From 0244e5bd65bf90c32693b27760d3512c1a19a332 Mon Sep 17 00:00:00 2001 From: rohitmalhotra1420 Date: Thu, 7 Nov 2024 12:13:12 +0530 Subject: [PATCH] Updates --- assets/{ccip-CiOu7uMi.js => ccip-DBR7mZLx.js} | 2 +- ...DPntdE7M.js => index-8e228000-VDftQdqf.js} | 2 +- .../{index-FF2LIIm3.js => index-BYSgwray.js} | 2 +- .../{index-B0ywuJCf.js => index-BobdBaP6.js} | 4 +- .../{index-CiyH7SV9.js => index-CyGt1Q2v.js} | 2172 +++++++++++++++-- assets/index-DfDZvzsB.css | 1 + assets/index-tWiYDii7.css | 1 - ...pto-Co9-WRDE.js => nodecrypto-DQxL8Shd.js} | 2 +- ...{purejs-IJPcfd_M.js => purejs-BR1xntTC.js} | 2 +- .../{utils-D-KHXRuV.js => utils-DtFhU_U4.js} | 2 +- ...ypto-3I5ubJVL.js => webcrypto-rHL-xC2P.js} | 2 +- index.html | 4 +- 12 files changed, 2013 insertions(+), 183 deletions(-) rename assets/{ccip-CiOu7uMi.js => ccip-DBR7mZLx.js} (97%) rename assets/{index-8e228000-DPntdE7M.js => index-8e228000-VDftQdqf.js} (99%) rename assets/{index-FF2LIIm3.js => index-BYSgwray.js} (99%) rename assets/{index-B0ywuJCf.js => index-BobdBaP6.js} (98%) rename assets/{index-CiyH7SV9.js => index-CyGt1Q2v.js} (53%) create mode 100644 assets/index-DfDZvzsB.css delete mode 100644 assets/index-tWiYDii7.css rename assets/{nodecrypto-Co9-WRDE.js => nodecrypto-DQxL8Shd.js} (64%) rename assets/{purejs-IJPcfd_M.js => purejs-BR1xntTC.js} (92%) rename assets/{utils-D-KHXRuV.js => utils-DtFhU_U4.js} (98%) rename assets/{webcrypto-3I5ubJVL.js => webcrypto-rHL-xC2P.js} (90%) diff --git a/assets/ccip-CiOu7uMi.js b/assets/ccip-DBR7mZLx.js similarity index 97% rename from assets/ccip-CiOu7uMi.js rename to assets/ccip-DBR7mZLx.js index 1b8ef15..2fbc56c 100644 --- a/assets/ccip-CiOu7uMi.js +++ b/assets/ccip-DBR7mZLx.js @@ -1 +1 @@ -import{j as p,k as m,l as y,m as k,n as b,o as O,q as E,t as L,H as h,v as x}from"./index-CiyH7SV9.js";class M extends p{constructor({callbackSelector:r,cause:a,data:o,extraData:i,sender:d,urls:t}){var n;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(n=a.metaMessages)!=null&&n.length?"":[],"Offchain Gateway Call:",t&&[" Gateway URL(s):",...t.map(f=>` ${m(f)}`)],` Sender: ${d}`,` Data: ${o}`,` Callback selector: ${r}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class R extends p{constructor({result:r,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${m(a)}`,`Response: ${y(r)}`],name:"OffchainLookupResponseMalformedError"})}}class S extends p{constructor({sender:r,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${r}`],name:"OffchainLookupSenderMismatchError"})}}const A="0x556f1830",$={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function C(c,{blockNumber:r,blockTag:a,data:o,to:i}){const{args:d}=k({data:o,abi:[$]}),[t,n,f,u,s]=d,{ccipRead:e}=c,w=e&&typeof(e==null?void 0:e.request)=="function"?e.request:q;try{if(!b(i,t))throw new S({sender:t,to:i});const l=await w({data:f,sender:t,urls:n}),{data:g}=await O(c,{blockNumber:r,blockTag:a,data:E([u,L([{type:"bytes"},{type:"bytes"}],[l,s])]),to:i});return g}catch(l){throw new M({callbackSelector:u,cause:l,data:o,extraData:s,sender:t,urls:n})}}async function q({data:c,sender:r,urls:a}){var i;let o=new Error("An unknown error occurred.");for(let d=0;d` ${m(f)}`)],` Sender: ${d}`,` Data: ${o}`,` Callback selector: ${r}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class R extends p{constructor({result:r,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${m(a)}`,`Response: ${y(r)}`],name:"OffchainLookupResponseMalformedError"})}}class S extends p{constructor({sender:r,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${r}`],name:"OffchainLookupSenderMismatchError"})}}const A="0x556f1830",$={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function C(c,{blockNumber:r,blockTag:a,data:o,to:i}){const{args:d}=k({data:o,abi:[$]}),[t,n,f,u,s]=d,{ccipRead:e}=c,w=e&&typeof(e==null?void 0:e.request)=="function"?e.request:q;try{if(!b(i,t))throw new S({sender:t,to:i});const l=await w({data:f,sender:t,urls:n}),{data:g}=await O(c,{blockNumber:r,blockTag:a,data:E([u,L([{type:"bytes"},{type:"bytes"}],[l,s])]),to:i});return g}catch(l){throw new M({callbackSelector:u,cause:l,data:o,extraData:s,sender:t,urls:n})}}async function q({data:c,sender:r,urls:a}){var i;let o=new Error("An unknown error occurred.");for(let d=0;de in t?Dl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,_e=(t,e,s)=>(jl(t,typeof e!="symbol"?e+"":e,s),s),Qi={exports:{}},ks=typeof Reflect=="object"?Reflect:null,zn=ks&&typeof ks.apply=="function"?ks.apply:function(t,e,s){return Function.prototype.apply.call(t,e,s)},$r;ks&&typeof ks.ownKeys=="function"?$r=ks.ownKeys:Object.getOwnPropertySymbols?$r=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:$r=function(t){return Object.getOwnPropertyNames(t)};function zl(t){console&&console.warn&&console.warn(t)}var Qa=Number.isNaN||function(t){return t!==t};function Pe(){Pe.init.call(this)}Qi.exports=Pe;Qi.exports.once=Kl;Pe.EventEmitter=Pe;Pe.prototype._events=void 0;Pe.prototype._eventsCount=0;Pe.prototype._maxListeners=void 0;var qn=10;function ri(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Pe,"defaultMaxListeners",{enumerable:!0,get:function(){return qn},set:function(t){if(typeof t!="number"||t<0||Qa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");qn=t}});Pe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Pe.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Qa(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Xa(t){return t._maxListeners===void 0?Pe.defaultMaxListeners:t._maxListeners}Pe.prototype.getMaxListeners=function(){return Xa(this)};Pe.prototype.emit=function(t){for(var e=[],s=1;s0&&(n=e[0]),n instanceof Error)throw n;var c=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw c.context=n,c}var a=i[t];if(a===void 0)return!1;if(typeof a=="function")zn(a,this,e);else for(var l=a.length,d=rc(a,l),s=0;s0&&c.length>i&&!c.warned){c.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=c.length,zl(a)}return t}Pe.prototype.addListener=function(t,e){return Za(this,t,e,!1)};Pe.prototype.on=Pe.prototype.addListener;Pe.prototype.prependListener=function(t,e){return Za(this,t,e,!0)};function ql(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ec(t,e,s){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:s},i=ql.bind(r);return i.listener=s,r.wrapFn=i,i}Pe.prototype.once=function(t,e){return ri(e),this.on(t,ec(this,t,e)),this};Pe.prototype.prependOnceListener=function(t,e){return ri(e),this.prependListener(t,ec(this,t,e)),this};Pe.prototype.removeListener=function(t,e){var s,r,i,n,c;if(ri(e),r=this._events,r===void 0)return this;if(s=r[t],s===void 0)return this;if(s===e||s.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,s.listener||e));else if(typeof s!="function"){for(i=-1,n=s.length-1;n>=0;n--)if(s[n]===e||s[n].listener===e){c=s[n].listener,i=n;break}if(i<0)return this;i===0?s.shift():$l(s,i),s.length===1&&(r[t]=s[0]),r.removeListener!==void 0&&this.emit("removeListener",t,c||e)}return this};Pe.prototype.off=Pe.prototype.removeListener;Pe.prototype.removeAllListeners=function(t){var e,s,r;if(s=this._events,s===void 0)return this;if(s.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):s[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete s[t]),this;if(arguments.length===0){var i=Object.keys(s),n;for(r=0;r=0;r--)this.removeListener(t,e[r]);return this};function tc(t,e,s){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?s?[i.listener||i]:[i]:s?Vl(i):rc(i,i.length)}Pe.prototype.listeners=function(t){return tc(this,t,!0)};Pe.prototype.rawListeners=function(t){return tc(this,t,!1)};Pe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):sc.call(t,e)};Pe.prototype.listenerCount=sc;function sc(t){var e=this._events;if(e!==void 0){var s=e[t];if(typeof s=="function")return 1;if(s!==void 0)return s.length}return 0}Pe.prototype.eventNames=function(){return this._eventsCount>0?$r(this._events):[]};function rc(t,e){for(var s=new Array(e),r=0;re in t?Dl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,_e=(t,e,s)=>(jl(t,typeof e!="symbol"?e+"":e,s),s),Qi={exports:{}},ks=typeof Reflect=="object"?Reflect:null,zn=ks&&typeof ks.apply=="function"?ks.apply:function(t,e,s){return Function.prototype.apply.call(t,e,s)},$r;ks&&typeof ks.ownKeys=="function"?$r=ks.ownKeys:Object.getOwnPropertySymbols?$r=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:$r=function(t){return Object.getOwnPropertyNames(t)};function zl(t){console&&console.warn&&console.warn(t)}var Qa=Number.isNaN||function(t){return t!==t};function Pe(){Pe.init.call(this)}Qi.exports=Pe;Qi.exports.once=Kl;Pe.EventEmitter=Pe;Pe.prototype._events=void 0;Pe.prototype._eventsCount=0;Pe.prototype._maxListeners=void 0;var qn=10;function ri(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Pe,"defaultMaxListeners",{enumerable:!0,get:function(){return qn},set:function(t){if(typeof t!="number"||t<0||Qa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");qn=t}});Pe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Pe.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Qa(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Xa(t){return t._maxListeners===void 0?Pe.defaultMaxListeners:t._maxListeners}Pe.prototype.getMaxListeners=function(){return Xa(this)};Pe.prototype.emit=function(t){for(var e=[],s=1;s0&&(n=e[0]),n instanceof Error)throw n;var c=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw c.context=n,c}var a=i[t];if(a===void 0)return!1;if(typeof a=="function")zn(a,this,e);else for(var l=a.length,d=rc(a,l),s=0;s0&&c.length>i&&!c.warned){c.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=c.length,zl(a)}return t}Pe.prototype.addListener=function(t,e){return Za(this,t,e,!1)};Pe.prototype.on=Pe.prototype.addListener;Pe.prototype.prependListener=function(t,e){return Za(this,t,e,!0)};function ql(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ec(t,e,s){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:s},i=ql.bind(r);return i.listener=s,r.wrapFn=i,i}Pe.prototype.once=function(t,e){return ri(e),this.on(t,ec(this,t,e)),this};Pe.prototype.prependOnceListener=function(t,e){return ri(e),this.prependListener(t,ec(this,t,e)),this};Pe.prototype.removeListener=function(t,e){var s,r,i,n,c;if(ri(e),r=this._events,r===void 0)return this;if(s=r[t],s===void 0)return this;if(s===e||s.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,s.listener||e));else if(typeof s!="function"){for(i=-1,n=s.length-1;n>=0;n--)if(s[n]===e||s[n].listener===e){c=s[n].listener,i=n;break}if(i<0)return this;i===0?s.shift():$l(s,i),s.length===1&&(r[t]=s[0]),r.removeListener!==void 0&&this.emit("removeListener",t,c||e)}return this};Pe.prototype.off=Pe.prototype.removeListener;Pe.prototype.removeAllListeners=function(t){var e,s,r;if(s=this._events,s===void 0)return this;if(s.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):s[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete s[t]),this;if(arguments.length===0){var i=Object.keys(s),n;for(r=0;r=0;r--)this.removeListener(t,e[r]);return this};function tc(t,e,s){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?s?[i.listener||i]:[i]:s?Vl(i):rc(i,i.length)}Pe.prototype.listeners=function(t){return tc(this,t,!0)};Pe.prototype.rawListeners=function(t){return tc(this,t,!1)};Pe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):sc.call(t,e)};Pe.prototype.listenerCount=sc;function sc(t){var e=this._events;if(e!==void 0){var s=e[t];if(typeof s=="function")return 1;if(s!==void 0)return s.length}return 0}Pe.prototype.eventNames=function(){return this._eventsCount>0?$r(this._events):[]};function rc(t,e){for(var s=new Array(e),r=0;ri.map(i=>d[i]); -import{B as pe,_ as me}from"./index-CiyH7SV9.js";const he=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,ge=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ye=e=>ge(e)&&e[he]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"},F=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ve=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),F(r)&&(r=ye(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[be]=ve();function P(e={}){return be(e)}function S(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return S(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=pe.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),_e={state:p,subscribe(e){return S(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return S(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;_e.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ce=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))We.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=Ce({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ae.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Re={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return S(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var De=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ue=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))je.call(t,s)&&le(e,s,t[s]);return e};function Te(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Te()?"dark":"light"}),ce={state:k,subscribe(e){return S(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=Ue({},s))}},D=P({open:!1,message:"",variant:"success"}),Ve={state:D,subscribe(e){return S(D,()=>e(D))},openToast(e,t){D.open=!0,D.message=e,D.variant=t},closeToast(){D.open=!1}};class $e{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await me(()=>import("./index-FF2LIIm3.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const xe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:$e},Symbol.toStringTag,{value:"Module"}));export{m as C,Re as E,J as M,w as O,de as R,ce as T,Ve as a,_e as b,$ as c,xe as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BYSgwray.js","assets/index-CyGt1Q2v.js","assets/index-DfDZvzsB.css"])))=>i.map(i=>d[i]); +import{B as pe,_ as me}from"./index-CyGt1Q2v.js";const he=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,ge=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ye=e=>ge(e)&&e[he]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"},F=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ve=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),F(r)&&(r=ye(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[be]=ve();function P(e={}){return be(e)}function S(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return S(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=pe.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),_e={state:p,subscribe(e){return S(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return S(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;_e.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ce=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))We.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=Ce({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ae.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Re={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return S(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var De=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ue=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))je.call(t,s)&&le(e,s,t[s]);return e};function Te(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Te()?"dark":"light"}),ce={state:k,subscribe(e){return S(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=Ue({},s))}},D=P({open:!1,message:"",variant:"success"}),Ve={state:D,subscribe(e){return S(D,()=>e(D))},openToast(e,t){D.open=!0,D.message=e,D.variant=t},closeToast(){D.open=!1}};class $e{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await me(()=>import("./index-BYSgwray.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const xe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:$e},Symbol.toStringTag,{value:"Module"}));export{m as C,Re as E,J as M,w as O,de as R,ce as T,Ve as a,_e as b,$ as c,xe as i}; diff --git a/assets/index-CiyH7SV9.js b/assets/index-CyGt1Q2v.js similarity index 53% rename from assets/index-CiyH7SV9.js rename to assets/index-CyGt1Q2v.js index fa0b605..584cdb4 100644 --- a/assets/index-CiyH7SV9.js +++ b/assets/index-CyGt1Q2v.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webcrypto-3I5ubJVL.js","assets/utils-D-KHXRuV.js","assets/nodecrypto-Co9-WRDE.js"])))=>i.map(i=>d[i]); -var _6=Object.defineProperty;var x6=(Xr,eo,to)=>eo in Xr?_6(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to;var Qu=(Xr,eo,to)=>x6(Xr,typeof eo!="symbol"?eo+"":eo,to);function _mergeNamespaces(Xr,eo){for(var to=0;toro[no]})}}}return Object.freeze(Object.defineProperty(Xr,Symbol.toStringTag,{value:"Module"}))}(function(){const eo=document.createElement("link").relList;if(eo&&eo.supports&&eo.supports("modulepreload"))return;for(const no of document.querySelectorAll('link[rel="modulepreload"]'))ro(no);new MutationObserver(no=>{for(const io of no)if(io.type==="childList")for(const oo of io.addedNodes)oo.tagName==="LINK"&&oo.rel==="modulepreload"&&ro(oo)}).observe(document,{childList:!0,subtree:!0});function to(no){const io={};return no.integrity&&(io.integrity=no.integrity),no.referrerPolicy&&(io.referrerPolicy=no.referrerPolicy),no.crossOrigin==="use-credentials"?io.credentials="include":no.crossOrigin==="anonymous"?io.credentials="omit":io.credentials="same-origin",io}function ro(no){if(no.ep)return;no.ep=!0;const io=to(no);fetch(no.href,io)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$2(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}function getAugmentedNamespace(Xr){if(Xr.__esModule)return Xr;var eo=Xr.default;if(typeof eo=="function"){var to=function ro(){return this instanceof ro?Reflect.construct(eo,arguments,this.constructor):eo.apply(this,arguments)};to.prototype=eo.prototype}else to={};return Object.defineProperty(to,"__esModule",{value:!0}),Object.keys(Xr).forEach(function(ro){var no=Object.getOwnPropertyDescriptor(Xr,ro);Object.defineProperty(to,ro,no.get?no:{enumerable:!0,get:function(){return Xr[ro]}})}),to}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webcrypto-rHL-xC2P.js","assets/utils-DtFhU_U4.js","assets/nodecrypto-DQxL8Shd.js"])))=>i.map(i=>d[i]); +var xC=Object.defineProperty;var EC=(Xr,eo,to)=>eo in Xr?xC(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to;var sp=(Xr,eo,to)=>EC(Xr,typeof eo!="symbol"?eo+"":eo,to);function _mergeNamespaces(Xr,eo){for(var to=0;toro[no]})}}}return Object.freeze(Object.defineProperty(Xr,Symbol.toStringTag,{value:"Module"}))}(function(){const eo=document.createElement("link").relList;if(eo&&eo.supports&&eo.supports("modulepreload"))return;for(const no of document.querySelectorAll('link[rel="modulepreload"]'))ro(no);new MutationObserver(no=>{for(const io of no)if(io.type==="childList")for(const oo of io.addedNodes)oo.tagName==="LINK"&&oo.rel==="modulepreload"&&ro(oo)}).observe(document,{childList:!0,subtree:!0});function to(no){const io={};return no.integrity&&(io.integrity=no.integrity),no.referrerPolicy&&(io.referrerPolicy=no.referrerPolicy),no.crossOrigin==="use-credentials"?io.credentials="include":no.crossOrigin==="anonymous"?io.credentials="omit":io.credentials="same-origin",io}function ro(no){if(no.ep)return;no.ep=!0;const io=to(no);fetch(no.href,io)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$2(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}function getAugmentedNamespace(Xr){if(Xr.__esModule)return Xr;var eo=Xr.default;if(typeof eo=="function"){var to=function ro(){return this instanceof ro?Reflect.construct(eo,arguments,this.constructor):eo.apply(this,arguments)};to.prototype=eo.prototype}else to={};return Object.defineProperty(to,"__esModule",{value:!0}),Object.keys(Xr).forEach(function(ro){var no=Object.getOwnPropertyDescriptor(Xr,ro);Object.defineProperty(to,ro,no.get?no:{enumerable:!0,get:function(){return Xr[ro]}})}),to}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js * @@ -7,7 +7,7 @@ var _6=Object.defineProperty;var x6=(Xr,eo,to)=>eo in Xr?_6(Xr,eo,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var l$9=Symbol.for("react.element"),n$7=Symbol.for("react.portal"),p$b=Symbol.for("react.fragment"),q$a=Symbol.for("react.strict_mode"),r$7=Symbol.for("react.profiler"),t$5=Symbol.for("react.provider"),u$6=Symbol.for("react.context"),v$a=Symbol.for("react.forward_ref"),w$b=Symbol.for("react.suspense"),x$8=Symbol.for("react.memo"),y$c=Symbol.for("react.lazy"),z$c=Symbol.iterator;function A$9(Xr){return Xr===null||typeof Xr!="object"?null:(Xr=z$c&&Xr[z$c]||Xr["@@iterator"],typeof Xr=="function"?Xr:null)}var B$8={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$8=Object.assign,D$9={};function E$a(Xr,eo,to){this.props=Xr,this.context=eo,this.refs=D$9,this.updater=to||B$8}E$a.prototype.isReactComponent={};E$a.prototype.setState=function(Xr,eo){if(typeof Xr!="object"&&typeof Xr!="function"&&Xr!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Xr,eo,"setState")};E$a.prototype.forceUpdate=function(Xr){this.updater.enqueueForceUpdate(this,Xr,"forceUpdate")};function F$9(){}F$9.prototype=E$a.prototype;function G$6(Xr,eo,to){this.props=Xr,this.context=eo,this.refs=D$9,this.updater=to||B$8}var H$6=G$6.prototype=new F$9;H$6.constructor=G$6;C$8(H$6,E$a.prototype);H$6.isPureReactComponent=!0;var I$3=Array.isArray,J$5=Object.prototype.hasOwnProperty,K$6={current:null},L$a={key:!0,ref:!0,__self:!0,__source:!0};function M$7(Xr,eo,to){var ro,no={},io=null,oo=null;if(eo!=null)for(ro in eo.ref!==void 0&&(oo=eo.ref),eo.key!==void 0&&(io=""+eo.key),eo)J$5.call(eo,ro)&&!L$a.hasOwnProperty(ro)&&(no[ro]=eo[ro]);var ao=arguments.length-2;if(ao===1)no.children=to;else if(1eo in Xr?_6(Xr,eo,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var f$c=reactExports,k$7=Symbol.for("react.element"),l$8=Symbol.for("react.fragment"),m$7=Object.prototype.hasOwnProperty,n$6=f$c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$a={key:!0,ref:!0,__self:!0,__source:!0};function q$9(Xr,eo,to){var ro,no={},io=null,oo=null;to!==void 0&&(io=""+to),eo.key!==void 0&&(io=""+eo.key),eo.ref!==void 0&&(oo=eo.ref);for(ro in eo)m$7.call(eo,ro)&&!p$a.hasOwnProperty(ro)&&(no[ro]=eo[ro]);if(Xr&&Xr.defaultProps)for(ro in eo=Xr.defaultProps,eo)no[ro]===void 0&&(no[ro]=eo[ro]);return{$$typeof:k$7,type:Xr,key:io,ref:oo,props:no,_owner:n$6.current}}reactJsxRuntime_production_min.Fragment=l$8;reactJsxRuntime_production_min.jsx=q$9;reactJsxRuntime_production_min.jsxs=q$9;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,client$1={},reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** + */var f$d=reactExports,k$9=Symbol.for("react.element"),l$a=Symbol.for("react.fragment"),m$9=Object.prototype.hasOwnProperty,n$d=f$d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$e={key:!0,ref:!0,__self:!0,__source:!0};function q$b(Xr,eo,to){var ro,no={},io=null,oo=null;to!==void 0&&(io=""+to),eo.key!==void 0&&(io=""+eo.key),eo.ref!==void 0&&(oo=eo.ref);for(ro in eo)m$9.call(eo,ro)&&!p$e.hasOwnProperty(ro)&&(no[ro]=eo[ro]);if(Xr&&Xr.defaultProps)for(ro in eo=Xr.defaultProps,eo)no[ro]===void 0&&(no[ro]=eo[ro]);return{$$typeof:k$9,type:Xr,key:io,ref:oo,props:no,_owner:n$d.current}}reactJsxRuntime_production_min.Fragment=l$a;reactJsxRuntime_production_min.jsx=q$b;reactJsxRuntime_production_min.jsxs=q$b;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,client$1={},reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** * @license React * scheduler.production.min.js * @@ -23,7 +23,7 @@ var _6=Object.defineProperty;var x6=(Xr,eo,to)=>eo in Xr?_6(Xr,eo,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(Xr){function eo($o,Co){var Ro=$o.length;$o.push(Co);e:for(;0>>1,mo=$o[So];if(0>>1;Sono(Zo,Ro))Qono(qo,Zo)?($o[So]=qo,$o[Qo]=Ro,So=Qo):($o[So]=Zo,$o[Vo]=Ro,So=Vo);else if(Qono(qo,Ro))$o[So]=qo,$o[Qo]=Ro,So=Qo;else break e}}return Co}function no($o,Co){var Ro=$o.sortIndex-Co.sortIndex;return Ro!==0?Ro:$o.id-Co.id}if(typeof performance=="object"&&typeof performance.now=="function"){var io=performance;Xr.unstable_now=function(){return io.now()}}else{var oo=Date,ao=oo.now();Xr.unstable_now=function(){return oo.now()-ao}}var so=[],co=[],lo=1,fo=null,ho=3,go=!1,yo=!1,vo=!1,wo=typeof setTimeout=="function"?setTimeout:null,Eo=typeof clearTimeout=="function"?clearTimeout:null,ko=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Ao($o){for(var Co=to(co);Co!==null;){if(Co.callback===null)ro(co);else if(Co.startTime<=$o)ro(co),Co.sortIndex=Co.expirationTime,eo(so,Co);else break;Co=to(co)}}function Po($o){if(vo=!1,Ao($o),!yo)if(to(so)!==null)yo=!0,bo(jo);else{var Co=to(co);Co!==null&&_o(Po,Co.startTime-$o)}}function jo($o,Co){yo=!1,vo&&(vo=!1,Eo(Do),Do=-1),go=!0;var Ro=ho;try{for(Ao(Co),fo=to(so);fo!==null&&(!(fo.expirationTime>Co)||$o&&!Lo());){var So=fo.callback;if(typeof So=="function"){fo.callback=null,ho=fo.priorityLevel;var mo=So(fo.expirationTime<=Co);Co=Xr.unstable_now(),typeof mo=="function"?fo.callback=mo:fo===to(so)&&ro(so),Ao(Co)}else ro(so);fo=to(so)}if(fo!==null)var To=!0;else{var Vo=to(co);Vo!==null&&_o(Po,Vo.startTime-Co),To=!1}return To}finally{fo=null,ho=Ro,go=!1}}var Mo=!1,No=null,Do=-1,Fo=5,Xo=-1;function Lo(){return!(Xr.unstable_now()-Xo$o||125<$o?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fo=0<$o?Math.floor(1e3/$o):5},Xr.unstable_getCurrentPriorityLevel=function(){return ho},Xr.unstable_getFirstCallbackNode=function(){return to(so)},Xr.unstable_next=function($o){switch(ho){case 1:case 2:case 3:var Co=3;break;default:Co=ho}var Ro=ho;ho=Co;try{return $o()}finally{ho=Ro}},Xr.unstable_pauseExecution=function(){},Xr.unstable_requestPaint=function(){},Xr.unstable_runWithPriority=function($o,Co){switch($o){case 1:case 2:case 3:case 4:case 5:break;default:$o=3}var Ro=ho;ho=$o;try{return Co()}finally{ho=Ro}},Xr.unstable_scheduleCallback=function($o,Co,Ro){var So=Xr.unstable_now();switch(typeof Ro=="object"&&Ro!==null?(Ro=Ro.delay,Ro=typeof Ro=="number"&&0So?($o.sortIndex=Ro,eo(co,$o),to(so)===null&&$o===to(co)&&(vo?(Eo(Do),Do=-1):vo=!0,_o(Po,Ro-So))):($o.sortIndex=mo,eo(so,$o),yo||go||(yo=!0,bo(jo))),$o},Xr.unstable_shouldYield=Lo,Xr.unstable_wrapCallback=function($o){var Co=ho;return function(){var Ro=ho;ho=Co;try{return $o.apply(this,arguments)}finally{ho=Ro}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + */(function(Xr){function eo(Ao,ko){var mo=Ao.length;Ao.push(ko);e:for(;0>>1,Do=Ao[Io];if(0>>1;Iono(Yo,mo))Xono(qo,Yo)?(Ao[Io]=qo,Ao[Xo]=mo,Io=Xo):(Ao[Io]=Yo,Ao[Ho]=mo,Io=Ho);else if(Xono(qo,mo))Ao[Io]=qo,Ao[Xo]=mo,Io=Xo;else break e}}return ko}function no(Ao,ko){var mo=Ao.sortIndex-ko.sortIndex;return mo!==0?mo:Ao.id-ko.id}if(typeof performance=="object"&&typeof performance.now=="function"){var io=performance;Xr.unstable_now=function(){return io.now()}}else{var oo=Date,ao=oo.now();Xr.unstable_now=function(){return oo.now()-ao}}var so=[],co=[],lo=1,uo=null,ho=3,go=!1,bo=!1,wo=!1,Eo=typeof setTimeout=="function"?setTimeout:null,$o=typeof clearTimeout=="function"?clearTimeout:null,Co=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Ro(Ao){for(var ko=to(co);ko!==null;){if(ko.callback===null)ro(co);else if(ko.startTime<=Ao)ro(co),ko.sortIndex=ko.expirationTime,eo(so,ko);else break;ko=to(co)}}function Oo(Ao){if(wo=!1,Ro(Ao),!bo)if(to(so)!==null)bo=!0,So(jo);else{var ko=to(co);ko!==null&&To(Oo,ko.startTime-Ao)}}function jo(Ao,ko){bo=!1,wo&&(wo=!1,$o(Fo),Fo=-1),go=!0;var mo=ho;try{for(Ro(ko),uo=to(so);uo!==null&&(!(uo.expirationTime>ko)||Ao&&!Po());){var Io=uo.callback;if(typeof Io=="function"){uo.callback=null,ho=uo.priorityLevel;var Do=Io(uo.expirationTime<=ko);ko=Xr.unstable_now(),typeof Do=="function"?uo.callback=Do:uo===to(so)&&ro(so),Ro(ko)}else ro(so);uo=to(so)}if(uo!==null)var Lo=!0;else{var Ho=to(co);Ho!==null&&To(Oo,Ho.startTime-ko),Lo=!1}return Lo}finally{uo=null,ho=mo,go=!1}}var Bo=!1,Mo=null,Fo=-1,Wo=5,Jo=-1;function Po(){return!(Xr.unstable_now()-JoAo||125Io?(Ao.sortIndex=mo,eo(co,Ao),to(so)===null&&Ao===to(co)&&(wo?($o(Fo),Fo=-1):wo=!0,To(Oo,mo-Io))):(Ao.sortIndex=Do,eo(so,Ao),bo||go||(bo=!0,So(jo))),Ao},Xr.unstable_shouldYield=Po,Xr.unstable_wrapCallback=function(Ao){var ko=ho;return function(){var mo=ho;ho=ko;try{return Ao.apply(this,arguments)}finally{ho=mo}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** * @license React * react-dom.production.min.js * @@ -31,14 +31,14 @@ var _6=Object.defineProperty;var x6=(Xr,eo,to)=>eo in Xr?_6(Xr,eo,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var aa$1=reactExports,ca$1=schedulerExports;function p$9(Xr){for(var eo="https://reactjs.org/docs/error-decoder.html?invariant="+Xr,to=1;to"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la$1={},ma={};function oa$1(Xr){return ja.call(ma,Xr)?!0:ja.call(la$1,Xr)?!1:ka.test(Xr)?ma[Xr]=!0:(la$1[Xr]=!0,!1)}function pa$1(Xr,eo,to,ro){if(to!==null&&to.type===0)return!1;switch(typeof eo){case"function":case"symbol":return!0;case"boolean":return ro?!1:to!==null?!to.acceptsBooleans:(Xr=Xr.toLowerCase().slice(0,5),Xr!=="data-"&&Xr!=="aria-");default:return!1}}function qa(Xr,eo,to,ro){if(eo===null||typeof eo>"u"||pa$1(Xr,eo,to,ro))return!0;if(ro)return!1;if(to!==null)switch(to.type){case 3:return!eo;case 4:return eo===!1;case 5:return isNaN(eo);case 6:return isNaN(eo)||1>eo}return!1}function v$9(Xr,eo,to,ro,no,io,oo){this.acceptsBooleans=eo===2||eo===3||eo===4,this.attributeName=ro,this.attributeNamespace=no,this.mustUseProperty=to,this.propertyName=Xr,this.type=eo,this.sanitizeURL=io,this.removeEmptyString=oo}var z$b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(Xr){z$b[Xr]=new v$9(Xr,0,!1,Xr,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(Xr){var eo=Xr[0];z$b[eo]=new v$9(eo,1,!1,Xr[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,2,!1,Xr.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,2,!1,Xr,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(Xr){z$b[Xr]=new v$9(Xr,3,!1,Xr.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,3,!0,Xr,null,!1,!1)});["capture","download"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,4,!1,Xr,null,!1,!1)});["cols","rows","size","span"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,6,!1,Xr,null,!1,!1)});["rowSpan","start"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,5,!1,Xr.toLowerCase(),null,!1,!1)});var ra$1=/[\-:]([a-z])/g;function sa$1(Xr){return Xr[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$b[eo]=new v$9(eo,1,!1,Xr,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$b[eo]=new v$9(eo,1,!1,Xr,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$b[eo]=new v$9(eo,1,!1,Xr,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,1,!1,Xr.toLowerCase(),null,!1,!1)});z$b.xlinkHref=new v$9("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(Xr){z$b[Xr]=new v$9(Xr,1,!1,Xr.toLowerCase(),null,!0,!0)});function ta$1(Xr,eo,to,ro){var no=z$b.hasOwnProperty(eo)?z$b[eo]:null;(no!==null?no.type!==0:ro||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la$1={},ma={};function oa$1(Xr){return ja.call(ma,Xr)?!0:ja.call(la$1,Xr)?!1:ka.test(Xr)?ma[Xr]=!0:(la$1[Xr]=!0,!1)}function pa$1(Xr,eo,to,ro){if(to!==null&&to.type===0)return!1;switch(typeof eo){case"function":case"symbol":return!0;case"boolean":return ro?!1:to!==null?!to.acceptsBooleans:(Xr=Xr.toLowerCase().slice(0,5),Xr!=="data-"&&Xr!=="aria-");default:return!1}}function qa(Xr,eo,to,ro){if(eo===null||typeof eo>"u"||pa$1(Xr,eo,to,ro))return!0;if(ro)return!1;if(to!==null)switch(to.type){case 3:return!eo;case 4:return eo===!1;case 5:return isNaN(eo);case 6:return isNaN(eo)||1>eo}return!1}function v$e(Xr,eo,to,ro,no,io,oo){this.acceptsBooleans=eo===2||eo===3||eo===4,this.attributeName=ro,this.attributeNamespace=no,this.mustUseProperty=to,this.propertyName=Xr,this.type=eo,this.sanitizeURL=io,this.removeEmptyString=oo}var z$c={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(Xr){z$c[Xr]=new v$e(Xr,0,!1,Xr,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(Xr){var eo=Xr[0];z$c[eo]=new v$e(eo,1,!1,Xr[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,2,!1,Xr.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,2,!1,Xr,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(Xr){z$c[Xr]=new v$e(Xr,3,!1,Xr.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,3,!0,Xr,null,!1,!1)});["capture","download"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,4,!1,Xr,null,!1,!1)});["cols","rows","size","span"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,6,!1,Xr,null,!1,!1)});["rowSpan","start"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,5,!1,Xr.toLowerCase(),null,!1,!1)});var ra$1=/[\-:]([a-z])/g;function sa$1(Xr){return Xr[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$c[eo]=new v$e(eo,1,!1,Xr,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$c[eo]=new v$e(eo,1,!1,Xr,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(Xr){var eo=Xr.replace(ra$1,sa$1);z$c[eo]=new v$e(eo,1,!1,Xr,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,1,!1,Xr.toLowerCase(),null,!1,!1)});z$c.xlinkHref=new v$e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(Xr){z$c[Xr]=new v$e(Xr,1,!1,Xr.toLowerCase(),null,!0,!0)});function ta$1(Xr,eo,to,ro){var no=z$c.hasOwnProperty(eo)?z$c[eo]:null;(no!==null?no.type!==0:ro||!(2ao||no[oo]!==io[ao]){var so=` -`+no[oo].replace(" at new "," at ");return Xr.displayName&&so.includes("")&&(so=so.replace("",Xr.displayName)),so}while(1<=oo&&0<=ao);break}}}finally{Na=!1,Error.prepareStackTrace=to}return(Xr=Xr?Xr.displayName||Xr.name:"")?Ma(Xr):""}function Pa(Xr){switch(Xr.tag){case 5:return Ma(Xr.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return Xr=Oa$1(Xr.type,!1),Xr;case 11:return Xr=Oa$1(Xr.type.render,!1),Xr;case 1:return Xr=Oa$1(Xr.type,!0),Xr;default:return""}}function Qa(Xr){if(Xr==null)return null;if(typeof Xr=="function")return Xr.displayName||Xr.name||null;if(typeof Xr=="string")return Xr;switch(Xr){case ya$1:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea$1:return"Suspense";case Fa:return"SuspenseList"}if(typeof Xr=="object")switch(Xr.$$typeof){case Ca:return(Xr.displayName||"Context")+".Consumer";case Ba:return(Xr._context.displayName||"Context")+".Provider";case Da:var eo=Xr.render;return Xr=Xr.displayName,Xr||(Xr=eo.displayName||eo.name||"",Xr=Xr!==""?"ForwardRef("+Xr+")":"ForwardRef"),Xr;case Ga:return eo=Xr.displayName||null,eo!==null?eo:Qa(Xr.type)||"Memo";case Ha:eo=Xr._payload,Xr=Xr._init;try{return Qa(Xr(eo))}catch{}}return null}function Ra$1(Xr){var eo=Xr.type;switch(Xr.tag){case 24:return"Cache";case 9:return(eo.displayName||"Context")+".Consumer";case 10:return(eo._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return Xr=eo.render,Xr=Xr.displayName||Xr.name||"",eo.displayName||(Xr!==""?"ForwardRef("+Xr+")":"ForwardRef");case 7:return"Fragment";case 5:return eo;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(eo);case 8:return eo===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof eo=="function")return eo.displayName||eo.name||null;if(typeof eo=="string")return eo}return null}function Sa$1(Xr){switch(typeof Xr){case"boolean":case"number":case"string":case"undefined":return Xr;case"object":return Xr;default:return""}}function Ta$1(Xr){var eo=Xr.type;return(Xr=Xr.nodeName)&&Xr.toLowerCase()==="input"&&(eo==="checkbox"||eo==="radio")}function Ua(Xr){var eo=Ta$1(Xr)?"checked":"value",to=Object.getOwnPropertyDescriptor(Xr.constructor.prototype,eo),ro=""+Xr[eo];if(!Xr.hasOwnProperty(eo)&&typeof to<"u"&&typeof to.get=="function"&&typeof to.set=="function"){var no=to.get,io=to.set;return Object.defineProperty(Xr,eo,{configurable:!0,get:function(){return no.call(this)},set:function(oo){ro=""+oo,io.call(this,oo)}}),Object.defineProperty(Xr,eo,{enumerable:to.enumerable}),{getValue:function(){return ro},setValue:function(oo){ro=""+oo},stopTracking:function(){Xr._valueTracker=null,delete Xr[eo]}}}}function Va(Xr){Xr._valueTracker||(Xr._valueTracker=Ua(Xr))}function Wa(Xr){if(!Xr)return!1;var eo=Xr._valueTracker;if(!eo)return!0;var to=eo.getValue(),ro="";return Xr&&(ro=Ta$1(Xr)?Xr.checked?"true":"false":Xr.value),Xr=ro,Xr!==to?(eo.setValue(Xr),!0):!1}function Xa(Xr){if(Xr=Xr||(typeof document<"u"?document:void 0),typeof Xr>"u")return null;try{return Xr.activeElement||Xr.body}catch{return Xr.body}}function Ya(Xr,eo){var to=eo.checked;return A$8({},eo,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:to??Xr._wrapperState.initialChecked})}function Za(Xr,eo){var to=eo.defaultValue==null?"":eo.defaultValue,ro=eo.checked!=null?eo.checked:eo.defaultChecked;to=Sa$1(eo.value!=null?eo.value:to),Xr._wrapperState={initialChecked:ro,initialValue:to,controlled:eo.type==="checkbox"||eo.type==="radio"?eo.checked!=null:eo.value!=null}}function ab(Xr,eo){eo=eo.checked,eo!=null&&ta$1(Xr,"checked",eo,!1)}function bb(Xr,eo){ab(Xr,eo);var to=Sa$1(eo.value),ro=eo.type;if(to!=null)ro==="number"?(to===0&&Xr.value===""||Xr.value!=to)&&(Xr.value=""+to):Xr.value!==""+to&&(Xr.value=""+to);else if(ro==="submit"||ro==="reset"){Xr.removeAttribute("value");return}eo.hasOwnProperty("value")?cb(Xr,eo.type,to):eo.hasOwnProperty("defaultValue")&&cb(Xr,eo.type,Sa$1(eo.defaultValue)),eo.checked==null&&eo.defaultChecked!=null&&(Xr.defaultChecked=!!eo.defaultChecked)}function db(Xr,eo,to){if(eo.hasOwnProperty("value")||eo.hasOwnProperty("defaultValue")){var ro=eo.type;if(!(ro!=="submit"&&ro!=="reset"||eo.value!==void 0&&eo.value!==null))return;eo=""+Xr._wrapperState.initialValue,to||eo===Xr.value||(Xr.value=eo),Xr.defaultValue=eo}to=Xr.name,to!==""&&(Xr.name=""),Xr.defaultChecked=!!Xr._wrapperState.initialChecked,to!==""&&(Xr.name=to)}function cb(Xr,eo,to){(eo!=="number"||Xa(Xr.ownerDocument)!==Xr)&&(to==null?Xr.defaultValue=""+Xr._wrapperState.initialValue:Xr.defaultValue!==""+to&&(Xr.defaultValue=""+to))}var eb=Array.isArray;function fb(Xr,eo,to,ro){if(Xr=Xr.options,eo){eo={};for(var no=0;no"+eo.valueOf().toString()+"",eo=mb.firstChild;Xr.firstChild;)Xr.removeChild(Xr.firstChild);for(;eo.firstChild;)Xr.appendChild(eo.firstChild)}});function ob(Xr,eo){if(eo){var to=Xr.firstChild;if(to&&to===Xr.lastChild&&to.nodeType===3){to.nodeValue=eo;return}}Xr.textContent=eo}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(Xr){qb.forEach(function(eo){eo=eo+Xr.charAt(0).toUpperCase()+Xr.substring(1),pb[eo]=pb[Xr]})});function rb(Xr,eo,to){return eo==null||typeof eo=="boolean"||eo===""?"":to||typeof eo!="number"||eo===0||pb.hasOwnProperty(Xr)&&pb[Xr]?(""+eo).trim():eo+"px"}function sb(Xr,eo){Xr=Xr.style;for(var to in eo)if(eo.hasOwnProperty(to)){var ro=to.indexOf("--")===0,no=rb(to,eo[to],ro);to==="float"&&(to="cssFloat"),ro?Xr.setProperty(to,no):Xr[to]=no}}var tb=A$8({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(Xr,eo){if(eo){if(tb[Xr]&&(eo.children!=null||eo.dangerouslySetInnerHTML!=null))throw Error(p$9(137,Xr));if(eo.dangerouslySetInnerHTML!=null){if(eo.children!=null)throw Error(p$9(60));if(typeof eo.dangerouslySetInnerHTML!="object"||!("__html"in eo.dangerouslySetInnerHTML))throw Error(p$9(61))}if(eo.style!=null&&typeof eo.style!="object")throw Error(p$9(62))}}function vb(Xr,eo){if(Xr.indexOf("-")===-1)return typeof eo.is=="string";switch(Xr){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(Xr){return Xr=Xr.target||Xr.srcElement||window,Xr.correspondingUseElement&&(Xr=Xr.correspondingUseElement),Xr.nodeType===3?Xr.parentNode:Xr}var yb=null,zb=null,Ab=null;function Bb(Xr){if(Xr=Cb(Xr)){if(typeof yb!="function")throw Error(p$9(280));var eo=Xr.stateNode;eo&&(eo=Db(eo),yb(Xr.stateNode,Xr.type,eo))}}function Eb(Xr){zb?Ab?Ab.push(Xr):Ab=[Xr]:zb=Xr}function Fb(){if(zb){var Xr=zb,eo=Ab;if(Ab=zb=null,Bb(Xr),eo)for(Xr=0;Xr>>=0,Xr===0?32:31-(pc(Xr)/qc|0)|0}var rc=64,sc=4194304;function tc(Xr){switch(Xr&-Xr){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return Xr&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return Xr&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return Xr}}function uc(Xr,eo){var to=Xr.pendingLanes;if(to===0)return 0;var ro=0,no=Xr.suspendedLanes,io=Xr.pingedLanes,oo=to&268435455;if(oo!==0){var ao=oo&~no;ao!==0?ro=tc(ao):(io&=oo,io!==0&&(ro=tc(io)))}else oo=to&~no,oo!==0?ro=tc(oo):io!==0&&(ro=tc(io));if(ro===0)return 0;if(eo!==0&&eo!==ro&&!(eo&no)&&(no=ro&-ro,io=eo&-eo,no>=io||no===16&&(io&4194240)!==0))return eo;if(ro&4&&(ro|=to&16),eo=Xr.entangledLanes,eo!==0)for(Xr=Xr.entanglements,eo&=ro;0to;to++)eo.push(Xr);return eo}function Ac(Xr,eo,to){Xr.pendingLanes|=eo,eo!==536870912&&(Xr.suspendedLanes=0,Xr.pingedLanes=0),Xr=Xr.eventTimes,eo=31-oc(eo),Xr[eo]=to}function Bc(Xr,eo){var to=Xr.pendingLanes&~eo;Xr.pendingLanes=eo,Xr.suspendedLanes=0,Xr.pingedLanes=0,Xr.expiredLanes&=eo,Xr.mutableReadLanes&=eo,Xr.entangledLanes&=eo,eo=Xr.entanglements;var ro=Xr.eventTimes;for(Xr=Xr.expirationTimes;0=be$2),ee$6=" ",fe$2=!1;function ge$5(Xr,eo){switch(Xr){case"keyup":return $d.indexOf(eo.keyCode)!==-1;case"keydown":return eo.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$4(Xr){return Xr=Xr.detail,typeof Xr=="object"&&"data"in Xr?Xr.data:null}var ie$4=!1;function je$3(Xr,eo){switch(Xr){case"compositionend":return he$4(eo);case"keypress":return eo.which!==32?null:(fe$2=!0,ee$6);case"textInput":return Xr=eo.data,Xr===ee$6&&fe$2?null:Xr;default:return null}}function ke$5(Xr,eo){if(ie$4)return Xr==="compositionend"||!ae$5&&ge$5(Xr,eo)?(Xr=nd(),md=ld=kd=null,ie$4=!1,Xr):null;switch(Xr){case"paste":return null;case"keypress":if(!(eo.ctrlKey||eo.altKey||eo.metaKey)||eo.ctrlKey&&eo.altKey){if(eo.char&&1=eo)return{node:to,offset:eo-Xr};Xr=ro}e:{for(;to;){if(to.nextSibling){to=to.nextSibling;break e}to=to.parentNode}to=void 0}to=Je$2(to)}}function Le$4(Xr,eo){return Xr&&eo?Xr===eo?!0:Xr&&Xr.nodeType===3?!1:eo&&eo.nodeType===3?Le$4(Xr,eo.parentNode):"contains"in Xr?Xr.contains(eo):Xr.compareDocumentPosition?!!(Xr.compareDocumentPosition(eo)&16):!1:!1}function Me$2(){for(var Xr=window,eo=Xa();eo instanceof Xr.HTMLIFrameElement;){try{var to=typeof eo.contentWindow.location.href=="string"}catch{to=!1}if(to)Xr=eo.contentWindow;else break;eo=Xa(Xr.document)}return eo}function Ne$3(Xr){var eo=Xr&&Xr.nodeName&&Xr.nodeName.toLowerCase();return eo&&(eo==="input"&&(Xr.type==="text"||Xr.type==="search"||Xr.type==="tel"||Xr.type==="url"||Xr.type==="password")||eo==="textarea"||Xr.contentEditable==="true")}function Oe$2(Xr){var eo=Me$2(),to=Xr.focusedElem,ro=Xr.selectionRange;if(eo!==to&&to&&to.ownerDocument&&Le$4(to.ownerDocument.documentElement,to)){if(ro!==null&&Ne$3(to)){if(eo=ro.start,Xr=ro.end,Xr===void 0&&(Xr=eo),"selectionStart"in to)to.selectionStart=eo,to.selectionEnd=Math.min(Xr,to.value.length);else if(Xr=(eo=to.ownerDocument||document)&&eo.defaultView||window,Xr.getSelection){Xr=Xr.getSelection();var no=to.textContent.length,io=Math.min(ro.start,no);ro=ro.end===void 0?io:Math.min(ro.end,no),!Xr.extend&&io>ro&&(no=ro,ro=io,io=no),no=Ke$3(to,io);var oo=Ke$3(to,ro);no&&oo&&(Xr.rangeCount!==1||Xr.anchorNode!==no.node||Xr.anchorOffset!==no.offset||Xr.focusNode!==oo.node||Xr.focusOffset!==oo.offset)&&(eo=eo.createRange(),eo.setStart(no.node,no.offset),Xr.removeAllRanges(),io>ro?(Xr.addRange(eo),Xr.extend(oo.node,oo.offset)):(eo.setEnd(oo.node,oo.offset),Xr.addRange(eo)))}}for(eo=[],Xr=to;Xr=Xr.parentNode;)Xr.nodeType===1&&eo.push({element:Xr,left:Xr.scrollLeft,top:Xr.scrollTop});for(typeof to.focus=="function"&&to.focus(),to=0;to=document.documentMode,Qe$4=null,Re$3=null,Se$3=null,Te$4=!1;function Ue$4(Xr,eo,to){var ro=to.window===to?to.document:to.nodeType===9?to:to.ownerDocument;Te$4||Qe$4==null||Qe$4!==Xa(ro)||(ro=Qe$4,"selectionStart"in ro&&Ne$3(ro)?ro={start:ro.selectionStart,end:ro.selectionEnd}:(ro=(ro.ownerDocument&&ro.ownerDocument.defaultView||window).getSelection(),ro={anchorNode:ro.anchorNode,anchorOffset:ro.anchorOffset,focusNode:ro.focusNode,focusOffset:ro.focusOffset}),Se$3&&Ie$1(Se$3,ro)||(Se$3=ro,ro=oe$4(Re$3,"onSelect"),0Tf||(Xr.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$5(Xr,eo){Tf++,Sf[Tf]=Xr.current,Xr.current=eo}var Vf={},H$5=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(Xr,eo){var to=Xr.type.contextTypes;if(!to)return Vf;var ro=Xr.stateNode;if(ro&&ro.__reactInternalMemoizedUnmaskedChildContext===eo)return ro.__reactInternalMemoizedMaskedChildContext;var no={},io;for(io in to)no[io]=eo[io];return ro&&(Xr=Xr.stateNode,Xr.__reactInternalMemoizedUnmaskedChildContext=eo,Xr.__reactInternalMemoizedMaskedChildContext=no),no}function Zf(Xr){return Xr=Xr.childContextTypes,Xr!=null}function $f(){E$9(Wf),E$9(H$5)}function ag(Xr,eo,to){if(H$5.current!==Vf)throw Error(p$9(168));G$5(H$5,eo),G$5(Wf,to)}function bg(Xr,eo,to){var ro=Xr.stateNode;if(eo=eo.childContextTypes,typeof ro.getChildContext!="function")return to;ro=ro.getChildContext();for(var no in ro)if(!(no in eo))throw Error(p$9(108,Ra$1(Xr)||"Unknown",no));return A$8({},to,ro)}function cg(Xr){return Xr=(Xr=Xr.stateNode)&&Xr.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$5.current,G$5(H$5,Xr),G$5(Wf,Wf.current),!0}function dg(Xr,eo,to){var ro=Xr.stateNode;if(!ro)throw Error(p$9(169));to?(Xr=bg(Xr,eo,Xf),ro.__reactInternalMemoizedMergedChildContext=Xr,E$9(Wf),E$9(H$5),G$5(H$5,Xr)):E$9(Wf),G$5(Wf,to)}var eg=null,fg=!1,gg=!1;function hg(Xr){eg===null?eg=[Xr]:eg.push(Xr)}function ig(Xr){fg=!0,hg(Xr)}function jg$1(){if(!gg&&eg!==null){gg=!0;var Xr=0,eo=C$7;try{var to=eg;for(C$7=1;Xr>=oo,no-=oo,rg=1<<32-oc(eo)+no|to<Do?(Fo=No,No=null):Fo=No.sibling;var Xo=ho(Eo,No,Ao[Do],Po);if(Xo===null){No===null&&(No=Fo);break}Xr&&No&&Xo.alternate===null&&eo(Eo,No),ko=io(Xo,ko,Do),Mo===null?jo=Xo:Mo.sibling=Xo,Mo=Xo,No=Fo}if(Do===Ao.length)return to(Eo,No),I$2&&tg(Eo,Do),jo;if(No===null){for(;DoDo?(Fo=No,No=null):Fo=No.sibling;var Lo=ho(Eo,No,Xo.value,Po);if(Lo===null){No===null&&(No=Fo);break}Xr&&No&&Lo.alternate===null&&eo(Eo,No),ko=io(Lo,ko,Do),Mo===null?jo=Lo:Mo.sibling=Lo,Mo=Lo,No=Fo}if(Xo.done)return to(Eo,No),I$2&&tg(Eo,Do),jo;if(No===null){for(;!Xo.done;Do++,Xo=Ao.next())Xo=fo(Eo,Xo.value,Po),Xo!==null&&(ko=io(Xo,ko,Do),Mo===null?jo=Xo:Mo.sibling=Xo,Mo=Xo);return I$2&&tg(Eo,Do),jo}for(No=ro(Eo,No);!Xo.done;Do++,Xo=Ao.next())Xo=go(No,Eo,Do,Xo.value,Po),Xo!==null&&(Xr&&Xo.alternate!==null&&No.delete(Xo.key===null?Do:Xo.key),ko=io(Xo,ko,Do),Mo===null?jo=Xo:Mo.sibling=Xo,Mo=Xo);return Xr&&No.forEach(function(Bo){return eo(Eo,Bo)}),I$2&&tg(Eo,Do),jo}function wo(Eo,ko,Ao,Po){if(typeof Ao=="object"&&Ao!==null&&Ao.type===ya$1&&Ao.key===null&&(Ao=Ao.props.children),typeof Ao=="object"&&Ao!==null){switch(Ao.$$typeof){case va:e:{for(var jo=Ao.key,Mo=ko;Mo!==null;){if(Mo.key===jo){if(jo=Ao.type,jo===ya$1){if(Mo.tag===7){to(Eo,Mo.sibling),ko=no(Mo,Ao.props.children),ko.return=Eo,Eo=ko;break e}}else if(Mo.elementType===jo||typeof jo=="object"&&jo!==null&&jo.$$typeof===Ha&&Ng(jo)===Mo.type){to(Eo,Mo.sibling),ko=no(Mo,Ao.props),ko.ref=Lg(Eo,Mo,Ao),ko.return=Eo,Eo=ko;break e}to(Eo,Mo);break}else eo(Eo,Mo);Mo=Mo.sibling}Ao.type===ya$1?(ko=Tg(Ao.props.children,Eo.mode,Po,Ao.key),ko.return=Eo,Eo=ko):(Po=Rg(Ao.type,Ao.key,Ao.props,null,Eo.mode,Po),Po.ref=Lg(Eo,ko,Ao),Po.return=Eo,Eo=Po)}return oo(Eo);case wa:e:{for(Mo=Ao.key;ko!==null;){if(ko.key===Mo)if(ko.tag===4&&ko.stateNode.containerInfo===Ao.containerInfo&&ko.stateNode.implementation===Ao.implementation){to(Eo,ko.sibling),ko=no(ko,Ao.children||[]),ko.return=Eo,Eo=ko;break e}else{to(Eo,ko);break}else eo(Eo,ko);ko=ko.sibling}ko=Sg(Ao,Eo.mode,Po),ko.return=Eo,Eo=ko}return oo(Eo);case Ha:return Mo=Ao._init,wo(Eo,ko,Mo(Ao._payload),Po)}if(eb(Ao))return yo(Eo,ko,Ao,Po);if(Ka(Ao))return vo(Eo,ko,Ao,Po);Mg$1(Eo,Ao)}return typeof Ao=="string"&&Ao!==""||typeof Ao=="number"?(Ao=""+Ao,ko!==null&&ko.tag===6?(to(Eo,ko.sibling),ko=no(ko,Ao),ko.return=Eo,Eo=ko):(to(Eo,ko),ko=Qg$1(Ao,Eo.mode,Po),ko.return=Eo,Eo=ko),oo(Eo)):to(Eo,ko)}return wo}var Ug=Og(!0),Vg$1=Og(!1),Wg=Uf(null),Xg$1=null,Yg$1=null,Zg$1=null;function $g(){Zg$1=Yg$1=Xg$1=null}function ah(Xr){var eo=Wg.current;E$9(Wg),Xr._currentValue=eo}function bh(Xr,eo,to){for(;Xr!==null;){var ro=Xr.alternate;if((Xr.childLanes&eo)!==eo?(Xr.childLanes|=eo,ro!==null&&(ro.childLanes|=eo)):ro!==null&&(ro.childLanes&eo)!==eo&&(ro.childLanes|=eo),Xr===to)break;Xr=Xr.return}}function ch$1(Xr,eo){Xg$1=Xr,Zg$1=Yg$1=null,Xr=Xr.dependencies,Xr!==null&&Xr.firstContext!==null&&(Xr.lanes&eo&&(dh$1=!0),Xr.firstContext=null)}function eh(Xr){var eo=Xr._currentValue;if(Zg$1!==Xr)if(Xr={context:Xr,memoizedValue:eo,next:null},Yg$1===null){if(Xg$1===null)throw Error(p$9(308));Yg$1=Xr,Xg$1.dependencies={lanes:0,firstContext:Xr}}else Yg$1=Yg$1.next=Xr;return eo}var fh=null;function gh(Xr){fh===null?fh=[Xr]:fh.push(Xr)}function hh(Xr,eo,to,ro){var no=eo.interleaved;return no===null?(to.next=to,gh(eo)):(to.next=no.next,no.next=to),eo.interleaved=to,ih(Xr,ro)}function ih(Xr,eo){Xr.lanes|=eo;var to=Xr.alternate;for(to!==null&&(to.lanes|=eo),to=Xr,Xr=Xr.return;Xr!==null;)Xr.childLanes|=eo,to=Xr.alternate,to!==null&&(to.childLanes|=eo),to=Xr,Xr=Xr.return;return to.tag===3?to.stateNode:null}var jh=!1;function kh(Xr){Xr.updateQueue={baseState:Xr.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(Xr,eo){Xr=Xr.updateQueue,eo.updateQueue===Xr&&(eo.updateQueue={baseState:Xr.baseState,firstBaseUpdate:Xr.firstBaseUpdate,lastBaseUpdate:Xr.lastBaseUpdate,shared:Xr.shared,effects:Xr.effects})}function mh(Xr,eo){return{eventTime:Xr,lane:eo,tag:0,payload:null,callback:null,next:null}}function nh(Xr,eo,to){var ro=Xr.updateQueue;if(ro===null)return null;if(ro=ro.shared,K$5&2){var no=ro.pending;return no===null?eo.next=eo:(eo.next=no.next,no.next=eo),ro.pending=eo,ih(Xr,to)}return no=ro.interleaved,no===null?(eo.next=eo,gh(ro)):(eo.next=no.next,no.next=eo),ro.interleaved=eo,ih(Xr,to)}function oh(Xr,eo,to){if(eo=eo.updateQueue,eo!==null&&(eo=eo.shared,(to&4194240)!==0)){var ro=eo.lanes;ro&=Xr.pendingLanes,to|=ro,eo.lanes=to,Cc(Xr,to)}}function ph(Xr,eo){var to=Xr.updateQueue,ro=Xr.alternate;if(ro!==null&&(ro=ro.updateQueue,to===ro)){var no=null,io=null;if(to=to.firstBaseUpdate,to!==null){do{var oo={eventTime:to.eventTime,lane:to.lane,tag:to.tag,payload:to.payload,callback:to.callback,next:null};io===null?no=io=oo:io=io.next=oo,to=to.next}while(to!==null);io===null?no=io=eo:io=io.next=eo}else no=io=eo;to={baseState:ro.baseState,firstBaseUpdate:no,lastBaseUpdate:io,shared:ro.shared,effects:ro.effects},Xr.updateQueue=to;return}Xr=to.lastBaseUpdate,Xr===null?to.firstBaseUpdate=eo:Xr.next=eo,to.lastBaseUpdate=eo}function qh(Xr,eo,to,ro){var no=Xr.updateQueue;jh=!1;var io=no.firstBaseUpdate,oo=no.lastBaseUpdate,ao=no.shared.pending;if(ao!==null){no.shared.pending=null;var so=ao,co=so.next;so.next=null,oo===null?io=co:oo.next=co,oo=so;var lo=Xr.alternate;lo!==null&&(lo=lo.updateQueue,ao=lo.lastBaseUpdate,ao!==oo&&(ao===null?lo.firstBaseUpdate=co:ao.next=co,lo.lastBaseUpdate=so))}if(io!==null){var fo=no.baseState;oo=0,lo=co=so=null,ao=io;do{var ho=ao.lane,go=ao.eventTime;if((ro&ho)===ho){lo!==null&&(lo=lo.next={eventTime:go,lane:0,tag:ao.tag,payload:ao.payload,callback:ao.callback,next:null});e:{var yo=Xr,vo=ao;switch(ho=eo,go=to,vo.tag){case 1:if(yo=vo.payload,typeof yo=="function"){fo=yo.call(go,fo,ho);break e}fo=yo;break e;case 3:yo.flags=yo.flags&-65537|128;case 0:if(yo=vo.payload,ho=typeof yo=="function"?yo.call(go,fo,ho):yo,ho==null)break e;fo=A$8({},fo,ho);break e;case 2:jh=!0}}ao.callback!==null&&ao.lane!==0&&(Xr.flags|=64,ho=no.effects,ho===null?no.effects=[ao]:ho.push(ao))}else go={eventTime:go,lane:ho,tag:ao.tag,payload:ao.payload,callback:ao.callback,next:null},lo===null?(co=lo=go,so=fo):lo=lo.next=go,oo|=ho;if(ao=ao.next,ao===null){if(ao=no.shared.pending,ao===null)break;ho=ao,ao=ho.next,ho.next=null,no.lastBaseUpdate=ho,no.shared.pending=null}}while(!0);if(lo===null&&(so=fo),no.baseState=so,no.firstBaseUpdate=co,no.lastBaseUpdate=lo,eo=no.shared.interleaved,eo!==null){no=eo;do oo|=no.lane,no=no.next;while(no!==eo)}else io===null&&(no.shared.lanes=0);rh|=oo,Xr.lanes=oo,Xr.memoizedState=fo}}function sh(Xr,eo,to){if(Xr=eo.effects,eo.effects=null,Xr!==null)for(eo=0;eoto?to:4,Xr(!0);var ro=Gh.transition;Gh.transition={};try{Xr(!1),eo()}finally{C$7=to,Gh.transition=ro}}function wi$1(){return Uh().memoizedState}function xi$1(Xr,eo,to){var ro=yi$1(Xr);if(to={lane:ro,action:to,hasEagerState:!1,eagerState:null,next:null},zi$1(Xr))Ai$1(eo,to);else if(to=hh(Xr,eo,to,ro),to!==null){var no=R$8();gi$1(to,Xr,ro,no),Bi$1(to,eo,ro)}}function ii$1(Xr,eo,to){var ro=yi$1(Xr),no={lane:ro,action:to,hasEagerState:!1,eagerState:null,next:null};if(zi$1(Xr))Ai$1(eo,no);else{var io=Xr.alternate;if(Xr.lanes===0&&(io===null||io.lanes===0)&&(io=eo.lastRenderedReducer,io!==null))try{var oo=eo.lastRenderedState,ao=io(oo,to);if(no.hasEagerState=!0,no.eagerState=ao,He$4(ao,oo)){var so=eo.interleaved;so===null?(no.next=no,gh(eo)):(no.next=so.next,so.next=no),eo.interleaved=no;return}}catch{}finally{}to=hh(Xr,eo,no,ro),to!==null&&(no=R$8(),gi$1(to,Xr,ro,no),Bi$1(to,eo,ro))}}function zi$1(Xr){var eo=Xr.alternate;return Xr===M$6||eo!==null&&eo===M$6}function Ai$1(Xr,eo){Jh=Ih=!0;var to=Xr.pending;to===null?eo.next=eo:(eo.next=to.next,to.next=eo),Xr.pending=eo}function Bi$1(Xr,eo,to){if(to&4194240){var ro=eo.lanes;ro&=Xr.pendingLanes,to|=ro,eo.lanes=to,Cc(Xr,to)}}var Rh={readContext:eh,useCallback:P$8,useContext:P$8,useEffect:P$8,useImperativeHandle:P$8,useInsertionEffect:P$8,useLayoutEffect:P$8,useMemo:P$8,useReducer:P$8,useRef:P$8,useState:P$8,useDebugValue:P$8,useDeferredValue:P$8,useTransition:P$8,useMutableSource:P$8,useSyncExternalStore:P$8,useId:P$8,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(Xr,eo){return Th().memoizedState=[Xr,eo===void 0?null:eo],Xr},useContext:eh,useEffect:mi$1,useImperativeHandle:function(Xr,eo,to){return to=to!=null?to.concat([Xr]):null,ki$1(4194308,4,pi$1.bind(null,eo,Xr),to)},useLayoutEffect:function(Xr,eo){return ki$1(4194308,4,Xr,eo)},useInsertionEffect:function(Xr,eo){return ki$1(4,2,Xr,eo)},useMemo:function(Xr,eo){var to=Th();return eo=eo===void 0?null:eo,Xr=Xr(),to.memoizedState=[Xr,eo],Xr},useReducer:function(Xr,eo,to){var ro=Th();return eo=to!==void 0?to(eo):eo,ro.memoizedState=ro.baseState=eo,Xr={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:eo},ro.queue=Xr,Xr=Xr.dispatch=xi$1.bind(null,M$6,Xr),[ro.memoizedState,Xr]},useRef:function(Xr){var eo=Th();return Xr={current:Xr},eo.memoizedState=Xr},useState:hi$1,useDebugValue:ri$1,useDeferredValue:function(Xr){return Th().memoizedState=Xr},useTransition:function(){var Xr=hi$1(!1),eo=Xr[0];return Xr=vi$1.bind(null,Xr[1]),Th().memoizedState=Xr,[eo,Xr]},useMutableSource:function(){},useSyncExternalStore:function(Xr,eo,to){var ro=M$6,no=Th();if(I$2){if(to===void 0)throw Error(p$9(407));to=to()}else{if(to=eo(),Q$8===null)throw Error(p$9(349));Hh&30||di$1(ro,eo,to)}no.memoizedState=to;var io={value:to,getSnapshot:eo};return no.queue=io,mi$1(ai$1.bind(null,ro,io,Xr),[Xr]),ro.flags|=2048,bi$1(9,ci$1.bind(null,ro,io,to,eo),void 0,null),to},useId:function(){var Xr=Th(),eo=Q$8.identifierPrefix;if(I$2){var to=sg,ro=rg;to=(ro&~(1<<32-oc(ro)-1)).toString(32)+to,eo=":"+eo+"R"+to,to=Kh++,0")&&(so=so.replace("",Xr.displayName)),so}while(1<=oo&&0<=ao);break}}}finally{Na=!1,Error.prepareStackTrace=to}return(Xr=Xr?Xr.displayName||Xr.name:"")?Ma(Xr):""}function Pa(Xr){switch(Xr.tag){case 5:return Ma(Xr.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return Xr=Oa$1(Xr.type,!1),Xr;case 11:return Xr=Oa$1(Xr.type.render,!1),Xr;case 1:return Xr=Oa$1(Xr.type,!0),Xr;default:return""}}function Qa(Xr){if(Xr==null)return null;if(typeof Xr=="function")return Xr.displayName||Xr.name||null;if(typeof Xr=="string")return Xr;switch(Xr){case ya$1:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea$1:return"Suspense";case Fa:return"SuspenseList"}if(typeof Xr=="object")switch(Xr.$$typeof){case Ca:return(Xr.displayName||"Context")+".Consumer";case Ba:return(Xr._context.displayName||"Context")+".Provider";case Da:var eo=Xr.render;return Xr=Xr.displayName,Xr||(Xr=eo.displayName||eo.name||"",Xr=Xr!==""?"ForwardRef("+Xr+")":"ForwardRef"),Xr;case Ga:return eo=Xr.displayName||null,eo!==null?eo:Qa(Xr.type)||"Memo";case Ha:eo=Xr._payload,Xr=Xr._init;try{return Qa(Xr(eo))}catch{}}return null}function Ra$1(Xr){var eo=Xr.type;switch(Xr.tag){case 24:return"Cache";case 9:return(eo.displayName||"Context")+".Consumer";case 10:return(eo._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return Xr=eo.render,Xr=Xr.displayName||Xr.name||"",eo.displayName||(Xr!==""?"ForwardRef("+Xr+")":"ForwardRef");case 7:return"Fragment";case 5:return eo;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(eo);case 8:return eo===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof eo=="function")return eo.displayName||eo.name||null;if(typeof eo=="string")return eo}return null}function Sa$1(Xr){switch(typeof Xr){case"boolean":case"number":case"string":case"undefined":return Xr;case"object":return Xr;default:return""}}function Ta$1(Xr){var eo=Xr.type;return(Xr=Xr.nodeName)&&Xr.toLowerCase()==="input"&&(eo==="checkbox"||eo==="radio")}function Ua(Xr){var eo=Ta$1(Xr)?"checked":"value",to=Object.getOwnPropertyDescriptor(Xr.constructor.prototype,eo),ro=""+Xr[eo];if(!Xr.hasOwnProperty(eo)&&typeof to<"u"&&typeof to.get=="function"&&typeof to.set=="function"){var no=to.get,io=to.set;return Object.defineProperty(Xr,eo,{configurable:!0,get:function(){return no.call(this)},set:function(oo){ro=""+oo,io.call(this,oo)}}),Object.defineProperty(Xr,eo,{enumerable:to.enumerable}),{getValue:function(){return ro},setValue:function(oo){ro=""+oo},stopTracking:function(){Xr._valueTracker=null,delete Xr[eo]}}}}function Va(Xr){Xr._valueTracker||(Xr._valueTracker=Ua(Xr))}function Wa(Xr){if(!Xr)return!1;var eo=Xr._valueTracker;if(!eo)return!0;var to=eo.getValue(),ro="";return Xr&&(ro=Ta$1(Xr)?Xr.checked?"true":"false":Xr.value),Xr=ro,Xr!==to?(eo.setValue(Xr),!0):!1}function Xa(Xr){if(Xr=Xr||(typeof document<"u"?document:void 0),typeof Xr>"u")return null;try{return Xr.activeElement||Xr.body}catch{return Xr.body}}function Ya(Xr,eo){var to=eo.checked;return A$b({},eo,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:to??Xr._wrapperState.initialChecked})}function Za(Xr,eo){var to=eo.defaultValue==null?"":eo.defaultValue,ro=eo.checked!=null?eo.checked:eo.defaultChecked;to=Sa$1(eo.value!=null?eo.value:to),Xr._wrapperState={initialChecked:ro,initialValue:to,controlled:eo.type==="checkbox"||eo.type==="radio"?eo.checked!=null:eo.value!=null}}function ab(Xr,eo){eo=eo.checked,eo!=null&&ta$1(Xr,"checked",eo,!1)}function bb(Xr,eo){ab(Xr,eo);var to=Sa$1(eo.value),ro=eo.type;if(to!=null)ro==="number"?(to===0&&Xr.value===""||Xr.value!=to)&&(Xr.value=""+to):Xr.value!==""+to&&(Xr.value=""+to);else if(ro==="submit"||ro==="reset"){Xr.removeAttribute("value");return}eo.hasOwnProperty("value")?cb(Xr,eo.type,to):eo.hasOwnProperty("defaultValue")&&cb(Xr,eo.type,Sa$1(eo.defaultValue)),eo.checked==null&&eo.defaultChecked!=null&&(Xr.defaultChecked=!!eo.defaultChecked)}function db(Xr,eo,to){if(eo.hasOwnProperty("value")||eo.hasOwnProperty("defaultValue")){var ro=eo.type;if(!(ro!=="submit"&&ro!=="reset"||eo.value!==void 0&&eo.value!==null))return;eo=""+Xr._wrapperState.initialValue,to||eo===Xr.value||(Xr.value=eo),Xr.defaultValue=eo}to=Xr.name,to!==""&&(Xr.name=""),Xr.defaultChecked=!!Xr._wrapperState.initialChecked,to!==""&&(Xr.name=to)}function cb(Xr,eo,to){(eo!=="number"||Xa(Xr.ownerDocument)!==Xr)&&(to==null?Xr.defaultValue=""+Xr._wrapperState.initialValue:Xr.defaultValue!==""+to&&(Xr.defaultValue=""+to))}var eb=Array.isArray;function fb(Xr,eo,to,ro){if(Xr=Xr.options,eo){eo={};for(var no=0;no"+eo.valueOf().toString()+"",eo=mb.firstChild;Xr.firstChild;)Xr.removeChild(Xr.firstChild);for(;eo.firstChild;)Xr.appendChild(eo.firstChild)}});function ob(Xr,eo){if(eo){var to=Xr.firstChild;if(to&&to===Xr.lastChild&&to.nodeType===3){to.nodeValue=eo;return}}Xr.textContent=eo}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(Xr){qb.forEach(function(eo){eo=eo+Xr.charAt(0).toUpperCase()+Xr.substring(1),pb[eo]=pb[Xr]})});function rb(Xr,eo,to){return eo==null||typeof eo=="boolean"||eo===""?"":to||typeof eo!="number"||eo===0||pb.hasOwnProperty(Xr)&&pb[Xr]?(""+eo).trim():eo+"px"}function sb(Xr,eo){Xr=Xr.style;for(var to in eo)if(eo.hasOwnProperty(to)){var ro=to.indexOf("--")===0,no=rb(to,eo[to],ro);to==="float"&&(to="cssFloat"),ro?Xr.setProperty(to,no):Xr[to]=no}}var tb=A$b({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(Xr,eo){if(eo){if(tb[Xr]&&(eo.children!=null||eo.dangerouslySetInnerHTML!=null))throw Error(p$d(137,Xr));if(eo.dangerouslySetInnerHTML!=null){if(eo.children!=null)throw Error(p$d(60));if(typeof eo.dangerouslySetInnerHTML!="object"||!("__html"in eo.dangerouslySetInnerHTML))throw Error(p$d(61))}if(eo.style!=null&&typeof eo.style!="object")throw Error(p$d(62))}}function vb(Xr,eo){if(Xr.indexOf("-")===-1)return typeof eo.is=="string";switch(Xr){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(Xr){return Xr=Xr.target||Xr.srcElement||window,Xr.correspondingUseElement&&(Xr=Xr.correspondingUseElement),Xr.nodeType===3?Xr.parentNode:Xr}var yb=null,zb=null,Ab=null;function Bb(Xr){if(Xr=Cb(Xr)){if(typeof yb!="function")throw Error(p$d(280));var eo=Xr.stateNode;eo&&(eo=Db(eo),yb(Xr.stateNode,Xr.type,eo))}}function Eb(Xr){zb?Ab?Ab.push(Xr):Ab=[Xr]:zb=Xr}function Fb(){if(zb){var Xr=zb,eo=Ab;if(Ab=zb=null,Bb(Xr),eo)for(Xr=0;Xr>>=0,Xr===0?32:31-(pc(Xr)/qc|0)|0}var rc=64,sc=4194304;function tc(Xr){switch(Xr&-Xr){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return Xr&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return Xr&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return Xr}}function uc(Xr,eo){var to=Xr.pendingLanes;if(to===0)return 0;var ro=0,no=Xr.suspendedLanes,io=Xr.pingedLanes,oo=to&268435455;if(oo!==0){var ao=oo&~no;ao!==0?ro=tc(ao):(io&=oo,io!==0&&(ro=tc(io)))}else oo=to&~no,oo!==0?ro=tc(oo):io!==0&&(ro=tc(io));if(ro===0)return 0;if(eo!==0&&eo!==ro&&!(eo&no)&&(no=ro&-ro,io=eo&-eo,no>=io||no===16&&(io&4194240)!==0))return eo;if(ro&4&&(ro|=to&16),eo=Xr.entangledLanes,eo!==0)for(Xr=Xr.entanglements,eo&=ro;0to;to++)eo.push(Xr);return eo}function Ac(Xr,eo,to){Xr.pendingLanes|=eo,eo!==536870912&&(Xr.suspendedLanes=0,Xr.pingedLanes=0),Xr=Xr.eventTimes,eo=31-oc(eo),Xr[eo]=to}function Bc(Xr,eo){var to=Xr.pendingLanes&~eo;Xr.pendingLanes=eo,Xr.suspendedLanes=0,Xr.pingedLanes=0,Xr.expiredLanes&=eo,Xr.mutableReadLanes&=eo,Xr.entangledLanes&=eo,eo=Xr.entanglements;var ro=Xr.eventTimes;for(Xr=Xr.expirationTimes;0=be$3),ee$7=" ",fe$3=!1;function ge$6(Xr,eo){switch(Xr){case"keyup":return $d.indexOf(eo.keyCode)!==-1;case"keydown":return eo.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$5(Xr){return Xr=Xr.detail,typeof Xr=="object"&&"data"in Xr?Xr.data:null}var ie$6=!1;function je$4(Xr,eo){switch(Xr){case"compositionend":return he$5(eo);case"keypress":return eo.which!==32?null:(fe$3=!0,ee$7);case"textInput":return Xr=eo.data,Xr===ee$7&&fe$3?null:Xr;default:return null}}function ke$6(Xr,eo){if(ie$6)return Xr==="compositionend"||!ae$7&&ge$6(Xr,eo)?(Xr=nd(),md=ld=kd=null,ie$6=!1,Xr):null;switch(Xr){case"paste":return null;case"keypress":if(!(eo.ctrlKey||eo.altKey||eo.metaKey)||eo.ctrlKey&&eo.altKey){if(eo.char&&1=eo)return{node:to,offset:eo-Xr};Xr=ro}e:{for(;to;){if(to.nextSibling){to=to.nextSibling;break e}to=to.parentNode}to=void 0}to=Je$2(to)}}function Le$5(Xr,eo){return Xr&&eo?Xr===eo?!0:Xr&&Xr.nodeType===3?!1:eo&&eo.nodeType===3?Le$5(Xr,eo.parentNode):"contains"in Xr?Xr.contains(eo):Xr.compareDocumentPosition?!!(Xr.compareDocumentPosition(eo)&16):!1:!1}function Me$3(){for(var Xr=window,eo=Xa();eo instanceof Xr.HTMLIFrameElement;){try{var to=typeof eo.contentWindow.location.href=="string"}catch{to=!1}if(to)Xr=eo.contentWindow;else break;eo=Xa(Xr.document)}return eo}function Ne$4(Xr){var eo=Xr&&Xr.nodeName&&Xr.nodeName.toLowerCase();return eo&&(eo==="input"&&(Xr.type==="text"||Xr.type==="search"||Xr.type==="tel"||Xr.type==="url"||Xr.type==="password")||eo==="textarea"||Xr.contentEditable==="true")}function Oe$3(Xr){var eo=Me$3(),to=Xr.focusedElem,ro=Xr.selectionRange;if(eo!==to&&to&&to.ownerDocument&&Le$5(to.ownerDocument.documentElement,to)){if(ro!==null&&Ne$4(to)){if(eo=ro.start,Xr=ro.end,Xr===void 0&&(Xr=eo),"selectionStart"in to)to.selectionStart=eo,to.selectionEnd=Math.min(Xr,to.value.length);else if(Xr=(eo=to.ownerDocument||document)&&eo.defaultView||window,Xr.getSelection){Xr=Xr.getSelection();var no=to.textContent.length,io=Math.min(ro.start,no);ro=ro.end===void 0?io:Math.min(ro.end,no),!Xr.extend&&io>ro&&(no=ro,ro=io,io=no),no=Ke$3(to,io);var oo=Ke$3(to,ro);no&&oo&&(Xr.rangeCount!==1||Xr.anchorNode!==no.node||Xr.anchorOffset!==no.offset||Xr.focusNode!==oo.node||Xr.focusOffset!==oo.offset)&&(eo=eo.createRange(),eo.setStart(no.node,no.offset),Xr.removeAllRanges(),io>ro?(Xr.addRange(eo),Xr.extend(oo.node,oo.offset)):(eo.setEnd(oo.node,oo.offset),Xr.addRange(eo)))}}for(eo=[],Xr=to;Xr=Xr.parentNode;)Xr.nodeType===1&&eo.push({element:Xr,left:Xr.scrollLeft,top:Xr.scrollTop});for(typeof to.focus=="function"&&to.focus(),to=0;to=document.documentMode,Qe$4=null,Re$4=null,Se$4=null,Te$5=!1;function Ue$4(Xr,eo,to){var ro=to.window===to?to.document:to.nodeType===9?to:to.ownerDocument;Te$5||Qe$4==null||Qe$4!==Xa(ro)||(ro=Qe$4,"selectionStart"in ro&&Ne$4(ro)?ro={start:ro.selectionStart,end:ro.selectionEnd}:(ro=(ro.ownerDocument&&ro.ownerDocument.defaultView||window).getSelection(),ro={anchorNode:ro.anchorNode,anchorOffset:ro.anchorOffset,focusNode:ro.focusNode,focusOffset:ro.focusOffset}),Se$4&&Ie$1(Se$4,ro)||(Se$4=ro,ro=oe$6(Re$4,"onSelect"),0Tf||(Xr.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$8(Xr,eo){Tf++,Sf[Tf]=Xr.current,Xr.current=eo}var Vf={},H$7=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(Xr,eo){var to=Xr.type.contextTypes;if(!to)return Vf;var ro=Xr.stateNode;if(ro&&ro.__reactInternalMemoizedUnmaskedChildContext===eo)return ro.__reactInternalMemoizedMaskedChildContext;var no={},io;for(io in to)no[io]=eo[io];return ro&&(Xr=Xr.stateNode,Xr.__reactInternalMemoizedUnmaskedChildContext=eo,Xr.__reactInternalMemoizedMaskedChildContext=no),no}function Zf(Xr){return Xr=Xr.childContextTypes,Xr!=null}function $f(){E$a(Wf),E$a(H$7)}function ag(Xr,eo,to){if(H$7.current!==Vf)throw Error(p$d(168));G$8(H$7,eo),G$8(Wf,to)}function bg(Xr,eo,to){var ro=Xr.stateNode;if(eo=eo.childContextTypes,typeof ro.getChildContext!="function")return to;ro=ro.getChildContext();for(var no in ro)if(!(no in eo))throw Error(p$d(108,Ra$1(Xr)||"Unknown",no));return A$b({},to,ro)}function cg(Xr){return Xr=(Xr=Xr.stateNode)&&Xr.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$7.current,G$8(H$7,Xr),G$8(Wf,Wf.current),!0}function dg(Xr,eo,to){var ro=Xr.stateNode;if(!ro)throw Error(p$d(169));to?(Xr=bg(Xr,eo,Xf),ro.__reactInternalMemoizedMergedChildContext=Xr,E$a(Wf),E$a(H$7),G$8(H$7,Xr)):E$a(Wf),G$8(Wf,to)}var eg=null,fg=!1,gg=!1;function hg(Xr){eg===null?eg=[Xr]:eg.push(Xr)}function ig(Xr){fg=!0,hg(Xr)}function jg$1(){if(!gg&&eg!==null){gg=!0;var Xr=0,eo=C$9;try{var to=eg;for(C$9=1;Xr>=oo,no-=oo,rg=1<<32-oc(eo)+no|to<Fo?(Wo=Mo,Mo=null):Wo=Mo.sibling;var Jo=ho($o,Mo,Ro[Fo],Oo);if(Jo===null){Mo===null&&(Mo=Wo);break}Xr&&Mo&&Jo.alternate===null&&eo($o,Mo),Co=io(Jo,Co,Fo),Bo===null?jo=Jo:Bo.sibling=Jo,Bo=Jo,Mo=Wo}if(Fo===Ro.length)return to($o,Mo),I$3&&tg($o,Fo),jo;if(Mo===null){for(;FoFo?(Wo=Mo,Mo=null):Wo=Mo.sibling;var Po=ho($o,Mo,Jo.value,Oo);if(Po===null){Mo===null&&(Mo=Wo);break}Xr&&Mo&&Po.alternate===null&&eo($o,Mo),Co=io(Po,Co,Fo),Bo===null?jo=Po:Bo.sibling=Po,Bo=Po,Mo=Wo}if(Jo.done)return to($o,Mo),I$3&&tg($o,Fo),jo;if(Mo===null){for(;!Jo.done;Fo++,Jo=Ro.next())Jo=uo($o,Jo.value,Oo),Jo!==null&&(Co=io(Jo,Co,Fo),Bo===null?jo=Jo:Bo.sibling=Jo,Bo=Jo);return I$3&&tg($o,Fo),jo}for(Mo=ro($o,Mo);!Jo.done;Fo++,Jo=Ro.next())Jo=go(Mo,$o,Fo,Jo.value,Oo),Jo!==null&&(Xr&&Jo.alternate!==null&&Mo.delete(Jo.key===null?Fo:Jo.key),Co=io(Jo,Co,Fo),Bo===null?jo=Jo:Bo.sibling=Jo,Bo=Jo);return Xr&&Mo.forEach(function(fo){return eo($o,fo)}),I$3&&tg($o,Fo),jo}function Eo($o,Co,Ro,Oo){if(typeof Ro=="object"&&Ro!==null&&Ro.type===ya$1&&Ro.key===null&&(Ro=Ro.props.children),typeof Ro=="object"&&Ro!==null){switch(Ro.$$typeof){case va:e:{for(var jo=Ro.key,Bo=Co;Bo!==null;){if(Bo.key===jo){if(jo=Ro.type,jo===ya$1){if(Bo.tag===7){to($o,Bo.sibling),Co=no(Bo,Ro.props.children),Co.return=$o,$o=Co;break e}}else if(Bo.elementType===jo||typeof jo=="object"&&jo!==null&&jo.$$typeof===Ha&&Ng(jo)===Bo.type){to($o,Bo.sibling),Co=no(Bo,Ro.props),Co.ref=Lg($o,Bo,Ro),Co.return=$o,$o=Co;break e}to($o,Bo);break}else eo($o,Bo);Bo=Bo.sibling}Ro.type===ya$1?(Co=Tg(Ro.props.children,$o.mode,Oo,Ro.key),Co.return=$o,$o=Co):(Oo=Rg(Ro.type,Ro.key,Ro.props,null,$o.mode,Oo),Oo.ref=Lg($o,Co,Ro),Oo.return=$o,$o=Oo)}return oo($o);case wa:e:{for(Bo=Ro.key;Co!==null;){if(Co.key===Bo)if(Co.tag===4&&Co.stateNode.containerInfo===Ro.containerInfo&&Co.stateNode.implementation===Ro.implementation){to($o,Co.sibling),Co=no(Co,Ro.children||[]),Co.return=$o,$o=Co;break e}else{to($o,Co);break}else eo($o,Co);Co=Co.sibling}Co=Sg(Ro,$o.mode,Oo),Co.return=$o,$o=Co}return oo($o);case Ha:return Bo=Ro._init,Eo($o,Co,Bo(Ro._payload),Oo)}if(eb(Ro))return bo($o,Co,Ro,Oo);if(Ka(Ro))return wo($o,Co,Ro,Oo);Mg$1($o,Ro)}return typeof Ro=="string"&&Ro!==""||typeof Ro=="number"?(Ro=""+Ro,Co!==null&&Co.tag===6?(to($o,Co.sibling),Co=no(Co,Ro),Co.return=$o,$o=Co):(to($o,Co),Co=Qg$1(Ro,$o.mode,Oo),Co.return=$o,$o=Co),oo($o)):to($o,Co)}return Eo}var Ug=Og(!0),Vg$1=Og(!1),Wg=Uf(null),Xg$1=null,Yg$1=null,Zg$1=null;function $g(){Zg$1=Yg$1=Xg$1=null}function ah(Xr){var eo=Wg.current;E$a(Wg),Xr._currentValue=eo}function bh(Xr,eo,to){for(;Xr!==null;){var ro=Xr.alternate;if((Xr.childLanes&eo)!==eo?(Xr.childLanes|=eo,ro!==null&&(ro.childLanes|=eo)):ro!==null&&(ro.childLanes&eo)!==eo&&(ro.childLanes|=eo),Xr===to)break;Xr=Xr.return}}function ch$1(Xr,eo){Xg$1=Xr,Zg$1=Yg$1=null,Xr=Xr.dependencies,Xr!==null&&Xr.firstContext!==null&&(Xr.lanes&eo&&(dh$1=!0),Xr.firstContext=null)}function eh(Xr){var eo=Xr._currentValue;if(Zg$1!==Xr)if(Xr={context:Xr,memoizedValue:eo,next:null},Yg$1===null){if(Xg$1===null)throw Error(p$d(308));Yg$1=Xr,Xg$1.dependencies={lanes:0,firstContext:Xr}}else Yg$1=Yg$1.next=Xr;return eo}var fh=null;function gh(Xr){fh===null?fh=[Xr]:fh.push(Xr)}function hh(Xr,eo,to,ro){var no=eo.interleaved;return no===null?(to.next=to,gh(eo)):(to.next=no.next,no.next=to),eo.interleaved=to,ih(Xr,ro)}function ih(Xr,eo){Xr.lanes|=eo;var to=Xr.alternate;for(to!==null&&(to.lanes|=eo),to=Xr,Xr=Xr.return;Xr!==null;)Xr.childLanes|=eo,to=Xr.alternate,to!==null&&(to.childLanes|=eo),to=Xr,Xr=Xr.return;return to.tag===3?to.stateNode:null}var jh=!1;function kh(Xr){Xr.updateQueue={baseState:Xr.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(Xr,eo){Xr=Xr.updateQueue,eo.updateQueue===Xr&&(eo.updateQueue={baseState:Xr.baseState,firstBaseUpdate:Xr.firstBaseUpdate,lastBaseUpdate:Xr.lastBaseUpdate,shared:Xr.shared,effects:Xr.effects})}function mh(Xr,eo){return{eventTime:Xr,lane:eo,tag:0,payload:null,callback:null,next:null}}function nh(Xr,eo,to){var ro=Xr.updateQueue;if(ro===null)return null;if(ro=ro.shared,K$6&2){var no=ro.pending;return no===null?eo.next=eo:(eo.next=no.next,no.next=eo),ro.pending=eo,ih(Xr,to)}return no=ro.interleaved,no===null?(eo.next=eo,gh(ro)):(eo.next=no.next,no.next=eo),ro.interleaved=eo,ih(Xr,to)}function oh(Xr,eo,to){if(eo=eo.updateQueue,eo!==null&&(eo=eo.shared,(to&4194240)!==0)){var ro=eo.lanes;ro&=Xr.pendingLanes,to|=ro,eo.lanes=to,Cc(Xr,to)}}function ph(Xr,eo){var to=Xr.updateQueue,ro=Xr.alternate;if(ro!==null&&(ro=ro.updateQueue,to===ro)){var no=null,io=null;if(to=to.firstBaseUpdate,to!==null){do{var oo={eventTime:to.eventTime,lane:to.lane,tag:to.tag,payload:to.payload,callback:to.callback,next:null};io===null?no=io=oo:io=io.next=oo,to=to.next}while(to!==null);io===null?no=io=eo:io=io.next=eo}else no=io=eo;to={baseState:ro.baseState,firstBaseUpdate:no,lastBaseUpdate:io,shared:ro.shared,effects:ro.effects},Xr.updateQueue=to;return}Xr=to.lastBaseUpdate,Xr===null?to.firstBaseUpdate=eo:Xr.next=eo,to.lastBaseUpdate=eo}function qh(Xr,eo,to,ro){var no=Xr.updateQueue;jh=!1;var io=no.firstBaseUpdate,oo=no.lastBaseUpdate,ao=no.shared.pending;if(ao!==null){no.shared.pending=null;var so=ao,co=so.next;so.next=null,oo===null?io=co:oo.next=co,oo=so;var lo=Xr.alternate;lo!==null&&(lo=lo.updateQueue,ao=lo.lastBaseUpdate,ao!==oo&&(ao===null?lo.firstBaseUpdate=co:ao.next=co,lo.lastBaseUpdate=so))}if(io!==null){var uo=no.baseState;oo=0,lo=co=so=null,ao=io;do{var ho=ao.lane,go=ao.eventTime;if((ro&ho)===ho){lo!==null&&(lo=lo.next={eventTime:go,lane:0,tag:ao.tag,payload:ao.payload,callback:ao.callback,next:null});e:{var bo=Xr,wo=ao;switch(ho=eo,go=to,wo.tag){case 1:if(bo=wo.payload,typeof bo=="function"){uo=bo.call(go,uo,ho);break e}uo=bo;break e;case 3:bo.flags=bo.flags&-65537|128;case 0:if(bo=wo.payload,ho=typeof bo=="function"?bo.call(go,uo,ho):bo,ho==null)break e;uo=A$b({},uo,ho);break e;case 2:jh=!0}}ao.callback!==null&&ao.lane!==0&&(Xr.flags|=64,ho=no.effects,ho===null?no.effects=[ao]:ho.push(ao))}else go={eventTime:go,lane:ho,tag:ao.tag,payload:ao.payload,callback:ao.callback,next:null},lo===null?(co=lo=go,so=uo):lo=lo.next=go,oo|=ho;if(ao=ao.next,ao===null){if(ao=no.shared.pending,ao===null)break;ho=ao,ao=ho.next,ho.next=null,no.lastBaseUpdate=ho,no.shared.pending=null}}while(!0);if(lo===null&&(so=uo),no.baseState=so,no.firstBaseUpdate=co,no.lastBaseUpdate=lo,eo=no.shared.interleaved,eo!==null){no=eo;do oo|=no.lane,no=no.next;while(no!==eo)}else io===null&&(no.shared.lanes=0);rh|=oo,Xr.lanes=oo,Xr.memoizedState=uo}}function sh(Xr,eo,to){if(Xr=eo.effects,eo.effects=null,Xr!==null)for(eo=0;eoto?to:4,Xr(!0);var ro=Gh.transition;Gh.transition={};try{Xr(!1),eo()}finally{C$9=to,Gh.transition=ro}}function wi$1(){return Uh().memoizedState}function xi$1(Xr,eo,to){var ro=yi$1(Xr);if(to={lane:ro,action:to,hasEagerState:!1,eagerState:null,next:null},zi$1(Xr))Ai$1(eo,to);else if(to=hh(Xr,eo,to,ro),to!==null){var no=R$9();gi$1(to,Xr,ro,no),Bi$1(to,eo,ro)}}function ii$1(Xr,eo,to){var ro=yi$1(Xr),no={lane:ro,action:to,hasEagerState:!1,eagerState:null,next:null};if(zi$1(Xr))Ai$1(eo,no);else{var io=Xr.alternate;if(Xr.lanes===0&&(io===null||io.lanes===0)&&(io=eo.lastRenderedReducer,io!==null))try{var oo=eo.lastRenderedState,ao=io(oo,to);if(no.hasEagerState=!0,no.eagerState=ao,He$5(ao,oo)){var so=eo.interleaved;so===null?(no.next=no,gh(eo)):(no.next=so.next,so.next=no),eo.interleaved=no;return}}catch{}finally{}to=hh(Xr,eo,no,ro),to!==null&&(no=R$9(),gi$1(to,Xr,ro,no),Bi$1(to,eo,ro))}}function zi$1(Xr){var eo=Xr.alternate;return Xr===M$7||eo!==null&&eo===M$7}function Ai$1(Xr,eo){Jh=Ih=!0;var to=Xr.pending;to===null?eo.next=eo:(eo.next=to.next,to.next=eo),Xr.pending=eo}function Bi$1(Xr,eo,to){if(to&4194240){var ro=eo.lanes;ro&=Xr.pendingLanes,to|=ro,eo.lanes=to,Cc(Xr,to)}}var Rh={readContext:eh,useCallback:P$9,useContext:P$9,useEffect:P$9,useImperativeHandle:P$9,useInsertionEffect:P$9,useLayoutEffect:P$9,useMemo:P$9,useReducer:P$9,useRef:P$9,useState:P$9,useDebugValue:P$9,useDeferredValue:P$9,useTransition:P$9,useMutableSource:P$9,useSyncExternalStore:P$9,useId:P$9,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(Xr,eo){return Th().memoizedState=[Xr,eo===void 0?null:eo],Xr},useContext:eh,useEffect:mi$1,useImperativeHandle:function(Xr,eo,to){return to=to!=null?to.concat([Xr]):null,ki$1(4194308,4,pi$1.bind(null,eo,Xr),to)},useLayoutEffect:function(Xr,eo){return ki$1(4194308,4,Xr,eo)},useInsertionEffect:function(Xr,eo){return ki$1(4,2,Xr,eo)},useMemo:function(Xr,eo){var to=Th();return eo=eo===void 0?null:eo,Xr=Xr(),to.memoizedState=[Xr,eo],Xr},useReducer:function(Xr,eo,to){var ro=Th();return eo=to!==void 0?to(eo):eo,ro.memoizedState=ro.baseState=eo,Xr={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:eo},ro.queue=Xr,Xr=Xr.dispatch=xi$1.bind(null,M$7,Xr),[ro.memoizedState,Xr]},useRef:function(Xr){var eo=Th();return Xr={current:Xr},eo.memoizedState=Xr},useState:hi$1,useDebugValue:ri$1,useDeferredValue:function(Xr){return Th().memoizedState=Xr},useTransition:function(){var Xr=hi$1(!1),eo=Xr[0];return Xr=vi$1.bind(null,Xr[1]),Th().memoizedState=Xr,[eo,Xr]},useMutableSource:function(){},useSyncExternalStore:function(Xr,eo,to){var ro=M$7,no=Th();if(I$3){if(to===void 0)throw Error(p$d(407));to=to()}else{if(to=eo(),Q$9===null)throw Error(p$d(349));Hh&30||di$1(ro,eo,to)}no.memoizedState=to;var io={value:to,getSnapshot:eo};return no.queue=io,mi$1(ai$1.bind(null,ro,io,Xr),[Xr]),ro.flags|=2048,bi$1(9,ci$1.bind(null,ro,io,to,eo),void 0,null),to},useId:function(){var Xr=Th(),eo=Q$9.identifierPrefix;if(I$3){var to=sg,ro=rg;to=(ro&~(1<<32-oc(ro)-1)).toString(32)+to,eo=":"+eo+"R"+to,to=Kh++,0<\/script>",Xr=Xr.removeChild(Xr.firstChild)):typeof ro.is=="string"?Xr=oo.createElement(to,{is:ro.is}):(Xr=oo.createElement(to),to==="select"&&(oo=Xr,ro.multiple?oo.multiple=!0:ro.size&&(oo.size=ro.size))):Xr=oo.createElementNS(Xr,to),Xr[Of]=eo,Xr[Pf]=ro,zj(Xr,eo,!1,!1),eo.stateNode=Xr;e:{switch(oo=vb(to,ro),to){case"dialog":D$8("cancel",Xr),D$8("close",Xr),no=ro;break;case"iframe":case"object":case"embed":D$8("load",Xr),no=ro;break;case"video":case"audio":for(no=0;noGj&&(eo.flags|=128,ro=!0,Dj(io,!1),eo.lanes=4194304)}else{if(!ro)if(Xr=Ch(oo),Xr!==null){if(eo.flags|=128,ro=!0,to=Xr.updateQueue,to!==null&&(eo.updateQueue=to,eo.flags|=4),Dj(io,!0),io.tail===null&&io.tailMode==="hidden"&&!oo.alternate&&!I$2)return S$8(eo),null}else 2*B$7()-io.renderingStartTime>Gj&&to!==1073741824&&(eo.flags|=128,ro=!0,Dj(io,!1),eo.lanes=4194304);io.isBackwards?(oo.sibling=eo.child,eo.child=oo):(to=io.last,to!==null?to.sibling=oo:eo.child=oo,io.last=oo)}return io.tail!==null?(eo=io.tail,io.rendering=eo,io.tail=eo.sibling,io.renderingStartTime=B$7(),eo.sibling=null,to=L$9.current,G$5(L$9,ro?to&1|2:to&1),eo):(S$8(eo),null);case 22:case 23:return Hj(),ro=eo.memoizedState!==null,Xr!==null&&Xr.memoizedState!==null!==ro&&(eo.flags|=8192),ro&&eo.mode&1?fj&1073741824&&(S$8(eo),eo.subtreeFlags&6&&(eo.flags|=8192)):S$8(eo),null;case 24:return null;case 25:return null}throw Error(p$9(156,eo.tag))}function Ij(Xr,eo){switch(wg(eo),eo.tag){case 1:return Zf(eo.type)&&$f(),Xr=eo.flags,Xr&65536?(eo.flags=Xr&-65537|128,eo):null;case 3:return zh(),E$9(Wf),E$9(H$5),Eh(),Xr=eo.flags,Xr&65536&&!(Xr&128)?(eo.flags=Xr&-65537|128,eo):null;case 5:return Bh(eo),null;case 13:if(E$9(L$9),Xr=eo.memoizedState,Xr!==null&&Xr.dehydrated!==null){if(eo.alternate===null)throw Error(p$9(340));Ig()}return Xr=eo.flags,Xr&65536?(eo.flags=Xr&-65537|128,eo):null;case 19:return E$9(L$9),null;case 4:return zh(),null;case 10:return ah(eo.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U$7=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V$4=null;function Lj(Xr,eo){var to=Xr.ref;if(to!==null)if(typeof to=="function")try{to(null)}catch(ro){W$7(Xr,eo,ro)}else to.current=null}function Mj(Xr,eo,to){try{to()}catch(ro){W$7(Xr,eo,ro)}}var Nj=!1;function Oj(Xr,eo){if(Cf=dd,Xr=Me$2(),Ne$3(Xr)){if("selectionStart"in Xr)var to={start:Xr.selectionStart,end:Xr.selectionEnd};else e:{to=(to=Xr.ownerDocument)&&to.defaultView||window;var ro=to.getSelection&&to.getSelection();if(ro&&ro.rangeCount!==0){to=ro.anchorNode;var no=ro.anchorOffset,io=ro.focusNode;ro=ro.focusOffset;try{to.nodeType,io.nodeType}catch{to=null;break e}var oo=0,ao=-1,so=-1,co=0,lo=0,fo=Xr,ho=null;t:for(;;){for(var go;fo!==to||no!==0&&fo.nodeType!==3||(ao=oo+no),fo!==io||ro!==0&&fo.nodeType!==3||(so=oo+ro),fo.nodeType===3&&(oo+=fo.nodeValue.length),(go=fo.firstChild)!==null;)ho=fo,fo=go;for(;;){if(fo===Xr)break t;if(ho===to&&++co===no&&(ao=oo),ho===io&&++lo===ro&&(so=oo),(go=fo.nextSibling)!==null)break;fo=ho,ho=fo.parentNode}fo=go}to=ao===-1||so===-1?null:{start:ao,end:so}}else to=null}to=to||{start:0,end:0}}else to=null;for(Df={focusedElem:Xr,selectionRange:to},dd=!1,V$4=eo;V$4!==null;)if(eo=V$4,Xr=eo.child,(eo.subtreeFlags&1028)!==0&&Xr!==null)Xr.return=eo,V$4=Xr;else for(;V$4!==null;){eo=V$4;try{var yo=eo.alternate;if(eo.flags&1024)switch(eo.tag){case 0:case 11:case 15:break;case 1:if(yo!==null){var vo=yo.memoizedProps,wo=yo.memoizedState,Eo=eo.stateNode,ko=Eo.getSnapshotBeforeUpdate(eo.elementType===eo.type?vo:Ci$1(eo.type,vo),wo);Eo.__reactInternalSnapshotBeforeUpdate=ko}break;case 3:var Ao=eo.stateNode.containerInfo;Ao.nodeType===1?Ao.textContent="":Ao.nodeType===9&&Ao.documentElement&&Ao.removeChild(Ao.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$9(163))}}catch(Po){W$7(eo,eo.return,Po)}if(Xr=eo.sibling,Xr!==null){Xr.return=eo.return,V$4=Xr;break}V$4=eo.return}return yo=Nj,Nj=!1,yo}function Pj(Xr,eo,to){var ro=eo.updateQueue;if(ro=ro!==null?ro.lastEffect:null,ro!==null){var no=ro=ro.next;do{if((no.tag&Xr)===Xr){var io=no.destroy;no.destroy=void 0,io!==void 0&&Mj(eo,to,io)}no=no.next}while(no!==ro)}}function Qj(Xr,eo){if(eo=eo.updateQueue,eo=eo!==null?eo.lastEffect:null,eo!==null){var to=eo=eo.next;do{if((to.tag&Xr)===Xr){var ro=to.create;to.destroy=ro()}to=to.next}while(to!==eo)}}function Rj(Xr){var eo=Xr.ref;if(eo!==null){var to=Xr.stateNode;switch(Xr.tag){case 5:Xr=to;break;default:Xr=to}typeof eo=="function"?eo(Xr):eo.current=Xr}}function Sj(Xr){var eo=Xr.alternate;eo!==null&&(Xr.alternate=null,Sj(eo)),Xr.child=null,Xr.deletions=null,Xr.sibling=null,Xr.tag===5&&(eo=Xr.stateNode,eo!==null&&(delete eo[Of],delete eo[Pf],delete eo[of],delete eo[Qf],delete eo[Rf])),Xr.stateNode=null,Xr.return=null,Xr.dependencies=null,Xr.memoizedProps=null,Xr.memoizedState=null,Xr.pendingProps=null,Xr.stateNode=null,Xr.updateQueue=null}function Tj(Xr){return Xr.tag===5||Xr.tag===3||Xr.tag===4}function Uj(Xr){e:for(;;){for(;Xr.sibling===null;){if(Xr.return===null||Tj(Xr.return))return null;Xr=Xr.return}for(Xr.sibling.return=Xr.return,Xr=Xr.sibling;Xr.tag!==5&&Xr.tag!==6&&Xr.tag!==18;){if(Xr.flags&2||Xr.child===null||Xr.tag===4)continue e;Xr.child.return=Xr,Xr=Xr.child}if(!(Xr.flags&2))return Xr.stateNode}}function Vj(Xr,eo,to){var ro=Xr.tag;if(ro===5||ro===6)Xr=Xr.stateNode,eo?to.nodeType===8?to.parentNode.insertBefore(Xr,eo):to.insertBefore(Xr,eo):(to.nodeType===8?(eo=to.parentNode,eo.insertBefore(Xr,to)):(eo=to,eo.appendChild(Xr)),to=to._reactRootContainer,to!=null||eo.onclick!==null||(eo.onclick=Bf));else if(ro!==4&&(Xr=Xr.child,Xr!==null))for(Vj(Xr,eo,to),Xr=Xr.sibling;Xr!==null;)Vj(Xr,eo,to),Xr=Xr.sibling}function Wj(Xr,eo,to){var ro=Xr.tag;if(ro===5||ro===6)Xr=Xr.stateNode,eo?to.insertBefore(Xr,eo):to.appendChild(Xr);else if(ro!==4&&(Xr=Xr.child,Xr!==null))for(Wj(Xr,eo,to),Xr=Xr.sibling;Xr!==null;)Wj(Xr,eo,to),Xr=Xr.sibling}var X$5=null,Xj=!1;function Yj(Xr,eo,to){for(to=to.child;to!==null;)Zj(Xr,eo,to),to=to.sibling}function Zj(Xr,eo,to){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,to)}catch{}switch(to.tag){case 5:U$7||Lj(to,eo);case 6:var ro=X$5,no=Xj;X$5=null,Yj(Xr,eo,to),X$5=ro,Xj=no,X$5!==null&&(Xj?(Xr=X$5,to=to.stateNode,Xr.nodeType===8?Xr.parentNode.removeChild(to):Xr.removeChild(to)):X$5.removeChild(to.stateNode));break;case 18:X$5!==null&&(Xj?(Xr=X$5,to=to.stateNode,Xr.nodeType===8?Kf(Xr.parentNode,to):Xr.nodeType===1&&Kf(Xr,to),bd(Xr)):Kf(X$5,to.stateNode));break;case 4:ro=X$5,no=Xj,X$5=to.stateNode.containerInfo,Xj=!0,Yj(Xr,eo,to),X$5=ro,Xj=no;break;case 0:case 11:case 14:case 15:if(!U$7&&(ro=to.updateQueue,ro!==null&&(ro=ro.lastEffect,ro!==null))){no=ro=ro.next;do{var io=no,oo=io.destroy;io=io.tag,oo!==void 0&&(io&2||io&4)&&Mj(to,eo,oo),no=no.next}while(no!==ro)}Yj(Xr,eo,to);break;case 1:if(!U$7&&(Lj(to,eo),ro=to.stateNode,typeof ro.componentWillUnmount=="function"))try{ro.props=to.memoizedProps,ro.state=to.memoizedState,ro.componentWillUnmount()}catch(ao){W$7(to,eo,ao)}Yj(Xr,eo,to);break;case 21:Yj(Xr,eo,to);break;case 22:to.mode&1?(U$7=(ro=U$7)||to.memoizedState!==null,Yj(Xr,eo,to),U$7=ro):Yj(Xr,eo,to);break;default:Yj(Xr,eo,to)}}function ak(Xr){var eo=Xr.updateQueue;if(eo!==null){Xr.updateQueue=null;var to=Xr.stateNode;to===null&&(to=Xr.stateNode=new Kj),eo.forEach(function(ro){var no=bk.bind(null,Xr,ro);to.has(ro)||(to.add(ro),ro.then(no,no))})}}function ck(Xr,eo){var to=eo.deletions;if(to!==null)for(var ro=0;rono&&(no=oo),ro&=~io}if(ro=no,ro=B$7()-ro,ro=(120>ro?120:480>ro?480:1080>ro?1080:1920>ro?1920:3e3>ro?3e3:4320>ro?4320:1960*lk(ro/1960))-ro,10Xr?16:Xr,wk===null)var ro=!1;else{if(Xr=wk,wk=null,xk=0,K$5&6)throw Error(p$9(331));var no=K$5;for(K$5|=4,V$4=Xr.current;V$4!==null;){var io=V$4,oo=io.child;if(V$4.flags&16){var ao=io.deletions;if(ao!==null){for(var so=0;soB$7()-fk?Kk(Xr,0):rk|=to),Dk(Xr,eo)}function Yk(Xr,eo){eo===0&&(Xr.mode&1?(eo=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):eo=1);var to=R$8();Xr=ih(Xr,eo),Xr!==null&&(Ac(Xr,eo,to),Dk(Xr,to))}function uj(Xr){var eo=Xr.memoizedState,to=0;eo!==null&&(to=eo.retryLane),Yk(Xr,to)}function bk(Xr,eo){var to=0;switch(Xr.tag){case 13:var ro=Xr.stateNode,no=Xr.memoizedState;no!==null&&(to=no.retryLane);break;case 19:ro=Xr.stateNode;break;default:throw Error(p$9(314))}ro!==null&&ro.delete(eo),Yk(Xr,to)}var Vk;Vk=function(Xr,eo,to){if(Xr!==null)if(Xr.memoizedProps!==eo.pendingProps||Wf.current)dh$1=!0;else{if(!(Xr.lanes&to)&&!(eo.flags&128))return dh$1=!1,yj(Xr,eo,to);dh$1=!!(Xr.flags&131072)}else dh$1=!1,I$2&&eo.flags&1048576&&ug(eo,ng,eo.index);switch(eo.lanes=0,eo.tag){case 2:var ro=eo.type;ij(Xr,eo),Xr=eo.pendingProps;var no=Yf(eo,H$5.current);ch$1(eo,to),no=Nh(null,eo,ro,Xr,no,to);var io=Sh();return eo.flags|=1,typeof no=="object"&&no!==null&&typeof no.render=="function"&&no.$$typeof===void 0?(eo.tag=1,eo.memoizedState=null,eo.updateQueue=null,Zf(ro)?(io=!0,cg(eo)):io=!1,eo.memoizedState=no.state!==null&&no.state!==void 0?no.state:null,kh(eo),no.updater=Ei$1,eo.stateNode=no,no._reactInternals=eo,Ii$1(eo,ro,Xr,to),eo=jj(null,eo,ro,!0,io,to)):(eo.tag=0,I$2&&io&&vg(eo),Xi$2(null,eo,no,to),eo=eo.child),eo;case 16:ro=eo.elementType;e:{switch(ij(Xr,eo),Xr=eo.pendingProps,no=ro._init,ro=no(ro._payload),eo.type=ro,no=eo.tag=Zk(ro),Xr=Ci$1(ro,Xr),no){case 0:eo=cj(null,eo,ro,Xr,to);break e;case 1:eo=hj(null,eo,ro,Xr,to);break e;case 11:eo=Yi$2(null,eo,ro,Xr,to);break e;case 14:eo=$i$1(null,eo,ro,Ci$1(ro.type,Xr),to);break e}throw Error(p$9(306,ro,""))}return eo;case 0:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),cj(Xr,eo,ro,no,to);case 1:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),hj(Xr,eo,ro,no,to);case 3:e:{if(kj(eo),Xr===null)throw Error(p$9(387));ro=eo.pendingProps,io=eo.memoizedState,no=io.element,lh(Xr,eo),qh(eo,ro,null,to);var oo=eo.memoizedState;if(ro=oo.element,io.isDehydrated)if(io={element:ro,isDehydrated:!1,cache:oo.cache,pendingSuspenseBoundaries:oo.pendingSuspenseBoundaries,transitions:oo.transitions},eo.updateQueue.baseState=io,eo.memoizedState=io,eo.flags&256){no=Ji$2(Error(p$9(423)),eo),eo=lj(Xr,eo,ro,to,no);break e}else if(ro!==no){no=Ji$2(Error(p$9(424)),eo),eo=lj(Xr,eo,ro,to,no);break e}else for(yg=Lf(eo.stateNode.containerInfo.firstChild),xg=eo,I$2=!0,zg$1=null,to=Vg$1(eo,null,ro,to),eo.child=to;to;)to.flags=to.flags&-3|4096,to=to.sibling;else{if(Ig(),ro===no){eo=Zi$2(Xr,eo,to);break e}Xi$2(Xr,eo,ro,to)}eo=eo.child}return eo;case 5:return Ah(eo),Xr===null&&Eg(eo),ro=eo.type,no=eo.pendingProps,io=Xr!==null?Xr.memoizedProps:null,oo=no.children,Ef(ro,no)?oo=null:io!==null&&Ef(ro,io)&&(eo.flags|=32),gj(Xr,eo),Xi$2(Xr,eo,oo,to),eo.child;case 6:return Xr===null&&Eg(eo),null;case 13:return oj(Xr,eo,to);case 4:return yh(eo,eo.stateNode.containerInfo),ro=eo.pendingProps,Xr===null?eo.child=Ug(eo,null,ro,to):Xi$2(Xr,eo,ro,to),eo.child;case 11:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),Yi$2(Xr,eo,ro,no,to);case 7:return Xi$2(Xr,eo,eo.pendingProps,to),eo.child;case 8:return Xi$2(Xr,eo,eo.pendingProps.children,to),eo.child;case 12:return Xi$2(Xr,eo,eo.pendingProps.children,to),eo.child;case 10:e:{if(ro=eo.type._context,no=eo.pendingProps,io=eo.memoizedProps,oo=no.value,G$5(Wg,ro._currentValue),ro._currentValue=oo,io!==null)if(He$4(io.value,oo)){if(io.children===no.children&&!Wf.current){eo=Zi$2(Xr,eo,to);break e}}else for(io=eo.child,io!==null&&(io.return=eo);io!==null;){var ao=io.dependencies;if(ao!==null){oo=io.child;for(var so=ao.firstContext;so!==null;){if(so.context===ro){if(io.tag===1){so=mh(-1,to&-to),so.tag=2;var co=io.updateQueue;if(co!==null){co=co.shared;var lo=co.pending;lo===null?so.next=so:(so.next=lo.next,lo.next=so),co.pending=so}}io.lanes|=to,so=io.alternate,so!==null&&(so.lanes|=to),bh(io.return,to,eo),ao.lanes|=to;break}so=so.next}}else if(io.tag===10)oo=io.type===eo.type?null:io.child;else if(io.tag===18){if(oo=io.return,oo===null)throw Error(p$9(341));oo.lanes|=to,ao=oo.alternate,ao!==null&&(ao.lanes|=to),bh(oo,to,eo),oo=io.sibling}else oo=io.child;if(oo!==null)oo.return=io;else for(oo=io;oo!==null;){if(oo===eo){oo=null;break}if(io=oo.sibling,io!==null){io.return=oo.return,oo=io;break}oo=oo.return}io=oo}Xi$2(Xr,eo,no.children,to),eo=eo.child}return eo;case 9:return no=eo.type,ro=eo.pendingProps.children,ch$1(eo,to),no=eh(no),ro=ro(no),eo.flags|=1,Xi$2(Xr,eo,ro,to),eo.child;case 14:return ro=eo.type,no=Ci$1(ro,eo.pendingProps),no=Ci$1(ro.type,no),$i$1(Xr,eo,ro,no,to);case 15:return bj(Xr,eo,eo.type,eo.pendingProps,to);case 17:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),ij(Xr,eo),eo.tag=1,Zf(ro)?(Xr=!0,cg(eo)):Xr=!1,ch$1(eo,to),Gi$2(eo,ro,no),Ii$1(eo,ro,no,to),jj(null,eo,ro,!0,Xr,to);case 19:return xj(Xr,eo,to);case 22:return dj(Xr,eo,to)}throw Error(p$9(156,eo.tag))};function Fk(Xr,eo){return ac(Xr,eo)}function $k(Xr,eo,to,ro){this.tag=Xr,this.key=to,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=eo,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=ro,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg$1(Xr,eo,to,ro){return new $k(Xr,eo,to,ro)}function aj(Xr){return Xr=Xr.prototype,!(!Xr||!Xr.isReactComponent)}function Zk(Xr){if(typeof Xr=="function")return aj(Xr)?1:0;if(Xr!=null){if(Xr=Xr.$$typeof,Xr===Da)return 11;if(Xr===Ga)return 14}return 2}function Pg(Xr,eo){var to=Xr.alternate;return to===null?(to=Bg$1(Xr.tag,eo,Xr.key,Xr.mode),to.elementType=Xr.elementType,to.type=Xr.type,to.stateNode=Xr.stateNode,to.alternate=Xr,Xr.alternate=to):(to.pendingProps=eo,to.type=Xr.type,to.flags=0,to.subtreeFlags=0,to.deletions=null),to.flags=Xr.flags&14680064,to.childLanes=Xr.childLanes,to.lanes=Xr.lanes,to.child=Xr.child,to.memoizedProps=Xr.memoizedProps,to.memoizedState=Xr.memoizedState,to.updateQueue=Xr.updateQueue,eo=Xr.dependencies,to.dependencies=eo===null?null:{lanes:eo.lanes,firstContext:eo.firstContext},to.sibling=Xr.sibling,to.index=Xr.index,to.ref=Xr.ref,to}function Rg(Xr,eo,to,ro,no,io){var oo=2;if(ro=Xr,typeof Xr=="function")aj(Xr)&&(oo=1);else if(typeof Xr=="string")oo=5;else e:switch(Xr){case ya$1:return Tg(to.children,no,io,eo);case za:oo=8,no|=8;break;case Aa:return Xr=Bg$1(12,to,eo,no|2),Xr.elementType=Aa,Xr.lanes=io,Xr;case Ea$1:return Xr=Bg$1(13,to,eo,no),Xr.elementType=Ea$1,Xr.lanes=io,Xr;case Fa:return Xr=Bg$1(19,to,eo,no),Xr.elementType=Fa,Xr.lanes=io,Xr;case Ia$1:return pj(to,no,io,eo);default:if(typeof Xr=="object"&&Xr!==null)switch(Xr.$$typeof){case Ba:oo=10;break e;case Ca:oo=9;break e;case Da:oo=11;break e;case Ga:oo=14;break e;case Ha:oo=16,ro=null;break e}throw Error(p$9(130,Xr==null?Xr:typeof Xr,""))}return eo=Bg$1(oo,to,eo,no),eo.elementType=Xr,eo.type=ro,eo.lanes=io,eo}function Tg(Xr,eo,to,ro){return Xr=Bg$1(7,Xr,ro,eo),Xr.lanes=to,Xr}function pj(Xr,eo,to,ro){return Xr=Bg$1(22,Xr,ro,eo),Xr.elementType=Ia$1,Xr.lanes=to,Xr.stateNode={isHidden:!1},Xr}function Qg$1(Xr,eo,to){return Xr=Bg$1(6,Xr,null,eo),Xr.lanes=to,Xr}function Sg(Xr,eo,to){return eo=Bg$1(4,Xr.children!==null?Xr.children:[],Xr.key,eo),eo.lanes=to,eo.stateNode={containerInfo:Xr.containerInfo,pendingChildren:null,implementation:Xr.implementation},eo}function al(Xr,eo,to,ro,no){this.tag=eo,this.containerInfo=Xr,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=ro,this.onRecoverableError=no,this.mutableSourceEagerHydrationData=null}function bl(Xr,eo,to,ro,no,io,oo,ao,so){return Xr=new al(Xr,eo,to,ao,so),eo===1?(eo=1,io===!0&&(eo|=8)):eo=0,io=Bg$1(3,null,null,eo),Xr.current=io,io.stateNode=Xr,io.memoizedState={element:ro,isDehydrated:to,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(io),Xr}function cl(Xr,eo,to){var ro=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(Xr){console.error(Xr)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,m$6=reactDomExports;client$1.createRoot=m$6.createRoot,client$1.hydrateRoot=m$6.hydrateRoot;/** +`+io.stack}return{value:Xr,source:eo,stack:no,digest:null}}function Ki$1(Xr,eo,to){return{value:Xr,source:null,stack:to??null,digest:eo??null}}function Li$1(Xr,eo){try{console.error(eo.value)}catch(to){setTimeout(function(){throw to})}}var Mi$2=typeof WeakMap=="function"?WeakMap:Map;function Ni$1(Xr,eo,to){to=mh(-1,to),to.tag=3,to.payload={element:null};var ro=eo.value;return to.callback=function(){Oi$1||(Oi$1=!0,Pi$2=ro),Li$1(Xr,eo)},to}function Qi$2(Xr,eo,to){to=mh(-1,to),to.tag=3;var ro=Xr.type.getDerivedStateFromError;if(typeof ro=="function"){var no=eo.value;to.payload=function(){return ro(no)},to.callback=function(){Li$1(Xr,eo)}}var io=Xr.stateNode;return io!==null&&typeof io.componentDidCatch=="function"&&(to.callback=function(){Li$1(Xr,eo),typeof ro!="function"&&(Ri$1===null?Ri$1=new Set([this]):Ri$1.add(this));var oo=eo.stack;this.componentDidCatch(eo.value,{componentStack:oo!==null?oo:""})}),to}function Si$1(Xr,eo,to){var ro=Xr.pingCache;if(ro===null){ro=Xr.pingCache=new Mi$2;var no=new Set;ro.set(eo,no)}else no=ro.get(eo),no===void 0&&(no=new Set,ro.set(eo,no));no.has(to)||(no.add(to),Xr=Ti$1.bind(null,Xr,eo,to),eo.then(Xr,Xr))}function Ui$2(Xr){do{var eo;if((eo=Xr.tag===13)&&(eo=Xr.memoizedState,eo=eo!==null?eo.dehydrated!==null:!0),eo)return Xr;Xr=Xr.return}while(Xr!==null);return null}function Vi$1(Xr,eo,to,ro,no){return Xr.mode&1?(Xr.flags|=65536,Xr.lanes=no,Xr):(Xr===eo?Xr.flags|=65536:(Xr.flags|=128,to.flags|=131072,to.flags&=-52805,to.tag===1&&(to.alternate===null?to.tag=17:(eo=mh(-1,1),eo.tag=2,nh(to,eo,1))),to.lanes|=1),Xr)}var Wi$3=ua$1.ReactCurrentOwner,dh$1=!1;function Xi$2(Xr,eo,to,ro){eo.child=Xr===null?Vg$1(eo,null,to,ro):Ug(eo,Xr.child,to,ro)}function Yi$2(Xr,eo,to,ro,no){to=to.render;var io=eo.ref;return ch$1(eo,no),ro=Nh(Xr,eo,to,ro,io,no),to=Sh(),Xr!==null&&!dh$1?(eo.updateQueue=Xr.updateQueue,eo.flags&=-2053,Xr.lanes&=~no,Zi$2(Xr,eo,no)):(I$3&&to&&vg(eo),eo.flags|=1,Xi$2(Xr,eo,ro,no),eo.child)}function $i$1(Xr,eo,to,ro,no){if(Xr===null){var io=to.type;return typeof io=="function"&&!aj(io)&&io.defaultProps===void 0&&to.compare===null&&to.defaultProps===void 0?(eo.tag=15,eo.type=io,bj(Xr,eo,io,ro,no)):(Xr=Rg(to.type,null,ro,eo,eo.mode,no),Xr.ref=eo.ref,Xr.return=eo,eo.child=Xr)}if(io=Xr.child,!(Xr.lanes&no)){var oo=io.memoizedProps;if(to=to.compare,to=to!==null?to:Ie$1,to(oo,ro)&&Xr.ref===eo.ref)return Zi$2(Xr,eo,no)}return eo.flags|=1,Xr=Pg(io,ro),Xr.ref=eo.ref,Xr.return=eo,eo.child=Xr}function bj(Xr,eo,to,ro,no){if(Xr!==null){var io=Xr.memoizedProps;if(Ie$1(io,ro)&&Xr.ref===eo.ref)if(dh$1=!1,eo.pendingProps=ro=io,(Xr.lanes&no)!==0)Xr.flags&131072&&(dh$1=!0);else return eo.lanes=Xr.lanes,Zi$2(Xr,eo,no)}return cj(Xr,eo,to,ro,no)}function dj(Xr,eo,to){var ro=eo.pendingProps,no=ro.children,io=Xr!==null?Xr.memoizedState:null;if(ro.mode==="hidden")if(!(eo.mode&1))eo.memoizedState={baseLanes:0,cachePool:null,transitions:null},G$8(ej,fj),fj|=to;else{if(!(to&1073741824))return Xr=io!==null?io.baseLanes|to:to,eo.lanes=eo.childLanes=1073741824,eo.memoizedState={baseLanes:Xr,cachePool:null,transitions:null},eo.updateQueue=null,G$8(ej,fj),fj|=Xr,null;eo.memoizedState={baseLanes:0,cachePool:null,transitions:null},ro=io!==null?io.baseLanes:to,G$8(ej,fj),fj|=ro}else io!==null?(ro=io.baseLanes|to,eo.memoizedState=null):ro=to,G$8(ej,fj),fj|=ro;return Xi$2(Xr,eo,no,to),eo.child}function gj(Xr,eo){var to=eo.ref;(Xr===null&&to!==null||Xr!==null&&Xr.ref!==to)&&(eo.flags|=512,eo.flags|=2097152)}function cj(Xr,eo,to,ro,no){var io=Zf(to)?Xf:H$7.current;return io=Yf(eo,io),ch$1(eo,no),to=Nh(Xr,eo,to,ro,io,no),ro=Sh(),Xr!==null&&!dh$1?(eo.updateQueue=Xr.updateQueue,eo.flags&=-2053,Xr.lanes&=~no,Zi$2(Xr,eo,no)):(I$3&&ro&&vg(eo),eo.flags|=1,Xi$2(Xr,eo,to,no),eo.child)}function hj(Xr,eo,to,ro,no){if(Zf(to)){var io=!0;cg(eo)}else io=!1;if(ch$1(eo,no),eo.stateNode===null)ij(Xr,eo),Gi$2(eo,to,ro),Ii$1(eo,to,ro,no),ro=!0;else if(Xr===null){var oo=eo.stateNode,ao=eo.memoizedProps;oo.props=ao;var so=oo.context,co=to.contextType;typeof co=="object"&&co!==null?co=eh(co):(co=Zf(to)?Xf:H$7.current,co=Yf(eo,co));var lo=to.getDerivedStateFromProps,uo=typeof lo=="function"||typeof oo.getSnapshotBeforeUpdate=="function";uo||typeof oo.UNSAFE_componentWillReceiveProps!="function"&&typeof oo.componentWillReceiveProps!="function"||(ao!==ro||so!==co)&&Hi$2(eo,oo,ro,co),jh=!1;var ho=eo.memoizedState;oo.state=ho,qh(eo,ro,oo,no),so=eo.memoizedState,ao!==ro||ho!==so||Wf.current||jh?(typeof lo=="function"&&(Di$1(eo,to,lo,ro),so=eo.memoizedState),(ao=jh||Fi$2(eo,to,ao,ro,ho,so,co))?(uo||typeof oo.UNSAFE_componentWillMount!="function"&&typeof oo.componentWillMount!="function"||(typeof oo.componentWillMount=="function"&&oo.componentWillMount(),typeof oo.UNSAFE_componentWillMount=="function"&&oo.UNSAFE_componentWillMount()),typeof oo.componentDidMount=="function"&&(eo.flags|=4194308)):(typeof oo.componentDidMount=="function"&&(eo.flags|=4194308),eo.memoizedProps=ro,eo.memoizedState=so),oo.props=ro,oo.state=so,oo.context=co,ro=ao):(typeof oo.componentDidMount=="function"&&(eo.flags|=4194308),ro=!1)}else{oo=eo.stateNode,lh(Xr,eo),ao=eo.memoizedProps,co=eo.type===eo.elementType?ao:Ci$1(eo.type,ao),oo.props=co,uo=eo.pendingProps,ho=oo.context,so=to.contextType,typeof so=="object"&&so!==null?so=eh(so):(so=Zf(to)?Xf:H$7.current,so=Yf(eo,so));var go=to.getDerivedStateFromProps;(lo=typeof go=="function"||typeof oo.getSnapshotBeforeUpdate=="function")||typeof oo.UNSAFE_componentWillReceiveProps!="function"&&typeof oo.componentWillReceiveProps!="function"||(ao!==uo||ho!==so)&&Hi$2(eo,oo,ro,so),jh=!1,ho=eo.memoizedState,oo.state=ho,qh(eo,ro,oo,no);var bo=eo.memoizedState;ao!==uo||ho!==bo||Wf.current||jh?(typeof go=="function"&&(Di$1(eo,to,go,ro),bo=eo.memoizedState),(co=jh||Fi$2(eo,to,co,ro,ho,bo,so)||!1)?(lo||typeof oo.UNSAFE_componentWillUpdate!="function"&&typeof oo.componentWillUpdate!="function"||(typeof oo.componentWillUpdate=="function"&&oo.componentWillUpdate(ro,bo,so),typeof oo.UNSAFE_componentWillUpdate=="function"&&oo.UNSAFE_componentWillUpdate(ro,bo,so)),typeof oo.componentDidUpdate=="function"&&(eo.flags|=4),typeof oo.getSnapshotBeforeUpdate=="function"&&(eo.flags|=1024)):(typeof oo.componentDidUpdate!="function"||ao===Xr.memoizedProps&&ho===Xr.memoizedState||(eo.flags|=4),typeof oo.getSnapshotBeforeUpdate!="function"||ao===Xr.memoizedProps&&ho===Xr.memoizedState||(eo.flags|=1024),eo.memoizedProps=ro,eo.memoizedState=bo),oo.props=ro,oo.state=bo,oo.context=so,ro=co):(typeof oo.componentDidUpdate!="function"||ao===Xr.memoizedProps&&ho===Xr.memoizedState||(eo.flags|=4),typeof oo.getSnapshotBeforeUpdate!="function"||ao===Xr.memoizedProps&&ho===Xr.memoizedState||(eo.flags|=1024),ro=!1)}return jj(Xr,eo,to,ro,io,no)}function jj(Xr,eo,to,ro,no,io){gj(Xr,eo);var oo=(eo.flags&128)!==0;if(!ro&&!oo)return no&&dg(eo,to,!1),Zi$2(Xr,eo,io);ro=eo.stateNode,Wi$3.current=eo;var ao=oo&&typeof to.getDerivedStateFromError!="function"?null:ro.render();return eo.flags|=1,Xr!==null&&oo?(eo.child=Ug(eo,Xr.child,null,io),eo.child=Ug(eo,null,ao,io)):Xi$2(Xr,eo,ao,io),eo.memoizedState=ro.state,no&&dg(eo,to,!0),eo.child}function kj(Xr){var eo=Xr.stateNode;eo.pendingContext?ag(Xr,eo.pendingContext,eo.pendingContext!==eo.context):eo.context&&ag(Xr,eo.context,!1),yh(Xr,eo.containerInfo)}function lj(Xr,eo,to,ro,no){return Ig(),Jg$1(no),eo.flags|=256,Xi$2(Xr,eo,to,ro),eo.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(Xr){return{baseLanes:Xr,cachePool:null,transitions:null}}function oj(Xr,eo,to){var ro=eo.pendingProps,no=L$a.current,io=!1,oo=(eo.flags&128)!==0,ao;if((ao=oo)||(ao=Xr!==null&&Xr.memoizedState===null?!1:(no&2)!==0),ao?(io=!0,eo.flags&=-129):(Xr===null||Xr.memoizedState!==null)&&(no|=1),G$8(L$a,no&1),Xr===null)return Eg(eo),Xr=eo.memoizedState,Xr!==null&&(Xr=Xr.dehydrated,Xr!==null)?(eo.mode&1?Xr.data==="$!"?eo.lanes=8:eo.lanes=1073741824:eo.lanes=1,null):(oo=ro.children,Xr=ro.fallback,io?(ro=eo.mode,io=eo.child,oo={mode:"hidden",children:oo},!(ro&1)&&io!==null?(io.childLanes=0,io.pendingProps=oo):io=pj(oo,ro,0,null),Xr=Tg(Xr,ro,to,null),io.return=eo,Xr.return=eo,io.sibling=Xr,eo.child=io,eo.child.memoizedState=nj(to),eo.memoizedState=mj,Xr):qj(eo,oo));if(no=Xr.memoizedState,no!==null&&(ao=no.dehydrated,ao!==null))return rj(Xr,eo,oo,ro,ao,no,to);if(io){io=ro.fallback,oo=eo.mode,no=Xr.child,ao=no.sibling;var so={mode:"hidden",children:ro.children};return!(oo&1)&&eo.child!==no?(ro=eo.child,ro.childLanes=0,ro.pendingProps=so,eo.deletions=null):(ro=Pg(no,so),ro.subtreeFlags=no.subtreeFlags&14680064),ao!==null?io=Pg(ao,io):(io=Tg(io,oo,to,null),io.flags|=2),io.return=eo,ro.return=eo,ro.sibling=io,eo.child=ro,ro=io,io=eo.child,oo=Xr.child.memoizedState,oo=oo===null?nj(to):{baseLanes:oo.baseLanes|to,cachePool:null,transitions:oo.transitions},io.memoizedState=oo,io.childLanes=Xr.childLanes&~to,eo.memoizedState=mj,ro}return io=Xr.child,Xr=io.sibling,ro=Pg(io,{mode:"visible",children:ro.children}),!(eo.mode&1)&&(ro.lanes=to),ro.return=eo,ro.sibling=null,Xr!==null&&(to=eo.deletions,to===null?(eo.deletions=[Xr],eo.flags|=16):to.push(Xr)),eo.child=ro,eo.memoizedState=null,ro}function qj(Xr,eo){return eo=pj({mode:"visible",children:eo},Xr.mode,0,null),eo.return=Xr,Xr.child=eo}function sj(Xr,eo,to,ro){return ro!==null&&Jg$1(ro),Ug(eo,Xr.child,null,to),Xr=qj(eo,eo.pendingProps.children),Xr.flags|=2,eo.memoizedState=null,Xr}function rj(Xr,eo,to,ro,no,io,oo){if(to)return eo.flags&256?(eo.flags&=-257,ro=Ki$1(Error(p$d(422))),sj(Xr,eo,oo,ro)):eo.memoizedState!==null?(eo.child=Xr.child,eo.flags|=128,null):(io=ro.fallback,no=eo.mode,ro=pj({mode:"visible",children:ro.children},no,0,null),io=Tg(io,no,oo,null),io.flags|=2,ro.return=eo,io.return=eo,ro.sibling=io,eo.child=ro,eo.mode&1&&Ug(eo,Xr.child,null,oo),eo.child.memoizedState=nj(oo),eo.memoizedState=mj,io);if(!(eo.mode&1))return sj(Xr,eo,oo,null);if(no.data==="$!"){if(ro=no.nextSibling&&no.nextSibling.dataset,ro)var ao=ro.dgst;return ro=ao,io=Error(p$d(419)),ro=Ki$1(io,ro,void 0),sj(Xr,eo,oo,ro)}if(ao=(oo&Xr.childLanes)!==0,dh$1||ao){if(ro=Q$9,ro!==null){switch(oo&-oo){case 4:no=2;break;case 16:no=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:no=32;break;case 536870912:no=268435456;break;default:no=0}no=no&(ro.suspendedLanes|oo)?0:no,no!==0&&no!==io.retryLane&&(io.retryLane=no,ih(Xr,no),gi$1(ro,Xr,no,-1))}return tj(),ro=Ki$1(Error(p$d(421))),sj(Xr,eo,oo,ro)}return no.data==="$?"?(eo.flags|=128,eo.child=Xr.child,eo=uj.bind(null,Xr),no._reactRetry=eo,null):(Xr=io.treeContext,yg=Lf(no.nextSibling),xg=eo,I$3=!0,zg$1=null,Xr!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg$1,rg=Xr.id,sg=Xr.overflow,qg$1=eo),eo=qj(eo,ro.children),eo.flags|=4096,eo)}function vj(Xr,eo,to){Xr.lanes|=eo;var ro=Xr.alternate;ro!==null&&(ro.lanes|=eo),bh(Xr.return,eo,to)}function wj(Xr,eo,to,ro,no){var io=Xr.memoizedState;io===null?Xr.memoizedState={isBackwards:eo,rendering:null,renderingStartTime:0,last:ro,tail:to,tailMode:no}:(io.isBackwards=eo,io.rendering=null,io.renderingStartTime=0,io.last=ro,io.tail=to,io.tailMode=no)}function xj(Xr,eo,to){var ro=eo.pendingProps,no=ro.revealOrder,io=ro.tail;if(Xi$2(Xr,eo,ro.children,to),ro=L$a.current,ro&2)ro=ro&1|2,eo.flags|=128;else{if(Xr!==null&&Xr.flags&128)e:for(Xr=eo.child;Xr!==null;){if(Xr.tag===13)Xr.memoizedState!==null&&vj(Xr,to,eo);else if(Xr.tag===19)vj(Xr,to,eo);else if(Xr.child!==null){Xr.child.return=Xr,Xr=Xr.child;continue}if(Xr===eo)break e;for(;Xr.sibling===null;){if(Xr.return===null||Xr.return===eo)break e;Xr=Xr.return}Xr.sibling.return=Xr.return,Xr=Xr.sibling}ro&=1}if(G$8(L$a,ro),!(eo.mode&1))eo.memoizedState=null;else switch(no){case"forwards":for(to=eo.child,no=null;to!==null;)Xr=to.alternate,Xr!==null&&Ch(Xr)===null&&(no=to),to=to.sibling;to=no,to===null?(no=eo.child,eo.child=null):(no=to.sibling,to.sibling=null),wj(eo,!1,no,to,io);break;case"backwards":for(to=null,no=eo.child,eo.child=null;no!==null;){if(Xr=no.alternate,Xr!==null&&Ch(Xr)===null){eo.child=no;break}Xr=no.sibling,no.sibling=to,to=no,no=Xr}wj(eo,!0,to,null,io);break;case"together":wj(eo,!1,null,null,void 0);break;default:eo.memoizedState=null}return eo.child}function ij(Xr,eo){!(eo.mode&1)&&Xr!==null&&(Xr.alternate=null,eo.alternate=null,eo.flags|=2)}function Zi$2(Xr,eo,to){if(Xr!==null&&(eo.dependencies=Xr.dependencies),rh|=eo.lanes,!(to&eo.childLanes))return null;if(Xr!==null&&eo.child!==Xr.child)throw Error(p$d(153));if(eo.child!==null){for(Xr=eo.child,to=Pg(Xr,Xr.pendingProps),eo.child=to,to.return=eo;Xr.sibling!==null;)Xr=Xr.sibling,to=to.sibling=Pg(Xr,Xr.pendingProps),to.return=eo;to.sibling=null}return eo.child}function yj(Xr,eo,to){switch(eo.tag){case 3:kj(eo),Ig();break;case 5:Ah(eo);break;case 1:Zf(eo.type)&&cg(eo);break;case 4:yh(eo,eo.stateNode.containerInfo);break;case 10:var ro=eo.type._context,no=eo.memoizedProps.value;G$8(Wg,ro._currentValue),ro._currentValue=no;break;case 13:if(ro=eo.memoizedState,ro!==null)return ro.dehydrated!==null?(G$8(L$a,L$a.current&1),eo.flags|=128,null):to&eo.child.childLanes?oj(Xr,eo,to):(G$8(L$a,L$a.current&1),Xr=Zi$2(Xr,eo,to),Xr!==null?Xr.sibling:null);G$8(L$a,L$a.current&1);break;case 19:if(ro=(to&eo.childLanes)!==0,Xr.flags&128){if(ro)return xj(Xr,eo,to);eo.flags|=128}if(no=eo.memoizedState,no!==null&&(no.rendering=null,no.tail=null,no.lastEffect=null),G$8(L$a,L$a.current),ro)break;return null;case 22:case 23:return eo.lanes=0,dj(Xr,eo,to)}return Zi$2(Xr,eo,to)}var zj,Aj,Bj,Cj;zj=function(Xr,eo){for(var to=eo.child;to!==null;){if(to.tag===5||to.tag===6)Xr.appendChild(to.stateNode);else if(to.tag!==4&&to.child!==null){to.child.return=to,to=to.child;continue}if(to===eo)break;for(;to.sibling===null;){if(to.return===null||to.return===eo)return;to=to.return}to.sibling.return=to.return,to=to.sibling}};Aj=function(){};Bj=function(Xr,eo,to,ro){var no=Xr.memoizedProps;if(no!==ro){Xr=eo.stateNode,xh(uh.current);var io=null;switch(to){case"input":no=Ya(Xr,no),ro=Ya(Xr,ro),io=[];break;case"select":no=A$b({},no,{value:void 0}),ro=A$b({},ro,{value:void 0}),io=[];break;case"textarea":no=gb(Xr,no),ro=gb(Xr,ro),io=[];break;default:typeof no.onClick!="function"&&typeof ro.onClick=="function"&&(Xr.onclick=Bf)}ub(to,ro);var oo;to=null;for(co in no)if(!ro.hasOwnProperty(co)&&no.hasOwnProperty(co)&&no[co]!=null)if(co==="style"){var ao=no[co];for(oo in ao)ao.hasOwnProperty(oo)&&(to||(to={}),to[oo]="")}else co!=="dangerouslySetInnerHTML"&&co!=="children"&&co!=="suppressContentEditableWarning"&&co!=="suppressHydrationWarning"&&co!=="autoFocus"&&(ea$1.hasOwnProperty(co)?io||(io=[]):(io=io||[]).push(co,null));for(co in ro){var so=ro[co];if(ao=no!=null?no[co]:void 0,ro.hasOwnProperty(co)&&so!==ao&&(so!=null||ao!=null))if(co==="style")if(ao){for(oo in ao)!ao.hasOwnProperty(oo)||so&&so.hasOwnProperty(oo)||(to||(to={}),to[oo]="");for(oo in so)so.hasOwnProperty(oo)&&ao[oo]!==so[oo]&&(to||(to={}),to[oo]=so[oo])}else to||(io||(io=[]),io.push(co,to)),to=so;else co==="dangerouslySetInnerHTML"?(so=so?so.__html:void 0,ao=ao?ao.__html:void 0,so!=null&&ao!==so&&(io=io||[]).push(co,so)):co==="children"?typeof so!="string"&&typeof so!="number"||(io=io||[]).push(co,""+so):co!=="suppressContentEditableWarning"&&co!=="suppressHydrationWarning"&&(ea$1.hasOwnProperty(co)?(so!=null&&co==="onScroll"&&D$9("scroll",Xr),io||ao===so||(io=[])):(io=io||[]).push(co,so))}to&&(io=io||[]).push("style",to);var co=io;(eo.updateQueue=co)&&(eo.flags|=4)}};Cj=function(Xr,eo,to,ro){to!==ro&&(eo.flags|=4)};function Dj(Xr,eo){if(!I$3)switch(Xr.tailMode){case"hidden":eo=Xr.tail;for(var to=null;eo!==null;)eo.alternate!==null&&(to=eo),eo=eo.sibling;to===null?Xr.tail=null:to.sibling=null;break;case"collapsed":to=Xr.tail;for(var ro=null;to!==null;)to.alternate!==null&&(ro=to),to=to.sibling;ro===null?eo||Xr.tail===null?Xr.tail=null:Xr.tail.sibling=null:ro.sibling=null}}function S$9(Xr){var eo=Xr.alternate!==null&&Xr.alternate.child===Xr.child,to=0,ro=0;if(eo)for(var no=Xr.child;no!==null;)to|=no.lanes|no.childLanes,ro|=no.subtreeFlags&14680064,ro|=no.flags&14680064,no.return=Xr,no=no.sibling;else for(no=Xr.child;no!==null;)to|=no.lanes|no.childLanes,ro|=no.subtreeFlags,ro|=no.flags,no.return=Xr,no=no.sibling;return Xr.subtreeFlags|=ro,Xr.childLanes=to,eo}function Ej(Xr,eo,to){var ro=eo.pendingProps;switch(wg(eo),eo.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$9(eo),null;case 1:return Zf(eo.type)&&$f(),S$9(eo),null;case 3:return ro=eo.stateNode,zh(),E$a(Wf),E$a(H$7),Eh(),ro.pendingContext&&(ro.context=ro.pendingContext,ro.pendingContext=null),(Xr===null||Xr.child===null)&&(Gg$1(eo)?eo.flags|=4:Xr===null||Xr.memoizedState.isDehydrated&&!(eo.flags&256)||(eo.flags|=1024,zg$1!==null&&(Fj(zg$1),zg$1=null))),Aj(Xr,eo),S$9(eo),null;case 5:Bh(eo);var no=xh(wh.current);if(to=eo.type,Xr!==null&&eo.stateNode!=null)Bj(Xr,eo,to,ro,no),Xr.ref!==eo.ref&&(eo.flags|=512,eo.flags|=2097152);else{if(!ro){if(eo.stateNode===null)throw Error(p$d(166));return S$9(eo),null}if(Xr=xh(uh.current),Gg$1(eo)){ro=eo.stateNode,to=eo.type;var io=eo.memoizedProps;switch(ro[Of]=eo,ro[Pf]=io,Xr=(eo.mode&1)!==0,to){case"dialog":D$9("cancel",ro),D$9("close",ro);break;case"iframe":case"object":case"embed":D$9("load",ro);break;case"video":case"audio":for(no=0;no<\/script>",Xr=Xr.removeChild(Xr.firstChild)):typeof ro.is=="string"?Xr=oo.createElement(to,{is:ro.is}):(Xr=oo.createElement(to),to==="select"&&(oo=Xr,ro.multiple?oo.multiple=!0:ro.size&&(oo.size=ro.size))):Xr=oo.createElementNS(Xr,to),Xr[Of]=eo,Xr[Pf]=ro,zj(Xr,eo,!1,!1),eo.stateNode=Xr;e:{switch(oo=vb(to,ro),to){case"dialog":D$9("cancel",Xr),D$9("close",Xr),no=ro;break;case"iframe":case"object":case"embed":D$9("load",Xr),no=ro;break;case"video":case"audio":for(no=0;noGj&&(eo.flags|=128,ro=!0,Dj(io,!1),eo.lanes=4194304)}else{if(!ro)if(Xr=Ch(oo),Xr!==null){if(eo.flags|=128,ro=!0,to=Xr.updateQueue,to!==null&&(eo.updateQueue=to,eo.flags|=4),Dj(io,!0),io.tail===null&&io.tailMode==="hidden"&&!oo.alternate&&!I$3)return S$9(eo),null}else 2*B$a()-io.renderingStartTime>Gj&&to!==1073741824&&(eo.flags|=128,ro=!0,Dj(io,!1),eo.lanes=4194304);io.isBackwards?(oo.sibling=eo.child,eo.child=oo):(to=io.last,to!==null?to.sibling=oo:eo.child=oo,io.last=oo)}return io.tail!==null?(eo=io.tail,io.rendering=eo,io.tail=eo.sibling,io.renderingStartTime=B$a(),eo.sibling=null,to=L$a.current,G$8(L$a,ro?to&1|2:to&1),eo):(S$9(eo),null);case 22:case 23:return Hj(),ro=eo.memoizedState!==null,Xr!==null&&Xr.memoizedState!==null!==ro&&(eo.flags|=8192),ro&&eo.mode&1?fj&1073741824&&(S$9(eo),eo.subtreeFlags&6&&(eo.flags|=8192)):S$9(eo),null;case 24:return null;case 25:return null}throw Error(p$d(156,eo.tag))}function Ij(Xr,eo){switch(wg(eo),eo.tag){case 1:return Zf(eo.type)&&$f(),Xr=eo.flags,Xr&65536?(eo.flags=Xr&-65537|128,eo):null;case 3:return zh(),E$a(Wf),E$a(H$7),Eh(),Xr=eo.flags,Xr&65536&&!(Xr&128)?(eo.flags=Xr&-65537|128,eo):null;case 5:return Bh(eo),null;case 13:if(E$a(L$a),Xr=eo.memoizedState,Xr!==null&&Xr.dehydrated!==null){if(eo.alternate===null)throw Error(p$d(340));Ig()}return Xr=eo.flags,Xr&65536?(eo.flags=Xr&-65537|128,eo):null;case 19:return E$a(L$a),null;case 4:return zh(),null;case 10:return ah(eo.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U$8=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V$6=null;function Lj(Xr,eo){var to=Xr.ref;if(to!==null)if(typeof to=="function")try{to(null)}catch(ro){W$9(Xr,eo,ro)}else to.current=null}function Mj(Xr,eo,to){try{to()}catch(ro){W$9(Xr,eo,ro)}}var Nj=!1;function Oj(Xr,eo){if(Cf=dd,Xr=Me$3(),Ne$4(Xr)){if("selectionStart"in Xr)var to={start:Xr.selectionStart,end:Xr.selectionEnd};else e:{to=(to=Xr.ownerDocument)&&to.defaultView||window;var ro=to.getSelection&&to.getSelection();if(ro&&ro.rangeCount!==0){to=ro.anchorNode;var no=ro.anchorOffset,io=ro.focusNode;ro=ro.focusOffset;try{to.nodeType,io.nodeType}catch{to=null;break e}var oo=0,ao=-1,so=-1,co=0,lo=0,uo=Xr,ho=null;t:for(;;){for(var go;uo!==to||no!==0&&uo.nodeType!==3||(ao=oo+no),uo!==io||ro!==0&&uo.nodeType!==3||(so=oo+ro),uo.nodeType===3&&(oo+=uo.nodeValue.length),(go=uo.firstChild)!==null;)ho=uo,uo=go;for(;;){if(uo===Xr)break t;if(ho===to&&++co===no&&(ao=oo),ho===io&&++lo===ro&&(so=oo),(go=uo.nextSibling)!==null)break;uo=ho,ho=uo.parentNode}uo=go}to=ao===-1||so===-1?null:{start:ao,end:so}}else to=null}to=to||{start:0,end:0}}else to=null;for(Df={focusedElem:Xr,selectionRange:to},dd=!1,V$6=eo;V$6!==null;)if(eo=V$6,Xr=eo.child,(eo.subtreeFlags&1028)!==0&&Xr!==null)Xr.return=eo,V$6=Xr;else for(;V$6!==null;){eo=V$6;try{var bo=eo.alternate;if(eo.flags&1024)switch(eo.tag){case 0:case 11:case 15:break;case 1:if(bo!==null){var wo=bo.memoizedProps,Eo=bo.memoizedState,$o=eo.stateNode,Co=$o.getSnapshotBeforeUpdate(eo.elementType===eo.type?wo:Ci$1(eo.type,wo),Eo);$o.__reactInternalSnapshotBeforeUpdate=Co}break;case 3:var Ro=eo.stateNode.containerInfo;Ro.nodeType===1?Ro.textContent="":Ro.nodeType===9&&Ro.documentElement&&Ro.removeChild(Ro.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$d(163))}}catch(Oo){W$9(eo,eo.return,Oo)}if(Xr=eo.sibling,Xr!==null){Xr.return=eo.return,V$6=Xr;break}V$6=eo.return}return bo=Nj,Nj=!1,bo}function Pj(Xr,eo,to){var ro=eo.updateQueue;if(ro=ro!==null?ro.lastEffect:null,ro!==null){var no=ro=ro.next;do{if((no.tag&Xr)===Xr){var io=no.destroy;no.destroy=void 0,io!==void 0&&Mj(eo,to,io)}no=no.next}while(no!==ro)}}function Qj(Xr,eo){if(eo=eo.updateQueue,eo=eo!==null?eo.lastEffect:null,eo!==null){var to=eo=eo.next;do{if((to.tag&Xr)===Xr){var ro=to.create;to.destroy=ro()}to=to.next}while(to!==eo)}}function Rj(Xr){var eo=Xr.ref;if(eo!==null){var to=Xr.stateNode;switch(Xr.tag){case 5:Xr=to;break;default:Xr=to}typeof eo=="function"?eo(Xr):eo.current=Xr}}function Sj(Xr){var eo=Xr.alternate;eo!==null&&(Xr.alternate=null,Sj(eo)),Xr.child=null,Xr.deletions=null,Xr.sibling=null,Xr.tag===5&&(eo=Xr.stateNode,eo!==null&&(delete eo[Of],delete eo[Pf],delete eo[of],delete eo[Qf],delete eo[Rf])),Xr.stateNode=null,Xr.return=null,Xr.dependencies=null,Xr.memoizedProps=null,Xr.memoizedState=null,Xr.pendingProps=null,Xr.stateNode=null,Xr.updateQueue=null}function Tj(Xr){return Xr.tag===5||Xr.tag===3||Xr.tag===4}function Uj(Xr){e:for(;;){for(;Xr.sibling===null;){if(Xr.return===null||Tj(Xr.return))return null;Xr=Xr.return}for(Xr.sibling.return=Xr.return,Xr=Xr.sibling;Xr.tag!==5&&Xr.tag!==6&&Xr.tag!==18;){if(Xr.flags&2||Xr.child===null||Xr.tag===4)continue e;Xr.child.return=Xr,Xr=Xr.child}if(!(Xr.flags&2))return Xr.stateNode}}function Vj(Xr,eo,to){var ro=Xr.tag;if(ro===5||ro===6)Xr=Xr.stateNode,eo?to.nodeType===8?to.parentNode.insertBefore(Xr,eo):to.insertBefore(Xr,eo):(to.nodeType===8?(eo=to.parentNode,eo.insertBefore(Xr,to)):(eo=to,eo.appendChild(Xr)),to=to._reactRootContainer,to!=null||eo.onclick!==null||(eo.onclick=Bf));else if(ro!==4&&(Xr=Xr.child,Xr!==null))for(Vj(Xr,eo,to),Xr=Xr.sibling;Xr!==null;)Vj(Xr,eo,to),Xr=Xr.sibling}function Wj(Xr,eo,to){var ro=Xr.tag;if(ro===5||ro===6)Xr=Xr.stateNode,eo?to.insertBefore(Xr,eo):to.appendChild(Xr);else if(ro!==4&&(Xr=Xr.child,Xr!==null))for(Wj(Xr,eo,to),Xr=Xr.sibling;Xr!==null;)Wj(Xr,eo,to),Xr=Xr.sibling}var X$8=null,Xj=!1;function Yj(Xr,eo,to){for(to=to.child;to!==null;)Zj(Xr,eo,to),to=to.sibling}function Zj(Xr,eo,to){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,to)}catch{}switch(to.tag){case 5:U$8||Lj(to,eo);case 6:var ro=X$8,no=Xj;X$8=null,Yj(Xr,eo,to),X$8=ro,Xj=no,X$8!==null&&(Xj?(Xr=X$8,to=to.stateNode,Xr.nodeType===8?Xr.parentNode.removeChild(to):Xr.removeChild(to)):X$8.removeChild(to.stateNode));break;case 18:X$8!==null&&(Xj?(Xr=X$8,to=to.stateNode,Xr.nodeType===8?Kf(Xr.parentNode,to):Xr.nodeType===1&&Kf(Xr,to),bd(Xr)):Kf(X$8,to.stateNode));break;case 4:ro=X$8,no=Xj,X$8=to.stateNode.containerInfo,Xj=!0,Yj(Xr,eo,to),X$8=ro,Xj=no;break;case 0:case 11:case 14:case 15:if(!U$8&&(ro=to.updateQueue,ro!==null&&(ro=ro.lastEffect,ro!==null))){no=ro=ro.next;do{var io=no,oo=io.destroy;io=io.tag,oo!==void 0&&(io&2||io&4)&&Mj(to,eo,oo),no=no.next}while(no!==ro)}Yj(Xr,eo,to);break;case 1:if(!U$8&&(Lj(to,eo),ro=to.stateNode,typeof ro.componentWillUnmount=="function"))try{ro.props=to.memoizedProps,ro.state=to.memoizedState,ro.componentWillUnmount()}catch(ao){W$9(to,eo,ao)}Yj(Xr,eo,to);break;case 21:Yj(Xr,eo,to);break;case 22:to.mode&1?(U$8=(ro=U$8)||to.memoizedState!==null,Yj(Xr,eo,to),U$8=ro):Yj(Xr,eo,to);break;default:Yj(Xr,eo,to)}}function ak(Xr){var eo=Xr.updateQueue;if(eo!==null){Xr.updateQueue=null;var to=Xr.stateNode;to===null&&(to=Xr.stateNode=new Kj),eo.forEach(function(ro){var no=bk.bind(null,Xr,ro);to.has(ro)||(to.add(ro),ro.then(no,no))})}}function ck(Xr,eo){var to=eo.deletions;if(to!==null)for(var ro=0;rono&&(no=oo),ro&=~io}if(ro=no,ro=B$a()-ro,ro=(120>ro?120:480>ro?480:1080>ro?1080:1920>ro?1920:3e3>ro?3e3:4320>ro?4320:1960*lk(ro/1960))-ro,10Xr?16:Xr,wk===null)var ro=!1;else{if(Xr=wk,wk=null,xk=0,K$6&6)throw Error(p$d(331));var no=K$6;for(K$6|=4,V$6=Xr.current;V$6!==null;){var io=V$6,oo=io.child;if(V$6.flags&16){var ao=io.deletions;if(ao!==null){for(var so=0;soB$a()-fk?Kk(Xr,0):rk|=to),Dk(Xr,eo)}function Yk(Xr,eo){eo===0&&(Xr.mode&1?(eo=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):eo=1);var to=R$9();Xr=ih(Xr,eo),Xr!==null&&(Ac(Xr,eo,to),Dk(Xr,to))}function uj(Xr){var eo=Xr.memoizedState,to=0;eo!==null&&(to=eo.retryLane),Yk(Xr,to)}function bk(Xr,eo){var to=0;switch(Xr.tag){case 13:var ro=Xr.stateNode,no=Xr.memoizedState;no!==null&&(to=no.retryLane);break;case 19:ro=Xr.stateNode;break;default:throw Error(p$d(314))}ro!==null&&ro.delete(eo),Yk(Xr,to)}var Vk;Vk=function(Xr,eo,to){if(Xr!==null)if(Xr.memoizedProps!==eo.pendingProps||Wf.current)dh$1=!0;else{if(!(Xr.lanes&to)&&!(eo.flags&128))return dh$1=!1,yj(Xr,eo,to);dh$1=!!(Xr.flags&131072)}else dh$1=!1,I$3&&eo.flags&1048576&&ug(eo,ng,eo.index);switch(eo.lanes=0,eo.tag){case 2:var ro=eo.type;ij(Xr,eo),Xr=eo.pendingProps;var no=Yf(eo,H$7.current);ch$1(eo,to),no=Nh(null,eo,ro,Xr,no,to);var io=Sh();return eo.flags|=1,typeof no=="object"&&no!==null&&typeof no.render=="function"&&no.$$typeof===void 0?(eo.tag=1,eo.memoizedState=null,eo.updateQueue=null,Zf(ro)?(io=!0,cg(eo)):io=!1,eo.memoizedState=no.state!==null&&no.state!==void 0?no.state:null,kh(eo),no.updater=Ei$1,eo.stateNode=no,no._reactInternals=eo,Ii$1(eo,ro,Xr,to),eo=jj(null,eo,ro,!0,io,to)):(eo.tag=0,I$3&&io&&vg(eo),Xi$2(null,eo,no,to),eo=eo.child),eo;case 16:ro=eo.elementType;e:{switch(ij(Xr,eo),Xr=eo.pendingProps,no=ro._init,ro=no(ro._payload),eo.type=ro,no=eo.tag=Zk(ro),Xr=Ci$1(ro,Xr),no){case 0:eo=cj(null,eo,ro,Xr,to);break e;case 1:eo=hj(null,eo,ro,Xr,to);break e;case 11:eo=Yi$2(null,eo,ro,Xr,to);break e;case 14:eo=$i$1(null,eo,ro,Ci$1(ro.type,Xr),to);break e}throw Error(p$d(306,ro,""))}return eo;case 0:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),cj(Xr,eo,ro,no,to);case 1:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),hj(Xr,eo,ro,no,to);case 3:e:{if(kj(eo),Xr===null)throw Error(p$d(387));ro=eo.pendingProps,io=eo.memoizedState,no=io.element,lh(Xr,eo),qh(eo,ro,null,to);var oo=eo.memoizedState;if(ro=oo.element,io.isDehydrated)if(io={element:ro,isDehydrated:!1,cache:oo.cache,pendingSuspenseBoundaries:oo.pendingSuspenseBoundaries,transitions:oo.transitions},eo.updateQueue.baseState=io,eo.memoizedState=io,eo.flags&256){no=Ji$2(Error(p$d(423)),eo),eo=lj(Xr,eo,ro,to,no);break e}else if(ro!==no){no=Ji$2(Error(p$d(424)),eo),eo=lj(Xr,eo,ro,to,no);break e}else for(yg=Lf(eo.stateNode.containerInfo.firstChild),xg=eo,I$3=!0,zg$1=null,to=Vg$1(eo,null,ro,to),eo.child=to;to;)to.flags=to.flags&-3|4096,to=to.sibling;else{if(Ig(),ro===no){eo=Zi$2(Xr,eo,to);break e}Xi$2(Xr,eo,ro,to)}eo=eo.child}return eo;case 5:return Ah(eo),Xr===null&&Eg(eo),ro=eo.type,no=eo.pendingProps,io=Xr!==null?Xr.memoizedProps:null,oo=no.children,Ef(ro,no)?oo=null:io!==null&&Ef(ro,io)&&(eo.flags|=32),gj(Xr,eo),Xi$2(Xr,eo,oo,to),eo.child;case 6:return Xr===null&&Eg(eo),null;case 13:return oj(Xr,eo,to);case 4:return yh(eo,eo.stateNode.containerInfo),ro=eo.pendingProps,Xr===null?eo.child=Ug(eo,null,ro,to):Xi$2(Xr,eo,ro,to),eo.child;case 11:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),Yi$2(Xr,eo,ro,no,to);case 7:return Xi$2(Xr,eo,eo.pendingProps,to),eo.child;case 8:return Xi$2(Xr,eo,eo.pendingProps.children,to),eo.child;case 12:return Xi$2(Xr,eo,eo.pendingProps.children,to),eo.child;case 10:e:{if(ro=eo.type._context,no=eo.pendingProps,io=eo.memoizedProps,oo=no.value,G$8(Wg,ro._currentValue),ro._currentValue=oo,io!==null)if(He$5(io.value,oo)){if(io.children===no.children&&!Wf.current){eo=Zi$2(Xr,eo,to);break e}}else for(io=eo.child,io!==null&&(io.return=eo);io!==null;){var ao=io.dependencies;if(ao!==null){oo=io.child;for(var so=ao.firstContext;so!==null;){if(so.context===ro){if(io.tag===1){so=mh(-1,to&-to),so.tag=2;var co=io.updateQueue;if(co!==null){co=co.shared;var lo=co.pending;lo===null?so.next=so:(so.next=lo.next,lo.next=so),co.pending=so}}io.lanes|=to,so=io.alternate,so!==null&&(so.lanes|=to),bh(io.return,to,eo),ao.lanes|=to;break}so=so.next}}else if(io.tag===10)oo=io.type===eo.type?null:io.child;else if(io.tag===18){if(oo=io.return,oo===null)throw Error(p$d(341));oo.lanes|=to,ao=oo.alternate,ao!==null&&(ao.lanes|=to),bh(oo,to,eo),oo=io.sibling}else oo=io.child;if(oo!==null)oo.return=io;else for(oo=io;oo!==null;){if(oo===eo){oo=null;break}if(io=oo.sibling,io!==null){io.return=oo.return,oo=io;break}oo=oo.return}io=oo}Xi$2(Xr,eo,no.children,to),eo=eo.child}return eo;case 9:return no=eo.type,ro=eo.pendingProps.children,ch$1(eo,to),no=eh(no),ro=ro(no),eo.flags|=1,Xi$2(Xr,eo,ro,to),eo.child;case 14:return ro=eo.type,no=Ci$1(ro,eo.pendingProps),no=Ci$1(ro.type,no),$i$1(Xr,eo,ro,no,to);case 15:return bj(Xr,eo,eo.type,eo.pendingProps,to);case 17:return ro=eo.type,no=eo.pendingProps,no=eo.elementType===ro?no:Ci$1(ro,no),ij(Xr,eo),eo.tag=1,Zf(ro)?(Xr=!0,cg(eo)):Xr=!1,ch$1(eo,to),Gi$2(eo,ro,no),Ii$1(eo,ro,no,to),jj(null,eo,ro,!0,Xr,to);case 19:return xj(Xr,eo,to);case 22:return dj(Xr,eo,to)}throw Error(p$d(156,eo.tag))};function Fk(Xr,eo){return ac(Xr,eo)}function $k(Xr,eo,to,ro){this.tag=Xr,this.key=to,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=eo,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=ro,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg$1(Xr,eo,to,ro){return new $k(Xr,eo,to,ro)}function aj(Xr){return Xr=Xr.prototype,!(!Xr||!Xr.isReactComponent)}function Zk(Xr){if(typeof Xr=="function")return aj(Xr)?1:0;if(Xr!=null){if(Xr=Xr.$$typeof,Xr===Da)return 11;if(Xr===Ga)return 14}return 2}function Pg(Xr,eo){var to=Xr.alternate;return to===null?(to=Bg$1(Xr.tag,eo,Xr.key,Xr.mode),to.elementType=Xr.elementType,to.type=Xr.type,to.stateNode=Xr.stateNode,to.alternate=Xr,Xr.alternate=to):(to.pendingProps=eo,to.type=Xr.type,to.flags=0,to.subtreeFlags=0,to.deletions=null),to.flags=Xr.flags&14680064,to.childLanes=Xr.childLanes,to.lanes=Xr.lanes,to.child=Xr.child,to.memoizedProps=Xr.memoizedProps,to.memoizedState=Xr.memoizedState,to.updateQueue=Xr.updateQueue,eo=Xr.dependencies,to.dependencies=eo===null?null:{lanes:eo.lanes,firstContext:eo.firstContext},to.sibling=Xr.sibling,to.index=Xr.index,to.ref=Xr.ref,to}function Rg(Xr,eo,to,ro,no,io){var oo=2;if(ro=Xr,typeof Xr=="function")aj(Xr)&&(oo=1);else if(typeof Xr=="string")oo=5;else e:switch(Xr){case ya$1:return Tg(to.children,no,io,eo);case za:oo=8,no|=8;break;case Aa:return Xr=Bg$1(12,to,eo,no|2),Xr.elementType=Aa,Xr.lanes=io,Xr;case Ea$1:return Xr=Bg$1(13,to,eo,no),Xr.elementType=Ea$1,Xr.lanes=io,Xr;case Fa:return Xr=Bg$1(19,to,eo,no),Xr.elementType=Fa,Xr.lanes=io,Xr;case Ia$1:return pj(to,no,io,eo);default:if(typeof Xr=="object"&&Xr!==null)switch(Xr.$$typeof){case Ba:oo=10;break e;case Ca:oo=9;break e;case Da:oo=11;break e;case Ga:oo=14;break e;case Ha:oo=16,ro=null;break e}throw Error(p$d(130,Xr==null?Xr:typeof Xr,""))}return eo=Bg$1(oo,to,eo,no),eo.elementType=Xr,eo.type=ro,eo.lanes=io,eo}function Tg(Xr,eo,to,ro){return Xr=Bg$1(7,Xr,ro,eo),Xr.lanes=to,Xr}function pj(Xr,eo,to,ro){return Xr=Bg$1(22,Xr,ro,eo),Xr.elementType=Ia$1,Xr.lanes=to,Xr.stateNode={isHidden:!1},Xr}function Qg$1(Xr,eo,to){return Xr=Bg$1(6,Xr,null,eo),Xr.lanes=to,Xr}function Sg(Xr,eo,to){return eo=Bg$1(4,Xr.children!==null?Xr.children:[],Xr.key,eo),eo.lanes=to,eo.stateNode={containerInfo:Xr.containerInfo,pendingChildren:null,implementation:Xr.implementation},eo}function al(Xr,eo,to,ro,no){this.tag=eo,this.containerInfo=Xr,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=ro,this.onRecoverableError=no,this.mutableSourceEagerHydrationData=null}function bl(Xr,eo,to,ro,no,io,oo,ao,so){return Xr=new al(Xr,eo,to,ao,so),eo===1?(eo=1,io===!0&&(eo|=8)):eo=0,io=Bg$1(3,null,null,eo),Xr.current=io,io.stateNode=Xr,io.memoizedState={element:ro,isDehydrated:to,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(io),Xr}function cl(Xr,eo,to){var ro=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(Xr){console.error(Xr)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports;const oe$5=getDefaultExportFromCjs$2(reactDomExports);var m$8=reactDomExports;client$1.createRoot=m$8.createRoot,client$1.hydrateRoot=m$8.hydrateRoot;/** * @remix-run/router v1.20.0 * * Copyright (c) Remix Software Inc. @@ -47,7 +47,7 @@ Error generating stack: `+io.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$1o(){return _extends$1o=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo"u")throw new Error(eo)}function warning(Xr,eo){if(!Xr){typeof console<"u"&&console.warn(eo);try{throw new Error(eo)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(Xr,eo){return{usr:Xr.state,key:Xr.key,idx:eo}}function createLocation(Xr,eo,to,ro){return to===void 0&&(to=null),_extends$1o({pathname:typeof Xr=="string"?Xr:Xr.pathname,search:"",hash:""},typeof eo=="string"?parsePath(eo):eo,{state:to,key:eo&&eo.key||ro||createKey()})}function createPath(Xr){let{pathname:eo="/",search:to="",hash:ro=""}=Xr;return to&&to!=="?"&&(eo+=to.charAt(0)==="?"?to:"?"+to),ro&&ro!=="#"&&(eo+=ro.charAt(0)==="#"?ro:"#"+ro),eo}function parsePath(Xr){let eo={};if(Xr){let to=Xr.indexOf("#");to>=0&&(eo.hash=Xr.substr(to),Xr=Xr.substr(0,to));let ro=Xr.indexOf("?");ro>=0&&(eo.search=Xr.substr(ro),Xr=Xr.substr(0,ro)),Xr&&(eo.pathname=Xr)}return eo}function getUrlBasedHistory(Xr,eo,to,ro){ro===void 0&&(ro={});let{window:no=document.defaultView,v5Compat:io=!1}=ro,oo=no.history,ao=Action.Pop,so=null,co=lo();co==null&&(co=0,oo.replaceState(_extends$1o({},oo.state,{idx:co}),""));function lo(){return(oo.state||{idx:null}).idx}function fo(){ao=Action.Pop;let wo=lo(),Eo=wo==null?null:wo-co;co=wo,so&&so({action:ao,location:vo.location,delta:Eo})}function ho(wo,Eo){ao=Action.Push;let ko=createLocation(vo.location,wo,Eo);co=lo()+1;let Ao=getHistoryState(ko,co),Po=vo.createHref(ko);try{oo.pushState(Ao,"",Po)}catch(jo){if(jo instanceof DOMException&&jo.name==="DataCloneError")throw jo;no.location.assign(Po)}io&&so&&so({action:ao,location:vo.location,delta:1})}function go(wo,Eo){ao=Action.Replace;let ko=createLocation(vo.location,wo,Eo);co=lo();let Ao=getHistoryState(ko,co),Po=vo.createHref(ko);oo.replaceState(Ao,"",Po),io&&so&&so({action:ao,location:vo.location,delta:0})}function yo(wo){let Eo=no.location.origin!=="null"?no.location.origin:no.location.href,ko=typeof wo=="string"?wo:createPath(wo);return ko=ko.replace(/ $/,"%20"),invariant$2(Eo,"No window.location.(origin|href) available to create URL for href: "+ko),new URL(ko,Eo)}let vo={get action(){return ao},get location(){return Xr(no,oo)},listen(wo){if(so)throw new Error("A history only accepts one active listener");return no.addEventListener(PopStateEventType,fo),so=wo,()=>{no.removeEventListener(PopStateEventType,fo),so=null}},createHref(wo){return eo(no,wo)},createURL:yo,encodeLocation(wo){let Eo=yo(wo);return{pathname:Eo.pathname,search:Eo.search,hash:Eo.hash}},push:ho,replace:go,go(wo){return oo.go(wo)}};return vo}var ResultType;(function(Xr){Xr.data="data",Xr.deferred="deferred",Xr.redirect="redirect",Xr.error="error"})(ResultType||(ResultType={}));function matchRoutes(Xr,eo,to){return to===void 0&&(to="/"),matchRoutesImpl(Xr,eo,to,!1)}function matchRoutesImpl(Xr,eo,to,ro){let no=typeof eo=="string"?parsePath(eo):eo,io=stripBasename(no.pathname||"/",to);if(io==null)return null;let oo=flattenRoutes(Xr);rankRouteBranches(oo);let ao=null;for(let so=0;ao==null&&so{let so={relativePath:ao===void 0?io.path||"":ao,caseSensitive:io.caseSensitive===!0,childrenIndex:oo,route:io};so.relativePath.startsWith("/")&&(invariant$2(so.relativePath.startsWith(ro),'Absolute route path "'+so.relativePath+'" nested under path '+('"'+ro+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),so.relativePath=so.relativePath.slice(ro.length));let co=joinPaths([ro,so.relativePath]),lo=to.concat(so);io.children&&io.children.length>0&&(invariant$2(io.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+co+'".')),flattenRoutes(io.children,eo,lo,co)),!(io.path==null&&!io.index)&&eo.push({path:co,score:computeScore(co,io.index),routesMeta:lo})};return Xr.forEach((io,oo)=>{var ao;if(io.path===""||!((ao=io.path)!=null&&ao.includes("?")))no(io,oo);else for(let so of explodeOptionalSegments(io.path))no(io,oo,so)}),eo}function explodeOptionalSegments(Xr){let eo=Xr.split("/");if(eo.length===0)return[];let[to,...ro]=eo,no=to.endsWith("?"),io=to.replace(/\?$/,"");if(ro.length===0)return no?[io,""]:[io];let oo=explodeOptionalSegments(ro.join("/")),ao=[];return ao.push(...oo.map(so=>so===""?io:[io,so].join("/"))),no&&ao.push(...oo),ao.map(so=>Xr.startsWith("/")&&so===""?"/":so)}function rankRouteBranches(Xr){Xr.sort((eo,to)=>eo.score!==to.score?to.score-eo.score:compareIndexes(eo.routesMeta.map(ro=>ro.childrenIndex),to.routesMeta.map(ro=>ro.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=Xr=>Xr==="*";function computeScore(Xr,eo){let to=Xr.split("/"),ro=to.length;return to.some(isSplat)&&(ro+=splatPenalty),eo&&(ro+=indexRouteValue),to.filter(no=>!isSplat(no)).reduce((no,io)=>no+(paramRe.test(io)?dynamicSegmentValue:io===""?emptySegmentValue:staticSegmentValue),ro)}function compareIndexes(Xr,eo){return Xr.length===eo.length&&Xr.slice(0,-1).every((ro,no)=>ro===eo[no])?Xr[Xr.length-1]-eo[eo.length-1]:0}function matchRouteBranch(Xr,eo,to){let{routesMeta:ro}=Xr,no={},io="/",oo=[];for(let ao=0;ao{let{paramName:ho,isOptional:go}=lo;if(ho==="*"){let vo=ao[fo]||"";oo=io.slice(0,io.length-vo.length).replace(/(.)\/+$/,"$1")}const yo=ao[fo];return go&&!yo?co[ho]=void 0:co[ho]=(yo||"").replace(/%2F/g,"/"),co},{}),pathname:io,pathnameBase:oo,pattern:Xr}}function compilePath(Xr,eo,to){eo===void 0&&(eo=!1),to===void 0&&(to=!0),warning(Xr==="*"||!Xr.endsWith("*")||Xr.endsWith("/*"),'Route path "'+Xr+'" will be treated as if it were '+('"'+Xr.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+Xr.replace(/\*$/,"/*")+'".'));let ro=[],no="^"+Xr.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(oo,ao,so)=>(ro.push({paramName:ao,isOptional:so!=null}),so?"/?([^\\/]+)?":"/([^\\/]+)"));return Xr.endsWith("*")?(ro.push({paramName:"*"}),no+=Xr==="*"||Xr==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):to?no+="\\/*$":Xr!==""&&Xr!=="/"&&(no+="(?:(?=\\/|$))"),[new RegExp(no,eo?void 0:"i"),ro]}function decodePath$1(Xr){try{return Xr.split("/").map(eo=>decodeURIComponent(eo).replace(/\//g,"%2F")).join("/")}catch(eo){return warning(!1,'The URL path "'+Xr+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+eo+").")),Xr}}function stripBasename(Xr,eo){if(eo==="/")return Xr;if(!Xr.toLowerCase().startsWith(eo.toLowerCase()))return null;let to=eo.endsWith("/")?eo.length-1:eo.length,ro=Xr.charAt(to);return ro&&ro!=="/"?null:Xr.slice(to)||"/"}function resolvePath(Xr,eo){eo===void 0&&(eo="/");let{pathname:to,search:ro="",hash:no=""}=typeof Xr=="string"?parsePath(Xr):Xr;return{pathname:to?to.startsWith("/")?to:resolvePathname(to,eo):eo,search:normalizeSearch(ro),hash:normalizeHash(no)}}function resolvePathname(Xr,eo){let to=eo.replace(/\/+$/,"").split("/");return Xr.split("/").forEach(no=>{no===".."?to.length>1&&to.pop():no!=="."&&to.push(no)}),to.length>1?to.join("/"):"/"}function getInvalidPathError(Xr,eo,to,ro){return"Cannot include a '"+Xr+"' character in a manually specified "+("`to."+eo+"` field ["+JSON.stringify(ro)+"]. Please separate it out to the ")+("`to."+to+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(Xr){return Xr.filter((eo,to)=>to===0||eo.route.path&&eo.route.path.length>0)}function getResolveToMatches(Xr,eo){let to=getPathContributingMatches(Xr);return eo?to.map((ro,no)=>no===to.length-1?ro.pathname:ro.pathnameBase):to.map(ro=>ro.pathnameBase)}function resolveTo(Xr,eo,to,ro){ro===void 0&&(ro=!1);let no;typeof Xr=="string"?no=parsePath(Xr):(no=_extends$1o({},Xr),invariant$2(!no.pathname||!no.pathname.includes("?"),getInvalidPathError("?","pathname","search",no)),invariant$2(!no.pathname||!no.pathname.includes("#"),getInvalidPathError("#","pathname","hash",no)),invariant$2(!no.search||!no.search.includes("#"),getInvalidPathError("#","search","hash",no)));let io=Xr===""||no.pathname==="",oo=io?"/":no.pathname,ao;if(oo==null)ao=to;else{let fo=eo.length-1;if(!ro&&oo.startsWith("..")){let ho=oo.split("/");for(;ho[0]==="..";)ho.shift(),fo-=1;no.pathname=ho.join("/")}ao=fo>=0?eo[fo]:"/"}let so=resolvePath(no,ao),co=oo&&oo!=="/"&&oo.endsWith("/"),lo=(io||oo===".")&&to.endsWith("/");return!so.pathname.endsWith("/")&&(co||lo)&&(so.pathname+="/"),so}const joinPaths=Xr=>Xr.join("/").replace(/\/\/+/g,"/"),normalizePathname=Xr=>Xr.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=Xr=>!Xr||Xr==="?"?"":Xr.startsWith("?")?Xr:"?"+Xr,normalizeHash=Xr=>!Xr||Xr==="#"?"":Xr.startsWith("#")?Xr:"#"+Xr;function isRouteErrorResponse(Xr){return Xr!=null&&typeof Xr.status=="number"&&typeof Xr.statusText=="string"&&typeof Xr.internal=="boolean"&&"data"in Xr}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** + */function _extends$1q(){return _extends$1q=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo"u")throw new Error(eo)}function warning(Xr,eo){if(!Xr){typeof console<"u"&&console.warn(eo);try{throw new Error(eo)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(Xr,eo){return{usr:Xr.state,key:Xr.key,idx:eo}}function createLocation(Xr,eo,to,ro){return to===void 0&&(to=null),_extends$1q({pathname:typeof Xr=="string"?Xr:Xr.pathname,search:"",hash:""},typeof eo=="string"?parsePath(eo):eo,{state:to,key:eo&&eo.key||ro||createKey()})}function createPath(Xr){let{pathname:eo="/",search:to="",hash:ro=""}=Xr;return to&&to!=="?"&&(eo+=to.charAt(0)==="?"?to:"?"+to),ro&&ro!=="#"&&(eo+=ro.charAt(0)==="#"?ro:"#"+ro),eo}function parsePath(Xr){let eo={};if(Xr){let to=Xr.indexOf("#");to>=0&&(eo.hash=Xr.substr(to),Xr=Xr.substr(0,to));let ro=Xr.indexOf("?");ro>=0&&(eo.search=Xr.substr(ro),Xr=Xr.substr(0,ro)),Xr&&(eo.pathname=Xr)}return eo}function getUrlBasedHistory(Xr,eo,to,ro){ro===void 0&&(ro={});let{window:no=document.defaultView,v5Compat:io=!1}=ro,oo=no.history,ao=Action.Pop,so=null,co=lo();co==null&&(co=0,oo.replaceState(_extends$1q({},oo.state,{idx:co}),""));function lo(){return(oo.state||{idx:null}).idx}function uo(){ao=Action.Pop;let Eo=lo(),$o=Eo==null?null:Eo-co;co=Eo,so&&so({action:ao,location:wo.location,delta:$o})}function ho(Eo,$o){ao=Action.Push;let Co=createLocation(wo.location,Eo,$o);co=lo()+1;let Ro=getHistoryState(Co,co),Oo=wo.createHref(Co);try{oo.pushState(Ro,"",Oo)}catch(jo){if(jo instanceof DOMException&&jo.name==="DataCloneError")throw jo;no.location.assign(Oo)}io&&so&&so({action:ao,location:wo.location,delta:1})}function go(Eo,$o){ao=Action.Replace;let Co=createLocation(wo.location,Eo,$o);co=lo();let Ro=getHistoryState(Co,co),Oo=wo.createHref(Co);oo.replaceState(Ro,"",Oo),io&&so&&so({action:ao,location:wo.location,delta:0})}function bo(Eo){let $o=no.location.origin!=="null"?no.location.origin:no.location.href,Co=typeof Eo=="string"?Eo:createPath(Eo);return Co=Co.replace(/ $/,"%20"),invariant$2($o,"No window.location.(origin|href) available to create URL for href: "+Co),new URL(Co,$o)}let wo={get action(){return ao},get location(){return Xr(no,oo)},listen(Eo){if(so)throw new Error("A history only accepts one active listener");return no.addEventListener(PopStateEventType,uo),so=Eo,()=>{no.removeEventListener(PopStateEventType,uo),so=null}},createHref(Eo){return eo(no,Eo)},createURL:bo,encodeLocation(Eo){let $o=bo(Eo);return{pathname:$o.pathname,search:$o.search,hash:$o.hash}},push:ho,replace:go,go(Eo){return oo.go(Eo)}};return wo}var ResultType;(function(Xr){Xr.data="data",Xr.deferred="deferred",Xr.redirect="redirect",Xr.error="error"})(ResultType||(ResultType={}));function matchRoutes(Xr,eo,to){return to===void 0&&(to="/"),matchRoutesImpl(Xr,eo,to,!1)}function matchRoutesImpl(Xr,eo,to,ro){let no=typeof eo=="string"?parsePath(eo):eo,io=stripBasename(no.pathname||"/",to);if(io==null)return null;let oo=flattenRoutes(Xr);rankRouteBranches(oo);let ao=null;for(let so=0;ao==null&&so{let so={relativePath:ao===void 0?io.path||"":ao,caseSensitive:io.caseSensitive===!0,childrenIndex:oo,route:io};so.relativePath.startsWith("/")&&(invariant$2(so.relativePath.startsWith(ro),'Absolute route path "'+so.relativePath+'" nested under path '+('"'+ro+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),so.relativePath=so.relativePath.slice(ro.length));let co=joinPaths([ro,so.relativePath]),lo=to.concat(so);io.children&&io.children.length>0&&(invariant$2(io.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+co+'".')),flattenRoutes(io.children,eo,lo,co)),!(io.path==null&&!io.index)&&eo.push({path:co,score:computeScore(co,io.index),routesMeta:lo})};return Xr.forEach((io,oo)=>{var ao;if(io.path===""||!((ao=io.path)!=null&&ao.includes("?")))no(io,oo);else for(let so of explodeOptionalSegments(io.path))no(io,oo,so)}),eo}function explodeOptionalSegments(Xr){let eo=Xr.split("/");if(eo.length===0)return[];let[to,...ro]=eo,no=to.endsWith("?"),io=to.replace(/\?$/,"");if(ro.length===0)return no?[io,""]:[io];let oo=explodeOptionalSegments(ro.join("/")),ao=[];return ao.push(...oo.map(so=>so===""?io:[io,so].join("/"))),no&&ao.push(...oo),ao.map(so=>Xr.startsWith("/")&&so===""?"/":so)}function rankRouteBranches(Xr){Xr.sort((eo,to)=>eo.score!==to.score?to.score-eo.score:compareIndexes(eo.routesMeta.map(ro=>ro.childrenIndex),to.routesMeta.map(ro=>ro.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=Xr=>Xr==="*";function computeScore(Xr,eo){let to=Xr.split("/"),ro=to.length;return to.some(isSplat)&&(ro+=splatPenalty),eo&&(ro+=indexRouteValue),to.filter(no=>!isSplat(no)).reduce((no,io)=>no+(paramRe.test(io)?dynamicSegmentValue:io===""?emptySegmentValue:staticSegmentValue),ro)}function compareIndexes(Xr,eo){return Xr.length===eo.length&&Xr.slice(0,-1).every((ro,no)=>ro===eo[no])?Xr[Xr.length-1]-eo[eo.length-1]:0}function matchRouteBranch(Xr,eo,to){let{routesMeta:ro}=Xr,no={},io="/",oo=[];for(let ao=0;ao{let{paramName:ho,isOptional:go}=lo;if(ho==="*"){let wo=ao[uo]||"";oo=io.slice(0,io.length-wo.length).replace(/(.)\/+$/,"$1")}const bo=ao[uo];return go&&!bo?co[ho]=void 0:co[ho]=(bo||"").replace(/%2F/g,"/"),co},{}),pathname:io,pathnameBase:oo,pattern:Xr}}function compilePath(Xr,eo,to){eo===void 0&&(eo=!1),to===void 0&&(to=!0),warning(Xr==="*"||!Xr.endsWith("*")||Xr.endsWith("/*"),'Route path "'+Xr+'" will be treated as if it were '+('"'+Xr.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+Xr.replace(/\*$/,"/*")+'".'));let ro=[],no="^"+Xr.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(oo,ao,so)=>(ro.push({paramName:ao,isOptional:so!=null}),so?"/?([^\\/]+)?":"/([^\\/]+)"));return Xr.endsWith("*")?(ro.push({paramName:"*"}),no+=Xr==="*"||Xr==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):to?no+="\\/*$":Xr!==""&&Xr!=="/"&&(no+="(?:(?=\\/|$))"),[new RegExp(no,eo?void 0:"i"),ro]}function decodePath$1(Xr){try{return Xr.split("/").map(eo=>decodeURIComponent(eo).replace(/\//g,"%2F")).join("/")}catch(eo){return warning(!1,'The URL path "'+Xr+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+eo+").")),Xr}}function stripBasename(Xr,eo){if(eo==="/")return Xr;if(!Xr.toLowerCase().startsWith(eo.toLowerCase()))return null;let to=eo.endsWith("/")?eo.length-1:eo.length,ro=Xr.charAt(to);return ro&&ro!=="/"?null:Xr.slice(to)||"/"}function resolvePath(Xr,eo){eo===void 0&&(eo="/");let{pathname:to,search:ro="",hash:no=""}=typeof Xr=="string"?parsePath(Xr):Xr;return{pathname:to?to.startsWith("/")?to:resolvePathname(to,eo):eo,search:normalizeSearch(ro),hash:normalizeHash(no)}}function resolvePathname(Xr,eo){let to=eo.replace(/\/+$/,"").split("/");return Xr.split("/").forEach(no=>{no===".."?to.length>1&&to.pop():no!=="."&&to.push(no)}),to.length>1?to.join("/"):"/"}function getInvalidPathError(Xr,eo,to,ro){return"Cannot include a '"+Xr+"' character in a manually specified "+("`to."+eo+"` field ["+JSON.stringify(ro)+"]. Please separate it out to the ")+("`to."+to+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(Xr){return Xr.filter((eo,to)=>to===0||eo.route.path&&eo.route.path.length>0)}function getResolveToMatches(Xr,eo){let to=getPathContributingMatches(Xr);return eo?to.map((ro,no)=>no===to.length-1?ro.pathname:ro.pathnameBase):to.map(ro=>ro.pathnameBase)}function resolveTo(Xr,eo,to,ro){ro===void 0&&(ro=!1);let no;typeof Xr=="string"?no=parsePath(Xr):(no=_extends$1q({},Xr),invariant$2(!no.pathname||!no.pathname.includes("?"),getInvalidPathError("?","pathname","search",no)),invariant$2(!no.pathname||!no.pathname.includes("#"),getInvalidPathError("#","pathname","hash",no)),invariant$2(!no.search||!no.search.includes("#"),getInvalidPathError("#","search","hash",no)));let io=Xr===""||no.pathname==="",oo=io?"/":no.pathname,ao;if(oo==null)ao=to;else{let uo=eo.length-1;if(!ro&&oo.startsWith("..")){let ho=oo.split("/");for(;ho[0]==="..";)ho.shift(),uo-=1;no.pathname=ho.join("/")}ao=uo>=0?eo[uo]:"/"}let so=resolvePath(no,ao),co=oo&&oo!=="/"&&oo.endsWith("/"),lo=(io||oo===".")&&to.endsWith("/");return!so.pathname.endsWith("/")&&(co||lo)&&(so.pathname+="/"),so}const joinPaths=Xr=>Xr.join("/").replace(/\/\/+/g,"/"),normalizePathname=Xr=>Xr.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=Xr=>!Xr||Xr==="?"?"":Xr.startsWith("?")?Xr:"?"+Xr,normalizeHash=Xr=>!Xr||Xr==="#"?"":Xr.startsWith("#")?Xr:"#"+Xr;function isRouteErrorResponse(Xr){return Xr!=null&&typeof Xr.status=="number"&&typeof Xr.statusText=="string"&&typeof Xr.internal=="boolean"&&"data"in Xr}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** * React Router v6.27.0 * * Copyright (c) Remix Software Inc. @@ -56,7 +56,7 @@ Error generating stack: `+io.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$1n(){return _extends$1n=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo{ao.current=!0}),reactExports.useCallback(function(co,lo){if(lo===void 0&&(lo={}),!ao.current)return;if(typeof co=="number"){ro.go(co);return}let fo=resolveTo(co,JSON.parse(oo),io,lo.relative==="path");Xr==null&&eo!=="/"&&(fo.pathname=fo.pathname==="/"?eo:joinPaths([eo,fo.pathname])),(lo.replace?ro.replace:ro.push)(fo,lo.state,lo)},[eo,ro,oo,io,Xr])}function useRoutes(Xr,eo){return useRoutesImpl(Xr,eo)}function useRoutesImpl(Xr,eo,to,ro){useInRouterContext()||invariant$2(!1);let{navigator:no}=reactExports.useContext(NavigationContext),{matches:io}=reactExports.useContext(RouteContext),oo=io[io.length-1],ao=oo?oo.params:{};oo&&oo.pathname;let so=oo?oo.pathnameBase:"/";oo&&oo.route;let co=useLocation(),lo;if(eo){var fo;let wo=typeof eo=="string"?parsePath(eo):eo;so==="/"||(fo=wo.pathname)!=null&&fo.startsWith(so)||invariant$2(!1),lo=wo}else lo=co;let ho=lo.pathname||"/",go=ho;if(so!=="/"){let wo=so.replace(/^\//,"").split("/");go="/"+ho.replace(/^\//,"").split("/").slice(wo.length).join("/")}let yo=matchRoutes(Xr,{pathname:go}),vo=_renderMatches(yo&&yo.map(wo=>Object.assign({},wo,{params:Object.assign({},ao,wo.params),pathname:joinPaths([so,no.encodeLocation?no.encodeLocation(wo.pathname).pathname:wo.pathname]),pathnameBase:wo.pathnameBase==="/"?so:joinPaths([so,no.encodeLocation?no.encodeLocation(wo.pathnameBase).pathname:wo.pathnameBase])})),io,to,ro);return eo&&vo?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1n({pathname:"/",search:"",hash:"",state:null,key:"default"},lo),navigationType:Action.Pop}},vo):vo}function DefaultErrorComponent(){let Xr=useRouteError(),eo=isRouteErrorResponse(Xr)?Xr.status+" "+Xr.statusText:Xr instanceof Error?Xr.message:JSON.stringify(Xr),to=Xr instanceof Error?Xr.stack:null,no={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},eo),to?reactExports.createElement("pre",{style:no},to):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(eo){super(eo),this.state={location:eo.location,revalidation:eo.revalidation,error:eo.error}}static getDerivedStateFromError(eo){return{error:eo}}static getDerivedStateFromProps(eo,to){return to.location!==eo.location||to.revalidation!=="idle"&&eo.revalidation==="idle"?{error:eo.error,location:eo.location,revalidation:eo.revalidation}:{error:eo.error!==void 0?eo.error:to.error,location:to.location,revalidation:eo.revalidation||to.revalidation}}componentDidCatch(eo,to){console.error("React Router caught the following error during render",eo,to)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(Xr){let{routeContext:eo,match:to,children:ro}=Xr,no=reactExports.useContext(DataRouterContext);return no&&no.static&&no.staticContext&&(to.route.errorElement||to.route.ErrorBoundary)&&(no.staticContext._deepestRenderedBoundaryId=to.route.id),reactExports.createElement(RouteContext.Provider,{value:eo},ro)}function _renderMatches(Xr,eo,to,ro){var no;if(eo===void 0&&(eo=[]),to===void 0&&(to=null),ro===void 0&&(ro=null),Xr==null){var io;if(!to)return null;if(to.errors)Xr=to.matches;else if((io=ro)!=null&&io.v7_partialHydration&&eo.length===0&&!to.initialized&&to.matches.length>0)Xr=to.matches;else return null}let oo=Xr,ao=(no=to)==null?void 0:no.errors;if(ao!=null){let lo=oo.findIndex(fo=>fo.route.id&&(ao==null?void 0:ao[fo.route.id])!==void 0);lo>=0||invariant$2(!1),oo=oo.slice(0,Math.min(oo.length,lo+1))}let so=!1,co=-1;if(to&&ro&&ro.v7_partialHydration)for(let lo=0;lo=0?oo=oo.slice(0,co+1):oo=[oo[0]];break}}}return oo.reduceRight((lo,fo,ho)=>{let go,yo=!1,vo=null,wo=null;to&&(go=ao&&fo.route.id?ao[fo.route.id]:void 0,vo=fo.route.errorElement||defaultErrorElement,so&&(co<0&&ho===0?(yo=!0,wo=null):co===ho&&(yo=!0,wo=fo.route.hydrateFallbackElement||null)));let Eo=eo.concat(oo.slice(0,ho+1)),ko=()=>{let Ao;return go?Ao=vo:yo?Ao=wo:fo.route.Component?Ao=reactExports.createElement(fo.route.Component,null):fo.route.element?Ao=fo.route.element:Ao=lo,reactExports.createElement(RenderedRoute,{match:fo,routeContext:{outlet:lo,matches:Eo,isDataRoute:to!=null},children:Ao})};return to&&(fo.route.ErrorBoundary||fo.route.errorElement||ho===0)?reactExports.createElement(RenderErrorBoundary,{location:to.location,revalidation:to.revalidation,component:vo,error:go,children:ko(),routeContext:{outlet:null,matches:Eo,isDataRoute:!0}}):ko()},null)}var DataRouterHook$1=function(Xr){return Xr.UseBlocker="useBlocker",Xr.UseRevalidator="useRevalidator",Xr.UseNavigateStable="useNavigate",Xr}(DataRouterHook$1||{}),DataRouterStateHook$1=function(Xr){return Xr.UseBlocker="useBlocker",Xr.UseLoaderData="useLoaderData",Xr.UseActionData="useActionData",Xr.UseRouteError="useRouteError",Xr.UseNavigation="useNavigation",Xr.UseRouteLoaderData="useRouteLoaderData",Xr.UseMatches="useMatches",Xr.UseRevalidator="useRevalidator",Xr.UseNavigateStable="useNavigate",Xr.UseRouteId="useRouteId",Xr}(DataRouterStateHook$1||{});function useDataRouterContext(Xr){let eo=reactExports.useContext(DataRouterContext);return eo||invariant$2(!1),eo}function useDataRouterState(Xr){let eo=reactExports.useContext(DataRouterStateContext);return eo||invariant$2(!1),eo}function useRouteContext(Xr){let eo=reactExports.useContext(RouteContext);return eo||invariant$2(!1),eo}function useCurrentRouteId(Xr){let eo=useRouteContext(),to=eo.matches[eo.matches.length-1];return to.route.id||invariant$2(!1),to.route.id}function useRouteError(){var Xr;let eo=reactExports.useContext(RouteErrorContext),to=useDataRouterState(DataRouterStateHook$1.UseRouteError),ro=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return eo!==void 0?eo:(Xr=to.errors)==null?void 0:Xr[ro]}function useNavigateStable(){let{router:Xr}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),eo=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),to=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(()=>{to.current=!0}),reactExports.useCallback(function(no,io){io===void 0&&(io={}),to.current&&(typeof no=="number"?Xr.navigate(no):Xr.navigate(no,_extends$1n({fromRouteId:eo},io)))},[Xr,eo])}function Navigate(Xr){let{to:eo,replace:to,state:ro,relative:no}=Xr;useInRouterContext()||invariant$2(!1);let{future:io,static:oo}=reactExports.useContext(NavigationContext),{matches:ao}=reactExports.useContext(RouteContext),{pathname:so}=useLocation(),co=useNavigate(),lo=resolveTo(eo,getResolveToMatches(ao,io.v7_relativeSplatPath),so,no==="path"),fo=JSON.stringify(lo);return reactExports.useEffect(()=>co(JSON.parse(fo),{replace:to,state:ro,relative:no}),[co,fo,no,to,ro]),null}function Route(Xr){invariant$2(!1)}function Router(Xr){let{basename:eo="/",children:to=null,location:ro,navigationType:no=Action.Pop,navigator:io,static:oo=!1,future:ao}=Xr;useInRouterContext()&&invariant$2(!1);let so=eo.replace(/^\/*/,"/"),co=reactExports.useMemo(()=>({basename:so,navigator:io,static:oo,future:_extends$1n({v7_relativeSplatPath:!1},ao)}),[so,ao,io,oo]);typeof ro=="string"&&(ro=parsePath(ro));let{pathname:lo="/",search:fo="",hash:ho="",state:go=null,key:yo="default"}=ro,vo=reactExports.useMemo(()=>{let wo=stripBasename(lo,so);return wo==null?null:{location:{pathname:wo,search:fo,hash:ho,state:go,key:yo},navigationType:no}},[so,lo,fo,ho,go,yo,no]);return vo==null?null:reactExports.createElement(NavigationContext.Provider,{value:co},reactExports.createElement(LocationContext.Provider,{children:to,value:vo}))}function Routes(Xr){let{children:eo,location:to}=Xr;return useRoutes(createRoutesFromChildren(eo),to)}new Promise(()=>{});function createRoutesFromChildren(Xr,eo){eo===void 0&&(eo=[]);let to=[];return reactExports.Children.forEach(Xr,(ro,no)=>{if(!reactExports.isValidElement(ro))return;let io=[...eo,no];if(ro.type===reactExports.Fragment){to.push.apply(to,createRoutesFromChildren(ro.props.children,io));return}ro.type!==Route&&invariant$2(!1),!ro.props.index||!ro.props.children||invariant$2(!1);let oo={id:ro.props.id||io.join("-"),caseSensitive:ro.props.caseSensitive,element:ro.props.element,Component:ro.props.Component,index:ro.props.index,path:ro.props.path,loader:ro.props.loader,action:ro.props.action,errorElement:ro.props.errorElement,ErrorBoundary:ro.props.ErrorBoundary,hasErrorBoundary:ro.props.ErrorBoundary!=null||ro.props.errorElement!=null,shouldRevalidate:ro.props.shouldRevalidate,handle:ro.props.handle,lazy:ro.props.lazy};ro.props.children&&(oo.children=createRoutesFromChildren(ro.props.children,io)),to.push(oo)}),to}/** + */function _extends$1p(){return _extends$1p=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo{ao.current=!0}),reactExports.useCallback(function(co,lo){if(lo===void 0&&(lo={}),!ao.current)return;if(typeof co=="number"){ro.go(co);return}let uo=resolveTo(co,JSON.parse(oo),io,lo.relative==="path");Xr==null&&eo!=="/"&&(uo.pathname=uo.pathname==="/"?eo:joinPaths([eo,uo.pathname])),(lo.replace?ro.replace:ro.push)(uo,lo.state,lo)},[eo,ro,oo,io,Xr])}function useResolvedPath(Xr,eo){let{relative:to}=eo===void 0?{}:eo,{future:ro}=reactExports.useContext(NavigationContext),{matches:no}=reactExports.useContext(RouteContext),{pathname:io}=useLocation(),oo=JSON.stringify(getResolveToMatches(no,ro.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(Xr,JSON.parse(oo),io,to==="path"),[Xr,oo,io,to])}function useRoutes(Xr,eo){return useRoutesImpl(Xr,eo)}function useRoutesImpl(Xr,eo,to,ro){useInRouterContext()||invariant$2(!1);let{navigator:no}=reactExports.useContext(NavigationContext),{matches:io}=reactExports.useContext(RouteContext),oo=io[io.length-1],ao=oo?oo.params:{};oo&&oo.pathname;let so=oo?oo.pathnameBase:"/";oo&&oo.route;let co=useLocation(),lo;if(eo){var uo;let Eo=typeof eo=="string"?parsePath(eo):eo;so==="/"||(uo=Eo.pathname)!=null&&uo.startsWith(so)||invariant$2(!1),lo=Eo}else lo=co;let ho=lo.pathname||"/",go=ho;if(so!=="/"){let Eo=so.replace(/^\//,"").split("/");go="/"+ho.replace(/^\//,"").split("/").slice(Eo.length).join("/")}let bo=matchRoutes(Xr,{pathname:go}),wo=_renderMatches(bo&&bo.map(Eo=>Object.assign({},Eo,{params:Object.assign({},ao,Eo.params),pathname:joinPaths([so,no.encodeLocation?no.encodeLocation(Eo.pathname).pathname:Eo.pathname]),pathnameBase:Eo.pathnameBase==="/"?so:joinPaths([so,no.encodeLocation?no.encodeLocation(Eo.pathnameBase).pathname:Eo.pathnameBase])})),io,to,ro);return eo&&wo?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1p({pathname:"/",search:"",hash:"",state:null,key:"default"},lo),navigationType:Action.Pop}},wo):wo}function DefaultErrorComponent(){let Xr=useRouteError(),eo=isRouteErrorResponse(Xr)?Xr.status+" "+Xr.statusText:Xr instanceof Error?Xr.message:JSON.stringify(Xr),to=Xr instanceof Error?Xr.stack:null,no={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},eo),to?reactExports.createElement("pre",{style:no},to):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(eo){super(eo),this.state={location:eo.location,revalidation:eo.revalidation,error:eo.error}}static getDerivedStateFromError(eo){return{error:eo}}static getDerivedStateFromProps(eo,to){return to.location!==eo.location||to.revalidation!=="idle"&&eo.revalidation==="idle"?{error:eo.error,location:eo.location,revalidation:eo.revalidation}:{error:eo.error!==void 0?eo.error:to.error,location:to.location,revalidation:eo.revalidation||to.revalidation}}componentDidCatch(eo,to){console.error("React Router caught the following error during render",eo,to)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(Xr){let{routeContext:eo,match:to,children:ro}=Xr,no=reactExports.useContext(DataRouterContext);return no&&no.static&&no.staticContext&&(to.route.errorElement||to.route.ErrorBoundary)&&(no.staticContext._deepestRenderedBoundaryId=to.route.id),reactExports.createElement(RouteContext.Provider,{value:eo},ro)}function _renderMatches(Xr,eo,to,ro){var no;if(eo===void 0&&(eo=[]),to===void 0&&(to=null),ro===void 0&&(ro=null),Xr==null){var io;if(!to)return null;if(to.errors)Xr=to.matches;else if((io=ro)!=null&&io.v7_partialHydration&&eo.length===0&&!to.initialized&&to.matches.length>0)Xr=to.matches;else return null}let oo=Xr,ao=(no=to)==null?void 0:no.errors;if(ao!=null){let lo=oo.findIndex(uo=>uo.route.id&&(ao==null?void 0:ao[uo.route.id])!==void 0);lo>=0||invariant$2(!1),oo=oo.slice(0,Math.min(oo.length,lo+1))}let so=!1,co=-1;if(to&&ro&&ro.v7_partialHydration)for(let lo=0;lo=0?oo=oo.slice(0,co+1):oo=[oo[0]];break}}}return oo.reduceRight((lo,uo,ho)=>{let go,bo=!1,wo=null,Eo=null;to&&(go=ao&&uo.route.id?ao[uo.route.id]:void 0,wo=uo.route.errorElement||defaultErrorElement,so&&(co<0&&ho===0?(bo=!0,Eo=null):co===ho&&(bo=!0,Eo=uo.route.hydrateFallbackElement||null)));let $o=eo.concat(oo.slice(0,ho+1)),Co=()=>{let Ro;return go?Ro=wo:bo?Ro=Eo:uo.route.Component?Ro=reactExports.createElement(uo.route.Component,null):uo.route.element?Ro=uo.route.element:Ro=lo,reactExports.createElement(RenderedRoute,{match:uo,routeContext:{outlet:lo,matches:$o,isDataRoute:to!=null},children:Ro})};return to&&(uo.route.ErrorBoundary||uo.route.errorElement||ho===0)?reactExports.createElement(RenderErrorBoundary,{location:to.location,revalidation:to.revalidation,component:wo,error:go,children:Co(),routeContext:{outlet:null,matches:$o,isDataRoute:!0}}):Co()},null)}var DataRouterHook$1=function(Xr){return Xr.UseBlocker="useBlocker",Xr.UseRevalidator="useRevalidator",Xr.UseNavigateStable="useNavigate",Xr}(DataRouterHook$1||{}),DataRouterStateHook$1=function(Xr){return Xr.UseBlocker="useBlocker",Xr.UseLoaderData="useLoaderData",Xr.UseActionData="useActionData",Xr.UseRouteError="useRouteError",Xr.UseNavigation="useNavigation",Xr.UseRouteLoaderData="useRouteLoaderData",Xr.UseMatches="useMatches",Xr.UseRevalidator="useRevalidator",Xr.UseNavigateStable="useNavigate",Xr.UseRouteId="useRouteId",Xr}(DataRouterStateHook$1||{});function useDataRouterContext(Xr){let eo=reactExports.useContext(DataRouterContext);return eo||invariant$2(!1),eo}function useDataRouterState(Xr){let eo=reactExports.useContext(DataRouterStateContext);return eo||invariant$2(!1),eo}function useRouteContext(Xr){let eo=reactExports.useContext(RouteContext);return eo||invariant$2(!1),eo}function useCurrentRouteId(Xr){let eo=useRouteContext(),to=eo.matches[eo.matches.length-1];return to.route.id||invariant$2(!1),to.route.id}function useRouteError(){var Xr;let eo=reactExports.useContext(RouteErrorContext),to=useDataRouterState(DataRouterStateHook$1.UseRouteError),ro=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return eo!==void 0?eo:(Xr=to.errors)==null?void 0:Xr[ro]}function useNavigateStable(){let{router:Xr}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),eo=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),to=reactExports.useRef(!1);return useIsomorphicLayoutEffect$5(()=>{to.current=!0}),reactExports.useCallback(function(no,io){io===void 0&&(io={}),to.current&&(typeof no=="number"?Xr.navigate(no):Xr.navigate(no,_extends$1p({fromRouteId:eo},io)))},[Xr,eo])}function Navigate(Xr){let{to:eo,replace:to,state:ro,relative:no}=Xr;useInRouterContext()||invariant$2(!1);let{future:io,static:oo}=reactExports.useContext(NavigationContext),{matches:ao}=reactExports.useContext(RouteContext),{pathname:so}=useLocation(),co=useNavigate(),lo=resolveTo(eo,getResolveToMatches(ao,io.v7_relativeSplatPath),so,no==="path"),uo=JSON.stringify(lo);return reactExports.useEffect(()=>co(JSON.parse(uo),{replace:to,state:ro,relative:no}),[co,uo,no,to,ro]),null}function Route(Xr){invariant$2(!1)}function Router(Xr){let{basename:eo="/",children:to=null,location:ro,navigationType:no=Action.Pop,navigator:io,static:oo=!1,future:ao}=Xr;useInRouterContext()&&invariant$2(!1);let so=eo.replace(/^\/*/,"/"),co=reactExports.useMemo(()=>({basename:so,navigator:io,static:oo,future:_extends$1p({v7_relativeSplatPath:!1},ao)}),[so,ao,io,oo]);typeof ro=="string"&&(ro=parsePath(ro));let{pathname:lo="/",search:uo="",hash:ho="",state:go=null,key:bo="default"}=ro,wo=reactExports.useMemo(()=>{let Eo=stripBasename(lo,so);return Eo==null?null:{location:{pathname:Eo,search:uo,hash:ho,state:go,key:bo},navigationType:no}},[so,lo,uo,ho,go,bo,no]);return wo==null?null:reactExports.createElement(NavigationContext.Provider,{value:co},reactExports.createElement(LocationContext.Provider,{children:to,value:wo}))}function Routes(Xr){let{children:eo,location:to}=Xr;return useRoutes(createRoutesFromChildren(eo),to)}new Promise(()=>{});function createRoutesFromChildren(Xr,eo){eo===void 0&&(eo=[]);let to=[];return reactExports.Children.forEach(Xr,(ro,no)=>{if(!reactExports.isValidElement(ro))return;let io=[...eo,no];if(ro.type===reactExports.Fragment){to.push.apply(to,createRoutesFromChildren(ro.props.children,io));return}ro.type!==Route&&invariant$2(!1),!ro.props.index||!ro.props.children||invariant$2(!1);let oo={id:ro.props.id||io.join("-"),caseSensitive:ro.props.caseSensitive,element:ro.props.element,Component:ro.props.Component,index:ro.props.index,path:ro.props.path,loader:ro.props.loader,action:ro.props.action,errorElement:ro.props.errorElement,ErrorBoundary:ro.props.ErrorBoundary,hasErrorBoundary:ro.props.ErrorBoundary!=null||ro.props.errorElement!=null,shouldRevalidate:ro.props.shouldRevalidate,handle:ro.props.handle,lazy:ro.props.lazy};ro.props.children&&(oo.children=createRoutesFromChildren(ro.props.children,io)),to.push(oo)}),to}/** * React Router DOM v6.27.0 * * Copyright (c) Remix Software Inc. @@ -65,7 +65,1837 @@ Error generating stack: `+io.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(Xr){let{basename:eo,children:to,future:ro,window:no}=Xr,io=reactExports.useRef();io.current==null&&(io.current=createBrowserHistory({window:no,v5Compat:!0}));let oo=io.current,[ao,so]=reactExports.useState({action:oo.action,location:oo.location}),{v7_startTransition:co}=ro||{},lo=reactExports.useCallback(fo=>{co&&startTransitionImpl?startTransitionImpl(()=>so(fo)):so(fo)},[so,co]);return reactExports.useLayoutEffect(()=>oo.listen(lo),[oo,lo]),reactExports.createElement(Router,{basename:eo,children:to,location:ao.location,navigationType:ao.action,navigator:oo,future:ro})}var DataRouterHook;(function(Xr){Xr.UseScrollRestoration="useScrollRestoration",Xr.UseSubmit="useSubmit",Xr.UseSubmitFetcher="useSubmitFetcher",Xr.UseFetcher="useFetcher",Xr.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(Xr){Xr.UseFetcher="useFetcher",Xr.UseFetchers="useFetchers",Xr.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));const UninitializedWallet=()=>{const Xr=useNavigate();return jsxRuntimeExports.jsxs("div",{className:"flex gap-5",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Xr("signup"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-44",children:"Sign Up"}),jsxRuntimeExports.jsx("button",{onClick:()=>Xr("login"),className:"bg-green-600 text-white px-6 py-3 rounded-lg w-44",children:"Login"})]})},global$1=globalThis||void 0||self;var ACTION=(Xr=>(Xr.IS_CONNECTED="isConnected",Xr.REQ_TO_CONNECT="reqToConnect",Xr.REQ_TO_SIGN="reqToSign",Xr.REQ_WALLET_DETAILS="reqWalletDetails",Xr.ERROR="error",Xr.CONNECTION_STATUS="connectionStatus",Xr.WALLET_DETAILS="walletDetails",Xr.SIGNATURE="signature",Xr))(ACTION||{});const I0=class I0{constructor(eo){this.pushWallet=eo,this.initializeListener()}initializeListener(){I0.messageListener&&window.removeEventListener("message",I0.messageListener),I0.messageListener=async eo=>{var no,io,oo,ao,so,co;if(eo.origin==="http://localhost:5174")return;const{action:to,data:ro}=eo.data;if(this.pushWallet===void 0)(no=eo.source)==null||no.postMessage({action:ACTION.ERROR,error:"PushWallet Not Logged In"},eo.origin),global$1.myEvent=eo;else switch(to){case ACTION.REQ_WALLET_DETAILS:{const lo=this.pushWallet.signerAccount;(io=eo.source)==null||io.postMessage({action:ACTION.WALLET_DETAILS,address:lo},eo.origin);break}case ACTION.IS_CONNECTED:{const lo=this.pushWallet.ConnectionStatus(eo.origin);(oo=eo.source)==null||oo.postMessage({action:ACTION.CONNECTION_STATUS,isPending:lo.isPending,isConnected:lo.isConnected},eo.origin);break}case ACTION.REQ_TO_CONNECT:{this.pushWallet.requestToConnect(eo.origin);const lo=this.pushWallet.ConnectionStatus(eo.origin);(ao=eo.source)==null||ao.postMessage({action:ACTION.CONNECTION_STATUS,isPending:lo.isPending,isConnected:lo.isConnected},eo.origin);break}case ACTION.REQ_TO_SIGN:{try{const lo=await this.pushWallet.sign(ro,eo.origin);(so=eo.source)==null||so.postMessage({action:ACTION.SIGNATURE,signature:lo},eo.origin)}catch{(co=eo.source)==null||co.postMessage({action:ACTION.ERROR,error:"Origin Not Connected"},eo.origin)}break}}},window.addEventListener("message",I0.messageListener)}};Qu(I0,"messageListener");let PostMessageHandler=I0;const initialState={wallet:null,theme:"light",postMessageHandler:new PostMessageHandler(void 0)};function globalReducer(Xr,eo){switch(eo.type){case"INITIALIZE_WALLET":return{...Xr,wallet:eo.payload,postMessageHandler:new PostMessageHandler(eo.payload)};case"RESET_WALLET":return{...Xr,wallet:null,postMessageHandler:new PostMessageHandler(void 0)};case"SET_THEME":return{...Xr,theme:eo.payload};default:return Xr}}const GlobalContext=reactExports.createContext({state:initialState,dispatch:()=>null});function useGlobalState(){const Xr=reactExports.useContext(GlobalContext);if(!Xr)throw new Error("useGlobalState must be used within a GlobalProvider");return Xr}const GlobalProvider=({children:Xr})=>{const[eo,to]=reactExports.useReducer(globalReducer,initialState);return jsxRuntimeExports.jsx(GlobalContext.Provider,{value:{state:eo,dispatch:to},children:Xr})},InitializedWallet=()=>{const Xr=useNavigate(),{state:eo,dispatch:to}=useGlobalState(),[ro]=reactExports.useState(eo.wallet.signerAccount.split(":")[2]),[no,io]=reactExports.useState(!1),[oo,ao]=reactExports.useState(!1),so=()=>io(!0),co=()=>io(!1),lo=()=>ao(!0),fo=()=>ao(!1),ho=yo=>{eo.wallet.acceptConnectionReq(yo),to({type:"INITIALIZE_WALLET",payload:eo.wallet})},go=yo=>{eo.wallet.rejectConnectionReq(yo),to({type:"INITIALIZE_WALLET",payload:eo.wallet})};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsxRuntimeExports.jsxs("div",{className:"p-8 w-full",children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Push Wallet Address",value:ro,disabled:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-center"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 mb-4",children:"This is the consumer account used for signing in the Push wallet"}),jsxRuntimeExports.jsx("button",{onClick:lo,className:"w-full py-3 mb-4 text-blue-600 bg-white border border-blue-600 rounded-md hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"View Connected Accounts"}),jsxRuntimeExports.jsx("button",{onClick:so,className:"w-full py-3 mb-4 text-blue-600 bg-white border border-blue-600 rounded-md hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"View App Connections"}),jsxRuntimeExports.jsxs("button",{onClick:()=>Xr("login"),className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Lock Push Account"]})]}),no&&jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-500 bg-opacity-75 z-50",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-lg relative",children:[jsxRuntimeExports.jsx("button",{onClick:co,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600",children:"×"}),jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold mb-4",children:"App Connections"}),jsxRuntimeExports.jsx("ul",{children:eo.wallet.appConnections.map(yo=>jsxRuntimeExports.jsx("li",{className:"mb-4",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("span",{className:"font-medium",children:yo.origin})}),jsxRuntimeExports.jsx("div",{className:"space-x-2",children:yo.isPending?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("button",{onClick:()=>ho(yo.origin),className:"px-4 py-2 text-white bg-green-600 rounded hover:bg-green-700",children:"Accept"}),jsxRuntimeExports.jsx("button",{onClick:()=>go(yo.origin),className:"px-4 py-2 text-white bg-red-600 rounded hover:bg-red-700",children:"Reject"})]}):jsxRuntimeExports.jsx("button",{onClick:()=>go(yo.origin),className:"px-4 py-2 text-white bg-gray-600 rounded hover:bg-gray-700",children:"Remove"})})]})},yo.origin))})]})}),oo&&jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-500 bg-opacity-75 z-50",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-6xl relative",children:[jsxRuntimeExports.jsx("button",{onClick:fo,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600",children:"×"}),jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Connected Accounts"}),jsxRuntimeExports.jsx("ul",{children:Object.keys(eo.wallet.walletToEncDerivedKey).map(yo=>jsxRuntimeExports.jsx("li",{className:"mb-4",children:jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntimeExports.jsx("div",{className:"break-words",children:jsxRuntimeExports.jsx("span",{className:"font-medium",children:yo})})})},yo))})]})})]})};function Home(){const{state:Xr}=useGlobalState();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xr.wallet===null?jsxRuntimeExports.jsx(UninitializedWallet,{}):jsxRuntimeExports.jsx(InitializedWallet,{})})}function number$7(Xr){if(!Number.isSafeInteger(Xr)||Xr<0)throw new Error(`positive integer expected, not ${Xr}`)}function isBytes$8(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function bytes$2(Xr,...eo){if(!isBytes$8(Xr))throw new Error("Uint8Array expected");if(eo.length>0&&!eo.includes(Xr.length))throw new Error(`Uint8Array expected of length ${eo}, not of length=${Xr.length}`)}function hash$6(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$7(Xr.outputLen),number$7(Xr.blockLen)}function exists$3(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output$2(Xr,eo){bytes$2(Xr);const to=eo.outputLen;if(Xr.lengthnew Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength),u32$2=Xr=>new Uint32Array(Xr.buffer,Xr.byteOffset,Math.floor(Xr.byteLength/4)),createView$1=Xr=>new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),rotr$1=(Xr,eo)=>Xr<<32-eo|Xr>>>eo,rotl=(Xr,eo)=>Xr<>>32-eo>>>0,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=Xr=>Xr<<24&4278190080|Xr<<8&16711680|Xr>>>8&65280|Xr>>>24&255,byteSwapIfBE=isLE$1?Xr=>Xr:Xr=>byteSwap(Xr);function byteSwap32(Xr){for(let eo=0;eoeo.toString(16).padStart(2,"0"));function bytesToHex$4(Xr){bytes$2(Xr);let eo="";for(let to=0;to=asciis$3._0&&Xr<=asciis$3._9)return Xr-asciis$3._0;if(Xr>=asciis$3._A&&Xr<=asciis$3._F)return Xr-(asciis$3._A-10);if(Xr>=asciis$3._a&&Xr<=asciis$3._f)return Xr-(asciis$3._a-10)}function hexToBytes$5(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no{};async function asyncLoop(Xr,eo,to){let ro=Date.now();for(let no=0;no=0&&ioXr().update(toBytes$2(ro)).digest(),to=Xr();return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=()=>Xr(),eo}function wrapConstructorWithOpts(Xr){const eo=(ro,no)=>Xr(no).update(toBytes$2(ro)).digest(),to=Xr({});return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=ro=>Xr(ro),eo}function wrapXOFConstructorWithOpts(Xr){const eo=(ro,no)=>Xr(no).update(toBytes$2(ro)).digest(),to=Xr({});return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=ro=>Xr(ro),eo}function randomBytes$1(Xr=32){if(crypto$5&&typeof crypto$5.getRandomValues=="function")return crypto$5.getRandomValues(new Uint8Array(Xr));if(crypto$5&&typeof crypto$5.randomBytes=="function")return crypto$5.randomBytes(Xr);throw new Error("crypto.getRandomValues must be defined")}const utils$f=Object.freeze(Object.defineProperty({__proto__:null,Hash:Hash$5,asyncLoop,byteSwap,byteSwap32,byteSwapIfBE,bytesToHex:bytesToHex$4,checkOpts,concatBytes:concatBytes$5,createView:createView$1,hexToBytes:hexToBytes$5,isBytes:isBytes$7,isLE:isLE$1,nextTick:nextTick$1,randomBytes:randomBytes$1,rotl,rotr:rotr$1,toBytes:toBytes$2,u32:u32$2,u8:u8$1,utf8ToBytes:utf8ToBytes$4,wrapConstructor:wrapConstructor$1,wrapConstructorWithOpts,wrapXOFConstructorWithOpts},Symbol.toStringTag,{value:"Module"}));let HMAC$2=class extends Hash$5{constructor(eo,to){super(),this.finished=!1,this.destroyed=!1,hash$6(eo);const ro=toBytes$2(to);if(this.iHash=eo.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 no=this.blockLen,io=new Uint8Array(no);io.set(ro.length>no?eo.create().update(ro).digest():ro);for(let oo=0;oonew HMAC$2(Xr,eo).update(to).digest();hmac$4.create=(Xr,eo)=>new HMAC$2(Xr,eo);const hmac$5=Object.freeze(Object.defineProperty({__proto__:null,HMAC:HMAC$2,hmac:hmac$4},Symbol.toStringTag,{value:"Module"}));function pbkdf2Init(Xr,eo,to,ro){hash$6(Xr);const no=checkOpts({dkLen:32,asyncTick:10},ro),{c:io,dkLen:oo,asyncTick:ao}=no;if(number$7(io),number$7(oo),number$7(ao),io<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const so=toBytes$2(eo),co=toBytes$2(to),lo=new Uint8Array(oo),fo=hmac$4.create(Xr,so),ho=fo._cloneInto().update(co);return{c:io,dkLen:oo,asyncTick:ao,DK:lo,PRF:fo,PRFSalt:ho}}function pbkdf2Output(Xr,eo,to,ro,no){return Xr.destroy(),eo.destroy(),ro&&ro.destroy(),no.fill(0),to}function pbkdf2(Xr,eo,to,ro){const{c:no,dkLen:io,DK:oo,PRF:ao,PRFSalt:so}=pbkdf2Init(Xr,eo,to,ro);let co;const lo=new Uint8Array(4),fo=createView$1(lo),ho=new Uint8Array(ao.outputLen);for(let go=1,yo=0;yo{so._cloneInto(lo).update(go).digestInto(go);for(let Eo=0;Eo0&&!eo.includes(Xr.length))throw new Error(`Uint8Array expected of length ${eo}, not of length=${Xr.length}`)}function hash$5(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$6(Xr.outputLen),number$6(Xr.blockLen)}function exists$2(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output$1(Xr,eo){bytes$1(Xr);const to=eo.outputLen;if(Xr.lengthnew Uint8Array(Bo.buffer,Bo.byteOffset,Bo.byteLength);Xr.u8=no;const io=Bo=>new Uint32Array(Bo.buffer,Bo.byteOffset,Math.floor(Bo.byteLength/4));Xr.u32=io;const oo=Bo=>new DataView(Bo.buffer,Bo.byteOffset,Bo.byteLength);Xr.createView=oo;const ao=(Bo,xo)=>Bo<<32-xo|Bo>>>xo;Xr.rotr=ao;const so=(Bo,xo)=>Bo<>>32-xo>>>0;Xr.rotl=so,Xr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const co=Bo=>Bo<<24&4278190080|Bo<<8&16711680|Bo>>>8&65280|Bo>>>24&255;Xr.byteSwap=co,Xr.byteSwapIfBE=Xr.isLE?Bo=>Bo:Bo=>(0,Xr.byteSwap)(Bo);function lo(Bo){for(let xo=0;xoxo.toString(16).padStart(2,"0"));function ho(Bo){(0,to.bytes)(Bo);let xo="";for(let uo=0;uo=go._0&&Bo<=go._9)return Bo-go._0;if(Bo>=go._A&&Bo<=go._F)return Bo-(go._A-10);if(Bo>=go._a&&Bo<=go._f)return Bo-(go._a-10)}function vo(Bo){if(typeof Bo!="string")throw new Error("hex string expected, got "+typeof Bo);const xo=Bo.length,uo=xo/2;if(xo%2)throw new Error("padded hex string expected, got unpadded hex of length "+xo);const po=new Uint8Array(uo);for(let bo=0,_o=0;bo{};Xr.nextTick=wo;async function Eo(Bo,xo,uo){let po=Date.now();for(let bo=0;bo=0&&_oBo().update(Ao(po)).digest(),uo=Bo();return xo.outputLen=uo.outputLen,xo.blockLen=uo.blockLen,xo.create=()=>Bo(),xo}function Fo(Bo){const xo=(po,bo)=>Bo(bo).update(Ao(po)).digest(),uo=Bo({});return xo.outputLen=uo.outputLen,xo.blockLen=uo.blockLen,xo.create=po=>Bo(po),xo}function Xo(Bo){const xo=(po,bo)=>Bo(bo).update(Ao(po)).digest(),uo=Bo({});return xo.outputLen=uo.outputLen,xo.blockLen=uo.blockLen,xo.create=po=>Bo(po),xo}function Lo(Bo=32){if(eo.crypto&&typeof eo.crypto.getRandomValues=="function")return eo.crypto.getRandomValues(new Uint8Array(Bo));if(eo.crypto&&typeof eo.crypto.randomBytes=="function")return eo.crypto.randomBytes(Bo);throw new Error("crypto.getRandomValues must be defined")}})(utils$e);Object.defineProperty(_md,"__esModule",{value:!0});_md.HashMD=_md.Maj=_md.Chi=void 0;const _assert_js_1=_assert,utils_js_1$3=utils$e;function setBigUint64$2(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}const Chi$1=(Xr,eo,to)=>Xr&eo^~Xr&to;_md.Chi=Chi$1;const Maj$1=(Xr,eo,to)=>Xr&eo^Xr&to^eo&to;_md.Maj=Maj$1;let HashMD$1=class extends utils_js_1$3.Hash{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(eo){(0,_assert_js_1.exists)(this);const{view:to,buffer:ro,blockLen:no}=this;eo=(0,utils_js_1$3.toBytes)(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let fo=oo;folo.length)throw new Error("_sha2: outputLen bigger than state");for(let fo=0;fo>>3,vo=(0,utils_js_1$2.rotr)(go,17)^(0,utils_js_1$2.rotr)(go,19)^go>>>10;SHA256_W$1[fo]=vo+SHA256_W$1[fo-7]+yo+SHA256_W$1[fo-16]|0}let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this;for(let fo=0;fo<64;fo++){const ho=(0,utils_js_1$2.rotr)(ao,6)^(0,utils_js_1$2.rotr)(ao,11)^(0,utils_js_1$2.rotr)(ao,25),go=lo+ho+(0,_md_js_1$2.Chi)(ao,so,co)+SHA256_K$1[fo]+SHA256_W$1[fo]|0,vo=((0,utils_js_1$2.rotr)(ro,2)^(0,utils_js_1$2.rotr)(ro,13)^(0,utils_js_1$2.rotr)(ro,22))+(0,_md_js_1$2.Maj)(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+go|0,oo=io,io=no,no=ro,ro=go+vo|0}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,so=so+this.F|0,co=co+this.G|0,lo=lo+this.H|0,this.set(ro,no,io,oo,ao,so,co,lo)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};sha256$7.SHA256=SHA256$1;class SHA224 extends SHA256$1{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}}var sha256_1$4=sha256$7.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256$1);sha256$7.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);function setBigUint64$1(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}class HashMD extends Hash$5{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=createView$1(this.buffer)}update(eo){exists$3(this);const{view:to,buffer:ro,blockLen:no}=this;eo=toBytes$2(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let fo=oo;folo.length)throw new Error("_sha2: outputLen bigger than state");for(let fo=0;fo>_32n$1&U32_MASK64$1)}:{h:Number(Xr>>_32n$1&U32_MASK64$1)|0,l:Number(Xr&U32_MASK64$1)|0}}function split$2(Xr,eo=!1){let to=new Uint32Array(Xr.length),ro=new Uint32Array(Xr.length);for(let no=0;noBigInt(Xr>>>0)<<_32n$1|BigInt(eo>>>0),shrSH=(Xr,eo,to)=>Xr>>>to,shrSL=(Xr,eo,to)=>Xr<<32-to|eo>>>to,rotrSH=(Xr,eo,to)=>Xr>>>to|eo<<32-to,rotrSL=(Xr,eo,to)=>Xr<<32-to|eo>>>to,rotrBH=(Xr,eo,to)=>Xr<<64-to|eo>>>to-32,rotrBL=(Xr,eo,to)=>Xr>>>to-32|eo<<64-to,rotr32H=(Xr,eo)=>eo,rotr32L=(Xr,eo)=>Xr,rotlSH$1=(Xr,eo,to)=>Xr<>>32-to,rotlSL$1=(Xr,eo,to)=>eo<>>32-to,rotlBH$1=(Xr,eo,to)=>eo<>>64-to,rotlBL$1=(Xr,eo,to)=>Xr<>>64-to;function add(Xr,eo,to,ro){const no=(eo>>>0)+(ro>>>0);return{h:Xr+to+(no/2**32|0)|0,l:no|0}}const add3L=(Xr,eo,to)=>(Xr>>>0)+(eo>>>0)+(to>>>0),add3H=(Xr,eo,to,ro)=>eo+to+ro+(Xr/2**32|0)|0,add4L=(Xr,eo,to,ro)=>(Xr>>>0)+(eo>>>0)+(to>>>0)+(ro>>>0),add4H=(Xr,eo,to,ro,no)=>eo+to+ro+no+(Xr/2**32|0)|0,add5L=(Xr,eo,to,ro,no)=>(Xr>>>0)+(eo>>>0)+(to>>>0)+(ro>>>0)+(no>>>0),add5H=(Xr,eo,to,ro,no,io)=>eo+to+ro+no+io+(Xr/2**32|0)|0,u64$4={fromBig:fromBig$1,split:split$2,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH:rotlSH$1,rotlSL:rotlSL$1,rotlBH:rotlBH$1,rotlBL:rotlBL$1,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64$4.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(Xr=>BigInt(Xr))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends 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:eo,Al:to,Bh:ro,Bl:no,Ch:io,Cl:oo,Dh:ao,Dl:so,Eh:co,El:lo,Fh:fo,Fl:ho,Gh:go,Gl:yo,Hh:vo,Hl:wo}=this;return[eo,to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo]}set(eo,to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo){this.Ah=eo|0,this.Al=to|0,this.Bh=ro|0,this.Bl=no|0,this.Ch=io|0,this.Cl=oo|0,this.Dh=ao|0,this.Dl=so|0,this.Eh=co|0,this.El=lo|0,this.Fh=fo|0,this.Fl=ho|0,this.Gh=go|0,this.Gl=yo|0,this.Hh=vo|0,this.Hl=wo|0}process(eo,to){for(let Ao=0;Ao<16;Ao++,to+=4)SHA512_W_H[Ao]=eo.getUint32(to),SHA512_W_L[Ao]=eo.getUint32(to+=4);for(let Ao=16;Ao<80;Ao++){const Po=SHA512_W_H[Ao-15]|0,jo=SHA512_W_L[Ao-15]|0,Mo=u64$4.rotrSH(Po,jo,1)^u64$4.rotrSH(Po,jo,8)^u64$4.shrSH(Po,jo,7),No=u64$4.rotrSL(Po,jo,1)^u64$4.rotrSL(Po,jo,8)^u64$4.shrSL(Po,jo,7),Do=SHA512_W_H[Ao-2]|0,Fo=SHA512_W_L[Ao-2]|0,Xo=u64$4.rotrSH(Do,Fo,19)^u64$4.rotrBH(Do,Fo,61)^u64$4.shrSH(Do,Fo,6),Lo=u64$4.rotrSL(Do,Fo,19)^u64$4.rotrBL(Do,Fo,61)^u64$4.shrSL(Do,Fo,6),Bo=u64$4.add4L(No,Lo,SHA512_W_L[Ao-7],SHA512_W_L[Ao-16]),xo=u64$4.add4H(Bo,Mo,Xo,SHA512_W_H[Ao-7],SHA512_W_H[Ao-16]);SHA512_W_H[Ao]=xo|0,SHA512_W_L[Ao]=Bo|0}let{Ah:ro,Al:no,Bh:io,Bl:oo,Ch:ao,Cl:so,Dh:co,Dl:lo,Eh:fo,El:ho,Fh:go,Fl:yo,Gh:vo,Gl:wo,Hh:Eo,Hl:ko}=this;for(let Ao=0;Ao<80;Ao++){const Po=u64$4.rotrSH(fo,ho,14)^u64$4.rotrSH(fo,ho,18)^u64$4.rotrBH(fo,ho,41),jo=u64$4.rotrSL(fo,ho,14)^u64$4.rotrSL(fo,ho,18)^u64$4.rotrBL(fo,ho,41),Mo=fo&go^~fo&vo,No=ho&yo^~ho&wo,Do=u64$4.add5L(ko,jo,No,SHA512_Kl[Ao],SHA512_W_L[Ao]),Fo=u64$4.add5H(Do,Eo,Po,Mo,SHA512_Kh[Ao],SHA512_W_H[Ao]),Xo=Do|0,Lo=u64$4.rotrSH(ro,no,28)^u64$4.rotrBH(ro,no,34)^u64$4.rotrBH(ro,no,39),Bo=u64$4.rotrSL(ro,no,28)^u64$4.rotrBL(ro,no,34)^u64$4.rotrBL(ro,no,39),xo=ro&io^ro&ao^io&ao,uo=no&oo^no&so^oo&so;Eo=vo|0,ko=wo|0,vo=go|0,wo=yo|0,go=fo|0,yo=ho|0,{h:fo,l:ho}=u64$4.add(co|0,lo|0,Fo|0,Xo|0),co=ao|0,lo=so|0,ao=io|0,so=oo|0,io=ro|0,oo=no|0;const po=u64$4.add3L(Xo,Bo,uo);ro=u64$4.add3H(po,Fo,Lo,xo),no=po|0}({h:ro,l:no}=u64$4.add(this.Ah|0,this.Al|0,ro|0,no|0)),{h:io,l:oo}=u64$4.add(this.Bh|0,this.Bl|0,io|0,oo|0),{h:ao,l:so}=u64$4.add(this.Ch|0,this.Cl|0,ao|0,so|0),{h:co,l:lo}=u64$4.add(this.Dh|0,this.Dl|0,co|0,lo|0),{h:fo,l:ho}=u64$4.add(this.Eh|0,this.El|0,fo|0,ho|0),{h:go,l:yo}=u64$4.add(this.Fh|0,this.Fl|0,go|0,yo|0),{h:vo,l:wo}=u64$4.add(this.Gh|0,this.Gl|0,vo|0,wo|0),{h:Eo,l:ko}=u64$4.add(this.Hh|0,this.Hl|0,Eo|0,ko|0),this.set(ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo,Eo,ko)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.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)}}const sha512$3=wrapConstructor$1(()=>new SHA512);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$5(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function chain(...Xr){const eo=io=>io,to=(io,oo)=>ao=>io(oo(ao)),ro=Xr.map(io=>io.encode).reduceRight(to,eo),no=Xr.map(io=>io.decode).reduce(to,eo);return{encode:ro,decode:no}}function alphabet$1(Xr){return{encode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return eo.map(to=>{if(to<0||to>=Xr.length)throw new Error(`Digit index outside alphabet: ${to} (alphabet: ${Xr.length})`);return Xr[to]})},decode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="string")throw new Error("alphabet.decode input should be array of strings");return eo.map(to=>{if(typeof to!="string")throw new Error(`alphabet.decode: not string element=${to}`);const ro=Xr.indexOf(to);if(ro===-1)throw new Error(`Unknown letter: "${to}". Allowed: ${Xr}`);return ro})}}}function join(Xr=""){if(typeof Xr!="string")throw new Error("join separator should be string");return{encode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="string")throw new Error("join.encode input should be array of strings");for(let to of eo)if(typeof to!="string")throw new Error(`join.encode: non-string input=${to}`);return eo.join(Xr)},decode:eo=>{if(typeof eo!="string")throw new Error("join.decode input should be string");return eo.split(Xr)}}}function padding(Xr,eo="="){if(typeof eo!="string")throw new Error("padding chr should be string");return{encode(to){if(!Array.isArray(to)||to.length&&typeof to[0]!="string")throw new Error("padding.encode input should be array of strings");for(let ro of to)if(typeof ro!="string")throw new Error(`padding.encode: non-string input=${ro}`);for(;to.length*Xr%8;)to.push(eo);return to},decode(to){if(!Array.isArray(to)||to.length&&typeof to[0]!="string")throw new Error("padding.encode input should be array of strings");for(let no of to)if(typeof no!="string")throw new Error(`padding.decode: non-string input=${no}`);let ro=to.length;if(ro*Xr%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;ro>0&&to[ro-1]===eo;ro--)if(!((ro-1)*Xr%8))throw new Error("Invalid padding: string has too much padding");return to.slice(0,ro)}}}function convertRadix(Xr,eo,to){if(eo<2)throw new Error(`convertRadix: wrong from=${eo}, base cannot be less than 2`);if(to<2)throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`);if(!Array.isArray(Xr))throw new Error("convertRadix: data should be array");if(!Xr.length)return[];let ro=0;const no=[],io=Array.from(Xr);for(io.forEach(oo=>{if(oo<0||oo>=eo)throw new Error(`Wrong integer: ${oo}`)});;){let oo=0,ao=!0;for(let so=ro;soeo?gcd(eo,Xr%eo):Xr,radix2carry=(Xr,eo)=>Xr+(eo-gcd(Xr,eo));function convertRadix2(Xr,eo,to,ro){if(!Array.isArray(Xr))throw new Error("convertRadix2: data should be array");if(eo<=0||eo>32)throw new Error(`convertRadix2: wrong from=${eo}`);if(to<=0||to>32)throw new Error(`convertRadix2: wrong to=${to}`);if(radix2carry(eo,to)>32)throw new Error(`convertRadix2: carry overflow from=${eo} to=${to} carryBits=${radix2carry(eo,to)}`);let no=0,io=0;const oo=2**to-1,ao=[];for(const so of Xr){if(so>=2**eo)throw new Error(`convertRadix2: invalid data word=${so} from=${eo}`);if(no=no<32)throw new Error(`convertRadix2: carry overflow pos=${io} from=${eo}`);for(io+=eo;io>=to;io-=to)ao.push((no>>io-to&oo)>>>0);no&=2**io-1}if(no=no<=eo)throw new Error("Excess padding");if(!ro&&no)throw new Error(`Non-zero padding: ${no}`);return ro&&io>0&&ao.push(no>>>0),ao}function radix(Xr){return{encode:eo=>{if(!isBytes$5(eo))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(eo),2**8,Xr)},decode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(convertRadix(eo,Xr,2**8))}}}function radix2(Xr,eo=!1){if(Xr<=0||Xr>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry(8,Xr)>32||radix2carry(Xr,8)>32)throw new Error("radix2: carry overflow");return{encode:to=>{if(!isBytes$5(to))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(to),8,Xr,!eo)},decode:to=>{if(!Array.isArray(to)||to.length&&typeof to[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(convertRadix2(to,Xr,8,eo))}}}function checksum(Xr,eo){if(typeof eo!="function")throw new Error("checksum fn should be function");return{encode(to){if(!isBytes$5(to))throw new Error("checksum.encode: input should be Uint8Array");const ro=eo(to).slice(0,Xr),no=new Uint8Array(to.length+Xr);return no.set(to),no.set(ro,to.length),no},decode(to){if(!isBytes$5(to))throw new Error("checksum.decode: input should be Uint8Array");const ro=to.slice(0,-Xr),no=eo(ro).slice(0,Xr),io=to.slice(-Xr);for(let oo=0;oochain(radix(58),alphabet$1(Xr),join("")),base58$2=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check=Xr=>chain(checksum(4,eo=>Xr(Xr(eo))),base58$2);/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const isJapanese=Xr=>Xr[0]==="あいこくしん";function nfkd(Xr){if(typeof Xr!="string")throw new TypeError(`Invalid mnemonic type: ${typeof Xr}`);return Xr.normalize("NFKD")}function normalize$1(Xr){const eo=nfkd(Xr),to=eo.split(" ");if(![12,15,18,21,24].includes(to.length))throw new Error("Invalid mnemonic");return{nfkd:eo,words:to}}function assertEntropy(Xr){bytes$2(Xr,16,20,24,28,32)}function generateMnemonic(Xr,eo=128){if(number$7(eo),eo%32!==0||eo>256)throw new TypeError("Invalid entropy");return entropyToMnemonic(randomBytes$1(eo/8),Xr)}const calcChecksum=Xr=>{const eo=8-Xr.length/4;return new Uint8Array([sha256_1$4(Xr)[0]>>eo<{if(typeof eo!="string")throw new Error(`Wordlist: non-string element: ${eo}`)}),utils$d.chain(utils$d.checksum(1,calcChecksum),utils$d.radix2(11,!0),utils$d.alphabet(Xr))}function entropyToMnemonic(Xr,eo){return assertEntropy(Xr),getCoder(eo).encode(Xr).join(isJapanese(eo)?" ":" ")}const salt=Xr=>nfkd(`mnemonic${Xr}`);function mnemonicToSeed(Xr,eo=""){return pbkdf2Async(sha512$3,normalize$1(Xr).nfkd,salt(eo),{c:2048,dkLen:64})}function mnemonicToSeedSync(Xr,eo=""){return pbkdf2(sha512$3,normalize$1(Xr).nfkd,salt(eo),{c:2048,dkLen:64})}const wordlist=`abandon + */function _extends$1o(){return _extends$1o=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&(to[no]=Xr[no]);return to}function isModifiedEvent(Xr){return!!(Xr.metaKey||Xr.altKey||Xr.ctrlKey||Xr.shiftKey)}function shouldProcessLinkClick(Xr,eo){return Xr.button===0&&(!eo||eo==="_self")&&!isModifiedEvent(Xr)}const _excluded$1f=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(Xr){let{basename:eo,children:to,future:ro,window:no}=Xr,io=reactExports.useRef();io.current==null&&(io.current=createBrowserHistory({window:no,v5Compat:!0}));let oo=io.current,[ao,so]=reactExports.useState({action:oo.action,location:oo.location}),{v7_startTransition:co}=ro||{},lo=reactExports.useCallback(uo=>{co&&startTransitionImpl?startTransitionImpl(()=>so(uo)):so(uo)},[so,co]);return reactExports.useLayoutEffect(()=>oo.listen(lo),[oo,lo]),reactExports.createElement(Router,{basename:eo,children:to,location:ao.location,navigationType:ao.action,navigator:oo,future:ro})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(eo,to){let{onClick:ro,relative:no,reloadDocument:io,replace:oo,state:ao,target:so,to:co,preventScrollReset:lo,viewTransition:uo}=eo,ho=_objectWithoutPropertiesLoose$1i(eo,_excluded$1f),{basename:go}=reactExports.useContext(NavigationContext),bo,wo=!1;if(typeof co=="string"&&ABSOLUTE_URL_REGEX.test(co)&&(bo=co,isBrowser$1))try{let Ro=new URL(window.location.href),Oo=co.startsWith("//")?new URL(Ro.protocol+co):new URL(co),jo=stripBasename(Oo.pathname,go);Oo.origin===Ro.origin&&jo!=null?co=jo+Oo.search+Oo.hash:wo=!0}catch{}let Eo=useHref(co,{relative:no}),$o=useLinkClickHandler(co,{replace:oo,state:ao,target:so,preventScrollReset:lo,relative:no,viewTransition:uo});function Co(Ro){ro&&ro(Ro),Ro.defaultPrevented||$o(Ro)}return reactExports.createElement("a",_extends$1o({},ho,{href:bo||Eo,onClick:wo||io?ro:Co,ref:to,target:so}))});var DataRouterHook;(function(Xr){Xr.UseScrollRestoration="useScrollRestoration",Xr.UseSubmit="useSubmit",Xr.UseSubmitFetcher="useSubmitFetcher",Xr.UseFetcher="useFetcher",Xr.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(Xr){Xr.UseFetcher="useFetcher",Xr.UseFetchers="useFetchers",Xr.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(Xr,eo){let{target:to,replace:ro,state:no,preventScrollReset:io,relative:oo,viewTransition:ao}=eo===void 0?{}:eo,so=useNavigate(),co=useLocation(),lo=useResolvedPath(Xr,{relative:oo});return reactExports.useCallback(uo=>{if(shouldProcessLinkClick(uo,to)){uo.preventDefault();let ho=ro!==void 0?ro:createPath(co)===createPath(lo);so(Xr,{replace:ho,state:no,preventScrollReset:io,relative:oo,viewTransition:ao})}},[co,so,lo,ro,no,to,Xr,io,oo,ao])}function getDefaultExportFromCjs$1(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}var browser$j={exports:{}},process$1=browser$j.exports={},cachedSetTimeout$1,cachedClearTimeout$1;function defaultSetTimout$1(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout$1(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout$1=setTimeout:cachedSetTimeout$1=defaultSetTimout$1}catch{cachedSetTimeout$1=defaultSetTimout$1}try{typeof clearTimeout=="function"?cachedClearTimeout$1=clearTimeout:cachedClearTimeout$1=defaultClearTimeout$1}catch{cachedClearTimeout$1=defaultClearTimeout$1}})();function runTimeout$1(Xr){if(cachedSetTimeout$1===setTimeout)return setTimeout(Xr,0);if((cachedSetTimeout$1===defaultSetTimout$1||!cachedSetTimeout$1)&&setTimeout)return cachedSetTimeout$1=setTimeout,setTimeout(Xr,0);try{return cachedSetTimeout$1(Xr,0)}catch{try{return cachedSetTimeout$1.call(null,Xr,0)}catch{return cachedSetTimeout$1.call(this,Xr,0)}}}function runClearTimeout$1(Xr){if(cachedClearTimeout$1===clearTimeout)return clearTimeout(Xr);if((cachedClearTimeout$1===defaultClearTimeout$1||!cachedClearTimeout$1)&&clearTimeout)return cachedClearTimeout$1=clearTimeout,clearTimeout(Xr);try{return cachedClearTimeout$1(Xr)}catch{try{return cachedClearTimeout$1.call(null,Xr)}catch{return cachedClearTimeout$1.call(this,Xr)}}}var queue$1=[],draining$1=!1,currentQueue$1,queueIndex$1=-1;function cleanUpNextTick$1(){!draining$1||!currentQueue$1||(draining$1=!1,currentQueue$1.length?queue$1=currentQueue$1.concat(queue$1):queueIndex$1=-1,queue$1.length&&drainQueue$1())}function drainQueue$1(){if(!draining$1){var Xr=runTimeout$1(cleanUpNextTick$1);draining$1=!0;for(var eo=queue$1.length;eo;){for(currentQueue$1=queue$1,queue$1=[];++queueIndex$11)for(var to=1;toga)&&(Dl=(Ll=Ll.replace(" ",":")).length),0Yo&&(Yo=(Lo=Lo.trim()).charCodeAt(0)),Yo){case 38:return Lo.replace($o,"$1"+Do.trim());case 58:return Do.trim()+Lo.replace($o,"$1"+Do.trim());default:if(0<1*Ho&&0Ko.charCodeAt(8))break;case 115:Xo=Xo.replace(Ko,"-webkit-"+Ko)+";"+Xo;break;case 207:case 102:Xo=Xo.replace(Ko,"-webkit-"+(102Ho.charCodeAt(0)&&(Ho=Ho.trim()),Io=Ho,Ho=[Io],01?eo-1:0),ro=1;ro0?" Args: "+to.join(", "):""))}var j$a=function(){function Xr(to){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=to}var eo=Xr.prototype;return eo.indexOfGroup=function(to){for(var ro=0,no=0;no=this.groupSizes.length){for(var no=this.groupSizes,io=no.length,oo=io;to>=oo;)(oo<<=1)<0&&D$8(16,""+to);this.groupSizes=new Uint32Array(oo),this.groupSizes.set(no),this.length=oo;for(var ao=io;ao=this.length||this.groupSizes[to]===0)return ro;for(var no=this.groupSizes[to],io=this.indexOfGroup(to),oo=io+no,ao=io;ao=k$6&&(k$6=eo+1),T$9.set(Xr,eo),x$a.set(eo,Xr)},M$6="style["+N$9+'][data-styled-version="5.3.11"]',G$7=new RegExp("^"+N$9+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),L$9=function(Xr,eo,to){for(var ro,no=to.split(","),io=0,oo=no.length;io=0;co--){var lo=so[co];if(lo&&lo.nodeType===1&&lo.hasAttribute(N$9))return lo}}(to),io=no!==void 0?no.nextSibling:null;ro.setAttribute(N$9,"active"),ro.setAttribute("data-styled-version","5.3.11");var oo=Y$3();return oo&&ro.setAttribute("nonce",oo),to.insertBefore(ro,io),ro},H$6=function(){function Xr(to){var ro=this.element=q$8(to);ro.appendChild(document.createTextNode("")),this.sheet=function(no){if(no.sheet)return no.sheet;for(var io=document.styleSheets,oo=0,ao=io.length;oo=0){var no=document.createTextNode(ro),io=this.nodes[to];return this.element.insertBefore(no,io||null),this.length++,!0}return!1},eo.deleteRule=function(to){this.element.removeChild(this.nodes[to]),this.length--},eo.getRule=function(to){return to0&&(uo+=ho+",")}),io+=""+co+lo+'{content:"'+uo+`"}/*!sc*/ +`}}}return io}(this)},Xr}(),Z$6=/(a)(d)/gi,K$5=function(Xr){return String.fromCharCode(Xr+(Xr>25?39:97))};function Q$8(Xr){var eo,to="";for(eo=Math.abs(Xr);eo>52;eo=eo/52|0)to=K$5(eo%52)+to;return(K$5(eo%52)+to).replace(Z$6,"$1-$2")}var ee$6=function(Xr,eo){for(var to=eo.length;to;)Xr=33*Xr^eo.charCodeAt(--to);return Xr},te$4=function(Xr){return ee$6(5381,Xr)};function ne$3(Xr){for(var eo=0;eo>>0);if(!to.hasNameForId(no,ao)){var so=ro(oo,"."+ao,void 0,no);to.insertRules(no,ao,so)}io.push(ao),this.staticRulesId=ao}else{for(var co=this.rules.length,lo=ee$6(this.baseHash,ro.hash),uo="",ho=0;ho>>0);if(!to.hasNameForId(no,Eo)){var $o=ro(uo,"."+Eo,void 0,no);to.insertRules(no,Eo,$o)}io.push(Eo)}}return io.join(" ")},Xr}(),se$3=/^\s*\/\/.*$/gm,ie$5=[":","[",".","#"];function ae$6(Xr){var eo,to,ro,no,io=w$a,oo=io.options,ao=oo===void 0?w$a:oo,so=io.plugins,co=so===void 0?S$8:so,lo=new stylis_min(ao),uo=[],ho=function(wo){function Eo($o){if($o)try{wo($o+"}")}catch{}}return function($o,Co,Ro,Oo,jo,Bo,Mo,Fo,Wo,Jo){switch($o){case 1:if(Wo===0&&Co.charCodeAt(0)===64)return wo(Co+";"),"";break;case 2:if(Fo===0)return Co+"/*|*/";break;case 3:switch(Fo){case 102:case 112:return wo(Ro[0]+Co),"";default:return Co+(Jo===0?"/*|*/":"")}case-2:Co.split("/*|*/}").forEach(Eo)}}}(function(wo){uo.push(wo)}),go=function(wo,Eo,$o){return Eo===0&&ie$5.indexOf($o[to.length])!==-1||$o.match(no)?wo:"."+eo};function bo(wo,Eo,$o,Co){Co===void 0&&(Co="&");var Ro=wo.replace(se$3,""),Oo=Eo&&$o?$o+" "+Eo+" { "+Ro+" }":Ro;return eo=Co,to=Eo,ro=new RegExp("\\"+to+"\\b","g"),no=new RegExp("(\\"+to+"\\b){2,}"),lo($o||!Eo?"":Eo,Oo)}return lo.use([].concat(co,[function(wo,Eo,$o){wo===2&&$o.length&&$o[0].lastIndexOf(to)>0&&($o[0]=$o[0].replace(ro,go))},ho,function(wo){if(wo===-2){var Eo=uo;return uo=[],Eo}}])),bo.hash=co.length?co.reduce(function(wo,Eo){return Eo.name||D$8(15),ee$6(wo,Eo.name)},5381).toString():"",bo}var ce$7=React.createContext();ce$7.Consumer;var le$6=React.createContext(),de$6=(le$6.Consumer,new X$7),he$4=ae$6();function pe$5(){return reactExports.useContext(ce$7)||de$6}function fe$2(){return reactExports.useContext(le$6)||he$4}var ye$3=function(){function Xr(eo,to){var ro=this;this.inject=function(no,io){io===void 0&&(io=he$4);var oo=ro.name+io.hash;no.hasNameForId(ro.id,oo)||no.insertRules(ro.id,oo,io(ro.rules,oo,"@keyframes"))},this.toString=function(){return D$8(12,String(ro.name))},this.name=eo,this.id="sc-keyframes-"+eo,this.rules=to}return Xr.prototype.getName=function(eo){return eo===void 0&&(eo=he$4),this.name+eo.hash},Xr}(),ve$4=/([A-Z])/,ge$5=/([A-Z])/g,Se$3=/^ms-/,we$3=function(Xr){return"-"+Xr.toLowerCase()};function Ee$3(Xr){return ve$4.test(Xr)?Xr.replace(ge$5,we$3).replace(Se$3,"-ms-"):Xr}var be$2=function(Xr){return Xr==null||Xr===!1||Xr===""};function _e$4(Xr,eo,to,ro){if(Array.isArray(Xr)){for(var no,io=[],oo=0,ao=Xr.length;oo1?eo-1:0),ro=1;ro?@[\\\]^`{|}~-]+/g,De$5=/(^-|-$)/g;function je$3(Xr){return Xr.replace(Re$3,"-").replace(De$5,"")}var Te$4=function(Xr){return Q$8(te$4(Xr)>>>0)};function xe$3(Xr){return typeof Xr=="string"&&!0}var ke$5=function(Xr){return typeof Xr=="function"||typeof Xr=="object"&&Xr!==null&&!Array.isArray(Xr)},Ve$4=function(Xr){return Xr!=="__proto__"&&Xr!=="constructor"&&Xr!=="prototype"};function Be$5(Xr,eo,to){var ro=Xr[to];ke$5(eo)&&ke$5(ro)?ze$4(ro,eo):Xr[to]=eo}function ze$4(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;ro=0||(Jo[Fo]=Bo[Fo]);return Jo}(eo,["componentId"]),jo=Ro&&Ro+"-"+(xe$3(Co)?Co:je$3(b$9(Co)));return Ye$3(Co,y$d({},Oo,{attrs:ho,componentId:jo}),to)},Object.defineProperty(bo,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(Co){this._foldedDefaultProps=ro?ze$4({},Xr.defaultProps,Co):Co}}),Object.defineProperty(bo,"toString",{value:function(){return"."+bo.styledComponentId}}),no&&hoistNonReactStatics$1(bo,Xr,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),bo}var qe$4=function(Xr){return function eo(to,ro,no){if(no===void 0&&(no=w$a),!reactIsExports$1.isValidElementType(ro))return D$8(1,String(ro));var io=function(){return to(ro,no,Ae$3.apply(void 0,arguments))};return io.withConfig=function(oo){return eo(to,ro,y$d({},no,{},oo))},io.attrs=function(oo){return eo(to,ro,y$d({},no,{attrs:Array.prototype.concat(no.attrs,oo).filter(Boolean)}))},io}(Ye$3,Xr)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(Xr){qe$4[Xr]=qe$4(Xr)});var He$4=function(){function Xr(to,ro){this.rules=to,this.componentId=ro,this.isStatic=ne$3(to),X$7.registerId(this.componentId+1)}var eo=Xr.prototype;return eo.createStyles=function(to,ro,no,io){var oo=io(_e$4(this.rules,ro,no,io).join(""),""),ao=this.componentId+to;no.insertRules(ao,ao,oo)},eo.removeStyles=function(to,ro){ro.clearRules(this.componentId+to)},eo.renderStyles=function(to,ro,no,io){to>2&&X$7.registerId(this.componentId+to),this.removeStyles(to,no),this.createStyles(to,ro,no,io)},Xr}();function $e$3(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;ro1?eo-1:0),ro=1;roXr}; + width: ${({size:Xr})=>Xr}; + height: ${({size:Xr})=>Xr}; + display: inline-flex; + font-size: inherit; + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`,IconWrapper=({autoSize:Xr,color:eo,componentName:to,icon:ro,size:no,...io})=>{const oo=eo?`var(--${eo})`:"currentColor",ao=no?`${no}px`:Xr?"1em":"16px";return jsxRuntimeExports.jsx(StyledIconWrapper,{"aria-hidden":"true","aria-label":to,color:oo,role:"img",size:ao,...io,children:ro})},Asterisk=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Asterisk",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 5 5",xmlns:"http://www.w3.org/2000/svg",fill:"none",...eo,children:jsxRuntimeExports.jsx("path",{d:"M0.687978 4.28802L0.795978 4.14402L1.43198 3.32202L1.83998 2.84202C1.82798 2.81802 1.82198 2.79402 1.81598 2.76402L1.20998 2.62002L0.207978 2.33802L0.039978 2.28402L0.327978 1.40202L0.495978 1.45602L1.47398 1.81002L2.04398 2.04402C2.06798 2.02602 2.09198 2.00802 2.11598 1.99002L2.07398 1.39002L2.03798 0.346015V0.166016H2.96198V0.346015L2.92598 1.39002L2.87798 1.99002C2.90198 2.00802 2.92598 2.02602 2.94998 2.04402L3.51998 1.81002L4.50398 1.45602L4.67198 1.40202L4.95998 2.28402L4.78598 2.33802L3.78398 2.62002L3.17798 2.76402C3.17198 2.79402 3.16598 2.81802 3.15398 2.84202L3.56198 3.32202L4.20398 4.14402L4.30598 4.28802L3.55598 4.83402L3.45398 4.68402L2.87198 3.82002L2.54798 3.29202C2.52998 3.29202 2.51198 3.29202 2.49998 3.29202C2.48198 3.29202 2.46398 3.29202 2.44598 3.29202L2.12198 3.82002L1.53998 4.68402L1.43798 4.83402L0.687978 4.28802Z",fill:"currentColor"})}),...to})},CrossFilled=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"CrossFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...eo,children:jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 28C22.6274 28 28 22.6274 28 16C28 9.37259 22.6274 4 16 4C9.37256 4 4 9.37259 4 16C4 22.6274 9.37256 28 16 28ZM11.4705 11.4706C11.8255 11.1155 12.4011 11.1155 12.7562 11.4706L15.9705 14.6849L19.1848 11.4706C19.5398 11.1155 20.1154 11.1155 20.4705 11.4706C20.8255 11.8256 20.8255 12.4012 20.4705 12.7563L17.2562 15.9706L20.4705 19.1849C20.8255 19.5399 20.8255 20.1156 20.4705 20.4706C20.1154 20.8257 19.5398 20.8257 19.1848 20.4706L15.9705 17.2563L12.7562 20.4706C12.4011 20.8256 11.8255 20.8256 11.4705 20.4706C11.1154 20.1155 11.1154 19.5399 11.4705 19.1849L14.6848 15.9706L11.4705 12.7563C11.1154 12.4012 11.1154 11.8256 11.4705 11.4706Z",fill:"currentColor"})}),...to})},Ellipse=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Ellipse",icon:jsxRuntimeExports.jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",fill:"currentColor",...eo,children:jsxRuntimeExports.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})}),...to})},InfoFilled=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"InfoFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...eo,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.5385 9.53846C15.8123 9.53846 16.08 9.61967 16.3077 9.77181C16.5354 9.92395 16.7129 10.1402 16.8177 10.3932C16.9225 10.6462 16.9499 10.9246 16.8965 11.1932C16.843 11.4618 16.7112 11.7085 16.5175 11.9021C16.3239 12.0958 16.0772 12.2277 15.8086 12.2811C15.54 12.3345 15.2616 12.3071 15.0086 12.2023C14.7556 12.0975 14.5393 11.92 14.3872 11.6923C14.2351 11.4646 14.1538 11.1969 14.1538 10.9231C14.1538 10.5559 14.2997 10.2037 14.5594 9.944C14.8191 9.68434 15.1712 9.53846 15.5385 9.53846ZM16.9231 22.4615C16.4334 22.4615 15.9639 22.267 15.6177 21.9208C15.2714 21.5746 15.0769 21.105 15.0769 20.6154V16C14.8321 16 14.5973 15.9027 14.4242 15.7296C14.2511 15.5565 14.1538 15.3217 14.1538 15.0769C14.1538 14.8321 14.2511 14.5973 14.4242 14.4242C14.5973 14.2511 14.8321 14.1538 15.0769 14.1538C15.5666 14.1538 16.0361 14.3483 16.3824 14.6946C16.7286 15.0408 16.9231 15.5104 16.9231 16V20.6154C17.1679 20.6154 17.4027 20.7126 17.5758 20.8857C17.7489 21.0589 17.8462 21.2936 17.8462 21.5385C17.8462 21.7833 17.7489 22.0181 17.5758 22.1912C17.4027 22.3643 17.1679 22.4615 16.9231 22.4615Z",fill:"currentColor"})}),...to})},TickCircleFilled=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"TickCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...eo,children:jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4 16C4 12.8174 5.26428 9.76516 7.51472 7.51472C9.76516 5.26428 12.8174 4 16 4C19.1826 4 22.2348 5.26428 24.4853 7.51472C26.7357 9.76516 28 12.8174 28 16C28 19.1826 26.7357 22.2348 24.4853 24.4853C22.2348 26.7357 19.1826 28 16 28C12.8174 28 9.76516 26.7357 7.51472 24.4853C5.26428 22.2348 4 19.1826 4 16ZM15.3152 21.136L22.224 12.4992L20.976 11.5008L15.0848 18.8624L10.912 15.3856L9.888 16.6144L15.3152 21.1376V21.136Z",fill:"currentColor"})}),...to})},WarningCircleFilled=Xr=>{const{svgProps:eo,...to}=Xr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"WarningCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...eo,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.0769 10.4615C15.0769 10.2167 15.1742 9.98193 15.3473 9.80882C15.5204 9.63571 15.7552 9.53846 16 9.53846C16.2448 9.53846 16.4796 9.63571 16.6527 9.80882C16.8258 9.98193 16.9231 10.2167 16.9231 10.4615V16.9231C16.9231 17.1679 16.8258 17.4027 16.6527 17.5758C16.4796 17.7489 16.2448 17.8462 16 17.8462C15.7552 17.8462 15.5204 17.7489 15.3473 17.5758C15.1742 17.4027 15.0769 17.1679 15.0769 16.9231V10.4615ZM16 22.4615C15.7262 22.4615 15.4585 22.3803 15.2308 22.2282C15.0031 22.076 14.8256 21.8598 14.7208 21.6068C14.616 21.3538 14.5886 21.0754 14.642 20.8068C14.6954 20.5382 14.8273 20.2915 15.0209 20.0978C15.2146 19.9042 15.4613 19.7723 15.7299 19.7189C15.9985 19.6655 16.2769 19.6929 16.5299 19.7977C16.7829 19.9025 16.9991 20.08 17.1513 20.3077C17.3034 20.5354 17.3846 20.8031 17.3846 21.0769C17.3846 21.4441 17.2387 21.7963 16.9791 22.056C16.7194 22.3157 16.3672 22.4615 16 22.4615Z",fill:"currentColor"})}),...to})},alertVariants={success:{icon:TickCircleFilled,iconColor:"components-alert-icon-success",borderColor:"components-alert-stroke-success",bgColor:"components-alert-background-success",ctaColor:"components-alert-text-cta-success"},warning:{icon:WarningCircleFilled,iconColor:"components-alert-icon-warning",borderColor:"components-alert-stroke-warning",bgColor:"components-alert-background-warning",ctaColor:"components-alert-text-cta-warning"},info:{icon:InfoFilled,iconColor:"components-alert-icon-info",borderColor:"components-alert-stroke-info",bgColor:"components-alert-background-info",ctaColor:"components-alert-text-cta-info"},error:{icon:WarningCircleFilled,iconColor:"components-alert-icon-error",borderColor:"components-alert-stroke-error",bgColor:"components-alert-background-error",ctaColor:"components-alert-text-cta-error"}},deviceSizes={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",desktop:"2560px",ultrawide:"3440px"},deviceMediaQ={mobileS:`(max-width: ${deviceSizes.mobileS})`,mobileM:`(max-width: ${deviceSizes.mobileM})`,mobileL:`(max-width: ${deviceSizes.mobileL})`,tablet:`(max-width: ${deviceSizes.tablet})`,laptop:`(max-width: ${deviceSizes.laptop})`,laptopL:`(max-width: ${deviceSizes.laptopL})`,desktop:`(max-width: ${deviceSizes.desktop})`,ultrawide:`(max-width: ${deviceSizes.ultrawide})`},breakpointMap={initial:"",ms:"mobileS",mm:"mobileM",ml:"mobileL",tb:"tablet",lp:"laptop",ll:"laptopL",dp:"desktop",uw:"ultrawide"},colorPrimitives={"gray-100":"#F5F6F8","gray-200":"#EAEBF2","gray-300":"#C4CBD5","gray-400":"#B0B3B9","gray-500":"#8C93A0","gray-600":"#757D8D","gray-700":"#484D58","gray-800":"#313338","gray-900":"#202124","gray-1000":"#17181B","pink-100":"#FCEBFF","pink-200":"#FBE8FF","pink-300":"#F3AEFF","pink-400":"#CF59E2","pink-500":"#D548EC","pink-600":"#C742DD","pink-700":"#AA30BE","pink-800":"#7B0090","pink-900":"#570066","pink-1000":"#35003F","blue-100":"#E8F2FF","blue-200":"#D1E4FF","blue-300":"#A2C9FF","blue-400":"#73ADFF","blue-500":"#4090FF","blue-600":"#076EFF","blue-700":"#0056D0","blue-800":"#00419D","blue-900":"#002D6D","blue-1000":"#001A40","green-100":"#D8F7F0","green-200":"#AFEFE1","green-300":"#51DCBD","green-400":"#00C296","green-500":"#00A47F","green-600":"#008769","green-700":"#006B53","green-800":"#00513F","green-900":"#00382B","green-1000":"#002019","red-100":"#FFECEC","red-200":"#FFD9D9","red-300":"#FFB1B1","red-400":"#FF8585","red-500":"#FF4E4E","red-600":"#F11F1F","red-700":"#D43B3B","red-800":"#A40A0A","red-900":"#670000","red-1000":"#400000","yellow-100":"#FFF0CB","yellow-200":"#FFDF93","yellow-300":"#FFBB16","yellow-400":"#E99B00","yellow-500":"#C77100","yellow-600":"#A85A00","yellow-700":"#8A4900","yellow-800":"#663600","yellow-900":"#472600","yellow-1000":"#291500","white-10":"rgba(255,255,255,0.1)","white-20":"rgba(255,255,255,0.2)","white-30":"rgba(255,255,255,0.3)","white-40":"rgba(255,255,255,0.4)","white-50":"rgba(255,255,255,0.5)","white-60":"rgba(255,255,255,0.6)","white-70":"rgba(255,255,255,0.7)","white-80":"rgba(255,255,255,0.8)","white-90":"rgba(255,255,255,0.9)","white-100":"rgba(255,255,255,1)","black-10":"rgba(0,0,0,0.1)","black-20":"rgba(0,0,0,0.2)","black-30":"rgba(0,0,0,0.3)","black-40":"rgba(0,0,0,0.4)","black-50":"rgba(0,0,0,0.5)","black-60":"rgba(0,0,0,0.6)","black-70":"rgba(0,0,0,0.7)","black-80":"rgba(0,0,0,0.8)","black-90":"rgba(0,0,0,0.9)","black-100":"rgba(0,0,0,1)",transparent:"transparent"},colorBrands={"primary-100":colorPrimitives["pink-100"],"primary-200":colorPrimitives["pink-200"],"primary-300":colorPrimitives["pink-300"],"primary-400":colorPrimitives["pink-400"],"primary-500":colorPrimitives["pink-500"],"primary-600":colorPrimitives["pink-600"],"primary-700":colorPrimitives["pink-700"],"primary-800":colorPrimitives["pink-800"],"primary-900":colorPrimitives["pink-900"],"primary-1000":colorPrimitives["pink-1000"],"neutral-100":colorPrimitives["gray-100"],"neutral-200":colorPrimitives["gray-200"],"neutral-300":colorPrimitives["gray-300"],"neutral-400":colorPrimitives["gray-400"],"neutral-500":colorPrimitives["gray-500"],"neutral-600":colorPrimitives["gray-600"],"neutral-700":colorPrimitives["gray-700"],"neutral-800":colorPrimitives["gray-800"],"neutral-900":colorPrimitives["gray-900"],"neutral-1000":colorPrimitives["gray-1000"],"info-100":colorPrimitives["blue-100"],"info-200":colorPrimitives["blue-200"],"info-300":colorPrimitives["blue-300"],"info-400":colorPrimitives["blue-400"],"info-500":colorPrimitives["blue-500"],"info-600":colorPrimitives["blue-600"],"info-700":colorPrimitives["blue-700"],"info-800":colorPrimitives["blue-800"],"info-900":colorPrimitives["blue-900"],"info-1000":colorPrimitives["blue-1000"],"success-100":colorPrimitives["green-100"],"success-200":colorPrimitives["green-200"],"success-300":colorPrimitives["green-300"],"success-400":colorPrimitives["green-400"],"success-500":colorPrimitives["green-500"],"success-600":colorPrimitives["green-600"],"success-700":colorPrimitives["green-700"],"success-800":colorPrimitives["green-800"],"success-900":colorPrimitives["green-900"],"success-1000":colorPrimitives["green-1000"],"warning-100":colorPrimitives["yellow-100"],"warning-200":colorPrimitives["yellow-200"],"warning-300":colorPrimitives["yellow-300"],"warning-400":colorPrimitives["yellow-400"],"warning-500":colorPrimitives["yellow-500"],"warning-600":colorPrimitives["yellow-600"],"warning-700":colorPrimitives["yellow-700"],"warning-800":colorPrimitives["yellow-800"],"warning-900":colorPrimitives["yellow-900"],"warning-1000":colorPrimitives["yellow-1000"],"danger-100":colorPrimitives["red-100"],"danger-200":colorPrimitives["red-200"],"danger-300":colorPrimitives["red-300"],"danger-400":colorPrimitives["red-400"],"danger-500":colorPrimitives["red-500"],"danger-600":colorPrimitives["red-600"],"danger-700":colorPrimitives["red-700"],"danger-800":colorPrimitives["red-800"],"danger-900":colorPrimitives["red-900"],"danger-1000":colorPrimitives["red-1000"]},textSemantics={primary:{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},secondary:{light:colorBrands["neutral-800"],dark:colorBrands["neutral-300"]},tertiary:{light:colorBrands["neutral-500"],dark:colorBrands["neutral-600"]},"primary-inverse":{light:colorPrimitives["white-100"],dark:colorPrimitives["black-100"]},"secondary-inverse":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]},"tertiary-inverse":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-200"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-800"]},"on-light-bg":{light:colorPrimitives["black-100"],dark:colorPrimitives["black-100"]},"on-dark-bg":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-700"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-700"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-100"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-700"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"state-danger-bold":{light:colorBrands["danger-700"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},alertSemantics={"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-body":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"icon-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"icon-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"icon-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"text-cta-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"text-cta-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"text-cta-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"text-cta-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"background-warning":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"background-error":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"background-info":{light:colorPrimitives["blue-100"],dark:colorPrimitives["blue-900"]},"stroke-success":{light:colorBrands["success-300"],dark:colorBrands["success-700"]},"stroke-warning":{light:colorBrands["warning-300"],dark:colorBrands["warning-700"]},"stroke-error":{light:colorBrands["danger-300"],dark:colorBrands["danger-700"]},"stroke-info":{light:colorPrimitives["blue-300"],dark:colorPrimitives["blue-700"]}},iconSemantics={primary:{light:colorBrands["neutral-900"],dark:colorBrands["neutral-400"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-100"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"hero-icons":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-200"],dark:colorBrands["success-600"]},"state-success-bold":{light:colorBrands["success-600"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-200"],dark:colorBrands["info-600"]},"state-info-bold":{light:colorBrands["info-600"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-200"],dark:colorBrands["warning-600"]},"state-warning-bold":{light:colorBrands["warning-600"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-200"],dark:colorBrands["danger-600"]},"state-danger-bold":{light:colorBrands["danger-600"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},strokeSemantics={primary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-300"],dark:colorBrands["success-500"]},"state-success-bold":{light:colorBrands["success-700"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-300"],dark:colorBrands["info-500"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-300"]},"state-warning-subtle":{light:colorBrands["warning-300"],dark:colorBrands["warning-500"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-300"]},"state-danger-subtle":{light:colorBrands["danger-300"],dark:colorBrands["danger-500"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-300"]},"state-hover":{light:colorBrands["success-300"],dark:colorBrands["success-800"]},"state-focus":{light:colorBrands["success-300"],dark:colorBrands["success-300"]},"state-pressed":{light:colorBrands["info-800"],dark:colorBrands["info-300"]},"state-disabled":{light:colorBrands["info-300"],dark:colorBrands["info-800"]}},surfaceSemantics={primary:{light:colorPrimitives["white-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-1000"]},tertiary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"primary-inverse":{light:colorPrimitives["black-100"],dark:colorPrimitives["white-100"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-300"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-500"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]},"glass-subtle":{light:colorPrimitives["white-80"],dark:colorPrimitives["black-80"]},"glass-bold":{light:colorPrimitives["white-50"],dark:colorPrimitives["black-50"]},transparent:{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-200"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-900"]},"state-info-bold":{light:colorBrands["info-500"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"state-warning-bold":{light:colorBrands["warning-500"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-200"]},"state-disabled":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]}},primaryButtonSemantics={"background-default":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-hover":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-pressed":{light:colorBrands["primary-800"],dark:colorBrands["primary-600"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"background-loading":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]}},secondaryButtonSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-700"]},"background-pressed":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-1000"]},"background-focus":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-loading":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["neutral-1000"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-800"],dark:colorPrimitives["white-60"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]}},tertiaryButtonSemantics={"background-default":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-inverse":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-300"]},"background-pressed":{light:colorBrands["neutral-100"],dark:colorPrimitives["gray-1000"]},"background-focus":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-loading":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["gray-200"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-300"],dark:colorPrimitives["white-50"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]}},outlineButtonSemantics={"background-default":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-hover":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-pressed":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-focus":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"stroke-loading":{light:colorBrands["neutral-200"],dark:colorBrands["primary-400"]},"stroke-hover":{light:strokeSemantics["brand-subtle"].light,dark:strokeSemantics.secondary.dark},"stroke-pressed":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-300"]}},dangerButtonSemantics={"background-default":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"background-hover":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-pressed":{light:colorBrands["danger-800"],dark:colorBrands["danger-700"]},"background-focus":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-loading":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-70"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-600"]}},dangerSecondaryButtonSemantics={"background-default":{light:colorBrands["danger-200"],dark:colorBrands["danger-800"]},"background-hover":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-pressed":{light:colorBrands["danger-500"],dark:colorBrands["danger-1000"]},"background-focus":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-loading":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["danger-700"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["danger-400"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-400"]}},checkboxSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:textSemantics["brand-medium"].light,dark:textSemantics["brand-medium"].dark},"stroke-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]}},inputSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},listItemSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-hover":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-error":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-error":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark}},modalSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorPrimitives["green-300"]},"icon-error":{light:colorPrimitives["red-700"],dark:colorPrimitives["red-600"]},"icon-warning":{light:colorPrimitives["yellow-400"],dark:colorPrimitives["yellow-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorPrimitives["blue-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-secondary":{light:iconSemantics.secondary.light,dark:iconSemantics.secondary.dark}},notificationsSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},paginationSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-hover":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-300"]},"text-selected":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-default":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["secondary-inverse"].light,dark:textSemantics["secondary-inverse"].dark}},progressBarSemantics={"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},radioSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics["brand-medium"].light,dark:strokeSemantics["brand-medium"].dark},"stroke-disabled":{light:strokeSemantics["state-disabled"].light,dark:strokeSemantics["state-disabled"].dark}},skeletonSemantics={"gradient-light":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"gradient-dark":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]}},switchSemantics={"background-selected":{light:colorBrands["primary-600"],dark:colorBrands["primary-600"]},"background-unselected":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-600"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark}},tagSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-success":{light:surfaceSemantics["state-success-subtle"].light,dark:surfaceSemantics["state-success-subtle"].dark},"background-danger":{light:surfaceSemantics["state-danger-subtle"].light,dark:surfaceSemantics["state-danger-subtle"].dark},"background-warning":{light:surfaceSemantics["state-warning-subtle"].light,dark:surfaceSemantics["state-warning-subtle"].dark},"background-info":{light:surfaceSemantics["state-info-subtle"].light,dark:surfaceSemantics["state-info-subtle"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-bold"].dark},"text-warning":{light:textSemantics["state-warning-bold"].light,dark:textSemantics["state-warning-bold"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"text-info":{light:textSemantics["state-info-bold"].light,dark:textSemantics["state-info-bold"].dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-warning":{light:iconSemantics["state-warning-bold"].light,dark:iconSemantics["state-warning-bold"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"icon-info":{light:iconSemantics["state-info-bold"].light,dark:iconSemantics["state-info-bold"].dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},textAreaSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},toastSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-success":{light:colorPrimitives["white-100"],dark:surfaceSemantics["state-success-bold"].dark},"background-warning":{light:surfaceSemantics["state-danger-bold"].light,dark:surfaceSemantics["state-danger-bold"].dark},"background-error":{light:surfaceSemantics["state-warning-bold"].light,dark:surfaceSemantics["state-warning-bold"].dark},"background-info":{light:surfaceSemantics["state-info-bold"].light,dark:surfaceSemantics["state-info-bold"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorBrands["success-300"]},"icon-warning":{light:colorPrimitives["red-700"],dark:colorBrands["danger-600"]},"icon-error":{light:colorPrimitives["yellow-400"],dark:colorBrands["warning-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorBrands["info-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},tooltipSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-primary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark}},sliderSemantics={"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},spinnerSemantics={"icon-primary":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"icon-secondary":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]}},tableSemantics={"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-heading":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},pillSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-700"]},"background-selected":{light:surfaceSemantics["primary-inverse"].light,dark:surfaceSemantics["primary-inverse"].dark},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-selected":{light:textSemantics["primary-inverse"].light,dark:textSemantics["primary-inverse"].dark}},semanticKeys={alert:"components-alert",buttonPrimary:"components-button-primary",buttonSecondary:"components-button-secondary",buttonTertiary:"components-button-tertiary",buttonOutline:"components-button-outline",buttonDanger:"components-button-danger",buttonDangerSecondary:"components-button-danger-secondary",checkbox:"components-checkbox",icon:"icon",input:"components-inputs",listItem:"components-list-item",modal:"components-modal",notifications:"components-in-app-notification",pagination:"components-pagination",pill:"components-pill",progressBar:"components-progress-bar",radio:"components-radio-button",surface:"surface",stroke:"stroke",skeleton:"components-skeleton-loader",table:"components-table",tag:"components-tag",text:"text",textArea:"components-textarea",toast:"components-toast",toggle:"components-toggle-switch",tooltip:"components-tooltip",slider:"components-slider",spinner:"components-spinner"},colorSemantics={[semanticKeys.alert]:alertSemantics,[semanticKeys.buttonPrimary]:primaryButtonSemantics,[semanticKeys.buttonSecondary]:secondaryButtonSemantics,[semanticKeys.buttonTertiary]:tertiaryButtonSemantics,[semanticKeys.buttonOutline]:outlineButtonSemantics,[semanticKeys.buttonDanger]:dangerButtonSemantics,[semanticKeys.buttonDangerSecondary]:dangerSecondaryButtonSemantics,[semanticKeys.checkbox]:checkboxSemantics,[semanticKeys.icon]:iconSemantics,[semanticKeys.input]:inputSemantics,[semanticKeys.listItem]:listItemSemantics,[semanticKeys.modal]:modalSemantics,[semanticKeys.notifications]:notificationsSemantics,[semanticKeys.pagination]:paginationSemantics,[semanticKeys.pill]:pillSemantics,[semanticKeys.progressBar]:progressBarSemantics,[semanticKeys.radio]:radioSemantics,[semanticKeys.surface]:surfaceSemantics,[semanticKeys.stroke]:strokeSemantics,[semanticKeys.skeleton]:skeletonSemantics,[semanticKeys.table]:tableSemantics,[semanticKeys.tag]:tagSemantics,[semanticKeys.text]:textSemantics,[semanticKeys.textArea]:textAreaSemantics,[semanticKeys.toast]:toastSemantics,[semanticKeys.toggle]:switchSemantics,[semanticKeys.tooltip]:tooltipSemantics,[semanticKeys.slider]:sliderSemantics,[semanticKeys.spinner]:spinnerSemantics},blurVariables={"blur-xs":"8px","blur-sm":"16px","blur-md":"24px","blur-lg":"40px","blur-xl":"72px","blur-xxl":"128px"},borderRadiusVariables={"radius-none":"0px","radius-xxxs":"4px","radius-xxs":"8px","radius-xs":"12px","radius-sm":"16px","radius-md":"24px","radius-lg":"32px","radius-xl":"40px","radius-xxl":"48px","radius-xxxl":"64px","radius-round":"1000px"},borderSizeVariables={"border-none":"0px","border-xs":"0.5px","border-sm":"1px","border-xmd":"1.5px","border-md":"2px","border-lg":"3px","border-xl":"4px"},opacityVariables={"opacity-0":"0","opacity-10":"0.1","opacity-20":"0.2","opacity-30":"0.3","opacity-40":"0.4","opacity-50":"0.5","opacity-60":"0.6","opacity-70":"0.7","opacity-80":"0.8","opacity-90":"0.9","opacity-100":"1"},spacingVariables={"spacing-none":"0px","spacing-xxxs":"4px","spacing-xxs":"8px","spacing-xs":"12px","spacing-sm":"16px","spacing-md":"24px","spacing-lg":"32px","spacing-xl":"40px","spacing-xxl":"48px","spacing-xxxl":"64px"},getThemeColors=Xr=>Object.entries(colorSemantics).reduce((eo,[to,ro])=>(Object.entries(ro).forEach(([no,io])=>{eo[`${to}-${no}`]=io[Xr]}),eo),{}),createTheme=Xr=>({colors:getThemeColors(Xr),blur:blurVariables,borderRadius:borderRadiusVariables,borderSize:borderSizeVariables,opacity:opacityVariables,spacing:spacingVariables}),getBlocksCSSVariables=Xr=>Object.values(Xr).map(eo=>Object.entries(eo).map(([to,ro])=>`--${to}: ${ro};`).join("")).join(""),blocksTheme={light:createTheme("light"),dark:createTheme("dark")},radiusRegex=/\bradius-[a-z]+\b/g,spacingRegex=/\bspacing-[a-z]+\b/g,textVariants={"dl-bold":{fontSize:"72px",fontStyle:null,fontWeight:"700",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-semibold":{fontSize:"72px",fontStyle:null,fontWeight:"500",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-regular":{fontSize:"72px",fontStyle:null,fontWeight:"400",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"ds-bold":{fontSize:"58px",fontStyle:null,fontWeight:"700",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-semibold":{fontSize:"58px",fontStyle:null,fontWeight:"500",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-regular":{fontSize:"58px",fontStyle:null,fontWeight:"400",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"h1-bold":{fontSize:"48px",fontStyle:null,fontWeight:"700",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-bold":{fontSize:"34px",fontStyle:null,fontWeight:"700",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-bold":{fontSize:"26px",fontStyle:null,fontWeight:"700",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-bold":{fontSize:"20px",fontStyle:null,fontWeight:"700",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-semibold":{fontSize:"48px",fontStyle:null,fontWeight:"500",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-semibold":{fontSize:"34px",fontStyle:null,fontWeight:"500",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-semibold":{fontSize:"26px",fontStyle:null,fontWeight:"500",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-semibold":{fontSize:"20px",fontStyle:null,fontWeight:"500",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-regular":{fontSize:"48px",fontStyle:null,fontWeight:"400",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-regular":{fontSize:"34px",fontStyle:null,fontWeight:"400",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-regular":{fontSize:"26px",fontStyle:null,fontWeight:"400",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-regular":{fontSize:"20px",fontStyle:null,fontWeight:"400",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"21px",letterSpacing:null,textTransform:null},"bl-bold":{fontSize:"18px",fontStyle:null,fontWeight:"700",lineHeight:"27px",letterSpacing:"0.5px",textTransform:null},"bl-semibold":{fontSize:"18px",fontStyle:null,fontWeight:"500",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-regular":{fontSize:"18px",fontStyle:null,fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-bold-italic":{fontSize:"18px",fontStyle:"italic",fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bm-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular-italic":{fontSize:"16px",fontStyle:"italic",fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bs-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular-italic":{fontSize:"14px",fontStyle:"italic",fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bes-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-semibold":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular-italic":{fontSize:"12px",fontStyle:"italic",fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"ol-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"ol-regular":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"os-bold":{fontSize:"10px",fontStyle:null,fontWeight:"700",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"os-regular":{fontSize:"10px",fontStyle:null,fontWeight:"500",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"c-semibold":{fontSize:"10px",fontStyle:null,fontWeight:500,lineHeight:"14px",letterSpacing:null,textTransform:null},"c-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:null},"c-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"16px",letterSpacing:null,textTransform:null}},getVariantStyles=Xr=>{if(Xr){const eo=textVariants[Xr];return Ae$3` + font-size: ${eo.fontSize}; + ${eo.fontStyle?`font-style: ${eo.fontStyle};`:""} + font-weight: ${eo.fontWeight}; + line-height: ${eo.lineHeight}; + ${eo.letterSpacing?`letter-spacing: ${eo.letterSpacing};`:""} + ${eo.textTransform?`text-transform: ${eo.textTransform};`:""} + `}return Ae$3` + font-size: ${textVariants["bes-regular"].fontSize}; + line-height: ${textVariants["bes-regular"].lineHeight}; + font-weight: ${textVariants["bes-regular"].fontWeight}; + `},getTextResponsiveCSSProperties=Xr=>[{propName:"display",prop:Xr.display}],getTextResponsiveCSS=Xr=>{const eo=getTextResponsiveCSSProperties(Xr);return getResponsiveCSS(eo)},StyledText=qe$4.p.withConfig({shouldForwardProp:(Xr,eo)=>!["color","display"].includes(Xr)&&eo(Xr)})` + /* Variant CSS */ + ${({variant:Xr})=>getVariantStyles(Xr)} + + color: ${({color:Xr})=>`var(--${Xr})`}; + font-family: var(--font-family); + margin: 0px; + text-align: ${({textAlign:Xr})=>Xr}; + text-transform: ${({textTransform:Xr})=>Xr}; + + /* Ellipsis for single line overflow */ + ${({ellipsis:Xr})=>Xr&&` + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + `} + + /* Text wrapping */ + ${({wrap:Xr})=>Xr&&` + white-space: normal; + word-wrap: break-word; + `} + + /* Limit number of lines */ + ${({numberOfLines:Xr})=>Xr&&` + display: -webkit-box; + -webkit-line-clamp: ${Xr}; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + `} + + /* Full width of parent container */ + width: ${({fullWidth:Xr})=>Xr?"100%":"auto"}; + + /* Responsive props */ + ${Xr=>getTextResponsiveCSS(Xr)} + + /* Extra CSS props */ + ${Xr=>Xr.css||""} +`,Text=reactExports.forwardRef(({as:Xr="p",color:eo="text-primary",...to},ro)=>jsxRuntimeExports.jsx(StyledText,{as:Xr,color:eo,ref:ro,...to}));Text.displayName="Text";const getCSSValue=(Xr,eo)=>{if(Xr==="padding"||Xr==="margin"){if(typeof eo=="string")return eo.replace(spacingRegex,to=>`var(--${to})`)}else if(Xr==="gap"||Xr==="border-radius")return`var(--${eo})`;return eo},parsePixels=Xr=>parseFloat(Xr.replace("px","")),computePixels=(Xr,eo)=>Xr.reduce((to,ro)=>to+parsePixels(ro),0)+"px",createBreakpointCSS=Xr=>{const eo=Object.entries(Xr).filter(([ro,no])=>no);if(!eo.length)return"";const to=`@media ${deviceMediaQ[eo[0][0]]} { + ${eo[0][1]} + }`;return eo.length===1?to:`${to}`+eo.map(([ro,no],io)=>{if(io){const oo=eo[io-1][0],so=`@media (min-width: ${computePixels([deviceSizes[oo],"1px"])})`,co=ro,lo=deviceMediaQ!=null&&deviceMediaQ[co]?`and ${deviceMediaQ==null?void 0:deviceMediaQ[co]}`:"";return`${so} ${lo} { ${no} }`}else return""}).join(";")},getResponsiveCSS=Xr=>{let eo="";const to={mobileS:"",mobileM:"",mobileL:"",tablet:"",laptop:"",laptopL:"",desktop:"",ultrawide:""};return Xr.forEach(({prop:ro,propName:no})=>{typeof ro=="object"?Object.entries(ro).forEach(([io,oo])=>{const ao=breakpointMap[io];ao?to[ao]+=`${no}: ${getCSSValue(no,oo)};`:eo+=`${no}: ${getCSSValue(no,oo)};`}):ro&&(eo+=`${no}: ${getCSSValue(no,ro)};`)}),Ae$3` + ${eo} + ${createBreakpointCSS(to)} + `},getBlocksBorder=Xr=>{if(!Xr)return Xr;let eo;return eo=Xr.split(" "),eo[0]=`var(--${eo[0]})`,eo[2]=`var(--${eo[2]})`,eo.join(" ")},getBlocksBorderRadius=Xr=>Xr&&Xr.replace(radiusRegex,to=>`var(--${to})`),getTextVariantStyles=(Xr,eo)=>Ae$3` + color: var(--${eo}); + font-family: var(--font-family); + font-size: ${textVariants[Xr].fontSize}; + font-style: ${textVariants[Xr].fontStyle}; + font-weight: ${textVariants[Xr].fontWeight}; + line-height: ${textVariants[Xr].lineHeight}; + letter-spacing: ${textVariants[Xr].letterSpacing}; + text-transform: ${textVariants[Xr].textTransform}; + margin: var(--spacing-none); +`;qe$4.button` + display: inline-flex; + align-items: center; + justify-content: center; + padding: var(--${Xr=>Xr.padding||"spacing-none"}); + margin: var(--${Xr=>Xr.margin||"spacing-none"}); + border-radius: ${Xr=>getBlocksBorderRadius(Xr.borderRadius)}; + background-color: var(--${({defaultBackground:Xr})=>Xr||"surface-transparent"}); + color: ${({defaultColor:Xr})=>`var(--${Xr})`||"inherit"}; + border: none; + cursor: ${({disabled:Xr})=>Xr?"not-allowed":"pointer"}; + transition: background-color 0.3s, color 0.3s; + height: fit-content; + &:hover { + background-color: var(--${({hoverBackground:Xr})=>Xr||"surface-transparent"}); + color: ${({hoverColor:Xr})=>`var(--${Xr})`||"inherit"}; + } + &:disabled { + color: var(--icon-state-disabled); + } +`;qe$4.div` + /* Common Alert CSS */ + + display: flex; + font-family: var(--font-family); + border-radius: var(--radius-sm); + justify-content: center; + white-space: nowrap; + padding: var(--spacing-xs); + justify-content: space-between; + ${({variant:Xr})=>` + border: var(--border-sm) solid var(--${alertVariants[Xr].borderColor}); + background-color: var(--${alertVariants[Xr].bgColor}); + `} + + /* Common icon css added through CSS class */ + .icon { + display: flex; + justify-content: center; + margin-right: var(--spacing-xxxs); + color: var(--${({variant:Xr})=>alertVariants[Xr].iconColor}); + } + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`;qe$4.div` + /* Link CSS */ + text-decoration: none; + cursor: pointer; + color: var(--${({variant:Xr})=>alertVariants[Xr].ctaColor}); +`;qe$4.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: var(--spacing-xxxs); + flex: 1 0 0; +`;qe$4.div` + display: flex; + gap: var(--spacing-xs, 12px); + align-items: center; + height: 24px; +`;qe$4.p` + white-space: break-spaces; + ${()=>getTextVariantStyles("h5-semibold","components-alert-text-default")} +`;qe$4.p` + white-space: break-spaces; + ${()=>getTextVariantStyles("bs-regular","components-alert-text-body")} +`;const getBoxResponsiveCSSProperties=Xr=>[{propName:"align-items",prop:Xr.alignItems},{propName:"align-self",prop:Xr.alignSelf},{propName:"display",prop:Xr.display},{propName:"flex-direction",prop:Xr.flexDirection},{propName:"gap",prop:Xr.gap},{propName:"height",prop:Xr.height},{propName:"justify-content",prop:Xr.justifyContent},{propName:"margin",prop:Xr.margin},{propName:"max-height",prop:Xr.maxHeight},{propName:"min-height",prop:Xr.minHeight},{propName:"max-width",prop:Xr.maxWidth},{propName:"min-width",prop:Xr.minWidth},{propName:"padding",prop:Xr.padding},{propName:"text-align",prop:Xr.textAlign},{propName:"width",prop:Xr.width}],getBoxResponsiveCSS=Xr=>{const eo=getBoxResponsiveCSSProperties(Xr);return getResponsiveCSS(eo)},boxRestrictedCSSPropKeys=["border","borderRadius","backgroundColor","color","cursor","position","boxShadow","alignItems","alignSelf","display","flexDirection","gap","height","justifyContent","margin","maxHeight","minHeight","maxWidth","minWidth","overflow","padding","textAlign","width"],StyledBox=qe$4.div.withConfig({shouldForwardProp:(Xr,eo)=>!boxRestrictedCSSPropKeys.includes(Xr)&&eo(Xr)})` + /* Responsive props */ + ${Xr=>getBoxResponsiveCSS(Xr)} + + /* Non-responsive props */ + color: ${Xr=>Xr!=null&&Xr.color?`var(--${Xr.color})`:""}; + background-color: ${Xr=>Xr!=null&&Xr.backgroundColor?`var(--${Xr.backgroundColor})`:""}; + box-shadow: ${Xr=>Xr.boxShadow}; + border-radius: ${Xr=>getBlocksBorderRadius(Xr.borderRadius)}; + cursor: ${Xr=>Xr.cursor}; + overflow: ${Xr=>Xr.overflow}; + border: ${Xr=>getBlocksBorder(Xr.border)}; + position: ${Xr=>Xr.position}; + + // push custom scroll + ${Xr=>Xr.customScrollbar&&` + &::-webkit-scrollbar-track { + background-color: none; + border-radius: 9px; + } + + &::-webkit-scrollbar { + background-color: none; + width: 4px; + } + + &::-webkit-scrollbar-thumb { + border-radius: 10px; + background: ${colorBrands["primary-500"]}; + } + `} + + /* Extra CSS prop */ + ${Xr=>Xr.css||""} +`,Box=reactExports.forwardRef(({as:Xr="div",...eo},to)=>jsxRuntimeExports.jsx(StyledBox,{as:Xr,ref:to,...eo}));Box.displayName="Box";const getButtonVariantStyles=(Xr,eo)=>{switch(Xr){case"primary":return` + background-color: var(--${eo?"components-button-primary-background-loading":"components-button-primary-background-default"}); + color: var(--components-button-primary-text-default); + ${!eo&&` + &:hover { + background-color: var(--components-button-primary-background-hover) + } + &:active { + background-color: var(--components-button-primary-background-pressed); + } + `}; + + &:focus-visible { + background-color: var(--components-button-primary-background-focus); + border: var(--border-sm) solid var(--components-button-primary-stroke-focus); + outline: none; + } + ${!eo&&`&:disabled { + background-color: var(--components-button-primary-background-disabled); + color: var(--components-button-primary-text-disabled); + }`}; + + `;case"secondary":return` + background-color: var(--components-button-secondary-background-default); + color: var(--components-button-secondary-text-default); + ${!eo&&` + &:hover { + background-color: var(--components-button-secondary-background-hover); + } + + &:active { + background-color: var(--components-button-secondary-background-pressed); + }`}; + + &:focus-visible { + background-color: var(--components-button-secondary-background-focus); + border: var(--border-sm) solid var(--components-button-secondary-stroke-focus); + outline: none; + } + ${!eo&&`&:disabled { + background-color: var(--components-button-secondary-background-disabled); + color: var(--components-button-secondary-text-disabled); + };`}; + + `;case"tertiary":return` + background-color: var(--components-button-tertiary-background-default); + color: var(--components-button-tertiary-text-default); + ${!eo&&` + &:hover { + color: var(--components-button-tertiary-text-default); + background-color: var(--components-button-tertiary-background-hover); + } + + &:active { + background-color: var(--components-button-tertiary-background-pressed); + color: var(--components-button-secondary-text-default); + }`}; + + &:focus-visible { + border: var(--border-sm) solid var(--components-button-tertiary-stroke-focus); + background-color: var(--components-button-tertiary-background-focus); + color: var(--components-button-tertiary-text-default); + outline: none; + } + ${!eo&&`&:disabled { + background-color: var(--components-button-tertiary-background-disabled); + color: var(--components-button-tertiary-text-disabled); + }`}; + `;case"danger":return` + background-color: var(--components-button-danger-background-default); + color: var(--components-button-danger-text-default); + ${!eo&&` + &:hover { + background-color: var(--components-button-danger-background-hover); + } + + &:active { + background-color: var(--components-button-danger-background-pressed); + }`}; + + &:focus-visible { + background-color: var(--components-button-danger-background-focus); + border: var(--border-sm) solid var(--components-button-danger-stroke-focus); + outline: none; + } + ${!eo&&`&:disabled { + background-color: var(--components-button-danger-background-disabled); + color: var(--components-button-danger-text-disabled); + }`}; + `;case"dangerSecondary":return` + background-color: var(--components-button-danger-secondary-background-default); + color: var(--components-button-danger-secondary-text-default); + ${!eo&&` + &:hover { + background-color: var(--components-button-danger-secondary-background-hover); + } + + &:active { + background-color: var(--components-button-danger-secondary-background-pressed); + }`}; + + &:focus-visible { + background-color: var(--components-button-danger-secondary-background-focus); + border: var(--border-sm) solid var(--components-button-danger-secondary-stroke-focus); + outline: none; + } + ${!eo&&`&:disabled { + background-color: var(--components-button-danger-secondary-background-disabled); + color:var(--components-button-danger-secondary-text-disabled); + }`}; + `;case"outline":return` + background-color: var(--components-button-outline-background-default); + border: var(--border-sm) solid var(--components-button-outline-stroke-default); + color: var(--components-button-outline-text-default); + outline: none; + ${!eo&&` + &:hover { + border: var(--border-sm) solid var(--components-button-outline-stroke-hover); + background-color: var(--components-button-outline-background-hover); + } + + &:active { + border: var(--border-sm) solid var(--components-button-outline-stroke-pressed); + background-color: var(--components-button-outline-background-pressed); + }`}; + + &:focus-visible { + border: var(--border-sm) solid var(--components-button-outline-stroke-focus); + background-color: var(--components-button-outline-background-focus); + } + + ${!eo&&`&:disabled { + border: none; + background-color: var(--components-button-tertiary-background-disabled); + color: var(--components-button-outline-text-disabled); + }`}; + `}},getButtonSizeStyles=({iconOnly:Xr,size:eo})=>eo==="extraSmall"?Ae$3` + /* Button tag container size css */ + + ${Xr?` + border-radius: var(--radius-xxs); + gap: var(--spacing-none); + height: 32px; + width: 32px; + padding: var(--spacing-none); + `:` + border-radius: var(--radius-xxs); + gap: var(--spacing-xxxs); + height: 32px; + padding: var(--spacing-xs) var(--spacing-sm); + min-width: 100px; + `} + + /* Button text size css */ + leading-trim: both; + text-edge: cap; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: 16px; + + [role='img'] { + width: 16px; + height: 16px; + } + [role='spinner'] { + width: 10.66px; + height: 10.66px; + } + + .icon-text > span { + height: 16px; + width: 16px; + } + + .icon-only > span { + height: 16px; + width: 16px; + } + `:eo==="small"?Ae$3` + /* Button tag container size css */ + + ${Xr?` + border-radius: var(--radius-xs); + gap: var(--spacing-none); + height: 40px; + width: 40px; + padding: var(--spacing-none); + `:` + border-radius: var(--radius-xs); + gap: var(--spacing-xxxs); + height: 40px; + padding: var(--spacing-xs) var(--spacing-md); + min-width: 100px; + `} + + /* Button text size css */ + leading-trim: both; + text-edge: cap; + font-size: 14px; + font-style: normal; + font-weight: 500; + line-height: 16px; + + [role='img'] { + width: 24px; + height: 24px; + } + [role='spinner'] { + width: 16px; + height: 16px; + } + + .icon-text > span { + height: 16px; + width: 16px; + } + + .icon-only > span { + height: 24px; + width: 24px; + } + `:eo==="medium"?Ae$3` + /* Button tag container size css */ + + ${Xr?` + border-radius: var(--spacing-sm); + gap: var(--spacing-none); + height: 48px; + width: 48px; + padding: var(--spacing-none); + `:` + border-radius: var(--radius-xs); + gap: var(--spacing-xxxs); + height: 48px; + padding: var(--spacing-sm) var(--spacing-md); + min-width: 100px; + `} + + /* Button text size css */ + leading-trim: both; + text-edge: cap; + font-size: 16px; + font-style: normal; + font-weight: 500; + line-height: 16px; + + [role='img'] { + width: 24px; + height: 24px; + } + [role='spinner'] { + width: 16px; + height: 16px; + } + + .icon-text > span { + height: 24px; + width: 24px; + } + + .icon-only > span { + height: 24px; + width: 24px; + } + `:Ae$3` + /* Button tag container size css */ + + ${Xr?` + border-radius: var(--spacing-sm); + gap: var(--spacing-none); + height: 52px; + width: 52px; + padding: var(--spacing-none); + `:` + border-radius: var(--radius-xs); + gap: var(--spacing-xxxs); + height: 52px; + padding: var(--spacing-sm) var(--spacing-lg); + min-width: 100px; + `} + + /* Button text size css */ + leading-trim: both; + text-edge: cap; + font-size: 18px; + font-style: normal; + font-weight: 500; + line-height: 16px; + + [role='img'] { + width: 32px; + height: 32px; + } + [role='spinner'] { + width: 21.333px; + height: 21.333px; + } + .icon-text > span { + height: 24px; + width: 24px; + } + + .icon-only > span { + height: 32px; + width: 32px; + } + `,getSpinnerColor=Xr=>{switch(Xr){case"primary":return"components-spinner-icon-primary";case"secondary":return"components-spinner-icon-secondary";default:return""}},getSpinnerSize=Xr=>{switch(Xr){case"small":return 16;case"medium":return 24;case"large":return 32;default:return 48}},spin=We$4` + from { + transform:rotate(0deg); + } + to { + transform:rotate(360deg); + } +`,Container$3=qe$4.div` + display: flex; + align-items: center; + justify-content: center; + animation-name: ${spin}; + animation-duration: 1s; + animation-iteration-count: infinite; + animation-timing-function: linear; + ${({size:Xr})=>` + width: ${getSpinnerSize(Xr)}px; + height: ${getSpinnerSize(Xr)}px; + `} + ${({variant:Xr})=>` + ${Xr?` + [role='img'] { + color: var(--${getSpinnerColor(Xr)}); + } + `:""} + `} + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`,Spinner$2=({size:Xr="small",css:eo,variant:to})=>jsxRuntimeExports.jsx(Container$3,{size:Xr,css:eo,variant:to,role:"spinner",children:jsxRuntimeExports.jsx(Ellipse,{size:getSpinnerSize(Xr)})});Spinner$2.displayName="Spinner";const StyledButton=qe$4.button` + /* Common Button CSS */ + + align-items: center; + cursor: ${Xr=>Xr.disabled?"not-allowed":"pointer"}; + display: flex; + font-family: var(--font-family); + justify-content: center; + white-space: nowrap; + flex-shrink: 0; + + /* Common icon css added through CSS class */ + .icon { + display: flex; + align-items: center; + justify-content: center; + } + /* Button variant CSS styles */ + ${({variant:Xr,loading:eo})=>getButtonVariantStyles(Xr||"primary",eo)} + + ${({loading:Xr})=>Xr&&"opacity: var(--opacity-80);"} + + /* Button and font size CSS styles */ + ${({iconOnly:Xr,size:eo})=>getButtonSizeStyles({iconOnly:!!Xr,size:eo||"medium"})} + + /* Circular CSS for rounded icon only buttons */ + ${({circular:Xr,iconOnly:eo})=>Xr&&eo&&"border-radius: var(--r10);"} + + /* Prop specific CSS */ + ${({block:Xr})=>Xr&&"width: 100%;"} + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`,SpinnerContainer=qe$4.div` + padding: 5px; +`,Button$1=reactExports.forwardRef(({disabled:Xr,variant:eo="primary",size:to="medium",leadingIcon:ro,trailingIcon:no,loading:io=!1,iconOnly:oo,circular:ao=!1,children:so,...co},lo)=>jsxRuntimeExports.jsxs(StyledButton,{...Xr||io?{"aria-disabled":!0}:{},circular:ao,disabled:Xr||io,iconOnly:oo,loading:io,role:"button",ref:lo,size:to,variant:eo,...co,children:[io&&jsxRuntimeExports.jsx(SpinnerContainer,{children:jsxRuntimeExports.jsx(Spinner$2,{})}),ro&&jsxRuntimeExports.jsx("span",{className:"icon icon-text",children:ro}),!oo&&so,no&&jsxRuntimeExports.jsx("span",{className:"icon icon-text",children:no}),oo&&!io&&!so&&jsxRuntimeExports.jsx("span",{className:"icon icon-only",children:oo})]}));Button$1.displayName="Button";function composeEventHandlers$1(Xr,eo,{checkForDefaultPrevented:to=!0}={}){return function(no){if(Xr==null||Xr(no),to===!1||!no.defaultPrevented)return eo==null?void 0:eo(no)}}function setRef(Xr,eo){typeof Xr=="function"?Xr(eo):Xr!=null&&(Xr.current=eo)}function composeRefs(...Xr){return eo=>Xr.forEach(to=>setRef(to,eo))}function useComposedRefs$1(...Xr){return reactExports.useCallback(composeRefs(...Xr),Xr)}function createContext2$1(Xr,eo){const to=reactExports.createContext(eo),ro=io=>{const{children:oo,...ao}=io,so=reactExports.useMemo(()=>ao,Object.values(ao));return jsxRuntimeExports.jsx(to.Provider,{value:so,children:oo})};ro.displayName=Xr+"Provider";function no(io){const oo=reactExports.useContext(to);if(oo)return oo;if(eo!==void 0)return eo;throw new Error(`\`${io}\` must be used within \`${Xr}\``)}return[ro,no]}function createContextScope$3(Xr,eo=[]){let to=[];function ro(io,oo){const ao=reactExports.createContext(oo),so=to.length;to=[...to,oo];const co=uo=>{var $o;const{scope:ho,children:go,...bo}=uo,wo=(($o=ho==null?void 0:ho[Xr])==null?void 0:$o[so])||ao,Eo=reactExports.useMemo(()=>bo,Object.values(bo));return jsxRuntimeExports.jsx(wo.Provider,{value:Eo,children:go})};co.displayName=io+"Provider";function lo(uo,ho){var wo;const go=((wo=ho==null?void 0:ho[Xr])==null?void 0:wo[so])||ao,bo=reactExports.useContext(go);if(bo)return bo;if(oo!==void 0)return oo;throw new Error(`\`${uo}\` must be used within \`${io}\``)}return[co,lo]}const no=()=>{const io=to.map(oo=>reactExports.createContext(oo));return function(ao){const so=(ao==null?void 0:ao[Xr])||io;return reactExports.useMemo(()=>({[`__scope${Xr}`]:{...ao,[Xr]:so}}),[ao,so])}};return no.scopeName=Xr,[ro,composeContextScopes$3(no,...eo)]}function composeContextScopes$3(...Xr){const eo=Xr[0];if(Xr.length===1)return eo;const to=()=>{const ro=Xr.map(no=>({useScope:no(),scopeName:no.scopeName}));return function(io){const oo=ro.reduce((ao,{useScope:so,scopeName:co})=>{const uo=so(io)[`__scope${co}`];return{...ao,...uo}},{});return reactExports.useMemo(()=>({[`__scope${eo.scopeName}`]:oo}),[oo])}};return to.scopeName=eo.scopeName,to}function useCallbackRef$1(Xr){const eo=reactExports.useRef(Xr);return reactExports.useEffect(()=>{eo.current=Xr}),reactExports.useMemo(()=>(...to)=>{var ro;return(ro=eo.current)==null?void 0:ro.call(eo,...to)},[])}function useControllableState({prop:Xr,defaultProp:eo,onChange:to=()=>{}}){const[ro,no]=useUncontrolledState({defaultProp:eo,onChange:to}),io=Xr!==void 0,oo=io?Xr:ro,ao=useCallbackRef$1(to),so=reactExports.useCallback(co=>{if(io){const uo=typeof co=="function"?co(Xr):co;uo!==Xr&&ao(uo)}else no(co)},[io,Xr,no,ao]);return[oo,so]}function useUncontrolledState({defaultProp:Xr,onChange:eo}){const to=reactExports.useState(Xr),[ro]=to,no=reactExports.useRef(ro),io=useCallbackRef$1(eo);return reactExports.useEffect(()=>{no.current!==ro&&(io(ro),no.current=ro)},[ro,no,io]),to}var Slot=reactExports.forwardRef((Xr,eo)=>{const{children:to,...ro}=Xr,no=reactExports.Children.toArray(to),io=no.find(isSlottable);if(io){const oo=io.props.children,ao=no.map(so=>so===io?reactExports.Children.count(oo)>1?reactExports.Children.only(null):reactExports.isValidElement(oo)?oo.props.children:null:so);return jsxRuntimeExports.jsx(SlotClone,{...ro,ref:eo,children:reactExports.isValidElement(oo)?reactExports.cloneElement(oo,void 0,ao):null})}return jsxRuntimeExports.jsx(SlotClone,{...ro,ref:eo,children:to})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((Xr,eo)=>{const{children:to,...ro}=Xr;if(reactExports.isValidElement(to)){const no=getElementRef$1(to);return reactExports.cloneElement(to,{...mergeProps(ro,to.props),ref:eo?composeRefs(eo,no):no})}return reactExports.Children.count(to)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:Xr})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xr});function isSlottable(Xr){return reactExports.isValidElement(Xr)&&Xr.type===Slottable}function mergeProps(Xr,eo){const to={...eo};for(const ro in eo){const no=Xr[ro],io=eo[ro];/^on[A-Z]/.test(ro)?no&&io?to[ro]=(...ao)=>{io(...ao),no(...ao)}:no&&(to[ro]=no):ro==="style"?to[ro]={...no,...io}:ro==="className"&&(to[ro]=[no,io].filter(Boolean).join(" "))}return{...Xr,...to}}function getElementRef$1(Xr){var ro,no;let eo=(ro=Object.getOwnPropertyDescriptor(Xr.props,"ref"))==null?void 0:ro.get,to=eo&&"isReactWarning"in eo&&eo.isReactWarning;return to?Xr.ref:(eo=(no=Object.getOwnPropertyDescriptor(Xr,"ref"))==null?void 0:no.get,to=eo&&"isReactWarning"in eo&&eo.isReactWarning,to?Xr.props.ref:Xr.props.ref||Xr.ref)}var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((Xr,eo)=>{const to=reactExports.forwardRef((ro,no)=>{const{asChild:io,...oo}=ro,ao=io?Slot:eo;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(ao,{...oo,ref:no})});return to.displayName=`Primitive.${eo}`,{...Xr,[eo]:to}},{});function dispatchDiscreteCustomEvent(Xr,eo){Xr&&reactDomExports.flushSync(()=>Xr.dispatchEvent(eo))}function createContextScope$2(Xr,eo=[]){let to=[];function ro(io,oo){const ao=reactExports.createContext(oo),so=to.length;to=[...to,oo];function co(uo){const{scope:ho,children:go,...bo}=uo,wo=(ho==null?void 0:ho[Xr][so])||ao,Eo=reactExports.useMemo(()=>bo,Object.values(bo));return jsxRuntimeExports.jsx(wo.Provider,{value:Eo,children:go})}function lo(uo,ho){const go=(ho==null?void 0:ho[Xr][so])||ao,bo=reactExports.useContext(go);if(bo)return bo;if(oo!==void 0)return oo;throw new Error(`\`${uo}\` must be used within \`${io}\``)}return co.displayName=io+"Provider",[co,lo]}const no=()=>{const io=to.map(oo=>reactExports.createContext(oo));return function(ao){const so=(ao==null?void 0:ao[Xr])||io;return reactExports.useMemo(()=>({[`__scope${Xr}`]:{...ao,[Xr]:so}}),[ao,so])}};return no.scopeName=Xr,[ro,composeContextScopes$2(no,...eo)]}function composeContextScopes$2(...Xr){const eo=Xr[0];if(Xr.length===1)return eo;const to=()=>{const ro=Xr.map(no=>({useScope:no(),scopeName:no.scopeName}));return function(io){const oo=ro.reduce((ao,{useScope:so,scopeName:co})=>{const uo=so(io)[`__scope${co}`];return{...ao,...uo}},{});return reactExports.useMemo(()=>({[`__scope${eo.scopeName}`]:oo}),[oo])}};return to.scopeName=eo.scopeName,to}function createCollection(Xr){const eo=Xr+"CollectionProvider",[to,ro]=createContextScope$2(eo),[no,io]=to(eo,{collectionRef:{current:null},itemMap:new Map}),oo=go=>{const{scope:bo,children:wo}=go,Eo=React.useRef(null),$o=React.useRef(new Map).current;return jsxRuntimeExports.jsx(no,{scope:bo,itemMap:$o,collectionRef:Eo,children:wo})};oo.displayName=eo;const ao=Xr+"CollectionSlot",so=React.forwardRef((go,bo)=>{const{scope:wo,children:Eo}=go,$o=io(ao,wo),Co=useComposedRefs$1(bo,$o.collectionRef);return jsxRuntimeExports.jsx(Slot,{ref:Co,children:Eo})});so.displayName=ao;const co=Xr+"CollectionItemSlot",lo="data-radix-collection-item",uo=React.forwardRef((go,bo)=>{const{scope:wo,children:Eo,...$o}=go,Co=React.useRef(null),Ro=useComposedRefs$1(bo,Co),Oo=io(co,wo);return React.useEffect(()=>(Oo.itemMap.set(Co,{ref:Co,...$o}),()=>void Oo.itemMap.delete(Co))),jsxRuntimeExports.jsx(Slot,{[lo]:"",ref:Ro,children:Eo})});uo.displayName=co;function ho(go){const bo=io(Xr+"CollectionConsumer",go);return React.useCallback(()=>{const Eo=bo.collectionRef.current;if(!Eo)return[];const $o=Array.from(Eo.querySelectorAll(`[${lo}]`));return Array.from(bo.itemMap.values()).sort((Oo,jo)=>$o.indexOf(Oo.ref.current)-$o.indexOf(jo.ref.current))},[bo.collectionRef,bo.itemMap])}return[{Provider:oo,Slot:so,ItemSlot:uo},ho,ro]}var DirectionContext=reactExports.createContext(void 0);function useDirection(Xr){const eo=reactExports.useContext(DirectionContext);return Xr||eo||"ltr"}function useEscapeKeydown(Xr,eo=globalThis==null?void 0:globalThis.document){const to=useCallbackRef$1(Xr);reactExports.useEffect(()=>{const ro=no=>{no.key==="Escape"&&to(no)};return eo.addEventListener("keydown",ro,{capture:!0}),()=>eo.removeEventListener("keydown",ro,{capture:!0})},[to,eo])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=reactExports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=reactExports.forwardRef((Xr,eo)=>{const{disableOutsidePointerEvents:to=!1,onEscapeKeyDown:ro,onPointerDownOutside:no,onFocusOutside:io,onInteractOutside:oo,onDismiss:ao,...so}=Xr,co=reactExports.useContext(DismissableLayerContext),[lo,uo]=reactExports.useState(null),ho=(lo==null?void 0:lo.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,go]=reactExports.useState({}),bo=useComposedRefs$1(eo,Mo=>uo(Mo)),wo=Array.from(co.layers),[Eo]=[...co.layersWithOutsidePointerEventsDisabled].slice(-1),$o=wo.indexOf(Eo),Co=lo?wo.indexOf(lo):-1,Ro=co.layersWithOutsidePointerEventsDisabled.size>0,Oo=Co>=$o,jo=usePointerDownOutside(Mo=>{const Fo=Mo.target,Wo=[...co.branches].some(Jo=>Jo.contains(Fo));!Oo||Wo||(no==null||no(Mo),oo==null||oo(Mo),Mo.defaultPrevented||ao==null||ao())},ho),Bo=useFocusOutside(Mo=>{const Fo=Mo.target;[...co.branches].some(Jo=>Jo.contains(Fo))||(io==null||io(Mo),oo==null||oo(Mo),Mo.defaultPrevented||ao==null||ao())},ho);return useEscapeKeydown(Mo=>{Co===co.layers.size-1&&(ro==null||ro(Mo),!Mo.defaultPrevented&&ao&&(Mo.preventDefault(),ao()))},ho),reactExports.useEffect(()=>{if(lo)return to&&(co.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=ho.body.style.pointerEvents,ho.body.style.pointerEvents="none"),co.layersWithOutsidePointerEventsDisabled.add(lo)),co.layers.add(lo),dispatchUpdate(),()=>{to&&co.layersWithOutsidePointerEventsDisabled.size===1&&(ho.body.style.pointerEvents=originalBodyPointerEvents)}},[lo,ho,to,co]),reactExports.useEffect(()=>()=>{lo&&(co.layers.delete(lo),co.layersWithOutsidePointerEventsDisabled.delete(lo),dispatchUpdate())},[lo,co]),reactExports.useEffect(()=>{const Mo=()=>go({});return document.addEventListener(CONTEXT_UPDATE,Mo),()=>document.removeEventListener(CONTEXT_UPDATE,Mo)},[]),jsxRuntimeExports.jsx(Primitive.div,{...so,ref:bo,style:{pointerEvents:Ro?Oo?"auto":"none":void 0,...Xr.style},onFocusCapture:composeEventHandlers$1(Xr.onFocusCapture,Bo.onFocusCapture),onBlurCapture:composeEventHandlers$1(Xr.onBlurCapture,Bo.onBlurCapture),onPointerDownCapture:composeEventHandlers$1(Xr.onPointerDownCapture,jo.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((Xr,eo)=>{const to=reactExports.useContext(DismissableLayerContext),ro=reactExports.useRef(null),no=useComposedRefs$1(eo,ro);return reactExports.useEffect(()=>{const io=ro.current;if(io)return to.branches.add(io),()=>{to.branches.delete(io)}},[to.branches]),jsxRuntimeExports.jsx(Primitive.div,{...Xr,ref:no})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(Xr,eo=globalThis==null?void 0:globalThis.document){const to=useCallbackRef$1(Xr),ro=reactExports.useRef(!1),no=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const io=ao=>{if(ao.target&&!ro.current){let so=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,to,co,{discrete:!0})};const co={originalEvent:ao};ao.pointerType==="touch"?(eo.removeEventListener("click",no.current),no.current=so,eo.addEventListener("click",no.current,{once:!0})):so()}else eo.removeEventListener("click",no.current);ro.current=!1},oo=window.setTimeout(()=>{eo.addEventListener("pointerdown",io)},0);return()=>{window.clearTimeout(oo),eo.removeEventListener("pointerdown",io),eo.removeEventListener("click",no.current)}},[eo,to]),{onPointerDownCapture:()=>ro.current=!0}}function useFocusOutside(Xr,eo=globalThis==null?void 0:globalThis.document){const to=useCallbackRef$1(Xr),ro=reactExports.useRef(!1);return reactExports.useEffect(()=>{const no=io=>{io.target&&!ro.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,to,{originalEvent:io},{discrete:!1})};return eo.addEventListener("focusin",no),()=>eo.removeEventListener("focusin",no)},[eo,to]),{onFocusCapture:()=>ro.current=!0,onBlurCapture:()=>ro.current=!1}}function dispatchUpdate(){const Xr=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(Xr)}function handleAndDispatchCustomEvent(Xr,eo,to,{discrete:ro}){const no=to.originalEvent.target,io=new CustomEvent(Xr,{bubbles:!1,cancelable:!0,detail:to});eo&&no.addEventListener(Xr,eo,{once:!0}),ro?dispatchDiscreteCustomEvent(no,io):no.dispatchEvent(io)}var count$1=0;function useFocusGuards(){reactExports.useEffect(()=>{const Xr=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",Xr[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",Xr[1]??createFocusGuard()),count$1++,()=>{count$1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(eo=>eo.remove()),count$1--}},[])}function createFocusGuard(){const Xr=document.createElement("span");return Xr.setAttribute("data-radix-focus-guard",""),Xr.tabIndex=0,Xr.style.outline="none",Xr.style.opacity="0",Xr.style.position="fixed",Xr.style.pointerEvents="none",Xr}var AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS$1={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=reactExports.forwardRef((Xr,eo)=>{const{loop:to=!1,trapped:ro=!1,onMountAutoFocus:no,onUnmountAutoFocus:io,...oo}=Xr,[ao,so]=reactExports.useState(null),co=useCallbackRef$1(no),lo=useCallbackRef$1(io),uo=reactExports.useRef(null),ho=useComposedRefs$1(eo,wo=>so(wo)),go=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(ro){let wo=function(Ro){if(go.paused||!ao)return;const Oo=Ro.target;ao.contains(Oo)?uo.current=Oo:focus(uo.current,{select:!0})},Eo=function(Ro){if(go.paused||!ao)return;const Oo=Ro.relatedTarget;Oo!==null&&(ao.contains(Oo)||focus(uo.current,{select:!0}))},$o=function(Ro){if(document.activeElement===document.body)for(const jo of Ro)jo.removedNodes.length>0&&focus(ao)};document.addEventListener("focusin",wo),document.addEventListener("focusout",Eo);const Co=new MutationObserver($o);return ao&&Co.observe(ao,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",wo),document.removeEventListener("focusout",Eo),Co.disconnect()}}},[ro,ao,go.paused]),reactExports.useEffect(()=>{if(ao){focusScopesStack.add(go);const wo=document.activeElement;if(!ao.contains(wo)){const $o=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS$1);ao.addEventListener(AUTOFOCUS_ON_MOUNT,co),ao.dispatchEvent($o),$o.defaultPrevented||(focusFirst$2(removeLinks(getTabbableCandidates(ao)),{select:!0}),document.activeElement===wo&&focus(ao))}return()=>{ao.removeEventListener(AUTOFOCUS_ON_MOUNT,co),setTimeout(()=>{const $o=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS$1);ao.addEventListener(AUTOFOCUS_ON_UNMOUNT,lo),ao.dispatchEvent($o),$o.defaultPrevented||focus(wo??document.body,{select:!0}),ao.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lo),focusScopesStack.remove(go)},0)}}},[ao,co,lo,go]);const bo=reactExports.useCallback(wo=>{if(!to&&!ro||go.paused)return;const Eo=wo.key==="Tab"&&!wo.altKey&&!wo.ctrlKey&&!wo.metaKey,$o=document.activeElement;if(Eo&&$o){const Co=wo.currentTarget,[Ro,Oo]=getTabbableEdges(Co);Ro&&Oo?!wo.shiftKey&&$o===Oo?(wo.preventDefault(),to&&focus(Ro,{select:!0})):wo.shiftKey&&$o===Ro&&(wo.preventDefault(),to&&focus(Oo,{select:!0})):$o===Co&&wo.preventDefault()}},[to,ro,go.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...oo,ref:ho,onKeyDown:bo})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst$2(Xr,{select:eo=!1}={}){const to=document.activeElement;for(const ro of Xr)if(focus(ro,{select:eo}),document.activeElement!==to)return}function getTabbableEdges(Xr){const eo=getTabbableCandidates(Xr),to=findVisible(eo,Xr),ro=findVisible(eo.reverse(),Xr);return[to,ro]}function getTabbableCandidates(Xr){const eo=[],to=document.createTreeWalker(Xr,NodeFilter.SHOW_ELEMENT,{acceptNode:ro=>{const no=ro.tagName==="INPUT"&&ro.type==="hidden";return ro.disabled||ro.hidden||no?NodeFilter.FILTER_SKIP:ro.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;to.nextNode();)eo.push(to.currentNode);return eo}function findVisible(Xr,eo){for(const to of Xr)if(!isHidden$1(to,{upTo:eo}))return to}function isHidden$1(Xr,{upTo:eo}){if(getComputedStyle(Xr).visibility==="hidden")return!0;for(;Xr;){if(eo!==void 0&&Xr===eo)return!1;if(getComputedStyle(Xr).display==="none")return!0;Xr=Xr.parentElement}return!1}function isSelectableInput(Xr){return Xr instanceof HTMLInputElement&&"select"in Xr}function focus(Xr,{select:eo=!1}={}){if(Xr&&Xr.focus){const to=document.activeElement;Xr.focus({preventScroll:!0}),Xr!==to&&isSelectableInput(Xr)&&eo&&Xr.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let Xr=[];return{add(eo){const to=Xr[0];eo!==to&&(to==null||to.pause()),Xr=arrayRemove(Xr,eo),Xr.unshift(eo)},remove(eo){var to;Xr=arrayRemove(Xr,eo),(to=Xr[0])==null||to.resume()}}}function arrayRemove(Xr,eo){const to=[...Xr],ro=to.indexOf(eo);return ro!==-1&&to.splice(ro,1),to}function removeLinks(Xr){return Xr.filter(eo=>eo.tagName!=="A")}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count=0;function useId$1(Xr){const[eo,to]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{Xr||to(ro=>ro??String(count++))},[Xr]),Xr||(eo?`radix-${eo}`:"")}const sides=["top","right","bottom","left"],min=Math.min,max=Math.max,round=Math.round,floor=Math.floor,createCoords=Xr=>({x:Xr,y:Xr}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp(Xr,eo,to){return max(Xr,min(eo,to))}function evaluate(Xr,eo){return typeof Xr=="function"?Xr(eo):Xr}function getSide(Xr){return Xr.split("-")[0]}function getAlignment(Xr){return Xr.split("-")[1]}function getOppositeAxis(Xr){return Xr==="x"?"y":"x"}function getAxisLength(Xr){return Xr==="y"?"height":"width"}function getSideAxis(Xr){return["top","bottom"].includes(getSide(Xr))?"y":"x"}function getAlignmentAxis(Xr){return getOppositeAxis(getSideAxis(Xr))}function getAlignmentSides(Xr,eo,to){to===void 0&&(to=!1);const ro=getAlignment(Xr),no=getAlignmentAxis(Xr),io=getAxisLength(no);let oo=no==="x"?ro===(to?"end":"start")?"right":"left":ro==="start"?"bottom":"top";return eo.reference[io]>eo.floating[io]&&(oo=getOppositePlacement(oo)),[oo,getOppositePlacement(oo)]}function getExpandedPlacements(Xr){const eo=getOppositePlacement(Xr);return[getOppositeAlignmentPlacement(Xr),eo,getOppositeAlignmentPlacement(eo)]}function getOppositeAlignmentPlacement(Xr){return Xr.replace(/start|end/g,eo=>oppositeAlignmentMap[eo])}function getSideList(Xr,eo,to){const ro=["left","right"],no=["right","left"],io=["top","bottom"],oo=["bottom","top"];switch(Xr){case"top":case"bottom":return to?eo?no:ro:eo?ro:no;case"left":case"right":return eo?io:oo;default:return[]}}function getOppositeAxisPlacements(Xr,eo,to,ro){const no=getAlignment(Xr);let io=getSideList(getSide(Xr),to==="start",ro);return no&&(io=io.map(oo=>oo+"-"+no),eo&&(io=io.concat(io.map(getOppositeAlignmentPlacement)))),io}function getOppositePlacement(Xr){return Xr.replace(/left|right|bottom|top/g,eo=>oppositeSideMap[eo])}function expandPaddingObject(Xr){return{top:0,right:0,bottom:0,left:0,...Xr}}function getPaddingObject(Xr){return typeof Xr!="number"?expandPaddingObject(Xr):{top:Xr,right:Xr,bottom:Xr,left:Xr}}function rectToClientRect(Xr){const{x:eo,y:to,width:ro,height:no}=Xr;return{width:ro,height:no,top:to,left:eo,right:eo+ro,bottom:to+no,x:eo,y:to}}function computeCoordsFromPlacement(Xr,eo,to){let{reference:ro,floating:no}=Xr;const io=getSideAxis(eo),oo=getAlignmentAxis(eo),ao=getAxisLength(oo),so=getSide(eo),co=io==="y",lo=ro.x+ro.width/2-no.width/2,uo=ro.y+ro.height/2-no.height/2,ho=ro[ao]/2-no[ao]/2;let go;switch(so){case"top":go={x:lo,y:ro.y-no.height};break;case"bottom":go={x:lo,y:ro.y+ro.height};break;case"right":go={x:ro.x+ro.width,y:uo};break;case"left":go={x:ro.x-no.width,y:uo};break;default:go={x:ro.x,y:ro.y}}switch(getAlignment(eo)){case"start":go[oo]-=ho*(to&&co?-1:1);break;case"end":go[oo]+=ho*(to&&co?-1:1);break}return go}const computePosition$1=async(Xr,eo,to)=>{const{placement:ro="bottom",strategy:no="absolute",middleware:io=[],platform:oo}=to,ao=io.filter(Boolean),so=await(oo.isRTL==null?void 0:oo.isRTL(eo));let co=await oo.getElementRects({reference:Xr,floating:eo,strategy:no}),{x:lo,y:uo}=computeCoordsFromPlacement(co,ro,so),ho=ro,go={},bo=0;for(let wo=0;wo({name:"arrow",options:Xr,async fn(eo){const{x:to,y:ro,placement:no,rects:io,platform:oo,elements:ao,middlewareData:so}=eo,{element:co,padding:lo=0}=evaluate(Xr,eo)||{};if(co==null)return{};const uo=getPaddingObject(lo),ho={x:to,y:ro},go=getAlignmentAxis(no),bo=getAxisLength(go),wo=await oo.getDimensions(co),Eo=go==="y",$o=Eo?"top":"left",Co=Eo?"bottom":"right",Ro=Eo?"clientHeight":"clientWidth",Oo=io.reference[bo]+io.reference[go]-ho[go]-io.floating[bo],jo=ho[go]-io.reference[go],Bo=await(oo.getOffsetParent==null?void 0:oo.getOffsetParent(co));let Mo=Bo?Bo[Ro]:0;(!Mo||!await(oo.isElement==null?void 0:oo.isElement(Bo)))&&(Mo=ao.floating[Ro]||io.floating[bo]);const Fo=Oo/2-jo/2,Wo=Mo/2-wo[bo]/2-1,Jo=min(uo[$o],Wo),Po=min(uo[Co],Wo),fo=Jo,yo=Mo-wo[bo]-Po,vo=Mo/2-wo[bo]/2+Fo,_o=clamp(fo,vo,yo),So=!so.arrow&&getAlignment(no)!=null&&vo!==_o&&io.reference[bo]/2-(vovo<=0)){var Po,fo;const vo=(((Po=io.flip)==null?void 0:Po.index)||0)+1,_o=Mo[vo];if(_o)return{data:{index:vo,overflows:Jo},reset:{placement:_o}};let So=(fo=Jo.filter(To=>To.overflows[0]<=0).sort((To,Ao)=>To.overflows[1]-Ao.overflows[1])[0])==null?void 0:fo.placement;if(!So)switch(go){case"bestFit":{var yo;const To=(yo=Jo.filter(Ao=>{if(Bo){const ko=getSideAxis(Ao.placement);return ko===Co||ko==="y"}return!0}).map(Ao=>[Ao.placement,Ao.overflows.filter(ko=>ko>0).reduce((ko,mo)=>ko+mo,0)]).sort((Ao,ko)=>Ao[1]-ko[1])[0])==null?void 0:yo[0];To&&(So=To);break}case"initialPlacement":So=ao;break}if(no!==So)return{reset:{placement:So}}}return{}}}};function getSideOffsets(Xr,eo){return{top:Xr.top-eo.height,right:Xr.right-eo.width,bottom:Xr.bottom-eo.height,left:Xr.left-eo.width}}function isAnySideFullyClipped(Xr){return sides.some(eo=>Xr[eo]>=0)}const hide$2=function(Xr){return Xr===void 0&&(Xr={}),{name:"hide",options:Xr,async fn(eo){const{rects:to}=eo,{strategy:ro="referenceHidden",...no}=evaluate(Xr,eo);switch(ro){case"referenceHidden":{const io=await detectOverflow(eo,{...no,elementContext:"reference"}),oo=getSideOffsets(io,to.reference);return{data:{referenceHiddenOffsets:oo,referenceHidden:isAnySideFullyClipped(oo)}}}case"escaped":{const io=await detectOverflow(eo,{...no,altBoundary:!0}),oo=getSideOffsets(io,to.floating);return{data:{escapedOffsets:oo,escaped:isAnySideFullyClipped(oo)}}}default:return{}}}}};async function convertValueToCoords(Xr,eo){const{placement:to,platform:ro,elements:no}=Xr,io=await(ro.isRTL==null?void 0:ro.isRTL(no.floating)),oo=getSide(to),ao=getAlignment(to),so=getSideAxis(to)==="y",co=["left","top"].includes(oo)?-1:1,lo=io&&so?-1:1,uo=evaluate(eo,Xr);let{mainAxis:ho,crossAxis:go,alignmentAxis:bo}=typeof uo=="number"?{mainAxis:uo,crossAxis:0,alignmentAxis:null}:{mainAxis:uo.mainAxis||0,crossAxis:uo.crossAxis||0,alignmentAxis:uo.alignmentAxis};return ao&&typeof bo=="number"&&(go=ao==="end"?bo*-1:bo),so?{x:go*lo,y:ho*co}:{x:ho*co,y:go*lo}}const offset$3=function(Xr){return Xr===void 0&&(Xr=0),{name:"offset",options:Xr,async fn(eo){var to,ro;const{x:no,y:io,placement:oo,middlewareData:ao}=eo,so=await convertValueToCoords(eo,Xr);return oo===((to=ao.offset)==null?void 0:to.placement)&&(ro=ao.arrow)!=null&&ro.alignmentOffset?{}:{x:no+so.x,y:io+so.y,data:{...so,placement:oo}}}}},shift$2=function(Xr){return Xr===void 0&&(Xr={}),{name:"shift",options:Xr,async fn(eo){const{x:to,y:ro,placement:no}=eo,{mainAxis:io=!0,crossAxis:oo=!1,limiter:ao={fn:Eo=>{let{x:$o,y:Co}=Eo;return{x:$o,y:Co}}},...so}=evaluate(Xr,eo),co={x:to,y:ro},lo=await detectOverflow(eo,so),uo=getSideAxis(getSide(no)),ho=getOppositeAxis(uo);let go=co[ho],bo=co[uo];if(io){const Eo=ho==="y"?"top":"left",$o=ho==="y"?"bottom":"right",Co=go+lo[Eo],Ro=go-lo[$o];go=clamp(Co,go,Ro)}if(oo){const Eo=uo==="y"?"top":"left",$o=uo==="y"?"bottom":"right",Co=bo+lo[Eo],Ro=bo-lo[$o];bo=clamp(Co,bo,Ro)}const wo=ao.fn({...eo,[ho]:go,[uo]:bo});return{...wo,data:{x:wo.x-to,y:wo.y-ro,enabled:{[ho]:io,[uo]:oo}}}}}},limitShift$2=function(Xr){return Xr===void 0&&(Xr={}),{options:Xr,fn(eo){const{x:to,y:ro,placement:no,rects:io,middlewareData:oo}=eo,{offset:ao=0,mainAxis:so=!0,crossAxis:co=!0}=evaluate(Xr,eo),lo={x:to,y:ro},uo=getSideAxis(no),ho=getOppositeAxis(uo);let go=lo[ho],bo=lo[uo];const wo=evaluate(ao,eo),Eo=typeof wo=="number"?{mainAxis:wo,crossAxis:0}:{mainAxis:0,crossAxis:0,...wo};if(so){const Ro=ho==="y"?"height":"width",Oo=io.reference[ho]-io.floating[Ro]+Eo.mainAxis,jo=io.reference[ho]+io.reference[Ro]-Eo.mainAxis;gojo&&(go=jo)}if(co){var $o,Co;const Ro=ho==="y"?"width":"height",Oo=["top","left"].includes(getSide(no)),jo=io.reference[uo]-io.floating[Ro]+(Oo&&(($o=oo.offset)==null?void 0:$o[uo])||0)+(Oo?0:Eo.crossAxis),Bo=io.reference[uo]+io.reference[Ro]+(Oo?0:((Co=oo.offset)==null?void 0:Co[uo])||0)-(Oo?Eo.crossAxis:0);boBo&&(bo=Bo)}return{[ho]:go,[uo]:bo}}}},size$4=function(Xr){return Xr===void 0&&(Xr={}),{name:"size",options:Xr,async fn(eo){var to,ro;const{placement:no,rects:io,platform:oo,elements:ao}=eo,{apply:so=()=>{},...co}=evaluate(Xr,eo),lo=await detectOverflow(eo,co),uo=getSide(no),ho=getAlignment(no),go=getSideAxis(no)==="y",{width:bo,height:wo}=io.floating;let Eo,$o;uo==="top"||uo==="bottom"?(Eo=uo,$o=ho===(await(oo.isRTL==null?void 0:oo.isRTL(ao.floating))?"start":"end")?"left":"right"):($o=uo,Eo=ho==="end"?"top":"bottom");const Co=wo-lo.top-lo.bottom,Ro=bo-lo.left-lo.right,Oo=min(wo-lo[Eo],Co),jo=min(bo-lo[$o],Ro),Bo=!eo.middlewareData.shift;let Mo=Oo,Fo=jo;if((to=eo.middlewareData.shift)!=null&&to.enabled.x&&(Fo=Ro),(ro=eo.middlewareData.shift)!=null&&ro.enabled.y&&(Mo=Co),Bo&&!ho){const Jo=max(lo.left,0),Po=max(lo.right,0),fo=max(lo.top,0),yo=max(lo.bottom,0);go?Fo=bo-2*(Jo!==0||Po!==0?Jo+Po:max(lo.left,lo.right)):Mo=wo-2*(fo!==0||yo!==0?fo+yo:max(lo.top,lo.bottom))}await so({...eo,availableWidth:Fo,availableHeight:Mo});const Wo=await oo.getDimensions(ao.floating);return bo!==Wo.width||wo!==Wo.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(Xr){return isNode$1(Xr)?(Xr.nodeName||"").toLowerCase():"#document"}function getWindow(Xr){var eo;return(Xr==null||(eo=Xr.ownerDocument)==null?void 0:eo.defaultView)||window}function getDocumentElement(Xr){var eo;return(eo=(isNode$1(Xr)?Xr.ownerDocument:Xr.document)||window.document)==null?void 0:eo.documentElement}function isNode$1(Xr){return hasWindow()?Xr instanceof Node||Xr instanceof getWindow(Xr).Node:!1}function isElement(Xr){return hasWindow()?Xr instanceof Element||Xr instanceof getWindow(Xr).Element:!1}function isHTMLElement(Xr){return hasWindow()?Xr instanceof HTMLElement||Xr instanceof getWindow(Xr).HTMLElement:!1}function isShadowRoot(Xr){return!hasWindow()||typeof ShadowRoot>"u"?!1:Xr instanceof ShadowRoot||Xr instanceof getWindow(Xr).ShadowRoot}function isOverflowElement(Xr){const{overflow:eo,overflowX:to,overflowY:ro,display:no}=getComputedStyle$2(Xr);return/auto|scroll|overlay|hidden|clip/.test(eo+ro+to)&&!["inline","contents"].includes(no)}function isTableElement(Xr){return["table","td","th"].includes(getNodeName(Xr))}function isTopLayer(Xr){return[":popover-open",":modal"].some(eo=>{try{return Xr.matches(eo)}catch{return!1}})}function isContainingBlock(Xr){const eo=isWebKit(),to=isElement(Xr)?getComputedStyle$2(Xr):Xr;return to.transform!=="none"||to.perspective!=="none"||(to.containerType?to.containerType!=="normal":!1)||!eo&&(to.backdropFilter?to.backdropFilter!=="none":!1)||!eo&&(to.filter?to.filter!=="none":!1)||["transform","perspective","filter"].some(ro=>(to.willChange||"").includes(ro))||["paint","layout","strict","content"].some(ro=>(to.contain||"").includes(ro))}function getContainingBlock(Xr){let eo=getParentNode$1(Xr);for(;isHTMLElement(eo)&&!isLastTraversableNode(eo);){if(isContainingBlock(eo))return eo;if(isTopLayer(eo))return null;eo=getParentNode$1(eo)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(Xr){return["html","body","#document"].includes(getNodeName(Xr))}function getComputedStyle$2(Xr){return getWindow(Xr).getComputedStyle(Xr)}function getNodeScroll(Xr){return isElement(Xr)?{scrollLeft:Xr.scrollLeft,scrollTop:Xr.scrollTop}:{scrollLeft:Xr.scrollX,scrollTop:Xr.scrollY}}function getParentNode$1(Xr){if(getNodeName(Xr)==="html")return Xr;const eo=Xr.assignedSlot||Xr.parentNode||isShadowRoot(Xr)&&Xr.host||getDocumentElement(Xr);return isShadowRoot(eo)?eo.host:eo}function getNearestOverflowAncestor(Xr){const eo=getParentNode$1(Xr);return isLastTraversableNode(eo)?Xr.ownerDocument?Xr.ownerDocument.body:Xr.body:isHTMLElement(eo)&&isOverflowElement(eo)?eo:getNearestOverflowAncestor(eo)}function getOverflowAncestors(Xr,eo,to){var ro;eo===void 0&&(eo=[]),to===void 0&&(to=!0);const no=getNearestOverflowAncestor(Xr),io=no===((ro=Xr.ownerDocument)==null?void 0:ro.body),oo=getWindow(no);if(io){const ao=getFrameElement(oo);return eo.concat(oo,oo.visualViewport||[],isOverflowElement(no)?no:[],ao&&to?getOverflowAncestors(ao):[])}return eo.concat(no,getOverflowAncestors(no,[],to))}function getFrameElement(Xr){return Xr.parent&&Object.getPrototypeOf(Xr.parent)?Xr.frameElement:null}function getCssDimensions(Xr){const eo=getComputedStyle$2(Xr);let to=parseFloat(eo.width)||0,ro=parseFloat(eo.height)||0;const no=isHTMLElement(Xr),io=no?Xr.offsetWidth:to,oo=no?Xr.offsetHeight:ro,ao=round(to)!==io||round(ro)!==oo;return ao&&(to=io,ro=oo),{width:to,height:ro,$:ao}}function unwrapElement(Xr){return isElement(Xr)?Xr:Xr.contextElement}function getScale(Xr){const eo=unwrapElement(Xr);if(!isHTMLElement(eo))return createCoords(1);const to=eo.getBoundingClientRect(),{width:ro,height:no,$:io}=getCssDimensions(eo);let oo=(io?round(to.width):to.width)/ro,ao=(io?round(to.height):to.height)/no;return(!oo||!Number.isFinite(oo))&&(oo=1),(!ao||!Number.isFinite(ao))&&(ao=1),{x:oo,y:ao}}const noOffsets=createCoords(0);function getVisualOffsets(Xr){const eo=getWindow(Xr);return!isWebKit()||!eo.visualViewport?noOffsets:{x:eo.visualViewport.offsetLeft,y:eo.visualViewport.offsetTop}}function shouldAddVisualOffsets(Xr,eo,to){return eo===void 0&&(eo=!1),!to||eo&&to!==getWindow(Xr)?!1:eo}function getBoundingClientRect(Xr,eo,to,ro){eo===void 0&&(eo=!1),to===void 0&&(to=!1);const no=Xr.getBoundingClientRect(),io=unwrapElement(Xr);let oo=createCoords(1);eo&&(ro?isElement(ro)&&(oo=getScale(ro)):oo=getScale(Xr));const ao=shouldAddVisualOffsets(io,to,ro)?getVisualOffsets(io):createCoords(0);let so=(no.left+ao.x)/oo.x,co=(no.top+ao.y)/oo.y,lo=no.width/oo.x,uo=no.height/oo.y;if(io){const ho=getWindow(io),go=ro&&isElement(ro)?getWindow(ro):ro;let bo=ho,wo=getFrameElement(bo);for(;wo&&ro&&go!==bo;){const Eo=getScale(wo),$o=wo.getBoundingClientRect(),Co=getComputedStyle$2(wo),Ro=$o.left+(wo.clientLeft+parseFloat(Co.paddingLeft))*Eo.x,Oo=$o.top+(wo.clientTop+parseFloat(Co.paddingTop))*Eo.y;so*=Eo.x,co*=Eo.y,lo*=Eo.x,uo*=Eo.y,so+=Ro,co+=Oo,bo=getWindow(wo),wo=getFrameElement(bo)}}return rectToClientRect({width:lo,height:uo,x:so,y:co})}function getWindowScrollBarX(Xr,eo){const to=getNodeScroll(Xr).scrollLeft;return eo?eo.left+to:getBoundingClientRect(getDocumentElement(Xr)).left+to}function getHTMLOffset(Xr,eo,to){to===void 0&&(to=!1);const ro=Xr.getBoundingClientRect(),no=ro.left+eo.scrollLeft-(to?0:getWindowScrollBarX(Xr,ro)),io=ro.top+eo.scrollTop;return{x:no,y:io}}function convertOffsetParentRelativeRectToViewportRelativeRect(Xr){let{elements:eo,rect:to,offsetParent:ro,strategy:no}=Xr;const io=no==="fixed",oo=getDocumentElement(ro),ao=eo?isTopLayer(eo.floating):!1;if(ro===oo||ao&&io)return to;let so={scrollLeft:0,scrollTop:0},co=createCoords(1);const lo=createCoords(0),uo=isHTMLElement(ro);if((uo||!uo&&!io)&&((getNodeName(ro)!=="body"||isOverflowElement(oo))&&(so=getNodeScroll(ro)),isHTMLElement(ro))){const go=getBoundingClientRect(ro);co=getScale(ro),lo.x=go.x+ro.clientLeft,lo.y=go.y+ro.clientTop}const ho=oo&&!uo&&!io?getHTMLOffset(oo,so,!0):createCoords(0);return{width:to.width*co.x,height:to.height*co.y,x:to.x*co.x-so.scrollLeft*co.x+lo.x+ho.x,y:to.y*co.y-so.scrollTop*co.y+lo.y+ho.y}}function getClientRects(Xr){return Array.from(Xr.getClientRects())}function getDocumentRect(Xr){const eo=getDocumentElement(Xr),to=getNodeScroll(Xr),ro=Xr.ownerDocument.body,no=max(eo.scrollWidth,eo.clientWidth,ro.scrollWidth,ro.clientWidth),io=max(eo.scrollHeight,eo.clientHeight,ro.scrollHeight,ro.clientHeight);let oo=-to.scrollLeft+getWindowScrollBarX(Xr);const ao=-to.scrollTop;return getComputedStyle$2(ro).direction==="rtl"&&(oo+=max(eo.clientWidth,ro.clientWidth)-no),{width:no,height:io,x:oo,y:ao}}function getViewportRect(Xr,eo){const to=getWindow(Xr),ro=getDocumentElement(Xr),no=to.visualViewport;let io=ro.clientWidth,oo=ro.clientHeight,ao=0,so=0;if(no){io=no.width,oo=no.height;const co=isWebKit();(!co||co&&eo==="fixed")&&(ao=no.offsetLeft,so=no.offsetTop)}return{width:io,height:oo,x:ao,y:so}}function getInnerBoundingClientRect(Xr,eo){const to=getBoundingClientRect(Xr,!0,eo==="fixed"),ro=to.top+Xr.clientTop,no=to.left+Xr.clientLeft,io=isHTMLElement(Xr)?getScale(Xr):createCoords(1),oo=Xr.clientWidth*io.x,ao=Xr.clientHeight*io.y,so=no*io.x,co=ro*io.y;return{width:oo,height:ao,x:so,y:co}}function getClientRectFromClippingAncestor(Xr,eo,to){let ro;if(eo==="viewport")ro=getViewportRect(Xr,to);else if(eo==="document")ro=getDocumentRect(getDocumentElement(Xr));else if(isElement(eo))ro=getInnerBoundingClientRect(eo,to);else{const no=getVisualOffsets(Xr);ro={x:eo.x-no.x,y:eo.y-no.y,width:eo.width,height:eo.height}}return rectToClientRect(ro)}function hasFixedPositionAncestor(Xr,eo){const to=getParentNode$1(Xr);return to===eo||!isElement(to)||isLastTraversableNode(to)?!1:getComputedStyle$2(to).position==="fixed"||hasFixedPositionAncestor(to,eo)}function getClippingElementAncestors(Xr,eo){const to=eo.get(Xr);if(to)return to;let ro=getOverflowAncestors(Xr,[],!1).filter(ao=>isElement(ao)&&getNodeName(ao)!=="body"),no=null;const io=getComputedStyle$2(Xr).position==="fixed";let oo=io?getParentNode$1(Xr):Xr;for(;isElement(oo)&&!isLastTraversableNode(oo);){const ao=getComputedStyle$2(oo),so=isContainingBlock(oo);!so&&ao.position==="fixed"&&(no=null),(io?!so&&!no:!so&&ao.position==="static"&&!!no&&["absolute","fixed"].includes(no.position)||isOverflowElement(oo)&&!so&&hasFixedPositionAncestor(Xr,oo))?ro=ro.filter(lo=>lo!==oo):no=ao,oo=getParentNode$1(oo)}return eo.set(Xr,ro),ro}function getClippingRect(Xr){let{element:eo,boundary:to,rootBoundary:ro,strategy:no}=Xr;const oo=[...to==="clippingAncestors"?isTopLayer(eo)?[]:getClippingElementAncestors(eo,this._c):[].concat(to),ro],ao=oo[0],so=oo.reduce((co,lo)=>{const uo=getClientRectFromClippingAncestor(eo,lo,no);return co.top=max(uo.top,co.top),co.right=min(uo.right,co.right),co.bottom=min(uo.bottom,co.bottom),co.left=max(uo.left,co.left),co},getClientRectFromClippingAncestor(eo,ao,no));return{width:so.right-so.left,height:so.bottom-so.top,x:so.left,y:so.top}}function getDimensions(Xr){const{width:eo,height:to}=getCssDimensions(Xr);return{width:eo,height:to}}function getRectRelativeToOffsetParent(Xr,eo,to){const ro=isHTMLElement(eo),no=getDocumentElement(eo),io=to==="fixed",oo=getBoundingClientRect(Xr,!0,io,eo);let ao={scrollLeft:0,scrollTop:0};const so=createCoords(0);if(ro||!ro&&!io)if((getNodeName(eo)!=="body"||isOverflowElement(no))&&(ao=getNodeScroll(eo)),ro){const ho=getBoundingClientRect(eo,!0,io,eo);so.x=ho.x+eo.clientLeft,so.y=ho.y+eo.clientTop}else no&&(so.x=getWindowScrollBarX(no));const co=no&&!ro&&!io?getHTMLOffset(no,ao):createCoords(0),lo=oo.left+ao.scrollLeft-so.x-co.x,uo=oo.top+ao.scrollTop-so.y-co.y;return{x:lo,y:uo,width:oo.width,height:oo.height}}function isStaticPositioned(Xr){return getComputedStyle$2(Xr).position==="static"}function getTrueOffsetParent(Xr,eo){if(!isHTMLElement(Xr)||getComputedStyle$2(Xr).position==="fixed")return null;if(eo)return eo(Xr);let to=Xr.offsetParent;return getDocumentElement(Xr)===to&&(to=to.ownerDocument.body),to}function getOffsetParent(Xr,eo){const to=getWindow(Xr);if(isTopLayer(Xr))return to;if(!isHTMLElement(Xr)){let no=getParentNode$1(Xr);for(;no&&!isLastTraversableNode(no);){if(isElement(no)&&!isStaticPositioned(no))return no;no=getParentNode$1(no)}return to}let ro=getTrueOffsetParent(Xr,eo);for(;ro&&isTableElement(ro)&&isStaticPositioned(ro);)ro=getTrueOffsetParent(ro,eo);return ro&&isLastTraversableNode(ro)&&isStaticPositioned(ro)&&!isContainingBlock(ro)?to:ro||getContainingBlock(Xr)||to}const getElementRects=async function(Xr){const eo=this.getOffsetParent||getOffsetParent,to=this.getDimensions,ro=await to(Xr.floating);return{reference:getRectRelativeToOffsetParent(Xr.reference,await eo(Xr.floating),Xr.strategy),floating:{x:0,y:0,width:ro.width,height:ro.height}}};function isRTL(Xr){return getComputedStyle$2(Xr).direction==="rtl"}const platform$3={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function observeMove(Xr,eo){let to=null,ro;const no=getDocumentElement(Xr);function io(){var ao;clearTimeout(ro),(ao=to)==null||ao.disconnect(),to=null}function oo(ao,so){ao===void 0&&(ao=!1),so===void 0&&(so=1),io();const{left:co,top:lo,width:uo,height:ho}=Xr.getBoundingClientRect();if(ao||eo(),!uo||!ho)return;const go=floor(lo),bo=floor(no.clientWidth-(co+uo)),wo=floor(no.clientHeight-(lo+ho)),Eo=floor(co),Co={rootMargin:-go+"px "+-bo+"px "+-wo+"px "+-Eo+"px",threshold:max(0,min(1,so))||1};let Ro=!0;function Oo(jo){const Bo=jo[0].intersectionRatio;if(Bo!==so){if(!Ro)return oo();Bo?oo(!1,Bo):ro=setTimeout(()=>{oo(!1,1e-7)},1e3)}Ro=!1}try{to=new IntersectionObserver(Oo,{...Co,root:no.ownerDocument})}catch{to=new IntersectionObserver(Oo,Co)}to.observe(Xr)}return oo(!0),io}function autoUpdate(Xr,eo,to,ro){ro===void 0&&(ro={});const{ancestorScroll:no=!0,ancestorResize:io=!0,elementResize:oo=typeof ResizeObserver=="function",layoutShift:ao=typeof IntersectionObserver=="function",animationFrame:so=!1}=ro,co=unwrapElement(Xr),lo=no||io?[...co?getOverflowAncestors(co):[],...getOverflowAncestors(eo)]:[];lo.forEach($o=>{no&&$o.addEventListener("scroll",to,{passive:!0}),io&&$o.addEventListener("resize",to)});const uo=co&&ao?observeMove(co,to):null;let ho=-1,go=null;oo&&(go=new ResizeObserver($o=>{let[Co]=$o;Co&&Co.target===co&&go&&(go.unobserve(eo),cancelAnimationFrame(ho),ho=requestAnimationFrame(()=>{var Ro;(Ro=go)==null||Ro.observe(eo)})),to()}),co&&!so&&go.observe(co),go.observe(eo));let bo,wo=so?getBoundingClientRect(Xr):null;so&&Eo();function Eo(){const $o=getBoundingClientRect(Xr);wo&&($o.x!==wo.x||$o.y!==wo.y||$o.width!==wo.width||$o.height!==wo.height)&&to(),wo=$o,bo=requestAnimationFrame(Eo)}return to(),()=>{var $o;lo.forEach(Co=>{no&&Co.removeEventListener("scroll",to),io&&Co.removeEventListener("resize",to)}),uo==null||uo(),($o=go)==null||$o.disconnect(),go=null,so&&cancelAnimationFrame(bo)}}const offset$2=offset$3,shift$1=shift$2,flip$1=flip$2,size$3=size$4,hide$1=hide$2,arrow$2=arrow$3,limitShift$1=limitShift$2,computePosition=(Xr,eo,to)=>{const ro=new Map,no={platform:platform$3,...to},io={...no.platform,_c:ro};return computePosition$1(Xr,eo,{...no,platform:io})};var index$2=typeof document<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function deepEqual(Xr,eo){if(Xr===eo)return!0;if(typeof Xr!=typeof eo)return!1;if(typeof Xr=="function"&&Xr.toString()===eo.toString())return!0;let to,ro,no;if(Xr&&eo&&typeof Xr=="object"){if(Array.isArray(Xr)){if(to=Xr.length,to!==eo.length)return!1;for(ro=to;ro--!==0;)if(!deepEqual(Xr[ro],eo[ro]))return!1;return!0}if(no=Object.keys(Xr),to=no.length,to!==Object.keys(eo).length)return!1;for(ro=to;ro--!==0;)if(!{}.hasOwnProperty.call(eo,no[ro]))return!1;for(ro=to;ro--!==0;){const io=no[ro];if(!(io==="_owner"&&Xr.$$typeof)&&!deepEqual(Xr[io],eo[io]))return!1}return!0}return Xr!==Xr&&eo!==eo}function getDPR(Xr){return typeof window>"u"?1:(Xr.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(Xr,eo){const to=getDPR(Xr);return Math.round(eo*to)/to}function useLatestRef(Xr){const eo=reactExports.useRef(Xr);return index$2(()=>{eo.current=Xr}),eo}function useFloating(Xr){Xr===void 0&&(Xr={});const{placement:eo="bottom",strategy:to="absolute",middleware:ro=[],platform:no,elements:{reference:io,floating:oo}={},transform:ao=!0,whileElementsMounted:so,open:co}=Xr,[lo,uo]=reactExports.useState({x:0,y:0,strategy:to,placement:eo,middlewareData:{},isPositioned:!1}),[ho,go]=reactExports.useState(ro);deepEqual(ho,ro)||go(ro);const[bo,wo]=reactExports.useState(null),[Eo,$o]=reactExports.useState(null),Co=reactExports.useCallback(Ao=>{Ao!==Bo.current&&(Bo.current=Ao,wo(Ao))},[]),Ro=reactExports.useCallback(Ao=>{Ao!==Mo.current&&(Mo.current=Ao,$o(Ao))},[]),Oo=io||bo,jo=oo||Eo,Bo=reactExports.useRef(null),Mo=reactExports.useRef(null),Fo=reactExports.useRef(lo),Wo=so!=null,Jo=useLatestRef(so),Po=useLatestRef(no),fo=useLatestRef(co),yo=reactExports.useCallback(()=>{if(!Bo.current||!Mo.current)return;const Ao={placement:eo,strategy:to,middleware:ho};Po.current&&(Ao.platform=Po.current),computePosition(Bo.current,Mo.current,Ao).then(ko=>{const mo={...ko,isPositioned:fo.current!==!1};vo.current&&!deepEqual(Fo.current,mo)&&(Fo.current=mo,reactDomExports.flushSync(()=>{uo(mo)}))})},[ho,eo,to,Po,fo]);index$2(()=>{co===!1&&Fo.current.isPositioned&&(Fo.current.isPositioned=!1,uo(Ao=>({...Ao,isPositioned:!1})))},[co]);const vo=reactExports.useRef(!1);index$2(()=>(vo.current=!0,()=>{vo.current=!1}),[]),index$2(()=>{if(Oo&&(Bo.current=Oo),jo&&(Mo.current=jo),Oo&&jo){if(Jo.current)return Jo.current(Oo,jo,yo);yo()}},[Oo,jo,yo,Jo,Wo]);const _o=reactExports.useMemo(()=>({reference:Bo,floating:Mo,setReference:Co,setFloating:Ro}),[Co,Ro]),So=reactExports.useMemo(()=>({reference:Oo,floating:jo}),[Oo,jo]),To=reactExports.useMemo(()=>{const Ao={position:to,left:0,top:0};if(!So.floating)return Ao;const ko=roundByDPR(So.floating,lo.x),mo=roundByDPR(So.floating,lo.y);return ao?{...Ao,transform:"translate("+ko+"px, "+mo+"px)",...getDPR(So.floating)>=1.5&&{willChange:"transform"}}:{position:to,left:ko,top:mo}},[to,ao,So.floating,lo.x,lo.y]);return reactExports.useMemo(()=>({...lo,update:yo,refs:_o,elements:So,floatingStyles:To}),[lo,yo,_o,So,To])}const arrow$1=Xr=>{function eo(to){return{}.hasOwnProperty.call(to,"current")}return{name:"arrow",options:Xr,fn(to){const{element:ro,padding:no}=typeof Xr=="function"?Xr(to):Xr;return ro&&eo(ro)?ro.current!=null?arrow$2({element:ro.current,padding:no}).fn(to):{}:ro?arrow$2({element:ro,padding:no}).fn(to):{}}}},offset$1=(Xr,eo)=>({...offset$2(Xr),options:[Xr,eo]}),shift=(Xr,eo)=>({...shift$1(Xr),options:[Xr,eo]}),limitShift=(Xr,eo)=>({...limitShift$1(Xr),options:[Xr,eo]}),flip=(Xr,eo)=>({...flip$1(Xr),options:[Xr,eo]}),size$2=(Xr,eo)=>({...size$3(Xr),options:[Xr,eo]}),hide=(Xr,eo)=>({...hide$1(Xr),options:[Xr,eo]}),arrow=(Xr,eo)=>({...arrow$1(Xr),options:[Xr,eo]});var NAME$4="Arrow",Arrow$1=reactExports.forwardRef((Xr,eo)=>{const{children:to,width:ro=10,height:no=5,...io}=Xr;return jsxRuntimeExports.jsx(Primitive.svg,{...io,ref:eo,width:ro,height:no,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:Xr.asChild?to:jsxRuntimeExports.jsx("polygon",{points:"0,0 30,0 15,10"})})});Arrow$1.displayName=NAME$4;var Root$3=Arrow$1;function createContextScope$1(Xr,eo=[]){let to=[];function ro(io,oo){const ao=reactExports.createContext(oo),so=to.length;to=[...to,oo];function co(uo){const{scope:ho,children:go,...bo}=uo,wo=(ho==null?void 0:ho[Xr][so])||ao,Eo=reactExports.useMemo(()=>bo,Object.values(bo));return jsxRuntimeExports.jsx(wo.Provider,{value:Eo,children:go})}function lo(uo,ho){const go=(ho==null?void 0:ho[Xr][so])||ao,bo=reactExports.useContext(go);if(bo)return bo;if(oo!==void 0)return oo;throw new Error(`\`${uo}\` must be used within \`${io}\``)}return co.displayName=io+"Provider",[co,lo]}const no=()=>{const io=to.map(oo=>reactExports.createContext(oo));return function(ao){const so=(ao==null?void 0:ao[Xr])||io;return reactExports.useMemo(()=>({[`__scope${Xr}`]:{...ao,[Xr]:so}}),[ao,so])}};return no.scopeName=Xr,[ro,composeContextScopes$1(no,...eo)]}function composeContextScopes$1(...Xr){const eo=Xr[0];if(Xr.length===1)return eo;const to=()=>{const ro=Xr.map(no=>({useScope:no(),scopeName:no.scopeName}));return function(io){const oo=ro.reduce((ao,{useScope:so,scopeName:co})=>{const uo=so(io)[`__scope${co}`];return{...ao,...uo}},{});return reactExports.useMemo(()=>({[`__scope${eo.scopeName}`]:oo}),[oo])}};return to.scopeName=eo.scopeName,to}function useSize(Xr){const[eo,to]=reactExports.useState(void 0);return useLayoutEffect2(()=>{if(Xr){to({width:Xr.offsetWidth,height:Xr.offsetHeight});const ro=new ResizeObserver(no=>{if(!Array.isArray(no)||!no.length)return;const io=no[0];let oo,ao;if("borderBoxSize"in io){const so=io.borderBoxSize,co=Array.isArray(so)?so[0]:so;oo=co.inlineSize,ao=co.blockSize}else oo=Xr.offsetWidth,ao=Xr.offsetHeight;to({width:oo,height:ao})});return ro.observe(Xr,{box:"border-box"}),()=>ro.unobserve(Xr)}else to(void 0)},[Xr]),eo}var POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope$1(POPPER_NAME),[PopperProvider$1,usePopperContext]=createPopperContext(POPPER_NAME),Popper$1=Xr=>{const{__scopePopper:eo,children:to}=Xr,[ro,no]=reactExports.useState(null);return jsxRuntimeExports.jsx(PopperProvider$1,{scope:eo,anchor:ro,onAnchorChange:no,children:to})};Popper$1.displayName=POPPER_NAME;var ANCHOR_NAME$1="PopperAnchor",PopperAnchor=reactExports.forwardRef((Xr,eo)=>{const{__scopePopper:to,virtualRef:ro,...no}=Xr,io=usePopperContext(ANCHOR_NAME$1,to),oo=reactExports.useRef(null),ao=useComposedRefs$1(eo,oo);return reactExports.useEffect(()=>{io.onAnchorChange((ro==null?void 0:ro.current)||oo.current)}),ro?null:jsxRuntimeExports.jsx(Primitive.div,{...no,ref:ao})});PopperAnchor.displayName=ANCHOR_NAME$1;var CONTENT_NAME$4="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME$4),PopperContent$1=reactExports.forwardRef((Xr,eo)=>{var qo,Ko,Qo,zo,ga,$a;const{__scopePopper:to,side:ro="bottom",sideOffset:no=0,align:io="center",alignOffset:oo=0,arrowPadding:ao=0,avoidCollisions:so=!0,collisionBoundary:co=[],collisionPadding:lo=0,sticky:uo="partial",hideWhenDetached:ho=!1,updatePositionStrategy:go="optimized",onPlaced:bo,...wo}=Xr,Eo=usePopperContext(CONTENT_NAME$4,to),[$o,Co]=reactExports.useState(null),Ro=useComposedRefs$1(eo,Sl=>Co(Sl)),[Oo,jo]=reactExports.useState(null),Bo=useSize(Oo),Mo=(Bo==null?void 0:Bo.width)??0,Fo=(Bo==null?void 0:Bo.height)??0,Wo=ro+(io!=="center"?"-"+io:""),Jo=typeof lo=="number"?lo:{top:0,right:0,bottom:0,left:0,...lo},Po=Array.isArray(co)?co:[co],fo=Po.length>0,yo={padding:Jo,boundary:Po.filter(isNotNull),altBoundary:fo},{refs:vo,floatingStyles:_o,placement:So,isPositioned:To,middlewareData:Ao}=useFloating({strategy:"fixed",placement:Wo,whileElementsMounted:(...Sl)=>autoUpdate(...Sl,{animationFrame:go==="always"}),elements:{reference:Eo.anchor},middleware:[offset$1({mainAxis:no+Fo,alignmentAxis:oo}),so&&shift({mainAxis:!0,crossAxis:!1,limiter:uo==="partial"?limitShift():void 0,...yo}),so&&flip({...yo}),size$2({...yo,apply:({elements:Sl,rects:El,availableWidth:Tl,availableHeight:Il})=>{const{width:Zl,height:Vl}=El.reference,Ol=Sl.floating.style;Ol.setProperty("--radix-popper-available-width",`${Tl}px`),Ol.setProperty("--radix-popper-available-height",`${Il}px`),Ol.setProperty("--radix-popper-anchor-width",`${Zl}px`),Ol.setProperty("--radix-popper-anchor-height",`${Vl}px`)}}),Oo&&arrow({element:Oo,padding:ao}),transformOrigin({arrowWidth:Mo,arrowHeight:Fo}),ho&&hide({strategy:"referenceHidden",...yo})]}),[ko,mo]=getSideAndAlignFromPlacement(So),Io=useCallbackRef$1(bo);useLayoutEffect2(()=>{To&&(Io==null||Io())},[To,Io]);const Do=(qo=Ao.arrow)==null?void 0:qo.x,Lo=(Ko=Ao.arrow)==null?void 0:Ko.y,Ho=((Qo=Ao.arrow)==null?void 0:Qo.centerOffset)!==0,[Yo,Xo]=reactExports.useState();return useLayoutEffect2(()=>{$o&&Xo(window.getComputedStyle($o).zIndex)},[$o]),jsxRuntimeExports.jsx("div",{ref:vo.setFloating,"data-radix-popper-content-wrapper":"",style:{..._o,transform:To?_o.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Yo,"--radix-popper-transform-origin":[(zo=Ao.transformOrigin)==null?void 0:zo.x,(ga=Ao.transformOrigin)==null?void 0:ga.y].join(" "),...(($a=Ao.hide)==null?void 0:$a.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:Xr.dir,children:jsxRuntimeExports.jsx(PopperContentProvider,{scope:to,placedSide:ko,onArrowChange:jo,arrowX:Do,arrowY:Lo,shouldHideArrow:Ho,children:jsxRuntimeExports.jsx(Primitive.div,{"data-side":ko,"data-align":mo,...wo,ref:Ro,style:{...wo.style,animation:To?void 0:"none"}})})})});PopperContent$1.displayName=CONTENT_NAME$4;var ARROW_NAME$3="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=reactExports.forwardRef(function(eo,to){const{__scopePopper:ro,...no}=eo,io=useContentContext(ARROW_NAME$3,ro),oo=OPPOSITE_SIDE[io.placedSide];return jsxRuntimeExports.jsx("span",{ref:io.onArrowChange,style:{position:"absolute",left:io.arrowX,top:io.arrowY,[oo]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[io.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[io.placedSide],visibility:io.shouldHideArrow?"hidden":void 0},children:jsxRuntimeExports.jsx(Root$3,{...no,ref:to,style:{...no.style,display:"block"}})})});PopperArrow.displayName=ARROW_NAME$3;function isNotNull(Xr){return Xr!==null}var transformOrigin=Xr=>({name:"transformOrigin",options:Xr,fn(eo){var Eo,$o,Co;const{placement:to,rects:ro,middlewareData:no}=eo,oo=((Eo=no.arrow)==null?void 0:Eo.centerOffset)!==0,ao=oo?0:Xr.arrowWidth,so=oo?0:Xr.arrowHeight,[co,lo]=getSideAndAlignFromPlacement(to),uo={start:"0%",center:"50%",end:"100%"}[lo],ho=((($o=no.arrow)==null?void 0:$o.x)??0)+ao/2,go=(((Co=no.arrow)==null?void 0:Co.y)??0)+so/2;let bo="",wo="";return co==="bottom"?(bo=oo?uo:`${ho}px`,wo=`${-so}px`):co==="top"?(bo=oo?uo:`${ho}px`,wo=`${ro.floating.height+so}px`):co==="right"?(bo=`${-so}px`,wo=oo?uo:`${go}px`):co==="left"&&(bo=`${ro.floating.width+so}px`,wo=oo?uo:`${go}px`),{data:{x:bo,y:wo}}}});function getSideAndAlignFromPlacement(Xr){const[eo,to="center"]=Xr.split("-");return[eo,to]}var Root2$1=Popper$1,Anchor=PopperAnchor,Content$1=PopperContent$1,Arrow=PopperArrow,PORTAL_NAME$4="Portal",Portal$3=reactExports.forwardRef((Xr,eo)=>{var ao;const{container:to,...ro}=Xr,[no,io]=reactExports.useState(!1);useLayoutEffect2(()=>io(!0),[]);const oo=to||no&&((ao=globalThis==null?void 0:globalThis.document)==null?void 0:ao.body);return oo?oe$5.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...ro,ref:eo}),oo):null});Portal$3.displayName=PORTAL_NAME$4;function useStateMachine(Xr,eo){return reactExports.useReducer((to,ro)=>eo[to][ro]??to,Xr)}var Presence=Xr=>{const{present:eo,children:to}=Xr,ro=usePresence(eo),no=typeof to=="function"?to({present:ro.isPresent}):reactExports.Children.only(to),io=useComposedRefs$1(ro.ref,getElementRef(no));return typeof to=="function"||ro.isPresent?reactExports.cloneElement(no,{ref:io}):null};Presence.displayName="Presence";function usePresence(Xr){const[eo,to]=reactExports.useState(),ro=reactExports.useRef({}),no=reactExports.useRef(Xr),io=reactExports.useRef("none"),oo=Xr?"mounted":"unmounted",[ao,so]=useStateMachine(oo,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return reactExports.useEffect(()=>{const co=getAnimationName(ro.current);io.current=ao==="mounted"?co:"none"},[ao]),useLayoutEffect2(()=>{const co=ro.current,lo=no.current;if(lo!==Xr){const ho=io.current,go=getAnimationName(co);Xr?so("MOUNT"):go==="none"||(co==null?void 0:co.display)==="none"?so("UNMOUNT"):so(lo&&ho!==go?"ANIMATION_OUT":"UNMOUNT"),no.current=Xr}},[Xr,so]),useLayoutEffect2(()=>{if(eo){let co;const lo=eo.ownerDocument.defaultView??window,uo=go=>{const wo=getAnimationName(ro.current).includes(go.animationName);if(go.target===eo&&wo&&(so("ANIMATION_END"),!no.current)){const Eo=eo.style.animationFillMode;eo.style.animationFillMode="forwards",co=lo.setTimeout(()=>{eo.style.animationFillMode==="forwards"&&(eo.style.animationFillMode=Eo)})}},ho=go=>{go.target===eo&&(io.current=getAnimationName(ro.current))};return eo.addEventListener("animationstart",ho),eo.addEventListener("animationcancel",uo),eo.addEventListener("animationend",uo),()=>{lo.clearTimeout(co),eo.removeEventListener("animationstart",ho),eo.removeEventListener("animationcancel",uo),eo.removeEventListener("animationend",uo)}}else so("ANIMATION_END")},[eo,so]),{isPresent:["mounted","unmountSuspended"].includes(ao),ref:reactExports.useCallback(co=>{co&&(ro.current=getComputedStyle(co)),to(co)},[])}}function getAnimationName(Xr){return(Xr==null?void 0:Xr.animationName)||"none"}function getElementRef(Xr){var ro,no;let eo=(ro=Object.getOwnPropertyDescriptor(Xr.props,"ref"))==null?void 0:ro.get,to=eo&&"isReactWarning"in eo&&eo.isReactWarning;return to?Xr.ref:(eo=(no=Object.getOwnPropertyDescriptor(Xr,"ref"))==null?void 0:no.get,to=eo&&"isReactWarning"in eo&&eo.isReactWarning,to?Xr.props.ref:Xr.props.ref||Xr.ref)}function createContextScope(Xr,eo=[]){let to=[];function ro(io,oo){const ao=reactExports.createContext(oo),so=to.length;to=[...to,oo];function co(uo){const{scope:ho,children:go,...bo}=uo,wo=(ho==null?void 0:ho[Xr][so])||ao,Eo=reactExports.useMemo(()=>bo,Object.values(bo));return jsxRuntimeExports.jsx(wo.Provider,{value:Eo,children:go})}function lo(uo,ho){const go=(ho==null?void 0:ho[Xr][so])||ao,bo=reactExports.useContext(go);if(bo)return bo;if(oo!==void 0)return oo;throw new Error(`\`${uo}\` must be used within \`${io}\``)}return co.displayName=io+"Provider",[co,lo]}const no=()=>{const io=to.map(oo=>reactExports.createContext(oo));return function(ao){const so=(ao==null?void 0:ao[Xr])||io;return reactExports.useMemo(()=>({[`__scope${Xr}`]:{...ao,[Xr]:so}}),[ao,so])}};return no.scopeName=Xr,[ro,composeContextScopes(no,...eo)]}function composeContextScopes(...Xr){const eo=Xr[0];if(Xr.length===1)return eo;const to=()=>{const ro=Xr.map(no=>({useScope:no(),scopeName:no.scopeName}));return function(io){const oo=ro.reduce((ao,{useScope:so,scopeName:co})=>{const uo=so(io)[`__scope${co}`];return{...ao,...uo}},{});return reactExports.useMemo(()=>({[`__scope${eo.scopeName}`]:oo}),[oo])}};return to.scopeName=eo.scopeName,to}var ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",EVENT_OPTIONS={bubbles:!1,cancelable:!0},GROUP_NAME$2="RovingFocusGroup",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection(GROUP_NAME$2),[createRovingFocusGroupContext,createRovingFocusGroupScope]=createContextScope(GROUP_NAME$2,[createCollectionScope$1]),[RovingFocusProvider,useRovingFocusContext]=createRovingFocusGroupContext(GROUP_NAME$2),RovingFocusGroup=reactExports.forwardRef((Xr,eo)=>jsxRuntimeExports.jsx(Collection$1.Provider,{scope:Xr.__scopeRovingFocusGroup,children:jsxRuntimeExports.jsx(Collection$1.Slot,{scope:Xr.__scopeRovingFocusGroup,children:jsxRuntimeExports.jsx(RovingFocusGroupImpl,{...Xr,ref:eo})})}));RovingFocusGroup.displayName=GROUP_NAME$2;var RovingFocusGroupImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeRovingFocusGroup:to,orientation:ro,loop:no=!1,dir:io,currentTabStopId:oo,defaultCurrentTabStopId:ao,onCurrentTabStopIdChange:so,onEntryFocus:co,preventScrollOnEntryFocus:lo=!1,...uo}=Xr,ho=reactExports.useRef(null),go=useComposedRefs$1(eo,ho),bo=useDirection(io),[wo=null,Eo]=useControllableState({prop:oo,defaultProp:ao,onChange:so}),[$o,Co]=reactExports.useState(!1),Ro=useCallbackRef$1(co),Oo=useCollection$1(to),jo=reactExports.useRef(!1),[Bo,Mo]=reactExports.useState(0);return reactExports.useEffect(()=>{const Fo=ho.current;if(Fo)return Fo.addEventListener(ENTRY_FOCUS,Ro),()=>Fo.removeEventListener(ENTRY_FOCUS,Ro)},[Ro]),jsxRuntimeExports.jsx(RovingFocusProvider,{scope:to,orientation:ro,dir:bo,loop:no,currentTabStopId:wo,onItemFocus:reactExports.useCallback(Fo=>Eo(Fo),[Eo]),onItemShiftTab:reactExports.useCallback(()=>Co(!0),[]),onFocusableItemAdd:reactExports.useCallback(()=>Mo(Fo=>Fo+1),[]),onFocusableItemRemove:reactExports.useCallback(()=>Mo(Fo=>Fo-1),[]),children:jsxRuntimeExports.jsx(Primitive.div,{tabIndex:$o||Bo===0?-1:0,"data-orientation":ro,...uo,ref:go,style:{outline:"none",...Xr.style},onMouseDown:composeEventHandlers$1(Xr.onMouseDown,()=>{jo.current=!0}),onFocus:composeEventHandlers$1(Xr.onFocus,Fo=>{const Wo=!jo.current;if(Fo.target===Fo.currentTarget&&Wo&&!$o){const Jo=new CustomEvent(ENTRY_FOCUS,EVENT_OPTIONS);if(Fo.currentTarget.dispatchEvent(Jo),!Jo.defaultPrevented){const Po=Oo().filter(So=>So.focusable),fo=Po.find(So=>So.active),yo=Po.find(So=>So.id===wo),_o=[fo,yo,...Po].filter(Boolean).map(So=>So.ref.current);focusFirst$1(_o,lo)}}jo.current=!1}),onBlur:composeEventHandlers$1(Xr.onBlur,()=>Co(!1))})})}),ITEM_NAME$2="RovingFocusGroupItem",RovingFocusGroupItem=reactExports.forwardRef((Xr,eo)=>{const{__scopeRovingFocusGroup:to,focusable:ro=!0,active:no=!1,tabStopId:io,...oo}=Xr,ao=useId$1(),so=io||ao,co=useRovingFocusContext(ITEM_NAME$2,to),lo=co.currentTabStopId===so,uo=useCollection$1(to),{onFocusableItemAdd:ho,onFocusableItemRemove:go}=co;return reactExports.useEffect(()=>{if(ro)return ho(),()=>go()},[ro,ho,go]),jsxRuntimeExports.jsx(Collection$1.ItemSlot,{scope:to,id:so,focusable:ro,active:no,children:jsxRuntimeExports.jsx(Primitive.span,{tabIndex:lo?0:-1,"data-orientation":co.orientation,...oo,ref:eo,onMouseDown:composeEventHandlers$1(Xr.onMouseDown,bo=>{ro?co.onItemFocus(so):bo.preventDefault()}),onFocus:composeEventHandlers$1(Xr.onFocus,()=>co.onItemFocus(so)),onKeyDown:composeEventHandlers$1(Xr.onKeyDown,bo=>{if(bo.key==="Tab"&&bo.shiftKey){co.onItemShiftTab();return}if(bo.target!==bo.currentTarget)return;const wo=getFocusIntent(bo,co.orientation,co.dir);if(wo!==void 0){if(bo.metaKey||bo.ctrlKey||bo.altKey||bo.shiftKey)return;bo.preventDefault();let $o=uo().filter(Co=>Co.focusable).map(Co=>Co.ref.current);if(wo==="last")$o.reverse();else if(wo==="prev"||wo==="next"){wo==="prev"&&$o.reverse();const Co=$o.indexOf(bo.currentTarget);$o=co.loop?wrapArray$1($o,Co+1):$o.slice(Co+1)}setTimeout(()=>focusFirst$1($o))}})})})});RovingFocusGroupItem.displayName=ITEM_NAME$2;var MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey(Xr,eo){return eo!=="rtl"?Xr:Xr==="ArrowLeft"?"ArrowRight":Xr==="ArrowRight"?"ArrowLeft":Xr}function getFocusIntent(Xr,eo,to){const ro=getDirectionAwareKey(Xr.key,to);if(!(eo==="vertical"&&["ArrowLeft","ArrowRight"].includes(ro))&&!(eo==="horizontal"&&["ArrowUp","ArrowDown"].includes(ro)))return MAP_KEY_TO_FOCUS_INTENT[ro]}function focusFirst$1(Xr,eo=!1){const to=document.activeElement;for(const ro of Xr)if(ro===to||(ro.focus({preventScroll:eo}),document.activeElement!==to))return}function wrapArray$1(Xr,eo){return Xr.map((to,ro)=>Xr[(eo+ro)%Xr.length])}var Root$2=RovingFocusGroup,Item$2=RovingFocusGroupItem,getDefaultParent=function(Xr){if(typeof document>"u")return null;var eo=Array.isArray(Xr)?Xr[0]:Xr;return eo.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(Xr){return Xr&&(Xr.host||unwrapHost(Xr.parentNode))},correctTargets=function(Xr,eo){return eo.map(function(to){if(Xr.contains(to))return to;var ro=unwrapHost(to);return ro&&Xr.contains(ro)?ro:(console.error("aria-hidden",to,"in not contained inside",Xr,". Doing nothing"),null)}).filter(function(to){return!!to})},applyAttributeToOthers=function(Xr,eo,to,ro){var no=correctTargets(eo,Array.isArray(Xr)?Xr:[Xr]);markerMap[to]||(markerMap[to]=new WeakMap);var io=markerMap[to],oo=[],ao=new Set,so=new Set(no),co=function(uo){!uo||ao.has(uo)||(ao.add(uo),co(uo.parentNode))};no.forEach(co);var lo=function(uo){!uo||so.has(uo)||Array.prototype.forEach.call(uo.children,function(ho){if(ao.has(ho))lo(ho);else try{var go=ho.getAttribute(ro),bo=go!==null&&go!=="false",wo=(counterMap.get(ho)||0)+1,Eo=(io.get(ho)||0)+1;counterMap.set(ho,wo),io.set(ho,Eo),oo.push(ho),wo===1&&bo&&uncontrolledNodes.set(ho,!0),Eo===1&&ho.setAttribute(to,"true"),bo||ho.setAttribute(ro,"true")}catch($o){console.error("aria-hidden: cannot operate on ",ho,$o)}})};return lo(eo),ao.clear(),lockCount++,function(){oo.forEach(function(uo){var ho=counterMap.get(uo)-1,go=io.get(uo)-1;counterMap.set(uo,ho),io.set(uo,go),ho||(uncontrolledNodes.has(uo)||uo.removeAttribute(ro),uncontrolledNodes.delete(uo)),go||uo.removeAttribute(to)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(Xr,eo,to){to===void 0&&(to="data-aria-hidden");var ro=Array.from(Array.isArray(Xr)?Xr:[Xr]),no=getDefaultParent(Xr);return no?(ro.push.apply(ro,Array.from(no.querySelectorAll("[aria-live]"))),applyAttributeToOthers(ro,no,to,"aria-hidden")):function(){return null}},__assign$3=function(){return __assign$3=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro"u")return zeroGap;var eo=getOffset(Xr),to=document.documentElement.clientWidth,ro=window.innerWidth;return{left:eo[0],top:eo[1],right:eo[2],gap:Math.max(0,ro-to+eo[2]-eo[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles$1=function(Xr,eo,to,ro){var no=Xr.left,io=Xr.top,oo=Xr.right,ao=Xr.gap;return to===void 0&&(to="margin"),` + .`.concat(noScrollbarsClassName,` { + overflow: hidden `).concat(ro,`; + padding-right: `).concat(ao,"px ").concat(ro,`; + } + body[`).concat(lockAttribute,`] { + overflow: hidden `).concat(ro,`; + overscroll-behavior: contain; + `).concat([eo&&"position: relative ".concat(ro,";"),to==="margin"&&` + padding-left: `.concat(no,`px; + padding-top: `).concat(io,`px; + padding-right: `).concat(oo,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(ao,"px ").concat(ro,`; + `),to==="padding"&&"padding-right: ".concat(ao,"px ").concat(ro,";")].filter(Boolean).join(""),` + } + + .`).concat(zeroRightClassName,` { + right: `).concat(ao,"px ").concat(ro,`; + } + + .`).concat(fullWidthClassName,` { + margin-right: `).concat(ao,"px ").concat(ro,`; + } + + .`).concat(zeroRightClassName," .").concat(zeroRightClassName,` { + right: 0 `).concat(ro,`; + } + + .`).concat(fullWidthClassName," .").concat(fullWidthClassName,` { + margin-right: 0 `).concat(ro,`; + } + + body[`).concat(lockAttribute,`] { + `).concat(removedBarSizeVariable,": ").concat(ao,`px; + } +`)},getCurrentUseCounter=function(){var Xr=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(Xr)?Xr:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var Xr=getCurrentUseCounter()-1;Xr<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,Xr.toString())}},[])},RemoveScrollBar=function(Xr){var eo=Xr.noRelative,to=Xr.noImportant,ro=Xr.gapMode,no=ro===void 0?"margin":ro;useLockAttribute();var io=reactExports.useMemo(function(){return getGapWidth(no)},[no]);return reactExports.createElement(Style,{styles:getStyles$1(io,!eo,no,to?"":"!important")})},passiveSupported=!1;if(typeof window<"u")try{var options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch{passiveSupported=!1}var nonPassive=passiveSupported?{passive:!1}:!1,alwaysContainsScroll=function(Xr){return Xr.tagName==="TEXTAREA"},elementCanBeScrolled=function(Xr,eo){if(!(Xr instanceof Element))return!1;var to=window.getComputedStyle(Xr);return to[eo]!=="hidden"&&!(to.overflowY===to.overflowX&&!alwaysContainsScroll(Xr)&&to[eo]==="visible")},elementCouldBeVScrolled=function(Xr){return elementCanBeScrolled(Xr,"overflowY")},elementCouldBeHScrolled=function(Xr){return elementCanBeScrolled(Xr,"overflowX")},locationCouldBeScrolled=function(Xr,eo){var to=eo.ownerDocument,ro=eo;do{typeof ShadowRoot<"u"&&ro instanceof ShadowRoot&&(ro=ro.host);var no=elementCouldBeScrolled(Xr,ro);if(no){var io=getScrollVariables(Xr,ro),oo=io[1],ao=io[2];if(oo>ao)return!0}ro=ro.parentNode}while(ro&&ro!==to.body);return!1},getVScrollVariables=function(Xr){var eo=Xr.scrollTop,to=Xr.scrollHeight,ro=Xr.clientHeight;return[eo,to,ro]},getHScrollVariables=function(Xr){var eo=Xr.scrollLeft,to=Xr.scrollWidth,ro=Xr.clientWidth;return[eo,to,ro]},elementCouldBeScrolled=function(Xr,eo){return Xr==="v"?elementCouldBeVScrolled(eo):elementCouldBeHScrolled(eo)},getScrollVariables=function(Xr,eo){return Xr==="v"?getVScrollVariables(eo):getHScrollVariables(eo)},getDirectionFactor=function(Xr,eo){return Xr==="h"&&eo==="rtl"?-1:1},handleScroll=function(Xr,eo,to,ro,no){var io=getDirectionFactor(Xr,window.getComputedStyle(eo).direction),oo=io*ro,ao=to.target,so=eo.contains(ao),co=!1,lo=oo>0,uo=0,ho=0;do{var go=getScrollVariables(Xr,ao),bo=go[0],wo=go[1],Eo=go[2],$o=wo-Eo-io*bo;(bo||$o)&&elementCouldBeScrolled(Xr,ao)&&(uo+=$o,ho+=bo),ao instanceof ShadowRoot?ao=ao.host:ao=ao.parentNode}while(!so&&ao!==document.body||so&&(eo.contains(ao)||eo===ao));return(lo&&(Math.abs(uo)<1||!no)||!lo&&(Math.abs(ho)<1||!no))&&(co=!0),co},getTouchXY=function(Xr){return"changedTouches"in Xr?[Xr.changedTouches[0].clientX,Xr.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(Xr){return[Xr.deltaX,Xr.deltaY]},extractRef$1=function(Xr){return Xr&&"current"in Xr?Xr.current:Xr},deltaCompare=function(Xr,eo){return Xr[0]===eo[0]&&Xr[1]===eo[1]},generateStyle=function(Xr){return` + .block-interactivity-`.concat(Xr,` {pointer-events: none;} + .allow-interactivity-`).concat(Xr,` {pointer-events: all;} +`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(Xr){var eo=reactExports.useRef([]),to=reactExports.useRef([0,0]),ro=reactExports.useRef(),no=reactExports.useState(idCounter++)[0],io=reactExports.useState(styleSingleton)[0],oo=reactExports.useRef(Xr);reactExports.useEffect(function(){oo.current=Xr},[Xr]),reactExports.useEffect(function(){if(Xr.inert){document.body.classList.add("block-interactivity-".concat(no));var wo=__spreadArray$1([Xr.lockRef.current],(Xr.shards||[]).map(extractRef$1),!0).filter(Boolean);return wo.forEach(function(Eo){return Eo.classList.add("allow-interactivity-".concat(no))}),function(){document.body.classList.remove("block-interactivity-".concat(no)),wo.forEach(function(Eo){return Eo.classList.remove("allow-interactivity-".concat(no))})}}},[Xr.inert,Xr.lockRef.current,Xr.shards]);var ao=reactExports.useCallback(function(wo,Eo){if("touches"in wo&&wo.touches.length===2||wo.type==="wheel"&&wo.ctrlKey)return!oo.current.allowPinchZoom;var $o=getTouchXY(wo),Co=to.current,Ro="deltaX"in wo?wo.deltaX:Co[0]-$o[0],Oo="deltaY"in wo?wo.deltaY:Co[1]-$o[1],jo,Bo=wo.target,Mo=Math.abs(Ro)>Math.abs(Oo)?"h":"v";if("touches"in wo&&Mo==="h"&&Bo.type==="range")return!1;var Fo=locationCouldBeScrolled(Mo,Bo);if(!Fo)return!0;if(Fo?jo=Mo:(jo=Mo==="v"?"h":"v",Fo=locationCouldBeScrolled(Mo,Bo)),!Fo)return!1;if(!ro.current&&"changedTouches"in wo&&(Ro||Oo)&&(ro.current=jo),!jo)return!0;var Wo=ro.current||jo;return handleScroll(Wo,Eo,wo,Wo==="h"?Ro:Oo,!0)},[]),so=reactExports.useCallback(function(wo){var Eo=wo;if(!(!lockStack.length||lockStack[lockStack.length-1]!==io)){var $o="deltaY"in Eo?getDeltaXY(Eo):getTouchXY(Eo),Co=eo.current.filter(function(jo){return jo.name===Eo.type&&(jo.target===Eo.target||Eo.target===jo.shadowParent)&&deltaCompare(jo.delta,$o)})[0];if(Co&&Co.should){Eo.cancelable&&Eo.preventDefault();return}if(!Co){var Ro=(oo.current.shards||[]).map(extractRef$1).filter(Boolean).filter(function(jo){return jo.contains(Eo.target)}),Oo=Ro.length>0?ao(Eo,Ro[0]):!oo.current.noIsolation;Oo&&Eo.cancelable&&Eo.preventDefault()}}},[]),co=reactExports.useCallback(function(wo,Eo,$o,Co){var Ro={name:wo,delta:Eo,target:$o,should:Co,shadowParent:getOutermostShadowParent($o)};eo.current.push(Ro),setTimeout(function(){eo.current=eo.current.filter(function(Oo){return Oo!==Ro})},1)},[]),lo=reactExports.useCallback(function(wo){to.current=getTouchXY(wo),ro.current=void 0},[]),uo=reactExports.useCallback(function(wo){co(wo.type,getDeltaXY(wo),wo.target,ao(wo,Xr.lockRef.current))},[]),ho=reactExports.useCallback(function(wo){co(wo.type,getTouchXY(wo),wo.target,ao(wo,Xr.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(io),Xr.setCallbacks({onScrollCapture:uo,onWheelCapture:uo,onTouchMoveCapture:ho}),document.addEventListener("wheel",so,nonPassive),document.addEventListener("touchmove",so,nonPassive),document.addEventListener("touchstart",lo,nonPassive),function(){lockStack=lockStack.filter(function(wo){return wo!==io}),document.removeEventListener("wheel",so,nonPassive),document.removeEventListener("touchmove",so,nonPassive),document.removeEventListener("touchstart",lo,nonPassive)}},[]);var go=Xr.removeScrollBar,bo=Xr.inert;return reactExports.createElement(reactExports.Fragment,null,bo?reactExports.createElement(io,{styles:generateStyle(no)}):null,go?reactExports.createElement(RemoveScrollBar,{gapMode:Xr.gapMode}):null)}function getOutermostShadowParent(Xr){for(var eo=null;Xr!==null;)Xr instanceof ShadowRoot&&(eo=Xr.host,Xr=Xr.host),Xr=Xr.parentNode;return eo}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(Xr,eo){return reactExports.createElement(RemoveScroll,__assign$3({},Xr,{ref:eo,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var SELECTION_KEYS=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS,"ArrowRight"],rtl:[...SELECTION_KEYS,"ArrowLeft"]},SUB_CLOSE_KEYS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},MENU_NAME="Menu",[Collection,useCollection,createCollectionScope]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope$3(MENU_NAME,[createCollectionScope,createPopperScope,createRovingFocusGroupScope]),usePopperScope$1=createPopperScope(),useRovingFocusGroupScope=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=Xr=>{const{__scopeMenu:eo,open:to=!1,children:ro,dir:no,onOpenChange:io,modal:oo=!0}=Xr,ao=usePopperScope$1(eo),[so,co]=reactExports.useState(null),lo=reactExports.useRef(!1),uo=useCallbackRef$1(io),ho=useDirection(no);return reactExports.useEffect(()=>{const go=()=>{lo.current=!0,document.addEventListener("pointerdown",bo,{capture:!0,once:!0}),document.addEventListener("pointermove",bo,{capture:!0,once:!0})},bo=()=>lo.current=!1;return document.addEventListener("keydown",go,{capture:!0}),()=>{document.removeEventListener("keydown",go,{capture:!0}),document.removeEventListener("pointerdown",bo,{capture:!0}),document.removeEventListener("pointermove",bo,{capture:!0})}},[]),jsxRuntimeExports.jsx(Root2$1,{...ao,children:jsxRuntimeExports.jsx(MenuProvider,{scope:eo,open:to,onOpenChange:uo,content:so,onContentChange:co,children:jsxRuntimeExports.jsx(MenuRootProvider,{scope:eo,onClose:reactExports.useCallback(()=>uo(!1),[uo]),isUsingKeyboardRef:lo,dir:ho,modal:oo,children:ro})})})};Menu.displayName=MENU_NAME;var ANCHOR_NAME="MenuAnchor",MenuAnchor=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,...ro}=Xr,no=usePopperScope$1(to);return jsxRuntimeExports.jsx(Anchor,{...no,...ro,ref:eo})});MenuAnchor.displayName=ANCHOR_NAME;var PORTAL_NAME$3="MenuPortal",[PortalProvider$2,usePortalContext$2]=createMenuContext(PORTAL_NAME$3,{forceMount:void 0}),MenuPortal=Xr=>{const{__scopeMenu:eo,forceMount:to,children:ro,container:no}=Xr,io=useMenuContext(PORTAL_NAME$3,eo);return jsxRuntimeExports.jsx(PortalProvider$2,{scope:eo,forceMount:to,children:jsxRuntimeExports.jsx(Presence,{present:to||io.open,children:jsxRuntimeExports.jsx(Portal$3,{asChild:!0,container:no,children:ro})})})};MenuPortal.displayName=PORTAL_NAME$3;var CONTENT_NAME$3="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(CONTENT_NAME$3),MenuContent=reactExports.forwardRef((Xr,eo)=>{const to=usePortalContext$2(CONTENT_NAME$3,Xr.__scopeMenu),{forceMount:ro=to.forceMount,...no}=Xr,io=useMenuContext(CONTENT_NAME$3,Xr.__scopeMenu),oo=useMenuRootContext(CONTENT_NAME$3,Xr.__scopeMenu);return jsxRuntimeExports.jsx(Collection.Provider,{scope:Xr.__scopeMenu,children:jsxRuntimeExports.jsx(Presence,{present:ro||io.open,children:jsxRuntimeExports.jsx(Collection.Slot,{scope:Xr.__scopeMenu,children:oo.modal?jsxRuntimeExports.jsx(MenuRootContentModal,{...no,ref:eo}):jsxRuntimeExports.jsx(MenuRootContentNonModal,{...no,ref:eo})})})})}),MenuRootContentModal=reactExports.forwardRef((Xr,eo)=>{const to=useMenuContext(CONTENT_NAME$3,Xr.__scopeMenu),ro=reactExports.useRef(null),no=useComposedRefs$1(eo,ro);return reactExports.useEffect(()=>{const io=ro.current;if(io)return hideOthers(io)},[]),jsxRuntimeExports.jsx(MenuContentImpl,{...Xr,ref:no,trapFocus:to.open,disableOutsidePointerEvents:to.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers$1(Xr.onFocusOutside,io=>io.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>to.onOpenChange(!1)})}),MenuRootContentNonModal=reactExports.forwardRef((Xr,eo)=>{const to=useMenuContext(CONTENT_NAME$3,Xr.__scopeMenu);return jsxRuntimeExports.jsx(MenuContentImpl,{...Xr,ref:eo,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>to.onOpenChange(!1)})}),MenuContentImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,loop:ro=!1,trapFocus:no,onOpenAutoFocus:io,onCloseAutoFocus:oo,disableOutsidePointerEvents:ao,onEntryFocus:so,onEscapeKeyDown:co,onPointerDownOutside:lo,onFocusOutside:uo,onInteractOutside:ho,onDismiss:go,disableOutsideScroll:bo,...wo}=Xr,Eo=useMenuContext(CONTENT_NAME$3,to),$o=useMenuRootContext(CONTENT_NAME$3,to),Co=usePopperScope$1(to),Ro=useRovingFocusGroupScope(to),Oo=useCollection(to),[jo,Bo]=reactExports.useState(null),Mo=reactExports.useRef(null),Fo=useComposedRefs$1(eo,Mo,Eo.onContentChange),Wo=reactExports.useRef(0),Jo=reactExports.useRef(""),Po=reactExports.useRef(0),fo=reactExports.useRef(null),yo=reactExports.useRef("right"),vo=reactExports.useRef(0),_o=bo?ReactRemoveScroll:reactExports.Fragment,So=bo?{as:Slot,allowPinchZoom:!0}:void 0,To=ko=>{var qo,Ko;const mo=Jo.current+ko,Io=Oo().filter(Qo=>!Qo.disabled),Do=document.activeElement,Lo=(qo=Io.find(Qo=>Qo.ref.current===Do))==null?void 0:qo.textValue,Ho=Io.map(Qo=>Qo.textValue),Yo=getNextMatch(Ho,mo,Lo),Xo=(Ko=Io.find(Qo=>Qo.textValue===Yo))==null?void 0:Ko.ref.current;(function Qo(zo){Jo.current=zo,window.clearTimeout(Wo.current),zo!==""&&(Wo.current=window.setTimeout(()=>Qo(""),1e3))})(mo),Xo&&setTimeout(()=>Xo.focus())};reactExports.useEffect(()=>()=>window.clearTimeout(Wo.current),[]),useFocusGuards();const Ao=reactExports.useCallback(ko=>{var Io,Do;return yo.current===((Io=fo.current)==null?void 0:Io.side)&&isPointerInGraceArea(ko,(Do=fo.current)==null?void 0:Do.area)},[]);return jsxRuntimeExports.jsx(MenuContentProvider,{scope:to,searchRef:Jo,onItemEnter:reactExports.useCallback(ko=>{Ao(ko)&&ko.preventDefault()},[Ao]),onItemLeave:reactExports.useCallback(ko=>{var mo;Ao(ko)||((mo=Mo.current)==null||mo.focus(),Bo(null))},[Ao]),onTriggerLeave:reactExports.useCallback(ko=>{Ao(ko)&&ko.preventDefault()},[Ao]),pointerGraceTimerRef:Po,onPointerGraceIntentChange:reactExports.useCallback(ko=>{fo.current=ko},[]),children:jsxRuntimeExports.jsx(_o,{...So,children:jsxRuntimeExports.jsx(FocusScope,{asChild:!0,trapped:no,onMountAutoFocus:composeEventHandlers$1(io,ko=>{var mo;ko.preventDefault(),(mo=Mo.current)==null||mo.focus({preventScroll:!0})}),onUnmountAutoFocus:oo,children:jsxRuntimeExports.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:ao,onEscapeKeyDown:co,onPointerDownOutside:lo,onFocusOutside:uo,onInteractOutside:ho,onDismiss:go,children:jsxRuntimeExports.jsx(Root$2,{asChild:!0,...Ro,dir:$o.dir,orientation:"vertical",loop:ro,currentTabStopId:jo,onCurrentTabStopIdChange:Bo,onEntryFocus:composeEventHandlers$1(so,ko=>{$o.isUsingKeyboardRef.current||ko.preventDefault()}),preventScrollOnEntryFocus:!0,children:jsxRuntimeExports.jsx(Content$1,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(Eo.open),"data-radix-menu-content":"",dir:$o.dir,...Co,...wo,ref:Fo,style:{outline:"none",...wo.style},onKeyDown:composeEventHandlers$1(wo.onKeyDown,ko=>{const Io=ko.target.closest("[data-radix-menu-content]")===ko.currentTarget,Do=ko.ctrlKey||ko.altKey||ko.metaKey,Lo=ko.key.length===1;Io&&(ko.key==="Tab"&&ko.preventDefault(),!Do&&Lo&&To(ko.key));const Ho=Mo.current;if(ko.target!==Ho||!FIRST_LAST_KEYS.includes(ko.key))return;ko.preventDefault();const Xo=Oo().filter(qo=>!qo.disabled).map(qo=>qo.ref.current);LAST_KEYS.includes(ko.key)&&Xo.reverse(),focusFirst(Xo)}),onBlur:composeEventHandlers$1(Xr.onBlur,ko=>{ko.currentTarget.contains(ko.target)||(window.clearTimeout(Wo.current),Jo.current="")}),onPointerMove:composeEventHandlers$1(Xr.onPointerMove,whenMouse(ko=>{const mo=ko.target,Io=vo.current!==ko.clientX;if(ko.currentTarget.contains(mo)&&Io){const Do=ko.clientX>vo.current?"right":"left";yo.current=Do,vo.current=ko.clientX}}))})})})})})})});MenuContent.displayName=CONTENT_NAME$3;var GROUP_NAME$1="MenuGroup",MenuGroup=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,...ro}=Xr;return jsxRuntimeExports.jsx(Primitive.div,{role:"group",...ro,ref:eo})});MenuGroup.displayName=GROUP_NAME$1;var LABEL_NAME$1="MenuLabel",MenuLabel=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,...ro}=Xr;return jsxRuntimeExports.jsx(Primitive.div,{...ro,ref:eo})});MenuLabel.displayName=LABEL_NAME$1;var ITEM_NAME$1="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=reactExports.forwardRef((Xr,eo)=>{const{disabled:to=!1,onSelect:ro,...no}=Xr,io=reactExports.useRef(null),oo=useMenuRootContext(ITEM_NAME$1,Xr.__scopeMenu),ao=useMenuContentContext(ITEM_NAME$1,Xr.__scopeMenu),so=useComposedRefs$1(eo,io),co=reactExports.useRef(!1),lo=()=>{const uo=io.current;if(!to&&uo){const ho=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});uo.addEventListener(ITEM_SELECT,go=>ro==null?void 0:ro(go),{once:!0}),dispatchDiscreteCustomEvent(uo,ho),ho.defaultPrevented?co.current=!1:oo.onClose()}};return jsxRuntimeExports.jsx(MenuItemImpl,{...no,ref:so,disabled:to,onClick:composeEventHandlers$1(Xr.onClick,lo),onPointerDown:uo=>{var ho;(ho=Xr.onPointerDown)==null||ho.call(Xr,uo),co.current=!0},onPointerUp:composeEventHandlers$1(Xr.onPointerUp,uo=>{var ho;co.current||(ho=uo.currentTarget)==null||ho.click()}),onKeyDown:composeEventHandlers$1(Xr.onKeyDown,uo=>{const ho=ao.searchRef.current!=="";to||ho&&uo.key===" "||SELECTION_KEYS.includes(uo.key)&&(uo.currentTarget.click(),uo.preventDefault())})})});MenuItem.displayName=ITEM_NAME$1;var MenuItemImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,disabled:ro=!1,textValue:no,...io}=Xr,oo=useMenuContentContext(ITEM_NAME$1,to),ao=useRovingFocusGroupScope(to),so=reactExports.useRef(null),co=useComposedRefs$1(eo,so),[lo,uo]=reactExports.useState(!1),[ho,go]=reactExports.useState("");return reactExports.useEffect(()=>{const bo=so.current;bo&&go((bo.textContent??"").trim())},[io.children]),jsxRuntimeExports.jsx(Collection.ItemSlot,{scope:to,disabled:ro,textValue:no??ho,children:jsxRuntimeExports.jsx(Item$2,{asChild:!0,...ao,focusable:!ro,children:jsxRuntimeExports.jsx(Primitive.div,{role:"menuitem","data-highlighted":lo?"":void 0,"aria-disabled":ro||void 0,"data-disabled":ro?"":void 0,...io,ref:co,onPointerMove:composeEventHandlers$1(Xr.onPointerMove,whenMouse(bo=>{ro?oo.onItemLeave(bo):(oo.onItemEnter(bo),bo.defaultPrevented||bo.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:composeEventHandlers$1(Xr.onPointerLeave,whenMouse(bo=>oo.onItemLeave(bo))),onFocus:composeEventHandlers$1(Xr.onFocus,()=>uo(!0)),onBlur:composeEventHandlers$1(Xr.onBlur,()=>uo(!1))})})})}),CHECKBOX_ITEM_NAME$1="MenuCheckboxItem",MenuCheckboxItem=reactExports.forwardRef((Xr,eo)=>{const{checked:to=!1,onCheckedChange:ro,...no}=Xr;return jsxRuntimeExports.jsx(ItemIndicatorProvider,{scope:Xr.__scopeMenu,checked:to,children:jsxRuntimeExports.jsx(MenuItem,{role:"menuitemcheckbox","aria-checked":isIndeterminate(to)?"mixed":to,...no,ref:eo,"data-state":getCheckedState(to),onSelect:composeEventHandlers$1(no.onSelect,()=>ro==null?void 0:ro(isIndeterminate(to)?!0:!to),{checkForDefaultPrevented:!1})})})});MenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME$1;var RADIO_GROUP_NAME$1="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME$1,{value:void 0,onValueChange:()=>{}}),MenuRadioGroup=reactExports.forwardRef((Xr,eo)=>{const{value:to,onValueChange:ro,...no}=Xr,io=useCallbackRef$1(ro);return jsxRuntimeExports.jsx(RadioGroupProvider,{scope:Xr.__scopeMenu,value:to,onValueChange:io,children:jsxRuntimeExports.jsx(MenuGroup,{...no,ref:eo})})});MenuRadioGroup.displayName=RADIO_GROUP_NAME$1;var RADIO_ITEM_NAME$1="MenuRadioItem",MenuRadioItem=reactExports.forwardRef((Xr,eo)=>{const{value:to,...ro}=Xr,no=useRadioGroupContext(RADIO_ITEM_NAME$1,Xr.__scopeMenu),io=to===no.value;return jsxRuntimeExports.jsx(ItemIndicatorProvider,{scope:Xr.__scopeMenu,checked:io,children:jsxRuntimeExports.jsx(MenuItem,{role:"menuitemradio","aria-checked":io,...ro,ref:eo,"data-state":getCheckedState(io),onSelect:composeEventHandlers$1(ro.onSelect,()=>{var oo;return(oo=no.onValueChange)==null?void 0:oo.call(no,to)},{checkForDefaultPrevented:!1})})})});MenuRadioItem.displayName=RADIO_ITEM_NAME$1;var ITEM_INDICATOR_NAME="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME,{checked:!1}),MenuItemIndicator=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,forceMount:ro,...no}=Xr,io=useItemIndicatorContext(ITEM_INDICATOR_NAME,to);return jsxRuntimeExports.jsx(Presence,{present:ro||isIndeterminate(io.checked)||io.checked===!0,children:jsxRuntimeExports.jsx(Primitive.span,{...no,ref:eo,"data-state":getCheckedState(io.checked)})})});MenuItemIndicator.displayName=ITEM_INDICATOR_NAME;var SEPARATOR_NAME$1="MenuSeparator",MenuSeparator=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,...ro}=Xr;return jsxRuntimeExports.jsx(Primitive.div,{role:"separator","aria-orientation":"horizontal",...ro,ref:eo})});MenuSeparator.displayName=SEPARATOR_NAME$1;var ARROW_NAME$2="MenuArrow",MenuArrow=reactExports.forwardRef((Xr,eo)=>{const{__scopeMenu:to,...ro}=Xr,no=usePopperScope$1(to);return jsxRuntimeExports.jsx(Arrow,{...no,...ro,ref:eo})});MenuArrow.displayName=ARROW_NAME$2;var SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),SUB_TRIGGER_NAME$1="MenuSubTrigger",MenuSubTrigger=reactExports.forwardRef((Xr,eo)=>{const to=useMenuContext(SUB_TRIGGER_NAME$1,Xr.__scopeMenu),ro=useMenuRootContext(SUB_TRIGGER_NAME$1,Xr.__scopeMenu),no=useMenuSubContext(SUB_TRIGGER_NAME$1,Xr.__scopeMenu),io=useMenuContentContext(SUB_TRIGGER_NAME$1,Xr.__scopeMenu),oo=reactExports.useRef(null),{pointerGraceTimerRef:ao,onPointerGraceIntentChange:so}=io,co={__scopeMenu:Xr.__scopeMenu},lo=reactExports.useCallback(()=>{oo.current&&window.clearTimeout(oo.current),oo.current=null},[]);return reactExports.useEffect(()=>lo,[lo]),reactExports.useEffect(()=>{const uo=ao.current;return()=>{window.clearTimeout(uo),so(null)}},[ao,so]),jsxRuntimeExports.jsx(MenuAnchor,{asChild:!0,...co,children:jsxRuntimeExports.jsx(MenuItemImpl,{id:no.triggerId,"aria-haspopup":"menu","aria-expanded":to.open,"aria-controls":no.contentId,"data-state":getOpenState(to.open),...Xr,ref:composeRefs(eo,no.onTriggerChange),onClick:uo=>{var ho;(ho=Xr.onClick)==null||ho.call(Xr,uo),!(Xr.disabled||uo.defaultPrevented)&&(uo.currentTarget.focus(),to.open||to.onOpenChange(!0))},onPointerMove:composeEventHandlers$1(Xr.onPointerMove,whenMouse(uo=>{io.onItemEnter(uo),!uo.defaultPrevented&&!Xr.disabled&&!to.open&&!oo.current&&(io.onPointerGraceIntentChange(null),oo.current=window.setTimeout(()=>{to.onOpenChange(!0),lo()},100))})),onPointerLeave:composeEventHandlers$1(Xr.onPointerLeave,whenMouse(uo=>{var go,bo;lo();const ho=(go=to.content)==null?void 0:go.getBoundingClientRect();if(ho){const wo=(bo=to.content)==null?void 0:bo.dataset.side,Eo=wo==="right",$o=Eo?-5:5,Co=ho[Eo?"left":"right"],Ro=ho[Eo?"right":"left"];io.onPointerGraceIntentChange({area:[{x:uo.clientX+$o,y:uo.clientY},{x:Co,y:ho.top},{x:Ro,y:ho.top},{x:Ro,y:ho.bottom},{x:Co,y:ho.bottom}],side:wo}),window.clearTimeout(ao.current),ao.current=window.setTimeout(()=>io.onPointerGraceIntentChange(null),300)}else{if(io.onTriggerLeave(uo),uo.defaultPrevented)return;io.onPointerGraceIntentChange(null)}})),onKeyDown:composeEventHandlers$1(Xr.onKeyDown,uo=>{var go;const ho=io.searchRef.current!=="";Xr.disabled||ho&&uo.key===" "||SUB_OPEN_KEYS[ro.dir].includes(uo.key)&&(to.onOpenChange(!0),(go=to.content)==null||go.focus(),uo.preventDefault())})})})});MenuSubTrigger.displayName=SUB_TRIGGER_NAME$1;var SUB_CONTENT_NAME$1="MenuSubContent",MenuSubContent=reactExports.forwardRef((Xr,eo)=>{const to=usePortalContext$2(CONTENT_NAME$3,Xr.__scopeMenu),{forceMount:ro=to.forceMount,...no}=Xr,io=useMenuContext(CONTENT_NAME$3,Xr.__scopeMenu),oo=useMenuRootContext(CONTENT_NAME$3,Xr.__scopeMenu),ao=useMenuSubContext(SUB_CONTENT_NAME$1,Xr.__scopeMenu),so=reactExports.useRef(null),co=useComposedRefs$1(eo,so);return jsxRuntimeExports.jsx(Collection.Provider,{scope:Xr.__scopeMenu,children:jsxRuntimeExports.jsx(Presence,{present:ro||io.open,children:jsxRuntimeExports.jsx(Collection.Slot,{scope:Xr.__scopeMenu,children:jsxRuntimeExports.jsx(MenuContentImpl,{id:ao.contentId,"aria-labelledby":ao.triggerId,...no,ref:co,align:"start",side:oo.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:lo=>{var uo;oo.isUsingKeyboardRef.current&&((uo=so.current)==null||uo.focus()),lo.preventDefault()},onCloseAutoFocus:lo=>lo.preventDefault(),onFocusOutside:composeEventHandlers$1(Xr.onFocusOutside,lo=>{lo.target!==ao.trigger&&io.onOpenChange(!1)}),onEscapeKeyDown:composeEventHandlers$1(Xr.onEscapeKeyDown,lo=>{oo.onClose(),lo.preventDefault()}),onKeyDown:composeEventHandlers$1(Xr.onKeyDown,lo=>{var go;const uo=lo.currentTarget.contains(lo.target),ho=SUB_CLOSE_KEYS[oo.dir].includes(lo.key);uo&&ho&&(io.onOpenChange(!1),(go=ao.trigger)==null||go.focus(),lo.preventDefault())})})})})})});MenuSubContent.displayName=SUB_CONTENT_NAME$1;function getOpenState(Xr){return Xr?"open":"closed"}function isIndeterminate(Xr){return Xr==="indeterminate"}function getCheckedState(Xr){return isIndeterminate(Xr)?"indeterminate":Xr?"checked":"unchecked"}function focusFirst(Xr){const eo=document.activeElement;for(const to of Xr)if(to===eo||(to.focus(),document.activeElement!==eo))return}function wrapArray(Xr,eo){return Xr.map((to,ro)=>Xr[(eo+ro)%Xr.length])}function getNextMatch(Xr,eo,to){const no=eo.length>1&&Array.from(eo).every(co=>co===eo[0])?eo[0]:eo,io=to?Xr.indexOf(to):-1;let oo=wrapArray(Xr,Math.max(io,0));no.length===1&&(oo=oo.filter(co=>co!==to));const so=oo.find(co=>co.toLowerCase().startsWith(no.toLowerCase()));return so!==to?so:void 0}function isPointInPolygon$1(Xr,eo){const{x:to,y:ro}=Xr;let no=!1;for(let io=0,oo=eo.length-1;ioro!=lo>ro&&to<(co-ao)*(ro-so)/(lo-so)+ao&&(no=!no)}return no}function isPointerInGraceArea(Xr,eo){if(!eo)return!1;const to={x:Xr.clientX,y:Xr.clientY};return isPointInPolygon$1(to,eo)}function whenMouse(Xr){return eo=>eo.pointerType==="mouse"?Xr(eo):void 0}var Root3=Menu,Anchor2=MenuAnchor,Portal$2=MenuPortal,Content2$2=MenuContent,Group=MenuGroup,Label=MenuLabel,Item2$1=MenuItem,CheckboxItem=MenuCheckboxItem,RadioGroup=MenuRadioGroup,RadioItem=MenuRadioItem,ItemIndicator=MenuItemIndicator,Separator=MenuSeparator,Arrow2=MenuArrow,SubTrigger=MenuSubTrigger,SubContent=MenuSubContent,DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext,createDropdownMenuScope]=createContextScope$3(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu=Xr=>{const{__scopeDropdownMenu:eo,children:to,dir:ro,open:no,defaultOpen:io,onOpenChange:oo,modal:ao=!0}=Xr,so=useMenuScope(eo),co=reactExports.useRef(null),[lo=!1,uo]=useControllableState({prop:no,defaultProp:io,onChange:oo});return jsxRuntimeExports.jsx(DropdownMenuProvider,{scope:eo,triggerId:useId$1(),triggerRef:co,contentId:useId$1(),open:lo,onOpenChange:uo,onOpenToggle:reactExports.useCallback(()=>uo(ho=>!ho),[uo]),modal:ao,children:jsxRuntimeExports.jsx(Root3,{...so,open:lo,onOpenChange:uo,dir:ro,modal:ao,children:to})})};DropdownMenu.displayName=DROPDOWN_MENU_NAME;var TRIGGER_NAME$2="DropdownMenuTrigger",DropdownMenuTrigger=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,disabled:ro=!1,...no}=Xr,io=useDropdownMenuContext(TRIGGER_NAME$2,to),oo=useMenuScope(to);return jsxRuntimeExports.jsx(Anchor2,{asChild:!0,...oo,children:jsxRuntimeExports.jsx(Primitive.button,{type:"button",id:io.triggerId,"aria-haspopup":"menu","aria-expanded":io.open,"aria-controls":io.open?io.contentId:void 0,"data-state":io.open?"open":"closed","data-disabled":ro?"":void 0,disabled:ro,...no,ref:composeRefs(eo,io.triggerRef),onPointerDown:composeEventHandlers$1(Xr.onPointerDown,ao=>{!ro&&ao.button===0&&ao.ctrlKey===!1&&(io.onOpenToggle(),io.open||ao.preventDefault())}),onKeyDown:composeEventHandlers$1(Xr.onKeyDown,ao=>{ro||(["Enter"," "].includes(ao.key)&&io.onOpenToggle(),ao.key==="ArrowDown"&&io.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(ao.key)&&ao.preventDefault())})})})});DropdownMenuTrigger.displayName=TRIGGER_NAME$2;var PORTAL_NAME$2="DropdownMenuPortal",DropdownMenuPortal=Xr=>{const{__scopeDropdownMenu:eo,...to}=Xr,ro=useMenuScope(eo);return jsxRuntimeExports.jsx(Portal$2,{...ro,...to})};DropdownMenuPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$2="DropdownMenuContent",DropdownMenuContent=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useDropdownMenuContext(CONTENT_NAME$2,to),io=useMenuScope(to),oo=reactExports.useRef(!1);return jsxRuntimeExports.jsx(Content2$2,{id:no.contentId,"aria-labelledby":no.triggerId,...io,...ro,ref:eo,onCloseAutoFocus:composeEventHandlers$1(Xr.onCloseAutoFocus,ao=>{var so;oo.current||(so=no.triggerRef.current)==null||so.focus(),oo.current=!1,ao.preventDefault()}),onInteractOutside:composeEventHandlers$1(Xr.onInteractOutside,ao=>{const so=ao.detail.originalEvent,co=so.button===0&&so.ctrlKey===!0,lo=so.button===2||co;(!no.modal||lo)&&(oo.current=!0)}),style:{...Xr.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuContent.displayName=CONTENT_NAME$2;var GROUP_NAME="DropdownMenuGroup",DropdownMenuGroup=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(Group,{...no,...ro,ref:eo})});DropdownMenuGroup.displayName=GROUP_NAME;var LABEL_NAME="DropdownMenuLabel",DropdownMenuLabel=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(Label,{...no,...ro,ref:eo})});DropdownMenuLabel.displayName=LABEL_NAME;var ITEM_NAME="DropdownMenuItem",DropdownMenuItem=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(Item2$1,{...no,...ro,ref:eo})});DropdownMenuItem.displayName=ITEM_NAME;var CHECKBOX_ITEM_NAME="DropdownMenuCheckboxItem",DropdownMenuCheckboxItem=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(CheckboxItem,{...no,...ro,ref:eo})});DropdownMenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME;var RADIO_GROUP_NAME="DropdownMenuRadioGroup",DropdownMenuRadioGroup=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(RadioGroup,{...no,...ro,ref:eo})});DropdownMenuRadioGroup.displayName=RADIO_GROUP_NAME;var RADIO_ITEM_NAME="DropdownMenuRadioItem",DropdownMenuRadioItem=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(RadioItem,{...no,...ro,ref:eo})});DropdownMenuRadioItem.displayName=RADIO_ITEM_NAME;var INDICATOR_NAME="DropdownMenuItemIndicator",DropdownMenuItemIndicator=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(ItemIndicator,{...no,...ro,ref:eo})});DropdownMenuItemIndicator.displayName=INDICATOR_NAME;var SEPARATOR_NAME="DropdownMenuSeparator",DropdownMenuSeparator=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(Separator,{...no,...ro,ref:eo})});DropdownMenuSeparator.displayName=SEPARATOR_NAME;var ARROW_NAME$1="DropdownMenuArrow",DropdownMenuArrow=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(Arrow2,{...no,...ro,ref:eo})});DropdownMenuArrow.displayName=ARROW_NAME$1;var SUB_TRIGGER_NAME="DropdownMenuSubTrigger",DropdownMenuSubTrigger=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(SubTrigger,{...no,...ro,ref:eo})});DropdownMenuSubTrigger.displayName=SUB_TRIGGER_NAME;var SUB_CONTENT_NAME="DropdownMenuSubContent",DropdownMenuSubContent=reactExports.forwardRef((Xr,eo)=>{const{__scopeDropdownMenu:to,...ro}=Xr,no=useMenuScope(to);return jsxRuntimeExports.jsx(SubContent,{...no,...ro,ref:eo,style:{...Xr.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuSubContent.displayName=SUB_CONTENT_NAME;var Root2=DropdownMenu,Trigger=DropdownMenuTrigger,Portal2=DropdownMenuPortal,Content2$1=DropdownMenuContent,Item2=DropdownMenuItem;const RadixDropdownContent=qe$4(Content2$1)` + /* Extra CSS props */ + ${Xr=>Xr.css||""} +`,Dropdown$1=reactExports.forwardRef(({overlay:Xr,trigger:eo="click",children:to,...ro},no)=>{const[io,oo]=reactExports.useState(!1),ao=()=>oo(!0),so=()=>oo(!1),co=()=>oo(!io);return jsxRuntimeExports.jsxs(Root2,{open:io,onOpenChange:oo,children:[jsxRuntimeExports.jsx(Trigger,{asChild:!0,ref:no,style:{pointerEvents:eo==="hover"?"auto":"inherit"},onMouseEnter:()=>eo=="hover"&&ao(),onMouseLeave:()=>eo=="hover"&&so(),onClick:()=>eo=="click"&&co,children:to&&typeof to=="function"?to({isOpen:io}):to}),jsxRuntimeExports.jsx(Portal2,{children:jsxRuntimeExports.jsx(RadixDropdownContent,{sideOffset:2,alignOffset:-3,onMouseEnter:()=>eo=="hover"&&ao(),onMouseLeave:()=>eo=="hover"&&so(),onPointerDownOutside:()=>so(),...ro,children:typeof Xr=="function"?Xr(oo):Xr})})]})});Dropdown$1.displayName="Dropdown";qe$4(Link)` + /* Link CSS */ + + text-decoration: none; + + &:hover > * { + color: ${({isText:Xr})=>Xr?"var(--text-brand-medium)":""}; + } + + /* Extra CSS props */ + ${Xr=>Xr.css||""} +`;const getLozengeVariantStyles=Xr=>Xr==="primary"?Ae$3` + background-color: var(--surface-brand-subtle); + color: var(--text-brand-bold); + .icon { + color: var(--icon-brand-medium); + } + `:Ae$3``,getLozengeSizeStyles=({iconOnly:Xr,size:eo})=>eo==="small"?Ae$3` + /* Lozenge tag container size css */ + max-height: 14px; + min-height: 14px; + + border-radius: var(--radius-xxxs); + ${Xr?` + gap: var(--spacing-none); + padding: var(--spacing-xxxs); + `:` + gap: var(--spacing-xxxs); + padding: var(--spacing-xxxs) var(--spacing-xxs); + `} + + /* Lozenge text size css */ + leading-trim: both; + text-edge: cap; + font-size: ${textVariants["os-bold"].fontSize}; + font-style: ${textVariants["os-bold"].fontStyle}; + font-weight: ${textVariants["os-bold"].fontWeight}; + line-height: ${textVariants["os-bold"].lineHeight}; + text-transform: ${textVariants["os-bold"].textTransform}; + + .icon > span { + height: 8px; + width: 8px; + } + `:Ae$3` + /* Lozenge tag container size css + note: - add medium small and large sizes */ + + var(--spacing-sm); + + ${Xr?` + border-radius: var(--radius-sm); + gap: var(--spacing-none); + `:` + border-radius: var(--radius-xs); + gap: var(--spacing-xxxs); + `} + + /* Lozenge text size css */ + leading-trim: both; + text-edge: cap; + font-size: 18px; + font-style: normal; + font-weight: 500; + line-height: 16px; + + .icon > span { + height: 24px; + width: 24px; + } + `,StyledLozenge=qe$4.div` + /* Common Lozenge CSS */ + + align-items: center; + display: flex; + font-family: var(--font-family); + justify-content: center; + white-space: nowrap; + + /* Common icon css added through CSS class */ + .icon { + display: flex; + align-items: center; + justify-content: center; + } + + /* Lozenge variant CSS styles */ + ${({variant:Xr})=>getLozengeVariantStyles(Xr||"primary")} + + /* Lozenge and font size CSS styles */ + ${({iconOnly:Xr,size:eo})=>getLozengeSizeStyles({iconOnly:Xr,size:eo||"small"})} + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`,Lozenge=reactExports.forwardRef(({variant:Xr="primary",size:eo="small",icon:to,children:ro,...no},io)=>{const oo=!ro;return jsxRuntimeExports.jsxs(StyledLozenge,{role:"div",iconOnly:oo,ref:io,size:eo,variant:Xr,...no,children:[to&&jsxRuntimeExports.jsx("span",{className:"icon",children:to}),jsxRuntimeExports.jsx("span",{children:ro})]})});Lozenge.displayName="Lozenge";const menuCSSPropsKeys=["height","maxHeight","minHeight","maxWidth","minWidth","width"];qe$4.div.withConfig({shouldForwardProp:(Xr,eo)=>!menuCSSPropsKeys.includes(Xr)&&eo(Xr)})` + display: flex; + flex-direction: column; + background-color: var(--surface-primary); + border: var(--border-sm) solid var(--stroke-secondary); + border-radius: var(--radius-xs); + padding: var(--spacing-xxs); + margin: var(--spacing-none); + gap: var(--spacing-xs); + + /* Menu non-responsive styles */ + width: ${Xr=>Xr.width}; + min-width: ${Xr=>Xr.minWidth||"145px"}; + max-width: ${Xr=>Xr.maxWidth}; + height: ${Xr=>Xr.height}; + min-height: ${Xr=>Xr.minHeight}; + max-height: ${Xr=>Xr.maxHeight}; + + /* Extra CSS props */ + ${Xr=>Xr.css||""} +`;qe$4(Item2)` + // Menu default styles + padding: var(--spacing-none) var(--spacing-xxxs); + display: flex; + flex-direction: row; + flex: 1; + align-items: center; + gap: var(--spacing-xxxs); + border-radius: var(--radius-xxs); + + [role='img'] { + width: 24px; + height: 24px; + color: var(--components-list-item-icon-${({type:Xr})=>Xr||"default"}); + } + + &:hover { + background-color: var(--surface-secondary); + outline: none !important; + } + + cursor: pointer; + min-height: 32px; + + /* Extra CSS props */ + ${Xr=>Xr.css||""}; +`;qe$4.span` + color: var(--components-list-item-text-${({type:Xr})=>Xr||"default"}); + text-align: center; + + font-family: var(--font-family); + font-size: ${textVariants["bs-regular"].fontSize}; + font-style: ${textVariants["bs-regular"].fontStyle}; + font-weight: ${textVariants["bs-regular"].fontWeight}; + line-height: ${textVariants["bs-regular"].lineHeight}; +`;var DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope$3(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),TRIGGER_NAME$1="DialogTrigger",DialogTrigger=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,...ro}=Xr,no=useDialogContext(TRIGGER_NAME$1,to),io=useComposedRefs$1(eo,no.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":no.open,"aria-controls":no.contentId,"data-state":getState$1(no.open),...ro,ref:io,onClick:composeEventHandlers$1(Xr.onClick,no.onOpenToggle)})});DialogTrigger.displayName=TRIGGER_NAME$1;var PORTAL_NAME$1="DialogPortal",[PortalProvider$1,usePortalContext$1]=createDialogContext(PORTAL_NAME$1,{forceMount:void 0}),OVERLAY_NAME="DialogOverlay",DialogOverlay=reactExports.forwardRef((Xr,eo)=>{const to=usePortalContext$1(OVERLAY_NAME,Xr.__scopeDialog),{forceMount:ro=to.forceMount,...no}=Xr,io=useDialogContext(OVERLAY_NAME,Xr.__scopeDialog);return io.modal?jsxRuntimeExports.jsx(Presence,{present:ro||io.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...no,ref:eo})}):null});DialogOverlay.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,...ro}=Xr,no=useDialogContext(OVERLAY_NAME,to);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[no.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState$1(no.open),...ro,ref:eo,style:{pointerEvents:"auto",...ro.style}})})}),CONTENT_NAME$1="DialogContent",DialogContent=reactExports.forwardRef((Xr,eo)=>{const to=usePortalContext$1(CONTENT_NAME$1,Xr.__scopeDialog),{forceMount:ro=to.forceMount,...no}=Xr,io=useDialogContext(CONTENT_NAME$1,Xr.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:ro||io.open,children:io.modal?jsxRuntimeExports.jsx(DialogContentModal,{...no,ref:eo}):jsxRuntimeExports.jsx(DialogContentNonModal,{...no,ref:eo})})});DialogContent.displayName=CONTENT_NAME$1;var DialogContentModal=reactExports.forwardRef((Xr,eo)=>{const to=useDialogContext(CONTENT_NAME$1,Xr.__scopeDialog),ro=reactExports.useRef(null),no=useComposedRefs$1(eo,to.contentRef,ro);return reactExports.useEffect(()=>{const io=ro.current;if(io)return hideOthers(io)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...Xr,ref:no,trapFocus:to.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers$1(Xr.onCloseAutoFocus,io=>{var oo;io.preventDefault(),(oo=to.triggerRef.current)==null||oo.focus()}),onPointerDownOutside:composeEventHandlers$1(Xr.onPointerDownOutside,io=>{const oo=io.detail.originalEvent,ao=oo.button===0&&oo.ctrlKey===!0;(oo.button===2||ao)&&io.preventDefault()}),onFocusOutside:composeEventHandlers$1(Xr.onFocusOutside,io=>io.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((Xr,eo)=>{const to=useDialogContext(CONTENT_NAME$1,Xr.__scopeDialog),ro=reactExports.useRef(!1),no=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...Xr,ref:eo,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:io=>{var oo,ao;(oo=Xr.onCloseAutoFocus)==null||oo.call(Xr,io),io.defaultPrevented||(ro.current||(ao=to.triggerRef.current)==null||ao.focus(),io.preventDefault()),ro.current=!1,no.current=!1},onInteractOutside:io=>{var so,co;(so=Xr.onInteractOutside)==null||so.call(Xr,io),io.defaultPrevented||(ro.current=!0,io.detail.originalEvent.type==="pointerdown"&&(no.current=!0));const oo=io.target;((co=to.triggerRef.current)==null?void 0:co.contains(oo))&&io.preventDefault(),io.detail.originalEvent.type==="focusin"&&no.current&&io.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,trapFocus:ro,onOpenAutoFocus:no,onCloseAutoFocus:io,...oo}=Xr,ao=useDialogContext(CONTENT_NAME$1,to),so=reactExports.useRef(null),co=useComposedRefs$1(eo,so);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:ro,onMountAutoFocus:no,onUnmountAutoFocus:io,children:jsxRuntimeExports.jsx(DismissableLayer,{role:"dialog",id:ao.contentId,"aria-describedby":ao.descriptionId,"aria-labelledby":ao.titleId,"data-state":getState$1(ao.open),...oo,ref:co,onDismiss:()=>ao.onOpenChange(!1)})}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TitleWarning,{titleId:ao.titleId}),jsxRuntimeExports.jsx(DescriptionWarning,{contentRef:so,descriptionId:ao.descriptionId})]})]})}),TITLE_NAME="DialogTitle",DialogTitle=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,...ro}=Xr,no=useDialogContext(TITLE_NAME,to);return jsxRuntimeExports.jsx(Primitive.h2,{id:no.titleId,...ro,ref:eo})});DialogTitle.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,...ro}=Xr,no=useDialogContext(DESCRIPTION_NAME,to);return jsxRuntimeExports.jsx(Primitive.p,{id:no.descriptionId,...ro,ref:eo})});DialogDescription.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((Xr,eo)=>{const{__scopeDialog:to,...ro}=Xr,no=useDialogContext(CLOSE_NAME,to);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...ro,ref:eo,onClick:composeEventHandlers$1(Xr.onClick,()=>no.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState$1(Xr){return Xr?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2$1(TITLE_WARNING_NAME,{contentName:CONTENT_NAME$1,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:Xr})=>{const eo=useWarningContext(TITLE_WARNING_NAME),to=`\`${eo.contentName}\` requires a \`${eo.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${eo.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${eo.docsSlug}`;return reactExports.useEffect(()=>{Xr&&(document.getElementById(Xr)||console.error(to))},[to,Xr]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning=({contentRef:Xr,descriptionId:eo})=>{const ro=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return reactExports.useEffect(()=>{var io;const no=(io=Xr.current)==null?void 0:io.getAttribute("aria-describedby");eo&&no&&(document.getElementById(eo)||console.warn(ro))},[ro,Xr,eo]),null},Overlay=DialogOverlay,Content=DialogContent;qe$4(Overlay)` + background: var(--surface-glass-bold); + backdrop-filter: blur(calc(var(--blur-lg) / 2)); + position: fixed; + inset: 0; + z-index: 1000; +`;qe$4(Content)` + display: flex; + border-radius: var(--radius-sm); + border: var(--border-sm) solid var(--stroke-secondary); + background: var(--components-modal-background-default); + padding: var(--spacing-${({size:Xr})=>Xr==="small"?"xs":"sm"}); + flex-direction: column; + align-items: flex-start; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + min-width: 300px; + width: ${({size:Xr})=>Xr==="small"?"360px":Xr==="medium"?"500px":"700px"}; + gap: var(--spacing-sm); + z-index: 1100; + @media ${deviceMediaQ.mobileL} { + width: 80%; + } +`;qe$4.div` + display: flex; + flex-direction: column; + align-items: flex-start; + flex: 1 0 0; + width: 100%; + padding-top: var( + --spacing-${({size:Xr})=>Xr==="small"?"xxs":"xs"} + ); +`;qe$4.div` + position: relative; + width: 100%; +`;qe$4.div` + cursor: pointer; + color: var(--components-modal-icon-default); + padding: var(--spacing-none); + position: absolute; + left: 0; + top: 0; +`;qe$4.div` + background-color: var(--surface-transparent); + cursor: pointer; + color: var(--components-modal-icon-default); + padding: var(--spacing-none); + position: absolute; + right: 0; + top: 0; +`;qe$4.div` + display: flex; + padding: var(--spacing-xxs); + justify-content: center; + align-items: center; + gap: var(--spacing-xs); + align-self: ${({buttonAlignment:Xr})=>Xr==="end"?"flex-end":"center"}; +`;qe$4.div` + display: flex; + padding: var(--spacing-none); + align-items: flex-start; + gap: var(--spacing-xxxs); + margin-top: ${({size:Xr})=>Xr==="small"?"-24px":"-28px"}; + + [role='img'] { + color: var(--${({iconColor:Xr})=>Xr}); + } +`;qe$4.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: var(--spacing-xxxs); + flex: 1 0 0; +`;qe$4.p` + ${({size:Xr})=>getTextVariantStyles(Xr==="small"?"h5-semibold":Xr==="medium"?"h4-semibold":"h3-semibold","components-modal-text-default")} +`;qe$4.div` + ${({size:Xr})=>getTextVariantStyles(Xr==="small"?"bes-regular":Xr==="medium"?"bs-regular":"bm-regular","components-modal-text-secondary")} +`;var It$3=Xr=>{switch(Xr){case"success":return Ut$3;case"info":return Kt$4;case"warning":return Ot$4;case"error":return Jt$4;default:return null}},_t$3=Array(12).fill(0),kt$3=({visible:Xr,className:eo})=>React.createElement("div",{className:["sonner-loading-wrapper",eo].filter(Boolean).join(" "),"data-visible":Xr},React.createElement("div",{className:"sonner-spinner"},_t$3.map((to,ro)=>React.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${ro}`})))),Ut$3=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},React.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Ot$4=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},React.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Kt$4=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},React.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Jt$4=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},React.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Dt$3=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},React.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),React.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Mt$3=()=>{let[Xr,eo]=React.useState(document.hidden);return React.useEffect(()=>{let to=()=>{eo(document.hidden)};return document.addEventListener("visibilitychange",to),()=>window.removeEventListener("visibilitychange",to)},[]),Xr},mt$4=1,pt$4=class{constructor(){this.subscribe=eo=>(this.subscribers.push(eo),()=>{let to=this.subscribers.indexOf(eo);this.subscribers.splice(to,1)}),this.publish=eo=>{this.subscribers.forEach(to=>to(eo))},this.addToast=eo=>{this.publish(eo),this.toasts=[...this.toasts,eo]},this.create=eo=>{var to;let{message:ro,...no}=eo,io=typeof(eo==null?void 0:eo.id)=="number"||((to=eo.id)==null?void 0:to.length)>0?eo.id:mt$4++,oo=this.toasts.find(so=>so.id===io),ao=eo.dismissible===void 0?!0:eo.dismissible;return oo?this.toasts=this.toasts.map(so=>so.id===io?(this.publish({...so,...eo,id:io,title:ro}),{...so,...eo,id:io,dismissible:ao,title:ro}):so):this.addToast({title:ro,...no,dismissible:ao,id:io}),io},this.dismiss=eo=>(eo||this.toasts.forEach(to=>{this.subscribers.forEach(ro=>ro({id:to.id,dismiss:!0}))}),this.subscribers.forEach(to=>to({id:eo,dismiss:!0})),eo),this.message=(eo,to)=>this.create({...to,message:eo}),this.error=(eo,to)=>this.create({...to,message:eo,type:"error"}),this.success=(eo,to)=>this.create({...to,type:"success",message:eo}),this.info=(eo,to)=>this.create({...to,type:"info",message:eo}),this.warning=(eo,to)=>this.create({...to,type:"warning",message:eo}),this.loading=(eo,to)=>this.create({...to,type:"loading",message:eo}),this.promise=(eo,to)=>{if(!to)return;let ro;to.loading!==void 0&&(ro=this.create({...to,promise:eo,type:"loading",message:to.loading,description:typeof to.description!="function"?to.description:void 0}));let no=eo instanceof Promise?eo:eo(),io=ro!==void 0,oo,ao=no.then(async co=>{if(oo=["resolve",co],React.isValidElement(co))io=!1,this.create({id:ro,type:"default",message:co});else if(Qt$3(co)&&!co.ok){io=!1;let lo=typeof to.error=="function"?await to.error(`HTTP error! status: ${co.status}`):to.error,uo=typeof to.description=="function"?await to.description(`HTTP error! status: ${co.status}`):to.description;this.create({id:ro,type:"error",message:lo,description:uo})}else if(to.success!==void 0){io=!1;let lo=typeof to.success=="function"?await to.success(co):to.success,uo=typeof to.description=="function"?await to.description(co):to.description;this.create({id:ro,type:"success",message:lo,description:uo})}}).catch(async co=>{if(oo=["reject",co],to.error!==void 0){io=!1;let lo=typeof to.error=="function"?await to.error(co):to.error,uo=typeof to.description=="function"?await to.description(co):to.description;this.create({id:ro,type:"error",message:lo,description:uo})}}).finally(()=>{var co;io&&(this.dismiss(ro),ro=void 0),(co=to.finally)==null||co.call(to)}),so=()=>new Promise((co,lo)=>ao.then(()=>oo[0]==="reject"?lo(oo[1]):co(oo[1])).catch(lo));return typeof ro!="string"&&typeof ro!="number"?{unwrap:so}:Object.assign(ro,{unwrap:so})},this.custom=(eo,to)=>{let ro=(to==null?void 0:to.id)||mt$4++;return this.create({jsx:eo(ro),id:ro,...to}),ro},this.subscribers=[],this.toasts=[]}},v$a=new pt$4,Gt$4=(Xr,eo)=>{let to=(eo==null?void 0:eo.id)||mt$4++;return v$a.addToast({title:Xr,...eo,id:to}),to},Qt$3=Xr=>Xr&&typeof Xr=="object"&&"ok"in Xr&&typeof Xr.ok=="boolean"&&"status"in Xr&&typeof Xr.status=="number",qt$4=Gt$4,Zt$3=()=>v$a.toasts;Object.assign(qt$4,{success:v$a.success,info:v$a.info,warning:v$a.warning,error:v$a.error,custom:v$a.custom,message:v$a.message,promise:v$a.promise,dismiss:v$a.dismiss,loading:v$a.loading},{getHistory:Zt$3});function gt$4(Xr,{insertAt:eo}={}){if(typeof document>"u")return;let to=document.head||document.getElementsByTagName("head")[0],ro=document.createElement("style");ro.type="text/css",eo==="top"&&to.firstChild?to.insertBefore(ro,to.firstChild):to.appendChild(ro),ro.styleSheet?ro.styleSheet.cssText=Xr:ro.appendChild(document.createTextNode(Xr))}gt$4(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function O$b(Xr){return Xr.label!==void 0}var ae$5=3,ne$2="32px",At$2=4e3,re$3=356,se$2=14,ie$4=20,le$5=200;function de$5(...Xr){return Xr.filter(Boolean).join(" ")}var ce$6=Xr=>{var eo,to,ro,no,io,oo,ao,so,co,lo,uo;let{invert:ho,toast:go,unstyled:bo,interacting:wo,setHeights:Eo,visibleToasts:$o,heights:Co,index:Ro,toasts:Oo,expanded:jo,removeToast:Bo,defaultRichColors:Mo,closeButton:Fo,style:Wo,cancelButtonStyle:Jo,actionButtonStyle:Po,className:fo="",descriptionClassName:yo="",duration:vo,position:_o,gap:So,loadingIcon:To,expandByDefault:Ao,classNames:ko,icons:mo,closeButtonAriaLabel:Io="Close toast",pauseWhenPageIsHidden:Do,cn:Lo}=Xr,[Ho,Yo]=React.useState(!1),[Xo,qo]=React.useState(!1),[Ko,Qo]=React.useState(!1),[zo,ga]=React.useState(!1),[$a,Sl]=React.useState(!1),[El,Tl]=React.useState(0),[Il,Zl]=React.useState(0),Vl=React.useRef(go.duration||vo||At$2),Ol=React.useRef(null),Dl=React.useRef(null),Fl=Ro===0,Jl=Ro+1<=$o,cu=go.type,Ll=go.dismissible!==!1,Xl=go.className||"",ku=go.descriptionClassName||"",iu=React.useMemo(()=>Co.findIndex(Au=>Au.toastId===go.id)||0,[Co,go.id]),hu=React.useMemo(()=>{var Au;return(Au=go.closeButton)!=null?Au:Fo},[go.closeButton,Fo]);React.useMemo(()=>go.duration||vo||At$2,[go.duration,vo]);let Cu=React.useRef(0),_l=React.useRef(0),Go=React.useRef(0),yl=React.useRef(null),[Al,Ul]=_o.split("-"),su=React.useMemo(()=>Co.reduce((Au,yu,wu)=>wu>=iu?Au:Au+yu.height,0),[Co,iu]),Ql=Mt$3(),vu=go.invert||ho,qu=cu==="loading";_l.current=React.useMemo(()=>iu*So+su,[iu,su]),React.useEffect(()=>{Yo(!0)},[]),React.useEffect(()=>{let Au=Dl.current;if(Au){let yu=Au.getBoundingClientRect().height;return Zl(yu),Eo(wu=>[{toastId:go.id,height:yu,position:go.position},...wu]),()=>Eo(wu=>wu.filter(Gu=>Gu.toastId!==go.id))}},[Eo,go.id]),React.useLayoutEffect(()=>{if(!Ho)return;let Au=Dl.current,yu=Au.style.height;Au.style.height="auto";let wu=Au.getBoundingClientRect().height;Au.style.height=yu,Zl(wu),Eo(Gu=>Gu.find(Ml=>Ml.toastId===go.id)?Gu.map(Ml=>Ml.toastId===go.id?{...Ml,height:wu}:Ml):[{toastId:go.id,height:wu,position:go.position},...Gu])},[Ho,go.title,go.description,Eo,go.id]);let pu=React.useCallback(()=>{qo(!0),Tl(_l.current),Eo(Au=>Au.filter(yu=>yu.toastId!==go.id)),setTimeout(()=>{Bo(go)},le$5)},[go,Bo,Eo,_l]);React.useEffect(()=>{if(go.promise&&cu==="loading"||go.duration===1/0||go.type==="loading")return;let Au;return jo||wo||Do&&Ql?(()=>{if(Go.current{var yu;(yu=go.onAutoClose)==null||yu.call(go,go),pu()},Vl.current)),()=>clearTimeout(Au)},[jo,wo,go,cu,Do,Ql,pu]),React.useEffect(()=>{go.delete&&pu()},[pu,go.delete]);function xu(){var Au,yu,wu;return mo!=null&&mo.loading?React.createElement("div",{className:Lo(ko==null?void 0:ko.loader,(Au=go==null?void 0:go.classNames)==null?void 0:Au.loader,"sonner-loader"),"data-visible":cu==="loading"},mo.loading):To?React.createElement("div",{className:Lo(ko==null?void 0:ko.loader,(yu=go==null?void 0:go.classNames)==null?void 0:yu.loader,"sonner-loader"),"data-visible":cu==="loading"},To):React.createElement(kt$3,{className:Lo(ko==null?void 0:ko.loader,(wu=go==null?void 0:go.classNames)==null?void 0:wu.loader),visible:cu==="loading"})}return React.createElement("li",{tabIndex:0,ref:Dl,className:Lo(fo,Xl,ko==null?void 0:ko.toast,(eo=go==null?void 0:go.classNames)==null?void 0:eo.toast,ko==null?void 0:ko.default,ko==null?void 0:ko[cu],(to=go==null?void 0:go.classNames)==null?void 0:to[cu]),"data-sonner-toast":"","data-rich-colors":(ro=go.richColors)!=null?ro:Mo,"data-styled":!(go.jsx||go.unstyled||bo),"data-mounted":Ho,"data-promise":!!go.promise,"data-swiped":$a,"data-removed":Xo,"data-visible":Jl,"data-y-position":Al,"data-x-position":Ul,"data-index":Ro,"data-front":Fl,"data-swiping":Ko,"data-dismissible":Ll,"data-type":cu,"data-invert":vu,"data-swipe-out":zo,"data-expanded":!!(jo||Ao&&Ho),style:{"--index":Ro,"--toasts-before":Ro,"--z-index":Oo.length-Ro,"--offset":`${Xo?El:_l.current}px`,"--initial-height":Ao?"auto":`${Il}px`,...Wo,...go.style},onPointerDown:Au=>{qu||!Ll||(Ol.current=new Date,Tl(_l.current),Au.target.setPointerCapture(Au.pointerId),Au.target.tagName!=="BUTTON"&&(Qo(!0),yl.current={x:Au.clientX,y:Au.clientY}))},onPointerUp:()=>{var Au,yu,wu,Gu;if(zo||!Ll)return;yl.current=null;let Ml=Number(((Au=Dl.current)==null?void 0:Au.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Nl=new Date().getTime()-((yu=Ol.current)==null?void 0:yu.getTime()),Yl=Math.abs(Ml)/Nl;if(Math.abs(Ml)>=ie$4||Yl>.11){Tl(_l.current),(wu=go.onDismiss)==null||wu.call(go,go),pu(),ga(!0),Sl(!1);return}(Gu=Dl.current)==null||Gu.style.setProperty("--swipe-amount","0px"),Qo(!1)},onPointerMove:Au=>{var yu,wu,Gu;if(!yl.current||!Ll)return;let Ml=Au.clientY-yl.current.y,Nl=((yu=window.getSelection())==null?void 0:yu.toString().length)>0;Number(((wu=Dl.current)==null?void 0:wu.style.getPropertyValue("--swipe-amount").replace("px",""))||0)>0&&Sl(!0),!Nl&&((Gu=Dl.current)==null||Gu.style.setProperty("--swipe-amount",`${Math.max(0,Ml)}px`))}},hu&&!go.jsx?React.createElement("button",{"aria-label":Io,"data-disabled":qu,"data-close-button":!0,onClick:qu||!Ll?()=>{}:()=>{var Au;pu(),(Au=go.onDismiss)==null||Au.call(go,go)},className:Lo(ko==null?void 0:ko.closeButton,(no=go==null?void 0:go.classNames)==null?void 0:no.closeButton)},(io=mo==null?void 0:mo.close)!=null?io:Dt$3):null,go.jsx||React.isValidElement(go.title)?go.jsx?go.jsx:typeof go.title=="function"?go.title():go.title:React.createElement(React.Fragment,null,cu||go.icon||go.promise?React.createElement("div",{"data-icon":"",className:Lo(ko==null?void 0:ko.icon,(oo=go==null?void 0:go.classNames)==null?void 0:oo.icon)},go.promise||go.type==="loading"&&!go.icon?go.icon||xu():null,go.type!=="loading"?go.icon||(mo==null?void 0:mo[cu])||It$3(cu):null):null,React.createElement("div",{"data-content":"",className:Lo(ko==null?void 0:ko.content,(ao=go==null?void 0:go.classNames)==null?void 0:ao.content)},React.createElement("div",{"data-title":"",className:Lo(ko==null?void 0:ko.title,(so=go==null?void 0:go.classNames)==null?void 0:so.title)},typeof go.title=="function"?go.title():go.title),go.description?React.createElement("div",{"data-description":"",className:Lo(yo,ku,ko==null?void 0:ko.description,(co=go==null?void 0:go.classNames)==null?void 0:co.description)},typeof go.description=="function"?go.description():go.description):null),React.isValidElement(go.cancel)?go.cancel:go.cancel&&O$b(go.cancel)?React.createElement("button",{"data-button":!0,"data-cancel":!0,style:go.cancelButtonStyle||Jo,onClick:Au=>{var yu,wu;O$b(go.cancel)&&Ll&&((wu=(yu=go.cancel).onClick)==null||wu.call(yu,Au),pu())},className:Lo(ko==null?void 0:ko.cancelButton,(lo=go==null?void 0:go.classNames)==null?void 0:lo.cancelButton)},go.cancel.label):null,React.isValidElement(go.action)?go.action:go.action&&O$b(go.action)?React.createElement("button",{"data-button":!0,"data-action":!0,style:go.actionButtonStyle||Po,onClick:Au=>{var yu,wu;O$b(go.action)&&((wu=(yu=go.action).onClick)==null||wu.call(yu,Au),!Au.defaultPrevented&&pu())},className:Lo(ko==null?void 0:ko.actionButton,(uo=go==null?void 0:go.classNames)==null?void 0:uo.actionButton)},go.action.label):null))};function Lt$3(){if(typeof window>"u"||typeof document>"u")return"ltr";let Xr=document.documentElement.getAttribute("dir");return Xr==="auto"||!Xr?window.getComputedStyle(document.documentElement).direction:Xr}var Be$4=reactExports.forwardRef(function(Xr,eo){let{invert:to,position:ro="bottom-right",hotkey:no=["altKey","KeyT"],expand:io,closeButton:oo,className:ao,offset:so,theme:co="light",richColors:lo,duration:uo,style:ho,visibleToasts:go=ae$5,toastOptions:bo,dir:wo=Lt$3(),gap:Eo=se$2,loadingIcon:$o,icons:Co,containerAriaLabel:Ro="Notifications",pauseWhenPageIsHidden:Oo,cn:jo=de$5}=Xr,[Bo,Mo]=React.useState([]),Fo=React.useMemo(()=>Array.from(new Set([ro].concat(Bo.filter(Do=>Do.position).map(Do=>Do.position)))),[Bo,ro]),[Wo,Jo]=React.useState([]),[Po,fo]=React.useState(!1),[yo,vo]=React.useState(!1),[_o,So]=React.useState(co!=="system"?co:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),To=React.useRef(null),Ao=no.join("+").replace(/Key/g,"").replace(/Digit/g,""),ko=React.useRef(null),mo=React.useRef(!1),Io=React.useCallback(Do=>{Mo(Lo=>{var Ho;return(Ho=Lo.find(Yo=>Yo.id===Do.id))!=null&&Ho.delete||v$a.dismiss(Do.id),Lo.filter(({id:Yo})=>Yo!==Do.id)})},[]);return React.useEffect(()=>v$a.subscribe(Do=>{if(Do.dismiss){Mo(Lo=>Lo.map(Ho=>Ho.id===Do.id?{...Ho,delete:!0}:Ho));return}setTimeout(()=>{oe$5.flushSync(()=>{Mo(Lo=>{let Ho=Lo.findIndex(Yo=>Yo.id===Do.id);return Ho!==-1?[...Lo.slice(0,Ho),{...Lo[Ho],...Do},...Lo.slice(Ho+1)]:[Do,...Lo]})})})}),[]),React.useEffect(()=>{if(co!=="system"){So(co);return}if(co==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?So("dark"):So("light")),typeof window>"u")return;let Do=window.matchMedia("(prefers-color-scheme: dark)");try{Do.addEventListener("change",({matches:Lo})=>{So(Lo?"dark":"light")})}catch{Do.addListener(({matches:Ho})=>{try{So(Ho?"dark":"light")}catch(Yo){console.error(Yo)}})}},[co]),React.useEffect(()=>{Bo.length<=1&&fo(!1)},[Bo]),React.useEffect(()=>{let Do=Lo=>{var Ho,Yo;no.every(Xo=>Lo[Xo]||Lo.code===Xo)&&(fo(!0),(Ho=To.current)==null||Ho.focus()),Lo.code==="Escape"&&(document.activeElement===To.current||(Yo=To.current)!=null&&Yo.contains(document.activeElement))&&fo(!1)};return document.addEventListener("keydown",Do),()=>document.removeEventListener("keydown",Do)},[no]),React.useEffect(()=>{if(To.current)return()=>{ko.current&&(ko.current.focus({preventScroll:!0}),ko.current=null,mo.current=!1)}},[To.current]),React.createElement("section",{"aria-label":`${Ro} ${Ao}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false"},Fo.map((Do,Lo)=>{var Ho;let[Yo,Xo]=Do.split("-");return Bo.length?React.createElement("ol",{key:Do,dir:wo==="auto"?Lt$3():wo,tabIndex:-1,ref:To,className:ao,"data-sonner-toaster":!0,"data-theme":_o,"data-y-position":Yo,"data-lifted":Po&&Bo.length>1&&!io,"data-x-position":Xo,style:{"--front-toast-height":`${((Ho=Wo[0])==null?void 0:Ho.height)||0}px`,"--offset":typeof so=="number"?`${so}px`:so||ne$2,"--width":`${re$3}px`,"--gap":`${Eo}px`,...ho},onBlur:qo=>{mo.current&&!qo.currentTarget.contains(qo.relatedTarget)&&(mo.current=!1,ko.current&&(ko.current.focus({preventScroll:!0}),ko.current=null))},onFocus:qo=>{qo.target instanceof HTMLElement&&qo.target.dataset.dismissible==="false"||mo.current||(mo.current=!0,ko.current=qo.relatedTarget)},onMouseEnter:()=>fo(!0),onMouseMove:()=>fo(!0),onMouseLeave:()=>{yo||fo(!1)},onPointerDown:qo=>{qo.target instanceof HTMLElement&&qo.target.dataset.dismissible==="false"||vo(!0)},onPointerUp:()=>vo(!1)},Bo.filter(qo=>!qo.position&&Lo===0||qo.position===Do).map((qo,Ko)=>{var Qo,zo;return React.createElement(ce$6,{key:qo.id,icons:Co,index:Ko,toast:qo,defaultRichColors:lo,duration:(Qo=bo==null?void 0:bo.duration)!=null?Qo:uo,className:bo==null?void 0:bo.className,descriptionClassName:bo==null?void 0:bo.descriptionClassName,invert:to,visibleToasts:go,closeButton:(zo=bo==null?void 0:bo.closeButton)!=null?zo:oo,interacting:yo,position:Do,style:bo==null?void 0:bo.style,unstyled:bo==null?void 0:bo.unstyled,classNames:bo==null?void 0:bo.classNames,cancelButtonStyle:bo==null?void 0:bo.cancelButtonStyle,actionButtonStyle:bo==null?void 0:bo.actionButtonStyle,removeToast:Io,toasts:Bo.filter(ga=>ga.position==qo.position),heights:Wo.filter(ga=>ga.position==qo.position),setHeights:Jo,expandByDefault:io,gap:Eo,loadingIcon:$o,expanded:Po,pauseWhenPageIsHidden:Oo,cn:jo})})):null}))});qe$4.div` + position: relative; + background-color: var(--components-in-app-notification-background-default); + border-radius: var(--radius-xxs); + box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.05); + display: flex; + flex-direction: row; + align-items: stretch; + height: 111px; + width: 397px; + cursor: pointer; + box-sizing: border-box; + border: var(--border-sm) solid var(--components-in-app-notification-stroke-bg); + overflow: hidden; + @media${deviceMediaQ.mobileL} { + width: -webkit-fill-available; + } +`;qe$4(Be$4)` + width: 397px; + @media${deviceMediaQ.mobileL} { + width: 100%; + } +`;qe$4.div` + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; + padding: var(--spacing-sm); + flex: 1; + box-sizing: border-box; +`;qe$4.span` + ${()=>getTextVariantStyles("h5-semibold","components-in-app-notification-text-default")} +`;qe$4.span` + ${()=>getTextVariantStyles("bes-regular","components-in-app-notification-text-secondary")} + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + line-clamp: 3; + -webkit-box-orient: vertical; +`;qe$4.div` + padding: var(--spacing-sm) var(--spacing-xs); + border-radius: var(--radius-xxs) var(--radius-none) var(--radius-none) + var(--radius-xxs); + background: radial-gradient( + 79.55% 79.55% at 50% 50%, + #344efd 0%, + #171717 100% + ); +`;qe$4.div` + background-color: var(--surface-transparent); + cursor: pointer; + color: var(--components-in-app-notification-icon-default); + padding: var(--spacing-none); + position: absolute; + right: var(--spacing-xxs); + top: var(--spacing-xxs); +`;qe$4.div``;function _typeof$4(Xr){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(eo){return typeof eo}:function(eo){return eo&&typeof Symbol=="function"&&eo.constructor===Symbol&&eo!==Symbol.prototype?"symbol":typeof eo},_typeof$4(Xr)}function toPrimitive(Xr,eo){if(_typeof$4(Xr)!="object"||!Xr)return Xr;var to=Xr[Symbol.toPrimitive];if(to!==void 0){var ro=to.call(Xr,eo||"default");if(_typeof$4(ro)!="object")return ro;throw new TypeError("@@toPrimitive must return a primitive value.")}return(eo==="string"?String:Number)(Xr)}function toPropertyKey(Xr){var eo=toPrimitive(Xr,"string");return _typeof$4(eo)=="symbol"?eo:eo+""}function _defineProperty$2(Xr,eo,to){return(eo=toPropertyKey(eo))in Xr?Object.defineProperty(Xr,eo,{value:to,enumerable:!0,configurable:!0,writable:!0}):Xr[eo]=to,Xr}function _extends$1n(){return _extends$1n=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eoXr.length)&&(eo=Xr.length);for(var to=0,ro=Array(eo);to=KeyCode.F1&&to<=KeyCode.F12)return!1;switch(to){case KeyCode.ALT:case KeyCode.CAPS_LOCK:case KeyCode.CONTEXT_MENU:case KeyCode.CTRL:case KeyCode.DOWN:case KeyCode.END:case KeyCode.ESC:case KeyCode.HOME:case KeyCode.INSERT:case KeyCode.LEFT:case KeyCode.MAC_FF_META:case KeyCode.META:case KeyCode.NUMLOCK:case KeyCode.NUM_CENTER:case KeyCode.PAGE_DOWN:case KeyCode.PAGE_UP:case KeyCode.PAUSE:case KeyCode.PRINT_SCREEN:case KeyCode.RIGHT:case KeyCode.SHIFT:case KeyCode.UP:case KeyCode.WIN_KEY:case KeyCode.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(eo){if(eo>=KeyCode.ZERO&&eo<=KeyCode.NINE||eo>=KeyCode.NUM_ZERO&&eo<=KeyCode.NUM_MULTIPLY||eo>=KeyCode.A&&eo<=KeyCode.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&eo===0)return!0;switch(eo){case KeyCode.SPACE:case KeyCode.QUESTION_MARK:case KeyCode.NUM_PLUS:case KeyCode.NUM_MINUS:case KeyCode.NUM_PERIOD:case KeyCode.NUM_DIVISION:case KeyCode.SEMICOLON:case KeyCode.DASH:case KeyCode.EQUALS:case KeyCode.COMMA:case KeyCode.PERIOD:case KeyCode.SLASH:case KeyCode.APOSTROPHE:case KeyCode.SINGLE_QUOTE:case KeyCode.OPEN_SQUARE_BRACKET:case KeyCode.BACKSLASH:case KeyCode.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}},attributes=`accept acceptCharset accessKey action allowFullScreen allowTransparency + alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge + charSet checked classID className colSpan cols content contentEditable contextMenu + controls coords crossOrigin data dateTime default defer dir disabled download draggable + encType form formAction formEncType formMethod formNoValidate formTarget frameBorder + headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity + is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media + mediaGroup method min minLength multiple muted name noValidate nonce open + optimum pattern placeholder poster preload radioGroup readOnly rel required + reversed role rowSpan rows sandbox scope scoped scrolling seamless selected + shape size sizes span spellCheck src srcDoc srcLang srcSet start step style + summary tabIndex target title type useMap value width wmode wrap`,eventsName=`onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown + onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick + onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown + onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel + onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough + onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,propList="".concat(attributes," ").concat(eventsName).split(/[\s\n]+/),ariaPrefix="aria-",dataPrefix="data-";function match$1(Xr,eo){return Xr.indexOf(eo)===0}function pickAttrs(Xr){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,to;eo===!1?to={aria:!0,data:!0,attr:!0}:eo===!0?to={aria:!0}:to=_objectSpread2({},eo);var ro={};return Object.keys(Xr).forEach(function(no){(to.aria&&(no==="role"||match$1(no,ariaPrefix))||to.data&&match$1(no,dataPrefix)||to.attr&&propList.includes(no))&&(ro[no]=Xr[no])}),ro}var locale$1={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},defaultPageSizeOptions=["10","20","50","100"],Options=function(eo){var to=eo.pageSizeOptions,ro=to===void 0?defaultPageSizeOptions:to,no=eo.locale,io=eo.changeSize,oo=eo.pageSize,ao=eo.goButton,so=eo.quickGo,co=eo.rootPrefixCls,lo=eo.selectComponentClass,uo=eo.selectPrefixCls,ho=eo.disabled,go=eo.buildOptionText,bo=eo.showSizeChanger,wo=React.useState(""),Eo=_slicedToArray(wo,2),$o=Eo[0],Co=Eo[1],Ro=function(){return!$o||Number.isNaN($o)?void 0:Number($o)},Oo=typeof go=="function"?go:function(Ao){return"".concat(Ao," ").concat(no.items_per_page)},jo=function(ko,mo){if(io==null||io(Number(ko)),_typeof$4(bo)==="object"){var Io;(Io=bo.onChange)===null||Io===void 0||Io.call(bo,ko,mo)}},Bo=function(ko){Co(ko.target.value)},Mo=function(ko){ao||$o===""||(Co(""),!(ko.relatedTarget&&(ko.relatedTarget.className.indexOf("".concat(co,"-item-link"))>=0||ko.relatedTarget.className.indexOf("".concat(co,"-item"))>=0))&&(so==null||so(Ro())))},Fo=function(ko){$o!==""&&(ko.keyCode===KeyCode.ENTER||ko.type==="click")&&(Co(""),so==null||so(Ro()))},Wo=function(){return ro.some(function(ko){return ko.toString()===oo.toString()})?ro:ro.concat([oo.toString()]).sort(function(ko,mo){var Io=Number.isNaN(Number(ko))?0:Number(ko),Do=Number.isNaN(Number(mo))?0:Number(mo);return Io-Do})},Jo="".concat(co,"-options");if(!bo&&!so)return null;var Po=null,fo=null,yo=null;if(bo&&lo){var vo=_typeof$4(bo)==="object"?bo:{},_o=vo.options,So=vo.className,To=_o?void 0:Wo().map(function(Ao,ko){return React.createElement(lo.Option,{key:ko,value:Ao.toString()},Oo(Ao))});Po=React.createElement(lo,_extends$1n({disabled:ho,prefixCls:uo,showSearch:!1,optionLabelProp:_o?"label":"children",popupMatchSelectWidth:!1,value:(oo||ro[0]).toString(),getPopupContainer:function(ko){return ko.parentNode},"aria-label":no.page_size,defaultOpen:!1},_typeof$4(bo)==="object"?bo:null,{className:classNames$1("".concat(Jo,"-size-changer"),So),options:_o,onChange:jo}),To)}return so&&(ao&&(yo=typeof ao=="boolean"?React.createElement("button",{type:"button",onClick:Fo,onKeyUp:Fo,disabled:ho,className:"".concat(Jo,"-quick-jumper-button")},no.jump_to_confirm):React.createElement("span",{onClick:Fo,onKeyUp:Fo},ao)),fo=React.createElement("div",{className:"".concat(Jo,"-quick-jumper")},no.jump_to,React.createElement("input",{disabled:ho,type:"text",value:$o,onChange:Bo,onKeyUp:Fo,onBlur:Mo,"aria-label":no.page}),no.page,yo)),React.createElement("li",{className:Jo},Po,fo)},Pager=function(eo){var to=eo.rootPrefixCls,ro=eo.page,no=eo.active,io=eo.className,oo=eo.showTitle,ao=eo.onClick,so=eo.onKeyPress,co=eo.itemRender,lo="".concat(to,"-item"),uo=classNames$1(lo,"".concat(lo,"-").concat(ro),_defineProperty$2(_defineProperty$2({},"".concat(lo,"-active"),no),"".concat(lo,"-disabled"),!ro),io),ho=function(){ao(ro)},go=function(Eo){so(Eo,ao,ro)},bo=co(ro,"page",React.createElement("a",{rel:"nofollow"},ro));return bo?React.createElement("li",{title:oo?String(ro):null,className:uo,onClick:ho,onKeyDown:go,tabIndex:0},bo):null},defaultItemRender=function(eo,to,ro){return ro};function noop$a(){}function isInteger$3(Xr){var eo=Number(Xr);return typeof eo=="number"&&!Number.isNaN(eo)&&isFinite(eo)&&Math.floor(eo)===eo}function calculatePage(Xr,eo,to){var ro=typeof Xr>"u"?eo:Xr;return Math.floor((to-1)/ro)+1}var Pagination=function(eo){var to=eo.prefixCls,ro=to===void 0?"rc-pagination":to,no=eo.selectPrefixCls,io=no===void 0?"rc-select":no,oo=eo.className,ao=eo.selectComponentClass,so=eo.current,co=eo.defaultCurrent,lo=co===void 0?1:co,uo=eo.total,ho=uo===void 0?0:uo,go=eo.pageSize,bo=eo.defaultPageSize,wo=bo===void 0?10:bo,Eo=eo.onChange,$o=Eo===void 0?noop$a:Eo,Co=eo.hideOnSinglePage,Ro=eo.align,Oo=eo.showPrevNextJumpers,jo=Oo===void 0?!0:Oo,Bo=eo.showQuickJumper,Mo=eo.showLessItems,Fo=eo.showTitle,Wo=Fo===void 0?!0:Fo,Jo=eo.onShowSizeChange,Po=Jo===void 0?noop$a:Jo,fo=eo.locale,yo=fo===void 0?locale$1:fo,vo=eo.style,_o=eo.totalBoundaryShowSizeChanger,So=_o===void 0?50:_o,To=eo.disabled,Ao=eo.simple,ko=eo.showTotal,mo=eo.showSizeChanger,Io=mo===void 0?ho>So:mo,Do=eo.pageSizeOptions,Lo=eo.itemRender,Ho=Lo===void 0?defaultItemRender:Lo,Yo=eo.jumpPrevIcon,Xo=eo.jumpNextIcon,qo=eo.prevIcon,Ko=eo.nextIcon,Qo=React.useRef(null),zo=useMergedState(10,{value:go,defaultValue:wo}),ga=_slicedToArray(zo,2),$a=ga[0],Sl=ga[1],El=useMergedState(1,{value:so,defaultValue:lo,postState:function(Ru){return Math.max(1,Math.min(Ru,calculatePage(void 0,$a,ho)))}}),Tl=_slicedToArray(El,2),Il=Tl[0],Zl=Tl[1],Vl=React.useState(Il),Ol=_slicedToArray(Vl,2),Dl=Ol[0],Fl=Ol[1];reactExports.useEffect(function(){Fl(Il)},[Il]);var Jl=Math.max(1,Il-(Mo?3:5)),cu=Math.min(calculatePage(void 0,$a,ho),Il+(Mo?3:5));function Ll(Tu,Ru){var Ou=Tu||React.createElement("button",{type:"button","aria-label":Ru,className:"".concat(ro,"-item-link")});return typeof Tu=="function"&&(Ou=React.createElement(Tu,_objectSpread2({},eo))),Ou}function Xl(Tu){var Ru=Tu.target.value,Ou=calculatePage(void 0,$a,ho),_u;return Ru===""?_u=Ru:Number.isNaN(Number(Ru))?_u=Dl:Ru>=Ou?_u=Ou:_u=Number(Ru),_u}function ku(Tu){return isInteger$3(Tu)&&Tu!==Il&&isInteger$3(ho)&&ho>0}var iu=ho>$a?Bo:!1;function hu(Tu){(Tu.keyCode===KeyCode.UP||Tu.keyCode===KeyCode.DOWN)&&Tu.preventDefault()}function Cu(Tu){var Ru=Xl(Tu);switch(Ru!==Dl&&Fl(Ru),Tu.keyCode){case KeyCode.ENTER:yl(Ru);break;case KeyCode.UP:yl(Ru-1);break;case KeyCode.DOWN:yl(Ru+1);break}}function _l(Tu){yl(Xl(Tu))}function Go(Tu){var Ru=calculatePage(Tu,$a,ho),Ou=Il>Ru&&Ru!==0?Ru:Il;Sl(Tu),Fl(Ou),Po==null||Po(Il,Tu),Zl(Ou),$o==null||$o(Ou,Tu)}function yl(Tu){if(ku(Tu)&&!To){var Ru=calculatePage(void 0,$a,ho),Ou=Tu;return Tu>Ru?Ou=Ru:Tu<1&&(Ou=1),Ou!==Dl&&Fl(Ou),Zl(Ou),$o==null||$o(Ou,$a),Ou}return Il}var Al=Il>1,Ul=Il2?Ou-2:0),$u=2;$uho?ho:Il*$a])),Su=null,ru=calculatePage(void 0,$a,ho);if(Co&&ho<=$a)return null;var uu=[],xl={rootPrefixCls:ro,onClick:yl,onKeyPress:pu,showTitle:Wo,itemRender:Ho,page:-1},$l=Il-1>0?Il-1:0,Cl=Il+1=tu*2&&Il!==3&&(uu[0]=React.cloneElement(uu[0],{className:classNames$1("".concat(ro,"-item-after-jump-prev"),uu[0].props.className)}),uu.unshift(Yl)),ru-Il>=tu*2&&Il!==ru-2){var _f=uu[uu.length-1];uu[uu.length-1]=React.cloneElement(_f,{className:classNames$1("".concat(ro,"-item-before-jump-next"),_f.props.className)}),uu.push(Su)}Yu!==1&&uu.unshift(React.createElement(Pager,_extends$1n({},xl,{key:1,page:1}))),_d!==ru&&uu.push(React.createElement(Pager,_extends$1n({},xl,{key:ru,page:ru})))}var ep=Gu($l);if(ep){var Xu=!Al||!ru;ep=React.createElement("li",{title:Wo?yo.prev_page:null,onClick:su,tabIndex:Xu?null:0,onKeyDown:xu,className:classNames$1("".concat(ro,"-prev"),_defineProperty$2({},"".concat(ro,"-disabled"),Xu)),"aria-disabled":Xu},ep)}var _h=Ml(Cl);if(_h){var zu,Vu;Ao?(zu=!Ul,Vu=Al?0:null):(zu=!Ul||!ru,Vu=zu?null:0),_h=React.createElement("li",{title:Wo?yo.next_page:null,onClick:Ql,tabIndex:Vu,onKeyDown:Au,className:classNames$1("".concat(ro,"-next"),_defineProperty$2({},"".concat(ro,"-disabled"),zu)),"aria-disabled":zu},_h)}var Fu=classNames$1(ro,oo,_defineProperty$2(_defineProperty$2(_defineProperty$2(_defineProperty$2(_defineProperty$2({},"".concat(ro,"-start"),Ro==="start"),"".concat(ro,"-center"),Ro==="center"),"".concat(ro,"-end"),Ro==="end"),"".concat(ro,"-simple"),Ao),"".concat(ro,"-disabled"),To));return React.createElement("ul",_extends$1n({className:Fu,style:vo,ref:Qo},Wl),eu,ep,Ao?au:uu,_h,React.createElement(Options,{locale:yo,rootPrefixCls:ro,disabled:To,selectComponentClass:ao,selectPrefixCls:io,changeSize:Go,pageSize:$a,pageSizeOptions:Do,quickGo:iu?yl:null,goButton:Hl,showSizeChanger:Io}))},en_US={};Object.defineProperty(en_US,"__esModule",{value:!0});en_US.default=void 0;var locale={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"};en_US.default=locale;qe$4(Pagination)` + display: flex; + justify-content: center; + align-items: center; + + .rc-pagination-item { + display: flex; + justify-content: center; + align-items: center; + border: none !important; + background: transparent !important; + margin: var(--spacing-none) var(--spacing-xxxs) !important; + padding: 0; + height: 24px; + min-width: 18px !important; + max-width: 18px !important; + line-height: 24px; + font-family: var(--font-family); + ${({disabled:Xr})=>getTextVariantStyles("bes-semibold",Xr?"components-pagination-text-disabled":"components-pagination-text-default")}; + + &-active { + font-weight: bold; + color: ${({disabled:Xr})=>Xr?"var(--components-pagination-text-disabled)":"var(--components-pagination-text-selected)"}; + } + + a { + color: inherit !important; + padding: 0px; + text-decoration: none; + } + } + + .rc-pagination-jump-prev, + .rc-pagination-jump-next { + display: flex; + justify-content: center; + align-items: center; + border: none !important; + background: transparent !important; + min-width: 18px !important; + max-width: 18px !important; + margin: var(--spacing-none) var(--spacing-xxxs) !important; + padding: 0; + + /* Hide the original ellipsis content */ + & > * { + display: none; + } + + &::before { + content: "..."; + color: ${({disabled:Xr})=>Xr?"var(--components-pagination-text-disabled)":"var(--components-pagination-text-default)"}; + display: inline-block; + line-height: 24px; + vertical-align: middle; + margin-bottom: var(--spacing-xxxs); + } + + &:hover::before { + color: var(--components-pagination-text-default); + } + } + + .rc-pagination-prev, + .rc-pagination-next { + display: flex; + justify-content: center; + align-items: center; + border: none !important; + background: transparent !important; + margin: 0 !important; + padding: 0; + } + + .rc-pagination-prev:focus-visible, + .rc-pagination-next:focus-visible, + .rc-pagination-item:focus-visible { + outline: none !important; + box-shadow: none !important; + } +`;qe$4.div` + background: var(--components-pagination-background-default); + width: 24px; + height: 24px; + display: flex; + justify-content: center; + align-items: center; + border-radius: var(--radius-xxs); + + &:hover { + background: var(--components-pagination-background-hover); + } + + span { + height: 10px; + width: 10px; + } +`;qe$4.div` + align-items: center; + border-radius: var(--radius-xl); + background: var(--components-pill-background-${({isActive:Xr})=>Xr?"selected":"default"}); + cursor: pointer; + display: flex; + flex-direction: column; + height: 40px; + justify-content: center; + max-width: max-content; + padding: var(--spacing-none) var(--spacing-sm); + + ${({isActive:Xr})=>getTextVariantStyles("bs-semibold",Xr?"components-pill-text-selected":"components-pill-text-default")} + + &:hover { + ${({isActive:Xr})=>!Xr&&`background: var(--components-pill-background-hover); + color: var(--components-pill-text-default);`} + } + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`;qe$4.div` + /* Default CSS */ + background-color: var(--components-progress-bar-background-default); + width: 100%; + height: 4px; + border-radius: var(--radius-xxs, 8px); + + /* Extra CSS prop */ + ${({css:Xr})=>Xr||""} +`;qe$4.div` + /* Default CSS */ + border-radius: var(--radius-xxs, 8px); + background-color: var(--components-progress-bar-background-progress); + height: 100%; + width: ${({width:Xr})=>Xr}; + transition: width 0.3s ease; +`;const getSeparatorResponsiveCSSProperties=Xr=>[{propName:"height",prop:Xr.height},{propName:"margin",prop:Xr.margin},{propName:"width",prop:Xr.width}],getSeparatorResponsiveCSS=Xr=>{const eo=getSeparatorResponsiveCSSProperties(Xr);return getResponsiveCSS(eo)},separatorRestrictedPropsKeys=["height","margin","width","orientation"];qe$4.div.withConfig({shouldForwardProp:(Xr,eo)=>!separatorRestrictedPropsKeys.includes(Xr)&&eo(Xr)})` + /* Initial values */ + width: ${({width:Xr,orientation:eo})=>Xr||(eo==="horizontal"?"100%":"1px")}; + height: ${({height:Xr,orientation:eo})=>Xr||(eo==="horizontal"?"1px":"100%")}; + + /* Responsive props */ + ${Xr=>getSeparatorResponsiveCSS(Xr)} + + /* Non-responsive props */ + background-color: var(--surface-tertiary); + + /* Extra CSS prop */ + ${({css:Xr})=>Xr||""} +`;const getSkeletonResponsiveCSSProperties=Xr=>[{propName:"height",prop:Xr.height},{propName:"margin",prop:Xr.margin},{propName:"width",prop:Xr.width},{propName:"border-radius",prop:Xr.borderRadius}],getSkeletonResponsiveCSS=Xr=>{const eo=getSkeletonResponsiveCSSProperties(Xr);return getResponsiveCSS(eo)},getSkeletonPulseAnimation=(Xr,eo)=>We$4` + 0% { + background-color: ${Xr}; + } + 100% { + background-color: ${eo} + } +`,skeletonCSSPropsKeys=["height","width"];qe$4.div.withConfig({shouldForwardProp:(Xr,eo)=>!skeletonCSSPropsKeys.includes(Xr)&&eo(Xr)})` + /* Responsive props */ + ${Xr=>getSkeletonResponsiveCSS(Xr)} + + /* Extra CSS prop */ + ${Xr=>Xr.css||""} + + /* Animation props */ + animation: ${getSkeletonPulseAnimation("var(--components-skeleton-loader-gradient-light)","var(--components-skeleton-loader-gradient-dark)")} + 1s infinite alternate-reverse; + + /* Hide children */ + & > * { + visibility: hidden !important; + } +`;/** + * @reach/utils v0.18.0 + * + * Copyright (c) 2018-2022, React Training LLC + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function canUseDOM(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function composeEventHandlers(Xr,eo){return to=>{if(Xr&&Xr(to),!to.defaultPrevented)return eo(to)}}function isBoolean$2(Xr){return typeof Xr=="boolean"}function isFunction$7(Xr){return!!(Xr&&{}.toString.call(Xr)=="[object Function]")}function assignRef(Xr,eo){if(Xr!=null)if(isFunction$7(Xr))Xr(eo);else try{Xr.current=eo}catch{throw new Error(`Cannot assign value "${eo}" to ref "${Xr}"`)}}function useComposedRefs(...Xr){return reactExports.useCallback(eo=>{for(let to of Xr)assignRef(to,eo)},Xr)}function getOwnerDocument(Xr){return canUseDOM()?Xr?Xr.ownerDocument:document:null}function getOwnerWindow(Xr){let eo=getOwnerDocument(Xr);return eo?eo.defaultView||window:null}function getComputedStyles(Xr){let eo=getOwnerWindow(Xr);return eo?eo.getComputedStyle(Xr,null):null}function getComputedStyle$1(Xr,eo){var to;return((to=getComputedStyles(Xr))==null?void 0:to.getPropertyValue(eo))||null}function createNamedContext(Xr,eo){let to=reactExports.createContext(eo);return to.displayName=Xr,to}function createContext2(Xr,eo){let to=reactExports.createContext(eo);function ro(io){let{children:oo,...ao}=io,so=reactExports.useMemo(()=>ao,Object.values(ao));return reactExports.createElement(to.Provider,{value:so},oo)}function no(io){let oo=reactExports.useContext(to);if(oo)return oo;throw Error(`${io} must be rendered inside of a ${Xr} component.`)}return to.displayName=`${Xr}Context`,ro.displayName=`${Xr}Provider`,[ro,no]}function makeId(...Xr){return Xr.filter(eo=>eo!=null).join("--")}function noop$9(){}function useControlledState({controlledValue:Xr,defaultValue:eo,calledFrom:to="A component"}){let ro=Xr!==void 0,no=reactExports.useRef(ro);!no.current&&ro&&console.warn(`${to} is changing from controlled to uncontrolled. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),no.current&&!ro&&console.warn(`${to} is changing from uncontrolled to controlled. Components should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);let[io,oo]=reactExports.useState(no.current?Xr:eo),ao=reactExports.useCallback(so=>{no.current||oo(so)},[]);return[no.current?Xr:io,ao]}function useForceUpdate$1(){let[,Xr]=reactExports.useState(Object.create(null));return reactExports.useCallback(()=>{Xr(Object.create(null))},[])}var useIsomorphicLayoutEffect$3=canUseDOM()?reactExports.useLayoutEffect:reactExports.useEffect;function useStatefulRefValue(Xr,eo){let[to,ro]=reactExports.useState(eo),no=reactExports.useCallback(io=>{Xr.current=io,ro(io)},[]);return[to,no]}function useUpdateEffect$1(Xr,eo){const to=reactExports.useRef(!1);reactExports.useEffect(()=>{to.current?Xr():to.current=!0},eo)}function createDescendantContext(Xr,eo={}){const to=[];let ro=reactExports.createContext({descendants:to,registerDescendant:()=>noop$9,...eo});return ro.displayName=Xr,ro}function useDescendant(Xr,eo,to){let ro=useForceUpdate$1(),{registerDescendant:no,descendants:io}=reactExports.useContext(eo),oo=to??io.findIndex(ao=>ao.element===Xr.element);return useIsomorphicLayoutEffect$3(()=>(Xr.element||ro(),no({...Xr,index:oo})),[Xr,ro,oo,no,...Object.values(Xr)]),oo}function useDescendantsInit(){return reactExports.useState([])}function useDescendants(Xr){return reactExports.useContext(Xr).descendants}function DescendantProvider({context:Xr,children:eo,items:to,set:ro}){let no=reactExports.useCallback(({element:io,index:oo,...ao})=>io?(ro(so=>{if(oo!=null&&oo!==-1)return insertAt(so,{element:io,index:oo,...ao},oo);if(so.length===0)return[{...ao,element:io,index:0}];if(so.find(uo=>uo.element===io))return console.warn(`[reach-ui]: \`useDescendant\` was called with an element that was already registered. + +If you are using the \`@reach/descendants\` package directly, make sure to only register descendants once. Registering a descendant more than once will lead to bugs in your app. + +If you are using another \`reach-ui\` package, this is probably our bug! + +To report a bug, open a new issue: + + https://github.com/reach/reach-ui/issues/new?assignees=&labels=&template=Bug_report.md + +IMPORTANT: this check will only run in the development build, so if you see this warning please be aware that your app may crash when deployed.`),updateIndices(so);let co=findDOMIndex(so,io),lo;return co===-1?lo=[...so,{...ao,element:io,index:so.length}]:lo=insertAt(so,{...ao,element:io,index:co},co),lo}),()=>{io&&ro(so=>so.filter(co=>io!==co.element))}):noop$9,[]);return reactExports.createElement(Xr.Provider,{value:reactExports.useMemo(()=>({descendants:to,registerDescendant:no}),[to,no])},eo)}function useDescendantKeyDown(Xr,eo){let{descendants:to}=reactExports.useContext(Xr),{callback:ro,currentIndex:no,filter:io,key:oo="index",orientation:ao="vertical",rotate:so=!0,rtl:co=!1}=eo;return function(uo){if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(uo.key))return;let ho=no??-1,go=io?to.filter(io):to;if(!go.length)return;let bo=go.findIndex(Ro=>Ro.index===no);function wo(){return ho===Co().index?so?$o():go[bo]:go[(bo+1)%go.length]}function Eo(){return ho===$o().index?so?Co():go[bo]:go[(bo-1+go.length)%go.length]}function $o(){return go[0]}function Co(){return go[go.length-1]}switch(uo.key){case"ArrowDown":if(ao==="vertical"||ao==="both"){uo.preventDefault();let Mo=wo();ro(oo==="option"?Mo:Mo[oo])}break;case"ArrowUp":if(ao==="vertical"||ao==="both"){uo.preventDefault();let Mo=Eo();ro(oo==="option"?Mo:Mo[oo])}break;case"ArrowLeft":if(ao==="horizontal"||ao==="both"){uo.preventDefault();let Mo=(co?wo:Eo)();ro(oo==="option"?Mo:Mo[oo])}break;case"ArrowRight":if(ao==="horizontal"||ao==="both"){uo.preventDefault();let Mo=(co?Eo:wo)();ro(oo==="option"?Mo:Mo[oo])}break;case"PageUp":uo.preventDefault();let Ro=(uo.ctrlKey?Eo:$o)();ro(oo==="option"?Ro:Ro[oo]);break;case"Home":uo.preventDefault();let Oo=$o();ro(oo==="option"?Oo:Oo[oo]);break;case"PageDown":uo.preventDefault();let jo=(uo.ctrlKey?wo:Co)();ro(oo==="option"?jo:jo[oo]);break;case"End":uo.preventDefault();let Bo=Co();ro(oo==="option"?Bo:Bo[oo]);break}}}function isElementPreceding(Xr,eo){return!!(eo.compareDocumentPosition(Xr)&Node.DOCUMENT_POSITION_PRECEDING)}function findDOMIndex(Xr,eo){if(!eo||!Xr.length)return-1;let to=Xr.length;for(;to--;){let ro=Xr[to].element;if(ro&&isElementPreceding(ro,eo))return to+1}return-1}function insertAt(Xr,eo,to){return to==null||!(to in Xr)?[...Xr,eo]:[...Xr.slice(0,to),eo,...Xr.slice(to)]}function updateIndices(Xr){return Xr.sort((eo,to)=>!eo.element||!to.element?0:isElementPreceding(eo.element,to.element)?-1:1).map((eo,to)=>({...eo,index:to}))}var serverHandoffComplete=!1,id=0;function genId(){return++id}var maybeReactUseId=React$1.useId;function useId(Xr){if(maybeReactUseId!==void 0){let no=maybeReactUseId();return Xr??no}let eo=Xr??(serverHandoffComplete?genId():null),[to,ro]=reactExports.useState(eo);return useIsomorphicLayoutEffect$3(()=>{to===null&&ro(genId())},[]),reactExports.useEffect(()=>{serverHandoffComplete===!1&&(serverHandoffComplete=!0)},[]),Xr??to??void 0}var PortalImpl=({children:Xr,type:eo="reach-portal",containerRef:to})=>{let ro=reactExports.useRef(null),no=reactExports.useRef(null),io=useForceUpdate$1();return reactExports.useEffect(()=>{to!=null&&(typeof to!="object"||!("current"in to)?console.warn("@reach/portal: Invalid value passed to the `containerRef` of a `Portal`. The portal will be appended to the document body, but if you want to attach it to another DOM node you must pass a valid React ref object to `containerRef`."):to.current==null&&console.warn("@reach/portal: A ref was passed to the `containerRef` prop of a `Portal`, but no DOM node was attached to it. Be sure to pass the ref to a DOM component.\n\nIf you are forwarding the ref from another component, be sure to use the React.forwardRef API. See https://reactjs.org/docs/forwarding-refs.html."))},[to]),useIsomorphicLayoutEffect$3(()=>{if(!ro.current)return;let oo=ro.current.ownerDocument,ao=(to==null?void 0:to.current)||oo.body;return no.current=oo==null?void 0:oo.createElement(eo),ao.appendChild(no.current),io(),()=>{no.current&&ao&&ao.removeChild(no.current)}},[eo,io,to]),no.current?reactDomExports.createPortal(Xr,no.current):reactExports.createElement("span",{ref:ro})},Portal$1=({unstable_skipInitialRender:Xr,...eo})=>{let[to,ro]=reactExports.useState(!1);return reactExports.useEffect(()=>{Xr&&ro(!0)},[Xr]),Xr&&!to?null:reactExports.createElement(PortalImpl,{...eo})};Portal$1.displayName="Portal";var props=["bottom","height","left","right","top","width"],rectChanged=function(eo,to){return eo===void 0&&(eo={}),to===void 0&&(to={}),props.some(function(ro){return eo[ro]!==to[ro]})},observedNodes=new Map,rafId,run$3=function Xr(){var eo=[];observedNodes.forEach(function(to,ro){var no=ro.getBoundingClientRect();rectChanged(no,to.rect)&&(to.rect=no,eo.push(to))}),eo.forEach(function(to){to.callbacks.forEach(function(ro){return ro(to.rect)})}),rafId=window.requestAnimationFrame(Xr)};function observeRect(Xr,eo){return{observe:function(){var ro=observedNodes.size===0;observedNodes.has(Xr)?observedNodes.get(Xr).callbacks.push(eo):observedNodes.set(Xr,{rect:void 0,hasRectChanged:!1,callbacks:[eo]}),ro&&run$3()},unobserve:function(){var ro=observedNodes.get(Xr);if(ro){var no=ro.callbacks.indexOf(eo);no>=0&&ro.callbacks.splice(no,1),ro.callbacks.length||observedNodes.delete(Xr),observedNodes.size||cancelAnimationFrame(rafId)}}}}function useRect(Xr,eo,to){let ro,no;isBoolean$2(eo)?ro=eo:(ro=(eo==null?void 0:eo.observe)??!0,no=eo==null?void 0:eo.onChange),isFunction$7(to)&&(no=to),reactExports.useEffect(()=>{isBoolean$2(eo)&&console.warn("Passing `observe` as the second argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `observe` property as the second argument (`useRect(ref, { observe })`).\nSee https://reach.tech/rect#userect-observe")},[eo]),reactExports.useEffect(()=>{isFunction$7(to)&&console.warn("Passing `onChange` as the third argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `onChange` property as the second argument (`useRect(ref, { onChange })`).\nSee https://reach.tech/rect#userect-onchange")},[to]);let[io,oo]=reactExports.useState(Xr.current),ao=reactExports.useRef(!1),so=reactExports.useRef(!1),[co,lo]=reactExports.useState(null),uo=reactExports.useRef(no);return useIsomorphicLayoutEffect$3(()=>{uo.current=no,Xr.current!==io&&oo(Xr.current)}),useIsomorphicLayoutEffect$3(()=>{io&&!ao.current&&(ao.current=!0,lo(io.getBoundingClientRect()))},[io]),useIsomorphicLayoutEffect$3(()=>{if(!ro)return;let ho=io;if(so.current||(so.current=!0,ho=Xr.current),!ho){console.warn("You need to place the ref");return}let go=observeRect(ho,bo=>{var wo;(wo=uo.current)==null||wo.call(uo,bo),lo(bo)});return go.observe(),()=>{go.unobserve()}},[ro,io,Xr]),co}/*! +* tabbable 5.3.3 +* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE +*/var candidateSelectors=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],candidateSelector=candidateSelectors.join(","),NoElement=typeof Element>"u",matches=NoElement?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,getRootNode=!NoElement&&Element.prototype.getRootNode?function(Xr){return Xr.getRootNode()}:function(Xr){return Xr.ownerDocument},getCandidates=function(eo,to,ro){var no=Array.prototype.slice.apply(eo.querySelectorAll(candidateSelector));return to&&matches.call(eo,candidateSelector)&&no.unshift(eo),no=no.filter(ro),no},getCandidatesIteratively=function Xr(eo,to,ro){for(var no=[],io=Array.from(eo);io.length;){var oo=io.shift();if(oo.tagName==="SLOT"){var ao=oo.assignedElements(),so=ao.length?ao:oo.children,co=Xr(so,!0,ro);ro.flatten?no.push.apply(no,co):no.push({scope:oo,candidates:co})}else{var lo=matches.call(oo,candidateSelector);lo&&ro.filter(oo)&&(to||!eo.includes(oo))&&no.push(oo);var uo=oo.shadowRoot||typeof ro.getShadowRoot=="function"&&ro.getShadowRoot(oo),ho=!ro.shadowRootFilter||ro.shadowRootFilter(oo);if(uo&&ho){var go=Xr(uo===!0?oo.children:uo.children,!0,ro);ro.flatten?no.push.apply(no,go):no.push({scope:oo,candidates:go})}else io.unshift.apply(io,oo.children)}}return no},getTabindex=function(eo,to){return eo.tabIndex<0&&(to||/^(AUDIO|VIDEO|DETAILS)$/.test(eo.tagName)||eo.isContentEditable)&&isNaN(parseInt(eo.getAttribute("tabindex"),10))?0:eo.tabIndex},sortOrderedTabbables=function(eo,to){return eo.tabIndex===to.tabIndex?eo.documentOrder-to.documentOrder:eo.tabIndex-to.tabIndex},isInput=function(eo){return eo.tagName==="INPUT"},isHiddenInput=function(eo){return isInput(eo)&&eo.type==="hidden"},isDetailsWithSummary=function(eo){var to=eo.tagName==="DETAILS"&&Array.prototype.slice.apply(eo.children).some(function(ro){return ro.tagName==="SUMMARY"});return to},getCheckedRadio=function(eo,to){for(var ro=0;rosummary:first-of-type"),oo=io?eo.parentElement:eo;if(matches.call(oo,"details:not([open]) *"))return!0;var ao=getRootNode(eo).host,so=(ao==null?void 0:ao.ownerDocument.contains(ao))||eo.ownerDocument.contains(eo);if(!ro||ro==="full"){if(typeof no=="function"){for(var co=eo;eo;){var lo=eo.parentElement,uo=getRootNode(eo);if(lo&&!lo.shadowRoot&&no(lo)===!0)return isZeroArea(eo);eo.assignedSlot?eo=eo.assignedSlot:!lo&&uo!==eo.ownerDocument?eo=uo.host:eo=lo}eo=co}if(so)return!eo.getClientRects().length}else if(ro==="non-zero-area")return isZeroArea(eo);return!1},isDisabledFromFieldset=function(eo){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(eo.tagName))for(var to=eo.parentElement;to;){if(to.tagName==="FIELDSET"&&to.disabled){for(var ro=0;ro=0)},sortByOrder=function Xr(eo){var to=[],ro=[];return eo.forEach(function(no,io){var oo=!!no.scope,ao=oo?no.scope:no,so=getTabindex(ao,oo),co=oo?Xr(no.candidates):ao;so===0?oo?to.push.apply(to,co):to.push(ao):ro.push({documentOrder:io,tabIndex:so,item:no,isScope:oo,content:co})}),ro.sort(sortOrderedTabbables).reduce(function(no,io){return io.isScope?no.push.apply(no,io.content):no.push(io.content),no},[]).concat(to)},tabbable=function(eo,to){to=to||{};var ro;return to.getShadowRoot?ro=getCandidatesIteratively([eo],to.includeContainer,{filter:isNodeMatchingSelectorTabbable.bind(null,to),flatten:!1,getShadowRoot:to.getShadowRoot,shadowRootFilter:isValidShadowRootTabbable}):ro=getCandidates(eo,to.includeContainer,isNodeMatchingSelectorTabbable.bind(null,to)),sortByOrder(ro)},Popover=reactExports.forwardRef(function({unstable_skipInitialPortalRender:eo,...to},ro){return reactExports.createElement(Portal$1,{unstable_skipInitialRender:eo},reactExports.createElement(PopoverImpl,{ref:ro,...to}))});Popover.displayName="Popover";var PopoverImpl=reactExports.forwardRef(function({as:eo="div",targetRef:to,position:ro=positionDefault,unstable_observableRefs:no=[],...io},oo){const ao=reactExports.useRef(null),so=useRect(ao,{observe:!io.hidden}),co=useRect(to,{observe:!0}),lo=useComposedRefs(ao,oo);return useSimulateTabNavigationForReactTree(to,ao),reactExports.createElement(eo,{"data-reach-popover":"",ref:lo,...io,style:{position:"absolute",...getStyles(ro,co,so,...no),...io.style}})});PopoverImpl.displayName="PopoverImpl";function getStyles(Xr,eo,to,...ro){return to?Xr(eo,to,...ro.map(no=>no.current)):{visibility:"hidden"}}function getTopPosition(Xr,eo,to){return{top:to?`${Xr.top-eo.height+window.pageYOffset}px`:`${Xr.top+Xr.height+window.pageYOffset}px`}}var positionDefault=(Xr,eo)=>{if(!Xr||!eo)return{};const{directionRight:to,directionUp:ro}=getCollisions(Xr,eo);return{left:to?`${Xr.right-eo.width+window.pageXOffset}px`:`${Xr.left+window.pageXOffset}px`,...getTopPosition(Xr,eo,ro)}},positionMatchWidth=(Xr,eo)=>{if(!Xr||!eo)return{};const{directionUp:to}=getCollisions(Xr,eo);return{width:Xr.width,left:Xr.left,...getTopPosition(Xr,eo,to)}};function getCollisions(Xr,eo,to=0,ro=0){const no={top:Xr.top-eo.height<0,right:window.innerWidth(to.addEventListener("keydown",ro),()=>{to.removeEventListener("keydown",ro)}),[]);function no(){const Co=tabbable(to),Ro=Co&&Xr.current?Co.indexOf(Xr.current):-1,Oo=Co&&Co[Ro+1];return eo.current&&eo.current.contains(Oo||null)?!1:Oo}function io(){return Xr.current?Xr.current===to.activeElement:!1}function oo(Co){const Ro=eo.current&&tabbable(eo.current);Ro&&Ro[0]&&(Co.preventDefault(),Ro[0].focus())}function ao(){if(eo.current?eo.current.contains(to.activeElement||null):!1){const Ro=eo.current&&tabbable(eo.current);return!!(Ro&&Ro[Ro.length-1]===to.activeElement)}return!1}function so(Co){const Ro=no();Ro&&(Co.preventDefault(),Ro.focus())}function co(Co){if(!Co.shiftKey)return;const Ro=no();return Co.target===Ro}function lo(Co){const Ro=eo.current&&tabbable(eo.current),Oo=Ro&&Ro[Ro.length-1];Oo&&(Co.preventDefault(),Oo.focus())}function uo(Co){const Ro=eo.current&&tabbable(eo.current);return Ro?Ro.length===0?!1:Co.target===Ro[0]:!1}function ho(Co){var Ro;Co.preventDefault(),(Ro=Xr.current)==null||Ro.focus()}function go(Co){const Ro=eo.current?tabbable(to).filter(Oo=>!eo.current.contains(Oo)):null;return Ro?Co.target===Ro[Ro.length-1]:!1}function bo(Co){return Co.target===tabbable(to)[0]}let wo=[];function Eo(){const Co=eo.current&&tabbable(eo.current);Co&&(Co.forEach(Ro=>{wo.push([Ro,Ro.tabIndex]),Ro.tabIndex=-1}),to.addEventListener("focusin",$o))}function $o(){to.removeEventListener("focusin",$o),wo.forEach(([Co,Ro])=>{Co.tabIndex=Ro})}}function findAll({autoEscape:Xr,caseSensitive:eo=!1,findChunks:to=defaultFindChunks,sanitize:ro,searchWords:no,textToHighlight:io}){return fillInChunks({chunksToHighlight:combineChunks({chunks:to({autoEscape:Xr,caseSensitive:eo,sanitize:ro,searchWords:no,textToHighlight:io})}),totalLength:io?io.length:0})}function combineChunks({chunks:Xr}){return Xr.sort((eo,to)=>eo.start-to.start).reduce((eo,to)=>{if(eo.length===0)return[to];{const ro=eo.pop();if(to.start<=ro.end){const no=Math.max(ro.end,to.end);eo.push({highlight:!1,start:ro.start,end:no})}else eo.push(ro,to);return eo}},[])}function defaultFindChunks({autoEscape:Xr,caseSensitive:eo,sanitize:to=defaultSanitize,searchWords:ro,textToHighlight:no}){return no=to(no||""),ro.filter(io=>io).reduce((io,oo)=>{oo=to(oo),Xr&&(oo=escapeRegExpFn(oo));const ao=new RegExp(oo,eo?"g":"gi");let so;for(;so=ao.exec(no||"");){let co=so.index,lo=ao.lastIndex;lo>co&&io.push({highlight:!1,start:co,end:lo}),so.index===ao.lastIndex&&ao.lastIndex++}return io},[])}function fillInChunks({chunksToHighlight:Xr,totalLength:eo}){const to=[];if(Xr.length===0)ro(0,eo,!1);else{let no=0;Xr.forEach(io=>{ro(no,io.start,!1),ro(io.start,io.end,!0),no=io.end}),ro(no,eo,!1)}return to;function ro(no,io,oo){io-no>0&&to.push({start:no,end:io,highlight:oo})}}function defaultSanitize(Xr){return Xr}function escapeRegExpFn(Xr){return Xr.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var HighlightWords={combineChunks,fillInChunks,findAll,findChunks:defaultFindChunks},IDLE="IDLE",SUGGESTING="SUGGESTING",NAVIGATING="NAVIGATING",INTERACTING="INTERACTING",CLEAR$1="CLEAR",CHANGE="CHANGE",INITIAL_CHANGE="INITIAL_CHANGE",NAVIGATE="NAVIGATE",SELECT_WITH_KEYBOARD="SELECT_WITH_KEYBOARD",SELECT_WITH_CLICK="SELECT_WITH_CLICK",ESCAPE="ESCAPE",BLUR="BLUR",INTERACT="INTERACT",FOCUS="FOCUS",OPEN_WITH_BUTTON="OPEN_WITH_BUTTON",OPEN_WITH_INPUT_CLICK="OPEN_WITH_INPUT_CLICK",CLOSE_WITH_BUTTON="CLOSE_WITH_BUTTON",stateChart={initial:IDLE,states:{[IDLE]:{on:{[BLUR]:IDLE,[CLEAR$1]:IDLE,[CHANGE]:SUGGESTING,[INITIAL_CHANGE]:IDLE,[FOCUS]:SUGGESTING,[NAVIGATE]:NAVIGATING,[OPEN_WITH_BUTTON]:SUGGESTING,[OPEN_WITH_INPUT_CLICK]:SUGGESTING}},[SUGGESTING]:{on:{[CHANGE]:SUGGESTING,[FOCUS]:SUGGESTING,[NAVIGATE]:NAVIGATING,[CLEAR$1]:IDLE,[ESCAPE]:IDLE,[BLUR]:IDLE,[SELECT_WITH_CLICK]:IDLE,[INTERACT]:INTERACTING,[CLOSE_WITH_BUTTON]:IDLE}},[NAVIGATING]:{on:{[CHANGE]:SUGGESTING,[FOCUS]:SUGGESTING,[CLEAR$1]:IDLE,[BLUR]:IDLE,[ESCAPE]:IDLE,[NAVIGATE]:NAVIGATING,[SELECT_WITH_CLICK]:IDLE,[SELECT_WITH_KEYBOARD]:IDLE,[CLOSE_WITH_BUTTON]:IDLE,[INTERACT]:INTERACTING}},[INTERACTING]:{on:{[CLEAR$1]:IDLE,[CHANGE]:SUGGESTING,[FOCUS]:SUGGESTING,[BLUR]:IDLE,[ESCAPE]:IDLE,[NAVIGATE]:NAVIGATING,[CLOSE_WITH_BUTTON]:IDLE,[SELECT_WITH_CLICK]:IDLE}}}},reducer=(Xr,eo)=>{let to={...Xr,lastEventType:eo.type};switch(eo.type){case CHANGE:case INITIAL_CHANGE:return{...to,navigationValue:null,value:eo.value};case NAVIGATE:case OPEN_WITH_BUTTON:case OPEN_WITH_INPUT_CLICK:return{...to,navigationValue:findNavigationValue(to,eo)};case CLEAR$1:return{...to,value:"",navigationValue:null};case BLUR:case ESCAPE:return{...to,navigationValue:null};case SELECT_WITH_CLICK:return{...to,value:eo.isControlled?Xr.value:eo.value,navigationValue:null};case SELECT_WITH_KEYBOARD:return{...to,value:eo.isControlled?Xr.value:Xr.navigationValue,navigationValue:null};case CLOSE_WITH_BUTTON:return{...to,navigationValue:null};case INTERACT:return to;case FOCUS:return{...to,navigationValue:findNavigationValue(to,eo)};default:return to}};function popoverIsExpanded(Xr){return[SUGGESTING,NAVIGATING,INTERACTING].includes(Xr)}function findNavigationValue(Xr,eo){return eo.value?eo.value:eo.persistSelection?Xr.value:null}var ComboboxDescendantContext=createDescendantContext("ComboboxDescendantContext"),ComboboxContext=createNamedContext("ComboboxContext",{}),OptionContext=createNamedContext("OptionContext",{}),Combobox=reactExports.forwardRef(({onSelect:Xr,openOnFocus:eo=!1,children:to,as:ro="div","aria-label":no,"aria-labelledby":io,...oo},ao)=>{let[so,co]=useDescendantsInit(),lo=reactExports.useRef(),uo=reactExports.useRef(),ho=reactExports.useRef(),go=reactExports.useRef(!1),bo=reactExports.useRef(!1),wo={value:"",navigationValue:null},[Eo,$o,Co]=useReducerMachine(stateChart,reducer,wo);useFocusManagement($o.lastEventType,lo);let Ro=useId(oo.id),Oo=Ro?makeId("listbox",Ro):"listbox",jo=reactExports.useRef(!1),Bo=popoverIsExpanded(Eo),Mo={ariaLabel:no,ariaLabelledby:io,autocompletePropRef:go,buttonRef:ho,comboboxId:Ro,data:$o,inputRef:lo,isExpanded:Bo,listboxId:Oo,onSelect:Xr||noop$9,openOnFocus:eo,persistSelectionRef:bo,popoverRef:uo,state:Eo,transition:Co,isControlledRef:jo};return reactExports.createElement(DescendantProvider,{context:ComboboxDescendantContext,items:so,set:co},reactExports.createElement(ComboboxContext.Provider,{value:Mo},reactExports.createElement(ro,{...oo,"data-reach-combobox":"","data-state":getDataState(Eo),"data-expanded":Bo||void 0,ref:ao},isFunction$7(to)?to({id:Ro,isExpanded:Bo,navigationValue:$o.navigationValue??null,state:Eo}):to)))});Combobox.displayName="Combobox";var ComboboxInput=reactExports.forwardRef(({as:Xr="input",selectOnClick:eo=!1,autocomplete:to=!0,onClick:ro,onChange:no,onKeyDown:io,onBlur:oo,onFocus:ao,value:so,...co},lo)=>{let{current:uo}=reactExports.useRef(so),ho=reactExports.useRef(!1);useUpdateEffect$1(()=>{ho.current=!0},[so]);let{data:{navigationValue:go,value:bo,lastEventType:wo},inputRef:Eo,state:$o,transition:Co,listboxId:Ro,autocompletePropRef:Oo,openOnFocus:jo,isExpanded:Bo,ariaLabel:Mo,ariaLabelledby:Fo,persistSelectionRef:Wo,isControlledRef:Jo}=reactExports.useContext(ComboboxContext),Po=useComposedRefs(Eo,lo),fo=reactExports.useRef(!1),yo=useKeyDown(),vo=useBlur(),_o=typeof so<"u",So=typeof uo<"u";!_o&&So&&console.warn("ComboboxInput is changing from controlled to uncontrolled. ComboboxInput should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled ComboboxInput for the lifetime of the component. Check the `value` prop being passed in."),_o&&!So&&console.warn("ComboboxInput is changing from uncontrolled to controlled. ComboboxInput should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled ComboboxInput for the lifetime of the component. Check the `value` prop being passed in."),reactExports.useEffect(()=>{Jo.current=_o},[_o]),useIsomorphicLayoutEffect$3(()=>{Oo.current=to},[to,Oo]);let To=reactExports.useCallback(Do=>{Do.trim()===""?Co(CLEAR$1,{isControlled:_o}):Do===uo&&!ho.current?Co(INITIAL_CHANGE,{value:Do}):Co(CHANGE,{value:Do})},[uo,Co,_o]);reactExports.useEffect(()=>{_o&&so!==bo&&(so.trim()!==""||(bo||"").trim()!=="")&&To(so)},[so,To,_o,bo]),reactExports.useEffect(()=>{var Ho;let Do=(Ho=Eo.current)==null?void 0:Ho.form;if(!Do)return;function Lo(Yo){Co(CLEAR$1,{isControlled:_o})}return Do.addEventListener("reset",Lo),()=>{Do==null||Do.removeEventListener("reset",Lo)}},[Eo,_o,Co]);function Ao(Do){let{value:Lo}=Do.target;_o||To(Lo)}function ko(){eo&&(fo.current=!0),jo&&wo!==SELECT_WITH_CLICK&&Co(FOCUS,{persistSelection:Wo.current})}function mo(){var Do;fo.current&&(fo.current=!1,(Do=Eo.current)==null||Do.select()),jo&&$o===IDLE&&Co(OPEN_WITH_INPUT_CLICK)}let Io=to&&($o===NAVIGATING||$o===INTERACTING)?go||so||bo:so||bo;return reactExports.createElement(Xr,{"aria-activedescendant":go?String(makeHash(go)):void 0,"aria-autocomplete":"both","aria-controls":Ro,"aria-expanded":Bo,"aria-haspopup":"listbox","aria-label":Mo,"aria-labelledby":Mo?void 0:Fo,role:"combobox",...co,"data-reach-combobox-input":"","data-state":getDataState($o),ref:Po,onBlur:composeEventHandlers(oo,vo),onChange:composeEventHandlers(no,Ao),onClick:composeEventHandlers(ro,mo),onFocus:composeEventHandlers(ao,ko),onKeyDown:composeEventHandlers(io,yo),value:Io||""})});ComboboxInput.displayName="ComboboxInput";var ComboboxPopover=reactExports.forwardRef(({as:Xr="div",children:eo,portal:to=!0,onKeyDown:ro,onBlur:no,position:io=positionMatchWidth,...oo},ao)=>{let{popoverRef:so,inputRef:co,isExpanded:lo,state:uo}=reactExports.useContext(ComboboxContext),ho=useComposedRefs(so,ao),go=useKeyDown(),bo=useBlur(),wo={"data-reach-combobox-popover":"","data-state":getDataState(uo),onKeyDown:composeEventHandlers(ro,go),onBlur:composeEventHandlers(no,bo),hidden:!lo,tabIndex:-1,children:eo};return to?reactExports.createElement(Popover,{as:Xr,...oo,ref:ho,"data-expanded":lo||void 0,position:io,targetRef:co,unstable_skipInitialPortalRender:!0,...wo}):reactExports.createElement(Xr,{ref:ho,...oo,...wo})});ComboboxPopover.displayName="ComboboxPopover";var ComboboxList=reactExports.forwardRef(({persistSelection:Xr=!1,as:eo="ul",...to},ro)=>{let{persistSelectionRef:no,listboxId:io}=reactExports.useContext(ComboboxContext);return Xr&&(no.current=!0),reactExports.createElement(eo,{role:"listbox",...to,ref:ro,"data-reach-combobox-list":"",id:io})});ComboboxList.displayName="ComboboxList";var ComboboxOption=reactExports.forwardRef(({as:Xr="li",children:eo,index:to,value:ro,onClick:no,...io},oo)=>{let{onSelect:ao,data:{navigationValue:so},transition:co,isControlledRef:lo}=reactExports.useContext(ComboboxContext),uo=reactExports.useRef(null),[ho,go]=useStatefulRefValue(uo,null),bo=reactExports.useMemo(()=>({element:ho,value:ro}),[ro,ho]),wo=useDescendant(bo,ComboboxDescendantContext,to),Eo=useComposedRefs(oo,go),$o=so===ro,Co=()=>{ao&&ao(ro),co(SELECT_WITH_CLICK,{value:ro,isControlled:lo.current})};return reactExports.createElement(OptionContext.Provider,{value:{value:ro,index:wo}},reactExports.createElement(Xr,{"aria-selected":$o,role:"option",...io,"data-reach-combobox-option":"",ref:Eo,id:String(makeHash(ro)),"data-highlighted":$o?"":void 0,tabIndex:-1,onClick:composeEventHandlers(no,Co)},eo?isFunction$7(eo)?eo({value:ro,index:wo}):eo:reactExports.createElement(ComboboxOptionText,null)))});ComboboxOption.displayName="ComboboxOption";function ComboboxOptionText(){let{value:Xr}=reactExports.useContext(OptionContext),{data:{value:eo}}=reactExports.useContext(ComboboxContext),to=reactExports.useMemo(()=>HighlightWords.findAll({searchWords:escapeRegexp(eo||"").split(/\s+/),textToHighlight:Xr}),[eo,Xr]);return reactExports.createElement(reactExports.Fragment,null,to.length?to.map((ro,no)=>{let io=Xr.slice(ro.start,ro.end);return reactExports.createElement("span",{key:no,"data-reach-combobox-option-text":"","data-user-value":ro.highlight?!0:void 0,"data-suggested-value":ro.highlight?void 0:!0},io)}):Xr)}ComboboxOptionText.displayName="ComboboxOptionText";var ComboboxButton=reactExports.forwardRef(({as:Xr="button",onClick:eo,onKeyDown:to,...ro},no)=>{let{transition:io,state:oo,buttonRef:ao,listboxId:so,isExpanded:co}=reactExports.useContext(ComboboxContext),lo=useComposedRefs(ao,no),uo=useKeyDown(),ho=()=>{io(oo===IDLE?OPEN_WITH_BUTTON:CLOSE_WITH_BUTTON)};return reactExports.createElement(Xr,{"aria-controls":so,"aria-haspopup":"listbox","aria-expanded":co,...ro,"data-reach-combobox-button":"",ref:lo,onClick:composeEventHandlers(eo,ho),onKeyDown:composeEventHandlers(to,uo)})});ComboboxButton.displayName="ComboboxButton";function useFocusManagement(Xr,eo){useIsomorphicLayoutEffect$3(()=>{var to;(Xr===NAVIGATE||Xr===ESCAPE||Xr===SELECT_WITH_CLICK||Xr===OPEN_WITH_BUTTON)&&((to=eo.current)==null||to.focus())},[eo,Xr])}function useKeyDown(){let{data:{navigationValue:Xr},onSelect:eo,state:to,transition:ro,autocompletePropRef:no,persistSelectionRef:io,inputRef:oo,isControlledRef:ao}=reactExports.useContext(ComboboxContext),so=useDescendants(ComboboxDescendantContext);return function(lo){var $o;let uo=so.findIndex(({value:Co})=>Co===Xr);function ho(){return uo===so.length-1?no.current?null:bo():so[(uo+1)%so.length]}function go(){return uo===0?no.current?null:wo():uo===-1?wo():so[(uo-1+so.length)%so.length]}function bo(){return so[0]}function wo(){return so[so.length-1]}let Eo=(($o=oo.current)==null?void 0:$o.tagName.toUpperCase())==="TEXTAREA"&&oo.current.value.includes(` +`);switch(lo.key){case"ArrowDown":if(!so||!so.length)return;if(to===IDLE){if(Eo)return;lo.preventDefault(),ro(NAVIGATE,{persistSelection:io.current})}else{lo.preventDefault();let Co=ho();ro(NAVIGATE,{value:Co?Co.value:null})}break;case"ArrowUp":if(!so||!so.length)return;if(to===IDLE){if(Eo)return;lo.preventDefault(),ro(NAVIGATE,{persistSelection:io.current})}else{lo.preventDefault();let Co=go();ro(NAVIGATE,{value:Co?Co.value:null})}break;case"Home":case"PageUp":if(lo.preventDefault(),!so||so.length===0)return;to===IDLE?ro(NAVIGATE):ro(NAVIGATE,{value:bo().value});break;case"End":case"PageDown":if(lo.preventDefault(),!so||so.length===0)return;to===IDLE?ro(NAVIGATE):ro(NAVIGATE,{value:wo().value});break;case"Escape":to!==IDLE&&ro(ESCAPE);break;case"Enter":to===NAVIGATING&&Xr!==null&&(lo.preventDefault(),eo&&eo(Xr),ro(SELECT_WITH_KEYBOARD,{isControlled:ao.current}));break}}}function useBlur(){let{state:Xr,transition:eo,popoverRef:to,inputRef:ro,buttonRef:no}=reactExports.useContext(ComboboxContext);return function(oo){let ao=to.current,so=ro.current,co=no.current,lo=oo.relatedTarget;lo!==so&&lo!==co&&ao&&(ao.contains(lo)?Xr!==INTERACTING&&eo(INTERACT):eo(BLUR))}}function useReducerMachine(Xr,eo,to){let[ro,no]=reactExports.useState(Xr.initial),[io,oo]=reactExports.useReducer(eo,to);return[ro,io,(so,co={})=>{let lo=Xr.states[ro],uo=lo&&lo.on[so];if(uo){oo({type:so,state:ro,nextState:ro,...co}),no(uo);return}}]}function makeHash(Xr){let eo=0;if(Xr.length===0)return eo;for(let to=0;toXr?"xxs":"none"}); + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`;qe$4.div` + ${({theme:Xr,success:eo,error:to,disabled:ro})=>{var ao;const no=(ao=Xr==null?void 0:Xr.blocksTheme)==null?void 0:ao.colors,io=to?"danger":eo?"success":ro?"disabled":"default",oo=to?"danger":eo?"success":"focus";return Ae$3` + display: flex; + align-self: stretch; + cursor: pointer; + align-items: center; + justify-content: space-between; + border-radius: var(--radius-xs, 12px); + border: 1.5px solid + var(--components-inputs-stroke-${io}, ${no[`components-inputs-stroke-${io}`]}); + background: var( + --components-inputs-background-${io}, + ${no[`components-inputs-background-${io}`]} + ); + padding: var(--spacing-xs, 12px); + &:hover { + border: 1.5px solid var(--components-inputs-stroke-hover, #c4cbd5); + } + + &:focus-within { + border: 1.5px solid + var(--components-inputs-stroke-${oo}, ${no[`components-inputs-stroke-${oo}`]}); + outline: none; + } + + [data-reach-combobox-input] { + background-color: transparent; + border: none; + color: var(--components-inputs-text-default, ${no["components-inputs-text-default"]}); + + display: flex; + + font-family: var(--font-family); + font-size: ${textVariants["bs-regular"].fontSize}; + font-style: ${textVariants["bs-regular"].fontStyle}; + font-weight: ${textVariants["bs-regular"].fontWeight}; + line-height: ${textVariants["bs-regular"].lineHeight}; + + gap: var(--spacing-none, 0px); + + &:focus { + outline: none; + } + &:hover { + outline: none; + } + &:disabled { + background-color: transparent; + cursor: not-allowed; + color: var(--components-inputs-text-disabled, ${no["components-inputs-text-disabled"]}); + } + + ::placeholder { + color: var(--components-inputs-text-placeholder, ${no["components-inputs-text-placeholder"]}); + } + } + `}} +`;qe$4(ComboboxPopover)` + margin: var(--spacing-sm) var(--spacing-none) var(--spacing-none) var(--spacing-none); + padding: var(--spacing-xxs, 8px); + border-radius: var(--radius-xs, 12px); + border: var(--border-sm, 1px) solid var(--stroke-secondary, #eaebf2); + background: var(--surface-primary, #fff); + overflow: hidden auto; + max-height: 20rem; +`;qe$4(Combobox)` + width: 100%; + position: relative; +`;qe$4.div` + display: flex; + width: 100%; + gap: var(--spacing-xxs); +`;qe$4(ComboboxInput)` + width: 100%; +`;qe$4(ComboboxList)` + display: flex; + flex-direction: column; + gap: var(--spacing-xs, 12px); +`;qe$4(ComboboxOption)` + display: flex; + align-items: center; + padding: var(--spacing-xxxs, 4px); + gap: var(--spacing-xxs, 8px); + color: var(--components-list-item-text-default); + font-family: var(--font-family); + font-size: ${textVariants["bs-regular"].fontSize}; + font-style: ${textVariants["bs-regular"].fontStyle}; + font-weight: ${textVariants["bs-regular"].fontWeight}; + line-height: ${textVariants["bs-regular"].lineHeight}; + &:hover { + border-radius: var(--radius-xxs, 8px); + background: var(--surface-secondary, #f5f6f8); + } + [role='img'] { + width: 24px; + height: 24px; + } +`;qe$4.div` + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; +`;qe$4.span` + color: var(--${({color:Xr})=>Xr}); + font-family: var(--font-family); + font-size: ${textVariants["h6-semibold"].fontSize}; + font-style: ${textVariants["h6-semibold"].fontStyle}; + font-weight: ${textVariants["h6-semibold"].fontWeight}; + line-height: ${textVariants["h6-semibold"].lineHeight}; +`;qe$4.div` + display: flex; + align-items: flex-start; + gap: var(--spacing-xxxs, 4px); +`;qe$4.span` + color: var(--${({color:Xr})=>Xr}); + font-family: var(--font-family); + font-size: ${textVariants["c-regular"].fontSize}; + font-style: ${textVariants["c-regular"].fontStyle}; + font-weight: ${textVariants["c-regular"].fontWeight}; + line-height: ${textVariants["c-regular"].lineHeight}; +`;var TabsDescendantsContext=createDescendantContext("TabsDescendantsContext"),TabPanelDescendantsContext=createDescendantContext("TabPanelDescendantsContext"),[TabsProvider,useTabsCtx]=createContext2("Tabs"),Tabs=reactExports.forwardRef(({as:Xr="div",children:eo,defaultIndex:to,orientation:ro="horizontal",index:no=void 0,keyboardActivation:io="auto",onChange:oo,readOnly:ao=!1,...so},co)=>{let{current:lo}=reactExports.useRef(no!==void 0),uo=useId(so.id||"tabs"),ho=reactExports.useRef(null),go=reactExports.useRef(!1),[bo,wo]=useControlledState({controlledValue:no,defaultValue:to??0,calledFrom:"Tabs"}),[Eo,$o]=reactExports.useState(-1),[Co,Ro]=useDescendantsInit(),Oo=reactExports.useCallback(()=>{ho.current&&isFunction$7(ho.current.focus)&&ho.current.focus()},[]),jo=reactExports.useCallback(Mo=>{oo&&oo(Mo),wo(Mo)},[oo,wo]),Bo=reactExports.useCallback(Mo=>{var Jo;let Fo=(Jo=Co[Mo])==null?void 0:Jo.element,Wo=getOwnerDocument(Fo);io==="auto"&&(oo&&oo(Mo),wo(Mo)),Fo&&Fo!==Wo.activeElement&&isFunction$7(Fo.focus)&&Fo.focus()},[io,oo,wo,Co]);return reactExports.createElement(DescendantProvider,{context:TabsDescendantsContext,items:Co,set:Ro},reactExports.createElement(TabsProvider,{focusedIndex:Eo,id:uo,isControlled:lo,isRTL:go,keyboardActivation:io,onFocusPanel:Oo,onSelectTab:ao?noop$9:jo,onSelectTabWithKeyboard:ao?noop$9:Bo,orientation:ro,selectedIndex:bo,selectedPanelRef:ho,setFocusedIndex:$o,setSelectedIndex:wo},reactExports.createElement(Xr,{...so,ref:co,"data-reach-tabs":"","data-orientation":ro,id:so.id},isFunction$7(eo)?eo({focusedIndex:Eo,id:uo,selectedIndex:bo}):eo)))});Tabs.displayName="Tabs";var TabListImpl=reactExports.forwardRef(({children:Xr,as:eo="div",onKeyDown:to,...ro},no)=>{let{focusedIndex:io,isControlled:oo,isRTL:ao,keyboardActivation:so,onSelectTabWithKeyboard:co,orientation:lo,selectedIndex:uo,setSelectedIndex:ho}=useTabsCtx("TabList"),go=useDescendants(TabsDescendantsContext),bo=reactExports.useRef(null),wo=useComposedRefs(no,bo);reactExports.useEffect(()=>{bo.current&&(bo.current.ownerDocument&&bo.current.ownerDocument.dir==="rtl"||getComputedStyle$1(bo.current,"direction")==="rtl")&&(ao.current=!0)},[ao]);let Eo=composeEventHandlers(to,useDescendantKeyDown(TabsDescendantsContext,{currentIndex:so==="manual"?io:uo,orientation:lo,rotate:!0,callback:co,filter:$o=>!$o.disabled,rtl:ao.current}));return useIsomorphicLayoutEffect$3(()=>{var $o;if(!oo&&boolOrBoolString(($o=go[uo])==null?void 0:$o.disabled)){let Co=go.find(Ro=>!Ro.disabled);Co&&ho(Co.index)}},[go,oo,uo,ho]),reactExports.createElement(eo,{role:"tablist","aria-orientation":lo,...ro,"data-reach-tab-list":"",ref:wo,onKeyDown:Eo},Xr)});TabListImpl.displayName="TabList";var TabList=reactExports.memo(TabListImpl);TabList.displayName="TabList";var Tab=reactExports.forwardRef(({isSelected:Xr,children:eo,as:to="button",index:ro,disabled:no,onBlur:io,onFocus:oo,...ao},so)=>{let{id:co,onSelectTab:lo,orientation:uo,selectedIndex:ho,setFocusedIndex:go}=useTabsCtx("Tab"),bo=reactExports.useRef(null),[wo,Eo]=useStatefulRefValue(bo,null),$o=useComposedRefs(so,Eo),Co=reactExports.useMemo(()=>({element:wo,disabled:!!no}),[no,wo]),Ro=useDescendant(Co,TabsDescendantsContext,ro),Oo=to==="button"&&ao.type==null?"button":ao.type,jo=Ro===ho;function Bo(){lo(Ro)}return reactExports.createElement(to,{"aria-controls":makeId(co,"panel",Ro),"aria-disabled":no,"aria-selected":jo,role:"tab",tabIndex:jo?0:-1,...ao,ref:$o,"data-reach-tab":"","data-orientation":uo,"data-selected":jo?"":void 0,disabled:no,id:makeId(co,"tab",Ro),onClick:Bo,onFocus:composeEventHandlers(oo,()=>{go(Ro)}),onBlur:composeEventHandlers(io,()=>{go(-1)}),type:Oo},eo)});Tab.displayName="Tab";var TabPanelsImpl=reactExports.forwardRef(({children:Xr,as:eo="div",...to},ro)=>{let no=reactExports.useRef(),io=useComposedRefs(no,ro),[oo,ao]=useDescendantsInit();return reactExports.createElement(DescendantProvider,{context:TabPanelDescendantsContext,items:oo,set:ao},reactExports.createElement(eo,{...to,ref:io,"data-reach-tab-panels":""},Xr))});TabPanelsImpl.displayName="TabPanels";var TabPanels=reactExports.memo(TabPanelsImpl);TabPanels.displayName="TabPanels";var TabPanel=reactExports.forwardRef(({children:Xr,"aria-label":eo,as:to="div",index:ro,...no},io)=>{let{selectedPanelRef:oo,selectedIndex:ao,id:so}=useTabsCtx("TabPanel"),co=reactExports.useRef(null),[lo,uo]=useStatefulRefValue(co,null),ho=reactExports.useMemo(()=>({element:lo}),[lo]),go=useDescendant(ho,TabPanelDescendantsContext,ro),bo=makeId(so,"panel",go),wo=go===ao,Eo=reactExports.useRef(!1),$o=Eo.current?!wo:!1;reactExports.useEffect(()=>{Eo.current=!0},[]);let Co=useComposedRefs(io,uo,wo?oo:null);return reactExports.createElement(to,{"aria-labelledby":makeId(so,"tab",go),hidden:$o,role:"tabpanel",tabIndex:wo?0:-1,...no,ref:Co,"data-reach-tab-panel":"",id:bo},Xr)});TabPanel.displayName="TabPanel";function boolOrBoolString(Xr){return Xr==="true"?!0:isBoolean$2(Xr)?Xr:!1}qe$4(Tabs)` + display: flex; + flex-direction: column; + gap: var(--spacing-sm); +`;qe$4(TabList)` + overflow: auto hidden; + display: flex; + width: fit-content; + @media${deviceMediaQ.mobileL} { + width: -webkit-fill-available; + } + padding: var(--spacing-xxxs); + background-color: var(--surface-secondary); + border-radius: var(--radius-sm); + gap: var(--spacing-xxs); +`;qe$4(Tab)` + display: flex; + padding: var(--spacing-none) var(--spacing-sm); + height: 40px; + justify-content: center; + align-items: center; + gap: var(--spacing-xxs); + align-self: stretch; + cursor: pointer; + color: var(--text-secondary); + background-color: var(--surface-transparent); + border-radius: var(--radius-xs); + transition: background-color 0.3s, color 0.3s; + border-bottom: none; + + &[data-selected] { + background-color: var(--components-button-tertiary-background-inverse); + color: var(--text-secondary); + } + + &:focus { + outline: none; + } + + &:hover { + color: var(--components-button-secondary-text-default); + } + + &:focus-visible { + outline: var(--border-sm) solid var(--stroke-state-focused); + } + + &:active { + background-color: var(--surface-transparent); + color: var(--components-button-secondary-text-default); + } + + &[aria-disabled='true'] { + cursor: not-allowed; + color: var(--components-button-secondary-text-disabled); + opacity: 1; + } +`;qe$4(Tabs)` + display: flex; + flex-direction: column; + gap: var(--spacing-sm); +`;qe$4(TabList)` + overflow: auto hidden; + display: flex; + background-color: var(--surface-transparent); + gap: var(--spacing-xs); + justify-content: flex-start; + border-bottom: var(--border-sm) solid var(--stroke-secondary); +`;qe$4(Tab)` + display: flex; + padding: var(--spacing-none) var(--spacing-sm); + height: 40px; + justify-content: center; + align-items: center; + gap: var(--spacing-xxs); + cursor: pointer; + margin-bottom: -1px; + background-color: var(--surface-transparent); + color: var(--text-secondary); + transition: background-color 0.3s, color 0.3s; + border-bottom: var(--border-md) solid var(--surface-transparent); + + &[data-selected] { + border-bottom: var(--border-md) solid var(--stroke-brand-medium); + color: var(--text-primary); + } + + &:hover { + color: var(--text-primary); + } + + &:focus-visible { + outline: var(--border-md) solid var(--stroke-state-focused); + border-bottom: var(--border-md) solid var(--surface-transparent); + border-radius: var(--radius-xs); + margin-bottom: -2px; + } + + &:active { + background-color: var(--surface-transparent); + color: var(--text-primary); + } + + &[aria-disabled='true'] { + cursor: not-allowed; + color: var(--text-state-disabled); + border-bottom: var(--border-md) solid var(--stroke-state-disabled); + opacity: 1; + } +`;qe$4.span` + white-space: nowrap; + font-family: var(--font-family); + font-size: ${textVariants["h5-semibold"].fontSize}; + font-style: ${textVariants["h5-semibold"].fontStyle}; + font-weight: ${textVariants["h5-semibold"].fontWeight}; + line-height: ${textVariants["h5-semibold"].lineHeight}; +`;var isDevelopment$2=!1;function sheetForTag(Xr){if(Xr.sheet)return Xr.sheet;for(var eo=0;eo0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next(){return character=position2||token$1(character)>3?"":" "}function escaping(Xr,eo){for(;--eo&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$1(Xr,caret$1()+(eo<6&&peek()==32&&next()==32))}function delimiter(Xr){for(;next();)switch(character){case Xr:return position;case 34:case 39:Xr!==34&&Xr!==39&&delimiter(character);break;case 40:Xr===41&&delimiter(Xr);break;case 92:next();break}return position}function commenter(Xr,eo){for(;next()&&Xr+character!==57;)if(Xr+character===84&&peek()===47)break;return"/*"+slice$1(eo,position-1)+"*"+from$1(Xr===47?Xr:next())}function identifier(Xr){for(;!token$1(peek());)next();return slice$1(Xr,position)}function compile$1(Xr){return dealloc(parse$4("",null,null,null,[""],Xr=alloc(Xr),0,[0],Xr))}function parse$4(Xr,eo,to,ro,no,io,oo,ao,so){for(var co=0,lo=0,uo=oo,ho=0,go=0,bo=0,wo=1,Eo=1,$o=1,Co=0,Ro="",Oo=no,jo=io,Bo=ro,Mo=Ro;Eo;)switch(bo=Co,Co=next()){case 40:if(bo!=108&&charat(Mo,uo-1)==58){indexof(Mo+=replace(delimit(Co),"&","&\f"),"&\f")!=-1&&($o=-1);break}case 34:case 39:case 91:Mo+=delimit(Co);break;case 9:case 10:case 13:case 32:Mo+=whitespace(bo);break;case 92:Mo+=escaping(caret$1()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret$1()),eo,to),so);break;default:Mo+="/"}break;case 123*wo:ao[co++]=strlen(Mo)*$o;case 125*wo:case 59:case 0:switch(Co){case 0:case 125:Eo=0;case 59+lo:$o==-1&&(Mo=replace(Mo,/\f/g,"")),go>0&&strlen(Mo)-uo&&append(go>32?declaration(Mo+";",ro,to,uo-1):declaration(replace(Mo," ","")+";",ro,to,uo-2),so);break;case 59:Mo+=";";default:if(append(Bo=ruleset(Mo,eo,to,co,lo,no,ao,Ro,Oo=[],jo=[],uo),io),Co===123)if(lo===0)parse$4(Mo,eo,Bo,Bo,Oo,io,uo,ao,jo);else switch(ho===99&&charat(Mo,3)===110?100:ho){case 100:case 108:case 109:case 115:parse$4(Xr,Bo,Bo,ro&&append(ruleset(Xr,Bo,Bo,0,0,no,ao,Ro,no,Oo=[],uo),jo),no,jo,uo,ao,ro?Oo:jo);break;default:parse$4(Mo,Bo,Bo,Bo,[""],jo,0,ao,jo)}}co=lo=go=0,wo=$o=1,Ro=Mo="",uo=oo;break;case 58:uo=1+strlen(Mo),go=bo;default:if(wo<1){if(Co==123)--wo;else if(Co==125&&wo++==0&&prev()==125)continue}switch(Mo+=from$1(Co),Co*wo){case 38:$o=lo>0?1:(Mo+="\f",-1);break;case 44:ao[co++]=(strlen(Mo)-1)*$o,$o=1;break;case 64:peek()===45&&(Mo+=delimit(next())),ho=peek(),lo=uo=strlen(Ro=Mo+=identifier(caret$1())),Co++;break;case 45:bo===45&&strlen(Mo)==2&&(wo=0)}}return io}function ruleset(Xr,eo,to,ro,no,io,oo,ao,so,co,lo){for(var uo=no-1,ho=no===0?io:[""],go=sizeof(ho),bo=0,wo=0,Eo=0;bo0?ho[$o]+" "+Co:replace(Co,/&\f/g,ho[$o])))&&(so[Eo++]=Ro);return node$2(Xr,eo,to,no===0?RULESET:ao,so,co,lo)}function comment(Xr,eo,to){return node$2(Xr,eo,to,COMMENT$1,from$1(char()),substr(Xr,2,-2),0)}function declaration(Xr,eo,to,ro){return node$2(Xr,eo,to,DECLARATION,substr(Xr,0,ro),substr(Xr,ro+1,-1),ro)}function serialize$2(Xr,eo){for(var to="",ro=sizeof(Xr),no=0;no6)switch(charat(Xr,eo+1)){case 109:if(charat(Xr,eo+4)!==45)break;case 102:return replace(Xr,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(Xr,eo+3)==108?"$3":"$2-$3"))+Xr;case 115:return~indexof(Xr,"stretch")?prefix(replace(Xr,"stretch","fill-available"),eo)+Xr:Xr}break;case 4949:if(charat(Xr,eo+1)!==115)break;case 6444:switch(charat(Xr,strlen(Xr)-3-(~indexof(Xr,"!important")&&10))){case 107:return replace(Xr,":",":"+WEBKIT)+Xr;case 101:return replace(Xr,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(Xr,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+Xr}break;case 5936:switch(charat(Xr,eo+11)){case 114:return WEBKIT+Xr+MS+replace(Xr,/[svh]\w+-[tblr]{2}/,"tb")+Xr;case 108:return WEBKIT+Xr+MS+replace(Xr,/[svh]\w+-[tblr]{2}/,"tb-rl")+Xr;case 45:return WEBKIT+Xr+MS+replace(Xr,/[svh]\w+-[tblr]{2}/,"lr")+Xr}return WEBKIT+Xr+MS+Xr+Xr}return Xr}var prefixer=function(eo,to,ro,no){if(eo.length>-1&&!eo.return)switch(eo.type){case DECLARATION:eo.return=prefix(eo.value,eo.length);break;case KEYFRAMES:return serialize$2([copy$2(eo,{value:replace(eo.value,"@","@"+WEBKIT)})],no);case RULESET:if(eo.length)return combine$1(eo.props,function(io){switch(match(io,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize$2([copy$2(eo,{props:[replace(io,/:(read-\w+)/,":"+MOZ+"$1")]})],no);case"::placeholder":return serialize$2([copy$2(eo,{props:[replace(io,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy$2(eo,{props:[replace(io,/:(plac\w+)/,":"+MOZ+"$1")]}),copy$2(eo,{props:[replace(io,/:(plac\w+)/,MS+"input-$1")]})],no)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(eo){var to=eo.key;if(to==="css"){var ro=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(ro,function(wo){var Eo=wo.getAttribute("data-emotion");Eo.indexOf(" ")!==-1&&(document.head.appendChild(wo),wo.setAttribute("data-s",""))})}var no=eo.stylisPlugins||defaultStylisPlugins,io={},oo,ao=[];oo=eo.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+to+' "]'),function(wo){for(var Eo=wo.getAttribute("data-emotion").split(" "),$o=1;$o=4;++ro,no-=4)to=Xr.charCodeAt(ro)&255|(Xr.charCodeAt(++ro)&255)<<8|(Xr.charCodeAt(++ro)&255)<<16|(Xr.charCodeAt(++ro)&255)<<24,to=(to&65535)*1540483477+((to>>>16)*59797<<16),to^=to>>>24,eo=(to&65535)*1540483477+((to>>>16)*59797<<16)^(eo&65535)*1540483477+((eo>>>16)*59797<<16);switch(no){case 3:eo^=(Xr.charCodeAt(ro+2)&255)<<16;case 2:eo^=(Xr.charCodeAt(ro+1)&255)<<8;case 1:eo^=Xr.charCodeAt(ro)&255,eo=(eo&65535)*1540483477+((eo>>>16)*59797<<16)}return eo^=eo>>>13,eo=(eo&65535)*1540483477+((eo>>>16)*59797<<16),((eo^eo>>>15)>>>0).toString(36)}var unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},isDevelopment$1=!1,hyphenateRegex=/[A-Z]|^ms/g,animationRegex=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty=function(eo){return eo.charCodeAt(1)===45},isProcessableValue=function(eo){return eo!=null&&typeof eo!="boolean"},processStyleName=memoize$3(function(Xr){return isCustomProperty(Xr)?Xr:Xr.replace(hyphenateRegex,"-$&").toLowerCase()}),processStyleValue=function(eo,to){switch(eo){case"animation":case"animationName":if(typeof to=="string")return to.replace(animationRegex,function(ro,no,io){return cursor={name:no,styles:io,next:cursor},no})}return unitlessKeys[eo]!==1&&!isCustomProperty(eo)&&typeof to=="number"&&to!==0?to+"px":to},noComponentSelectorMessage="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function handleInterpolation(Xr,eo,to){if(to==null)return"";var ro=to;if(ro.__emotion_styles!==void 0)return ro;switch(typeof to){case"boolean":return"";case"object":{var no=to;if(no.anim===1)return cursor={name:no.name,styles:no.styles,next:cursor},no.name;var io=to;if(io.styles!==void 0){var oo=io.next;if(oo!==void 0)for(;oo!==void 0;)cursor={name:oo.name,styles:oo.styles,next:cursor},oo=oo.next;var ao=io.styles+";";return ao}return createStringFromObject(Xr,eo,to)}case"function":{if(Xr!==void 0){var so=cursor,co=to(Xr);return cursor=so,handleInterpolation(Xr,eo,co)}break}}var lo=to;return lo}function createStringFromObject(Xr,eo,to){var ro="";if(Array.isArray(to))for(var no=0;no=0||(no[to]=Xr[to]);return no},e$7=function(Xr,eo){if(Xr==null)return{};var to,ro,no=i$d(Xr,eo);if(Object.getOwnPropertySymbols){var io=Object.getOwnPropertySymbols(Xr);for(ro=0;ro=0||Object.prototype.propertyIsEnumerable.call(Xr,to)&&(no[to]=Xr[to])}return no},b$8=reactExports.createContext(null),u$a=function(Xr){var eo=Xr.current.querySelector(".tr-header");return Array.from((eo==null?void 0:eo.querySelectorAll(".th"))||[])},C$7=function(Xr,eo,to,ro){return Array.from(Xr.current.querySelectorAll(to)).forEach(function(no){var io=Array.from(no.querySelectorAll(ro)),oo=io.length;io.forEach(function(ao,so){return eo(ao,so,oo)})})},o$b=function(Xr,eo){return C$7(Xr,eo,".tr-header",".th")},a$9=function(Xr,eo){return C$7(Xr,eo,".tr-body",".td")},G$6=function(Xr,eo){return{index:eo,minWidth:+Xr.getAttribute("data-resize-min-width"),width:Xr.getBoundingClientRect().width,isStiff:Xr.classList.contains("stiff"),isHide:Xr.getAttribute("data-hide")==="true",isColSpan:Xr.classList.contains("colspan")}},A$9=reactExports.createContext(null),X$6=function(Xr){var eo=Xr.tableElementRef,to=Xr.tableMemoryRef,ro=Xr.layout,no=Xr.children,io=reactExports.useMemo(function(){return{layout:ro,tableElementRef:eo,tableMemoryRef:to}},[ro,eo,to]);return jsx(A$9.Provider,{value:io},no)},d$9=function(Xr,eo){var to=u$a(Xr).map(G$6);eo.current.dataColumns=to},r$a=function(Xr,eo,to){var ro=eo.current.style.getPropertyValue("--data-table-library_grid-template-columns")!==Xr;eo.current&&Xr&&ro&&(eo.current.style.setProperty("--data-table-library_grid-template-columns",Xr),d$9(eo,to))},x$9=function(Xr,eo){eo!=null&&eo.onLayoutChange&&Xr&&eo.onLayoutChange(Xr)},y$c=` + `.concat(function(){},` + padding: 0; + margin: 0; + + `).concat(function(){},` + display: flex; + align-items: center; + + `).concat(function(){},` + align-self: stretch; + + + & > div { + `).concat(function(){},` + flex: 1; + + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + + &.hide { + display: none; + } + + &.pin-left, + &.pin-right { + position: sticky; + z-index: 2; + } + + `).concat(function(){},` + background-color: inherit; +`),s$7=css(y$c,";",""),p$a=reactExports.forwardRef(function(Xr,eo){var to=reactExports.useContext(A$9);if(!to)throw new Error("No Layout Context.");var ro=to.layout,no=ro!=null&&ro.isDiv?"div":"td";return jsx(no,n$a({css:s$7,ref:eo},Xr))}),B$8=css(y$c," z-index:1;text-align:left;position:sticky;top:0;&.pin-left,&.pin-right{z-index:3;}",""),Z$5=reactExports.forwardRef(function(Xr,eo){var to=reactExports.useContext(A$9);if(!to)throw new Error("No Layout Context.");var ro=to.layout,no=ro!=null&&ro.isDiv?"div":"th";return jsx(no,n$a({css:B$8,ref:eo},Xr))}),W$7={name:"1k13m5t",styles:"z-index:2;position:absolute;top:0;right:0;bottom:0;width:1px;margin:4px 0"},m$5=function(Xr){var eo=typeof Xr=="boolean"||(Xr==null?void 0:Xr.resizerWidth)==null?10:Xr.resizerWidth,to=typeof Xr=="boolean"||(Xr==null?void 0:Xr.resizerHighlight)==null?"transparent":Xr.resizerHighlight;return{handle:W$7,area:css("z-index:1;position:absolute;top:0;right:0;bottom:0;cursor:ew-resize;width:",eo,"px;height:100%;&:hover,&.active{background-color:",to,";}","")}},r$9=function(Xr,eo){(eo==null||eo>Xr.length)&&(eo=Xr.length);for(var to=0,ro=new Array(eo);toBo&&Ao.width!==0?Ao:To)},null),Fo=jo.reduce(function(To,Ao){return To+Ao.width},0),Wo=jo[Bo].minWidth,Jo=Oo>Wo&&Oo!==0?Oo:Wo,Po=Jo-jo[Bo].width,fo=jo.map(function(To,Ao){if(Mo&&Bo===Ao)return Mo.width-Po>Wo?Jo:To.width;if((Mo==null?void 0:Mo.index)===Ao){var ko=To.width-Po;return ko>Wo?ko:To.width}return To.width}),yo=Fo-fo.reduce(function(To,Ao){return To+Ao},0);fo[Bo]=fo[Bo]+yo;var vo=!1,_o=jo.slice(0).reverse().map(function(To,Ao){var ko=fo.slice(0).reverse()[Ao],mo=ko/Fo*100;return To.isStiff||Co!=null&&Co.horizontalScroll?"".concat(ko,"px"):vo?"minmax(0, ".concat(mo,"%)"):(vo=!0,"minmax(0, 1fr)")}).slice(0).reverse().join(" "),So=function(To,Ao){if(u$9(Array.from(To.classList)).includes("pin-left")){var ko=fo.reduce(function(Io,Do,Lo){return Lo>=Ao?Io:Io+Do},0);To.style.left="".concat(ko,"px")}if(u$9(Array.from(To.classList)).includes("pin-right")){var mo=fo.reduceRight(function(Io,Do,Lo){return Lo<=Ao?Io:Io+Do},0);To.style.right="".concat(mo,"px")}};return o$b(Ro,So),a$9(Ro,So),_o}(Xr,io,ro,wo);r$a(Eo,ro,no)}},[Xr,io,ro,no]),go=reactExports.useCallback(function(){var bo;lo.current=!1;var wo=ro.current.style.getPropertyValue("--data-table-library_grid-template-columns");if(so.current!==wo){x$9(wo,io);var Eo=u$a(ro).map(G$6);no.current.dataColumns=Eo}(bo=oo.current)===null||bo===void 0||bo.querySelector(".resizer-area").classList.remove("active")},[io,ro,no]);return reactExports.useEffect(function(){var bo=ao.current;return bo&&(bo.addEventListener("mousedown",uo),document.addEventListener("mousemove",ho),document.addEventListener("mouseup",go)),function(){bo&&(bo.removeEventListener("mousedown",uo),document.removeEventListener("mousemove",ho),document.removeEventListener("mouseup",go))}},[eo,uo,ho,go]),{cellRef:oo,resizeRef:ao}},p$9=["index","className","hide","pinLeft","pinRight","stiff","isFooter","includePreviousColSpan","previousColSpans","gridColumnStart","gridColumnEnd","resize","role","children","style"];function h$a(Xr,eo){var to=Object.keys(Xr);if(Object.getOwnPropertySymbols){var ro=Object.getOwnPropertySymbols(Xr);eo&&(ro=ro.filter(function(no){return Object.getOwnPropertyDescriptor(Xr,no).enumerable})),to.push.apply(to,ro)}return to}function x$8(Xr){for(var eo=1;eoXr?` + div { + display: flex; + justify-content: ${Xr}; + } + `:""} +`;qe$4(o$8)` + ${({cellAlignment:Xr})=>Xr?` + div { + display: flex; + justify-content: ${Xr}; + } + `:""} +`;qe$4.div` + position: absolute; + z-index: 100; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + flex-direction: column; + gap: var(--spacing-xs); + opacity: ${({blur:Xr})=>Xr?"0.5":"1"}; +`;qe$4.div` + display: flex; + align-items: center; + justify-content: center; + gap: var(--spacing-xs); + flex-direction: column; +`;qe$4.div` + display: flex; + align-items: center; + justify-content: center; + gap: var(--spacing-xxxs); + flex-direction: column; +`;qe$4.span` + ${()=>getTextVariantStyles("bm-semibold","text-primary")} +`;qe$4.span` + ${()=>getTextVariantStyles("bes-regular","text-tertiary")} +`;qe$4.span` + ${()=>getTextVariantStyles("bm-semibold","text-tertiary")} +`;qe$4.div` + width: inherit; + height: inherit; + position: relative; +`;const sizeMapping={small:{padding:"var(--spacing-none) var(--spacing-xxxs)",height:"18px",borderRadius:"var(--radius-xs)"},medium:{padding:"var(--spacing-none) var(--spacing-xxs)",height:"24px",borderRadius:"var(--radius-md)"}};qe$4.div` + align-items: center; + border-radius: ${({size:Xr})=>sizeMapping[Xr].borderRadius}; + background: var(--components-tag-background-${({variant:Xr})=>Xr}); + display: flex; + gap: var(--spacing-xxxs); + padding: ${({size:Xr})=>sizeMapping[Xr].padding}; + width: max-content; + height: ${({size:Xr})=>sizeMapping[Xr].height}; + + ${({icon:Xr})=>Xr&&` + [role='img'] { + width: 14px; + height: 14px; + }; + `} +`;qe$4.span` + display: flex; + align-items: center; + justify-content: center; + color: var(--components-tag-text-${({variant:Xr})=>Xr}); +`;qe$4.span` + ${({variant:Xr})=>getTextVariantStyles("bes-semibold",`components-tag-text-${Xr}`)} +`;qe$4.div` + background: var(--components-tag-icon-${({variant:Xr})=>Xr}); + border-radius: var(--radius-lg); + flex-shrink: 0; + height: 10px; + width: 10px; +`;var NAME$3="VisuallyHidden",VisuallyHidden=reactExports.forwardRef((Xr,eo)=>jsxRuntimeExports.jsx(Primitive.span,{...Xr,ref:eo,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...Xr.style}}));VisuallyHidden.displayName=NAME$3;var Root$1=VisuallyHidden,[createTooltipContext,createTooltipScope]=createContextScope$3("Tooltip",[createPopperScope]),usePopperScope=createPopperScope(),PROVIDER_NAME="TooltipProvider",TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(PROVIDER_NAME),TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),TRIGGER_NAME="TooltipTrigger",TooltipTrigger=reactExports.forwardRef((Xr,eo)=>{const{__scopeTooltip:to,...ro}=Xr,no=useTooltipContext(TRIGGER_NAME,to),io=useTooltipProviderContext(TRIGGER_NAME,to),oo=usePopperScope(to),ao=reactExports.useRef(null),so=useComposedRefs$1(eo,ao,no.onTriggerChange),co=reactExports.useRef(!1),lo=reactExports.useRef(!1),uo=reactExports.useCallback(()=>co.current=!1,[]);return reactExports.useEffect(()=>()=>document.removeEventListener("pointerup",uo),[uo]),jsxRuntimeExports.jsx(Anchor,{asChild:!0,...oo,children:jsxRuntimeExports.jsx(Primitive.button,{"aria-describedby":no.open?no.contentId:void 0,"data-state":no.stateAttribute,...ro,ref:so,onPointerMove:composeEventHandlers$1(Xr.onPointerMove,ho=>{ho.pointerType!=="touch"&&!lo.current&&!io.isPointerInTransitRef.current&&(no.onTriggerEnter(),lo.current=!0)}),onPointerLeave:composeEventHandlers$1(Xr.onPointerLeave,()=>{no.onTriggerLeave(),lo.current=!1}),onPointerDown:composeEventHandlers$1(Xr.onPointerDown,()=>{co.current=!0,document.addEventListener("pointerup",uo,{once:!0})}),onFocus:composeEventHandlers$1(Xr.onFocus,()=>{co.current||no.onOpen()}),onBlur:composeEventHandlers$1(Xr.onBlur,no.onClose),onClick:composeEventHandlers$1(Xr.onClick,no.onClose)})})});TooltipTrigger.displayName=TRIGGER_NAME;var PORTAL_NAME="TooltipPortal",[PortalProvider,usePortalContext]=createTooltipContext(PORTAL_NAME,{forceMount:void 0}),CONTENT_NAME="TooltipContent",TooltipContent=reactExports.forwardRef((Xr,eo)=>{const to=usePortalContext(CONTENT_NAME,Xr.__scopeTooltip),{forceMount:ro=to.forceMount,side:no="top",...io}=Xr,oo=useTooltipContext(CONTENT_NAME,Xr.__scopeTooltip);return jsxRuntimeExports.jsx(Presence,{present:ro||oo.open,children:oo.disableHoverableContent?jsxRuntimeExports.jsx(TooltipContentImpl,{side:no,...io,ref:eo}):jsxRuntimeExports.jsx(TooltipContentHoverable,{side:no,...io,ref:eo})})}),TooltipContentHoverable=reactExports.forwardRef((Xr,eo)=>{const to=useTooltipContext(CONTENT_NAME,Xr.__scopeTooltip),ro=useTooltipProviderContext(CONTENT_NAME,Xr.__scopeTooltip),no=reactExports.useRef(null),io=useComposedRefs$1(eo,no),[oo,ao]=reactExports.useState(null),{trigger:so,onClose:co}=to,lo=no.current,{onPointerInTransitChange:uo}=ro,ho=reactExports.useCallback(()=>{ao(null),uo(!1)},[uo]),go=reactExports.useCallback((bo,wo)=>{const Eo=bo.currentTarget,$o={x:bo.clientX,y:bo.clientY},Co=getExitSideFromRect($o,Eo.getBoundingClientRect()),Ro=getPaddedExitPoints($o,Co),Oo=getPointsFromRect(wo.getBoundingClientRect()),jo=getHull([...Ro,...Oo]);ao(jo),uo(!0)},[uo]);return reactExports.useEffect(()=>()=>ho(),[ho]),reactExports.useEffect(()=>{if(so&&lo){const bo=Eo=>go(Eo,lo),wo=Eo=>go(Eo,so);return so.addEventListener("pointerleave",bo),lo.addEventListener("pointerleave",wo),()=>{so.removeEventListener("pointerleave",bo),lo.removeEventListener("pointerleave",wo)}}},[so,lo,go,ho]),reactExports.useEffect(()=>{if(oo){const bo=wo=>{const Eo=wo.target,$o={x:wo.clientX,y:wo.clientY},Co=(so==null?void 0:so.contains(Eo))||(lo==null?void 0:lo.contains(Eo)),Ro=!isPointInPolygon($o,oo);Co?ho():Ro&&(ho(),co())};return document.addEventListener("pointermove",bo),()=>document.removeEventListener("pointermove",bo)}},[so,lo,oo,co,ho]),jsxRuntimeExports.jsx(TooltipContentImpl,{...Xr,ref:io})}),[VisuallyHiddenContentContextProvider,useVisuallyHiddenContentContext]=createTooltipContext(TOOLTIP_NAME,{isInside:!1}),TooltipContentImpl=reactExports.forwardRef((Xr,eo)=>{const{__scopeTooltip:to,children:ro,"aria-label":no,onEscapeKeyDown:io,onPointerDownOutside:oo,...ao}=Xr,so=useTooltipContext(CONTENT_NAME,to),co=usePopperScope(to),{onClose:lo}=so;return reactExports.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,lo),()=>document.removeEventListener(TOOLTIP_OPEN,lo)),[lo]),reactExports.useEffect(()=>{if(so.trigger){const uo=ho=>{const go=ho.target;go!=null&&go.contains(so.trigger)&&lo()};return window.addEventListener("scroll",uo,{capture:!0}),()=>window.removeEventListener("scroll",uo,{capture:!0})}},[so.trigger,lo]),jsxRuntimeExports.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:io,onPointerDownOutside:oo,onFocusOutside:uo=>uo.preventDefault(),onDismiss:lo,children:jsxRuntimeExports.jsxs(Content$1,{"data-state":so.stateAttribute,...co,...ao,ref:eo,style:{...ao.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[jsxRuntimeExports.jsx(Slottable,{children:ro}),jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider,{scope:to,isInside:!0,children:jsxRuntimeExports.jsx(Root$1,{id:so.contentId,role:"tooltip",children:no||ro})})]})})});TooltipContent.displayName=CONTENT_NAME;var ARROW_NAME="TooltipArrow",TooltipArrow=reactExports.forwardRef((Xr,eo)=>{const{__scopeTooltip:to,...ro}=Xr,no=usePopperScope(to);return useVisuallyHiddenContentContext(ARROW_NAME,to).isInside?null:jsxRuntimeExports.jsx(Arrow,{...no,...ro,ref:eo})});TooltipArrow.displayName=ARROW_NAME;function getExitSideFromRect(Xr,eo){const to=Math.abs(eo.top-Xr.y),ro=Math.abs(eo.bottom-Xr.y),no=Math.abs(eo.right-Xr.x),io=Math.abs(eo.left-Xr.x);switch(Math.min(to,ro,no,io)){case io:return"left";case no:return"right";case to:return"top";case ro:return"bottom";default:throw new Error("unreachable")}}function getPaddedExitPoints(Xr,eo,to=5){const ro=[];switch(eo){case"top":ro.push({x:Xr.x-to,y:Xr.y+to},{x:Xr.x+to,y:Xr.y+to});break;case"bottom":ro.push({x:Xr.x-to,y:Xr.y-to},{x:Xr.x+to,y:Xr.y-to});break;case"left":ro.push({x:Xr.x+to,y:Xr.y-to},{x:Xr.x+to,y:Xr.y+to});break;case"right":ro.push({x:Xr.x-to,y:Xr.y-to},{x:Xr.x-to,y:Xr.y+to});break}return ro}function getPointsFromRect(Xr){const{top:eo,right:to,bottom:ro,left:no}=Xr;return[{x:no,y:eo},{x:to,y:eo},{x:to,y:ro},{x:no,y:ro}]}function isPointInPolygon(Xr,eo){const{x:to,y:ro}=Xr;let no=!1;for(let io=0,oo=eo.length-1;ioro!=lo>ro&&to<(co-ao)*(ro-so)/(lo-so)+ao&&(no=!no)}return no}function getHull(Xr){const eo=Xr.slice();return eo.sort((to,ro)=>to.xro.x?1:to.yro.y?1:0),getHullPresorted(eo)}function getHullPresorted(Xr){if(Xr.length<=1)return Xr.slice();const eo=[];for(let ro=0;ro=2;){const io=eo[eo.length-1],oo=eo[eo.length-2];if((io.x-oo.x)*(no.y-oo.y)>=(io.y-oo.y)*(no.x-oo.x))eo.pop();else break}eo.push(no)}eo.pop();const to=[];for(let ro=Xr.length-1;ro>=0;ro--){const no=Xr[ro];for(;to.length>=2;){const io=to[to.length-1],oo=to[to.length-2];if((io.x-oo.x)*(no.y-oo.y)>=(io.y-oo.y)*(no.x-oo.x))to.pop();else break}to.push(no)}return to.pop(),eo.length===1&&to.length===1&&eo[0].x===to[0].x&&eo[0].y===to[0].y?eo:eo.concat(to)}var Content2=TooltipContent;const tooltipCSSPropsKeys=["height","maxHeight","minHeight","maxWidth","minWidth","width"],__vite_import_meta_env__={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"};var define_process_env_default$8={};function getAppBasePath(){if(typeof import.meta<"u"&&__vite_import_meta_env__)return"/push-wallet/";if(typeof process$1$1<"u"&&define_process_env_default$8){if(define_process_env_default$8.VITE_DEV_MODE==="preview")return"/push-wallet/pr-preview/";if(define_process_env_default$8.VITE_DEV_MODE==="testing")return"/push-wallet/"}return"/"}var freeGlobal$4=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf$3=typeof self=="object"&&self&&self.Object===Object&&self;freeGlobal$4||freeSelf$3||Function("return this")();var useIsomorphicLayoutEffect$2=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useEventListener(Xr,eo,to,ro){const no=reactExports.useRef(eo);useIsomorphicLayoutEffect$2(()=>{no.current=eo},[eo]),reactExports.useEffect(()=>{const io=window;if(!(io&&io.addEventListener))return;const oo=ao=>{no.current(ao)};return io.addEventListener(Xr,oo,ro),()=>{io.removeEventListener(Xr,oo,ro)}},[Xr,to,ro])}function useEventCallback$1(Xr){const eo=reactExports.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return useIsomorphicLayoutEffect$2(()=>{eo.current=Xr},[Xr]),reactExports.useCallback((...to)=>{var ro;return(ro=eo.current)==null?void 0:ro.call(eo,...to)},[eo])}var IS_SERVER=typeof window>"u";function useLocalStorage$1(Xr,eo,to={}){const{initializeWithValue:ro=!0}=to,no=reactExports.useCallback(ho=>to.serializer?to.serializer(ho):JSON.stringify(ho),[to]),io=reactExports.useCallback(ho=>{if(to.deserializer)return to.deserializer(ho);if(ho==="undefined")return;const go=eo instanceof Function?eo():eo;let bo;try{bo=JSON.parse(ho)}catch(wo){return console.error("Error parsing JSON:",wo),go}return bo},[to,eo]),oo=reactExports.useCallback(()=>{const ho=eo instanceof Function?eo():eo;if(IS_SERVER)return ho;try{const go=window.localStorage.getItem(Xr);return go?io(go):ho}catch(go){return console.warn(`Error reading localStorage key “${Xr}”:`,go),ho}},[eo,Xr,io]),[ao,so]=reactExports.useState(()=>ro?oo():eo instanceof Function?eo():eo),co=useEventCallback$1(ho=>{IS_SERVER&&console.warn(`Tried setting localStorage key “${Xr}” even though environment is not a client`);try{const go=ho instanceof Function?ho(oo()):ho;window.localStorage.setItem(Xr,no(go)),so(go),window.dispatchEvent(new StorageEvent("local-storage",{key:Xr}))}catch(go){console.warn(`Error setting localStorage key “${Xr}”:`,go)}}),lo=useEventCallback$1(()=>{IS_SERVER&&console.warn(`Tried removing localStorage key “${Xr}” even though environment is not a client`);const ho=eo instanceof Function?eo():eo;window.localStorage.removeItem(Xr),so(ho),window.dispatchEvent(new StorageEvent("local-storage",{key:Xr}))});reactExports.useEffect(()=>{so(oo())},[Xr]);const uo=reactExports.useCallback(ho=>{ho.key&&ho.key!==Xr||so(oo())},[Xr,oo]);return useEventListener("storage",uo),useEventListener("local-storage",uo),[ao,co,lo]}const useDarkMode=()=>{const[Xr,eo]=useLocalStorage$1("pushWalletThemeMode",!0);return{isDarkMode:Xr,enable:()=>{document.documentElement.setAttribute("theme","dark"),eo(!0)},disable:()=>{document.documentElement.setAttribute("theme","light"),eo(!1)}}};qe$4(Content2).withConfig({shouldForwardProp:Xr=>!tooltipCSSPropsKeys.includes(Xr)})` + /* Tooltip default styles */ + display: flex; + flex-direction: column; + gap: var(--s1); + padding: var(--s2); + border-radius: var(--r3); + font-family: var(--font-family); + word-wrap: break-word; + color: var(--text-primary-inverse); + background-color: var(--surface-primary-inverse); + + /* Tooltip non-responsive styles */ + width: ${({width:Xr})=>Xr}; + min-width: ${({minWidth:Xr})=>Xr}; + max-width: ${({maxWidth:Xr})=>Xr}; + height: ${({height:Xr})=>Xr}; + min-height: ${({minHeight:Xr})=>Xr}; + max-height: ${({maxHeight:Xr})=>Xr}; + + ${Xr=>Xr.css||""}; +`;qe$4.span` + color: var(--text-primary-inverse); + font-family: var(--font-family); + font-size: ${textVariants["c-semibold"].fontSize}; + font-style: ${textVariants["c-semibold"].fontStyle}; + font-weight: ${textVariants["c-semibold"].fontWeight}; + line-height: ${textVariants["c-semibold"].lineHeight}; +`;qe$4.span` + color: var(--text-primary-inverse); + font-family: var(--font-family); + font-size: ${textVariants["c-regular"].fontSize}; + font-style: ${textVariants["c-regular"].fontStyle}; + font-weight: ${textVariants["c-regular"].fontWeight}; + line-height: ${textVariants["c-regular"].lineHeight}; +`;const Container$2=qe$4.div` + align-items: flex-start; + display: flex; + flex-direction: column; + flex: 1 0 0; + gap: var(--spacing-xxs, 8px); + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`,StyledTextArea=qe$4.textarea` + ${({resizable:Xr,success:eo,error:to})=>{const ro=to?"danger":eo?"success":"default",no=to?"danger":eo?"success":"focus";return Ae$3` + align-self: stretch; + align-items: flex-start; + border-radius: var(--radius-xs, 12px); + border: 1.5px solid var(--components-inputs-stroke-${ro}); + background: var(--components-inputs-background-${ro}); + + color: var(--components-inputs-text-${ro}); + + display: flex; + + font-family: var(--font-family); + font-size: ${textVariants["bs-regular"].fontSize}; + font-style: ${textVariants["bs-regular"].fontStyle}; + font-weight: ${textVariants["bs-regular"].fontWeight}; + line-height: ${textVariants["bs-regular"].lineHeight}; + gap: var(--spacing-none, 0px); + + padding: var(--spacing-xs, 12px); + ::placeholder { + color: var(--components-inputs-text-placeholder); + } + + resize: ${Xr?"vertical":"none"}; + + &:hover { + outline: none; + } + + &:focus { + border: 1.5px solid var(--components-inputs-stroke-${no}); + outline: none; + } + + &:disabled { + border: 1.5px solid var(--components-inputs-stroke-default); + background: var(--components-inputs-background-disabled); + cursor: not-allowed; + color: var(--components-inputs-text-disabled); + } + `}} +`,LabelContainer$1=qe$4.div` + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; +`,LabelText=qe$4.span` + color: var(--${({color:Xr})=>Xr}); + font-family: var(--font-family); + font-size: ${textVariants["h6-semibold"].fontSize}; + font-style: ${textVariants["h6-semibold"].fontStyle}; + font-weight: ${textVariants["h6-semibold"].fontWeight}; + line-height: ${textVariants["h6-semibold"].lineHeight}; +`,LabelTextContainer$1=qe$4.div` + display: flex; + align-items: flex-start; + gap: var(--spacing-xxxs, 4px); +`,LabelCount=qe$4.span` + color: var(--${({color:Xr})=>Xr}); + font-family: var(--font-family); + font-size: ${textVariants["c-regular"].fontSize}; + font-style: ${textVariants["c-regular"].fontStyle}; + font-weight: ${textVariants["c-regular"].fontWeight}; + line-height: ${textVariants["c-regular"].lineHeight}; +`;reactExports.forwardRef(({css:Xr,description:eo,disabled:to,error:ro,errorMessage:no,label:io,numberOfLines:oo=4,onChange:ao,placeholder:so,required:co,resizable:lo,success:uo,totalCount:ho,value:go},bo)=>jsxRuntimeExports.jsxs(Container$2,{css:Xr,children:[io&&jsxRuntimeExports.jsxs(LabelContainer$1,{children:[jsxRuntimeExports.jsx(LabelText,{color:to?"components-inputs-text-disabled":"components-inputs-text-default",children:jsxRuntimeExports.jsxs(LabelTextContainer$1,{children:[io,co&&jsxRuntimeExports.jsx(Asterisk,{size:4.6})]})}),ho&&jsxRuntimeExports.jsx(LabelCount,{color:to?"components-inputs-text-disabled":"components-inputs-text-secondary",children:`${(go==null?void 0:go.length)||0} / ${ho}`})]}),jsxRuntimeExports.jsx(StyledTextArea,{disabled:to,error:ro,onChange:ao,placeholder:so,ref:bo,resizable:lo,rows:oo,success:uo,value:go}),eo&&jsxRuntimeExports.jsx(LabelCount,{color:uo||ro?"components-inputs-text-default":to?"components-inputs-text-disabled":"components-inputs-text-placeholder",children:eo}),no&&jsxRuntimeExports.jsx(LabelCount,{color:"components-inputs-text-danger",children:no})]}));const Container$1=qe$4.div` + align-items: flex-start; + display: flex; + flex-direction: column; + flex: 1 0 0; + gap: var(--spacing-${({label:Xr})=>Xr?"xxs":"none"}); + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`,StyledTextInput=qe$4.div` + ${({success:Xr,error:eo,disabled:to})=>{const ro=eo?"danger":Xr?"success":to?"disabled":"default",no=eo?"danger":Xr?"success":"focus";return Ae$3` + align-self: stretch; + justify-content: space-between; + align-items: flex-start; + border-radius: var(--radius-xs, 12px); + border: 1.5px solid var(--components-inputs-stroke-${ro}); + background: var(--components-inputs-background-${ro}); + + display: flex; + + gap: var(--spacing-xxs, 8px); + + padding: var(--spacing-xs, 12px); + [role='img'] { + width: 24px; + height: 24px; + + color: var(--components-inputs-icon-${ro}); + } + & input { + color: var(--components-inputs-text-${ro}); + + font-family: var(--font-family); + font-size: ${textVariants["bs-regular"].fontSize}; + font-style: ${textVariants["bs-regular"].fontStyle}; + font-weight: ${textVariants["bs-regular"].fontWeight}; + line-height: ${textVariants["bs-regular"].lineHeight}; + width: 100%; + ::placeholder { + color: var(--components-inputs-text-placeholder); + } + border: none; + background: transparent; + &:focus, + :disabled { + outline: none; + } + } + + &:hover { + border: 1.5px solid var(--components-inputs-stroke-hover); + } + + &:focus-within { + border: 1.5px solid var(--components-inputs-stroke-${no}); + outline: none; + } + + &:disabled { + border: 1.5px solid var(--components-inputs-stroke-default); + background: var(--components-inputs-background-disabled); + cursor: not-allowed; + color: var(--components-inputs-text-disabled); + } + `}} +`,LabelContainer=qe$4.div` + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; +`,InputText=qe$4.span` + color: var(--${({color:Xr})=>Xr}); + font-family: var(--font-family); + ${({variant:Xr})=>` + font-size: ${textVariants[Xr].fontSize}; + font-style: ${textVariants[Xr].fontStyle}; + font-weight: ${textVariants[Xr].fontWeight}; + line-height: ${textVariants[Xr].lineHeight}; + `} +`,LabelTextContainer=qe$4.div` + display: flex; + align-items: flex-start; + gap: var(--spacing-xxxs, 4px); +`,InputContainer=qe$4.div` + display: flex; + gap: var(--spacing-xxs); + width: 100%; +`;reactExports.forwardRef(({css:Xr,description:eo,disabled:to,error:ro,errorMessage:no,label:io,onChange:oo,onClear:ao,placeholder:so,required:co,type:lo="text",icon:uo,success:ho,totalCount:go,value:bo},wo)=>jsxRuntimeExports.jsxs(Container$1,{css:Xr,label:io,children:[io&&jsxRuntimeExports.jsxs(LabelContainer,{children:[jsxRuntimeExports.jsx(InputText,{color:to?"components-inputs-text-disabled":"components-inputs-text-default",variant:"h6-bold",children:jsxRuntimeExports.jsxs(LabelTextContainer,{children:[io,co&&jsxRuntimeExports.jsx(Asterisk,{size:4.6})]})}),go&&jsxRuntimeExports.jsx(InputText,{color:to?"components-inputs-text-disabled":"components-inputs-text-secondary",variant:"c-regular",children:`${typeof bo=="string"&&(bo==null?void 0:bo.length)||0} / ${go}`})]}),jsxRuntimeExports.jsxs(StyledTextInput,{disabled:to,error:ro,onChange:oo,ref:wo,success:ho,children:[jsxRuntimeExports.jsxs(InputContainer,{children:[uo,jsxRuntimeExports.jsx("input",{type:lo,disabled:!!to,...to?{"aria-disabled":!0}:{},placeholder:so,onChange:oo,value:bo})]}),ao&&jsxRuntimeExports.jsx(CrossFilled,{onClick:()=>ao==null?void 0:ao()})]}),eo&&jsxRuntimeExports.jsx(InputText,{color:ho||ro?"components-inputs-text-default":to?"components-inputs-text-disabled":"components-inputs-text-placeholder",variant:"c-regular",children:eo}),no&&jsxRuntimeExports.jsx(InputText,{color:"components-inputs-text-danger",variant:"c-regular",children:no})]}));function usePrevious$2(Xr){const eo=reactExports.useRef({value:Xr,previous:Xr});return reactExports.useMemo(()=>(eo.current.value!==Xr&&(eo.current.previous=eo.current.value,eo.current.value=Xr),eo.current.previous),[Xr])}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope$3(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=reactExports.forwardRef((Xr,eo)=>{const{__scopeSwitch:to,name:ro,checked:no,defaultChecked:io,required:oo,disabled:ao,value:so="on",onCheckedChange:co,form:lo,...uo}=Xr,[ho,go]=reactExports.useState(null),bo=useComposedRefs$1(eo,Ro=>go(Ro)),wo=reactExports.useRef(!1),Eo=ho?lo||!!ho.closest("form"):!0,[$o=!1,Co]=useControllableState({prop:no,defaultProp:io,onChange:co});return jsxRuntimeExports.jsxs(SwitchProvider,{scope:to,checked:$o,disabled:ao,children:[jsxRuntimeExports.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":$o,"aria-required":oo,"data-state":getState($o),"data-disabled":ao?"":void 0,disabled:ao,value:so,...uo,ref:bo,onClick:composeEventHandlers$1(Xr.onClick,Ro=>{Co(Oo=>!Oo),Eo&&(wo.current=Ro.isPropagationStopped(),wo.current||Ro.stopPropagation())})}),Eo&&jsxRuntimeExports.jsx(BubbleInput,{control:ho,bubbles:!wo.current,name:ro,value:so,checked:$o,required:oo,disabled:ao,form:lo,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=reactExports.forwardRef((Xr,eo)=>{const{__scopeSwitch:to,...ro}=Xr,no=useSwitchContext(THUMB_NAME,to);return jsxRuntimeExports.jsx(Primitive.span,{"data-state":getState(no.checked),"data-disabled":no.disabled?"":void 0,...ro,ref:eo})});SwitchThumb.displayName=THUMB_NAME;var BubbleInput=Xr=>{const{control:eo,checked:to,bubbles:ro=!0,...no}=Xr,io=reactExports.useRef(null),oo=usePrevious$2(to),ao=useSize(eo);return reactExports.useEffect(()=>{const so=io.current,co=window.HTMLInputElement.prototype,uo=Object.getOwnPropertyDescriptor(co,"checked").set;if(oo!==to&&uo){const ho=new Event("click",{bubbles:ro});uo.call(so,to),so.dispatchEvent(ho)}},[oo,to,ro]),jsxRuntimeExports.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:to,...no,tabIndex:-1,ref:io,style:{...Xr.style,...ao,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function getState(Xr){return Xr?"checked":"unchecked"}var Root=Switch$1,Thumb=SwitchThumb;qe$4(Root)` + width: 38px; + height: 20px; + padding: 3px; + background-color: var(--components-toggle-switch-background-unselected); + border-radius: var(--radius-md); + position: relative; + &[data-state='checked'] { + background-color: var(--components-toggle-switch-background-selected); + } + &:disabled { + cursor: not-allowed; + background: var(--components-toggle-switch-background-disabled); + span { + background: var(--components-toggle-switch-icon-disabled); + } + } +`;qe$4(Thumb)` + display: block; + cursor: pointer; + width: 14px; + height: 14px; + background-color: var(--components-toggle-switch-icon-default); + border-radius: var(--radius-round); + transition: transform 100ms; + will-change: transform; + &[data-state='checked'] { + transform: translateX(17.5px); + } +`;qe$4.div` + display: flex; + flex-direction: ${({flexDirection:Xr})=>Xr||""}; + gap: var(--spacing-xxs); + justifycontent: space-between; + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`;qe$4.div` + display: flex; + align-items: flex-start; + flex-direction: column; +`;qe$4.p` + margin: 0; + color: ${({color:Xr})=>Xr}; + ${({variant:Xr})=>`font-family: var(--font-family); + font-size: ${textVariants[Xr].fontSize}; + font-style: ${textVariants[Xr].fontStyle}; + font-weight: ${textVariants[Xr].fontWeight}; + line-height: ${textVariants[Xr].lineHeight};`} +`;const Container=qe$4.div` + align-items: center; + display: flex; + flex-direction: column; + flex: 1 0 0; + gap: var(--spacing-xxs, 8px); + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""}; +`;reactExports.forwardRef(({disabled:Xr,children:eo,onChange:to,onDrop:ro,id:no},io)=>{const oo=ao=>{ao.preventDefault()};return jsxRuntimeExports.jsxs(Container,{ref:io,onDrop:ro,onDragOver:oo,children:[eo,jsxRuntimeExports.jsx("input",{id:no,type:"file",accept:"image/*",hidden:!0,disabled:!!Xr,...Xr?{"aria-disabled":!0}:{},onChange:to})]})});function _setPrototypeOf(Xr,eo){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(to,ro){return to.__proto__=ro,to},_setPrototypeOf(Xr,eo)}function _inheritsLoose(Xr,eo){Xr.prototype=Object.create(eo.prototype),Xr.prototype.constructor=Xr,_setPrototypeOf(Xr,eo)}function s$5(Xr){return Xr&&Xr.stopPropagation&&Xr.stopPropagation(),Xr&&Xr.preventDefault&&Xr.preventDefault(),!1}function n$5(Xr){return Xr==null?[]:Array.isArray(Xr)?Xr.slice():[Xr]}function i$9(Xr){return Xr!==null&&Xr.length===1?Xr[0]:Xr.slice()}function o$5(Xr){Object.keys(Xr).forEach(eo=>{typeof document<"u"&&document.addEventListener(eo,Xr[eo],!1)})}function r$6(Xr,eo){return a$6(function(to,ro){let no=to;return no<=ro.min&&(no=ro.min),no>=ro.max&&(no=ro.max),no}(Xr,eo),eo)}function a$6(Xr,eo){const to=(Xr-eo.min)%eo.step;let ro=Xr-to;return 2*Math.abs(to)>=eo.step&&(ro+=to>0?eo.step:-eo.step),parseFloat(ro.toFixed(5))}let p$8=function(Xr){function eo(ro){var no;(no=Xr.call(this,ro)||this).onKeyUp=()=>{no.onEnd()},no.onMouseUp=()=>{no.onEnd(no.getMouseEventMap())},no.onTouchEnd=ao=>{ao.preventDefault(),no.onEnd(no.getTouchEventMap())},no.onBlur=()=>{no.setState({index:-1},no.onEnd(no.getKeyDownEventMap()))},no.onMouseMove=ao=>{no.setState({pending:!0});const so=no.getMousePosition(ao),co=no.getDiffPosition(so[0]),lo=no.getValueFromPosition(co);no.move(lo)},no.onTouchMove=ao=>{if(ao.touches.length>1)return;no.setState({pending:!0});const so=no.getTouchPosition(ao);if(no.isScrolling===void 0){const uo=so[0]-no.startPosition[0],ho=so[1]-no.startPosition[1];no.isScrolling=Math.abs(ho)>Math.abs(uo)}if(no.isScrolling)return void no.setState({index:-1});const co=no.getDiffPosition(so[0]),lo=no.getValueFromPosition(co);no.move(lo)},no.onKeyDown=ao=>{if(!(ao.ctrlKey||ao.shiftKey||ao.altKey||ao.metaKey))switch(no.setState({pending:!0}),ao.key){case"ArrowLeft":case"ArrowDown":case"Left":case"Down":ao.preventDefault(),no.moveDownByStep();break;case"ArrowRight":case"ArrowUp":case"Right":case"Up":ao.preventDefault(),no.moveUpByStep();break;case"Home":ao.preventDefault(),no.move(no.props.min);break;case"End":ao.preventDefault(),no.move(no.props.max);break;case"PageDown":ao.preventDefault(),no.moveDownByStep(no.props.pageFn(no.props.step));break;case"PageUp":ao.preventDefault(),no.moveUpByStep(no.props.pageFn(no.props.step))}},no.onSliderMouseDown=ao=>{if(!no.props.disabled&&ao.button!==2){if(no.setState({pending:!0}),!no.props.snapDragDisabled){const so=no.getMousePosition(ao);no.forceValueFromPosition(so[0],co=>{no.start(co,so[0]),o$5(no.getMouseEventMap())})}s$5(ao)}},no.onSliderClick=ao=>{if(!no.props.disabled&&no.props.onSliderClick&&!no.hasMoved){const so=no.getMousePosition(ao),co=r$6(no.calcValue(no.calcOffsetFromPosition(so[0])),no.props);no.props.onSliderClick(co)}},no.createOnKeyDown=ao=>so=>{no.props.disabled||(no.start(ao),o$5(no.getKeyDownEventMap()),s$5(so))},no.createOnMouseDown=ao=>so=>{if(no.props.disabled||so.button===2)return;no.setState({pending:!0});const co=no.getMousePosition(so);no.start(ao,co[0]),o$5(no.getMouseEventMap()),s$5(so)},no.createOnTouchStart=ao=>so=>{if(no.props.disabled||so.touches.length>1)return;no.setState({pending:!0});const co=no.getTouchPosition(so);no.startPosition=co,no.isScrolling=void 0,no.start(ao,co[0]),o$5(no.getTouchEventMap()),function(lo){lo.stopPropagation&&lo.stopPropagation()}(so)},no.handleResize=()=>{const ao=window.setTimeout(()=>{no.pendingResizeTimeouts.shift(),no.resize()},0);no.pendingResizeTimeouts.push(ao)},no.renderThumb=(ao,so)=>{const co=no.props.thumbClassName+" "+no.props.thumbClassName+"-"+so+" "+(no.state.index===so?no.props.thumbActiveClassName:""),lo={ref:ho=>{no["thumb"+so]=ho},key:no.props.thumbClassName+"-"+so,className:co,style:ao,onMouseDown:no.createOnMouseDown(so),onTouchStart:no.createOnTouchStart(so),onFocus:no.createOnKeyDown(so),tabIndex:0,role:"slider","aria-orientation":no.props.orientation,"aria-valuenow":no.state.value[so],"aria-valuemin":no.props.min,"aria-valuemax":no.props.max,"aria-label":Array.isArray(no.props.ariaLabel)?no.props.ariaLabel[so]:no.props.ariaLabel,"aria-labelledby":Array.isArray(no.props.ariaLabelledby)?no.props.ariaLabelledby[so]:no.props.ariaLabelledby,"aria-disabled":no.props.disabled},uo={index:so,value:i$9(no.state.value),valueNow:no.state.value[so]};return no.props.ariaValuetext&&(lo["aria-valuetext"]=typeof no.props.ariaValuetext=="string"?no.props.ariaValuetext:no.props.ariaValuetext(uo)),no.props.renderThumb(lo,uo)},no.renderTrack=(ao,so,co)=>{const lo={key:no.props.trackClassName+"-"+ao,className:no.props.trackClassName+" "+no.props.trackClassName+"-"+ao,style:no.buildTrackStyle(so,no.state.upperBound-co)},uo={index:ao,value:i$9(no.state.value)};return no.props.renderTrack(lo,uo)};let io=n$5(ro.value);io.length||(io=n$5(ro.defaultValue)),no.pendingResizeTimeouts=[];const oo=[];for(let ao=0;aor$6(oo,ro))}:null},to.componentDidUpdate=function(){this.state.upperBound===0&&this.resize()},to.componentWillUnmount=function(){this.clearPendingResizeTimeouts(),this.resizeObserver&&this.resizeObserver.disconnect()},to.onEnd=function(ro){ro&&function(no){Object.keys(no).forEach(io=>{typeof document<"u"&&document.removeEventListener(io,no[io],!1)})}(ro),this.hasMoved&&this.fireChangeEvent("onAfterChange"),this.setState({pending:!1}),this.hasMoved=!1},to.getValue=function(){return i$9(this.state.value)},to.getClosestIndex=function(ro){let no=Number.MAX_VALUE,io=-1;const{value:oo}=this.state,ao=oo.length;for(let so=0;so{no(oo),this.fireChangeEvent("onChange")})},to.clearPendingResizeTimeouts=function(){do{const ro=this.pendingResizeTimeouts.shift();clearTimeout(ro)}while(this.pendingResizeTimeouts.length)},to.start=function(ro,no){const io=this["thumb"+ro];io&&io.focus();const{zIndices:oo}=this.state;oo.splice(oo.indexOf(ro),1),oo.push(ro),this.setState(ao=>({startValue:ao.value[ro],startPosition:no!==void 0?no:ao.startPosition,index:ro,zIndices:oo}))},to.moveUpByStep=function(ro){ro===void 0&&(ro=this.props.step);const no=this.state.value[this.state.index],io=r$6(this.props.invert&&this.props.orientation==="horizontal"?no-ro:no+ro,this.props);this.move(Math.min(io,this.props.max))},to.moveDownByStep=function(ro){ro===void 0&&(ro=this.props.step);const no=this.state.value[this.state.index],io=r$6(this.props.invert&&this.props.orientation==="horizontal"?no+ro:no-ro,this.props);this.move(Math.max(io,this.props.min))},to.move=function(ro){const no=this.state.value.slice(),{index:io}=this.state,{length:oo}=no,ao=no[io];if(ro===ao)return;this.hasMoved||this.fireChangeEvent("onBeforeChange"),this.hasMoved=!0;const{pearling:so,max:co,min:lo,minDistance:uo}=this.props;if(!so){if(io>0){const ho=no[io-1];roho-uo&&(ro=ho-uo)}}no[io]=ro,so&&oo>1&&(ro>ao?(this.pushSucceeding(no,uo,io),function(ho,go,bo,wo){for(let Eo=0;Eo$o&&(go[ho-1-Eo]=$o)}}(oo,no,uo,co)):roro[oo+1];oo+=1,ao=ro[oo]+no)ro[oo+1]=a$6(ao,this.props)},to.pushPreceding=function(ro,no,io){for(let oo=io,ao=ro[oo]-no;ro[oo-1]!==null&&ao=0?this.posMinKey():void 0,zIndex:this.state.zIndices.indexOf(no)+1};return io[this.posMinKey()]=ro+"px",io},to.buildTrackStyle=function(ro,no){const io={position:"absolute",willChange:this.state.index>=0?this.posMinKey()+","+this.posMaxKey():void 0};return io[this.posMinKey()]=ro,io[this.posMaxKey()]=no,io},to.buildMarkStyle=function(ro){var no;return(no={position:"absolute"})[this.posMinKey()]=ro,no},to.renderThumbs=function(ro){const{length:no}=ro,io=[];for(let ao=0;aooo):typeof ro=="number"&&(ro=Array.from({length:no}).map((io,oo)=>oo).filter(io=>io%ro==0)),ro.map(parseFloat).sort((io,oo)=>io-oo).map(io=>{const oo=this.calcOffset(io),ao={key:io,className:this.props.markClassName,style:this.buildMarkStyle(oo)};return this.props.renderMark(ao)})},to.render=function(){const ro=[],{value:no}=this.state,io=no.length;for(let co=0;co{this.slider=co,this.resizeElementRef.current=co},style:{position:"relative"},className:this.props.className+(this.props.disabled?" disabled":""),onMouseDown:this.onSliderMouseDown,onClick:this.onSliderClick},oo,ao,so)},eo}(React.Component);p$8.displayName="ReactSlider",p$8.defaultProps={min:0,max:100,step:1,pageFn:Xr=>10*Xr,minDistance:0,defaultValue:0,orientation:"horizontal",className:"slider",thumbClassName:"thumb",thumbActiveClassName:"active",trackClassName:"track",markClassName:"mark",withTracks:!0,pearling:!1,disabled:!1,snapDragDisabled:!1,invert:!1,marks:[],renderThumb:Xr=>React.createElement("div",Xr),renderTrack:Xr=>React.createElement("div",Xr),renderMark:Xr=>React.createElement("span",Xr)};var u$6=p$8,lodash={exports:{}};/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */lodash.exports;(function(Xr,eo){(function(){var to,ro="4.17.21",no=200,io="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",oo="Expected a function",ao="Invalid `variable` option passed into `_.template`",so="__lodash_hash_undefined__",co=500,lo="__lodash_placeholder__",uo=1,ho=2,go=4,bo=1,wo=2,Eo=1,$o=2,Co=4,Ro=8,Oo=16,jo=32,Bo=64,Mo=128,Fo=256,Wo=512,Jo=30,Po="...",fo=800,yo=16,vo=1,_o=2,So=3,To=1/0,Ao=9007199254740991,ko=17976931348623157e292,mo=NaN,Io=4294967295,Do=Io-1,Lo=Io>>>1,Ho=[["ary",Mo],["bind",Eo],["bindKey",$o],["curry",Ro],["curryRight",Oo],["flip",Wo],["partial",jo],["partialRight",Bo],["rearg",Fo]],Yo="[object Arguments]",Xo="[object Array]",qo="[object AsyncFunction]",Ko="[object Boolean]",Qo="[object Date]",zo="[object DOMException]",ga="[object Error]",$a="[object Function]",Sl="[object GeneratorFunction]",El="[object Map]",Tl="[object Number]",Il="[object Null]",Zl="[object Object]",Vl="[object Promise]",Ol="[object Proxy]",Dl="[object RegExp]",Fl="[object Set]",Jl="[object String]",cu="[object Symbol]",Ll="[object Undefined]",Xl="[object WeakMap]",ku="[object WeakSet]",iu="[object ArrayBuffer]",hu="[object DataView]",Cu="[object Float32Array]",_l="[object Float64Array]",Go="[object Int8Array]",yl="[object Int16Array]",Al="[object Int32Array]",Ul="[object Uint8Array]",su="[object Uint8ClampedArray]",Ql="[object Uint16Array]",vu="[object Uint32Array]",qu=/\b__p \+= '';/g,pu=/\b(__p \+=) '' \+/g,xu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Au=/&(?:amp|lt|gt|quot|#39);/g,yu=/[&<>"']/g,wu=RegExp(Au.source),Gu=RegExp(yu.source),Ml=/<%-([\s\S]+?)%>/g,Nl=/<%([\s\S]+?)%>/g,Yl=/<%=([\s\S]+?)%>/g,Wl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eu=/^\w*$/,Su=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ru=/[\\^$.*+?()[\]{}|]/g,uu=RegExp(ru.source),xl=/^\s+/,$l=/\s/,Cl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Zo=/\{\n\/\* \[wrapped with (.+)\] \*/,Rl=/,? & /,Hl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,au=/[()=,{}\[\]\/\s]/,tu=/\\(\\)?/g,lu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nu=/\w*$/,Pu=/^[-+]0x[0-9a-f]+$/i,ip=/^0b[01]+$/i,Lu=/^\[object .+?Constructor\]$/,Yu=/^0o[0-7]+$/i,_d=/^(?:0|[1-9]\d*)$/,Qu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_f=/($^)/,ep=/['\n\r\u2028\u2029\\]/g,Xu="\\ud800-\\udfff",_h="\\u0300-\\u036f",zu="\\ufe20-\\ufe2f",Vu="\\u20d0-\\u20ff",Fu=_h+zu+Vu,Tu="\\u2700-\\u27bf",Ru="a-z\\xdf-\\xf6\\xf8-\\xff",Ou="\\xac\\xb1\\xd7\\xf7",_u="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",$u="\\u2000-\\u206f",Uu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ju="A-Z\\xc0-\\xd6\\xd8-\\xde",Bu="\\ufe0e\\ufe0f",Hu=Ou+_u+$u+Uu,fp="['’]",wp="["+Xu+"]",xp="["+Hu+"]",gp="["+Fu+"]",fu="\\d+",Cp="["+Tu+"]",Rp="["+Ru+"]",Np="[^"+Xu+Hu+fu+Tu+Ru+ju+"]",_p="\\ud83c[\\udffb-\\udfff]",Tp="(?:"+gp+"|"+_p+")",Ap="[^"+Xu+"]",Kp="(?:\\ud83c[\\udde6-\\uddff]){2}",Sp="[\\ud800-\\udbff][\\udc00-\\udfff]",Ep="["+ju+"]",qp="\\u200d",Gp="(?:"+Rp+"|"+Np+")",Hp="(?:"+Ep+"|"+Np+")",Dp="(?:"+fp+"(?:d|ll|m|re|s|t|ve))?",lm="(?:"+fp+"(?:D|LL|M|RE|S|T|VE))?",rm=Tp+"?",V0="["+Bu+"]?",Uy="(?:"+qp+"(?:"+[Ap,Kp,Sp].join("|")+")"+V0+rm+")*",t0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",K0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",G0=V0+rm+Uy,Z0="(?:"+[Cp,Kp,Sp].join("|")+")"+G0,X0="(?:"+[Ap+gp+"?",gp,Kp,Sp,wp].join("|")+")",Wy=RegExp(fp,"g"),f0=RegExp(gp,"g"),C0=RegExp(_p+"(?="+_p+")|"+X0+G0,"g"),Q0=RegExp([Ep+"?"+Rp+"+"+Dp+"(?="+[xp,Ep,"$"].join("|")+")",Hp+"+"+lm+"(?="+[xp,Ep+Gp,"$"].join("|")+")",Ep+"?"+Gp+"+"+Dp,Ep+"+"+lm,K0,t0,fu,Z0].join("|"),"g"),ey=RegExp("["+qp+Xu+Fu+Bu+"]"),T0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ty=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zy=-1,vp={};vp[Cu]=vp[_l]=vp[Go]=vp[yl]=vp[Al]=vp[Ul]=vp[su]=vp[Ql]=vp[vu]=!0,vp[Yo]=vp[Xo]=vp[iu]=vp[Ko]=vp[hu]=vp[Qo]=vp[ga]=vp[$a]=vp[El]=vp[Tl]=vp[Zl]=vp[Dl]=vp[Fl]=vp[Jl]=vp[Xl]=!1;var yp={};yp[Yo]=yp[Xo]=yp[iu]=yp[hu]=yp[Ko]=yp[Qo]=yp[Cu]=yp[_l]=yp[Go]=yp[yl]=yp[Al]=yp[El]=yp[Tl]=yp[Zl]=yp[Dl]=yp[Fl]=yp[Jl]=yp[cu]=yp[Ul]=yp[su]=yp[Ql]=yp[vu]=!0,yp[ga]=yp[$a]=yp[Xl]=!1;var ou={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Eu={"&":"&","<":"<",">":">",'"':""","'":"'"},Wu={"&":"&","<":"<",">":">",""":'"',"'":"'"},up={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Op=parseFloat,Ip=parseInt,cm=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Am=typeof self=="object"&&self&&self.Object===Object&&self,$p=cm||Am||Function("return this")(),Xp=eo&&!eo.nodeType&&eo,nm=Xp&&!0&&Xr&&!Xr.nodeType&&Xr,Hm=nm&&nm.exports===Xp,Sm=Hm&&cm.process,Wp=function(){try{var zl=nm&&nm.require&&nm.require("util").types;return zl||Sm&&Sm.binding&&Sm.binding("util")}catch{}}(),qm=Wp&&Wp.isArrayBuffer,d0=Wp&&Wp.isDate,r0=Wp&&Wp.isMap,h0=Wp&&Wp.isRegExp,qy=Wp&&Wp.isSet,J0=Wp&&Wp.isTypedArray;function Yp(zl,du,nu){switch(nu.length){case 0:return zl.call(du);case 1:return zl.call(du,nu[0]);case 2:return zl.call(du,nu[0],nu[1]);case 3:return zl.call(du,nu[0],nu[1],nu[2])}return zl.apply(du,nu)}function y_(zl,du,nu,Mu){for(var tp=-1,hp=zl==null?0:zl.length;++tp-1}function Vy(zl,du,nu){for(var Mu=-1,tp=zl==null?0:zl.length;++Mu-1;);return nu}function xv(zl,du){for(var nu=zl.length;nu--&&p0(du,zl[nu],0)>-1;);return nu}function k_(zl,du){for(var nu=zl.length,Mu=0;nu--;)zl[nu]===du&&++Mu;return Mu}var C_=Jy(ou),T_=Jy(Eu);function I_(zl){return"\\"+up[zl]}function R_(zl,du){return zl==null?to:zl[du]}function m0(zl){return ey.test(zl)}function A_(zl){return T0.test(zl)}function P_(zl){for(var du,nu=[];!(du=zl.next()).done;)nu.push(du.value);return nu}function e1(zl){var du=-1,nu=Array(zl.size);return zl.forEach(function(Mu,tp){nu[++du]=[tp,Mu]}),nu}function Ev(zl,du){return function(nu){return zl(du(nu))}}function Gm(zl,du){for(var nu=-1,Mu=zl.length,tp=0,hp=[];++nu-1}function bx(po,xo){var No=this.__data__,Uo=by(No,po);return Uo<0?(++this.size,No.push([po,xo])):No[Uo][1]=xo,this}Mm.prototype.clear=mx,Mm.prototype.delete=gx,Mm.prototype.get=yx,Mm.prototype.has=vx,Mm.prototype.set=bx;function jm(po){var xo=-1,No=po==null?0:po.length;for(this.clear();++xo=xo?po:xo)),po}function wm(po,xo,No,Uo,Vo,wl){var Pl,Bl=xo&uo,Gl=xo&ho,mu=xo&go;if(No&&(Pl=Vo?No(po,Uo,Vo,wl):No(po)),Pl!==to)return Pl;if(!Pp(po))return po;var gu=rp(po);if(gu){if(Pl=$E(po),!Bl)return im(po,Pl)}else{var bu=Jp(po),Iu=bu==$a||bu==Sl;if(e0(po))return iw(po,Bl);if(bu==Zl||bu==Yo||Iu&&!Vo){if(Pl=Gl||Iu?{}:Ew(po),!Bl)return Gl?hE(po,jx(Pl,po)):fE(po,Mv(Pl,po))}else{if(!yp[bu])return Vo?po:{};Pl=SE(po,bu,Bl)}}wl||(wl=new Tm);var Du=wl.get(po);if(Du)return Du;wl.set(po,Pl),Xw(po)?po.forEach(function(Ju){Pl.add(wm(Ju,xo,No,Ju,po,wl))}):Jw(po)&&po.forEach(function(Ju,cp){Pl.set(cp,wm(Ju,xo,No,cp,po,wl))});var Zu=mu?Gl?T1:C1:Gl?am:zp,op=gu?to:Zu(po);return gm(op||po,function(Ju,cp){op&&(cp=Ju,Ju=po[cp]),M0(Pl,cp,wm(Ju,xo,No,cp,po,wl))}),Pl}function Bx(po){var xo=zp(po);return function(No){return jv(No,po,xo)}}function jv(po,xo,No){var Uo=No.length;if(po==null)return!Uo;for(po=bp(po);Uo--;){var Vo=No[Uo],wl=xo[Vo],Pl=po[Vo];if(Pl===to&&!(Vo in po)||!wl(Pl))return!1}return!0}function Bv(po,xo,No){if(typeof po!="function")throw new ym(oo);return W0(function(){po.apply(to,No)},xo)}function j0(po,xo,No,Uo){var Vo=-1,wl=ry,Pl=!0,Bl=po.length,Gl=[],mu=xo.length;if(!Bl)return Gl;No&&(xo=kp(xo,um(No))),Uo?(wl=Vy,Pl=!1):xo.length>=no&&(wl=I0,Pl=!1,xo=new o0(xo));e:for(;++VoVo?0:Vo+No),Uo=Uo===to||Uo>Vo?Vo:np(Uo),Uo<0&&(Uo+=Vo),Uo=No>Uo?0:e_(Uo);No0&&No(Bl)?xo>1?Vp(Bl,xo-1,No,Uo,Vo):Km(Vo,Bl):Uo||(Vo[Vo.length]=Bl)}return Vo}var s1=uw(),Fv=uw(!0);function Pm(po,xo){return po&&s1(po,xo,zp)}function c1(po,xo){return po&&Fv(po,xo,zp)}function _y(po,xo){return Vm(xo,function(No){return Um(po[No])})}function s0(po,xo){xo=Xm(xo,po);for(var No=0,Uo=xo.length;po!=null&&Noxo}function Fx(po,xo){return po!=null&&mp.call(po,xo)}function Ux(po,xo){return po!=null&&xo in bp(po)}function Wx(po,xo,No){return po>=Zp(xo,No)&&po=120&&gu.length>=120)?new o0(Pl&&gu):to}gu=po[0];var bu=-1,Iu=Bl[0];e:for(;++bu-1;)Bl!==po&&fy.call(Bl,Gl,1),fy.call(po,Gl,1);return po}function Yv(po,xo){for(var No=po?xo.length:0,Uo=No-1;No--;){var Vo=xo[No];if(No==Uo||Vo!==wl){var wl=Vo;Fm(Vo)?fy.call(po,Vo,1):b1(po,Vo)}}return po}function m1(po,xo){return po+my(Av()*(xo-po+1))}function tE(po,xo,No,Uo){for(var Vo=-1,wl=Up(py((xo-po)/(No||1)),0),Pl=nu(wl);wl--;)Pl[Uo?wl:++Vo]=po,po+=No;return Pl}function g1(po,xo){var No="";if(!po||xo<1||xo>Ao)return No;do xo%2&&(No+=po),xo=my(xo/2),xo&&(po+=po);while(xo);return No}function ap(po,xo){return M1(kw(po,xo,sm),po+"")}function rE(po){return Ov(k0(po))}function nE(po,xo){var No=k0(po);return Py(No,a0(xo,0,No.length))}function L0(po,xo,No,Uo){if(!Pp(po))return po;xo=Xm(xo,po);for(var Vo=-1,wl=xo.length,Pl=wl-1,Bl=po;Bl!=null&&++VoVo?0:Vo+xo),No=No>Vo?Vo:No,No<0&&(No+=Vo),Vo=xo>No?0:No-xo>>>0,xo>>>=0;for(var wl=nu(Vo);++Uo>>1,Pl=po[wl];Pl!==null&&!fm(Pl)&&(No?Pl<=xo:Pl=no){var mu=xo?null:yE(po);if(mu)return iy(mu);Pl=!1,Vo=I0,Gl=new o0}else Gl=xo?[]:Bl;e:for(;++Uo=Uo?po:_m(po,xo,No)}var nw=K_||function(po){return $p.clearTimeout(po)};function iw(po,xo){if(xo)return po.slice();var No=po.length,Uo=kv?kv(No):new po.constructor(No);return po.copy(Uo),Uo}function $1(po){var xo=new po.constructor(po.byteLength);return new uy(xo).set(new uy(po)),xo}function cE(po,xo){var No=xo?$1(po.buffer):po.buffer;return new po.constructor(No,po.byteOffset,po.byteLength)}function lE(po){var xo=new po.constructor(po.source,Nu.exec(po));return xo.lastIndex=po.lastIndex,xo}function uE(po){return O0?bp(O0.call(po)):{}}function ow(po,xo){var No=xo?$1(po.buffer):po.buffer;return new po.constructor(No,po.byteOffset,po.length)}function aw(po,xo){if(po!==xo){var No=po!==to,Uo=po===null,Vo=po===po,wl=fm(po),Pl=xo!==to,Bl=xo===null,Gl=xo===xo,mu=fm(xo);if(!Bl&&!mu&&!wl&&po>xo||wl&&Pl&&Gl&&!Bl&&!mu||Uo&&Pl&&Gl||!No&&Gl||!Vo)return 1;if(!Uo&&!wl&&!mu&&po=Bl)return Gl;var mu=No[Uo];return Gl*(mu=="desc"?-1:1)}}return po.index-xo.index}function sw(po,xo,No,Uo){for(var Vo=-1,wl=po.length,Pl=No.length,Bl=-1,Gl=xo.length,mu=Up(wl-Pl,0),gu=nu(Gl+mu),bu=!Uo;++Bl1?No[Vo-1]:to,Pl=Vo>2?No[2]:to;for(wl=po.length>3&&typeof wl=="function"?(Vo--,wl):to,Pl&&em(No[0],No[1],Pl)&&(wl=Vo<3?to:wl,Vo=1),xo=bp(xo);++Uo-1?Vo[wl?xo[Pl]:Pl]:to}}function hw(po){return Lm(function(xo){var No=xo.length,Uo=No,Vo=bm.prototype.thru;for(po&&xo.reverse();Uo--;){var wl=xo[Uo];if(typeof wl!="function")throw new ym(oo);if(Vo&&!Pl&&Ry(wl)=="wrapper")var Pl=new bm([],!0)}for(Uo=Pl?Uo:No;++Uo1&&dp.reverse(),gu&&GlBl))return!1;var mu=wl.get(po),gu=wl.get(xo);if(mu&&gu)return mu==xo&&gu==po;var bu=-1,Iu=!0,Du=No&wo?new o0:to;for(wl.set(po,xo),wl.set(xo,po);++bu1?"& ":"")+xo[Uo],xo=xo.join(No>2?", ":" "),po.replace(Cl,`{ +/* [wrapped with `+xo+`] */ +`)}function CE(po){return rp(po)||u0(po)||!!(Iv&&po&&po[Iv])}function Fm(po,xo){var No=typeof po;return xo=xo??Ao,!!xo&&(No=="number"||No!="symbol"&&_d.test(po))&&po>-1&&po%1==0&&po0){if(++xo>=fo)return arguments[0]}else xo=0;return po.apply(to,arguments)}}function Py(po,xo){var No=-1,Uo=po.length,Vo=Uo-1;for(xo=xo===to?Uo:xo;++No1?po[xo-1]:to;return No=typeof No=="function"?(po.pop(),No):to,Dw(po,No)});function Lw(po){var xo=_c(po);return xo.__chain__=!0,xo}function D2(po,xo){return xo(po),po}function Ny(po,xo){return xo(po)}var L2=Lm(function(po){var xo=po.length,No=xo?po[0]:0,Uo=this.__wrapped__,Vo=function(wl){return a1(wl,po)};return xo>1||this.__actions__.length||!(Uo instanceof lp)||!Fm(No)?this.thru(Vo):(Uo=Uo.slice(No,+No+(xo?1:0)),Uo.__actions__.push({func:Ny,args:[Vo],thisArg:to}),new bm(Uo,this.__chain__).thru(function(wl){return xo&&!wl.length&&wl.push(to),wl}))});function F2(){return Lw(this)}function U2(){return new bm(this.value(),this.__chain__)}function W2(){this.__values__===to&&(this.__values__=Qw(this.value()));var po=this.__index__>=this.__values__.length,xo=po?to:this.__values__[this.__index__++];return{done:po,value:xo}}function z2(){return this}function q2(po){for(var xo,No=this;No instanceof vy;){var Uo=Pw(No);Uo.__index__=0,Uo.__values__=to,xo?Vo.__wrapped__=Uo:xo=Uo;var Vo=Uo;No=No.__wrapped__}return Vo.__wrapped__=po,xo}function H2(){var po=this.__wrapped__;if(po instanceof lp){var xo=po;return this.__actions__.length&&(xo=new lp(this)),xo=xo.reverse(),xo.__actions__.push({func:Ny,args:[j1],thisArg:to}),new bm(xo,this.__chain__)}return this.thru(j1)}function V2(){return tw(this.__wrapped__,this.__actions__)}var K2=Sy(function(po,xo,No){mp.call(po,No)?++po[No]:Bm(po,No,1)});function G2(po,xo,No){var Uo=rp(po)?mv:Dx;return No&&em(po,xo,No)&&(xo=to),Uo(po,Ku(xo,3))}function Z2(po,xo){var No=rp(po)?Vm:Lv;return No(po,Ku(xo,3))}var J2=fw(Nw),Y2=fw(Ow);function X2(po,xo){return Vp(Oy(po,xo),1)}function Q2(po,xo){return Vp(Oy(po,xo),To)}function e$(po,xo,No){return No=No===to?1:np(No),Vp(Oy(po,xo),No)}function Fw(po,xo){var No=rp(po)?gm:Jm;return No(po,Ku(xo,3))}function Uw(po,xo){var No=rp(po)?v_:Dv;return No(po,Ku(xo,3))}var t$=Sy(function(po,xo,No){mp.call(po,No)?po[No].push(xo):Bm(po,No,[xo])});function r$(po,xo,No,Uo){po=om(po)?po:k0(po),No=No&&!Uo?np(No):0;var Vo=po.length;return No<0&&(No=Up(Vo+No,0)),Ly(po)?No<=Vo&&po.indexOf(xo,No)>-1:!!Vo&&p0(po,xo,No)>-1}var n$=ap(function(po,xo,No){var Uo=-1,Vo=typeof xo=="function",wl=om(po)?nu(po.length):[];return Jm(po,function(Pl){wl[++Uo]=Vo?Yp(xo,Pl,No):B0(Pl,xo,No)}),wl}),i$=Sy(function(po,xo,No){Bm(po,No,xo)});function Oy(po,xo){var No=rp(po)?kp:Hv;return No(po,Ku(xo,3))}function o$(po,xo,No,Uo){return po==null?[]:(rp(xo)||(xo=xo==null?[]:[xo]),No=Uo?to:No,rp(No)||(No=No==null?[]:[No]),Zv(po,xo,No))}var a$=Sy(function(po,xo,No){po[No?0:1].push(xo)},function(){return[[],[]]});function s$(po,xo,No){var Uo=rp(po)?Ky:bv,Vo=arguments.length<3;return Uo(po,Ku(xo,4),No,Vo,Jm)}function c$(po,xo,No){var Uo=rp(po)?b_:bv,Vo=arguments.length<3;return Uo(po,Ku(xo,4),No,Vo,Dv)}function l$(po,xo){var No=rp(po)?Vm:Lv;return No(po,By(Ku(xo,3)))}function u$(po){var xo=rp(po)?Ov:rE;return xo(po)}function d$(po,xo,No){(No?em(po,xo,No):xo===to)?xo=1:xo=np(xo);var Uo=rp(po)?Nx:nE;return Uo(po,xo)}function f$(po){var xo=rp(po)?Ox:oE;return xo(po)}function h$(po){if(po==null)return 0;if(om(po))return Ly(po)?g0(po):po.length;var xo=Jp(po);return xo==El||xo==Fl?po.size:f1(po).length}function p$(po,xo,No){var Uo=rp(po)?Gy:aE;return No&&em(po,xo,No)&&(xo=to),Uo(po,Ku(xo,3))}var m$=ap(function(po,xo){if(po==null)return[];var No=xo.length;return No>1&&em(po,xo[0],xo[1])?xo=[]:No>2&&em(xo[0],xo[1],xo[2])&&(xo=[xo[0]]),Zv(po,Vp(xo,1),[])}),My=G_||function(){return $p.Date.now()};function g$(po,xo){if(typeof xo!="function")throw new ym(oo);return po=np(po),function(){if(--po<1)return xo.apply(this,arguments)}}function Ww(po,xo,No){return xo=No?to:xo,xo=po&&xo==null?po.length:xo,Dm(po,Mo,to,to,to,to,xo)}function zw(po,xo){var No;if(typeof xo!="function")throw new ym(oo);return po=np(po),function(){return--po>0&&(No=xo.apply(this,arguments)),po<=1&&(xo=to),No}}var D1=ap(function(po,xo,No){var Uo=Eo;if(No.length){var Vo=Gm(No,$0(D1));Uo|=jo}return Dm(po,Uo,xo,No,Vo)}),qw=ap(function(po,xo,No){var Uo=Eo|$o;if(No.length){var Vo=Gm(No,$0(qw));Uo|=jo}return Dm(xo,Uo,po,No,Vo)});function Hw(po,xo,No){xo=No?to:xo;var Uo=Dm(po,Ro,to,to,to,to,to,xo);return Uo.placeholder=Hw.placeholder,Uo}function Vw(po,xo,No){xo=No?to:xo;var Uo=Dm(po,Oo,to,to,to,to,to,xo);return Uo.placeholder=Vw.placeholder,Uo}function Kw(po,xo,No){var Uo,Vo,wl,Pl,Bl,Gl,mu=0,gu=!1,bu=!1,Iu=!0;if(typeof po!="function")throw new ym(oo);xo=Em(xo)||0,Pp(No)&&(gu=!!No.leading,bu="maxWait"in No,wl=bu?Up(Em(No.maxWait)||0,xo):wl,Iu="trailing"in No?!!No.trailing:Iu);function Du(Bp){var Rm=Uo,zm=Vo;return Uo=Vo=to,mu=Bp,Pl=po.apply(zm,Rm),Pl}function Zu(Bp){return mu=Bp,Bl=W0(cp,xo),gu?Du(Bp):Pl}function op(Bp){var Rm=Bp-Gl,zm=Bp-mu,f_=xo-Rm;return bu?Zp(f_,wl-zm):f_}function Ju(Bp){var Rm=Bp-Gl,zm=Bp-mu;return Gl===to||Rm>=xo||Rm<0||bu&&zm>=wl}function cp(){var Bp=My();if(Ju(Bp))return dp(Bp);Bl=W0(cp,op(Bp))}function dp(Bp){return Bl=to,Iu&&Uo?Du(Bp):(Uo=Vo=to,Pl)}function hm(){Bl!==to&&nw(Bl),mu=0,Uo=Gl=Vo=Bl=to}function tm(){return Bl===to?Pl:dp(My())}function pm(){var Bp=My(),Rm=Ju(Bp);if(Uo=arguments,Vo=this,Gl=Bp,Rm){if(Bl===to)return Zu(Gl);if(bu)return nw(Bl),Bl=W0(cp,xo),Du(Gl)}return Bl===to&&(Bl=W0(cp,xo)),Pl}return pm.cancel=hm,pm.flush=tm,pm}var y$=ap(function(po,xo){return Bv(po,1,xo)}),v$=ap(function(po,xo,No){return Bv(po,Em(xo)||0,No)});function b$(po){return Dm(po,Wo)}function jy(po,xo){if(typeof po!="function"||xo!=null&&typeof xo!="function")throw new ym(oo);var No=function(){var Uo=arguments,Vo=xo?xo.apply(this,Uo):Uo[0],wl=No.cache;if(wl.has(Vo))return wl.get(Vo);var Pl=po.apply(this,Uo);return No.cache=wl.set(Vo,Pl)||wl,Pl};return No.cache=new(jy.Cache||jm),No}jy.Cache=jm;function By(po){if(typeof po!="function")throw new ym(oo);return function(){var xo=arguments;switch(xo.length){case 0:return!po.call(this);case 1:return!po.call(this,xo[0]);case 2:return!po.call(this,xo[0],xo[1]);case 3:return!po.call(this,xo[0],xo[1],xo[2])}return!po.apply(this,xo)}}function w$(po){return zw(2,po)}var _$=sE(function(po,xo){xo=xo.length==1&&rp(xo[0])?kp(xo[0],um(Ku())):kp(Vp(xo,1),um(Ku()));var No=xo.length;return ap(function(Uo){for(var Vo=-1,wl=Zp(Uo.length,No);++Vo=xo}),u0=Wv(function(){return arguments}())?Wv:function(po){return Mp(po)&&mp.call(po,"callee")&&!Tv.call(po,"callee")},rp=nu.isArray,j$=qm?um(qm):qx;function om(po){return po!=null&&Dy(po.length)&&!Um(po)}function jp(po){return Mp(po)&&om(po)}function B$(po){return po===!0||po===!1||Mp(po)&&Qp(po)==Ko}var e0=J_||J1,D$=d0?um(d0):Hx;function L$(po){return Mp(po)&&po.nodeType===1&&!z0(po)}function F$(po){if(po==null)return!0;if(om(po)&&(rp(po)||typeof po=="string"||typeof po.splice=="function"||e0(po)||S0(po)||u0(po)))return!po.length;var xo=Jp(po);if(xo==El||xo==Fl)return!po.size;if(U0(po))return!f1(po).length;for(var No in po)if(mp.call(po,No))return!1;return!0}function U$(po,xo){return D0(po,xo)}function W$(po,xo,No){No=typeof No=="function"?No:to;var Uo=No?No(po,xo):to;return Uo===to?D0(po,xo,to,No):!!Uo}function F1(po){if(!Mp(po))return!1;var xo=Qp(po);return xo==ga||xo==zo||typeof po.message=="string"&&typeof po.name=="string"&&!z0(po)}function z$(po){return typeof po=="number"&&Rv(po)}function Um(po){if(!Pp(po))return!1;var xo=Qp(po);return xo==$a||xo==Sl||xo==qo||xo==Ol}function Zw(po){return typeof po=="number"&&po==np(po)}function Dy(po){return typeof po=="number"&&po>-1&&po%1==0&&po<=Ao}function Pp(po){var xo=typeof po;return po!=null&&(xo=="object"||xo=="function")}function Mp(po){return po!=null&&typeof po=="object"}var Jw=r0?um(r0):Kx;function q$(po,xo){return po===xo||d1(po,xo,R1(xo))}function H$(po,xo,No){return No=typeof No=="function"?No:to,d1(po,xo,R1(xo),No)}function V$(po){return Yw(po)&&po!=+po}function K$(po){if(RE(po))throw new tp(io);return zv(po)}function G$(po){return po===null}function Z$(po){return po==null}function Yw(po){return typeof po=="number"||Mp(po)&&Qp(po)==Tl}function z0(po){if(!Mp(po)||Qp(po)!=Zl)return!1;var xo=dy(po);if(xo===null)return!0;var No=mp.call(xo,"constructor")&&xo.constructor;return typeof No=="function"&&No instanceof No&&sy.call(No)==q_}var U1=h0?um(h0):Gx;function J$(po){return Zw(po)&&po>=-Ao&&po<=Ao}var Xw=qy?um(qy):Zx;function Ly(po){return typeof po=="string"||!rp(po)&&Mp(po)&&Qp(po)==Jl}function fm(po){return typeof po=="symbol"||Mp(po)&&Qp(po)==cu}var S0=J0?um(J0):Jx;function Y$(po){return po===to}function X$(po){return Mp(po)&&Jp(po)==Xl}function Q$(po){return Mp(po)&&Qp(po)==ku}var eS=Iy(h1),tS=Iy(function(po,xo){return po<=xo});function Qw(po){if(!po)return[];if(om(po))return Ly(po)?Cm(po):im(po);if(R0&&po[R0])return P_(po[R0]());var xo=Jp(po),No=xo==El?e1:xo==Fl?iy:k0;return No(po)}function Wm(po){if(!po)return po===0?po:0;if(po=Em(po),po===To||po===-To){var xo=po<0?-1:1;return xo*ko}return po===po?po:0}function np(po){var xo=Wm(po),No=xo%1;return xo===xo?No?xo-No:xo:0}function e_(po){return po?a0(np(po),0,Io):0}function Em(po){if(typeof po=="number")return po;if(fm(po))return mo;if(Pp(po)){var xo=typeof po.valueOf=="function"?po.valueOf():po;po=Pp(xo)?xo+"":xo}if(typeof po!="string")return po===0?po:+po;po=wv(po);var No=ip.test(po);return No||Yu.test(po)?Ip(po.slice(2),No?2:8):Pu.test(po)?mo:+po}function t_(po){return Nm(po,am(po))}function rS(po){return po?a0(np(po),-Ao,Ao):po===0?po:0}function pp(po){return po==null?"":dm(po)}var nS=x0(function(po,xo){if(U0(xo)||om(xo)){Nm(xo,zp(xo),po);return}for(var No in xo)mp.call(xo,No)&&M0(po,No,xo[No])}),r_=x0(function(po,xo){Nm(xo,am(xo),po)}),Fy=x0(function(po,xo,No,Uo){Nm(xo,am(xo),po,Uo)}),iS=x0(function(po,xo,No,Uo){Nm(xo,zp(xo),po,Uo)}),oS=Lm(a1);function aS(po,xo){var No=_0(po);return xo==null?No:Mv(No,xo)}var sS=ap(function(po,xo){po=bp(po);var No=-1,Uo=xo.length,Vo=Uo>2?xo[2]:to;for(Vo&&em(xo[0],xo[1],Vo)&&(Uo=1);++No1),wl}),Nm(po,T1(po),No),Uo&&(No=wm(No,uo|ho|go,vE));for(var Vo=xo.length;Vo--;)b1(No,xo[Vo]);return No});function SS(po,xo){return i_(po,By(Ku(xo)))}var kS=Lm(function(po,xo){return po==null?{}:Qx(po,xo)});function i_(po,xo){if(po==null)return{};var No=kp(T1(po),function(Uo){return[Uo]});return xo=Ku(xo),Jv(po,No,function(Uo,Vo){return xo(Uo,Vo[0])})}function CS(po,xo,No){xo=Xm(xo,po);var Uo=-1,Vo=xo.length;for(Vo||(Vo=1,po=to);++Uoxo){var Uo=po;po=xo,xo=Uo}if(No||po%1||xo%1){var Vo=Av();return Zp(po+Vo*(xo-po+Op("1e-"+((Vo+"").length-1))),xo)}return m1(po,xo)}var FS=E0(function(po,xo,No){return xo=xo.toLowerCase(),po+(No?s_(xo):xo)});function s_(po){return q1(pp(po).toLowerCase())}function c_(po){return po=pp(po),po&&po.replace(Qu,C_).replace(f0,"")}function US(po,xo,No){po=pp(po),xo=dm(xo);var Uo=po.length;No=No===to?Uo:a0(np(No),0,Uo);var Vo=No;return No-=xo.length,No>=0&&po.slice(No,Vo)==xo}function WS(po){return po=pp(po),po&&Gu.test(po)?po.replace(yu,T_):po}function zS(po){return po=pp(po),po&&uu.test(po)?po.replace(ru,"\\$&"):po}var qS=E0(function(po,xo,No){return po+(No?"-":"")+xo.toLowerCase()}),HS=E0(function(po,xo,No){return po+(No?" ":"")+xo.toLowerCase()}),VS=dw("toLowerCase");function KS(po,xo,No){po=pp(po),xo=np(xo);var Uo=xo?g0(po):0;if(!xo||Uo>=xo)return po;var Vo=(xo-Uo)/2;return Ty(my(Vo),No)+po+Ty(py(Vo),No)}function GS(po,xo,No){po=pp(po),xo=np(xo);var Uo=xo?g0(po):0;return xo&&Uo>>0,No?(po=pp(po),po&&(typeof xo=="string"||xo!=null&&!U1(xo))&&(xo=dm(xo),!xo&&m0(po))?Qm(Cm(po),0,No):po.split(xo,No)):[]}var t3=E0(function(po,xo,No){return po+(No?" ":"")+q1(xo)});function r3(po,xo,No){return po=pp(po),No=No==null?0:a0(np(No),0,po.length),xo=dm(xo),po.slice(No,No+xo.length)==xo}function n3(po,xo,No){var Uo=_c.templateSettings;No&&em(po,xo,No)&&(xo=to),po=pp(po),xo=Fy({},xo,Uo,vw);var Vo=Fy({},xo.imports,Uo.imports,vw),wl=zp(Vo),Pl=Qy(Vo,wl),Bl,Gl,mu=0,gu=xo.interpolate||_f,bu="__p += '",Iu=t1((xo.escape||_f).source+"|"+gu.source+"|"+(gu===Yl?lu:_f).source+"|"+(xo.evaluate||_f).source+"|$","g"),Du="//# sourceURL="+(mp.call(xo,"sourceURL")?(xo.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zy+"]")+` +`;po.replace(Iu,function(Ju,cp,dp,hm,tm,pm){return dp||(dp=hm),bu+=po.slice(mu,pm).replace(ep,I_),cp&&(Bl=!0,bu+=`' + +__e(`+cp+`) + +'`),tm&&(Gl=!0,bu+=`'; +`+tm+`; +__p += '`),dp&&(bu+=`' + +((__t = (`+dp+`)) == null ? '' : __t) + +'`),mu=pm+Ju.length,Ju}),bu+=`'; +`;var Zu=mp.call(xo,"variable")&&xo.variable;if(!Zu)bu=`with (obj) { +`+bu+` +} +`;else if(au.test(Zu))throw new tp(ao);bu=(Gl?bu.replace(qu,""):bu).replace(pu,"$1").replace(xu,"$1;"),bu="function("+(Zu||"obj")+`) { +`+(Zu?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(Bl?", __e = _.escape":"")+(Gl?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+bu+`return __p +}`;var op=u_(function(){return hp(wl,Du+"return "+bu).apply(to,Pl)});if(op.source=bu,F1(op))throw op;return op}function i3(po){return pp(po).toLowerCase()}function o3(po){return pp(po).toUpperCase()}function a3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return wv(po);if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=Cm(xo),wl=_v(Uo,Vo),Pl=xv(Uo,Vo)+1;return Qm(Uo,wl,Pl).join("")}function s3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return po.slice(0,$v(po)+1);if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=xv(Uo,Cm(xo))+1;return Qm(Uo,0,Vo).join("")}function c3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return po.replace(xl,"");if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=_v(Uo,Cm(xo));return Qm(Uo,Vo).join("")}function l3(po,xo){var No=Jo,Uo=Po;if(Pp(xo)){var Vo="separator"in xo?xo.separator:Vo;No="length"in xo?np(xo.length):No,Uo="omission"in xo?dm(xo.omission):Uo}po=pp(po);var wl=po.length;if(m0(po)){var Pl=Cm(po);wl=Pl.length}if(No>=wl)return po;var Bl=No-g0(Uo);if(Bl<1)return Uo;var Gl=Pl?Qm(Pl,0,Bl).join(""):po.slice(0,Bl);if(Vo===to)return Gl+Uo;if(Pl&&(Bl+=Gl.length-Bl),U1(Vo)){if(po.slice(Bl).search(Vo)){var mu,gu=Gl;for(Vo.global||(Vo=t1(Vo.source,pp(Nu.exec(Vo))+"g")),Vo.lastIndex=0;mu=Vo.exec(gu);)var bu=mu.index;Gl=Gl.slice(0,bu===to?Bl:bu)}}else if(po.indexOf(dm(Vo),Bl)!=Bl){var Iu=Gl.lastIndexOf(Vo);Iu>-1&&(Gl=Gl.slice(0,Iu))}return Gl+Uo}function u3(po){return po=pp(po),po&&wu.test(po)?po.replace(Au,j_):po}var d3=E0(function(po,xo,No){return po+(No?" ":"")+xo.toUpperCase()}),q1=dw("toUpperCase");function l_(po,xo,No){return po=pp(po),xo=No?to:xo,xo===to?A_(po)?L_(po):x_(po):po.match(xo)||[]}var u_=ap(function(po,xo){try{return Yp(po,to,xo)}catch(No){return F1(No)?No:new tp(No)}}),f3=Lm(function(po,xo){return gm(xo,function(No){No=Om(No),Bm(po,No,D1(po[No],po))}),po});function h3(po){var xo=po==null?0:po.length,No=Ku();return po=xo?kp(po,function(Uo){if(typeof Uo[1]!="function")throw new ym(oo);return[No(Uo[0]),Uo[1]]}):[],ap(function(Uo){for(var Vo=-1;++VoAo)return[];var No=Io,Uo=Zp(po,Io);xo=Ku(xo),po-=Io;for(var Vo=Xy(Uo,xo);++No0||xo<0)?new lp(No):(po<0?No=No.takeRight(-po):po&&(No=No.drop(po)),xo!==to&&(xo=np(xo),No=xo<0?No.dropRight(-xo):No.take(xo-po)),No)},lp.prototype.takeRightWhile=function(po){return this.reverse().takeWhile(po).reverse()},lp.prototype.toArray=function(){return this.take(Io)},Pm(lp.prototype,function(po,xo){var No=/^(?:filter|find|map|reject)|While$/.test(xo),Uo=/^(?:head|last)$/.test(xo),Vo=_c[Uo?"take"+(xo=="last"?"Right":""):xo],wl=Uo||/^find/.test(xo);Vo&&(_c.prototype[xo]=function(){var Pl=this.__wrapped__,Bl=Uo?[1]:arguments,Gl=Pl instanceof lp,mu=Bl[0],gu=Gl||rp(Pl),bu=function(cp){var dp=Vo.apply(_c,Km([cp],Bl));return Uo&&Iu?dp[0]:dp};gu&&No&&typeof mu=="function"&&mu.length!=1&&(Gl=gu=!1);var Iu=this.__chain__,Du=!!this.__actions__.length,Zu=wl&&!Iu,op=Gl&&!Du;if(!wl&&gu){Pl=op?Pl:new lp(this);var Ju=po.apply(Pl,Bl);return Ju.__actions__.push({func:Ny,args:[bu],thisArg:to}),new bm(Ju,Iu)}return Zu&&op?po.apply(this,Bl):(Ju=this.thru(bu),Zu?Uo?Ju.value()[0]:Ju.value():Ju)})}),gm(["pop","push","shift","sort","splice","unshift"],function(po){var xo=oy[po],No=/^(?:push|sort|unshift)$/.test(po)?"tap":"thru",Uo=/^(?:pop|shift)$/.test(po);_c.prototype[po]=function(){var Vo=arguments;if(Uo&&!this.__chain__){var wl=this.value();return xo.apply(rp(wl)?wl:[],Vo)}return this[No](function(Pl){return xo.apply(rp(Pl)?Pl:[],Vo)})}}),Pm(lp.prototype,function(po,xo){var No=_c[xo];if(No){var Uo=No.name+"";mp.call(w0,Uo)||(w0[Uo]=[]),w0[Uo].push({name:xo,func:No})}}),w0[ky(to,$o).name]=[{name:"wrapper",func:to}],lp.prototype.clone=sx,lp.prototype.reverse=cx,lp.prototype.value=lx,_c.prototype.at=L2,_c.prototype.chain=F2,_c.prototype.commit=U2,_c.prototype.next=W2,_c.prototype.plant=q2,_c.prototype.reverse=H2,_c.prototype.toJSON=_c.prototype.valueOf=_c.prototype.value=V2,_c.prototype.first=_c.prototype.head,R0&&(_c.prototype[R0]=z2),_c},y0=F_();nm?((nm.exports=y0)._=y0,Xp._=y0):$p._=y0}).call(commonjsGlobal)})(lodash,lodash.exports);lodash.exports;qe$4(u$6)` + .horizontal-slider-track { + height: var(--spacing-xxxs); + background-color: var(--components-slider-background-default); + border-radius: var(--border-sm); + } + + .horizontal-slider-thumb { + width: var(--spacing-sm); + height: var(--spacing-sm); + margin-top: -6px; + background-color: var(--components-slider-icon-default); + border: var(--border-sm) solid var(--components-slider-stroke-default); + border-radius: 50%; + cursor: pointer; + &:active, + &:focus { + outline: none; + } + } + + ${({range:Xr})=>Xr?Ae$3` + .horizontal-slider-track-1 { + background-color: var(--components-slider-background-progress); + } + `:Ae$3` + .horizontal-slider-track-0 { + background-color: var(--components-slider-background-progress); + } + `} +`;const brandColors={"GRAY-100":"#F5F6F8","GRAY-200":"#EAEBF2","GRAY-300":"#C4CBD5","GRAY-400":"#B0B3B9","GRAY-500":"#8C93A0","GRAY-600":"#757D8D","GRAY-700":"#484D58","GRAY-800":"#313338","GRAY-900":"#202124","GRAY-1000":"#17181B","PINK-100":"#FCEBFF","PINK-200":"#FBE8FF","PINK-300":"#F3AEFF","PINK-400":"#CF59E2","PINK-500":"#D548EC","PINK-600":"#C742DD","PINK-700":"#AA30BE","PINK-800":"#7B0090","PINK-900":"#570066","PINK-1000":"#35003F","RED-100":"#FFECEC","RED-200":"#FFD9D9","RED-300":"#FFB1B1","RED-400":"#FF8585","RED-500":"#FF4E4E","RED-600":"#F11F1F","RED-700":"#D43B3B","RED-800":"#A40A0A","RED-900":"#670000","RED-1000":"#400000","GREEN-100":"#D8F7F0","GREEN-200":"#AFEFE1","GREEN-300":"#51DCBD","GREEN-400":"#00C296","GREEN-500":"#00A47F","GREEN-600":"#008769","GREEN-700":"#006B53","GREEN-800":"#A40A0A","GREEN-900":"#00382B","GREEN-1000":"#002019"},blocksColorsLegacy={PRIMARY:"rgba(27.0, 150.0, 227.0, 1.0)",PRIMARY_PINK:"#CF1C84",PLACEHOLDER_DARK_GRAY:"#D9D9D9",LINKS:"rgba(20.0, 126.0, 251.0, 1.0)",GRADIENT_PRIMARY:"rgba(226.0, 8.0, 128.0, 1.0)",GRADIENT_SECONDARY:"rgba(53.0, 197.0, 243.0, 1.0)",GRADIENT_THIRD:"rgba(103.0, 76.0, 159.0, 1.0)",TRANSPARENT:"transparent",WHITE:"rgba(255.0, 255.0, 255.0, 1.0)",DARK_WHITE:"rgba(255.0, 255.0, 255.0, 0.75)",MID_WHITE:"rgba(255.0, 255.0, 255.0, 0.5)",LIGHT_WHITE:"rgba(255.0, 255.0, 255.0, 0.25)",SLIGHTER_GRAY:"rgba(250.0, 250.0, 250.0, 1)",SLIGHT_GRAY:"rgba(231.0, 231.0, 231.0, 1)",LIGHT_GRAY:"rgba(225.0, 225.0, 225.0, 1)",MID_GRAY:"rgba(200.0, 200.0, 200.0, 1)",DARK_GRAY:"rgba(160.0, 160.0, 160.0, 1)",DARKER_GRAY:"rgba(100.0, 100.0, 100.0, 1)",LIGHT_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.1)",SEMI_MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.25)",MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.5)",DARK_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.75)",BLACK:"rgba(0.0, 0.0, 0.0, 1.0)",CONFIRM_GREEN:"rgba(50.0, 205.0, 50.0, 1.0)",CONFIRM:"rgba(34.0, 139.0, 34.0, 1.0)",WARNING:"rgba(255.0, 153.0, 0.0, 1.0)",SUBLIME_RED:"rgba(237.0, 59.0, 72.0, 1.0)",BADGE_RED:"rgba(208.0, 44.0, 30.0, 1.0)",LIGHT_MAROON:"rgba(159.0, 0.0, 0.0, 1.0)",LIGHTER_MAROON:"rgba(129.0, 0.0, 0.0, 1.0)",...brandColors},createBlocksColors=()=>{const Xr=blocksColorsLegacy;return Object.keys(Xr).reduce((to,ro)=>{const no=ro.toLowerCase().replace(/_([a-z])/g,(io,oo)=>oo.toUpperCase());return to[no]=Xr[ro],to},{})};createBlocksColors();qe$4.span` + /* Common Wrapper CSS */ + width: ${({width:Xr})=>Xr?`${Xr}px`:"auto"}; + height: ${({height:Xr})=>Xr?`${Xr}px`:"auto"}; + display: inline-flex; + font-size: inherit; + + /* Custom CSS applied via styled component css prop */ + ${Xr=>Xr.css||""} +`;const UninitializedWallet=()=>{const Xr=useNavigate();return jsxRuntimeExports.jsxs("div",{className:"flex gap-5",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Xr("signup"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-44",children:"Sign Up"}),jsxRuntimeExports.jsx("button",{onClick:()=>Xr("login"),className:"bg-green-600 text-white px-6 py-3 rounded-lg w-44",children:"Login"})]})},global$1=globalThis||void 0||self;var ACTION=(Xr=>(Xr.IS_CONNECTED="isConnected",Xr.REQ_TO_CONNECT="reqToConnect",Xr.REQ_TO_SIGN="reqToSign",Xr.REQ_WALLET_DETAILS="reqWalletDetails",Xr.ERROR="error",Xr.CONNECTION_STATUS="connectionStatus",Xr.WALLET_DETAILS="walletDetails",Xr.SIGNATURE="signature",Xr))(ACTION||{});const Y1=class Y1{constructor(eo){this.pushWallet=eo,this.initializeListener()}initializeListener(){Y1.messageListener&&window.removeEventListener("message",Y1.messageListener),Y1.messageListener=async eo=>{var no,io,oo,ao,so,co;if(eo.origin==="http://localhost:5174")return;const{action:to,data:ro}=eo.data;if(this.pushWallet===void 0)(no=eo.source)==null||no.postMessage({action:ACTION.ERROR,error:"PushWallet Not Logged In"},eo.origin),global$1.myEvent=eo;else switch(to){case ACTION.REQ_WALLET_DETAILS:{const lo=this.pushWallet.signerAccount;(io=eo.source)==null||io.postMessage({action:ACTION.WALLET_DETAILS,address:lo},eo.origin);break}case ACTION.IS_CONNECTED:{const lo=this.pushWallet.ConnectionStatus(eo.origin);(oo=eo.source)==null||oo.postMessage({action:ACTION.CONNECTION_STATUS,isPending:lo.isPending,isConnected:lo.isConnected},eo.origin);break}case ACTION.REQ_TO_CONNECT:{this.pushWallet.requestToConnect(eo.origin);const lo=this.pushWallet.ConnectionStatus(eo.origin);(ao=eo.source)==null||ao.postMessage({action:ACTION.CONNECTION_STATUS,isPending:lo.isPending,isConnected:lo.isConnected},eo.origin);break}case ACTION.REQ_TO_SIGN:{try{const lo=await this.pushWallet.sign(ro,eo.origin);(so=eo.source)==null||so.postMessage({action:ACTION.SIGNATURE,signature:lo},eo.origin)}catch{(co=eo.source)==null||co.postMessage({action:ACTION.ERROR,error:"Origin Not Connected"},eo.origin)}break}}},window.addEventListener("message",Y1.messageListener)}};sp(Y1,"messageListener");let PostMessageHandler=Y1;const initialState={wallet:null,theme:"light",postMessageHandler:new PostMessageHandler(void 0)};function globalReducer(Xr,eo){switch(eo.type){case"INITIALIZE_WALLET":return{...Xr,wallet:eo.payload,postMessageHandler:new PostMessageHandler(eo.payload)};case"RESET_WALLET":return{...Xr,wallet:null,postMessageHandler:new PostMessageHandler(void 0)};case"SET_THEME":return{...Xr,theme:eo.payload};default:return Xr}}const GlobalContext=reactExports.createContext({state:initialState,dispatch:()=>null});function useGlobalState(){const Xr=reactExports.useContext(GlobalContext);if(!Xr)throw new Error("useGlobalState must be used within a GlobalProvider");return Xr}const GlobalProvider=({children:Xr})=>{const[eo,to]=reactExports.useReducer(globalReducer,initialState);return jsxRuntimeExports.jsx(GlobalContext.Provider,{value:{state:eo,dispatch:to},children:Xr})},InitializedWallet=()=>{const Xr=useNavigate(),{state:eo,dispatch:to}=useGlobalState(),[ro]=reactExports.useState(eo.wallet.signerAccount.split(":")[2]),[no,io]=reactExports.useState(!1),[oo,ao]=reactExports.useState(!1),so=()=>io(!0),co=()=>io(!1),lo=()=>ao(!0),uo=()=>ao(!1),ho=bo=>{eo.wallet.acceptConnectionReq(bo),to({type:"INITIALIZE_WALLET",payload:eo.wallet})},go=bo=>{eo.wallet.rejectConnectionReq(bo),to({type:"INITIALIZE_WALLET",payload:eo.wallet})};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsxRuntimeExports.jsxs("div",{className:"p-8 w-full",children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Push Wallet Address",value:ro,disabled:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-center"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 mb-4",children:"This is the consumer account used for signing in the Push wallet"}),jsxRuntimeExports.jsx("button",{onClick:lo,className:"w-full py-3 mb-4 text-blue-600 bg-white border border-blue-600 rounded-md hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"View Connected Accounts"}),jsxRuntimeExports.jsx("button",{onClick:so,className:"w-full py-3 mb-4 text-blue-600 bg-white border border-blue-600 rounded-md hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"View App Connections"}),jsxRuntimeExports.jsxs("button",{onClick:()=>Xr("login"),className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Lock Push Account"]})]}),no&&jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-500 bg-opacity-75 z-50",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-lg relative",children:[jsxRuntimeExports.jsx("button",{onClick:co,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600",children:"×"}),jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold mb-4",children:"App Connections"}),jsxRuntimeExports.jsx("ul",{children:eo.wallet.appConnections.map(bo=>jsxRuntimeExports.jsx("li",{className:"mb-4",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("span",{className:"font-medium",children:bo.origin})}),jsxRuntimeExports.jsx("div",{className:"space-x-2",children:bo.isPending?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("button",{onClick:()=>ho(bo.origin),className:"px-4 py-2 text-white bg-green-600 rounded hover:bg-green-700",children:"Accept"}),jsxRuntimeExports.jsx("button",{onClick:()=>go(bo.origin),className:"px-4 py-2 text-white bg-red-600 rounded hover:bg-red-700",children:"Reject"})]}):jsxRuntimeExports.jsx("button",{onClick:()=>go(bo.origin),className:"px-4 py-2 text-white bg-gray-600 rounded hover:bg-gray-700",children:"Remove"})})]})},bo.origin))})]})}),oo&&jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-500 bg-opacity-75 z-50",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-6xl relative",children:[jsxRuntimeExports.jsx("button",{onClick:uo,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600",children:"×"}),jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Connected Accounts"}),jsxRuntimeExports.jsx("ul",{children:Object.keys(eo.wallet.walletToEncDerivedKey).map(bo=>jsxRuntimeExports.jsx("li",{className:"mb-4",children:jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntimeExports.jsx("div",{className:"break-words",children:jsxRuntimeExports.jsx("span",{className:"font-medium",children:bo})})})},bo))})]})})]})};function Home(){const{state:Xr}=useGlobalState();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xr.wallet===null?jsxRuntimeExports.jsx(UninitializedWallet,{}):jsxRuntimeExports.jsx(InitializedWallet,{})})}function number$7(Xr){if(!Number.isSafeInteger(Xr)||Xr<0)throw new Error(`positive integer expected, not ${Xr}`)}function isBytes$8(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function bytes$2(Xr,...eo){if(!isBytes$8(Xr))throw new Error("Uint8Array expected");if(eo.length>0&&!eo.includes(Xr.length))throw new Error(`Uint8Array expected of length ${eo}, not of length=${Xr.length}`)}function hash$6(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$7(Xr.outputLen),number$7(Xr.blockLen)}function exists$3(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output$2(Xr,eo){bytes$2(Xr);const to=eo.outputLen;if(Xr.lengthnew Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength),u32$2=Xr=>new Uint32Array(Xr.buffer,Xr.byteOffset,Math.floor(Xr.byteLength/4)),createView$1=Xr=>new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),rotr$1=(Xr,eo)=>Xr<<32-eo|Xr>>>eo,rotl=(Xr,eo)=>Xr<>>32-eo>>>0,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=Xr=>Xr<<24&4278190080|Xr<<8&16711680|Xr>>>8&65280|Xr>>>24&255,byteSwapIfBE=isLE$1?Xr=>Xr:Xr=>byteSwap(Xr);function byteSwap32(Xr){for(let eo=0;eoeo.toString(16).padStart(2,"0"));function bytesToHex$4(Xr){bytes$2(Xr);let eo="";for(let to=0;to=asciis$3._0&&Xr<=asciis$3._9)return Xr-asciis$3._0;if(Xr>=asciis$3._A&&Xr<=asciis$3._F)return Xr-(asciis$3._A-10);if(Xr>=asciis$3._a&&Xr<=asciis$3._f)return Xr-(asciis$3._a-10)}function hexToBytes$5(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no{};async function asyncLoop(Xr,eo,to){let ro=Date.now();for(let no=0;no=0&&ioXr().update(toBytes$2(ro)).digest(),to=Xr();return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=()=>Xr(),eo}function wrapConstructorWithOpts(Xr){const eo=(ro,no)=>Xr(no).update(toBytes$2(ro)).digest(),to=Xr({});return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=ro=>Xr(ro),eo}function wrapXOFConstructorWithOpts(Xr){const eo=(ro,no)=>Xr(no).update(toBytes$2(ro)).digest(),to=Xr({});return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=ro=>Xr(ro),eo}function randomBytes$1(Xr=32){if(crypto$5&&typeof crypto$5.getRandomValues=="function")return crypto$5.getRandomValues(new Uint8Array(Xr));if(crypto$5&&typeof crypto$5.randomBytes=="function")return crypto$5.randomBytes(Xr);throw new Error("crypto.getRandomValues must be defined")}const utils$f=Object.freeze(Object.defineProperty({__proto__:null,Hash:Hash$5,asyncLoop,byteSwap,byteSwap32,byteSwapIfBE,bytesToHex:bytesToHex$4,checkOpts,concatBytes:concatBytes$5,createView:createView$1,hexToBytes:hexToBytes$5,isBytes:isBytes$7,isLE:isLE$1,nextTick:nextTick$1,randomBytes:randomBytes$1,rotl,rotr:rotr$1,toBytes:toBytes$2,u32:u32$2,u8:u8$1,utf8ToBytes:utf8ToBytes$4,wrapConstructor:wrapConstructor$1,wrapConstructorWithOpts,wrapXOFConstructorWithOpts},Symbol.toStringTag,{value:"Module"}));let HMAC$2=class extends Hash$5{constructor(eo,to){super(),this.finished=!1,this.destroyed=!1,hash$6(eo);const ro=toBytes$2(to);if(this.iHash=eo.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 no=this.blockLen,io=new Uint8Array(no);io.set(ro.length>no?eo.create().update(ro).digest():ro);for(let oo=0;oonew HMAC$2(Xr,eo).update(to).digest();hmac$4.create=(Xr,eo)=>new HMAC$2(Xr,eo);const hmac$5=Object.freeze(Object.defineProperty({__proto__:null,HMAC:HMAC$2,hmac:hmac$4},Symbol.toStringTag,{value:"Module"}));function pbkdf2Init(Xr,eo,to,ro){hash$6(Xr);const no=checkOpts({dkLen:32,asyncTick:10},ro),{c:io,dkLen:oo,asyncTick:ao}=no;if(number$7(io),number$7(oo),number$7(ao),io<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const so=toBytes$2(eo),co=toBytes$2(to),lo=new Uint8Array(oo),uo=hmac$4.create(Xr,so),ho=uo._cloneInto().update(co);return{c:io,dkLen:oo,asyncTick:ao,DK:lo,PRF:uo,PRFSalt:ho}}function pbkdf2Output(Xr,eo,to,ro,no){return Xr.destroy(),eo.destroy(),ro&&ro.destroy(),no.fill(0),to}function pbkdf2(Xr,eo,to,ro){const{c:no,dkLen:io,DK:oo,PRF:ao,PRFSalt:so}=pbkdf2Init(Xr,eo,to,ro);let co;const lo=new Uint8Array(4),uo=createView$1(lo),ho=new Uint8Array(ao.outputLen);for(let go=1,bo=0;bo{so._cloneInto(lo).update(go).digestInto(go);for(let $o=0;$o0&&!eo.includes(Xr.length))throw new Error(`Uint8Array expected of length ${eo}, not of length=${Xr.length}`)}function hash$5(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$6(Xr.outputLen),number$6(Xr.blockLen)}function exists$2(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output$1(Xr,eo){bytes$1(Xr);const to=eo.outputLen;if(Xr.lengthnew Uint8Array(fo.buffer,fo.byteOffset,fo.byteLength);Xr.u8=no;const io=fo=>new Uint32Array(fo.buffer,fo.byteOffset,Math.floor(fo.byteLength/4));Xr.u32=io;const oo=fo=>new DataView(fo.buffer,fo.byteOffset,fo.byteLength);Xr.createView=oo;const ao=(fo,yo)=>fo<<32-yo|fo>>>yo;Xr.rotr=ao;const so=(fo,yo)=>fo<>>32-yo>>>0;Xr.rotl=so,Xr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const co=fo=>fo<<24&4278190080|fo<<8&16711680|fo>>>8&65280|fo>>>24&255;Xr.byteSwap=co,Xr.byteSwapIfBE=Xr.isLE?fo=>fo:fo=>(0,Xr.byteSwap)(fo);function lo(fo){for(let yo=0;yoyo.toString(16).padStart(2,"0"));function ho(fo){(0,to.bytes)(fo);let yo="";for(let vo=0;vo=go._0&&fo<=go._9)return fo-go._0;if(fo>=go._A&&fo<=go._F)return fo-(go._A-10);if(fo>=go._a&&fo<=go._f)return fo-(go._a-10)}function wo(fo){if(typeof fo!="string")throw new Error("hex string expected, got "+typeof fo);const yo=fo.length,vo=yo/2;if(yo%2)throw new Error("padded hex string expected, got unpadded hex of length "+yo);const _o=new Uint8Array(vo);for(let So=0,To=0;So{};Xr.nextTick=Eo;async function $o(fo,yo,vo){let _o=Date.now();for(let So=0;So=0&&Tofo().update(Ro(_o)).digest(),vo=fo();return yo.outputLen=vo.outputLen,yo.blockLen=vo.blockLen,yo.create=()=>fo(),yo}function Wo(fo){const yo=(_o,So)=>fo(So).update(Ro(_o)).digest(),vo=fo({});return yo.outputLen=vo.outputLen,yo.blockLen=vo.blockLen,yo.create=_o=>fo(_o),yo}function Jo(fo){const yo=(_o,So)=>fo(So).update(Ro(_o)).digest(),vo=fo({});return yo.outputLen=vo.outputLen,yo.blockLen=vo.blockLen,yo.create=_o=>fo(_o),yo}function Po(fo=32){if(eo.crypto&&typeof eo.crypto.getRandomValues=="function")return eo.crypto.getRandomValues(new Uint8Array(fo));if(eo.crypto&&typeof eo.crypto.randomBytes=="function")return eo.crypto.randomBytes(fo);throw new Error("crypto.getRandomValues must be defined")}})(utils$e);Object.defineProperty(_md,"__esModule",{value:!0});_md.HashMD=_md.Maj=_md.Chi=void 0;const _assert_js_1=_assert,utils_js_1$3=utils$e;function setBigUint64$2(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}const Chi$1=(Xr,eo,to)=>Xr&eo^~Xr&to;_md.Chi=Chi$1;const Maj$1=(Xr,eo,to)=>Xr&eo^Xr&to^eo&to;_md.Maj=Maj$1;let HashMD$1=class extends utils_js_1$3.Hash{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(eo){(0,_assert_js_1.exists)(this);const{view:to,buffer:ro,blockLen:no}=this;eo=(0,utils_js_1$3.toBytes)(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let uo=oo;uolo.length)throw new Error("_sha2: outputLen bigger than state");for(let uo=0;uo>>3,wo=(0,utils_js_1$2.rotr)(go,17)^(0,utils_js_1$2.rotr)(go,19)^go>>>10;SHA256_W$1[uo]=wo+SHA256_W$1[uo-7]+bo+SHA256_W$1[uo-16]|0}let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this;for(let uo=0;uo<64;uo++){const ho=(0,utils_js_1$2.rotr)(ao,6)^(0,utils_js_1$2.rotr)(ao,11)^(0,utils_js_1$2.rotr)(ao,25),go=lo+ho+(0,_md_js_1$2.Chi)(ao,so,co)+SHA256_K$1[uo]+SHA256_W$1[uo]|0,wo=((0,utils_js_1$2.rotr)(ro,2)^(0,utils_js_1$2.rotr)(ro,13)^(0,utils_js_1$2.rotr)(ro,22))+(0,_md_js_1$2.Maj)(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+go|0,oo=io,io=no,no=ro,ro=go+wo|0}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,so=so+this.F|0,co=co+this.G|0,lo=lo+this.H|0,this.set(ro,no,io,oo,ao,so,co,lo)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};sha256$7.SHA256=SHA256$1;class SHA224 extends SHA256$1{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}}var sha256_1$4=sha256$7.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256$1);sha256$7.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);function setBigUint64$1(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}class HashMD extends Hash$5{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=createView$1(this.buffer)}update(eo){exists$3(this);const{view:to,buffer:ro,blockLen:no}=this;eo=toBytes$2(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let uo=oo;uolo.length)throw new Error("_sha2: outputLen bigger than state");for(let uo=0;uo>_32n$1&U32_MASK64$1)}:{h:Number(Xr>>_32n$1&U32_MASK64$1)|0,l:Number(Xr&U32_MASK64$1)|0}}function split$2(Xr,eo=!1){let to=new Uint32Array(Xr.length),ro=new Uint32Array(Xr.length);for(let no=0;noBigInt(Xr>>>0)<<_32n$1|BigInt(eo>>>0),shrSH=(Xr,eo,to)=>Xr>>>to,shrSL=(Xr,eo,to)=>Xr<<32-to|eo>>>to,rotrSH=(Xr,eo,to)=>Xr>>>to|eo<<32-to,rotrSL=(Xr,eo,to)=>Xr<<32-to|eo>>>to,rotrBH=(Xr,eo,to)=>Xr<<64-to|eo>>>to-32,rotrBL=(Xr,eo,to)=>Xr>>>to-32|eo<<64-to,rotr32H=(Xr,eo)=>eo,rotr32L=(Xr,eo)=>Xr,rotlSH$1=(Xr,eo,to)=>Xr<>>32-to,rotlSL$1=(Xr,eo,to)=>eo<>>32-to,rotlBH$1=(Xr,eo,to)=>eo<>>64-to,rotlBL$1=(Xr,eo,to)=>Xr<>>64-to;function add(Xr,eo,to,ro){const no=(eo>>>0)+(ro>>>0);return{h:Xr+to+(no/2**32|0)|0,l:no|0}}const add3L=(Xr,eo,to)=>(Xr>>>0)+(eo>>>0)+(to>>>0),add3H=(Xr,eo,to,ro)=>eo+to+ro+(Xr/2**32|0)|0,add4L=(Xr,eo,to,ro)=>(Xr>>>0)+(eo>>>0)+(to>>>0)+(ro>>>0),add4H=(Xr,eo,to,ro,no)=>eo+to+ro+no+(Xr/2**32|0)|0,add5L=(Xr,eo,to,ro,no)=>(Xr>>>0)+(eo>>>0)+(to>>>0)+(ro>>>0)+(no>>>0),add5H=(Xr,eo,to,ro,no,io)=>eo+to+ro+no+io+(Xr/2**32|0)|0,u64$4={fromBig:fromBig$1,split:split$2,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH:rotlSH$1,rotlSL:rotlSL$1,rotlBH:rotlBH$1,rotlBL:rotlBL$1,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64$4.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(Xr=>BigInt(Xr))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends 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:eo,Al:to,Bh:ro,Bl:no,Ch:io,Cl:oo,Dh:ao,Dl:so,Eh:co,El:lo,Fh:uo,Fl:ho,Gh:go,Gl:bo,Hh:wo,Hl:Eo}=this;return[eo,to,ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo]}set(eo,to,ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo){this.Ah=eo|0,this.Al=to|0,this.Bh=ro|0,this.Bl=no|0,this.Ch=io|0,this.Cl=oo|0,this.Dh=ao|0,this.Dl=so|0,this.Eh=co|0,this.El=lo|0,this.Fh=uo|0,this.Fl=ho|0,this.Gh=go|0,this.Gl=bo|0,this.Hh=wo|0,this.Hl=Eo|0}process(eo,to){for(let Ro=0;Ro<16;Ro++,to+=4)SHA512_W_H[Ro]=eo.getUint32(to),SHA512_W_L[Ro]=eo.getUint32(to+=4);for(let Ro=16;Ro<80;Ro++){const Oo=SHA512_W_H[Ro-15]|0,jo=SHA512_W_L[Ro-15]|0,Bo=u64$4.rotrSH(Oo,jo,1)^u64$4.rotrSH(Oo,jo,8)^u64$4.shrSH(Oo,jo,7),Mo=u64$4.rotrSL(Oo,jo,1)^u64$4.rotrSL(Oo,jo,8)^u64$4.shrSL(Oo,jo,7),Fo=SHA512_W_H[Ro-2]|0,Wo=SHA512_W_L[Ro-2]|0,Jo=u64$4.rotrSH(Fo,Wo,19)^u64$4.rotrBH(Fo,Wo,61)^u64$4.shrSH(Fo,Wo,6),Po=u64$4.rotrSL(Fo,Wo,19)^u64$4.rotrBL(Fo,Wo,61)^u64$4.shrSL(Fo,Wo,6),fo=u64$4.add4L(Mo,Po,SHA512_W_L[Ro-7],SHA512_W_L[Ro-16]),yo=u64$4.add4H(fo,Bo,Jo,SHA512_W_H[Ro-7],SHA512_W_H[Ro-16]);SHA512_W_H[Ro]=yo|0,SHA512_W_L[Ro]=fo|0}let{Ah:ro,Al:no,Bh:io,Bl:oo,Ch:ao,Cl:so,Dh:co,Dl:lo,Eh:uo,El:ho,Fh:go,Fl:bo,Gh:wo,Gl:Eo,Hh:$o,Hl:Co}=this;for(let Ro=0;Ro<80;Ro++){const Oo=u64$4.rotrSH(uo,ho,14)^u64$4.rotrSH(uo,ho,18)^u64$4.rotrBH(uo,ho,41),jo=u64$4.rotrSL(uo,ho,14)^u64$4.rotrSL(uo,ho,18)^u64$4.rotrBL(uo,ho,41),Bo=uo&go^~uo&wo,Mo=ho&bo^~ho&Eo,Fo=u64$4.add5L(Co,jo,Mo,SHA512_Kl[Ro],SHA512_W_L[Ro]),Wo=u64$4.add5H(Fo,$o,Oo,Bo,SHA512_Kh[Ro],SHA512_W_H[Ro]),Jo=Fo|0,Po=u64$4.rotrSH(ro,no,28)^u64$4.rotrBH(ro,no,34)^u64$4.rotrBH(ro,no,39),fo=u64$4.rotrSL(ro,no,28)^u64$4.rotrBL(ro,no,34)^u64$4.rotrBL(ro,no,39),yo=ro&io^ro&ao^io&ao,vo=no&oo^no&so^oo&so;$o=wo|0,Co=Eo|0,wo=go|0,Eo=bo|0,go=uo|0,bo=ho|0,{h:uo,l:ho}=u64$4.add(co|0,lo|0,Wo|0,Jo|0),co=ao|0,lo=so|0,ao=io|0,so=oo|0,io=ro|0,oo=no|0;const _o=u64$4.add3L(Jo,fo,vo);ro=u64$4.add3H(_o,Wo,Po,yo),no=_o|0}({h:ro,l:no}=u64$4.add(this.Ah|0,this.Al|0,ro|0,no|0)),{h:io,l:oo}=u64$4.add(this.Bh|0,this.Bl|0,io|0,oo|0),{h:ao,l:so}=u64$4.add(this.Ch|0,this.Cl|0,ao|0,so|0),{h:co,l:lo}=u64$4.add(this.Dh|0,this.Dl|0,co|0,lo|0),{h:uo,l:ho}=u64$4.add(this.Eh|0,this.El|0,uo|0,ho|0),{h:go,l:bo}=u64$4.add(this.Fh|0,this.Fl|0,go|0,bo|0),{h:wo,l:Eo}=u64$4.add(this.Gh|0,this.Gl|0,wo|0,Eo|0),{h:$o,l:Co}=u64$4.add(this.Hh|0,this.Hl|0,$o|0,Co|0),this.set(ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo,$o,Co)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.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)}}const sha512$3=wrapConstructor$1(()=>new SHA512);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$5(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function chain(...Xr){const eo=io=>io,to=(io,oo)=>ao=>io(oo(ao)),ro=Xr.map(io=>io.encode).reduceRight(to,eo),no=Xr.map(io=>io.decode).reduce(to,eo);return{encode:ro,decode:no}}function alphabet$1(Xr){return{encode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return eo.map(to=>{if(to<0||to>=Xr.length)throw new Error(`Digit index outside alphabet: ${to} (alphabet: ${Xr.length})`);return Xr[to]})},decode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="string")throw new Error("alphabet.decode input should be array of strings");return eo.map(to=>{if(typeof to!="string")throw new Error(`alphabet.decode: not string element=${to}`);const ro=Xr.indexOf(to);if(ro===-1)throw new Error(`Unknown letter: "${to}". Allowed: ${Xr}`);return ro})}}}function join(Xr=""){if(typeof Xr!="string")throw new Error("join separator should be string");return{encode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="string")throw new Error("join.encode input should be array of strings");for(let to of eo)if(typeof to!="string")throw new Error(`join.encode: non-string input=${to}`);return eo.join(Xr)},decode:eo=>{if(typeof eo!="string")throw new Error("join.decode input should be string");return eo.split(Xr)}}}function padding(Xr,eo="="){if(typeof eo!="string")throw new Error("padding chr should be string");return{encode(to){if(!Array.isArray(to)||to.length&&typeof to[0]!="string")throw new Error("padding.encode input should be array of strings");for(let ro of to)if(typeof ro!="string")throw new Error(`padding.encode: non-string input=${ro}`);for(;to.length*Xr%8;)to.push(eo);return to},decode(to){if(!Array.isArray(to)||to.length&&typeof to[0]!="string")throw new Error("padding.encode input should be array of strings");for(let no of to)if(typeof no!="string")throw new Error(`padding.decode: non-string input=${no}`);let ro=to.length;if(ro*Xr%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;ro>0&&to[ro-1]===eo;ro--)if(!((ro-1)*Xr%8))throw new Error("Invalid padding: string has too much padding");return to.slice(0,ro)}}}function convertRadix(Xr,eo,to){if(eo<2)throw new Error(`convertRadix: wrong from=${eo}, base cannot be less than 2`);if(to<2)throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`);if(!Array.isArray(Xr))throw new Error("convertRadix: data should be array");if(!Xr.length)return[];let ro=0;const no=[],io=Array.from(Xr);for(io.forEach(oo=>{if(oo<0||oo>=eo)throw new Error(`Wrong integer: ${oo}`)});;){let oo=0,ao=!0;for(let so=ro;soeo?gcd(eo,Xr%eo):Xr,radix2carry=(Xr,eo)=>Xr+(eo-gcd(Xr,eo));function convertRadix2(Xr,eo,to,ro){if(!Array.isArray(Xr))throw new Error("convertRadix2: data should be array");if(eo<=0||eo>32)throw new Error(`convertRadix2: wrong from=${eo}`);if(to<=0||to>32)throw new Error(`convertRadix2: wrong to=${to}`);if(radix2carry(eo,to)>32)throw new Error(`convertRadix2: carry overflow from=${eo} to=${to} carryBits=${radix2carry(eo,to)}`);let no=0,io=0;const oo=2**to-1,ao=[];for(const so of Xr){if(so>=2**eo)throw new Error(`convertRadix2: invalid data word=${so} from=${eo}`);if(no=no<32)throw new Error(`convertRadix2: carry overflow pos=${io} from=${eo}`);for(io+=eo;io>=to;io-=to)ao.push((no>>io-to&oo)>>>0);no&=2**io-1}if(no=no<=eo)throw new Error("Excess padding");if(!ro&&no)throw new Error(`Non-zero padding: ${no}`);return ro&&io>0&&ao.push(no>>>0),ao}function radix(Xr){return{encode:eo=>{if(!isBytes$5(eo))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(eo),2**8,Xr)},decode:eo=>{if(!Array.isArray(eo)||eo.length&&typeof eo[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(convertRadix(eo,Xr,2**8))}}}function radix2(Xr,eo=!1){if(Xr<=0||Xr>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry(8,Xr)>32||radix2carry(Xr,8)>32)throw new Error("radix2: carry overflow");return{encode:to=>{if(!isBytes$5(to))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(to),8,Xr,!eo)},decode:to=>{if(!Array.isArray(to)||to.length&&typeof to[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(convertRadix2(to,Xr,8,eo))}}}function checksum(Xr,eo){if(typeof eo!="function")throw new Error("checksum fn should be function");return{encode(to){if(!isBytes$5(to))throw new Error("checksum.encode: input should be Uint8Array");const ro=eo(to).slice(0,Xr),no=new Uint8Array(to.length+Xr);return no.set(to),no.set(ro,to.length),no},decode(to){if(!isBytes$5(to))throw new Error("checksum.decode: input should be Uint8Array");const ro=to.slice(0,-Xr),no=eo(ro).slice(0,Xr),io=to.slice(-Xr);for(let oo=0;oochain(radix(58),alphabet$1(Xr),join("")),base58$2=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check=Xr=>chain(checksum(4,eo=>Xr(Xr(eo))),base58$2);/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const isJapanese=Xr=>Xr[0]==="あいこくしん";function nfkd(Xr){if(typeof Xr!="string")throw new TypeError(`Invalid mnemonic type: ${typeof Xr}`);return Xr.normalize("NFKD")}function normalize$1(Xr){const eo=nfkd(Xr),to=eo.split(" ");if(![12,15,18,21,24].includes(to.length))throw new Error("Invalid mnemonic");return{nfkd:eo,words:to}}function assertEntropy(Xr){bytes$2(Xr,16,20,24,28,32)}function generateMnemonic(Xr,eo=128){if(number$7(eo),eo%32!==0||eo>256)throw new TypeError("Invalid entropy");return entropyToMnemonic(randomBytes$1(eo/8),Xr)}const calcChecksum=Xr=>{const eo=8-Xr.length/4;return new Uint8Array([sha256_1$4(Xr)[0]>>eo<{if(typeof eo!="string")throw new Error(`Wordlist: non-string element: ${eo}`)}),utils$d.chain(utils$d.checksum(1,calcChecksum),utils$d.radix2(11,!0),utils$d.alphabet(Xr))}function entropyToMnemonic(Xr,eo){return assertEntropy(Xr),getCoder(eo).encode(Xr).join(isJapanese(eo)?" ":" ")}const salt=Xr=>nfkd(`mnemonic${Xr}`);function mnemonicToSeed(Xr,eo=""){return pbkdf2Async(sha512$3,normalize$1(Xr).nfkd,salt(eo),{c:2048,dkLen:64})}function mnemonicToSeedSync(Xr,eo=""){return pbkdf2(sha512$3,normalize$1(Xr).nfkd,salt(eo),{c:2048,dkLen:64})}const wordlist=`abandon ability able about @@ -2113,19 +3943,19 @@ zebra zero zone zoo`.split(` -`);var ripemd160$1={};Object.defineProperty(ripemd160$1,"__esModule",{value:!0});var ripemd160_1=ripemd160$1.ripemd160=ripemd160$1.RIPEMD160=void 0;const _md_js_1$1=_md,utils_js_1$1=utils$e,Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((Xr,eo)=>eo)),Pi$1=Id.map(Xr=>(9*Xr+5)%16);let idxL=[Id],idxR=[Pi$1];for(let Xr=0;Xr<4;Xr++)for(let eo of[idxL,idxR])eo.push(eo[Xr].map(to=>Rho[to]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(Xr=>new Uint8Array(Xr)),shiftsL=idxL.map((Xr,eo)=>Xr.map(to=>shifts[eo][to])),shiftsR=idxR.map((Xr,eo)=>Xr.map(to=>shifts[eo][to])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$b(Xr,eo,to,ro){return Xr===0?eo^to^ro:Xr===1?eo&to|~eo&ro:Xr===2?(eo|~to)^ro:Xr===3?eo&ro|to&~ro:eo^(to|~ro)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends _md_js_1$1.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:eo,h1:to,h2:ro,h3:no,h4:io}=this;return[eo,to,ro,no,io]}set(eo,to,ro,no,io){this.h0=eo|0,this.h1=to|0,this.h2=ro|0,this.h3=no|0,this.h4=io|0}process(eo,to){for(let go=0;go<16;go++,to+=4)R_BUF[go]=eo.getUint32(to,!0);let ro=this.h0|0,no=ro,io=this.h1|0,oo=io,ao=this.h2|0,so=ao,co=this.h3|0,lo=co,fo=this.h4|0,ho=fo;for(let go=0;go<5;go++){const yo=4-go,vo=Kl[go],wo=Kr[go],Eo=idxL[go],ko=idxR[go],Ao=shiftsL[go],Po=shiftsR[go];for(let jo=0;jo<16;jo++){const Mo=(0,utils_js_1$1.rotl)(ro+f$b(go,io,ao,co)+R_BUF[Eo[jo]]+vo,Ao[jo])+fo|0;ro=fo,fo=co,co=(0,utils_js_1$1.rotl)(ao,10)|0,ao=io,io=Mo}for(let jo=0;jo<16;jo++){const Mo=(0,utils_js_1$1.rotl)(no+f$b(yo,oo,so,lo)+R_BUF[ko[jo]]+wo,Po[jo])+ho|0;no=ho,ho=lo,lo=(0,utils_js_1$1.rotl)(so,10)|0,so=oo,oo=Mo}}this.set(this.h1+ao+lo|0,this.h2+co+ho|0,this.h3+fo+no|0,this.h4+ro+oo|0,this.h0+io+so|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}ripemd160$1.RIPEMD160=RIPEMD160;ripemd160_1=ripemd160$1.ripemd160=(0,utils_js_1$1.wrapConstructor)(()=>new RIPEMD160);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$e=BigInt(0),_1n$g=BigInt(1),_2n$a=BigInt(2);function isBytes$4(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function abytes(Xr){if(!isBytes$4(Xr))throw new Error("Uint8Array expected")}function abool(Xr,eo){if(typeof eo!="boolean")throw new Error(`${Xr} must be valid boolean, got "${eo}".`)}const hexes$3=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex$3(Xr){abytes(Xr);let eo="";for(let to=0;to=asciis$2._0&&Xr<=asciis$2._9)return Xr-asciis$2._0;if(Xr>=asciis$2._A&&Xr<=asciis$2._F)return Xr-(asciis$2._A-10);if(Xr>=asciis$2._a&&Xr<=asciis$2._f)return Xr-(asciis$2._a-10)}function hexToBytes$4(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;notypeof Xr=="bigint"&&_0n$e<=Xr;function inRange$1(Xr,eo,to){return isPosBig(Xr)&&isPosBig(eo)&&isPosBig(to)&&eo<=Xr&&Xr_0n$e;Xr>>=_1n$g,eo+=1);return eo}function bitGet$2(Xr,eo){return Xr>>BigInt(eo)&_1n$g}function bitSet$2(Xr,eo,to){return Xr|(to?_1n$g:_0n$e)<(_2n$a<new Uint8Array(Xr),u8fr$2=Xr=>Uint8Array.from(Xr);function createHmacDrbg$2(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n$2(Xr),no=u8n$2(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...fo)=>to(no,ro,...fo),so=(fo=u8n$2())=>{no=ao(u8fr$2([0]),fo),ro=ao(),fo.length!==0&&(no=ao(u8fr$2([1]),fo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let fo=0;const ho=[];for(;fo{oo(),so(fo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns$2={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes$4(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject$2(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns$2[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const notImplemented=()=>{throw new Error("not implemented")};function memoized(Xr){const eo=new WeakMap;return(to,...ro)=>{const no=eo.get(to);if(no!==void 0)return no;const io=Xr(to,...ro);return eo.set(to,io),io}}const ut$6=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet:bitGet$2,bitLen:bitLen$2,bitMask:bitMask$2,bitSet:bitSet$2,bytesToHex:bytesToHex$3,bytesToNumberBE:bytesToNumberBE$2,bytesToNumberLE:bytesToNumberLE$2,concatBytes:concatBytes$4,createHmacDrbg:createHmacDrbg$2,ensureBytes:ensureBytes$3,equalBytes:equalBytes$2,hexToBytes:hexToBytes$4,hexToNumber:hexToNumber$3,inRange:inRange$1,isBytes:isBytes$4,memoized,notImplemented,numberToBytesBE:numberToBytesBE$2,numberToBytesLE:numberToBytesLE$2,numberToHexUnpadded:numberToHexUnpadded$2,numberToVarBytesBE:numberToVarBytesBE$2,utf8ToBytes:utf8ToBytes$3,validateObject:validateObject$2},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$d=BigInt(0),_1n$f=BigInt(1),_2n$9=BigInt(2),_3n$4=BigInt(3),_4n$2=BigInt(4),_5n$2=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$2(Xr,eo){const to=Xr%eo;return to>=_0n$d?to:eo+to}function pow$1(Xr,eo,to){if(to<=_0n$d||eo<_0n$d)throw new Error("Expected power/modulo > 0");if(to===_1n$f)return _0n$d;let ro=_1n$f;for(;eo>_0n$d;)eo&_1n$f&&(ro=ro*Xr%to),Xr=Xr*Xr%to,eo>>=_1n$f;return ro}function pow2(Xr,eo,to){let ro=Xr;for(;eo-- >_0n$d;)ro*=ro,ro%=to;return ro}function invert$2(Xr,eo){if(Xr===_0n$d||eo<=_0n$d)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod$2(Xr,eo),ro=eo,no=_0n$d,io=_1n$f;for(;to!==_0n$d;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$f)throw new Error("invert: does not exist");return mod$2(no,eo)}function tonelliShanks$1(Xr){const eo=(Xr-_1n$f)/_2n$9;let to,ro,no;for(to=Xr-_1n$f,ro=0;to%_2n$9===_0n$d;to/=_2n$9,ro++);for(no=_2n$9;no(mod$2(Xr,eo)&_1n$f)===_1n$f,FIELD_FIELDS$2=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField$2(Xr){const eo={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},to=FIELD_FIELDS$2.reduce((ro,no)=>(ro[no]="function",ro),eo);return validateObject$2(Xr,to)}function FpPow$2(Xr,eo,to){if(to<_0n$d)throw new Error("Expected power > 0");if(to===_0n$d)return Xr.ONE;if(to===_1n$f)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$d;)to&_1n$f&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$f;return ro}function FpInvertBatch$1(Xr,eo){const to=new Array(eo.length),ro=eo.reduce((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=io,Xr.mul(io,oo)),Xr.ONE),no=Xr.inv(ro);return eo.reduceRight((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=Xr.mul(io,to[ao]),Xr.mul(io,oo)),no),to}function nLength$2(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function Field$2(Xr,eo,to=!1,ro={}){if(Xr<=_0n$d)throw new Error(`Expected Field ORDER > 0, got ${Xr}`);const{nBitLength:no,nByteLength:io}=nLength$2(Xr,eo);if(io>2048)throw new Error("Field lengths over 2048 bytes are not supported");const oo=FpSqrt$1(Xr),ao=Object.freeze({ORDER:Xr,BITS:no,BYTES:io,MASK:bitMask$2(no),ZERO:_0n$d,ONE:_1n$f,create:so=>mod$2(so,Xr),isValid:so=>{if(typeof so!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof so}`);return _0n$d<=so&&soso===_0n$d,isOdd:so=>(so&_1n$f)===_1n$f,neg:so=>mod$2(-so,Xr),eql:(so,co)=>so===co,sqr:so=>mod$2(so*so,Xr),add:(so,co)=>mod$2(so+co,Xr),sub:(so,co)=>mod$2(so-co,Xr),mul:(so,co)=>mod$2(so*co,Xr),pow:(so,co)=>FpPow$2(ao,so,co),div:(so,co)=>mod$2(so*invert$2(co,Xr),Xr),sqrN:so=>so*so,addN:(so,co)=>so+co,subN:(so,co)=>so-co,mulN:(so,co)=>so*co,inv:so=>invert$2(so,Xr),sqrt:ro.sqrt||(so=>oo(ao,so)),invertBatch:so=>FpInvertBatch$1(ao,so),cmov:(so,co,lo)=>lo?co:so,toBytes:so=>to?numberToBytesLE$2(so,io):numberToBytesBE$2(so,io),fromBytes:so=>{if(so.length!==io)throw new Error(`Fp.fromBytes: expected ${io}, got ${so.length}`);return to?bytesToNumberLE$2(so):bytesToNumberBE$2(so)}});return Object.freeze(ao)}function getFieldBytesLength$2(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength$2(Xr){const eo=getFieldBytesLength$2(Xr);return eo+Math.ceil(eo/2)}function mapHashToField$2(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength$2(eo),io=getMinHashLength$2(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE$2(Xr):bytesToNumberLE$2(Xr),ao=mod$2(oo,eo-_1n$f)+_1n$f;return to?numberToBytesLE$2(ao,no):numberToBytesBE$2(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$c=BigInt(0),_1n$e=BigInt(1),pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function wNAF$2(Xr,eo){const to=(io,oo)=>{const ao=oo.negate();return io?ao:oo},ro=io=>{if(!Number.isSafeInteger(io)||io<=0||io>eo)throw new Error(`Wrong window size=${io}, should be [1..${eo}]`)},no=io=>{ro(io);const oo=Math.ceil(eo/io)+1,ao=2**(io-1);return{windows:oo,windowSize:ao}};return{constTimeNegate:to,unsafeLadder(io,oo){let ao=Xr.ZERO,so=io;for(;oo>_0n$c;)oo&_1n$e&&(ao=ao.add(so)),so=so.double(),oo>>=_1n$e;return ao},precomputeWindow(io,oo){const{windows:ao,windowSize:so}=no(oo),co=[];let lo=io,fo=lo;for(let ho=0;ho>=yo,Eo>co&&(Eo-=go,ao+=_1n$e);const ko=wo,Ao=wo+Math.abs(Eo)-1,Po=vo%2!==0,jo=Eo<0;Eo===0?fo=fo.add(to(Po,oo[ko])):lo=lo.add(to(jo,oo[Ao]))}return{p:lo,f:fo}},wNAFCached(io,oo,ao){const so=pointWindowSizes.get(io)||1;let co=pointPrecomputes.get(io);return co||(co=this.precomputeWindow(io,so),so!==1&&pointPrecomputes.set(io,ao(co))),this.wNAF(so,co,oo)},setWindowSize(io,oo){ro(oo),pointWindowSizes.set(io,oo),pointPrecomputes.delete(io)}}}function pippenger(Xr,eo,to,ro){if(!Array.isArray(to)||!Array.isArray(ro)||ro.length!==to.length)throw new Error("arrays of points and scalars must have equal length");ro.forEach((lo,fo)=>{if(!eo.isValid(lo))throw new Error(`wrong scalar at index ${fo}`)}),to.forEach((lo,fo)=>{if(!(lo instanceof Xr))throw new Error(`wrong point at index ${fo}`)});const no=bitLen$2(BigInt(to.length)),io=no>12?no-3:no>4?no-2:no?2:1,oo=(1<=0;lo-=io){ao.fill(Xr.ZERO);for(let ho=0;ho>BigInt(lo)&BigInt(oo));ao[yo]=ao[yo].add(to[ho])}let fo=Xr.ZERO;for(let ho=ao.length-1,go=Xr.ZERO;ho>0;ho--)go=go.add(ao[ho]),fo=fo.add(go);if(co=co.add(fo),lo!==0)for(let ho=0;ho{const{Err:to}=DER$2;if(Xr<0||Xr>256)throw new to("tlv.encode: wrong tag");if(eo.length&1)throw new to("tlv.encode: unpadded data");const ro=eo.length/2,no=numberToHexUnpadded$2(ro);if(no.length/2&128)throw new to("tlv.encode: long form length too big");const io=ro>127?numberToHexUnpadded$2(no.length/2|128):"";return`${numberToHexUnpadded$2(Xr)}${io}${no}${eo}`},decode(Xr,eo){const{Err:to}=DER$2;let ro=0;if(Xr<0||Xr>256)throw new to("tlv.encode: wrong tag");if(eo.length<2||eo[ro++]!==Xr)throw new to("tlv.decode: wrong tlv");const no=eo[ro++],io=!!(no&128);let oo=0;if(!io)oo=no;else{const so=no&127;if(!so)throw new to("tlv.decode(long): indefinite length not supported");if(so>4)throw new to("tlv.decode(long): byte length is too big");const co=eo.subarray(ro,ro+so);if(co.length!==so)throw new to("tlv.decode: length bytes not complete");if(co[0]===0)throw new to("tlv.decode(long): zero leftmost byte");for(const lo of co)oo=oo<<8|lo;if(ro+=so,oo<128)throw new to("tlv.decode(long): not minimal encoding")}const ao=eo.subarray(ro,ro+oo);if(ao.length!==oo)throw new to("tlv.decode: wrong value length");return{v:ao,l:eo.subarray(ro+oo)}}},_int:{encode(Xr){const{Err:eo}=DER$2;if(Xr<_0n$b)throw new eo("integer: negative integers are not allowed");let to=numberToHexUnpadded$2(Xr);if(Number.parseInt(to[0],16)&8&&(to="00"+to),to.length&1)throw new eo("unexpected assertion");return to},decode(Xr){const{Err:eo}=DER$2;if(Xr[0]&128)throw new eo("Invalid signature integer: negative");if(Xr[0]===0&&!(Xr[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return b2n$2(Xr)}},toSig(Xr){const{Err:eo,_int:to,_tlv:ro}=DER$2,no=typeof Xr=="string"?h2b$2(Xr):Xr;abytes(no);const{v:io,l:oo}=ro.decode(48,no);if(oo.length)throw new eo("Invalid signature: left bytes after parsing");const{v:ao,l:so}=ro.decode(2,io),{v:co,l:lo}=ro.decode(2,so);if(lo.length)throw new eo("Invalid signature: left bytes after parsing");return{r:to.decode(ao),s:to.decode(co)}},hexFromSig(Xr){const{_tlv:eo,_int:to}=DER$2,ro=`${eo.encode(2,to.encode(Xr.r))}${eo.encode(2,to.encode(Xr.s))}`;return eo.encode(48,ro)}},_0n$b=BigInt(0),_1n$d=BigInt(1);BigInt(2);const _3n$3=BigInt(3);BigInt(4);function weierstrassPoints$2(Xr){const eo=validatePointOpts$2(Xr),{Fp:to}=eo,ro=Field$2(eo.n,eo.nBitLength),no=eo.toBytes||((vo,wo,Eo)=>{const ko=wo.toAffine();return concatBytes$4(Uint8Array.from([4]),to.toBytes(ko.x),to.toBytes(ko.y))}),io=eo.fromBytes||(vo=>{const wo=vo.subarray(1),Eo=to.fromBytes(wo.subarray(0,to.BYTES)),ko=to.fromBytes(wo.subarray(to.BYTES,2*to.BYTES));return{x:Eo,y:ko}});function oo(vo){const{a:wo,b:Eo}=eo,ko=to.sqr(vo),Ao=to.mul(ko,vo);return to.add(to.add(Ao,to.mul(vo,wo)),Eo)}if(!to.eql(to.sqr(eo.Gy),oo(eo.Gx)))throw new Error("bad generator point: equation left != right");function ao(vo){return inRange$1(vo,_1n$d,eo.n)}function so(vo){const{allowedPrivateKeyLengths:wo,nByteLength:Eo,wrapPrivateKey:ko,n:Ao}=eo;if(wo&&typeof vo!="bigint"){if(isBytes$4(vo)&&(vo=bytesToHex$3(vo)),typeof vo!="string"||!wo.includes(vo.length))throw new Error("Invalid key");vo=vo.padStart(Eo*2,"0")}let Po;try{Po=typeof vo=="bigint"?vo:bytesToNumberBE$2(ensureBytes$3("private key",vo,Eo))}catch{throw new Error(`private key must be ${Eo} bytes, hex or bigint, not ${typeof vo}`)}return ko&&(Po=mod$2(Po,Ao)),aInRange("private key",Po,_1n$d,Ao),Po}function co(vo){if(!(vo instanceof ho))throw new Error("ProjectivePoint expected")}const lo=memoized((vo,wo)=>{const{px:Eo,py:ko,pz:Ao}=vo;if(to.eql(Ao,to.ONE))return{x:Eo,y:ko};const Po=vo.is0();wo==null&&(wo=Po?to.ONE:to.inv(Ao));const jo=to.mul(Eo,wo),Mo=to.mul(ko,wo),No=to.mul(Ao,wo);if(Po)return{x:to.ZERO,y:to.ZERO};if(!to.eql(No,to.ONE))throw new Error("invZ was invalid");return{x:jo,y:Mo}}),fo=memoized(vo=>{if(vo.is0()){if(eo.allowInfinityPoint&&!to.is0(vo.py))return;throw new Error("bad point: ZERO")}const{x:wo,y:Eo}=vo.toAffine();if(!to.isValid(wo)||!to.isValid(Eo))throw new Error("bad point: x or y not FE");const ko=to.sqr(Eo),Ao=oo(wo);if(!to.eql(ko,Ao))throw new Error("bad point: equation left != right");if(!vo.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ho{constructor(wo,Eo,ko){if(this.px=wo,this.py=Eo,this.pz=ko,wo==null||!to.isValid(wo))throw new Error("x required");if(Eo==null||!to.isValid(Eo))throw new Error("y required");if(ko==null||!to.isValid(ko))throw new Error("z required");Object.freeze(this)}static fromAffine(wo){const{x:Eo,y:ko}=wo||{};if(!wo||!to.isValid(Eo)||!to.isValid(ko))throw new Error("invalid affine point");if(wo instanceof ho)throw new Error("projective point not allowed");const Ao=Po=>to.eql(Po,to.ZERO);return Ao(Eo)&&Ao(ko)?ho.ZERO:new ho(Eo,ko,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(wo){const Eo=to.invertBatch(wo.map(ko=>ko.pz));return wo.map((ko,Ao)=>ko.toAffine(Eo[Ao])).map(ho.fromAffine)}static fromHex(wo){const Eo=ho.fromAffine(io(ensureBytes$3("pointHex",wo)));return Eo.assertValidity(),Eo}static fromPrivateKey(wo){return ho.BASE.multiply(so(wo))}static msm(wo,Eo){return pippenger(ho,ro,wo,Eo)}_setWindowSize(wo){yo.setWindowSize(this,wo)}assertValidity(){fo(this)}hasEvenY(){const{y:wo}=this.toAffine();if(to.isOdd)return!to.isOdd(wo);throw new Error("Field doesn't support isOdd")}equals(wo){co(wo);const{px:Eo,py:ko,pz:Ao}=this,{px:Po,py:jo,pz:Mo}=wo,No=to.eql(to.mul(Eo,Mo),to.mul(Po,Ao)),Do=to.eql(to.mul(ko,Mo),to.mul(jo,Ao));return No&&Do}negate(){return new ho(this.px,to.neg(this.py),this.pz)}double(){const{a:wo,b:Eo}=eo,ko=to.mul(Eo,_3n$3),{px:Ao,py:Po,pz:jo}=this;let Mo=to.ZERO,No=to.ZERO,Do=to.ZERO,Fo=to.mul(Ao,Ao),Xo=to.mul(Po,Po),Lo=to.mul(jo,jo),Bo=to.mul(Ao,Po);return Bo=to.add(Bo,Bo),Do=to.mul(Ao,jo),Do=to.add(Do,Do),Mo=to.mul(wo,Do),No=to.mul(ko,Lo),No=to.add(Mo,No),Mo=to.sub(Xo,No),No=to.add(Xo,No),No=to.mul(Mo,No),Mo=to.mul(Bo,Mo),Do=to.mul(ko,Do),Lo=to.mul(wo,Lo),Bo=to.sub(Fo,Lo),Bo=to.mul(wo,Bo),Bo=to.add(Bo,Do),Do=to.add(Fo,Fo),Fo=to.add(Do,Fo),Fo=to.add(Fo,Lo),Fo=to.mul(Fo,Bo),No=to.add(No,Fo),Lo=to.mul(Po,jo),Lo=to.add(Lo,Lo),Fo=to.mul(Lo,Bo),Mo=to.sub(Mo,Fo),Do=to.mul(Lo,Xo),Do=to.add(Do,Do),Do=to.add(Do,Do),new ho(Mo,No,Do)}add(wo){co(wo);const{px:Eo,py:ko,pz:Ao}=this,{px:Po,py:jo,pz:Mo}=wo;let No=to.ZERO,Do=to.ZERO,Fo=to.ZERO;const Xo=eo.a,Lo=to.mul(eo.b,_3n$3);let Bo=to.mul(Eo,Po),xo=to.mul(ko,jo),uo=to.mul(Ao,Mo),po=to.add(Eo,ko),bo=to.add(Po,jo);po=to.mul(po,bo),bo=to.add(Bo,xo),po=to.sub(po,bo),bo=to.add(Eo,Ao);let _o=to.add(Po,Mo);return bo=to.mul(bo,_o),_o=to.add(Bo,uo),bo=to.sub(bo,_o),_o=to.add(ko,Ao),No=to.add(jo,Mo),_o=to.mul(_o,No),No=to.add(xo,uo),_o=to.sub(_o,No),Fo=to.mul(Xo,bo),No=to.mul(Lo,uo),Fo=to.add(No,Fo),No=to.sub(xo,Fo),Fo=to.add(xo,Fo),Do=to.mul(No,Fo),xo=to.add(Bo,Bo),xo=to.add(xo,Bo),uo=to.mul(Xo,uo),bo=to.mul(Lo,bo),xo=to.add(xo,uo),uo=to.sub(Bo,uo),uo=to.mul(Xo,uo),bo=to.add(bo,uo),Bo=to.mul(xo,bo),Do=to.add(Do,Bo),Bo=to.mul(_o,bo),No=to.mul(po,No),No=to.sub(No,Bo),Bo=to.mul(po,xo),Fo=to.mul(_o,Fo),Fo=to.add(Fo,Bo),new ho(No,Do,Fo)}subtract(wo){return this.add(wo.negate())}is0(){return this.equals(ho.ZERO)}wNAF(wo){return yo.wNAFCached(this,wo,ho.normalizeZ)}multiplyUnsafe(wo){aInRange("scalar",wo,_0n$b,eo.n);const Eo=ho.ZERO;if(wo===_0n$b)return Eo;if(wo===_1n$d)return this;const{endo:ko}=eo;if(!ko)return yo.unsafeLadder(this,wo);let{k1neg:Ao,k1:Po,k2neg:jo,k2:Mo}=ko.splitScalar(wo),No=Eo,Do=Eo,Fo=this;for(;Po>_0n$b||Mo>_0n$b;)Po&_1n$d&&(No=No.add(Fo)),Mo&_1n$d&&(Do=Do.add(Fo)),Fo=Fo.double(),Po>>=_1n$d,Mo>>=_1n$d;return Ao&&(No=No.negate()),jo&&(Do=Do.negate()),Do=new ho(to.mul(Do.px,ko.beta),Do.py,Do.pz),No.add(Do)}multiply(wo){const{endo:Eo,n:ko}=eo;aInRange("scalar",wo,_1n$d,ko);let Ao,Po;if(Eo){const{k1neg:jo,k1:Mo,k2neg:No,k2:Do}=Eo.splitScalar(wo);let{p:Fo,f:Xo}=this.wNAF(Mo),{p:Lo,f:Bo}=this.wNAF(Do);Fo=yo.constTimeNegate(jo,Fo),Lo=yo.constTimeNegate(No,Lo),Lo=new ho(to.mul(Lo.px,Eo.beta),Lo.py,Lo.pz),Ao=Fo.add(Lo),Po=Xo.add(Bo)}else{const{p:jo,f:Mo}=this.wNAF(wo);Ao=jo,Po=Mo}return ho.normalizeZ([Ao,Po])[0]}multiplyAndAddUnsafe(wo,Eo,ko){const Ao=ho.BASE,Po=(Mo,No)=>No===_0n$b||No===_1n$d||!Mo.equals(Ao)?Mo.multiplyUnsafe(No):Mo.multiply(No),jo=Po(this,Eo).add(Po(wo,ko));return jo.is0()?void 0:jo}toAffine(wo){return lo(this,wo)}isTorsionFree(){const{h:wo,isTorsionFree:Eo}=eo;if(wo===_1n$d)return!0;if(Eo)return Eo(ho,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:wo,clearCofactor:Eo}=eo;return wo===_1n$d?this:Eo?Eo(ho,this):this.multiplyUnsafe(eo.h)}toRawBytes(wo=!0){return abool("isCompressed",wo),this.assertValidity(),no(ho,this,wo)}toHex(wo=!0){return abool("isCompressed",wo),bytesToHex$3(this.toRawBytes(wo))}}ho.BASE=new ho(eo.Gx,eo.Gy,to.ONE),ho.ZERO=new ho(to.ZERO,to.ONE,to.ZERO);const go=eo.nBitLength,yo=wNAF$2(ho,eo.endo?Math.ceil(go/2):go);return{CURVE:eo,ProjectivePoint:ho,normPrivateKeyToScalar:so,weierstrassEquation:oo,isWithinCurveOrder:ao}}function validateOpts$5(Xr){const eo=validateBasic$2(Xr);return validateObject$2(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass$3(Xr){const eo=validateOpts$5(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(uo){return mod$2(uo,ro)}function ao(uo){return invert$2(uo,ro)}const{ProjectivePoint:so,normPrivateKeyToScalar:co,weierstrassEquation:lo,isWithinCurveOrder:fo}=weierstrassPoints$2({...eo,toBytes(uo,po,bo){const _o=po.toAffine(),$o=to.toBytes(_o.x),Co=concatBytes$4;return abool("isCompressed",bo),bo?Co(Uint8Array.from([po.hasEvenY()?2:3]),$o):Co(Uint8Array.from([4]),$o,to.toBytes(_o.y))},fromBytes(uo){const po=uo.length,bo=uo[0],_o=uo.subarray(1);if(po===no&&(bo===2||bo===3)){const $o=bytesToNumberBE$2(_o);if(!inRange$1($o,_1n$d,to.ORDER))throw new Error("Point is not on curve");const Co=lo($o);let Ro;try{Ro=to.sqrt(Co)}catch(To){const Vo=To instanceof Error?": "+To.message:"";throw new Error("Point is not on curve"+Vo)}const So=(Ro&_1n$d)===_1n$d;return(bo&1)===1!==So&&(Ro=to.neg(Ro)),{x:$o,y:Ro}}else if(po===io&&bo===4){const $o=to.fromBytes(_o.subarray(0,to.BYTES)),Co=to.fromBytes(_o.subarray(to.BYTES,2*to.BYTES));return{x:$o,y:Co}}else throw new Error(`Point of length ${po} was invalid. Expected ${no} compressed bytes or ${io} uncompressed bytes`)}}),ho=uo=>bytesToHex$3(numberToBytesBE$2(uo,eo.nByteLength));function go(uo){const po=ro>>_1n$d;return uo>po}function yo(uo){return go(uo)?oo(-uo):uo}const vo=(uo,po,bo)=>bytesToNumberBE$2(uo.slice(po,bo));class wo{constructor(po,bo,_o){this.r=po,this.s=bo,this.recovery=_o,this.assertValidity()}static fromCompact(po){const bo=eo.nByteLength;return po=ensureBytes$3("compactSignature",po,bo*2),new wo(vo(po,0,bo),vo(po,bo,2*bo))}static fromDER(po){const{r:bo,s:_o}=DER$2.toSig(ensureBytes$3("DER",po));return new wo(bo,_o)}assertValidity(){aInRange("r",this.r,_1n$d,ro),aInRange("s",this.s,_1n$d,ro)}addRecoveryBit(po){return new wo(this.r,this.s,po)}recoverPublicKey(po){const{r:bo,s:_o,recovery:$o}=this,Co=Mo(ensureBytes$3("msgHash",po));if($o==null||![0,1,2,3].includes($o))throw new Error("recovery id invalid");const Ro=$o===2||$o===3?bo+eo.n:bo;if(Ro>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const So=$o&1?"03":"02",mo=so.fromHex(So+ho(Ro)),To=ao(Ro),Vo=oo(-Co*To),Zo=oo(_o*To),Qo=so.BASE.multiplyAndAddUnsafe(mo,Vo,Zo);if(!Qo)throw new Error("point at infinify");return Qo.assertValidity(),Qo}hasHighS(){return go(this.s)}normalizeS(){return this.hasHighS()?new wo(this.r,oo(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$4(this.toDERHex())}toDERHex(){return DER$2.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$4(this.toCompactHex())}toCompactHex(){return ho(this.r)+ho(this.s)}}const Eo={isValidPrivateKey(uo){try{return co(uo),!0}catch{return!1}},normPrivateKeyToScalar:co,randomPrivateKey:()=>{const uo=getMinHashLength$2(eo.n);return mapHashToField$2(eo.randomBytes(uo),eo.n)},precompute(uo=8,po=so.BASE){return po._setWindowSize(uo),po.multiply(BigInt(3)),po}};function ko(uo,po=!0){return so.fromPrivateKey(uo).toRawBytes(po)}function Ao(uo){const po=isBytes$4(uo),bo=typeof uo=="string",_o=(po||bo)&&uo.length;return po?_o===no||_o===io:bo?_o===2*no||_o===2*io:uo instanceof so}function Po(uo,po,bo=!0){if(Ao(uo))throw new Error("first arg must be private key");if(!Ao(po))throw new Error("second arg must be public key");return so.fromHex(po).multiply(co(uo)).toRawBytes(bo)}const jo=eo.bits2int||function(uo){const po=bytesToNumberBE$2(uo),bo=uo.length*8-eo.nBitLength;return bo>0?po>>BigInt(bo):po},Mo=eo.bits2int_modN||function(uo){return oo(jo(uo))},No=bitMask$2(eo.nBitLength);function Do(uo){return aInRange(`num < 2^${eo.nBitLength}`,uo,_0n$b,No),numberToBytesBE$2(uo,eo.nByteLength)}function Fo(uo,po,bo=Xo){if(["recovered","canonical"].some(Ho=>Ho in bo))throw new Error("sign() legacy options not supported");const{hash:_o,randomBytes:$o}=eo;let{lowS:Co,prehash:Ro,extraEntropy:So}=bo;Co==null&&(Co=!0),uo=ensureBytes$3("msgHash",uo),validateSigVerOpts(bo),Ro&&(uo=ensureBytes$3("prehashed msgHash",_o(uo)));const mo=Mo(uo),To=co(po),Vo=[Do(To),Do(mo)];if(So!=null&&So!==!1){const Ho=So===!0?$o(to.BYTES):So;Vo.push(ensureBytes$3("extraEntropy",Ho))}const Zo=concatBytes$4(...Vo),Qo=mo;function qo(Ho){const $a=jo(Ho);if(!fo($a))return;const zo=ao($a),Ko=so.BASE.multiply($a).toAffine(),_c=oo(Ko.x);if(_c===_0n$b)return;const Cl=oo(zo*oo(Qo+_c*To));if(Cl===_0n$b)return;let ga=(Ko.x===_c?0:2)|Number(Ko.y&_1n$d),El=Cl;return Co&&go(Cl)&&(El=yo(Cl),ga^=1),new wo(_c,El,ga)}return{seed:Zo,k2sig:qo}}const Xo={lowS:eo.lowS,prehash:!1},Lo={lowS:eo.lowS,prehash:!1};function Bo(uo,po,bo=Xo){const{seed:_o,k2sig:$o}=Fo(uo,po,bo),Co=eo;return createHmacDrbg$2(Co.hash.outputLen,Co.nByteLength,Co.hmac)(_o,$o)}so.BASE._setWindowSize(8);function xo(uo,po,bo,_o=Lo){var Ko;const $o=uo;if(po=ensureBytes$3("msgHash",po),bo=ensureBytes$3("publicKey",bo),"strict"in _o)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(_o);const{lowS:Co,prehash:Ro}=_o;let So,mo;try{if(typeof $o=="string"||isBytes$4($o))try{So=wo.fromDER($o)}catch(_c){if(!(_c instanceof DER$2.Err))throw _c;So=wo.fromCompact($o)}else if(typeof $o=="object"&&typeof $o.r=="bigint"&&typeof $o.s=="bigint"){const{r:_c,s:Cl}=$o;So=new wo(_c,Cl)}else throw new Error("PARSE");mo=so.fromHex(bo)}catch(_c){if(_c.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Co&&So.hasHighS())return!1;Ro&&(po=eo.hash(po));const{r:To,s:Vo}=So,Zo=Mo(po),Qo=ao(Vo),qo=oo(Zo*Qo),Ho=oo(To*Qo),$a=(Ko=so.BASE.multiplyAndAddUnsafe(mo,qo,Ho))==null?void 0:Ko.toAffine();return $a?oo($a.x)===To:!1}return{CURVE:eo,getPublicKey:ko,getSharedSecret:Po,sign:Bo,verify:xo,ProjectivePoint:so,Signature:wo,utils:Eo}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash$1(Xr){return{hash:Xr,hmac:(eo,...to)=>hmac$4(Xr,eo,concatBytes$5(...to)),randomBytes:randomBytes$1}}function createCurve(Xr,eo){const to=ro=>weierstrass$3({...Xr,...getHash$1(ro)});return Object.freeze({...to(eo),create:to})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$c=BigInt(1),_2n$8=BigInt(2),divNearest=(Xr,eo)=>(Xr+eo/_2n$8)/eo;function sqrtMod(Xr){const eo=secp256k1P,to=BigInt(3),ro=BigInt(6),no=BigInt(11),io=BigInt(22),oo=BigInt(23),ao=BigInt(44),so=BigInt(88),co=Xr*Xr*Xr%eo,lo=co*co*Xr%eo,fo=pow2(lo,to,eo)*lo%eo,ho=pow2(fo,to,eo)*lo%eo,go=pow2(ho,_2n$8,eo)*co%eo,yo=pow2(go,no,eo)*go%eo,vo=pow2(yo,io,eo)*yo%eo,wo=pow2(vo,ao,eo)*vo%eo,Eo=pow2(wo,so,eo)*wo%eo,ko=pow2(Eo,ao,eo)*vo%eo,Ao=pow2(ko,to,eo)*lo%eo,Po=pow2(Ao,oo,eo)*yo%eo,jo=pow2(Po,ro,eo)*co%eo,Mo=pow2(jo,_2n$8,eo);if(!Fp$1.eql(Fp$1.sqr(Mo),Xr))throw new Error("Cannot find square root");return Mo}const Fp$1=Field$2(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1$2=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:Xr=>{const eo=secp256k1N,to=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),ro=-_1n$c*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),no=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),io=to,oo=BigInt("0x100000000000000000000000000000000"),ao=divNearest(io*Xr,eo),so=divNearest(-ro*Xr,eo);let co=mod$2(Xr-ao*to-so*no,eo),lo=mod$2(-ao*ro-so*io,eo);const fo=co>oo,ho=lo>oo;if(fo&&(co=eo-co),ho&&(lo=eo-lo),co>oo||lo>oo)throw new Error("splitScalar: Endomorphism failed, k="+Xr);return{k1neg:fo,k1:co,k2neg:ho,k2:lo}}}},sha256_1$4);BigInt(0);secp256k1$2.ProjectivePoint;const secp256k1$3=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:secp256k1$2},Symbol.toStringTag,{value:"Module"}));/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point=secp256k1$2.ProjectivePoint,base58check=createBase58check(sha256_1$4);function bytesToNumber$1(Xr){return BigInt(`0x${bytesToHex$4(Xr)}`)}function numberToBytes$1(Xr){return hexToBytes$5(Xr.toString(16).padStart(64,"0"))}const MASTER_SECRET=utf8ToBytes$4("Bitcoin seed"),BITCOIN_VERSIONS={private:76066276,public:76067358},HARDENED_OFFSET=2147483648,hash160=Xr=>ripemd160_1(sha256_1$4(Xr)),fromU32=Xr=>createView$1(Xr).getUint32(0,!1),toU32=Xr=>{if(!Number.isSafeInteger(Xr)||Xr<0||Xr>2**32-1)throw new Error(`Invalid number=${Xr}. Should be from 0 to 2 ** 32 - 1`);const eo=new Uint8Array(4);return createView$1(eo).setUint32(0,Xr,!1),eo};class HDKey{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const eo=this.privateKey;if(!eo)throw new Error("No private key");return base58check.encode(this.serialize(this.versions.private,concatBytes$5(new Uint8Array([0]),eo)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(eo,to=BITCOIN_VERSIONS){if(bytes$2(eo),8*eo.length<128||8*eo.length>512)throw new Error(`HDKey: wrong seed length=${eo.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const ro=hmac$4(sha512$3,MASTER_SECRET,eo);return new HDKey({versions:to,chainCode:ro.slice(32),privateKey:ro.slice(0,32)})}static fromExtendedKey(eo,to=BITCOIN_VERSIONS){const ro=base58check.decode(eo),no=createView$1(ro),io=no.getUint32(0,!1),oo={versions:to,depth:ro[4],parentFingerprint:no.getUint32(5,!1),index:no.getUint32(9,!1),chainCode:ro.slice(13,45)},ao=ro.slice(45),so=ao[0]===0;if(io!==to[so?"private":"public"])throw new Error("Version mismatch");return so?new HDKey({...oo,privateKey:ao.slice(1)}):new HDKey({...oo,publicKey:ao})}static fromJSON(eo){return HDKey.fromExtendedKey(eo.xpriv)}constructor(eo){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!eo||typeof eo!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=eo.versions||BITCOIN_VERSIONS,this.depth=eo.depth||0,this.chainCode=eo.chainCode||null,this.index=eo.index||0,this.parentFingerprint=eo.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(eo.publicKey&&eo.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(eo.privateKey){if(!secp256k1$2.utils.isValidPrivateKey(eo.privateKey))throw new Error("Invalid private key");this.privKey=typeof eo.privateKey=="bigint"?eo.privateKey:bytesToNumber$1(eo.privateKey),this.privKeyBytes=numberToBytes$1(this.privKey),this.pubKey=secp256k1$2.getPublicKey(eo.privateKey,!0)}else if(eo.publicKey)this.pubKey=Point.fromHex(eo.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160(this.pubKey)}derive(eo){if(!/^[mM]'?/.test(eo))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(eo))return this;const to=eo.replace(/^[mM]'?\//,"").split("/");let ro=this;for(const no of to){const io=/^(\d+)('?)$/.exec(no),oo=io&&io[1];if(!io||io.length!==3||typeof oo!="string")throw new Error(`Invalid child index: ${no}`);let ao=+oo;if(!Number.isSafeInteger(ao)||ao>=HARDENED_OFFSET)throw new Error("Invalid index");io[2]==="'"&&(ao+=HARDENED_OFFSET),ro=ro.deriveChild(ao)}return ro}deriveChild(eo){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let to=toU32(eo);if(eo>=HARDENED_OFFSET){const ao=this.privateKey;if(!ao)throw new Error("Could not derive hardened child key");to=concatBytes$5(new Uint8Array([0]),ao,to)}else to=concatBytes$5(this.pubKey,to);const ro=hmac$4(sha512$3,this.chainCode,to),no=bytesToNumber$1(ro.slice(0,32)),io=ro.slice(32);if(!secp256k1$2.utils.isValidPrivateKey(no))throw new Error("Tweak bigger than curve order");const oo={versions:this.versions,chainCode:io,depth:this.depth+1,parentFingerprint:this.fingerprint,index:eo};try{if(this.privateKey){const ao=mod$2(this.privKey+no,secp256k1$2.CURVE.n);if(!secp256k1$2.utils.isValidPrivateKey(ao))throw new Error("The tweak was out of range or the resulted private key is invalid");oo.privateKey=ao}else{const ao=Point.fromHex(this.pubKey).add(Point.fromPrivateKey(no));if(ao.equals(Point.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");oo.publicKey=ao.toRawBytes(!0)}return new HDKey(oo)}catch{return this.deriveChild(eo+1)}}sign(eo){if(!this.privateKey)throw new Error("No privateKey set!");return bytes$2(eo,32),secp256k1$2.sign(eo,this.privKey).toCompactRawBytes()}verify(eo,to){if(bytes$2(eo,32),bytes$2(to,64),!this.publicKey)throw new Error("No publicKey set!");let ro;try{ro=secp256k1$2.Signature.fromCompact(to)}catch{return!1}return secp256k1$2.verify(ro,eo,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(eo,to){if(!this.chainCode)throw new Error("No chainCode set");return bytes$2(to,33),concatBytes$5(toU32(eo),new Uint8Array([this.depth]),toU32(this.parentFingerprint),toU32(this.index),this.chainCode,to)}}const getRandomElement=Xr=>{if(Xr.length===0)throw new Error("Array cannot be empty");const eo=Math.floor(Math.random()*Xr.length);return Xr[eo]};function getDefaultExportFromCjs$1(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}var browser$j={exports:{}},process$1=browser$j.exports={},cachedSetTimeout$1,cachedClearTimeout$1;function defaultSetTimout$1(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout$1(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout$1=setTimeout:cachedSetTimeout$1=defaultSetTimout$1}catch{cachedSetTimeout$1=defaultSetTimout$1}try{typeof clearTimeout=="function"?cachedClearTimeout$1=clearTimeout:cachedClearTimeout$1=defaultClearTimeout$1}catch{cachedClearTimeout$1=defaultClearTimeout$1}})();function runTimeout$1(Xr){if(cachedSetTimeout$1===setTimeout)return setTimeout(Xr,0);if((cachedSetTimeout$1===defaultSetTimout$1||!cachedSetTimeout$1)&&setTimeout)return cachedSetTimeout$1=setTimeout,setTimeout(Xr,0);try{return cachedSetTimeout$1(Xr,0)}catch{try{return cachedSetTimeout$1.call(null,Xr,0)}catch{return cachedSetTimeout$1.call(this,Xr,0)}}}function runClearTimeout$1(Xr){if(cachedClearTimeout$1===clearTimeout)return clearTimeout(Xr);if((cachedClearTimeout$1===defaultClearTimeout$1||!cachedClearTimeout$1)&&clearTimeout)return cachedClearTimeout$1=clearTimeout,clearTimeout(Xr);try{return cachedClearTimeout$1(Xr)}catch{try{return cachedClearTimeout$1.call(null,Xr)}catch{return cachedClearTimeout$1.call(this,Xr)}}}var queue$1=[],draining$1=!1,currentQueue$1,queueIndex$1=-1;function cleanUpNextTick$1(){!draining$1||!currentQueue$1||(draining$1=!1,currentQueue$1.length?queue$1=currentQueue$1.concat(queue$1):queueIndex$1=-1,queue$1.length&&drainQueue$1())}function drainQueue$1(){if(!draining$1){var Xr=runTimeout$1(cleanUpNextTick$1);draining$1=!0;for(var eo=queue$1.length;eo;){for(currentQueue$1=queue$1,queue$1=[];++queueIndex$11)for(var to=1;toeo=>{const to=toString$c.call(eo);return Xr[to]||(Xr[to]=to.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=Xr=>(Xr=Xr.toLowerCase(),eo=>kindOf(eo)===Xr),typeOfTest=Xr=>eo=>typeof eo===Xr,{isArray:isArray$f}=Array,isUndefined=typeOfTest("undefined");function isBuffer$4(Xr){return Xr!==null&&!isUndefined(Xr)&&Xr.constructor!==null&&!isUndefined(Xr.constructor)&&isFunction$6(Xr.constructor.isBuffer)&&Xr.constructor.isBuffer(Xr)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView$1(Xr){let eo;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?eo=ArrayBuffer.isView(Xr):eo=Xr&&Xr.buffer&&isArrayBuffer(Xr.buffer),eo}const isString$5=typeOfTest("string"),isFunction$6=typeOfTest("function"),isNumber$3=typeOfTest("number"),isObject$h=Xr=>Xr!==null&&typeof Xr=="object",isBoolean$1=Xr=>Xr===!0||Xr===!1,isPlainObject$2=Xr=>{if(kindOf(Xr)!=="object")return!1;const eo=getPrototypeOf(Xr);return(eo===null||eo===Object.prototype||Object.getPrototypeOf(eo)===null)&&!(Symbol.toStringTag in Xr)&&!(Symbol.iterator in Xr)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob$1=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=Xr=>isObject$h(Xr)&&isFunction$6(Xr.pipe),isFormData=Xr=>{let eo;return Xr&&(typeof FormData=="function"&&Xr instanceof FormData||isFunction$6(Xr.append)&&((eo=kindOf(Xr))==="formdata"||eo==="object"&&isFunction$6(Xr.toString)&&Xr.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$2=Xr=>Xr.trim?Xr.trim():Xr.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(Xr,eo,{allOwnKeys:to=!1}={}){if(Xr===null||typeof Xr>"u")return;let ro,no;if(typeof Xr!="object"&&(Xr=[Xr]),isArray$f(Xr))for(ro=0,no=Xr.length;ro0;)if(no=to[ro],eo===no.toLowerCase())return no;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=Xr=>!isUndefined(Xr)&&Xr!==_global;function merge(){const{caseless:Xr}=isContextDefined(this)&&this||{},eo={},to=(ro,no)=>{const io=Xr&&findKey(eo,no)||no;isPlainObject$2(eo[io])&&isPlainObject$2(ro)?eo[io]=merge(eo[io],ro):isPlainObject$2(ro)?eo[io]=merge({},ro):isArray$f(ro)?eo[io]=ro.slice():eo[io]=ro};for(let ro=0,no=arguments.length;ro(forEach$1(eo,(no,io)=>{to&&isFunction$6(no)?Xr[io]=bind$1(no,to):Xr[io]=no},{allOwnKeys:ro}),Xr),stripBOM=Xr=>(Xr.charCodeAt(0)===65279&&(Xr=Xr.slice(1)),Xr),inherits=(Xr,eo,to,ro)=>{Xr.prototype=Object.create(eo.prototype,ro),Xr.prototype.constructor=Xr,Object.defineProperty(Xr,"super",{value:eo.prototype}),to&&Object.assign(Xr.prototype,to)},toFlatObject=(Xr,eo,to,ro)=>{let no,io,oo;const ao={};if(eo=eo||{},Xr==null)return eo;do{for(no=Object.getOwnPropertyNames(Xr),io=no.length;io-- >0;)oo=no[io],(!ro||ro(oo,Xr,eo))&&!ao[oo]&&(eo[oo]=Xr[oo],ao[oo]=!0);Xr=to!==!1&&getPrototypeOf(Xr)}while(Xr&&(!to||to(Xr,eo))&&Xr!==Object.prototype);return eo},endsWith=(Xr,eo,to)=>{Xr=String(Xr),(to===void 0||to>Xr.length)&&(to=Xr.length),to-=eo.length;const ro=Xr.indexOf(eo,to);return ro!==-1&&ro===to},toArray$2=Xr=>{if(!Xr)return null;if(isArray$f(Xr))return Xr;let eo=Xr.length;if(!isNumber$3(eo))return null;const to=new Array(eo);for(;eo-- >0;)to[eo]=Xr[eo];return to},isTypedArray$5=(Xr=>eo=>Xr&&eo instanceof Xr)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(Xr,eo)=>{const ro=(Xr&&Xr[Symbol.iterator]).call(Xr);let no;for(;(no=ro.next())&&!no.done;){const io=no.value;eo.call(Xr,io[0],io[1])}},matchAll=(Xr,eo)=>{let to;const ro=[];for(;(to=Xr.exec(eo))!==null;)ro.push(to);return ro},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=Xr=>Xr.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(to,ro,no){return ro.toUpperCase()+no}),hasOwnProperty$m=(({hasOwnProperty:Xr})=>(eo,to)=>Xr.call(eo,to))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(Xr,eo)=>{const to=Object.getOwnPropertyDescriptors(Xr),ro={};forEach$1(to,(no,io)=>{let oo;(oo=eo(no,io,Xr))!==!1&&(ro[io]=oo||no)}),Object.defineProperties(Xr,ro)},freezeMethods=Xr=>{reduceDescriptors(Xr,(eo,to)=>{if(isFunction$6(Xr)&&["arguments","caller","callee"].indexOf(to)!==-1)return!1;const ro=Xr[to];if(isFunction$6(ro)){if(eo.enumerable=!1,"writable"in eo){eo.writable=!1;return}eo.set||(eo.set=()=>{throw Error("Can not rewrite read-only method '"+to+"'")})}})},toObjectSet=(Xr,eo)=>{const to={},ro=no=>{no.forEach(io=>{to[io]=!0})};return isArray$f(Xr)?ro(Xr):ro(String(Xr).split(eo)),to},noop$8=()=>{},toFiniteNumber=(Xr,eo)=>Xr!=null&&Number.isFinite(Xr=+Xr)?Xr:eo,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$4={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(Xr=16,eo=ALPHABET$4.ALPHA_DIGIT)=>{let to="";const{length:ro}=eo;for(;Xr--;)to+=eo[Math.random()*ro|0];return to};function isSpecCompliantForm(Xr){return!!(Xr&&isFunction$6(Xr.append)&&Xr[Symbol.toStringTag]==="FormData"&&Xr[Symbol.iterator])}const toJSONObject=Xr=>{const eo=new Array(10),to=(ro,no)=>{if(isObject$h(ro)){if(eo.indexOf(ro)>=0)return;if(!("toJSON"in ro)){eo[no]=ro;const io=isArray$f(ro)?[]:{};return forEach$1(ro,(oo,ao)=>{const so=to(oo,no+1);!isUndefined(so)&&(io[ao]=so)}),eo[no]=void 0,io}}return ro};return to(Xr,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=Xr=>Xr&&(isObject$h(Xr)||isFunction$6(Xr))&&isFunction$6(Xr.then)&&isFunction$6(Xr.catch),_setImmediate=((Xr,eo)=>Xr?setImmediate:eo?((to,ro)=>(_global.addEventListener("message",({source:no,data:io})=>{no===_global&&io===to&&ro.length&&ro.shift()()},!1),no=>{ro.push(no),_global.postMessage(to,"*")}))(`axios@${Math.random()}`,[]):to=>setTimeout(to))(typeof setImmediate=="function",isFunction$6(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process$1$1<"u"&&process$1$1.nextTick||_setImmediate,utils$c={isArray:isArray$f,isArrayBuffer,isBuffer:isBuffer$4,isFormData,isArrayBufferView:isArrayBufferView$1,isString:isString$5,isNumber:isNumber$3,isBoolean:isBoolean$1,isObject:isObject$h,isPlainObject:isPlainObject$2,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob:isBlob$1,isRegExp,isFunction:isFunction$6,isStream,isURLSearchParams,isTypedArray:isTypedArray$5,isFileList,forEach:forEach$1,merge,extend,trim:trim$2,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$2,forEachEntry,matchAll,isHTMLForm,hasOwnProperty:hasOwnProperty$m,hasOwnProp:hasOwnProperty$m,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$8,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET:ALPHABET$4,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};var buffer$2={},base64Js$1={};base64Js$1.byteLength=byteLength$1;base64Js$1.toByteArray=toByteArray$1;base64Js$1.fromByteArray=fromByteArray$1;var lookup$1=[],revLookup$1=[],Arr$1=typeof Uint8Array<"u"?Uint8Array:Array,code$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$8=0,len$1=code$1.length;i$80)throw new Error("Invalid string. Length must be a multiple of 4");var to=Xr.indexOf("=");to===-1&&(to=eo);var ro=to===eo?0:4-to%4;return[to,ro]}function byteLength$1(Xr){var eo=getLens$1(Xr),to=eo[0],ro=eo[1];return(to+ro)*3/4-ro}function _byteLength$1(Xr,eo,to){return(eo+to)*3/4-to}function toByteArray$1(Xr){var eo,to=getLens$1(Xr),ro=to[0],no=to[1],io=new Arr$1(_byteLength$1(Xr,ro,no)),oo=0,ao=no>0?ro-4:ro,so;for(so=0;so>16&255,io[oo++]=eo>>8&255,io[oo++]=eo&255;return no===2&&(eo=revLookup$1[Xr.charCodeAt(so)]<<2|revLookup$1[Xr.charCodeAt(so+1)]>>4,io[oo++]=eo&255),no===1&&(eo=revLookup$1[Xr.charCodeAt(so)]<<10|revLookup$1[Xr.charCodeAt(so+1)]<<4|revLookup$1[Xr.charCodeAt(so+2)]>>2,io[oo++]=eo>>8&255,io[oo++]=eo&255),io}function tripletToBase64$1(Xr){return lookup$1[Xr>>18&63]+lookup$1[Xr>>12&63]+lookup$1[Xr>>6&63]+lookup$1[Xr&63]}function encodeChunk$1(Xr,eo,to){for(var ro,no=[],io=eo;ioao?ao:oo+io));return ro===1?(eo=Xr[to-1],no.push(lookup$1[eo>>2]+lookup$1[eo<<4&63]+"==")):ro===2&&(eo=(Xr[to-2]<<8)+Xr[to-1],no.push(lookup$1[eo>>10]+lookup$1[eo>>4&63]+lookup$1[eo<<2&63]+"=")),no.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(Xr,eo,to,ro,no){var io,oo,ao=no*8-ro-1,so=(1<>1,lo=-7,fo=to?no-1:0,ho=to?-1:1,go=Xr[eo+fo];for(fo+=ho,io=go&(1<<-lo)-1,go>>=-lo,lo+=ao;lo>0;io=io*256+Xr[eo+fo],fo+=ho,lo-=8);for(oo=io&(1<<-lo)-1,io>>=-lo,lo+=ro;lo>0;oo=oo*256+Xr[eo+fo],fo+=ho,lo-=8);if(io===0)io=1-co;else{if(io===so)return oo?NaN:(go?-1:1)*(1/0);oo=oo+Math.pow(2,ro),io=io-co}return(go?-1:1)*oo*Math.pow(2,io-ro)};ieee754.write=function(Xr,eo,to,ro,no,io){var oo,ao,so,co=io*8-no-1,lo=(1<>1,ho=no===23?Math.pow(2,-24)-Math.pow(2,-77):0,go=ro?0:io-1,yo=ro?1:-1,vo=eo<0||eo===0&&1/eo<0?1:0;for(eo=Math.abs(eo),isNaN(eo)||eo===1/0?(ao=isNaN(eo)?1:0,oo=lo):(oo=Math.floor(Math.log(eo)/Math.LN2),eo*(so=Math.pow(2,-oo))<1&&(oo--,so*=2),oo+fo>=1?eo+=ho/so:eo+=ho*Math.pow(2,1-fo),eo*so>=2&&(oo++,so/=2),oo+fo>=lo?(ao=0,oo=lo):oo+fo>=1?(ao=(eo*so-1)*Math.pow(2,no),oo=oo+fo):(ao=eo*Math.pow(2,fo-1)*Math.pow(2,no),oo=0));no>=8;Xr[to+go]=ao&255,go+=yo,ao/=256,no-=8);for(oo=oo<0;Xr[to+go]=oo&255,go+=yo,oo/=256,co-=8);Xr[to+go-yo]|=vo*128};/*! +`);var ripemd160$1={};Object.defineProperty(ripemd160$1,"__esModule",{value:!0});var ripemd160_1=ripemd160$1.ripemd160=ripemd160$1.RIPEMD160=void 0;const _md_js_1$1=_md,utils_js_1$1=utils$e,Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((Xr,eo)=>eo)),Pi$1=Id.map(Xr=>(9*Xr+5)%16);let idxL=[Id],idxR=[Pi$1];for(let Xr=0;Xr<4;Xr++)for(let eo of[idxL,idxR])eo.push(eo[Xr].map(to=>Rho[to]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(Xr=>new Uint8Array(Xr)),shiftsL=idxL.map((Xr,eo)=>Xr.map(to=>shifts[eo][to])),shiftsR=idxR.map((Xr,eo)=>Xr.map(to=>shifts[eo][to])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$a(Xr,eo,to,ro){return Xr===0?eo^to^ro:Xr===1?eo&to|~eo&ro:Xr===2?(eo|~to)^ro:Xr===3?eo&ro|to&~ro:eo^(to|~ro)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends _md_js_1$1.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:eo,h1:to,h2:ro,h3:no,h4:io}=this;return[eo,to,ro,no,io]}set(eo,to,ro,no,io){this.h0=eo|0,this.h1=to|0,this.h2=ro|0,this.h3=no|0,this.h4=io|0}process(eo,to){for(let go=0;go<16;go++,to+=4)R_BUF[go]=eo.getUint32(to,!0);let ro=this.h0|0,no=ro,io=this.h1|0,oo=io,ao=this.h2|0,so=ao,co=this.h3|0,lo=co,uo=this.h4|0,ho=uo;for(let go=0;go<5;go++){const bo=4-go,wo=Kl[go],Eo=Kr[go],$o=idxL[go],Co=idxR[go],Ro=shiftsL[go],Oo=shiftsR[go];for(let jo=0;jo<16;jo++){const Bo=(0,utils_js_1$1.rotl)(ro+f$a(go,io,ao,co)+R_BUF[$o[jo]]+wo,Ro[jo])+uo|0;ro=uo,uo=co,co=(0,utils_js_1$1.rotl)(ao,10)|0,ao=io,io=Bo}for(let jo=0;jo<16;jo++){const Bo=(0,utils_js_1$1.rotl)(no+f$a(bo,oo,so,lo)+R_BUF[Co[jo]]+Eo,Oo[jo])+ho|0;no=ho,ho=lo,lo=(0,utils_js_1$1.rotl)(so,10)|0,so=oo,oo=Bo}}this.set(this.h1+ao+lo|0,this.h2+co+ho|0,this.h3+uo+no|0,this.h4+ro+oo|0,this.h0+io+so|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}ripemd160$1.RIPEMD160=RIPEMD160;ripemd160_1=ripemd160$1.ripemd160=(0,utils_js_1$1.wrapConstructor)(()=>new RIPEMD160);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$e=BigInt(0),_1n$g=BigInt(1),_2n$a=BigInt(2);function isBytes$4(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function abytes(Xr){if(!isBytes$4(Xr))throw new Error("Uint8Array expected")}function abool(Xr,eo){if(typeof eo!="boolean")throw new Error(`${Xr} must be valid boolean, got "${eo}".`)}const hexes$3=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex$3(Xr){abytes(Xr);let eo="";for(let to=0;to=asciis$2._0&&Xr<=asciis$2._9)return Xr-asciis$2._0;if(Xr>=asciis$2._A&&Xr<=asciis$2._F)return Xr-(asciis$2._A-10);if(Xr>=asciis$2._a&&Xr<=asciis$2._f)return Xr-(asciis$2._a-10)}function hexToBytes$4(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;notypeof Xr=="bigint"&&_0n$e<=Xr;function inRange$1(Xr,eo,to){return isPosBig(Xr)&&isPosBig(eo)&&isPosBig(to)&&eo<=Xr&&Xr_0n$e;Xr>>=_1n$g,eo+=1);return eo}function bitGet$2(Xr,eo){return Xr>>BigInt(eo)&_1n$g}function bitSet$2(Xr,eo,to){return Xr|(to?_1n$g:_0n$e)<(_2n$a<new Uint8Array(Xr),u8fr$2=Xr=>Uint8Array.from(Xr);function createHmacDrbg$2(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n$2(Xr),no=u8n$2(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...uo)=>to(no,ro,...uo),so=(uo=u8n$2())=>{no=ao(u8fr$2([0]),uo),ro=ao(),uo.length!==0&&(no=ao(u8fr$2([1]),uo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let uo=0;const ho=[];for(;uo{oo(),so(uo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns$2={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes$4(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject$2(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns$2[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const notImplemented=()=>{throw new Error("not implemented")};function memoized(Xr){const eo=new WeakMap;return(to,...ro)=>{const no=eo.get(to);if(no!==void 0)return no;const io=Xr(to,...ro);return eo.set(to,io),io}}const ut$6=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet:bitGet$2,bitLen:bitLen$2,bitMask:bitMask$2,bitSet:bitSet$2,bytesToHex:bytesToHex$3,bytesToNumberBE:bytesToNumberBE$2,bytesToNumberLE:bytesToNumberLE$2,concatBytes:concatBytes$4,createHmacDrbg:createHmacDrbg$2,ensureBytes:ensureBytes$3,equalBytes:equalBytes$2,hexToBytes:hexToBytes$4,hexToNumber:hexToNumber$3,inRange:inRange$1,isBytes:isBytes$4,memoized,notImplemented,numberToBytesBE:numberToBytesBE$2,numberToBytesLE:numberToBytesLE$2,numberToHexUnpadded:numberToHexUnpadded$2,numberToVarBytesBE:numberToVarBytesBE$2,utf8ToBytes:utf8ToBytes$3,validateObject:validateObject$2},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$d=BigInt(0),_1n$f=BigInt(1),_2n$9=BigInt(2),_3n$4=BigInt(3),_4n$2=BigInt(4),_5n$2=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$2(Xr,eo){const to=Xr%eo;return to>=_0n$d?to:eo+to}function pow$1(Xr,eo,to){if(to<=_0n$d||eo<_0n$d)throw new Error("Expected power/modulo > 0");if(to===_1n$f)return _0n$d;let ro=_1n$f;for(;eo>_0n$d;)eo&_1n$f&&(ro=ro*Xr%to),Xr=Xr*Xr%to,eo>>=_1n$f;return ro}function pow2(Xr,eo,to){let ro=Xr;for(;eo-- >_0n$d;)ro*=ro,ro%=to;return ro}function invert$2(Xr,eo){if(Xr===_0n$d||eo<=_0n$d)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod$2(Xr,eo),ro=eo,no=_0n$d,io=_1n$f;for(;to!==_0n$d;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$f)throw new Error("invert: does not exist");return mod$2(no,eo)}function tonelliShanks$1(Xr){const eo=(Xr-_1n$f)/_2n$9;let to,ro,no;for(to=Xr-_1n$f,ro=0;to%_2n$9===_0n$d;to/=_2n$9,ro++);for(no=_2n$9;no(mod$2(Xr,eo)&_1n$f)===_1n$f,FIELD_FIELDS$2=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField$2(Xr){const eo={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},to=FIELD_FIELDS$2.reduce((ro,no)=>(ro[no]="function",ro),eo);return validateObject$2(Xr,to)}function FpPow$2(Xr,eo,to){if(to<_0n$d)throw new Error("Expected power > 0");if(to===_0n$d)return Xr.ONE;if(to===_1n$f)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$d;)to&_1n$f&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$f;return ro}function FpInvertBatch$1(Xr,eo){const to=new Array(eo.length),ro=eo.reduce((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=io,Xr.mul(io,oo)),Xr.ONE),no=Xr.inv(ro);return eo.reduceRight((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=Xr.mul(io,to[ao]),Xr.mul(io,oo)),no),to}function nLength$2(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function Field$2(Xr,eo,to=!1,ro={}){if(Xr<=_0n$d)throw new Error(`Expected Field ORDER > 0, got ${Xr}`);const{nBitLength:no,nByteLength:io}=nLength$2(Xr,eo);if(io>2048)throw new Error("Field lengths over 2048 bytes are not supported");const oo=FpSqrt$1(Xr),ao=Object.freeze({ORDER:Xr,BITS:no,BYTES:io,MASK:bitMask$2(no),ZERO:_0n$d,ONE:_1n$f,create:so=>mod$2(so,Xr),isValid:so=>{if(typeof so!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof so}`);return _0n$d<=so&&soso===_0n$d,isOdd:so=>(so&_1n$f)===_1n$f,neg:so=>mod$2(-so,Xr),eql:(so,co)=>so===co,sqr:so=>mod$2(so*so,Xr),add:(so,co)=>mod$2(so+co,Xr),sub:(so,co)=>mod$2(so-co,Xr),mul:(so,co)=>mod$2(so*co,Xr),pow:(so,co)=>FpPow$2(ao,so,co),div:(so,co)=>mod$2(so*invert$2(co,Xr),Xr),sqrN:so=>so*so,addN:(so,co)=>so+co,subN:(so,co)=>so-co,mulN:(so,co)=>so*co,inv:so=>invert$2(so,Xr),sqrt:ro.sqrt||(so=>oo(ao,so)),invertBatch:so=>FpInvertBatch$1(ao,so),cmov:(so,co,lo)=>lo?co:so,toBytes:so=>to?numberToBytesLE$2(so,io):numberToBytesBE$2(so,io),fromBytes:so=>{if(so.length!==io)throw new Error(`Fp.fromBytes: expected ${io}, got ${so.length}`);return to?bytesToNumberLE$2(so):bytesToNumberBE$2(so)}});return Object.freeze(ao)}function getFieldBytesLength$2(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength$2(Xr){const eo=getFieldBytesLength$2(Xr);return eo+Math.ceil(eo/2)}function mapHashToField$2(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength$2(eo),io=getMinHashLength$2(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE$2(Xr):bytesToNumberLE$2(Xr),ao=mod$2(oo,eo-_1n$f)+_1n$f;return to?numberToBytesLE$2(ao,no):numberToBytesBE$2(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$c=BigInt(0),_1n$e=BigInt(1),pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function wNAF$2(Xr,eo){const to=(io,oo)=>{const ao=oo.negate();return io?ao:oo},ro=io=>{if(!Number.isSafeInteger(io)||io<=0||io>eo)throw new Error(`Wrong window size=${io}, should be [1..${eo}]`)},no=io=>{ro(io);const oo=Math.ceil(eo/io)+1,ao=2**(io-1);return{windows:oo,windowSize:ao}};return{constTimeNegate:to,unsafeLadder(io,oo){let ao=Xr.ZERO,so=io;for(;oo>_0n$c;)oo&_1n$e&&(ao=ao.add(so)),so=so.double(),oo>>=_1n$e;return ao},precomputeWindow(io,oo){const{windows:ao,windowSize:so}=no(oo),co=[];let lo=io,uo=lo;for(let ho=0;ho>=bo,$o>co&&($o-=go,ao+=_1n$e);const Co=Eo,Ro=Eo+Math.abs($o)-1,Oo=wo%2!==0,jo=$o<0;$o===0?uo=uo.add(to(Oo,oo[Co])):lo=lo.add(to(jo,oo[Ro]))}return{p:lo,f:uo}},wNAFCached(io,oo,ao){const so=pointWindowSizes.get(io)||1;let co=pointPrecomputes.get(io);return co||(co=this.precomputeWindow(io,so),so!==1&&pointPrecomputes.set(io,ao(co))),this.wNAF(so,co,oo)},setWindowSize(io,oo){ro(oo),pointWindowSizes.set(io,oo),pointPrecomputes.delete(io)}}}function pippenger(Xr,eo,to,ro){if(!Array.isArray(to)||!Array.isArray(ro)||ro.length!==to.length)throw new Error("arrays of points and scalars must have equal length");ro.forEach((lo,uo)=>{if(!eo.isValid(lo))throw new Error(`wrong scalar at index ${uo}`)}),to.forEach((lo,uo)=>{if(!(lo instanceof Xr))throw new Error(`wrong point at index ${uo}`)});const no=bitLen$2(BigInt(to.length)),io=no>12?no-3:no>4?no-2:no?2:1,oo=(1<=0;lo-=io){ao.fill(Xr.ZERO);for(let ho=0;ho>BigInt(lo)&BigInt(oo));ao[bo]=ao[bo].add(to[ho])}let uo=Xr.ZERO;for(let ho=ao.length-1,go=Xr.ZERO;ho>0;ho--)go=go.add(ao[ho]),uo=uo.add(go);if(co=co.add(uo),lo!==0)for(let ho=0;ho{const{Err:to}=DER$2;if(Xr<0||Xr>256)throw new to("tlv.encode: wrong tag");if(eo.length&1)throw new to("tlv.encode: unpadded data");const ro=eo.length/2,no=numberToHexUnpadded$2(ro);if(no.length/2&128)throw new to("tlv.encode: long form length too big");const io=ro>127?numberToHexUnpadded$2(no.length/2|128):"";return`${numberToHexUnpadded$2(Xr)}${io}${no}${eo}`},decode(Xr,eo){const{Err:to}=DER$2;let ro=0;if(Xr<0||Xr>256)throw new to("tlv.encode: wrong tag");if(eo.length<2||eo[ro++]!==Xr)throw new to("tlv.decode: wrong tlv");const no=eo[ro++],io=!!(no&128);let oo=0;if(!io)oo=no;else{const so=no&127;if(!so)throw new to("tlv.decode(long): indefinite length not supported");if(so>4)throw new to("tlv.decode(long): byte length is too big");const co=eo.subarray(ro,ro+so);if(co.length!==so)throw new to("tlv.decode: length bytes not complete");if(co[0]===0)throw new to("tlv.decode(long): zero leftmost byte");for(const lo of co)oo=oo<<8|lo;if(ro+=so,oo<128)throw new to("tlv.decode(long): not minimal encoding")}const ao=eo.subarray(ro,ro+oo);if(ao.length!==oo)throw new to("tlv.decode: wrong value length");return{v:ao,l:eo.subarray(ro+oo)}}},_int:{encode(Xr){const{Err:eo}=DER$2;if(Xr<_0n$b)throw new eo("integer: negative integers are not allowed");let to=numberToHexUnpadded$2(Xr);if(Number.parseInt(to[0],16)&8&&(to="00"+to),to.length&1)throw new eo("unexpected assertion");return to},decode(Xr){const{Err:eo}=DER$2;if(Xr[0]&128)throw new eo("Invalid signature integer: negative");if(Xr[0]===0&&!(Xr[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return b2n$2(Xr)}},toSig(Xr){const{Err:eo,_int:to,_tlv:ro}=DER$2,no=typeof Xr=="string"?h2b$2(Xr):Xr;abytes(no);const{v:io,l:oo}=ro.decode(48,no);if(oo.length)throw new eo("Invalid signature: left bytes after parsing");const{v:ao,l:so}=ro.decode(2,io),{v:co,l:lo}=ro.decode(2,so);if(lo.length)throw new eo("Invalid signature: left bytes after parsing");return{r:to.decode(ao),s:to.decode(co)}},hexFromSig(Xr){const{_tlv:eo,_int:to}=DER$2,ro=`${eo.encode(2,to.encode(Xr.r))}${eo.encode(2,to.encode(Xr.s))}`;return eo.encode(48,ro)}},_0n$b=BigInt(0),_1n$d=BigInt(1);BigInt(2);const _3n$3=BigInt(3);BigInt(4);function weierstrassPoints$2(Xr){const eo=validatePointOpts$2(Xr),{Fp:to}=eo,ro=Field$2(eo.n,eo.nBitLength),no=eo.toBytes||((wo,Eo,$o)=>{const Co=Eo.toAffine();return concatBytes$4(Uint8Array.from([4]),to.toBytes(Co.x),to.toBytes(Co.y))}),io=eo.fromBytes||(wo=>{const Eo=wo.subarray(1),$o=to.fromBytes(Eo.subarray(0,to.BYTES)),Co=to.fromBytes(Eo.subarray(to.BYTES,2*to.BYTES));return{x:$o,y:Co}});function oo(wo){const{a:Eo,b:$o}=eo,Co=to.sqr(wo),Ro=to.mul(Co,wo);return to.add(to.add(Ro,to.mul(wo,Eo)),$o)}if(!to.eql(to.sqr(eo.Gy),oo(eo.Gx)))throw new Error("bad generator point: equation left != right");function ao(wo){return inRange$1(wo,_1n$d,eo.n)}function so(wo){const{allowedPrivateKeyLengths:Eo,nByteLength:$o,wrapPrivateKey:Co,n:Ro}=eo;if(Eo&&typeof wo!="bigint"){if(isBytes$4(wo)&&(wo=bytesToHex$3(wo)),typeof wo!="string"||!Eo.includes(wo.length))throw new Error("Invalid key");wo=wo.padStart($o*2,"0")}let Oo;try{Oo=typeof wo=="bigint"?wo:bytesToNumberBE$2(ensureBytes$3("private key",wo,$o))}catch{throw new Error(`private key must be ${$o} bytes, hex or bigint, not ${typeof wo}`)}return Co&&(Oo=mod$2(Oo,Ro)),aInRange("private key",Oo,_1n$d,Ro),Oo}function co(wo){if(!(wo instanceof ho))throw new Error("ProjectivePoint expected")}const lo=memoized((wo,Eo)=>{const{px:$o,py:Co,pz:Ro}=wo;if(to.eql(Ro,to.ONE))return{x:$o,y:Co};const Oo=wo.is0();Eo==null&&(Eo=Oo?to.ONE:to.inv(Ro));const jo=to.mul($o,Eo),Bo=to.mul(Co,Eo),Mo=to.mul(Ro,Eo);if(Oo)return{x:to.ZERO,y:to.ZERO};if(!to.eql(Mo,to.ONE))throw new Error("invZ was invalid");return{x:jo,y:Bo}}),uo=memoized(wo=>{if(wo.is0()){if(eo.allowInfinityPoint&&!to.is0(wo.py))return;throw new Error("bad point: ZERO")}const{x:Eo,y:$o}=wo.toAffine();if(!to.isValid(Eo)||!to.isValid($o))throw new Error("bad point: x or y not FE");const Co=to.sqr($o),Ro=oo(Eo);if(!to.eql(Co,Ro))throw new Error("bad point: equation left != right");if(!wo.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ho{constructor(Eo,$o,Co){if(this.px=Eo,this.py=$o,this.pz=Co,Eo==null||!to.isValid(Eo))throw new Error("x required");if($o==null||!to.isValid($o))throw new Error("y required");if(Co==null||!to.isValid(Co))throw new Error("z required");Object.freeze(this)}static fromAffine(Eo){const{x:$o,y:Co}=Eo||{};if(!Eo||!to.isValid($o)||!to.isValid(Co))throw new Error("invalid affine point");if(Eo instanceof ho)throw new Error("projective point not allowed");const Ro=Oo=>to.eql(Oo,to.ZERO);return Ro($o)&&Ro(Co)?ho.ZERO:new ho($o,Co,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Eo){const $o=to.invertBatch(Eo.map(Co=>Co.pz));return Eo.map((Co,Ro)=>Co.toAffine($o[Ro])).map(ho.fromAffine)}static fromHex(Eo){const $o=ho.fromAffine(io(ensureBytes$3("pointHex",Eo)));return $o.assertValidity(),$o}static fromPrivateKey(Eo){return ho.BASE.multiply(so(Eo))}static msm(Eo,$o){return pippenger(ho,ro,Eo,$o)}_setWindowSize(Eo){bo.setWindowSize(this,Eo)}assertValidity(){uo(this)}hasEvenY(){const{y:Eo}=this.toAffine();if(to.isOdd)return!to.isOdd(Eo);throw new Error("Field doesn't support isOdd")}equals(Eo){co(Eo);const{px:$o,py:Co,pz:Ro}=this,{px:Oo,py:jo,pz:Bo}=Eo,Mo=to.eql(to.mul($o,Bo),to.mul(Oo,Ro)),Fo=to.eql(to.mul(Co,Bo),to.mul(jo,Ro));return Mo&&Fo}negate(){return new ho(this.px,to.neg(this.py),this.pz)}double(){const{a:Eo,b:$o}=eo,Co=to.mul($o,_3n$3),{px:Ro,py:Oo,pz:jo}=this;let Bo=to.ZERO,Mo=to.ZERO,Fo=to.ZERO,Wo=to.mul(Ro,Ro),Jo=to.mul(Oo,Oo),Po=to.mul(jo,jo),fo=to.mul(Ro,Oo);return fo=to.add(fo,fo),Fo=to.mul(Ro,jo),Fo=to.add(Fo,Fo),Bo=to.mul(Eo,Fo),Mo=to.mul(Co,Po),Mo=to.add(Bo,Mo),Bo=to.sub(Jo,Mo),Mo=to.add(Jo,Mo),Mo=to.mul(Bo,Mo),Bo=to.mul(fo,Bo),Fo=to.mul(Co,Fo),Po=to.mul(Eo,Po),fo=to.sub(Wo,Po),fo=to.mul(Eo,fo),fo=to.add(fo,Fo),Fo=to.add(Wo,Wo),Wo=to.add(Fo,Wo),Wo=to.add(Wo,Po),Wo=to.mul(Wo,fo),Mo=to.add(Mo,Wo),Po=to.mul(Oo,jo),Po=to.add(Po,Po),Wo=to.mul(Po,fo),Bo=to.sub(Bo,Wo),Fo=to.mul(Po,Jo),Fo=to.add(Fo,Fo),Fo=to.add(Fo,Fo),new ho(Bo,Mo,Fo)}add(Eo){co(Eo);const{px:$o,py:Co,pz:Ro}=this,{px:Oo,py:jo,pz:Bo}=Eo;let Mo=to.ZERO,Fo=to.ZERO,Wo=to.ZERO;const Jo=eo.a,Po=to.mul(eo.b,_3n$3);let fo=to.mul($o,Oo),yo=to.mul(Co,jo),vo=to.mul(Ro,Bo),_o=to.add($o,Co),So=to.add(Oo,jo);_o=to.mul(_o,So),So=to.add(fo,yo),_o=to.sub(_o,So),So=to.add($o,Ro);let To=to.add(Oo,Bo);return So=to.mul(So,To),To=to.add(fo,vo),So=to.sub(So,To),To=to.add(Co,Ro),Mo=to.add(jo,Bo),To=to.mul(To,Mo),Mo=to.add(yo,vo),To=to.sub(To,Mo),Wo=to.mul(Jo,So),Mo=to.mul(Po,vo),Wo=to.add(Mo,Wo),Mo=to.sub(yo,Wo),Wo=to.add(yo,Wo),Fo=to.mul(Mo,Wo),yo=to.add(fo,fo),yo=to.add(yo,fo),vo=to.mul(Jo,vo),So=to.mul(Po,So),yo=to.add(yo,vo),vo=to.sub(fo,vo),vo=to.mul(Jo,vo),So=to.add(So,vo),fo=to.mul(yo,So),Fo=to.add(Fo,fo),fo=to.mul(To,So),Mo=to.mul(_o,Mo),Mo=to.sub(Mo,fo),fo=to.mul(_o,yo),Wo=to.mul(To,Wo),Wo=to.add(Wo,fo),new ho(Mo,Fo,Wo)}subtract(Eo){return this.add(Eo.negate())}is0(){return this.equals(ho.ZERO)}wNAF(Eo){return bo.wNAFCached(this,Eo,ho.normalizeZ)}multiplyUnsafe(Eo){aInRange("scalar",Eo,_0n$b,eo.n);const $o=ho.ZERO;if(Eo===_0n$b)return $o;if(Eo===_1n$d)return this;const{endo:Co}=eo;if(!Co)return bo.unsafeLadder(this,Eo);let{k1neg:Ro,k1:Oo,k2neg:jo,k2:Bo}=Co.splitScalar(Eo),Mo=$o,Fo=$o,Wo=this;for(;Oo>_0n$b||Bo>_0n$b;)Oo&_1n$d&&(Mo=Mo.add(Wo)),Bo&_1n$d&&(Fo=Fo.add(Wo)),Wo=Wo.double(),Oo>>=_1n$d,Bo>>=_1n$d;return Ro&&(Mo=Mo.negate()),jo&&(Fo=Fo.negate()),Fo=new ho(to.mul(Fo.px,Co.beta),Fo.py,Fo.pz),Mo.add(Fo)}multiply(Eo){const{endo:$o,n:Co}=eo;aInRange("scalar",Eo,_1n$d,Co);let Ro,Oo;if($o){const{k1neg:jo,k1:Bo,k2neg:Mo,k2:Fo}=$o.splitScalar(Eo);let{p:Wo,f:Jo}=this.wNAF(Bo),{p:Po,f:fo}=this.wNAF(Fo);Wo=bo.constTimeNegate(jo,Wo),Po=bo.constTimeNegate(Mo,Po),Po=new ho(to.mul(Po.px,$o.beta),Po.py,Po.pz),Ro=Wo.add(Po),Oo=Jo.add(fo)}else{const{p:jo,f:Bo}=this.wNAF(Eo);Ro=jo,Oo=Bo}return ho.normalizeZ([Ro,Oo])[0]}multiplyAndAddUnsafe(Eo,$o,Co){const Ro=ho.BASE,Oo=(Bo,Mo)=>Mo===_0n$b||Mo===_1n$d||!Bo.equals(Ro)?Bo.multiplyUnsafe(Mo):Bo.multiply(Mo),jo=Oo(this,$o).add(Oo(Eo,Co));return jo.is0()?void 0:jo}toAffine(Eo){return lo(this,Eo)}isTorsionFree(){const{h:Eo,isTorsionFree:$o}=eo;if(Eo===_1n$d)return!0;if($o)return $o(ho,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:Eo,clearCofactor:$o}=eo;return Eo===_1n$d?this:$o?$o(ho,this):this.multiplyUnsafe(eo.h)}toRawBytes(Eo=!0){return abool("isCompressed",Eo),this.assertValidity(),no(ho,this,Eo)}toHex(Eo=!0){return abool("isCompressed",Eo),bytesToHex$3(this.toRawBytes(Eo))}}ho.BASE=new ho(eo.Gx,eo.Gy,to.ONE),ho.ZERO=new ho(to.ZERO,to.ONE,to.ZERO);const go=eo.nBitLength,bo=wNAF$2(ho,eo.endo?Math.ceil(go/2):go);return{CURVE:eo,ProjectivePoint:ho,normPrivateKeyToScalar:so,weierstrassEquation:oo,isWithinCurveOrder:ao}}function validateOpts$5(Xr){const eo=validateBasic$2(Xr);return validateObject$2(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass$3(Xr){const eo=validateOpts$5(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(vo){return mod$2(vo,ro)}function ao(vo){return invert$2(vo,ro)}const{ProjectivePoint:so,normPrivateKeyToScalar:co,weierstrassEquation:lo,isWithinCurveOrder:uo}=weierstrassPoints$2({...eo,toBytes(vo,_o,So){const To=_o.toAffine(),Ao=to.toBytes(To.x),ko=concatBytes$4;return abool("isCompressed",So),So?ko(Uint8Array.from([_o.hasEvenY()?2:3]),Ao):ko(Uint8Array.from([4]),Ao,to.toBytes(To.y))},fromBytes(vo){const _o=vo.length,So=vo[0],To=vo.subarray(1);if(_o===no&&(So===2||So===3)){const Ao=bytesToNumberBE$2(To);if(!inRange$1(Ao,_1n$d,to.ORDER))throw new Error("Point is not on curve");const ko=lo(Ao);let mo;try{mo=to.sqrt(ko)}catch(Lo){const Ho=Lo instanceof Error?": "+Lo.message:"";throw new Error("Point is not on curve"+Ho)}const Io=(mo&_1n$d)===_1n$d;return(So&1)===1!==Io&&(mo=to.neg(mo)),{x:Ao,y:mo}}else if(_o===io&&So===4){const Ao=to.fromBytes(To.subarray(0,to.BYTES)),ko=to.fromBytes(To.subarray(to.BYTES,2*to.BYTES));return{x:Ao,y:ko}}else throw new Error(`Point of length ${_o} was invalid. Expected ${no} compressed bytes or ${io} uncompressed bytes`)}}),ho=vo=>bytesToHex$3(numberToBytesBE$2(vo,eo.nByteLength));function go(vo){const _o=ro>>_1n$d;return vo>_o}function bo(vo){return go(vo)?oo(-vo):vo}const wo=(vo,_o,So)=>bytesToNumberBE$2(vo.slice(_o,So));class Eo{constructor(_o,So,To){this.r=_o,this.s=So,this.recovery=To,this.assertValidity()}static fromCompact(_o){const So=eo.nByteLength;return _o=ensureBytes$3("compactSignature",_o,So*2),new Eo(wo(_o,0,So),wo(_o,So,2*So))}static fromDER(_o){const{r:So,s:To}=DER$2.toSig(ensureBytes$3("DER",_o));return new Eo(So,To)}assertValidity(){aInRange("r",this.r,_1n$d,ro),aInRange("s",this.s,_1n$d,ro)}addRecoveryBit(_o){return new Eo(this.r,this.s,_o)}recoverPublicKey(_o){const{r:So,s:To,recovery:Ao}=this,ko=Bo(ensureBytes$3("msgHash",_o));if(Ao==null||![0,1,2,3].includes(Ao))throw new Error("recovery id invalid");const mo=Ao===2||Ao===3?So+eo.n:So;if(mo>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const Io=Ao&1?"03":"02",Do=so.fromHex(Io+ho(mo)),Lo=ao(mo),Ho=oo(-ko*Lo),Yo=oo(To*Lo),Xo=so.BASE.multiplyAndAddUnsafe(Do,Ho,Yo);if(!Xo)throw new Error("point at infinify");return Xo.assertValidity(),Xo}hasHighS(){return go(this.s)}normalizeS(){return this.hasHighS()?new Eo(this.r,oo(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$4(this.toDERHex())}toDERHex(){return DER$2.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$4(this.toCompactHex())}toCompactHex(){return ho(this.r)+ho(this.s)}}const $o={isValidPrivateKey(vo){try{return co(vo),!0}catch{return!1}},normPrivateKeyToScalar:co,randomPrivateKey:()=>{const vo=getMinHashLength$2(eo.n);return mapHashToField$2(eo.randomBytes(vo),eo.n)},precompute(vo=8,_o=so.BASE){return _o._setWindowSize(vo),_o.multiply(BigInt(3)),_o}};function Co(vo,_o=!0){return so.fromPrivateKey(vo).toRawBytes(_o)}function Ro(vo){const _o=isBytes$4(vo),So=typeof vo=="string",To=(_o||So)&&vo.length;return _o?To===no||To===io:So?To===2*no||To===2*io:vo instanceof so}function Oo(vo,_o,So=!0){if(Ro(vo))throw new Error("first arg must be private key");if(!Ro(_o))throw new Error("second arg must be public key");return so.fromHex(_o).multiply(co(vo)).toRawBytes(So)}const jo=eo.bits2int||function(vo){const _o=bytesToNumberBE$2(vo),So=vo.length*8-eo.nBitLength;return So>0?_o>>BigInt(So):_o},Bo=eo.bits2int_modN||function(vo){return oo(jo(vo))},Mo=bitMask$2(eo.nBitLength);function Fo(vo){return aInRange(`num < 2^${eo.nBitLength}`,vo,_0n$b,Mo),numberToBytesBE$2(vo,eo.nByteLength)}function Wo(vo,_o,So=Jo){if(["recovered","canonical"].some(Ko=>Ko in So))throw new Error("sign() legacy options not supported");const{hash:To,randomBytes:Ao}=eo;let{lowS:ko,prehash:mo,extraEntropy:Io}=So;ko==null&&(ko=!0),vo=ensureBytes$3("msgHash",vo),validateSigVerOpts(So),mo&&(vo=ensureBytes$3("prehashed msgHash",To(vo)));const Do=Bo(vo),Lo=co(_o),Ho=[Fo(Lo),Fo(Do)];if(Io!=null&&Io!==!1){const Ko=Io===!0?Ao(to.BYTES):Io;Ho.push(ensureBytes$3("extraEntropy",Ko))}const Yo=concatBytes$4(...Ho),Xo=Do;function qo(Ko){const Qo=jo(Ko);if(!uo(Qo))return;const zo=ao(Qo),ga=so.BASE.multiply(Qo).toAffine(),$a=oo(ga.x);if($a===_0n$b)return;const Sl=oo(zo*oo(Xo+$a*Lo));if(Sl===_0n$b)return;let El=(ga.x===$a?0:2)|Number(ga.y&_1n$d),Tl=Sl;return ko&&go(Sl)&&(Tl=bo(Sl),El^=1),new Eo($a,Tl,El)}return{seed:Yo,k2sig:qo}}const Jo={lowS:eo.lowS,prehash:!1},Po={lowS:eo.lowS,prehash:!1};function fo(vo,_o,So=Jo){const{seed:To,k2sig:Ao}=Wo(vo,_o,So),ko=eo;return createHmacDrbg$2(ko.hash.outputLen,ko.nByteLength,ko.hmac)(To,Ao)}so.BASE._setWindowSize(8);function yo(vo,_o,So,To=Po){var ga;const Ao=vo;if(_o=ensureBytes$3("msgHash",_o),So=ensureBytes$3("publicKey",So),"strict"in To)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(To);const{lowS:ko,prehash:mo}=To;let Io,Do;try{if(typeof Ao=="string"||isBytes$4(Ao))try{Io=Eo.fromDER(Ao)}catch($a){if(!($a instanceof DER$2.Err))throw $a;Io=Eo.fromCompact(Ao)}else if(typeof Ao=="object"&&typeof Ao.r=="bigint"&&typeof Ao.s=="bigint"){const{r:$a,s:Sl}=Ao;Io=new Eo($a,Sl)}else throw new Error("PARSE");Do=so.fromHex(So)}catch($a){if($a.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ko&&Io.hasHighS())return!1;mo&&(_o=eo.hash(_o));const{r:Lo,s:Ho}=Io,Yo=Bo(_o),Xo=ao(Ho),qo=oo(Yo*Xo),Ko=oo(Lo*Xo),Qo=(ga=so.BASE.multiplyAndAddUnsafe(Do,qo,Ko))==null?void 0:ga.toAffine();return Qo?oo(Qo.x)===Lo:!1}return{CURVE:eo,getPublicKey:Co,getSharedSecret:Oo,sign:fo,verify:yo,ProjectivePoint:so,Signature:Eo,utils:$o}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash$1(Xr){return{hash:Xr,hmac:(eo,...to)=>hmac$4(Xr,eo,concatBytes$5(...to)),randomBytes:randomBytes$1}}function createCurve(Xr,eo){const to=ro=>weierstrass$3({...Xr,...getHash$1(ro)});return Object.freeze({...to(eo),create:to})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$c=BigInt(1),_2n$8=BigInt(2),divNearest=(Xr,eo)=>(Xr+eo/_2n$8)/eo;function sqrtMod(Xr){const eo=secp256k1P,to=BigInt(3),ro=BigInt(6),no=BigInt(11),io=BigInt(22),oo=BigInt(23),ao=BigInt(44),so=BigInt(88),co=Xr*Xr*Xr%eo,lo=co*co*Xr%eo,uo=pow2(lo,to,eo)*lo%eo,ho=pow2(uo,to,eo)*lo%eo,go=pow2(ho,_2n$8,eo)*co%eo,bo=pow2(go,no,eo)*go%eo,wo=pow2(bo,io,eo)*bo%eo,Eo=pow2(wo,ao,eo)*wo%eo,$o=pow2(Eo,so,eo)*Eo%eo,Co=pow2($o,ao,eo)*wo%eo,Ro=pow2(Co,to,eo)*lo%eo,Oo=pow2(Ro,oo,eo)*bo%eo,jo=pow2(Oo,ro,eo)*co%eo,Bo=pow2(jo,_2n$8,eo);if(!Fp$1.eql(Fp$1.sqr(Bo),Xr))throw new Error("Cannot find square root");return Bo}const Fp$1=Field$2(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1$2=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:Xr=>{const eo=secp256k1N,to=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),ro=-_1n$c*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),no=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),io=to,oo=BigInt("0x100000000000000000000000000000000"),ao=divNearest(io*Xr,eo),so=divNearest(-ro*Xr,eo);let co=mod$2(Xr-ao*to-so*no,eo),lo=mod$2(-ao*ro-so*io,eo);const uo=co>oo,ho=lo>oo;if(uo&&(co=eo-co),ho&&(lo=eo-lo),co>oo||lo>oo)throw new Error("splitScalar: Endomorphism failed, k="+Xr);return{k1neg:uo,k1:co,k2neg:ho,k2:lo}}}},sha256_1$4);BigInt(0);secp256k1$2.ProjectivePoint;const secp256k1$3=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:secp256k1$2},Symbol.toStringTag,{value:"Module"}));/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point=secp256k1$2.ProjectivePoint,base58check=createBase58check(sha256_1$4);function bytesToNumber$1(Xr){return BigInt(`0x${bytesToHex$4(Xr)}`)}function numberToBytes$1(Xr){return hexToBytes$5(Xr.toString(16).padStart(64,"0"))}const MASTER_SECRET=utf8ToBytes$4("Bitcoin seed"),BITCOIN_VERSIONS={private:76066276,public:76067358},HARDENED_OFFSET=2147483648,hash160=Xr=>ripemd160_1(sha256_1$4(Xr)),fromU32=Xr=>createView$1(Xr).getUint32(0,!1),toU32=Xr=>{if(!Number.isSafeInteger(Xr)||Xr<0||Xr>2**32-1)throw new Error(`Invalid number=${Xr}. Should be from 0 to 2 ** 32 - 1`);const eo=new Uint8Array(4);return createView$1(eo).setUint32(0,Xr,!1),eo};class HDKey{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const eo=this.privateKey;if(!eo)throw new Error("No private key");return base58check.encode(this.serialize(this.versions.private,concatBytes$5(new Uint8Array([0]),eo)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(eo,to=BITCOIN_VERSIONS){if(bytes$2(eo),8*eo.length<128||8*eo.length>512)throw new Error(`HDKey: wrong seed length=${eo.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const ro=hmac$4(sha512$3,MASTER_SECRET,eo);return new HDKey({versions:to,chainCode:ro.slice(32),privateKey:ro.slice(0,32)})}static fromExtendedKey(eo,to=BITCOIN_VERSIONS){const ro=base58check.decode(eo),no=createView$1(ro),io=no.getUint32(0,!1),oo={versions:to,depth:ro[4],parentFingerprint:no.getUint32(5,!1),index:no.getUint32(9,!1),chainCode:ro.slice(13,45)},ao=ro.slice(45),so=ao[0]===0;if(io!==to[so?"private":"public"])throw new Error("Version mismatch");return so?new HDKey({...oo,privateKey:ao.slice(1)}):new HDKey({...oo,publicKey:ao})}static fromJSON(eo){return HDKey.fromExtendedKey(eo.xpriv)}constructor(eo){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!eo||typeof eo!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=eo.versions||BITCOIN_VERSIONS,this.depth=eo.depth||0,this.chainCode=eo.chainCode||null,this.index=eo.index||0,this.parentFingerprint=eo.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(eo.publicKey&&eo.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(eo.privateKey){if(!secp256k1$2.utils.isValidPrivateKey(eo.privateKey))throw new Error("Invalid private key");this.privKey=typeof eo.privateKey=="bigint"?eo.privateKey:bytesToNumber$1(eo.privateKey),this.privKeyBytes=numberToBytes$1(this.privKey),this.pubKey=secp256k1$2.getPublicKey(eo.privateKey,!0)}else if(eo.publicKey)this.pubKey=Point.fromHex(eo.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160(this.pubKey)}derive(eo){if(!/^[mM]'?/.test(eo))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(eo))return this;const to=eo.replace(/^[mM]'?\//,"").split("/");let ro=this;for(const no of to){const io=/^(\d+)('?)$/.exec(no),oo=io&&io[1];if(!io||io.length!==3||typeof oo!="string")throw new Error(`Invalid child index: ${no}`);let ao=+oo;if(!Number.isSafeInteger(ao)||ao>=HARDENED_OFFSET)throw new Error("Invalid index");io[2]==="'"&&(ao+=HARDENED_OFFSET),ro=ro.deriveChild(ao)}return ro}deriveChild(eo){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let to=toU32(eo);if(eo>=HARDENED_OFFSET){const ao=this.privateKey;if(!ao)throw new Error("Could not derive hardened child key");to=concatBytes$5(new Uint8Array([0]),ao,to)}else to=concatBytes$5(this.pubKey,to);const ro=hmac$4(sha512$3,this.chainCode,to),no=bytesToNumber$1(ro.slice(0,32)),io=ro.slice(32);if(!secp256k1$2.utils.isValidPrivateKey(no))throw new Error("Tweak bigger than curve order");const oo={versions:this.versions,chainCode:io,depth:this.depth+1,parentFingerprint:this.fingerprint,index:eo};try{if(this.privateKey){const ao=mod$2(this.privKey+no,secp256k1$2.CURVE.n);if(!secp256k1$2.utils.isValidPrivateKey(ao))throw new Error("The tweak was out of range or the resulted private key is invalid");oo.privateKey=ao}else{const ao=Point.fromHex(this.pubKey).add(Point.fromPrivateKey(no));if(ao.equals(Point.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");oo.publicKey=ao.toRawBytes(!0)}return new HDKey(oo)}catch{return this.deriveChild(eo+1)}}sign(eo){if(!this.privateKey)throw new Error("No privateKey set!");return bytes$2(eo,32),secp256k1$2.sign(eo,this.privKey).toCompactRawBytes()}verify(eo,to){if(bytes$2(eo,32),bytes$2(to,64),!this.publicKey)throw new Error("No publicKey set!");let ro;try{ro=secp256k1$2.Signature.fromCompact(to)}catch{return!1}return secp256k1$2.verify(ro,eo,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(eo,to){if(!this.chainCode)throw new Error("No chainCode set");return bytes$2(to,33),concatBytes$5(toU32(eo),new Uint8Array([this.depth]),toU32(this.parentFingerprint),toU32(this.index),this.chainCode,to)}}const getRandomElement=Xr=>{if(Xr.length===0)throw new Error("Array cannot be empty");const eo=Math.floor(Math.random()*Xr.length);return Xr[eo]};function bind$1(Xr,eo){return function(){return Xr.apply(eo,arguments)}}const{toString:toString$c}=Object.prototype,{getPrototypeOf}=Object,kindOf=(Xr=>eo=>{const to=toString$c.call(eo);return Xr[to]||(Xr[to]=to.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=Xr=>(Xr=Xr.toLowerCase(),eo=>kindOf(eo)===Xr),typeOfTest=Xr=>eo=>typeof eo===Xr,{isArray:isArray$f}=Array,isUndefined=typeOfTest("undefined");function isBuffer$4(Xr){return Xr!==null&&!isUndefined(Xr)&&Xr.constructor!==null&&!isUndefined(Xr.constructor)&&isFunction$6(Xr.constructor.isBuffer)&&Xr.constructor.isBuffer(Xr)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView$1(Xr){let eo;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?eo=ArrayBuffer.isView(Xr):eo=Xr&&Xr.buffer&&isArrayBuffer(Xr.buffer),eo}const isString$5=typeOfTest("string"),isFunction$6=typeOfTest("function"),isNumber$3=typeOfTest("number"),isObject$h=Xr=>Xr!==null&&typeof Xr=="object",isBoolean$1=Xr=>Xr===!0||Xr===!1,isPlainObject$2=Xr=>{if(kindOf(Xr)!=="object")return!1;const eo=getPrototypeOf(Xr);return(eo===null||eo===Object.prototype||Object.getPrototypeOf(eo)===null)&&!(Symbol.toStringTag in Xr)&&!(Symbol.iterator in Xr)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob$1=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=Xr=>isObject$h(Xr)&&isFunction$6(Xr.pipe),isFormData=Xr=>{let eo;return Xr&&(typeof FormData=="function"&&Xr instanceof FormData||isFunction$6(Xr.append)&&((eo=kindOf(Xr))==="formdata"||eo==="object"&&isFunction$6(Xr.toString)&&Xr.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$2=Xr=>Xr.trim?Xr.trim():Xr.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(Xr,eo,{allOwnKeys:to=!1}={}){if(Xr===null||typeof Xr>"u")return;let ro,no;if(typeof Xr!="object"&&(Xr=[Xr]),isArray$f(Xr))for(ro=0,no=Xr.length;ro0;)if(no=to[ro],eo===no.toLowerCase())return no;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=Xr=>!isUndefined(Xr)&&Xr!==_global;function merge(){const{caseless:Xr}=isContextDefined(this)&&this||{},eo={},to=(ro,no)=>{const io=Xr&&findKey(eo,no)||no;isPlainObject$2(eo[io])&&isPlainObject$2(ro)?eo[io]=merge(eo[io],ro):isPlainObject$2(ro)?eo[io]=merge({},ro):isArray$f(ro)?eo[io]=ro.slice():eo[io]=ro};for(let ro=0,no=arguments.length;ro(forEach$1(eo,(no,io)=>{to&&isFunction$6(no)?Xr[io]=bind$1(no,to):Xr[io]=no},{allOwnKeys:ro}),Xr),stripBOM=Xr=>(Xr.charCodeAt(0)===65279&&(Xr=Xr.slice(1)),Xr),inherits=(Xr,eo,to,ro)=>{Xr.prototype=Object.create(eo.prototype,ro),Xr.prototype.constructor=Xr,Object.defineProperty(Xr,"super",{value:eo.prototype}),to&&Object.assign(Xr.prototype,to)},toFlatObject=(Xr,eo,to,ro)=>{let no,io,oo;const ao={};if(eo=eo||{},Xr==null)return eo;do{for(no=Object.getOwnPropertyNames(Xr),io=no.length;io-- >0;)oo=no[io],(!ro||ro(oo,Xr,eo))&&!ao[oo]&&(eo[oo]=Xr[oo],ao[oo]=!0);Xr=to!==!1&&getPrototypeOf(Xr)}while(Xr&&(!to||to(Xr,eo))&&Xr!==Object.prototype);return eo},endsWith=(Xr,eo,to)=>{Xr=String(Xr),(to===void 0||to>Xr.length)&&(to=Xr.length),to-=eo.length;const ro=Xr.indexOf(eo,to);return ro!==-1&&ro===to},toArray$2=Xr=>{if(!Xr)return null;if(isArray$f(Xr))return Xr;let eo=Xr.length;if(!isNumber$3(eo))return null;const to=new Array(eo);for(;eo-- >0;)to[eo]=Xr[eo];return to},isTypedArray$5=(Xr=>eo=>Xr&&eo instanceof Xr)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(Xr,eo)=>{const ro=(Xr&&Xr[Symbol.iterator]).call(Xr);let no;for(;(no=ro.next())&&!no.done;){const io=no.value;eo.call(Xr,io[0],io[1])}},matchAll=(Xr,eo)=>{let to;const ro=[];for(;(to=Xr.exec(eo))!==null;)ro.push(to);return ro},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=Xr=>Xr.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(to,ro,no){return ro.toUpperCase()+no}),hasOwnProperty$m=(({hasOwnProperty:Xr})=>(eo,to)=>Xr.call(eo,to))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(Xr,eo)=>{const to=Object.getOwnPropertyDescriptors(Xr),ro={};forEach$1(to,(no,io)=>{let oo;(oo=eo(no,io,Xr))!==!1&&(ro[io]=oo||no)}),Object.defineProperties(Xr,ro)},freezeMethods=Xr=>{reduceDescriptors(Xr,(eo,to)=>{if(isFunction$6(Xr)&&["arguments","caller","callee"].indexOf(to)!==-1)return!1;const ro=Xr[to];if(isFunction$6(ro)){if(eo.enumerable=!1,"writable"in eo){eo.writable=!1;return}eo.set||(eo.set=()=>{throw Error("Can not rewrite read-only method '"+to+"'")})}})},toObjectSet=(Xr,eo)=>{const to={},ro=no=>{no.forEach(io=>{to[io]=!0})};return isArray$f(Xr)?ro(Xr):ro(String(Xr).split(eo)),to},noop$8=()=>{},toFiniteNumber=(Xr,eo)=>Xr!=null&&Number.isFinite(Xr=+Xr)?Xr:eo,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$4={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(Xr=16,eo=ALPHABET$4.ALPHA_DIGIT)=>{let to="";const{length:ro}=eo;for(;Xr--;)to+=eo[Math.random()*ro|0];return to};function isSpecCompliantForm(Xr){return!!(Xr&&isFunction$6(Xr.append)&&Xr[Symbol.toStringTag]==="FormData"&&Xr[Symbol.iterator])}const toJSONObject=Xr=>{const eo=new Array(10),to=(ro,no)=>{if(isObject$h(ro)){if(eo.indexOf(ro)>=0)return;if(!("toJSON"in ro)){eo[no]=ro;const io=isArray$f(ro)?[]:{};return forEach$1(ro,(oo,ao)=>{const so=to(oo,no+1);!isUndefined(so)&&(io[ao]=so)}),eo[no]=void 0,io}}return ro};return to(Xr,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=Xr=>Xr&&(isObject$h(Xr)||isFunction$6(Xr))&&isFunction$6(Xr.then)&&isFunction$6(Xr.catch),_setImmediate=((Xr,eo)=>Xr?setImmediate:eo?((to,ro)=>(_global.addEventListener("message",({source:no,data:io})=>{no===_global&&io===to&&ro.length&&ro.shift()()},!1),no=>{ro.push(no),_global.postMessage(to,"*")}))(`axios@${Math.random()}`,[]):to=>setTimeout(to))(typeof setImmediate=="function",isFunction$6(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process$1$1<"u"&&process$1$1.nextTick||_setImmediate,utils$c={isArray:isArray$f,isArrayBuffer,isBuffer:isBuffer$4,isFormData,isArrayBufferView:isArrayBufferView$1,isString:isString$5,isNumber:isNumber$3,isBoolean:isBoolean$1,isObject:isObject$h,isPlainObject:isPlainObject$2,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob:isBlob$1,isRegExp,isFunction:isFunction$6,isStream,isURLSearchParams,isTypedArray:isTypedArray$5,isFileList,forEach:forEach$1,merge,extend,trim:trim$2,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$2,forEachEntry,matchAll,isHTMLForm,hasOwnProperty:hasOwnProperty$m,hasOwnProp:hasOwnProperty$m,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$8,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET:ALPHABET$4,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};var buffer$2={},base64Js$1={};base64Js$1.byteLength=byteLength$1;base64Js$1.toByteArray=toByteArray$1;base64Js$1.fromByteArray=fromByteArray$1;var lookup$1=[],revLookup$1=[],Arr$1=typeof Uint8Array<"u"?Uint8Array:Array,code$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$8=0,len$1=code$1.length;i$80)throw new Error("Invalid string. Length must be a multiple of 4");var to=Xr.indexOf("=");to===-1&&(to=eo);var ro=to===eo?0:4-to%4;return[to,ro]}function byteLength$1(Xr){var eo=getLens$1(Xr),to=eo[0],ro=eo[1];return(to+ro)*3/4-ro}function _byteLength$1(Xr,eo,to){return(eo+to)*3/4-to}function toByteArray$1(Xr){var eo,to=getLens$1(Xr),ro=to[0],no=to[1],io=new Arr$1(_byteLength$1(Xr,ro,no)),oo=0,ao=no>0?ro-4:ro,so;for(so=0;so>16&255,io[oo++]=eo>>8&255,io[oo++]=eo&255;return no===2&&(eo=revLookup$1[Xr.charCodeAt(so)]<<2|revLookup$1[Xr.charCodeAt(so+1)]>>4,io[oo++]=eo&255),no===1&&(eo=revLookup$1[Xr.charCodeAt(so)]<<10|revLookup$1[Xr.charCodeAt(so+1)]<<4|revLookup$1[Xr.charCodeAt(so+2)]>>2,io[oo++]=eo>>8&255,io[oo++]=eo&255),io}function tripletToBase64$1(Xr){return lookup$1[Xr>>18&63]+lookup$1[Xr>>12&63]+lookup$1[Xr>>6&63]+lookup$1[Xr&63]}function encodeChunk$1(Xr,eo,to){for(var ro,no=[],io=eo;ioao?ao:oo+io));return ro===1?(eo=Xr[to-1],no.push(lookup$1[eo>>2]+lookup$1[eo<<4&63]+"==")):ro===2&&(eo=(Xr[to-2]<<8)+Xr[to-1],no.push(lookup$1[eo>>10]+lookup$1[eo>>4&63]+lookup$1[eo<<2&63]+"=")),no.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(Xr,eo,to,ro,no){var io,oo,ao=no*8-ro-1,so=(1<>1,lo=-7,uo=to?no-1:0,ho=to?-1:1,go=Xr[eo+uo];for(uo+=ho,io=go&(1<<-lo)-1,go>>=-lo,lo+=ao;lo>0;io=io*256+Xr[eo+uo],uo+=ho,lo-=8);for(oo=io&(1<<-lo)-1,io>>=-lo,lo+=ro;lo>0;oo=oo*256+Xr[eo+uo],uo+=ho,lo-=8);if(io===0)io=1-co;else{if(io===so)return oo?NaN:(go?-1:1)*(1/0);oo=oo+Math.pow(2,ro),io=io-co}return(go?-1:1)*oo*Math.pow(2,io-ro)};ieee754.write=function(Xr,eo,to,ro,no,io){var oo,ao,so,co=io*8-no-1,lo=(1<>1,ho=no===23?Math.pow(2,-24)-Math.pow(2,-77):0,go=ro?0:io-1,bo=ro?1:-1,wo=eo<0||eo===0&&1/eo<0?1:0;for(eo=Math.abs(eo),isNaN(eo)||eo===1/0?(ao=isNaN(eo)?1:0,oo=lo):(oo=Math.floor(Math.log(eo)/Math.LN2),eo*(so=Math.pow(2,-oo))<1&&(oo--,so*=2),oo+uo>=1?eo+=ho/so:eo+=ho*Math.pow(2,1-uo),eo*so>=2&&(oo++,so/=2),oo+uo>=lo?(ao=0,oo=lo):oo+uo>=1?(ao=(eo*so-1)*Math.pow(2,no),oo=oo+uo):(ao=eo*Math.pow(2,uo-1)*Math.pow(2,no),oo=0));no>=8;Xr[to+go]=ao&255,go+=bo,ao/=256,no-=8);for(oo=oo<0;Xr[to+go]=oo&255,go+=bo,oo/=256,co-=8);Xr[to+go-bo]|=wo*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(Xr){const eo=base64Js$1,to=ieee754,ro=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xr.Buffer=lo,Xr.SlowBuffer=jo,Xr.INSPECT_MAX_BYTES=50;const no=2147483647;Xr.kMaxLength=no;const{Uint8Array:io,ArrayBuffer:oo,SharedArrayBuffer:ao}=globalThis;lo.TYPED_ARRAY_SUPPORT=so(),!lo.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function so(){try{const wl=new io(1),Jo={foo:function(){return 42}};return Object.setPrototypeOf(Jo,io.prototype),Object.setPrototypeOf(wl,Jo),wl.foo()===42}catch{return!1}}Object.defineProperty(lo.prototype,"parent",{enumerable:!0,get:function(){if(lo.isBuffer(this))return this.buffer}}),Object.defineProperty(lo.prototype,"offset",{enumerable:!0,get:function(){if(lo.isBuffer(this))return this.byteOffset}});function co(wl){if(wl>no)throw new RangeError('The value "'+wl+'" is invalid for option "size"');const Jo=new io(wl);return Object.setPrototypeOf(Jo,lo.prototype),Jo}function lo(wl,Jo,Go){if(typeof wl=="number"){if(typeof Jo=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return yo(wl)}return fo(wl,Jo,Go)}lo.poolSize=8192;function fo(wl,Jo,Go){if(typeof wl=="string")return vo(wl,Jo);if(oo.isView(wl))return Eo(wl);if(wl==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof wl);if(uu(wl,oo)||wl&&uu(wl.buffer,oo)||typeof ao<"u"&&(uu(wl,ao)||wl&&uu(wl.buffer,ao)))return ko(wl,Jo,Go);if(typeof wl=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $l=wl.valueOf&&wl.valueOf();if($l!=null&&$l!==wl)return lo.from($l,Jo,Go);const Zl=Ao(wl);if(Zl)return Zl;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof wl[Symbol.toPrimitive]=="function")return lo.from(wl[Symbol.toPrimitive]("string"),Jo,Go);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof wl)}lo.from=function(wl,Jo,Go){return fo(wl,Jo,Go)},Object.setPrototypeOf(lo.prototype,io.prototype),Object.setPrototypeOf(lo,io);function ho(wl){if(typeof wl!="number")throw new TypeError('"size" argument must be of type number');if(wl<0)throw new RangeError('The value "'+wl+'" is invalid for option "size"')}function go(wl,Jo,Go){return ho(wl),wl<=0?co(wl):Jo!==void 0?typeof Go=="string"?co(wl).fill(Jo,Go):co(wl).fill(Jo):co(wl)}lo.alloc=function(wl,Jo,Go){return go(wl,Jo,Go)};function yo(wl){return ho(wl),co(wl<0?0:Po(wl)|0)}lo.allocUnsafe=function(wl){return yo(wl)},lo.allocUnsafeSlow=function(wl){return yo(wl)};function vo(wl,Jo){if((typeof Jo!="string"||Jo==="")&&(Jo="utf8"),!lo.isEncoding(Jo))throw new TypeError("Unknown encoding: "+Jo);const Go=Mo(wl,Jo)|0;let $l=co(Go);const Zl=$l.write(wl,Jo);return Zl!==Go&&($l=$l.slice(0,Zl)),$l}function wo(wl){const Jo=wl.length<0?0:Po(wl.length)|0,Go=co(Jo);for(let $l=0;$l=no)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+no.toString(16)+" bytes");return wl|0}function jo(wl){return+wl!=wl&&(wl=0),lo.alloc(+wl)}lo.isBuffer=function(Jo){return Jo!=null&&Jo._isBuffer===!0&&Jo!==lo.prototype},lo.compare=function(Jo,Go){if(uu(Jo,io)&&(Jo=lo.from(Jo,Jo.offset,Jo.byteLength)),uu(Go,io)&&(Go=lo.from(Go,Go.offset,Go.byteLength)),!lo.isBuffer(Jo)||!lo.isBuffer(Go))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Jo===Go)return 0;let $l=Jo.length,Zl=Go.length;for(let Ul=0,Gl=Math.min($l,Zl);UlZl.length?(lo.isBuffer(Gl)||(Gl=lo.from(Gl)),Gl.copy(Zl,Ul)):io.prototype.set.call(Zl,Gl,Ul);else if(lo.isBuffer(Gl))Gl.copy(Zl,Ul);else throw new TypeError('"list" argument must be an Array of Buffers');Ul+=Gl.length}return Zl};function Mo(wl,Jo){if(lo.isBuffer(wl))return wl.length;if(oo.isView(wl)||uu(wl,oo))return wl.byteLength;if(typeof wl!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof wl);const Go=wl.length,$l=arguments.length>2&&arguments[2]===!0;if(!$l&&Go===0)return 0;let Zl=!1;for(;;)switch(Jo){case"ascii":case"latin1":case"binary":return Go;case"utf8":case"utf-8":return Tl(wl).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Go*2;case"hex":return Go>>>1;case"base64":return Vl(wl).length;default:if(Zl)return $l?-1:Tl(wl).length;Jo=(""+Jo).toLowerCase(),Zl=!0}}lo.byteLength=Mo;function No(wl,Jo,Go){let $l=!1;if((Jo===void 0||Jo<0)&&(Jo=0),Jo>this.length||((Go===void 0||Go>this.length)&&(Go=this.length),Go<=0)||(Go>>>=0,Jo>>>=0,Go<=Jo))return"";for(wl||(wl="utf8");;)switch(wl){case"hex":return mo(this,Jo,Go);case"utf8":case"utf-8":return _o(this,Jo,Go);case"ascii":return Ro(this,Jo,Go);case"latin1":case"binary":return So(this,Jo,Go);case"base64":return bo(this,Jo,Go);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,Jo,Go);default:if($l)throw new TypeError("Unknown encoding: "+wl);wl=(wl+"").toLowerCase(),$l=!0}}lo.prototype._isBuffer=!0;function Do(wl,Jo,Go){const $l=wl[Jo];wl[Jo]=wl[Go],wl[Go]=$l}lo.prototype.swap16=function(){const Jo=this.length;if(Jo%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Go=0;GoGo&&(Jo+=" ... "),""},ro&&(lo.prototype[ro]=lo.prototype.inspect),lo.prototype.compare=function(Jo,Go,$l,Zl,Ul){if(uu(Jo,io)&&(Jo=lo.from(Jo,Jo.offset,Jo.byteLength)),!lo.isBuffer(Jo))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Jo);if(Go===void 0&&(Go=0),$l===void 0&&($l=Jo?Jo.length:0),Zl===void 0&&(Zl=0),Ul===void 0&&(Ul=this.length),Go<0||$l>Jo.length||Zl<0||Ul>this.length)throw new RangeError("out of range index");if(Zl>=Ul&&Go>=$l)return 0;if(Zl>=Ul)return-1;if(Go>=$l)return 1;if(Go>>>=0,$l>>>=0,Zl>>>=0,Ul>>>=0,this===Jo)return 0;let Gl=Ul-Zl,Nu=$l-Go;const hu=Math.min(Gl,Nu),cu=this.slice(Zl,Ul),Wu=Jo.slice(Go,$l);for(let mu=0;mu2147483647?Go=2147483647:Go<-2147483648&&(Go=-2147483648),Go=+Go,ru(Go)&&(Go=Zl?0:wl.length-1),Go<0&&(Go=wl.length+Go),Go>=wl.length){if(Zl)return-1;Go=wl.length-1}else if(Go<0)if(Zl)Go=0;else return-1;if(typeof Jo=="string"&&(Jo=lo.from(Jo,$l)),lo.isBuffer(Jo))return Jo.length===0?-1:Xo(wl,Jo,Go,$l,Zl);if(typeof Jo=="number")return Jo=Jo&255,typeof io.prototype.indexOf=="function"?Zl?io.prototype.indexOf.call(wl,Jo,Go):io.prototype.lastIndexOf.call(wl,Jo,Go):Xo(wl,[Jo],Go,$l,Zl);throw new TypeError("val must be string, number or Buffer")}function Xo(wl,Jo,Go,$l,Zl){let Ul=1,Gl=wl.length,Nu=Jo.length;if($l!==void 0&&($l=String($l).toLowerCase(),$l==="ucs2"||$l==="ucs-2"||$l==="utf16le"||$l==="utf-16le")){if(wl.length<2||Jo.length<2)return-1;Ul=2,Gl/=2,Nu/=2,Go/=2}function hu(Wu,mu){return Ul===1?Wu[mu]:Wu.readUInt16BE(mu*Ul)}let cu;if(Zl){let Wu=-1;for(cu=Go;cuGl&&(Go=Gl-Nu),cu=Go;cu>=0;cu--){let Wu=!0;for(let mu=0;muZl&&($l=Zl)):$l=Zl;const Ul=Jo.length;$l>Ul/2&&($l=Ul/2);let Gl;for(Gl=0;Gl<$l;++Gl){const Nu=parseInt(Jo.substr(Gl*2,2),16);if(ru(Nu))return Gl;wl[Go+Gl]=Nu}return Gl}function Bo(wl,Jo,Go,$l){return Ll(Tl(Jo,wl.length-Go),wl,Go,$l)}function xo(wl,Jo,Go,$l){return Ll(Ml(Jo),wl,Go,$l)}function uo(wl,Jo,Go,$l){return Ll(Vl(Jo),wl,Go,$l)}function po(wl,Jo,Go,$l){return Ll(ou(Jo,wl.length-Go),wl,Go,$l)}lo.prototype.write=function(Jo,Go,$l,Zl){if(Go===void 0)Zl="utf8",$l=this.length,Go=0;else if($l===void 0&&typeof Go=="string")Zl=Go,$l=this.length,Go=0;else if(isFinite(Go))Go=Go>>>0,isFinite($l)?($l=$l>>>0,Zl===void 0&&(Zl="utf8")):(Zl=$l,$l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Ul=this.length-Go;if(($l===void 0||$l>Ul)&&($l=Ul),Jo.length>0&&($l<0||Go<0)||Go>this.length)throw new RangeError("Attempt to write outside buffer bounds");Zl||(Zl="utf8");let Gl=!1;for(;;)switch(Zl){case"hex":return Lo(this,Jo,Go,$l);case"utf8":case"utf-8":return Bo(this,Jo,Go,$l);case"ascii":case"latin1":case"binary":return xo(this,Jo,Go,$l);case"base64":return uo(this,Jo,Go,$l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return po(this,Jo,Go,$l);default:if(Gl)throw new TypeError("Unknown encoding: "+Zl);Zl=(""+Zl).toLowerCase(),Gl=!0}},lo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function bo(wl,Jo,Go){return Jo===0&&Go===wl.length?eo.fromByteArray(wl):eo.fromByteArray(wl.slice(Jo,Go))}function _o(wl,Jo,Go){Go=Math.min(wl.length,Go);const $l=[];let Zl=Jo;for(;Zl239?4:Ul>223?3:Ul>191?2:1;if(Zl+Nu<=Go){let hu,cu,Wu,mu;switch(Nu){case 1:Ul<128&&(Gl=Ul);break;case 2:hu=wl[Zl+1],(hu&192)===128&&(mu=(Ul&31)<<6|hu&63,mu>127&&(Gl=mu));break;case 3:hu=wl[Zl+1],cu=wl[Zl+2],(hu&192)===128&&(cu&192)===128&&(mu=(Ul&15)<<12|(hu&63)<<6|cu&63,mu>2047&&(mu<55296||mu>57343)&&(Gl=mu));break;case 4:hu=wl[Zl+1],cu=wl[Zl+2],Wu=wl[Zl+3],(hu&192)===128&&(cu&192)===128&&(Wu&192)===128&&(mu=(Ul&15)<<18|(hu&63)<<12|(cu&63)<<6|Wu&63,mu>65535&&mu<1114112&&(Gl=mu))}}Gl===null?(Gl=65533,Nu=1):Gl>65535&&(Gl-=65536,$l.push(Gl>>>10&1023|55296),Gl=56320|Gl&1023),$l.push(Gl),Zl+=Nu}return Co($l)}const $o=4096;function Co(wl){const Jo=wl.length;if(Jo<=$o)return String.fromCharCode.apply(String,wl);let Go="",$l=0;for(;$l$l)&&(Go=$l);let Zl="";for(let Ul=Jo;Ul$l&&(Jo=$l),Go<0?(Go+=$l,Go<0&&(Go=0)):Go>$l&&(Go=$l),GoGo)throw new RangeError("Trying to access beyond buffer length")}lo.prototype.readUintLE=lo.prototype.readUIntLE=function(Jo,Go,$l){Jo=Jo>>>0,Go=Go>>>0,$l||Vo(Jo,Go,this.length);let Zl=this[Jo],Ul=1,Gl=0;for(;++Gl>>0,Go=Go>>>0,$l||Vo(Jo,Go,this.length);let Zl=this[Jo+--Go],Ul=1;for(;Go>0&&(Ul*=256);)Zl+=this[Jo+--Go]*Ul;return Zl},lo.prototype.readUint8=lo.prototype.readUInt8=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,1,this.length),this[Jo]},lo.prototype.readUint16LE=lo.prototype.readUInt16LE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,2,this.length),this[Jo]|this[Jo+1]<<8},lo.prototype.readUint16BE=lo.prototype.readUInt16BE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,2,this.length),this[Jo]<<8|this[Jo+1]},lo.prototype.readUint32LE=lo.prototype.readUInt32LE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,4,this.length),(this[Jo]|this[Jo+1]<<8|this[Jo+2]<<16)+this[Jo+3]*16777216},lo.prototype.readUint32BE=lo.prototype.readUInt32BE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,4,this.length),this[Jo]*16777216+(this[Jo+1]<<16|this[Jo+2]<<8|this[Jo+3])},lo.prototype.readBigUInt64LE=ku(function(Jo){Jo=Jo>>>0,Al(Jo,"offset");const Go=this[Jo],$l=this[Jo+7];(Go===void 0||$l===void 0)&&Ol(Jo,this.length-8);const Zl=Go+this[++Jo]*2**8+this[++Jo]*2**16+this[++Jo]*2**24,Ul=this[++Jo]+this[++Jo]*2**8+this[++Jo]*2**16+$l*2**24;return BigInt(Zl)+(BigInt(Ul)<>>0,Al(Jo,"offset");const Go=this[Jo],$l=this[Jo+7];(Go===void 0||$l===void 0)&&Ol(Jo,this.length-8);const Zl=Go*2**24+this[++Jo]*2**16+this[++Jo]*2**8+this[++Jo],Ul=this[++Jo]*2**24+this[++Jo]*2**16+this[++Jo]*2**8+$l;return(BigInt(Zl)<>>0,Go=Go>>>0,$l||Vo(Jo,Go,this.length);let Zl=this[Jo],Ul=1,Gl=0;for(;++Gl=Ul&&(Zl-=Math.pow(2,8*Go)),Zl},lo.prototype.readIntBE=function(Jo,Go,$l){Jo=Jo>>>0,Go=Go>>>0,$l||Vo(Jo,Go,this.length);let Zl=Go,Ul=1,Gl=this[Jo+--Zl];for(;Zl>0&&(Ul*=256);)Gl+=this[Jo+--Zl]*Ul;return Ul*=128,Gl>=Ul&&(Gl-=Math.pow(2,8*Go)),Gl},lo.prototype.readInt8=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,1,this.length),this[Jo]&128?(255-this[Jo]+1)*-1:this[Jo]},lo.prototype.readInt16LE=function(Jo,Go){Jo=Jo>>>0,Go||Vo(Jo,2,this.length);const $l=this[Jo]|this[Jo+1]<<8;return $l&32768?$l|4294901760:$l},lo.prototype.readInt16BE=function(Jo,Go){Jo=Jo>>>0,Go||Vo(Jo,2,this.length);const $l=this[Jo+1]|this[Jo]<<8;return $l&32768?$l|4294901760:$l},lo.prototype.readInt32LE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,4,this.length),this[Jo]|this[Jo+1]<<8|this[Jo+2]<<16|this[Jo+3]<<24},lo.prototype.readInt32BE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,4,this.length),this[Jo]<<24|this[Jo+1]<<16|this[Jo+2]<<8|this[Jo+3]},lo.prototype.readBigInt64LE=ku(function(Jo){Jo=Jo>>>0,Al(Jo,"offset");const Go=this[Jo],$l=this[Jo+7];(Go===void 0||$l===void 0)&&Ol(Jo,this.length-8);const Zl=this[Jo+4]+this[Jo+5]*2**8+this[Jo+6]*2**16+($l<<24);return(BigInt(Zl)<>>0,Al(Jo,"offset");const Go=this[Jo],$l=this[Jo+7];(Go===void 0||$l===void 0)&&Ol(Jo,this.length-8);const Zl=(Go<<24)+this[++Jo]*2**16+this[++Jo]*2**8+this[++Jo];return(BigInt(Zl)<>>0,Go||Vo(Jo,4,this.length),to.read(this,Jo,!0,23,4)},lo.prototype.readFloatBE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,4,this.length),to.read(this,Jo,!1,23,4)},lo.prototype.readDoubleLE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,8,this.length),to.read(this,Jo,!0,52,8)},lo.prototype.readDoubleBE=function(Jo,Go){return Jo=Jo>>>0,Go||Vo(Jo,8,this.length),to.read(this,Jo,!1,52,8)};function Zo(wl,Jo,Go,$l,Zl,Ul){if(!lo.isBuffer(wl))throw new TypeError('"buffer" argument must be a Buffer instance');if(Jo>Zl||Jowl.length)throw new RangeError("Index out of range")}lo.prototype.writeUintLE=lo.prototype.writeUIntLE=function(Jo,Go,$l,Zl){if(Jo=+Jo,Go=Go>>>0,$l=$l>>>0,!Zl){const Nu=Math.pow(2,8*$l)-1;Zo(this,Jo,Go,$l,Nu,0)}let Ul=1,Gl=0;for(this[Go]=Jo&255;++Gl<$l&&(Ul*=256);)this[Go+Gl]=Jo/Ul&255;return Go+$l},lo.prototype.writeUintBE=lo.prototype.writeUIntBE=function(Jo,Go,$l,Zl){if(Jo=+Jo,Go=Go>>>0,$l=$l>>>0,!Zl){const Nu=Math.pow(2,8*$l)-1;Zo(this,Jo,Go,$l,Nu,0)}let Ul=$l-1,Gl=1;for(this[Go+Ul]=Jo&255;--Ul>=0&&(Gl*=256);)this[Go+Ul]=Jo/Gl&255;return Go+$l},lo.prototype.writeUint8=lo.prototype.writeUInt8=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,1,255,0),this[Go]=Jo&255,Go+1},lo.prototype.writeUint16LE=lo.prototype.writeUInt16LE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,2,65535,0),this[Go]=Jo&255,this[Go+1]=Jo>>>8,Go+2},lo.prototype.writeUint16BE=lo.prototype.writeUInt16BE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,2,65535,0),this[Go]=Jo>>>8,this[Go+1]=Jo&255,Go+2},lo.prototype.writeUint32LE=lo.prototype.writeUInt32LE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,4,4294967295,0),this[Go+3]=Jo>>>24,this[Go+2]=Jo>>>16,this[Go+1]=Jo>>>8,this[Go]=Jo&255,Go+4},lo.prototype.writeUint32BE=lo.prototype.writeUInt32BE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,4,4294967295,0),this[Go]=Jo>>>24,this[Go+1]=Jo>>>16,this[Go+2]=Jo>>>8,this[Go+3]=Jo&255,Go+4};function Qo(wl,Jo,Go,$l,Zl){El(Jo,$l,Zl,wl,Go,7);let Ul=Number(Jo&BigInt(4294967295));wl[Go++]=Ul,Ul=Ul>>8,wl[Go++]=Ul,Ul=Ul>>8,wl[Go++]=Ul,Ul=Ul>>8,wl[Go++]=Ul;let Gl=Number(Jo>>BigInt(32)&BigInt(4294967295));return wl[Go++]=Gl,Gl=Gl>>8,wl[Go++]=Gl,Gl=Gl>>8,wl[Go++]=Gl,Gl=Gl>>8,wl[Go++]=Gl,Go}function qo(wl,Jo,Go,$l,Zl){El(Jo,$l,Zl,wl,Go,7);let Ul=Number(Jo&BigInt(4294967295));wl[Go+7]=Ul,Ul=Ul>>8,wl[Go+6]=Ul,Ul=Ul>>8,wl[Go+5]=Ul,Ul=Ul>>8,wl[Go+4]=Ul;let Gl=Number(Jo>>BigInt(32)&BigInt(4294967295));return wl[Go+3]=Gl,Gl=Gl>>8,wl[Go+2]=Gl,Gl=Gl>>8,wl[Go+1]=Gl,Gl=Gl>>8,wl[Go]=Gl,Go+8}lo.prototype.writeBigUInt64LE=ku(function(Jo,Go=0){return Qo(this,Jo,Go,BigInt(0),BigInt("0xffffffffffffffff"))}),lo.prototype.writeBigUInt64BE=ku(function(Jo,Go=0){return qo(this,Jo,Go,BigInt(0),BigInt("0xffffffffffffffff"))}),lo.prototype.writeIntLE=function(Jo,Go,$l,Zl){if(Jo=+Jo,Go=Go>>>0,!Zl){const hu=Math.pow(2,8*$l-1);Zo(this,Jo,Go,$l,hu-1,-hu)}let Ul=0,Gl=1,Nu=0;for(this[Go]=Jo&255;++Ul<$l&&(Gl*=256);)Jo<0&&Nu===0&&this[Go+Ul-1]!==0&&(Nu=1),this[Go+Ul]=(Jo/Gl>>0)-Nu&255;return Go+$l},lo.prototype.writeIntBE=function(Jo,Go,$l,Zl){if(Jo=+Jo,Go=Go>>>0,!Zl){const hu=Math.pow(2,8*$l-1);Zo(this,Jo,Go,$l,hu-1,-hu)}let Ul=$l-1,Gl=1,Nu=0;for(this[Go+Ul]=Jo&255;--Ul>=0&&(Gl*=256);)Jo<0&&Nu===0&&this[Go+Ul+1]!==0&&(Nu=1),this[Go+Ul]=(Jo/Gl>>0)-Nu&255;return Go+$l},lo.prototype.writeInt8=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,1,127,-128),Jo<0&&(Jo=255+Jo+1),this[Go]=Jo&255,Go+1},lo.prototype.writeInt16LE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,2,32767,-32768),this[Go]=Jo&255,this[Go+1]=Jo>>>8,Go+2},lo.prototype.writeInt16BE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,2,32767,-32768),this[Go]=Jo>>>8,this[Go+1]=Jo&255,Go+2},lo.prototype.writeInt32LE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,4,2147483647,-2147483648),this[Go]=Jo&255,this[Go+1]=Jo>>>8,this[Go+2]=Jo>>>16,this[Go+3]=Jo>>>24,Go+4},lo.prototype.writeInt32BE=function(Jo,Go,$l){return Jo=+Jo,Go=Go>>>0,$l||Zo(this,Jo,Go,4,2147483647,-2147483648),Jo<0&&(Jo=4294967295+Jo+1),this[Go]=Jo>>>24,this[Go+1]=Jo>>>16,this[Go+2]=Jo>>>8,this[Go+3]=Jo&255,Go+4},lo.prototype.writeBigInt64LE=ku(function(Jo,Go=0){return Qo(this,Jo,Go,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),lo.prototype.writeBigInt64BE=ku(function(Jo,Go=0){return qo(this,Jo,Go,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ho(wl,Jo,Go,$l,Zl,Ul){if(Go+$l>wl.length)throw new RangeError("Index out of range");if(Go<0)throw new RangeError("Index out of range")}function $a(wl,Jo,Go,$l,Zl){return Jo=+Jo,Go=Go>>>0,Zl||Ho(wl,Jo,Go,4),to.write(wl,Jo,Go,$l,23,4),Go+4}lo.prototype.writeFloatLE=function(Jo,Go,$l){return $a(this,Jo,Go,!0,$l)},lo.prototype.writeFloatBE=function(Jo,Go,$l){return $a(this,Jo,Go,!1,$l)};function zo(wl,Jo,Go,$l,Zl){return Jo=+Jo,Go=Go>>>0,Zl||Ho(wl,Jo,Go,8),to.write(wl,Jo,Go,$l,52,8),Go+8}lo.prototype.writeDoubleLE=function(Jo,Go,$l){return zo(this,Jo,Go,!0,$l)},lo.prototype.writeDoubleBE=function(Jo,Go,$l){return zo(this,Jo,Go,!1,$l)},lo.prototype.copy=function(Jo,Go,$l,Zl){if(!lo.isBuffer(Jo))throw new TypeError("argument should be a Buffer");if($l||($l=0),!Zl&&Zl!==0&&(Zl=this.length),Go>=Jo.length&&(Go=Jo.length),Go||(Go=0),Zl>0&&Zl<$l&&(Zl=$l),Zl===$l||Jo.length===0||this.length===0)return 0;if(Go<0)throw new RangeError("targetStart out of bounds");if($l<0||$l>=this.length)throw new RangeError("Index out of range");if(Zl<0)throw new RangeError("sourceEnd out of bounds");Zl>this.length&&(Zl=this.length),Jo.length-Go>>0,$l=$l===void 0?this.length:$l>>>0,Jo||(Jo=0);let Ul;if(typeof Jo=="number")for(Ul=Go;Ul<$l;++Ul)this[Ul]=Jo;else{const Gl=lo.isBuffer(Jo)?Jo:lo.from(Jo,Zl),Nu=Gl.length;if(Nu===0)throw new TypeError('The value "'+Jo+'" is invalid for argument "value"');for(Ul=0;Ul<$l-Go;++Ul)this[Ul+Go]=Gl[Ul%Nu]}return this};const Ko={};function _c(wl,Jo,Go){Ko[wl]=class extends Go{constructor(){super(),Object.defineProperty(this,"message",{value:Jo.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${wl}]`,this.stack,delete this.name}get code(){return wl}set code(Zl){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Zl,writable:!0})}toString(){return`${this.name} [${wl}]: ${this.message}`}}}_c("ERR_BUFFER_OUT_OF_BOUNDS",function(wl){return wl?`${wl} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),_c("ERR_INVALID_ARG_TYPE",function(wl,Jo){return`The "${wl}" argument must be of type number. Received type ${typeof Jo}`},TypeError),_c("ERR_OUT_OF_RANGE",function(wl,Jo,Go){let $l=`The value of "${wl}" is out of range.`,Zl=Go;return Number.isInteger(Go)&&Math.abs(Go)>2**32?Zl=Cl(String(Go)):typeof Go=="bigint"&&(Zl=String(Go),(Go>BigInt(2)**BigInt(32)||Go<-(BigInt(2)**BigInt(32)))&&(Zl=Cl(Zl)),Zl+="n"),$l+=` It must be ${Jo}. Received ${Zl}`,$l},RangeError);function Cl(wl){let Jo="",Go=wl.length;const $l=wl[0]==="-"?1:0;for(;Go>=$l+4;Go-=3)Jo=`_${wl.slice(Go-3,Go)}${Jo}`;return`${wl.slice(0,Go)}${Jo}`}function ga(wl,Jo,Go){Al(Jo,"offset"),(wl[Jo]===void 0||wl[Jo+Go]===void 0)&&Ol(Jo,wl.length-(Go+1))}function El(wl,Jo,Go,$l,Zl,Ul){if(wl>Go||wl= 0${Gl} and < 2${Gl} ** ${(Ul+1)*8}${Gl}`:Nu=`>= -(2${Gl} ** ${(Ul+1)*8-1}${Gl}) and < 2 ** ${(Ul+1)*8-1}${Gl}`,new Ko.ERR_OUT_OF_RANGE("value",Nu,wl)}ga($l,Zl,Ul)}function Al(wl,Jo){if(typeof wl!="number")throw new Ko.ERR_INVALID_ARG_TYPE(Jo,"number",wl)}function Ol(wl,Jo,Go){throw Math.floor(wl)!==wl?(Al(wl,Go),new Ko.ERR_OUT_OF_RANGE("offset","an integer",wl)):Jo<0?new Ko.ERR_BUFFER_OUT_OF_BOUNDS:new Ko.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Jo}`,wl)}const Wl=/[^+/0-9A-Za-z-_]/g;function zl(wl){if(wl=wl.split("=")[0],wl=wl.trim().replace(Wl,""),wl.length<2)return"";for(;wl.length%4!==0;)wl=wl+"=";return wl}function Tl(wl,Jo){Jo=Jo||1/0;let Go;const $l=wl.length;let Zl=null;const Ul=[];for(let Gl=0;Gl<$l;++Gl){if(Go=wl.charCodeAt(Gl),Go>55295&&Go<57344){if(!Zl){if(Go>56319){(Jo-=3)>-1&&Ul.push(239,191,189);continue}else if(Gl+1===$l){(Jo-=3)>-1&&Ul.push(239,191,189);continue}Zl=Go;continue}if(Go<56320){(Jo-=3)>-1&&Ul.push(239,191,189),Zl=Go;continue}Go=(Zl-55296<<10|Go-56320)+65536}else Zl&&(Jo-=3)>-1&&Ul.push(239,191,189);if(Zl=null,Go<128){if((Jo-=1)<0)break;Ul.push(Go)}else if(Go<2048){if((Jo-=2)<0)break;Ul.push(Go>>6|192,Go&63|128)}else if(Go<65536){if((Jo-=3)<0)break;Ul.push(Go>>12|224,Go>>6&63|128,Go&63|128)}else if(Go<1114112){if((Jo-=4)<0)break;Ul.push(Go>>18|240,Go>>12&63|128,Go>>6&63|128,Go&63|128)}else throw new Error("Invalid code point")}return Ul}function Ml(wl){const Jo=[];for(let Go=0;Go>8,Zl=Go%256,Ul.push(Zl),Ul.push($l);return Ul}function Vl(wl){return eo.toByteArray(zl(wl))}function Ll(wl,Jo,Go,$l){let Zl;for(Zl=0;Zl<$l&&!(Zl+Go>=Jo.length||Zl>=wl.length);++Zl)Jo[Zl+Go]=wl[Zl];return Zl}function uu(wl,Jo){return wl instanceof Jo||wl!=null&&wl.constructor!=null&&wl.constructor.name!=null&&wl.constructor.name===Jo.name}function ru(wl){return wl!==wl}const tu=function(){const wl="0123456789abcdef",Jo=new Array(256);for(let Go=0;Go<16;++Go){const $l=Go*16;for(let Zl=0;Zl<16;++Zl)Jo[$l+Zl]=wl[Go]+wl[Zl]}return Jo}();function ku(wl){return typeof BigInt>"u"?au:wl}function au(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$3=buffer$2.Buffer,Blob$3=buffer$2.Blob,BlobOptions=buffer$2.BlobOptions,Buffer$1$1=buffer$2.Buffer,File=buffer$2.File,FileOptions=buffer$2.FileOptions,INSPECT_MAX_BYTES=buffer$2.INSPECT_MAX_BYTES,SlowBuffer=buffer$2.SlowBuffer,TranscodeEncoding=buffer$2.TranscodeEncoding,atob$1=buffer$2.atob,btoa$2=buffer$2.btoa,constants$9=buffer$2.constants,isAscii=buffer$2.isAscii,isUtf8=buffer$2.isUtf8,kMaxLength=buffer$2.kMaxLength,kStringMaxLength=buffer$2.kStringMaxLength,resolveObjectURL=buffer$2.resolveObjectURL,transcode=buffer$2.transcode,dist$2=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$3,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$2,constants:constants$9,default:Buffer$3,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));function AxiosError(Xr,eo,to,ro,no){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=Xr,this.name="AxiosError",eo&&(this.code=eo),to&&(this.config=to),ro&&(this.request=ro),no&&(this.response=no,this.status=no.status?no.status:null)}utils$c.inherits(AxiosError,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$c.toJSONObject(this.config),code:this.code,status:this.status}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(Xr=>{descriptors[Xr]={value:Xr}});Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError.from=(Xr,eo,to,ro,no,io)=>{const oo=Object.create(prototype$1);return utils$c.toFlatObject(Xr,oo,function(so){return so!==Error.prototype},ao=>ao!=="isAxiosError"),AxiosError.call(oo,Xr.message,eo,to,ro,no),oo.cause=Xr,oo.name=Xr.name,io&&Object.assign(oo,io),oo};const httpAdapter=null;function isVisitable(Xr){return utils$c.isPlainObject(Xr)||utils$c.isArray(Xr)}function removeBrackets(Xr){return utils$c.endsWith(Xr,"[]")?Xr.slice(0,-2):Xr}function renderKey(Xr,eo,to){return Xr?Xr.concat(eo).map(function(no,io){return no=removeBrackets(no),!to&&io?"["+no+"]":no}).join(to?".":""):eo}function isFlatArray(Xr){return utils$c.isArray(Xr)&&!Xr.some(isVisitable)}const predicates=utils$c.toFlatObject(utils$c,{},null,function(eo){return/^is[A-Z]/.test(eo)});function toFormData(Xr,eo,to){if(!utils$c.isObject(Xr))throw new TypeError("target must be an object");eo=eo||new FormData,to=utils$c.toFlatObject(to,{metaTokens:!0,dots:!1,indexes:!1},!1,function(vo,wo){return!utils$c.isUndefined(wo[vo])});const ro=to.metaTokens,no=to.visitor||lo,io=to.dots,oo=to.indexes,so=(to.Blob||typeof Blob<"u"&&Blob)&&utils$c.isSpecCompliantForm(eo);if(!utils$c.isFunction(no))throw new TypeError("visitor must be a function");function co(yo){if(yo===null)return"";if(utils$c.isDate(yo))return yo.toISOString();if(!so&&utils$c.isBlob(yo))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$c.isArrayBuffer(yo)||utils$c.isTypedArray(yo)?so&&typeof Blob=="function"?new Blob([yo]):Buffer$3.from(yo):yo}function lo(yo,vo,wo){let Eo=yo;if(yo&&!wo&&typeof yo=="object"){if(utils$c.endsWith(vo,"{}"))vo=ro?vo:vo.slice(0,-2),yo=JSON.stringify(yo);else if(utils$c.isArray(yo)&&isFlatArray(yo)||(utils$c.isFileList(yo)||utils$c.endsWith(vo,"[]"))&&(Eo=utils$c.toArray(yo)))return vo=removeBrackets(vo),Eo.forEach(function(Ao,Po){!(utils$c.isUndefined(Ao)||Ao===null)&&eo.append(oo===!0?renderKey([vo],Po,io):oo===null?vo:vo+"[]",co(Ao))}),!1}return isVisitable(yo)?!0:(eo.append(renderKey(wo,vo,io),co(yo)),!1)}const fo=[],ho=Object.assign(predicates,{defaultVisitor:lo,convertValue:co,isVisitable});function go(yo,vo){if(!utils$c.isUndefined(yo)){if(fo.indexOf(yo)!==-1)throw Error("Circular reference detected in "+vo.join("."));fo.push(yo),utils$c.forEach(yo,function(Eo,ko){(!(utils$c.isUndefined(Eo)||Eo===null)&&no.call(eo,Eo,utils$c.isString(ko)?ko.trim():ko,vo,ho))===!0&&go(Eo,vo?vo.concat(ko):[ko])}),fo.pop()}}if(!utils$c.isObject(Xr))throw new TypeError("data must be an object");return go(Xr),eo}function encode$q(Xr){const eo={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(Xr).replace(/[!'()~]|%20|%00/g,function(ro){return eo[ro]})}function AxiosURLSearchParams(Xr,eo){this._pairs=[],Xr&&toFormData(Xr,this,eo)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(eo,to){this._pairs.push([eo,to])};prototype.toString=function(eo){const to=eo?function(ro){return eo.call(this,ro,encode$q)}:encode$q;return this._pairs.map(function(no){return to(no[0])+"="+to(no[1])},"").join("&")};function encode$p(Xr){return encodeURIComponent(Xr).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(Xr,eo,to){if(!eo)return Xr;const ro=to&&to.encode||encode$p,no=to&&to.serialize;let io;if(no?io=no(eo,to):io=utils$c.isURLSearchParams(eo)?eo.toString():new AxiosURLSearchParams(eo,to).toString(ro),io){const oo=Xr.indexOf("#");oo!==-1&&(Xr=Xr.slice(0,oo)),Xr+=(Xr.indexOf("?")===-1?"?":"&")+io}return Xr}class InterceptorManager{constructor(){this.handlers=[]}use(eo,to,ro){return this.handlers.push({fulfilled:eo,rejected:to,synchronous:ro?ro.synchronous:!1,runWhen:ro?ro.runWhen:null}),this.handlers.length-1}eject(eo){this.handlers[eo]&&(this.handlers[eo]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(eo){utils$c.forEach(this.handlers,function(ro){ro!==null&&eo(ro)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$2={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",_navigator=typeof navigator=="object"&&navigator||void 0,hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$b=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,navigator:_navigator,origin},Symbol.toStringTag,{value:"Module"})),platform$1={...utils$b,...platform$2};function toURLEncodedForm(Xr,eo){return toFormData(Xr,new platform$1.classes.URLSearchParams,Object.assign({visitor:function(to,ro,no,io){return platform$1.isNode&&utils$c.isBuffer(to)?(this.append(ro,to.toString("base64")),!1):io.defaultVisitor.apply(this,arguments)}},eo))}function parsePropPath(Xr){return utils$c.matchAll(/\w+|\[(\w*)]/g,Xr).map(eo=>eo[0]==="[]"?"":eo[1]||eo[0])}function arrayToObject(Xr){const eo={},to=Object.keys(Xr);let ro;const no=to.length;let io;for(ro=0;ro=to.length;return oo=!oo&&utils$c.isArray(no)?no.length:oo,so?(utils$c.hasOwnProp(no,oo)?no[oo]=[no[oo],ro]:no[oo]=ro,!ao):((!no[oo]||!utils$c.isObject(no[oo]))&&(no[oo]=[]),eo(to,ro,no[oo],io)&&utils$c.isArray(no[oo])&&(no[oo]=arrayToObject(no[oo])),!ao)}if(utils$c.isFormData(Xr)&&utils$c.isFunction(Xr.entries)){const to={};return utils$c.forEachEntry(Xr,(ro,no)=>{eo(parsePropPath(ro),no,to,0)}),to}return null}function stringifySafely(Xr,eo,to){if(utils$c.isString(Xr))try{return(eo||JSON.parse)(Xr),utils$c.trim(Xr)}catch(ro){if(ro.name!=="SyntaxError")throw ro}return(0,JSON.stringify)(Xr)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(eo,to){const ro=to.getContentType()||"",no=ro.indexOf("application/json")>-1,io=utils$c.isObject(eo);if(io&&utils$c.isHTMLForm(eo)&&(eo=new FormData(eo)),utils$c.isFormData(eo))return no?JSON.stringify(formDataToJSON(eo)):eo;if(utils$c.isArrayBuffer(eo)||utils$c.isBuffer(eo)||utils$c.isStream(eo)||utils$c.isFile(eo)||utils$c.isBlob(eo)||utils$c.isReadableStream(eo))return eo;if(utils$c.isArrayBufferView(eo))return eo.buffer;if(utils$c.isURLSearchParams(eo))return to.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),eo.toString();let ao;if(io){if(ro.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(eo,this.formSerializer).toString();if((ao=utils$c.isFileList(eo))||ro.indexOf("multipart/form-data")>-1){const so=this.env&&this.env.FormData;return toFormData(ao?{"files[]":eo}:eo,so&&new so,this.formSerializer)}}return io||no?(to.setContentType("application/json",!1),stringifySafely(eo)):eo}],transformResponse:[function(eo){const to=this.transitional||defaults.transitional,ro=to&&to.forcedJSONParsing,no=this.responseType==="json";if(utils$c.isResponse(eo)||utils$c.isReadableStream(eo))return eo;if(eo&&utils$c.isString(eo)&&(ro&&!this.responseType||no)){const oo=!(to&&to.silentJSONParsing)&&no;try{return JSON.parse(eo)}catch(ao){if(oo)throw ao.name==="SyntaxError"?AxiosError.from(ao,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):ao}}return eo}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$1.classes.FormData,Blob:platform$1.classes.Blob},validateStatus:function(eo){return eo>=200&&eo<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$c.forEach(["delete","get","head","post","put","patch"],Xr=>{defaults.headers[Xr]={}});const ignoreDuplicateOf=utils$c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders$1=Xr=>{const eo={};let to,ro,no;return Xr&&Xr.split(` -`).forEach(function(oo){no=oo.indexOf(":"),to=oo.substring(0,no).trim().toLowerCase(),ro=oo.substring(no+1).trim(),!(!to||eo[to]&&ignoreDuplicateOf[to])&&(to==="set-cookie"?eo[to]?eo[to].push(ro):eo[to]=[ro]:eo[to]=eo[to]?eo[to]+", "+ro:ro)}),eo},$internals=Symbol("internals");function normalizeHeader(Xr){return Xr&&String(Xr).trim().toLowerCase()}function normalizeValue$1(Xr){return Xr===!1||Xr==null?Xr:utils$c.isArray(Xr)?Xr.map(normalizeValue$1):String(Xr)}function parseTokens(Xr){const eo=Object.create(null),to=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let ro;for(;ro=to.exec(Xr);)eo[ro[1]]=ro[2];return eo}const isValidHeaderName=Xr=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(Xr.trim());function matchHeaderValue(Xr,eo,to,ro,no){if(utils$c.isFunction(ro))return ro.call(this,eo,to);if(no&&(eo=to),!!utils$c.isString(eo)){if(utils$c.isString(ro))return eo.indexOf(ro)!==-1;if(utils$c.isRegExp(ro))return ro.test(eo)}}function formatHeader(Xr){return Xr.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(eo,to,ro)=>to.toUpperCase()+ro)}function buildAccessors(Xr,eo){const to=utils$c.toCamelCase(" "+eo);["get","set","has"].forEach(ro=>{Object.defineProperty(Xr,ro+to,{value:function(no,io,oo){return this[ro].call(this,eo,no,io,oo)},configurable:!0})})}class AxiosHeaders{constructor(eo){eo&&this.set(eo)}set(eo,to,ro){const no=this;function io(ao,so,co){const lo=normalizeHeader(so);if(!lo)throw new Error("header name must be a non-empty string");const fo=utils$c.findKey(no,lo);(!fo||no[fo]===void 0||co===!0||co===void 0&&no[fo]!==!1)&&(no[fo||so]=normalizeValue$1(ao))}const oo=(ao,so)=>utils$c.forEach(ao,(co,lo)=>io(co,lo,so));if(utils$c.isPlainObject(eo)||eo instanceof this.constructor)oo(eo,to);else if(utils$c.isString(eo)&&(eo=eo.trim())&&!isValidHeaderName(eo))oo(parseHeaders$1(eo),to);else if(utils$c.isHeaders(eo))for(const[ao,so]of eo.entries())io(so,ao,ro);else eo!=null&&io(to,eo,ro);return this}get(eo,to){if(eo=normalizeHeader(eo),eo){const ro=utils$c.findKey(this,eo);if(ro){const no=this[ro];if(!to)return no;if(to===!0)return parseTokens(no);if(utils$c.isFunction(to))return to.call(this,no,ro);if(utils$c.isRegExp(to))return to.exec(no);throw new TypeError("parser must be boolean|regexp|function")}}}has(eo,to){if(eo=normalizeHeader(eo),eo){const ro=utils$c.findKey(this,eo);return!!(ro&&this[ro]!==void 0&&(!to||matchHeaderValue(this,this[ro],ro,to)))}return!1}delete(eo,to){const ro=this;let no=!1;function io(oo){if(oo=normalizeHeader(oo),oo){const ao=utils$c.findKey(ro,oo);ao&&(!to||matchHeaderValue(ro,ro[ao],ao,to))&&(delete ro[ao],no=!0)}}return utils$c.isArray(eo)?eo.forEach(io):io(eo),no}clear(eo){const to=Object.keys(this);let ro=to.length,no=!1;for(;ro--;){const io=to[ro];(!eo||matchHeaderValue(this,this[io],io,eo,!0))&&(delete this[io],no=!0)}return no}normalize(eo){const to=this,ro={};return utils$c.forEach(this,(no,io)=>{const oo=utils$c.findKey(ro,io);if(oo){to[oo]=normalizeValue$1(no),delete to[io];return}const ao=eo?formatHeader(io):String(io).trim();ao!==io&&delete to[io],to[ao]=normalizeValue$1(no),ro[ao]=!0}),this}concat(...eo){return this.constructor.concat(this,...eo)}toJSON(eo){const to=Object.create(null);return utils$c.forEach(this,(ro,no)=>{ro!=null&&ro!==!1&&(to[no]=eo&&utils$c.isArray(ro)?ro.join(", "):ro)}),to}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([eo,to])=>eo+": "+to).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(eo){return eo instanceof this?eo:new this(eo)}static concat(eo,...to){const ro=new this(eo);return to.forEach(no=>ro.set(no)),ro}static accessor(eo){const ro=(this[$internals]=this[$internals]={accessors:{}}).accessors,no=this.prototype;function io(oo){const ao=normalizeHeader(oo);ro[ao]||(buildAccessors(no,oo),ro[ao]=!0)}return utils$c.isArray(eo)?eo.forEach(io):io(eo),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$c.reduceDescriptors(AxiosHeaders.prototype,({value:Xr},eo)=>{let to=eo[0].toUpperCase()+eo.slice(1);return{get:()=>Xr,set(ro){this[to]=ro}}});utils$c.freezeMethods(AxiosHeaders);function transformData(Xr,eo){const to=this||defaults,ro=eo||to,no=AxiosHeaders.from(ro.headers);let io=ro.data;return utils$c.forEach(Xr,function(ao){io=ao.call(to,io,no.normalize(),eo?eo.status:void 0)}),no.normalize(),io}function isCancel(Xr){return!!(Xr&&Xr.__CANCEL__)}function CanceledError(Xr,eo,to){AxiosError.call(this,Xr??"canceled",AxiosError.ERR_CANCELED,eo,to),this.name="CanceledError"}utils$c.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(Xr,eo,to){const ro=to.config.validateStatus;!to.status||!ro||ro(to.status)?Xr(to):eo(new AxiosError("Request failed with status code "+to.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(to.status/100)-4],to.config,to.request,to))}function parseProtocol(Xr){const eo=/^([-+\w]{1,25})(:?\/\/|:)/.exec(Xr);return eo&&eo[1]||""}function speedometer(Xr,eo){Xr=Xr||10;const to=new Array(Xr),ro=new Array(Xr);let no=0,io=0,oo;return eo=eo!==void 0?eo:1e3,function(so){const co=Date.now(),lo=ro[io];oo||(oo=co),to[no]=so,ro[no]=co;let fo=io,ho=0;for(;fo!==no;)ho+=to[fo++],fo=fo%Xr;if(no=(no+1)%Xr,no===io&&(io=(io+1)%Xr),co-oo{to=lo,no=null,io&&(clearTimeout(io),io=null),Xr.apply(null,co)};return[(...co)=>{const lo=Date.now(),fo=lo-to;fo>=ro?oo(co,lo):(no=co,io||(io=setTimeout(()=>{io=null,oo(no)},ro-fo)))},()=>no&&oo(no)]}const progressEventReducer=(Xr,eo,to=3)=>{let ro=0;const no=speedometer(50,250);return throttle(io=>{const oo=io.loaded,ao=io.lengthComputable?io.total:void 0,so=oo-ro,co=no(so),lo=oo<=ao;ro=oo;const fo={loaded:oo,total:ao,progress:ao?oo/ao:void 0,bytes:so,rate:co||void 0,estimated:co&&ao&&lo?(ao-oo)/co:void 0,event:io,lengthComputable:ao!=null,[eo?"download":"upload"]:!0};Xr(fo)},to)},progressEventDecorator=(Xr,eo)=>{const to=Xr!=null;return[ro=>eo[0]({lengthComputable:to,total:Xr,loaded:ro}),eo[1]]},asyncDecorator=Xr=>(...eo)=>utils$c.asap(()=>Xr(...eo)),isURLSameOrigin=platform$1.hasStandardBrowserEnv?function(){const eo=platform$1.navigator&&/(msie|trident)/i.test(platform$1.navigator.userAgent),to=document.createElement("a");let ro;function no(io){let oo=io;return eo&&(to.setAttribute("href",oo),oo=to.href),to.setAttribute("href",oo),{href:to.href,protocol:to.protocol?to.protocol.replace(/:$/,""):"",host:to.host,search:to.search?to.search.replace(/^\?/,""):"",hash:to.hash?to.hash.replace(/^#/,""):"",hostname:to.hostname,port:to.port,pathname:to.pathname.charAt(0)==="/"?to.pathname:"/"+to.pathname}}return ro=no(window.location.href),function(oo){const ao=utils$c.isString(oo)?no(oo):oo;return ao.protocol===ro.protocol&&ao.host===ro.host}}():function(){return function(){return!0}}(),cookies=platform$1.hasStandardBrowserEnv?{write(Xr,eo,to,ro,no,io){const oo=[Xr+"="+encodeURIComponent(eo)];utils$c.isNumber(to)&&oo.push("expires="+new Date(to).toGMTString()),utils$c.isString(ro)&&oo.push("path="+ro),utils$c.isString(no)&&oo.push("domain="+no),io===!0&&oo.push("secure"),document.cookie=oo.join("; ")},read(Xr){const eo=document.cookie.match(new RegExp("(^|;\\s*)("+Xr+")=([^;]*)"));return eo?decodeURIComponent(eo[3]):null},remove(Xr){this.write(Xr,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(Xr){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(Xr)}function combineURLs(Xr,eo){return eo?Xr.replace(/\/?\/$/,"")+"/"+eo.replace(/^\/+/,""):Xr}function buildFullPath(Xr,eo){return Xr&&!isAbsoluteURL(eo)?combineURLs(Xr,eo):eo}const headersToObject=Xr=>Xr instanceof AxiosHeaders?{...Xr}:Xr;function mergeConfig(Xr,eo){eo=eo||{};const to={};function ro(co,lo,fo){return utils$c.isPlainObject(co)&&utils$c.isPlainObject(lo)?utils$c.merge.call({caseless:fo},co,lo):utils$c.isPlainObject(lo)?utils$c.merge({},lo):utils$c.isArray(lo)?lo.slice():lo}function no(co,lo,fo){if(utils$c.isUndefined(lo)){if(!utils$c.isUndefined(co))return ro(void 0,co,fo)}else return ro(co,lo,fo)}function io(co,lo){if(!utils$c.isUndefined(lo))return ro(void 0,lo)}function oo(co,lo){if(utils$c.isUndefined(lo)){if(!utils$c.isUndefined(co))return ro(void 0,co)}else return ro(void 0,lo)}function ao(co,lo,fo){if(fo in eo)return ro(co,lo);if(fo in Xr)return ro(void 0,co)}const so={url:io,method:io,data:io,baseURL:oo,transformRequest:oo,transformResponse:oo,paramsSerializer:oo,timeout:oo,timeoutMessage:oo,withCredentials:oo,withXSRFToken:oo,adapter:oo,responseType:oo,xsrfCookieName:oo,xsrfHeaderName:oo,onUploadProgress:oo,onDownloadProgress:oo,decompress:oo,maxContentLength:oo,maxBodyLength:oo,beforeRedirect:oo,transport:oo,httpAgent:oo,httpsAgent:oo,cancelToken:oo,socketPath:oo,responseEncoding:oo,validateStatus:ao,headers:(co,lo)=>no(headersToObject(co),headersToObject(lo),!0)};return utils$c.forEach(Object.keys(Object.assign({},Xr,eo)),function(lo){const fo=so[lo]||no,ho=fo(Xr[lo],eo[lo],lo);utils$c.isUndefined(ho)&&fo!==ao||(to[lo]=ho)}),to}const resolveConfig=Xr=>{const eo=mergeConfig({},Xr);let{data:to,withXSRFToken:ro,xsrfHeaderName:no,xsrfCookieName:io,headers:oo,auth:ao}=eo;eo.headers=oo=AxiosHeaders.from(oo),eo.url=buildURL(buildFullPath(eo.baseURL,eo.url),Xr.params,Xr.paramsSerializer),ao&&oo.set("Authorization","Basic "+btoa((ao.username||"")+":"+(ao.password?unescape(encodeURIComponent(ao.password)):"")));let so;if(utils$c.isFormData(to)){if(platform$1.hasStandardBrowserEnv||platform$1.hasStandardBrowserWebWorkerEnv)oo.setContentType(void 0);else if((so=oo.getContentType())!==!1){const[co,...lo]=so?so.split(";").map(fo=>fo.trim()).filter(Boolean):[];oo.setContentType([co||"multipart/form-data",...lo].join("; "))}}if(platform$1.hasStandardBrowserEnv&&(ro&&utils$c.isFunction(ro)&&(ro=ro(eo)),ro||ro!==!1&&isURLSameOrigin(eo.url))){const co=no&&io&&cookies.read(io);co&&oo.set(no,co)}return eo},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(Xr){return new Promise(function(to,ro){const no=resolveConfig(Xr);let io=no.data;const oo=AxiosHeaders.from(no.headers).normalize();let{responseType:ao,onUploadProgress:so,onDownloadProgress:co}=no,lo,fo,ho,go,yo;function vo(){go&&go(),yo&&yo(),no.cancelToken&&no.cancelToken.unsubscribe(lo),no.signal&&no.signal.removeEventListener("abort",lo)}let wo=new XMLHttpRequest;wo.open(no.method.toUpperCase(),no.url,!0),wo.timeout=no.timeout;function Eo(){if(!wo)return;const Ao=AxiosHeaders.from("getAllResponseHeaders"in wo&&wo.getAllResponseHeaders()),jo={data:!ao||ao==="text"||ao==="json"?wo.responseText:wo.response,status:wo.status,statusText:wo.statusText,headers:Ao,config:Xr,request:wo};settle(function(No){to(No),vo()},function(No){ro(No),vo()},jo),wo=null}"onloadend"in wo?wo.onloadend=Eo:wo.onreadystatechange=function(){!wo||wo.readyState!==4||wo.status===0&&!(wo.responseURL&&wo.responseURL.indexOf("file:")===0)||setTimeout(Eo)},wo.onabort=function(){wo&&(ro(new AxiosError("Request aborted",AxiosError.ECONNABORTED,Xr,wo)),wo=null)},wo.onerror=function(){ro(new AxiosError("Network Error",AxiosError.ERR_NETWORK,Xr,wo)),wo=null},wo.ontimeout=function(){let Po=no.timeout?"timeout of "+no.timeout+"ms exceeded":"timeout exceeded";const jo=no.transitional||transitionalDefaults;no.timeoutErrorMessage&&(Po=no.timeoutErrorMessage),ro(new AxiosError(Po,jo.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,Xr,wo)),wo=null},io===void 0&&oo.setContentType(null),"setRequestHeader"in wo&&utils$c.forEach(oo.toJSON(),function(Po,jo){wo.setRequestHeader(jo,Po)}),utils$c.isUndefined(no.withCredentials)||(wo.withCredentials=!!no.withCredentials),ao&&ao!=="json"&&(wo.responseType=no.responseType),co&&([ho,yo]=progressEventReducer(co,!0),wo.addEventListener("progress",ho)),so&&wo.upload&&([fo,go]=progressEventReducer(so),wo.upload.addEventListener("progress",fo),wo.upload.addEventListener("loadend",go)),(no.cancelToken||no.signal)&&(lo=Ao=>{wo&&(ro(!Ao||Ao.type?new CanceledError(null,Xr,wo):Ao),wo.abort(),wo=null)},no.cancelToken&&no.cancelToken.subscribe(lo),no.signal&&(no.signal.aborted?lo():no.signal.addEventListener("abort",lo)));const ko=parseProtocol(no.url);if(ko&&platform$1.protocols.indexOf(ko)===-1){ro(new AxiosError("Unsupported protocol "+ko+":",AxiosError.ERR_BAD_REQUEST,Xr));return}wo.send(io||null)})},composeSignals=(Xr,eo)=>{const{length:to}=Xr=Xr?Xr.filter(Boolean):[];if(eo||to){let ro=new AbortController,no;const io=function(co){if(!no){no=!0,ao();const lo=co instanceof Error?co:this.reason;ro.abort(lo instanceof AxiosError?lo:new CanceledError(lo instanceof Error?lo.message:lo))}};let oo=eo&&setTimeout(()=>{oo=null,io(new AxiosError(`timeout ${eo} of ms exceeded`,AxiosError.ETIMEDOUT))},eo);const ao=()=>{Xr&&(oo&&clearTimeout(oo),oo=null,Xr.forEach(co=>{co.unsubscribe?co.unsubscribe(io):co.removeEventListener("abort",io)}),Xr=null)};Xr.forEach(co=>co.addEventListener("abort",io));const{signal:so}=ro;return so.unsubscribe=()=>utils$c.asap(ao),so}},streamChunk=function*(Xr,eo){let to=Xr.byteLength;if(to{const no=readBytes(Xr,eo);let io=0,oo,ao=so=>{oo||(oo=!0,ro&&ro(so))};return new ReadableStream({async pull(so){try{const{done:co,value:lo}=await no.next();if(co){ao(),so.close();return}let fo=lo.byteLength;if(to){let ho=io+=fo;to(ho)}so.enqueue(new Uint8Array(lo))}catch(co){throw ao(co),co}},cancel(so){return ao(so),no.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(Xr=>eo=>Xr.encode(eo))(new TextEncoder):async Xr=>new Uint8Array(await new Response(Xr).arrayBuffer())),test=(Xr,...eo)=>{try{return!!Xr(...eo)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let Xr=!1;const eo=new Request(platform$1.origin,{body:new ReadableStream,method:"POST",get duplex(){return Xr=!0,"half"}}).headers.has("Content-Type");return Xr&&!eo}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$c.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(Xr=>Xr.body)};isFetchSupported&&(Xr=>{["text","arrayBuffer","blob","formData","stream"].forEach(eo=>{!resolvers[eo]&&(resolvers[eo]=utils$c.isFunction(Xr[eo])?to=>to[eo]():(to,ro)=>{throw new AxiosError(`Response type '${eo}' is not supported`,AxiosError.ERR_NOT_SUPPORT,ro)})})})(new Response);const getBodyLength=async Xr=>{if(Xr==null)return 0;if(utils$c.isBlob(Xr))return Xr.size;if(utils$c.isSpecCompliantForm(Xr))return(await new Request(platform$1.origin,{method:"POST",body:Xr}).arrayBuffer()).byteLength;if(utils$c.isArrayBufferView(Xr)||utils$c.isArrayBuffer(Xr))return Xr.byteLength;if(utils$c.isURLSearchParams(Xr)&&(Xr=Xr+""),utils$c.isString(Xr))return(await encodeText(Xr)).byteLength},resolveBodyLength=async(Xr,eo)=>{const to=utils$c.toFiniteNumber(Xr.getContentLength());return to??getBodyLength(eo)},fetchAdapter=isFetchSupported&&(async Xr=>{let{url:eo,method:to,data:ro,signal:no,cancelToken:io,timeout:oo,onDownloadProgress:ao,onUploadProgress:so,responseType:co,headers:lo,withCredentials:fo="same-origin",fetchOptions:ho}=resolveConfig(Xr);co=co?(co+"").toLowerCase():"text";let go=composeSignals([no,io&&io.toAbortSignal()],oo),yo;const vo=go&&go.unsubscribe&&(()=>{go.unsubscribe()});let wo;try{if(so&&supportsRequestStream&&to!=="get"&&to!=="head"&&(wo=await resolveBodyLength(lo,ro))!==0){let jo=new Request(eo,{method:"POST",body:ro,duplex:"half"}),Mo;if(utils$c.isFormData(ro)&&(Mo=jo.headers.get("content-type"))&&lo.setContentType(Mo),jo.body){const[No,Do]=progressEventDecorator(wo,progressEventReducer(asyncDecorator(so)));ro=trackStream(jo.body,DEFAULT_CHUNK_SIZE,No,Do)}}utils$c.isString(fo)||(fo=fo?"include":"omit");const Eo="credentials"in Request.prototype;yo=new Request(eo,{...ho,signal:go,method:to.toUpperCase(),headers:lo.normalize().toJSON(),body:ro,duplex:"half",credentials:Eo?fo:void 0});let ko=await fetch(yo);const Ao=supportsResponseStream&&(co==="stream"||co==="response");if(supportsResponseStream&&(ao||Ao&&vo)){const jo={};["status","statusText","headers"].forEach(Fo=>{jo[Fo]=ko[Fo]});const Mo=utils$c.toFiniteNumber(ko.headers.get("content-length")),[No,Do]=ao&&progressEventDecorator(Mo,progressEventReducer(asyncDecorator(ao),!0))||[];ko=new Response(trackStream(ko.body,DEFAULT_CHUNK_SIZE,No,()=>{Do&&Do(),vo&&vo()}),jo)}co=co||"text";let Po=await resolvers[utils$c.findKey(resolvers,co)||"text"](ko,Xr);return!Ao&&vo&&vo(),await new Promise((jo,Mo)=>{settle(jo,Mo,{data:Po,headers:AxiosHeaders.from(ko.headers),status:ko.status,statusText:ko.statusText,config:Xr,request:yo})})}catch(Eo){throw vo&&vo(),Eo&&Eo.name==="TypeError"&&/fetch/i.test(Eo.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,Xr,yo),{cause:Eo.cause||Eo}):AxiosError.from(Eo,Eo&&Eo.code,Xr,yo)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$c.forEach(knownAdapters,(Xr,eo)=>{if(Xr){try{Object.defineProperty(Xr,"name",{value:eo})}catch{}Object.defineProperty(Xr,"adapterName",{value:eo})}});const renderReason=Xr=>`- ${Xr}`,isResolvedHandle=Xr=>utils$c.isFunction(Xr)||Xr===null||Xr===!1,adapters={getAdapter:Xr=>{Xr=utils$c.isArray(Xr)?Xr:[Xr];const{length:eo}=Xr;let to,ro;const no={};for(let io=0;io`adapter ${ao} `+(so===!1?"is not supported by the environment":"is not available in the build"));let oo=eo?io.length>1?`since : + */(function(Xr){const eo=base64Js$1,to=ieee754,ro=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xr.Buffer=lo,Xr.SlowBuffer=jo,Xr.INSPECT_MAX_BYTES=50;const no=2147483647;Xr.kMaxLength=no;const{Uint8Array:io,ArrayBuffer:oo,SharedArrayBuffer:ao}=globalThis;lo.TYPED_ARRAY_SUPPORT=so(),!lo.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function so(){try{const _l=new io(1),Go={foo:function(){return 42}};return Object.setPrototypeOf(Go,io.prototype),Object.setPrototypeOf(_l,Go),_l.foo()===42}catch{return!1}}Object.defineProperty(lo.prototype,"parent",{enumerable:!0,get:function(){if(lo.isBuffer(this))return this.buffer}}),Object.defineProperty(lo.prototype,"offset",{enumerable:!0,get:function(){if(lo.isBuffer(this))return this.byteOffset}});function co(_l){if(_l>no)throw new RangeError('The value "'+_l+'" is invalid for option "size"');const Go=new io(_l);return Object.setPrototypeOf(Go,lo.prototype),Go}function lo(_l,Go,yl){if(typeof _l=="number"){if(typeof Go=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bo(_l)}return uo(_l,Go,yl)}lo.poolSize=8192;function uo(_l,Go,yl){if(typeof _l=="string")return wo(_l,Go);if(oo.isView(_l))return $o(_l);if(_l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _l);if(Xl(_l,oo)||_l&&Xl(_l.buffer,oo)||typeof ao<"u"&&(Xl(_l,ao)||_l&&Xl(_l.buffer,ao)))return Co(_l,Go,yl);if(typeof _l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Al=_l.valueOf&&_l.valueOf();if(Al!=null&&Al!==_l)return lo.from(Al,Go,yl);const Ul=Ro(_l);if(Ul)return Ul;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _l[Symbol.toPrimitive]=="function")return lo.from(_l[Symbol.toPrimitive]("string"),Go,yl);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _l)}lo.from=function(_l,Go,yl){return uo(_l,Go,yl)},Object.setPrototypeOf(lo.prototype,io.prototype),Object.setPrototypeOf(lo,io);function ho(_l){if(typeof _l!="number")throw new TypeError('"size" argument must be of type number');if(_l<0)throw new RangeError('The value "'+_l+'" is invalid for option "size"')}function go(_l,Go,yl){return ho(_l),_l<=0?co(_l):Go!==void 0?typeof yl=="string"?co(_l).fill(Go,yl):co(_l).fill(Go):co(_l)}lo.alloc=function(_l,Go,yl){return go(_l,Go,yl)};function bo(_l){return ho(_l),co(_l<0?0:Oo(_l)|0)}lo.allocUnsafe=function(_l){return bo(_l)},lo.allocUnsafeSlow=function(_l){return bo(_l)};function wo(_l,Go){if((typeof Go!="string"||Go==="")&&(Go="utf8"),!lo.isEncoding(Go))throw new TypeError("Unknown encoding: "+Go);const yl=Bo(_l,Go)|0;let Al=co(yl);const Ul=Al.write(_l,Go);return Ul!==yl&&(Al=Al.slice(0,Ul)),Al}function Eo(_l){const Go=_l.length<0?0:Oo(_l.length)|0,yl=co(Go);for(let Al=0;Al=no)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+no.toString(16)+" bytes");return _l|0}function jo(_l){return+_l!=_l&&(_l=0),lo.alloc(+_l)}lo.isBuffer=function(Go){return Go!=null&&Go._isBuffer===!0&&Go!==lo.prototype},lo.compare=function(Go,yl){if(Xl(Go,io)&&(Go=lo.from(Go,Go.offset,Go.byteLength)),Xl(yl,io)&&(yl=lo.from(yl,yl.offset,yl.byteLength)),!lo.isBuffer(Go)||!lo.isBuffer(yl))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Go===yl)return 0;let Al=Go.length,Ul=yl.length;for(let su=0,Ql=Math.min(Al,Ul);suUl.length?(lo.isBuffer(Ql)||(Ql=lo.from(Ql)),Ql.copy(Ul,su)):io.prototype.set.call(Ul,Ql,su);else if(lo.isBuffer(Ql))Ql.copy(Ul,su);else throw new TypeError('"list" argument must be an Array of Buffers');su+=Ql.length}return Ul};function Bo(_l,Go){if(lo.isBuffer(_l))return _l.length;if(oo.isView(_l)||Xl(_l,oo))return _l.byteLength;if(typeof _l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _l);const yl=_l.length,Al=arguments.length>2&&arguments[2]===!0;if(!Al&&yl===0)return 0;let Ul=!1;for(;;)switch(Go){case"ascii":case"latin1":case"binary":return yl;case"utf8":case"utf-8":return Dl(_l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yl*2;case"hex":return yl>>>1;case"base64":return cu(_l).length;default:if(Ul)return Al?-1:Dl(_l).length;Go=(""+Go).toLowerCase(),Ul=!0}}lo.byteLength=Bo;function Mo(_l,Go,yl){let Al=!1;if((Go===void 0||Go<0)&&(Go=0),Go>this.length||((yl===void 0||yl>this.length)&&(yl=this.length),yl<=0)||(yl>>>=0,Go>>>=0,yl<=Go))return"";for(_l||(_l="utf8");;)switch(_l){case"hex":return Do(this,Go,yl);case"utf8":case"utf-8":return To(this,Go,yl);case"ascii":return mo(this,Go,yl);case"latin1":case"binary":return Io(this,Go,yl);case"base64":return So(this,Go,yl);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lo(this,Go,yl);default:if(Al)throw new TypeError("Unknown encoding: "+_l);_l=(_l+"").toLowerCase(),Al=!0}}lo.prototype._isBuffer=!0;function Fo(_l,Go,yl){const Al=_l[Go];_l[Go]=_l[yl],_l[yl]=Al}lo.prototype.swap16=function(){const Go=this.length;if(Go%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let yl=0;ylyl&&(Go+=" ... "),""},ro&&(lo.prototype[ro]=lo.prototype.inspect),lo.prototype.compare=function(Go,yl,Al,Ul,su){if(Xl(Go,io)&&(Go=lo.from(Go,Go.offset,Go.byteLength)),!lo.isBuffer(Go))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Go);if(yl===void 0&&(yl=0),Al===void 0&&(Al=Go?Go.length:0),Ul===void 0&&(Ul=0),su===void 0&&(su=this.length),yl<0||Al>Go.length||Ul<0||su>this.length)throw new RangeError("out of range index");if(Ul>=su&&yl>=Al)return 0;if(Ul>=su)return-1;if(yl>=Al)return 1;if(yl>>>=0,Al>>>=0,Ul>>>=0,su>>>=0,this===Go)return 0;let Ql=su-Ul,vu=Al-yl;const qu=Math.min(Ql,vu),pu=this.slice(Ul,su),xu=Go.slice(yl,Al);for(let Au=0;Au2147483647?yl=2147483647:yl<-2147483648&&(yl=-2147483648),yl=+yl,ku(yl)&&(yl=Ul?0:_l.length-1),yl<0&&(yl=_l.length+yl),yl>=_l.length){if(Ul)return-1;yl=_l.length-1}else if(yl<0)if(Ul)yl=0;else return-1;if(typeof Go=="string"&&(Go=lo.from(Go,Al)),lo.isBuffer(Go))return Go.length===0?-1:Jo(_l,Go,yl,Al,Ul);if(typeof Go=="number")return Go=Go&255,typeof io.prototype.indexOf=="function"?Ul?io.prototype.indexOf.call(_l,Go,yl):io.prototype.lastIndexOf.call(_l,Go,yl):Jo(_l,[Go],yl,Al,Ul);throw new TypeError("val must be string, number or Buffer")}function Jo(_l,Go,yl,Al,Ul){let su=1,Ql=_l.length,vu=Go.length;if(Al!==void 0&&(Al=String(Al).toLowerCase(),Al==="ucs2"||Al==="ucs-2"||Al==="utf16le"||Al==="utf-16le")){if(_l.length<2||Go.length<2)return-1;su=2,Ql/=2,vu/=2,yl/=2}function qu(xu,Au){return su===1?xu[Au]:xu.readUInt16BE(Au*su)}let pu;if(Ul){let xu=-1;for(pu=yl;puQl&&(yl=Ql-vu),pu=yl;pu>=0;pu--){let xu=!0;for(let Au=0;AuUl&&(Al=Ul)):Al=Ul;const su=Go.length;Al>su/2&&(Al=su/2);let Ql;for(Ql=0;Ql>>0,isFinite(Al)?(Al=Al>>>0,Ul===void 0&&(Ul="utf8")):(Ul=Al,Al=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const su=this.length-yl;if((Al===void 0||Al>su)&&(Al=su),Go.length>0&&(Al<0||yl<0)||yl>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ul||(Ul="utf8");let Ql=!1;for(;;)switch(Ul){case"hex":return Po(this,Go,yl,Al);case"utf8":case"utf-8":return fo(this,Go,yl,Al);case"ascii":case"latin1":case"binary":return yo(this,Go,yl,Al);case"base64":return vo(this,Go,yl,Al);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _o(this,Go,yl,Al);default:if(Ql)throw new TypeError("Unknown encoding: "+Ul);Ul=(""+Ul).toLowerCase(),Ql=!0}},lo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function So(_l,Go,yl){return Go===0&&yl===_l.length?eo.fromByteArray(_l):eo.fromByteArray(_l.slice(Go,yl))}function To(_l,Go,yl){yl=Math.min(_l.length,yl);const Al=[];let Ul=Go;for(;Ul239?4:su>223?3:su>191?2:1;if(Ul+vu<=yl){let qu,pu,xu,Au;switch(vu){case 1:su<128&&(Ql=su);break;case 2:qu=_l[Ul+1],(qu&192)===128&&(Au=(su&31)<<6|qu&63,Au>127&&(Ql=Au));break;case 3:qu=_l[Ul+1],pu=_l[Ul+2],(qu&192)===128&&(pu&192)===128&&(Au=(su&15)<<12|(qu&63)<<6|pu&63,Au>2047&&(Au<55296||Au>57343)&&(Ql=Au));break;case 4:qu=_l[Ul+1],pu=_l[Ul+2],xu=_l[Ul+3],(qu&192)===128&&(pu&192)===128&&(xu&192)===128&&(Au=(su&15)<<18|(qu&63)<<12|(pu&63)<<6|xu&63,Au>65535&&Au<1114112&&(Ql=Au))}}Ql===null?(Ql=65533,vu=1):Ql>65535&&(Ql-=65536,Al.push(Ql>>>10&1023|55296),Ql=56320|Ql&1023),Al.push(Ql),Ul+=vu}return ko(Al)}const Ao=4096;function ko(_l){const Go=_l.length;if(Go<=Ao)return String.fromCharCode.apply(String,_l);let yl="",Al=0;for(;AlAl)&&(yl=Al);let Ul="";for(let su=Go;suAl&&(Go=Al),yl<0?(yl+=Al,yl<0&&(yl=0)):yl>Al&&(yl=Al),ylyl)throw new RangeError("Trying to access beyond buffer length")}lo.prototype.readUintLE=lo.prototype.readUIntLE=function(Go,yl,Al){Go=Go>>>0,yl=yl>>>0,Al||Ho(Go,yl,this.length);let Ul=this[Go],su=1,Ql=0;for(;++Ql>>0,yl=yl>>>0,Al||Ho(Go,yl,this.length);let Ul=this[Go+--yl],su=1;for(;yl>0&&(su*=256);)Ul+=this[Go+--yl]*su;return Ul},lo.prototype.readUint8=lo.prototype.readUInt8=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,1,this.length),this[Go]},lo.prototype.readUint16LE=lo.prototype.readUInt16LE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,2,this.length),this[Go]|this[Go+1]<<8},lo.prototype.readUint16BE=lo.prototype.readUInt16BE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,2,this.length),this[Go]<<8|this[Go+1]},lo.prototype.readUint32LE=lo.prototype.readUInt32LE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,4,this.length),(this[Go]|this[Go+1]<<8|this[Go+2]<<16)+this[Go+3]*16777216},lo.prototype.readUint32BE=lo.prototype.readUInt32BE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,4,this.length),this[Go]*16777216+(this[Go+1]<<16|this[Go+2]<<8|this[Go+3])},lo.prototype.readBigUInt64LE=hu(function(Go){Go=Go>>>0,Il(Go,"offset");const yl=this[Go],Al=this[Go+7];(yl===void 0||Al===void 0)&&Zl(Go,this.length-8);const Ul=yl+this[++Go]*2**8+this[++Go]*2**16+this[++Go]*2**24,su=this[++Go]+this[++Go]*2**8+this[++Go]*2**16+Al*2**24;return BigInt(Ul)+(BigInt(su)<>>0,Il(Go,"offset");const yl=this[Go],Al=this[Go+7];(yl===void 0||Al===void 0)&&Zl(Go,this.length-8);const Ul=yl*2**24+this[++Go]*2**16+this[++Go]*2**8+this[++Go],su=this[++Go]*2**24+this[++Go]*2**16+this[++Go]*2**8+Al;return(BigInt(Ul)<>>0,yl=yl>>>0,Al||Ho(Go,yl,this.length);let Ul=this[Go],su=1,Ql=0;for(;++Ql=su&&(Ul-=Math.pow(2,8*yl)),Ul},lo.prototype.readIntBE=function(Go,yl,Al){Go=Go>>>0,yl=yl>>>0,Al||Ho(Go,yl,this.length);let Ul=yl,su=1,Ql=this[Go+--Ul];for(;Ul>0&&(su*=256);)Ql+=this[Go+--Ul]*su;return su*=128,Ql>=su&&(Ql-=Math.pow(2,8*yl)),Ql},lo.prototype.readInt8=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,1,this.length),this[Go]&128?(255-this[Go]+1)*-1:this[Go]},lo.prototype.readInt16LE=function(Go,yl){Go=Go>>>0,yl||Ho(Go,2,this.length);const Al=this[Go]|this[Go+1]<<8;return Al&32768?Al|4294901760:Al},lo.prototype.readInt16BE=function(Go,yl){Go=Go>>>0,yl||Ho(Go,2,this.length);const Al=this[Go+1]|this[Go]<<8;return Al&32768?Al|4294901760:Al},lo.prototype.readInt32LE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,4,this.length),this[Go]|this[Go+1]<<8|this[Go+2]<<16|this[Go+3]<<24},lo.prototype.readInt32BE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,4,this.length),this[Go]<<24|this[Go+1]<<16|this[Go+2]<<8|this[Go+3]},lo.prototype.readBigInt64LE=hu(function(Go){Go=Go>>>0,Il(Go,"offset");const yl=this[Go],Al=this[Go+7];(yl===void 0||Al===void 0)&&Zl(Go,this.length-8);const Ul=this[Go+4]+this[Go+5]*2**8+this[Go+6]*2**16+(Al<<24);return(BigInt(Ul)<>>0,Il(Go,"offset");const yl=this[Go],Al=this[Go+7];(yl===void 0||Al===void 0)&&Zl(Go,this.length-8);const Ul=(yl<<24)+this[++Go]*2**16+this[++Go]*2**8+this[++Go];return(BigInt(Ul)<>>0,yl||Ho(Go,4,this.length),to.read(this,Go,!0,23,4)},lo.prototype.readFloatBE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,4,this.length),to.read(this,Go,!1,23,4)},lo.prototype.readDoubleLE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,8,this.length),to.read(this,Go,!0,52,8)},lo.prototype.readDoubleBE=function(Go,yl){return Go=Go>>>0,yl||Ho(Go,8,this.length),to.read(this,Go,!1,52,8)};function Yo(_l,Go,yl,Al,Ul,su){if(!lo.isBuffer(_l))throw new TypeError('"buffer" argument must be a Buffer instance');if(Go>Ul||Go_l.length)throw new RangeError("Index out of range")}lo.prototype.writeUintLE=lo.prototype.writeUIntLE=function(Go,yl,Al,Ul){if(Go=+Go,yl=yl>>>0,Al=Al>>>0,!Ul){const vu=Math.pow(2,8*Al)-1;Yo(this,Go,yl,Al,vu,0)}let su=1,Ql=0;for(this[yl]=Go&255;++Ql>>0,Al=Al>>>0,!Ul){const vu=Math.pow(2,8*Al)-1;Yo(this,Go,yl,Al,vu,0)}let su=Al-1,Ql=1;for(this[yl+su]=Go&255;--su>=0&&(Ql*=256);)this[yl+su]=Go/Ql&255;return yl+Al},lo.prototype.writeUint8=lo.prototype.writeUInt8=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,1,255,0),this[yl]=Go&255,yl+1},lo.prototype.writeUint16LE=lo.prototype.writeUInt16LE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,2,65535,0),this[yl]=Go&255,this[yl+1]=Go>>>8,yl+2},lo.prototype.writeUint16BE=lo.prototype.writeUInt16BE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,2,65535,0),this[yl]=Go>>>8,this[yl+1]=Go&255,yl+2},lo.prototype.writeUint32LE=lo.prototype.writeUInt32LE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,4,4294967295,0),this[yl+3]=Go>>>24,this[yl+2]=Go>>>16,this[yl+1]=Go>>>8,this[yl]=Go&255,yl+4},lo.prototype.writeUint32BE=lo.prototype.writeUInt32BE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,4,4294967295,0),this[yl]=Go>>>24,this[yl+1]=Go>>>16,this[yl+2]=Go>>>8,this[yl+3]=Go&255,yl+4};function Xo(_l,Go,yl,Al,Ul){Tl(Go,Al,Ul,_l,yl,7);let su=Number(Go&BigInt(4294967295));_l[yl++]=su,su=su>>8,_l[yl++]=su,su=su>>8,_l[yl++]=su,su=su>>8,_l[yl++]=su;let Ql=Number(Go>>BigInt(32)&BigInt(4294967295));return _l[yl++]=Ql,Ql=Ql>>8,_l[yl++]=Ql,Ql=Ql>>8,_l[yl++]=Ql,Ql=Ql>>8,_l[yl++]=Ql,yl}function qo(_l,Go,yl,Al,Ul){Tl(Go,Al,Ul,_l,yl,7);let su=Number(Go&BigInt(4294967295));_l[yl+7]=su,su=su>>8,_l[yl+6]=su,su=su>>8,_l[yl+5]=su,su=su>>8,_l[yl+4]=su;let Ql=Number(Go>>BigInt(32)&BigInt(4294967295));return _l[yl+3]=Ql,Ql=Ql>>8,_l[yl+2]=Ql,Ql=Ql>>8,_l[yl+1]=Ql,Ql=Ql>>8,_l[yl]=Ql,yl+8}lo.prototype.writeBigUInt64LE=hu(function(Go,yl=0){return Xo(this,Go,yl,BigInt(0),BigInt("0xffffffffffffffff"))}),lo.prototype.writeBigUInt64BE=hu(function(Go,yl=0){return qo(this,Go,yl,BigInt(0),BigInt("0xffffffffffffffff"))}),lo.prototype.writeIntLE=function(Go,yl,Al,Ul){if(Go=+Go,yl=yl>>>0,!Ul){const qu=Math.pow(2,8*Al-1);Yo(this,Go,yl,Al,qu-1,-qu)}let su=0,Ql=1,vu=0;for(this[yl]=Go&255;++su>0)-vu&255;return yl+Al},lo.prototype.writeIntBE=function(Go,yl,Al,Ul){if(Go=+Go,yl=yl>>>0,!Ul){const qu=Math.pow(2,8*Al-1);Yo(this,Go,yl,Al,qu-1,-qu)}let su=Al-1,Ql=1,vu=0;for(this[yl+su]=Go&255;--su>=0&&(Ql*=256);)Go<0&&vu===0&&this[yl+su+1]!==0&&(vu=1),this[yl+su]=(Go/Ql>>0)-vu&255;return yl+Al},lo.prototype.writeInt8=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,1,127,-128),Go<0&&(Go=255+Go+1),this[yl]=Go&255,yl+1},lo.prototype.writeInt16LE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,2,32767,-32768),this[yl]=Go&255,this[yl+1]=Go>>>8,yl+2},lo.prototype.writeInt16BE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,2,32767,-32768),this[yl]=Go>>>8,this[yl+1]=Go&255,yl+2},lo.prototype.writeInt32LE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,4,2147483647,-2147483648),this[yl]=Go&255,this[yl+1]=Go>>>8,this[yl+2]=Go>>>16,this[yl+3]=Go>>>24,yl+4},lo.prototype.writeInt32BE=function(Go,yl,Al){return Go=+Go,yl=yl>>>0,Al||Yo(this,Go,yl,4,2147483647,-2147483648),Go<0&&(Go=4294967295+Go+1),this[yl]=Go>>>24,this[yl+1]=Go>>>16,this[yl+2]=Go>>>8,this[yl+3]=Go&255,yl+4},lo.prototype.writeBigInt64LE=hu(function(Go,yl=0){return Xo(this,Go,yl,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),lo.prototype.writeBigInt64BE=hu(function(Go,yl=0){return qo(this,Go,yl,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ko(_l,Go,yl,Al,Ul,su){if(yl+Al>_l.length)throw new RangeError("Index out of range");if(yl<0)throw new RangeError("Index out of range")}function Qo(_l,Go,yl,Al,Ul){return Go=+Go,yl=yl>>>0,Ul||Ko(_l,Go,yl,4),to.write(_l,Go,yl,Al,23,4),yl+4}lo.prototype.writeFloatLE=function(Go,yl,Al){return Qo(this,Go,yl,!0,Al)},lo.prototype.writeFloatBE=function(Go,yl,Al){return Qo(this,Go,yl,!1,Al)};function zo(_l,Go,yl,Al,Ul){return Go=+Go,yl=yl>>>0,Ul||Ko(_l,Go,yl,8),to.write(_l,Go,yl,Al,52,8),yl+8}lo.prototype.writeDoubleLE=function(Go,yl,Al){return zo(this,Go,yl,!0,Al)},lo.prototype.writeDoubleBE=function(Go,yl,Al){return zo(this,Go,yl,!1,Al)},lo.prototype.copy=function(Go,yl,Al,Ul){if(!lo.isBuffer(Go))throw new TypeError("argument should be a Buffer");if(Al||(Al=0),!Ul&&Ul!==0&&(Ul=this.length),yl>=Go.length&&(yl=Go.length),yl||(yl=0),Ul>0&&Ul=this.length)throw new RangeError("Index out of range");if(Ul<0)throw new RangeError("sourceEnd out of bounds");Ul>this.length&&(Ul=this.length),Go.length-yl>>0,Al=Al===void 0?this.length:Al>>>0,Go||(Go=0);let su;if(typeof Go=="number")for(su=yl;su2**32?Ul=Sl(String(yl)):typeof yl=="bigint"&&(Ul=String(yl),(yl>BigInt(2)**BigInt(32)||yl<-(BigInt(2)**BigInt(32)))&&(Ul=Sl(Ul)),Ul+="n"),Al+=` It must be ${Go}. Received ${Ul}`,Al},RangeError);function Sl(_l){let Go="",yl=_l.length;const Al=_l[0]==="-"?1:0;for(;yl>=Al+4;yl-=3)Go=`_${_l.slice(yl-3,yl)}${Go}`;return`${_l.slice(0,yl)}${Go}`}function El(_l,Go,yl){Il(Go,"offset"),(_l[Go]===void 0||_l[Go+yl]===void 0)&&Zl(Go,_l.length-(yl+1))}function Tl(_l,Go,yl,Al,Ul,su){if(_l>yl||_l= 0${Ql} and < 2${Ql} ** ${(su+1)*8}${Ql}`:vu=`>= -(2${Ql} ** ${(su+1)*8-1}${Ql}) and < 2 ** ${(su+1)*8-1}${Ql}`,new ga.ERR_OUT_OF_RANGE("value",vu,_l)}El(Al,Ul,su)}function Il(_l,Go){if(typeof _l!="number")throw new ga.ERR_INVALID_ARG_TYPE(Go,"number",_l)}function Zl(_l,Go,yl){throw Math.floor(_l)!==_l?(Il(_l,yl),new ga.ERR_OUT_OF_RANGE("offset","an integer",_l)):Go<0?new ga.ERR_BUFFER_OUT_OF_BOUNDS:new ga.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Go}`,_l)}const Vl=/[^+/0-9A-Za-z-_]/g;function Ol(_l){if(_l=_l.split("=")[0],_l=_l.trim().replace(Vl,""),_l.length<2)return"";for(;_l.length%4!==0;)_l=_l+"=";return _l}function Dl(_l,Go){Go=Go||1/0;let yl;const Al=_l.length;let Ul=null;const su=[];for(let Ql=0;Ql55295&&yl<57344){if(!Ul){if(yl>56319){(Go-=3)>-1&&su.push(239,191,189);continue}else if(Ql+1===Al){(Go-=3)>-1&&su.push(239,191,189);continue}Ul=yl;continue}if(yl<56320){(Go-=3)>-1&&su.push(239,191,189),Ul=yl;continue}yl=(Ul-55296<<10|yl-56320)+65536}else Ul&&(Go-=3)>-1&&su.push(239,191,189);if(Ul=null,yl<128){if((Go-=1)<0)break;su.push(yl)}else if(yl<2048){if((Go-=2)<0)break;su.push(yl>>6|192,yl&63|128)}else if(yl<65536){if((Go-=3)<0)break;su.push(yl>>12|224,yl>>6&63|128,yl&63|128)}else if(yl<1114112){if((Go-=4)<0)break;su.push(yl>>18|240,yl>>12&63|128,yl>>6&63|128,yl&63|128)}else throw new Error("Invalid code point")}return su}function Fl(_l){const Go=[];for(let yl=0;yl<_l.length;++yl)Go.push(_l.charCodeAt(yl)&255);return Go}function Jl(_l,Go){let yl,Al,Ul;const su=[];for(let Ql=0;Ql<_l.length&&!((Go-=2)<0);++Ql)yl=_l.charCodeAt(Ql),Al=yl>>8,Ul=yl%256,su.push(Ul),su.push(Al);return su}function cu(_l){return eo.toByteArray(Ol(_l))}function Ll(_l,Go,yl,Al){let Ul;for(Ul=0;Ul=Go.length||Ul>=_l.length);++Ul)Go[Ul+yl]=_l[Ul];return Ul}function Xl(_l,Go){return _l instanceof Go||_l!=null&&_l.constructor!=null&&_l.constructor.name!=null&&_l.constructor.name===Go.name}function ku(_l){return _l!==_l}const iu=function(){const _l="0123456789abcdef",Go=new Array(256);for(let yl=0;yl<16;++yl){const Al=yl*16;for(let Ul=0;Ul<16;++Ul)Go[Al+Ul]=_l[yl]+_l[Ul]}return Go}();function hu(_l){return typeof BigInt>"u"?Cu:_l}function Cu(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$3=buffer$2.Buffer,Blob$3=buffer$2.Blob,BlobOptions=buffer$2.BlobOptions,Buffer$1$1=buffer$2.Buffer,File=buffer$2.File,FileOptions=buffer$2.FileOptions,INSPECT_MAX_BYTES=buffer$2.INSPECT_MAX_BYTES,SlowBuffer=buffer$2.SlowBuffer,TranscodeEncoding=buffer$2.TranscodeEncoding,atob$1=buffer$2.atob,btoa$2=buffer$2.btoa,constants$9=buffer$2.constants,isAscii=buffer$2.isAscii,isUtf8=buffer$2.isUtf8,kMaxLength=buffer$2.kMaxLength,kStringMaxLength=buffer$2.kStringMaxLength,resolveObjectURL=buffer$2.resolveObjectURL,transcode=buffer$2.transcode,dist$2=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$3,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$2,constants:constants$9,default:Buffer$3,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));function AxiosError(Xr,eo,to,ro,no){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=Xr,this.name="AxiosError",eo&&(this.code=eo),to&&(this.config=to),ro&&(this.request=ro),no&&(this.response=no,this.status=no.status?no.status:null)}utils$c.inherits(AxiosError,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$c.toJSONObject(this.config),code:this.code,status:this.status}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(Xr=>{descriptors[Xr]={value:Xr}});Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError.from=(Xr,eo,to,ro,no,io)=>{const oo=Object.create(prototype$1);return utils$c.toFlatObject(Xr,oo,function(so){return so!==Error.prototype},ao=>ao!=="isAxiosError"),AxiosError.call(oo,Xr.message,eo,to,ro,no),oo.cause=Xr,oo.name=Xr.name,io&&Object.assign(oo,io),oo};const httpAdapter=null;function isVisitable(Xr){return utils$c.isPlainObject(Xr)||utils$c.isArray(Xr)}function removeBrackets(Xr){return utils$c.endsWith(Xr,"[]")?Xr.slice(0,-2):Xr}function renderKey(Xr,eo,to){return Xr?Xr.concat(eo).map(function(no,io){return no=removeBrackets(no),!to&&io?"["+no+"]":no}).join(to?".":""):eo}function isFlatArray(Xr){return utils$c.isArray(Xr)&&!Xr.some(isVisitable)}const predicates=utils$c.toFlatObject(utils$c,{},null,function(eo){return/^is[A-Z]/.test(eo)});function toFormData(Xr,eo,to){if(!utils$c.isObject(Xr))throw new TypeError("target must be an object");eo=eo||new FormData,to=utils$c.toFlatObject(to,{metaTokens:!0,dots:!1,indexes:!1},!1,function(wo,Eo){return!utils$c.isUndefined(Eo[wo])});const ro=to.metaTokens,no=to.visitor||lo,io=to.dots,oo=to.indexes,so=(to.Blob||typeof Blob<"u"&&Blob)&&utils$c.isSpecCompliantForm(eo);if(!utils$c.isFunction(no))throw new TypeError("visitor must be a function");function co(bo){if(bo===null)return"";if(utils$c.isDate(bo))return bo.toISOString();if(!so&&utils$c.isBlob(bo))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$c.isArrayBuffer(bo)||utils$c.isTypedArray(bo)?so&&typeof Blob=="function"?new Blob([bo]):Buffer$3.from(bo):bo}function lo(bo,wo,Eo){let $o=bo;if(bo&&!Eo&&typeof bo=="object"){if(utils$c.endsWith(wo,"{}"))wo=ro?wo:wo.slice(0,-2),bo=JSON.stringify(bo);else if(utils$c.isArray(bo)&&isFlatArray(bo)||(utils$c.isFileList(bo)||utils$c.endsWith(wo,"[]"))&&($o=utils$c.toArray(bo)))return wo=removeBrackets(wo),$o.forEach(function(Ro,Oo){!(utils$c.isUndefined(Ro)||Ro===null)&&eo.append(oo===!0?renderKey([wo],Oo,io):oo===null?wo:wo+"[]",co(Ro))}),!1}return isVisitable(bo)?!0:(eo.append(renderKey(Eo,wo,io),co(bo)),!1)}const uo=[],ho=Object.assign(predicates,{defaultVisitor:lo,convertValue:co,isVisitable});function go(bo,wo){if(!utils$c.isUndefined(bo)){if(uo.indexOf(bo)!==-1)throw Error("Circular reference detected in "+wo.join("."));uo.push(bo),utils$c.forEach(bo,function($o,Co){(!(utils$c.isUndefined($o)||$o===null)&&no.call(eo,$o,utils$c.isString(Co)?Co.trim():Co,wo,ho))===!0&&go($o,wo?wo.concat(Co):[Co])}),uo.pop()}}if(!utils$c.isObject(Xr))throw new TypeError("data must be an object");return go(Xr),eo}function encode$q(Xr){const eo={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(Xr).replace(/[!'()~]|%20|%00/g,function(ro){return eo[ro]})}function AxiosURLSearchParams(Xr,eo){this._pairs=[],Xr&&toFormData(Xr,this,eo)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(eo,to){this._pairs.push([eo,to])};prototype.toString=function(eo){const to=eo?function(ro){return eo.call(this,ro,encode$q)}:encode$q;return this._pairs.map(function(no){return to(no[0])+"="+to(no[1])},"").join("&")};function encode$p(Xr){return encodeURIComponent(Xr).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(Xr,eo,to){if(!eo)return Xr;const ro=to&&to.encode||encode$p,no=to&&to.serialize;let io;if(no?io=no(eo,to):io=utils$c.isURLSearchParams(eo)?eo.toString():new AxiosURLSearchParams(eo,to).toString(ro),io){const oo=Xr.indexOf("#");oo!==-1&&(Xr=Xr.slice(0,oo)),Xr+=(Xr.indexOf("?")===-1?"?":"&")+io}return Xr}class InterceptorManager{constructor(){this.handlers=[]}use(eo,to,ro){return this.handlers.push({fulfilled:eo,rejected:to,synchronous:ro?ro.synchronous:!1,runWhen:ro?ro.runWhen:null}),this.handlers.length-1}eject(eo){this.handlers[eo]&&(this.handlers[eo]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(eo){utils$c.forEach(this.handlers,function(ro){ro!==null&&eo(ro)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$2={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",_navigator=typeof navigator=="object"&&navigator||void 0,hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$b=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,navigator:_navigator,origin},Symbol.toStringTag,{value:"Module"})),platform$1={...utils$b,...platform$2};function toURLEncodedForm(Xr,eo){return toFormData(Xr,new platform$1.classes.URLSearchParams,Object.assign({visitor:function(to,ro,no,io){return platform$1.isNode&&utils$c.isBuffer(to)?(this.append(ro,to.toString("base64")),!1):io.defaultVisitor.apply(this,arguments)}},eo))}function parsePropPath(Xr){return utils$c.matchAll(/\w+|\[(\w*)]/g,Xr).map(eo=>eo[0]==="[]"?"":eo[1]||eo[0])}function arrayToObject(Xr){const eo={},to=Object.keys(Xr);let ro;const no=to.length;let io;for(ro=0;ro=to.length;return oo=!oo&&utils$c.isArray(no)?no.length:oo,so?(utils$c.hasOwnProp(no,oo)?no[oo]=[no[oo],ro]:no[oo]=ro,!ao):((!no[oo]||!utils$c.isObject(no[oo]))&&(no[oo]=[]),eo(to,ro,no[oo],io)&&utils$c.isArray(no[oo])&&(no[oo]=arrayToObject(no[oo])),!ao)}if(utils$c.isFormData(Xr)&&utils$c.isFunction(Xr.entries)){const to={};return utils$c.forEachEntry(Xr,(ro,no)=>{eo(parsePropPath(ro),no,to,0)}),to}return null}function stringifySafely(Xr,eo,to){if(utils$c.isString(Xr))try{return(eo||JSON.parse)(Xr),utils$c.trim(Xr)}catch(ro){if(ro.name!=="SyntaxError")throw ro}return(0,JSON.stringify)(Xr)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(eo,to){const ro=to.getContentType()||"",no=ro.indexOf("application/json")>-1,io=utils$c.isObject(eo);if(io&&utils$c.isHTMLForm(eo)&&(eo=new FormData(eo)),utils$c.isFormData(eo))return no?JSON.stringify(formDataToJSON(eo)):eo;if(utils$c.isArrayBuffer(eo)||utils$c.isBuffer(eo)||utils$c.isStream(eo)||utils$c.isFile(eo)||utils$c.isBlob(eo)||utils$c.isReadableStream(eo))return eo;if(utils$c.isArrayBufferView(eo))return eo.buffer;if(utils$c.isURLSearchParams(eo))return to.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),eo.toString();let ao;if(io){if(ro.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(eo,this.formSerializer).toString();if((ao=utils$c.isFileList(eo))||ro.indexOf("multipart/form-data")>-1){const so=this.env&&this.env.FormData;return toFormData(ao?{"files[]":eo}:eo,so&&new so,this.formSerializer)}}return io||no?(to.setContentType("application/json",!1),stringifySafely(eo)):eo}],transformResponse:[function(eo){const to=this.transitional||defaults.transitional,ro=to&&to.forcedJSONParsing,no=this.responseType==="json";if(utils$c.isResponse(eo)||utils$c.isReadableStream(eo))return eo;if(eo&&utils$c.isString(eo)&&(ro&&!this.responseType||no)){const oo=!(to&&to.silentJSONParsing)&&no;try{return JSON.parse(eo)}catch(ao){if(oo)throw ao.name==="SyntaxError"?AxiosError.from(ao,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):ao}}return eo}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$1.classes.FormData,Blob:platform$1.classes.Blob},validateStatus:function(eo){return eo>=200&&eo<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$c.forEach(["delete","get","head","post","put","patch"],Xr=>{defaults.headers[Xr]={}});const ignoreDuplicateOf=utils$c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders$1=Xr=>{const eo={};let to,ro,no;return Xr&&Xr.split(` +`).forEach(function(oo){no=oo.indexOf(":"),to=oo.substring(0,no).trim().toLowerCase(),ro=oo.substring(no+1).trim(),!(!to||eo[to]&&ignoreDuplicateOf[to])&&(to==="set-cookie"?eo[to]?eo[to].push(ro):eo[to]=[ro]:eo[to]=eo[to]?eo[to]+", "+ro:ro)}),eo},$internals=Symbol("internals");function normalizeHeader(Xr){return Xr&&String(Xr).trim().toLowerCase()}function normalizeValue$1(Xr){return Xr===!1||Xr==null?Xr:utils$c.isArray(Xr)?Xr.map(normalizeValue$1):String(Xr)}function parseTokens(Xr){const eo=Object.create(null),to=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let ro;for(;ro=to.exec(Xr);)eo[ro[1]]=ro[2];return eo}const isValidHeaderName=Xr=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(Xr.trim());function matchHeaderValue(Xr,eo,to,ro,no){if(utils$c.isFunction(ro))return ro.call(this,eo,to);if(no&&(eo=to),!!utils$c.isString(eo)){if(utils$c.isString(ro))return eo.indexOf(ro)!==-1;if(utils$c.isRegExp(ro))return ro.test(eo)}}function formatHeader(Xr){return Xr.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(eo,to,ro)=>to.toUpperCase()+ro)}function buildAccessors(Xr,eo){const to=utils$c.toCamelCase(" "+eo);["get","set","has"].forEach(ro=>{Object.defineProperty(Xr,ro+to,{value:function(no,io,oo){return this[ro].call(this,eo,no,io,oo)},configurable:!0})})}class AxiosHeaders{constructor(eo){eo&&this.set(eo)}set(eo,to,ro){const no=this;function io(ao,so,co){const lo=normalizeHeader(so);if(!lo)throw new Error("header name must be a non-empty string");const uo=utils$c.findKey(no,lo);(!uo||no[uo]===void 0||co===!0||co===void 0&&no[uo]!==!1)&&(no[uo||so]=normalizeValue$1(ao))}const oo=(ao,so)=>utils$c.forEach(ao,(co,lo)=>io(co,lo,so));if(utils$c.isPlainObject(eo)||eo instanceof this.constructor)oo(eo,to);else if(utils$c.isString(eo)&&(eo=eo.trim())&&!isValidHeaderName(eo))oo(parseHeaders$1(eo),to);else if(utils$c.isHeaders(eo))for(const[ao,so]of eo.entries())io(so,ao,ro);else eo!=null&&io(to,eo,ro);return this}get(eo,to){if(eo=normalizeHeader(eo),eo){const ro=utils$c.findKey(this,eo);if(ro){const no=this[ro];if(!to)return no;if(to===!0)return parseTokens(no);if(utils$c.isFunction(to))return to.call(this,no,ro);if(utils$c.isRegExp(to))return to.exec(no);throw new TypeError("parser must be boolean|regexp|function")}}}has(eo,to){if(eo=normalizeHeader(eo),eo){const ro=utils$c.findKey(this,eo);return!!(ro&&this[ro]!==void 0&&(!to||matchHeaderValue(this,this[ro],ro,to)))}return!1}delete(eo,to){const ro=this;let no=!1;function io(oo){if(oo=normalizeHeader(oo),oo){const ao=utils$c.findKey(ro,oo);ao&&(!to||matchHeaderValue(ro,ro[ao],ao,to))&&(delete ro[ao],no=!0)}}return utils$c.isArray(eo)?eo.forEach(io):io(eo),no}clear(eo){const to=Object.keys(this);let ro=to.length,no=!1;for(;ro--;){const io=to[ro];(!eo||matchHeaderValue(this,this[io],io,eo,!0))&&(delete this[io],no=!0)}return no}normalize(eo){const to=this,ro={};return utils$c.forEach(this,(no,io)=>{const oo=utils$c.findKey(ro,io);if(oo){to[oo]=normalizeValue$1(no),delete to[io];return}const ao=eo?formatHeader(io):String(io).trim();ao!==io&&delete to[io],to[ao]=normalizeValue$1(no),ro[ao]=!0}),this}concat(...eo){return this.constructor.concat(this,...eo)}toJSON(eo){const to=Object.create(null);return utils$c.forEach(this,(ro,no)=>{ro!=null&&ro!==!1&&(to[no]=eo&&utils$c.isArray(ro)?ro.join(", "):ro)}),to}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([eo,to])=>eo+": "+to).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(eo){return eo instanceof this?eo:new this(eo)}static concat(eo,...to){const ro=new this(eo);return to.forEach(no=>ro.set(no)),ro}static accessor(eo){const ro=(this[$internals]=this[$internals]={accessors:{}}).accessors,no=this.prototype;function io(oo){const ao=normalizeHeader(oo);ro[ao]||(buildAccessors(no,oo),ro[ao]=!0)}return utils$c.isArray(eo)?eo.forEach(io):io(eo),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$c.reduceDescriptors(AxiosHeaders.prototype,({value:Xr},eo)=>{let to=eo[0].toUpperCase()+eo.slice(1);return{get:()=>Xr,set(ro){this[to]=ro}}});utils$c.freezeMethods(AxiosHeaders);function transformData(Xr,eo){const to=this||defaults,ro=eo||to,no=AxiosHeaders.from(ro.headers);let io=ro.data;return utils$c.forEach(Xr,function(ao){io=ao.call(to,io,no.normalize(),eo?eo.status:void 0)}),no.normalize(),io}function isCancel(Xr){return!!(Xr&&Xr.__CANCEL__)}function CanceledError(Xr,eo,to){AxiosError.call(this,Xr??"canceled",AxiosError.ERR_CANCELED,eo,to),this.name="CanceledError"}utils$c.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(Xr,eo,to){const ro=to.config.validateStatus;!to.status||!ro||ro(to.status)?Xr(to):eo(new AxiosError("Request failed with status code "+to.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(to.status/100)-4],to.config,to.request,to))}function parseProtocol(Xr){const eo=/^([-+\w]{1,25})(:?\/\/|:)/.exec(Xr);return eo&&eo[1]||""}function speedometer(Xr,eo){Xr=Xr||10;const to=new Array(Xr),ro=new Array(Xr);let no=0,io=0,oo;return eo=eo!==void 0?eo:1e3,function(so){const co=Date.now(),lo=ro[io];oo||(oo=co),to[no]=so,ro[no]=co;let uo=io,ho=0;for(;uo!==no;)ho+=to[uo++],uo=uo%Xr;if(no=(no+1)%Xr,no===io&&(io=(io+1)%Xr),co-oo{to=lo,no=null,io&&(clearTimeout(io),io=null),Xr.apply(null,co)};return[(...co)=>{const lo=Date.now(),uo=lo-to;uo>=ro?oo(co,lo):(no=co,io||(io=setTimeout(()=>{io=null,oo(no)},ro-uo)))},()=>no&&oo(no)]}const progressEventReducer=(Xr,eo,to=3)=>{let ro=0;const no=speedometer(50,250);return throttle(io=>{const oo=io.loaded,ao=io.lengthComputable?io.total:void 0,so=oo-ro,co=no(so),lo=oo<=ao;ro=oo;const uo={loaded:oo,total:ao,progress:ao?oo/ao:void 0,bytes:so,rate:co||void 0,estimated:co&&ao&&lo?(ao-oo)/co:void 0,event:io,lengthComputable:ao!=null,[eo?"download":"upload"]:!0};Xr(uo)},to)},progressEventDecorator=(Xr,eo)=>{const to=Xr!=null;return[ro=>eo[0]({lengthComputable:to,total:Xr,loaded:ro}),eo[1]]},asyncDecorator=Xr=>(...eo)=>utils$c.asap(()=>Xr(...eo)),isURLSameOrigin=platform$1.hasStandardBrowserEnv?function(){const eo=platform$1.navigator&&/(msie|trident)/i.test(platform$1.navigator.userAgent),to=document.createElement("a");let ro;function no(io){let oo=io;return eo&&(to.setAttribute("href",oo),oo=to.href),to.setAttribute("href",oo),{href:to.href,protocol:to.protocol?to.protocol.replace(/:$/,""):"",host:to.host,search:to.search?to.search.replace(/^\?/,""):"",hash:to.hash?to.hash.replace(/^#/,""):"",hostname:to.hostname,port:to.port,pathname:to.pathname.charAt(0)==="/"?to.pathname:"/"+to.pathname}}return ro=no(window.location.href),function(oo){const ao=utils$c.isString(oo)?no(oo):oo;return ao.protocol===ro.protocol&&ao.host===ro.host}}():function(){return function(){return!0}}(),cookies=platform$1.hasStandardBrowserEnv?{write(Xr,eo,to,ro,no,io){const oo=[Xr+"="+encodeURIComponent(eo)];utils$c.isNumber(to)&&oo.push("expires="+new Date(to).toGMTString()),utils$c.isString(ro)&&oo.push("path="+ro),utils$c.isString(no)&&oo.push("domain="+no),io===!0&&oo.push("secure"),document.cookie=oo.join("; ")},read(Xr){const eo=document.cookie.match(new RegExp("(^|;\\s*)("+Xr+")=([^;]*)"));return eo?decodeURIComponent(eo[3]):null},remove(Xr){this.write(Xr,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(Xr){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(Xr)}function combineURLs(Xr,eo){return eo?Xr.replace(/\/?\/$/,"")+"/"+eo.replace(/^\/+/,""):Xr}function buildFullPath(Xr,eo){return Xr&&!isAbsoluteURL(eo)?combineURLs(Xr,eo):eo}const headersToObject=Xr=>Xr instanceof AxiosHeaders?{...Xr}:Xr;function mergeConfig(Xr,eo){eo=eo||{};const to={};function ro(co,lo,uo){return utils$c.isPlainObject(co)&&utils$c.isPlainObject(lo)?utils$c.merge.call({caseless:uo},co,lo):utils$c.isPlainObject(lo)?utils$c.merge({},lo):utils$c.isArray(lo)?lo.slice():lo}function no(co,lo,uo){if(utils$c.isUndefined(lo)){if(!utils$c.isUndefined(co))return ro(void 0,co,uo)}else return ro(co,lo,uo)}function io(co,lo){if(!utils$c.isUndefined(lo))return ro(void 0,lo)}function oo(co,lo){if(utils$c.isUndefined(lo)){if(!utils$c.isUndefined(co))return ro(void 0,co)}else return ro(void 0,lo)}function ao(co,lo,uo){if(uo in eo)return ro(co,lo);if(uo in Xr)return ro(void 0,co)}const so={url:io,method:io,data:io,baseURL:oo,transformRequest:oo,transformResponse:oo,paramsSerializer:oo,timeout:oo,timeoutMessage:oo,withCredentials:oo,withXSRFToken:oo,adapter:oo,responseType:oo,xsrfCookieName:oo,xsrfHeaderName:oo,onUploadProgress:oo,onDownloadProgress:oo,decompress:oo,maxContentLength:oo,maxBodyLength:oo,beforeRedirect:oo,transport:oo,httpAgent:oo,httpsAgent:oo,cancelToken:oo,socketPath:oo,responseEncoding:oo,validateStatus:ao,headers:(co,lo)=>no(headersToObject(co),headersToObject(lo),!0)};return utils$c.forEach(Object.keys(Object.assign({},Xr,eo)),function(lo){const uo=so[lo]||no,ho=uo(Xr[lo],eo[lo],lo);utils$c.isUndefined(ho)&&uo!==ao||(to[lo]=ho)}),to}const resolveConfig=Xr=>{const eo=mergeConfig({},Xr);let{data:to,withXSRFToken:ro,xsrfHeaderName:no,xsrfCookieName:io,headers:oo,auth:ao}=eo;eo.headers=oo=AxiosHeaders.from(oo),eo.url=buildURL(buildFullPath(eo.baseURL,eo.url),Xr.params,Xr.paramsSerializer),ao&&oo.set("Authorization","Basic "+btoa((ao.username||"")+":"+(ao.password?unescape(encodeURIComponent(ao.password)):"")));let so;if(utils$c.isFormData(to)){if(platform$1.hasStandardBrowserEnv||platform$1.hasStandardBrowserWebWorkerEnv)oo.setContentType(void 0);else if((so=oo.getContentType())!==!1){const[co,...lo]=so?so.split(";").map(uo=>uo.trim()).filter(Boolean):[];oo.setContentType([co||"multipart/form-data",...lo].join("; "))}}if(platform$1.hasStandardBrowserEnv&&(ro&&utils$c.isFunction(ro)&&(ro=ro(eo)),ro||ro!==!1&&isURLSameOrigin(eo.url))){const co=no&&io&&cookies.read(io);co&&oo.set(no,co)}return eo},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(Xr){return new Promise(function(to,ro){const no=resolveConfig(Xr);let io=no.data;const oo=AxiosHeaders.from(no.headers).normalize();let{responseType:ao,onUploadProgress:so,onDownloadProgress:co}=no,lo,uo,ho,go,bo;function wo(){go&&go(),bo&&bo(),no.cancelToken&&no.cancelToken.unsubscribe(lo),no.signal&&no.signal.removeEventListener("abort",lo)}let Eo=new XMLHttpRequest;Eo.open(no.method.toUpperCase(),no.url,!0),Eo.timeout=no.timeout;function $o(){if(!Eo)return;const Ro=AxiosHeaders.from("getAllResponseHeaders"in Eo&&Eo.getAllResponseHeaders()),jo={data:!ao||ao==="text"||ao==="json"?Eo.responseText:Eo.response,status:Eo.status,statusText:Eo.statusText,headers:Ro,config:Xr,request:Eo};settle(function(Mo){to(Mo),wo()},function(Mo){ro(Mo),wo()},jo),Eo=null}"onloadend"in Eo?Eo.onloadend=$o:Eo.onreadystatechange=function(){!Eo||Eo.readyState!==4||Eo.status===0&&!(Eo.responseURL&&Eo.responseURL.indexOf("file:")===0)||setTimeout($o)},Eo.onabort=function(){Eo&&(ro(new AxiosError("Request aborted",AxiosError.ECONNABORTED,Xr,Eo)),Eo=null)},Eo.onerror=function(){ro(new AxiosError("Network Error",AxiosError.ERR_NETWORK,Xr,Eo)),Eo=null},Eo.ontimeout=function(){let Oo=no.timeout?"timeout of "+no.timeout+"ms exceeded":"timeout exceeded";const jo=no.transitional||transitionalDefaults;no.timeoutErrorMessage&&(Oo=no.timeoutErrorMessage),ro(new AxiosError(Oo,jo.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,Xr,Eo)),Eo=null},io===void 0&&oo.setContentType(null),"setRequestHeader"in Eo&&utils$c.forEach(oo.toJSON(),function(Oo,jo){Eo.setRequestHeader(jo,Oo)}),utils$c.isUndefined(no.withCredentials)||(Eo.withCredentials=!!no.withCredentials),ao&&ao!=="json"&&(Eo.responseType=no.responseType),co&&([ho,bo]=progressEventReducer(co,!0),Eo.addEventListener("progress",ho)),so&&Eo.upload&&([uo,go]=progressEventReducer(so),Eo.upload.addEventListener("progress",uo),Eo.upload.addEventListener("loadend",go)),(no.cancelToken||no.signal)&&(lo=Ro=>{Eo&&(ro(!Ro||Ro.type?new CanceledError(null,Xr,Eo):Ro),Eo.abort(),Eo=null)},no.cancelToken&&no.cancelToken.subscribe(lo),no.signal&&(no.signal.aborted?lo():no.signal.addEventListener("abort",lo)));const Co=parseProtocol(no.url);if(Co&&platform$1.protocols.indexOf(Co)===-1){ro(new AxiosError("Unsupported protocol "+Co+":",AxiosError.ERR_BAD_REQUEST,Xr));return}Eo.send(io||null)})},composeSignals=(Xr,eo)=>{const{length:to}=Xr=Xr?Xr.filter(Boolean):[];if(eo||to){let ro=new AbortController,no;const io=function(co){if(!no){no=!0,ao();const lo=co instanceof Error?co:this.reason;ro.abort(lo instanceof AxiosError?lo:new CanceledError(lo instanceof Error?lo.message:lo))}};let oo=eo&&setTimeout(()=>{oo=null,io(new AxiosError(`timeout ${eo} of ms exceeded`,AxiosError.ETIMEDOUT))},eo);const ao=()=>{Xr&&(oo&&clearTimeout(oo),oo=null,Xr.forEach(co=>{co.unsubscribe?co.unsubscribe(io):co.removeEventListener("abort",io)}),Xr=null)};Xr.forEach(co=>co.addEventListener("abort",io));const{signal:so}=ro;return so.unsubscribe=()=>utils$c.asap(ao),so}},streamChunk=function*(Xr,eo){let to=Xr.byteLength;if(to{const no=readBytes(Xr,eo);let io=0,oo,ao=so=>{oo||(oo=!0,ro&&ro(so))};return new ReadableStream({async pull(so){try{const{done:co,value:lo}=await no.next();if(co){ao(),so.close();return}let uo=lo.byteLength;if(to){let ho=io+=uo;to(ho)}so.enqueue(new Uint8Array(lo))}catch(co){throw ao(co),co}},cancel(so){return ao(so),no.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(Xr=>eo=>Xr.encode(eo))(new TextEncoder):async Xr=>new Uint8Array(await new Response(Xr).arrayBuffer())),test=(Xr,...eo)=>{try{return!!Xr(...eo)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let Xr=!1;const eo=new Request(platform$1.origin,{body:new ReadableStream,method:"POST",get duplex(){return Xr=!0,"half"}}).headers.has("Content-Type");return Xr&&!eo}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$c.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(Xr=>Xr.body)};isFetchSupported&&(Xr=>{["text","arrayBuffer","blob","formData","stream"].forEach(eo=>{!resolvers[eo]&&(resolvers[eo]=utils$c.isFunction(Xr[eo])?to=>to[eo]():(to,ro)=>{throw new AxiosError(`Response type '${eo}' is not supported`,AxiosError.ERR_NOT_SUPPORT,ro)})})})(new Response);const getBodyLength=async Xr=>{if(Xr==null)return 0;if(utils$c.isBlob(Xr))return Xr.size;if(utils$c.isSpecCompliantForm(Xr))return(await new Request(platform$1.origin,{method:"POST",body:Xr}).arrayBuffer()).byteLength;if(utils$c.isArrayBufferView(Xr)||utils$c.isArrayBuffer(Xr))return Xr.byteLength;if(utils$c.isURLSearchParams(Xr)&&(Xr=Xr+""),utils$c.isString(Xr))return(await encodeText(Xr)).byteLength},resolveBodyLength=async(Xr,eo)=>{const to=utils$c.toFiniteNumber(Xr.getContentLength());return to??getBodyLength(eo)},fetchAdapter=isFetchSupported&&(async Xr=>{let{url:eo,method:to,data:ro,signal:no,cancelToken:io,timeout:oo,onDownloadProgress:ao,onUploadProgress:so,responseType:co,headers:lo,withCredentials:uo="same-origin",fetchOptions:ho}=resolveConfig(Xr);co=co?(co+"").toLowerCase():"text";let go=composeSignals([no,io&&io.toAbortSignal()],oo),bo;const wo=go&&go.unsubscribe&&(()=>{go.unsubscribe()});let Eo;try{if(so&&supportsRequestStream&&to!=="get"&&to!=="head"&&(Eo=await resolveBodyLength(lo,ro))!==0){let jo=new Request(eo,{method:"POST",body:ro,duplex:"half"}),Bo;if(utils$c.isFormData(ro)&&(Bo=jo.headers.get("content-type"))&&lo.setContentType(Bo),jo.body){const[Mo,Fo]=progressEventDecorator(Eo,progressEventReducer(asyncDecorator(so)));ro=trackStream(jo.body,DEFAULT_CHUNK_SIZE,Mo,Fo)}}utils$c.isString(uo)||(uo=uo?"include":"omit");const $o="credentials"in Request.prototype;bo=new Request(eo,{...ho,signal:go,method:to.toUpperCase(),headers:lo.normalize().toJSON(),body:ro,duplex:"half",credentials:$o?uo:void 0});let Co=await fetch(bo);const Ro=supportsResponseStream&&(co==="stream"||co==="response");if(supportsResponseStream&&(ao||Ro&&wo)){const jo={};["status","statusText","headers"].forEach(Wo=>{jo[Wo]=Co[Wo]});const Bo=utils$c.toFiniteNumber(Co.headers.get("content-length")),[Mo,Fo]=ao&&progressEventDecorator(Bo,progressEventReducer(asyncDecorator(ao),!0))||[];Co=new Response(trackStream(Co.body,DEFAULT_CHUNK_SIZE,Mo,()=>{Fo&&Fo(),wo&&wo()}),jo)}co=co||"text";let Oo=await resolvers[utils$c.findKey(resolvers,co)||"text"](Co,Xr);return!Ro&&wo&&wo(),await new Promise((jo,Bo)=>{settle(jo,Bo,{data:Oo,headers:AxiosHeaders.from(Co.headers),status:Co.status,statusText:Co.statusText,config:Xr,request:bo})})}catch($o){throw wo&&wo(),$o&&$o.name==="TypeError"&&/fetch/i.test($o.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,Xr,bo),{cause:$o.cause||$o}):AxiosError.from($o,$o&&$o.code,Xr,bo)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$c.forEach(knownAdapters,(Xr,eo)=>{if(Xr){try{Object.defineProperty(Xr,"name",{value:eo})}catch{}Object.defineProperty(Xr,"adapterName",{value:eo})}});const renderReason=Xr=>`- ${Xr}`,isResolvedHandle=Xr=>utils$c.isFunction(Xr)||Xr===null||Xr===!1,adapters={getAdapter:Xr=>{Xr=utils$c.isArray(Xr)?Xr:[Xr];const{length:eo}=Xr;let to,ro;const no={};for(let io=0;io`adapter ${ao} `+(so===!1?"is not supported by the environment":"is not available in the build"));let oo=eo?io.length>1?`since : `+io.map(renderReason).join(` `):" "+renderReason(io[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+oo,"ERR_NOT_SUPPORT")}return ro},adapters:knownAdapters};function throwIfCancellationRequested(Xr){if(Xr.cancelToken&&Xr.cancelToken.throwIfRequested(),Xr.signal&&Xr.signal.aborted)throw new CanceledError(null,Xr)}function dispatchRequest(Xr){return throwIfCancellationRequested(Xr),Xr.headers=AxiosHeaders.from(Xr.headers),Xr.data=transformData.call(Xr,Xr.transformRequest),["post","put","patch"].indexOf(Xr.method)!==-1&&Xr.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(Xr.adapter||defaults.adapter)(Xr).then(function(ro){return throwIfCancellationRequested(Xr),ro.data=transformData.call(Xr,Xr.transformResponse,ro),ro.headers=AxiosHeaders.from(ro.headers),ro},function(ro){return isCancel(ro)||(throwIfCancellationRequested(Xr),ro&&ro.response&&(ro.response.data=transformData.call(Xr,Xr.transformResponse,ro.response),ro.response.headers=AxiosHeaders.from(ro.response.headers))),Promise.reject(ro)})}const VERSION$5="1.7.7",validators$1={};["object","boolean","number","function","string","symbol"].forEach((Xr,eo)=>{validators$1[Xr]=function(ro){return typeof ro===Xr||"a"+(eo<1?"n ":" ")+Xr}});const deprecatedWarnings={};validators$1.transitional=function(eo,to,ro){function no(io,oo){return"[Axios v"+VERSION$5+"] Transitional option '"+io+"'"+oo+(ro?". "+ro:"")}return(io,oo,ao)=>{if(eo===!1)throw new AxiosError(no(oo," has been removed"+(to?" in "+to:"")),AxiosError.ERR_DEPRECATED);return to&&!deprecatedWarnings[oo]&&(deprecatedWarnings[oo]=!0,console.warn(no(oo," has been deprecated since v"+to+" and will be removed in the near future"))),eo?eo(io,oo,ao):!0}};function assertOptions(Xr,eo,to){if(typeof Xr!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const ro=Object.keys(Xr);let no=ro.length;for(;no-- >0;){const io=ro[no],oo=eo[io];if(oo){const ao=Xr[io],so=ao===void 0||oo(ao,io,Xr);if(so!==!0)throw new AxiosError("option "+io+" must be "+so,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(to!==!0)throw new AxiosError("Unknown option "+io,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(eo){this.defaults=eo,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(eo,to){try{return await this._request(eo,to)}catch(ro){if(ro instanceof Error){let no;Error.captureStackTrace?Error.captureStackTrace(no={}):no=new Error;const io=no.stack?no.stack.replace(/^.+\n/,""):"";try{ro.stack?io&&!String(ro.stack).endsWith(io.replace(/^.+\n.+\n/,""))&&(ro.stack+=` -`+io):ro.stack=io}catch{}}throw ro}}_request(eo,to){typeof eo=="string"?(to=to||{},to.url=eo):to=eo||{},to=mergeConfig(this.defaults,to);const{transitional:ro,paramsSerializer:no,headers:io}=to;ro!==void 0&&validator.assertOptions(ro,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),no!=null&&(utils$c.isFunction(no)?to.paramsSerializer={serialize:no}:validator.assertOptions(no,{encode:validators.function,serialize:validators.function},!0)),to.method=(to.method||this.defaults.method||"get").toLowerCase();let oo=io&&utils$c.merge(io.common,io[to.method]);io&&utils$c.forEach(["delete","get","head","post","put","patch","common"],yo=>{delete io[yo]}),to.headers=AxiosHeaders.concat(oo,io);const ao=[];let so=!0;this.interceptors.request.forEach(function(vo){typeof vo.runWhen=="function"&&vo.runWhen(to)===!1||(so=so&&vo.synchronous,ao.unshift(vo.fulfilled,vo.rejected))});const co=[];this.interceptors.response.forEach(function(vo){co.push(vo.fulfilled,vo.rejected)});let lo,fo=0,ho;if(!so){const yo=[dispatchRequest.bind(this),void 0];for(yo.unshift.apply(yo,ao),yo.push.apply(yo,co),ho=yo.length,lo=Promise.resolve(to);fo{if(!ro._listeners)return;let io=ro._listeners.length;for(;io-- >0;)ro._listeners[io](no);ro._listeners=null}),this.promise.then=no=>{let io;const oo=new Promise(ao=>{ro.subscribe(ao),io=ao}).then(no);return oo.cancel=function(){ro.unsubscribe(io)},oo},eo(function(io,oo,ao){ro.reason||(ro.reason=new CanceledError(io,oo,ao),to(ro.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(eo){if(this.reason){eo(this.reason);return}this._listeners?this._listeners.push(eo):this._listeners=[eo]}unsubscribe(eo){if(!this._listeners)return;const to=this._listeners.indexOf(eo);to!==-1&&this._listeners.splice(to,1)}toAbortSignal(){const eo=new AbortController,to=ro=>{eo.abort(ro)};return this.subscribe(to),eo.signal.unsubscribe=()=>this.unsubscribe(to),eo.signal}static source(){let eo;return{token:new CancelToken(function(no){eo=no}),cancel:eo}}}function spread(Xr){return function(to){return Xr.apply(null,to)}}function isAxiosError(Xr){return utils$c.isObject(Xr)&&Xr.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([Xr,eo])=>{HttpStatusCode[eo]=Xr});function createInstance(Xr){const eo=new Axios(Xr),to=bind$1(Axios.prototype.request,eo);return utils$c.extend(to,Axios.prototype,eo,{allOwnKeys:!0}),utils$c.extend(to,eo,null,{allOwnKeys:!0}),to.create=function(no){return createInstance(mergeConfig(Xr,no))},to}const axios=createInstance(defaults);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION$5;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function(eo){return Promise.all(eo)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=Xr=>formDataToJSON(utils$c.isHTMLForm(Xr)?new FormData(Xr):Xr);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;const version$w="1.0.6";let BaseError$1=class bv extends Error{constructor(eo,to={}){var oo;const ro=to.cause instanceof bv?to.cause.details:(oo=to.cause)!=null&&oo.message?to.cause.message:to.details,no=to.cause instanceof bv&&to.cause.docsPath||to.docsPath,io=[eo||"An error occurred.","",...to.metaMessages?[...to.metaMessages,""]:[],...no?[`Docs: https://abitype.dev${no}`]:[],...ro?[`Details: ${ro}`]:[],`Version: abitype@${version$w}`].join(` -`);super(io),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),to.cause&&(this.cause=to.cause),this.details=ro,this.docsPath=no,this.metaMessages=to.metaMessages,this.shortMessage=eo}};function execTyped(Xr,eo){const to=Xr.exec(eo);return to==null?void 0:to.groups}const bytesRegex$1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex$1=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(Xr){let eo=Xr.type;if(tupleRegex.test(Xr.type)&&"components"in Xr){eo="(";const to=Xr.components.length;for(let no=0;no[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(Xr){return errorSignatureRegex.test(Xr)}function execErrorSignature(Xr){return execTyped(errorSignatureRegex,Xr)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(Xr){return eventSignatureRegex.test(Xr)}function execEventSignature(Xr){return execTyped(eventSignatureRegex,Xr)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(Xr){return functionSignatureRegex.test(Xr)}function execFunctionSignature(Xr){return execTyped(functionSignatureRegex,Xr)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(Xr){return structSignatureRegex.test(Xr)}function execStructSignature(Xr){return execTyped(structSignatureRegex,Xr)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(Xr){return constructorSignatureRegex.test(Xr)}function execConstructorSignature(Xr){return execTyped(constructorSignatureRegex,Xr)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(Xr){return fallbackSignatureRegex.test(Xr)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(Xr){return receiveSignatureRegex.test(Xr)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$1{constructor({type:eo}){super("Unknown type.",{metaMessages:[`Type "${eo}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class UnknownSolidityTypeError extends BaseError$1{constructor({type:eo}){super("Unknown type.",{metaMessages:[`Type "${eo}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidParameterError extends BaseError$1{constructor({param:eo}){super("Invalid ABI parameter.",{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$1{constructor({param:eo,name:to}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`"${to}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class InvalidModifierError extends BaseError$1{constructor({param:eo,type:to,modifier:ro}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`Modifier "${ro}" not allowed${to?` in "${to}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$1{constructor({param:eo,type:to,modifier:ro}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`Modifier "${ro}" not allowed${to?` in "${to}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${ro}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$1{constructor({abiParameter:eo}){super("Invalid ABI parameter.",{details:JSON.stringify(eo,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class InvalidSignatureError extends BaseError$1{constructor({signature:eo,type:to}){super(`Invalid ${to} signature.`,{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class UnknownSignatureError extends BaseError$1{constructor({signature:eo}){super("Unknown signature.",{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$1{constructor({signature:eo}){super("Invalid struct signature.",{details:eo,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$1{constructor({type:eo}){super("Circular reference detected.",{metaMessages:[`Struct "${eo}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$1{constructor({current:eo,depth:to}){super("Unbalanced parentheses.",{metaMessages:[`"${eo.trim()}" has too many ${to>0?"opening":"closing"} parentheses.`],details:`Depth "${to}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(Xr,eo){return eo?`${eo}:${Xr}`:Xr}const parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function parseSignature(Xr,eo={}){if(isFunctionSignature(Xr)){const to=execFunctionSignature(Xr);if(!to)throw new InvalidSignatureError({signature:Xr,type:"function"});const ro=splitParameters(to.parameters),no=[],io=ro.length;for(let ao=0;ao[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter(Xr,eo){var fo,ho;const to=getParameterCacheKey(Xr,eo==null?void 0:eo.type);if(parameterCache.has(to))return parameterCache.get(to);const ro=isTupleRegex.test(Xr),no=execTyped(ro?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,Xr);if(!no)throw new InvalidParameterError({param:Xr});if(no.name&&isSolidityKeyword(no.name))throw new SolidityProtectedKeywordError({param:Xr,name:no.name});const io=no.name?{name:no.name}:{},oo=no.modifier==="indexed"?{indexed:!0}:{},ao=(eo==null?void 0:eo.structs)??{};let so,co={};if(ro){so="tuple";const go=splitParameters(no.type),yo=[],vo=go.length;for(let wo=0;wo[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(Xr,eo,to=new Set){const ro=[],no=Xr.length;for(let io=0;ioeo(Xr,io)}function formatAbiItem(Xr,{includeName:eo=!1}={}){if(Xr.type!=="function"&&Xr.type!=="event"&&Xr.type!=="error")throw new InvalidDefinitionTypeError(Xr.type);return`${Xr.name}(${formatAbiParams(Xr.inputs,{includeName:eo})})`}function formatAbiParams(Xr,{includeName:eo=!1}={}){return Xr?Xr.map(to=>formatAbiParam(to,{includeName:eo})).join(eo?", ":","):""}function formatAbiParam(Xr,{includeName:eo}){return Xr.type.startsWith("tuple")?`(${formatAbiParams(Xr.components,{includeName:eo})})${Xr.type.slice(5)}`:Xr.type+(eo&&Xr.name?` ${Xr.name}`:"")}function isHex$4(Xr,{strict:eo=!0}={}){return!Xr||typeof Xr!="string"?!1:eo?/^0x[0-9a-fA-F]*$/.test(Xr):Xr.startsWith("0x")}function size$1(Xr){return isHex$4(Xr,{strict:!1})?Math.ceil((Xr.length-2)/2):Xr.length}const version$v="2.21.37";let errorConfig={getDocsUrl:({docsBaseUrl:Xr,docsPath:eo="",docsSlug:to})=>eo?`${Xr??"https://viem.sh"}${eo}${to?`#${to}`:""}`:void 0,version:`viem@${version$v}`};class BaseError extends Error{constructor(eo,to={}){var ao;const ro=(()=>{var so;return to.cause instanceof BaseError?to.cause.details:(so=to.cause)!=null&&so.message?to.cause.message:to.details})(),no=to.cause instanceof BaseError&&to.cause.docsPath||to.docsPath,io=(ao=errorConfig.getDocsUrl)==null?void 0:ao.call(errorConfig,{...to,docsPath:no}),oo=[eo||"An error occurred.","",...to.metaMessages?[...to.metaMessages,""]:[],...io?[`Docs: ${io}`]:[],...ro?[`Details: ${ro}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(` -`);super(oo,to.cause?{cause:to.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=ro,this.docsPath=no,this.metaMessages=to.metaMessages,this.name=to.name??this.name,this.shortMessage=eo,this.version=version$v}walk(eo){return walk(this,eo)}}function walk(Xr,eo){return eo!=null&&eo(Xr)?Xr:Xr&&typeof Xr=="object"&&"cause"in Xr?walk(Xr.cause,eo):eo?null:Xr}class AbiConstructorNotFoundError extends BaseError{constructor({docsPath:eo}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`+io):ro.stack=io}catch{}}throw ro}}_request(eo,to){typeof eo=="string"?(to=to||{},to.url=eo):to=eo||{},to=mergeConfig(this.defaults,to);const{transitional:ro,paramsSerializer:no,headers:io}=to;ro!==void 0&&validator.assertOptions(ro,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),no!=null&&(utils$c.isFunction(no)?to.paramsSerializer={serialize:no}:validator.assertOptions(no,{encode:validators.function,serialize:validators.function},!0)),to.method=(to.method||this.defaults.method||"get").toLowerCase();let oo=io&&utils$c.merge(io.common,io[to.method]);io&&utils$c.forEach(["delete","get","head","post","put","patch","common"],bo=>{delete io[bo]}),to.headers=AxiosHeaders.concat(oo,io);const ao=[];let so=!0;this.interceptors.request.forEach(function(wo){typeof wo.runWhen=="function"&&wo.runWhen(to)===!1||(so=so&&wo.synchronous,ao.unshift(wo.fulfilled,wo.rejected))});const co=[];this.interceptors.response.forEach(function(wo){co.push(wo.fulfilled,wo.rejected)});let lo,uo=0,ho;if(!so){const bo=[dispatchRequest.bind(this),void 0];for(bo.unshift.apply(bo,ao),bo.push.apply(bo,co),ho=bo.length,lo=Promise.resolve(to);uo{if(!ro._listeners)return;let io=ro._listeners.length;for(;io-- >0;)ro._listeners[io](no);ro._listeners=null}),this.promise.then=no=>{let io;const oo=new Promise(ao=>{ro.subscribe(ao),io=ao}).then(no);return oo.cancel=function(){ro.unsubscribe(io)},oo},eo(function(io,oo,ao){ro.reason||(ro.reason=new CanceledError(io,oo,ao),to(ro.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(eo){if(this.reason){eo(this.reason);return}this._listeners?this._listeners.push(eo):this._listeners=[eo]}unsubscribe(eo){if(!this._listeners)return;const to=this._listeners.indexOf(eo);to!==-1&&this._listeners.splice(to,1)}toAbortSignal(){const eo=new AbortController,to=ro=>{eo.abort(ro)};return this.subscribe(to),eo.signal.unsubscribe=()=>this.unsubscribe(to),eo.signal}static source(){let eo;return{token:new CancelToken(function(no){eo=no}),cancel:eo}}}function spread(Xr){return function(to){return Xr.apply(null,to)}}function isAxiosError(Xr){return utils$c.isObject(Xr)&&Xr.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([Xr,eo])=>{HttpStatusCode[eo]=Xr});function createInstance(Xr){const eo=new Axios(Xr),to=bind$1(Axios.prototype.request,eo);return utils$c.extend(to,Axios.prototype,eo,{allOwnKeys:!0}),utils$c.extend(to,eo,null,{allOwnKeys:!0}),to.create=function(no){return createInstance(mergeConfig(Xr,no))},to}const axios=createInstance(defaults);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION$5;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function(eo){return Promise.all(eo)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=Xr=>formDataToJSON(utils$c.isHTMLForm(Xr)?new FormData(Xr):Xr);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;const version$w="1.0.6";let BaseError$1=class Q3 extends Error{constructor(eo,to={}){var oo;const ro=to.cause instanceof Q3?to.cause.details:(oo=to.cause)!=null&&oo.message?to.cause.message:to.details,no=to.cause instanceof Q3&&to.cause.docsPath||to.docsPath,io=[eo||"An error occurred.","",...to.metaMessages?[...to.metaMessages,""]:[],...no?[`Docs: https://abitype.dev${no}`]:[],...ro?[`Details: ${ro}`]:[],`Version: abitype@${version$w}`].join(` +`);super(io),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),to.cause&&(this.cause=to.cause),this.details=ro,this.docsPath=no,this.metaMessages=to.metaMessages,this.shortMessage=eo}};function execTyped(Xr,eo){const to=Xr.exec(eo);return to==null?void 0:to.groups}const bytesRegex$1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex$1=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(Xr){let eo=Xr.type;if(tupleRegex.test(Xr.type)&&"components"in Xr){eo="(";const to=Xr.components.length;for(let no=0;no[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(Xr){return errorSignatureRegex.test(Xr)}function execErrorSignature(Xr){return execTyped(errorSignatureRegex,Xr)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(Xr){return eventSignatureRegex.test(Xr)}function execEventSignature(Xr){return execTyped(eventSignatureRegex,Xr)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(Xr){return functionSignatureRegex.test(Xr)}function execFunctionSignature(Xr){return execTyped(functionSignatureRegex,Xr)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(Xr){return structSignatureRegex.test(Xr)}function execStructSignature(Xr){return execTyped(structSignatureRegex,Xr)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(Xr){return constructorSignatureRegex.test(Xr)}function execConstructorSignature(Xr){return execTyped(constructorSignatureRegex,Xr)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(Xr){return fallbackSignatureRegex.test(Xr)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(Xr){return receiveSignatureRegex.test(Xr)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$1{constructor({type:eo}){super("Unknown type.",{metaMessages:[`Type "${eo}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class UnknownSolidityTypeError extends BaseError$1{constructor({type:eo}){super("Unknown type.",{metaMessages:[`Type "${eo}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidParameterError extends BaseError$1{constructor({param:eo}){super("Invalid ABI parameter.",{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$1{constructor({param:eo,name:to}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`"${to}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class InvalidModifierError extends BaseError$1{constructor({param:eo,type:to,modifier:ro}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`Modifier "${ro}" not allowed${to?` in "${to}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$1{constructor({param:eo,type:to,modifier:ro}){super("Invalid ABI parameter.",{details:eo,metaMessages:[`Modifier "${ro}" not allowed${to?` in "${to}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${ro}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$1{constructor({abiParameter:eo}){super("Invalid ABI parameter.",{details:JSON.stringify(eo,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class InvalidSignatureError extends BaseError$1{constructor({signature:eo,type:to}){super(`Invalid ${to} signature.`,{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class UnknownSignatureError extends BaseError$1{constructor({signature:eo}){super("Unknown signature.",{details:eo}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$1{constructor({signature:eo}){super("Invalid struct signature.",{details:eo,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$1{constructor({type:eo}){super("Circular reference detected.",{metaMessages:[`Struct "${eo}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$1{constructor({current:eo,depth:to}){super("Unbalanced parentheses.",{metaMessages:[`"${eo.trim()}" has too many ${to>0?"opening":"closing"} parentheses.`],details:`Depth "${to}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(Xr,eo){return eo?`${eo}:${Xr}`:Xr}const parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function parseSignature(Xr,eo={}){if(isFunctionSignature(Xr)){const to=execFunctionSignature(Xr);if(!to)throw new InvalidSignatureError({signature:Xr,type:"function"});const ro=splitParameters(to.parameters),no=[],io=ro.length;for(let ao=0;ao[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter(Xr,eo){var uo,ho;const to=getParameterCacheKey(Xr,eo==null?void 0:eo.type);if(parameterCache.has(to))return parameterCache.get(to);const ro=isTupleRegex.test(Xr),no=execTyped(ro?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,Xr);if(!no)throw new InvalidParameterError({param:Xr});if(no.name&&isSolidityKeyword(no.name))throw new SolidityProtectedKeywordError({param:Xr,name:no.name});const io=no.name?{name:no.name}:{},oo=no.modifier==="indexed"?{indexed:!0}:{},ao=(eo==null?void 0:eo.structs)??{};let so,co={};if(ro){so="tuple";const go=splitParameters(no.type),bo=[],wo=go.length;for(let Eo=0;Eo[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(Xr,eo,to=new Set){const ro=[],no=Xr.length;for(let io=0;ioeo(Xr,io)}function formatAbiItem(Xr,{includeName:eo=!1}={}){if(Xr.type!=="function"&&Xr.type!=="event"&&Xr.type!=="error")throw new InvalidDefinitionTypeError(Xr.type);return`${Xr.name}(${formatAbiParams(Xr.inputs,{includeName:eo})})`}function formatAbiParams(Xr,{includeName:eo=!1}={}){return Xr?Xr.map(to=>formatAbiParam(to,{includeName:eo})).join(eo?", ":","):""}function formatAbiParam(Xr,{includeName:eo}){return Xr.type.startsWith("tuple")?`(${formatAbiParams(Xr.components,{includeName:eo})})${Xr.type.slice(5)}`:Xr.type+(eo&&Xr.name?` ${Xr.name}`:"")}function isHex$4(Xr,{strict:eo=!0}={}){return!Xr||typeof Xr!="string"?!1:eo?/^0x[0-9a-fA-F]*$/.test(Xr):Xr.startsWith("0x")}function size$1(Xr){return isHex$4(Xr,{strict:!1})?Math.ceil((Xr.length-2)/2):Xr.length}const version$v="2.21.41";let errorConfig={getDocsUrl:({docsBaseUrl:Xr,docsPath:eo="",docsSlug:to})=>eo?`${Xr??"https://viem.sh"}${eo}${to?`#${to}`:""}`:void 0,version:`viem@${version$v}`};class BaseError extends Error{constructor(eo,to={}){var ao;const ro=(()=>{var so;return to.cause instanceof BaseError?to.cause.details:(so=to.cause)!=null&&so.message?to.cause.message:to.details})(),no=to.cause instanceof BaseError&&to.cause.docsPath||to.docsPath,io=(ao=errorConfig.getDocsUrl)==null?void 0:ao.call(errorConfig,{...to,docsPath:no}),oo=[eo||"An error occurred.","",...to.metaMessages?[...to.metaMessages,""]:[],...io?[`Docs: ${io}`]:[],...ro?[`Details: ${ro}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(` +`);super(oo,to.cause?{cause:to.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=ro,this.docsPath=no,this.metaMessages=to.metaMessages,this.name=to.name??this.name,this.shortMessage=eo,this.version=version$v}walk(eo){return walk(this,eo)}}function walk(Xr,eo){return eo!=null&&eo(Xr)?Xr:Xr&&typeof Xr=="object"&&"cause"in Xr&&Xr.cause!==void 0?walk(Xr.cause,eo):eo?null:Xr}class AbiConstructorNotFoundError extends BaseError{constructor({docsPath:eo}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` `),{docsPath:eo,name:"AbiConstructorNotFoundError"})}}class AbiConstructorParamsNotFoundError extends BaseError{constructor({docsPath:eo}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:eo,name:"AbiConstructorParamsNotFoundError"})}}class AbiDecodingDataSizeTooSmallError extends BaseError{constructor({data:eo,params:to,size:ro}){super([`Data size of ${ro} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${formatAbiParams(to,{includeName:!0})})`,`Data: ${eo} (${ro} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=eo,this.params=to,this.size=ro}}class AbiDecodingZeroDataError extends BaseError{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class AbiEncodingArrayLengthMismatchError extends BaseError{constructor({expectedLength:eo,givenLength:to,type:ro}){super([`ABI encoding array length mismatch for type ${ro}.`,`Expected length: ${eo}`,`Given length: ${to}`].join(` @@ -2141,7 +3971,7 @@ zoo`.split(` `),{docsPath:to,name:"InvalidAbiEncodingType"})}}class InvalidAbiDecodingTypeError extends BaseError{constructor(eo,{docsPath:to}){super([`Type "${eo}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:to,name:"InvalidAbiDecodingType"})}}class InvalidArrayError extends BaseError{constructor(eo){super([`Value "${eo}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class InvalidDefinitionTypeError extends BaseError{constructor(eo){super([`"${eo}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class UnsupportedPackedAbiType extends BaseError{constructor(eo){super(`Type "${eo}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}class FilterTypeNotSupportedError extends BaseError{constructor(eo){super(`Filter type "${eo}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}class SliceOffsetOutOfBoundsError extends BaseError{constructor({offset:eo,position:to,size:ro}){super(`Slice ${to==="start"?"starting":"ending"} at offset "${eo}" is out-of-bounds (size: ${ro}).`,{name:"SliceOffsetOutOfBoundsError"})}}class SizeExceedsPaddingSizeError extends BaseError{constructor({size:eo,targetSize:to,type:ro}){super(`${ro.charAt(0).toUpperCase()}${ro.slice(1).toLowerCase()} size (${eo}) exceeds padding size (${to}).`,{name:"SizeExceedsPaddingSizeError"})}}class InvalidBytesLengthError extends BaseError{constructor({size:eo,targetSize:to,type:ro}){super(`${ro.charAt(0).toUpperCase()}${ro.slice(1).toLowerCase()} is expected to be ${to} ${ro} long, but is ${eo} ${ro} long.`,{name:"InvalidBytesLengthError"})}}function pad$1(Xr,{dir:eo,size:to=32}={}){return typeof Xr=="string"?padHex(Xr,{dir:eo,size:to}):padBytes(Xr,{dir:eo,size:to})}function padHex(Xr,{dir:eo,size:to=32}={}){if(to===null)return Xr;const ro=Xr.replace("0x","");if(ro.length>to*2)throw new SizeExceedsPaddingSizeError({size:Math.ceil(ro.length/2),targetSize:to,type:"hex"});return`0x${ro[eo==="right"?"padEnd":"padStart"](to*2,"0")}`}function padBytes(Xr,{dir:eo,size:to=32}={}){if(to===null)return Xr;if(Xr.length>to)throw new SizeExceedsPaddingSizeError({size:Xr.length,targetSize:to,type:"bytes"});const ro=new Uint8Array(to);for(let no=0;noeo)throw new SizeOverflowError({givenSize:size$1(Xr),maxSize:eo})}function hexToBigInt(Xr,eo={}){const{signed:to}=eo;eo.size&&assertSize(Xr,{size:eo.size});const ro=BigInt(Xr);if(!to)return ro;const no=(Xr.length-2)/2,io=(1n<eo.toString(16).padStart(2,"0"));function toHex$1(Xr,eo={}){return typeof Xr=="number"||typeof Xr=="bigint"?numberToHex(Xr,eo):typeof Xr=="string"?stringToHex(Xr,eo):typeof Xr=="boolean"?boolToHex(Xr,eo):bytesToHex$2(Xr,eo)}function boolToHex(Xr,eo={}){const to=`0x${Number(Xr)}`;return typeof eo.size=="number"?(assertSize(to,{size:eo.size}),pad$1(to,{size:eo.size})):to}function bytesToHex$2(Xr,eo={}){let to="";for(let no=0;noio||no=charCodeMap.zero&&Xr<=charCodeMap.nine)return Xr-charCodeMap.zero;if(Xr>=charCodeMap.A&&Xr<=charCodeMap.F)return Xr-(charCodeMap.A-10);if(Xr>=charCodeMap.a&&Xr<=charCodeMap.f)return Xr-(charCodeMap.a-10)}function hexToBytes$3(Xr,eo={}){let to=Xr;eo.size&&(assertSize(to,{size:eo.size}),to=pad$1(to,{dir:"right",size:eo.size}));let ro=to.slice(2);ro.length%2&&(ro=`0${ro}`);const no=ro.length/2,io=new Uint8Array(no);for(let oo=0,ao=0;oo>_7n$1)*_0x71n$1)%_256n$1,eo&_2n$7&&(no^=_1n$b<<(_1n$b<to>32?rotlBH$1(Xr,eo,to):rotlSH$1(Xr,eo,to),rotlL$1=(Xr,eo,to)=>to>32?rotlBL$1(Xr,eo,to):rotlSL$1(Xr,eo,to);function keccakP$1(Xr,eo=24){const to=new Uint32Array(10);for(let ro=24-eo;ro<24;ro++){for(let oo=0;oo<10;oo++)to[oo]=Xr[oo]^Xr[oo+10]^Xr[oo+20]^Xr[oo+30]^Xr[oo+40];for(let oo=0;oo<10;oo+=2){const ao=(oo+8)%10,so=(oo+2)%10,co=to[so],lo=to[so+1],fo=rotlH$1(co,lo,1)^to[ao],ho=rotlL$1(co,lo,1)^to[ao+1];for(let go=0;go<50;go+=10)Xr[oo+go]^=fo,Xr[oo+go+1]^=ho}let no=Xr[2],io=Xr[3];for(let oo=0;oo<24;oo++){const ao=SHA3_ROTL$1[oo],so=rotlH$1(no,io,ao),co=rotlL$1(no,io,ao),lo=SHA3_PI$1[oo];no=Xr[lo],io=Xr[lo+1],Xr[lo]=so,Xr[lo+1]=co}for(let oo=0;oo<50;oo+=10){for(let ao=0;ao<10;ao++)to[ao]=Xr[oo+ao];for(let ao=0;ao<10;ao++)Xr[oo+ao]^=~to[(ao+2)%10]&to[(ao+4)%10]}Xr[0]^=SHA3_IOTA_H$1[ro],Xr[1]^=SHA3_IOTA_L$1[ro]}to.fill(0)}let Keccak$2=class S_ extends Hash$5{constructor(eo,to,ro,no=!1,io=24){if(super(),this.blockLen=eo,this.suffix=to,this.outputLen=ro,this.enableXOF=no,this.rounds=io,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$7(ro),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$2(this.state)}keccak(){isLE$1||byteSwap32(this.state32),keccakP$1(this.state32,this.rounds),isLE$1||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(eo){exists$3(this);const{blockLen:to,state:ro}=this;eo=toBytes$2(eo);const no=eo.length;for(let io=0;io=ro&&this.keccak();const oo=Math.min(ro-this.posOut,io-no);eo.set(to.subarray(this.posOut,this.posOut+oo),no),this.posOut+=oo,no+=oo}return eo}xofInto(eo){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(eo)}xof(eo){return number$7(eo),this.xofInto(new Uint8Array(eo))}digestInto(eo){if(output$2(eo,this),this.finished)throw new Error("digest() was already called");return this.writeInto(eo),this.destroy(),eo}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(eo){const{blockLen:to,suffix:ro,outputLen:no,rounds:io,enableXOF:oo}=this;return eo||(eo=new S_(to,ro,no,oo,io)),eo.state32.set(this.state32),eo.pos=this.pos,eo.posOut=this.posOut,eo.finished=this.finished,eo.rounds=io,eo.suffix=ro,eo.outputLen=no,eo.enableXOF=oo,eo.destroyed=this.destroyed,eo}};const gen$1=(Xr,eo,to)=>wrapConstructor$1(()=>new Keccak$2(eo,Xr,to)),keccak_256$1=gen$1(1,136,256/8);function keccak256(Xr,eo){const to=eo||"hex",ro=keccak_256$1(isHex$4(Xr,{strict:!1})?toBytes$1(Xr):Xr);return to==="bytes"?ro:toHex$1(ro)}const hash$4=Xr=>keccak256(toBytes$1(Xr));function hashSignature(Xr){return hash$4(Xr)}function normalizeSignature(Xr){let eo=!0,to="",ro=0,no="",io=!1;for(let oo=0;oo{const eo=typeof Xr=="string"?Xr:formatAbiItem$1(Xr);return normalizeSignature(eo)};function toSignatureHash(Xr){return hashSignature(toSignature(Xr))}const toEventSelector=toSignatureHash;class InvalidAddressError extends BaseError{constructor({address:eo}){super(`Address "${eo}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(eo){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=eo}get(eo){const to=super.get(eo);return super.has(eo)&&to!==void 0&&(this.delete(eo),super.set(eo,to)),to}set(eo,to){if(super.set(eo,to),this.maxSize&&this.size>this.maxSize){const ro=this.keys().next().value;ro&&this.delete(ro)}return this}}const checksumAddressCache=new LruMap(8192);function checksumAddress(Xr,eo){if(checksumAddressCache.has(`${Xr}.${eo}`))return checksumAddressCache.get(`${Xr}.${eo}`);const to=Xr.substring(2).toLowerCase(),ro=keccak256(stringToBytes$1(to),"bytes"),no=to.split("");for(let oo=0;oo<40;oo+=2)ro[oo>>1]>>4>=8&&no[oo]&&(no[oo]=no[oo].toUpperCase()),(ro[oo>>1]&15)>=8&&no[oo+1]&&(no[oo+1]=no[oo+1].toUpperCase());const io=`0x${no.join("")}`;return checksumAddressCache.set(`${Xr}.${eo}`,io),io}function getAddress$1(Xr,eo){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});return checksumAddress(Xr,eo)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(Xr,eo){const{strict:to=!0}=eo??{},ro=`${Xr}.${to}`;if(isAddressCache.has(ro))return isAddressCache.get(ro);const no=addressRegex.test(Xr)?Xr.toLowerCase()===Xr?!0:to?checksumAddress(Xr)===Xr:!0:!1;return isAddressCache.set(ro,no),no}function concat$1(Xr){return typeof Xr[0]=="string"?concatHex(Xr):concatBytes$3(Xr)}function concatBytes$3(Xr){let eo=0;for(const no of Xr)eo+=no.length;const to=new Uint8Array(eo);let ro=0;for(const no of Xr)to.set(no,ro),ro+=no.length;return to}function concatHex(Xr){return`0x${Xr.reduce((eo,to)=>eo+to.replace("0x",""),"")}`}function slice(Xr,eo,to,{strict:ro}={}){return isHex$4(Xr,{strict:!1})?sliceHex(Xr,eo,to,{strict:ro}):sliceBytes(Xr,eo,to,{strict:ro})}function assertStartOffset(Xr,eo){if(typeof eo=="number"&&eo>0&&eo>size$1(Xr)-1)throw new SliceOffsetOutOfBoundsError({offset:eo,position:"start",size:size$1(Xr)})}function assertEndOffset(Xr,eo,to){if(typeof eo=="number"&&typeof to=="number"&&size$1(Xr)!==to-eo)throw new SliceOffsetOutOfBoundsError({offset:to,position:"end",size:size$1(Xr)})}function sliceBytes(Xr,eo,to,{strict:ro}={}){assertStartOffset(Xr,eo);const no=Xr.slice(eo,to);return ro&&assertEndOffset(no,eo,to),no}function sliceHex(Xr,eo,to,{strict:ro}={}){assertStartOffset(Xr,eo);const no=`0x${Xr.replace("0x","").slice((eo??0)*2,(to??Xr.length)*2)}`;return ro&&assertEndOffset(no,eo,to),no}function encodeAbiParameters(Xr,eo){if(Xr.length!==eo.length)throw new AbiEncodingLengthMismatchError({expectedLength:Xr.length,givenLength:eo.length});const to=prepareParams({params:Xr,values:eo}),ro=encodeParams(to);return ro.length===0?"0x":ro}function prepareParams({params:Xr,values:eo}){const to=[];for(let ro=0;ro0?concat$1([ao,oo]):ao}}if(no)return{dynamic:!0,encoded:oo}}return{dynamic:!1,encoded:concat$1(io.map(({encoded:oo})=>oo))}}function encodeBytes(Xr,{param:eo}){const[,to]=eo.type.split("bytes"),ro=size$1(Xr);if(!to){let no=Xr;return ro%32!==0&&(no=padHex(no,{dir:"right",size:Math.ceil((Xr.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$1([padHex(numberToHex(ro,{size:32})),no])}}if(ro!==Number.parseInt(to))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(to),value:Xr});return{dynamic:!1,encoded:padHex(Xr,{dir:"right"})}}function encodeBool(Xr){if(typeof Xr!="boolean")throw new BaseError(`Invalid boolean value: "${Xr}" (type: ${typeof Xr}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex(boolToHex(Xr))}}function encodeNumber(Xr,{signed:eo}){return{dynamic:!1,encoded:numberToHex(Xr,{size:32,signed:eo})}}function encodeString(Xr){const eo=stringToHex(Xr),to=Math.ceil(size$1(eo)/32),ro=[];for(let no=0;nono))}}function getArrayComponents(Xr){const eo=Xr.match(/^(.*)\[(\d+)?\]$/);return eo?[eo[2]?Number(eo[2]):null,eo[1]]:void 0}const toFunctionSelector=Xr=>slice(toSignatureHash(Xr),0,4);function getAbiItem(Xr){const{abi:eo,args:to=[],name:ro}=Xr,no=isHex$4(ro,{strict:!1}),io=eo.filter(ao=>no?ao.type==="function"?toFunctionSelector(ao)===ro:ao.type==="event"?toEventSelector(ao)===ro:!1:"name"in ao&&ao.name===ro);if(io.length===0)return;if(io.length===1)return io[0];let oo;for(const ao of io){if(!("inputs"in ao))continue;if(!to||to.length===0){if(!ao.inputs||ao.inputs.length===0)return ao;continue}if(!ao.inputs||ao.inputs.length===0||ao.inputs.length!==to.length)continue;if(to.every((co,lo)=>{const fo="inputs"in ao&&ao.inputs[lo];return fo?isArgOfType(co,fo):!1})){if(oo&&"inputs"in oo&&oo.inputs){const co=getAmbiguousTypes(ao.inputs,oo.inputs,to);if(co)throw new AbiItemAmbiguityError({abiItem:ao,type:co[0]},{abiItem:oo,type:co[1]})}oo=ao}}return oo||io[0]}function isArgOfType(Xr,eo){const to=typeof Xr,ro=eo.type;switch(ro){case"address":return isAddress(Xr,{strict:!1});case"bool":return to==="boolean";case"function":return to==="string";case"string":return to==="string";default:return ro==="tuple"&&"components"in eo?Object.values(eo.components).every((no,io)=>isArgOfType(Object.values(Xr)[io],no)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(ro)?to==="number"||to==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(ro)?to==="string"||Xr instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(ro)?Array.isArray(Xr)&&Xr.every(no=>isArgOfType(no,{...eo,type:ro.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(Xr,eo,to){for(const ro in Xr){const no=Xr[ro],io=eo[ro];if(no.type==="tuple"&&io.type==="tuple"&&"components"in no&&"components"in io)return getAmbiguousTypes(no.components,io.components,to[ro]);const oo=[no.type,io.type];if(oo.includes("address")&&oo.includes("bytes20")?!0:oo.includes("address")&&oo.includes("string")?isAddress(to[ro],{strict:!1}):oo.includes("address")&&oo.includes("bytes")?isAddress(to[ro],{strict:!1}):!1)return oo}}const docsPath$4="/docs/contract/encodeEventTopics";function encodeEventTopics(Xr){var so;const{abi:eo,eventName:to,args:ro}=Xr;let no=eo[0];if(to){const co=getAbiItem({abi:eo,name:to});if(!co)throw new AbiEventNotFoundError(to,{docsPath:docsPath$4});no=co}if(no.type!=="event")throw new AbiEventNotFoundError(void 0,{docsPath:docsPath$4});const io=formatAbiItem(no),oo=toEventSelector(io);let ao=[];if(ro&&"inputs"in no){const co=(so=no.inputs)==null?void 0:so.filter(fo=>"indexed"in fo&&fo.indexed),lo=Array.isArray(ro)?ro:Object.values(ro).length>0?(co==null?void 0:co.map(fo=>ro[fo.name]))??[]:[];lo.length>0&&(ao=(co==null?void 0:co.map((fo,ho)=>Array.isArray(lo[ho])?lo[ho].map((go,yo)=>encodeArg({param:fo,value:lo[ho][yo]})):lo[ho]?encodeArg({param:fo,value:lo[ho]}):null))??[])}return[oo,...ao]}function encodeArg({param:Xr,value:eo}){if(Xr.type==="string"||Xr.type==="bytes")return keccak256(toBytes$1(eo));if(Xr.type==="tuple"||Xr.type.match(/^(.*)\[(\d+)?\]$/))throw new FilterTypeNotSupportedError(Xr.type);return encodeAbiParameters([Xr],[eo])}function createFilterRequestScope(Xr,{method:eo}){var ro,no;const to={};return Xr.transport.type==="fallback"&&((no=(ro=Xr.transport).onResponse)==null||no.call(ro,({method:io,response:oo,status:ao,transport:so})=>{ao==="success"&&eo===io&&(to[oo]=so.request)})),io=>to[io]||Xr.request}async function createContractEventFilter(Xr,eo){const{address:to,abi:ro,args:no,eventName:io,fromBlock:oo,strict:ao,toBlock:so}=eo,co=createFilterRequestScope(Xr,{method:"eth_newFilter"}),lo=io?encodeEventTopics({abi:ro,args:no,eventName:io}):void 0,fo=await Xr.request({method:"eth_newFilter",params:[{address:to,fromBlock:typeof oo=="bigint"?numberToHex(oo):oo,toBlock:typeof so=="bigint"?numberToHex(so):so,topics:lo}]});return{abi:ro,args:no,eventName:io,id:fo,request:co(fo),strict:!!ao,type:"event"}}function parseAccount(Xr){return typeof Xr=="string"?{address:Xr,type:"json-rpc"}:Xr}const docsPath$3="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(Xr){const{abi:eo,args:to,functionName:ro}=Xr;let no=eo[0];if(ro){const io=getAbiItem({abi:eo,args:to,name:ro});if(!io)throw new AbiFunctionNotFoundError(ro,{docsPath:docsPath$3});no=io}if(no.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$3});return{abi:[no],functionName:toFunctionSelector(formatAbiItem(no))}}function encodeFunctionData(Xr){const{args:eo}=Xr,{abi:to,functionName:ro}=(()=>{var ao;return Xr.abi.length===1&&((ao=Xr.functionName)!=null&&ao.startsWith("0x"))?Xr:prepareEncodeFunctionData(Xr)})(),no=to[0],io=ro,oo="inputs"in no&&no.inputs?encodeAbiParameters(no.inputs,eo??[]):void 0;return concatHex([io,oo??"0x"])}const panicReasons={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class NegativeOffsetError extends BaseError{constructor({offset:eo}){super(`Offset \`${eo}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError{constructor({length:eo,position:to}){super(`Position \`${to}\` is out of bounds (\`0 < position < ${eo}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError{constructor({count:eo,limit:to}){super(`Recursive read limit of \`${to}\` exceeded (recursive read count: \`${eo}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(Xr){if(Xr<0||Xr>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:Xr})},decrementPosition(Xr){if(Xr<0)throw new NegativeOffsetError({offset:Xr});const eo=this.position-Xr;this.assertPosition(eo),this.position=eo},getReadCount(Xr){return this.positionReadCount.get(Xr||this.position)||0},incrementPosition(Xr){if(Xr<0)throw new NegativeOffsetError({offset:Xr});const eo=this.position+Xr;this.assertPosition(eo),this.position=eo},inspectByte(Xr){const eo=Xr??this.position;return this.assertPosition(eo),this.bytes[eo]},inspectBytes(Xr,eo){const to=eo??this.position;return this.assertPosition(to+Xr-1),this.bytes.subarray(to,to+Xr)},inspectUint8(Xr){const eo=Xr??this.position;return this.assertPosition(eo),this.bytes[eo]},inspectUint16(Xr){const eo=Xr??this.position;return this.assertPosition(eo+1),this.dataView.getUint16(eo)},inspectUint24(Xr){const eo=Xr??this.position;return this.assertPosition(eo+2),(this.dataView.getUint16(eo)<<8)+this.dataView.getUint8(eo+2)},inspectUint32(Xr){const eo=Xr??this.position;return this.assertPosition(eo+3),this.dataView.getUint32(eo)},pushByte(Xr){this.assertPosition(this.position),this.bytes[this.position]=Xr,this.position++},pushBytes(Xr){this.assertPosition(this.position+Xr.length-1),this.bytes.set(Xr,this.position),this.position+=Xr.length},pushUint8(Xr){this.assertPosition(this.position),this.bytes[this.position]=Xr,this.position++},pushUint16(Xr){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,Xr),this.position+=2},pushUint24(Xr){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,Xr>>8),this.dataView.setUint8(this.position+2,Xr&255),this.position+=3},pushUint32(Xr){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,Xr),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const Xr=this.inspectByte();return this.position++,Xr},readBytes(Xr,eo){this.assertReadLimit(),this._touch();const to=this.inspectBytes(Xr);return this.position+=eo??Xr,to},readUint8(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint8();return this.position+=1,Xr},readUint16(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint16();return this.position+=2,Xr},readUint24(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint24();return this.position+=3,Xr},readUint32(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint32();return this.position+=4,Xr},get remaining(){return this.bytes.length-this.position},setPosition(Xr){const eo=this.position;return this.assertPosition(Xr),this.position=Xr,()=>this.position=eo},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const Xr=this.getReadCount();this.positionReadCount.set(this.position,Xr+1),Xr>0&&this.recursiveReadCount++}};function createCursor(Xr,{recursiveReadLimit:eo=8192}={}){const to=Object.create(staticCursor);return to.bytes=Xr,to.dataView=new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),to.positionReadCount=new Map,to.recursiveReadLimit=eo,to}function bytesToBigInt(Xr,eo={}){typeof eo.size<"u"&&assertSize(Xr,{size:eo.size});const to=bytesToHex$2(Xr,eo);return hexToBigInt(to,eo)}function bytesToBool(Xr,eo={}){let to=Xr;if(typeof eo.size<"u"&&(assertSize(to,{size:eo.size}),to=trim$1(to)),to.length>1||to[0]>1)throw new InvalidBytesBooleanError(to);return!!to[0]}function bytesToNumber(Xr,eo={}){typeof eo.size<"u"&&assertSize(Xr,{size:eo.size});const to=bytesToHex$2(Xr,eo);return hexToNumber$2(to,eo)}function bytesToString(Xr,eo={}){let to=Xr;return typeof eo.size<"u"&&(assertSize(to,{size:eo.size}),to=trim$1(to,{dir:"right"})),new TextDecoder().decode(to)}function decodeAbiParameters(Xr,eo){const to=typeof eo=="string"?hexToBytes$3(eo):eo,ro=createCursor(to);if(size$1(to)===0&&Xr.length>0)throw new AbiDecodingZeroDataError;if(size$1(eo)&&size$1(eo)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof eo=="string"?eo:bytesToHex$2(eo),params:Xr,size:size$1(eo)});let no=0;const io=[];for(let oo=0;oo48?bytesToBigInt(no,{signed:to}):bytesToNumber(no,{signed:to}),32]}function decodeTuple(Xr,eo,{staticPosition:to}){const ro=eo.components.length===0||eo.components.some(({name:oo})=>!oo),no=ro?[]:{};let io=0;if(hasDynamicChild(eo)){const oo=bytesToNumber(Xr.readBytes(sizeOfOffset)),ao=to+oo;for(let so=0;sooo.type==="error"&&ro===toFunctionSelector(formatAbiItem(oo)));if(!io)throw new AbiErrorSignatureNotFoundError(ro,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:io,args:"inputs"in io&&io.inputs&&io.inputs.length>0?decodeAbiParameters(io.inputs,slice(to,4)):void 0,errorName:io.name}}const stringify$4=(Xr,eo,to)=>JSON.stringify(Xr,(ro,no)=>typeof no=="bigint"?no.toString():no,to);function formatAbiItemWithArgs({abiItem:Xr,args:eo,includeFunctionName:to=!0,includeName:ro=!1}){if("name"in Xr&&"inputs"in Xr&&Xr.inputs)return`${to?Xr.name:""}(${Xr.inputs.map((no,io)=>`${ro&&no.name?`${no.name}: `:""}${typeof eo[io]=="object"?stringify$4(eo[io]):eo[io]}`).join(", ")})`}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9};function formatUnits(Xr,eo){let to=Xr.toString();const ro=to.startsWith("-");ro&&(to=to.slice(1)),to=to.padStart(eo,"0");let[no,io]=[to.slice(0,to.length-eo),to.slice(to.length-eo)];return io=io.replace(/(0+)$/,""),`${ro?"-":""}${no||"0"}${io?`.${io}`:""}`}function formatEther$1(Xr,eo="wei"){return formatUnits(Xr,etherUnits[eo])}function formatGwei(Xr,eo="wei"){return formatUnits(Xr,gweiUnits[eo])}class AccountStateConflictError extends BaseError{constructor({address:eo}){super(`State for account "${eo}" is set multiple times.`,{name:"AccountStateConflictError"})}}class StateAssignmentConflictError extends BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function prettyStateMapping(Xr){return Xr.reduce((eo,{slot:to,value:ro})=>`${eo} ${to}: ${ro} +`),{name:"InvalidDefinitionTypeError"})}}class UnsupportedPackedAbiType extends BaseError{constructor(eo){super(`Type "${eo}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}class FilterTypeNotSupportedError extends BaseError{constructor(eo){super(`Filter type "${eo}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}class SliceOffsetOutOfBoundsError extends BaseError{constructor({offset:eo,position:to,size:ro}){super(`Slice ${to==="start"?"starting":"ending"} at offset "${eo}" is out-of-bounds (size: ${ro}).`,{name:"SliceOffsetOutOfBoundsError"})}}class SizeExceedsPaddingSizeError extends BaseError{constructor({size:eo,targetSize:to,type:ro}){super(`${ro.charAt(0).toUpperCase()}${ro.slice(1).toLowerCase()} size (${eo}) exceeds padding size (${to}).`,{name:"SizeExceedsPaddingSizeError"})}}class InvalidBytesLengthError extends BaseError{constructor({size:eo,targetSize:to,type:ro}){super(`${ro.charAt(0).toUpperCase()}${ro.slice(1).toLowerCase()} is expected to be ${to} ${ro} long, but is ${eo} ${ro} long.`,{name:"InvalidBytesLengthError"})}}function pad$1(Xr,{dir:eo,size:to=32}={}){return typeof Xr=="string"?padHex(Xr,{dir:eo,size:to}):padBytes(Xr,{dir:eo,size:to})}function padHex(Xr,{dir:eo,size:to=32}={}){if(to===null)return Xr;const ro=Xr.replace("0x","");if(ro.length>to*2)throw new SizeExceedsPaddingSizeError({size:Math.ceil(ro.length/2),targetSize:to,type:"hex"});return`0x${ro[eo==="right"?"padEnd":"padStart"](to*2,"0")}`}function padBytes(Xr,{dir:eo,size:to=32}={}){if(to===null)return Xr;if(Xr.length>to)throw new SizeExceedsPaddingSizeError({size:Xr.length,targetSize:to,type:"bytes"});const ro=new Uint8Array(to);for(let no=0;noeo)throw new SizeOverflowError({givenSize:size$1(Xr),maxSize:eo})}function hexToBigInt(Xr,eo={}){const{signed:to}=eo;eo.size&&assertSize(Xr,{size:eo.size});const ro=BigInt(Xr);if(!to)return ro;const no=(Xr.length-2)/2,io=(1n<eo.toString(16).padStart(2,"0"));function toHex$1(Xr,eo={}){return typeof Xr=="number"||typeof Xr=="bigint"?numberToHex(Xr,eo):typeof Xr=="string"?stringToHex(Xr,eo):typeof Xr=="boolean"?boolToHex(Xr,eo):bytesToHex$2(Xr,eo)}function boolToHex(Xr,eo={}){const to=`0x${Number(Xr)}`;return typeof eo.size=="number"?(assertSize(to,{size:eo.size}),pad$1(to,{size:eo.size})):to}function bytesToHex$2(Xr,eo={}){let to="";for(let no=0;noio||no=charCodeMap.zero&&Xr<=charCodeMap.nine)return Xr-charCodeMap.zero;if(Xr>=charCodeMap.A&&Xr<=charCodeMap.F)return Xr-(charCodeMap.A-10);if(Xr>=charCodeMap.a&&Xr<=charCodeMap.f)return Xr-(charCodeMap.a-10)}function hexToBytes$3(Xr,eo={}){let to=Xr;eo.size&&(assertSize(to,{size:eo.size}),to=pad$1(to,{dir:"right",size:eo.size}));let ro=to.slice(2);ro.length%2&&(ro=`0${ro}`);const no=ro.length/2,io=new Uint8Array(no);for(let oo=0,ao=0;oo>_7n$1)*_0x71n$1)%_256n$1,eo&_2n$7&&(no^=_1n$b<<(_1n$b<to>32?rotlBH$1(Xr,eo,to):rotlSH$1(Xr,eo,to),rotlL$1=(Xr,eo,to)=>to>32?rotlBL$1(Xr,eo,to):rotlSL$1(Xr,eo,to);function keccakP$1(Xr,eo=24){const to=new Uint32Array(10);for(let ro=24-eo;ro<24;ro++){for(let oo=0;oo<10;oo++)to[oo]=Xr[oo]^Xr[oo+10]^Xr[oo+20]^Xr[oo+30]^Xr[oo+40];for(let oo=0;oo<10;oo+=2){const ao=(oo+8)%10,so=(oo+2)%10,co=to[so],lo=to[so+1],uo=rotlH$1(co,lo,1)^to[ao],ho=rotlL$1(co,lo,1)^to[ao+1];for(let go=0;go<50;go+=10)Xr[oo+go]^=uo,Xr[oo+go+1]^=ho}let no=Xr[2],io=Xr[3];for(let oo=0;oo<24;oo++){const ao=SHA3_ROTL$1[oo],so=rotlH$1(no,io,ao),co=rotlL$1(no,io,ao),lo=SHA3_PI$1[oo];no=Xr[lo],io=Xr[lo+1],Xr[lo]=so,Xr[lo+1]=co}for(let oo=0;oo<50;oo+=10){for(let ao=0;ao<10;ao++)to[ao]=Xr[oo+ao];for(let ao=0;ao<10;ao++)Xr[oo+ao]^=~to[(ao+2)%10]&to[(ao+4)%10]}Xr[0]^=SHA3_IOTA_H$1[ro],Xr[1]^=SHA3_IOTA_L$1[ro]}to.fill(0)}let Keccak$2=class aC extends Hash$5{constructor(eo,to,ro,no=!1,io=24){if(super(),this.blockLen=eo,this.suffix=to,this.outputLen=ro,this.enableXOF=no,this.rounds=io,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$7(ro),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$2(this.state)}keccak(){isLE$1||byteSwap32(this.state32),keccakP$1(this.state32,this.rounds),isLE$1||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(eo){exists$3(this);const{blockLen:to,state:ro}=this;eo=toBytes$2(eo);const no=eo.length;for(let io=0;io=ro&&this.keccak();const oo=Math.min(ro-this.posOut,io-no);eo.set(to.subarray(this.posOut,this.posOut+oo),no),this.posOut+=oo,no+=oo}return eo}xofInto(eo){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(eo)}xof(eo){return number$7(eo),this.xofInto(new Uint8Array(eo))}digestInto(eo){if(output$2(eo,this),this.finished)throw new Error("digest() was already called");return this.writeInto(eo),this.destroy(),eo}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(eo){const{blockLen:to,suffix:ro,outputLen:no,rounds:io,enableXOF:oo}=this;return eo||(eo=new aC(to,ro,no,oo,io)),eo.state32.set(this.state32),eo.pos=this.pos,eo.posOut=this.posOut,eo.finished=this.finished,eo.rounds=io,eo.suffix=ro,eo.outputLen=no,eo.enableXOF=oo,eo.destroyed=this.destroyed,eo}};const gen$1=(Xr,eo,to)=>wrapConstructor$1(()=>new Keccak$2(eo,Xr,to)),keccak_256$1=gen$1(1,136,256/8);function keccak256(Xr,eo){const to=eo||"hex",ro=keccak_256$1(isHex$4(Xr,{strict:!1})?toBytes$1(Xr):Xr);return to==="bytes"?ro:toHex$1(ro)}const hash$4=Xr=>keccak256(toBytes$1(Xr));function hashSignature(Xr){return hash$4(Xr)}function normalizeSignature(Xr){let eo=!0,to="",ro=0,no="",io=!1;for(let oo=0;oo{const eo=typeof Xr=="string"?Xr:formatAbiItem$1(Xr);return normalizeSignature(eo)};function toSignatureHash(Xr){return hashSignature(toSignature(Xr))}const toEventSelector=toSignatureHash;class InvalidAddressError extends BaseError{constructor({address:eo}){super(`Address "${eo}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(eo){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=eo}get(eo){const to=super.get(eo);return super.has(eo)&&to!==void 0&&(this.delete(eo),super.set(eo,to)),to}set(eo,to){if(super.set(eo,to),this.maxSize&&this.size>this.maxSize){const ro=this.keys().next().value;ro&&this.delete(ro)}return this}}const checksumAddressCache=new LruMap(8192);function checksumAddress(Xr,eo){if(checksumAddressCache.has(`${Xr}.${eo}`))return checksumAddressCache.get(`${Xr}.${eo}`);const to=Xr.substring(2).toLowerCase(),ro=keccak256(stringToBytes$1(to),"bytes"),no=to.split("");for(let oo=0;oo<40;oo+=2)ro[oo>>1]>>4>=8&&no[oo]&&(no[oo]=no[oo].toUpperCase()),(ro[oo>>1]&15)>=8&&no[oo+1]&&(no[oo+1]=no[oo+1].toUpperCase());const io=`0x${no.join("")}`;return checksumAddressCache.set(`${Xr}.${eo}`,io),io}function getAddress$1(Xr,eo){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});return checksumAddress(Xr,eo)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(Xr,eo){const{strict:to=!0}=eo??{},ro=`${Xr}.${to}`;if(isAddressCache.has(ro))return isAddressCache.get(ro);const no=addressRegex.test(Xr)?Xr.toLowerCase()===Xr?!0:to?checksumAddress(Xr)===Xr:!0:!1;return isAddressCache.set(ro,no),no}function concat$1(Xr){return typeof Xr[0]=="string"?concatHex(Xr):concatBytes$3(Xr)}function concatBytes$3(Xr){let eo=0;for(const no of Xr)eo+=no.length;const to=new Uint8Array(eo);let ro=0;for(const no of Xr)to.set(no,ro),ro+=no.length;return to}function concatHex(Xr){return`0x${Xr.reduce((eo,to)=>eo+to.replace("0x",""),"")}`}function slice(Xr,eo,to,{strict:ro}={}){return isHex$4(Xr,{strict:!1})?sliceHex(Xr,eo,to,{strict:ro}):sliceBytes(Xr,eo,to,{strict:ro})}function assertStartOffset(Xr,eo){if(typeof eo=="number"&&eo>0&&eo>size$1(Xr)-1)throw new SliceOffsetOutOfBoundsError({offset:eo,position:"start",size:size$1(Xr)})}function assertEndOffset(Xr,eo,to){if(typeof eo=="number"&&typeof to=="number"&&size$1(Xr)!==to-eo)throw new SliceOffsetOutOfBoundsError({offset:to,position:"end",size:size$1(Xr)})}function sliceBytes(Xr,eo,to,{strict:ro}={}){assertStartOffset(Xr,eo);const no=Xr.slice(eo,to);return ro&&assertEndOffset(no,eo,to),no}function sliceHex(Xr,eo,to,{strict:ro}={}){assertStartOffset(Xr,eo);const no=`0x${Xr.replace("0x","").slice((eo??0)*2,(to??Xr.length)*2)}`;return ro&&assertEndOffset(no,eo,to),no}function encodeAbiParameters(Xr,eo){if(Xr.length!==eo.length)throw new AbiEncodingLengthMismatchError({expectedLength:Xr.length,givenLength:eo.length});const to=prepareParams({params:Xr,values:eo}),ro=encodeParams(to);return ro.length===0?"0x":ro}function prepareParams({params:Xr,values:eo}){const to=[];for(let ro=0;ro0?concat$1([ao,oo]):ao}}if(no)return{dynamic:!0,encoded:oo}}return{dynamic:!1,encoded:concat$1(io.map(({encoded:oo})=>oo))}}function encodeBytes(Xr,{param:eo}){const[,to]=eo.type.split("bytes"),ro=size$1(Xr);if(!to){let no=Xr;return ro%32!==0&&(no=padHex(no,{dir:"right",size:Math.ceil((Xr.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$1([padHex(numberToHex(ro,{size:32})),no])}}if(ro!==Number.parseInt(to))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(to),value:Xr});return{dynamic:!1,encoded:padHex(Xr,{dir:"right"})}}function encodeBool(Xr){if(typeof Xr!="boolean")throw new BaseError(`Invalid boolean value: "${Xr}" (type: ${typeof Xr}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex(boolToHex(Xr))}}function encodeNumber(Xr,{signed:eo}){return{dynamic:!1,encoded:numberToHex(Xr,{size:32,signed:eo})}}function encodeString(Xr){const eo=stringToHex(Xr),to=Math.ceil(size$1(eo)/32),ro=[];for(let no=0;nono))}}function getArrayComponents(Xr){const eo=Xr.match(/^(.*)\[(\d+)?\]$/);return eo?[eo[2]?Number(eo[2]):null,eo[1]]:void 0}const toFunctionSelector=Xr=>slice(toSignatureHash(Xr),0,4);function getAbiItem(Xr){const{abi:eo,args:to=[],name:ro}=Xr,no=isHex$4(ro,{strict:!1}),io=eo.filter(ao=>no?ao.type==="function"?toFunctionSelector(ao)===ro:ao.type==="event"?toEventSelector(ao)===ro:!1:"name"in ao&&ao.name===ro);if(io.length===0)return;if(io.length===1)return io[0];let oo;for(const ao of io){if(!("inputs"in ao))continue;if(!to||to.length===0){if(!ao.inputs||ao.inputs.length===0)return ao;continue}if(!ao.inputs||ao.inputs.length===0||ao.inputs.length!==to.length)continue;if(to.every((co,lo)=>{const uo="inputs"in ao&&ao.inputs[lo];return uo?isArgOfType(co,uo):!1})){if(oo&&"inputs"in oo&&oo.inputs){const co=getAmbiguousTypes(ao.inputs,oo.inputs,to);if(co)throw new AbiItemAmbiguityError({abiItem:ao,type:co[0]},{abiItem:oo,type:co[1]})}oo=ao}}return oo||io[0]}function isArgOfType(Xr,eo){const to=typeof Xr,ro=eo.type;switch(ro){case"address":return isAddress(Xr,{strict:!1});case"bool":return to==="boolean";case"function":return to==="string";case"string":return to==="string";default:return ro==="tuple"&&"components"in eo?Object.values(eo.components).every((no,io)=>isArgOfType(Object.values(Xr)[io],no)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(ro)?to==="number"||to==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(ro)?to==="string"||Xr instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(ro)?Array.isArray(Xr)&&Xr.every(no=>isArgOfType(no,{...eo,type:ro.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(Xr,eo,to){for(const ro in Xr){const no=Xr[ro],io=eo[ro];if(no.type==="tuple"&&io.type==="tuple"&&"components"in no&&"components"in io)return getAmbiguousTypes(no.components,io.components,to[ro]);const oo=[no.type,io.type];if(oo.includes("address")&&oo.includes("bytes20")?!0:oo.includes("address")&&oo.includes("string")?isAddress(to[ro],{strict:!1}):oo.includes("address")&&oo.includes("bytes")?isAddress(to[ro],{strict:!1}):!1)return oo}}const docsPath$4="/docs/contract/encodeEventTopics";function encodeEventTopics(Xr){var so;const{abi:eo,eventName:to,args:ro}=Xr;let no=eo[0];if(to){const co=getAbiItem({abi:eo,name:to});if(!co)throw new AbiEventNotFoundError(to,{docsPath:docsPath$4});no=co}if(no.type!=="event")throw new AbiEventNotFoundError(void 0,{docsPath:docsPath$4});const io=formatAbiItem(no),oo=toEventSelector(io);let ao=[];if(ro&&"inputs"in no){const co=(so=no.inputs)==null?void 0:so.filter(uo=>"indexed"in uo&&uo.indexed),lo=Array.isArray(ro)?ro:Object.values(ro).length>0?(co==null?void 0:co.map(uo=>ro[uo.name]))??[]:[];lo.length>0&&(ao=(co==null?void 0:co.map((uo,ho)=>Array.isArray(lo[ho])?lo[ho].map((go,bo)=>encodeArg({param:uo,value:lo[ho][bo]})):lo[ho]?encodeArg({param:uo,value:lo[ho]}):null))??[])}return[oo,...ao]}function encodeArg({param:Xr,value:eo}){if(Xr.type==="string"||Xr.type==="bytes")return keccak256(toBytes$1(eo));if(Xr.type==="tuple"||Xr.type.match(/^(.*)\[(\d+)?\]$/))throw new FilterTypeNotSupportedError(Xr.type);return encodeAbiParameters([Xr],[eo])}function createFilterRequestScope(Xr,{method:eo}){var ro,no;const to={};return Xr.transport.type==="fallback"&&((no=(ro=Xr.transport).onResponse)==null||no.call(ro,({method:io,response:oo,status:ao,transport:so})=>{ao==="success"&&eo===io&&(to[oo]=so.request)})),io=>to[io]||Xr.request}async function createContractEventFilter(Xr,eo){const{address:to,abi:ro,args:no,eventName:io,fromBlock:oo,strict:ao,toBlock:so}=eo,co=createFilterRequestScope(Xr,{method:"eth_newFilter"}),lo=io?encodeEventTopics({abi:ro,args:no,eventName:io}):void 0,uo=await Xr.request({method:"eth_newFilter",params:[{address:to,fromBlock:typeof oo=="bigint"?numberToHex(oo):oo,toBlock:typeof so=="bigint"?numberToHex(so):so,topics:lo}]});return{abi:ro,args:no,eventName:io,id:uo,request:co(uo),strict:!!ao,type:"event"}}function parseAccount(Xr){return typeof Xr=="string"?{address:Xr,type:"json-rpc"}:Xr}const docsPath$3="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(Xr){const{abi:eo,args:to,functionName:ro}=Xr;let no=eo[0];if(ro){const io=getAbiItem({abi:eo,args:to,name:ro});if(!io)throw new AbiFunctionNotFoundError(ro,{docsPath:docsPath$3});no=io}if(no.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$3});return{abi:[no],functionName:toFunctionSelector(formatAbiItem(no))}}function encodeFunctionData(Xr){const{args:eo}=Xr,{abi:to,functionName:ro}=(()=>{var ao;return Xr.abi.length===1&&((ao=Xr.functionName)!=null&&ao.startsWith("0x"))?Xr:prepareEncodeFunctionData(Xr)})(),no=to[0],io=ro,oo="inputs"in no&&no.inputs?encodeAbiParameters(no.inputs,eo??[]):void 0;return concatHex([io,oo??"0x"])}const panicReasons={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class NegativeOffsetError extends BaseError{constructor({offset:eo}){super(`Offset \`${eo}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError{constructor({length:eo,position:to}){super(`Position \`${to}\` is out of bounds (\`0 < position < ${eo}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError{constructor({count:eo,limit:to}){super(`Recursive read limit of \`${to}\` exceeded (recursive read count: \`${eo}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(Xr){if(Xr<0||Xr>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:Xr})},decrementPosition(Xr){if(Xr<0)throw new NegativeOffsetError({offset:Xr});const eo=this.position-Xr;this.assertPosition(eo),this.position=eo},getReadCount(Xr){return this.positionReadCount.get(Xr||this.position)||0},incrementPosition(Xr){if(Xr<0)throw new NegativeOffsetError({offset:Xr});const eo=this.position+Xr;this.assertPosition(eo),this.position=eo},inspectByte(Xr){const eo=Xr??this.position;return this.assertPosition(eo),this.bytes[eo]},inspectBytes(Xr,eo){const to=eo??this.position;return this.assertPosition(to+Xr-1),this.bytes.subarray(to,to+Xr)},inspectUint8(Xr){const eo=Xr??this.position;return this.assertPosition(eo),this.bytes[eo]},inspectUint16(Xr){const eo=Xr??this.position;return this.assertPosition(eo+1),this.dataView.getUint16(eo)},inspectUint24(Xr){const eo=Xr??this.position;return this.assertPosition(eo+2),(this.dataView.getUint16(eo)<<8)+this.dataView.getUint8(eo+2)},inspectUint32(Xr){const eo=Xr??this.position;return this.assertPosition(eo+3),this.dataView.getUint32(eo)},pushByte(Xr){this.assertPosition(this.position),this.bytes[this.position]=Xr,this.position++},pushBytes(Xr){this.assertPosition(this.position+Xr.length-1),this.bytes.set(Xr,this.position),this.position+=Xr.length},pushUint8(Xr){this.assertPosition(this.position),this.bytes[this.position]=Xr,this.position++},pushUint16(Xr){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,Xr),this.position+=2},pushUint24(Xr){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,Xr>>8),this.dataView.setUint8(this.position+2,Xr&255),this.position+=3},pushUint32(Xr){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,Xr),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const Xr=this.inspectByte();return this.position++,Xr},readBytes(Xr,eo){this.assertReadLimit(),this._touch();const to=this.inspectBytes(Xr);return this.position+=eo??Xr,to},readUint8(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint8();return this.position+=1,Xr},readUint16(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint16();return this.position+=2,Xr},readUint24(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint24();return this.position+=3,Xr},readUint32(){this.assertReadLimit(),this._touch();const Xr=this.inspectUint32();return this.position+=4,Xr},get remaining(){return this.bytes.length-this.position},setPosition(Xr){const eo=this.position;return this.assertPosition(Xr),this.position=Xr,()=>this.position=eo},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const Xr=this.getReadCount();this.positionReadCount.set(this.position,Xr+1),Xr>0&&this.recursiveReadCount++}};function createCursor(Xr,{recursiveReadLimit:eo=8192}={}){const to=Object.create(staticCursor);return to.bytes=Xr,to.dataView=new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),to.positionReadCount=new Map,to.recursiveReadLimit=eo,to}function bytesToBigInt(Xr,eo={}){typeof eo.size<"u"&&assertSize(Xr,{size:eo.size});const to=bytesToHex$2(Xr,eo);return hexToBigInt(to,eo)}function bytesToBool(Xr,eo={}){let to=Xr;if(typeof eo.size<"u"&&(assertSize(to,{size:eo.size}),to=trim$1(to)),to.length>1||to[0]>1)throw new InvalidBytesBooleanError(to);return!!to[0]}function bytesToNumber(Xr,eo={}){typeof eo.size<"u"&&assertSize(Xr,{size:eo.size});const to=bytesToHex$2(Xr,eo);return hexToNumber$2(to,eo)}function bytesToString(Xr,eo={}){let to=Xr;return typeof eo.size<"u"&&(assertSize(to,{size:eo.size}),to=trim$1(to,{dir:"right"})),new TextDecoder().decode(to)}function decodeAbiParameters(Xr,eo){const to=typeof eo=="string"?hexToBytes$3(eo):eo,ro=createCursor(to);if(size$1(to)===0&&Xr.length>0)throw new AbiDecodingZeroDataError;if(size$1(eo)&&size$1(eo)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof eo=="string"?eo:bytesToHex$2(eo),params:Xr,size:size$1(eo)});let no=0;const io=[];for(let oo=0;oo48?bytesToBigInt(no,{signed:to}):bytesToNumber(no,{signed:to}),32]}function decodeTuple(Xr,eo,{staticPosition:to}){const ro=eo.components.length===0||eo.components.some(({name:oo})=>!oo),no=ro?[]:{};let io=0;if(hasDynamicChild(eo)){const oo=bytesToNumber(Xr.readBytes(sizeOfOffset)),ao=to+oo;for(let so=0;sooo.type==="error"&&ro===toFunctionSelector(formatAbiItem(oo)));if(!io)throw new AbiErrorSignatureNotFoundError(ro,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:io,args:"inputs"in io&&io.inputs&&io.inputs.length>0?decodeAbiParameters(io.inputs,slice(to,4)):void 0,errorName:io.name}}const stringify$4=(Xr,eo,to)=>JSON.stringify(Xr,(ro,no)=>typeof no=="bigint"?no.toString():no,to);function formatAbiItemWithArgs({abiItem:Xr,args:eo,includeFunctionName:to=!0,includeName:ro=!1}){if("name"in Xr&&"inputs"in Xr&&Xr.inputs)return`${to?Xr.name:""}(${Xr.inputs.map((no,io)=>`${ro&&no.name?`${no.name}: `:""}${typeof eo[io]=="object"?stringify$4(eo[io]):eo[io]}`).join(", ")})`}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9};function formatUnits(Xr,eo){let to=Xr.toString();const ro=to.startsWith("-");ro&&(to=to.slice(1)),to=to.padStart(eo,"0");let[no,io]=[to.slice(0,to.length-eo),to.slice(to.length-eo)];return io=io.replace(/(0+)$/,""),`${ro?"-":""}${no||"0"}${io?`.${io}`:""}`}function formatEther$1(Xr,eo="wei"){return formatUnits(Xr,etherUnits[eo])}function formatGwei(Xr,eo="wei"){return formatUnits(Xr,gweiUnits[eo])}class AccountStateConflictError extends BaseError{constructor({address:eo}){super(`State for account "${eo}" is set multiple times.`,{name:"AccountStateConflictError"})}}class StateAssignmentConflictError extends BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function prettyStateMapping(Xr){return Xr.reduce((eo,{slot:to,value:ro})=>`${eo} ${to}: ${ro} `,"")}function prettyStateOverride(Xr){return Xr.reduce((eo,{address:to,...ro})=>{let no=`${eo} ${to}: `;return ro.nonce&&(no+=` nonce: ${ro.nonce} `),ro.balance&&(no+=` balance: ${ro.balance} @@ -2151,21 +3981,21 @@ zoo`.split(` `,no+=prettyStateMapping(ro.stateDiff)),no},` State Override: `).slice(0,-1)}function prettyPrint(Xr){const eo=Object.entries(Xr).map(([ro,no])=>no===void 0||no===!1?null:[ro,no]).filter(Boolean),to=eo.reduce((ro,[no])=>Math.max(ro,no.length),0);return eo.map(([ro,no])=>` ${`${ro}:`.padEnd(to+1)} ${no}`).join(` `)}class FeeConflictError extends BaseError{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class InvalidLegacyVError extends BaseError{constructor({v:eo}){super(`Invalid \`v\` value "${eo}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class InvalidSerializableTransactionError extends BaseError{constructor({transaction:eo}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",prettyPrint(eo),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class InvalidStorageKeySizeError extends BaseError{constructor({storageKey:eo}){super(`Size for storage key "${eo}" is invalid. Expected 32 bytes. Got ${Math.floor((eo.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class TransactionExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:fo,value:ho}){var yo;const go=prettyPrint({chain:no&&`${no==null?void 0:no.name} (id: ${no==null?void 0:no.id})`,from:to==null?void 0:to.address,to:fo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((yo=no==null?void 0:no.nativeCurrency)==null?void 0:yo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Request Arguments:",go].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class TransactionNotFoundError extends BaseError{constructor({blockHash:eo,blockNumber:to,blockTag:ro,hash:no,index:io}){let oo="Transaction";ro&&io!==void 0&&(oo=`Transaction at block time "${ro}" at index "${io}"`),eo&&io!==void 0&&(oo=`Transaction at block hash "${eo}" at index "${io}"`),to&&io!==void 0&&(oo=`Transaction at block number "${to}" at index "${io}"`),no&&(oo=`Transaction with hash "${no}"`),super(`${oo} could not be found.`,{name:"TransactionNotFoundError"})}}class TransactionReceiptNotFoundError extends BaseError{constructor({hash:eo}){super(`Transaction receipt with hash "${eo}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class WaitForTransactionReceiptTimeoutError extends BaseError{constructor({hash:eo}){super(`Timed out while waiting for transaction with hash "${eo}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const getContractAddress=Xr=>Xr,getUrl=Xr=>Xr;class CallExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:fo,value:ho,stateOverride:go}){var wo;const yo=to?parseAccount(to):void 0;let vo=prettyPrint({from:yo==null?void 0:yo.address,to:fo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((wo=no==null?void 0:no.nativeCurrency)==null?void 0:wo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});go&&(vo+=` -${prettyStateOverride(go)}`),super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Raw Call Arguments:",vo].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class ContractFunctionExecutionError extends BaseError{constructor(eo,{abi:to,args:ro,contractAddress:no,docsPath:io,functionName:oo,sender:ao}){const so=getAbiItem({abi:to,args:ro,name:oo}),co=so?formatAbiItemWithArgs({abiItem:so,args:ro,includeFunctionName:!1,includeName:!1}):void 0,lo=so?formatAbiItem(so,{includeName:!0}):void 0,fo=prettyPrint({address:no&&getContractAddress(no),function:lo,args:co&&co!=="()"&&`${[...Array((oo==null?void 0:oo.length)??0).keys()].map(()=>" ").join("")}${co}`,sender:ao});super(eo.shortMessage||`An unknown error occurred while executing the contract function "${oo}".`,{cause:eo,docsPath:io,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],fo&&"Contract Call:",fo].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=to,this.args=ro,this.cause=eo,this.contractAddress=no,this.functionName=oo,this.sender=ao}}class ContractFunctionRevertedError extends BaseError{constructor({abi:eo,data:to,functionName:ro,message:no}){let io,oo,ao,so;if(to&&to!=="0x")try{oo=decodeErrorResult({abi:eo,data:to});const{abiItem:lo,errorName:fo,args:ho}=oo;if(fo==="Error")so=ho[0];else if(fo==="Panic"){const[go]=ho;so=panicReasons[go]}else{const go=lo?formatAbiItem(lo,{includeName:!0}):void 0,yo=lo&&ho?formatAbiItemWithArgs({abiItem:lo,args:ho,includeFunctionName:!1,includeName:!1}):void 0;ao=[go?`Error: ${go}`:"",yo&&yo!=="()"?` ${[...Array((fo==null?void 0:fo.length)??0).keys()].map(()=>" ").join("")}${yo}`:""]}}catch(lo){io=lo}else no&&(so=no);let co;io instanceof AbiErrorSignatureNotFoundError&&(co=io.signature,ao=[`Unable to decode signature "${co}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${co}.`]),super(so&&so!=="execution reverted"||co?[`The contract function "${ro}" reverted with the following ${co?"signature":"reason"}:`,so||co].join(` +`),{name:"FeeConflictError"})}}class InvalidLegacyVError extends BaseError{constructor({v:eo}){super(`Invalid \`v\` value "${eo}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class InvalidSerializableTransactionError extends BaseError{constructor({transaction:eo}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",prettyPrint(eo),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class InvalidStorageKeySizeError extends BaseError{constructor({storageKey:eo}){super(`Size for storage key "${eo}" is invalid. Expected 32 bytes. Got ${Math.floor((eo.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class TransactionExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:uo,value:ho}){var bo;const go=prettyPrint({chain:no&&`${no==null?void 0:no.name} (id: ${no==null?void 0:no.id})`,from:to==null?void 0:to.address,to:uo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((bo=no==null?void 0:no.nativeCurrency)==null?void 0:bo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Request Arguments:",go].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class TransactionNotFoundError extends BaseError{constructor({blockHash:eo,blockNumber:to,blockTag:ro,hash:no,index:io}){let oo="Transaction";ro&&io!==void 0&&(oo=`Transaction at block time "${ro}" at index "${io}"`),eo&&io!==void 0&&(oo=`Transaction at block hash "${eo}" at index "${io}"`),to&&io!==void 0&&(oo=`Transaction at block number "${to}" at index "${io}"`),no&&(oo=`Transaction with hash "${no}"`),super(`${oo} could not be found.`,{name:"TransactionNotFoundError"})}}class TransactionReceiptNotFoundError extends BaseError{constructor({hash:eo}){super(`Transaction receipt with hash "${eo}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class WaitForTransactionReceiptTimeoutError extends BaseError{constructor({hash:eo}){super(`Timed out while waiting for transaction with hash "${eo}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const getContractAddress=Xr=>Xr,getUrl=Xr=>Xr;class CallExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:uo,value:ho,stateOverride:go}){var Eo;const bo=to?parseAccount(to):void 0;let wo=prettyPrint({from:bo==null?void 0:bo.address,to:uo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((Eo=no==null?void 0:no.nativeCurrency)==null?void 0:Eo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});go&&(wo+=` +${prettyStateOverride(go)}`),super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Raw Call Arguments:",wo].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class ContractFunctionExecutionError extends BaseError{constructor(eo,{abi:to,args:ro,contractAddress:no,docsPath:io,functionName:oo,sender:ao}){const so=getAbiItem({abi:to,args:ro,name:oo}),co=so?formatAbiItemWithArgs({abiItem:so,args:ro,includeFunctionName:!1,includeName:!1}):void 0,lo=so?formatAbiItem(so,{includeName:!0}):void 0,uo=prettyPrint({address:no&&getContractAddress(no),function:lo,args:co&&co!=="()"&&`${[...Array((oo==null?void 0:oo.length)??0).keys()].map(()=>" ").join("")}${co}`,sender:ao});super(eo.shortMessage||`An unknown error occurred while executing the contract function "${oo}".`,{cause:eo,docsPath:io,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],uo&&"Contract Call:",uo].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=to,this.args=ro,this.cause=eo,this.contractAddress=no,this.functionName=oo,this.sender=ao}}class ContractFunctionRevertedError extends BaseError{constructor({abi:eo,data:to,functionName:ro,message:no}){let io,oo,ao,so;if(to&&to!=="0x")try{oo=decodeErrorResult({abi:eo,data:to});const{abiItem:lo,errorName:uo,args:ho}=oo;if(uo==="Error")so=ho[0];else if(uo==="Panic"){const[go]=ho;so=panicReasons[go]}else{const go=lo?formatAbiItem(lo,{includeName:!0}):void 0,bo=lo&&ho?formatAbiItemWithArgs({abiItem:lo,args:ho,includeFunctionName:!1,includeName:!1}):void 0;ao=[go?`Error: ${go}`:"",bo&&bo!=="()"?` ${[...Array((uo==null?void 0:uo.length)??0).keys()].map(()=>" ").join("")}${bo}`:""]}}catch(lo){io=lo}else no&&(so=no);let co;io instanceof AbiErrorSignatureNotFoundError&&(co=io.signature,ao=[`Unable to decode signature "${co}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${co}.`]),super(so&&so!=="execution reverted"||co?[`The contract function "${ro}" reverted with the following ${co?"signature":"reason"}:`,so||co].join(` `):`The contract function "${ro}" reverted.`,{cause:io,metaMessages:ao,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=oo,this.reason=so,this.signature=co}}class ContractFunctionZeroDataError extends BaseError{constructor({functionName:eo}){super(`The contract function "${eo}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${eo}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError{constructor({factory:eo}){super(`Deployment for counterfactual contract call failed${eo?` for factory "${eo}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class RawContractError extends BaseError{constructor({data:eo,message:to}){super(to||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=eo}}class HttpRequestError extends BaseError{constructor({body:eo,cause:to,details:ro,headers:no,status:io,url:oo}){super("HTTP request failed.",{cause:to,details:ro,metaMessages:[io&&`Status: ${io}`,`URL: ${getUrl(oo)}`,eo&&`Request body: ${stringify$4(eo)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=eo,this.headers=no,this.status=io,this.url=oo}}class RpcRequestError extends BaseError{constructor({body:eo,error:to,url:ro}){super("RPC Request failed.",{cause:to,details:to.message,metaMessages:[`URL: ${getUrl(ro)}`,`Request body: ${stringify$4(eo)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=to.code}}class TimeoutError extends BaseError{constructor({body:eo,url:to}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${getUrl(to)}`,`Request body: ${stringify$4(eo)}`],name:"TimeoutError"})}}const unknownErrorCode=-1;class RpcError extends BaseError{constructor(eo,{code:to,docsPath:ro,metaMessages:no,name:io,shortMessage:oo}){super(oo,{cause:eo,docsPath:ro,metaMessages:no||(eo==null?void 0:eo.metaMessages),name:io||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=io||eo.name,this.code=eo instanceof RpcRequestError?eo.code:to??unknownErrorCode}}class ProviderRpcError extends RpcError{constructor(eo,to){super(eo,to),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=to.data}}class ParseRpcError extends RpcError{constructor(eo){super(eo,{code:ParseRpcError.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ParseRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class InvalidRequestRpcError extends RpcError{constructor(eo){super(eo,{code:InvalidRequestRpcError.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(InvalidRequestRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class MethodNotFoundRpcError extends RpcError{constructor(eo,{method:to}={}){super(eo,{code:MethodNotFoundRpcError.code,name:"MethodNotFoundRpcError",shortMessage:`The method${to?` "${to}"`:""} does not exist / is not available.`})}}Object.defineProperty(MethodNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class InvalidParamsRpcError extends RpcError{constructor(eo){super(eo,{code:InvalidParamsRpcError.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(InvalidParamsRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class InternalRpcError extends RpcError{constructor(eo){super(eo,{code:InternalRpcError.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(InternalRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class InvalidInputRpcError extends RpcError{constructor(eo){super(eo,{code:InvalidInputRpcError.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(InvalidInputRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ResourceNotFoundRpcError extends RpcError{constructor(eo){super(eo,{code:ResourceNotFoundRpcError.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ResourceNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ResourceUnavailableRpcError extends RpcError{constructor(eo){super(eo,{code:ResourceUnavailableRpcError.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ResourceUnavailableRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class TransactionRejectedRpcError extends RpcError{constructor(eo){super(eo,{code:TransactionRejectedRpcError.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(TransactionRejectedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class MethodNotSupportedRpcError extends RpcError{constructor(eo,{method:to}={}){super(eo,{code:MethodNotSupportedRpcError.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${to?` "${to}"`:""} is not implemented.`})}}Object.defineProperty(MethodNotSupportedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class LimitExceededRpcError extends RpcError{constructor(eo){super(eo,{code:LimitExceededRpcError.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(LimitExceededRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class JsonRpcVersionUnsupportedError extends RpcError{constructor(eo){super(eo,{code:JsonRpcVersionUnsupportedError.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(JsonRpcVersionUnsupportedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let UserRejectedRequestError$1=class k_ extends ProviderRpcError{constructor(eo){super(eo,{code:k_.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(UserRejectedRequestError$1,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class UnauthorizedProviderError extends ProviderRpcError{constructor(eo){super(eo,{code:UnauthorizedProviderError.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(UnauthorizedProviderError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class UnsupportedProviderMethodError extends ProviderRpcError{constructor(eo,{method:to}={}){super(eo,{code:UnsupportedProviderMethodError.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${to?` " ${to}"`:""}.`})}}Object.defineProperty(UnsupportedProviderMethodError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ProviderDisconnectedError extends ProviderRpcError{constructor(eo){super(eo,{code:ProviderDisconnectedError.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ProviderDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ChainDisconnectedError extends ProviderRpcError{constructor(eo){super(eo,{code:ChainDisconnectedError.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ChainDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class SwitchChainError extends ProviderRpcError{constructor(eo){super(eo,{code:SwitchChainError.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(SwitchChainError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class UnknownRpcError extends RpcError{constructor(eo){super(eo,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(Xr,{abi:eo,address:to,args:ro,docsPath:no,functionName:io,sender:oo}){const{code:ao,data:so,message:co,shortMessage:lo}=Xr instanceof RawContractError?Xr:Xr instanceof BaseError?Xr.walk(ho=>"data"in ho)||Xr.walk():{},fo=Xr instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:io}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(ao)&&(so||co||lo)?new ContractFunctionRevertedError({abi:eo,data:typeof so=="object"?so.data:so,functionName:io,message:lo??co}):Xr;return new ContractFunctionExecutionError(fo,{abi:eo,args:ro,contractAddress:to,docsPath:no,functionName:io,sender:oo})}function publicKeyToAddress(Xr){const eo=keccak256(`0x${Xr.substring(4)}`).substring(26);return checksumAddress(`0x${eo}`)}const scriptRel="modulepreload",assetsURL=function(Xr){return"/push-wallet/"+Xr},seen={},__vitePreload=function(eo,to,ro){let no=Promise.resolve();if(to&&to.length>0){document.getElementsByTagName("link");const oo=document.querySelector("meta[property=csp-nonce]"),ao=(oo==null?void 0:oo.nonce)||(oo==null?void 0:oo.getAttribute("nonce"));no=Promise.allSettled(to.map(so=>{if(so=assetsURL(so),so in seen)return;seen[so]=!0;const co=so.endsWith(".css"),lo=co?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${so}"]${lo}`))return;const fo=document.createElement("link");if(fo.rel=co?"stylesheet":scriptRel,co||(fo.as="script"),fo.crossOrigin="",fo.href=so,ao&&fo.setAttribute("nonce",ao),document.head.appendChild(fo),co)return new Promise((ho,go)=>{fo.addEventListener("load",ho),fo.addEventListener("error",()=>go(new Error(`Unable to preload CSS for ${so}`)))})}))}function io(oo){const ao=new Event("vite:preloadError",{cancelable:!0});if(ao.payload=oo,window.dispatchEvent(ao),!ao.defaultPrevented)throw oo}return no.then(oo=>{for(const ao of oo||[])ao.status==="rejected"&&io(ao.reason);return eo().catch(io)})};async function recoverPublicKey({hash:Xr,signature:eo}){const to=isHex$4(Xr)?Xr:toHex$1(Xr),{secp256k1:ro}=await __vitePreload(async()=>{const{secp256k1:oo}=await Promise.resolve().then(()=>secp256k1$3);return{secp256k1:oo}},void 0);return`0x${(()=>{if(typeof eo=="object"&&"r"in eo&&"s"in eo){const{r:co,s:lo,v:fo,yParity:ho}=eo,go=Number(ho??fo),yo=toRecoveryBit(go);return new ro.Signature(hexToBigInt(co),hexToBigInt(lo)).addRecoveryBit(yo)}const oo=isHex$4(eo)?eo:toHex$1(eo),ao=hexToNumber$2(`0x${oo.slice(130)}`),so=toRecoveryBit(ao);return ro.Signature.fromCompact(oo.substring(2,130)).addRecoveryBit(so)})().recoverPublicKey(to.substring(2)).toHex(!1)}`}function toRecoveryBit(Xr){if(Xr===0||Xr===1)return Xr;if(Xr===27)return 0;if(Xr===28)return 1;throw new Error("Invalid yParityOrV value")}async function recoverAddress({hash:Xr,signature:eo}){return publicKeyToAddress(await recoverPublicKey({hash:Xr,signature:eo}))}function toRlp(Xr,eo="hex"){const to=getEncodable(Xr),ro=createCursor(new Uint8Array(to.length));return to.encode(ro),eo==="hex"?bytesToHex$2(ro.bytes):ro.bytes}function getEncodable(Xr){return Array.isArray(Xr)?getEncodableList(Xr.map(eo=>getEncodable(eo))):getEncodableBytes(Xr)}function getEncodableList(Xr){const eo=Xr.reduce((no,io)=>no+io.length,0),to=getSizeOfLength(eo);return{length:eo<=55?1+eo:1+to+eo,encode(no){eo<=55?no.pushByte(192+eo):(no.pushByte(247+to),to===1?no.pushUint8(eo):to===2?no.pushUint16(eo):to===3?no.pushUint24(eo):no.pushUint32(eo));for(const{encode:io}of Xr)io(no)}}}function getEncodableBytes(Xr){const eo=typeof Xr=="string"?hexToBytes$3(Xr):Xr,to=getSizeOfLength(eo.length);return{length:eo.length===1&&eo[0]<128?1:eo.length<=55?1+eo.length:1+to+eo.length,encode(no){eo.length===1&&eo[0]<128?no.pushBytes(eo):eo.length<=55?(no.pushByte(128+eo.length),no.pushBytes(eo)):(no.pushByte(183+to),to===1?no.pushUint8(eo.length):to===2?no.pushUint16(eo.length):to===3?no.pushUint24(eo.length):no.pushUint32(eo.length),no.pushBytes(eo))}}}function getSizeOfLength(Xr){if(Xr<2**8)return 1;if(Xr<2**16)return 2;if(Xr<2**24)return 3;if(Xr<2**32)return 4;throw new BaseError("Length is too large.")}function hashAuthorization(Xr){const{chainId:eo,contractAddress:to,nonce:ro,to:no}=Xr,io=keccak256(concatHex(["0x05",toRlp([eo?numberToHex(eo):"0x",to,ro?numberToHex(ro):"0x"])]));return no==="bytes"?hexToBytes$3(io):io}async function recoverAuthorizationAddress(Xr){const{authorization:eo,signature:to}=Xr;return recoverAddress({hash:hashAuthorization(eo),signature:to??eo})}class EstimateGasExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:fo,value:ho}){var yo;const go=prettyPrint({from:to==null?void 0:to.address,to:fo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((yo=no==null?void 0:no.nativeCurrency)==null?void 0:yo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Estimate Gas Arguments:",go].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class ExecutionRevertedError extends BaseError{constructor({cause:eo,message:to}={}){var no;const ro=(no=to==null?void 0:to.replace("execution reverted: ",""))==null?void 0:no.replace("execution reverted","");super(`Execution reverted ${ro?`with reason: ${ro}`:"for an unknown reason"}.`,{cause:eo,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError{constructor({cause:eo,maxFeePerGas:to}={}){super(`The fee cap (\`maxFeePerGas\`${to?` = ${formatGwei(to)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:eo,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class FeeCapTooLowError extends BaseError{constructor({cause:eo,maxFeePerGas:to}={}){super(`The fee cap (\`maxFeePerGas\`${to?` = ${formatGwei(to)}`:""} gwei) cannot be lower than the block base fee.`,{cause:eo,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class NonceTooHighError extends BaseError{constructor({cause:eo,nonce:to}={}){super(`Nonce provided for the transaction ${to?`(${to}) `:""}is higher than the next one expected.`,{cause:eo,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError{constructor({cause:eo,nonce:to}={}){super([`Nonce provided for the transaction ${to?`(${to}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`)})}}Object.defineProperty(InvalidInputRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ResourceNotFoundRpcError extends RpcError{constructor(eo){super(eo,{code:ResourceNotFoundRpcError.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ResourceNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ResourceUnavailableRpcError extends RpcError{constructor(eo){super(eo,{code:ResourceUnavailableRpcError.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ResourceUnavailableRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class TransactionRejectedRpcError extends RpcError{constructor(eo){super(eo,{code:TransactionRejectedRpcError.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(TransactionRejectedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class MethodNotSupportedRpcError extends RpcError{constructor(eo,{method:to}={}){super(eo,{code:MethodNotSupportedRpcError.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${to?` "${to}"`:""} is not implemented.`})}}Object.defineProperty(MethodNotSupportedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class LimitExceededRpcError extends RpcError{constructor(eo){super(eo,{code:LimitExceededRpcError.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(LimitExceededRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class JsonRpcVersionUnsupportedError extends RpcError{constructor(eo){super(eo,{code:JsonRpcVersionUnsupportedError.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(JsonRpcVersionUnsupportedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let UserRejectedRequestError$1=class sC extends ProviderRpcError{constructor(eo){super(eo,{code:sC.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(UserRejectedRequestError$1,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class UnauthorizedProviderError extends ProviderRpcError{constructor(eo){super(eo,{code:UnauthorizedProviderError.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(UnauthorizedProviderError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class UnsupportedProviderMethodError extends ProviderRpcError{constructor(eo,{method:to}={}){super(eo,{code:UnsupportedProviderMethodError.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${to?` " ${to}"`:""}.`})}}Object.defineProperty(UnsupportedProviderMethodError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ProviderDisconnectedError extends ProviderRpcError{constructor(eo){super(eo,{code:ProviderDisconnectedError.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ProviderDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ChainDisconnectedError extends ProviderRpcError{constructor(eo){super(eo,{code:ChainDisconnectedError.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ChainDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class SwitchChainError extends ProviderRpcError{constructor(eo){super(eo,{code:SwitchChainError.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(SwitchChainError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class UnknownRpcError extends RpcError{constructor(eo){super(eo,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(Xr,{abi:eo,address:to,args:ro,docsPath:no,functionName:io,sender:oo}){const{code:ao,data:so,message:co,shortMessage:lo}=Xr instanceof RawContractError?Xr:Xr instanceof BaseError?Xr.walk(ho=>"data"in ho)||Xr.walk():{},uo=Xr instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:io}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(ao)&&(so||co||lo)?new ContractFunctionRevertedError({abi:eo,data:typeof so=="object"?so.data:so,functionName:io,message:lo??co}):Xr;return new ContractFunctionExecutionError(uo,{abi:eo,args:ro,contractAddress:to,docsPath:no,functionName:io,sender:oo})}function publicKeyToAddress(Xr){const eo=keccak256(`0x${Xr.substring(4)}`).substring(26);return checksumAddress(`0x${eo}`)}const scriptRel="modulepreload",assetsURL=function(Xr){return"/push-wallet/"+Xr},seen={},__vitePreload=function(eo,to,ro){let no=Promise.resolve();if(to&&to.length>0){document.getElementsByTagName("link");const oo=document.querySelector("meta[property=csp-nonce]"),ao=(oo==null?void 0:oo.nonce)||(oo==null?void 0:oo.getAttribute("nonce"));no=Promise.allSettled(to.map(so=>{if(so=assetsURL(so),so in seen)return;seen[so]=!0;const co=so.endsWith(".css"),lo=co?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${so}"]${lo}`))return;const uo=document.createElement("link");if(uo.rel=co?"stylesheet":scriptRel,co||(uo.as="script"),uo.crossOrigin="",uo.href=so,ao&&uo.setAttribute("nonce",ao),document.head.appendChild(uo),co)return new Promise((ho,go)=>{uo.addEventListener("load",ho),uo.addEventListener("error",()=>go(new Error(`Unable to preload CSS for ${so}`)))})}))}function io(oo){const ao=new Event("vite:preloadError",{cancelable:!0});if(ao.payload=oo,window.dispatchEvent(ao),!ao.defaultPrevented)throw oo}return no.then(oo=>{for(const ao of oo||[])ao.status==="rejected"&&io(ao.reason);return eo().catch(io)})};async function recoverPublicKey({hash:Xr,signature:eo}){const to=isHex$4(Xr)?Xr:toHex$1(Xr),{secp256k1:ro}=await __vitePreload(async()=>{const{secp256k1:oo}=await Promise.resolve().then(()=>secp256k1$3);return{secp256k1:oo}},void 0);return`0x${(()=>{if(typeof eo=="object"&&"r"in eo&&"s"in eo){const{r:co,s:lo,v:uo,yParity:ho}=eo,go=Number(ho??uo),bo=toRecoveryBit(go);return new ro.Signature(hexToBigInt(co),hexToBigInt(lo)).addRecoveryBit(bo)}const oo=isHex$4(eo)?eo:toHex$1(eo),ao=hexToNumber$2(`0x${oo.slice(130)}`),so=toRecoveryBit(ao);return ro.Signature.fromCompact(oo.substring(2,130)).addRecoveryBit(so)})().recoverPublicKey(to.substring(2)).toHex(!1)}`}function toRecoveryBit(Xr){if(Xr===0||Xr===1)return Xr;if(Xr===27)return 0;if(Xr===28)return 1;throw new Error("Invalid yParityOrV value")}async function recoverAddress({hash:Xr,signature:eo}){return publicKeyToAddress(await recoverPublicKey({hash:Xr,signature:eo}))}function toRlp(Xr,eo="hex"){const to=getEncodable(Xr),ro=createCursor(new Uint8Array(to.length));return to.encode(ro),eo==="hex"?bytesToHex$2(ro.bytes):ro.bytes}function getEncodable(Xr){return Array.isArray(Xr)?getEncodableList(Xr.map(eo=>getEncodable(eo))):getEncodableBytes(Xr)}function getEncodableList(Xr){const eo=Xr.reduce((no,io)=>no+io.length,0),to=getSizeOfLength(eo);return{length:eo<=55?1+eo:1+to+eo,encode(no){eo<=55?no.pushByte(192+eo):(no.pushByte(247+to),to===1?no.pushUint8(eo):to===2?no.pushUint16(eo):to===3?no.pushUint24(eo):no.pushUint32(eo));for(const{encode:io}of Xr)io(no)}}}function getEncodableBytes(Xr){const eo=typeof Xr=="string"?hexToBytes$3(Xr):Xr,to=getSizeOfLength(eo.length);return{length:eo.length===1&&eo[0]<128?1:eo.length<=55?1+eo.length:1+to+eo.length,encode(no){eo.length===1&&eo[0]<128?no.pushBytes(eo):eo.length<=55?(no.pushByte(128+eo.length),no.pushBytes(eo)):(no.pushByte(183+to),to===1?no.pushUint8(eo.length):to===2?no.pushUint16(eo.length):to===3?no.pushUint24(eo.length):no.pushUint32(eo.length),no.pushBytes(eo))}}}function getSizeOfLength(Xr){if(Xr<2**8)return 1;if(Xr<2**16)return 2;if(Xr<2**24)return 3;if(Xr<2**32)return 4;throw new BaseError("Length is too large.")}function hashAuthorization(Xr){const{chainId:eo,contractAddress:to,nonce:ro,to:no}=Xr,io=keccak256(concatHex(["0x05",toRlp([eo?numberToHex(eo):"0x",to,ro?numberToHex(ro):"0x"])]));return no==="bytes"?hexToBytes$3(io):io}async function recoverAuthorizationAddress(Xr){const{authorization:eo,signature:to}=Xr;return recoverAddress({hash:hashAuthorization(eo),signature:to??eo})}class EstimateGasExecutionError extends BaseError{constructor(eo,{account:to,docsPath:ro,chain:no,data:io,gas:oo,gasPrice:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,nonce:lo,to:uo,value:ho}){var bo;const go=prettyPrint({from:to==null?void 0:to.address,to:uo,value:typeof ho<"u"&&`${formatEther$1(ho)} ${((bo=no==null?void 0:no.nativeCurrency)==null?void 0:bo.symbol)||"ETH"}`,data:io,gas:oo,gasPrice:typeof ao<"u"&&`${formatGwei(ao)} gwei`,maxFeePerGas:typeof so<"u"&&`${formatGwei(so)} gwei`,maxPriorityFeePerGas:typeof co<"u"&&`${formatGwei(co)} gwei`,nonce:lo});super(eo.shortMessage,{cause:eo,docsPath:ro,metaMessages:[...eo.metaMessages?[...eo.metaMessages," "]:[],"Estimate Gas Arguments:",go].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=eo}}class ExecutionRevertedError extends BaseError{constructor({cause:eo,message:to}={}){var no;const ro=(no=to==null?void 0:to.replace("execution reverted: ",""))==null?void 0:no.replace("execution reverted","");super(`Execution reverted ${ro?`with reason: ${ro}`:"for an unknown reason"}.`,{cause:eo,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError{constructor({cause:eo,maxFeePerGas:to}={}){super(`The fee cap (\`maxFeePerGas\`${to?` = ${formatGwei(to)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:eo,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class FeeCapTooLowError extends BaseError{constructor({cause:eo,maxFeePerGas:to}={}){super(`The fee cap (\`maxFeePerGas\`${to?` = ${formatGwei(to)}`:""} gwei) cannot be lower than the block base fee.`,{cause:eo,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class NonceTooHighError extends BaseError{constructor({cause:eo,nonce:to}={}){super(`Nonce provided for the transaction ${to?`(${to}) `:""}is higher than the next one expected.`,{cause:eo,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError{constructor({cause:eo,nonce:to}={}){super([`Nonce provided for the transaction ${to?`(${to}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:eo,name:"NonceTooLowError"})}}Object.defineProperty(NonceTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class NonceMaxValueError extends BaseError{constructor({cause:eo,nonce:to}={}){super(`Nonce provided for the transaction ${to?`(${to}) `:""}exceeds the maximum allowed nonce.`,{cause:eo,name:"NonceMaxValueError"})}}Object.defineProperty(NonceMaxValueError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let InsufficientFundsError$1=class extends BaseError{constructor({cause:eo}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:eo,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(InsufficientFundsError$1,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class IntrinsicGasTooHighError extends BaseError{constructor({cause:eo,gas:to}={}){super(`The amount of gas ${to?`(${to}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:eo,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(IntrinsicGasTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class IntrinsicGasTooLowError extends BaseError{constructor({cause:eo,gas:to}={}){super(`The amount of gas ${to?`(${to}) `:""}provided for the transaction is too low.`,{cause:eo,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(IntrinsicGasTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class TransactionTypeNotSupportedError extends BaseError{constructor({cause:eo}){super("The transaction type is not supported for this chain.",{cause:eo,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(TransactionTypeNotSupportedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class TipAboveFeeCapError extends BaseError{constructor({cause:eo,maxPriorityFeePerGas:to,maxFeePerGas:ro}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${to?` = ${formatGwei(to)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${ro?` = ${formatGwei(ro)} gwei`:""}).`].join(` -`),{cause:eo,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class UnknownNodeError extends BaseError{constructor({cause:eo}){super(`An error occurred while executing: ${eo==null?void 0:eo.shortMessage}`,{cause:eo,name:"UnknownNodeError"})}}function getNodeError(Xr,eo){const to=(Xr.details||"").toLowerCase(),ro=Xr instanceof BaseError?Xr.walk(no=>(no==null?void 0:no.code)===ExecutionRevertedError.code):Xr;return ro instanceof BaseError?new ExecutionRevertedError({cause:Xr,message:ro.details}):ExecutionRevertedError.nodeMessage.test(to)?new ExecutionRevertedError({cause:Xr,message:Xr.details}):FeeCapTooHighError.nodeMessage.test(to)?new FeeCapTooHighError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(to)?new FeeCapTooLowError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas}):NonceTooHighError.nodeMessage.test(to)?new NonceTooHighError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):NonceTooLowError.nodeMessage.test(to)?new NonceTooLowError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):NonceMaxValueError.nodeMessage.test(to)?new NonceMaxValueError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):InsufficientFundsError$1.nodeMessage.test(to)?new InsufficientFundsError$1({cause:Xr}):IntrinsicGasTooHighError.nodeMessage.test(to)?new IntrinsicGasTooHighError({cause:Xr,gas:eo==null?void 0:eo.gas}):IntrinsicGasTooLowError.nodeMessage.test(to)?new IntrinsicGasTooLowError({cause:Xr,gas:eo==null?void 0:eo.gas}):TransactionTypeNotSupportedError.nodeMessage.test(to)?new TransactionTypeNotSupportedError({cause:Xr}):TipAboveFeeCapError.nodeMessage.test(to)?new TipAboveFeeCapError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas,maxPriorityFeePerGas:eo==null?void 0:eo.maxPriorityFeePerGas}):new UnknownNodeError({cause:Xr})}function getEstimateGasError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new EstimateGasExecutionError(ro,{docsPath:eo,...to})}function extract(Xr,{format:eo}){if(!eo)return{};const to={};function ro(io){const oo=Object.keys(io);for(const ao of oo)ao in Xr&&(to[ao]=Xr[ao]),io[ao]&&typeof io[ao]=="object"&&!Array.isArray(io[ao])&&ro(io[ao])}const no=eo(Xr||{});return ro(no),to}function defineFormatter(Xr,eo){return({exclude:to,format:ro})=>({exclude:to,format:no=>{const io=eo(no);if(to)for(const oo of to)delete io[oo];return{...io,...ro(no)}},type:Xr})}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(Xr){const eo={};return typeof Xr.authorizationList<"u"&&(eo.authorizationList=formatAuthorizationList$1(Xr.authorizationList)),typeof Xr.accessList<"u"&&(eo.accessList=Xr.accessList),typeof Xr.blobVersionedHashes<"u"&&(eo.blobVersionedHashes=Xr.blobVersionedHashes),typeof Xr.blobs<"u"&&(typeof Xr.blobs[0]!="string"?eo.blobs=Xr.blobs.map(to=>bytesToHex$2(to)):eo.blobs=Xr.blobs),typeof Xr.data<"u"&&(eo.data=Xr.data),typeof Xr.from<"u"&&(eo.from=Xr.from),typeof Xr.gas<"u"&&(eo.gas=numberToHex(Xr.gas)),typeof Xr.gasPrice<"u"&&(eo.gasPrice=numberToHex(Xr.gasPrice)),typeof Xr.maxFeePerBlobGas<"u"&&(eo.maxFeePerBlobGas=numberToHex(Xr.maxFeePerBlobGas)),typeof Xr.maxFeePerGas<"u"&&(eo.maxFeePerGas=numberToHex(Xr.maxFeePerGas)),typeof Xr.maxPriorityFeePerGas<"u"&&(eo.maxPriorityFeePerGas=numberToHex(Xr.maxPriorityFeePerGas)),typeof Xr.nonce<"u"&&(eo.nonce=numberToHex(Xr.nonce)),typeof Xr.to<"u"&&(eo.to=Xr.to),typeof Xr.type<"u"&&(eo.type=rpcTransactionType[Xr.type]),typeof Xr.value<"u"&&(eo.value=numberToHex(Xr.value)),eo}const defineTransactionRequest=defineFormatter("transactionRequest",formatTransactionRequest);function formatAuthorizationList$1(Xr){return Xr.map(eo=>({address:eo.contractAddress,r:eo.r,s:eo.s,chainId:numberToHex(eo.chainId),nonce:numberToHex(eo.nonce),...typeof eo.yParity<"u"?{yParity:numberToHex(eo.yParity)}:{},...typeof eo.v<"u"&&typeof eo.yParity>"u"?{v:numberToHex(eo.v)}:{}}))}function serializeStateMapping(Xr){if(!(!Xr||Xr.length===0))return Xr.reduce((eo,{slot:to,value:ro})=>{if(to.length!==66)throw new InvalidBytesLengthError({size:to.length,targetSize:66,type:"hex"});if(ro.length!==66)throw new InvalidBytesLengthError({size:ro.length,targetSize:66,type:"hex"});return eo[to]=ro,eo},{})}function serializeAccountStateOverride(Xr){const{balance:eo,nonce:to,state:ro,stateDiff:no,code:io}=Xr,oo={};if(io!==void 0&&(oo.code=io),eo!==void 0&&(oo.balance=numberToHex(eo)),to!==void 0&&(oo.nonce=numberToHex(to)),ro!==void 0&&(oo.state=serializeStateMapping(ro)),no!==void 0){if(oo.state)throw new StateAssignmentConflictError;oo.stateDiff=serializeStateMapping(no)}return oo}function serializeStateOverride(Xr){if(!Xr)return;const eo={};for(const{address:to,...ro}of Xr){if(!isAddress(to,{strict:!1}))throw new InvalidAddressError({address:to});if(eo[to])throw new AccountStateConflictError({address:to});eo[to]=serializeAccountStateOverride(ro)}return eo}const maxUint16=2n**16n-1n,maxUint256=2n**256n-1n;function assertRequest(Xr){const{account:eo,gasPrice:to,maxFeePerGas:ro,maxPriorityFeePerGas:no,to:io}=Xr,oo=eo?parseAccount(eo):void 0;if(oo&&!isAddress(oo.address))throw new InvalidAddressError({address:oo.address});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(typeof to<"u"&&(typeof ro<"u"||typeof no<"u"))throw new FeeConflictError;if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro});if(no&&ro&&no>ro)throw new TipAboveFeeCapError({maxFeePerGas:ro,maxPriorityFeePerGas:no})}class BaseFeeScalarError extends BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Eip1559FeesNotSupportedError extends BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class MaxFeePerGasTooLowError extends BaseError{constructor({maxPriorityFeePerGas:eo}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei(eo)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class BlockNotFoundError extends BaseError{constructor({blockHash:eo,blockNumber:to}){let ro="Block";eo&&(ro=`Block at hash "${eo}"`),to&&(ro=`Block at number "${to}"`),super(`${ro} could not be found.`,{name:"BlockNotFoundError"})}}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(Xr){const eo={...Xr,blockHash:Xr.blockHash?Xr.blockHash:null,blockNumber:Xr.blockNumber?BigInt(Xr.blockNumber):null,chainId:Xr.chainId?hexToNumber$2(Xr.chainId):void 0,gas:Xr.gas?BigInt(Xr.gas):void 0,gasPrice:Xr.gasPrice?BigInt(Xr.gasPrice):void 0,maxFeePerBlobGas:Xr.maxFeePerBlobGas?BigInt(Xr.maxFeePerBlobGas):void 0,maxFeePerGas:Xr.maxFeePerGas?BigInt(Xr.maxFeePerGas):void 0,maxPriorityFeePerGas:Xr.maxPriorityFeePerGas?BigInt(Xr.maxPriorityFeePerGas):void 0,nonce:Xr.nonce?hexToNumber$2(Xr.nonce):void 0,to:Xr.to?Xr.to:null,transactionIndex:Xr.transactionIndex?Number(Xr.transactionIndex):null,type:Xr.type?transactionType[Xr.type]:void 0,typeHex:Xr.type?Xr.type:void 0,value:Xr.value?BigInt(Xr.value):void 0,v:Xr.v?BigInt(Xr.v):void 0};return Xr.authorizationList&&(eo.authorizationList=formatAuthorizationList(Xr.authorizationList)),eo.yParity=(()=>{if(Xr.yParity)return Number(Xr.yParity);if(typeof eo.v=="bigint"){if(eo.v===0n||eo.v===27n)return 0;if(eo.v===1n||eo.v===28n)return 1;if(eo.v>=35n)return eo.v%2n===0n?1:0}})(),eo.type==="legacy"&&(delete eo.accessList,delete eo.maxFeePerBlobGas,delete eo.maxFeePerGas,delete eo.maxPriorityFeePerGas,delete eo.yParity),eo.type==="eip2930"&&(delete eo.maxFeePerBlobGas,delete eo.maxFeePerGas,delete eo.maxPriorityFeePerGas),eo.type==="eip1559"&&delete eo.maxFeePerBlobGas,eo}const defineTransaction=defineFormatter("transaction",formatTransaction);function formatAuthorizationList(Xr){return Xr.map(eo=>({contractAddress:eo.address,chainId:Number(eo.chainId),nonce:Number(eo.nonce),r:eo.r,s:eo.s,yParity:Number(eo.yParity)}))}function formatBlock(Xr){var to;const eo=(to=Xr.transactions)==null?void 0:to.map(ro=>typeof ro=="string"?ro:formatTransaction(ro));return{...Xr,baseFeePerGas:Xr.baseFeePerGas?BigInt(Xr.baseFeePerGas):null,blobGasUsed:Xr.blobGasUsed?BigInt(Xr.blobGasUsed):void 0,difficulty:Xr.difficulty?BigInt(Xr.difficulty):void 0,excessBlobGas:Xr.excessBlobGas?BigInt(Xr.excessBlobGas):void 0,gasLimit:Xr.gasLimit?BigInt(Xr.gasLimit):void 0,gasUsed:Xr.gasUsed?BigInt(Xr.gasUsed):void 0,hash:Xr.hash?Xr.hash:null,logsBloom:Xr.logsBloom?Xr.logsBloom:null,nonce:Xr.nonce?Xr.nonce:null,number:Xr.number?BigInt(Xr.number):null,size:Xr.size?BigInt(Xr.size):void 0,timestamp:Xr.timestamp?BigInt(Xr.timestamp):void 0,transactions:eo,totalDifficulty:Xr.totalDifficulty?BigInt(Xr.totalDifficulty):null}}const defineBlock=defineFormatter("block",formatBlock);async function getBlock$1(Xr,{blockHash:eo,blockNumber:to,blockTag:ro,includeTransactions:no}={}){var lo,fo,ho;const io=ro??"latest",oo=no??!1,ao=to!==void 0?numberToHex(to):void 0;let so=null;if(eo?so=await Xr.request({method:"eth_getBlockByHash",params:[eo,oo]},{dedupe:!0}):so=await Xr.request({method:"eth_getBlockByNumber",params:[ao||io,oo]},{dedupe:!!ao}),!so)throw new BlockNotFoundError({blockHash:eo,blockNumber:to});return(((ho=(fo=(lo=Xr.chain)==null?void 0:lo.formatters)==null?void 0:fo.block)==null?void 0:ho.format)||formatBlock)(so)}async function getGasPrice(Xr){const eo=await Xr.request({method:"eth_gasPrice"});return BigInt(eo)}async function estimateMaxPriorityFeePerGas(Xr,eo){return internal_estimateMaxPriorityFeePerGas(Xr,eo)}async function internal_estimateMaxPriorityFeePerGas(Xr,eo){var io,oo;const{block:to,chain:ro=Xr.chain,request:no}=eo||{};try{const ao=((io=ro==null?void 0:ro.fees)==null?void 0:io.maxPriorityFeePerGas)??((oo=ro==null?void 0:ro.fees)==null?void 0:oo.defaultPriorityFee);if(typeof ao=="function"){const co=to||await getAction(Xr,getBlock$1,"getBlock")({}),lo=await ao({block:co,client:Xr,request:no});if(lo===null)throw new Error;return lo}if(typeof ao<"u")return ao;const so=await Xr.request({method:"eth_maxPriorityFeePerGas"});return hexToBigInt(so)}catch{const[ao,so]=await Promise.all([to?Promise.resolve(to):getAction(Xr,getBlock$1,"getBlock")({}),getAction(Xr,getGasPrice,"getGasPrice")({})]);if(typeof ao.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const co=so-ao.baseFeePerGas;return co<0n?0n:co}}async function estimateFeesPerGas$1(Xr,eo){return internal_estimateFeesPerGas(Xr,eo)}async function internal_estimateFeesPerGas(Xr,eo){var ho,go;const{block:to,chain:ro=Xr.chain,request:no,type:io="eip1559"}=eo||{},oo=await(async()=>{var yo,vo;return typeof((yo=ro==null?void 0:ro.fees)==null?void 0:yo.baseFeeMultiplier)=="function"?ro.fees.baseFeeMultiplier({block:to,client:Xr,request:no}):((vo=ro==null?void 0:ro.fees)==null?void 0:vo.baseFeeMultiplier)??1.2})();if(oo<1)throw new BaseFeeScalarError;const so=10**(((ho=oo.toString().split(".")[1])==null?void 0:ho.length)??0),co=yo=>yo*BigInt(Math.ceil(oo*so))/BigInt(so),lo=to||await getAction(Xr,getBlock$1,"getBlock")({});if(typeof((go=ro==null?void 0:ro.fees)==null?void 0:go.estimateFeesPerGas)=="function"){const yo=await ro.fees.estimateFeesPerGas({block:to,client:Xr,multiply:co,request:no,type:io});if(yo!==null)return yo}if(io==="eip1559"){if(typeof lo.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const yo=typeof(no==null?void 0:no.maxPriorityFeePerGas)=="bigint"?no.maxPriorityFeePerGas:await internal_estimateMaxPriorityFeePerGas(Xr,{block:lo,chain:ro,request:no}),vo=co(lo.baseFeePerGas);return{maxFeePerGas:(no==null?void 0:no.maxFeePerGas)??vo+yo,maxPriorityFeePerGas:yo}}return{gasPrice:(no==null?void 0:no.gasPrice)??co(await getAction(Xr,getGasPrice,"getGasPrice")({}))}}async function getTransactionCount(Xr,{address:eo,blockTag:to="latest",blockNumber:ro}){const no=await Xr.request({method:"eth_getTransactionCount",params:[eo,ro?numberToHex(ro):to]},{dedupe:!!ro});return hexToNumber$2(no)}function blobsToCommitments(Xr){const{kzg:eo}=Xr,to=Xr.to??(typeof Xr.blobs[0]=="string"?"hex":"bytes"),ro=typeof Xr.blobs[0]=="string"?Xr.blobs.map(io=>hexToBytes$3(io)):Xr.blobs,no=[];for(const io of ro)no.push(Uint8Array.from(eo.blobToKzgCommitment(io)));return to==="bytes"?no:no.map(io=>bytesToHex$2(io))}function blobsToProofs(Xr){const{kzg:eo}=Xr,to=Xr.to??(typeof Xr.blobs[0]=="string"?"hex":"bytes"),ro=typeof Xr.blobs[0]=="string"?Xr.blobs.map(oo=>hexToBytes$3(oo)):Xr.blobs,no=typeof Xr.commitments[0]=="string"?Xr.commitments.map(oo=>hexToBytes$3(oo)):Xr.commitments,io=[];for(let oo=0;oobytesToHex$2(oo))}function sha256$6(Xr,eo){const to=eo||"hex",ro=sha256_1$4(isHex$4(Xr,{strict:!1})?toBytes$1(Xr):Xr);return to==="bytes"?ro:toHex$1(ro)}function commitmentToVersionedHash(Xr){const{commitment:eo,version:to=1}=Xr,ro=Xr.to??(typeof eo=="string"?"hex":"bytes"),no=sha256$6(eo,"bytes");return no.set([to],0),ro==="bytes"?no:bytesToHex$2(no)}function commitmentsToVersionedHashes(Xr){const{commitments:eo,version:to}=Xr,ro=Xr.to??(typeof eo[0]=="string"?"hex":"bytes"),no=[];for(const io of eo)no.push(commitmentToVersionedHash({commitment:io,to:ro,version:to}));return no}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError{constructor({maxSize:eo,size:to}){super("Blob size is too large.",{metaMessages:[`Max: ${eo} bytes`,`Given: ${to} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError{constructor({hash:eo,size:to}){super(`Versioned hash "${eo}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${to}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError{constructor({hash:eo,version:to}){super(`Versioned hash "${eo}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${to}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(Xr){const eo=Xr.to??(typeof Xr.data=="string"?"hex":"bytes"),to=typeof Xr.data=="string"?hexToBytes$3(Xr.data):Xr.data,ro=size$1(to);if(!ro)throw new EmptyBlobError;if(ro>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:ro});const no=[];let io=!0,oo=0;for(;io;){const ao=createCursor(new Uint8Array(bytesPerBlob));let so=0;for(;soao.bytes):no.map(ao=>bytesToHex$2(ao.bytes))}function toBlobSidecars(Xr){const{data:eo,kzg:to,to:ro}=Xr,no=Xr.blobs??toBlobs({data:eo,to:ro}),io=Xr.commitments??blobsToCommitments({blobs:no,kzg:to,to:ro}),oo=Xr.proofs??blobsToProofs({blobs:no,commitments:io,kzg:to,to:ro}),ao=[];for(let so=0;so"u"&&fo)if(so){const Eo=await wo();ho.nonce=await so.consume({address:fo.address,chainId:Eo,client:Xr})}else ho.nonce=await getAction(Xr,getTransactionCount,"getTransactionCount")({address:fo.address,blockTag:"pending"});if((co.includes("fees")||co.includes("type"))&&typeof lo>"u")try{ho.type=getTransactionType(ho)}catch{const Eo=await yo();ho.type=typeof(Eo==null?void 0:Eo.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(co.includes("fees"))if(ho.type!=="legacy"&&ho.type!=="eip2930"){if(typeof ho.maxFeePerGas>"u"||typeof ho.maxPriorityFeePerGas>"u"){const Eo=await yo(),{maxFeePerGas:ko,maxPriorityFeePerGas:Ao}=await internal_estimateFeesPerGas(Xr,{block:Eo,chain:no,request:ho});if(typeof eo.maxPriorityFeePerGas>"u"&&eo.maxFeePerGas&&eo.maxFeePerGas"u"&&(ho.gas=await getAction(Xr,estimateGas$1,"estimateGas")({...ho,account:fo&&{address:fo.address,type:"json-rpc"}})),assertRequest(ho),delete ho.parameters,ho}async function getBalance(Xr,{address:eo,blockNumber:to,blockTag:ro="latest"}){const no=to?numberToHex(to):void 0,io=await Xr.request({method:"eth_getBalance",params:[eo,no||ro]});return BigInt(io)}async function estimateGas$1(Xr,eo){var no,io,oo;const{account:to=Xr.account}=eo,ro=to?parseAccount(to):void 0;try{let uo=function(bo){const{block:_o,request:$o,rpcStateOverride:Co}=bo;return Xr.request({method:"eth_estimateGas",params:Co?[$o,_o??"latest",Co]:_o?[$o,_o]:[$o]})};const{accessList:ao,authorizationList:so,blobs:co,blobVersionedHashes:lo,blockNumber:fo,blockTag:ho,data:go,gas:yo,gasPrice:vo,maxFeePerBlobGas:wo,maxFeePerGas:Eo,maxPriorityFeePerGas:ko,nonce:Ao,value:Po,stateOverride:jo,...Mo}=await prepareTransactionRequest(Xr,{...eo,parameters:(ro==null?void 0:ro.type)==="local"?void 0:["blobVersionedHashes"]}),Do=(fo?numberToHex(fo):void 0)||ho,Fo=serializeStateOverride(jo),Xo=await(async()=>{if(Mo.to)return Mo.to;if(so&&so.length>0)return await recoverAuthorizationAddress({authorization:so[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`")})})();assertRequest(eo);const Lo=(oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionRequest)==null?void 0:oo.format,xo=(Lo||formatTransactionRequest)({...extract(Mo,{format:Lo}),from:ro==null?void 0:ro.address,accessList:ao,authorizationList:so,blobs:co,blobVersionedHashes:lo,data:go,gas:yo,gasPrice:vo,maxFeePerBlobGas:wo,maxFeePerGas:Eo,maxPriorityFeePerGas:ko,nonce:Ao,to:Xo,value:Po});let po=BigInt(await uo({block:Do,request:xo,rpcStateOverride:Fo}));if(so){const bo=await getBalance(Xr,{address:xo.from}),_o=await Promise.all(so.map(async $o=>{const{contractAddress:Co}=$o,Ro=await uo({block:Do,request:{authorizationList:void 0,data:go,from:ro==null?void 0:ro.address,to:Co,value:numberToHex(bo)},rpcStateOverride:Fo}).catch(()=>100000n);return 2n*BigInt(Ro)}));po+=_o.reduce(($o,Co)=>$o+Co,0n)}return po}catch(ao){throw getEstimateGasError(ao,{...eo,account:ro,chain:Xr.chain})}}async function estimateContractGas(Xr,eo){const{abi:to,address:ro,args:no,functionName:io,...oo}=eo,ao=encodeFunctionData({abi:to,args:no,functionName:io});try{return await getAction(Xr,estimateGas$1,"estimateGas")({data:ao,to:ro,...oo})}catch(so){const co=oo.account?parseAccount(oo.account):void 0;throw getContractError(so,{abi:to,address:ro,args:no,docsPath:"/docs/contract/estimateContractGas",functionName:io,sender:co==null?void 0:co.address})}}function isAddressEqual(Xr,eo){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});if(!isAddress(eo,{strict:!1}))throw new InvalidAddressError({address:eo});return Xr.toLowerCase()===eo.toLowerCase()}const docsPath$2="/docs/contract/decodeEventLog";function decodeEventLog(Xr){const{abi:eo,data:to,strict:ro,topics:no}=Xr,io=ro??!0,[oo,...ao]=no;if(!oo)throw new AbiEventSignatureEmptyTopicsError({docsPath:docsPath$2});const so=eo.length===1?eo[0]:eo.find(vo=>vo.type==="event"&&oo===toEventSelector(formatAbiItem(vo)));if(!(so&&"name"in so)||so.type!=="event")throw new AbiEventSignatureNotFoundError(oo,{docsPath:docsPath$2});const{name:co,inputs:lo}=so,fo=lo==null?void 0:lo.some(vo=>!("name"in vo&&vo.name));let ho=fo?[]:{};const go=lo.filter(vo=>"indexed"in vo&&vo.indexed);for(let vo=0;vo!("indexed"in vo&&vo.indexed));if(yo.length>0){if(to&&to!=="0x")try{const vo=decodeAbiParameters(yo,to);if(vo)if(fo)ho=[...ho,...vo];else for(let wo=0;wo0?ho:void 0}}function decodeTopic({param:Xr,value:eo}){return Xr.type==="string"||Xr.type==="bytes"||Xr.type==="tuple"||Xr.type.match(/^(.*)\[(\d+)?\]$/)?eo:(decodeAbiParameters([Xr],eo)||[])[0]}function parseEventLogs(Xr){const{abi:eo,args:to,logs:ro,strict:no=!0}=Xr,io=(()=>{if(Xr.eventName)return Array.isArray(Xr.eventName)?Xr.eventName:[Xr.eventName]})();return ro.map(oo=>{var ao;try{const so=eo.find(lo=>lo.type==="event"&&oo.topics[0]===toEventSelector(lo));if(!so)return null;const co=decodeEventLog({...oo,abi:[so],strict:no});return io&&!io.includes(co.eventName)||!includesArgs({args:co.args,inputs:so.inputs,matchArgs:to})?null:{...co,...oo}}catch(so){let co,lo;if(so instanceof AbiEventSignatureNotFoundError)return null;if(so instanceof DecodeLogDataMismatch||so instanceof DecodeLogTopicsMismatch){if(no)return null;co=so.abiItem.name,lo=(ao=so.abiItem.inputs)==null?void 0:ao.some(fo=>!("name"in fo&&fo.name))}return{...oo,args:lo?[]:{},eventName:co}}}).filter(Boolean)}function includesArgs(Xr){const{args:eo,inputs:to,matchArgs:ro}=Xr;if(!ro)return!0;if(!eo)return!1;function no(io,oo,ao){try{return io.type==="address"?isAddressEqual(oo,ao):io.type==="string"||io.type==="bytes"?keccak256(toBytes$1(oo))===ao:oo===ao}catch{return!1}}return Array.isArray(eo)&&Array.isArray(ro)?ro.every((io,oo)=>{if(io==null)return!0;const ao=to[oo];return ao?(Array.isArray(io)?io:[io]).some(co=>no(ao,co,eo[oo])):!1}):typeof eo=="object"&&!Array.isArray(eo)&&typeof ro=="object"&&!Array.isArray(ro)?Object.entries(ro).every(([io,oo])=>{if(oo==null)return!0;const ao=to.find(co=>co.name===io);return ao?(Array.isArray(oo)?oo:[oo]).some(co=>no(ao,co,eo[io])):!1}):!1}function formatLog(Xr,{args:eo,eventName:to}={}){return{...Xr,blockHash:Xr.blockHash?Xr.blockHash:null,blockNumber:Xr.blockNumber?BigInt(Xr.blockNumber):null,logIndex:Xr.logIndex?Number(Xr.logIndex):null,transactionHash:Xr.transactionHash?Xr.transactionHash:null,transactionIndex:Xr.transactionIndex?Number(Xr.transactionIndex):null,...to?{args:eo,eventName:to}:{}}}async function getLogs(Xr,{address:eo,blockHash:to,fromBlock:ro,toBlock:no,event:io,events:oo,args:ao,strict:so}={}){const co=so??!1,lo=oo??(io?[io]:void 0);let fo=[];lo&&(fo=[lo.flatMap(vo=>encodeEventTopics({abi:[vo],eventName:vo.name,args:oo?void 0:ao}))],io&&(fo=fo[0]));let ho;to?ho=await Xr.request({method:"eth_getLogs",params:[{address:eo,topics:fo,blockHash:to}]}):ho=await Xr.request({method:"eth_getLogs",params:[{address:eo,topics:fo,fromBlock:typeof ro=="bigint"?numberToHex(ro):ro,toBlock:typeof no=="bigint"?numberToHex(no):no}]});const go=ho.map(yo=>formatLog(yo));return lo?parseEventLogs({abi:lo,args:ao,logs:go,strict:co}):go}async function getContractEvents(Xr,eo){const{abi:to,address:ro,args:no,blockHash:io,eventName:oo,fromBlock:ao,toBlock:so,strict:co}=eo,lo=oo?getAbiItem({abi:to,name:oo}):void 0,fo=lo?void 0:to.filter(ho=>ho.type==="event");return getAction(Xr,getLogs,"getLogs")({address:ro,args:no,blockHash:io,event:lo,events:fo,fromBlock:ao,toBlock:so,strict:co})}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(Xr){const{abi:eo,args:to,functionName:ro,data:no}=Xr;let io=eo[0];if(ro){const ao=getAbiItem({abi:eo,args:to,name:ro});if(!ao)throw new AbiFunctionNotFoundError(ro,{docsPath:docsPath$1});io=ao}if(io.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!io.outputs)throw new AbiFunctionOutputsNotFoundError(io.name,{docsPath:docsPath$1});const oo=decodeAbiParameters(io.outputs,no);if(oo&&oo.length>1)return oo;if(oo&&oo.length===1)return oo[0]}const multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],universalResolverErrors=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],universalResolverResolveAbi=[...universalResolverErrors,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],universalResolverReverseAbi=[...universalResolverErrors,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],universalSignatureValidatorAbi=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",universalSignatureValidatorByteCode="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ChainDoesNotSupportContract extends BaseError{constructor({blockNumber:eo,chain:to,contract:ro}){super(`Chain "${to.name}" does not support contract "${ro.name}".`,{metaMessages:["This could be due to any of the following:",...eo&&ro.blockCreated&&ro.blockCreated>eo?[`- The contract "${ro.name}" was not deployed until block ${ro.blockCreated} (current block ${eo}).`]:[`- The chain does not have the contract "${ro.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ChainMismatchError extends BaseError{constructor({chain:eo,currentChainId:to}){super(`The current chain of the wallet (id: ${to}) does not match the target chain for the transaction (id: ${eo.id} – ${eo.name}).`,{metaMessages:[`Current Chain ID: ${to}`,`Expected Chain ID: ${eo.id} – ${eo.name}`],name:"ChainMismatchError"})}}class ChainNotFoundError extends BaseError{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}class ClientChainNotConfiguredError extends BaseError{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError{constructor({chainId:eo}){super(typeof eo=="number"?`Chain ID "${eo}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const docsPath="/docs/contract/encodeDeployData";function encodeDeployData(Xr){const{abi:eo,args:to,bytecode:ro}=Xr;if(!to||to.length===0)return ro;const no=eo.find(oo=>"type"in oo&&oo.type==="constructor");if(!no)throw new AbiConstructorNotFoundError({docsPath});if(!("inputs"in no))throw new AbiConstructorParamsNotFoundError({docsPath});if(!no.inputs||no.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath});const io=encodeAbiParameters(no.inputs,to);return concatHex([ro,io])}function getChainContractAddress({blockNumber:Xr,chain:eo,contract:to}){var no;const ro=(no=eo==null?void 0:eo.contracts)==null?void 0:no[to];if(!ro)throw new ChainDoesNotSupportContract({chain:eo,contract:{name:to}});if(Xr&&ro.blockCreated&&ro.blockCreated>Xr)throw new ChainDoesNotSupportContract({blockNumber:Xr,chain:eo,contract:{name:to,blockCreated:ro.blockCreated}});return ro.address}function getCallError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new CallExecutionError(ro,{docsPath:eo,...to})}function withResolvers(){let Xr=()=>{},eo=()=>{};return{promise:new Promise((ro,no)=>{Xr=ro,eo=no}),resolve:Xr,reject:eo}}const schedulerCache=new Map;function createBatchScheduler({fn:Xr,id:eo,shouldSplitBatch:to,wait:ro=0,sort:no}){const io=async()=>{const lo=so();oo();const fo=lo.map(({args:ho})=>ho);fo.length!==0&&Xr(fo).then(ho=>{no&&Array.isArray(ho)&&ho.sort(no);for(let go=0;go{for(let go=0;goschedulerCache.delete(eo),ao=()=>so().map(({args:lo})=>lo),so=()=>schedulerCache.get(eo)||[],co=lo=>schedulerCache.set(eo,[...so(),lo]);return{flush:oo,async schedule(lo){const{promise:fo,resolve:ho,reject:go}=withResolvers();return(to==null?void 0:to([...ao(),lo]))&&io(),so().length>0?(co({args:lo,resolve:ho,reject:go}),fo):(co({args:lo,resolve:ho,reject:go}),setTimeout(io,ro),fo)}}}async function call(Xr,eo){var Lo,Bo,xo,uo;const{account:to=Xr.account,batch:ro=!!((Lo=Xr.batch)!=null&&Lo.multicall),blockNumber:no,blockTag:io="latest",accessList:oo,blobs:ao,code:so,data:co,factory:lo,factoryData:fo,gas:ho,gasPrice:go,maxFeePerBlobGas:yo,maxFeePerGas:vo,maxPriorityFeePerGas:wo,nonce:Eo,to:ko,value:Ao,stateOverride:Po,...jo}=eo,Mo=to?parseAccount(to):void 0;if(so&&(lo||fo))throw new BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(so&&ko)throw new BaseError("Cannot provide both `code` & `to` as parameters.");const No=so&&co,Do=lo&&fo&&ko&&co,Fo=No||Do,Xo=No?toDeploylessCallViaBytecodeData({code:so,data:co}):Do?toDeploylessCallViaFactoryData({data:co,factory:lo,factoryData:fo,to:ko}):co;try{assertRequest(eo);const bo=(no?numberToHex(no):void 0)||io,_o=serializeStateOverride(Po),$o=(uo=(xo=(Bo=Xr.chain)==null?void 0:Bo.formatters)==null?void 0:xo.transactionRequest)==null?void 0:uo.format,Ro=($o||formatTransactionRequest)({...extract(jo,{format:$o}),from:Mo==null?void 0:Mo.address,accessList:oo,blobs:ao,data:Xo,gas:ho,gasPrice:go,maxFeePerBlobGas:yo,maxFeePerGas:vo,maxPriorityFeePerGas:wo,nonce:Eo,to:Fo?void 0:ko,value:Ao});if(ro&&shouldPerformMulticall({request:Ro})&&!_o)try{return await scheduleMulticall(Xr,{...Ro,blockNumber:no,blockTag:io})}catch(mo){if(!(mo instanceof ClientChainNotConfiguredError)&&!(mo instanceof ChainDoesNotSupportContract))throw mo}const So=await Xr.request({method:"eth_call",params:_o?[Ro,bo,_o]:[Ro,bo]});return So==="0x"?{data:void 0}:{data:So}}catch(po){const bo=getRevertErrorData(po),{offchainLookup:_o,offchainLookupSignature:$o}=await __vitePreload(async()=>{const{offchainLookup:Co,offchainLookupSignature:Ro}=await import("./ccip-CiOu7uMi.js");return{offchainLookup:Co,offchainLookupSignature:Ro}},[]);if(Xr.ccipRead!==!1&&(bo==null?void 0:bo.slice(0,10))===$o&&ko)return{data:await _o(Xr,{data:bo,to:ko})};throw Fo&&(bo==null?void 0:bo.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lo}):getCallError(po,{...eo,account:Mo,chain:Xr.chain})}}function shouldPerformMulticall({request:Xr}){const{data:eo,to,...ro}=Xr;return!(!eo||eo.startsWith(aggregate3Signature)||!to||Object.values(ro).filter(no=>typeof no<"u").length>0)}async function scheduleMulticall(Xr,eo){var vo;const{batchSize:to=1024,wait:ro=0}=typeof((vo=Xr.batch)==null?void 0:vo.multicall)=="object"?Xr.batch.multicall:{},{blockNumber:no,blockTag:io="latest",data:oo,multicallAddress:ao,to:so}=eo;let co=ao;if(!co){if(!Xr.chain)throw new ClientChainNotConfiguredError;co=getChainContractAddress({blockNumber:no,chain:Xr.chain,contract:"multicall3"})}const fo=(no?numberToHex(no):void 0)||io,{schedule:ho}=createBatchScheduler({id:`${Xr.uid}.${fo}`,wait:ro,shouldSplitBatch(wo){return wo.reduce((ko,{data:Ao})=>ko+(Ao.length-2),0)>to*2},fn:async wo=>{const Eo=wo.map(Po=>({allowFailure:!0,callData:Po.data,target:Po.to})),ko=encodeFunctionData({abi:multicall3Abi,args:[Eo],functionName:"aggregate3"}),Ao=await Xr.request({method:"eth_call",params:[{data:ko,to:co},fo]});return decodeFunctionResult({abi:multicall3Abi,args:[Eo],functionName:"aggregate3",data:Ao||"0x"})}}),[{returnData:go,success:yo}]=await ho({data:oo,to:so});if(!yo)throw new RawContractError({data:go});return go==="0x"?{data:void 0}:{data:go}}function toDeploylessCallViaBytecodeData(Xr){const{code:eo,data:to}=Xr;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[eo,to]})}function toDeploylessCallViaFactoryData(Xr){const{data:eo,factory:to,factoryData:ro,to:no}=Xr;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[no,eo,to,ro]})}function getRevertErrorData(Xr){var to;if(!(Xr instanceof BaseError))return;const eo=Xr.walk();return typeof(eo==null?void 0:eo.data)=="object"?(to=eo.data)==null?void 0:to.data:eo.data}async function readContract(Xr,eo){const{abi:to,address:ro,args:no,functionName:io,...oo}=eo,ao=encodeFunctionData({abi:to,args:no,functionName:io});try{const{data:so}=await getAction(Xr,call,"call")({...oo,data:ao,to:ro});return decodeFunctionResult({abi:to,args:no,functionName:io,data:so||"0x"})}catch(so){throw getContractError(so,{abi:to,address:ro,args:no,docsPath:"/docs/contract/readContract",functionName:io})}}async function simulateContract(Xr,eo){const{abi:to,address:ro,args:no,dataSuffix:io,functionName:oo,...ao}=eo,so=ao.account?parseAccount(ao.account):Xr.account,co=encodeFunctionData({abi:to,args:no,functionName:oo});try{const{data:lo}=await getAction(Xr,call,"call")({batch:!1,data:`${co}${io?io.replace("0x",""):""}`,to:ro,...ao,account:so}),fo=decodeFunctionResult({abi:to,args:no,functionName:oo,data:lo||"0x"}),ho=to.filter(go=>"name"in go&&go.name===eo.functionName);return{result:fo,request:{abi:ho,address:ro,args:no,dataSuffix:io,functionName:oo,...ao,account:so}}}catch(lo){throw getContractError(lo,{abi:to,address:ro,args:no,docsPath:"/docs/contract/simulateContract",functionName:oo,sender:so==null?void 0:so.address})}}const listenersCache=new Map,cleanupCache=new Map;let callbackCount=0;function observe(Xr,eo,to){const ro=++callbackCount,no=()=>listenersCache.get(Xr)||[],io=()=>{const lo=no();listenersCache.set(Xr,lo.filter(fo=>fo.id!==ro))},oo=()=>{const lo=cleanupCache.get(Xr);no().length===1&&lo&&lo(),io()},ao=no();if(listenersCache.set(Xr,[...ao,{id:ro,fns:eo}]),ao&&ao.length>0)return oo;const so={};for(const lo in eo)so[lo]=(...fo)=>{var go,yo;const ho=no();if(ho.length!==0)for(const vo of ho)(yo=(go=vo.fns)[lo])==null||yo.call(go,...fo)};const co=to(so);return typeof co=="function"&&cleanupCache.set(Xr,co),oo}async function wait$1(Xr){return new Promise(eo=>setTimeout(eo,Xr))}function poll$1(Xr,{emitOnBegin:eo,initialWaitTime:to,interval:ro}){let no=!0;const io=()=>no=!1;return(async()=>{let ao;eo&&(ao=await Xr({unpoll:io}));const so=await(to==null?void 0:to(ao))??ro;await wait$1(so);const co=async()=>{no&&(await Xr({unpoll:io}),await wait$1(ro),co())};co()})(),io}const promiseCache$1=new Map,responseCache=new Map;function getCache$1(Xr){const eo=(no,io)=>({clear:()=>io.delete(no),get:()=>io.get(no),set:oo=>io.set(no,oo)}),to=eo(Xr,promiseCache$1),ro=eo(Xr,responseCache);return{clear:()=>{to.clear(),ro.clear()},promise:to,response:ro}}async function withCache(Xr,{cacheKey:eo,cacheTime:to=Number.POSITIVE_INFINITY}){const ro=getCache$1(eo),no=ro.response.get();if(no&&to>0&&new Date().getTime()-no.created.getTime()`blockNumber.${Xr}`;async function getBlockNumber(Xr,{cacheTime:eo=Xr.cacheTime}={}){const to=await withCache(()=>Xr.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(Xr.uid),cacheTime:eo});return BigInt(to)}async function getFilterChanges(Xr,{filter:eo}){const to="strict"in eo&&eo.strict,ro=await eo.request({method:"eth_getFilterChanges",params:[eo.id]});if(typeof ro[0]=="string")return ro;const no=ro.map(io=>formatLog(io));return!("abi"in eo)||!eo.abi?no:parseEventLogs({abi:eo.abi,logs:no,strict:to})}async function uninstallFilter(Xr,{filter:eo}){return eo.request({method:"eth_uninstallFilter",params:[eo.id]})}function watchContractEvent(Xr,eo){const{abi:to,address:ro,args:no,batch:io=!0,eventName:oo,fromBlock:ao,onError:so,onLogs:co,poll:lo,pollingInterval:fo=Xr.pollingInterval,strict:ho}=eo;return(typeof lo<"u"?lo:typeof ao=="bigint"?!0:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"))?(()=>{const wo=ho??!1,Eo=stringify$4(["watchContractEvent",ro,no,io,Xr.uid,oo,fo,wo,ao]);return observe(Eo,{onLogs:co,onError:so},ko=>{let Ao;ao!==void 0&&(Ao=ao-1n);let Po,jo=!1;const Mo=poll$1(async()=>{var No;if(!jo){try{Po=await getAction(Xr,createContractEventFilter,"createContractEventFilter")({abi:to,address:ro,args:no,eventName:oo,strict:wo,fromBlock:ao})}catch{}jo=!0;return}try{let Do;if(Po)Do=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:Po});else{const Fo=await getAction(Xr,getBlockNumber,"getBlockNumber")({});Ao&&Ao{Po&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:Po}),Mo()}})})():(()=>{const wo=ho??!1,Eo=stringify$4(["watchContractEvent",ro,no,io,Xr.uid,oo,fo,wo]);let ko=!0,Ao=()=>ko=!1;return observe(Eo,{onLogs:co,onError:so},Po=>((async()=>{try{const jo=(()=>{if(Xr.transport.type==="fallback"){const Do=Xr.transport.transports.find(Fo=>Fo.config.type==="webSocket");return Do?Do.value:Xr.transport}return Xr.transport})(),Mo=oo?encodeEventTopics({abi:to,eventName:oo,args:no}):[],{unsubscribe:No}=await jo.subscribe({params:["logs",{address:ro,topics:Mo}],onData(Do){var Xo;if(!ko)return;const Fo=Do.result;try{const{eventName:Lo,args:Bo}=decodeEventLog({abi:to,data:Fo.data,topics:Fo.topics,strict:ho}),xo=formatLog(Fo,{args:Bo,eventName:Lo});Po.onLogs([xo])}catch(Lo){let Bo,xo;if(Lo instanceof DecodeLogDataMismatch||Lo instanceof DecodeLogTopicsMismatch){if(ho)return;Bo=Lo.abiItem.name,xo=(Xo=Lo.abiItem.inputs)==null?void 0:Xo.some(po=>!("name"in po&&po.name))}const uo=formatLog(Fo,{args:xo?[]:{},eventName:Bo});Po.onLogs([uo])}},onError(Do){var Fo;(Fo=Po.onError)==null||Fo.call(Po,Do)}});Ao=No,ko||Ao()}catch(jo){so==null||so(jo)}})(),()=>Ao()))})()}class AccountNotFoundError extends BaseError{constructor({docsPath:eo}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:eo,docsSlug:"account",name:"AccountNotFoundError"})}}class AccountTypeNotSupportedError extends BaseError{constructor({docsPath:eo,metaMessages:to,type:ro}){super(`Account type "${ro}" is not supported.`,{docsPath:eo,metaMessages:to,name:"AccountTypeNotSupportedError"})}}function assertCurrentChain({chain:Xr,currentChainId:eo}){if(!Xr)throw new ChainNotFoundError;if(eo!==Xr.id)throw new ChainMismatchError({chain:Xr,currentChainId:eo})}function getTransactionError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new TransactionExecutionError(ro,{docsPath:eo,...to})}async function sendRawTransaction(Xr,{serializedTransaction:eo}){return Xr.request({method:"eth_sendRawTransaction",params:[eo]},{retryCount:0})}const supportsWalletNamespace=new LruMap(128);async function sendTransaction$1(Xr,eo){var Eo,ko,Ao,Po;const{account:to=Xr.account,chain:ro=Xr.chain,accessList:no,authorizationList:io,blobs:oo,data:ao,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:fo,maxPriorityFeePerGas:ho,nonce:go,value:yo,...vo}=eo;if(typeof to>"u")throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const wo=to?parseAccount(to):null;try{assertRequest(eo);const jo=await(async()=>{if(eo.to)return eo.to;if(io&&io.length>0)return await recoverAuthorizationAddress({authorization:io[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((wo==null?void 0:wo.type)==="json-rpc"||wo===null){let Mo;ro!==null&&(Mo=await getAction(Xr,getChainId$1,"getChainId")({}),assertCurrentChain({currentChainId:Mo,chain:ro}));const No=(Ao=(ko=(Eo=Xr.chain)==null?void 0:Eo.formatters)==null?void 0:ko.transactionRequest)==null?void 0:Ao.format,Fo=(No||formatTransactionRequest)({...extract(vo,{format:No}),accessList:no,authorizationList:io,blobs:oo,chainId:Mo,data:ao,from:wo==null?void 0:wo.address,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:fo,maxPriorityFeePerGas:ho,nonce:go,to:jo,value:yo}),Xo=supportsWalletNamespace.get(Xr.uid)?"wallet_sendTransaction":"eth_sendTransaction";try{return await Xr.request({method:Xo,params:[Fo]},{retryCount:0})}catch(Lo){const Bo=Lo;if(Bo.name==="InvalidInputRpcError"||Bo.name==="InvalidParamsRpcError"||Bo.name==="MethodNotFoundRpcError"||Bo.name==="MethodNotSupportedRpcError")return await Xr.request({method:"wallet_sendTransaction",params:[Fo]},{retryCount:0}).then(xo=>(supportsWalletNamespace.set(Xr.uid,!0),xo));throw Bo}}if((wo==null?void 0:wo.type)==="local"){const Mo=await getAction(Xr,prepareTransactionRequest,"prepareTransactionRequest")({account:wo,accessList:no,authorizationList:io,blobs:oo,chain:ro,data:ao,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:fo,maxPriorityFeePerGas:ho,nonce:go,nonceManager:wo.nonceManager,parameters:[...defaultParameters,"sidecars"],value:yo,...vo,to:jo}),No=(Po=ro==null?void 0:ro.serializers)==null?void 0:Po.transaction,Do=await wo.signTransaction(Mo,{serializer:No});return await getAction(Xr,sendRawTransaction,"sendRawTransaction")({serializedTransaction:Do})}throw(wo==null?void 0:wo.type)==="smart"?new AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:wo==null?void 0:wo.type})}catch(jo){throw jo instanceof AccountTypeNotSupportedError?jo:getTransactionError(jo,{...eo,account:wo,chain:eo.chain||void 0})}}async function writeContract(Xr,eo){const{abi:to,account:ro=Xr.account,address:no,args:io,dataSuffix:oo,functionName:ao,...so}=eo;if(typeof ro>"u")throw new AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const co=ro?parseAccount(ro):null,lo=encodeFunctionData({abi:to,args:io,functionName:ao});try{return await getAction(Xr,sendTransaction$1,"sendTransaction")({data:`${lo}${oo?oo.replace("0x",""):""}`,to:no,account:co,...so})}catch(fo){throw getContractError(fo,{abi:to,address:no,args:io,docsPath:"/docs/contract/writeContract",functionName:ao,sender:co==null?void 0:co.address})}}function getContract({abi:Xr,address:eo,client:to}){const ro=to,[no,io]=ro?"public"in ro&&"wallet"in ro?[ro.public,ro.wallet]:"public"in ro?[ro.public,void 0]:"wallet"in ro?[void 0,ro.wallet]:[ro,ro]:[void 0,void 0],oo=no!=null,ao=io!=null,so={};let co=!1,lo=!1,fo=!1;for(const ho of Xr)if(ho.type==="function"?ho.stateMutability==="view"||ho.stateMutability==="pure"?co=!0:lo=!0:ho.type==="event"&&(fo=!0),co&&lo&&fo)break;return oo&&(co&&(so.read=new Proxy({},{get(ho,go){return(...yo)=>{const{args:vo,options:wo}=getFunctionParameters(yo);return getAction(no,readContract,"readContract")({abi:Xr,address:eo,functionName:go,args:vo,...wo})}}})),lo&&(so.simulate=new Proxy({},{get(ho,go){return(...yo)=>{const{args:vo,options:wo}=getFunctionParameters(yo);return getAction(no,simulateContract,"simulateContract")({abi:Xr,address:eo,functionName:go,args:vo,...wo})}}})),fo&&(so.createEventFilter=new Proxy({},{get(ho,go){return(...yo)=>{const vo=Xr.find(ko=>ko.type==="event"&&ko.name===go),{args:wo,options:Eo}=getEventParameters(yo,vo);return getAction(no,createContractEventFilter,"createContractEventFilter")({abi:Xr,address:eo,eventName:go,args:wo,...Eo})}}}),so.getEvents=new Proxy({},{get(ho,go){return(...yo)=>{const vo=Xr.find(ko=>ko.type==="event"&&ko.name===go),{args:wo,options:Eo}=getEventParameters(yo,vo);return getAction(no,getContractEvents,"getContractEvents")({abi:Xr,address:eo,eventName:go,args:wo,...Eo})}}}),so.watchEvent=new Proxy({},{get(ho,go){return(...yo)=>{const vo=Xr.find(ko=>ko.type==="event"&&ko.name===go),{args:wo,options:Eo}=getEventParameters(yo,vo);return getAction(no,watchContractEvent,"watchContractEvent")({abi:Xr,address:eo,eventName:go,args:wo,...Eo})}}}))),ao&&lo&&(so.write=new Proxy({},{get(ho,go){return(...yo)=>{const{args:vo,options:wo}=getFunctionParameters(yo);return getAction(io,writeContract,"writeContract")({abi:Xr,address:eo,functionName:go,args:vo,...wo})}}})),(oo||ao)&&lo&&(so.estimateGas=new Proxy({},{get(ho,go){return(...yo)=>{const{args:vo,options:wo}=getFunctionParameters(yo);return getAction(no??io,estimateContractGas,"estimateContractGas")({abi:Xr,address:eo,functionName:go,args:vo,...wo,account:wo.account??io.account})}}})),so.address=eo,so.abi=Xr,so}function getFunctionParameters(Xr){const eo=Xr.length&&Array.isArray(Xr[0]),to=eo?Xr[0]:[],ro=(eo?Xr[1]:Xr[0])??{};return{args:to,options:ro}}function getEventParameters(Xr,eo){let to=!1;Array.isArray(Xr[0])?to=!0:Xr.length===1?to=eo.inputs.some(io=>io.indexed):Xr.length===2&&(to=!0);const ro=to?Xr[0]:void 0,no=(to?Xr[1]:Xr[0])??{};return{args:ro,options:no}}class Eip712DomainNotFoundError extends BaseError{constructor({address:eo}){super(`No EIP-712 domain found on contract "${eo}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${eo}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function getEip712Domain$1(Xr,eo){const{address:to,factory:ro,factoryData:no}=eo;try{const[io,oo,ao,so,co,lo,fo]=await getAction(Xr,readContract,"readContract")({abi:abi$2,address:to,functionName:"eip712Domain",factory:ro,factoryData:no});return{domain:{name:oo,version:ao,chainId:Number(so),verifyingContract:co,salt:lo},extensions:fo,fields:io}}catch(io){const oo=io;throw oo.name==="ContractFunctionExecutionError"&&oo.cause.name==="ContractFunctionZeroDataError"?new Eip712DomainNotFoundError({address:to}):oo}}const abi$2=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function addChain(Xr,{chain:eo}){const{id:to,name:ro,nativeCurrency:no,rpcUrls:io,blockExplorers:oo}=eo;await Xr.request({method:"wallet_addEthereumChain",params:[{chainId:numberToHex(to),chainName:ro,nativeCurrency:no,rpcUrls:io.default.http,blockExplorerUrls:oo?Object.values(oo).map(({url:ao})=>ao):void 0}]},{dedupe:!0,retryCount:0})}const size=256;let index$1=size,buffer$1;function uid$1(Xr=11){if(!buffer$1||index$1+Xr>size*2){buffer$1="",index$1=0;for(let eo=0;eo{const ko=Eo(wo);for(const Po in yo)delete ko[Po];const Ao={...wo,...ko};return Object.assign(Ao,{extend:vo(Ao)})}}return Object.assign(yo,{extend:vo(yo)})}const promiseCache=new LruMap(8192);function withDedupe(Xr,{enabled:eo=!0,id:to}){if(!eo||!to)return Xr();if(promiseCache.get(to))return promiseCache.get(to);const ro=Xr().finally(()=>promiseCache.delete(to));return promiseCache.set(to,ro),ro}function withRetry(Xr,{delay:eo=100,retryCount:to=2,shouldRetry:ro=()=>!0}={}){return new Promise((no,io)=>{const oo=async({count:ao=0}={})=>{const so=async({error:co})=>{const lo=typeof eo=="function"?eo({count:ao,error:co}):eo;lo&&await wait$1(lo),oo({count:ao+1})};try{const co=await Xr();no(co)}catch(co){if(ao{const{dedupe:no=!1,retryDelay:io=150,retryCount:oo=3,uid:ao}={...eo,...ro},so=no?keccak256(stringToHex(`${ao}.${stringify$4(to)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await Xr(to)}catch(co){const lo=co;switch(lo.code){case ParseRpcError.code:throw new ParseRpcError(lo);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lo);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lo,{method:to.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lo);case InternalRpcError.code:throw new InternalRpcError(lo);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lo);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lo);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lo);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lo);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lo,{method:to.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lo);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lo);case UserRejectedRequestError$1.code:throw new UserRejectedRequestError$1(lo);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lo);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lo);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lo);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lo);case SwitchChainError.code:throw new SwitchChainError(lo);case 5e3:throw new UserRejectedRequestError$1(lo);default:throw co instanceof BaseError?co:new UnknownRpcError(lo)}}},{delay:({count:co,error:lo})=>{var fo;if(lo&&lo instanceof HttpRequestError){const ho=(fo=lo==null?void 0:lo.headers)==null?void 0:fo.get("Retry-After");if(ho!=null&&ho.match(/\d/))return Number.parseInt(ho)*1e3}return~~(1<shouldRetry(co)}),{enabled:no,id:so})}}function shouldRetry(Xr){return"code"in Xr&&typeof Xr.code=="number"?Xr.code===-1||Xr.code===LimitExceededRpcError.code||Xr.code===InternalRpcError.code:Xr instanceof HttpRequestError&&Xr.status?Xr.status===403||Xr.status===408||Xr.status===413||Xr.status===429||Xr.status===500||Xr.status===502||Xr.status===503||Xr.status===504:!0}function createTransport({key:Xr,name:eo,request:to,retryCount:ro=3,retryDelay:no=150,timeout:io,type:oo},ao){const so=uid$1();return{config:{key:Xr,name:eo,request:to,retryCount:ro,retryDelay:no,timeout:io,type:oo},request:buildRequest(to,{retryCount:ro,retryDelay:no,uid:so}),value:ao}}function custom$1(Xr,eo={}){const{key:to="custom",name:ro="Custom Provider",retryDelay:no}=eo;return({retryCount:io})=>createTransport({key:to,name:ro,request:Xr.request.bind(Xr),retryCount:eo.retryCount??io,retryDelay:no,type:"custom"})}class UrlRequiredError extends BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function withTimeout(Xr,{errorInstance:eo=new Error("timed out"),timeout:to,signal:ro}){return new Promise((no,io)=>{(async()=>{let oo;try{const ao=new AbortController;to>0&&(oo=setTimeout(()=>{ro?ao.abort():io(eo)},to)),no(await Xr({signal:(ao==null?void 0:ao.signal)||null}))}catch(ao){(ao==null?void 0:ao.name)==="AbortError"&&io(eo),io(ao)}finally{clearTimeout(oo)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(Xr,eo={}){return{async request(to){var fo;const{body:ro,onRequest:no=eo.onRequest,onResponse:io=eo.onResponse,timeout:oo=eo.timeout??1e4}=to,ao={...eo.fetchOptions??{},...to.fetchOptions??{}},{headers:so,method:co,signal:lo}=ao;try{const ho=await withTimeout(async({signal:yo})=>{const vo={...ao,body:Array.isArray(ro)?stringify$4(ro.map(Ao=>({jsonrpc:"2.0",id:Ao.id??idCache.take(),...Ao}))):stringify$4({jsonrpc:"2.0",id:ro.id??idCache.take(),...ro}),headers:{"Content-Type":"application/json",...so},method:co||"POST",signal:lo||(oo>0?yo:null)},wo=new Request(Xr,vo),Eo=await(no==null?void 0:no(wo,vo))??{...vo,url:Xr};return await fetch(Eo.url??Xr,Eo)},{errorInstance:new TimeoutError({body:ro,url:Xr}),timeout:oo,signal:!0});io&&await io(ho);let go;if((fo=ho.headers.get("Content-Type"))!=null&&fo.startsWith("application/json"))go=await ho.json();else{go=await ho.text();try{go=JSON.parse(go||"{}")}catch(yo){if(ho.ok)throw yo;go={error:go}}}if(!ho.ok)throw new HttpRequestError({body:ro,details:stringify$4(go.error)||ho.statusText,headers:ho.headers,status:ho.status,url:Xr});return go}catch(ho){throw ho instanceof HttpRequestError||ho instanceof TimeoutError?ho:new HttpRequestError({body:ro,cause:ho,url:Xr})}}}}function http(Xr,eo={}){const{batch:to,fetchOptions:ro,key:no="http",name:io="HTTP JSON-RPC",onFetchRequest:oo,onFetchResponse:ao,retryDelay:so}=eo;return({chain:co,retryCount:lo,timeout:fo})=>{const{batchSize:ho=1e3,wait:go=0}=typeof to=="object"?to:{},yo=eo.retryCount??lo,vo=fo??eo.timeout??1e4,wo=Xr||(co==null?void 0:co.rpcUrls.default.http[0]);if(!wo)throw new UrlRequiredError;const Eo=getHttpRpcClient(wo,{fetchOptions:ro,onRequest:oo,onResponse:ao,timeout:vo});return createTransport({key:no,name:io,async request({method:ko,params:Ao}){const Po={method:ko,params:Ao},{schedule:jo}=createBatchScheduler({id:wo,wait:go,shouldSplitBatch(Fo){return Fo.length>ho},fn:Fo=>Eo.request({body:Fo}),sort:(Fo,Xo)=>Fo.id-Xo.id}),Mo=async Fo=>to?jo(Fo):[await Eo.request({body:Fo})],[{error:No,result:Do}]=await Mo(Po);if(No)throw new RpcRequestError({body:Po,error:No,url:wo});return Do},retryCount:yo,retryDelay:so,timeout:vo,type:"http"},{fetchOptions:ro,url:wo})}}function isNullUniversalResolverError(Xr,eo){var ro,no,io,oo,ao,so;if(!(Xr instanceof BaseError))return!1;const to=Xr.walk(co=>co instanceof ContractFunctionRevertedError);return to instanceof ContractFunctionRevertedError?!!(((ro=to.data)==null?void 0:ro.errorName)==="ResolverNotFound"||((no=to.data)==null?void 0:no.errorName)==="ResolverWildcardNotSupported"||((io=to.data)==null?void 0:io.errorName)==="ResolverNotContract"||((oo=to.data)==null?void 0:oo.errorName)==="ResolverError"||((ao=to.data)==null?void 0:ao.errorName)==="HttpError"||(so=to.reason)!=null&&so.includes("Wildcard on non-extended resolvers is not supported")||eo==="reverse"&&to.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(Xr){if(Xr.length!==66||Xr.indexOf("[")!==0||Xr.indexOf("]")!==65)return null;const eo=`0x${Xr.slice(1,65)}`;return isHex$4(eo)?eo:null}function namehash(Xr){let eo=new Uint8Array(32).fill(0);if(!Xr)return bytesToHex$2(eo);const to=Xr.split(".");for(let ro=to.length-1;ro>=0;ro-=1){const no=encodedLabelToLabelhash(to[ro]),io=no?toBytes$1(no):keccak256(stringToBytes$1(to[ro]),"bytes");eo=keccak256(concat$1([eo,io]),"bytes")}return bytesToHex$2(eo)}function encodeLabelhash(Xr){return`[${Xr.slice(2)}]`}function labelhash(Xr){const eo=new Uint8Array(32).fill(0);return Xr?encodedLabelToLabelhash(Xr)||keccak256(stringToBytes$1(Xr)):bytesToHex$2(eo)}function packetToBytes(Xr){const eo=Xr.replace(/^\.|\.$/gm,"");if(eo.length===0)return new Uint8Array(1);const to=new Uint8Array(stringToBytes$1(eo).byteLength+2);let ro=0;const no=eo.split(".");for(let io=0;io255&&(oo=stringToBytes$1(encodeLabelhash(labelhash(no[io])))),to[ro]=oo.length,to.set(oo,ro+1),ro+=oo.length+1}return to.byteLength!==ro+1?to.slice(0,ro+1):to}async function getEnsAddress(Xr,{blockNumber:eo,blockTag:to,coinType:ro,name:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){let so=ao;if(!so){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");so=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}try{const co=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...ro!=null?{args:[namehash(no),BigInt(ro)]}:{args:[namehash(no)]}}),lo={address:so,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes(no)),co],blockNumber:eo,blockTag:to},fo=getAction(Xr,readContract,"readContract"),ho=io?await fo({...lo,args:[...lo.args,io]}):await fo(lo);if(ho[0]==="0x")return null;const go=decodeFunctionResult({abi:addressResolverAbi,args:ro!=null?[namehash(no),BigInt(ro)]:void 0,functionName:"addr",data:ho[0]});return go==="0x"||trim$1(go)==="0x00"?null:go}catch(co){if(oo)throw co;if(isNullUniversalResolverError(co,"resolve"))return null;throw co}}class EnsAvatarInvalidMetadataError extends BaseError{constructor({data:eo}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(eo)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError{constructor({reason:eo}){super(`ENS NFT avatar URI is invalid. ${eo}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError{constructor({uri:eo}){super(`Unable to resolve ENS avatar URI "${eo}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError{constructor({namespace:eo}){super(`ENS NFT avatar namespace "${eo}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(Xr){try{const eo=await fetch(Xr,{method:"HEAD"});if(eo.status===200){const to=eo.headers.get("content-type");return to==null?void 0:to.startsWith("image/")}return!1}catch(eo){return typeof eo=="object"&&typeof eo.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(to=>{const ro=new Image;ro.onload=()=>{to(!0)},ro.onerror=()=>{to(!1)},ro.src=Xr})}}function getGateway(Xr,eo){return Xr?Xr.endsWith("/")?Xr.slice(0,-1):Xr:eo}function resolveAvatarUri({uri:Xr,gatewayUrls:eo}){const to=base64Regex.test(Xr);if(to)return{uri:Xr,isOnChain:!0,isEncoded:to};const ro=getGateway(eo==null?void 0:eo.ipfs,"https://ipfs.io"),no=getGateway(eo==null?void 0:eo.arweave,"https://arweave.net"),io=Xr.match(networkRegex),{protocol:oo,subpath:ao,target:so,subtarget:co=""}=(io==null?void 0:io.groups)||{},lo=oo==="ipns:/"||ao==="ipns/",fo=oo==="ipfs:/"||ao==="ipfs/"||ipfsHashRegex.test(Xr);if(Xr.startsWith("http")&&!lo&&!fo){let go=Xr;return eo!=null&&eo.arweave&&(go=Xr.replace(/https:\/\/arweave.net/g,eo==null?void 0:eo.arweave)),{uri:go,isOnChain:!1,isEncoded:!1}}if((lo||fo)&&so)return{uri:`${ro}/${lo?"ipns":"ipfs"}/${so}${co}`,isOnChain:!1,isEncoded:!1};if(oo==="ar:/"&&so)return{uri:`${no}/${so}${co||""}`,isOnChain:!1,isEncoded:!1};let ho=Xr.replace(dataURIRegex,"");if(ho.startsWith("no.json());return await parseAvatarUri({gatewayUrls:Xr,uri:getJsonImage(to)})}catch{throw new EnsAvatarUriResolutionError({uri:eo})}}async function parseAvatarUri({gatewayUrls:Xr,uri:eo}){const{uri:to,isOnChain:ro}=resolveAvatarUri({uri:eo,gatewayUrls:Xr});if(ro||await isImageUri(to))return to;throw new EnsAvatarUriResolutionError({uri:eo})}function parseNftUri(Xr){let eo=Xr;eo.startsWith("did:nft:")&&(eo=eo.replace("did:nft:","").replace(/_/g,"/"));const[to,ro,no]=eo.split("/"),[io,oo]=to.split(":"),[ao,so]=ro.split(":");if(!io||io.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!oo)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!so)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!no)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!ao)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(oo),namespace:ao.toLowerCase(),contractAddress:so,tokenID:no}}async function getNftTokenUri(Xr,{nft:eo}){if(eo.namespace==="erc721")return readContract(Xr,{address:eo.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(eo.tokenID)]});if(eo.namespace==="erc1155")return readContract(Xr,{address:eo.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(eo.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:eo.namespace})}async function parseAvatarRecord(Xr,{gatewayUrls:eo,record:to}){return/eip155:/i.test(to)?parseNftAvatarUri(Xr,{gatewayUrls:eo,record:to}):parseAvatarUri({uri:to,gatewayUrls:eo})}async function parseNftAvatarUri(Xr,{gatewayUrls:eo,record:to}){const ro=parseNftUri(to),no=await getNftTokenUri(Xr,{nft:ro}),{uri:io,isOnChain:oo,isEncoded:ao}=resolveAvatarUri({uri:no,gatewayUrls:eo});if(oo&&(io.includes("data:application/json;base64,")||io.startsWith("{"))){const co=ao?atob(io.replace("data:application/json;base64,","")):io,lo=JSON.parse(co);return parseAvatarUri({uri:getJsonImage(lo),gatewayUrls:eo})}let so=ro.tokenID;return ro.namespace==="erc1155"&&(so=so.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:eo,uri:io.replace(/(?:0x)?{id}/,so)})}async function getEnsText(Xr,{blockNumber:eo,blockTag:to,name:ro,key:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){let so=ao;if(!so){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");so=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}try{const co={address:so,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes(ro)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(ro),no]})],blockNumber:eo,blockTag:to},lo=getAction(Xr,readContract,"readContract"),fo=io?await lo({...co,args:[...co.args,io]}):await lo(co);if(fo[0]==="0x")return null;const ho=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:fo[0]});return ho===""?null:ho}catch(co){if(oo)throw co;if(isNullUniversalResolverError(co,"resolve"))return null;throw co}}async function getEnsAvatar(Xr,{blockNumber:eo,blockTag:to,assetGatewayUrls:ro,name:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){const so=await getAction(Xr,getEnsText,"getEnsText")({blockNumber:eo,blockTag:to,key:"avatar",name:no,universalResolverAddress:ao,gatewayUrls:io,strict:oo});if(!so)return null;try{return await parseAvatarRecord(Xr,{record:so,gatewayUrls:ro})}catch{return null}}async function getEnsName(Xr,{address:eo,blockNumber:to,blockTag:ro,gatewayUrls:no,strict:io,universalResolverAddress:oo}){let ao=oo;if(!ao){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");ao=getChainContractAddress({blockNumber:to,chain:Xr.chain,contract:"ensUniversalResolver"})}const so=`${eo.toLowerCase().substring(2)}.addr.reverse`;try{const co={address:ao,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex$1(packetToBytes(so))],blockNumber:to,blockTag:ro},lo=getAction(Xr,readContract,"readContract"),[fo,ho]=no?await lo({...co,args:[...co.args,no]}):await lo(co);return eo.toLowerCase()!==ho.toLowerCase()?null:fo}catch(co){if(io)throw co;if(isNullUniversalResolverError(co,"reverse"))return null;throw co}}async function getEnsResolver(Xr,{blockNumber:eo,blockTag:to,name:ro,universalResolverAddress:no}){let io=no;if(!io){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");io=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}const[oo]=await getAction(Xr,readContract,"readContract")({address:io,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[toHex$1(packetToBytes(ro))],blockNumber:eo,blockTag:to});return oo}async function createBlockFilter(Xr){const eo=createFilterRequestScope(Xr,{method:"eth_newBlockFilter"}),to=await Xr.request({method:"eth_newBlockFilter"});return{id:to,request:eo(to),type:"block"}}async function createEventFilter(Xr,{address:eo,args:to,event:ro,events:no,fromBlock:io,strict:oo,toBlock:ao}={}){const so=no??(ro?[ro]:void 0),co=createFilterRequestScope(Xr,{method:"eth_newFilter"});let lo=[];so&&(lo=[so.flatMap(go=>encodeEventTopics({abi:[go],eventName:go.name,args:to}))],ro&&(lo=lo[0]));const fo=await Xr.request({method:"eth_newFilter",params:[{address:eo,fromBlock:typeof io=="bigint"?numberToHex(io):io,toBlock:typeof ao=="bigint"?numberToHex(ao):ao,...lo.length?{topics:lo}:{}}]});return{abi:so,args:to,eventName:ro?ro.name:void 0,fromBlock:io,id:fo,request:co(fo),strict:!!oo,toBlock:ao,type:"event"}}async function createPendingTransactionFilter(Xr){const eo=createFilterRequestScope(Xr,{method:"eth_newPendingTransactionFilter"}),to=await Xr.request({method:"eth_newPendingTransactionFilter"});return{id:to,request:eo(to),type:"transaction"}}async function getBlobBaseFee(Xr){const eo=await Xr.request({method:"eth_blobBaseFee"});return BigInt(eo)}async function getBlockTransactionCount(Xr,{blockHash:eo,blockNumber:to,blockTag:ro="latest"}={}){const no=to!==void 0?numberToHex(to):void 0;let io;return eo?io=await Xr.request({method:"eth_getBlockTransactionCountByHash",params:[eo]},{dedupe:!0}):io=await Xr.request({method:"eth_getBlockTransactionCountByNumber",params:[no||ro]},{dedupe:!!no}),hexToNumber$2(io)}async function getCode$1(Xr,{address:eo,blockNumber:to,blockTag:ro="latest"}){const no=to!==void 0?numberToHex(to):void 0,io=await Xr.request({method:"eth_getCode",params:[eo,no||ro]},{dedupe:!!no});if(io!=="0x")return io}function formatFeeHistory(Xr){var eo;return{baseFeePerGas:Xr.baseFeePerGas.map(to=>BigInt(to)),gasUsedRatio:Xr.gasUsedRatio,oldestBlock:BigInt(Xr.oldestBlock),reward:(eo=Xr.reward)==null?void 0:eo.map(to=>to.map(ro=>BigInt(ro)))}}async function getFeeHistory(Xr,{blockCount:eo,blockNumber:to,blockTag:ro="latest",rewardPercentiles:no}){const io=to?numberToHex(to):void 0,oo=await Xr.request({method:"eth_feeHistory",params:[numberToHex(eo),io||ro,no]},{dedupe:!!io});return formatFeeHistory(oo)}async function getFilterLogs(Xr,{filter:eo}){const to=eo.strict??!1,no=(await eo.request({method:"eth_getFilterLogs",params:[eo.id]})).map(io=>formatLog(io));return eo.abi?parseEventLogs({abi:eo.abi,logs:no,strict:to}):no}function defineChain(Xr){return{formatters:void 0,fees:void 0,serializers:void 0,...Xr}}const arrayRegex=/^(.*)\[([0-9]*)\]$/,bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class InvalidPrimaryTypeError extends BaseError{constructor({primaryType:eo,types:to}){super(`Invalid primary type \`${eo}\` must be one of \`${JSON.stringify(Object.keys(to))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class InvalidStructTypeError extends BaseError{constructor({type:eo}){super(`Struct type "${eo}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function hashTypedData(Xr){const{domain:eo={},message:to,primaryType:ro}=Xr,no={EIP712Domain:getTypesForEIP712Domain({domain:eo}),...Xr.types};validateTypedData$1({domain:eo,message:to,primaryType:ro,types:no});const io=["0x1901"];return eo&&io.push(hashDomain({domain:eo,types:no})),ro!=="EIP712Domain"&&io.push(hashStruct({data:to,primaryType:ro,types:no})),keccak256(concat$1(io))}function hashDomain({domain:Xr,types:eo}){return hashStruct({data:Xr,primaryType:"EIP712Domain",types:eo})}function hashStruct({data:Xr,primaryType:eo,types:to}){const ro=encodeData$3({data:Xr,primaryType:eo,types:to});return keccak256(ro)}function encodeData$3({data:Xr,primaryType:eo,types:to}){const ro=[{type:"bytes32"}],no=[hashType({primaryType:eo,types:to})];for(const io of to[eo]){const[oo,ao]=encodeField({types:to,name:io.name,type:io.type,value:Xr[io.name]});ro.push(oo),no.push(ao)}return encodeAbiParameters(ro,no)}function hashType({primaryType:Xr,types:eo}){const to=toHex$1(encodeType$1({primaryType:Xr,types:eo}));return keccak256(to)}function encodeType$1({primaryType:Xr,types:eo}){let to="";const ro=findTypeDependencies({primaryType:Xr,types:eo});ro.delete(Xr);const no=[Xr,...Array.from(ro).sort()];for(const io of no)to+=`${io}(${eo[io].map(({name:oo,type:ao})=>`${ao} ${oo}`).join(",")})`;return to}function findTypeDependencies({primaryType:Xr,types:eo},to=new Set){const ro=Xr.match(/^\w*/u),no=ro==null?void 0:ro[0];if(to.has(no)||eo[no]===void 0)return to;to.add(no);for(const io of eo[no])findTypeDependencies({primaryType:io.type,types:eo},to);return to}function encodeField({types:Xr,name:eo,type:to,value:ro}){if(Xr[to]!==void 0)return[{type:"bytes32"},keccak256(encodeData$3({data:ro,primaryType:to,types:Xr}))];if(to==="bytes")return ro=`0x${(ro.length%2?"0":"")+ro.slice(2)}`,[{type:"bytes32"},keccak256(ro)];if(to==="string")return[{type:"bytes32"},keccak256(toHex$1(ro))];if(to.lastIndexOf("]")===to.length-1){const no=to.slice(0,to.lastIndexOf("[")),io=ro.map(oo=>encodeField({name:eo,type:no,types:Xr,value:oo}));return[{type:"bytes32"},keccak256(encodeAbiParameters(io.map(([oo])=>oo),io.map(([,oo])=>oo)))]}return[{type:to},ro]}function serializeTypedData(Xr){const{domain:eo,message:to,primaryType:ro,types:no}=Xr,io=(so,co)=>{const lo={...co};for(const fo of so){const{name:ho,type:go}=fo;go==="address"&&(lo[ho]=lo[ho].toLowerCase())}return lo},oo=no.EIP712Domain?eo?io(no.EIP712Domain,eo):{}:{},ao=(()=>{if(ro!=="EIP712Domain")return io(no[ro],to)})();return stringify$4({domain:oo,message:ao,primaryType:ro,types:no})}function validateTypedData$1(Xr){const{domain:eo,message:to,primaryType:ro,types:no}=Xr,io=(oo,ao)=>{for(const so of oo){const{name:co,type:lo}=so,fo=ao[co],ho=lo.match(integerRegex);if(ho&&(typeof fo=="number"||typeof fo=="bigint")){const[vo,wo,Eo]=ho;numberToHex(fo,{signed:wo==="int",size:Number.parseInt(Eo)/8})}if(lo==="address"&&typeof fo=="string"&&!isAddress(fo))throw new InvalidAddressError({address:fo});const go=lo.match(bytesRegex);if(go){const[vo,wo]=go;if(wo&&size$1(fo)!==Number.parseInt(wo))throw new BytesSizeMismatchError({expectedSize:Number.parseInt(wo),givenSize:size$1(fo)})}const yo=no[lo];yo&&(validateReference(lo),io(yo,fo))}};if(no.EIP712Domain&&eo&&io(no.EIP712Domain,eo),ro!=="EIP712Domain")if(no[ro])io(no[ro],to);else throw new InvalidPrimaryTypeError({primaryType:ro,types:no})}function getTypesForEIP712Domain({domain:Xr}){return[typeof(Xr==null?void 0:Xr.name)=="string"&&{name:"name",type:"string"},(Xr==null?void 0:Xr.version)&&{name:"version",type:"string"},typeof(Xr==null?void 0:Xr.chainId)=="number"&&{name:"chainId",type:"uint256"},(Xr==null?void 0:Xr.verifyingContract)&&{name:"verifyingContract",type:"address"},(Xr==null?void 0:Xr.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function validateReference(Xr){if(Xr==="address"||Xr==="bool"||Xr==="string"||Xr.startsWith("bytes")||Xr.startsWith("uint")||Xr.startsWith("int"))throw new InvalidStructTypeError({type:Xr})}function encodePacked(Xr,eo){if(Xr.length!==eo.length)throw new AbiEncodingLengthMismatchError({expectedLength:Xr.length,givenLength:eo.length});const to=[];for(let ro=0;roformatLog(to)):null,to:Xr.to?Xr.to:null,transactionIndex:Xr.transactionIndex?hexToNumber$2(Xr.transactionIndex):null,status:Xr.status?receiptStatuses[Xr.status]:null,type:Xr.type?transactionType[Xr.type]||Xr.type:null};return Xr.blobGasPrice&&(eo.blobGasPrice=BigInt(Xr.blobGasPrice)),Xr.blobGasUsed&&(eo.blobGasUsed=BigInt(Xr.blobGasUsed)),eo}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt),presignMessagePrefix=`Ethereum Signed Message: -`;function toPrefixedMessage(Xr){const eo=typeof Xr=="string"?stringToHex(Xr):typeof Xr.raw=="string"?Xr.raw:bytesToHex$2(Xr.raw),to=stringToHex(`${presignMessagePrefix}${size$1(eo)}`);return concat$1([to,eo])}function hashMessage(Xr,eo){return keccak256(toPrefixedMessage(Xr),eo)}const erc6492MagicBytes="0x6492649264926492649264926492649264926492649264926492649264926492";function isErc6492Signature(Xr){return sliceHex(Xr,-32)===erc6492MagicBytes}function serializeErc6492Signature(Xr){const{address:eo,data:to,signature:ro,to:no="hex"}=Xr,io=concatHex([encodeAbiParameters([{type:"address"},{type:"bytes"},{type:"bytes"}],[eo,to,ro]),erc6492MagicBytes]);return no==="hex"?io:hexToBytes$3(io)}function assertTransactionEIP7702(Xr){const{authorizationList:eo}=Xr;if(eo)for(const to of eo){const{contractAddress:ro,chainId:no}=to;if(!isAddress(ro))throw new InvalidAddressError({address:ro});if(no<0)throw new InvalidChainIdError({chainId:no})}assertTransactionEIP1559(Xr)}function assertTransactionEIP4844(Xr){const{blobVersionedHashes:eo}=Xr;if(eo){if(eo.length===0)throw new EmptyBlobError;for(const to of eo){const ro=size$1(to),no=hexToNumber$2(slice(to,0,1));if(ro!==32)throw new InvalidVersionedHashSizeError({hash:to,size:ro});if(no!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:to,version:no})}}assertTransactionEIP1559(Xr)}function assertTransactionEIP1559(Xr){const{chainId:eo,maxPriorityFeePerGas:to,maxFeePerGas:ro,to:no}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(no&&!isAddress(no))throw new InvalidAddressError({address:no});if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro});if(to&&ro&&to>ro)throw new TipAboveFeeCapError({maxFeePerGas:ro,maxPriorityFeePerGas:to})}function assertTransactionEIP2930(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(to||no)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro})}function assertTransactionLegacy(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io}=Xr;if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(typeof eo<"u"&&eo<=0)throw new InvalidChainIdError({chainId:eo});if(to||no)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro})}function serializeAuthorizationList(Xr){if(!Xr||Xr.length===0)return[];const eo=[];for(const to of Xr){const{contractAddress:ro,chainId:no,nonce:io,...oo}=to;eo.push([no?toHex$1(no):"0x",ro,io?toHex$1(io):"0x",...toYParitySignatureArray({},oo)])}return eo}function serializeAccessList(Xr){if(!Xr||Xr.length===0)return[];const eo=[];for(let to=0;to"u"||typeof go>"u")){const Ao=typeof Xr.blobs[0]=="string"?Xr.blobs:Xr.blobs.map(Mo=>bytesToHex$2(Mo)),Po=Xr.kzg,jo=blobsToCommitments({blobs:Ao,kzg:Po});if(typeof ho>"u"&&(ho=commitmentsToVersionedHashes({commitments:jo})),typeof go>"u"){const Mo=blobsToProofs({blobs:Ao,commitments:jo,kzg:Po});go=toBlobSidecars({blobs:Ao,commitments:jo,proofs:Mo})}}const yo=serializeAccessList(lo),vo=[toHex$1(to),no?toHex$1(no):"0x",co?toHex$1(co):"0x",so?toHex$1(so):"0x",ro?toHex$1(ro):"0x",io??"0x",oo?toHex$1(oo):"0x",fo??"0x",yo,ao?toHex$1(ao):"0x",ho??[],...toYParitySignatureArray(Xr,eo)],wo=[],Eo=[],ko=[];if(go)for(let Ao=0;Ao{if(eo.v>=35n)return(eo.v-35n)/2n>0?eo.v:27n+(eo.v===35n?0n:1n);if(to>0)return BigInt(to*2)+BigInt(35n+eo.v-27n);const go=27n+(eo.v===27n?0n:1n);if(eo.v!==go)throw new InvalidLegacyVError({v:eo.v});return go})(),fo=trim$1(eo.r),ho=trim$1(eo.s);co=[...co,toHex$1(lo),fo==="0x00"?"0x":fo,ho==="0x00"?"0x":ho]}else to>0&&(co=[...co,toHex$1(to),"0x","0x"]);return toRlp(co)}function toYParitySignatureArray(Xr,eo){const to=eo??Xr,{v:ro,yParity:no}=to;if(typeof to.r>"u")return[];if(typeof to.s>"u")return[];if(typeof ro>"u"&&typeof no>"u")return[];const io=trim$1(to.r),oo=trim$1(to.s);return[typeof no=="number"?no?toHex$1(1):"0x":ro===0n?"0x":ro===1n?toHex$1(1):ro===27n?"0x":toHex$1(1),io==="0x00"?"0x":io,oo==="0x00"?"0x":oo]}class InvalidDecimalNumberError extends BaseError{constructor({value:eo}){super(`Number \`${eo}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function parseUnits(Xr,eo){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(Xr))throw new InvalidDecimalNumberError({value:Xr});let[to,ro="0"]=Xr.split(".");const no=to.startsWith("-");if(no&&(to=to.slice(1)),ro=ro.replace(/(0+)$/,""),eo===0)Math.round(+`.${ro}`)===1&&(to=`${BigInt(to)+1n}`),ro="";else if(ro.length>eo){const[io,oo,ao]=[ro.slice(0,eo-1),ro.slice(eo-1,eo),ro.slice(eo)],so=Math.round(+`${oo}.${ao}`);so>9?ro=`${BigInt(io)+BigInt(1)}0`.padStart(io.length+1,"0"):ro=`${io}${so}`,ro.length>eo&&(ro=ro.slice(1),to=`${BigInt(to)+1n}`),ro=ro.slice(0,eo)}else ro=ro.padEnd(eo,"0");return BigInt(`${no?"-":""}${to}${ro}`)}function parseEther$1(Xr,eo="wei"){return parseUnits(Xr,etherUnits[eo])}function formatStorageProof(Xr){return Xr.map(eo=>({...eo,value:BigInt(eo.value)}))}function formatProof(Xr){return{...Xr,balance:Xr.balance?BigInt(Xr.balance):void 0,nonce:Xr.nonce?hexToNumber$2(Xr.nonce):void 0,storageProof:Xr.storageProof?formatStorageProof(Xr.storageProof):void 0}}async function getProof(Xr,{address:eo,blockNumber:to,blockTag:ro,storageKeys:no}){const io=ro??"latest",oo=to!==void 0?numberToHex(to):void 0,ao=await Xr.request({method:"eth_getProof",params:[eo,no,oo||io]});return formatProof(ao)}async function getStorageAt(Xr,{address:eo,blockNumber:to,blockTag:ro="latest",slot:no}){const io=to!==void 0?numberToHex(to):void 0;return await Xr.request({method:"eth_getStorageAt",params:[eo,no,io||ro]})}async function getTransaction(Xr,{blockHash:eo,blockNumber:to,blockTag:ro,hash:no,index:io}){var lo,fo,ho;const oo=ro||"latest",ao=to!==void 0?numberToHex(to):void 0;let so=null;if(no?so=await Xr.request({method:"eth_getTransactionByHash",params:[no]},{dedupe:!0}):eo?so=await Xr.request({method:"eth_getTransactionByBlockHashAndIndex",params:[eo,numberToHex(io)]},{dedupe:!0}):(ao||oo)&&(so=await Xr.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[ao||oo,numberToHex(io)]},{dedupe:!!ao})),!so)throw new TransactionNotFoundError({blockHash:eo,blockNumber:to,blockTag:oo,hash:no,index:io});return(((ho=(fo=(lo=Xr.chain)==null?void 0:lo.formatters)==null?void 0:fo.transaction)==null?void 0:ho.format)||formatTransaction)(so)}async function getTransactionConfirmations(Xr,{hash:eo,transactionReceipt:to}){const[ro,no]=await Promise.all([getAction(Xr,getBlockNumber,"getBlockNumber")({}),eo?getAction(Xr,getTransaction,"getTransaction")({hash:eo}):void 0]),io=(to==null?void 0:to.blockNumber)||(no==null?void 0:no.blockNumber);return io?ro-io+1n:0n}async function getTransactionReceipt(Xr,{hash:eo}){var no,io,oo;const to=await Xr.request({method:"eth_getTransactionReceipt",params:[eo]},{dedupe:!0});if(!to)throw new TransactionReceiptNotFoundError({hash:eo});return(((oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionReceipt)==null?void 0:oo.format)||formatTransactionReceipt)(to)}async function multicall(Xr,eo){var wo;const{allowFailure:to=!0,batchSize:ro,blockNumber:no,blockTag:io,multicallAddress:oo,stateOverride:ao}=eo,so=eo.contracts,co=ro??(typeof((wo=Xr.batch)==null?void 0:wo.multicall)=="object"&&Xr.batch.multicall.batchSize||1024);let lo=oo;if(!lo){if(!Xr.chain)throw new Error("client chain not configured. multicallAddress is required.");lo=getChainContractAddress({blockNumber:no,chain:Xr.chain,contract:"multicall3"})}const fo=[[]];let ho=0,go=0;for(let Eo=0;Eo0&&go>co&&fo[ho].length>0&&(ho++,go=(Mo.length-2)/2,fo[ho]=[]),fo[ho]=[...fo[ho],{allowFailure:!0,callData:Mo,target:Ao}]}catch(Mo){const No=getContractError(Mo,{abi:ko,address:Ao,args:Po,docsPath:"/docs/contract/multicall",functionName:jo});if(!to)throw No;fo[ho]=[...fo[ho],{allowFailure:!0,callData:"0x",target:Ao}]}}const yo=await Promise.allSettled(fo.map(Eo=>getAction(Xr,readContract,"readContract")({abi:multicall3Abi,address:lo,args:[Eo],blockNumber:no,blockTag:io,functionName:"aggregate3",stateOverride:ao}))),vo=[];for(let Eo=0;Eo{if(no===0||no===1)return no;if(ro&&(ro===27n||ro===28n||ro>=35n))return ro%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),oo=`0x${new secp256k1$2.Signature(hexToBigInt(Xr),hexToBigInt(eo)).toCompactHex()}${io===0?"1b":"1c"}`;return to==="hex"?oo:hexToBytes$3(oo)}async function verifyHash(Xr,eo){var fo,ho,go;const{address:to,factory:ro,factoryData:no,hash:io,signature:oo,universalSignatureVerifierAddress:ao=(go=(ho=(fo=Xr.chain)==null?void 0:fo.contracts)==null?void 0:ho.universalSignatureVerifier)==null?void 0:go.address,...so}=eo,co=isHex$4(oo)?oo:typeof oo=="object"&&"r"in oo&&"s"in oo?serializeSignature(oo):bytesToHex$2(oo),lo=await(async()=>!ro&&!no||isErc6492Signature(co)?co:serializeErc6492Signature({address:ro,data:no,signature:co}))();try{const yo=ao?{to:ao,data:encodeFunctionData({abi:universalSignatureValidatorAbi,functionName:"isValidSig",args:[to,io,lo]}),...so}:{data:encodeDeployData({abi:universalSignatureValidatorAbi,args:[to,io,lo],bytecode:universalSignatureValidatorByteCode}),...so},{data:vo}=await getAction(Xr,call,"call")(yo);return hexToBool(vo??"0x0")}catch(yo){try{if(isAddressEqual(getAddress$1(to),await recoverAddress({hash:io,signature:oo})))return!0}catch{}if(yo instanceof CallExecutionError)return!1;throw yo}}async function verifyMessage(Xr,{address:eo,message:to,factory:ro,factoryData:no,signature:io,...oo}){const ao=hashMessage(to);return verifyHash(Xr,{address:eo,factory:ro,factoryData:no,hash:ao,signature:io,...oo})}async function verifyTypedData(Xr,eo){const{address:to,factory:ro,factoryData:no,signature:io,message:oo,primaryType:ao,types:so,domain:co,...lo}=eo,fo=hashTypedData({message:oo,primaryType:ao,types:so,domain:co});return verifyHash(Xr,{address:to,factory:ro,factoryData:no,hash:fo,signature:io,...lo})}function watchBlockNumber(Xr,{emitOnBegin:eo=!1,emitMissed:to=!1,onBlockNumber:ro,onError:no,poll:io,pollingInterval:oo=Xr.pollingInterval}){const ao=typeof io<"u"?io:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket");let so;return ao?(()=>{const fo=stringify$4(["watchBlockNumber",Xr.uid,eo,to,oo]);return observe(fo,{onBlockNumber:ro,onError:no},ho=>poll$1(async()=>{var go;try{const yo=await getAction(Xr,getBlockNumber,"getBlockNumber")({cacheTime:0});if(so){if(yo===so)return;if(yo-so>1&&to)for(let vo=so+1n;voso)&&(ho.onBlockNumber(yo,so),so=yo)}catch(yo){(go=ho.onError)==null||go.call(ho,yo)}},{emitOnBegin:eo,interval:oo}))})():(()=>{const fo=stringify$4(["watchBlockNumber",Xr.uid,eo,to]);return observe(fo,{onBlockNumber:ro,onError:no},ho=>{let go=!0,yo=()=>go=!1;return(async()=>{try{const vo=(()=>{if(Xr.transport.type==="fallback"){const Eo=Xr.transport.transports.find(ko=>ko.config.type==="webSocket");return Eo?Eo.value:Xr.transport}return Xr.transport})(),{unsubscribe:wo}=await vo.subscribe({params:["newHeads"],onData(Eo){var Ao;if(!go)return;const ko=hexToBigInt((Ao=Eo.result)==null?void 0:Ao.number);ho.onBlockNumber(ko,so),so=ko},onError(Eo){var ko;(ko=ho.onError)==null||ko.call(ho,Eo)}});yo=wo,go||yo()}catch(vo){no==null||no(vo)}})(),()=>yo()})})()}async function waitForTransactionReceipt(Xr,{confirmations:eo=1,hash:to,onReplaced:ro,pollingInterval:no=Xr.pollingInterval,retryCount:io=6,retryDelay:oo=({count:so})=>~~(1<vo(new WaitForTransactionReceiptTimeoutError({hash:to})),ao):void 0,Eo=observe(so,{onReplaced:ro,resolve:yo,reject:vo},ko=>{const Ao=getAction(Xr,watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:no,async onBlockNumber(Po){const jo=No=>{clearTimeout(wo),Ao(),No(),Eo()};let Mo=Po;if(!ho)try{if(fo){if(eo>1&&(!fo.blockNumber||Mo-fo.blockNumber+1nko.resolve(fo));return}if(co||(ho=!0,await withRetry(async()=>{co=await getAction(Xr,getTransaction,"getTransaction")({hash:to}),co.blockNumber&&(Mo=co.blockNumber)},{delay:oo,retryCount:io}),ho=!1),fo=await getAction(Xr,getTransactionReceipt,"getTransactionReceipt")({hash:to}),eo>1&&(!fo.blockNumber||Mo-fo.blockNumber+1nko.resolve(fo))}catch(No){if(No instanceof TransactionNotFoundError||No instanceof TransactionReceiptNotFoundError){if(!co){ho=!1;return}try{lo=co,ho=!0;const Do=await withRetry(()=>getAction(Xr,getBlock$1,"getBlock")({blockNumber:Mo,includeTransactions:!0}),{delay:oo,retryCount:io,shouldRetry:({error:Lo})=>Lo instanceof BlockNotFoundError});ho=!1;const Fo=Do.transactions.find(({from:Lo,nonce:Bo})=>Lo===lo.from&&Bo===lo.nonce);if(!Fo||(fo=await getAction(Xr,getTransactionReceipt,"getTransactionReceipt")({hash:Fo.hash}),eo>1&&(!fo.blockNumber||Mo-fo.blockNumber+1n{var Lo;(Lo=ko.onReplaced)==null||Lo.call(ko,{reason:Xo,replacedTransaction:lo,transaction:Fo,transactionReceipt:fo}),ko.resolve(fo)})}catch(Do){jo(()=>ko.reject(Do))}}else jo(()=>ko.reject(No))}}})});return go}function watchBlocks(Xr,{blockTag:eo="latest",emitMissed:to=!1,emitOnBegin:ro=!1,onBlock:no,onError:io,includeTransactions:oo,poll:ao,pollingInterval:so=Xr.pollingInterval}){const co=typeof ao<"u"?ao:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"),lo=oo??!1;let fo;return co?(()=>{const yo=stringify$4(["watchBlocks",Xr.uid,eo,to,ro,lo,so]);return observe(yo,{onBlock:no,onError:io},vo=>poll$1(async()=>{var wo;try{const Eo=await getAction(Xr,getBlock$1,"getBlock")({blockTag:eo,includeTransactions:lo});if(Eo.number&&(fo!=null&&fo.number)){if(Eo.number===fo.number)return;if(Eo.number-fo.number>1&&to)for(let ko=(fo==null?void 0:fo.number)+1n;kofo.number)&&(vo.onBlock(Eo,fo),fo=Eo)}catch(Eo){(wo=vo.onError)==null||wo.call(vo,Eo)}},{emitOnBegin:ro,interval:so}))})():(()=>{let yo=!0,vo=!0,wo=()=>yo=!1;return(async()=>{try{ro&&getAction(Xr,getBlock$1,"getBlock")({blockTag:eo,includeTransactions:lo}).then(Ao=>{yo&&vo&&(no(Ao,void 0),vo=!1)});const Eo=(()=>{if(Xr.transport.type==="fallback"){const Ao=Xr.transport.transports.find(Po=>Po.config.type==="webSocket");return Ao?Ao.value:Xr.transport}return Xr.transport})(),{unsubscribe:ko}=await Eo.subscribe({params:["newHeads"],onData(Ao){var Mo,No,Do;if(!yo)return;const jo=(((Do=(No=(Mo=Xr.chain)==null?void 0:Mo.formatters)==null?void 0:No.block)==null?void 0:Do.format)||formatBlock)(Ao.result);no(jo,fo),vo=!1,fo=jo},onError(Ao){io==null||io(Ao)}});wo=ko,yo||wo()}catch(Eo){io==null||io(Eo)}})(),()=>wo()})()}function watchEvent(Xr,{address:eo,args:to,batch:ro=!0,event:no,events:io,fromBlock:oo,onError:ao,onLogs:so,poll:co,pollingInterval:lo=Xr.pollingInterval,strict:fo}){const ho=typeof co<"u"?co:typeof oo=="bigint"?!0:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"),go=fo??!1;return ho?(()=>{const wo=stringify$4(["watchEvent",eo,to,ro,Xr.uid,no,lo,oo]);return observe(wo,{onLogs:so,onError:ao},Eo=>{let ko;oo!==void 0&&(ko=oo-1n);let Ao,Po=!1;const jo=poll$1(async()=>{var Mo;if(!Po){try{Ao=await getAction(Xr,createEventFilter,"createEventFilter")({address:eo,args:to,event:no,events:io,strict:go,fromBlock:oo})}catch{}Po=!0;return}try{let No;if(Ao)No=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:Ao});else{const Do=await getAction(Xr,getBlockNumber,"getBlockNumber")({});ko&&ko!==Do?No=await getAction(Xr,getLogs,"getLogs")({address:eo,args:to,event:no,events:io,fromBlock:ko+1n,toBlock:Do}):No=[],ko=Do}if(No.length===0)return;if(ro)Eo.onLogs(No);else for(const Do of No)Eo.onLogs([Do])}catch(No){Ao&&No instanceof InvalidInputRpcError&&(Po=!1),(Mo=Eo.onError)==null||Mo.call(Eo,No)}},{emitOnBegin:!0,interval:lo});return async()=>{Ao&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:Ao}),jo()}})})():(()=>{let wo=!0,Eo=()=>wo=!1;return(async()=>{try{const ko=(()=>{if(Xr.transport.type==="fallback"){const Mo=Xr.transport.transports.find(No=>No.config.type==="webSocket");return Mo?Mo.value:Xr.transport}return Xr.transport})(),Ao=io??(no?[no]:void 0);let Po=[];Ao&&(Po=[Ao.flatMap(No=>encodeEventTopics({abi:[No],eventName:No.name,args:to}))],no&&(Po=Po[0]));const{unsubscribe:jo}=await ko.subscribe({params:["logs",{address:eo,topics:Po}],onData(Mo){var Do;if(!wo)return;const No=Mo.result;try{const{eventName:Fo,args:Xo}=decodeEventLog({abi:Ao??[],data:No.data,topics:No.topics,strict:go}),Lo=formatLog(No,{args:Xo,eventName:Fo});so([Lo])}catch(Fo){let Xo,Lo;if(Fo instanceof DecodeLogDataMismatch||Fo instanceof DecodeLogTopicsMismatch){if(fo)return;Xo=Fo.abiItem.name,Lo=(Do=Fo.abiItem.inputs)==null?void 0:Do.some(xo=>!("name"in xo&&xo.name))}const Bo=formatLog(No,{args:Lo?[]:{},eventName:Xo});so([Bo])}},onError(Mo){ao==null||ao(Mo)}});Eo=jo,wo||Eo()}catch(ko){ao==null||ao(ko)}})(),()=>Eo()})()}function watchPendingTransactions(Xr,{batch:eo=!0,onError:to,onTransactions:ro,poll:no,pollingInterval:io=Xr.pollingInterval}){return(typeof no<"u"?no:Xr.transport.type!=="webSocket")?(()=>{const co=stringify$4(["watchPendingTransactions",Xr.uid,eo,io]);return observe(co,{onTransactions:ro,onError:to},lo=>{let fo;const ho=poll$1(async()=>{var go;try{if(!fo)try{fo=await getAction(Xr,createPendingTransactionFilter,"createPendingTransactionFilter")({});return}catch(vo){throw ho(),vo}const yo=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:fo});if(yo.length===0)return;if(eo)lo.onTransactions(yo);else for(const vo of yo)lo.onTransactions([vo])}catch(yo){(go=lo.onError)==null||go.call(lo,yo)}},{emitOnBegin:!0,interval:io});return async()=>{fo&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:fo}),ho()}})})():(()=>{let co=!0,lo=()=>co=!1;return(async()=>{try{const{unsubscribe:fo}=await Xr.transport.subscribe({params:["newPendingTransactions"],onData(ho){if(!co)return;const go=ho.result;ro([go])},onError(ho){to==null||to(ho)}});lo=fo,co||lo()}catch(fo){to==null||to(fo)}})(),()=>lo()})()}function parseSiweMessage(Xr){var fo,ho,go;const{scheme:eo,statement:to,...ro}=((fo=Xr.match(prefixRegex))==null?void 0:fo.groups)??{},{chainId:no,expirationTime:io,issuedAt:oo,notBefore:ao,requestId:so,...co}=((ho=Xr.match(suffixRegex))==null?void 0:ho.groups)??{},lo=(go=Xr.split("Resources:")[1])==null?void 0:go.split(` -- `).slice(1);return{...ro,...co,...no?{chainId:Number(no)}:{},...io?{expirationTime:new Date(io)}:{},...oo?{issuedAt:new Date(oo)}:{},...ao?{notBefore:new Date(ao)}:{},...so?{requestId:so}:{},...lo?{resources:lo}:{},...eo?{scheme:eo}:{},...to?{statement:to}:{}}}const prefixRegex=/^(?:(?[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?
0x[a-fA-F0-9]{40})\n\n(?:(?.*)\n\n)?/,suffixRegex=/(?:URI: (?.+))\n(?:Version: (?.+))\n(?:Chain ID: (?\d+))\n(?:Nonce: (?[a-zA-Z0-9]+))\n(?:Issued At: (?.+))(?:\nExpiration Time: (?.+))?(?:\nNot Before: (?.+))?(?:\nRequest ID: (?.+))?/;function validateSiweMessage(Xr){const{address:eo,domain:to,message:ro,nonce:no,scheme:io,time:oo=new Date}=Xr;if(to&&ro.domain!==to||no&&ro.nonce!==no||io&&ro.scheme!==io||ro.expirationTime&&oo>=ro.expirationTime||ro.notBefore&&oocall(Xr,eo),createBlockFilter:()=>createBlockFilter(Xr),createContractEventFilter:eo=>createContractEventFilter(Xr,eo),createEventFilter:eo=>createEventFilter(Xr,eo),createPendingTransactionFilter:()=>createPendingTransactionFilter(Xr),estimateContractGas:eo=>estimateContractGas(Xr,eo),estimateGas:eo=>estimateGas$1(Xr,eo),getBalance:eo=>getBalance(Xr,eo),getBlobBaseFee:()=>getBlobBaseFee(Xr),getBlock:eo=>getBlock$1(Xr,eo),getBlockNumber:eo=>getBlockNumber(Xr,eo),getBlockTransactionCount:eo=>getBlockTransactionCount(Xr,eo),getBytecode:eo=>getCode$1(Xr,eo),getChainId:()=>getChainId$1(Xr),getCode:eo=>getCode$1(Xr,eo),getContractEvents:eo=>getContractEvents(Xr,eo),getEip712Domain:eo=>getEip712Domain$1(Xr,eo),getEnsAddress:eo=>getEnsAddress(Xr,eo),getEnsAvatar:eo=>getEnsAvatar(Xr,eo),getEnsName:eo=>getEnsName(Xr,eo),getEnsResolver:eo=>getEnsResolver(Xr,eo),getEnsText:eo=>getEnsText(Xr,eo),getFeeHistory:eo=>getFeeHistory(Xr,eo),estimateFeesPerGas:eo=>estimateFeesPerGas$1(Xr,eo),getFilterChanges:eo=>getFilterChanges(Xr,eo),getFilterLogs:eo=>getFilterLogs(Xr,eo),getGasPrice:()=>getGasPrice(Xr),getLogs:eo=>getLogs(Xr,eo),getProof:eo=>getProof(Xr,eo),estimateMaxPriorityFeePerGas:eo=>estimateMaxPriorityFeePerGas(Xr,eo),getStorageAt:eo=>getStorageAt(Xr,eo),getTransaction:eo=>getTransaction(Xr,eo),getTransactionConfirmations:eo=>getTransactionConfirmations(Xr,eo),getTransactionCount:eo=>getTransactionCount(Xr,eo),getTransactionReceipt:eo=>getTransactionReceipt(Xr,eo),multicall:eo=>multicall(Xr,eo),prepareTransactionRequest:eo=>prepareTransactionRequest(Xr,eo),readContract:eo=>readContract(Xr,eo),sendRawTransaction:eo=>sendRawTransaction(Xr,eo),simulateContract:eo=>simulateContract(Xr,eo),verifyMessage:eo=>verifyMessage(Xr,eo),verifySiweMessage:eo=>verifySiweMessage(Xr,eo),verifyTypedData:eo=>verifyTypedData(Xr,eo),uninstallFilter:eo=>uninstallFilter(Xr,eo),waitForTransactionReceipt:eo=>waitForTransactionReceipt(Xr,eo),watchBlocks:eo=>watchBlocks(Xr,eo),watchBlockNumber:eo=>watchBlockNumber(Xr,eo),watchContractEvent:eo=>watchContractEvent(Xr,eo),watchEvent:eo=>watchEvent(Xr,eo),watchPendingTransactions:eo=>watchPendingTransactions(Xr,eo)}}function createPublicClient(Xr){const{key:eo="public",name:to="Public Client"}=Xr;return createClient({...Xr,key:eo,name:to,type:"publicClient"}).extend(publicActions)}function deployContract(Xr,eo){const{abi:to,args:ro,bytecode:no,...io}=eo,oo=encodeDeployData({abi:to,args:ro,bytecode:no});return sendTransaction$1(Xr,{...io,data:oo})}async function getAddresses(Xr){var to;return((to=Xr.account)==null?void 0:to.type)==="local"?[Xr.account.address]:(await Xr.request({method:"eth_accounts"},{dedupe:!0})).map(ro=>checksumAddress(ro))}async function getPermissions(Xr){return await Xr.request({method:"wallet_getPermissions"},{dedupe:!0})}async function requestAddresses(Xr){return(await Xr.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(to=>getAddress$1(to))}async function requestPermissions(Xr,eo){return Xr.request({method:"wallet_requestPermissions",params:[eo]},{retryCount:0})}async function signMessage$3(Xr,{account:eo=Xr.account,message:to}){if(!eo)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const ro=parseAccount(eo);if(ro.signMessage)return ro.signMessage({message:to});const no=typeof to=="string"?stringToHex(to):to.raw instanceof Uint8Array?toHex$1(to.raw):to.raw;return Xr.request({method:"personal_sign",params:[no,ro.address]},{retryCount:0})}async function signTransaction$3(Xr,eo){var co,lo,fo,ho;const{account:to=Xr.account,chain:ro=Xr.chain,...no}=eo;if(!to)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const io=parseAccount(to);assertRequest({account:io,...eo});const oo=await getAction(Xr,getChainId$1,"getChainId")({});ro!==null&&assertCurrentChain({currentChainId:oo,chain:ro});const ao=(ro==null?void 0:ro.formatters)||((co=Xr.chain)==null?void 0:co.formatters),so=((lo=ao==null?void 0:ao.transactionRequest)==null?void 0:lo.format)||formatTransactionRequest;return io.signTransaction?io.signTransaction({...no,chainId:oo},{serializer:(ho=(fo=Xr.chain)==null?void 0:fo.serializers)==null?void 0:ho.transaction}):await Xr.request({method:"eth_signTransaction",params:[{...so(no),chainId:numberToHex(oo),from:io.address}]},{retryCount:0})}async function signTypedData$2(Xr,eo){const{account:to=Xr.account,domain:ro,message:no,primaryType:io}=eo;if(!to)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const oo=parseAccount(to),ao={EIP712Domain:getTypesForEIP712Domain({domain:ro}),...eo.types};if(validateTypedData$1({domain:ro,message:no,primaryType:io,types:ao}),oo.signTypedData)return oo.signTypedData({domain:ro,message:no,primaryType:io,types:ao});const so=serializeTypedData({domain:ro,message:no,primaryType:io,types:ao});return Xr.request({method:"eth_signTypedData_v4",params:[oo.address,so]},{retryCount:0})}async function switchChain(Xr,{id:eo}){await Xr.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(eo)}]},{retryCount:0})}async function watchAsset(Xr,eo){return await Xr.request({method:"wallet_watchAsset",params:eo},{retryCount:0})}function walletActions(Xr){return{addChain:eo=>addChain(Xr,eo),deployContract:eo=>deployContract(Xr,eo),getAddresses:()=>getAddresses(Xr),getChainId:()=>getChainId$1(Xr),getPermissions:()=>getPermissions(Xr),prepareTransactionRequest:eo=>prepareTransactionRequest(Xr,eo),requestAddresses:()=>requestAddresses(Xr),requestPermissions:eo=>requestPermissions(Xr,eo),sendRawTransaction:eo=>sendRawTransaction(Xr,eo),sendTransaction:eo=>sendTransaction$1(Xr,eo),signMessage:eo=>signMessage$3(Xr,eo),signTransaction:eo=>signTransaction$3(Xr,eo),signTypedData:eo=>signTypedData$2(Xr,eo),switchChain:eo=>switchChain(Xr,eo),watchAsset:eo=>watchAsset(Xr,eo),writeContract:eo=>writeContract(Xr,eo)}}function createWalletClient(Xr){const{key:eo="wallet",name:to="Wallet Client",transport:ro}=Xr;return createClient({...Xr,key:eo,name:to,transport:ro,type:"walletClient"}).extend(walletActions)}var ENV$1=(Xr=>(Xr.PROD="prod",Xr.STAGING="staging",Xr.DEV="dev",Xr.LOCAL="local",Xr))(ENV$1||{});const gasPerPubdataDefault=50000n,maxBytecodeSize=maxUint16*32n,formatters$2={block:defineBlock({format(Xr){var to;const eo=(to=Xr.transactions)==null?void 0:to.map(ro=>{var io;if(typeof ro=="string")return ro;const no=(io=formatters$2.transaction)==null?void 0:io.format(ro);return no.typeHex==="0x71"?no.type="eip712":no.typeHex==="0xff"&&(no.type="priority"),no});return{l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTimestamp:Xr.l1BatchTimestamp?hexToBigInt(Xr.l1BatchTimestamp):null,transactions:eo}}}),transaction:defineTransaction({format(Xr){const eo={};return Xr.type==="0x71"?eo.type="eip712":Xr.type==="0xff"&&(eo.type="priority"),{...eo,l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTxIndex:Xr.l1BatchTxIndex?hexToBigInt(Xr.l1BatchTxIndex):null}}}),transactionReceipt:defineTransactionReceipt({format(Xr){return{l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTxIndex:Xr.l1BatchTxIndex?hexToBigInt(Xr.l1BatchTxIndex):null,logs:Xr.logs.map(eo=>({...formatLog(eo),l1BatchNumber:eo.l1BatchNumber?hexToBigInt(eo.l1BatchNumber):null,transactionLogIndex:hexToNumber$2(eo.transactionLogIndex),logType:eo.logType})),l2ToL1Logs:Xr.l2ToL1Logs.map(eo=>({blockNumber:hexToBigInt(eo.blockHash),blockHash:eo.blockHash,l1BatchNumber:hexToBigInt(eo.l1BatchNumber),transactionIndex:hexToBigInt(eo.transactionIndex),shardId:hexToBigInt(eo.shardId),isService:eo.isService,sender:eo.sender,key:eo.key,value:eo.value,transactionHash:eo.transactionHash,logIndex:hexToBigInt(eo.logIndex)}))}}}),transactionRequest:defineTransactionRequest({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format(Xr){return Xr.gasPerPubdata||Xr.paymaster&&Xr.paymasterInput||Xr.factoryDeps||Xr.customSignature?{eip712Meta:{...Xr.gasPerPubdata?{gasPerPubdata:toHex$1(Xr.gasPerPubdata)}:{gasPerPubdata:toHex$1(gasPerPubdataDefault)},...Xr.paymaster&&Xr.paymasterInput?{paymasterParams:{paymaster:Xr.paymaster,paymasterInput:Array.from(hexToBytes$3(Xr.paymasterInput))}}:{},...Xr.factoryDeps?{factoryDeps:Xr.factoryDeps.map(eo=>Array.from(hexToBytes$3(eo)))}:{},...Xr.customSignature?{customSignature:Array.from(hexToBytes$3(Xr.customSignature))}:{}},type:"0x71"}:{}}})};class InvalidEip712TransactionError extends BaseError{constructor(){super(["Transaction is not an EIP712 transaction.","","Transaction must:",' - include `type: "eip712"`'," - include one of the following: `customSignature`, `paymaster`, `paymasterInput`, `gasPerPubdata`, `factoryDeps`"].join(` -`),{name:"InvalidEip712TransactionError"})}}function isEIP712Transaction(Xr){return!!(Xr.type==="eip712"||"customSignature"in Xr&&Xr.customSignature||"paymaster"in Xr&&Xr.paymaster||"paymasterInput"in Xr&&Xr.paymasterInput||"gasPerPubdata"in Xr&&typeof Xr.gasPerPubdata=="bigint"||"factoryDeps"in Xr&&Xr.factoryDeps)}function assertEip712Transaction(Xr){const{chainId:eo,to,from:ro,paymaster:no,paymasterInput:io}=Xr;if(!isEIP712Transaction(Xr))throw new InvalidEip712TransactionError;if(!eo||eo<=0)throw new InvalidChainIdError({chainId:eo});if(to&&!isAddress(to))throw new InvalidAddressError({address:to});if(ro&&!isAddress(ro))throw new InvalidAddressError({address:ro});if(no&&!isAddress(no))throw new InvalidAddressError({address:no});if(no&&!io)throw new BaseError("`paymasterInput` must be provided when `paymaster` is defined");if(!no&&io)throw new BaseError("`paymaster` must be provided when `paymasterInput` is defined")}function serializeTransaction$3(Xr,eo){return isEIP712Transaction(Xr)?serializeTransactionEIP712(Xr):serializeTransaction$4(Xr,eo)}const serializers$2={transaction:serializeTransaction$3};function serializeTransactionEIP712(Xr){const{chainId:eo,gas:to,nonce:ro,to:no,from:io,value:oo,maxFeePerGas:ao,maxPriorityFeePerGas:so,customSignature:co,factoryDeps:lo,paymaster:fo,paymasterInput:ho,gasPerPubdata:go,data:yo}=Xr;assertEip712Transaction(Xr);const vo=[ro?toHex$1(ro):"0x",so?toHex$1(so):"0x",ao?toHex$1(ao):"0x",to?toHex$1(to):"0x",no??"0x",oo?toHex$1(oo):"0x",yo??"0x0",toHex$1(eo),toHex$1(""),toHex$1(""),toHex$1(eo),io??"0x",toHex$1(go||gasPerPubdataDefault),lo??[],co??"0x",fo&&ho?[fo,ho]:[]];return concatHex(["0x71",toRlp(vo)])}class BytecodeLengthExceedsMaxSizeError extends BaseError{constructor({givenLength:eo,maxBytecodeSize:to}){super(`Bytecode cannot be longer than ${to} bytes. Given length: ${eo}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class BytecodeLengthInWordsMustBeOddError extends BaseError{constructor({givenLengthInWords:eo}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${eo}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class BytecodeLengthMustBeDivisibleBy32Error extends BaseError{constructor({givenLength:eo}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${eo}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function hashBytecode(Xr){const eo=toBytes$1(Xr);if(eo.length%32!==0)throw new BytecodeLengthMustBeDivisibleBy32Error({givenLength:eo.length});if(eo.length>maxBytecodeSize)throw new BytecodeLengthExceedsMaxSizeError({givenLength:eo.length,maxBytecodeSize});const to=sha256$6(eo),ro=toBytes$1(to),no=eo.length/32;if(no%2===0)throw new BytecodeLengthInWordsMustBeOddError({givenLengthInWords:no});const io=toBytes$1(no),oo=pad$1(io,{size:2}),ao=new Uint8Array([1,0]);return ro.set(ao,0),ro.set(oo,2),ro}const getEip712Domain=Xr=>{assertEip712Transaction(Xr);const eo=transactionToMessage(Xr);return{domain:{name:"zkSync",version:"2",chainId:Xr.chainId},types:{Transaction:[{name:"txType",type:"uint256"},{name:"from",type:"uint256"},{name:"to",type:"uint256"},{name:"gasLimit",type:"uint256"},{name:"gasPerPubdataByteLimit",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymaster",type:"uint256"},{name:"nonce",type:"uint256"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"factoryDeps",type:"bytes32[]"},{name:"paymasterInput",type:"bytes"}]},primaryType:"Transaction",message:eo}};function transactionToMessage(Xr){const{gas:eo,nonce:to,to:ro,from:no,value:io,maxFeePerGas:oo,maxPriorityFeePerGas:ao,factoryDeps:so,paymaster:co,paymasterInput:lo,gasPerPubdata:fo,data:ho}=Xr;return{txType:113n,from:BigInt(no),to:ro?BigInt(ro):0n,gasLimit:eo??0n,gasPerPubdataByteLimit:fo??gasPerPubdataDefault,maxFeePerGas:oo??0n,maxPriorityFeePerGas:ao??0n,paymaster:co?BigInt(co):0n,nonce:to?BigInt(to):0n,value:io??0n,data:ho||"0x0",factoryDeps:(so==null?void 0:so.map(go=>toHex$1(hashBytecode(go))))??[],paymasterInput:lo||"0x"}}const chainConfig$3={formatters:formatters$2,serializers:serializers$2,custom:{getEip712Domain}},abstractTestnet=defineChain({...chainConfig$3,id:11124,name:"Abstract Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://api.testnet.abs.xyz"]}},blockExplorers:{default:{name:"Abstract Block Explorer",url:"https://explorer.testnet.abs.xyz"}},testnet:!0,contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963",blockCreated:358349},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:431682}}}),acala=defineChain({id:787,name:"Acala",network:"acala",nativeCurrency:{name:"Acala",symbol:"ACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]}},blockExplorers:{default:{name:"Acala Blockscout",url:"https://blockscout.acala.network",apiUrl:"https://blockscout.acala.network/api"}},testnet:!1}),alienx=defineChain({id:10241024,name:"AlienX Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://explorer.alienxchain.io"}},testnet:!1}),alienxHalTestnet=defineChain({id:10241025,name:"ALIENX Hal Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://hal-rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://hal-explorer.alienxchain.io"}},testnet:!0}),contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters$1={block:defineBlock({format(Xr){var to;return{transactions:(to=Xr.transactions)==null?void 0:to.map(ro=>{if(typeof ro=="string")return ro;const no=formatTransaction(ro);return no.typeHex==="0x7e"&&(no.isSystemTx=ro.isSystemTx,no.mint=ro.mint?hexToBigInt(ro.mint):void 0,no.sourceHash=ro.sourceHash,no.type="deposit"),no}),stateRoot:Xr.stateRoot}}}),transaction:defineTransaction({format(Xr){const eo={};return Xr.type==="0x7e"&&(eo.isSystemTx=Xr.isSystemTx,eo.mint=Xr.mint?hexToBigInt(Xr.mint):void 0,eo.sourceHash=Xr.sourceHash,eo.type="deposit"),eo}}),transactionReceipt:defineTransactionReceipt({format(Xr){return{l1GasPrice:Xr.l1GasPrice?hexToBigInt(Xr.l1GasPrice):null,l1GasUsed:Xr.l1GasUsed?hexToBigInt(Xr.l1GasUsed):null,l1Fee:Xr.l1Fee?hexToBigInt(Xr.l1Fee):null,l1FeeScalar:Xr.l1FeeScalar?Number(Xr.l1FeeScalar):null}}})};function serializeTransaction$2(Xr,eo){return isDeposit(Xr)?serializeTransactionDeposit(Xr):serializeTransaction$4(Xr,eo)}const serializers$1={transaction:serializeTransaction$2};function serializeTransactionDeposit(Xr){assertTransactionDeposit(Xr);const{sourceHash:eo,data:to,from:ro,gas:no,isSystemTx:io,mint:oo,to:ao,value:so}=Xr,co=[eo,ro,ao??"0x",oo?toHex$1(oo):"0x",so?toHex$1(so):"0x",no?toHex$1(no):"0x",io?"0x1":"0x",to??"0x"];return concatHex(["0x7e",toRlp(co)])}function isDeposit(Xr){return Xr.type==="deposit"||typeof Xr.sourceHash<"u"}function assertTransactionDeposit(Xr){const{from:eo,to}=Xr;if(eo&&!isAddress(eo))throw new InvalidAddressError({address:eo});if(to&&!isAddress(to))throw new InvalidAddressError({address:to})}const chainConfig$2={contracts,formatters:formatters$1,serializers:serializers$1},sourceId$J=1,ancient8=defineChain({...chainConfig$2,id:888888888,name:"Ancient8",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 explorer",url:"https://scan.ancient8.gg",apiUrl:"https://scan.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$J]:{address:"0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"}},portal:{[sourceId$J]:{address:"0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",blockCreated:19070571}},l1StandardBridge:{[sourceId$J]:{address:"0xd5e3eDf5b68135D559D572E26bF863FBC1950033",blockCreated:19070571}}},sourceId:sourceId$J}),sourceId$I=11155111,ancient8Sepolia=defineChain({...chainConfig$2,id:28122024,name:"Ancient8 Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpcv2-testnet.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 Celestia Testnet explorer",url:"https://scanv2-testnet.ancient8.gg",apiUrl:"https://scanv2-testnet.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$I]:{address:"0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"}},portal:{[sourceId$I]:{address:"0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",blockCreated:4972908}},l1StandardBridge:{[sourceId$I]:{address:"0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",blockCreated:4972908}}},sourceId:sourceId$I}),anvil=defineChain({id:31337,name:"Anvil",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$H=42161,apeChain=defineChain({id:33139,name:"Ape Chain",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.apechain.com/http"],webSocket:["wss://rpc.apechain.com/ws"]}},blockExplorers:{default:{name:"Apescan",url:"https://apescan.io",apiUrl:"https://api.apescan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:20889}},sourceId:sourceId$H}),apexTestnet=defineChain({id:3993,name:"APEX Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.apexlayer.xyz"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-testnet.apexlayer.xyz",apiUrl:"https://exp-testnet.apexlayer.xyz/api"}},contracts:{multicall3:{address:"0xf7642be33a6b18D16a995657adb5a68CD0438aE2",blockCreated:283775}},testnet:!0}),arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),arbitrumGoerli=defineChain({id:421613,name:"Arbitrum Goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0}),arbitrumNova=defineChain({id:42170,name:"Arbitrum Nova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://nova.arbiscan.io",apiUrl:"https://api-nova.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}}}),arbitrumSepolia=defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),areonNetwork=defineChain({id:463,name:"Areon Network",nativeCurrency:{decimals:18,name:"AREA",symbol:"AREA"},rpcUrls:{default:{http:["https://mainnet-rpc.areon.network"],webSocket:["wss://mainnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:353286}},testnet:!1}),areonNetworkTestnet=defineChain({id:462,name:"Areon Network Testnet",nativeCurrency:{decimals:18,name:"TAREA",symbol:"TAREA"},rpcUrls:{default:{http:["https://testnet-rpc.areon.network"],webSocket:["wss://testnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},testnet:!0}),artelaTestnet=defineChain({id:11822,name:"Artela Testnet",nativeCurrency:{name:"ART",symbol:"ART",decimals:18},rpcUrls:{default:{http:["https://betanet-rpc1.artela.network"]}},blockExplorers:{default:{name:"Artela",url:"https://betanet-scan.artela.network",apiUrl:"https://betanet-scan.artela.network/api"}},contracts:{multicall3:{address:"0xd07c8635f76e8745Ee7092fbb6e8fbc5FeF09DD7",blockCreated:7001871}},testnet:!0}),assetChain=defineChain({id:42420,name:"AssetChain Mainnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://mainnet-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Explorer",url:"https://scan.assetchain.org",apiUrl:"https://scan.assetchain.org/api"}},testnet:!1,contracts:{}}),assetChainTestnet=defineChain({id:42421,name:"AssetChain Testnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://enugu-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Testnet Explorer",url:"https://scan-testnet.assetchain.org",apiUrl:"https://scan-testnet.assetchain.org/api"}},testnet:!0,contracts:{multicall3:{address:"0x989F832D35988cb5e3eB001Fa2Fe789469EC31Ea",blockCreated:17177}}}),astar=defineChain({id:592,name:"Astar",network:"astar-mainnet",nativeCurrency:{name:"Astar",symbol:"ASTR",decimals:18},rpcUrls:{default:{http:["https://astar.api.onfinality.io/public"]}},blockExplorers:{default:{name:"Astar Subscan",url:"https://astar.subscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:761794}},testnet:!1}),astarZkEVM=defineChain({id:3776,name:"Astar zkEVM",network:"AstarZkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-zkevm.astar.network"]}},blockExplorers:{default:{name:"Astar zkEVM Explorer",url:"https://astar-zkevm.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:93528}},testnet:!1}),astarZkyoto=defineChain({id:6038361,name:"Astar zkEVM Testnet zKyoto",network:"zKyoto",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/zkyoto"]}},blockExplorers:{default:{name:"zKyoto Explorer",url:"https://zkyoto.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:196153}},testnet:!0}),atletaOlympia=defineChain({id:2340,name:"Atleta Olympia",nativeCurrency:{decimals:18,name:"Atla",symbol:"ATLA"},rpcUrls:{default:{http:["https://testnet-rpc.atleta.network:9944","https://testnet-rpc.atleta.network"],ws:["wss://testnet-rpc.atleta.network:9944"]}},blockExplorers:{default:{name:"Atleta Olympia Explorer",url:"https://blockscout.atleta.network",apiUrl:"https://blockscout.atleta.network/api"}},contracts:{multicall3:{address:"0x1472ec6392180fb84F345d2455bCC75B26577115",blockCreated:1076473}},testnet:!0}),aurora=defineChain({id:1313161554,name:"Aurora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://aurorascan.dev",apiUrl:"https://aurorascan.dev/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:62907816}}}),auroraTestnet=defineChain({id:1313161555,name:"Aurora Testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://testnet.aurorascan.dev",apiUrl:"https://testnet.aurorascan.dev/api"}},testnet:!0}),auroria=defineChain({id:205205,name:"Auroria Testnet",network:"auroria",nativeCurrency:{name:"Auroria Stratis",symbol:"tSTRAX",decimals:18},rpcUrls:{default:{http:["https://auroria.rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Auroria Testnet Explorer",url:"https://auroria.explorer.stratisevm.com"}},testnet:!0}),avalanche=defineChain({id:43114,name:"Avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),avalancheFuji=defineChain({id:43113,name:"Avalanche Fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://testnet.snowtrace.io",apiUrl:"https://api-testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0}),sourceId$G=8453,b3=defineChain({id:8333,name:"B3",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.b3.fun"}},sourceId:sourceId$G}),sourceId$F=168587773,b3Sepolia=defineChain({id:1993,name:"B3 Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.b3.fun"}},testnet:!0,sourceId:sourceId$F}),bahamut=defineChain({id:5165,network:"bahamut",name:"Bahamut",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.bahamut.io","https://bahamut-rpc.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut-rpc.publicnode.com","wss://ws2.sahara.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://www.ftnscan.com",apiUrl:"https://www.ftnscan.com/api"}}}),sourceId$E=1,base$6=defineChain({...chainConfig$2,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$E]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[sourceId$E]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[sourceId$E]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[sourceId$E]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:sourceId$E}),sourceId$D=5,baseGoerli=defineChain({...chainConfig$2,id:84531,name:"Base Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org",apiUrl:"https://goerli.basescan.org/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$D]:{address:"0x2A35891ff30313CcFa6CE88dcf3858bb075A2298"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1376988},portal:{[sourceId$D]:{address:"0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA"}},l1StandardBridge:{[sourceId$D]:{address:"0xfA6D8Ee5BE770F84FC001D098C4bD604Fe01284a"}}},testnet:!0,sourceId:sourceId$D}),sourceId$C=11155111,baseSepolia$1=defineChain({...chainConfig$2,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$C]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[sourceId$C]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[sourceId$C]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[sourceId$C]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:sourceId$C}),beam=defineChain({id:4337,name:"Beam",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc"],webSocket:["wss://build.onbeam.com/ws"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets.avax.network/beam"}},contracts:{multicall3:{address:"0x4956f15efdc3dc16645e90cc356eafa65ffc65ec",blockCreated:1}}}),beamTestnet=defineChain({id:13337,name:"Beam Testnet",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc/testnet"],webSocket:["wss://build.onbeam.com/ws/testnet"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets-test.avax.network/beam"}},contracts:{multicall3:{address:"0x9bf49b704ee2a095b95c1f2d4eb9010510c41c9e",blockCreated:3}},testnet:!0}),bearNetworkChainMainnet=defineChain({id:641230,name:"Bear Network Chain Mainnet",nativeCurrency:{decimals:18,name:"BearNetworkChain",symbol:"BRNKC"},rpcUrls:{default:{http:["https://brnkc-mainnet.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkScan",url:"https://brnkscan.bearnetwork.net",apiUrl:"https://brnkscan.bearnetwork.net/api"}}}),bearNetworkChainTestnet=defineChain({id:751230,name:"Bear Network Chain Testnet",nativeCurrency:{decimals:18,name:"tBRNKC",symbol:"tBRNKC"},rpcUrls:{default:{http:["https://brnkc-test.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkTestScan",url:"https://brnktest-scan.bearnetwork.net",apiUrl:"https://brnktest-scan.bearnetwork.net/api"}},testnet:!0}),berachainTestnet=defineChain({id:80085,name:"Berachain Artio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),berachainTestnetbArtio=defineChain({id:80084,name:"Berachain bArtio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:109269}},rpcUrls:{default:{http:["https://bartio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain bArtio Beratrail",url:"https://bartio.beratrail.io"}},testnet:!0}),bevmMainnet=defineChain({id:11501,name:"BEVM Mainnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet-1.bevm.io"]}},blockExplorers:{default:{name:"Bevmscan",url:"https://scan-mainnet.bevm.io",apiUrl:"https://scan-mainnet-api.bevm.io/api"}}}),bifrost=defineChain({id:3068,name:"Bifrost Mainnet",nativeCurrency:{name:"BFC",symbol:"BFC",decimals:18},rpcUrls:{default:{http:["https://public-01.mainnet.bifrostnetwork.com/rpc"]}},blockExplorers:{default:{name:"Bifrost Blockscout",url:"https://explorer.mainnet.bifrostnetwork.com"}},testnet:!1}),bitkub=defineChain({id:96,name:"Bitkub",nativeCurrency:{name:"Bitkub",symbol:"KUB",decimals:18},rpcUrls:{default:{http:["https://rpc.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Mainnet Explorer",url:"https://www.bkcscan.com",apiUrl:"https://www.bkcscan.com/api"}}}),bitkubTestnet=defineChain({id:25925,name:"Bitkub Testnet",network:"Bitkub Testnet",nativeCurrency:{name:"Bitkub Test",symbol:"tKUB",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Testnet Explorer",url:"https://testnet.bkcscan.com",apiUrl:"https://testnet.bkcscan.com/api"}},testnet:!0}),bitlayer=defineChain({id:200901,name:"Bitlayer Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org"],webSocket:["wss://ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer mainnet scan",url:"https://www.btrscan.com"}}}),bitlayerTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer testnet scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bitrock=defineChain({id:7171,name:"Bitrock Mainnet",nativeCurrency:{name:"BROCK",symbol:"BROCK",decimals:18},rpcUrls:{default:{http:["https://brockrpc.io"]}},blockExplorers:{default:{name:"Bitrock Explorer",url:"https://explorer.bit-rock.io"}},testnet:!1}),bitTorrent=defineChain({id:199,name:"BitTorrent",network:"bittorrent-chain-mainnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://rpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://bttcscan.com",apiUrl:"https://api.bttcscan.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:31078552}}}),bitTorrentTestnet=defineChain({id:1028,name:"BitTorrent Chain Testnet",network:"bittorrent-chain-testnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://testrpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://testnet.bttcscan.com",apiUrl:"https://testnet.bttcscan.com/api"}},testnet:!0}),sourceId$B=1,blast=defineChain({id:81457,name:"Blast",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://blastscan.io",apiUrl:"https://api.blastscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:212929}},sourceId:sourceId$B}),sourceId$A=11155111,blastSepolia=defineChain({id:168587773,name:"Blast Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://sepolia.blastscan.io",apiUrl:"https://api-sepolia.blastscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:756690}},testnet:!0,sourceId:sourceId$A}),sourceId$z=1,bob=defineChain({...chainConfig$2,id:60808,name:"BOB",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.gobob.xyz"],webSocket:["wss://rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Explorer",url:"https://explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:23131},l2OutputOracle:{[sourceId$z]:{address:"0xdDa53E23f8a32640b04D7256e651C1db98dB11C1",blockCreated:4462615}},portal:{[sourceId$z]:{address:"0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E",blockCreated:4462615}}},sourceId:sourceId$z}),boba=defineChain({id:288,name:"Boba Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://bobascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:446859}}}),bobaSepolia=defineChain({id:28882,name:"Boba Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://testnet.bobascan.com"}},testnet:!0}),sourceId$y=11155111,bobSepolia=defineChain({...chainConfig$2,id:808813,name:"BOB Sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://bob-sepolia.rpc.gobob.xyz"],webSocket:["wss://bob-sepolia.rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Sepolia Explorer",url:"https://bob-sepolia.explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:35677},l2OutputOracle:{[sourceId$y]:{address:"0x14D0069452b4AE2b250B395b8adAb771E4267d2f",blockCreated:4462615}},portal:{[sourceId$y]:{address:"0x867B1Aa872b9C8cB5E9F7755feDC45BB24Ad0ae4",blockCreated:4462615}}},testnet:!0,sourceId:sourceId$y}),botanixTestnet=defineChain({id:3636,name:"Botanix Testnet",nativeCurrency:{name:"Botanix",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://poa-node.botanixlabs.dev"]}},blockExplorers:{default:{name:"blockscout",url:"https://blockscout.botanixlabs.dev",apiUrl:"https://blockscout.botanixlabs.dev"}},testnet:!0}),bounceBit=defineChain({id:6001,name:"BounceBit Mainnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-mainnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://bbscan.io"}},testnet:!1}),bounceBitTestnet=defineChain({id:6e3,name:"BounceBit Testnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-testnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://testnet.bbscan.io"}},testnet:!0}),bronos=defineChain({id:1039,name:"Bronos",nativeCurrency:{decimals:18,name:"BRO",symbol:"BRO"},rpcUrls:{default:{http:["https://evm.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://broscan.bronos.org"}}}),bronosTestnet=defineChain({id:1038,name:"Bronos Testnet",nativeCurrency:{decimals:18,name:"Bronos Coin",symbol:"tBRO"},rpcUrls:{default:{http:["https://evm-testnet.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://tbroscan.bronos.org"}},testnet:!0}),bsc=defineChain({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://rpc.ankr.com/bsc"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),bscGreenfield=defineChain({id:1017,name:"BNB Greenfield Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://greenfield-chain.bnbchain.org"]}},blockExplorers:{default:{name:"BNB Greenfield Mainnet Scan",url:"https://greenfieldscan.com"}},testnet:!1}),bscTestnet=defineChain({id:97,name:"Binance Smart Chain Testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{default:{name:"BscScan",url:"https://testnet.bscscan.com",apiUrl:"https://api-testnet.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0}),bsquared=defineChain({id:223,name:"B2",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.bsquared.network"}}}),bsquaredTestnet=defineChain({id:1123,name:"B2 Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet-explorer.bsquared.network"}},testnet:!0}),btr=defineChain({id:200901,name:"Bitlayer",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org","https://rpc.bitlayer-rpc.com","https://rpc.ankr.com/bitlayer"],webSocket:["wss://ws.bitlayer.org","wss://ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://www.btrscan.com"}}}),btrTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org","wss://testnet-ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bxn=defineChain({id:4999,name:"BlackFort Exchange Network",nativeCurrency:{name:"BlackFort Token",symbol:"BXN",decimals:18},rpcUrls:{default:{http:["https://mainnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.blackfort.network",apiUrl:"https://explorer.blackfort.network/api"}}}),bxnTestnet=defineChain({id:4777,name:"BlackFort Exchange Network Testnet",nativeCurrency:{name:"BlackFort Testnet Token",symbol:"TBXN",decimals:18},rpcUrls:{default:{http:["https://testnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.blackfort.network",apiUrl:"https://testnet-explorer.blackfort.network/api"}},testnet:!0}),cannon=defineChain({id:13370,name:"Cannon",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),canto=defineChain({id:7700,name:"Canto",nativeCurrency:{decimals:18,name:"Canto",symbol:"CANTO"},rpcUrls:{default:{http:["https://canto.gravitychain.io"]}},blockExplorers:{default:{name:"Tuber.Build (Blockscout)",url:"https://tuber.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2905789}}}),fees={estimateFeesPerGas:async Xr=>{var no;if(!((no=Xr.request)!=null&&no.feeCurrency))return null;const[eo,to]=await Promise.all([estimateFeePerGasInFeeCurrency(Xr.client,Xr.request.feeCurrency),estimateMaxPriorityFeePerGasInFeeCurrency(Xr.client,Xr.request.feeCurrency)]);return{maxFeePerGas:Xr.multiply(eo)+to,maxPriorityFeePerGas:to}}};async function estimateFeePerGasInFeeCurrency(Xr,eo){const to=await Xr.request({method:"eth_gasPrice",params:[eo]});return BigInt(to)}async function estimateMaxPriorityFeePerGasInFeeCurrency(Xr,eo){const to=await Xr.request({method:"eth_maxPriorityFeePerGas",params:[eo]});return BigInt(to)}function isEmpty(Xr){return Xr===0||Xr===0n||Xr===void 0||Xr===null||Xr==="0"||Xr===""||typeof Xr=="string"&&(trim$1(Xr).toLowerCase()==="0x"||trim$1(Xr).toLowerCase()==="0x00")}function isPresent(Xr){return!isEmpty(Xr)}function isEIP1559(Xr){return typeof Xr.maxFeePerGas<"u"&&typeof Xr.maxPriorityFeePerGas<"u"}function isCIP64(Xr){return Xr.type==="cip64"?!0:isEIP1559(Xr)&&isPresent(Xr.feeCurrency)}const formatters={block:defineBlock({format(Xr){var to;return{transactions:(to=Xr.transactions)==null?void 0:to.map(ro=>typeof ro=="string"?ro:{...formatTransaction(ro),...ro.gatewayFee?{gatewayFee:hexToBigInt(ro.gatewayFee),gatewayFeeRecipient:ro.gatewayFeeRecipient}:{},feeCurrency:ro.feeCurrency}),...Xr.randomness?{randomness:Xr.randomness}:{}}}}),transaction:defineTransaction({format(Xr){if(Xr.type==="0x7e")return{isSystemTx:Xr.isSystemTx,mint:Xr.mint?hexToBigInt(Xr.mint):void 0,sourceHash:Xr.sourceHash,type:"deposit"};const eo={feeCurrency:Xr.feeCurrency};return Xr.type==="0x7b"?eo.type="cip64":(Xr.type==="0x7c"&&(eo.type="cip42"),eo.gatewayFee=Xr.gatewayFee?hexToBigInt(Xr.gatewayFee):null,eo.gatewayFeeRecipient=Xr.gatewayFeeRecipient),eo}}),transactionRequest:defineTransactionRequest({format(Xr){const eo={};return Xr.feeCurrency&&(eo.feeCurrency=Xr.feeCurrency),isCIP64(Xr)&&(eo.type="0x7b"),eo}})};function serializeTransaction$1(Xr,eo){return isCIP64(Xr)?serializeTransactionCIP64(Xr,eo):serializeTransaction$2(Xr,eo)}const serializers={transaction:serializeTransaction$1};function serializeTransactionCIP64(Xr,eo){assertTransactionCIP64(Xr);const{chainId:to,gas:ro,nonce:no,to:io,value:oo,maxFeePerGas:ao,maxPriorityFeePerGas:so,accessList:co,feeCurrency:lo,data:fo}=Xr,ho=[toHex$1(to),no?toHex$1(no):"0x",so?toHex$1(so):"0x",ao?toHex$1(ao):"0x",ro?toHex$1(ro):"0x",io??"0x",oo?toHex$1(oo):"0x",fo??"0x",serializeAccessList(co),lo,...toYParitySignatureArray(Xr,eo)];return concatHex(["0x7b",toRlp(ho)])}const MAX_MAX_FEE_PER_GAS=maxUint256;function assertTransactionCIP64(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io,feeCurrency:oo}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(ro)throw new BaseError("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(isPresent(no)&&no>MAX_MAX_FEE_PER_GAS)throw new FeeCapTooHighError({maxFeePerGas:no});if(isPresent(to)&&isPresent(no)&&to>no)throw new TipAboveFeeCapError({maxFeePerGas:no,maxPriorityFeePerGas:to});if(isPresent(oo)&&!isAddress(oo))throw new BaseError("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(isEmpty(oo))throw new BaseError("`feeCurrency` must be provided for CIP-64 transactions.")}const chainConfig$1={contracts,formatters,serializers,fees},celo=defineChain({...chainConfig$1,id:42220,name:"Celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://celoscan.io",apiUrl:"https://api.celoscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1}),sourceId$x=17e3,celoAlfajores=defineChain({...chainConfig$1,id:44787,name:"Alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Alfajores Explorer",url:"https://celo-alfajores.blockscout.com",apiUrl:"https://celo-alfajores.blockscout.com/api"}},contracts:{...chainConfig$1.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:14569001},portal:{[sourceId$x]:{address:"0x82527353927d8D069b3B452904c942dA149BA381",blockCreated:2411324}},disputeGameFactory:{[sourceId$x]:{address:"0xE28AAdcd9883746c0e5068F58f9ea06027b214cb",blockCreated:2411324}},l2OutputOracle:{[sourceId$x]:{address:"0x4a2635e9e4f6e45817b1D402ac4904c1d1752438",blockCreated:2411324}},l1StandardBridge:{[sourceId$x]:{address:"0xD1B0E0581973c9eB7f886967A606b9441A897037",blockCreated:2411324}}},testnet:!0}),chang=defineChain({id:5858,name:"Chang Chain Foundation Mainnet",nativeCurrency:{decimals:18,name:"CTH",symbol:"CTH"},rpcUrls:{default:{http:["https://rpc.cthscan.com"]}},blockExplorers:{default:{name:"Chang Chain explorer",url:"https://cthscan.com"}}}),chiliz=defineChain({id:88888,name:"Chiliz Chain",network:"chiliz-chain",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://rpc.ankr.com/chiliz","https://chiliz-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"https://scan.chiliz.com",apiUrl:"https://scan.chiliz.com/api"}}}),chips=defineChain({id:2882,name:"Chips Network",network:"CHIPS",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://node.chips.ooo/wasp/api/v1/chains/iota1pp3d3mnap3ufmgqnjsnw344sqmf5svjh26y2khnmc89sv6788y3r207a8fn/evm"]}}}),classic=defineChain({id:61,name:"Ethereum Classic",nativeCurrency:{decimals:18,name:"ETC",symbol:"ETC"},rpcUrls:{default:{http:["https://etc.rivet.link"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.com/etc/mainnet"}}}),confluxESpace=defineChain({id:1030,name:"Conflux eSpace",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evm.confluxrpc.com"],webSocket:["wss://evm.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evm.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:68602935}}}),confluxESpaceTestnet=defineChain({id:71,name:"Conflux eSpace Testnet",network:"cfx-espace-testnet",testnet:!0,nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evmtestnet.confluxrpc.com"],webSocket:["wss://evmtestnet.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evmtestnet.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:117499050}}}),coreDao=defineChain({id:1116,name:"Core Dao",nativeCurrency:{decimals:18,name:"Core",symbol:"CORE"},rpcUrls:{default:{http:["https://rpc.coredao.org"]}},blockExplorers:{default:{name:"CoreDao",url:"https://scan.coredao.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:11907934}},testnet:!1}),crab=defineChain({id:44,name:"Crab Network",nativeCurrency:{decimals:18,name:"Crab Network Native Token",symbol:"CRAB"},rpcUrls:{default:{http:["https://crab-rpc.darwinia.network"],webSocket:["wss://crab-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://crab-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3032593}}}),cronos=defineChain({id:25,name:"Cronos Mainnet",nativeCurrency:{decimals:18,name:"Cronos",symbol:"CRO"},rpcUrls:{default:{http:["https://evm.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://explorer.cronos.org",apiUrl:"https://explorer-api.cronos.org/mainnet/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1963112}}}),cronosTestnet=defineChain({id:338,name:"Cronos Testnet",nativeCurrency:{decimals:18,name:"CRO",symbol:"tCRO"},rpcUrls:{default:{http:["https://evm-t3.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://cronos.org/explorer/testnet3"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:10191251}},testnet:!0}),cronoszkEVM=defineChain({id:388,name:"Cronos zkEVM Mainnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM CRO",symbol:"zkCRO"},rpcUrls:{default:{http:["https://mainnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM (Mainnet) Chain Explorer",url:"https://explorer.zkevm.cronos.org"}}}),cronoszkEVMTestnet=defineChain({id:282,name:"Cronos zkEVM Testnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM Test Coin",symbol:"zkTCRO"},rpcUrls:{default:{http:["https://testnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM Testnet Explorer",url:"https://explorer.zkevm.cronos.org/testnet"}},testnet:!0}),crossbell=defineChain({id:3737,name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io",apiUrl:"https://scan.crossbell.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}}),curtis=defineChain({id:33111,name:"Curtis",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.curtis.apechain.com"]}},blockExplorers:{default:{name:"Curtis Explorer",url:"https://explorer.curtis.apechain.com"}},testnet:!0}),cyber=defineChain({id:7560,name:"Cyber",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),cyberTestnet=defineChain({id:111557560,name:"Cyber Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co",apiUrl:"https://testnet.cyberscan.co/api"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),darwinia=defineChain({id:46,name:"Darwinia Network",nativeCurrency:{decimals:18,name:"RING",symbol:"RING"},rpcUrls:{default:{http:["https://rpc.darwinia.network"],webSocket:["wss://rpc.darwinia.network"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69420}}}),dchain=defineChain({...chainConfig$2,id:2716446429837e3,name:"Dchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchain-2716446429837000-1.jsonrpc.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchain-2716446429837000-1.sagaexplorer.io",apiUrl:"https://api-dchain-2716446429837000-1.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),dchainTestnet=defineChain({...chainConfig$2,id:2713017997578e3,name:"Dchain Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchaintestnet-2713017997578000-1.jsonrpc.testnet.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io",apiUrl:"https://api-dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),defichainEvm=defineChain({id:1130,network:"defichain-evm",name:"DeFiChain EVM Mainnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.mainnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:137852}}}),defichainEvmTestnet=defineChain({id:1131,network:"defichain-evm-testnet",name:"DeFiChain EVM Testnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.testnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live/?network=TestNet"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:156462}},testnet:!0}),degen=defineChain({id:666666666,name:"Degen",nativeCurrency:{decimals:18,name:"Degen",symbol:"DEGEN"},rpcUrls:{default:{http:["https://rpc.degen.tips"],webSocket:["wss://rpc.degen.tips"]}},blockExplorers:{default:{name:"Degen Chain Explorer",url:"https://explorer.degen.tips",apiUrl:"https://explorer.degen.tips/api/v2"}}}),dfk=defineChain({id:53935,name:"DFK Chain",nativeCurrency:{decimals:18,name:"Jewel",symbol:"JEWEL"},rpcUrls:{default:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]}},blockExplorers:{default:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14790551}}}),dodochainTestnet=defineChain({id:53457,name:"DODOchain Testnet",nativeCurrency:{decimals:18,name:"DODO",symbol:"DODO"},rpcUrls:{default:{http:["https://dodochain-testnet.alt.technology"],webSocket:["wss://dodochain-testnet.alt.technology/ws"]}},blockExplorers:{default:{name:"DODOchain Testnet (Sepolia) Explorer",url:"https://testnet-scan.dodochain.com"}},testnet:!0}),dogechain=defineChain({id:2e3,name:"Dogechain",nativeCurrency:{decimals:18,name:"Wrapped Dogecoin",symbol:"WDOGE"},rpcUrls:{default:{http:["https://rpc.dogechain.dog"]}},blockExplorers:{default:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog",apiUrl:"https://explorer.dogechain.dog/api"}},contracts:{multicall3:{address:"0x68a8609a60a008EFA633dfdec592c03B030cC508",blockCreated:25384031}}}),dosChain=defineChain({id:7979,name:"DOS Chain",nativeCurrency:{decimals:18,name:"DOS Chain",symbol:"DOS"},rpcUrls:{default:{http:["https://main.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Explorer",url:"https://doscan.io",apiUrl:"https://api.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:161908}}}),dosChainTestnet=defineChain({id:3939,name:"DOS Chain Testnet",nativeCurrency:{decimals:18,name:"DOS Chain Testnet",symbol:"DOS"},rpcUrls:{default:{http:["https://test.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Testnet Explorer",url:"https://test.doscan.io",apiUrl:"https://api-test.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69623}},testnet:!0}),dreyerxMainnet=defineChain({id:23451,name:"DreyerX Mainnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["https://rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Scan",url:"https://scan.dreyerx.com"}}}),dreyerxTestnet=defineChain({id:23452,name:"DreyerX Testnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["http://testnet-rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Testnet Scan",url:"https://testnet-scan.dreyerx.com"}},testnet:!0}),dustboyIoT=defineChain({id:555888,name:"DustBoy IoT",nativeCurrency:{name:"Ether",symbol:"DST",decimals:18},rpcUrls:{default:{http:["https://dustboy-rpc.jibl2.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://dustboy.jibl2.com",apiUrl:"https://dustboy.jibl2.com/api"}},contracts:{multicall3:{address:"0xFFD34aa2C62B2D52E00A361e466C229788f4eD6a",blockCreated:526569}},testnet:!1}),dymension=defineChain({id:1100,name:"Dymension",nativeCurrency:{name:"DYM",symbol:"DYM",decimals:18},rpcUrls:{default:{http:["https://dymension-evm-rpc.publicnode.com"],webSocket:["wss://dymension-evm-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Dym FYI",url:"https://dym.fyi"}},testnet:!1}),edgeless=defineChain({id:2026,name:"Edgeless Network",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://rpc.edgeless.network/http"],webSocket:["wss://rpc.edgeless.network/ws"]}},blockExplorers:{default:{name:"Edgeless Explorer",url:"https://explorer.edgeless.network"}}}),edgelessTestnet=defineChain({id:202,name:"Edgeless Testnet",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://edgeless-testnet.rpc.caldera.xyz/http"],webSocket:["wss://edgeless-testnet.rpc.caldera.xyz/ws"]}},blockExplorers:{default:{name:"Edgeless Testnet Explorer",url:"https://testnet.explorer.edgeless.network"}}}),edgeware=defineChain({id:2021,name:"Edgeware EdgeEVM Mainnet",nativeCurrency:{decimals:18,name:"Edgeware",symbol:"EDG"},rpcUrls:{default:{http:["https://edgeware-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live",apiUrl:"https://edgscan.live/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18117872}}}),edgewareTestnet=defineChain({id:2022,name:"Beresheet BereEVM Testnet",nativeCurrency:{decimals:18,name:"Testnet EDG",symbol:"tEDG"},rpcUrls:{default:{http:["https://beresheet-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live",apiUrl:"https://testnet.edgscan.live/api"}}}),ekta=defineChain({id:1994,name:"Ekta",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://main.ekta.io"]}},blockExplorers:{default:{name:"Ektascan",url:"https://ektascan.io",apiUrl:"https://ektascan.io/api"}}}),ektaTestnet=defineChain({id:1004,name:"Ekta Testnet",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://test.ekta.io:8545"]}},blockExplorers:{default:{name:"Test Ektascan",url:"https://test.ektascan.io",apiUrl:"https://test.ektascan.io/api"}},testnet:!0}),elastos=defineChain({id:20,name:"Elastos Smart Chain",nativeCurrency:{name:"ELA",symbol:"ELA",decimals:18},rpcUrls:{default:{http:["https://api2.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc.elastos.io"}},testnet:!1}),elastosTestnet=defineChain({id:21,name:"Elastos Smart Chain Testnet",nativeCurrency:{name:"tELA",symbol:"tELA",decimals:18},rpcUrls:{default:{http:["https://api-testnet.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc-testnet.elastos.io"}},testnet:!0}),electroneum=defineChain({id:52014,name:"Electroneum Mainnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.electroneum.com"}},testnet:!1}),electroneumTestnet=defineChain({id:5201420,name:"Electroneum Testnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.thesecurityteam.rocks"}},testnet:!0}),elysiumTestnet=defineChain({...chainConfig$2,id:1338,name:"Elysium Testnet",nativeCurrency:{decimals:18,name:"LAVA",symbol:"LAVA"},rpcUrls:{default:{http:["https://elysium-test-rpc.vulcanforged.com"]}},blockExplorers:{default:{name:"Elysium testnet explorer",url:"https://elysium-explorer.vulcanforged.com"}},testnet:!0}),eon=defineChain({id:7332,name:"Horizen EON",nativeCurrency:{decimals:18,name:"ZEN",symbol:"ZEN"},rpcUrls:{default:{http:["https://eon-rpc.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"EON Explorer",url:"https://eon-explorer.horizenlabs.io"}},contracts:{}}),eos=defineChain({id:17777,name:"EOS EVM",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com",apiUrl:"https://explorer.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7943933}}}),eosTestnet=defineChain({id:15557,name:"EOS EVM Testnet",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.testnet.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com",apiUrl:"https://explorer.testnet.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9067940}},testnet:!0}),etherlink=defineChain({id:42793,name:"Etherlink",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.mainnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink",url:"https://explorer.etherlink.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:33899}}}),etherlinkTestnet=defineChain({id:128123,name:"Etherlink Testnet",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.ghostnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink Testnet",url:"https://testnet-explorer.etherlink.com"}},testnet:!0}),evmos=defineChain({id:9001,name:"Evmos",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.org:8545"]}},blockExplorers:{default:{name:"Evmos Block Explorer",url:"https://escan.live"}}}),evmosTestnet=defineChain({id:9e3,name:"Evmos Testnet",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.dev:8545"]}},blockExplorers:{default:{name:"Evmos Testnet Block Explorer",url:"https://evm.evmos.dev/"}}}),excelonMainnet=defineChain({id:22052002,name:"Excelon Mainnet",network:"XLON",nativeCurrency:{decimals:18,name:"Excelon",symbol:"xlon"},rpcUrls:{default:{http:["https://edgewallet1.xlon.org"]}},blockExplorers:{default:{name:"Excelon explorer",url:"https://explorer.excelon.io"}}}),fantom=defineChain({id:250,name:"Fantom",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.ankr.com/fantom"]}},blockExplorers:{default:{name:"FTMScan",url:"https://ftmscan.com",apiUrl:"https://api.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:33001987}}}),fantomSonicTestnet=defineChain({id:64240,name:"Fantom Sonic Open Testnet",network:"fantom-sonic-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpcapi.sonic.fantom.network"]}},blockExplorers:{default:{name:"Fantom Sonic Open Testnet Explorer",url:"https://public-sonic.fantom.network"}},testnet:!0}),fantomTestnet=defineChain({id:4002,name:"Fantom Testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.testnet.fantom.network"]}},blockExplorers:{default:{name:"FTMScan",url:"https://testnet.ftmscan.com",apiUrl:"https://testnet.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:8328688}},testnet:!0}),fibo=defineChain({id:12306,name:"Fibo Chain",nativeCurrency:{decimals:18,name:"fibo",symbol:"FIBO"},rpcUrls:{default:{http:["https://network.hzroc.art"]}},blockExplorers:{default:{name:"FiboScan",url:"https://scan.fibochain.org"}}}),filecoin=defineChain({id:314,name:"Filecoin Mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3328594}}}),filecoinCalibration=defineChain({id:314159,name:"Filecoin Calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}},testnet:!0}),filecoinHyperspace=defineChain({id:3141,name:"Filecoin Hyperspace",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://hyperspace.filfox.info/en"}},testnet:!0}),flare=defineChain({id:14,name:"Flare Mainnet",nativeCurrency:{decimals:18,name:"Flare",symbol:"FLR"},rpcUrls:{default:{http:["https://flare-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Flare Explorer",url:"https://flare-explorer.flare.network",apiUrl:"https://flare-explorer.flare.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3002461}}}),flareTestnet=defineChain({id:114,name:"Flare Testnet Coston2",nativeCurrency:{decimals:18,name:"Coston2 Flare",symbol:"C2FLR"},rpcUrls:{default:{http:["https://coston2-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston2 Explorer",url:"https://coston2-explorer.flare.network",apiUrl:"https://coston2-explorer.flare.network/api"}},testnet:!0}),flowMainnet=defineChain({id:747,name:"FlowEVM Mainnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://mainnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Mainnet Explorer",url:"https://flowdiver.io"}}}),flowPreviewnet=defineChain({id:646,name:"FlowEVM Previewnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://previewnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Previewnet Explorer",url:"https://previewnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6205}}}),flowTestnet=defineChain({id:545,name:"FlowEVM Testnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://testnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Flow Diver",url:"https://testnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:137518}}}),fluence=defineChain({id:9999999,name:"Fluence",nativeCurrency:{name:"FLT",symbol:"FLT",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.fluence.dev"],webSocket:["wss://ws.mainnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.mainnet.fluence.dev",apiUrl:"https://blockscout.mainnet.fluence.dev/api"}}}),fluenceStage=defineChain({id:123420000220,name:"Fluence Stage",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.stage.fluence.dev"],webSocket:["wss://ws.stage.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.stage.fluence.dev",apiUrl:"https://blockscout.stage.fluence.dev/api"}},testnet:!0}),fluenceTestnet=defineChain({id:52164803,name:"Fluence Testnet",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.fluence.dev"],webSocket:["wss://ws.testnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.testnet.fluence.dev",apiUrl:"https://blockscout.testnet.fluence.dev/api"}},testnet:!0}),forma=defineChain({id:984122,name:"Forma",network:"forma",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.forma.art"],webSocket:["wss://ws.forma.art"]}},blockExplorers:{default:{name:"Forma Explorer",url:"https://explorer.forma.art"}},contracts:{multicall3:{address:"0xd53C6FFB123F7349A32980F87faeD8FfDc9ef079",blockCreated:252705}}}),foundry=defineChain({id:31337,name:"Foundry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$w=1,fraxtal=defineChain({...chainConfig$2,id:252,name:"Fraxtal",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.frax.com"]}},blockExplorers:{default:{name:"fraxscan",url:"https://fraxscan.com",apiUrl:"https://api.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$w]:{address:"0x66CC916Ed5C6C2FA97014f7D1cD141528Ae171e4"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$w]:{address:"0x36cb65c1967A0Fb0EEE11569C51C2f2aA1Ca6f6D",blockCreated:19135323}},l1StandardBridge:{[sourceId$w]:{address:"0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2",blockCreated:19135323}}},sourceId:sourceId$w}),sourceId$v=17e3,fraxtalTestnet=defineChain({...chainConfig$2,id:2522,name:"Fraxtal Testnet",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.frax.com"]}},blockExplorers:{default:{name:"fraxscan testnet",url:"https://holesky.fraxscan.com",apiUrl:"https://api-holesky.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$v]:{address:"0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$v]:{address:"0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d",blockCreated:318416}},l1StandardBridge:{[sourceId$v]:{address:"0x0BaafC217162f64930909aD9f2B27125121d6332",blockCreated:318416}}},sourceId:sourceId$v}),sourceId$u=1,funkiMainnet=defineChain({...chainConfig$2,id:33979,name:"Funki",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.funkichain.com"]}},blockExplorers:{default:{name:"Funki Mainnet Explorer",url:"https://funkiscan.io"}},contracts:{...chainConfig$2.contracts},sourceId:sourceId$u}),sourceId$t=11155111,funkiSepolia=defineChain({...chainConfig$2,id:3397901,network:"funkiSepolia",name:"Funki Sepolia Sandbox",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://funki-testnet.alt.technology"]}},blockExplorers:{default:{name:"Funki Sepolia Sandbox Explorer",url:"https://sepolia-sandbox.funkichain.com/"}},testnet:!0,contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204}},sourceId:sourceId$t}),fuse=defineChain({id:122,name:"Fuse",nativeCurrency:{name:"Fuse",symbol:"FUSE",decimals:18},rpcUrls:{default:{http:["https://rpc.fuse.io"]}},blockExplorers:{default:{name:"Fuse Explorer",url:"https://explorer.fuse.io",apiUrl:"https://explorer.fuse.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:16146628}}}),fuseSparknet=defineChain({id:123,name:"Fuse Sparknet",nativeCurrency:{name:"Spark",symbol:"SPARK",decimals:18},rpcUrls:{default:{http:["https://rpc.fusespark.io"]}},blockExplorers:{default:{name:"Sparkent Explorer",url:"https://explorer.fusespark.io",apiUrl:"https://explorer.fusespark.io/api"}}}),fusion=defineChain({id:32659,name:"Fusion Mainnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://mainnet.fusionnetwork.io"],webSocket:["wss://mainnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10441605}},testnet:!1}),fusionTestnet=defineChain({id:46688,name:"Fusion Testnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://testnet.fusionnetwork.io"],webSocket:["wss://testnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://testnet.fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10428309}},testnet:!0}),sourceId$s=17e3,garnet=defineChain({...chainConfig$2,name:"Garnet Testnet",testnet:!0,id:17069,sourceId:sourceId$s,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"],webSocket:["wss://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$s]:{address:"0x57ee40586fbE286AfC75E67cb69511A6D9aF5909",blockCreated:1274684}},l2OutputOracle:{[sourceId$s]:{address:"0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B",blockCreated:1274684}},l1StandardBridge:{[sourceId$s]:{address:"0x09bcDd311FE398F80a78BE37E489f5D440DB95DE",blockCreated:1274684}}}}),genesys=defineChain({id:16507,name:"Genesys Mainnet",nativeCurrency:{decimals:18,name:"GSYS",symbol:"GSYS"},rpcUrls:{default:{http:["https://rpc.genesys.network"]}},blockExplorers:{default:{name:"Genesys Explorer",url:"https://gchainexplorer.genesys.network"}},testnet:!1}),glideL1Protocol=defineChain({id:251,name:"Glide L1 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l1-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l1-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),glideL2Protocol=defineChain({id:253,name:"Glide L2 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l2-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l2-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),gnosis=defineChain({id:100,name:"Gnosis",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{default:{name:"Gnosisscan",url:"https://gnosisscan.io",apiUrl:"https://api.gnosisscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}}),gnosisChiado=defineChain({id:10200,name:"Gnosis Chiado",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.chiadochain.net",apiUrl:"https://blockscout.chiadochain.net/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4967313}},testnet:!0}),gobi=defineChain({id:1663,name:"Horizen Gobi Testnet",nativeCurrency:{decimals:18,name:"Test ZEN",symbol:"tZEN"},rpcUrls:{default:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"Gobi Explorer",url:"https://gobi-explorer.horizen.io"}},contracts:{},testnet:!0}),goChain=defineChain({id:60,name:"GoChain",nativeCurrency:{decimals:18,name:"GO",symbol:"GO"},rpcUrls:{default:{http:["https://rpc.gochain.io"]}},blockExplorers:{default:{name:"GoChain Explorer",url:"https://explorer.gochain.io"}},testnet:!1}),goerli=defineChain({id:5,name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io",apiUrl:"https://api-goerli.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xfc4AC75C46C914aF5892d6d3eFFcebD7917293F1",blockCreated:10339206},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),gravity=defineChain({id:1625,name:"Gravity Alpha Mainnet",nativeCurrency:{name:"G",symbol:"G",decimals:18},rpcUrls:{default:{http:["https://rpc.gravity.xyz"]}},blockExplorers:{default:{name:"Gravity Explorer",url:"https://explorer.gravity.xyz",apiUrl:"https://explorer.gravity.xyz/api"}},contracts:{multicall3:{address:"0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c",blockCreated:16851}}}),guruTestnet=defineChain({id:261,name:"Guru Network Testnet",nativeCurrency:{name:"testGURU",symbol:"tGURU",decimals:18},rpcUrls:{default:{http:["https://rpc.gurunetwork.ai/archive/261"]}},blockExplorers:{default:{name:"Guruscan",url:"https://scan.gurunetwork.ai"}},testnet:!0}),ham=defineChain({id:5112,name:"Ham",nativeCurrency:{decimals:18,name:"Ham",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.ham.fun"],webSocket:["wss://rpc.ham.fun"]}},blockExplorers:{default:{name:"Ham Chain Explorer",url:"https://explorer.ham.fun",apiUrl:"https://explorer.ham.fun/api/v2"}}}),haqqMainnet=defineChain({id:11235,name:"HAQQ Mainnet",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLM"},rpcUrls:{default:{http:["https://rpc.eth.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.haqq.network",apiUrl:"https://explorer.haqq.network/api"}}}),haqqTestedge2=defineChain({id:54211,name:"HAQQ Testedge 2",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLMT"},rpcUrls:{default:{http:["https://rpc.eth.testedge2.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.testedge2.haqq.network",apiUrl:"https://explorer.testedge2.haqq.network/api"}}}),hardhat=defineChain({id:31337,name:"Hardhat",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),harmonyOne=defineChain({id:16666e5,name:"Harmony One",nativeCurrency:{name:"Harmony",symbol:"ONE",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/harmony"]}},blockExplorers:{default:{name:"Harmony Explorer",url:"https://explorer.harmony.one"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:24185753}}}),hashkeyTestnet=defineChain({id:133,name:"HashKey Chain Testnet",nativeCurrency:{decimals:18,name:"HashKey EcoPoints",symbol:"HSK"},rpcUrls:{default:{http:["https://hashkeychain-testnet.alt.technology"]}},blockExplorers:{default:{name:"HashKey Chain Explorer",url:"https://hashkeychain-testnet-explorer.alt.technology"}}}),hedera=defineChain({id:295,name:"Hedera Mainnet",network:"hedera-mainnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://mainnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/mainnet"}},testnet:!1}),hederaPreviewnet=defineChain({id:297,name:"Hedera Previewnet",network:"hedera-previewnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://previewnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/previewnet"}},testnet:!0}),hederaTestnet=defineChain({id:296,name:"Hedera Testnet",network:"hedera-testnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://testnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/testnet"}},testnet:!0}),hela=defineChain({id:8668,name:"Hela Mainnet",nativeCurrency:{name:"HLUSD",symbol:"HLUSD",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.helachain.com"]}},blockExplorers:{default:{name:"Hela explorer",url:"https://mainnet-blockexplorer.helachain.com"}},testnet:!1}),hemiSepolia=defineChain({id:743111,name:"Hemi Sepolia",network:"Hemi Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.rpc.hemi.network/rpc"]}},blockExplorers:{default:{name:"Hemi Sepolia explorer",url:"https://testnet.explorer.hemi.xyz"}},testnet:!0}),holesky=defineChain({id:17e3,name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://holesky.etherscan.io",apiUrl:"https://api-holesky.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",blockCreated:801613},ensUniversalResolver:{address:"0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",blockCreated:973484}},testnet:!0}),hychain=defineChain({id:2911,name:"HYCHAIN",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://explorer.hychain.com"}},testnet:!1}),hychainTestnet=defineChain({id:29112,name:"HYCHAIN Testnet",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://testnet-rpc.hychain.com/http"}},testnet:!0}),immutableZkEvm=defineChain({id:13371,name:"Immutable zkEVM",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.immutable.com"]}},blockExplorers:{default:{name:"Immutable Explorer",url:"https://explorer.immutable.com",apiUrl:"https://explorer.immutable.com/api"}},contracts:{multicall3:{address:"0x236bdA4589e44e6850f5aC6a74BfCa398a86c6c0",blockCreated:4335972}}}),immutableZkEvmTestnet=defineChain({id:13473,name:"Immutable zkEVM Testnet",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.testnet.immutable.com"]}},blockExplorers:{default:{name:"Immutable Testnet Explorer",url:"https://explorer.testnet.immutable.com/"}},contracts:{multicall3:{address:"0x2CC787Ed364600B0222361C4188308Fa8E68bA60",blockCreated:5977391}},testnet:!0}),inEVM=defineChain({id:2525,name:"inEVM Mainnet",nativeCurrency:{decimals:18,name:"Injective",symbol:"INJ"},rpcUrls:{default:{http:["https://mainnet.rpc.inevm.com/http"]}},blockExplorers:{default:{name:"inEVM Explorer",url:"https://inevm.calderaexplorer.xyz",apiUrl:"https://inevm.calderaexplorer.xyz/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:118606}}}),sourceId$r=11155111,inkSepolia=defineChain({...chainConfig$2,id:763373,name:"Ink Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-gel-sepolia.inkonchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer-sepolia.inkonchain.com/",apiUrl:"https://explorer-sepolia.inkonchain.com/api/v2"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$r]:{address:"0x860e626c700af381133d9f4af31412a2d1db3d5d"}},portal:{[sourceId$r]:{address:"0x5c1d29c6c9c8b0800692acc95d700bcb4966a1d7"}},l1StandardBridge:{[sourceId$r]:{address:"0x33f60714bbd74d62b66d79213c348614de51901c"}}},testnet:!0,sourceId:sourceId$r}),iota$1=defineChain({id:8822,name:"IOTA EVM",network:"iotaevm",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.iota.org",apiUrl:"https://explorer.evm.iota.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:25022}}}),iotaTestnet=defineChain({id:1075,name:"IOTA EVM Testnet",network:"iotaevm-testnet",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.testnet.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.testnet.iotaledger.net",apiUrl:"https://explorer.evm.testnet.iotaledger.net/api"}},testnet:!0}),iotex=defineChain({id:4689,name:"IoTeX",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://iotexscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:22163670}}}),iotexTestnet=defineChain({id:4690,name:"IoTeX Testnet",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://testnet.iotexscan.io"}},contracts:{multicall3:{address:"0xb5cecD6894c6f473Ec726A176f1512399A2e355d",blockCreated:24347592}},testnet:!0}),jbc=defineChain({id:8899,name:"JIBCHAIN L1",network:"jbc",nativeCurrency:{name:"JBC",symbol:"JBC",decimals:18},rpcUrls:{default:{http:["https://rpc-l1.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-l1.jibchain.net",apiUrl:"https://exp-l1.jibchain.net/api"}},contracts:{multicall3:{address:"0xc0C8C486D1466C57Efe13C2bf000d4c56F47CBdC",blockCreated:2299048}},testnet:!1}),jbcTestnet=defineChain({id:88991,name:"Jibchain Testnet",nativeCurrency:{name:"tJBC",symbol:"tJBC",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.testnet.jibchain.net",apiUrl:"https://exp.testnet.jibchain.net/api"}},contracts:{multicall3:{address:"0xa1a858ad9041B4741e620355a3F96B3c78e70ecE",blockCreated:32848}},testnet:!0}),karura=defineChain({id:686,name:"Karura",network:"karura",nativeCurrency:{name:"Karura",symbol:"KAR",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]}},blockExplorers:{default:{name:"Karura Blockscout",url:"https://blockscout.karura.network",apiUrl:"https://blockscout.karura.network/api"}},testnet:!1}),kakarotSepolia=defineChain({id:1802203764,name:"Kakarot Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kakarotStarknetSepolia=defineChain({id:920637907288165,name:"Kakarot Starknet Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kava=defineChain({id:2222,name:"Kava EVM",network:"kava-mainnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Explorer",url:"https://kavascan.com",apiUrl:"https://kavascan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3661165}},testnet:!1}),kavaTestnet=defineChain({id:2221,name:"Kava EVM Testnet",network:"kava-testnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.testnet.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Testnet Explorer",url:"https://testnet.kavascan.com/",apiUrl:"https://testnet.kavascan.com/api"}},contracts:{multicall3:{address:"0xDf1D724A7166261eEB015418fe8c7679BBEa7fd6",blockCreated:7242179}},testnet:!0}),kcc=defineChain({id:321,name:"KCC Mainnet",network:"KCC Mainnet",nativeCurrency:{decimals:18,name:"KCS",symbol:"KCS"},rpcUrls:{default:{http:["https://kcc-rpc.com"]}},blockExplorers:{default:{name:"KCC Explorer",url:"https://explorer.kcc.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11760430}},testnet:!1}),kinto=defineChain({id:7887,name:"Kinto Mainnet",network:"Kinto Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.kinto.xyz/http"]}},blockExplorers:{default:{name:"Kinto Explorer",url:"https://explorer.kinto.xyz"}},testnet:!1}),klaytn=defineChain({id:8217,name:"Klaytn",nativeCurrency:{decimals:18,name:"Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-cypress.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://scope.klaytn.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kaia=defineChain({id:8217,name:"Kaia",nativeCurrency:{decimals:18,name:"Kaia",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kaiascan.io",apiUrl:"https://api-cypress.klaytnscope.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kairos=defineChain({id:1001,name:"Kairos Testnet",network:"kairos",nativeCurrency:{decimals:18,name:"Kairos KAIA",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en-kairos.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kairos.kaiascan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),klaytnBaobab=defineChain({id:1001,name:"Klaytn Baobab Testnet",network:"klaytn-baobab",nativeCurrency:{decimals:18,name:"Baobab Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-baobab.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),koi=defineChain({id:701,name:"Koi Network",nativeCurrency:{decimals:18,name:"Koi Network Native Token",symbol:"KRING"},rpcUrls:{default:{http:["https://koi-rpc.darwinia.network"],webSocket:["wss://koi-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://koi-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:180001}},testnet:!0}),kroma=defineChain({id:255,name:"Kroma",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.kroma.network"]}},blockExplorers:{default:{name:"Kroma Explorer",url:"https://blockscout.kroma.network",apiUrl:"https://blockscout.kroma.network/api"}},testnet:!1}),kromaSepolia=defineChain({id:2358,name:"Kroma Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.sepolia.kroma.network"]}},blockExplorers:{default:{name:"Kroma Sepolia Explorer",url:"https://blockscout.sepolia.kroma.network",apiUrl:"https://blockscout.sepolia.kroma.network/api"}},testnet:!0}),l3x=defineChain({id:12324,name:"L3X Protocol",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.l3x.com"],webSocket:["wss://rpc-mainnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Mainnet Explorer",url:"https://explorer.l3x.com",apiUrl:"https://explorer.l3x.com/api/v2"}},testnet:!1}),l3xTestnet=defineChain({id:12325,name:"L3X Protocol Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.l3x.com"],webSocket:["wss://rpc-testnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Testnet Explorer",url:"https://explorer-testnet.l3x.com",apiUrl:"https://explorer-testnet.l3x.com/api/v2"}},testnet:!0}),lavita=defineChain({id:360890,name:"LAVITA Mainnet",nativeCurrency:{name:"vTFUEL",symbol:"vTFUEL",decimals:18},rpcUrls:{default:{http:["https://tsub360890-eth-rpc.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"LAVITA Explorer",url:"https://tsub360890-explorer.thetatoken.org"}},testnet:!1}),lightlinkPegasus=defineChain({id:1891,name:"LightLink Pegasus Testnet",network:"lightlink-pegasus",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.pegasus.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Pegasus Explorer",url:"https://pegasus.lightlink.io"}},testnet:!0}),lightlinkPhoenix=defineChain({id:1890,name:"LightLink Phoenix Mainnet",network:"lightlink-phoenix",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.phoenix.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Phoenix Explorer",url:"https://phoenix.lightlink.io"}},testnet:!1});async function estimateGas(Xr,eo){var no,io,oo;const{account:to=Xr.account}=eo;if(!to)throw new AccountNotFoundError;const ro=parseAccount(to);try{const{accessList:ao,blockNumber:so,blockTag:co,data:lo,gas:fo,gasPrice:ho,maxFeePerGas:go,maxPriorityFeePerGas:yo,nonce:vo,to:wo,value:Eo,...ko}=eo,Po=(so?numberToHex(so):void 0)||co;assertRequest(eo);const jo=(oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionRequest)==null?void 0:oo.format,No=(jo||formatTransactionRequest)({...extract(ko,{format:jo}),from:ro==null?void 0:ro.address,accessList:ao,data:lo,gas:fo,gasPrice:ho,maxFeePerGas:go,maxPriorityFeePerGas:yo,nonce:vo,to:wo,value:Eo}),{baseFeePerGas:Do,gasLimit:Fo,priorityFeePerGas:Xo}=await Xr.request({method:"linea_estimateGas",params:Po?[No,Po]:[No]});return{baseFeePerGas:BigInt(Do),gasLimit:BigInt(Fo),priorityFeePerGas:BigInt(Xo)}}catch(ao){throw getCallError(ao,{...eo,account:ro,chain:Xr.chain})}}const chainConfig={fees:{estimateFeesPerGas,async maxPriorityFeePerGas({block:Xr,client:eo,request:to}){const ro=await estimateFeesPerGas({block:Xr,client:eo,multiply:no=>no,request:to,type:"eip1559"});return ro!=null&&ro.maxPriorityFeePerGas?ro.maxPriorityFeePerGas:null}}};async function estimateFeesPerGas({client:Xr,multiply:eo,request:to,type:ro}){try{const no=await estimateGas(Xr,{...to,account:to==null?void 0:to.account}),{priorityFeePerGas:io}=no,ao=eo(BigInt(no.baseFeePerGas))+io;return ro==="legacy"?{gasPrice:ao}:{maxFeePerGas:ao,maxPriorityFeePerGas:io}}catch{return null}}const linea=defineChain({...chainConfig,id:59144,name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build",apiUrl:"https://api.lineascan.build/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42}},testnet:!1}),lineaGoerli=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://api-goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),lineaSepolia=defineChain({...chainConfig,id:59141,name:"Linea Sepolia Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),lineaTestnet=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),sourceId$q=1,lisk=defineChain({...chainConfig$2,id:1135,name:"Lisk",network:"lisk",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.lisk.com",apiUrl:"https://blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xA9d71E1dd7ca26F26e656E66d6AA81ed7f745bf0"},l2OutputOracle:{[sourceId$q]:{address:"0x113cB99283AF242Da0A0C54347667edF531Aa7d6"}},portal:{[sourceId$q]:{address:"0x26dB93F8b8b4f7016240af62F7730979d353f9A7"}},l1StandardBridge:{[sourceId$q]:{address:"0x2658723Bf70c7667De6B25F99fcce13A16D25d08"}}},sourceId:sourceId$q}),sourceId$p=11155111,liskSepolia=defineChain({...chainConfig$2,id:4202,network:"lisk-sepolia",name:"Lisk Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia-api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.lisk.com",apiUrl:"https://sepolia-blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$p]:{address:"0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$p]:{address:"0xe3d90F21490686Ec7eF37BE788E02dfC12787264"}},l1StandardBridge:{[sourceId$p]:{address:"0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5"}}},testnet:!0,sourceId:sourceId$p}),localhost=defineChain({id:1337,name:"Localhost",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),loop=defineChain({id:15551,name:"LoopNetwork Mainnet",nativeCurrency:{name:"LOOP",symbol:"LOOP",decimals:18},rpcUrls:{default:{http:["https://api.mainnetloop.com"]}},blockExplorers:{default:{name:"LoopNetwork Blockchain Explorer",url:"https://explorer.mainnetloop.com/"}},testnet:!1}),lukso=defineChain({id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network",apiUrl:"https://api.explorer.execution.mainnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:468183}}}),luksoTestnet=defineChain({id:4201,name:"LUKSO Testnet",nativeCurrency:{decimals:18,name:"LUKSO Testnet",symbol:"LYXt"},rpcUrls:{default:{http:["https://rpc.testnet.lukso.network"],webSocket:["wss://ws-rpc.testnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Testnet Explorer",url:"https://explorer.execution.testnet.lukso.network",apiUrl:"https://api.explorer.execution.testnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:605348}},testnet:!0}),lycan=defineChain({id:721,name:"Lycan",nativeCurrency:{decimals:18,name:"Lycan",symbol:"LYC"},rpcUrls:{default:{http:["https://rpc.lycanchain.com","https://us-east.lycanchain.com","https://us-west.lycanchain.com","https://eu-north.lycanchain.com","https://eu-west.lycanchain.com","https://asia-southeast.lycanchain.com"],webSocket:["wss://rpc.lycanchain.com","wss://us-east.lycanchain.com","wss://us-west.lycanchain.com","wss://eu-north.lycanchain.com","wss://eu-west.lycanchain.com","wss://asia-southeast.lycanchain.com"]}},blockExplorers:{default:{name:"Lycan Explorer",url:"https://explorer.lycanchain.com"}}}),lyra=defineChain({id:957,name:"Lyra Chain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.lyra.finance"]}},blockExplorers:{default:{name:"Lyra Explorer",url:"https://explorer.lyra.finance",apiUrl:"https://explorer.lyra.finance/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1935198}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),mandala=defineChain({id:595,name:"Mandala TC9",network:"mandala",nativeCurrency:{name:"Mandala",symbol:"mACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]}},blockExplorers:{default:{name:"Mandala Blockscout",url:"https://blockscout.mandala.aca-staging.network",apiUrl:"https://blockscout.mandala.aca-staging.network/api"}},testnet:!0}),manta=defineChain({id:169,name:"Manta Pacific Mainnet",network:"manta",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.manta.network/http"]}},blockExplorers:{default:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network",apiUrl:"https://pacific-explorer.manta.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:332890}}}),mantaSepoliaTestnet=defineChain({id:3441006,name:"Manta Pacific Sepolia Testnet",network:"manta-sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.sepolia-testnet.manta.network/http"]}},blockExplorers:{default:{name:"Manta Sepolia Testnet Explorer",url:"https://pacific-explorer.sepolia-testnet.manta.network",apiUrl:"https://pacific-explorer.sepolia-testnet.manta.network/api"}},contracts:{multicall3:{address:"0xca54918f7B525C8df894668846506767412b53E3",blockCreated:479584}},testnet:!0}),mantaTestnet=defineChain({id:3441005,name:"Manta Pacific Testnet",network:"manta-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://manta-testnet.calderachain.xyz/http"]}},blockExplorers:{default:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network",apiUrl:"https://pacific-explorer.testnet.manta.network/api"}},contracts:{multicall3:{address:"0x211B1643b95Fe76f11eD8880EE810ABD9A4cf56C",blockCreated:419915}},testnet:!0}),mantle=defineChain({id:5e3,name:"Mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Explorer",url:"https://mantlescan.xyz/",apiUrl:"https://api.mantlescan.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:304717}}}),mantleSepoliaTestnet=defineChain({id:5003,name:"Mantle Sepolia Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.sepolia.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.sepolia.mantle.xyz/",apiUrl:"https://explorer.sepolia.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4584012}},testnet:!0}),mantleTestnet=defineChain({id:5001,name:"Mantle Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz",apiUrl:"https://explorer.testnet.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:561333}},testnet:!0}),mapProtocol=defineChain({id:22776,name:"MAP Protocol",nativeCurrency:{decimals:18,name:"MAPO",symbol:"MAPO"},rpcUrls:{default:{http:["https://rpc.maplabs.io"]}},blockExplorers:{default:{name:"MAPO Scan",url:"https://maposcan.io"}},testnet:!1}),matchain=defineChain({id:698,name:"Matchain",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://matchscan.io"}}}),matchainTestnet=defineChain({id:699,name:"Matchain Testnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://testnet.matchscan.io"}},testnet:!0}),meld=defineChain({id:333000333,name:"Meld",nativeCurrency:{decimals:18,name:"Meld",symbol:"MELD"},rpcUrls:{default:{http:["https://rpc-1.meld.com"]}},blockExplorers:{default:{name:"MELDscan",url:"https://meldscan.io"}},contracts:{multicall3:{address:"0x769ee5a8e82c15c1b6e358f62ac8eb6e3abe8dc5",blockCreated:360069}}}),merlin=defineChain({id:4200,name:"Merlin",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.merlinchain.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://scan.merlinchain.io",apiUrl:"https://scan.merlinchain.io/api"}}}),metachain=defineChain({id:571,name:"MetaChain Mainnet",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://rpc.metatime.com"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://explorer.metatime.com"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}}}),metachainIstanbul=defineChain({id:1453,name:"MetaChain Istanbul",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://istanbul-rpc.metachain.dev"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://istanbul-explorer.metachain.dev"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}},testnet:!0}),sourceId$o=1,metalL2=defineChain({...chainConfig$2,id:1750,name:"Metal L2",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.metall2.com"],webSocket:["wss://rpc.metall2.com"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.metall2.com",apiUrl:"https://explorer.metall2.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$o]:{address:"0x3B1F7aDa0Fcc26B13515af752Dd07fB1CAc11426"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0},portal:{[sourceId$o]:{address:"0x3F37aBdE2C6b5B2ed6F8045787Df1ED1E3753956"}},l1StandardBridge:{[sourceId$o]:{address:"0x6d0f65D59b55B0FEC5d2d15365154DcADC140BF3"}}},sourceId:sourceId$o}),meter=defineChain({id:82,name:"Meter",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpc.meter.io"]}},blockExplorers:{default:{name:"MeterScan",url:"https://scan.meter.io"}}}),meterTestnet=defineChain({id:83,name:"Meter Testnet",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpctest.meter.io"]}},blockExplorers:{default:{name:"MeterTestnetScan",url:"https://scan-warringstakes.meter.io"}}}),metis=defineChain({id:1088,name:"Metis",nativeCurrency:{decimals:18,name:"Metis",symbol:"METIS"},rpcUrls:{default:{http:["https://andromeda.metis.io/?owner=1088"]}},blockExplorers:{default:{name:"Metis Explorer",url:"https://explorer.metis.io",apiUrl:"https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2338552}}}),metisGoerli=defineChain({id:599,name:"Metis Goerli",nativeCurrency:{decimals:18,name:"Metis Goerli",symbol:"METIS"},rpcUrls:{default:{http:["https://goerli.gateway.metisdevops.link"]}},blockExplorers:{default:{name:"Metis Goerli Explorer",url:"https://goerli.explorer.metisdevops.link",apiUrl:"https://goerli.explorer.metisdevops.link/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1006207}}}),mev=defineChain({id:7518,name:"MEVerse Chain Mainnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversemainnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://www.meversescan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:86881340}}}),mevTestnet=defineChain({id:4759,name:"MEVerse Chain Testnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversetestnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.meversescan.io/"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:64371115}},testnet:!0}),mint=defineChain({id:185,name:"Mint Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain explorer",url:"https://explorer.mintchain.io"}},testnet:!1}),mintSepoliaTestnet=defineChain({id:1686,name:"Mint Sepolia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain Testnet explorer",url:"https://testnet-explorer.mintchain.io"}},testnet:!0}),sourceId$n=1,mode$1=defineChain({...chainConfig$2,id:34443,name:"Mode Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.mode.network"]}},blockExplorers:{default:{name:"Modescan",url:"https://modescan.io"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2465882},l2OutputOracle:{[sourceId$n]:{address:"0x4317ba146D4933D889518a3e5E11Fe7a53199b04"}},portal:{[sourceId$n]:{address:"0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07"}},l1StandardBridge:{[sourceId$n]:{address:"0x735aDBbE72226BD52e818E7181953f42E3b0FF21"}}},sourceId:sourceId$n}),sourceId$m=11155111,modeTestnet=defineChain({...chainConfig$2,id:919,name:"Mode Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.mode.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.mode.network",apiUrl:"https://sepolia.explorer.mode.network/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$m]:{address:"0x2634BD65ba27AB63811c74A63118ACb312701Bfa",blockCreated:3778393}},portal:{[sourceId$m]:{address:"0x320e1580effF37E008F1C92700d1eBa47c1B23fD",blockCreated:3778395}},l1StandardBridge:{[sourceId$m]:{address:"0xbC5C679879B2965296756CD959C3C739769995E2",blockCreated:3778392}},multicall3:{address:"0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF",blockCreated:3019007}},testnet:!0,sourceId:sourceId$m}),moonbaseAlpha=defineChain({id:1287,name:"Moonbase Alpha",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonbase.moonscan.io",apiUrl:"https://moonbase.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1850686}},testnet:!0}),moonbeam=defineChain({id:1284,name:"Moonbeam",nativeCurrency:{decimals:18,name:"GLMR",symbol:"GLMR"},rpcUrls:{default:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonscan.io",apiUrl:"https://api-moonbeam.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:609002}},testnet:!1}),moonbeamDev=defineChain({id:1281,name:"Moonbeam Development Node",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]}}}),moonriver=defineChain({id:1285,name:"Moonriver",nativeCurrency:{decimals:18,name:"MOVR",symbol:"MOVR"},rpcUrls:{default:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonriver.moonscan.io",apiUrl:"https://api-moonriver.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1597904}},testnet:!1}),morph=defineChain({id:2818,name:"Morph",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.morphl2.io"],webSocket:["wss://rpc.morphl2.io:8443"]}},blockExplorers:{default:{name:"Morph Explorer",url:"https://explorer.morphl2.io"}},testnet:!1}),morphHolesky=defineChain({id:2810,name:"Morph Holesky",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-quicknode-holesky.morphl2.io"],webSocket:["wss://rpc-quicknode-holesky.morphl2.io"]}},blockExplorers:{default:{name:"Morph Holesky Explorer",url:"https://explorer-holesky.morphl2.io",apiUrl:"https://explorer-api-holesky.morphl2.io/api?"}},testnet:!0}),morphSepolia=defineChain({id:2710,name:"Morph Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.morphl2.io"]}},blockExplorers:{default:{name:"Morph Testnet Explorer",url:"https://explorer-testnet.morphl2.io",apiUrl:"https://explorer-api-testnet.morphl2.io/api"}},testnet:!0}),nautilus=defineChain({id:22222,name:"Nautilus Mainnet",nativeCurrency:{name:"ZBC",symbol:"ZBC",decimals:9},rpcUrls:{default:{http:["https://api.nautilus.nautchain.xyz"]}},blockExplorers:{default:{name:"NautScan",url:"https://nautscan.com"}}}),neonDevnet=defineChain({id:245022926,name:"Neon EVM DevNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://devnet.neonevm.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://devnet.neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:205206112}},testnet:!0}),neonMainnet=defineChain({id:245022934,network:"neonMainnet",name:"Neon EVM MainNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://neon-proxy-mainnet.solana.p2p.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:206545524}},testnet:!1}),nexi=defineChain({id:4242,name:"Nexi",nativeCurrency:{name:"Nexi",symbol:"NEXI",decimals:18},rpcUrls:{default:{http:["https://rpc.chain.nexi.technology"]}},blockExplorers:{default:{name:"NexiScan",url:"https://www.nexiscan.com",apiUrl:"https://www.nexiscan.com/api"}},contracts:{multicall3:{address:"0x0277A46Cc69A57eE3A6C8c158bA874832F718B8E",blockCreated:25770160}}}),nexilix=defineChain({id:240,name:"Nexilix Smart Chain",nativeCurrency:{decimals:18,name:"Nexilix",symbol:"NEXILIX"},rpcUrls:{default:{http:["https://rpcurl.pos.nexilix.com"]}},blockExplorers:{default:{name:"NexilixScan",url:"https://scan.nexilix.com"}},contracts:{multicall3:{address:"0x58381c8e2BF9d0C2C4259cA14BdA9Afe02831244",blockCreated:74448}}}),oasisTestnet=defineChain({id:4090,network:"oasis-testnet",name:"Oasis Testnet",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.oasis.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://oasis.ftnscan.com",apiUrl:"https://oasis.ftnscan.com/api"}},testnet:!0}),oasys=defineChain({id:248,name:"Oasys",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.oasys.games"]}},blockExplorers:{default:{name:"OasysScan",url:"https://scan.oasys.games",apiUrl:"https://scan.oasys.games/api"}}}),odysseyTestnet=defineChain({id:911867,name:"Odyssey Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://odyssey.ithaca.xyz"]}},blockExplorers:{default:{name:"Odyssey Explorer",url:"https://odyssey-explorer.ithaca.xyz",apiUrl:"https://odyssey-explorer.ithaca.xyz/api"}},testnet:!0}),okc=defineChain({id:66,name:"OKC",nativeCurrency:{decimals:18,name:"OKT",symbol:"OKT"},rpcUrls:{default:{http:["https://exchainrpc.okex.org"]}},blockExplorers:{default:{name:"oklink",url:"https://www.oklink.com/okc"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10364792}}}),oortMainnetDev=defineChain({id:9700,name:"OORT MainnetDev",nativeCurrency:{decimals:18,name:"OORT",symbol:"OORT"},rpcUrls:{default:{http:["https://dev-rpc.oortech.com"]}},blockExplorers:{default:{name:"OORT MainnetDev Explorer",url:"https://dev-scan.oortech.com"}}}),sourceId$l=56,opBNB=defineChain({id:204,name:"opBNB",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opBNB (BSCScan)",url:"https://opbnb.bscscan.com",apiUrl:"https://api-opbnb.bscscan.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:512881},l2OutputOracle:{[sourceId$l]:{address:"0x153CAB79f4767E2ff862C94aa49573294B13D169"}},portal:{[sourceId$l]:{address:"0x1876EA7702C0ad0C6A2ae6036DE7733edfBca519"}},l1StandardBridge:{[sourceId$l]:{address:"0xF05F0e4362859c3331Cb9395CBC201E3Fa6757Ea"}}},sourceId:sourceId$l}),sourceId$k=97,opBNBTestnet=defineChain({id:5611,name:"opBNB Testnet",nativeCurrency:{decimals:18,name:"tBNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://opbnb-testnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://testnet.opbnbscan.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3705108},l2OutputOracle:{[sourceId$k]:{address:"0xFf2394Bb843012562f4349C6632a0EcB92fC8810"}},portal:{[sourceId$k]:{address:"0x4386C8ABf2009aC0c263462Da568DD9d46e52a31"}},l1StandardBridge:{[sourceId$k]:{address:"0x677311Fd2cCc511Bbc0f581E8d9a07B033D5E840"}}},testnet:!0,sourceId:sourceId$k}),sourceId$j=1,optimism=defineChain({...chainConfig$2,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$j]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId$j]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId$j]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId$j]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:sourceId$j}),sourceId$i=5,optimismGoerli=defineChain({...chainConfig$2,id:420,name:"Optimism Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io",apiUrl:"https://goerli-optimism.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$i]:{address:"0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461},portal:{[sourceId$i]:{address:"0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383"}},l1StandardBridge:{[sourceId$i]:{address:"0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"}}},testnet:!0,sourceId:sourceId$i}),sourceId$h=11155111,optimismSepolia=defineChain({...chainConfig$2,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$h]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[sourceId$h]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[sourceId$h]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[sourceId$h]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:sourceId$h}),optopia=defineChain({id:62050,name:"Optopia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan.optopia.ai"}},testnet:!1}),optopiaTestnet=defineChain({id:62049,name:"Optopia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan-testnet.optopia.ai"}},testnet:!0}),orderly=defineChain({id:291,name:"Orderly",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.orderly.network"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorer.orderly.network"}},testnet:!1}),orderlySepolia=defineChain({id:4460,name:"Orderly Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://l2-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorerl2new-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"}},testnet:!0}),otimDevnet=defineChain({id:41144114,name:"Otim Devnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["http://devnet.otim.xyz"]}},contracts:{batchInvoker:{address:"0x5FbDB2315678afecb367f032d93F642f64180aa3"}}}),palm=defineChain({id:11297108109,name:"Palm",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}}}),palmTestnet=defineChain({id:11297108099,name:"Palm Testnet",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}},testnet:!0}),sourceId$g=1,pgn=defineChain({id:424,network:"pgn",name:"PGN",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Explorer",url:"https://explorer.publicgoods.network",apiUrl:"https://explorer.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$g]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3380209},portal:{[sourceId$g]:{address:"0xb26Fd985c5959bBB382BAFdD0b879E149e48116c"}},l1StandardBridge:{[sourceId$g]:{address:"0xD0204B9527C1bA7bD765Fa5CCD9355d38338272b"}}},formatters:formatters$1,sourceId:sourceId$g}),sourceId$f=11155111,pgnTestnet=defineChain({id:58008,network:"pgn-testnet",name:"PGN ",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network",apiUrl:"https://explorer.sepolia.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$f]:{address:"0xD5bAc3152ffC25318F848B3DD5dA6C85171BaEEe"}},portal:{[sourceId$f]:{address:"0xF04BdD5353Bb0EFF6CA60CfcC78594278eBfE179"}},l1StandardBridge:{[sourceId$f]:{address:"0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3754925}},formatters:formatters$1,sourceId:sourceId$f,testnet:!0}),phoenix=defineChain({id:13381,name:"Phoenix Blockchain",nativeCurrency:{name:"Phoenix",symbol:"PHX",decimals:18},rpcUrls:{default:{http:["https://rpc.phoenixplorer.com"]}},blockExplorers:{default:{name:"Phoenixplorer",url:"https://phoenixplorer.com",apiUrl:"https://phoenixplorer.com/api"}},contracts:{multicall3:{address:"0x498cF757a575cFF2c2Ed9f532f56Efa797f86442",blockCreated:5620192}}}),playfiAlbireo=defineChain({...chainConfig$3,id:1612127,name:"PlayFi Albireo Testnet",network:"albireo",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://albireo-rpc.playfi.ai"],webSocket:["wss://albireo-rpc-ws.playfi.ai/ws"]}},blockExplorers:{default:{name:"PlayFi Albireo Explorer",url:"https://albireo-explorer.playfi.ai"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0}),plinga=defineChain({id:242,name:"Plinga",nativeCurrency:{name:"Plinga",symbol:"PLINGA",decimals:18},rpcUrls:{default:{http:["https://rpcurl.mainnet.plgchain.com"]}},blockExplorers:{default:{name:"Plgscan",url:"https://www.plgscan.com"}},contracts:{multicall3:{address:"0x0989576160f2e7092908BB9479631b901060b6e4",blockCreated:204489}}}),sourceId$e=11155111,plumeTestnet=defineChain({id:161221135,name:"Plume Testnet",nativeCurrency:{name:"Plume Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.plumenetwork.xyz/http"],webSocket:["wss://testnet-rpc.plumenetwork.xyz/ws"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.plumenetwork.xyz",apiUrl:"https://testnet-explorer.plumenetwork.xyz/api"}},testnet:!0,sourceId:sourceId$e}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),polygonAmoy=defineChain({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api-amoy.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0}),polygonMumbai=defineChain({id:80001,name:"Polygon Mumbai",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/polygon_mumbai"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com",apiUrl:"https://api-testnet.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}},testnet:!0}),polygonZkEvm=defineChain({id:1101,name:"Polygon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://zkevm.polygonscan.com",apiUrl:"https://api-zkevm.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:57746}}}),polygonZkEvmCardona=defineChain({id:2442,name:"Polygon zkEVM Cardona",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://cardona-zkevm.polygonscan.com",apiUrl:"https://cardona-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:114091}}}),polygonZkEvmTestnet=defineChain({id:1442,name:"Polygon zkEVM Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com",apiUrl:"https://testnet-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),pulsechain=defineChain({id:369,name:"PulseChain",nativeCurrency:{name:"Pulse",symbol:"PLS",decimals:18},testnet:!1,rpcUrls:{default:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.pulsechain.com",apiUrl:"https://api.scan.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),pulsechainV4=defineChain({id:943,name:"PulseChain V4",testnet:!0,nativeCurrency:{name:"V4 Pulse",symbol:"v4PLS",decimals:18},rpcUrls:{default:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.v4.testnet.pulsechain.com",apiUrl:"https://scan.v4.testnet.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),ql1=defineChain({id:766,name:"QL1",nativeCurrency:{decimals:18,name:"QOM",symbol:"QOM"},rpcUrls:{default:{http:["https://rpc.qom.one"]}},blockExplorers:{default:{name:"Ql1 Explorer",url:"https://scan.qom.one"}},contracts:{multicall3:{address:"0x7A52370716ea730585884F5BDB0f6E60C39b8C64"}},testnet:!1}),qMainnet=defineChain({id:35441,name:"Q Mainnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.q.org"]}},blockExplorers:{default:{name:"Q Mainnet Explorer",url:"https://explorer.q.org",apiUrl:"https://explorer.q.org/api"}}}),qTestnet=defineChain({id:35443,name:"Q Testnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.qtestnet.org"]}},blockExplorers:{default:{name:"Q Testnet Explorer",url:"https://explorer.qtestnet.org",apiUrl:"https://explorer.qtestnet.org/api"}},testnet:!0}),real=defineChain({id:111188,name:"re.al",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://real.drpc.org"]}},blockExplorers:{default:{name:"re.al Explorer",url:"https://explorer.re.al",apiUrl:"https://explorer.re.al/api/v2"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:695}}}),redbellyTestnet=defineChain({id:153,name:"Redbelly Network Testnet",nativeCurrency:{name:"Redbelly Native Coin",symbol:"RBNT",decimals:18},rpcUrls:{default:{http:["https://governors.testnet.redbelly.network"]}},blockExplorers:{default:{name:"Ethernal",url:"https://explorer.testnet.redbelly.network",apiUrl:"https://ethernal.fly.dev/api"}},testnet:!0}),sourceId$d=1,redstone=defineChain({...chainConfig$2,name:"Redstone",id:690,sourceId:sourceId$d,nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.redstonechain.com"],webSocket:["wss://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$d]:{address:"0xC7bCb0e8839a28A1cFadd1CF716de9016CdA51ae",blockCreated:19578329}},l2OutputOracle:{[sourceId$d]:{address:"0xa426A052f657AEEefc298b3B5c35a470e4739d69",blockCreated:19578337}},l1StandardBridge:{[sourceId$d]:{address:"0xc473ca7E02af24c129c2eEf51F2aDf0411c1Df69",blockCreated:19578331}}}}),reyaNetwork=defineChain({id:1729,name:"Reya Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.reya.network"],webSocket:["wss://ws.reya.network"]}},blockExplorers:{default:{name:"Reya Network Explorer",url:"https://explorer.reya.network"}},testnet:!1}),rollux=defineChain({id:570,name:"Rollux Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.rollux.com"],webSocket:["wss://rpc.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxExplorer",url:"https://explorer.rollux.com",apiUrl:"https://explorer.rollux.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:119222}}}),rolluxTestnet=defineChain({id:57e3,name:"Rollux Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc-tanenbaum.rollux.com/"],webSocket:["wss://rpc-tanenbaum.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxTestnetExplorer",url:"https://rollux.tanenbaum.io",apiUrl:"https://rollux.tanenbaum.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1813675}}}),ronin=defineChain({id:2020,name:"Ronin",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://api.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Ronin Explorer",url:"https://app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:26023535}}}),root$c=defineChain({id:7668,name:"The Root Network",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://root.rootnet.live/archive"],webSocket:["wss://root.rootnet.live/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:9218338}}}),rootPorcini=defineChain({id:7672,name:"The Root Network - Porcini",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://porcini.rootnet.app/archive"],webSocket:["wss://porcini.rootnet.app/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://porcini.rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:10555692}},testnet:!0}),rootstock=defineChain({id:30,name:"Rootstock Mainnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"RBTC"},rpcUrls:{default:{http:["https://public-node.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.rsk.co"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4249540}}}),rootstockTestnet=defineChain({id:31,name:"Rootstock Testnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"tRBTC"},rpcUrls:{default:{http:["https://public-node.testnet.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.testnet.rootstock.io"}},testnet:!0}),sourceId$c=1,rss3=defineChain({...chainConfig$2,id:12553,name:"RSS3 VSL Mainnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Mainnet Scan",url:"https://scan.rss3.io",apiUrl:"https://scan.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$c]:{address:"0xE6f24d2C32B3109B18ed33cF08eFb490b1e09C10"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14193},portal:{[sourceId$c]:{address:"0x6A12432491bbbE8d3babf75F759766774C778Db4",blockCreated:19387057}},l1StandardBridge:{[sourceId$c]:{address:"0x4cbab69108Aa72151EDa5A3c164eA86845f18438"}}},sourceId:sourceId$c}),sourceId$b=11155111,rss3Sepolia=defineChain({...chainConfig$2,id:2331,name:"RSS3 VSL Sepolia Testnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Sepolia Testnet Scan",url:"https://scan.testnet.rss3.io",apiUrl:"https://scan.testnet.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$b]:{address:"0xDb5c46C3Eaa6Ed6aE8b2379785DF7dd029C0dC81"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:55697},portal:{[sourceId$b]:{address:"0xcBD77E8E1E7F06B25baDe67142cdE82652Da7b57",blockCreated:5345035}},l1StandardBridge:{[sourceId$b]:{address:"0xdDD29bb63B0839FB1cE0eE439Ff027738595D07B"}}},testnet:!0,sourceId:sourceId$b}),saigon=defineChain({id:2021,name:"Saigon Testnet",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://saigon-testnet.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Saigon Explorer",url:"https://saigon-app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18736871}},testnet:!0}),sanko=defineChain({id:1996,name:"Sanko",nativeCurrency:{name:"DMT",symbol:"DMT",decimals:18},rpcUrls:{default:{http:["https://mainnet.sanko.xyz"]}},blockExplorers:{default:{name:"Sanko Explorer",url:"https://explorer.sanko.xyz"}},testnet:!1}),sapphire=defineChain({id:23294,name:"Oasis Sapphire",network:"sapphire",nativeCurrency:{name:"Sapphire Rose",symbol:"ROSE",decimals:18},rpcUrls:{default:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/mainnet/sapphire"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:734531}}}),sapphireTestnet=defineChain({id:23295,name:"Oasis Sapphire Testnet",network:"sapphire-testnet",nativeCurrency:{name:"Sapphire Test Rose",symbol:"TEST",decimals:18},rpcUrls:{default:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/testnet/sapphire"}},testnet:!0}),satoshiVM=defineChain({id:3109,name:"SatoshiVM Alpha Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://alpha-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://svmscan.io",apiUrl:"https://svmscan.io/api"}}}),satoshiVMTestnet=defineChain({id:3110,name:"SatoshiVM Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://test-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet.svmscan.io",apiUrl:"https://testnet.svmscan.io/api"}},testnet:!0}),scroll=defineChain({id:534352,name:"Scroll",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://scrollscan.com",apiUrl:"https://api.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14}},testnet:!1}),scrollSepolia=defineChain({id:534351,name:"Scroll Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://sepolia.scrollscan.com",apiUrl:"https://api-sepolia.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),sei=defineChain({id:1329,name:"Sei Network",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc.sei-apis.com/"],webSocket:["wss://evm-ws.sei-apis.com/"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com",apiUrl:"https://seitrace.com/pacific-1/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}}}),seiDevnet=defineChain({id:713715,name:"Sei Devnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-arctic-1.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),seiTestnet=defineChain({id:1328,name:"Sei Testnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-testnet.sei-apis.com"],webSocket:["wss://evm-ws-testnet.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),sepolia=defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc2.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),sourceId$a=1,shape=defineChain({...chainConfig$2,id:360,name:"Shape",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.shape.network"]}},blockExplorers:{default:{name:"shapescan",url:"https://shapescan.xyz",apiUrl:"https://shapescan.xyz/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$a]:{address:"0x6Ef8c69CfE4635d866e3E02732068022c06e724D",blockCreated:20369940}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1},portal:{[sourceId$a]:{address:"0xEB06fFa16011B5628BaB98E29776361c83741dd3",blockCreated:20369933}},l1StandardBridge:{[sourceId$a]:{address:"0x62Edd5f4930Ea92dCa3fB81689bDD9b9d076b57B",blockCreated:20369935}}},sourceId:sourceId$a}),sourceId$9=11155111,shapeSepolia=defineChain({...chainConfig$2,id:11011,name:"Shape Sepolia Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.shape.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer-sepolia.shape.network/",apiUrl:"https://explorer-sepolia.shape.network/api/v2"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1}},testnet:!0,sourceId:sourceId$9}),shardeumSphinx=defineChain({id:8082,name:"Shardeum Sphinx",nativeCurrency:{name:"SHARDEUM",symbol:"SHM",decimals:18},rpcUrls:{default:{http:["https://sphinx.shardeum.org"]}},blockExplorers:{default:{name:"Shardeum Explorer",url:"https://explorer-sphinx.shardeum.org"}},testnet:!0}),shibarium=defineChain({id:109,name:"Shibarium",network:"shibarium",nativeCurrency:{name:"Bone",symbol:"BONE",decimals:18},rpcUrls:{default:{http:["https://rpc.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://shibariumscan.io"}},contracts:{multicall3:{address:"0x864Bf681ADD6052395188A89101A1B37d3B4C961",blockCreated:265900}}}),shibariumTestnet=defineChain({id:157,name:"Puppynet Shibarium",nativeCurrency:{decimals:18,name:"Bone",symbol:"BONE"},rpcUrls:{default:{http:["https://puppynet.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://puppyscan.shib.io",apiUrl:"https://puppyscan.shib.io/api"}},contracts:{multicall3:{address:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",blockCreated:3035769}},testnet:!0}),shiden=defineChain({id:336,name:"Shiden",nativeCurrency:{decimals:18,name:"SDN",symbol:"SDN"},rpcUrls:{default:{http:["https://shiden.public.blastapi.io"],webSocket:["wss://shiden-rpc.dwellir.com"]}},blockExplorers:{default:{name:"Shiden Scan",url:"https://shiden.subscan.io"}},testnet:!1}),shimmer=defineChain({id:148,name:"Shimmer",network:"shimmer",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.shimmer.network",apiUrl:"https://explorer.evm.shimmer.network/api"}}}),shimmerTestnet=defineChain({id:1073,name:"Shimmer Testnet",network:"shimmer-testnet",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.testnet.shimmer.network",apiUrl:"https://explorer.evm.testnet.shimmer.network/api"}},testnet:!0}),silicon=defineChain({id:2355,name:"Silicon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.silicon.network","https://silicon-mainnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconScope",url:"https://scope.silicon.network"}}}),siliconSepolia=defineChain({id:1722641160,name:"Silicon Sepolia zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-sepolia.silicon.network","https://silicon-testnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconSepoliaScope",url:"https://scope-sepolia.silicon.network"}},testnet:!0}),skaleBlockBrawlers=defineChain({id:391845894,name:"SKALE | Block Brawlers",nativeCurrency:{name:"BRAWL",symbol:"BRAWL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCalypso=defineChain({id:1564830818,name:"SKALE | Calypso NFT Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3107626}}}),skaleCalypsoTestnet=defineChain({id:974399131,name:"SKALE Calypso Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/giant-half-dual-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/giant-half-dual-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://giant-half-dual-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:103220}},testnet:!0}),skaleCryptoBlades=defineChain({id:1026062157,name:"SKALE | CryptoBlades",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCryptoColosseum=defineChain({id:1032942172,name:"SKALE | Crypto Colosseum",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleEuropa=defineChain({id:2046399126,name:"SKALE | Europa Liquidity Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3113495}}}),skaleEuropaTestnet=defineChain({id:1444673419,name:"SKALE Europa Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/juicy-low-small-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/juicy-low-small-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://juicy-low-small-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:110858}},testnet:!0}),skaleExorde=defineChain({id:2139927552,name:"SKALE | Exorde",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleHumanProtocol=defineChain({id:1273227453,name:"SKALE | Human Protocol",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleNebula=defineChain({id:1482601649,name:"SKALE | Nebula Gaming Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2372986}}}),skaleNebulaTestnet=defineChain({id:37084624,name:"SKALE Nebula Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/lanky-ill-funny-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/lanky-ill-funny-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:105141}},testnet:!0}),skaleRazor=defineChain({id:278611351,name:"SKALE | Razor Network",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleTitan=defineChain({id:1350216234,name:"SKALE | Titan Community Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2076458}}}),skaleTitanTestnet=defineChain({id:1020352220,name:"SKALE Titan Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/aware-fake-trim-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/aware-fake-trim-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://aware-fake-trim-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:104072}},testnet:!0}),sketchpad=defineChain({id:984123,name:"Forma Sketchpad",network:"sketchpad",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.sketchpad-1.forma.art"],webSocket:["wss://ws.sketchpad-1.forma.art"]}},blockExplorers:{default:{name:"Sketchpad Explorer",url:"https://explorer.sketchpad-1.forma.art"}},testnet:!0}),sourceId$8=1,snax=defineChain({...chainConfig$2,id:2192,network:"snaxchain-mainnet",name:"SnaxChain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://explorer.snaxchain.io",apiUrl:"https://explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$8]:{address:"0x472562Fcf26D6b2793f8E0b0fB660ba0E5e08A46"}},l2OutputOracle:{[sourceId$8]:{address:"0x2172e492Fc807F5d5645D0E3543f139ECF539294"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$8]:{address:"0x79f446D024d74D0Bb6E699C131c703463c5D65E9"}},l1StandardBridge:{[sourceId$8]:{address:"0x6534Bdb6b5c060d3e6aa833433333135eFE8E0aA"}}},sourceId:sourceId$8}),sourceId$7=11155111,snaxTestnet=defineChain({...chainConfig$2,id:13001,network:"snaxchain-testnet",name:"SnaxChain Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://testnet-explorer.snaxchain.io",apiUrl:"https://testnet-explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$7]:{address:"0x206a75d89d45F146C54020F132FF93bEDD09f55E"}},l2OutputOracle:{[sourceId$7]:{address:"0x60e3A368a4cdCEf85ffB964e372726F56A46221e"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$7]:{address:"0xb5afdd0E8dDF081Ef90e8A3e0c7b5798e66E954E"}},l1StandardBridge:{[sourceId$7]:{address:"0xbd37E1a59D4C00C9A46F75018dffd84061bC5f74"}}},testnet:!0,sourceId:sourceId$7}),sourceId$6=11155111,soneiumMinato=defineChain({...chainConfig$2,id:1946,name:"Soneium Minato Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.minato.soneium.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer-testnet.soneium.org",apiUrl:"https://explorer-testnet.soneium.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$6]:{address:"0xF69dB6cA559C52d9A4BB6e2B2901f490Ca35Fbf6"}},l2OutputOracle:{[sourceId$6]:{address:"0x710e5286C746eC38beeB7538d0146f60D27be343"}},portal:{[sourceId$6]:{address:"0x65ea1489741A5D72fFdD8e6485B216bBdcC15Af3",blockCreated:6466136}},l1StandardBridge:{[sourceId$6]:{address:"0x5f5a404A5edabcDD80DB05E8e54A78c9EBF000C2",blockCreated:6466136}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1}},testnet:!0,sourceId:sourceId$6}),songbird=defineChain({id:19,name:"Songbird Canary-Network",nativeCurrency:{decimals:18,name:"Songbird",symbol:"SGB"},rpcUrls:{default:{http:["https://songbird-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Songbird Explorer",url:"https://songbird-explorer.flare.network",apiUrl:"https://songbird-explorer.flare.network/api"}}}),songbirdTestnet=defineChain({id:16,name:"Songbird Testnet Coston",nativeCurrency:{decimals:18,name:"Coston Flare",symbol:"CFLR"},rpcUrls:{default:{http:["https://coston-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston Explorer",url:"https://coston-explorer.flare.network",apiUrl:"https://coston-explorer.flare.network/api"}},testnet:!0}),sophonTestnet=defineChain({...chainConfig$3,id:531050104,name:"Sophon Testnet",nativeCurrency:{decimals:18,name:"Sophon",symbol:"SOPH"},rpcUrls:{default:{http:["https://rpc.testnet.sophon.xyz"],webSocket:["wss://rpc.testnet.sophon.xyz/ws"]}},blockExplorers:{default:{name:"Sophon Block Explorer",url:"https://explorer.testnet.sophon.xyz"}},contracts:{multicall3:{address:"0x83c04d112adedA2C6D9037bb6ecb42E7f0b108Af",blockCreated:15642}},testnet:!0}),spicy=defineChain({id:88882,name:"Chiliz Spicy Testnet",network:"chiliz-spicy-Testnet",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy-rpc.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"http://spicy-explorer.chiliz.com",apiUrl:"http://spicy-explorer.chiliz.com/api"}},testnet:!0}),step=defineChain({id:1234,name:"Step Network",nativeCurrency:{name:"FITFI",symbol:"FITFI",decimals:18},rpcUrls:{default:{http:["https://rpc.step.network"]}},blockExplorers:{default:{name:"Step Scan",url:"https://stepscan.io"}},testnet:!1}),storyTestnet=defineChain({id:1513,name:"Story Testnet",nativeCurrency:{decimals:18,name:"IP",symbol:"IP"},rpcUrls:{default:{http:["https://testnet.storyrpc.io"]}},blockExplorers:{default:{name:"Story Testnet Explorer",url:"https://testnet.storyscan.xyz"}},testnet:!0}),stratis=defineChain({id:105105,name:"Stratis Mainnet",network:"stratis",nativeCurrency:{name:"Stratis",symbol:"STRAX",decimals:18},rpcUrls:{default:{http:["https://rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Stratis Explorer",url:"https://explorer.stratisevm.com"}}}),superlumio=defineChain({id:8866,name:"SuperLumio",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.lumio.io"]}},blockExplorers:{default:{name:"Lumio explorer",url:"https://explorer.lumio.io"}},testnet:!1}),superposition=defineChain({id:55244,name:"Superposition",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.superposition.so"]}},blockExplorers:{default:{name:"Superposition Explorer",url:"https://explorer.superposition.so"}},testnet:!1}),swan=defineChain({id:254,name:"Swan Chain Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.swanchain.org"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://swanscan.io"}},testnet:!1}),swanProximaTestnet=defineChain({id:20241133,name:"Swan Proxima Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://rpc-proxima.swanchain.io "]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://proxima-explorer.swanchain.io"}},testnet:!0}),swanSaturnTestnet=defineChain({id:2024,name:"Swan Saturn Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://saturn-rpc.swanchain.io"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://saturn-explorer.swanchain.io"}},testnet:!0}),syscoin=defineChain({id:57,name:"Syscoin Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]}},blockExplorers:{default:{name:"SyscoinExplorer",url:"https://explorer.syscoin.org",apiUrl:"https://explorer.syscoin.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:287139}}}),syscoinTestnet=defineChain({id:5700,name:"Syscoin Tanenbaum Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]}},blockExplorers:{default:{name:"SyscoinTestnetExplorer",url:"https://tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:271288}}}),taiko=defineChain({id:167e3,name:"Taiko Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.mainnet.taiko.xyz"],webSocket:["wss://ws.mainnet.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://taikoscan.io",apiUrl:"https://api.taikoscan.io/api"}},contracts:{multicall3:{address:"0xcb2436774C3e191c85056d248EF4260ce5f27A9D"}}}),taikoHekla=defineChain({id:167009,name:"Taiko Hekla L2",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.hekla.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://hekla.taikoscan.network"}},testnet:!0}),taikoJolnir=defineChain({id:167007,name:"Taiko Jolnir (Alpha-5 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.jolnir.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.jolnir.taiko.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:732706}},testnet:!0}),taikoKatla=defineChain({id:167008,name:"Taiko Katla (Alpha-6 Testnet)",network:"tko-katla",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.katla.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.katla.taiko.xyz"}}}),taikoTestnetSepolia=defineChain({id:167005,name:"Taiko (Alpha-3 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.test.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.test.taiko.xyz"}}}),taraxa=defineChain({id:841,name:"Taraxa Mainnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.mainnet.taraxa.io"}}}),taraxaTestnet=defineChain({id:842,name:"Taraxa Testnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.testnet.taraxa.io"}},testnet:!0}),telcoinTestnet=defineChain({id:2017,name:"Telcoin Adiri Testnet",nativeCurrency:{name:"Telcoin",symbol:"TEL",decimals:18},rpcUrls:{default:{http:["https://rpc.telcoin.network"]}},blockExplorers:{default:{name:"telscan",url:"https://telscan.io"}},testnet:!0}),telos=defineChain({id:40,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://mainnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan",url:"https://www.teloscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:246530709}}}),telosTestnet=defineChain({id:41,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://testnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan (testnet)",url:"https://testnet.teloscan.io/"}},testnet:!0}),tenet=defineChain({id:1559,name:"Tenet",network:"tenet-mainnet",nativeCurrency:{name:"TENET",symbol:"TENET",decimals:18},rpcUrls:{default:{http:["https://rpc.tenet.org"]}},blockExplorers:{default:{name:"TenetScan Mainnet",url:"https://tenetscan.io",apiUrl:"https://tenetscan.io/api"}},testnet:!1}),thaiChain=defineChain({id:7,name:"ThaiChain",nativeCurrency:{name:"TCH",symbol:"TCH",decimals:18},rpcUrls:{default:{http:["https://rpc.thaichain.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.thaichain.org",apiUrl:"https://exp.thaichain.org/api"}},contracts:{multicall3:{address:"0x0DaD6130e832c21719C5CE3bae93454E16A84826",blockCreated:4806386}},testnet:!1}),that=defineChain({id:8428,name:"THAT Mainnet",nativeCurrency:{name:"THAT",symbol:"THAT",decimals:18},rpcUrls:{default:{http:["https://api.thatchain.io/mainnet"]}},blockExplorers:{default:{name:"Blockscout",url:"https://that.blockscout.com"}},testnet:!1}),theta$1=defineChain({id:361,name:"Theta Mainnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://explorer.thetatoken.org"}},testnet:!1}),thetaTestnet=defineChain({id:365,name:"Theta Testnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api-testnet.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://testnet-explorer.thetatoken.org"}},testnet:!0}),thunderCore=defineChain({id:108,name:"ThunderCore Mainnet",nativeCurrency:{name:"TT",symbol:"TT",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.thundercore.com"]}},blockExplorers:{default:{name:"ThunderCore Explorer",url:"https://viewblock.io/thundercore"}},testnet:!1}),thunderTestnet=defineChain({id:997,name:"5ireChain Thunder Testnet",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Explorer",url:"https://explorer.5ire.network"}},testnet:!0}),tiktrixTestnet=defineChain({id:62092,name:"TikTrix Testnet",nativeCurrency:{name:"tTTX",symbol:"tTTX",decimals:18},rpcUrls:{default:{http:["https://tiktrix-rpc.xyz"]}},blockExplorers:{default:{name:"TikTrix Testnet Explorer",url:"https://tiktrix.xyz"}},testnet:!0}),tomb=defineChain({id:6969,name:"Tomb Mainnet",nativeCurrency:{name:"TOMB",symbol:"TOMB",decimals:18},rpcUrls:{default:{http:["https://rpc.tombchain.com"]}},blockExplorers:{default:{name:"Tomb Explorer",url:"https://tombscout.com"}},testnet:!1}),tron=defineChain({id:728126428,name:"Tron",nativeCurrency:{name:"TRON",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://api.trongrid.io/jsonrpc"]}},blockExplorers:{default:{name:"Tronscan",url:"https://tronscan.org",apiUrl:"https://apilist.tronscanapi.com/api"}}}),ultron=defineChain({id:1231,name:"Ultron Mainnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-rpc.net"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://ulxscan.com"}},testnet:!1}),ultronTestnet=defineChain({id:1230,name:"Ultron Testnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-dev.io"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://explorer.ultron-dev.io"}},testnet:!0}),sourceId$5=11155111,unichainSepolia=defineChain({...chainConfig$2,id:1301,name:"Unichain Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.unichain.org"]}},blockExplorers:{default:{name:"Uniscan",url:"https://sepolia.uniscan.xyz",apiUrl:"https://api-sepolia.uniscan.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},portal:{[sourceId$5]:{address:"0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD"}},l1StandardBridge:{[sourceId$5]:{address:"0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2"}},disputeGameFactory:{[sourceId$5]:{address:"0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b"}}},testnet:!0,sourceId:sourceId$5}),unique=defineChain({id:8880,name:"Unique Mainnet",nativeCurrency:{decimals:18,name:"UNQ",symbol:"UNQ"},rpcUrls:{default:{http:["https://rpc.unique.network"]}},blockExplorers:{default:{name:"Unique Subscan",url:"https://unique.subscan.io/"}}}),uniqueOpal=defineChain({id:8882,name:"Opal Testnet",nativeCurrency:{decimals:18,name:"OPL",symbol:"OPL"},rpcUrls:{default:{http:["https://rpc-opal.unique.network"]}},blockExplorers:{default:{name:"Opal Subscan",url:"https://opal.subscan.io/"}},testnet:!0}),uniqueQuartz=defineChain({id:8881,name:"Quartz Mainnet",nativeCurrency:{decimals:18,name:"QTZ",symbol:"QTZ"},rpcUrls:{default:{http:["https://rpc-quartz.unique.network"]}},blockExplorers:{default:{name:"Quartz Subscan",url:"https://quartz.subscan.io/"}}}),unreal=defineChain({id:18233,name:"Unreal",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://rpc.unreal-orbit.gelato.digital"]}},blockExplorers:{default:{name:"Unreal Explorer",url:"https://unreal.blockscout.com",apiUrl:"https://unreal.blockscout.com/api/v2"}},testnet:!0,contracts:{multicall3:{address:"0x8b6B0e60D8CD84898Ea8b981065A12F876eA5677",blockCreated:1745}}}),vechain=defineChain({id:100009,name:"Vechain",nativeCurrency:{name:"VeChain",symbol:"VET",decimals:18},rpcUrls:{default:{http:["https://mainnet.vechain.org"]}},blockExplorers:{default:{name:"Vechain Explorer",url:"https://explore.vechain.org"},vechainStats:{name:"Vechain Stats",url:"https://vechainstats.com"}}}),velas=defineChain({id:106,name:"Velas EVM Mainnet",nativeCurrency:{name:"VLX",symbol:"VLX",decimals:18},rpcUrls:{default:{http:["https://evmexplorer.velas.com/rpc"]}},blockExplorers:{default:{name:"Velas Explorer",url:"https://evmexplorer.velas.com"}},testnet:!1}),viction=defineChain({id:88,name:"Viction",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://vicscan.xyz"}},testnet:!1}),victionTestnet=defineChain({id:89,name:"Viction Testnet",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://testnet.vicscan.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:12170179}},testnet:!0}),vision=defineChain({id:888888,name:"Vision",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org"}},testnet:!1}),visionTestnet=defineChain({id:666666,name:"Vision Testnet",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://vpioneer.infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org/?chain=vpioneer"}},testnet:!0}),wanchain=defineChain({id:888,name:"Wanchain",nativeCurrency:{name:"WANCHAIN",symbol:"WAN",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]}},blockExplorers:{default:{name:"WanScan",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0xcDF6A1566e78EB4594c86Fe73Fcdc82429e97fbB",blockCreated:25312390}}}),wanchainTestnet=defineChain({id:999,name:"Wanchain Testnet",nativeCurrency:{name:"WANCHAIN",symbol:"WANt",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:46891"]}},blockExplorers:{default:{name:"WanScanTest",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0x11c89bF4496c39FB80535Ffb4c92715839CC5324",blockCreated:24743448}},testnet:!0}),weaveVMAlphanet=defineChain({id:9496,name:"WeaveVM Alphanet",nativeCurrency:{name:"Testnet WeaveVM",symbol:"tWVM",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.wvm.dev"]}},blockExplorers:{default:{name:"WeaveVM Alphanet Explorer",url:"https://explorer.wvm.dev"}},testnet:!0}),wemix=defineChain({id:1111,name:"WEMIX",network:"wemix-mainnet",nativeCurrency:{name:"WEMIX",symbol:"WEMIX",decimals:18},rpcUrls:{default:{http:["https://api.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://explorer.wemix.com"}}}),wemixTestnet=defineChain({id:1112,name:"WEMIX Testnet",network:"wemix-testnet",nativeCurrency:{name:"WEMIX",symbol:"tWEMIX",decimals:18},rpcUrls:{default:{http:["https://api.test.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://testnet.wemixscan.com",apiUrl:"https://testnet.wemixscan.com/api"}},testnet:!0}),sourceId$4=1,worldchain=defineChain({...chainConfig$2,id:480,name:"World Chain",network:"worldchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-mainnet.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan",url:"https://worldscan.org",apiUrl:"https://api.worldscan.org/api"},blockscout:{name:"Blockscout",url:"https://worldchain-mainnet.explorer.alchemy.com",apiUrl:"https://worldchain-mainnet.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$4]:{address:"0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52"}},l2OutputOracle:{[sourceId$4]:{address:"0x19A6d1E9034596196295CF148509796978343c5D"}},portal:{[sourceId$4]:{address:"0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C"}},l1StandardBridge:{[sourceId$4]:{address:"0x470458C91978D2d929704489Ad730DC3E3001113"}}},testnet:!1,sourceId:sourceId$4}),sourceId$3=11155111,worldchainSepolia=defineChain({...chainConfig$2,id:4801,name:"World Chain Sepolia",network:"worldchain-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-sepolia.g.alchemy.com/public"]},public:{http:["https://worldchain-sepolia.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan Sepolia",url:"https://sepolia.worldscan.org"},blockscout:{name:"Blockscout",url:"https://worldchain-sepolia.explorer.alchemy.com",apiUrl:"https://worldchain-sepolia.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$3]:{address:"0x8cF97Ee616C986a070F5020d973b456D0120C253"}},l2OutputOracle:{[sourceId$3]:{address:"0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e"}},portal:{[sourceId$3]:{address:"0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4"}},l1StandardBridge:{[sourceId$3]:{address:"0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE"}}},testnet:!0,sourceId:sourceId$3}),xai=defineChain({id:660279,name:"Xai Mainnet",nativeCurrency:{name:"Xai",symbol:"XAI",decimals:18},rpcUrls:{default:{http:["https://xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.xai-chain.net"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:222549}},testnet:!1}),xaiTestnet=defineChain({id:37714555429,name:"Xai Testnet",nativeCurrency:{name:"sXai",symbol:"sXAI",decimals:18},rpcUrls:{default:{http:["https://testnet-v2.xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer-v2.xai-chain.net"}},testnet:!0}),xdc=defineChain({id:50,name:"XinFin Network",nativeCurrency:{decimals:18,name:"XDC",symbol:"XDC"},rpcUrls:{default:{http:["https://rpc.xdcrpc.com"]}},blockExplorers:{default:{name:"XDCScan",url:"https://xdcscan.com"}},contracts:{multicall3:{address:"0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF",blockCreated:75884020}}}),xdcTestnet=defineChain({id:51,name:"Apothem Network",nativeCurrency:{decimals:18,name:"TXDC",symbol:"TXDC"},rpcUrls:{default:{http:["https://erpc.apothem.network"]}},blockExplorers:{default:{name:"Blocksscan",url:"https://apothem.blocksscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:59765389}}}),xLayer=defineChain({id:196,name:"X Layer Mainnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://rpc.xlayer.tech"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer",apiUrl:"https://www.oklink.com/api/v5/explorer/xlayer/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:47416}}}),xLayerTestnet=defineChain({id:195,name:"X1 Testnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://xlayertestrpc.okx.com"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer-test"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:624344}},testnet:!0}),xrSepolia=defineChain({id:2730,name:"XR Sepolia",nativeCurrency:{decimals:18,name:"tXR",symbol:"tXR"},rpcUrls:{default:{http:["https://xr-sepolia-testnet.rpc.caldera.xyz/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://xr-sepolia-testnet.explorer.caldera.xyz"}},testnet:!0}),yooldoVerse=defineChain({id:50005,name:"Yooldo Verse",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Explorer",url:"https://explorer.yooldo-verse.xyz"}}}),yooldoVerseTestnet=defineChain({id:50006,name:"Yooldo Verse Testnet",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Testnet Explorer",url:"https://explorer.testnet.yooldo-verse.xyz"}},testnet:!0}),zenchainTestnet=defineChain({id:8408,name:"Zenchain Testnet",nativeCurrency:{decimals:18,name:"ZCX",symbol:"ZCX"},rpcUrls:{default:{http:["https://zenchain-testnet.api.onfinality.io/public"],webSocket:["wss://zenchain-testnet.api.onfinality.io/public-ws"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:230019}},blockExplorers:{default:{name:"Zentrace",url:"https://zentrace.io"}},testnet:!0}),zetachain=defineChain({id:7e3,name:"ZetaChain",nativeCurrency:{decimals:18,name:"Zeta",symbol:"ZETA"},rpcUrls:{default:{http:["https://zetachain-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1632781}},blockExplorers:{default:{name:"ZetaScan",url:"https://explorer.zetachain.com"}},testnet:!1}),zetachainAthensTestnet=defineChain({id:7001,name:"ZetaChain Athens Testnet",nativeCurrency:{decimals:18,name:"Zeta",symbol:"aZETA"},rpcUrls:{default:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2715217}},blockExplorers:{default:{name:"ZetaScan",url:"https://athens.explorer.zetachain.com"}},testnet:!0}),zhejiang=defineChain({id:1337803,name:"Zhejiang",nativeCurrency:{name:"Zhejiang Ether",symbol:"ZhejETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zhejiang.ethpandaops.io"]}},blockExplorers:{default:{name:"Beaconchain",url:"https://zhejiang.beaconcha.in"}},testnet:!0}),zilliqa=defineChain({id:32769,name:"Zilliqa",network:"zilliqa",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.zilliqa.com"}},testnet:!1}),zilliqaTestnet=defineChain({id:33101,name:"Zilliqa Testnet",network:"zilliqa-testnet",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://dev-api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.testnet.zilliqa.com"}},testnet:!0}),zircuit=defineChain({id:48900,name:"Zircuit Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://zircuit1-mainnet.p2pify.com","https://zircuit1-mainnet.liquify.com","https://zircuit-mainnet.drpc.org"]}},blockExplorers:{default:{name:"Zircuit Explorer",url:"https://explorer.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}},testnet:!1}),zircuitTestnet=defineChain({id:48899,name:"Zircuit Testnet",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zircuit1-testnet.p2pify.com","https://zircuit1-testnet.liquify.com"]}},blockExplorers:{default:{name:"Zircuit Testnet Explorer",url:"https://explorer.testnet.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:6040287}},testnet:!0}),zkFair=defineChain({id:42766,name:"ZKFair Mainnet",network:"zkfair-mainnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://scan.zkfair.io",apiUrl:"https://scan.zkfair.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6090959}},testnet:!1}),zkFairTestnet=defineChain({id:43851,name:"ZKFair Testnet",network:"zkfair-testnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://testnet-rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://testnet-scan.zkfair.io"}},testnet:!0}),zkLinkNova=defineChain({id:810180,name:"zkLink Nova",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://explorer.zklink.io"}}}),zkLinkNovaSepoliaTestnet=defineChain({id:810181,name:"zkLink Nova Sepolia Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://sepolia.explorer.zklink.io"}}}),zksync=defineChain({...chainConfig$3,id:324,name:"ZKsync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://era.zksync.network/",apiUrl:"https://api-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://explorer.zksync.io/",apiUrl:"https://block-explorer-api.mainnet.zksync.io/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:45659388}}}),zksyncInMemoryNode=defineChain({...chainConfig$3,id:260,name:"ZKsync InMemory Node",network:"zksync-in-memory-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8011"]}},testnet:!0}),zksyncLocalNode=defineChain({...chainConfig$3,id:270,name:"ZKsync CLI Local Node",network:"zksync-cli-local-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:3050"]}},testnet:!0}),zksyncSepoliaTestnet=defineChain({...chainConfig$3,id:300,name:"ZKsync Sepolia Testnet",network:"zksync-sepolia-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia-era.zksync.network/",apiUrl:"https://api-sepolia-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://sepolia.explorer.zksync.io/",blockExplorerApi:"https://block-explorer-api.sepolia.zksync.dev/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:3855712}},testnet:!0}),sourceId$2=1,zora=defineChain({...chainConfig$2,id:7777777,name:"Zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy",apiUrl:"https://explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$2]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:5882},portal:{[sourceId$2]:{address:"0x1a0ad011913A150f69f6A19DF447A0CfD9551054"}},l1StandardBridge:{[sourceId$2]:{address:"0x3e2Ea9B92B7E48A52296fD261dc26fd995284631"}}},sourceId:sourceId$2}),sourceId$1=11155111,zoraSepolia=defineChain({...chainConfig$2,id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/",apiUrl:"https://sepolia.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$1]:{address:"0x2615B481Bd3E5A1C0C7Ca3Da1bdc663E8615Ade9"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:83160},portal:{[sourceId$1]:{address:"0xeffE2C6cA9Ab797D418f0D91eA60807713f3536f"}},l1StandardBridge:{[sourceId$1]:{address:"0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB"}}},sourceId:sourceId$1,testnet:!0}),sourceId=5,zoraTestnet=defineChain({...chainConfig$2,id:999,name:"Zora Goerli Testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy",apiUrl:"https://testnet.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:189123},portal:{[sourceId]:{address:"0xDb9F51790365e7dc196e7D072728df39Be958ACe"}}},sourceId,testnet:!0}),viemChains=Object.freeze(Object.defineProperty({__proto__:null,abstractTestnet,acala,alienx,alienxHalTestnet,ancient8,ancient8Sepolia,anvil,apeChain,apexTestnet,arbitrum,arbitrumGoerli,arbitrumNova,arbitrumSepolia,areonNetwork,areonNetworkTestnet,artelaTestnet,assetChain,assetChainTestnet,astar,astarZkEVM,astarZkyoto,atletaOlympia,aurora,auroraTestnet,auroria,avalanche,avalancheFuji,b3,b3Sepolia,bahamut,base:base$6,baseGoerli,baseSepolia:baseSepolia$1,beam,beamTestnet,bearNetworkChainMainnet,bearNetworkChainTestnet,berachainTestnet,berachainTestnetbArtio,bevmMainnet,bifrost,bitTorrent,bitTorrentTestnet,bitkub,bitkubTestnet,bitlayer,bitlayerTestnet,bitrock,blast,blastSepolia,bob,bobSepolia,boba,bobaSepolia,botanixTestnet,bounceBit,bounceBitTestnet,bronos,bronosTestnet,bsc,bscGreenfield,bscTestnet,bsquared,bsquaredTestnet,btr,btrTestnet,bxn,bxnTestnet,cannon,canto,celo,celoAlfajores,chang,chiliz,chips,classic,confluxESpace,confluxESpaceTestnet,coreDao,crab,cronos,cronosTestnet,cronoszkEVM,cronoszkEVMTestnet,crossbell,curtis,cyber,cyberTestnet,darwinia,dchain,dchainTestnet,defichainEvm,defichainEvmTestnet,degen,dfk,dodochainTestnet,dogechain,dosChain,dosChainTestnet,dreyerxMainnet,dreyerxTestnet,dustboyIoT,dymension,edgeless,edgelessTestnet,edgeware,edgewareTestnet,ekta,ektaTestnet,elastos,elastosTestnet,electroneum,electroneumTestnet,elysiumTestnet,eon,eos,eosTestnet,etherlink,etherlinkTestnet,evmos,evmosTestnet,excelonMainnet,fantom,fantomSonicTestnet,fantomTestnet,fibo,filecoin,filecoinCalibration,filecoinHyperspace,flare,flareTestnet,flowMainnet,flowPreviewnet,flowTestnet,fluence,fluenceStage,fluenceTestnet,forma,foundry,fraxtal,fraxtalTestnet,funkiMainnet,funkiSepolia,fuse,fuseSparknet,fusion,fusionTestnet,garnet,genesys,glideL1Protocol,glideL2Protocol,gnosis,gnosisChiado,goChain,gobi,goerli,gravity,guruTestnet,ham,haqqMainnet,haqqTestedge2,hardhat,harmonyOne,hashkeyTestnet,hedera,hederaPreviewnet,hederaTestnet,hela,hemiSepolia,holesky,hychain,hychainTestnet,immutableZkEvm,immutableZkEvmTestnet,inEVM,inkSepolia,iota:iota$1,iotaTestnet,iotex,iotexTestnet,jbc,jbcTestnet,kaia,kairos,kakarotSepolia,kakarotStarknetSepolia,karura,kava,kavaTestnet,kcc,kinto,klaytn,klaytnBaobab,koi,kroma,kromaSepolia,l3x,l3xTestnet,lavita,lightlinkPegasus,lightlinkPhoenix,linea,lineaGoerli,lineaSepolia,lineaTestnet,lisk,liskSepolia,localhost,loop,lukso,luksoTestnet,lycan,lyra,mainnet,mandala,manta,mantaSepoliaTestnet,mantaTestnet,mantle,mantleSepoliaTestnet,mantleTestnet,mapProtocol,matchain,matchainTestnet,meld,merlin,metachain,metachainIstanbul,metalL2,meter,meterTestnet,metis,metisGoerli,mev,mevTestnet,mint,mintSepoliaTestnet,mode:mode$1,modeTestnet,moonbaseAlpha,moonbeam,moonbeamDev,moonriver,morph,morphHolesky,morphSepolia,nautilus,neonDevnet,neonMainnet,nexi,nexilix,oasisTestnet,oasys,odysseyTestnet,okc,oortMainnetDev,opBNB,opBNBTestnet,optimism,optimismGoerli,optimismSepolia,optopia,optopiaTestnet,orderly,orderlySepolia,otimDevnet,palm,palmTestnet,pgn,pgnTestnet,phoenix,playfiAlbireo,plinga,plumeTestnet,polygon,polygonAmoy,polygonMumbai,polygonZkEvm,polygonZkEvmCardona,polygonZkEvmTestnet,pulsechain,pulsechainV4,qMainnet,qTestnet,ql1,real,redbellyTestnet,redstone,reyaNetwork,rollux,rolluxTestnet,ronin,root:root$c,rootPorcini,rootstock,rootstockTestnet,rss3,rss3Sepolia,saigon,sanko,sapphire,sapphireTestnet,satoshiVM,satoshiVMTestnet,scroll,scrollSepolia,sei,seiDevnet,seiTestnet,sepolia,shape,shapeSepolia,shardeumSphinx,shibarium,shibariumTestnet,shiden,shimmer,shimmerTestnet,silicon,siliconSepolia,skaleBlockBrawlers,skaleCalypso,skaleCalypsoTestnet,skaleCryptoBlades,skaleCryptoColosseum,skaleEuropa,skaleEuropaTestnet,skaleExorde,skaleHumanProtocol,skaleNebula,skaleNebulaTestnet,skaleRazor,skaleTitan,skaleTitanTestnet,sketchpad,snax,snaxTestnet,soneiumMinato,songbird,songbirdTestnet,sophonTestnet,spicy,step,storyTestnet,stratis,superlumio,superposition,swan,swanProximaTestnet,swanSaturnTestnet,syscoin,syscoinTestnet,taiko,taikoHekla,taikoJolnir,taikoKatla,taikoTestnetSepolia,taraxa,taraxaTestnet,telcoinTestnet,telos,telosTestnet,tenet,thaiChain,that,theta:theta$1,thetaTestnet,thunderCore,thunderTestnet,tiktrixTestnet,tomb,tron,ultron,ultronTestnet,unichainSepolia,unique,uniqueOpal,uniqueQuartz,unreal,vechain,velas,viction,victionTestnet,vision,visionTestnet,wanchain,wanchainTestnet,weaveVMAlphanet,wemix,wemixTestnet,worldchain,worldchainSepolia,x1Testnet:xLayerTestnet,xLayer,xLayerTestnet,xai,xaiTestnet,xdc,xdcTestnet,xrSepolia,yooldoVerse,yooldoVerseTestnet,zenchainTestnet,zetachain,zetachainAthensTestnet,zhejiang,zilliqa,zilliqaTestnet,zircuit,zircuitTestnet,zkFair,zkFairTestnet,zkLinkNova,zkLinkNovaSepoliaTestnet,zkSync:zksync,zkSyncInMemoryNode:zksyncInMemoryNode,zkSyncLocalNode:zksyncLocalNode,zkSyncSepoliaTestnet:zksyncSepoliaTestnet,zksync,zksyncInMemoryNode,zksyncLocalNode,zksyncSepoliaTestnet,zora,zoraSepolia,zoraTestnet},Symbol.toStringTag,{value:"Module"})),validatorABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"valPerBlock",type:"uint16"},{indexed:!1,internalType:"uint16",name:"valPerBlockTarget",type:"uint16"}],name:"BlockParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"ownerWallet",type:"address"},{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"},{indexed:!1,internalType:"string",name:"nodeApiBaseUrl",type:"string"}],name:"NodeAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"address",name:"reporterWallet",type:"address"},{indexed:!1,internalType:"address[]",name:"voters",type:"address[]"},{indexed:!1,internalType:"enum ValidatorV1.VoteAction",name:"voteAction",type:"uint8"}],name:"NodeReported",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeStatus",name:"nodeStatus",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"}],name:"NodeStatusChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferStarted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"nodeRandomMinCount",type:"uint16"},{indexed:!1,internalType:"uint16",name:"nodeRandomPingCount",type:"uint16"}],name:"RandomParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"BAN_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORT_THRESHOLD_PER_BLOCK",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASH_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getActiveVNodes",outputs:[{components:[{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"}],internalType:"struct ValidatorV1.ActiveValidator[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_nodeWallet",type:"address"}],name:"getNodeInfo",outputs:[{components:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],internalType:"struct ValidatorV1.NodeInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint16",name:"protocolVersion_",type:"uint16"},{internalType:"address",name:"pushToken_",type:"address"},{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"},{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_V_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_S_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_V_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_S_",type:"uint16"},{internalType:"uint16",name:"SLASH_PERCENT_",type:"uint16"},{internalType:"uint16",name:"BAN_PERCENT_",type:"uint16"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"minStakeD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeV",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nodeMap",outputs:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomMinCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomPingCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolVersion",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from_",type:"address"},{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"redistributeStaked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"nodeTokens_",type:"uint256"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType_",type:"uint8"},{internalType:"string",name:"nodeApiBaseUrl_",type:"string"},{internalType:"address",name:"nodeWallet_",type:"address"}],name:"registerNodeAndStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum ValidatorV1.NodeType",name:"targetNodeType_",type:"uint8"},{internalType:"bytes",name:"voteBlob_",type:"bytes"},{internalType:"bytes[]",name:"signatures_",type:"bytes[]"}],name:"reportNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr_",type:"address"}],name:"setStorageContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"snodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"storageContract",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFees",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalStaked",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"unstakeFees",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"nodeWallet_",type:"address"}],name:"unstakeNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"}],name:"updateBlockParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"}],name:"updateRandomParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"valPerBlock",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"valPerBlockTarget",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"vnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"vnodesActive",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"}],config$9={ABIS:{VALIDATOR:validatorABI},VALIDATOR:{[ENV$1.PROD]:{NETWORK:mainnet,VALIDATOR_CONTRACT:"TODO"},[ENV$1.STAGING]:{NETWORK:sepolia,VALIDATOR_CONTRACT:"TODO"},[ENV$1.DEV]:{NETWORK:sepolia,VALIDATOR_CONTRACT:"0x18Fa54e372e7F5993b2233449e8ab2086eCA3fAE"},[ENV$1.LOCAL]:{NETWORK:localhost,VALIDATOR_CONTRACT:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"}},WALLET_URL:{[ENV$1.PROD]:"TODO",[ENV$1.STAGING]:"TODO",[ENV$1.DEV]:"https://push-protocol.github.io/push-keys/",[ENV$1.LOCAL]:"http://localhost:5174/push-keys/"}},Kp=class Kp{constructor(eo,to,ro){Qu(this,"ReqModifier",(eo,to)=>{let ro=Kp.vNodeUrlModifier(eo),no=to;return(to==="push_getBlocks"||to==="push_getBlockByHash"||to==="push_getTransactions"||to==="push_getTransactionByHash"||to==="push_getTransactionsByUser"||to==="push_getTransactionsBySender"||to==="push_getTransactionsByRecipient")&&(this.env===ENV$1.LOCAL&&(ro="http://localhost:5001/rpc"),this.env===ENV$1.DEV&&(ro="https://anode1.push.org/rpc"),no=`RpcService.${to.replace("push_","")}`,to==="push_getTransactions"&&(no="RpcService.getTxs"),to==="push_getTransactionsByUser"&&(no="RpcService.getTransactionsByUser"),to==="push_getTransactionsBySender"&&(no="RpcService.getTxsBySender"),to==="push_getTransactionsByRecipient"&&(no="RpcService.getTxsByRecipient"),to==="push_getTransactionByHash"&&(no="RpcService.getTxByHash")),{url:ro,fnName:no}});Qu(this,"call",async(eo,to=[],ro=this.activeValidatorURL)=>await Kp.sendJsonRpcRequest(this.ReqModifier(ro,eo).url,this.ReqModifier(ro,eo).fnName,to));this.activeValidatorURL=eo,this.env=to,this.validatorContractClient=ro}};Qu(Kp,"instance"),Qu(Kp,"idCounter",0),Qu(Kp,"initalize",async eo=>{const to={env:(eo==null?void 0:eo.env)||ENV$1.STAGING};if(!Kp.instance||Kp.instance.env!==to.env){const ro=Kp.createValidatorContractClient(to.env),no=await Kp.getActiveValidator(ro);Kp.instance=new Kp(no.nodeApiBaseUrl,to.env,ro)}return Kp.instance}),Qu(Kp,"createValidatorContractClient",eo=>{const to=createPublicClient({chain:config$9.VALIDATOR[eo].NETWORK,transport:http()});return getContract({abi:config$9.ABIS.VALIDATOR,address:config$9.VALIDATOR[eo].VALIDATOR_CONTRACT,client:{public:to}})}),Qu(Kp,"sendJsonRpcRequest",async(eo,to,ro=[])=>{const no={jsonrpc:"2.0",method:to,params:ro,id:Kp.idCounter++};try{const io=await axios.post(eo,no);if(io.data.error)throw console.error("JSON-RPC Error:",io.data.error),Error(io.data.error.message);return io.data.result}catch(io){throw console.error("Error sending JSON-RPC request:",io),io}}),Qu(Kp,"ping",async eo=>await Kp.sendJsonRpcRequest(Kp.vNodeUrlModifier(eo),"push_listening")),Qu(Kp,"getActiveValidator",async eo=>{const to=await eo.read.getActiveVNodes(),ro=getRandomElement(to);return await Kp.ping(ro.nodeApiBaseUrl)?ro:await Kp.getActiveValidator(eo)}),Qu(Kp,"vNodeUrlModifier",eo=>{let to=eo;return eo.includes(".local")&&(to=eo.replace(".local",".localh")),`${to}/api/v1/rpc`});let Validator=Kp;function varint64read(){let Xr=0,eo=0;for(let ro=0;ro<28;ro+=7){let no=this.buf[this.pos++];if(Xr|=(no&127)<>4,!(to&128))return this.assertBounds(),[Xr,eo];for(let ro=3;ro<=31;ro+=7){let no=this.buf[this.pos++];if(eo|=(no&127)<>>io,ao=!(!(oo>>>7)&&eo==0),so=(ao?oo|128:oo)&255;if(to.push(so),!ao)return}const ro=Xr>>>28&15|(eo&7)<<4,no=!!(eo>>3);if(to.push((no?ro|128:ro)&255),!!no){for(let io=3;io<31;io=io+7){const oo=eo>>>io,ao=!!(oo>>>7),so=(ao?oo|128:oo)&255;if(to.push(so),!ao)return}to.push(eo>>>31&1)}}const TWO_PWR_32_DBL=4294967296;function int64FromString(Xr){const eo=Xr[0]==="-";eo&&(Xr=Xr.slice(1));const to=1e6;let ro=0,no=0;function io(oo,ao){const so=Number(Xr.slice(oo,ao));no*=to,ro=ro*to+so,ro>=TWO_PWR_32_DBL&&(no=no+(ro/TWO_PWR_32_DBL|0),ro=ro%TWO_PWR_32_DBL)}return io(-24,-18),io(-18,-12),io(-12,-6),io(-6),eo?negate(ro,no):newBits(ro,no)}function int64ToString(Xr,eo){let to=newBits(Xr,eo);const ro=to.hi&2147483648;ro&&(to=negate(to.lo,to.hi));const no=uInt64ToString(to.lo,to.hi);return ro?"-"+no:no}function uInt64ToString(Xr,eo){if({lo:Xr,hi:eo}=toUnsigned(Xr,eo),eo<=2097151)return String(TWO_PWR_32_DBL*eo+Xr);const to=Xr&16777215,ro=(Xr>>>24|eo<<8)&16777215,no=eo>>16&65535;let io=to+ro*6777216+no*6710656,oo=ro+no*8147497,ao=no*2;const so=1e7;return io>=so&&(oo+=Math.floor(io/so),io%=so),oo>=so&&(ao+=Math.floor(oo/so),oo%=so),ao.toString()+decimalFrom1e7WithLeadingZeros(oo)+decimalFrom1e7WithLeadingZeros(io)}function toUnsigned(Xr,eo){return{lo:Xr>>>0,hi:eo>>>0}}function newBits(Xr,eo){return{lo:Xr|0,hi:eo|0}}function negate(Xr,eo){return eo=~eo,Xr?Xr=~Xr+1:eo+=1,newBits(Xr,eo)}const decimalFrom1e7WithLeadingZeros=Xr=>{const eo=String(Xr);return"0000000".slice(eo.length)+eo};function varint32write(Xr,eo){if(Xr>=0){for(;Xr>127;)eo.push(Xr&127|128),Xr=Xr>>>7;eo.push(Xr)}else{for(let to=0;to<9;to++)eo.push(Xr&127|128),Xr=Xr>>7;eo.push(1)}}function varint32read(){let Xr=this.buf[this.pos++],eo=Xr&127;if(!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<7,!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<14,!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<21,!(Xr&128))return this.assertBounds(),eo;Xr=this.buf[this.pos++],eo|=(Xr&15)<<28;for(let to=5;Xr&128&&to<10;to++)Xr=this.buf[this.pos++];if(Xr&128)throw new Error("invalid varint");return this.assertBounds(),eo>>>0}var define_process_env_default$8={};const protoInt64=makeInt64Support();function makeInt64Support(){const Xr=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof Xr.getBigInt64=="function"&&typeof Xr.getBigUint64=="function"&&typeof Xr.setBigInt64=="function"&&typeof Xr.setBigUint64=="function"&&(typeof process$1$1!="object"||typeof define_process_env_default$8!="object"||define_process_env_default$8.BUF_BIGINT_DISABLE!=="1")){const to=BigInt("-9223372036854775808"),ro=BigInt("9223372036854775807"),no=BigInt("0"),io=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(oo){const ao=typeof oo=="bigint"?oo:BigInt(oo);if(ao>ro||aoio||ao>>0)}raw(eo){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(eo),this}uint32(eo){for(assertUInt32(eo);eo>127;)this.buf.push(eo&127|128),eo=eo>>>7;return this.buf.push(eo),this}int32(eo){return assertInt32(eo),varint32write(eo,this.buf),this}bool(eo){return this.buf.push(eo?1:0),this}bytes(eo){return this.uint32(eo.byteLength),this.raw(eo)}string(eo){let to=this.encodeUtf8(eo);return this.uint32(to.byteLength),this.raw(to)}float(eo){assertFloat32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setFloat32(0,eo,!0),this.raw(to)}double(eo){let to=new Uint8Array(8);return new DataView(to.buffer).setFloat64(0,eo,!0),this.raw(to)}fixed32(eo){assertUInt32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setUint32(0,eo,!0),this.raw(to)}sfixed32(eo){assertInt32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setInt32(0,eo,!0),this.raw(to)}sint32(eo){return assertInt32(eo),eo=(eo<<1^eo>>31)>>>0,varint32write(eo,this.buf),this}sfixed64(eo){let to=new Uint8Array(8),ro=new DataView(to.buffer),no=protoInt64.enc(eo);return ro.setInt32(0,no.lo,!0),ro.setInt32(4,no.hi,!0),this.raw(to)}fixed64(eo){let to=new Uint8Array(8),ro=new DataView(to.buffer),no=protoInt64.uEnc(eo);return ro.setInt32(0,no.lo,!0),ro.setInt32(4,no.hi,!0),this.raw(to)}int64(eo){let to=protoInt64.enc(eo);return varint64write(to.lo,to.hi,this.buf),this}sint64(eo){let to=protoInt64.enc(eo),ro=to.hi>>31,no=to.lo<<1^ro,io=(to.hi<<1|to.lo>>>31)^ro;return varint64write(no,io,this.buf),this}uint64(eo){let to=protoInt64.uEnc(eo);return varint64write(to.lo,to.hi,this.buf),this}},BinaryReader$1=class{constructor(eo,to=getTextEncoding().decodeUtf8){this.decodeUtf8=to,this.varint64=varint64read,this.uint32=varint32read,this.buf=eo,this.len=eo.length,this.pos=0,this.view=new DataView(eo.buffer,eo.byteOffset,eo.byteLength)}tag(){let eo=this.uint32(),to=eo>>>3,ro=eo&7;if(to<=0||ro<0||ro>5)throw new Error("illegal tag: field no "+to+" wire type "+ro);return[to,ro]}skip(eo,to){let ro=this.pos;switch(eo){case WireType.Varint:for(;this.buf[this.pos++]&128;);break;case WireType.Bit64:this.pos+=4;case WireType.Bit32:this.pos+=4;break;case WireType.LengthDelimited:let no=this.uint32();this.pos+=no;break;case WireType.StartGroup:for(;;){const[io,oo]=this.tag();if(oo===WireType.EndGroup){if(to!==void 0&&io!==to)throw new Error("invalid end group tag");break}this.skip(oo,io)}break;default:throw new Error("cant skip wire type "+eo)}return this.assertBounds(),this.buf.subarray(ro,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let eo=this.uint32();return eo>>>1^-(eo&1)}int64(){return protoInt64.dec(...this.varint64())}uint64(){return protoInt64.uDec(...this.varint64())}sint64(){let[eo,to]=this.varint64(),ro=-(eo&1);return eo=(eo>>>1|(to&1)<<31)^ro,to=to>>>1^ro,protoInt64.dec(eo,to)}bool(){let[eo,to]=this.varint64();return eo!==0||to!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let eo=this.uint32(),to=this.pos;return this.pos+=eo,this.assertBounds(),this.buf.subarray(to,to+eo)}string(){return this.decodeUtf8(this.bytes())}};function assertInt32(Xr){if(typeof Xr=="string")Xr=Number(Xr);else if(typeof Xr!="number")throw new Error("invalid int32: "+typeof Xr);if(!Number.isInteger(Xr)||Xr>INT32_MAX||XrUINT32_MAX||Xr<0)throw new Error("invalid uint32: "+Xr)}function assertFloat32(Xr){if(typeof Xr=="string"){const eo=Xr;if(Xr=Number(Xr),isNaN(Xr)&&eo!=="NaN")throw new Error("invalid float32: "+eo)}else if(typeof Xr!="number")throw new Error("invalid float32: "+typeof Xr);if(Number.isFinite(Xr)&&(Xr>FLOAT32_MAX||Xr>>3){case 1:if(io!==8)break;no.type=to.uint32();continue;case 2:if(io!==18)break;no.category=to.string();continue;case 3:if(io!==26)break;no.sender=to.string();continue;case 4:if(io!==34)break;no.recipients.push(to.string());continue;case 5:if(io!==42)break;no.data=to.bytes();continue;case 6:if(io!==50)break;no.salt=to.bytes();continue;case 7:if(io!==58)break;no.apiToken=to.bytes();continue;case 8:if(io!==66)break;no.signature=to.bytes();continue;case 9:if(io!==74)break;no.fee=to.string();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{type:isSet$3(Xr.type)?globalThis.Number(Xr.type):0,category:isSet$3(Xr.category)?globalThis.String(Xr.category):"",sender:isSet$3(Xr.sender)?globalThis.String(Xr.sender):"",recipients:globalThis.Array.isArray(Xr==null?void 0:Xr.recipients)?Xr.recipients.map(eo=>globalThis.String(eo)):[],data:isSet$3(Xr.data)?bytesFromBase64$1(Xr.data):new Uint8Array(0),salt:isSet$3(Xr.salt)?bytesFromBase64$1(Xr.salt):new Uint8Array(0),apiToken:isSet$3(Xr.apiToken)?bytesFromBase64$1(Xr.apiToken):new Uint8Array(0),signature:isSet$3(Xr.signature)?bytesFromBase64$1(Xr.signature):new Uint8Array(0),fee:isSet$3(Xr.fee)?globalThis.String(Xr.fee):""}},toJSON(Xr){var to;const eo={};return Xr.type!==0&&(eo.type=Math.round(Xr.type)),Xr.category!==""&&(eo.category=Xr.category),Xr.sender!==""&&(eo.sender=Xr.sender),(to=Xr.recipients)!=null&&to.length&&(eo.recipients=Xr.recipients),Xr.data.length!==0&&(eo.data=base64FromBytes$1(Xr.data)),Xr.salt.length!==0&&(eo.salt=base64FromBytes$1(Xr.salt)),Xr.apiToken.length!==0&&(eo.apiToken=base64FromBytes$1(Xr.apiToken)),Xr.signature.length!==0&&(eo.signature=base64FromBytes$1(Xr.signature)),Xr.fee!==""&&(eo.fee=Xr.fee),eo},create(Xr){return Transaction$2.fromPartial(Xr??{})},fromPartial(Xr){var to;const eo=createBaseTransaction();return eo.type=Xr.type??0,eo.category=Xr.category??"",eo.sender=Xr.sender??"",eo.recipients=((to=Xr.recipients)==null?void 0:to.map(ro=>ro))||[],eo.data=Xr.data??new Uint8Array(0),eo.salt=Xr.salt??new Uint8Array(0),eo.apiToken=Xr.apiToken??new Uint8Array(0),eo.signature=Xr.signature??new Uint8Array(0),eo.fee=Xr.fee??"",eo}};function bytesFromBase64$1(Xr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Xr,"base64"));{const eo=globalThis.atob(Xr),to=new Uint8Array(eo.length);for(let ro=0;ro{eo.push(globalThis.String.fromCharCode(to))}),globalThis.btoa(eo.join(""))}}function isSet$3(Xr){return Xr!=null}const REGEX$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function validate$4(Xr){return typeof Xr=="string"&®EX$1.test(Xr)}function parse$3(Xr){if(!validate$4(Xr))throw TypeError("Invalid UUID");var eo,to=new Uint8Array(16);return to[0]=(eo=parseInt(Xr.slice(0,8),16))>>>24,to[1]=eo>>>16&255,to[2]=eo>>>8&255,to[3]=eo&255,to[4]=(eo=parseInt(Xr.slice(9,13),16))>>>8,to[5]=eo&255,to[6]=(eo=parseInt(Xr.slice(14,18),16))>>>8,to[7]=eo&255,to[8]=(eo=parseInt(Xr.slice(19,23),16))>>>8,to[9]=eo&255,to[10]=(eo=parseInt(Xr.slice(24,36),16))/1099511627776&255,to[11]=eo/4294967296&255,to[12]=eo>>>24&255,to[13]=eo>>>16&255,to[14]=eo>>>8&255,to[15]=eo&255,to}var byteToHex$2=[];for(var i$7=0;i$7<256;++i$7)byteToHex$2.push((i$7+256).toString(16).slice(1));function unsafeStringify$1(Xr,eo=0){return(byteToHex$2[Xr[eo+0]]+byteToHex$2[Xr[eo+1]]+byteToHex$2[Xr[eo+2]]+byteToHex$2[Xr[eo+3]]+"-"+byteToHex$2[Xr[eo+4]]+byteToHex$2[Xr[eo+5]]+"-"+byteToHex$2[Xr[eo+6]]+byteToHex$2[Xr[eo+7]]+"-"+byteToHex$2[Xr[eo+8]]+byteToHex$2[Xr[eo+9]]+"-"+byteToHex$2[Xr[eo+10]]+byteToHex$2[Xr[eo+11]]+byteToHex$2[Xr[eo+12]]+byteToHex$2[Xr[eo+13]]+byteToHex$2[Xr[eo+14]]+byteToHex$2[Xr[eo+15]]).toLowerCase()}var getRandomValues$2,rnds8$2=new Uint8Array(16);function rng$2(){if(!getRandomValues$2&&(getRandomValues$2=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues$2))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues$2(rnds8$2)}var randomUUID$1=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native$3={randomUUID:randomUUID$1};function v4$2(Xr,eo,to){if(native$3.randomUUID&&!eo&&!Xr)return native$3.randomUUID();Xr=Xr||{};var ro=Xr.random||(Xr.rng||rng$2)();return ro[6]=ro[6]&15|64,ro[8]=ro[8]&63|128,unsafeStringify$1(ro)}var TxCategory=(Xr=>(Xr.INIT_DID="INIT_DID",Xr.INIT_SESSION_KEY="INIT_SESSION_KEY",Xr))(TxCategory||{});function createBaseEncryptedText(){return{ciphertext:"",salt:"",nonce:"",version:"",preKey:""}}const EncryptedText={encode(Xr,eo=new BinaryWriter$1){return Xr.ciphertext!==""&&eo.uint32(10).string(Xr.ciphertext),Xr.salt!==""&&eo.uint32(18).string(Xr.salt),Xr.nonce!==""&&eo.uint32(26).string(Xr.nonce),Xr.version!==""&&eo.uint32(34).string(Xr.version),Xr.preKey!==""&&eo.uint32(42).string(Xr.preKey),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseEncryptedText();for(;to.pos>>3){case 1:if(io!==10)break;no.ciphertext=to.string();continue;case 2:if(io!==18)break;no.salt=to.string();continue;case 3:if(io!==26)break;no.nonce=to.string();continue;case 4:if(io!==34)break;no.version=to.string();continue;case 5:if(io!==42)break;no.preKey=to.string();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{ciphertext:isSet$2(Xr.ciphertext)?globalThis.String(Xr.ciphertext):"",salt:isSet$2(Xr.salt)?globalThis.String(Xr.salt):"",nonce:isSet$2(Xr.nonce)?globalThis.String(Xr.nonce):"",version:isSet$2(Xr.version)?globalThis.String(Xr.version):"",preKey:isSet$2(Xr.preKey)?globalThis.String(Xr.preKey):""}},toJSON(Xr){const eo={};return Xr.ciphertext!==""&&(eo.ciphertext=Xr.ciphertext),Xr.salt!==""&&(eo.salt=Xr.salt),Xr.nonce!==""&&(eo.nonce=Xr.nonce),Xr.version!==""&&(eo.version=Xr.version),Xr.preKey!==""&&(eo.preKey=Xr.preKey),eo},create(Xr){return EncryptedText.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseEncryptedText();return eo.ciphertext=Xr.ciphertext??"",eo.salt=Xr.salt??"",eo.nonce=Xr.nonce??"",eo.version=Xr.version??"",eo.preKey=Xr.preKey??"",eo}};function createBaseWalletToEncDerivedKey(){return{encDerivedPrivKey:void 0,signature:new Uint8Array(0)}}const WalletToEncDerivedKey={encode(Xr,eo=new BinaryWriter$1){return Xr.encDerivedPrivKey!==void 0&&EncryptedText.encode(Xr.encDerivedPrivKey,eo.uint32(10).fork()).join(),Xr.signature.length!==0&&eo.uint32(18).bytes(Xr.signature),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseWalletToEncDerivedKey();for(;to.pos>>3){case 1:if(io!==10)break;no.encDerivedPrivKey=EncryptedText.decode(to,to.uint32());continue;case 2:if(io!==18)break;no.signature=to.bytes();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{encDerivedPrivKey:isSet$2(Xr.encDerivedPrivKey)?EncryptedText.fromJSON(Xr.encDerivedPrivKey):void 0,signature:isSet$2(Xr.signature)?bytesFromBase64(Xr.signature):new Uint8Array(0)}},toJSON(Xr){const eo={};return Xr.encDerivedPrivKey!==void 0&&(eo.encDerivedPrivKey=EncryptedText.toJSON(Xr.encDerivedPrivKey)),Xr.signature.length!==0&&(eo.signature=base64FromBytes(Xr.signature)),eo},create(Xr){return WalletToEncDerivedKey.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseWalletToEncDerivedKey();return eo.encDerivedPrivKey=Xr.encDerivedPrivKey!==void 0&&Xr.encDerivedPrivKey!==null?EncryptedText.fromPartial(Xr.encDerivedPrivKey):void 0,eo.signature=Xr.signature??new Uint8Array(0),eo}};function createBaseInitDid(){return{masterPubKey:"",derivedKeyIndex:0,derivedPubKey:"",walletToEncDerivedKey:{}}}const InitDid={encode(Xr,eo=new BinaryWriter$1){return Xr.masterPubKey!==""&&eo.uint32(10).string(Xr.masterPubKey),Xr.derivedKeyIndex!==0&&eo.uint32(16).uint32(Xr.derivedKeyIndex),Xr.derivedPubKey!==""&&eo.uint32(26).string(Xr.derivedPubKey),Object.entries(Xr.walletToEncDerivedKey).forEach(([to,ro])=>{InitDid_WalletToEncDerivedKeyEntry.encode({key:to,value:ro},eo.uint32(34).fork()).join()}),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitDid();for(;to.pos>>3){case 1:if(io!==10)break;no.masterPubKey=to.string();continue;case 2:if(io!==16)break;no.derivedKeyIndex=to.uint32();continue;case 3:if(io!==26)break;no.derivedPubKey=to.string();continue;case 4:if(io!==34)break;const oo=InitDid_WalletToEncDerivedKeyEntry.decode(to,to.uint32());oo.value!==void 0&&(no.walletToEncDerivedKey[oo.key]=oo.value);continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{masterPubKey:isSet$2(Xr.masterPubKey)?globalThis.String(Xr.masterPubKey):"",derivedKeyIndex:isSet$2(Xr.derivedKeyIndex)?globalThis.Number(Xr.derivedKeyIndex):0,derivedPubKey:isSet$2(Xr.derivedPubKey)?globalThis.String(Xr.derivedPubKey):"",walletToEncDerivedKey:isObject$g(Xr.walletToEncDerivedKey)?Object.entries(Xr.walletToEncDerivedKey).reduce((eo,[to,ro])=>(eo[to]=WalletToEncDerivedKey.fromJSON(ro),eo),{}):{}}},toJSON(Xr){const eo={};if(Xr.masterPubKey!==""&&(eo.masterPubKey=Xr.masterPubKey),Xr.derivedKeyIndex!==0&&(eo.derivedKeyIndex=Math.round(Xr.derivedKeyIndex)),Xr.derivedPubKey!==""&&(eo.derivedPubKey=Xr.derivedPubKey),Xr.walletToEncDerivedKey){const to=Object.entries(Xr.walletToEncDerivedKey);to.length>0&&(eo.walletToEncDerivedKey={},to.forEach(([ro,no])=>{eo.walletToEncDerivedKey[ro]=WalletToEncDerivedKey.toJSON(no)}))}return eo},create(Xr){return InitDid.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitDid();return eo.masterPubKey=Xr.masterPubKey??"",eo.derivedKeyIndex=Xr.derivedKeyIndex??0,eo.derivedPubKey=Xr.derivedPubKey??"",eo.walletToEncDerivedKey=Object.entries(Xr.walletToEncDerivedKey??{}).reduce((to,[ro,no])=>(no!==void 0&&(to[ro]=WalletToEncDerivedKey.fromPartial(no)),to),{}),eo}};function createBaseInitDid_WalletToEncDerivedKeyEntry(){return{key:"",value:void 0}}const InitDid_WalletToEncDerivedKeyEntry={encode(Xr,eo=new BinaryWriter$1){return Xr.key!==""&&eo.uint32(10).string(Xr.key),Xr.value!==void 0&&WalletToEncDerivedKey.encode(Xr.value,eo.uint32(18).fork()).join(),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitDid_WalletToEncDerivedKeyEntry();for(;to.pos>>3){case 1:if(io!==10)break;no.key=to.string();continue;case 2:if(io!==18)break;no.value=WalletToEncDerivedKey.decode(to,to.uint32());continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{key:isSet$2(Xr.key)?globalThis.String(Xr.key):"",value:isSet$2(Xr.value)?WalletToEncDerivedKey.fromJSON(Xr.value):void 0}},toJSON(Xr){const eo={};return Xr.key!==""&&(eo.key=Xr.key),Xr.value!==void 0&&(eo.value=WalletToEncDerivedKey.toJSON(Xr.value)),eo},create(Xr){return InitDid_WalletToEncDerivedKeyEntry.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitDid_WalletToEncDerivedKeyEntry();return eo.key=Xr.key??"",eo.value=Xr.value!==void 0&&Xr.value!==null?WalletToEncDerivedKey.fromPartial(Xr.value):void 0,eo}};function bytesFromBase64(Xr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Xr,"base64"));{const eo=globalThis.atob(Xr),to=new Uint8Array(eo.length);for(let ro=0;ro{eo.push(globalThis.String.fromCharCode(to))}),globalThis.btoa(eo.join(""))}}function isObject$g(Xr){return typeof Xr=="object"&&Xr!==null}function isSet$2(Xr){return Xr!=null}function keyActionFromJSON(Xr){switch(Xr){case 0:case"PUBLISH_KEY":return 0;case 1:case"REVOKE_KEY":return 1;case-1:case"UNRECOGNIZED":default:return-1}}function keyActionToJSON(Xr){switch(Xr){case 0:return"PUBLISH_KEY";case 1:return"REVOKE_KEY";case-1:default:return"UNRECOGNIZED"}}function createBaseInitSessionKey(){return{keyIndex:0,keyAddress:"",action:0}}const InitSessionKey={encode(Xr,eo=new BinaryWriter$1){return Xr.keyIndex!==0&&eo.uint32(8).int32(Xr.keyIndex),Xr.keyAddress!==""&&eo.uint32(18).string(Xr.keyAddress),Xr.action!==0&&eo.uint32(24).int32(Xr.action),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitSessionKey();for(;to.pos>>3){case 1:if(io!==8)break;no.keyIndex=to.int32();continue;case 2:if(io!==18)break;no.keyAddress=to.string();continue;case 3:if(io!==24)break;no.action=to.int32();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{keyIndex:isSet$1(Xr.keyIndex)?globalThis.Number(Xr.keyIndex):0,keyAddress:isSet$1(Xr.keyAddress)?globalThis.String(Xr.keyAddress):"",action:isSet$1(Xr.action)?keyActionFromJSON(Xr.action):0}},toJSON(Xr){const eo={};return Xr.keyIndex!==0&&(eo.keyIndex=Math.round(Xr.keyIndex)),Xr.keyAddress!==""&&(eo.keyAddress=Xr.keyAddress),Xr.action!==0&&(eo.action=keyActionToJSON(Xr.action)),eo},create(Xr){return InitSessionKey.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitSessionKey();return eo.keyIndex=Xr.keyIndex??0,eo.keyAddress=Xr.keyAddress??"",eo.action=Xr.action??0,eo}};function isSet$1(Xr){return Xr!=null}const Lm=class Lm{constructor(eo,to){Qu(this,"createUnsigned",(eo,to,ro)=>Transaction$2.create({type:0,category:eo,recipients:to,data:ro,salt:parse$3(v4$2()),fee:"0"}));Qu(this,"get",async(eo=Math.floor(Date.now()),to="DESC",ro=30,no=1,io,oo)=>io===void 0?await this.validator.call("push_getTransactions",[eo,to,ro,no,oo]):await this.validator.call("push_getTransactionsByUser",[io,eo,to,ro,no,oo]));Qu(this,"getBySender",async(eo,to=Math.floor(Date.now()/1e3),ro="ASC",no=30,io=1,oo)=>await this.validator.call("push_getTransactionsBySender",[eo,to,ro,no,io,oo]));Qu(this,"getByRecipient",async(eo,to=Math.floor(Date.now()/1e3),ro="ASC",no=30,io=1,oo)=>await this.validator.call("push_getTransactionsByRecipient",[eo,to,ro,no,io,oo]));Qu(this,"search",async eo=>await this.validator.call("push_getTransactionByHash",[eo]));Qu(this,"send",async(eo,to)=>{const ro=await this.validator.call("push_getApiToken"),no=Lm.serialize({...eo,sender:to.account,signature:new Uint8Array(0),apiToken:utf8ToBytes$4(ro.apiToken)}),io=new TextEncoder().encode(toHex$1(sha256_1$4(no))),oo=await to.signMessage(io),ao=Lm.serialize({...Lm.deserialize(no),signature:oo});return await this.validator.call("push_sendTransaction",[bytesToHex$4(ao)],ro.apiUrl)});this.validator=eo,this.env=to}};Qu(Lm,"initialize",async eo=>{const to=await Validator.initalize({env:eo});return new Lm(to,eo)}),Qu(Lm,"serialize",eo=>{const to=Transaction$2.create(eo);return Transaction$2.encode(to).finish()}),Qu(Lm,"deserialize",eo=>Transaction$2.decode(eo)),Qu(Lm,"serializeData",(eo,to)=>{switch(to){case TxCategory.INIT_DID:{const ro=eo,no=InitDid.create(ro);return InitDid.encode(no).finish()}case TxCategory.INIT_SESSION_KEY:{const ro=eo,no=InitSessionKey.create(ro);return InitSessionKey.encode(no).finish()}default:throw new Error("Serialization Not Supported for given TxCateory")}}),Qu(Lm,"deserializeData",(eo,to)=>{switch(to){case TxCategory.INIT_DID:return InitDid.decode(eo);case TxCategory.INIT_SESSION_KEY:return InitSessionKey.decode(eo);default:throw new Error("Deserialization Not Supported for given TxCateory")}});let Tx=Lm;var dist$1={};Object.defineProperty(dist$1,"__esModule",{value:!0});var bech32m=dist$1.bech32m=dist$1.bech32=void 0;const ALPHABET$3="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={};for(let Xr=0;Xr>25;return(Xr&33554431)<<5^-(eo>>0&1)&996825010^-(eo>>1&1)&642813549^-(eo>>2&1)&513874426^-(eo>>3&1)&1027748829^-(eo>>4&1)&705979059}function prefixChk(Xr){let eo=1;for(let to=0;to126)return"Invalid prefix ("+Xr+")";eo=polymodStep(eo)^ro>>5}eo=polymodStep(eo);for(let to=0;to=to;)io-=to,ao.push(no>>io&oo);if(ro)io>0&&ao.push(no<=eo)return"Excess padding";if(no<so)throw new TypeError("Exceeds length limit");oo=oo.toLowerCase();let co=prefixChk(oo);if(typeof co=="string")throw new Error(co);let lo=oo+"1";for(let fo=0;fo>5)throw new Error("Non 5-bit word");co=polymodStep(co)^ho,lo+=ALPHABET$3.charAt(ho)}for(let fo=0;fo<6;++fo)co=polymodStep(co);co^=eo;for(let fo=0;fo<6;++fo){const ho=co>>(5-fo)*5&31;lo+=ALPHABET$3.charAt(ho)}return lo}function ro(oo,ao){if(ao=ao||90,oo.length<8)return oo+" too short";if(oo.length>ao)return"Exceeds length limit";const so=oo.toLowerCase(),co=oo.toUpperCase();if(oo!==so&&oo!==co)return"Mixed-case string "+oo;oo=so;const lo=oo.lastIndexOf("1");if(lo===-1)return"No separator character for "+oo;if(lo===0)return"Missing prefix for "+oo;const fo=oo.slice(0,lo),ho=oo.slice(lo+1);if(ho.length<6)return"Data too short";let go=prefixChk(fo);if(typeof go=="string")return go;const yo=[];for(let vo=0;vo=ho.length)&&yo.push(Eo)}return go!==eo?"Invalid checksum for "+oo:{prefix:fo,words:yo}}function no(oo,ao){const so=ro(oo,ao);if(typeof so=="object")return so}function io(oo,ao){const so=ro(oo,ao);if(typeof so=="object")return so;throw new Error(so)}return{decodeUnsafe:no,decode:io,encode:to,toWords,fromWordsUnsafe,fromWords}}dist$1.bech32=getLibraryFromEncoding("bech32");bech32m=dist$1.bech32m=getLibraryFromEncoding("bech32m");var PUSH_NETWORK=(Xr=>(Xr.DEVNET="devnet",Xr.TESTNET="testnet",Xr.MAINNET="mainnet",Xr))(PUSH_NETWORK||{});const PUSH_PREFIX="push";var Hm;let Address$1=(Hm=class{},Qu(Hm,"evmToPush",(eo,to=PUSH_PREFIX)=>{try{const ro=bech32m.toWords(hexToBytes$5(getAddress$1(eo).slice(2)));return bech32m.encode(to,ro)}catch{throw new Error("Invalid EVM address")}}),Qu(Hm,"pushToEvm",eo=>{try{const to=bech32m.decode(eo),ro=new Uint8Array(bech32m.fromWords(to.words));return getAddress$1(`0x${bytesToHex$4(ro)}`)}catch{throw new Error("Invalid Push address")}}),Qu(Hm,"toPushCAIP",(eo,to=ENV$1.STAGING)=>{let ro;switch(to){case ENV$1.LOCAL:case ENV$1.DEV:{ro=PUSH_NETWORK.DEVNET;break}case ENV$1.STAGING:{ro=PUSH_NETWORK.TESTNET;break}case ENV$1.PROD:{ro=PUSH_NETWORK.MAINNET;break}default:throw Error("Invalid ENV")}const no=eo.startsWith(PUSH_PREFIX)?eo:Hm.evmToPush(eo);return`push:${ro}:${no}`}),Qu(Hm,"toCAIP",(eo,to)=>{const ro=eo.startsWith(PUSH_PREFIX)?"push":eo.startsWith("0x")?"eip155":"solana";if(ro==="eip155"&&typeof to!="number")throw new Error("Invalid network for EIP155 address");if((ro==="push"||ro==="solana")&&typeof to=="number")throw new Error(`Invalid network for ${ro} address`);const io={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}[to];return ro==="solana"?`${ro}:${io}:${eo}`:`${ro}:${to}:${eo}`}),Hm);var ENV=(Xr=>(Xr.PROD="prod",Xr.STAGING="staging",Xr.DEV="dev",Xr.LOCAL="local",Xr))(ENV||{});const chainToNamespace={EVM:"eip155",SOL:"solana"},networkToSolChainId={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"},R0=class R0{};Qu(R0,"initialize",async(eo,to="WALLETCLIENT")=>to==="DYNAMIC"?R0.convertDynamicProvider(eo):R0.convertViemWalletClient(eo)),Qu(R0,"convertViemWalletClient",async eo=>{try{const to=eo.account;if(!to)throw new Error("WalletClient Account Undefined");const ro=await eo.getChainId(),no=async io=>{const oo=await eo.signMessage({message:io,account:to});return hexToBytes$5(oo.replace("0x",""))};return{account:`eip155:${ro}:${getAddress$1(to.address)}`,signMessage:no}}catch{throw new Error("Invalid WalletClient")}}),Qu(R0,"convertDynamicProvider",async eo=>{try{const to=chainToNamespace[eo.chain];if(to===void 0)throw new Error("Unsupported Namespace");let ro=await eo.getNetwork();to==="solana"&&(ro=networkToSolChainId[ro]);const no=async io=>{const oo=await eo.signMessage(io);return isHex$4(oo)?hexToBytes$5(oo.replace("0x","")):Buffer$3.from(oo,"base64")};return{account:`${to}:${ro}:${eo.address}`,signMessage:no}}catch{throw new Error("Invalid Dynamic Provider")}});let PushSigner=R0;var ENCRYPTION_TYPE=(Xr=>(Xr.V1="x25519-xsalsa20-poly1305",Xr.V2="aes256GcmHkdfSha256",Xr.V3="eip191-aes256-gcm-hkdf-sha256",Xr.V4="pgpv1:nft",Xr.V5="push:v5",Xr))(ENCRYPTION_TYPE||{});const J0=class J0{constructor(eo){Qu(this,"hkdf",async(eo,to)=>{const ro=await crypto.subtle.importKey("raw",eo,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:to,info:new ArrayBuffer(0)},ro,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])});Qu(this,"aesGcmEncryption",async(eo,to,ro)=>{const oo=crypto.getRandomValues(new Uint8Array(32)),ao=crypto.getRandomValues(new Uint8Array(12)),so=await this.hkdf(to,oo),co={name:"AES-GCM",iv:ao};ro&&(co.additionalData=ro);const lo=await crypto.subtle.encrypt(co,so,eo);return{ciphertext:bytesToHex$4(new Uint8Array(lo)),salt:bytesToHex$4(oo),nonce:bytesToHex$4(ao)}});Qu(this,"aesGcmDecryption",async(eo,to,ro)=>{const no=await this.hkdf(to,hexToBytes$5(eo.salt)),io={name:"AES-GCM",iv:hexToBytes$5(eo.nonce)};ro&&(io.additionalData=ro);const oo=await crypto.subtle.decrypt(io,no,hexToBytes$5(eo.ciphertext));return new Uint8Array(oo)});Qu(this,"encryptV5",async eo=>{const to=bytesToHex$4(await crypto.getRandomValues(new Uint8Array(32))),ro=`Enable Push Network Profile -`+to,no=await this.signer.signMessage(ro),oo=new TextEncoder().encode(eo);return{...await this.aesGcmEncryption(oo,no),version:ENCRYPTION_TYPE.V5,preKey:to}});Qu(this,"decryptV5",async eo=>{const to=`Enable Push Network Profile -`+eo.preKey,ro=await this.signer.signMessage(to),no=await this.aesGcmDecryption(eo,ro);return new TextDecoder().decode(no)});this.signer=eo}};Qu(J0,"encrypt",async(eo,to,ro=ENCRYPTION_TYPE.V5)=>{const no=new J0(to);switch(ro){case ENCRYPTION_TYPE.V5:return await no.encryptV5(eo);default:throw new Error("Invalid Key Encryption")}}),Qu(J0,"decrypt",async(eo,to)=>{const ro=new J0(to);switch(eo.version){case ENCRYPTION_TYPE.V5:return ro.decryptV5(eo);default:throw new Error("Invalid Key Encryption")}});let PushEncryption=J0;function toAccount(Xr){if(typeof Xr=="string"){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});return{address:Xr,type:"json-rpc"}}if(!isAddress(Xr.address,{strict:!1}))throw new InvalidAddressError({address:Xr.address});return{address:Xr.address,nonceManager:Xr.nonceManager,sign:Xr.sign,experimental_signAuthorization:Xr.experimental_signAuthorization,signMessage:Xr.signMessage,signTransaction:Xr.signTransaction,signTypedData:Xr.signTypedData,source:"custom",type:"local"}}async function sign$3({hash:Xr,privateKey:eo,to="object"}){const{r:ro,s:no,recovery:io}=secp256k1$2.sign(Xr.slice(2),eo.slice(2)),oo={r:numberToHex(ro,{size:32}),s:numberToHex(no,{size:32}),v:io?28n:27n,yParity:io};return to==="bytes"||to==="hex"?serializeSignature({...oo,to}):oo}async function experimental_signAuthorization(Xr){const{contractAddress:eo,chainId:to,nonce:ro,privateKey:no,to:io="object"}=Xr,oo=await sign$3({hash:hashAuthorization({contractAddress:eo,chainId:to,nonce:ro}),privateKey:no,to:io});return io==="object"?{contractAddress:eo,chainId:to,nonce:ro,...oo}:oo}async function signMessage$2({message:Xr,privateKey:eo}){return await sign$3({hash:hashMessage(Xr),privateKey:eo,to:"hex"})}async function signTransaction$2(Xr){const{privateKey:eo,transaction:to,serializer:ro=serializeTransaction$4}=Xr,no=to.type==="eip4844"?{...to,sidecars:!1}:to,io=await sign$3({hash:keccak256(ro(no)),privateKey:eo});return ro(to,io)}async function signTypedData$1(Xr){const{privateKey:eo,...to}=Xr;return await sign$3({hash:hashTypedData(to),privateKey:eo,to:"hex"})}function privateKeyToAccount(Xr,eo={}){const{nonceManager:to}=eo,ro=toHex$1(secp256k1$2.getPublicKey(Xr.slice(2),!1)),no=publicKeyToAddress(ro);return{...toAccount({address:no,nonceManager:to,async sign({hash:oo}){return sign$3({hash:oo,privateKey:Xr,to:"hex"})},async experimental_signAuthorization(oo){return experimental_signAuthorization({...oo,privateKey:Xr})},async signMessage({message:oo}){return signMessage$2({message:oo,privateKey:Xr})},async signTransaction(oo,{serializer:ao}={}){return signTransaction$2({privateKey:Xr,transaction:oo,serializer:ao})},async signTypedData(oo){return signTypedData$1({...oo,privateKey:Xr})}}),publicKey:ro,source:"privateKey"}}function hdKeyToAccount(Xr,{accountIndex:eo=0,addressIndex:to=0,changeIndex:ro=0,path:no,...io}={}){const oo=Xr.derive(no||`m/44'/60'/${eo}'/${ro}/${to}`);return{...privateKeyToAccount(toHex$1(oo.privateKey),io),getHdKey:()=>oo,source:"hd"}}function mnemonicToAccount(Xr,eo={}){const to=mnemonicToSeedSync(Xr);return hdKeyToAccount(HDKey.fromMasterSeed(to),eo)}const qp=class qp{constructor(eo,to,ro,no=void 0,io){Qu(this,"signerAccount");Qu(this,"appConnections");Qu(this,"walletToEncDerivedKey",{});Qu(this,"connectWalletWithAccount",async eo=>{if(!qp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const to=await PushEncryption.encrypt(this.derivedHDNode.privateExtendedKey,eo),ro=await mnemonicToSeed(this.mnemonic),no=HDKey.fromMasterSeed(ro),io=`PUSH_DID:${bytesToHex$4(sha256_1$4(no.publicKey))}`,oo=await eo.signMessage(`Connect Account To ${io}`);this.walletToEncDerivedKey[eo.account]={encDerivedPrivKey:to,signature:oo}});Qu(this,"registerPushAccount",async()=>{if(!qp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const eo=await mnemonicToSeed(this.mnemonic),to=HDKey.fromMasterSeed(eo),ro={masterPubKey:bytesToHex$4(to.publicKey),derivedKeyIndex:this.derivedHDNode.index,derivedPubKey:bytesToHex$4(this.derivedHDNode.publicKey),walletToEncDerivedKey:this.walletToEncDerivedKey},no=await Tx.initialize(this.env),io=no.createUnsigned("INIT_DID",[],Tx.serializeData(ro,"INIT_DID"));console.log("InitDIDTx:",io),console.log(`0x${bytesToHex$4(to.privateKey)}`);const oo=privateKeyToAccount(`0x${bytesToHex$4(to.privateKey)}`),ao={account:Address$1.toPushCAIP(oo.address,this.env),signMessage:async so=>{const co=await oo.signMessage({message:{raw:so}});return hexToBytes$3(co)}};await no.send(io,ao),qp.unRegisteredProfile=!1,Object.keys(this.walletToEncDerivedKey).forEach(so=>{const{encDerivedPrivKey:co}=this.walletToEncDerivedKey[so];localStorage.setItem(so,JSON.stringify({did:this.did,derivedKeyIndex:0,encDerivedPrivKey:co}))})});Qu(this,"sign",async(eo,to)=>{if(!this.appConnections.find(ao=>ao.origin===to))throw Error("App not Connected");const no=hdKeyToAccount(this.derivedHDNode),io=createWalletClient({account:no,chain:mainnet,transport:http()});return await(await PushSigner.initialize(io)).signMessage(typeof eo=="string"?eo:bytesToString(eo))});Qu(this,"ConnectionStatus",eo=>{const to=this.appConnections.find(ro=>ro.origin===eo);return to?{isConnected:!to.isPending,isPending:to.isPending}:{isConnected:!1,isPending:!1}});Qu(this,"requestToConnect",eo=>{this.appConnections.find(ro=>ro.origin===eo)||(this.appConnections.push({origin:eo,isPending:!0}),localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Qu(this,"acceptConnectionReq",eo=>{const to=this.appConnections.find(ro=>ro.origin===eo);to&&(to.isPending=!1,localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Qu(this,"rejectConnectionReq",eo=>{this.appConnections=this.appConnections.filter(to=>to.origin!==eo),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});Qu(this,"generateRandomSessionKey",()=>{var ro,no;let eo=this.derivedHDNode;const to=9;for(let io=0;io{const to=this.generateRandomSessionKey();console.log(eo,to)});Qu(this,"revokeSessionKey",eo=>{console.log(eo)});this.did=eo,this.account=to,this.derivedHDNode=ro,this.mnemonic=no,this.env=io,this.signerAccount=Address$1.toPushCAIP(Address$1.evmToPush(hdKeyToAccount(ro).address,"pushconsumer"),io),this.appConnections=localStorage.getItem("appConnections")?JSON.parse(localStorage.getItem("appConnections")):[]}};Qu(qp,"pushValidator"),Qu(qp,"unRegisteredProfile",!1),Qu(qp,"signUp",async(eo=ENV.STAGING)=>{qp.unRegisteredProfile=!0;const to=await qp.generatePushWallet(),ro=Address$1.toPushCAIP(mnemonicToAccount(to.mnemonic).address,eo);localStorage.removeItem("appConnections");const no=new qp(to.did,ro,to.derivedNode,to.mnemonic,eo),io=createWalletClient({account:mnemonicToAccount(to.mnemonic),chain:mainnet,transport:http()}),oo=await PushSigner.initialize(io);return oo.account=ro,await no.connectWalletWithAccount(oo),no}),Qu(qp,"logInWithMnemonic",async(eo,to=ENV.STAGING)=>{const ro=Address$1.toPushCAIP(mnemonicToAccount(eo).address,to),no=createWalletClient({account:mnemonicToAccount(eo),chain:mainnet,transport:http()}),io=await PushSigner.initialize(no);return io.account=ro,await qp.loginWithWallet(io,to)}),Qu(qp,"loginWithWallet",async(eo,to=ENV.STAGING)=>{qp.pushValidator=await Validator.initalize({env:to});const ro=await qp.getPushWallet(eo.account);if(ro==null)throw Error("Push Account Not Found!");{const no=await qp.decryptDerivedNode(ro.encDerivedPrivKey,eo);return new qp(ro.did,eo.account,no,void 0,to)}}),Qu(qp,"loginWithSocial",async()=>{}),Qu(qp,"getPushWallet",async eo=>{const to=localStorage.getItem(eo);return to?JSON.parse(to):await qp.pushValidator.call("push_accountInfo",[eo])}),Qu(qp,"generateDerivedNode",async(eo,to=0,ro=0)=>{const io=`m/44'/60'/0'/0/${ro}/0'/${to}'`;return eo.derive(io)}),Qu(qp,"generatePushWallet",async()=>{const eo=generateMnemonic(wordlist),to=await mnemonicToSeed(eo),ro=HDKey.fromMasterSeed(to),no=`PUSH_DID:${bytesToHex$4(sha256_1$4(ro.publicKey))}`,io=await qp.generateDerivedNode(ro);return{mnemonic:eo,masterNode:ro,did:no,derivedNode:io}}),Qu(qp,"decryptDerivedNode",async(eo,to)=>{const ro=await PushEncryption.decrypt(eo,to);return HDKey.fromExtendedKey(ro)});let PushWallet=qp;const config$8={},config$7={APP_NAME:"Push Local Wallet",NODE_ENV:"local",APP_ENV:"local",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$6={APP_NAME:"Push Devnet Wallet",NODE_ENV:"dev",APP_ENV:"dev",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$5={APP_NAME:"Push Testnet Wallet",NODE_ENV:"staging",APP_ENV:"staging",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$4={APP_NAME:"Push Wallet",NODE_ENV:"prod",APP_ENV:"prod",ALLOWED_NETWORKS:[1,137,56,10,42161,1101,122,7560],DEFAULT_CHAIN:1},env$2="dev";let dynamicConfig;switch(env$2){case ENV.LOCAL:{dynamicConfig=config$7;break}case ENV.DEV:{dynamicConfig=config$6;break}case ENV.STAGING:{dynamicConfig=config$5;break}case ENV.PROD:{dynamicConfig=config$4;break}default:dynamicConfig=config$5}const config$3={...dynamicConfig,...config$8},MnemonicGrid=({words:Xr,disabled:eo,handleMnemonicChange:to})=>jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:Xr.map((ro,no)=>jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:"text-lg font-medium",children:`${no+1}.`}),jsxRuntimeExports.jsx("input",{type:"text",value:ro,onChange:io=>to(no,io.target.value),placeholder:`Word ${no+1}`,className:"border p-2 rounded w-full text-center",disabled:eo})]},no))});function __awaiter$p(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var eventemitter3$2={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,fo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,fo||so,ho),yo=to?to+co:co;return so._events[yo]?so._events[yo].fn?so._events[yo]=[so._events[yo],go]:so._events[yo].push(go):(so._events[yo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var co=[],lo,fo;if(this._eventsCount===0)return co;for(fo in lo=this._events)eo.call(lo,fo)&&co.push(to?fo.slice(1):fo);return Object.getOwnPropertySymbols?co.concat(Object.getOwnPropertySymbols(lo)):co},ao.prototype.listeners=function(co){var lo=to?to+co:co,fo=this._events[lo];if(!fo)return[];if(fo.fn)return[fo.fn];for(var ho=0,go=fo.length,yo=new Array(go);ho{if(typeof Xr!="object"||typeof eo!="object")return eo;const to=Object.assign({},Xr);for(const ro in eo)Object.prototype.hasOwnProperty.call(eo,ro)&&(typeof eo[ro]=="object"&&Object.prototype.hasOwnProperty.call(Xr,ro)&&typeof Xr[ro]=="object"?to[ro]=deepMerge$1(Xr[ro],eo[ro]):to[ro]=eo[ro]);return to},processArgs=Xr=>{const eo=Xr.args.filter(ro=>typeof ro=="object"),to=Xr.args.filter(ro=>typeof ro!="object"||ro instanceof Error).map(ro=>ro.toString());return{objectArgs:eo,remainingArgs:to}},IGNORE_MESSAGES=["Failed to send logs to server"],messageQueue=[];let Logger$2=class h0{constructor(eo,to){this.name=eo,this.meta=void 0,to===void 0?this.level=LogLevel.WARN:this.level=to}static setEmitErrors(eo){eo!==void 0&&(h0.globalKeys.emitErrors=eo)}static setEnvironmentId(eo){eo!==void 0&&(h0.globalKeys.environmentId=eo)}setMetaData(eo,to){this.meta||(this.meta={});const ro={};eo.split(".").reduce((no,io,oo,ao)=>{if(oo===ao.length-1)no[io]=to;else return no[io]||(no[io]={}),no[io]},ro),this.meta=deepMerge$1(this.meta,ro)}getNameArray(eo){return Array.isArray(eo)?eo:[eo]}createLogger(eo,to){return new h0([...this.getNameArray(this.name),...this.getNameArray(eo)],to??this.level)}get logLevel(){return LogLevel[this.level]}setLogLevel(eo){if(eo in LogLevel&&typeof eo=="string")this.level=LogLevel[eo];else if(eo in LogLevel&&typeof eo=="number")this.level=eo;else throw new Error(`Invalid log level: ${eo}`)}formatMessage(eo,to){var ro;return to instanceof Error||to instanceof Object&&Object.prototype.hasOwnProperty.call(to,"stack")?to=to.stack:to instanceof Object&&(to=JSON.stringify(to)),`${(Array.isArray(this.name)?this.name:[this.name]).map(io=>`[${io}]`).join("")} [${(ro=LogLevel[eo])!==null&&ro!==void 0?ro:"TROUBLESHOOTING"}]: ${to}`}captureAndSend(eo,to,...ro){return __awaiter$p(this,void 0,void 0,function*(){h0.globalKeys.emitErrors&&!IGNORE_MESSAGES.includes(to==null?void 0:to.toString())&&typeof window<"u"&&this.emitHttpLogs(eo,to,{args:ro})})}emitHttpLogs(eo,to,{args:ro=[],transformMeta:no=io=>io}){messageQueue.push({args:ro,level:eo,message:to}),messageQueue.length===1&&queueMicrotask(()=>__awaiter$p(this,void 0,void 0,function*(){var io,oo;const ao=[];messageQueue.forEach(so=>{var co,lo,fo,ho,go,yo;const vo={},{objectArgs:wo,remainingArgs:Eo}=processArgs(so);Object.assign(vo,...wo),Object.assign(vo,{level:LogLevel[so.level],message:[so.message,...Eo].join(" "),meta:no(this.meta),url:{hostname:(co=window.location)===null||co===void 0?void 0:co.hostname,origin:(lo=window.location)===null||lo===void 0?void 0:lo.origin,pathname:(fo=window.location)===null||fo===void 0?void 0:fo.pathname,port:(ho=window.location)===null||ho===void 0?void 0:ho.port,protocol:(go=window.location)===null||go===void 0?void 0:go.protocol},userAgent:(yo=window.navigator)===null||yo===void 0?void 0:yo.userAgent}),ao.push(vo)});try{if(!(!((io=h0.globalKeys)===null||io===void 0)&&io.environmentId))throw new Error("Environment ID not set");yield fetch(`https://logs.dynamicauth.com/api/v1/${(oo=h0.globalKeys)===null||oo===void 0?void 0:oo.environmentId}`,{body:JSON.stringify(ao),headers:{"Content-Type":"application/json"},method:"POST",mode:"cors",referrerPolicy:"origin-when-cross-origin"})}catch(so){this.debug("Failed to send logs to server",so)}messageQueue.length=0}))}instrument(eo,to){return this.emitHttpLogs(LogLevel.INFO,eo,{args:[to],transformMeta:()=>{}})}log(eo,to,...ro){if(!(typeof window<"u"&&(window==null?void 0:window.dynamic_enableTroubleshootMode)===!0)&&(eo{packageVersions[Xr]=eo,versionCheckTimeout&&(clearTimeout(versionCheckTimeout),versionCheckTimeout=null),versionCheckTimeout=setTimeout(()=>{const ro=Object.values(packageVersions),[no]=ro;if(!ro.every(oo=>oo===no)){const oo=packageVersions["@dynamic-labs/sdk-react-core"]||no,ao=getErrorMessage(oo);logger$d.error(new Error(ao))}versionCheckTimeout=null},100)},getErrorMessage=Xr=>` +`),{cause:eo,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class UnknownNodeError extends BaseError{constructor({cause:eo}){super(`An error occurred while executing: ${eo==null?void 0:eo.shortMessage}`,{cause:eo,name:"UnknownNodeError"})}}function getNodeError(Xr,eo){const to=(Xr.details||"").toLowerCase(),ro=Xr instanceof BaseError?Xr.walk(no=>(no==null?void 0:no.code)===ExecutionRevertedError.code):Xr;return ro instanceof BaseError?new ExecutionRevertedError({cause:Xr,message:ro.details}):ExecutionRevertedError.nodeMessage.test(to)?new ExecutionRevertedError({cause:Xr,message:Xr.details}):FeeCapTooHighError.nodeMessage.test(to)?new FeeCapTooHighError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(to)?new FeeCapTooLowError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas}):NonceTooHighError.nodeMessage.test(to)?new NonceTooHighError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):NonceTooLowError.nodeMessage.test(to)?new NonceTooLowError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):NonceMaxValueError.nodeMessage.test(to)?new NonceMaxValueError({cause:Xr,nonce:eo==null?void 0:eo.nonce}):InsufficientFundsError$1.nodeMessage.test(to)?new InsufficientFundsError$1({cause:Xr}):IntrinsicGasTooHighError.nodeMessage.test(to)?new IntrinsicGasTooHighError({cause:Xr,gas:eo==null?void 0:eo.gas}):IntrinsicGasTooLowError.nodeMessage.test(to)?new IntrinsicGasTooLowError({cause:Xr,gas:eo==null?void 0:eo.gas}):TransactionTypeNotSupportedError.nodeMessage.test(to)?new TransactionTypeNotSupportedError({cause:Xr}):TipAboveFeeCapError.nodeMessage.test(to)?new TipAboveFeeCapError({cause:Xr,maxFeePerGas:eo==null?void 0:eo.maxFeePerGas,maxPriorityFeePerGas:eo==null?void 0:eo.maxPriorityFeePerGas}):new UnknownNodeError({cause:Xr})}function getEstimateGasError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new EstimateGasExecutionError(ro,{docsPath:eo,...to})}function extract(Xr,{format:eo}){if(!eo)return{};const to={};function ro(io){const oo=Object.keys(io);for(const ao of oo)ao in Xr&&(to[ao]=Xr[ao]),io[ao]&&typeof io[ao]=="object"&&!Array.isArray(io[ao])&&ro(io[ao])}const no=eo(Xr||{});return ro(no),to}function defineFormatter(Xr,eo){return({exclude:to,format:ro})=>({exclude:to,format:no=>{const io=eo(no);if(to)for(const oo of to)delete io[oo];return{...io,...ro(no)}},type:Xr})}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(Xr){const eo={};return typeof Xr.authorizationList<"u"&&(eo.authorizationList=formatAuthorizationList$1(Xr.authorizationList)),typeof Xr.accessList<"u"&&(eo.accessList=Xr.accessList),typeof Xr.blobVersionedHashes<"u"&&(eo.blobVersionedHashes=Xr.blobVersionedHashes),typeof Xr.blobs<"u"&&(typeof Xr.blobs[0]!="string"?eo.blobs=Xr.blobs.map(to=>bytesToHex$2(to)):eo.blobs=Xr.blobs),typeof Xr.data<"u"&&(eo.data=Xr.data),typeof Xr.from<"u"&&(eo.from=Xr.from),typeof Xr.gas<"u"&&(eo.gas=numberToHex(Xr.gas)),typeof Xr.gasPrice<"u"&&(eo.gasPrice=numberToHex(Xr.gasPrice)),typeof Xr.maxFeePerBlobGas<"u"&&(eo.maxFeePerBlobGas=numberToHex(Xr.maxFeePerBlobGas)),typeof Xr.maxFeePerGas<"u"&&(eo.maxFeePerGas=numberToHex(Xr.maxFeePerGas)),typeof Xr.maxPriorityFeePerGas<"u"&&(eo.maxPriorityFeePerGas=numberToHex(Xr.maxPriorityFeePerGas)),typeof Xr.nonce<"u"&&(eo.nonce=numberToHex(Xr.nonce)),typeof Xr.to<"u"&&(eo.to=Xr.to),typeof Xr.type<"u"&&(eo.type=rpcTransactionType[Xr.type]),typeof Xr.value<"u"&&(eo.value=numberToHex(Xr.value)),eo}const defineTransactionRequest=defineFormatter("transactionRequest",formatTransactionRequest);function formatAuthorizationList$1(Xr){return Xr.map(eo=>({address:eo.contractAddress,r:eo.r,s:eo.s,chainId:numberToHex(eo.chainId),nonce:numberToHex(eo.nonce),...typeof eo.yParity<"u"?{yParity:numberToHex(eo.yParity)}:{},...typeof eo.v<"u"&&typeof eo.yParity>"u"?{v:numberToHex(eo.v)}:{}}))}function serializeStateMapping(Xr){if(!(!Xr||Xr.length===0))return Xr.reduce((eo,{slot:to,value:ro})=>{if(to.length!==66)throw new InvalidBytesLengthError({size:to.length,targetSize:66,type:"hex"});if(ro.length!==66)throw new InvalidBytesLengthError({size:ro.length,targetSize:66,type:"hex"});return eo[to]=ro,eo},{})}function serializeAccountStateOverride(Xr){const{balance:eo,nonce:to,state:ro,stateDiff:no,code:io}=Xr,oo={};if(io!==void 0&&(oo.code=io),eo!==void 0&&(oo.balance=numberToHex(eo)),to!==void 0&&(oo.nonce=numberToHex(to)),ro!==void 0&&(oo.state=serializeStateMapping(ro)),no!==void 0){if(oo.state)throw new StateAssignmentConflictError;oo.stateDiff=serializeStateMapping(no)}return oo}function serializeStateOverride(Xr){if(!Xr)return;const eo={};for(const{address:to,...ro}of Xr){if(!isAddress(to,{strict:!1}))throw new InvalidAddressError({address:to});if(eo[to])throw new AccountStateConflictError({address:to});eo[to]=serializeAccountStateOverride(ro)}return eo}const maxUint16=2n**16n-1n,maxUint256=2n**256n-1n;function assertRequest(Xr){const{account:eo,gasPrice:to,maxFeePerGas:ro,maxPriorityFeePerGas:no,to:io}=Xr,oo=eo?parseAccount(eo):void 0;if(oo&&!isAddress(oo.address))throw new InvalidAddressError({address:oo.address});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(typeof to<"u"&&(typeof ro<"u"||typeof no<"u"))throw new FeeConflictError;if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro});if(no&&ro&&no>ro)throw new TipAboveFeeCapError({maxFeePerGas:ro,maxPriorityFeePerGas:no})}class BaseFeeScalarError extends BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Eip1559FeesNotSupportedError extends BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class MaxFeePerGasTooLowError extends BaseError{constructor({maxPriorityFeePerGas:eo}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei(eo)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class BlockNotFoundError extends BaseError{constructor({blockHash:eo,blockNumber:to}){let ro="Block";eo&&(ro=`Block at hash "${eo}"`),to&&(ro=`Block at number "${to}"`),super(`${ro} could not be found.`,{name:"BlockNotFoundError"})}}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(Xr){const eo={...Xr,blockHash:Xr.blockHash?Xr.blockHash:null,blockNumber:Xr.blockNumber?BigInt(Xr.blockNumber):null,chainId:Xr.chainId?hexToNumber$2(Xr.chainId):void 0,gas:Xr.gas?BigInt(Xr.gas):void 0,gasPrice:Xr.gasPrice?BigInt(Xr.gasPrice):void 0,maxFeePerBlobGas:Xr.maxFeePerBlobGas?BigInt(Xr.maxFeePerBlobGas):void 0,maxFeePerGas:Xr.maxFeePerGas?BigInt(Xr.maxFeePerGas):void 0,maxPriorityFeePerGas:Xr.maxPriorityFeePerGas?BigInt(Xr.maxPriorityFeePerGas):void 0,nonce:Xr.nonce?hexToNumber$2(Xr.nonce):void 0,to:Xr.to?Xr.to:null,transactionIndex:Xr.transactionIndex?Number(Xr.transactionIndex):null,type:Xr.type?transactionType[Xr.type]:void 0,typeHex:Xr.type?Xr.type:void 0,value:Xr.value?BigInt(Xr.value):void 0,v:Xr.v?BigInt(Xr.v):void 0};return Xr.authorizationList&&(eo.authorizationList=formatAuthorizationList(Xr.authorizationList)),eo.yParity=(()=>{if(Xr.yParity)return Number(Xr.yParity);if(typeof eo.v=="bigint"){if(eo.v===0n||eo.v===27n)return 0;if(eo.v===1n||eo.v===28n)return 1;if(eo.v>=35n)return eo.v%2n===0n?1:0}})(),eo.type==="legacy"&&(delete eo.accessList,delete eo.maxFeePerBlobGas,delete eo.maxFeePerGas,delete eo.maxPriorityFeePerGas,delete eo.yParity),eo.type==="eip2930"&&(delete eo.maxFeePerBlobGas,delete eo.maxFeePerGas,delete eo.maxPriorityFeePerGas),eo.type==="eip1559"&&delete eo.maxFeePerBlobGas,eo}const defineTransaction=defineFormatter("transaction",formatTransaction);function formatAuthorizationList(Xr){return Xr.map(eo=>({contractAddress:eo.address,chainId:Number(eo.chainId),nonce:Number(eo.nonce),r:eo.r,s:eo.s,yParity:Number(eo.yParity)}))}function formatBlock(Xr){var to;const eo=(to=Xr.transactions)==null?void 0:to.map(ro=>typeof ro=="string"?ro:formatTransaction(ro));return{...Xr,baseFeePerGas:Xr.baseFeePerGas?BigInt(Xr.baseFeePerGas):null,blobGasUsed:Xr.blobGasUsed?BigInt(Xr.blobGasUsed):void 0,difficulty:Xr.difficulty?BigInt(Xr.difficulty):void 0,excessBlobGas:Xr.excessBlobGas?BigInt(Xr.excessBlobGas):void 0,gasLimit:Xr.gasLimit?BigInt(Xr.gasLimit):void 0,gasUsed:Xr.gasUsed?BigInt(Xr.gasUsed):void 0,hash:Xr.hash?Xr.hash:null,logsBloom:Xr.logsBloom?Xr.logsBloom:null,nonce:Xr.nonce?Xr.nonce:null,number:Xr.number?BigInt(Xr.number):null,size:Xr.size?BigInt(Xr.size):void 0,timestamp:Xr.timestamp?BigInt(Xr.timestamp):void 0,transactions:eo,totalDifficulty:Xr.totalDifficulty?BigInt(Xr.totalDifficulty):null}}const defineBlock=defineFormatter("block",formatBlock);async function getBlock$1(Xr,{blockHash:eo,blockNumber:to,blockTag:ro,includeTransactions:no}={}){var lo,uo,ho;const io=ro??"latest",oo=no??!1,ao=to!==void 0?numberToHex(to):void 0;let so=null;if(eo?so=await Xr.request({method:"eth_getBlockByHash",params:[eo,oo]},{dedupe:!0}):so=await Xr.request({method:"eth_getBlockByNumber",params:[ao||io,oo]},{dedupe:!!ao}),!so)throw new BlockNotFoundError({blockHash:eo,blockNumber:to});return(((ho=(uo=(lo=Xr.chain)==null?void 0:lo.formatters)==null?void 0:uo.block)==null?void 0:ho.format)||formatBlock)(so)}async function getGasPrice(Xr){const eo=await Xr.request({method:"eth_gasPrice"});return BigInt(eo)}async function estimateMaxPriorityFeePerGas(Xr,eo){return internal_estimateMaxPriorityFeePerGas(Xr,eo)}async function internal_estimateMaxPriorityFeePerGas(Xr,eo){var io,oo;const{block:to,chain:ro=Xr.chain,request:no}=eo||{};try{const ao=((io=ro==null?void 0:ro.fees)==null?void 0:io.maxPriorityFeePerGas)??((oo=ro==null?void 0:ro.fees)==null?void 0:oo.defaultPriorityFee);if(typeof ao=="function"){const co=to||await getAction(Xr,getBlock$1,"getBlock")({}),lo=await ao({block:co,client:Xr,request:no});if(lo===null)throw new Error;return lo}if(typeof ao<"u")return ao;const so=await Xr.request({method:"eth_maxPriorityFeePerGas"});return hexToBigInt(so)}catch{const[ao,so]=await Promise.all([to?Promise.resolve(to):getAction(Xr,getBlock$1,"getBlock")({}),getAction(Xr,getGasPrice,"getGasPrice")({})]);if(typeof ao.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const co=so-ao.baseFeePerGas;return co<0n?0n:co}}async function estimateFeesPerGas$1(Xr,eo){return internal_estimateFeesPerGas(Xr,eo)}async function internal_estimateFeesPerGas(Xr,eo){var ho,go;const{block:to,chain:ro=Xr.chain,request:no,type:io="eip1559"}=eo||{},oo=await(async()=>{var bo,wo;return typeof((bo=ro==null?void 0:ro.fees)==null?void 0:bo.baseFeeMultiplier)=="function"?ro.fees.baseFeeMultiplier({block:to,client:Xr,request:no}):((wo=ro==null?void 0:ro.fees)==null?void 0:wo.baseFeeMultiplier)??1.2})();if(oo<1)throw new BaseFeeScalarError;const so=10**(((ho=oo.toString().split(".")[1])==null?void 0:ho.length)??0),co=bo=>bo*BigInt(Math.ceil(oo*so))/BigInt(so),lo=to||await getAction(Xr,getBlock$1,"getBlock")({});if(typeof((go=ro==null?void 0:ro.fees)==null?void 0:go.estimateFeesPerGas)=="function"){const bo=await ro.fees.estimateFeesPerGas({block:to,client:Xr,multiply:co,request:no,type:io});if(bo!==null)return bo}if(io==="eip1559"){if(typeof lo.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const bo=typeof(no==null?void 0:no.maxPriorityFeePerGas)=="bigint"?no.maxPriorityFeePerGas:await internal_estimateMaxPriorityFeePerGas(Xr,{block:lo,chain:ro,request:no}),wo=co(lo.baseFeePerGas);return{maxFeePerGas:(no==null?void 0:no.maxFeePerGas)??wo+bo,maxPriorityFeePerGas:bo}}return{gasPrice:(no==null?void 0:no.gasPrice)??co(await getAction(Xr,getGasPrice,"getGasPrice")({}))}}async function getTransactionCount(Xr,{address:eo,blockTag:to="latest",blockNumber:ro}){const no=await Xr.request({method:"eth_getTransactionCount",params:[eo,ro?numberToHex(ro):to]},{dedupe:!!ro});return hexToNumber$2(no)}function blobsToCommitments(Xr){const{kzg:eo}=Xr,to=Xr.to??(typeof Xr.blobs[0]=="string"?"hex":"bytes"),ro=typeof Xr.blobs[0]=="string"?Xr.blobs.map(io=>hexToBytes$3(io)):Xr.blobs,no=[];for(const io of ro)no.push(Uint8Array.from(eo.blobToKzgCommitment(io)));return to==="bytes"?no:no.map(io=>bytesToHex$2(io))}function blobsToProofs(Xr){const{kzg:eo}=Xr,to=Xr.to??(typeof Xr.blobs[0]=="string"?"hex":"bytes"),ro=typeof Xr.blobs[0]=="string"?Xr.blobs.map(oo=>hexToBytes$3(oo)):Xr.blobs,no=typeof Xr.commitments[0]=="string"?Xr.commitments.map(oo=>hexToBytes$3(oo)):Xr.commitments,io=[];for(let oo=0;oobytesToHex$2(oo))}function sha256$6(Xr,eo){const to=eo||"hex",ro=sha256_1$4(isHex$4(Xr,{strict:!1})?toBytes$1(Xr):Xr);return to==="bytes"?ro:toHex$1(ro)}function commitmentToVersionedHash(Xr){const{commitment:eo,version:to=1}=Xr,ro=Xr.to??(typeof eo=="string"?"hex":"bytes"),no=sha256$6(eo,"bytes");return no.set([to],0),ro==="bytes"?no:bytesToHex$2(no)}function commitmentsToVersionedHashes(Xr){const{commitments:eo,version:to}=Xr,ro=Xr.to??(typeof eo[0]=="string"?"hex":"bytes"),no=[];for(const io of eo)no.push(commitmentToVersionedHash({commitment:io,to:ro,version:to}));return no}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError{constructor({maxSize:eo,size:to}){super("Blob size is too large.",{metaMessages:[`Max: ${eo} bytes`,`Given: ${to} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError{constructor({hash:eo,size:to}){super(`Versioned hash "${eo}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${to}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError{constructor({hash:eo,version:to}){super(`Versioned hash "${eo}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${to}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(Xr){const eo=Xr.to??(typeof Xr.data=="string"?"hex":"bytes"),to=typeof Xr.data=="string"?hexToBytes$3(Xr.data):Xr.data,ro=size$1(to);if(!ro)throw new EmptyBlobError;if(ro>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:ro});const no=[];let io=!0,oo=0;for(;io;){const ao=createCursor(new Uint8Array(bytesPerBlob));let so=0;for(;soao.bytes):no.map(ao=>bytesToHex$2(ao.bytes))}function toBlobSidecars(Xr){const{data:eo,kzg:to,to:ro}=Xr,no=Xr.blobs??toBlobs({data:eo,to:ro}),io=Xr.commitments??blobsToCommitments({blobs:no,kzg:to,to:ro}),oo=Xr.proofs??blobsToProofs({blobs:no,commitments:io,kzg:to,to:ro}),ao=[];for(let so=0;so"u"&&uo)if(so){const $o=await Eo();ho.nonce=await so.consume({address:uo.address,chainId:$o,client:Xr})}else ho.nonce=await getAction(Xr,getTransactionCount,"getTransactionCount")({address:uo.address,blockTag:"pending"});if((co.includes("fees")||co.includes("type"))&&typeof lo>"u")try{ho.type=getTransactionType(ho)}catch{const $o=await bo();ho.type=typeof($o==null?void 0:$o.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(co.includes("fees"))if(ho.type!=="legacy"&&ho.type!=="eip2930"){if(typeof ho.maxFeePerGas>"u"||typeof ho.maxPriorityFeePerGas>"u"){const $o=await bo(),{maxFeePerGas:Co,maxPriorityFeePerGas:Ro}=await internal_estimateFeesPerGas(Xr,{block:$o,chain:no,request:ho});if(typeof eo.maxPriorityFeePerGas>"u"&&eo.maxFeePerGas&&eo.maxFeePerGas"u"&&(ho.gas=await getAction(Xr,estimateGas$1,"estimateGas")({...ho,account:uo&&{address:uo.address,type:"json-rpc"}})),assertRequest(ho),delete ho.parameters,ho}async function getBalance(Xr,{address:eo,blockNumber:to,blockTag:ro="latest"}){const no=to?numberToHex(to):void 0,io=await Xr.request({method:"eth_getBalance",params:[eo,no||ro]});return BigInt(io)}async function estimateGas$1(Xr,eo){var no,io,oo;const{account:to=Xr.account}=eo,ro=to?parseAccount(to):void 0;try{let vo=function(So){const{block:To,request:Ao,rpcStateOverride:ko}=So;return Xr.request({method:"eth_estimateGas",params:ko?[Ao,To??"latest",ko]:To?[Ao,To]:[Ao]})};const{accessList:ao,authorizationList:so,blobs:co,blobVersionedHashes:lo,blockNumber:uo,blockTag:ho,data:go,gas:bo,gasPrice:wo,maxFeePerBlobGas:Eo,maxFeePerGas:$o,maxPriorityFeePerGas:Co,nonce:Ro,value:Oo,stateOverride:jo,...Bo}=await prepareTransactionRequest(Xr,{...eo,parameters:(ro==null?void 0:ro.type)==="local"?void 0:["blobVersionedHashes"]}),Fo=(uo?numberToHex(uo):void 0)||ho,Wo=serializeStateOverride(jo),Jo=await(async()=>{if(Bo.to)return Bo.to;if(so&&so.length>0)return await recoverAuthorizationAddress({authorization:so[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`")})})();assertRequest(eo);const Po=(oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionRequest)==null?void 0:oo.format,yo=(Po||formatTransactionRequest)({...extract(Bo,{format:Po}),from:ro==null?void 0:ro.address,accessList:ao,authorizationList:so,blobs:co,blobVersionedHashes:lo,data:go,gas:bo,gasPrice:wo,maxFeePerBlobGas:Eo,maxFeePerGas:$o,maxPriorityFeePerGas:Co,nonce:Ro,to:Jo,value:Oo});let _o=BigInt(await vo({block:Fo,request:yo,rpcStateOverride:Wo}));if(so){const So=await getBalance(Xr,{address:yo.from}),To=await Promise.all(so.map(async Ao=>{const{contractAddress:ko}=Ao,mo=await vo({block:Fo,request:{authorizationList:void 0,data:go,from:ro==null?void 0:ro.address,to:ko,value:numberToHex(So)},rpcStateOverride:Wo}).catch(()=>100000n);return 2n*BigInt(mo)}));_o+=To.reduce((Ao,ko)=>Ao+ko,0n)}return _o}catch(ao){throw getEstimateGasError(ao,{...eo,account:ro,chain:Xr.chain})}}async function estimateContractGas(Xr,eo){const{abi:to,address:ro,args:no,functionName:io,...oo}=eo,ao=encodeFunctionData({abi:to,args:no,functionName:io});try{return await getAction(Xr,estimateGas$1,"estimateGas")({data:ao,to:ro,...oo})}catch(so){const co=oo.account?parseAccount(oo.account):void 0;throw getContractError(so,{abi:to,address:ro,args:no,docsPath:"/docs/contract/estimateContractGas",functionName:io,sender:co==null?void 0:co.address})}}function isAddressEqual(Xr,eo){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});if(!isAddress(eo,{strict:!1}))throw new InvalidAddressError({address:eo});return Xr.toLowerCase()===eo.toLowerCase()}const docsPath$2="/docs/contract/decodeEventLog";function decodeEventLog(Xr){const{abi:eo,data:to,strict:ro,topics:no}=Xr,io=ro??!0,[oo,...ao]=no;if(!oo)throw new AbiEventSignatureEmptyTopicsError({docsPath:docsPath$2});const so=eo.length===1?eo[0]:eo.find(wo=>wo.type==="event"&&oo===toEventSelector(formatAbiItem(wo)));if(!(so&&"name"in so)||so.type!=="event")throw new AbiEventSignatureNotFoundError(oo,{docsPath:docsPath$2});const{name:co,inputs:lo}=so,uo=lo==null?void 0:lo.some(wo=>!("name"in wo&&wo.name));let ho=uo?[]:{};const go=lo.filter(wo=>"indexed"in wo&&wo.indexed);for(let wo=0;wo!("indexed"in wo&&wo.indexed));if(bo.length>0){if(to&&to!=="0x")try{const wo=decodeAbiParameters(bo,to);if(wo)if(uo)ho=[...ho,...wo];else for(let Eo=0;Eo0?ho:void 0}}function decodeTopic({param:Xr,value:eo}){return Xr.type==="string"||Xr.type==="bytes"||Xr.type==="tuple"||Xr.type.match(/^(.*)\[(\d+)?\]$/)?eo:(decodeAbiParameters([Xr],eo)||[])[0]}function parseEventLogs(Xr){const{abi:eo,args:to,logs:ro,strict:no=!0}=Xr,io=(()=>{if(Xr.eventName)return Array.isArray(Xr.eventName)?Xr.eventName:[Xr.eventName]})();return ro.map(oo=>{var ao;try{const so=eo.find(lo=>lo.type==="event"&&oo.topics[0]===toEventSelector(lo));if(!so)return null;const co=decodeEventLog({...oo,abi:[so],strict:no});return io&&!io.includes(co.eventName)||!includesArgs({args:co.args,inputs:so.inputs,matchArgs:to})?null:{...co,...oo}}catch(so){let co,lo;if(so instanceof AbiEventSignatureNotFoundError)return null;if(so instanceof DecodeLogDataMismatch||so instanceof DecodeLogTopicsMismatch){if(no)return null;co=so.abiItem.name,lo=(ao=so.abiItem.inputs)==null?void 0:ao.some(uo=>!("name"in uo&&uo.name))}return{...oo,args:lo?[]:{},eventName:co}}}).filter(Boolean)}function includesArgs(Xr){const{args:eo,inputs:to,matchArgs:ro}=Xr;if(!ro)return!0;if(!eo)return!1;function no(io,oo,ao){try{return io.type==="address"?isAddressEqual(oo,ao):io.type==="string"||io.type==="bytes"?keccak256(toBytes$1(oo))===ao:oo===ao}catch{return!1}}return Array.isArray(eo)&&Array.isArray(ro)?ro.every((io,oo)=>{if(io==null)return!0;const ao=to[oo];return ao?(Array.isArray(io)?io:[io]).some(co=>no(ao,co,eo[oo])):!1}):typeof eo=="object"&&!Array.isArray(eo)&&typeof ro=="object"&&!Array.isArray(ro)?Object.entries(ro).every(([io,oo])=>{if(oo==null)return!0;const ao=to.find(co=>co.name===io);return ao?(Array.isArray(oo)?oo:[oo]).some(co=>no(ao,co,eo[io])):!1}):!1}function formatLog(Xr,{args:eo,eventName:to}={}){return{...Xr,blockHash:Xr.blockHash?Xr.blockHash:null,blockNumber:Xr.blockNumber?BigInt(Xr.blockNumber):null,logIndex:Xr.logIndex?Number(Xr.logIndex):null,transactionHash:Xr.transactionHash?Xr.transactionHash:null,transactionIndex:Xr.transactionIndex?Number(Xr.transactionIndex):null,...to?{args:eo,eventName:to}:{}}}async function getLogs(Xr,{address:eo,blockHash:to,fromBlock:ro,toBlock:no,event:io,events:oo,args:ao,strict:so}={}){const co=so??!1,lo=oo??(io?[io]:void 0);let uo=[];lo&&(uo=[lo.flatMap(wo=>encodeEventTopics({abi:[wo],eventName:wo.name,args:oo?void 0:ao}))],io&&(uo=uo[0]));let ho;to?ho=await Xr.request({method:"eth_getLogs",params:[{address:eo,topics:uo,blockHash:to}]}):ho=await Xr.request({method:"eth_getLogs",params:[{address:eo,topics:uo,fromBlock:typeof ro=="bigint"?numberToHex(ro):ro,toBlock:typeof no=="bigint"?numberToHex(no):no}]});const go=ho.map(bo=>formatLog(bo));return lo?parseEventLogs({abi:lo,args:ao,logs:go,strict:co}):go}async function getContractEvents(Xr,eo){const{abi:to,address:ro,args:no,blockHash:io,eventName:oo,fromBlock:ao,toBlock:so,strict:co}=eo,lo=oo?getAbiItem({abi:to,name:oo}):void 0,uo=lo?void 0:to.filter(ho=>ho.type==="event");return getAction(Xr,getLogs,"getLogs")({address:ro,args:no,blockHash:io,event:lo,events:uo,fromBlock:ao,toBlock:so,strict:co})}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(Xr){const{abi:eo,args:to,functionName:ro,data:no}=Xr;let io=eo[0];if(ro){const ao=getAbiItem({abi:eo,args:to,name:ro});if(!ao)throw new AbiFunctionNotFoundError(ro,{docsPath:docsPath$1});io=ao}if(io.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!io.outputs)throw new AbiFunctionOutputsNotFoundError(io.name,{docsPath:docsPath$1});const oo=decodeAbiParameters(io.outputs,no);if(oo&&oo.length>1)return oo;if(oo&&oo.length===1)return oo[0]}const multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],universalResolverErrors=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],universalResolverResolveAbi=[...universalResolverErrors,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],universalResolverReverseAbi=[...universalResolverErrors,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],universalSignatureValidatorAbi=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",universalSignatureValidatorByteCode="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ChainDoesNotSupportContract extends BaseError{constructor({blockNumber:eo,chain:to,contract:ro}){super(`Chain "${to.name}" does not support contract "${ro.name}".`,{metaMessages:["This could be due to any of the following:",...eo&&ro.blockCreated&&ro.blockCreated>eo?[`- The contract "${ro.name}" was not deployed until block ${ro.blockCreated} (current block ${eo}).`]:[`- The chain does not have the contract "${ro.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ChainMismatchError extends BaseError{constructor({chain:eo,currentChainId:to}){super(`The current chain of the wallet (id: ${to}) does not match the target chain for the transaction (id: ${eo.id} – ${eo.name}).`,{metaMessages:[`Current Chain ID: ${to}`,`Expected Chain ID: ${eo.id} – ${eo.name}`],name:"ChainMismatchError"})}}class ChainNotFoundError extends BaseError{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}class ClientChainNotConfiguredError extends BaseError{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError{constructor({chainId:eo}){super(typeof eo=="number"?`Chain ID "${eo}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const docsPath="/docs/contract/encodeDeployData";function encodeDeployData(Xr){const{abi:eo,args:to,bytecode:ro}=Xr;if(!to||to.length===0)return ro;const no=eo.find(oo=>"type"in oo&&oo.type==="constructor");if(!no)throw new AbiConstructorNotFoundError({docsPath});if(!("inputs"in no))throw new AbiConstructorParamsNotFoundError({docsPath});if(!no.inputs||no.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath});const io=encodeAbiParameters(no.inputs,to);return concatHex([ro,io])}function getChainContractAddress({blockNumber:Xr,chain:eo,contract:to}){var no;const ro=(no=eo==null?void 0:eo.contracts)==null?void 0:no[to];if(!ro)throw new ChainDoesNotSupportContract({chain:eo,contract:{name:to}});if(Xr&&ro.blockCreated&&ro.blockCreated>Xr)throw new ChainDoesNotSupportContract({blockNumber:Xr,chain:eo,contract:{name:to,blockCreated:ro.blockCreated}});return ro.address}function getCallError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new CallExecutionError(ro,{docsPath:eo,...to})}function withResolvers(){let Xr=()=>{},eo=()=>{};return{promise:new Promise((ro,no)=>{Xr=ro,eo=no}),resolve:Xr,reject:eo}}const schedulerCache=new Map;function createBatchScheduler({fn:Xr,id:eo,shouldSplitBatch:to,wait:ro=0,sort:no}){const io=async()=>{const lo=so();oo();const uo=lo.map(({args:ho})=>ho);uo.length!==0&&Xr(uo).then(ho=>{no&&Array.isArray(ho)&&ho.sort(no);for(let go=0;go{for(let go=0;goschedulerCache.delete(eo),ao=()=>so().map(({args:lo})=>lo),so=()=>schedulerCache.get(eo)||[],co=lo=>schedulerCache.set(eo,[...so(),lo]);return{flush:oo,async schedule(lo){const{promise:uo,resolve:ho,reject:go}=withResolvers();return(to==null?void 0:to([...ao(),lo]))&&io(),so().length>0?(co({args:lo,resolve:ho,reject:go}),uo):(co({args:lo,resolve:ho,reject:go}),setTimeout(io,ro),uo)}}}async function call(Xr,eo){var Po,fo,yo,vo;const{account:to=Xr.account,batch:ro=!!((Po=Xr.batch)!=null&&Po.multicall),blockNumber:no,blockTag:io="latest",accessList:oo,blobs:ao,code:so,data:co,factory:lo,factoryData:uo,gas:ho,gasPrice:go,maxFeePerBlobGas:bo,maxFeePerGas:wo,maxPriorityFeePerGas:Eo,nonce:$o,to:Co,value:Ro,stateOverride:Oo,...jo}=eo,Bo=to?parseAccount(to):void 0;if(so&&(lo||uo))throw new BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(so&&Co)throw new BaseError("Cannot provide both `code` & `to` as parameters.");const Mo=so&&co,Fo=lo&&uo&&Co&&co,Wo=Mo||Fo,Jo=Mo?toDeploylessCallViaBytecodeData({code:so,data:co}):Fo?toDeploylessCallViaFactoryData({data:co,factory:lo,factoryData:uo,to:Co}):co;try{assertRequest(eo);const So=(no?numberToHex(no):void 0)||io,To=serializeStateOverride(Oo),Ao=(vo=(yo=(fo=Xr.chain)==null?void 0:fo.formatters)==null?void 0:yo.transactionRequest)==null?void 0:vo.format,mo=(Ao||formatTransactionRequest)({...extract(jo,{format:Ao}),from:Bo==null?void 0:Bo.address,accessList:oo,blobs:ao,data:Jo,gas:ho,gasPrice:go,maxFeePerBlobGas:bo,maxFeePerGas:wo,maxPriorityFeePerGas:Eo,nonce:$o,to:Wo?void 0:Co,value:Ro});if(ro&&shouldPerformMulticall({request:mo})&&!To)try{return await scheduleMulticall(Xr,{...mo,blockNumber:no,blockTag:io})}catch(Do){if(!(Do instanceof ClientChainNotConfiguredError)&&!(Do instanceof ChainDoesNotSupportContract))throw Do}const Io=await Xr.request({method:"eth_call",params:To?[mo,So,To]:[mo,So]});return Io==="0x"?{data:void 0}:{data:Io}}catch(_o){const So=getRevertErrorData(_o),{offchainLookup:To,offchainLookupSignature:Ao}=await __vitePreload(async()=>{const{offchainLookup:ko,offchainLookupSignature:mo}=await import("./ccip-DBR7mZLx.js");return{offchainLookup:ko,offchainLookupSignature:mo}},[]);if(Xr.ccipRead!==!1&&(So==null?void 0:So.slice(0,10))===Ao&&Co)return{data:await To(Xr,{data:So,to:Co})};throw Wo&&(So==null?void 0:So.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lo}):getCallError(_o,{...eo,account:Bo,chain:Xr.chain})}}function shouldPerformMulticall({request:Xr}){const{data:eo,to,...ro}=Xr;return!(!eo||eo.startsWith(aggregate3Signature)||!to||Object.values(ro).filter(no=>typeof no<"u").length>0)}async function scheduleMulticall(Xr,eo){var wo;const{batchSize:to=1024,wait:ro=0}=typeof((wo=Xr.batch)==null?void 0:wo.multicall)=="object"?Xr.batch.multicall:{},{blockNumber:no,blockTag:io="latest",data:oo,multicallAddress:ao,to:so}=eo;let co=ao;if(!co){if(!Xr.chain)throw new ClientChainNotConfiguredError;co=getChainContractAddress({blockNumber:no,chain:Xr.chain,contract:"multicall3"})}const uo=(no?numberToHex(no):void 0)||io,{schedule:ho}=createBatchScheduler({id:`${Xr.uid}.${uo}`,wait:ro,shouldSplitBatch(Eo){return Eo.reduce((Co,{data:Ro})=>Co+(Ro.length-2),0)>to*2},fn:async Eo=>{const $o=Eo.map(Oo=>({allowFailure:!0,callData:Oo.data,target:Oo.to})),Co=encodeFunctionData({abi:multicall3Abi,args:[$o],functionName:"aggregate3"}),Ro=await Xr.request({method:"eth_call",params:[{data:Co,to:co},uo]});return decodeFunctionResult({abi:multicall3Abi,args:[$o],functionName:"aggregate3",data:Ro||"0x"})}}),[{returnData:go,success:bo}]=await ho({data:oo,to:so});if(!bo)throw new RawContractError({data:go});return go==="0x"?{data:void 0}:{data:go}}function toDeploylessCallViaBytecodeData(Xr){const{code:eo,data:to}=Xr;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[eo,to]})}function toDeploylessCallViaFactoryData(Xr){const{data:eo,factory:to,factoryData:ro,to:no}=Xr;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[no,eo,to,ro]})}function getRevertErrorData(Xr){var to;if(!(Xr instanceof BaseError))return;const eo=Xr.walk();return typeof(eo==null?void 0:eo.data)=="object"?(to=eo.data)==null?void 0:to.data:eo.data}async function readContract(Xr,eo){const{abi:to,address:ro,args:no,functionName:io,...oo}=eo,ao=encodeFunctionData({abi:to,args:no,functionName:io});try{const{data:so}=await getAction(Xr,call,"call")({...oo,data:ao,to:ro});return decodeFunctionResult({abi:to,args:no,functionName:io,data:so||"0x"})}catch(so){throw getContractError(so,{abi:to,address:ro,args:no,docsPath:"/docs/contract/readContract",functionName:io})}}async function simulateContract(Xr,eo){const{abi:to,address:ro,args:no,dataSuffix:io,functionName:oo,...ao}=eo,so=ao.account?parseAccount(ao.account):Xr.account,co=encodeFunctionData({abi:to,args:no,functionName:oo});try{const{data:lo}=await getAction(Xr,call,"call")({batch:!1,data:`${co}${io?io.replace("0x",""):""}`,to:ro,...ao,account:so}),uo=decodeFunctionResult({abi:to,args:no,functionName:oo,data:lo||"0x"}),ho=to.filter(go=>"name"in go&&go.name===eo.functionName);return{result:uo,request:{abi:ho,address:ro,args:no,dataSuffix:io,functionName:oo,...ao,account:so}}}catch(lo){throw getContractError(lo,{abi:to,address:ro,args:no,docsPath:"/docs/contract/simulateContract",functionName:oo,sender:so==null?void 0:so.address})}}const listenersCache=new Map,cleanupCache=new Map;let callbackCount=0;function observe(Xr,eo,to){const ro=++callbackCount,no=()=>listenersCache.get(Xr)||[],io=()=>{const lo=no();listenersCache.set(Xr,lo.filter(uo=>uo.id!==ro))},oo=()=>{const lo=cleanupCache.get(Xr);no().length===1&&lo&&lo(),io()},ao=no();if(listenersCache.set(Xr,[...ao,{id:ro,fns:eo}]),ao&&ao.length>0)return oo;const so={};for(const lo in eo)so[lo]=(...uo)=>{var go,bo;const ho=no();if(ho.length!==0)for(const wo of ho)(bo=(go=wo.fns)[lo])==null||bo.call(go,...uo)};const co=to(so);return typeof co=="function"&&cleanupCache.set(Xr,co),oo}async function wait$1(Xr){return new Promise(eo=>setTimeout(eo,Xr))}function poll$1(Xr,{emitOnBegin:eo,initialWaitTime:to,interval:ro}){let no=!0;const io=()=>no=!1;return(async()=>{let ao;eo&&(ao=await Xr({unpoll:io}));const so=await(to==null?void 0:to(ao))??ro;await wait$1(so);const co=async()=>{no&&(await Xr({unpoll:io}),await wait$1(ro),co())};co()})(),io}const promiseCache$1=new Map,responseCache=new Map;function getCache$1(Xr){const eo=(no,io)=>({clear:()=>io.delete(no),get:()=>io.get(no),set:oo=>io.set(no,oo)}),to=eo(Xr,promiseCache$1),ro=eo(Xr,responseCache);return{clear:()=>{to.clear(),ro.clear()},promise:to,response:ro}}async function withCache(Xr,{cacheKey:eo,cacheTime:to=Number.POSITIVE_INFINITY}){const ro=getCache$1(eo),no=ro.response.get();if(no&&to>0&&new Date().getTime()-no.created.getTime()`blockNumber.${Xr}`;async function getBlockNumber(Xr,{cacheTime:eo=Xr.cacheTime}={}){const to=await withCache(()=>Xr.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(Xr.uid),cacheTime:eo});return BigInt(to)}async function getFilterChanges(Xr,{filter:eo}){const to="strict"in eo&&eo.strict,ro=await eo.request({method:"eth_getFilterChanges",params:[eo.id]});if(typeof ro[0]=="string")return ro;const no=ro.map(io=>formatLog(io));return!("abi"in eo)||!eo.abi?no:parseEventLogs({abi:eo.abi,logs:no,strict:to})}async function uninstallFilter(Xr,{filter:eo}){return eo.request({method:"eth_uninstallFilter",params:[eo.id]})}function watchContractEvent(Xr,eo){const{abi:to,address:ro,args:no,batch:io=!0,eventName:oo,fromBlock:ao,onError:so,onLogs:co,poll:lo,pollingInterval:uo=Xr.pollingInterval,strict:ho}=eo;return(typeof lo<"u"?lo:typeof ao=="bigint"?!0:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"))?(()=>{const Eo=ho??!1,$o=stringify$4(["watchContractEvent",ro,no,io,Xr.uid,oo,uo,Eo,ao]);return observe($o,{onLogs:co,onError:so},Co=>{let Ro;ao!==void 0&&(Ro=ao-1n);let Oo,jo=!1;const Bo=poll$1(async()=>{var Mo;if(!jo){try{Oo=await getAction(Xr,createContractEventFilter,"createContractEventFilter")({abi:to,address:ro,args:no,eventName:oo,strict:Eo,fromBlock:ao})}catch{}jo=!0;return}try{let Fo;if(Oo)Fo=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:Oo});else{const Wo=await getAction(Xr,getBlockNumber,"getBlockNumber")({});Ro&&Ro{Oo&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:Oo}),Bo()}})})():(()=>{const Eo=ho??!1,$o=stringify$4(["watchContractEvent",ro,no,io,Xr.uid,oo,uo,Eo]);let Co=!0,Ro=()=>Co=!1;return observe($o,{onLogs:co,onError:so},Oo=>((async()=>{try{const jo=(()=>{if(Xr.transport.type==="fallback"){const Fo=Xr.transport.transports.find(Wo=>Wo.config.type==="webSocket");return Fo?Fo.value:Xr.transport}return Xr.transport})(),Bo=oo?encodeEventTopics({abi:to,eventName:oo,args:no}):[],{unsubscribe:Mo}=await jo.subscribe({params:["logs",{address:ro,topics:Bo}],onData(Fo){var Jo;if(!Co)return;const Wo=Fo.result;try{const{eventName:Po,args:fo}=decodeEventLog({abi:to,data:Wo.data,topics:Wo.topics,strict:ho}),yo=formatLog(Wo,{args:fo,eventName:Po});Oo.onLogs([yo])}catch(Po){let fo,yo;if(Po instanceof DecodeLogDataMismatch||Po instanceof DecodeLogTopicsMismatch){if(ho)return;fo=Po.abiItem.name,yo=(Jo=Po.abiItem.inputs)==null?void 0:Jo.some(_o=>!("name"in _o&&_o.name))}const vo=formatLog(Wo,{args:yo?[]:{},eventName:fo});Oo.onLogs([vo])}},onError(Fo){var Wo;(Wo=Oo.onError)==null||Wo.call(Oo,Fo)}});Ro=Mo,Co||Ro()}catch(jo){so==null||so(jo)}})(),()=>Ro()))})()}class AccountNotFoundError extends BaseError{constructor({docsPath:eo}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:eo,docsSlug:"account",name:"AccountNotFoundError"})}}class AccountTypeNotSupportedError extends BaseError{constructor({docsPath:eo,metaMessages:to,type:ro}){super(`Account type "${ro}" is not supported.`,{docsPath:eo,metaMessages:to,name:"AccountTypeNotSupportedError"})}}function assertCurrentChain({chain:Xr,currentChainId:eo}){if(!Xr)throw new ChainNotFoundError;if(eo!==Xr.id)throw new ChainMismatchError({chain:Xr,currentChainId:eo})}function getTransactionError(Xr,{docsPath:eo,...to}){const ro=(()=>{const no=getNodeError(Xr,to);return no instanceof UnknownNodeError?Xr:no})();return new TransactionExecutionError(ro,{docsPath:eo,...to})}async function sendRawTransaction(Xr,{serializedTransaction:eo}){return Xr.request({method:"eth_sendRawTransaction",params:[eo]},{retryCount:0})}const supportsWalletNamespace=new LruMap(128);async function sendTransaction$1(Xr,eo){var $o,Co,Ro,Oo;const{account:to=Xr.account,chain:ro=Xr.chain,accessList:no,authorizationList:io,blobs:oo,data:ao,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:uo,maxPriorityFeePerGas:ho,nonce:go,value:bo,...wo}=eo;if(typeof to>"u")throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const Eo=to?parseAccount(to):null;try{assertRequest(eo);const jo=await(async()=>{if(eo.to)return eo.to;if(io&&io.length>0)return await recoverAuthorizationAddress({authorization:io[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((Eo==null?void 0:Eo.type)==="json-rpc"||Eo===null){let Bo;ro!==null&&(Bo=await getAction(Xr,getChainId$1,"getChainId")({}),assertCurrentChain({currentChainId:Bo,chain:ro}));const Mo=(Ro=(Co=($o=Xr.chain)==null?void 0:$o.formatters)==null?void 0:Co.transactionRequest)==null?void 0:Ro.format,Wo=(Mo||formatTransactionRequest)({...extract(wo,{format:Mo}),accessList:no,authorizationList:io,blobs:oo,chainId:Bo,data:ao,from:Eo==null?void 0:Eo.address,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:uo,maxPriorityFeePerGas:ho,nonce:go,to:jo,value:bo}),Jo=supportsWalletNamespace.get(Xr.uid),Po=Jo?"wallet_sendTransaction":"eth_sendTransaction";try{return await Xr.request({method:Po,params:[Wo]},{retryCount:0})}catch(fo){if(Jo===!1)throw fo;const yo=fo;if(yo.name==="InvalidInputRpcError"||yo.name==="InvalidParamsRpcError"||yo.name==="MethodNotFoundRpcError"||yo.name==="MethodNotSupportedRpcError")return await Xr.request({method:"wallet_sendTransaction",params:[Wo]},{retryCount:0}).then(vo=>(supportsWalletNamespace.set(Xr.uid,!0),vo)).catch(vo=>{const _o=vo;throw _o.name==="MethodNotFoundRpcError"||_o.name==="MethodNotSupportedRpcError"?(supportsWalletNamespace.set(Xr.uid,!1),yo):_o});throw yo}}if((Eo==null?void 0:Eo.type)==="local"){const Bo=await getAction(Xr,prepareTransactionRequest,"prepareTransactionRequest")({account:Eo,accessList:no,authorizationList:io,blobs:oo,chain:ro,data:ao,gas:so,gasPrice:co,maxFeePerBlobGas:lo,maxFeePerGas:uo,maxPriorityFeePerGas:ho,nonce:go,nonceManager:Eo.nonceManager,parameters:[...defaultParameters,"sidecars"],value:bo,...wo,to:jo}),Mo=(Oo=ro==null?void 0:ro.serializers)==null?void 0:Oo.transaction,Fo=await Eo.signTransaction(Bo,{serializer:Mo});return await getAction(Xr,sendRawTransaction,"sendRawTransaction")({serializedTransaction:Fo})}throw(Eo==null?void 0:Eo.type)==="smart"?new AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:Eo==null?void 0:Eo.type})}catch(jo){throw jo instanceof AccountTypeNotSupportedError?jo:getTransactionError(jo,{...eo,account:Eo,chain:eo.chain||void 0})}}async function writeContract(Xr,eo){const{abi:to,account:ro=Xr.account,address:no,args:io,dataSuffix:oo,functionName:ao,...so}=eo;if(typeof ro>"u")throw new AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const co=ro?parseAccount(ro):null,lo=encodeFunctionData({abi:to,args:io,functionName:ao});try{return await getAction(Xr,sendTransaction$1,"sendTransaction")({data:`${lo}${oo?oo.replace("0x",""):""}`,to:no,account:co,...so})}catch(uo){throw getContractError(uo,{abi:to,address:no,args:io,docsPath:"/docs/contract/writeContract",functionName:ao,sender:co==null?void 0:co.address})}}function getContract({abi:Xr,address:eo,client:to}){const ro=to,[no,io]=ro?"public"in ro&&"wallet"in ro?[ro.public,ro.wallet]:"public"in ro?[ro.public,void 0]:"wallet"in ro?[void 0,ro.wallet]:[ro,ro]:[void 0,void 0],oo=no!=null,ao=io!=null,so={};let co=!1,lo=!1,uo=!1;for(const ho of Xr)if(ho.type==="function"?ho.stateMutability==="view"||ho.stateMutability==="pure"?co=!0:lo=!0:ho.type==="event"&&(uo=!0),co&&lo&&uo)break;return oo&&(co&&(so.read=new Proxy({},{get(ho,go){return(...bo)=>{const{args:wo,options:Eo}=getFunctionParameters(bo);return getAction(no,readContract,"readContract")({abi:Xr,address:eo,functionName:go,args:wo,...Eo})}}})),lo&&(so.simulate=new Proxy({},{get(ho,go){return(...bo)=>{const{args:wo,options:Eo}=getFunctionParameters(bo);return getAction(no,simulateContract,"simulateContract")({abi:Xr,address:eo,functionName:go,args:wo,...Eo})}}})),uo&&(so.createEventFilter=new Proxy({},{get(ho,go){return(...bo)=>{const wo=Xr.find(Co=>Co.type==="event"&&Co.name===go),{args:Eo,options:$o}=getEventParameters(bo,wo);return getAction(no,createContractEventFilter,"createContractEventFilter")({abi:Xr,address:eo,eventName:go,args:Eo,...$o})}}}),so.getEvents=new Proxy({},{get(ho,go){return(...bo)=>{const wo=Xr.find(Co=>Co.type==="event"&&Co.name===go),{args:Eo,options:$o}=getEventParameters(bo,wo);return getAction(no,getContractEvents,"getContractEvents")({abi:Xr,address:eo,eventName:go,args:Eo,...$o})}}}),so.watchEvent=new Proxy({},{get(ho,go){return(...bo)=>{const wo=Xr.find(Co=>Co.type==="event"&&Co.name===go),{args:Eo,options:$o}=getEventParameters(bo,wo);return getAction(no,watchContractEvent,"watchContractEvent")({abi:Xr,address:eo,eventName:go,args:Eo,...$o})}}}))),ao&&lo&&(so.write=new Proxy({},{get(ho,go){return(...bo)=>{const{args:wo,options:Eo}=getFunctionParameters(bo);return getAction(io,writeContract,"writeContract")({abi:Xr,address:eo,functionName:go,args:wo,...Eo})}}})),(oo||ao)&&lo&&(so.estimateGas=new Proxy({},{get(ho,go){return(...bo)=>{const{args:wo,options:Eo}=getFunctionParameters(bo);return getAction(no??io,estimateContractGas,"estimateContractGas")({abi:Xr,address:eo,functionName:go,args:wo,...Eo,account:Eo.account??io.account})}}})),so.address=eo,so.abi=Xr,so}function getFunctionParameters(Xr){const eo=Xr.length&&Array.isArray(Xr[0]),to=eo?Xr[0]:[],ro=(eo?Xr[1]:Xr[0])??{};return{args:to,options:ro}}function getEventParameters(Xr,eo){let to=!1;Array.isArray(Xr[0])?to=!0:Xr.length===1?to=eo.inputs.some(io=>io.indexed):Xr.length===2&&(to=!0);const ro=to?Xr[0]:void 0,no=(to?Xr[1]:Xr[0])??{};return{args:ro,options:no}}class Eip712DomainNotFoundError extends BaseError{constructor({address:eo}){super(`No EIP-712 domain found on contract "${eo}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${eo}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function getEip712Domain$1(Xr,eo){const{address:to,factory:ro,factoryData:no}=eo;try{const[io,oo,ao,so,co,lo,uo]=await getAction(Xr,readContract,"readContract")({abi:abi$2,address:to,functionName:"eip712Domain",factory:ro,factoryData:no});return{domain:{name:oo,version:ao,chainId:Number(so),verifyingContract:co,salt:lo},extensions:uo,fields:io}}catch(io){const oo=io;throw oo.name==="ContractFunctionExecutionError"&&oo.cause.name==="ContractFunctionZeroDataError"?new Eip712DomainNotFoundError({address:to}):oo}}const abi$2=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function addChain(Xr,{chain:eo}){const{id:to,name:ro,nativeCurrency:no,rpcUrls:io,blockExplorers:oo}=eo;await Xr.request({method:"wallet_addEthereumChain",params:[{chainId:numberToHex(to),chainName:ro,nativeCurrency:no,rpcUrls:io.default.http,blockExplorerUrls:oo?Object.values(oo).map(({url:ao})=>ao):void 0}]},{dedupe:!0,retryCount:0})}const size=256;let index$1=size,buffer$1;function uid$1(Xr=11){if(!buffer$1||index$1+Xr>size*2){buffer$1="",index$1=0;for(let eo=0;eo{const Co=$o(Eo);for(const Oo in bo)delete Co[Oo];const Ro={...Eo,...Co};return Object.assign(Ro,{extend:wo(Ro)})}}return Object.assign(bo,{extend:wo(bo)})}const promiseCache=new LruMap(8192);function withDedupe(Xr,{enabled:eo=!0,id:to}){if(!eo||!to)return Xr();if(promiseCache.get(to))return promiseCache.get(to);const ro=Xr().finally(()=>promiseCache.delete(to));return promiseCache.set(to,ro),ro}function withRetry(Xr,{delay:eo=100,retryCount:to=2,shouldRetry:ro=()=>!0}={}){return new Promise((no,io)=>{const oo=async({count:ao=0}={})=>{const so=async({error:co})=>{const lo=typeof eo=="function"?eo({count:ao,error:co}):eo;lo&&await wait$1(lo),oo({count:ao+1})};try{const co=await Xr();no(co)}catch(co){if(ao{const{dedupe:no=!1,retryDelay:io=150,retryCount:oo=3,uid:ao}={...eo,...ro},so=no?keccak256(stringToHex(`${ao}.${stringify$4(to)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await Xr(to)}catch(co){const lo=co;switch(lo.code){case ParseRpcError.code:throw new ParseRpcError(lo);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lo);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lo,{method:to.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lo);case InternalRpcError.code:throw new InternalRpcError(lo);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lo);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lo);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lo);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lo);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lo,{method:to.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lo);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lo);case UserRejectedRequestError$1.code:throw new UserRejectedRequestError$1(lo);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lo);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lo);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lo);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lo);case SwitchChainError.code:throw new SwitchChainError(lo);case 5e3:throw new UserRejectedRequestError$1(lo);default:throw co instanceof BaseError?co:new UnknownRpcError(lo)}}},{delay:({count:co,error:lo})=>{var uo;if(lo&&lo instanceof HttpRequestError){const ho=(uo=lo==null?void 0:lo.headers)==null?void 0:uo.get("Retry-After");if(ho!=null&&ho.match(/\d/))return Number.parseInt(ho)*1e3}return~~(1<shouldRetry(co)}),{enabled:no,id:so})}}function shouldRetry(Xr){return"code"in Xr&&typeof Xr.code=="number"?Xr.code===-1||Xr.code===LimitExceededRpcError.code||Xr.code===InternalRpcError.code:Xr instanceof HttpRequestError&&Xr.status?Xr.status===403||Xr.status===408||Xr.status===413||Xr.status===429||Xr.status===500||Xr.status===502||Xr.status===503||Xr.status===504:!0}function createTransport({key:Xr,name:eo,request:to,retryCount:ro=3,retryDelay:no=150,timeout:io,type:oo},ao){const so=uid$1();return{config:{key:Xr,name:eo,request:to,retryCount:ro,retryDelay:no,timeout:io,type:oo},request:buildRequest(to,{retryCount:ro,retryDelay:no,uid:so}),value:ao}}function custom$1(Xr,eo={}){const{key:to="custom",name:ro="Custom Provider",retryDelay:no}=eo;return({retryCount:io})=>createTransport({key:to,name:ro,request:Xr.request.bind(Xr),retryCount:eo.retryCount??io,retryDelay:no,type:"custom"})}class UrlRequiredError extends BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function withTimeout(Xr,{errorInstance:eo=new Error("timed out"),timeout:to,signal:ro}){return new Promise((no,io)=>{(async()=>{let oo;try{const ao=new AbortController;to>0&&(oo=setTimeout(()=>{ro?ao.abort():io(eo)},to)),no(await Xr({signal:(ao==null?void 0:ao.signal)||null}))}catch(ao){(ao==null?void 0:ao.name)==="AbortError"&&io(eo),io(ao)}finally{clearTimeout(oo)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(Xr,eo={}){return{async request(to){var uo;const{body:ro,onRequest:no=eo.onRequest,onResponse:io=eo.onResponse,timeout:oo=eo.timeout??1e4}=to,ao={...eo.fetchOptions??{},...to.fetchOptions??{}},{headers:so,method:co,signal:lo}=ao;try{const ho=await withTimeout(async({signal:bo})=>{const wo={...ao,body:Array.isArray(ro)?stringify$4(ro.map(Ro=>({jsonrpc:"2.0",id:Ro.id??idCache.take(),...Ro}))):stringify$4({jsonrpc:"2.0",id:ro.id??idCache.take(),...ro}),headers:{"Content-Type":"application/json",...so},method:co||"POST",signal:lo||(oo>0?bo:null)},Eo=new Request(Xr,wo),$o=await(no==null?void 0:no(Eo,wo))??{...wo,url:Xr};return await fetch($o.url??Xr,$o)},{errorInstance:new TimeoutError({body:ro,url:Xr}),timeout:oo,signal:!0});io&&await io(ho);let go;if((uo=ho.headers.get("Content-Type"))!=null&&uo.startsWith("application/json"))go=await ho.json();else{go=await ho.text();try{go=JSON.parse(go||"{}")}catch(bo){if(ho.ok)throw bo;go={error:go}}}if(!ho.ok)throw new HttpRequestError({body:ro,details:stringify$4(go.error)||ho.statusText,headers:ho.headers,status:ho.status,url:Xr});return go}catch(ho){throw ho instanceof HttpRequestError||ho instanceof TimeoutError?ho:new HttpRequestError({body:ro,cause:ho,url:Xr})}}}}function http(Xr,eo={}){const{batch:to,fetchOptions:ro,key:no="http",name:io="HTTP JSON-RPC",onFetchRequest:oo,onFetchResponse:ao,retryDelay:so}=eo;return({chain:co,retryCount:lo,timeout:uo})=>{const{batchSize:ho=1e3,wait:go=0}=typeof to=="object"?to:{},bo=eo.retryCount??lo,wo=uo??eo.timeout??1e4,Eo=Xr||(co==null?void 0:co.rpcUrls.default.http[0]);if(!Eo)throw new UrlRequiredError;const $o=getHttpRpcClient(Eo,{fetchOptions:ro,onRequest:oo,onResponse:ao,timeout:wo});return createTransport({key:no,name:io,async request({method:Co,params:Ro}){const Oo={method:Co,params:Ro},{schedule:jo}=createBatchScheduler({id:Eo,wait:go,shouldSplitBatch(Wo){return Wo.length>ho},fn:Wo=>$o.request({body:Wo}),sort:(Wo,Jo)=>Wo.id-Jo.id}),Bo=async Wo=>to?jo(Wo):[await $o.request({body:Wo})],[{error:Mo,result:Fo}]=await Bo(Oo);if(Mo)throw new RpcRequestError({body:Oo,error:Mo,url:Eo});return Fo},retryCount:bo,retryDelay:so,timeout:wo,type:"http"},{fetchOptions:ro,url:Eo})}}function isNullUniversalResolverError(Xr,eo){var ro,no,io,oo,ao,so;if(!(Xr instanceof BaseError))return!1;const to=Xr.walk(co=>co instanceof ContractFunctionRevertedError);return to instanceof ContractFunctionRevertedError?!!(((ro=to.data)==null?void 0:ro.errorName)==="ResolverNotFound"||((no=to.data)==null?void 0:no.errorName)==="ResolverWildcardNotSupported"||((io=to.data)==null?void 0:io.errorName)==="ResolverNotContract"||((oo=to.data)==null?void 0:oo.errorName)==="ResolverError"||((ao=to.data)==null?void 0:ao.errorName)==="HttpError"||(so=to.reason)!=null&&so.includes("Wildcard on non-extended resolvers is not supported")||eo==="reverse"&&to.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(Xr){if(Xr.length!==66||Xr.indexOf("[")!==0||Xr.indexOf("]")!==65)return null;const eo=`0x${Xr.slice(1,65)}`;return isHex$4(eo)?eo:null}function namehash(Xr){let eo=new Uint8Array(32).fill(0);if(!Xr)return bytesToHex$2(eo);const to=Xr.split(".");for(let ro=to.length-1;ro>=0;ro-=1){const no=encodedLabelToLabelhash(to[ro]),io=no?toBytes$1(no):keccak256(stringToBytes$1(to[ro]),"bytes");eo=keccak256(concat$1([eo,io]),"bytes")}return bytesToHex$2(eo)}function encodeLabelhash(Xr){return`[${Xr.slice(2)}]`}function labelhash(Xr){const eo=new Uint8Array(32).fill(0);return Xr?encodedLabelToLabelhash(Xr)||keccak256(stringToBytes$1(Xr)):bytesToHex$2(eo)}function packetToBytes(Xr){const eo=Xr.replace(/^\.|\.$/gm,"");if(eo.length===0)return new Uint8Array(1);const to=new Uint8Array(stringToBytes$1(eo).byteLength+2);let ro=0;const no=eo.split(".");for(let io=0;io255&&(oo=stringToBytes$1(encodeLabelhash(labelhash(no[io])))),to[ro]=oo.length,to.set(oo,ro+1),ro+=oo.length+1}return to.byteLength!==ro+1?to.slice(0,ro+1):to}async function getEnsAddress(Xr,{blockNumber:eo,blockTag:to,coinType:ro,name:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){let so=ao;if(!so){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");so=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}try{const co=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...ro!=null?{args:[namehash(no),BigInt(ro)]}:{args:[namehash(no)]}}),lo={address:so,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes(no)),co],blockNumber:eo,blockTag:to},uo=getAction(Xr,readContract,"readContract"),ho=io?await uo({...lo,args:[...lo.args,io]}):await uo(lo);if(ho[0]==="0x")return null;const go=decodeFunctionResult({abi:addressResolverAbi,args:ro!=null?[namehash(no),BigInt(ro)]:void 0,functionName:"addr",data:ho[0]});return go==="0x"||trim$1(go)==="0x00"?null:go}catch(co){if(oo)throw co;if(isNullUniversalResolverError(co,"resolve"))return null;throw co}}class EnsAvatarInvalidMetadataError extends BaseError{constructor({data:eo}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(eo)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError{constructor({reason:eo}){super(`ENS NFT avatar URI is invalid. ${eo}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError{constructor({uri:eo}){super(`Unable to resolve ENS avatar URI "${eo}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError{constructor({namespace:eo}){super(`ENS NFT avatar namespace "${eo}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(Xr){try{const eo=await fetch(Xr,{method:"HEAD"});if(eo.status===200){const to=eo.headers.get("content-type");return to==null?void 0:to.startsWith("image/")}return!1}catch(eo){return typeof eo=="object"&&typeof eo.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(to=>{const ro=new Image;ro.onload=()=>{to(!0)},ro.onerror=()=>{to(!1)},ro.src=Xr})}}function getGateway(Xr,eo){return Xr?Xr.endsWith("/")?Xr.slice(0,-1):Xr:eo}function resolveAvatarUri({uri:Xr,gatewayUrls:eo}){const to=base64Regex.test(Xr);if(to)return{uri:Xr,isOnChain:!0,isEncoded:to};const ro=getGateway(eo==null?void 0:eo.ipfs,"https://ipfs.io"),no=getGateway(eo==null?void 0:eo.arweave,"https://arweave.net"),io=Xr.match(networkRegex),{protocol:oo,subpath:ao,target:so,subtarget:co=""}=(io==null?void 0:io.groups)||{},lo=oo==="ipns:/"||ao==="ipns/",uo=oo==="ipfs:/"||ao==="ipfs/"||ipfsHashRegex.test(Xr);if(Xr.startsWith("http")&&!lo&&!uo){let go=Xr;return eo!=null&&eo.arweave&&(go=Xr.replace(/https:\/\/arweave.net/g,eo==null?void 0:eo.arweave)),{uri:go,isOnChain:!1,isEncoded:!1}}if((lo||uo)&&so)return{uri:`${ro}/${lo?"ipns":"ipfs"}/${so}${co}`,isOnChain:!1,isEncoded:!1};if(oo==="ar:/"&&so)return{uri:`${no}/${so}${co||""}`,isOnChain:!1,isEncoded:!1};let ho=Xr.replace(dataURIRegex,"");if(ho.startsWith("no.json());return await parseAvatarUri({gatewayUrls:Xr,uri:getJsonImage(to)})}catch{throw new EnsAvatarUriResolutionError({uri:eo})}}async function parseAvatarUri({gatewayUrls:Xr,uri:eo}){const{uri:to,isOnChain:ro}=resolveAvatarUri({uri:eo,gatewayUrls:Xr});if(ro||await isImageUri(to))return to;throw new EnsAvatarUriResolutionError({uri:eo})}function parseNftUri(Xr){let eo=Xr;eo.startsWith("did:nft:")&&(eo=eo.replace("did:nft:","").replace(/_/g,"/"));const[to,ro,no]=eo.split("/"),[io,oo]=to.split(":"),[ao,so]=ro.split(":");if(!io||io.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!oo)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!so)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!no)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!ao)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(oo),namespace:ao.toLowerCase(),contractAddress:so,tokenID:no}}async function getNftTokenUri(Xr,{nft:eo}){if(eo.namespace==="erc721")return readContract(Xr,{address:eo.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(eo.tokenID)]});if(eo.namespace==="erc1155")return readContract(Xr,{address:eo.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(eo.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:eo.namespace})}async function parseAvatarRecord(Xr,{gatewayUrls:eo,record:to}){return/eip155:/i.test(to)?parseNftAvatarUri(Xr,{gatewayUrls:eo,record:to}):parseAvatarUri({uri:to,gatewayUrls:eo})}async function parseNftAvatarUri(Xr,{gatewayUrls:eo,record:to}){const ro=parseNftUri(to),no=await getNftTokenUri(Xr,{nft:ro}),{uri:io,isOnChain:oo,isEncoded:ao}=resolveAvatarUri({uri:no,gatewayUrls:eo});if(oo&&(io.includes("data:application/json;base64,")||io.startsWith("{"))){const co=ao?atob(io.replace("data:application/json;base64,","")):io,lo=JSON.parse(co);return parseAvatarUri({uri:getJsonImage(lo),gatewayUrls:eo})}let so=ro.tokenID;return ro.namespace==="erc1155"&&(so=so.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:eo,uri:io.replace(/(?:0x)?{id}/,so)})}async function getEnsText(Xr,{blockNumber:eo,blockTag:to,name:ro,key:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){let so=ao;if(!so){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");so=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}try{const co={address:so,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes(ro)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(ro),no]})],blockNumber:eo,blockTag:to},lo=getAction(Xr,readContract,"readContract"),uo=io?await lo({...co,args:[...co.args,io]}):await lo(co);if(uo[0]==="0x")return null;const ho=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:uo[0]});return ho===""?null:ho}catch(co){if(oo)throw co;if(isNullUniversalResolverError(co,"resolve"))return null;throw co}}async function getEnsAvatar(Xr,{blockNumber:eo,blockTag:to,assetGatewayUrls:ro,name:no,gatewayUrls:io,strict:oo,universalResolverAddress:ao}){const so=await getAction(Xr,getEnsText,"getEnsText")({blockNumber:eo,blockTag:to,key:"avatar",name:no,universalResolverAddress:ao,gatewayUrls:io,strict:oo});if(!so)return null;try{return await parseAvatarRecord(Xr,{record:so,gatewayUrls:ro})}catch{return null}}async function getEnsName(Xr,{address:eo,blockNumber:to,blockTag:ro,gatewayUrls:no,strict:io,universalResolverAddress:oo}){let ao=oo;if(!ao){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");ao=getChainContractAddress({blockNumber:to,chain:Xr.chain,contract:"ensUniversalResolver"})}const so=`${eo.toLowerCase().substring(2)}.addr.reverse`;try{const co={address:ao,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex$1(packetToBytes(so))],blockNumber:to,blockTag:ro},lo=getAction(Xr,readContract,"readContract"),[uo,ho]=no?await lo({...co,args:[...co.args,no]}):await lo(co);return eo.toLowerCase()!==ho.toLowerCase()?null:uo}catch(co){if(io)throw co;if(isNullUniversalResolverError(co,"reverse"))return null;throw co}}async function getEnsResolver(Xr,{blockNumber:eo,blockTag:to,name:ro,universalResolverAddress:no}){let io=no;if(!io){if(!Xr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");io=getChainContractAddress({blockNumber:eo,chain:Xr.chain,contract:"ensUniversalResolver"})}const[oo]=await getAction(Xr,readContract,"readContract")({address:io,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[toHex$1(packetToBytes(ro))],blockNumber:eo,blockTag:to});return oo}async function createBlockFilter(Xr){const eo=createFilterRequestScope(Xr,{method:"eth_newBlockFilter"}),to=await Xr.request({method:"eth_newBlockFilter"});return{id:to,request:eo(to),type:"block"}}async function createEventFilter(Xr,{address:eo,args:to,event:ro,events:no,fromBlock:io,strict:oo,toBlock:ao}={}){const so=no??(ro?[ro]:void 0),co=createFilterRequestScope(Xr,{method:"eth_newFilter"});let lo=[];so&&(lo=[so.flatMap(go=>encodeEventTopics({abi:[go],eventName:go.name,args:to}))],ro&&(lo=lo[0]));const uo=await Xr.request({method:"eth_newFilter",params:[{address:eo,fromBlock:typeof io=="bigint"?numberToHex(io):io,toBlock:typeof ao=="bigint"?numberToHex(ao):ao,...lo.length?{topics:lo}:{}}]});return{abi:so,args:to,eventName:ro?ro.name:void 0,fromBlock:io,id:uo,request:co(uo),strict:!!oo,toBlock:ao,type:"event"}}async function createPendingTransactionFilter(Xr){const eo=createFilterRequestScope(Xr,{method:"eth_newPendingTransactionFilter"}),to=await Xr.request({method:"eth_newPendingTransactionFilter"});return{id:to,request:eo(to),type:"transaction"}}async function getBlobBaseFee(Xr){const eo=await Xr.request({method:"eth_blobBaseFee"});return BigInt(eo)}async function getBlockTransactionCount(Xr,{blockHash:eo,blockNumber:to,blockTag:ro="latest"}={}){const no=to!==void 0?numberToHex(to):void 0;let io;return eo?io=await Xr.request({method:"eth_getBlockTransactionCountByHash",params:[eo]},{dedupe:!0}):io=await Xr.request({method:"eth_getBlockTransactionCountByNumber",params:[no||ro]},{dedupe:!!no}),hexToNumber$2(io)}async function getCode$1(Xr,{address:eo,blockNumber:to,blockTag:ro="latest"}){const no=to!==void 0?numberToHex(to):void 0,io=await Xr.request({method:"eth_getCode",params:[eo,no||ro]},{dedupe:!!no});if(io!=="0x")return io}function formatFeeHistory(Xr){var eo;return{baseFeePerGas:Xr.baseFeePerGas.map(to=>BigInt(to)),gasUsedRatio:Xr.gasUsedRatio,oldestBlock:BigInt(Xr.oldestBlock),reward:(eo=Xr.reward)==null?void 0:eo.map(to=>to.map(ro=>BigInt(ro)))}}async function getFeeHistory(Xr,{blockCount:eo,blockNumber:to,blockTag:ro="latest",rewardPercentiles:no}){const io=to?numberToHex(to):void 0,oo=await Xr.request({method:"eth_feeHistory",params:[numberToHex(eo),io||ro,no]},{dedupe:!!io});return formatFeeHistory(oo)}async function getFilterLogs(Xr,{filter:eo}){const to=eo.strict??!1,no=(await eo.request({method:"eth_getFilterLogs",params:[eo.id]})).map(io=>formatLog(io));return eo.abi?parseEventLogs({abi:eo.abi,logs:no,strict:to}):no}function defineChain(Xr){return{formatters:void 0,fees:void 0,serializers:void 0,...Xr}}const arrayRegex=/^(.*)\[([0-9]*)\]$/,bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class InvalidPrimaryTypeError extends BaseError{constructor({primaryType:eo,types:to}){super(`Invalid primary type \`${eo}\` must be one of \`${JSON.stringify(Object.keys(to))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class InvalidStructTypeError extends BaseError{constructor({type:eo}){super(`Struct type "${eo}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function hashTypedData(Xr){const{domain:eo={},message:to,primaryType:ro}=Xr,no={EIP712Domain:getTypesForEIP712Domain({domain:eo}),...Xr.types};validateTypedData$1({domain:eo,message:to,primaryType:ro,types:no});const io=["0x1901"];return eo&&io.push(hashDomain({domain:eo,types:no})),ro!=="EIP712Domain"&&io.push(hashStruct({data:to,primaryType:ro,types:no})),keccak256(concat$1(io))}function hashDomain({domain:Xr,types:eo}){return hashStruct({data:Xr,primaryType:"EIP712Domain",types:eo})}function hashStruct({data:Xr,primaryType:eo,types:to}){const ro=encodeData$3({data:Xr,primaryType:eo,types:to});return keccak256(ro)}function encodeData$3({data:Xr,primaryType:eo,types:to}){const ro=[{type:"bytes32"}],no=[hashType({primaryType:eo,types:to})];for(const io of to[eo]){const[oo,ao]=encodeField({types:to,name:io.name,type:io.type,value:Xr[io.name]});ro.push(oo),no.push(ao)}return encodeAbiParameters(ro,no)}function hashType({primaryType:Xr,types:eo}){const to=toHex$1(encodeType$1({primaryType:Xr,types:eo}));return keccak256(to)}function encodeType$1({primaryType:Xr,types:eo}){let to="";const ro=findTypeDependencies({primaryType:Xr,types:eo});ro.delete(Xr);const no=[Xr,...Array.from(ro).sort()];for(const io of no)to+=`${io}(${eo[io].map(({name:oo,type:ao})=>`${ao} ${oo}`).join(",")})`;return to}function findTypeDependencies({primaryType:Xr,types:eo},to=new Set){const ro=Xr.match(/^\w*/u),no=ro==null?void 0:ro[0];if(to.has(no)||eo[no]===void 0)return to;to.add(no);for(const io of eo[no])findTypeDependencies({primaryType:io.type,types:eo},to);return to}function encodeField({types:Xr,name:eo,type:to,value:ro}){if(Xr[to]!==void 0)return[{type:"bytes32"},keccak256(encodeData$3({data:ro,primaryType:to,types:Xr}))];if(to==="bytes")return ro=`0x${(ro.length%2?"0":"")+ro.slice(2)}`,[{type:"bytes32"},keccak256(ro)];if(to==="string")return[{type:"bytes32"},keccak256(toHex$1(ro))];if(to.lastIndexOf("]")===to.length-1){const no=to.slice(0,to.lastIndexOf("[")),io=ro.map(oo=>encodeField({name:eo,type:no,types:Xr,value:oo}));return[{type:"bytes32"},keccak256(encodeAbiParameters(io.map(([oo])=>oo),io.map(([,oo])=>oo)))]}return[{type:to},ro]}function serializeTypedData(Xr){const{domain:eo,message:to,primaryType:ro,types:no}=Xr,io=(so,co)=>{const lo={...co};for(const uo of so){const{name:ho,type:go}=uo;go==="address"&&(lo[ho]=lo[ho].toLowerCase())}return lo},oo=no.EIP712Domain?eo?io(no.EIP712Domain,eo):{}:{},ao=(()=>{if(ro!=="EIP712Domain")return io(no[ro],to)})();return stringify$4({domain:oo,message:ao,primaryType:ro,types:no})}function validateTypedData$1(Xr){const{domain:eo,message:to,primaryType:ro,types:no}=Xr,io=(oo,ao)=>{for(const so of oo){const{name:co,type:lo}=so,uo=ao[co],ho=lo.match(integerRegex);if(ho&&(typeof uo=="number"||typeof uo=="bigint")){const[wo,Eo,$o]=ho;numberToHex(uo,{signed:Eo==="int",size:Number.parseInt($o)/8})}if(lo==="address"&&typeof uo=="string"&&!isAddress(uo))throw new InvalidAddressError({address:uo});const go=lo.match(bytesRegex);if(go){const[wo,Eo]=go;if(Eo&&size$1(uo)!==Number.parseInt(Eo))throw new BytesSizeMismatchError({expectedSize:Number.parseInt(Eo),givenSize:size$1(uo)})}const bo=no[lo];bo&&(validateReference(lo),io(bo,uo))}};if(no.EIP712Domain&&eo&&io(no.EIP712Domain,eo),ro!=="EIP712Domain")if(no[ro])io(no[ro],to);else throw new InvalidPrimaryTypeError({primaryType:ro,types:no})}function getTypesForEIP712Domain({domain:Xr}){return[typeof(Xr==null?void 0:Xr.name)=="string"&&{name:"name",type:"string"},(Xr==null?void 0:Xr.version)&&{name:"version",type:"string"},typeof(Xr==null?void 0:Xr.chainId)=="number"&&{name:"chainId",type:"uint256"},(Xr==null?void 0:Xr.verifyingContract)&&{name:"verifyingContract",type:"address"},(Xr==null?void 0:Xr.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function validateReference(Xr){if(Xr==="address"||Xr==="bool"||Xr==="string"||Xr.startsWith("bytes")||Xr.startsWith("uint")||Xr.startsWith("int"))throw new InvalidStructTypeError({type:Xr})}function encodePacked(Xr,eo){if(Xr.length!==eo.length)throw new AbiEncodingLengthMismatchError({expectedLength:Xr.length,givenLength:eo.length});const to=[];for(let ro=0;roformatLog(to)):null,to:Xr.to?Xr.to:null,transactionIndex:Xr.transactionIndex?hexToNumber$2(Xr.transactionIndex):null,status:Xr.status?receiptStatuses[Xr.status]:null,type:Xr.type?transactionType[Xr.type]||Xr.type:null};return Xr.blobGasPrice&&(eo.blobGasPrice=BigInt(Xr.blobGasPrice)),Xr.blobGasUsed&&(eo.blobGasUsed=BigInt(Xr.blobGasUsed)),eo}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt),presignMessagePrefix=`Ethereum Signed Message: +`;function toPrefixedMessage(Xr){const eo=typeof Xr=="string"?stringToHex(Xr):typeof Xr.raw=="string"?Xr.raw:bytesToHex$2(Xr.raw),to=stringToHex(`${presignMessagePrefix}${size$1(eo)}`);return concat$1([to,eo])}function hashMessage(Xr,eo){return keccak256(toPrefixedMessage(Xr),eo)}const erc6492MagicBytes="0x6492649264926492649264926492649264926492649264926492649264926492";function isErc6492Signature(Xr){return sliceHex(Xr,-32)===erc6492MagicBytes}function serializeErc6492Signature(Xr){const{address:eo,data:to,signature:ro,to:no="hex"}=Xr,io=concatHex([encodeAbiParameters([{type:"address"},{type:"bytes"},{type:"bytes"}],[eo,to,ro]),erc6492MagicBytes]);return no==="hex"?io:hexToBytes$3(io)}function assertTransactionEIP7702(Xr){const{authorizationList:eo}=Xr;if(eo)for(const to of eo){const{contractAddress:ro,chainId:no}=to;if(!isAddress(ro))throw new InvalidAddressError({address:ro});if(no<0)throw new InvalidChainIdError({chainId:no})}assertTransactionEIP1559(Xr)}function assertTransactionEIP4844(Xr){const{blobVersionedHashes:eo}=Xr;if(eo){if(eo.length===0)throw new EmptyBlobError;for(const to of eo){const ro=size$1(to),no=hexToNumber$2(slice(to,0,1));if(ro!==32)throw new InvalidVersionedHashSizeError({hash:to,size:ro});if(no!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:to,version:no})}}assertTransactionEIP1559(Xr)}function assertTransactionEIP1559(Xr){const{chainId:eo,maxPriorityFeePerGas:to,maxFeePerGas:ro,to:no}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(no&&!isAddress(no))throw new InvalidAddressError({address:no});if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro});if(to&&ro&&to>ro)throw new TipAboveFeeCapError({maxFeePerGas:ro,maxPriorityFeePerGas:to})}function assertTransactionEIP2930(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(to||no)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro})}function assertTransactionLegacy(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io}=Xr;if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(typeof eo<"u"&&eo<=0)throw new InvalidChainIdError({chainId:eo});if(to||no)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(ro&&ro>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:ro})}function serializeAuthorizationList(Xr){if(!Xr||Xr.length===0)return[];const eo=[];for(const to of Xr){const{contractAddress:ro,chainId:no,nonce:io,...oo}=to;eo.push([no?toHex$1(no):"0x",ro,io?toHex$1(io):"0x",...toYParitySignatureArray({},oo)])}return eo}function serializeAccessList(Xr){if(!Xr||Xr.length===0)return[];const eo=[];for(let to=0;to"u"||typeof go>"u")){const Ro=typeof Xr.blobs[0]=="string"?Xr.blobs:Xr.blobs.map(Bo=>bytesToHex$2(Bo)),Oo=Xr.kzg,jo=blobsToCommitments({blobs:Ro,kzg:Oo});if(typeof ho>"u"&&(ho=commitmentsToVersionedHashes({commitments:jo})),typeof go>"u"){const Bo=blobsToProofs({blobs:Ro,commitments:jo,kzg:Oo});go=toBlobSidecars({blobs:Ro,commitments:jo,proofs:Bo})}}const bo=serializeAccessList(lo),wo=[toHex$1(to),no?toHex$1(no):"0x",co?toHex$1(co):"0x",so?toHex$1(so):"0x",ro?toHex$1(ro):"0x",io??"0x",oo?toHex$1(oo):"0x",uo??"0x",bo,ao?toHex$1(ao):"0x",ho??[],...toYParitySignatureArray(Xr,eo)],Eo=[],$o=[],Co=[];if(go)for(let Ro=0;Ro{if(eo.v>=35n)return(eo.v-35n)/2n>0?eo.v:27n+(eo.v===35n?0n:1n);if(to>0)return BigInt(to*2)+BigInt(35n+eo.v-27n);const go=27n+(eo.v===27n?0n:1n);if(eo.v!==go)throw new InvalidLegacyVError({v:eo.v});return go})(),uo=trim$1(eo.r),ho=trim$1(eo.s);co=[...co,toHex$1(lo),uo==="0x00"?"0x":uo,ho==="0x00"?"0x":ho]}else to>0&&(co=[...co,toHex$1(to),"0x","0x"]);return toRlp(co)}function toYParitySignatureArray(Xr,eo){const to=eo??Xr,{v:ro,yParity:no}=to;if(typeof to.r>"u")return[];if(typeof to.s>"u")return[];if(typeof ro>"u"&&typeof no>"u")return[];const io=trim$1(to.r),oo=trim$1(to.s);return[typeof no=="number"?no?toHex$1(1):"0x":ro===0n?"0x":ro===1n?toHex$1(1):ro===27n?"0x":toHex$1(1),io==="0x00"?"0x":io,oo==="0x00"?"0x":oo]}class InvalidDecimalNumberError extends BaseError{constructor({value:eo}){super(`Number \`${eo}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function parseUnits(Xr,eo){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(Xr))throw new InvalidDecimalNumberError({value:Xr});let[to,ro="0"]=Xr.split(".");const no=to.startsWith("-");if(no&&(to=to.slice(1)),ro=ro.replace(/(0+)$/,""),eo===0)Math.round(+`.${ro}`)===1&&(to=`${BigInt(to)+1n}`),ro="";else if(ro.length>eo){const[io,oo,ao]=[ro.slice(0,eo-1),ro.slice(eo-1,eo),ro.slice(eo)],so=Math.round(+`${oo}.${ao}`);so>9?ro=`${BigInt(io)+BigInt(1)}0`.padStart(io.length+1,"0"):ro=`${io}${so}`,ro.length>eo&&(ro=ro.slice(1),to=`${BigInt(to)+1n}`),ro=ro.slice(0,eo)}else ro=ro.padEnd(eo,"0");return BigInt(`${no?"-":""}${to}${ro}`)}function parseEther$1(Xr,eo="wei"){return parseUnits(Xr,etherUnits[eo])}function formatStorageProof(Xr){return Xr.map(eo=>({...eo,value:BigInt(eo.value)}))}function formatProof(Xr){return{...Xr,balance:Xr.balance?BigInt(Xr.balance):void 0,nonce:Xr.nonce?hexToNumber$2(Xr.nonce):void 0,storageProof:Xr.storageProof?formatStorageProof(Xr.storageProof):void 0}}async function getProof(Xr,{address:eo,blockNumber:to,blockTag:ro,storageKeys:no}){const io=ro??"latest",oo=to!==void 0?numberToHex(to):void 0,ao=await Xr.request({method:"eth_getProof",params:[eo,no,oo||io]});return formatProof(ao)}async function getStorageAt(Xr,{address:eo,blockNumber:to,blockTag:ro="latest",slot:no}){const io=to!==void 0?numberToHex(to):void 0;return await Xr.request({method:"eth_getStorageAt",params:[eo,no,io||ro]})}async function getTransaction(Xr,{blockHash:eo,blockNumber:to,blockTag:ro,hash:no,index:io}){var lo,uo,ho;const oo=ro||"latest",ao=to!==void 0?numberToHex(to):void 0;let so=null;if(no?so=await Xr.request({method:"eth_getTransactionByHash",params:[no]},{dedupe:!0}):eo?so=await Xr.request({method:"eth_getTransactionByBlockHashAndIndex",params:[eo,numberToHex(io)]},{dedupe:!0}):(ao||oo)&&(so=await Xr.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[ao||oo,numberToHex(io)]},{dedupe:!!ao})),!so)throw new TransactionNotFoundError({blockHash:eo,blockNumber:to,blockTag:oo,hash:no,index:io});return(((ho=(uo=(lo=Xr.chain)==null?void 0:lo.formatters)==null?void 0:uo.transaction)==null?void 0:ho.format)||formatTransaction)(so)}async function getTransactionConfirmations(Xr,{hash:eo,transactionReceipt:to}){const[ro,no]=await Promise.all([getAction(Xr,getBlockNumber,"getBlockNumber")({}),eo?getAction(Xr,getTransaction,"getTransaction")({hash:eo}):void 0]),io=(to==null?void 0:to.blockNumber)||(no==null?void 0:no.blockNumber);return io?ro-io+1n:0n}async function getTransactionReceipt(Xr,{hash:eo}){var no,io,oo;const to=await Xr.request({method:"eth_getTransactionReceipt",params:[eo]},{dedupe:!0});if(!to)throw new TransactionReceiptNotFoundError({hash:eo});return(((oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionReceipt)==null?void 0:oo.format)||formatTransactionReceipt)(to)}async function multicall(Xr,eo){var Eo;const{allowFailure:to=!0,batchSize:ro,blockNumber:no,blockTag:io,multicallAddress:oo,stateOverride:ao}=eo,so=eo.contracts,co=ro??(typeof((Eo=Xr.batch)==null?void 0:Eo.multicall)=="object"&&Xr.batch.multicall.batchSize||1024);let lo=oo;if(!lo){if(!Xr.chain)throw new Error("client chain not configured. multicallAddress is required.");lo=getChainContractAddress({blockNumber:no,chain:Xr.chain,contract:"multicall3"})}const uo=[[]];let ho=0,go=0;for(let $o=0;$o0&&go>co&&uo[ho].length>0&&(ho++,go=(Bo.length-2)/2,uo[ho]=[]),uo[ho]=[...uo[ho],{allowFailure:!0,callData:Bo,target:Ro}]}catch(Bo){const Mo=getContractError(Bo,{abi:Co,address:Ro,args:Oo,docsPath:"/docs/contract/multicall",functionName:jo});if(!to)throw Mo;uo[ho]=[...uo[ho],{allowFailure:!0,callData:"0x",target:Ro}]}}const bo=await Promise.allSettled(uo.map($o=>getAction(Xr,readContract,"readContract")({abi:multicall3Abi,address:lo,args:[$o],blockNumber:no,blockTag:io,functionName:"aggregate3",stateOverride:ao}))),wo=[];for(let $o=0;$o{if(no===0||no===1)return no;if(ro&&(ro===27n||ro===28n||ro>=35n))return ro%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),oo=`0x${new secp256k1$2.Signature(hexToBigInt(Xr),hexToBigInt(eo)).toCompactHex()}${io===0?"1b":"1c"}`;return to==="hex"?oo:hexToBytes$3(oo)}async function verifyHash(Xr,eo){var uo,ho,go;const{address:to,factory:ro,factoryData:no,hash:io,signature:oo,universalSignatureVerifierAddress:ao=(go=(ho=(uo=Xr.chain)==null?void 0:uo.contracts)==null?void 0:ho.universalSignatureVerifier)==null?void 0:go.address,...so}=eo,co=isHex$4(oo)?oo:typeof oo=="object"&&"r"in oo&&"s"in oo?serializeSignature(oo):bytesToHex$2(oo),lo=await(async()=>!ro&&!no||isErc6492Signature(co)?co:serializeErc6492Signature({address:ro,data:no,signature:co}))();try{const bo=ao?{to:ao,data:encodeFunctionData({abi:universalSignatureValidatorAbi,functionName:"isValidSig",args:[to,io,lo]}),...so}:{data:encodeDeployData({abi:universalSignatureValidatorAbi,args:[to,io,lo],bytecode:universalSignatureValidatorByteCode}),...so},{data:wo}=await getAction(Xr,call,"call")(bo);return hexToBool(wo??"0x0")}catch(bo){try{if(isAddressEqual(getAddress$1(to),await recoverAddress({hash:io,signature:oo})))return!0}catch{}if(bo instanceof CallExecutionError)return!1;throw bo}}async function verifyMessage(Xr,{address:eo,message:to,factory:ro,factoryData:no,signature:io,...oo}){const ao=hashMessage(to);return verifyHash(Xr,{address:eo,factory:ro,factoryData:no,hash:ao,signature:io,...oo})}async function verifyTypedData(Xr,eo){const{address:to,factory:ro,factoryData:no,signature:io,message:oo,primaryType:ao,types:so,domain:co,...lo}=eo,uo=hashTypedData({message:oo,primaryType:ao,types:so,domain:co});return verifyHash(Xr,{address:to,factory:ro,factoryData:no,hash:uo,signature:io,...lo})}function watchBlockNumber(Xr,{emitOnBegin:eo=!1,emitMissed:to=!1,onBlockNumber:ro,onError:no,poll:io,pollingInterval:oo=Xr.pollingInterval}){const ao=typeof io<"u"?io:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket");let so;return ao?(()=>{const uo=stringify$4(["watchBlockNumber",Xr.uid,eo,to,oo]);return observe(uo,{onBlockNumber:ro,onError:no},ho=>poll$1(async()=>{var go;try{const bo=await getAction(Xr,getBlockNumber,"getBlockNumber")({cacheTime:0});if(so){if(bo===so)return;if(bo-so>1&&to)for(let wo=so+1n;woso)&&(ho.onBlockNumber(bo,so),so=bo)}catch(bo){(go=ho.onError)==null||go.call(ho,bo)}},{emitOnBegin:eo,interval:oo}))})():(()=>{const uo=stringify$4(["watchBlockNumber",Xr.uid,eo,to]);return observe(uo,{onBlockNumber:ro,onError:no},ho=>{let go=!0,bo=()=>go=!1;return(async()=>{try{const wo=(()=>{if(Xr.transport.type==="fallback"){const $o=Xr.transport.transports.find(Co=>Co.config.type==="webSocket");return $o?$o.value:Xr.transport}return Xr.transport})(),{unsubscribe:Eo}=await wo.subscribe({params:["newHeads"],onData($o){var Ro;if(!go)return;const Co=hexToBigInt((Ro=$o.result)==null?void 0:Ro.number);ho.onBlockNumber(Co,so),so=Co},onError($o){var Co;(Co=ho.onError)==null||Co.call(ho,$o)}});bo=Eo,go||bo()}catch(wo){no==null||no(wo)}})(),()=>bo()})})()}async function waitForTransactionReceipt(Xr,{confirmations:eo=1,hash:to,onReplaced:ro,pollingInterval:no=Xr.pollingInterval,retryCount:io=6,retryDelay:oo=({count:so})=>~~(1<wo(new WaitForTransactionReceiptTimeoutError({hash:to})),ao):void 0,$o=observe(so,{onReplaced:ro,resolve:bo,reject:wo},Co=>{const Ro=getAction(Xr,watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:no,async onBlockNumber(Oo){const jo=Mo=>{clearTimeout(Eo),Ro(),Mo(),$o()};let Bo=Oo;if(!ho)try{if(uo){if(eo>1&&(!uo.blockNumber||Bo-uo.blockNumber+1nCo.resolve(uo));return}if(co||(ho=!0,await withRetry(async()=>{co=await getAction(Xr,getTransaction,"getTransaction")({hash:to}),co.blockNumber&&(Bo=co.blockNumber)},{delay:oo,retryCount:io}),ho=!1),uo=await getAction(Xr,getTransactionReceipt,"getTransactionReceipt")({hash:to}),eo>1&&(!uo.blockNumber||Bo-uo.blockNumber+1nCo.resolve(uo))}catch(Mo){if(Mo instanceof TransactionNotFoundError||Mo instanceof TransactionReceiptNotFoundError){if(!co){ho=!1;return}try{lo=co,ho=!0;const Fo=await withRetry(()=>getAction(Xr,getBlock$1,"getBlock")({blockNumber:Bo,includeTransactions:!0}),{delay:oo,retryCount:io,shouldRetry:({error:Po})=>Po instanceof BlockNotFoundError});ho=!1;const Wo=Fo.transactions.find(({from:Po,nonce:fo})=>Po===lo.from&&fo===lo.nonce);if(!Wo||(uo=await getAction(Xr,getTransactionReceipt,"getTransactionReceipt")({hash:Wo.hash}),eo>1&&(!uo.blockNumber||Bo-uo.blockNumber+1n{var Po;(Po=Co.onReplaced)==null||Po.call(Co,{reason:Jo,replacedTransaction:lo,transaction:Wo,transactionReceipt:uo}),Co.resolve(uo)})}catch(Fo){jo(()=>Co.reject(Fo))}}else jo(()=>Co.reject(Mo))}}})});return go}function watchBlocks(Xr,{blockTag:eo="latest",emitMissed:to=!1,emitOnBegin:ro=!1,onBlock:no,onError:io,includeTransactions:oo,poll:ao,pollingInterval:so=Xr.pollingInterval}){const co=typeof ao<"u"?ao:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"),lo=oo??!1;let uo;return co?(()=>{const bo=stringify$4(["watchBlocks",Xr.uid,eo,to,ro,lo,so]);return observe(bo,{onBlock:no,onError:io},wo=>poll$1(async()=>{var Eo;try{const $o=await getAction(Xr,getBlock$1,"getBlock")({blockTag:eo,includeTransactions:lo});if($o.number&&(uo!=null&&uo.number)){if($o.number===uo.number)return;if($o.number-uo.number>1&&to)for(let Co=(uo==null?void 0:uo.number)+1n;Co<$o.number;Co++){const Ro=await getAction(Xr,getBlock$1,"getBlock")({blockNumber:Co,includeTransactions:lo});wo.onBlock(Ro,uo),uo=Ro}}(!(uo!=null&&uo.number)||eo==="pending"&&!($o!=null&&$o.number)||$o.number&&$o.number>uo.number)&&(wo.onBlock($o,uo),uo=$o)}catch($o){(Eo=wo.onError)==null||Eo.call(wo,$o)}},{emitOnBegin:ro,interval:so}))})():(()=>{let bo=!0,wo=!0,Eo=()=>bo=!1;return(async()=>{try{ro&&getAction(Xr,getBlock$1,"getBlock")({blockTag:eo,includeTransactions:lo}).then(Ro=>{bo&&wo&&(no(Ro,void 0),wo=!1)});const $o=(()=>{if(Xr.transport.type==="fallback"){const Ro=Xr.transport.transports.find(Oo=>Oo.config.type==="webSocket");return Ro?Ro.value:Xr.transport}return Xr.transport})(),{unsubscribe:Co}=await $o.subscribe({params:["newHeads"],onData(Ro){var Bo,Mo,Fo;if(!bo)return;const jo=(((Fo=(Mo=(Bo=Xr.chain)==null?void 0:Bo.formatters)==null?void 0:Mo.block)==null?void 0:Fo.format)||formatBlock)(Ro.result);no(jo,uo),wo=!1,uo=jo},onError(Ro){io==null||io(Ro)}});Eo=Co,bo||Eo()}catch($o){io==null||io($o)}})(),()=>Eo()})()}function watchEvent(Xr,{address:eo,args:to,batch:ro=!0,event:no,events:io,fromBlock:oo,onError:ao,onLogs:so,poll:co,pollingInterval:lo=Xr.pollingInterval,strict:uo}){const ho=typeof co<"u"?co:typeof oo=="bigint"?!0:!(Xr.transport.type==="webSocket"||Xr.transport.type==="fallback"&&Xr.transport.transports[0].config.type==="webSocket"),go=uo??!1;return ho?(()=>{const Eo=stringify$4(["watchEvent",eo,to,ro,Xr.uid,no,lo,oo]);return observe(Eo,{onLogs:so,onError:ao},$o=>{let Co;oo!==void 0&&(Co=oo-1n);let Ro,Oo=!1;const jo=poll$1(async()=>{var Bo;if(!Oo){try{Ro=await getAction(Xr,createEventFilter,"createEventFilter")({address:eo,args:to,event:no,events:io,strict:go,fromBlock:oo})}catch{}Oo=!0;return}try{let Mo;if(Ro)Mo=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:Ro});else{const Fo=await getAction(Xr,getBlockNumber,"getBlockNumber")({});Co&&Co!==Fo?Mo=await getAction(Xr,getLogs,"getLogs")({address:eo,args:to,event:no,events:io,fromBlock:Co+1n,toBlock:Fo}):Mo=[],Co=Fo}if(Mo.length===0)return;if(ro)$o.onLogs(Mo);else for(const Fo of Mo)$o.onLogs([Fo])}catch(Mo){Ro&&Mo instanceof InvalidInputRpcError&&(Oo=!1),(Bo=$o.onError)==null||Bo.call($o,Mo)}},{emitOnBegin:!0,interval:lo});return async()=>{Ro&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:Ro}),jo()}})})():(()=>{let Eo=!0,$o=()=>Eo=!1;return(async()=>{try{const Co=(()=>{if(Xr.transport.type==="fallback"){const Bo=Xr.transport.transports.find(Mo=>Mo.config.type==="webSocket");return Bo?Bo.value:Xr.transport}return Xr.transport})(),Ro=io??(no?[no]:void 0);let Oo=[];Ro&&(Oo=[Ro.flatMap(Mo=>encodeEventTopics({abi:[Mo],eventName:Mo.name,args:to}))],no&&(Oo=Oo[0]));const{unsubscribe:jo}=await Co.subscribe({params:["logs",{address:eo,topics:Oo}],onData(Bo){var Fo;if(!Eo)return;const Mo=Bo.result;try{const{eventName:Wo,args:Jo}=decodeEventLog({abi:Ro??[],data:Mo.data,topics:Mo.topics,strict:go}),Po=formatLog(Mo,{args:Jo,eventName:Wo});so([Po])}catch(Wo){let Jo,Po;if(Wo instanceof DecodeLogDataMismatch||Wo instanceof DecodeLogTopicsMismatch){if(uo)return;Jo=Wo.abiItem.name,Po=(Fo=Wo.abiItem.inputs)==null?void 0:Fo.some(yo=>!("name"in yo&&yo.name))}const fo=formatLog(Mo,{args:Po?[]:{},eventName:Jo});so([fo])}},onError(Bo){ao==null||ao(Bo)}});$o=jo,Eo||$o()}catch(Co){ao==null||ao(Co)}})(),()=>$o()})()}function watchPendingTransactions(Xr,{batch:eo=!0,onError:to,onTransactions:ro,poll:no,pollingInterval:io=Xr.pollingInterval}){return(typeof no<"u"?no:Xr.transport.type!=="webSocket")?(()=>{const co=stringify$4(["watchPendingTransactions",Xr.uid,eo,io]);return observe(co,{onTransactions:ro,onError:to},lo=>{let uo;const ho=poll$1(async()=>{var go;try{if(!uo)try{uo=await getAction(Xr,createPendingTransactionFilter,"createPendingTransactionFilter")({});return}catch(wo){throw ho(),wo}const bo=await getAction(Xr,getFilterChanges,"getFilterChanges")({filter:uo});if(bo.length===0)return;if(eo)lo.onTransactions(bo);else for(const wo of bo)lo.onTransactions([wo])}catch(bo){(go=lo.onError)==null||go.call(lo,bo)}},{emitOnBegin:!0,interval:io});return async()=>{uo&&await getAction(Xr,uninstallFilter,"uninstallFilter")({filter:uo}),ho()}})})():(()=>{let co=!0,lo=()=>co=!1;return(async()=>{try{const{unsubscribe:uo}=await Xr.transport.subscribe({params:["newPendingTransactions"],onData(ho){if(!co)return;const go=ho.result;ro([go])},onError(ho){to==null||to(ho)}});lo=uo,co||lo()}catch(uo){to==null||to(uo)}})(),()=>lo()})()}function parseSiweMessage(Xr){var uo,ho,go;const{scheme:eo,statement:to,...ro}=((uo=Xr.match(prefixRegex))==null?void 0:uo.groups)??{},{chainId:no,expirationTime:io,issuedAt:oo,notBefore:ao,requestId:so,...co}=((ho=Xr.match(suffixRegex))==null?void 0:ho.groups)??{},lo=(go=Xr.split("Resources:")[1])==null?void 0:go.split(` +- `).slice(1);return{...ro,...co,...no?{chainId:Number(no)}:{},...io?{expirationTime:new Date(io)}:{},...oo?{issuedAt:new Date(oo)}:{},...ao?{notBefore:new Date(ao)}:{},...so?{requestId:so}:{},...lo?{resources:lo}:{},...eo?{scheme:eo}:{},...to?{statement:to}:{}}}const prefixRegex=/^(?:(?[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?
0x[a-fA-F0-9]{40})\n\n(?:(?.*)\n\n)?/,suffixRegex=/(?:URI: (?.+))\n(?:Version: (?.+))\n(?:Chain ID: (?\d+))\n(?:Nonce: (?[a-zA-Z0-9]+))\n(?:Issued At: (?.+))(?:\nExpiration Time: (?.+))?(?:\nNot Before: (?.+))?(?:\nRequest ID: (?.+))?/;function validateSiweMessage(Xr){const{address:eo,domain:to,message:ro,nonce:no,scheme:io,time:oo=new Date}=Xr;if(to&&ro.domain!==to||no&&ro.nonce!==no||io&&ro.scheme!==io||ro.expirationTime&&oo>=ro.expirationTime||ro.notBefore&&oocall(Xr,eo),createBlockFilter:()=>createBlockFilter(Xr),createContractEventFilter:eo=>createContractEventFilter(Xr,eo),createEventFilter:eo=>createEventFilter(Xr,eo),createPendingTransactionFilter:()=>createPendingTransactionFilter(Xr),estimateContractGas:eo=>estimateContractGas(Xr,eo),estimateGas:eo=>estimateGas$1(Xr,eo),getBalance:eo=>getBalance(Xr,eo),getBlobBaseFee:()=>getBlobBaseFee(Xr),getBlock:eo=>getBlock$1(Xr,eo),getBlockNumber:eo=>getBlockNumber(Xr,eo),getBlockTransactionCount:eo=>getBlockTransactionCount(Xr,eo),getBytecode:eo=>getCode$1(Xr,eo),getChainId:()=>getChainId$1(Xr),getCode:eo=>getCode$1(Xr,eo),getContractEvents:eo=>getContractEvents(Xr,eo),getEip712Domain:eo=>getEip712Domain$1(Xr,eo),getEnsAddress:eo=>getEnsAddress(Xr,eo),getEnsAvatar:eo=>getEnsAvatar(Xr,eo),getEnsName:eo=>getEnsName(Xr,eo),getEnsResolver:eo=>getEnsResolver(Xr,eo),getEnsText:eo=>getEnsText(Xr,eo),getFeeHistory:eo=>getFeeHistory(Xr,eo),estimateFeesPerGas:eo=>estimateFeesPerGas$1(Xr,eo),getFilterChanges:eo=>getFilterChanges(Xr,eo),getFilterLogs:eo=>getFilterLogs(Xr,eo),getGasPrice:()=>getGasPrice(Xr),getLogs:eo=>getLogs(Xr,eo),getProof:eo=>getProof(Xr,eo),estimateMaxPriorityFeePerGas:eo=>estimateMaxPriorityFeePerGas(Xr,eo),getStorageAt:eo=>getStorageAt(Xr,eo),getTransaction:eo=>getTransaction(Xr,eo),getTransactionConfirmations:eo=>getTransactionConfirmations(Xr,eo),getTransactionCount:eo=>getTransactionCount(Xr,eo),getTransactionReceipt:eo=>getTransactionReceipt(Xr,eo),multicall:eo=>multicall(Xr,eo),prepareTransactionRequest:eo=>prepareTransactionRequest(Xr,eo),readContract:eo=>readContract(Xr,eo),sendRawTransaction:eo=>sendRawTransaction(Xr,eo),simulateContract:eo=>simulateContract(Xr,eo),verifyMessage:eo=>verifyMessage(Xr,eo),verifySiweMessage:eo=>verifySiweMessage(Xr,eo),verifyTypedData:eo=>verifyTypedData(Xr,eo),uninstallFilter:eo=>uninstallFilter(Xr,eo),waitForTransactionReceipt:eo=>waitForTransactionReceipt(Xr,eo),watchBlocks:eo=>watchBlocks(Xr,eo),watchBlockNumber:eo=>watchBlockNumber(Xr,eo),watchContractEvent:eo=>watchContractEvent(Xr,eo),watchEvent:eo=>watchEvent(Xr,eo),watchPendingTransactions:eo=>watchPendingTransactions(Xr,eo)}}function createPublicClient(Xr){const{key:eo="public",name:to="Public Client"}=Xr;return createClient({...Xr,key:eo,name:to,type:"publicClient"}).extend(publicActions)}function deployContract(Xr,eo){const{abi:to,args:ro,bytecode:no,...io}=eo,oo=encodeDeployData({abi:to,args:ro,bytecode:no});return sendTransaction$1(Xr,{...io,data:oo})}async function getAddresses(Xr){var to;return((to=Xr.account)==null?void 0:to.type)==="local"?[Xr.account.address]:(await Xr.request({method:"eth_accounts"},{dedupe:!0})).map(ro=>checksumAddress(ro))}async function getPermissions(Xr){return await Xr.request({method:"wallet_getPermissions"},{dedupe:!0})}async function requestAddresses(Xr){return(await Xr.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(to=>getAddress$1(to))}async function requestPermissions(Xr,eo){return Xr.request({method:"wallet_requestPermissions",params:[eo]},{retryCount:0})}async function signMessage$3(Xr,{account:eo=Xr.account,message:to}){if(!eo)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const ro=parseAccount(eo);if(ro.signMessage)return ro.signMessage({message:to});const no=typeof to=="string"?stringToHex(to):to.raw instanceof Uint8Array?toHex$1(to.raw):to.raw;return Xr.request({method:"personal_sign",params:[no,ro.address]},{retryCount:0})}async function signTransaction$3(Xr,eo){var co,lo,uo,ho;const{account:to=Xr.account,chain:ro=Xr.chain,...no}=eo;if(!to)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const io=parseAccount(to);assertRequest({account:io,...eo});const oo=await getAction(Xr,getChainId$1,"getChainId")({});ro!==null&&assertCurrentChain({currentChainId:oo,chain:ro});const ao=(ro==null?void 0:ro.formatters)||((co=Xr.chain)==null?void 0:co.formatters),so=((lo=ao==null?void 0:ao.transactionRequest)==null?void 0:lo.format)||formatTransactionRequest;return io.signTransaction?io.signTransaction({...no,chainId:oo},{serializer:(ho=(uo=Xr.chain)==null?void 0:uo.serializers)==null?void 0:ho.transaction}):await Xr.request({method:"eth_signTransaction",params:[{...so(no),chainId:numberToHex(oo),from:io.address}]},{retryCount:0})}async function signTypedData$2(Xr,eo){const{account:to=Xr.account,domain:ro,message:no,primaryType:io}=eo;if(!to)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const oo=parseAccount(to),ao={EIP712Domain:getTypesForEIP712Domain({domain:ro}),...eo.types};if(validateTypedData$1({domain:ro,message:no,primaryType:io,types:ao}),oo.signTypedData)return oo.signTypedData({domain:ro,message:no,primaryType:io,types:ao});const so=serializeTypedData({domain:ro,message:no,primaryType:io,types:ao});return Xr.request({method:"eth_signTypedData_v4",params:[oo.address,so]},{retryCount:0})}async function switchChain(Xr,{id:eo}){await Xr.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(eo)}]},{retryCount:0})}async function watchAsset(Xr,eo){return await Xr.request({method:"wallet_watchAsset",params:eo},{retryCount:0})}function walletActions(Xr){return{addChain:eo=>addChain(Xr,eo),deployContract:eo=>deployContract(Xr,eo),getAddresses:()=>getAddresses(Xr),getChainId:()=>getChainId$1(Xr),getPermissions:()=>getPermissions(Xr),prepareTransactionRequest:eo=>prepareTransactionRequest(Xr,eo),requestAddresses:()=>requestAddresses(Xr),requestPermissions:eo=>requestPermissions(Xr,eo),sendRawTransaction:eo=>sendRawTransaction(Xr,eo),sendTransaction:eo=>sendTransaction$1(Xr,eo),signMessage:eo=>signMessage$3(Xr,eo),signTransaction:eo=>signTransaction$3(Xr,eo),signTypedData:eo=>signTypedData$2(Xr,eo),switchChain:eo=>switchChain(Xr,eo),watchAsset:eo=>watchAsset(Xr,eo),writeContract:eo=>writeContract(Xr,eo)}}function createWalletClient(Xr){const{key:eo="wallet",name:to="Wallet Client",transport:ro}=Xr;return createClient({...Xr,key:eo,name:to,transport:ro,type:"walletClient"}).extend(walletActions)}var ENV$1=(Xr=>(Xr.PROD="prod",Xr.STAGING="staging",Xr.DEV="dev",Xr.LOCAL="local",Xr))(ENV$1||{});const gasPerPubdataDefault=50000n,maxBytecodeSize=maxUint16*32n,formatters$2={block:defineBlock({format(Xr){var to;const eo=(to=Xr.transactions)==null?void 0:to.map(ro=>{var io;if(typeof ro=="string")return ro;const no=(io=formatters$2.transaction)==null?void 0:io.format(ro);return no.typeHex==="0x71"?no.type="eip712":no.typeHex==="0xff"&&(no.type="priority"),no});return{l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTimestamp:Xr.l1BatchTimestamp?hexToBigInt(Xr.l1BatchTimestamp):null,transactions:eo}}}),transaction:defineTransaction({format(Xr){const eo={};return Xr.type==="0x71"?eo.type="eip712":Xr.type==="0xff"&&(eo.type="priority"),{...eo,l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTxIndex:Xr.l1BatchTxIndex?hexToBigInt(Xr.l1BatchTxIndex):null}}}),transactionReceipt:defineTransactionReceipt({format(Xr){return{l1BatchNumber:Xr.l1BatchNumber?hexToBigInt(Xr.l1BatchNumber):null,l1BatchTxIndex:Xr.l1BatchTxIndex?hexToBigInt(Xr.l1BatchTxIndex):null,logs:Xr.logs.map(eo=>({...formatLog(eo),l1BatchNumber:eo.l1BatchNumber?hexToBigInt(eo.l1BatchNumber):null,transactionLogIndex:hexToNumber$2(eo.transactionLogIndex),logType:eo.logType})),l2ToL1Logs:Xr.l2ToL1Logs.map(eo=>({blockNumber:hexToBigInt(eo.blockHash),blockHash:eo.blockHash,l1BatchNumber:hexToBigInt(eo.l1BatchNumber),transactionIndex:hexToBigInt(eo.transactionIndex),shardId:hexToBigInt(eo.shardId),isService:eo.isService,sender:eo.sender,key:eo.key,value:eo.value,transactionHash:eo.transactionHash,logIndex:hexToBigInt(eo.logIndex)}))}}}),transactionRequest:defineTransactionRequest({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format(Xr){return Xr.gasPerPubdata||Xr.paymaster&&Xr.paymasterInput||Xr.factoryDeps||Xr.customSignature?{eip712Meta:{...Xr.gasPerPubdata?{gasPerPubdata:toHex$1(Xr.gasPerPubdata)}:{gasPerPubdata:toHex$1(gasPerPubdataDefault)},...Xr.paymaster&&Xr.paymasterInput?{paymasterParams:{paymaster:Xr.paymaster,paymasterInput:Array.from(hexToBytes$3(Xr.paymasterInput))}}:{},...Xr.factoryDeps?{factoryDeps:Xr.factoryDeps.map(eo=>Array.from(hexToBytes$3(eo)))}:{},...Xr.customSignature?{customSignature:Array.from(hexToBytes$3(Xr.customSignature))}:{}},type:"0x71"}:{}}})};class InvalidEip712TransactionError extends BaseError{constructor(){super(["Transaction is not an EIP712 transaction.","","Transaction must:",' - include `type: "eip712"`'," - include one of the following: `customSignature`, `paymaster`, `paymasterInput`, `gasPerPubdata`, `factoryDeps`"].join(` +`),{name:"InvalidEip712TransactionError"})}}function isEIP712Transaction(Xr){return!!(Xr.type==="eip712"||"customSignature"in Xr&&Xr.customSignature||"paymaster"in Xr&&Xr.paymaster||"paymasterInput"in Xr&&Xr.paymasterInput||"gasPerPubdata"in Xr&&typeof Xr.gasPerPubdata=="bigint"||"factoryDeps"in Xr&&Xr.factoryDeps)}function assertEip712Transaction(Xr){const{chainId:eo,to,from:ro,paymaster:no,paymasterInput:io}=Xr;if(!isEIP712Transaction(Xr))throw new InvalidEip712TransactionError;if(!eo||eo<=0)throw new InvalidChainIdError({chainId:eo});if(to&&!isAddress(to))throw new InvalidAddressError({address:to});if(ro&&!isAddress(ro))throw new InvalidAddressError({address:ro});if(no&&!isAddress(no))throw new InvalidAddressError({address:no});if(no&&!io)throw new BaseError("`paymasterInput` must be provided when `paymaster` is defined");if(!no&&io)throw new BaseError("`paymaster` must be provided when `paymasterInput` is defined")}function serializeTransaction$3(Xr,eo){return isEIP712Transaction(Xr)?serializeTransactionEIP712(Xr):serializeTransaction$4(Xr,eo)}const serializers$2={transaction:serializeTransaction$3};function serializeTransactionEIP712(Xr){const{chainId:eo,gas:to,nonce:ro,to:no,from:io,value:oo,maxFeePerGas:ao,maxPriorityFeePerGas:so,customSignature:co,factoryDeps:lo,paymaster:uo,paymasterInput:ho,gasPerPubdata:go,data:bo}=Xr;assertEip712Transaction(Xr);const wo=[ro?toHex$1(ro):"0x",so?toHex$1(so):"0x",ao?toHex$1(ao):"0x",to?toHex$1(to):"0x",no??"0x",oo?toHex$1(oo):"0x",bo??"0x0",toHex$1(eo),toHex$1(""),toHex$1(""),toHex$1(eo),io??"0x",toHex$1(go||gasPerPubdataDefault),lo??[],co??"0x",uo&&ho?[uo,ho]:[]];return concatHex(["0x71",toRlp(wo)])}class BytecodeLengthExceedsMaxSizeError extends BaseError{constructor({givenLength:eo,maxBytecodeSize:to}){super(`Bytecode cannot be longer than ${to} bytes. Given length: ${eo}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class BytecodeLengthInWordsMustBeOddError extends BaseError{constructor({givenLengthInWords:eo}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${eo}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class BytecodeLengthMustBeDivisibleBy32Error extends BaseError{constructor({givenLength:eo}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${eo}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function hashBytecode(Xr){const eo=toBytes$1(Xr);if(eo.length%32!==0)throw new BytecodeLengthMustBeDivisibleBy32Error({givenLength:eo.length});if(eo.length>maxBytecodeSize)throw new BytecodeLengthExceedsMaxSizeError({givenLength:eo.length,maxBytecodeSize});const to=sha256$6(eo),ro=toBytes$1(to),no=eo.length/32;if(no%2===0)throw new BytecodeLengthInWordsMustBeOddError({givenLengthInWords:no});const io=toBytes$1(no),oo=pad$1(io,{size:2}),ao=new Uint8Array([1,0]);return ro.set(ao,0),ro.set(oo,2),ro}const getEip712Domain=Xr=>{assertEip712Transaction(Xr);const eo=transactionToMessage(Xr);return{domain:{name:"zkSync",version:"2",chainId:Xr.chainId},types:{Transaction:[{name:"txType",type:"uint256"},{name:"from",type:"uint256"},{name:"to",type:"uint256"},{name:"gasLimit",type:"uint256"},{name:"gasPerPubdataByteLimit",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymaster",type:"uint256"},{name:"nonce",type:"uint256"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"factoryDeps",type:"bytes32[]"},{name:"paymasterInput",type:"bytes"}]},primaryType:"Transaction",message:eo}};function transactionToMessage(Xr){const{gas:eo,nonce:to,to:ro,from:no,value:io,maxFeePerGas:oo,maxPriorityFeePerGas:ao,factoryDeps:so,paymaster:co,paymasterInput:lo,gasPerPubdata:uo,data:ho}=Xr;return{txType:113n,from:BigInt(no),to:ro?BigInt(ro):0n,gasLimit:eo??0n,gasPerPubdataByteLimit:uo??gasPerPubdataDefault,maxFeePerGas:oo??0n,maxPriorityFeePerGas:ao??0n,paymaster:co?BigInt(co):0n,nonce:to?BigInt(to):0n,value:io??0n,data:ho||"0x0",factoryDeps:(so==null?void 0:so.map(go=>toHex$1(hashBytecode(go))))??[],paymasterInput:lo||"0x"}}const chainConfig$3={formatters:formatters$2,serializers:serializers$2,custom:{getEip712Domain}},abstractTestnet=defineChain({...chainConfig$3,id:11124,name:"Abstract Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://api.testnet.abs.xyz"]}},blockExplorers:{default:{name:"Abstract Block Explorer",url:"https://explorer.testnet.abs.xyz"}},testnet:!0,contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963",blockCreated:358349},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:431682}}}),acala=defineChain({id:787,name:"Acala",network:"acala",nativeCurrency:{name:"Acala",symbol:"ACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]}},blockExplorers:{default:{name:"Acala Blockscout",url:"https://blockscout.acala.network",apiUrl:"https://blockscout.acala.network/api"}},testnet:!1}),aioz=defineChain({id:168,name:"AIOZ Network",nativeCurrency:{decimals:18,name:"AIOZ",symbol:"AIOZ"},rpcUrls:{default:{http:["https://eth-dataseed.aioz.network"]}},blockExplorers:{default:{name:"AIOZ Explorer",url:"https://explorer.aioz.network"}},testnet:!1}),alienx=defineChain({id:10241024,name:"AlienX Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://explorer.alienxchain.io"}},testnet:!1}),alienxHalTestnet=defineChain({id:10241025,name:"ALIENX Hal Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://hal-rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://hal-explorer.alienxchain.io"}},testnet:!0}),contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters$1={block:defineBlock({format(Xr){var to;return{transactions:(to=Xr.transactions)==null?void 0:to.map(ro=>{if(typeof ro=="string")return ro;const no=formatTransaction(ro);return no.typeHex==="0x7e"&&(no.isSystemTx=ro.isSystemTx,no.mint=ro.mint?hexToBigInt(ro.mint):void 0,no.sourceHash=ro.sourceHash,no.type="deposit"),no}),stateRoot:Xr.stateRoot}}}),transaction:defineTransaction({format(Xr){const eo={};return Xr.type==="0x7e"&&(eo.isSystemTx=Xr.isSystemTx,eo.mint=Xr.mint?hexToBigInt(Xr.mint):void 0,eo.sourceHash=Xr.sourceHash,eo.type="deposit"),eo}}),transactionReceipt:defineTransactionReceipt({format(Xr){return{l1GasPrice:Xr.l1GasPrice?hexToBigInt(Xr.l1GasPrice):null,l1GasUsed:Xr.l1GasUsed?hexToBigInt(Xr.l1GasUsed):null,l1Fee:Xr.l1Fee?hexToBigInt(Xr.l1Fee):null,l1FeeScalar:Xr.l1FeeScalar?Number(Xr.l1FeeScalar):null}}})};function serializeTransaction$2(Xr,eo){return isDeposit(Xr)?serializeTransactionDeposit(Xr):serializeTransaction$4(Xr,eo)}const serializers$1={transaction:serializeTransaction$2};function serializeTransactionDeposit(Xr){assertTransactionDeposit(Xr);const{sourceHash:eo,data:to,from:ro,gas:no,isSystemTx:io,mint:oo,to:ao,value:so}=Xr,co=[eo,ro,ao??"0x",oo?toHex$1(oo):"0x",so?toHex$1(so):"0x",no?toHex$1(no):"0x",io?"0x1":"0x",to??"0x"];return concatHex(["0x7e",toRlp(co)])}function isDeposit(Xr){return Xr.type==="deposit"||typeof Xr.sourceHash<"u"}function assertTransactionDeposit(Xr){const{from:eo,to}=Xr;if(eo&&!isAddress(eo))throw new InvalidAddressError({address:eo});if(to&&!isAddress(to))throw new InvalidAddressError({address:to})}const chainConfig$2={contracts,formatters:formatters$1,serializers:serializers$1},sourceId$J=1,ancient8=defineChain({...chainConfig$2,id:888888888,name:"Ancient8",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 explorer",url:"https://scan.ancient8.gg",apiUrl:"https://scan.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$J]:{address:"0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"}},portal:{[sourceId$J]:{address:"0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",blockCreated:19070571}},l1StandardBridge:{[sourceId$J]:{address:"0xd5e3eDf5b68135D559D572E26bF863FBC1950033",blockCreated:19070571}}},sourceId:sourceId$J}),sourceId$I=11155111,ancient8Sepolia=defineChain({...chainConfig$2,id:28122024,name:"Ancient8 Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpcv2-testnet.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 Celestia Testnet explorer",url:"https://scanv2-testnet.ancient8.gg",apiUrl:"https://scanv2-testnet.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$I]:{address:"0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"}},portal:{[sourceId$I]:{address:"0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",blockCreated:4972908}},l1StandardBridge:{[sourceId$I]:{address:"0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",blockCreated:4972908}}},sourceId:sourceId$I}),anvil=defineChain({id:31337,name:"Anvil",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$H=42161,apeChain=defineChain({id:33139,name:"Ape Chain",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.apechain.com/http"],webSocket:["wss://rpc.apechain.com/ws"]}},blockExplorers:{default:{name:"Apescan",url:"https://apescan.io",apiUrl:"https://api.apescan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:20889}},sourceId:sourceId$H}),apexTestnet=defineChain({id:3993,name:"APEX Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.apexlayer.xyz"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-testnet.apexlayer.xyz",apiUrl:"https://exp-testnet.apexlayer.xyz/api"}},contracts:{multicall3:{address:"0xf7642be33a6b18D16a995657adb5a68CD0438aE2",blockCreated:283775}},testnet:!0}),arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),arbitrumGoerli=defineChain({id:421613,name:"Arbitrum Goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0}),arbitrumNova=defineChain({id:42170,name:"Arbitrum Nova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://nova.arbiscan.io",apiUrl:"https://api-nova.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}}}),arbitrumSepolia=defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),areonNetwork=defineChain({id:463,name:"Areon Network",nativeCurrency:{decimals:18,name:"AREA",symbol:"AREA"},rpcUrls:{default:{http:["https://mainnet-rpc.areon.network"],webSocket:["wss://mainnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:353286}},testnet:!1}),areonNetworkTestnet=defineChain({id:462,name:"Areon Network Testnet",nativeCurrency:{decimals:18,name:"TAREA",symbol:"TAREA"},rpcUrls:{default:{http:["https://testnet-rpc.areon.network"],webSocket:["wss://testnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},testnet:!0}),artelaTestnet=defineChain({id:11822,name:"Artela Testnet",nativeCurrency:{name:"ART",symbol:"ART",decimals:18},rpcUrls:{default:{http:["https://betanet-rpc1.artela.network"]}},blockExplorers:{default:{name:"Artela",url:"https://betanet-scan.artela.network",apiUrl:"https://betanet-scan.artela.network/api"}},contracts:{multicall3:{address:"0xd07c8635f76e8745Ee7092fbb6e8fbc5FeF09DD7",blockCreated:7001871}},testnet:!0}),assetChain=defineChain({id:42420,name:"AssetChain Mainnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://mainnet-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Explorer",url:"https://scan.assetchain.org",apiUrl:"https://scan.assetchain.org/api"}},testnet:!1,contracts:{}}),assetChainTestnet=defineChain({id:42421,name:"AssetChain Testnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://enugu-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Testnet Explorer",url:"https://scan-testnet.assetchain.org",apiUrl:"https://scan-testnet.assetchain.org/api"}},testnet:!0,contracts:{multicall3:{address:"0x989F832D35988cb5e3eB001Fa2Fe789469EC31Ea",blockCreated:17177}}}),astar=defineChain({id:592,name:"Astar",network:"astar-mainnet",nativeCurrency:{name:"Astar",symbol:"ASTR",decimals:18},rpcUrls:{default:{http:["https://astar.api.onfinality.io/public"]}},blockExplorers:{default:{name:"Astar Subscan",url:"https://astar.subscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:761794}},testnet:!1}),astarZkEVM=defineChain({id:3776,name:"Astar zkEVM",network:"AstarZkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-zkevm.astar.network"]}},blockExplorers:{default:{name:"Astar zkEVM Explorer",url:"https://astar-zkevm.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:93528}},testnet:!1}),astarZkyoto=defineChain({id:6038361,name:"Astar zkEVM Testnet zKyoto",network:"zKyoto",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/zkyoto"]}},blockExplorers:{default:{name:"zKyoto Explorer",url:"https://zkyoto.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:196153}},testnet:!0}),atletaOlympia=defineChain({id:2340,name:"Atleta Olympia",nativeCurrency:{decimals:18,name:"Atla",symbol:"ATLA"},rpcUrls:{default:{http:["https://testnet-rpc.atleta.network:9944","https://testnet-rpc.atleta.network"],ws:["wss://testnet-rpc.atleta.network:9944"]}},blockExplorers:{default:{name:"Atleta Olympia Explorer",url:"https://blockscout.atleta.network",apiUrl:"https://blockscout.atleta.network/api"}},contracts:{multicall3:{address:"0x1472ec6392180fb84F345d2455bCC75B26577115",blockCreated:1076473}},testnet:!0}),aurora=defineChain({id:1313161554,name:"Aurora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://aurorascan.dev",apiUrl:"https://aurorascan.dev/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:62907816}}}),auroraTestnet=defineChain({id:1313161555,name:"Aurora Testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://testnet.aurorascan.dev",apiUrl:"https://testnet.aurorascan.dev/api"}},testnet:!0}),auroria=defineChain({id:205205,name:"Auroria Testnet",network:"auroria",nativeCurrency:{name:"Auroria Stratis",symbol:"tSTRAX",decimals:18},rpcUrls:{default:{http:["https://auroria.rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Auroria Testnet Explorer",url:"https://auroria.explorer.stratisevm.com"}},testnet:!0}),avalanche=defineChain({id:43114,name:"Avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),avalancheFuji=defineChain({id:43113,name:"Avalanche Fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://testnet.snowtrace.io",apiUrl:"https://api-testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0}),sourceId$G=8453,b3=defineChain({id:8333,name:"B3",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.b3.fun"}},sourceId:sourceId$G}),sourceId$F=168587773,b3Sepolia=defineChain({id:1993,name:"B3 Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.b3.fun"}},testnet:!0,sourceId:sourceId$F}),bahamut=defineChain({id:5165,network:"bahamut",name:"Bahamut",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.bahamut.io","https://bahamut-rpc.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut-rpc.publicnode.com","wss://ws2.sahara.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://www.ftnscan.com",apiUrl:"https://www.ftnscan.com/api"}}}),sourceId$E=1,base$6=defineChain({...chainConfig$2,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$E]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[sourceId$E]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[sourceId$E]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[sourceId$E]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:sourceId$E}),sourceId$D=5,baseGoerli=defineChain({...chainConfig$2,id:84531,name:"Base Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org",apiUrl:"https://goerli.basescan.org/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$D]:{address:"0x2A35891ff30313CcFa6CE88dcf3858bb075A2298"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1376988},portal:{[sourceId$D]:{address:"0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA"}},l1StandardBridge:{[sourceId$D]:{address:"0xfA6D8Ee5BE770F84FC001D098C4bD604Fe01284a"}}},testnet:!0,sourceId:sourceId$D}),sourceId$C=11155111,baseSepolia$1=defineChain({...chainConfig$2,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$C]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[sourceId$C]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[sourceId$C]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[sourceId$C]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:sourceId$C}),beam=defineChain({id:4337,name:"Beam",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc"],webSocket:["wss://build.onbeam.com/ws"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets.avax.network/beam"}},contracts:{multicall3:{address:"0x4956f15efdc3dc16645e90cc356eafa65ffc65ec",blockCreated:1}}}),beamTestnet=defineChain({id:13337,name:"Beam Testnet",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc/testnet"],webSocket:["wss://build.onbeam.com/ws/testnet"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets-test.avax.network/beam"}},contracts:{multicall3:{address:"0x9bf49b704ee2a095b95c1f2d4eb9010510c41c9e",blockCreated:3}},testnet:!0}),bearNetworkChainMainnet=defineChain({id:641230,name:"Bear Network Chain Mainnet",nativeCurrency:{decimals:18,name:"BearNetworkChain",symbol:"BRNKC"},rpcUrls:{default:{http:["https://brnkc-mainnet.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkScan",url:"https://brnkscan.bearnetwork.net",apiUrl:"https://brnkscan.bearnetwork.net/api"}}}),bearNetworkChainTestnet=defineChain({id:751230,name:"Bear Network Chain Testnet",nativeCurrency:{decimals:18,name:"tBRNKC",symbol:"tBRNKC"},rpcUrls:{default:{http:["https://brnkc-test.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkTestScan",url:"https://brnktest-scan.bearnetwork.net",apiUrl:"https://brnktest-scan.bearnetwork.net/api"}},testnet:!0}),berachainTestnet=defineChain({id:80085,name:"Berachain Artio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),berachainTestnetbArtio=defineChain({id:80084,name:"Berachain bArtio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:109269}},rpcUrls:{default:{http:["https://bartio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain bArtio Beratrail",url:"https://bartio.beratrail.io"}},testnet:!0}),bevmMainnet=defineChain({id:11501,name:"BEVM Mainnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet-1.bevm.io"]}},blockExplorers:{default:{name:"Bevmscan",url:"https://scan-mainnet.bevm.io",apiUrl:"https://scan-mainnet-api.bevm.io/api"}}}),bifrost=defineChain({id:3068,name:"Bifrost Mainnet",nativeCurrency:{name:"BFC",symbol:"BFC",decimals:18},rpcUrls:{default:{http:["https://public-01.mainnet.bifrostnetwork.com/rpc"]}},blockExplorers:{default:{name:"Bifrost Blockscout",url:"https://explorer.mainnet.bifrostnetwork.com"}},testnet:!1}),bitkub=defineChain({id:96,name:"Bitkub",nativeCurrency:{name:"Bitkub",symbol:"KUB",decimals:18},rpcUrls:{default:{http:["https://rpc.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Mainnet Explorer",url:"https://www.bkcscan.com",apiUrl:"https://www.bkcscan.com/api"}}}),bitkubTestnet=defineChain({id:25925,name:"Bitkub Testnet",network:"Bitkub Testnet",nativeCurrency:{name:"Bitkub Test",symbol:"tKUB",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Testnet Explorer",url:"https://testnet.bkcscan.com",apiUrl:"https://testnet.bkcscan.com/api"}},testnet:!0}),bitlayer=defineChain({id:200901,name:"Bitlayer Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org"],webSocket:["wss://ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer mainnet scan",url:"https://www.btrscan.com"}}}),bitlayerTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer testnet scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bitrock=defineChain({id:7171,name:"Bitrock Mainnet",nativeCurrency:{name:"BROCK",symbol:"BROCK",decimals:18},rpcUrls:{default:{http:["https://brockrpc.io"]}},blockExplorers:{default:{name:"Bitrock Explorer",url:"https://explorer.bit-rock.io"}},testnet:!1}),bitTorrent=defineChain({id:199,name:"BitTorrent",network:"bittorrent-chain-mainnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://rpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://bttcscan.com",apiUrl:"https://api.bttcscan.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:31078552}}}),bitTorrentTestnet=defineChain({id:1028,name:"BitTorrent Chain Testnet",network:"bittorrent-chain-testnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://testrpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://testnet.bttcscan.com",apiUrl:"https://testnet.bttcscan.com/api"}},testnet:!0}),sourceId$B=1,blast=defineChain({id:81457,name:"Blast",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://blastscan.io",apiUrl:"https://api.blastscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:212929}},sourceId:sourceId$B}),sourceId$A=11155111,blastSepolia=defineChain({id:168587773,name:"Blast Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://sepolia.blastscan.io",apiUrl:"https://api-sepolia.blastscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:756690}},testnet:!0,sourceId:sourceId$A}),sourceId$z=1,bob=defineChain({...chainConfig$2,id:60808,name:"BOB",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.gobob.xyz"],webSocket:["wss://rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Explorer",url:"https://explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:23131},l2OutputOracle:{[sourceId$z]:{address:"0xdDa53E23f8a32640b04D7256e651C1db98dB11C1",blockCreated:4462615}},portal:{[sourceId$z]:{address:"0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E",blockCreated:4462615}}},sourceId:sourceId$z}),boba=defineChain({id:288,name:"Boba Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://bobascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:446859}}}),bobaSepolia=defineChain({id:28882,name:"Boba Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://testnet.bobascan.com"}},testnet:!0}),sourceId$y=11155111,bobSepolia=defineChain({...chainConfig$2,id:808813,name:"BOB Sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://bob-sepolia.rpc.gobob.xyz"],webSocket:["wss://bob-sepolia.rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Sepolia Explorer",url:"https://bob-sepolia.explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:35677},l2OutputOracle:{[sourceId$y]:{address:"0x14D0069452b4AE2b250B395b8adAb771E4267d2f",blockCreated:4462615}},portal:{[sourceId$y]:{address:"0x867B1Aa872b9C8cB5E9F7755feDC45BB24Ad0ae4",blockCreated:4462615}}},testnet:!0,sourceId:sourceId$y}),botanixTestnet=defineChain({id:3636,name:"Botanix Testnet",nativeCurrency:{name:"Botanix",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://poa-node.botanixlabs.dev"]}},blockExplorers:{default:{name:"blockscout",url:"https://blockscout.botanixlabs.dev",apiUrl:"https://blockscout.botanixlabs.dev"}},testnet:!0}),bounceBit=defineChain({id:6001,name:"BounceBit Mainnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-mainnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://bbscan.io"}},testnet:!1}),bounceBitTestnet=defineChain({id:6e3,name:"BounceBit Testnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-testnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://testnet.bbscan.io"}},testnet:!0}),bronos=defineChain({id:1039,name:"Bronos",nativeCurrency:{decimals:18,name:"BRO",symbol:"BRO"},rpcUrls:{default:{http:["https://evm.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://broscan.bronos.org"}}}),bronosTestnet=defineChain({id:1038,name:"Bronos Testnet",nativeCurrency:{decimals:18,name:"Bronos Coin",symbol:"tBRO"},rpcUrls:{default:{http:["https://evm-testnet.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://tbroscan.bronos.org"}},testnet:!0}),bsc=defineChain({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://rpc.ankr.com/bsc"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),bscGreenfield=defineChain({id:1017,name:"BNB Greenfield Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://greenfield-chain.bnbchain.org"]}},blockExplorers:{default:{name:"BNB Greenfield Mainnet Scan",url:"https://greenfieldscan.com"}},testnet:!1}),bscTestnet=defineChain({id:97,name:"Binance Smart Chain Testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{default:{name:"BscScan",url:"https://testnet.bscscan.com",apiUrl:"https://api-testnet.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0}),bsquared=defineChain({id:223,name:"B2",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.bsquared.network"}}}),bsquaredTestnet=defineChain({id:1123,name:"B2 Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet-explorer.bsquared.network"}},testnet:!0}),btr=defineChain({id:200901,name:"Bitlayer",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org","https://rpc.bitlayer-rpc.com","https://rpc.ankr.com/bitlayer"],webSocket:["wss://ws.bitlayer.org","wss://ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://www.btrscan.com"}}}),btrTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org","wss://testnet-ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bxn=defineChain({id:4999,name:"BlackFort Exchange Network",nativeCurrency:{name:"BlackFort Token",symbol:"BXN",decimals:18},rpcUrls:{default:{http:["https://mainnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.blackfort.network",apiUrl:"https://explorer.blackfort.network/api"}}}),bxnTestnet=defineChain({id:4777,name:"BlackFort Exchange Network Testnet",nativeCurrency:{name:"BlackFort Testnet Token",symbol:"TBXN",decimals:18},rpcUrls:{default:{http:["https://testnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.blackfort.network",apiUrl:"https://testnet-explorer.blackfort.network/api"}},testnet:!0}),cannon=defineChain({id:13370,name:"Cannon",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),canto=defineChain({id:7700,name:"Canto",nativeCurrency:{decimals:18,name:"Canto",symbol:"CANTO"},rpcUrls:{default:{http:["https://canto.gravitychain.io"]}},blockExplorers:{default:{name:"Tuber.Build (Blockscout)",url:"https://tuber.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2905789}}}),fees={estimateFeesPerGas:async Xr=>{var no;if(!((no=Xr.request)!=null&&no.feeCurrency))return null;const[eo,to]=await Promise.all([estimateFeePerGasInFeeCurrency(Xr.client,Xr.request.feeCurrency),estimateMaxPriorityFeePerGasInFeeCurrency(Xr.client,Xr.request.feeCurrency)]);return{maxFeePerGas:Xr.multiply(eo)+to,maxPriorityFeePerGas:to}}};async function estimateFeePerGasInFeeCurrency(Xr,eo){const to=await Xr.request({method:"eth_gasPrice",params:[eo]});return BigInt(to)}async function estimateMaxPriorityFeePerGasInFeeCurrency(Xr,eo){const to=await Xr.request({method:"eth_maxPriorityFeePerGas",params:[eo]});return BigInt(to)}function isEmpty(Xr){return Xr===0||Xr===0n||Xr===void 0||Xr===null||Xr==="0"||Xr===""||typeof Xr=="string"&&(trim$1(Xr).toLowerCase()==="0x"||trim$1(Xr).toLowerCase()==="0x00")}function isPresent(Xr){return!isEmpty(Xr)}function isEIP1559(Xr){return typeof Xr.maxFeePerGas<"u"&&typeof Xr.maxPriorityFeePerGas<"u"}function isCIP64(Xr){return Xr.type==="cip64"?!0:isEIP1559(Xr)&&isPresent(Xr.feeCurrency)}const formatters={block:defineBlock({format(Xr){var to;return{transactions:(to=Xr.transactions)==null?void 0:to.map(ro=>typeof ro=="string"?ro:{...formatTransaction(ro),...ro.gatewayFee?{gatewayFee:hexToBigInt(ro.gatewayFee),gatewayFeeRecipient:ro.gatewayFeeRecipient}:{},feeCurrency:ro.feeCurrency}),...Xr.randomness?{randomness:Xr.randomness}:{}}}}),transaction:defineTransaction({format(Xr){if(Xr.type==="0x7e")return{isSystemTx:Xr.isSystemTx,mint:Xr.mint?hexToBigInt(Xr.mint):void 0,sourceHash:Xr.sourceHash,type:"deposit"};const eo={feeCurrency:Xr.feeCurrency};return Xr.type==="0x7b"?eo.type="cip64":(Xr.type==="0x7c"&&(eo.type="cip42"),eo.gatewayFee=Xr.gatewayFee?hexToBigInt(Xr.gatewayFee):null,eo.gatewayFeeRecipient=Xr.gatewayFeeRecipient),eo}}),transactionRequest:defineTransactionRequest({format(Xr){const eo={};return Xr.feeCurrency&&(eo.feeCurrency=Xr.feeCurrency),isCIP64(Xr)&&(eo.type="0x7b"),eo}})};function serializeTransaction$1(Xr,eo){return isCIP64(Xr)?serializeTransactionCIP64(Xr,eo):serializeTransaction$2(Xr,eo)}const serializers={transaction:serializeTransaction$1};function serializeTransactionCIP64(Xr,eo){assertTransactionCIP64(Xr);const{chainId:to,gas:ro,nonce:no,to:io,value:oo,maxFeePerGas:ao,maxPriorityFeePerGas:so,accessList:co,feeCurrency:lo,data:uo}=Xr,ho=[toHex$1(to),no?toHex$1(no):"0x",so?toHex$1(so):"0x",ao?toHex$1(ao):"0x",ro?toHex$1(ro):"0x",io??"0x",oo?toHex$1(oo):"0x",uo??"0x",serializeAccessList(co),lo,...toYParitySignatureArray(Xr,eo)];return concatHex(["0x7b",toRlp(ho)])}const MAX_MAX_FEE_PER_GAS=maxUint256;function assertTransactionCIP64(Xr){const{chainId:eo,maxPriorityFeePerGas:to,gasPrice:ro,maxFeePerGas:no,to:io,feeCurrency:oo}=Xr;if(eo<=0)throw new InvalidChainIdError({chainId:eo});if(io&&!isAddress(io))throw new InvalidAddressError({address:io});if(ro)throw new BaseError("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(isPresent(no)&&no>MAX_MAX_FEE_PER_GAS)throw new FeeCapTooHighError({maxFeePerGas:no});if(isPresent(to)&&isPresent(no)&&to>no)throw new TipAboveFeeCapError({maxFeePerGas:no,maxPriorityFeePerGas:to});if(isPresent(oo)&&!isAddress(oo))throw new BaseError("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(isEmpty(oo))throw new BaseError("`feeCurrency` must be provided for CIP-64 transactions.")}const chainConfig$1={contracts,formatters,serializers,fees},celo=defineChain({...chainConfig$1,id:42220,name:"Celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://celoscan.io",apiUrl:"https://api.celoscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1}),sourceId$x=17e3,celoAlfajores=defineChain({...chainConfig$1,id:44787,name:"Alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Alfajores Explorer",url:"https://celo-alfajores.blockscout.com",apiUrl:"https://celo-alfajores.blockscout.com/api"}},contracts:{...chainConfig$1.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:14569001},portal:{[sourceId$x]:{address:"0x82527353927d8D069b3B452904c942dA149BA381",blockCreated:2411324}},disputeGameFactory:{[sourceId$x]:{address:"0xE28AAdcd9883746c0e5068F58f9ea06027b214cb",blockCreated:2411324}},l2OutputOracle:{[sourceId$x]:{address:"0x4a2635e9e4f6e45817b1D402ac4904c1d1752438",blockCreated:2411324}},l1StandardBridge:{[sourceId$x]:{address:"0xD1B0E0581973c9eB7f886967A606b9441A897037",blockCreated:2411324}}},testnet:!0}),chang=defineChain({id:5858,name:"Chang Chain Foundation Mainnet",nativeCurrency:{decimals:18,name:"CTH",symbol:"CTH"},rpcUrls:{default:{http:["https://rpc.cthscan.com"]}},blockExplorers:{default:{name:"Chang Chain explorer",url:"https://cthscan.com"}}}),chiliz=defineChain({id:88888,name:"Chiliz Chain",network:"chiliz-chain",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://rpc.ankr.com/chiliz","https://chiliz-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"https://scan.chiliz.com",apiUrl:"https://scan.chiliz.com/api"}}}),chips=defineChain({id:2882,name:"Chips Network",network:"CHIPS",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://node.chips.ooo/wasp/api/v1/chains/iota1pp3d3mnap3ufmgqnjsnw344sqmf5svjh26y2khnmc89sv6788y3r207a8fn/evm"]}}}),classic=defineChain({id:61,name:"Ethereum Classic",nativeCurrency:{decimals:18,name:"ETC",symbol:"ETC"},rpcUrls:{default:{http:["https://etc.rivet.link"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.com/etc/mainnet"}}}),confluxESpace=defineChain({id:1030,name:"Conflux eSpace",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evm.confluxrpc.com"],webSocket:["wss://evm.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evm.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:68602935}}}),confluxESpaceTestnet=defineChain({id:71,name:"Conflux eSpace Testnet",network:"cfx-espace-testnet",testnet:!0,nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evmtestnet.confluxrpc.com"],webSocket:["wss://evmtestnet.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evmtestnet.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:117499050}}}),coreDao=defineChain({id:1116,name:"Core Dao",nativeCurrency:{decimals:18,name:"Core",symbol:"CORE"},rpcUrls:{default:{http:["https://rpc.coredao.org"]}},blockExplorers:{default:{name:"CoreDao",url:"https://scan.coredao.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:11907934}},testnet:!1}),crab=defineChain({id:44,name:"Crab Network",nativeCurrency:{decimals:18,name:"Crab Network Native Token",symbol:"CRAB"},rpcUrls:{default:{http:["https://crab-rpc.darwinia.network"],webSocket:["wss://crab-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://crab-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3032593}}}),cronos=defineChain({id:25,name:"Cronos Mainnet",nativeCurrency:{decimals:18,name:"Cronos",symbol:"CRO"},rpcUrls:{default:{http:["https://evm.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://explorer.cronos.org",apiUrl:"https://explorer-api.cronos.org/mainnet/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1963112}}}),cronosTestnet=defineChain({id:338,name:"Cronos Testnet",nativeCurrency:{decimals:18,name:"CRO",symbol:"tCRO"},rpcUrls:{default:{http:["https://evm-t3.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://cronos.org/explorer/testnet3"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:10191251}},testnet:!0}),cronoszkEVM=defineChain({id:388,name:"Cronos zkEVM Mainnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM CRO",symbol:"zkCRO"},rpcUrls:{default:{http:["https://mainnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM (Mainnet) Chain Explorer",url:"https://explorer.zkevm.cronos.org"}}}),cronoszkEVMTestnet=defineChain({id:282,name:"Cronos zkEVM Testnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM Test Coin",symbol:"zkTCRO"},rpcUrls:{default:{http:["https://testnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM Testnet Explorer",url:"https://explorer.zkevm.cronos.org/testnet"}},testnet:!0}),crossbell=defineChain({id:3737,name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io",apiUrl:"https://scan.crossbell.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}}),curtis=defineChain({id:33111,name:"Curtis",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.curtis.apechain.com"]}},blockExplorers:{default:{name:"Curtis Explorer",url:"https://explorer.curtis.apechain.com"}},testnet:!0}),cyber=defineChain({id:7560,name:"Cyber",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),cyberTestnet=defineChain({id:111557560,name:"Cyber Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co",apiUrl:"https://testnet.cyberscan.co/api"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),darwinia=defineChain({id:46,name:"Darwinia Network",nativeCurrency:{decimals:18,name:"RING",symbol:"RING"},rpcUrls:{default:{http:["https://rpc.darwinia.network"],webSocket:["wss://rpc.darwinia.network"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69420}}}),dchain=defineChain({...chainConfig$2,id:2716446429837e3,name:"Dchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchain-2716446429837000-1.jsonrpc.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchain-2716446429837000-1.sagaexplorer.io",apiUrl:"https://api-dchain-2716446429837000-1.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),dchainTestnet=defineChain({...chainConfig$2,id:2713017997578e3,name:"Dchain Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchaintestnet-2713017997578000-1.jsonrpc.testnet.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io",apiUrl:"https://api-dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),defichainEvm=defineChain({id:1130,network:"defichain-evm",name:"DeFiChain EVM Mainnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.mainnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:137852}}}),defichainEvmTestnet=defineChain({id:1131,network:"defichain-evm-testnet",name:"DeFiChain EVM Testnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.testnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live/?network=TestNet"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:156462}},testnet:!0}),degen=defineChain({id:666666666,name:"Degen",nativeCurrency:{decimals:18,name:"Degen",symbol:"DEGEN"},rpcUrls:{default:{http:["https://rpc.degen.tips"],webSocket:["wss://rpc.degen.tips"]}},blockExplorers:{default:{name:"Degen Chain Explorer",url:"https://explorer.degen.tips",apiUrl:"https://explorer.degen.tips/api/v2"}}}),dfk=defineChain({id:53935,name:"DFK Chain",nativeCurrency:{decimals:18,name:"Jewel",symbol:"JEWEL"},rpcUrls:{default:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]}},blockExplorers:{default:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14790551}}}),dodochainTestnet=defineChain({id:53457,name:"DODOchain Testnet",nativeCurrency:{decimals:18,name:"DODO",symbol:"DODO"},rpcUrls:{default:{http:["https://dodochain-testnet.alt.technology"],webSocket:["wss://dodochain-testnet.alt.technology/ws"]}},blockExplorers:{default:{name:"DODOchain Testnet (Sepolia) Explorer",url:"https://testnet-scan.dodochain.com"}},testnet:!0}),dogechain=defineChain({id:2e3,name:"Dogechain",nativeCurrency:{decimals:18,name:"Wrapped Dogecoin",symbol:"WDOGE"},rpcUrls:{default:{http:["https://rpc.dogechain.dog"]}},blockExplorers:{default:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog",apiUrl:"https://explorer.dogechain.dog/api"}},contracts:{multicall3:{address:"0x68a8609a60a008EFA633dfdec592c03B030cC508",blockCreated:25384031}}}),dosChain=defineChain({id:7979,name:"DOS Chain",nativeCurrency:{decimals:18,name:"DOS Chain",symbol:"DOS"},rpcUrls:{default:{http:["https://main.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Explorer",url:"https://doscan.io",apiUrl:"https://api.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:161908}}}),dosChainTestnet=defineChain({id:3939,name:"DOS Chain Testnet",nativeCurrency:{decimals:18,name:"DOS Chain Testnet",symbol:"DOS"},rpcUrls:{default:{http:["https://test.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Testnet Explorer",url:"https://test.doscan.io",apiUrl:"https://api-test.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69623}},testnet:!0}),dreyerxMainnet=defineChain({id:23451,name:"DreyerX Mainnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["https://rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Scan",url:"https://scan.dreyerx.com"}}}),dreyerxTestnet=defineChain({id:23452,name:"DreyerX Testnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["http://testnet-rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Testnet Scan",url:"https://testnet-scan.dreyerx.com"}},testnet:!0}),dustboyIoT=defineChain({id:555888,name:"DustBoy IoT",nativeCurrency:{name:"Ether",symbol:"DST",decimals:18},rpcUrls:{default:{http:["https://dustboy-rpc.jibl2.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://dustboy.jibl2.com",apiUrl:"https://dustboy.jibl2.com/api"}},contracts:{multicall3:{address:"0xFFD34aa2C62B2D52E00A361e466C229788f4eD6a",blockCreated:526569}},testnet:!1}),dymension=defineChain({id:1100,name:"Dymension",nativeCurrency:{name:"DYM",symbol:"DYM",decimals:18},rpcUrls:{default:{http:["https://dymension-evm-rpc.publicnode.com"],webSocket:["wss://dymension-evm-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Dym FYI",url:"https://dym.fyi"}},testnet:!1}),edgeless=defineChain({id:2026,name:"Edgeless Network",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://rpc.edgeless.network/http"],webSocket:["wss://rpc.edgeless.network/ws"]}},blockExplorers:{default:{name:"Edgeless Explorer",url:"https://explorer.edgeless.network"}}}),edgelessTestnet=defineChain({id:202,name:"Edgeless Testnet",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://edgeless-testnet.rpc.caldera.xyz/http"],webSocket:["wss://edgeless-testnet.rpc.caldera.xyz/ws"]}},blockExplorers:{default:{name:"Edgeless Testnet Explorer",url:"https://testnet.explorer.edgeless.network"}}}),edgeware=defineChain({id:2021,name:"Edgeware EdgeEVM Mainnet",nativeCurrency:{decimals:18,name:"Edgeware",symbol:"EDG"},rpcUrls:{default:{http:["https://edgeware-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live",apiUrl:"https://edgscan.live/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18117872}}}),edgewareTestnet=defineChain({id:2022,name:"Beresheet BereEVM Testnet",nativeCurrency:{decimals:18,name:"Testnet EDG",symbol:"tEDG"},rpcUrls:{default:{http:["https://beresheet-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live",apiUrl:"https://testnet.edgscan.live/api"}}}),ekta=defineChain({id:1994,name:"Ekta",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://main.ekta.io"]}},blockExplorers:{default:{name:"Ektascan",url:"https://ektascan.io",apiUrl:"https://ektascan.io/api"}}}),ektaTestnet=defineChain({id:1004,name:"Ekta Testnet",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://test.ekta.io:8545"]}},blockExplorers:{default:{name:"Test Ektascan",url:"https://test.ektascan.io",apiUrl:"https://test.ektascan.io/api"}},testnet:!0}),elastos=defineChain({id:20,name:"Elastos Smart Chain",nativeCurrency:{name:"ELA",symbol:"ELA",decimals:18},rpcUrls:{default:{http:["https://api2.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc.elastos.io"}},testnet:!1}),elastosTestnet=defineChain({id:21,name:"Elastos Smart Chain Testnet",nativeCurrency:{name:"tELA",symbol:"tELA",decimals:18},rpcUrls:{default:{http:["https://api-testnet.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc-testnet.elastos.io"}},testnet:!0}),electroneum=defineChain({id:52014,name:"Electroneum Mainnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.electroneum.com"}},testnet:!1}),electroneumTestnet=defineChain({id:5201420,name:"Electroneum Testnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.thesecurityteam.rocks"}},testnet:!0}),elysiumTestnet=defineChain({...chainConfig$2,id:1338,name:"Elysium Testnet",nativeCurrency:{decimals:18,name:"LAVA",symbol:"LAVA"},rpcUrls:{default:{http:["https://elysium-test-rpc.vulcanforged.com"]}},blockExplorers:{default:{name:"Elysium testnet explorer",url:"https://elysium-explorer.vulcanforged.com"}},testnet:!0}),enuls=defineChain({id:119,name:"ENULS Mainnet",nativeCurrency:{decimals:18,name:"NULS",symbol:"NULS"},rpcUrls:{default:{http:["https://evmapi2.nuls.io"]}},blockExplorers:{default:{name:"ENULS Explorer",url:"https://evmscan.nuls.io"}},testnet:!1}),eon=defineChain({id:7332,name:"Horizen EON",nativeCurrency:{decimals:18,name:"ZEN",symbol:"ZEN"},rpcUrls:{default:{http:["https://eon-rpc.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"EON Explorer",url:"https://eon-explorer.horizenlabs.io"}},contracts:{}}),eos=defineChain({id:17777,name:"EOS EVM",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com",apiUrl:"https://explorer.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7943933}}}),eosTestnet=defineChain({id:15557,name:"EOS EVM Testnet",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.testnet.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com",apiUrl:"https://explorer.testnet.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9067940}},testnet:!0}),etherlink=defineChain({id:42793,name:"Etherlink",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.mainnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink",url:"https://explorer.etherlink.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:33899}}}),etherlinkTestnet=defineChain({id:128123,name:"Etherlink Testnet",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.ghostnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink Testnet",url:"https://testnet-explorer.etherlink.com"}},testnet:!0}),evmos=defineChain({id:9001,name:"Evmos",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.org:8545"]}},blockExplorers:{default:{name:"Evmos Block Explorer",url:"https://escan.live"}}}),evmosTestnet=defineChain({id:9e3,name:"Evmos Testnet",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.dev:8545"]}},blockExplorers:{default:{name:"Evmos Testnet Block Explorer",url:"https://evm.evmos.dev/"}}}),excelonMainnet=defineChain({id:22052002,name:"Excelon Mainnet",network:"XLON",nativeCurrency:{decimals:18,name:"Excelon",symbol:"xlon"},rpcUrls:{default:{http:["https://edgewallet1.xlon.org"]}},blockExplorers:{default:{name:"Excelon explorer",url:"https://explorer.excelon.io"}}}),fantom=defineChain({id:250,name:"Fantom",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.ankr.com/fantom"]}},blockExplorers:{default:{name:"FTMScan",url:"https://ftmscan.com",apiUrl:"https://api.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:33001987}}}),fantomSonicTestnet=defineChain({id:64240,name:"Fantom Sonic Open Testnet",network:"fantom-sonic-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpcapi.sonic.fantom.network"]}},blockExplorers:{default:{name:"Fantom Sonic Open Testnet Explorer",url:"https://public-sonic.fantom.network"}},testnet:!0}),fantomTestnet=defineChain({id:4002,name:"Fantom Testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.testnet.fantom.network"]}},blockExplorers:{default:{name:"FTMScan",url:"https://testnet.ftmscan.com",apiUrl:"https://testnet.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:8328688}},testnet:!0}),fibo=defineChain({id:12306,name:"Fibo Chain",nativeCurrency:{decimals:18,name:"fibo",symbol:"FIBO"},rpcUrls:{default:{http:["https://network.hzroc.art"]}},blockExplorers:{default:{name:"FiboScan",url:"https://scan.fibochain.org"}}}),filecoin=defineChain({id:314,name:"Filecoin Mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3328594}}}),filecoinCalibration=defineChain({id:314159,name:"Filecoin Calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}},testnet:!0}),filecoinHyperspace=defineChain({id:3141,name:"Filecoin Hyperspace",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://hyperspace.filfox.info/en"}},testnet:!0}),flare=defineChain({id:14,name:"Flare Mainnet",nativeCurrency:{decimals:18,name:"Flare",symbol:"FLR"},rpcUrls:{default:{http:["https://flare-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Flare Explorer",url:"https://flare-explorer.flare.network",apiUrl:"https://flare-explorer.flare.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3002461}}}),flareTestnet=defineChain({id:114,name:"Flare Testnet Coston2",nativeCurrency:{decimals:18,name:"Coston2 Flare",symbol:"C2FLR"},rpcUrls:{default:{http:["https://coston2-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston2 Explorer",url:"https://coston2-explorer.flare.network",apiUrl:"https://coston2-explorer.flare.network/api"}},testnet:!0}),flowMainnet=defineChain({id:747,name:"FlowEVM Mainnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://mainnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Mainnet Explorer",url:"https://flowdiver.io"}}}),flowPreviewnet=defineChain({id:646,name:"FlowEVM Previewnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://previewnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Previewnet Explorer",url:"https://previewnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6205}}}),flowTestnet=defineChain({id:545,name:"FlowEVM Testnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://testnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Flow Diver",url:"https://testnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:137518}}}),fluence=defineChain({id:9999999,name:"Fluence",nativeCurrency:{name:"FLT",symbol:"FLT",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.fluence.dev"],webSocket:["wss://ws.mainnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.mainnet.fluence.dev",apiUrl:"https://blockscout.mainnet.fluence.dev/api"}}}),fluenceStage=defineChain({id:123420000220,name:"Fluence Stage",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.stage.fluence.dev"],webSocket:["wss://ws.stage.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.stage.fluence.dev",apiUrl:"https://blockscout.stage.fluence.dev/api"}},testnet:!0}),fluenceTestnet=defineChain({id:52164803,name:"Fluence Testnet",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.fluence.dev"],webSocket:["wss://ws.testnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.testnet.fluence.dev",apiUrl:"https://blockscout.testnet.fluence.dev/api"}},testnet:!0}),forma=defineChain({id:984122,name:"Forma",network:"forma",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.forma.art"],webSocket:["wss://ws.forma.art"]}},blockExplorers:{default:{name:"Forma Explorer",url:"https://explorer.forma.art"}},contracts:{multicall3:{address:"0xd53C6FFB123F7349A32980F87faeD8FfDc9ef079",blockCreated:252705}}}),foundry=defineChain({id:31337,name:"Foundry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$w=1,fraxtal=defineChain({...chainConfig$2,id:252,name:"Fraxtal",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.frax.com"]}},blockExplorers:{default:{name:"fraxscan",url:"https://fraxscan.com",apiUrl:"https://api.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$w]:{address:"0x66CC916Ed5C6C2FA97014f7D1cD141528Ae171e4"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$w]:{address:"0x36cb65c1967A0Fb0EEE11569C51C2f2aA1Ca6f6D",blockCreated:19135323}},l1StandardBridge:{[sourceId$w]:{address:"0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2",blockCreated:19135323}}},sourceId:sourceId$w}),sourceId$v=17e3,fraxtalTestnet=defineChain({...chainConfig$2,id:2522,name:"Fraxtal Testnet",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.frax.com"]}},blockExplorers:{default:{name:"fraxscan testnet",url:"https://holesky.fraxscan.com",apiUrl:"https://api-holesky.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$v]:{address:"0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$v]:{address:"0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d",blockCreated:318416}},l1StandardBridge:{[sourceId$v]:{address:"0x0BaafC217162f64930909aD9f2B27125121d6332",blockCreated:318416}}},sourceId:sourceId$v}),sourceId$u=1,funkiMainnet=defineChain({...chainConfig$2,id:33979,name:"Funki",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.funkichain.com"]}},blockExplorers:{default:{name:"Funki Mainnet Explorer",url:"https://funkiscan.io"}},contracts:{...chainConfig$2.contracts},sourceId:sourceId$u}),sourceId$t=11155111,funkiSepolia=defineChain({...chainConfig$2,id:3397901,network:"funkiSepolia",name:"Funki Sepolia Sandbox",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://funki-testnet.alt.technology"]}},blockExplorers:{default:{name:"Funki Sepolia Sandbox Explorer",url:"https://sepolia-sandbox.funkichain.com/"}},testnet:!0,contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204}},sourceId:sourceId$t}),fuse=defineChain({id:122,name:"Fuse",nativeCurrency:{name:"Fuse",symbol:"FUSE",decimals:18},rpcUrls:{default:{http:["https://rpc.fuse.io"]}},blockExplorers:{default:{name:"Fuse Explorer",url:"https://explorer.fuse.io",apiUrl:"https://explorer.fuse.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:16146628}}}),fuseSparknet=defineChain({id:123,name:"Fuse Sparknet",nativeCurrency:{name:"Spark",symbol:"SPARK",decimals:18},rpcUrls:{default:{http:["https://rpc.fusespark.io"]}},blockExplorers:{default:{name:"Sparkent Explorer",url:"https://explorer.fusespark.io",apiUrl:"https://explorer.fusespark.io/api"}}}),fusion=defineChain({id:32659,name:"Fusion Mainnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://mainnet.fusionnetwork.io"],webSocket:["wss://mainnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10441605}},testnet:!1}),fusionTestnet=defineChain({id:46688,name:"Fusion Testnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://testnet.fusionnetwork.io"],webSocket:["wss://testnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://testnet.fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10428309}},testnet:!0}),sourceId$s=17e3,garnet=defineChain({...chainConfig$2,name:"Garnet Testnet",testnet:!0,id:17069,sourceId:sourceId$s,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"],webSocket:["wss://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$s]:{address:"0x57ee40586fbE286AfC75E67cb69511A6D9aF5909",blockCreated:1274684}},l2OutputOracle:{[sourceId$s]:{address:"0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B",blockCreated:1274684}},l1StandardBridge:{[sourceId$s]:{address:"0x09bcDd311FE398F80a78BE37E489f5D440DB95DE",blockCreated:1274684}}}}),genesys=defineChain({id:16507,name:"Genesys Mainnet",nativeCurrency:{decimals:18,name:"GSYS",symbol:"GSYS"},rpcUrls:{default:{http:["https://rpc.genesys.network"]}},blockExplorers:{default:{name:"Genesys Explorer",url:"https://gchainexplorer.genesys.network"}},testnet:!1}),glideL1Protocol=defineChain({id:251,name:"Glide L1 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l1-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l1-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),glideL2Protocol=defineChain({id:253,name:"Glide L2 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l2-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l2-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),gnosis=defineChain({id:100,name:"Gnosis",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{default:{name:"Gnosisscan",url:"https://gnosisscan.io",apiUrl:"https://api.gnosisscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}}),gnosisChiado=defineChain({id:10200,name:"Gnosis Chiado",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.chiadochain.net",apiUrl:"https://blockscout.chiadochain.net/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4967313}},testnet:!0}),gobi=defineChain({id:1663,name:"Horizen Gobi Testnet",nativeCurrency:{decimals:18,name:"Test ZEN",symbol:"tZEN"},rpcUrls:{default:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"Gobi Explorer",url:"https://gobi-explorer.horizen.io"}},contracts:{},testnet:!0}),goChain=defineChain({id:60,name:"GoChain",nativeCurrency:{decimals:18,name:"GO",symbol:"GO"},rpcUrls:{default:{http:["https://rpc.gochain.io"]}},blockExplorers:{default:{name:"GoChain Explorer",url:"https://explorer.gochain.io"}},testnet:!1}),godwoken=defineChain({id:71402,name:"Godwoken Mainnet",nativeCurrency:{decimals:18,name:"pCKB",symbol:"pCKB"},rpcUrls:{default:{http:["https://v1.mainnet.godwoken.io/rpc"]}},blockExplorers:{default:{name:"GW Scan",url:"https://v1.gwscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:15034}},testnet:!1}),goerli=defineChain({id:5,name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io",apiUrl:"https://api-goerli.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xfc4AC75C46C914aF5892d6d3eFFcebD7917293F1",blockCreated:10339206},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),gravity=defineChain({id:1625,name:"Gravity Alpha Mainnet",nativeCurrency:{name:"G",symbol:"G",decimals:18},rpcUrls:{default:{http:["https://rpc.gravity.xyz"]}},blockExplorers:{default:{name:"Gravity Explorer",url:"https://explorer.gravity.xyz",apiUrl:"https://explorer.gravity.xyz/api"}},contracts:{multicall3:{address:"0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c",blockCreated:16851}}}),guruTestnet=defineChain({id:261,name:"Guru Network Testnet",nativeCurrency:{name:"testGURU",symbol:"tGURU",decimals:18},rpcUrls:{default:{http:["https://rpc.gurunetwork.ai/archive/261"]}},blockExplorers:{default:{name:"Guruscan",url:"https://scan.gurunetwork.ai"}},testnet:!0}),ham=defineChain({id:5112,name:"Ham",nativeCurrency:{decimals:18,name:"Ham",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.ham.fun"],webSocket:["wss://rpc.ham.fun"]}},blockExplorers:{default:{name:"Ham Chain Explorer",url:"https://explorer.ham.fun",apiUrl:"https://explorer.ham.fun/api/v2"}}}),haqqMainnet=defineChain({id:11235,name:"HAQQ Mainnet",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLM"},rpcUrls:{default:{http:["https://rpc.eth.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.haqq.network",apiUrl:"https://explorer.haqq.network/api"}}}),haqqTestedge2=defineChain({id:54211,name:"HAQQ Testedge 2",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLMT"},rpcUrls:{default:{http:["https://rpc.eth.testedge2.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.testedge2.haqq.network",apiUrl:"https://explorer.testedge2.haqq.network/api"}}}),hardhat=defineChain({id:31337,name:"Hardhat",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),harmonyOne=defineChain({id:16666e5,name:"Harmony One",nativeCurrency:{name:"Harmony",symbol:"ONE",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/harmony"]}},blockExplorers:{default:{name:"Harmony Explorer",url:"https://explorer.harmony.one"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:24185753}}}),hashkeyTestnet=defineChain({id:133,name:"HashKey Chain Testnet",nativeCurrency:{decimals:18,name:"HashKey EcoPoints",symbol:"HSK"},rpcUrls:{default:{http:["https://hashkeychain-testnet.alt.technology"]}},blockExplorers:{default:{name:"HashKey Chain Explorer",url:"https://hashkeychain-testnet-explorer.alt.technology"}}}),hedera=defineChain({id:295,name:"Hedera Mainnet",network:"hedera-mainnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://mainnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/mainnet"}},testnet:!1}),hederaPreviewnet=defineChain({id:297,name:"Hedera Previewnet",network:"hedera-previewnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://previewnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/previewnet"}},testnet:!0}),hederaTestnet=defineChain({id:296,name:"Hedera Testnet",network:"hedera-testnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://testnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/testnet"}},testnet:!0}),hela=defineChain({id:8668,name:"Hela Mainnet",nativeCurrency:{name:"HLUSD",symbol:"HLUSD",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.helachain.com"]}},blockExplorers:{default:{name:"Hela explorer",url:"https://mainnet-blockexplorer.helachain.com"}},testnet:!1}),hemiSepolia=defineChain({id:743111,name:"Hemi Sepolia",network:"Hemi Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.rpc.hemi.network/rpc"]}},blockExplorers:{default:{name:"Hemi Sepolia explorer",url:"https://testnet.explorer.hemi.xyz"}},testnet:!0}),holesky=defineChain({id:17e3,name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://holesky.etherscan.io",apiUrl:"https://api-holesky.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",blockCreated:801613},ensUniversalResolver:{address:"0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",blockCreated:973484}},testnet:!0}),hychain=defineChain({id:2911,name:"HYCHAIN",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://explorer.hychain.com"}},testnet:!1}),hychainTestnet=defineChain({id:29112,name:"HYCHAIN Testnet",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://testnet-rpc.hychain.com/http"}},testnet:!0}),immutableZkEvm=defineChain({id:13371,name:"Immutable zkEVM",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.immutable.com"]}},blockExplorers:{default:{name:"Immutable Explorer",url:"https://explorer.immutable.com",apiUrl:"https://explorer.immutable.com/api"}},contracts:{multicall3:{address:"0x236bdA4589e44e6850f5aC6a74BfCa398a86c6c0",blockCreated:4335972}}}),immutableZkEvmTestnet=defineChain({id:13473,name:"Immutable zkEVM Testnet",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.testnet.immutable.com"]}},blockExplorers:{default:{name:"Immutable Testnet Explorer",url:"https://explorer.testnet.immutable.com/"}},contracts:{multicall3:{address:"0x2CC787Ed364600B0222361C4188308Fa8E68bA60",blockCreated:5977391}},testnet:!0}),inEVM=defineChain({id:2525,name:"inEVM Mainnet",nativeCurrency:{decimals:18,name:"Injective",symbol:"INJ"},rpcUrls:{default:{http:["https://mainnet.rpc.inevm.com/http"]}},blockExplorers:{default:{name:"inEVM Explorer",url:"https://inevm.calderaexplorer.xyz",apiUrl:"https://inevm.calderaexplorer.xyz/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:118606}}}),sourceId$r=11155111,inkSepolia=defineChain({...chainConfig$2,id:763373,name:"Ink Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-gel-sepolia.inkonchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer-sepolia.inkonchain.com/",apiUrl:"https://explorer-sepolia.inkonchain.com/api/v2"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$r]:{address:"0x860e626c700af381133d9f4af31412a2d1db3d5d"}},portal:{[sourceId$r]:{address:"0x5c1d29c6c9c8b0800692acc95d700bcb4966a1d7"}},l1StandardBridge:{[sourceId$r]:{address:"0x33f60714bbd74d62b66d79213c348614de51901c"}}},testnet:!0,sourceId:sourceId$r}),iota$1=defineChain({id:8822,name:"IOTA EVM",network:"iotaevm",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.iota.org",apiUrl:"https://explorer.evm.iota.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:25022}}}),iotaTestnet=defineChain({id:1075,name:"IOTA EVM Testnet",network:"iotaevm-testnet",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.testnet.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.testnet.iotaledger.net",apiUrl:"https://explorer.evm.testnet.iotaledger.net/api"}},testnet:!0}),iotex=defineChain({id:4689,name:"IoTeX",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://iotexscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:22163670}}}),iotexTestnet=defineChain({id:4690,name:"IoTeX Testnet",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://testnet.iotexscan.io"}},contracts:{multicall3:{address:"0xb5cecD6894c6f473Ec726A176f1512399A2e355d",blockCreated:24347592}},testnet:!0}),jbc=defineChain({id:8899,name:"JIBCHAIN L1",network:"jbc",nativeCurrency:{name:"JBC",symbol:"JBC",decimals:18},rpcUrls:{default:{http:["https://rpc-l1.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-l1.jibchain.net",apiUrl:"https://exp-l1.jibchain.net/api"}},contracts:{multicall3:{address:"0xc0C8C486D1466C57Efe13C2bf000d4c56F47CBdC",blockCreated:2299048}},testnet:!1}),jbcTestnet=defineChain({id:88991,name:"Jibchain Testnet",nativeCurrency:{name:"tJBC",symbol:"tJBC",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.testnet.jibchain.net",apiUrl:"https://exp.testnet.jibchain.net/api"}},contracts:{multicall3:{address:"0xa1a858ad9041B4741e620355a3F96B3c78e70ecE",blockCreated:32848}},testnet:!0}),karura=defineChain({id:686,name:"Karura",network:"karura",nativeCurrency:{name:"Karura",symbol:"KAR",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]}},blockExplorers:{default:{name:"Karura Blockscout",url:"https://blockscout.karura.network",apiUrl:"https://blockscout.karura.network/api"}},testnet:!1}),kakarotSepolia=defineChain({id:1802203764,name:"Kakarot Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kakarotStarknetSepolia=defineChain({id:920637907288165,name:"Kakarot Starknet Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kardiaChain=defineChain({id:24,name:"KardiaChain Mainnet",nativeCurrency:{name:"KAI",symbol:"KAI",decimals:18},rpcUrls:{default:{http:["https://rpc.kardiachain.io"]}},blockExplorers:{default:{name:"KardiaChain Explorer",url:"https://explorer.kardiachain.io"}},testnet:!1}),kava=defineChain({id:2222,name:"Kava EVM",network:"kava-mainnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Explorer",url:"https://kavascan.com",apiUrl:"https://kavascan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3661165}},testnet:!1}),kavaTestnet=defineChain({id:2221,name:"Kava EVM Testnet",network:"kava-testnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.testnet.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Testnet Explorer",url:"https://testnet.kavascan.com/",apiUrl:"https://testnet.kavascan.com/api"}},contracts:{multicall3:{address:"0xDf1D724A7166261eEB015418fe8c7679BBEa7fd6",blockCreated:7242179}},testnet:!0}),kcc=defineChain({id:321,name:"KCC Mainnet",network:"KCC Mainnet",nativeCurrency:{decimals:18,name:"KCS",symbol:"KCS"},rpcUrls:{default:{http:["https://kcc-rpc.com"]}},blockExplorers:{default:{name:"KCC Explorer",url:"https://explorer.kcc.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11760430}},testnet:!1}),kinto=defineChain({id:7887,name:"Kinto Mainnet",network:"Kinto Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.kinto.xyz/http"]}},blockExplorers:{default:{name:"Kinto Explorer",url:"https://explorer.kinto.xyz"}},testnet:!1}),klaytn=defineChain({id:8217,name:"Klaytn",nativeCurrency:{decimals:18,name:"Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-cypress.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://scope.klaytn.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kaia=defineChain({id:8217,name:"Kaia",nativeCurrency:{decimals:18,name:"Kaia",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kaiascan.io",apiUrl:"https://api-cypress.klaytnscope.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kairos=defineChain({id:1001,name:"Kairos Testnet",network:"kairos",nativeCurrency:{decimals:18,name:"Kairos KAIA",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en-kairos.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kairos.kaiascan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),klaytnBaobab=defineChain({id:1001,name:"Klaytn Baobab Testnet",network:"klaytn-baobab",nativeCurrency:{decimals:18,name:"Baobab Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-baobab.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),koi=defineChain({id:701,name:"Koi Network",nativeCurrency:{decimals:18,name:"Koi Network Native Token",symbol:"KRING"},rpcUrls:{default:{http:["https://koi-rpc.darwinia.network"],webSocket:["wss://koi-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://koi-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:180001}},testnet:!0}),kroma=defineChain({id:255,name:"Kroma",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.kroma.network"]}},blockExplorers:{default:{name:"Kroma Explorer",url:"https://blockscout.kroma.network",apiUrl:"https://blockscout.kroma.network/api"}},testnet:!1}),kromaSepolia=defineChain({id:2358,name:"Kroma Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.sepolia.kroma.network"]}},blockExplorers:{default:{name:"Kroma Sepolia Explorer",url:"https://blockscout.sepolia.kroma.network",apiUrl:"https://blockscout.sepolia.kroma.network/api"}},testnet:!0}),l3x=defineChain({id:12324,name:"L3X Protocol",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.l3x.com"],webSocket:["wss://rpc-mainnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Mainnet Explorer",url:"https://explorer.l3x.com",apiUrl:"https://explorer.l3x.com/api/v2"}},testnet:!1}),l3xTestnet=defineChain({id:12325,name:"L3X Protocol Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.l3x.com"],webSocket:["wss://rpc-testnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Testnet Explorer",url:"https://explorer-testnet.l3x.com",apiUrl:"https://explorer-testnet.l3x.com/api/v2"}},testnet:!0}),lavita=defineChain({id:360890,name:"LAVITA Mainnet",nativeCurrency:{name:"vTFUEL",symbol:"vTFUEL",decimals:18},rpcUrls:{default:{http:["https://tsub360890-eth-rpc.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"LAVITA Explorer",url:"https://tsub360890-explorer.thetatoken.org"}},testnet:!1}),lightlinkPegasus=defineChain({id:1891,name:"LightLink Pegasus Testnet",network:"lightlink-pegasus",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.pegasus.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Pegasus Explorer",url:"https://pegasus.lightlink.io"}},testnet:!0}),lightlinkPhoenix=defineChain({id:1890,name:"LightLink Phoenix Mainnet",network:"lightlink-phoenix",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.phoenix.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Phoenix Explorer",url:"https://phoenix.lightlink.io"}},testnet:!1});async function estimateGas(Xr,eo){var no,io,oo;const{account:to=Xr.account}=eo;if(!to)throw new AccountNotFoundError;const ro=parseAccount(to);try{const{accessList:ao,blockNumber:so,blockTag:co,data:lo,gas:uo,gasPrice:ho,maxFeePerGas:go,maxPriorityFeePerGas:bo,nonce:wo,to:Eo,value:$o,...Co}=eo,Oo=(so?numberToHex(so):void 0)||co;assertRequest(eo);const jo=(oo=(io=(no=Xr.chain)==null?void 0:no.formatters)==null?void 0:io.transactionRequest)==null?void 0:oo.format,Mo=(jo||formatTransactionRequest)({...extract(Co,{format:jo}),from:ro==null?void 0:ro.address,accessList:ao,data:lo,gas:uo,gasPrice:ho,maxFeePerGas:go,maxPriorityFeePerGas:bo,nonce:wo,to:Eo,value:$o}),{baseFeePerGas:Fo,gasLimit:Wo,priorityFeePerGas:Jo}=await Xr.request({method:"linea_estimateGas",params:Oo?[Mo,Oo]:[Mo]});return{baseFeePerGas:BigInt(Fo),gasLimit:BigInt(Wo),priorityFeePerGas:BigInt(Jo)}}catch(ao){throw getCallError(ao,{...eo,account:ro,chain:Xr.chain})}}const chainConfig={fees:{estimateFeesPerGas,async maxPriorityFeePerGas({block:Xr,client:eo,request:to}){const ro=await estimateFeesPerGas({block:Xr,client:eo,multiply:no=>no,request:to,type:"eip1559"});return ro!=null&&ro.maxPriorityFeePerGas?ro.maxPriorityFeePerGas:null}}};async function estimateFeesPerGas({client:Xr,multiply:eo,request:to,type:ro}){try{const no=await estimateGas(Xr,{...to,account:to==null?void 0:to.account}),{priorityFeePerGas:io}=no,ao=eo(BigInt(no.baseFeePerGas))+io;return ro==="legacy"?{gasPrice:ao}:{maxFeePerGas:ao,maxPriorityFeePerGas:io}}catch{return null}}const linea=defineChain({...chainConfig,id:59144,name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build",apiUrl:"https://api.lineascan.build/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42}},testnet:!1}),lineaGoerli=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://api-goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),lineaSepolia=defineChain({...chainConfig,id:59141,name:"Linea Sepolia Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),lineaTestnet=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),sourceId$q=1,lisk=defineChain({...chainConfig$2,id:1135,name:"Lisk",network:"lisk",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.lisk.com",apiUrl:"https://blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xA9d71E1dd7ca26F26e656E66d6AA81ed7f745bf0"},l2OutputOracle:{[sourceId$q]:{address:"0x113cB99283AF242Da0A0C54347667edF531Aa7d6"}},portal:{[sourceId$q]:{address:"0x26dB93F8b8b4f7016240af62F7730979d353f9A7"}},l1StandardBridge:{[sourceId$q]:{address:"0x2658723Bf70c7667De6B25F99fcce13A16D25d08"}}},sourceId:sourceId$q}),sourceId$p=11155111,liskSepolia=defineChain({...chainConfig$2,id:4202,network:"lisk-sepolia",name:"Lisk Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia-api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.lisk.com",apiUrl:"https://sepolia-blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$p]:{address:"0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$p]:{address:"0xe3d90F21490686Ec7eF37BE788E02dfC12787264"}},l1StandardBridge:{[sourceId$p]:{address:"0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5"}}},testnet:!0,sourceId:sourceId$p}),localhost=defineChain({id:1337,name:"Localhost",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),loop=defineChain({id:15551,name:"LoopNetwork Mainnet",nativeCurrency:{name:"LOOP",symbol:"LOOP",decimals:18},rpcUrls:{default:{http:["https://api.mainnetloop.com"]}},blockExplorers:{default:{name:"LoopNetwork Blockchain Explorer",url:"https://explorer.mainnetloop.com/"}},testnet:!1}),lukso=defineChain({id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network",apiUrl:"https://api.explorer.execution.mainnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:468183}}}),luksoTestnet=defineChain({id:4201,name:"LUKSO Testnet",nativeCurrency:{decimals:18,name:"LUKSO Testnet",symbol:"LYXt"},rpcUrls:{default:{http:["https://rpc.testnet.lukso.network"],webSocket:["wss://ws-rpc.testnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Testnet Explorer",url:"https://explorer.execution.testnet.lukso.network",apiUrl:"https://api.explorer.execution.testnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:605348}},testnet:!0}),lycan=defineChain({id:721,name:"Lycan",nativeCurrency:{decimals:18,name:"Lycan",symbol:"LYC"},rpcUrls:{default:{http:["https://rpc.lycanchain.com","https://us-east.lycanchain.com","https://us-west.lycanchain.com","https://eu-north.lycanchain.com","https://eu-west.lycanchain.com","https://asia-southeast.lycanchain.com"],webSocket:["wss://rpc.lycanchain.com","wss://us-east.lycanchain.com","wss://us-west.lycanchain.com","wss://eu-north.lycanchain.com","wss://eu-west.lycanchain.com","wss://asia-southeast.lycanchain.com"]}},blockExplorers:{default:{name:"Lycan Explorer",url:"https://explorer.lycanchain.com"}}}),lyra=defineChain({id:957,name:"Lyra Chain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.lyra.finance"]}},blockExplorers:{default:{name:"Lyra Explorer",url:"https://explorer.lyra.finance",apiUrl:"https://explorer.lyra.finance/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1935198}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),mandala=defineChain({id:595,name:"Mandala TC9",network:"mandala",nativeCurrency:{name:"Mandala",symbol:"mACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]}},blockExplorers:{default:{name:"Mandala Blockscout",url:"https://blockscout.mandala.aca-staging.network",apiUrl:"https://blockscout.mandala.aca-staging.network/api"}},testnet:!0}),manta=defineChain({id:169,name:"Manta Pacific Mainnet",network:"manta",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.manta.network/http"]}},blockExplorers:{default:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network",apiUrl:"https://pacific-explorer.manta.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:332890}}}),mantaSepoliaTestnet=defineChain({id:3441006,name:"Manta Pacific Sepolia Testnet",network:"manta-sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.sepolia-testnet.manta.network/http"]}},blockExplorers:{default:{name:"Manta Sepolia Testnet Explorer",url:"https://pacific-explorer.sepolia-testnet.manta.network",apiUrl:"https://pacific-explorer.sepolia-testnet.manta.network/api"}},contracts:{multicall3:{address:"0xca54918f7B525C8df894668846506767412b53E3",blockCreated:479584}},testnet:!0}),mantaTestnet=defineChain({id:3441005,name:"Manta Pacific Testnet",network:"manta-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://manta-testnet.calderachain.xyz/http"]}},blockExplorers:{default:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network",apiUrl:"https://pacific-explorer.testnet.manta.network/api"}},contracts:{multicall3:{address:"0x211B1643b95Fe76f11eD8880EE810ABD9A4cf56C",blockCreated:419915}},testnet:!0}),mantle=defineChain({id:5e3,name:"Mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Explorer",url:"https://mantlescan.xyz/",apiUrl:"https://api.mantlescan.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:304717}}}),mantleSepoliaTestnet=defineChain({id:5003,name:"Mantle Sepolia Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.sepolia.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.sepolia.mantle.xyz/",apiUrl:"https://explorer.sepolia.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4584012}},testnet:!0}),mantleTestnet=defineChain({id:5001,name:"Mantle Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz",apiUrl:"https://explorer.testnet.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:561333}},testnet:!0}),mapProtocol=defineChain({id:22776,name:"MAP Protocol",nativeCurrency:{decimals:18,name:"MAPO",symbol:"MAPO"},rpcUrls:{default:{http:["https://rpc.maplabs.io"]}},blockExplorers:{default:{name:"MAPO Scan",url:"https://maposcan.io"}},testnet:!1}),matchain=defineChain({id:698,name:"Matchain",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://matchscan.io"}}}),matchainTestnet=defineChain({id:699,name:"Matchain Testnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://testnet.matchscan.io"}},testnet:!0}),meld=defineChain({id:333000333,name:"Meld",nativeCurrency:{decimals:18,name:"Meld",symbol:"MELD"},rpcUrls:{default:{http:["https://rpc-1.meld.com"]}},blockExplorers:{default:{name:"MELDscan",url:"https://meldscan.io"}},contracts:{multicall3:{address:"0x769ee5a8e82c15c1b6e358f62ac8eb6e3abe8dc5",blockCreated:360069}}}),merlin=defineChain({id:4200,name:"Merlin",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.merlinchain.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://scan.merlinchain.io",apiUrl:"https://scan.merlinchain.io/api"}}}),metachain=defineChain({id:571,name:"MetaChain Mainnet",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://rpc.metatime.com"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://explorer.metatime.com"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}}}),metachainIstanbul=defineChain({id:1453,name:"MetaChain Istanbul",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://istanbul-rpc.metachain.dev"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://istanbul-explorer.metachain.dev"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}},testnet:!0}),sourceId$o=1,metalL2=defineChain({...chainConfig$2,id:1750,name:"Metal L2",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.metall2.com"],webSocket:["wss://rpc.metall2.com"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.metall2.com",apiUrl:"https://explorer.metall2.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$o]:{address:"0x3B1F7aDa0Fcc26B13515af752Dd07fB1CAc11426"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0},portal:{[sourceId$o]:{address:"0x3F37aBdE2C6b5B2ed6F8045787Df1ED1E3753956"}},l1StandardBridge:{[sourceId$o]:{address:"0x6d0f65D59b55B0FEC5d2d15365154DcADC140BF3"}}},sourceId:sourceId$o}),meter=defineChain({id:82,name:"Meter",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpc.meter.io"]}},blockExplorers:{default:{name:"MeterScan",url:"https://scan.meter.io"}}}),meterTestnet=defineChain({id:83,name:"Meter Testnet",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpctest.meter.io"]}},blockExplorers:{default:{name:"MeterTestnetScan",url:"https://scan-warringstakes.meter.io"}}}),metis=defineChain({id:1088,name:"Metis",nativeCurrency:{decimals:18,name:"Metis",symbol:"METIS"},rpcUrls:{default:{http:["https://andromeda.metis.io/?owner=1088"]}},blockExplorers:{default:{name:"Metis Explorer",url:"https://explorer.metis.io",apiUrl:"https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2338552}}}),metisGoerli=defineChain({id:599,name:"Metis Goerli",nativeCurrency:{decimals:18,name:"Metis Goerli",symbol:"METIS"},rpcUrls:{default:{http:["https://goerli.gateway.metisdevops.link"]}},blockExplorers:{default:{name:"Metis Goerli Explorer",url:"https://goerli.explorer.metisdevops.link",apiUrl:"https://goerli.explorer.metisdevops.link/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1006207}}}),mev=defineChain({id:7518,name:"MEVerse Chain Mainnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversemainnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://www.meversescan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:86881340}}}),mevTestnet=defineChain({id:4759,name:"MEVerse Chain Testnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversetestnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.meversescan.io/"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:64371115}},testnet:!0}),mint=defineChain({id:185,name:"Mint Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain explorer",url:"https://explorer.mintchain.io"}},testnet:!1}),mintSepoliaTestnet=defineChain({id:1686,name:"Mint Sepolia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain Testnet explorer",url:"https://testnet-explorer.mintchain.io"}},testnet:!0}),sourceId$n=1,mode$1=defineChain({...chainConfig$2,id:34443,name:"Mode Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.mode.network"]}},blockExplorers:{default:{name:"Modescan",url:"https://modescan.io"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2465882},l2OutputOracle:{[sourceId$n]:{address:"0x4317ba146D4933D889518a3e5E11Fe7a53199b04"}},portal:{[sourceId$n]:{address:"0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07"}},l1StandardBridge:{[sourceId$n]:{address:"0x735aDBbE72226BD52e818E7181953f42E3b0FF21"}}},sourceId:sourceId$n}),sourceId$m=11155111,modeTestnet=defineChain({...chainConfig$2,id:919,name:"Mode Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.mode.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.mode.network",apiUrl:"https://sepolia.explorer.mode.network/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$m]:{address:"0x2634BD65ba27AB63811c74A63118ACb312701Bfa",blockCreated:3778393}},portal:{[sourceId$m]:{address:"0x320e1580effF37E008F1C92700d1eBa47c1B23fD",blockCreated:3778395}},l1StandardBridge:{[sourceId$m]:{address:"0xbC5C679879B2965296756CD959C3C739769995E2",blockCreated:3778392}},multicall3:{address:"0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF",blockCreated:3019007}},testnet:!0,sourceId:sourceId$m}),moonbaseAlpha=defineChain({id:1287,name:"Moonbase Alpha",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonbase.moonscan.io",apiUrl:"https://moonbase.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1850686}},testnet:!0}),moonbeam=defineChain({id:1284,name:"Moonbeam",nativeCurrency:{decimals:18,name:"GLMR",symbol:"GLMR"},rpcUrls:{default:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonscan.io",apiUrl:"https://api-moonbeam.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:609002}},testnet:!1}),moonbeamDev=defineChain({id:1281,name:"Moonbeam Development Node",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]}}}),moonriver=defineChain({id:1285,name:"Moonriver",nativeCurrency:{decimals:18,name:"MOVR",symbol:"MOVR"},rpcUrls:{default:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonriver.moonscan.io",apiUrl:"https://api-moonriver.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1597904}},testnet:!1}),morph=defineChain({id:2818,name:"Morph",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.morphl2.io"],webSocket:["wss://rpc.morphl2.io:8443"]}},blockExplorers:{default:{name:"Morph Explorer",url:"https://explorer.morphl2.io"}},testnet:!1}),morphHolesky=defineChain({id:2810,name:"Morph Holesky",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-quicknode-holesky.morphl2.io"],webSocket:["wss://rpc-quicknode-holesky.morphl2.io"]}},blockExplorers:{default:{name:"Morph Holesky Explorer",url:"https://explorer-holesky.morphl2.io",apiUrl:"https://explorer-api-holesky.morphl2.io/api?"}},testnet:!0}),morphSepolia=defineChain({id:2710,name:"Morph Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.morphl2.io"]}},blockExplorers:{default:{name:"Morph Testnet Explorer",url:"https://explorer-testnet.morphl2.io",apiUrl:"https://explorer-api-testnet.morphl2.io/api"}},testnet:!0}),nautilus=defineChain({id:22222,name:"Nautilus Mainnet",nativeCurrency:{name:"ZBC",symbol:"ZBC",decimals:9},rpcUrls:{default:{http:["https://api.nautilus.nautchain.xyz"]}},blockExplorers:{default:{name:"NautScan",url:"https://nautscan.com"}}}),neonDevnet=defineChain({id:245022926,name:"Neon EVM DevNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://devnet.neonevm.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://devnet.neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:205206112}},testnet:!0}),neonMainnet=defineChain({id:245022934,network:"neonMainnet",name:"Neon EVM MainNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://neon-proxy-mainnet.solana.p2p.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:206545524}},testnet:!1}),nexi=defineChain({id:4242,name:"Nexi",nativeCurrency:{name:"Nexi",symbol:"NEXI",decimals:18},rpcUrls:{default:{http:["https://rpc.chain.nexi.technology"]}},blockExplorers:{default:{name:"NexiScan",url:"https://www.nexiscan.com",apiUrl:"https://www.nexiscan.com/api"}},contracts:{multicall3:{address:"0x0277A46Cc69A57eE3A6C8c158bA874832F718B8E",blockCreated:25770160}}}),nexilix=defineChain({id:240,name:"Nexilix Smart Chain",nativeCurrency:{decimals:18,name:"Nexilix",symbol:"NEXILIX"},rpcUrls:{default:{http:["https://rpcurl.pos.nexilix.com"]}},blockExplorers:{default:{name:"NexilixScan",url:"https://scan.nexilix.com"}},contracts:{multicall3:{address:"0x58381c8e2BF9d0C2C4259cA14BdA9Afe02831244",blockCreated:74448}}}),oasisTestnet=defineChain({id:4090,network:"oasis-testnet",name:"Oasis Testnet",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.oasis.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://oasis.ftnscan.com",apiUrl:"https://oasis.ftnscan.com/api"}},testnet:!0}),oasys=defineChain({id:248,name:"Oasys",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.oasys.games"]}},blockExplorers:{default:{name:"OasysScan",url:"https://scan.oasys.games",apiUrl:"https://scan.oasys.games/api"}}}),odysseyTestnet=defineChain({id:911867,name:"Odyssey Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://odyssey.ithaca.xyz"]}},blockExplorers:{default:{name:"Odyssey Explorer",url:"https://odyssey-explorer.ithaca.xyz",apiUrl:"https://odyssey-explorer.ithaca.xyz/api"}},testnet:!0}),okc=defineChain({id:66,name:"OKC",nativeCurrency:{decimals:18,name:"OKT",symbol:"OKT"},rpcUrls:{default:{http:["https://exchainrpc.okex.org"]}},blockExplorers:{default:{name:"oklink",url:"https://www.oklink.com/okc"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10364792}}}),oortMainnetDev=defineChain({id:9700,name:"OORT MainnetDev",nativeCurrency:{decimals:18,name:"OORT",symbol:"OORT"},rpcUrls:{default:{http:["https://dev-rpc.oortech.com"]}},blockExplorers:{default:{name:"OORT MainnetDev Explorer",url:"https://dev-scan.oortech.com"}}}),sourceId$l=56,opBNB=defineChain({id:204,name:"opBNB",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opBNB (BSCScan)",url:"https://opbnb.bscscan.com",apiUrl:"https://api-opbnb.bscscan.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:512881},l2OutputOracle:{[sourceId$l]:{address:"0x153CAB79f4767E2ff862C94aa49573294B13D169"}},portal:{[sourceId$l]:{address:"0x1876EA7702C0ad0C6A2ae6036DE7733edfBca519"}},l1StandardBridge:{[sourceId$l]:{address:"0xF05F0e4362859c3331Cb9395CBC201E3Fa6757Ea"}}},sourceId:sourceId$l}),sourceId$k=97,opBNBTestnet=defineChain({id:5611,name:"opBNB Testnet",nativeCurrency:{decimals:18,name:"tBNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://opbnb-testnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://testnet.opbnbscan.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3705108},l2OutputOracle:{[sourceId$k]:{address:"0xFf2394Bb843012562f4349C6632a0EcB92fC8810"}},portal:{[sourceId$k]:{address:"0x4386C8ABf2009aC0c263462Da568DD9d46e52a31"}},l1StandardBridge:{[sourceId$k]:{address:"0x677311Fd2cCc511Bbc0f581E8d9a07B033D5E840"}}},testnet:!0,sourceId:sourceId$k}),sourceId$j=1,optimism=defineChain({...chainConfig$2,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$j]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId$j]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId$j]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId$j]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:sourceId$j}),sourceId$i=5,optimismGoerli=defineChain({...chainConfig$2,id:420,name:"Optimism Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io",apiUrl:"https://goerli-optimism.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$i]:{address:"0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461},portal:{[sourceId$i]:{address:"0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383"}},l1StandardBridge:{[sourceId$i]:{address:"0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"}}},testnet:!0,sourceId:sourceId$i}),sourceId$h=11155111,optimismSepolia=defineChain({...chainConfig$2,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$h]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[sourceId$h]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[sourceId$h]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[sourceId$h]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:sourceId$h}),optopia=defineChain({id:62050,name:"Optopia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan.optopia.ai"}},testnet:!1}),optopiaTestnet=defineChain({id:62049,name:"Optopia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan-testnet.optopia.ai"}},testnet:!0}),orderly=defineChain({id:291,name:"Orderly",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.orderly.network"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorer.orderly.network"}},testnet:!1}),orderlySepolia=defineChain({id:4460,name:"Orderly Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://l2-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorerl2new-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"}},testnet:!0}),otimDevnet=defineChain({id:41144114,name:"Otim Devnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["http://devnet.otim.xyz"]}},contracts:{batchInvoker:{address:"0x5FbDB2315678afecb367f032d93F642f64180aa3"}}}),palm=defineChain({id:11297108109,name:"Palm",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}}}),palmTestnet=defineChain({id:11297108099,name:"Palm Testnet",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}},testnet:!0}),sourceId$g=1,pgn=defineChain({id:424,network:"pgn",name:"PGN",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Explorer",url:"https://explorer.publicgoods.network",apiUrl:"https://explorer.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$g]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3380209},portal:{[sourceId$g]:{address:"0xb26Fd985c5959bBB382BAFdD0b879E149e48116c"}},l1StandardBridge:{[sourceId$g]:{address:"0xD0204B9527C1bA7bD765Fa5CCD9355d38338272b"}}},formatters:formatters$1,sourceId:sourceId$g}),sourceId$f=11155111,pgnTestnet=defineChain({id:58008,network:"pgn-testnet",name:"PGN ",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network",apiUrl:"https://explorer.sepolia.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$f]:{address:"0xD5bAc3152ffC25318F848B3DD5dA6C85171BaEEe"}},portal:{[sourceId$f]:{address:"0xF04BdD5353Bb0EFF6CA60CfcC78594278eBfE179"}},l1StandardBridge:{[sourceId$f]:{address:"0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3754925}},formatters:formatters$1,sourceId:sourceId$f,testnet:!0}),phoenix=defineChain({id:13381,name:"Phoenix Blockchain",nativeCurrency:{name:"Phoenix",symbol:"PHX",decimals:18},rpcUrls:{default:{http:["https://rpc.phoenixplorer.com"]}},blockExplorers:{default:{name:"Phoenixplorer",url:"https://phoenixplorer.com",apiUrl:"https://phoenixplorer.com/api"}},contracts:{multicall3:{address:"0x498cF757a575cFF2c2Ed9f532f56Efa797f86442",blockCreated:5620192}}}),playfiAlbireo=defineChain({...chainConfig$3,id:1612127,name:"PlayFi Albireo Testnet",network:"albireo",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://albireo-rpc.playfi.ai"],webSocket:["wss://albireo-rpc-ws.playfi.ai/ws"]}},blockExplorers:{default:{name:"PlayFi Albireo Explorer",url:"https://albireo-explorer.playfi.ai"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0}),plinga=defineChain({id:242,name:"Plinga",nativeCurrency:{name:"Plinga",symbol:"PLINGA",decimals:18},rpcUrls:{default:{http:["https://rpcurl.mainnet.plgchain.com"]}},blockExplorers:{default:{name:"Plgscan",url:"https://www.plgscan.com"}},contracts:{multicall3:{address:"0x0989576160f2e7092908BB9479631b901060b6e4",blockCreated:204489}}}),sourceId$e=11155111,plumeTestnet=defineChain({id:161221135,name:"Plume Testnet",nativeCurrency:{name:"Plume Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.plumenetwork.xyz/http"],webSocket:["wss://testnet-rpc.plumenetwork.xyz/ws"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.plumenetwork.xyz",apiUrl:"https://testnet-explorer.plumenetwork.xyz/api"}},testnet:!0,sourceId:sourceId$e}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),polygonAmoy=defineChain({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api-amoy.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0}),polygonMumbai=defineChain({id:80001,name:"Polygon Mumbai",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/polygon_mumbai"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com",apiUrl:"https://api-testnet.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}},testnet:!0}),polygonZkEvm=defineChain({id:1101,name:"Polygon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://zkevm.polygonscan.com",apiUrl:"https://api-zkevm.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:57746}}}),polygonZkEvmCardona=defineChain({id:2442,name:"Polygon zkEVM Cardona",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://cardona-zkevm.polygonscan.com",apiUrl:"https://cardona-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:114091}}}),polygonZkEvmTestnet=defineChain({id:1442,name:"Polygon zkEVM Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com",apiUrl:"https://testnet-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),pulsechain=defineChain({id:369,name:"PulseChain",nativeCurrency:{name:"Pulse",symbol:"PLS",decimals:18},testnet:!1,rpcUrls:{default:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.pulsechain.com",apiUrl:"https://api.scan.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),pulsechainV4=defineChain({id:943,name:"PulseChain V4",testnet:!0,nativeCurrency:{name:"V4 Pulse",symbol:"v4PLS",decimals:18},rpcUrls:{default:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.v4.testnet.pulsechain.com",apiUrl:"https://scan.v4.testnet.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),ql1=defineChain({id:766,name:"QL1",nativeCurrency:{decimals:18,name:"QOM",symbol:"QOM"},rpcUrls:{default:{http:["https://rpc.qom.one"]}},blockExplorers:{default:{name:"Ql1 Explorer",url:"https://scan.qom.one"}},contracts:{multicall3:{address:"0x7A52370716ea730585884F5BDB0f6E60C39b8C64"}},testnet:!1}),qMainnet=defineChain({id:35441,name:"Q Mainnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.q.org"]}},blockExplorers:{default:{name:"Q Mainnet Explorer",url:"https://explorer.q.org",apiUrl:"https://explorer.q.org/api"}}}),qTestnet=defineChain({id:35443,name:"Q Testnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.qtestnet.org"]}},blockExplorers:{default:{name:"Q Testnet Explorer",url:"https://explorer.qtestnet.org",apiUrl:"https://explorer.qtestnet.org/api"}},testnet:!0}),real=defineChain({id:111188,name:"re.al",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://real.drpc.org"]}},blockExplorers:{default:{name:"re.al Explorer",url:"https://explorer.re.al",apiUrl:"https://explorer.re.al/api/v2"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:695}}}),redbellyTestnet=defineChain({id:153,name:"Redbelly Network Testnet",nativeCurrency:{name:"Redbelly Native Coin",symbol:"RBNT",decimals:18},rpcUrls:{default:{http:["https://governors.testnet.redbelly.network"]}},blockExplorers:{default:{name:"Ethernal",url:"https://explorer.testnet.redbelly.network",apiUrl:"https://ethernal.fly.dev/api"}},testnet:!0}),sourceId$d=1,redstone=defineChain({...chainConfig$2,name:"Redstone",id:690,sourceId:sourceId$d,nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.redstonechain.com"],webSocket:["wss://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$d]:{address:"0xC7bCb0e8839a28A1cFadd1CF716de9016CdA51ae",blockCreated:19578329}},l2OutputOracle:{[sourceId$d]:{address:"0xa426A052f657AEEefc298b3B5c35a470e4739d69",blockCreated:19578337}},l1StandardBridge:{[sourceId$d]:{address:"0xc473ca7E02af24c129c2eEf51F2aDf0411c1Df69",blockCreated:19578331}}}}),reyaNetwork=defineChain({id:1729,name:"Reya Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.reya.network"],webSocket:["wss://ws.reya.network"]}},blockExplorers:{default:{name:"Reya Network Explorer",url:"https://explorer.reya.network"}},testnet:!1}),rollux=defineChain({id:570,name:"Rollux Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.rollux.com"],webSocket:["wss://rpc.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxExplorer",url:"https://explorer.rollux.com",apiUrl:"https://explorer.rollux.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:119222}}}),rolluxTestnet=defineChain({id:57e3,name:"Rollux Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc-tanenbaum.rollux.com/"],webSocket:["wss://rpc-tanenbaum.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxTestnetExplorer",url:"https://rollux.tanenbaum.io",apiUrl:"https://rollux.tanenbaum.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1813675}}}),ronin=defineChain({id:2020,name:"Ronin",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://api.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Ronin Explorer",url:"https://app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:26023535}}}),root$c=defineChain({id:7668,name:"The Root Network",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://root.rootnet.live/archive"],webSocket:["wss://root.rootnet.live/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:9218338}}}),rootPorcini=defineChain({id:7672,name:"The Root Network - Porcini",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://porcini.rootnet.app/archive"],webSocket:["wss://porcini.rootnet.app/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://porcini.rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:10555692}},testnet:!0}),rootstock=defineChain({id:30,name:"Rootstock Mainnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"RBTC"},rpcUrls:{default:{http:["https://public-node.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.rsk.co"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4249540}}}),rootstockTestnet=defineChain({id:31,name:"Rootstock Testnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"tRBTC"},rpcUrls:{default:{http:["https://public-node.testnet.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.testnet.rootstock.io"}},testnet:!0}),sourceId$c=1,rss3=defineChain({...chainConfig$2,id:12553,name:"RSS3 VSL Mainnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Mainnet Scan",url:"https://scan.rss3.io",apiUrl:"https://scan.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$c]:{address:"0xE6f24d2C32B3109B18ed33cF08eFb490b1e09C10"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14193},portal:{[sourceId$c]:{address:"0x6A12432491bbbE8d3babf75F759766774C778Db4",blockCreated:19387057}},l1StandardBridge:{[sourceId$c]:{address:"0x4cbab69108Aa72151EDa5A3c164eA86845f18438"}}},sourceId:sourceId$c}),sourceId$b=11155111,rss3Sepolia=defineChain({...chainConfig$2,id:2331,name:"RSS3 VSL Sepolia Testnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Sepolia Testnet Scan",url:"https://scan.testnet.rss3.io",apiUrl:"https://scan.testnet.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$b]:{address:"0xDb5c46C3Eaa6Ed6aE8b2379785DF7dd029C0dC81"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:55697},portal:{[sourceId$b]:{address:"0xcBD77E8E1E7F06B25baDe67142cdE82652Da7b57",blockCreated:5345035}},l1StandardBridge:{[sourceId$b]:{address:"0xdDD29bb63B0839FB1cE0eE439Ff027738595D07B"}}},testnet:!0,sourceId:sourceId$b}),saakuru=defineChain({id:7225878,name:"Saakuru Mainnet",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.saakuru.network"]}},blockExplorers:{default:{name:"Saakuru Explorer",url:"https://explorer.saakuru.network"}},testnet:!1}),saigon=defineChain({id:2021,name:"Saigon Testnet",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://saigon-testnet.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Saigon Explorer",url:"https://saigon-app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18736871}},testnet:!0}),sanko=defineChain({id:1996,name:"Sanko",nativeCurrency:{name:"DMT",symbol:"DMT",decimals:18},rpcUrls:{default:{http:["https://mainnet.sanko.xyz"]}},blockExplorers:{default:{name:"Sanko Explorer",url:"https://explorer.sanko.xyz"}},testnet:!1}),sapphire=defineChain({id:23294,name:"Oasis Sapphire",network:"sapphire",nativeCurrency:{name:"Sapphire Rose",symbol:"ROSE",decimals:18},rpcUrls:{default:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/mainnet/sapphire"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:734531}}}),sapphireTestnet=defineChain({id:23295,name:"Oasis Sapphire Testnet",network:"sapphire-testnet",nativeCurrency:{name:"Sapphire Test Rose",symbol:"TEST",decimals:18},rpcUrls:{default:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/testnet/sapphire"}},testnet:!0}),satoshiVM=defineChain({id:3109,name:"SatoshiVM Alpha Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://alpha-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://svmscan.io",apiUrl:"https://svmscan.io/api"}}}),satoshiVMTestnet=defineChain({id:3110,name:"SatoshiVM Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://test-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet.svmscan.io",apiUrl:"https://testnet.svmscan.io/api"}},testnet:!0}),scroll=defineChain({id:534352,name:"Scroll",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://scrollscan.com",apiUrl:"https://api.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14}},testnet:!1}),scrollSepolia=defineChain({id:534351,name:"Scroll Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://sepolia.scrollscan.com",apiUrl:"https://api-sepolia.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),sei=defineChain({id:1329,name:"Sei Network",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc.sei-apis.com/"],webSocket:["wss://evm-ws.sei-apis.com/"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com",apiUrl:"https://seitrace.com/pacific-1/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}}}),seiDevnet=defineChain({id:713715,name:"Sei Devnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-arctic-1.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),seiTestnet=defineChain({id:1328,name:"Sei Testnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-testnet.sei-apis.com"],webSocket:["wss://evm-ws-testnet.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),sepolia=defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.drpc.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),sourceId$a=1,shape=defineChain({...chainConfig$2,id:360,name:"Shape",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.shape.network"]}},blockExplorers:{default:{name:"shapescan",url:"https://shapescan.xyz",apiUrl:"https://shapescan.xyz/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$a]:{address:"0x6Ef8c69CfE4635d866e3E02732068022c06e724D",blockCreated:20369940}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1},portal:{[sourceId$a]:{address:"0xEB06fFa16011B5628BaB98E29776361c83741dd3",blockCreated:20369933}},l1StandardBridge:{[sourceId$a]:{address:"0x62Edd5f4930Ea92dCa3fB81689bDD9b9d076b57B",blockCreated:20369935}}},sourceId:sourceId$a}),sourceId$9=11155111,shapeSepolia=defineChain({...chainConfig$2,id:11011,name:"Shape Sepolia Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.shape.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer-sepolia.shape.network/",apiUrl:"https://explorer-sepolia.shape.network/api/v2"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1}},testnet:!0,sourceId:sourceId$9}),shardeumSphinx=defineChain({id:8082,name:"Shardeum Sphinx",nativeCurrency:{name:"SHARDEUM",symbol:"SHM",decimals:18},rpcUrls:{default:{http:["https://sphinx.shardeum.org"]}},blockExplorers:{default:{name:"Shardeum Explorer",url:"https://explorer-sphinx.shardeum.org"}},testnet:!0}),shibarium=defineChain({id:109,name:"Shibarium",network:"shibarium",nativeCurrency:{name:"Bone",symbol:"BONE",decimals:18},rpcUrls:{default:{http:["https://rpc.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://shibariumscan.io"}},contracts:{multicall3:{address:"0x864Bf681ADD6052395188A89101A1B37d3B4C961",blockCreated:265900}}}),shibariumTestnet=defineChain({id:157,name:"Puppynet Shibarium",nativeCurrency:{decimals:18,name:"Bone",symbol:"BONE"},rpcUrls:{default:{http:["https://puppynet.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://puppyscan.shib.io",apiUrl:"https://puppyscan.shib.io/api"}},contracts:{multicall3:{address:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",blockCreated:3035769}},testnet:!0}),shiden=defineChain({id:336,name:"Shiden",nativeCurrency:{decimals:18,name:"SDN",symbol:"SDN"},rpcUrls:{default:{http:["https://shiden.public.blastapi.io"],webSocket:["wss://shiden-rpc.dwellir.com"]}},blockExplorers:{default:{name:"Shiden Scan",url:"https://shiden.subscan.io"}},testnet:!1}),shimmer=defineChain({id:148,name:"Shimmer",network:"shimmer",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.shimmer.network",apiUrl:"https://explorer.evm.shimmer.network/api"}}}),shimmerTestnet=defineChain({id:1073,name:"Shimmer Testnet",network:"shimmer-testnet",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.testnet.shimmer.network",apiUrl:"https://explorer.evm.testnet.shimmer.network/api"}},testnet:!0}),silicon=defineChain({id:2355,name:"Silicon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.silicon.network","https://silicon-mainnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconScope",url:"https://scope.silicon.network"}}}),siliconSepolia=defineChain({id:1722641160,name:"Silicon Sepolia zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-sepolia.silicon.network","https://silicon-testnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconSepoliaScope",url:"https://scope-sepolia.silicon.network"}},testnet:!0}),skaleBlockBrawlers=defineChain({id:391845894,name:"SKALE | Block Brawlers",nativeCurrency:{name:"BRAWL",symbol:"BRAWL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCalypso=defineChain({id:1564830818,name:"SKALE | Calypso NFT Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3107626}}}),skaleCalypsoTestnet=defineChain({id:974399131,name:"SKALE Calypso Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/giant-half-dual-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/giant-half-dual-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://giant-half-dual-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:103220}},testnet:!0}),skaleCryptoBlades=defineChain({id:1026062157,name:"SKALE | CryptoBlades",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCryptoColosseum=defineChain({id:1032942172,name:"SKALE | Crypto Colosseum",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleEuropa=defineChain({id:2046399126,name:"SKALE | Europa Liquidity Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3113495}}}),skaleEuropaTestnet=defineChain({id:1444673419,name:"SKALE Europa Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/juicy-low-small-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/juicy-low-small-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://juicy-low-small-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:110858}},testnet:!0}),skaleExorde=defineChain({id:2139927552,name:"SKALE | Exorde",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleHumanProtocol=defineChain({id:1273227453,name:"SKALE | Human Protocol",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleNebula=defineChain({id:1482601649,name:"SKALE | Nebula Gaming Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2372986}}}),skaleNebulaTestnet=defineChain({id:37084624,name:"SKALE Nebula Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/lanky-ill-funny-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/lanky-ill-funny-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:105141}},testnet:!0}),skaleRazor=defineChain({id:278611351,name:"SKALE | Razor Network",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleTitan=defineChain({id:1350216234,name:"SKALE | Titan Community Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2076458}}}),skaleTitanTestnet=defineChain({id:1020352220,name:"SKALE Titan Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/aware-fake-trim-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/aware-fake-trim-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://aware-fake-trim-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:104072}},testnet:!0}),sketchpad=defineChain({id:984123,name:"Forma Sketchpad",network:"sketchpad",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.sketchpad-1.forma.art"],webSocket:["wss://ws.sketchpad-1.forma.art"]}},blockExplorers:{default:{name:"Sketchpad Explorer",url:"https://explorer.sketchpad-1.forma.art"}},testnet:!0}),sourceId$8=1,snax=defineChain({...chainConfig$2,id:2192,network:"snaxchain-mainnet",name:"SnaxChain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://explorer.snaxchain.io",apiUrl:"https://explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$8]:{address:"0x472562Fcf26D6b2793f8E0b0fB660ba0E5e08A46"}},l2OutputOracle:{[sourceId$8]:{address:"0x2172e492Fc807F5d5645D0E3543f139ECF539294"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$8]:{address:"0x79f446D024d74D0Bb6E699C131c703463c5D65E9"}},l1StandardBridge:{[sourceId$8]:{address:"0x6534Bdb6b5c060d3e6aa833433333135eFE8E0aA"}}},sourceId:sourceId$8}),sourceId$7=11155111,snaxTestnet=defineChain({...chainConfig$2,id:13001,network:"snaxchain-testnet",name:"SnaxChain Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://testnet-explorer.snaxchain.io",apiUrl:"https://testnet-explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$7]:{address:"0x206a75d89d45F146C54020F132FF93bEDD09f55E"}},l2OutputOracle:{[sourceId$7]:{address:"0x60e3A368a4cdCEf85ffB964e372726F56A46221e"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$7]:{address:"0xb5afdd0E8dDF081Ef90e8A3e0c7b5798e66E954E"}},l1StandardBridge:{[sourceId$7]:{address:"0xbd37E1a59D4C00C9A46F75018dffd84061bC5f74"}}},testnet:!0,sourceId:sourceId$7}),sourceId$6=11155111,soneiumMinato=defineChain({...chainConfig$2,id:1946,name:"Soneium Minato Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.minato.soneium.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://soneium-minato.blockscout.com",apiUrl:"https://soneium-minato.blockscout.com/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$6]:{address:"0xB3Ad2c38E6e0640d7ce6aA952AB3A60E81bf7a01"}},l2OutputOracle:{[sourceId$6]:{address:"0x710e5286C746eC38beeB7538d0146f60D27be343"}},portal:{[sourceId$6]:{address:"0x65ea1489741A5D72fFdD8e6485B216bBdcC15Af3",blockCreated:6466136}},l1StandardBridge:{[sourceId$6]:{address:"0x5f5a404A5edabcDD80DB05E8e54A78c9EBF000C2",blockCreated:6466136}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1}},testnet:!0,sourceId:sourceId$6}),songbird=defineChain({id:19,name:"Songbird Canary-Network",nativeCurrency:{decimals:18,name:"Songbird",symbol:"SGB"},rpcUrls:{default:{http:["https://songbird-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Songbird Explorer",url:"https://songbird-explorer.flare.network",apiUrl:"https://songbird-explorer.flare.network/api"}}}),songbirdTestnet=defineChain({id:16,name:"Songbird Testnet Coston",nativeCurrency:{decimals:18,name:"Coston Flare",symbol:"CFLR"},rpcUrls:{default:{http:["https://coston-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston Explorer",url:"https://coston-explorer.flare.network",apiUrl:"https://coston-explorer.flare.network/api"}},testnet:!0}),sophonTestnet=defineChain({...chainConfig$3,id:531050104,name:"Sophon Testnet",nativeCurrency:{decimals:18,name:"Sophon",symbol:"SOPH"},rpcUrls:{default:{http:["https://rpc.testnet.sophon.xyz"],webSocket:["wss://rpc.testnet.sophon.xyz/ws"]}},blockExplorers:{default:{name:"Sophon Block Explorer",url:"https://explorer.testnet.sophon.xyz"}},contracts:{multicall3:{address:"0x83c04d112adedA2C6D9037bb6ecb42E7f0b108Af",blockCreated:15642}},testnet:!0}),spicy=defineChain({id:88882,name:"Chiliz Spicy Testnet",network:"chiliz-spicy-Testnet",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy-rpc.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"http://spicy-explorer.chiliz.com",apiUrl:"http://spicy-explorer.chiliz.com/api"}},testnet:!0}),step=defineChain({id:1234,name:"Step Network",nativeCurrency:{name:"FITFI",symbol:"FITFI",decimals:18},rpcUrls:{default:{http:["https://rpc.step.network"]}},blockExplorers:{default:{name:"Step Scan",url:"https://stepscan.io"}},testnet:!1}),storyTestnet=defineChain({id:1513,name:"Story Testnet",nativeCurrency:{decimals:18,name:"IP",symbol:"IP"},rpcUrls:{default:{http:["https://testnet.storyrpc.io"]}},blockExplorers:{default:{name:"Story Testnet Explorer",url:"https://testnet.storyscan.xyz"}},testnet:!0}),stratis=defineChain({id:105105,name:"Stratis Mainnet",network:"stratis",nativeCurrency:{name:"Stratis",symbol:"STRAX",decimals:18},rpcUrls:{default:{http:["https://rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Stratis Explorer",url:"https://explorer.stratisevm.com"}}}),superlumio=defineChain({id:8866,name:"SuperLumio",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.lumio.io"]}},blockExplorers:{default:{name:"Lumio explorer",url:"https://explorer.lumio.io"}},testnet:!1}),superposition=defineChain({id:55244,name:"Superposition",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.superposition.so"]}},blockExplorers:{default:{name:"Superposition Explorer",url:"https://explorer.superposition.so"}},testnet:!1}),swan=defineChain({id:254,name:"Swan Chain Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.swanchain.org"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://swanscan.io"}},testnet:!1}),swanProximaTestnet=defineChain({id:20241133,name:"Swan Proxima Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://rpc-proxima.swanchain.io "]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://proxima-explorer.swanchain.io"}},testnet:!0}),swanSaturnTestnet=defineChain({id:2024,name:"Swan Saturn Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://saturn-rpc.swanchain.io"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://saturn-explorer.swanchain.io"}},testnet:!0}),syscoin=defineChain({id:57,name:"Syscoin Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]}},blockExplorers:{default:{name:"SyscoinExplorer",url:"https://explorer.syscoin.org",apiUrl:"https://explorer.syscoin.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:287139}}}),syscoinTestnet=defineChain({id:5700,name:"Syscoin Tanenbaum Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]}},blockExplorers:{default:{name:"SyscoinTestnetExplorer",url:"https://tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:271288}}}),taiko=defineChain({id:167e3,name:"Taiko Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.mainnet.taiko.xyz"],webSocket:["wss://ws.mainnet.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://taikoscan.io",apiUrl:"https://api.taikoscan.io/api"}},contracts:{multicall3:{address:"0xcb2436774C3e191c85056d248EF4260ce5f27A9D"}}}),taikoHekla=defineChain({id:167009,name:"Taiko Hekla L2",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.hekla.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://hekla.taikoscan.network"}},testnet:!0}),taikoJolnir=defineChain({id:167007,name:"Taiko Jolnir (Alpha-5 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.jolnir.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.jolnir.taiko.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:732706}},testnet:!0}),taikoKatla=defineChain({id:167008,name:"Taiko Katla (Alpha-6 Testnet)",network:"tko-katla",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.katla.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.katla.taiko.xyz"}}}),taikoTestnetSepolia=defineChain({id:167005,name:"Taiko (Alpha-3 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.test.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.test.taiko.xyz"}}}),taraxa=defineChain({id:841,name:"Taraxa Mainnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.mainnet.taraxa.io"}}}),taraxaTestnet=defineChain({id:842,name:"Taraxa Testnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.testnet.taraxa.io"}},testnet:!0}),telcoinTestnet=defineChain({id:2017,name:"Telcoin Adiri Testnet",nativeCurrency:{name:"Telcoin",symbol:"TEL",decimals:18},rpcUrls:{default:{http:["https://rpc.telcoin.network"]}},blockExplorers:{default:{name:"telscan",url:"https://telscan.io"}},testnet:!0}),telos=defineChain({id:40,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://mainnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan",url:"https://www.teloscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:246530709}}}),telosTestnet=defineChain({id:41,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://testnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan (testnet)",url:"https://testnet.teloscan.io/"}},testnet:!0}),tenet=defineChain({id:1559,name:"Tenet",network:"tenet-mainnet",nativeCurrency:{name:"TENET",symbol:"TENET",decimals:18},rpcUrls:{default:{http:["https://rpc.tenet.org"]}},blockExplorers:{default:{name:"TenetScan Mainnet",url:"https://tenetscan.io",apiUrl:"https://tenetscan.io/api"}},testnet:!1}),thaiChain=defineChain({id:7,name:"ThaiChain",nativeCurrency:{name:"TCH",symbol:"TCH",decimals:18},rpcUrls:{default:{http:["https://rpc.thaichain.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.thaichain.org",apiUrl:"https://exp.thaichain.org/api"}},contracts:{multicall3:{address:"0x0DaD6130e832c21719C5CE3bae93454E16A84826",blockCreated:4806386}},testnet:!1}),that=defineChain({id:8428,name:"THAT Mainnet",nativeCurrency:{name:"THAT",symbol:"THAT",decimals:18},rpcUrls:{default:{http:["https://api.thatchain.io/mainnet"]}},blockExplorers:{default:{name:"Blockscout",url:"https://that.blockscout.com"}},testnet:!1}),theta$1=defineChain({id:361,name:"Theta Mainnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://explorer.thetatoken.org"}},testnet:!1}),thetaTestnet=defineChain({id:365,name:"Theta Testnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api-testnet.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://testnet-explorer.thetatoken.org"}},testnet:!0}),thunderCore=defineChain({id:108,name:"ThunderCore Mainnet",nativeCurrency:{name:"TT",symbol:"TT",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.thundercore.com"]}},blockExplorers:{default:{name:"ThunderCore Explorer",url:"https://viewblock.io/thundercore"}},testnet:!1}),thunderTestnet=defineChain({id:997,name:"5ireChain Thunder Testnet",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Explorer",url:"https://explorer.5ire.network"}},testnet:!0}),tiktrixTestnet=defineChain({id:62092,name:"TikTrix Testnet",nativeCurrency:{name:"tTTX",symbol:"tTTX",decimals:18},rpcUrls:{default:{http:["https://tiktrix-rpc.xyz"]}},blockExplorers:{default:{name:"TikTrix Testnet Explorer",url:"https://tiktrix.xyz"}},testnet:!0}),tomb=defineChain({id:6969,name:"Tomb Mainnet",nativeCurrency:{name:"TOMB",symbol:"TOMB",decimals:18},rpcUrls:{default:{http:["https://rpc.tombchain.com"]}},blockExplorers:{default:{name:"Tomb Explorer",url:"https://tombscout.com"}},testnet:!1}),tron=defineChain({id:728126428,name:"Tron",nativeCurrency:{name:"TRON",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://api.trongrid.io/jsonrpc"]}},blockExplorers:{default:{name:"Tronscan",url:"https://tronscan.org",apiUrl:"https://apilist.tronscanapi.com/api"}}}),ultron=defineChain({id:1231,name:"Ultron Mainnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-rpc.net"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://ulxscan.com"}},testnet:!1}),ultronTestnet=defineChain({id:1230,name:"Ultron Testnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-dev.io"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://explorer.ultron-dev.io"}},testnet:!0}),sourceId$5=11155111,unichainSepolia=defineChain({...chainConfig$2,id:1301,name:"Unichain Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.unichain.org"]}},blockExplorers:{default:{name:"Uniscan",url:"https://sepolia.uniscan.xyz",apiUrl:"https://api-sepolia.uniscan.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},portal:{[sourceId$5]:{address:"0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD"}},l1StandardBridge:{[sourceId$5]:{address:"0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2"}},disputeGameFactory:{[sourceId$5]:{address:"0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b"}}},testnet:!0,sourceId:sourceId$5}),unique=defineChain({id:8880,name:"Unique Mainnet",nativeCurrency:{decimals:18,name:"UNQ",symbol:"UNQ"},rpcUrls:{default:{http:["https://rpc.unique.network"]}},blockExplorers:{default:{name:"Unique Subscan",url:"https://unique.subscan.io/"}}}),uniqueOpal=defineChain({id:8882,name:"Opal Testnet",nativeCurrency:{decimals:18,name:"OPL",symbol:"OPL"},rpcUrls:{default:{http:["https://rpc-opal.unique.network"]}},blockExplorers:{default:{name:"Opal Subscan",url:"https://opal.subscan.io/"}},testnet:!0}),uniqueQuartz=defineChain({id:8881,name:"Quartz Mainnet",nativeCurrency:{decimals:18,name:"QTZ",symbol:"QTZ"},rpcUrls:{default:{http:["https://rpc-quartz.unique.network"]}},blockExplorers:{default:{name:"Quartz Subscan",url:"https://quartz.subscan.io/"}}}),unreal=defineChain({id:18233,name:"Unreal",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://rpc.unreal-orbit.gelato.digital"]}},blockExplorers:{default:{name:"Unreal Explorer",url:"https://unreal.blockscout.com",apiUrl:"https://unreal.blockscout.com/api/v2"}},testnet:!0,contracts:{multicall3:{address:"0x8b6B0e60D8CD84898Ea8b981065A12F876eA5677",blockCreated:1745}}}),vechain=defineChain({id:100009,name:"Vechain",nativeCurrency:{name:"VeChain",symbol:"VET",decimals:18},rpcUrls:{default:{http:["https://mainnet.vechain.org"]}},blockExplorers:{default:{name:"Vechain Explorer",url:"https://explore.vechain.org"},vechainStats:{name:"Vechain Stats",url:"https://vechainstats.com"}}}),velas=defineChain({id:106,name:"Velas EVM Mainnet",nativeCurrency:{name:"VLX",symbol:"VLX",decimals:18},rpcUrls:{default:{http:["https://evmexplorer.velas.com/rpc"]}},blockExplorers:{default:{name:"Velas Explorer",url:"https://evmexplorer.velas.com"}},testnet:!1}),viction=defineChain({id:88,name:"Viction",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://vicscan.xyz"}},testnet:!1}),victionTestnet=defineChain({id:89,name:"Viction Testnet",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://testnet.vicscan.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:12170179}},testnet:!0}),vision=defineChain({id:888888,name:"Vision",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org"}},testnet:!1}),visionTestnet=defineChain({id:666666,name:"Vision Testnet",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://vpioneer.infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org/?chain=vpioneer"}},testnet:!0}),wanchain=defineChain({id:888,name:"Wanchain",nativeCurrency:{name:"WANCHAIN",symbol:"WAN",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]}},blockExplorers:{default:{name:"WanScan",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0xcDF6A1566e78EB4594c86Fe73Fcdc82429e97fbB",blockCreated:25312390}}}),wanchainTestnet=defineChain({id:999,name:"Wanchain Testnet",nativeCurrency:{name:"WANCHAIN",symbol:"WANt",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:46891"]}},blockExplorers:{default:{name:"WanScanTest",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0x11c89bF4496c39FB80535Ffb4c92715839CC5324",blockCreated:24743448}},testnet:!0}),weaveVMAlphanet=defineChain({id:9496,name:"WeaveVM Alphanet",nativeCurrency:{name:"Testnet WeaveVM",symbol:"tWVM",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.wvm.dev"]}},blockExplorers:{default:{name:"WeaveVM Alphanet Explorer",url:"https://explorer.wvm.dev"}},testnet:!0}),wemix=defineChain({id:1111,name:"WEMIX",network:"wemix-mainnet",nativeCurrency:{name:"WEMIX",symbol:"WEMIX",decimals:18},rpcUrls:{default:{http:["https://api.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://explorer.wemix.com"}}}),wemixTestnet=defineChain({id:1112,name:"WEMIX Testnet",network:"wemix-testnet",nativeCurrency:{name:"WEMIX",symbol:"tWEMIX",decimals:18},rpcUrls:{default:{http:["https://api.test.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://testnet.wemixscan.com",apiUrl:"https://testnet.wemixscan.com/api"}},testnet:!0}),sourceId$4=1,worldchain=defineChain({...chainConfig$2,id:480,name:"World Chain",network:"worldchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-mainnet.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan",url:"https://worldscan.org",apiUrl:"https://api.worldscan.org/api"},blockscout:{name:"Blockscout",url:"https://worldchain-mainnet.explorer.alchemy.com",apiUrl:"https://worldchain-mainnet.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$4]:{address:"0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52"}},l2OutputOracle:{[sourceId$4]:{address:"0x19A6d1E9034596196295CF148509796978343c5D"}},portal:{[sourceId$4]:{address:"0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C"}},l1StandardBridge:{[sourceId$4]:{address:"0x470458C91978D2d929704489Ad730DC3E3001113"}}},testnet:!1,sourceId:sourceId$4}),sourceId$3=11155111,worldchainSepolia=defineChain({...chainConfig$2,id:4801,name:"World Chain Sepolia",network:"worldchain-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-sepolia.g.alchemy.com/public"]},public:{http:["https://worldchain-sepolia.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan Sepolia",url:"https://sepolia.worldscan.org"},blockscout:{name:"Blockscout",url:"https://worldchain-sepolia.explorer.alchemy.com",apiUrl:"https://worldchain-sepolia.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$3]:{address:"0x8cF97Ee616C986a070F5020d973b456D0120C253"}},l2OutputOracle:{[sourceId$3]:{address:"0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e"}},portal:{[sourceId$3]:{address:"0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4"}},l1StandardBridge:{[sourceId$3]:{address:"0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE"}}},testnet:!0,sourceId:sourceId$3}),xai=defineChain({id:660279,name:"Xai Mainnet",nativeCurrency:{name:"Xai",symbol:"XAI",decimals:18},rpcUrls:{default:{http:["https://xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.xai-chain.net"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:222549}},testnet:!1}),xaiTestnet=defineChain({id:37714555429,name:"Xai Testnet",nativeCurrency:{name:"sXai",symbol:"sXAI",decimals:18},rpcUrls:{default:{http:["https://testnet-v2.xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer-v2.xai-chain.net"}},testnet:!0}),xdc=defineChain({id:50,name:"XinFin Network",nativeCurrency:{decimals:18,name:"XDC",symbol:"XDC"},rpcUrls:{default:{http:["https://rpc.xdcrpc.com"]}},blockExplorers:{default:{name:"XDCScan",url:"https://xdcscan.com"}},contracts:{multicall3:{address:"0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF",blockCreated:75884020}}}),xdcTestnet=defineChain({id:51,name:"Apothem Network",nativeCurrency:{decimals:18,name:"TXDC",symbol:"TXDC"},rpcUrls:{default:{http:["https://erpc.apothem.network"]}},blockExplorers:{default:{name:"XDCScan",url:"https://testnet.xdcscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:59765389}}}),xLayer=defineChain({id:196,name:"X Layer Mainnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://rpc.xlayer.tech"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer",apiUrl:"https://www.oklink.com/api/v5/explorer/xlayer/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:47416}}}),xLayerTestnet=defineChain({id:195,name:"X1 Testnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://xlayertestrpc.okx.com"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer-test"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:624344}},testnet:!0}),xrSepolia=defineChain({id:2730,name:"XR Sepolia",nativeCurrency:{decimals:18,name:"tXR",symbol:"tXR"},rpcUrls:{default:{http:["https://xr-sepolia-testnet.rpc.caldera.xyz/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://xr-sepolia-testnet.explorer.caldera.xyz"}},testnet:!0}),yooldoVerse=defineChain({id:50005,name:"Yooldo Verse",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Explorer",url:"https://explorer.yooldo-verse.xyz"}}}),yooldoVerseTestnet=defineChain({id:50006,name:"Yooldo Verse Testnet",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Testnet Explorer",url:"https://explorer.testnet.yooldo-verse.xyz"}},testnet:!0}),zenchainTestnet=defineChain({id:8408,name:"Zenchain Testnet",nativeCurrency:{decimals:18,name:"ZCX",symbol:"ZCX"},rpcUrls:{default:{http:["https://zenchain-testnet.api.onfinality.io/public"],webSocket:["wss://zenchain-testnet.api.onfinality.io/public-ws"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:230019}},blockExplorers:{default:{name:"Zentrace",url:"https://zentrace.io"}},testnet:!0}),zeniq=defineChain({id:383414847825,name:"Zeniq Mainnet",nativeCurrency:{name:"ZENIQ",symbol:"ZENIQ",decimals:18},rpcUrls:{default:{http:["https://api.zeniq.network"]}},blockExplorers:{default:{name:"Zeniq Explorer",url:"https://zeniqscan.com"}},testnet:!1}),zetachain=defineChain({id:7e3,name:"ZetaChain",nativeCurrency:{decimals:18,name:"Zeta",symbol:"ZETA"},rpcUrls:{default:{http:["https://zetachain-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1632781}},blockExplorers:{default:{name:"ZetaScan",url:"https://explorer.zetachain.com"}},testnet:!1}),zetachainAthensTestnet=defineChain({id:7001,name:"ZetaChain Athens Testnet",nativeCurrency:{decimals:18,name:"Zeta",symbol:"aZETA"},rpcUrls:{default:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2715217}},blockExplorers:{default:{name:"ZetaScan",url:"https://athens.explorer.zetachain.com"}},testnet:!0}),zhejiang=defineChain({id:1337803,name:"Zhejiang",nativeCurrency:{name:"Zhejiang Ether",symbol:"ZhejETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zhejiang.ethpandaops.io"]}},blockExplorers:{default:{name:"Beaconchain",url:"https://zhejiang.beaconcha.in"}},testnet:!0}),zilliqa=defineChain({id:32769,name:"Zilliqa",network:"zilliqa",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.zilliqa.com"}},testnet:!1}),zilliqaTestnet=defineChain({id:33101,name:"Zilliqa Testnet",network:"zilliqa-testnet",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://dev-api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.testnet.zilliqa.com"}},testnet:!0}),zircuit=defineChain({id:48900,name:"Zircuit Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://zircuit1-mainnet.p2pify.com","https://zircuit1-mainnet.liquify.com","https://zircuit-mainnet.drpc.org"]}},blockExplorers:{default:{name:"Zircuit Explorer",url:"https://explorer.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}},testnet:!1}),zircuitTestnet=defineChain({id:48899,name:"Zircuit Testnet",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zircuit1-testnet.p2pify.com","https://zircuit1-testnet.liquify.com"]}},blockExplorers:{default:{name:"Zircuit Testnet Explorer",url:"https://explorer.testnet.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:6040287}},testnet:!0}),zkFair=defineChain({id:42766,name:"ZKFair Mainnet",network:"zkfair-mainnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://scan.zkfair.io",apiUrl:"https://scan.zkfair.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6090959}},testnet:!1}),zkFairTestnet=defineChain({id:43851,name:"ZKFair Testnet",network:"zkfair-testnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://testnet-rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://testnet-scan.zkfair.io"}},testnet:!0}),zkLinkNova=defineChain({id:810180,name:"zkLink Nova",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://explorer.zklink.io"}}}),zkLinkNovaSepoliaTestnet=defineChain({id:810181,name:"zkLink Nova Sepolia Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://sepolia.explorer.zklink.io"}}}),zksync=defineChain({...chainConfig$3,id:324,name:"ZKsync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://era.zksync.network/",apiUrl:"https://api-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://explorer.zksync.io/",apiUrl:"https://block-explorer-api.mainnet.zksync.io/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:45659388}}}),zksyncInMemoryNode=defineChain({...chainConfig$3,id:260,name:"ZKsync InMemory Node",network:"zksync-in-memory-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8011"]}},testnet:!0}),zksyncLocalNode=defineChain({...chainConfig$3,id:270,name:"ZKsync CLI Local Node",network:"zksync-cli-local-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:3050"]}},testnet:!0}),zksyncSepoliaTestnet=defineChain({...chainConfig$3,id:300,name:"ZKsync Sepolia Testnet",network:"zksync-sepolia-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia-era.zksync.network/",apiUrl:"https://api-sepolia-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://sepolia.explorer.zksync.io/",blockExplorerApi:"https://block-explorer-api.sepolia.zksync.dev/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:3855712}},testnet:!0}),sourceId$2=1,zora=defineChain({...chainConfig$2,id:7777777,name:"Zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy",apiUrl:"https://explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$2]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:5882},portal:{[sourceId$2]:{address:"0x1a0ad011913A150f69f6A19DF447A0CfD9551054"}},l1StandardBridge:{[sourceId$2]:{address:"0x3e2Ea9B92B7E48A52296fD261dc26fd995284631"}}},sourceId:sourceId$2}),sourceId$1=11155111,zoraSepolia=defineChain({...chainConfig$2,id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/",apiUrl:"https://sepolia.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$1]:{address:"0x2615B481Bd3E5A1C0C7Ca3Da1bdc663E8615Ade9"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:83160},portal:{[sourceId$1]:{address:"0xeffE2C6cA9Ab797D418f0D91eA60807713f3536f"}},l1StandardBridge:{[sourceId$1]:{address:"0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB"}}},sourceId:sourceId$1,testnet:!0}),sourceId=5,zoraTestnet=defineChain({...chainConfig$2,id:999,name:"Zora Goerli Testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy",apiUrl:"https://testnet.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:189123},portal:{[sourceId]:{address:"0xDb9F51790365e7dc196e7D072728df39Be958ACe"}}},sourceId,testnet:!0}),viemChains=Object.freeze(Object.defineProperty({__proto__:null,abstractTestnet,acala,aioz,alienx,alienxHalTestnet,ancient8,ancient8Sepolia,anvil,apeChain,apexTestnet,arbitrum,arbitrumGoerli,arbitrumNova,arbitrumSepolia,areonNetwork,areonNetworkTestnet,artelaTestnet,assetChain,assetChainTestnet,astar,astarZkEVM,astarZkyoto,atletaOlympia,aurora,auroraTestnet,auroria,avalanche,avalancheFuji,b3,b3Sepolia,bahamut,base:base$6,baseGoerli,baseSepolia:baseSepolia$1,beam,beamTestnet,bearNetworkChainMainnet,bearNetworkChainTestnet,berachainTestnet,berachainTestnetbArtio,bevmMainnet,bifrost,bitTorrent,bitTorrentTestnet,bitkub,bitkubTestnet,bitlayer,bitlayerTestnet,bitrock,blast,blastSepolia,bob,bobSepolia,boba,bobaSepolia,botanixTestnet,bounceBit,bounceBitTestnet,bronos,bronosTestnet,bsc,bscGreenfield,bscTestnet,bsquared,bsquaredTestnet,btr,btrTestnet,bxn,bxnTestnet,cannon,canto,celo,celoAlfajores,chang,chiliz,chips,classic,confluxESpace,confluxESpaceTestnet,coreDao,crab,cronos,cronosTestnet,cronoszkEVM,cronoszkEVMTestnet,crossbell,curtis,cyber,cyberTestnet,darwinia,dchain,dchainTestnet,defichainEvm,defichainEvmTestnet,degen,dfk,dodochainTestnet,dogechain,dosChain,dosChainTestnet,dreyerxMainnet,dreyerxTestnet,dustboyIoT,dymension,edgeless,edgelessTestnet,edgeware,edgewareTestnet,ekta,ektaTestnet,elastos,elastosTestnet,electroneum,electroneumTestnet,elysiumTestnet,enuls,eon,eos,eosTestnet,etherlink,etherlinkTestnet,evmos,evmosTestnet,excelonMainnet,fantom,fantomSonicTestnet,fantomTestnet,fibo,filecoin,filecoinCalibration,filecoinHyperspace,flare,flareTestnet,flowMainnet,flowPreviewnet,flowTestnet,fluence,fluenceStage,fluenceTestnet,forma,foundry,fraxtal,fraxtalTestnet,funkiMainnet,funkiSepolia,fuse,fuseSparknet,fusion,fusionTestnet,garnet,genesys,glideL1Protocol,glideL2Protocol,gnosis,gnosisChiado,goChain,gobi,godwoken,goerli,gravity,guruTestnet,ham,haqqMainnet,haqqTestedge2,hardhat,harmonyOne,hashkeyTestnet,hedera,hederaPreviewnet,hederaTestnet,hela,hemiSepolia,holesky,hychain,hychainTestnet,immutableZkEvm,immutableZkEvmTestnet,inEVM,inkSepolia,iota:iota$1,iotaTestnet,iotex,iotexTestnet,jbc,jbcTestnet,kaia,kairos,kakarotSepolia,kakarotStarknetSepolia,kardiaChain,karura,kava,kavaTestnet,kcc,kinto,klaytn,klaytnBaobab,koi,kroma,kromaSepolia,l3x,l3xTestnet,lavita,lightlinkPegasus,lightlinkPhoenix,linea,lineaGoerli,lineaSepolia,lineaTestnet,lisk,liskSepolia,localhost,loop,lukso,luksoTestnet,lycan,lyra,mainnet,mandala,manta,mantaSepoliaTestnet,mantaTestnet,mantle,mantleSepoliaTestnet,mantleTestnet,mapProtocol,matchain,matchainTestnet,meld,merlin,metachain,metachainIstanbul,metalL2,meter,meterTestnet,metis,metisGoerli,mev,mevTestnet,mint,mintSepoliaTestnet,mode:mode$1,modeTestnet,moonbaseAlpha,moonbeam,moonbeamDev,moonriver,morph,morphHolesky,morphSepolia,nautilus,neonDevnet,neonMainnet,nexi,nexilix,oasisTestnet,oasys,odysseyTestnet,okc,oortMainnetDev,opBNB,opBNBTestnet,optimism,optimismGoerli,optimismSepolia,optopia,optopiaTestnet,orderly,orderlySepolia,otimDevnet,palm,palmTestnet,pgn,pgnTestnet,phoenix,playfiAlbireo,plinga,plumeTestnet,polygon,polygonAmoy,polygonMumbai,polygonZkEvm,polygonZkEvmCardona,polygonZkEvmTestnet,pulsechain,pulsechainV4,qMainnet,qTestnet,ql1,real,redbellyTestnet,redstone,reyaNetwork,rollux,rolluxTestnet,ronin,root:root$c,rootPorcini,rootstock,rootstockTestnet,rss3,rss3Sepolia,saakuru,saigon,sanko,sapphire,sapphireTestnet,satoshiVM,satoshiVMTestnet,scroll,scrollSepolia,sei,seiDevnet,seiTestnet,sepolia,shape,shapeSepolia,shardeumSphinx,shibarium,shibariumTestnet,shiden,shimmer,shimmerTestnet,silicon,siliconSepolia,skaleBlockBrawlers,skaleCalypso,skaleCalypsoTestnet,skaleCryptoBlades,skaleCryptoColosseum,skaleEuropa,skaleEuropaTestnet,skaleExorde,skaleHumanProtocol,skaleNebula,skaleNebulaTestnet,skaleRazor,skaleTitan,skaleTitanTestnet,sketchpad,snax,snaxTestnet,soneiumMinato,songbird,songbirdTestnet,sophonTestnet,spicy,step,storyTestnet,stratis,superlumio,superposition,swan,swanProximaTestnet,swanSaturnTestnet,syscoin,syscoinTestnet,taiko,taikoHekla,taikoJolnir,taikoKatla,taikoTestnetSepolia,taraxa,taraxaTestnet,telcoinTestnet,telos,telosTestnet,tenet,thaiChain,that,theta:theta$1,thetaTestnet,thunderCore,thunderTestnet,tiktrixTestnet,tomb,tron,ultron,ultronTestnet,unichainSepolia,unique,uniqueOpal,uniqueQuartz,unreal,vechain,velas,viction,victionTestnet,vision,visionTestnet,wanchain,wanchainTestnet,weaveVMAlphanet,wemix,wemixTestnet,worldchain,worldchainSepolia,x1Testnet:xLayerTestnet,xLayer,xLayerTestnet,xai,xaiTestnet,xdc,xdcTestnet,xrSepolia,yooldoVerse,yooldoVerseTestnet,zenchainTestnet,zeniq,zetachain,zetachainAthensTestnet,zhejiang,zilliqa,zilliqaTestnet,zircuit,zircuitTestnet,zkFair,zkFairTestnet,zkLinkNova,zkLinkNovaSepoliaTestnet,zkSync:zksync,zkSyncInMemoryNode:zksyncInMemoryNode,zkSyncLocalNode:zksyncLocalNode,zkSyncSepoliaTestnet:zksyncSepoliaTestnet,zksync,zksyncInMemoryNode,zksyncLocalNode,zksyncSepoliaTestnet,zora,zoraSepolia,zoraTestnet},Symbol.toStringTag,{value:"Module"})),validatorABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"valPerBlock",type:"uint16"},{indexed:!1,internalType:"uint16",name:"valPerBlockTarget",type:"uint16"}],name:"BlockParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"ownerWallet",type:"address"},{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"},{indexed:!1,internalType:"string",name:"nodeApiBaseUrl",type:"string"}],name:"NodeAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"address",name:"reporterWallet",type:"address"},{indexed:!1,internalType:"address[]",name:"voters",type:"address[]"},{indexed:!1,internalType:"enum ValidatorV1.VoteAction",name:"voteAction",type:"uint8"}],name:"NodeReported",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeStatus",name:"nodeStatus",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"}],name:"NodeStatusChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferStarted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"nodeRandomMinCount",type:"uint16"},{indexed:!1,internalType:"uint16",name:"nodeRandomPingCount",type:"uint16"}],name:"RandomParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"BAN_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORT_THRESHOLD_PER_BLOCK",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASH_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getActiveVNodes",outputs:[{components:[{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"}],internalType:"struct ValidatorV1.ActiveValidator[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_nodeWallet",type:"address"}],name:"getNodeInfo",outputs:[{components:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],internalType:"struct ValidatorV1.NodeInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint16",name:"protocolVersion_",type:"uint16"},{internalType:"address",name:"pushToken_",type:"address"},{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"},{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_V_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_S_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_V_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_S_",type:"uint16"},{internalType:"uint16",name:"SLASH_PERCENT_",type:"uint16"},{internalType:"uint16",name:"BAN_PERCENT_",type:"uint16"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"minStakeD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeV",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nodeMap",outputs:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomMinCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomPingCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolVersion",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from_",type:"address"},{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"redistributeStaked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"nodeTokens_",type:"uint256"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType_",type:"uint8"},{internalType:"string",name:"nodeApiBaseUrl_",type:"string"},{internalType:"address",name:"nodeWallet_",type:"address"}],name:"registerNodeAndStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum ValidatorV1.NodeType",name:"targetNodeType_",type:"uint8"},{internalType:"bytes",name:"voteBlob_",type:"bytes"},{internalType:"bytes[]",name:"signatures_",type:"bytes[]"}],name:"reportNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr_",type:"address"}],name:"setStorageContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"snodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"storageContract",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFees",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalStaked",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"unstakeFees",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"nodeWallet_",type:"address"}],name:"unstakeNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"}],name:"updateBlockParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"}],name:"updateRandomParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"valPerBlock",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"valPerBlockTarget",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"vnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"vnodesActive",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"}],config$9={ABIS:{VALIDATOR:validatorABI},VALIDATOR:{[ENV$1.PROD]:{NETWORK:mainnet,VALIDATOR_CONTRACT:"TODO"},[ENV$1.STAGING]:{NETWORK:sepolia,VALIDATOR_CONTRACT:"TODO"},[ENV$1.DEV]:{NETWORK:sepolia,VALIDATOR_CONTRACT:"0x18Fa54e372e7F5993b2233449e8ab2086eCA3fAE"},[ENV$1.LOCAL]:{NETWORK:localhost,VALIDATOR_CONTRACT:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"}},WALLET_URL:{[ENV$1.PROD]:"TODO",[ENV$1.STAGING]:"TODO",[ENV$1.DEV]:"https://push-protocol.github.io/push-keys/",[ENV$1.LOCAL]:"http://localhost:5174/push-keys/"}},km=class km{constructor(eo,to,ro){sp(this,"ReqModifier",(eo,to)=>{let ro=km.vNodeUrlModifier(eo),no=to;return(to==="push_getBlocks"||to==="push_getBlockByHash"||to==="push_getTransactions"||to==="push_getTransactionByHash"||to==="push_getTransactionsByUser"||to==="push_getTransactionsBySender"||to==="push_getTransactionsByRecipient")&&(this.env===ENV$1.LOCAL&&(ro="http://localhost:5001/rpc"),this.env===ENV$1.DEV&&(ro="https://anode1.push.org/rpc"),no=`RpcService.${to.replace("push_","")}`,to==="push_getTransactions"&&(no="RpcService.getTxs"),to==="push_getTransactionsByUser"&&(no="RpcService.getTransactionsByUser"),to==="push_getTransactionsBySender"&&(no="RpcService.getTxsBySender"),to==="push_getTransactionsByRecipient"&&(no="RpcService.getTxsByRecipient"),to==="push_getTransactionByHash"&&(no="RpcService.getTxByHash")),{url:ro,fnName:no}});sp(this,"call",async(eo,to=[],ro=this.activeValidatorURL)=>await km.sendJsonRpcRequest(this.ReqModifier(ro,eo).url,this.ReqModifier(ro,eo).fnName,to));this.activeValidatorURL=eo,this.env=to,this.validatorContractClient=ro}};sp(km,"instance"),sp(km,"idCounter",0),sp(km,"initalize",async eo=>{const to={env:(eo==null?void 0:eo.env)||ENV$1.STAGING};if(!km.instance||km.instance.env!==to.env){const ro=km.createValidatorContractClient(to.env),no=await km.getActiveValidator(ro);km.instance=new km(no.nodeApiBaseUrl,to.env,ro)}return km.instance}),sp(km,"createValidatorContractClient",eo=>{const to=createPublicClient({chain:config$9.VALIDATOR[eo].NETWORK,transport:http()});return getContract({abi:config$9.ABIS.VALIDATOR,address:config$9.VALIDATOR[eo].VALIDATOR_CONTRACT,client:{public:to}})}),sp(km,"sendJsonRpcRequest",async(eo,to,ro=[])=>{const no={jsonrpc:"2.0",method:to,params:ro,id:km.idCounter++};try{const io=await axios.post(eo,no);if(io.data.error)throw console.error("JSON-RPC Error:",io.data.error),Error(io.data.error.message);return io.data.result}catch(io){throw console.error("Error sending JSON-RPC request:",io),io}}),sp(km,"ping",async eo=>await km.sendJsonRpcRequest(km.vNodeUrlModifier(eo),"push_listening")),sp(km,"getActiveValidator",async eo=>{const to=await eo.read.getActiveVNodes(),ro=getRandomElement(to);return await km.ping(ro.nodeApiBaseUrl)?ro:await km.getActiveValidator(eo)}),sp(km,"vNodeUrlModifier",eo=>{let to=eo;return eo.includes(".local")&&(to=eo.replace(".local",".localh")),`${to}/api/v1/rpc`});let Validator=km;function varint64read(){let Xr=0,eo=0;for(let ro=0;ro<28;ro+=7){let no=this.buf[this.pos++];if(Xr|=(no&127)<>4,!(to&128))return this.assertBounds(),[Xr,eo];for(let ro=3;ro<=31;ro+=7){let no=this.buf[this.pos++];if(eo|=(no&127)<>>io,ao=!(!(oo>>>7)&&eo==0),so=(ao?oo|128:oo)&255;if(to.push(so),!ao)return}const ro=Xr>>>28&15|(eo&7)<<4,no=!!(eo>>3);if(to.push((no?ro|128:ro)&255),!!no){for(let io=3;io<31;io=io+7){const oo=eo>>>io,ao=!!(oo>>>7),so=(ao?oo|128:oo)&255;if(to.push(so),!ao)return}to.push(eo>>>31&1)}}const TWO_PWR_32_DBL=4294967296;function int64FromString(Xr){const eo=Xr[0]==="-";eo&&(Xr=Xr.slice(1));const to=1e6;let ro=0,no=0;function io(oo,ao){const so=Number(Xr.slice(oo,ao));no*=to,ro=ro*to+so,ro>=TWO_PWR_32_DBL&&(no=no+(ro/TWO_PWR_32_DBL|0),ro=ro%TWO_PWR_32_DBL)}return io(-24,-18),io(-18,-12),io(-12,-6),io(-6),eo?negate(ro,no):newBits(ro,no)}function int64ToString(Xr,eo){let to=newBits(Xr,eo);const ro=to.hi&2147483648;ro&&(to=negate(to.lo,to.hi));const no=uInt64ToString(to.lo,to.hi);return ro?"-"+no:no}function uInt64ToString(Xr,eo){if({lo:Xr,hi:eo}=toUnsigned(Xr,eo),eo<=2097151)return String(TWO_PWR_32_DBL*eo+Xr);const to=Xr&16777215,ro=(Xr>>>24|eo<<8)&16777215,no=eo>>16&65535;let io=to+ro*6777216+no*6710656,oo=ro+no*8147497,ao=no*2;const so=1e7;return io>=so&&(oo+=Math.floor(io/so),io%=so),oo>=so&&(ao+=Math.floor(oo/so),oo%=so),ao.toString()+decimalFrom1e7WithLeadingZeros(oo)+decimalFrom1e7WithLeadingZeros(io)}function toUnsigned(Xr,eo){return{lo:Xr>>>0,hi:eo>>>0}}function newBits(Xr,eo){return{lo:Xr|0,hi:eo|0}}function negate(Xr,eo){return eo=~eo,Xr?Xr=~Xr+1:eo+=1,newBits(Xr,eo)}const decimalFrom1e7WithLeadingZeros=Xr=>{const eo=String(Xr);return"0000000".slice(eo.length)+eo};function varint32write(Xr,eo){if(Xr>=0){for(;Xr>127;)eo.push(Xr&127|128),Xr=Xr>>>7;eo.push(Xr)}else{for(let to=0;to<9;to++)eo.push(Xr&127|128),Xr=Xr>>7;eo.push(1)}}function varint32read(){let Xr=this.buf[this.pos++],eo=Xr&127;if(!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<7,!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<14,!(Xr&128))return this.assertBounds(),eo;if(Xr=this.buf[this.pos++],eo|=(Xr&127)<<21,!(Xr&128))return this.assertBounds(),eo;Xr=this.buf[this.pos++],eo|=(Xr&15)<<28;for(let to=5;Xr&128&&to<10;to++)Xr=this.buf[this.pos++];if(Xr&128)throw new Error("invalid varint");return this.assertBounds(),eo>>>0}var define_process_env_default$7={};const protoInt64=makeInt64Support();function makeInt64Support(){const Xr=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof Xr.getBigInt64=="function"&&typeof Xr.getBigUint64=="function"&&typeof Xr.setBigInt64=="function"&&typeof Xr.setBigUint64=="function"&&(typeof process$1$1!="object"||typeof define_process_env_default$7!="object"||define_process_env_default$7.BUF_BIGINT_DISABLE!=="1")){const to=BigInt("-9223372036854775808"),ro=BigInt("9223372036854775807"),no=BigInt("0"),io=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(oo){const ao=typeof oo=="bigint"?oo:BigInt(oo);if(ao>ro||aoio||ao>>0)}raw(eo){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(eo),this}uint32(eo){for(assertUInt32(eo);eo>127;)this.buf.push(eo&127|128),eo=eo>>>7;return this.buf.push(eo),this}int32(eo){return assertInt32(eo),varint32write(eo,this.buf),this}bool(eo){return this.buf.push(eo?1:0),this}bytes(eo){return this.uint32(eo.byteLength),this.raw(eo)}string(eo){let to=this.encodeUtf8(eo);return this.uint32(to.byteLength),this.raw(to)}float(eo){assertFloat32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setFloat32(0,eo,!0),this.raw(to)}double(eo){let to=new Uint8Array(8);return new DataView(to.buffer).setFloat64(0,eo,!0),this.raw(to)}fixed32(eo){assertUInt32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setUint32(0,eo,!0),this.raw(to)}sfixed32(eo){assertInt32(eo);let to=new Uint8Array(4);return new DataView(to.buffer).setInt32(0,eo,!0),this.raw(to)}sint32(eo){return assertInt32(eo),eo=(eo<<1^eo>>31)>>>0,varint32write(eo,this.buf),this}sfixed64(eo){let to=new Uint8Array(8),ro=new DataView(to.buffer),no=protoInt64.enc(eo);return ro.setInt32(0,no.lo,!0),ro.setInt32(4,no.hi,!0),this.raw(to)}fixed64(eo){let to=new Uint8Array(8),ro=new DataView(to.buffer),no=protoInt64.uEnc(eo);return ro.setInt32(0,no.lo,!0),ro.setInt32(4,no.hi,!0),this.raw(to)}int64(eo){let to=protoInt64.enc(eo);return varint64write(to.lo,to.hi,this.buf),this}sint64(eo){let to=protoInt64.enc(eo),ro=to.hi>>31,no=to.lo<<1^ro,io=(to.hi<<1|to.lo>>>31)^ro;return varint64write(no,io,this.buf),this}uint64(eo){let to=protoInt64.uEnc(eo);return varint64write(to.lo,to.hi,this.buf),this}},BinaryReader$1=class{constructor(eo,to=getTextEncoding().decodeUtf8){this.decodeUtf8=to,this.varint64=varint64read,this.uint32=varint32read,this.buf=eo,this.len=eo.length,this.pos=0,this.view=new DataView(eo.buffer,eo.byteOffset,eo.byteLength)}tag(){let eo=this.uint32(),to=eo>>>3,ro=eo&7;if(to<=0||ro<0||ro>5)throw new Error("illegal tag: field no "+to+" wire type "+ro);return[to,ro]}skip(eo,to){let ro=this.pos;switch(eo){case WireType.Varint:for(;this.buf[this.pos++]&128;);break;case WireType.Bit64:this.pos+=4;case WireType.Bit32:this.pos+=4;break;case WireType.LengthDelimited:let no=this.uint32();this.pos+=no;break;case WireType.StartGroup:for(;;){const[io,oo]=this.tag();if(oo===WireType.EndGroup){if(to!==void 0&&io!==to)throw new Error("invalid end group tag");break}this.skip(oo,io)}break;default:throw new Error("cant skip wire type "+eo)}return this.assertBounds(),this.buf.subarray(ro,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let eo=this.uint32();return eo>>>1^-(eo&1)}int64(){return protoInt64.dec(...this.varint64())}uint64(){return protoInt64.uDec(...this.varint64())}sint64(){let[eo,to]=this.varint64(),ro=-(eo&1);return eo=(eo>>>1|(to&1)<<31)^ro,to=to>>>1^ro,protoInt64.dec(eo,to)}bool(){let[eo,to]=this.varint64();return eo!==0||to!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let eo=this.uint32(),to=this.pos;return this.pos+=eo,this.assertBounds(),this.buf.subarray(to,to+eo)}string(){return this.decodeUtf8(this.bytes())}};function assertInt32(Xr){if(typeof Xr=="string")Xr=Number(Xr);else if(typeof Xr!="number")throw new Error("invalid int32: "+typeof Xr);if(!Number.isInteger(Xr)||Xr>INT32_MAX||XrUINT32_MAX||Xr<0)throw new Error("invalid uint32: "+Xr)}function assertFloat32(Xr){if(typeof Xr=="string"){const eo=Xr;if(Xr=Number(Xr),isNaN(Xr)&&eo!=="NaN")throw new Error("invalid float32: "+eo)}else if(typeof Xr!="number")throw new Error("invalid float32: "+typeof Xr);if(Number.isFinite(Xr)&&(Xr>FLOAT32_MAX||Xr>>3){case 1:if(io!==8)break;no.type=to.uint32();continue;case 2:if(io!==18)break;no.category=to.string();continue;case 3:if(io!==26)break;no.sender=to.string();continue;case 4:if(io!==34)break;no.recipients.push(to.string());continue;case 5:if(io!==42)break;no.data=to.bytes();continue;case 6:if(io!==50)break;no.salt=to.bytes();continue;case 7:if(io!==58)break;no.apiToken=to.bytes();continue;case 8:if(io!==66)break;no.signature=to.bytes();continue;case 9:if(io!==74)break;no.fee=to.string();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{type:isSet$3(Xr.type)?globalThis.Number(Xr.type):0,category:isSet$3(Xr.category)?globalThis.String(Xr.category):"",sender:isSet$3(Xr.sender)?globalThis.String(Xr.sender):"",recipients:globalThis.Array.isArray(Xr==null?void 0:Xr.recipients)?Xr.recipients.map(eo=>globalThis.String(eo)):[],data:isSet$3(Xr.data)?bytesFromBase64$1(Xr.data):new Uint8Array(0),salt:isSet$3(Xr.salt)?bytesFromBase64$1(Xr.salt):new Uint8Array(0),apiToken:isSet$3(Xr.apiToken)?bytesFromBase64$1(Xr.apiToken):new Uint8Array(0),signature:isSet$3(Xr.signature)?bytesFromBase64$1(Xr.signature):new Uint8Array(0),fee:isSet$3(Xr.fee)?globalThis.String(Xr.fee):""}},toJSON(Xr){var to;const eo={};return Xr.type!==0&&(eo.type=Math.round(Xr.type)),Xr.category!==""&&(eo.category=Xr.category),Xr.sender!==""&&(eo.sender=Xr.sender),(to=Xr.recipients)!=null&&to.length&&(eo.recipients=Xr.recipients),Xr.data.length!==0&&(eo.data=base64FromBytes$1(Xr.data)),Xr.salt.length!==0&&(eo.salt=base64FromBytes$1(Xr.salt)),Xr.apiToken.length!==0&&(eo.apiToken=base64FromBytes$1(Xr.apiToken)),Xr.signature.length!==0&&(eo.signature=base64FromBytes$1(Xr.signature)),Xr.fee!==""&&(eo.fee=Xr.fee),eo},create(Xr){return Transaction$2.fromPartial(Xr??{})},fromPartial(Xr){var to;const eo=createBaseTransaction();return eo.type=Xr.type??0,eo.category=Xr.category??"",eo.sender=Xr.sender??"",eo.recipients=((to=Xr.recipients)==null?void 0:to.map(ro=>ro))||[],eo.data=Xr.data??new Uint8Array(0),eo.salt=Xr.salt??new Uint8Array(0),eo.apiToken=Xr.apiToken??new Uint8Array(0),eo.signature=Xr.signature??new Uint8Array(0),eo.fee=Xr.fee??"",eo}};function bytesFromBase64$1(Xr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Xr,"base64"));{const eo=globalThis.atob(Xr),to=new Uint8Array(eo.length);for(let ro=0;ro{eo.push(globalThis.String.fromCharCode(to))}),globalThis.btoa(eo.join(""))}}function isSet$3(Xr){return Xr!=null}const REGEX$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function validate$4(Xr){return typeof Xr=="string"&®EX$1.test(Xr)}function parse$3(Xr){if(!validate$4(Xr))throw TypeError("Invalid UUID");var eo,to=new Uint8Array(16);return to[0]=(eo=parseInt(Xr.slice(0,8),16))>>>24,to[1]=eo>>>16&255,to[2]=eo>>>8&255,to[3]=eo&255,to[4]=(eo=parseInt(Xr.slice(9,13),16))>>>8,to[5]=eo&255,to[6]=(eo=parseInt(Xr.slice(14,18),16))>>>8,to[7]=eo&255,to[8]=(eo=parseInt(Xr.slice(19,23),16))>>>8,to[9]=eo&255,to[10]=(eo=parseInt(Xr.slice(24,36),16))/1099511627776&255,to[11]=eo/4294967296&255,to[12]=eo>>>24&255,to[13]=eo>>>16&255,to[14]=eo>>>8&255,to[15]=eo&255,to}var byteToHex$2=[];for(var i$7=0;i$7<256;++i$7)byteToHex$2.push((i$7+256).toString(16).slice(1));function unsafeStringify$1(Xr,eo=0){return(byteToHex$2[Xr[eo+0]]+byteToHex$2[Xr[eo+1]]+byteToHex$2[Xr[eo+2]]+byteToHex$2[Xr[eo+3]]+"-"+byteToHex$2[Xr[eo+4]]+byteToHex$2[Xr[eo+5]]+"-"+byteToHex$2[Xr[eo+6]]+byteToHex$2[Xr[eo+7]]+"-"+byteToHex$2[Xr[eo+8]]+byteToHex$2[Xr[eo+9]]+"-"+byteToHex$2[Xr[eo+10]]+byteToHex$2[Xr[eo+11]]+byteToHex$2[Xr[eo+12]]+byteToHex$2[Xr[eo+13]]+byteToHex$2[Xr[eo+14]]+byteToHex$2[Xr[eo+15]]).toLowerCase()}var getRandomValues$2,rnds8$2=new Uint8Array(16);function rng$2(){if(!getRandomValues$2&&(getRandomValues$2=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues$2))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues$2(rnds8$2)}var randomUUID$1=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native$3={randomUUID:randomUUID$1};function v4$2(Xr,eo,to){if(native$3.randomUUID&&!eo&&!Xr)return native$3.randomUUID();Xr=Xr||{};var ro=Xr.random||(Xr.rng||rng$2)();return ro[6]=ro[6]&15|64,ro[8]=ro[8]&63|128,unsafeStringify$1(ro)}var TxCategory=(Xr=>(Xr.INIT_DID="INIT_DID",Xr.INIT_SESSION_KEY="INIT_SESSION_KEY",Xr))(TxCategory||{});function createBaseEncryptedText(){return{ciphertext:"",salt:"",nonce:"",version:"",preKey:""}}const EncryptedText={encode(Xr,eo=new BinaryWriter$1){return Xr.ciphertext!==""&&eo.uint32(10).string(Xr.ciphertext),Xr.salt!==""&&eo.uint32(18).string(Xr.salt),Xr.nonce!==""&&eo.uint32(26).string(Xr.nonce),Xr.version!==""&&eo.uint32(34).string(Xr.version),Xr.preKey!==""&&eo.uint32(42).string(Xr.preKey),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseEncryptedText();for(;to.pos>>3){case 1:if(io!==10)break;no.ciphertext=to.string();continue;case 2:if(io!==18)break;no.salt=to.string();continue;case 3:if(io!==26)break;no.nonce=to.string();continue;case 4:if(io!==34)break;no.version=to.string();continue;case 5:if(io!==42)break;no.preKey=to.string();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{ciphertext:isSet$2(Xr.ciphertext)?globalThis.String(Xr.ciphertext):"",salt:isSet$2(Xr.salt)?globalThis.String(Xr.salt):"",nonce:isSet$2(Xr.nonce)?globalThis.String(Xr.nonce):"",version:isSet$2(Xr.version)?globalThis.String(Xr.version):"",preKey:isSet$2(Xr.preKey)?globalThis.String(Xr.preKey):""}},toJSON(Xr){const eo={};return Xr.ciphertext!==""&&(eo.ciphertext=Xr.ciphertext),Xr.salt!==""&&(eo.salt=Xr.salt),Xr.nonce!==""&&(eo.nonce=Xr.nonce),Xr.version!==""&&(eo.version=Xr.version),Xr.preKey!==""&&(eo.preKey=Xr.preKey),eo},create(Xr){return EncryptedText.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseEncryptedText();return eo.ciphertext=Xr.ciphertext??"",eo.salt=Xr.salt??"",eo.nonce=Xr.nonce??"",eo.version=Xr.version??"",eo.preKey=Xr.preKey??"",eo}};function createBaseWalletToEncDerivedKey(){return{encDerivedPrivKey:void 0,signature:new Uint8Array(0)}}const WalletToEncDerivedKey={encode(Xr,eo=new BinaryWriter$1){return Xr.encDerivedPrivKey!==void 0&&EncryptedText.encode(Xr.encDerivedPrivKey,eo.uint32(10).fork()).join(),Xr.signature.length!==0&&eo.uint32(18).bytes(Xr.signature),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseWalletToEncDerivedKey();for(;to.pos>>3){case 1:if(io!==10)break;no.encDerivedPrivKey=EncryptedText.decode(to,to.uint32());continue;case 2:if(io!==18)break;no.signature=to.bytes();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{encDerivedPrivKey:isSet$2(Xr.encDerivedPrivKey)?EncryptedText.fromJSON(Xr.encDerivedPrivKey):void 0,signature:isSet$2(Xr.signature)?bytesFromBase64(Xr.signature):new Uint8Array(0)}},toJSON(Xr){const eo={};return Xr.encDerivedPrivKey!==void 0&&(eo.encDerivedPrivKey=EncryptedText.toJSON(Xr.encDerivedPrivKey)),Xr.signature.length!==0&&(eo.signature=base64FromBytes(Xr.signature)),eo},create(Xr){return WalletToEncDerivedKey.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseWalletToEncDerivedKey();return eo.encDerivedPrivKey=Xr.encDerivedPrivKey!==void 0&&Xr.encDerivedPrivKey!==null?EncryptedText.fromPartial(Xr.encDerivedPrivKey):void 0,eo.signature=Xr.signature??new Uint8Array(0),eo}};function createBaseInitDid(){return{masterPubKey:"",derivedKeyIndex:0,derivedPubKey:"",walletToEncDerivedKey:{}}}const InitDid={encode(Xr,eo=new BinaryWriter$1){return Xr.masterPubKey!==""&&eo.uint32(10).string(Xr.masterPubKey),Xr.derivedKeyIndex!==0&&eo.uint32(16).uint32(Xr.derivedKeyIndex),Xr.derivedPubKey!==""&&eo.uint32(26).string(Xr.derivedPubKey),Object.entries(Xr.walletToEncDerivedKey).forEach(([to,ro])=>{InitDid_WalletToEncDerivedKeyEntry.encode({key:to,value:ro},eo.uint32(34).fork()).join()}),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitDid();for(;to.pos>>3){case 1:if(io!==10)break;no.masterPubKey=to.string();continue;case 2:if(io!==16)break;no.derivedKeyIndex=to.uint32();continue;case 3:if(io!==26)break;no.derivedPubKey=to.string();continue;case 4:if(io!==34)break;const oo=InitDid_WalletToEncDerivedKeyEntry.decode(to,to.uint32());oo.value!==void 0&&(no.walletToEncDerivedKey[oo.key]=oo.value);continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{masterPubKey:isSet$2(Xr.masterPubKey)?globalThis.String(Xr.masterPubKey):"",derivedKeyIndex:isSet$2(Xr.derivedKeyIndex)?globalThis.Number(Xr.derivedKeyIndex):0,derivedPubKey:isSet$2(Xr.derivedPubKey)?globalThis.String(Xr.derivedPubKey):"",walletToEncDerivedKey:isObject$g(Xr.walletToEncDerivedKey)?Object.entries(Xr.walletToEncDerivedKey).reduce((eo,[to,ro])=>(eo[to]=WalletToEncDerivedKey.fromJSON(ro),eo),{}):{}}},toJSON(Xr){const eo={};if(Xr.masterPubKey!==""&&(eo.masterPubKey=Xr.masterPubKey),Xr.derivedKeyIndex!==0&&(eo.derivedKeyIndex=Math.round(Xr.derivedKeyIndex)),Xr.derivedPubKey!==""&&(eo.derivedPubKey=Xr.derivedPubKey),Xr.walletToEncDerivedKey){const to=Object.entries(Xr.walletToEncDerivedKey);to.length>0&&(eo.walletToEncDerivedKey={},to.forEach(([ro,no])=>{eo.walletToEncDerivedKey[ro]=WalletToEncDerivedKey.toJSON(no)}))}return eo},create(Xr){return InitDid.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitDid();return eo.masterPubKey=Xr.masterPubKey??"",eo.derivedKeyIndex=Xr.derivedKeyIndex??0,eo.derivedPubKey=Xr.derivedPubKey??"",eo.walletToEncDerivedKey=Object.entries(Xr.walletToEncDerivedKey??{}).reduce((to,[ro,no])=>(no!==void 0&&(to[ro]=WalletToEncDerivedKey.fromPartial(no)),to),{}),eo}};function createBaseInitDid_WalletToEncDerivedKeyEntry(){return{key:"",value:void 0}}const InitDid_WalletToEncDerivedKeyEntry={encode(Xr,eo=new BinaryWriter$1){return Xr.key!==""&&eo.uint32(10).string(Xr.key),Xr.value!==void 0&&WalletToEncDerivedKey.encode(Xr.value,eo.uint32(18).fork()).join(),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitDid_WalletToEncDerivedKeyEntry();for(;to.pos>>3){case 1:if(io!==10)break;no.key=to.string();continue;case 2:if(io!==18)break;no.value=WalletToEncDerivedKey.decode(to,to.uint32());continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{key:isSet$2(Xr.key)?globalThis.String(Xr.key):"",value:isSet$2(Xr.value)?WalletToEncDerivedKey.fromJSON(Xr.value):void 0}},toJSON(Xr){const eo={};return Xr.key!==""&&(eo.key=Xr.key),Xr.value!==void 0&&(eo.value=WalletToEncDerivedKey.toJSON(Xr.value)),eo},create(Xr){return InitDid_WalletToEncDerivedKeyEntry.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitDid_WalletToEncDerivedKeyEntry();return eo.key=Xr.key??"",eo.value=Xr.value!==void 0&&Xr.value!==null?WalletToEncDerivedKey.fromPartial(Xr.value):void 0,eo}};function bytesFromBase64(Xr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Xr,"base64"));{const eo=globalThis.atob(Xr),to=new Uint8Array(eo.length);for(let ro=0;ro{eo.push(globalThis.String.fromCharCode(to))}),globalThis.btoa(eo.join(""))}}function isObject$g(Xr){return typeof Xr=="object"&&Xr!==null}function isSet$2(Xr){return Xr!=null}function keyActionFromJSON(Xr){switch(Xr){case 0:case"PUBLISH_KEY":return 0;case 1:case"REVOKE_KEY":return 1;case-1:case"UNRECOGNIZED":default:return-1}}function keyActionToJSON(Xr){switch(Xr){case 0:return"PUBLISH_KEY";case 1:return"REVOKE_KEY";case-1:default:return"UNRECOGNIZED"}}function createBaseInitSessionKey(){return{keyIndex:0,keyAddress:"",action:0}}const InitSessionKey={encode(Xr,eo=new BinaryWriter$1){return Xr.keyIndex!==0&&eo.uint32(8).int32(Xr.keyIndex),Xr.keyAddress!==""&&eo.uint32(18).string(Xr.keyAddress),Xr.action!==0&&eo.uint32(24).int32(Xr.action),eo},decode(Xr,eo){const to=Xr instanceof BinaryReader$1?Xr:new BinaryReader$1(Xr);let ro=eo===void 0?to.len:to.pos+eo;const no=createBaseInitSessionKey();for(;to.pos>>3){case 1:if(io!==8)break;no.keyIndex=to.int32();continue;case 2:if(io!==18)break;no.keyAddress=to.string();continue;case 3:if(io!==24)break;no.action=to.int32();continue}if((io&7)===4||io===0)break;to.skip(io&7)}return no},fromJSON(Xr){return{keyIndex:isSet$1(Xr.keyIndex)?globalThis.Number(Xr.keyIndex):0,keyAddress:isSet$1(Xr.keyAddress)?globalThis.String(Xr.keyAddress):"",action:isSet$1(Xr.action)?keyActionFromJSON(Xr.action):0}},toJSON(Xr){const eo={};return Xr.keyIndex!==0&&(eo.keyIndex=Math.round(Xr.keyIndex)),Xr.keyAddress!==""&&(eo.keyAddress=Xr.keyAddress),Xr.action!==0&&(eo.action=keyActionToJSON(Xr.action)),eo},create(Xr){return InitSessionKey.fromPartial(Xr??{})},fromPartial(Xr){const eo=createBaseInitSessionKey();return eo.keyIndex=Xr.keyIndex??0,eo.keyAddress=Xr.keyAddress??"",eo.action=Xr.action??0,eo}};function isSet$1(Xr){return Xr!=null}const H0=class H0{constructor(eo,to){sp(this,"createUnsigned",(eo,to,ro)=>Transaction$2.create({type:0,category:eo,recipients:to,data:ro,salt:parse$3(v4$2()),fee:"0"}));sp(this,"get",async(eo=Math.floor(Date.now()),to="DESC",ro=30,no=1,io,oo)=>io===void 0?await this.validator.call("push_getTransactions",[eo,to,ro,no,oo]):await this.validator.call("push_getTransactionsByUser",[io,eo,to,ro,no,oo]));sp(this,"getBySender",async(eo,to=Math.floor(Date.now()/1e3),ro="ASC",no=30,io=1,oo)=>await this.validator.call("push_getTransactionsBySender",[eo,to,ro,no,io,oo]));sp(this,"getByRecipient",async(eo,to=Math.floor(Date.now()/1e3),ro="ASC",no=30,io=1,oo)=>await this.validator.call("push_getTransactionsByRecipient",[eo,to,ro,no,io,oo]));sp(this,"search",async eo=>await this.validator.call("push_getTransactionByHash",[eo]));sp(this,"send",async(eo,to)=>{const ro=await this.validator.call("push_getApiToken"),no=H0.serialize({...eo,sender:to.account,signature:new Uint8Array(0),apiToken:utf8ToBytes$4(ro.apiToken)}),io=new TextEncoder().encode(toHex$1(sha256_1$4(no))),oo=await to.signMessage(io),ao=H0.serialize({...H0.deserialize(no),signature:oo});return await this.validator.call("push_sendTransaction",[bytesToHex$4(ao)],ro.apiUrl)});this.validator=eo,this.env=to}};sp(H0,"initialize",async eo=>{const to=await Validator.initalize({env:eo});return new H0(to,eo)}),sp(H0,"serialize",eo=>{const to=Transaction$2.create(eo);return Transaction$2.encode(to).finish()}),sp(H0,"deserialize",eo=>Transaction$2.decode(eo)),sp(H0,"serializeData",(eo,to)=>{switch(to){case TxCategory.INIT_DID:{const ro=eo,no=InitDid.create(ro);return InitDid.encode(no).finish()}case TxCategory.INIT_SESSION_KEY:{const ro=eo,no=InitSessionKey.create(ro);return InitSessionKey.encode(no).finish()}default:throw new Error("Serialization Not Supported for given TxCateory")}}),sp(H0,"deserializeData",(eo,to)=>{switch(to){case TxCategory.INIT_DID:return InitDid.decode(eo);case TxCategory.INIT_SESSION_KEY:return InitSessionKey.decode(eo);default:throw new Error("Deserialization Not Supported for given TxCateory")}});let Tx=H0;var dist$1={};Object.defineProperty(dist$1,"__esModule",{value:!0});var bech32m=dist$1.bech32m=dist$1.bech32=void 0;const ALPHABET$3="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={};for(let Xr=0;Xr>25;return(Xr&33554431)<<5^-(eo>>0&1)&996825010^-(eo>>1&1)&642813549^-(eo>>2&1)&513874426^-(eo>>3&1)&1027748829^-(eo>>4&1)&705979059}function prefixChk(Xr){let eo=1;for(let to=0;to126)return"Invalid prefix ("+Xr+")";eo=polymodStep(eo)^ro>>5}eo=polymodStep(eo);for(let to=0;to=to;)io-=to,ao.push(no>>io&oo);if(ro)io>0&&ao.push(no<=eo)return"Excess padding";if(no<so)throw new TypeError("Exceeds length limit");oo=oo.toLowerCase();let co=prefixChk(oo);if(typeof co=="string")throw new Error(co);let lo=oo+"1";for(let uo=0;uo>5)throw new Error("Non 5-bit word");co=polymodStep(co)^ho,lo+=ALPHABET$3.charAt(ho)}for(let uo=0;uo<6;++uo)co=polymodStep(co);co^=eo;for(let uo=0;uo<6;++uo){const ho=co>>(5-uo)*5&31;lo+=ALPHABET$3.charAt(ho)}return lo}function ro(oo,ao){if(ao=ao||90,oo.length<8)return oo+" too short";if(oo.length>ao)return"Exceeds length limit";const so=oo.toLowerCase(),co=oo.toUpperCase();if(oo!==so&&oo!==co)return"Mixed-case string "+oo;oo=so;const lo=oo.lastIndexOf("1");if(lo===-1)return"No separator character for "+oo;if(lo===0)return"Missing prefix for "+oo;const uo=oo.slice(0,lo),ho=oo.slice(lo+1);if(ho.length<6)return"Data too short";let go=prefixChk(uo);if(typeof go=="string")return go;const bo=[];for(let wo=0;wo=ho.length)&&bo.push($o)}return go!==eo?"Invalid checksum for "+oo:{prefix:uo,words:bo}}function no(oo,ao){const so=ro(oo,ao);if(typeof so=="object")return so}function io(oo,ao){const so=ro(oo,ao);if(typeof so=="object")return so;throw new Error(so)}return{decodeUnsafe:no,decode:io,encode:to,toWords,fromWordsUnsafe,fromWords}}dist$1.bech32=getLibraryFromEncoding("bech32");bech32m=dist$1.bech32m=getLibraryFromEncoding("bech32m");var PUSH_NETWORK=(Xr=>(Xr.DEVNET="devnet",Xr.TESTNET="testnet",Xr.MAINNET="mainnet",Xr))(PUSH_NETWORK||{});const PUSH_PREFIX="push";var Y0;let Address$1=(Y0=class{},sp(Y0,"evmToPush",(eo,to=PUSH_PREFIX)=>{try{const ro=bech32m.toWords(hexToBytes$5(getAddress$1(eo).slice(2)));return bech32m.encode(to,ro)}catch{throw new Error("Invalid EVM address")}}),sp(Y0,"pushToEvm",eo=>{try{const to=bech32m.decode(eo),ro=new Uint8Array(bech32m.fromWords(to.words));return getAddress$1(`0x${bytesToHex$4(ro)}`)}catch{throw new Error("Invalid Push address")}}),sp(Y0,"toPushCAIP",(eo,to=ENV$1.STAGING)=>{let ro;switch(to){case ENV$1.LOCAL:case ENV$1.DEV:{ro=PUSH_NETWORK.DEVNET;break}case ENV$1.STAGING:{ro=PUSH_NETWORK.TESTNET;break}case ENV$1.PROD:{ro=PUSH_NETWORK.MAINNET;break}default:throw Error("Invalid ENV")}const no=eo.startsWith(PUSH_PREFIX)?eo:Y0.evmToPush(eo);return`push:${ro}:${no}`}),sp(Y0,"toCAIP",(eo,to)=>{const ro=eo.startsWith(PUSH_PREFIX)?"push":eo.startsWith("0x")?"eip155":"solana";if(ro==="eip155"&&typeof to!="number")throw new Error("Invalid network for EIP155 address");if((ro==="push"||ro==="solana")&&typeof to=="number")throw new Error(`Invalid network for ${ro} address`);const io={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}[to];return ro==="solana"?`${ro}:${io}:${eo}`:`${ro}:${to}:${eo}`}),Y0);var ENV=(Xr=>(Xr.PROD="prod",Xr.STAGING="staging",Xr.DEV="dev",Xr.LOCAL="local",Xr))(ENV||{});const chainToNamespace={EVM:"eip155",SOL:"solana"},networkToSolChainId={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"},X1=class X1{};sp(X1,"initialize",async(eo,to="WALLETCLIENT")=>to==="DYNAMIC"?X1.convertDynamicProvider(eo):X1.convertViemWalletClient(eo)),sp(X1,"convertViemWalletClient",async eo=>{try{const to=eo.account;if(!to)throw new Error("WalletClient Account Undefined");const ro=await eo.getChainId(),no=async io=>{const oo=await eo.signMessage({message:io,account:to});return hexToBytes$5(oo.replace("0x",""))};return{account:`eip155:${ro}:${getAddress$1(to.address)}`,signMessage:no}}catch{throw new Error("Invalid WalletClient")}}),sp(X1,"convertDynamicProvider",async eo=>{try{const to=chainToNamespace[eo.chain];if(to===void 0)throw new Error("Unsupported Namespace");let ro=await eo.getNetwork();to==="solana"&&(ro=networkToSolChainId[ro]);const no=async io=>{const oo=await eo.signMessage(io);return isHex$4(oo)?hexToBytes$5(oo.replace("0x","")):Buffer$3.from(oo,"base64")};return{account:`${to}:${ro}:${eo.address}`,signMessage:no}}catch{throw new Error("Invalid Dynamic Provider")}});let PushSigner=X1;var ENCRYPTION_TYPE=(Xr=>(Xr.V1="x25519-xsalsa20-poly1305",Xr.V2="aes256GcmHkdfSha256",Xr.V3="eip191-aes256-gcm-hkdf-sha256",Xr.V4="pgpv1:nft",Xr.V5="push:v5",Xr))(ENCRYPTION_TYPE||{});const pv=class pv{constructor(eo){sp(this,"hkdf",async(eo,to)=>{const ro=await crypto.subtle.importKey("raw",eo,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:to,info:new ArrayBuffer(0)},ro,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])});sp(this,"aesGcmEncryption",async(eo,to,ro)=>{const oo=crypto.getRandomValues(new Uint8Array(32)),ao=crypto.getRandomValues(new Uint8Array(12)),so=await this.hkdf(to,oo),co={name:"AES-GCM",iv:ao};ro&&(co.additionalData=ro);const lo=await crypto.subtle.encrypt(co,so,eo);return{ciphertext:bytesToHex$4(new Uint8Array(lo)),salt:bytesToHex$4(oo),nonce:bytesToHex$4(ao)}});sp(this,"aesGcmDecryption",async(eo,to,ro)=>{const no=await this.hkdf(to,hexToBytes$5(eo.salt)),io={name:"AES-GCM",iv:hexToBytes$5(eo.nonce)};ro&&(io.additionalData=ro);const oo=await crypto.subtle.decrypt(io,no,hexToBytes$5(eo.ciphertext));return new Uint8Array(oo)});sp(this,"encryptV5",async eo=>{const to=bytesToHex$4(await crypto.getRandomValues(new Uint8Array(32))),ro=`Enable Push Network Profile +`+to,no=await this.signer.signMessage(ro),oo=new TextEncoder().encode(eo);return{...await this.aesGcmEncryption(oo,no),version:ENCRYPTION_TYPE.V5,preKey:to}});sp(this,"decryptV5",async eo=>{const to=`Enable Push Network Profile +`+eo.preKey,ro=await this.signer.signMessage(to),no=await this.aesGcmDecryption(eo,ro);return new TextDecoder().decode(no)});this.signer=eo}};sp(pv,"encrypt",async(eo,to,ro=ENCRYPTION_TYPE.V5)=>{const no=new pv(to);switch(ro){case ENCRYPTION_TYPE.V5:return await no.encryptV5(eo);default:throw new Error("Invalid Key Encryption")}}),sp(pv,"decrypt",async(eo,to)=>{const ro=new pv(to);switch(eo.version){case ENCRYPTION_TYPE.V5:return ro.decryptV5(eo);default:throw new Error("Invalid Key Encryption")}});let PushEncryption=pv;function toAccount(Xr){if(typeof Xr=="string"){if(!isAddress(Xr,{strict:!1}))throw new InvalidAddressError({address:Xr});return{address:Xr,type:"json-rpc"}}if(!isAddress(Xr.address,{strict:!1}))throw new InvalidAddressError({address:Xr.address});return{address:Xr.address,nonceManager:Xr.nonceManager,sign:Xr.sign,experimental_signAuthorization:Xr.experimental_signAuthorization,signMessage:Xr.signMessage,signTransaction:Xr.signTransaction,signTypedData:Xr.signTypedData,source:"custom",type:"local"}}async function sign$3({hash:Xr,privateKey:eo,to="object"}){const{r:ro,s:no,recovery:io}=secp256k1$2.sign(Xr.slice(2),eo.slice(2)),oo={r:numberToHex(ro,{size:32}),s:numberToHex(no,{size:32}),v:io?28n:27n,yParity:io};return to==="bytes"||to==="hex"?serializeSignature({...oo,to}):oo}async function experimental_signAuthorization(Xr){const{contractAddress:eo,chainId:to,nonce:ro,privateKey:no,to:io="object"}=Xr,oo=await sign$3({hash:hashAuthorization({contractAddress:eo,chainId:to,nonce:ro}),privateKey:no,to:io});return io==="object"?{contractAddress:eo,chainId:to,nonce:ro,...oo}:oo}async function signMessage$2({message:Xr,privateKey:eo}){return await sign$3({hash:hashMessage(Xr),privateKey:eo,to:"hex"})}async function signTransaction$2(Xr){const{privateKey:eo,transaction:to,serializer:ro=serializeTransaction$4}=Xr,no=to.type==="eip4844"?{...to,sidecars:!1}:to,io=await sign$3({hash:keccak256(ro(no)),privateKey:eo});return ro(to,io)}async function signTypedData$1(Xr){const{privateKey:eo,...to}=Xr;return await sign$3({hash:hashTypedData(to),privateKey:eo,to:"hex"})}function privateKeyToAccount(Xr,eo={}){const{nonceManager:to}=eo,ro=toHex$1(secp256k1$2.getPublicKey(Xr.slice(2),!1)),no=publicKeyToAddress(ro);return{...toAccount({address:no,nonceManager:to,async sign({hash:oo}){return sign$3({hash:oo,privateKey:Xr,to:"hex"})},async experimental_signAuthorization(oo){return experimental_signAuthorization({...oo,privateKey:Xr})},async signMessage({message:oo}){return signMessage$2({message:oo,privateKey:Xr})},async signTransaction(oo,{serializer:ao}={}){return signTransaction$2({privateKey:Xr,transaction:oo,serializer:ao})},async signTypedData(oo){return signTypedData$1({...oo,privateKey:Xr})}}),publicKey:ro,source:"privateKey"}}function hdKeyToAccount(Xr,{accountIndex:eo=0,addressIndex:to=0,changeIndex:ro=0,path:no,...io}={}){const oo=Xr.derive(no||`m/44'/60'/${eo}'/${ro}/${to}`);return{...privateKeyToAccount(toHex$1(oo.privateKey),io),getHdKey:()=>oo,source:"hd"}}function mnemonicToAccount(Xr,eo={}){const to=mnemonicToSeedSync(Xr);return hdKeyToAccount(HDKey.fromMasterSeed(to),eo)}const $m=class $m{constructor(eo,to,ro,no=void 0,io){sp(this,"signerAccount");sp(this,"appConnections");sp(this,"walletToEncDerivedKey",{});sp(this,"connectWalletWithAccount",async eo=>{if(!$m.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const to=await PushEncryption.encrypt(this.derivedHDNode.privateExtendedKey,eo),ro=await mnemonicToSeed(this.mnemonic),no=HDKey.fromMasterSeed(ro),io=`PUSH_DID:${bytesToHex$4(sha256_1$4(no.publicKey))}`,oo=await eo.signMessage(`Connect Account To ${io}`);this.walletToEncDerivedKey[eo.account]={encDerivedPrivKey:to,signature:oo}});sp(this,"registerPushAccount",async()=>{if(!$m.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const eo=await mnemonicToSeed(this.mnemonic),to=HDKey.fromMasterSeed(eo),ro={masterPubKey:bytesToHex$4(to.publicKey),derivedKeyIndex:this.derivedHDNode.index,derivedPubKey:bytesToHex$4(this.derivedHDNode.publicKey),walletToEncDerivedKey:this.walletToEncDerivedKey},no=await Tx.initialize(this.env),io=no.createUnsigned("INIT_DID",[],Tx.serializeData(ro,"INIT_DID"));console.log("InitDIDTx:",io),console.log(`0x${bytesToHex$4(to.privateKey)}`);const oo=privateKeyToAccount(`0x${bytesToHex$4(to.privateKey)}`),ao={account:Address$1.toPushCAIP(oo.address,this.env),signMessage:async so=>{const co=await oo.signMessage({message:{raw:so}});return hexToBytes$3(co)}};await no.send(io,ao),$m.unRegisteredProfile=!1,Object.keys(this.walletToEncDerivedKey).forEach(so=>{const{encDerivedPrivKey:co}=this.walletToEncDerivedKey[so];localStorage.setItem(so,JSON.stringify({did:this.did,derivedKeyIndex:0,encDerivedPrivKey:co}))})});sp(this,"sign",async(eo,to)=>{if(!this.appConnections.find(ao=>ao.origin===to))throw Error("App not Connected");const no=hdKeyToAccount(this.derivedHDNode),io=createWalletClient({account:no,chain:mainnet,transport:http()});return await(await PushSigner.initialize(io)).signMessage(typeof eo=="string"?eo:bytesToString(eo))});sp(this,"ConnectionStatus",eo=>{const to=this.appConnections.find(ro=>ro.origin===eo);return to?{isConnected:!to.isPending,isPending:to.isPending}:{isConnected:!1,isPending:!1}});sp(this,"requestToConnect",eo=>{this.appConnections.find(ro=>ro.origin===eo)||(this.appConnections.push({origin:eo,isPending:!0}),localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});sp(this,"acceptConnectionReq",eo=>{const to=this.appConnections.find(ro=>ro.origin===eo);to&&(to.isPending=!1,localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});sp(this,"rejectConnectionReq",eo=>{this.appConnections=this.appConnections.filter(to=>to.origin!==eo),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});sp(this,"generateRandomSessionKey",()=>{var ro,no;let eo=this.derivedHDNode;const to=9;for(let io=0;io{const to=this.generateRandomSessionKey();console.log(eo,to)});sp(this,"revokeSessionKey",eo=>{console.log(eo)});this.did=eo,this.account=to,this.derivedHDNode=ro,this.mnemonic=no,this.env=io,this.signerAccount=Address$1.toPushCAIP(Address$1.evmToPush(hdKeyToAccount(ro).address,"pushconsumer"),io),this.appConnections=localStorage.getItem("appConnections")?JSON.parse(localStorage.getItem("appConnections")):[]}};sp($m,"pushValidator"),sp($m,"unRegisteredProfile",!1),sp($m,"signUp",async(eo=ENV.STAGING)=>{$m.unRegisteredProfile=!0;const to=await $m.generatePushWallet(),ro=Address$1.toPushCAIP(mnemonicToAccount(to.mnemonic).address,eo);localStorage.removeItem("appConnections");const no=new $m(to.did,ro,to.derivedNode,to.mnemonic,eo),io=createWalletClient({account:mnemonicToAccount(to.mnemonic),chain:mainnet,transport:http()}),oo=await PushSigner.initialize(io);return oo.account=ro,await no.connectWalletWithAccount(oo),no}),sp($m,"logInWithMnemonic",async(eo,to=ENV.STAGING)=>{const ro=Address$1.toPushCAIP(mnemonicToAccount(eo).address,to),no=createWalletClient({account:mnemonicToAccount(eo),chain:mainnet,transport:http()}),io=await PushSigner.initialize(no);return io.account=ro,await $m.loginWithWallet(io,to)}),sp($m,"loginWithWallet",async(eo,to=ENV.STAGING)=>{$m.pushValidator=await Validator.initalize({env:to});const ro=await $m.getPushWallet(eo.account);if(ro==null)throw Error("Push Account Not Found!");{const no=await $m.decryptDerivedNode(ro.encDerivedPrivKey,eo);return new $m(ro.did,eo.account,no,void 0,to)}}),sp($m,"loginWithSocial",async()=>{}),sp($m,"getPushWallet",async eo=>{const to=localStorage.getItem(eo);return to?JSON.parse(to):await $m.pushValidator.call("push_accountInfo",[eo])}),sp($m,"generateDerivedNode",async(eo,to=0,ro=0)=>{const io=`m/44'/60'/0'/0/${ro}/0'/${to}'`;return eo.derive(io)}),sp($m,"generatePushWallet",async()=>{const eo=generateMnemonic(wordlist),to=await mnemonicToSeed(eo),ro=HDKey.fromMasterSeed(to),no=`PUSH_DID:${bytesToHex$4(sha256_1$4(ro.publicKey))}`,io=await $m.generateDerivedNode(ro);return{mnemonic:eo,masterNode:ro,did:no,derivedNode:io}}),sp($m,"decryptDerivedNode",async(eo,to)=>{const ro=await PushEncryption.decrypt(eo,to);return HDKey.fromExtendedKey(ro)});let PushWallet=$m;const config$8={},config$7={APP_NAME:"Push Local Wallet",NODE_ENV:"local",APP_ENV:"local",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$6={APP_NAME:"Push Devnet Wallet",NODE_ENV:"dev",APP_ENV:"dev",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$5={APP_NAME:"Push Testnet Wallet",NODE_ENV:"staging",APP_ENV:"staging",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$4={APP_NAME:"Push Wallet",NODE_ENV:"prod",APP_ENV:"prod",ALLOWED_NETWORKS:[1,137,56,10,42161,1101,122,7560],DEFAULT_CHAIN:1},env$2="dev";let dynamicConfig;switch(env$2){case ENV.LOCAL:{dynamicConfig=config$7;break}case ENV.DEV:{dynamicConfig=config$6;break}case ENV.STAGING:{dynamicConfig=config$5;break}case ENV.PROD:{dynamicConfig=config$4;break}default:dynamicConfig=config$5}const config$3={...dynamicConfig,...config$8},MnemonicGrid=({words:Xr,disabled:eo,handleMnemonicChange:to})=>jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:Xr.map((ro,no)=>jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:"text-lg font-medium",children:`${no+1}.`}),jsxRuntimeExports.jsx("input",{type:"text",value:ro,onChange:io=>to(no,io.target.value),placeholder:`Word ${no+1}`,className:"border p-2 rounded w-full text-center",disabled:eo})]},no))});function __awaiter$p(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var eventemitter3$2={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,uo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,uo||so,ho),bo=to?to+co:co;return so._events[bo]?so._events[bo].fn?so._events[bo]=[so._events[bo],go]:so._events[bo].push(go):(so._events[bo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var co=[],lo,uo;if(this._eventsCount===0)return co;for(uo in lo=this._events)eo.call(lo,uo)&&co.push(to?uo.slice(1):uo);return Object.getOwnPropertySymbols?co.concat(Object.getOwnPropertySymbols(lo)):co},ao.prototype.listeners=function(co){var lo=to?to+co:co,uo=this._events[lo];if(!uo)return[];if(uo.fn)return[uo.fn];for(var ho=0,go=uo.length,bo=new Array(go);ho{if(typeof Xr!="object"||typeof eo!="object")return eo;const to=Object.assign({},Xr);for(const ro in eo)Object.prototype.hasOwnProperty.call(eo,ro)&&(typeof eo[ro]=="object"&&Object.prototype.hasOwnProperty.call(Xr,ro)&&typeof Xr[ro]=="object"?to[ro]=deepMerge$1(Xr[ro],eo[ro]):to[ro]=eo[ro]);return to},processArgs=Xr=>{const eo=Xr.args.filter(ro=>typeof ro=="object"),to=Xr.args.filter(ro=>typeof ro!="object"||ro instanceof Error).map(ro=>ro.toString());return{objectArgs:eo,remainingArgs:to}},IGNORE_MESSAGES=["Failed to send logs to server"],messageQueue=[];let Logger$2=class Hy{constructor(eo,to){this.name=eo,this.meta=void 0,to===void 0?this.level=LogLevel.WARN:this.level=to}static setEmitErrors(eo){eo!==void 0&&(Hy.globalKeys.emitErrors=eo)}static setEnvironmentId(eo){eo!==void 0&&(Hy.globalKeys.environmentId=eo)}setMetaData(eo,to){this.meta||(this.meta={});const ro={};eo.split(".").reduce((no,io,oo,ao)=>{if(oo===ao.length-1)no[io]=to;else return no[io]||(no[io]={}),no[io]},ro),this.meta=deepMerge$1(this.meta,ro)}getNameArray(eo){return Array.isArray(eo)?eo:[eo]}createLogger(eo,to){return new Hy([...this.getNameArray(this.name),...this.getNameArray(eo)],to??this.level)}get logLevel(){return LogLevel[this.level]}setLogLevel(eo){if(eo in LogLevel&&typeof eo=="string")this.level=LogLevel[eo];else if(eo in LogLevel&&typeof eo=="number")this.level=eo;else throw new Error(`Invalid log level: ${eo}`)}formatMessage(eo,to){var ro;return to instanceof Error||to instanceof Object&&Object.prototype.hasOwnProperty.call(to,"stack")?to=to.stack:to instanceof Object&&(to=JSON.stringify(to)),`${(Array.isArray(this.name)?this.name:[this.name]).map(io=>`[${io}]`).join("")} [${(ro=LogLevel[eo])!==null&&ro!==void 0?ro:"TROUBLESHOOTING"}]: ${to}`}captureAndSend(eo,to,...ro){return __awaiter$p(this,void 0,void 0,function*(){Hy.globalKeys.emitErrors&&!IGNORE_MESSAGES.includes(to==null?void 0:to.toString())&&typeof window<"u"&&this.emitHttpLogs(eo,to,{args:ro})})}emitHttpLogs(eo,to,{args:ro=[],transformMeta:no=io=>io}){messageQueue.push({args:ro,level:eo,message:to}),messageQueue.length===1&&queueMicrotask(()=>__awaiter$p(this,void 0,void 0,function*(){var io,oo;const ao=[];messageQueue.forEach(so=>{var co,lo,uo,ho,go,bo;const wo={},{objectArgs:Eo,remainingArgs:$o}=processArgs(so);Object.assign(wo,...Eo),Object.assign(wo,{level:LogLevel[so.level],message:[so.message,...$o].join(" "),meta:no(this.meta),url:{hostname:(co=window.location)===null||co===void 0?void 0:co.hostname,origin:(lo=window.location)===null||lo===void 0?void 0:lo.origin,pathname:(uo=window.location)===null||uo===void 0?void 0:uo.pathname,port:(ho=window.location)===null||ho===void 0?void 0:ho.port,protocol:(go=window.location)===null||go===void 0?void 0:go.protocol},userAgent:(bo=window.navigator)===null||bo===void 0?void 0:bo.userAgent}),ao.push(wo)});try{if(!(!((io=Hy.globalKeys)===null||io===void 0)&&io.environmentId))throw new Error("Environment ID not set");yield fetch(`https://logs.dynamicauth.com/api/v1/${(oo=Hy.globalKeys)===null||oo===void 0?void 0:oo.environmentId}`,{body:JSON.stringify(ao),headers:{"Content-Type":"application/json"},method:"POST",mode:"cors",referrerPolicy:"origin-when-cross-origin"})}catch(so){this.debug("Failed to send logs to server",so)}messageQueue.length=0}))}instrument(eo,to){return this.emitHttpLogs(LogLevel.INFO,eo,{args:[to],transformMeta:()=>{}})}log(eo,to,...ro){if(!(typeof window<"u"&&(window==null?void 0:window.dynamic_enableTroubleshootMode)===!0)&&(eo{packageVersions[Xr]=eo,versionCheckTimeout&&(clearTimeout(versionCheckTimeout),versionCheckTimeout=null),versionCheckTimeout=setTimeout(()=>{const ro=Object.values(packageVersions),[no]=ro;if(!ro.every(oo=>oo===no)){const oo=packageVersions["@dynamic-labs/sdk-react-core"]||no,ao=getErrorMessage(oo);logger$d.error(new Error(ao))}versionCheckTimeout=null},100)},getErrorMessage=Xr=>` 🚨 Version Mismatch Error One or more \`@dynamic-labs\` packages are installed with mismatched versions. All \`@dynamic-labs\` packages must be on the same version to work correctly. @@ -2176,61 +4006,61 @@ ${Object.entries(packageVersions).filter(([,ro])=>ro!==Xr).map(([ro,no])=>`- \`$ 💡 To fix this issue, update all @dynamic-labs/* packages to version \`${Xr}\` in your package.json 💡 Tip: You can use the \`npx dynamic-doctor run\` command to check for other issues with your project setup. -`.trim();var version$u="3.4.4",dependencies$2={"@dynamic-labs/sdk-api-core":"0.0.547","@hcaptcha/react-hcaptcha":"1.4.4","country-list":"2.3.0",formik:"2.2.9",i18next:"23.4.6",qrcode:"1.5.1","react-focus-lock":"2.9.2","react-i18next":"13.5.0",yup:"0.32.11","react-international-phone":"4.2.5"};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof globalThis.setTimeout=="function"&&(cachedSetTimeout=setTimeout);typeof globalThis.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(Xr){if(cachedSetTimeout===setTimeout)return setTimeout(Xr,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(Xr,0);try{return cachedSetTimeout(Xr,0)}catch{try{return cachedSetTimeout.call(null,Xr,0)}catch{return cachedSetTimeout.call(this,Xr,0)}}}function runClearTimeout(Xr){if(cachedClearTimeout===clearTimeout)return clearTimeout(Xr);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(Xr);try{return cachedClearTimeout(Xr)}catch{try{return cachedClearTimeout.call(null,Xr)}catch{return cachedClearTimeout.call(this,Xr)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var Xr=runTimeout(cleanUpNextTick);draining=!0;for(var eo=queue.length;eo;){for(currentQueue=queue,queue=[];++queueIndex1)for(var to=1;to{const eo=Xr.split(".");let to=process;for(let ro=0;ro"u"&&Object.assign(window,{process}));const VERSION$4=version$u,API_VERSION$2=dependencies$2["@dynamic-labs/sdk-api-core"];var version$s="3.4.4",version$r="3.4.4";function __rest$a(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{const Xr=reactExports.useContext(WalletBookContext);if(Xr===void 0)throw new Error("useWalletBookContext must be used within a WalletBookContextProvider");return Xr},getWalletBookWallet=(Xr,eo,to)=>{var ro,no,io;if(!eo)throw new Error("Wallet key is required. Please pass in a wallet key to getWalletBookWallet");const oo=(no=(ro=Xr==null?void 0:Xr.wallets)===null||ro===void 0?void 0:ro[eo])!==null&&no!==void 0?no:to;if(!oo)throw new Error(`Wallet ${eo} not found in wallet book (${Object.keys((io=Xr==null?void 0:Xr.wallets)!==null&&io!==void 0?io:{}).length} wallets found)`);return oo};var version$p="3.4.4",define_process_env_default$7={};const DEFAULT_ICONIC_SPRITE_URL$1="https://iconic.dynamic-static-assets.com/icons/sprite.svg",getIconicSpriteUrl$1=()=>{var Xr,eo,to;return typeof process$1$1<"u"&&define_process_env_default$7&&(to=(eo=(Xr=define_process_env_default$7.ICONIC_SPRITE_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$7.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$7.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&to!==void 0?to:DEFAULT_ICONIC_SPRITE_URL$1},ICONIC_SPRITE_URL$1=getIconicSpriteUrl$1(),createIconic$1=Xr=>{const eo=Object.assign(Object.assign({},Xr),{function:ro=>{const no=`${ICONIC_SPRITE_URL$1}#${eo.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${eo.iconName}`},ro),{alt:eo.alt,src:no}))}}),to=eo.function.bind(eo);return Object.assign(to,{iconName:eo.iconName,sourcePath:eo.sourcePath}),to},BraveIcon=createIconic$1({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"}),ChromeIcon=createIconic$1({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"}),EdgeIcon=createIconic$1({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"}),FirefoxIcon=createIconic$1({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"}),OperaIcon=createIconic$1({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"}),SafariIcon=createIconic$1({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"}),AlgorandIcon=createIconic$1({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic$1({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic$1({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic$1({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic$1({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});const BitcoinIcon=createIconic$1({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic$1({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});const CosmosIcon=createIconic$1({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic$1({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic$1({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});const EthereumIcon=createIconic$1({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic$1({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic$1({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});const FlowIcon=createIconic$1({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic$1({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic$1({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic$1({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic$1({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});const SolanaIcon=createIconic$1({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"}),StarknetIcon=createIconic$1({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic$1({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic$1({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic$1({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic$1({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic$1({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic$1({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic$1({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic$1({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic$1({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic$1({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic$1({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic$1({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic$1({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic$1({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic$1({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic$1({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});const SignInWithEmailIcon=createIconic$1({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic$1({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic$1({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic$1({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic$1({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic$1({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic$1({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic$1({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic$1({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic$1({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic$1({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic$1({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic$1({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic$1({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic$1({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic$1({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic$1({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic$1({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic$1({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic$1({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic$1({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic$1({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic$1({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic$1({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic$1({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic$1({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic$1({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic$1({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic$1({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic$1({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic$1({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic$1({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic$1({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic$1({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});const WalletConnectIcon=createIconic$1({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic$1({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic$1({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic$1({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic$1({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic$1({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic$1({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic$1({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic$1({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic$1({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic$1({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic$1({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic$1({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic$1({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic$1({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic$1({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic$1({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});const AppleIcon=createIconic$1({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"}),AndroidIcon=createIconic$1({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"}),BitbucketIcon=createIconic$1({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"}),DiscordIcon=createIconic$1({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"}),FacebookIcon=createIconic$1({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"}),FarcasterIcon=createIconic$1({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"}),GithubIcon=createIconic$1({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"}),GithubDarkIcon=createIconic$1({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"}),GitlabIcon=createIconic$1({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"}),GoogleIcon=createIconic$1({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"}),HelpdeskIcon=createIconic$1({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"}),LinkedinIcon=createIconic$1({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"}),MicrosoftIcon=createIconic$1({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"}),SlackIcon=createIconic$1({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"}),TelegramIcon=createIconic$1({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"}),TwitchIcon=createIconic$1({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"}),TwitchDarkIcon=createIconic$1({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"}),TwitterIcon=createIconic$1({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"}),TwitterDarkIcon=createIconic$1({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"}),AppleSocialIcon=createIconic$1({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"}),AppleDarkSocialIcon=createIconic$1({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"}),CoinbaseSocialIcon=createIconic$1({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"}),CoinbaseSocialDarkIcon=createIconic$1({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"}),InstagramIcon=createIconic$1({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"}),YouTubeIcon=createIconic$1({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"}),OnePasswordIcon=createIconic$1({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"}),OnePasswordDarkIcon=createIconic$1({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"}),EpicGamesIcon=createIconic$1({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"}),EpicGamesDarkIcon=createIconic$1({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"}),SpotifyIcon=createIconic$1({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"}),SpotifyDarkIcon=createIconic$1({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"}),SteamIcon=createIconic$1({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"}),SteamDarkIcon=createIconic$1({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"}),TikTokIcon=createIconic$1({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"}),TikTokDarkIcon=createIconic$1({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"}),LineIcon=createIconic$1({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"}),index=Object.freeze(Object.defineProperty({__proto__:null,AppleDarkSocialIcon,AppleSocialIcon,BitbucketIcon,CoinbaseSocialDarkIcon,CoinbaseSocialIcon,DiscordIcon,EpicGamesDarkIcon,EpicGamesIcon,FacebookIcon,FarcasterIcon,GithubDarkIcon,GithubIcon,GitlabIcon,GoogleIcon,HelpdeskIcon,InstagramIcon,LineIcon,LinkedinIcon,MicrosoftIcon,OnePasswordDarkIcon,OnePasswordIcon,SlackIcon,SpotifyDarkIcon,SpotifyIcon,SteamDarkIcon,SteamIcon,TelegramIcon,TikTokDarkIcon,TikTokIcon,TwitchDarkIcon,TwitchIcon,TwitterDarkIcon,TwitterIcon,YouTubeIcon},Symbol.toStringTag,{value:"Module"})),CaptchaWaveIcon=createIconic$1({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"}),UserProfileIcon=createIconic$1({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic$1({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});function __rest$9(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{const to=Object.fromEntries(Object.values(index).map(no=>[no.iconName,no]));if(eo==="dark"){const no=to[`${Xr.toLowerCase()}-dark`];if(no)return no}const ro=to[Xr.toLowerCase()];if(ro)return ro;throw new Error(`Icon ${Xr}, not found`)},findSocialIcon=(Xr,eo="light")=>{try{return getSocialIcon(Xr,eo)}catch(to){return logger$c.error(to),null}},SocialIcon=Xr=>{var{name:eo,variant:to}=Xr,ro=__rest$9(Xr,["name","variant"]);const no=findSocialIcon(eo,to);return no?reactExports.createElement(no,ro,null):null};assertPackageVersion("@dynamic-labs/iconic",version$p);const TEMPLATES={androidUrl:"https://play.google.com/store/apps/details?id={{id}}",chromeUrl:"https://chrome.google.com/webstore/detail/{{id}}",edgeUrl:"https://microsoftedge.microsoft.com/addons/detail/{{id}}",firefoxUrl:"https://addons.mozilla.org/en-US/firefox/addon/{{id}}",iconicUrl:`${getIconicSpriteUrl$1()}#{{id}}`,iosUrl:"https://apps.apple.com/app/apple-store/{{id}}",walletConnectUrl:"https://registry.walletconnect.org/v2/logo/sm/{{id}}"},renderTemplate=(Xr,eo)=>{if(eo)return TEMPLATES[Xr].replace("{{id}}",eo)},getBrandIconUrl=Xr=>Xr.spriteId?renderTemplate("iconicUrl",Xr.spriteId):"",logger$b=new Logger$2("WalletBook"),getWalletIconUrl=(Xr,eo)=>{try{const to=getWalletBookWallet(Xr,eo);if(to!=null&&to.brand)return getBrandIconUrl(to.brand)}catch(to){logger$b.error(to)}return""},getDefaultWalletIconUrl=()=>{try{return renderTemplate("iconicUrl","defaultwallet")}catch(Xr){logger$b.error(Xr)}return""},findWalletBookWallet=(Xr,eo)=>{try{return getWalletBookWallet(Xr,eo)}catch{return}},getWalletLinks=(Xr,eo)=>{var to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo,Eo;const ko=findWalletBookWallet(Xr,eo),Ao={android:"",brave:"",chrome:"",edge:"",firefox:"",ios:""};return Ao.brave=(ro=renderTemplate("chromeUrl",(to=ko==null?void 0:ko.desktop)===null||to===void 0?void 0:to.chromeId))!==null&&ro!==void 0?ro:"",Ao.chrome=(io=renderTemplate("chromeUrl",(no=ko==null?void 0:ko.desktop)===null||no===void 0?void 0:no.chromeId))!==null&&io!==void 0?io:"",Ao.edge=(ao=renderTemplate("edgeUrl",(oo=ko==null?void 0:ko.desktop)===null||oo===void 0?void 0:oo.edgeId))!==null&&ao!==void 0?ao:"",Ao.firefox=(co=renderTemplate("firefoxUrl",(so=ko==null?void 0:ko.desktop)===null||so===void 0?void 0:so.firefoxId))!==null&&co!==void 0?co:"",Ao.ios=(go=(fo=renderTemplate("iosUrl",(lo=ko==null?void 0:ko.mobile)===null||lo===void 0?void 0:lo.iosId))!==null&&fo!==void 0?fo:(ho=ko==null?void 0:ko.mobile)===null||ho===void 0?void 0:ho.ios)!==null&&go!==void 0?go:"",Ao.android=(Eo=(vo=renderTemplate("androidUrl",(yo=ko==null?void 0:ko.mobile)===null||yo===void 0?void 0:yo.androidId))!==null&&vo!==void 0?vo:(wo=ko==null?void 0:ko.mobile)===null||wo===void 0?void 0:wo.android)!==null&&Eo!==void 0?Eo:"",Ao},getWalletPrimaryColor=(Xr,eo)=>{var to;const ro=getWalletBookWallet(Xr,eo);return(to=ro==null?void 0:ro.brand)===null||to===void 0?void 0:to.primaryColor},getWalletGroup=(Xr,eo)=>{const to=Xr.groups[eo];if(!to)throw new Error(`Group ${eo} not found in wallet book`);return to},findWalletGroup=(Xr,eo)=>{try{return getWalletGroup(Xr,eo)}catch(to){logger$b.error(to);return}};var define_process_env_default$6={};const getWalletBookCdnUrl=()=>{var Xr,eo,to;return(to=(eo=(Xr=define_process_env_default$6.WALLET_BOOK_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$6.NEXT_PUBLIC_WALLET_BOOK_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$6.REACT_APP_WALLET_BOOK_CDN_URL)!==null&&to!==void 0?to:"https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json"},findWalletGroupOverride=(Xr,eo,to)=>{var ro;const no=findWalletGroup(Xr,eo);return(ro=no==null?void 0:no.walletOverrides)===null||ro===void 0?void 0:ro[to]},isWalletMethodSupported=(Xr,eo,to)=>{var ro,no,io;return!(!((io=(no=(ro=Xr==null?void 0:Xr.walletLimitations)===null||ro===void 0?void 0:ro[to])===null||no===void 0?void 0:no.unsupportedMethods)===null||io===void 0)&&io.includes(eo))},isWalletEventSupported=(Xr,eo,to)=>{var ro,no,io;return!(!((io=(no=(ro=Xr==null?void 0:Xr.walletLimitations)===null||ro===void 0?void 0:ro[to])===null||no===void 0?void 0:no.unsupportedEvents)===null||io===void 0)&&io.includes(eo))};function __rest$8(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);noparseInt(Xr.toString()),parseEvmNetworks=Xr=>Xr.slice().map(to=>(to.chainId=parseChainId(to.chainId),to.networkId=parseChainId(to.networkId),to));let CustomError$1=class extends Error{constructor(eo,to){super(eo),this.code=void 0,this.code=to,Object.setPrototypeOf(this,this.constructor.prototype)}toJSON(){return{code:this.code,error:this.message}}};class DynamicError extends CustomError$1{}class AccountExistsError extends DynamicError{constructor(eo,to){super(eo),this.errorMessage=eo,this.errorPayload=to}}class ChainalysisError extends DynamicError{constructor(eo){super("This address is not approved for access"),this.walletPublicKey=eo}}class SandboxMaximumThresholdReachedError extends DynamicError{constructor(eo){super(eo),this.errorMessage=eo}}class EmailAlreadyExistsError extends DynamicError{constructor(){super("Email already exists")}}class EmailProviderError extends DynamicError{constructor(eo){super("EmailProviderError",eo)}}class EmailVerificationError extends DynamicError{constructor(eo){super("EmailVerificationError",eo)}}class GateBlockedError extends DynamicError{constructor(eo){super("This address is blocked by the gate"),this.walletPublicKey=eo}}class InsufficientFundsError extends DynamicError{constructor(){super(InsufficientFundsError.message)}static isInstance(eo){var to;return(((to=eo==null?void 0:eo.walk)===null||to===void 0?void 0:to.call(eo))||eo)instanceof InsufficientFundsError}static isErrorMessage(eo){var to;const ro=eo;return((to=ro==null?void 0:ro.message)===null||to===void 0?void 0:to.includes("AA21 didn't pay prefund"))||!1}}InsufficientFundsError.message="Insufficient funds.";class MissingEnvironmentIdError extends DynamicError{constructor(){super("You are missing the environmentId field in yours DynamicContextProvider settings prop")}}class MissingPublicAddressError extends DynamicError{constructor(){super("Missing public address","missing-public-address")}}class NoAccessError extends DynamicError{constructor({walletPublicKey:eo,email:to,phoneNumber:ro,socialProvider:no,socialUsername:io}){super("User does not have access"),this.email=to,this.walletPublicKey=eo,this.phoneNumber=ro,this.socialProvider=no,this.socialUsername=io}}class NotSupportedError extends DynamicError{}class SmsVerificationError extends DynamicError{}class SocialAccountAlreadyExistsError extends DynamicError{constructor(){super("Social account already exists")}}class TransactionGasCannotBeSponsoredError extends DynamicError{constructor(){super(TransactionGasCannotBeSponsoredError.message)}static isInstance(eo){var to;return(((to=eo==null?void 0:eo.walk)===null||to===void 0?void 0:to.call(eo))||eo)instanceof TransactionGasCannotBeSponsoredError}static isErrorMessage(eo){var to;const ro=eo;return((to=ro==null?void 0:ro.message)===null||to===void 0?void 0:to.includes("userOp did not match any gas sponsoring policies"))||!1}}TransactionGasCannotBeSponsoredError.message="Transaction gas cannot be sponsored.";class UserHasAccountWithEmailError extends DynamicError{constructor(eo){super(eo),this.error=eo}}class UsernameAlreadyExistsError extends DynamicError{constructor(){super("Username already exists")}}class WalletNotDeployedError extends DynamicError{constructor(){super("Wallet has not been deployed","wallet_not_deployed")}}class WalletUsedError extends DynamicError{constructor(eo){super("WalletUsedError",eo)}}class UserRejectedTransactionError extends DynamicError{constructor(){super("user rejected transaction")}}class TooManyEmailVerificationsError extends DynamicError{constructor(){super("Too many email verification attempts.")}}class VerificationDataCollectionError extends DynamicError{constructor(eo){super("Failed to get verification data: "+eo)}}class InvalidPhoneNumberError extends DynamicError{constructor(eo){super(eo??"Invalid phone number.")}}class MergeAccountsConfirmationError extends DynamicError{constructor({code:eo,mergeConflicts:to,walletAddress:ro}){super("MergeAccountsConfirmationError",eo),this.mergeConflicts=to,this.walletAddress=ro}}class CustomFieldNotUniqueError extends DynamicError{constructor(){super("Custom Field for user must be unique within the environment","custom_field_data_not_unique")}}class CookieInvalidError extends DynamicError{constructor(){super("The cookie is invalid or expired")}}class AccessBlockedError extends DynamicError{}class EmbeddedWalletException extends DynamicError{constructor(eo){super(eo)}}class MfaInvalidOtpError extends DynamicError{constructor(){super("Invalid code")}}class MfaRateLimitedError extends DynamicError{constructor(){super("Rate limit reached")}}class WalletAddressMismatchError extends DynamicError{constructor(eo,{activeAddress:to,expectedAddress:ro,walletName:no}){super(eo,"wallet_address_mismatch_error"),this.expectedAddress=ro,this.activeAddress=to,this.walletName=no}}class UserRejectedRequestError extends DynamicError{constructor(){super("User rejected request","user_rejected_request")}}const logger$a=new Logger$2("utils"),userAgentRegex1=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,userAgentRegex2=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,isMobile$1=Xr=>typeof window>"u"||typeof navigator>"u"?!1:userAgentRegex1.test(navigator.userAgent)||userAgentRegex2.test(navigator.userAgent.substring(0,4))||isIPad()||isIPhone(),isIPhone=()=>typeof window>"u"||typeof navigator>"u"?!1:/iPhone/.test(navigator.userAgent),isIPhone8OrEarlier=()=>typeof window>"u"||typeof navigator>"u"?!1:iPhoneLegacyRegex.some(({regex:Xr})=>Xr.test(navigator.userAgent)),isIPad=Xr=>{if(typeof window>"u"||typeof navigator>"u")return!1;const eo=navigator.maxTouchPoints;return/iPad/.test(navigator.userAgent)||/Mac/.test(navigator.userAgent)&&eo===5},isIOS$1=Xr=>typeof window>"u"||typeof navigator>"u"?!1:isIPhone()||isIPad(),isAndroid$1=()=>isMobile$1()&&!isIOS$1(),isLegacySafari=()=>typeof window>"u"||!window.CSS||typeof window.CSS.supports!="function"?!1:!CSS.supports("aspect-ratio: 1 / 1"),isSamsungBrowser=()=>typeof window>"u"||typeof navigator>"u"?!1:navigator.userAgent.includes("SamsungBrowser"),isSafariBrowser=()=>{if(typeof window>"u"||typeof navigator>"u")return!1;const{userAgent:Xr}=navigator;return Xr.includes("Safari")&&!Xr.includes("Chrome")&&!Xr.includes("Chromium")},iPhoneLegacyRegex=[{model:"iPhone 5",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]12|5)$/},{model:"iPhone 5C",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]34)$/},{model:"iPhone 5S",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?6[C,_]12|5S)$/},{model:"iPhone 6 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]1|1C2%257enohPi|6PLUS)$/},{model:"iPhone 6",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]2|6)$/},{model:"iPhone 6s Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]2|6SPLUS)$/},{model:"iPhone 6s",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]1|iPhone[ /]6s|6S)$/},{model:"iPhone SE",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]4|SE)$/},{model:"iPhone 7",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]13|iphone7|7)$/},{model:"iPhone 7 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]24|7PLUS)$/},{model:"iPhone 8",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]14|8)$/},{model:"iPhone 8 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]25|8PLUS)$/}],getAndroidVersion=()=>{if(typeof navigator>"u")return;const Xr=navigator.userAgent.match(/Android (\d+(\.\d+)?)/);return Xr?parseFloat(Xr[1]):void 0};function __awaiter$m(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __classPrivateFieldGet$5(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)}function __classPrivateFieldSet$5(Xr,eo,to,ro,no){if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no?no.value=to:eo.set(Xr,to),to}typeof SuppressedError=="function"&&SuppressedError;const getItemAsync=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){if(typeof window>"u")return;const eo=window.localStorage.getItem(Xr);if(eo)try{return JSON.parse(eo)}catch{return eo}}),setItemAsync=(Xr,eo)=>__awaiter$m(void 0,void 0,void 0,function*(){typeof window>"u"||window.localStorage.setItem(Xr,JSON.stringify(eo))}),removeItemAsync=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){if(!(typeof window>"u"))return localStorage.removeItem(Xr)});typeof window<"u"&&(window.global=globalThis,!window.Buffer&&typeof window.Buffer>"u"&&Object.assign(window,{Buffer:Buffer$1$1}));const bufferToBase64=Xr=>{const eo=Array.prototype.map.call(Xr,to=>String.fromCharCode(to)).join("");return Buffer$3.from(eo,"binary").toString("base64")},getProvidersFromWindow=Xr=>{const eo=Xr.split(".");let to=window;const ro=[];for(const[no,io]of Object.entries(eo)){if(to=to[io],typeof to!="object"||to===null)return[];Number(no)===eo.length-1&&(Array.isArray(to)?to.forEach(oo=>ro.push(oo)):to.providers?to.providers.forEach(oo=>ro.push(oo)):ro.push(to))}return ro};function sleep$1(Xr,eo){return new Promise(to=>{setTimeout(()=>to(eo),Xr)})}const FALLBACK_UNDEFINED="FALLBACK_UNDEFINED",retryableFn=(Xr,...eo)=>__awaiter$m(void 0,[Xr,...eo],void 0,function*(to,ro={}){const{maxRetries:no=3,currentRetry:io=0,timeoutMs:oo=100,fallbackValue:ao=new Error("Max retries reached"),retryStrategy:so="timeout-only",retryIntervalMs:co=0,logger:lo}=ro;lo==null||lo.debug("Configured retryableFn with options: ",{currentRetry:io,fallbackValue:ao,maxRetries:no,retryStrategy:so,timeoutMs:oo});const fo=new Promise((ho,go)=>{setTimeout(()=>{go(new Error("Timeout"))},oo)});try{return yield Promise.race([to(),fo])}catch(ho){if(lo==null||lo.debug("retryableFn caught error: ",ho),io>=no){if(lo==null||lo.error("Error while retrying function, returning/throwing fallback value",ho,ao),ao instanceof Error)throw ao;return ao===FALLBACK_UNDEFINED?void 0:ao}const go=(ho==null?void 0:ho.message)==="Timeout",yo=so==="timeout-and-rejection"||so==="timeout-only"&&go||so==="rejection-only"&&!go;if(lo==null||lo.debug("retryableFn shouldRetry: ",yo),!yo){if(ao instanceof Error)throw lo==null||lo.debug("retryableFn throwing fallbackValue error: ",ao),ho;if(ao===FALLBACK_UNDEFINED){lo==null||lo.debug("retryableFn returning undefined");return}return lo==null||lo.debug("retryableFn returning fallbackValue: ",ao),lo==null||lo.error("Error while retrying function, returning fallback value",ho),ao}return co&&(yield sleep$1(co)),retryableFn(to,{currentRetry:io+1,fallbackValue:ao,logger:lo,maxRetries:no,retryIntervalMs:co,retryStrategy:so,timeoutMs:oo})}}),wrapMethodWithCallback=(Xr,eo,to)=>{const no=Xr[eo].bind(Xr);Object.assign(Xr,{[eo]:(...io)=>to(no,...io)})},handleMobileWalletRedirect=({nativeLink:Xr,universalLink:eo})=>{const to=encodeURIComponent(window.location.toString()),ro=encodeURIComponent(window.location.origin);isSamsungBrowser()?window.location.assign(`${Xr}/${to}?ref=${ro}`):window.location.assign(`${eo}/${to}?ref=${ro}`)};function shareSameDomainSuffix(Xr,eo){return Xr.endsWith(eo)?Xr.length===eo.length||Xr[Xr.length-eo.length-1]===".":!1}function extractDomainWithSuffix(Xr,eo){const to=Xr.length-eo.length-2,ro=Xr.lastIndexOf(".",to);return ro===-1?Xr:Xr.slice(ro+1)}function getDomain(Xr,eo,to){if(to.validHosts!==null){const no=to.validHosts;for(const io of no)if(shareSameDomainSuffix(eo,io))return io}let ro=0;if(eo.startsWith("."))for(;roto+1&&Xr.charCodeAt(ro-1)<=32;)ro-=1;if(Xr.charCodeAt(to)===47&&Xr.charCodeAt(to+1)===47)to+=2;else{const co=Xr.indexOf(":/",to);if(co!==-1){const lo=co-to,fo=Xr.charCodeAt(to),ho=Xr.charCodeAt(to+1),go=Xr.charCodeAt(to+2),yo=Xr.charCodeAt(to+3),vo=Xr.charCodeAt(to+4);if(!(lo===5&&fo===104&&ho===116&&go===116&&yo===112&&vo===115)){if(!(lo===4&&fo===104&&ho===116&&go===116&&yo===112)){if(!(lo===3&&fo===119&&ho===115&&go===115)){if(!(lo===2&&fo===119&&ho===115))for(let wo=to;wo=97&&Eo<=122||Eo>=48&&Eo<=57||Eo===46||Eo===45||Eo===43))return null}}}}for(to=co+2;Xr.charCodeAt(to)===47;)to+=1}}let oo=-1,ao=-1,so=-1;for(let co=to;co=65&&lo<=90&&(no=!0)}if(oo!==-1&&oo>to&&ooto&&soto+1&&Xr.charCodeAt(ro-1)===46;)ro-=1;const io=to!==0||ro!==Xr.length?Xr.slice(to,ro):Xr;return no?io.toLowerCase():io}function isProbablyIpv4(Xr){if(Xr.length<7||Xr.length>15)return!1;let eo=0;for(let to=0;to57)return!1}return eo===3&&Xr.charCodeAt(0)!==46&&Xr.charCodeAt(Xr.length-1)!==46}function isProbablyIpv6(Xr){if(Xr.length<3)return!1;let eo=Xr.startsWith("[")?1:0,to=Xr.length;if(Xr[to-1]==="]"&&(to-=1),to-eo>39)return!1;let ro=!1;for(;eo=48&&no<=57||no>=97&&no<=102||no>=65&&no<=90))return!1}return ro}function isIp(Xr){return isProbablyIpv6(Xr)||isProbablyIpv4(Xr)}function isValidAscii(Xr){return Xr>=97&&Xr<=122||Xr>=48&&Xr<=57||Xr>127}function isValidHostname(Xr){if(Xr.length>255||Xr.length===0||!isValidAscii(Xr.charCodeAt(0))&&Xr.charCodeAt(0)!==46&&Xr.charCodeAt(0)!==95)return!1;let eo=-1,to=-1;const ro=Xr.length;for(let no=0;no64||to===46||to===45||to===95)return!1;eo=no}else if(!(isValidAscii(io)||io===45||io===95))return!1;to=io}return ro-eo-1<=63&&to!==45}function setDefaultsImpl({allowIcannDomains:Xr=!0,allowPrivateDomains:eo=!1,detectIp:to=!0,extractHostname:ro=!0,mixedInputs:no=!0,validHosts:io=null,validateHostname:oo=!0}){return{allowIcannDomains:Xr,allowPrivateDomains:eo,detectIp:to,extractHostname:ro,mixedInputs:no,validHosts:io,validateHostname:oo}}const DEFAULT_OPTIONS=setDefaultsImpl({});function setDefaults$1(Xr){return Xr===void 0?DEFAULT_OPTIONS:setDefaultsImpl(Xr)}function getSubdomain(Xr,eo){return eo.length===Xr.length?"":Xr.slice(0,-eo.length-1)}function getEmptyResult(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,publicSuffix:null,subdomain:null}}function parseImpl(Xr,eo,to,ro,no){const io=setDefaults$1(ro);return typeof Xr!="string"||(io.extractHostname?io.mixedInputs?no.hostname=extractHostname(Xr,isValidHostname(Xr)):no.hostname=extractHostname(Xr,!1):no.hostname=Xr,no.hostname===null)||io.detectIp&&(no.isIp=isIp(no.hostname),no.isIp)?no:io.validateHostname&&io.extractHostname&&!isValidHostname(no.hostname)?(no.hostname=null,no):(to(no.hostname,io,no),no.publicSuffix===null||(no.domain=getDomain(no.publicSuffix,no.hostname,io),no.domain===null)||(no.subdomain=getSubdomain(no.hostname,no.domain),no.domainWithoutSuffix=getDomainWithoutSuffix(no.domain,no.publicSuffix)),no)}function fastPathLookup(Xr,eo,to){if(!eo.allowPrivateDomains&&Xr.length>3){const ro=Xr.length-1,no=Xr.charCodeAt(ro),io=Xr.charCodeAt(ro-1),oo=Xr.charCodeAt(ro-2),ao=Xr.charCodeAt(ro-3);if(no===109&&io===111&&oo===99&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="com",!0;if(no===103&&io===114&&oo===111&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="org",!0;if(no===117&&io===100&&oo===101&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="edu",!0;if(no===118&&io===111&&oo===103&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="gov",!0;if(no===116&&io===101&&oo===110&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="net",!0;if(no===101&&io===100&&oo===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="de",!0}return!1}const exceptions=function(){const Xr=[1,{}],eo=[0,{city:Xr}];return[0,{ck:[0,{www:Xr}],jp:[0,{kawasaki:eo,kitakyushu:eo,kobe:eo,nagoya:eo,sapporo:eo,sendai:eo,yokohama:eo}]}]}(),rules=function(){const Xr=[1,{}],eo=[2,{}],to=[1,{gov:Xr,com:Xr,org:Xr,net:Xr,edu:Xr}],ro=[0,{"*":eo}],no=[1,{blogspot:eo}],io=[1,{gov:Xr}],oo=[0,{"*":Xr}],ao=[0,{cloud:eo}],so=[1,{co:eo}],co=[2,{nodes:eo}],lo=[0,{s3:eo}],fo=[0,{direct:eo}],ho=[2,{id:eo}],go=[0,{"webview-assets":eo}],yo=[0,{vfs:eo,"webview-assets":eo}],vo=[0,{"aws-cloud9":go,cloud9:yo}],wo=[0,{dualstack:lo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:yo}],Eo=[0,{dualstack:lo,s3:eo,"s3-website":eo,"aws-cloud9":go,cloud9:yo}],ko=[0,{dualstack:lo,"aws-cloud9":go,cloud9:yo}],Ao=[0,{apps:eo}],Po=[0,{paas:eo}],jo=[0,{app:eo}],Mo=[2,{eu:eo}],No=[0,{site:eo}],Do=[0,{pages:eo}],Fo=[1,{com:Xr,edu:Xr,net:Xr,org:Xr}],Xo=[0,{j:eo}],Lo=[0,{jelastic:eo}],Bo=[0,{user:eo}],xo=[1,{ybo:eo}],uo=[0,{cust:eo,reservd:eo}],po=[0,{cust:eo}],bo=[1,{gov:Xr,edu:Xr,mil:Xr,com:Xr,org:Xr,net:Xr}],_o=[1,{edu:Xr,biz:Xr,net:Xr,org:Xr,gov:Xr,info:Xr,com:Xr}],$o=[1,{gov:Xr,blogspot:eo}],Co=[1,{framer:eo}],Ro=[1,{barsy:eo}],So=[0,{forgot:eo}],mo=[1,{gs:Xr}],To=[0,{nes:Xr}],Vo=[1,{k12:Xr,cc:Xr,lib:Xr}],Zo=[1,{cc:Xr,lib:Xr}];return[0,{ac:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,mil:Xr,org:Xr,drr:eo}],ad:[1,{nom:Xr}],ae:[1,{co:Xr,net:Xr,org:Xr,sch:Xr,ac:Xr,gov:Xr,mil:Xr,blogspot:eo}],aero:[1,{"accident-investigation":Xr,"accident-prevention":Xr,aerobatic:Xr,aeroclub:Xr,aerodrome:Xr,agents:Xr,aircraft:Xr,airline:Xr,airport:Xr,"air-surveillance":Xr,airtraffic:Xr,"air-traffic-control":Xr,ambulance:Xr,amusement:Xr,association:Xr,author:Xr,ballooning:Xr,broker:Xr,caa:Xr,cargo:Xr,catering:Xr,certification:Xr,championship:Xr,charter:Xr,civilaviation:Xr,club:Xr,conference:Xr,consultant:Xr,consulting:Xr,control:Xr,council:Xr,crew:Xr,design:Xr,dgca:Xr,educator:Xr,emergency:Xr,engine:Xr,engineer:Xr,entertainment:Xr,equipment:Xr,exchange:Xr,express:Xr,federation:Xr,flight:Xr,fuel:Xr,gliding:Xr,government:Xr,groundhandling:Xr,group:Xr,hanggliding:Xr,homebuilt:Xr,insurance:Xr,journal:Xr,journalist:Xr,leasing:Xr,logistics:Xr,magazine:Xr,maintenance:Xr,media:Xr,microlight:Xr,modelling:Xr,navigation:Xr,parachuting:Xr,paragliding:Xr,"passenger-association":Xr,pilot:Xr,press:Xr,production:Xr,recreation:Xr,repbody:Xr,res:Xr,research:Xr,rotorcraft:Xr,safety:Xr,scientist:Xr,services:Xr,show:Xr,skydiving:Xr,software:Xr,student:Xr,trader:Xr,trading:Xr,trainer:Xr,union:Xr,workinggroup:Xr,works:Xr}],af:to,ag:[1,{com:Xr,org:Xr,net:Xr,co:Xr,nom:Xr}],ai:[1,{off:Xr,com:Xr,net:Xr,org:Xr,uwu:eo}],al:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,blogspot:eo}],am:[1,{co:Xr,com:Xr,commune:Xr,net:Xr,org:Xr,radio:eo,blogspot:eo,neko:eo,nyaa:eo}],ao:[1,{ed:Xr,gv:Xr,og:Xr,co:Xr,pb:Xr,it:Xr}],aq:Xr,ar:[1,{bet:Xr,com:no,coop:Xr,edu:Xr,gob:Xr,gov:Xr,int:Xr,mil:Xr,musica:Xr,mutual:Xr,net:Xr,org:Xr,senasa:Xr,tur:Xr}],arpa:[1,{e164:Xr,"in-addr":Xr,ip6:Xr,iris:Xr,uri:Xr,urn:Xr}],as:io,asia:[1,{cloudns:eo}],at:[1,{ac:[1,{sth:Xr}],co:no,gv:Xr,or:Xr,funkfeuer:[0,{wien:eo}],futurecms:[0,{"*":eo,ex:ro,in:ro}],futurehosting:eo,futuremailing:eo,ortsinfo:[0,{ex:ro,kunden:ro}],biz:eo,info:eo,"123webseite":eo,priv:eo,myspreadshop:eo,"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo}],au:[1,{com:[1,{blogspot:eo,cloudlets:[0,{mel:eo}],myspreadshop:eo}],net:Xr,org:Xr,edu:[1,{act:Xr,catholic:Xr,nsw:[1,{schools:Xr}],nt:Xr,qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],gov:[1,{qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],asn:Xr,id:Xr,info:Xr,conf:Xr,oz:Xr,act:Xr,nsw:Xr,nt:Xr,qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],aw:[1,{com:Xr}],ax:[1,{be:eo,cat:eo,es:eo,eu:eo,gg:eo,mc:eo,us:eo,xy:eo}],az:[1,{com:Xr,net:Xr,int:Xr,gov:Xr,org:Xr,edu:Xr,info:Xr,pp:Xr,mil:Xr,name:Xr,pro:Xr,biz:Xr}],ba:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,rs:eo,blogspot:eo}],bb:[1,{biz:Xr,co:Xr,com:Xr,edu:Xr,gov:Xr,info:Xr,net:Xr,org:Xr,store:Xr,tv:Xr}],bd:oo,be:[1,{ac:Xr,webhosting:eo,blogspot:eo,interhostsolutions:ao,kuleuven:[0,{ezproxy:eo}],"123website":eo,myspreadshop:eo,transurl:ro}],bf:io,bg:[1,{0:Xr,1:Xr,2:Xr,3:Xr,4:Xr,5:Xr,6:Xr,7:Xr,8:Xr,9:Xr,a:Xr,b:Xr,c:Xr,d:Xr,e:Xr,f:Xr,g:Xr,h:Xr,i:Xr,j:Xr,k:Xr,l:Xr,m:Xr,n:Xr,o:Xr,p:Xr,q:Xr,r:Xr,s:Xr,t:Xr,u:Xr,v:Xr,w:Xr,x:Xr,y:Xr,z:Xr,blogspot:eo,barsy:eo}],bh:to,bi:[1,{co:Xr,com:Xr,edu:Xr,or:Xr,org:Xr}],biz:[1,{activetrail:eo,cloudns:eo,jozi:eo,dyndns:eo,"for-better":eo,"for-more":eo,"for-some":eo,"for-the":eo,selfip:eo,webhop:eo,orx:eo,mmafan:eo,myftp:eo,"no-ip":eo,dscloud:eo}],bj:[1,{africa:Xr,agro:Xr,architectes:Xr,assur:Xr,avocats:Xr,co:Xr,com:Xr,eco:Xr,econo:Xr,edu:Xr,info:Xr,loisirs:Xr,money:Xr,net:Xr,org:Xr,ote:Xr,resto:Xr,restaurant:Xr,tourism:Xr,univ:Xr,blogspot:eo}],bm:to,bn:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,co:eo}],bo:[1,{com:Xr,edu:Xr,gob:Xr,int:Xr,org:Xr,net:Xr,mil:Xr,tv:Xr,web:Xr,academia:Xr,agro:Xr,arte:Xr,blog:Xr,bolivia:Xr,ciencia:Xr,cooperativa:Xr,democracia:Xr,deporte:Xr,ecologia:Xr,economia:Xr,empresa:Xr,indigena:Xr,industria:Xr,info:Xr,medicina:Xr,movimiento:Xr,musica:Xr,natural:Xr,nombre:Xr,noticias:Xr,patria:Xr,politica:Xr,profesional:Xr,plurinacional:Xr,pueblo:Xr,revista:Xr,salud:Xr,tecnologia:Xr,tksat:Xr,transporte:Xr,wiki:Xr}],br:[1,{"9guacu":Xr,abc:Xr,adm:Xr,adv:Xr,agr:Xr,aju:Xr,am:Xr,anani:Xr,aparecida:Xr,app:Xr,arq:Xr,art:Xr,ato:Xr,b:Xr,barueri:Xr,belem:Xr,bhz:Xr,bib:Xr,bio:Xr,blog:Xr,bmd:Xr,boavista:Xr,bsb:Xr,campinagrande:Xr,campinas:Xr,caxias:Xr,cim:Xr,cng:Xr,cnt:Xr,com:[1,{blogspot:eo,simplesite:eo}],contagem:Xr,coop:Xr,coz:Xr,cri:Xr,cuiaba:Xr,curitiba:Xr,def:Xr,des:Xr,det:Xr,dev:Xr,ecn:Xr,eco:Xr,edu:Xr,emp:Xr,enf:Xr,eng:Xr,esp:Xr,etc:Xr,eti:Xr,far:Xr,feira:Xr,flog:Xr,floripa:Xr,fm:Xr,fnd:Xr,fortal:Xr,fot:Xr,foz:Xr,fst:Xr,g12:Xr,geo:Xr,ggf:Xr,goiania:Xr,gov:[1,{ac:Xr,al:Xr,am:Xr,ap:Xr,ba:Xr,ce:Xr,df:Xr,es:Xr,go:Xr,ma:Xr,mg:Xr,ms:Xr,mt:Xr,pa:Xr,pb:Xr,pe:Xr,pi:Xr,pr:Xr,rj:Xr,rn:Xr,ro:Xr,rr:Xr,rs:Xr,sc:Xr,se:Xr,sp:Xr,to:Xr}],gru:Xr,imb:Xr,ind:Xr,inf:Xr,jab:Xr,jampa:Xr,jdf:Xr,joinville:Xr,jor:Xr,jus:Xr,leg:[1,{ac:eo,al:eo,am:eo,ap:eo,ba:eo,ce:eo,df:eo,es:eo,go:eo,ma:eo,mg:eo,ms:eo,mt:eo,pa:eo,pb:eo,pe:eo,pi:eo,pr:eo,rj:eo,rn:eo,ro:eo,rr:eo,rs:eo,sc:eo,se:eo,sp:eo,to:eo}],lel:Xr,log:Xr,londrina:Xr,macapa:Xr,maceio:Xr,manaus:Xr,maringa:Xr,mat:Xr,med:Xr,mil:Xr,morena:Xr,mp:Xr,mus:Xr,natal:Xr,net:Xr,niteroi:Xr,nom:oo,not:Xr,ntr:Xr,odo:Xr,ong:Xr,org:Xr,osasco:Xr,palmas:Xr,poa:Xr,ppg:Xr,pro:Xr,psc:Xr,psi:Xr,pvh:Xr,qsl:Xr,radio:Xr,rec:Xr,recife:Xr,rep:Xr,ribeirao:Xr,rio:Xr,riobranco:Xr,riopreto:Xr,salvador:Xr,sampa:Xr,santamaria:Xr,santoandre:Xr,saobernardo:Xr,saogonca:Xr,seg:Xr,sjc:Xr,slg:Xr,slz:Xr,sorocaba:Xr,srv:Xr,taxi:Xr,tc:Xr,tec:Xr,teo:Xr,the:Xr,tmp:Xr,trd:Xr,tur:Xr,tv:Xr,udi:Xr,vet:Xr,vix:Xr,vlog:Xr,wiki:Xr,zlg:Xr}],bs:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,gov:Xr,we:eo}],bt:to,bv:Xr,bw:[1,{co:Xr,org:Xr}],by:[1,{gov:Xr,mil:Xr,com:no,of:Xr,mycloud:eo,mediatech:eo}],bz:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,gov:Xr,za:eo,gsj:eo}],ca:[1,{ab:Xr,bc:Xr,mb:Xr,nb:Xr,nf:Xr,nl:Xr,ns:Xr,nt:Xr,nu:Xr,on:Xr,pe:Xr,qc:Xr,sk:Xr,yk:Xr,gc:Xr,barsy:eo,awdev:ro,co:eo,blogspot:eo,"no-ip":eo,myspreadshop:eo}],cat:Xr,cc:[1,{cloudns:eo,ftpaccess:eo,"game-server":eo,myphotos:eo,scrapping:eo,twmail:eo,csx:eo,fantasyleague:eo,spawn:[0,{instances:eo}]}],cd:io,cf:no,cg:Xr,ch:[1,{square7:eo,blogspot:eo,flow:[0,{ae:[0,{alp1:eo}],appengine:eo}],"linkyard-cloud":eo,dnsking:eo,gotdns:eo,"123website":eo,myspreadshop:eo,firenet:[0,{"*":eo,svc:ro}],"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo}],ci:[1,{org:Xr,or:Xr,com:Xr,co:Xr,edu:Xr,ed:Xr,ac:Xr,net:Xr,go:Xr,asso:Xr,"xn--aroport-bya":Xr,aéroport:Xr,int:Xr,presse:Xr,md:Xr,gouv:Xr,fin:eo,nl:eo}],ck:oo,cl:[1,{co:Xr,gob:Xr,gov:Xr,mil:Xr,blogspot:eo}],cm:[1,{co:Xr,com:Xr,gov:Xr,net:Xr}],cn:[1,{ac:Xr,com:[1,{amazonaws:[0,{compute:ro,"cn-north-1":lo,eb:[0,{"cn-north-1":eo,"cn-northwest-1":eo}],elb:ro}]}],edu:Xr,gov:Xr,net:Xr,org:Xr,mil:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--od0alg":Xr,網絡:Xr,ah:Xr,bj:Xr,cq:Xr,fj:Xr,gd:Xr,gs:Xr,gz:Xr,gx:Xr,ha:Xr,hb:Xr,he:Xr,hi:Xr,hl:Xr,hn:Xr,jl:Xr,js:Xr,jx:Xr,ln:Xr,nm:Xr,nx:Xr,qh:Xr,sc:Xr,sd:Xr,sh:Xr,sn:Xr,sx:Xr,tj:Xr,xj:Xr,xz:Xr,yn:Xr,zj:Xr,hk:Xr,mo:Xr,tw:Xr,"canva-apps":eo,instantcloud:eo,quickconnect:fo}],co:[1,{arts:Xr,com:no,edu:Xr,firm:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,rec:Xr,web:Xr,carrd:eo,crd:eo,otap:ro,leadpages:eo,lpages:eo,mypi:eo,n4t:eo,firewalledreplit:ho,repl:ho,supabase:eo}],com:[1,{devcdnaccesso:ro,adobeaemcloud:[2,{dev:ro}],airkitapps:eo,"airkitapps-au":eo,aivencloud:eo,kasserver:eo,amazonaws:[0,{compute:ro,"compute-1":ro,"us-east-1":[2,{dualstack:lo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:yo}],"ap-northeast-1":wo,"ap-northeast-2":Eo,"ap-south-1":Eo,"ap-southeast-1":ko,"ap-southeast-2":ko,"ca-central-1":Eo,"eu-central-1":Eo,"eu-west-1":wo,"eu-west-2":Eo,"eu-west-3":Eo,s3:eo,"s3-ap-northeast-1":eo,"s3-ap-northeast-2":eo,"s3-ap-south-1":eo,"s3-ap-southeast-1":eo,"s3-ap-southeast-2":eo,"s3-ca-central-1":eo,"s3-eu-central-1":eo,"s3-eu-west-1":eo,"s3-eu-west-2":eo,"s3-eu-west-3":eo,"s3-external-1":eo,"s3-fips-us-gov-west-1":eo,"s3-sa-east-1":eo,"s3-us-east-2":eo,"s3-us-gov-west-1":eo,"s3-us-west-1":eo,"s3-us-west-2":eo,"s3-website-ap-northeast-1":eo,"s3-website-ap-southeast-1":eo,"s3-website-ap-southeast-2":eo,"s3-website-eu-west-1":eo,"s3-website-sa-east-1":eo,"s3-website-us-east-1":eo,"s3-website-us-west-1":eo,"s3-website-us-west-2":eo,"sa-east-1":ko,"us-east-2":[0,{dualstack:lo,s3:eo,"s3-website":eo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:yo}],"us-west-2":[0,{"analytics-gateway":eo,"aws-cloud9":go,cloud9:yo}],"af-south-1":vo,"ap-east-1":vo,"ap-northeast-3":vo,"eu-north-1":vo,"eu-south-1":vo,"me-south-1":vo,"us-west-1":vo,elb:ro}],elasticbeanstalk:[2,{"ap-northeast-1":eo,"ap-northeast-2":eo,"ap-northeast-3":eo,"ap-south-1":eo,"ap-southeast-1":eo,"ap-southeast-2":eo,"ca-central-1":eo,"eu-central-1":eo,"eu-west-1":eo,"eu-west-2":eo,"eu-west-3":eo,"sa-east-1":eo,"us-east-1":eo,"us-east-2":eo,"us-gov-west-1":eo,"us-west-1":eo,"us-west-2":eo}],awsglobalaccelerator:eo,siiites:eo,appspacehosted:eo,appspaceusercontent:eo,"on-aptible":eo,myasustor:eo,"balena-devices":eo,betainabox:eo,boutir:eo,bplaced:eo,cafjs:eo,"canva-apps":eo,br:eo,cn:eo,de:eo,eu:eo,jpn:eo,mex:eo,ru:eo,sa:eo,uk:eo,us:eo,za:eo,ar:eo,hu:eo,kr:eo,no:eo,qc:eo,uy:eo,africa:eo,gr:eo,co:eo,jdevcloud:eo,wpdevcloud:eo,cloudcontrolled:eo,cloudcontrolapp:eo,"cf-ipfs":eo,"cloudflare-ipfs":eo,trycloudflare:eo,"customer-oci":[0,{"*":eo,oci:ro,ocp:ro,ocs:ro}],dattolocal:eo,dattorelay:eo,dattoweb:eo,mydatto:eo,builtwithdark:eo,datadetect:[0,{demo:eo,instance:eo}],ddns5:eo,discordsays:eo,discordsez:eo,drayddns:eo,dreamhosters:eo,mydrobo:eo,"dyndns-at-home":eo,"dyndns-at-work":eo,"dyndns-blog":eo,"dyndns-free":eo,"dyndns-home":eo,"dyndns-ip":eo,"dyndns-mail":eo,"dyndns-office":eo,"dyndns-pics":eo,"dyndns-remote":eo,"dyndns-server":eo,"dyndns-web":eo,"dyndns-wiki":eo,"dyndns-work":eo,blogdns:eo,cechire:eo,dnsalias:eo,dnsdojo:eo,doesntexist:eo,dontexist:eo,doomdns:eo,"dyn-o-saur":eo,dynalias:eo,"est-a-la-maison":eo,"est-a-la-masion":eo,"est-le-patron":eo,"est-mon-blogueur":eo,"from-ak":eo,"from-al":eo,"from-ar":eo,"from-ca":eo,"from-ct":eo,"from-dc":eo,"from-de":eo,"from-fl":eo,"from-ga":eo,"from-hi":eo,"from-ia":eo,"from-id":eo,"from-il":eo,"from-in":eo,"from-ks":eo,"from-ky":eo,"from-ma":eo,"from-md":eo,"from-mi":eo,"from-mn":eo,"from-mo":eo,"from-ms":eo,"from-mt":eo,"from-nc":eo,"from-nd":eo,"from-ne":eo,"from-nh":eo,"from-nj":eo,"from-nm":eo,"from-nv":eo,"from-oh":eo,"from-ok":eo,"from-or":eo,"from-pa":eo,"from-pr":eo,"from-ri":eo,"from-sc":eo,"from-sd":eo,"from-tn":eo,"from-tx":eo,"from-ut":eo,"from-va":eo,"from-vt":eo,"from-wa":eo,"from-wi":eo,"from-wv":eo,"from-wy":eo,getmyip:eo,gotdns:eo,"hobby-site":eo,homelinux:eo,homeunix:eo,iamallama:eo,"is-a-anarchist":eo,"is-a-blogger":eo,"is-a-bookkeeper":eo,"is-a-bulls-fan":eo,"is-a-caterer":eo,"is-a-chef":eo,"is-a-conservative":eo,"is-a-cpa":eo,"is-a-cubicle-slave":eo,"is-a-democrat":eo,"is-a-designer":eo,"is-a-doctor":eo,"is-a-financialadvisor":eo,"is-a-geek":eo,"is-a-green":eo,"is-a-guru":eo,"is-a-hard-worker":eo,"is-a-hunter":eo,"is-a-landscaper":eo,"is-a-lawyer":eo,"is-a-liberal":eo,"is-a-libertarian":eo,"is-a-llama":eo,"is-a-musician":eo,"is-a-nascarfan":eo,"is-a-nurse":eo,"is-a-painter":eo,"is-a-personaltrainer":eo,"is-a-photographer":eo,"is-a-player":eo,"is-a-republican":eo,"is-a-rockstar":eo,"is-a-socialist":eo,"is-a-student":eo,"is-a-teacher":eo,"is-a-techie":eo,"is-a-therapist":eo,"is-an-accountant":eo,"is-an-actor":eo,"is-an-actress":eo,"is-an-anarchist":eo,"is-an-artist":eo,"is-an-engineer":eo,"is-an-entertainer":eo,"is-certified":eo,"is-gone":eo,"is-into-anime":eo,"is-into-cars":eo,"is-into-cartoons":eo,"is-into-games":eo,"is-leet":eo,"is-not-certified":eo,"is-slick":eo,"is-uberleet":eo,"is-with-theband":eo,"isa-geek":eo,"isa-hockeynut":eo,issmarterthanyou:eo,"likes-pie":eo,likescandy:eo,"neat-url":eo,"saves-the-whales":eo,selfip:eo,"sells-for-less":eo,"sells-for-u":eo,servebbs:eo,"simple-url":eo,"space-to-rent":eo,"teaches-yoga":eo,writesthisblog:eo,digitaloceanspaces:ro,ddnsfree:eo,ddnsgeek:eo,giize:eo,gleeze:eo,kozow:eo,loseyourip:eo,ooguy:eo,theworkpc:eo,mytuleap:eo,"tuleap-partners":eo,encoreapi:eo,evennode:[0,{"eu-1":eo,"eu-2":eo,"eu-3":eo,"eu-4":eo,"us-1":eo,"us-2":eo,"us-3":eo,"us-4":eo}],onfabrica:eo,fbsbx:Ao,"fastly-edge":eo,"fastly-terrarium":eo,"fastvps-server":eo,mydobiss:eo,firebaseapp:eo,fldrv:eo,forgeblocks:eo,framercanvas:eo,"freebox-os":eo,freeboxos:eo,freemyip:eo,gentapps:eo,gentlentapis:eo,githubusercontent:eo,"0emm":ro,appspot:[2,{r:ro}],codespot:eo,googleapis:eo,googlecode:eo,pagespeedmobilizer:eo,publishproxy:eo,withgoogle:eo,withyoutube:eo,blogspot:eo,awsmppl:eo,herokuapp:eo,herokussl:eo,impertrixcdn:eo,impertrix:eo,smushcdn:eo,wphostedmail:eo,wpmucdn:eo,pixolino:eo,amscompute:eo,dopaas:eo,"hosted-by-previder":Po,hosteur:[0,{"rag-cloud":eo,"rag-cloud-ch":eo}],"ik-server":[0,{jcloud:eo,"jcloud-ver-jpc":eo}],jelastic:[0,{demo:eo}],kilatiron:eo,massivegrid:Po,wafaicloud:[0,{jed:eo,lon:eo,ryd:eo}],joyent:[0,{cns:ro}],ktistory:eo,lpusercontent:eo,lmpm:jo,linode:[0,{members:eo,nodebalancer:ro}],linodeobjects:ro,linodeusercontent:[0,{ip:eo}],barsycenter:eo,barsyonline:eo,mazeplay:eo,miniserver:eo,meteorapp:Mo,hostedpi:eo,"mythic-beasts":[0,{customer:eo,caracal:eo,fentiger:eo,lynx:eo,ocelot:eo,oncilla:eo,onza:eo,sphinx:eo,vs:eo,x:eo,yali:eo}],nospamproxy:ao,"4u":eo,nfshost:eo,"001www":eo,ddnslive:eo,myiphost:eo,blogsyte:eo,ciscofreak:eo,damnserver:eo,ditchyourip:eo,dnsiskinky:eo,dynns:eo,geekgalaxy:eo,"health-carereform":eo,homesecuritymac:eo,homesecuritypc:eo,myactivedirectory:eo,mysecuritycamera:eo,"net-freaks":eo,onthewifi:eo,point2this:eo,quicksytes:eo,securitytactics:eo,serveexchange:eo,servehumour:eo,servep2p:eo,servesarcasm:eo,stufftoread:eo,unusualperson:eo,workisboring:eo,"3utilities":eo,ddnsking:eo,myvnc:eo,servebeer:eo,servecounterstrike:eo,serveftp:eo,servegame:eo,servehalflife:eo,servehttp:eo,serveirc:eo,servemp3:eo,servepics:eo,servequake:eo,observableusercontent:[0,{static:eo}],simplesite:eo,orsites:eo,operaunite:eo,"authgear-staging":eo,authgearapps:eo,skygearapp:eo,outsystemscloud:eo,ownprovider:eo,pgfog:eo,pagefrontapp:eo,pagexl:eo,paywhirl:ro,gotpantheon:eo,"platter-app":eo,pleskns:eo,"postman-echo":eo,prgmr:[0,{xen:eo}],pythonanywhere:Mo,qualifioapp:eo,ladesk:eo,qbuser:eo,qa2:eo,"dev-myqnapcloud":eo,"alpha-myqnapcloud":eo,myqnapcloud:eo,quipelements:ro,rackmaze:eo,rhcloud:eo,render:jo,onrender:eo,"180r":eo,dojin:eo,sakuratan:eo,sakuraweb:eo,x0:eo,code:[0,{builder:ro,"dev-builder":ro,"stg-builder":ro}],logoip:eo,scrysec:eo,"firewall-gateway":eo,myshopblocks:eo,myshopify:eo,shopitsite:eo,"1kapp":eo,appchizi:eo,applinzi:eo,sinaapp:eo,vipsinaapp:eo,"bounty-full":[2,{alpha:eo,beta:eo}],streamlitapp:eo,"try-snowplow":eo,"stackhero-network":eo,"playstation-cloud":eo,myspreadshop:eo,stdlib:[0,{api:eo}],"temp-dns":eo,dsmynas:eo,familyds:eo,mytabit:eo,"tb-hosting":No,reservd:eo,thingdustdata:eo,bloxcms:eo,"townnews-staging":eo,typeform:[0,{pro:eo}],hk:eo,it:eo,vultrobjects:ro,wafflecell:eo,"reserve-online":eo,hotelwithflight:eo,remotewd:eo,wiardweb:Do,messwithdns:eo,"woltlab-demo":eo,wpenginepowered:[2,{js:eo}],wixsite:eo,xnbay:[2,{u2:eo,"u2-local":eo}],yolasite:eo}],coop:Xr,cr:[1,{ac:Xr,co:Xr,ed:Xr,fi:Xr,go:Xr,or:Xr,sa:Xr}],cu:[1,{com:Xr,edu:Xr,org:Xr,net:Xr,gov:Xr,inf:Xr}],cv:[1,{com:Xr,edu:Xr,int:Xr,nome:Xr,org:Xr,blogspot:eo}],cw:Fo,cx:[1,{gov:Xr,ath:eo,info:eo}],cy:[1,{ac:Xr,biz:Xr,com:[1,{blogspot:eo,scaleforce:Xo}],ekloges:Xr,gov:Xr,ltd:Xr,mil:Xr,net:Xr,org:Xr,press:Xr,pro:Xr,tm:Xr}],cz:[1,{co:eo,realm:eo,e4:eo,blogspot:eo,metacentrum:[0,{cloud:ro,custom:eo}],muni:[0,{cloud:[0,{flt:eo,usr:eo}]}]}],de:[1,{bplaced:eo,square7:eo,com:eo,cosidns:[0,{dyn:eo}],"dynamisches-dns":eo,dnsupdater:eo,"internet-dns":eo,"l-o-g-i-n":eo,dnshome:eo,fuettertdasnetz:eo,isteingeek:eo,istmein:eo,lebtimnetz:eo,leitungsen:eo,traeumtgerade:eo,ddnss:[2,{dyn:eo,dyndns:eo}],dyndns1:eo,"dyn-ip24":eo,"home-webserver":[2,{dyn:eo}],"myhome-server":eo,frusky:ro,goip:eo,blogspot:eo,"xn--gnstigbestellen-zvb":eo,günstigbestellen:eo,"xn--gnstigliefern-wob":eo,günstigliefern:eo,"hs-heilbronn":[0,{it:Do}],"dyn-berlin":eo,"in-berlin":eo,"in-brb":eo,"in-butter":eo,"in-dsl":eo,"in-vpn":eo,iservschule:eo,"mein-iserv":eo,schulplattform:eo,schulserver:eo,"test-iserv":eo,keymachine:eo,"git-repos":eo,"lcube-server":eo,"svn-repos":eo,barsy:eo,"123webseite":eo,logoip:eo,"firewall-gateway":eo,"my-gateway":eo,"my-router":eo,spdns:eo,speedpartner:[0,{customer:eo}],myspreadshop:eo,"taifun-dns":eo,"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo,"dd-dns":eo,"dray-dns":eo,draydns:eo,"dyn-vpn":eo,dynvpn:eo,"mein-vigor":eo,"my-vigor":eo,"my-wan":eo,"syno-ds":eo,"synology-diskstation":eo,"synology-ds":eo,uberspace:ro,virtualuser:eo,"virtual-user":eo,"community-pro":eo,diskussionsbereich:eo}],dj:Xr,dk:[1,{biz:eo,co:eo,firm:eo,reg:eo,store:eo,blogspot:eo,"123hjemmeside":eo,myspreadshop:eo}],dm:to,do:[1,{art:Xr,com:Xr,edu:Xr,gob:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,sld:Xr,web:Xr}],dz:[1,{art:Xr,asso:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,net:Xr,pol:Xr,soc:Xr,tm:Xr}],ec:[1,{com:Xr,info:Xr,net:Xr,fin:Xr,k12:Xr,med:Xr,pro:Xr,org:Xr,edu:Xr,gov:Xr,gob:Xr,mil:Xr,base:eo,official:eo}],edu:[1,{rit:[0,{"git-pages":eo}]}],ee:[1,{edu:Xr,gov:Xr,riik:Xr,lib:Xr,med:Xr,com:no,pri:Xr,aip:Xr,org:Xr,fie:Xr}],eg:[1,{com:no,edu:Xr,eun:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,sci:Xr}],er:oo,es:[1,{com:no,nom:Xr,org:Xr,gob:Xr,edu:Xr,"123miweb":eo,myspreadshop:eo}],et:[1,{com:Xr,gov:Xr,org:Xr,edu:Xr,biz:Xr,name:Xr,info:Xr,net:Xr}],eu:[1,{airkitapps:eo,mycd:eo,cloudns:eo,dogado:Lo,barsy:eo,wellbeingzone:eo,spdns:eo,transurl:ro,diskstation:eo}],fi:[1,{aland:Xr,dy:eo,blogspot:eo,"xn--hkkinen-5wa":eo,häkkinen:eo,iki:eo,cloudplatform:[0,{fi:eo}],datacenter:[0,{demo:eo,paas:eo}],kapsi:eo,"123kotisivu":eo,myspreadshop:eo}],fj:[1,{ac:Xr,biz:Xr,com:Xr,gov:Xr,info:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,pro:Xr}],fk:oo,fm:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,radio:eo,user:ro}],fo:Xr,fr:[1,{asso:Xr,com:Xr,gouv:Xr,nom:Xr,prd:Xr,tm:Xr,avoues:Xr,cci:Xr,greta:Xr,"huissier-justice":Xr,"en-root":eo,"fbx-os":eo,fbxos:eo,"freebox-os":eo,freeboxos:eo,blogspot:eo,goupile:eo,"123siteweb":eo,"on-web":eo,"chirurgiens-dentistes-en-france":eo,dedibox:eo,aeroport:eo,avocat:eo,chambagri:eo,"chirurgiens-dentistes":eo,"experts-comptables":eo,medecin:eo,notaires:eo,pharmacien:eo,port:eo,veterinaire:eo,myspreadshop:eo,ynh:eo}],ga:Xr,gb:Xr,gd:[1,{edu:Xr,gov:Xr}],ge:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr,net:Xr,pvt:Xr}],gf:Xr,gg:[1,{co:Xr,net:Xr,org:Xr,kaas:eo,cya:eo,panel:[2,{daemon:eo}]}],gh:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr}],gi:[1,{com:Xr,ltd:Xr,gov:Xr,mod:Xr,edu:Xr,org:Xr}],gl:[1,{co:Xr,com:Xr,edu:Xr,net:Xr,org:Xr,biz:eo,xx:eo}],gm:Xr,gn:[1,{ac:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,net:Xr}],gov:Xr,gp:[1,{com:Xr,net:Xr,mobi:Xr,edu:Xr,org:Xr,asso:Xr,app:eo}],gq:Xr,gr:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,gov:Xr,blogspot:eo,simplesite:eo}],gs:Xr,gt:[1,{com:Xr,edu:Xr,gob:Xr,ind:Xr,mil:Xr,net:Xr,org:Xr,blog:eo,de:eo,to:eo}],gu:[1,{com:Xr,edu:Xr,gov:Xr,guam:Xr,info:Xr,net:Xr,org:Xr,web:Xr}],gw:Xr,gy:[1,{co:Xr,com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,be:eo}],hk:[1,{com:Xr,edu:Xr,gov:Xr,idv:Xr,net:Xr,org:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--wcvs22d":Xr,教育:Xr,"xn--lcvr32d":Xr,敎育:Xr,"xn--mxtq1m":Xr,政府:Xr,"xn--gmqw5a":Xr,個人:Xr,"xn--ciqpn":Xr,个人:Xr,"xn--gmq050i":Xr,箇人:Xr,"xn--zf0avx":Xr,網络:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--mk0axi":Xr,组織:Xr,"xn--od0alg":Xr,網絡:Xr,"xn--od0aq3b":Xr,网絡:Xr,"xn--tn0ag":Xr,组织:Xr,"xn--uc0atv":Xr,組織:Xr,"xn--uc0ay4a":Xr,組织:Xr,blogspot:eo,secaas:eo,ltd:eo,inc:eo}],hm:Xr,hn:[1,{com:Xr,edu:Xr,org:Xr,net:Xr,mil:Xr,gob:Xr,cc:eo}],hr:[1,{iz:Xr,from:Xr,name:Xr,com:Xr,blogspot:eo,free:eo}],ht:[1,{com:Xr,shop:Xr,firm:Xr,info:Xr,adult:Xr,net:Xr,pro:Xr,org:Xr,med:Xr,art:Xr,coop:Xr,pol:Xr,asso:Xr,edu:Xr,rel:Xr,gouv:Xr,perso:Xr}],hu:[1,{2e3:Xr,co:Xr,info:Xr,org:Xr,priv:Xr,sport:Xr,tm:Xr,agrar:Xr,bolt:Xr,casino:Xr,city:Xr,erotica:Xr,erotika:Xr,film:Xr,forum:Xr,games:Xr,hotel:Xr,ingatlan:Xr,jogasz:Xr,konyvelo:Xr,lakas:Xr,media:Xr,news:Xr,reklam:Xr,sex:Xr,shop:Xr,suli:Xr,szex:Xr,tozsde:Xr,utazas:Xr,video:Xr,blogspot:eo}],id:[1,{ac:Xr,biz:Xr,co:no,desa:Xr,go:Xr,mil:Xr,my:[1,{rss:ro}],net:Xr,or:Xr,ponpes:Xr,sch:Xr,web:Xr,flap:eo,forte:eo}],ie:[1,{gov:Xr,blogspot:eo,myspreadshop:eo}],il:[1,{ac:Xr,co:[1,{ravpage:eo,blogspot:eo,tabitorder:eo,mytabit:eo}],gov:Xr,idf:Xr,k12:Xr,muni:Xr,net:Xr,org:Xr}],"xn--4dbrk0ce":[1,{"xn--4dbgdty6c":Xr,"xn--5dbhl8d":Xr,"xn--8dbq2a":Xr,"xn--hebda8b":Xr}],ישראל:[1,{אקדמיה:Xr,ישוב:Xr,צהל:Xr,ממשל:Xr}],im:[1,{ac:Xr,co:[1,{ltd:Xr,plc:Xr}],com:Xr,net:Xr,org:Xr,tt:Xr,tv:Xr,ro:eo}],in:[1,{"5g":Xr,"6g":Xr,ac:Xr,ai:Xr,am:Xr,bihar:Xr,biz:Xr,business:Xr,ca:Xr,cn:Xr,co:Xr,com:Xr,coop:Xr,cs:Xr,delhi:Xr,dr:Xr,edu:Xr,er:Xr,firm:Xr,gen:Xr,gov:Xr,gujarat:Xr,ind:Xr,info:Xr,int:Xr,internet:Xr,io:Xr,me:Xr,mil:Xr,net:Xr,nic:Xr,org:Xr,pg:Xr,post:Xr,pro:Xr,res:Xr,travel:Xr,tv:Xr,uk:Xr,up:Xr,us:Xr,web:eo,cloudns:eo,blogspot:eo,barsy:eo,supabase:eo}],info:[1,{cloudns:eo,"dynamic-dns":eo,dyndns:eo,"barrel-of-knowledge":eo,"barrell-of-knowledge":eo,"for-our":eo,"groks-the":eo,"groks-this":eo,"here-for-more":eo,knowsitall:eo,selfip:eo,webhop:eo,barsy:eo,mayfirst:eo,forumz:eo,nsupdate:eo,dvrcam:eo,ilovecollege:eo,"no-ip":eo,dnsupdate:eo,"v-info":eo}],int:[1,{eu:Xr}],io:[1,{2038:eo,com:Xr,"on-acorn":ro,apigee:eo,"b-data":eo,backplaneapp:eo,banzaicloud:[0,{app:eo,backyards:ro}],beagleboard:eo,bitbucket:eo,bluebite:eo,boxfuse:eo,browsersafetymark:eo,bigv:[0,{uk0:eo}],cleverapps:eo,dappnode:[0,{dyndns:eo}],dedyn:eo,drud:eo,definima:eo,"fh-muenster":eo,shw:eo,forgerock:[0,{id:eo}],ghost:eo,github:eo,gitlab:eo,lolipop:eo,"hasura-app":eo,hostyhosting:eo,moonscale:ro,beebyte:Po,beebyteapp:[0,{sekd1:eo}],jele:eo,unispace:[0,{"cloud-fr1":eo}],webthings:eo,loginline:eo,barsy:eo,azurecontainer:ro,ngrok:[2,{ap:eo,au:eo,eu:eo,in:eo,jp:eo,sa:eo,us:eo}],nodeart:[0,{stage:eo}],nid:eo,pantheonsite:eo,dyn53:eo,pstmn:[2,{mock:eo}],protonet:eo,qoto:eo,qcx:[2,{sys:ro}],vaporcloud:eo,vbrplsbx:[0,{g:eo}],"on-k3s":ro,"on-rio":ro,readthedocs:eo,resindevice:eo,resinstaging:[0,{devices:eo}],hzc:eo,sandcats:eo,shiftcrypto:eo,shiftedit:eo,"mo-siemens":eo,musician:eo,lair:Ao,stolos:ro,spacekit:eo,utwente:eo,s5y:ro,edugit:eo,telebit:eo,thingdust:[0,{dev:uo,disrec:uo,prod:po,testing:uo}],tickets:eo,upli:eo,wedeploy:eo,editorx:eo,wixstudio:eo,basicserver:eo,virtualserver:eo}],iq:bo,ir:[1,{ac:Xr,co:Xr,gov:Xr,id:Xr,net:Xr,org:Xr,sch:Xr,"xn--mgba3a4f16a":Xr,ایران:Xr,"xn--mgba3a4fra":Xr,ايران:Xr}],is:[1,{net:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,int:Xr,cupcake:eo,blogspot:eo}],it:[1,{gov:Xr,edu:Xr,abr:Xr,abruzzo:Xr,"aosta-valley":Xr,aostavalley:Xr,bas:Xr,basilicata:Xr,cal:Xr,calabria:Xr,cam:Xr,campania:Xr,"emilia-romagna":Xr,emiliaromagna:Xr,emr:Xr,"friuli-v-giulia":Xr,"friuli-ve-giulia":Xr,"friuli-vegiulia":Xr,"friuli-venezia-giulia":Xr,"friuli-veneziagiulia":Xr,"friuli-vgiulia":Xr,"friuliv-giulia":Xr,"friulive-giulia":Xr,friulivegiulia:Xr,"friulivenezia-giulia":Xr,friuliveneziagiulia:Xr,friulivgiulia:Xr,fvg:Xr,laz:Xr,lazio:Xr,lig:Xr,liguria:Xr,lom:Xr,lombardia:Xr,lombardy:Xr,lucania:Xr,mar:Xr,marche:Xr,mol:Xr,molise:Xr,piedmont:Xr,piemonte:Xr,pmn:Xr,pug:Xr,puglia:Xr,sar:Xr,sardegna:Xr,sardinia:Xr,sic:Xr,sicilia:Xr,sicily:Xr,taa:Xr,tos:Xr,toscana:Xr,"trentin-sud-tirol":Xr,"xn--trentin-sd-tirol-rzb":Xr,"trentin-süd-tirol":Xr,"trentin-sudtirol":Xr,"xn--trentin-sdtirol-7vb":Xr,"trentin-südtirol":Xr,"trentin-sued-tirol":Xr,"trentin-suedtirol":Xr,"trentino-a-adige":Xr,"trentino-aadige":Xr,"trentino-alto-adige":Xr,"trentino-altoadige":Xr,"trentino-s-tirol":Xr,"trentino-stirol":Xr,"trentino-sud-tirol":Xr,"xn--trentino-sd-tirol-c3b":Xr,"trentino-süd-tirol":Xr,"trentino-sudtirol":Xr,"xn--trentino-sdtirol-szb":Xr,"trentino-südtirol":Xr,"trentino-sued-tirol":Xr,"trentino-suedtirol":Xr,trentino:Xr,"trentinoa-adige":Xr,trentinoaadige:Xr,"trentinoalto-adige":Xr,trentinoaltoadige:Xr,"trentinos-tirol":Xr,trentinostirol:Xr,"trentinosud-tirol":Xr,"xn--trentinosd-tirol-rzb":Xr,"trentinosüd-tirol":Xr,trentinosudtirol:Xr,"xn--trentinosdtirol-7vb":Xr,trentinosüdtirol:Xr,"trentinosued-tirol":Xr,trentinosuedtirol:Xr,"trentinsud-tirol":Xr,"xn--trentinsd-tirol-6vb":Xr,"trentinsüd-tirol":Xr,trentinsudtirol:Xr,"xn--trentinsdtirol-nsb":Xr,trentinsüdtirol:Xr,"trentinsued-tirol":Xr,trentinsuedtirol:Xr,tuscany:Xr,umb:Xr,umbria:Xr,"val-d-aosta":Xr,"val-daosta":Xr,"vald-aosta":Xr,valdaosta:Xr,"valle-aosta":Xr,"valle-d-aosta":Xr,"valle-daosta":Xr,valleaosta:Xr,"valled-aosta":Xr,valledaosta:Xr,"vallee-aoste":Xr,"xn--valle-aoste-ebb":Xr,"vallée-aoste":Xr,"vallee-d-aoste":Xr,"xn--valle-d-aoste-ehb":Xr,"vallée-d-aoste":Xr,valleeaoste:Xr,"xn--valleaoste-e7a":Xr,valléeaoste:Xr,valleedaoste:Xr,"xn--valledaoste-ebb":Xr,valléedaoste:Xr,vao:Xr,vda:Xr,ven:Xr,veneto:Xr,ag:Xr,agrigento:Xr,al:Xr,alessandria:Xr,"alto-adige":Xr,altoadige:Xr,an:Xr,ancona:Xr,"andria-barletta-trani":Xr,"andria-trani-barletta":Xr,andriabarlettatrani:Xr,andriatranibarletta:Xr,ao:Xr,aosta:Xr,aoste:Xr,ap:Xr,aq:Xr,aquila:Xr,ar:Xr,arezzo:Xr,"ascoli-piceno":Xr,ascolipiceno:Xr,asti:Xr,at:Xr,av:Xr,avellino:Xr,ba:Xr,"balsan-sudtirol":Xr,"xn--balsan-sdtirol-nsb":Xr,"balsan-südtirol":Xr,"balsan-suedtirol":Xr,balsan:Xr,bari:Xr,"barletta-trani-andria":Xr,barlettatraniandria:Xr,belluno:Xr,benevento:Xr,bergamo:Xr,bg:Xr,bi:Xr,biella:Xr,bl:Xr,bn:Xr,bo:Xr,bologna:Xr,"bolzano-altoadige":Xr,bolzano:Xr,"bozen-sudtirol":Xr,"xn--bozen-sdtirol-2ob":Xr,"bozen-südtirol":Xr,"bozen-suedtirol":Xr,bozen:Xr,br:Xr,brescia:Xr,brindisi:Xr,bs:Xr,bt:Xr,"bulsan-sudtirol":Xr,"xn--bulsan-sdtirol-nsb":Xr,"bulsan-südtirol":Xr,"bulsan-suedtirol":Xr,bulsan:Xr,bz:Xr,ca:Xr,cagliari:Xr,caltanissetta:Xr,"campidano-medio":Xr,campidanomedio:Xr,campobasso:Xr,"carbonia-iglesias":Xr,carboniaiglesias:Xr,"carrara-massa":Xr,carraramassa:Xr,caserta:Xr,catania:Xr,catanzaro:Xr,cb:Xr,ce:Xr,"cesena-forli":Xr,"xn--cesena-forl-mcb":Xr,"cesena-forlì":Xr,cesenaforli:Xr,"xn--cesenaforl-i8a":Xr,cesenaforlì:Xr,ch:Xr,chieti:Xr,ci:Xr,cl:Xr,cn:Xr,co:Xr,como:Xr,cosenza:Xr,cr:Xr,cremona:Xr,crotone:Xr,cs:Xr,ct:Xr,cuneo:Xr,cz:Xr,"dell-ogliastra":Xr,dellogliastra:Xr,en:Xr,enna:Xr,fc:Xr,fe:Xr,fermo:Xr,ferrara:Xr,fg:Xr,fi:Xr,firenze:Xr,florence:Xr,fm:Xr,foggia:Xr,"forli-cesena":Xr,"xn--forl-cesena-fcb":Xr,"forlì-cesena":Xr,forlicesena:Xr,"xn--forlcesena-c8a":Xr,forlìcesena:Xr,fr:Xr,frosinone:Xr,ge:Xr,genoa:Xr,genova:Xr,go:Xr,gorizia:Xr,gr:Xr,grosseto:Xr,"iglesias-carbonia":Xr,iglesiascarbonia:Xr,im:Xr,imperia:Xr,is:Xr,isernia:Xr,kr:Xr,"la-spezia":Xr,laquila:Xr,laspezia:Xr,latina:Xr,lc:Xr,le:Xr,lecce:Xr,lecco:Xr,li:Xr,livorno:Xr,lo:Xr,lodi:Xr,lt:Xr,lu:Xr,lucca:Xr,macerata:Xr,mantova:Xr,"massa-carrara":Xr,massacarrara:Xr,matera:Xr,mb:Xr,mc:Xr,me:Xr,"medio-campidano":Xr,mediocampidano:Xr,messina:Xr,mi:Xr,milan:Xr,milano:Xr,mn:Xr,mo:Xr,modena:Xr,"monza-brianza":Xr,"monza-e-della-brianza":Xr,monza:Xr,monzabrianza:Xr,monzaebrianza:Xr,monzaedellabrianza:Xr,ms:Xr,mt:Xr,na:Xr,naples:Xr,napoli:Xr,no:Xr,novara:Xr,nu:Xr,nuoro:Xr,og:Xr,ogliastra:Xr,"olbia-tempio":Xr,olbiatempio:Xr,or:Xr,oristano:Xr,ot:Xr,pa:Xr,padova:Xr,padua:Xr,palermo:Xr,parma:Xr,pavia:Xr,pc:Xr,pd:Xr,pe:Xr,perugia:Xr,"pesaro-urbino":Xr,pesarourbino:Xr,pescara:Xr,pg:Xr,pi:Xr,piacenza:Xr,pisa:Xr,pistoia:Xr,pn:Xr,po:Xr,pordenone:Xr,potenza:Xr,pr:Xr,prato:Xr,pt:Xr,pu:Xr,pv:Xr,pz:Xr,ra:Xr,ragusa:Xr,ravenna:Xr,rc:Xr,re:Xr,"reggio-calabria":Xr,"reggio-emilia":Xr,reggiocalabria:Xr,reggioemilia:Xr,rg:Xr,ri:Xr,rieti:Xr,rimini:Xr,rm:Xr,rn:Xr,ro:Xr,roma:Xr,rome:Xr,rovigo:Xr,sa:Xr,salerno:Xr,sassari:Xr,savona:Xr,si:Xr,siena:Xr,siracusa:Xr,so:Xr,sondrio:Xr,sp:Xr,sr:Xr,ss:Xr,suedtirol:Xr,"xn--sdtirol-n2a":Xr,südtirol:Xr,sv:Xr,ta:Xr,taranto:Xr,te:Xr,"tempio-olbia":Xr,tempioolbia:Xr,teramo:Xr,terni:Xr,tn:Xr,to:Xr,torino:Xr,tp:Xr,tr:Xr,"trani-andria-barletta":Xr,"trani-barletta-andria":Xr,traniandriabarletta:Xr,tranibarlettaandria:Xr,trapani:Xr,trento:Xr,treviso:Xr,trieste:Xr,ts:Xr,turin:Xr,tv:Xr,ud:Xr,udine:Xr,"urbino-pesaro":Xr,urbinopesaro:Xr,va:Xr,varese:Xr,vb:Xr,vc:Xr,ve:Xr,venezia:Xr,venice:Xr,verbania:Xr,vercelli:Xr,verona:Xr,vi:Xr,"vibo-valentia":Xr,vibovalentia:Xr,vicenza:Xr,viterbo:Xr,vr:Xr,vs:Xr,vt:Xr,vv:Xr,blogspot:eo,ibxos:eo,iliadboxos:eo,neen:[0,{jc:eo}],tim:[0,{open:[0,{jelastic:ao}]}],"16-b":eo,"32-b":eo,"64-b":eo,"123homepage":eo,myspreadshop:eo,syncloud:eo}],je:[1,{co:Xr,net:Xr,org:Xr,of:eo}],jm:oo,jo:[1,{com:Xr,org:Xr,net:Xr,edu:Xr,sch:Xr,gov:Xr,mil:Xr,name:Xr}],jobs:Xr,jp:[1,{ac:Xr,ad:Xr,co:Xr,ed:Xr,go:Xr,gr:Xr,lg:Xr,ne:[1,{aseinet:Bo,gehirn:eo,ivory:eo,"mail-box":eo,mints:eo,mokuren:eo,opal:eo,sakura:eo,sumomo:eo,topaz:eo}],or:Xr,aichi:[1,{aisai:Xr,ama:Xr,anjo:Xr,asuke:Xr,chiryu:Xr,chita:Xr,fuso:Xr,gamagori:Xr,handa:Xr,hazu:Xr,hekinan:Xr,higashiura:Xr,ichinomiya:Xr,inazawa:Xr,inuyama:Xr,isshiki:Xr,iwakura:Xr,kanie:Xr,kariya:Xr,kasugai:Xr,kira:Xr,kiyosu:Xr,komaki:Xr,konan:Xr,kota:Xr,mihama:Xr,miyoshi:Xr,nishio:Xr,nisshin:Xr,obu:Xr,oguchi:Xr,oharu:Xr,okazaki:Xr,owariasahi:Xr,seto:Xr,shikatsu:Xr,shinshiro:Xr,shitara:Xr,tahara:Xr,takahama:Xr,tobishima:Xr,toei:Xr,togo:Xr,tokai:Xr,tokoname:Xr,toyoake:Xr,toyohashi:Xr,toyokawa:Xr,toyone:Xr,toyota:Xr,tsushima:Xr,yatomi:Xr}],akita:[1,{akita:Xr,daisen:Xr,fujisato:Xr,gojome:Xr,hachirogata:Xr,happou:Xr,higashinaruse:Xr,honjo:Xr,honjyo:Xr,ikawa:Xr,kamikoani:Xr,kamioka:Xr,katagami:Xr,kazuno:Xr,kitaakita:Xr,kosaka:Xr,kyowa:Xr,misato:Xr,mitane:Xr,moriyoshi:Xr,nikaho:Xr,noshiro:Xr,odate:Xr,oga:Xr,ogata:Xr,semboku:Xr,yokote:Xr,yurihonjo:Xr}],aomori:[1,{aomori:Xr,gonohe:Xr,hachinohe:Xr,hashikami:Xr,hiranai:Xr,hirosaki:Xr,itayanagi:Xr,kuroishi:Xr,misawa:Xr,mutsu:Xr,nakadomari:Xr,noheji:Xr,oirase:Xr,owani:Xr,rokunohe:Xr,sannohe:Xr,shichinohe:Xr,shingo:Xr,takko:Xr,towada:Xr,tsugaru:Xr,tsuruta:Xr}],chiba:[1,{abiko:Xr,asahi:Xr,chonan:Xr,chosei:Xr,choshi:Xr,chuo:Xr,funabashi:Xr,futtsu:Xr,hanamigawa:Xr,ichihara:Xr,ichikawa:Xr,ichinomiya:Xr,inzai:Xr,isumi:Xr,kamagaya:Xr,kamogawa:Xr,kashiwa:Xr,katori:Xr,katsuura:Xr,kimitsu:Xr,kisarazu:Xr,kozaki:Xr,kujukuri:Xr,kyonan:Xr,matsudo:Xr,midori:Xr,mihama:Xr,minamiboso:Xr,mobara:Xr,mutsuzawa:Xr,nagara:Xr,nagareyama:Xr,narashino:Xr,narita:Xr,noda:Xr,oamishirasato:Xr,omigawa:Xr,onjuku:Xr,otaki:Xr,sakae:Xr,sakura:Xr,shimofusa:Xr,shirako:Xr,shiroi:Xr,shisui:Xr,sodegaura:Xr,sosa:Xr,tako:Xr,tateyama:Xr,togane:Xr,tohnosho:Xr,tomisato:Xr,urayasu:Xr,yachimata:Xr,yachiyo:Xr,yokaichiba:Xr,yokoshibahikari:Xr,yotsukaido:Xr}],ehime:[1,{ainan:Xr,honai:Xr,ikata:Xr,imabari:Xr,iyo:Xr,kamijima:Xr,kihoku:Xr,kumakogen:Xr,masaki:Xr,matsuno:Xr,matsuyama:Xr,namikata:Xr,niihama:Xr,ozu:Xr,saijo:Xr,seiyo:Xr,shikokuchuo:Xr,tobe:Xr,toon:Xr,uchiko:Xr,uwajima:Xr,yawatahama:Xr}],fukui:[1,{echizen:Xr,eiheiji:Xr,fukui:Xr,ikeda:Xr,katsuyama:Xr,mihama:Xr,minamiechizen:Xr,obama:Xr,ohi:Xr,ono:Xr,sabae:Xr,sakai:Xr,takahama:Xr,tsuruga:Xr,wakasa:Xr}],fukuoka:[1,{ashiya:Xr,buzen:Xr,chikugo:Xr,chikuho:Xr,chikujo:Xr,chikushino:Xr,chikuzen:Xr,chuo:Xr,dazaifu:Xr,fukuchi:Xr,hakata:Xr,higashi:Xr,hirokawa:Xr,hisayama:Xr,iizuka:Xr,inatsuki:Xr,kaho:Xr,kasuga:Xr,kasuya:Xr,kawara:Xr,keisen:Xr,koga:Xr,kurate:Xr,kurogi:Xr,kurume:Xr,minami:Xr,miyako:Xr,miyama:Xr,miyawaka:Xr,mizumaki:Xr,munakata:Xr,nakagawa:Xr,nakama:Xr,nishi:Xr,nogata:Xr,ogori:Xr,okagaki:Xr,okawa:Xr,oki:Xr,omuta:Xr,onga:Xr,onojo:Xr,oto:Xr,saigawa:Xr,sasaguri:Xr,shingu:Xr,shinyoshitomi:Xr,shonai:Xr,soeda:Xr,sue:Xr,tachiarai:Xr,tagawa:Xr,takata:Xr,toho:Xr,toyotsu:Xr,tsuiki:Xr,ukiha:Xr,umi:Xr,usui:Xr,yamada:Xr,yame:Xr,yanagawa:Xr,yukuhashi:Xr}],fukushima:[1,{aizubange:Xr,aizumisato:Xr,aizuwakamatsu:Xr,asakawa:Xr,bandai:Xr,date:Xr,fukushima:Xr,furudono:Xr,futaba:Xr,hanawa:Xr,higashi:Xr,hirata:Xr,hirono:Xr,iitate:Xr,inawashiro:Xr,ishikawa:Xr,iwaki:Xr,izumizaki:Xr,kagamiishi:Xr,kaneyama:Xr,kawamata:Xr,kitakata:Xr,kitashiobara:Xr,koori:Xr,koriyama:Xr,kunimi:Xr,miharu:Xr,mishima:Xr,namie:Xr,nango:Xr,nishiaizu:Xr,nishigo:Xr,okuma:Xr,omotego:Xr,ono:Xr,otama:Xr,samegawa:Xr,shimogo:Xr,shirakawa:Xr,showa:Xr,soma:Xr,sukagawa:Xr,taishin:Xr,tamakawa:Xr,tanagura:Xr,tenei:Xr,yabuki:Xr,yamato:Xr,yamatsuri:Xr,yanaizu:Xr,yugawa:Xr}],gifu:[1,{anpachi:Xr,ena:Xr,gifu:Xr,ginan:Xr,godo:Xr,gujo:Xr,hashima:Xr,hichiso:Xr,hida:Xr,higashishirakawa:Xr,ibigawa:Xr,ikeda:Xr,kakamigahara:Xr,kani:Xr,kasahara:Xr,kasamatsu:Xr,kawaue:Xr,kitagata:Xr,mino:Xr,minokamo:Xr,mitake:Xr,mizunami:Xr,motosu:Xr,nakatsugawa:Xr,ogaki:Xr,sakahogi:Xr,seki:Xr,sekigahara:Xr,shirakawa:Xr,tajimi:Xr,takayama:Xr,tarui:Xr,toki:Xr,tomika:Xr,wanouchi:Xr,yamagata:Xr,yaotsu:Xr,yoro:Xr}],gunma:[1,{annaka:Xr,chiyoda:Xr,fujioka:Xr,higashiagatsuma:Xr,isesaki:Xr,itakura:Xr,kanna:Xr,kanra:Xr,katashina:Xr,kawaba:Xr,kiryu:Xr,kusatsu:Xr,maebashi:Xr,meiwa:Xr,midori:Xr,minakami:Xr,naganohara:Xr,nakanojo:Xr,nanmoku:Xr,numata:Xr,oizumi:Xr,ora:Xr,ota:Xr,shibukawa:Xr,shimonita:Xr,shinto:Xr,showa:Xr,takasaki:Xr,takayama:Xr,tamamura:Xr,tatebayashi:Xr,tomioka:Xr,tsukiyono:Xr,tsumagoi:Xr,ueno:Xr,yoshioka:Xr}],hiroshima:[1,{asaminami:Xr,daiwa:Xr,etajima:Xr,fuchu:Xr,fukuyama:Xr,hatsukaichi:Xr,higashihiroshima:Xr,hongo:Xr,jinsekikogen:Xr,kaita:Xr,kui:Xr,kumano:Xr,kure:Xr,mihara:Xr,miyoshi:Xr,naka:Xr,onomichi:Xr,osakikamijima:Xr,otake:Xr,saka:Xr,sera:Xr,seranishi:Xr,shinichi:Xr,shobara:Xr,takehara:Xr}],hokkaido:[1,{abashiri:Xr,abira:Xr,aibetsu:Xr,akabira:Xr,akkeshi:Xr,asahikawa:Xr,ashibetsu:Xr,ashoro:Xr,assabu:Xr,atsuma:Xr,bibai:Xr,biei:Xr,bifuka:Xr,bihoro:Xr,biratori:Xr,chippubetsu:Xr,chitose:Xr,date:Xr,ebetsu:Xr,embetsu:Xr,eniwa:Xr,erimo:Xr,esan:Xr,esashi:Xr,fukagawa:Xr,fukushima:Xr,furano:Xr,furubira:Xr,haboro:Xr,hakodate:Xr,hamatonbetsu:Xr,hidaka:Xr,higashikagura:Xr,higashikawa:Xr,hiroo:Xr,hokuryu:Xr,hokuto:Xr,honbetsu:Xr,horokanai:Xr,horonobe:Xr,ikeda:Xr,imakane:Xr,ishikari:Xr,iwamizawa:Xr,iwanai:Xr,kamifurano:Xr,kamikawa:Xr,kamishihoro:Xr,kamisunagawa:Xr,kamoenai:Xr,kayabe:Xr,kembuchi:Xr,kikonai:Xr,kimobetsu:Xr,kitahiroshima:Xr,kitami:Xr,kiyosato:Xr,koshimizu:Xr,kunneppu:Xr,kuriyama:Xr,kuromatsunai:Xr,kushiro:Xr,kutchan:Xr,kyowa:Xr,mashike:Xr,matsumae:Xr,mikasa:Xr,minamifurano:Xr,mombetsu:Xr,moseushi:Xr,mukawa:Xr,muroran:Xr,naie:Xr,nakagawa:Xr,nakasatsunai:Xr,nakatombetsu:Xr,nanae:Xr,nanporo:Xr,nayoro:Xr,nemuro:Xr,niikappu:Xr,niki:Xr,nishiokoppe:Xr,noboribetsu:Xr,numata:Xr,obihiro:Xr,obira:Xr,oketo:Xr,okoppe:Xr,otaru:Xr,otobe:Xr,otofuke:Xr,otoineppu:Xr,oumu:Xr,ozora:Xr,pippu:Xr,rankoshi:Xr,rebun:Xr,rikubetsu:Xr,rishiri:Xr,rishirifuji:Xr,saroma:Xr,sarufutsu:Xr,shakotan:Xr,shari:Xr,shibecha:Xr,shibetsu:Xr,shikabe:Xr,shikaoi:Xr,shimamaki:Xr,shimizu:Xr,shimokawa:Xr,shinshinotsu:Xr,shintoku:Xr,shiranuka:Xr,shiraoi:Xr,shiriuchi:Xr,sobetsu:Xr,sunagawa:Xr,taiki:Xr,takasu:Xr,takikawa:Xr,takinoue:Xr,teshikaga:Xr,tobetsu:Xr,tohma:Xr,tomakomai:Xr,tomari:Xr,toya:Xr,toyako:Xr,toyotomi:Xr,toyoura:Xr,tsubetsu:Xr,tsukigata:Xr,urakawa:Xr,urausu:Xr,uryu:Xr,utashinai:Xr,wakkanai:Xr,wassamu:Xr,yakumo:Xr,yoichi:Xr}],hyogo:[1,{aioi:Xr,akashi:Xr,ako:Xr,amagasaki:Xr,aogaki:Xr,asago:Xr,ashiya:Xr,awaji:Xr,fukusaki:Xr,goshiki:Xr,harima:Xr,himeji:Xr,ichikawa:Xr,inagawa:Xr,itami:Xr,kakogawa:Xr,kamigori:Xr,kamikawa:Xr,kasai:Xr,kasuga:Xr,kawanishi:Xr,miki:Xr,minamiawaji:Xr,nishinomiya:Xr,nishiwaki:Xr,ono:Xr,sanda:Xr,sannan:Xr,sasayama:Xr,sayo:Xr,shingu:Xr,shinonsen:Xr,shiso:Xr,sumoto:Xr,taishi:Xr,taka:Xr,takarazuka:Xr,takasago:Xr,takino:Xr,tamba:Xr,tatsuno:Xr,toyooka:Xr,yabu:Xr,yashiro:Xr,yoka:Xr,yokawa:Xr}],ibaraki:[1,{ami:Xr,asahi:Xr,bando:Xr,chikusei:Xr,daigo:Xr,fujishiro:Xr,hitachi:Xr,hitachinaka:Xr,hitachiomiya:Xr,hitachiota:Xr,ibaraki:Xr,ina:Xr,inashiki:Xr,itako:Xr,iwama:Xr,joso:Xr,kamisu:Xr,kasama:Xr,kashima:Xr,kasumigaura:Xr,koga:Xr,miho:Xr,mito:Xr,moriya:Xr,naka:Xr,namegata:Xr,oarai:Xr,ogawa:Xr,omitama:Xr,ryugasaki:Xr,sakai:Xr,sakuragawa:Xr,shimodate:Xr,shimotsuma:Xr,shirosato:Xr,sowa:Xr,suifu:Xr,takahagi:Xr,tamatsukuri:Xr,tokai:Xr,tomobe:Xr,tone:Xr,toride:Xr,tsuchiura:Xr,tsukuba:Xr,uchihara:Xr,ushiku:Xr,yachiyo:Xr,yamagata:Xr,yawara:Xr,yuki:Xr}],ishikawa:[1,{anamizu:Xr,hakui:Xr,hakusan:Xr,kaga:Xr,kahoku:Xr,kanazawa:Xr,kawakita:Xr,komatsu:Xr,nakanoto:Xr,nanao:Xr,nomi:Xr,nonoichi:Xr,noto:Xr,shika:Xr,suzu:Xr,tsubata:Xr,tsurugi:Xr,uchinada:Xr,wajima:Xr}],iwate:[1,{fudai:Xr,fujisawa:Xr,hanamaki:Xr,hiraizumi:Xr,hirono:Xr,ichinohe:Xr,ichinoseki:Xr,iwaizumi:Xr,iwate:Xr,joboji:Xr,kamaishi:Xr,kanegasaki:Xr,karumai:Xr,kawai:Xr,kitakami:Xr,kuji:Xr,kunohe:Xr,kuzumaki:Xr,miyako:Xr,mizusawa:Xr,morioka:Xr,ninohe:Xr,noda:Xr,ofunato:Xr,oshu:Xr,otsuchi:Xr,rikuzentakata:Xr,shiwa:Xr,shizukuishi:Xr,sumita:Xr,tanohata:Xr,tono:Xr,yahaba:Xr,yamada:Xr}],kagawa:[1,{ayagawa:Xr,higashikagawa:Xr,kanonji:Xr,kotohira:Xr,manno:Xr,marugame:Xr,mitoyo:Xr,naoshima:Xr,sanuki:Xr,tadotsu:Xr,takamatsu:Xr,tonosho:Xr,uchinomi:Xr,utazu:Xr,zentsuji:Xr}],kagoshima:[1,{akune:Xr,amami:Xr,hioki:Xr,isa:Xr,isen:Xr,izumi:Xr,kagoshima:Xr,kanoya:Xr,kawanabe:Xr,kinko:Xr,kouyama:Xr,makurazaki:Xr,matsumoto:Xr,minamitane:Xr,nakatane:Xr,nishinoomote:Xr,satsumasendai:Xr,soo:Xr,tarumizu:Xr,yusui:Xr}],kanagawa:[1,{aikawa:Xr,atsugi:Xr,ayase:Xr,chigasaki:Xr,ebina:Xr,fujisawa:Xr,hadano:Xr,hakone:Xr,hiratsuka:Xr,isehara:Xr,kaisei:Xr,kamakura:Xr,kiyokawa:Xr,matsuda:Xr,minamiashigara:Xr,miura:Xr,nakai:Xr,ninomiya:Xr,odawara:Xr,oi:Xr,oiso:Xr,sagamihara:Xr,samukawa:Xr,tsukui:Xr,yamakita:Xr,yamato:Xr,yokosuka:Xr,yugawara:Xr,zama:Xr,zushi:Xr}],kochi:[1,{aki:Xr,geisei:Xr,hidaka:Xr,higashitsuno:Xr,ino:Xr,kagami:Xr,kami:Xr,kitagawa:Xr,kochi:Xr,mihara:Xr,motoyama:Xr,muroto:Xr,nahari:Xr,nakamura:Xr,nankoku:Xr,nishitosa:Xr,niyodogawa:Xr,ochi:Xr,okawa:Xr,otoyo:Xr,otsuki:Xr,sakawa:Xr,sukumo:Xr,susaki:Xr,tosa:Xr,tosashimizu:Xr,toyo:Xr,tsuno:Xr,umaji:Xr,yasuda:Xr,yusuhara:Xr}],kumamoto:[1,{amakusa:Xr,arao:Xr,aso:Xr,choyo:Xr,gyokuto:Xr,kamiamakusa:Xr,kikuchi:Xr,kumamoto:Xr,mashiki:Xr,mifune:Xr,minamata:Xr,minamioguni:Xr,nagasu:Xr,nishihara:Xr,oguni:Xr,ozu:Xr,sumoto:Xr,takamori:Xr,uki:Xr,uto:Xr,yamaga:Xr,yamato:Xr,yatsushiro:Xr}],kyoto:[1,{ayabe:Xr,fukuchiyama:Xr,higashiyama:Xr,ide:Xr,ine:Xr,joyo:Xr,kameoka:Xr,kamo:Xr,kita:Xr,kizu:Xr,kumiyama:Xr,kyotamba:Xr,kyotanabe:Xr,kyotango:Xr,maizuru:Xr,minami:Xr,minamiyamashiro:Xr,miyazu:Xr,muko:Xr,nagaokakyo:Xr,nakagyo:Xr,nantan:Xr,oyamazaki:Xr,sakyo:Xr,seika:Xr,tanabe:Xr,uji:Xr,ujitawara:Xr,wazuka:Xr,yamashina:Xr,yawata:Xr}],mie:[1,{asahi:Xr,inabe:Xr,ise:Xr,kameyama:Xr,kawagoe:Xr,kiho:Xr,kisosaki:Xr,kiwa:Xr,komono:Xr,kumano:Xr,kuwana:Xr,matsusaka:Xr,meiwa:Xr,mihama:Xr,minamiise:Xr,misugi:Xr,miyama:Xr,nabari:Xr,shima:Xr,suzuka:Xr,tado:Xr,taiki:Xr,taki:Xr,tamaki:Xr,toba:Xr,tsu:Xr,udono:Xr,ureshino:Xr,watarai:Xr,yokkaichi:Xr}],miyagi:[1,{furukawa:Xr,higashimatsushima:Xr,ishinomaki:Xr,iwanuma:Xr,kakuda:Xr,kami:Xr,kawasaki:Xr,marumori:Xr,matsushima:Xr,minamisanriku:Xr,misato:Xr,murata:Xr,natori:Xr,ogawara:Xr,ohira:Xr,onagawa:Xr,osaki:Xr,rifu:Xr,semine:Xr,shibata:Xr,shichikashuku:Xr,shikama:Xr,shiogama:Xr,shiroishi:Xr,tagajo:Xr,taiwa:Xr,tome:Xr,tomiya:Xr,wakuya:Xr,watari:Xr,yamamoto:Xr,zao:Xr}],miyazaki:[1,{aya:Xr,ebino:Xr,gokase:Xr,hyuga:Xr,kadogawa:Xr,kawaminami:Xr,kijo:Xr,kitagawa:Xr,kitakata:Xr,kitaura:Xr,kobayashi:Xr,kunitomi:Xr,kushima:Xr,mimata:Xr,miyakonojo:Xr,miyazaki:Xr,morotsuka:Xr,nichinan:Xr,nishimera:Xr,nobeoka:Xr,saito:Xr,shiiba:Xr,shintomi:Xr,takaharu:Xr,takanabe:Xr,takazaki:Xr,tsuno:Xr}],nagano:[1,{achi:Xr,agematsu:Xr,anan:Xr,aoki:Xr,asahi:Xr,azumino:Xr,chikuhoku:Xr,chikuma:Xr,chino:Xr,fujimi:Xr,hakuba:Xr,hara:Xr,hiraya:Xr,iida:Xr,iijima:Xr,iiyama:Xr,iizuna:Xr,ikeda:Xr,ikusaka:Xr,ina:Xr,karuizawa:Xr,kawakami:Xr,kiso:Xr,kisofukushima:Xr,kitaaiki:Xr,komagane:Xr,komoro:Xr,matsukawa:Xr,matsumoto:Xr,miasa:Xr,minamiaiki:Xr,minamimaki:Xr,minamiminowa:Xr,minowa:Xr,miyada:Xr,miyota:Xr,mochizuki:Xr,nagano:Xr,nagawa:Xr,nagiso:Xr,nakagawa:Xr,nakano:Xr,nozawaonsen:Xr,obuse:Xr,ogawa:Xr,okaya:Xr,omachi:Xr,omi:Xr,ookuwa:Xr,ooshika:Xr,otaki:Xr,otari:Xr,sakae:Xr,sakaki:Xr,saku:Xr,sakuho:Xr,shimosuwa:Xr,shinanomachi:Xr,shiojiri:Xr,suwa:Xr,suzaka:Xr,takagi:Xr,takamori:Xr,takayama:Xr,tateshina:Xr,tatsuno:Xr,togakushi:Xr,togura:Xr,tomi:Xr,ueda:Xr,wada:Xr,yamagata:Xr,yamanouchi:Xr,yasaka:Xr,yasuoka:Xr}],nagasaki:[1,{chijiwa:Xr,futsu:Xr,goto:Xr,hasami:Xr,hirado:Xr,iki:Xr,isahaya:Xr,kawatana:Xr,kuchinotsu:Xr,matsuura:Xr,nagasaki:Xr,obama:Xr,omura:Xr,oseto:Xr,saikai:Xr,sasebo:Xr,seihi:Xr,shimabara:Xr,shinkamigoto:Xr,togitsu:Xr,tsushima:Xr,unzen:Xr}],nara:[1,{ando:Xr,gose:Xr,heguri:Xr,higashiyoshino:Xr,ikaruga:Xr,ikoma:Xr,kamikitayama:Xr,kanmaki:Xr,kashiba:Xr,kashihara:Xr,katsuragi:Xr,kawai:Xr,kawakami:Xr,kawanishi:Xr,koryo:Xr,kurotaki:Xr,mitsue:Xr,miyake:Xr,nara:Xr,nosegawa:Xr,oji:Xr,ouda:Xr,oyodo:Xr,sakurai:Xr,sango:Xr,shimoichi:Xr,shimokitayama:Xr,shinjo:Xr,soni:Xr,takatori:Xr,tawaramoto:Xr,tenkawa:Xr,tenri:Xr,uda:Xr,yamatokoriyama:Xr,yamatotakada:Xr,yamazoe:Xr,yoshino:Xr}],niigata:[1,{aga:Xr,agano:Xr,gosen:Xr,itoigawa:Xr,izumozaki:Xr,joetsu:Xr,kamo:Xr,kariwa:Xr,kashiwazaki:Xr,minamiuonuma:Xr,mitsuke:Xr,muika:Xr,murakami:Xr,myoko:Xr,nagaoka:Xr,niigata:Xr,ojiya:Xr,omi:Xr,sado:Xr,sanjo:Xr,seiro:Xr,seirou:Xr,sekikawa:Xr,shibata:Xr,tagami:Xr,tainai:Xr,tochio:Xr,tokamachi:Xr,tsubame:Xr,tsunan:Xr,uonuma:Xr,yahiko:Xr,yoita:Xr,yuzawa:Xr}],oita:[1,{beppu:Xr,bungoono:Xr,bungotakada:Xr,hasama:Xr,hiji:Xr,himeshima:Xr,hita:Xr,kamitsue:Xr,kokonoe:Xr,kuju:Xr,kunisaki:Xr,kusu:Xr,oita:Xr,saiki:Xr,taketa:Xr,tsukumi:Xr,usa:Xr,usuki:Xr,yufu:Xr}],okayama:[1,{akaiwa:Xr,asakuchi:Xr,bizen:Xr,hayashima:Xr,ibara:Xr,kagamino:Xr,kasaoka:Xr,kibichuo:Xr,kumenan:Xr,kurashiki:Xr,maniwa:Xr,misaki:Xr,nagi:Xr,niimi:Xr,nishiawakura:Xr,okayama:Xr,satosho:Xr,setouchi:Xr,shinjo:Xr,shoo:Xr,soja:Xr,takahashi:Xr,tamano:Xr,tsuyama:Xr,wake:Xr,yakage:Xr}],okinawa:[1,{aguni:Xr,ginowan:Xr,ginoza:Xr,gushikami:Xr,haebaru:Xr,higashi:Xr,hirara:Xr,iheya:Xr,ishigaki:Xr,ishikawa:Xr,itoman:Xr,izena:Xr,kadena:Xr,kin:Xr,kitadaito:Xr,kitanakagusuku:Xr,kumejima:Xr,kunigami:Xr,minamidaito:Xr,motobu:Xr,nago:Xr,naha:Xr,nakagusuku:Xr,nakijin:Xr,nanjo:Xr,nishihara:Xr,ogimi:Xr,okinawa:Xr,onna:Xr,shimoji:Xr,taketomi:Xr,tarama:Xr,tokashiki:Xr,tomigusuku:Xr,tonaki:Xr,urasoe:Xr,uruma:Xr,yaese:Xr,yomitan:Xr,yonabaru:Xr,yonaguni:Xr,zamami:Xr}],osaka:[1,{abeno:Xr,chihayaakasaka:Xr,chuo:Xr,daito:Xr,fujiidera:Xr,habikino:Xr,hannan:Xr,higashiosaka:Xr,higashisumiyoshi:Xr,higashiyodogawa:Xr,hirakata:Xr,ibaraki:Xr,ikeda:Xr,izumi:Xr,izumiotsu:Xr,izumisano:Xr,kadoma:Xr,kaizuka:Xr,kanan:Xr,kashiwara:Xr,katano:Xr,kawachinagano:Xr,kishiwada:Xr,kita:Xr,kumatori:Xr,matsubara:Xr,minato:Xr,minoh:Xr,misaki:Xr,moriguchi:Xr,neyagawa:Xr,nishi:Xr,nose:Xr,osakasayama:Xr,sakai:Xr,sayama:Xr,sennan:Xr,settsu:Xr,shijonawate:Xr,shimamoto:Xr,suita:Xr,tadaoka:Xr,taishi:Xr,tajiri:Xr,takaishi:Xr,takatsuki:Xr,tondabayashi:Xr,toyonaka:Xr,toyono:Xr,yao:Xr}],saga:[1,{ariake:Xr,arita:Xr,fukudomi:Xr,genkai:Xr,hamatama:Xr,hizen:Xr,imari:Xr,kamimine:Xr,kanzaki:Xr,karatsu:Xr,kashima:Xr,kitagata:Xr,kitahata:Xr,kiyama:Xr,kouhoku:Xr,kyuragi:Xr,nishiarita:Xr,ogi:Xr,omachi:Xr,ouchi:Xr,saga:Xr,shiroishi:Xr,taku:Xr,tara:Xr,tosu:Xr,yoshinogari:Xr}],saitama:[1,{arakawa:Xr,asaka:Xr,chichibu:Xr,fujimi:Xr,fujimino:Xr,fukaya:Xr,hanno:Xr,hanyu:Xr,hasuda:Xr,hatogaya:Xr,hatoyama:Xr,hidaka:Xr,higashichichibu:Xr,higashimatsuyama:Xr,honjo:Xr,ina:Xr,iruma:Xr,iwatsuki:Xr,kamiizumi:Xr,kamikawa:Xr,kamisato:Xr,kasukabe:Xr,kawagoe:Xr,kawaguchi:Xr,kawajima:Xr,kazo:Xr,kitamoto:Xr,koshigaya:Xr,kounosu:Xr,kuki:Xr,kumagaya:Xr,matsubushi:Xr,minano:Xr,misato:Xr,miyashiro:Xr,miyoshi:Xr,moroyama:Xr,nagatoro:Xr,namegawa:Xr,niiza:Xr,ogano:Xr,ogawa:Xr,ogose:Xr,okegawa:Xr,omiya:Xr,otaki:Xr,ranzan:Xr,ryokami:Xr,saitama:Xr,sakado:Xr,satte:Xr,sayama:Xr,shiki:Xr,shiraoka:Xr,soka:Xr,sugito:Xr,toda:Xr,tokigawa:Xr,tokorozawa:Xr,tsurugashima:Xr,urawa:Xr,warabi:Xr,yashio:Xr,yokoze:Xr,yono:Xr,yorii:Xr,yoshida:Xr,yoshikawa:Xr,yoshimi:Xr}],shiga:[1,{aisho:Xr,gamo:Xr,higashiomi:Xr,hikone:Xr,koka:Xr,konan:Xr,kosei:Xr,koto:Xr,kusatsu:Xr,maibara:Xr,moriyama:Xr,nagahama:Xr,nishiazai:Xr,notogawa:Xr,omihachiman:Xr,otsu:Xr,ritto:Xr,ryuoh:Xr,takashima:Xr,takatsuki:Xr,torahime:Xr,toyosato:Xr,yasu:Xr}],shimane:[1,{akagi:Xr,ama:Xr,gotsu:Xr,hamada:Xr,higashiizumo:Xr,hikawa:Xr,hikimi:Xr,izumo:Xr,kakinoki:Xr,masuda:Xr,matsue:Xr,misato:Xr,nishinoshima:Xr,ohda:Xr,okinoshima:Xr,okuizumo:Xr,shimane:Xr,tamayu:Xr,tsuwano:Xr,unnan:Xr,yakumo:Xr,yasugi:Xr,yatsuka:Xr}],shizuoka:[1,{arai:Xr,atami:Xr,fuji:Xr,fujieda:Xr,fujikawa:Xr,fujinomiya:Xr,fukuroi:Xr,gotemba:Xr,haibara:Xr,hamamatsu:Xr,higashiizu:Xr,ito:Xr,iwata:Xr,izu:Xr,izunokuni:Xr,kakegawa:Xr,kannami:Xr,kawanehon:Xr,kawazu:Xr,kikugawa:Xr,kosai:Xr,makinohara:Xr,matsuzaki:Xr,minamiizu:Xr,mishima:Xr,morimachi:Xr,nishiizu:Xr,numazu:Xr,omaezaki:Xr,shimada:Xr,shimizu:Xr,shimoda:Xr,shizuoka:Xr,susono:Xr,yaizu:Xr,yoshida:Xr}],tochigi:[1,{ashikaga:Xr,bato:Xr,haga:Xr,ichikai:Xr,iwafune:Xr,kaminokawa:Xr,kanuma:Xr,karasuyama:Xr,kuroiso:Xr,mashiko:Xr,mibu:Xr,moka:Xr,motegi:Xr,nasu:Xr,nasushiobara:Xr,nikko:Xr,nishikata:Xr,nogi:Xr,ohira:Xr,ohtawara:Xr,oyama:Xr,sakura:Xr,sano:Xr,shimotsuke:Xr,shioya:Xr,takanezawa:Xr,tochigi:Xr,tsuga:Xr,ujiie:Xr,utsunomiya:Xr,yaita:Xr}],tokushima:[1,{aizumi:Xr,anan:Xr,ichiba:Xr,itano:Xr,kainan:Xr,komatsushima:Xr,matsushige:Xr,mima:Xr,minami:Xr,miyoshi:Xr,mugi:Xr,nakagawa:Xr,naruto:Xr,sanagochi:Xr,shishikui:Xr,tokushima:Xr,wajiki:Xr}],tokyo:[1,{adachi:Xr,akiruno:Xr,akishima:Xr,aogashima:Xr,arakawa:Xr,bunkyo:Xr,chiyoda:Xr,chofu:Xr,chuo:Xr,edogawa:Xr,fuchu:Xr,fussa:Xr,hachijo:Xr,hachioji:Xr,hamura:Xr,higashikurume:Xr,higashimurayama:Xr,higashiyamato:Xr,hino:Xr,hinode:Xr,hinohara:Xr,inagi:Xr,itabashi:Xr,katsushika:Xr,kita:Xr,kiyose:Xr,kodaira:Xr,koganei:Xr,kokubunji:Xr,komae:Xr,koto:Xr,kouzushima:Xr,kunitachi:Xr,machida:Xr,meguro:Xr,minato:Xr,mitaka:Xr,mizuho:Xr,musashimurayama:Xr,musashino:Xr,nakano:Xr,nerima:Xr,ogasawara:Xr,okutama:Xr,ome:Xr,oshima:Xr,ota:Xr,setagaya:Xr,shibuya:Xr,shinagawa:Xr,shinjuku:Xr,suginami:Xr,sumida:Xr,tachikawa:Xr,taito:Xr,tama:Xr,toshima:Xr}],tottori:[1,{chizu:Xr,hino:Xr,kawahara:Xr,koge:Xr,kotoura:Xr,misasa:Xr,nanbu:Xr,nichinan:Xr,sakaiminato:Xr,tottori:Xr,wakasa:Xr,yazu:Xr,yonago:Xr}],toyama:[1,{asahi:Xr,fuchu:Xr,fukumitsu:Xr,funahashi:Xr,himi:Xr,imizu:Xr,inami:Xr,johana:Xr,kamiichi:Xr,kurobe:Xr,nakaniikawa:Xr,namerikawa:Xr,nanto:Xr,nyuzen:Xr,oyabe:Xr,taira:Xr,takaoka:Xr,tateyama:Xr,toga:Xr,tonami:Xr,toyama:Xr,unazuki:Xr,uozu:Xr,yamada:Xr}],wakayama:[1,{arida:Xr,aridagawa:Xr,gobo:Xr,hashimoto:Xr,hidaka:Xr,hirogawa:Xr,inami:Xr,iwade:Xr,kainan:Xr,kamitonda:Xr,katsuragi:Xr,kimino:Xr,kinokawa:Xr,kitayama:Xr,koya:Xr,koza:Xr,kozagawa:Xr,kudoyama:Xr,kushimoto:Xr,mihama:Xr,misato:Xr,nachikatsuura:Xr,shingu:Xr,shirahama:Xr,taiji:Xr,tanabe:Xr,wakayama:Xr,yuasa:Xr,yura:Xr}],yamagata:[1,{asahi:Xr,funagata:Xr,higashine:Xr,iide:Xr,kahoku:Xr,kaminoyama:Xr,kaneyama:Xr,kawanishi:Xr,mamurogawa:Xr,mikawa:Xr,murayama:Xr,nagai:Xr,nakayama:Xr,nanyo:Xr,nishikawa:Xr,obanazawa:Xr,oe:Xr,oguni:Xr,ohkura:Xr,oishida:Xr,sagae:Xr,sakata:Xr,sakegawa:Xr,shinjo:Xr,shirataka:Xr,shonai:Xr,takahata:Xr,tendo:Xr,tozawa:Xr,tsuruoka:Xr,yamagata:Xr,yamanobe:Xr,yonezawa:Xr,yuza:Xr}],yamaguchi:[1,{abu:Xr,hagi:Xr,hikari:Xr,hofu:Xr,iwakuni:Xr,kudamatsu:Xr,mitou:Xr,nagato:Xr,oshima:Xr,shimonoseki:Xr,shunan:Xr,tabuse:Xr,tokuyama:Xr,toyota:Xr,ube:Xr,yuu:Xr}],yamanashi:[1,{chuo:Xr,doshi:Xr,fuefuki:Xr,fujikawa:Xr,fujikawaguchiko:Xr,fujiyoshida:Xr,hayakawa:Xr,hokuto:Xr,ichikawamisato:Xr,kai:Xr,kofu:Xr,koshu:Xr,kosuge:Xr,"minami-alps":Xr,minobu:Xr,nakamichi:Xr,nanbu:Xr,narusawa:Xr,nirasaki:Xr,nishikatsura:Xr,oshino:Xr,otsuki:Xr,showa:Xr,tabayama:Xr,tsuru:Xr,uenohara:Xr,yamanakako:Xr,yamanashi:Xr}],"xn--4pvxs":Xr,栃木:Xr,"xn--vgu402c":Xr,愛知:Xr,"xn--c3s14m":Xr,愛媛:Xr,"xn--f6qx53a":Xr,兵庫:Xr,"xn--8pvr4u":Xr,熊本:Xr,"xn--uist22h":Xr,茨城:Xr,"xn--djrs72d6uy":Xr,北海道:Xr,"xn--mkru45i":Xr,千葉:Xr,"xn--0trq7p7nn":Xr,和歌山:Xr,"xn--8ltr62k":Xr,長崎:Xr,"xn--2m4a15e":Xr,長野:Xr,"xn--efvn9s":Xr,新潟:Xr,"xn--32vp30h":Xr,青森:Xr,"xn--4it797k":Xr,静岡:Xr,"xn--1lqs71d":Xr,東京:Xr,"xn--5rtp49c":Xr,石川:Xr,"xn--5js045d":Xr,埼玉:Xr,"xn--ehqz56n":Xr,三重:Xr,"xn--1lqs03n":Xr,京都:Xr,"xn--qqqt11m":Xr,佐賀:Xr,"xn--kbrq7o":Xr,大分:Xr,"xn--pssu33l":Xr,大阪:Xr,"xn--ntsq17g":Xr,奈良:Xr,"xn--uisz3g":Xr,宮城:Xr,"xn--6btw5a":Xr,宮崎:Xr,"xn--1ctwo":Xr,富山:Xr,"xn--6orx2r":Xr,山口:Xr,"xn--rht61e":Xr,山形:Xr,"xn--rht27z":Xr,山梨:Xr,"xn--djty4k":Xr,岩手:Xr,"xn--nit225k":Xr,岐阜:Xr,"xn--rht3d":Xr,岡山:Xr,"xn--klty5x":Xr,島根:Xr,"xn--kltx9a":Xr,広島:Xr,"xn--kltp7d":Xr,徳島:Xr,"xn--uuwu58a":Xr,沖縄:Xr,"xn--zbx025d":Xr,滋賀:Xr,"xn--ntso0iqx3a":Xr,神奈川:Xr,"xn--elqq16h":Xr,福井:Xr,"xn--4it168d":Xr,福岡:Xr,"xn--klt787d":Xr,福島:Xr,"xn--rny31h":Xr,秋田:Xr,"xn--7t0a264c":Xr,群馬:Xr,"xn--5rtq34k":Xr,香川:Xr,"xn--k7yn95e":Xr,高知:Xr,"xn--tor131o":Xr,鳥取:Xr,"xn--d5qv7z876c":Xr,鹿児島:Xr,kawasaki:oo,kitakyushu:oo,kobe:oo,nagoya:oo,sapporo:oo,sendai:oo,yokohama:oo,buyshop:eo,fashionstore:eo,handcrafted:eo,kawaiishop:eo,supersale:eo,theshop:eo,usercontent:eo,angry:eo,babyblue:eo,babymilk:eo,backdrop:eo,bambina:eo,bitter:eo,blush:eo,boo:eo,boy:eo,boyfriend:eo,but:eo,candypop:eo,capoo:eo,catfood:eo,cheap:eo,chicappa:eo,chillout:eo,chips:eo,chowder:eo,chu:eo,ciao:eo,cocotte:eo,coolblog:eo,cranky:eo,cutegirl:eo,daa:eo,deca:eo,deci:eo,digick:eo,egoism:eo,fakefur:eo,fem:eo,flier:eo,floppy:eo,fool:eo,frenchkiss:eo,girlfriend:eo,girly:eo,gloomy:eo,gonna:eo,greater:eo,hacca:eo,heavy:eo,her:eo,hiho:eo,hippy:eo,holy:eo,hungry:eo,icurus:eo,itigo:eo,jellybean:eo,kikirara:eo,kill:eo,kilo:eo,kuron:eo,littlestar:eo,lolipopmc:eo,lolitapunk:eo,lomo:eo,lovepop:eo,lovesick:eo,main:eo,mods:eo,mond:eo,mongolian:eo,moo:eo,namaste:eo,nikita:eo,nobushi:eo,noor:eo,oops:eo,parallel:eo,parasite:eo,pecori:eo,peewee:eo,penne:eo,pepper:eo,perma:eo,pigboat:eo,pinoko:eo,punyu:eo,pupu:eo,pussycat:eo,pya:eo,raindrop:eo,readymade:eo,sadist:eo,schoolbus:eo,secret:eo,staba:eo,stripper:eo,sub:eo,sunnyday:eo,thick:eo,tonkotsu:eo,under:eo,upper:eo,velvet:eo,verse:eo,versus:eo,vivian:eo,watson:eo,weblike:eo,whitesnow:eo,zombie:eo,blogspot:eo,"2-d":eo,bona:eo,crap:eo,daynight:eo,eek:eo,flop:eo,halfmoon:eo,jeez:eo,matrix:eo,mimoza:eo,netgamers:eo,nyanta:eo,o0o0:eo,rdy:eo,rgr:eo,rulez:eo,sakurastorage:[0,{isk01:lo,isk02:lo}],saloon:eo,sblo:eo,skr:eo,tank:eo,"uh-oh":eo,undo:eo,webaccel:[0,{rs:eo,user:eo}],websozai:eo,xii:eo}],ke:[1,{ac:Xr,co:no,go:Xr,info:Xr,me:Xr,mobi:Xr,ne:Xr,or:Xr,sc:Xr}],kg:[1,{org:Xr,net:Xr,com:Xr,edu:Xr,gov:Xr,mil:Xr,blog:eo,io:eo,jp:eo,tv:eo,uk:eo,us:eo}],kh:oo,ki:_o,km:[1,{org:Xr,nom:Xr,gov:Xr,prd:Xr,tm:Xr,edu:Xr,mil:Xr,ass:Xr,com:Xr,coop:Xr,asso:Xr,presse:Xr,medecin:Xr,notaires:Xr,pharmaciens:Xr,veterinaire:Xr,gouv:Xr}],kn:[1,{net:Xr,org:Xr,edu:Xr,gov:Xr}],kp:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,rep:Xr,tra:Xr}],kr:[1,{ac:Xr,co:Xr,es:Xr,go:Xr,hs:Xr,kg:Xr,mil:Xr,ms:Xr,ne:Xr,or:Xr,pe:Xr,re:Xr,sc:Xr,busan:Xr,chungbuk:Xr,chungnam:Xr,daegu:Xr,daejeon:Xr,gangwon:Xr,gwangju:Xr,gyeongbuk:Xr,gyeonggi:Xr,gyeongnam:Xr,incheon:Xr,jeju:Xr,jeonbuk:Xr,jeonnam:Xr,seoul:Xr,ulsan:Xr,blogspot:eo}],kw:[1,{com:Xr,edu:Xr,emb:Xr,gov:Xr,ind:Xr,net:Xr,org:Xr}],ky:Fo,kz:[1,{org:Xr,edu:Xr,net:Xr,gov:Xr,mil:Xr,com:Xr,jcloud:eo,kazteleport:[0,{upaas:eo}]}],la:[1,{int:Xr,net:Xr,info:Xr,edu:Xr,gov:Xr,per:Xr,com:Xr,org:Xr,bnr:eo,c:eo}],lb:to,lc:[1,{com:Xr,net:Xr,co:Xr,org:Xr,edu:Xr,gov:Xr,oy:eo}],li:[1,{blogspot:eo,caa:eo}],lk:[1,{gov:Xr,sch:Xr,net:Xr,int:Xr,com:Xr,org:Xr,edu:Xr,ngo:Xr,soc:Xr,web:Xr,ltd:Xr,assn:Xr,grp:Xr,hotel:Xr,ac:Xr}],lr:to,ls:[1,{ac:Xr,biz:Xr,co:Xr,edu:Xr,gov:Xr,info:Xr,net:Xr,org:Xr,sc:Xr,de:eo}],lt:$o,lu:[1,{blogspot:eo,"123website":eo}],lv:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr,id:Xr,net:Xr,asn:Xr,conf:Xr}],ly:[1,{com:Xr,net:Xr,gov:Xr,plc:Xr,edu:Xr,sch:Xr,med:Xr,org:Xr,id:Xr}],ma:[1,{co:Xr,net:Xr,gov:Xr,org:Xr,ac:Xr,press:Xr}],mc:[1,{tm:Xr,asso:Xr}],md:[1,{blogspot:eo,at:eo,de:eo,jp:eo,to:eo}],me:[1,{co:Xr,net:Xr,org:Xr,edu:Xr,ac:Xr,gov:Xr,its:Xr,priv:Xr,c66:eo,daplie:[2,{localhost:eo}],edgestack:eo,filegear:eo,"filegear-au":eo,"filegear-de":eo,"filegear-gb":eo,"filegear-ie":eo,"filegear-jp":eo,"filegear-sg":eo,glitch:eo,ravendb:eo,lohmus:eo,barsy:eo,mcpe:eo,mcdir:eo,soundcast:eo,tcp4:eo,brasilia:eo,ddns:eo,dnsfor:eo,hopto:eo,loginto:eo,noip:eo,webhop:eo,vp4:eo,diskstation:eo,dscloud:eo,i234:eo,myds:eo,synology:eo,transip:No,wedeploy:eo,yombo:eo,nohost:eo}],mg:[1,{org:Xr,nom:Xr,gov:Xr,prd:Xr,tm:Xr,edu:Xr,mil:Xr,com:Xr,co:Xr}],mh:Xr,mil:Xr,mk:[1,{com:Xr,org:Xr,net:Xr,edu:Xr,gov:Xr,inf:Xr,name:Xr,blogspot:eo}],ml:[1,{com:Xr,edu:Xr,gouv:Xr,gov:Xr,net:Xr,org:Xr,presse:Xr}],mm:oo,mn:[1,{gov:Xr,edu:Xr,org:Xr,nyc:eo}],mo:to,mobi:[1,{barsy:eo,dscloud:eo}],mp:[1,{ju:eo}],mq:Xr,mr:$o,ms:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,lab:eo,minisite:eo}],mt:[1,{com:no,edu:Xr,net:Xr,org:Xr}],mu:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,ac:Xr,co:Xr,or:Xr}],museum:Xr,mv:[1,{aero:Xr,biz:Xr,com:Xr,coop:Xr,edu:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,museum:Xr,name:Xr,net:Xr,org:Xr,pro:Xr}],mw:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,coop:Xr,edu:Xr,gov:Xr,int:Xr,museum:Xr,net:Xr,org:Xr}],mx:[1,{com:Xr,org:Xr,gob:Xr,edu:Xr,net:Xr,blogspot:eo}],my:[1,{biz:Xr,com:Xr,edu:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,blogspot:eo}],mz:[1,{ac:Xr,adv:Xr,co:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],na:[1,{info:Xr,pro:Xr,name:Xr,school:Xr,or:Xr,dr:Xr,us:Xr,mx:Xr,ca:Xr,in:Xr,cc:Xr,tv:Xr,ws:Xr,mobi:Xr,co:Xr,com:Xr,org:Xr}],name:[1,{her:So,his:So}],nc:[1,{asso:Xr,nom:Xr}],ne:Xr,net:[1,{adobeaemcloud:eo,"adobeio-static":eo,adobeioruntime:eo,akadns:eo,akamai:eo,"akamai-staging":eo,akamaiedge:eo,"akamaiedge-staging":eo,akamaihd:eo,"akamaihd-staging":eo,akamaiorigin:eo,"akamaiorigin-staging":eo,akamaized:eo,"akamaized-staging":eo,edgekey:eo,"edgekey-staging":eo,edgesuite:eo,"edgesuite-staging":eo,alwaysdata:eo,myamaze:eo,cloudfront:eo,t3l3p0rt:eo,appudo:eo,"atlassian-dev":[0,{prod:[0,{cdn:eo}]}],myfritz:eo,onavstack:eo,shopselect:eo,blackbaudcdn:eo,boomla:eo,bplaced:eo,square7:eo,gb:eo,hu:eo,jp:eo,se:eo,uk:eo,in:eo,clickrising:eo,cloudaccess:eo,"cdn77-ssl":eo,cdn77:[0,{r:eo}],"feste-ip":eo,"knx-server":eo,"static-access":eo,cryptonomic:ro,dattolocal:eo,mydatto:eo,debian:eo,bitbridge:eo,"at-band-camp":eo,blogdns:eo,"broke-it":eo,buyshouses:eo,dnsalias:eo,dnsdojo:eo,"does-it":eo,dontexist:eo,dynalias:eo,dynathome:eo,endofinternet:eo,"from-az":eo,"from-co":eo,"from-la":eo,"from-ny":eo,"gets-it":eo,"ham-radio-op":eo,homeftp:eo,homeip:eo,homelinux:eo,homeunix:eo,"in-the-band":eo,"is-a-chef":eo,"is-a-geek":eo,"isa-geek":eo,"kicks-ass":eo,"office-on-the":eo,podzone:eo,"scrapper-site":eo,selfip:eo,"sells-it":eo,servebbs:eo,serveftp:eo,thruhere:eo,webhop:eo,definima:eo,casacam:eo,dynu:eo,dynv6:eo,twmail:eo,ru:eo,channelsdvr:[2,{u:eo}],fastlylb:[2,{map:eo}],fastly:[0,{freetls:eo,map:eo,prod:[0,{a:eo,global:eo}],ssl:[0,{a:eo,b:eo,global:eo}]}],edgeapp:eo,flynnhosting:eo,"cdn-edges":eo,heteml:eo,cloudfunctions:eo,moonscale:eo,"in-dsl":eo,"in-vpn":eo,ipifony:eo,iobb:eo,cloudjiffy:[2,{"fra1-de":eo,"west1-us":eo}],elastx:[0,{"jls-sto1":eo,"jls-sto2":eo,"jls-sto3":eo}],faststacks:eo,massivegrid:[0,{paas:[0,{"fr-1":eo,"lon-1":eo,"lon-2":eo,"ny-1":eo,"ny-2":eo,"sg-1":eo}]}],saveincloud:[0,{jelastic:eo,"nordeste-idc":eo}],scaleforce:Xo,tsukaeru:Lo,kinghost:eo,uni5:eo,krellian:eo,barsy:eo,memset:eo,azurewebsites:eo,"azure-mobile":eo,cloudapp:eo,azurestaticapps:[2,{1:eo,2:eo,3:eo,centralus:eo,eastasia:eo,eastus2:eo,westeurope:eo,westus2:eo}],dnsup:eo,hicam:eo,"now-dns":eo,ownip:eo,vpndns:eo,"eating-organic":eo,mydissent:eo,myeffect:eo,mymediapc:eo,mypsx:eo,mysecuritycamera:eo,nhlfan:eo,"no-ip":eo,pgafan:eo,privatizehealthinsurance:eo,bounceme:eo,ddns:eo,redirectme:eo,serveblog:eo,serveminecraft:eo,sytes:eo,cloudycluster:eo,ovh:[0,{webpaas:ro,hosting:ro}],bar0:eo,bar1:eo,bar2:eo,rackmaze:eo,squares:eo,schokokeks:eo,"firewall-gateway":eo,seidat:eo,senseering:eo,siteleaf:eo,"vps-host":[2,{jelastic:[0,{atl:eo,njs:eo,ric:eo}]}],myspreadshop:eo,srcf:[0,{soc:eo,user:eo}],supabase:eo,dsmynas:eo,familyds:eo,tailscale:[0,{beta:eo}],ts:eo,torproject:[2,{pages:eo}],"reserve-online":eo,"community-pro":eo,meinforum:eo,yandexcloud:[2,{storage:eo,website:eo}],za:eo}],nf:[1,{com:Xr,net:Xr,per:Xr,rec:Xr,web:Xr,arts:Xr,firm:Xr,info:Xr,other:Xr,store:Xr}],ng:[1,{com:no,edu:Xr,gov:Xr,i:Xr,mil:Xr,mobi:Xr,name:Xr,net:Xr,org:Xr,sch:Xr,col:eo,firm:eo,gen:eo,ltd:eo,ngo:eo}],ni:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,gob:Xr,in:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,web:Xr}],nl:[1,{co:eo,"hosting-cluster":eo,blogspot:eo,gov:eo,khplay:eo,"123website":eo,myspreadshop:eo,transurl:ro,cistron:eo,demon:eo}],no:[1,{fhs:Xr,vgs:Xr,fylkesbibl:Xr,folkebibl:Xr,museum:Xr,idrett:Xr,priv:Xr,mil:Xr,stat:Xr,dep:Xr,kommune:Xr,herad:Xr,aa:mo,ah:mo,bu:mo,fm:mo,hl:mo,hm:mo,"jan-mayen":mo,mr:mo,nl:mo,nt:mo,of:mo,ol:mo,oslo:mo,rl:mo,sf:mo,st:mo,svalbard:mo,tm:mo,tr:mo,va:mo,vf:mo,akrehamn:Xr,"xn--krehamn-dxa":Xr,åkrehamn:Xr,algard:Xr,"xn--lgrd-poac":Xr,ålgård:Xr,arna:Xr,brumunddal:Xr,bryne:Xr,bronnoysund:Xr,"xn--brnnysund-m8ac":Xr,brønnøysund:Xr,drobak:Xr,"xn--drbak-wua":Xr,drøbak:Xr,egersund:Xr,fetsund:Xr,floro:Xr,"xn--flor-jra":Xr,florø:Xr,fredrikstad:Xr,hokksund:Xr,honefoss:Xr,"xn--hnefoss-q1a":Xr,hønefoss:Xr,jessheim:Xr,jorpeland:Xr,"xn--jrpeland-54a":Xr,jørpeland:Xr,kirkenes:Xr,kopervik:Xr,krokstadelva:Xr,langevag:Xr,"xn--langevg-jxa":Xr,langevåg:Xr,leirvik:Xr,mjondalen:Xr,"xn--mjndalen-64a":Xr,mjøndalen:Xr,"mo-i-rana":Xr,mosjoen:Xr,"xn--mosjen-eya":Xr,mosjøen:Xr,nesoddtangen:Xr,orkanger:Xr,osoyro:Xr,"xn--osyro-wua":Xr,osøyro:Xr,raholt:Xr,"xn--rholt-mra":Xr,råholt:Xr,sandnessjoen:Xr,"xn--sandnessjen-ogb":Xr,sandnessjøen:Xr,skedsmokorset:Xr,slattum:Xr,spjelkavik:Xr,stathelle:Xr,stavern:Xr,stjordalshalsen:Xr,"xn--stjrdalshalsen-sqb":Xr,stjørdalshalsen:Xr,tananger:Xr,tranby:Xr,vossevangen:Xr,afjord:Xr,"xn--fjord-lra":Xr,åfjord:Xr,agdenes:Xr,al:Xr,"xn--l-1fa":Xr,ål:Xr,alesund:Xr,"xn--lesund-hua":Xr,ålesund:Xr,alstahaug:Xr,alta:Xr,"xn--lt-liac":Xr,áltá:Xr,alaheadju:Xr,"xn--laheadju-7ya":Xr,álaheadju:Xr,alvdal:Xr,amli:Xr,"xn--mli-tla":Xr,åmli:Xr,amot:Xr,"xn--mot-tla":Xr,åmot:Xr,andebu:Xr,andoy:Xr,"xn--andy-ira":Xr,andøy:Xr,andasuolo:Xr,ardal:Xr,"xn--rdal-poa":Xr,årdal:Xr,aremark:Xr,arendal:Xr,"xn--s-1fa":Xr,ås:Xr,aseral:Xr,"xn--seral-lra":Xr,åseral:Xr,asker:Xr,askim:Xr,askvoll:Xr,askoy:Xr,"xn--asky-ira":Xr,askøy:Xr,asnes:Xr,"xn--snes-poa":Xr,åsnes:Xr,audnedaln:Xr,aukra:Xr,aure:Xr,aurland:Xr,"aurskog-holand":Xr,"xn--aurskog-hland-jnb":Xr,"aurskog-høland":Xr,austevoll:Xr,austrheim:Xr,averoy:Xr,"xn--avery-yua":Xr,averøy:Xr,balestrand:Xr,ballangen:Xr,balat:Xr,"xn--blt-elab":Xr,bálát:Xr,balsfjord:Xr,bahccavuotna:Xr,"xn--bhccavuotna-k7a":Xr,báhccavuotna:Xr,bamble:Xr,bardu:Xr,beardu:Xr,beiarn:Xr,bajddar:Xr,"xn--bjddar-pta":Xr,bájddar:Xr,baidar:Xr,"xn--bidr-5nac":Xr,báidár:Xr,berg:Xr,bergen:Xr,berlevag:Xr,"xn--berlevg-jxa":Xr,berlevåg:Xr,bearalvahki:Xr,"xn--bearalvhki-y4a":Xr,bearalváhki:Xr,bindal:Xr,birkenes:Xr,bjarkoy:Xr,"xn--bjarky-fya":Xr,bjarkøy:Xr,bjerkreim:Xr,bjugn:Xr,bodo:Xr,"xn--bod-2na":Xr,bodø:Xr,badaddja:Xr,"xn--bdddj-mrabd":Xr,bådåddjå:Xr,budejju:Xr,bokn:Xr,bremanger:Xr,bronnoy:Xr,"xn--brnny-wuac":Xr,brønnøy:Xr,bygland:Xr,bykle:Xr,barum:Xr,"xn--brum-voa":Xr,bærum:Xr,telemark:[0,{bo:Xr,"xn--b-5ga":Xr,bø:Xr}],nordland:[0,{bo:Xr,"xn--b-5ga":Xr,bø:Xr,heroy:Xr,"xn--hery-ira":Xr,herøy:Xr}],bievat:Xr,"xn--bievt-0qa":Xr,bievát:Xr,bomlo:Xr,"xn--bmlo-gra":Xr,bømlo:Xr,batsfjord:Xr,"xn--btsfjord-9za":Xr,båtsfjord:Xr,bahcavuotna:Xr,"xn--bhcavuotna-s4a":Xr,báhcavuotna:Xr,dovre:Xr,drammen:Xr,drangedal:Xr,dyroy:Xr,"xn--dyry-ira":Xr,dyrøy:Xr,donna:Xr,"xn--dnna-gra":Xr,dønna:Xr,eid:Xr,eidfjord:Xr,eidsberg:Xr,eidskog:Xr,eidsvoll:Xr,eigersund:Xr,elverum:Xr,enebakk:Xr,engerdal:Xr,etne:Xr,etnedal:Xr,evenes:Xr,evenassi:Xr,"xn--eveni-0qa01ga":Xr,evenášši:Xr,"evje-og-hornnes":Xr,farsund:Xr,fauske:Xr,fuossko:Xr,fuoisku:Xr,fedje:Xr,fet:Xr,finnoy:Xr,"xn--finny-yua":Xr,finnøy:Xr,fitjar:Xr,fjaler:Xr,fjell:Xr,flakstad:Xr,flatanger:Xr,flekkefjord:Xr,flesberg:Xr,flora:Xr,fla:Xr,"xn--fl-zia":Xr,flå:Xr,folldal:Xr,forsand:Xr,fosnes:Xr,frei:Xr,frogn:Xr,froland:Xr,frosta:Xr,frana:Xr,"xn--frna-woa":Xr,fræna:Xr,froya:Xr,"xn--frya-hra":Xr,frøya:Xr,fusa:Xr,fyresdal:Xr,forde:Xr,"xn--frde-gra":Xr,førde:Xr,gamvik:Xr,gangaviika:Xr,"xn--ggaviika-8ya47h":Xr,gáŋgaviika:Xr,gaular:Xr,gausdal:Xr,gildeskal:Xr,"xn--gildeskl-g0a":Xr,gildeskål:Xr,giske:Xr,gjemnes:Xr,gjerdrum:Xr,gjerstad:Xr,gjesdal:Xr,gjovik:Xr,"xn--gjvik-wua":Xr,gjøvik:Xr,gloppen:Xr,gol:Xr,gran:Xr,grane:Xr,granvin:Xr,gratangen:Xr,grimstad:Xr,grong:Xr,kraanghke:Xr,"xn--kranghke-b0a":Xr,kråanghke:Xr,grue:Xr,gulen:Xr,hadsel:Xr,halden:Xr,halsa:Xr,hamar:Xr,hamaroy:Xr,habmer:Xr,"xn--hbmer-xqa":Xr,hábmer:Xr,hapmir:Xr,"xn--hpmir-xqa":Xr,hápmir:Xr,hammerfest:Xr,hammarfeasta:Xr,"xn--hmmrfeasta-s4ac":Xr,hámmárfeasta:Xr,haram:Xr,hareid:Xr,harstad:Xr,hasvik:Xr,aknoluokta:Xr,"xn--koluokta-7ya57h":Xr,ákŋoluokta:Xr,hattfjelldal:Xr,aarborte:Xr,haugesund:Xr,hemne:Xr,hemnes:Xr,hemsedal:Xr,"more-og-romsdal":[0,{heroy:Xr,sande:Xr}],"xn--mre-og-romsdal-qqb":[0,{"xn--hery-ira":Xr,sande:Xr}],"møre-og-romsdal":[0,{herøy:Xr,sande:Xr}],hitra:Xr,hjartdal:Xr,hjelmeland:Xr,hobol:Xr,"xn--hobl-ira":Xr,hobøl:Xr,hof:Xr,hol:Xr,hole:Xr,holmestrand:Xr,holtalen:Xr,"xn--holtlen-hxa":Xr,holtålen:Xr,hornindal:Xr,horten:Xr,hurdal:Xr,hurum:Xr,hvaler:Xr,hyllestad:Xr,hagebostad:Xr,"xn--hgebostad-g3a":Xr,hægebostad:Xr,hoyanger:Xr,"xn--hyanger-q1a":Xr,høyanger:Xr,hoylandet:Xr,"xn--hylandet-54a":Xr,høylandet:Xr,ha:Xr,"xn--h-2fa":Xr,hå:Xr,ibestad:Xr,inderoy:Xr,"xn--indery-fya":Xr,inderøy:Xr,iveland:Xr,jevnaker:Xr,jondal:Xr,jolster:Xr,"xn--jlster-bya":Xr,jølster:Xr,karasjok:Xr,karasjohka:Xr,"xn--krjohka-hwab49j":Xr,kárášjohka:Xr,karlsoy:Xr,galsa:Xr,"xn--gls-elac":Xr,gálsá:Xr,karmoy:Xr,"xn--karmy-yua":Xr,karmøy:Xr,kautokeino:Xr,guovdageaidnu:Xr,klepp:Xr,klabu:Xr,"xn--klbu-woa":Xr,klæbu:Xr,kongsberg:Xr,kongsvinger:Xr,kragero:Xr,"xn--krager-gya":Xr,kragerø:Xr,kristiansand:Xr,kristiansund:Xr,krodsherad:Xr,"xn--krdsherad-m8a":Xr,krødsherad:Xr,kvalsund:Xr,rahkkeravju:Xr,"xn--rhkkervju-01af":Xr,ráhkkerávju:Xr,kvam:Xr,kvinesdal:Xr,kvinnherad:Xr,kviteseid:Xr,kvitsoy:Xr,"xn--kvitsy-fya":Xr,kvitsøy:Xr,kvafjord:Xr,"xn--kvfjord-nxa":Xr,kvæfjord:Xr,giehtavuoatna:Xr,kvanangen:Xr,"xn--kvnangen-k0a":Xr,kvænangen:Xr,navuotna:Xr,"xn--nvuotna-hwa":Xr,návuotna:Xr,kafjord:Xr,"xn--kfjord-iua":Xr,kåfjord:Xr,gaivuotna:Xr,"xn--givuotna-8ya":Xr,gáivuotna:Xr,larvik:Xr,lavangen:Xr,lavagis:Xr,loabat:Xr,"xn--loabt-0qa":Xr,loabát:Xr,lebesby:Xr,davvesiida:Xr,leikanger:Xr,leirfjord:Xr,leka:Xr,leksvik:Xr,lenvik:Xr,leangaviika:Xr,"xn--leagaviika-52b":Xr,leaŋgaviika:Xr,lesja:Xr,levanger:Xr,lier:Xr,lierne:Xr,lillehammer:Xr,lillesand:Xr,lindesnes:Xr,lindas:Xr,"xn--linds-pra":Xr,lindås:Xr,lom:Xr,loppa:Xr,lahppi:Xr,"xn--lhppi-xqa":Xr,láhppi:Xr,lund:Xr,lunner:Xr,luroy:Xr,"xn--lury-ira":Xr,lurøy:Xr,luster:Xr,lyngdal:Xr,lyngen:Xr,ivgu:Xr,lardal:Xr,lerdal:Xr,"xn--lrdal-sra":Xr,lærdal:Xr,lodingen:Xr,"xn--ldingen-q1a":Xr,lødingen:Xr,lorenskog:Xr,"xn--lrenskog-54a":Xr,lørenskog:Xr,loten:Xr,"xn--lten-gra":Xr,løten:Xr,malvik:Xr,masoy:Xr,"xn--msy-ula0h":Xr,måsøy:Xr,muosat:Xr,"xn--muost-0qa":Xr,muosát:Xr,mandal:Xr,marker:Xr,marnardal:Xr,masfjorden:Xr,meland:Xr,meldal:Xr,melhus:Xr,meloy:Xr,"xn--mely-ira":Xr,meløy:Xr,meraker:Xr,"xn--merker-kua":Xr,meråker:Xr,moareke:Xr,"xn--moreke-jua":Xr,moåreke:Xr,midsund:Xr,"midtre-gauldal":Xr,modalen:Xr,modum:Xr,molde:Xr,moskenes:Xr,moss:Xr,mosvik:Xr,malselv:Xr,"xn--mlselv-iua":Xr,målselv:Xr,malatvuopmi:Xr,"xn--mlatvuopmi-s4a":Xr,málatvuopmi:Xr,namdalseid:Xr,aejrie:Xr,namsos:Xr,namsskogan:Xr,naamesjevuemie:Xr,"xn--nmesjevuemie-tcba":Xr,nååmesjevuemie:Xr,laakesvuemie:Xr,nannestad:Xr,narvik:Xr,narviika:Xr,naustdal:Xr,"nedre-eiker":Xr,akershus:To,buskerud:To,nesna:Xr,nesodden:Xr,nesseby:Xr,unjarga:Xr,"xn--unjrga-rta":Xr,unjárga:Xr,nesset:Xr,nissedal:Xr,nittedal:Xr,"nord-aurdal":Xr,"nord-fron":Xr,"nord-odal":Xr,norddal:Xr,nordkapp:Xr,davvenjarga:Xr,"xn--davvenjrga-y4a":Xr,davvenjárga:Xr,"nordre-land":Xr,nordreisa:Xr,raisa:Xr,"xn--risa-5na":Xr,ráisa:Xr,"nore-og-uvdal":Xr,notodden:Xr,naroy:Xr,"xn--nry-yla5g":Xr,nærøy:Xr,notteroy:Xr,"xn--nttery-byae":Xr,nøtterøy:Xr,odda:Xr,oksnes:Xr,"xn--ksnes-uua":Xr,øksnes:Xr,oppdal:Xr,oppegard:Xr,"xn--oppegrd-ixa":Xr,oppegård:Xr,orkdal:Xr,orland:Xr,"xn--rland-uua":Xr,ørland:Xr,orskog:Xr,"xn--rskog-uua":Xr,ørskog:Xr,orsta:Xr,"xn--rsta-fra":Xr,ørsta:Xr,hedmark:[0,{os:Xr,valer:Xr,"xn--vler-qoa":Xr,våler:Xr}],hordaland:[0,{os:Xr}],osen:Xr,osteroy:Xr,"xn--ostery-fya":Xr,osterøy:Xr,"ostre-toten":Xr,"xn--stre-toten-zcb":Xr,"østre-toten":Xr,overhalla:Xr,"ovre-eiker":Xr,"xn--vre-eiker-k8a":Xr,"øvre-eiker":Xr,oyer:Xr,"xn--yer-zna":Xr,øyer:Xr,oygarden:Xr,"xn--ygarden-p1a":Xr,øygarden:Xr,"oystre-slidre":Xr,"xn--ystre-slidre-ujb":Xr,"øystre-slidre":Xr,porsanger:Xr,porsangu:Xr,"xn--porsgu-sta26f":Xr,porsáŋgu:Xr,porsgrunn:Xr,radoy:Xr,"xn--rady-ira":Xr,radøy:Xr,rakkestad:Xr,rana:Xr,ruovat:Xr,randaberg:Xr,rauma:Xr,rendalen:Xr,rennebu:Xr,rennesoy:Xr,"xn--rennesy-v1a":Xr,rennesøy:Xr,rindal:Xr,ringebu:Xr,ringerike:Xr,ringsaker:Xr,rissa:Xr,risor:Xr,"xn--risr-ira":Xr,risør:Xr,roan:Xr,rollag:Xr,rygge:Xr,ralingen:Xr,"xn--rlingen-mxa":Xr,rælingen:Xr,rodoy:Xr,"xn--rdy-0nab":Xr,rødøy:Xr,romskog:Xr,"xn--rmskog-bya":Xr,rømskog:Xr,roros:Xr,"xn--rros-gra":Xr,røros:Xr,rost:Xr,"xn--rst-0na":Xr,røst:Xr,royken:Xr,"xn--ryken-vua":Xr,røyken:Xr,royrvik:Xr,"xn--ryrvik-bya":Xr,røyrvik:Xr,rade:Xr,"xn--rde-ula":Xr,råde:Xr,salangen:Xr,siellak:Xr,saltdal:Xr,salat:Xr,"xn--slt-elab":Xr,sálát:Xr,"xn--slat-5na":Xr,sálat:Xr,samnanger:Xr,vestfold:[0,{sande:Xr}],sandefjord:Xr,sandnes:Xr,sandoy:Xr,"xn--sandy-yua":Xr,sandøy:Xr,sarpsborg:Xr,sauda:Xr,sauherad:Xr,sel:Xr,selbu:Xr,selje:Xr,seljord:Xr,sigdal:Xr,siljan:Xr,sirdal:Xr,skaun:Xr,skedsmo:Xr,ski:Xr,skien:Xr,skiptvet:Xr,skjervoy:Xr,"xn--skjervy-v1a":Xr,skjervøy:Xr,skierva:Xr,"xn--skierv-uta":Xr,skiervá:Xr,skjak:Xr,"xn--skjk-soa":Xr,skjåk:Xr,skodje:Xr,skanland:Xr,"xn--sknland-fxa":Xr,skånland:Xr,skanit:Xr,"xn--sknit-yqa":Xr,skánit:Xr,smola:Xr,"xn--smla-hra":Xr,smøla:Xr,snillfjord:Xr,snasa:Xr,"xn--snsa-roa":Xr,snåsa:Xr,snoasa:Xr,snaase:Xr,"xn--snase-nra":Xr,snåase:Xr,sogndal:Xr,sokndal:Xr,sola:Xr,solund:Xr,songdalen:Xr,sortland:Xr,spydeberg:Xr,stange:Xr,stavanger:Xr,steigen:Xr,steinkjer:Xr,stjordal:Xr,"xn--stjrdal-s1a":Xr,stjørdal:Xr,stokke:Xr,"stor-elvdal":Xr,stord:Xr,stordal:Xr,storfjord:Xr,omasvuotna:Xr,strand:Xr,stranda:Xr,stryn:Xr,sula:Xr,suldal:Xr,sund:Xr,sunndal:Xr,surnadal:Xr,sveio:Xr,svelvik:Xr,sykkylven:Xr,sogne:Xr,"xn--sgne-gra":Xr,søgne:Xr,somna:Xr,"xn--smna-gra":Xr,sømna:Xr,"sondre-land":Xr,"xn--sndre-land-0cb":Xr,"søndre-land":Xr,"sor-aurdal":Xr,"xn--sr-aurdal-l8a":Xr,"sør-aurdal":Xr,"sor-fron":Xr,"xn--sr-fron-q1a":Xr,"sør-fron":Xr,"sor-odal":Xr,"xn--sr-odal-q1a":Xr,"sør-odal":Xr,"sor-varanger":Xr,"xn--sr-varanger-ggb":Xr,"sør-varanger":Xr,"matta-varjjat":Xr,"xn--mtta-vrjjat-k7af":Xr,"mátta-várjjat":Xr,sorfold:Xr,"xn--srfold-bya":Xr,sørfold:Xr,sorreisa:Xr,"xn--srreisa-q1a":Xr,sørreisa:Xr,sorum:Xr,"xn--srum-gra":Xr,sørum:Xr,tana:Xr,deatnu:Xr,time:Xr,tingvoll:Xr,tinn:Xr,tjeldsund:Xr,dielddanuorri:Xr,tjome:Xr,"xn--tjme-hra":Xr,tjøme:Xr,tokke:Xr,tolga:Xr,torsken:Xr,tranoy:Xr,"xn--trany-yua":Xr,tranøy:Xr,tromso:Xr,"xn--troms-zua":Xr,tromsø:Xr,tromsa:Xr,romsa:Xr,trondheim:Xr,troandin:Xr,trysil:Xr,trana:Xr,"xn--trna-woa":Xr,træna:Xr,trogstad:Xr,"xn--trgstad-r1a":Xr,trøgstad:Xr,tvedestrand:Xr,tydal:Xr,tynset:Xr,tysfjord:Xr,divtasvuodna:Xr,divttasvuotna:Xr,tysnes:Xr,tysvar:Xr,"xn--tysvr-vra":Xr,tysvær:Xr,tonsberg:Xr,"xn--tnsberg-q1a":Xr,tønsberg:Xr,ullensaker:Xr,ullensvang:Xr,ulvik:Xr,utsira:Xr,vadso:Xr,"xn--vads-jra":Xr,vadsø:Xr,cahcesuolo:Xr,"xn--hcesuolo-7ya35b":Xr,čáhcesuolo:Xr,vaksdal:Xr,valle:Xr,vang:Xr,vanylven:Xr,vardo:Xr,"xn--vard-jra":Xr,vardø:Xr,varggat:Xr,"xn--vrggt-xqad":Xr,várggát:Xr,vefsn:Xr,vaapste:Xr,vega:Xr,vegarshei:Xr,"xn--vegrshei-c0a":Xr,vegårshei:Xr,vennesla:Xr,verdal:Xr,verran:Xr,vestby:Xr,vestnes:Xr,"vestre-slidre":Xr,"vestre-toten":Xr,vestvagoy:Xr,"xn--vestvgy-ixa6o":Xr,vestvågøy:Xr,vevelstad:Xr,vik:Xr,vikna:Xr,vindafjord:Xr,volda:Xr,voss:Xr,varoy:Xr,"xn--vry-yla5g":Xr,værøy:Xr,vagan:Xr,"xn--vgan-qoa":Xr,vågan:Xr,voagat:Xr,vagsoy:Xr,"xn--vgsy-qoa0j":Xr,vågsøy:Xr,vaga:Xr,"xn--vg-yiab":Xr,vågå:Xr,ostfold:[0,{valer:Xr}],"xn--stfold-9xa":[0,{"xn--vler-qoa":Xr}],østfold:[0,{våler:Xr}],co:eo,blogspot:eo,"123hjemmeside":eo,myspreadshop:eo}],np:oo,nr:_o,nu:[1,{merseine:eo,mine:eo,shacknet:eo,enterprisecloud:eo}],nz:[1,{ac:Xr,co:no,cri:Xr,geek:Xr,gen:Xr,govt:Xr,health:Xr,iwi:Xr,kiwi:Xr,maori:Xr,mil:Xr,"xn--mori-qsa":Xr,māori:Xr,net:Xr,org:Xr,parliament:Xr,school:Xr}],om:[1,{co:Xr,com:Xr,edu:Xr,gov:Xr,med:Xr,museum:Xr,net:Xr,org:Xr,pro:Xr}],onion:Xr,org:[1,{altervista:eo,amune:[0,{tele:eo}],pimienta:eo,poivron:eo,potager:eo,sweetpepper:eo,ae:eo,us:eo,certmgr:eo,cdn77:[0,{c:eo,rsc:eo}],"cdn77-secure":[0,{origin:[0,{ssl:eo}]}],cloudns:eo,duckdns:eo,tunk:eo,dyndns:[2,{go:eo,home:eo}],blogdns:eo,blogsite:eo,boldlygoingnowhere:eo,dnsalias:eo,dnsdojo:eo,doesntexist:eo,dontexist:eo,doomdns:eo,dvrdns:eo,dynalias:eo,endofinternet:eo,endoftheinternet:eo,"from-me":eo,"game-host":eo,gotdns:eo,"hobby-site":eo,homedns:eo,homeftp:eo,homelinux:eo,homeunix:eo,"is-a-bruinsfan":eo,"is-a-candidate":eo,"is-a-celticsfan":eo,"is-a-chef":eo,"is-a-geek":eo,"is-a-knight":eo,"is-a-linux-user":eo,"is-a-patsfan":eo,"is-a-soxfan":eo,"is-found":eo,"is-lost":eo,"is-saved":eo,"is-very-bad":eo,"is-very-evil":eo,"is-very-good":eo,"is-very-nice":eo,"is-very-sweet":eo,"isa-geek":eo,"kicks-ass":eo,misconfused:eo,podzone:eo,readmyblog:eo,selfip:eo,sellsyourhome:eo,servebbs:eo,serveftp:eo,servegame:eo,"stuff-4-sale":eo,webhop:eo,ddnss:eo,accesscam:eo,camdvr:eo,freeddns:eo,mywire:eo,webredirect:eo,eu:[2,{al:eo,asso:eo,at:eo,au:eo,be:eo,bg:eo,ca:eo,cd:eo,ch:eo,cn:eo,cy:eo,cz:eo,de:eo,dk:eo,edu:eo,ee:eo,es:eo,fi:eo,fr:eo,gr:eo,hr:eo,hu:eo,ie:eo,il:eo,in:eo,int:eo,is:eo,it:eo,jp:eo,kr:eo,lt:eo,lu:eo,lv:eo,mc:eo,me:eo,mk:eo,mt:eo,my:eo,net:eo,ng:eo,nl:eo,no:eo,nz:eo,paris:eo,pl:eo,pt:eo,"q-a":eo,ro:eo,ru:eo,se:eo,si:eo,sk:eo,tr:eo,uk:eo,us:eo}],twmail:eo,fedorainfracloud:eo,fedorapeople:eo,fedoraproject:[0,{cloud:eo,os:jo,stg:[0,{os:jo}]}],freedesktop:eo,hepforge:eo,"in-dsl":eo,"in-vpn":eo,js:eo,barsy:eo,mayfirst:eo,"mozilla-iot":eo,bmoattachments:eo,dynserv:eo,"now-dns":eo,"cable-modem":eo,collegefan:eo,couchpotatofries:eo,mlbfan:eo,mysecuritycamera:eo,nflfan:eo,"read-books":eo,ufcfan:eo,hopto:eo,myftp:eo,"no-ip":eo,zapto:eo,httpbin:eo,pubtls:eo,jpn:eo,"my-firewall":eo,myfirewall:eo,spdns:eo,"small-web":eo,dsmynas:eo,familyds:eo,teckids:lo,tuxfamily:eo,diskstation:eo,hk:eo,wmflabs:eo,toolforge:eo,wmcloud:eo,za:eo}],pa:[1,{ac:Xr,gob:Xr,com:Xr,org:Xr,sld:Xr,edu:Xr,net:Xr,ing:Xr,abo:Xr,med:Xr,nom:Xr}],pe:[1,{edu:Xr,gob:Xr,nom:Xr,mil:Xr,org:Xr,com:Xr,net:Xr,blogspot:eo}],pf:[1,{com:Xr,org:Xr,edu:Xr}],pg:oo,ph:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,ngo:Xr,mil:Xr,i:Xr}],pk:[1,{com:Xr,net:Xr,edu:Xr,org:Xr,fam:Xr,biz:Xr,web:Xr,gov:Xr,gob:Xr,gok:Xr,gon:Xr,gop:Xr,gos:Xr,info:Xr}],pl:[1,{com:Xr,net:Xr,org:Xr,aid:Xr,agro:Xr,atm:Xr,auto:Xr,biz:Xr,edu:Xr,gmina:Xr,gsm:Xr,info:Xr,mail:Xr,miasta:Xr,media:Xr,mil:Xr,nieruchomosci:Xr,nom:Xr,pc:Xr,powiat:Xr,priv:Xr,realestate:Xr,rel:Xr,sex:Xr,shop:Xr,sklep:Xr,sos:Xr,szkola:Xr,targi:Xr,tm:Xr,tourism:Xr,travel:Xr,turystyka:Xr,gov:[1,{ap:Xr,griw:Xr,ic:Xr,is:Xr,kmpsp:Xr,konsulat:Xr,kppsp:Xr,kwp:Xr,kwpsp:Xr,mup:Xr,mw:Xr,oia:Xr,oirm:Xr,oke:Xr,oow:Xr,oschr:Xr,oum:Xr,pa:Xr,pinb:Xr,piw:Xr,po:Xr,pr:Xr,psp:Xr,psse:Xr,pup:Xr,rzgw:Xr,sa:Xr,sdn:Xr,sko:Xr,so:Xr,sr:Xr,starostwo:Xr,ug:Xr,ugim:Xr,um:Xr,umig:Xr,upow:Xr,uppo:Xr,us:Xr,uw:Xr,uzs:Xr,wif:Xr,wiih:Xr,winb:Xr,wios:Xr,witd:Xr,wiw:Xr,wkz:Xr,wsa:Xr,wskr:Xr,wsse:Xr,wuoz:Xr,wzmiuw:Xr,zp:Xr,zpisdn:Xr}],augustow:Xr,"babia-gora":Xr,bedzin:Xr,beskidy:Xr,bialowieza:Xr,bialystok:Xr,bielawa:Xr,bieszczady:Xr,boleslawiec:Xr,bydgoszcz:Xr,bytom:Xr,cieszyn:Xr,czeladz:Xr,czest:Xr,dlugoleka:Xr,elblag:Xr,elk:Xr,glogow:Xr,gniezno:Xr,gorlice:Xr,grajewo:Xr,ilawa:Xr,jaworzno:Xr,"jelenia-gora":Xr,jgora:Xr,kalisz:Xr,"kazimierz-dolny":Xr,karpacz:Xr,kartuzy:Xr,kaszuby:Xr,katowice:Xr,kepno:Xr,ketrzyn:Xr,klodzko:Xr,kobierzyce:Xr,kolobrzeg:Xr,konin:Xr,konskowola:Xr,kutno:Xr,lapy:Xr,lebork:Xr,legnica:Xr,lezajsk:Xr,limanowa:Xr,lomza:Xr,lowicz:Xr,lubin:Xr,lukow:Xr,malbork:Xr,malopolska:Xr,mazowsze:Xr,mazury:Xr,mielec:Xr,mielno:Xr,mragowo:Xr,naklo:Xr,nowaruda:Xr,nysa:Xr,olawa:Xr,olecko:Xr,olkusz:Xr,olsztyn:Xr,opoczno:Xr,opole:Xr,ostroda:Xr,ostroleka:Xr,ostrowiec:Xr,ostrowwlkp:Xr,pila:Xr,pisz:Xr,podhale:Xr,podlasie:Xr,polkowice:Xr,pomorze:Xr,pomorskie:Xr,prochowice:Xr,pruszkow:Xr,przeworsk:Xr,pulawy:Xr,radom:Xr,"rawa-maz":Xr,rybnik:Xr,rzeszow:Xr,sanok:Xr,sejny:Xr,slask:Xr,slupsk:Xr,sosnowiec:Xr,"stalowa-wola":Xr,skoczow:Xr,starachowice:Xr,stargard:Xr,suwalki:Xr,swidnica:Xr,swiebodzin:Xr,swinoujscie:Xr,szczecin:Xr,szczytno:Xr,tarnobrzeg:Xr,tgory:Xr,turek:Xr,tychy:Xr,ustka:Xr,walbrzych:Xr,warmia:Xr,warszawa:Xr,waw:Xr,wegrow:Xr,wielun:Xr,wlocl:Xr,wloclawek:Xr,wodzislaw:Xr,wolomin:Xr,wroclaw:Xr,zachpomor:Xr,zagan:Xr,zarow:Xr,zgora:Xr,zgorzelec:Xr,beep:eo,"ecommerce-shop":eo,shoparena:eo,homesklep:eo,sdscloud:eo,unicloud:eo,krasnik:eo,leczna:eo,lubartow:eo,lublin:eo,poniatowa:eo,swidnik:eo,co:eo,simplesite:eo,art:eo,gliwice:eo,krakow:eo,poznan:eo,wroc:eo,zakopane:eo,myspreadshop:eo,gda:eo,gdansk:eo,gdynia:eo,med:eo,sopot:eo}],pm:[1,{own:eo,name:eo}],pn:[1,{gov:Xr,co:Xr,org:Xr,edu:Xr,net:Xr}],post:Xr,pr:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,isla:Xr,pro:Xr,biz:Xr,info:Xr,name:Xr,est:Xr,prof:Xr,ac:Xr}],pro:[1,{aaa:Xr,aca:Xr,acct:Xr,avocat:Xr,bar:Xr,cpa:Xr,eng:Xr,jur:Xr,law:Xr,med:Xr,recht:Xr,cloudns:eo,dnstrace:[0,{bci:eo}],barsy:eo}],ps:[1,{edu:Xr,gov:Xr,sec:Xr,plo:Xr,com:Xr,org:Xr,net:Xr}],pt:[1,{net:Xr,gov:Xr,org:Xr,edu:Xr,int:Xr,publ:Xr,com:Xr,nome:Xr,blogspot:eo,"123paginaweb":eo}],pw:[1,{co:Xr,ne:Xr,or:Xr,ed:Xr,go:Xr,belau:Xr,cloudns:eo,x443:eo}],py:[1,{com:Xr,coop:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],qa:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,sch:Xr,blogspot:eo}],re:[1,{asso:Xr,com:Xr,nom:Xr,blogspot:eo}],ro:[1,{arts:Xr,com:Xr,firm:Xr,info:Xr,nom:Xr,nt:Xr,org:Xr,rec:Xr,store:Xr,tm:Xr,www:Xr,co:eo,shop:eo,blogspot:eo,barsy:eo}],rs:[1,{ac:Xr,co:Xr,edu:Xr,gov:Xr,in:Xr,org:Xr,brendly:[0,{shop:eo}],blogspot:eo,ua:eo,ox:eo}],ru:[1,{ac:eo,edu:eo,gov:eo,int:eo,mil:eo,test:eo,eurodir:eo,adygeya:eo,bashkiria:eo,bir:eo,cbg:eo,com:eo,dagestan:eo,grozny:eo,kalmykia:eo,kustanai:eo,marine:eo,mordovia:eo,msk:eo,mytis:eo,nalchik:eo,nov:eo,pyatigorsk:eo,spb:eo,vladikavkaz:eo,vladimir:eo,blogspot:eo,na4u:eo,mircloud:eo,regruhosting:Lo,myjino:[2,{hosting:ro,landing:ro,spectrum:ro,vps:ro}],cldmail:[0,{hb:eo}],mcdir:[2,{vps:eo}],mcpre:eo,net:eo,org:eo,pp:eo,"123sait":eo,lk3:eo,ras:eo}],rw:[1,{ac:Xr,co:Xr,coop:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],sa:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,med:Xr,pub:Xr,edu:Xr,sch:Xr}],sb:to,sc:to,sd:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,med:Xr,tv:Xr,gov:Xr,info:Xr}],se:[1,{a:Xr,ac:Xr,b:Xr,bd:Xr,brand:Xr,c:Xr,d:Xr,e:Xr,f:Xr,fh:Xr,fhsk:Xr,fhv:Xr,g:Xr,h:Xr,i:Xr,k:Xr,komforb:Xr,kommunalforbund:Xr,komvux:Xr,l:Xr,lanbib:Xr,m:Xr,n:Xr,naturbruksgymn:Xr,o:Xr,org:Xr,p:Xr,parti:Xr,pp:Xr,press:Xr,r:Xr,s:Xr,t:Xr,tm:Xr,u:Xr,w:Xr,x:Xr,y:Xr,z:Xr,com:eo,blogspot:eo,conf:eo,iopsys:eo,"123minsida":eo,itcouldbewor:eo,myspreadshop:eo,paba:[0,{su:eo}]}],sg:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,per:Xr,blogspot:eo,enscaled:eo}],sh:[1,{com:Xr,net:Xr,gov:Xr,org:Xr,mil:Xr,bip:eo,hashbang:eo,platform:[0,{bc:eo,ent:eo,eu:eo,us:eo}],now:eo,vxl:eo,wedeploy:eo}],si:[1,{gitapp:eo,gitpage:eo,blogspot:eo}],sj:Xr,sk:no,sl:to,sm:Xr,sn:[1,{art:Xr,com:Xr,edu:Xr,gouv:Xr,org:Xr,perso:Xr,univ:Xr,blogspot:eo}],so:[1,{com:Xr,edu:Xr,gov:Xr,me:Xr,net:Xr,org:Xr,sch:eo}],sr:Xr,ss:[1,{biz:Xr,com:Xr,edu:Xr,gov:Xr,me:Xr,net:Xr,org:Xr,sch:Xr}],st:[1,{co:Xr,com:Xr,consulado:Xr,edu:Xr,embaixada:Xr,mil:Xr,net:Xr,org:Xr,principe:Xr,saotome:Xr,store:Xr,kirara:eo,noho:eo}],su:[1,{abkhazia:eo,adygeya:eo,aktyubinsk:eo,arkhangelsk:eo,armenia:eo,ashgabad:eo,azerbaijan:eo,balashov:eo,bashkiria:eo,bryansk:eo,bukhara:eo,chimkent:eo,dagestan:eo,"east-kazakhstan":eo,exnet:eo,georgia:eo,grozny:eo,ivanovo:eo,jambyl:eo,kalmykia:eo,kaluga:eo,karacol:eo,karaganda:eo,karelia:eo,khakassia:eo,krasnodar:eo,kurgan:eo,kustanai:eo,lenug:eo,mangyshlak:eo,mordovia:eo,msk:eo,murmansk:eo,nalchik:eo,navoi:eo,"north-kazakhstan":eo,nov:eo,obninsk:eo,penza:eo,pokrovsk:eo,sochi:eo,spb:eo,tashkent:eo,termez:eo,togliatti:eo,troitsk:eo,tselinograd:eo,tula:eo,tuva:eo,vladikavkaz:eo,vladimir:eo,vologda:eo}],sv:[1,{com:Xr,edu:Xr,gob:Xr,org:Xr,red:Xr}],sx:io,sy:bo,sz:[1,{co:Xr,ac:Xr,org:Xr}],tc:[1,{ch:eo,me:eo,we:eo}],td:no,tel:Xr,tf:[1,{sch:eo}],tg:Xr,th:[1,{ac:Xr,co:Xr,go:Xr,in:Xr,mi:Xr,net:Xr,or:Xr,online:eo,shop:eo}],tj:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,go:Xr,gov:Xr,int:Xr,mil:Xr,name:Xr,net:Xr,nic:Xr,org:Xr,test:Xr,web:Xr}],tk:Xr,tl:io,tm:[1,{com:Xr,co:Xr,org:Xr,net:Xr,nom:Xr,gov:Xr,mil:Xr,edu:Xr}],tn:[1,{com:Xr,ens:Xr,fin:Xr,gov:Xr,ind:Xr,info:Xr,intl:Xr,mincom:Xr,nat:Xr,net:Xr,org:Xr,perso:Xr,tourism:Xr,orangecloud:eo}],to:[1,{611:eo,com:Xr,gov:Xr,net:Xr,org:Xr,edu:Xr,mil:Xr,oya:eo,rdv:eo,x0:eo,vpnplus:eo,quickconnect:fo,nyan:eo}],tr:[1,{av:Xr,bbs:Xr,bel:Xr,biz:Xr,com:no,dr:Xr,edu:Xr,gen:Xr,gov:Xr,info:Xr,mil:Xr,k12:Xr,kep:Xr,name:Xr,net:Xr,org:Xr,pol:Xr,tel:Xr,tsk:Xr,tv:Xr,web:Xr,nc:io}],tt:[1,{co:Xr,com:Xr,org:Xr,net:Xr,biz:Xr,info:Xr,pro:Xr,int:Xr,coop:Xr,jobs:Xr,mobi:Xr,travel:Xr,museum:Xr,aero:Xr,name:Xr,gov:Xr,edu:Xr}],tv:[1,{dyndns:eo,"better-than":eo,"on-the-web":eo,"worse-than":eo,from:eo,sakura:eo}],tw:[1,{edu:Xr,gov:Xr,mil:Xr,com:[1,{mymailer:eo}],net:Xr,org:Xr,idv:Xr,game:Xr,ebiz:Xr,club:Xr,"xn--zf0ao64a":Xr,網路:Xr,"xn--uc0atv":Xr,組織:Xr,"xn--czrw28b":Xr,商業:Xr,url:eo,blogspot:eo}],tz:[1,{ac:Xr,co:Xr,go:Xr,hotel:Xr,info:Xr,me:Xr,mil:Xr,mobi:Xr,ne:Xr,or:Xr,sc:Xr,tv:Xr}],ua:[1,{com:Xr,edu:Xr,gov:Xr,in:Xr,net:Xr,org:Xr,cherkassy:Xr,cherkasy:Xr,chernigov:Xr,chernihiv:Xr,chernivtsi:Xr,chernovtsy:Xr,ck:Xr,cn:Xr,cr:Xr,crimea:Xr,cv:Xr,dn:Xr,dnepropetrovsk:Xr,dnipropetrovsk:Xr,donetsk:Xr,dp:Xr,if:Xr,"ivano-frankivsk":Xr,kh:Xr,kharkiv:Xr,kharkov:Xr,kherson:Xr,khmelnitskiy:Xr,khmelnytskyi:Xr,kiev:Xr,kirovograd:Xr,km:Xr,kr:Xr,kropyvnytskyi:Xr,krym:Xr,ks:Xr,kv:Xr,kyiv:Xr,lg:Xr,lt:Xr,lugansk:Xr,luhansk:Xr,lutsk:Xr,lv:Xr,lviv:Xr,mk:Xr,mykolaiv:Xr,nikolaev:Xr,od:Xr,odesa:Xr,odessa:Xr,pl:Xr,poltava:Xr,rivne:Xr,rovno:Xr,rv:Xr,sb:Xr,sebastopol:Xr,sevastopol:Xr,sm:Xr,sumy:Xr,te:Xr,ternopil:Xr,uz:Xr,uzhgorod:Xr,uzhhorod:Xr,vinnica:Xr,vinnytsia:Xr,vn:Xr,volyn:Xr,yalta:Xr,zakarpattia:Xr,zaporizhzhe:Xr,zaporizhzhia:Xr,zhitomir:Xr,zhytomyr:Xr,zp:Xr,zt:Xr,cc:eo,inf:eo,ltd:eo,cx:eo,ie:eo,biz:eo,co:eo,pp:eo,v:eo}],ug:[1,{co:Xr,or:Xr,ac:Xr,sc:Xr,go:Xr,ne:Xr,com:Xr,org:Xr,blogspot:eo}],uk:[1,{ac:Xr,co:[1,{bytemark:[0,{dh:eo,vm:eo}],blogspot:eo,layershift:Xo,barsy:eo,barsyonline:eo,retrosnub:po,"nh-serv":eo,"no-ip":eo,wellbeingzone:eo,adimo:eo,myspreadshop:eo}],gov:[1,{campaign:eo,service:eo,api:eo,homeoffice:eo}],ltd:Xr,me:Xr,net:Xr,nhs:Xr,org:[1,{glug:eo,lug:eo,lugs:eo,affinitylottery:eo,raffleentry:eo,weeklylottery:eo}],plc:Xr,police:Xr,sch:oo,conn:eo,copro:eo,hosp:eo,"independent-commission":eo,"independent-inquest":eo,"independent-inquiry":eo,"independent-panel":eo,"independent-review":eo,"public-inquiry":eo,"royal-commission":eo,pymnt:eo,barsy:eo}],us:[1,{dni:Xr,fed:Xr,isa:Xr,kids:Xr,nsn:Xr,ak:Vo,al:Vo,ar:Vo,as:Vo,az:Vo,ca:Vo,co:Vo,ct:Vo,dc:Vo,de:[1,{cc:Xr,lib:eo}],fl:Vo,ga:Vo,gu:Vo,hi:Zo,ia:Vo,id:Vo,il:Vo,in:Vo,ks:Vo,ky:Vo,la:Vo,ma:[1,{k12:[1,{pvt:Xr,chtr:Xr,paroch:Xr}],cc:Xr,lib:Xr}],md:Vo,me:Vo,mi:[1,{k12:Xr,cc:Xr,lib:Xr,"ann-arbor":Xr,cog:Xr,dst:Xr,eaton:Xr,gen:Xr,mus:Xr,tec:Xr,washtenaw:Xr}],mn:Vo,mo:Vo,ms:Vo,mt:Vo,nc:Vo,nd:Zo,ne:Vo,nh:Vo,nj:Vo,nm:Vo,nv:Vo,ny:Vo,oh:Vo,ok:Vo,or:Vo,pa:Vo,pr:Vo,ri:Zo,sc:Vo,sd:Zo,tn:Vo,tx:Vo,ut:Vo,vi:Vo,vt:Vo,va:Vo,wa:Vo,wi:Vo,wv:[1,{cc:Xr}],wy:Vo,graphox:eo,cloudns:eo,drud:eo,"is-by":eo,"land-4-sale":eo,"stuff-4-sale":eo,enscaled:[0,{phx:eo}],mircloud:eo,freeddns:eo,golffan:eo,noip:eo,pointto:eo,platterp:eo}],uy:[1,{com:no,edu:Xr,gub:Xr,mil:Xr,net:Xr,org:Xr}],uz:[1,{co:Xr,com:Xr,net:Xr,org:Xr}],va:Xr,vc:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,mil:Xr,edu:Xr,gv:[2,{d:eo}],"0e":eo}],ve:[1,{arts:Xr,bib:Xr,co:Xr,com:Xr,e12:Xr,edu:Xr,firm:Xr,gob:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,rar:Xr,rec:Xr,store:Xr,tec:Xr,web:Xr}],vg:[1,{at:eo}],vi:[1,{co:Xr,com:Xr,k12:Xr,net:Xr,org:Xr}],vn:[1,{ac:Xr,ai:Xr,biz:Xr,com:Xr,edu:Xr,gov:Xr,health:Xr,id:Xr,info:Xr,int:Xr,io:Xr,name:Xr,net:Xr,org:Xr,pro:Xr,angiang:Xr,bacgiang:Xr,backan:Xr,baclieu:Xr,bacninh:Xr,"baria-vungtau":Xr,bentre:Xr,binhdinh:Xr,binhduong:Xr,binhphuoc:Xr,binhthuan:Xr,camau:Xr,cantho:Xr,caobang:Xr,daklak:Xr,daknong:Xr,danang:Xr,dienbien:Xr,dongnai:Xr,dongthap:Xr,gialai:Xr,hagiang:Xr,haiduong:Xr,haiphong:Xr,hanam:Xr,hanoi:Xr,hatinh:Xr,haugiang:Xr,hoabinh:Xr,hungyen:Xr,khanhhoa:Xr,kiengiang:Xr,kontum:Xr,laichau:Xr,lamdong:Xr,langson:Xr,laocai:Xr,longan:Xr,namdinh:Xr,nghean:Xr,ninhbinh:Xr,ninhthuan:Xr,phutho:Xr,phuyen:Xr,quangbinh:Xr,quangnam:Xr,quangngai:Xr,quangninh:Xr,quangtri:Xr,soctrang:Xr,sonla:Xr,tayninh:Xr,thaibinh:Xr,thainguyen:Xr,thanhhoa:Xr,thanhphohochiminh:Xr,thuathienhue:Xr,tiengiang:Xr,travinh:Xr,tuyenquang:Xr,vinhlong:Xr,vinhphuc:Xr,yenbai:Xr,blogspot:eo}],vu:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,cn:eo,blog:eo,dev:eo,me:eo}],wf:[1,{biz:eo,sch:eo}],ws:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,advisor:ro,cloud66:eo,dyndns:eo,mypets:eo}],yt:[1,{org:eo}],"xn--mgbaam7a8h":Xr,امارات:Xr,"xn--y9a3aq":Xr,հայ:Xr,"xn--54b7fta0cc":Xr,বাংলা:Xr,"xn--90ae":Xr,бг:Xr,"xn--mgbcpq6gpa1a":Xr,البحرين:Xr,"xn--90ais":Xr,бел:Xr,"xn--fiqs8s":Xr,中国:Xr,"xn--fiqz9s":Xr,中國:Xr,"xn--lgbbat1ad8j":Xr,الجزائر:Xr,"xn--wgbh1c":Xr,مصر:Xr,"xn--e1a4c":Xr,ею:Xr,"xn--qxa6a":Xr,ευ:Xr,"xn--mgbah1a3hjkrd":Xr,موريتانيا:Xr,"xn--node":Xr,გე:Xr,"xn--qxam":Xr,ελ:Xr,"xn--j6w193g":[1,{"xn--55qx5d":Xr,"xn--wcvs22d":Xr,"xn--mxtq1m":Xr,"xn--gmqw5a":Xr,"xn--od0alg":Xr,"xn--uc0atv":Xr}],香港:[1,{公司:Xr,教育:Xr,政府:Xr,個人:Xr,網絡:Xr,組織:Xr}],"xn--2scrj9c":Xr,ಭಾರತ:Xr,"xn--3hcrj9c":Xr,ଭାରତ:Xr,"xn--45br5cyl":Xr,ভাৰত:Xr,"xn--h2breg3eve":Xr,भारतम्:Xr,"xn--h2brj9c8c":Xr,भारोत:Xr,"xn--mgbgu82a":Xr,ڀارت:Xr,"xn--rvc1e0am3e":Xr,ഭാരതം:Xr,"xn--h2brj9c":Xr,भारत:Xr,"xn--mgbbh1a":Xr,بارت:Xr,"xn--mgbbh1a71e":Xr,بھارت:Xr,"xn--fpcrj9c3d":Xr,భారత్:Xr,"xn--gecrj9c":Xr,ભારત:Xr,"xn--s9brj9c":Xr,ਭਾਰਤ:Xr,"xn--45brj9c":Xr,ভারত:Xr,"xn--xkc2dl3a5ee0h":Xr,இந்தியா:Xr,"xn--mgba3a4f16a":Xr,ایران:Xr,"xn--mgba3a4fra":Xr,ايران:Xr,"xn--mgbtx2b":Xr,عراق:Xr,"xn--mgbayh7gpa":Xr,الاردن:Xr,"xn--3e0b707e":Xr,한국:Xr,"xn--80ao21a":Xr,қаз:Xr,"xn--q7ce6a":Xr,ລາວ:Xr,"xn--fzc2c9e2c":Xr,ලංකා:Xr,"xn--xkc2al3hye2a":Xr,இலங்கை:Xr,"xn--mgbc0a9azcg":Xr,المغرب:Xr,"xn--d1alf":Xr,мкд:Xr,"xn--l1acc":Xr,мон:Xr,"xn--mix891f":Xr,澳門:Xr,"xn--mix082f":Xr,澳门:Xr,"xn--mgbx4cd0ab":Xr,مليسيا:Xr,"xn--mgb9awbf":Xr,عمان:Xr,"xn--mgbai9azgqp6j":Xr,پاکستان:Xr,"xn--mgbai9a5eva00b":Xr,پاكستان:Xr,"xn--ygbi2ammx":Xr,فلسطين:Xr,"xn--90a3ac":[1,{"xn--o1ac":Xr,"xn--c1avg":Xr,"xn--90azh":Xr,"xn--d1at":Xr,"xn--o1ach":Xr,"xn--80au":Xr}],срб:[1,{пр:Xr,орг:Xr,обр:Xr,од:Xr,упр:Xr,ак:Xr}],"xn--p1ai":Xr,рф:Xr,"xn--wgbl6a":Xr,قطر:Xr,"xn--mgberp4a5d4ar":Xr,السعودية:Xr,"xn--mgberp4a5d4a87g":Xr,السعودیة:Xr,"xn--mgbqly7c0a67fbc":Xr,السعودیۃ:Xr,"xn--mgbqly7cvafr":Xr,السعوديه:Xr,"xn--mgbpl2fh":Xr,سودان:Xr,"xn--yfro4i67o":Xr,新加坡:Xr,"xn--clchc0ea0b2g2a9gcd":Xr,சிங்கப்பூர்:Xr,"xn--ogbpf8fl":Xr,سورية:Xr,"xn--mgbtf8fl":Xr,سوريا:Xr,"xn--o3cw4h":[1,{"xn--12c1fe0br":Xr,"xn--12co0c3b4eva":Xr,"xn--h3cuzk1di":Xr,"xn--o3cyx2a":Xr,"xn--m3ch0j3a":Xr,"xn--12cfi8ixb8l":Xr}],ไทย:[1,{ศึกษา:Xr,ธุรกิจ:Xr,รัฐบาล:Xr,ทหาร:Xr,เน็ต:Xr,องค์กร:Xr}],"xn--pgbs0dh":Xr,تونس:Xr,"xn--kpry57d":Xr,台灣:Xr,"xn--kprw13d":Xr,台湾:Xr,"xn--nnx388a":Xr,臺灣:Xr,"xn--j1amh":Xr,укр:Xr,"xn--mgb2ddes":Xr,اليمن:Xr,xxx:Xr,ye:bo,za:[0,{ac:Xr,agric:Xr,alt:Xr,co:no,edu:Xr,gov:Xr,grondar:Xr,law:Xr,mil:Xr,net:Xr,ngo:Xr,nic:Xr,nis:Xr,nom:Xr,org:Xr,school:Xr,tm:Xr,web:Xr}],zm:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,gov:Xr,info:Xr,mil:Xr,net:Xr,org:Xr,sch:Xr}],zw:[1,{ac:Xr,co:Xr,gov:Xr,mil:Xr,org:Xr}],aaa:Xr,aarp:Xr,abb:Xr,abbott:Xr,abbvie:Xr,abc:Xr,able:Xr,abogado:Xr,abudhabi:Xr,academy:[1,{official:eo}],accenture:Xr,accountant:Xr,accountants:Xr,aco:Xr,actor:Xr,ads:Xr,adult:Xr,aeg:Xr,aetna:Xr,afl:Xr,africa:Xr,agakhan:Xr,agency:Xr,aig:Xr,airbus:Xr,airforce:Xr,airtel:Xr,akdn:Xr,alibaba:Xr,alipay:Xr,allfinanz:Xr,allstate:Xr,ally:Xr,alsace:Xr,alstom:Xr,amazon:Xr,americanexpress:Xr,americanfamily:Xr,amex:Xr,amfam:Xr,amica:Xr,amsterdam:Xr,analytics:Xr,android:Xr,anquan:Xr,anz:Xr,aol:Xr,apartments:Xr,app:[1,{beget:ro,clerk:eo,clerkstage:eo,wnext:eo,platform0:eo,deta:eo,ondigitalocean:eo,easypanel:eo,encr:eo,edgecompute:eo,fireweb:eo,onflashdrive:eo,framer:eo,run:[2,{a:eo}],web:eo,hasura:eo,loginline:eo,messerli:eo,netlify:eo,ngrok:eo,"ngrok-free":eo,developer:ro,noop:eo,northflank:ro,snowflake:[2,{privatelink:eo}],streamlit:eo,storipress:eo,telebit:eo,typedream:eo,vercel:eo,bookonline:eo}],apple:Xr,aquarelle:Xr,arab:Xr,aramco:Xr,archi:Xr,army:Xr,art:Xr,arte:Xr,asda:Xr,associates:Xr,athleta:Xr,attorney:Xr,auction:Xr,audi:Xr,audible:Xr,audio:Xr,auspost:Xr,author:Xr,auto:Xr,autos:Xr,avianca:Xr,aws:Xr,axa:Xr,azure:Xr,baby:Xr,baidu:Xr,banamex:Xr,bananarepublic:Xr,band:Xr,bank:Xr,bar:Xr,barcelona:Xr,barclaycard:Xr,barclays:Xr,barefoot:Xr,bargains:Xr,baseball:Xr,basketball:[1,{aus:eo,nz:eo}],bauhaus:Xr,bayern:Xr,bbc:Xr,bbt:Xr,bbva:Xr,bcg:Xr,bcn:Xr,beats:Xr,beauty:Xr,beer:Xr,bentley:Xr,berlin:Xr,best:Xr,bestbuy:Xr,bet:Xr,bharti:Xr,bible:Xr,bid:Xr,bike:Xr,bing:Xr,bingo:Xr,bio:Xr,black:Xr,blackfriday:Xr,blockbuster:Xr,blog:Xr,bloomberg:Xr,blue:Xr,bms:Xr,bmw:Xr,bnpparibas:Xr,boats:Xr,boehringer:Xr,bofa:Xr,bom:Xr,bond:Xr,boo:Xr,book:Xr,booking:Xr,bosch:Xr,bostik:Xr,boston:Xr,bot:Xr,boutique:Xr,box:Xr,bradesco:Xr,bridgestone:Xr,broadway:Xr,broker:Xr,brother:Xr,brussels:Xr,build:Xr,builders:[1,{cloudsite:eo}],business:so,buy:Xr,buzz:Xr,bzh:Xr,cab:Xr,cafe:Xr,cal:Xr,call:Xr,calvinklein:Xr,cam:Xr,camera:Xr,camp:Xr,canon:Xr,capetown:Xr,capital:Xr,capitalone:Xr,car:Xr,caravan:Xr,cards:Xr,care:Xr,career:Xr,careers:Xr,cars:Xr,casa:[1,{nabu:[0,{ui:eo}]}],case:Xr,cash:Xr,casino:Xr,catering:Xr,catholic:Xr,cba:Xr,cbn:Xr,cbre:Xr,cbs:Xr,center:Xr,ceo:Xr,cern:Xr,cfa:Xr,cfd:Xr,chanel:Xr,channel:Xr,charity:Xr,chase:Xr,chat:Xr,cheap:Xr,chintai:Xr,christmas:Xr,chrome:Xr,church:Xr,cipriani:Xr,circle:Xr,cisco:Xr,citadel:Xr,citi:Xr,citic:Xr,city:Xr,cityeats:Xr,claims:Xr,cleaning:Xr,click:Xr,clinic:Xr,clinique:Xr,clothing:Xr,cloud:[1,{banzai:ro,elementor:eo,encoway:[0,{eu:eo}],statics:ro,ravendb:eo,axarnet:[0,{"es-1":eo}],diadem:eo,jelastic:[0,{vip:eo}],jele:eo,"jenv-aruba":[0,{aruba:[0,{eur:[0,{it1:eo}]}],it1:eo}],keliweb:[2,{cs:eo}],oxa:[2,{tn:eo,uk:eo}],primetel:[2,{uk:eo}],reclaim:[0,{ca:eo,uk:eo,us:eo}],trendhosting:[0,{ch:eo,de:eo}],jotelulu:eo,kuleuven:eo,linkyard:eo,magentosite:ro,perspecta:eo,vapor:eo,"on-rancher":ro,scw:[0,{baremetal:[0,{"fr-par-1":eo,"fr-par-2":eo,"nl-ams-1":eo}],"fr-par":[0,{fnc:[2,{functions:eo}],k8s:co,s3:eo,"s3-website":eo,whm:eo}],instances:[0,{priv:eo,pub:eo}],k8s:eo,"nl-ams":[0,{k8s:co,s3:eo,"s3-website":eo,whm:eo}],"pl-waw":[0,{k8s:co,s3:eo,"s3-website":eo}],scalebook:eo,smartlabeling:eo}],sensiosite:ro,trafficplex:eo,urown:eo,voorloper:eo}],club:[1,{cloudns:eo,jele:eo,barsy:eo}],clubmed:Xr,coach:Xr,codes:[1,{owo:ro}],coffee:Xr,college:Xr,cologne:Xr,comcast:Xr,commbank:Xr,community:[1,{nog:eo,ravendb:eo,myforum:eo}],company:Xr,compare:Xr,computer:Xr,comsec:Xr,condos:Xr,construction:Xr,consulting:Xr,contact:Xr,contractors:Xr,cooking:Xr,cool:[1,{elementor:eo,de:eo}],corsica:Xr,country:Xr,coupon:Xr,coupons:Xr,courses:Xr,cpa:Xr,credit:Xr,creditcard:Xr,creditunion:Xr,cricket:Xr,crown:Xr,crs:Xr,cruise:Xr,cruises:Xr,cuisinella:Xr,cymru:Xr,cyou:Xr,dabur:Xr,dad:Xr,dance:Xr,data:Xr,date:Xr,dating:Xr,datsun:Xr,day:Xr,dclk:Xr,dds:Xr,deal:Xr,dealer:Xr,deals:Xr,degree:Xr,delivery:Xr,dell:Xr,deloitte:Xr,delta:Xr,democrat:Xr,dental:Xr,dentist:Xr,desi:Xr,design:[1,{bss:eo}],dev:[1,{autocode:eo,lcl:ro,lclstage:ro,stg:ro,stgstage:ro,pages:eo,r2:eo,workers:eo,curv:eo,deno:eo,"deno-staging":eo,deta:eo,fly:eo,githubpreview:eo,gateway:ro,iserv:eo,localcert:[0,{user:ro}],loginline:eo,mediatech:eo,ngrok:eo,"ngrok-free":eo,"platter-app":eo,shiftcrypto:eo,vercel:eo,webhare:ro}],dhl:Xr,diamonds:Xr,diet:Xr,digital:[1,{cloudapps:[2,{london:eo}]}],direct:Xr,directory:Xr,discount:Xr,discover:Xr,dish:Xr,diy:Xr,dnp:Xr,docs:Xr,doctor:Xr,dog:Xr,domains:Xr,dot:Xr,download:Xr,drive:Xr,dtv:Xr,dubai:Xr,dunlop:Xr,dupont:Xr,durban:Xr,dvag:Xr,dvr:Xr,earth:[1,{dapps:[0,{"*":eo,bzz:ro}]}],eat:Xr,eco:Xr,edeka:Xr,education:so,email:Xr,emerck:Xr,energy:Xr,engineer:Xr,engineering:Xr,enterprises:Xr,epson:Xr,equipment:Xr,ericsson:Xr,erni:Xr,esq:Xr,estate:[1,{compute:ro}],etisalat:Xr,eurovision:Xr,eus:[1,{party:Bo}],events:[1,{koobin:eo,co:eo}],exchange:Xr,expert:Xr,exposed:Xr,express:Xr,extraspace:Xr,fage:Xr,fail:Xr,fairwinds:Xr,faith:xo,family:Xr,fan:Xr,fans:Xr,farm:[1,{storj:eo}],farmers:Xr,fashion:Xr,fast:Xr,fedex:Xr,feedback:Xr,ferrari:Xr,ferrero:Xr,fidelity:Xr,fido:Xr,film:Xr,final:Xr,finance:Xr,financial:so,fire:Xr,firestone:Xr,firmdale:Xr,fish:Xr,fishing:Xr,fit:Xr,fitness:Xr,flickr:Xr,flights:Xr,flir:Xr,florist:Xr,flowers:Xr,fly:Xr,foo:Xr,food:Xr,football:Xr,ford:Xr,forex:Xr,forsale:Xr,forum:Xr,foundation:Xr,fox:Xr,free:Xr,fresenius:Xr,frl:Xr,frogans:Xr,frontdoor:Xr,frontier:Xr,ftr:Xr,fujitsu:Xr,fun:Xr,fund:Xr,furniture:Xr,futbol:Xr,fyi:Xr,gal:Xr,gallery:Xr,gallo:Xr,gallup:Xr,game:Xr,games:Xr,gap:Xr,garden:Xr,gay:Xr,gbiz:Xr,gdn:[1,{cnpy:eo}],gea:Xr,gent:Xr,genting:Xr,george:Xr,ggee:Xr,gift:Xr,gifts:Xr,gives:Xr,giving:Xr,glass:Xr,gle:Xr,global:Xr,globo:Xr,gmail:Xr,gmbh:Xr,gmo:Xr,gmx:Xr,godaddy:Xr,gold:Xr,goldpoint:Xr,golf:Xr,goo:Xr,goodyear:Xr,goog:[1,{cloud:eo,translate:eo,usercontent:ro}],google:Xr,gop:Xr,got:Xr,grainger:Xr,graphics:Xr,gratis:Xr,green:Xr,gripe:Xr,grocery:Xr,group:[1,{discourse:eo}],guardian:Xr,gucci:Xr,guge:Xr,guide:Xr,guitars:Xr,guru:Xr,hair:Xr,hamburg:Xr,hangout:Xr,haus:Xr,hbo:Xr,hdfc:Xr,hdfcbank:Xr,health:[1,{hra:eo}],healthcare:Xr,help:Xr,helsinki:Xr,here:Xr,hermes:Xr,hiphop:Xr,hisamitsu:Xr,hitachi:Xr,hiv:Xr,hkt:Xr,hockey:Xr,holdings:Xr,holiday:Xr,homedepot:Xr,homegoods:Xr,homes:Xr,homesense:Xr,honda:Xr,horse:Xr,hospital:Xr,host:[1,{cloudaccess:eo,freesite:eo,easypanel:eo,fastvps:eo,myfast:eo,tempurl:eo,wpmudev:eo,jele:eo,mircloud:eo,pcloud:eo,half:eo}],hosting:[1,{opencraft:eo}],hot:Xr,hotels:Xr,hotmail:Xr,house:Xr,how:Xr,hsbc:Xr,hughes:Xr,hyatt:Xr,hyundai:Xr,ibm:Xr,icbc:Xr,ice:Xr,icu:Xr,ieee:Xr,ifm:Xr,ikano:Xr,imamat:Xr,imdb:Xr,immo:Xr,immobilien:Xr,inc:Xr,industries:Xr,infiniti:Xr,ing:Xr,ink:Xr,institute:Xr,insurance:Xr,insure:Xr,international:Xr,intuit:Xr,investments:Xr,ipiranga:Xr,irish:Xr,ismaili:Xr,ist:Xr,istanbul:Xr,itau:Xr,itv:Xr,jaguar:Xr,java:Xr,jcb:Xr,jeep:Xr,jetzt:Xr,jewelry:Xr,jio:Xr,jll:Xr,jmp:Xr,jnj:Xr,joburg:Xr,jot:Xr,joy:Xr,jpmorgan:Xr,jprs:Xr,juegos:Xr,juniper:Xr,kaufen:Xr,kddi:Xr,kerryhotels:Xr,kerrylogistics:Xr,kerryproperties:Xr,kfh:Xr,kia:Xr,kids:Xr,kim:Xr,kinder:Xr,kindle:Xr,kitchen:Xr,kiwi:Xr,koeln:Xr,komatsu:Xr,kosher:Xr,kpmg:Xr,kpn:Xr,krd:[1,{co:eo,edu:eo}],kred:Xr,kuokgroup:Xr,kyoto:Xr,lacaixa:Xr,lamborghini:Xr,lamer:Xr,lancaster:Xr,land:[1,{static:[2,{dev:eo,sites:eo}]}],landrover:Xr,lanxess:Xr,lasalle:Xr,lat:Xr,latino:Xr,latrobe:Xr,law:Xr,lawyer:Xr,lds:Xr,lease:Xr,leclerc:Xr,lefrak:Xr,legal:Xr,lego:Xr,lexus:Xr,lgbt:Xr,lidl:Xr,life:Xr,lifeinsurance:Xr,lifestyle:Xr,lighting:Xr,like:Xr,lilly:Xr,limited:Xr,limo:Xr,lincoln:Xr,link:[1,{cyon:eo,mypep:eo,dweb:ro}],lipsy:Xr,live:[1,{hlx:eo}],living:Xr,llc:Xr,llp:Xr,loan:Xr,loans:Xr,locker:Xr,locus:Xr,lol:[1,{omg:eo}],london:Xr,lotte:Xr,lotto:Xr,love:Xr,lpl:Xr,lplfinancial:Xr,ltd:Xr,ltda:Xr,lundbeck:Xr,luxe:Xr,luxury:Xr,madrid:Xr,maif:Xr,maison:Xr,makeup:Xr,man:Xr,management:[1,{router:eo}],mango:Xr,map:Xr,market:Xr,marketing:Xr,markets:Xr,marriott:Xr,marshalls:Xr,mattel:Xr,mba:Xr,mckinsey:Xr,med:Xr,media:Co,meet:Xr,melbourne:Xr,meme:Xr,memorial:Xr,men:Xr,menu:Ro,merckmsd:Xr,miami:Xr,microsoft:Xr,mini:Xr,mint:Xr,mit:Xr,mitsubishi:Xr,mlb:Xr,mls:Xr,mma:Xr,mobile:Xr,moda:Xr,moe:Xr,moi:Xr,mom:Xr,monash:Xr,money:Xr,monster:Xr,mormon:Xr,mortgage:Xr,moscow:Xr,moto:Xr,motorcycles:Xr,mov:Xr,movie:Xr,msd:Xr,mtn:Xr,mtr:Xr,music:Xr,nab:Xr,nagoya:Xr,natura:Xr,navy:Xr,nba:Xr,nec:Xr,netbank:Xr,netflix:Xr,network:[1,{alces:ro,co:eo,arvo:eo,azimuth:eo,tlon:eo}],neustar:Xr,new:Xr,news:[1,{noticeable:eo}],next:Xr,nextdirect:Xr,nexus:Xr,nfl:Xr,ngo:Xr,nhk:Xr,nico:Xr,nike:Xr,nikon:Xr,ninja:Xr,nissan:Xr,nissay:Xr,nokia:Xr,norton:Xr,now:Xr,nowruz:Xr,nowtv:Xr,nra:Xr,nrw:Xr,ntt:Xr,nyc:Xr,obi:Xr,observer:Xr,office:Xr,okinawa:Xr,olayan:Xr,olayangroup:Xr,oldnavy:Xr,ollo:Xr,omega:Xr,one:[1,{onred:[2,{staging:eo}],service:eo,homelink:eo}],ong:Xr,onl:Xr,online:[1,{eero:eo,"eero-stage":eo,barsy:eo}],ooo:Xr,open:Xr,oracle:Xr,orange:[1,{tech:eo}],organic:Xr,origins:Xr,osaka:Xr,otsuka:Xr,ott:Xr,ovh:[1,{nerdpol:eo}],page:[1,{hlx:eo,hlx3:eo,translated:eo,codeberg:eo,pdns:eo,plesk:eo,prvcy:eo,rocky:eo,magnet:eo}],panasonic:Xr,paris:Xr,pars:Xr,partners:Xr,parts:Xr,party:xo,pay:Xr,pccw:Xr,pet:Xr,pfizer:Xr,pharmacy:Xr,phd:Xr,philips:Xr,phone:Xr,photo:Xr,photography:Xr,photos:Co,physio:Xr,pics:Xr,pictet:Xr,pictures:[1,{1337:eo}],pid:Xr,pin:Xr,ping:Xr,pink:Xr,pioneer:Xr,pizza:[1,{ngrok:eo}],place:so,play:Xr,playstation:Xr,plumbing:Xr,plus:Xr,pnc:Xr,pohl:Xr,poker:Xr,politie:Xr,porn:[1,{indie:eo}],pramerica:Xr,praxi:Xr,press:Xr,prime:Xr,prod:Xr,productions:Xr,prof:Xr,progressive:Xr,promo:Xr,properties:Xr,property:Xr,protection:Xr,pru:Xr,prudential:Xr,pub:Ro,pwc:Xr,qpon:Xr,quebec:Xr,quest:Xr,racing:Xr,radio:Xr,read:Xr,realestate:Xr,realtor:Xr,realty:Xr,recipes:Xr,red:Xr,redstone:Xr,redumbrella:Xr,rehab:Xr,reise:Xr,reisen:Xr,reit:Xr,reliance:Xr,ren:Xr,rent:Xr,rentals:Xr,repair:Xr,report:Xr,republican:Xr,rest:Xr,restaurant:Xr,review:xo,reviews:Xr,rexroth:Xr,rich:Xr,richardli:Xr,ricoh:Xr,ril:Xr,rio:Xr,rip:[1,{clan:eo}],rocher:Xr,rocks:[1,{myddns:eo,"lima-city":eo,webspace:eo}],rodeo:Xr,rogers:Xr,room:Xr,rsvp:Xr,rugby:Xr,ruhr:Xr,run:[1,{hs:eo,development:eo,ravendb:eo,servers:eo,build:ro,code:ro,database:ro,migration:ro,onporter:eo,repl:eo,wix:eo}],rwe:Xr,ryukyu:Xr,saarland:Xr,safe:Xr,safety:Xr,sakura:Xr,sale:Xr,salon:Xr,samsclub:Xr,samsung:Xr,sandvik:Xr,sandvikcoromant:Xr,sanofi:Xr,sap:Xr,sarl:Xr,sas:Xr,save:Xr,saxo:Xr,sbi:Xr,sbs:Xr,sca:Xr,scb:Xr,schaeffler:Xr,schmidt:Xr,scholarships:Xr,school:Xr,schule:Xr,schwarz:Xr,science:xo,scot:[1,{edu:eo,gov:[2,{service:eo}]}],search:Xr,seat:Xr,secure:Xr,security:Xr,seek:Xr,select:Xr,sener:Xr,services:[1,{loginline:eo}],seven:Xr,sew:Xr,sex:Xr,sexy:Xr,sfr:Xr,shangrila:Xr,sharp:Xr,shaw:Xr,shell:Xr,shia:Xr,shiksha:Xr,shoes:Xr,shop:[1,{base:eo,hoplix:eo,barsy:eo}],shopping:Xr,shouji:Xr,show:Xr,showtime:Xr,silk:Xr,sina:Xr,singles:Xr,site:[1,{cloudera:ro,cyon:eo,fnwk:eo,folionetwork:eo,fastvps:eo,jele:eo,lelux:eo,loginline:eo,barsy:eo,mintere:eo,omniwe:eo,opensocial:eo,platformsh:ro,tst:ro,byen:eo,srht:eo,novecore:eo}],ski:Xr,skin:Xr,sky:Xr,skype:Xr,sling:Xr,smart:Xr,smile:Xr,sncf:Xr,soccer:Xr,social:Xr,softbank:Xr,software:Xr,sohu:Xr,solar:Xr,solutions:[1,{diher:ro}],song:Xr,sony:Xr,soy:Xr,spa:Xr,space:[1,{myfast:eo,uber:eo,xs4all:eo}],sport:Xr,spot:Xr,srl:Xr,stada:Xr,staples:Xr,star:Xr,statebank:Xr,statefarm:Xr,stc:Xr,stcgroup:Xr,stockholm:Xr,storage:Xr,store:[1,{sellfy:eo,shopware:eo,storebase:eo}],stream:Xr,studio:Xr,study:Xr,style:Xr,sucks:Xr,supplies:Xr,supply:Xr,support:Ro,surf:Xr,surgery:Xr,suzuki:Xr,swatch:Xr,swiss:Xr,sydney:Xr,systems:[1,{knightpoint:eo}],tab:Xr,taipei:Xr,talk:Xr,taobao:Xr,target:Xr,tatamotors:Xr,tatar:Xr,tattoo:Xr,tax:Xr,taxi:Xr,tci:Xr,tdk:Xr,team:[1,{discourse:eo,jelastic:eo}],tech:Xr,technology:so,temasek:Xr,tennis:Xr,teva:Xr,thd:Xr,theater:Xr,theatre:Xr,tiaa:Xr,tickets:Xr,tienda:Xr,tips:Xr,tires:Xr,tirol:Xr,tjmaxx:Xr,tjx:Xr,tkmaxx:Xr,tmall:Xr,today:[1,{prequalifyme:eo}],tokyo:Xr,tools:Xr,top:[1,{"now-dns":eo,ntdll:eo}],toray:Xr,toshiba:Xr,total:Xr,tours:Xr,town:Xr,toyota:Xr,toys:Xr,trade:xo,trading:Xr,training:Xr,travel:Xr,travelers:Xr,travelersinsurance:Xr,trust:Xr,trv:Xr,tube:Xr,tui:Xr,tunes:Xr,tushu:Xr,tvs:Xr,ubank:Xr,ubs:Xr,unicom:Xr,university:Xr,uno:Xr,uol:Xr,ups:Xr,vacations:Xr,vana:Xr,vanguard:Xr,vegas:Xr,ventures:Xr,verisign:Xr,versicherung:Xr,vet:Xr,viajes:Xr,video:Xr,vig:Xr,viking:Xr,villas:Xr,vin:Xr,vip:Xr,virgin:Xr,visa:Xr,vision:Xr,viva:Xr,vivo:Xr,vlaanderen:Xr,vodka:Xr,volkswagen:Xr,volvo:Xr,vote:Xr,voting:Xr,voto:Xr,voyage:Xr,wales:Xr,walmart:Xr,walter:Xr,wang:Xr,wanggou:Xr,watch:Xr,watches:Xr,weather:Xr,weatherchannel:Xr,webcam:Xr,weber:Xr,website:Co,wedding:Xr,weibo:Xr,weir:Xr,whoswho:Xr,wien:Xr,wiki:Co,williamhill:Xr,win:Xr,windows:Xr,wine:Xr,winners:Xr,wme:Xr,wolterskluwer:Xr,woodside:Xr,work:Xr,works:Xr,world:Xr,wow:Xr,wtc:Xr,wtf:Xr,xbox:Xr,xerox:Xr,xfinity:Xr,xihuan:Xr,xin:Xr,"xn--11b4c3d":Xr,कॉम:Xr,"xn--1ck2e1b":Xr,セール:Xr,"xn--1qqw23a":Xr,佛山:Xr,"xn--30rr7y":Xr,慈善:Xr,"xn--3bst00m":Xr,集团:Xr,"xn--3ds443g":Xr,在线:Xr,"xn--3pxu8k":Xr,点看:Xr,"xn--42c2d9a":Xr,คอม:Xr,"xn--45q11c":Xr,八卦:Xr,"xn--4gbrim":Xr,موقع:Xr,"xn--55qw42g":Xr,公益:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--5su34j936bgsg":Xr,香格里拉:Xr,"xn--5tzm5g":Xr,网站:Xr,"xn--6frz82g":Xr,移动:Xr,"xn--6qq986b3xl":Xr,我爱你:Xr,"xn--80adxhks":Xr,москва:Xr,"xn--80aqecdr1a":Xr,католик:Xr,"xn--80asehdb":Xr,онлайн:Xr,"xn--80aswg":Xr,сайт:Xr,"xn--8y0a063a":Xr,联通:Xr,"xn--9dbq2a":Xr,קום:Xr,"xn--9et52u":Xr,时尚:Xr,"xn--9krt00a":Xr,微博:Xr,"xn--b4w605ferd":Xr,淡马锡:Xr,"xn--bck1b9a5dre4c":Xr,ファッション:Xr,"xn--c1avg":Xr,орг:Xr,"xn--c2br7g":Xr,नेट:Xr,"xn--cck2b3b":Xr,ストア:Xr,"xn--cckwcxetd":Xr,アマゾン:Xr,"xn--cg4bki":Xr,삼성:Xr,"xn--czr694b":Xr,商标:Xr,"xn--czrs0t":Xr,商店:Xr,"xn--czru2d":Xr,商城:Xr,"xn--d1acj3b":Xr,дети:Xr,"xn--eckvdtc9d":Xr,ポイント:Xr,"xn--efvy88h":Xr,新闻:Xr,"xn--fct429k":Xr,家電:Xr,"xn--fhbei":Xr,كوم:Xr,"xn--fiq228c5hs":Xr,中文网:Xr,"xn--fiq64b":Xr,中信:Xr,"xn--fjq720a":Xr,娱乐:Xr,"xn--flw351e":Xr,谷歌:Xr,"xn--fzys8d69uvgm":Xr,電訊盈科:Xr,"xn--g2xx48c":Xr,购物:Xr,"xn--gckr3f0f":Xr,クラウド:Xr,"xn--gk3at1e":Xr,通販:Xr,"xn--hxt814e":Xr,网店:Xr,"xn--i1b6b1a6a2e":Xr,संगठन:Xr,"xn--imr513n":Xr,餐厅:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--j1aef":Xr,ком:Xr,"xn--jlq480n2rg":Xr,亚马逊:Xr,"xn--jvr189m":Xr,食品:Xr,"xn--kcrx77d1x4a":Xr,飞利浦:Xr,"xn--kput3i":Xr,手机:Xr,"xn--mgba3a3ejt":Xr,ارامكو:Xr,"xn--mgba7c0bbn0a":Xr,العليان:Xr,"xn--mgbaakc7dvf":Xr,اتصالات:Xr,"xn--mgbab2bd":Xr,بازار:Xr,"xn--mgbca7dzdo":Xr,ابوظبي:Xr,"xn--mgbi4ecexp":Xr,كاثوليك:Xr,"xn--mgbt3dhd":Xr,همراه:Xr,"xn--mk1bu44c":Xr,닷컴:Xr,"xn--mxtq1m":Xr,政府:Xr,"xn--ngbc5azd":Xr,شبكة:Xr,"xn--ngbe9e0a":Xr,بيتك:Xr,"xn--ngbrx":Xr,عرب:Xr,"xn--nqv7f":Xr,机构:Xr,"xn--nqv7fs00ema":Xr,组织机构:Xr,"xn--nyqy26a":Xr,健康:Xr,"xn--otu796d":Xr,招聘:Xr,"xn--p1acf":[1,{"xn--90amc":eo,"xn--j1aef":eo,"xn--j1ael8b":eo,"xn--h1ahn":eo,"xn--j1adp":eo,"xn--c1avg":eo,"xn--80aaa0cvac":eo,"xn--h1aliz":eo,"xn--90a1af":eo,"xn--41a":eo}],рус:[1,{биз:eo,ком:eo,крым:eo,мир:eo,мск:eo,орг:eo,самара:eo,сочи:eo,спб:eo,я:eo}],"xn--pssy2u":Xr,大拿:Xr,"xn--q9jyb4c":Xr,みんな:Xr,"xn--qcka1pmc":Xr,グーグル:Xr,"xn--rhqv96g":Xr,世界:Xr,"xn--rovu88b":Xr,書籍:Xr,"xn--ses554g":Xr,网址:Xr,"xn--t60b56a":Xr,닷넷:Xr,"xn--tckwe":Xr,コム:Xr,"xn--tiq49xqyj":Xr,天主教:Xr,"xn--unup4y":Xr,游戏:Xr,"xn--vermgensberater-ctb":Xr,vermögensberater:Xr,"xn--vermgensberatung-pwb":Xr,vermögensberatung:Xr,"xn--vhquv":Xr,企业:Xr,"xn--vuq861b":Xr,信息:Xr,"xn--w4r85el8fhu5dnra":Xr,嘉里大酒店:Xr,"xn--w4rs40l":Xr,嘉里:Xr,"xn--xhq521b":Xr,广东:Xr,"xn--zfr164b":Xr,政务:Xr,xyz:[1,{blogsite:eo,localzone:eo,crafting:eo,zapto:eo,telebit:ro}],yachts:Xr,yahoo:Xr,yamaxun:Xr,yandex:Xr,yodobashi:Xr,yoga:Xr,yokohama:Xr,you:Xr,youtube:Xr,yun:Xr,zappos:Xr,zara:Xr,zero:Xr,zip:Xr,zone:[1,{cloud66:eo,hs:eo,triton:ro,lima:eo}],zuerich:Xr}]}();function lookupInTrie(Xr,eo,to,ro){let no=null,io=eo;for(;io!==void 0&&(io[0]&ro&&(no={index:to+1,isIcann:io[0]===1,isPrivate:io[0]===2}),to!==-1);){const oo=io[1];io=Object.prototype.hasOwnProperty.call(oo,Xr[to])?oo[Xr[to]]:oo["*"],to-=1}return no}function suffixLookup(Xr,eo,to){var ro;if(fastPathLookup(Xr,eo,to))return;const no=Xr.split("."),io=(eo.allowPrivateDomains?2:0)|(eo.allowIcannDomains?1:0),oo=lookupInTrie(no,exceptions,no.length-1,io);if(oo!==null){to.isIcann=oo.isIcann,to.isPrivate=oo.isPrivate,to.publicSuffix=no.slice(oo.index+1).join(".");return}const ao=lookupInTrie(no,rules,no.length-1,io);if(ao!==null){to.isIcann=ao.isIcann,to.isPrivate=ao.isPrivate,to.publicSuffix=no.slice(ao.index).join(".");return}to.isIcann=!1,to.isPrivate=!1,to.publicSuffix=(ro=no[no.length-1])!==null&&ro!==void 0?ro:null}function parse$2(Xr,eo={}){return parseImpl(Xr,5,suffixLookup,eo,getEmptyResult())}const createBrowserPlatformService=Xr=>({getDisplayOrigin:()=>Xr.location.origin,getHost:()=>Xr.location.host,getHostname:()=>Xr.location.hostname,getOrigin:()=>Xr.location.origin,getTLD:()=>parse$2(Xr.location.hostname,{allowPrivateDomains:!0}).domain||void 0,isNativeMobile:!1,openURL:eo=>__awaiter$m(void 0,void 0,void 0,function*(){Xr.location.assign(eo)})});var _a$3,_PlatformService_implementation;class PlatformService{static get implementation(){return __classPrivateFieldGet$5(_a$3,_a$3,"f",_PlatformService_implementation)?__classPrivateFieldGet$5(_a$3,_a$3,"f",_PlatformService_implementation):createBrowserPlatformService(window)}static set implementation(eo){__classPrivateFieldSet$5(_a$3,_a$3,eo,"f",_PlatformService_implementation)}static get isNativeMobile(){return _a$3.implementation.isNativeMobile}static get getOrigin(){return _a$3.implementation.getOrigin}static get getDisplayOrigin(){return _a$3.implementation.getDisplayOrigin}static get getHost(){return _a$3.implementation.getHost}static get getHostname(){return _a$3.implementation.getHostname}static get getTLD(){return _a$3.implementation.getTLD}static get openURL(){return _a$3.implementation.openURL}}_a$3=PlatformService;_PlatformService_implementation={value:void 0};const getTLD=()=>PlatformService.getTLD(),ceil=(Xr,eo=0)=>{const to=Math.pow(10,eo);return Math.ceil(Xr*to)/to},trimEnd=(Xr,eo="")=>{let to=Xr.length-1;for(;to>=0&&Xr[to]===eo;)to--;return Xr.slice(0,to+1)},formatNumberText=(Xr,{precision:eo=0}={})=>{if(!eo)return Xr;const to=parseFloat(Xr),ro=ceil(to,eo).toFixed(eo),[no,io]=ro.split("."),oo=trimEnd(io,"0");return`${no}.${oo||"0"}`},isLedgerAddressViaVerifiedCredentials=(Xr,eo)=>eo.filter(ro=>{var no;return((no=ro.walletProperties)===null||no===void 0?void 0:no.hardwareWallet)==="ledger"}).map(ro=>ro.address).includes(Xr),isEip9693Event=Xr=>Xr.type==="eip6963:announceProvider"&&Xr.detail!==void 0;class Eip6963Provider{constructor(){this.providers=[]}registerProviders(){typeof window>"u"||(window.addEventListener("eip6963:announceProvider",eo=>{isEip9693Event(eo)&&this.providers.push(eo.detail)}),window.dispatchEvent(new Event("eip6963:requestProvider")))}}class Eip6963ProviderSingleton{constructor(){this.eip6963Provider=new Eip6963Provider}static get(){var eo;return!((eo=Eip6963ProviderSingleton.instance)===null||eo===void 0)&&eo.eip6963Provider||(Eip6963ProviderSingleton.instance=new Eip6963ProviderSingleton,Eip6963ProviderSingleton.instance.eip6963Provider.registerProviders()),Eip6963ProviderSingleton.instance.eip6963Provider}}const runSafe=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){try{return[yield Xr(),void 0]}catch(eo){return[void 0,eo]}});var _a$2,_FetchService_implementation;class FetchService{static get implementation(){return __classPrivateFieldGet$5(_a$2,_a$2,"f",_FetchService_implementation)?__classPrivateFieldGet$5(_a$2,_a$2,"f",_FetchService_implementation):{fetch:window.fetch.bind(window)}}static set implementation(eo){__classPrivateFieldSet$5(_a$2,_a$2,eo,"f",_FetchService_implementation)}static get fetch(){return _a$2.implementation.fetch}}_a$2=FetchService;_FetchService_implementation={value:void 0};var version$n="3.4.4";function __awaiter$l(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const BASE_PATH="https://app.dynamicauth.com/api/v0".replace(/\/+$/,""),isBlob=Xr=>typeof Blob<"u"&&Xr instanceof Blob;class BaseAPI{constructor(eo=new Configuration){this.configuration=eo,this.fetchApi=(to,ro)=>__awaiter$l(this,void 0,void 0,function*(){let no={url:to,init:ro};for(const oo of this.middleware)oo.pre&&(no=(yield oo.pre(Object.assign({fetch:this.fetchApi},no)))||no);let io=yield(this.configuration.fetchApi||fetch)(no.url,no.init);for(const oo of this.middleware)oo.post&&(io=(yield oo.post({fetch:this.fetchApi,url:no.url,init:no.init,response:io.clone()}))||io);return io}),this.middleware=eo.middleware}withMiddleware(...eo){const to=this.clone();return to.middleware=to.middleware.concat(...eo),to}withPreMiddleware(...eo){const to=eo.map(ro=>({pre:ro}));return this.withMiddleware(...to)}withPostMiddleware(...eo){const to=eo.map(ro=>({post:ro}));return this.withMiddleware(...to)}request(eo,to){return __awaiter$l(this,void 0,void 0,function*(){const{url:ro,init:no}=this.createFetchParams(eo,to),io=yield this.fetchApi(ro,no);if(io.status>=200&&io.status<300)return io;throw io})}createFetchParams(eo,to){let ro=this.configuration.basePath+eo.path;eo.query!==void 0&&Object.keys(eo.query).length!==0&&(ro+="?"+this.configuration.queryParamsStringify(eo.query));const no=typeof FormData<"u"&&eo.body instanceof FormData||eo.body instanceof URLSearchParams||isBlob(eo.body)?eo.body:JSON.stringify(eo.body),io=Object.assign({},this.configuration.headers,eo.headers),oo=Object.assign({method:eo.method,headers:io,body:no,credentials:this.configuration.credentials},to);return{url:ro,init:oo}}clone(){const eo=this.constructor,to=new eo(this.configuration);return to.middleware=this.middleware.slice(),to}}class RequiredError extends Error{constructor(eo,to){super(to),this.field=eo,this.name="RequiredError"}}class Configuration{constructor(eo={}){this.configuration=eo}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const eo=this.configuration.apiKey;if(eo)return typeof eo=="function"?eo:()=>eo}get accessToken(){const eo=this.configuration.accessToken;if(eo)return typeof eo=="function"?eo:()=>__awaiter$l(this,void 0,void 0,function*(){return eo})}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}function exists$1(Xr,eo){const to=Xr[eo];return to!=null}function querystring(Xr,eo=""){return Object.keys(Xr).map(to=>{const ro=eo+(eo.length?`[${to}]`:to),no=Xr[to];if(no instanceof Array){const io=no.map(oo=>encodeURIComponent(String(oo))).join(`&${encodeURIComponent(ro)}=`);return`${encodeURIComponent(ro)}=${io}`}return no instanceof Date?`${encodeURIComponent(ro)}=${encodeURIComponent(no.toISOString())}`:no instanceof Object?querystring(no,ro):`${encodeURIComponent(ro)}=${encodeURIComponent(String(no))}`}).filter(to=>to.length>0).join("&")}function canConsumeForm(Xr){for(const eo of Xr)if(eo.contentType==="multipart/form-data")return!0;return!1}class JSONApiResponse{constructor(eo,to=ro=>ro){this.raw=eo,this.transformer=to}value(){return __awaiter$l(this,void 0,void 0,function*(){return this.transformer(yield this.raw.json())})}}class VoidApiResponse{constructor(eo){this.raw=eo}value(){return __awaiter$l(this,void 0,void 0,function*(){})}}class TextApiResponse{constructor(eo){this.raw=eo}value(){return __awaiter$l(this,void 0,void 0,function*(){return yield this.raw.text()})}}var AttestationConveyancePreference;(function(Xr){Xr.Direct="direct",Xr.Enterprise="enterprise",Xr.Indirect="indirect",Xr.None="none"})(AttestationConveyancePreference||(AttestationConveyancePreference={}));function AttestationConveyancePreferenceFromJSON(Xr){return AttestationConveyancePreferenceFromJSONTyped(Xr)}function AttestationConveyancePreferenceFromJSONTyped(Xr,eo){return Xr}var AuthModeEnum;(function(Xr){Xr.Only="connect-only",Xr.AndSign="connect-and-sign"})(AuthModeEnum||(AuthModeEnum={}));function AuthModeEnumToJSON(Xr){return Xr}var AuthStorageEnum;(function(Xr){Xr.Localstorage="localstorage",Xr.Cookie="cookie"})(AuthStorageEnum||(AuthStorageEnum={}));function AuthStorageEnumFromJSON(Xr){return AuthStorageEnumFromJSONTyped(Xr)}function AuthStorageEnumFromJSONTyped(Xr,eo){return Xr}var AuthenticatorAttachment;(function(Xr){Xr.CrossPlatform="cross-platform",Xr.Platform="platform"})(AuthenticatorAttachment||(AuthenticatorAttachment={}));function AuthenticatorAttachmentFromJSON(Xr){return AuthenticatorAttachmentFromJSONTyped(Xr)}function AuthenticatorAttachmentFromJSONTyped(Xr,eo){return Xr}function AuthenticatorAttachmentToJSON(Xr){return Xr}var ResidentKeyRequirement;(function(Xr){Xr.Discouraged="discouraged",Xr.Preferred="preferred",Xr.Required="required"})(ResidentKeyRequirement||(ResidentKeyRequirement={}));function ResidentKeyRequirementFromJSON(Xr){return ResidentKeyRequirementFromJSONTyped(Xr)}function ResidentKeyRequirementFromJSONTyped(Xr,eo){return Xr}var UserVerificationRequirement;(function(Xr){Xr.Discouraged="discouraged",Xr.Preferred="preferred",Xr.Required="required"})(UserVerificationRequirement||(UserVerificationRequirement={}));function UserVerificationRequirementFromJSON(Xr){return UserVerificationRequirementFromJSONTyped(Xr)}function UserVerificationRequirementFromJSONTyped(Xr,eo){return Xr}var AuthenticatorTransportProtocol;(function(Xr){Xr.Internal="AUTHENTICATOR_TRANSPORT_INTERNAL",Xr.Usb="AUTHENTICATOR_TRANSPORT_USB",Xr.Nfc="AUTHENTICATOR_TRANSPORT_NFC",Xr.Ble="AUTHENTICATOR_TRANSPORT_BLE",Xr.Hybrid="AUTHENTICATOR_TRANSPORT_HYBRID"})(AuthenticatorTransportProtocol||(AuthenticatorTransportProtocol={}));function AuthenticatorTransportProtocolToJSON(Xr){return Xr}var JwtVerifiedCredentialFormatEnum;(function(Xr){Xr.Blockchain="blockchain",Xr.Email="email",Xr.Oauth="oauth",Xr.Passkey="passkey",Xr.PhoneNumber="phoneNumber",Xr.ExternalUser="externalUser"})(JwtVerifiedCredentialFormatEnum||(JwtVerifiedCredentialFormatEnum={}));function JwtVerifiedCredentialFormatEnumFromJSON(Xr){return JwtVerifiedCredentialFormatEnumFromJSONTyped(Xr)}function JwtVerifiedCredentialFormatEnumFromJSONTyped(Xr,eo){return Xr}var ProviderEnum;(function(Xr){Xr.EmailOnly="emailOnly",Xr.MagicLink="magicLink",Xr.Apple="apple",Xr.Bitbucket="bitbucket",Xr.Coinbasesocial="coinbasesocial",Xr.Discord="discord",Xr.Facebook="facebook",Xr.Farcaster="farcaster",Xr.Github="github",Xr.Gitlab="gitlab",Xr.Google="google",Xr.Instagram="instagram",Xr.Linkedin="linkedin",Xr.Microsoft="microsoft",Xr.Twitch="twitch",Xr.Twitter="twitter",Xr.Blocto="blocto",Xr.Banxa="banxa",Xr.Dynamic="dynamic",Xr.Alchemy="alchemy",Xr.Zerodev="zerodev",Xr.Telegram="telegram",Xr.Turnkey="turnkey",Xr.CoinbaseWaas="coinbaseWaas",Xr.Sms="sms"})(ProviderEnum||(ProviderEnum={}));function ProviderEnumFromJSON(Xr){return ProviderEnumFromJSONTyped(Xr)}function ProviderEnumFromJSONTyped(Xr,eo){return Xr}function ProviderEnumToJSON(Xr){return Xr}var WalletAddressType;(function(Xr){Xr.Ordinals="ordinals",Xr.Payment="payment",Xr.Cosmos="cosmos",Xr.Evm="evm"})(WalletAddressType||(WalletAddressType={}));function WalletAddressTypeFromJSON(Xr){return WalletAddressTypeFromJSONTyped(Xr)}function WalletAddressTypeFromJSONTyped(Xr,eo){return Xr}function WalletAddressTypeToJSON(Xr){return Xr}var EmbeddedWalletVersionEnum;(function(Xr){Xr.V1="V1",Xr.V2="V2"})(EmbeddedWalletVersionEnum||(EmbeddedWalletVersionEnum={}));function EmbeddedWalletVersionEnumFromJSON(Xr){return EmbeddedWalletVersionEnumFromJSONTyped(Xr)}function EmbeddedWalletVersionEnumFromJSONTyped(Xr,eo){return Xr}var HardwareWalletEnum;(function(Xr){Xr.Ledger="ledger"})(HardwareWalletEnum||(HardwareWalletEnum={}));function HardwareWalletEnumFromJSON(Xr){return HardwareWalletEnumFromJSONTyped(Xr)}function HardwareWalletEnumFromJSONTyped(Xr,eo){return Xr}var PasswordSourceTypeEnum;(function(Xr){Xr.Dynamic="dynamic",Xr.User="user"})(PasswordSourceTypeEnum||(PasswordSourceTypeEnum={}));function PasswordSourceTypeEnumFromJSON(Xr){return PasswordSourceTypeEnumFromJSONTyped(Xr)}function PasswordSourceTypeEnumFromJSONTyped(Xr,eo){return Xr}function PasswordSourceTypeEnumToJSON(Xr){return Xr}var WalletProviderEnum;(function(Xr){Xr.BrowserExtension="browserExtension",Xr.CustodialService="custodialService",Xr.WalletConnect="walletConnect",Xr.QrCode="qrCode",Xr.DeepLink="deepLink",Xr.EmbeddedWallet="embeddedWallet",Xr.SmartContractWallet="smartContractWallet"})(WalletProviderEnum||(WalletProviderEnum={}));function WalletProviderEnumFromJSON(Xr){return WalletProviderEnumFromJSONTyped(Xr)}function WalletProviderEnumFromJSONTyped(Xr,eo){return Xr}function WalletProviderEnumToJSON(Xr){return Xr}var MfaBackupCodeAcknowledgement;(function(Xr){Xr.Pending="pending",Xr.Complete="complete"})(MfaBackupCodeAcknowledgement||(MfaBackupCodeAcknowledgement={}));function MfaBackupCodeAcknowledgementFromJSON(Xr){return MfaBackupCodeAcknowledgementFromJSONTyped(Xr)}function MfaBackupCodeAcknowledgementFromJSONTyped(Xr,eo){return Xr}function MfaBackupCodeAcknowledgementToJSON(Xr){return Xr}var CustomFieldType;(function(Xr){Xr.Text="text",Xr.Checkbox="checkbox",Xr.Select="select"})(CustomFieldType||(CustomFieldType={}));function CustomFieldTypeFromJSON(Xr){return CustomFieldTypeFromJSONTyped(Xr)}function CustomFieldTypeFromJSONTyped(Xr,eo){return Xr}var KycFieldType;(function(Xr){Xr.Standard="standard",Xr.Custom="custom"})(KycFieldType||(KycFieldType={}));function KycFieldTypeFromJSON(Xr){return KycFieldTypeFromJSONTyped(Xr)}function KycFieldTypeFromJSONTyped(Xr,eo){return Xr}function KycFieldTypeToJSON(Xr){return Xr}var ChainEnum;(function(Xr){Xr.Eth="ETH",Xr.Evm="EVM",Xr.Flow="FLOW",Xr.Sol="SOL",Xr.Algo="ALGO",Xr.Stark="STARK",Xr.Cosmos="COSMOS",Xr.Btc="BTC"})(ChainEnum||(ChainEnum={}));function ChainEnumFromJSON(Xr){return ChainEnumFromJSONTyped(Xr)}function ChainEnumFromJSONTyped(Xr,eo){return Xr}function ChainEnumToJSON(Xr){return Xr}function PasskeyRegistrationCredentialToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{attestationObject:Xr.attestationObject,clientDataJson:Xr.clientDataJson,credentialId:Xr.credentialId,transports:Xr.transports.map(AuthenticatorTransportProtocolToJSON)}}function CompletePasskeyRecoveryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,attestation:PasskeyRegistrationCredentialToJSON(Xr.attestation),challenge:Xr.challenge}}function ConnectRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,chain:Xr.chain,provider:Xr.provider,walletName:Xr.walletName,authMode:Xr.authMode}}var EmbeddedWalletChainEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(EmbeddedWalletChainEnum||(EmbeddedWalletChainEnum={}));function EmbeddedWalletChainEnumToJSON(Xr){return Xr}var EmbeddedWalletProviderEnum;(function(Xr){Xr.Turnkey="turnkey",Xr.Turnkeyhd="turnkeyhd"})(EmbeddedWalletProviderEnum||(EmbeddedWalletProviderEnum={}));function EmbeddedWalletProviderEnumToJSON(Xr){return Xr}function CreateTurnkeyEmbeddedWalletSpecificOptsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{attestation:PasskeyRegistrationCredentialToJSON(Xr.attestation),challenge:Xr.challenge}}function CreateEmbeddedWalletSpecificOptsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:Object.assign({},CreateTurnkeyEmbeddedWalletSpecificOptsToJSON(Xr))}function CreateEmbeddedWalletParamsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chains:Xr.chains===void 0?void 0:Xr.chains.map(EmbeddedWalletChainEnumToJSON),chain:Xr.chain,embeddedWalletProvider:Xr.embeddedWalletProvider,embeddedWalletSpecificOpts:CreateEmbeddedWalletSpecificOptsToJSON(Xr.embeddedWalletSpecificOpts),isAuthenticatorAttached:Xr.isAuthenticatorAttached,passkeyAlias:Xr.passkeyAlias,sessionPublicKey:Xr.sessionPublicKey}}function CreateEmbeddedWalletsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{embeddedWallets:Xr.embeddedWallets.map(CreateEmbeddedWalletParamsToJSON)}}var UserIdentifierTypeEnum;(function(Xr){Xr.Email="email",Xr.Id="id",Xr.ExternalUserId="externalUserId",Xr.PhoneNumber="phoneNumber",Xr.SocialUsername="socialUsername"})(UserIdentifierTypeEnum||(UserIdentifierTypeEnum={}));function TurnkeyStampToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{stampHeaderName:Xr.stampHeaderName,stampHeaderValue:Xr.stampHeaderValue}}function TurnkeySignedRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{body:Xr.body,stamp:TurnkeyStampToJSON(Xr.stamp),url:Xr.url}}function CreateWalletAccountRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}var CurrencyType;(function(Xr){Xr.Fiat="fiat",Xr.Crypto="crypto"})(CurrencyType||(CurrencyType={}));function DeleteEmbeddedWalletsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}var TimeUnitEnum;(function(Xr){Xr.Days="days",Xr.Hours="hours",Xr.Minutes="minutes"})(TimeUnitEnum||(TimeUnitEnum={}));function TimeUnitEnumFromJSON(Xr){return TimeUnitEnumFromJSONTyped(Xr)}function TimeUnitEnumFromJSONTyped(Xr,eo){return Xr}var EcdsaValidatorOptions;(function(Xr){Xr.SignerToEcdsa="zerodev_signer_to_ecdsa",Xr.MultiChain="zerodev_multi_chain"})(EcdsaValidatorOptions||(EcdsaValidatorOptions={}));function EcdsaValidatorOptionsFromJSON(Xr){return EcdsaValidatorOptionsFromJSONTyped(Xr)}function EcdsaValidatorOptionsFromJSONTyped(Xr,eo){return Xr}function EmailProviderResponseFromJSON(Xr){return EmailProviderResponseFromJSONTyped(Xr)}function EmailProviderResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{emailProvider:ProviderEnumFromJSON(Xr.emailProvider)}}function EmailVerificationCreateRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{email:Xr.email,captchaToken:Xr.captchaToken}}function EmailVerificationCreateResponseFromJSON(Xr){return EmailVerificationCreateResponseFromJSONTyped(Xr)}function EmailVerificationCreateResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{verificationUUID:Xr.verificationUUID,email:Xr.email}}function EmailVerificationRetryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,email:Xr.email,captchaToken:Xr.captchaToken}}function EmailVerificationVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,verificationToken:Xr.verificationToken,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function EmbeddedWalletAuthTokenFromJSON(Xr){return EmbeddedWalletAuthTokenFromJSONTyped(Xr)}function EmbeddedWalletAuthTokenFromJSONTyped(Xr,eo){return Xr==null?Xr:{token:Xr.token}}var EmbeddedWalletAuthType;(function(Xr){Xr.Mpc="mpc"})(EmbeddedWalletAuthType||(EmbeddedWalletAuthType={}));function EmbeddedWalletPasscodeClaimRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId}}function EmbeddedWalletSecretFromJSON(Xr){return EmbeddedWalletSecretFromJSONTyped(Xr)}function EmbeddedWalletSecretFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletId:Xr.walletId,secret:Xr.secret,source:exists$1(Xr,"source")?PasswordSourceTypeEnumFromJSON(Xr.source):void 0}}function NameServiceDataFromJSON(Xr){return NameServiceDataFromJSONTyped(Xr)}function NameServiceDataFromJSONTyped(Xr,eo){return Xr==null?Xr:{avatar:exists$1(Xr,"avatar")?Xr.avatar:void 0,name:exists$1(Xr,"name")?Xr.name:void 0}}function WalletAdditionalAddressFromJSON(Xr){return WalletAdditionalAddressFromJSONTyped(Xr)}function WalletAdditionalAddressFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,publicKey:exists$1(Xr,"publicKey")?Xr.publicKey:void 0,type:WalletAddressTypeFromJSON(Xr.type)}}function WalletAdditionalAddressToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,publicKey:Xr.publicKey,type:Xr.type}}function WalletPropertiesFromJSON(Xr){return WalletPropertiesFromJSONTyped(Xr)}function WalletPropertiesFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeySubOrganizationId:exists$1(Xr,"turnkeySubOrganizationId")?Xr.turnkeySubOrganizationId:void 0,turnkeyPrivateKeyId:exists$1(Xr,"turnkeyPrivateKeyId")?Xr.turnkeyPrivateKeyId:void 0,turnkeyHDWalletId:exists$1(Xr,"turnkeyHDWalletId")?Xr.turnkeyHDWalletId:void 0,isAuthenticatorAttached:exists$1(Xr,"isAuthenticatorAttached")?Xr.isAuthenticatorAttached:void 0,turnkeyUserId:exists$1(Xr,"turnkeyUserId")?Xr.turnkeyUserId:void 0,isSessionKeyCompatible:exists$1(Xr,"isSessionKeyCompatible")?Xr.isSessionKeyCompatible:void 0,version:exists$1(Xr,"version")?EmbeddedWalletVersionEnumFromJSON(Xr.version):void 0,hardwareWallet:exists$1(Xr,"hardwareWallet")?HardwareWalletEnumFromJSON(Xr.hardwareWallet):void 0,claimed:exists$1(Xr,"claimed")?Xr.claimed:void 0,source:exists$1(Xr,"source")?PasswordSourceTypeEnumFromJSON(Xr.source):void 0}}function JwtVerifiedCredentialFromJSON(Xr){return JwtVerifiedCredentialFromJSONTyped(Xr)}function JwtVerifiedCredentialFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:exists$1(Xr,"address")?Xr.address:void 0,chain:exists$1(Xr,"chain")?Xr.chain:void 0,refId:exists$1(Xr,"refId")?Xr.refId:void 0,signerRefId:exists$1(Xr,"signerRefId")?Xr.signerRefId:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,id:Xr.id,nameService:exists$1(Xr,"name_service")?NameServiceDataFromJSON(Xr.name_service):void 0,publicIdentifier:exists$1(Xr,"public_identifier")?Xr.public_identifier:void 0,walletName:exists$1(Xr,"wallet_name")?Xr.wallet_name:void 0,walletProvider:exists$1(Xr,"wallet_provider")?WalletProviderEnumFromJSON(Xr.wallet_provider):void 0,walletProperties:exists$1(Xr,"wallet_properties")?WalletPropertiesFromJSON(Xr.wallet_properties):void 0,format:JwtVerifiedCredentialFormatEnumFromJSON(Xr.format),oauthProvider:exists$1(Xr,"oauth_provider")?ProviderEnumFromJSON(Xr.oauth_provider):void 0,oauthUsername:exists$1(Xr,"oauth_username")?Xr.oauth_username:void 0,oauthDisplayName:exists$1(Xr,"oauth_display_name")?Xr.oauth_display_name:void 0,oauthAccountId:exists$1(Xr,"oauth_account_id")?Xr.oauth_account_id:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,phoneCountryCode:exists$1(Xr,"phoneCountryCode")?Xr.phoneCountryCode:void 0,isoCountryCode:exists$1(Xr,"isoCountryCode")?Xr.isoCountryCode:void 0,oauthAccountPhotos:exists$1(Xr,"oauth_account_photos")?Xr.oauth_account_photos:void 0,oauthEmails:exists$1(Xr,"oauth_emails")?Xr.oauth_emails:void 0,oauthMetadata:exists$1(Xr,"oauth_metadata")?Xr.oauth_metadata:void 0,previousUsers:exists$1(Xr,"previous_users")?Xr.previous_users:void 0,embeddedWalletId:exists$1(Xr,"embedded_wallet_id")?Xr.embedded_wallet_id:void 0,walletAdditionalAddresses:exists$1(Xr,"wallet_additional_addresses")?Xr.wallet_additional_addresses.map(WalletAdditionalAddressFromJSON):void 0,lastSelectedAt:exists$1(Xr,"lastSelectedAt")?new Date(Xr.lastSelectedAt):void 0}}function CustomFieldValidValueFromJSON(Xr){return CustomFieldValidValueFromJSONTyped(Xr)}function CustomFieldValidValueFromJSONTyped(Xr,eo){return Xr==null?Xr:{label:Xr.label,key:exists$1(Xr,"key")?Xr.key:void 0}}function CustomFieldValidationRulesFromJSON(Xr){return CustomFieldValidationRulesFromJSONTyped(Xr)}function CustomFieldValidationRulesFromJSONTyped(Xr,eo){return Xr==null?Xr:{unique:exists$1(Xr,"unique")?Xr.unique:void 0,regex:exists$1(Xr,"regex")?Xr.regex:void 0,validOptions:exists$1(Xr,"validOptions")?Xr.validOptions.map(CustomFieldValidValueFromJSON):void 0,checkboxText:exists$1(Xr,"checkboxText")?Xr.checkboxText:void 0}}function ProjectSettingsKycFromJSON(Xr){return ProjectSettingsKycFromJSONTyped(Xr)}function ProjectSettingsKycFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,required:Xr.required,enabled:Xr.enabled,unique:Xr.unique,verify:Xr.verify,type:exists$1(Xr,"type")?KycFieldTypeFromJSON(Xr.type):void 0,validationRules:exists$1(Xr,"validationRules")?CustomFieldValidationRulesFromJSON(Xr.validationRules):void 0,validationType:exists$1(Xr,"validationType")?CustomFieldTypeFromJSON(Xr.validationType):void 0,label:exists$1(Xr,"label")?Xr.label:void 0,position:exists$1(Xr,"position")?Xr.position:void 0}}function SdkUserFromJSON(Xr){return SdkUserFromJSONTyped(Xr)}function SdkUserFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,projectEnvironmentId:Xr.projectEnvironmentId,verifiedCredentials:Xr.verifiedCredentials.map(JwtVerifiedCredentialFromJSON),lastVerifiedCredentialId:exists$1(Xr,"lastVerifiedCredentialId")?Xr.lastVerifiedCredentialId:void 0,sessionId:exists$1(Xr,"sessionId")?Xr.sessionId:void 0,alias:exists$1(Xr,"alias")?Xr.alias:void 0,country:exists$1(Xr,"country")?Xr.country:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,firstName:exists$1(Xr,"firstName")?Xr.firstName:void 0,jobTitle:exists$1(Xr,"jobTitle")?Xr.jobTitle:void 0,lastName:exists$1(Xr,"lastName")?Xr.lastName:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,policiesConsent:exists$1(Xr,"policiesConsent")?Xr.policiesConsent:void 0,tShirtSize:exists$1(Xr,"tShirtSize")?Xr.tShirtSize:void 0,team:exists$1(Xr,"team")?Xr.team:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,firstVisit:exists$1(Xr,"firstVisit")?new Date(Xr.firstVisit):void 0,lastVisit:exists$1(Xr,"lastVisit")?new Date(Xr.lastVisit):void 0,newUser:exists$1(Xr,"newUser")?Xr.newUser:void 0,metadata:exists$1(Xr,"metadata")?Xr.metadata:void 0,mfaBackupCodeAcknowledgement:exists$1(Xr,"mfaBackupCodeAcknowledgement")?MfaBackupCodeAcknowledgementFromJSON(Xr.mfaBackupCodeAcknowledgement):void 0,btcWallet:exists$1(Xr,"btcWallet")?Xr.btcWallet:void 0,kdaWallet:exists$1(Xr,"kdaWallet")?Xr.kdaWallet:void 0,ltcWallet:exists$1(Xr,"ltcWallet")?Xr.ltcWallet:void 0,ckbWallet:exists$1(Xr,"ckbWallet")?Xr.ckbWallet:void 0,kasWallet:exists$1(Xr,"kasWallet")?Xr.kasWallet:void 0,dogeWallet:exists$1(Xr,"dogeWallet")?Xr.dogeWallet:void 0,emailNotification:exists$1(Xr,"emailNotification")?Xr.emailNotification:void 0,discordNotification:exists$1(Xr,"discordNotification")?Xr.discordNotification:void 0,newsletterNotification:exists$1(Xr,"newsletterNotification")?Xr.newsletterNotification:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,scope:exists$1(Xr,"scope")?Xr.scope:void 0,missingFields:exists$1(Xr,"missingFields")?Xr.missingFields.map(ProjectSettingsKycFromJSON):void 0}}var EmbeddedWalletSecurityMethod;(function(Xr){Xr.Passkey="passkey",Xr.Passphrase="passphrase"})(EmbeddedWalletSecurityMethod||(EmbeddedWalletSecurityMethod={}));function EmbeddedWalletSecurityMethodFromJSON(Xr){return EmbeddedWalletSecurityMethodFromJSONTyped(Xr)}function EmbeddedWalletSecurityMethodFromJSONTyped(Xr,eo){return Xr}var EnvironmentEnum;(function(Xr){Xr.Sandbox="sandbox",Xr.Live="live"})(EnvironmentEnum||(EnvironmentEnum={}));function EnvironmentEnumFromJSON(Xr){return EnvironmentEnumFromJSONTyped(Xr)}function EnvironmentEnumFromJSONTyped(Xr,eo){return Xr}function ExportEmbeddedWalletResponseFromJSON(Xr){return ExportEmbeddedWalletResponseFromJSONTyped(Xr)}function ExportEmbeddedWalletResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{exportBundle:Xr.exportBundle}}function ExternalAuthSigninRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{jwt:Xr.jwt,sessionPublicKey:Xr.sessionPublicKey}}function FarcasterSignInRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,domain:Xr.domain,nonce:Xr.nonce,message:Xr.message,signature:Xr.signature,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function PasskeyStorageFromJSON(Xr){return PasskeyStorageFromJSONTyped(Xr)}function PasskeyStorageFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,icon:Xr.icon,updatedAt:exists$1(Xr,"updatedAt")?new Date(Xr.updatedAt):void 0}}function UserPasskeyFromJSON(Xr){return UserPasskeyFromJSONTyped(Xr)}function UserPasskeyFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,alias:exists$1(Xr,"alias")?Xr.alias:void 0,userAgent:exists$1(Xr,"userAgent")?Xr.userAgent:void 0,origin:exists$1(Xr,"origin")?Xr.origin:void 0,credentialId:Xr.credentialId,createdAt:new Date(Xr.createdAt),updatedAt:exists$1(Xr,"updatedAt")?new Date(Xr.updatedAt):void 0,storage:exists$1(Xr,"storage")?PasskeyStorageFromJSON(Xr.storage):void 0}}function GetUserPasskeysResponseFromJSON(Xr){return GetUserPasskeysResponseFromJSONTyped(Xr)}function GetUserPasskeysResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{passkeys:Xr.passkeys.map(UserPasskeyFromJSON),count:Xr.count}}var HealthcheckStatus;(function(Xr){Xr.Healthy="healthy",Xr.Unhealthy="unhealthy"})(HealthcheckStatus||(HealthcheckStatus={}));function HealthcheckStatusFromJSON(Xr){return HealthcheckStatusFromJSONTyped(Xr)}function HealthcheckStatusFromJSONTyped(Xr,eo){return Xr}function HealthcheckResponseFromJSON(Xr){return HealthcheckResponseFromJSONTyped(Xr)}function HealthcheckResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{status:HealthcheckStatusFromJSON(Xr.status)}}function InitEmailAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,turnkeyEmailAuthTargetPublicKey:Xr.turnkeyEmailAuthTargetPublicKey}}function InitEmailAuthResponseFromJSON(Xr){return InitEmailAuthResponseFromJSONTyped(Xr)}function InitEmailAuthResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeyUserId:Xr.turnkeyUserId,turnkeyApiKeyId:Xr.turnkeyApiKeyId}}function InitPasskeyRecoveryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,turnkeyRecoveryTargetPublicKey:Xr.turnkeyRecoveryTargetPublicKey}}function InitPasskeyRecoveryResponseFromJSON(Xr){return InitPasskeyRecoveryResponseFromJSONTyped(Xr)}function InitPasskeyRecoveryResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeyRecoveryUserId:Xr.turnkeyRecoveryUserId}}function JwksKeyFromJSON(Xr){return JwksKeyFromJSONTyped(Xr)}function JwksKeyFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:exists$1(Xr,"kid")?Xr.kid:void 0,alg:exists$1(Xr,"alg")?Xr.alg:void 0,kty:exists$1(Xr,"kty")?Xr.kty:void 0,use:exists$1(Xr,"use")?Xr.use:void 0,e:exists$1(Xr,"e")?Xr.e:void 0,n:exists$1(Xr,"n")?Xr.n:void 0}}function JwksResponseFromJSON(Xr){return JwksResponseFromJSONTyped(Xr)}function JwksResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{keys:Xr.keys.map(JwksKeyFromJSON)}}function AuthenticationExtensionsClientInputsFromJSON(Xr){return AuthenticationExtensionsClientInputsFromJSONTyped(Xr)}function AuthenticationExtensionsClientInputsFromJSONTyped(Xr,eo){return Xr==null?Xr:{appid:exists$1(Xr,"appid")?Xr.appid:void 0,credProps:exists$1(Xr,"credProps")?Xr.credProps:void 0,hmacCreateSecret:exists$1(Xr,"hmacCreateSecret")?Xr.hmacCreateSecret:void 0}}var PublicKeyCredentialType;(function(Xr){Xr.PublicKey="public-key"})(PublicKeyCredentialType||(PublicKeyCredentialType={}));function PublicKeyCredentialTypeFromJSON(Xr){return PublicKeyCredentialTypeFromJSONTyped(Xr)}function PublicKeyCredentialTypeFromJSONTyped(Xr,eo){return Xr}function PublicKeyCredentialTypeToJSON(Xr){return Xr}function PublicKeyCredentialDescriptorFromJSON(Xr){return PublicKeyCredentialDescriptorFromJSONTyped(Xr)}function PublicKeyCredentialDescriptorFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:PublicKeyCredentialTypeFromJSON(Xr.type)}}function MFAAuthPasskeyDeviceGetResponseAssertionFromJSON(Xr){return MFAAuthPasskeyDeviceGetResponseAssertionFromJSONTyped(Xr)}function MFAAuthPasskeyDeviceGetResponseAssertionFromJSONTyped(Xr,eo){return Xr==null?Xr:{rpId:exists$1(Xr,"rpId")?Xr.rpId:void 0,challenge:Xr.challenge,timeout:exists$1(Xr,"timeout")?Xr.timeout:void 0,userVerification:exists$1(Xr,"userVerification")?UserVerificationRequirementFromJSON(Xr.userVerification):void 0,allowCredentials:exists$1(Xr,"allowCredentials")?Xr.allowCredentials.map(PublicKeyCredentialDescriptorFromJSON):void 0,extensions:exists$1(Xr,"extensions")?AuthenticationExtensionsClientInputsFromJSON(Xr.extensions):void 0}}var MFADeviceType;(function(Xr){Xr.Totp="totp",Xr.Passkey="passkey"})(MFADeviceType||(MFADeviceType={}));function MFADeviceTypeFromJSON(Xr){return MFADeviceTypeFromJSONTyped(Xr)}function MFADeviceTypeFromJSONTyped(Xr,eo){return Xr}function MFADeviceTypeToJSON(Xr){return Xr}function MFAAuthPasskeyDeviceGetResponseFromJSON(Xr){return MFAAuthPasskeyDeviceGetResponseFromJSONTyped(Xr)}function MFAAuthPasskeyDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),assertion:MFAAuthPasskeyDeviceGetResponseAssertionFromJSON(Xr.assertion)}}function AuthenticationExtensionsClientOutputsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{appid:Xr.appid,credProps:Xr.credProps,hmacCreateSecret:Xr.hmacCreateSecret}}function AuthenticatorAssertionResponseToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{clientDataJSON:Xr.clientDataJSON,authenticatorData:Xr.authenticatorData,signature:Xr.signature,userHandle:Xr.userHandle}}function PasskeyAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,rawId:Xr.rawId,response:AuthenticatorAssertionResponseToJSON(Xr.response),authenticatorAttachment:Xr.authenticatorAttachment,clientExtensionResults:AuthenticationExtensionsClientOutputsToJSON(Xr.clientExtensionResults),type:Xr.type}}function MFAAuthPasskeyDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,assertion:PasskeyAuthRequestToJSON(Xr.assertion)}}function CreateMfaTokenToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{singleUse:Xr.singleUse}}function MFAAuthRecoveryDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{createMfaToken:CreateMfaTokenToJSON(Xr.createMfaToken),code:Xr.code}}function MFAAuthTotpDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,createMfaToken:CreateMfaTokenToJSON(Xr.createMfaToken),code:Xr.code}}function MFADeviceFromJSON(Xr){return MFADeviceFromJSONTyped(Xr)}function MFADeviceFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:exists$1(Xr,"type")?MFADeviceTypeFromJSON(Xr.type):void 0,verified:exists$1(Xr,"verified")?Xr.verified:void 0,id:exists$1(Xr,"id")?Xr.id:void 0,createdAt:exists$1(Xr,"createdAt")?new Date(Xr.createdAt):void 0,verifiedAt:exists$1(Xr,"verifiedAt")?Xr.verifiedAt===null?null:new Date(Xr.verifiedAt):void 0,_default:exists$1(Xr,"default")?Xr.default:void 0,alias:exists$1(Xr,"alias")?Xr.alias:void 0}}function MFAGetRecoveryCodesResponseFromJSON(Xr){return MFAGetRecoveryCodesResponseFromJSONTyped(Xr)}function MFAGetRecoveryCodesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,recoveryCodes:Xr.recoveryCodes}}function MFAListDevicesResponseFromJSON(Xr){return MFAListDevicesResponseFromJSONTyped(Xr)}function MFAListDevicesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,devices:Xr.devices.map(MFADeviceFromJSON)}}function MFARegenRecoveryCodesResponseFromJSON(Xr){return MFARegenRecoveryCodesResponseFromJSONTyped(Xr)}function MFARegenRecoveryCodesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,recoveryCodes:Xr.recoveryCodes}}function AuthenticatorSelectionCriteriaFromJSON(Xr){return AuthenticatorSelectionCriteriaFromJSONTyped(Xr)}function AuthenticatorSelectionCriteriaFromJSONTyped(Xr,eo){return Xr==null?Xr:{authenticatorAttachment:exists$1(Xr,"authenticatorAttachment")?AuthenticatorAttachmentFromJSON(Xr.authenticatorAttachment):void 0,requireResidentKey:exists$1(Xr,"requireResidentKey")?Xr.requireResidentKey:void 0,residentKey:exists$1(Xr,"residentKey")?ResidentKeyRequirementFromJSON(Xr.residentKey):void 0,userVerification:exists$1(Xr,"userVerification")?UserVerificationRequirementFromJSON(Xr.userVerification):void 0}}function PublicKeyCredentialParametersFromJSON(Xr){return PublicKeyCredentialParametersFromJSONTyped(Xr)}function PublicKeyCredentialParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{alg:Xr.alg,type:PublicKeyCredentialTypeFromJSON(Xr.type)}}function PublicKeyCredentialRpEntityFromJSON(Xr){return PublicKeyCredentialRpEntityFromJSONTyped(Xr)}function PublicKeyCredentialRpEntityFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:exists$1(Xr,"id")?Xr.id:void 0,name:Xr.name}}function PublicKeyCredentialUserEntityFromJSON(Xr){return PublicKeyCredentialUserEntityFromJSONTyped(Xr)}function PublicKeyCredentialUserEntityFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,name:Xr.name,displayName:Xr.displayName}}function MFARegisterPasskeyDeviceGetResponseRegistrationFromJSON(Xr){return MFARegisterPasskeyDeviceGetResponseRegistrationFromJSONTyped(Xr)}function MFARegisterPasskeyDeviceGetResponseRegistrationFromJSONTyped(Xr,eo){return Xr==null?Xr:{attestation:exists$1(Xr,"attestation")?AttestationConveyancePreferenceFromJSON(Xr.attestation):void 0,rp:PublicKeyCredentialRpEntityFromJSON(Xr.rp),user:PublicKeyCredentialUserEntityFromJSON(Xr.user),challenge:Xr.challenge,pubKeyCredParams:Xr.pubKeyCredParams.map(PublicKeyCredentialParametersFromJSON),timeout:exists$1(Xr,"timeout")?Xr.timeout:void 0,authenticatorSelection:exists$1(Xr,"authenticatorSelection")?AuthenticatorSelectionCriteriaFromJSON(Xr.authenticatorSelection):void 0,excludeCredentials:exists$1(Xr,"excludeCredentials")?Xr.excludeCredentials.map(PublicKeyCredentialDescriptorFromJSON):void 0,extensions:exists$1(Xr,"extensions")?AuthenticationExtensionsClientInputsFromJSON(Xr.extensions):void 0}}function MFARegisterPasskeyDeviceGetResponseFromJSON(Xr){return MFARegisterPasskeyDeviceGetResponseFromJSONTyped(Xr)}function MFARegisterPasskeyDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),registration:MFARegisterPasskeyDeviceGetResponseRegistrationFromJSON(Xr.registration)}}function AuthenticatorAttestationResponseToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{clientDataJSON:Xr.clientDataJSON,attestationObject:Xr.attestationObject,authenticatorData:Xr.authenticatorData,publicKeyAlgorithm:Xr.publicKeyAlgorithm,publicKey:Xr.publicKey}}function PasskeyRegisterVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,rawId:Xr.rawId,response:AuthenticatorAttestationResponseToJSON(Xr.response),authenticatorAttachment:Xr.authenticatorAttachment,clientExtensionResults:AuthenticationExtensionsClientOutputsToJSON(Xr.clientExtensionResults),type:Xr.type}}function MFARegisterPasskeyDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,attestation:PasskeyRegisterVerifyRequestToJSON(Xr.attestation)}}function MFARegisterTotpDeviceGetResponseFromJSON(Xr){return MFARegisterTotpDeviceGetResponseFromJSONTyped(Xr)}function MFARegisterTotpDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),secret:Xr.secret,uri:Xr.uri}}function MFARegisterTotpDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{type:Xr.type,code:Xr.code}}function MFAUpdateDeviceRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{default:Xr._default}}function MergeUserConflictResolutionToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{userId:Xr.userId,fieldKey:Xr.fieldKey,type:Xr.type}}function MergeUserConflictResolutionsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{mergeUserResolutions:Xr.mergeUserResolutions===void 0?void 0:Xr.mergeUserResolutions.map(MergeUserConflictResolutionToJSON)}}function NameServiceFromJSON(Xr){return NameServiceFromJSONTyped(Xr)}function NameServiceFromJSONTyped(Xr,eo){return Xr==null?Xr:{registry:exists$1(Xr,"registry")?Xr.registry:void 0}}function NativeCurrencyFromJSON(Xr){return NativeCurrencyFromJSONTyped(Xr)}function NativeCurrencyFromJSONTyped(Xr,eo){return Xr==null?Xr:{decimals:Xr.decimals,name:Xr.name,symbol:Xr.symbol,denom:exists$1(Xr,"denom")?Xr.denom:void 0,iconUrl:exists$1(Xr,"iconUrl")?Xr.iconUrl:void 0}}function NetworkConfigurationFromJSON(Xr){return NetworkConfigurationFromJSONTyped(Xr)}function NetworkConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{lcdUrl:exists$1(Xr,"lcdUrl")?Xr.lcdUrl:void 0,chainName:exists$1(Xr,"chainName")?Xr.chainName:void 0,name:Xr.name,shortName:Xr.shortName,chain:Xr.chain,chainId:Xr.chainId,nameService:exists$1(Xr,"nameService")?NameServiceFromJSON(Xr.nameService):void 0,networkId:Xr.networkId,iconUrls:Xr.iconUrls,nativeCurrency:NativeCurrencyFromJSON(Xr.nativeCurrency),rpcUrls:Xr.rpcUrls,privateCustomerRpcUrls:exists$1(Xr,"privateCustomerRpcUrls")?Xr.privateCustomerRpcUrls:void 0,blockExplorerUrls:Xr.blockExplorerUrls,vanityName:exists$1(Xr,"vanityName")?Xr.vanityName:void 0,bech32Prefix:exists$1(Xr,"bech32_prefix")?Xr.bech32_prefix:void 0}}function NetworkConfigurationResponseFromJSON(Xr){return NetworkConfigurationResponseFromJSONTyped(Xr)}function NetworkConfigurationResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{chainName:exists$1(Xr,"chainName")?Xr.chainName:void 0,networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkConfigurationFromJSON):void 0}}var NextViewEnum;(function(Xr){Xr.Done="done",Xr.VerifyEmail="verify-email",Xr.VerifiedAndTransferred="verified-and-transferred",Xr.VerifySms="verify-sms"})(NextViewEnum||(NextViewEnum={}));function NextViewEnumFromJSON(Xr){return NextViewEnumFromJSONTyped(Xr)}function NextViewEnumFromJSONTyped(Xr,eo){return Xr}function NonceResponseFromJSON(Xr){return NonceResponseFromJSONTyped(Xr)}function NonceResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{nonce:exists$1(Xr,"nonce")?Xr.nonce:void 0}}function OauthInitAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,redirectUrl:Xr.redirectUrl}}function OauthProviderLoginUrlFromJSON(Xr){return OauthProviderLoginUrlFromJSONTyped(Xr)}function OauthProviderLoginUrlFromJSONTyped(Xr,eo){return Xr==null?Xr:{url:Xr.url}}function OauthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{code:Xr.code,codeVerifier:Xr.codeVerifier,state:Xr.state,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function OauthResultRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,telegramAuthToken:Xr.telegramAuthToken,forceCreateUser:Xr.forceCreateUser,code:Xr.code,sessionPublicKey:Xr.sessionPublicKey}}var OauthResultStatus;(function(Xr){Xr.Pending="pending",Xr.Completed="completed"})(OauthResultStatus||(OauthResultStatus={}));function OauthResultStatusFromJSON(Xr){return OauthResultStatusFromJSONTyped(Xr)}function OauthResultStatusFromJSONTyped(Xr,eo){return Xr}function OauthResultResponseFromJSON(Xr){return OauthResultResponseFromJSONTyped(Xr)}function OauthResultResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{code:exists$1(Xr,"code")?Xr.code:void 0,error:exists$1(Xr,"error")?Xr.error:void 0,status:OauthResultStatusFromJSON(Xr.status)}}function PrefetchRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chain:Xr.chain,publicWalletAddress:Xr.publicWalletAddress}}function NetworkFromJSON(Xr){return NetworkFromJSONTyped(Xr)}function NetworkFromJSONTyped(Xr,eo){return Xr==null?Xr:{networkId:Xr.networkId,chainName:Xr.chainName,enabled:Xr.enabled,rpcUrl:exists$1(Xr,"rpcUrl")?Xr.rpcUrl:void 0}}function ProjectSettingsChainsFromJSON(Xr){return ProjectSettingsChainsFromJSONTyped(Xr)}function ProjectSettingsChainsFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,enabled:Xr.enabled,networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkFromJSON):void 0}}function ProjectSettingsDesignButtonFromJSON(Xr){return ProjectSettingsDesignButtonFromJSONTyped(Xr)}function ProjectSettingsDesignButtonFromJSONTyped(Xr,eo){return Xr==null?Xr:{background:exists$1(Xr,"background")?Xr.background:void 0,fontColor:exists$1(Xr,"fontColor")?Xr.fontColor:void 0,paddingHeight:exists$1(Xr,"paddingHeight")?Xr.paddingHeight:void 0,paddingWidth:exists$1(Xr,"paddingWidth")?Xr.paddingWidth:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0}}function ProjectSettingsDesignModalFromJSON(Xr){return ProjectSettingsDesignModalFromJSONTyped(Xr)}function ProjectSettingsDesignModalFromJSONTyped(Xr,eo){return Xr==null?Xr:{border:exists$1(Xr,"border")?Xr.border:void 0,brand:exists$1(Xr,"brand")?Xr.brand:void 0,primaryColor:exists$1(Xr,"primaryColor")?Xr.primaryColor:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0,theme:exists$1(Xr,"theme")?Xr.theme:void 0,view:exists$1(Xr,"view")?Xr.view:void 0,template:exists$1(Xr,"template")?Xr.template:void 0,displayOrder:exists$1(Xr,"displayOrder")?Xr.displayOrder:void 0,emailOnly:exists$1(Xr,"emailOnly")?Xr.emailOnly:void 0,showWalletsButton:exists$1(Xr,"showWalletsButton")?Xr.showWalletsButton:void 0,emailSubmitButtonInsideInput:exists$1(Xr,"emailSubmitButtonInsideInput")?Xr.emailSubmitButtonInsideInput:void 0,splitEmailAndSocial:exists$1(Xr,"splitEmailAndSocial")?Xr.splitEmailAndSocial:void 0,socialAboveEmail:exists$1(Xr,"socialAboveEmail")?Xr.socialAboveEmail:void 0}}function ProjectSettingsDesignWidgetFromJSON(Xr){return ProjectSettingsDesignWidgetFromJSONTyped(Xr)}function ProjectSettingsDesignWidgetFromJSONTyped(Xr,eo){return Xr==null?Xr:{backgroundColor:exists$1(Xr,"backgroundColor")?Xr.backgroundColor:void 0,border:exists$1(Xr,"border")?Xr.border:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0,textColor:exists$1(Xr,"textColor")?Xr.textColor:void 0,theme:exists$1(Xr,"theme")?Xr.theme:void 0}}function ProjectSettingsDesignFromJSON(Xr){return ProjectSettingsDesignFromJSONTyped(Xr)}function ProjectSettingsDesignFromJSONTyped(Xr,eo){return Xr==null?Xr:{modal:exists$1(Xr,"modal")?ProjectSettingsDesignModalFromJSON(Xr.modal):void 0,button:exists$1(Xr,"button")?ProjectSettingsDesignButtonFromJSON(Xr.button):void 0,widget:exists$1(Xr,"widget")?ProjectSettingsDesignWidgetFromJSON(Xr.widget):void 0}}function ProjectSettingsGeneralFromJSON(Xr){return ProjectSettingsGeneralFromJSONTyped(Xr)}function ProjectSettingsGeneralFromJSONTyped(Xr,eo){return Xr==null?Xr:{displayName:exists$1(Xr,"displayName")?Xr.displayName:void 0,supportEmail:exists$1(Xr,"supportEmail")?Xr.supportEmail:void 0,supportText:exists$1(Xr,"supportText")?Xr.supportText:void 0,appLogo:exists$1(Xr,"appLogo")?Xr.appLogo:void 0,imageUserNotInAccessList:exists$1(Xr,"imageUserNotInAccessList")?Xr.imageUserNotInAccessList:void 0,imageUserInAccessList:exists$1(Xr,"imageUserInAccessList")?Xr.imageUserInAccessList:void 0,supportUrls:exists$1(Xr,"supportUrls")?Xr.supportUrls:void 0,collectUserDataWelcomeHeader:exists$1(Xr,"collectUserDataWelcomeHeader")?Xr.collectUserDataWelcomeHeader:void 0,collectUserDataWelcomeMessage:exists$1(Xr,"collectUserDataWelcomeMessage")?Xr.collectUserDataWelcomeMessage:void 0,skipOptionalKYCFieldDuringOnboarding:exists$1(Xr,"skipOptionalKYCFieldDuringOnboarding")?Xr.skipOptionalKYCFieldDuringOnboarding:void 0,emailCompanyName:exists$1(Xr,"emailCompanyName")?Xr.emailCompanyName:void 0}}function ProjectSettingsPrivacyFromJSON(Xr){return ProjectSettingsPrivacyFromJSONTyped(Xr)}function ProjectSettingsPrivacyFromJSONTyped(Xr,eo){return Xr==null?Xr:{collectIp:exists$1(Xr,"collectIp")?Xr.collectIp:void 0}}function MobileSettingsFromJSON(Xr){return MobileSettingsFromJSONTyped(Xr)}function MobileSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{deeplinkUrlsEnabled:exists$1(Xr,"deeplinkUrlsEnabled")?Xr.deeplinkUrlsEnabled:void 0}}function ProjectSettingsSdkAccountAbstractionFromJSON(Xr){return ProjectSettingsSdkAccountAbstractionFromJSONTyped(Xr)}function ProjectSettingsSdkAccountAbstractionFromJSONTyped(Xr,eo){return Xr==null?Xr:{allWallets:exists$1(Xr,"allWallets")?Xr.allWallets:void 0,allUsers:exists$1(Xr,"allUsers")?Xr.allUsers:void 0}}var SignInProviderEnum;(function(Xr){Xr.Dynamic="dynamic",Xr.MagicLink="magicLink",Xr.Blocto="blocto",Xr.Turnkey="turnkey",Xr.CoinbaseWaas="coinbaseWaas"})(SignInProviderEnum||(SignInProviderEnum={}));function SignInProviderEnumFromJSON(Xr){return SignInProviderEnumFromJSONTyped(Xr)}function SignInProviderEnumFromJSONTyped(Xr,eo){return Xr}function ProjectSettingsSdkEmailSignInFromJSON(Xr){return ProjectSettingsSdkEmailSignInFromJSONTyped(Xr)}function ProjectSettingsSdkEmailSignInFromJSONTyped(Xr,eo){return Xr==null?Xr:{signInProvider:exists$1(Xr,"signInProvider")?SignInProviderEnumFromJSON(Xr.signInProvider):void 0}}function ChainConfigurationFromJSON(Xr){return ChainConfigurationFromJSONTyped(Xr)}function ChainConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,enabled:Xr.enabled,primary:Xr.primary}}function DurationFromJSON(Xr){return DurationFromJSONTyped(Xr)}function DurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{amount:Xr.amount,unit:TimeUnitEnumFromJSON(Xr.unit)}}function SupportedSecurityMethodFromJSON(Xr){return SupportedSecurityMethodFromJSONTyped(Xr)}function SupportedSecurityMethodFromJSONTyped(Xr,eo){return Xr==null?Xr:{isDefault:Xr.isDefault,isEnabled:Xr.isEnabled,isPermanentAuthenticator:Xr.isPermanentAuthenticator,listPosition:Xr.listPosition}}function SupportedSecurityMethodsFromJSON(Xr){return SupportedSecurityMethodsFromJSONTyped(Xr)}function SupportedSecurityMethodsFromJSONTyped(Xr,eo){return Xr==null?Xr:{passkey:exists$1(Xr,"passkey")?SupportedSecurityMethodFromJSON(Xr.passkey):void 0,email:exists$1(Xr,"email")?SupportedSecurityMethodFromJSON(Xr.email):void 0,password:exists$1(Xr,"password")?SupportedSecurityMethodFromJSON(Xr.password):void 0}}function ProjectSettingsSdkEmbeddedWalletsFromJSON(Xr){return ProjectSettingsSdkEmbeddedWalletsFromJSONTyped(Xr)}function ProjectSettingsSdkEmbeddedWalletsFromJSONTyped(Xr,eo){return Xr==null?Xr:{automaticEmbeddedWalletCreation:exists$1(Xr,"automaticEmbeddedWalletCreation")?Xr.automaticEmbeddedWalletCreation:void 0,showEmbeddedWalletActionsUI:exists$1(Xr,"showEmbeddedWalletActionsUI")?Xr.showEmbeddedWalletActionsUI:void 0,emailRecoveryEnabled:exists$1(Xr,"emailRecoveryEnabled")?Xr.emailRecoveryEnabled:void 0,forceAuthenticatorAtSignup:exists$1(Xr,"forceAuthenticatorAtSignup")?Xr.forceAuthenticatorAtSignup:void 0,allowSkippingAuthenticatorAtSignup:exists$1(Xr,"allowSkippingAuthenticatorAtSignup")?Xr.allowSkippingAuthenticatorAtSignup:void 0,sessionKeyDuration:exists$1(Xr,"sessionKeyDuration")?DurationFromJSON(Xr.sessionKeyDuration):void 0,supportedSecurityMethods:exists$1(Xr,"supportedSecurityMethods")?SupportedSecurityMethodsFromJSON(Xr.supportedSecurityMethods):void 0,chainConfigurations:exists$1(Xr,"chainConfigurations")?Xr.chainConfigurations.map(ChainConfigurationFromJSON):void 0,domainEnabledByProvider:exists$1(Xr,"domainEnabledByProvider")?Xr.domainEnabledByProvider:void 0,defaultWalletVersion:exists$1(Xr,"defaultWalletVersion")?EmbeddedWalletVersionEnumFromJSON(Xr.defaultWalletVersion):void 0,promptForKeyExport:exists$1(Xr,"promptForKeyExport")?Xr.promptForKeyExport:void 0}}var SocialSignInProviderEnum;(function(Xr){Xr.Apple="apple",Xr.Bitbucket="bitbucket",Xr.Coinbasesocial="coinbasesocial",Xr.Discord="discord",Xr.Facebook="facebook",Xr.Farcaster="farcaster",Xr.Github="github",Xr.Gitlab="gitlab",Xr.Google="google",Xr.Instagram="instagram",Xr.Linkedin="linkedin",Xr.Microsoft="microsoft",Xr.Twitch="twitch",Xr.Twitter="twitter",Xr.Telegram="telegram"})(SocialSignInProviderEnum||(SocialSignInProviderEnum={}));function SocialSignInProviderEnumFromJSON(Xr){return SocialSignInProviderEnumFromJSONTyped(Xr)}function SocialSignInProviderEnumFromJSONTyped(Xr,eo){return Xr}function SocialSignInProviderFromJSON(Xr){return SocialSignInProviderFromJSONTyped(Xr)}function SocialSignInProviderFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:SocialSignInProviderEnumFromJSON(Xr.provider),enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0}}function ProjectSettingsSdkSocialSignInFromJSON(Xr){return ProjectSettingsSdkSocialSignInFromJSONTyped(Xr)}function ProjectSettingsSdkSocialSignInFromJSONTyped(Xr,eo){return Xr==null?Xr:{signInProvider:exists$1(Xr,"signInProvider")?SignInProviderEnumFromJSON(Xr.signInProvider):void 0,providers:exists$1(Xr,"providers")?Xr.providers.map(SocialSignInProviderFromJSON):void 0}}function ProjectSettingsSdkWalletConnectFromJSON(Xr){return ProjectSettingsSdkWalletConnectFromJSONTyped(Xr)}function ProjectSettingsSdkWalletConnectFromJSONTyped(Xr,eo){return Xr==null?Xr:{projectId:exists$1(Xr,"projectId")?Xr.projectId:void 0,v2Enabled:exists$1(Xr,"v2Enabled")?Xr.v2Enabled:void 0,walletProjectId:exists$1(Xr,"walletProjectId")?Xr.walletProjectId:void 0}}var SdkViewSectionAlignment;(function(Xr){Xr.Center="center",Xr.Left="left",Xr.Right="right"})(SdkViewSectionAlignment||(SdkViewSectionAlignment={}));function SdkViewSectionAlignmentFromJSON(Xr){return SdkViewSectionAlignmentFromJSONTyped(Xr)}function SdkViewSectionAlignmentFromJSONTyped(Xr,eo){return Xr}var SdkViewSectionType;(function(Xr){Xr.Email="email",Xr.EmailAndPhone="emailAndPhone",Xr.Phone="phone",Xr.Separator="separator",Xr.Social="social",Xr.Text="text",Xr.Wallet="wallet"})(SdkViewSectionType||(SdkViewSectionType={}));function SdkViewSectionTypeFromJSON(Xr){return SdkViewSectionTypeFromJSONTyped(Xr)}function SdkViewSectionTypeFromJSONTyped(Xr,eo){return Xr}function SdkViewSectionFromJSON(Xr){return SdkViewSectionFromJSONTyped(Xr)}function SdkViewSectionFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:SdkViewSectionTypeFromJSON(Xr.type),label:exists$1(Xr,"label")?Xr.label:void 0,numOfItemsToDisplay:exists$1(Xr,"numOfItemsToDisplay")?Xr.numOfItemsToDisplay:void 0,defaultItem:exists$1(Xr,"defaultItem")?Xr.defaultItem:void 0,alignment:exists$1(Xr,"alignment")?SdkViewSectionAlignmentFromJSON(Xr.alignment):void 0}}var SdkViewType;(function(Xr){Xr.Login="login"})(SdkViewType||(SdkViewType={}));function SdkViewTypeFromJSON(Xr){return SdkViewTypeFromJSONTyped(Xr)}function SdkViewTypeFromJSONTyped(Xr,eo){return Xr}function SdkViewFromJSON(Xr){return SdkViewFromJSONTyped(Xr)}function SdkViewFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:SdkViewTypeFromJSON(Xr.type),sections:exists$1(Xr,"sections")?Xr.sections.map(SdkViewSectionFromJSON):void 0}}function ProjectSettingsSdkFromJSON(Xr){return ProjectSettingsSdkFromJSONTyped(Xr)}function ProjectSettingsSdkFromJSONTyped(Xr,eo){return Xr==null?Xr:{emailSignIn:exists$1(Xr,"emailSignIn")?ProjectSettingsSdkEmailSignInFromJSON(Xr.emailSignIn):void 0,socialSignIn:exists$1(Xr,"socialSignIn")?ProjectSettingsSdkSocialSignInFromJSON(Xr.socialSignIn):void 0,multiWallet:exists$1(Xr,"multiWallet")?Xr.multiWallet:void 0,multiWalletUnlinkDisabled:exists$1(Xr,"multiWalletUnlinkDisabled")?Xr.multiWalletUnlinkDisabled:void 0,mobile:exists$1(Xr,"mobile")?MobileSettingsFromJSON(Xr.mobile):void 0,confirmWalletTransfers:exists$1(Xr,"confirmWalletTransfers")?Xr.confirmWalletTransfers:void 0,onrampFunding:exists$1(Xr,"onrampFunding")?Xr.onrampFunding:void 0,passkeyEmbeddedWalletEnabled:exists$1(Xr,"passkeyEmbeddedWalletEnabled")?Xr.passkeyEmbeddedWalletEnabled:void 0,automaticEmbeddedWalletCreation:exists$1(Xr,"automaticEmbeddedWalletCreation")?Xr.automaticEmbeddedWalletCreation:void 0,passkeyEmbeddedWalletRecoveryEnabled:exists$1(Xr,"passkeyEmbeddedWalletRecoveryEnabled")?Xr.passkeyEmbeddedWalletRecoveryEnabled:void 0,embeddedWalletSecurityMethods:exists$1(Xr,"embeddedWalletSecurityMethods")?Xr.embeddedWalletSecurityMethods.map(EmbeddedWalletSecurityMethodFromJSON):void 0,embeddedWallets:exists$1(Xr,"embeddedWallets")?ProjectSettingsSdkEmbeddedWalletsFromJSON(Xr.embeddedWallets):void 0,walletConnect:exists$1(Xr,"walletConnect")?ProjectSettingsSdkWalletConnectFromJSON(Xr.walletConnect):void 0,confirmEmailProviderForVerify:exists$1(Xr,"confirmEmailProviderForVerify")?Xr.confirmEmailProviderForVerify:void 0,displayDynamicMessaging:exists$1(Xr,"displayDynamicMessaging")?Xr.displayDynamicMessaging:void 0,hideNetworkInDynamicWidget:exists$1(Xr,"hideNetworkInDynamicWidget")?Xr.hideNetworkInDynamicWidget:void 0,preventOrphanedAccounts:exists$1(Xr,"preventOrphanedAccounts")?Xr.preventOrphanedAccounts:void 0,views:exists$1(Xr,"views")?Xr.views.map(SdkViewFromJSON):void 0,accountAbstraction:exists$1(Xr,"accountAbstraction")?ProjectSettingsSdkAccountAbstractionFromJSON(Xr.accountAbstraction):void 0,enableMultiAsset:exists$1(Xr,"enableMultiAsset")?Xr.enableMultiAsset:void 0,showFiat:exists$1(Xr,"showFiat")?Xr.showFiat:void 0}}function AuthSettingsFromJSON(Xr){return AuthSettingsFromJSONTyped(Xr)}function AuthSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{storage:Xr.storage.map(AuthStorageEnumFromJSON)}}function ExternalAuthFromJSON(Xr){return ExternalAuthFromJSONTyped(Xr)}function ExternalAuthFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,iss:exists$1(Xr,"iss")?Xr.iss:void 0,aud:exists$1(Xr,"aud")?Xr.aud:void 0,jwksUrl:exists$1(Xr,"jwksUrl")?Xr.jwksUrl:void 0,cookieName:exists$1(Xr,"cookieName")?Xr.cookieName:void 0}}function HCaptchaSettingsFromJSON(Xr){return HCaptchaSettingsFromJSONTyped(Xr)}function HCaptchaSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,secretKey:exists$1(Xr,"secretKey")?Xr.secretKey:void 0,siteKey:exists$1(Xr,"siteKey")?Xr.siteKey:void 0}}function MFASettingsFromJSON(Xr){return MFASettingsFromJSONTyped(Xr)}function MFASettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,required:exists$1(Xr,"required")?Xr.required:void 0,availableMethods:exists$1(Xr,"availableMethods")?Xr.availableMethods.map(MFADeviceTypeFromJSON):void 0}}function ProjectSettingsSecurityFromJSON(Xr){return ProjectSettingsSecurityFromJSONTyped(Xr)}function ProjectSettingsSecurityFromJSONTyped(Xr,eo){return Xr==null?Xr:{jwtDuration:exists$1(Xr,"jwtDuration")?DurationFromJSON(Xr.jwtDuration):void 0,hCaptcha:exists$1(Xr,"hCaptcha")?HCaptchaSettingsFromJSON(Xr.hCaptcha):void 0,mfa:exists$1(Xr,"mfa")?MFASettingsFromJSON(Xr.mfa):void 0,auth:exists$1(Xr,"auth")?AuthSettingsFromJSON(Xr.auth):void 0,externalAuth:exists$1(Xr,"externalAuth")?ExternalAuthFromJSON(Xr.externalAuth):void 0}}function ProviderAgreementFromJSON(Xr){return ProviderAgreementFromJSONTyped(Xr)}function ProviderAgreementFromJSONTyped(Xr,eo){return Xr==null?Xr:{termsUrl:Xr.termsUrl,email:Xr.email,userId:Xr.userId,createdAt:new Date(Xr.createdAt)}}function ProviderMultichainAccountAbstractionProvidersFromJSON(Xr){return ProviderMultichainAccountAbstractionProvidersFromJSONTyped(Xr)}function ProviderMultichainAccountAbstractionProvidersFromJSONTyped(Xr,eo){return Xr==null?Xr:{clientId:Xr.clientId,chain:Xr.chain,_default:exists$1(Xr,"default")?Xr.default:void 0}}function SmsCountryCodeFromJSON(Xr){return SmsCountryCodeFromJSONTyped(Xr)}function SmsCountryCodeFromJSONTyped(Xr,eo){return Xr==null?Xr:{isoCountryCode:Xr.isoCountryCode,phoneCountryCode:Xr.phoneCountryCode}}var ProviderEntryPointVersionEnum;(function(Xr){Xr.V6="v6",Xr.V7="v7"})(ProviderEntryPointVersionEnum||(ProviderEntryPointVersionEnum={}));var ProviderKernelVersionEnum;(function(Xr){Xr.V24="v2_4",Xr.V30="v3_0",Xr.V31="v3_1"})(ProviderKernelVersionEnum||(ProviderKernelVersionEnum={}));function ProviderFromJSON(Xr){return ProviderFromJSONTyped(Xr)}function ProviderFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:exists$1(Xr,"id")?Xr.id:void 0,provider:ProviderEnumFromJSON(Xr.provider),enabledAt:exists$1(Xr,"enabledAt")?Xr.enabledAt===null?null:new Date(Xr.enabledAt):void 0,clientId:exists$1(Xr,"clientId")?Xr.clientId:void 0,clientSecret:exists$1(Xr,"clientSecret")?Xr.clientSecret:void 0,providerProjectId:exists$1(Xr,"providerProjectId")?Xr.providerProjectId:void 0,authorizationUrl:exists$1(Xr,"authorizationUrl")?Xr.authorizationUrl:void 0,redirectUrl:exists$1(Xr,"redirectUrl")?Xr.redirectUrl:void 0,defaultChainId:exists$1(Xr,"defaultChainId")?Xr.defaultChainId:void 0,defaultChain:exists$1(Xr,"defaultChain")?Xr.defaultChain:void 0,keyExportUrl:exists$1(Xr,"keyExportUrl")?Xr.keyExportUrl:void 0,termsAcceptedByUser:exists$1(Xr,"termsAcceptedByUser")?ProviderAgreementFromJSON(Xr.termsAcceptedByUser):void 0,scopes:exists$1(Xr,"scopes")?Xr.scopes:void 0,baseAuthUrl:exists$1(Xr,"baseAuthUrl")?Xr.baseAuthUrl:void 0,appleKeyId:exists$1(Xr,"appleKeyId")?Xr.appleKeyId:void 0,appleTeamId:exists$1(Xr,"appleTeamId")?Xr.appleTeamId:void 0,accountSid:exists$1(Xr,"accountSid")?Xr.accountSid:void 0,twilioNumber:exists$1(Xr,"twilioNumber")?Xr.twilioNumber:void 0,enabledCountries:exists$1(Xr,"enabledCountries")?Xr.enabledCountries.map(SmsCountryCodeFromJSON):void 0,entryPointVersion:exists$1(Xr,"entryPointVersion")?Xr.entryPointVersion:void 0,kernelVersion:exists$1(Xr,"kernelVersion")?Xr.kernelVersion:void 0,multichainAccountAbstractionProviders:exists$1(Xr,"multichainAccountAbstractionProviders")?Xr.multichainAccountAbstractionProviders.map(ProviderMultichainAccountAbstractionProvidersFromJSON):void 0,ecdsaProviderType:exists$1(Xr,"ecdsaProviderType")?EcdsaValidatorOptionsFromJSON(Xr.ecdsaProviderType):void 0,createNewAccounts:exists$1(Xr,"createNewAccounts")?Xr.createNewAccounts:void 0}}function ProjectSettingsFromJSON(Xr){return ProjectSettingsFromJSONTyped(Xr)}function ProjectSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{environmentName:exists$1(Xr,"environmentName")?EnvironmentEnumFromJSON(Xr.environmentName):void 0,chains:Xr.chains.map(ProjectSettingsChainsFromJSON),customFields:exists$1(Xr,"customFields")?Xr.customFields.map(ProjectSettingsKycFromJSON):void 0,kyc:Xr.kyc.map(ProjectSettingsKycFromJSON),design:ProjectSettingsDesignFromJSON(Xr.design),general:ProjectSettingsGeneralFromJSON(Xr.general),privacy:ProjectSettingsPrivacyFromJSON(Xr.privacy),providers:exists$1(Xr,"providers")?Xr.providers.map(ProviderFromJSON):void 0,sdk:ProjectSettingsSdkFromJSON(Xr.sdk),security:ProjectSettingsSecurityFromJSON(Xr.security),networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkConfigurationResponseFromJSON):void 0}}var PublishEventsEventsTypeEnum;(function(Xr){Xr.Track="track"})(PublishEventsEventsTypeEnum||(PublishEventsEventsTypeEnum={}));function PublishEventsEventsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{anonymousId:Xr.anonymousId,event:Xr.event,properties:Xr.properties,type:Xr.type}}function PublishEventsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{events:Xr.events.map(PublishEventsEventsToJSON)}}function RegisterEmbeddedWalletSessionKeyResponseFromJSON(Xr){return RegisterEmbeddedWalletSessionKeyResponseFromJSONTyped(Xr)}function RegisterEmbeddedWalletSessionKeyResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{publicKey:Xr.publicKey,expiresAt:Xr.expiresAt}}function RegisterSessionKeyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{publicKey:Xr.publicKey,prevSessionKeySignature:Xr.prevSessionKeySignature}}function ScanWebsiteUrlRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{url:Xr.url}}function ScanWebsiteUrlResponseFromJSON(Xr){return ScanWebsiteUrlResponseFromJSONTyped(Xr)}function ScanWebsiteUrlResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{isMalicious:Xr.isMalicious}}function NextJsSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{version:Xr.version}}function ReactSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{version:Xr.version}}function FrameworkSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{react:ReactSettingsToJSON(Xr.react),nextjs:NextJsSettingsToJSON(Xr.nextjs)}}function SdkSettingsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{dynamicContextProps:Xr.dynamicContextProps,dynamicWagmiSettings:Xr.dynamicWagmiSettings,frameworkSettings:FrameworkSettingsToJSON(Xr.frameworkSettings)}}function SimulateEvmTransactionRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chainId:Xr.chainId,data:Xr.data,from:Xr.from,to:Xr.to,value:Xr.value,domain:Xr.domain}}function EvmAssetFromJSON(Xr){return EvmAssetFromJSONTyped(Xr)}function EvmAssetFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,chainId:Xr.chainId,chainName:Xr.chainName,decimals:Xr.decimals,logoUrl:Xr.logoUrl,name:Xr.name,symbol:Xr.symbol,type:Xr.type,usdPrice:Xr.usdPrice}}function EvmAssetTransferFromJSON(Xr){return EvmAssetTransferFromJSONTyped(Xr)}function EvmAssetTransferFromJSONTyped(Xr,eo){return Xr==null?Xr:{rawValue:Xr.rawValue,summary:Xr.summary,usdPrice:Xr.usdPrice,value:Xr.value}}function AssetDiffFromJSON(Xr){return AssetDiffFromJSONTyped(Xr)}function AssetDiffFromJSONTyped(Xr,eo){return Xr==null?Xr:{asset:EvmAssetFromJSON(Xr.asset),_in:Xr.in.map(EvmAssetTransferFromJSON),out:Xr.out.map(EvmAssetTransferFromJSON)}}function SimulateEvmTransactionResponseFromJSON(Xr){return SimulateEvmTransactionResponseFromJSONTyped(Xr)}function SimulateEvmTransactionResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{inAssets:Xr.inAssets.map(AssetDiffFromJSON),outAssets:Xr.outAssets.map(AssetDiffFromJSON)}}function SmsVerificationCreateRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{phoneCountryCode:Xr.phoneCountryCode,phoneNumber:Xr.phoneNumber,isoCountryCode:Xr.isoCountryCode,captchaToken:Xr.captchaToken}}function SmsVerificationCreateResponseFromJSON(Xr){return SmsVerificationCreateResponseFromJSONTyped(Xr)}function SmsVerificationCreateResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{verificationUUID:Xr.verificationUUID,phoneNumber:Xr.phoneNumber,phoneCountryCode:Xr.phoneCountryCode,isoCountryCode:Xr.isoCountryCode}}function SmsVerificationRetryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,phoneCountryCode:Xr.phoneCountryCode,phoneNumber:Xr.phoneNumber,isoCountryCode:Xr.isoCountryCode,captchaToken:Xr.captchaToken}}function SmsVerificationVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,verificationToken:Xr.verificationToken,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function SolanaTransactionOptimizationRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{transaction:Xr.transaction,address:Xr.address}}function SolanaTransactionOptimizationResponseFromJSON(Xr){return SolanaTransactionOptimizationResponseFromJSONTyped(Xr)}function SolanaTransactionOptimizationResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{transaction:Xr.transaction}}function OnrampConfigurationFromJSON(Xr){return OnrampConfigurationFromJSONTyped(Xr)}function OnrampConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:exists$1(Xr,"provider")?ProviderEnumFromJSON(Xr.provider):void 0,name:exists$1(Xr,"name")?Xr.name:void 0,iconUrl:exists$1(Xr,"iconUrl")?Xr.iconUrl:void 0,url:exists$1(Xr,"url")?Xr.url:void 0}}function SupportedOnrampsResponseFromJSON(Xr){return SupportedOnrampsResponseFromJSONTyped(Xr)}function SupportedOnrampsResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{onramps:exists$1(Xr,"onramps")?Xr.onramps.map(OnrampConfigurationFromJSON):void 0}}function TelegramUserToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,firstName:Xr.firstName,lastName:Xr.lastName,hash:Xr.hash,photoURL:Xr.photoURL,username:Xr.username,authDate:Xr.authDate}}function TelegramPostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,telegramUser:TelegramUserToJSON(Xr.telegramUser)}}function TokenBalanceFromJSON(Xr){return TokenBalanceFromJSONTyped(Xr)}function TokenBalanceFromJSONTyped(Xr,eo){return Xr==null?Xr:{networkId:exists$1(Xr,"networkId")?Xr.networkId:void 0,address:Xr.address,name:Xr.name,symbol:Xr.symbol,decimals:Xr.decimals,logoURI:Xr.logoURI,balance:Xr.balance,rawBalance:Xr.rawBalance,price:exists$1(Xr,"price")?Xr.price:void 0,marketValue:exists$1(Xr,"marketValue")?Xr.marketValue:void 0}}function TurnkeyWalletAccountFromJSON(Xr){return TurnkeyWalletAccountFromJSONTyped(Xr)}function TurnkeyWalletAccountFromJSONTyped(Xr,eo){return Xr==null?Xr:{curve:Xr.curve,pathFormat:Xr.pathFormat,path:Xr.path,addressFormat:Xr.addressFormat}}function TurnkeyCreateWalletAccountsRequestBodyParametersFromJSON(Xr){return TurnkeyCreateWalletAccountsRequestBodyParametersFromJSONTyped(Xr)}function TurnkeyCreateWalletAccountsRequestBodyParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletId:Xr.walletId,accounts:Xr.accounts.map(TurnkeyWalletAccountFromJSON)}}function TurnkeyCreateWalletAccountsRequestBodyFromJSON(Xr){return TurnkeyCreateWalletAccountsRequestBodyFromJSONTyped(Xr)}function TurnkeyCreateWalletAccountsRequestBodyFromJSONTyped(Xr,eo){return Xr==null?Xr:{organizationId:Xr.organizationId,parameters:TurnkeyCreateWalletAccountsRequestBodyParametersFromJSON(Xr.parameters),timestampMs:Xr.timestampMs,type:Xr.type}}function TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSON(Xr){return TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSONTyped(Xr)}function TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletIds:Xr.walletIds,deleteWithoutExport:exists$1(Xr,"deleteWithoutExport")?Xr.deleteWithoutExport:void 0}}function TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSON(Xr){return TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSONTyped(Xr)}function TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSONTyped(Xr,eo){return Xr==null?Xr:{organizationId:Xr.organizationId,parameters:TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSON(Xr.parameters),timestampMs:Xr.timestampMs,type:Xr.type}}var UnprocessableEntityErrorCode;(function(Xr){Xr.EmailAlreadyExists="email_already_exists",Xr.AllowlistAlreadyExists="allowlist_already_exists",Xr.AllowlistEntryAlreadyExists="allowlist_entry_already_exists",Xr.ReassignWalletError="reassign_wallet_error",Xr.ReassignWalletConfirm="reassign_wallet_confirm",Xr.MembersCannotDeleteThemself="members_cannot_delete_themself",Xr.UsernameAlreadyExists="username_already_exists",Xr.WrongEmailVerificationToken="wrong_email_verification_token",Xr.WrongSmsVerificationToken="wrong_sms_verification_token",Xr.InvalidEmailVerification="invalid_email_verification",Xr.InvalidSmsVerification="invalid_sms_verification",Xr.InvalidVerification="invalid_verification",Xr.InvalidPosition="invalid_position",Xr.TooManySmsVerificationAttempts="too_many_sms_verification_attempts",Xr.TooManyEmailVerificationAttempts="too_many_email_verification_attempts",Xr.TooManyVerificationAttempts="too_many_verification_attempts",Xr.OrganizationNameAlreadyExists="organization_name_already_exists",Xr.ProjectNameAlreadyExists="project_name_already_exists",Xr.WalletNotDeployed="wallet_not_deployed",Xr.EmailVerificationRequired="email_verification_required",Xr.PhoneVerificationRequired="phone_verification_required",Xr.InviteAddressRequired="invite_address_required",Xr.ProviderNotAvailable="provider_not_available",Xr.ForbiddenUnlinkRequest="forbidden_unlink_request",Xr.InvalidUnlinkRequest="invalid_unlink_request",Xr.TooManyApiTokens="too_many_api_tokens",Xr.LockTimeout="lock_timeout",Xr.LockTooManyAttempts="lock_too_many_attempts",Xr.NftTokenGatingNotSupportedForChain="nft_token_gating_not_supported_for_chain",Xr.EmptyChainName="empty_chain_name",Xr.NoEnabledEmailProvider="no_enabled_email_provider",Xr.NoEnabledSmsProvider="no_enabled_sms_provider",Xr.InvalidKeyExportUrl="invalid_key_export_url",Xr.InvalidDynamicProps="invalid_dynamic_props",Xr.TooManyRequests="too_many_requests",Xr.TooManyOrganizationsForUser="too_many_organizations_for_user",Xr.TooManyProjectsForOrganization="too_many_projects_for_organization",Xr.EmailAssociatedWithDifferentProvider="email_associated_with_different_provider",Xr.UserHasAlreadyAccountWithEmail="user_has_already_account_with_email",Xr.UserHasAlreadyAccountWithPhoneNumber="user_has_already_account_with_phone_number",Xr.OtherVerifyFailure="other_verify_failure",Xr.EmailTiedToEmbeddedWallet="email_tied_to_embedded_wallet",Xr.InvalidInvite="invalid_invite",Xr.SocialAccountAlreadyExists="social_account_already_exists",Xr.InvalidEmailAddress="invalid_email_address",Xr.InvalidGate="invalid_gate",Xr.ConflictingEmbeddedWalletProviders="conflicting_embedded_wallet_providers",Xr.InvalidUser="invalid_user",Xr.InvalidCorsOrigins="invalid_cors_origins",Xr.InvalidMobileDeeplinkUrls="invalid_mobile_deeplink_urls",Xr.UnauthorizedMobileDeeplinkUrl="unauthorized_mobile_deeplink_url",Xr.InvalidPrivateKeyFormat="invalid_private_key_format",Xr.InvalidEmbeddedWalletSettings="invalid_embedded_wallet_settings",Xr.WalletNotSupportPasskey="wallet_not_support_passkey",Xr.RecoveryEmailUnavailableOrInvalid="recovery_email_unavailable_or_invalid",Xr.ConnectError="connect_error",Xr.InvalidWalletName="invalid_wallet_name",Xr.InvalidWalletAddress="invalid_wallet_address",Xr.EmailRecoveryDisabled="email_recovery_disabled",Xr.NoCompatibleWalletServiceEnabled="no_compatible_wallet_service_enabled",Xr.MissingAaProjectId="missing_aa_project_id",Xr.LinkedEmbeddedWallet="linked_embedded_wallet",Xr.InvalidMpcEnvironment="invalid_mpc_environment",Xr.InvalidRegex="invalid_regex",Xr.RepeatedOptions="repeated_options",Xr.MissingPhoneNumberOrEmail="missing_phone_number_or_email",Xr.DuplicateExists="duplicate_exists",Xr.MfaDeviceNotFound="mfa_device_not_found",Xr.MfaInvalidCode="mfa_invalid_code",Xr.MfaInvalidRequest="mfa_invalid_request",Xr.InvalidPhone="invalid_phone",Xr.GateExists="gate_exists",Xr.InvalidEmbeddedWalletChainsConfiguration="invalid_embedded_wallet_chains_configuration",Xr.MergeAccountsConfirmation="merge_accounts_confirmation",Xr.MergeAccountsInvalid="merge_accounts_invalid",Xr.InvalidWalletId="invalid_wallet_id",Xr.UnableToFetchBalances="unable_to_fetch_balances",Xr.CannotSwitchToUnique="cannot_switch_to_unique",Xr.CustomFieldDataNotUnique="custom_field_data_not_unique",Xr.MetadataSizeExceeded="metadata_size_exceeded",Xr.InvalidCustomHostname="invalid_custom_hostname",Xr.BlockedUserCannotTransferWallet="blocked_user_cannot_transfer_wallet",Xr.FeatureNotEnabledInSuborg="feature_not_enabled_in_suborg",Xr.InvalidUsername="invalid_username",Xr.InvalidExternalAuth="invalid_external_auth",Xr.InvalidChainAddressMatch="invalid_chain_address_match",Xr.InvalidUpdate="invalid_update",Xr.CannotDeleteLastProject="cannot_delete_last_project",Xr.NoHdWalletFound="no_hd_wallet_found",Xr.WalletAccountExistsForChain="wallet_account_exists_for_chain",Xr.TooManyEmbeddedWalletsForUser="too_many_embedded_wallets_for_user",Xr.TooManyEmbeddedWalletsPerChainForUser="too_many_embedded_wallets_per_chain_for_user",Xr.InvalidSessionPublicKey="invalid_session_public_key"})(UnprocessableEntityErrorCode||(UnprocessableEntityErrorCode={}));function UpdateRecoveryEmailRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}function UpdateSelfResponseFromJSON(Xr){return UpdateSelfResponseFromJSONTyped(Xr)}function UpdateSelfResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{mfaToken:exists$1(Xr,"mfaToken")?Xr.mfaToken:void 0,jwt:exists$1(Xr,"jwt")?Xr.jwt:void 0,user:SdkUserFromJSON(Xr.user),minifiedJwt:exists$1(Xr,"minifiedJwt")?Xr.minifiedJwt:void 0,expiresAt:Xr.expiresAt,nextView:NextViewEnumFromJSON(Xr.nextView),emailVerification:exists$1(Xr,"emailVerification")?EmailVerificationCreateResponseFromJSON(Xr.emailVerification):void 0,smsVerification:exists$1(Xr,"smsVerification")?SmsVerificationCreateResponseFromJSON(Xr.smsVerification):void 0}}function UpdateUserPasskeyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,alias:Xr.alias}}function UserFieldsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{email:Xr.email,alias:Xr.alias,firstName:Xr.firstName,lastName:Xr.lastName,jobTitle:Xr.jobTitle,phoneNumber:Xr.phoneNumber,tShirtSize:Xr.tShirtSize,team:Xr.team,policiesConsent:Xr.policiesConsent,country:Xr.country,username:Xr.username,captchaToken:Xr.captchaToken,metadata:Xr.metadata,mfaBackupCodeAcknowledgement:Xr.mfaBackupCodeAcknowledgement,btcWallet:Xr.btcWallet,kdaWallet:Xr.kdaWallet,ltcWallet:Xr.ltcWallet,ckbWallet:Xr.ckbWallet,kasWallet:Xr.kasWallet,dogeWallet:Xr.dogeWallet,emailNotification:Xr.emailNotification,discordNotification:Xr.discordNotification,newsletterNotification:Xr.newsletterNotification}}function UserWalletSelectionRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId}}function OauthProviderRequestFromJSON(Xr){return OauthProviderRequestFromJSONTyped(Xr)}function OauthProviderRequestFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:exists$1(Xr,"provider")?ProviderEnumFromJSON(Xr.provider):void 0,accessToken:exists$1(Xr,"accessToken")?Xr.accessToken:void 0,didToken:exists$1(Xr,"didToken")?Xr.didToken:void 0}}function OauthProviderRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{provider:Xr.provider,accessToken:Xr.accessToken,didToken:Xr.didToken}}function VerifyRequestFromJSON(Xr){return VerifyRequestFromJSONTyped(Xr)}function VerifyRequestFromJSONTyped(Xr,eo){return Xr==null?Xr:{oauth:exists$1(Xr,"oauth")?OauthProviderRequestFromJSON(Xr.oauth):void 0,signedMessage:Xr.signedMessage,messageToSign:Xr.messageToSign,publicWalletAddress:Xr.publicWalletAddress,chain:ChainEnumFromJSON(Xr.chain),walletName:Xr.walletName,walletProvider:WalletProviderEnumFromJSON(Xr.walletProvider),skipEmptyAccountCheck:exists$1(Xr,"skipEmptyAccountCheck")?Xr.skipEmptyAccountCheck:void 0,captchaToken:exists$1(Xr,"captchaToken")?Xr.captchaToken:void 0,network:exists$1(Xr,"network")?Xr.network:void 0,additionalWalletAddresses:exists$1(Xr,"additionalWalletAddresses")?Xr.additionalWalletAddresses.map(WalletAdditionalAddressFromJSON):void 0,backup:exists$1(Xr,"backup")?Xr.backup:void 0,password:exists$1(Xr,"password")?Xr.password:void 0,passwordSource:exists$1(Xr,"passwordSource")?PasswordSourceTypeEnumFromJSON(Xr.passwordSource):void 0,sessionPublicKey:exists$1(Xr,"sessionPublicKey")?Xr.sessionPublicKey:void 0}}function VerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{oauth:OauthProviderRequestToJSON(Xr.oauth),signedMessage:Xr.signedMessage,messageToSign:Xr.messageToSign,publicWalletAddress:Xr.publicWalletAddress,chain:Xr.chain,walletName:Xr.walletName,walletProvider:Xr.walletProvider,skipEmptyAccountCheck:Xr.skipEmptyAccountCheck,captchaToken:Xr.captchaToken,network:Xr.network,additionalWalletAddresses:Xr.additionalWalletAddresses===void 0?void 0:Xr.additionalWalletAddresses.map(WalletAdditionalAddressToJSON),backup:Xr.backup,password:Xr.password,passwordSource:Xr.passwordSource,sessionPublicKey:Xr.sessionPublicKey}}function VerifyResponseFromJSON(Xr){return VerifyResponseFromJSONTyped(Xr)}function VerifyResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{mfaToken:exists$1(Xr,"mfaToken")?Xr.mfaToken:void 0,jwt:exists$1(Xr,"jwt")?Xr.jwt:void 0,user:SdkUserFromJSON(Xr.user),minifiedJwt:exists$1(Xr,"minifiedJwt")?Xr.minifiedJwt:void 0,expiresAt:Xr.expiresAt}}function VerifyUnlinkRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,verifiedCrentialId:Xr.verifiedCrentialId,primaryWalletId:Xr.primaryWalletId}}class SDKApi extends BaseAPI{authMfaPasskeyDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDevice.");if(eo.mFAAuthPasskeyDevicePostRequest===null||eo.mFAAuthPasskeyDevicePostRequest===void 0)throw new RequiredError("mFAAuthPasskeyDevicePostRequest","Required parameter requestParameters.mFAAuthPasskeyDevicePostRequest was null or undefined when calling authMfaPasskeyDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthPasskeyDevicePostRequestToJSON(eo.mFAAuthPasskeyDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaPasskeyDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaPasskeyDeviceRaw(eo,to)).value()})}authMfaPasskeyDeviceChallengeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDeviceChallenge.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAAuthPasskeyDeviceGetResponseFromJSON(oo))})}authMfaPasskeyDeviceChallenge(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaPasskeyDeviceChallengeRaw(eo,to)).value()})}authMfaPasskeyDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaPasskeyDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaPasskeyDeviceOptionsRaw(eo,to)})}authMfaRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaRecovery.");if(eo.mFAAuthRecoveryDevicePostRequest===null||eo.mFAAuthRecoveryDevicePostRequest===void 0)throw new RequiredError("mFAAuthRecoveryDevicePostRequest","Required parameter requestParameters.mFAAuthRecoveryDevicePostRequest was null or undefined when calling authMfaRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthRecoveryDevicePostRequestToJSON(eo.mFAAuthRecoveryDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaRecoveryRaw(eo,to)).value()})}authMfaRecoveryOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaRecoveryOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaRecoveryOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaRecoveryOptionsRaw(eo,to)})}authMfaTotpDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaTotpDevice.");if(eo.mFAAuthTotpDevicePostRequest===null||eo.mFAAuthTotpDevicePostRequest===void 0)throw new RequiredError("mFAAuthTotpDevicePostRequest","Required parameter requestParameters.mFAAuthTotpDevicePostRequest was null or undefined when calling authMfaTotpDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthTotpDevicePostRequestToJSON(eo.mFAAuthTotpDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaTotpDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaTotpDeviceRaw(eo,to)).value()})}authMfaTotpDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaTotpDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaTotpDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaTotpDeviceOptionsRaw(eo,to)})}claimEmbeddedWalletRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling claimEmbeddedWallet.");if(eo.embeddedWalletPasscodeClaimRequest===null||eo.embeddedWalletPasscodeClaimRequest===void 0)throw new RequiredError("embeddedWalletPasscodeClaimRequest","Required parameter requestParameters.embeddedWalletPasscodeClaimRequest was null or undefined when calling claimEmbeddedWallet.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode/claim".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:EmbeddedWalletPasscodeClaimRequestToJSON(eo.embeddedWalletPasscodeClaimRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}claimEmbeddedWallet(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.claimEmbeddedWalletRaw(eo,to)).value()})}claimEmbeddedWalletOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling claimEmbeddedWalletOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode/claim".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}claimEmbeddedWalletOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.claimEmbeddedWalletOptionsRaw(eo,to)})}completePasskeyRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling completePasskeyRecovery.");if(eo.completePasskeyRecoveryRequest===null||eo.completePasskeyRecoveryRequest===void 0)throw new RequiredError("completePasskeyRecoveryRequest","Required parameter requestParameters.completePasskeyRecoveryRequest was null or undefined when calling completePasskeyRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:CompletePasskeyRecoveryRequestToJSON(eo.completePasskeyRecoveryRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}completePasskeyRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.completePasskeyRecoveryRaw(eo,to)).value()})}createEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmailVerification.");if(eo.emailVerificationCreateRequest===null||eo.emailVerificationCreateRequest===void 0)throw new RequiredError("emailVerificationCreateRequest","Required parameter requestParameters.emailVerificationCreateRequest was null or undefined when calling createEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationCreateRequestToJSON(eo.emailVerificationCreateRequest)},to);return new JSONApiResponse(io,oo=>EmailVerificationCreateResponseFromJSON(oo))})}createEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createEmailVerificationRaw(eo,to)).value()})}createEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createEmailVerificationOptionsRaw(eo,to)})}createEmbeddedWalletsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmbeddedWallets.");if(eo.createEmbeddedWalletsRequest===null||eo.createEmbeddedWalletsRequest===void 0)throw new RequiredError("createEmbeddedWalletsRequest","Required parameter requestParameters.createEmbeddedWalletsRequest was null or undefined when calling createEmbeddedWallets.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:CreateEmbeddedWalletsRequestToJSON(eo.createEmbeddedWalletsRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}createEmbeddedWallets(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createEmbeddedWalletsRaw(eo,to)).value()})}createEmbeddedWalletsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmbeddedWalletsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createEmbeddedWalletsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createEmbeddedWalletsOptionsRaw(eo,to)})}createNewRecoveryCodesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createNewRecoveryCodes.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegenRecoveryCodesResponseFromJSON(oo))})}createNewRecoveryCodes(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createNewRecoveryCodesRaw(eo,to)).value()})}createSmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createSmsVerification.");if(eo.smsVerificationCreateRequest===null||eo.smsVerificationCreateRequest===void 0)throw new RequiredError("smsVerificationCreateRequest","Required parameter requestParameters.smsVerificationCreateRequest was null or undefined when calling createSmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationCreateRequestToJSON(eo.smsVerificationCreateRequest)},to);return new JSONApiResponse(io,oo=>SmsVerificationCreateResponseFromJSON(oo))})}createSmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createSmsVerificationRaw(eo,to)).value()})}createSmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createSmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createSmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createSmsVerificationOptionsRaw(eo,to)})}createVisitRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createVisit.");if(eo.connectRequest===null||eo.connectRequest===void 0)throw new RequiredError("connectRequest","Required parameter requestParameters.connectRequest was null or undefined when calling createVisit.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/connect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ConnectRequestToJSON(eo.connectRequest)},to);return new VoidApiResponse(io)})}createVisit(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createVisitRaw(eo,to)})}createWalletAccountRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createWalletAccount.");if(eo.createWalletAccountRequest===null||eo.createWalletAccountRequest===void 0)throw new RequiredError("createWalletAccountRequest","Required parameter requestParameters.createWalletAccountRequest was null or undefined when calling createWalletAccount.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:CreateWalletAccountRequestToJSON(eo.createWalletAccountRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}createWalletAccount(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createWalletAccountRaw(eo,to)).value()})}deleteEmbeddedWalletsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling deleteEmbeddedWallets.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"DELETE",headers:no,query:ro,body:DeleteEmbeddedWalletsRequestToJSON(eo.deleteEmbeddedWalletsRequest)},to);return new VoidApiResponse(io)})}deleteEmbeddedWallets(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.deleteEmbeddedWalletsRaw(eo,to)})}deleteMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling deleteMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling deleteMfaDevice.");if(eo.xMfaAuthToken===null||eo.xMfaAuthToken===void 0)throw new RequiredError("xMfaAuthToken","Required parameter requestParameters.xMfaAuthToken was null or undefined when calling deleteMfaDevice.");const ro={},no={};if(eo.xMfaAuthToken!==void 0&&eo.xMfaAuthToken!==null&&(no["x-mfa-auth-token"]=String(eo.xMfaAuthToken)),this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"DELETE",headers:no,query:ro},to);return new VoidApiResponse(io)})}deleteMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.deleteMfaDeviceRaw(eo,to)})}emailAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling emailAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/emailAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}emailAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.emailAuthOptionsRaw(eo,to)})}emailProviderOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling emailProviderOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailProvider".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}emailProviderOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.emailProviderOptionsRaw(eo,to)})}embeddedWalletDeleteRequestOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletDeleteRequestOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/deleteRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}embeddedWalletDeleteRequestOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.embeddedWalletDeleteRequestOptionsRaw(eo,to)})}embeddedWalletExportRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletExport.");if(eo.walletId===null||eo.walletId===void 0)throw new RequiredError("walletId","Required parameter requestParameters.walletId was null or undefined when calling embeddedWalletExport.");if(eo.activityId===null||eo.activityId===void 0)throw new RequiredError("activityId","Required parameter requestParameters.activityId was null or undefined when calling embeddedWalletExport.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/{walletId}/activities/{activityId}/export".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{walletId}",encodeURIComponent(String(eo.walletId))).replace("{activityId}",encodeURIComponent(String(eo.activityId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>ExportEmbeddedWalletResponseFromJSON(oo))})}embeddedWalletExport(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.embeddedWalletExportRaw(eo,to)).value()})}embeddedWalletExportOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletExportOptions.");if(eo.walletId===null||eo.walletId===void 0)throw new RequiredError("walletId","Required parameter requestParameters.walletId was null or undefined when calling embeddedWalletExportOptions.");if(eo.activityId===null||eo.activityId===void 0)throw new RequiredError("activityId","Required parameter requestParameters.activityId was null or undefined when calling embeddedWalletExportOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/{walletId}/activities/{activityId}/export".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{walletId}",encodeURIComponent(String(eo.walletId))).replace("{activityId}",encodeURIComponent(String(eo.activityId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}embeddedWalletExportOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.embeddedWalletExportOptionsRaw(eo,to)})}eventsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling eventsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/events".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}eventsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.eventsOptionsRaw(eo,to)})}externalAuthSigninRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthSignin.");if(eo.externalAuthSigninRequest===null||eo.externalAuthSigninRequest===void 0)throw new RequiredError("externalAuthSigninRequest","Required parameter requestParameters.externalAuthSigninRequest was null or undefined when calling externalAuthSignin.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/externalAuth/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ExternalAuthSigninRequestToJSON(eo.externalAuthSigninRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}externalAuthSignin(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.externalAuthSigninRaw(eo,to)).value()})}externalAuthSigninOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthSigninOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/externalAuth/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}externalAuthSigninOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.externalAuthSigninOptionsRaw(eo,to)})}externalAuthVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthVerify.");if(eo.externalAuthSigninRequest===null||eo.externalAuthSigninRequest===void 0)throw new RequiredError("externalAuthSigninRequest","Required parameter requestParameters.externalAuthSigninRequest was null or undefined when calling externalAuthVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/externalAuth/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ExternalAuthSigninRequestToJSON(eo.externalAuthSigninRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}externalAuthVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.externalAuthVerifyRaw(eo,to)).value()})}externalAuthVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/externalAuth/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}externalAuthVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.externalAuthVerifyOptionsRaw(eo,to)})}farcasterSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/farcaster/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:FarcasterSignInRequestToJSON(eo.farcasterSignInRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}farcasterSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.farcasterSignInRaw(eo,to)).value()})}farcasterSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/farcaster/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}farcasterSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.farcasterSignInOptionsRaw(eo,to)})}farcasterVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/farcaster/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:FarcasterSignInRequestToJSON(eo.farcasterSignInRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}farcasterVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.farcasterVerifyRaw(eo,to)).value()})}farcasterVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/farcaster/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}farcasterVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.farcasterVerifyOptionsRaw(eo,to)})}getAccountBalancesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAccountBalances.");if(eo.chainName===null||eo.chainName===void 0)throw new RequiredError("chainName","Required parameter requestParameters.chainName was null or undefined when calling getAccountBalances.");if(eo.accountAddress===null||eo.accountAddress===void 0)throw new RequiredError("accountAddress","Required parameter requestParameters.accountAddress was null or undefined when calling getAccountBalances.");const ro={};eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.accountAddress!==void 0&&(ro.accountAddress=eo.accountAddress),eo.includePrices!==void 0&&(ro.includePrices=eo.includePrices),eo.includeNative!==void 0&&(ro.includeNative=eo.includeNative);const no={},io=yield this.request({path:"/sdk/{environmentId}/chains/{chainName}/balances".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{chainName}",encodeURIComponent(String(eo.chainName))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>oo.map(TokenBalanceFromJSON))})}getAccountBalances(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAccountBalancesRaw(eo,to)).value()})}getAccountBalancesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAccountBalancesOptions.");if(eo.chainName===null||eo.chainName===void 0)throw new RequiredError("chainName","Required parameter requestParameters.chainName was null or undefined when calling getAccountBalancesOptions.");if(eo.networkId===null||eo.networkId===void 0)throw new RequiredError("networkId","Required parameter requestParameters.networkId was null or undefined when calling getAccountBalancesOptions.");if(eo.accountAddress===null||eo.accountAddress===void 0)throw new RequiredError("accountAddress","Required parameter requestParameters.accountAddress was null or undefined when calling getAccountBalancesOptions.");const ro={};eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.accountAddress!==void 0&&(ro.accountAddress=eo.accountAddress);const no={},io=yield this.request({path:"/sdk/{environmentId}/chains/{chainName}/balances".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{chainName}",encodeURIComponent(String(eo.chainName))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getAccountBalancesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getAccountBalancesOptionsRaw(eo,to)})}getAuthTokenRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthToken.");const ro={};eo.type!==void 0&&(ro.type=eo.type);const no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/authToken".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletAuthTokenFromJSON(oo))})}getAuthToken(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAuthTokenRaw(eo,to)).value()})}getAuthTokenOptsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthTokenOpts.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/authToken".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getAuthTokenOpts(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getAuthTokenOptsRaw(eo,to)})}getAuthenticatedUserRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthenticatedUser.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>SdkUserFromJSON(oo))})}getAuthenticatedUser(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAuthenticatedUserRaw(eo,to)).value()})}getCreateWalletAccountRequestRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getCreateWalletAccountRequest.");if(eo.chain===null||eo.chain===void 0)throw new RequiredError("chain","Required parameter requestParameters.chain was null or undefined when calling getCreateWalletAccountRequest.");const ro={};eo.chain!==void 0&&(ro.chain=eo.chain);const no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts/createRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>TurnkeyCreateWalletAccountsRequestBodyFromJSON(oo))})}getCreateWalletAccountRequest(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getCreateWalletAccountRequestRaw(eo,to)).value()})}getEmailProviderRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmailProvider.");if(eo.email===null||eo.email===void 0)throw new RequiredError("email","Required parameter requestParameters.email was null or undefined when calling getEmailProvider.");const ro={};eo.email!==void 0&&(ro.email=eo.email);const no={},io=yield this.request({path:"/sdk/{environmentId}/emailProvider".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmailProviderResponseFromJSON(oo))})}getEmailProvider(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmailProviderRaw(eo,to)).value()})}getEmbeddedWalletBackupOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletBackupOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/backup".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getEmbeddedWalletBackupOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getEmbeddedWalletBackupOptionRaw(eo,to)})}getEmbeddedWalletBackupsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletBackups.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/backup".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletSecretFromJSON(oo))})}getEmbeddedWalletBackups(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletBackupsRaw(eo,to)).value()})}getEmbeddedWalletPasscodeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletPasscode.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletSecretFromJSON(oo))})}getEmbeddedWalletPasscode(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletPasscodeRaw(eo,to)).value()})}getEmbeddedWalletPasscodeOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletPasscodeOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getEmbeddedWalletPasscodeOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getEmbeddedWalletPasscodeOptionRaw(eo,to)})}getEmbeddedWalletsDeleteRequestRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletsDeleteRequest.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/deleteRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSON(oo))})}getEmbeddedWalletsDeleteRequest(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletsDeleteRequestRaw(eo,to)).value()})}getEnvironmentSettingsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEnvironmentSettings.");const ro={};eo.sdkVersion!==void 0&&(ro.sdkVersion=eo.sdkVersion);const no={},io=yield this.request({path:"/sdk/{environmentId}/settings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>ProjectSettingsFromJSON(oo))})}getEnvironmentSettings(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEnvironmentSettingsRaw(eo,to)).value()})}getHealthcheckRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getHealthcheck.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/healthcheck".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>HealthcheckResponseFromJSON(oo))})}getHealthcheck(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getHealthcheckRaw(eo,to)).value()})}getHealthcheckOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getHealthcheckOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/healthcheck".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getHealthcheckOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getHealthcheckOptionsRaw(eo,to)})}getJwksByEnvironmentIdRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getJwksByEnvironmentId.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/.well-known/jwks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>JwksResponseFromJSON(oo))})}getJwksByEnvironmentId(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getJwksByEnvironmentIdRaw(eo,to)).value()})}getMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling getMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFADeviceFromJSON(oo))})}getMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getMfaDeviceRaw(eo,to)).value()})}getMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getMfaDeviceOptions.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling getMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getMfaDeviceOptionsRaw(eo,to)})}getNetworksConfigurationByEnvIdRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getNetworksConfigurationByEnvId.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/networks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>oo.map(NetworkConfigurationResponseFromJSON))})}getNetworksConfigurationByEnvId(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getNetworksConfigurationByEnvIdRaw(eo,to)).value()})}getNonceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getNonce.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/nonce".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>NonceResponseFromJSON(oo))})}getNonce(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getNonceRaw(eo,to)).value()})}getRecoveryCodesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getRecoveryCodes.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAGetRecoveryCodesResponseFromJSON(oo))})}getRecoveryCodes(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getRecoveryCodesRaw(eo,to)).value()})}getSupportedOnrampsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getSupportedOnramps.");if(eo.walletAddress===null||eo.walletAddress===void 0)throw new RequiredError("walletAddress","Required parameter requestParameters.walletAddress was null or undefined when calling getSupportedOnramps.");if(eo.chain===null||eo.chain===void 0)throw new RequiredError("chain","Required parameter requestParameters.chain was null or undefined when calling getSupportedOnramps.");const ro={};eo.walletAddress!==void 0&&(ro.walletAddress=eo.walletAddress),eo.chain!==void 0&&(ro.chain=eo.chain),eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.token!==void 0&&(ro.token=eo.token);const no={},io=yield this.request({path:"/sdk/{environmentId}/onramps".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>SupportedOnrampsResponseFromJSON(oo))})}getSupportedOnramps(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getSupportedOnrampsRaw(eo,to)).value()})}getTelegramAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getTelegramAuth.");if(eo.state===null||eo.state===void 0)throw new RequiredError("state","Required parameter requestParameters.state was null or undefined when calling getTelegramAuth.");const ro={};eo.state!==void 0&&(ro.state=eo.state);const no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}getTelegramAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getTelegramAuthRaw(eo,to)).value()})}getUserMfaDevicesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getUserMfaDevices.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAListDevicesResponseFromJSON(oo))})}getUserMfaDevices(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getUserMfaDevicesRaw(eo,to)).value()})}getUserPasskeysRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getUserPasskeys.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>GetUserPasskeysResponseFromJSON(oo))})}getUserPasskeys(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getUserPasskeysRaw(eo,to)).value()})}initAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initAuth.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling initAuth.");if(eo.oauthInitAuthRequest===null||eo.oauthInitAuthRequest===void 0)throw new RequiredError("oauthInitAuthRequest","Required parameter requestParameters.oauthInitAuthRequest was null or undefined when calling initAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/initAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthInitAuthRequestToJSON(eo.oauthInitAuthRequest)},to);return new VoidApiResponse(io)})}initAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.initAuthRaw(eo,to)})}initAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initAuthOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling initAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/initAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}initAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.initAuthOptionsRaw(eo,to)})}initEmailAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initEmailAuth.");if(eo.initEmailAuthRequest===null||eo.initEmailAuthRequest===void 0)throw new RequiredError("initEmailAuthRequest","Required parameter requestParameters.initEmailAuthRequest was null or undefined when calling initEmailAuth.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/emailAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:InitEmailAuthRequestToJSON(eo.initEmailAuthRequest)},to);return new JSONApiResponse(io,oo=>InitEmailAuthResponseFromJSON(oo))})}initEmailAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.initEmailAuthRaw(eo,to)).value()})}initPasskeyRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initPasskeyRecovery.");if(eo.initPasskeyRecoveryRequest===null||eo.initPasskeyRecoveryRequest===void 0)throw new RequiredError("initPasskeyRecoveryRequest","Required parameter requestParameters.initPasskeyRecoveryRequest was null or undefined when calling initPasskeyRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:InitPasskeyRecoveryRequestToJSON(eo.initPasskeyRecoveryRequest)},to);return new JSONApiResponse(io,oo=>InitPasskeyRecoveryResponseFromJSON(oo))})}initPasskeyRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.initPasskeyRecoveryRaw(eo,to)).value()})}jwksOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling jwksOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/.well-known/jwks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}jwksOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.jwksOptionsRaw(eo,to)})}listMfaDevicesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling listMfaDevicesOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}listMfaDevicesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.listMfaDevicesOptionsRaw(eo,to)})}logDynamicSdkSettingsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling logDynamicSdkSettings.");if(eo.sdkSettingsRequest===null||eo.sdkSettingsRequest===void 0)throw new RequiredError("sdkSettingsRequest","Required parameter requestParameters.sdkSettingsRequest was null or undefined when calling logDynamicSdkSettings.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/sdkSettings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SdkSettingsRequestToJSON(eo.sdkSettingsRequest)},to);return new VoidApiResponse(io)})}logDynamicSdkSettings(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.logDynamicSdkSettingsRaw(eo,to)})}mergeUsersRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling mergeUsers.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}mergeUsers(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.mergeUsersRaw(eo,to)).value()})}mergeUsersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling mergeUsersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}mergeUsersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.mergeUsersOptionsRaw(eo,to)})}networksOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling networksOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/networks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}networksOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.networksOptionsRaw(eo,to)})}nonceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling nonceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/nonce".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}nonceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.nonceOptionsRaw(eo,to)})}oauthAuthorizeHtmlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthAuthorizeHtml.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthAuthorizeHtml.");const ro={};eo.scope!==void 0&&(ro.scope=eo.scope),eo.state!==void 0&&(ro.state=eo.state),eo.redirectUri!==void 0&&(ro.redirect_uri=eo.redirectUri);const no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/authorizeHtml".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}oauthAuthorizeHtml(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthAuthorizeHtmlRaw(eo,to)).value()})}oauthAuthorizeHtmlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthAuthorizeHtmlOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthAuthorizeHtmlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/authorizeHtml".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthAuthorizeHtmlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthAuthorizeHtmlOptionsRaw(eo,to)})}oauthLoginRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLogin.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLogin.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/login".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLogin(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginRaw(eo,to)})}oauthLoginOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/login".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLoginOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginOptionsRaw(eo,to)})}oauthLoginUrlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginUrl.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginUrl.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/loginUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>OauthProviderLoginUrlFromJSON(oo))})}oauthLoginUrl(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthLoginUrlRaw(eo,to)).value()})}oauthLoginUrlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginUrlOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginUrlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/loginUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLoginUrlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginUrlOptionsRaw(eo,to)})}oauthRedirectAppleRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectApple.");const ro={},no={};canConsumeForm([{contentType:"application/x-www-form-urlencoded"}]);let oo;oo=new URLSearchParams,eo.code!==void 0&&oo.append("code",eo.code),eo.state!==void 0&&oo.append("state",eo.state),eo.idToken!==void 0&&oo.append("id_token",eo.idToken),eo.error!==void 0&&oo.append("error",eo.error);const ao=yield this.request({path:"/sdk/{environmentId}/providers/apple/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:oo},to);return new TextApiResponse(ao)})}oauthRedirectApple(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthRedirectAppleRaw(eo,to)).value()})}oauthRedirectAppleOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectAppleOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/apple/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthRedirectAppleOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthRedirectAppleOptionsRaw(eo,to)})}oauthRedirectCodeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectCode.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthRedirectCode.");const ro={};eo.code!==void 0&&(ro.code=eo.code),eo.scope!==void 0&&(ro.scope=eo.scope),eo.state!==void 0&&(ro.state=eo.state),eo.authuser!==void 0&&(ro.authuser=eo.authuser),eo.prompt!==void 0&&(ro.prompt=eo.prompt),eo.error!==void 0&&(ro.error=eo.error);const no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}oauthRedirectCode(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthRedirectCodeRaw(eo,to)).value()})}oauthRedirectOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthRedirectOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthRedirectOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthRedirectOptionsRaw(eo,to)})}oauthResultRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthResult.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthResult.");if(eo.oauthResultRequest===null||eo.oauthResultRequest===void 0)throw new RequiredError("oauthResultRequest","Required parameter requestParameters.oauthResultRequest was null or undefined when calling oauthResult.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/oauthResult".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>OauthResultResponseFromJSON(oo))})}oauthResult(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthResultRaw(eo,to)).value()})}oauthResultOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthResultOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthResultOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/oauthResult".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthResultOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthResultOptionsRaw(eo,to)})}oauthSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthSignIn.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthSignIn.");if(eo.oauthRequest===null||eo.oauthRequest===void 0)throw new RequiredError("oauthRequest","Required parameter requestParameters.oauthRequest was null or undefined when calling oauthSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/signIn".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthRequestToJSON(eo.oauthRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}oauthSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthSignInRaw(eo,to)).value()})}oauthSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthSignInOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/signIn".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthSignInOptionsRaw(eo,to)})}oauthVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthVerify.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthVerify.");if(eo.oauthRequest===null||eo.oauthRequest===void 0)throw new RequiredError("oauthRequest","Required parameter requestParameters.oauthRequest was null or undefined when calling oauthVerify.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthRequestToJSON(eo.oauthRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}oauthVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthVerifyRaw(eo,to)).value()})}oauthVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthVerifyOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthVerifyOptionsRaw(eo,to)})}onrampsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling onrampsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/onramps".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}onrampsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.onrampsOptionsRaw(eo,to)})}optimizeTransactionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optimizeTransaction.");if(eo.solanaTransactionOptimizationRequest===null||eo.solanaTransactionOptimizationRequest===void 0)throw new RequiredError("solanaTransactionOptimizationRequest","Required parameter requestParameters.solanaTransactionOptimizationRequest was null or undefined when calling optimizeTransaction.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/solana/optimizeTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SolanaTransactionOptimizationRequestToJSON(eo.solanaTransactionOptimizationRequest)},to);return new JSONApiResponse(io,oo=>SolanaTransactionOptimizationResponseFromJSON(oo))})}optimizeTransaction(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.optimizeTransactionRaw(eo,to)).value()})}optimizeTransactionOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optimizeTransactionOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/solana/optimizeTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}optimizeTransactionOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.optimizeTransactionOptionsRaw(eo,to)})}optionsConnectRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optionsConnect.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/connect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}optionsConnect(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.optionsConnectRaw(eo,to)})}passkeyRecoveryOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling passkeyRecoveryOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}passkeyRecoveryOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.passkeyRecoveryOptionsRaw(eo,to)})}postTelegramAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling postTelegramAuth.");if(eo.telegramPostRequest===null||eo.telegramPostRequest===void 0)throw new RequiredError("telegramPostRequest","Required parameter requestParameters.telegramPostRequest was null or undefined when calling postTelegramAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:TelegramPostRequestToJSON(eo.telegramPostRequest)},to);return new VoidApiResponse(io)})}postTelegramAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.postTelegramAuthRaw(eo,to)})}prefetchRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling prefetch.");if(eo.prefetchRequest===null||eo.prefetchRequest===void 0)throw new RequiredError("prefetchRequest","Required parameter requestParameters.prefetchRequest was null or undefined when calling prefetch.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/prefetch".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:PrefetchRequestToJSON(eo.prefetchRequest)},to);return new VoidApiResponse(io)})}prefetch(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.prefetchRaw(eo,to)})}publishEventRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling publishEvent.");if(eo.publishEvents===null||eo.publishEvents===void 0)throw new RequiredError("publishEvents","Required parameter requestParameters.publishEvents was null or undefined when calling publishEvent.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/events".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:PublishEventsToJSON(eo.publishEvents)},to);return new VoidApiResponse(io)})}publishEvent(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.publishEventRaw(eo,to)})}recoveryCodesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling recoveryCodesOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}recoveryCodesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.recoveryCodesOptionsRaw(eo,to)})}recoveryEmailOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling recoveryEmailOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/recoveryEmail".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}recoveryEmailOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.recoveryEmailOptionsRaw(eo,to)})}refreshAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling refreshAuth.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/refresh".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}refreshAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.refreshAuthRaw(eo,to)).value()})}refreshOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling refreshOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/refresh".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}refreshOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.refreshOptionsRaw(eo,to)})}registerPasskeyMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegisterPasskeyDeviceGetResponseFromJSON(oo))})}registerPasskeyMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerPasskeyMfaDeviceRaw(eo,to)).value()})}registerPasskeyMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}registerPasskeyMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.registerPasskeyMfaDeviceOptionsRaw(eo,to)})}registerPasskeyMfaDeviceVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDeviceVerify.");if(eo.mFARegisterPasskeyDevicePostRequest===null||eo.mFARegisterPasskeyDevicePostRequest===void 0)throw new RequiredError("mFARegisterPasskeyDevicePostRequest","Required parameter requestParameters.mFARegisterPasskeyDevicePostRequest was null or undefined when calling registerPasskeyMfaDeviceVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFARegisterPasskeyDevicePostRequestToJSON(eo.mFARegisterPasskeyDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}registerPasskeyMfaDeviceVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerPasskeyMfaDeviceVerifyRaw(eo,to)).value()})}registerSessionKeyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerSessionKey.");if(eo.registerSessionKeyRequest===null||eo.registerSessionKeyRequest===void 0)throw new RequiredError("registerSessionKeyRequest","Required parameter requestParameters.registerSessionKeyRequest was null or undefined when calling registerSessionKey.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/sessionKey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:RegisterSessionKeyRequestToJSON(eo.registerSessionKeyRequest)},to);return new JSONApiResponse(io,oo=>RegisterEmbeddedWalletSessionKeyResponseFromJSON(oo))})}registerSessionKey(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerSessionKeyRaw(eo,to)).value()})}registerTotpMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegisterTotpDeviceGetResponseFromJSON(oo))})}registerTotpMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerTotpMfaDeviceRaw(eo,to)).value()})}registerTotpMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}registerTotpMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.registerTotpMfaDeviceOptionsRaw(eo,to)})}registerTotpMfaDeviceVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDeviceVerify.");if(eo.mFARegisterTotpDevicePostRequest===null||eo.mFARegisterTotpDevicePostRequest===void 0)throw new RequiredError("mFARegisterTotpDevicePostRequest","Required parameter requestParameters.mFARegisterTotpDevicePostRequest was null or undefined when calling registerTotpMfaDeviceVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFARegisterTotpDevicePostRequestToJSON(eo.mFARegisterTotpDevicePostRequest)},to);return new JSONApiResponse(io,oo=>MFADeviceFromJSON(oo))})}registerTotpMfaDeviceVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerTotpMfaDeviceVerifyRaw(eo,to)).value()})}retryEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retryEmailVerification.");if(eo.emailVerificationRetryRequest===null||eo.emailVerificationRetryRequest===void 0)throw new RequiredError("emailVerificationRetryRequest","Required parameter requestParameters.emailVerificationRetryRequest was null or undefined when calling retryEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationRetryRequestToJSON(eo.emailVerificationRetryRequest)},to);return new JSONApiResponse(io,oo=>EmailVerificationCreateResponseFromJSON(oo))})}retryEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.retryEmailVerificationRaw(eo,to)).value()})}retryEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retryEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}retryEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.retryEmailVerificationOptionsRaw(eo,to)})}retrySmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retrySmsVerification.");if(eo.smsVerificationRetryRequest===null||eo.smsVerificationRetryRequest===void 0)throw new RequiredError("smsVerificationRetryRequest","Required parameter requestParameters.smsVerificationRetryRequest was null or undefined when calling retrySmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationRetryRequestToJSON(eo.smsVerificationRetryRequest)},to);return new JSONApiResponse(io,oo=>SmsVerificationCreateResponseFromJSON(oo))})}retrySmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.retrySmsVerificationRaw(eo,to)).value()})}retrySmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retrySmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}retrySmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.retrySmsVerificationOptionsRaw(eo,to)})}revokeSessionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling revokeSession.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/revoke".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new VoidApiResponse(io)})}revokeSession(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.revokeSessionRaw(eo,to)})}revokeSessionOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling revokeSessionOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/revoke".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}revokeSessionOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.revokeSessionOptionRaw(eo,to)})}scanUrlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling scanUrl.");if(eo.scanWebsiteUrlRequest===null||eo.scanWebsiteUrlRequest===void 0)throw new RequiredError("scanWebsiteUrlRequest","Required parameter requestParameters.scanWebsiteUrlRequest was null or undefined when calling scanUrl.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/scan/websiteUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ScanWebsiteUrlRequestToJSON(eo.scanWebsiteUrlRequest)},to);return new JSONApiResponse(io,oo=>ScanWebsiteUrlResponseFromJSON(oo))})}scanUrl(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.scanUrlRaw(eo,to)).value()})}scanUrlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling scanUrlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/scan/websiteUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}scanUrlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.scanUrlOptionsRaw(eo,to)})}sdkSettingsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sdkSettingsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/sdkSettings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sdkSettingsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sdkSettingsOptionsRaw(eo,to)})}selectUserWalletRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling selectUserWallet.");if(eo.userWalletSelectionRequest===null||eo.userWalletSelectionRequest===void 0)throw new RequiredError("userWalletSelectionRequest","Required parameter requestParameters.userWalletSelectionRequest was null or undefined when calling selectUserWallet.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/wallets/selection".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UserWalletSelectionRequestToJSON(eo.userWalletSelectionRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}selectUserWallet(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.selectUserWalletRaw(eo,to)).value()})}selectUserWalletOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling selectUserWalletOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/wallets/selection".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}selectUserWalletOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.selectUserWalletOptionsRaw(eo,to)})}sessionCheckRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionCheck.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/session".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionCheck(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionCheckRaw(eo,to)})}sessionCheckOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionCheckOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/session".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionCheckOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionCheckOptionsRaw(eo,to)})}sessionKeyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionKeyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/sessionKey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionKeyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionKeyOptionsRaw(eo,to)})}settingsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling settingsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/settings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}settingsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.settingsOptionsRaw(eo,to)})}signInWithEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithEmailVerification.");if(eo.emailVerificationVerifyRequest===null||eo.emailVerificationVerifyRequest===void 0)throw new RequiredError("emailVerificationVerifyRequest","Required parameter requestParameters.emailVerificationVerifyRequest was null or undefined when calling signInWithEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationVerifyRequestToJSON(eo.emailVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}signInWithEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.signInWithEmailVerificationRaw(eo,to)).value()})}signInWithEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}signInWithEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.signInWithEmailVerificationOptionsRaw(eo,to)})}signInWithSmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithSmsVerification.");if(eo.smsVerificationVerifyRequest===null||eo.smsVerificationVerifyRequest===void 0)throw new RequiredError("smsVerificationVerifyRequest","Required parameter requestParameters.smsVerificationVerifyRequest was null or undefined when calling signInWithSmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationVerifyRequestToJSON(eo.smsVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}signInWithSmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.signInWithSmsVerificationRaw(eo,to)).value()})}signInWithSmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithSmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}signInWithSmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.signInWithSmsVerificationOptionsRaw(eo,to)})}simulateEvmTransactionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateEvmTransaction.");if(eo.simulateEvmTransactionRequest===null||eo.simulateEvmTransactionRequest===void 0)throw new RequiredError("simulateEvmTransactionRequest","Required parameter requestParameters.simulateEvmTransactionRequest was null or undefined when calling simulateEvmTransaction.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/evm/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SimulateEvmTransactionRequestToJSON(eo.simulateEvmTransactionRequest)},to);return new JSONApiResponse(io,oo=>SimulateEvmTransactionResponseFromJSON(oo))})}simulateEvmTransaction(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.simulateEvmTransactionRaw(eo,to)).value()})}simulateEvmTransactionOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateEvmTransactionOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/evm/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}simulateEvmTransactionOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.simulateEvmTransactionOptionsRaw(eo,to)})}telegramAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramAuthOptionsRaw(eo,to)})}telegramCheckAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramCheckAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/checkTelegramAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new VoidApiResponse(io)})}telegramCheckAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramCheckAuthRaw(eo,to)})}telegramCheckAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramCheckAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/checkTelegramAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramCheckAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramCheckAuthOptionsRaw(eo,to)})}telegramSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/telegram/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}telegramSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.telegramSignInRaw(eo,to)).value()})}telegramSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramSignInOptionsRaw(eo,to)})}telegramVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/telegram/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}telegramVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.telegramVerifyRaw(eo,to)).value()})}telegramVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramVerifyOptionsRaw(eo,to)})}updateEmbeddedWalletRecoveryEmailRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateEmbeddedWalletRecoveryEmail.");if(eo.updateRecoveryEmailRequest===null||eo.updateRecoveryEmailRequest===void 0)throw new RequiredError("updateRecoveryEmailRequest","Required parameter requestParameters.updateRecoveryEmailRequest was null or undefined when calling updateEmbeddedWalletRecoveryEmail.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/recoveryEmail".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UpdateRecoveryEmailRequestToJSON(eo.updateRecoveryEmailRequest)},to);return new VoidApiResponse(io)})}updateEmbeddedWalletRecoveryEmail(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.updateEmbeddedWalletRecoveryEmailRaw(eo,to)})}updatePasskeyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updatePasskey.");if(eo.updateUserPasskeyRequest===null||eo.updateUserPasskeyRequest===void 0)throw new RequiredError("updateUserPasskeyRequest","Required parameter requestParameters.updateUserPasskeyRequest was null or undefined when calling updatePasskey.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UpdateUserPasskeyRequestToJSON(eo.updateUserPasskeyRequest)},to);return new JSONApiResponse(io,oo=>UserPasskeyFromJSON(oo))})}updatePasskey(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.updatePasskeyRaw(eo,to)).value()})}updateSelfRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateSelf.");if(eo.userFields===null||eo.userFields===void 0)throw new RequiredError("userFields","Required parameter requestParameters.userFields was null or undefined when calling updateSelf.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UserFieldsToJSON(eo.userFields)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}updateSelf(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.updateSelfRaw(eo,to)).value()})}updateUserMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateUserMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling updateUserMfaDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"PUT",headers:no,query:ro,body:MFAUpdateDeviceRequestToJSON(eo.mFAUpdateDeviceRequest)},to);return new VoidApiResponse(io)})}updateUserMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.updateUserMfaDeviceRaw(eo,to)})}userPasskeysOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling userPasskeysOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}userPasskeysOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.userPasskeysOptionsRaw(eo,to)})}usersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling usersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}usersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.usersOptionsRaw(eo,to)})}verifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verify.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verify.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyRaw(eo,to)).value()})}verifyEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyEmailVerification.");if(eo.emailVerificationVerifyRequest===null||eo.emailVerificationVerifyRequest===void 0)throw new RequiredError("emailVerificationVerifyRequest","Required parameter requestParameters.emailVerificationVerifyRequest was null or undefined when calling verifyEmailVerification.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationVerifyRequestToJSON(eo.emailVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}verifyEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyEmailVerificationRaw(eo,to)).value()})}verifyEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyEmailVerificationOptionsRaw(eo,to)})}verifyLinkRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyLink.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verifyLink.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/link".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyLink(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyLinkRaw(eo,to)).value()})}verifyLinkOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyLinkOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/link".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyLinkOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyLinkOptionsRaw(eo,to)})}verifyMergeUsersRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyMergeUsers.");if(eo.mergeUserConflictResolutions===null||eo.mergeUserConflictResolutions===void 0)throw new RequiredError("mergeUserConflictResolutions","Required parameter requestParameters.mergeUserConflictResolutions was null or undefined when calling verifyMergeUsers.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MergeUserConflictResolutionsToJSON(eo.mergeUserConflictResolutions)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyMergeUsers(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyMergeUsersRaw(eo,to)).value()})}verifyMergeUsersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyMergeUsersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyMergeUsersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyMergeUsersOptionsRaw(eo,to)})}verifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyOptionsRaw(eo,to)})}verifyPrefetchRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyPrefetch.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/prefetch".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyPrefetch(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyPrefetchRaw(eo,to)})}verifySmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifySmsVerification.");if(eo.smsVerificationVerifyRequest===null||eo.smsVerificationVerifyRequest===void 0)throw new RequiredError("smsVerificationVerifyRequest","Required parameter requestParameters.smsVerificationVerifyRequest was null or undefined when calling verifySmsVerification.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationVerifyRequestToJSON(eo.smsVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}verifySmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifySmsVerificationRaw(eo,to)).value()})}verifySmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifySmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifySmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifySmsVerificationOptionsRaw(eo,to)})}verifyTransferRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyTransfer.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verifyTransfer.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/transfer".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyTransfer(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyTransferRaw(eo,to)).value()})}verifyTransferOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyTransferOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/transfer".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyTransferOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyTransferOptionsRaw(eo,to)})}verifyUnlinkRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyUnlink.");if(eo.verifyUnlinkRequest===null||eo.verifyUnlinkRequest===void 0)throw new RequiredError("verifyUnlinkRequest","Required parameter requestParameters.verifyUnlinkRequest was null or undefined when calling verifyUnlink.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/unlink".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyUnlinkRequestToJSON(eo.verifyUnlinkRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyUnlink(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyUnlinkRaw(eo,to)).value()})}verifyUnlinkOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyUnlinkOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/unlink".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyUnlinkOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyUnlinkOptionsRaw(eo,to)})}walletAccountOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling walletAccountOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}walletAccountOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.walletAccountOptionsRaw(eo,to)})}walletAccountRequestOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling walletAccountRequestOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts/createRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}walletAccountRequestOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.walletAccountRequestOptionsRaw(eo,to)})}}var GetAccountBalancesChainNameEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(GetAccountBalancesChainNameEnum||(GetAccountBalancesChainNameEnum={}));var GetAccountBalancesNetworkIdEnum;(function(Xr){Xr[Xr.NUMBER_0=0]="NUMBER_0",Xr[Xr.NUMBER_1=1]="NUMBER_1",Xr[Xr.NUMBER_10=10]="NUMBER_10",Xr[Xr.NUMBER_137=137]="NUMBER_137",Xr[Xr.NUMBER_42161=42161]="NUMBER_42161",Xr[Xr.NUMBER_8453=8453]="NUMBER_8453"})(GetAccountBalancesNetworkIdEnum||(GetAccountBalancesNetworkIdEnum={}));var GetAccountBalancesOptionsChainNameEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(GetAccountBalancesOptionsChainNameEnum||(GetAccountBalancesOptionsChainNameEnum={}));function JwtBlockchainAccountFromJSON(Xr){return JwtBlockchainAccountFromJSONTyped(Xr)}function JwtBlockchainAccountFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,chain:Xr.chain,id:Xr.id,nameService:exists$1(Xr,"name_service")?NameServiceDataFromJSON(Xr.name_service):void 0,walletName:Xr.wallet_name,walletProvider:WalletProviderEnumFromJSON(Xr.wallet_provider)}}function JwtPayloadDeprecatedInfoFromJSON(Xr){return JwtPayloadDeprecatedInfoFromJSONTyped(Xr)}function JwtPayloadDeprecatedInfoFromJSONTyped(Xr,eo){return Xr==null?Xr:{alias:exists$1(Xr,"alias")?Xr.alias:void 0,chain:exists$1(Xr,"chain")?ChainEnumFromJSON(Xr.chain):void 0,email:exists$1(Xr,"email")?Xr.email:void 0,ens:exists$1(Xr,"ens")?NameServiceDataFromJSON(Xr.ens):void 0,environmentId:Xr.environmentId,firstName:exists$1(Xr,"firstName")?Xr.firstName:void 0,jobTitle:exists$1(Xr,"jobTitle")?Xr.jobTitle:void 0,lastName:exists$1(Xr,"lastName")?Xr.lastName:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,tShirtSize:exists$1(Xr,"tShirtSize")?Xr.tShirtSize:void 0,userId:exists$1(Xr,"userId")?Xr.userId:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,wallet:exists$1(Xr,"wallet")?Xr.wallet:void 0,walletPublicKey:exists$1(Xr,"walletPublicKey")?Xr.walletPublicKey:void 0}}function JwtVerifiedCredentialHashesFromJSON(Xr){return JwtVerifiedCredentialHashesFromJSONTyped(Xr)}function JwtVerifiedCredentialHashesFromJSONTyped(Xr,eo){return Xr==null?Xr:{blockchain:exists$1(Xr,"blockchain")?Xr.blockchain:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,oauth:exists$1(Xr,"oauth")?Xr.oauth:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,externalUser:exists$1(Xr,"externalUser")?Xr.externalUser:void 0}}function DynamicJwtFromJSON(Xr){return DynamicJwtFromJSONTyped(Xr)}function DynamicJwtFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:Xr.kid,aud:Xr.aud,iss:Xr.iss,sub:Xr.sub,exp:exists$1(Xr,"exp")?Xr.exp:void 0,iat:exists$1(Xr,"iat")?Xr.iat:void 0,sid:Xr.sid,alias:exists$1(Xr,"alias")?Xr.alias:void 0,blockchainAccounts:exists$1(Xr,"blockchain_accounts")?Xr.blockchain_accounts.map(JwtBlockchainAccountFromJSON):void 0,country:exists$1(Xr,"country")?Xr.country:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,environmentId:Xr.environment_id,familyName:exists$1(Xr,"family_name")?Xr.family_name:void 0,givenName:exists$1(Xr,"given_name")?Xr.given_name:void 0,jobTitle:exists$1(Xr,"job_title")?Xr.job_title:void 0,lastAuthenticatedAccountId:exists$1(Xr,"last_authenticated_account_id")?Xr.last_authenticated_account_id:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,phoneNumber:exists$1(Xr,"phone_number")?Xr.phone_number:void 0,missingFields:Xr.missing_fields.map(ProjectSettingsKycFromJSON),scope:exists$1(Xr,"scope")?Xr.scope:void 0,tShirtSize:exists$1(Xr,"t_shirt_size")?Xr.t_shirt_size:void 0,team:exists$1(Xr,"team")?Xr.team:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,policiesConsent:exists$1(Xr,"policies_consent")?Xr.policies_consent:void 0,verifiedAccount:exists$1(Xr,"verified_account")?JwtBlockchainAccountFromJSON(Xr.verified_account):void 0,verifiedCredentials:Xr.verified_credentials.map(JwtVerifiedCredentialFromJSON),lastVerifiedCredentialId:Xr.last_verified_credential_id,firstVisit:exists$1(Xr,"first_visit")?new Date(Xr.first_visit):void 0,lastVisit:exists$1(Xr,"last_visit")?new Date(Xr.last_visit):void 0,newUser:exists$1(Xr,"new_user")?Xr.new_user:void 0,btcWallet:exists$1(Xr,"btc_wallet")?Xr.btc_wallet:void 0,kdaWallet:exists$1(Xr,"kda_wallet")?Xr.kda_wallet:void 0,ltcWallet:exists$1(Xr,"ltc_wallet")?Xr.ltc_wallet:void 0,ckbWallet:exists$1(Xr,"ckb_wallet")?Xr.ckb_wallet:void 0,kasWallet:exists$1(Xr,"kas_wallet")?Xr.kas_wallet:void 0,dogeWallet:exists$1(Xr,"doge_wallet")?Xr.doge_wallet:void 0,emailNotification:exists$1(Xr,"email_notification")?Xr.email_notification:void 0,discordNotification:exists$1(Xr,"discord_notification")?Xr.discord_notification:void 0,newsletterNotification:exists$1(Xr,"newsletter_notification")?Xr.newsletter_notification:void 0,metadata:exists$1(Xr,"metadata")?Xr.metadata:void 0,verifiedCredentialsHashes:exists$1(Xr,"verifiedCredentialsHashes")?JwtVerifiedCredentialHashesFromJSON(Xr.verifiedCredentialsHashes):void 0,info:exists$1(Xr,"info")?JwtPayloadDeprecatedInfoFromJSON(Xr.info):void 0}}function MinifiedDynamicJwtFromJSON(Xr){return MinifiedDynamicJwtFromJSONTyped(Xr)}function MinifiedDynamicJwtFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:Xr.kid,aud:Xr.aud,iss:Xr.iss,sub:Xr.sub,sid:Xr.sid,exp:exists$1(Xr,"exp")?Xr.exp:void 0,iat:exists$1(Xr,"iat")?Xr.iat:void 0,environmentId:Xr.environment_id,lastVerifiedCredentialId:Xr.last_verified_credential_id,scope:exists$1(Xr,"scope")?Xr.scope:void 0,verifiedCredentialsHashes:exists$1(Xr,"verifiedCredentialsHashes")?JwtVerifiedCredentialHashesFromJSON(Xr.verifiedCredentialsHashes):void 0}}var SocialOAuthErrorCode;(function(Xr){Xr.ACCOUNT_ALREADY_LINKED="account_already_linked",Xr.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE="account_already_linked_to_different_profile",Xr.INVALID_PROVIDER="invalid_provider",Xr.NO_ACCOUNT_LINKED="no_account_linked",Xr.NO_AUTH_CODE="no_auth_code",Xr.NO_OAUTH_URL="no_oauth_url",Xr.NO_PROVIDER="no_provider",Xr.OAUTH_ERROR="oauth_error",Xr.OAUTH_WINDOW_BLOCKED="oauth_window_blocked",Xr.OAUTH_WINDOW_CLOSED="oauth_window_closed",Xr.OAUTH_WINDOW_TIMEOUT="oauth_window_timeout",Xr.PROVIDER_NOT_ENABLED="provider_not_enabled",Xr.SESSION_TIMEOUT="session_timeout",Xr.SIGNIN_ERROR="signin_error",Xr.SOCIAL_LINKING_NOT_ENABLED="social_linking_not_enabled",Xr.UNLINK_ERROR="unlink_error",Xr.VERIFICATION_ERROR="verification_error",Xr.GENERAL_ERROR="general_error",Xr.USER_CANCELLED="user_cancelled"})(SocialOAuthErrorCode||(SocialOAuthErrorCode={}));class BaseWallet{constructor({id:eo,key:to,address:ro,additionalAddresses:no=[],chain:io,isAuthenticated:oo}){this.id=eo,this.key=to,this.address=ro,this.additionalAddresses=no,this.chain=io,this.isAuthenticated=oo}}assertPackageVersion("@dynamic-labs/types",version$n);const appleIdScriptSrc="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",loadAppleId=()=>new Promise((Xr,eo)=>{const to=document.querySelector("script[data-apple-sdk]");if(to)to.hasAttribute("data-loaded")?Xr():(to.addEventListener("load",()=>Xr()),to.addEventListener("error",()=>eo(new Error("Failed to load Apple SDK"))));else{const ro=document.createElement("script");ro.type="text/javascript",ro.src=appleIdScriptSrc,ro.setAttribute("data-apple-sdk","true"),ro.onload=()=>{ro==null||ro.setAttribute("data-loaded","true"),Xr()},ro.onerror=()=>eo(new Error("Failed to load Apple SDK")),window.document.head.appendChild(ro)}}),connectWithAppleId=Xr=>__awaiter$m(void 0,[Xr],void 0,function*({clientId:eo,oauthLoginUrl:to,state:ro}){yield loadAppleId(),AppleID.auth.init({clientId:eo,redirectURI:to.searchParams.get("redirect_uri"),scope:"name email",state:ro,usePopup:!1}),AppleID.auth.signIn()});let authWindowInterval;const createWindowOauth2Service=()=>({getOauthCode:({apiProvider:Xr,provider:eo,redirectUrl:to,setIsProcessing:ro,state:no,oauthLoginUrl:io,initWebAuth:oo,strategy:ao})=>new Promise((so,co)=>{if(eo===ProviderEnum.Apple&&(isSafariBrowser()||isIOS$1()||ao==="redirect")){oo({redirectUrl:to||window.location.href}).then(()=>connectWithAppleId({clientId:Xr==null?void 0:Xr.clientId,oauthLoginUrl:io,state:no}).catch(co));return}if(ao==="redirect"&&eo!==ProviderEnum.Telegram){oo({redirectUrl:to||window.location.href}).then(()=>{window.location.assign(io)});return}const lo=ko=>co(ko);clearInterval(authWindowInterval);const fo={},ho=window.open("","_blank","width=500,height=600");if(ho===null||typeof ho>"u"){lo({code:SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED,message:"Please allow popups and try again."});return}const go=()=>{window.removeEventListener("message",yo),fo[eo]=!1},yo=ko=>__awaiter$m(void 0,void 0,void 0,function*(){const Ao=ko.data,Po=vo(Xr);if(!Po)return;if((Ao==null?void 0:Ao.type)==="origin_check"&&ho){logger$a.debug("Origin check message received. Sending response now.",{data:Ao,expectedOrigin:Po}),ho.postMessage("origin_check_response",Po);return}const jo=(Ao==null?void 0:Ao.type)==="telegram_completed",Mo=(Ao==null?void 0:Ao.type)==="authorization_response";(Mo||jo)&&logger$a.debug("Message received",{data:Ao});const No=ko.origin===Po;if((Mo&&(Ao==null?void 0:Ao.provider)===eo||jo)&&No){if(ro(!0),!fo[eo]){lo({code:SocialOAuthErrorCode.SESSION_TIMEOUT,message:`Connecting ${eo} account session timeout.`});return}if(go(),jo){wo(Ao,no);return}Eo(Ao,eo,no)}}),vo=ko=>{if(ko!=null&&ko.redirectUrl)try{return new URL(ko.redirectUrl).origin}catch(Ao){logger$a.error("Failed to parse social provider redirect url",{error:Ao});return}},wo=(ko,Ao)=>{logger$a.debug("Telegram completion message received",{data:ko});const{code:Po,state:jo}=ko;if(Ao!==jo){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:"Failed to connect telegram account: Invalid random state"});return}so(Po),ro(!1)},Eo=(ko,Ao,Po)=>{const{code:jo,error:Mo,state:No}=ko;if(Mo&&Mo!=="undefined"){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:`Failed to connect ${Ao} social account: ${Mo}`});return}if(Po!==No){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:`Failed to connect ${Ao} social account: Invalid random state`});return}if(!jo){lo({code:SocialOAuthErrorCode.NO_AUTH_CODE,message:`Failed to connect ${Ao} social account: no authorization code`});return}so(jo),ro(!1)};fo[eo]||(window.addEventListener("message",yo),fo[eo]=!0),oo().then(()=>{ho==null||ho.location.assign(io),authWindowInterval=setInterval(()=>{ho!=null&&ho.closed&&(clearInterval(authWindowInterval),ro(!1),fo[eo]&&lo({code:SocialOAuthErrorCode.USER_CANCELLED,message:"User cancelled connection"}))},2e3)})})});var _a$1,_Oauth2Service_implementation;class Oauth2Service{static get implementation(){return __classPrivateFieldGet$5(_a$1,_a$1,"f",_Oauth2Service_implementation)?__classPrivateFieldGet$5(_a$1,_a$1,"f",_Oauth2Service_implementation):createWindowOauth2Service()}static set implementation(eo){__classPrivateFieldSet$5(_a$1,_a$1,eo,"f",_Oauth2Service_implementation)}static get getOauthCode(){return _a$1.implementation.getOauthCode}}_a$1=Oauth2Service;_Oauth2Service_implementation={value:void 0};Oauth2Service.isGetOauthCodeError=Xr=>typeof Xr=="object"&&"code"in Xr&&Object.values(SocialOAuthErrorCode).includes(Xr.code)&&"message"in Xr&&typeof Xr.message=="string";const template$1=Xr=>eo=>Xr.replace(/{{(\w+?)}}/g,(to,ro)=>ro in eo?eo[ro]:to),get$8=(Xr,eo)=>{try{return(eo.match(/[^.[\]"']+/g)||[]).reduce((ro,no)=>ro[no],Xr)}catch{return}},hexToString=Xr=>{const eo=Xr.startsWith("0x")?Xr.substring(2):Xr;let to="";const ro=eo.length-eo.length%2;for(let no=0;no{if(typeof Xr!="string")throw new Error("Input must be a string");const eo=Xr.startsWith("0x")?Xr.substring(2):Xr;return/^[0-9a-fA-F]+$/.test(eo)};class StorageService{static clearRegistry(){StorageService.registry={localStorage:void 0,secureStorage:void 0,sessionStorage:void 0}}static registerSourceStorage(eo,to){StorageService.registry[eo]=to}static getSourceStorage(eo){return StorageService.registry[eo]}static resolveStorage(eo){const to=(eo==null?void 0:eo.priority)||["localStorage"];for(const ro of to){const no=StorageService.getSourceStorage(ro);if(no)return no}throw new Error("No available storage found based on the specified priority")}static getItem(eo,to){return StorageService.resolveStorage(to).getItem(eo)}static setItem(eo,to,ro){StorageService.resolveStorage(ro).setItem(eo,to)}static removeItem(eo,to){StorageService.resolveStorage(to).removeItem(eo)}static getKeys(eo){return StorageService.resolveStorage(eo).getKeys()}}StorageService.registry={localStorage:void 0,secureStorage:void 0,sessionStorage:void 0};StorageService.events=new EventEmitter$3;const createStorageService=({postfix:Xr,storage:eo})=>{const to=co=>Xr?`${co}_${Xr}`:co,ro=co=>JSON.stringify(co),no=co=>JSON.parse(co),io=co=>{const lo=eo.getItem(to(co));if(lo)try{return no(lo)}catch(fo){logger$a.error(`Error while parsing ${co} from local storage`,{value:lo}),ao(co),StorageService.events.emit("parseFailure",fo,co)}},oo=(co,lo)=>{eo.setItem(to(co),ro(lo))},ao=co=>{eo.removeItem(to(co))};return{getItem:io,getKeys:()=>Object.keys(eo),removeItem:ao,setItem:oo}},cloneObjectWithOverrides=(Xr,eo={})=>{var to,ro;const no=Object.getOwnPropertyDescriptors(Xr),io=Object.create(Object.getPrototypeOf(Xr));for(const[ao,so]of Object.entries(eo))Object.defineProperty(io,ao,{configurable:!0,enumerable:(ro=(to=no[ao])===null||to===void 0?void 0:to.enumerable)!==null&&ro!==void 0?ro:!0,value:so,writable:!0});const oo=Object.keys(eo);for(const[ao,so]of Object.entries(no))oo.includes(ao)||Object.defineProperty(io,ao,so);return io};assertPackageVersion("@dynamic-labs/utils",version$o);var util$9;(function(Xr){Xr.assertEqual=no=>no;function eo(no){}Xr.assertIs=eo;function to(no){throw new Error}Xr.assertNever=to,Xr.arrayToEnum=no=>{const io={};for(const oo of no)io[oo]=oo;return io},Xr.getValidEnumValues=no=>{const io=Xr.objectKeys(no).filter(ao=>typeof no[no[ao]]!="number"),oo={};for(const ao of io)oo[ao]=no[ao];return Xr.objectValues(oo)},Xr.objectValues=no=>Xr.objectKeys(no).map(function(io){return no[io]}),Xr.objectKeys=typeof Object.keys=="function"?no=>Object.keys(no):no=>{const io=[];for(const oo in no)Object.prototype.hasOwnProperty.call(no,oo)&&io.push(oo);return io},Xr.find=(no,io)=>{for(const oo of no)if(io(oo))return oo},Xr.isInteger=typeof Number.isInteger=="function"?no=>Number.isInteger(no):no=>typeof no=="number"&&isFinite(no)&&Math.floor(no)===no;function ro(no,io=" | "){return no.map(oo=>typeof oo=="string"?`'${oo}'`:oo).join(io)}Xr.joinValues=ro,Xr.jsonStringifyReplacer=(no,io)=>typeof io=="bigint"?io.toString():io})(util$9||(util$9={}));var objectUtil;(function(Xr){Xr.mergeShapes=(eo,to)=>({...eo,...to})})(objectUtil||(objectUtil={}));const ZodParsedType=util$9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=Xr=>{switch(typeof Xr){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(Xr)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(Xr)?ZodParsedType.array:Xr===null?ZodParsedType.null:Xr.then&&typeof Xr.then=="function"&&Xr.catch&&typeof Xr.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&Xr instanceof Map?ZodParsedType.map:typeof Set<"u"&&Xr instanceof Set?ZodParsedType.set:typeof Date<"u"&&Xr instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=Xr=>JSON.stringify(Xr,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(eo){super(),this.issues=[],this.addIssue=ro=>{this.issues=[...this.issues,ro]},this.addIssues=(ro=[])=>{this.issues=[...this.issues,...ro]};const to=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,to):this.__proto__=to,this.name="ZodError",this.issues=eo}get errors(){return this.issues}format(eo){const to=eo||function(io){return io.message},ro={_errors:[]},no=io=>{for(const oo of io.issues)if(oo.code==="invalid_union")oo.unionErrors.map(no);else if(oo.code==="invalid_return_type")no(oo.returnTypeError);else if(oo.code==="invalid_arguments")no(oo.argumentsError);else if(oo.path.length===0)ro._errors.push(to(oo));else{let ao=ro,so=0;for(;soto.message){const to={},ro=[];for(const no of this.issues)no.path.length>0?(to[no.path[0]]=to[no.path[0]]||[],to[no.path[0]].push(eo(no))):ro.push(eo(no));return{formErrors:ro,fieldErrors:to}}get formErrors(){return this.flatten()}}ZodError.create=Xr=>new ZodError(Xr);const errorMap=(Xr,eo)=>{let to;switch(Xr.code){case ZodIssueCode.invalid_type:Xr.received===ZodParsedType.undefined?to="Required":to=`Expected ${Xr.expected}, received ${Xr.received}`;break;case ZodIssueCode.invalid_literal:to=`Invalid literal value, expected ${JSON.stringify(Xr.expected,util$9.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:to=`Unrecognized key(s) in object: ${util$9.joinValues(Xr.keys,", ")}`;break;case ZodIssueCode.invalid_union:to="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:to=`Invalid discriminator value. Expected ${util$9.joinValues(Xr.options)}`;break;case ZodIssueCode.invalid_enum_value:to=`Invalid enum value. Expected ${util$9.joinValues(Xr.options)}, received '${Xr.received}'`;break;case ZodIssueCode.invalid_arguments:to="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:to="Invalid function return type";break;case ZodIssueCode.invalid_date:to="Invalid date";break;case ZodIssueCode.invalid_string:typeof Xr.validation=="object"?"includes"in Xr.validation?(to=`Invalid input: must include "${Xr.validation.includes}"`,typeof Xr.validation.position=="number"&&(to=`${to} at one or more positions greater than or equal to ${Xr.validation.position}`)):"startsWith"in Xr.validation?to=`Invalid input: must start with "${Xr.validation.startsWith}"`:"endsWith"in Xr.validation?to=`Invalid input: must end with "${Xr.validation.endsWith}"`:util$9.assertNever(Xr.validation):Xr.validation!=="regex"?to=`Invalid ${Xr.validation}`:to="Invalid";break;case ZodIssueCode.too_small:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"more than"} ${Xr.minimum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"over"} ${Xr.minimum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${Xr.minimum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(Xr.minimum))}`:to="Invalid input";break;case ZodIssueCode.too_big:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"less than"} ${Xr.maximum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"under"} ${Xr.maximum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="bigint"?to=`BigInt must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly":Xr.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(Xr.maximum))}`:to="Invalid input";break;case ZodIssueCode.custom:to="Invalid input";break;case ZodIssueCode.invalid_intersection_types:to="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:to=`Number must be a multiple of ${Xr.multipleOf}`;break;case ZodIssueCode.not_finite:to="Number must be finite";break;default:to=eo.defaultError,util$9.assertNever(Xr)}return{message:to}};let overrideErrorMap=errorMap;function setErrorMap(Xr){overrideErrorMap=Xr}function getErrorMap(){return overrideErrorMap}const makeIssue=Xr=>{const{data:eo,path:to,errorMaps:ro,issueData:no}=Xr,io=[...to,...no.path||[]],oo={...no,path:io};let ao="";const so=ro.filter(co=>!!co).slice().reverse();for(const co of so)ao=co(oo,{data:eo,defaultError:ao}).message;return{...no,path:io,message:no.message||ao}},EMPTY_PATH=[];function addIssueToContext(Xr,eo){const to=makeIssue({issueData:eo,data:Xr.data,path:Xr.path,errorMaps:[Xr.common.contextualErrorMap,Xr.schemaErrorMap,getErrorMap(),errorMap].filter(ro=>!!ro)});Xr.common.issues.push(to)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(eo,to){const ro=[];for(const no of to){if(no.status==="aborted")return INVALID;no.status==="dirty"&&eo.dirty(),ro.push(no.value)}return{status:eo.value,value:ro}}static async mergeObjectAsync(eo,to){const ro=[];for(const no of to)ro.push({key:await no.key,value:await no.value});return ParseStatus.mergeObjectSync(eo,ro)}static mergeObjectSync(eo,to){const ro={};for(const no of to){const{key:io,value:oo}=no;if(io.status==="aborted"||oo.status==="aborted")return INVALID;io.status==="dirty"&&eo.dirty(),oo.status==="dirty"&&eo.dirty(),io.value!=="__proto__"&&(typeof oo.value<"u"||no.alwaysSet)&&(ro[io.value]=oo.value)}return{status:eo.value,value:ro}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=Xr=>({status:"dirty",value:Xr}),OK=Xr=>({status:"valid",value:Xr}),isAborted=Xr=>Xr.status==="aborted",isDirty=Xr=>Xr.status==="dirty",isValid=Xr=>Xr.status==="valid",isAsync=Xr=>typeof Promise<"u"&&Xr instanceof Promise;var errorUtil;(function(Xr){Xr.errToObj=eo=>typeof eo=="string"?{message:eo}:eo||{},Xr.toString=eo=>typeof eo=="string"?eo:eo==null?void 0:eo.message})(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(eo,to,ro,no){this._cachedPath=[],this.parent=eo,this.data=to,this._path=ro,this._key=no}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(Xr,eo)=>{if(isValid(eo))return{success:!0,data:eo.value};if(!Xr.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const to=new ZodError(Xr.common.issues);return this._error=to,this._error}}};function processCreateParams(Xr){if(!Xr)return{};const{errorMap:eo,invalid_type_error:to,required_error:ro,description:no}=Xr;if(eo&&(to||ro))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return eo?{errorMap:eo,description:no}:{errorMap:(oo,ao)=>oo.code!=="invalid_type"?{message:ao.defaultError}:typeof ao.data>"u"?{message:ro??ao.defaultError}:{message:to??ao.defaultError},description:no}}class ZodType{constructor(eo){this.spa=this.safeParseAsync,this._def=eo,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(eo){return getParsedType(eo.data)}_getOrReturnCtx(eo,to){return to||{common:eo.parent.common,data:eo.data,parsedType:getParsedType(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}_processInputParams(eo){return{status:new ParseStatus,ctx:{common:eo.parent.common,data:eo.data,parsedType:getParsedType(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}}_parseSync(eo){const to=this._parse(eo);if(isAsync(to))throw new Error("Synchronous parse encountered promise.");return to}_parseAsync(eo){const to=this._parse(eo);return Promise.resolve(to)}parse(eo,to){const ro=this.safeParse(eo,to);if(ro.success)return ro.data;throw ro.error}safeParse(eo,to){var ro;const no={common:{issues:[],async:(ro=to==null?void 0:to.async)!==null&&ro!==void 0?ro:!1,contextualErrorMap:to==null?void 0:to.errorMap},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:getParsedType(eo)},io=this._parseSync({data:eo,path:no.path,parent:no});return handleResult(no,io)}async parseAsync(eo,to){const ro=await this.safeParseAsync(eo,to);if(ro.success)return ro.data;throw ro.error}async safeParseAsync(eo,to){const ro={common:{issues:[],contextualErrorMap:to==null?void 0:to.errorMap,async:!0},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:getParsedType(eo)},no=this._parse({data:eo,path:ro.path,parent:ro}),io=await(isAsync(no)?no:Promise.resolve(no));return handleResult(ro,io)}refine(eo,to){const ro=no=>typeof to=="string"||typeof to>"u"?{message:to}:typeof to=="function"?to(no):to;return this._refinement((no,io)=>{const oo=eo(no),ao=()=>io.addIssue({code:ZodIssueCode.custom,...ro(no)});return typeof Promise<"u"&&oo instanceof Promise?oo.then(so=>so?!0:(ao(),!1)):oo?!0:(ao(),!1)})}refinement(eo,to){return this._refinement((ro,no)=>eo(ro)?!0:(no.addIssue(typeof to=="function"?to(ro,no):to),!1))}_refinement(eo){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:eo}})}superRefine(eo){return this._refinement(eo)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(eo){return ZodUnion.create([this,eo],this._def)}and(eo){return ZodIntersection.create(this,eo,this._def)}transform(eo){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:eo}})}default(eo){const to=typeof eo=="function"?eo:()=>eo;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:to,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(eo){const to=typeof eo=="function"?eo:()=>eo;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:to,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(eo){const to=this.constructor;return new to({...this._def,description:eo})}pipe(eo){return ZodPipeline.create(this,eo)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[a-z][a-z0-9]*$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,datetimeRegex=Xr=>Xr.precision?Xr.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}Z$`):Xr.precision===0?Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function isValidIP(Xr,eo){return!!((eo==="v4"||!eo)&&ipv4Regex.test(Xr)||(eo==="v6"||!eo)&&ipv6Regex.test(Xr))}class ZodString extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=String(eo.data)),this._getType(eo)!==ZodParsedType.string){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:io.parsedType}),INVALID}const ro=new ParseStatus;let no;for(const io of this._def.checks)if(io.kind==="min")eo.data.lengthio.value&&(no=this._getOrReturnCtx(eo,no),addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:io.value,type:"string",inclusive:!0,exact:!1,message:io.message}),ro.dirty());else if(io.kind==="length"){const oo=eo.data.length>io.value,ao=eo.data.lengtheo.test(no),{validation:to,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(ro)})}_addCheck(eo){return new ZodString({...this._def,checks:[...this._def.checks,eo]})}email(eo){return this._addCheck({kind:"email",...errorUtil.errToObj(eo)})}url(eo){return this._addCheck({kind:"url",...errorUtil.errToObj(eo)})}emoji(eo){return this._addCheck({kind:"emoji",...errorUtil.errToObj(eo)})}uuid(eo){return this._addCheck({kind:"uuid",...errorUtil.errToObj(eo)})}cuid(eo){return this._addCheck({kind:"cuid",...errorUtil.errToObj(eo)})}cuid2(eo){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(eo)})}ulid(eo){return this._addCheck({kind:"ulid",...errorUtil.errToObj(eo)})}ip(eo){return this._addCheck({kind:"ip",...errorUtil.errToObj(eo)})}datetime(eo){var to;return typeof eo=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:eo}):this._addCheck({kind:"datetime",precision:typeof(eo==null?void 0:eo.precision)>"u"?null:eo==null?void 0:eo.precision,offset:(to=eo==null?void 0:eo.offset)!==null&&to!==void 0?to:!1,...errorUtil.errToObj(eo==null?void 0:eo.message)})}regex(eo,to){return this._addCheck({kind:"regex",regex:eo,...errorUtil.errToObj(to)})}includes(eo,to){return this._addCheck({kind:"includes",value:eo,position:to==null?void 0:to.position,...errorUtil.errToObj(to==null?void 0:to.message)})}startsWith(eo,to){return this._addCheck({kind:"startsWith",value:eo,...errorUtil.errToObj(to)})}endsWith(eo,to){return this._addCheck({kind:"endsWith",value:eo,...errorUtil.errToObj(to)})}min(eo,to){return this._addCheck({kind:"min",value:eo,...errorUtil.errToObj(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo,...errorUtil.errToObj(to)})}length(eo,to){return this._addCheck({kind:"length",value:eo,...errorUtil.errToObj(to)})}nonempty(eo){return this.min(1,errorUtil.errToObj(eo))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(eo=>eo.kind==="datetime")}get isEmail(){return!!this._def.checks.find(eo=>eo.kind==="email")}get isURL(){return!!this._def.checks.find(eo=>eo.kind==="url")}get isEmoji(){return!!this._def.checks.find(eo=>eo.kind==="emoji")}get isUUID(){return!!this._def.checks.find(eo=>eo.kind==="uuid")}get isCUID(){return!!this._def.checks.find(eo=>eo.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(eo=>eo.kind==="cuid2")}get isULID(){return!!this._def.checks.find(eo=>eo.kind==="ulid")}get isIP(){return!!this._def.checks.find(eo=>eo.kind==="ip")}get minLength(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxLength(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...processCreateParams(Xr)})};function floatSafeRemainder(Xr,eo){const to=(Xr.toString().split(".")[1]||"").length,ro=(eo.toString().split(".")[1]||"").length,no=to>ro?to:ro,io=parseInt(Xr.toFixed(no).replace(".","")),oo=parseInt(eo.toFixed(no).replace(".",""));return io%oo/Math.pow(10,no)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(eo){if(this._def.coerce&&(eo.data=Number(eo.data)),this._getType(eo)!==ZodParsedType.number){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:io.parsedType}),INVALID}let ro;const no=new ParseStatus;for(const io of this._def.checks)io.kind==="int"?util$9.isInteger(eo.data)||(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:io.message}),no.dirty()):io.kind==="min"?(io.inclusive?eo.dataio.value:eo.data>=io.value)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:io.value,type:"number",inclusive:io.inclusive,exact:!1,message:io.message}),no.dirty()):io.kind==="multipleOf"?floatSafeRemainder(eo.data,io.value)!==0&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_multiple_of,multipleOf:io.value,message:io.message}),no.dirty()):io.kind==="finite"?Number.isFinite(eo.data)||(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_finite,message:io.message}),no.dirty()):util$9.assertNever(io);return{status:no.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,errorUtil.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,errorUtil.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,errorUtil.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,errorUtil.toString(to))}setLimit(eo,to,ro,no){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:errorUtil.toString(no)}]})}_addCheck(eo){return new ZodNumber({...this._def,checks:[...this._def.checks,eo]})}int(eo){return this._addCheck({kind:"int",message:errorUtil.toString(eo)})}positive(eo){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:errorUtil.toString(to)})}finite(eo){return this._addCheck({kind:"finite",message:errorUtil.toString(eo)})}safe(eo){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(eo)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(eo)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valueeo.kind==="int"||eo.kind==="multipleOf"&&util$9.isInteger(eo.value))}get isFinite(){let eo=null,to=null;for(const ro of this._def.checks){if(ro.kind==="finite"||ro.kind==="int"||ro.kind==="multipleOf")return!0;ro.kind==="min"?(to===null||ro.value>to)&&(to=ro.value):ro.kind==="max"&&(eo===null||ro.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(Xr==null?void 0:Xr.coerce)||!1,...processCreateParams(Xr)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(eo){if(this._def.coerce&&(eo.data=BigInt(eo.data)),this._getType(eo)!==ZodParsedType.bigint){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:io.parsedType}),INVALID}let ro;const no=new ParseStatus;for(const io of this._def.checks)io.kind==="min"?(io.inclusive?eo.dataio.value:eo.data>=io.value)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,type:"bigint",maximum:io.value,inclusive:io.inclusive,message:io.message}),no.dirty()):io.kind==="multipleOf"?eo.data%io.value!==BigInt(0)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_multiple_of,multipleOf:io.value,message:io.message}),no.dirty()):util$9.assertNever(io);return{status:no.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,errorUtil.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,errorUtil.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,errorUtil.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,errorUtil.toString(to))}setLimit(eo,to,ro,no){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:errorUtil.toString(no)}]})}_addCheck(eo){return new ZodBigInt({...this._def,checks:[...this._def.checks,eo]})}positive(eo){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:errorUtil.toString(to)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...processCreateParams(Xr)})};class ZodBoolean extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=!!eo.data),this._getType(eo)!==ZodParsedType.boolean){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodBoolean.create=Xr=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(Xr==null?void 0:Xr.coerce)||!1,...processCreateParams(Xr)});class ZodDate extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=new Date(eo.data)),this._getType(eo)!==ZodParsedType.date){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:io.parsedType}),INVALID}if(isNaN(eo.data.getTime())){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_date}),INVALID}const ro=new ParseStatus;let no;for(const io of this._def.checks)io.kind==="min"?eo.data.getTime()io.value&&(no=this._getOrReturnCtx(eo,no),addIssueToContext(no,{code:ZodIssueCode.too_big,message:io.message,inclusive:!0,exact:!1,maximum:io.value,type:"date"}),ro.dirty()):util$9.assertNever(io);return{status:ro.value,value:new Date(eo.data.getTime())}}_addCheck(eo){return new ZodDate({...this._def,checks:[...this._def.checks,eo]})}min(eo,to){return this._addCheck({kind:"min",value:eo.getTime(),message:errorUtil.toString(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo.getTime(),message:errorUtil.toString(to)})}get minDate(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo!=null?new Date(eo):null}get maxDate(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valuenew ZodDate({checks:[],coerce:(Xr==null?void 0:Xr.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(Xr)});class ZodSymbol extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.symbol){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodSymbol.create=Xr=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(Xr)});class ZodUndefined extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.undefined){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodUndefined.create=Xr=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(Xr)});class ZodNull extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.null){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodNull.create=Xr=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(Xr)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(eo){return OK(eo.data)}}ZodAny.create=Xr=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(Xr)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(eo){return OK(eo.data)}}ZodUnknown.create=Xr=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(Xr)});class ZodNever extends ZodType{_parse(eo){const to=this._getOrReturnCtx(eo);return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:to.parsedType}),INVALID}}ZodNever.create=Xr=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(Xr)});class ZodVoid extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.undefined){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodVoid.create=Xr=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(Xr)});class ZodArray extends ZodType{_parse(eo){const{ctx:to,status:ro}=this._processInputParams(eo),no=this._def;if(to.parsedType!==ZodParsedType.array)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:to.parsedType}),INVALID;if(no.exactLength!==null){const oo=to.data.length>no.exactLength.value,ao=to.data.lengthno.maxLength.value&&(addIssueToContext(to,{code:ZodIssueCode.too_big,maximum:no.maxLength.value,type:"array",inclusive:!0,exact:!1,message:no.maxLength.message}),ro.dirty()),to.common.async)return Promise.all([...to.data].map((oo,ao)=>no.type._parseAsync(new ParseInputLazyPath(to,oo,to.path,ao)))).then(oo=>ParseStatus.mergeArray(ro,oo));const io=[...to.data].map((oo,ao)=>no.type._parseSync(new ParseInputLazyPath(to,oo,to.path,ao)));return ParseStatus.mergeArray(ro,io)}get element(){return this._def.type}min(eo,to){return new ZodArray({...this._def,minLength:{value:eo,message:errorUtil.toString(to)}})}max(eo,to){return new ZodArray({...this._def,maxLength:{value:eo,message:errorUtil.toString(to)}})}length(eo,to){return new ZodArray({...this._def,exactLength:{value:eo,message:errorUtil.toString(to)}})}nonempty(eo){return this.min(1,eo)}}ZodArray.create=(Xr,eo)=>new ZodArray({type:Xr,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(eo)});function deepPartialify(Xr){if(Xr instanceof ZodObject){const eo={};for(const to in Xr.shape){const ro=Xr.shape[to];eo[to]=ZodOptional.create(deepPartialify(ro))}return new ZodObject({...Xr._def,shape:()=>eo})}else return Xr instanceof ZodArray?new ZodArray({...Xr._def,type:deepPartialify(Xr.element)}):Xr instanceof ZodOptional?ZodOptional.create(deepPartialify(Xr.unwrap())):Xr instanceof ZodNullable?ZodNullable.create(deepPartialify(Xr.unwrap())):Xr instanceof ZodTuple?ZodTuple.create(Xr.items.map(eo=>deepPartialify(eo))):Xr}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const eo=this._def.shape(),to=util$9.objectKeys(eo);return this._cached={shape:eo,keys:to}}_parse(eo){if(this._getType(eo)!==ZodParsedType.object){const co=this._getOrReturnCtx(eo);return addIssueToContext(co,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:co.parsedType}),INVALID}const{status:ro,ctx:no}=this._processInputParams(eo),{shape:io,keys:oo}=this._getCached(),ao=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const co in no.data)oo.includes(co)||ao.push(co);const so=[];for(const co of oo){const lo=io[co],fo=no.data[co];so.push({key:{status:"valid",value:co},value:lo._parse(new ParseInputLazyPath(no,fo,no.path,co)),alwaysSet:co in no.data})}if(this._def.catchall instanceof ZodNever){const co=this._def.unknownKeys;if(co==="passthrough")for(const lo of ao)so.push({key:{status:"valid",value:lo},value:{status:"valid",value:no.data[lo]}});else if(co==="strict")ao.length>0&&(addIssueToContext(no,{code:ZodIssueCode.unrecognized_keys,keys:ao}),ro.dirty());else if(co!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const co=this._def.catchall;for(const lo of ao){const fo=no.data[lo];so.push({key:{status:"valid",value:lo},value:co._parse(new ParseInputLazyPath(no,fo,no.path,lo)),alwaysSet:lo in no.data})}}return no.common.async?Promise.resolve().then(async()=>{const co=[];for(const lo of so){const fo=await lo.key;co.push({key:fo,value:await lo.value,alwaysSet:lo.alwaysSet})}return co}).then(co=>ParseStatus.mergeObjectSync(ro,co)):ParseStatus.mergeObjectSync(ro,so)}get shape(){return this._def.shape()}strict(eo){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...eo!==void 0?{errorMap:(to,ro)=>{var no,io,oo,ao;const so=(oo=(io=(no=this._def).errorMap)===null||io===void 0?void 0:io.call(no,to,ro).message)!==null&&oo!==void 0?oo:ro.defaultError;return to.code==="unrecognized_keys"?{message:(ao=errorUtil.errToObj(eo).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(eo){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...eo})})}merge(eo){return new ZodObject({unknownKeys:eo._def.unknownKeys,catchall:eo._def.catchall,shape:()=>({...this._def.shape(),...eo._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(eo,to){return this.augment({[eo]:to})}catchall(eo){return new ZodObject({...this._def,catchall:eo})}pick(eo){const to={};return util$9.objectKeys(eo).forEach(ro=>{eo[ro]&&this.shape[ro]&&(to[ro]=this.shape[ro])}),new ZodObject({...this._def,shape:()=>to})}omit(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{eo[ro]||(to[ro]=this.shape[ro])}),new ZodObject({...this._def,shape:()=>to})}deepPartial(){return deepPartialify(this)}partial(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{const no=this.shape[ro];eo&&!eo[ro]?to[ro]=no:to[ro]=no.optional()}),new ZodObject({...this._def,shape:()=>to})}required(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{if(eo&&!eo[ro])to[ro]=this.shape[ro];else{let io=this.shape[ro];for(;io instanceof ZodOptional;)io=io._def.innerType;to[ro]=io}}),new ZodObject({...this._def,shape:()=>to})}keyof(){return createZodEnum(util$9.objectKeys(this.shape))}}ZodObject.create=(Xr,eo)=>new ZodObject({shape:()=>Xr,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});ZodObject.strictCreate=(Xr,eo)=>new ZodObject({shape:()=>Xr,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});ZodObject.lazycreate=(Xr,eo)=>new ZodObject({shape:Xr,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});class ZodUnion extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.options;function no(io){for(const ao of io)if(ao.result.status==="valid")return ao.result;for(const ao of io)if(ao.result.status==="dirty")return to.common.issues.push(...ao.ctx.common.issues),ao.result;const oo=io.map(ao=>new ZodError(ao.ctx.common.issues));return addIssueToContext(to,{code:ZodIssueCode.invalid_union,unionErrors:oo}),INVALID}if(to.common.async)return Promise.all(ro.map(async io=>{const oo={...to,common:{...to.common,issues:[]},parent:null};return{result:await io._parseAsync({data:to.data,path:to.path,parent:oo}),ctx:oo}})).then(no);{let io;const oo=[];for(const so of ro){const co={...to,common:{...to.common,issues:[]},parent:null},lo=so._parseSync({data:to.data,path:to.path,parent:co});if(lo.status==="valid")return lo;lo.status==="dirty"&&!io&&(io={result:lo,ctx:co}),co.common.issues.length&&oo.push(co.common.issues)}if(io)return to.common.issues.push(...io.ctx.common.issues),io.result;const ao=oo.map(so=>new ZodError(so));return addIssueToContext(to,{code:ZodIssueCode.invalid_union,unionErrors:ao}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(Xr,eo)=>new ZodUnion({options:Xr,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(eo)});const getDiscriminator=Xr=>Xr instanceof ZodLazy?getDiscriminator(Xr.schema):Xr instanceof ZodEffects?getDiscriminator(Xr.innerType()):Xr instanceof ZodLiteral?[Xr.value]:Xr instanceof ZodEnum?Xr.options:Xr instanceof ZodNativeEnum?Object.keys(Xr.enum):Xr instanceof ZodDefault?getDiscriminator(Xr._def.innerType):Xr instanceof ZodUndefined?[void 0]:Xr instanceof ZodNull?[null]:null;class ZodDiscriminatedUnion extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.object)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:to.parsedType}),INVALID;const ro=this.discriminator,no=to.data[ro],io=this.optionsMap.get(no);return io?to.common.async?io._parseAsync({data:to.data,path:to.path,parent:to}):io._parseSync({data:to.data,path:to.path,parent:to}):(addIssueToContext(to,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ro]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(eo,to,ro){const no=new Map;for(const io of to){const oo=getDiscriminator(io.shape[eo]);if(!oo)throw new Error(`A discriminator value for key \`${eo}\` could not be extracted from all schema options`);for(const ao of oo){if(no.has(ao))throw new Error(`Discriminator property ${String(eo)} has duplicate value ${String(ao)}`);no.set(ao,io)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:eo,options:to,optionsMap:no,...processCreateParams(ro)})}}function mergeValues(Xr,eo){const to=getParsedType(Xr),ro=getParsedType(eo);if(Xr===eo)return{valid:!0,data:Xr};if(to===ZodParsedType.object&&ro===ZodParsedType.object){const no=util$9.objectKeys(eo),io=util$9.objectKeys(Xr).filter(ao=>no.indexOf(ao)!==-1),oo={...Xr,...eo};for(const ao of io){const so=mergeValues(Xr[ao],eo[ao]);if(!so.valid)return{valid:!1};oo[ao]=so.data}return{valid:!0,data:oo}}else if(to===ZodParsedType.array&&ro===ZodParsedType.array){if(Xr.length!==eo.length)return{valid:!1};const no=[];for(let io=0;io{if(isAborted(io)||isAborted(oo))return INVALID;const ao=mergeValues(io.value,oo.value);return ao.valid?((isDirty(io)||isDirty(oo))&&to.dirty(),{status:to.value,value:ao.data}):(addIssueToContext(ro,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return ro.common.async?Promise.all([this._def.left._parseAsync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseAsync({data:ro.data,path:ro.path,parent:ro})]).then(([io,oo])=>no(io,oo)):no(this._def.left._parseSync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseSync({data:ro.data,path:ro.path,parent:ro}))}}ZodIntersection.create=(Xr,eo,to)=>new ZodIntersection({left:Xr,right:eo,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(to)});class ZodTuple extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.array)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ro.parsedType}),INVALID;if(ro.data.lengththis._def.items.length&&(addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),to.dirty());const io=[...ro.data].map((oo,ao)=>{const so=this._def.items[ao]||this._def.rest;return so?so._parse(new ParseInputLazyPath(ro,oo,ro.path,ao)):null}).filter(oo=>!!oo);return ro.common.async?Promise.all(io).then(oo=>ParseStatus.mergeArray(to,oo)):ParseStatus.mergeArray(to,io)}get items(){return this._def.items}rest(eo){return new ZodTuple({...this._def,rest:eo})}}ZodTuple.create=(Xr,eo)=>{if(!Array.isArray(Xr))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:Xr,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(eo)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.object)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ro.parsedType}),INVALID;const no=[],io=this._def.keyType,oo=this._def.valueType;for(const ao in ro.data)no.push({key:io._parse(new ParseInputLazyPath(ro,ao,ro.path,ao)),value:oo._parse(new ParseInputLazyPath(ro,ro.data[ao],ro.path,ao))});return ro.common.async?ParseStatus.mergeObjectAsync(to,no):ParseStatus.mergeObjectSync(to,no)}get element(){return this._def.valueType}static create(eo,to,ro){return to instanceof ZodType?new ZodRecord({keyType:eo,valueType:to,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ro)}):new ZodRecord({keyType:ZodString.create(),valueType:eo,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(to)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.map)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:ro.parsedType}),INVALID;const no=this._def.keyType,io=this._def.valueType,oo=[...ro.data.entries()].map(([ao,so],co)=>({key:no._parse(new ParseInputLazyPath(ro,ao,ro.path,[co,"key"])),value:io._parse(new ParseInputLazyPath(ro,so,ro.path,[co,"value"]))}));if(ro.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of oo){const co=await so.key,lo=await so.value;if(co.status==="aborted"||lo.status==="aborted")return INVALID;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}})}else{const ao=new Map;for(const so of oo){const co=so.key,lo=so.value;if(co.status==="aborted"||lo.status==="aborted")return INVALID;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}}}}ZodMap.create=(Xr,eo,to)=>new ZodMap({valueType:eo,keyType:Xr,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(to)});class ZodSet extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.set)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:ro.parsedType}),INVALID;const no=this._def;no.minSize!==null&&ro.data.sizeno.maxSize.value&&(addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:no.maxSize.value,type:"set",inclusive:!0,exact:!1,message:no.maxSize.message}),to.dirty());const io=this._def.valueType;function oo(so){const co=new Set;for(const lo of so){if(lo.status==="aborted")return INVALID;lo.status==="dirty"&&to.dirty(),co.add(lo.value)}return{status:to.value,value:co}}const ao=[...ro.data.values()].map((so,co)=>io._parse(new ParseInputLazyPath(ro,so,ro.path,co)));return ro.common.async?Promise.all(ao).then(so=>oo(so)):oo(ao)}min(eo,to){return new ZodSet({...this._def,minSize:{value:eo,message:errorUtil.toString(to)}})}max(eo,to){return new ZodSet({...this._def,maxSize:{value:eo,message:errorUtil.toString(to)}})}size(eo,to){return this.min(eo,to).max(eo,to)}nonempty(eo){return this.min(1,eo)}}ZodSet.create=(Xr,eo)=>new ZodSet({valueType:Xr,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(eo)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.function)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:to.parsedType}),INVALID;function ro(ao,so){return makeIssue({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,getErrorMap(),errorMap].filter(co=>!!co),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:so}})}function no(ao,so){return makeIssue({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,getErrorMap(),errorMap].filter(co=>!!co),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:so}})}const io={errorMap:to.common.contextualErrorMap},oo=to.data;if(this._def.returns instanceof ZodPromise){const ao=this;return OK(async function(...so){const co=new ZodError([]),lo=await ao._def.args.parseAsync(so,io).catch(go=>{throw co.addIssue(ro(so,go)),co}),fo=await Reflect.apply(oo,this,lo);return await ao._def.returns._def.type.parseAsync(fo,io).catch(go=>{throw co.addIssue(no(fo,go)),co})})}else{const ao=this;return OK(function(...so){const co=ao._def.args.safeParse(so,io);if(!co.success)throw new ZodError([ro(so,co.error)]);const lo=Reflect.apply(oo,this,co.data),fo=ao._def.returns.safeParse(lo,io);if(!fo.success)throw new ZodError([no(lo,fo.error)]);return fo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...eo){return new ZodFunction({...this._def,args:ZodTuple.create(eo).rest(ZodUnknown.create())})}returns(eo){return new ZodFunction({...this._def,returns:eo})}implement(eo){return this.parse(eo)}strictImplement(eo){return this.parse(eo)}static create(eo,to,ro){return new ZodFunction({args:eo||ZodTuple.create([]).rest(ZodUnknown.create()),returns:to||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(ro)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(eo){const{ctx:to}=this._processInputParams(eo);return this._def.getter()._parse({data:to.data,path:to.path,parent:to})}}ZodLazy.create=(Xr,eo)=>new ZodLazy({getter:Xr,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(eo)});class ZodLiteral extends ZodType{_parse(eo){if(eo.data!==this._def.value){const to=this._getOrReturnCtx(eo);return addIssueToContext(to,{received:to.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:eo.data}}get value(){return this._def.value}}ZodLiteral.create=(Xr,eo)=>new ZodLiteral({value:Xr,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(eo)});function createZodEnum(Xr,eo){return new ZodEnum({values:Xr,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(eo)})}class ZodEnum extends ZodType{_parse(eo){if(typeof eo.data!="string"){const to=this._getOrReturnCtx(eo),ro=this._def.values;return addIssueToContext(to,{expected:util$9.joinValues(ro),received:to.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._def.values.indexOf(eo.data)===-1){const to=this._getOrReturnCtx(eo),ro=this._def.values;return addIssueToContext(to,{received:to.data,code:ZodIssueCode.invalid_enum_value,options:ro}),INVALID}return OK(eo.data)}get options(){return this._def.values}get enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Values(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}extract(eo){return ZodEnum.create(eo)}exclude(eo){return ZodEnum.create(this.options.filter(to=>!eo.includes(to)))}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(eo){const to=util$9.getValidEnumValues(this._def.values),ro=this._getOrReturnCtx(eo);if(ro.parsedType!==ZodParsedType.string&&ro.parsedType!==ZodParsedType.number){const no=util$9.objectValues(to);return addIssueToContext(ro,{expected:util$9.joinValues(no),received:ro.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(to.indexOf(eo.data)===-1){const no=util$9.objectValues(to);return addIssueToContext(ro,{received:ro.data,code:ZodIssueCode.invalid_enum_value,options:no}),INVALID}return OK(eo.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(Xr,eo)=>new ZodNativeEnum({values:Xr,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(eo)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.promise&&to.common.async===!1)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:to.parsedType}),INVALID;const ro=to.parsedType===ZodParsedType.promise?to.data:Promise.resolve(to.data);return OK(ro.then(no=>this._def.type.parseAsync(no,{path:to.path,errorMap:to.common.contextualErrorMap})))}}ZodPromise.create=(Xr,eo)=>new ZodPromise({type:Xr,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(eo)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo),no=this._def.effect||null,io={addIssue:oo=>{addIssueToContext(ro,oo),oo.fatal?to.abort():to.dirty()},get path(){return ro.path}};if(io.addIssue=io.addIssue.bind(io),no.type==="preprocess"){const oo=no.transform(ro.data,io);return ro.common.issues.length?{status:"dirty",value:ro.data}:ro.common.async?Promise.resolve(oo).then(ao=>this._def.schema._parseAsync({data:ao,path:ro.path,parent:ro})):this._def.schema._parseSync({data:oo,path:ro.path,parent:ro})}if(no.type==="refinement"){const oo=ao=>{const so=no.refinement(ao,io);if(ro.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(ro.common.async===!1){const ao=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});return ao.status==="aborted"?INVALID:(ao.status==="dirty"&&to.dirty(),oo(ao.value),{status:to.value,value:ao.value})}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(ao=>ao.status==="aborted"?INVALID:(ao.status==="dirty"&&to.dirty(),oo(ao.value).then(()=>({status:to.value,value:ao.value}))))}if(no.type==="transform")if(ro.common.async===!1){const oo=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});if(!isValid(oo))return oo;const ao=no.transform(oo.value,io);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:to.value,value:ao}}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(oo=>isValid(oo)?Promise.resolve(no.transform(oo.value,io)).then(ao=>({status:to.value,value:ao})):oo);util$9.assertNever(no)}}ZodEffects.create=(Xr,eo,to)=>new ZodEffects({schema:Xr,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:eo,...processCreateParams(to)});ZodEffects.createWithPreprocess=(Xr,eo,to)=>new ZodEffects({schema:eo,effect:{type:"preprocess",transform:Xr},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(to)});class ZodOptional extends ZodType{_parse(eo){return this._getType(eo)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}}ZodOptional.create=(Xr,eo)=>new ZodOptional({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(eo)});class ZodNullable extends ZodType{_parse(eo){return this._getType(eo)===ZodParsedType.null?OK(null):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}}ZodNullable.create=(Xr,eo)=>new ZodNullable({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(eo)});class ZodDefault extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo);let ro=to.data;return to.parsedType===ZodParsedType.undefined&&(ro=this._def.defaultValue()),this._def.innerType._parse({data:ro,path:to.path,parent:to})}removeDefault(){return this._def.innerType}}ZodDefault.create=(Xr,eo)=>new ZodDefault({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof eo.default=="function"?eo.default:()=>eo.default,...processCreateParams(eo)});class ZodCatch extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro={...to,common:{...to.common,issues:[]}},no=this._def.innerType._parse({data:ro.data,path:ro.path,parent:{...ro}});return isAsync(no)?no.then(io=>({status:"valid",value:io.status==="valid"?io.value:this._def.catchValue({get error(){return new ZodError(ro.common.issues)},input:ro.data})})):{status:"valid",value:no.status==="valid"?no.value:this._def.catchValue({get error(){return new ZodError(ro.common.issues)},input:ro.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(Xr,eo)=>new ZodCatch({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof eo.catch=="function"?eo.catch:()=>eo.catch,...processCreateParams(eo)});class ZodNaN extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.nan){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:ro.parsedType}),INVALID}return{status:"valid",value:eo.data}}}ZodNaN.create=Xr=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(Xr)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=to.data;return this._def.type._parse({data:ro,path:to.path,parent:to})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.common.async)return(async()=>{const io=await this._def.in._parseAsync({data:ro.data,path:ro.path,parent:ro});return io.status==="aborted"?INVALID:io.status==="dirty"?(to.dirty(),DIRTY(io.value)):this._def.out._parseAsync({data:io.value,path:ro.path,parent:ro})})();{const no=this._def.in._parseSync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?INVALID:no.status==="dirty"?(to.dirty(),{status:"dirty",value:no.value}):this._def.out._parseSync({data:no.value,path:ro.path,parent:ro})}}static create(eo,to){return new ZodPipeline({in:eo,out:to,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(eo){const to=this._def.innerType._parse(eo);return isValid(to)&&(to.value=Object.freeze(to.value)),to}}ZodReadonly.create=(Xr,eo)=>new ZodReadonly({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(eo)});const custom=(Xr,eo={},to)=>Xr?ZodAny.create().superRefine((ro,no)=>{var io,oo;if(!Xr(ro)){const ao=typeof eo=="function"?eo(ro):typeof eo=="string"?{message:eo}:eo,so=(oo=(io=ao.fatal)!==null&&io!==void 0?io:to)!==null&&oo!==void 0?oo:!0,co=typeof ao=="string"?{message:ao}:ao;no.addIssue({code:"custom",...co,fatal:so})}}):ZodAny.create(),late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(Xr){Xr.ZodString="ZodString",Xr.ZodNumber="ZodNumber",Xr.ZodNaN="ZodNaN",Xr.ZodBigInt="ZodBigInt",Xr.ZodBoolean="ZodBoolean",Xr.ZodDate="ZodDate",Xr.ZodSymbol="ZodSymbol",Xr.ZodUndefined="ZodUndefined",Xr.ZodNull="ZodNull",Xr.ZodAny="ZodAny",Xr.ZodUnknown="ZodUnknown",Xr.ZodNever="ZodNever",Xr.ZodVoid="ZodVoid",Xr.ZodArray="ZodArray",Xr.ZodObject="ZodObject",Xr.ZodUnion="ZodUnion",Xr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Xr.ZodIntersection="ZodIntersection",Xr.ZodTuple="ZodTuple",Xr.ZodRecord="ZodRecord",Xr.ZodMap="ZodMap",Xr.ZodSet="ZodSet",Xr.ZodFunction="ZodFunction",Xr.ZodLazy="ZodLazy",Xr.ZodLiteral="ZodLiteral",Xr.ZodEnum="ZodEnum",Xr.ZodEffects="ZodEffects",Xr.ZodNativeEnum="ZodNativeEnum",Xr.ZodOptional="ZodOptional",Xr.ZodNullable="ZodNullable",Xr.ZodDefault="ZodDefault",Xr.ZodCatch="ZodCatch",Xr.ZodPromise="ZodPromise",Xr.ZodBranded="ZodBranded",Xr.ZodPipeline="ZodPipeline",Xr.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(Xr,eo={message:`Input not instance of ${Xr.name}`})=>custom(to=>to instanceof Xr,eo),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$4={string:Xr=>ZodString.create({...Xr,coerce:!0}),number:Xr=>ZodNumber.create({...Xr,coerce:!0}),boolean:Xr=>ZodBoolean.create({...Xr,coerce:!0}),bigint:Xr=>ZodBigInt.create({...Xr,coerce:!0}),date:Xr=>ZodDate.create({...Xr,coerce:!0})},NEVER=INVALID;var z$a=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return util$9},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$4,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError});const walletConnectSourceValueSchema$1=z$a.object({app:z$a.object({android:z$a.string().nullable(),browser:z$a.string().nullable(),chrome:z$a.string().nullable(),edge:z$a.string().nullable(),firefox:z$a.string().nullable(),ios:z$a.string().nullable(),linux:z$a.string().nullable(),mac:z$a.string().nullable(),opera:z$a.string().nullable(),safari:z$a.string().nullable(),windows:z$a.string().nullable()}),app_type:z$a.string(),category:z$a.string().nullable(),chains:z$a.array(z$a.string()),description:z$a.string().nullable(),desktop:z$a.object({native:z$a.string().nullable(),universal:z$a.string().nullable()}),homepage:z$a.string(),id:z$a.string(),image_id:z$a.string(),image_url:z$a.object({lg:z$a.string(),md:z$a.string(),sm:z$a.string()}),injected:z$a.array(z$a.object({injected_id:z$a.string(),namespace:z$a.string()})).nullable(),metadata:z$a.object({colors:z$a.object({primary:z$a.string().nullable(),secondary:z$a.string().nullable()}),shortName:z$a.string().nullable()}),mobile:z$a.object({native:z$a.string().nullable(),universal:z$a.string().nullable()}),name:z$a.string(),rdns:z$a.string().nullable(),sdks:z$a.array(z$a.string()),slug:z$a.string(),supported_standards:z$a.array(z$a.object({id:z$a.string(),standard_id:z$a.number(),standard_prefix:z$a.string(),title:z$a.string(),url:z$a.string()})).optional(),updatedAt:z$a.string(),versions:z$a.array(z$a.string())}).strict();z$a.record(z$a.string(),walletConnectSourceValueSchema$1);const nonEmptyString$1=z$a.preprocess(Xr=>Xr||void 0,z$a.string().optional()),transformChromeExtensionId$1=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("chrome.google.com/webstore/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId$1=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId$1=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr!=null&&Xr.includes("addons.mozilla.org"))try{return new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex$1=/^id[0-9]{1,36}$/,transformIosId$1=Xr=>{if(Xr!=null&&Xr.match(idRegex$1))return Xr;if(Xr!=null&&Xr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const to=new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1);if(to!=null&&to.match(idRegex$1))return to}catch{}},transformAndroidId$1=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr)try{const to=new URL(Xr).searchParams.get("id");if(to)return to}catch{}},nonEmptyStringArray$1=z$a.preprocess(Xr=>Array.isArray(Xr)&&Xr.length>0?Xr:void 0,z$a.array(z$a.string()).optional()),filterEmptyObject$1=Xr=>Xr&&Object.values(Xr).some(eo=>!!eo)?Xr:void 0,injectedConfigSchema$1=z$a.object({chain:z$a.string(),extensionLocators:z$a.array(z$a.object({flag:z$a.string(),value:z$a.boolean().optional().default(!0)})),providerInterface:z$a.string().optional(),walletStandard:z$a.object({features:z$a.array(z$a.string()),name:z$a.string(),providerId:z$a.string().optional()}).optional(),walletStandardLocators:z$a.array(z$a.object({locator:z$a.string(),name:z$a.string()})).optional(),windowLocations:z$a.array(z$a.string()).optional().refine(Xr=>!Xr||!Xr.some(eo=>["ethereum","ethereum.providers"].includes(eo)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema$1=z$a.object({alt:nonEmptyString$1,primaryColor:nonEmptyString$1,spriteId:nonEmptyString$1}),walletSchema$1=z$a.preprocess(Xr=>Xr,z$a.object({brand:brandSchema$1.optional(),chainGroup:z$a.string().optional(),chains:z$a.array(z$a.string()).optional(),desktop:z$a.object({chromeId:nonEmptyString$1.transform(transformChromeExtensionId$1),edgeId:nonEmptyString$1.transform(transformEdgeExtensionId$1),firefoxId:nonEmptyString$1.transform(transformFirefoxExtensionId$1),native:nonEmptyString$1,operaId:nonEmptyString$1,safariId:nonEmptyString$1,universal:nonEmptyString$1}).optional().transform(filterEmptyObject$1),eip6963Config:z$a.object({rdns:z$a.string()}).optional(),filterFromWalletConnect:z$a.boolean().optional(),group:z$a.string().optional(),hardwareWallets:z$a.array(z$a.string()).optional(),injectedConfig:z$a.array(injectedConfigSchema$1).optional(),mobile:z$a.object({android:stringType().nullish(),androidId:nonEmptyString$1.transform(transformAndroidId$1),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString$1.transform(transformIosId$1),native:nonEmptyString$1,universal:nonEmptyString$1}).optional().transform(filterEmptyObject$1),mobileExperience:z$a.enum(["in-app-browser","redirect"]).optional(),name:z$a.string(),shortName:nonEmptyString$1,showOnlyIfInstalled:z$a.boolean().optional(),switchNetworkOnlyFromWallet:z$a.boolean().optional(),walletConnect:z$a.object({sdks:nonEmptyStringArray$1}).optional().transform(filterEmptyObject$1),walletGroup:z$a.string().optional(),walletLimitations:z$a.object({browserExtension:z$a.object({unsupportedEvents:z$a.array(z$a.string()).optional(),unsupportedMethods:z$a.array(z$a.string()).optional()}).optional(),mobile:z$a.object({unsupportedEvents:z$a.array(z$a.string()).optional(),unsupportedMethods:z$a.array(z$a.string()).optional()}).optional()}).optional()})).transform(Xr=>{var eo,to,ro,no,io,oo;return Xr.group&&(Xr.chainGroup=Xr.group),(!((eo=Xr.mobile)===null||eo===void 0)&&eo.iosId||((to=Xr.mobile)===null||to===void 0?void 0:to.ios)===null)&&((ro=Xr.mobile)===null||ro===void 0||delete ro.ios),(!((no=Xr.mobile)===null||no===void 0)&&no.androidId||((io=Xr.mobile)===null||io===void 0?void 0:io.android)===null)&&((oo=Xr.mobile)===null||oo===void 0||delete oo.android),Xr}),WalletOverrideEntrySchema$1=z$a.object({brand:brandSchema$1.optional(),name:nonEmptyString$1}),walletGroupSchema$1=z$a.object({brand:z$a.object({alt:nonEmptyString$1,primaryColor:nonEmptyString$1,spriteId:nonEmptyString$1}).optional(),key:z$a.string(),name:z$a.string(),walletOverrides:z$a.record(WalletOverrideEntrySchema$1).optional()});z$a.record(z$a.string(),walletSchema$1);const walletBookSchema=z$a.preprocess(Xr=>Xr,z$a.object({groups:z$a.record(z$a.string(),walletGroupSchema$1),wallets:z$a.record(z$a.string(),walletSchema$1)}));z$a.record(z$a.string(),walletGroupSchema$1);var groups={argentx:{brand:{alt:"ArgentX",primaryColor:"#FF875B",spriteId:"argentx"},key:"argentx",name:"ArgentX"},backpack:{brand:{alt:"Backpack",spriteId:"backpack"},key:"backpack",name:"Backpack"},bitgetwallet:{brand:{alt:"Bitget Wallet",spriteId:"bitget"},key:"bitgetwallet",name:"Bitget"},blocto:{brand:{alt:"Blocto",primaryColor:"#5E678A",spriteId:"blocto"},key:"blocto",name:"Blocto"},brave:{brand:{alt:"Brave Browser",primaryColor:"#4B49C6",spriteId:"brave"},key:"brave",name:"Brave"},coin98:{brand:{alt:"Coin98 Wallet",primaryColor:"#CDA349",spriteId:"fc460647-ea95-447a-99f0-1bff8fa4be00"},key:"coin98",name:"Coin98"},coinbase:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},key:"coinbase",name:"Coinbase"},exodus:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},key:"exodus",name:"Exodus"},keplr:{brand:{alt:"Keplr",spriteId:"keplr"},key:"keplr",name:"Keplr"},magiceden:{brand:{alt:"Magic Eden",spriteId:"magiceden"},key:"magiceden",name:"Magic Eden"},mathwallet:{brand:{alt:"MathWallet Wallet",spriteId:"26a8f588-3231-4411-60ce-5bb6b805a700"},key:"mathwallet",name:"Math Wallet"},metamask:{brand:{alt:"MetaMask",primaryColor:"#E2761B",spriteId:"metamask"},key:"metamask",name:"MetaMask"},okxwallet:{brand:{alt:"OKX Wallet",spriteId:"okx"},key:"okxwallet",name:"OKX Wallet"},onekey:{brand:{alt:"OneKey Wallet",spriteId:"12bebb3f-8030-4892-8452-c60a6bac1500"},key:"onekey",name:"OneKey"},phantom:{brand:{alt:"Phantom",primaryColor:"#4B49C6",spriteId:"phantom"},key:"phantom",name:"Phantom"}},wallets$2={metamask:{brand:{alt:"MetaMask Wallet",primaryColor:"#E8831D",spriteId:"metamask"},chainGroup:"metamask",chains:["eip155:1"],desktop:{chromeId:"nkbihfbeogaeaoehlefnkodbefgpgknn",edgeId:"ejbalbakoplchlghecdalmeeeajnimhm",firefoxId:"ether-metamask"},eip6963Config:{rdns:"io.metamask"},filterFromWalletConnect:!0,group:"metamask",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isMetaMask",value:!0},{flag:"isDawn",value:!1},{flag:"isBraveWallet",value:!1},{flag:"isTrustWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isZerion",value:!1},{flag:"isSuperb",value:!1},{flag:"isRabby",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1},{flag:"isRainbow",value:!1},{flag:"isAvalanche",value:!1},{flag:"isMagicEden",value:!1},{flag:"isZerion",value:!1},{flag:"isOneKey",value:!1},{flag:"isPhantom",value:!1},{flag:"isCoin98",value:!1},{flag:"isBinance",value:!1}]}],mobile:{androidId:"io.metamask",inAppBrowser:"https://metamask.app.link/dapp",iosId:"id1438144202",native:"metamask://wc",universal:"https://metamask.app.link/wc"},mobileExperience:"in-app-browser",name:"MetaMask",shortName:"MetaMask",walletConnect:{sdks:["sign_v1","sign_v2"]}},coinbase:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},chainGroup:"coinbase",desktop:{chromeId:"hnfanknocfeofbddgcijnmhnfnkdnaad"},eip6963Config:{rdns:"com.coinbase.wallet"},group:"coinbase",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isCoinbaseWallet",value:!0}],windowLocations:["coinbaseWalletExtension"]}],mobile:{androidId:"org.toshi",iosId:"id1278383455"},name:"Coinbase",shortName:"Coinbase Wallet"},coinbasesolana:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},chainGroup:"coinbase",desktop:{chromeId:"hnfanknocfeofbddgcijnmhnfnkdnaad"},group:"coinbase",injectedConfig:[{chain:"sol",extensionLocators:[],windowLocations:["coinbaseSolana"]}],name:"Coinbase",shortName:"Coinbase Wallet (Solana)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},phantom:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isBraveWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isMagicEden",value:!1},{flag:"isGlow",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1}],walletStandardLocators:[{locator:"features.phantom:.phantom",name:"Phantom"}],windowLocations:["phantom.solana"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom"},phantombtc:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"btc",extensionLocators:[{flag:"isPhantom",value:!0}],walletStandard:{features:["bitcoin:connect"],name:"Phantom"},windowLocations:["phantom.bitcoin"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (Bitcoin)"},phantomevm:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isPhantom",value:!0}],windowLocations:["phantom.ethereum"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (EVM)"},phantomledger:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isBraveWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isMagicEden",value:!1},{flag:"isGlow",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1}],walletStandardLocators:[{locator:"features.phantom:.phantom",name:"Phantom"}],windowLocations:["phantom.solana"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (Ledger)"},walletconnect:{brand:{alt:"WalletConnect",primaryColor:"#3182CE",spriteId:"walletconnect"},mobile:{androidId:"enable-android",iosId:"id1438144202"},name:"WalletConnect",shortName:"WalletConnect"},argentx:{brand:{alt:"Argent X Wallet",primaryColor:"#FF875B",spriteId:"argentx"},desktop:{chromeId:"dlcobpjiigpikoobohmabehhmhfoodbb",edgeId:"ajcicjlkibolbeaaagejfhnofogocgcj",firefoxId:"argent-x"},mobile:{androidId:"im.argent.contractwalletclient",iosId:"id1358741926"},name:"Argent X"},perawallet:{brand:{alt:"Pera Wallet",spriteId:"pera"},mobile:{androidId:"com.algorand.android",iosId:"id1459898525"},name:"Pera Wallet"},blocto:{brand:{alt:"Blocto Wallet",primaryColor:"#5E678A",spriteId:"blocto"},chainGroup:"blocto",group:"blocto",mobile:{androidId:"com.portto.blocto",iosId:"id1481181682"},name:"Blocto",shortName:"Blocto (Flow)"},solflare:{brand:{alt:"Solflare Wallet",primaryColor:"#FC7227",spriteId:"solflare"},chains:["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"],desktop:{chromeId:"bhhhlbepdkbapadjdnnojkbgioiodbic"},filterFromWalletConnect:!0,hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isSolflare",value:!0}],windowLocations:["solflare"]}],mobile:{androidId:"com.solflare.mobile",iosId:"id1580902717"},name:"Solflare",walletConnect:{sdks:["sign_v1"]},walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},braavos:{brand:{alt:"Braavos Wallet",primaryColor:"#FABB38",spriteId:"braavos"},desktop:{chromeId:"jnlgamecbpmbajjfhmmmlhejkemejdma",edgeId:"hkkpjehhcnhgefhbdcgfkeegglpjchdc",firefoxId:"braavos-wallet"},mobile:{androidId:"app.braavos.wallet",iosId:"id1636013523"},name:"Braavos"},trust:{brand:{alt:"Trust Wallet",primaryColor:"#0500FF",spriteId:"7677b54f-3486-46e2-4e37-bf8747814f00"},chains:["cosmos:cosmoshub-4","cosmos:kava-4","cosmos:thorchain-mainnet-v1","eip155:1","eip155:10","eip155:100","eip155:108","eip155:1101","eip155:128","eip155:137","eip155:2020","eip155:288","eip155:321","eip155:324","eip155:361","eip155:42161","eip155:42220","eip155:43114","eip155:4689","eip155:56","eip155:56288","eip155:59144","eip155:60","eip155:820","eip155:88","eip155:9001","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"egjidjbpglichdcondbcbdnbeeppgdph"},eip6963Config:{rdns:"com.trustwallet.app"},filterFromWalletConnect:!0,injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isTrustWallet",value:!0}],windowLocations:["trustWallet"]}],mobile:{androidId:"com.wallet.crypto.trustapp",iosId:"id1288339409",native:"trust://wc",universal:"https://link.trustwallet.com/wc"},name:"Trust",shortName:"Trust",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},rainbow:{brand:{alt:"Rainbow Wallet",primaryColor:"#001e59",spriteId:"rainbow"},chains:["eip155:1","eip155:10","eip155:137","eip155:42161","eip155:56","eip155:7777777","eip155:8453"],desktop:{chromeId:"opfgelmcmbiajamepnmloijbpoleiama",edgeId:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefoxId:"rainbow-extension"},eip6963Config:{rdns:"me.rainbow"},filterFromWalletConnect:!0,injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isRainbow",value:!0}],windowLocations:["rainbow"]}],mobile:{androidId:"me.rainbow",iosId:"id1457119021",native:"rainbow://wc",universal:"https://rnbwapp.com/wc"},name:"Rainbow",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},dapper:{brand:{alt:"Dapper Wallet",primaryColor:"#762FBE",spriteId:"dapper"},mobile:{android:"fake-to-get-dapper-to-appear",ios:"fake-to-get-dapper-to-appear"},name:"Dapper"},glow:{brand:{alt:"Glow Wallet",spriteId:"glow"},desktop:{chromeId:"ojbcfhjmpigfobfclfflafhblgemeidi",edgeId:"niihfokdlimbddhfmngnplgfcgpmlido",firefoxId:"glow-solana-wallet"},hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isGlow",value:!0}],windowLocations:["glowSolana"]}],name:"Glow"},lilico:{brand:{alt:"Lilico Wallet",spriteId:"lilico"},desktop:{chromeId:"hpclkefagolihohboafpheddmmgdffjm"},filterFromWalletConnect:!0,name:"Lilico"},magicemailotp:{brand:{alt:"Magic Email OTP",spriteId:"magiclink"},name:"Magic Email OTP"},magiclink:{brand:{alt:"Magic Link",spriteId:"magiclink"},name:"Magic Link"},magicsocial:{brand:{alt:"Magic Social",spriteId:"magiclink"},name:"Magic Social"},magiceden:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",chains:["eip155:1","eip155:137","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},eip6963Config:{rdns:"io.magiceden.wallet"},filterFromWalletConnect:!0,group:"magiceden",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isMagicEden",value:!0}],windowLocations:["magicEden.ethereum"]}],mobile:{androidId:"com.magiceden.wallet",iosId:"id6478631482",native:"magiceden://wc"},name:"Magic Eden"},magicedenbtc:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},group:"magiceden",hardwareWallets:["ledger"],injectedConfig:[{chain:"btc",extensionLocators:[],walletStandard:{features:["sats-connect:"],name:"Magic Eden"},windowLocations:["magicEden.bitcoin"]}],mobile:{androidId:"com.magiceden.wallet",inAppBrowser:"magiceden://browser/{{encodedDappURI}}",iosId:"id6478631482",universal:"https://magiceden.io/browser/{{encodedDappURI}}"},name:"Magic Eden",shortName:"Magic Eden (Bitcoin)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},magicedensol:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},group:"magiceden",hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isMagicEden",value:!0}],windowLocations:["magicEden.solana"]}],name:"Magic Eden",shortName:"Magic Eden (Solana)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},exodus:{brand:{alt:"Exodus Wallet",spriteId:"4c16cad4-cac9-4643-6726-c696efaf5200"},chainGroup:"exodus",chains:["eip155:1","eip155:137","eip155:43114","eip155:56","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},filterFromWalletConnect:!0,group:"exodus",mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820",native:"exodus://wc",universal:"https://exodus.com/m/wc"},name:"Exodus",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},exodusevm:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},chainGroup:"exodus",chains:["eip155:1","eip155:137","eip155:43114","eip155:56"],desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},filterFromWalletConnect:!0,group:"exodus",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isExodus",value:!0}]}],mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820",native:"exodus://wc"},name:"Exodus",shortName:"Exodus Wallet (EVM)",walletConnect:{sdks:["sign_v2","auth_v1"]}},exodussol:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},chainGroup:"exodus",desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},group:"exodus",injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isExodus",value:!0}],windowLocations:["exodus.solana"]}],mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820"},name:"Exodus",shortName:"Exodus Wallet (Solana)"},okxwallet:{brand:{alt:"OKX Wallet",spriteId:"okx"},chainGroup:"okxwallet",chains:["eip155:1","eip155:137","eip155:43114","eip155:56","eip155:66","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"mcohilncbfahbmgdjkbpemcciiolgcge"},eip6963Config:{rdns:"com.okex.wallet"},filterFromWalletConnect:!0,group:"okxwallet",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isOKExWallet",value:!0},{flag:"isOkxWallet",value:!0}],windowLocations:["okxwallet"]}],mobile:{androidId:"com.okinc.okex.gp",iosId:"id1327268470",native:"okex://main/wc"},name:"OKX",shortName:"OKX Wallet",walletConnect:{sdks:["sign_v2"]}},backpack:{brand:{alt:"Backpack",primaryColor:"#e43c3c",spriteId:"backpack"},chainGroup:"backpack",chains:["eip155:1","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"aflkmfhebedbjioipglgcbcmnbpgliof"},eip6963Config:{rdns:"app.backpack"},filterFromWalletConnect:!0,group:"backpack",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isBackpack",value:!0}],windowLocations:[]}],name:"Backpack",walletConnect:{sdks:["sign_v1"]}},okxwalletbtc:{brand:{alt:"OKX Wallet",spriteId:"okx"},chainGroup:"okxwallet",desktop:{chromeId:"mcohilncbfahbmgdjkbpemcciiolgcge"},group:"okxwallet",injectedConfig:[{chain:"btc",extensionLocators:[],windowLocations:["okxwallet.bitcoin"]}],mobile:{androidId:"com.okinc.okex.gp",inAppBrowser:"okx://wallet/dapp/url?dappUrl={{encodedDappURI}}",iosId:"id1327268470"},name:"OKX",shortName:"OKX Wallet (Bitcoin)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},unisat:{brand:{alt:"UniSat",spriteId:"unisat"},desktop:{chromeId:"ppbibelpcjmhbdihakflkdcoccbgbkpo"},injectedConfig:[{chain:"btc",extensionLocators:[],windowLocations:["unisat"]}],name:"UniSat"},unknown:{brand:{spriteId:"captcha-wave"},mobile:{androidId:"enable-android",iosId:"id1234567890"},name:"Unknown Wallet",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},xverse:{brand:{alt:"Xverse Wallet",spriteId:"xverse"},desktop:{chromeId:"idnnbdplmphpflfnlkomgpfbpcgelopg"},hardwareWallets:["ledger"],injectedConfig:[{chain:"btc",extensionLocators:[],walletStandard:{features:["sats-connect:"],name:"Xverse",providerId:"XverseProviders.BitcoinProvider"},windowLocations:["XverseProviders.BitcoinProvider"]}],mobile:{androidId:"com.secretkeylabs.xverse",inAppBrowser:"xverse://browser?url={{encodedDappURI}}",iosId:"id1552272513"},name:"Xverse",walletLimitations:{browserExtension:{unsupportedEvents:["accountChanged"],unsupportedMethods:["getConnectedAccounts"]}}},fallbackconnector:{brand:{spriteId:"captcha-wave"},mobile:{androidId:"enable-android",iosId:"id1234567890"},name:"Fallback Connector",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}}},walletBookFallbacks={groups,wallets:wallets$2};const useWalletBookCdn=()=>{const[Xr,eo]=reactExports.useState({});return reactExports.useEffect(()=>{__awaiter$n(void 0,void 0,void 0,function*(){const ro=getWalletBookCdnUrl(),io=yield retryableFn(()=>__awaiter$n(void 0,void 0,void 0,function*(){const oo=yield fetch(ro,{mode:"cors"});if(oo.ok){const ao=yield oo.json();try{return walletBookSchema.parse(ao)}catch(so){throw logger$b.error("Error parsing wallet book data",so,ao),so}}throw new Error(`Failed to fetch wallet book data from ${ro} with status code ${oo.status}`)}),{fallbackValue:walletBookSchema.parse(walletBookFallbacks),logger:logger$b.createLogger("useWalletBookCdn"),maxRetries:3,retryStrategy:"timeout-and-rejection",timeoutMs:3e4});eo(io)})},[]),Xr},WalletIcon=Xr=>{var{walletKey:eo,children:to}=Xr,ro=__rest$8(Xr,["walletKey","children"]);const{walletBook:no}=useWalletBookContext(),io=findWalletBookWallet(no,eo),[oo,ao]=reactExports.useState(!1),so=getWalletIconUrl(no,eo),co=getDefaultWalletIconUrl();if(!io||!io.brand||!so)return reactExports.createElement(reactExports.Fragment,{},to);const lo=()=>{ao(!0)};return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`wallet-icon-${eo}`},ro),{alt:io.brand.alt,onError:lo,src:oo?co:so}),to)},WalletBookContextProvider=({walletBook:Xr,children:eo})=>reactExports.createElement(WalletBookContext.Provider,{value:{walletBook:Xr}},eo),BrandIcon=Xr=>{var{brand:eo,walletKey:to}=Xr,ro=__rest$8(Xr,["brand","walletKey"]);const[no,io]=reactExports.useState(!1),oo=getBrandIconUrl(eo),ao=getDefaultWalletIconUrl();if(!oo)return reactExports.createElement(reactExports.Fragment,{});const so=()=>{io(!0)};return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`wallet-icon-${to}`},ro),{alt:eo.alt,onError:so,src:no?ao:oo}))};assertPackageVersion("@dynamic-labs/wallet-book",version$q);const logger$9=new Logger$2("WalletConnector"),shouldLowercaseAddress$1=Xr=>["eip155","flow","evm","eth","avax","matic"].includes(Xr.toLowerCase()),normalizeAddress$1=(Xr,eo)=>(Xr.startsWith("0x")&&(Xr=Xr.slice(2)),shouldLowercaseAddress$1(eo)?Xr.toLowerCase():Xr),isSameAddress$1=(Xr,eo,to)=>normalizeAddress$1(Xr,to)===normalizeAddress$1(eo,to),getMobileExperience=({mobileExperienceProp:Xr,walletBook:eo,walletKey:to})=>{if(Xr&&typeof Xr=="string")return Xr;if(Xr!=null&&Xr[to])return Xr[to];const ro=findWalletBookWallet(eo,to);return ro!=null&&ro.mobileExperience?ro.mobileExperience:Xr!=null&&Xr.default?Xr.default:"in-app-browser"},isConnectorMethodSupported=(Xr,eo,to)=>{const ro=Xr.constructorProps.walletData||getWalletBookWallet(Xr.walletBook,Xr.key);return isWalletMethodSupported(ro,eo,to)};class WalletBookSingleton{constructor(eo){this.walletBook=eo}static getOrCreate(eo){var to;return!((to=WalletBookSingleton.instance)===null||to===void 0)&&to.walletBook||(WalletBookSingleton.instance=new WalletBookSingleton(eo)),WalletBookSingleton.instance}}var _WalletConnectorBase_registeredExtensions;class WalletConnectorBase extends EventEmitter$3{createWallet(eo){return new this.ChainWallet(eo)}constructor(eo){if(super(),this.chainRpcProviders=void 0,this.isGlobalTransaction=!1,_WalletConnectorBase_registeredExtensions.set(this,[]),this.didSetup=!1,this.requiresNonDynamicEmailOtp=!1,this.canConnectViaCustodialService=!1,this.canConnectViaQrCode=!1,this.canConnectViaSocial=!1,this.isAvailable=!0,this.isEmbeddedWallet=!1,this.isWalletConnect=!1,this.overrideKey=void 0,this.providerResources=void 0,this.switchNetworkOnlyFromWallet=void 0,this.isInitialized=!0,this.constructorProps=eo,this._walletBookInstance=WalletBookSingleton.getOrCreate(eo.walletBook),this.walletBook===void 0)throw new Error("WalletConnectorBase was not called with super(props) and is missing wallet-book")}extend(eo){if(__classPrivateFieldGet$6(this,_WalletConnectorBase_registeredExtensions,"f").includes(eo.name))throw new Error(`You can only register a single extension of: ${eo.name}`);eo.name==="global-wallet-extension"&&(!this.isEmbeddedWallet||!this.supportedChains.includes("EVM"))||(__classPrivateFieldGet$6(this,_WalletConnectorBase_registeredExtensions,"f").push(eo.name),eo.extend(this))}initEventListener(){this.didSetup||(this.didSetup=!0,this.setupEventListeners())}get walletBook(){return this._walletBookInstance.walletBook}filter(){try{return getWalletBookWallet(this.walletBook,this.key,this.walletFallback),!0}catch{return!1}}get mobileExperience(){return getMobileExperience({mobileExperienceProp:this.constructorProps.mobileExperience,walletBook:this.walletBook,walletKey:this.key})}chooseAccountsToConnect(){return Promise.resolve([])}connect(){return __awaiter$o(this,void 0,void 0,function*(){yield this.getAddress()})}endSession(){return Promise.resolve()}getAddress(eo){return Promise.resolve(void 0)}parseAddress(eo){return eo}isTestnet(){return Promise.resolve(!1)}getAdditionalAddresses(eo){return Promise.resolve([])}setAdditionalAddresses(eo,to){return Promise.resolve()}getBalance(eo){return Promise.resolve(void 0)}getConnectedAccounts(){return Promise.resolve([])}getDeepLink(){}getNetwork(){return Promise.resolve(void 0)}getNameService(eo){return Promise.resolve(void 0)}getPublicClient(){return Promise.resolve(void 0)}getSession(){return __awaiter$o(this,void 0,void 0,function*(){return Promise.resolve()})}getSigner(){return Promise.resolve(void 0)}getWalletClient(eo){}init(){return Promise.resolve()}isInstalledOnBrowser(){return!1}get key(){return this.overrideKey||this.name.replace(/\W/g,"").toLowerCase()}getMobileOrInstalledWallet(){return this}proveOwnership(eo,to){return __awaiter$o(this,void 0,void 0,function*(){return yield this.validateActiveWallet(eo),this.signMessage(to)})}setupEventListeners(){}signMessage(eo,to){return Promise.resolve(void 0)}supportsNetworkSwitching(){return!1}switchNetwork({networkName:eo,networkChainId:to}){return Promise.resolve(void 0)}teardownEventListeners(){}setVerifiedCredentials(eo){}canGetChainAddress(){return!0}handleWalletNotActive(eo){return __awaiter$o(this,arguments,void 0,function*({activeAddress:to,expectedAddress:ro,reconnectedAddress:no}){logger$9.debug("validateActiveWallet - wallet is not active",{activeAddress:to,expectedAddress:ro,reconnectedAddress:no});const io=to||no||"",oo=this.constructorProps.walletUiUtils;if(!oo)throw new WalletAddressMismatchError(`Wallet ${ro??""} is not currently active in ${this.name||this.key}.`,{activeAddress:io,expectedAddress:ro,walletName:this.name||this.key});return oo.syncWallet({activeAddress:io,expectedAddress:ro,walletConnector:this})})}validateActiveWallet(eo){return __awaiter$o(this,void 0,void 0,function*(){logger$9.debug("validateActiveWallet - validating wallet",eo);const to=isConnectorMethodSupported(this,"getConnectedAccounts","browserExtension");logger$9.debug("validateActiveWallet - getting connected accounts",{canFetchConnectedAccounts:to});const[ro]=to?yield this.getConnectedAccounts():[];if(ro&&isSameAddress$1(ro,eo,this.connectedChain)){logger$9.debug("validateActiveWallet - wallet is active");return}logger$9.debug("validateActiveWallet - trying to reconnect wallet...");const oo=yield __awaiter$o(this,void 0,void 0,function*(){if(!(this.isWalletConnect||!this.canGetChainAddress()))return this.getAddress().catch(ao=>{logger$9.debug("validateActiveWallet - error getting address",ao)})});if(oo&&isSameAddress$1(oo,eo,this.connectedChain)){logger$9.debug("validateActiveWallet - wallet reconnected successfuly");return}return this.handleWalletNotActive({activeAddress:ro,expectedAddress:eo,reconnectedAddress:oo})})}}_WalletConnectorBase_registeredExtensions=new WeakMap;let Wallet$1=class extends BaseWallet{constructor(eo){var{connector:to}=eo,ro=__rest$a(eo,["connector"]);super(ro),this._connector=to}get connector(){return this._connector}getBalance(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter$o(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(to=>normalizeAddress$1(to,this.chain)).includes(normalizeAddress$1(this.address,this.chain))}catch(eo){return logger$9.error("[Wallet] isConnected - Error detecting if wallet is connected",eo),!1}})}proveOwnership(eo){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,eo)})}signMessage(eo){return __awaiter$o(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(eo,this.address)})}switchNetwork(eo){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:eo})})}sync(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}};const walletConnectorEvents=new EventEmitter$3,ProviderLookup=(Xr,eo)=>{if(eo.length!==0)return Xr.find(to=>eo.every(no=>((to==null?void 0:to[no.flag])||!1)===no.value)===!0)},chainsInfo=[{blockchainName:"Algorand",displayName:"Algorand",name:"algorand",symbol:"ALGO"},{blockchainName:"Bitcoin",displayName:"Bitcoin",name:"bitcoin",symbol:"BTC"},{blockchainName:"Ethereum",displayName:"EVM",name:"evm",symbol:"ETH"},{blockchainName:"Flow",displayName:"Flow",name:"flow",symbol:"FLOW"},{blockchainName:"Solana",displayName:"Solana",name:"solana",symbol:"SOL"},{blockchainName:"Starknet",displayName:"Starknet",name:"starknet",symbol:"ETH"},{blockchainName:"Cosmos",displayName:"Cosmos",name:"cosmos",symbol:"COSMOS"},{blockchainName:"Bitcoin",displayName:"Bitcoin",name:"bitcoin",symbol:"BTC"}],chainOverrides={algo:"algorand",bip122:"bitcoin",btc:"bitcoin",eip155:"evm",eth:"evm",sol:"solana",stark:"starknet"};let chainInfoOverrides$1;const setChainInfoOverrides=Xr=>{chainInfoOverrides$1=Xr},getChainInfo=Xr=>{var eo;const to=Xr.toLowerCase(),ro=(eo=chainOverrides[to])!==null&&eo!==void 0?eo:to,no=chainsInfo.find(io=>io.name===ro||io.symbol.toLocaleLowerCase()===ro);if(no)return no},getChainInfoWithOverrides=Xr=>{var eo,to;const ro=getChainInfo(Xr);if(!ro)return;const no=chainInfoOverrides$1==null?void 0:chainInfoOverrides$1[ro.name],io=Object.assign({},ro);return no&&(io.blockchainName=(eo=no.displayName)!==null&&eo!==void 0?eo:ro.blockchainName,io.displayName=(to=no.displayName)!==null&&to!==void 0?to:ro.displayName),io},isEmailOTPWalletConnector=Xr=>!!Xr.verifyOneTimePassword,isEmailWalletConnector=Xr=>!!Xr.clearEmail,isTurnkeyWalletConnector=Xr=>{const eo=Xr;return!!(eo&&eo.key==="turnkeyhd"&&typeof eo.getWebAuthnAttestation=="function"&&typeof eo.getAuthenticatorHandler=="function"&&typeof eo.getExportHandler=="function"&&typeof eo.isSessionKeyCompatible=="function"&&typeof eo.createOrRestoreSession=="function")},isSocialWalletConnector=Xr=>!!Xr.canConnectViaSocial,filterWalletsByKey=(Xr,eo)=>eo.flatMap(to=>Xr.find(ro=>walletHasKey(ro,to))).filter(isWalletConnector),walletHasKey=(Xr,eo)=>Xr.key===eo,isWalletConnector=Xr=>!!Xr,getWalletConnectorByKey=(Xr,eo)=>filterWalletsByKey(Xr,[eo]).length>0?filterWalletsByKey(Xr,[eo])[0]:null,getConnectionDeepLink=(Xr,eo,to)=>{if(isAndroid$1())return Xr;const ro=getRegularDeepLink(Xr,eo,to);if(!ro)return`${ro}?uri=${encodeURIComponent(Xr)}`;const no=new URL(ro),io=new URLSearchParams(no.search);return io.set("uri",Xr),no.search=io.toString(),no.toString()},getRegularDeepLink=(Xr,eo,to)=>{var ro,no,io,oo;if(isAndroid$1())return Xr.split("?")[0];const ao=isMobile$1()?"mobile":"desktop";let so;return to==="native"?so=((ro=eo[ao])===null||ro===void 0?void 0:ro.native)||((no=eo[ao])===null||no===void 0?void 0:no.universal):so=((io=eo[ao])===null||io===void 0?void 0:io.universal)||((oo=eo[ao])===null||oo===void 0?void 0:oo.native),so||""},getDeepLink=({mode:Xr,uri:eo="",metadata:to,preference:ro})=>{switch(Xr){case"connection":return getConnectionDeepLink(eo,to,ro);case"regular":return getRegularDeepLink(eo,to,ro)}},performPlatformSpecificConnectionMethod=(Xr,eo,to,ro)=>{var no,io,oo;const ao=getDeepLink({metadata:eo,mode:"connection",preference:ro,uri:Xr});isMobile$1()?window.location.href=ao:(!((no=eo.desktop)===null||no===void 0)&&no.native&&((io=to.onDesktopUri)===null||io===void 0||io.call(to,ao)),(oo=to.onDisplayUri)===null||oo===void 0||oo.call(to,Xr))},isEmbeddedConnector=Xr=>!!Xr.isEmbeddedWallet,isMagicConnector=Xr=>["magicemailotp","magicsocial"].includes(Xr.key),isBloctoConnector=Xr=>["bloctoemail","bloctoevm","Blocto"].includes(Xr.key),isPasskeyWalletConnector=Xr=>!!Xr.getWebAuthnAttestation,isAccountAbstractionConnector=Xr=>Xr!=null&&typeof Xr=="object"&&"canSponsorTransactionGas"in Xr,isBitcoinConnector=Xr=>!!(Xr!=null&&Xr.sendBitcoin),isHardwareWalletConnector=Xr=>"canConnectWithHardwareWallet"in Xr,isHex$2=Xr=>!Xr||typeof Xr!="string"?!1:/^0x[0-9a-fA-F]*$/.test(Xr),eventListenerHandlers=Xr=>({handleAccountChange:no=>__awaiter$o(void 0,void 0,void 0,function*(){if(logger$9.debug(`${Xr.name} - accountChange`,no),no.length===0){Xr.emit("disconnect");return}Xr.emit("accountChange",{accounts:no})}),handleChainChange:no=>__awaiter$o(void 0,void 0,void 0,function*(){logger$9.debug(`${Xr.name} - chainChange`,no);const io=isHex$2(no)?parseInt(no,16).toString():no.toString();Xr.emit("chainChange",{chain:io})}),handleDisconnect:no=>__awaiter$o(void 0,void 0,void 0,function*(){logger$9.debug(`${Xr.name} - disconnect`,no),(no==null?void 0:no.code)!==1013&&Xr.emit("disconnect")})}),isPhantomRedirectConnector=Xr=>Xr.key==="phantom"&&Xr.extractSignature!==void 0,getRpcUrlForChain=({networks:Xr,chainId:eo})=>{var to;const ro=Xr.find(no=>no.chainId===eo);if(ro)return((to=ro.privateCustomerRpcUrls)===null||to===void 0?void 0:to[0])||ro.rpcUrls[0]},isCoinbaseMpcWalletConnector=Xr=>!!Xr&&Xr.key==="coinbasempc"&&Xr.generateWallet!==void 0&&Xr.changePasscode!==void 0&&Xr.exportWalletKeys!==void 0,isWalletConnectConnector=Xr=>!!(Xr!=null&&Xr.isWalletConnect),isSendBalanceWalletConnector=Xr=>"createUiTransaction"in Xr&&typeof Xr.createUiTransaction=="function",isSessionKeyCompatibleWalletConnector=Xr=>{const eo=Xr;return!!(typeof(eo==null?void 0:eo.isSessionKeyCompatible)=="function"&&eo.isSessionKeyCompatible())},isSessionKeyCompatibleWallet=Xr=>isSessionKeyCompatibleWalletConnector(Xr.connector);assertPackageVersion("@dynamic-labs/wallet-connector-core",version$r);const getApiProviders=Xr=>Object.values(ProviderEnum).reduce((eo,to)=>{const ro=Xr.find(no=>no.provider===to);return ro&&(eo[to]=ro),eo},{});let wallets$1=[];const defaultWalletUiUtils={createPassword:()=>{throw Error("createPassword not implemented")},disabledConfirmationOnce:()=>{throw Error("disabledConfirmationOnce, not implemented")},enterPassword:()=>{throw Error("enterPassword not implemented")},sendTransaction:()=>{throw Error("requestSendTransactionConfirmation not implemented")},signMessage:()=>{throw Error("signMessage not implemented")},syncWallet:()=>{throw Error("syncWallet not implemented")}},getSupportedWallets=Xr=>{const{appLogoUrl:eo="",appName:to="",coinbaseWalletPreference:ro,chainRpcProviders:no,deepLinkPreference:io,flowNetwork:oo,mobileExperience:ao="in-app-browser",networkConfigurations:so={cosmos:[],evm:[],solana:[],starknet:[]},settings:co,skipMemo:lo=!1,walletConnectProjectId:fo="",walletConnectorsProp:ho,walletUiUtils:go=void 0,walletBook:yo,walletConnectPreferredChains:vo}=Xr;if(!lo&&wallets$1.length>0)return wallets$1;const wo=(so==null?void 0:so.evm)||[],Eo=(so==null?void 0:so.solana)||[],ko=(so==null?void 0:so.cosmos)||[],Ao=(so==null?void 0:so.starknet)||[],jo={apiProviders:getApiProviders(getEnabledProviders(co.providers)),appLogoUrl:eo,appName:to,chainRpcProviders:no,coinbaseWalletPreference:ro,cosmosNetworks:ko,deepLinkPreference:io,evmNetworks:wo,flowNetwork:oo,mobileExperience:ao,projectId:fo,settings:co,solNetworks:Eo,starknetNetworks:Ao,walletBook:yo,walletConnectPreferredChains:vo,walletUiUtils:go||defaultWalletUiUtils},Mo=ho.map(Do=>Do(jo)).flat().map(Do=>{try{return new Do(jo)}catch(Fo){logger$9.error(`Failed to construct wallet ${Do.name}`,Fo);return}}).filter(Do=>Do==null?void 0:Do.filter()).map(Do=>Do.getMobileOrInstalledWallet()),No=filterWalletsForPlatform(yo,Mo);return wallets$1=applyLinksOverrides(yo,No),wallets$1},applyLinksOverrides=(Xr,eo)=>eo.map(to=>{const ro=getWalletBookWallet(Xr,to.key,to.walletFallback);return ro.switchNetworkOnlyFromWallet!==void 0&&(to.switchNetworkOnlyFromWallet=ro.switchNetworkOnlyFromWallet),to}),filterWalletsForPlatform=(Xr,eo)=>eo.filter(to=>{const ro=getWalletBookWallet(Xr,to.key,to.walletFallback);return to.isInstalledOnBrowser()||isEmbeddedConnector(to)?!0:ro.showOnlyIfInstalled?!1:isMobile$1()?handleMobileWalletFilter(Xr,to.key,ro):!0}),handleMobileWalletFilter=(Xr,eo,to)=>{if(!to.mobile)return!1;const ro=!!to.mobile.universal||!!to.mobile.native,no=to.walletConnect!==void 0;if(isIPad()||isIPhone()){const io=!!getWalletLinks(Xr,eo).ios;return no?io&&ro:io}else{const io=!!getWalletLinks(Xr,eo).android;return no?io&&ro:io}},chainStringToChains={"eip155:1":["ETH","EVM"],"flow:mainnet":["FLOW"]},getSupportedChainsForWalletConnector=(Xr,eo)=>{var to;const ro=getWalletBookWallet(Xr,eo.key,eo.walletFallback),no=new Set;return((to=ro.chains)!==null&&to!==void 0?to:[]).forEach(oo=>{const ao=chainStringToChains[oo];ao==null||ao.forEach(so=>{no.add(so)})}),eo.supportedChains.forEach(oo=>{no.add(oo)}),[...no]},getEnabledWallets=Xr=>getSupportedWallets(Xr.getSupportedWalletOpts).filter(ro=>Xr.enabledChains.some(no=>getSupportedChainsForWalletConnector(Xr.getSupportedWalletOpts.walletBook,ro).includes(no))||ro.key==="magiclink"),getEnabledProviders=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.filter(to=>!!to.enabledAt||to.provider===ProviderEnum.MagicLink&&!!to.providerProjectId||to.provider===ProviderEnum.Turnkey))!==null&&eo!==void 0?eo:[]},generateMessageToSign=({blockchain:Xr,domain:eo,chainId:to,nonce:ro,uri:no,publicKey:io,issuedAt:oo=new Date().toISOString(),statement:ao,requestId:so,resources:co})=>{var lo,fo;if(Xr==="STARK")return JSON.stringify({domain:eo.substring(0,31),nonce:ro});const ho=(fo=(lo=getChainInfo(Xr))===null||lo===void 0?void 0:lo.blockchainName)!==null&&fo!==void 0?fo:"Ethereum",yo=[`${eo} wants you to sign in with your ${ho} account:`,io].join(` -`),vo=ao?` +`.trim();var version$u="3.5.1",dependencies$2={"@dynamic-labs/sdk-api-core":"0.0.559","@hcaptcha/react-hcaptcha":"1.4.4","country-list":"2.3.0",formik:"2.2.9",i18next:"23.4.6",qrcode:"1.5.1","react-focus-lock":"2.9.2","react-i18next":"13.5.0",yup:"0.32.11","react-international-phone":"4.2.5"};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof globalThis.setTimeout=="function"&&(cachedSetTimeout=setTimeout);typeof globalThis.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(Xr){if(cachedSetTimeout===setTimeout)return setTimeout(Xr,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(Xr,0);try{return cachedSetTimeout(Xr,0)}catch{try{return cachedSetTimeout.call(null,Xr,0)}catch{return cachedSetTimeout.call(this,Xr,0)}}}function runClearTimeout(Xr){if(cachedClearTimeout===clearTimeout)return clearTimeout(Xr);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(Xr);try{return cachedClearTimeout(Xr)}catch{try{return cachedClearTimeout.call(null,Xr)}catch{return cachedClearTimeout.call(this,Xr)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var Xr=runTimeout(cleanUpNextTick);draining=!0;for(var eo=queue.length;eo;){for(currentQueue=queue,queue=[];++queueIndex1)for(var to=1;to{const eo=Xr.split(".");let to=process;for(let ro=0;ro"u"&&Object.assign(window,{process}));const VERSION$4=version$u,API_VERSION$2=dependencies$2["@dynamic-labs/sdk-api-core"];var version$s="3.5.1",version$r="3.5.1";function __rest$a(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{const Xr=reactExports.useContext(WalletBookContext);if(Xr===void 0)throw new Error("useWalletBookContext must be used within a WalletBookContextProvider");return Xr},getWalletBookWallet=(Xr,eo,to)=>{var ro,no,io;if(!eo)throw new Error("Wallet key is required. Please pass in a wallet key to getWalletBookWallet");const oo=(no=(ro=Xr==null?void 0:Xr.wallets)===null||ro===void 0?void 0:ro[eo])!==null&&no!==void 0?no:to;if(!oo)throw new Error(`Wallet ${eo} not found in wallet book (${Object.keys((io=Xr==null?void 0:Xr.wallets)!==null&&io!==void 0?io:{}).length} wallets found)`);return oo};var version$p="3.5.1",define_process_env_default$6={};const DEFAULT_ICONIC_SPRITE_URL$1="https://iconic.dynamic-static-assets.com/icons/sprite.svg",getIconicSpriteUrl$1=()=>{var Xr,eo,to;return typeof process$1$1<"u"&&define_process_env_default$6&&(to=(eo=(Xr=define_process_env_default$6.ICONIC_SPRITE_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$6.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$6.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&to!==void 0?to:DEFAULT_ICONIC_SPRITE_URL$1},ICONIC_SPRITE_URL$1=getIconicSpriteUrl$1(),createIconic$1=Xr=>{const eo=Object.assign(Object.assign({},Xr),{function:ro=>{const no=`${ICONIC_SPRITE_URL$1}#${eo.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${eo.iconName}`},ro),{alt:eo.alt,src:no}))}}),to=eo.function.bind(eo);return Object.assign(to,{iconName:eo.iconName,sourcePath:eo.sourcePath}),to},BraveIcon=createIconic$1({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"}),ChromeIcon=createIconic$1({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"}),EdgeIcon=createIconic$1({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"}),FirefoxIcon=createIconic$1({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"}),OperaIcon=createIconic$1({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"}),SafariIcon=createIconic$1({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"}),AlgorandIcon=createIconic$1({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic$1({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic$1({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic$1({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic$1({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});const BitcoinIcon=createIconic$1({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic$1({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});const CosmosIcon=createIconic$1({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic$1({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic$1({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});const EthereumIcon=createIconic$1({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic$1({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic$1({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});const FlowIcon=createIconic$1({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic$1({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic$1({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic$1({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic$1({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});const SolanaIcon=createIconic$1({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"}),StarknetIcon=createIconic$1({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic$1({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic$1({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic$1({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic$1({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic$1({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic$1({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic$1({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic$1({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic$1({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic$1({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic$1({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic$1({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic$1({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic$1({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic$1({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic$1({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});const SignInWithEmailIcon=createIconic$1({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic$1({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic$1({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic$1({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic$1({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic$1({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic$1({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic$1({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic$1({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic$1({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic$1({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic$1({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic$1({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic$1({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic$1({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic$1({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic$1({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic$1({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic$1({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic$1({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic$1({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic$1({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic$1({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic$1({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic$1({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic$1({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic$1({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic$1({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic$1({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic$1({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic$1({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic$1({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic$1({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic$1({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});const WalletConnectIcon=createIconic$1({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic$1({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic$1({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic$1({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic$1({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic$1({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic$1({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic$1({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic$1({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic$1({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic$1({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic$1({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic$1({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic$1({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic$1({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic$1({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic$1({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic$1({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});const AppleIcon=createIconic$1({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"}),AndroidIcon=createIconic$1({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"}),BitbucketIcon=createIconic$1({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"}),DiscordIcon=createIconic$1({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"}),FacebookIcon=createIconic$1({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"}),FarcasterIcon=createIconic$1({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"}),GithubIcon=createIconic$1({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"}),GithubDarkIcon=createIconic$1({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"}),GitlabIcon=createIconic$1({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"}),GoogleIcon=createIconic$1({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"}),HelpdeskIcon=createIconic$1({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"}),LinkedinIcon=createIconic$1({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"}),MicrosoftIcon=createIconic$1({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"}),SlackIcon=createIconic$1({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"}),TelegramIcon=createIconic$1({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"}),TwitchIcon=createIconic$1({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"}),TwitchDarkIcon=createIconic$1({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"}),TwitterIcon=createIconic$1({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"}),TwitterDarkIcon=createIconic$1({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"}),AppleSocialIcon=createIconic$1({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"}),AppleDarkSocialIcon=createIconic$1({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"}),CoinbaseSocialIcon=createIconic$1({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"}),CoinbaseSocialDarkIcon=createIconic$1({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"}),InstagramIcon=createIconic$1({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"}),YouTubeIcon=createIconic$1({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"}),OnePasswordIcon=createIconic$1({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"}),OnePasswordDarkIcon=createIconic$1({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"}),EpicGamesIcon=createIconic$1({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"}),EpicGamesDarkIcon=createIconic$1({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"}),SpotifyIcon=createIconic$1({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"}),SpotifyDarkIcon=createIconic$1({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"}),SteamIcon=createIconic$1({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"}),SteamDarkIcon=createIconic$1({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"}),TikTokIcon=createIconic$1({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"}),TikTokDarkIcon=createIconic$1({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"}),LineIcon=createIconic$1({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"}),index=Object.freeze(Object.defineProperty({__proto__:null,AppleDarkSocialIcon,AppleSocialIcon,BitbucketIcon,CoinbaseSocialDarkIcon,CoinbaseSocialIcon,DiscordIcon,EpicGamesDarkIcon,EpicGamesIcon,FacebookIcon,FarcasterIcon,GithubDarkIcon,GithubIcon,GitlabIcon,GoogleIcon,HelpdeskIcon,InstagramIcon,LineIcon,LinkedinIcon,MicrosoftIcon,OnePasswordDarkIcon,OnePasswordIcon,SlackIcon,SpotifyDarkIcon,SpotifyIcon,SteamDarkIcon,SteamIcon,TelegramIcon,TikTokDarkIcon,TikTokIcon,TwitchDarkIcon,TwitchIcon,TwitterDarkIcon,TwitterIcon,YouTubeIcon},Symbol.toStringTag,{value:"Module"})),CaptchaWaveIcon=createIconic$1({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"}),UserProfileIcon=createIconic$1({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic$1({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});function __rest$9(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{const to=Object.fromEntries(Object.values(index).map(no=>[no.iconName,no]));if(eo==="dark"){const no=to[`${Xr.toLowerCase()}-dark`];if(no)return no}const ro=to[Xr.toLowerCase()];if(ro)return ro;throw new Error(`Icon ${Xr}, not found`)},findSocialIcon=(Xr,eo="light")=>{try{return getSocialIcon(Xr,eo)}catch(to){return logger$c.error(to),null}},SocialIcon=Xr=>{var{name:eo,variant:to}=Xr,ro=__rest$9(Xr,["name","variant"]);const no=findSocialIcon(eo,to);return no?reactExports.createElement(no,ro,null):null};assertPackageVersion("@dynamic-labs/iconic",version$p);const TEMPLATES={androidUrl:"https://play.google.com/store/apps/details?id={{id}}",chromeUrl:"https://chrome.google.com/webstore/detail/{{id}}",edgeUrl:"https://microsoftedge.microsoft.com/addons/detail/{{id}}",firefoxUrl:"https://addons.mozilla.org/en-US/firefox/addon/{{id}}",iconicUrl:`${getIconicSpriteUrl$1()}#{{id}}`,iosUrl:"https://apps.apple.com/app/apple-store/{{id}}",walletConnectUrl:"https://registry.walletconnect.org/v2/logo/sm/{{id}}"},renderTemplate=(Xr,eo)=>{if(eo)return TEMPLATES[Xr].replace("{{id}}",eo)},getBrandIconUrl=Xr=>Xr.spriteId?renderTemplate("iconicUrl",Xr.spriteId):"",logger$b=new Logger$2("WalletBook"),getWalletIconUrl=(Xr,eo)=>{try{const to=getWalletBookWallet(Xr,eo);if(to!=null&&to.brand)return getBrandIconUrl(to.brand)}catch(to){logger$b.error(to)}return""},getDefaultWalletIconUrl=()=>{try{return renderTemplate("iconicUrl","defaultwallet")}catch(Xr){logger$b.error(Xr)}return""},findWalletBookWallet=(Xr,eo)=>{try{return getWalletBookWallet(Xr,eo)}catch{return}},getWalletLinks=(Xr,eo)=>{var to,ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo,$o;const Co=findWalletBookWallet(Xr,eo),Ro={android:"",brave:"",chrome:"",edge:"",firefox:"",ios:""};return Ro.brave=(ro=renderTemplate("chromeUrl",(to=Co==null?void 0:Co.desktop)===null||to===void 0?void 0:to.chromeId))!==null&&ro!==void 0?ro:"",Ro.chrome=(io=renderTemplate("chromeUrl",(no=Co==null?void 0:Co.desktop)===null||no===void 0?void 0:no.chromeId))!==null&&io!==void 0?io:"",Ro.edge=(ao=renderTemplate("edgeUrl",(oo=Co==null?void 0:Co.desktop)===null||oo===void 0?void 0:oo.edgeId))!==null&&ao!==void 0?ao:"",Ro.firefox=(co=renderTemplate("firefoxUrl",(so=Co==null?void 0:Co.desktop)===null||so===void 0?void 0:so.firefoxId))!==null&&co!==void 0?co:"",Ro.ios=(go=(uo=renderTemplate("iosUrl",(lo=Co==null?void 0:Co.mobile)===null||lo===void 0?void 0:lo.iosId))!==null&&uo!==void 0?uo:(ho=Co==null?void 0:Co.mobile)===null||ho===void 0?void 0:ho.ios)!==null&&go!==void 0?go:"",Ro.android=($o=(wo=renderTemplate("androidUrl",(bo=Co==null?void 0:Co.mobile)===null||bo===void 0?void 0:bo.androidId))!==null&&wo!==void 0?wo:(Eo=Co==null?void 0:Co.mobile)===null||Eo===void 0?void 0:Eo.android)!==null&&$o!==void 0?$o:"",Ro},getWalletPrimaryColor=(Xr,eo)=>{var to;const ro=getWalletBookWallet(Xr,eo);return(to=ro==null?void 0:ro.brand)===null||to===void 0?void 0:to.primaryColor},getWalletGroup=(Xr,eo)=>{const to=Xr.groups[eo];if(!to)throw new Error(`Group ${eo} not found in wallet book`);return to},findWalletGroup=(Xr,eo)=>{try{return getWalletGroup(Xr,eo)}catch(to){logger$b.error(to);return}};var define_process_env_default$5={};const getWalletBookCdnUrl=()=>{var Xr,eo,to;return(to=(eo=(Xr=define_process_env_default$5.WALLET_BOOK_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$5.NEXT_PUBLIC_WALLET_BOOK_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$5.REACT_APP_WALLET_BOOK_CDN_URL)!==null&&to!==void 0?to:"https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json"},findWalletGroupOverride=(Xr,eo,to)=>{var ro;const no=findWalletGroup(Xr,eo);return(ro=no==null?void 0:no.walletOverrides)===null||ro===void 0?void 0:ro[to]},isWalletMethodSupported=(Xr,eo,to)=>{var ro,no,io;return!(!((io=(no=(ro=Xr==null?void 0:Xr.walletLimitations)===null||ro===void 0?void 0:ro[to])===null||no===void 0?void 0:no.unsupportedMethods)===null||io===void 0)&&io.includes(eo))},isWalletEventSupported=(Xr,eo,to)=>{var ro,no,io;return!(!((io=(no=(ro=Xr==null?void 0:Xr.walletLimitations)===null||ro===void 0?void 0:ro[to])===null||no===void 0?void 0:no.unsupportedEvents)===null||io===void 0)&&io.includes(eo))};function __rest$8(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);noparseInt(Xr.toString()),parseEvmNetworks=Xr=>Xr.slice().map(to=>(to.chainId=parseChainId(to.chainId),to.networkId=parseChainId(to.networkId),to)),parseCosmosNetworks=Xr=>parseEvmNetworks(Xr);let CustomError$1=class extends Error{constructor(eo,to){super(eo),this.code=void 0,this.code=to,Object.setPrototypeOf(this,this.constructor.prototype)}toJSON(){return{code:this.code,error:this.message}}};class DynamicError extends CustomError$1{}class AccountExistsError extends DynamicError{constructor(eo,to){super(eo),this.errorMessage=eo,this.errorPayload=to}}class ChainalysisError extends DynamicError{constructor(eo){super("This address is not approved for access"),this.walletPublicKey=eo}}class SandboxMaximumThresholdReachedError extends DynamicError{constructor(eo){super(eo),this.errorMessage=eo}}class EmailAlreadyExistsError extends DynamicError{constructor(){super("Email already exists")}}class EmailProviderError extends DynamicError{constructor(eo){super("EmailProviderError",eo)}}class EmailVerificationError extends DynamicError{constructor(eo){super("EmailVerificationError",eo)}}class GateBlockedError extends DynamicError{constructor(eo){super("This address is blocked by the gate"),this.walletPublicKey=eo}}class InsufficientFundsError extends DynamicError{constructor(){super(InsufficientFundsError.message)}static isInstance(eo){var to;return(((to=eo==null?void 0:eo.walk)===null||to===void 0?void 0:to.call(eo))||eo)instanceof InsufficientFundsError}static isErrorMessage(eo){var to;const ro=eo;return((to=ro==null?void 0:ro.message)===null||to===void 0?void 0:to.includes("AA21 didn't pay prefund"))||!1}}InsufficientFundsError.message="Insufficient funds.";class MissingEnvironmentIdError extends DynamicError{constructor(){super("You are missing the environmentId field in yours DynamicContextProvider settings prop")}}class MissingPublicAddressError extends DynamicError{constructor(){super("Missing public address","missing-public-address")}}class NoAccessError extends DynamicError{constructor({walletPublicKey:eo,email:to,phoneNumber:ro,socialProvider:no,socialUsername:io}){super("User does not have access"),this.email=to,this.walletPublicKey=eo,this.phoneNumber=ro,this.socialProvider=no,this.socialUsername=io}}class NotSupportedError extends DynamicError{}class SmsVerificationError extends DynamicError{}class SocialAccountAlreadyExistsError extends DynamicError{constructor(){super("Social account already exists")}}class TransactionGasCannotBeSponsoredError extends DynamicError{constructor(){super(TransactionGasCannotBeSponsoredError.message)}static isInstance(eo){var to;return(((to=eo==null?void 0:eo.walk)===null||to===void 0?void 0:to.call(eo))||eo)instanceof TransactionGasCannotBeSponsoredError}static isErrorMessage(eo){var to;const ro=eo;return((to=ro==null?void 0:ro.message)===null||to===void 0?void 0:to.includes("userOp did not match any gas sponsoring policies"))||!1}}TransactionGasCannotBeSponsoredError.message="Transaction gas cannot be sponsored.";class UserHasAccountWithEmailError extends DynamicError{constructor(eo){super(eo),this.error=eo}}class UsernameAlreadyExistsError extends DynamicError{constructor(){super("Username already exists")}}class WalletNotDeployedError extends DynamicError{constructor(){super("Wallet has not been deployed","wallet_not_deployed")}}class WalletUsedError extends DynamicError{constructor(eo){super("WalletUsedError",eo)}}class UserRejectedTransactionError extends DynamicError{constructor(){super("user rejected transaction")}}class TooManyEmailVerificationsError extends DynamicError{constructor(){super("Too many email verification attempts.")}}class VerificationDataCollectionError extends DynamicError{constructor(eo){super("Failed to get verification data: "+eo)}}class InvalidPhoneNumberError extends DynamicError{constructor(eo){super(eo??"Invalid phone number.")}}class MergeAccountsConfirmationError extends DynamicError{constructor({code:eo,mergeConflicts:to,walletAddress:ro}){super("MergeAccountsConfirmationError",eo),this.mergeConflicts=to,this.walletAddress=ro}}class CustomFieldNotUniqueError extends DynamicError{constructor(){super("Custom Field for user must be unique within the environment","custom_field_data_not_unique")}}class CookieInvalidError extends DynamicError{constructor(){super("The cookie is invalid or expired")}}class AccessBlockedError extends DynamicError{}class EmbeddedWalletException extends DynamicError{constructor(eo){super(eo)}}class MfaInvalidOtpError extends DynamicError{constructor(){super("Invalid code")}}class MfaRateLimitedError extends DynamicError{constructor(){super("Rate limit reached")}}class WalletAddressMismatchError extends DynamicError{constructor(eo,{activeAddress:to,expectedAddress:ro,walletName:no}){super(eo,"wallet_address_mismatch_error"),this.expectedAddress=ro,this.activeAddress=to,this.walletName=no}}class UserRejectedRequestError extends DynamicError{constructor(){super("User rejected request","user_rejected_request")}}const logger$a=new Logger$2("utils"),userAgentRegex1=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,userAgentRegex2=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,isMobile$1=Xr=>typeof window>"u"||typeof navigator>"u"?!1:userAgentRegex1.test(navigator.userAgent)||userAgentRegex2.test(navigator.userAgent.substring(0,4))||isIPad()||isIPhone(),isIPhone=()=>typeof window>"u"||typeof navigator>"u"?!1:/iPhone/.test(navigator.userAgent),isIPhone8OrEarlier=()=>typeof window>"u"||typeof navigator>"u"?!1:iPhoneLegacyRegex.some(({regex:Xr})=>Xr.test(navigator.userAgent)),isIPad=Xr=>{if(typeof window>"u"||typeof navigator>"u")return!1;const eo=navigator.maxTouchPoints;return/iPad/.test(navigator.userAgent)||/Mac/.test(navigator.userAgent)&&eo===5},isIOS$1=Xr=>typeof window>"u"||typeof navigator>"u"?!1:isIPhone()||isIPad(),isAndroid$1=()=>isMobile$1()&&!isIOS$1(),isLegacySafari=()=>typeof window>"u"||!window.CSS||typeof window.CSS.supports!="function"?!1:!CSS.supports("aspect-ratio: 1 / 1"),isSamsungBrowser=()=>typeof window>"u"||typeof navigator>"u"?!1:navigator.userAgent.includes("SamsungBrowser"),isSafariBrowser=()=>{if(typeof window>"u"||typeof navigator>"u")return!1;const{userAgent:Xr}=navigator;return Xr.includes("Safari")&&!Xr.includes("Chrome")&&!Xr.includes("Chromium")},iPhoneLegacyRegex=[{model:"iPhone 5",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]12|5)$/},{model:"iPhone 5C",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]34)$/},{model:"iPhone 5S",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?6[C,_]12|5S)$/},{model:"iPhone 6 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]1|1C2%257enohPi|6PLUS)$/},{model:"iPhone 6",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]2|6)$/},{model:"iPhone 6s Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]2|6SPLUS)$/},{model:"iPhone 6s",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]1|iPhone[ /]6s|6S)$/},{model:"iPhone SE",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]4|SE)$/},{model:"iPhone 7",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]13|iphone7|7)$/},{model:"iPhone 7 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]24|7PLUS)$/},{model:"iPhone 8",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]14|8)$/},{model:"iPhone 8 Plus",regex:/(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]25|8PLUS)$/}],getAndroidVersion=()=>{if(typeof navigator>"u")return;const Xr=navigator.userAgent.match(/Android (\d+(\.\d+)?)/);return Xr?parseFloat(Xr[1]):void 0};function __awaiter$m(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __classPrivateFieldGet$5(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)}function __classPrivateFieldSet$5(Xr,eo,to,ro,no){if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no?no.value=to:eo.set(Xr,to),to}typeof SuppressedError=="function"&&SuppressedError;const getItemAsync=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){if(typeof window>"u")return;const eo=window.localStorage.getItem(Xr);if(eo)try{return JSON.parse(eo)}catch{return eo}}),setItemAsync=(Xr,eo)=>__awaiter$m(void 0,void 0,void 0,function*(){typeof window>"u"||window.localStorage.setItem(Xr,JSON.stringify(eo))}),removeItemAsync=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){if(!(typeof window>"u"))return localStorage.removeItem(Xr)});typeof window<"u"&&(window.global=globalThis,!window.Buffer&&typeof window.Buffer>"u"&&Object.assign(window,{Buffer:Buffer$1$1}));const bufferToBase64=Xr=>{const eo=Array.prototype.map.call(Xr,to=>String.fromCharCode(to)).join("");return Buffer$3.from(eo,"binary").toString("base64")},getProvidersFromWindow=Xr=>{const eo=Xr.split(".");let to=window;const ro=[];for(const[no,io]of Object.entries(eo)){if(to=to[io],typeof to!="object"||to===null)return[];Number(no)===eo.length-1&&(Array.isArray(to)?to.forEach(oo=>ro.push(oo)):to.providers?to.providers.forEach(oo=>ro.push(oo)):ro.push(to))}return ro};function sleep$1(Xr,eo){return new Promise(to=>{setTimeout(()=>to(eo),Xr)})}const FALLBACK_UNDEFINED="FALLBACK_UNDEFINED",retryableFn=(Xr,...eo)=>__awaiter$m(void 0,[Xr,...eo],void 0,function*(to,ro={}){const{maxRetries:no=3,currentRetry:io=0,timeoutMs:oo=100,fallbackValue:ao=new Error("Max retries reached"),retryStrategy:so="timeout-only",retryIntervalMs:co=0,logger:lo}=ro;lo==null||lo.debug("Configured retryableFn with options: ",{currentRetry:io,fallbackValue:ao,maxRetries:no,retryStrategy:so,timeoutMs:oo});const uo=new Promise((ho,go)=>{setTimeout(()=>{go(new Error("Timeout"))},oo)});try{return yield Promise.race([to(),uo])}catch(ho){if(lo==null||lo.debug("retryableFn caught error: ",ho),io>=no){if(lo==null||lo.error("Error while retrying function, returning/throwing fallback value",ho,ao),ao instanceof Error)throw ao;return ao===FALLBACK_UNDEFINED?void 0:ao}const go=(ho==null?void 0:ho.message)==="Timeout",bo=so==="timeout-and-rejection"||so==="timeout-only"&&go||so==="rejection-only"&&!go;if(lo==null||lo.debug("retryableFn shouldRetry: ",bo),!bo){if(ao instanceof Error)throw lo==null||lo.debug("retryableFn throwing fallbackValue error: ",ao),ho;if(ao===FALLBACK_UNDEFINED){lo==null||lo.debug("retryableFn returning undefined");return}return lo==null||lo.debug("retryableFn returning fallbackValue: ",ao),lo==null||lo.error("Error while retrying function, returning fallback value",ho),ao}return co&&(yield sleep$1(co)),retryableFn(to,{currentRetry:io+1,fallbackValue:ao,logger:lo,maxRetries:no,retryIntervalMs:co,retryStrategy:so,timeoutMs:oo})}}),wrapMethodWithCallback=(Xr,eo,to)=>{const no=Xr[eo].bind(Xr);Object.assign(Xr,{[eo]:(...io)=>to(no,...io)})},handleMobileWalletRedirect=({nativeLink:Xr,universalLink:eo})=>{const to=encodeURIComponent(window.location.toString()),ro=encodeURIComponent(window.location.origin);isSamsungBrowser()?window.location.assign(`${Xr}/${to}?ref=${ro}`):window.location.assign(`${eo}/${to}?ref=${ro}`)};function shareSameDomainSuffix(Xr,eo){return Xr.endsWith(eo)?Xr.length===eo.length||Xr[Xr.length-eo.length-1]===".":!1}function extractDomainWithSuffix(Xr,eo){const to=Xr.length-eo.length-2,ro=Xr.lastIndexOf(".",to);return ro===-1?Xr:Xr.slice(ro+1)}function getDomain(Xr,eo,to){if(to.validHosts!==null){const no=to.validHosts;for(const io of no)if(shareSameDomainSuffix(eo,io))return io}let ro=0;if(eo.startsWith("."))for(;roto+1&&Xr.charCodeAt(ro-1)<=32;)ro-=1;if(Xr.charCodeAt(to)===47&&Xr.charCodeAt(to+1)===47)to+=2;else{const co=Xr.indexOf(":/",to);if(co!==-1){const lo=co-to,uo=Xr.charCodeAt(to),ho=Xr.charCodeAt(to+1),go=Xr.charCodeAt(to+2),bo=Xr.charCodeAt(to+3),wo=Xr.charCodeAt(to+4);if(!(lo===5&&uo===104&&ho===116&&go===116&&bo===112&&wo===115)){if(!(lo===4&&uo===104&&ho===116&&go===116&&bo===112)){if(!(lo===3&&uo===119&&ho===115&&go===115)){if(!(lo===2&&uo===119&&ho===115))for(let Eo=to;Eo=97&&$o<=122||$o>=48&&$o<=57||$o===46||$o===45||$o===43))return null}}}}for(to=co+2;Xr.charCodeAt(to)===47;)to+=1}}let oo=-1,ao=-1,so=-1;for(let co=to;co=65&&lo<=90&&(no=!0)}if(oo!==-1&&oo>to&&ooto&&soto+1&&Xr.charCodeAt(ro-1)===46;)ro-=1;const io=to!==0||ro!==Xr.length?Xr.slice(to,ro):Xr;return no?io.toLowerCase():io}function isProbablyIpv4(Xr){if(Xr.length<7||Xr.length>15)return!1;let eo=0;for(let to=0;to57)return!1}return eo===3&&Xr.charCodeAt(0)!==46&&Xr.charCodeAt(Xr.length-1)!==46}function isProbablyIpv6(Xr){if(Xr.length<3)return!1;let eo=Xr.startsWith("[")?1:0,to=Xr.length;if(Xr[to-1]==="]"&&(to-=1),to-eo>39)return!1;let ro=!1;for(;eo=48&&no<=57||no>=97&&no<=102||no>=65&&no<=90))return!1}return ro}function isIp(Xr){return isProbablyIpv6(Xr)||isProbablyIpv4(Xr)}function isValidAscii(Xr){return Xr>=97&&Xr<=122||Xr>=48&&Xr<=57||Xr>127}function isValidHostname(Xr){if(Xr.length>255||Xr.length===0||!isValidAscii(Xr.charCodeAt(0))&&Xr.charCodeAt(0)!==46&&Xr.charCodeAt(0)!==95)return!1;let eo=-1,to=-1;const ro=Xr.length;for(let no=0;no64||to===46||to===45||to===95)return!1;eo=no}else if(!(isValidAscii(io)||io===45||io===95))return!1;to=io}return ro-eo-1<=63&&to!==45}function setDefaultsImpl({allowIcannDomains:Xr=!0,allowPrivateDomains:eo=!1,detectIp:to=!0,extractHostname:ro=!0,mixedInputs:no=!0,validHosts:io=null,validateHostname:oo=!0}){return{allowIcannDomains:Xr,allowPrivateDomains:eo,detectIp:to,extractHostname:ro,mixedInputs:no,validHosts:io,validateHostname:oo}}const DEFAULT_OPTIONS=setDefaultsImpl({});function setDefaults$1(Xr){return Xr===void 0?DEFAULT_OPTIONS:setDefaultsImpl(Xr)}function getSubdomain(Xr,eo){return eo.length===Xr.length?"":Xr.slice(0,-eo.length-1)}function getEmptyResult(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,publicSuffix:null,subdomain:null}}function parseImpl(Xr,eo,to,ro,no){const io=setDefaults$1(ro);return typeof Xr!="string"||(io.extractHostname?io.mixedInputs?no.hostname=extractHostname(Xr,isValidHostname(Xr)):no.hostname=extractHostname(Xr,!1):no.hostname=Xr,no.hostname===null)||io.detectIp&&(no.isIp=isIp(no.hostname),no.isIp)?no:io.validateHostname&&io.extractHostname&&!isValidHostname(no.hostname)?(no.hostname=null,no):(to(no.hostname,io,no),no.publicSuffix===null||(no.domain=getDomain(no.publicSuffix,no.hostname,io),no.domain===null)||(no.subdomain=getSubdomain(no.hostname,no.domain),no.domainWithoutSuffix=getDomainWithoutSuffix(no.domain,no.publicSuffix)),no)}function fastPathLookup(Xr,eo,to){if(!eo.allowPrivateDomains&&Xr.length>3){const ro=Xr.length-1,no=Xr.charCodeAt(ro),io=Xr.charCodeAt(ro-1),oo=Xr.charCodeAt(ro-2),ao=Xr.charCodeAt(ro-3);if(no===109&&io===111&&oo===99&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="com",!0;if(no===103&&io===114&&oo===111&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="org",!0;if(no===117&&io===100&&oo===101&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="edu",!0;if(no===118&&io===111&&oo===103&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="gov",!0;if(no===116&&io===101&&oo===110&&ao===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="net",!0;if(no===101&&io===100&&oo===46)return to.isIcann=!0,to.isPrivate=!1,to.publicSuffix="de",!0}return!1}const exceptions=function(){const Xr=[1,{}],eo=[0,{city:Xr}];return[0,{ck:[0,{www:Xr}],jp:[0,{kawasaki:eo,kitakyushu:eo,kobe:eo,nagoya:eo,sapporo:eo,sendai:eo,yokohama:eo}]}]}(),rules=function(){const Xr=[1,{}],eo=[2,{}],to=[1,{gov:Xr,com:Xr,org:Xr,net:Xr,edu:Xr}],ro=[0,{"*":eo}],no=[1,{blogspot:eo}],io=[1,{gov:Xr}],oo=[0,{"*":Xr}],ao=[0,{cloud:eo}],so=[1,{co:eo}],co=[2,{nodes:eo}],lo=[0,{s3:eo}],uo=[0,{direct:eo}],ho=[2,{id:eo}],go=[0,{"webview-assets":eo}],bo=[0,{vfs:eo,"webview-assets":eo}],wo=[0,{"aws-cloud9":go,cloud9:bo}],Eo=[0,{dualstack:lo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:bo}],$o=[0,{dualstack:lo,s3:eo,"s3-website":eo,"aws-cloud9":go,cloud9:bo}],Co=[0,{dualstack:lo,"aws-cloud9":go,cloud9:bo}],Ro=[0,{apps:eo}],Oo=[0,{paas:eo}],jo=[0,{app:eo}],Bo=[2,{eu:eo}],Mo=[0,{site:eo}],Fo=[0,{pages:eo}],Wo=[1,{com:Xr,edu:Xr,net:Xr,org:Xr}],Jo=[0,{j:eo}],Po=[0,{jelastic:eo}],fo=[0,{user:eo}],yo=[1,{ybo:eo}],vo=[0,{cust:eo,reservd:eo}],_o=[0,{cust:eo}],So=[1,{gov:Xr,edu:Xr,mil:Xr,com:Xr,org:Xr,net:Xr}],To=[1,{edu:Xr,biz:Xr,net:Xr,org:Xr,gov:Xr,info:Xr,com:Xr}],Ao=[1,{gov:Xr,blogspot:eo}],ko=[1,{framer:eo}],mo=[1,{barsy:eo}],Io=[0,{forgot:eo}],Do=[1,{gs:Xr}],Lo=[0,{nes:Xr}],Ho=[1,{k12:Xr,cc:Xr,lib:Xr}],Yo=[1,{cc:Xr,lib:Xr}];return[0,{ac:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,mil:Xr,org:Xr,drr:eo}],ad:[1,{nom:Xr}],ae:[1,{co:Xr,net:Xr,org:Xr,sch:Xr,ac:Xr,gov:Xr,mil:Xr,blogspot:eo}],aero:[1,{"accident-investigation":Xr,"accident-prevention":Xr,aerobatic:Xr,aeroclub:Xr,aerodrome:Xr,agents:Xr,aircraft:Xr,airline:Xr,airport:Xr,"air-surveillance":Xr,airtraffic:Xr,"air-traffic-control":Xr,ambulance:Xr,amusement:Xr,association:Xr,author:Xr,ballooning:Xr,broker:Xr,caa:Xr,cargo:Xr,catering:Xr,certification:Xr,championship:Xr,charter:Xr,civilaviation:Xr,club:Xr,conference:Xr,consultant:Xr,consulting:Xr,control:Xr,council:Xr,crew:Xr,design:Xr,dgca:Xr,educator:Xr,emergency:Xr,engine:Xr,engineer:Xr,entertainment:Xr,equipment:Xr,exchange:Xr,express:Xr,federation:Xr,flight:Xr,fuel:Xr,gliding:Xr,government:Xr,groundhandling:Xr,group:Xr,hanggliding:Xr,homebuilt:Xr,insurance:Xr,journal:Xr,journalist:Xr,leasing:Xr,logistics:Xr,magazine:Xr,maintenance:Xr,media:Xr,microlight:Xr,modelling:Xr,navigation:Xr,parachuting:Xr,paragliding:Xr,"passenger-association":Xr,pilot:Xr,press:Xr,production:Xr,recreation:Xr,repbody:Xr,res:Xr,research:Xr,rotorcraft:Xr,safety:Xr,scientist:Xr,services:Xr,show:Xr,skydiving:Xr,software:Xr,student:Xr,trader:Xr,trading:Xr,trainer:Xr,union:Xr,workinggroup:Xr,works:Xr}],af:to,ag:[1,{com:Xr,org:Xr,net:Xr,co:Xr,nom:Xr}],ai:[1,{off:Xr,com:Xr,net:Xr,org:Xr,uwu:eo}],al:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,blogspot:eo}],am:[1,{co:Xr,com:Xr,commune:Xr,net:Xr,org:Xr,radio:eo,blogspot:eo,neko:eo,nyaa:eo}],ao:[1,{ed:Xr,gv:Xr,og:Xr,co:Xr,pb:Xr,it:Xr}],aq:Xr,ar:[1,{bet:Xr,com:no,coop:Xr,edu:Xr,gob:Xr,gov:Xr,int:Xr,mil:Xr,musica:Xr,mutual:Xr,net:Xr,org:Xr,senasa:Xr,tur:Xr}],arpa:[1,{e164:Xr,"in-addr":Xr,ip6:Xr,iris:Xr,uri:Xr,urn:Xr}],as:io,asia:[1,{cloudns:eo}],at:[1,{ac:[1,{sth:Xr}],co:no,gv:Xr,or:Xr,funkfeuer:[0,{wien:eo}],futurecms:[0,{"*":eo,ex:ro,in:ro}],futurehosting:eo,futuremailing:eo,ortsinfo:[0,{ex:ro,kunden:ro}],biz:eo,info:eo,"123webseite":eo,priv:eo,myspreadshop:eo,"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo}],au:[1,{com:[1,{blogspot:eo,cloudlets:[0,{mel:eo}],myspreadshop:eo}],net:Xr,org:Xr,edu:[1,{act:Xr,catholic:Xr,nsw:[1,{schools:Xr}],nt:Xr,qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],gov:[1,{qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],asn:Xr,id:Xr,info:Xr,conf:Xr,oz:Xr,act:Xr,nsw:Xr,nt:Xr,qld:Xr,sa:Xr,tas:Xr,vic:Xr,wa:Xr}],aw:[1,{com:Xr}],ax:[1,{be:eo,cat:eo,es:eo,eu:eo,gg:eo,mc:eo,us:eo,xy:eo}],az:[1,{com:Xr,net:Xr,int:Xr,gov:Xr,org:Xr,edu:Xr,info:Xr,pp:Xr,mil:Xr,name:Xr,pro:Xr,biz:Xr}],ba:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,rs:eo,blogspot:eo}],bb:[1,{biz:Xr,co:Xr,com:Xr,edu:Xr,gov:Xr,info:Xr,net:Xr,org:Xr,store:Xr,tv:Xr}],bd:oo,be:[1,{ac:Xr,webhosting:eo,blogspot:eo,interhostsolutions:ao,kuleuven:[0,{ezproxy:eo}],"123website":eo,myspreadshop:eo,transurl:ro}],bf:io,bg:[1,{0:Xr,1:Xr,2:Xr,3:Xr,4:Xr,5:Xr,6:Xr,7:Xr,8:Xr,9:Xr,a:Xr,b:Xr,c:Xr,d:Xr,e:Xr,f:Xr,g:Xr,h:Xr,i:Xr,j:Xr,k:Xr,l:Xr,m:Xr,n:Xr,o:Xr,p:Xr,q:Xr,r:Xr,s:Xr,t:Xr,u:Xr,v:Xr,w:Xr,x:Xr,y:Xr,z:Xr,blogspot:eo,barsy:eo}],bh:to,bi:[1,{co:Xr,com:Xr,edu:Xr,or:Xr,org:Xr}],biz:[1,{activetrail:eo,cloudns:eo,jozi:eo,dyndns:eo,"for-better":eo,"for-more":eo,"for-some":eo,"for-the":eo,selfip:eo,webhop:eo,orx:eo,mmafan:eo,myftp:eo,"no-ip":eo,dscloud:eo}],bj:[1,{africa:Xr,agro:Xr,architectes:Xr,assur:Xr,avocats:Xr,co:Xr,com:Xr,eco:Xr,econo:Xr,edu:Xr,info:Xr,loisirs:Xr,money:Xr,net:Xr,org:Xr,ote:Xr,resto:Xr,restaurant:Xr,tourism:Xr,univ:Xr,blogspot:eo}],bm:to,bn:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,co:eo}],bo:[1,{com:Xr,edu:Xr,gob:Xr,int:Xr,org:Xr,net:Xr,mil:Xr,tv:Xr,web:Xr,academia:Xr,agro:Xr,arte:Xr,blog:Xr,bolivia:Xr,ciencia:Xr,cooperativa:Xr,democracia:Xr,deporte:Xr,ecologia:Xr,economia:Xr,empresa:Xr,indigena:Xr,industria:Xr,info:Xr,medicina:Xr,movimiento:Xr,musica:Xr,natural:Xr,nombre:Xr,noticias:Xr,patria:Xr,politica:Xr,profesional:Xr,plurinacional:Xr,pueblo:Xr,revista:Xr,salud:Xr,tecnologia:Xr,tksat:Xr,transporte:Xr,wiki:Xr}],br:[1,{"9guacu":Xr,abc:Xr,adm:Xr,adv:Xr,agr:Xr,aju:Xr,am:Xr,anani:Xr,aparecida:Xr,app:Xr,arq:Xr,art:Xr,ato:Xr,b:Xr,barueri:Xr,belem:Xr,bhz:Xr,bib:Xr,bio:Xr,blog:Xr,bmd:Xr,boavista:Xr,bsb:Xr,campinagrande:Xr,campinas:Xr,caxias:Xr,cim:Xr,cng:Xr,cnt:Xr,com:[1,{blogspot:eo,simplesite:eo}],contagem:Xr,coop:Xr,coz:Xr,cri:Xr,cuiaba:Xr,curitiba:Xr,def:Xr,des:Xr,det:Xr,dev:Xr,ecn:Xr,eco:Xr,edu:Xr,emp:Xr,enf:Xr,eng:Xr,esp:Xr,etc:Xr,eti:Xr,far:Xr,feira:Xr,flog:Xr,floripa:Xr,fm:Xr,fnd:Xr,fortal:Xr,fot:Xr,foz:Xr,fst:Xr,g12:Xr,geo:Xr,ggf:Xr,goiania:Xr,gov:[1,{ac:Xr,al:Xr,am:Xr,ap:Xr,ba:Xr,ce:Xr,df:Xr,es:Xr,go:Xr,ma:Xr,mg:Xr,ms:Xr,mt:Xr,pa:Xr,pb:Xr,pe:Xr,pi:Xr,pr:Xr,rj:Xr,rn:Xr,ro:Xr,rr:Xr,rs:Xr,sc:Xr,se:Xr,sp:Xr,to:Xr}],gru:Xr,imb:Xr,ind:Xr,inf:Xr,jab:Xr,jampa:Xr,jdf:Xr,joinville:Xr,jor:Xr,jus:Xr,leg:[1,{ac:eo,al:eo,am:eo,ap:eo,ba:eo,ce:eo,df:eo,es:eo,go:eo,ma:eo,mg:eo,ms:eo,mt:eo,pa:eo,pb:eo,pe:eo,pi:eo,pr:eo,rj:eo,rn:eo,ro:eo,rr:eo,rs:eo,sc:eo,se:eo,sp:eo,to:eo}],lel:Xr,log:Xr,londrina:Xr,macapa:Xr,maceio:Xr,manaus:Xr,maringa:Xr,mat:Xr,med:Xr,mil:Xr,morena:Xr,mp:Xr,mus:Xr,natal:Xr,net:Xr,niteroi:Xr,nom:oo,not:Xr,ntr:Xr,odo:Xr,ong:Xr,org:Xr,osasco:Xr,palmas:Xr,poa:Xr,ppg:Xr,pro:Xr,psc:Xr,psi:Xr,pvh:Xr,qsl:Xr,radio:Xr,rec:Xr,recife:Xr,rep:Xr,ribeirao:Xr,rio:Xr,riobranco:Xr,riopreto:Xr,salvador:Xr,sampa:Xr,santamaria:Xr,santoandre:Xr,saobernardo:Xr,saogonca:Xr,seg:Xr,sjc:Xr,slg:Xr,slz:Xr,sorocaba:Xr,srv:Xr,taxi:Xr,tc:Xr,tec:Xr,teo:Xr,the:Xr,tmp:Xr,trd:Xr,tur:Xr,tv:Xr,udi:Xr,vet:Xr,vix:Xr,vlog:Xr,wiki:Xr,zlg:Xr}],bs:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,gov:Xr,we:eo}],bt:to,bv:Xr,bw:[1,{co:Xr,org:Xr}],by:[1,{gov:Xr,mil:Xr,com:no,of:Xr,mycloud:eo,mediatech:eo}],bz:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,gov:Xr,za:eo,gsj:eo}],ca:[1,{ab:Xr,bc:Xr,mb:Xr,nb:Xr,nf:Xr,nl:Xr,ns:Xr,nt:Xr,nu:Xr,on:Xr,pe:Xr,qc:Xr,sk:Xr,yk:Xr,gc:Xr,barsy:eo,awdev:ro,co:eo,blogspot:eo,"no-ip":eo,myspreadshop:eo}],cat:Xr,cc:[1,{cloudns:eo,ftpaccess:eo,"game-server":eo,myphotos:eo,scrapping:eo,twmail:eo,csx:eo,fantasyleague:eo,spawn:[0,{instances:eo}]}],cd:io,cf:no,cg:Xr,ch:[1,{square7:eo,blogspot:eo,flow:[0,{ae:[0,{alp1:eo}],appengine:eo}],"linkyard-cloud":eo,dnsking:eo,gotdns:eo,"123website":eo,myspreadshop:eo,firenet:[0,{"*":eo,svc:ro}],"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo}],ci:[1,{org:Xr,or:Xr,com:Xr,co:Xr,edu:Xr,ed:Xr,ac:Xr,net:Xr,go:Xr,asso:Xr,"xn--aroport-bya":Xr,aéroport:Xr,int:Xr,presse:Xr,md:Xr,gouv:Xr,fin:eo,nl:eo}],ck:oo,cl:[1,{co:Xr,gob:Xr,gov:Xr,mil:Xr,blogspot:eo}],cm:[1,{co:Xr,com:Xr,gov:Xr,net:Xr}],cn:[1,{ac:Xr,com:[1,{amazonaws:[0,{compute:ro,"cn-north-1":lo,eb:[0,{"cn-north-1":eo,"cn-northwest-1":eo}],elb:ro}]}],edu:Xr,gov:Xr,net:Xr,org:Xr,mil:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--od0alg":Xr,網絡:Xr,ah:Xr,bj:Xr,cq:Xr,fj:Xr,gd:Xr,gs:Xr,gz:Xr,gx:Xr,ha:Xr,hb:Xr,he:Xr,hi:Xr,hl:Xr,hn:Xr,jl:Xr,js:Xr,jx:Xr,ln:Xr,nm:Xr,nx:Xr,qh:Xr,sc:Xr,sd:Xr,sh:Xr,sn:Xr,sx:Xr,tj:Xr,xj:Xr,xz:Xr,yn:Xr,zj:Xr,hk:Xr,mo:Xr,tw:Xr,"canva-apps":eo,instantcloud:eo,quickconnect:uo}],co:[1,{arts:Xr,com:no,edu:Xr,firm:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,rec:Xr,web:Xr,carrd:eo,crd:eo,otap:ro,leadpages:eo,lpages:eo,mypi:eo,n4t:eo,firewalledreplit:ho,repl:ho,supabase:eo}],com:[1,{devcdnaccesso:ro,adobeaemcloud:[2,{dev:ro}],airkitapps:eo,"airkitapps-au":eo,aivencloud:eo,kasserver:eo,amazonaws:[0,{compute:ro,"compute-1":ro,"us-east-1":[2,{dualstack:lo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:bo}],"ap-northeast-1":Eo,"ap-northeast-2":$o,"ap-south-1":$o,"ap-southeast-1":Co,"ap-southeast-2":Co,"ca-central-1":$o,"eu-central-1":$o,"eu-west-1":Eo,"eu-west-2":$o,"eu-west-3":$o,s3:eo,"s3-ap-northeast-1":eo,"s3-ap-northeast-2":eo,"s3-ap-south-1":eo,"s3-ap-southeast-1":eo,"s3-ap-southeast-2":eo,"s3-ca-central-1":eo,"s3-eu-central-1":eo,"s3-eu-west-1":eo,"s3-eu-west-2":eo,"s3-eu-west-3":eo,"s3-external-1":eo,"s3-fips-us-gov-west-1":eo,"s3-sa-east-1":eo,"s3-us-east-2":eo,"s3-us-gov-west-1":eo,"s3-us-west-1":eo,"s3-us-west-2":eo,"s3-website-ap-northeast-1":eo,"s3-website-ap-southeast-1":eo,"s3-website-ap-southeast-2":eo,"s3-website-eu-west-1":eo,"s3-website-sa-east-1":eo,"s3-website-us-east-1":eo,"s3-website-us-west-1":eo,"s3-website-us-west-2":eo,"sa-east-1":Co,"us-east-2":[0,{dualstack:lo,s3:eo,"s3-website":eo,"analytics-gateway":eo,"aws-cloud9":go,cloud9:bo}],"us-west-2":[0,{"analytics-gateway":eo,"aws-cloud9":go,cloud9:bo}],"af-south-1":wo,"ap-east-1":wo,"ap-northeast-3":wo,"eu-north-1":wo,"eu-south-1":wo,"me-south-1":wo,"us-west-1":wo,elb:ro}],elasticbeanstalk:[2,{"ap-northeast-1":eo,"ap-northeast-2":eo,"ap-northeast-3":eo,"ap-south-1":eo,"ap-southeast-1":eo,"ap-southeast-2":eo,"ca-central-1":eo,"eu-central-1":eo,"eu-west-1":eo,"eu-west-2":eo,"eu-west-3":eo,"sa-east-1":eo,"us-east-1":eo,"us-east-2":eo,"us-gov-west-1":eo,"us-west-1":eo,"us-west-2":eo}],awsglobalaccelerator:eo,siiites:eo,appspacehosted:eo,appspaceusercontent:eo,"on-aptible":eo,myasustor:eo,"balena-devices":eo,betainabox:eo,boutir:eo,bplaced:eo,cafjs:eo,"canva-apps":eo,br:eo,cn:eo,de:eo,eu:eo,jpn:eo,mex:eo,ru:eo,sa:eo,uk:eo,us:eo,za:eo,ar:eo,hu:eo,kr:eo,no:eo,qc:eo,uy:eo,africa:eo,gr:eo,co:eo,jdevcloud:eo,wpdevcloud:eo,cloudcontrolled:eo,cloudcontrolapp:eo,"cf-ipfs":eo,"cloudflare-ipfs":eo,trycloudflare:eo,"customer-oci":[0,{"*":eo,oci:ro,ocp:ro,ocs:ro}],dattolocal:eo,dattorelay:eo,dattoweb:eo,mydatto:eo,builtwithdark:eo,datadetect:[0,{demo:eo,instance:eo}],ddns5:eo,discordsays:eo,discordsez:eo,drayddns:eo,dreamhosters:eo,mydrobo:eo,"dyndns-at-home":eo,"dyndns-at-work":eo,"dyndns-blog":eo,"dyndns-free":eo,"dyndns-home":eo,"dyndns-ip":eo,"dyndns-mail":eo,"dyndns-office":eo,"dyndns-pics":eo,"dyndns-remote":eo,"dyndns-server":eo,"dyndns-web":eo,"dyndns-wiki":eo,"dyndns-work":eo,blogdns:eo,cechire:eo,dnsalias:eo,dnsdojo:eo,doesntexist:eo,dontexist:eo,doomdns:eo,"dyn-o-saur":eo,dynalias:eo,"est-a-la-maison":eo,"est-a-la-masion":eo,"est-le-patron":eo,"est-mon-blogueur":eo,"from-ak":eo,"from-al":eo,"from-ar":eo,"from-ca":eo,"from-ct":eo,"from-dc":eo,"from-de":eo,"from-fl":eo,"from-ga":eo,"from-hi":eo,"from-ia":eo,"from-id":eo,"from-il":eo,"from-in":eo,"from-ks":eo,"from-ky":eo,"from-ma":eo,"from-md":eo,"from-mi":eo,"from-mn":eo,"from-mo":eo,"from-ms":eo,"from-mt":eo,"from-nc":eo,"from-nd":eo,"from-ne":eo,"from-nh":eo,"from-nj":eo,"from-nm":eo,"from-nv":eo,"from-oh":eo,"from-ok":eo,"from-or":eo,"from-pa":eo,"from-pr":eo,"from-ri":eo,"from-sc":eo,"from-sd":eo,"from-tn":eo,"from-tx":eo,"from-ut":eo,"from-va":eo,"from-vt":eo,"from-wa":eo,"from-wi":eo,"from-wv":eo,"from-wy":eo,getmyip:eo,gotdns:eo,"hobby-site":eo,homelinux:eo,homeunix:eo,iamallama:eo,"is-a-anarchist":eo,"is-a-blogger":eo,"is-a-bookkeeper":eo,"is-a-bulls-fan":eo,"is-a-caterer":eo,"is-a-chef":eo,"is-a-conservative":eo,"is-a-cpa":eo,"is-a-cubicle-slave":eo,"is-a-democrat":eo,"is-a-designer":eo,"is-a-doctor":eo,"is-a-financialadvisor":eo,"is-a-geek":eo,"is-a-green":eo,"is-a-guru":eo,"is-a-hard-worker":eo,"is-a-hunter":eo,"is-a-landscaper":eo,"is-a-lawyer":eo,"is-a-liberal":eo,"is-a-libertarian":eo,"is-a-llama":eo,"is-a-musician":eo,"is-a-nascarfan":eo,"is-a-nurse":eo,"is-a-painter":eo,"is-a-personaltrainer":eo,"is-a-photographer":eo,"is-a-player":eo,"is-a-republican":eo,"is-a-rockstar":eo,"is-a-socialist":eo,"is-a-student":eo,"is-a-teacher":eo,"is-a-techie":eo,"is-a-therapist":eo,"is-an-accountant":eo,"is-an-actor":eo,"is-an-actress":eo,"is-an-anarchist":eo,"is-an-artist":eo,"is-an-engineer":eo,"is-an-entertainer":eo,"is-certified":eo,"is-gone":eo,"is-into-anime":eo,"is-into-cars":eo,"is-into-cartoons":eo,"is-into-games":eo,"is-leet":eo,"is-not-certified":eo,"is-slick":eo,"is-uberleet":eo,"is-with-theband":eo,"isa-geek":eo,"isa-hockeynut":eo,issmarterthanyou:eo,"likes-pie":eo,likescandy:eo,"neat-url":eo,"saves-the-whales":eo,selfip:eo,"sells-for-less":eo,"sells-for-u":eo,servebbs:eo,"simple-url":eo,"space-to-rent":eo,"teaches-yoga":eo,writesthisblog:eo,digitaloceanspaces:ro,ddnsfree:eo,ddnsgeek:eo,giize:eo,gleeze:eo,kozow:eo,loseyourip:eo,ooguy:eo,theworkpc:eo,mytuleap:eo,"tuleap-partners":eo,encoreapi:eo,evennode:[0,{"eu-1":eo,"eu-2":eo,"eu-3":eo,"eu-4":eo,"us-1":eo,"us-2":eo,"us-3":eo,"us-4":eo}],onfabrica:eo,fbsbx:Ro,"fastly-edge":eo,"fastly-terrarium":eo,"fastvps-server":eo,mydobiss:eo,firebaseapp:eo,fldrv:eo,forgeblocks:eo,framercanvas:eo,"freebox-os":eo,freeboxos:eo,freemyip:eo,gentapps:eo,gentlentapis:eo,githubusercontent:eo,"0emm":ro,appspot:[2,{r:ro}],codespot:eo,googleapis:eo,googlecode:eo,pagespeedmobilizer:eo,publishproxy:eo,withgoogle:eo,withyoutube:eo,blogspot:eo,awsmppl:eo,herokuapp:eo,herokussl:eo,impertrixcdn:eo,impertrix:eo,smushcdn:eo,wphostedmail:eo,wpmucdn:eo,pixolino:eo,amscompute:eo,dopaas:eo,"hosted-by-previder":Oo,hosteur:[0,{"rag-cloud":eo,"rag-cloud-ch":eo}],"ik-server":[0,{jcloud:eo,"jcloud-ver-jpc":eo}],jelastic:[0,{demo:eo}],kilatiron:eo,massivegrid:Oo,wafaicloud:[0,{jed:eo,lon:eo,ryd:eo}],joyent:[0,{cns:ro}],ktistory:eo,lpusercontent:eo,lmpm:jo,linode:[0,{members:eo,nodebalancer:ro}],linodeobjects:ro,linodeusercontent:[0,{ip:eo}],barsycenter:eo,barsyonline:eo,mazeplay:eo,miniserver:eo,meteorapp:Bo,hostedpi:eo,"mythic-beasts":[0,{customer:eo,caracal:eo,fentiger:eo,lynx:eo,ocelot:eo,oncilla:eo,onza:eo,sphinx:eo,vs:eo,x:eo,yali:eo}],nospamproxy:ao,"4u":eo,nfshost:eo,"001www":eo,ddnslive:eo,myiphost:eo,blogsyte:eo,ciscofreak:eo,damnserver:eo,ditchyourip:eo,dnsiskinky:eo,dynns:eo,geekgalaxy:eo,"health-carereform":eo,homesecuritymac:eo,homesecuritypc:eo,myactivedirectory:eo,mysecuritycamera:eo,"net-freaks":eo,onthewifi:eo,point2this:eo,quicksytes:eo,securitytactics:eo,serveexchange:eo,servehumour:eo,servep2p:eo,servesarcasm:eo,stufftoread:eo,unusualperson:eo,workisboring:eo,"3utilities":eo,ddnsking:eo,myvnc:eo,servebeer:eo,servecounterstrike:eo,serveftp:eo,servegame:eo,servehalflife:eo,servehttp:eo,serveirc:eo,servemp3:eo,servepics:eo,servequake:eo,observableusercontent:[0,{static:eo}],simplesite:eo,orsites:eo,operaunite:eo,"authgear-staging":eo,authgearapps:eo,skygearapp:eo,outsystemscloud:eo,ownprovider:eo,pgfog:eo,pagefrontapp:eo,pagexl:eo,paywhirl:ro,gotpantheon:eo,"platter-app":eo,pleskns:eo,"postman-echo":eo,prgmr:[0,{xen:eo}],pythonanywhere:Bo,qualifioapp:eo,ladesk:eo,qbuser:eo,qa2:eo,"dev-myqnapcloud":eo,"alpha-myqnapcloud":eo,myqnapcloud:eo,quipelements:ro,rackmaze:eo,rhcloud:eo,render:jo,onrender:eo,"180r":eo,dojin:eo,sakuratan:eo,sakuraweb:eo,x0:eo,code:[0,{builder:ro,"dev-builder":ro,"stg-builder":ro}],logoip:eo,scrysec:eo,"firewall-gateway":eo,myshopblocks:eo,myshopify:eo,shopitsite:eo,"1kapp":eo,appchizi:eo,applinzi:eo,sinaapp:eo,vipsinaapp:eo,"bounty-full":[2,{alpha:eo,beta:eo}],streamlitapp:eo,"try-snowplow":eo,"stackhero-network":eo,"playstation-cloud":eo,myspreadshop:eo,stdlib:[0,{api:eo}],"temp-dns":eo,dsmynas:eo,familyds:eo,mytabit:eo,"tb-hosting":Mo,reservd:eo,thingdustdata:eo,bloxcms:eo,"townnews-staging":eo,typeform:[0,{pro:eo}],hk:eo,it:eo,vultrobjects:ro,wafflecell:eo,"reserve-online":eo,hotelwithflight:eo,remotewd:eo,wiardweb:Fo,messwithdns:eo,"woltlab-demo":eo,wpenginepowered:[2,{js:eo}],wixsite:eo,xnbay:[2,{u2:eo,"u2-local":eo}],yolasite:eo}],coop:Xr,cr:[1,{ac:Xr,co:Xr,ed:Xr,fi:Xr,go:Xr,or:Xr,sa:Xr}],cu:[1,{com:Xr,edu:Xr,org:Xr,net:Xr,gov:Xr,inf:Xr}],cv:[1,{com:Xr,edu:Xr,int:Xr,nome:Xr,org:Xr,blogspot:eo}],cw:Wo,cx:[1,{gov:Xr,ath:eo,info:eo}],cy:[1,{ac:Xr,biz:Xr,com:[1,{blogspot:eo,scaleforce:Jo}],ekloges:Xr,gov:Xr,ltd:Xr,mil:Xr,net:Xr,org:Xr,press:Xr,pro:Xr,tm:Xr}],cz:[1,{co:eo,realm:eo,e4:eo,blogspot:eo,metacentrum:[0,{cloud:ro,custom:eo}],muni:[0,{cloud:[0,{flt:eo,usr:eo}]}]}],de:[1,{bplaced:eo,square7:eo,com:eo,cosidns:[0,{dyn:eo}],"dynamisches-dns":eo,dnsupdater:eo,"internet-dns":eo,"l-o-g-i-n":eo,dnshome:eo,fuettertdasnetz:eo,isteingeek:eo,istmein:eo,lebtimnetz:eo,leitungsen:eo,traeumtgerade:eo,ddnss:[2,{dyn:eo,dyndns:eo}],dyndns1:eo,"dyn-ip24":eo,"home-webserver":[2,{dyn:eo}],"myhome-server":eo,frusky:ro,goip:eo,blogspot:eo,"xn--gnstigbestellen-zvb":eo,günstigbestellen:eo,"xn--gnstigliefern-wob":eo,günstigliefern:eo,"hs-heilbronn":[0,{it:Fo}],"dyn-berlin":eo,"in-berlin":eo,"in-brb":eo,"in-butter":eo,"in-dsl":eo,"in-vpn":eo,iservschule:eo,"mein-iserv":eo,schulplattform:eo,schulserver:eo,"test-iserv":eo,keymachine:eo,"git-repos":eo,"lcube-server":eo,"svn-repos":eo,barsy:eo,"123webseite":eo,logoip:eo,"firewall-gateway":eo,"my-gateway":eo,"my-router":eo,spdns:eo,speedpartner:[0,{customer:eo}],myspreadshop:eo,"taifun-dns":eo,"12hp":eo,"2ix":eo,"4lima":eo,"lima-city":eo,"dd-dns":eo,"dray-dns":eo,draydns:eo,"dyn-vpn":eo,dynvpn:eo,"mein-vigor":eo,"my-vigor":eo,"my-wan":eo,"syno-ds":eo,"synology-diskstation":eo,"synology-ds":eo,uberspace:ro,virtualuser:eo,"virtual-user":eo,"community-pro":eo,diskussionsbereich:eo}],dj:Xr,dk:[1,{biz:eo,co:eo,firm:eo,reg:eo,store:eo,blogspot:eo,"123hjemmeside":eo,myspreadshop:eo}],dm:to,do:[1,{art:Xr,com:Xr,edu:Xr,gob:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr,sld:Xr,web:Xr}],dz:[1,{art:Xr,asso:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,net:Xr,pol:Xr,soc:Xr,tm:Xr}],ec:[1,{com:Xr,info:Xr,net:Xr,fin:Xr,k12:Xr,med:Xr,pro:Xr,org:Xr,edu:Xr,gov:Xr,gob:Xr,mil:Xr,base:eo,official:eo}],edu:[1,{rit:[0,{"git-pages":eo}]}],ee:[1,{edu:Xr,gov:Xr,riik:Xr,lib:Xr,med:Xr,com:no,pri:Xr,aip:Xr,org:Xr,fie:Xr}],eg:[1,{com:no,edu:Xr,eun:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,sci:Xr}],er:oo,es:[1,{com:no,nom:Xr,org:Xr,gob:Xr,edu:Xr,"123miweb":eo,myspreadshop:eo}],et:[1,{com:Xr,gov:Xr,org:Xr,edu:Xr,biz:Xr,name:Xr,info:Xr,net:Xr}],eu:[1,{airkitapps:eo,mycd:eo,cloudns:eo,dogado:Po,barsy:eo,wellbeingzone:eo,spdns:eo,transurl:ro,diskstation:eo}],fi:[1,{aland:Xr,dy:eo,blogspot:eo,"xn--hkkinen-5wa":eo,häkkinen:eo,iki:eo,cloudplatform:[0,{fi:eo}],datacenter:[0,{demo:eo,paas:eo}],kapsi:eo,"123kotisivu":eo,myspreadshop:eo}],fj:[1,{ac:Xr,biz:Xr,com:Xr,gov:Xr,info:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,pro:Xr}],fk:oo,fm:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,radio:eo,user:ro}],fo:Xr,fr:[1,{asso:Xr,com:Xr,gouv:Xr,nom:Xr,prd:Xr,tm:Xr,avoues:Xr,cci:Xr,greta:Xr,"huissier-justice":Xr,"en-root":eo,"fbx-os":eo,fbxos:eo,"freebox-os":eo,freeboxos:eo,blogspot:eo,goupile:eo,"123siteweb":eo,"on-web":eo,"chirurgiens-dentistes-en-france":eo,dedibox:eo,aeroport:eo,avocat:eo,chambagri:eo,"chirurgiens-dentistes":eo,"experts-comptables":eo,medecin:eo,notaires:eo,pharmacien:eo,port:eo,veterinaire:eo,myspreadshop:eo,ynh:eo}],ga:Xr,gb:Xr,gd:[1,{edu:Xr,gov:Xr}],ge:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr,net:Xr,pvt:Xr}],gf:Xr,gg:[1,{co:Xr,net:Xr,org:Xr,kaas:eo,cya:eo,panel:[2,{daemon:eo}]}],gh:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr}],gi:[1,{com:Xr,ltd:Xr,gov:Xr,mod:Xr,edu:Xr,org:Xr}],gl:[1,{co:Xr,com:Xr,edu:Xr,net:Xr,org:Xr,biz:eo,xx:eo}],gm:Xr,gn:[1,{ac:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,net:Xr}],gov:Xr,gp:[1,{com:Xr,net:Xr,mobi:Xr,edu:Xr,org:Xr,asso:Xr,app:eo}],gq:Xr,gr:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,gov:Xr,blogspot:eo,simplesite:eo}],gs:Xr,gt:[1,{com:Xr,edu:Xr,gob:Xr,ind:Xr,mil:Xr,net:Xr,org:Xr,blog:eo,de:eo,to:eo}],gu:[1,{com:Xr,edu:Xr,gov:Xr,guam:Xr,info:Xr,net:Xr,org:Xr,web:Xr}],gw:Xr,gy:[1,{co:Xr,com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,be:eo}],hk:[1,{com:Xr,edu:Xr,gov:Xr,idv:Xr,net:Xr,org:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--wcvs22d":Xr,教育:Xr,"xn--lcvr32d":Xr,敎育:Xr,"xn--mxtq1m":Xr,政府:Xr,"xn--gmqw5a":Xr,個人:Xr,"xn--ciqpn":Xr,个人:Xr,"xn--gmq050i":Xr,箇人:Xr,"xn--zf0avx":Xr,網络:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--mk0axi":Xr,组織:Xr,"xn--od0alg":Xr,網絡:Xr,"xn--od0aq3b":Xr,网絡:Xr,"xn--tn0ag":Xr,组织:Xr,"xn--uc0atv":Xr,組織:Xr,"xn--uc0ay4a":Xr,組织:Xr,blogspot:eo,secaas:eo,ltd:eo,inc:eo}],hm:Xr,hn:[1,{com:Xr,edu:Xr,org:Xr,net:Xr,mil:Xr,gob:Xr,cc:eo}],hr:[1,{iz:Xr,from:Xr,name:Xr,com:Xr,blogspot:eo,free:eo}],ht:[1,{com:Xr,shop:Xr,firm:Xr,info:Xr,adult:Xr,net:Xr,pro:Xr,org:Xr,med:Xr,art:Xr,coop:Xr,pol:Xr,asso:Xr,edu:Xr,rel:Xr,gouv:Xr,perso:Xr}],hu:[1,{2e3:Xr,co:Xr,info:Xr,org:Xr,priv:Xr,sport:Xr,tm:Xr,agrar:Xr,bolt:Xr,casino:Xr,city:Xr,erotica:Xr,erotika:Xr,film:Xr,forum:Xr,games:Xr,hotel:Xr,ingatlan:Xr,jogasz:Xr,konyvelo:Xr,lakas:Xr,media:Xr,news:Xr,reklam:Xr,sex:Xr,shop:Xr,suli:Xr,szex:Xr,tozsde:Xr,utazas:Xr,video:Xr,blogspot:eo}],id:[1,{ac:Xr,biz:Xr,co:no,desa:Xr,go:Xr,mil:Xr,my:[1,{rss:ro}],net:Xr,or:Xr,ponpes:Xr,sch:Xr,web:Xr,flap:eo,forte:eo}],ie:[1,{gov:Xr,blogspot:eo,myspreadshop:eo}],il:[1,{ac:Xr,co:[1,{ravpage:eo,blogspot:eo,tabitorder:eo,mytabit:eo}],gov:Xr,idf:Xr,k12:Xr,muni:Xr,net:Xr,org:Xr}],"xn--4dbrk0ce":[1,{"xn--4dbgdty6c":Xr,"xn--5dbhl8d":Xr,"xn--8dbq2a":Xr,"xn--hebda8b":Xr}],ישראל:[1,{אקדמיה:Xr,ישוב:Xr,צהל:Xr,ממשל:Xr}],im:[1,{ac:Xr,co:[1,{ltd:Xr,plc:Xr}],com:Xr,net:Xr,org:Xr,tt:Xr,tv:Xr,ro:eo}],in:[1,{"5g":Xr,"6g":Xr,ac:Xr,ai:Xr,am:Xr,bihar:Xr,biz:Xr,business:Xr,ca:Xr,cn:Xr,co:Xr,com:Xr,coop:Xr,cs:Xr,delhi:Xr,dr:Xr,edu:Xr,er:Xr,firm:Xr,gen:Xr,gov:Xr,gujarat:Xr,ind:Xr,info:Xr,int:Xr,internet:Xr,io:Xr,me:Xr,mil:Xr,net:Xr,nic:Xr,org:Xr,pg:Xr,post:Xr,pro:Xr,res:Xr,travel:Xr,tv:Xr,uk:Xr,up:Xr,us:Xr,web:eo,cloudns:eo,blogspot:eo,barsy:eo,supabase:eo}],info:[1,{cloudns:eo,"dynamic-dns":eo,dyndns:eo,"barrel-of-knowledge":eo,"barrell-of-knowledge":eo,"for-our":eo,"groks-the":eo,"groks-this":eo,"here-for-more":eo,knowsitall:eo,selfip:eo,webhop:eo,barsy:eo,mayfirst:eo,forumz:eo,nsupdate:eo,dvrcam:eo,ilovecollege:eo,"no-ip":eo,dnsupdate:eo,"v-info":eo}],int:[1,{eu:Xr}],io:[1,{2038:eo,com:Xr,"on-acorn":ro,apigee:eo,"b-data":eo,backplaneapp:eo,banzaicloud:[0,{app:eo,backyards:ro}],beagleboard:eo,bitbucket:eo,bluebite:eo,boxfuse:eo,browsersafetymark:eo,bigv:[0,{uk0:eo}],cleverapps:eo,dappnode:[0,{dyndns:eo}],dedyn:eo,drud:eo,definima:eo,"fh-muenster":eo,shw:eo,forgerock:[0,{id:eo}],ghost:eo,github:eo,gitlab:eo,lolipop:eo,"hasura-app":eo,hostyhosting:eo,moonscale:ro,beebyte:Oo,beebyteapp:[0,{sekd1:eo}],jele:eo,unispace:[0,{"cloud-fr1":eo}],webthings:eo,loginline:eo,barsy:eo,azurecontainer:ro,ngrok:[2,{ap:eo,au:eo,eu:eo,in:eo,jp:eo,sa:eo,us:eo}],nodeart:[0,{stage:eo}],nid:eo,pantheonsite:eo,dyn53:eo,pstmn:[2,{mock:eo}],protonet:eo,qoto:eo,qcx:[2,{sys:ro}],vaporcloud:eo,vbrplsbx:[0,{g:eo}],"on-k3s":ro,"on-rio":ro,readthedocs:eo,resindevice:eo,resinstaging:[0,{devices:eo}],hzc:eo,sandcats:eo,shiftcrypto:eo,shiftedit:eo,"mo-siemens":eo,musician:eo,lair:Ro,stolos:ro,spacekit:eo,utwente:eo,s5y:ro,edugit:eo,telebit:eo,thingdust:[0,{dev:vo,disrec:vo,prod:_o,testing:vo}],tickets:eo,upli:eo,wedeploy:eo,editorx:eo,wixstudio:eo,basicserver:eo,virtualserver:eo}],iq:So,ir:[1,{ac:Xr,co:Xr,gov:Xr,id:Xr,net:Xr,org:Xr,sch:Xr,"xn--mgba3a4f16a":Xr,ایران:Xr,"xn--mgba3a4fra":Xr,ايران:Xr}],is:[1,{net:Xr,com:Xr,edu:Xr,gov:Xr,org:Xr,int:Xr,cupcake:eo,blogspot:eo}],it:[1,{gov:Xr,edu:Xr,abr:Xr,abruzzo:Xr,"aosta-valley":Xr,aostavalley:Xr,bas:Xr,basilicata:Xr,cal:Xr,calabria:Xr,cam:Xr,campania:Xr,"emilia-romagna":Xr,emiliaromagna:Xr,emr:Xr,"friuli-v-giulia":Xr,"friuli-ve-giulia":Xr,"friuli-vegiulia":Xr,"friuli-venezia-giulia":Xr,"friuli-veneziagiulia":Xr,"friuli-vgiulia":Xr,"friuliv-giulia":Xr,"friulive-giulia":Xr,friulivegiulia:Xr,"friulivenezia-giulia":Xr,friuliveneziagiulia:Xr,friulivgiulia:Xr,fvg:Xr,laz:Xr,lazio:Xr,lig:Xr,liguria:Xr,lom:Xr,lombardia:Xr,lombardy:Xr,lucania:Xr,mar:Xr,marche:Xr,mol:Xr,molise:Xr,piedmont:Xr,piemonte:Xr,pmn:Xr,pug:Xr,puglia:Xr,sar:Xr,sardegna:Xr,sardinia:Xr,sic:Xr,sicilia:Xr,sicily:Xr,taa:Xr,tos:Xr,toscana:Xr,"trentin-sud-tirol":Xr,"xn--trentin-sd-tirol-rzb":Xr,"trentin-süd-tirol":Xr,"trentin-sudtirol":Xr,"xn--trentin-sdtirol-7vb":Xr,"trentin-südtirol":Xr,"trentin-sued-tirol":Xr,"trentin-suedtirol":Xr,"trentino-a-adige":Xr,"trentino-aadige":Xr,"trentino-alto-adige":Xr,"trentino-altoadige":Xr,"trentino-s-tirol":Xr,"trentino-stirol":Xr,"trentino-sud-tirol":Xr,"xn--trentino-sd-tirol-c3b":Xr,"trentino-süd-tirol":Xr,"trentino-sudtirol":Xr,"xn--trentino-sdtirol-szb":Xr,"trentino-südtirol":Xr,"trentino-sued-tirol":Xr,"trentino-suedtirol":Xr,trentino:Xr,"trentinoa-adige":Xr,trentinoaadige:Xr,"trentinoalto-adige":Xr,trentinoaltoadige:Xr,"trentinos-tirol":Xr,trentinostirol:Xr,"trentinosud-tirol":Xr,"xn--trentinosd-tirol-rzb":Xr,"trentinosüd-tirol":Xr,trentinosudtirol:Xr,"xn--trentinosdtirol-7vb":Xr,trentinosüdtirol:Xr,"trentinosued-tirol":Xr,trentinosuedtirol:Xr,"trentinsud-tirol":Xr,"xn--trentinsd-tirol-6vb":Xr,"trentinsüd-tirol":Xr,trentinsudtirol:Xr,"xn--trentinsdtirol-nsb":Xr,trentinsüdtirol:Xr,"trentinsued-tirol":Xr,trentinsuedtirol:Xr,tuscany:Xr,umb:Xr,umbria:Xr,"val-d-aosta":Xr,"val-daosta":Xr,"vald-aosta":Xr,valdaosta:Xr,"valle-aosta":Xr,"valle-d-aosta":Xr,"valle-daosta":Xr,valleaosta:Xr,"valled-aosta":Xr,valledaosta:Xr,"vallee-aoste":Xr,"xn--valle-aoste-ebb":Xr,"vallée-aoste":Xr,"vallee-d-aoste":Xr,"xn--valle-d-aoste-ehb":Xr,"vallée-d-aoste":Xr,valleeaoste:Xr,"xn--valleaoste-e7a":Xr,valléeaoste:Xr,valleedaoste:Xr,"xn--valledaoste-ebb":Xr,valléedaoste:Xr,vao:Xr,vda:Xr,ven:Xr,veneto:Xr,ag:Xr,agrigento:Xr,al:Xr,alessandria:Xr,"alto-adige":Xr,altoadige:Xr,an:Xr,ancona:Xr,"andria-barletta-trani":Xr,"andria-trani-barletta":Xr,andriabarlettatrani:Xr,andriatranibarletta:Xr,ao:Xr,aosta:Xr,aoste:Xr,ap:Xr,aq:Xr,aquila:Xr,ar:Xr,arezzo:Xr,"ascoli-piceno":Xr,ascolipiceno:Xr,asti:Xr,at:Xr,av:Xr,avellino:Xr,ba:Xr,"balsan-sudtirol":Xr,"xn--balsan-sdtirol-nsb":Xr,"balsan-südtirol":Xr,"balsan-suedtirol":Xr,balsan:Xr,bari:Xr,"barletta-trani-andria":Xr,barlettatraniandria:Xr,belluno:Xr,benevento:Xr,bergamo:Xr,bg:Xr,bi:Xr,biella:Xr,bl:Xr,bn:Xr,bo:Xr,bologna:Xr,"bolzano-altoadige":Xr,bolzano:Xr,"bozen-sudtirol":Xr,"xn--bozen-sdtirol-2ob":Xr,"bozen-südtirol":Xr,"bozen-suedtirol":Xr,bozen:Xr,br:Xr,brescia:Xr,brindisi:Xr,bs:Xr,bt:Xr,"bulsan-sudtirol":Xr,"xn--bulsan-sdtirol-nsb":Xr,"bulsan-südtirol":Xr,"bulsan-suedtirol":Xr,bulsan:Xr,bz:Xr,ca:Xr,cagliari:Xr,caltanissetta:Xr,"campidano-medio":Xr,campidanomedio:Xr,campobasso:Xr,"carbonia-iglesias":Xr,carboniaiglesias:Xr,"carrara-massa":Xr,carraramassa:Xr,caserta:Xr,catania:Xr,catanzaro:Xr,cb:Xr,ce:Xr,"cesena-forli":Xr,"xn--cesena-forl-mcb":Xr,"cesena-forlì":Xr,cesenaforli:Xr,"xn--cesenaforl-i8a":Xr,cesenaforlì:Xr,ch:Xr,chieti:Xr,ci:Xr,cl:Xr,cn:Xr,co:Xr,como:Xr,cosenza:Xr,cr:Xr,cremona:Xr,crotone:Xr,cs:Xr,ct:Xr,cuneo:Xr,cz:Xr,"dell-ogliastra":Xr,dellogliastra:Xr,en:Xr,enna:Xr,fc:Xr,fe:Xr,fermo:Xr,ferrara:Xr,fg:Xr,fi:Xr,firenze:Xr,florence:Xr,fm:Xr,foggia:Xr,"forli-cesena":Xr,"xn--forl-cesena-fcb":Xr,"forlì-cesena":Xr,forlicesena:Xr,"xn--forlcesena-c8a":Xr,forlìcesena:Xr,fr:Xr,frosinone:Xr,ge:Xr,genoa:Xr,genova:Xr,go:Xr,gorizia:Xr,gr:Xr,grosseto:Xr,"iglesias-carbonia":Xr,iglesiascarbonia:Xr,im:Xr,imperia:Xr,is:Xr,isernia:Xr,kr:Xr,"la-spezia":Xr,laquila:Xr,laspezia:Xr,latina:Xr,lc:Xr,le:Xr,lecce:Xr,lecco:Xr,li:Xr,livorno:Xr,lo:Xr,lodi:Xr,lt:Xr,lu:Xr,lucca:Xr,macerata:Xr,mantova:Xr,"massa-carrara":Xr,massacarrara:Xr,matera:Xr,mb:Xr,mc:Xr,me:Xr,"medio-campidano":Xr,mediocampidano:Xr,messina:Xr,mi:Xr,milan:Xr,milano:Xr,mn:Xr,mo:Xr,modena:Xr,"monza-brianza":Xr,"monza-e-della-brianza":Xr,monza:Xr,monzabrianza:Xr,monzaebrianza:Xr,monzaedellabrianza:Xr,ms:Xr,mt:Xr,na:Xr,naples:Xr,napoli:Xr,no:Xr,novara:Xr,nu:Xr,nuoro:Xr,og:Xr,ogliastra:Xr,"olbia-tempio":Xr,olbiatempio:Xr,or:Xr,oristano:Xr,ot:Xr,pa:Xr,padova:Xr,padua:Xr,palermo:Xr,parma:Xr,pavia:Xr,pc:Xr,pd:Xr,pe:Xr,perugia:Xr,"pesaro-urbino":Xr,pesarourbino:Xr,pescara:Xr,pg:Xr,pi:Xr,piacenza:Xr,pisa:Xr,pistoia:Xr,pn:Xr,po:Xr,pordenone:Xr,potenza:Xr,pr:Xr,prato:Xr,pt:Xr,pu:Xr,pv:Xr,pz:Xr,ra:Xr,ragusa:Xr,ravenna:Xr,rc:Xr,re:Xr,"reggio-calabria":Xr,"reggio-emilia":Xr,reggiocalabria:Xr,reggioemilia:Xr,rg:Xr,ri:Xr,rieti:Xr,rimini:Xr,rm:Xr,rn:Xr,ro:Xr,roma:Xr,rome:Xr,rovigo:Xr,sa:Xr,salerno:Xr,sassari:Xr,savona:Xr,si:Xr,siena:Xr,siracusa:Xr,so:Xr,sondrio:Xr,sp:Xr,sr:Xr,ss:Xr,suedtirol:Xr,"xn--sdtirol-n2a":Xr,südtirol:Xr,sv:Xr,ta:Xr,taranto:Xr,te:Xr,"tempio-olbia":Xr,tempioolbia:Xr,teramo:Xr,terni:Xr,tn:Xr,to:Xr,torino:Xr,tp:Xr,tr:Xr,"trani-andria-barletta":Xr,"trani-barletta-andria":Xr,traniandriabarletta:Xr,tranibarlettaandria:Xr,trapani:Xr,trento:Xr,treviso:Xr,trieste:Xr,ts:Xr,turin:Xr,tv:Xr,ud:Xr,udine:Xr,"urbino-pesaro":Xr,urbinopesaro:Xr,va:Xr,varese:Xr,vb:Xr,vc:Xr,ve:Xr,venezia:Xr,venice:Xr,verbania:Xr,vercelli:Xr,verona:Xr,vi:Xr,"vibo-valentia":Xr,vibovalentia:Xr,vicenza:Xr,viterbo:Xr,vr:Xr,vs:Xr,vt:Xr,vv:Xr,blogspot:eo,ibxos:eo,iliadboxos:eo,neen:[0,{jc:eo}],tim:[0,{open:[0,{jelastic:ao}]}],"16-b":eo,"32-b":eo,"64-b":eo,"123homepage":eo,myspreadshop:eo,syncloud:eo}],je:[1,{co:Xr,net:Xr,org:Xr,of:eo}],jm:oo,jo:[1,{com:Xr,org:Xr,net:Xr,edu:Xr,sch:Xr,gov:Xr,mil:Xr,name:Xr}],jobs:Xr,jp:[1,{ac:Xr,ad:Xr,co:Xr,ed:Xr,go:Xr,gr:Xr,lg:Xr,ne:[1,{aseinet:fo,gehirn:eo,ivory:eo,"mail-box":eo,mints:eo,mokuren:eo,opal:eo,sakura:eo,sumomo:eo,topaz:eo}],or:Xr,aichi:[1,{aisai:Xr,ama:Xr,anjo:Xr,asuke:Xr,chiryu:Xr,chita:Xr,fuso:Xr,gamagori:Xr,handa:Xr,hazu:Xr,hekinan:Xr,higashiura:Xr,ichinomiya:Xr,inazawa:Xr,inuyama:Xr,isshiki:Xr,iwakura:Xr,kanie:Xr,kariya:Xr,kasugai:Xr,kira:Xr,kiyosu:Xr,komaki:Xr,konan:Xr,kota:Xr,mihama:Xr,miyoshi:Xr,nishio:Xr,nisshin:Xr,obu:Xr,oguchi:Xr,oharu:Xr,okazaki:Xr,owariasahi:Xr,seto:Xr,shikatsu:Xr,shinshiro:Xr,shitara:Xr,tahara:Xr,takahama:Xr,tobishima:Xr,toei:Xr,togo:Xr,tokai:Xr,tokoname:Xr,toyoake:Xr,toyohashi:Xr,toyokawa:Xr,toyone:Xr,toyota:Xr,tsushima:Xr,yatomi:Xr}],akita:[1,{akita:Xr,daisen:Xr,fujisato:Xr,gojome:Xr,hachirogata:Xr,happou:Xr,higashinaruse:Xr,honjo:Xr,honjyo:Xr,ikawa:Xr,kamikoani:Xr,kamioka:Xr,katagami:Xr,kazuno:Xr,kitaakita:Xr,kosaka:Xr,kyowa:Xr,misato:Xr,mitane:Xr,moriyoshi:Xr,nikaho:Xr,noshiro:Xr,odate:Xr,oga:Xr,ogata:Xr,semboku:Xr,yokote:Xr,yurihonjo:Xr}],aomori:[1,{aomori:Xr,gonohe:Xr,hachinohe:Xr,hashikami:Xr,hiranai:Xr,hirosaki:Xr,itayanagi:Xr,kuroishi:Xr,misawa:Xr,mutsu:Xr,nakadomari:Xr,noheji:Xr,oirase:Xr,owani:Xr,rokunohe:Xr,sannohe:Xr,shichinohe:Xr,shingo:Xr,takko:Xr,towada:Xr,tsugaru:Xr,tsuruta:Xr}],chiba:[1,{abiko:Xr,asahi:Xr,chonan:Xr,chosei:Xr,choshi:Xr,chuo:Xr,funabashi:Xr,futtsu:Xr,hanamigawa:Xr,ichihara:Xr,ichikawa:Xr,ichinomiya:Xr,inzai:Xr,isumi:Xr,kamagaya:Xr,kamogawa:Xr,kashiwa:Xr,katori:Xr,katsuura:Xr,kimitsu:Xr,kisarazu:Xr,kozaki:Xr,kujukuri:Xr,kyonan:Xr,matsudo:Xr,midori:Xr,mihama:Xr,minamiboso:Xr,mobara:Xr,mutsuzawa:Xr,nagara:Xr,nagareyama:Xr,narashino:Xr,narita:Xr,noda:Xr,oamishirasato:Xr,omigawa:Xr,onjuku:Xr,otaki:Xr,sakae:Xr,sakura:Xr,shimofusa:Xr,shirako:Xr,shiroi:Xr,shisui:Xr,sodegaura:Xr,sosa:Xr,tako:Xr,tateyama:Xr,togane:Xr,tohnosho:Xr,tomisato:Xr,urayasu:Xr,yachimata:Xr,yachiyo:Xr,yokaichiba:Xr,yokoshibahikari:Xr,yotsukaido:Xr}],ehime:[1,{ainan:Xr,honai:Xr,ikata:Xr,imabari:Xr,iyo:Xr,kamijima:Xr,kihoku:Xr,kumakogen:Xr,masaki:Xr,matsuno:Xr,matsuyama:Xr,namikata:Xr,niihama:Xr,ozu:Xr,saijo:Xr,seiyo:Xr,shikokuchuo:Xr,tobe:Xr,toon:Xr,uchiko:Xr,uwajima:Xr,yawatahama:Xr}],fukui:[1,{echizen:Xr,eiheiji:Xr,fukui:Xr,ikeda:Xr,katsuyama:Xr,mihama:Xr,minamiechizen:Xr,obama:Xr,ohi:Xr,ono:Xr,sabae:Xr,sakai:Xr,takahama:Xr,tsuruga:Xr,wakasa:Xr}],fukuoka:[1,{ashiya:Xr,buzen:Xr,chikugo:Xr,chikuho:Xr,chikujo:Xr,chikushino:Xr,chikuzen:Xr,chuo:Xr,dazaifu:Xr,fukuchi:Xr,hakata:Xr,higashi:Xr,hirokawa:Xr,hisayama:Xr,iizuka:Xr,inatsuki:Xr,kaho:Xr,kasuga:Xr,kasuya:Xr,kawara:Xr,keisen:Xr,koga:Xr,kurate:Xr,kurogi:Xr,kurume:Xr,minami:Xr,miyako:Xr,miyama:Xr,miyawaka:Xr,mizumaki:Xr,munakata:Xr,nakagawa:Xr,nakama:Xr,nishi:Xr,nogata:Xr,ogori:Xr,okagaki:Xr,okawa:Xr,oki:Xr,omuta:Xr,onga:Xr,onojo:Xr,oto:Xr,saigawa:Xr,sasaguri:Xr,shingu:Xr,shinyoshitomi:Xr,shonai:Xr,soeda:Xr,sue:Xr,tachiarai:Xr,tagawa:Xr,takata:Xr,toho:Xr,toyotsu:Xr,tsuiki:Xr,ukiha:Xr,umi:Xr,usui:Xr,yamada:Xr,yame:Xr,yanagawa:Xr,yukuhashi:Xr}],fukushima:[1,{aizubange:Xr,aizumisato:Xr,aizuwakamatsu:Xr,asakawa:Xr,bandai:Xr,date:Xr,fukushima:Xr,furudono:Xr,futaba:Xr,hanawa:Xr,higashi:Xr,hirata:Xr,hirono:Xr,iitate:Xr,inawashiro:Xr,ishikawa:Xr,iwaki:Xr,izumizaki:Xr,kagamiishi:Xr,kaneyama:Xr,kawamata:Xr,kitakata:Xr,kitashiobara:Xr,koori:Xr,koriyama:Xr,kunimi:Xr,miharu:Xr,mishima:Xr,namie:Xr,nango:Xr,nishiaizu:Xr,nishigo:Xr,okuma:Xr,omotego:Xr,ono:Xr,otama:Xr,samegawa:Xr,shimogo:Xr,shirakawa:Xr,showa:Xr,soma:Xr,sukagawa:Xr,taishin:Xr,tamakawa:Xr,tanagura:Xr,tenei:Xr,yabuki:Xr,yamato:Xr,yamatsuri:Xr,yanaizu:Xr,yugawa:Xr}],gifu:[1,{anpachi:Xr,ena:Xr,gifu:Xr,ginan:Xr,godo:Xr,gujo:Xr,hashima:Xr,hichiso:Xr,hida:Xr,higashishirakawa:Xr,ibigawa:Xr,ikeda:Xr,kakamigahara:Xr,kani:Xr,kasahara:Xr,kasamatsu:Xr,kawaue:Xr,kitagata:Xr,mino:Xr,minokamo:Xr,mitake:Xr,mizunami:Xr,motosu:Xr,nakatsugawa:Xr,ogaki:Xr,sakahogi:Xr,seki:Xr,sekigahara:Xr,shirakawa:Xr,tajimi:Xr,takayama:Xr,tarui:Xr,toki:Xr,tomika:Xr,wanouchi:Xr,yamagata:Xr,yaotsu:Xr,yoro:Xr}],gunma:[1,{annaka:Xr,chiyoda:Xr,fujioka:Xr,higashiagatsuma:Xr,isesaki:Xr,itakura:Xr,kanna:Xr,kanra:Xr,katashina:Xr,kawaba:Xr,kiryu:Xr,kusatsu:Xr,maebashi:Xr,meiwa:Xr,midori:Xr,minakami:Xr,naganohara:Xr,nakanojo:Xr,nanmoku:Xr,numata:Xr,oizumi:Xr,ora:Xr,ota:Xr,shibukawa:Xr,shimonita:Xr,shinto:Xr,showa:Xr,takasaki:Xr,takayama:Xr,tamamura:Xr,tatebayashi:Xr,tomioka:Xr,tsukiyono:Xr,tsumagoi:Xr,ueno:Xr,yoshioka:Xr}],hiroshima:[1,{asaminami:Xr,daiwa:Xr,etajima:Xr,fuchu:Xr,fukuyama:Xr,hatsukaichi:Xr,higashihiroshima:Xr,hongo:Xr,jinsekikogen:Xr,kaita:Xr,kui:Xr,kumano:Xr,kure:Xr,mihara:Xr,miyoshi:Xr,naka:Xr,onomichi:Xr,osakikamijima:Xr,otake:Xr,saka:Xr,sera:Xr,seranishi:Xr,shinichi:Xr,shobara:Xr,takehara:Xr}],hokkaido:[1,{abashiri:Xr,abira:Xr,aibetsu:Xr,akabira:Xr,akkeshi:Xr,asahikawa:Xr,ashibetsu:Xr,ashoro:Xr,assabu:Xr,atsuma:Xr,bibai:Xr,biei:Xr,bifuka:Xr,bihoro:Xr,biratori:Xr,chippubetsu:Xr,chitose:Xr,date:Xr,ebetsu:Xr,embetsu:Xr,eniwa:Xr,erimo:Xr,esan:Xr,esashi:Xr,fukagawa:Xr,fukushima:Xr,furano:Xr,furubira:Xr,haboro:Xr,hakodate:Xr,hamatonbetsu:Xr,hidaka:Xr,higashikagura:Xr,higashikawa:Xr,hiroo:Xr,hokuryu:Xr,hokuto:Xr,honbetsu:Xr,horokanai:Xr,horonobe:Xr,ikeda:Xr,imakane:Xr,ishikari:Xr,iwamizawa:Xr,iwanai:Xr,kamifurano:Xr,kamikawa:Xr,kamishihoro:Xr,kamisunagawa:Xr,kamoenai:Xr,kayabe:Xr,kembuchi:Xr,kikonai:Xr,kimobetsu:Xr,kitahiroshima:Xr,kitami:Xr,kiyosato:Xr,koshimizu:Xr,kunneppu:Xr,kuriyama:Xr,kuromatsunai:Xr,kushiro:Xr,kutchan:Xr,kyowa:Xr,mashike:Xr,matsumae:Xr,mikasa:Xr,minamifurano:Xr,mombetsu:Xr,moseushi:Xr,mukawa:Xr,muroran:Xr,naie:Xr,nakagawa:Xr,nakasatsunai:Xr,nakatombetsu:Xr,nanae:Xr,nanporo:Xr,nayoro:Xr,nemuro:Xr,niikappu:Xr,niki:Xr,nishiokoppe:Xr,noboribetsu:Xr,numata:Xr,obihiro:Xr,obira:Xr,oketo:Xr,okoppe:Xr,otaru:Xr,otobe:Xr,otofuke:Xr,otoineppu:Xr,oumu:Xr,ozora:Xr,pippu:Xr,rankoshi:Xr,rebun:Xr,rikubetsu:Xr,rishiri:Xr,rishirifuji:Xr,saroma:Xr,sarufutsu:Xr,shakotan:Xr,shari:Xr,shibecha:Xr,shibetsu:Xr,shikabe:Xr,shikaoi:Xr,shimamaki:Xr,shimizu:Xr,shimokawa:Xr,shinshinotsu:Xr,shintoku:Xr,shiranuka:Xr,shiraoi:Xr,shiriuchi:Xr,sobetsu:Xr,sunagawa:Xr,taiki:Xr,takasu:Xr,takikawa:Xr,takinoue:Xr,teshikaga:Xr,tobetsu:Xr,tohma:Xr,tomakomai:Xr,tomari:Xr,toya:Xr,toyako:Xr,toyotomi:Xr,toyoura:Xr,tsubetsu:Xr,tsukigata:Xr,urakawa:Xr,urausu:Xr,uryu:Xr,utashinai:Xr,wakkanai:Xr,wassamu:Xr,yakumo:Xr,yoichi:Xr}],hyogo:[1,{aioi:Xr,akashi:Xr,ako:Xr,amagasaki:Xr,aogaki:Xr,asago:Xr,ashiya:Xr,awaji:Xr,fukusaki:Xr,goshiki:Xr,harima:Xr,himeji:Xr,ichikawa:Xr,inagawa:Xr,itami:Xr,kakogawa:Xr,kamigori:Xr,kamikawa:Xr,kasai:Xr,kasuga:Xr,kawanishi:Xr,miki:Xr,minamiawaji:Xr,nishinomiya:Xr,nishiwaki:Xr,ono:Xr,sanda:Xr,sannan:Xr,sasayama:Xr,sayo:Xr,shingu:Xr,shinonsen:Xr,shiso:Xr,sumoto:Xr,taishi:Xr,taka:Xr,takarazuka:Xr,takasago:Xr,takino:Xr,tamba:Xr,tatsuno:Xr,toyooka:Xr,yabu:Xr,yashiro:Xr,yoka:Xr,yokawa:Xr}],ibaraki:[1,{ami:Xr,asahi:Xr,bando:Xr,chikusei:Xr,daigo:Xr,fujishiro:Xr,hitachi:Xr,hitachinaka:Xr,hitachiomiya:Xr,hitachiota:Xr,ibaraki:Xr,ina:Xr,inashiki:Xr,itako:Xr,iwama:Xr,joso:Xr,kamisu:Xr,kasama:Xr,kashima:Xr,kasumigaura:Xr,koga:Xr,miho:Xr,mito:Xr,moriya:Xr,naka:Xr,namegata:Xr,oarai:Xr,ogawa:Xr,omitama:Xr,ryugasaki:Xr,sakai:Xr,sakuragawa:Xr,shimodate:Xr,shimotsuma:Xr,shirosato:Xr,sowa:Xr,suifu:Xr,takahagi:Xr,tamatsukuri:Xr,tokai:Xr,tomobe:Xr,tone:Xr,toride:Xr,tsuchiura:Xr,tsukuba:Xr,uchihara:Xr,ushiku:Xr,yachiyo:Xr,yamagata:Xr,yawara:Xr,yuki:Xr}],ishikawa:[1,{anamizu:Xr,hakui:Xr,hakusan:Xr,kaga:Xr,kahoku:Xr,kanazawa:Xr,kawakita:Xr,komatsu:Xr,nakanoto:Xr,nanao:Xr,nomi:Xr,nonoichi:Xr,noto:Xr,shika:Xr,suzu:Xr,tsubata:Xr,tsurugi:Xr,uchinada:Xr,wajima:Xr}],iwate:[1,{fudai:Xr,fujisawa:Xr,hanamaki:Xr,hiraizumi:Xr,hirono:Xr,ichinohe:Xr,ichinoseki:Xr,iwaizumi:Xr,iwate:Xr,joboji:Xr,kamaishi:Xr,kanegasaki:Xr,karumai:Xr,kawai:Xr,kitakami:Xr,kuji:Xr,kunohe:Xr,kuzumaki:Xr,miyako:Xr,mizusawa:Xr,morioka:Xr,ninohe:Xr,noda:Xr,ofunato:Xr,oshu:Xr,otsuchi:Xr,rikuzentakata:Xr,shiwa:Xr,shizukuishi:Xr,sumita:Xr,tanohata:Xr,tono:Xr,yahaba:Xr,yamada:Xr}],kagawa:[1,{ayagawa:Xr,higashikagawa:Xr,kanonji:Xr,kotohira:Xr,manno:Xr,marugame:Xr,mitoyo:Xr,naoshima:Xr,sanuki:Xr,tadotsu:Xr,takamatsu:Xr,tonosho:Xr,uchinomi:Xr,utazu:Xr,zentsuji:Xr}],kagoshima:[1,{akune:Xr,amami:Xr,hioki:Xr,isa:Xr,isen:Xr,izumi:Xr,kagoshima:Xr,kanoya:Xr,kawanabe:Xr,kinko:Xr,kouyama:Xr,makurazaki:Xr,matsumoto:Xr,minamitane:Xr,nakatane:Xr,nishinoomote:Xr,satsumasendai:Xr,soo:Xr,tarumizu:Xr,yusui:Xr}],kanagawa:[1,{aikawa:Xr,atsugi:Xr,ayase:Xr,chigasaki:Xr,ebina:Xr,fujisawa:Xr,hadano:Xr,hakone:Xr,hiratsuka:Xr,isehara:Xr,kaisei:Xr,kamakura:Xr,kiyokawa:Xr,matsuda:Xr,minamiashigara:Xr,miura:Xr,nakai:Xr,ninomiya:Xr,odawara:Xr,oi:Xr,oiso:Xr,sagamihara:Xr,samukawa:Xr,tsukui:Xr,yamakita:Xr,yamato:Xr,yokosuka:Xr,yugawara:Xr,zama:Xr,zushi:Xr}],kochi:[1,{aki:Xr,geisei:Xr,hidaka:Xr,higashitsuno:Xr,ino:Xr,kagami:Xr,kami:Xr,kitagawa:Xr,kochi:Xr,mihara:Xr,motoyama:Xr,muroto:Xr,nahari:Xr,nakamura:Xr,nankoku:Xr,nishitosa:Xr,niyodogawa:Xr,ochi:Xr,okawa:Xr,otoyo:Xr,otsuki:Xr,sakawa:Xr,sukumo:Xr,susaki:Xr,tosa:Xr,tosashimizu:Xr,toyo:Xr,tsuno:Xr,umaji:Xr,yasuda:Xr,yusuhara:Xr}],kumamoto:[1,{amakusa:Xr,arao:Xr,aso:Xr,choyo:Xr,gyokuto:Xr,kamiamakusa:Xr,kikuchi:Xr,kumamoto:Xr,mashiki:Xr,mifune:Xr,minamata:Xr,minamioguni:Xr,nagasu:Xr,nishihara:Xr,oguni:Xr,ozu:Xr,sumoto:Xr,takamori:Xr,uki:Xr,uto:Xr,yamaga:Xr,yamato:Xr,yatsushiro:Xr}],kyoto:[1,{ayabe:Xr,fukuchiyama:Xr,higashiyama:Xr,ide:Xr,ine:Xr,joyo:Xr,kameoka:Xr,kamo:Xr,kita:Xr,kizu:Xr,kumiyama:Xr,kyotamba:Xr,kyotanabe:Xr,kyotango:Xr,maizuru:Xr,minami:Xr,minamiyamashiro:Xr,miyazu:Xr,muko:Xr,nagaokakyo:Xr,nakagyo:Xr,nantan:Xr,oyamazaki:Xr,sakyo:Xr,seika:Xr,tanabe:Xr,uji:Xr,ujitawara:Xr,wazuka:Xr,yamashina:Xr,yawata:Xr}],mie:[1,{asahi:Xr,inabe:Xr,ise:Xr,kameyama:Xr,kawagoe:Xr,kiho:Xr,kisosaki:Xr,kiwa:Xr,komono:Xr,kumano:Xr,kuwana:Xr,matsusaka:Xr,meiwa:Xr,mihama:Xr,minamiise:Xr,misugi:Xr,miyama:Xr,nabari:Xr,shima:Xr,suzuka:Xr,tado:Xr,taiki:Xr,taki:Xr,tamaki:Xr,toba:Xr,tsu:Xr,udono:Xr,ureshino:Xr,watarai:Xr,yokkaichi:Xr}],miyagi:[1,{furukawa:Xr,higashimatsushima:Xr,ishinomaki:Xr,iwanuma:Xr,kakuda:Xr,kami:Xr,kawasaki:Xr,marumori:Xr,matsushima:Xr,minamisanriku:Xr,misato:Xr,murata:Xr,natori:Xr,ogawara:Xr,ohira:Xr,onagawa:Xr,osaki:Xr,rifu:Xr,semine:Xr,shibata:Xr,shichikashuku:Xr,shikama:Xr,shiogama:Xr,shiroishi:Xr,tagajo:Xr,taiwa:Xr,tome:Xr,tomiya:Xr,wakuya:Xr,watari:Xr,yamamoto:Xr,zao:Xr}],miyazaki:[1,{aya:Xr,ebino:Xr,gokase:Xr,hyuga:Xr,kadogawa:Xr,kawaminami:Xr,kijo:Xr,kitagawa:Xr,kitakata:Xr,kitaura:Xr,kobayashi:Xr,kunitomi:Xr,kushima:Xr,mimata:Xr,miyakonojo:Xr,miyazaki:Xr,morotsuka:Xr,nichinan:Xr,nishimera:Xr,nobeoka:Xr,saito:Xr,shiiba:Xr,shintomi:Xr,takaharu:Xr,takanabe:Xr,takazaki:Xr,tsuno:Xr}],nagano:[1,{achi:Xr,agematsu:Xr,anan:Xr,aoki:Xr,asahi:Xr,azumino:Xr,chikuhoku:Xr,chikuma:Xr,chino:Xr,fujimi:Xr,hakuba:Xr,hara:Xr,hiraya:Xr,iida:Xr,iijima:Xr,iiyama:Xr,iizuna:Xr,ikeda:Xr,ikusaka:Xr,ina:Xr,karuizawa:Xr,kawakami:Xr,kiso:Xr,kisofukushima:Xr,kitaaiki:Xr,komagane:Xr,komoro:Xr,matsukawa:Xr,matsumoto:Xr,miasa:Xr,minamiaiki:Xr,minamimaki:Xr,minamiminowa:Xr,minowa:Xr,miyada:Xr,miyota:Xr,mochizuki:Xr,nagano:Xr,nagawa:Xr,nagiso:Xr,nakagawa:Xr,nakano:Xr,nozawaonsen:Xr,obuse:Xr,ogawa:Xr,okaya:Xr,omachi:Xr,omi:Xr,ookuwa:Xr,ooshika:Xr,otaki:Xr,otari:Xr,sakae:Xr,sakaki:Xr,saku:Xr,sakuho:Xr,shimosuwa:Xr,shinanomachi:Xr,shiojiri:Xr,suwa:Xr,suzaka:Xr,takagi:Xr,takamori:Xr,takayama:Xr,tateshina:Xr,tatsuno:Xr,togakushi:Xr,togura:Xr,tomi:Xr,ueda:Xr,wada:Xr,yamagata:Xr,yamanouchi:Xr,yasaka:Xr,yasuoka:Xr}],nagasaki:[1,{chijiwa:Xr,futsu:Xr,goto:Xr,hasami:Xr,hirado:Xr,iki:Xr,isahaya:Xr,kawatana:Xr,kuchinotsu:Xr,matsuura:Xr,nagasaki:Xr,obama:Xr,omura:Xr,oseto:Xr,saikai:Xr,sasebo:Xr,seihi:Xr,shimabara:Xr,shinkamigoto:Xr,togitsu:Xr,tsushima:Xr,unzen:Xr}],nara:[1,{ando:Xr,gose:Xr,heguri:Xr,higashiyoshino:Xr,ikaruga:Xr,ikoma:Xr,kamikitayama:Xr,kanmaki:Xr,kashiba:Xr,kashihara:Xr,katsuragi:Xr,kawai:Xr,kawakami:Xr,kawanishi:Xr,koryo:Xr,kurotaki:Xr,mitsue:Xr,miyake:Xr,nara:Xr,nosegawa:Xr,oji:Xr,ouda:Xr,oyodo:Xr,sakurai:Xr,sango:Xr,shimoichi:Xr,shimokitayama:Xr,shinjo:Xr,soni:Xr,takatori:Xr,tawaramoto:Xr,tenkawa:Xr,tenri:Xr,uda:Xr,yamatokoriyama:Xr,yamatotakada:Xr,yamazoe:Xr,yoshino:Xr}],niigata:[1,{aga:Xr,agano:Xr,gosen:Xr,itoigawa:Xr,izumozaki:Xr,joetsu:Xr,kamo:Xr,kariwa:Xr,kashiwazaki:Xr,minamiuonuma:Xr,mitsuke:Xr,muika:Xr,murakami:Xr,myoko:Xr,nagaoka:Xr,niigata:Xr,ojiya:Xr,omi:Xr,sado:Xr,sanjo:Xr,seiro:Xr,seirou:Xr,sekikawa:Xr,shibata:Xr,tagami:Xr,tainai:Xr,tochio:Xr,tokamachi:Xr,tsubame:Xr,tsunan:Xr,uonuma:Xr,yahiko:Xr,yoita:Xr,yuzawa:Xr}],oita:[1,{beppu:Xr,bungoono:Xr,bungotakada:Xr,hasama:Xr,hiji:Xr,himeshima:Xr,hita:Xr,kamitsue:Xr,kokonoe:Xr,kuju:Xr,kunisaki:Xr,kusu:Xr,oita:Xr,saiki:Xr,taketa:Xr,tsukumi:Xr,usa:Xr,usuki:Xr,yufu:Xr}],okayama:[1,{akaiwa:Xr,asakuchi:Xr,bizen:Xr,hayashima:Xr,ibara:Xr,kagamino:Xr,kasaoka:Xr,kibichuo:Xr,kumenan:Xr,kurashiki:Xr,maniwa:Xr,misaki:Xr,nagi:Xr,niimi:Xr,nishiawakura:Xr,okayama:Xr,satosho:Xr,setouchi:Xr,shinjo:Xr,shoo:Xr,soja:Xr,takahashi:Xr,tamano:Xr,tsuyama:Xr,wake:Xr,yakage:Xr}],okinawa:[1,{aguni:Xr,ginowan:Xr,ginoza:Xr,gushikami:Xr,haebaru:Xr,higashi:Xr,hirara:Xr,iheya:Xr,ishigaki:Xr,ishikawa:Xr,itoman:Xr,izena:Xr,kadena:Xr,kin:Xr,kitadaito:Xr,kitanakagusuku:Xr,kumejima:Xr,kunigami:Xr,minamidaito:Xr,motobu:Xr,nago:Xr,naha:Xr,nakagusuku:Xr,nakijin:Xr,nanjo:Xr,nishihara:Xr,ogimi:Xr,okinawa:Xr,onna:Xr,shimoji:Xr,taketomi:Xr,tarama:Xr,tokashiki:Xr,tomigusuku:Xr,tonaki:Xr,urasoe:Xr,uruma:Xr,yaese:Xr,yomitan:Xr,yonabaru:Xr,yonaguni:Xr,zamami:Xr}],osaka:[1,{abeno:Xr,chihayaakasaka:Xr,chuo:Xr,daito:Xr,fujiidera:Xr,habikino:Xr,hannan:Xr,higashiosaka:Xr,higashisumiyoshi:Xr,higashiyodogawa:Xr,hirakata:Xr,ibaraki:Xr,ikeda:Xr,izumi:Xr,izumiotsu:Xr,izumisano:Xr,kadoma:Xr,kaizuka:Xr,kanan:Xr,kashiwara:Xr,katano:Xr,kawachinagano:Xr,kishiwada:Xr,kita:Xr,kumatori:Xr,matsubara:Xr,minato:Xr,minoh:Xr,misaki:Xr,moriguchi:Xr,neyagawa:Xr,nishi:Xr,nose:Xr,osakasayama:Xr,sakai:Xr,sayama:Xr,sennan:Xr,settsu:Xr,shijonawate:Xr,shimamoto:Xr,suita:Xr,tadaoka:Xr,taishi:Xr,tajiri:Xr,takaishi:Xr,takatsuki:Xr,tondabayashi:Xr,toyonaka:Xr,toyono:Xr,yao:Xr}],saga:[1,{ariake:Xr,arita:Xr,fukudomi:Xr,genkai:Xr,hamatama:Xr,hizen:Xr,imari:Xr,kamimine:Xr,kanzaki:Xr,karatsu:Xr,kashima:Xr,kitagata:Xr,kitahata:Xr,kiyama:Xr,kouhoku:Xr,kyuragi:Xr,nishiarita:Xr,ogi:Xr,omachi:Xr,ouchi:Xr,saga:Xr,shiroishi:Xr,taku:Xr,tara:Xr,tosu:Xr,yoshinogari:Xr}],saitama:[1,{arakawa:Xr,asaka:Xr,chichibu:Xr,fujimi:Xr,fujimino:Xr,fukaya:Xr,hanno:Xr,hanyu:Xr,hasuda:Xr,hatogaya:Xr,hatoyama:Xr,hidaka:Xr,higashichichibu:Xr,higashimatsuyama:Xr,honjo:Xr,ina:Xr,iruma:Xr,iwatsuki:Xr,kamiizumi:Xr,kamikawa:Xr,kamisato:Xr,kasukabe:Xr,kawagoe:Xr,kawaguchi:Xr,kawajima:Xr,kazo:Xr,kitamoto:Xr,koshigaya:Xr,kounosu:Xr,kuki:Xr,kumagaya:Xr,matsubushi:Xr,minano:Xr,misato:Xr,miyashiro:Xr,miyoshi:Xr,moroyama:Xr,nagatoro:Xr,namegawa:Xr,niiza:Xr,ogano:Xr,ogawa:Xr,ogose:Xr,okegawa:Xr,omiya:Xr,otaki:Xr,ranzan:Xr,ryokami:Xr,saitama:Xr,sakado:Xr,satte:Xr,sayama:Xr,shiki:Xr,shiraoka:Xr,soka:Xr,sugito:Xr,toda:Xr,tokigawa:Xr,tokorozawa:Xr,tsurugashima:Xr,urawa:Xr,warabi:Xr,yashio:Xr,yokoze:Xr,yono:Xr,yorii:Xr,yoshida:Xr,yoshikawa:Xr,yoshimi:Xr}],shiga:[1,{aisho:Xr,gamo:Xr,higashiomi:Xr,hikone:Xr,koka:Xr,konan:Xr,kosei:Xr,koto:Xr,kusatsu:Xr,maibara:Xr,moriyama:Xr,nagahama:Xr,nishiazai:Xr,notogawa:Xr,omihachiman:Xr,otsu:Xr,ritto:Xr,ryuoh:Xr,takashima:Xr,takatsuki:Xr,torahime:Xr,toyosato:Xr,yasu:Xr}],shimane:[1,{akagi:Xr,ama:Xr,gotsu:Xr,hamada:Xr,higashiizumo:Xr,hikawa:Xr,hikimi:Xr,izumo:Xr,kakinoki:Xr,masuda:Xr,matsue:Xr,misato:Xr,nishinoshima:Xr,ohda:Xr,okinoshima:Xr,okuizumo:Xr,shimane:Xr,tamayu:Xr,tsuwano:Xr,unnan:Xr,yakumo:Xr,yasugi:Xr,yatsuka:Xr}],shizuoka:[1,{arai:Xr,atami:Xr,fuji:Xr,fujieda:Xr,fujikawa:Xr,fujinomiya:Xr,fukuroi:Xr,gotemba:Xr,haibara:Xr,hamamatsu:Xr,higashiizu:Xr,ito:Xr,iwata:Xr,izu:Xr,izunokuni:Xr,kakegawa:Xr,kannami:Xr,kawanehon:Xr,kawazu:Xr,kikugawa:Xr,kosai:Xr,makinohara:Xr,matsuzaki:Xr,minamiizu:Xr,mishima:Xr,morimachi:Xr,nishiizu:Xr,numazu:Xr,omaezaki:Xr,shimada:Xr,shimizu:Xr,shimoda:Xr,shizuoka:Xr,susono:Xr,yaizu:Xr,yoshida:Xr}],tochigi:[1,{ashikaga:Xr,bato:Xr,haga:Xr,ichikai:Xr,iwafune:Xr,kaminokawa:Xr,kanuma:Xr,karasuyama:Xr,kuroiso:Xr,mashiko:Xr,mibu:Xr,moka:Xr,motegi:Xr,nasu:Xr,nasushiobara:Xr,nikko:Xr,nishikata:Xr,nogi:Xr,ohira:Xr,ohtawara:Xr,oyama:Xr,sakura:Xr,sano:Xr,shimotsuke:Xr,shioya:Xr,takanezawa:Xr,tochigi:Xr,tsuga:Xr,ujiie:Xr,utsunomiya:Xr,yaita:Xr}],tokushima:[1,{aizumi:Xr,anan:Xr,ichiba:Xr,itano:Xr,kainan:Xr,komatsushima:Xr,matsushige:Xr,mima:Xr,minami:Xr,miyoshi:Xr,mugi:Xr,nakagawa:Xr,naruto:Xr,sanagochi:Xr,shishikui:Xr,tokushima:Xr,wajiki:Xr}],tokyo:[1,{adachi:Xr,akiruno:Xr,akishima:Xr,aogashima:Xr,arakawa:Xr,bunkyo:Xr,chiyoda:Xr,chofu:Xr,chuo:Xr,edogawa:Xr,fuchu:Xr,fussa:Xr,hachijo:Xr,hachioji:Xr,hamura:Xr,higashikurume:Xr,higashimurayama:Xr,higashiyamato:Xr,hino:Xr,hinode:Xr,hinohara:Xr,inagi:Xr,itabashi:Xr,katsushika:Xr,kita:Xr,kiyose:Xr,kodaira:Xr,koganei:Xr,kokubunji:Xr,komae:Xr,koto:Xr,kouzushima:Xr,kunitachi:Xr,machida:Xr,meguro:Xr,minato:Xr,mitaka:Xr,mizuho:Xr,musashimurayama:Xr,musashino:Xr,nakano:Xr,nerima:Xr,ogasawara:Xr,okutama:Xr,ome:Xr,oshima:Xr,ota:Xr,setagaya:Xr,shibuya:Xr,shinagawa:Xr,shinjuku:Xr,suginami:Xr,sumida:Xr,tachikawa:Xr,taito:Xr,tama:Xr,toshima:Xr}],tottori:[1,{chizu:Xr,hino:Xr,kawahara:Xr,koge:Xr,kotoura:Xr,misasa:Xr,nanbu:Xr,nichinan:Xr,sakaiminato:Xr,tottori:Xr,wakasa:Xr,yazu:Xr,yonago:Xr}],toyama:[1,{asahi:Xr,fuchu:Xr,fukumitsu:Xr,funahashi:Xr,himi:Xr,imizu:Xr,inami:Xr,johana:Xr,kamiichi:Xr,kurobe:Xr,nakaniikawa:Xr,namerikawa:Xr,nanto:Xr,nyuzen:Xr,oyabe:Xr,taira:Xr,takaoka:Xr,tateyama:Xr,toga:Xr,tonami:Xr,toyama:Xr,unazuki:Xr,uozu:Xr,yamada:Xr}],wakayama:[1,{arida:Xr,aridagawa:Xr,gobo:Xr,hashimoto:Xr,hidaka:Xr,hirogawa:Xr,inami:Xr,iwade:Xr,kainan:Xr,kamitonda:Xr,katsuragi:Xr,kimino:Xr,kinokawa:Xr,kitayama:Xr,koya:Xr,koza:Xr,kozagawa:Xr,kudoyama:Xr,kushimoto:Xr,mihama:Xr,misato:Xr,nachikatsuura:Xr,shingu:Xr,shirahama:Xr,taiji:Xr,tanabe:Xr,wakayama:Xr,yuasa:Xr,yura:Xr}],yamagata:[1,{asahi:Xr,funagata:Xr,higashine:Xr,iide:Xr,kahoku:Xr,kaminoyama:Xr,kaneyama:Xr,kawanishi:Xr,mamurogawa:Xr,mikawa:Xr,murayama:Xr,nagai:Xr,nakayama:Xr,nanyo:Xr,nishikawa:Xr,obanazawa:Xr,oe:Xr,oguni:Xr,ohkura:Xr,oishida:Xr,sagae:Xr,sakata:Xr,sakegawa:Xr,shinjo:Xr,shirataka:Xr,shonai:Xr,takahata:Xr,tendo:Xr,tozawa:Xr,tsuruoka:Xr,yamagata:Xr,yamanobe:Xr,yonezawa:Xr,yuza:Xr}],yamaguchi:[1,{abu:Xr,hagi:Xr,hikari:Xr,hofu:Xr,iwakuni:Xr,kudamatsu:Xr,mitou:Xr,nagato:Xr,oshima:Xr,shimonoseki:Xr,shunan:Xr,tabuse:Xr,tokuyama:Xr,toyota:Xr,ube:Xr,yuu:Xr}],yamanashi:[1,{chuo:Xr,doshi:Xr,fuefuki:Xr,fujikawa:Xr,fujikawaguchiko:Xr,fujiyoshida:Xr,hayakawa:Xr,hokuto:Xr,ichikawamisato:Xr,kai:Xr,kofu:Xr,koshu:Xr,kosuge:Xr,"minami-alps":Xr,minobu:Xr,nakamichi:Xr,nanbu:Xr,narusawa:Xr,nirasaki:Xr,nishikatsura:Xr,oshino:Xr,otsuki:Xr,showa:Xr,tabayama:Xr,tsuru:Xr,uenohara:Xr,yamanakako:Xr,yamanashi:Xr}],"xn--4pvxs":Xr,栃木:Xr,"xn--vgu402c":Xr,愛知:Xr,"xn--c3s14m":Xr,愛媛:Xr,"xn--f6qx53a":Xr,兵庫:Xr,"xn--8pvr4u":Xr,熊本:Xr,"xn--uist22h":Xr,茨城:Xr,"xn--djrs72d6uy":Xr,北海道:Xr,"xn--mkru45i":Xr,千葉:Xr,"xn--0trq7p7nn":Xr,和歌山:Xr,"xn--8ltr62k":Xr,長崎:Xr,"xn--2m4a15e":Xr,長野:Xr,"xn--efvn9s":Xr,新潟:Xr,"xn--32vp30h":Xr,青森:Xr,"xn--4it797k":Xr,静岡:Xr,"xn--1lqs71d":Xr,東京:Xr,"xn--5rtp49c":Xr,石川:Xr,"xn--5js045d":Xr,埼玉:Xr,"xn--ehqz56n":Xr,三重:Xr,"xn--1lqs03n":Xr,京都:Xr,"xn--qqqt11m":Xr,佐賀:Xr,"xn--kbrq7o":Xr,大分:Xr,"xn--pssu33l":Xr,大阪:Xr,"xn--ntsq17g":Xr,奈良:Xr,"xn--uisz3g":Xr,宮城:Xr,"xn--6btw5a":Xr,宮崎:Xr,"xn--1ctwo":Xr,富山:Xr,"xn--6orx2r":Xr,山口:Xr,"xn--rht61e":Xr,山形:Xr,"xn--rht27z":Xr,山梨:Xr,"xn--djty4k":Xr,岩手:Xr,"xn--nit225k":Xr,岐阜:Xr,"xn--rht3d":Xr,岡山:Xr,"xn--klty5x":Xr,島根:Xr,"xn--kltx9a":Xr,広島:Xr,"xn--kltp7d":Xr,徳島:Xr,"xn--uuwu58a":Xr,沖縄:Xr,"xn--zbx025d":Xr,滋賀:Xr,"xn--ntso0iqx3a":Xr,神奈川:Xr,"xn--elqq16h":Xr,福井:Xr,"xn--4it168d":Xr,福岡:Xr,"xn--klt787d":Xr,福島:Xr,"xn--rny31h":Xr,秋田:Xr,"xn--7t0a264c":Xr,群馬:Xr,"xn--5rtq34k":Xr,香川:Xr,"xn--k7yn95e":Xr,高知:Xr,"xn--tor131o":Xr,鳥取:Xr,"xn--d5qv7z876c":Xr,鹿児島:Xr,kawasaki:oo,kitakyushu:oo,kobe:oo,nagoya:oo,sapporo:oo,sendai:oo,yokohama:oo,buyshop:eo,fashionstore:eo,handcrafted:eo,kawaiishop:eo,supersale:eo,theshop:eo,usercontent:eo,angry:eo,babyblue:eo,babymilk:eo,backdrop:eo,bambina:eo,bitter:eo,blush:eo,boo:eo,boy:eo,boyfriend:eo,but:eo,candypop:eo,capoo:eo,catfood:eo,cheap:eo,chicappa:eo,chillout:eo,chips:eo,chowder:eo,chu:eo,ciao:eo,cocotte:eo,coolblog:eo,cranky:eo,cutegirl:eo,daa:eo,deca:eo,deci:eo,digick:eo,egoism:eo,fakefur:eo,fem:eo,flier:eo,floppy:eo,fool:eo,frenchkiss:eo,girlfriend:eo,girly:eo,gloomy:eo,gonna:eo,greater:eo,hacca:eo,heavy:eo,her:eo,hiho:eo,hippy:eo,holy:eo,hungry:eo,icurus:eo,itigo:eo,jellybean:eo,kikirara:eo,kill:eo,kilo:eo,kuron:eo,littlestar:eo,lolipopmc:eo,lolitapunk:eo,lomo:eo,lovepop:eo,lovesick:eo,main:eo,mods:eo,mond:eo,mongolian:eo,moo:eo,namaste:eo,nikita:eo,nobushi:eo,noor:eo,oops:eo,parallel:eo,parasite:eo,pecori:eo,peewee:eo,penne:eo,pepper:eo,perma:eo,pigboat:eo,pinoko:eo,punyu:eo,pupu:eo,pussycat:eo,pya:eo,raindrop:eo,readymade:eo,sadist:eo,schoolbus:eo,secret:eo,staba:eo,stripper:eo,sub:eo,sunnyday:eo,thick:eo,tonkotsu:eo,under:eo,upper:eo,velvet:eo,verse:eo,versus:eo,vivian:eo,watson:eo,weblike:eo,whitesnow:eo,zombie:eo,blogspot:eo,"2-d":eo,bona:eo,crap:eo,daynight:eo,eek:eo,flop:eo,halfmoon:eo,jeez:eo,matrix:eo,mimoza:eo,netgamers:eo,nyanta:eo,o0o0:eo,rdy:eo,rgr:eo,rulez:eo,sakurastorage:[0,{isk01:lo,isk02:lo}],saloon:eo,sblo:eo,skr:eo,tank:eo,"uh-oh":eo,undo:eo,webaccel:[0,{rs:eo,user:eo}],websozai:eo,xii:eo}],ke:[1,{ac:Xr,co:no,go:Xr,info:Xr,me:Xr,mobi:Xr,ne:Xr,or:Xr,sc:Xr}],kg:[1,{org:Xr,net:Xr,com:Xr,edu:Xr,gov:Xr,mil:Xr,blog:eo,io:eo,jp:eo,tv:eo,uk:eo,us:eo}],kh:oo,ki:To,km:[1,{org:Xr,nom:Xr,gov:Xr,prd:Xr,tm:Xr,edu:Xr,mil:Xr,ass:Xr,com:Xr,coop:Xr,asso:Xr,presse:Xr,medecin:Xr,notaires:Xr,pharmaciens:Xr,veterinaire:Xr,gouv:Xr}],kn:[1,{net:Xr,org:Xr,edu:Xr,gov:Xr}],kp:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,rep:Xr,tra:Xr}],kr:[1,{ac:Xr,co:Xr,es:Xr,go:Xr,hs:Xr,kg:Xr,mil:Xr,ms:Xr,ne:Xr,or:Xr,pe:Xr,re:Xr,sc:Xr,busan:Xr,chungbuk:Xr,chungnam:Xr,daegu:Xr,daejeon:Xr,gangwon:Xr,gwangju:Xr,gyeongbuk:Xr,gyeonggi:Xr,gyeongnam:Xr,incheon:Xr,jeju:Xr,jeonbuk:Xr,jeonnam:Xr,seoul:Xr,ulsan:Xr,blogspot:eo}],kw:[1,{com:Xr,edu:Xr,emb:Xr,gov:Xr,ind:Xr,net:Xr,org:Xr}],ky:Wo,kz:[1,{org:Xr,edu:Xr,net:Xr,gov:Xr,mil:Xr,com:Xr,jcloud:eo,kazteleport:[0,{upaas:eo}]}],la:[1,{int:Xr,net:Xr,info:Xr,edu:Xr,gov:Xr,per:Xr,com:Xr,org:Xr,bnr:eo,c:eo}],lb:to,lc:[1,{com:Xr,net:Xr,co:Xr,org:Xr,edu:Xr,gov:Xr,oy:eo}],li:[1,{blogspot:eo,caa:eo}],lk:[1,{gov:Xr,sch:Xr,net:Xr,int:Xr,com:Xr,org:Xr,edu:Xr,ngo:Xr,soc:Xr,web:Xr,ltd:Xr,assn:Xr,grp:Xr,hotel:Xr,ac:Xr}],lr:to,ls:[1,{ac:Xr,biz:Xr,co:Xr,edu:Xr,gov:Xr,info:Xr,net:Xr,org:Xr,sc:Xr,de:eo}],lt:Ao,lu:[1,{blogspot:eo,"123website":eo}],lv:[1,{com:Xr,edu:Xr,gov:Xr,org:Xr,mil:Xr,id:Xr,net:Xr,asn:Xr,conf:Xr}],ly:[1,{com:Xr,net:Xr,gov:Xr,plc:Xr,edu:Xr,sch:Xr,med:Xr,org:Xr,id:Xr}],ma:[1,{co:Xr,net:Xr,gov:Xr,org:Xr,ac:Xr,press:Xr}],mc:[1,{tm:Xr,asso:Xr}],md:[1,{blogspot:eo,at:eo,de:eo,jp:eo,to:eo}],me:[1,{co:Xr,net:Xr,org:Xr,edu:Xr,ac:Xr,gov:Xr,its:Xr,priv:Xr,c66:eo,daplie:[2,{localhost:eo}],edgestack:eo,filegear:eo,"filegear-au":eo,"filegear-de":eo,"filegear-gb":eo,"filegear-ie":eo,"filegear-jp":eo,"filegear-sg":eo,glitch:eo,ravendb:eo,lohmus:eo,barsy:eo,mcpe:eo,mcdir:eo,soundcast:eo,tcp4:eo,brasilia:eo,ddns:eo,dnsfor:eo,hopto:eo,loginto:eo,noip:eo,webhop:eo,vp4:eo,diskstation:eo,dscloud:eo,i234:eo,myds:eo,synology:eo,transip:Mo,wedeploy:eo,yombo:eo,nohost:eo}],mg:[1,{org:Xr,nom:Xr,gov:Xr,prd:Xr,tm:Xr,edu:Xr,mil:Xr,com:Xr,co:Xr}],mh:Xr,mil:Xr,mk:[1,{com:Xr,org:Xr,net:Xr,edu:Xr,gov:Xr,inf:Xr,name:Xr,blogspot:eo}],ml:[1,{com:Xr,edu:Xr,gouv:Xr,gov:Xr,net:Xr,org:Xr,presse:Xr}],mm:oo,mn:[1,{gov:Xr,edu:Xr,org:Xr,nyc:eo}],mo:to,mobi:[1,{barsy:eo,dscloud:eo}],mp:[1,{ju:eo}],mq:Xr,mr:Ao,ms:[1,{com:Xr,edu:Xr,gov:Xr,net:Xr,org:Xr,lab:eo,minisite:eo}],mt:[1,{com:no,edu:Xr,net:Xr,org:Xr}],mu:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,ac:Xr,co:Xr,or:Xr}],museum:Xr,mv:[1,{aero:Xr,biz:Xr,com:Xr,coop:Xr,edu:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,museum:Xr,name:Xr,net:Xr,org:Xr,pro:Xr}],mw:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,coop:Xr,edu:Xr,gov:Xr,int:Xr,museum:Xr,net:Xr,org:Xr}],mx:[1,{com:Xr,org:Xr,gob:Xr,edu:Xr,net:Xr,blogspot:eo}],my:[1,{biz:Xr,com:Xr,edu:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,blogspot:eo}],mz:[1,{ac:Xr,adv:Xr,co:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],na:[1,{info:Xr,pro:Xr,name:Xr,school:Xr,or:Xr,dr:Xr,us:Xr,mx:Xr,ca:Xr,in:Xr,cc:Xr,tv:Xr,ws:Xr,mobi:Xr,co:Xr,com:Xr,org:Xr}],name:[1,{her:Io,his:Io}],nc:[1,{asso:Xr,nom:Xr}],ne:Xr,net:[1,{adobeaemcloud:eo,"adobeio-static":eo,adobeioruntime:eo,akadns:eo,akamai:eo,"akamai-staging":eo,akamaiedge:eo,"akamaiedge-staging":eo,akamaihd:eo,"akamaihd-staging":eo,akamaiorigin:eo,"akamaiorigin-staging":eo,akamaized:eo,"akamaized-staging":eo,edgekey:eo,"edgekey-staging":eo,edgesuite:eo,"edgesuite-staging":eo,alwaysdata:eo,myamaze:eo,cloudfront:eo,t3l3p0rt:eo,appudo:eo,"atlassian-dev":[0,{prod:[0,{cdn:eo}]}],myfritz:eo,onavstack:eo,shopselect:eo,blackbaudcdn:eo,boomla:eo,bplaced:eo,square7:eo,gb:eo,hu:eo,jp:eo,se:eo,uk:eo,in:eo,clickrising:eo,cloudaccess:eo,"cdn77-ssl":eo,cdn77:[0,{r:eo}],"feste-ip":eo,"knx-server":eo,"static-access":eo,cryptonomic:ro,dattolocal:eo,mydatto:eo,debian:eo,bitbridge:eo,"at-band-camp":eo,blogdns:eo,"broke-it":eo,buyshouses:eo,dnsalias:eo,dnsdojo:eo,"does-it":eo,dontexist:eo,dynalias:eo,dynathome:eo,endofinternet:eo,"from-az":eo,"from-co":eo,"from-la":eo,"from-ny":eo,"gets-it":eo,"ham-radio-op":eo,homeftp:eo,homeip:eo,homelinux:eo,homeunix:eo,"in-the-band":eo,"is-a-chef":eo,"is-a-geek":eo,"isa-geek":eo,"kicks-ass":eo,"office-on-the":eo,podzone:eo,"scrapper-site":eo,selfip:eo,"sells-it":eo,servebbs:eo,serveftp:eo,thruhere:eo,webhop:eo,definima:eo,casacam:eo,dynu:eo,dynv6:eo,twmail:eo,ru:eo,channelsdvr:[2,{u:eo}],fastlylb:[2,{map:eo}],fastly:[0,{freetls:eo,map:eo,prod:[0,{a:eo,global:eo}],ssl:[0,{a:eo,b:eo,global:eo}]}],edgeapp:eo,flynnhosting:eo,"cdn-edges":eo,heteml:eo,cloudfunctions:eo,moonscale:eo,"in-dsl":eo,"in-vpn":eo,ipifony:eo,iobb:eo,cloudjiffy:[2,{"fra1-de":eo,"west1-us":eo}],elastx:[0,{"jls-sto1":eo,"jls-sto2":eo,"jls-sto3":eo}],faststacks:eo,massivegrid:[0,{paas:[0,{"fr-1":eo,"lon-1":eo,"lon-2":eo,"ny-1":eo,"ny-2":eo,"sg-1":eo}]}],saveincloud:[0,{jelastic:eo,"nordeste-idc":eo}],scaleforce:Jo,tsukaeru:Po,kinghost:eo,uni5:eo,krellian:eo,barsy:eo,memset:eo,azurewebsites:eo,"azure-mobile":eo,cloudapp:eo,azurestaticapps:[2,{1:eo,2:eo,3:eo,centralus:eo,eastasia:eo,eastus2:eo,westeurope:eo,westus2:eo}],dnsup:eo,hicam:eo,"now-dns":eo,ownip:eo,vpndns:eo,"eating-organic":eo,mydissent:eo,myeffect:eo,mymediapc:eo,mypsx:eo,mysecuritycamera:eo,nhlfan:eo,"no-ip":eo,pgafan:eo,privatizehealthinsurance:eo,bounceme:eo,ddns:eo,redirectme:eo,serveblog:eo,serveminecraft:eo,sytes:eo,cloudycluster:eo,ovh:[0,{webpaas:ro,hosting:ro}],bar0:eo,bar1:eo,bar2:eo,rackmaze:eo,squares:eo,schokokeks:eo,"firewall-gateway":eo,seidat:eo,senseering:eo,siteleaf:eo,"vps-host":[2,{jelastic:[0,{atl:eo,njs:eo,ric:eo}]}],myspreadshop:eo,srcf:[0,{soc:eo,user:eo}],supabase:eo,dsmynas:eo,familyds:eo,tailscale:[0,{beta:eo}],ts:eo,torproject:[2,{pages:eo}],"reserve-online":eo,"community-pro":eo,meinforum:eo,yandexcloud:[2,{storage:eo,website:eo}],za:eo}],nf:[1,{com:Xr,net:Xr,per:Xr,rec:Xr,web:Xr,arts:Xr,firm:Xr,info:Xr,other:Xr,store:Xr}],ng:[1,{com:no,edu:Xr,gov:Xr,i:Xr,mil:Xr,mobi:Xr,name:Xr,net:Xr,org:Xr,sch:Xr,col:eo,firm:eo,gen:eo,ltd:eo,ngo:eo}],ni:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,gob:Xr,in:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,web:Xr}],nl:[1,{co:eo,"hosting-cluster":eo,blogspot:eo,gov:eo,khplay:eo,"123website":eo,myspreadshop:eo,transurl:ro,cistron:eo,demon:eo}],no:[1,{fhs:Xr,vgs:Xr,fylkesbibl:Xr,folkebibl:Xr,museum:Xr,idrett:Xr,priv:Xr,mil:Xr,stat:Xr,dep:Xr,kommune:Xr,herad:Xr,aa:Do,ah:Do,bu:Do,fm:Do,hl:Do,hm:Do,"jan-mayen":Do,mr:Do,nl:Do,nt:Do,of:Do,ol:Do,oslo:Do,rl:Do,sf:Do,st:Do,svalbard:Do,tm:Do,tr:Do,va:Do,vf:Do,akrehamn:Xr,"xn--krehamn-dxa":Xr,åkrehamn:Xr,algard:Xr,"xn--lgrd-poac":Xr,ålgård:Xr,arna:Xr,brumunddal:Xr,bryne:Xr,bronnoysund:Xr,"xn--brnnysund-m8ac":Xr,brønnøysund:Xr,drobak:Xr,"xn--drbak-wua":Xr,drøbak:Xr,egersund:Xr,fetsund:Xr,floro:Xr,"xn--flor-jra":Xr,florø:Xr,fredrikstad:Xr,hokksund:Xr,honefoss:Xr,"xn--hnefoss-q1a":Xr,hønefoss:Xr,jessheim:Xr,jorpeland:Xr,"xn--jrpeland-54a":Xr,jørpeland:Xr,kirkenes:Xr,kopervik:Xr,krokstadelva:Xr,langevag:Xr,"xn--langevg-jxa":Xr,langevåg:Xr,leirvik:Xr,mjondalen:Xr,"xn--mjndalen-64a":Xr,mjøndalen:Xr,"mo-i-rana":Xr,mosjoen:Xr,"xn--mosjen-eya":Xr,mosjøen:Xr,nesoddtangen:Xr,orkanger:Xr,osoyro:Xr,"xn--osyro-wua":Xr,osøyro:Xr,raholt:Xr,"xn--rholt-mra":Xr,råholt:Xr,sandnessjoen:Xr,"xn--sandnessjen-ogb":Xr,sandnessjøen:Xr,skedsmokorset:Xr,slattum:Xr,spjelkavik:Xr,stathelle:Xr,stavern:Xr,stjordalshalsen:Xr,"xn--stjrdalshalsen-sqb":Xr,stjørdalshalsen:Xr,tananger:Xr,tranby:Xr,vossevangen:Xr,afjord:Xr,"xn--fjord-lra":Xr,åfjord:Xr,agdenes:Xr,al:Xr,"xn--l-1fa":Xr,ål:Xr,alesund:Xr,"xn--lesund-hua":Xr,ålesund:Xr,alstahaug:Xr,alta:Xr,"xn--lt-liac":Xr,áltá:Xr,alaheadju:Xr,"xn--laheadju-7ya":Xr,álaheadju:Xr,alvdal:Xr,amli:Xr,"xn--mli-tla":Xr,åmli:Xr,amot:Xr,"xn--mot-tla":Xr,åmot:Xr,andebu:Xr,andoy:Xr,"xn--andy-ira":Xr,andøy:Xr,andasuolo:Xr,ardal:Xr,"xn--rdal-poa":Xr,årdal:Xr,aremark:Xr,arendal:Xr,"xn--s-1fa":Xr,ås:Xr,aseral:Xr,"xn--seral-lra":Xr,åseral:Xr,asker:Xr,askim:Xr,askvoll:Xr,askoy:Xr,"xn--asky-ira":Xr,askøy:Xr,asnes:Xr,"xn--snes-poa":Xr,åsnes:Xr,audnedaln:Xr,aukra:Xr,aure:Xr,aurland:Xr,"aurskog-holand":Xr,"xn--aurskog-hland-jnb":Xr,"aurskog-høland":Xr,austevoll:Xr,austrheim:Xr,averoy:Xr,"xn--avery-yua":Xr,averøy:Xr,balestrand:Xr,ballangen:Xr,balat:Xr,"xn--blt-elab":Xr,bálát:Xr,balsfjord:Xr,bahccavuotna:Xr,"xn--bhccavuotna-k7a":Xr,báhccavuotna:Xr,bamble:Xr,bardu:Xr,beardu:Xr,beiarn:Xr,bajddar:Xr,"xn--bjddar-pta":Xr,bájddar:Xr,baidar:Xr,"xn--bidr-5nac":Xr,báidár:Xr,berg:Xr,bergen:Xr,berlevag:Xr,"xn--berlevg-jxa":Xr,berlevåg:Xr,bearalvahki:Xr,"xn--bearalvhki-y4a":Xr,bearalváhki:Xr,bindal:Xr,birkenes:Xr,bjarkoy:Xr,"xn--bjarky-fya":Xr,bjarkøy:Xr,bjerkreim:Xr,bjugn:Xr,bodo:Xr,"xn--bod-2na":Xr,bodø:Xr,badaddja:Xr,"xn--bdddj-mrabd":Xr,bådåddjå:Xr,budejju:Xr,bokn:Xr,bremanger:Xr,bronnoy:Xr,"xn--brnny-wuac":Xr,brønnøy:Xr,bygland:Xr,bykle:Xr,barum:Xr,"xn--brum-voa":Xr,bærum:Xr,telemark:[0,{bo:Xr,"xn--b-5ga":Xr,bø:Xr}],nordland:[0,{bo:Xr,"xn--b-5ga":Xr,bø:Xr,heroy:Xr,"xn--hery-ira":Xr,herøy:Xr}],bievat:Xr,"xn--bievt-0qa":Xr,bievát:Xr,bomlo:Xr,"xn--bmlo-gra":Xr,bømlo:Xr,batsfjord:Xr,"xn--btsfjord-9za":Xr,båtsfjord:Xr,bahcavuotna:Xr,"xn--bhcavuotna-s4a":Xr,báhcavuotna:Xr,dovre:Xr,drammen:Xr,drangedal:Xr,dyroy:Xr,"xn--dyry-ira":Xr,dyrøy:Xr,donna:Xr,"xn--dnna-gra":Xr,dønna:Xr,eid:Xr,eidfjord:Xr,eidsberg:Xr,eidskog:Xr,eidsvoll:Xr,eigersund:Xr,elverum:Xr,enebakk:Xr,engerdal:Xr,etne:Xr,etnedal:Xr,evenes:Xr,evenassi:Xr,"xn--eveni-0qa01ga":Xr,evenášši:Xr,"evje-og-hornnes":Xr,farsund:Xr,fauske:Xr,fuossko:Xr,fuoisku:Xr,fedje:Xr,fet:Xr,finnoy:Xr,"xn--finny-yua":Xr,finnøy:Xr,fitjar:Xr,fjaler:Xr,fjell:Xr,flakstad:Xr,flatanger:Xr,flekkefjord:Xr,flesberg:Xr,flora:Xr,fla:Xr,"xn--fl-zia":Xr,flå:Xr,folldal:Xr,forsand:Xr,fosnes:Xr,frei:Xr,frogn:Xr,froland:Xr,frosta:Xr,frana:Xr,"xn--frna-woa":Xr,fræna:Xr,froya:Xr,"xn--frya-hra":Xr,frøya:Xr,fusa:Xr,fyresdal:Xr,forde:Xr,"xn--frde-gra":Xr,førde:Xr,gamvik:Xr,gangaviika:Xr,"xn--ggaviika-8ya47h":Xr,gáŋgaviika:Xr,gaular:Xr,gausdal:Xr,gildeskal:Xr,"xn--gildeskl-g0a":Xr,gildeskål:Xr,giske:Xr,gjemnes:Xr,gjerdrum:Xr,gjerstad:Xr,gjesdal:Xr,gjovik:Xr,"xn--gjvik-wua":Xr,gjøvik:Xr,gloppen:Xr,gol:Xr,gran:Xr,grane:Xr,granvin:Xr,gratangen:Xr,grimstad:Xr,grong:Xr,kraanghke:Xr,"xn--kranghke-b0a":Xr,kråanghke:Xr,grue:Xr,gulen:Xr,hadsel:Xr,halden:Xr,halsa:Xr,hamar:Xr,hamaroy:Xr,habmer:Xr,"xn--hbmer-xqa":Xr,hábmer:Xr,hapmir:Xr,"xn--hpmir-xqa":Xr,hápmir:Xr,hammerfest:Xr,hammarfeasta:Xr,"xn--hmmrfeasta-s4ac":Xr,hámmárfeasta:Xr,haram:Xr,hareid:Xr,harstad:Xr,hasvik:Xr,aknoluokta:Xr,"xn--koluokta-7ya57h":Xr,ákŋoluokta:Xr,hattfjelldal:Xr,aarborte:Xr,haugesund:Xr,hemne:Xr,hemnes:Xr,hemsedal:Xr,"more-og-romsdal":[0,{heroy:Xr,sande:Xr}],"xn--mre-og-romsdal-qqb":[0,{"xn--hery-ira":Xr,sande:Xr}],"møre-og-romsdal":[0,{herøy:Xr,sande:Xr}],hitra:Xr,hjartdal:Xr,hjelmeland:Xr,hobol:Xr,"xn--hobl-ira":Xr,hobøl:Xr,hof:Xr,hol:Xr,hole:Xr,holmestrand:Xr,holtalen:Xr,"xn--holtlen-hxa":Xr,holtålen:Xr,hornindal:Xr,horten:Xr,hurdal:Xr,hurum:Xr,hvaler:Xr,hyllestad:Xr,hagebostad:Xr,"xn--hgebostad-g3a":Xr,hægebostad:Xr,hoyanger:Xr,"xn--hyanger-q1a":Xr,høyanger:Xr,hoylandet:Xr,"xn--hylandet-54a":Xr,høylandet:Xr,ha:Xr,"xn--h-2fa":Xr,hå:Xr,ibestad:Xr,inderoy:Xr,"xn--indery-fya":Xr,inderøy:Xr,iveland:Xr,jevnaker:Xr,jondal:Xr,jolster:Xr,"xn--jlster-bya":Xr,jølster:Xr,karasjok:Xr,karasjohka:Xr,"xn--krjohka-hwab49j":Xr,kárášjohka:Xr,karlsoy:Xr,galsa:Xr,"xn--gls-elac":Xr,gálsá:Xr,karmoy:Xr,"xn--karmy-yua":Xr,karmøy:Xr,kautokeino:Xr,guovdageaidnu:Xr,klepp:Xr,klabu:Xr,"xn--klbu-woa":Xr,klæbu:Xr,kongsberg:Xr,kongsvinger:Xr,kragero:Xr,"xn--krager-gya":Xr,kragerø:Xr,kristiansand:Xr,kristiansund:Xr,krodsherad:Xr,"xn--krdsherad-m8a":Xr,krødsherad:Xr,kvalsund:Xr,rahkkeravju:Xr,"xn--rhkkervju-01af":Xr,ráhkkerávju:Xr,kvam:Xr,kvinesdal:Xr,kvinnherad:Xr,kviteseid:Xr,kvitsoy:Xr,"xn--kvitsy-fya":Xr,kvitsøy:Xr,kvafjord:Xr,"xn--kvfjord-nxa":Xr,kvæfjord:Xr,giehtavuoatna:Xr,kvanangen:Xr,"xn--kvnangen-k0a":Xr,kvænangen:Xr,navuotna:Xr,"xn--nvuotna-hwa":Xr,návuotna:Xr,kafjord:Xr,"xn--kfjord-iua":Xr,kåfjord:Xr,gaivuotna:Xr,"xn--givuotna-8ya":Xr,gáivuotna:Xr,larvik:Xr,lavangen:Xr,lavagis:Xr,loabat:Xr,"xn--loabt-0qa":Xr,loabát:Xr,lebesby:Xr,davvesiida:Xr,leikanger:Xr,leirfjord:Xr,leka:Xr,leksvik:Xr,lenvik:Xr,leangaviika:Xr,"xn--leagaviika-52b":Xr,leaŋgaviika:Xr,lesja:Xr,levanger:Xr,lier:Xr,lierne:Xr,lillehammer:Xr,lillesand:Xr,lindesnes:Xr,lindas:Xr,"xn--linds-pra":Xr,lindås:Xr,lom:Xr,loppa:Xr,lahppi:Xr,"xn--lhppi-xqa":Xr,láhppi:Xr,lund:Xr,lunner:Xr,luroy:Xr,"xn--lury-ira":Xr,lurøy:Xr,luster:Xr,lyngdal:Xr,lyngen:Xr,ivgu:Xr,lardal:Xr,lerdal:Xr,"xn--lrdal-sra":Xr,lærdal:Xr,lodingen:Xr,"xn--ldingen-q1a":Xr,lødingen:Xr,lorenskog:Xr,"xn--lrenskog-54a":Xr,lørenskog:Xr,loten:Xr,"xn--lten-gra":Xr,løten:Xr,malvik:Xr,masoy:Xr,"xn--msy-ula0h":Xr,måsøy:Xr,muosat:Xr,"xn--muost-0qa":Xr,muosát:Xr,mandal:Xr,marker:Xr,marnardal:Xr,masfjorden:Xr,meland:Xr,meldal:Xr,melhus:Xr,meloy:Xr,"xn--mely-ira":Xr,meløy:Xr,meraker:Xr,"xn--merker-kua":Xr,meråker:Xr,moareke:Xr,"xn--moreke-jua":Xr,moåreke:Xr,midsund:Xr,"midtre-gauldal":Xr,modalen:Xr,modum:Xr,molde:Xr,moskenes:Xr,moss:Xr,mosvik:Xr,malselv:Xr,"xn--mlselv-iua":Xr,målselv:Xr,malatvuopmi:Xr,"xn--mlatvuopmi-s4a":Xr,málatvuopmi:Xr,namdalseid:Xr,aejrie:Xr,namsos:Xr,namsskogan:Xr,naamesjevuemie:Xr,"xn--nmesjevuemie-tcba":Xr,nååmesjevuemie:Xr,laakesvuemie:Xr,nannestad:Xr,narvik:Xr,narviika:Xr,naustdal:Xr,"nedre-eiker":Xr,akershus:Lo,buskerud:Lo,nesna:Xr,nesodden:Xr,nesseby:Xr,unjarga:Xr,"xn--unjrga-rta":Xr,unjárga:Xr,nesset:Xr,nissedal:Xr,nittedal:Xr,"nord-aurdal":Xr,"nord-fron":Xr,"nord-odal":Xr,norddal:Xr,nordkapp:Xr,davvenjarga:Xr,"xn--davvenjrga-y4a":Xr,davvenjárga:Xr,"nordre-land":Xr,nordreisa:Xr,raisa:Xr,"xn--risa-5na":Xr,ráisa:Xr,"nore-og-uvdal":Xr,notodden:Xr,naroy:Xr,"xn--nry-yla5g":Xr,nærøy:Xr,notteroy:Xr,"xn--nttery-byae":Xr,nøtterøy:Xr,odda:Xr,oksnes:Xr,"xn--ksnes-uua":Xr,øksnes:Xr,oppdal:Xr,oppegard:Xr,"xn--oppegrd-ixa":Xr,oppegård:Xr,orkdal:Xr,orland:Xr,"xn--rland-uua":Xr,ørland:Xr,orskog:Xr,"xn--rskog-uua":Xr,ørskog:Xr,orsta:Xr,"xn--rsta-fra":Xr,ørsta:Xr,hedmark:[0,{os:Xr,valer:Xr,"xn--vler-qoa":Xr,våler:Xr}],hordaland:[0,{os:Xr}],osen:Xr,osteroy:Xr,"xn--ostery-fya":Xr,osterøy:Xr,"ostre-toten":Xr,"xn--stre-toten-zcb":Xr,"østre-toten":Xr,overhalla:Xr,"ovre-eiker":Xr,"xn--vre-eiker-k8a":Xr,"øvre-eiker":Xr,oyer:Xr,"xn--yer-zna":Xr,øyer:Xr,oygarden:Xr,"xn--ygarden-p1a":Xr,øygarden:Xr,"oystre-slidre":Xr,"xn--ystre-slidre-ujb":Xr,"øystre-slidre":Xr,porsanger:Xr,porsangu:Xr,"xn--porsgu-sta26f":Xr,porsáŋgu:Xr,porsgrunn:Xr,radoy:Xr,"xn--rady-ira":Xr,radøy:Xr,rakkestad:Xr,rana:Xr,ruovat:Xr,randaberg:Xr,rauma:Xr,rendalen:Xr,rennebu:Xr,rennesoy:Xr,"xn--rennesy-v1a":Xr,rennesøy:Xr,rindal:Xr,ringebu:Xr,ringerike:Xr,ringsaker:Xr,rissa:Xr,risor:Xr,"xn--risr-ira":Xr,risør:Xr,roan:Xr,rollag:Xr,rygge:Xr,ralingen:Xr,"xn--rlingen-mxa":Xr,rælingen:Xr,rodoy:Xr,"xn--rdy-0nab":Xr,rødøy:Xr,romskog:Xr,"xn--rmskog-bya":Xr,rømskog:Xr,roros:Xr,"xn--rros-gra":Xr,røros:Xr,rost:Xr,"xn--rst-0na":Xr,røst:Xr,royken:Xr,"xn--ryken-vua":Xr,røyken:Xr,royrvik:Xr,"xn--ryrvik-bya":Xr,røyrvik:Xr,rade:Xr,"xn--rde-ula":Xr,råde:Xr,salangen:Xr,siellak:Xr,saltdal:Xr,salat:Xr,"xn--slt-elab":Xr,sálát:Xr,"xn--slat-5na":Xr,sálat:Xr,samnanger:Xr,vestfold:[0,{sande:Xr}],sandefjord:Xr,sandnes:Xr,sandoy:Xr,"xn--sandy-yua":Xr,sandøy:Xr,sarpsborg:Xr,sauda:Xr,sauherad:Xr,sel:Xr,selbu:Xr,selje:Xr,seljord:Xr,sigdal:Xr,siljan:Xr,sirdal:Xr,skaun:Xr,skedsmo:Xr,ski:Xr,skien:Xr,skiptvet:Xr,skjervoy:Xr,"xn--skjervy-v1a":Xr,skjervøy:Xr,skierva:Xr,"xn--skierv-uta":Xr,skiervá:Xr,skjak:Xr,"xn--skjk-soa":Xr,skjåk:Xr,skodje:Xr,skanland:Xr,"xn--sknland-fxa":Xr,skånland:Xr,skanit:Xr,"xn--sknit-yqa":Xr,skánit:Xr,smola:Xr,"xn--smla-hra":Xr,smøla:Xr,snillfjord:Xr,snasa:Xr,"xn--snsa-roa":Xr,snåsa:Xr,snoasa:Xr,snaase:Xr,"xn--snase-nra":Xr,snåase:Xr,sogndal:Xr,sokndal:Xr,sola:Xr,solund:Xr,songdalen:Xr,sortland:Xr,spydeberg:Xr,stange:Xr,stavanger:Xr,steigen:Xr,steinkjer:Xr,stjordal:Xr,"xn--stjrdal-s1a":Xr,stjørdal:Xr,stokke:Xr,"stor-elvdal":Xr,stord:Xr,stordal:Xr,storfjord:Xr,omasvuotna:Xr,strand:Xr,stranda:Xr,stryn:Xr,sula:Xr,suldal:Xr,sund:Xr,sunndal:Xr,surnadal:Xr,sveio:Xr,svelvik:Xr,sykkylven:Xr,sogne:Xr,"xn--sgne-gra":Xr,søgne:Xr,somna:Xr,"xn--smna-gra":Xr,sømna:Xr,"sondre-land":Xr,"xn--sndre-land-0cb":Xr,"søndre-land":Xr,"sor-aurdal":Xr,"xn--sr-aurdal-l8a":Xr,"sør-aurdal":Xr,"sor-fron":Xr,"xn--sr-fron-q1a":Xr,"sør-fron":Xr,"sor-odal":Xr,"xn--sr-odal-q1a":Xr,"sør-odal":Xr,"sor-varanger":Xr,"xn--sr-varanger-ggb":Xr,"sør-varanger":Xr,"matta-varjjat":Xr,"xn--mtta-vrjjat-k7af":Xr,"mátta-várjjat":Xr,sorfold:Xr,"xn--srfold-bya":Xr,sørfold:Xr,sorreisa:Xr,"xn--srreisa-q1a":Xr,sørreisa:Xr,sorum:Xr,"xn--srum-gra":Xr,sørum:Xr,tana:Xr,deatnu:Xr,time:Xr,tingvoll:Xr,tinn:Xr,tjeldsund:Xr,dielddanuorri:Xr,tjome:Xr,"xn--tjme-hra":Xr,tjøme:Xr,tokke:Xr,tolga:Xr,torsken:Xr,tranoy:Xr,"xn--trany-yua":Xr,tranøy:Xr,tromso:Xr,"xn--troms-zua":Xr,tromsø:Xr,tromsa:Xr,romsa:Xr,trondheim:Xr,troandin:Xr,trysil:Xr,trana:Xr,"xn--trna-woa":Xr,træna:Xr,trogstad:Xr,"xn--trgstad-r1a":Xr,trøgstad:Xr,tvedestrand:Xr,tydal:Xr,tynset:Xr,tysfjord:Xr,divtasvuodna:Xr,divttasvuotna:Xr,tysnes:Xr,tysvar:Xr,"xn--tysvr-vra":Xr,tysvær:Xr,tonsberg:Xr,"xn--tnsberg-q1a":Xr,tønsberg:Xr,ullensaker:Xr,ullensvang:Xr,ulvik:Xr,utsira:Xr,vadso:Xr,"xn--vads-jra":Xr,vadsø:Xr,cahcesuolo:Xr,"xn--hcesuolo-7ya35b":Xr,čáhcesuolo:Xr,vaksdal:Xr,valle:Xr,vang:Xr,vanylven:Xr,vardo:Xr,"xn--vard-jra":Xr,vardø:Xr,varggat:Xr,"xn--vrggt-xqad":Xr,várggát:Xr,vefsn:Xr,vaapste:Xr,vega:Xr,vegarshei:Xr,"xn--vegrshei-c0a":Xr,vegårshei:Xr,vennesla:Xr,verdal:Xr,verran:Xr,vestby:Xr,vestnes:Xr,"vestre-slidre":Xr,"vestre-toten":Xr,vestvagoy:Xr,"xn--vestvgy-ixa6o":Xr,vestvågøy:Xr,vevelstad:Xr,vik:Xr,vikna:Xr,vindafjord:Xr,volda:Xr,voss:Xr,varoy:Xr,"xn--vry-yla5g":Xr,værøy:Xr,vagan:Xr,"xn--vgan-qoa":Xr,vågan:Xr,voagat:Xr,vagsoy:Xr,"xn--vgsy-qoa0j":Xr,vågsøy:Xr,vaga:Xr,"xn--vg-yiab":Xr,vågå:Xr,ostfold:[0,{valer:Xr}],"xn--stfold-9xa":[0,{"xn--vler-qoa":Xr}],østfold:[0,{våler:Xr}],co:eo,blogspot:eo,"123hjemmeside":eo,myspreadshop:eo}],np:oo,nr:To,nu:[1,{merseine:eo,mine:eo,shacknet:eo,enterprisecloud:eo}],nz:[1,{ac:Xr,co:no,cri:Xr,geek:Xr,gen:Xr,govt:Xr,health:Xr,iwi:Xr,kiwi:Xr,maori:Xr,mil:Xr,"xn--mori-qsa":Xr,māori:Xr,net:Xr,org:Xr,parliament:Xr,school:Xr}],om:[1,{co:Xr,com:Xr,edu:Xr,gov:Xr,med:Xr,museum:Xr,net:Xr,org:Xr,pro:Xr}],onion:Xr,org:[1,{altervista:eo,amune:[0,{tele:eo}],pimienta:eo,poivron:eo,potager:eo,sweetpepper:eo,ae:eo,us:eo,certmgr:eo,cdn77:[0,{c:eo,rsc:eo}],"cdn77-secure":[0,{origin:[0,{ssl:eo}]}],cloudns:eo,duckdns:eo,tunk:eo,dyndns:[2,{go:eo,home:eo}],blogdns:eo,blogsite:eo,boldlygoingnowhere:eo,dnsalias:eo,dnsdojo:eo,doesntexist:eo,dontexist:eo,doomdns:eo,dvrdns:eo,dynalias:eo,endofinternet:eo,endoftheinternet:eo,"from-me":eo,"game-host":eo,gotdns:eo,"hobby-site":eo,homedns:eo,homeftp:eo,homelinux:eo,homeunix:eo,"is-a-bruinsfan":eo,"is-a-candidate":eo,"is-a-celticsfan":eo,"is-a-chef":eo,"is-a-geek":eo,"is-a-knight":eo,"is-a-linux-user":eo,"is-a-patsfan":eo,"is-a-soxfan":eo,"is-found":eo,"is-lost":eo,"is-saved":eo,"is-very-bad":eo,"is-very-evil":eo,"is-very-good":eo,"is-very-nice":eo,"is-very-sweet":eo,"isa-geek":eo,"kicks-ass":eo,misconfused:eo,podzone:eo,readmyblog:eo,selfip:eo,sellsyourhome:eo,servebbs:eo,serveftp:eo,servegame:eo,"stuff-4-sale":eo,webhop:eo,ddnss:eo,accesscam:eo,camdvr:eo,freeddns:eo,mywire:eo,webredirect:eo,eu:[2,{al:eo,asso:eo,at:eo,au:eo,be:eo,bg:eo,ca:eo,cd:eo,ch:eo,cn:eo,cy:eo,cz:eo,de:eo,dk:eo,edu:eo,ee:eo,es:eo,fi:eo,fr:eo,gr:eo,hr:eo,hu:eo,ie:eo,il:eo,in:eo,int:eo,is:eo,it:eo,jp:eo,kr:eo,lt:eo,lu:eo,lv:eo,mc:eo,me:eo,mk:eo,mt:eo,my:eo,net:eo,ng:eo,nl:eo,no:eo,nz:eo,paris:eo,pl:eo,pt:eo,"q-a":eo,ro:eo,ru:eo,se:eo,si:eo,sk:eo,tr:eo,uk:eo,us:eo}],twmail:eo,fedorainfracloud:eo,fedorapeople:eo,fedoraproject:[0,{cloud:eo,os:jo,stg:[0,{os:jo}]}],freedesktop:eo,hepforge:eo,"in-dsl":eo,"in-vpn":eo,js:eo,barsy:eo,mayfirst:eo,"mozilla-iot":eo,bmoattachments:eo,dynserv:eo,"now-dns":eo,"cable-modem":eo,collegefan:eo,couchpotatofries:eo,mlbfan:eo,mysecuritycamera:eo,nflfan:eo,"read-books":eo,ufcfan:eo,hopto:eo,myftp:eo,"no-ip":eo,zapto:eo,httpbin:eo,pubtls:eo,jpn:eo,"my-firewall":eo,myfirewall:eo,spdns:eo,"small-web":eo,dsmynas:eo,familyds:eo,teckids:lo,tuxfamily:eo,diskstation:eo,hk:eo,wmflabs:eo,toolforge:eo,wmcloud:eo,za:eo}],pa:[1,{ac:Xr,gob:Xr,com:Xr,org:Xr,sld:Xr,edu:Xr,net:Xr,ing:Xr,abo:Xr,med:Xr,nom:Xr}],pe:[1,{edu:Xr,gob:Xr,nom:Xr,mil:Xr,org:Xr,com:Xr,net:Xr,blogspot:eo}],pf:[1,{com:Xr,org:Xr,edu:Xr}],pg:oo,ph:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,ngo:Xr,mil:Xr,i:Xr}],pk:[1,{com:Xr,net:Xr,edu:Xr,org:Xr,fam:Xr,biz:Xr,web:Xr,gov:Xr,gob:Xr,gok:Xr,gon:Xr,gop:Xr,gos:Xr,info:Xr}],pl:[1,{com:Xr,net:Xr,org:Xr,aid:Xr,agro:Xr,atm:Xr,auto:Xr,biz:Xr,edu:Xr,gmina:Xr,gsm:Xr,info:Xr,mail:Xr,miasta:Xr,media:Xr,mil:Xr,nieruchomosci:Xr,nom:Xr,pc:Xr,powiat:Xr,priv:Xr,realestate:Xr,rel:Xr,sex:Xr,shop:Xr,sklep:Xr,sos:Xr,szkola:Xr,targi:Xr,tm:Xr,tourism:Xr,travel:Xr,turystyka:Xr,gov:[1,{ap:Xr,griw:Xr,ic:Xr,is:Xr,kmpsp:Xr,konsulat:Xr,kppsp:Xr,kwp:Xr,kwpsp:Xr,mup:Xr,mw:Xr,oia:Xr,oirm:Xr,oke:Xr,oow:Xr,oschr:Xr,oum:Xr,pa:Xr,pinb:Xr,piw:Xr,po:Xr,pr:Xr,psp:Xr,psse:Xr,pup:Xr,rzgw:Xr,sa:Xr,sdn:Xr,sko:Xr,so:Xr,sr:Xr,starostwo:Xr,ug:Xr,ugim:Xr,um:Xr,umig:Xr,upow:Xr,uppo:Xr,us:Xr,uw:Xr,uzs:Xr,wif:Xr,wiih:Xr,winb:Xr,wios:Xr,witd:Xr,wiw:Xr,wkz:Xr,wsa:Xr,wskr:Xr,wsse:Xr,wuoz:Xr,wzmiuw:Xr,zp:Xr,zpisdn:Xr}],augustow:Xr,"babia-gora":Xr,bedzin:Xr,beskidy:Xr,bialowieza:Xr,bialystok:Xr,bielawa:Xr,bieszczady:Xr,boleslawiec:Xr,bydgoszcz:Xr,bytom:Xr,cieszyn:Xr,czeladz:Xr,czest:Xr,dlugoleka:Xr,elblag:Xr,elk:Xr,glogow:Xr,gniezno:Xr,gorlice:Xr,grajewo:Xr,ilawa:Xr,jaworzno:Xr,"jelenia-gora":Xr,jgora:Xr,kalisz:Xr,"kazimierz-dolny":Xr,karpacz:Xr,kartuzy:Xr,kaszuby:Xr,katowice:Xr,kepno:Xr,ketrzyn:Xr,klodzko:Xr,kobierzyce:Xr,kolobrzeg:Xr,konin:Xr,konskowola:Xr,kutno:Xr,lapy:Xr,lebork:Xr,legnica:Xr,lezajsk:Xr,limanowa:Xr,lomza:Xr,lowicz:Xr,lubin:Xr,lukow:Xr,malbork:Xr,malopolska:Xr,mazowsze:Xr,mazury:Xr,mielec:Xr,mielno:Xr,mragowo:Xr,naklo:Xr,nowaruda:Xr,nysa:Xr,olawa:Xr,olecko:Xr,olkusz:Xr,olsztyn:Xr,opoczno:Xr,opole:Xr,ostroda:Xr,ostroleka:Xr,ostrowiec:Xr,ostrowwlkp:Xr,pila:Xr,pisz:Xr,podhale:Xr,podlasie:Xr,polkowice:Xr,pomorze:Xr,pomorskie:Xr,prochowice:Xr,pruszkow:Xr,przeworsk:Xr,pulawy:Xr,radom:Xr,"rawa-maz":Xr,rybnik:Xr,rzeszow:Xr,sanok:Xr,sejny:Xr,slask:Xr,slupsk:Xr,sosnowiec:Xr,"stalowa-wola":Xr,skoczow:Xr,starachowice:Xr,stargard:Xr,suwalki:Xr,swidnica:Xr,swiebodzin:Xr,swinoujscie:Xr,szczecin:Xr,szczytno:Xr,tarnobrzeg:Xr,tgory:Xr,turek:Xr,tychy:Xr,ustka:Xr,walbrzych:Xr,warmia:Xr,warszawa:Xr,waw:Xr,wegrow:Xr,wielun:Xr,wlocl:Xr,wloclawek:Xr,wodzislaw:Xr,wolomin:Xr,wroclaw:Xr,zachpomor:Xr,zagan:Xr,zarow:Xr,zgora:Xr,zgorzelec:Xr,beep:eo,"ecommerce-shop":eo,shoparena:eo,homesklep:eo,sdscloud:eo,unicloud:eo,krasnik:eo,leczna:eo,lubartow:eo,lublin:eo,poniatowa:eo,swidnik:eo,co:eo,simplesite:eo,art:eo,gliwice:eo,krakow:eo,poznan:eo,wroc:eo,zakopane:eo,myspreadshop:eo,gda:eo,gdansk:eo,gdynia:eo,med:eo,sopot:eo}],pm:[1,{own:eo,name:eo}],pn:[1,{gov:Xr,co:Xr,org:Xr,edu:Xr,net:Xr}],post:Xr,pr:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,isla:Xr,pro:Xr,biz:Xr,info:Xr,name:Xr,est:Xr,prof:Xr,ac:Xr}],pro:[1,{aaa:Xr,aca:Xr,acct:Xr,avocat:Xr,bar:Xr,cpa:Xr,eng:Xr,jur:Xr,law:Xr,med:Xr,recht:Xr,cloudns:eo,dnstrace:[0,{bci:eo}],barsy:eo}],ps:[1,{edu:Xr,gov:Xr,sec:Xr,plo:Xr,com:Xr,org:Xr,net:Xr}],pt:[1,{net:Xr,gov:Xr,org:Xr,edu:Xr,int:Xr,publ:Xr,com:Xr,nome:Xr,blogspot:eo,"123paginaweb":eo}],pw:[1,{co:Xr,ne:Xr,or:Xr,ed:Xr,go:Xr,belau:Xr,cloudns:eo,x443:eo}],py:[1,{com:Xr,coop:Xr,edu:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],qa:[1,{com:Xr,edu:Xr,gov:Xr,mil:Xr,name:Xr,net:Xr,org:Xr,sch:Xr,blogspot:eo}],re:[1,{asso:Xr,com:Xr,nom:Xr,blogspot:eo}],ro:[1,{arts:Xr,com:Xr,firm:Xr,info:Xr,nom:Xr,nt:Xr,org:Xr,rec:Xr,store:Xr,tm:Xr,www:Xr,co:eo,shop:eo,blogspot:eo,barsy:eo}],rs:[1,{ac:Xr,co:Xr,edu:Xr,gov:Xr,in:Xr,org:Xr,brendly:[0,{shop:eo}],blogspot:eo,ua:eo,ox:eo}],ru:[1,{ac:eo,edu:eo,gov:eo,int:eo,mil:eo,test:eo,eurodir:eo,adygeya:eo,bashkiria:eo,bir:eo,cbg:eo,com:eo,dagestan:eo,grozny:eo,kalmykia:eo,kustanai:eo,marine:eo,mordovia:eo,msk:eo,mytis:eo,nalchik:eo,nov:eo,pyatigorsk:eo,spb:eo,vladikavkaz:eo,vladimir:eo,blogspot:eo,na4u:eo,mircloud:eo,regruhosting:Po,myjino:[2,{hosting:ro,landing:ro,spectrum:ro,vps:ro}],cldmail:[0,{hb:eo}],mcdir:[2,{vps:eo}],mcpre:eo,net:eo,org:eo,pp:eo,"123sait":eo,lk3:eo,ras:eo}],rw:[1,{ac:Xr,co:Xr,coop:Xr,gov:Xr,mil:Xr,net:Xr,org:Xr}],sa:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,med:Xr,pub:Xr,edu:Xr,sch:Xr}],sb:to,sc:to,sd:[1,{com:Xr,net:Xr,org:Xr,edu:Xr,med:Xr,tv:Xr,gov:Xr,info:Xr}],se:[1,{a:Xr,ac:Xr,b:Xr,bd:Xr,brand:Xr,c:Xr,d:Xr,e:Xr,f:Xr,fh:Xr,fhsk:Xr,fhv:Xr,g:Xr,h:Xr,i:Xr,k:Xr,komforb:Xr,kommunalforbund:Xr,komvux:Xr,l:Xr,lanbib:Xr,m:Xr,n:Xr,naturbruksgymn:Xr,o:Xr,org:Xr,p:Xr,parti:Xr,pp:Xr,press:Xr,r:Xr,s:Xr,t:Xr,tm:Xr,u:Xr,w:Xr,x:Xr,y:Xr,z:Xr,com:eo,blogspot:eo,conf:eo,iopsys:eo,"123minsida":eo,itcouldbewor:eo,myspreadshop:eo,paba:[0,{su:eo}]}],sg:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,per:Xr,blogspot:eo,enscaled:eo}],sh:[1,{com:Xr,net:Xr,gov:Xr,org:Xr,mil:Xr,bip:eo,hashbang:eo,platform:[0,{bc:eo,ent:eo,eu:eo,us:eo}],now:eo,vxl:eo,wedeploy:eo}],si:[1,{gitapp:eo,gitpage:eo,blogspot:eo}],sj:Xr,sk:no,sl:to,sm:Xr,sn:[1,{art:Xr,com:Xr,edu:Xr,gouv:Xr,org:Xr,perso:Xr,univ:Xr,blogspot:eo}],so:[1,{com:Xr,edu:Xr,gov:Xr,me:Xr,net:Xr,org:Xr,sch:eo}],sr:Xr,ss:[1,{biz:Xr,com:Xr,edu:Xr,gov:Xr,me:Xr,net:Xr,org:Xr,sch:Xr}],st:[1,{co:Xr,com:Xr,consulado:Xr,edu:Xr,embaixada:Xr,mil:Xr,net:Xr,org:Xr,principe:Xr,saotome:Xr,store:Xr,kirara:eo,noho:eo}],su:[1,{abkhazia:eo,adygeya:eo,aktyubinsk:eo,arkhangelsk:eo,armenia:eo,ashgabad:eo,azerbaijan:eo,balashov:eo,bashkiria:eo,bryansk:eo,bukhara:eo,chimkent:eo,dagestan:eo,"east-kazakhstan":eo,exnet:eo,georgia:eo,grozny:eo,ivanovo:eo,jambyl:eo,kalmykia:eo,kaluga:eo,karacol:eo,karaganda:eo,karelia:eo,khakassia:eo,krasnodar:eo,kurgan:eo,kustanai:eo,lenug:eo,mangyshlak:eo,mordovia:eo,msk:eo,murmansk:eo,nalchik:eo,navoi:eo,"north-kazakhstan":eo,nov:eo,obninsk:eo,penza:eo,pokrovsk:eo,sochi:eo,spb:eo,tashkent:eo,termez:eo,togliatti:eo,troitsk:eo,tselinograd:eo,tula:eo,tuva:eo,vladikavkaz:eo,vladimir:eo,vologda:eo}],sv:[1,{com:Xr,edu:Xr,gob:Xr,org:Xr,red:Xr}],sx:io,sy:So,sz:[1,{co:Xr,ac:Xr,org:Xr}],tc:[1,{ch:eo,me:eo,we:eo}],td:no,tel:Xr,tf:[1,{sch:eo}],tg:Xr,th:[1,{ac:Xr,co:Xr,go:Xr,in:Xr,mi:Xr,net:Xr,or:Xr,online:eo,shop:eo}],tj:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,go:Xr,gov:Xr,int:Xr,mil:Xr,name:Xr,net:Xr,nic:Xr,org:Xr,test:Xr,web:Xr}],tk:Xr,tl:io,tm:[1,{com:Xr,co:Xr,org:Xr,net:Xr,nom:Xr,gov:Xr,mil:Xr,edu:Xr}],tn:[1,{com:Xr,ens:Xr,fin:Xr,gov:Xr,ind:Xr,info:Xr,intl:Xr,mincom:Xr,nat:Xr,net:Xr,org:Xr,perso:Xr,tourism:Xr,orangecloud:eo}],to:[1,{611:eo,com:Xr,gov:Xr,net:Xr,org:Xr,edu:Xr,mil:Xr,oya:eo,rdv:eo,x0:eo,vpnplus:eo,quickconnect:uo,nyan:eo}],tr:[1,{av:Xr,bbs:Xr,bel:Xr,biz:Xr,com:no,dr:Xr,edu:Xr,gen:Xr,gov:Xr,info:Xr,mil:Xr,k12:Xr,kep:Xr,name:Xr,net:Xr,org:Xr,pol:Xr,tel:Xr,tsk:Xr,tv:Xr,web:Xr,nc:io}],tt:[1,{co:Xr,com:Xr,org:Xr,net:Xr,biz:Xr,info:Xr,pro:Xr,int:Xr,coop:Xr,jobs:Xr,mobi:Xr,travel:Xr,museum:Xr,aero:Xr,name:Xr,gov:Xr,edu:Xr}],tv:[1,{dyndns:eo,"better-than":eo,"on-the-web":eo,"worse-than":eo,from:eo,sakura:eo}],tw:[1,{edu:Xr,gov:Xr,mil:Xr,com:[1,{mymailer:eo}],net:Xr,org:Xr,idv:Xr,game:Xr,ebiz:Xr,club:Xr,"xn--zf0ao64a":Xr,網路:Xr,"xn--uc0atv":Xr,組織:Xr,"xn--czrw28b":Xr,商業:Xr,url:eo,blogspot:eo}],tz:[1,{ac:Xr,co:Xr,go:Xr,hotel:Xr,info:Xr,me:Xr,mil:Xr,mobi:Xr,ne:Xr,or:Xr,sc:Xr,tv:Xr}],ua:[1,{com:Xr,edu:Xr,gov:Xr,in:Xr,net:Xr,org:Xr,cherkassy:Xr,cherkasy:Xr,chernigov:Xr,chernihiv:Xr,chernivtsi:Xr,chernovtsy:Xr,ck:Xr,cn:Xr,cr:Xr,crimea:Xr,cv:Xr,dn:Xr,dnepropetrovsk:Xr,dnipropetrovsk:Xr,donetsk:Xr,dp:Xr,if:Xr,"ivano-frankivsk":Xr,kh:Xr,kharkiv:Xr,kharkov:Xr,kherson:Xr,khmelnitskiy:Xr,khmelnytskyi:Xr,kiev:Xr,kirovograd:Xr,km:Xr,kr:Xr,kropyvnytskyi:Xr,krym:Xr,ks:Xr,kv:Xr,kyiv:Xr,lg:Xr,lt:Xr,lugansk:Xr,luhansk:Xr,lutsk:Xr,lv:Xr,lviv:Xr,mk:Xr,mykolaiv:Xr,nikolaev:Xr,od:Xr,odesa:Xr,odessa:Xr,pl:Xr,poltava:Xr,rivne:Xr,rovno:Xr,rv:Xr,sb:Xr,sebastopol:Xr,sevastopol:Xr,sm:Xr,sumy:Xr,te:Xr,ternopil:Xr,uz:Xr,uzhgorod:Xr,uzhhorod:Xr,vinnica:Xr,vinnytsia:Xr,vn:Xr,volyn:Xr,yalta:Xr,zakarpattia:Xr,zaporizhzhe:Xr,zaporizhzhia:Xr,zhitomir:Xr,zhytomyr:Xr,zp:Xr,zt:Xr,cc:eo,inf:eo,ltd:eo,cx:eo,ie:eo,biz:eo,co:eo,pp:eo,v:eo}],ug:[1,{co:Xr,or:Xr,ac:Xr,sc:Xr,go:Xr,ne:Xr,com:Xr,org:Xr,blogspot:eo}],uk:[1,{ac:Xr,co:[1,{bytemark:[0,{dh:eo,vm:eo}],blogspot:eo,layershift:Jo,barsy:eo,barsyonline:eo,retrosnub:_o,"nh-serv":eo,"no-ip":eo,wellbeingzone:eo,adimo:eo,myspreadshop:eo}],gov:[1,{campaign:eo,service:eo,api:eo,homeoffice:eo}],ltd:Xr,me:Xr,net:Xr,nhs:Xr,org:[1,{glug:eo,lug:eo,lugs:eo,affinitylottery:eo,raffleentry:eo,weeklylottery:eo}],plc:Xr,police:Xr,sch:oo,conn:eo,copro:eo,hosp:eo,"independent-commission":eo,"independent-inquest":eo,"independent-inquiry":eo,"independent-panel":eo,"independent-review":eo,"public-inquiry":eo,"royal-commission":eo,pymnt:eo,barsy:eo}],us:[1,{dni:Xr,fed:Xr,isa:Xr,kids:Xr,nsn:Xr,ak:Ho,al:Ho,ar:Ho,as:Ho,az:Ho,ca:Ho,co:Ho,ct:Ho,dc:Ho,de:[1,{cc:Xr,lib:eo}],fl:Ho,ga:Ho,gu:Ho,hi:Yo,ia:Ho,id:Ho,il:Ho,in:Ho,ks:Ho,ky:Ho,la:Ho,ma:[1,{k12:[1,{pvt:Xr,chtr:Xr,paroch:Xr}],cc:Xr,lib:Xr}],md:Ho,me:Ho,mi:[1,{k12:Xr,cc:Xr,lib:Xr,"ann-arbor":Xr,cog:Xr,dst:Xr,eaton:Xr,gen:Xr,mus:Xr,tec:Xr,washtenaw:Xr}],mn:Ho,mo:Ho,ms:Ho,mt:Ho,nc:Ho,nd:Yo,ne:Ho,nh:Ho,nj:Ho,nm:Ho,nv:Ho,ny:Ho,oh:Ho,ok:Ho,or:Ho,pa:Ho,pr:Ho,ri:Yo,sc:Ho,sd:Yo,tn:Ho,tx:Ho,ut:Ho,vi:Ho,vt:Ho,va:Ho,wa:Ho,wi:Ho,wv:[1,{cc:Xr}],wy:Ho,graphox:eo,cloudns:eo,drud:eo,"is-by":eo,"land-4-sale":eo,"stuff-4-sale":eo,enscaled:[0,{phx:eo}],mircloud:eo,freeddns:eo,golffan:eo,noip:eo,pointto:eo,platterp:eo}],uy:[1,{com:no,edu:Xr,gub:Xr,mil:Xr,net:Xr,org:Xr}],uz:[1,{co:Xr,com:Xr,net:Xr,org:Xr}],va:Xr,vc:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,mil:Xr,edu:Xr,gv:[2,{d:eo}],"0e":eo}],ve:[1,{arts:Xr,bib:Xr,co:Xr,com:Xr,e12:Xr,edu:Xr,firm:Xr,gob:Xr,gov:Xr,info:Xr,int:Xr,mil:Xr,net:Xr,nom:Xr,org:Xr,rar:Xr,rec:Xr,store:Xr,tec:Xr,web:Xr}],vg:[1,{at:eo}],vi:[1,{co:Xr,com:Xr,k12:Xr,net:Xr,org:Xr}],vn:[1,{ac:Xr,ai:Xr,biz:Xr,com:Xr,edu:Xr,gov:Xr,health:Xr,id:Xr,info:Xr,int:Xr,io:Xr,name:Xr,net:Xr,org:Xr,pro:Xr,angiang:Xr,bacgiang:Xr,backan:Xr,baclieu:Xr,bacninh:Xr,"baria-vungtau":Xr,bentre:Xr,binhdinh:Xr,binhduong:Xr,binhphuoc:Xr,binhthuan:Xr,camau:Xr,cantho:Xr,caobang:Xr,daklak:Xr,daknong:Xr,danang:Xr,dienbien:Xr,dongnai:Xr,dongthap:Xr,gialai:Xr,hagiang:Xr,haiduong:Xr,haiphong:Xr,hanam:Xr,hanoi:Xr,hatinh:Xr,haugiang:Xr,hoabinh:Xr,hungyen:Xr,khanhhoa:Xr,kiengiang:Xr,kontum:Xr,laichau:Xr,lamdong:Xr,langson:Xr,laocai:Xr,longan:Xr,namdinh:Xr,nghean:Xr,ninhbinh:Xr,ninhthuan:Xr,phutho:Xr,phuyen:Xr,quangbinh:Xr,quangnam:Xr,quangngai:Xr,quangninh:Xr,quangtri:Xr,soctrang:Xr,sonla:Xr,tayninh:Xr,thaibinh:Xr,thainguyen:Xr,thanhhoa:Xr,thanhphohochiminh:Xr,thuathienhue:Xr,tiengiang:Xr,travinh:Xr,tuyenquang:Xr,vinhlong:Xr,vinhphuc:Xr,yenbai:Xr,blogspot:eo}],vu:[1,{com:Xr,edu:Xr,net:Xr,org:Xr,cn:eo,blog:eo,dev:eo,me:eo}],wf:[1,{biz:eo,sch:eo}],ws:[1,{com:Xr,net:Xr,org:Xr,gov:Xr,edu:Xr,advisor:ro,cloud66:eo,dyndns:eo,mypets:eo}],yt:[1,{org:eo}],"xn--mgbaam7a8h":Xr,امارات:Xr,"xn--y9a3aq":Xr,հայ:Xr,"xn--54b7fta0cc":Xr,বাংলা:Xr,"xn--90ae":Xr,бг:Xr,"xn--mgbcpq6gpa1a":Xr,البحرين:Xr,"xn--90ais":Xr,бел:Xr,"xn--fiqs8s":Xr,中国:Xr,"xn--fiqz9s":Xr,中國:Xr,"xn--lgbbat1ad8j":Xr,الجزائر:Xr,"xn--wgbh1c":Xr,مصر:Xr,"xn--e1a4c":Xr,ею:Xr,"xn--qxa6a":Xr,ευ:Xr,"xn--mgbah1a3hjkrd":Xr,موريتانيا:Xr,"xn--node":Xr,გე:Xr,"xn--qxam":Xr,ελ:Xr,"xn--j6w193g":[1,{"xn--55qx5d":Xr,"xn--wcvs22d":Xr,"xn--mxtq1m":Xr,"xn--gmqw5a":Xr,"xn--od0alg":Xr,"xn--uc0atv":Xr}],香港:[1,{公司:Xr,教育:Xr,政府:Xr,個人:Xr,網絡:Xr,組織:Xr}],"xn--2scrj9c":Xr,ಭಾರತ:Xr,"xn--3hcrj9c":Xr,ଭାରତ:Xr,"xn--45br5cyl":Xr,ভাৰত:Xr,"xn--h2breg3eve":Xr,भारतम्:Xr,"xn--h2brj9c8c":Xr,भारोत:Xr,"xn--mgbgu82a":Xr,ڀارت:Xr,"xn--rvc1e0am3e":Xr,ഭാരതം:Xr,"xn--h2brj9c":Xr,भारत:Xr,"xn--mgbbh1a":Xr,بارت:Xr,"xn--mgbbh1a71e":Xr,بھارت:Xr,"xn--fpcrj9c3d":Xr,భారత్:Xr,"xn--gecrj9c":Xr,ભારત:Xr,"xn--s9brj9c":Xr,ਭਾਰਤ:Xr,"xn--45brj9c":Xr,ভারত:Xr,"xn--xkc2dl3a5ee0h":Xr,இந்தியா:Xr,"xn--mgba3a4f16a":Xr,ایران:Xr,"xn--mgba3a4fra":Xr,ايران:Xr,"xn--mgbtx2b":Xr,عراق:Xr,"xn--mgbayh7gpa":Xr,الاردن:Xr,"xn--3e0b707e":Xr,한국:Xr,"xn--80ao21a":Xr,қаз:Xr,"xn--q7ce6a":Xr,ລາວ:Xr,"xn--fzc2c9e2c":Xr,ලංකා:Xr,"xn--xkc2al3hye2a":Xr,இலங்கை:Xr,"xn--mgbc0a9azcg":Xr,المغرب:Xr,"xn--d1alf":Xr,мкд:Xr,"xn--l1acc":Xr,мон:Xr,"xn--mix891f":Xr,澳門:Xr,"xn--mix082f":Xr,澳门:Xr,"xn--mgbx4cd0ab":Xr,مليسيا:Xr,"xn--mgb9awbf":Xr,عمان:Xr,"xn--mgbai9azgqp6j":Xr,پاکستان:Xr,"xn--mgbai9a5eva00b":Xr,پاكستان:Xr,"xn--ygbi2ammx":Xr,فلسطين:Xr,"xn--90a3ac":[1,{"xn--o1ac":Xr,"xn--c1avg":Xr,"xn--90azh":Xr,"xn--d1at":Xr,"xn--o1ach":Xr,"xn--80au":Xr}],срб:[1,{пр:Xr,орг:Xr,обр:Xr,од:Xr,упр:Xr,ак:Xr}],"xn--p1ai":Xr,рф:Xr,"xn--wgbl6a":Xr,قطر:Xr,"xn--mgberp4a5d4ar":Xr,السعودية:Xr,"xn--mgberp4a5d4a87g":Xr,السعودیة:Xr,"xn--mgbqly7c0a67fbc":Xr,السعودیۃ:Xr,"xn--mgbqly7cvafr":Xr,السعوديه:Xr,"xn--mgbpl2fh":Xr,سودان:Xr,"xn--yfro4i67o":Xr,新加坡:Xr,"xn--clchc0ea0b2g2a9gcd":Xr,சிங்கப்பூர்:Xr,"xn--ogbpf8fl":Xr,سورية:Xr,"xn--mgbtf8fl":Xr,سوريا:Xr,"xn--o3cw4h":[1,{"xn--12c1fe0br":Xr,"xn--12co0c3b4eva":Xr,"xn--h3cuzk1di":Xr,"xn--o3cyx2a":Xr,"xn--m3ch0j3a":Xr,"xn--12cfi8ixb8l":Xr}],ไทย:[1,{ศึกษา:Xr,ธุรกิจ:Xr,รัฐบาล:Xr,ทหาร:Xr,เน็ต:Xr,องค์กร:Xr}],"xn--pgbs0dh":Xr,تونس:Xr,"xn--kpry57d":Xr,台灣:Xr,"xn--kprw13d":Xr,台湾:Xr,"xn--nnx388a":Xr,臺灣:Xr,"xn--j1amh":Xr,укр:Xr,"xn--mgb2ddes":Xr,اليمن:Xr,xxx:Xr,ye:So,za:[0,{ac:Xr,agric:Xr,alt:Xr,co:no,edu:Xr,gov:Xr,grondar:Xr,law:Xr,mil:Xr,net:Xr,ngo:Xr,nic:Xr,nis:Xr,nom:Xr,org:Xr,school:Xr,tm:Xr,web:Xr}],zm:[1,{ac:Xr,biz:Xr,co:Xr,com:Xr,edu:Xr,gov:Xr,info:Xr,mil:Xr,net:Xr,org:Xr,sch:Xr}],zw:[1,{ac:Xr,co:Xr,gov:Xr,mil:Xr,org:Xr}],aaa:Xr,aarp:Xr,abb:Xr,abbott:Xr,abbvie:Xr,abc:Xr,able:Xr,abogado:Xr,abudhabi:Xr,academy:[1,{official:eo}],accenture:Xr,accountant:Xr,accountants:Xr,aco:Xr,actor:Xr,ads:Xr,adult:Xr,aeg:Xr,aetna:Xr,afl:Xr,africa:Xr,agakhan:Xr,agency:Xr,aig:Xr,airbus:Xr,airforce:Xr,airtel:Xr,akdn:Xr,alibaba:Xr,alipay:Xr,allfinanz:Xr,allstate:Xr,ally:Xr,alsace:Xr,alstom:Xr,amazon:Xr,americanexpress:Xr,americanfamily:Xr,amex:Xr,amfam:Xr,amica:Xr,amsterdam:Xr,analytics:Xr,android:Xr,anquan:Xr,anz:Xr,aol:Xr,apartments:Xr,app:[1,{beget:ro,clerk:eo,clerkstage:eo,wnext:eo,platform0:eo,deta:eo,ondigitalocean:eo,easypanel:eo,encr:eo,edgecompute:eo,fireweb:eo,onflashdrive:eo,framer:eo,run:[2,{a:eo}],web:eo,hasura:eo,loginline:eo,messerli:eo,netlify:eo,ngrok:eo,"ngrok-free":eo,developer:ro,noop:eo,northflank:ro,snowflake:[2,{privatelink:eo}],streamlit:eo,storipress:eo,telebit:eo,typedream:eo,vercel:eo,bookonline:eo}],apple:Xr,aquarelle:Xr,arab:Xr,aramco:Xr,archi:Xr,army:Xr,art:Xr,arte:Xr,asda:Xr,associates:Xr,athleta:Xr,attorney:Xr,auction:Xr,audi:Xr,audible:Xr,audio:Xr,auspost:Xr,author:Xr,auto:Xr,autos:Xr,avianca:Xr,aws:Xr,axa:Xr,azure:Xr,baby:Xr,baidu:Xr,banamex:Xr,bananarepublic:Xr,band:Xr,bank:Xr,bar:Xr,barcelona:Xr,barclaycard:Xr,barclays:Xr,barefoot:Xr,bargains:Xr,baseball:Xr,basketball:[1,{aus:eo,nz:eo}],bauhaus:Xr,bayern:Xr,bbc:Xr,bbt:Xr,bbva:Xr,bcg:Xr,bcn:Xr,beats:Xr,beauty:Xr,beer:Xr,bentley:Xr,berlin:Xr,best:Xr,bestbuy:Xr,bet:Xr,bharti:Xr,bible:Xr,bid:Xr,bike:Xr,bing:Xr,bingo:Xr,bio:Xr,black:Xr,blackfriday:Xr,blockbuster:Xr,blog:Xr,bloomberg:Xr,blue:Xr,bms:Xr,bmw:Xr,bnpparibas:Xr,boats:Xr,boehringer:Xr,bofa:Xr,bom:Xr,bond:Xr,boo:Xr,book:Xr,booking:Xr,bosch:Xr,bostik:Xr,boston:Xr,bot:Xr,boutique:Xr,box:Xr,bradesco:Xr,bridgestone:Xr,broadway:Xr,broker:Xr,brother:Xr,brussels:Xr,build:Xr,builders:[1,{cloudsite:eo}],business:so,buy:Xr,buzz:Xr,bzh:Xr,cab:Xr,cafe:Xr,cal:Xr,call:Xr,calvinklein:Xr,cam:Xr,camera:Xr,camp:Xr,canon:Xr,capetown:Xr,capital:Xr,capitalone:Xr,car:Xr,caravan:Xr,cards:Xr,care:Xr,career:Xr,careers:Xr,cars:Xr,casa:[1,{nabu:[0,{ui:eo}]}],case:Xr,cash:Xr,casino:Xr,catering:Xr,catholic:Xr,cba:Xr,cbn:Xr,cbre:Xr,cbs:Xr,center:Xr,ceo:Xr,cern:Xr,cfa:Xr,cfd:Xr,chanel:Xr,channel:Xr,charity:Xr,chase:Xr,chat:Xr,cheap:Xr,chintai:Xr,christmas:Xr,chrome:Xr,church:Xr,cipriani:Xr,circle:Xr,cisco:Xr,citadel:Xr,citi:Xr,citic:Xr,city:Xr,cityeats:Xr,claims:Xr,cleaning:Xr,click:Xr,clinic:Xr,clinique:Xr,clothing:Xr,cloud:[1,{banzai:ro,elementor:eo,encoway:[0,{eu:eo}],statics:ro,ravendb:eo,axarnet:[0,{"es-1":eo}],diadem:eo,jelastic:[0,{vip:eo}],jele:eo,"jenv-aruba":[0,{aruba:[0,{eur:[0,{it1:eo}]}],it1:eo}],keliweb:[2,{cs:eo}],oxa:[2,{tn:eo,uk:eo}],primetel:[2,{uk:eo}],reclaim:[0,{ca:eo,uk:eo,us:eo}],trendhosting:[0,{ch:eo,de:eo}],jotelulu:eo,kuleuven:eo,linkyard:eo,magentosite:ro,perspecta:eo,vapor:eo,"on-rancher":ro,scw:[0,{baremetal:[0,{"fr-par-1":eo,"fr-par-2":eo,"nl-ams-1":eo}],"fr-par":[0,{fnc:[2,{functions:eo}],k8s:co,s3:eo,"s3-website":eo,whm:eo}],instances:[0,{priv:eo,pub:eo}],k8s:eo,"nl-ams":[0,{k8s:co,s3:eo,"s3-website":eo,whm:eo}],"pl-waw":[0,{k8s:co,s3:eo,"s3-website":eo}],scalebook:eo,smartlabeling:eo}],sensiosite:ro,trafficplex:eo,urown:eo,voorloper:eo}],club:[1,{cloudns:eo,jele:eo,barsy:eo}],clubmed:Xr,coach:Xr,codes:[1,{owo:ro}],coffee:Xr,college:Xr,cologne:Xr,comcast:Xr,commbank:Xr,community:[1,{nog:eo,ravendb:eo,myforum:eo}],company:Xr,compare:Xr,computer:Xr,comsec:Xr,condos:Xr,construction:Xr,consulting:Xr,contact:Xr,contractors:Xr,cooking:Xr,cool:[1,{elementor:eo,de:eo}],corsica:Xr,country:Xr,coupon:Xr,coupons:Xr,courses:Xr,cpa:Xr,credit:Xr,creditcard:Xr,creditunion:Xr,cricket:Xr,crown:Xr,crs:Xr,cruise:Xr,cruises:Xr,cuisinella:Xr,cymru:Xr,cyou:Xr,dabur:Xr,dad:Xr,dance:Xr,data:Xr,date:Xr,dating:Xr,datsun:Xr,day:Xr,dclk:Xr,dds:Xr,deal:Xr,dealer:Xr,deals:Xr,degree:Xr,delivery:Xr,dell:Xr,deloitte:Xr,delta:Xr,democrat:Xr,dental:Xr,dentist:Xr,desi:Xr,design:[1,{bss:eo}],dev:[1,{autocode:eo,lcl:ro,lclstage:ro,stg:ro,stgstage:ro,pages:eo,r2:eo,workers:eo,curv:eo,deno:eo,"deno-staging":eo,deta:eo,fly:eo,githubpreview:eo,gateway:ro,iserv:eo,localcert:[0,{user:ro}],loginline:eo,mediatech:eo,ngrok:eo,"ngrok-free":eo,"platter-app":eo,shiftcrypto:eo,vercel:eo,webhare:ro}],dhl:Xr,diamonds:Xr,diet:Xr,digital:[1,{cloudapps:[2,{london:eo}]}],direct:Xr,directory:Xr,discount:Xr,discover:Xr,dish:Xr,diy:Xr,dnp:Xr,docs:Xr,doctor:Xr,dog:Xr,domains:Xr,dot:Xr,download:Xr,drive:Xr,dtv:Xr,dubai:Xr,dunlop:Xr,dupont:Xr,durban:Xr,dvag:Xr,dvr:Xr,earth:[1,{dapps:[0,{"*":eo,bzz:ro}]}],eat:Xr,eco:Xr,edeka:Xr,education:so,email:Xr,emerck:Xr,energy:Xr,engineer:Xr,engineering:Xr,enterprises:Xr,epson:Xr,equipment:Xr,ericsson:Xr,erni:Xr,esq:Xr,estate:[1,{compute:ro}],etisalat:Xr,eurovision:Xr,eus:[1,{party:fo}],events:[1,{koobin:eo,co:eo}],exchange:Xr,expert:Xr,exposed:Xr,express:Xr,extraspace:Xr,fage:Xr,fail:Xr,fairwinds:Xr,faith:yo,family:Xr,fan:Xr,fans:Xr,farm:[1,{storj:eo}],farmers:Xr,fashion:Xr,fast:Xr,fedex:Xr,feedback:Xr,ferrari:Xr,ferrero:Xr,fidelity:Xr,fido:Xr,film:Xr,final:Xr,finance:Xr,financial:so,fire:Xr,firestone:Xr,firmdale:Xr,fish:Xr,fishing:Xr,fit:Xr,fitness:Xr,flickr:Xr,flights:Xr,flir:Xr,florist:Xr,flowers:Xr,fly:Xr,foo:Xr,food:Xr,football:Xr,ford:Xr,forex:Xr,forsale:Xr,forum:Xr,foundation:Xr,fox:Xr,free:Xr,fresenius:Xr,frl:Xr,frogans:Xr,frontdoor:Xr,frontier:Xr,ftr:Xr,fujitsu:Xr,fun:Xr,fund:Xr,furniture:Xr,futbol:Xr,fyi:Xr,gal:Xr,gallery:Xr,gallo:Xr,gallup:Xr,game:Xr,games:Xr,gap:Xr,garden:Xr,gay:Xr,gbiz:Xr,gdn:[1,{cnpy:eo}],gea:Xr,gent:Xr,genting:Xr,george:Xr,ggee:Xr,gift:Xr,gifts:Xr,gives:Xr,giving:Xr,glass:Xr,gle:Xr,global:Xr,globo:Xr,gmail:Xr,gmbh:Xr,gmo:Xr,gmx:Xr,godaddy:Xr,gold:Xr,goldpoint:Xr,golf:Xr,goo:Xr,goodyear:Xr,goog:[1,{cloud:eo,translate:eo,usercontent:ro}],google:Xr,gop:Xr,got:Xr,grainger:Xr,graphics:Xr,gratis:Xr,green:Xr,gripe:Xr,grocery:Xr,group:[1,{discourse:eo}],guardian:Xr,gucci:Xr,guge:Xr,guide:Xr,guitars:Xr,guru:Xr,hair:Xr,hamburg:Xr,hangout:Xr,haus:Xr,hbo:Xr,hdfc:Xr,hdfcbank:Xr,health:[1,{hra:eo}],healthcare:Xr,help:Xr,helsinki:Xr,here:Xr,hermes:Xr,hiphop:Xr,hisamitsu:Xr,hitachi:Xr,hiv:Xr,hkt:Xr,hockey:Xr,holdings:Xr,holiday:Xr,homedepot:Xr,homegoods:Xr,homes:Xr,homesense:Xr,honda:Xr,horse:Xr,hospital:Xr,host:[1,{cloudaccess:eo,freesite:eo,easypanel:eo,fastvps:eo,myfast:eo,tempurl:eo,wpmudev:eo,jele:eo,mircloud:eo,pcloud:eo,half:eo}],hosting:[1,{opencraft:eo}],hot:Xr,hotels:Xr,hotmail:Xr,house:Xr,how:Xr,hsbc:Xr,hughes:Xr,hyatt:Xr,hyundai:Xr,ibm:Xr,icbc:Xr,ice:Xr,icu:Xr,ieee:Xr,ifm:Xr,ikano:Xr,imamat:Xr,imdb:Xr,immo:Xr,immobilien:Xr,inc:Xr,industries:Xr,infiniti:Xr,ing:Xr,ink:Xr,institute:Xr,insurance:Xr,insure:Xr,international:Xr,intuit:Xr,investments:Xr,ipiranga:Xr,irish:Xr,ismaili:Xr,ist:Xr,istanbul:Xr,itau:Xr,itv:Xr,jaguar:Xr,java:Xr,jcb:Xr,jeep:Xr,jetzt:Xr,jewelry:Xr,jio:Xr,jll:Xr,jmp:Xr,jnj:Xr,joburg:Xr,jot:Xr,joy:Xr,jpmorgan:Xr,jprs:Xr,juegos:Xr,juniper:Xr,kaufen:Xr,kddi:Xr,kerryhotels:Xr,kerrylogistics:Xr,kerryproperties:Xr,kfh:Xr,kia:Xr,kids:Xr,kim:Xr,kinder:Xr,kindle:Xr,kitchen:Xr,kiwi:Xr,koeln:Xr,komatsu:Xr,kosher:Xr,kpmg:Xr,kpn:Xr,krd:[1,{co:eo,edu:eo}],kred:Xr,kuokgroup:Xr,kyoto:Xr,lacaixa:Xr,lamborghini:Xr,lamer:Xr,lancaster:Xr,land:[1,{static:[2,{dev:eo,sites:eo}]}],landrover:Xr,lanxess:Xr,lasalle:Xr,lat:Xr,latino:Xr,latrobe:Xr,law:Xr,lawyer:Xr,lds:Xr,lease:Xr,leclerc:Xr,lefrak:Xr,legal:Xr,lego:Xr,lexus:Xr,lgbt:Xr,lidl:Xr,life:Xr,lifeinsurance:Xr,lifestyle:Xr,lighting:Xr,like:Xr,lilly:Xr,limited:Xr,limo:Xr,lincoln:Xr,link:[1,{cyon:eo,mypep:eo,dweb:ro}],lipsy:Xr,live:[1,{hlx:eo}],living:Xr,llc:Xr,llp:Xr,loan:Xr,loans:Xr,locker:Xr,locus:Xr,lol:[1,{omg:eo}],london:Xr,lotte:Xr,lotto:Xr,love:Xr,lpl:Xr,lplfinancial:Xr,ltd:Xr,ltda:Xr,lundbeck:Xr,luxe:Xr,luxury:Xr,madrid:Xr,maif:Xr,maison:Xr,makeup:Xr,man:Xr,management:[1,{router:eo}],mango:Xr,map:Xr,market:Xr,marketing:Xr,markets:Xr,marriott:Xr,marshalls:Xr,mattel:Xr,mba:Xr,mckinsey:Xr,med:Xr,media:ko,meet:Xr,melbourne:Xr,meme:Xr,memorial:Xr,men:Xr,menu:mo,merckmsd:Xr,miami:Xr,microsoft:Xr,mini:Xr,mint:Xr,mit:Xr,mitsubishi:Xr,mlb:Xr,mls:Xr,mma:Xr,mobile:Xr,moda:Xr,moe:Xr,moi:Xr,mom:Xr,monash:Xr,money:Xr,monster:Xr,mormon:Xr,mortgage:Xr,moscow:Xr,moto:Xr,motorcycles:Xr,mov:Xr,movie:Xr,msd:Xr,mtn:Xr,mtr:Xr,music:Xr,nab:Xr,nagoya:Xr,natura:Xr,navy:Xr,nba:Xr,nec:Xr,netbank:Xr,netflix:Xr,network:[1,{alces:ro,co:eo,arvo:eo,azimuth:eo,tlon:eo}],neustar:Xr,new:Xr,news:[1,{noticeable:eo}],next:Xr,nextdirect:Xr,nexus:Xr,nfl:Xr,ngo:Xr,nhk:Xr,nico:Xr,nike:Xr,nikon:Xr,ninja:Xr,nissan:Xr,nissay:Xr,nokia:Xr,norton:Xr,now:Xr,nowruz:Xr,nowtv:Xr,nra:Xr,nrw:Xr,ntt:Xr,nyc:Xr,obi:Xr,observer:Xr,office:Xr,okinawa:Xr,olayan:Xr,olayangroup:Xr,oldnavy:Xr,ollo:Xr,omega:Xr,one:[1,{onred:[2,{staging:eo}],service:eo,homelink:eo}],ong:Xr,onl:Xr,online:[1,{eero:eo,"eero-stage":eo,barsy:eo}],ooo:Xr,open:Xr,oracle:Xr,orange:[1,{tech:eo}],organic:Xr,origins:Xr,osaka:Xr,otsuka:Xr,ott:Xr,ovh:[1,{nerdpol:eo}],page:[1,{hlx:eo,hlx3:eo,translated:eo,codeberg:eo,pdns:eo,plesk:eo,prvcy:eo,rocky:eo,magnet:eo}],panasonic:Xr,paris:Xr,pars:Xr,partners:Xr,parts:Xr,party:yo,pay:Xr,pccw:Xr,pet:Xr,pfizer:Xr,pharmacy:Xr,phd:Xr,philips:Xr,phone:Xr,photo:Xr,photography:Xr,photos:ko,physio:Xr,pics:Xr,pictet:Xr,pictures:[1,{1337:eo}],pid:Xr,pin:Xr,ping:Xr,pink:Xr,pioneer:Xr,pizza:[1,{ngrok:eo}],place:so,play:Xr,playstation:Xr,plumbing:Xr,plus:Xr,pnc:Xr,pohl:Xr,poker:Xr,politie:Xr,porn:[1,{indie:eo}],pramerica:Xr,praxi:Xr,press:Xr,prime:Xr,prod:Xr,productions:Xr,prof:Xr,progressive:Xr,promo:Xr,properties:Xr,property:Xr,protection:Xr,pru:Xr,prudential:Xr,pub:mo,pwc:Xr,qpon:Xr,quebec:Xr,quest:Xr,racing:Xr,radio:Xr,read:Xr,realestate:Xr,realtor:Xr,realty:Xr,recipes:Xr,red:Xr,redstone:Xr,redumbrella:Xr,rehab:Xr,reise:Xr,reisen:Xr,reit:Xr,reliance:Xr,ren:Xr,rent:Xr,rentals:Xr,repair:Xr,report:Xr,republican:Xr,rest:Xr,restaurant:Xr,review:yo,reviews:Xr,rexroth:Xr,rich:Xr,richardli:Xr,ricoh:Xr,ril:Xr,rio:Xr,rip:[1,{clan:eo}],rocher:Xr,rocks:[1,{myddns:eo,"lima-city":eo,webspace:eo}],rodeo:Xr,rogers:Xr,room:Xr,rsvp:Xr,rugby:Xr,ruhr:Xr,run:[1,{hs:eo,development:eo,ravendb:eo,servers:eo,build:ro,code:ro,database:ro,migration:ro,onporter:eo,repl:eo,wix:eo}],rwe:Xr,ryukyu:Xr,saarland:Xr,safe:Xr,safety:Xr,sakura:Xr,sale:Xr,salon:Xr,samsclub:Xr,samsung:Xr,sandvik:Xr,sandvikcoromant:Xr,sanofi:Xr,sap:Xr,sarl:Xr,sas:Xr,save:Xr,saxo:Xr,sbi:Xr,sbs:Xr,sca:Xr,scb:Xr,schaeffler:Xr,schmidt:Xr,scholarships:Xr,school:Xr,schule:Xr,schwarz:Xr,science:yo,scot:[1,{edu:eo,gov:[2,{service:eo}]}],search:Xr,seat:Xr,secure:Xr,security:Xr,seek:Xr,select:Xr,sener:Xr,services:[1,{loginline:eo}],seven:Xr,sew:Xr,sex:Xr,sexy:Xr,sfr:Xr,shangrila:Xr,sharp:Xr,shaw:Xr,shell:Xr,shia:Xr,shiksha:Xr,shoes:Xr,shop:[1,{base:eo,hoplix:eo,barsy:eo}],shopping:Xr,shouji:Xr,show:Xr,showtime:Xr,silk:Xr,sina:Xr,singles:Xr,site:[1,{cloudera:ro,cyon:eo,fnwk:eo,folionetwork:eo,fastvps:eo,jele:eo,lelux:eo,loginline:eo,barsy:eo,mintere:eo,omniwe:eo,opensocial:eo,platformsh:ro,tst:ro,byen:eo,srht:eo,novecore:eo}],ski:Xr,skin:Xr,sky:Xr,skype:Xr,sling:Xr,smart:Xr,smile:Xr,sncf:Xr,soccer:Xr,social:Xr,softbank:Xr,software:Xr,sohu:Xr,solar:Xr,solutions:[1,{diher:ro}],song:Xr,sony:Xr,soy:Xr,spa:Xr,space:[1,{myfast:eo,uber:eo,xs4all:eo}],sport:Xr,spot:Xr,srl:Xr,stada:Xr,staples:Xr,star:Xr,statebank:Xr,statefarm:Xr,stc:Xr,stcgroup:Xr,stockholm:Xr,storage:Xr,store:[1,{sellfy:eo,shopware:eo,storebase:eo}],stream:Xr,studio:Xr,study:Xr,style:Xr,sucks:Xr,supplies:Xr,supply:Xr,support:mo,surf:Xr,surgery:Xr,suzuki:Xr,swatch:Xr,swiss:Xr,sydney:Xr,systems:[1,{knightpoint:eo}],tab:Xr,taipei:Xr,talk:Xr,taobao:Xr,target:Xr,tatamotors:Xr,tatar:Xr,tattoo:Xr,tax:Xr,taxi:Xr,tci:Xr,tdk:Xr,team:[1,{discourse:eo,jelastic:eo}],tech:Xr,technology:so,temasek:Xr,tennis:Xr,teva:Xr,thd:Xr,theater:Xr,theatre:Xr,tiaa:Xr,tickets:Xr,tienda:Xr,tips:Xr,tires:Xr,tirol:Xr,tjmaxx:Xr,tjx:Xr,tkmaxx:Xr,tmall:Xr,today:[1,{prequalifyme:eo}],tokyo:Xr,tools:Xr,top:[1,{"now-dns":eo,ntdll:eo}],toray:Xr,toshiba:Xr,total:Xr,tours:Xr,town:Xr,toyota:Xr,toys:Xr,trade:yo,trading:Xr,training:Xr,travel:Xr,travelers:Xr,travelersinsurance:Xr,trust:Xr,trv:Xr,tube:Xr,tui:Xr,tunes:Xr,tushu:Xr,tvs:Xr,ubank:Xr,ubs:Xr,unicom:Xr,university:Xr,uno:Xr,uol:Xr,ups:Xr,vacations:Xr,vana:Xr,vanguard:Xr,vegas:Xr,ventures:Xr,verisign:Xr,versicherung:Xr,vet:Xr,viajes:Xr,video:Xr,vig:Xr,viking:Xr,villas:Xr,vin:Xr,vip:Xr,virgin:Xr,visa:Xr,vision:Xr,viva:Xr,vivo:Xr,vlaanderen:Xr,vodka:Xr,volkswagen:Xr,volvo:Xr,vote:Xr,voting:Xr,voto:Xr,voyage:Xr,wales:Xr,walmart:Xr,walter:Xr,wang:Xr,wanggou:Xr,watch:Xr,watches:Xr,weather:Xr,weatherchannel:Xr,webcam:Xr,weber:Xr,website:ko,wedding:Xr,weibo:Xr,weir:Xr,whoswho:Xr,wien:Xr,wiki:ko,williamhill:Xr,win:Xr,windows:Xr,wine:Xr,winners:Xr,wme:Xr,wolterskluwer:Xr,woodside:Xr,work:Xr,works:Xr,world:Xr,wow:Xr,wtc:Xr,wtf:Xr,xbox:Xr,xerox:Xr,xfinity:Xr,xihuan:Xr,xin:Xr,"xn--11b4c3d":Xr,कॉम:Xr,"xn--1ck2e1b":Xr,セール:Xr,"xn--1qqw23a":Xr,佛山:Xr,"xn--30rr7y":Xr,慈善:Xr,"xn--3bst00m":Xr,集团:Xr,"xn--3ds443g":Xr,在线:Xr,"xn--3pxu8k":Xr,点看:Xr,"xn--42c2d9a":Xr,คอม:Xr,"xn--45q11c":Xr,八卦:Xr,"xn--4gbrim":Xr,موقع:Xr,"xn--55qw42g":Xr,公益:Xr,"xn--55qx5d":Xr,公司:Xr,"xn--5su34j936bgsg":Xr,香格里拉:Xr,"xn--5tzm5g":Xr,网站:Xr,"xn--6frz82g":Xr,移动:Xr,"xn--6qq986b3xl":Xr,我爱你:Xr,"xn--80adxhks":Xr,москва:Xr,"xn--80aqecdr1a":Xr,католик:Xr,"xn--80asehdb":Xr,онлайн:Xr,"xn--80aswg":Xr,сайт:Xr,"xn--8y0a063a":Xr,联通:Xr,"xn--9dbq2a":Xr,קום:Xr,"xn--9et52u":Xr,时尚:Xr,"xn--9krt00a":Xr,微博:Xr,"xn--b4w605ferd":Xr,淡马锡:Xr,"xn--bck1b9a5dre4c":Xr,ファッション:Xr,"xn--c1avg":Xr,орг:Xr,"xn--c2br7g":Xr,नेट:Xr,"xn--cck2b3b":Xr,ストア:Xr,"xn--cckwcxetd":Xr,アマゾン:Xr,"xn--cg4bki":Xr,삼성:Xr,"xn--czr694b":Xr,商标:Xr,"xn--czrs0t":Xr,商店:Xr,"xn--czru2d":Xr,商城:Xr,"xn--d1acj3b":Xr,дети:Xr,"xn--eckvdtc9d":Xr,ポイント:Xr,"xn--efvy88h":Xr,新闻:Xr,"xn--fct429k":Xr,家電:Xr,"xn--fhbei":Xr,كوم:Xr,"xn--fiq228c5hs":Xr,中文网:Xr,"xn--fiq64b":Xr,中信:Xr,"xn--fjq720a":Xr,娱乐:Xr,"xn--flw351e":Xr,谷歌:Xr,"xn--fzys8d69uvgm":Xr,電訊盈科:Xr,"xn--g2xx48c":Xr,购物:Xr,"xn--gckr3f0f":Xr,クラウド:Xr,"xn--gk3at1e":Xr,通販:Xr,"xn--hxt814e":Xr,网店:Xr,"xn--i1b6b1a6a2e":Xr,संगठन:Xr,"xn--imr513n":Xr,餐厅:Xr,"xn--io0a7i":Xr,网络:Xr,"xn--j1aef":Xr,ком:Xr,"xn--jlq480n2rg":Xr,亚马逊:Xr,"xn--jvr189m":Xr,食品:Xr,"xn--kcrx77d1x4a":Xr,飞利浦:Xr,"xn--kput3i":Xr,手机:Xr,"xn--mgba3a3ejt":Xr,ارامكو:Xr,"xn--mgba7c0bbn0a":Xr,العليان:Xr,"xn--mgbaakc7dvf":Xr,اتصالات:Xr,"xn--mgbab2bd":Xr,بازار:Xr,"xn--mgbca7dzdo":Xr,ابوظبي:Xr,"xn--mgbi4ecexp":Xr,كاثوليك:Xr,"xn--mgbt3dhd":Xr,همراه:Xr,"xn--mk1bu44c":Xr,닷컴:Xr,"xn--mxtq1m":Xr,政府:Xr,"xn--ngbc5azd":Xr,شبكة:Xr,"xn--ngbe9e0a":Xr,بيتك:Xr,"xn--ngbrx":Xr,عرب:Xr,"xn--nqv7f":Xr,机构:Xr,"xn--nqv7fs00ema":Xr,组织机构:Xr,"xn--nyqy26a":Xr,健康:Xr,"xn--otu796d":Xr,招聘:Xr,"xn--p1acf":[1,{"xn--90amc":eo,"xn--j1aef":eo,"xn--j1ael8b":eo,"xn--h1ahn":eo,"xn--j1adp":eo,"xn--c1avg":eo,"xn--80aaa0cvac":eo,"xn--h1aliz":eo,"xn--90a1af":eo,"xn--41a":eo}],рус:[1,{биз:eo,ком:eo,крым:eo,мир:eo,мск:eo,орг:eo,самара:eo,сочи:eo,спб:eo,я:eo}],"xn--pssy2u":Xr,大拿:Xr,"xn--q9jyb4c":Xr,みんな:Xr,"xn--qcka1pmc":Xr,グーグル:Xr,"xn--rhqv96g":Xr,世界:Xr,"xn--rovu88b":Xr,書籍:Xr,"xn--ses554g":Xr,网址:Xr,"xn--t60b56a":Xr,닷넷:Xr,"xn--tckwe":Xr,コム:Xr,"xn--tiq49xqyj":Xr,天主教:Xr,"xn--unup4y":Xr,游戏:Xr,"xn--vermgensberater-ctb":Xr,vermögensberater:Xr,"xn--vermgensberatung-pwb":Xr,vermögensberatung:Xr,"xn--vhquv":Xr,企业:Xr,"xn--vuq861b":Xr,信息:Xr,"xn--w4r85el8fhu5dnra":Xr,嘉里大酒店:Xr,"xn--w4rs40l":Xr,嘉里:Xr,"xn--xhq521b":Xr,广东:Xr,"xn--zfr164b":Xr,政务:Xr,xyz:[1,{blogsite:eo,localzone:eo,crafting:eo,zapto:eo,telebit:ro}],yachts:Xr,yahoo:Xr,yamaxun:Xr,yandex:Xr,yodobashi:Xr,yoga:Xr,yokohama:Xr,you:Xr,youtube:Xr,yun:Xr,zappos:Xr,zara:Xr,zero:Xr,zip:Xr,zone:[1,{cloud66:eo,hs:eo,triton:ro,lima:eo}],zuerich:Xr}]}();function lookupInTrie(Xr,eo,to,ro){let no=null,io=eo;for(;io!==void 0&&(io[0]&ro&&(no={index:to+1,isIcann:io[0]===1,isPrivate:io[0]===2}),to!==-1);){const oo=io[1];io=Object.prototype.hasOwnProperty.call(oo,Xr[to])?oo[Xr[to]]:oo["*"],to-=1}return no}function suffixLookup(Xr,eo,to){var ro;if(fastPathLookup(Xr,eo,to))return;const no=Xr.split("."),io=(eo.allowPrivateDomains?2:0)|(eo.allowIcannDomains?1:0),oo=lookupInTrie(no,exceptions,no.length-1,io);if(oo!==null){to.isIcann=oo.isIcann,to.isPrivate=oo.isPrivate,to.publicSuffix=no.slice(oo.index+1).join(".");return}const ao=lookupInTrie(no,rules,no.length-1,io);if(ao!==null){to.isIcann=ao.isIcann,to.isPrivate=ao.isPrivate,to.publicSuffix=no.slice(ao.index).join(".");return}to.isIcann=!1,to.isPrivate=!1,to.publicSuffix=(ro=no[no.length-1])!==null&&ro!==void 0?ro:null}function parse$2(Xr,eo={}){return parseImpl(Xr,5,suffixLookup,eo,getEmptyResult())}const createBrowserPlatformService=Xr=>({getDisplayOrigin:()=>Xr.location.origin,getHost:()=>Xr.location.host,getHostname:()=>Xr.location.hostname,getOrigin:()=>Xr.location.origin,getTLD:()=>parse$2(Xr.location.hostname,{allowPrivateDomains:!0}).domain||void 0,isNativeMobile:!1,openURL:eo=>__awaiter$m(void 0,void 0,void 0,function*(){Xr.location.assign(eo)})});var _a$3,_PlatformService_implementation;class PlatformService{static get implementation(){return __classPrivateFieldGet$5(_a$3,_a$3,"f",_PlatformService_implementation)?__classPrivateFieldGet$5(_a$3,_a$3,"f",_PlatformService_implementation):createBrowserPlatformService(window)}static set implementation(eo){__classPrivateFieldSet$5(_a$3,_a$3,eo,"f",_PlatformService_implementation)}static get isNativeMobile(){return _a$3.implementation.isNativeMobile}static get getOrigin(){return _a$3.implementation.getOrigin}static get getDisplayOrigin(){return _a$3.implementation.getDisplayOrigin}static get getHost(){return _a$3.implementation.getHost}static get getHostname(){return _a$3.implementation.getHostname}static get getTLD(){return _a$3.implementation.getTLD}static get openURL(){return _a$3.implementation.openURL}}_a$3=PlatformService;_PlatformService_implementation={value:void 0};const getTLD=()=>PlatformService.getTLD(),ceil=(Xr,eo=0)=>{const to=Math.pow(10,eo);return Math.ceil(Xr*to)/to},trimEnd=(Xr,eo="")=>{let to=Xr.length-1;for(;to>=0&&Xr[to]===eo;)to--;return Xr.slice(0,to+1)},formatNumberText=(Xr,{precision:eo=0}={})=>{if(!eo)return Xr;const to=parseFloat(Xr),ro=ceil(to,eo).toFixed(eo),[no,io]=ro.split("."),oo=trimEnd(io,"0");return`${no}.${oo||"0"}`},isLedgerAddressViaVerifiedCredentials=(Xr,eo)=>eo.filter(ro=>{var no;return((no=ro.walletProperties)===null||no===void 0?void 0:no.hardwareWallet)==="ledger"}).map(ro=>ro.address).includes(Xr),isEip9693Event=Xr=>Xr.type==="eip6963:announceProvider"&&Xr.detail!==void 0;class Eip6963Provider{constructor(){this.providers=[]}registerProviders(){typeof window>"u"||(window.addEventListener("eip6963:announceProvider",eo=>{isEip9693Event(eo)&&this.providers.push(eo.detail)}),window.dispatchEvent(new Event("eip6963:requestProvider")))}}class Eip6963ProviderSingleton{constructor(){this.eip6963Provider=new Eip6963Provider}static get(){var eo;return!((eo=Eip6963ProviderSingleton.instance)===null||eo===void 0)&&eo.eip6963Provider||(Eip6963ProviderSingleton.instance=new Eip6963ProviderSingleton,Eip6963ProviderSingleton.instance.eip6963Provider.registerProviders()),Eip6963ProviderSingleton.instance.eip6963Provider}}const runSafe=Xr=>__awaiter$m(void 0,void 0,void 0,function*(){try{return[yield Xr(),void 0]}catch(eo){return[void 0,eo]}});var _a$2,_FetchService_implementation;class FetchService{static get implementation(){return __classPrivateFieldGet$5(_a$2,_a$2,"f",_FetchService_implementation)?__classPrivateFieldGet$5(_a$2,_a$2,"f",_FetchService_implementation):{fetch:window.fetch.bind(window)}}static set implementation(eo){__classPrivateFieldSet$5(_a$2,_a$2,eo,"f",_FetchService_implementation)}static get fetch(){return _a$2.implementation.fetch}}_a$2=FetchService;_FetchService_implementation={value:void 0};var version$n="3.5.1";function __awaiter$l(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const BASE_PATH="https://app.dynamicauth.com/api/v0".replace(/\/+$/,""),isBlob=Xr=>typeof Blob<"u"&&Xr instanceof Blob;class BaseAPI{constructor(eo=new Configuration){this.configuration=eo,this.fetchApi=(to,ro)=>__awaiter$l(this,void 0,void 0,function*(){let no={url:to,init:ro};for(const oo of this.middleware)oo.pre&&(no=(yield oo.pre(Object.assign({fetch:this.fetchApi},no)))||no);let io=yield(this.configuration.fetchApi||fetch)(no.url,no.init);for(const oo of this.middleware)oo.post&&(io=(yield oo.post({fetch:this.fetchApi,url:no.url,init:no.init,response:io.clone()}))||io);return io}),this.middleware=eo.middleware}withMiddleware(...eo){const to=this.clone();return to.middleware=to.middleware.concat(...eo),to}withPreMiddleware(...eo){const to=eo.map(ro=>({pre:ro}));return this.withMiddleware(...to)}withPostMiddleware(...eo){const to=eo.map(ro=>({post:ro}));return this.withMiddleware(...to)}request(eo,to){return __awaiter$l(this,void 0,void 0,function*(){const{url:ro,init:no}=this.createFetchParams(eo,to),io=yield this.fetchApi(ro,no);if(io.status>=200&&io.status<300)return io;throw io})}createFetchParams(eo,to){let ro=this.configuration.basePath+eo.path;eo.query!==void 0&&Object.keys(eo.query).length!==0&&(ro+="?"+this.configuration.queryParamsStringify(eo.query));const no=typeof FormData<"u"&&eo.body instanceof FormData||eo.body instanceof URLSearchParams||isBlob(eo.body)?eo.body:JSON.stringify(eo.body),io=Object.assign({},this.configuration.headers,eo.headers),oo=Object.assign({method:eo.method,headers:io,body:no,credentials:this.configuration.credentials},to);return{url:ro,init:oo}}clone(){const eo=this.constructor,to=new eo(this.configuration);return to.middleware=this.middleware.slice(),to}}class RequiredError extends Error{constructor(eo,to){super(to),this.field=eo,this.name="RequiredError"}}class Configuration{constructor(eo={}){this.configuration=eo}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const eo=this.configuration.apiKey;if(eo)return typeof eo=="function"?eo:()=>eo}get accessToken(){const eo=this.configuration.accessToken;if(eo)return typeof eo=="function"?eo:()=>__awaiter$l(this,void 0,void 0,function*(){return eo})}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}function exists$1(Xr,eo){const to=Xr[eo];return to!=null}function querystring(Xr,eo=""){return Object.keys(Xr).map(to=>{const ro=eo+(eo.length?`[${to}]`:to),no=Xr[to];if(no instanceof Array){const io=no.map(oo=>encodeURIComponent(String(oo))).join(`&${encodeURIComponent(ro)}=`);return`${encodeURIComponent(ro)}=${io}`}return no instanceof Date?`${encodeURIComponent(ro)}=${encodeURIComponent(no.toISOString())}`:no instanceof Object?querystring(no,ro):`${encodeURIComponent(ro)}=${encodeURIComponent(String(no))}`}).filter(to=>to.length>0).join("&")}function canConsumeForm(Xr){for(const eo of Xr)if(eo.contentType==="multipart/form-data")return!0;return!1}class JSONApiResponse{constructor(eo,to=ro=>ro){this.raw=eo,this.transformer=to}value(){return __awaiter$l(this,void 0,void 0,function*(){return this.transformer(yield this.raw.json())})}}class VoidApiResponse{constructor(eo){this.raw=eo}value(){return __awaiter$l(this,void 0,void 0,function*(){})}}class TextApiResponse{constructor(eo){this.raw=eo}value(){return __awaiter$l(this,void 0,void 0,function*(){return yield this.raw.text()})}}var AttestationConveyancePreference;(function(Xr){Xr.Direct="direct",Xr.Enterprise="enterprise",Xr.Indirect="indirect",Xr.None="none"})(AttestationConveyancePreference||(AttestationConveyancePreference={}));function AttestationConveyancePreferenceFromJSON(Xr){return AttestationConveyancePreferenceFromJSONTyped(Xr)}function AttestationConveyancePreferenceFromJSONTyped(Xr,eo){return Xr}var AuthModeEnum;(function(Xr){Xr.Only="connect-only",Xr.AndSign="connect-and-sign"})(AuthModeEnum||(AuthModeEnum={}));function AuthModeEnumToJSON(Xr){return Xr}var AuthStorageEnum;(function(Xr){Xr.Localstorage="localstorage",Xr.Cookie="cookie"})(AuthStorageEnum||(AuthStorageEnum={}));function AuthStorageEnumFromJSON(Xr){return AuthStorageEnumFromJSONTyped(Xr)}function AuthStorageEnumFromJSONTyped(Xr,eo){return Xr}var AuthenticatorAttachment;(function(Xr){Xr.CrossPlatform="cross-platform",Xr.Platform="platform"})(AuthenticatorAttachment||(AuthenticatorAttachment={}));function AuthenticatorAttachmentFromJSON(Xr){return AuthenticatorAttachmentFromJSONTyped(Xr)}function AuthenticatorAttachmentFromJSONTyped(Xr,eo){return Xr}function AuthenticatorAttachmentToJSON(Xr){return Xr}var ResidentKeyRequirement;(function(Xr){Xr.Discouraged="discouraged",Xr.Preferred="preferred",Xr.Required="required"})(ResidentKeyRequirement||(ResidentKeyRequirement={}));function ResidentKeyRequirementFromJSON(Xr){return ResidentKeyRequirementFromJSONTyped(Xr)}function ResidentKeyRequirementFromJSONTyped(Xr,eo){return Xr}var UserVerificationRequirement;(function(Xr){Xr.Discouraged="discouraged",Xr.Preferred="preferred",Xr.Required="required"})(UserVerificationRequirement||(UserVerificationRequirement={}));function UserVerificationRequirementFromJSON(Xr){return UserVerificationRequirementFromJSONTyped(Xr)}function UserVerificationRequirementFromJSONTyped(Xr,eo){return Xr}var AuthenticatorTransportProtocol;(function(Xr){Xr.Internal="AUTHENTICATOR_TRANSPORT_INTERNAL",Xr.Usb="AUTHENTICATOR_TRANSPORT_USB",Xr.Nfc="AUTHENTICATOR_TRANSPORT_NFC",Xr.Ble="AUTHENTICATOR_TRANSPORT_BLE",Xr.Hybrid="AUTHENTICATOR_TRANSPORT_HYBRID"})(AuthenticatorTransportProtocol||(AuthenticatorTransportProtocol={}));function AuthenticatorTransportProtocolToJSON(Xr){return Xr}var JwtVerifiedCredentialFormatEnum;(function(Xr){Xr.Blockchain="blockchain",Xr.Email="email",Xr.Oauth="oauth",Xr.Passkey="passkey",Xr.PhoneNumber="phoneNumber",Xr.ExternalUser="externalUser"})(JwtVerifiedCredentialFormatEnum||(JwtVerifiedCredentialFormatEnum={}));function JwtVerifiedCredentialFormatEnumFromJSON(Xr){return JwtVerifiedCredentialFormatEnumFromJSONTyped(Xr)}function JwtVerifiedCredentialFormatEnumFromJSONTyped(Xr,eo){return Xr}var ProviderEnum;(function(Xr){Xr.EmailOnly="emailOnly",Xr.MagicLink="magicLink",Xr.Apple="apple",Xr.Bitbucket="bitbucket",Xr.Coinbasesocial="coinbasesocial",Xr.Discord="discord",Xr.Epicgames="epicgames",Xr.Facebook="facebook",Xr.Farcaster="farcaster",Xr.Github="github",Xr.Gitlab="gitlab",Xr.Google="google",Xr.Instagram="instagram",Xr.Linkedin="linkedin",Xr.Microsoft="microsoft",Xr.Twitch="twitch",Xr.Twitter="twitter",Xr.Blocto="blocto",Xr.Banxa="banxa",Xr.Dynamic="dynamic",Xr.Alchemy="alchemy",Xr.Zerodev="zerodev",Xr.Telegram="telegram",Xr.Turnkey="turnkey",Xr.CoinbaseWaas="coinbaseWaas",Xr.Sms="sms",Xr.Spotify="spotify",Xr.Tiktok="tiktok",Xr.Line="line",Xr.Steam="steam",Xr.Shopify="shopify"})(ProviderEnum||(ProviderEnum={}));function ProviderEnumFromJSON(Xr){return ProviderEnumFromJSONTyped(Xr)}function ProviderEnumFromJSONTyped(Xr,eo){return Xr}function ProviderEnumToJSON(Xr){return Xr}var WalletAddressType;(function(Xr){Xr.Ordinals="ordinals",Xr.Payment="payment",Xr.Cosmos="cosmos",Xr.Evm="evm"})(WalletAddressType||(WalletAddressType={}));function WalletAddressTypeFromJSON(Xr){return WalletAddressTypeFromJSONTyped(Xr)}function WalletAddressTypeFromJSONTyped(Xr,eo){return Xr}function WalletAddressTypeToJSON(Xr){return Xr}var EmbeddedWalletVersionEnum;(function(Xr){Xr.V1="V1",Xr.V2="V2"})(EmbeddedWalletVersionEnum||(EmbeddedWalletVersionEnum={}));function EmbeddedWalletVersionEnumFromJSON(Xr){return EmbeddedWalletVersionEnumFromJSONTyped(Xr)}function EmbeddedWalletVersionEnumFromJSONTyped(Xr,eo){return Xr}var HardwareWalletEnum;(function(Xr){Xr.Ledger="ledger"})(HardwareWalletEnum||(HardwareWalletEnum={}));function HardwareWalletEnumFromJSON(Xr){return HardwareWalletEnumFromJSONTyped(Xr)}function HardwareWalletEnumFromJSONTyped(Xr,eo){return Xr}var PasswordSourceTypeEnum;(function(Xr){Xr.Dynamic="dynamic",Xr.User="user"})(PasswordSourceTypeEnum||(PasswordSourceTypeEnum={}));function PasswordSourceTypeEnumFromJSON(Xr){return PasswordSourceTypeEnumFromJSONTyped(Xr)}function PasswordSourceTypeEnumFromJSONTyped(Xr,eo){return Xr}function PasswordSourceTypeEnumToJSON(Xr){return Xr}var WalletProviderEnum;(function(Xr){Xr.BrowserExtension="browserExtension",Xr.CustodialService="custodialService",Xr.WalletConnect="walletConnect",Xr.QrCode="qrCode",Xr.DeepLink="deepLink",Xr.EmbeddedWallet="embeddedWallet",Xr.SmartContractWallet="smartContractWallet"})(WalletProviderEnum||(WalletProviderEnum={}));function WalletProviderEnumFromJSON(Xr){return WalletProviderEnumFromJSONTyped(Xr)}function WalletProviderEnumFromJSONTyped(Xr,eo){return Xr}function WalletProviderEnumToJSON(Xr){return Xr}var MfaBackupCodeAcknowledgement;(function(Xr){Xr.Pending="pending",Xr.Complete="complete"})(MfaBackupCodeAcknowledgement||(MfaBackupCodeAcknowledgement={}));function MfaBackupCodeAcknowledgementFromJSON(Xr){return MfaBackupCodeAcknowledgementFromJSONTyped(Xr)}function MfaBackupCodeAcknowledgementFromJSONTyped(Xr,eo){return Xr}function MfaBackupCodeAcknowledgementToJSON(Xr){return Xr}var CustomFieldType;(function(Xr){Xr.Text="text",Xr.Checkbox="checkbox",Xr.Select="select"})(CustomFieldType||(CustomFieldType={}));function CustomFieldTypeFromJSON(Xr){return CustomFieldTypeFromJSONTyped(Xr)}function CustomFieldTypeFromJSONTyped(Xr,eo){return Xr}var KycFieldType;(function(Xr){Xr.Standard="standard",Xr.Custom="custom"})(KycFieldType||(KycFieldType={}));function KycFieldTypeFromJSON(Xr){return KycFieldTypeFromJSONTyped(Xr)}function KycFieldTypeFromJSONTyped(Xr,eo){return Xr}function KycFieldTypeToJSON(Xr){return Xr}var ChainEnum;(function(Xr){Xr.Eth="ETH",Xr.Evm="EVM",Xr.Flow="FLOW",Xr.Sol="SOL",Xr.Algo="ALGO",Xr.Stark="STARK",Xr.Cosmos="COSMOS",Xr.Btc="BTC",Xr.Eclipse="ECLIPSE"})(ChainEnum||(ChainEnum={}));function ChainEnumFromJSON(Xr){return ChainEnumFromJSONTyped(Xr)}function ChainEnumFromJSONTyped(Xr,eo){return Xr}function ChainEnumToJSON(Xr){return Xr}function PasskeyRegistrationCredentialToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{attestationObject:Xr.attestationObject,clientDataJson:Xr.clientDataJson,credentialId:Xr.credentialId,transports:Xr.transports.map(AuthenticatorTransportProtocolToJSON)}}function CompletePasskeyRecoveryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,attestation:PasskeyRegistrationCredentialToJSON(Xr.attestation),challenge:Xr.challenge}}function ConnectRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,chain:Xr.chain,provider:Xr.provider,walletName:Xr.walletName,authMode:Xr.authMode}}var EmbeddedWalletChainEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(EmbeddedWalletChainEnum||(EmbeddedWalletChainEnum={}));function EmbeddedWalletChainEnumToJSON(Xr){return Xr}var EmbeddedWalletProviderEnum;(function(Xr){Xr.Turnkey="turnkey",Xr.Turnkeyhd="turnkeyhd"})(EmbeddedWalletProviderEnum||(EmbeddedWalletProviderEnum={}));function EmbeddedWalletProviderEnumToJSON(Xr){return Xr}function CreateTurnkeyEmbeddedWalletSpecificOptsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{attestation:PasskeyRegistrationCredentialToJSON(Xr.attestation),challenge:Xr.challenge}}function CreateEmbeddedWalletSpecificOptsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:Object.assign({},CreateTurnkeyEmbeddedWalletSpecificOptsToJSON(Xr))}function CreateEmbeddedWalletParamsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chains:Xr.chains===void 0?void 0:Xr.chains.map(EmbeddedWalletChainEnumToJSON),chain:Xr.chain,embeddedWalletProvider:Xr.embeddedWalletProvider,embeddedWalletSpecificOpts:CreateEmbeddedWalletSpecificOptsToJSON(Xr.embeddedWalletSpecificOpts),isAuthenticatorAttached:Xr.isAuthenticatorAttached,passkeyAlias:Xr.passkeyAlias,sessionPublicKey:Xr.sessionPublicKey}}function CreateEmbeddedWalletsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{embeddedWallets:Xr.embeddedWallets.map(CreateEmbeddedWalletParamsToJSON)}}var UserIdentifierTypeEnum;(function(Xr){Xr.Email="email",Xr.Id="id",Xr.ExternalUserId="externalUserId",Xr.PhoneNumber="phoneNumber",Xr.SocialUsername="socialUsername"})(UserIdentifierTypeEnum||(UserIdentifierTypeEnum={}));function TurnkeyStampToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{stampHeaderName:Xr.stampHeaderName,stampHeaderValue:Xr.stampHeaderValue}}function TurnkeySignedRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{body:Xr.body,stamp:TurnkeyStampToJSON(Xr.stamp),url:Xr.url}}function CreateWalletAccountRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}var CurrencyType;(function(Xr){Xr.Fiat="fiat",Xr.Crypto="crypto"})(CurrencyType||(CurrencyType={}));function DeleteEmbeddedWalletsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}var TimeUnitEnum;(function(Xr){Xr.Days="days",Xr.Hours="hours",Xr.Minutes="minutes"})(TimeUnitEnum||(TimeUnitEnum={}));function TimeUnitEnumFromJSON(Xr){return TimeUnitEnumFromJSONTyped(Xr)}function TimeUnitEnumFromJSONTyped(Xr,eo){return Xr}var EcdsaValidatorOptions;(function(Xr){Xr.SignerToEcdsa="zerodev_signer_to_ecdsa",Xr.MultiChain="zerodev_multi_chain"})(EcdsaValidatorOptions||(EcdsaValidatorOptions={}));function EcdsaValidatorOptionsFromJSON(Xr){return EcdsaValidatorOptionsFromJSONTyped(Xr)}function EcdsaValidatorOptionsFromJSONTyped(Xr,eo){return Xr}function EmailProviderResponseFromJSON(Xr){return EmailProviderResponseFromJSONTyped(Xr)}function EmailProviderResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{emailProvider:ProviderEnumFromJSON(Xr.emailProvider)}}function EmailVerificationCreateRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{email:Xr.email,captchaToken:Xr.captchaToken}}function EmailVerificationCreateResponseFromJSON(Xr){return EmailVerificationCreateResponseFromJSONTyped(Xr)}function EmailVerificationCreateResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{verificationUUID:Xr.verificationUUID,email:Xr.email}}function EmailVerificationRetryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,email:Xr.email,captchaToken:Xr.captchaToken}}function EmailVerificationVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,verificationToken:Xr.verificationToken,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function EmbeddedWalletAuthTokenFromJSON(Xr){return EmbeddedWalletAuthTokenFromJSONTyped(Xr)}function EmbeddedWalletAuthTokenFromJSONTyped(Xr,eo){return Xr==null?Xr:{token:Xr.token}}var EmbeddedWalletAuthType;(function(Xr){Xr.Mpc="mpc"})(EmbeddedWalletAuthType||(EmbeddedWalletAuthType={}));function EmbeddedWalletPasscodeClaimRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId}}function EmbeddedWalletSecretFromJSON(Xr){return EmbeddedWalletSecretFromJSONTyped(Xr)}function EmbeddedWalletSecretFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletId:Xr.walletId,secret:Xr.secret,source:exists$1(Xr,"source")?PasswordSourceTypeEnumFromJSON(Xr.source):void 0}}function NameServiceDataFromJSON(Xr){return NameServiceDataFromJSONTyped(Xr)}function NameServiceDataFromJSONTyped(Xr,eo){return Xr==null?Xr:{avatar:exists$1(Xr,"avatar")?Xr.avatar:void 0,name:exists$1(Xr,"name")?Xr.name:void 0}}function WalletAdditionalAddressFromJSON(Xr){return WalletAdditionalAddressFromJSONTyped(Xr)}function WalletAdditionalAddressFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,publicKey:exists$1(Xr,"publicKey")?Xr.publicKey:void 0,type:WalletAddressTypeFromJSON(Xr.type)}}function WalletAdditionalAddressToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,publicKey:Xr.publicKey,type:Xr.type}}function WalletPropertiesFromJSON(Xr){return WalletPropertiesFromJSONTyped(Xr)}function WalletPropertiesFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeySubOrganizationId:exists$1(Xr,"turnkeySubOrganizationId")?Xr.turnkeySubOrganizationId:void 0,turnkeyPrivateKeyId:exists$1(Xr,"turnkeyPrivateKeyId")?Xr.turnkeyPrivateKeyId:void 0,turnkeyHDWalletId:exists$1(Xr,"turnkeyHDWalletId")?Xr.turnkeyHDWalletId:void 0,isAuthenticatorAttached:exists$1(Xr,"isAuthenticatorAttached")?Xr.isAuthenticatorAttached:void 0,turnkeyUserId:exists$1(Xr,"turnkeyUserId")?Xr.turnkeyUserId:void 0,isSessionKeyCompatible:exists$1(Xr,"isSessionKeyCompatible")?Xr.isSessionKeyCompatible:void 0,version:exists$1(Xr,"version")?EmbeddedWalletVersionEnumFromJSON(Xr.version):void 0,hardwareWallet:exists$1(Xr,"hardwareWallet")?HardwareWalletEnumFromJSON(Xr.hardwareWallet):void 0,claimed:exists$1(Xr,"claimed")?Xr.claimed:void 0,source:exists$1(Xr,"source")?PasswordSourceTypeEnumFromJSON(Xr.source):void 0}}function JwtVerifiedCredentialFromJSON(Xr){return JwtVerifiedCredentialFromJSONTyped(Xr)}function JwtVerifiedCredentialFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:exists$1(Xr,"address")?Xr.address:void 0,chain:exists$1(Xr,"chain")?Xr.chain:void 0,refId:exists$1(Xr,"refId")?Xr.refId:void 0,signerRefId:exists$1(Xr,"signerRefId")?Xr.signerRefId:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,id:Xr.id,nameService:exists$1(Xr,"name_service")?NameServiceDataFromJSON(Xr.name_service):void 0,publicIdentifier:exists$1(Xr,"public_identifier")?Xr.public_identifier:void 0,walletName:exists$1(Xr,"wallet_name")?Xr.wallet_name:void 0,walletProvider:exists$1(Xr,"wallet_provider")?WalletProviderEnumFromJSON(Xr.wallet_provider):void 0,walletProperties:exists$1(Xr,"wallet_properties")?WalletPropertiesFromJSON(Xr.wallet_properties):void 0,format:JwtVerifiedCredentialFormatEnumFromJSON(Xr.format),oauthProvider:exists$1(Xr,"oauth_provider")?ProviderEnumFromJSON(Xr.oauth_provider):void 0,oauthUsername:exists$1(Xr,"oauth_username")?Xr.oauth_username:void 0,oauthDisplayName:exists$1(Xr,"oauth_display_name")?Xr.oauth_display_name:void 0,oauthAccountId:exists$1(Xr,"oauth_account_id")?Xr.oauth_account_id:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,phoneCountryCode:exists$1(Xr,"phoneCountryCode")?Xr.phoneCountryCode:void 0,isoCountryCode:exists$1(Xr,"isoCountryCode")?Xr.isoCountryCode:void 0,oauthAccountPhotos:exists$1(Xr,"oauth_account_photos")?Xr.oauth_account_photos:void 0,oauthEmails:exists$1(Xr,"oauth_emails")?Xr.oauth_emails:void 0,oauthMetadata:exists$1(Xr,"oauth_metadata")?Xr.oauth_metadata:void 0,previousUsers:exists$1(Xr,"previous_users")?Xr.previous_users:void 0,embeddedWalletId:exists$1(Xr,"embedded_wallet_id")?Xr.embedded_wallet_id:void 0,walletAdditionalAddresses:exists$1(Xr,"wallet_additional_addresses")?Xr.wallet_additional_addresses.map(WalletAdditionalAddressFromJSON):void 0,lastSelectedAt:exists$1(Xr,"lastSelectedAt")?new Date(Xr.lastSelectedAt):void 0,signInEnabled:Xr.signInEnabled}}function CustomFieldValidValueFromJSON(Xr){return CustomFieldValidValueFromJSONTyped(Xr)}function CustomFieldValidValueFromJSONTyped(Xr,eo){return Xr==null?Xr:{label:Xr.label,key:exists$1(Xr,"key")?Xr.key:void 0}}function CustomFieldValidationRulesFromJSON(Xr){return CustomFieldValidationRulesFromJSONTyped(Xr)}function CustomFieldValidationRulesFromJSONTyped(Xr,eo){return Xr==null?Xr:{unique:exists$1(Xr,"unique")?Xr.unique:void 0,regex:exists$1(Xr,"regex")?Xr.regex:void 0,validOptions:exists$1(Xr,"validOptions")?Xr.validOptions.map(CustomFieldValidValueFromJSON):void 0,checkboxText:exists$1(Xr,"checkboxText")?Xr.checkboxText:void 0}}function ProjectSettingsKycFromJSON(Xr){return ProjectSettingsKycFromJSONTyped(Xr)}function ProjectSettingsKycFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,required:Xr.required,enabled:Xr.enabled,unique:Xr.unique,verify:Xr.verify,type:exists$1(Xr,"type")?KycFieldTypeFromJSON(Xr.type):void 0,validationRules:exists$1(Xr,"validationRules")?CustomFieldValidationRulesFromJSON(Xr.validationRules):void 0,validationType:exists$1(Xr,"validationType")?CustomFieldTypeFromJSON(Xr.validationType):void 0,label:exists$1(Xr,"label")?Xr.label:void 0,position:exists$1(Xr,"position")?Xr.position:void 0}}function SdkUserFromJSON(Xr){return SdkUserFromJSONTyped(Xr)}function SdkUserFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,projectEnvironmentId:Xr.projectEnvironmentId,verifiedCredentials:Xr.verifiedCredentials.map(JwtVerifiedCredentialFromJSON),lastVerifiedCredentialId:exists$1(Xr,"lastVerifiedCredentialId")?Xr.lastVerifiedCredentialId:void 0,sessionId:exists$1(Xr,"sessionId")?Xr.sessionId:void 0,alias:exists$1(Xr,"alias")?Xr.alias:void 0,country:exists$1(Xr,"country")?Xr.country:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,firstName:exists$1(Xr,"firstName")?Xr.firstName:void 0,jobTitle:exists$1(Xr,"jobTitle")?Xr.jobTitle:void 0,lastName:exists$1(Xr,"lastName")?Xr.lastName:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,policiesConsent:exists$1(Xr,"policiesConsent")?Xr.policiesConsent:void 0,tShirtSize:exists$1(Xr,"tShirtSize")?Xr.tShirtSize:void 0,team:exists$1(Xr,"team")?Xr.team:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,firstVisit:exists$1(Xr,"firstVisit")?new Date(Xr.firstVisit):void 0,lastVisit:exists$1(Xr,"lastVisit")?new Date(Xr.lastVisit):void 0,newUser:exists$1(Xr,"newUser")?Xr.newUser:void 0,metadata:exists$1(Xr,"metadata")?Xr.metadata:void 0,mfaBackupCodeAcknowledgement:exists$1(Xr,"mfaBackupCodeAcknowledgement")?MfaBackupCodeAcknowledgementFromJSON(Xr.mfaBackupCodeAcknowledgement):void 0,btcWallet:exists$1(Xr,"btcWallet")?Xr.btcWallet:void 0,kdaWallet:exists$1(Xr,"kdaWallet")?Xr.kdaWallet:void 0,ltcWallet:exists$1(Xr,"ltcWallet")?Xr.ltcWallet:void 0,ckbWallet:exists$1(Xr,"ckbWallet")?Xr.ckbWallet:void 0,kasWallet:exists$1(Xr,"kasWallet")?Xr.kasWallet:void 0,dogeWallet:exists$1(Xr,"dogeWallet")?Xr.dogeWallet:void 0,emailNotification:exists$1(Xr,"emailNotification")?Xr.emailNotification:void 0,discordNotification:exists$1(Xr,"discordNotification")?Xr.discordNotification:void 0,newsletterNotification:exists$1(Xr,"newsletterNotification")?Xr.newsletterNotification:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,scope:exists$1(Xr,"scope")?Xr.scope:void 0,missingFields:exists$1(Xr,"missingFields")?Xr.missingFields.map(ProjectSettingsKycFromJSON):void 0}}var EmbeddedWalletSecurityMethod;(function(Xr){Xr.Passkey="passkey",Xr.Passphrase="passphrase"})(EmbeddedWalletSecurityMethod||(EmbeddedWalletSecurityMethod={}));function EmbeddedWalletSecurityMethodFromJSON(Xr){return EmbeddedWalletSecurityMethodFromJSONTyped(Xr)}function EmbeddedWalletSecurityMethodFromJSONTyped(Xr,eo){return Xr}var EnvironmentEnum;(function(Xr){Xr.Sandbox="sandbox",Xr.Live="live"})(EnvironmentEnum||(EnvironmentEnum={}));function EnvironmentEnumFromJSON(Xr){return EnvironmentEnumFromJSONTyped(Xr)}function EnvironmentEnumFromJSONTyped(Xr,eo){return Xr}function ExportEmbeddedWalletResponseFromJSON(Xr){return ExportEmbeddedWalletResponseFromJSONTyped(Xr)}function ExportEmbeddedWalletResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{exportBundle:Xr.exportBundle}}function ExternalAuthSigninRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{jwt:Xr.jwt,sessionPublicKey:Xr.sessionPublicKey}}function FarcasterSignInRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{address:Xr.address,domain:Xr.domain,nonce:Xr.nonce,message:Xr.message,signature:Xr.signature,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function PasskeyStorageFromJSON(Xr){return PasskeyStorageFromJSONTyped(Xr)}function PasskeyStorageFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,icon:Xr.icon,updatedAt:exists$1(Xr,"updatedAt")?new Date(Xr.updatedAt):void 0}}function UserPasskeyFromJSON(Xr){return UserPasskeyFromJSONTyped(Xr)}function UserPasskeyFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,alias:exists$1(Xr,"alias")?Xr.alias:void 0,userAgent:exists$1(Xr,"userAgent")?Xr.userAgent:void 0,origin:exists$1(Xr,"origin")?Xr.origin:void 0,credentialId:Xr.credentialId,createdAt:new Date(Xr.createdAt),updatedAt:exists$1(Xr,"updatedAt")?new Date(Xr.updatedAt):void 0,storage:exists$1(Xr,"storage")?PasskeyStorageFromJSON(Xr.storage):void 0}}function GetUserPasskeysResponseFromJSON(Xr){return GetUserPasskeysResponseFromJSONTyped(Xr)}function GetUserPasskeysResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{passkeys:Xr.passkeys.map(UserPasskeyFromJSON),count:Xr.count}}var HealthcheckStatus;(function(Xr){Xr.Healthy="healthy",Xr.Unhealthy="unhealthy"})(HealthcheckStatus||(HealthcheckStatus={}));function HealthcheckStatusFromJSON(Xr){return HealthcheckStatusFromJSONTyped(Xr)}function HealthcheckStatusFromJSONTyped(Xr,eo){return Xr}function HealthcheckResponseFromJSON(Xr){return HealthcheckResponseFromJSONTyped(Xr)}function HealthcheckResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{status:HealthcheckStatusFromJSON(Xr.status)}}function InitEmailAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,turnkeyEmailAuthTargetPublicKey:Xr.turnkeyEmailAuthTargetPublicKey}}function InitEmailAuthResponseFromJSON(Xr){return InitEmailAuthResponseFromJSONTyped(Xr)}function InitEmailAuthResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeyUserId:Xr.turnkeyUserId,turnkeyApiKeyId:Xr.turnkeyApiKeyId}}function InitPasskeyRecoveryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,turnkeyRecoveryTargetPublicKey:Xr.turnkeyRecoveryTargetPublicKey}}function InitPasskeyRecoveryResponseFromJSON(Xr){return InitPasskeyRecoveryResponseFromJSONTyped(Xr)}function InitPasskeyRecoveryResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{turnkeyRecoveryUserId:Xr.turnkeyRecoveryUserId}}function JwksKeyFromJSON(Xr){return JwksKeyFromJSONTyped(Xr)}function JwksKeyFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:exists$1(Xr,"kid")?Xr.kid:void 0,alg:exists$1(Xr,"alg")?Xr.alg:void 0,kty:exists$1(Xr,"kty")?Xr.kty:void 0,use:exists$1(Xr,"use")?Xr.use:void 0,e:exists$1(Xr,"e")?Xr.e:void 0,n:exists$1(Xr,"n")?Xr.n:void 0}}function JwksResponseFromJSON(Xr){return JwksResponseFromJSONTyped(Xr)}function JwksResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{keys:Xr.keys.map(JwksKeyFromJSON)}}function AuthenticationExtensionsClientInputsFromJSON(Xr){return AuthenticationExtensionsClientInputsFromJSONTyped(Xr)}function AuthenticationExtensionsClientInputsFromJSONTyped(Xr,eo){return Xr==null?Xr:{appid:exists$1(Xr,"appid")?Xr.appid:void 0,credProps:exists$1(Xr,"credProps")?Xr.credProps:void 0,hmacCreateSecret:exists$1(Xr,"hmacCreateSecret")?Xr.hmacCreateSecret:void 0}}var PublicKeyCredentialType;(function(Xr){Xr.PublicKey="public-key"})(PublicKeyCredentialType||(PublicKeyCredentialType={}));function PublicKeyCredentialTypeFromJSON(Xr){return PublicKeyCredentialTypeFromJSONTyped(Xr)}function PublicKeyCredentialTypeFromJSONTyped(Xr,eo){return Xr}function PublicKeyCredentialTypeToJSON(Xr){return Xr}function PublicKeyCredentialDescriptorFromJSON(Xr){return PublicKeyCredentialDescriptorFromJSONTyped(Xr)}function PublicKeyCredentialDescriptorFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:PublicKeyCredentialTypeFromJSON(Xr.type)}}function MFAAuthPasskeyDeviceGetResponseAssertionFromJSON(Xr){return MFAAuthPasskeyDeviceGetResponseAssertionFromJSONTyped(Xr)}function MFAAuthPasskeyDeviceGetResponseAssertionFromJSONTyped(Xr,eo){return Xr==null?Xr:{rpId:exists$1(Xr,"rpId")?Xr.rpId:void 0,challenge:Xr.challenge,timeout:exists$1(Xr,"timeout")?Xr.timeout:void 0,userVerification:exists$1(Xr,"userVerification")?UserVerificationRequirementFromJSON(Xr.userVerification):void 0,allowCredentials:exists$1(Xr,"allowCredentials")?Xr.allowCredentials.map(PublicKeyCredentialDescriptorFromJSON):void 0,extensions:exists$1(Xr,"extensions")?AuthenticationExtensionsClientInputsFromJSON(Xr.extensions):void 0}}var MFADeviceType;(function(Xr){Xr.Totp="totp",Xr.Passkey="passkey"})(MFADeviceType||(MFADeviceType={}));function MFADeviceTypeFromJSON(Xr){return MFADeviceTypeFromJSONTyped(Xr)}function MFADeviceTypeFromJSONTyped(Xr,eo){return Xr}function MFADeviceTypeToJSON(Xr){return Xr}function MFAAuthPasskeyDeviceGetResponseFromJSON(Xr){return MFAAuthPasskeyDeviceGetResponseFromJSONTyped(Xr)}function MFAAuthPasskeyDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),assertion:MFAAuthPasskeyDeviceGetResponseAssertionFromJSON(Xr.assertion)}}function AuthenticationExtensionsClientOutputsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{appid:Xr.appid,credProps:Xr.credProps,hmacCreateSecret:Xr.hmacCreateSecret}}function AuthenticatorAssertionResponseToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{clientDataJSON:Xr.clientDataJSON,authenticatorData:Xr.authenticatorData,signature:Xr.signature,userHandle:Xr.userHandle}}function PasskeyAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,rawId:Xr.rawId,response:AuthenticatorAssertionResponseToJSON(Xr.response),authenticatorAttachment:Xr.authenticatorAttachment,clientExtensionResults:AuthenticationExtensionsClientOutputsToJSON(Xr.clientExtensionResults),type:Xr.type}}function MFAAuthPasskeyDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,assertion:PasskeyAuthRequestToJSON(Xr.assertion)}}function CreateMfaTokenToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{singleUse:Xr.singleUse}}function MFAAuthRecoveryDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{createMfaToken:CreateMfaTokenToJSON(Xr.createMfaToken),code:Xr.code}}function MFAAuthTotpDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,createMfaToken:CreateMfaTokenToJSON(Xr.createMfaToken),code:Xr.code}}function MFADeviceFromJSON(Xr){return MFADeviceFromJSONTyped(Xr)}function MFADeviceFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:exists$1(Xr,"type")?MFADeviceTypeFromJSON(Xr.type):void 0,verified:exists$1(Xr,"verified")?Xr.verified:void 0,id:exists$1(Xr,"id")?Xr.id:void 0,createdAt:exists$1(Xr,"createdAt")?new Date(Xr.createdAt):void 0,verifiedAt:exists$1(Xr,"verifiedAt")?Xr.verifiedAt===null?null:new Date(Xr.verifiedAt):void 0,_default:exists$1(Xr,"default")?Xr.default:void 0,alias:exists$1(Xr,"alias")?Xr.alias:void 0}}function MFAGetRecoveryCodesResponseFromJSON(Xr){return MFAGetRecoveryCodesResponseFromJSONTyped(Xr)}function MFAGetRecoveryCodesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,recoveryCodes:Xr.recoveryCodes}}function MFAListDevicesResponseFromJSON(Xr){return MFAListDevicesResponseFromJSONTyped(Xr)}function MFAListDevicesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,devices:Xr.devices.map(MFADeviceFromJSON)}}function MFARegenRecoveryCodesResponseFromJSON(Xr){return MFARegenRecoveryCodesResponseFromJSONTyped(Xr)}function MFARegenRecoveryCodesResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{count:Xr.count,recoveryCodes:Xr.recoveryCodes}}function AuthenticatorSelectionCriteriaFromJSON(Xr){return AuthenticatorSelectionCriteriaFromJSONTyped(Xr)}function AuthenticatorSelectionCriteriaFromJSONTyped(Xr,eo){return Xr==null?Xr:{authenticatorAttachment:exists$1(Xr,"authenticatorAttachment")?AuthenticatorAttachmentFromJSON(Xr.authenticatorAttachment):void 0,requireResidentKey:exists$1(Xr,"requireResidentKey")?Xr.requireResidentKey:void 0,residentKey:exists$1(Xr,"residentKey")?ResidentKeyRequirementFromJSON(Xr.residentKey):void 0,userVerification:exists$1(Xr,"userVerification")?UserVerificationRequirementFromJSON(Xr.userVerification):void 0}}function PublicKeyCredentialParametersFromJSON(Xr){return PublicKeyCredentialParametersFromJSONTyped(Xr)}function PublicKeyCredentialParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{alg:Xr.alg,type:PublicKeyCredentialTypeFromJSON(Xr.type)}}function PublicKeyCredentialRpEntityFromJSON(Xr){return PublicKeyCredentialRpEntityFromJSONTyped(Xr)}function PublicKeyCredentialRpEntityFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:exists$1(Xr,"id")?Xr.id:void 0,name:Xr.name}}function PublicKeyCredentialUserEntityFromJSON(Xr){return PublicKeyCredentialUserEntityFromJSONTyped(Xr)}function PublicKeyCredentialUserEntityFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,name:Xr.name,displayName:Xr.displayName}}function MFARegisterPasskeyDeviceGetResponseRegistrationFromJSON(Xr){return MFARegisterPasskeyDeviceGetResponseRegistrationFromJSONTyped(Xr)}function MFARegisterPasskeyDeviceGetResponseRegistrationFromJSONTyped(Xr,eo){return Xr==null?Xr:{attestation:exists$1(Xr,"attestation")?AttestationConveyancePreferenceFromJSON(Xr.attestation):void 0,rp:PublicKeyCredentialRpEntityFromJSON(Xr.rp),user:PublicKeyCredentialUserEntityFromJSON(Xr.user),challenge:Xr.challenge,pubKeyCredParams:Xr.pubKeyCredParams.map(PublicKeyCredentialParametersFromJSON),timeout:exists$1(Xr,"timeout")?Xr.timeout:void 0,authenticatorSelection:exists$1(Xr,"authenticatorSelection")?AuthenticatorSelectionCriteriaFromJSON(Xr.authenticatorSelection):void 0,excludeCredentials:exists$1(Xr,"excludeCredentials")?Xr.excludeCredentials.map(PublicKeyCredentialDescriptorFromJSON):void 0,extensions:exists$1(Xr,"extensions")?AuthenticationExtensionsClientInputsFromJSON(Xr.extensions):void 0}}function MFARegisterPasskeyDeviceGetResponseFromJSON(Xr){return MFARegisterPasskeyDeviceGetResponseFromJSONTyped(Xr)}function MFARegisterPasskeyDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),registration:MFARegisterPasskeyDeviceGetResponseRegistrationFromJSON(Xr.registration)}}function AuthenticatorAttestationResponseToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{clientDataJSON:Xr.clientDataJSON,attestationObject:Xr.attestationObject,authenticatorData:Xr.authenticatorData,publicKeyAlgorithm:Xr.publicKeyAlgorithm,publicKey:Xr.publicKey}}function PasskeyRegisterVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,rawId:Xr.rawId,response:AuthenticatorAttestationResponseToJSON(Xr.response),authenticatorAttachment:Xr.authenticatorAttachment,clientExtensionResults:AuthenticationExtensionsClientOutputsToJSON(Xr.clientExtensionResults),type:Xr.type}}function MFARegisterPasskeyDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,attestation:PasskeyRegisterVerifyRequestToJSON(Xr.attestation)}}function MFARegisterTotpDeviceGetResponseFromJSON(Xr){return MFARegisterTotpDeviceGetResponseFromJSONTyped(Xr)}function MFARegisterTotpDeviceGetResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:Xr.id,type:MFADeviceTypeFromJSON(Xr.type),secret:Xr.secret,uri:Xr.uri}}function MFARegisterTotpDevicePostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{type:Xr.type,code:Xr.code}}function MFAUpdateDeviceRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{default:Xr._default}}function MergeUserConflictResolutionToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{userId:Xr.userId,fieldKey:Xr.fieldKey,type:Xr.type}}function MergeUserConflictResolutionsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{mergeUserResolutions:Xr.mergeUserResolutions===void 0?void 0:Xr.mergeUserResolutions.map(MergeUserConflictResolutionToJSON)}}function NameServiceFromJSON(Xr){return NameServiceFromJSONTyped(Xr)}function NameServiceFromJSONTyped(Xr,eo){return Xr==null?Xr:{registry:exists$1(Xr,"registry")?Xr.registry:void 0}}function NativeCurrencyFromJSON(Xr){return NativeCurrencyFromJSONTyped(Xr)}function NativeCurrencyFromJSONTyped(Xr,eo){return Xr==null?Xr:{decimals:Xr.decimals,name:Xr.name,symbol:Xr.symbol,denom:exists$1(Xr,"denom")?Xr.denom:void 0,iconUrl:exists$1(Xr,"iconUrl")?Xr.iconUrl:void 0}}function NetworkConfigurationFromJSON(Xr){return NetworkConfigurationFromJSONTyped(Xr)}function NetworkConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{lcdUrl:exists$1(Xr,"lcdUrl")?Xr.lcdUrl:void 0,chainName:exists$1(Xr,"chainName")?Xr.chainName:void 0,name:Xr.name,shortName:Xr.shortName,chain:Xr.chain,chainId:Xr.chainId,nameService:exists$1(Xr,"nameService")?NameServiceFromJSON(Xr.nameService):void 0,networkId:Xr.networkId,iconUrls:Xr.iconUrls,nativeCurrency:NativeCurrencyFromJSON(Xr.nativeCurrency),rpcUrls:Xr.rpcUrls,privateCustomerRpcUrls:exists$1(Xr,"privateCustomerRpcUrls")?Xr.privateCustomerRpcUrls:void 0,blockExplorerUrls:Xr.blockExplorerUrls,vanityName:exists$1(Xr,"vanityName")?Xr.vanityName:void 0,bech32Prefix:exists$1(Xr,"bech32Prefix")?Xr.bech32Prefix:void 0}}function NetworkConfigurationResponseFromJSON(Xr){return NetworkConfigurationResponseFromJSONTyped(Xr)}function NetworkConfigurationResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{chainName:exists$1(Xr,"chainName")?Xr.chainName:void 0,networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkConfigurationFromJSON):void 0}}var NextViewEnum;(function(Xr){Xr.Done="done",Xr.VerifyEmail="verify-email",Xr.VerifiedAndTransferred="verified-and-transferred",Xr.VerifySms="verify-sms"})(NextViewEnum||(NextViewEnum={}));function NextViewEnumFromJSON(Xr){return NextViewEnumFromJSONTyped(Xr)}function NextViewEnumFromJSONTyped(Xr,eo){return Xr}function NonceResponseFromJSON(Xr){return NonceResponseFromJSONTyped(Xr)}function NonceResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{nonce:exists$1(Xr,"nonce")?Xr.nonce:void 0}}function OauthInitAuthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,redirectUrl:Xr.redirectUrl}}function OauthProviderLoginUrlFromJSON(Xr){return OauthProviderLoginUrlFromJSONTyped(Xr)}function OauthProviderLoginUrlFromJSONTyped(Xr,eo){return Xr==null?Xr:{url:Xr.url}}function OauthRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{code:Xr.code,codeVerifier:Xr.codeVerifier,state:Xr.state,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function OauthResultRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,telegramAuthToken:Xr.telegramAuthToken,forceCreateUser:Xr.forceCreateUser,code:Xr.code,sessionPublicKey:Xr.sessionPublicKey}}var OauthResultStatus;(function(Xr){Xr.Pending="pending",Xr.Completed="completed"})(OauthResultStatus||(OauthResultStatus={}));function OauthResultStatusFromJSON(Xr){return OauthResultStatusFromJSONTyped(Xr)}function OauthResultStatusFromJSONTyped(Xr,eo){return Xr}function OauthResultResponseFromJSON(Xr){return OauthResultResponseFromJSONTyped(Xr)}function OauthResultResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{code:exists$1(Xr,"code")?Xr.code:void 0,error:exists$1(Xr,"error")?Xr.error:void 0,status:OauthResultStatusFromJSON(Xr.status)}}function PrefetchRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chain:Xr.chain,publicWalletAddress:Xr.publicWalletAddress}}function NetworkFromJSON(Xr){return NetworkFromJSONTyped(Xr)}function NetworkFromJSONTyped(Xr,eo){return Xr==null?Xr:{networkId:Xr.networkId,chainName:Xr.chainName,enabled:Xr.enabled,rpcUrl:exists$1(Xr,"rpcUrl")?Xr.rpcUrl:void 0}}function ProjectSettingsChainsFromJSON(Xr){return ProjectSettingsChainsFromJSONTyped(Xr)}function ProjectSettingsChainsFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,enabled:Xr.enabled,networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkFromJSON):void 0}}function ProjectSettingsDesignButtonFromJSON(Xr){return ProjectSettingsDesignButtonFromJSONTyped(Xr)}function ProjectSettingsDesignButtonFromJSONTyped(Xr,eo){return Xr==null?Xr:{background:exists$1(Xr,"background")?Xr.background:void 0,fontColor:exists$1(Xr,"fontColor")?Xr.fontColor:void 0,paddingHeight:exists$1(Xr,"paddingHeight")?Xr.paddingHeight:void 0,paddingWidth:exists$1(Xr,"paddingWidth")?Xr.paddingWidth:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0}}function ProjectSettingsDesignModalFromJSON(Xr){return ProjectSettingsDesignModalFromJSONTyped(Xr)}function ProjectSettingsDesignModalFromJSONTyped(Xr,eo){return Xr==null?Xr:{border:exists$1(Xr,"border")?Xr.border:void 0,brand:exists$1(Xr,"brand")?Xr.brand:void 0,primaryColor:exists$1(Xr,"primaryColor")?Xr.primaryColor:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0,theme:exists$1(Xr,"theme")?Xr.theme:void 0,view:exists$1(Xr,"view")?Xr.view:void 0,template:exists$1(Xr,"template")?Xr.template:void 0,displayOrder:exists$1(Xr,"displayOrder")?Xr.displayOrder:void 0,emailOnly:exists$1(Xr,"emailOnly")?Xr.emailOnly:void 0,showWalletsButton:exists$1(Xr,"showWalletsButton")?Xr.showWalletsButton:void 0,emailSubmitButtonInsideInput:exists$1(Xr,"emailSubmitButtonInsideInput")?Xr.emailSubmitButtonInsideInput:void 0,splitEmailAndSocial:exists$1(Xr,"splitEmailAndSocial")?Xr.splitEmailAndSocial:void 0,socialAboveEmail:exists$1(Xr,"socialAboveEmail")?Xr.socialAboveEmail:void 0}}function ProjectSettingsDesignWidgetFromJSON(Xr){return ProjectSettingsDesignWidgetFromJSONTyped(Xr)}function ProjectSettingsDesignWidgetFromJSONTyped(Xr,eo){return Xr==null?Xr:{backgroundColor:exists$1(Xr,"backgroundColor")?Xr.backgroundColor:void 0,border:exists$1(Xr,"border")?Xr.border:void 0,radius:exists$1(Xr,"radius")?Xr.radius:void 0,textColor:exists$1(Xr,"textColor")?Xr.textColor:void 0,theme:exists$1(Xr,"theme")?Xr.theme:void 0}}function ProjectSettingsDesignFromJSON(Xr){return ProjectSettingsDesignFromJSONTyped(Xr)}function ProjectSettingsDesignFromJSONTyped(Xr,eo){return Xr==null?Xr:{modal:exists$1(Xr,"modal")?ProjectSettingsDesignModalFromJSON(Xr.modal):void 0,button:exists$1(Xr,"button")?ProjectSettingsDesignButtonFromJSON(Xr.button):void 0,widget:exists$1(Xr,"widget")?ProjectSettingsDesignWidgetFromJSON(Xr.widget):void 0}}function ProjectSettingsGeneralFromJSON(Xr){return ProjectSettingsGeneralFromJSONTyped(Xr)}function ProjectSettingsGeneralFromJSONTyped(Xr,eo){return Xr==null?Xr:{displayName:exists$1(Xr,"displayName")?Xr.displayName:void 0,supportEmail:exists$1(Xr,"supportEmail")?Xr.supportEmail:void 0,supportText:exists$1(Xr,"supportText")?Xr.supportText:void 0,appLogo:exists$1(Xr,"appLogo")?Xr.appLogo:void 0,imageUserNotInAccessList:exists$1(Xr,"imageUserNotInAccessList")?Xr.imageUserNotInAccessList:void 0,imageUserInAccessList:exists$1(Xr,"imageUserInAccessList")?Xr.imageUserInAccessList:void 0,supportUrls:exists$1(Xr,"supportUrls")?Xr.supportUrls:void 0,collectUserDataWelcomeHeader:exists$1(Xr,"collectUserDataWelcomeHeader")?Xr.collectUserDataWelcomeHeader:void 0,collectUserDataWelcomeMessage:exists$1(Xr,"collectUserDataWelcomeMessage")?Xr.collectUserDataWelcomeMessage:void 0,skipOptionalKYCFieldDuringOnboarding:exists$1(Xr,"skipOptionalKYCFieldDuringOnboarding")?Xr.skipOptionalKYCFieldDuringOnboarding:void 0,emailCompanyName:exists$1(Xr,"emailCompanyName")?Xr.emailCompanyName:void 0}}function ProjectSettingsPrivacyFromJSON(Xr){return ProjectSettingsPrivacyFromJSONTyped(Xr)}function ProjectSettingsPrivacyFromJSONTyped(Xr,eo){return Xr==null?Xr:{collectIp:exists$1(Xr,"collectIp")?Xr.collectIp:void 0}}function MobileSettingsFromJSON(Xr){return MobileSettingsFromJSONTyped(Xr)}function MobileSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{deeplinkUrlsEnabled:exists$1(Xr,"deeplinkUrlsEnabled")?Xr.deeplinkUrlsEnabled:void 0}}function ProjectSettingsSdkAccountAbstractionFromJSON(Xr){return ProjectSettingsSdkAccountAbstractionFromJSONTyped(Xr)}function ProjectSettingsSdkAccountAbstractionFromJSONTyped(Xr,eo){return Xr==null?Xr:{allWallets:exists$1(Xr,"allWallets")?Xr.allWallets:void 0,allUsers:exists$1(Xr,"allUsers")?Xr.allUsers:void 0,separateSmartWalletAndSigner:exists$1(Xr,"separateSmartWalletAndSigner")?Xr.separateSmartWalletAndSigner:void 0}}var SignInProviderEnum;(function(Xr){Xr.Dynamic="dynamic",Xr.MagicLink="magicLink",Xr.Blocto="blocto",Xr.Turnkey="turnkey",Xr.CoinbaseWaas="coinbaseWaas"})(SignInProviderEnum||(SignInProviderEnum={}));function SignInProviderEnumFromJSON(Xr){return SignInProviderEnumFromJSONTyped(Xr)}function SignInProviderEnumFromJSONTyped(Xr,eo){return Xr}function ProjectSettingsSdkEmailSignInFromJSON(Xr){return ProjectSettingsSdkEmailSignInFromJSONTyped(Xr)}function ProjectSettingsSdkEmailSignInFromJSONTyped(Xr,eo){return Xr==null?Xr:{signInProvider:exists$1(Xr,"signInProvider")?SignInProviderEnumFromJSON(Xr.signInProvider):void 0}}function ChainConfigurationFromJSON(Xr){return ChainConfigurationFromJSONTyped(Xr)}function ChainConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{name:Xr.name,enabled:Xr.enabled,primary:Xr.primary}}function DurationFromJSON(Xr){return DurationFromJSONTyped(Xr)}function DurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{amount:Xr.amount,unit:TimeUnitEnumFromJSON(Xr.unit)}}function SupportedSecurityMethodFromJSON(Xr){return SupportedSecurityMethodFromJSONTyped(Xr)}function SupportedSecurityMethodFromJSONTyped(Xr,eo){return Xr==null?Xr:{isDefault:Xr.isDefault,isEnabled:Xr.isEnabled,isPermanentAuthenticator:Xr.isPermanentAuthenticator,listPosition:Xr.listPosition}}function SupportedSecurityMethodsFromJSON(Xr){return SupportedSecurityMethodsFromJSONTyped(Xr)}function SupportedSecurityMethodsFromJSONTyped(Xr,eo){return Xr==null?Xr:{passkey:exists$1(Xr,"passkey")?SupportedSecurityMethodFromJSON(Xr.passkey):void 0,email:exists$1(Xr,"email")?SupportedSecurityMethodFromJSON(Xr.email):void 0,password:exists$1(Xr,"password")?SupportedSecurityMethodFromJSON(Xr.password):void 0}}function ProjectSettingsSdkEmbeddedWalletsFromJSON(Xr){return ProjectSettingsSdkEmbeddedWalletsFromJSONTyped(Xr)}function ProjectSettingsSdkEmbeddedWalletsFromJSONTyped(Xr,eo){return Xr==null?Xr:{automaticEmbeddedWalletCreation:exists$1(Xr,"automaticEmbeddedWalletCreation")?Xr.automaticEmbeddedWalletCreation:void 0,showEmbeddedWalletActionsUI:exists$1(Xr,"showEmbeddedWalletActionsUI")?Xr.showEmbeddedWalletActionsUI:void 0,emailRecoveryEnabled:exists$1(Xr,"emailRecoveryEnabled")?Xr.emailRecoveryEnabled:void 0,forceAuthenticatorAtSignup:exists$1(Xr,"forceAuthenticatorAtSignup")?Xr.forceAuthenticatorAtSignup:void 0,allowSkippingAuthenticatorAtSignup:exists$1(Xr,"allowSkippingAuthenticatorAtSignup")?Xr.allowSkippingAuthenticatorAtSignup:void 0,sessionKeyDuration:exists$1(Xr,"sessionKeyDuration")?DurationFromJSON(Xr.sessionKeyDuration):void 0,supportedSecurityMethods:exists$1(Xr,"supportedSecurityMethods")?SupportedSecurityMethodsFromJSON(Xr.supportedSecurityMethods):void 0,chainConfigurations:exists$1(Xr,"chainConfigurations")?Xr.chainConfigurations.map(ChainConfigurationFromJSON):void 0,domainEnabledByProvider:exists$1(Xr,"domainEnabledByProvider")?Xr.domainEnabledByProvider:void 0,defaultWalletVersion:exists$1(Xr,"defaultWalletVersion")?EmbeddedWalletVersionEnumFromJSON(Xr.defaultWalletVersion):void 0,promptForKeyExport:exists$1(Xr,"promptForKeyExport")?Xr.promptForKeyExport:void 0}}var SocialSignInProviderEnum;(function(Xr){Xr.Apple="apple",Xr.Bitbucket="bitbucket",Xr.Coinbasesocial="coinbasesocial",Xr.Discord="discord",Xr.Epicgames="epicgames",Xr.Facebook="facebook",Xr.Farcaster="farcaster",Xr.Github="github",Xr.Gitlab="gitlab",Xr.Google="google",Xr.Instagram="instagram",Xr.Linkedin="linkedin",Xr.Microsoft="microsoft",Xr.Twitch="twitch",Xr.Twitter="twitter",Xr.Telegram="telegram",Xr.Spotify="spotify",Xr.Tiktok="tiktok",Xr.Line="line",Xr.Steam="steam",Xr.Shopify="shopify"})(SocialSignInProviderEnum||(SocialSignInProviderEnum={}));function SocialSignInProviderEnumFromJSON(Xr){return SocialSignInProviderEnumFromJSONTyped(Xr)}function SocialSignInProviderEnumFromJSONTyped(Xr,eo){return Xr}function SocialSignInProviderFromJSON(Xr){return SocialSignInProviderFromJSONTyped(Xr)}function SocialSignInProviderFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:SocialSignInProviderEnumFromJSON(Xr.provider),enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0}}function ProjectSettingsSdkSocialSignInFromJSON(Xr){return ProjectSettingsSdkSocialSignInFromJSONTyped(Xr)}function ProjectSettingsSdkSocialSignInFromJSONTyped(Xr,eo){return Xr==null?Xr:{signInProvider:exists$1(Xr,"signInProvider")?SignInProviderEnumFromJSON(Xr.signInProvider):void 0,providers:exists$1(Xr,"providers")?Xr.providers.map(SocialSignInProviderFromJSON):void 0}}function ProjectSettingsSdkWalletConnectFromJSON(Xr){return ProjectSettingsSdkWalletConnectFromJSONTyped(Xr)}function ProjectSettingsSdkWalletConnectFromJSONTyped(Xr,eo){return Xr==null?Xr:{projectId:exists$1(Xr,"projectId")?Xr.projectId:void 0,v2Enabled:exists$1(Xr,"v2Enabled")?Xr.v2Enabled:void 0,walletProjectId:exists$1(Xr,"walletProjectId")?Xr.walletProjectId:void 0}}var SdkViewSectionAlignment;(function(Xr){Xr.Center="center",Xr.Left="left",Xr.Right="right"})(SdkViewSectionAlignment||(SdkViewSectionAlignment={}));function SdkViewSectionAlignmentFromJSON(Xr){return SdkViewSectionAlignmentFromJSONTyped(Xr)}function SdkViewSectionAlignmentFromJSONTyped(Xr,eo){return Xr}var SdkViewSectionType;(function(Xr){Xr.Email="email",Xr.EmailAndPhone="emailAndPhone",Xr.Phone="phone",Xr.Separator="separator",Xr.Social="social",Xr.Text="text",Xr.Wallet="wallet"})(SdkViewSectionType||(SdkViewSectionType={}));function SdkViewSectionTypeFromJSON(Xr){return SdkViewSectionTypeFromJSONTyped(Xr)}function SdkViewSectionTypeFromJSONTyped(Xr,eo){return Xr}function SdkViewSectionFromJSON(Xr){return SdkViewSectionFromJSONTyped(Xr)}function SdkViewSectionFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:SdkViewSectionTypeFromJSON(Xr.type),label:exists$1(Xr,"label")?Xr.label:void 0,numOfItemsToDisplay:exists$1(Xr,"numOfItemsToDisplay")?Xr.numOfItemsToDisplay:void 0,defaultItem:exists$1(Xr,"defaultItem")?Xr.defaultItem:void 0,alignment:exists$1(Xr,"alignment")?SdkViewSectionAlignmentFromJSON(Xr.alignment):void 0}}var SdkViewType;(function(Xr){Xr.Login="login"})(SdkViewType||(SdkViewType={}));function SdkViewTypeFromJSON(Xr){return SdkViewTypeFromJSONTyped(Xr)}function SdkViewTypeFromJSONTyped(Xr,eo){return Xr}function SdkViewFromJSON(Xr){return SdkViewFromJSONTyped(Xr)}function SdkViewFromJSONTyped(Xr,eo){return Xr==null?Xr:{type:SdkViewTypeFromJSON(Xr.type),sections:exists$1(Xr,"sections")?Xr.sections.map(SdkViewSectionFromJSON):void 0}}function ProjectSettingsSdkFromJSON(Xr){return ProjectSettingsSdkFromJSONTyped(Xr)}function ProjectSettingsSdkFromJSONTyped(Xr,eo){return Xr==null?Xr:{emailSignIn:exists$1(Xr,"emailSignIn")?ProjectSettingsSdkEmailSignInFromJSON(Xr.emailSignIn):void 0,socialSignIn:exists$1(Xr,"socialSignIn")?ProjectSettingsSdkSocialSignInFromJSON(Xr.socialSignIn):void 0,multiWallet:exists$1(Xr,"multiWallet")?Xr.multiWallet:void 0,multiWalletUnlinkDisabled:exists$1(Xr,"multiWalletUnlinkDisabled")?Xr.multiWalletUnlinkDisabled:void 0,mobile:exists$1(Xr,"mobile")?MobileSettingsFromJSON(Xr.mobile):void 0,confirmWalletTransfers:exists$1(Xr,"confirmWalletTransfers")?Xr.confirmWalletTransfers:void 0,onrampFunding:exists$1(Xr,"onrampFunding")?Xr.onrampFunding:void 0,passkeyEmbeddedWalletEnabled:exists$1(Xr,"passkeyEmbeddedWalletEnabled")?Xr.passkeyEmbeddedWalletEnabled:void 0,automaticEmbeddedWalletCreation:exists$1(Xr,"automaticEmbeddedWalletCreation")?Xr.automaticEmbeddedWalletCreation:void 0,passkeyEmbeddedWalletRecoveryEnabled:exists$1(Xr,"passkeyEmbeddedWalletRecoveryEnabled")?Xr.passkeyEmbeddedWalletRecoveryEnabled:void 0,embeddedWalletSecurityMethods:exists$1(Xr,"embeddedWalletSecurityMethods")?Xr.embeddedWalletSecurityMethods.map(EmbeddedWalletSecurityMethodFromJSON):void 0,embeddedWallets:exists$1(Xr,"embeddedWallets")?ProjectSettingsSdkEmbeddedWalletsFromJSON(Xr.embeddedWallets):void 0,walletConnect:exists$1(Xr,"walletConnect")?ProjectSettingsSdkWalletConnectFromJSON(Xr.walletConnect):void 0,confirmEmailProviderForVerify:exists$1(Xr,"confirmEmailProviderForVerify")?Xr.confirmEmailProviderForVerify:void 0,displayDynamicMessaging:exists$1(Xr,"displayDynamicMessaging")?Xr.displayDynamicMessaging:void 0,hideNetworkInDynamicWidget:exists$1(Xr,"hideNetworkInDynamicWidget")?Xr.hideNetworkInDynamicWidget:void 0,preventOrphanedAccounts:exists$1(Xr,"preventOrphanedAccounts")?Xr.preventOrphanedAccounts:void 0,views:exists$1(Xr,"views")?Xr.views.map(SdkViewFromJSON):void 0,accountAbstraction:exists$1(Xr,"accountAbstraction")?ProjectSettingsSdkAccountAbstractionFromJSON(Xr.accountAbstraction):void 0,enableMultiAsset:exists$1(Xr,"enableMultiAsset")?Xr.enableMultiAsset:void 0,showFiat:exists$1(Xr,"showFiat")?Xr.showFiat:void 0,disabledWalletConnectors:exists$1(Xr,"disabledWalletConnectors")?Xr.disabledWalletConnectors:void 0}}function AuthSettingsFromJSON(Xr){return AuthSettingsFromJSONTyped(Xr)}function AuthSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{storage:Xr.storage.map(AuthStorageEnumFromJSON)}}function ExternalAuthFromJSON(Xr){return ExternalAuthFromJSONTyped(Xr)}function ExternalAuthFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,iss:exists$1(Xr,"iss")?Xr.iss:void 0,aud:exists$1(Xr,"aud")?Xr.aud:void 0,jwksUrl:exists$1(Xr,"jwksUrl")?Xr.jwksUrl:void 0,cookieName:exists$1(Xr,"cookieName")?Xr.cookieName:void 0}}function HCaptchaSettingsFromJSON(Xr){return HCaptchaSettingsFromJSONTyped(Xr)}function HCaptchaSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,secretKey:exists$1(Xr,"secretKey")?Xr.secretKey:void 0,siteKey:exists$1(Xr,"siteKey")?Xr.siteKey:void 0}}function MFASettingsFromJSON(Xr){return MFASettingsFromJSONTyped(Xr)}function MFASettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{enabled:exists$1(Xr,"enabled")?Xr.enabled:void 0,required:exists$1(Xr,"required")?Xr.required:void 0,availableMethods:exists$1(Xr,"availableMethods")?Xr.availableMethods.map(MFADeviceTypeFromJSON):void 0}}function ProjectSettingsSecurityFromJSON(Xr){return ProjectSettingsSecurityFromJSONTyped(Xr)}function ProjectSettingsSecurityFromJSONTyped(Xr,eo){return Xr==null?Xr:{jwtDuration:exists$1(Xr,"jwtDuration")?DurationFromJSON(Xr.jwtDuration):void 0,hCaptcha:exists$1(Xr,"hCaptcha")?HCaptchaSettingsFromJSON(Xr.hCaptcha):void 0,mfa:exists$1(Xr,"mfa")?MFASettingsFromJSON(Xr.mfa):void 0,auth:exists$1(Xr,"auth")?AuthSettingsFromJSON(Xr.auth):void 0,externalAuth:exists$1(Xr,"externalAuth")?ExternalAuthFromJSON(Xr.externalAuth):void 0}}function ProviderAgreementFromJSON(Xr){return ProviderAgreementFromJSONTyped(Xr)}function ProviderAgreementFromJSONTyped(Xr,eo){return Xr==null?Xr:{termsUrl:Xr.termsUrl,email:Xr.email,userId:Xr.userId,createdAt:new Date(Xr.createdAt)}}function ProviderMultichainAccountAbstractionProvidersFromJSON(Xr){return ProviderMultichainAccountAbstractionProvidersFromJSONTyped(Xr)}function ProviderMultichainAccountAbstractionProvidersFromJSONTyped(Xr,eo){return Xr==null?Xr:{clientId:Xr.clientId,chain:Xr.chain,_default:exists$1(Xr,"default")?Xr.default:void 0}}function SmsCountryCodeFromJSON(Xr){return SmsCountryCodeFromJSONTyped(Xr)}function SmsCountryCodeFromJSONTyped(Xr,eo){return Xr==null?Xr:{isoCountryCode:Xr.isoCountryCode,phoneCountryCode:Xr.phoneCountryCode}}var ProviderEntryPointVersionEnum;(function(Xr){Xr.V6="v6",Xr.V7="v7"})(ProviderEntryPointVersionEnum||(ProviderEntryPointVersionEnum={}));var ProviderKernelVersionEnum;(function(Xr){Xr.V24="v2_4",Xr.V30="v3_0",Xr.V31="v3_1"})(ProviderKernelVersionEnum||(ProviderKernelVersionEnum={}));function ProviderFromJSON(Xr){return ProviderFromJSONTyped(Xr)}function ProviderFromJSONTyped(Xr,eo){return Xr==null?Xr:{id:exists$1(Xr,"id")?Xr.id:void 0,provider:ProviderEnumFromJSON(Xr.provider),enabledAt:exists$1(Xr,"enabledAt")?Xr.enabledAt===null?null:new Date(Xr.enabledAt):void 0,clientId:exists$1(Xr,"clientId")?Xr.clientId:void 0,clientSecret:exists$1(Xr,"clientSecret")?Xr.clientSecret:void 0,providerProjectId:exists$1(Xr,"providerProjectId")?Xr.providerProjectId:void 0,authorizationUrl:exists$1(Xr,"authorizationUrl")?Xr.authorizationUrl:void 0,redirectUrl:exists$1(Xr,"redirectUrl")?Xr.redirectUrl:void 0,defaultChainId:exists$1(Xr,"defaultChainId")?Xr.defaultChainId:void 0,defaultChain:exists$1(Xr,"defaultChain")?Xr.defaultChain:void 0,keyExportUrl:exists$1(Xr,"keyExportUrl")?Xr.keyExportUrl:void 0,termsAcceptedByUser:exists$1(Xr,"termsAcceptedByUser")?ProviderAgreementFromJSON(Xr.termsAcceptedByUser):void 0,scopes:exists$1(Xr,"scopes")?Xr.scopes:void 0,baseAuthUrl:exists$1(Xr,"baseAuthUrl")?Xr.baseAuthUrl:void 0,appleKeyId:exists$1(Xr,"appleKeyId")?Xr.appleKeyId:void 0,appleTeamId:exists$1(Xr,"appleTeamId")?Xr.appleTeamId:void 0,accountSid:exists$1(Xr,"accountSid")?Xr.accountSid:void 0,twilioNumber:exists$1(Xr,"twilioNumber")?Xr.twilioNumber:void 0,enabledCountries:exists$1(Xr,"enabledCountries")?Xr.enabledCountries.map(SmsCountryCodeFromJSON):void 0,entryPointVersion:exists$1(Xr,"entryPointVersion")?Xr.entryPointVersion:void 0,kernelVersion:exists$1(Xr,"kernelVersion")?Xr.kernelVersion:void 0,multichainAccountAbstractionProviders:exists$1(Xr,"multichainAccountAbstractionProviders")?Xr.multichainAccountAbstractionProviders.map(ProviderMultichainAccountAbstractionProvidersFromJSON):void 0,ecdsaProviderType:exists$1(Xr,"ecdsaProviderType")?EcdsaValidatorOptionsFromJSON(Xr.ecdsaProviderType):void 0,createNewAccounts:exists$1(Xr,"createNewAccounts")?Xr.createNewAccounts:void 0}}function ProjectSettingsFromJSON(Xr){return ProjectSettingsFromJSONTyped(Xr)}function ProjectSettingsFromJSONTyped(Xr,eo){return Xr==null?Xr:{environmentName:exists$1(Xr,"environmentName")?EnvironmentEnumFromJSON(Xr.environmentName):void 0,chains:Xr.chains.map(ProjectSettingsChainsFromJSON),customFields:exists$1(Xr,"customFields")?Xr.customFields.map(ProjectSettingsKycFromJSON):void 0,kyc:Xr.kyc.map(ProjectSettingsKycFromJSON),design:ProjectSettingsDesignFromJSON(Xr.design),general:ProjectSettingsGeneralFromJSON(Xr.general),privacy:ProjectSettingsPrivacyFromJSON(Xr.privacy),providers:exists$1(Xr,"providers")?Xr.providers.map(ProviderFromJSON):void 0,sdk:ProjectSettingsSdkFromJSON(Xr.sdk),security:ProjectSettingsSecurityFromJSON(Xr.security),networks:exists$1(Xr,"networks")?Xr.networks.map(NetworkConfigurationResponseFromJSON):void 0}}var PublishEventsEventsTypeEnum;(function(Xr){Xr.Track="track"})(PublishEventsEventsTypeEnum||(PublishEventsEventsTypeEnum={}));function PublishEventsEventsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{anonymousId:Xr.anonymousId,event:Xr.event,properties:Xr.properties,type:Xr.type}}function PublishEventsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{events:Xr.events.map(PublishEventsEventsToJSON)}}function RegisterEmbeddedWalletSessionKeyResponseFromJSON(Xr){return RegisterEmbeddedWalletSessionKeyResponseFromJSONTyped(Xr)}function RegisterEmbeddedWalletSessionKeyResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{publicKey:Xr.publicKey,expiresAt:Xr.expiresAt}}function RegisterSessionKeyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{publicKey:Xr.publicKey,prevSessionKeySignature:Xr.prevSessionKeySignature}}function ScanWebsiteUrlRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{url:Xr.url}}function ScanWebsiteUrlResponseFromJSON(Xr){return ScanWebsiteUrlResponseFromJSONTyped(Xr)}function ScanWebsiteUrlResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{isMalicious:Xr.isMalicious}}function NextJsSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{version:Xr.version}}function ReactSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{version:Xr.version}}function FrameworkSettingsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{react:ReactSettingsToJSON(Xr.react),nextjs:NextJsSettingsToJSON(Xr.nextjs)}}function SdkSettingsRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{dynamicContextProps:Xr.dynamicContextProps,dynamicWagmiSettings:Xr.dynamicWagmiSettings,frameworkSettings:FrameworkSettingsToJSON(Xr.frameworkSettings)}}function SimulateEVMTransactionRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chainId:Xr.chainId,data:Xr.data,from:Xr.from,to:Xr.to,value:Xr.value,domain:Xr.domain}}var SolanaChainType;(function(Xr){Xr.Mainnet="mainnet",Xr.Devnet="devnet"})(SolanaChainType||(SolanaChainType={}));function SolanaChainTypeToJSON(Xr){return Xr}function SimulateSVMTransactionRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{chain:Xr.chain,transactions:Xr.transactions,accountAddress:Xr.accountAddress,domain:Xr.domain,method:Xr.method}}function AssetFromJSON(Xr){return AssetFromJSONTyped(Xr)}function AssetFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,chainId:Xr.chainId,chainName:Xr.chainName,decimals:Xr.decimals,logoUrl:Xr.logoUrl,name:Xr.name,symbol:Xr.symbol,type:Xr.type}}function AssetTransferFromJSON(Xr){return AssetTransferFromJSONTyped(Xr)}function AssetTransferFromJSONTyped(Xr,eo){return Xr==null?Xr:{rawValue:exists$1(Xr,"rawValue")?Xr.rawValue:void 0,summary:exists$1(Xr,"summary")?Xr.summary:void 0,usdPrice:exists$1(Xr,"usdPrice")?Xr.usdPrice:void 0,value:exists$1(Xr,"value")?Xr.value:void 0}}function AssetDiffFromJSON(Xr){return AssetDiffFromJSONTyped(Xr)}function AssetDiffFromJSONTyped(Xr,eo){return Xr==null?Xr:{asset:AssetFromJSON(Xr.asset),transferIn:Xr.transferIn.map(AssetTransferFromJSON),transferOut:Xr.transferOut.map(AssetTransferFromJSON)}}function SimulateTransactionResponseFromJSON(Xr){return SimulateTransactionResponseFromJSONTyped(Xr)}function SimulateTransactionResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{inAssets:Xr.inAssets.map(AssetDiffFromJSON),outAssets:Xr.outAssets.map(AssetDiffFromJSON),counterparties:exists$1(Xr,"counterparties")?Xr.counterparties:void 0}}function SmsVerificationCreateRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{phoneCountryCode:Xr.phoneCountryCode,phoneNumber:Xr.phoneNumber,isoCountryCode:Xr.isoCountryCode,captchaToken:Xr.captchaToken}}function SmsVerificationCreateResponseFromJSON(Xr){return SmsVerificationCreateResponseFromJSONTyped(Xr)}function SmsVerificationCreateResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{verificationUUID:Xr.verificationUUID,phoneNumber:Xr.phoneNumber,phoneCountryCode:Xr.phoneCountryCode,isoCountryCode:Xr.isoCountryCode}}function SmsVerificationRetryRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,phoneCountryCode:Xr.phoneCountryCode,phoneNumber:Xr.phoneNumber,isoCountryCode:Xr.isoCountryCode,captchaToken:Xr.captchaToken}}function SmsVerificationVerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{verificationUUID:Xr.verificationUUID,verificationToken:Xr.verificationToken,captchaToken:Xr.captchaToken,sessionPublicKey:Xr.sessionPublicKey}}function SolanaTransactionOptimizationRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{transaction:Xr.transaction,address:Xr.address}}function SolanaTransactionOptimizationResponseFromJSON(Xr){return SolanaTransactionOptimizationResponseFromJSONTyped(Xr)}function SolanaTransactionOptimizationResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{transaction:Xr.transaction}}function OnrampConfigurationFromJSON(Xr){return OnrampConfigurationFromJSONTyped(Xr)}function OnrampConfigurationFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:exists$1(Xr,"provider")?ProviderEnumFromJSON(Xr.provider):void 0,name:exists$1(Xr,"name")?Xr.name:void 0,iconUrl:exists$1(Xr,"iconUrl")?Xr.iconUrl:void 0,url:exists$1(Xr,"url")?Xr.url:void 0}}function SupportedOnrampsResponseFromJSON(Xr){return SupportedOnrampsResponseFromJSONTyped(Xr)}function SupportedOnrampsResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{onramps:exists$1(Xr,"onramps")?Xr.onramps.map(OnrampConfigurationFromJSON):void 0}}function TelegramUserToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,firstName:Xr.firstName,lastName:Xr.lastName,hash:Xr.hash,photoURL:Xr.photoURL,username:Xr.username,authDate:Xr.authDate}}function TelegramPostRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{state:Xr.state,telegramUser:TelegramUserToJSON(Xr.telegramUser)}}function TokenBalanceFromJSON(Xr){return TokenBalanceFromJSONTyped(Xr)}function TokenBalanceFromJSONTyped(Xr,eo){return Xr==null?Xr:{networkId:exists$1(Xr,"networkId")?Xr.networkId:void 0,address:Xr.address,name:Xr.name,symbol:Xr.symbol,decimals:Xr.decimals,logoURI:Xr.logoURI,balance:Xr.balance,rawBalance:Xr.rawBalance,price:exists$1(Xr,"price")?Xr.price:void 0,marketValue:exists$1(Xr,"marketValue")?Xr.marketValue:void 0}}function TurnkeyWalletAccountFromJSON(Xr){return TurnkeyWalletAccountFromJSONTyped(Xr)}function TurnkeyWalletAccountFromJSONTyped(Xr,eo){return Xr==null?Xr:{curve:Xr.curve,pathFormat:Xr.pathFormat,path:Xr.path,addressFormat:Xr.addressFormat}}function TurnkeyCreateWalletAccountsRequestBodyParametersFromJSON(Xr){return TurnkeyCreateWalletAccountsRequestBodyParametersFromJSONTyped(Xr)}function TurnkeyCreateWalletAccountsRequestBodyParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletId:Xr.walletId,accounts:Xr.accounts.map(TurnkeyWalletAccountFromJSON)}}function TurnkeyCreateWalletAccountsRequestBodyFromJSON(Xr){return TurnkeyCreateWalletAccountsRequestBodyFromJSONTyped(Xr)}function TurnkeyCreateWalletAccountsRequestBodyFromJSONTyped(Xr,eo){return Xr==null?Xr:{organizationId:Xr.organizationId,parameters:TurnkeyCreateWalletAccountsRequestBodyParametersFromJSON(Xr.parameters),timestampMs:Xr.timestampMs,type:Xr.type}}function TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSON(Xr){return TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSONTyped(Xr)}function TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSONTyped(Xr,eo){return Xr==null?Xr:{walletIds:Xr.walletIds,deleteWithoutExport:exists$1(Xr,"deleteWithoutExport")?Xr.deleteWithoutExport:void 0}}function TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSON(Xr){return TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSONTyped(Xr)}function TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSONTyped(Xr,eo){return Xr==null?Xr:{organizationId:Xr.organizationId,parameters:TurnkeyDeleteEmbeddedWalletsRequestBodyParametersFromJSON(Xr.parameters),timestampMs:Xr.timestampMs,type:Xr.type}}var UnprocessableEntityErrorCode;(function(Xr){Xr.EmailAlreadyExists="email_already_exists",Xr.AllowlistAlreadyExists="allowlist_already_exists",Xr.AllowlistEntryAlreadyExists="allowlist_entry_already_exists",Xr.ReassignWalletError="reassign_wallet_error",Xr.ReassignWalletConfirm="reassign_wallet_confirm",Xr.MembersCannotDeleteThemself="members_cannot_delete_themself",Xr.UsernameAlreadyExists="username_already_exists",Xr.WrongEmailVerificationToken="wrong_email_verification_token",Xr.WrongSmsVerificationToken="wrong_sms_verification_token",Xr.InvalidEmailVerification="invalid_email_verification",Xr.InvalidSmsVerification="invalid_sms_verification",Xr.InvalidVerification="invalid_verification",Xr.InvalidPosition="invalid_position",Xr.TooManySmsVerificationAttempts="too_many_sms_verification_attempts",Xr.TooManyEmailVerificationAttempts="too_many_email_verification_attempts",Xr.TooManyVerificationAttempts="too_many_verification_attempts",Xr.OrganizationNameAlreadyExists="organization_name_already_exists",Xr.ProjectNameAlreadyExists="project_name_already_exists",Xr.WalletNotDeployed="wallet_not_deployed",Xr.EmailVerificationRequired="email_verification_required",Xr.PhoneVerificationRequired="phone_verification_required",Xr.InviteAddressRequired="invite_address_required",Xr.ProviderNotAvailable="provider_not_available",Xr.ForbiddenUnlinkRequest="forbidden_unlink_request",Xr.InvalidUnlinkRequest="invalid_unlink_request",Xr.TooManyApiTokens="too_many_api_tokens",Xr.LockTimeout="lock_timeout",Xr.LockTooManyAttempts="lock_too_many_attempts",Xr.NftTokenGatingNotSupportedForChain="nft_token_gating_not_supported_for_chain",Xr.EmptyChainName="empty_chain_name",Xr.NoEnabledEmailProvider="no_enabled_email_provider",Xr.NoEnabledSmsProvider="no_enabled_sms_provider",Xr.InvalidKeyExportUrl="invalid_key_export_url",Xr.InvalidDynamicProps="invalid_dynamic_props",Xr.TooManyRequests="too_many_requests",Xr.TooManyOrganizationsForUser="too_many_organizations_for_user",Xr.TooManyProjectsForOrganization="too_many_projects_for_organization",Xr.EmailAssociatedWithDifferentProvider="email_associated_with_different_provider",Xr.UserHasAlreadyAccountWithEmail="user_has_already_account_with_email",Xr.UserHasAlreadyAccountWithPhoneNumber="user_has_already_account_with_phone_number",Xr.OtherVerifyFailure="other_verify_failure",Xr.EmailTiedToEmbeddedWallet="email_tied_to_embedded_wallet",Xr.InvalidInvite="invalid_invite",Xr.SocialAccountAlreadyExists="social_account_already_exists",Xr.InvalidEmailAddress="invalid_email_address",Xr.InvalidGate="invalid_gate",Xr.ConflictingEmbeddedWalletProviders="conflicting_embedded_wallet_providers",Xr.InvalidUser="invalid_user",Xr.InvalidCorsOrigins="invalid_cors_origins",Xr.InvalidMobileDeeplinkUrls="invalid_mobile_deeplink_urls",Xr.UnauthorizedMobileDeeplinkUrl="unauthorized_mobile_deeplink_url",Xr.InvalidPrivateKeyFormat="invalid_private_key_format",Xr.InvalidEmbeddedWalletSettings="invalid_embedded_wallet_settings",Xr.WalletNotSupportPasskey="wallet_not_support_passkey",Xr.RecoveryEmailUnavailableOrInvalid="recovery_email_unavailable_or_invalid",Xr.ConnectError="connect_error",Xr.InvalidWalletName="invalid_wallet_name",Xr.InvalidWalletAddress="invalid_wallet_address",Xr.EmailRecoveryDisabled="email_recovery_disabled",Xr.NoCompatibleWalletServiceEnabled="no_compatible_wallet_service_enabled",Xr.MissingAaProjectId="missing_aa_project_id",Xr.LinkedEmbeddedWallet="linked_embedded_wallet",Xr.InvalidMpcEnvironment="invalid_mpc_environment",Xr.InvalidRegex="invalid_regex",Xr.RepeatedOptions="repeated_options",Xr.MissingPhoneNumberOrEmail="missing_phone_number_or_email",Xr.DuplicateExists="duplicate_exists",Xr.MfaDeviceNotFound="mfa_device_not_found",Xr.MfaInvalidCode="mfa_invalid_code",Xr.MfaInvalidRequest="mfa_invalid_request",Xr.InvalidPhone="invalid_phone",Xr.GateExists="gate_exists",Xr.InvalidEmbeddedWalletChainsConfiguration="invalid_embedded_wallet_chains_configuration",Xr.MergeAccountsConfirmation="merge_accounts_confirmation",Xr.MergeAccountsInvalid="merge_accounts_invalid",Xr.InvalidWalletId="invalid_wallet_id",Xr.UnableToFetchBalances="unable_to_fetch_balances",Xr.CannotSwitchToUnique="cannot_switch_to_unique",Xr.CustomFieldDataNotUnique="custom_field_data_not_unique",Xr.MetadataSizeExceeded="metadata_size_exceeded",Xr.InvalidCustomHostname="invalid_custom_hostname",Xr.BlockedUserCannotTransferWallet="blocked_user_cannot_transfer_wallet",Xr.FeatureNotEnabledInSuborg="feature_not_enabled_in_suborg",Xr.InvalidUsername="invalid_username",Xr.InvalidExternalAuth="invalid_external_auth",Xr.InvalidChainAddressMatch="invalid_chain_address_match",Xr.InvalidUpdate="invalid_update",Xr.CannotDeleteLastProject="cannot_delete_last_project",Xr.NoHdWalletFound="no_hd_wallet_found",Xr.WalletAccountExistsForChain="wallet_account_exists_for_chain",Xr.TooManyEmbeddedWalletsForUser="too_many_embedded_wallets_for_user",Xr.TooManyEmbeddedWalletsPerChainForUser="too_many_embedded_wallets_per_chain_for_user",Xr.InvalidSessionPublicKey="invalid_session_public_key"})(UnprocessableEntityErrorCode||(UnprocessableEntityErrorCode={}));function UpdateRecoveryEmailRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{turnkeySignedRequest:TurnkeySignedRequestToJSON(Xr.turnkeySignedRequest)}}function UpdateSelfResponseFromJSON(Xr){return UpdateSelfResponseFromJSONTyped(Xr)}function UpdateSelfResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{mfaToken:exists$1(Xr,"mfaToken")?Xr.mfaToken:void 0,jwt:exists$1(Xr,"jwt")?Xr.jwt:void 0,user:SdkUserFromJSON(Xr.user),minifiedJwt:exists$1(Xr,"minifiedJwt")?Xr.minifiedJwt:void 0,expiresAt:Xr.expiresAt,nextView:NextViewEnumFromJSON(Xr.nextView),emailVerification:exists$1(Xr,"emailVerification")?EmailVerificationCreateResponseFromJSON(Xr.emailVerification):void 0,smsVerification:exists$1(Xr,"smsVerification")?SmsVerificationCreateResponseFromJSON(Xr.smsVerification):void 0}}function UpdateUserPasskeyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{id:Xr.id,alias:Xr.alias}}function UserFieldsToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{email:Xr.email,alias:Xr.alias,firstName:Xr.firstName,lastName:Xr.lastName,jobTitle:Xr.jobTitle,phoneNumber:Xr.phoneNumber,tShirtSize:Xr.tShirtSize,team:Xr.team,policiesConsent:Xr.policiesConsent,country:Xr.country,username:Xr.username,captchaToken:Xr.captchaToken,metadata:Xr.metadata,mfaBackupCodeAcknowledgement:Xr.mfaBackupCodeAcknowledgement,btcWallet:Xr.btcWallet,kdaWallet:Xr.kdaWallet,ltcWallet:Xr.ltcWallet,ckbWallet:Xr.ckbWallet,kasWallet:Xr.kasWallet,dogeWallet:Xr.dogeWallet,emailNotification:Xr.emailNotification,discordNotification:Xr.discordNotification,newsletterNotification:Xr.newsletterNotification}}function UserWalletSelectionRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId}}function OauthProviderRequestFromJSON(Xr){return OauthProviderRequestFromJSONTyped(Xr)}function OauthProviderRequestFromJSONTyped(Xr,eo){return Xr==null?Xr:{provider:exists$1(Xr,"provider")?ProviderEnumFromJSON(Xr.provider):void 0,accessToken:exists$1(Xr,"accessToken")?Xr.accessToken:void 0,didToken:exists$1(Xr,"didToken")?Xr.didToken:void 0}}function OauthProviderRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{provider:Xr.provider,accessToken:Xr.accessToken,didToken:Xr.didToken}}function VerifyRequestFromJSON(Xr){return VerifyRequestFromJSONTyped(Xr)}function VerifyRequestFromJSONTyped(Xr,eo){return Xr==null?Xr:{oauth:exists$1(Xr,"oauth")?OauthProviderRequestFromJSON(Xr.oauth):void 0,signedMessage:Xr.signedMessage,messageToSign:Xr.messageToSign,publicWalletAddress:Xr.publicWalletAddress,chain:ChainEnumFromJSON(Xr.chain),walletName:Xr.walletName,walletProvider:WalletProviderEnumFromJSON(Xr.walletProvider),skipEmptyAccountCheck:exists$1(Xr,"skipEmptyAccountCheck")?Xr.skipEmptyAccountCheck:void 0,captchaToken:exists$1(Xr,"captchaToken")?Xr.captchaToken:void 0,network:exists$1(Xr,"network")?Xr.network:void 0,additionalWalletAddresses:exists$1(Xr,"additionalWalletAddresses")?Xr.additionalWalletAddresses.map(WalletAdditionalAddressFromJSON):void 0,backup:exists$1(Xr,"backup")?Xr.backup:void 0,password:exists$1(Xr,"password")?Xr.password:void 0,passwordSource:exists$1(Xr,"passwordSource")?PasswordSourceTypeEnumFromJSON(Xr.passwordSource):void 0,sessionPublicKey:exists$1(Xr,"sessionPublicKey")?Xr.sessionPublicKey:void 0}}function VerifyRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{oauth:OauthProviderRequestToJSON(Xr.oauth),signedMessage:Xr.signedMessage,messageToSign:Xr.messageToSign,publicWalletAddress:Xr.publicWalletAddress,chain:Xr.chain,walletName:Xr.walletName,walletProvider:Xr.walletProvider,skipEmptyAccountCheck:Xr.skipEmptyAccountCheck,captchaToken:Xr.captchaToken,network:Xr.network,additionalWalletAddresses:Xr.additionalWalletAddresses===void 0?void 0:Xr.additionalWalletAddresses.map(WalletAdditionalAddressToJSON),backup:Xr.backup,password:Xr.password,passwordSource:Xr.passwordSource,sessionPublicKey:Xr.sessionPublicKey}}function VerifyResponseFromJSON(Xr){return VerifyResponseFromJSONTyped(Xr)}function VerifyResponseFromJSONTyped(Xr,eo){return Xr==null?Xr:{mfaToken:exists$1(Xr,"mfaToken")?Xr.mfaToken:void 0,jwt:exists$1(Xr,"jwt")?Xr.jwt:void 0,user:SdkUserFromJSON(Xr.user),minifiedJwt:exists$1(Xr,"minifiedJwt")?Xr.minifiedJwt:void 0,expiresAt:Xr.expiresAt}}function VerifyUnlinkRequestToJSON(Xr){if(Xr!==void 0)return Xr===null?null:{walletId:Xr.walletId,verifiedCrentialId:Xr.verifiedCrentialId,primaryWalletId:Xr.primaryWalletId}}class SDKApi extends BaseAPI{authMfaPasskeyDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDevice.");if(eo.mFAAuthPasskeyDevicePostRequest===null||eo.mFAAuthPasskeyDevicePostRequest===void 0)throw new RequiredError("mFAAuthPasskeyDevicePostRequest","Required parameter requestParameters.mFAAuthPasskeyDevicePostRequest was null or undefined when calling authMfaPasskeyDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthPasskeyDevicePostRequestToJSON(eo.mFAAuthPasskeyDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaPasskeyDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaPasskeyDeviceRaw(eo,to)).value()})}authMfaPasskeyDeviceChallengeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDeviceChallenge.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAAuthPasskeyDeviceGetResponseFromJSON(oo))})}authMfaPasskeyDeviceChallenge(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaPasskeyDeviceChallengeRaw(eo,to)).value()})}authMfaPasskeyDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaPasskeyDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaPasskeyDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaPasskeyDeviceOptionsRaw(eo,to)})}authMfaRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaRecovery.");if(eo.mFAAuthRecoveryDevicePostRequest===null||eo.mFAAuthRecoveryDevicePostRequest===void 0)throw new RequiredError("mFAAuthRecoveryDevicePostRequest","Required parameter requestParameters.mFAAuthRecoveryDevicePostRequest was null or undefined when calling authMfaRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthRecoveryDevicePostRequestToJSON(eo.mFAAuthRecoveryDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaRecoveryRaw(eo,to)).value()})}authMfaRecoveryOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaRecoveryOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaRecoveryOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaRecoveryOptionsRaw(eo,to)})}authMfaTotpDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaTotpDevice.");if(eo.mFAAuthTotpDevicePostRequest===null||eo.mFAAuthTotpDevicePostRequest===void 0)throw new RequiredError("mFAAuthTotpDevicePostRequest","Required parameter requestParameters.mFAAuthTotpDevicePostRequest was null or undefined when calling authMfaTotpDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFAAuthTotpDevicePostRequestToJSON(eo.mFAAuthTotpDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}authMfaTotpDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.authMfaTotpDeviceRaw(eo,to)).value()})}authMfaTotpDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling authMfaTotpDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/auth/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}authMfaTotpDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.authMfaTotpDeviceOptionsRaw(eo,to)})}claimEmbeddedWalletRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling claimEmbeddedWallet.");if(eo.embeddedWalletPasscodeClaimRequest===null||eo.embeddedWalletPasscodeClaimRequest===void 0)throw new RequiredError("embeddedWalletPasscodeClaimRequest","Required parameter requestParameters.embeddedWalletPasscodeClaimRequest was null or undefined when calling claimEmbeddedWallet.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode/claim".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:EmbeddedWalletPasscodeClaimRequestToJSON(eo.embeddedWalletPasscodeClaimRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}claimEmbeddedWallet(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.claimEmbeddedWalletRaw(eo,to)).value()})}claimEmbeddedWalletOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling claimEmbeddedWalletOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode/claim".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}claimEmbeddedWalletOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.claimEmbeddedWalletOptionsRaw(eo,to)})}completePasskeyRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling completePasskeyRecovery.");if(eo.completePasskeyRecoveryRequest===null||eo.completePasskeyRecoveryRequest===void 0)throw new RequiredError("completePasskeyRecoveryRequest","Required parameter requestParameters.completePasskeyRecoveryRequest was null or undefined when calling completePasskeyRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:CompletePasskeyRecoveryRequestToJSON(eo.completePasskeyRecoveryRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}completePasskeyRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.completePasskeyRecoveryRaw(eo,to)).value()})}createEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmailVerification.");if(eo.emailVerificationCreateRequest===null||eo.emailVerificationCreateRequest===void 0)throw new RequiredError("emailVerificationCreateRequest","Required parameter requestParameters.emailVerificationCreateRequest was null or undefined when calling createEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationCreateRequestToJSON(eo.emailVerificationCreateRequest)},to);return new JSONApiResponse(io,oo=>EmailVerificationCreateResponseFromJSON(oo))})}createEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createEmailVerificationRaw(eo,to)).value()})}createEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createEmailVerificationOptionsRaw(eo,to)})}createEmbeddedWalletsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmbeddedWallets.");if(eo.createEmbeddedWalletsRequest===null||eo.createEmbeddedWalletsRequest===void 0)throw new RequiredError("createEmbeddedWalletsRequest","Required parameter requestParameters.createEmbeddedWalletsRequest was null or undefined when calling createEmbeddedWallets.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:CreateEmbeddedWalletsRequestToJSON(eo.createEmbeddedWalletsRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}createEmbeddedWallets(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createEmbeddedWalletsRaw(eo,to)).value()})}createEmbeddedWalletsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createEmbeddedWalletsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createEmbeddedWalletsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createEmbeddedWalletsOptionsRaw(eo,to)})}createNewRecoveryCodesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createNewRecoveryCodes.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegenRecoveryCodesResponseFromJSON(oo))})}createNewRecoveryCodes(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createNewRecoveryCodesRaw(eo,to)).value()})}createSmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createSmsVerification.");if(eo.smsVerificationCreateRequest===null||eo.smsVerificationCreateRequest===void 0)throw new RequiredError("smsVerificationCreateRequest","Required parameter requestParameters.smsVerificationCreateRequest was null or undefined when calling createSmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationCreateRequestToJSON(eo.smsVerificationCreateRequest)},to);return new JSONApiResponse(io,oo=>SmsVerificationCreateResponseFromJSON(oo))})}createSmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createSmsVerificationRaw(eo,to)).value()})}createSmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createSmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/create".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}createSmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createSmsVerificationOptionsRaw(eo,to)})}createVisitRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createVisit.");if(eo.connectRequest===null||eo.connectRequest===void 0)throw new RequiredError("connectRequest","Required parameter requestParameters.connectRequest was null or undefined when calling createVisit.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/connect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ConnectRequestToJSON(eo.connectRequest)},to);return new VoidApiResponse(io)})}createVisit(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.createVisitRaw(eo,to)})}createWalletAccountRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling createWalletAccount.");if(eo.createWalletAccountRequest===null||eo.createWalletAccountRequest===void 0)throw new RequiredError("createWalletAccountRequest","Required parameter requestParameters.createWalletAccountRequest was null or undefined when calling createWalletAccount.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:CreateWalletAccountRequestToJSON(eo.createWalletAccountRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}createWalletAccount(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.createWalletAccountRaw(eo,to)).value()})}deleteEmbeddedWalletsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling deleteEmbeddedWallets.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"DELETE",headers:no,query:ro,body:DeleteEmbeddedWalletsRequestToJSON(eo.deleteEmbeddedWalletsRequest)},to);return new VoidApiResponse(io)})}deleteEmbeddedWallets(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.deleteEmbeddedWalletsRaw(eo,to)})}deleteMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling deleteMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling deleteMfaDevice.");if(eo.xMfaAuthToken===null||eo.xMfaAuthToken===void 0)throw new RequiredError("xMfaAuthToken","Required parameter requestParameters.xMfaAuthToken was null or undefined when calling deleteMfaDevice.");const ro={},no={};if(eo.xMfaAuthToken!==void 0&&eo.xMfaAuthToken!==null&&(no["x-mfa-auth-token"]=String(eo.xMfaAuthToken)),this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"DELETE",headers:no,query:ro},to);return new VoidApiResponse(io)})}deleteMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.deleteMfaDeviceRaw(eo,to)})}emailAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling emailAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/emailAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}emailAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.emailAuthOptionsRaw(eo,to)})}emailProviderOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling emailProviderOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailProvider".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}emailProviderOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.emailProviderOptionsRaw(eo,to)})}embeddedWalletDeleteRequestOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletDeleteRequestOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/deleteRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}embeddedWalletDeleteRequestOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.embeddedWalletDeleteRequestOptionsRaw(eo,to)})}embeddedWalletExportRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletExport.");if(eo.walletId===null||eo.walletId===void 0)throw new RequiredError("walletId","Required parameter requestParameters.walletId was null or undefined when calling embeddedWalletExport.");if(eo.activityId===null||eo.activityId===void 0)throw new RequiredError("activityId","Required parameter requestParameters.activityId was null or undefined when calling embeddedWalletExport.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/{walletId}/activities/{activityId}/export".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{walletId}",encodeURIComponent(String(eo.walletId))).replace("{activityId}",encodeURIComponent(String(eo.activityId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>ExportEmbeddedWalletResponseFromJSON(oo))})}embeddedWalletExport(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.embeddedWalletExportRaw(eo,to)).value()})}embeddedWalletExportOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling embeddedWalletExportOptions.");if(eo.walletId===null||eo.walletId===void 0)throw new RequiredError("walletId","Required parameter requestParameters.walletId was null or undefined when calling embeddedWalletExportOptions.");if(eo.activityId===null||eo.activityId===void 0)throw new RequiredError("activityId","Required parameter requestParameters.activityId was null or undefined when calling embeddedWalletExportOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/{walletId}/activities/{activityId}/export".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{walletId}",encodeURIComponent(String(eo.walletId))).replace("{activityId}",encodeURIComponent(String(eo.activityId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}embeddedWalletExportOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.embeddedWalletExportOptionsRaw(eo,to)})}eventsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling eventsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/events".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}eventsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.eventsOptionsRaw(eo,to)})}externalAuthSigninRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthSignin.");if(eo.externalAuthSigninRequest===null||eo.externalAuthSigninRequest===void 0)throw new RequiredError("externalAuthSigninRequest","Required parameter requestParameters.externalAuthSigninRequest was null or undefined when calling externalAuthSignin.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/externalAuth/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ExternalAuthSigninRequestToJSON(eo.externalAuthSigninRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}externalAuthSignin(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.externalAuthSigninRaw(eo,to)).value()})}externalAuthSigninOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthSigninOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/externalAuth/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}externalAuthSigninOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.externalAuthSigninOptionsRaw(eo,to)})}externalAuthVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthVerify.");if(eo.externalAuthSigninRequest===null||eo.externalAuthSigninRequest===void 0)throw new RequiredError("externalAuthSigninRequest","Required parameter requestParameters.externalAuthSigninRequest was null or undefined when calling externalAuthVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/externalAuth/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ExternalAuthSigninRequestToJSON(eo.externalAuthSigninRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}externalAuthVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.externalAuthVerifyRaw(eo,to)).value()})}externalAuthVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling externalAuthVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/externalAuth/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}externalAuthVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.externalAuthVerifyOptionsRaw(eo,to)})}farcasterSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/farcaster/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:FarcasterSignInRequestToJSON(eo.farcasterSignInRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}farcasterSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.farcasterSignInRaw(eo,to)).value()})}farcasterSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/farcaster/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}farcasterSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.farcasterSignInOptionsRaw(eo,to)})}farcasterVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/farcaster/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:FarcasterSignInRequestToJSON(eo.farcasterSignInRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}farcasterVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.farcasterVerifyRaw(eo,to)).value()})}farcasterVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling farcasterVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/farcaster/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}farcasterVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.farcasterVerifyOptionsRaw(eo,to)})}getAccountBalancesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAccountBalances.");if(eo.chainName===null||eo.chainName===void 0)throw new RequiredError("chainName","Required parameter requestParameters.chainName was null or undefined when calling getAccountBalances.");if(eo.accountAddress===null||eo.accountAddress===void 0)throw new RequiredError("accountAddress","Required parameter requestParameters.accountAddress was null or undefined when calling getAccountBalances.");const ro={};eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.accountAddress!==void 0&&(ro.accountAddress=eo.accountAddress),eo.includePrices!==void 0&&(ro.includePrices=eo.includePrices),eo.includeNative!==void 0&&(ro.includeNative=eo.includeNative);const no={},io=yield this.request({path:"/sdk/{environmentId}/chains/{chainName}/balances".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{chainName}",encodeURIComponent(String(eo.chainName))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>oo.map(TokenBalanceFromJSON))})}getAccountBalances(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAccountBalancesRaw(eo,to)).value()})}getAccountBalancesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAccountBalancesOptions.");if(eo.chainName===null||eo.chainName===void 0)throw new RequiredError("chainName","Required parameter requestParameters.chainName was null or undefined when calling getAccountBalancesOptions.");if(eo.networkId===null||eo.networkId===void 0)throw new RequiredError("networkId","Required parameter requestParameters.networkId was null or undefined when calling getAccountBalancesOptions.");if(eo.accountAddress===null||eo.accountAddress===void 0)throw new RequiredError("accountAddress","Required parameter requestParameters.accountAddress was null or undefined when calling getAccountBalancesOptions.");const ro={};eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.accountAddress!==void 0&&(ro.accountAddress=eo.accountAddress);const no={},io=yield this.request({path:"/sdk/{environmentId}/chains/{chainName}/balances".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{chainName}",encodeURIComponent(String(eo.chainName))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getAccountBalancesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getAccountBalancesOptionsRaw(eo,to)})}getAuthTokenRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthToken.");const ro={};eo.type!==void 0&&(ro.type=eo.type);const no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/authToken".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletAuthTokenFromJSON(oo))})}getAuthToken(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAuthTokenRaw(eo,to)).value()})}getAuthTokenOptsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthTokenOpts.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/authToken".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getAuthTokenOpts(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getAuthTokenOptsRaw(eo,to)})}getAuthenticatedUserRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getAuthenticatedUser.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>SdkUserFromJSON(oo))})}getAuthenticatedUser(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getAuthenticatedUserRaw(eo,to)).value()})}getCreateWalletAccountRequestRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getCreateWalletAccountRequest.");if(eo.chain===null||eo.chain===void 0)throw new RequiredError("chain","Required parameter requestParameters.chain was null or undefined when calling getCreateWalletAccountRequest.");const ro={};eo.chain!==void 0&&(ro.chain=eo.chain);const no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts/createRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>TurnkeyCreateWalletAccountsRequestBodyFromJSON(oo))})}getCreateWalletAccountRequest(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getCreateWalletAccountRequestRaw(eo,to)).value()})}getEmailProviderRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmailProvider.");if(eo.email===null||eo.email===void 0)throw new RequiredError("email","Required parameter requestParameters.email was null or undefined when calling getEmailProvider.");const ro={};eo.email!==void 0&&(ro.email=eo.email);const no={},io=yield this.request({path:"/sdk/{environmentId}/emailProvider".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmailProviderResponseFromJSON(oo))})}getEmailProvider(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmailProviderRaw(eo,to)).value()})}getEmbeddedWalletBackupOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletBackupOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/backup".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getEmbeddedWalletBackupOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getEmbeddedWalletBackupOptionRaw(eo,to)})}getEmbeddedWalletBackupsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletBackups.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/backup".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletSecretFromJSON(oo))})}getEmbeddedWalletBackups(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletBackupsRaw(eo,to)).value()})}getEmbeddedWalletPasscodeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletPasscode.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>EmbeddedWalletSecretFromJSON(oo))})}getEmbeddedWalletPasscode(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletPasscodeRaw(eo,to)).value()})}getEmbeddedWalletPasscodeOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletPasscodeOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passcode".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getEmbeddedWalletPasscodeOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getEmbeddedWalletPasscodeOptionRaw(eo,to)})}getEmbeddedWalletsDeleteRequestRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEmbeddedWalletsDeleteRequest.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/deleteRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>TurnkeyDeleteEmbeddedWalletsRequestBodyFromJSON(oo))})}getEmbeddedWalletsDeleteRequest(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEmbeddedWalletsDeleteRequestRaw(eo,to)).value()})}getEnvironmentSettingsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getEnvironmentSettings.");const ro={};eo.sdkVersion!==void 0&&(ro.sdkVersion=eo.sdkVersion);const no={},io=yield this.request({path:"/sdk/{environmentId}/settings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>ProjectSettingsFromJSON(oo))})}getEnvironmentSettings(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getEnvironmentSettingsRaw(eo,to)).value()})}getHealthcheckRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getHealthcheck.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/healthcheck".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>HealthcheckResponseFromJSON(oo))})}getHealthcheck(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getHealthcheckRaw(eo,to)).value()})}getHealthcheckOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getHealthcheckOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/healthcheck".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getHealthcheckOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getHealthcheckOptionsRaw(eo,to)})}getJwksByEnvironmentIdRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getJwksByEnvironmentId.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/.well-known/jwks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>JwksResponseFromJSON(oo))})}getJwksByEnvironmentId(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getJwksByEnvironmentIdRaw(eo,to)).value()})}getMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling getMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFADeviceFromJSON(oo))})}getMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getMfaDeviceRaw(eo,to)).value()})}getMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getMfaDeviceOptions.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling getMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}getMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.getMfaDeviceOptionsRaw(eo,to)})}getNetworksConfigurationByEnvIdRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getNetworksConfigurationByEnvId.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/networks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>oo.map(NetworkConfigurationResponseFromJSON))})}getNetworksConfigurationByEnvId(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getNetworksConfigurationByEnvIdRaw(eo,to)).value()})}getNonceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getNonce.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/nonce".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>NonceResponseFromJSON(oo))})}getNonce(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getNonceRaw(eo,to)).value()})}getRecoveryCodesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getRecoveryCodes.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAGetRecoveryCodesResponseFromJSON(oo))})}getRecoveryCodes(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getRecoveryCodesRaw(eo,to)).value()})}getSupportedOnrampsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getSupportedOnramps.");if(eo.walletAddress===null||eo.walletAddress===void 0)throw new RequiredError("walletAddress","Required parameter requestParameters.walletAddress was null or undefined when calling getSupportedOnramps.");if(eo.chain===null||eo.chain===void 0)throw new RequiredError("chain","Required parameter requestParameters.chain was null or undefined when calling getSupportedOnramps.");const ro={};eo.walletAddress!==void 0&&(ro.walletAddress=eo.walletAddress),eo.chain!==void 0&&(ro.chain=eo.chain),eo.networkId!==void 0&&(ro.networkId=eo.networkId),eo.token!==void 0&&(ro.token=eo.token);const no={},io=yield this.request({path:"/sdk/{environmentId}/onramps".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>SupportedOnrampsResponseFromJSON(oo))})}getSupportedOnramps(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getSupportedOnrampsRaw(eo,to)).value()})}getTelegramAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getTelegramAuth.");if(eo.state===null||eo.state===void 0)throw new RequiredError("state","Required parameter requestParameters.state was null or undefined when calling getTelegramAuth.");const ro={};eo.state!==void 0&&(ro.state=eo.state);const no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}getTelegramAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getTelegramAuthRaw(eo,to)).value()})}getUserMfaDevicesRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getUserMfaDevices.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFAListDevicesResponseFromJSON(oo))})}getUserMfaDevices(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getUserMfaDevicesRaw(eo,to)).value()})}getUserPasskeysRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling getUserPasskeys.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>GetUserPasskeysResponseFromJSON(oo))})}getUserPasskeys(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.getUserPasskeysRaw(eo,to)).value()})}initAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initAuth.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling initAuth.");if(eo.oauthInitAuthRequest===null||eo.oauthInitAuthRequest===void 0)throw new RequiredError("oauthInitAuthRequest","Required parameter requestParameters.oauthInitAuthRequest was null or undefined when calling initAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/initAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthInitAuthRequestToJSON(eo.oauthInitAuthRequest)},to);return new VoidApiResponse(io)})}initAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.initAuthRaw(eo,to)})}initAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initAuthOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling initAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/initAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}initAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.initAuthOptionsRaw(eo,to)})}initEmailAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initEmailAuth.");if(eo.initEmailAuthRequest===null||eo.initEmailAuthRequest===void 0)throw new RequiredError("initEmailAuthRequest","Required parameter requestParameters.initEmailAuthRequest was null or undefined when calling initEmailAuth.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/emailAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:InitEmailAuthRequestToJSON(eo.initEmailAuthRequest)},to);return new JSONApiResponse(io,oo=>InitEmailAuthResponseFromJSON(oo))})}initEmailAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.initEmailAuthRaw(eo,to)).value()})}initPasskeyRecoveryRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling initPasskeyRecovery.");if(eo.initPasskeyRecoveryRequest===null||eo.initPasskeyRecoveryRequest===void 0)throw new RequiredError("initPasskeyRecoveryRequest","Required parameter requestParameters.initPasskeyRecoveryRequest was null or undefined when calling initPasskeyRecovery.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:InitPasskeyRecoveryRequestToJSON(eo.initPasskeyRecoveryRequest)},to);return new JSONApiResponse(io,oo=>InitPasskeyRecoveryResponseFromJSON(oo))})}initPasskeyRecovery(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.initPasskeyRecoveryRaw(eo,to)).value()})}jwksOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling jwksOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/.well-known/jwks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}jwksOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.jwksOptionsRaw(eo,to)})}listMfaDevicesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling listMfaDevicesOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}listMfaDevicesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.listMfaDevicesOptionsRaw(eo,to)})}logDynamicSdkSettingsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling logDynamicSdkSettings.");if(eo.sdkSettingsRequest===null||eo.sdkSettingsRequest===void 0)throw new RequiredError("sdkSettingsRequest","Required parameter requestParameters.sdkSettingsRequest was null or undefined when calling logDynamicSdkSettings.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/sdkSettings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SdkSettingsRequestToJSON(eo.sdkSettingsRequest)},to);return new VoidApiResponse(io)})}logDynamicSdkSettings(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.logDynamicSdkSettingsRaw(eo,to)})}mergeUsersRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling mergeUsers.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}mergeUsers(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.mergeUsersRaw(eo,to)).value()})}mergeUsersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling mergeUsersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}mergeUsersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.mergeUsersOptionsRaw(eo,to)})}networksOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling networksOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/networks".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}networksOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.networksOptionsRaw(eo,to)})}nonceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling nonceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/nonce".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}nonceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.nonceOptionsRaw(eo,to)})}oauthAuthorizeHtmlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthAuthorizeHtml.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthAuthorizeHtml.");const ro={};eo.scope!==void 0&&(ro.scope=eo.scope),eo.state!==void 0&&(ro.state=eo.state),eo.redirectUri!==void 0&&(ro.redirect_uri=eo.redirectUri);const no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/authorizeHtml".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}oauthAuthorizeHtml(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthAuthorizeHtmlRaw(eo,to)).value()})}oauthAuthorizeHtmlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthAuthorizeHtmlOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthAuthorizeHtmlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/authorizeHtml".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthAuthorizeHtmlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthAuthorizeHtmlOptionsRaw(eo,to)})}oauthLoginRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLogin.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLogin.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/login".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLogin(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginRaw(eo,to)})}oauthLoginOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/login".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLoginOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginOptionsRaw(eo,to)})}oauthLoginUrlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginUrl.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginUrl.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/loginUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>OauthProviderLoginUrlFromJSON(oo))})}oauthLoginUrl(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthLoginUrlRaw(eo,to)).value()})}oauthLoginUrlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthLoginUrlOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthLoginUrlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/loginUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthLoginUrlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthLoginUrlOptionsRaw(eo,to)})}oauthRedirectAppleRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectApple.");const ro={},no={};canConsumeForm([{contentType:"application/x-www-form-urlencoded"}]);let oo;oo=new URLSearchParams,eo.code!==void 0&&oo.append("code",eo.code),eo.state!==void 0&&oo.append("state",eo.state),eo.idToken!==void 0&&oo.append("id_token",eo.idToken),eo.error!==void 0&&oo.append("error",eo.error);const ao=yield this.request({path:"/sdk/{environmentId}/providers/apple/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:oo},to);return new TextApiResponse(ao)})}oauthRedirectApple(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthRedirectAppleRaw(eo,to)).value()})}oauthRedirectAppleOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectAppleOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/apple/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthRedirectAppleOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthRedirectAppleOptionsRaw(eo,to)})}oauthRedirectCodeRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectCode.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthRedirectCode.");const ro={};eo.code!==void 0&&(ro.code=eo.code),eo.scope!==void 0&&(ro.scope=eo.scope),eo.state!==void 0&&(ro.state=eo.state),eo.authuser!==void 0&&(ro.authuser=eo.authuser),eo.prompt!==void 0&&(ro.prompt=eo.prompt),eo.error!==void 0&&(ro.error=eo.error);const no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"GET",headers:no,query:ro},to);return new TextApiResponse(io)})}oauthRedirectCode(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthRedirectCodeRaw(eo,to)).value()})}oauthRedirectOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthRedirectOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthRedirectOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/redirect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthRedirectOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthRedirectOptionsRaw(eo,to)})}oauthResultRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthResult.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthResult.");if(eo.oauthResultRequest===null||eo.oauthResultRequest===void 0)throw new RequiredError("oauthResultRequest","Required parameter requestParameters.oauthResultRequest was null or undefined when calling oauthResult.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/oauthResult".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>OauthResultResponseFromJSON(oo))})}oauthResult(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthResultRaw(eo,to)).value()})}oauthResultOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthResultOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthResultOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/oauthResult".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthResultOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthResultOptionsRaw(eo,to)})}oauthSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthSignIn.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthSignIn.");if(eo.oauthRequest===null||eo.oauthRequest===void 0)throw new RequiredError("oauthRequest","Required parameter requestParameters.oauthRequest was null or undefined when calling oauthSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/signIn".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthRequestToJSON(eo.oauthRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}oauthSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthSignInRaw(eo,to)).value()})}oauthSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthSignInOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/signIn".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthSignInOptionsRaw(eo,to)})}oauthVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthVerify.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthVerify.");if(eo.oauthRequest===null||eo.oauthRequest===void 0)throw new RequiredError("oauthRequest","Required parameter requestParameters.oauthRequest was null or undefined when calling oauthVerify.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"POST",headers:no,query:ro,body:OauthRequestToJSON(eo.oauthRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}oauthVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.oauthVerifyRaw(eo,to)).value()})}oauthVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling oauthVerifyOptions.");if(eo.providerType===null||eo.providerType===void 0)throw new RequiredError("providerType","Required parameter requestParameters.providerType was null or undefined when calling oauthVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/providers/{providerType}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{providerType}",encodeURIComponent(String(eo.providerType))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}oauthVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.oauthVerifyOptionsRaw(eo,to)})}onrampsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling onrampsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/onramps".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}onrampsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.onrampsOptionsRaw(eo,to)})}optimizeTransactionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optimizeTransaction.");if(eo.solanaTransactionOptimizationRequest===null||eo.solanaTransactionOptimizationRequest===void 0)throw new RequiredError("solanaTransactionOptimizationRequest","Required parameter requestParameters.solanaTransactionOptimizationRequest was null or undefined when calling optimizeTransaction.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/solana/optimizeTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SolanaTransactionOptimizationRequestToJSON(eo.solanaTransactionOptimizationRequest)},to);return new JSONApiResponse(io,oo=>SolanaTransactionOptimizationResponseFromJSON(oo))})}optimizeTransaction(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.optimizeTransactionRaw(eo,to)).value()})}optimizeTransactionOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optimizeTransactionOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/solana/optimizeTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}optimizeTransactionOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.optimizeTransactionOptionsRaw(eo,to)})}optionsConnectRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling optionsConnect.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/connect".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}optionsConnect(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.optionsConnectRaw(eo,to)})}passkeyRecoveryOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling passkeyRecoveryOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/passkeyRecovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}passkeyRecoveryOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.passkeyRecoveryOptionsRaw(eo,to)})}postTelegramAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling postTelegramAuth.");if(eo.telegramPostRequest===null||eo.telegramPostRequest===void 0)throw new RequiredError("telegramPostRequest","Required parameter requestParameters.telegramPostRequest was null or undefined when calling postTelegramAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:TelegramPostRequestToJSON(eo.telegramPostRequest)},to);return new VoidApiResponse(io)})}postTelegramAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.postTelegramAuthRaw(eo,to)})}prefetchRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling prefetch.");if(eo.prefetchRequest===null||eo.prefetchRequest===void 0)throw new RequiredError("prefetchRequest","Required parameter requestParameters.prefetchRequest was null or undefined when calling prefetch.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/prefetch".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:PrefetchRequestToJSON(eo.prefetchRequest)},to);return new VoidApiResponse(io)})}prefetch(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.prefetchRaw(eo,to)})}publishEventRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling publishEvent.");if(eo.publishEvents===null||eo.publishEvents===void 0)throw new RequiredError("publishEvents","Required parameter requestParameters.publishEvents was null or undefined when calling publishEvent.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/events".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:PublishEventsToJSON(eo.publishEvents)},to);return new VoidApiResponse(io)})}publishEvent(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.publishEventRaw(eo,to)})}recoveryCodesOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling recoveryCodesOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/recovery".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}recoveryCodesOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.recoveryCodesOptionsRaw(eo,to)})}recoveryEmailOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling recoveryEmailOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/recoveryEmail".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}recoveryEmailOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.recoveryEmailOptionsRaw(eo,to)})}refreshAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling refreshAuth.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/refresh".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}refreshAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.refreshAuthRaw(eo,to)).value()})}refreshOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling refreshOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/refresh".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}refreshOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.refreshOptionsRaw(eo,to)})}registerPasskeyMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegisterPasskeyDeviceGetResponseFromJSON(oo))})}registerPasskeyMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerPasskeyMfaDeviceRaw(eo,to)).value()})}registerPasskeyMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}registerPasskeyMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.registerPasskeyMfaDeviceOptionsRaw(eo,to)})}registerPasskeyMfaDeviceVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerPasskeyMfaDeviceVerify.");if(eo.mFARegisterPasskeyDevicePostRequest===null||eo.mFARegisterPasskeyDevicePostRequest===void 0)throw new RequiredError("mFARegisterPasskeyDevicePostRequest","Required parameter requestParameters.mFARegisterPasskeyDevicePostRequest was null or undefined when calling registerPasskeyMfaDeviceVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/passkey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFARegisterPasskeyDevicePostRequestToJSON(eo.mFARegisterPasskeyDevicePostRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}registerPasskeyMfaDeviceVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerPasskeyMfaDeviceVerifyRaw(eo,to)).value()})}registerSessionKeyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerSessionKey.");if(eo.registerSessionKeyRequest===null||eo.registerSessionKeyRequest===void 0)throw new RequiredError("registerSessionKeyRequest","Required parameter requestParameters.registerSessionKeyRequest was null or undefined when calling registerSessionKey.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/sessionKey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:RegisterSessionKeyRequestToJSON(eo.registerSessionKeyRequest)},to);return new JSONApiResponse(io,oo=>RegisterEmbeddedWalletSessionKeyResponseFromJSON(oo))})}registerSessionKey(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerSessionKeyRaw(eo,to)).value()})}registerTotpMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDevice.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new JSONApiResponse(io,oo=>MFARegisterTotpDeviceGetResponseFromJSON(oo))})}registerTotpMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerTotpMfaDeviceRaw(eo,to)).value()})}registerTotpMfaDeviceOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDeviceOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}registerTotpMfaDeviceOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.registerTotpMfaDeviceOptionsRaw(eo,to)})}registerTotpMfaDeviceVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling registerTotpMfaDeviceVerify.");if(eo.mFARegisterTotpDevicePostRequest===null||eo.mFARegisterTotpDevicePostRequest===void 0)throw new RequiredError("mFARegisterTotpDevicePostRequest","Required parameter requestParameters.mFARegisterTotpDevicePostRequest was null or undefined when calling registerTotpMfaDeviceVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/register/totp".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MFARegisterTotpDevicePostRequestToJSON(eo.mFARegisterTotpDevicePostRequest)},to);return new JSONApiResponse(io,oo=>MFADeviceFromJSON(oo))})}registerTotpMfaDeviceVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.registerTotpMfaDeviceVerifyRaw(eo,to)).value()})}retryEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retryEmailVerification.");if(eo.emailVerificationRetryRequest===null||eo.emailVerificationRetryRequest===void 0)throw new RequiredError("emailVerificationRetryRequest","Required parameter requestParameters.emailVerificationRetryRequest was null or undefined when calling retryEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationRetryRequestToJSON(eo.emailVerificationRetryRequest)},to);return new JSONApiResponse(io,oo=>EmailVerificationCreateResponseFromJSON(oo))})}retryEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.retryEmailVerificationRaw(eo,to)).value()})}retryEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retryEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}retryEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.retryEmailVerificationOptionsRaw(eo,to)})}retrySmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retrySmsVerification.");if(eo.smsVerificationRetryRequest===null||eo.smsVerificationRetryRequest===void 0)throw new RequiredError("smsVerificationRetryRequest","Required parameter requestParameters.smsVerificationRetryRequest was null or undefined when calling retrySmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationRetryRequestToJSON(eo.smsVerificationRetryRequest)},to);return new JSONApiResponse(io,oo=>SmsVerificationCreateResponseFromJSON(oo))})}retrySmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.retrySmsVerificationRaw(eo,to)).value()})}retrySmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling retrySmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/retry".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}retrySmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.retrySmsVerificationOptionsRaw(eo,to)})}revokeSessionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling revokeSession.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/revoke".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro},to);return new VoidApiResponse(io)})}revokeSession(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.revokeSessionRaw(eo,to)})}revokeSessionOptionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling revokeSessionOption.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/revoke".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}revokeSessionOption(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.revokeSessionOptionRaw(eo,to)})}scanUrlRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling scanUrl.");if(eo.scanWebsiteUrlRequest===null||eo.scanWebsiteUrlRequest===void 0)throw new RequiredError("scanWebsiteUrlRequest","Required parameter requestParameters.scanWebsiteUrlRequest was null or undefined when calling scanUrl.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/scan/websiteUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:ScanWebsiteUrlRequestToJSON(eo.scanWebsiteUrlRequest)},to);return new JSONApiResponse(io,oo=>ScanWebsiteUrlResponseFromJSON(oo))})}scanUrl(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.scanUrlRaw(eo,to)).value()})}scanUrlOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling scanUrlOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/scan/websiteUrl".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}scanUrlOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.scanUrlOptionsRaw(eo,to)})}sdkSettingsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sdkSettingsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/sdkSettings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sdkSettingsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sdkSettingsOptionsRaw(eo,to)})}selectUserWalletRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling selectUserWallet.");if(eo.userWalletSelectionRequest===null||eo.userWalletSelectionRequest===void 0)throw new RequiredError("userWalletSelectionRequest","Required parameter requestParameters.userWalletSelectionRequest was null or undefined when calling selectUserWallet.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/wallets/selection".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UserWalletSelectionRequestToJSON(eo.userWalletSelectionRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}selectUserWallet(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.selectUserWalletRaw(eo,to)).value()})}selectUserWalletOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling selectUserWalletOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/wallets/selection".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}selectUserWalletOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.selectUserWalletOptionsRaw(eo,to)})}sessionCheckRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionCheck.");const ro={},no={};if(this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/session".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"GET",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionCheck(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionCheckRaw(eo,to)})}sessionCheckOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionCheckOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/session".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionCheckOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionCheckOptionsRaw(eo,to)})}sessionKeyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling sessionKeyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/sessionKey".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}sessionKeyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.sessionKeyOptionsRaw(eo,to)})}settingsOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling settingsOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/settings".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}settingsOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.settingsOptionsRaw(eo,to)})}signInWithEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithEmailVerification.");if(eo.emailVerificationVerifyRequest===null||eo.emailVerificationVerifyRequest===void 0)throw new RequiredError("emailVerificationVerifyRequest","Required parameter requestParameters.emailVerificationVerifyRequest was null or undefined when calling signInWithEmailVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationVerifyRequestToJSON(eo.emailVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}signInWithEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.signInWithEmailVerificationRaw(eo,to)).value()})}signInWithEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}signInWithEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.signInWithEmailVerificationOptionsRaw(eo,to)})}signInWithSmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithSmsVerification.");if(eo.smsVerificationVerifyRequest===null||eo.smsVerificationVerifyRequest===void 0)throw new RequiredError("smsVerificationVerifyRequest","Required parameter requestParameters.smsVerificationVerifyRequest was null or undefined when calling signInWithSmsVerification.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationVerifyRequestToJSON(eo.smsVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}signInWithSmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.signInWithSmsVerificationRaw(eo,to)).value()})}signInWithSmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling signInWithSmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}signInWithSmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.signInWithSmsVerificationOptionsRaw(eo,to)})}simulateEVMTransactionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateEVMTransaction.");if(eo.simulateEVMTransactionRequest===null||eo.simulateEVMTransactionRequest===void 0)throw new RequiredError("simulateEVMTransactionRequest","Required parameter requestParameters.simulateEVMTransactionRequest was null or undefined when calling simulateEVMTransaction.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/evm/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SimulateEVMTransactionRequestToJSON(eo.simulateEVMTransactionRequest)},to);return new JSONApiResponse(io,oo=>SimulateTransactionResponseFromJSON(oo))})}simulateEVMTransaction(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.simulateEVMTransactionRaw(eo,to)).value()})}simulateEVMTransactionOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateEVMTransactionOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/evm/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}simulateEVMTransactionOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.simulateEVMTransactionOptionsRaw(eo,to)})}simulateSVMTransactionRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateSVMTransaction.");if(eo.simulateSVMTransactionRequest===null||eo.simulateSVMTransactionRequest===void 0)throw new RequiredError("simulateSVMTransactionRequest","Required parameter requestParameters.simulateSVMTransactionRequest was null or undefined when calling simulateSVMTransaction.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/solana/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SimulateSVMTransactionRequestToJSON(eo.simulateSVMTransactionRequest)},to);return new JSONApiResponse(io,oo=>SimulateTransactionResponseFromJSON(oo))})}simulateSVMTransaction(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.simulateSVMTransactionRaw(eo,to)).value()})}simulateSVMTransactionOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling simulateSVMTransactionOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/solana/simulateTransaction".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}simulateSVMTransactionOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.simulateSVMTransactionOptionsRaw(eo,to)})}telegramAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/auth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramAuthOptionsRaw(eo,to)})}telegramCheckAuthRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramCheckAuth.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/checkTelegramAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new VoidApiResponse(io)})}telegramCheckAuth(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramCheckAuthRaw(eo,to)})}telegramCheckAuthOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramCheckAuthOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/checkTelegramAuth".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramCheckAuthOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramCheckAuthOptionsRaw(eo,to)})}telegramSignInRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramSignIn.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/telegram/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}telegramSignIn(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.telegramSignInRaw(eo,to)).value()})}telegramSignInOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramSignInOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/signin".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramSignInOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramSignInOptionsRaw(eo,to)})}telegramVerifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramVerify.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/telegram/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:OauthResultRequestToJSON(eo.oauthResultRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}telegramVerify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.telegramVerifyRaw(eo,to)).value()})}telegramVerifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling telegramVerifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/telegram/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}telegramVerifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.telegramVerifyOptionsRaw(eo,to)})}updateEmbeddedWalletRecoveryEmailRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateEmbeddedWalletRecoveryEmail.");if(eo.updateRecoveryEmailRequest===null||eo.updateRecoveryEmailRequest===void 0)throw new RequiredError("updateRecoveryEmailRequest","Required parameter requestParameters.updateRecoveryEmailRequest was null or undefined when calling updateEmbeddedWalletRecoveryEmail.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/recoveryEmail".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UpdateRecoveryEmailRequestToJSON(eo.updateRecoveryEmailRequest)},to);return new VoidApiResponse(io)})}updateEmbeddedWalletRecoveryEmail(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.updateEmbeddedWalletRecoveryEmailRaw(eo,to)})}updatePasskeyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updatePasskey.");if(eo.updateUserPasskeyRequest===null||eo.updateUserPasskeyRequest===void 0)throw new RequiredError("updateUserPasskeyRequest","Required parameter requestParameters.updateUserPasskeyRequest was null or undefined when calling updatePasskey.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UpdateUserPasskeyRequestToJSON(eo.updateUserPasskeyRequest)},to);return new JSONApiResponse(io,oo=>UserPasskeyFromJSON(oo))})}updatePasskey(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.updatePasskeyRaw(eo,to)).value()})}updateSelfRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateSelf.");if(eo.userFields===null||eo.userFields===void 0)throw new RequiredError("userFields","Required parameter requestParameters.userFields was null or undefined when calling updateSelf.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"PUT",headers:no,query:ro,body:UserFieldsToJSON(eo.userFields)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}updateSelf(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.updateSelfRaw(eo,to)).value()})}updateUserMfaDeviceRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling updateUserMfaDevice.");if(eo.mfaDeviceId===null||eo.mfaDeviceId===void 0)throw new RequiredError("mfaDeviceId","Required parameter requestParameters.mfaDeviceId was null or undefined when calling updateUserMfaDevice.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/users/mfa/{mfaDeviceId}".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))).replace("{mfaDeviceId}",encodeURIComponent(String(eo.mfaDeviceId))),method:"PUT",headers:no,query:ro,body:MFAUpdateDeviceRequestToJSON(eo.mFAUpdateDeviceRequest)},to);return new VoidApiResponse(io)})}updateUserMfaDevice(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.updateUserMfaDeviceRaw(eo,to)})}userPasskeysOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling userPasskeysOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/passkeys".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}userPasskeysOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.userPasskeysOptionsRaw(eo,to)})}usersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling usersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}usersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.usersOptionsRaw(eo,to)})}verifyRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verify.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verify.");const ro={},no={};no["Content-Type"]="application/json";const io=yield this.request({path:"/sdk/{environmentId}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verify(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyRaw(eo,to)).value()})}verifyEmailVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyEmailVerification.");if(eo.emailVerificationVerifyRequest===null||eo.emailVerificationVerifyRequest===void 0)throw new RequiredError("emailVerificationVerifyRequest","Required parameter requestParameters.emailVerificationVerifyRequest was null or undefined when calling verifyEmailVerification.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:EmailVerificationVerifyRequestToJSON(eo.emailVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}verifyEmailVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyEmailVerificationRaw(eo,to)).value()})}verifyEmailVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyEmailVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/emailVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyEmailVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyEmailVerificationOptionsRaw(eo,to)})}verifyLinkRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyLink.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verifyLink.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/link".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyLink(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyLinkRaw(eo,to)).value()})}verifyLinkOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyLinkOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/link".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyLinkOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyLinkOptionsRaw(eo,to)})}verifyMergeUsersRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyMergeUsers.");if(eo.mergeUserConflictResolutions===null||eo.mergeUserConflictResolutions===void 0)throw new RequiredError("mergeUserConflictResolutions","Required parameter requestParameters.mergeUserConflictResolutions was null or undefined when calling verifyMergeUsers.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:MergeUserConflictResolutionsToJSON(eo.mergeUserConflictResolutions)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyMergeUsers(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyMergeUsersRaw(eo,to)).value()})}verifyMergeUsersOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyMergeUsersOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/merge".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyMergeUsersOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyMergeUsersOptionsRaw(eo,to)})}verifyOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyOptionsRaw(eo,to)})}verifyPrefetchRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyPrefetch.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/prefetch".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyPrefetch(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyPrefetchRaw(eo,to)})}verifySmsVerificationRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifySmsVerification.");if(eo.smsVerificationVerifyRequest===null||eo.smsVerificationVerifyRequest===void 0)throw new RequiredError("smsVerificationVerifyRequest","Required parameter requestParameters.smsVerificationVerifyRequest was null or undefined when calling verifySmsVerification.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:SmsVerificationVerifyRequestToJSON(eo.smsVerificationVerifyRequest)},to);return new JSONApiResponse(io,oo=>UpdateSelfResponseFromJSON(oo))})}verifySmsVerification(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifySmsVerificationRaw(eo,to)).value()})}verifySmsVerificationOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifySmsVerificationOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/smsVerifications/verify".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifySmsVerificationOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifySmsVerificationOptionsRaw(eo,to)})}verifyTransferRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyTransfer.");if(eo.verifyRequest===null||eo.verifyRequest===void 0)throw new RequiredError("verifyRequest","Required parameter requestParameters.verifyRequest was null or undefined when calling verifyTransfer.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/transfer".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyRequestToJSON(eo.verifyRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyTransfer(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyTransferRaw(eo,to)).value()})}verifyTransferOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyTransferOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/transfer".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyTransferOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyTransferOptionsRaw(eo,to)})}verifyUnlinkRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyUnlink.");if(eo.verifyUnlinkRequest===null||eo.verifyUnlinkRequest===void 0)throw new RequiredError("verifyUnlinkRequest","Required parameter requestParameters.verifyUnlinkRequest was null or undefined when calling verifyUnlink.");const ro={},no={};if(no["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const oo=this.configuration.accessToken,ao=yield oo("bearerAuth",[]);ao&&(no.Authorization=`Bearer ${ao}`)}const io=yield this.request({path:"/sdk/{environmentId}/verify/unlink".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"POST",headers:no,query:ro,body:VerifyUnlinkRequestToJSON(eo.verifyUnlinkRequest)},to);return new JSONApiResponse(io,oo=>VerifyResponseFromJSON(oo))})}verifyUnlink(eo,to){return __awaiter$l(this,void 0,void 0,function*(){return yield(yield this.verifyUnlinkRaw(eo,to)).value()})}verifyUnlinkOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling verifyUnlinkOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/verify/unlink".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}verifyUnlinkOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.verifyUnlinkOptionsRaw(eo,to)})}walletAccountOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling walletAccountOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}walletAccountOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.walletAccountOptionsRaw(eo,to)})}walletAccountRequestOptionsRaw(eo,to){return __awaiter$l(this,void 0,void 0,function*(){if(eo.environmentId===null||eo.environmentId===void 0)throw new RequiredError("environmentId","Required parameter requestParameters.environmentId was null or undefined when calling walletAccountRequestOptions.");const ro={},no={},io=yield this.request({path:"/sdk/{environmentId}/users/embeddedWallets/walletAccounts/createRequest".replace("{environmentId}",encodeURIComponent(String(eo.environmentId))),method:"OPTIONS",headers:no,query:ro},to);return new VoidApiResponse(io)})}walletAccountRequestOptions(eo,to){return __awaiter$l(this,void 0,void 0,function*(){yield this.walletAccountRequestOptionsRaw(eo,to)})}}var GetAccountBalancesChainNameEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(GetAccountBalancesChainNameEnum||(GetAccountBalancesChainNameEnum={}));var GetAccountBalancesNetworkIdEnum;(function(Xr){Xr[Xr.NUMBER_0=0]="NUMBER_0",Xr[Xr.NUMBER_1=1]="NUMBER_1",Xr[Xr.NUMBER_10=10]="NUMBER_10",Xr[Xr.NUMBER_137=137]="NUMBER_137",Xr[Xr.NUMBER_42161=42161]="NUMBER_42161",Xr[Xr.NUMBER_8453=8453]="NUMBER_8453"})(GetAccountBalancesNetworkIdEnum||(GetAccountBalancesNetworkIdEnum={}));var GetAccountBalancesOptionsChainNameEnum;(function(Xr){Xr.Evm="EVM",Xr.Sol="SOL"})(GetAccountBalancesOptionsChainNameEnum||(GetAccountBalancesOptionsChainNameEnum={}));function JwtBlockchainAccountFromJSON(Xr){return JwtBlockchainAccountFromJSONTyped(Xr)}function JwtBlockchainAccountFromJSONTyped(Xr,eo){return Xr==null?Xr:{address:Xr.address,chain:Xr.chain,id:Xr.id,nameService:exists$1(Xr,"name_service")?NameServiceDataFromJSON(Xr.name_service):void 0,walletName:Xr.wallet_name,walletProvider:WalletProviderEnumFromJSON(Xr.wallet_provider)}}function JwtPayloadDeprecatedInfoFromJSON(Xr){return JwtPayloadDeprecatedInfoFromJSONTyped(Xr)}function JwtPayloadDeprecatedInfoFromJSONTyped(Xr,eo){return Xr==null?Xr:{alias:exists$1(Xr,"alias")?Xr.alias:void 0,chain:exists$1(Xr,"chain")?ChainEnumFromJSON(Xr.chain):void 0,email:exists$1(Xr,"email")?Xr.email:void 0,ens:exists$1(Xr,"ens")?NameServiceDataFromJSON(Xr.ens):void 0,environmentId:Xr.environmentId,firstName:exists$1(Xr,"firstName")?Xr.firstName:void 0,jobTitle:exists$1(Xr,"jobTitle")?Xr.jobTitle:void 0,lastName:exists$1(Xr,"lastName")?Xr.lastName:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,tShirtSize:exists$1(Xr,"tShirtSize")?Xr.tShirtSize:void 0,userId:exists$1(Xr,"userId")?Xr.userId:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,wallet:exists$1(Xr,"wallet")?Xr.wallet:void 0,walletPublicKey:exists$1(Xr,"walletPublicKey")?Xr.walletPublicKey:void 0}}function JwtVerifiedCredentialHashesFromJSON(Xr){return JwtVerifiedCredentialHashesFromJSONTyped(Xr)}function JwtVerifiedCredentialHashesFromJSONTyped(Xr,eo){return Xr==null?Xr:{blockchain:exists$1(Xr,"blockchain")?Xr.blockchain:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,oauth:exists$1(Xr,"oauth")?Xr.oauth:void 0,phoneNumber:exists$1(Xr,"phoneNumber")?Xr.phoneNumber:void 0,externalUser:exists$1(Xr,"externalUser")?Xr.externalUser:void 0}}function DynamicJwtFromJSON(Xr){return DynamicJwtFromJSONTyped(Xr)}function DynamicJwtFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:Xr.kid,aud:Xr.aud,iss:Xr.iss,sub:Xr.sub,exp:exists$1(Xr,"exp")?Xr.exp:void 0,iat:exists$1(Xr,"iat")?Xr.iat:void 0,sid:Xr.sid,alias:exists$1(Xr,"alias")?Xr.alias:void 0,blockchainAccounts:exists$1(Xr,"blockchain_accounts")?Xr.blockchain_accounts.map(JwtBlockchainAccountFromJSON):void 0,country:exists$1(Xr,"country")?Xr.country:void 0,email:exists$1(Xr,"email")?Xr.email:void 0,environmentId:Xr.environment_id,familyName:exists$1(Xr,"family_name")?Xr.family_name:void 0,givenName:exists$1(Xr,"given_name")?Xr.given_name:void 0,jobTitle:exists$1(Xr,"job_title")?Xr.job_title:void 0,lastAuthenticatedAccountId:exists$1(Xr,"last_authenticated_account_id")?Xr.last_authenticated_account_id:void 0,lists:exists$1(Xr,"lists")?Xr.lists:void 0,phoneNumber:exists$1(Xr,"phone_number")?Xr.phone_number:void 0,missingFields:Xr.missing_fields.map(ProjectSettingsKycFromJSON),scope:exists$1(Xr,"scope")?Xr.scope:void 0,tShirtSize:exists$1(Xr,"t_shirt_size")?Xr.t_shirt_size:void 0,team:exists$1(Xr,"team")?Xr.team:void 0,username:exists$1(Xr,"username")?Xr.username:void 0,policiesConsent:exists$1(Xr,"policies_consent")?Xr.policies_consent:void 0,verifiedAccount:exists$1(Xr,"verified_account")?JwtBlockchainAccountFromJSON(Xr.verified_account):void 0,verifiedCredentials:Xr.verified_credentials.map(JwtVerifiedCredentialFromJSON),lastVerifiedCredentialId:Xr.last_verified_credential_id,firstVisit:exists$1(Xr,"first_visit")?new Date(Xr.first_visit):void 0,lastVisit:exists$1(Xr,"last_visit")?new Date(Xr.last_visit):void 0,newUser:exists$1(Xr,"new_user")?Xr.new_user:void 0,btcWallet:exists$1(Xr,"btc_wallet")?Xr.btc_wallet:void 0,kdaWallet:exists$1(Xr,"kda_wallet")?Xr.kda_wallet:void 0,ltcWallet:exists$1(Xr,"ltc_wallet")?Xr.ltc_wallet:void 0,ckbWallet:exists$1(Xr,"ckb_wallet")?Xr.ckb_wallet:void 0,kasWallet:exists$1(Xr,"kas_wallet")?Xr.kas_wallet:void 0,dogeWallet:exists$1(Xr,"doge_wallet")?Xr.doge_wallet:void 0,emailNotification:exists$1(Xr,"email_notification")?Xr.email_notification:void 0,discordNotification:exists$1(Xr,"discord_notification")?Xr.discord_notification:void 0,newsletterNotification:exists$1(Xr,"newsletter_notification")?Xr.newsletter_notification:void 0,metadata:exists$1(Xr,"metadata")?Xr.metadata:void 0,verifiedCredentialsHashes:exists$1(Xr,"verifiedCredentialsHashes")?JwtVerifiedCredentialHashesFromJSON(Xr.verifiedCredentialsHashes):void 0,info:exists$1(Xr,"info")?JwtPayloadDeprecatedInfoFromJSON(Xr.info):void 0}}function MinifiedDynamicJwtFromJSON(Xr){return MinifiedDynamicJwtFromJSONTyped(Xr)}function MinifiedDynamicJwtFromJSONTyped(Xr,eo){return Xr==null?Xr:{kid:Xr.kid,aud:Xr.aud,iss:Xr.iss,sub:Xr.sub,sid:Xr.sid,exp:exists$1(Xr,"exp")?Xr.exp:void 0,iat:exists$1(Xr,"iat")?Xr.iat:void 0,environmentId:Xr.environment_id,lastVerifiedCredentialId:Xr.last_verified_credential_id,scope:exists$1(Xr,"scope")?Xr.scope:void 0,verifiedCredentialsHashes:exists$1(Xr,"verifiedCredentialsHashes")?JwtVerifiedCredentialHashesFromJSON(Xr.verifiedCredentialsHashes):void 0}}var SocialOAuthErrorCode;(function(Xr){Xr.ACCOUNT_ALREADY_LINKED="account_already_linked",Xr.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE="account_already_linked_to_different_profile",Xr.INVALID_PROVIDER="invalid_provider",Xr.NO_ACCOUNT_LINKED="no_account_linked",Xr.NO_AUTH_CODE="no_auth_code",Xr.NO_OAUTH_URL="no_oauth_url",Xr.NO_PROVIDER="no_provider",Xr.OAUTH_ERROR="oauth_error",Xr.OAUTH_WINDOW_BLOCKED="oauth_window_blocked",Xr.OAUTH_WINDOW_CLOSED="oauth_window_closed",Xr.OAUTH_WINDOW_TIMEOUT="oauth_window_timeout",Xr.PROVIDER_NOT_ENABLED="provider_not_enabled",Xr.SESSION_TIMEOUT="session_timeout",Xr.SIGNIN_ERROR="signin_error",Xr.SOCIAL_LINKING_NOT_ENABLED="social_linking_not_enabled",Xr.UNLINK_ERROR="unlink_error",Xr.VERIFICATION_ERROR="verification_error",Xr.GENERAL_ERROR="general_error",Xr.USER_CANCELLED="user_cancelled"})(SocialOAuthErrorCode||(SocialOAuthErrorCode={}));class BaseWallet{constructor({id:eo,key:to,address:ro,additionalAddresses:no=[],chain:io,isAuthenticated:oo}){this.id=eo,this.key=to,this.address=ro,this.additionalAddresses=no,this.chain=io,this.isAuthenticated=oo}}assertPackageVersion("@dynamic-labs/types",version$n);const appleIdScriptSrc="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",loadAppleId=()=>new Promise((Xr,eo)=>{const to=document.querySelector("script[data-apple-sdk]");if(to)to.hasAttribute("data-loaded")?Xr():(to.addEventListener("load",()=>Xr()),to.addEventListener("error",()=>eo(new Error("Failed to load Apple SDK"))));else{const ro=document.createElement("script");ro.type="text/javascript",ro.src=appleIdScriptSrc,ro.setAttribute("data-apple-sdk","true"),ro.onload=()=>{ro==null||ro.setAttribute("data-loaded","true"),Xr()},ro.onerror=()=>eo(new Error("Failed to load Apple SDK")),window.document.head.appendChild(ro)}}),connectWithAppleId=Xr=>__awaiter$m(void 0,[Xr],void 0,function*({clientId:eo,oauthLoginUrl:to,state:ro}){yield loadAppleId(),AppleID.auth.init({clientId:eo,redirectURI:to.searchParams.get("redirect_uri"),scope:"name email",state:ro,usePopup:!1}),AppleID.auth.signIn()});let authWindowInterval;const createWindowOauth2Service=()=>({getOauthCode:({apiProvider:Xr,provider:eo,redirectUrl:to,setIsProcessing:ro,state:no,oauthLoginUrl:io,initWebAuth:oo,strategy:ao})=>new Promise((so,co)=>{if(eo===ProviderEnum.Apple&&(isSafariBrowser()||isIOS$1()||ao==="redirect")){oo({redirectUrl:to||window.location.href}).then(()=>connectWithAppleId({clientId:Xr==null?void 0:Xr.clientId,oauthLoginUrl:io,state:no}).catch(co));return}if(ao==="redirect"&&eo!==ProviderEnum.Telegram){oo({redirectUrl:to||window.location.href}).then(()=>{window.location.assign(io)});return}const lo=Co=>co(Co);clearInterval(authWindowInterval);const uo={},ho=window.open("","_blank","width=500,height=600");if(ho===null||typeof ho>"u"){lo({code:SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED,message:"Please allow popups and try again."});return}const go=()=>{window.removeEventListener("message",bo),uo[eo]=!1},bo=Co=>__awaiter$m(void 0,void 0,void 0,function*(){const Ro=Co.data,Oo=wo(Xr);if(!Oo)return;if((Ro==null?void 0:Ro.type)==="origin_check"&&ho){logger$a.debug("Origin check message received. Sending response now.",{data:Ro,expectedOrigin:Oo}),ho.postMessage("origin_check_response",Oo);return}const jo=(Ro==null?void 0:Ro.type)==="telegram_completed",Bo=(Ro==null?void 0:Ro.type)==="authorization_response";(Bo||jo)&&logger$a.debug("Message received",{data:Ro});const Mo=Co.origin===Oo;if((Bo&&(Ro==null?void 0:Ro.provider)===eo||jo)&&Mo){if(ro(!0),!uo[eo]){lo({code:SocialOAuthErrorCode.SESSION_TIMEOUT,message:`Connecting ${eo} account session timeout.`});return}if(go(),jo){Eo(Ro,no);return}$o(Ro,eo,no)}}),wo=Co=>{if(Co!=null&&Co.redirectUrl)try{return new URL(Co.redirectUrl).origin}catch(Ro){logger$a.error("Failed to parse social provider redirect url",{error:Ro});return}},Eo=(Co,Ro)=>{logger$a.debug("Telegram completion message received",{data:Co});const{code:Oo,state:jo}=Co;if(Ro!==jo){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:"Failed to connect telegram account: Invalid random state"});return}so(Oo),ro(!1)},$o=(Co,Ro,Oo)=>{const{code:jo,error:Bo,state:Mo}=Co;if(Bo&&Bo!=="undefined"){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:`Failed to connect ${Ro} social account: ${Bo}`});return}if(Oo!==Mo){lo({code:SocialOAuthErrorCode.OAUTH_ERROR,message:`Failed to connect ${Ro} social account: Invalid random state`});return}if(!jo){lo({code:SocialOAuthErrorCode.NO_AUTH_CODE,message:`Failed to connect ${Ro} social account: no authorization code`});return}so(jo),ro(!1)};uo[eo]||(window.addEventListener("message",bo),uo[eo]=!0),oo().then(()=>{ho==null||ho.location.assign(io),authWindowInterval=setInterval(()=>{ho!=null&&ho.closed&&(clearInterval(authWindowInterval),ro(!1),uo[eo]&&lo({code:SocialOAuthErrorCode.USER_CANCELLED,message:"User cancelled connection"}))},2e3)})})});var _a$1,_Oauth2Service_implementation;class Oauth2Service{static get implementation(){return __classPrivateFieldGet$5(_a$1,_a$1,"f",_Oauth2Service_implementation)?__classPrivateFieldGet$5(_a$1,_a$1,"f",_Oauth2Service_implementation):createWindowOauth2Service()}static set implementation(eo){__classPrivateFieldSet$5(_a$1,_a$1,eo,"f",_Oauth2Service_implementation)}static get getOauthCode(){return _a$1.implementation.getOauthCode}}_a$1=Oauth2Service;_Oauth2Service_implementation={value:void 0};Oauth2Service.isGetOauthCodeError=Xr=>typeof Xr=="object"&&"code"in Xr&&Object.values(SocialOAuthErrorCode).includes(Xr.code)&&"message"in Xr&&typeof Xr.message=="string";const template$1=Xr=>eo=>Xr.replace(/{{(\w+?)}}/g,(to,ro)=>ro in eo?eo[ro]:to),get$8=(Xr,eo)=>{try{return(eo.match(/[^.[\]"']+/g)||[]).reduce((ro,no)=>ro[no],Xr)}catch{return}},hexToString=Xr=>{const eo=Xr.startsWith("0x")?Xr.substring(2):Xr;let to="";const ro=eo.length-eo.length%2;for(let no=0;no{if(typeof Xr!="string")throw new Error("Input must be a string");const eo=Xr.startsWith("0x")?Xr.substring(2):Xr;return/^[0-9a-fA-F]+$/.test(eo)};class StorageService{static clearRegistry(){StorageService.registry={localStorage:void 0,secureStorage:void 0,sessionStorage:void 0}}static registerSourceStorage(eo,to){StorageService.registry[eo]=to}static getSourceStorage(eo){return StorageService.registry[eo]}static resolveStorage(eo){const to=(eo==null?void 0:eo.priority)||["localStorage"];for(const ro of to){const no=StorageService.getSourceStorage(ro);if(no)return no}throw new Error("No available storage found based on the specified priority")}static getItem(eo,to){return StorageService.resolveStorage(to).getItem(eo)}static setItem(eo,to,ro){StorageService.resolveStorage(ro).setItem(eo,to)}static removeItem(eo,to){StorageService.resolveStorage(to).removeItem(eo)}static getKeys(eo){return StorageService.resolveStorage(eo).getKeys()}}StorageService.registry={localStorage:void 0,secureStorage:void 0,sessionStorage:void 0};StorageService.events=new EventEmitter$3;const createStorageService=({postfix:Xr,storage:eo})=>{const to=co=>Xr?`${co}_${Xr}`:co,ro=co=>JSON.stringify(co),no=co=>JSON.parse(co),io=co=>{const lo=eo.getItem(to(co));if(lo)try{return no(lo)}catch(uo){logger$a.error(`Error while parsing ${co} from local storage`,{value:lo}),ao(co),StorageService.events.emit("parseFailure",uo,co)}},oo=(co,lo)=>{eo.setItem(to(co),ro(lo))},ao=co=>{eo.removeItem(to(co))};return{getItem:io,getKeys:()=>Object.keys(eo),removeItem:ao,setItem:oo}},cloneObjectWithOverrides=(Xr,eo={})=>{var to,ro;const no=Object.getOwnPropertyDescriptors(Xr),io=Object.create(Object.getPrototypeOf(Xr));for(const[ao,so]of Object.entries(eo))Object.defineProperty(io,ao,{configurable:!0,enumerable:(ro=(to=no[ao])===null||to===void 0?void 0:to.enumerable)!==null&&ro!==void 0?ro:!0,value:so,writable:!0});const oo=Object.keys(eo);for(const[ao,so]of Object.entries(no))oo.includes(ao)||Object.defineProperty(io,ao,so);return io};assertPackageVersion("@dynamic-labs/utils",version$o);var util$9;(function(Xr){Xr.assertEqual=no=>no;function eo(no){}Xr.assertIs=eo;function to(no){throw new Error}Xr.assertNever=to,Xr.arrayToEnum=no=>{const io={};for(const oo of no)io[oo]=oo;return io},Xr.getValidEnumValues=no=>{const io=Xr.objectKeys(no).filter(ao=>typeof no[no[ao]]!="number"),oo={};for(const ao of io)oo[ao]=no[ao];return Xr.objectValues(oo)},Xr.objectValues=no=>Xr.objectKeys(no).map(function(io){return no[io]}),Xr.objectKeys=typeof Object.keys=="function"?no=>Object.keys(no):no=>{const io=[];for(const oo in no)Object.prototype.hasOwnProperty.call(no,oo)&&io.push(oo);return io},Xr.find=(no,io)=>{for(const oo of no)if(io(oo))return oo},Xr.isInteger=typeof Number.isInteger=="function"?no=>Number.isInteger(no):no=>typeof no=="number"&&isFinite(no)&&Math.floor(no)===no;function ro(no,io=" | "){return no.map(oo=>typeof oo=="string"?`'${oo}'`:oo).join(io)}Xr.joinValues=ro,Xr.jsonStringifyReplacer=(no,io)=>typeof io=="bigint"?io.toString():io})(util$9||(util$9={}));var objectUtil;(function(Xr){Xr.mergeShapes=(eo,to)=>({...eo,...to})})(objectUtil||(objectUtil={}));const ZodParsedType=util$9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=Xr=>{switch(typeof Xr){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(Xr)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(Xr)?ZodParsedType.array:Xr===null?ZodParsedType.null:Xr.then&&typeof Xr.then=="function"&&Xr.catch&&typeof Xr.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&Xr instanceof Map?ZodParsedType.map:typeof Set<"u"&&Xr instanceof Set?ZodParsedType.set:typeof Date<"u"&&Xr instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=Xr=>JSON.stringify(Xr,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(eo){super(),this.issues=[],this.addIssue=ro=>{this.issues=[...this.issues,ro]},this.addIssues=(ro=[])=>{this.issues=[...this.issues,...ro]};const to=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,to):this.__proto__=to,this.name="ZodError",this.issues=eo}get errors(){return this.issues}format(eo){const to=eo||function(io){return io.message},ro={_errors:[]},no=io=>{for(const oo of io.issues)if(oo.code==="invalid_union")oo.unionErrors.map(no);else if(oo.code==="invalid_return_type")no(oo.returnTypeError);else if(oo.code==="invalid_arguments")no(oo.argumentsError);else if(oo.path.length===0)ro._errors.push(to(oo));else{let ao=ro,so=0;for(;soto.message){const to={},ro=[];for(const no of this.issues)no.path.length>0?(to[no.path[0]]=to[no.path[0]]||[],to[no.path[0]].push(eo(no))):ro.push(eo(no));return{formErrors:ro,fieldErrors:to}}get formErrors(){return this.flatten()}}ZodError.create=Xr=>new ZodError(Xr);const errorMap=(Xr,eo)=>{let to;switch(Xr.code){case ZodIssueCode.invalid_type:Xr.received===ZodParsedType.undefined?to="Required":to=`Expected ${Xr.expected}, received ${Xr.received}`;break;case ZodIssueCode.invalid_literal:to=`Invalid literal value, expected ${JSON.stringify(Xr.expected,util$9.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:to=`Unrecognized key(s) in object: ${util$9.joinValues(Xr.keys,", ")}`;break;case ZodIssueCode.invalid_union:to="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:to=`Invalid discriminator value. Expected ${util$9.joinValues(Xr.options)}`;break;case ZodIssueCode.invalid_enum_value:to=`Invalid enum value. Expected ${util$9.joinValues(Xr.options)}, received '${Xr.received}'`;break;case ZodIssueCode.invalid_arguments:to="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:to="Invalid function return type";break;case ZodIssueCode.invalid_date:to="Invalid date";break;case ZodIssueCode.invalid_string:typeof Xr.validation=="object"?"includes"in Xr.validation?(to=`Invalid input: must include "${Xr.validation.includes}"`,typeof Xr.validation.position=="number"&&(to=`${to} at one or more positions greater than or equal to ${Xr.validation.position}`)):"startsWith"in Xr.validation?to=`Invalid input: must start with "${Xr.validation.startsWith}"`:"endsWith"in Xr.validation?to=`Invalid input: must end with "${Xr.validation.endsWith}"`:util$9.assertNever(Xr.validation):Xr.validation!=="regex"?to=`Invalid ${Xr.validation}`:to="Invalid";break;case ZodIssueCode.too_small:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"more than"} ${Xr.minimum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"over"} ${Xr.minimum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${Xr.minimum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(Xr.minimum))}`:to="Invalid input";break;case ZodIssueCode.too_big:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"less than"} ${Xr.maximum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"under"} ${Xr.maximum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="bigint"?to=`BigInt must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly":Xr.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(Xr.maximum))}`:to="Invalid input";break;case ZodIssueCode.custom:to="Invalid input";break;case ZodIssueCode.invalid_intersection_types:to="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:to=`Number must be a multiple of ${Xr.multipleOf}`;break;case ZodIssueCode.not_finite:to="Number must be finite";break;default:to=eo.defaultError,util$9.assertNever(Xr)}return{message:to}};let overrideErrorMap=errorMap;function setErrorMap(Xr){overrideErrorMap=Xr}function getErrorMap(){return overrideErrorMap}const makeIssue=Xr=>{const{data:eo,path:to,errorMaps:ro,issueData:no}=Xr,io=[...to,...no.path||[]],oo={...no,path:io};let ao="";const so=ro.filter(co=>!!co).slice().reverse();for(const co of so)ao=co(oo,{data:eo,defaultError:ao}).message;return{...no,path:io,message:no.message||ao}},EMPTY_PATH=[];function addIssueToContext(Xr,eo){const to=makeIssue({issueData:eo,data:Xr.data,path:Xr.path,errorMaps:[Xr.common.contextualErrorMap,Xr.schemaErrorMap,getErrorMap(),errorMap].filter(ro=>!!ro)});Xr.common.issues.push(to)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(eo,to){const ro=[];for(const no of to){if(no.status==="aborted")return INVALID;no.status==="dirty"&&eo.dirty(),ro.push(no.value)}return{status:eo.value,value:ro}}static async mergeObjectAsync(eo,to){const ro=[];for(const no of to)ro.push({key:await no.key,value:await no.value});return ParseStatus.mergeObjectSync(eo,ro)}static mergeObjectSync(eo,to){const ro={};for(const no of to){const{key:io,value:oo}=no;if(io.status==="aborted"||oo.status==="aborted")return INVALID;io.status==="dirty"&&eo.dirty(),oo.status==="dirty"&&eo.dirty(),io.value!=="__proto__"&&(typeof oo.value<"u"||no.alwaysSet)&&(ro[io.value]=oo.value)}return{status:eo.value,value:ro}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=Xr=>({status:"dirty",value:Xr}),OK=Xr=>({status:"valid",value:Xr}),isAborted=Xr=>Xr.status==="aborted",isDirty=Xr=>Xr.status==="dirty",isValid=Xr=>Xr.status==="valid",isAsync=Xr=>typeof Promise<"u"&&Xr instanceof Promise;var errorUtil;(function(Xr){Xr.errToObj=eo=>typeof eo=="string"?{message:eo}:eo||{},Xr.toString=eo=>typeof eo=="string"?eo:eo==null?void 0:eo.message})(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(eo,to,ro,no){this._cachedPath=[],this.parent=eo,this.data=to,this._path=ro,this._key=no}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(Xr,eo)=>{if(isValid(eo))return{success:!0,data:eo.value};if(!Xr.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const to=new ZodError(Xr.common.issues);return this._error=to,this._error}}};function processCreateParams(Xr){if(!Xr)return{};const{errorMap:eo,invalid_type_error:to,required_error:ro,description:no}=Xr;if(eo&&(to||ro))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return eo?{errorMap:eo,description:no}:{errorMap:(oo,ao)=>oo.code!=="invalid_type"?{message:ao.defaultError}:typeof ao.data>"u"?{message:ro??ao.defaultError}:{message:to??ao.defaultError},description:no}}class ZodType{constructor(eo){this.spa=this.safeParseAsync,this._def=eo,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(eo){return getParsedType(eo.data)}_getOrReturnCtx(eo,to){return to||{common:eo.parent.common,data:eo.data,parsedType:getParsedType(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}_processInputParams(eo){return{status:new ParseStatus,ctx:{common:eo.parent.common,data:eo.data,parsedType:getParsedType(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}}_parseSync(eo){const to=this._parse(eo);if(isAsync(to))throw new Error("Synchronous parse encountered promise.");return to}_parseAsync(eo){const to=this._parse(eo);return Promise.resolve(to)}parse(eo,to){const ro=this.safeParse(eo,to);if(ro.success)return ro.data;throw ro.error}safeParse(eo,to){var ro;const no={common:{issues:[],async:(ro=to==null?void 0:to.async)!==null&&ro!==void 0?ro:!1,contextualErrorMap:to==null?void 0:to.errorMap},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:getParsedType(eo)},io=this._parseSync({data:eo,path:no.path,parent:no});return handleResult(no,io)}async parseAsync(eo,to){const ro=await this.safeParseAsync(eo,to);if(ro.success)return ro.data;throw ro.error}async safeParseAsync(eo,to){const ro={common:{issues:[],contextualErrorMap:to==null?void 0:to.errorMap,async:!0},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:getParsedType(eo)},no=this._parse({data:eo,path:ro.path,parent:ro}),io=await(isAsync(no)?no:Promise.resolve(no));return handleResult(ro,io)}refine(eo,to){const ro=no=>typeof to=="string"||typeof to>"u"?{message:to}:typeof to=="function"?to(no):to;return this._refinement((no,io)=>{const oo=eo(no),ao=()=>io.addIssue({code:ZodIssueCode.custom,...ro(no)});return typeof Promise<"u"&&oo instanceof Promise?oo.then(so=>so?!0:(ao(),!1)):oo?!0:(ao(),!1)})}refinement(eo,to){return this._refinement((ro,no)=>eo(ro)?!0:(no.addIssue(typeof to=="function"?to(ro,no):to),!1))}_refinement(eo){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:eo}})}superRefine(eo){return this._refinement(eo)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(eo){return ZodUnion.create([this,eo],this._def)}and(eo){return ZodIntersection.create(this,eo,this._def)}transform(eo){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:eo}})}default(eo){const to=typeof eo=="function"?eo:()=>eo;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:to,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(eo){const to=typeof eo=="function"?eo:()=>eo;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:to,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(eo){const to=this.constructor;return new to({...this._def,description:eo})}pipe(eo){return ZodPipeline.create(this,eo)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[a-z][a-z0-9]*$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,datetimeRegex=Xr=>Xr.precision?Xr.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}Z$`):Xr.precision===0?Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function isValidIP(Xr,eo){return!!((eo==="v4"||!eo)&&ipv4Regex.test(Xr)||(eo==="v6"||!eo)&&ipv6Regex.test(Xr))}class ZodString extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=String(eo.data)),this._getType(eo)!==ZodParsedType.string){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:io.parsedType}),INVALID}const ro=new ParseStatus;let no;for(const io of this._def.checks)if(io.kind==="min")eo.data.lengthio.value&&(no=this._getOrReturnCtx(eo,no),addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:io.value,type:"string",inclusive:!0,exact:!1,message:io.message}),ro.dirty());else if(io.kind==="length"){const oo=eo.data.length>io.value,ao=eo.data.lengtheo.test(no),{validation:to,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(ro)})}_addCheck(eo){return new ZodString({...this._def,checks:[...this._def.checks,eo]})}email(eo){return this._addCheck({kind:"email",...errorUtil.errToObj(eo)})}url(eo){return this._addCheck({kind:"url",...errorUtil.errToObj(eo)})}emoji(eo){return this._addCheck({kind:"emoji",...errorUtil.errToObj(eo)})}uuid(eo){return this._addCheck({kind:"uuid",...errorUtil.errToObj(eo)})}cuid(eo){return this._addCheck({kind:"cuid",...errorUtil.errToObj(eo)})}cuid2(eo){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(eo)})}ulid(eo){return this._addCheck({kind:"ulid",...errorUtil.errToObj(eo)})}ip(eo){return this._addCheck({kind:"ip",...errorUtil.errToObj(eo)})}datetime(eo){var to;return typeof eo=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:eo}):this._addCheck({kind:"datetime",precision:typeof(eo==null?void 0:eo.precision)>"u"?null:eo==null?void 0:eo.precision,offset:(to=eo==null?void 0:eo.offset)!==null&&to!==void 0?to:!1,...errorUtil.errToObj(eo==null?void 0:eo.message)})}regex(eo,to){return this._addCheck({kind:"regex",regex:eo,...errorUtil.errToObj(to)})}includes(eo,to){return this._addCheck({kind:"includes",value:eo,position:to==null?void 0:to.position,...errorUtil.errToObj(to==null?void 0:to.message)})}startsWith(eo,to){return this._addCheck({kind:"startsWith",value:eo,...errorUtil.errToObj(to)})}endsWith(eo,to){return this._addCheck({kind:"endsWith",value:eo,...errorUtil.errToObj(to)})}min(eo,to){return this._addCheck({kind:"min",value:eo,...errorUtil.errToObj(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo,...errorUtil.errToObj(to)})}length(eo,to){return this._addCheck({kind:"length",value:eo,...errorUtil.errToObj(to)})}nonempty(eo){return this.min(1,errorUtil.errToObj(eo))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(eo=>eo.kind==="datetime")}get isEmail(){return!!this._def.checks.find(eo=>eo.kind==="email")}get isURL(){return!!this._def.checks.find(eo=>eo.kind==="url")}get isEmoji(){return!!this._def.checks.find(eo=>eo.kind==="emoji")}get isUUID(){return!!this._def.checks.find(eo=>eo.kind==="uuid")}get isCUID(){return!!this._def.checks.find(eo=>eo.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(eo=>eo.kind==="cuid2")}get isULID(){return!!this._def.checks.find(eo=>eo.kind==="ulid")}get isIP(){return!!this._def.checks.find(eo=>eo.kind==="ip")}get minLength(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxLength(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...processCreateParams(Xr)})};function floatSafeRemainder(Xr,eo){const to=(Xr.toString().split(".")[1]||"").length,ro=(eo.toString().split(".")[1]||"").length,no=to>ro?to:ro,io=parseInt(Xr.toFixed(no).replace(".","")),oo=parseInt(eo.toFixed(no).replace(".",""));return io%oo/Math.pow(10,no)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(eo){if(this._def.coerce&&(eo.data=Number(eo.data)),this._getType(eo)!==ZodParsedType.number){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:io.parsedType}),INVALID}let ro;const no=new ParseStatus;for(const io of this._def.checks)io.kind==="int"?util$9.isInteger(eo.data)||(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:io.message}),no.dirty()):io.kind==="min"?(io.inclusive?eo.dataio.value:eo.data>=io.value)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:io.value,type:"number",inclusive:io.inclusive,exact:!1,message:io.message}),no.dirty()):io.kind==="multipleOf"?floatSafeRemainder(eo.data,io.value)!==0&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_multiple_of,multipleOf:io.value,message:io.message}),no.dirty()):io.kind==="finite"?Number.isFinite(eo.data)||(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_finite,message:io.message}),no.dirty()):util$9.assertNever(io);return{status:no.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,errorUtil.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,errorUtil.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,errorUtil.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,errorUtil.toString(to))}setLimit(eo,to,ro,no){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:errorUtil.toString(no)}]})}_addCheck(eo){return new ZodNumber({...this._def,checks:[...this._def.checks,eo]})}int(eo){return this._addCheck({kind:"int",message:errorUtil.toString(eo)})}positive(eo){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:errorUtil.toString(to)})}finite(eo){return this._addCheck({kind:"finite",message:errorUtil.toString(eo)})}safe(eo){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(eo)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(eo)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valueeo.kind==="int"||eo.kind==="multipleOf"&&util$9.isInteger(eo.value))}get isFinite(){let eo=null,to=null;for(const ro of this._def.checks){if(ro.kind==="finite"||ro.kind==="int"||ro.kind==="multipleOf")return!0;ro.kind==="min"?(to===null||ro.value>to)&&(to=ro.value):ro.kind==="max"&&(eo===null||ro.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(Xr==null?void 0:Xr.coerce)||!1,...processCreateParams(Xr)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(eo){if(this._def.coerce&&(eo.data=BigInt(eo.data)),this._getType(eo)!==ZodParsedType.bigint){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:io.parsedType}),INVALID}let ro;const no=new ParseStatus;for(const io of this._def.checks)io.kind==="min"?(io.inclusive?eo.dataio.value:eo.data>=io.value)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,type:"bigint",maximum:io.value,inclusive:io.inclusive,message:io.message}),no.dirty()):io.kind==="multipleOf"?eo.data%io.value!==BigInt(0)&&(ro=this._getOrReturnCtx(eo,ro),addIssueToContext(ro,{code:ZodIssueCode.not_multiple_of,multipleOf:io.value,message:io.message}),no.dirty()):util$9.assertNever(io);return{status:no.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,errorUtil.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,errorUtil.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,errorUtil.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,errorUtil.toString(to))}setLimit(eo,to,ro,no){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:errorUtil.toString(no)}]})}_addCheck(eo){return new ZodBigInt({...this._def,checks:[...this._def.checks,eo]})}positive(eo){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:errorUtil.toString(to)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...processCreateParams(Xr)})};class ZodBoolean extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=!!eo.data),this._getType(eo)!==ZodParsedType.boolean){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodBoolean.create=Xr=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(Xr==null?void 0:Xr.coerce)||!1,...processCreateParams(Xr)});class ZodDate extends ZodType{_parse(eo){if(this._def.coerce&&(eo.data=new Date(eo.data)),this._getType(eo)!==ZodParsedType.date){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:io.parsedType}),INVALID}if(isNaN(eo.data.getTime())){const io=this._getOrReturnCtx(eo);return addIssueToContext(io,{code:ZodIssueCode.invalid_date}),INVALID}const ro=new ParseStatus;let no;for(const io of this._def.checks)io.kind==="min"?eo.data.getTime()io.value&&(no=this._getOrReturnCtx(eo,no),addIssueToContext(no,{code:ZodIssueCode.too_big,message:io.message,inclusive:!0,exact:!1,maximum:io.value,type:"date"}),ro.dirty()):util$9.assertNever(io);return{status:ro.value,value:new Date(eo.data.getTime())}}_addCheck(eo){return new ZodDate({...this._def,checks:[...this._def.checks,eo]})}min(eo,to){return this._addCheck({kind:"min",value:eo.getTime(),message:errorUtil.toString(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo.getTime(),message:errorUtil.toString(to)})}get minDate(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo!=null?new Date(eo):null}get maxDate(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valuenew ZodDate({checks:[],coerce:(Xr==null?void 0:Xr.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(Xr)});class ZodSymbol extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.symbol){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodSymbol.create=Xr=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(Xr)});class ZodUndefined extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.undefined){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodUndefined.create=Xr=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(Xr)});class ZodNull extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.null){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodNull.create=Xr=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(Xr)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(eo){return OK(eo.data)}}ZodAny.create=Xr=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(Xr)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(eo){return OK(eo.data)}}ZodUnknown.create=Xr=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(Xr)});class ZodNever extends ZodType{_parse(eo){const to=this._getOrReturnCtx(eo);return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:to.parsedType}),INVALID}}ZodNever.create=Xr=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(Xr)});class ZodVoid extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.undefined){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:ro.parsedType}),INVALID}return OK(eo.data)}}ZodVoid.create=Xr=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(Xr)});class ZodArray extends ZodType{_parse(eo){const{ctx:to,status:ro}=this._processInputParams(eo),no=this._def;if(to.parsedType!==ZodParsedType.array)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:to.parsedType}),INVALID;if(no.exactLength!==null){const oo=to.data.length>no.exactLength.value,ao=to.data.lengthno.maxLength.value&&(addIssueToContext(to,{code:ZodIssueCode.too_big,maximum:no.maxLength.value,type:"array",inclusive:!0,exact:!1,message:no.maxLength.message}),ro.dirty()),to.common.async)return Promise.all([...to.data].map((oo,ao)=>no.type._parseAsync(new ParseInputLazyPath(to,oo,to.path,ao)))).then(oo=>ParseStatus.mergeArray(ro,oo));const io=[...to.data].map((oo,ao)=>no.type._parseSync(new ParseInputLazyPath(to,oo,to.path,ao)));return ParseStatus.mergeArray(ro,io)}get element(){return this._def.type}min(eo,to){return new ZodArray({...this._def,minLength:{value:eo,message:errorUtil.toString(to)}})}max(eo,to){return new ZodArray({...this._def,maxLength:{value:eo,message:errorUtil.toString(to)}})}length(eo,to){return new ZodArray({...this._def,exactLength:{value:eo,message:errorUtil.toString(to)}})}nonempty(eo){return this.min(1,eo)}}ZodArray.create=(Xr,eo)=>new ZodArray({type:Xr,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(eo)});function deepPartialify(Xr){if(Xr instanceof ZodObject){const eo={};for(const to in Xr.shape){const ro=Xr.shape[to];eo[to]=ZodOptional.create(deepPartialify(ro))}return new ZodObject({...Xr._def,shape:()=>eo})}else return Xr instanceof ZodArray?new ZodArray({...Xr._def,type:deepPartialify(Xr.element)}):Xr instanceof ZodOptional?ZodOptional.create(deepPartialify(Xr.unwrap())):Xr instanceof ZodNullable?ZodNullable.create(deepPartialify(Xr.unwrap())):Xr instanceof ZodTuple?ZodTuple.create(Xr.items.map(eo=>deepPartialify(eo))):Xr}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const eo=this._def.shape(),to=util$9.objectKeys(eo);return this._cached={shape:eo,keys:to}}_parse(eo){if(this._getType(eo)!==ZodParsedType.object){const co=this._getOrReturnCtx(eo);return addIssueToContext(co,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:co.parsedType}),INVALID}const{status:ro,ctx:no}=this._processInputParams(eo),{shape:io,keys:oo}=this._getCached(),ao=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const co in no.data)oo.includes(co)||ao.push(co);const so=[];for(const co of oo){const lo=io[co],uo=no.data[co];so.push({key:{status:"valid",value:co},value:lo._parse(new ParseInputLazyPath(no,uo,no.path,co)),alwaysSet:co in no.data})}if(this._def.catchall instanceof ZodNever){const co=this._def.unknownKeys;if(co==="passthrough")for(const lo of ao)so.push({key:{status:"valid",value:lo},value:{status:"valid",value:no.data[lo]}});else if(co==="strict")ao.length>0&&(addIssueToContext(no,{code:ZodIssueCode.unrecognized_keys,keys:ao}),ro.dirty());else if(co!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const co=this._def.catchall;for(const lo of ao){const uo=no.data[lo];so.push({key:{status:"valid",value:lo},value:co._parse(new ParseInputLazyPath(no,uo,no.path,lo)),alwaysSet:lo in no.data})}}return no.common.async?Promise.resolve().then(async()=>{const co=[];for(const lo of so){const uo=await lo.key;co.push({key:uo,value:await lo.value,alwaysSet:lo.alwaysSet})}return co}).then(co=>ParseStatus.mergeObjectSync(ro,co)):ParseStatus.mergeObjectSync(ro,so)}get shape(){return this._def.shape()}strict(eo){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...eo!==void 0?{errorMap:(to,ro)=>{var no,io,oo,ao;const so=(oo=(io=(no=this._def).errorMap)===null||io===void 0?void 0:io.call(no,to,ro).message)!==null&&oo!==void 0?oo:ro.defaultError;return to.code==="unrecognized_keys"?{message:(ao=errorUtil.errToObj(eo).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(eo){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...eo})})}merge(eo){return new ZodObject({unknownKeys:eo._def.unknownKeys,catchall:eo._def.catchall,shape:()=>({...this._def.shape(),...eo._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(eo,to){return this.augment({[eo]:to})}catchall(eo){return new ZodObject({...this._def,catchall:eo})}pick(eo){const to={};return util$9.objectKeys(eo).forEach(ro=>{eo[ro]&&this.shape[ro]&&(to[ro]=this.shape[ro])}),new ZodObject({...this._def,shape:()=>to})}omit(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{eo[ro]||(to[ro]=this.shape[ro])}),new ZodObject({...this._def,shape:()=>to})}deepPartial(){return deepPartialify(this)}partial(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{const no=this.shape[ro];eo&&!eo[ro]?to[ro]=no:to[ro]=no.optional()}),new ZodObject({...this._def,shape:()=>to})}required(eo){const to={};return util$9.objectKeys(this.shape).forEach(ro=>{if(eo&&!eo[ro])to[ro]=this.shape[ro];else{let io=this.shape[ro];for(;io instanceof ZodOptional;)io=io._def.innerType;to[ro]=io}}),new ZodObject({...this._def,shape:()=>to})}keyof(){return createZodEnum(util$9.objectKeys(this.shape))}}ZodObject.create=(Xr,eo)=>new ZodObject({shape:()=>Xr,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});ZodObject.strictCreate=(Xr,eo)=>new ZodObject({shape:()=>Xr,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});ZodObject.lazycreate=(Xr,eo)=>new ZodObject({shape:Xr,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(eo)});class ZodUnion extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.options;function no(io){for(const ao of io)if(ao.result.status==="valid")return ao.result;for(const ao of io)if(ao.result.status==="dirty")return to.common.issues.push(...ao.ctx.common.issues),ao.result;const oo=io.map(ao=>new ZodError(ao.ctx.common.issues));return addIssueToContext(to,{code:ZodIssueCode.invalid_union,unionErrors:oo}),INVALID}if(to.common.async)return Promise.all(ro.map(async io=>{const oo={...to,common:{...to.common,issues:[]},parent:null};return{result:await io._parseAsync({data:to.data,path:to.path,parent:oo}),ctx:oo}})).then(no);{let io;const oo=[];for(const so of ro){const co={...to,common:{...to.common,issues:[]},parent:null},lo=so._parseSync({data:to.data,path:to.path,parent:co});if(lo.status==="valid")return lo;lo.status==="dirty"&&!io&&(io={result:lo,ctx:co}),co.common.issues.length&&oo.push(co.common.issues)}if(io)return to.common.issues.push(...io.ctx.common.issues),io.result;const ao=oo.map(so=>new ZodError(so));return addIssueToContext(to,{code:ZodIssueCode.invalid_union,unionErrors:ao}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(Xr,eo)=>new ZodUnion({options:Xr,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(eo)});const getDiscriminator=Xr=>Xr instanceof ZodLazy?getDiscriminator(Xr.schema):Xr instanceof ZodEffects?getDiscriminator(Xr.innerType()):Xr instanceof ZodLiteral?[Xr.value]:Xr instanceof ZodEnum?Xr.options:Xr instanceof ZodNativeEnum?Object.keys(Xr.enum):Xr instanceof ZodDefault?getDiscriminator(Xr._def.innerType):Xr instanceof ZodUndefined?[void 0]:Xr instanceof ZodNull?[null]:null;class ZodDiscriminatedUnion extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.object)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:to.parsedType}),INVALID;const ro=this.discriminator,no=to.data[ro],io=this.optionsMap.get(no);return io?to.common.async?io._parseAsync({data:to.data,path:to.path,parent:to}):io._parseSync({data:to.data,path:to.path,parent:to}):(addIssueToContext(to,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ro]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(eo,to,ro){const no=new Map;for(const io of to){const oo=getDiscriminator(io.shape[eo]);if(!oo)throw new Error(`A discriminator value for key \`${eo}\` could not be extracted from all schema options`);for(const ao of oo){if(no.has(ao))throw new Error(`Discriminator property ${String(eo)} has duplicate value ${String(ao)}`);no.set(ao,io)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:eo,options:to,optionsMap:no,...processCreateParams(ro)})}}function mergeValues(Xr,eo){const to=getParsedType(Xr),ro=getParsedType(eo);if(Xr===eo)return{valid:!0,data:Xr};if(to===ZodParsedType.object&&ro===ZodParsedType.object){const no=util$9.objectKeys(eo),io=util$9.objectKeys(Xr).filter(ao=>no.indexOf(ao)!==-1),oo={...Xr,...eo};for(const ao of io){const so=mergeValues(Xr[ao],eo[ao]);if(!so.valid)return{valid:!1};oo[ao]=so.data}return{valid:!0,data:oo}}else if(to===ZodParsedType.array&&ro===ZodParsedType.array){if(Xr.length!==eo.length)return{valid:!1};const no=[];for(let io=0;io{if(isAborted(io)||isAborted(oo))return INVALID;const ao=mergeValues(io.value,oo.value);return ao.valid?((isDirty(io)||isDirty(oo))&&to.dirty(),{status:to.value,value:ao.data}):(addIssueToContext(ro,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return ro.common.async?Promise.all([this._def.left._parseAsync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseAsync({data:ro.data,path:ro.path,parent:ro})]).then(([io,oo])=>no(io,oo)):no(this._def.left._parseSync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseSync({data:ro.data,path:ro.path,parent:ro}))}}ZodIntersection.create=(Xr,eo,to)=>new ZodIntersection({left:Xr,right:eo,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(to)});class ZodTuple extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.array)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ro.parsedType}),INVALID;if(ro.data.lengththis._def.items.length&&(addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),to.dirty());const io=[...ro.data].map((oo,ao)=>{const so=this._def.items[ao]||this._def.rest;return so?so._parse(new ParseInputLazyPath(ro,oo,ro.path,ao)):null}).filter(oo=>!!oo);return ro.common.async?Promise.all(io).then(oo=>ParseStatus.mergeArray(to,oo)):ParseStatus.mergeArray(to,io)}get items(){return this._def.items}rest(eo){return new ZodTuple({...this._def,rest:eo})}}ZodTuple.create=(Xr,eo)=>{if(!Array.isArray(Xr))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:Xr,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(eo)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.object)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ro.parsedType}),INVALID;const no=[],io=this._def.keyType,oo=this._def.valueType;for(const ao in ro.data)no.push({key:io._parse(new ParseInputLazyPath(ro,ao,ro.path,ao)),value:oo._parse(new ParseInputLazyPath(ro,ro.data[ao],ro.path,ao))});return ro.common.async?ParseStatus.mergeObjectAsync(to,no):ParseStatus.mergeObjectSync(to,no)}get element(){return this._def.valueType}static create(eo,to,ro){return to instanceof ZodType?new ZodRecord({keyType:eo,valueType:to,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ro)}):new ZodRecord({keyType:ZodString.create(),valueType:eo,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(to)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.map)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:ro.parsedType}),INVALID;const no=this._def.keyType,io=this._def.valueType,oo=[...ro.data.entries()].map(([ao,so],co)=>({key:no._parse(new ParseInputLazyPath(ro,ao,ro.path,[co,"key"])),value:io._parse(new ParseInputLazyPath(ro,so,ro.path,[co,"value"]))}));if(ro.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of oo){const co=await so.key,lo=await so.value;if(co.status==="aborted"||lo.status==="aborted")return INVALID;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}})}else{const ao=new Map;for(const so of oo){const co=so.key,lo=so.value;if(co.status==="aborted"||lo.status==="aborted")return INVALID;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}}}}ZodMap.create=(Xr,eo,to)=>new ZodMap({valueType:eo,keyType:Xr,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(to)});class ZodSet extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==ZodParsedType.set)return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:ro.parsedType}),INVALID;const no=this._def;no.minSize!==null&&ro.data.sizeno.maxSize.value&&(addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:no.maxSize.value,type:"set",inclusive:!0,exact:!1,message:no.maxSize.message}),to.dirty());const io=this._def.valueType;function oo(so){const co=new Set;for(const lo of so){if(lo.status==="aborted")return INVALID;lo.status==="dirty"&&to.dirty(),co.add(lo.value)}return{status:to.value,value:co}}const ao=[...ro.data.values()].map((so,co)=>io._parse(new ParseInputLazyPath(ro,so,ro.path,co)));return ro.common.async?Promise.all(ao).then(so=>oo(so)):oo(ao)}min(eo,to){return new ZodSet({...this._def,minSize:{value:eo,message:errorUtil.toString(to)}})}max(eo,to){return new ZodSet({...this._def,maxSize:{value:eo,message:errorUtil.toString(to)}})}size(eo,to){return this.min(eo,to).max(eo,to)}nonempty(eo){return this.min(1,eo)}}ZodSet.create=(Xr,eo)=>new ZodSet({valueType:Xr,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(eo)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.function)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:to.parsedType}),INVALID;function ro(ao,so){return makeIssue({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,getErrorMap(),errorMap].filter(co=>!!co),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:so}})}function no(ao,so){return makeIssue({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,getErrorMap(),errorMap].filter(co=>!!co),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:so}})}const io={errorMap:to.common.contextualErrorMap},oo=to.data;if(this._def.returns instanceof ZodPromise){const ao=this;return OK(async function(...so){const co=new ZodError([]),lo=await ao._def.args.parseAsync(so,io).catch(go=>{throw co.addIssue(ro(so,go)),co}),uo=await Reflect.apply(oo,this,lo);return await ao._def.returns._def.type.parseAsync(uo,io).catch(go=>{throw co.addIssue(no(uo,go)),co})})}else{const ao=this;return OK(function(...so){const co=ao._def.args.safeParse(so,io);if(!co.success)throw new ZodError([ro(so,co.error)]);const lo=Reflect.apply(oo,this,co.data),uo=ao._def.returns.safeParse(lo,io);if(!uo.success)throw new ZodError([no(lo,uo.error)]);return uo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...eo){return new ZodFunction({...this._def,args:ZodTuple.create(eo).rest(ZodUnknown.create())})}returns(eo){return new ZodFunction({...this._def,returns:eo})}implement(eo){return this.parse(eo)}strictImplement(eo){return this.parse(eo)}static create(eo,to,ro){return new ZodFunction({args:eo||ZodTuple.create([]).rest(ZodUnknown.create()),returns:to||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(ro)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(eo){const{ctx:to}=this._processInputParams(eo);return this._def.getter()._parse({data:to.data,path:to.path,parent:to})}}ZodLazy.create=(Xr,eo)=>new ZodLazy({getter:Xr,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(eo)});class ZodLiteral extends ZodType{_parse(eo){if(eo.data!==this._def.value){const to=this._getOrReturnCtx(eo);return addIssueToContext(to,{received:to.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:eo.data}}get value(){return this._def.value}}ZodLiteral.create=(Xr,eo)=>new ZodLiteral({value:Xr,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(eo)});function createZodEnum(Xr,eo){return new ZodEnum({values:Xr,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(eo)})}class ZodEnum extends ZodType{_parse(eo){if(typeof eo.data!="string"){const to=this._getOrReturnCtx(eo),ro=this._def.values;return addIssueToContext(to,{expected:util$9.joinValues(ro),received:to.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._def.values.indexOf(eo.data)===-1){const to=this._getOrReturnCtx(eo),ro=this._def.values;return addIssueToContext(to,{received:to.data,code:ZodIssueCode.invalid_enum_value,options:ro}),INVALID}return OK(eo.data)}get options(){return this._def.values}get enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Values(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}extract(eo){return ZodEnum.create(eo)}exclude(eo){return ZodEnum.create(this.options.filter(to=>!eo.includes(to)))}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(eo){const to=util$9.getValidEnumValues(this._def.values),ro=this._getOrReturnCtx(eo);if(ro.parsedType!==ZodParsedType.string&&ro.parsedType!==ZodParsedType.number){const no=util$9.objectValues(to);return addIssueToContext(ro,{expected:util$9.joinValues(no),received:ro.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(to.indexOf(eo.data)===-1){const no=util$9.objectValues(to);return addIssueToContext(ro,{received:ro.data,code:ZodIssueCode.invalid_enum_value,options:no}),INVALID}return OK(eo.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(Xr,eo)=>new ZodNativeEnum({values:Xr,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(eo)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==ZodParsedType.promise&&to.common.async===!1)return addIssueToContext(to,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:to.parsedType}),INVALID;const ro=to.parsedType===ZodParsedType.promise?to.data:Promise.resolve(to.data);return OK(ro.then(no=>this._def.type.parseAsync(no,{path:to.path,errorMap:to.common.contextualErrorMap})))}}ZodPromise.create=(Xr,eo)=>new ZodPromise({type:Xr,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(eo)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo),no=this._def.effect||null,io={addIssue:oo=>{addIssueToContext(ro,oo),oo.fatal?to.abort():to.dirty()},get path(){return ro.path}};if(io.addIssue=io.addIssue.bind(io),no.type==="preprocess"){const oo=no.transform(ro.data,io);return ro.common.issues.length?{status:"dirty",value:ro.data}:ro.common.async?Promise.resolve(oo).then(ao=>this._def.schema._parseAsync({data:ao,path:ro.path,parent:ro})):this._def.schema._parseSync({data:oo,path:ro.path,parent:ro})}if(no.type==="refinement"){const oo=ao=>{const so=no.refinement(ao,io);if(ro.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(ro.common.async===!1){const ao=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});return ao.status==="aborted"?INVALID:(ao.status==="dirty"&&to.dirty(),oo(ao.value),{status:to.value,value:ao.value})}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(ao=>ao.status==="aborted"?INVALID:(ao.status==="dirty"&&to.dirty(),oo(ao.value).then(()=>({status:to.value,value:ao.value}))))}if(no.type==="transform")if(ro.common.async===!1){const oo=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});if(!isValid(oo))return oo;const ao=no.transform(oo.value,io);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:to.value,value:ao}}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(oo=>isValid(oo)?Promise.resolve(no.transform(oo.value,io)).then(ao=>({status:to.value,value:ao})):oo);util$9.assertNever(no)}}ZodEffects.create=(Xr,eo,to)=>new ZodEffects({schema:Xr,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:eo,...processCreateParams(to)});ZodEffects.createWithPreprocess=(Xr,eo,to)=>new ZodEffects({schema:eo,effect:{type:"preprocess",transform:Xr},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(to)});class ZodOptional extends ZodType{_parse(eo){return this._getType(eo)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}}ZodOptional.create=(Xr,eo)=>new ZodOptional({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(eo)});class ZodNullable extends ZodType{_parse(eo){return this._getType(eo)===ZodParsedType.null?OK(null):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}}ZodNullable.create=(Xr,eo)=>new ZodNullable({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(eo)});class ZodDefault extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo);let ro=to.data;return to.parsedType===ZodParsedType.undefined&&(ro=this._def.defaultValue()),this._def.innerType._parse({data:ro,path:to.path,parent:to})}removeDefault(){return this._def.innerType}}ZodDefault.create=(Xr,eo)=>new ZodDefault({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof eo.default=="function"?eo.default:()=>eo.default,...processCreateParams(eo)});class ZodCatch extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro={...to,common:{...to.common,issues:[]}},no=this._def.innerType._parse({data:ro.data,path:ro.path,parent:{...ro}});return isAsync(no)?no.then(io=>({status:"valid",value:io.status==="valid"?io.value:this._def.catchValue({get error(){return new ZodError(ro.common.issues)},input:ro.data})})):{status:"valid",value:no.status==="valid"?no.value:this._def.catchValue({get error(){return new ZodError(ro.common.issues)},input:ro.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(Xr,eo)=>new ZodCatch({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof eo.catch=="function"?eo.catch:()=>eo.catch,...processCreateParams(eo)});class ZodNaN extends ZodType{_parse(eo){if(this._getType(eo)!==ZodParsedType.nan){const ro=this._getOrReturnCtx(eo);return addIssueToContext(ro,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:ro.parsedType}),INVALID}return{status:"valid",value:eo.data}}}ZodNaN.create=Xr=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(Xr)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=to.data;return this._def.type._parse({data:ro,path:to.path,parent:to})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.common.async)return(async()=>{const io=await this._def.in._parseAsync({data:ro.data,path:ro.path,parent:ro});return io.status==="aborted"?INVALID:io.status==="dirty"?(to.dirty(),DIRTY(io.value)):this._def.out._parseAsync({data:io.value,path:ro.path,parent:ro})})();{const no=this._def.in._parseSync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?INVALID:no.status==="dirty"?(to.dirty(),{status:"dirty",value:no.value}):this._def.out._parseSync({data:no.value,path:ro.path,parent:ro})}}static create(eo,to){return new ZodPipeline({in:eo,out:to,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(eo){const to=this._def.innerType._parse(eo);return isValid(to)&&(to.value=Object.freeze(to.value)),to}}ZodReadonly.create=(Xr,eo)=>new ZodReadonly({innerType:Xr,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(eo)});const custom=(Xr,eo={},to)=>Xr?ZodAny.create().superRefine((ro,no)=>{var io,oo;if(!Xr(ro)){const ao=typeof eo=="function"?eo(ro):typeof eo=="string"?{message:eo}:eo,so=(oo=(io=ao.fatal)!==null&&io!==void 0?io:to)!==null&&oo!==void 0?oo:!0,co=typeof ao=="string"?{message:ao}:ao;no.addIssue({code:"custom",...co,fatal:so})}}):ZodAny.create(),late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(Xr){Xr.ZodString="ZodString",Xr.ZodNumber="ZodNumber",Xr.ZodNaN="ZodNaN",Xr.ZodBigInt="ZodBigInt",Xr.ZodBoolean="ZodBoolean",Xr.ZodDate="ZodDate",Xr.ZodSymbol="ZodSymbol",Xr.ZodUndefined="ZodUndefined",Xr.ZodNull="ZodNull",Xr.ZodAny="ZodAny",Xr.ZodUnknown="ZodUnknown",Xr.ZodNever="ZodNever",Xr.ZodVoid="ZodVoid",Xr.ZodArray="ZodArray",Xr.ZodObject="ZodObject",Xr.ZodUnion="ZodUnion",Xr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Xr.ZodIntersection="ZodIntersection",Xr.ZodTuple="ZodTuple",Xr.ZodRecord="ZodRecord",Xr.ZodMap="ZodMap",Xr.ZodSet="ZodSet",Xr.ZodFunction="ZodFunction",Xr.ZodLazy="ZodLazy",Xr.ZodLiteral="ZodLiteral",Xr.ZodEnum="ZodEnum",Xr.ZodEffects="ZodEffects",Xr.ZodNativeEnum="ZodNativeEnum",Xr.ZodOptional="ZodOptional",Xr.ZodNullable="ZodNullable",Xr.ZodDefault="ZodDefault",Xr.ZodCatch="ZodCatch",Xr.ZodPromise="ZodPromise",Xr.ZodBranded="ZodBranded",Xr.ZodPipeline="ZodPipeline",Xr.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(Xr,eo={message:`Input not instance of ${Xr.name}`})=>custom(to=>to instanceof Xr,eo),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$4={string:Xr=>ZodString.create({...Xr,coerce:!0}),number:Xr=>ZodNumber.create({...Xr,coerce:!0}),boolean:Xr=>ZodBoolean.create({...Xr,coerce:!0}),bigint:Xr=>ZodBigInt.create({...Xr,coerce:!0}),date:Xr=>ZodDate.create({...Xr,coerce:!0})},NEVER=INVALID;var z$9=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return util$9},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$4,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError});const walletConnectSourceValueSchema$1=z$9.object({app:z$9.object({android:z$9.string().nullable(),browser:z$9.string().nullable(),chrome:z$9.string().nullable(),edge:z$9.string().nullable(),firefox:z$9.string().nullable(),ios:z$9.string().nullable(),linux:z$9.string().nullable(),mac:z$9.string().nullable(),opera:z$9.string().nullable(),safari:z$9.string().nullable(),windows:z$9.string().nullable()}),app_type:z$9.string(),category:z$9.string().nullable(),chains:z$9.array(z$9.string()),description:z$9.string().nullable(),desktop:z$9.object({native:z$9.string().nullable(),universal:z$9.string().nullable()}),homepage:z$9.string(),id:z$9.string(),image_id:z$9.string(),image_url:z$9.object({lg:z$9.string(),md:z$9.string(),sm:z$9.string()}),injected:z$9.array(z$9.object({injected_id:z$9.string(),namespace:z$9.string()})).nullable(),metadata:z$9.object({colors:z$9.object({primary:z$9.string().nullable(),secondary:z$9.string().nullable()}),shortName:z$9.string().nullable()}),mobile:z$9.object({native:z$9.string().nullable(),universal:z$9.string().nullable()}),name:z$9.string(),rdns:z$9.string().nullable(),sdks:z$9.array(z$9.string()),slug:z$9.string(),supported_standards:z$9.array(z$9.object({id:z$9.string(),standard_id:z$9.number(),standard_prefix:z$9.string(),title:z$9.string(),url:z$9.string()})).optional(),updatedAt:z$9.string(),versions:z$9.array(z$9.string())}).strict();z$9.record(z$9.string(),walletConnectSourceValueSchema$1);const nonEmptyString$1=z$9.preprocess(Xr=>Xr||void 0,z$9.string().optional()),transformChromeExtensionId$1=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("chrome.google.com/webstore/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId$1=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId$1=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr!=null&&Xr.includes("addons.mozilla.org"))try{return new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex$1=/^id[0-9]{1,36}$/,transformIosId$1=Xr=>{if(Xr!=null&&Xr.match(idRegex$1))return Xr;if(Xr!=null&&Xr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const to=new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1);if(to!=null&&to.match(idRegex$1))return to}catch{}},transformAndroidId$1=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr)try{const to=new URL(Xr).searchParams.get("id");if(to)return to}catch{}},nonEmptyStringArray$1=z$9.preprocess(Xr=>Array.isArray(Xr)&&Xr.length>0?Xr:void 0,z$9.array(z$9.string()).optional()),filterEmptyObject$1=Xr=>Xr&&Object.values(Xr).some(eo=>!!eo)?Xr:void 0,injectedConfigSchema$1=z$9.object({chain:z$9.string(),extensionLocators:z$9.array(z$9.object({flag:z$9.string(),value:z$9.boolean().optional().default(!0)})),providerInterface:z$9.string().optional(),walletStandard:z$9.object({features:z$9.array(z$9.string()),name:z$9.string(),providerId:z$9.string().optional()}).optional(),walletStandardLocators:z$9.array(z$9.object({locator:z$9.string(),name:z$9.string()})).optional(),windowLocations:z$9.array(z$9.string()).optional().refine(Xr=>!Xr||!Xr.some(eo=>["ethereum","ethereum.providers"].includes(eo)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema$1=z$9.object({alt:nonEmptyString$1,primaryColor:nonEmptyString$1,spriteId:nonEmptyString$1}),walletSchema$1=z$9.preprocess(Xr=>Xr,z$9.object({brand:brandSchema$1.optional(),chainGroup:z$9.string().optional(),chains:z$9.array(z$9.string()).optional(),desktop:z$9.object({chromeId:nonEmptyString$1.transform(transformChromeExtensionId$1),edgeId:nonEmptyString$1.transform(transformEdgeExtensionId$1),firefoxId:nonEmptyString$1.transform(transformFirefoxExtensionId$1),native:nonEmptyString$1,operaId:nonEmptyString$1,safariId:nonEmptyString$1,universal:nonEmptyString$1}).optional().transform(filterEmptyObject$1),eip6963Config:z$9.object({rdns:z$9.string()}).optional(),filterFromWalletConnect:z$9.boolean().optional(),group:z$9.string().optional(),hardwareWallets:z$9.array(z$9.string()).optional(),injectedConfig:z$9.array(injectedConfigSchema$1).optional(),mobile:z$9.object({android:stringType().nullish(),androidId:nonEmptyString$1.transform(transformAndroidId$1),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString$1.transform(transformIosId$1),native:nonEmptyString$1,universal:nonEmptyString$1}).optional().transform(filterEmptyObject$1),mobileExperience:z$9.enum(["in-app-browser","redirect"]).optional(),name:z$9.string(),shortName:nonEmptyString$1,showOnlyIfInstalled:z$9.boolean().optional(),switchNetworkOnlyFromWallet:z$9.boolean().optional(),walletConnect:z$9.object({sdks:nonEmptyStringArray$1}).optional().transform(filterEmptyObject$1),walletGroup:z$9.string().optional(),walletLimitations:z$9.object({browserExtension:z$9.object({unsupportedEvents:z$9.array(z$9.string()).optional(),unsupportedMethods:z$9.array(z$9.string()).optional()}).optional(),mobile:z$9.object({unsupportedEvents:z$9.array(z$9.string()).optional(),unsupportedMethods:z$9.array(z$9.string()).optional()}).optional()}).optional()})).transform(Xr=>{var eo,to,ro,no,io,oo;return Xr.group&&(Xr.chainGroup=Xr.group),(!((eo=Xr.mobile)===null||eo===void 0)&&eo.iosId||((to=Xr.mobile)===null||to===void 0?void 0:to.ios)===null)&&((ro=Xr.mobile)===null||ro===void 0||delete ro.ios),(!((no=Xr.mobile)===null||no===void 0)&&no.androidId||((io=Xr.mobile)===null||io===void 0?void 0:io.android)===null)&&((oo=Xr.mobile)===null||oo===void 0||delete oo.android),Xr}),WalletOverrideEntrySchema$1=z$9.object({brand:brandSchema$1.optional(),name:nonEmptyString$1}),walletGroupSchema$1=z$9.object({brand:z$9.object({alt:nonEmptyString$1,primaryColor:nonEmptyString$1,spriteId:nonEmptyString$1}).optional(),key:z$9.string(),name:z$9.string(),walletOverrides:z$9.record(WalletOverrideEntrySchema$1).optional()});z$9.record(z$9.string(),walletSchema$1);const walletBookSchema=z$9.preprocess(Xr=>Xr,z$9.object({groups:z$9.record(z$9.string(),walletGroupSchema$1),wallets:z$9.record(z$9.string(),walletSchema$1)}));z$9.record(z$9.string(),walletGroupSchema$1);var groups={argentx:{brand:{alt:"ArgentX",primaryColor:"#FF875B",spriteId:"argentx"},key:"argentx",name:"ArgentX"},backpack:{brand:{alt:"Backpack",spriteId:"backpack"},key:"backpack",name:"Backpack"},bitgetwallet:{brand:{alt:"Bitget Wallet",spriteId:"bitget"},key:"bitgetwallet",name:"Bitget"},blocto:{brand:{alt:"Blocto",primaryColor:"#5E678A",spriteId:"blocto"},key:"blocto",name:"Blocto"},brave:{brand:{alt:"Brave Browser",primaryColor:"#4B49C6",spriteId:"brave"},key:"brave",name:"Brave"},coin98:{brand:{alt:"Coin98 Wallet",primaryColor:"#CDA349",spriteId:"fc460647-ea95-447a-99f0-1bff8fa4be00"},key:"coin98",name:"Coin98"},coinbase:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},key:"coinbase",name:"Coinbase"},compasswallet:{brand:{alt:"Compass",primaryColor:"#4B49C6",spriteId:"1d7dea00-96be-4ce8-ca15-d14bddbb5000"},key:"compasswallet",name:"Compass"},exodus:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},key:"exodus",name:"Exodus"},keplr:{brand:{alt:"Keplr",spriteId:"keplr"},key:"keplr",name:"Keplr"},magiceden:{brand:{alt:"Magic Eden",spriteId:"magiceden"},key:"magiceden",name:"Magic Eden"},mathwallet:{brand:{alt:"MathWallet Wallet",spriteId:"26a8f588-3231-4411-60ce-5bb6b805a700"},key:"mathwallet",name:"Math Wallet"},metamask:{brand:{alt:"MetaMask",primaryColor:"#E2761B",spriteId:"metamask"},key:"metamask",name:"MetaMask"},okxwallet:{brand:{alt:"OKX Wallet",spriteId:"okx"},key:"okxwallet",name:"OKX Wallet"},onekey:{brand:{alt:"OneKey Wallet",spriteId:"12bebb3f-8030-4892-8452-c60a6bac1500"},key:"onekey",name:"OneKey"},phantom:{brand:{alt:"Phantom",primaryColor:"#4B49C6",spriteId:"phantom"},key:"phantom",name:"Phantom"}},wallets$1={metamask:{brand:{alt:"MetaMask Wallet",primaryColor:"#E8831D",spriteId:"metamask"},chainGroup:"metamask",chains:["eip155:1"],desktop:{chromeId:"nkbihfbeogaeaoehlefnkodbefgpgknn",edgeId:"ejbalbakoplchlghecdalmeeeajnimhm",firefoxId:"ether-metamask"},eip6963Config:{rdns:"io.metamask"},filterFromWalletConnect:!0,group:"metamask",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isMetaMask",value:!0},{flag:"isDawn",value:!1},{flag:"isBraveWallet",value:!1},{flag:"isTrustWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isZerion",value:!1},{flag:"isSuperb",value:!1},{flag:"isRabby",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1},{flag:"isRainbow",value:!1},{flag:"isAvalanche",value:!1},{flag:"isMagicEden",value:!1},{flag:"isZerion",value:!1},{flag:"isOneKey",value:!1},{flag:"isPhantom",value:!1},{flag:"isCoin98",value:!1},{flag:"isBinance",value:!1}]}],mobile:{androidId:"io.metamask",inAppBrowser:"https://metamask.app.link/dapp",iosId:"id1438144202",native:"metamask://wc",universal:"https://metamask.app.link/wc"},mobileExperience:"in-app-browser",name:"MetaMask",shortName:"MetaMask",walletConnect:{sdks:["sign_v1","sign_v2"]}},coinbase:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},chainGroup:"coinbase",desktop:{chromeId:"hnfanknocfeofbddgcijnmhnfnkdnaad"},eip6963Config:{rdns:"com.coinbase.wallet"},group:"coinbase",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isCoinbaseWallet",value:!0}],windowLocations:["coinbaseWalletExtension"]}],mobile:{androidId:"org.toshi",iosId:"id1278383455"},name:"Coinbase",shortName:"Coinbase Wallet"},coinbasesolana:{brand:{alt:"Coinbase Wallet",primaryColor:"#1648F9",spriteId:"coinbase"},chainGroup:"coinbase",desktop:{chromeId:"hnfanknocfeofbddgcijnmhnfnkdnaad"},group:"coinbase",injectedConfig:[{chain:"sol",extensionLocators:[],windowLocations:["coinbaseSolana"]}],name:"Coinbase",shortName:"Coinbase Wallet (Solana)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},phantom:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isBraveWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isMagicEden",value:!1},{flag:"isGlow",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1}],walletStandardLocators:[{locator:"features.phantom:.phantom",name:"Phantom"}],windowLocations:["phantom.solana"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom"},phantombtc:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"btc",extensionLocators:[{flag:"isPhantom",value:!0}],walletStandard:{features:["bitcoin:connect"],name:"Phantom"},windowLocations:["phantom.bitcoin"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (Bitcoin)"},phantomevm:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isPhantom",value:!0}],windowLocations:["phantom.ethereum"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (EVM)"},phantomledger:{brand:{alt:"Phantom Wallet",primaryColor:"#4B49C6",spriteId:"phantom"},chainGroup:"phantom",desktop:{chromeId:"bfnaelmomeimhlpmgjnjophhpkkoljpa",firefoxId:"phantom-app"},group:"phantom",injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isBraveWallet",value:!1},{flag:"isExodus",value:!1},{flag:"isMagicEden",value:!1},{flag:"isGlow",value:!1},{flag:"isOKExWallet",value:!1},{flag:"isOkxWallet",value:!1}],walletStandardLocators:[{locator:"features.phantom:.phantom",name:"Phantom"}],windowLocations:["phantom.solana"]}],mobile:{androidId:"app.phantom",iosId:"id1598432977"},name:"Phantom",shortName:"Phantom (Ledger)"},walletconnect:{brand:{alt:"WalletConnect",primaryColor:"#3182CE",spriteId:"walletconnect"},mobile:{androidId:"enable-android",iosId:"id1438144202"},name:"WalletConnect",shortName:"WalletConnect"},argentx:{brand:{alt:"Argent X Wallet",primaryColor:"#FF875B",spriteId:"argentx"},desktop:{chromeId:"dlcobpjiigpikoobohmabehhmhfoodbb",edgeId:"ajcicjlkibolbeaaagejfhnofogocgcj",firefoxId:"argent-x"},mobile:{androidId:"im.argent.contractwalletclient",iosId:"id1358741926"},name:"Argent X"},perawallet:{brand:{alt:"Pera Wallet",spriteId:"pera"},mobile:{androidId:"com.algorand.android",iosId:"id1459898525"},name:"Pera Wallet"},blocto:{brand:{alt:"Blocto Wallet",primaryColor:"#5E678A",spriteId:"blocto"},chainGroup:"blocto",group:"blocto",mobile:{androidId:"com.portto.blocto",iosId:"id1481181682"},name:"Blocto",shortName:"Blocto (Flow)"},solflare:{brand:{alt:"Solflare Wallet",primaryColor:"#FC7227",spriteId:"solflare"},chains:["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"],desktop:{chromeId:"bhhhlbepdkbapadjdnnojkbgioiodbic"},filterFromWalletConnect:!0,hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isSolflare",value:!0}],windowLocations:["solflare"]}],mobile:{androidId:"com.solflare.mobile",iosId:"id1580902717"},name:"Solflare",walletConnect:{sdks:["sign_v1"]},walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},braavos:{brand:{alt:"Braavos Wallet",primaryColor:"#FABB38",spriteId:"braavos"},desktop:{chromeId:"jnlgamecbpmbajjfhmmmlhejkemejdma",edgeId:"hkkpjehhcnhgefhbdcgfkeegglpjchdc",firefoxId:"braavos-wallet"},mobile:{androidId:"app.braavos.wallet",iosId:"id1636013523"},name:"Braavos"},trust:{brand:{alt:"Trust Wallet",primaryColor:"#0500FF",spriteId:"7677b54f-3486-46e2-4e37-bf8747814f00"},chains:["cosmos:cosmoshub-4","cosmos:kava-4","cosmos:thorchain-mainnet-v1","eip155:1","eip155:10","eip155:100","eip155:108","eip155:1101","eip155:128","eip155:137","eip155:2020","eip155:288","eip155:321","eip155:324","eip155:361","eip155:42161","eip155:42220","eip155:43114","eip155:4689","eip155:56","eip155:56288","eip155:59144","eip155:60","eip155:820","eip155:88","eip155:9001","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"egjidjbpglichdcondbcbdnbeeppgdph"},eip6963Config:{rdns:"com.trustwallet.app"},filterFromWalletConnect:!0,injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isTrustWallet",value:!0}],windowLocations:["trustWallet"]}],mobile:{androidId:"com.wallet.crypto.trustapp",iosId:"id1288339409",native:"trust://wc",universal:"https://link.trustwallet.com/wc"},name:"Trust",shortName:"Trust",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},rainbow:{brand:{alt:"Rainbow Wallet",primaryColor:"#001e59",spriteId:"rainbow"},chains:["eip155:1","eip155:10","eip155:137","eip155:42161","eip155:56","eip155:7777777","eip155:8453"],desktop:{chromeId:"opfgelmcmbiajamepnmloijbpoleiama",edgeId:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefoxId:"rainbow-extension"},eip6963Config:{rdns:"me.rainbow"},filterFromWalletConnect:!0,injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isRainbow",value:!0}],windowLocations:["rainbow"]}],mobile:{androidId:"me.rainbow",iosId:"id1457119021",native:"rainbow://wc",universal:"https://rnbwapp.com/wc"},name:"Rainbow",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},dapper:{brand:{alt:"Dapper Wallet",primaryColor:"#762FBE",spriteId:"dapper"},mobile:{android:"fake-to-get-dapper-to-appear",ios:"fake-to-get-dapper-to-appear"},name:"Dapper"},glow:{brand:{alt:"Glow Wallet",spriteId:"glow"},desktop:{chromeId:"ojbcfhjmpigfobfclfflafhblgemeidi",edgeId:"niihfokdlimbddhfmngnplgfcgpmlido",firefoxId:"glow-solana-wallet"},hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isGlow",value:!0}],windowLocations:["glowSolana"]}],name:"Glow"},lilico:{brand:{alt:"Lilico Wallet",spriteId:"lilico"},desktop:{chromeId:"hpclkefagolihohboafpheddmmgdffjm"},filterFromWalletConnect:!0,name:"Lilico"},magicemailotp:{brand:{alt:"Magic Email OTP",spriteId:"magiclink"},name:"Magic Email OTP"},magiclink:{brand:{alt:"Magic Link",spriteId:"magiclink"},name:"Magic Link"},magicsocial:{brand:{alt:"Magic Social",spriteId:"magiclink"},name:"Magic Social"},magiceden:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",chains:["eip155:1","eip155:137","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},eip6963Config:{rdns:"io.magiceden.wallet"},filterFromWalletConnect:!0,group:"magiceden",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isMagicEden",value:!0}],windowLocations:["magicEden.ethereum"]}],mobile:{androidId:"com.magiceden.wallet",iosId:"id6478631482",native:"magiceden://wc"},name:"Magic Eden"},magicedenbtc:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},group:"magiceden",hardwareWallets:["ledger"],injectedConfig:[{chain:"btc",extensionLocators:[],walletStandard:{features:["sats-connect:"],name:"Magic Eden"},windowLocations:["magicEden.bitcoin"]}],mobile:{androidId:"com.magiceden.wallet",inAppBrowser:"magiceden://browser/{{encodedDappURI}}",iosId:"id6478631482",universal:"https://magiceden.io/browser/{{encodedDappURI}}"},name:"Magic Eden",shortName:"Magic Eden (Bitcoin)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},magicedensol:{brand:{alt:"Magic Eden",spriteId:"magiceden"},chainGroup:"magiceden",desktop:{chromeId:"mkpegjkblkkefacfnmkajcjmabijhclg"},group:"magiceden",hardwareWallets:["ledger"],injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isMagicEden",value:!0}],windowLocations:["magicEden.solana"]}],name:"Magic Eden",shortName:"Magic Eden (Solana)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},exodus:{brand:{alt:"Exodus Wallet",spriteId:"4c16cad4-cac9-4643-6726-c696efaf5200"},chainGroup:"exodus",chains:["eip155:1","eip155:137","eip155:43114","eip155:56","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},filterFromWalletConnect:!0,group:"exodus",mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820",native:"exodus://wc",universal:"https://exodus.com/m/wc"},name:"Exodus",walletConnect:{sdks:["sign_v1","sign_v2","auth_v1"]}},exodusevm:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},chainGroup:"exodus",chains:["eip155:1","eip155:137","eip155:43114","eip155:56"],desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},filterFromWalletConnect:!0,group:"exodus",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isExodus",value:!0}]}],mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820",native:"exodus://wc"},name:"Exodus",shortName:"Exodus Wallet (EVM)",walletConnect:{sdks:["sign_v2","auth_v1"]}},exodussol:{brand:{alt:"Exodus Wallet",spriteId:"exodus"},chainGroup:"exodus",desktop:{chromeId:"aholpfdialjgjfhomihkjbmgjidlcdno"},group:"exodus",injectedConfig:[{chain:"sol",extensionLocators:[{flag:"isPhantom",value:!0},{flag:"isExodus",value:!0}],windowLocations:["exodus.solana"]}],mobile:{androidId:"exodusmovement.exodus",iosId:"id1414384820"},name:"Exodus",shortName:"Exodus Wallet (Solana)"},okxwallet:{brand:{alt:"OKX Wallet",spriteId:"okx"},chainGroup:"okxwallet",chains:["eip155:1","eip155:137","eip155:43114","eip155:56","eip155:66","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"mcohilncbfahbmgdjkbpemcciiolgcge"},eip6963Config:{rdns:"com.okex.wallet"},filterFromWalletConnect:!0,group:"okxwallet",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isOKExWallet",value:!0},{flag:"isOkxWallet",value:!0}],windowLocations:["okxwallet"]}],mobile:{androidId:"com.okinc.okex.gp",iosId:"id1327268470",native:"okex://main/wc"},name:"OKX",shortName:"OKX Wallet",walletConnect:{sdks:["sign_v2"]}},backpack:{brand:{alt:"Backpack",primaryColor:"#e43c3c",spriteId:"backpack"},chainGroup:"backpack",chains:["eip155:1","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],desktop:{chromeId:"aflkmfhebedbjioipglgcbcmnbpgliof"},eip6963Config:{rdns:"app.backpack"},filterFromWalletConnect:!0,group:"backpack",injectedConfig:[{chain:"evm",extensionLocators:[{flag:"isBackpack",value:!0}],windowLocations:[]}],name:"Backpack",walletConnect:{sdks:["sign_v1"]}},okxwalletbtc:{brand:{alt:"OKX Wallet",spriteId:"okx"},chainGroup:"okxwallet",desktop:{chromeId:"mcohilncbfahbmgdjkbpemcciiolgcge"},group:"okxwallet",injectedConfig:[{chain:"btc",extensionLocators:[],windowLocations:["okxwallet.bitcoin"]}],mobile:{androidId:"com.okinc.okex.gp",inAppBrowser:"okx://wallet/dapp/url?dappUrl={{encodedDappURI}}",iosId:"id1327268470"},name:"OKX",shortName:"OKX Wallet (Bitcoin)",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},unisat:{brand:{alt:"UniSat",spriteId:"unisat"},desktop:{chromeId:"ppbibelpcjmhbdihakflkdcoccbgbkpo"},injectedConfig:[{chain:"btc",extensionLocators:[],windowLocations:["unisat"]}],name:"UniSat"},unknown:{brand:{spriteId:"captcha-wave"},mobile:{androidId:"enable-android",iosId:"id1234567890"},name:"Unknown Wallet",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}},xverse:{brand:{alt:"Xverse Wallet",spriteId:"xverse"},desktop:{chromeId:"idnnbdplmphpflfnlkomgpfbpcgelopg"},hardwareWallets:["ledger"],injectedConfig:[{chain:"btc",extensionLocators:[],walletStandard:{features:["sats-connect:"],name:"Xverse",providerId:"XverseProviders.BitcoinProvider"},windowLocations:["XverseProviders.BitcoinProvider"]}],mobile:{androidId:"com.secretkeylabs.xverse",inAppBrowser:"xverse://browser?url={{encodedDappURI}}",iosId:"id1552272513"},name:"Xverse",walletLimitations:{browserExtension:{unsupportedEvents:["accountChanged"],unsupportedMethods:["getConnectedAccounts"]}}},fallbackconnector:{brand:{spriteId:"captcha-wave"},mobile:{androidId:"enable-android",iosId:"id1234567890"},name:"Fallback Connector",walletLimitations:{browserExtension:{unsupportedMethods:["getConnectedAccounts"]}}}},walletBookFallbacks={groups,wallets:wallets$1};const useWalletBookCdn=()=>{const[Xr,eo]=reactExports.useState({});return reactExports.useEffect(()=>{__awaiter$n(void 0,void 0,void 0,function*(){const ro=getWalletBookCdnUrl(),io=yield retryableFn(()=>__awaiter$n(void 0,void 0,void 0,function*(){const oo=yield fetch(ro,{mode:"cors"});if(oo.ok){const ao=yield oo.json();try{return walletBookSchema.parse(ao)}catch(so){throw logger$b.error("Error parsing wallet book data",so,ao),so}}throw new Error(`Failed to fetch wallet book data from ${ro} with status code ${oo.status}`)}),{fallbackValue:walletBookSchema.parse(walletBookFallbacks),logger:logger$b.createLogger("useWalletBookCdn"),maxRetries:3,retryStrategy:"timeout-and-rejection",timeoutMs:3e4});eo(io)})},[]),Xr},WalletIcon=Xr=>{var{walletKey:eo,children:to}=Xr,ro=__rest$8(Xr,["walletKey","children"]);const{walletBook:no}=useWalletBookContext(),io=findWalletBookWallet(no,eo),[oo,ao]=reactExports.useState(!1),so=getWalletIconUrl(no,eo),co=getDefaultWalletIconUrl();if(!io||!io.brand||!so)return reactExports.createElement(reactExports.Fragment,{},to);const lo=()=>{ao(!0)};return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`wallet-icon-${eo}`},ro),{alt:io.brand.alt,onError:lo,src:oo?co:so}),to)},WalletBookContextProvider=({walletBook:Xr,children:eo})=>reactExports.createElement(WalletBookContext.Provider,{value:{walletBook:Xr}},eo),BrandIcon=Xr=>{var{brand:eo,walletKey:to}=Xr,ro=__rest$8(Xr,["brand","walletKey"]);const[no,io]=reactExports.useState(!1),oo=getBrandIconUrl(eo),ao=getDefaultWalletIconUrl();if(!oo)return reactExports.createElement(reactExports.Fragment,{});const so=()=>{io(!0)};return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`wallet-icon-${to}`},ro),{alt:eo.alt,onError:so,src:no?ao:oo}))};assertPackageVersion("@dynamic-labs/wallet-book",version$q);const logger$9=new Logger$2("WalletConnector"),shouldLowercaseAddress$1=Xr=>["eip155","flow","evm","eth","avax","matic"].includes(Xr.toLowerCase()),normalizeAddress$1=(Xr,eo)=>(Xr.startsWith("0x")&&(Xr=Xr.slice(2)),shouldLowercaseAddress$1(eo)?Xr.toLowerCase():Xr),isSameAddress$1=(Xr,eo,to)=>normalizeAddress$1(Xr,to)===normalizeAddress$1(eo,to),getMobileExperience=({mobileExperienceProp:Xr,walletBook:eo,walletKey:to})=>{if(Xr&&typeof Xr=="string")return Xr;if(Xr!=null&&Xr[to])return Xr[to];const ro=findWalletBookWallet(eo,to);return ro!=null&&ro.mobileExperience?ro.mobileExperience:Xr!=null&&Xr.default?Xr.default:"in-app-browser"},isConnectorMethodSupported=(Xr,eo,to)=>{const ro=Xr.constructorProps.walletData||getWalletBookWallet(Xr.walletBook,Xr.key);return isWalletMethodSupported(ro,eo,to)};class WalletBookSingleton{constructor(eo){this.walletBook=eo}static getOrCreate(eo){var to;return!((to=WalletBookSingleton.instance)===null||to===void 0)&&to.walletBook||(WalletBookSingleton.instance=new WalletBookSingleton(eo)),WalletBookSingleton.instance}}const walletConnectorEvents=new EventEmitter$3;var _WalletConnectorBase_registeredExtensions;class WalletConnectorBase extends EventEmitter$3{createWallet(eo){return new this.ChainWallet(eo)}constructor(eo){if(super(),this.chainRpcProviders=void 0,this.isGlobalTransaction=!1,_WalletConnectorBase_registeredExtensions.set(this,[]),this.didSetup=!1,this.requiresNonDynamicEmailOtp=!1,this.canConnectViaCustodialService=!1,this.canConnectViaQrCode=!1,this.canConnectViaSocial=!1,this.isAvailable=!0,this.isEmbeddedWallet=!1,this.isWalletConnect=!1,this.overrideKey=void 0,this.providerResources=void 0,this.switchNetworkOnlyFromWallet=void 0,this.isInitialized=!0,this.constructorProps=eo,this._walletBookInstance=WalletBookSingleton.getOrCreate(eo.walletBook),this._metadata=eo.metadata,this.walletConnectorEventsEmitter=this.constructorProps.walletConnectorEventsEmitter||walletConnectorEvents,this.walletBook===void 0)throw new Error("WalletConnectorBase was not called with super(props) and is missing wallet-book")}extend(eo){if(__classPrivateFieldGet$6(this,_WalletConnectorBase_registeredExtensions,"f").includes(eo.name))throw new Error(`You can only register a single extension of: ${eo.name}`);eo.name==="global-wallet-extension"&&(!this.isEmbeddedWallet||!this.supportedChains.includes("EVM"))||(__classPrivateFieldGet$6(this,_WalletConnectorBase_registeredExtensions,"f").push(eo.name),eo.extend(this))}initEventListener(){this.didSetup||(this.didSetup=!0,this.setupEventListeners())}get walletBook(){return this._walletBookInstance.walletBook}filter(){try{return getWalletBookWallet(this.walletBook,this.key,this.walletFallback),!0}catch{return!1}}get mobileExperience(){return getMobileExperience({mobileExperienceProp:this.constructorProps.mobileExperience,walletBook:this.walletBook,walletKey:this.key})}chooseAccountsToConnect(){return Promise.resolve([])}connect(){return __awaiter$o(this,void 0,void 0,function*(){yield this.getAddress()})}endSession(){return Promise.resolve()}getAddress(eo){return Promise.resolve(void 0)}parseAddress(eo){return eo}isTestnet(){return Promise.resolve(!1)}getAdditionalAddresses(eo){return Promise.resolve([])}setAdditionalAddresses(eo,to){return Promise.resolve()}getBalance(eo){return Promise.resolve(void 0)}getConnectedAccounts(){return Promise.resolve([])}getDeepLink(){}getNetwork(){return Promise.resolve(void 0)}getNameService(eo){return Promise.resolve(void 0)}getPublicClient(){return Promise.resolve(void 0)}getSession(){return __awaiter$o(this,void 0,void 0,function*(){return Promise.resolve()})}getSigner(){return Promise.resolve(void 0)}getWalletClient(eo){}init(){return Promise.resolve()}isInstalledOnBrowser(){return!1}get key(){return this.overrideKey||this.name.replace(/\W/g,"").toLowerCase()}get metadata(){var eo;return(eo=this._metadata)!==null&&eo!==void 0?eo:{id:this.key}}getMobileOrInstalledWallet(){return this}proveOwnership(eo,to){return __awaiter$o(this,void 0,void 0,function*(){return yield this.validateActiveWallet(eo),this.signMessage(to)})}setupEventListeners(){}signMessage(eo,to){return Promise.resolve(void 0)}supportsNetworkSwitching(){return!1}switchNetwork({networkName:eo,networkChainId:to}){return Promise.resolve(void 0)}teardownEventListeners(){}setVerifiedCredentials(eo){}canGetChainAddress(){return!0}handleWalletNotActive(eo){return __awaiter$o(this,arguments,void 0,function*({activeAddress:to,expectedAddress:ro,reconnectedAddress:no}){logger$9.debug("validateActiveWallet - wallet is not active",{activeAddress:to,expectedAddress:ro,reconnectedAddress:no});const io=to||no||"",oo=this.constructorProps.walletUiUtils;if(!oo)throw new WalletAddressMismatchError(`Wallet ${ro??""} is not currently active in ${this.name||this.key}.`,{activeAddress:io,expectedAddress:ro,walletName:this.name||this.key});return oo.syncWallet({activeAddress:io,expectedAddress:ro,walletConnector:this})})}validateActiveWallet(eo){return __awaiter$o(this,void 0,void 0,function*(){logger$9.debug("validateActiveWallet - validating wallet",eo);const to=isConnectorMethodSupported(this,"getConnectedAccounts","browserExtension");logger$9.debug("validateActiveWallet - getting connected accounts",{canFetchConnectedAccounts:to});const[ro]=to?yield this.getConnectedAccounts():[];if(ro&&isSameAddress$1(ro,eo,this.connectedChain)){logger$9.debug("validateActiveWallet - wallet is active");return}logger$9.debug("validateActiveWallet - trying to reconnect wallet...");const oo=yield __awaiter$o(this,void 0,void 0,function*(){if(!(this.isWalletConnect||!this.canGetChainAddress()))return this.getAddress().catch(ao=>{logger$9.debug("validateActiveWallet - error getting address",ao)})});if(oo&&isSameAddress$1(oo,eo,this.connectedChain)){logger$9.debug("validateActiveWallet - wallet reconnected successfuly");return}return this.handleWalletNotActive({activeAddress:ro,expectedAddress:eo,reconnectedAddress:oo})})}}_WalletConnectorBase_registeredExtensions=new WeakMap;let Wallet$1=class extends BaseWallet{constructor(eo){var{connector:to}=eo,ro=__rest$a(eo,["connector"]);super(ro),this._connector=to}get connector(){return this._connector}getBalance(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter$o(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(to=>normalizeAddress$1(to,this.chain)).includes(normalizeAddress$1(this.address,this.chain))}catch(eo){return logger$9.error("[Wallet] isConnected - Error detecting if wallet is connected",eo),!1}})}proveOwnership(eo){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,eo)})}signMessage(eo){return __awaiter$o(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(eo,this.address)})}switchNetwork(eo){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:eo})})}sync(){return __awaiter$o(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}};const ProviderLookup=(Xr,eo)=>{if(eo.length!==0)return Xr.find(to=>eo.every(no=>((to==null?void 0:to[no.flag])||!1)===no.value)===!0)},chainsInfo=[{blockchainName:"Algorand",displayName:"Algorand",name:"algorand",symbol:"ALGO"},{blockchainName:"Bitcoin",displayName:"Bitcoin",name:"bitcoin",symbol:"BTC"},{blockchainName:"Ethereum",displayName:"EVM",name:"evm",symbol:"ETH"},{blockchainName:"Flow",displayName:"Flow",name:"flow",symbol:"FLOW"},{blockchainName:"Solana",displayName:"Solana",name:"solana",symbol:"SOL"},{blockchainName:"Starknet",displayName:"Starknet",name:"starknet",symbol:"ETH"},{blockchainName:"Cosmos",displayName:"Cosmos",name:"cosmos",symbol:"COSMOS"},{blockchainName:"Bitcoin",displayName:"Bitcoin",name:"bitcoin",symbol:"BTC"}],chainOverrides={algo:"algorand",bip122:"bitcoin",btc:"bitcoin",eip155:"evm",eth:"evm",sol:"solana",stark:"starknet"};let chainInfoOverrides$1;const setChainInfoOverrides=Xr=>{chainInfoOverrides$1=Xr},getChainInfo=Xr=>{var eo;const to=Xr.toLowerCase(),ro=(eo=chainOverrides[to])!==null&&eo!==void 0?eo:to,no=chainsInfo.find(io=>io.name===ro||io.symbol.toLocaleLowerCase()===ro);if(no)return no},getChainInfoWithOverrides=Xr=>{var eo,to;const ro=getChainInfo(Xr);if(!ro)return;const no=chainInfoOverrides$1==null?void 0:chainInfoOverrides$1[ro.name],io=Object.assign({},ro);return no&&(io.blockchainName=(eo=no.displayName)!==null&&eo!==void 0?eo:ro.blockchainName,io.displayName=(to=no.displayName)!==null&&to!==void 0?to:ro.displayName),io},isEmailOTPWalletConnector=Xr=>!!Xr.verifyOneTimePassword,isEmailWalletConnector=Xr=>!!Xr.clearEmail,isTurnkeyWalletConnector=Xr=>{const eo=Xr;return!!(eo&&eo.key==="turnkeyhd"&&typeof eo.getWebAuthnAttestation=="function"&&typeof eo.getAuthenticatorHandler=="function"&&typeof eo.getExportHandler=="function"&&typeof eo.isSessionKeyCompatible=="function"&&typeof eo.createOrRestoreSession=="function")},isSocialWalletConnector=Xr=>!!Xr.canConnectViaSocial,filterWalletsByKey=(Xr,eo)=>eo.flatMap(to=>Xr.find(ro=>walletHasKey(ro,to))).filter(isWalletConnector),walletHasKey=(Xr,eo)=>Xr.key===eo,isWalletConnector=Xr=>!!Xr,getWalletConnectorByKey=(Xr,eo)=>filterWalletsByKey(Xr,[eo]).length>0?filterWalletsByKey(Xr,[eo])[0]:null,getConnectionDeepLink=(Xr,eo,to)=>{if(isAndroid$1())return Xr;const ro=getRegularDeepLink(Xr,eo,to);if(!ro)return`${ro}?uri=${encodeURIComponent(Xr)}`;const no=new URL(ro),io=new URLSearchParams(no.search);return io.set("uri",Xr),no.search=io.toString(),no.toString()},getRegularDeepLink=(Xr,eo,to)=>{var ro,no,io,oo;if(isAndroid$1())return Xr.split("?")[0];const ao=isMobile$1()?"mobile":"desktop";let so;return to==="native"?so=((ro=eo[ao])===null||ro===void 0?void 0:ro.native)||((no=eo[ao])===null||no===void 0?void 0:no.universal):so=((io=eo[ao])===null||io===void 0?void 0:io.universal)||((oo=eo[ao])===null||oo===void 0?void 0:oo.native),so||""},getDeepLink=({mode:Xr,uri:eo="",metadata:to,preference:ro})=>{switch(Xr){case"connection":return getConnectionDeepLink(eo,to,ro);case"regular":return getRegularDeepLink(eo,to,ro)}},performPlatformSpecificConnectionMethod=(Xr,eo,to,ro)=>{var no,io,oo;const ao=getDeepLink({metadata:eo,mode:"connection",preference:ro,uri:Xr});isMobile$1()?window.location.href=ao:(!((no=eo.desktop)===null||no===void 0)&&no.native&&((io=to.onDesktopUri)===null||io===void 0||io.call(to,ao)),(oo=to.onDisplayUri)===null||oo===void 0||oo.call(to,Xr))},isEmbeddedConnector=Xr=>!!Xr.isEmbeddedWallet,isMagicConnector=Xr=>["magicemailotp","magicsocial"].includes(Xr.key),isBloctoConnector=Xr=>["bloctoemail","bloctoevm","Blocto"].includes(Xr.key),isPasskeyWalletConnector=Xr=>!!Xr.getWebAuthnAttestation,isAccountAbstractionConnector=Xr=>Xr!=null&&typeof Xr=="object"&&"canSponsorTransactionGas"in Xr,isBitcoinConnector=Xr=>!!(Xr!=null&&Xr.sendBitcoin),isHardwareWalletConnector=Xr=>"canConnectWithHardwareWallet"in Xr,isHex$2=Xr=>!Xr||typeof Xr!="string"?!1:/^0x[0-9a-fA-F]*$/.test(Xr),eventListenerHandlers=Xr=>({handleAccountChange:no=>__awaiter$o(void 0,void 0,void 0,function*(){if(logger$9.debug(`${Xr.name} - accountChange`,no),no.length===0){Xr.emit("disconnect");return}Xr.emit("accountChange",{accounts:no})}),handleChainChange:no=>__awaiter$o(void 0,void 0,void 0,function*(){logger$9.debug(`${Xr.name} - chainChange`,no);const io=isHex$2(no)?parseInt(no,16).toString():no.toString();Xr.emit("chainChange",{chain:io})}),handleDisconnect:no=>__awaiter$o(void 0,void 0,void 0,function*(){logger$9.debug(`${Xr.name} - disconnect`,no),(no==null?void 0:no.code)!==1013&&Xr.emit("disconnect")})}),isPhantomRedirectConnector=Xr=>Xr.key==="phantom"&&Xr.extractSignature!==void 0,getRpcUrlForChain=({networks:Xr,chainId:eo})=>{var to;const ro=Xr.find(no=>no.chainId===eo);if(ro)return((to=ro.privateCustomerRpcUrls)===null||to===void 0?void 0:to[0])||ro.rpcUrls[0]},isCoinbaseMpcWalletConnector=Xr=>!!Xr&&Xr.key==="coinbasempc"&&Xr.generateWallet!==void 0&&Xr.changePasscode!==void 0&&Xr.exportWalletKeys!==void 0,isWalletConnectConnector=Xr=>!!(Xr!=null&&Xr.isWalletConnect),isSendBalanceWalletConnector=Xr=>"createUiTransaction"in Xr&&typeof Xr.createUiTransaction=="function",isSessionKeyCompatibleWalletConnector=Xr=>{const eo=Xr;return!!(typeof(eo==null?void 0:eo.isSessionKeyCompatible)=="function"&&eo.isSessionKeyCompatible())},isSessionKeyCompatibleWallet=Xr=>isSessionKeyCompatibleWalletConnector(Xr.connector);assertPackageVersion("@dynamic-labs/wallet-connector-core",version$r);const generateMessageToSign=({blockchain:Xr,domain:eo,chainId:to,nonce:ro,uri:no,publicKey:io,issuedAt:oo=new Date().toISOString(),statement:ao,requestId:so,resources:co})=>{var lo,uo;if(Xr==="STARK")return JSON.stringify({domain:eo.substring(0,31),nonce:ro});const ho=(uo=(lo=getChainInfo(Xr))===null||lo===void 0?void 0:lo.blockchainName)!==null&&uo!==void 0?uo:"Ethereum",bo=[`${eo} wants you to sign in with your ${ho} account:`,io].join(` +`),wo=ao?` `:` -`,wo=`${[yo,ao].join(vo)} -`,Eo=[];Eo.push(`URI: ${no}`),Eo.push("Version: 1"),to&&Eo.push(`Chain ID: ${to}`),Eo.push(`Nonce: ${ro}`),Eo.push(`Issued At: ${oo}`),so&&Eo.push(`Request ID: ${so}`),co!=null&&co.length&&Eo.push(`Resources:${co.map(Ao=>` -- `+Ao).join()}`);const ko=Eo.join(` -`);return[wo,ko].join(` -`)};assertPackageVersion("@dynamic-labs/multi-wallet",version$s);var version$m="3.4.4",ProviderChain;(function(Xr){Xr.EVM="evm",Xr.SOLANA="solana",Xr.STARKNET="starknet"})(ProviderChain||(ProviderChain={}));function __awaiter$k(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class ChainRpcProvidersClass{static get client(){return ChainRpcProvidersClass.instance||(ChainRpcProvidersClass.instance=new ChainRpcProvidersClass),ChainRpcProvidersClass.instance}constructor(){this.getProvidersMethods={}}static getProviders(eo){return Object.values(ProviderChain).forEach(to=>{var ro,no;if(!ChainRpcProvidersClass.providers[to]){const io=(no=(ro=ChainRpcProvidersClass.client.getProvidersMethods)[to])===null||no===void 0?void 0:no.call(ro,eo);io&&Object.assign(ChainRpcProvidersClass.providers,{[to]:io})}}),ChainRpcProvidersClass.providers}static registerChainProviders(eo,to){return __awaiter$k(this,void 0,void 0,function*(){ChainRpcProvidersClass.client.getProvidersMethods[eo]||Object.assign(ChainRpcProvidersClass.client.getProvidersMethods,{[eo]:to})})}}ChainRpcProvidersClass.providers={};ChainRpcProvidersClass.wipeInstance=()=>{ChainRpcProvidersClass.instance=void 0,ChainRpcProvidersClass.providers={}};const ChainRpcProviders=ChainRpcProvidersClass;assertPackageVersion("@dynamic-labs/rpc-providers",version$m);const logger$8=new Logger$2("DynamicSDK"),dynamicEvents=new EventEmitter$3,useInternalDynamicEvents=(Xr,eo)=>{const to=reactExports.useRef(eo);to.current=eo,reactExports.useEffect(()=>{const ro=(...no)=>to.current(...no);return dynamicEvents.on(Xr,ro),()=>{dynamicEvents.off(Xr,ro)}},[Xr])},externalEvents=["emailVerificationResult","embeddedWalletCreated","logout","walletAdded","mfaCompletionSuccess","mfaCompletionFailure"],useDynamicEvents=(Xr,eo)=>{if(!externalEvents.includes(Xr))throw new Error(`Unrecognized event "${Xr}" used with useDynamicEvents`);useInternalDynamicEvents(Xr,eo)},errorMessageMap={"-32000":"Message signature denied","-32002":"Please unlock your wallet extension and try again.","-32003":"Message signature denied.","-32602":"Invalid parameters. Please try again.","-32603":"There was an internal error. Please try again.",0:"Message signature denied.",4001:"Message signature denied.",4100:"Please unlock your wallet extension and try again.",4900:"There was an internal error. Please try again.",5001:"Message signature denied.",5002:"Message signature denied.",account_already_linked_to_different_profile:"This social account is already linked to a different profile.",connection_rejected:"Connection rejected. Please try again.",metamask_timeout:"Whoops. Looks like something went wrong. Please try again.","missing-nonce":"Something went wrong. Please try again.","missing-public-address":"Connection cancelled. Please try again",oauth_window_blocked:"To connect to your social account, enable popups in your browser and then try again.",oauth_window_timeout:"Session time out. Please try again.",too_many_email_verification_attempts:"Too many email verification attempts, please try again later","user-cancelled":"",wallet_not_deployed:"Your smart wallet has not been deployed.",wrong_email_verification_token:"The code you entered is incorrect. Please try again."},ErrorContext=reactExports.createContext(void 0),ErrorContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(void 0),ro=reactExports.useCallback(io=>{var oo;to((oo=errorMessageMap[io])!==null&&oo!==void 0?oo:"Something went wrong. Please try again.")},[]),no=reactExports.useCallback(()=>{to(void 0)},[]);return jsxRuntimeExports.jsx(ErrorContext.Provider,{value:{clearError:no,error:eo,setError:to,setErrorMessage:ro},children:Xr})},useErrorContext=()=>{const Xr=reactExports.useContext(ErrorContext);if(Xr===void 0)throw new Error("usage of useErrorContext not wrapped in `ErrorContextProvider`.");return Xr},ViewContext=reactExports.createContext(void 0),ViewContextProvider=({children:Xr,initialView:eo={props:{isWalletConnectList:!0},type:"wallet-list"}})=>{const[to,ro]=reactExports.useState(null),no=to||eo,{clearError:io}=useErrorContext(),oo=reactExports.useCallback(()=>{ro(null)},[]),ao=reactExports.useCallback((co,lo,fo)=>{no.type!==co&&io(),ro({events:fo,props:lo,type:co})},[]);useInternalDynamicEvents("logout",()=>oo());const so=reactExports.useMemo(()=>({goToInitialView:oo,setView:ao,view:no}),[oo,ao,no]);return jsxRuntimeExports.jsx(ViewContext.Provider,{value:so,children:Xr})},useViewContext=()=>{const Xr=reactExports.useContext(ViewContext);if(Xr===void 0)throw new Error("usage of useViewContext not wrapped in `ViewContextProvider`.");return Xr},createWallet=(Xr,eo)=>{var to;const ro=findWalletBookWallet(Xr,eo.key);return{chainGroup:ro==null?void 0:ro.chainGroup,group:(ro==null?void 0:ro.chainGroup)||(ro==null?void 0:ro.walletGroup),injectedConfig:ro==null?void 0:ro.injectedConfig,isInstalledOnBrowser:(to=eo.isInstalledOnBrowser())!==null&&to!==void 0?to:!1,key:eo.key,name:eo.name,walletConnector:eo,walletGroup:ro==null?void 0:ro.walletGroup}},convertHexToRGBA=(Xr,eo=1)=>{const to=parseInt(Xr.slice(1,3),16),ro=parseInt(Xr.slice(3,5),16),no=parseInt(Xr.slice(5,7),16);return"rgba("+to+", "+ro+", "+no+", "+eo+")"},TEXT_LIGHT_PRIMARY="#363A46";convertHexToRGBA(TEXT_LIGHT_PRIMARY,.65);convertHexToRGBA(TEXT_LIGHT_PRIMARY,.4);const TEXT_DARK_BASE="#F5F8FF";convertHexToRGBA(TEXT_DARK_BASE,.95);convertHexToRGBA(TEXT_DARK_BASE,.55);convertHexToRGBA(TEXT_DARK_BASE,.4);const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW=10,ChainEnumToVerifiedCredentialName={ALGO:"algorand",BTC:"bip122",COSMOS:"cosmos",ETH:"eip155",EVM:"eip155",FLOW:"flow",SOL:"solana",STARK:"starknet"},VerifiedCredentialNameToChainEnum={algorand:ChainEnum.Algo,bip122:ChainEnum.Btc,cosmos:ChainEnum.Cosmos,eip155:ChainEnum.Evm,flow:ChainEnum.Flow,solana:ChainEnum.Sol,starknet:ChainEnum.Stark},DYNAMIC_AUTH_COOKIE_NAME="DYNAMIC_JWT_TOKEN",useStoreWithSelector=(Xr,eo)=>{const to=reactExports.useRef(void 0),ro=()=>eo(Xr.getState()),no=()=>(to.current===void 0&&(to.current={value:eo(Xr.getInitialState())}),to.current.value);return reactExports.useSyncExternalStore(Xr.subscribe,ro,no)};var version$l="3.4.4";const createStore$1=Xr=>{const eo=new Set;let to=Xr();const ro=()=>{for(const no of eo)no(to)};return{getInitialState:()=>Xr(),getState:()=>to,setState:no=>{to=Object.assign(Object.assign({},to),no),ro()},subscribe:no=>(eo.add(no),()=>{eo.delete(no)})}},logger$7=new Logger$2("@dynamic-labs/logger"),persist=({name:Xr,version:eo=0,storage:to,store:ro,partialize:no})=>{ro.subscribe(oo=>{const ao=no(oo);to.setItem(Xr,JSON.stringify({state:ao,version:eo}))});const io=to.getItem(Xr);if(io)try{const{state:oo,version:ao}=JSON.parse(io);ao===eo&&ro.setState(Object.assign(ro.getInitialState(),oo))}catch(oo){logger$7.error("Failed to load state from storage",oo)}return ro};assertPackageVersion("@dynamic-labs/store",version$l);const AUTH_TOKEN="dynamic_authentication_token",AUTH_MIN_TOKEN$1="dynamic_min_authentication_token",AUTH_EXPIRES_AT="dynamic_auth_expires_at",LAST_USED_WALLET="dynamic_last_used_wallet",NONCE_STORAGE_KEY="dynamic_nonce",PRIMARY_WALLET_ID="dynamic_primary_wallet_id",WALLET_PICKER_SEARCH_KEY="dynamic_wallet_picker_search",NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY="dynamic_newtoweb3_wallet_extension_installed",CONNECTED_WALLETS_INFO="dynamic_connected_wallets",AUTH_MODE="dynamic_auth_mode",CONNECTED_WALLET_NAME_SERVICE="dynamic_connected_wallet_ns",BRIDGE_ONBOARDING_COMPLETED="dynamic_bridge_onboarding_completed",DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS="dynamic_context_session_settings",WAGMI_LAST_SESSION_SETTINGS="dynamic_wagmi_session_settings",EMBEDDED_WALLET_SESSION_SETTINGS="dynamic_embedded_wallet_session_settings",EMBEDDED_WALLET_SECURE_BANNER="dynamic_embedded_secure_banner",PHONE_INPUT_DEFAULT_COUNTRY="dynamic_phone_input_default_country",CAPTCHA_TOKEN="dynamic_captcha_token",PHANTOM_SIGNATURE_STATE="phantom_verification_type",STORE_STORAGE_KEY="dynamic_store",createInitialStates=({environmentId:Xr})=>({environmentId:Xr,loadingAndLifecycle:{sessionValidation:!1},projectSettings:{expiresAt:void 0,settings:void 0},sendBalanceState:{amount:void 0,chainName:void 0,nativePrice:void 0},tokenBalancesState:{error:void 0,isError:!1,isLoading:!1,tokenBalances:void 0},user:void 0,walletConnectorOptions:[]}),transformStateForLocalStorage=Xr=>({environmentId:Xr.environmentId,projectSettings:Xr.projectSettings,user:Xr.user}),clearExpiredData=Xr=>{const{projectSettings:eo,user:to}=Xr.getState(),[ro]=StorageService.getItem(CONNECTED_WALLETS_INFO)||[],no=!to&&!ro;return(oo=>no||oo.expiresAt&&oo.expiresAt{const eo=StorageService.getItem(AUTH_USER);return eo&&!Xr.getState().user&&(Xr.setState({user:eo}),StorageService.removeItem(AUTH_USER)),Xr};let store;const getStore=()=>{if(!store)throw new Error("Store not initialized");return store},removeStoreInstance=()=>{store=void 0},initializeStore=({storageSuffix:Xr,environmentId:eo})=>{if(store)return;const to=Xr?`${STORE_STORAGE_KEY}_${Xr}`:STORE_STORAGE_KEY;store=syncLegacyStorage(persist({name:to,partialize:transformStateForLocalStorage,storage:getStorage(),store:createStore$1(()=>createInitialStates({environmentId:eo,storageSuffix:Xr}))})),clearExpiredData(store)},getStorage=()=>typeof localStorage>"u"?{getItem:()=>null,setItem:()=>{}}:window.localStorage,createStoreState=Xr=>{const eo=Xr[0].toUpperCase()+Xr.slice(1),to=()=>useStoreWithSelector(getStore(),oo=>oo[Xr]),ro=oo=>getStore().setState(Object.assign(Object.assign({},getStore().getState()),{[Xr]:oo})),no=()=>getStore().getState()[Xr],io=()=>ro(getStore().getInitialState()[Xr]);return{[`use${eo}`]:to,[`get${eo}`]:no,[`set${eo}`]:ro,[`reset${eo}`]:io}},{getLoadingAndLifecycle,setLoadingAndLifecycle,useLoadingAndLifecycle}=createStoreState("loadingAndLifecycle"),require$$0$b=[{code:"AD",name:"Andorra"},{code:"AE",name:"United Arab Emirates"},{code:"AF",name:"Afghanistan"},{code:"AG",name:"Antigua and Barbuda"},{code:"AI",name:"Anguilla"},{code:"AL",name:"Albania"},{code:"AM",name:"Armenia"},{code:"AO",name:"Angola"},{code:"AQ",name:"Antarctica"},{code:"AR",name:"Argentina"},{code:"AS",name:"American Samoa"},{code:"AT",name:"Austria"},{code:"AU",name:"Australia"},{code:"AW",name:"Aruba"},{code:"AX",name:"Åland Islands"},{code:"AZ",name:"Azerbaijan"},{code:"BA",name:"Bosnia and Herzegovina"},{code:"BB",name:"Barbados"},{code:"BD",name:"Bangladesh"},{code:"BE",name:"Belgium"},{code:"BF",name:"Burkina Faso"},{code:"BG",name:"Bulgaria"},{code:"BH",name:"Bahrain"},{code:"BI",name:"Burundi"},{code:"BJ",name:"Benin"},{code:"BL",name:"Saint Barthélemy"},{code:"BM",name:"Bermuda"},{code:"BN",name:"Brunei Darussalam"},{code:"BO",name:"Bolivia, Plurinational State of"},{code:"BQ",name:"Bonaire, Sint Eustatius and Saba"},{code:"BR",name:"Brazil"},{code:"BS",name:"Bahamas"},{code:"BT",name:"Bhutan"},{code:"BV",name:"Bouvet Island"},{code:"BW",name:"Botswana"},{code:"BY",name:"Belarus"},{code:"BZ",name:"Belize"},{code:"CA",name:"Canada"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CD",name:"Congo, Democratic Republic of the"},{code:"CF",name:"Central African Republic"},{code:"CG",name:"Congo"},{code:"CH",name:"Switzerland"},{code:"CI",name:"Côte d'Ivoire"},{code:"CK",name:"Cook Islands"},{code:"CL",name:"Chile"},{code:"CM",name:"Cameroon"},{code:"CN",name:"China"},{code:"CO",name:"Colombia"},{code:"CR",name:"Costa Rica"},{code:"CU",name:"Cuba"},{code:"CV",name:"Cabo Verde"},{code:"CW",name:"Curaçao"},{code:"CX",name:"Christmas Island"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DE",name:"Germany"},{code:"DJ",name:"Djibouti"},{code:"DK",name:"Denmark"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"DZ",name:"Algeria"},{code:"EC",name:"Ecuador"},{code:"EE",name:"Estonia"},{code:"EG",name:"Egypt"},{code:"EH",name:"Western Sahara"},{code:"ER",name:"Eritrea"},{code:"ES",name:"Spain"},{code:"ET",name:"Ethiopia"},{code:"FI",name:"Finland"},{code:"FJ",name:"Fiji"},{code:"FK",name:"Falkland Islands (Malvinas)"},{code:"FM",name:"Micronesia, Federated States of"},{code:"FO",name:"Faroe Islands"},{code:"FR",name:"France"},{code:"GA",name:"Gabon"},{code:"GB",name:"United Kingdom of Great Britain and Northern Ireland"},{code:"GD",name:"Grenada"},{code:"GE",name:"Georgia"},{code:"GF",name:"French Guiana"},{code:"GG",name:"Guernsey"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GL",name:"Greenland"},{code:"GM",name:"Gambia"},{code:"GN",name:"Guinea"},{code:"GP",name:"Guadeloupe"},{code:"GQ",name:"Equatorial Guinea"},{code:"GR",name:"Greece"},{code:"GS",name:"South Georgia and the South Sandwich Islands"},{code:"GT",name:"Guatemala"},{code:"GU",name:"Guam"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HK",name:"Hong Kong"},{code:"HM",name:"Heard Island and McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HR",name:"Croatia"},{code:"HT",name:"Haiti"},{code:"HU",name:"Hungary"},{code:"ID",name:"Indonesia"},{code:"IE",name:"Ireland"},{code:"IL",name:"Israel"},{code:"IM",name:"Isle of Man"},{code:"IN",name:"India"},{code:"IO",name:"British Indian Ocean Territory"},{code:"IQ",name:"Iraq"},{code:"IR",name:"Iran, Islamic Republic of"},{code:"IS",name:"Iceland"},{code:"IT",name:"Italy"},{code:"JE",name:"Jersey"},{code:"JM",name:"Jamaica"},{code:"JO",name:"Jordan"},{code:"JP",name:"Japan"},{code:"KE",name:"Kenya"},{code:"KG",name:"Kyrgyzstan"},{code:"KH",name:"Cambodia"},{code:"KI",name:"Kiribati"},{code:"KM",name:"Comoros"},{code:"KN",name:"Saint Kitts and Nevis"},{code:"KP",name:"Korea, Democratic People's Republic of"},{code:"KR",name:"Korea, Republic of"},{code:"KW",name:"Kuwait"},{code:"KY",name:"Cayman Islands"},{code:"KZ",name:"Kazakhstan"},{code:"LA",name:"Lao People's Democratic Republic"},{code:"LB",name:"Lebanon"},{code:"LC",name:"Saint Lucia"},{code:"LI",name:"Liechtenstein"},{code:"LK",name:"Sri Lanka"},{code:"LR",name:"Liberia"},{code:"LS",name:"Lesotho"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"LV",name:"Latvia"},{code:"LY",name:"Libya"},{code:"MA",name:"Morocco"},{code:"MC",name:"Monaco"},{code:"MD",name:"Moldova, Republic of"},{code:"ME",name:"Montenegro"},{code:"MF",name:"Saint Martin, (French part)"},{code:"MG",name:"Madagascar"},{code:"MH",name:"Marshall Islands"},{code:"MK",name:"North Macedonia"},{code:"ML",name:"Mali"},{code:"MM",name:"Myanmar"},{code:"MN",name:"Mongolia"},{code:"MO",name:"Macao"},{code:"MP",name:"Northern Mariana Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MS",name:"Montserrat"},{code:"MT",name:"Malta"},{code:"MU",name:"Mauritius"},{code:"MV",name:"Maldives"},{code:"MW",name:"Malawi"},{code:"MX",name:"Mexico"},{code:"MY",name:"Malaysia"},{code:"MZ",name:"Mozambique"},{code:"NA",name:"Namibia"},{code:"NC",name:"New Caledonia"},{code:"NE",name:"Niger"},{code:"NF",name:"Norfolk Island"},{code:"NG",name:"Nigeria"},{code:"NI",name:"Nicaragua"},{code:"NL",name:"Netherlands"},{code:"NO",name:"Norway"},{code:"NP",name:"Nepal"},{code:"NR",name:"Nauru"},{code:"NU",name:"Niue"},{code:"NZ",name:"New Zealand"},{code:"OM",name:"Oman"},{code:"PA",name:"Panama"},{code:"PE",name:"Peru"},{code:"PF",name:"French Polynesia"},{code:"PG",name:"Papua New Guinea"},{code:"PH",name:"Philippines"},{code:"PK",name:"Pakistan"},{code:"PL",name:"Poland"},{code:"PM",name:"Saint Pierre and Miquelon"},{code:"PN",name:"Pitcairn"},{code:"PR",name:"Puerto Rico"},{code:"PS",name:"Palestine, State of"},{code:"PT",name:"Portugal"},{code:"PW",name:"Palau"},{code:"PY",name:"Paraguay"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RS",name:"Serbia"},{code:"RU",name:"Russian Federation"},{code:"RW",name:"Rwanda"},{code:"SA",name:"Saudi Arabia"},{code:"SB",name:"Solomon Islands"},{code:"SC",name:"Seychelles"},{code:"SD",name:"Sudan"},{code:"SE",name:"Sweden"},{code:"SG",name:"Singapore"},{code:"SH",name:"Saint Helena, Ascension and Tristan da Cunha"},{code:"SI",name:"Slovenia"},{code:"SJ",name:"Svalbard and Jan Mayen"},{code:"SK",name:"Slovakia"},{code:"SL",name:"Sierra Leone"},{code:"SM",name:"San Marino"},{code:"SN",name:"Senegal"},{code:"SO",name:"Somalia"},{code:"SR",name:"Suriname"},{code:"SS",name:"South Sudan"},{code:"ST",name:"Sao Tome and Principe"},{code:"SV",name:"El Salvador"},{code:"SX",name:"Sint Maarten, (Dutch part)"},{code:"SY",name:"Syrian Arab Republic"},{code:"SZ",name:"Eswatini"},{code:"TC",name:"Turks and Caicos Islands"},{code:"TD",name:"Chad"},{code:"TF",name:"French Southern Territories"},{code:"TG",name:"Togo"},{code:"TH",name:"Thailand"},{code:"TJ",name:"Tajikistan"},{code:"TK",name:"Tokelau"},{code:"TL",name:"Timor-Leste"},{code:"TM",name:"Turkmenistan"},{code:"TN",name:"Tunisia"},{code:"TO",name:"Tonga"},{code:"TR",name:"Türkiye"},{code:"TT",name:"Trinidad and Tobago"},{code:"TV",name:"Tuvalu"},{code:"TW",name:"Taiwan, Province of China"},{code:"TZ",name:"Tanzania, United Republic of"},{code:"UA",name:"Ukraine"},{code:"UG",name:"Uganda"},{code:"UM",name:"United States Minor Outlying Islands"},{code:"US",name:"United States of America"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VA",name:"Holy See"},{code:"VC",name:"Saint Vincent and the Grenadines"},{code:"VE",name:"Venezuela, Bolivarian Republic of"},{code:"VG",name:"Virgin Islands, British"},{code:"VI",name:"Virgin Islands, U.S."},{code:"VN",name:"Viet Nam"},{code:"VU",name:"Vanuatu"},{code:"WF",name:"Wallis and Futuna"},{code:"WS",name:"Samoa"},{code:"YE",name:"Yemen"},{code:"YT",name:"Mayotte"},{code:"ZA",name:"South Africa"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}];var data=require$$0$b,nameMap={},codeMap={};data.forEach(mapCodeAndName);function mapCodeAndName(Xr){nameMap[Xr.name.toLowerCase()]=Xr.code,codeMap[Xr.code.toLowerCase()]=Xr.name}var getData=function(){return data};const tShirtSizes=["XS","S","M","L","XL","2XL"],countryCodes=getData(),teamNames=["Brunei DS","Cambodia","Indonesia","Laos","Malaysia","Myanmar","Philippines","Singapore","Thailand","Vietnam"],defaultWalletsForChains={primary_chain:"evm",wallets:{algorand:"perawallet",bitcoin:"xverse",cosmos:"keplr",evm:"metamask",flow:"blocto",solana:"phantom"}},tooltipZIndex=2147483647,toolkitZIndex=2147483646,authModalZIndex=2147483645,chainInfoOverrides={starknet:"STARK"},getEnabledChains=Xr=>Xr.filter(({enabled:eo})=>eo).map(({name:eo})=>{var to,ro;return(to=chainInfoOverrides[eo])!==null&&to!==void 0?to:(ro=getChainInfo(eo))===null||ro===void 0?void 0:ro.symbol}).filter(eo=>!!eo),getWallets$1=Xr=>{var eo;return getEnabledWallets({enabledChains:getEnabledChains(Xr.getSupportedWalletOpts.settings.chains),getSupportedWalletOpts:Object.assign(Object.assign({},Xr.getSupportedWalletOpts),{chainRpcProviders:ChainRpcProviders,walletConnectProjectId:(eo=Xr.getSupportedWalletOpts.settings.sdk.walletConnect)===null||eo===void 0?void 0:eo.projectId})}).map(to=>{var ro;return(ro=Xr.walletConnectorExtensions)===null||ro===void 0||ro.forEach(no=>to.extend(no)),createWallet(Xr.getSupportedWalletOpts.walletBook,to)})},getExpiresAt=()=>StorageService.getItem(AUTH_EXPIRES_AT),parseToken$1=Xr=>{var eo;if(!Xr)return;const to=(eo=Xr.split(".")[1])===null||eo===void 0?void 0:eo.replace(/-/g,"+").replace(/_/g,"/"),ro=to&&decodeURIComponent(atob(to).split("").map(no=>`%${`00${no.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(ro)},decodeMinJwt$1=Xr=>{try{const eo=parseToken$1(Xr);return eo?MinifiedDynamicJwtFromJSON(eo):void 0}catch(eo){logger$8.error(eo);return}},decodeJwt=Xr=>{try{const eo=parseToken$1(Xr);return eo?DynamicJwtFromJSON(eo):void 0}catch(eo){logger$8.error(eo);return}};let logoutTimer,dynamicContextSettingsTimer,wagmiSettingsTimer;const sdkSettingsTimeout=24*60*60*1e3,isMinAuthTokenExpired$1=Xr=>{const eo=decodeMinJwt$1(Xr);return isTokenExpired$1(eo)},isAuthTokenExpired=Xr=>{const eo=decodeJwt(Xr);return isTokenExpired$1(eo)},isTokenExpired$1=Xr=>{if(!Xr||!Xr.exp)return!0;const eo=new Date(Xr.exp*1e3).getTime();return new Date().getTime()>=eo},initExpirationTime=Xr=>{const eo=getExpiresAt();if(!eo)return clearTimeout(logoutTimer);const to=new Date(eo*1e3).getTime(),ro=new Date().getTime();if(ro>=to)return clearTimeout(logoutTimer),Xr();const no=to-ro,io=Math.min(no,2147483647);logoutTimer=setTimeout(Xr,io)},getInitialView=({connectedWallets:Xr,isBridgeFlow:eo,bridgeOnboardingCompleted:to,isAuthenticated:ro,isMultiWalletEnabled:no})=>ro||to?{type:no?"multi-wallet-wallet-list":"wallet-list"}:eo&&!Xr.length?{type:"bridge-welcome"}:{type:"login-with-email-or-wallet"},setDynamicContextSessionSettings=()=>{setSessionSettings(DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS),dynamicContextSettingsTimer=setTimeout(isDynamicContextSessionSettingExpired,sdkSettingsTimeout)},setWagmiSessionSettings=()=>{setSessionSettings(WAGMI_LAST_SESSION_SETTINGS),wagmiSettingsTimer=setTimeout(isWagmiSessionSettingExpired,sdkSettingsTimeout)},setSessionSettings=Xr=>{const eo=new Date().getTime();StorageService.setItem(Xr,eo.toString())},isDynamicContextSessionSettingExpired=()=>isSettingExpired(DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS,dynamicContextSettingsTimer),isWagmiSessionSettingExpired=()=>isSettingExpired(WAGMI_LAST_SESSION_SETTINGS,wagmiSettingsTimer),isSettingExpired=(Xr,eo)=>{const to=StorageService.getItem(Xr);if(!to)return!0;const ro=parseInt(to);return new Date().getTime()-ro>sdkSettingsTimeout?(clearTimeout(eo),StorageService.removeItem(Xr),!0):!1},resolveNetworkValidationMode=({networkValidationMode:Xr,bridgeChains:eo})=>Xr||(eo?"always":"sign-in"),getDeepLinkPreference=(Xr,eo)=>eo?"universal":Xr,getAuthToken=()=>{if(typeof window>"u")return;const Xr=StorageService.getItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]});if(Xr&&!isAuthTokenExpired(Xr))return Xr};function __rest$7(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no()=>{if(Xr.isInitialized)eo();else{const to=()=>{setTimeout(()=>{Xr.off("initialized",to)},0),eo()};Xr.on("initialized",to)}};function loadNamespaces(Xr,eo,to){Xr.loadNamespaces(eo,loadedClb(Xr,to))}function loadLanguages(Xr,eo,to,ro){typeof to=="string"&&(to=[to]),to.forEach(no=>{Xr.options.ns.indexOf(no)<0&&Xr.options.ns.push(no)}),Xr.loadLanguages(eo,loadedClb(Xr,ro))}function oldI18nextHasLoadedNamespace(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ro=eo.languages[0],no=eo.options?eo.options.fallbackLng:!1,io=eo.languages[eo.languages.length-1];if(ro.toLowerCase()==="cimode")return!0;const oo=(ao,so)=>{const co=eo.services.backendConnector.state[`${ao}|${so}`];return co===-1||co===2};return to.bindI18n&&to.bindI18n.indexOf("languageChanging")>-1&&eo.services.backendConnector.backend&&eo.isLanguageChangingTo&&!oo(eo.isLanguageChangingTo,Xr)?!1:!!(eo.hasResourceBundle(ro,Xr)||!eo.services.backendConnector.backend||eo.options.resources&&!eo.options.partialBundledLanguages||oo(ro,Xr)&&(!no||oo(io,Xr)))}function hasLoadedNamespace(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!eo.languages||!eo.languages.length?(warnOnce("i18n.languages were undefined or empty",eo.languages),!0):eo.options.ignoreJSONStructure!==void 0?eo.hasLoadedNamespace(Xr,{lng:to.lng,precheck:(no,io)=>{if(to.bindI18n&&to.bindI18n.indexOf("languageChanging")>-1&&no.services.backendConnector.backend&&no.isLanguageChangingTo&&!io(no.isLanguageChangingTo,Xr))return!1}}):oldI18nextHasLoadedNamespace(Xr,eo,to)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=Xr=>htmlEntities[Xr],unescape$2=Xr=>Xr.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions$1={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:unescape$2};function setDefaults(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions$1={...defaultOptions$1,...Xr}}function getDefaults(){return defaultOptions$1}let i18nInstance;function setI18n(Xr){i18nInstance=Xr}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(Xr){setDefaults(Xr.options.react),setI18n(Xr)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(eo){eo.forEach(to=>{this.usedNamespaces[to]||(this.usedNamespaces[to]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious$1=(Xr,eo)=>{const to=reactExports.useRef();return reactExports.useEffect(()=>{to.current=Xr},[Xr,eo]),to.current};function useTranslation(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:to}=eo,{i18n:ro,defaultNS:no}=reactExports.useContext(I18nContext)||{},io=to||ro||getI18n();if(io&&!io.reportNamespaces&&(io.reportNamespaces=new ReportNamespaces),!io){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const Ao=(jo,Mo)=>typeof Mo=="string"?Mo:Mo&&typeof Mo=="object"&&typeof Mo.defaultValue=="string"?Mo.defaultValue:Array.isArray(jo)?jo[jo.length-1]:jo,Po=[Ao,{},!1];return Po.t=Ao,Po.i18n={},Po.ready=!1,Po}io.options.react&&io.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const oo={...getDefaults(),...io.options.react,...eo},{useSuspense:ao,keyPrefix:so}=oo;let co=no||io.options&&io.options.defaultNS;co=typeof co=="string"?[co]:co||["translation"],io.reportNamespaces.addUsedNamespaces&&io.reportNamespaces.addUsedNamespaces(co);const lo=(io.isInitialized||io.initializedStoreOnce)&&co.every(Ao=>hasLoadedNamespace(Ao,io,oo));function fo(){return io.getFixedT(eo.lng||null,oo.nsMode==="fallback"?co:co[0],so)}const[ho,go]=reactExports.useState(fo);let yo=co.join();eo.lng&&(yo=`${eo.lng}${yo}`);const vo=usePrevious$1(yo),wo=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:Ao,bindI18nStore:Po}=oo;wo.current=!0,!lo&&!ao&&(eo.lng?loadLanguages(io,eo.lng,co,()=>{wo.current&&go(fo)}):loadNamespaces(io,co,()=>{wo.current&&go(fo)})),lo&&vo&&vo!==yo&&wo.current&&go(fo);function jo(){wo.current&&go(fo)}return Ao&&io&&io.on(Ao,jo),Po&&io&&io.store.on(Po,jo),()=>{wo.current=!1,Ao&&io&&Ao.split(" ").forEach(Mo=>io.off(Mo,jo)),Po&&io&&Po.split(" ").forEach(Mo=>io.store.off(Mo,jo))}},[io,yo]);const Eo=reactExports.useRef(!0);reactExports.useEffect(()=>{wo.current&&!Eo.current&&go(fo),Eo.current=!1},[io,so]);const ko=[ho,io,lo];if(ko.t=ho,ko.i18n=io,ko.ready=lo,lo||!lo&&!ao)return ko;throw new Promise(Ao=>{eo.lng?loadLanguages(io,eo.lng,co,()=>Ao()):loadNamespaces(io,co,()=>Ao())})}function I18nextProvider(Xr){let{i18n:eo,defaultNS:to,children:ro}=Xr;const no=reactExports.useMemo(()=>({i18n:eo,defaultNS:to}),[eo,to]);return reactExports.createElement(I18nContext.Provider,{value:no},ro)}const isClassNamesObjectArg=Xr=>typeof Xr=="object",isString$4=Xr=>typeof Xr=="string",classNames=(...Xr)=>Xr.reduce((to,ro)=>{if(isString$4(ro))return[...to,ro];if(isClassNamesObjectArg(ro)){const io=Object.keys(ro).map(oo=>ro[oo]?oo:null).filter(isString$4);return[...to,...io]}return to},[]).join(" "),useLocalStorage=(Xr,eo,to,ro)=>{const[no,io]=reactExports.useState(()=>{try{const so=StorageService.getItem(Xr);return so&&to&&!to(so)?(StorageService.removeItem(Xr),ro==null||ro.forEach(co=>StorageService.removeItem(co)),eo):so??eo}catch(so){return logger$8.error(so),eo}}),oo=reactExports.useCallback(so=>{try{const co=so instanceof Function?so(no):so;io(co),StorageService.setItem(Xr,co)}catch(co){logger$8.error(co)}},[Xr,no]),ao=reactExports.useCallback(()=>{StorageService.removeItem(Xr),io(eo)},[eo,Xr]);return[no,oo,ao]},CaptchaContext=reactExports.createContext(void 0),CaptchaContextProvider=({children:Xr})=>{const{setView:eo}=useViewContext(),[to,ro,no]=useLocalStorage(CAPTCHA_TOKEN,void 0),[io,oo]=reactExports.useState(),ao=reactExports.useCallback(({authMethod:lo,onCaptchaSuccess:fo})=>{oo({authMethod:lo,onCaptchaSuccess:fo}),eo("captcha")},[eo,oo]),so=reactExports.useCallback(()=>{const lo=to;return no(),lo},[to,no]),co=reactExports.useMemo(()=>({captchaAuthState:io,engageCaptcha:ao,getCaptchaToken:so,removeCaptchaToken:no,setCaptchaAuthState:oo,setCaptchaToken:ro}),[io,so,ao,oo,ro,no]);return jsxRuntimeExports.jsx(CaptchaContext.Provider,{value:co,children:Xr})},useCaptchaContext=()=>{const Xr=reactExports.useContext(CaptchaContext);if(Xr===void 0)throw new Error("usage of useCaptchaContext not wrapped in `CaptchaContextProvider`.");return Xr};var R$7=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",{default:". .... ....","/^4/":"... ... ...","/^5(?!50)/":"... ... ...","/^1(3|8)00/":".... ... ...","/^13/":".. .. ..","/^180/":"... ...."},0,[]],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["Côte d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","",2],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49",".... ........"],["Ghana","gh","233"],["Greece","gr","30"],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",".. ........"],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63",".... ......."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","",3,["787","939"]],["Qatar","qa","974"],["Réunion","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","... ... ..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]],ve$3="react-international-phone-",se$1=(...Xr)=>Xr.filter(eo=>!!eo).join(" ").trim(),xe$2=(...Xr)=>se$1(...Xr).split(" ").map(eo=>`${ve$3}${eo}`).join(" "),P$7=({addPrefix:Xr,rawClassNames:eo})=>se$1(xe$2(...Xr),...eo),le$4=({value:Xr,mask:eo,maskSymbol:to,offset:ro=0,trimNonMaskCharsLeftover:no=!1})=>{if(Xr.length=oo.length){if(!no&&co!==to){ao+=co;continue}break}co===to?(ao+=oo[so],so+=1):ao+=co}return ao},F$8=Xr=>Xr?/^\d+$/.test(Xr):!1,z$9=Xr=>Xr.replace(/\D/g,""),ue$4=(Xr,eo)=>{let to=Xr.style.display;to!=="block"&&(Xr.style.display="block");let ro=Xr.getBoundingClientRect(),no=eo.getBoundingClientRect(),io=no.top-ro.top,oo=ro.bottom-no.bottom;io>=0&&oo>=0||(Math.abs(io){let{name:eo,iso2:to,dialCode:ro,format:no,priority:io,areaCodes:oo}=Xr,ao=[eo,to,ro,no,io,oo];for(let so=0;sogo===void 0?"__undefined":go).replace(/"__undefined"/g,"undefined");throw new Error(`[react-international-phone] invalid country values passed to buildCountryData. Check ${co} in: ${fo}`)}}return ao.filter(so=>so!==void 0)},de$4=({phone:Xr,dialCode:eo,prefix:to="+",charAfterDialCode:ro=" "})=>{if(!Xr||!eo)return Xr;let no=Xr;return no.startsWith(to)&&(no=no.replace(to,"")),no.startsWith(eo)?(no=no.replace(eo,""),no.startsWith(ro)&&(no=no.replace(ro,"")),no):Xr},ce$5=(Xr,eo)=>{let to=eo.disableDialCodeAndPrefix?!1:eo.forceDialCode,ro=eo.disableDialCodeAndPrefix?!1:eo.insertDialCodeOnEmpty,no=Xr,io=co=>eo.trimNonDigitsEnd?co.trim():co;if(!no)return ro&&!no.length||to?io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`):io(no);if(no=z$9(no),no===eo.dialCode&&!eo.disableDialCodeAndPrefix)return io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`);if(eo.dialCode.startsWith(no)&&!eo.disableDialCodeAndPrefix)return io(to?`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`:`${eo.prefix}${no}`);if(!no.startsWith(eo.dialCode)&&!eo.disableDialCodeAndPrefix){if(to)return io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`);if(no.length{let co=eo.dialCode.length,lo=no.slice(0,co),fo=no.slice(co);return{phoneLeftSide:lo,phoneRightSide:fo}},{phoneLeftSide:ao,phoneRightSide:so}=oo();return ao=`${eo.prefix}${ao}${eo.charAfterDialCode}`,so=le$4({value:so,mask:eo.mask,maskSymbol:eo.maskChar,trimNonMaskCharsLeftover:eo.trimNonDigitsEnd||eo.disableDialCodeAndPrefix&&so.length===0}),eo.disableDialCodeAndPrefix&&(ao=""),io(`${ao}${so}`)},pe$4=({phoneBeforeInput:Xr,phoneAfterInput:eo,phoneAfterFormatted:to,cursorPositionAfterInput:ro,leftOffset:no=0,deletion:io})=>{if(ro=0;lo-=1)if(F$8(eo[lo])){oo=lo;break}if(oo===null){for(let lo=0;lo=ao+1));lo+=1);if(io!=="backward")for(;!F$8(to[so])&&soXr?`${eo}${z$9(Xr)}`:"";function W$6({value:Xr,country:eo,insertDialCodeOnEmpty:to,trimNonDigitsEnd:ro,countries:no,prefix:io,charAfterDialCode:oo,forceDialCode:ao,disableDialCodeAndPrefix:so,defaultMask:co,countryGuessingEnabled:lo,disableFormatting:fo}){let ho=Xr;so&&(ho=ho.startsWith(`${io}`)?ho:`${io}${eo.dialCode}${ho}`);let go=lo?X$4({phone:ho,countries:no,currentCountryIso2:eo==null?void 0:eo.iso2}):void 0,yo=(go==null?void 0:go.country)??eo,vo=ce$5(ho,{prefix:io,mask:Q$7({phone:ho,country:yo,defaultMask:co,disableFormatting:fo}),maskChar:J$4,dialCode:yo.dialCode,trimNonDigitsEnd:ro,charAfterDialCode:oo,forceDialCode:ao,insertDialCodeOnEmpty:to,disableDialCodeAndPrefix:so}),wo=lo&&!(go!=null&&go.fullDialCodeMatch)?eo:yo;return{phone:B$6({phone:so?`${wo.dialCode}${vo}`:vo,prefix:io}),inputValue:vo,country:wo}}var De$4=Xr=>{if((Xr==null?void 0:Xr.toLocaleLowerCase().includes("delete"))??!1)return Xr!=null&&Xr.toLocaleLowerCase().includes("forward")?"forward":"backward"},me=(Xr,{country:eo,insertDialCodeOnEmpty:to,phoneBeforeInput:ro,prefix:no,charAfterDialCode:io,forceDialCode:oo,disableDialCodeAndPrefix:ao,countryGuessingEnabled:so,defaultMask:co,disableFormatting:lo,countries:fo})=>{let ho=Xr.nativeEvent,go=ho.inputType,yo=De$4(go),vo=!!(go!=null&&go.startsWith("insertFrom")),wo=go==="insertText",Eo=(ho==null?void 0:ho.data)||void 0,ko=Xr.target.value,Ao=Xr.target.selectionStart??0;if(go!=null&&go.includes("history"))return{inputValue:ro,phone:B$6({phone:ro,prefix:no}),cursorPosition:ro.length,country:eo};if(wo&&!F$8(Eo)&&ko!==no)return{inputValue:ro,phone:B$6({phone:ao?`${eo.dialCode}${ro}`:ro,prefix:no}),cursorPosition:Ao-((Eo==null?void 0:Eo.length)??0),country:eo};if(oo&&!ko.startsWith(`${no}${eo.dialCode}`)&&!vo){let Do=ko?ro:`${no}${eo.dialCode}${io}`;return{inputValue:Do,phone:B$6({phone:Do,prefix:no}),cursorPosition:no.length+eo.dialCode.length+io.length,country:eo}}let{phone:Po,inputValue:jo,country:Mo}=W$6({value:ko,country:eo,trimNonDigitsEnd:yo==="backward",insertDialCodeOnEmpty:to,countryGuessingEnabled:so,countries:fo,prefix:no,charAfterDialCode:io,forceDialCode:oo,disableDialCodeAndPrefix:ao,disableFormatting:lo,defaultMask:co}),No=pe$4({cursorPositionAfterInput:Ao,phoneBeforeInput:ro,phoneAfterInput:ko,phoneAfterFormatted:jo,leftOffset:oo?no.length+eo.dialCode.length+io.length:0,deletion:yo});return{phone:Po,inputValue:jo,cursorPosition:No,country:Mo}},fe$1=(Xr,eo)=>{let to=Object.keys(Xr),ro=Object.keys(eo);if(to.length!==ro.length)return!1;for(let no of to)if(Xr[no]!==eo[no])return!1;return!0},Ce$3=()=>{let Xr=reactExports.useRef(),eo=reactExports.useRef(Date.now());return{check:()=>{let to=Date.now(),ro=Xr.current?to-eo.current:void 0;return Xr.current=eo.current,eo.current=to,ro}}},ke$4={size:20,overrideLastItemDebounceMS:-1};function ye$2(Xr,eo){let{size:to,overrideLastItemDebounceMS:ro,onChange:no}={...ke$4,...eo},[io,oo]=reactExports.useState(Xr),[ao,so]=reactExports.useState([io]),[co,lo]=reactExports.useState(0),fo=Ce$3();return[io,(ho,go)=>{if(typeof ho=="object"&&typeof io=="object"&&fe$1(ho,io)||ho===io)return;let yo=ro>0,vo=fo.check(),wo=yo&&vo!==void 0?vo>ro:!0;if((go==null?void 0:go.overrideLastItem)!==void 0?go.overrideLastItem:!wo)so(Eo=>[...Eo.slice(0,co),ho]);else{let Eo=ao.length>=to;so(ko=>[...ko.slice(Eo?1:0,co+1),ho]),Eo||lo(ko=>ko+1)}oo(ho),no==null||no(ho)},()=>{if(co<=0)return{success:!1};let ho=ao[co-1];return oo(ho),lo(go=>go-1),no==null||no(ho),{success:!0,value:ho}},()=>{if(co+1>=ao.length)return{success:!1};let ho=ao[co+1];return oo(ho),lo(go=>go+1),no==null||no(ho),{success:!0,value:ho}}]}var J$4=".",E$8={defaultCountry:"us",value:"",prefix:"+",defaultMask:"............",charAfterDialCode:" ",historySaveDebounceMS:200,disableCountryGuess:!1,disableDialCodePrefill:!1,forceDialCode:!1,disableDialCodeAndPrefix:!1,disableFormatting:!1,countries:R$7,preferredCountries:[]},ee$5=({defaultCountry:Xr=E$8.defaultCountry,value:eo=E$8.value,countries:to=E$8.countries,prefix:ro=E$8.prefix,defaultMask:no=E$8.defaultMask,charAfterDialCode:io=E$8.charAfterDialCode,historySaveDebounceMS:oo=E$8.historySaveDebounceMS,disableCountryGuess:ao=E$8.disableCountryGuess,disableDialCodePrefill:so=E$8.disableDialCodePrefill,forceDialCode:co=E$8.forceDialCode,disableDialCodeAndPrefix:lo=E$8.disableDialCodeAndPrefix,disableFormatting:fo=E$8.disableFormatting,onChange:ho,inputRef:go})=>{let yo={countries:to,prefix:ro,charAfterDialCode:io,forceDialCode:lo?!1:co,disableDialCodeAndPrefix:lo,defaultMask:no,countryGuessingEnabled:!ao,disableFormatting:fo},vo=reactExports.useRef(null),wo=go||vo,Eo=uo=>{Promise.resolve().then(()=>{var po;typeof window>"u"||wo.current!==(document==null?void 0:document.activeElement)||((po=wo.current)==null||po.setSelectionRange(uo,uo))})},[{phone:ko,inputValue:Ao,country:Po},jo,Mo,No]=ye$2(()=>{let uo=$$6({value:Xr,field:"iso2",countries:to});uo||console.error(`[react-international-phone]: can not find a country with "${Xr}" iso2 code`);let po=uo||$$6({value:"us",field:"iso2",countries:to}),{phone:bo,inputValue:_o,country:$o}=W$6({value:eo,country:po,insertDialCodeOnEmpty:!so,...yo});return Eo(_o.length),{phone:bo,inputValue:_o,country:$o.iso2}},{overrideLastItemDebounceMS:oo,onChange:({inputValue:uo,phone:po,country:bo})=>{if(!ho)return;let _o=Do(bo);ho({phone:po,inputValue:uo,country:_o})}}),Do=reactExports.useCallback(uo=>$$6({value:uo,field:"iso2",countries:to}),[to]),Fo=reactExports.useMemo(()=>Do(Po),[Po,Do]);reactExports.useEffect(()=>{let uo=wo.current;if(!uo)return;let po=bo=>{if(!bo.key)return;let _o=bo.ctrlKey,$o=bo.shiftKey,Co=bo.key.toLowerCase()==="z";!_o||!Co||($o?No():Mo())};return uo.addEventListener("keydown",po),()=>{uo.removeEventListener("keydown",po)}},[wo,Mo,No]);let Xo=uo=>{uo.preventDefault();let{phone:po,inputValue:bo,country:_o,cursorPosition:$o}=me(uo,{country:Fo,phoneBeforeInput:Ao,insertDialCodeOnEmpty:!1,...yo});return jo({inputValue:bo,phone:po,country:_o.iso2}),Eo($o),eo},Lo=(uo,po={focusOnInput:!1})=>{let bo=$$6({value:uo,field:"iso2",countries:to});if(!bo){console.error(`[react-international-phone]: can not find a country with "${uo}" iso2 code`);return}let _o=lo?"":`${ro}${bo.dialCode}${io}`;jo({inputValue:_o,phone:`${ro}${bo.dialCode}`,country:bo.iso2}),po.focusOnInput&&Promise.resolve().then(()=>{var $o;($o=wo.current)==null||$o.focus()})},[Bo,xo]=reactExports.useState(!1);return reactExports.useEffect(()=>{if(!Bo){xo(!0),eo!==ko&&(ho==null||ho({inputValue:Ao,phone:ko,country:Fo}));return}if(eo===ko)return;let{phone:uo,inputValue:po,country:bo}=W$6({value:eo,country:Fo,insertDialCodeOnEmpty:!so,...yo});jo({phone:uo,inputValue:po,country:bo.iso2})},[eo]),{phone:ko,inputValue:Ao,country:Fo,setCountry:Lo,handlePhoneValueChange:Xo,inputRef:wo}},Q$7=({phone:Xr,country:eo,defaultMask:to="............",disableFormatting:ro=!1})=>{let no=eo.format,io=ao=>ro?ao.replace(new RegExp(`[^${J$4}]`,"g"),""):ao;if(!no)return io(to);if(typeof no=="string")return io(no);if(!no.default)return console.error(`[react-international-phone]: default mask for ${eo.iso2} is not provided`),io(to);let oo=Object.keys(no).find(ao=>{if(ao==="default")return!1;if(!(ao.charAt(0)==="/"&&ao.charAt(ao.length-1)==="/"))return console.error(`[react-international-phone]: format regex "${ao}" for ${eo.iso2} is not valid`),!1;let so=new RegExp(ao.substring(1,ao.length-1)),co=Xr.replace(eo.dialCode,"");return so.test(z$9(co))});return io(oo?no[oo]:no.default)},M$5=Xr=>{let[eo,to,ro,no,io,oo]=Xr;return{name:eo,iso2:to,dialCode:ro,format:no,priority:io,areaCodes:oo}},_e$3=Xr=>`Field "${Xr}" is not supported`,$$6=({field:Xr,value:eo,countries:to=R$7})=>{if(["priority"].includes(Xr))throw new Error(_e$3(Xr));let ro=to.find(no=>{let io=M$5(no);return eo===io[Xr]});if(ro)return M$5(ro)},X$4=({phone:Xr,countries:eo=R$7,currentCountryIso2:to})=>{var ao;let ro={country:void 0,fullDialCodeMatch:!1};if(!Xr)return ro;let no=z$9(Xr);if(!no)return ro;let io=ro,oo=({country:so,fullDialCodeMatch:co})=>{var ho,go;let lo=so.dialCode===((ho=io.country)==null?void 0:ho.dialCode),fo=(so.priority??0)<(((go=io.country)==null?void 0:go.priority)??0);(!lo||fo)&&(io={country:so,fullDialCodeMatch:co})};for(let so of eo){let co=M$5(so),{dialCode:lo,areaCodes:fo}=co;if(no.startsWith(lo)){let ho=io.country?Number(lo)>=Number(io.country.dialCode):!0;if(fo){let go=no.substring(lo.length);for(let yo of fo)if(go.startsWith(yo))return{country:co,fullDialCodeMatch:!0}}(ho||lo===no||!io.fullDialCodeMatch)&&oo({country:co,fullDialCodeMatch:!0})}io.fullDialCodeMatch||no.length{if(!(lo!=null&&lo.areaCodes))return!1;let fo=no.substring(lo.dialCode.length);return lo.areaCodes.some(ho=>ho.startsWith(fo))})(so):!1;io&&((ao=io.country)==null?void 0:ao.dialCode)===so.dialCode&&io.country!==so&&io.fullDialCodeMatch&&(!so.areaCodes||co)&&(io={country:so,fullDialCodeMatch:!0})}return io},Ae$2=(Xr,eo)=>{let to=parseInt(Xr,16);return Number(to+eo).toString(16)},Te$3="abcdefghijklmnopqrstuvwxyz",Ee$2="1f1e6",we$2=Te$3.split("").reduce((Xr,eo,to)=>({...Xr,[eo]:Ae$2(Ee$2,to)}),{}),Le$3=Xr=>[we$2[Xr[0]],we$2[Xr[1]]].join("-"),q$8=({iso2:Xr,size:eo,src:to,protocol:ro="https",disableLazyLoading:no,className:io,style:oo,...ao})=>{if(!Xr)return React.createElement("img",{className:P$7({addPrefix:["flag-emoji"],rawClassNames:[io]}),width:eo,height:eo,...ao});let so=()=>{if(to)return to;let co=Le$3(Xr);return`${ro}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${co}.svg`};return React.createElement("img",{className:P$7({addPrefix:["flag-emoji"],rawClassNames:[io]}),src:so(),width:eo,height:eo,draggable:!1,"data-country":Xr,loading:no?void 0:"lazy",style:{width:eo,height:eo,...oo},alt:"",...ao})},ze$3=1e3,ne$1=({show:Xr,dialCodePrefix:eo="+",selectedCountry:to,countries:ro=R$7,preferredCountries:no=[],flags:io,onSelect:oo,onClose:ao,...so})=>{let co=reactExports.useRef(null),lo=reactExports.useRef(),fo=reactExports.useMemo(()=>{if(!no||!no.length)return ro;let Mo=[],No=[...ro];for(let Do of no){let Fo=No.findIndex(Xo=>M$5(Xo).iso2===Do);if(Fo!==-1){let Xo=No.splice(Fo,1)[0];Mo.push(Xo)}}return Mo.concat(No)},[ro,no]),ho=reactExports.useRef({updatedAt:void 0,value:""}),go=Mo=>{let No=ho.current.updatedAt&&new Date().getTime()-ho.current.updatedAt.getTime()>ze$3;ho.current={value:No?Mo:`${ho.current.value}${Mo}`,updatedAt:new Date};let Do=fo.findIndex(Fo=>M$5(Fo).name.toLowerCase().startsWith(ho.current.value));Do!==-1&&wo(Do)},yo=reactExports.useCallback(Mo=>fo.findIndex(No=>M$5(No).iso2===Mo),[fo]),[vo,wo]=reactExports.useState(yo(to)),Eo=()=>{lo.current!==to&&wo(yo(to))},ko=reactExports.useCallback(Mo=>{wo(yo(Mo.iso2)),oo==null||oo(Mo)},[oo,yo]),Ao=Mo=>{let No=fo.length-1,Do=Fo=>Mo==="prev"?Fo-1:Mo==="next"?Fo+1:Mo==="last"?No:0;wo(Fo=>{let Xo=Do(Fo);return Xo<0?0:Xo>No?No:Xo})},Po=Mo=>{if(Mo.stopPropagation(),Mo.key==="Enter"){Mo.preventDefault();let No=M$5(fo[vo]);ko(No);return}if(Mo.key==="Escape"){ao==null||ao();return}if(Mo.key==="ArrowUp"){Mo.preventDefault(),Ao("prev");return}if(Mo.key==="ArrowDown"){Mo.preventDefault(),Ao("next");return}if(Mo.key==="PageUp"){Mo.preventDefault(),Ao("first");return}if(Mo.key==="PageDown"){Mo.preventDefault(),Ao("last");return}Mo.key===" "&&Mo.preventDefault(),Mo.key.length===1&&!Mo.altKey&&!Mo.ctrlKey&&!Mo.metaKey&&go(Mo.key.toLocaleLowerCase())},jo=reactExports.useCallback(()=>{if(!co.current||vo===void 0)return;let Mo=M$5(fo[vo]).iso2;if(Mo===lo.current)return;let No=co.current.querySelector(`[data-country="${Mo}"]`);No&&(ue$4(co.current,No),lo.current=Mo)},[vo,fo]);return reactExports.useEffect(()=>{jo()},[vo,jo]),reactExports.useEffect(()=>{co.current&&(Xr?co.current.focus():Eo())},[Xr]),reactExports.useEffect(()=>{Eo()},[to]),React.createElement("ul",{ref:co,role:"listbox",className:P$7({addPrefix:["country-selector-dropdown"],rawClassNames:[so.className]}),style:{display:Xr?"block":"none",...so.style},onKeyDown:Po,onBlur:ao,tabIndex:-1,"aria-activedescendant":`react-international-phone__${M$5(fo[vo]).iso2}-option`},fo.map((Mo,No)=>{let Do=M$5(Mo),Fo=Do.iso2===to,Xo=No===vo,Lo=no.includes(Do.iso2),Bo=No===no.length-1,xo=io==null?void 0:io.find(uo=>uo.iso2===Do.iso2);return React.createElement(React.Fragment,{key:Do.iso2},React.createElement("li",{"data-country":Do.iso2,role:"option","aria-selected":Fo,"aria-label":`${Do.name} ${eo}${Do.dialCode}`,id:`react-international-phone__${Do.iso2}-option`,className:P$7({addPrefix:["country-selector-dropdown__list-item",Lo&&"country-selector-dropdown__list-item--preferred",Fo&&"country-selector-dropdown__list-item--selected",Xo&&"country-selector-dropdown__list-item--focused"],rawClassNames:[so.listItemClassName]}),onClick:()=>ko(Do),style:so.listItemStyle,title:Do.name},React.createElement(q$8,{iso2:Do.iso2,src:xo==null?void 0:xo.src,className:P$7({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[so.listItemFlagClassName]}),style:so.listItemFlagStyle}),React.createElement("span",{className:P$7({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[so.listItemCountryNameClassName]}),style:so.listItemCountryNameStyle},Do.name),React.createElement("span",{className:P$7({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[so.listItemDialCodeClassName]}),style:so.listItemDialCodeStyle},eo,Do.dialCode)),Bo?React.createElement("hr",{className:P$7({addPrefix:["country-selector-dropdown__preferred-list-divider"],rawClassNames:[so.preferredListDividerClassName]}),style:so.preferredListDividerStyle}):null)}))},ae$4=({selectedCountry:Xr,onSelect:eo,disabled:to,hideDropdown:ro,countries:no=R$7,preferredCountries:io=[],flags:oo,renderButtonWrapper:ao,...so})=>{let[co,lo]=reactExports.useState(!1),fo=reactExports.useMemo(()=>{if(Xr)return $$6({value:Xr,field:"iso2",countries:no})},[no,Xr]),ho=reactExports.useRef(null),go=vo=>{vo.key&&["ArrowUp","ArrowDown"].includes(vo.key)&&(vo.preventDefault(),lo(!0))},yo=()=>{var Eo;let vo={title:fo==null?void 0:fo.name,onClick:()=>lo(ko=>!ko),onMouseDown:ko=>ko.preventDefault(),onKeyDown:go,disabled:ro||to,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":co},wo=React.createElement("div",{className:P$7({addPrefix:["country-selector-button__button-content"],rawClassNames:[so.buttonContentWrapperClassName]}),style:so.buttonContentWrapperStyle},React.createElement(q$8,{iso2:Xr,src:(Eo=oo==null?void 0:oo.find(ko=>ko.iso2===Xr))==null?void 0:Eo.src,className:P$7({addPrefix:["country-selector-button__flag-emoji",to&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[so.flagClassName]}),style:{visibility:Xr?"visible":"hidden",...so.flagStyle}}),!ro&&React.createElement("div",{className:P$7({addPrefix:["country-selector-button__dropdown-arrow",to&&"country-selector-button__dropdown-arrow--disabled",co&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[so.dropdownArrowClassName]}),style:so.dropdownArrowStyle}));return ao?ao({children:wo,rootProps:vo}):React.createElement("button",{...vo,type:"button",className:P$7({addPrefix:["country-selector-button",co&&"country-selector-button--active",to&&"country-selector-button--disabled",ro&&"country-selector-button--hide-dropdown"],rawClassNames:[so.buttonClassName]}),"data-country":Xr,style:so.buttonStyle},wo)};return React.createElement("div",{className:P$7({addPrefix:["country-selector"],rawClassNames:[so.className]}),style:so.style,ref:ho},yo(),React.createElement(ne$1,{show:co,countries:no,preferredCountries:io,flags:oo,onSelect:vo=>{lo(!1),eo==null||eo(vo)},selectedCountry:Xr,onClose:()=>{lo(!1)},...so.dropdownStyleProps}))},ie$3=({dialCode:Xr,prefix:eo,disabled:to,style:ro,className:no})=>React.createElement("div",{className:P$7({addPrefix:["dial-code-preview",to&&"dial-code-preview--disabled"],rawClassNames:[no]}),style:ro},`${eo}${Xr}`);reactExports.forwardRef(({value:Xr,onChange:eo,countries:to=R$7,preferredCountries:ro=[],hideDropdown:no,showDisabledDialCodeAndPrefix:io,disableFocusAfterCountrySelect:oo,flags:ao,style:so,className:co,inputStyle:lo,inputClassName:fo,countrySelectorStyleProps:ho,dialCodePreviewStyleProps:go,inputProps:yo,placeholder:vo,disabled:wo,name:Eo,onFocus:ko,onBlur:Ao,required:Po,autoFocus:jo,...Mo},No)=>{let{phone:Do,inputValue:Fo,inputRef:Xo,country:Lo,setCountry:Bo,handlePhoneValueChange:xo}=ee$5({value:Xr,countries:to,...Mo,onChange:po=>{eo==null||eo(po.phone,{country:po.country,inputValue:po.inputValue})}}),uo=Mo.disableDialCodeAndPrefix&&io&&(Lo==null?void 0:Lo.dialCode);return reactExports.useImperativeHandle(No,()=>Xo.current?Object.assign(Xo.current,{setCountry:Bo,state:{phone:Do,inputValue:Fo,country:Lo}}):null,[Xo,Bo,Do,Fo,Lo]),React.createElement("div",{ref:No,className:P$7({addPrefix:["input-container"],rawClassNames:[co]}),style:so},React.createElement(ae$4,{onSelect:po=>Bo(po.iso2,{focusOnInput:!oo}),flags:ao,selectedCountry:Lo.iso2,countries:to,preferredCountries:ro,disabled:wo,hideDropdown:no,...ho}),uo&&React.createElement(ie$3,{dialCode:Lo.dialCode,prefix:Mo.prefix??"+",disabled:wo,...go}),React.createElement("input",{onChange:xo,value:Fo,type:"tel",ref:Xo,className:P$7({addPrefix:["input",wo&&"input--disabled"],rawClassNames:[fo]}),placeholder:vo,disabled:wo,style:lo,name:Eo,onFocus:ko,onBlur:Ao,autoFocus:jo,required:Po,...yo}))});let ApiEndpoint$1=class{};ApiEndpoint$1.getBaseUrl=()=>{if(!ApiEndpoint$1.__baseUrl__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint$1.__baseUrl__};ApiEndpoint$1.setBaseUrl=Xr=>{Xr?ApiEndpoint$1.__baseUrl__=Xr:ApiEndpoint$1.__baseUrl__=new Configuration().basePath};const hasPendingMfaAction=Xr=>{var eo;return((eo=Xr.scope)===null||eo===void 0?void 0:eo.includes("requiresAdditionalAuth"))||Xr.mfaBackupCodeAcknowledgement===MfaBackupCodeAcknowledgement.Pending},hasPendingRequirements=Xr=>{var eo;return!!(!((eo=Xr.missingFields)===null||eo===void 0)&&eo.length)||hasPendingMfaAction(Xr)},{getUser,setUser,useUser:useUserRaw}=createStoreState("user"),useUser=()=>{const Xr=reactExports.useRef(!1),eo=useUserRaw();return eo?!Xr.current&&hasPendingRequirements(eo)?{userWithMissingInfo:eo}:(Xr.current=!0,{user:eo}):(Xr.current=!1,{})},consoleLogger={type:"logger",log(Xr){this.output("log",Xr)},warn(Xr){this.output("warn",Xr)},error(Xr){this.output("error",Xr)},output(Xr,eo){console&&console[Xr]&&console[Xr].apply(console,eo)}};let Logger$1=class wv{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(eo,to)}init(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=to.prefix||"i18next:",this.logger=eo||consoleLogger,this.options=to,this.debug=to.debug}log(){for(var eo=arguments.length,to=new Array(eo),ro=0;ro{this.observers[ro]=this.observers[ro]||[],this.observers[ro].push(to)}),this}off(eo,to){if(this.observers[eo]){if(!to){delete this.observers[eo];return}this.observers[eo]=this.observers[eo].filter(ro=>ro!==to)}}emit(eo){for(var to=arguments.length,ro=new Array(to>1?to-1:0),no=1;no{oo(...ro)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(oo=>{oo.apply(oo,[eo,...ro])})}};function defer(){let Xr,eo;const to=new Promise((ro,no)=>{Xr=ro,eo=no});return to.resolve=Xr,to.reject=eo,to}function makeString(Xr){return Xr==null?"":""+Xr}function copy$1(Xr,eo,to){Xr.forEach(ro=>{eo[ro]&&(to[ro]=eo[ro])})}function getLastOfPath(Xr,eo,to){function ro(oo){return oo&&oo.indexOf("###")>-1?oo.replace(/###/g,"."):oo}function no(){return!Xr||typeof Xr=="string"}const io=typeof eo!="string"?[].concat(eo):eo.split(".");for(;io.length>1;){if(no())return{};const oo=ro(io.shift());!Xr[oo]&&to&&(Xr[oo]=new to),Object.prototype.hasOwnProperty.call(Xr,oo)?Xr=Xr[oo]:Xr={}}return no()?{}:{obj:Xr,k:ro(io.shift())}}function setPath(Xr,eo,to){const{obj:ro,k:no}=getLastOfPath(Xr,eo,Object);ro[no]=to}function pushPath(Xr,eo,to,ro){const{obj:no,k:io}=getLastOfPath(Xr,eo,Object);no[io]=no[io]||[],no[io].push(to)}function getPath(Xr,eo){const{obj:to,k:ro}=getLastOfPath(Xr,eo);if(to)return to[ro]}function getPathWithDefaults(Xr,eo,to){const ro=getPath(Xr,to);return ro!==void 0?ro:getPath(eo,to)}function deepExtend(Xr,eo,to){for(const ro in eo)ro!=="__proto__"&&ro!=="constructor"&&(ro in Xr?typeof Xr[ro]=="string"||Xr[ro]instanceof String||typeof eo[ro]=="string"||eo[ro]instanceof String?to&&(Xr[ro]=eo[ro]):deepExtend(Xr[ro],eo[ro],to):Xr[ro]=eo[ro]);return Xr}function regexEscape(Xr){return Xr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape$1(Xr){return typeof Xr=="string"?Xr.replace(/[&<>"'\/]/g,eo=>_entityMap[eo]):Xr}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(Xr,eo,to){eo=eo||"",to=to||"";const ro=chars.filter(oo=>eo.indexOf(oo)<0&&to.indexOf(oo)<0);if(ro.length===0)return!0;const no=new RegExp(`(${ro.map(oo=>oo==="?"?"\\?":oo).join("|")})`);let io=!no.test(Xr);if(!io){const oo=Xr.indexOf(to);oo>0&&!no.test(Xr.substring(0,oo))&&(io=!0)}return io}function deepFind(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!Xr)return;if(Xr[eo])return Xr[eo];const ro=eo.split(to);let no=Xr;for(let io=0;ioio+oo;)oo++,ao=ro.slice(io,io+oo).join(to),so=no[ao];if(so===void 0)return;if(so===null)return null;if(eo.endsWith(ao)){if(typeof so=="string")return so;if(ao&&typeof so[ao]=="string")return so[ao]}const co=ro.slice(io+oo).join(to);return co?deepFind(so,co,to):void 0}no=no[ro[io]]}return no}function getCleanedCode(Xr){return Xr&&Xr.indexOf("_")>0?Xr.replace("_","-"):Xr}class ResourceStore extends EventEmitter$2{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=eo||{},this.options=to,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(eo){this.options.ns.indexOf(eo)<0&&this.options.ns.push(eo)}removeNamespaces(eo){const to=this.options.ns.indexOf(eo);to>-1&&this.options.ns.splice(to,1)}getResource(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const io=no.keySeparator!==void 0?no.keySeparator:this.options.keySeparator,oo=no.ignoreJSONStructure!==void 0?no.ignoreJSONStructure:this.options.ignoreJSONStructure;let ao=[eo,to];ro&&typeof ro!="string"&&(ao=ao.concat(ro)),ro&&typeof ro=="string"&&(ao=ao.concat(io?ro.split(io):ro)),eo.indexOf(".")>-1&&(ao=eo.split("."));const so=getPath(this.data,ao);return so||!oo||typeof ro!="string"?so:deepFind(this.data&&this.data[eo]&&this.data[eo][to],ro,io)}addResource(eo,to,ro,no){let io=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const oo=io.keySeparator!==void 0?io.keySeparator:this.options.keySeparator;let ao=[eo,to];ro&&(ao=ao.concat(oo?ro.split(oo):ro)),eo.indexOf(".")>-1&&(ao=eo.split("."),no=to,to=ao[1]),this.addNamespaces(to),setPath(this.data,ao,no),io.silent||this.emit("added",eo,to,ro,no)}addResources(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const io in ro)(typeof ro[io]=="string"||Object.prototype.toString.apply(ro[io])==="[object Array]")&&this.addResource(eo,to,io,ro[io],{silent:!0});no.silent||this.emit("added",eo,to,ro)}addResourceBundle(eo,to,ro,no,io){let oo=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},ao=[eo,to];eo.indexOf(".")>-1&&(ao=eo.split("."),no=ro,ro=to,to=ao[1]),this.addNamespaces(to);let so=getPath(this.data,ao)||{};no?deepExtend(so,ro,io):so={...so,...ro},setPath(this.data,ao,so),oo.silent||this.emit("added",eo,to,ro)}removeResourceBundle(eo,to){this.hasResourceBundle(eo,to)&&delete this.data[eo][to],this.removeNamespaces(to),this.emit("removed",eo,to)}hasResourceBundle(eo,to){return this.getResource(eo,to)!==void 0}getResourceBundle(eo,to){return to||(to=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(eo,to)}:this.getResource(eo,to)}getDataByLanguage(eo){return this.data[eo]}hasLanguageSomeTranslations(eo){const to=this.getDataByLanguage(eo);return!!(to&&Object.keys(to)||[]).find(no=>to[no]&&Object.keys(to[no]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(Xr){this.processors[Xr.name]=Xr},handle(Xr,eo,to,ro,no){return Xr.forEach(io=>{this.processors[io]&&(eo=this.processors[io].process(eo,to,ro,no))}),eo}};const checkedLoadedFor={};class Translator extends EventEmitter$2{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy$1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],eo,this),this.options=to,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(eo){eo&&(this.language=eo)}exists(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(eo==null)return!1;const ro=this.resolve(eo,to);return ro&&ro.res!==void 0}extractFromKey(eo,to){let ro=to.nsSeparator!==void 0?to.nsSeparator:this.options.nsSeparator;ro===void 0&&(ro=":");const no=to.keySeparator!==void 0?to.keySeparator:this.options.keySeparator;let io=to.ns||this.options.defaultNS||[];const oo=ro&&eo.indexOf(ro)>-1,ao=!this.options.userDefinedKeySeparator&&!to.keySeparator&&!this.options.userDefinedNsSeparator&&!to.nsSeparator&&!looksLikeObjectPath(eo,ro,no);if(oo&&!ao){const so=eo.match(this.interpolator.nestingRegexp);if(so&&so.length>0)return{key:eo,namespaces:io};const co=eo.split(ro);(ro!==no||ro===no&&this.options.ns.indexOf(co[0])>-1)&&(io=co.shift()),eo=co.join(no)}return typeof io=="string"&&(io=[io]),{key:eo,namespaces:io}}translate(eo,to,ro){if(typeof to!="object"&&this.options.overloadTranslationOptionHandler&&(to=this.options.overloadTranslationOptionHandler(arguments)),typeof to=="object"&&(to={...to}),to||(to={}),eo==null)return"";Array.isArray(eo)||(eo=[String(eo)]);const no=to.returnDetails!==void 0?to.returnDetails:this.options.returnDetails,io=to.keySeparator!==void 0?to.keySeparator:this.options.keySeparator,{key:oo,namespaces:ao}=this.extractFromKey(eo[eo.length-1],to),so=ao[ao.length-1],co=to.lng||this.language,lo=to.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(co&&co.toLowerCase()==="cimode"){if(lo){const Po=to.nsSeparator||this.options.nsSeparator;return no?{res:`${so}${Po}${oo}`,usedKey:oo,exactUsedKey:oo,usedLng:co,usedNS:so}:`${so}${Po}${oo}`}return no?{res:oo,usedKey:oo,exactUsedKey:oo,usedLng:co,usedNS:so}:oo}const fo=this.resolve(eo,to);let ho=fo&&fo.res;const go=fo&&fo.usedKey||oo,yo=fo&&fo.exactUsedKey||oo,vo=Object.prototype.toString.apply(ho),wo=["[object Number]","[object Function]","[object RegExp]"],Eo=to.joinArrays!==void 0?to.joinArrays:this.options.joinArrays,ko=!this.i18nFormat||this.i18nFormat.handleAsObject;if(ko&&ho&&(typeof ho!="string"&&typeof ho!="boolean"&&typeof ho!="number")&&wo.indexOf(vo)<0&&!(typeof Eo=="string"&&vo==="[object Array]")){if(!to.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Po=this.options.returnedObjectHandler?this.options.returnedObjectHandler(go,ho,{...to,ns:ao}):`key '${oo} (${this.language})' returned an object instead of string.`;return no?(fo.res=Po,fo):Po}if(io){const Po=vo==="[object Array]",jo=Po?[]:{},Mo=Po?yo:go;for(const No in ho)if(Object.prototype.hasOwnProperty.call(ho,No)){const Do=`${Mo}${io}${No}`;jo[No]=this.translate(Do,{...to,joinArrays:!1,ns:ao}),jo[No]===Do&&(jo[No]=ho[No])}ho=jo}}else if(ko&&typeof Eo=="string"&&vo==="[object Array]")ho=ho.join(Eo),ho&&(ho=this.extendTranslation(ho,eo,to,ro));else{let Po=!1,jo=!1;const Mo=to.count!==void 0&&typeof to.count!="string",No=Translator.hasDefaultValue(to),Do=Mo?this.pluralResolver.getSuffix(co,to.count,to):"",Fo=to.ordinal&&Mo?this.pluralResolver.getSuffix(co,to.count,{ordinal:!1}):"",Xo=to[`defaultValue${Do}`]||to[`defaultValue${Fo}`]||to.defaultValue;!this.isValidLookup(ho)&&No&&(Po=!0,ho=Xo),this.isValidLookup(ho)||(jo=!0,ho=oo);const Bo=(to.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&jo?void 0:ho,xo=No&&Xo!==ho&&this.options.updateMissing;if(jo||Po||xo){if(this.logger.log(xo?"updateKey":"missingKey",co,so,oo,xo?Xo:ho),io){const _o=this.resolve(oo,{...to,keySeparator:!1});_o&&_o.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let uo=[];const po=this.languageUtils.getFallbackCodes(this.options.fallbackLng,to.lng||this.language);if(this.options.saveMissingTo==="fallback"&&po&&po[0])for(let _o=0;_o{const Ro=No&&Co!==ho?Co:Bo;this.options.missingKeyHandler?this.options.missingKeyHandler(_o,so,$o,Ro,xo,to):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(_o,so,$o,Ro,xo,to),this.emit("missingKey",_o,so,$o,ho)};this.options.saveMissing&&(this.options.saveMissingPlurals&&Mo?uo.forEach(_o=>{this.pluralResolver.getSuffixes(_o,to).forEach($o=>{bo([_o],oo+$o,to[`defaultValue${$o}`]||Xo)})}):bo(uo,oo,Xo))}ho=this.extendTranslation(ho,eo,to,fo,ro),jo&&ho===oo&&this.options.appendNamespaceToMissingKey&&(ho=`${so}:${oo}`),(jo||Po)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?ho=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${so}:${oo}`:oo,Po?ho:void 0):ho=this.options.parseMissingKeyHandler(ho))}return no?(fo.res=ho,fo):ho}extendTranslation(eo,to,ro,no,io){var oo=this;if(this.i18nFormat&&this.i18nFormat.parse)eo=this.i18nFormat.parse(eo,{...this.options.interpolation.defaultVariables,...ro},ro.lng||this.language||no.usedLng,no.usedNS,no.usedKey,{resolved:no});else if(!ro.skipInterpolation){ro.interpolation&&this.interpolator.init({...ro,interpolation:{...this.options.interpolation,...ro.interpolation}});const co=typeof eo=="string"&&(ro&&ro.interpolation&&ro.interpolation.skipOnVariables!==void 0?ro.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let lo;if(co){const ho=eo.match(this.interpolator.nestingRegexp);lo=ho&&ho.length}let fo=ro.replace&&typeof ro.replace!="string"?ro.replace:ro;if(this.options.interpolation.defaultVariables&&(fo={...this.options.interpolation.defaultVariables,...fo}),eo=this.interpolator.interpolate(eo,fo,ro.lng||this.language,ro),co){const ho=eo.match(this.interpolator.nestingRegexp),go=ho&&ho.length;lo1&&arguments[1]!==void 0?arguments[1]:{},ro,no,io,oo,ao;return typeof eo=="string"&&(eo=[eo]),eo.forEach(so=>{if(this.isValidLookup(ro))return;const co=this.extractFromKey(so,to),lo=co.key;no=lo;let fo=co.namespaces;this.options.fallbackNS&&(fo=fo.concat(this.options.fallbackNS));const ho=to.count!==void 0&&typeof to.count!="string",go=ho&&!to.ordinal&&to.count===0&&this.pluralResolver.shouldUseIntlApi(),yo=to.context!==void 0&&(typeof to.context=="string"||typeof to.context=="number")&&to.context!=="",vo=to.lngs?to.lngs:this.languageUtils.toResolveHierarchy(to.lng||this.language,to.fallbackLng);fo.forEach(wo=>{this.isValidLookup(ro)||(ao=wo,!checkedLoadedFor[`${vo[0]}-${wo}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(ao)&&(checkedLoadedFor[`${vo[0]}-${wo}`]=!0,this.logger.warn(`key "${no}" for languages "${vo.join(", ")}" won't get resolved as namespace "${ao}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),vo.forEach(Eo=>{if(this.isValidLookup(ro))return;oo=Eo;const ko=[lo];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(ko,lo,Eo,wo,to);else{let Po;ho&&(Po=this.pluralResolver.getSuffix(Eo,to.count,to));const jo=`${this.options.pluralSeparator}zero`,Mo=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(ho&&(ko.push(lo+Po),to.ordinal&&Po.indexOf(Mo)===0&&ko.push(lo+Po.replace(Mo,this.options.pluralSeparator)),go&&ko.push(lo+jo)),yo){const No=`${lo}${this.options.contextSeparator}${to.context}`;ko.push(No),ho&&(ko.push(No+Po),to.ordinal&&Po.indexOf(Mo)===0&&ko.push(No+Po.replace(Mo,this.options.pluralSeparator)),go&&ko.push(No+jo))}}let Ao;for(;Ao=ko.pop();)this.isValidLookup(ro)||(io=Ao,ro=this.getResource(Eo,wo,Ao,to))}))})}),{res:ro,usedKey:no,exactUsedKey:io,usedLng:oo,usedNS:ao}}isValidLookup(eo){return eo!==void 0&&!(!this.options.returnNull&&eo===null)&&!(!this.options.returnEmptyString&&eo==="")}getResource(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(eo,to,ro,no):this.resourceStore.getResource(eo,to,ro,no)}static hasDefaultValue(eo){const to="defaultValue";for(const ro in eo)if(Object.prototype.hasOwnProperty.call(eo,ro)&&to===ro.substring(0,to.length)&&eo[ro]!==void 0)return!0;return!1}}function capitalize$4(Xr){return Xr.charAt(0).toUpperCase()+Xr.slice(1)}class LanguageUtil{constructor(eo){this.options=eo,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(eo){if(eo=getCleanedCode(eo),!eo||eo.indexOf("-")<0)return null;const to=eo.split("-");return to.length===2||(to.pop(),to[to.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(to.join("-"))}getLanguagePartFromCode(eo){if(eo=getCleanedCode(eo),!eo||eo.indexOf("-")<0)return eo;const to=eo.split("-");return this.formatLanguageCode(to[0])}formatLanguageCode(eo){if(typeof eo=="string"&&eo.indexOf("-")>-1){const to=["hans","hant","latn","cyrl","cans","mong","arab"];let ro=eo.split("-");return this.options.lowerCaseLng?ro=ro.map(no=>no.toLowerCase()):ro.length===2?(ro[0]=ro[0].toLowerCase(),ro[1]=ro[1].toUpperCase(),to.indexOf(ro[1].toLowerCase())>-1&&(ro[1]=capitalize$4(ro[1].toLowerCase()))):ro.length===3&&(ro[0]=ro[0].toLowerCase(),ro[1].length===2&&(ro[1]=ro[1].toUpperCase()),ro[0]!=="sgn"&&ro[2].length===2&&(ro[2]=ro[2].toUpperCase()),to.indexOf(ro[1].toLowerCase())>-1&&(ro[1]=capitalize$4(ro[1].toLowerCase())),to.indexOf(ro[2].toLowerCase())>-1&&(ro[2]=capitalize$4(ro[2].toLowerCase()))),ro.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?eo.toLowerCase():eo}isSupportedCode(eo){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(eo=this.getLanguagePartFromCode(eo)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(eo)>-1}getBestMatchFromCodes(eo){if(!eo)return null;let to;return eo.forEach(ro=>{if(to)return;const no=this.formatLanguageCode(ro);(!this.options.supportedLngs||this.isSupportedCode(no))&&(to=no)}),!to&&this.options.supportedLngs&&eo.forEach(ro=>{if(to)return;const no=this.getLanguagePartFromCode(ro);if(this.isSupportedCode(no))return to=no;to=this.options.supportedLngs.find(io=>{if(io===no)return io;if(!(io.indexOf("-")<0&&no.indexOf("-")<0)&&io.indexOf(no)===0)return io})}),to||(to=this.getFallbackCodes(this.options.fallbackLng)[0]),to}getFallbackCodes(eo,to){if(!eo)return[];if(typeof eo=="function"&&(eo=eo(to)),typeof eo=="string"&&(eo=[eo]),Object.prototype.toString.apply(eo)==="[object Array]")return eo;if(!to)return eo.default||[];let ro=eo[to];return ro||(ro=eo[this.getScriptPartFromCode(to)]),ro||(ro=eo[this.formatLanguageCode(to)]),ro||(ro=eo[this.getLanguagePartFromCode(to)]),ro||(ro=eo.default),ro||[]}toResolveHierarchy(eo,to){const ro=this.getFallbackCodes(to||this.options.fallbackLng||[],eo),no=[],io=oo=>{oo&&(this.isSupportedCode(oo)?no.push(oo):this.logger.warn(`rejecting language code not found in supportedLngs: ${oo}`))};return typeof eo=="string"&&(eo.indexOf("-")>-1||eo.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&io(this.formatLanguageCode(eo)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&io(this.getScriptPartFromCode(eo)),this.options.load!=="currentOnly"&&io(this.getLanguagePartFromCode(eo))):typeof eo=="string"&&io(this.formatLanguageCode(eo)),ro.forEach(oo=>{no.indexOf(oo)<0&&io(this.formatLanguageCode(oo))}),no}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(Xr){return+(Xr>1)},2:function(Xr){return+(Xr!=1)},3:function(Xr){return 0},4:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr%10>=2&&Xr%10<=4&&(Xr%100<10||Xr%100>=20)?1:2},5:function(Xr){return Xr==0?0:Xr==1?1:Xr==2?2:Xr%100>=3&&Xr%100<=10?3:Xr%100>=11?4:5},6:function(Xr){return Xr==1?0:Xr>=2&&Xr<=4?1:2},7:function(Xr){return Xr==1?0:Xr%10>=2&&Xr%10<=4&&(Xr%100<10||Xr%100>=20)?1:2},8:function(Xr){return Xr==1?0:Xr==2?1:Xr!=8&&Xr!=11?2:3},9:function(Xr){return+(Xr>=2)},10:function(Xr){return Xr==1?0:Xr==2?1:Xr<7?2:Xr<11?3:4},11:function(Xr){return Xr==1||Xr==11?0:Xr==2||Xr==12?1:Xr>2&&Xr<20?2:3},12:function(Xr){return+(Xr%10!=1||Xr%100==11)},13:function(Xr){return+(Xr!==0)},14:function(Xr){return Xr==1?0:Xr==2?1:Xr==3?2:3},15:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr%10>=2&&(Xr%100<10||Xr%100>=20)?1:2},16:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr!==0?1:2},17:function(Xr){return Xr==1||Xr%10==1&&Xr%100!=11?0:1},18:function(Xr){return Xr==0?0:Xr==1?1:2},19:function(Xr){return Xr==1?0:Xr==0||Xr%100>1&&Xr%100<11?1:Xr%100>10&&Xr%100<20?2:3},20:function(Xr){return Xr==1?0:Xr==0||Xr%100>0&&Xr%100<20?1:2},21:function(Xr){return Xr%100==1?1:Xr%100==2?2:Xr%100==3||Xr%100==4?3:0},22:function(Xr){return Xr==1?0:Xr==2?1:(Xr<0||Xr>10)&&Xr%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const Xr={};return sets.forEach(eo=>{eo.lngs.forEach(to=>{Xr[to]={numbers:eo.nr,plurals:_rulesPluralsTypes[eo.fc]}})}),Xr}class PluralResolver{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=eo,this.options=to,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(eo,to){this.rules[eo]=to}getRule(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(eo),{type:to.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[eo]||this.rules[this.languageUtils.getLanguagePartFromCode(eo)]}needsPlural(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ro=this.getRule(eo,to);return this.shouldUseIntlApi()?ro&&ro.resolvedOptions().pluralCategories.length>1:ro&&ro.numbers.length>1}getPluralFormsOfKey(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(eo,ro).map(no=>`${to}${no}`)}getSuffixes(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ro=this.getRule(eo,to);return ro?this.shouldUseIntlApi()?ro.resolvedOptions().pluralCategories.sort((no,io)=>suffixesOrder[no]-suffixesOrder[io]).map(no=>`${this.options.prepend}${to.ordinal?`ordinal${this.options.prepend}`:""}${no}`):ro.numbers.map(no=>this.getSuffix(eo,no,to)):[]}getSuffix(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const no=this.getRule(eo,ro);return no?this.shouldUseIntlApi()?`${this.options.prepend}${ro.ordinal?`ordinal${this.options.prepend}`:""}${no.select(to)}`:this.getSuffixRetroCompatible(no,to):(this.logger.warn(`no plural rule found for: ${eo}`),"")}getSuffixRetroCompatible(eo,to){const ro=eo.noAbs?eo.plurals(to):eo.plurals(Math.abs(to));let no=eo.numbers[ro];this.options.simplifyPluralSuffix&&eo.numbers.length===2&&eo.numbers[0]===1&&(no===2?no="plural":no===1&&(no=""));const io=()=>this.options.prepend&&no.toString()?this.options.prepend+no.toString():no.toString();return this.options.compatibilityJSON==="v1"?no===1?"":typeof no=="number"?`_plural_${no.toString()}`:io():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&eo.numbers.length===2&&eo.numbers[0]===1?io():this.options.prepend&&ro.toString()?this.options.prepend+ro.toString():ro.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(Xr,eo,to){let ro=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",no=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,io=getPathWithDefaults(Xr,eo,to);return!io&&no&&typeof to=="string"&&(io=deepFind(Xr,to,ro),io===void 0&&(io=deepFind(eo,to,ro))),io}class Interpolator{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=eo,this.format=eo.interpolation&&eo.interpolation.format||(to=>to),this.init(eo)}init(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};eo.interpolation||(eo.interpolation={escapeValue:!0});const to=eo.interpolation;this.escape=to.escape!==void 0?to.escape:escape$1,this.escapeValue=to.escapeValue!==void 0?to.escapeValue:!0,this.useRawValueToEscape=to.useRawValueToEscape!==void 0?to.useRawValueToEscape:!1,this.prefix=to.prefix?regexEscape(to.prefix):to.prefixEscaped||"{{",this.suffix=to.suffix?regexEscape(to.suffix):to.suffixEscaped||"}}",this.formatSeparator=to.formatSeparator?to.formatSeparator:to.formatSeparator||",",this.unescapePrefix=to.unescapeSuffix?"":to.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":to.unescapeSuffix||"",this.nestingPrefix=to.nestingPrefix?regexEscape(to.nestingPrefix):to.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=to.nestingSuffix?regexEscape(to.nestingSuffix):to.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=to.nestingOptionsSeparator?to.nestingOptionsSeparator:to.nestingOptionsSeparator||",",this.maxReplaces=to.maxReplaces?to.maxReplaces:1e3,this.alwaysFormat=to.alwaysFormat!==void 0?to.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const eo=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(eo,"g");const to=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(to,"g");const ro=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(ro,"g")}interpolate(eo,to,ro,no){let io,oo,ao;const so=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function co(yo){return yo.replace(/\$/g,"$$$$")}const lo=yo=>{if(yo.indexOf(this.formatSeparator)<0){const ko=deepFindWithDefaults(to,so,yo,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ko,void 0,ro,{...no,...to,interpolationkey:yo}):ko}const vo=yo.split(this.formatSeparator),wo=vo.shift().trim(),Eo=vo.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(to,so,wo,this.options.keySeparator,this.options.ignoreJSONStructure),Eo,ro,{...no,...to,interpolationkey:wo})};this.resetRegExp();const fo=no&&no.missingInterpolationHandler||this.options.missingInterpolationHandler,ho=no&&no.interpolation&&no.interpolation.skipOnVariables!==void 0?no.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:yo=>co(yo)},{regex:this.regexp,safeValue:yo=>this.escapeValue?co(this.escape(yo)):co(yo)}].forEach(yo=>{for(ao=0;io=yo.regex.exec(eo);){const vo=io[1].trim();if(oo=lo(vo),oo===void 0)if(typeof fo=="function"){const Eo=fo(eo,io,no);oo=typeof Eo=="string"?Eo:""}else if(no&&Object.prototype.hasOwnProperty.call(no,vo))oo="";else if(ho){oo=io[0];continue}else this.logger.warn(`missed to pass in variable ${vo} for interpolating ${eo}`),oo="";else typeof oo!="string"&&!this.useRawValueToEscape&&(oo=makeString(oo));const wo=yo.safeValue(oo);if(eo=eo.replace(io[0],wo),ho?(yo.regex.lastIndex+=oo.length,yo.regex.lastIndex-=io[0].length):yo.regex.lastIndex=0,ao++,ao>=this.maxReplaces)break}}),eo}nest(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},no,io,oo;function ao(so,co){const lo=this.nestingOptionsSeparator;if(so.indexOf(lo)<0)return so;const fo=so.split(new RegExp(`${lo}[ ]*{`));let ho=`{${fo[1]}`;so=fo[0],ho=this.interpolate(ho,oo);const go=ho.match(/'/g),yo=ho.match(/"/g);(go&&go.length%2===0&&!yo||yo.length%2!==0)&&(ho=ho.replace(/'/g,'"'));try{oo=JSON.parse(ho),co&&(oo={...co,...oo})}catch(vo){return this.logger.warn(`failed parsing options string in nesting for key ${so}`,vo),`${so}${lo}${ho}`}return delete oo.defaultValue,so}for(;no=this.nestingRegexp.exec(eo);){let so=[];oo={...ro},oo=oo.replace&&typeof oo.replace!="string"?oo.replace:oo,oo.applyPostProcessor=!1,delete oo.defaultValue;let co=!1;if(no[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(no[1])){const lo=no[1].split(this.formatSeparator).map(fo=>fo.trim());no[1]=lo.shift(),so=lo,co=!0}if(io=to(ao.call(this,no[1].trim(),oo),oo),io&&no[0]===eo&&typeof io!="string")return io;typeof io!="string"&&(io=makeString(io)),io||(this.logger.warn(`missed to resolve ${no[1]} for nesting ${eo}`),io=""),co&&(io=so.reduce((lo,fo)=>this.format(lo,fo,ro.lng,{...ro,interpolationkey:no[1].trim()}),io.trim())),eo=eo.replace(no[0],io),this.regexp.lastIndex=0}return eo}}function parseFormatStr(Xr){let eo=Xr.toLowerCase().trim();const to={};if(Xr.indexOf("(")>-1){const ro=Xr.split("(");eo=ro[0].toLowerCase().trim();const no=ro[1].substring(0,ro[1].length-1);eo==="currency"&&no.indexOf(":")<0?to.currency||(to.currency=no.trim()):eo==="relativetime"&&no.indexOf(":")<0?to.range||(to.range=no.trim()):no.split(";").forEach(oo=>{if(!oo)return;const[ao,...so]=oo.split(":"),co=so.join(":").trim().replace(/^'+|'+$/g,"");to[ao.trim()]||(to[ao.trim()]=co),co==="false"&&(to[ao.trim()]=!1),co==="true"&&(to[ao.trim()]=!0),isNaN(co)||(to[ao.trim()]=parseInt(co,10))})}return{formatName:eo,formatOptions:to}}function createCachedFormatter(Xr){const eo={};return function(ro,no,io){const oo=no+JSON.stringify(io);let ao=eo[oo];return ao||(ao=Xr(getCleanedCode(no),io),eo[oo]=ao),ao(ro)}}class Formatter{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=eo,this.formats={number:createCachedFormatter((to,ro)=>{const no=new Intl.NumberFormat(to,{...ro});return io=>no.format(io)}),currency:createCachedFormatter((to,ro)=>{const no=new Intl.NumberFormat(to,{...ro,style:"currency"});return io=>no.format(io)}),datetime:createCachedFormatter((to,ro)=>{const no=new Intl.DateTimeFormat(to,{...ro});return io=>no.format(io)}),relativetime:createCachedFormatter((to,ro)=>{const no=new Intl.RelativeTimeFormat(to,{...ro});return io=>no.format(io,ro.range||"day")}),list:createCachedFormatter((to,ro)=>{const no=new Intl.ListFormat(to,{...ro});return io=>no.format(io)})},this.init(eo)}init(eo){const ro=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=ro.formatSeparator?ro.formatSeparator:ro.formatSeparator||","}add(eo,to){this.formats[eo.toLowerCase().trim()]=to}addCached(eo,to){this.formats[eo.toLowerCase().trim()]=createCachedFormatter(to)}format(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return to.split(this.formatSeparator).reduce((ao,so)=>{const{formatName:co,formatOptions:lo}=parseFormatStr(so);if(this.formats[co]){let fo=ao;try{const ho=no&&no.formatParams&&no.formatParams[no.interpolationkey]||{},go=ho.locale||ho.lng||no.locale||no.lng||ro;fo=this.formats[co](ao,go,{...lo,...no,...ho})}catch(ho){this.logger.warn(ho)}return fo}else this.logger.warn(`there was no format function for ${co}`);return ao},eo)}}function removePending(Xr,eo){Xr.pending[eo]!==void 0&&(delete Xr.pending[eo],Xr.pendingCount--)}class Connector extends EventEmitter$2{constructor(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=eo,this.store=to,this.services=ro,this.languageUtils=ro.languageUtils,this.options=no,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=no.maxParallelReads||10,this.readingCalls=0,this.maxRetries=no.maxRetries>=0?no.maxRetries:5,this.retryTimeout=no.retryTimeout>=1?no.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(ro,no.backend,no)}queueLoad(eo,to,ro,no){const io={},oo={},ao={},so={};return eo.forEach(co=>{let lo=!0;to.forEach(fo=>{const ho=`${co}|${fo}`;!ro.reload&&this.store.hasResourceBundle(co,fo)?this.state[ho]=2:this.state[ho]<0||(this.state[ho]===1?oo[ho]===void 0&&(oo[ho]=!0):(this.state[ho]=1,lo=!1,oo[ho]===void 0&&(oo[ho]=!0),io[ho]===void 0&&(io[ho]=!0),so[fo]===void 0&&(so[fo]=!0)))}),lo||(ao[co]=!0)}),(Object.keys(io).length||Object.keys(oo).length)&&this.queue.push({pending:oo,pendingCount:Object.keys(oo).length,loaded:{},errors:[],callback:no}),{toLoad:Object.keys(io),pending:Object.keys(oo),toLoadLanguages:Object.keys(ao),toLoadNamespaces:Object.keys(so)}}loaded(eo,to,ro){const no=eo.split("|"),io=no[0],oo=no[1];to&&this.emit("failedLoading",io,oo,to),ro&&this.store.addResourceBundle(io,oo,ro),this.state[eo]=to?-1:2;const ao={};this.queue.forEach(so=>{pushPath(so.loaded,[io],oo),removePending(so,eo),to&&so.errors.push(to),so.pendingCount===0&&!so.done&&(Object.keys(so.loaded).forEach(co=>{ao[co]||(ao[co]={});const lo=so.loaded[co];lo.length&&lo.forEach(fo=>{ao[co][fo]===void 0&&(ao[co][fo]=!0)})}),so.done=!0,so.errors.length?so.callback(so.errors):so.callback())}),this.emit("loaded",ao),this.queue=this.queue.filter(so=>!so.done)}read(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,io=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,oo=arguments.length>5?arguments[5]:void 0;if(!eo.length)return oo(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:eo,ns:to,fcName:ro,tried:no,wait:io,callback:oo});return}this.readingCalls++;const ao=(co,lo)=>{if(this.readingCalls--,this.waitingReads.length>0){const fo=this.waitingReads.shift();this.read(fo.lng,fo.ns,fo.fcName,fo.tried,fo.wait,fo.callback)}if(co&&lo&&no{this.read.call(this,eo,to,ro,no+1,io*2,oo)},io);return}oo(co,lo)},so=this.backend[ro].bind(this.backend);if(so.length===2){try{const co=so(eo,to);co&&typeof co.then=="function"?co.then(lo=>ao(null,lo)).catch(ao):ao(null,co)}catch(co){ao(co)}return}return so(eo,to,ao)}prepareLoading(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},no=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),no&&no();typeof eo=="string"&&(eo=this.languageUtils.toResolveHierarchy(eo)),typeof to=="string"&&(to=[to]);const io=this.queueLoad(eo,to,ro,no);if(!io.toLoad.length)return io.pending.length||no(),null;io.toLoad.forEach(oo=>{this.loadOne(oo)})}load(eo,to,ro){this.prepareLoading(eo,to,{},ro)}reload(eo,to,ro){this.prepareLoading(eo,to,{reload:!0},ro)}loadOne(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const ro=eo.split("|"),no=ro[0],io=ro[1];this.read(no,io,"read",void 0,void 0,(oo,ao)=>{oo&&this.logger.warn(`${to}loading namespace ${io} for language ${no} failed`,oo),!oo&&ao&&this.logger.log(`${to}loaded namespace ${io} for language ${no}`,ao),this.loaded(eo,oo,ao)})}saveMissing(eo,to,ro,no,io){let oo=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},ao=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(to)){this.logger.warn(`did not save key "${ro}" as the namespace "${to}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(ro==null||ro==="")){if(this.backend&&this.backend.create){const so={...oo,isUpdate:io},co=this.backend.create.bind(this.backend);if(co.length<6)try{let lo;co.length===5?lo=co(eo,to,ro,no,so):lo=co(eo,to,ro,no),lo&&typeof lo.then=="function"?lo.then(fo=>ao(null,fo)).catch(ao):ao(null,lo)}catch(lo){ao(lo)}else co(eo,to,ro,no,ao,so)}!eo||!eo[0]||this.store.addResource(eo[0],to,ro,no)}}}function get$7(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(eo){let to={};if(typeof eo[1]=="object"&&(to=eo[1]),typeof eo[1]=="string"&&(to.defaultValue=eo[1]),typeof eo[2]=="string"&&(to.tDescription=eo[2]),typeof eo[2]=="object"||typeof eo[3]=="object"){const ro=eo[3]||eo[2];Object.keys(ro).forEach(no=>{to[no]=ro[no]})}return to},interpolation:{escapeValue:!0,format:(Xr,eo,to,ro)=>Xr,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(Xr){return typeof Xr.ns=="string"&&(Xr.ns=[Xr.ns]),typeof Xr.fallbackLng=="string"&&(Xr.fallbackLng=[Xr.fallbackLng]),typeof Xr.fallbackNS=="string"&&(Xr.fallbackNS=[Xr.fallbackNS]),Xr.supportedLngs&&Xr.supportedLngs.indexOf("cimode")<0&&(Xr.supportedLngs=Xr.supportedLngs.concat(["cimode"])),Xr}function noop$6(){}function bindMemberFunctions(Xr){Object.getOwnPropertyNames(Object.getPrototypeOf(Xr)).forEach(to=>{typeof Xr[to]=="function"&&(Xr[to]=Xr[to].bind(Xr))})}class I18n extends EventEmitter$2{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(eo),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),to&&!this.isInitialized&&!eo.isClone){if(!this.options.initImmediate)return this.init(eo,to),this;setTimeout(()=>{this.init(eo,to)},0)}}init(){var eo=this;let to=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ro=arguments.length>1?arguments[1]:void 0;typeof to=="function"&&(ro=to,to={}),!to.defaultNS&&to.defaultNS!==!1&&to.ns&&(typeof to.ns=="string"?to.defaultNS=to.ns:to.ns.indexOf("translation")<0&&(to.defaultNS=to.ns[0]));const no=get$7();this.options={...no,...this.options,...transformOptions(to)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...no.interpolation,...this.options.interpolation}),to.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=to.keySeparator),to.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=to.nsSeparator);function io(lo){return lo?typeof lo=="function"?new lo:lo:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(io(this.modules.logger),this.options):baseLogger.init(null,this.options);let lo;this.modules.formatter?lo=this.modules.formatter:typeof Intl<"u"&&(lo=Formatter);const fo=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const ho=this.services;ho.logger=baseLogger,ho.resourceStore=this.store,ho.languageUtils=fo,ho.pluralResolver=new PluralResolver(fo,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),lo&&(!this.options.interpolation.format||this.options.interpolation.format===no.interpolation.format)&&(ho.formatter=io(lo),ho.formatter.init(ho,this.options),this.options.interpolation.format=ho.formatter.format.bind(ho.formatter)),ho.interpolator=new Interpolator(this.options),ho.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},ho.backendConnector=new Connector(io(this.modules.backend),ho.resourceStore,ho,this.options),ho.backendConnector.on("*",function(go){for(var yo=arguments.length,vo=new Array(yo>1?yo-1:0),wo=1;wo1?yo-1:0),wo=1;wo{go.init&&go.init(this)})}if(this.format=this.options.interpolation.format,ro||(ro=noop$6),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const lo=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);lo.length>0&&lo[0]!=="dev"&&(this.options.lng=lo[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(lo=>{this[lo]=function(){return eo.store[lo](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(lo=>{this[lo]=function(){return eo.store[lo](...arguments),eo}});const so=defer(),co=()=>{const lo=(fo,ho)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),so.resolve(ho),ro(fo,ho)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return lo(null,this.t.bind(this));this.changeLanguage(this.options.lng,lo)};return this.options.resources||!this.options.initImmediate?co():setTimeout(co,0),so}loadResources(eo){let ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$6;const no=typeof eo=="string"?eo:this.language;if(typeof eo=="function"&&(ro=eo),!this.options.resources||this.options.partialBundledLanguages){if(no&&no.toLowerCase()==="cimode")return ro();const io=[],oo=ao=>{if(!ao)return;this.services.languageUtils.toResolveHierarchy(ao).forEach(co=>{io.indexOf(co)<0&&io.push(co)})};no?oo(no):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(so=>oo(so)),this.options.preload&&this.options.preload.forEach(ao=>oo(ao)),this.services.backendConnector.load(io,this.options.ns,ao=>{!ao&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),ro(ao)})}else ro(null)}reloadResources(eo,to,ro){const no=defer();return eo||(eo=this.languages),to||(to=this.options.ns),ro||(ro=noop$6),this.services.backendConnector.reload(eo,to,io=>{no.resolve(),ro(io)}),no}use(eo){if(!eo)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!eo.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return eo.type==="backend"&&(this.modules.backend=eo),(eo.type==="logger"||eo.log&&eo.warn&&eo.error)&&(this.modules.logger=eo),eo.type==="languageDetector"&&(this.modules.languageDetector=eo),eo.type==="i18nFormat"&&(this.modules.i18nFormat=eo),eo.type==="postProcessor"&&postProcessor.addPostProcessor(eo),eo.type==="formatter"&&(this.modules.formatter=eo),eo.type==="3rdParty"&&this.modules.external.push(eo),this}setResolvedLanguage(eo){if(!(!eo||!this.languages)&&!(["cimode","dev"].indexOf(eo)>-1))for(let to=0;to-1)&&this.store.hasLanguageSomeTranslations(ro)){this.resolvedLanguage=ro;break}}}changeLanguage(eo,to){var ro=this;this.isLanguageChangingTo=eo;const no=defer();this.emit("languageChanging",eo);const io=so=>{this.language=so,this.languages=this.services.languageUtils.toResolveHierarchy(so),this.resolvedLanguage=void 0,this.setResolvedLanguage(so)},oo=(so,co)=>{co?(io(co),this.translator.changeLanguage(co),this.isLanguageChangingTo=void 0,this.emit("languageChanged",co),this.logger.log("languageChanged",co)):this.isLanguageChangingTo=void 0,no.resolve(function(){return ro.t(...arguments)}),to&&to(so,function(){return ro.t(...arguments)})},ao=so=>{!eo&&!so&&this.services.languageDetector&&(so=[]);const co=typeof so=="string"?so:this.services.languageUtils.getBestMatchFromCodes(so);co&&(this.language||io(co),this.translator.language||this.translator.changeLanguage(co),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(co)),this.loadResources(co,lo=>{oo(lo,co)})};return!eo&&this.services.languageDetector&&!this.services.languageDetector.async?ao(this.services.languageDetector.detect()):!eo&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(ao):this.services.languageDetector.detect(ao):ao(eo),no}getFixedT(eo,to,ro){var no=this;const io=function(oo,ao){let so;if(typeof ao!="object"){for(var co=arguments.length,lo=new Array(co>2?co-2:0),fo=2;fo`${so.keyPrefix}${ho}${yo}`):go=so.keyPrefix?`${so.keyPrefix}${ho}${oo}`:oo,no.t(go,so)};return typeof eo=="string"?io.lng=eo:io.lngs=eo,io.ns=to,io.keyPrefix=ro,io}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(eo){this.options.defaultNS=eo}hasLoadedNamespace(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const ro=to.lng||this.resolvedLanguage||this.languages[0],no=this.options?this.options.fallbackLng:!1,io=this.languages[this.languages.length-1];if(ro.toLowerCase()==="cimode")return!0;const oo=(ao,so)=>{const co=this.services.backendConnector.state[`${ao}|${so}`];return co===-1||co===2};if(to.precheck){const ao=to.precheck(this,oo);if(ao!==void 0)return ao}return!!(this.hasResourceBundle(ro,eo)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||oo(ro,eo)&&(!no||oo(io,eo)))}loadNamespaces(eo,to){const ro=defer();return this.options.ns?(typeof eo=="string"&&(eo=[eo]),eo.forEach(no=>{this.options.ns.indexOf(no)<0&&this.options.ns.push(no)}),this.loadResources(no=>{ro.resolve(),to&&to(no)}),ro):(to&&to(),Promise.resolve())}loadLanguages(eo,to){const ro=defer();typeof eo=="string"&&(eo=[eo]);const no=this.options.preload||[],io=eo.filter(oo=>no.indexOf(oo)<0);return io.length?(this.options.preload=no.concat(io),this.loadResources(oo=>{ro.resolve(),to&&to(oo)}),ro):(to&&to(),Promise.resolve())}dir(eo){if(eo||(eo=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!eo)return"rtl";const to=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],ro=this.services&&this.services.languageUtils||new LanguageUtil(get$7());return to.indexOf(ro.getLanguagePartFromCode(eo))>-1||eo.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1?arguments[1]:void 0;return new I18n(eo,to)}cloneInstance(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$6;const ro=eo.forkResourceStore;ro&&delete eo.forkResourceStore;const no={...this.options,...eo,isClone:!0},io=new I18n(no);return(eo.debug!==void 0||eo.prefix!==void 0)&&(io.logger=io.logger.clone(eo)),["store","services","language"].forEach(ao=>{io[ao]=this[ao]}),io.services={...this.services},io.services.utils={hasLoadedNamespace:io.hasLoadedNamespace.bind(io)},ro&&(io.store=new ResourceStore(this.store.data,no),io.services.resourceStore=io.store),io.translator=new Translator(io.services,no),io.translator.on("*",function(ao){for(var so=arguments.length,co=new Array(so>1?so-1:0),lo=1;lo{if(typeof Xr!="object"||typeof eo!="object")return eo;const to=Object.assign({},Xr);for(const ro in eo)Object.prototype.hasOwnProperty.call(eo,ro)&&(typeof eo[ro]=="object"&&Object.prototype.hasOwnProperty.call(Xr,ro)&&typeof Xr[ro]=="object"?to[ro]=deepMerge(Xr[ro],eo[ro]):to[ro]=eo[ro]);return to};class Locale{static setResources(eo){if(Locale.__resources__)return;if(!eo){Locale.__resources__={en:{translation}};return}const to={};Object.keys(eo).forEach(ro=>{const no=Object.assign({},translation);to[ro]={translation:deepMerge(no,eo[ro])}}),Locale.__resources__=to}static setup(eo){if(Locale.__initialized__&&Locale.__i18nInstance__)return Locale.__i18nInstance__;Locale.setResources(eo);const to=instance$3.createInstance();return to.use(initReactI18next).init({fallbackLng:"en",interpolation:{escapeValue:!1},lng:"en",resources:Locale.getResources()}),Locale.__i18nInstance__=to,Locale.__initialized__=!0,Locale.__i18nInstance__}static getInstance(){if(Locale.__initialized__||this.setup(),!Locale.__i18nInstance__||!Locale.__initialized__)throw new Error("Locale is not initialized");return Locale.__i18nInstance__}}Locale.__i18nInstance__=null;Locale.__initialized__=!1;Locale.getResources=()=>Locale.__resources__;const getMinAuthToken$1=()=>{if(typeof window>"u")return;const Xr=StorageService.getItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]});if(!(!Xr||isMinAuthTokenExpired$1(Xr)))return Xr},isCookieEnabled$1=()=>{var Xr,eo,to,ro;if(PlatformService.isNativeMobile)return!1;const no=(eo=(Xr=getProjectSettings())===null||Xr===void 0?void 0:Xr.settings)===null||eo===void 0?void 0:eo.security;if(!no)return!1;const io=(((to=no.auth)===null||to===void 0?void 0:to.storage)||[]).includes(AuthStorageEnum.Cookie),oo=!!(!((ro=no.externalAuth)===null||ro===void 0)&&ro.cookieName);return io||oo},sdkApi$1=({customHeaders:Xr}={})=>{const eo={basePath:ApiEndpoint$1.getBaseUrl(),headers:Object.assign({"Content-Type":"application/json"},Xr)},to=getMinAuthToken$1();to&&(eo.headers.Authorization=`Bearer ${to}`);const ro=isCookieEnabled$1()?"include":void 0;return eo.headers["x-dyn-version"]=`WalletKit/${VERSION$4}`,eo.headers["x-dyn-api-version"]=`API/${API_VERSION$2}`,new SDKApi(new Configuration(Object.assign(Object.assign({},eo),{credentials:ro,fetchApi:FetchService.fetch})))},fetchProjectSettings=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{return yield sdkApi$1().getEnvironmentSettings({environmentId:Xr,sdkVersion:`WalletKit/${VERSION$4}`},{credentials:"omit"})}catch(eo){logger$8.error(eo);return}}),sendDynamicProps=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const{dynamicContextProps:to,dynamicWagmiSettings:ro,frameworkSettings:no}=eo;to&&(yield sendDynamicContextSettings(Xr,{dynamicContextProps:to,frameworkSettings:no},isDynamicContextSessionSettingExpired,setDynamicContextSessionSettings)),ro&&(yield sendDynamicContextSettings(Xr,{dynamicWagmiSettings:ro},isWagmiSessionSettingExpired,setWagmiSessionSettings))}catch(to){logger$8.warn("Error caught when sending sdkSettings to api. Please notify Dynamic, and send the DynamicContextProvider settings you currently have configured",{error:to})}}),sendDynamicContextSettings=(Xr,eo,to,ro)=>__awaiter$j(void 0,void 0,void 0,function*(){to()&&(yield sdkApi$1().logDynamicSdkSettings({environmentId:Xr,sdkSettingsRequest:eo}),ro())}),AccessDeniedContext=reactExports.createContext(void 0),AccessDeniedContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(""),[ro,no]=reactExports.useState(""),[io,oo]=reactExports.useState(void 0),ao=reactExports.useMemo(()=>({deniedAddress:ro,deniedOauthProvider:io,deniedOauthUsername:eo,setDeniedAddress:no,setDeniedOauthProvider:oo,setDeniedOauthUsername:to}),[ro,io,eo]);return jsxRuntimeExports.jsx(AccessDeniedContext.Provider,{value:ao,children:Xr})},useAccessDeniedContext=()=>{const Xr=reactExports.useContext(AccessDeniedContext);if(Xr===void 0)throw new Error("usage of useAccessDeniedContext not wrapped in `AccessDeniedContextProvider`.");return Xr},AccountExistsContext=reactExports.createContext(void 0),AccountExistsContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(),ro=reactExports.useMemo(()=>({existentAccountData:eo,setExistentAccountData:to}),[eo,to]);return jsxRuntimeExports.jsx(AccountExistsContext.Provider,{value:ro,children:Xr})},useAccountExistsContext=()=>{const Xr=reactExports.useContext(AccountExistsContext);if(Xr===void 0)throw new Error("usage of useAccountExistsContext not wrapped in `AccountExistsContextProvider`.");return Xr},UserWalletsContext=reactExports.createContext(void 0),UserWalletsProvider=({children:Xr})=>{const[eo,to]=reactExports.useState([]),ro=reactExports.useRef([]),no=reactExports.useRef([]),io=reactExports.useCallback(oo=>{to(ao=>{const so=oo(ao);return ro.current.forEach(co=>{const lo=so.find(({id:fo})=>fo===co);lo&&dynamicEvents.emit("walletAdded",lo,so)}),no.current.forEach(co=>{const lo=ao.find(({id:fo})=>fo===co);lo&&dynamicEvents.emit("walletRemoved",lo,so)}),ro.current=[],no.current=[],so})},[]);return jsxRuntimeExports.jsx(UserWalletsContext.Provider,{value:{addedWalletsIds:ro,registerUserWallet:oo=>io(ao=>[...ao,oo]),removeUserWallet:oo=>io(ao=>ao.filter(({id:so})=>oo!==so)),removedWalletsIds:no,setUserWallets:io,userWallets:eo},children:Xr})},useInternalUserWallets=()=>{const Xr=reactExports.useContext(UserWalletsContext);if(!Xr)throw new Error("Can only call useInternalUserWallets inside UserWalletsProvider");return Xr},useUserWallets=()=>{const Xr=reactExports.useContext(UserWalletsContext);if(!Xr)throw new Error("Can only call useUserWallets inside UserWalletsProvider");return Xr.userWallets},VerificationContext=reactExports.createContext(void 0),VerificationProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(void 0),[ro,no]=reactExports.useState(void 0),[io,oo]=reactExports.useState(void 0),ao=reactExports.useMemo(()=>({displayedDestination:eo,retryData:io,setDisplayedDestination:to,setRetryData:oo,setVerificationUUID:no,verificationUUID:ro}),[eo,io,ro]);return jsxRuntimeExports.jsx(VerificationContext.Provider,{value:ao,children:Xr})},useVerification=()=>{const Xr=reactExports.useContext(VerificationContext);if(Xr===void 0)throw new Error("usage of useVerification not wrapped in `VerificationProvider`.");return Xr},WalletContext=reactExports.createContext(void 0),WalletContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(!1),ro=reactExports.useMemo(()=>({isLoadingEmbeddedWallet:eo,setIsLoadingEmbeddedWallet:to}),[eo]);return jsxRuntimeExports.jsx(WalletContext.Provider,{value:ro,children:Xr})},useWalletContext=()=>{const Xr=reactExports.useContext(WalletContext);if(Xr===void 0)throw new Error("usage of useWalletContext not wrapped in `WalletContextProvider`.");return Xr},iframeContainerId$2="dyn-secure-enclave-container-id",iframeElementId$2="dyn-secure-enclave-element-id",revealIframeContainerId="dyn-secure-enclave-export-container-id",revealIframeElementId="dyn-secure-enclave-export-element-id";var EmbeddedWalletVersion;(function(Xr){Xr.V1="V1",Xr.V2="V2"})(EmbeddedWalletVersion||(EmbeddedWalletVersion={}));const isPromise$1=Xr=>Xr instanceof Promise,resolveFetcher=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,{retries:no},io){const oo=no?no+1:1;let ao=0,so,co;for(;ao{const to=reactExports.useRef(new Date().getTime()),{deps:ro=[],initialData:no=void 0,enabled:io=!0,retries:oo=0,onBeforeFetch:ao=()=>{},onReject:so=()=>{},onResolve:co=()=>{}}=eo||{},[lo,fo]=reactExports.useState(no),[ho,go]=reactExports.useState(io),[yo,vo]=reactExports.useState(void 0),wo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const Eo=new Date().getTime();return Eo-to.current<5&&logger$8.warn("usePromise: Fetcher function was called in very quick succession. Please make sure the fetcher function is not synchronous and that you are not calling it inside a loop.",ro),to.current=Eo,go(!0),ao(),resolveFetcher(Xr,{retries:oo},(Ao,Po)=>{if(Eo===to.current){if(Ao){logger$8.error(Ao),vo(Ao),so==null||so(Ao);return}fo(Po),co==null||co(Po)}}).finally(()=>go(!1))}),ro);return reactExports.useEffect(()=>{io&&wo()},[wo,io]),reactExports.useMemo(()=>({data:lo,error:yo,isLoading:ho,retrigger:wo}),[lo,yo,ho,wo])},isSSR=()=>typeof window>"u",getValueByKey=(Xr,eo)=>Xr[eo],themesData={border:"rounded",brandStyle:"subtle",customColor:"",template:"default",themes:{auto:{colors:{accent_1:"#2C303A",accent_2:"#3C414D",accent_3:"#4C525F",background:"#15181F",border:"1px solid #2C303A",error_1:"rgba(255, 106, 106, 0.2)",error_2:"#FF6A6A",footer:"#2C303A",primary:"#15181F",secondary:"#2C303A",ternary:"#2660FF",textPrimary:"#FFF",textSecondary:"#ACACB9"},name:"auto"},dark:{colors:{accent_1:"#2C303A",accent_2:"#3C414D",accent_3:"#4C525F",background:"#15181F",border:"1px solid #2C303A",error_1:"rgba(255, 106, 106, 0.2)",error_2:"#FF6A6A",footer:"#2C303A",primary:"#15181F",secondary:"#2C303A",ternary:"#2660FF",textPrimary:"#FFF",textSecondary:"#ACACB9"},name:"dark"},light:{colors:{accent_1:"#FFF",accent_2:"#F0F3FF",accent_3:"#E9EDFC",background:"#FFFFFF",border:"1px solid #E9EDFC",error_1:"rgba(255, 70, 70, 0.1)",error_2:"#FF4646",footer:"#F7F9FE",primary:"#F7F7F9",secondary:"#FFFFFF",ternary:"#2660FF",textPrimary:"#404040",textSecondary:"#80858B"},name:"light"}},view:"extended",walletColor:{color:"#1648F9",gradient:"90deg, #1648F9 0%, #4B73FF 100%"}},getThemeConfig=(Xr,eo)=>{const{border:to,brand:ro,view:no,primaryColor:io}=Xr||{},oo=eo||(Xr==null?void 0:Xr.theme)||"light",ao=(Xr==null?void 0:Xr.template)||"default";return Object.assign(Object.assign({},themesData),{border:to||themesData.border,brandStyle:ro||themesData.brandStyle,customColor:io||themesData.customColor,template:ao,theme:getValueByKey(themesData.themes,oo),view:no||themesData.view})},findOrCreateLinkTag=()=>{if(isSSR())return;const Xr=document.querySelector('[data-source="dynamic-theme-cdn"]');if(Xr)return Xr;const eo=document.createElement("link");return document.head.append(eo),eo.dataset.source="dynamic-theme-cdn",eo.rel="stylesheet",eo},findOrCreateStyleTag=()=>{if(isSSR())return;const Xr=document.querySelector('[data-source="dynamic-theme"]');if(Xr)return Xr;const eo=document.createElement("style");return document.head.append(eo),eo.dataset.source="dynamic-theme",eo},buildStylesheet=Xr=>{const{customColor:eo,brandStyle:to}=Xr;return`@layer dynamic-project-environment-theme { +`,Eo=`${[bo,ao].join(wo)} +`,$o=[];$o.push(`URI: ${no}`),$o.push("Version: 1"),to&&$o.push(`Chain ID: ${to}`),$o.push(`Nonce: ${ro}`),$o.push(`Issued At: ${oo}`),so&&$o.push(`Request ID: ${so}`),co!=null&&co.length&&$o.push(`Resources:${co.map(Ro=>` +- `+Ro).join()}`);const Co=$o.join(` +`);return[Eo,Co].join(` +`)},getEnabledProviders=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.filter(to=>!!to.enabledAt||to.provider===ProviderEnum.MagicLink&&!!to.providerProjectId||to.provider===ProviderEnum.Turnkey))!==null&&eo!==void 0?eo:[]},getApiProviders=Xr=>Object.values(ProviderEnum).reduce((eo,to)=>{const ro=Xr.find(no=>no.provider===to);return ro&&(eo[to]=ro),eo},{}),handleMobileWalletFilter=(Xr,eo,to)=>{if(!to.mobile)return!1;const ro=!!to.mobile.universal||!!to.mobile.native,no=to.walletConnect!==void 0;if(isIPad()||isIPhone()){const io=!!getWalletLinks(Xr,eo).ios;return no?io&&ro:io}else{const io=!!getWalletLinks(Xr,eo).android;return no?io&&ro:io}},filterWalletsForPlatform=(Xr,eo)=>eo.filter(to=>{const ro=getWalletBookWallet(Xr,to.key,to.walletFallback);return to.isInstalledOnBrowser()||isEmbeddedConnector(to)?!0:ro.showOnlyIfInstalled?!1:isMobile$1()?handleMobileWalletFilter(Xr,to.key,ro):!0}),applyLinksOverrides=(Xr,eo)=>eo.map(to=>{const ro=getWalletBookWallet(Xr,to.key,to.walletFallback);return ro.switchNetworkOnlyFromWallet!==void 0&&(to.switchNetworkOnlyFromWallet=ro.switchNetworkOnlyFromWallet),to}),defaultWalletUiUtils={createPassword:()=>{throw Error("createPassword not implemented")},disabledConfirmationOnce:()=>{throw Error("disabledConfirmationOnce, not implemented")},enterPassword:()=>{throw Error("enterPassword not implemented")},sendTransaction:()=>{throw Error("requestSendTransactionConfirmation not implemented")},signMessage:()=>{throw Error("signMessage not implemented")},syncWallet:()=>{throw Error("syncWallet not implemented")}},getSupportedWallets=Xr=>{var eo;const{appLogoUrl:to="",appName:ro="",coinbaseWalletPreference:no,chainRpcProviders:io,deepLinkPreference:oo,flowNetwork:ao,mobileExperience:so="in-app-browser",networkConfigurations:co={cosmos:[],evm:[],solana:[],starknet:[]},settings:lo,skipMemo:uo=!1,walletConnectProjectId:ho="",walletConnectorsProp:go,walletUiUtils:bo=void 0,walletBook:wo,walletConnectPreferredChains:Eo}=Xr;let $o=[];if(!uo&&$o.length>0)return $o;const Co=(co==null?void 0:co.evm)||[],Ro=(co==null?void 0:co.solana)||[],Oo=(co==null?void 0:co.cosmos)||[],jo=(co==null?void 0:co.starknet)||[],Bo=getApiProviders(getEnabledProviders(lo.providers)),Mo=(eo=lo.sdk.disabledWalletConnectors)!==null&&eo!==void 0?eo:[],Fo={apiProviders:Bo,appLogoUrl:to,appName:ro,chainRpcProviders:io,coinbaseWalletPreference:no,cosmosNetworks:Oo,deepLinkPreference:oo,evmNetworks:Co,flowNetwork:ao,mobileExperience:so,projectId:ho,settings:lo,solNetworks:Ro,starknetNetworks:jo,walletBook:wo,walletConnectPreferredChains:Eo,walletConnectorEventsEmitter:walletConnectorEvents,walletUiUtils:bo||defaultWalletUiUtils},Wo=go.map(fo=>fo(Fo)).flat().map(fo=>{try{return new fo(Fo)}catch(yo){logger$9.error(`Failed to construct wallet ${fo.name}`,yo);return}}).filter(fo=>{var yo;return fo&&(!(!((yo=fo.metadata)===null||yo===void 0)&&yo.id)||!Mo.includes(fo.metadata.id))}).map(fo=>((!(fo!=null&&fo.isWalletConnect)||fo.key==="walletconnect")&&(fo==null||fo.init()),fo)).filter(fo=>fo==null?void 0:fo.filter()).map(fo=>fo.getMobileOrInstalledWallet()),Jo=Wo.filter(fo=>fo.isWalletConnect?!Wo.some(yo=>yo.key===fo.key&&!yo.isWalletConnect&&yo.isInstalledOnBrowser()):!0),Po=filterWalletsForPlatform(wo,Jo);return $o=applyLinksOverrides(wo,Po),$o},chainStringToChains={"eip155:1":["ETH","EVM"],"flow:mainnet":["FLOW"]},getSupportedChainsForWalletConnector=(Xr,eo)=>{var to;const ro=getWalletBookWallet(Xr,eo.key,eo.walletFallback),no=new Set;return((to=ro.chains)!==null&&to!==void 0?to:[]).forEach(oo=>{const ao=chainStringToChains[oo];ao==null||ao.forEach(so=>{no.add(so)})}),eo.supportedChains.forEach(oo=>{no.add(oo)}),[...no]},getEnabledWallets=Xr=>getSupportedWallets(Xr.getSupportedWalletOpts).filter(ro=>Xr.enabledChains.some(no=>getSupportedChainsForWalletConnector(Xr.getSupportedWalletOpts.walletBook,ro).includes(no))||ro.key==="magiclink");assertPackageVersion("@dynamic-labs/multi-wallet",version$s);var version$m="3.5.1",ProviderChain;(function(Xr){Xr.EVM="evm",Xr.SOLANA="solana",Xr.STARKNET="starknet"})(ProviderChain||(ProviderChain={}));function __awaiter$k(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class ChainRpcProvidersClass{static get client(){return ChainRpcProvidersClass.instance||(ChainRpcProvidersClass.instance=new ChainRpcProvidersClass),ChainRpcProvidersClass.instance}constructor(){this.getProvidersMethods={}}static getProviders(eo){return Object.values(ProviderChain).forEach(to=>{var ro,no;if(!ChainRpcProvidersClass.providers[to]){const io=(no=(ro=ChainRpcProvidersClass.client.getProvidersMethods)[to])===null||no===void 0?void 0:no.call(ro,eo);io&&Object.assign(ChainRpcProvidersClass.providers,{[to]:io})}}),ChainRpcProvidersClass.providers}static registerChainProviders(eo,to){return __awaiter$k(this,void 0,void 0,function*(){ChainRpcProvidersClass.client.getProvidersMethods[eo]||Object.assign(ChainRpcProvidersClass.client.getProvidersMethods,{[eo]:to})})}}ChainRpcProvidersClass.providers={};ChainRpcProvidersClass.wipeInstance=()=>{ChainRpcProvidersClass.instance=void 0,ChainRpcProvidersClass.providers={}};const ChainRpcProviders=ChainRpcProvidersClass;assertPackageVersion("@dynamic-labs/rpc-providers",version$m);const logger$8=new Logger$2("DynamicSDK"),dynamicEvents=new EventEmitter$3,useInternalDynamicEvents=(Xr,eo)=>{const to=reactExports.useRef(eo);to.current=eo,reactExports.useEffect(()=>{const ro=(...no)=>to.current(...no);return dynamicEvents.on(Xr,ro),()=>{dynamicEvents.off(Xr,ro)}},[Xr])},externalEvents=["emailVerificationResult","embeddedWalletCreated","logout","walletAdded","mfaCompletionSuccess","mfaCompletionFailure"],useDynamicEvents=(Xr,eo)=>{if(!externalEvents.includes(Xr))throw new Error(`Unrecognized event "${Xr}" used with useDynamicEvents`);useInternalDynamicEvents(Xr,eo)},errorMessageMap={"-32000":"Message signature denied","-32002":"Please unlock your wallet extension and try again.","-32003":"Message signature denied.","-32602":"Invalid parameters. Please try again.","-32603":"There was an internal error. Please try again.",0:"Message signature denied.",4001:"Message signature denied.",4100:"Please unlock your wallet extension and try again.",4900:"There was an internal error. Please try again.",5001:"Message signature denied.",5002:"Message signature denied.",account_already_linked_to_different_profile:"This social account is already linked to a different profile.",connection_rejected:"Connection rejected. Please try again.",metamask_timeout:"Whoops. Looks like something went wrong. Please try again.","missing-nonce":"Something went wrong. Please try again.","missing-public-address":"Connection cancelled. Please try again",oauth_window_blocked:"To connect to your social account, enable popups in your browser and then try again.",oauth_window_timeout:"Session time out. Please try again.",too_many_email_verification_attempts:"Too many email verification attempts, please try again later","user-cancelled":"",wallet_not_deployed:"Your smart wallet has not been deployed.",wrong_email_verification_token:"The code you entered is incorrect. Please try again."},ErrorContext=reactExports.createContext(void 0),ErrorContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(void 0),ro=reactExports.useCallback(io=>{var oo;to((oo=errorMessageMap[io])!==null&&oo!==void 0?oo:"Something went wrong. Please try again.")},[]),no=reactExports.useCallback(()=>{to(void 0)},[]);return jsxRuntimeExports.jsx(ErrorContext.Provider,{value:{clearError:no,error:eo,setError:to,setErrorMessage:ro},children:Xr})},useErrorContext=()=>{const Xr=reactExports.useContext(ErrorContext);if(Xr===void 0)throw new Error("usage of useErrorContext not wrapped in `ErrorContextProvider`.");return Xr},ViewContext=reactExports.createContext(void 0),ViewContextProvider=({children:Xr,initialView:eo={props:{isWalletConnectList:!0},type:"wallet-list"}})=>{const[to,ro]=reactExports.useState(null),no=to||eo,{clearError:io}=useErrorContext(),oo=reactExports.useCallback(()=>{ro(null)},[]),ao=reactExports.useCallback((co,lo,uo)=>{no.type!==co&&io(),ro({events:uo,props:lo,type:co})},[]);useInternalDynamicEvents("logout",()=>oo());const so=reactExports.useMemo(()=>({goToInitialView:oo,setView:ao,view:no}),[oo,ao,no]);return jsxRuntimeExports.jsx(ViewContext.Provider,{value:so,children:Xr})},useViewContext=()=>{const Xr=reactExports.useContext(ViewContext);if(Xr===void 0)throw new Error("usage of useViewContext not wrapped in `ViewContextProvider`.");return Xr},createWallet=(Xr,eo)=>{var to;const ro=findWalletBookWallet(Xr,eo.key);return{chainGroup:ro==null?void 0:ro.chainGroup,group:(ro==null?void 0:ro.chainGroup)||(ro==null?void 0:ro.walletGroup),injectedConfig:ro==null?void 0:ro.injectedConfig,isInstalledOnBrowser:(to=eo.isInstalledOnBrowser())!==null&&to!==void 0?to:!1,key:eo.key,name:eo.name,walletConnector:eo,walletGroup:ro==null?void 0:ro.walletGroup}},convertHexToRGBA=(Xr,eo=1)=>{const to=parseInt(Xr.slice(1,3),16),ro=parseInt(Xr.slice(3,5),16),no=parseInt(Xr.slice(5,7),16);return"rgba("+to+", "+ro+", "+no+", "+eo+")"},TEXT_LIGHT_PRIMARY="#363A46";convertHexToRGBA(TEXT_LIGHT_PRIMARY,.65);convertHexToRGBA(TEXT_LIGHT_PRIMARY,.4);const TEXT_DARK_BASE="#F5F8FF";convertHexToRGBA(TEXT_DARK_BASE,.95);convertHexToRGBA(TEXT_DARK_BASE,.55);convertHexToRGBA(TEXT_DARK_BASE,.4);const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW=10,ChainEnumToVerifiedCredentialName={ALGO:"algorand",BTC:"bip122",COSMOS:"cosmos",ETH:"eip155",EVM:"eip155",FLOW:"flow",SOL:"solana",STARK:"starknet"},VerifiedCredentialNameToChainEnum={algorand:ChainEnum.Algo,bip122:ChainEnum.Btc,cosmos:ChainEnum.Cosmos,eip155:ChainEnum.Evm,flow:ChainEnum.Flow,solana:ChainEnum.Sol,starknet:ChainEnum.Stark},DYNAMIC_AUTH_COOKIE_NAME="DYNAMIC_JWT_TOKEN",useStoreWithSelector=(Xr,eo)=>{const to=reactExports.useRef(void 0),ro=()=>eo(Xr.getState()),no=()=>(to.current===void 0&&(to.current={value:eo(Xr.getInitialState())}),to.current.value);return reactExports.useSyncExternalStore(Xr.subscribe,ro,no)};var version$l="3.5.1";const createStore$1=Xr=>{const eo=new Set;let to=Xr();const ro=()=>{for(const no of eo)no(to)};return{getInitialState:()=>Xr(),getState:()=>to,setState:no=>{to=Object.assign(Object.assign({},to),no),ro()},subscribe:no=>(eo.add(no),()=>{eo.delete(no)})}},logger$7=new Logger$2("@dynamic-labs/logger"),persist=({name:Xr,version:eo=0,storage:to,store:ro,partialize:no})=>{ro.subscribe(oo=>{const ao=no(oo);to.setItem(Xr,JSON.stringify({state:ao,version:eo}))});const io=to.getItem(Xr);if(io)try{const{state:oo,version:ao}=JSON.parse(io);ao===eo&&ro.setState(Object.assign(ro.getInitialState(),oo))}catch(oo){logger$7.error("Failed to load state from storage",oo)}return ro};assertPackageVersion("@dynamic-labs/store",version$l);const AUTH_TOKEN="dynamic_authentication_token",AUTH_MIN_TOKEN$1="dynamic_min_authentication_token",AUTH_EXPIRES_AT="dynamic_auth_expires_at",LAST_USED_WALLET="dynamic_last_used_wallet",NONCE_STORAGE_KEY="dynamic_nonce",PRIMARY_WALLET_ID="dynamic_primary_wallet_id",WALLET_PICKER_SEARCH_KEY="dynamic_wallet_picker_search",NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY="dynamic_newtoweb3_wallet_extension_installed",CONNECTED_WALLETS_INFO="dynamic_connected_wallets",AUTH_MODE="dynamic_auth_mode",CONNECTED_WALLET_NAME_SERVICE="dynamic_connected_wallet_ns",BRIDGE_ONBOARDING_COMPLETED="dynamic_bridge_onboarding_completed",DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS="dynamic_context_session_settings",WAGMI_LAST_SESSION_SETTINGS="dynamic_wagmi_session_settings",EMBEDDED_WALLET_SESSION_SETTINGS="dynamic_embedded_wallet_session_settings",EMBEDDED_WALLET_SECURE_BANNER="dynamic_embedded_secure_banner",PHONE_INPUT_DEFAULT_COUNTRY="dynamic_phone_input_default_country",CAPTCHA_TOKEN="dynamic_captcha_token",PHANTOM_SIGNATURE_STATE="phantom_verification_type",STORE_STORAGE_KEY="dynamic_store",createInitialStates=({environmentId:Xr})=>({environmentId:Xr,loadingAndLifecycle:{sessionValidation:!1},projectSettings:{expiresAt:void 0,settings:void 0},sendBalanceState:{amount:void 0,chainName:void 0,nativePrice:void 0},tokenBalancesState:{error:void 0,isError:!1,isLoading:!1,tokenBalances:void 0},user:void 0,walletConnectorOptions:[]}),transformStateForLocalStorage=Xr=>({environmentId:Xr.environmentId,projectSettings:Xr.projectSettings,user:Xr.user}),clearExpiredData=Xr=>{const{projectSettings:eo,user:to}=Xr.getState(),[ro]=StorageService.getItem(CONNECTED_WALLETS_INFO)||[],no=!to&&!ro;return(oo=>no||oo.expiresAt&&oo.expiresAt{const eo=StorageService.getItem(AUTH_USER);return eo&&!Xr.getState().user&&(Xr.setState({user:eo}),StorageService.removeItem(AUTH_USER)),Xr};let store;const getStore=()=>{if(!store)throw new Error("Store not initialized");return store},removeStoreInstance=()=>{store=void 0},initializeStore=({storageSuffix:Xr,environmentId:eo})=>{if(store)return;const to=Xr?`${STORE_STORAGE_KEY}_${Xr}`:STORE_STORAGE_KEY;store=syncLegacyStorage(persist({name:to,partialize:transformStateForLocalStorage,storage:getStorage(),store:createStore$1(()=>createInitialStates({environmentId:eo,storageSuffix:Xr}))})),clearExpiredData(store)},getStorage=()=>typeof localStorage>"u"?{getItem:()=>null,setItem:()=>{}}:window.localStorage,createStoreState=Xr=>{const eo=Xr[0].toUpperCase()+Xr.slice(1),to=()=>useStoreWithSelector(getStore(),oo=>oo[Xr]),ro=oo=>getStore().setState(Object.assign(Object.assign({},getStore().getState()),{[Xr]:oo})),no=()=>getStore().getState()[Xr],io=()=>ro(getStore().getInitialState()[Xr]);return{[`use${eo}`]:to,[`get${eo}`]:no,[`set${eo}`]:ro,[`reset${eo}`]:io}},{getLoadingAndLifecycle,setLoadingAndLifecycle,useLoadingAndLifecycle}=createStoreState("loadingAndLifecycle"),require$$0$b=[{code:"AD",name:"Andorra"},{code:"AE",name:"United Arab Emirates"},{code:"AF",name:"Afghanistan"},{code:"AG",name:"Antigua and Barbuda"},{code:"AI",name:"Anguilla"},{code:"AL",name:"Albania"},{code:"AM",name:"Armenia"},{code:"AO",name:"Angola"},{code:"AQ",name:"Antarctica"},{code:"AR",name:"Argentina"},{code:"AS",name:"American Samoa"},{code:"AT",name:"Austria"},{code:"AU",name:"Australia"},{code:"AW",name:"Aruba"},{code:"AX",name:"Åland Islands"},{code:"AZ",name:"Azerbaijan"},{code:"BA",name:"Bosnia and Herzegovina"},{code:"BB",name:"Barbados"},{code:"BD",name:"Bangladesh"},{code:"BE",name:"Belgium"},{code:"BF",name:"Burkina Faso"},{code:"BG",name:"Bulgaria"},{code:"BH",name:"Bahrain"},{code:"BI",name:"Burundi"},{code:"BJ",name:"Benin"},{code:"BL",name:"Saint Barthélemy"},{code:"BM",name:"Bermuda"},{code:"BN",name:"Brunei Darussalam"},{code:"BO",name:"Bolivia, Plurinational State of"},{code:"BQ",name:"Bonaire, Sint Eustatius and Saba"},{code:"BR",name:"Brazil"},{code:"BS",name:"Bahamas"},{code:"BT",name:"Bhutan"},{code:"BV",name:"Bouvet Island"},{code:"BW",name:"Botswana"},{code:"BY",name:"Belarus"},{code:"BZ",name:"Belize"},{code:"CA",name:"Canada"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CD",name:"Congo, Democratic Republic of the"},{code:"CF",name:"Central African Republic"},{code:"CG",name:"Congo"},{code:"CH",name:"Switzerland"},{code:"CI",name:"Côte d'Ivoire"},{code:"CK",name:"Cook Islands"},{code:"CL",name:"Chile"},{code:"CM",name:"Cameroon"},{code:"CN",name:"China"},{code:"CO",name:"Colombia"},{code:"CR",name:"Costa Rica"},{code:"CU",name:"Cuba"},{code:"CV",name:"Cabo Verde"},{code:"CW",name:"Curaçao"},{code:"CX",name:"Christmas Island"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DE",name:"Germany"},{code:"DJ",name:"Djibouti"},{code:"DK",name:"Denmark"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"DZ",name:"Algeria"},{code:"EC",name:"Ecuador"},{code:"EE",name:"Estonia"},{code:"EG",name:"Egypt"},{code:"EH",name:"Western Sahara"},{code:"ER",name:"Eritrea"},{code:"ES",name:"Spain"},{code:"ET",name:"Ethiopia"},{code:"FI",name:"Finland"},{code:"FJ",name:"Fiji"},{code:"FK",name:"Falkland Islands (Malvinas)"},{code:"FM",name:"Micronesia, Federated States of"},{code:"FO",name:"Faroe Islands"},{code:"FR",name:"France"},{code:"GA",name:"Gabon"},{code:"GB",name:"United Kingdom of Great Britain and Northern Ireland"},{code:"GD",name:"Grenada"},{code:"GE",name:"Georgia"},{code:"GF",name:"French Guiana"},{code:"GG",name:"Guernsey"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GL",name:"Greenland"},{code:"GM",name:"Gambia"},{code:"GN",name:"Guinea"},{code:"GP",name:"Guadeloupe"},{code:"GQ",name:"Equatorial Guinea"},{code:"GR",name:"Greece"},{code:"GS",name:"South Georgia and the South Sandwich Islands"},{code:"GT",name:"Guatemala"},{code:"GU",name:"Guam"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HK",name:"Hong Kong"},{code:"HM",name:"Heard Island and McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HR",name:"Croatia"},{code:"HT",name:"Haiti"},{code:"HU",name:"Hungary"},{code:"ID",name:"Indonesia"},{code:"IE",name:"Ireland"},{code:"IL",name:"Israel"},{code:"IM",name:"Isle of Man"},{code:"IN",name:"India"},{code:"IO",name:"British Indian Ocean Territory"},{code:"IQ",name:"Iraq"},{code:"IR",name:"Iran, Islamic Republic of"},{code:"IS",name:"Iceland"},{code:"IT",name:"Italy"},{code:"JE",name:"Jersey"},{code:"JM",name:"Jamaica"},{code:"JO",name:"Jordan"},{code:"JP",name:"Japan"},{code:"KE",name:"Kenya"},{code:"KG",name:"Kyrgyzstan"},{code:"KH",name:"Cambodia"},{code:"KI",name:"Kiribati"},{code:"KM",name:"Comoros"},{code:"KN",name:"Saint Kitts and Nevis"},{code:"KP",name:"Korea, Democratic People's Republic of"},{code:"KR",name:"Korea, Republic of"},{code:"KW",name:"Kuwait"},{code:"KY",name:"Cayman Islands"},{code:"KZ",name:"Kazakhstan"},{code:"LA",name:"Lao People's Democratic Republic"},{code:"LB",name:"Lebanon"},{code:"LC",name:"Saint Lucia"},{code:"LI",name:"Liechtenstein"},{code:"LK",name:"Sri Lanka"},{code:"LR",name:"Liberia"},{code:"LS",name:"Lesotho"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"LV",name:"Latvia"},{code:"LY",name:"Libya"},{code:"MA",name:"Morocco"},{code:"MC",name:"Monaco"},{code:"MD",name:"Moldova, Republic of"},{code:"ME",name:"Montenegro"},{code:"MF",name:"Saint Martin, (French part)"},{code:"MG",name:"Madagascar"},{code:"MH",name:"Marshall Islands"},{code:"MK",name:"North Macedonia"},{code:"ML",name:"Mali"},{code:"MM",name:"Myanmar"},{code:"MN",name:"Mongolia"},{code:"MO",name:"Macao"},{code:"MP",name:"Northern Mariana Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MS",name:"Montserrat"},{code:"MT",name:"Malta"},{code:"MU",name:"Mauritius"},{code:"MV",name:"Maldives"},{code:"MW",name:"Malawi"},{code:"MX",name:"Mexico"},{code:"MY",name:"Malaysia"},{code:"MZ",name:"Mozambique"},{code:"NA",name:"Namibia"},{code:"NC",name:"New Caledonia"},{code:"NE",name:"Niger"},{code:"NF",name:"Norfolk Island"},{code:"NG",name:"Nigeria"},{code:"NI",name:"Nicaragua"},{code:"NL",name:"Netherlands"},{code:"NO",name:"Norway"},{code:"NP",name:"Nepal"},{code:"NR",name:"Nauru"},{code:"NU",name:"Niue"},{code:"NZ",name:"New Zealand"},{code:"OM",name:"Oman"},{code:"PA",name:"Panama"},{code:"PE",name:"Peru"},{code:"PF",name:"French Polynesia"},{code:"PG",name:"Papua New Guinea"},{code:"PH",name:"Philippines"},{code:"PK",name:"Pakistan"},{code:"PL",name:"Poland"},{code:"PM",name:"Saint Pierre and Miquelon"},{code:"PN",name:"Pitcairn"},{code:"PR",name:"Puerto Rico"},{code:"PS",name:"Palestine, State of"},{code:"PT",name:"Portugal"},{code:"PW",name:"Palau"},{code:"PY",name:"Paraguay"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RS",name:"Serbia"},{code:"RU",name:"Russian Federation"},{code:"RW",name:"Rwanda"},{code:"SA",name:"Saudi Arabia"},{code:"SB",name:"Solomon Islands"},{code:"SC",name:"Seychelles"},{code:"SD",name:"Sudan"},{code:"SE",name:"Sweden"},{code:"SG",name:"Singapore"},{code:"SH",name:"Saint Helena, Ascension and Tristan da Cunha"},{code:"SI",name:"Slovenia"},{code:"SJ",name:"Svalbard and Jan Mayen"},{code:"SK",name:"Slovakia"},{code:"SL",name:"Sierra Leone"},{code:"SM",name:"San Marino"},{code:"SN",name:"Senegal"},{code:"SO",name:"Somalia"},{code:"SR",name:"Suriname"},{code:"SS",name:"South Sudan"},{code:"ST",name:"Sao Tome and Principe"},{code:"SV",name:"El Salvador"},{code:"SX",name:"Sint Maarten, (Dutch part)"},{code:"SY",name:"Syrian Arab Republic"},{code:"SZ",name:"Eswatini"},{code:"TC",name:"Turks and Caicos Islands"},{code:"TD",name:"Chad"},{code:"TF",name:"French Southern Territories"},{code:"TG",name:"Togo"},{code:"TH",name:"Thailand"},{code:"TJ",name:"Tajikistan"},{code:"TK",name:"Tokelau"},{code:"TL",name:"Timor-Leste"},{code:"TM",name:"Turkmenistan"},{code:"TN",name:"Tunisia"},{code:"TO",name:"Tonga"},{code:"TR",name:"Türkiye"},{code:"TT",name:"Trinidad and Tobago"},{code:"TV",name:"Tuvalu"},{code:"TW",name:"Taiwan, Province of China"},{code:"TZ",name:"Tanzania, United Republic of"},{code:"UA",name:"Ukraine"},{code:"UG",name:"Uganda"},{code:"UM",name:"United States Minor Outlying Islands"},{code:"US",name:"United States of America"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VA",name:"Holy See"},{code:"VC",name:"Saint Vincent and the Grenadines"},{code:"VE",name:"Venezuela, Bolivarian Republic of"},{code:"VG",name:"Virgin Islands, British"},{code:"VI",name:"Virgin Islands, U.S."},{code:"VN",name:"Viet Nam"},{code:"VU",name:"Vanuatu"},{code:"WF",name:"Wallis and Futuna"},{code:"WS",name:"Samoa"},{code:"YE",name:"Yemen"},{code:"YT",name:"Mayotte"},{code:"ZA",name:"South Africa"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}];var data=require$$0$b,nameMap={},codeMap={};data.forEach(mapCodeAndName);function mapCodeAndName(Xr){nameMap[Xr.name.toLowerCase()]=Xr.code,codeMap[Xr.code.toLowerCase()]=Xr.name}var getData=function(){return data};const tShirtSizes=["XS","S","M","L","XL","2XL"],countryCodes=getData(),teamNames=["Brunei DS","Cambodia","Indonesia","Laos","Malaysia","Myanmar","Philippines","Singapore","Thailand","Vietnam"],defaultWalletsForChains={primary_chain:"evm",wallets:{algorand:"perawallet",bitcoin:"xverse",cosmos:"keplr",evm:"metamask",flow:"blocto",solana:"phantom"}},tooltipZIndex=2147483647,toolkitZIndex=2147483646,authModalZIndex=2147483645,chainInfoOverrides={starknet:"STARK"},getEnabledChains=Xr=>Xr.filter(({enabled:eo})=>eo).map(({name:eo})=>{var to,ro;return(to=chainInfoOverrides[eo])!==null&&to!==void 0?to:(ro=getChainInfo(eo))===null||ro===void 0?void 0:ro.symbol}).filter(eo=>!!eo),getWallets$1=Xr=>{var eo;return getEnabledWallets({enabledChains:getEnabledChains(Xr.getSupportedWalletOpts.settings.chains),getSupportedWalletOpts:Object.assign(Object.assign({},Xr.getSupportedWalletOpts),{chainRpcProviders:ChainRpcProviders,walletConnectProjectId:(eo=Xr.getSupportedWalletOpts.settings.sdk.walletConnect)===null||eo===void 0?void 0:eo.projectId})}).map(to=>{var ro;return(ro=Xr.walletConnectorExtensions)===null||ro===void 0||ro.forEach(no=>to.extend(no)),createWallet(Xr.getSupportedWalletOpts.walletBook,to)})},getExpiresAt=()=>StorageService.getItem(AUTH_EXPIRES_AT),parseToken$1=Xr=>{var eo;if(!Xr)return;const to=(eo=Xr.split(".")[1])===null||eo===void 0?void 0:eo.replace(/-/g,"+").replace(/_/g,"/"),ro=to&&decodeURIComponent(atob(to).split("").map(no=>`%${`00${no.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(ro)},decodeMinJwt$1=Xr=>{try{const eo=parseToken$1(Xr);return eo?MinifiedDynamicJwtFromJSON(eo):void 0}catch(eo){logger$8.error(eo);return}},decodeJwt=Xr=>{try{const eo=parseToken$1(Xr);return eo?DynamicJwtFromJSON(eo):void 0}catch(eo){logger$8.error(eo);return}};let logoutTimer,dynamicContextSettingsTimer,wagmiSettingsTimer;const sdkSettingsTimeout=24*60*60*1e3,isMinAuthTokenExpired$1=Xr=>{const eo=decodeMinJwt$1(Xr);return isTokenExpired$1(eo)},isAuthTokenExpired=Xr=>{const eo=decodeJwt(Xr);return isTokenExpired$1(eo)},isTokenExpired$1=Xr=>{if(!Xr||!Xr.exp)return!0;const eo=new Date(Xr.exp*1e3).getTime();return new Date().getTime()>=eo},initExpirationTime=Xr=>{const eo=getExpiresAt();if(!eo)return clearTimeout(logoutTimer);const to=new Date(eo*1e3).getTime(),ro=new Date().getTime();if(ro>=to)return clearTimeout(logoutTimer),Xr();const no=to-ro,io=Math.min(no,2147483647);logoutTimer=setTimeout(Xr,io)},getInitialView=({connectedWallets:Xr,isBridgeFlow:eo,bridgeOnboardingCompleted:to,isAuthenticated:ro,isMultiWalletEnabled:no})=>ro||to?{type:no?"multi-wallet-wallet-list":"wallet-list"}:eo&&!Xr.length?{type:"bridge-welcome"}:{type:"login-with-email-or-wallet"},setDynamicContextSessionSettings=()=>{setSessionSettings(DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS),dynamicContextSettingsTimer=setTimeout(isDynamicContextSessionSettingExpired,sdkSettingsTimeout)},setWagmiSessionSettings=()=>{setSessionSettings(WAGMI_LAST_SESSION_SETTINGS),wagmiSettingsTimer=setTimeout(isWagmiSessionSettingExpired,sdkSettingsTimeout)},setSessionSettings=Xr=>{const eo=new Date().getTime();StorageService.setItem(Xr,eo.toString())},isDynamicContextSessionSettingExpired=()=>isSettingExpired(DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS,dynamicContextSettingsTimer),isWagmiSessionSettingExpired=()=>isSettingExpired(WAGMI_LAST_SESSION_SETTINGS,wagmiSettingsTimer),isSettingExpired=(Xr,eo)=>{const to=StorageService.getItem(Xr);if(!to)return!0;const ro=parseInt(to);return new Date().getTime()-ro>sdkSettingsTimeout?(clearTimeout(eo),StorageService.removeItem(Xr),!0):!1},resolveNetworkValidationMode=({networkValidationMode:Xr,bridgeChains:eo})=>Xr||(eo?"always":"sign-in"),getDeepLinkPreference=(Xr,eo)=>eo?"universal":Xr,getAuthToken=()=>{if(typeof window>"u")return;const Xr=StorageService.getItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]});if(Xr&&!isAuthTokenExpired(Xr))return Xr};function __rest$7(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no()=>{if(Xr.isInitialized)eo();else{const to=()=>{setTimeout(()=>{Xr.off("initialized",to)},0),eo()};Xr.on("initialized",to)}};function loadNamespaces(Xr,eo,to){Xr.loadNamespaces(eo,loadedClb(Xr,to))}function loadLanguages(Xr,eo,to,ro){typeof to=="string"&&(to=[to]),to.forEach(no=>{Xr.options.ns.indexOf(no)<0&&Xr.options.ns.push(no)}),Xr.loadLanguages(eo,loadedClb(Xr,ro))}function oldI18nextHasLoadedNamespace(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ro=eo.languages[0],no=eo.options?eo.options.fallbackLng:!1,io=eo.languages[eo.languages.length-1];if(ro.toLowerCase()==="cimode")return!0;const oo=(ao,so)=>{const co=eo.services.backendConnector.state[`${ao}|${so}`];return co===-1||co===2};return to.bindI18n&&to.bindI18n.indexOf("languageChanging")>-1&&eo.services.backendConnector.backend&&eo.isLanguageChangingTo&&!oo(eo.isLanguageChangingTo,Xr)?!1:!!(eo.hasResourceBundle(ro,Xr)||!eo.services.backendConnector.backend||eo.options.resources&&!eo.options.partialBundledLanguages||oo(ro,Xr)&&(!no||oo(io,Xr)))}function hasLoadedNamespace(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!eo.languages||!eo.languages.length?(warnOnce("i18n.languages were undefined or empty",eo.languages),!0):eo.options.ignoreJSONStructure!==void 0?eo.hasLoadedNamespace(Xr,{lng:to.lng,precheck:(no,io)=>{if(to.bindI18n&&to.bindI18n.indexOf("languageChanging")>-1&&no.services.backendConnector.backend&&no.isLanguageChangingTo&&!io(no.isLanguageChangingTo,Xr))return!1}}):oldI18nextHasLoadedNamespace(Xr,eo,to)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=Xr=>htmlEntities[Xr],unescape$2=Xr=>Xr.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions$1={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:unescape$2};function setDefaults(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions$1={...defaultOptions$1,...Xr}}function getDefaults(){return defaultOptions$1}let i18nInstance;function setI18n(Xr){i18nInstance=Xr}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(Xr){setDefaults(Xr.options.react),setI18n(Xr)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(eo){eo.forEach(to=>{this.usedNamespaces[to]||(this.usedNamespaces[to]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious$1=(Xr,eo)=>{const to=reactExports.useRef();return reactExports.useEffect(()=>{to.current=Xr},[Xr,eo]),to.current};function useTranslation(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:to}=eo,{i18n:ro,defaultNS:no}=reactExports.useContext(I18nContext)||{},io=to||ro||getI18n();if(io&&!io.reportNamespaces&&(io.reportNamespaces=new ReportNamespaces),!io){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const Ro=(jo,Bo)=>typeof Bo=="string"?Bo:Bo&&typeof Bo=="object"&&typeof Bo.defaultValue=="string"?Bo.defaultValue:Array.isArray(jo)?jo[jo.length-1]:jo,Oo=[Ro,{},!1];return Oo.t=Ro,Oo.i18n={},Oo.ready=!1,Oo}io.options.react&&io.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const oo={...getDefaults(),...io.options.react,...eo},{useSuspense:ao,keyPrefix:so}=oo;let co=no||io.options&&io.options.defaultNS;co=typeof co=="string"?[co]:co||["translation"],io.reportNamespaces.addUsedNamespaces&&io.reportNamespaces.addUsedNamespaces(co);const lo=(io.isInitialized||io.initializedStoreOnce)&&co.every(Ro=>hasLoadedNamespace(Ro,io,oo));function uo(){return io.getFixedT(eo.lng||null,oo.nsMode==="fallback"?co:co[0],so)}const[ho,go]=reactExports.useState(uo);let bo=co.join();eo.lng&&(bo=`${eo.lng}${bo}`);const wo=usePrevious$1(bo),Eo=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:Ro,bindI18nStore:Oo}=oo;Eo.current=!0,!lo&&!ao&&(eo.lng?loadLanguages(io,eo.lng,co,()=>{Eo.current&&go(uo)}):loadNamespaces(io,co,()=>{Eo.current&&go(uo)})),lo&&wo&&wo!==bo&&Eo.current&&go(uo);function jo(){Eo.current&&go(uo)}return Ro&&io&&io.on(Ro,jo),Oo&&io&&io.store.on(Oo,jo),()=>{Eo.current=!1,Ro&&io&&Ro.split(" ").forEach(Bo=>io.off(Bo,jo)),Oo&&io&&Oo.split(" ").forEach(Bo=>io.store.off(Bo,jo))}},[io,bo]);const $o=reactExports.useRef(!0);reactExports.useEffect(()=>{Eo.current&&!$o.current&&go(uo),$o.current=!1},[io,so]);const Co=[ho,io,lo];if(Co.t=ho,Co.i18n=io,Co.ready=lo,lo||!lo&&!ao)return Co;throw new Promise(Ro=>{eo.lng?loadLanguages(io,eo.lng,co,()=>Ro()):loadNamespaces(io,co,()=>Ro())})}function I18nextProvider(Xr){let{i18n:eo,defaultNS:to,children:ro}=Xr;const no=reactExports.useMemo(()=>({i18n:eo,defaultNS:to}),[eo,to]);return reactExports.createElement(I18nContext.Provider,{value:no},ro)}const isClassNamesObjectArg=Xr=>typeof Xr=="object",isString$4=Xr=>typeof Xr=="string",classNames=(...Xr)=>Xr.reduce((to,ro)=>{if(isString$4(ro))return[...to,ro];if(isClassNamesObjectArg(ro)){const io=Object.keys(ro).map(oo=>ro[oo]?oo:null).filter(isString$4);return[...to,...io]}return to},[]).join(" "),useLocalStorage=(Xr,eo,to,ro)=>{const[no,io]=reactExports.useState(()=>{try{const so=StorageService.getItem(Xr);return so&&to&&!to(so)?(StorageService.removeItem(Xr),ro==null||ro.forEach(co=>StorageService.removeItem(co)),eo):so??eo}catch(so){return logger$8.error(so),eo}}),oo=reactExports.useCallback(so=>{try{const co=so instanceof Function?so(no):so;io(co),StorageService.setItem(Xr,co)}catch(co){logger$8.error(co)}},[Xr,no]),ao=reactExports.useCallback(()=>{StorageService.removeItem(Xr),io(eo)},[eo,Xr]);return[no,oo,ao]},CaptchaContext=reactExports.createContext(void 0),CaptchaContextProvider=({children:Xr})=>{const{setView:eo}=useViewContext(),[to,ro,no]=useLocalStorage(CAPTCHA_TOKEN,void 0),[io,oo]=reactExports.useState(),ao=reactExports.useCallback(({authMethod:lo,onCaptchaSuccess:uo})=>{oo({authMethod:lo,onCaptchaSuccess:uo}),eo("captcha")},[eo,oo]),so=reactExports.useCallback(()=>{const lo=to;return no(),lo},[to,no]),co=reactExports.useMemo(()=>({captchaAuthState:io,engageCaptcha:ao,getCaptchaToken:so,removeCaptchaToken:no,setCaptchaAuthState:oo,setCaptchaToken:ro}),[io,so,ao,oo,ro,no]);return jsxRuntimeExports.jsx(CaptchaContext.Provider,{value:co,children:Xr})},useCaptchaContext=()=>{const Xr=reactExports.useContext(CaptchaContext);if(Xr===void 0)throw new Error("usage of useCaptchaContext not wrapped in `CaptchaContextProvider`.");return Xr};var R$7=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",{default:". .... ....","/^4/":"... ... ...","/^5(?!50)/":"... ... ...","/^1(3|8)00/":".... ... ...","/^13/":".. .. ..","/^180/":"... ...."},0,[]],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["Côte d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","",2],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49",".... ........"],["Ghana","gh","233"],["Greece","gr","30"],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",".. ........"],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63",".... ......."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","",3,["787","939"]],["Qatar","qa","974"],["Réunion","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","... ... ..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]],ve$3="react-international-phone-",se$1=(...Xr)=>Xr.filter(eo=>!!eo).join(" ").trim(),xe$2=(...Xr)=>se$1(...Xr).split(" ").map(eo=>`${ve$3}${eo}`).join(" "),P$7=({addPrefix:Xr,rawClassNames:eo})=>se$1(xe$2(...Xr),...eo),le$4=({value:Xr,mask:eo,maskSymbol:to,offset:ro=0,trimNonMaskCharsLeftover:no=!1})=>{if(Xr.length=oo.length){if(!no&&co!==to){ao+=co;continue}break}co===to?(ao+=oo[so],so+=1):ao+=co}return ao},F$8=Xr=>Xr?/^\d+$/.test(Xr):!1,z$8=Xr=>Xr.replace(/\D/g,""),ue$4=(Xr,eo)=>{let to=Xr.style.display;to!=="block"&&(Xr.style.display="block");let ro=Xr.getBoundingClientRect(),no=eo.getBoundingClientRect(),io=no.top-ro.top,oo=ro.bottom-no.bottom;io>=0&&oo>=0||(Math.abs(io){let{name:eo,iso2:to,dialCode:ro,format:no,priority:io,areaCodes:oo}=Xr,ao=[eo,to,ro,no,io,oo];for(let so=0;sogo===void 0?"__undefined":go).replace(/"__undefined"/g,"undefined");throw new Error(`[react-international-phone] invalid country values passed to buildCountryData. Check ${co} in: ${uo}`)}}return ao.filter(so=>so!==void 0)},de$4=({phone:Xr,dialCode:eo,prefix:to="+",charAfterDialCode:ro=" "})=>{if(!Xr||!eo)return Xr;let no=Xr;return no.startsWith(to)&&(no=no.replace(to,"")),no.startsWith(eo)?(no=no.replace(eo,""),no.startsWith(ro)&&(no=no.replace(ro,"")),no):Xr},ce$5=(Xr,eo)=>{let to=eo.disableDialCodeAndPrefix?!1:eo.forceDialCode,ro=eo.disableDialCodeAndPrefix?!1:eo.insertDialCodeOnEmpty,no=Xr,io=co=>eo.trimNonDigitsEnd?co.trim():co;if(!no)return ro&&!no.length||to?io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`):io(no);if(no=z$8(no),no===eo.dialCode&&!eo.disableDialCodeAndPrefix)return io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`);if(eo.dialCode.startsWith(no)&&!eo.disableDialCodeAndPrefix)return io(to?`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`:`${eo.prefix}${no}`);if(!no.startsWith(eo.dialCode)&&!eo.disableDialCodeAndPrefix){if(to)return io(`${eo.prefix}${eo.dialCode}${eo.charAfterDialCode}`);if(no.length{let co=eo.dialCode.length,lo=no.slice(0,co),uo=no.slice(co);return{phoneLeftSide:lo,phoneRightSide:uo}},{phoneLeftSide:ao,phoneRightSide:so}=oo();return ao=`${eo.prefix}${ao}${eo.charAfterDialCode}`,so=le$4({value:so,mask:eo.mask,maskSymbol:eo.maskChar,trimNonMaskCharsLeftover:eo.trimNonDigitsEnd||eo.disableDialCodeAndPrefix&&so.length===0}),eo.disableDialCodeAndPrefix&&(ao=""),io(`${ao}${so}`)},pe$4=({phoneBeforeInput:Xr,phoneAfterInput:eo,phoneAfterFormatted:to,cursorPositionAfterInput:ro,leftOffset:no=0,deletion:io})=>{if(ro=0;lo-=1)if(F$8(eo[lo])){oo=lo;break}if(oo===null){for(let lo=0;lo=ao+1));lo+=1);if(io!=="backward")for(;!F$8(to[so])&&soXr?`${eo}${z$8(Xr)}`:"";function W$6({value:Xr,country:eo,insertDialCodeOnEmpty:to,trimNonDigitsEnd:ro,countries:no,prefix:io,charAfterDialCode:oo,forceDialCode:ao,disableDialCodeAndPrefix:so,defaultMask:co,countryGuessingEnabled:lo,disableFormatting:uo}){let ho=Xr;so&&(ho=ho.startsWith(`${io}`)?ho:`${io}${eo.dialCode}${ho}`);let go=lo?X$4({phone:ho,countries:no,currentCountryIso2:eo==null?void 0:eo.iso2}):void 0,bo=(go==null?void 0:go.country)??eo,wo=ce$5(ho,{prefix:io,mask:Q$7({phone:ho,country:bo,defaultMask:co,disableFormatting:uo}),maskChar:J$4,dialCode:bo.dialCode,trimNonDigitsEnd:ro,charAfterDialCode:oo,forceDialCode:ao,insertDialCodeOnEmpty:to,disableDialCodeAndPrefix:so}),Eo=lo&&!(go!=null&&go.fullDialCodeMatch)?eo:bo;return{phone:B$6({phone:so?`${Eo.dialCode}${wo}`:wo,prefix:io}),inputValue:wo,country:Eo}}var De$4=Xr=>{if((Xr==null?void 0:Xr.toLocaleLowerCase().includes("delete"))??!1)return Xr!=null&&Xr.toLocaleLowerCase().includes("forward")?"forward":"backward"},me=(Xr,{country:eo,insertDialCodeOnEmpty:to,phoneBeforeInput:ro,prefix:no,charAfterDialCode:io,forceDialCode:oo,disableDialCodeAndPrefix:ao,countryGuessingEnabled:so,defaultMask:co,disableFormatting:lo,countries:uo})=>{let ho=Xr.nativeEvent,go=ho.inputType,bo=De$4(go),wo=!!(go!=null&&go.startsWith("insertFrom")),Eo=go==="insertText",$o=(ho==null?void 0:ho.data)||void 0,Co=Xr.target.value,Ro=Xr.target.selectionStart??0;if(go!=null&&go.includes("history"))return{inputValue:ro,phone:B$6({phone:ro,prefix:no}),cursorPosition:ro.length,country:eo};if(Eo&&!F$8($o)&&Co!==no)return{inputValue:ro,phone:B$6({phone:ao?`${eo.dialCode}${ro}`:ro,prefix:no}),cursorPosition:Ro-(($o==null?void 0:$o.length)??0),country:eo};if(oo&&!Co.startsWith(`${no}${eo.dialCode}`)&&!wo){let Fo=Co?ro:`${no}${eo.dialCode}${io}`;return{inputValue:Fo,phone:B$6({phone:Fo,prefix:no}),cursorPosition:no.length+eo.dialCode.length+io.length,country:eo}}let{phone:Oo,inputValue:jo,country:Bo}=W$6({value:Co,country:eo,trimNonDigitsEnd:bo==="backward",insertDialCodeOnEmpty:to,countryGuessingEnabled:so,countries:uo,prefix:no,charAfterDialCode:io,forceDialCode:oo,disableDialCodeAndPrefix:ao,disableFormatting:lo,defaultMask:co}),Mo=pe$4({cursorPositionAfterInput:Ro,phoneBeforeInput:ro,phoneAfterInput:Co,phoneAfterFormatted:jo,leftOffset:oo?no.length+eo.dialCode.length+io.length:0,deletion:bo});return{phone:Oo,inputValue:jo,cursorPosition:Mo,country:Bo}},fe$1=(Xr,eo)=>{let to=Object.keys(Xr),ro=Object.keys(eo);if(to.length!==ro.length)return!1;for(let no of to)if(Xr[no]!==eo[no])return!1;return!0},Ce$3=()=>{let Xr=reactExports.useRef(),eo=reactExports.useRef(Date.now());return{check:()=>{let to=Date.now(),ro=Xr.current?to-eo.current:void 0;return Xr.current=eo.current,eo.current=to,ro}}},ke$4={size:20,overrideLastItemDebounceMS:-1};function ye$2(Xr,eo){let{size:to,overrideLastItemDebounceMS:ro,onChange:no}={...ke$4,...eo},[io,oo]=reactExports.useState(Xr),[ao,so]=reactExports.useState([io]),[co,lo]=reactExports.useState(0),uo=Ce$3();return[io,(ho,go)=>{if(typeof ho=="object"&&typeof io=="object"&&fe$1(ho,io)||ho===io)return;let bo=ro>0,wo=uo.check(),Eo=bo&&wo!==void 0?wo>ro:!0;if((go==null?void 0:go.overrideLastItem)!==void 0?go.overrideLastItem:!Eo)so($o=>[...$o.slice(0,co),ho]);else{let $o=ao.length>=to;so(Co=>[...Co.slice($o?1:0,co+1),ho]),$o||lo(Co=>Co+1)}oo(ho),no==null||no(ho)},()=>{if(co<=0)return{success:!1};let ho=ao[co-1];return oo(ho),lo(go=>go-1),no==null||no(ho),{success:!0,value:ho}},()=>{if(co+1>=ao.length)return{success:!1};let ho=ao[co+1];return oo(ho),lo(go=>go+1),no==null||no(ho),{success:!0,value:ho}}]}var J$4=".",E$8={defaultCountry:"us",value:"",prefix:"+",defaultMask:"............",charAfterDialCode:" ",historySaveDebounceMS:200,disableCountryGuess:!1,disableDialCodePrefill:!1,forceDialCode:!1,disableDialCodeAndPrefix:!1,disableFormatting:!1,countries:R$7,preferredCountries:[]},ee$5=({defaultCountry:Xr=E$8.defaultCountry,value:eo=E$8.value,countries:to=E$8.countries,prefix:ro=E$8.prefix,defaultMask:no=E$8.defaultMask,charAfterDialCode:io=E$8.charAfterDialCode,historySaveDebounceMS:oo=E$8.historySaveDebounceMS,disableCountryGuess:ao=E$8.disableCountryGuess,disableDialCodePrefill:so=E$8.disableDialCodePrefill,forceDialCode:co=E$8.forceDialCode,disableDialCodeAndPrefix:lo=E$8.disableDialCodeAndPrefix,disableFormatting:uo=E$8.disableFormatting,onChange:ho,inputRef:go})=>{let bo={countries:to,prefix:ro,charAfterDialCode:io,forceDialCode:lo?!1:co,disableDialCodeAndPrefix:lo,defaultMask:no,countryGuessingEnabled:!ao,disableFormatting:uo},wo=reactExports.useRef(null),Eo=go||wo,$o=vo=>{Promise.resolve().then(()=>{var _o;typeof window>"u"||Eo.current!==(document==null?void 0:document.activeElement)||((_o=Eo.current)==null||_o.setSelectionRange(vo,vo))})},[{phone:Co,inputValue:Ro,country:Oo},jo,Bo,Mo]=ye$2(()=>{let vo=$$6({value:Xr,field:"iso2",countries:to});vo||console.error(`[react-international-phone]: can not find a country with "${Xr}" iso2 code`);let _o=vo||$$6({value:"us",field:"iso2",countries:to}),{phone:So,inputValue:To,country:Ao}=W$6({value:eo,country:_o,insertDialCodeOnEmpty:!so,...bo});return $o(To.length),{phone:So,inputValue:To,country:Ao.iso2}},{overrideLastItemDebounceMS:oo,onChange:({inputValue:vo,phone:_o,country:So})=>{if(!ho)return;let To=Fo(So);ho({phone:_o,inputValue:vo,country:To})}}),Fo=reactExports.useCallback(vo=>$$6({value:vo,field:"iso2",countries:to}),[to]),Wo=reactExports.useMemo(()=>Fo(Oo),[Oo,Fo]);reactExports.useEffect(()=>{let vo=Eo.current;if(!vo)return;let _o=So=>{if(!So.key)return;let To=So.ctrlKey,Ao=So.shiftKey,ko=So.key.toLowerCase()==="z";!To||!ko||(Ao?Mo():Bo())};return vo.addEventListener("keydown",_o),()=>{vo.removeEventListener("keydown",_o)}},[Eo,Bo,Mo]);let Jo=vo=>{vo.preventDefault();let{phone:_o,inputValue:So,country:To,cursorPosition:Ao}=me(vo,{country:Wo,phoneBeforeInput:Ro,insertDialCodeOnEmpty:!1,...bo});return jo({inputValue:So,phone:_o,country:To.iso2}),$o(Ao),eo},Po=(vo,_o={focusOnInput:!1})=>{let So=$$6({value:vo,field:"iso2",countries:to});if(!So){console.error(`[react-international-phone]: can not find a country with "${vo}" iso2 code`);return}let To=lo?"":`${ro}${So.dialCode}${io}`;jo({inputValue:To,phone:`${ro}${So.dialCode}`,country:So.iso2}),_o.focusOnInput&&Promise.resolve().then(()=>{var Ao;(Ao=Eo.current)==null||Ao.focus()})},[fo,yo]=reactExports.useState(!1);return reactExports.useEffect(()=>{if(!fo){yo(!0),eo!==Co&&(ho==null||ho({inputValue:Ro,phone:Co,country:Wo}));return}if(eo===Co)return;let{phone:vo,inputValue:_o,country:So}=W$6({value:eo,country:Wo,insertDialCodeOnEmpty:!so,...bo});jo({phone:vo,inputValue:_o,country:So.iso2})},[eo]),{phone:Co,inputValue:Ro,country:Wo,setCountry:Po,handlePhoneValueChange:Jo,inputRef:Eo}},Q$7=({phone:Xr,country:eo,defaultMask:to="............",disableFormatting:ro=!1})=>{let no=eo.format,io=ao=>ro?ao.replace(new RegExp(`[^${J$4}]`,"g"),""):ao;if(!no)return io(to);if(typeof no=="string")return io(no);if(!no.default)return console.error(`[react-international-phone]: default mask for ${eo.iso2} is not provided`),io(to);let oo=Object.keys(no).find(ao=>{if(ao==="default")return!1;if(!(ao.charAt(0)==="/"&&ao.charAt(ao.length-1)==="/"))return console.error(`[react-international-phone]: format regex "${ao}" for ${eo.iso2} is not valid`),!1;let so=new RegExp(ao.substring(1,ao.length-1)),co=Xr.replace(eo.dialCode,"");return so.test(z$8(co))});return io(oo?no[oo]:no.default)},M$5=Xr=>{let[eo,to,ro,no,io,oo]=Xr;return{name:eo,iso2:to,dialCode:ro,format:no,priority:io,areaCodes:oo}},_e$3=Xr=>`Field "${Xr}" is not supported`,$$6=({field:Xr,value:eo,countries:to=R$7})=>{if(["priority"].includes(Xr))throw new Error(_e$3(Xr));let ro=to.find(no=>{let io=M$5(no);return eo===io[Xr]});if(ro)return M$5(ro)},X$4=({phone:Xr,countries:eo=R$7,currentCountryIso2:to})=>{var ao;let ro={country:void 0,fullDialCodeMatch:!1};if(!Xr)return ro;let no=z$8(Xr);if(!no)return ro;let io=ro,oo=({country:so,fullDialCodeMatch:co})=>{var ho,go;let lo=so.dialCode===((ho=io.country)==null?void 0:ho.dialCode),uo=(so.priority??0)<(((go=io.country)==null?void 0:go.priority)??0);(!lo||uo)&&(io={country:so,fullDialCodeMatch:co})};for(let so of eo){let co=M$5(so),{dialCode:lo,areaCodes:uo}=co;if(no.startsWith(lo)){let ho=io.country?Number(lo)>=Number(io.country.dialCode):!0;if(uo){let go=no.substring(lo.length);for(let bo of uo)if(go.startsWith(bo))return{country:co,fullDialCodeMatch:!0}}(ho||lo===no||!io.fullDialCodeMatch)&&oo({country:co,fullDialCodeMatch:!0})}io.fullDialCodeMatch||no.length{if(!(lo!=null&&lo.areaCodes))return!1;let uo=no.substring(lo.dialCode.length);return lo.areaCodes.some(ho=>ho.startsWith(uo))})(so):!1;io&&((ao=io.country)==null?void 0:ao.dialCode)===so.dialCode&&io.country!==so&&io.fullDialCodeMatch&&(!so.areaCodes||co)&&(io={country:so,fullDialCodeMatch:!0})}return io},Ae$2=(Xr,eo)=>{let to=parseInt(Xr,16);return Number(to+eo).toString(16)},Te$3="abcdefghijklmnopqrstuvwxyz",Ee$2="1f1e6",we$2=Te$3.split("").reduce((Xr,eo,to)=>({...Xr,[eo]:Ae$2(Ee$2,to)}),{}),Le$3=Xr=>[we$2[Xr[0]],we$2[Xr[1]]].join("-"),q$7=({iso2:Xr,size:eo,src:to,protocol:ro="https",disableLazyLoading:no,className:io,style:oo,...ao})=>{if(!Xr)return React.createElement("img",{className:P$7({addPrefix:["flag-emoji"],rawClassNames:[io]}),width:eo,height:eo,...ao});let so=()=>{if(to)return to;let co=Le$3(Xr);return`${ro}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${co}.svg`};return React.createElement("img",{className:P$7({addPrefix:["flag-emoji"],rawClassNames:[io]}),src:so(),width:eo,height:eo,draggable:!1,"data-country":Xr,loading:no?void 0:"lazy",style:{width:eo,height:eo,...oo},alt:"",...ao})},ze$3=1e3,ne$1=({show:Xr,dialCodePrefix:eo="+",selectedCountry:to,countries:ro=R$7,preferredCountries:no=[],flags:io,onSelect:oo,onClose:ao,...so})=>{let co=reactExports.useRef(null),lo=reactExports.useRef(),uo=reactExports.useMemo(()=>{if(!no||!no.length)return ro;let Bo=[],Mo=[...ro];for(let Fo of no){let Wo=Mo.findIndex(Jo=>M$5(Jo).iso2===Fo);if(Wo!==-1){let Jo=Mo.splice(Wo,1)[0];Bo.push(Jo)}}return Bo.concat(Mo)},[ro,no]),ho=reactExports.useRef({updatedAt:void 0,value:""}),go=Bo=>{let Mo=ho.current.updatedAt&&new Date().getTime()-ho.current.updatedAt.getTime()>ze$3;ho.current={value:Mo?Bo:`${ho.current.value}${Bo}`,updatedAt:new Date};let Fo=uo.findIndex(Wo=>M$5(Wo).name.toLowerCase().startsWith(ho.current.value));Fo!==-1&&Eo(Fo)},bo=reactExports.useCallback(Bo=>uo.findIndex(Mo=>M$5(Mo).iso2===Bo),[uo]),[wo,Eo]=reactExports.useState(bo(to)),$o=()=>{lo.current!==to&&Eo(bo(to))},Co=reactExports.useCallback(Bo=>{Eo(bo(Bo.iso2)),oo==null||oo(Bo)},[oo,bo]),Ro=Bo=>{let Mo=uo.length-1,Fo=Wo=>Bo==="prev"?Wo-1:Bo==="next"?Wo+1:Bo==="last"?Mo:0;Eo(Wo=>{let Jo=Fo(Wo);return Jo<0?0:Jo>Mo?Mo:Jo})},Oo=Bo=>{if(Bo.stopPropagation(),Bo.key==="Enter"){Bo.preventDefault();let Mo=M$5(uo[wo]);Co(Mo);return}if(Bo.key==="Escape"){ao==null||ao();return}if(Bo.key==="ArrowUp"){Bo.preventDefault(),Ro("prev");return}if(Bo.key==="ArrowDown"){Bo.preventDefault(),Ro("next");return}if(Bo.key==="PageUp"){Bo.preventDefault(),Ro("first");return}if(Bo.key==="PageDown"){Bo.preventDefault(),Ro("last");return}Bo.key===" "&&Bo.preventDefault(),Bo.key.length===1&&!Bo.altKey&&!Bo.ctrlKey&&!Bo.metaKey&&go(Bo.key.toLocaleLowerCase())},jo=reactExports.useCallback(()=>{if(!co.current||wo===void 0)return;let Bo=M$5(uo[wo]).iso2;if(Bo===lo.current)return;let Mo=co.current.querySelector(`[data-country="${Bo}"]`);Mo&&(ue$4(co.current,Mo),lo.current=Bo)},[wo,uo]);return reactExports.useEffect(()=>{jo()},[wo,jo]),reactExports.useEffect(()=>{co.current&&(Xr?co.current.focus():$o())},[Xr]),reactExports.useEffect(()=>{$o()},[to]),React.createElement("ul",{ref:co,role:"listbox",className:P$7({addPrefix:["country-selector-dropdown"],rawClassNames:[so.className]}),style:{display:Xr?"block":"none",...so.style},onKeyDown:Oo,onBlur:ao,tabIndex:-1,"aria-activedescendant":`react-international-phone__${M$5(uo[wo]).iso2}-option`},uo.map((Bo,Mo)=>{let Fo=M$5(Bo),Wo=Fo.iso2===to,Jo=Mo===wo,Po=no.includes(Fo.iso2),fo=Mo===no.length-1,yo=io==null?void 0:io.find(vo=>vo.iso2===Fo.iso2);return React.createElement(React.Fragment,{key:Fo.iso2},React.createElement("li",{"data-country":Fo.iso2,role:"option","aria-selected":Wo,"aria-label":`${Fo.name} ${eo}${Fo.dialCode}`,id:`react-international-phone__${Fo.iso2}-option`,className:P$7({addPrefix:["country-selector-dropdown__list-item",Po&&"country-selector-dropdown__list-item--preferred",Wo&&"country-selector-dropdown__list-item--selected",Jo&&"country-selector-dropdown__list-item--focused"],rawClassNames:[so.listItemClassName]}),onClick:()=>Co(Fo),style:so.listItemStyle,title:Fo.name},React.createElement(q$7,{iso2:Fo.iso2,src:yo==null?void 0:yo.src,className:P$7({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[so.listItemFlagClassName]}),style:so.listItemFlagStyle}),React.createElement("span",{className:P$7({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[so.listItemCountryNameClassName]}),style:so.listItemCountryNameStyle},Fo.name),React.createElement("span",{className:P$7({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[so.listItemDialCodeClassName]}),style:so.listItemDialCodeStyle},eo,Fo.dialCode)),fo?React.createElement("hr",{className:P$7({addPrefix:["country-selector-dropdown__preferred-list-divider"],rawClassNames:[so.preferredListDividerClassName]}),style:so.preferredListDividerStyle}):null)}))},ae$4=({selectedCountry:Xr,onSelect:eo,disabled:to,hideDropdown:ro,countries:no=R$7,preferredCountries:io=[],flags:oo,renderButtonWrapper:ao,...so})=>{let[co,lo]=reactExports.useState(!1),uo=reactExports.useMemo(()=>{if(Xr)return $$6({value:Xr,field:"iso2",countries:no})},[no,Xr]),ho=reactExports.useRef(null),go=wo=>{wo.key&&["ArrowUp","ArrowDown"].includes(wo.key)&&(wo.preventDefault(),lo(!0))},bo=()=>{var $o;let wo={title:uo==null?void 0:uo.name,onClick:()=>lo(Co=>!Co),onMouseDown:Co=>Co.preventDefault(),onKeyDown:go,disabled:ro||to,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":co},Eo=React.createElement("div",{className:P$7({addPrefix:["country-selector-button__button-content"],rawClassNames:[so.buttonContentWrapperClassName]}),style:so.buttonContentWrapperStyle},React.createElement(q$7,{iso2:Xr,src:($o=oo==null?void 0:oo.find(Co=>Co.iso2===Xr))==null?void 0:$o.src,className:P$7({addPrefix:["country-selector-button__flag-emoji",to&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[so.flagClassName]}),style:{visibility:Xr?"visible":"hidden",...so.flagStyle}}),!ro&&React.createElement("div",{className:P$7({addPrefix:["country-selector-button__dropdown-arrow",to&&"country-selector-button__dropdown-arrow--disabled",co&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[so.dropdownArrowClassName]}),style:so.dropdownArrowStyle}));return ao?ao({children:Eo,rootProps:wo}):React.createElement("button",{...wo,type:"button",className:P$7({addPrefix:["country-selector-button",co&&"country-selector-button--active",to&&"country-selector-button--disabled",ro&&"country-selector-button--hide-dropdown"],rawClassNames:[so.buttonClassName]}),"data-country":Xr,style:so.buttonStyle},Eo)};return React.createElement("div",{className:P$7({addPrefix:["country-selector"],rawClassNames:[so.className]}),style:so.style,ref:ho},bo(),React.createElement(ne$1,{show:co,countries:no,preferredCountries:io,flags:oo,onSelect:wo=>{lo(!1),eo==null||eo(wo)},selectedCountry:Xr,onClose:()=>{lo(!1)},...so.dropdownStyleProps}))},ie$3=({dialCode:Xr,prefix:eo,disabled:to,style:ro,className:no})=>React.createElement("div",{className:P$7({addPrefix:["dial-code-preview",to&&"dial-code-preview--disabled"],rawClassNames:[no]}),style:ro},`${eo}${Xr}`);reactExports.forwardRef(({value:Xr,onChange:eo,countries:to=R$7,preferredCountries:ro=[],hideDropdown:no,showDisabledDialCodeAndPrefix:io,disableFocusAfterCountrySelect:oo,flags:ao,style:so,className:co,inputStyle:lo,inputClassName:uo,countrySelectorStyleProps:ho,dialCodePreviewStyleProps:go,inputProps:bo,placeholder:wo,disabled:Eo,name:$o,onFocus:Co,onBlur:Ro,required:Oo,autoFocus:jo,...Bo},Mo)=>{let{phone:Fo,inputValue:Wo,inputRef:Jo,country:Po,setCountry:fo,handlePhoneValueChange:yo}=ee$5({value:Xr,countries:to,...Bo,onChange:_o=>{eo==null||eo(_o.phone,{country:_o.country,inputValue:_o.inputValue})}}),vo=Bo.disableDialCodeAndPrefix&&io&&(Po==null?void 0:Po.dialCode);return reactExports.useImperativeHandle(Mo,()=>Jo.current?Object.assign(Jo.current,{setCountry:fo,state:{phone:Fo,inputValue:Wo,country:Po}}):null,[Jo,fo,Fo,Wo,Po]),React.createElement("div",{ref:Mo,className:P$7({addPrefix:["input-container"],rawClassNames:[co]}),style:so},React.createElement(ae$4,{onSelect:_o=>fo(_o.iso2,{focusOnInput:!oo}),flags:ao,selectedCountry:Po.iso2,countries:to,preferredCountries:ro,disabled:Eo,hideDropdown:no,...ho}),vo&&React.createElement(ie$3,{dialCode:Po.dialCode,prefix:Bo.prefix??"+",disabled:Eo,...go}),React.createElement("input",{onChange:yo,value:Wo,type:"tel",ref:Jo,className:P$7({addPrefix:["input",Eo&&"input--disabled"],rawClassNames:[uo]}),placeholder:wo,disabled:Eo,style:lo,name:$o,onFocus:Co,onBlur:Ro,autoFocus:jo,required:Oo,...bo}))});let ApiEndpoint$1=class{};ApiEndpoint$1.getBaseUrl=()=>{if(!ApiEndpoint$1.__baseUrl__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint$1.__baseUrl__};ApiEndpoint$1.setBaseUrl=Xr=>{Xr?ApiEndpoint$1.__baseUrl__=Xr:ApiEndpoint$1.__baseUrl__=new Configuration().basePath};const hasPendingMfaAction=Xr=>{var eo;return((eo=Xr.scope)===null||eo===void 0?void 0:eo.includes("requiresAdditionalAuth"))||Xr.mfaBackupCodeAcknowledgement===MfaBackupCodeAcknowledgement.Pending},hasPendingRequirements=Xr=>{var eo;return!!(!((eo=Xr.missingFields)===null||eo===void 0)&&eo.length)||hasPendingMfaAction(Xr)},{getUser,setUser,useUser:useUserRaw}=createStoreState("user"),useUser=()=>{const Xr=reactExports.useRef(!1),eo=useUserRaw();return eo?!Xr.current&&hasPendingRequirements(eo)?{userWithMissingInfo:eo}:(Xr.current=!0,{user:eo}):(Xr.current=!1,{})},consoleLogger={type:"logger",log(Xr){this.output("log",Xr)},warn(Xr){this.output("warn",Xr)},error(Xr){this.output("error",Xr)},output(Xr,eo){console&&console[Xr]&&console[Xr].apply(console,eo)}};let Logger$1=class _k{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(eo,to)}init(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=to.prefix||"i18next:",this.logger=eo||consoleLogger,this.options=to,this.debug=to.debug}log(){for(var eo=arguments.length,to=new Array(eo),ro=0;ro{this.observers[ro]=this.observers[ro]||[],this.observers[ro].push(to)}),this}off(eo,to){if(this.observers[eo]){if(!to){delete this.observers[eo];return}this.observers[eo]=this.observers[eo].filter(ro=>ro!==to)}}emit(eo){for(var to=arguments.length,ro=new Array(to>1?to-1:0),no=1;no{oo(...ro)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(oo=>{oo.apply(oo,[eo,...ro])})}};function defer(){let Xr,eo;const to=new Promise((ro,no)=>{Xr=ro,eo=no});return to.resolve=Xr,to.reject=eo,to}function makeString(Xr){return Xr==null?"":""+Xr}function copy$1(Xr,eo,to){Xr.forEach(ro=>{eo[ro]&&(to[ro]=eo[ro])})}function getLastOfPath(Xr,eo,to){function ro(oo){return oo&&oo.indexOf("###")>-1?oo.replace(/###/g,"."):oo}function no(){return!Xr||typeof Xr=="string"}const io=typeof eo!="string"?[].concat(eo):eo.split(".");for(;io.length>1;){if(no())return{};const oo=ro(io.shift());!Xr[oo]&&to&&(Xr[oo]=new to),Object.prototype.hasOwnProperty.call(Xr,oo)?Xr=Xr[oo]:Xr={}}return no()?{}:{obj:Xr,k:ro(io.shift())}}function setPath(Xr,eo,to){const{obj:ro,k:no}=getLastOfPath(Xr,eo,Object);ro[no]=to}function pushPath(Xr,eo,to,ro){const{obj:no,k:io}=getLastOfPath(Xr,eo,Object);no[io]=no[io]||[],no[io].push(to)}function getPath(Xr,eo){const{obj:to,k:ro}=getLastOfPath(Xr,eo);if(to)return to[ro]}function getPathWithDefaults(Xr,eo,to){const ro=getPath(Xr,to);return ro!==void 0?ro:getPath(eo,to)}function deepExtend(Xr,eo,to){for(const ro in eo)ro!=="__proto__"&&ro!=="constructor"&&(ro in Xr?typeof Xr[ro]=="string"||Xr[ro]instanceof String||typeof eo[ro]=="string"||eo[ro]instanceof String?to&&(Xr[ro]=eo[ro]):deepExtend(Xr[ro],eo[ro],to):Xr[ro]=eo[ro]);return Xr}function regexEscape(Xr){return Xr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape$1(Xr){return typeof Xr=="string"?Xr.replace(/[&<>"'\/]/g,eo=>_entityMap[eo]):Xr}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(Xr,eo,to){eo=eo||"",to=to||"";const ro=chars.filter(oo=>eo.indexOf(oo)<0&&to.indexOf(oo)<0);if(ro.length===0)return!0;const no=new RegExp(`(${ro.map(oo=>oo==="?"?"\\?":oo).join("|")})`);let io=!no.test(Xr);if(!io){const oo=Xr.indexOf(to);oo>0&&!no.test(Xr.substring(0,oo))&&(io=!0)}return io}function deepFind(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!Xr)return;if(Xr[eo])return Xr[eo];const ro=eo.split(to);let no=Xr;for(let io=0;ioio+oo;)oo++,ao=ro.slice(io,io+oo).join(to),so=no[ao];if(so===void 0)return;if(so===null)return null;if(eo.endsWith(ao)){if(typeof so=="string")return so;if(ao&&typeof so[ao]=="string")return so[ao]}const co=ro.slice(io+oo).join(to);return co?deepFind(so,co,to):void 0}no=no[ro[io]]}return no}function getCleanedCode(Xr){return Xr&&Xr.indexOf("_")>0?Xr.replace("_","-"):Xr}class ResourceStore extends EventEmitter$2{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=eo||{},this.options=to,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(eo){this.options.ns.indexOf(eo)<0&&this.options.ns.push(eo)}removeNamespaces(eo){const to=this.options.ns.indexOf(eo);to>-1&&this.options.ns.splice(to,1)}getResource(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const io=no.keySeparator!==void 0?no.keySeparator:this.options.keySeparator,oo=no.ignoreJSONStructure!==void 0?no.ignoreJSONStructure:this.options.ignoreJSONStructure;let ao=[eo,to];ro&&typeof ro!="string"&&(ao=ao.concat(ro)),ro&&typeof ro=="string"&&(ao=ao.concat(io?ro.split(io):ro)),eo.indexOf(".")>-1&&(ao=eo.split("."));const so=getPath(this.data,ao);return so||!oo||typeof ro!="string"?so:deepFind(this.data&&this.data[eo]&&this.data[eo][to],ro,io)}addResource(eo,to,ro,no){let io=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const oo=io.keySeparator!==void 0?io.keySeparator:this.options.keySeparator;let ao=[eo,to];ro&&(ao=ao.concat(oo?ro.split(oo):ro)),eo.indexOf(".")>-1&&(ao=eo.split("."),no=to,to=ao[1]),this.addNamespaces(to),setPath(this.data,ao,no),io.silent||this.emit("added",eo,to,ro,no)}addResources(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const io in ro)(typeof ro[io]=="string"||Object.prototype.toString.apply(ro[io])==="[object Array]")&&this.addResource(eo,to,io,ro[io],{silent:!0});no.silent||this.emit("added",eo,to,ro)}addResourceBundle(eo,to,ro,no,io){let oo=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},ao=[eo,to];eo.indexOf(".")>-1&&(ao=eo.split("."),no=ro,ro=to,to=ao[1]),this.addNamespaces(to);let so=getPath(this.data,ao)||{};no?deepExtend(so,ro,io):so={...so,...ro},setPath(this.data,ao,so),oo.silent||this.emit("added",eo,to,ro)}removeResourceBundle(eo,to){this.hasResourceBundle(eo,to)&&delete this.data[eo][to],this.removeNamespaces(to),this.emit("removed",eo,to)}hasResourceBundle(eo,to){return this.getResource(eo,to)!==void 0}getResourceBundle(eo,to){return to||(to=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(eo,to)}:this.getResource(eo,to)}getDataByLanguage(eo){return this.data[eo]}hasLanguageSomeTranslations(eo){const to=this.getDataByLanguage(eo);return!!(to&&Object.keys(to)||[]).find(no=>to[no]&&Object.keys(to[no]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(Xr){this.processors[Xr.name]=Xr},handle(Xr,eo,to,ro,no){return Xr.forEach(io=>{this.processors[io]&&(eo=this.processors[io].process(eo,to,ro,no))}),eo}};const checkedLoadedFor={};class Translator extends EventEmitter$2{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy$1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],eo,this),this.options=to,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(eo){eo&&(this.language=eo)}exists(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(eo==null)return!1;const ro=this.resolve(eo,to);return ro&&ro.res!==void 0}extractFromKey(eo,to){let ro=to.nsSeparator!==void 0?to.nsSeparator:this.options.nsSeparator;ro===void 0&&(ro=":");const no=to.keySeparator!==void 0?to.keySeparator:this.options.keySeparator;let io=to.ns||this.options.defaultNS||[];const oo=ro&&eo.indexOf(ro)>-1,ao=!this.options.userDefinedKeySeparator&&!to.keySeparator&&!this.options.userDefinedNsSeparator&&!to.nsSeparator&&!looksLikeObjectPath(eo,ro,no);if(oo&&!ao){const so=eo.match(this.interpolator.nestingRegexp);if(so&&so.length>0)return{key:eo,namespaces:io};const co=eo.split(ro);(ro!==no||ro===no&&this.options.ns.indexOf(co[0])>-1)&&(io=co.shift()),eo=co.join(no)}return typeof io=="string"&&(io=[io]),{key:eo,namespaces:io}}translate(eo,to,ro){if(typeof to!="object"&&this.options.overloadTranslationOptionHandler&&(to=this.options.overloadTranslationOptionHandler(arguments)),typeof to=="object"&&(to={...to}),to||(to={}),eo==null)return"";Array.isArray(eo)||(eo=[String(eo)]);const no=to.returnDetails!==void 0?to.returnDetails:this.options.returnDetails,io=to.keySeparator!==void 0?to.keySeparator:this.options.keySeparator,{key:oo,namespaces:ao}=this.extractFromKey(eo[eo.length-1],to),so=ao[ao.length-1],co=to.lng||this.language,lo=to.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(co&&co.toLowerCase()==="cimode"){if(lo){const Oo=to.nsSeparator||this.options.nsSeparator;return no?{res:`${so}${Oo}${oo}`,usedKey:oo,exactUsedKey:oo,usedLng:co,usedNS:so}:`${so}${Oo}${oo}`}return no?{res:oo,usedKey:oo,exactUsedKey:oo,usedLng:co,usedNS:so}:oo}const uo=this.resolve(eo,to);let ho=uo&&uo.res;const go=uo&&uo.usedKey||oo,bo=uo&&uo.exactUsedKey||oo,wo=Object.prototype.toString.apply(ho),Eo=["[object Number]","[object Function]","[object RegExp]"],$o=to.joinArrays!==void 0?to.joinArrays:this.options.joinArrays,Co=!this.i18nFormat||this.i18nFormat.handleAsObject;if(Co&&ho&&(typeof ho!="string"&&typeof ho!="boolean"&&typeof ho!="number")&&Eo.indexOf(wo)<0&&!(typeof $o=="string"&&wo==="[object Array]")){if(!to.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Oo=this.options.returnedObjectHandler?this.options.returnedObjectHandler(go,ho,{...to,ns:ao}):`key '${oo} (${this.language})' returned an object instead of string.`;return no?(uo.res=Oo,uo):Oo}if(io){const Oo=wo==="[object Array]",jo=Oo?[]:{},Bo=Oo?bo:go;for(const Mo in ho)if(Object.prototype.hasOwnProperty.call(ho,Mo)){const Fo=`${Bo}${io}${Mo}`;jo[Mo]=this.translate(Fo,{...to,joinArrays:!1,ns:ao}),jo[Mo]===Fo&&(jo[Mo]=ho[Mo])}ho=jo}}else if(Co&&typeof $o=="string"&&wo==="[object Array]")ho=ho.join($o),ho&&(ho=this.extendTranslation(ho,eo,to,ro));else{let Oo=!1,jo=!1;const Bo=to.count!==void 0&&typeof to.count!="string",Mo=Translator.hasDefaultValue(to),Fo=Bo?this.pluralResolver.getSuffix(co,to.count,to):"",Wo=to.ordinal&&Bo?this.pluralResolver.getSuffix(co,to.count,{ordinal:!1}):"",Jo=to[`defaultValue${Fo}`]||to[`defaultValue${Wo}`]||to.defaultValue;!this.isValidLookup(ho)&&Mo&&(Oo=!0,ho=Jo),this.isValidLookup(ho)||(jo=!0,ho=oo);const fo=(to.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&jo?void 0:ho,yo=Mo&&Jo!==ho&&this.options.updateMissing;if(jo||Oo||yo){if(this.logger.log(yo?"updateKey":"missingKey",co,so,oo,yo?Jo:ho),io){const To=this.resolve(oo,{...to,keySeparator:!1});To&&To.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let vo=[];const _o=this.languageUtils.getFallbackCodes(this.options.fallbackLng,to.lng||this.language);if(this.options.saveMissingTo==="fallback"&&_o&&_o[0])for(let To=0;To<_o.length;To++)vo.push(_o[To]);else this.options.saveMissingTo==="all"?vo=this.languageUtils.toResolveHierarchy(to.lng||this.language):vo.push(to.lng||this.language);const So=(To,Ao,ko)=>{const mo=Mo&&ko!==ho?ko:fo;this.options.missingKeyHandler?this.options.missingKeyHandler(To,so,Ao,mo,yo,to):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(To,so,Ao,mo,yo,to),this.emit("missingKey",To,so,Ao,ho)};this.options.saveMissing&&(this.options.saveMissingPlurals&&Bo?vo.forEach(To=>{this.pluralResolver.getSuffixes(To,to).forEach(Ao=>{So([To],oo+Ao,to[`defaultValue${Ao}`]||Jo)})}):So(vo,oo,Jo))}ho=this.extendTranslation(ho,eo,to,uo,ro),jo&&ho===oo&&this.options.appendNamespaceToMissingKey&&(ho=`${so}:${oo}`),(jo||Oo)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?ho=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${so}:${oo}`:oo,Oo?ho:void 0):ho=this.options.parseMissingKeyHandler(ho))}return no?(uo.res=ho,uo):ho}extendTranslation(eo,to,ro,no,io){var oo=this;if(this.i18nFormat&&this.i18nFormat.parse)eo=this.i18nFormat.parse(eo,{...this.options.interpolation.defaultVariables,...ro},ro.lng||this.language||no.usedLng,no.usedNS,no.usedKey,{resolved:no});else if(!ro.skipInterpolation){ro.interpolation&&this.interpolator.init({...ro,interpolation:{...this.options.interpolation,...ro.interpolation}});const co=typeof eo=="string"&&(ro&&ro.interpolation&&ro.interpolation.skipOnVariables!==void 0?ro.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let lo;if(co){const ho=eo.match(this.interpolator.nestingRegexp);lo=ho&&ho.length}let uo=ro.replace&&typeof ro.replace!="string"?ro.replace:ro;if(this.options.interpolation.defaultVariables&&(uo={...this.options.interpolation.defaultVariables,...uo}),eo=this.interpolator.interpolate(eo,uo,ro.lng||this.language,ro),co){const ho=eo.match(this.interpolator.nestingRegexp),go=ho&&ho.length;lo1&&arguments[1]!==void 0?arguments[1]:{},ro,no,io,oo,ao;return typeof eo=="string"&&(eo=[eo]),eo.forEach(so=>{if(this.isValidLookup(ro))return;const co=this.extractFromKey(so,to),lo=co.key;no=lo;let uo=co.namespaces;this.options.fallbackNS&&(uo=uo.concat(this.options.fallbackNS));const ho=to.count!==void 0&&typeof to.count!="string",go=ho&&!to.ordinal&&to.count===0&&this.pluralResolver.shouldUseIntlApi(),bo=to.context!==void 0&&(typeof to.context=="string"||typeof to.context=="number")&&to.context!=="",wo=to.lngs?to.lngs:this.languageUtils.toResolveHierarchy(to.lng||this.language,to.fallbackLng);uo.forEach(Eo=>{this.isValidLookup(ro)||(ao=Eo,!checkedLoadedFor[`${wo[0]}-${Eo}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(ao)&&(checkedLoadedFor[`${wo[0]}-${Eo}`]=!0,this.logger.warn(`key "${no}" for languages "${wo.join(", ")}" won't get resolved as namespace "${ao}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),wo.forEach($o=>{if(this.isValidLookup(ro))return;oo=$o;const Co=[lo];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(Co,lo,$o,Eo,to);else{let Oo;ho&&(Oo=this.pluralResolver.getSuffix($o,to.count,to));const jo=`${this.options.pluralSeparator}zero`,Bo=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(ho&&(Co.push(lo+Oo),to.ordinal&&Oo.indexOf(Bo)===0&&Co.push(lo+Oo.replace(Bo,this.options.pluralSeparator)),go&&Co.push(lo+jo)),bo){const Mo=`${lo}${this.options.contextSeparator}${to.context}`;Co.push(Mo),ho&&(Co.push(Mo+Oo),to.ordinal&&Oo.indexOf(Bo)===0&&Co.push(Mo+Oo.replace(Bo,this.options.pluralSeparator)),go&&Co.push(Mo+jo))}}let Ro;for(;Ro=Co.pop();)this.isValidLookup(ro)||(io=Ro,ro=this.getResource($o,Eo,Ro,to))}))})}),{res:ro,usedKey:no,exactUsedKey:io,usedLng:oo,usedNS:ao}}isValidLookup(eo){return eo!==void 0&&!(!this.options.returnNull&&eo===null)&&!(!this.options.returnEmptyString&&eo==="")}getResource(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(eo,to,ro,no):this.resourceStore.getResource(eo,to,ro,no)}static hasDefaultValue(eo){const to="defaultValue";for(const ro in eo)if(Object.prototype.hasOwnProperty.call(eo,ro)&&to===ro.substring(0,to.length)&&eo[ro]!==void 0)return!0;return!1}}function capitalize$4(Xr){return Xr.charAt(0).toUpperCase()+Xr.slice(1)}class LanguageUtil{constructor(eo){this.options=eo,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(eo){if(eo=getCleanedCode(eo),!eo||eo.indexOf("-")<0)return null;const to=eo.split("-");return to.length===2||(to.pop(),to[to.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(to.join("-"))}getLanguagePartFromCode(eo){if(eo=getCleanedCode(eo),!eo||eo.indexOf("-")<0)return eo;const to=eo.split("-");return this.formatLanguageCode(to[0])}formatLanguageCode(eo){if(typeof eo=="string"&&eo.indexOf("-")>-1){const to=["hans","hant","latn","cyrl","cans","mong","arab"];let ro=eo.split("-");return this.options.lowerCaseLng?ro=ro.map(no=>no.toLowerCase()):ro.length===2?(ro[0]=ro[0].toLowerCase(),ro[1]=ro[1].toUpperCase(),to.indexOf(ro[1].toLowerCase())>-1&&(ro[1]=capitalize$4(ro[1].toLowerCase()))):ro.length===3&&(ro[0]=ro[0].toLowerCase(),ro[1].length===2&&(ro[1]=ro[1].toUpperCase()),ro[0]!=="sgn"&&ro[2].length===2&&(ro[2]=ro[2].toUpperCase()),to.indexOf(ro[1].toLowerCase())>-1&&(ro[1]=capitalize$4(ro[1].toLowerCase())),to.indexOf(ro[2].toLowerCase())>-1&&(ro[2]=capitalize$4(ro[2].toLowerCase()))),ro.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?eo.toLowerCase():eo}isSupportedCode(eo){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(eo=this.getLanguagePartFromCode(eo)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(eo)>-1}getBestMatchFromCodes(eo){if(!eo)return null;let to;return eo.forEach(ro=>{if(to)return;const no=this.formatLanguageCode(ro);(!this.options.supportedLngs||this.isSupportedCode(no))&&(to=no)}),!to&&this.options.supportedLngs&&eo.forEach(ro=>{if(to)return;const no=this.getLanguagePartFromCode(ro);if(this.isSupportedCode(no))return to=no;to=this.options.supportedLngs.find(io=>{if(io===no)return io;if(!(io.indexOf("-")<0&&no.indexOf("-")<0)&&io.indexOf(no)===0)return io})}),to||(to=this.getFallbackCodes(this.options.fallbackLng)[0]),to}getFallbackCodes(eo,to){if(!eo)return[];if(typeof eo=="function"&&(eo=eo(to)),typeof eo=="string"&&(eo=[eo]),Object.prototype.toString.apply(eo)==="[object Array]")return eo;if(!to)return eo.default||[];let ro=eo[to];return ro||(ro=eo[this.getScriptPartFromCode(to)]),ro||(ro=eo[this.formatLanguageCode(to)]),ro||(ro=eo[this.getLanguagePartFromCode(to)]),ro||(ro=eo.default),ro||[]}toResolveHierarchy(eo,to){const ro=this.getFallbackCodes(to||this.options.fallbackLng||[],eo),no=[],io=oo=>{oo&&(this.isSupportedCode(oo)?no.push(oo):this.logger.warn(`rejecting language code not found in supportedLngs: ${oo}`))};return typeof eo=="string"&&(eo.indexOf("-")>-1||eo.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&io(this.formatLanguageCode(eo)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&io(this.getScriptPartFromCode(eo)),this.options.load!=="currentOnly"&&io(this.getLanguagePartFromCode(eo))):typeof eo=="string"&&io(this.formatLanguageCode(eo)),ro.forEach(oo=>{no.indexOf(oo)<0&&io(this.formatLanguageCode(oo))}),no}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(Xr){return+(Xr>1)},2:function(Xr){return+(Xr!=1)},3:function(Xr){return 0},4:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr%10>=2&&Xr%10<=4&&(Xr%100<10||Xr%100>=20)?1:2},5:function(Xr){return Xr==0?0:Xr==1?1:Xr==2?2:Xr%100>=3&&Xr%100<=10?3:Xr%100>=11?4:5},6:function(Xr){return Xr==1?0:Xr>=2&&Xr<=4?1:2},7:function(Xr){return Xr==1?0:Xr%10>=2&&Xr%10<=4&&(Xr%100<10||Xr%100>=20)?1:2},8:function(Xr){return Xr==1?0:Xr==2?1:Xr!=8&&Xr!=11?2:3},9:function(Xr){return+(Xr>=2)},10:function(Xr){return Xr==1?0:Xr==2?1:Xr<7?2:Xr<11?3:4},11:function(Xr){return Xr==1||Xr==11?0:Xr==2||Xr==12?1:Xr>2&&Xr<20?2:3},12:function(Xr){return+(Xr%10!=1||Xr%100==11)},13:function(Xr){return+(Xr!==0)},14:function(Xr){return Xr==1?0:Xr==2?1:Xr==3?2:3},15:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr%10>=2&&(Xr%100<10||Xr%100>=20)?1:2},16:function(Xr){return Xr%10==1&&Xr%100!=11?0:Xr!==0?1:2},17:function(Xr){return Xr==1||Xr%10==1&&Xr%100!=11?0:1},18:function(Xr){return Xr==0?0:Xr==1?1:2},19:function(Xr){return Xr==1?0:Xr==0||Xr%100>1&&Xr%100<11?1:Xr%100>10&&Xr%100<20?2:3},20:function(Xr){return Xr==1?0:Xr==0||Xr%100>0&&Xr%100<20?1:2},21:function(Xr){return Xr%100==1?1:Xr%100==2?2:Xr%100==3||Xr%100==4?3:0},22:function(Xr){return Xr==1?0:Xr==2?1:(Xr<0||Xr>10)&&Xr%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const Xr={};return sets.forEach(eo=>{eo.lngs.forEach(to=>{Xr[to]={numbers:eo.nr,plurals:_rulesPluralsTypes[eo.fc]}})}),Xr}class PluralResolver{constructor(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=eo,this.options=to,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(eo,to){this.rules[eo]=to}getRule(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(eo),{type:to.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[eo]||this.rules[this.languageUtils.getLanguagePartFromCode(eo)]}needsPlural(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ro=this.getRule(eo,to);return this.shouldUseIntlApi()?ro&&ro.resolvedOptions().pluralCategories.length>1:ro&&ro.numbers.length>1}getPluralFormsOfKey(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(eo,ro).map(no=>`${to}${no}`)}getSuffixes(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ro=this.getRule(eo,to);return ro?this.shouldUseIntlApi()?ro.resolvedOptions().pluralCategories.sort((no,io)=>suffixesOrder[no]-suffixesOrder[io]).map(no=>`${this.options.prepend}${to.ordinal?`ordinal${this.options.prepend}`:""}${no}`):ro.numbers.map(no=>this.getSuffix(eo,no,to)):[]}getSuffix(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const no=this.getRule(eo,ro);return no?this.shouldUseIntlApi()?`${this.options.prepend}${ro.ordinal?`ordinal${this.options.prepend}`:""}${no.select(to)}`:this.getSuffixRetroCompatible(no,to):(this.logger.warn(`no plural rule found for: ${eo}`),"")}getSuffixRetroCompatible(eo,to){const ro=eo.noAbs?eo.plurals(to):eo.plurals(Math.abs(to));let no=eo.numbers[ro];this.options.simplifyPluralSuffix&&eo.numbers.length===2&&eo.numbers[0]===1&&(no===2?no="plural":no===1&&(no=""));const io=()=>this.options.prepend&&no.toString()?this.options.prepend+no.toString():no.toString();return this.options.compatibilityJSON==="v1"?no===1?"":typeof no=="number"?`_plural_${no.toString()}`:io():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&eo.numbers.length===2&&eo.numbers[0]===1?io():this.options.prepend&&ro.toString()?this.options.prepend+ro.toString():ro.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(Xr,eo,to){let ro=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",no=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,io=getPathWithDefaults(Xr,eo,to);return!io&&no&&typeof to=="string"&&(io=deepFind(Xr,to,ro),io===void 0&&(io=deepFind(eo,to,ro))),io}class Interpolator{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=eo,this.format=eo.interpolation&&eo.interpolation.format||(to=>to),this.init(eo)}init(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};eo.interpolation||(eo.interpolation={escapeValue:!0});const to=eo.interpolation;this.escape=to.escape!==void 0?to.escape:escape$1,this.escapeValue=to.escapeValue!==void 0?to.escapeValue:!0,this.useRawValueToEscape=to.useRawValueToEscape!==void 0?to.useRawValueToEscape:!1,this.prefix=to.prefix?regexEscape(to.prefix):to.prefixEscaped||"{{",this.suffix=to.suffix?regexEscape(to.suffix):to.suffixEscaped||"}}",this.formatSeparator=to.formatSeparator?to.formatSeparator:to.formatSeparator||",",this.unescapePrefix=to.unescapeSuffix?"":to.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":to.unescapeSuffix||"",this.nestingPrefix=to.nestingPrefix?regexEscape(to.nestingPrefix):to.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=to.nestingSuffix?regexEscape(to.nestingSuffix):to.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=to.nestingOptionsSeparator?to.nestingOptionsSeparator:to.nestingOptionsSeparator||",",this.maxReplaces=to.maxReplaces?to.maxReplaces:1e3,this.alwaysFormat=to.alwaysFormat!==void 0?to.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const eo=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(eo,"g");const to=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(to,"g");const ro=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(ro,"g")}interpolate(eo,to,ro,no){let io,oo,ao;const so=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function co(bo){return bo.replace(/\$/g,"$$$$")}const lo=bo=>{if(bo.indexOf(this.formatSeparator)<0){const Co=deepFindWithDefaults(to,so,bo,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(Co,void 0,ro,{...no,...to,interpolationkey:bo}):Co}const wo=bo.split(this.formatSeparator),Eo=wo.shift().trim(),$o=wo.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(to,so,Eo,this.options.keySeparator,this.options.ignoreJSONStructure),$o,ro,{...no,...to,interpolationkey:Eo})};this.resetRegExp();const uo=no&&no.missingInterpolationHandler||this.options.missingInterpolationHandler,ho=no&&no.interpolation&&no.interpolation.skipOnVariables!==void 0?no.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:bo=>co(bo)},{regex:this.regexp,safeValue:bo=>this.escapeValue?co(this.escape(bo)):co(bo)}].forEach(bo=>{for(ao=0;io=bo.regex.exec(eo);){const wo=io[1].trim();if(oo=lo(wo),oo===void 0)if(typeof uo=="function"){const $o=uo(eo,io,no);oo=typeof $o=="string"?$o:""}else if(no&&Object.prototype.hasOwnProperty.call(no,wo))oo="";else if(ho){oo=io[0];continue}else this.logger.warn(`missed to pass in variable ${wo} for interpolating ${eo}`),oo="";else typeof oo!="string"&&!this.useRawValueToEscape&&(oo=makeString(oo));const Eo=bo.safeValue(oo);if(eo=eo.replace(io[0],Eo),ho?(bo.regex.lastIndex+=oo.length,bo.regex.lastIndex-=io[0].length):bo.regex.lastIndex=0,ao++,ao>=this.maxReplaces)break}}),eo}nest(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},no,io,oo;function ao(so,co){const lo=this.nestingOptionsSeparator;if(so.indexOf(lo)<0)return so;const uo=so.split(new RegExp(`${lo}[ ]*{`));let ho=`{${uo[1]}`;so=uo[0],ho=this.interpolate(ho,oo);const go=ho.match(/'/g),bo=ho.match(/"/g);(go&&go.length%2===0&&!bo||bo.length%2!==0)&&(ho=ho.replace(/'/g,'"'));try{oo=JSON.parse(ho),co&&(oo={...co,...oo})}catch(wo){return this.logger.warn(`failed parsing options string in nesting for key ${so}`,wo),`${so}${lo}${ho}`}return delete oo.defaultValue,so}for(;no=this.nestingRegexp.exec(eo);){let so=[];oo={...ro},oo=oo.replace&&typeof oo.replace!="string"?oo.replace:oo,oo.applyPostProcessor=!1,delete oo.defaultValue;let co=!1;if(no[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(no[1])){const lo=no[1].split(this.formatSeparator).map(uo=>uo.trim());no[1]=lo.shift(),so=lo,co=!0}if(io=to(ao.call(this,no[1].trim(),oo),oo),io&&no[0]===eo&&typeof io!="string")return io;typeof io!="string"&&(io=makeString(io)),io||(this.logger.warn(`missed to resolve ${no[1]} for nesting ${eo}`),io=""),co&&(io=so.reduce((lo,uo)=>this.format(lo,uo,ro.lng,{...ro,interpolationkey:no[1].trim()}),io.trim())),eo=eo.replace(no[0],io),this.regexp.lastIndex=0}return eo}}function parseFormatStr(Xr){let eo=Xr.toLowerCase().trim();const to={};if(Xr.indexOf("(")>-1){const ro=Xr.split("(");eo=ro[0].toLowerCase().trim();const no=ro[1].substring(0,ro[1].length-1);eo==="currency"&&no.indexOf(":")<0?to.currency||(to.currency=no.trim()):eo==="relativetime"&&no.indexOf(":")<0?to.range||(to.range=no.trim()):no.split(";").forEach(oo=>{if(!oo)return;const[ao,...so]=oo.split(":"),co=so.join(":").trim().replace(/^'+|'+$/g,"");to[ao.trim()]||(to[ao.trim()]=co),co==="false"&&(to[ao.trim()]=!1),co==="true"&&(to[ao.trim()]=!0),isNaN(co)||(to[ao.trim()]=parseInt(co,10))})}return{formatName:eo,formatOptions:to}}function createCachedFormatter(Xr){const eo={};return function(ro,no,io){const oo=no+JSON.stringify(io);let ao=eo[oo];return ao||(ao=Xr(getCleanedCode(no),io),eo[oo]=ao),ao(ro)}}class Formatter{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=eo,this.formats={number:createCachedFormatter((to,ro)=>{const no=new Intl.NumberFormat(to,{...ro});return io=>no.format(io)}),currency:createCachedFormatter((to,ro)=>{const no=new Intl.NumberFormat(to,{...ro,style:"currency"});return io=>no.format(io)}),datetime:createCachedFormatter((to,ro)=>{const no=new Intl.DateTimeFormat(to,{...ro});return io=>no.format(io)}),relativetime:createCachedFormatter((to,ro)=>{const no=new Intl.RelativeTimeFormat(to,{...ro});return io=>no.format(io,ro.range||"day")}),list:createCachedFormatter((to,ro)=>{const no=new Intl.ListFormat(to,{...ro});return io=>no.format(io)})},this.init(eo)}init(eo){const ro=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=ro.formatSeparator?ro.formatSeparator:ro.formatSeparator||","}add(eo,to){this.formats[eo.toLowerCase().trim()]=to}addCached(eo,to){this.formats[eo.toLowerCase().trim()]=createCachedFormatter(to)}format(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return to.split(this.formatSeparator).reduce((ao,so)=>{const{formatName:co,formatOptions:lo}=parseFormatStr(so);if(this.formats[co]){let uo=ao;try{const ho=no&&no.formatParams&&no.formatParams[no.interpolationkey]||{},go=ho.locale||ho.lng||no.locale||no.lng||ro;uo=this.formats[co](ao,go,{...lo,...no,...ho})}catch(ho){this.logger.warn(ho)}return uo}else this.logger.warn(`there was no format function for ${co}`);return ao},eo)}}function removePending(Xr,eo){Xr.pending[eo]!==void 0&&(delete Xr.pending[eo],Xr.pendingCount--)}class Connector extends EventEmitter$2{constructor(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=eo,this.store=to,this.services=ro,this.languageUtils=ro.languageUtils,this.options=no,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=no.maxParallelReads||10,this.readingCalls=0,this.maxRetries=no.maxRetries>=0?no.maxRetries:5,this.retryTimeout=no.retryTimeout>=1?no.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(ro,no.backend,no)}queueLoad(eo,to,ro,no){const io={},oo={},ao={},so={};return eo.forEach(co=>{let lo=!0;to.forEach(uo=>{const ho=`${co}|${uo}`;!ro.reload&&this.store.hasResourceBundle(co,uo)?this.state[ho]=2:this.state[ho]<0||(this.state[ho]===1?oo[ho]===void 0&&(oo[ho]=!0):(this.state[ho]=1,lo=!1,oo[ho]===void 0&&(oo[ho]=!0),io[ho]===void 0&&(io[ho]=!0),so[uo]===void 0&&(so[uo]=!0)))}),lo||(ao[co]=!0)}),(Object.keys(io).length||Object.keys(oo).length)&&this.queue.push({pending:oo,pendingCount:Object.keys(oo).length,loaded:{},errors:[],callback:no}),{toLoad:Object.keys(io),pending:Object.keys(oo),toLoadLanguages:Object.keys(ao),toLoadNamespaces:Object.keys(so)}}loaded(eo,to,ro){const no=eo.split("|"),io=no[0],oo=no[1];to&&this.emit("failedLoading",io,oo,to),ro&&this.store.addResourceBundle(io,oo,ro),this.state[eo]=to?-1:2;const ao={};this.queue.forEach(so=>{pushPath(so.loaded,[io],oo),removePending(so,eo),to&&so.errors.push(to),so.pendingCount===0&&!so.done&&(Object.keys(so.loaded).forEach(co=>{ao[co]||(ao[co]={});const lo=so.loaded[co];lo.length&&lo.forEach(uo=>{ao[co][uo]===void 0&&(ao[co][uo]=!0)})}),so.done=!0,so.errors.length?so.callback(so.errors):so.callback())}),this.emit("loaded",ao),this.queue=this.queue.filter(so=>!so.done)}read(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,io=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,oo=arguments.length>5?arguments[5]:void 0;if(!eo.length)return oo(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:eo,ns:to,fcName:ro,tried:no,wait:io,callback:oo});return}this.readingCalls++;const ao=(co,lo)=>{if(this.readingCalls--,this.waitingReads.length>0){const uo=this.waitingReads.shift();this.read(uo.lng,uo.ns,uo.fcName,uo.tried,uo.wait,uo.callback)}if(co&&lo&&no{this.read.call(this,eo,to,ro,no+1,io*2,oo)},io);return}oo(co,lo)},so=this.backend[ro].bind(this.backend);if(so.length===2){try{const co=so(eo,to);co&&typeof co.then=="function"?co.then(lo=>ao(null,lo)).catch(ao):ao(null,co)}catch(co){ao(co)}return}return so(eo,to,ao)}prepareLoading(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},no=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),no&&no();typeof eo=="string"&&(eo=this.languageUtils.toResolveHierarchy(eo)),typeof to=="string"&&(to=[to]);const io=this.queueLoad(eo,to,ro,no);if(!io.toLoad.length)return io.pending.length||no(),null;io.toLoad.forEach(oo=>{this.loadOne(oo)})}load(eo,to,ro){this.prepareLoading(eo,to,{},ro)}reload(eo,to,ro){this.prepareLoading(eo,to,{reload:!0},ro)}loadOne(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const ro=eo.split("|"),no=ro[0],io=ro[1];this.read(no,io,"read",void 0,void 0,(oo,ao)=>{oo&&this.logger.warn(`${to}loading namespace ${io} for language ${no} failed`,oo),!oo&&ao&&this.logger.log(`${to}loaded namespace ${io} for language ${no}`,ao),this.loaded(eo,oo,ao)})}saveMissing(eo,to,ro,no,io){let oo=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},ao=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(to)){this.logger.warn(`did not save key "${ro}" as the namespace "${to}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(ro==null||ro==="")){if(this.backend&&this.backend.create){const so={...oo,isUpdate:io},co=this.backend.create.bind(this.backend);if(co.length<6)try{let lo;co.length===5?lo=co(eo,to,ro,no,so):lo=co(eo,to,ro,no),lo&&typeof lo.then=="function"?lo.then(uo=>ao(null,uo)).catch(ao):ao(null,lo)}catch(lo){ao(lo)}else co(eo,to,ro,no,ao,so)}!eo||!eo[0]||this.store.addResource(eo[0],to,ro,no)}}}function get$7(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(eo){let to={};if(typeof eo[1]=="object"&&(to=eo[1]),typeof eo[1]=="string"&&(to.defaultValue=eo[1]),typeof eo[2]=="string"&&(to.tDescription=eo[2]),typeof eo[2]=="object"||typeof eo[3]=="object"){const ro=eo[3]||eo[2];Object.keys(ro).forEach(no=>{to[no]=ro[no]})}return to},interpolation:{escapeValue:!0,format:(Xr,eo,to,ro)=>Xr,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(Xr){return typeof Xr.ns=="string"&&(Xr.ns=[Xr.ns]),typeof Xr.fallbackLng=="string"&&(Xr.fallbackLng=[Xr.fallbackLng]),typeof Xr.fallbackNS=="string"&&(Xr.fallbackNS=[Xr.fallbackNS]),Xr.supportedLngs&&Xr.supportedLngs.indexOf("cimode")<0&&(Xr.supportedLngs=Xr.supportedLngs.concat(["cimode"])),Xr}function noop$6(){}function bindMemberFunctions(Xr){Object.getOwnPropertyNames(Object.getPrototypeOf(Xr)).forEach(to=>{typeof Xr[to]=="function"&&(Xr[to]=Xr[to].bind(Xr))})}class I18n extends EventEmitter$2{constructor(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(eo),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),to&&!this.isInitialized&&!eo.isClone){if(!this.options.initImmediate)return this.init(eo,to),this;setTimeout(()=>{this.init(eo,to)},0)}}init(){var eo=this;let to=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ro=arguments.length>1?arguments[1]:void 0;typeof to=="function"&&(ro=to,to={}),!to.defaultNS&&to.defaultNS!==!1&&to.ns&&(typeof to.ns=="string"?to.defaultNS=to.ns:to.ns.indexOf("translation")<0&&(to.defaultNS=to.ns[0]));const no=get$7();this.options={...no,...this.options,...transformOptions(to)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...no.interpolation,...this.options.interpolation}),to.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=to.keySeparator),to.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=to.nsSeparator);function io(lo){return lo?typeof lo=="function"?new lo:lo:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(io(this.modules.logger),this.options):baseLogger.init(null,this.options);let lo;this.modules.formatter?lo=this.modules.formatter:typeof Intl<"u"&&(lo=Formatter);const uo=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const ho=this.services;ho.logger=baseLogger,ho.resourceStore=this.store,ho.languageUtils=uo,ho.pluralResolver=new PluralResolver(uo,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),lo&&(!this.options.interpolation.format||this.options.interpolation.format===no.interpolation.format)&&(ho.formatter=io(lo),ho.formatter.init(ho,this.options),this.options.interpolation.format=ho.formatter.format.bind(ho.formatter)),ho.interpolator=new Interpolator(this.options),ho.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},ho.backendConnector=new Connector(io(this.modules.backend),ho.resourceStore,ho,this.options),ho.backendConnector.on("*",function(go){for(var bo=arguments.length,wo=new Array(bo>1?bo-1:0),Eo=1;Eo1?bo-1:0),Eo=1;Eo{go.init&&go.init(this)})}if(this.format=this.options.interpolation.format,ro||(ro=noop$6),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const lo=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);lo.length>0&&lo[0]!=="dev"&&(this.options.lng=lo[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(lo=>{this[lo]=function(){return eo.store[lo](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(lo=>{this[lo]=function(){return eo.store[lo](...arguments),eo}});const so=defer(),co=()=>{const lo=(uo,ho)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),so.resolve(ho),ro(uo,ho)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return lo(null,this.t.bind(this));this.changeLanguage(this.options.lng,lo)};return this.options.resources||!this.options.initImmediate?co():setTimeout(co,0),so}loadResources(eo){let ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$6;const no=typeof eo=="string"?eo:this.language;if(typeof eo=="function"&&(ro=eo),!this.options.resources||this.options.partialBundledLanguages){if(no&&no.toLowerCase()==="cimode")return ro();const io=[],oo=ao=>{if(!ao)return;this.services.languageUtils.toResolveHierarchy(ao).forEach(co=>{io.indexOf(co)<0&&io.push(co)})};no?oo(no):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(so=>oo(so)),this.options.preload&&this.options.preload.forEach(ao=>oo(ao)),this.services.backendConnector.load(io,this.options.ns,ao=>{!ao&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),ro(ao)})}else ro(null)}reloadResources(eo,to,ro){const no=defer();return eo||(eo=this.languages),to||(to=this.options.ns),ro||(ro=noop$6),this.services.backendConnector.reload(eo,to,io=>{no.resolve(),ro(io)}),no}use(eo){if(!eo)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!eo.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return eo.type==="backend"&&(this.modules.backend=eo),(eo.type==="logger"||eo.log&&eo.warn&&eo.error)&&(this.modules.logger=eo),eo.type==="languageDetector"&&(this.modules.languageDetector=eo),eo.type==="i18nFormat"&&(this.modules.i18nFormat=eo),eo.type==="postProcessor"&&postProcessor.addPostProcessor(eo),eo.type==="formatter"&&(this.modules.formatter=eo),eo.type==="3rdParty"&&this.modules.external.push(eo),this}setResolvedLanguage(eo){if(!(!eo||!this.languages)&&!(["cimode","dev"].indexOf(eo)>-1))for(let to=0;to-1)&&this.store.hasLanguageSomeTranslations(ro)){this.resolvedLanguage=ro;break}}}changeLanguage(eo,to){var ro=this;this.isLanguageChangingTo=eo;const no=defer();this.emit("languageChanging",eo);const io=so=>{this.language=so,this.languages=this.services.languageUtils.toResolveHierarchy(so),this.resolvedLanguage=void 0,this.setResolvedLanguage(so)},oo=(so,co)=>{co?(io(co),this.translator.changeLanguage(co),this.isLanguageChangingTo=void 0,this.emit("languageChanged",co),this.logger.log("languageChanged",co)):this.isLanguageChangingTo=void 0,no.resolve(function(){return ro.t(...arguments)}),to&&to(so,function(){return ro.t(...arguments)})},ao=so=>{!eo&&!so&&this.services.languageDetector&&(so=[]);const co=typeof so=="string"?so:this.services.languageUtils.getBestMatchFromCodes(so);co&&(this.language||io(co),this.translator.language||this.translator.changeLanguage(co),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(co)),this.loadResources(co,lo=>{oo(lo,co)})};return!eo&&this.services.languageDetector&&!this.services.languageDetector.async?ao(this.services.languageDetector.detect()):!eo&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(ao):this.services.languageDetector.detect(ao):ao(eo),no}getFixedT(eo,to,ro){var no=this;const io=function(oo,ao){let so;if(typeof ao!="object"){for(var co=arguments.length,lo=new Array(co>2?co-2:0),uo=2;uo`${so.keyPrefix}${ho}${bo}`):go=so.keyPrefix?`${so.keyPrefix}${ho}${oo}`:oo,no.t(go,so)};return typeof eo=="string"?io.lng=eo:io.lngs=eo,io.ns=to,io.keyPrefix=ro,io}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(eo){this.options.defaultNS=eo}hasLoadedNamespace(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const ro=to.lng||this.resolvedLanguage||this.languages[0],no=this.options?this.options.fallbackLng:!1,io=this.languages[this.languages.length-1];if(ro.toLowerCase()==="cimode")return!0;const oo=(ao,so)=>{const co=this.services.backendConnector.state[`${ao}|${so}`];return co===-1||co===2};if(to.precheck){const ao=to.precheck(this,oo);if(ao!==void 0)return ao}return!!(this.hasResourceBundle(ro,eo)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||oo(ro,eo)&&(!no||oo(io,eo)))}loadNamespaces(eo,to){const ro=defer();return this.options.ns?(typeof eo=="string"&&(eo=[eo]),eo.forEach(no=>{this.options.ns.indexOf(no)<0&&this.options.ns.push(no)}),this.loadResources(no=>{ro.resolve(),to&&to(no)}),ro):(to&&to(),Promise.resolve())}loadLanguages(eo,to){const ro=defer();typeof eo=="string"&&(eo=[eo]);const no=this.options.preload||[],io=eo.filter(oo=>no.indexOf(oo)<0);return io.length?(this.options.preload=no.concat(io),this.loadResources(oo=>{ro.resolve(),to&&to(oo)}),ro):(to&&to(),Promise.resolve())}dir(eo){if(eo||(eo=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!eo)return"rtl";const to=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],ro=this.services&&this.services.languageUtils||new LanguageUtil(get$7());return to.indexOf(ro.getLanguagePartFromCode(eo))>-1||eo.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1?arguments[1]:void 0;return new I18n(eo,to)}cloneInstance(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$6;const ro=eo.forkResourceStore;ro&&delete eo.forkResourceStore;const no={...this.options,...eo,isClone:!0},io=new I18n(no);return(eo.debug!==void 0||eo.prefix!==void 0)&&(io.logger=io.logger.clone(eo)),["store","services","language"].forEach(ao=>{io[ao]=this[ao]}),io.services={...this.services},io.services.utils={hasLoadedNamespace:io.hasLoadedNamespace.bind(io)},ro&&(io.store=new ResourceStore(this.store.data,no),io.services.resourceStore=io.store),io.translator=new Translator(io.services,no),io.translator.on("*",function(ao){for(var so=arguments.length,co=new Array(so>1?so-1:0),lo=1;lo{if(typeof Xr!="object"||typeof eo!="object")return eo;const to=Object.assign({},Xr);for(const ro in eo)Object.prototype.hasOwnProperty.call(eo,ro)&&(typeof eo[ro]=="object"&&Object.prototype.hasOwnProperty.call(Xr,ro)&&typeof Xr[ro]=="object"?to[ro]=deepMerge(Xr[ro],eo[ro]):to[ro]=eo[ro]);return to};class Locale{static setResources(eo){if(Locale.__resources__)return;if(!eo){Locale.__resources__={en:{translation}};return}const to={};Object.keys(eo).forEach(ro=>{const no=Object.assign({},translation);to[ro]={translation:deepMerge(no,eo[ro])}}),Locale.__resources__=to}static setup(eo){if(Locale.__initialized__&&Locale.__i18nInstance__)return Locale.__i18nInstance__;Locale.setResources(eo);const to=instance$3.createInstance();return to.use(initReactI18next).init({fallbackLng:"en",interpolation:{escapeValue:!1},lng:"en",resources:Locale.getResources()}),Locale.__i18nInstance__=to,Locale.__initialized__=!0,Locale.__i18nInstance__}static getInstance(){if(Locale.__initialized__||this.setup(),!Locale.__i18nInstance__||!Locale.__initialized__)throw new Error("Locale is not initialized");return Locale.__i18nInstance__}}Locale.__i18nInstance__=null;Locale.__initialized__=!1;Locale.getResources=()=>Locale.__resources__;const getMinAuthToken$1=()=>{if(typeof window>"u")return;const Xr=StorageService.getItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]});if(!(!Xr||isMinAuthTokenExpired$1(Xr)))return Xr},isCookieEnabled$1=()=>{var Xr,eo,to,ro;if(PlatformService.isNativeMobile)return!1;const no=(eo=(Xr=getProjectSettings())===null||Xr===void 0?void 0:Xr.settings)===null||eo===void 0?void 0:eo.security;if(!no)return!1;const io=(((to=no.auth)===null||to===void 0?void 0:to.storage)||[]).includes(AuthStorageEnum.Cookie),oo=!!(!((ro=no.externalAuth)===null||ro===void 0)&&ro.cookieName);return io||oo},sdkApi$1=({customHeaders:Xr}={})=>{const eo={basePath:ApiEndpoint$1.getBaseUrl(),headers:Object.assign({"Content-Type":"application/json"},Xr)},to=getMinAuthToken$1();to&&(eo.headers.Authorization=`Bearer ${to}`);const ro=isCookieEnabled$1()?"include":void 0;return eo.headers["x-dyn-version"]=`WalletKit/${VERSION$4}`,eo.headers["x-dyn-api-version"]=`API/${API_VERSION$2}`,new SDKApi(new Configuration(Object.assign(Object.assign({},eo),{credentials:ro,fetchApi:FetchService.fetch})))},fetchProjectSettings=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{return yield sdkApi$1().getEnvironmentSettings({environmentId:Xr,sdkVersion:`WalletKit/${VERSION$4}`},{credentials:"omit"})}catch(eo){logger$8.error(eo);return}}),sendDynamicProps=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const{dynamicContextProps:to,dynamicWagmiSettings:ro,frameworkSettings:no}=eo;to&&(yield sendDynamicContextSettings(Xr,{dynamicContextProps:to,frameworkSettings:no},isDynamicContextSessionSettingExpired,setDynamicContextSessionSettings)),ro&&(yield sendDynamicContextSettings(Xr,{dynamicWagmiSettings:ro},isWagmiSessionSettingExpired,setWagmiSessionSettings))}catch(to){logger$8.warn("Error caught when sending sdkSettings to api. Please notify Dynamic, and send the DynamicContextProvider settings you currently have configured",{error:to})}}),sendDynamicContextSettings=(Xr,eo,to,ro)=>__awaiter$j(void 0,void 0,void 0,function*(){to()&&(yield sdkApi$1().logDynamicSdkSettings({environmentId:Xr,sdkSettingsRequest:eo}),ro())}),AccessDeniedContext=reactExports.createContext(void 0),AccessDeniedContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(""),[ro,no]=reactExports.useState(""),[io,oo]=reactExports.useState(void 0),ao=reactExports.useMemo(()=>({deniedAddress:ro,deniedOauthProvider:io,deniedOauthUsername:eo,setDeniedAddress:no,setDeniedOauthProvider:oo,setDeniedOauthUsername:to}),[ro,io,eo]);return jsxRuntimeExports.jsx(AccessDeniedContext.Provider,{value:ao,children:Xr})},useAccessDeniedContext=()=>{const Xr=reactExports.useContext(AccessDeniedContext);if(Xr===void 0)throw new Error("usage of useAccessDeniedContext not wrapped in `AccessDeniedContextProvider`.");return Xr},AccountExistsContext=reactExports.createContext(void 0),AccountExistsContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(),ro=reactExports.useMemo(()=>({existentAccountData:eo,setExistentAccountData:to}),[eo,to]);return jsxRuntimeExports.jsx(AccountExistsContext.Provider,{value:ro,children:Xr})},useAccountExistsContext=()=>{const Xr=reactExports.useContext(AccountExistsContext);if(Xr===void 0)throw new Error("usage of useAccountExistsContext not wrapped in `AccountExistsContextProvider`.");return Xr},UserWalletsContext=reactExports.createContext(void 0),UserWalletsProvider=({children:Xr})=>{const[eo,to]=reactExports.useState([]),ro=reactExports.useRef([]),no=reactExports.useRef([]),io=reactExports.useCallback(oo=>{to(ao=>{const so=oo(ao);return ro.current.forEach(co=>{const lo=so.find(({id:uo})=>uo===co);lo&&dynamicEvents.emit("walletAdded",lo,so)}),no.current.forEach(co=>{const lo=ao.find(({id:uo})=>uo===co);lo&&dynamicEvents.emit("walletRemoved",lo,so)}),ro.current=[],no.current=[],so})},[]);return jsxRuntimeExports.jsx(UserWalletsContext.Provider,{value:{addedWalletsIds:ro,registerUserWallet:oo=>io(ao=>[...ao,oo]),removeUserWallet:oo=>io(ao=>ao.filter(({id:so})=>oo!==so)),removedWalletsIds:no,setUserWallets:io,userWallets:eo},children:Xr})},useInternalUserWallets=()=>{const Xr=reactExports.useContext(UserWalletsContext);if(!Xr)throw new Error("Can only call useInternalUserWallets inside UserWalletsProvider");return Xr},useUserWallets=()=>{const Xr=reactExports.useContext(UserWalletsContext);if(!Xr)throw new Error("Can only call useUserWallets inside UserWalletsProvider");return Xr.userWallets},VerificationContext=reactExports.createContext(void 0),VerificationProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(void 0),[ro,no]=reactExports.useState(void 0),[io,oo]=reactExports.useState(void 0),ao=reactExports.useMemo(()=>({displayedDestination:eo,retryData:io,setDisplayedDestination:to,setRetryData:oo,setVerificationUUID:no,verificationUUID:ro}),[eo,io,ro]);return jsxRuntimeExports.jsx(VerificationContext.Provider,{value:ao,children:Xr})},useVerification=()=>{const Xr=reactExports.useContext(VerificationContext);if(Xr===void 0)throw new Error("usage of useVerification not wrapped in `VerificationProvider`.");return Xr},WalletContext=reactExports.createContext(void 0),WalletContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(!1),ro=reactExports.useMemo(()=>({isLoadingEmbeddedWallet:eo,setIsLoadingEmbeddedWallet:to}),[eo]);return jsxRuntimeExports.jsx(WalletContext.Provider,{value:ro,children:Xr})},useWalletContext=()=>{const Xr=reactExports.useContext(WalletContext);if(Xr===void 0)throw new Error("usage of useWalletContext not wrapped in `WalletContextProvider`.");return Xr},iframeContainerId$2="dyn-secure-enclave-container-id",iframeElementId$2="dyn-secure-enclave-element-id",revealIframeContainerId="dyn-secure-enclave-export-container-id",revealIframeElementId="dyn-secure-enclave-export-element-id";var EmbeddedWalletVersion;(function(Xr){Xr.V1="V1",Xr.V2="V2"})(EmbeddedWalletVersion||(EmbeddedWalletVersion={}));const isPromise$1=Xr=>Xr instanceof Promise,resolveFetcher=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,{retries:no},io){const oo=no?no+1:1;let ao=0,so,co;for(;ao{const to=reactExports.useRef(new Date().getTime()),{deps:ro=[],initialData:no=void 0,enabled:io=!0,retries:oo=0,onBeforeFetch:ao=()=>{},onReject:so=()=>{},onResolve:co=()=>{}}=eo||{},[lo,uo]=reactExports.useState(no),[ho,go]=reactExports.useState(io),[bo,wo]=reactExports.useState(void 0),Eo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const $o=new Date().getTime();return $o-to.current<5&&logger$8.logVerboseTroubleshootingMessage("usePromise: Fetcher function was called in very quick succession. Please make sure the fetcher function is not synchronous and that you are not calling it inside a loop.",ro),to.current=$o,go(!0),ao(),resolveFetcher(Xr,{retries:oo},(Ro,Oo)=>{if($o===to.current){if(Ro){logger$8.error(Ro),wo(Ro),so==null||so(Ro);return}uo(Oo),co==null||co(Oo)}}).finally(()=>go(!1))}),ro);return reactExports.useEffect(()=>{io&&Eo()},[Eo,io]),reactExports.useMemo(()=>({data:lo,error:bo,isLoading:ho,retrigger:Eo}),[lo,bo,ho,Eo])},isSSR=()=>typeof window>"u",getValueByKey=(Xr,eo)=>Xr[eo],themesData={border:"rounded",brandStyle:"subtle",customColor:"",template:"default",themes:{auto:{colors:{accent_1:"#2C303A",accent_2:"#3C414D",accent_3:"#4C525F",background:"#15181F",border:"1px solid #2C303A",error_1:"rgba(255, 106, 106, 0.2)",error_2:"#FF6A6A",footer:"#2C303A",primary:"#15181F",secondary:"#2C303A",ternary:"#2660FF",textPrimary:"#FFF",textSecondary:"#ACACB9"},name:"auto"},dark:{colors:{accent_1:"#2C303A",accent_2:"#3C414D",accent_3:"#4C525F",background:"#15181F",border:"1px solid #2C303A",error_1:"rgba(255, 106, 106, 0.2)",error_2:"#FF6A6A",footer:"#2C303A",primary:"#15181F",secondary:"#2C303A",ternary:"#2660FF",textPrimary:"#FFF",textSecondary:"#ACACB9"},name:"dark"},light:{colors:{accent_1:"#FFF",accent_2:"#F0F3FF",accent_3:"#E9EDFC",background:"#FFFFFF",border:"1px solid #E9EDFC",error_1:"rgba(255, 70, 70, 0.1)",error_2:"#FF4646",footer:"#F7F9FE",primary:"#F7F7F9",secondary:"#FFFFFF",ternary:"#2660FF",textPrimary:"#404040",textSecondary:"#80858B"},name:"light"}},view:"extended",walletColor:{color:"#1648F9",gradient:"90deg, #1648F9 0%, #4B73FF 100%"}},getThemeConfig=(Xr,eo)=>{const{border:to,brand:ro,view:no,primaryColor:io}=Xr||{},oo=eo||(Xr==null?void 0:Xr.theme)||"light",ao=(Xr==null?void 0:Xr.template)||"default";return Object.assign(Object.assign({},themesData),{border:to||themesData.border,brandStyle:ro||themesData.brandStyle,customColor:io||themesData.customColor,template:ao,theme:getValueByKey(themesData.themes,oo),view:no||themesData.view})},findOrCreateLinkTag=()=>{if(isSSR())return;const Xr=document.querySelector('[data-source="dynamic-theme-cdn"]');if(Xr)return Xr;const eo=document.createElement("link");return document.head.append(eo),eo.dataset.source="dynamic-theme-cdn",eo.rel="stylesheet",eo},findOrCreateStyleTag=()=>{if(isSSR())return;const Xr=document.querySelector('[data-source="dynamic-theme"]');if(Xr)return Xr;const eo=document.createElement("style");return document.head.append(eo),eo.dataset.source="dynamic-theme",eo},buildStylesheet=Xr=>{const{customColor:eo,brandStyle:to}=Xr;return`@layer dynamic-project-environment-theme { #dynamic-widget, #dynamic-modal, .dynamic-shadow-dom { ${[["--dynamic-brand-primary-color",eo],["--dynamic-badge-dot-background",eo],["--dynamic-footer-background-color",to==="bold"?eo:void 0],["--dynamic-footer-icon-color",to==="subtle"?eo:void 0]].filter(([,oo])=>oo!==void 0&&oo!=="").map(([oo,ao])=>`${oo}: ${ao};`).join(` `)} } -}`},ThemeContext=reactExports.createContext(void 0),ThemeContextProvider=({customerTheme:Xr,designSettings:eo,children:to})=>{const[ro,no]=reactExports.useState(Xr||getThemeConfig(eo==null?void 0:eo.modal)),io=reactExports.useRef(findOrCreateLinkTag()),oo=reactExports.useRef(findOrCreateStyleTag()),ao=reactExports.useCallback(vo=>{if(no(vo),isSSR()||io.current===void 0||oo.current===void 0)return;document.body.dataset.dynamicTheme=vo.theme.name,document.body.dataset.dynamicThemeBrand=vo.brandStyle;const wo=vo.template==="default"?"":`https://app.dynamic.xyz/assets/templates/${vo.template}.css`;io.current.href!==wo&&(io.current.href=wo);const Eo=buildStylesheet(vo);oo.current.innerHTML!==Eo&&(oo.current.innerHTML=Eo)},[]),so=reactExports.useCallback((vo,wo)=>{var Eo;const ko=(Eo=themesData.themes)===null||Eo===void 0?void 0:Eo[vo],Ao=Object.assign(Object.assign({},ro),{theme:Object.assign(Object.assign({},ko),{colors:Object.assign(Object.assign({},ko.colors),{ternary:wo??ko.colors.ternary})})});ao(Ao)},[ao,ro]),co=reactExports.useCallback(vo=>ao(Object.assign(Object.assign({},ro),{template:vo})),[ao,ro]),lo=reactExports.useCallback(vo=>ao(Object.assign(Object.assign({},ro),{border:vo})),[ao,ro]),fo=reactExports.useCallback(vo=>ao(Object.assign(Object.assign({},ro),{view:vo})),[ao,ro]),ho=reactExports.useCallback(vo=>ao(Object.assign(Object.assign({},ro),{customColor:vo})),[ao,ro]),go=reactExports.useCallback(vo=>ao(Object.assign(Object.assign({},ro),{brandStyle:vo})),[ao,ro]);reactExports.useEffect(()=>ao(Xr||getThemeConfig(eo==null?void 0:eo.modal)),[Xr,eo==null?void 0:eo.modal,ao]);const yo=reactExports.useMemo(()=>({changeBorder:lo,changeBrandStyle:go,changePrimaryColor:ho,changeTemplate:co,changeTheme:so,changeView:fo,theme:ro}),[ro,lo,go,co,so,ho,fo]);return jsxRuntimeExports.jsx(ThemeContext.Provider,{value:yo,children:to})},useThemeContext=()=>{const Xr=reactExports.useContext(ThemeContext);if(Xr===void 0)throw new Error("useThemeContext must be used within a ThemeContextProvider");return Xr};var map;try{map=Map}catch{}var set$2;try{set$2=Set}catch{}function baseClone$1(Xr,eo,to){if(!Xr||typeof Xr!="object"||typeof Xr=="function")return Xr;if(Xr.nodeType&&"cloneNode"in Xr)return Xr.cloneNode(!0);if(Xr instanceof Date)return new Date(Xr.getTime());if(Xr instanceof RegExp)return new RegExp(Xr);if(Array.isArray(Xr))return Xr.map(clone$1);if(map&&Xr instanceof map)return new Map(Array.from(Xr.entries()));if(set$2&&Xr instanceof set$2)return new Set(Array.from(Xr.values()));if(Xr instanceof Object){eo.push(Xr);var ro=Object.create(Xr);to.push(ro);for(var no in Xr){var io=eo.findIndex(function(oo){return oo===Xr[no]});ro[no]=io>-1?to[io]:baseClone$1(Xr[no],eo,to)}return ro}return Xr}function clone$1(Xr){return baseClone$1(Xr,[],[])}const toString$b=Object.prototype.toString,errorToString=Error.prototype.toString,regExpToString=RegExp.prototype.toString,symbolToString$2=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP=/^Symbol\((.*)\)(.*)$/;function printNumber(Xr){return Xr!=+Xr?"NaN":Xr===0&&1/Xr<0?"-0":""+Xr}function printSimpleValue(Xr,eo=!1){if(Xr==null||Xr===!0||Xr===!1)return""+Xr;const to=typeof Xr;if(to==="number")return printNumber(Xr);if(to==="string")return eo?`"${Xr}"`:Xr;if(to==="function")return"[Function "+(Xr.name||"anonymous")+"]";if(to==="symbol")return symbolToString$2.call(Xr).replace(SYMBOL_REGEXP,"Symbol($1)");const ro=toString$b.call(Xr).slice(8,-1);return ro==="Date"?isNaN(Xr.getTime())?""+Xr:Xr.toISOString(Xr):ro==="Error"||Xr instanceof Error?"["+errorToString.call(Xr)+"]":ro==="RegExp"?regExpToString.call(Xr):null}function printValue(Xr,eo){let to=printSimpleValue(Xr,eo);return to!==null?to:JSON.stringify(Xr,function(ro,no){let io=printSimpleValue(this[ro],eo);return io!==null?io:no},2)}let mixed={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:Xr,type:eo,value:to,originalValue:ro})=>{let no=ro!=null&&ro!==to,io=`${Xr} must be a \`${eo}\` type, but the final value was: \`${printValue(to,!0)}\``+(no?` (cast from the value \`${printValue(ro,!0)}\`).`:".");return to===null&&(io+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),io},defined:"${path} must be defined"},string$5={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number$5={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean$4={isValue:"${path} field must be ${value}"},object$1={noUnknown:"${path} field has unspecified keys: ${unknown}"},array$4={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed,string:string$5,number:number$5,date,object:object$1,array:array$4,boolean:boolean$4});var objectProto$r=Object.prototype,hasOwnProperty$l=objectProto$r.hasOwnProperty;function baseHas$1(Xr,eo){return Xr!=null&&hasOwnProperty$l.call(Xr,eo)}var _baseHas=baseHas$1,isArray$e=Array.isArray,isArray_1=isArray$e,freeGlobal$3=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$3,freeGlobal$2=_freeGlobal,freeSelf$2=typeof self=="object"&&self&&self.Object===Object&&self,root$b=freeGlobal$2||freeSelf$2||Function("return this")(),_root=root$b,root$a=_root,Symbol$7=root$a.Symbol,_Symbol=Symbol$7,Symbol$6=_Symbol,objectProto$q=Object.prototype,hasOwnProperty$k=objectProto$q.hasOwnProperty,nativeObjectToString$3=objectProto$q.toString,symToStringTag$3=Symbol$6?Symbol$6.toStringTag:void 0;function getRawTag$2(Xr){var eo=hasOwnProperty$k.call(Xr,symToStringTag$3),to=Xr[symToStringTag$3];try{Xr[symToStringTag$3]=void 0;var ro=!0}catch{}var no=nativeObjectToString$3.call(Xr);return ro&&(eo?Xr[symToStringTag$3]=to:delete Xr[symToStringTag$3]),no}var _getRawTag=getRawTag$2,objectProto$p=Object.prototype,nativeObjectToString$2=objectProto$p.toString;function objectToString$4(Xr){return nativeObjectToString$2.call(Xr)}var _objectToString=objectToString$4,Symbol$5=_Symbol,getRawTag$1=_getRawTag,objectToString$3=_objectToString,nullTag$1="[object Null]",undefinedTag$1="[object Undefined]",symToStringTag$2=Symbol$5?Symbol$5.toStringTag:void 0;function baseGetTag$6(Xr){return Xr==null?Xr===void 0?undefinedTag$1:nullTag$1:symToStringTag$2&&symToStringTag$2 in Object(Xr)?getRawTag$1(Xr):objectToString$3(Xr)}var _baseGetTag=baseGetTag$6;function isObjectLike$6(Xr){return Xr!=null&&typeof Xr=="object"}var isObjectLike_1=isObjectLike$6,baseGetTag$5=_baseGetTag,isObjectLike$5=isObjectLike_1,symbolTag$4="[object Symbol]";function isSymbol$4(Xr){return typeof Xr=="symbol"||isObjectLike$5(Xr)&&baseGetTag$5(Xr)==symbolTag$4}var isSymbol_1=isSymbol$4,isArray$d=isArray_1,isSymbol$3=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(Xr,eo){if(isArray$d(Xr))return!1;var to=typeof Xr;return to=="number"||to=="symbol"||to=="boolean"||Xr==null||isSymbol$3(Xr)?!0:reIsPlainProp.test(Xr)||!reIsDeepProp.test(Xr)||eo!=null&&Xr in Object(eo)}var _isKey=isKey$3;function isObject$f(Xr){var eo=typeof Xr;return Xr!=null&&(eo=="object"||eo=="function")}var isObject_1=isObject$f,baseGetTag$4=_baseGetTag,isObject$e=isObject_1,asyncTag$1="[object AsyncFunction]",funcTag$5="[object Function]",genTag$3="[object GeneratorFunction]",proxyTag$1="[object Proxy]";function isFunction$5(Xr){if(!isObject$e(Xr))return!1;var eo=baseGetTag$4(Xr);return eo==funcTag$5||eo==genTag$3||eo==asyncTag$1||eo==proxyTag$1}var isFunction_1=isFunction$5,root$9=_root,coreJsData$3=root$9["__core-js_shared__"],_coreJsData=coreJsData$3,coreJsData$2=_coreJsData,maskSrcKey$2=function(){var Xr=/[^.]+$/.exec(coreJsData$2&&coreJsData$2.keys&&coreJsData$2.keys.IE_PROTO||"");return Xr?"Symbol(src)_1."+Xr:""}();function isMasked$3(Xr){return!!maskSrcKey$2&&maskSrcKey$2 in Xr}var _isMasked=isMasked$3,funcProto$5=Function.prototype,funcToString$5=funcProto$5.toString;function toSource$4(Xr){if(Xr!=null){try{return funcToString$5.call(Xr)}catch{}try{return Xr+""}catch{}}return""}var _toSource=toSource$4,isFunction$4=isFunction_1,isMasked$2=_isMasked,isObject$d=isObject_1,toSource$3=_toSource,reRegExpChar$2=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor$2=/^\[object .+?Constructor\]$/,funcProto$4=Function.prototype,objectProto$o=Object.prototype,funcToString$4=funcProto$4.toString,hasOwnProperty$j=objectProto$o.hasOwnProperty,reIsNative$2=RegExp("^"+funcToString$4.call(hasOwnProperty$j).replace(reRegExpChar$2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$3(Xr){if(!isObject$d(Xr)||isMasked$2(Xr))return!1;var eo=isFunction$4(Xr)?reIsNative$2:reIsHostCtor$2;return eo.test(toSource$3(Xr))}var _baseIsNative=baseIsNative$3;function getValue$4(Xr,eo){return Xr==null?void 0:Xr[eo]}var _getValue=getValue$4,baseIsNative$2=_baseIsNative,getValue$3=_getValue;function getNative$9(Xr,eo){var to=getValue$3(Xr,eo);return baseIsNative$2(to)?to:void 0}var _getNative=getNative$9,getNative$8=_getNative,nativeCreate$5=getNative$8(Object,"create"),_nativeCreate=nativeCreate$5,nativeCreate$4=_nativeCreate;function hashClear$2(){this.__data__=nativeCreate$4?nativeCreate$4(null):{},this.size=0}var _hashClear=hashClear$2;function hashDelete$2(Xr){var eo=this.has(Xr)&&delete this.__data__[Xr];return this.size-=eo?1:0,eo}var _hashDelete=hashDelete$2,nativeCreate$3=_nativeCreate,HASH_UNDEFINED$4="__lodash_hash_undefined__",objectProto$n=Object.prototype,hasOwnProperty$i=objectProto$n.hasOwnProperty;function hashGet$2(Xr){var eo=this.__data__;if(nativeCreate$3){var to=eo[Xr];return to===HASH_UNDEFINED$4?void 0:to}return hasOwnProperty$i.call(eo,Xr)?eo[Xr]:void 0}var _hashGet=hashGet$2,nativeCreate$2=_nativeCreate,objectProto$m=Object.prototype,hasOwnProperty$h=objectProto$m.hasOwnProperty;function hashHas$2(Xr){var eo=this.__data__;return nativeCreate$2?eo[Xr]!==void 0:hasOwnProperty$h.call(eo,Xr)}var _hashHas=hashHas$2,nativeCreate$1=_nativeCreate,HASH_UNDEFINED$3="__lodash_hash_undefined__";function hashSet$2(Xr,eo){var to=this.__data__;return this.size+=this.has(Xr)?0:1,to[Xr]=nativeCreate$1&&eo===void 0?HASH_UNDEFINED$3:eo,this}var _hashSet=hashSet$2,hashClear$1=_hashClear,hashDelete$1=_hashDelete,hashGet$1=_hashGet,hashHas$1=_hashHas,hashSet$1=_hashSet;function Hash$4(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1}var _listCacheHas=listCacheHas$2,assocIndexOf$1=_assocIndexOf;function listCacheSet$2(Xr,eo){var to=this.__data__,ro=assocIndexOf$1(to,Xr);return ro<0?(++this.size,to.push([Xr,eo])):to[ro][1]=eo,this}var _listCacheSet=listCacheSet$2,listCacheClear$1=_listCacheClear,listCacheDelete$1=_listCacheDelete,listCacheGet$1=_listCacheGet,listCacheHas$1=_listCacheHas,listCacheSet$1=_listCacheSet;function ListCache$5(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1&&Xr%1==0&&Xr-1&&Xr%1==0&&Xr<=MAX_SAFE_INTEGER$4}var isLength_1=isLength$4,isSymbol$1=isSymbol_1,INFINITY$2=1/0;function toKey$5(Xr){if(typeof Xr=="string"||isSymbol$1(Xr))return Xr;var eo=Xr+"";return eo=="0"&&1/Xr==-INFINITY$2?"-0":eo}var _toKey=toKey$5,castPath$1=_castPath,isArguments$3=isArguments_1,isArray$a=isArray_1,isIndex$2=_isIndex,isLength$3=isLength_1,toKey$4=_toKey;function hasPath$2(Xr,eo,to){eo=castPath$1(eo,Xr);for(var ro=-1,no=eo.length,io=!1;++roXr&&Xr.__isYupSchema__;class Condition{constructor(eo,to){if(this.fn=void 0,this.refs=eo,this.refs=eo,typeof to=="function"){this.fn=to;return}if(!has$1(to,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!to.then&&!to.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:ro,then:no,otherwise:io}=to,oo=typeof ro=="function"?ro:(...ao)=>ao.every(so=>so===ro);this.fn=function(...ao){let so=ao.pop(),co=ao.pop(),lo=oo(...ao)?no:io;if(lo)return typeof lo=="function"?lo(co):co.concat(lo.resolve(so))}}resolve(eo,to){let ro=this.refs.map(io=>io.getValue(to==null?void 0:to.value,to==null?void 0:to.parent,to==null?void 0:to.context)),no=this.fn.apply(eo,ro.concat(eo,to));if(no===void 0||no===eo)return eo;if(!isSchema(no))throw new TypeError("conditions must return a schema object");return no.resolve(to)}}function toArray$1(Xr){return Xr==null?[]:[].concat(Xr)}function _extends$1l(){return _extends$1l=Object.assign||function(Xr){for(var eo=1;eoprintValue(to[io])):typeof eo=="function"?eo(to):eo}static isError(eo){return eo&&eo.name==="ValidationError"}constructor(eo,to,ro,no){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=to,this.path=ro,this.type=no,this.errors=[],this.inner=[],toArray$1(eo).forEach(io=>{ValidationError.isError(io)?(this.errors.push(...io.errors),this.inner=this.inner.concat(io.inner.length?io.inner:io)):this.errors.push(io)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,ValidationError)}}const once$1=Xr=>{let eo=!1;return(...to)=>{eo||(eo=!0,Xr(...to))}};function runTests(Xr,eo){let{endEarly:to,tests:ro,args:no,value:io,errors:oo,sort:ao,path:so}=Xr,co=once$1(eo),lo=ro.length;const fo=[];if(oo=oo||[],!lo)return oo.length?co(new ValidationError(oo,io,so)):co(null,io);for(let ho=0;hoao))return!1;var co=io.get(Xr),lo=io.get(eo);if(co&&lo)return co==eo&&lo==Xr;var fo=-1,ho=!0,go=to&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(io.set(Xr,eo),io.set(eo,Xr);++fo=this._maxSize&&this.clear(),Xr in this._values||this._size++,this._values[Xr]=eo};var SPLIT_REGEX=/[^.^\]^[]+|(?=\[\]|\.\.)/g,DIGIT_REGEX=/^\d+$/,LEAD_DIGIT_REGEX=/^\d/,SPEC_CHAR_REGEX=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,CLEAN_QUOTES_REGEX=/^\s*(['"]?)(.*?)(\1)\s*$/,MAX_CACHE_SIZE=512,pathCache=new Cache(MAX_CACHE_SIZE),setCache=new Cache(MAX_CACHE_SIZE),getCache=new Cache(MAX_CACHE_SIZE),propertyExpr={Cache,split:split$1,normalizePath,setter:function(Xr){var eo=normalizePath(Xr);return setCache.get(Xr)||setCache.set(Xr,function(ro,no){for(var io=0,oo=eo.length,ao=ro;io=0)&&(to[no]=Xr[no]);return to}function createValidation(Xr){function eo(to,ro){let{value:no,path:io="",label:oo,options:ao,originalValue:so,sync:co}=to,lo=_objectWithoutPropertiesLoose$1g(to,["value","path","label","options","originalValue","sync"]);const{name:fo,test:ho,params:go,message:yo}=Xr;let{parent:vo,context:wo}=ao;function Eo(Mo){return Reference$1.isRef(Mo)?Mo.getValue(no,vo,wo):Mo}function ko(Mo={}){const No=mapValues$1(_extends$1k({value:no,originalValue:so,label:oo,path:Mo.path||io},go,Mo.params),Eo),Do=new ValidationError(ValidationError.formatError(Mo.message||yo,No),no,No.path,Mo.type||fo);return Do.params=No,Do}let Ao=_extends$1k({path:io,parent:vo,type:fo,createError:ko,resolve:Eo,options:ao,originalValue:so},lo);if(!co){try{Promise.resolve(ho.call(Ao,no,Ao)).then(Mo=>{ValidationError.isError(Mo)?ro(Mo):Mo?ro(null,Mo):ro(ko())}).catch(ro)}catch(Mo){ro(Mo)}return}let Po;try{var jo;if(Po=ho.call(Ao,no,Ao),typeof((jo=Po)==null?void 0:jo.then)=="function")throw new Error(`Validation test of type: "${Ao.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(Mo){ro(Mo);return}ValidationError.isError(Po)?ro(Po):Po?ro(null,Po):ro(ko())}return eo.OPTIONS=Xr,eo}let trim=Xr=>Xr.substr(0,Xr.length-1).substr(1);function getIn$1(Xr,eo,to,ro=to){let no,io,oo;return eo?(propertyExpr.forEach(eo,(ao,so,co)=>{let lo=so?trim(ao):ao;if(Xr=Xr.resolve({context:ro,parent:no,value:to}),Xr.innerType){let fo=co?parseInt(lo,10):0;if(to&&fo>=to.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${ao}, in the path: ${eo}. because there is no value at that index. `);no=to,to=to&&to[fo],Xr=Xr.innerType}if(!co){if(!Xr.fields||!Xr.fields[lo])throw new Error(`The schema does not contain the path: ${eo}. (failed at: ${oo} which is a type: "${Xr._type}")`);no=to,to=to&&to[lo],Xr=Xr.fields[lo]}io=lo,oo=so?"["+ao+"]":"."+ao}),{schema:Xr,parent:no,parentPath:io}):{parent:no,parentPath:eo,schema:Xr}}class ReferenceSet{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const eo=[];for(const to of this.list)eo.push(to);for(const[,to]of this.refs)eo.push(to.describe());return eo}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(eo){return this.toArray().reduce((to,ro)=>to.concat(Reference$1.isRef(ro)?eo(ro):ro),[])}add(eo){Reference$1.isRef(eo)?this.refs.set(eo.key,eo):this.list.add(eo)}delete(eo){Reference$1.isRef(eo)?this.refs.delete(eo.key):this.list.delete(eo)}clone(){const eo=new ReferenceSet;return eo.list=new Set(this.list),eo.refs=new Map(this.refs),eo}merge(eo,to){const ro=this.clone();return eo.list.forEach(no=>ro.add(no)),eo.refs.forEach(no=>ro.add(no)),to.list.forEach(no=>ro.delete(no)),to.refs.forEach(no=>ro.delete(no)),ro}}function _extends$1j(){return _extends$1j=Object.assign||function(Xr){for(var eo=1;eo{this.typeError(mixed.notType)}),this.type=(eo==null?void 0:eo.type)||"mixed",this.spec=_extends$1j({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},eo==null?void 0:eo.spec)}get _type(){return this.type}_typeCheck(eo){return!0}clone(eo){if(this._mutate)return eo&&Object.assign(this.spec,eo),this;const to=Object.create(Object.getPrototypeOf(this));return to.type=this.type,to._typeError=this._typeError,to._whitelistError=this._whitelistError,to._blacklistError=this._blacklistError,to._whitelist=this._whitelist.clone(),to._blacklist=this._blacklist.clone(),to.exclusiveTests=_extends$1j({},this.exclusiveTests),to.deps=[...this.deps],to.conditions=[...this.conditions],to.tests=[...this.tests],to.transforms=[...this.transforms],to.spec=clone$1(_extends$1j({},this.spec,eo)),to}label(eo){let to=this.clone();return to.spec.label=eo,to}meta(...eo){if(eo.length===0)return this.spec.meta;let to=this.clone();return to.spec.meta=Object.assign(to.spec.meta||{},eo[0]),to}withMutation(eo){let to=this._mutate;this._mutate=!0;let ro=eo(this);return this._mutate=to,ro}concat(eo){if(!eo||eo===this)return this;if(eo.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${eo.type}`);let to=this,ro=eo.clone();const no=_extends$1j({},to.spec,ro.spec);return ro.spec=no,ro._typeError||(ro._typeError=to._typeError),ro._whitelistError||(ro._whitelistError=to._whitelistError),ro._blacklistError||(ro._blacklistError=to._blacklistError),ro._whitelist=to._whitelist.merge(eo._whitelist,eo._blacklist),ro._blacklist=to._blacklist.merge(eo._blacklist,eo._whitelist),ro.tests=to.tests,ro.exclusiveTests=to.exclusiveTests,ro.withMutation(io=>{eo.tests.forEach(oo=>{io.test(oo.OPTIONS)})}),ro.transforms=[...to.transforms,...ro.transforms],ro}isType(eo){return this.spec.nullable&&eo===null?!0:this._typeCheck(eo)}resolve(eo){let to=this;if(to.conditions.length){let ro=to.conditions;to=to.clone(),to.conditions=[],to=ro.reduce((no,io)=>io.resolve(no,eo),to),to=to.resolve(eo)}return to}cast(eo,to={}){let ro=this.resolve(_extends$1j({value:eo},to)),no=ro._cast(eo,to);if(eo!==void 0&&to.assert!==!1&&ro.isType(no)!==!0){let io=printValue(eo),oo=printValue(no);throw new TypeError(`The value of ${to.path||"field"} could not be cast to a value that satisfies the schema type: "${ro._type}". +}`},ThemeContext=reactExports.createContext(void 0),ThemeContextProvider=({customerTheme:Xr,designSettings:eo,children:to})=>{const[ro,no]=reactExports.useState(Xr||getThemeConfig(eo==null?void 0:eo.modal)),io=reactExports.useRef(findOrCreateLinkTag()),oo=reactExports.useRef(findOrCreateStyleTag()),ao=reactExports.useCallback(wo=>{if(no(wo),isSSR()||io.current===void 0||oo.current===void 0)return;document.body.dataset.dynamicTheme=wo.theme.name,document.body.dataset.dynamicThemeBrand=wo.brandStyle;const Eo=wo.template==="default"?"":`https://app.dynamic.xyz/assets/templates/${wo.template}.css`;io.current.href!==Eo&&(io.current.href=Eo);const $o=buildStylesheet(wo);oo.current.innerHTML!==$o&&(oo.current.innerHTML=$o)},[]),so=reactExports.useCallback((wo,Eo)=>{var $o;const Co=($o=themesData.themes)===null||$o===void 0?void 0:$o[wo],Ro=Object.assign(Object.assign({},ro),{theme:Object.assign(Object.assign({},Co),{colors:Object.assign(Object.assign({},Co.colors),{ternary:Eo??Co.colors.ternary})})});ao(Ro)},[ao,ro]),co=reactExports.useCallback(wo=>ao(Object.assign(Object.assign({},ro),{template:wo})),[ao,ro]),lo=reactExports.useCallback(wo=>ao(Object.assign(Object.assign({},ro),{border:wo})),[ao,ro]),uo=reactExports.useCallback(wo=>ao(Object.assign(Object.assign({},ro),{view:wo})),[ao,ro]),ho=reactExports.useCallback(wo=>ao(Object.assign(Object.assign({},ro),{customColor:wo})),[ao,ro]),go=reactExports.useCallback(wo=>ao(Object.assign(Object.assign({},ro),{brandStyle:wo})),[ao,ro]);reactExports.useEffect(()=>ao(Xr||getThemeConfig(eo==null?void 0:eo.modal)),[Xr,eo==null?void 0:eo.modal,ao]);const bo=reactExports.useMemo(()=>({changeBorder:lo,changeBrandStyle:go,changePrimaryColor:ho,changeTemplate:co,changeTheme:so,changeView:uo,theme:ro}),[ro,lo,go,co,so,ho,uo]);return jsxRuntimeExports.jsx(ThemeContext.Provider,{value:bo,children:to})},useThemeContext=()=>{const Xr=reactExports.useContext(ThemeContext);if(Xr===void 0)throw new Error("useThemeContext must be used within a ThemeContextProvider");return Xr};var map;try{map=Map}catch{}var set$2;try{set$2=Set}catch{}function baseClone$1(Xr,eo,to){if(!Xr||typeof Xr!="object"||typeof Xr=="function")return Xr;if(Xr.nodeType&&"cloneNode"in Xr)return Xr.cloneNode(!0);if(Xr instanceof Date)return new Date(Xr.getTime());if(Xr instanceof RegExp)return new RegExp(Xr);if(Array.isArray(Xr))return Xr.map(clone$1);if(map&&Xr instanceof map)return new Map(Array.from(Xr.entries()));if(set$2&&Xr instanceof set$2)return new Set(Array.from(Xr.values()));if(Xr instanceof Object){eo.push(Xr);var ro=Object.create(Xr);to.push(ro);for(var no in Xr){var io=eo.findIndex(function(oo){return oo===Xr[no]});ro[no]=io>-1?to[io]:baseClone$1(Xr[no],eo,to)}return ro}return Xr}function clone$1(Xr){return baseClone$1(Xr,[],[])}const toString$b=Object.prototype.toString,errorToString=Error.prototype.toString,regExpToString=RegExp.prototype.toString,symbolToString$2=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP=/^Symbol\((.*)\)(.*)$/;function printNumber(Xr){return Xr!=+Xr?"NaN":Xr===0&&1/Xr<0?"-0":""+Xr}function printSimpleValue(Xr,eo=!1){if(Xr==null||Xr===!0||Xr===!1)return""+Xr;const to=typeof Xr;if(to==="number")return printNumber(Xr);if(to==="string")return eo?`"${Xr}"`:Xr;if(to==="function")return"[Function "+(Xr.name||"anonymous")+"]";if(to==="symbol")return symbolToString$2.call(Xr).replace(SYMBOL_REGEXP,"Symbol($1)");const ro=toString$b.call(Xr).slice(8,-1);return ro==="Date"?isNaN(Xr.getTime())?""+Xr:Xr.toISOString(Xr):ro==="Error"||Xr instanceof Error?"["+errorToString.call(Xr)+"]":ro==="RegExp"?regExpToString.call(Xr):null}function printValue(Xr,eo){let to=printSimpleValue(Xr,eo);return to!==null?to:JSON.stringify(Xr,function(ro,no){let io=printSimpleValue(this[ro],eo);return io!==null?io:no},2)}let mixed={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:Xr,type:eo,value:to,originalValue:ro})=>{let no=ro!=null&&ro!==to,io=`${Xr} must be a \`${eo}\` type, but the final value was: \`${printValue(to,!0)}\``+(no?` (cast from the value \`${printValue(ro,!0)}\`).`:".");return to===null&&(io+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),io},defined:"${path} must be defined"},string$5={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number$5={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean$4={isValue:"${path} field must be ${value}"},object$1={noUnknown:"${path} field has unspecified keys: ${unknown}"},array$4={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed,string:string$5,number:number$5,date,object:object$1,array:array$4,boolean:boolean$4});var objectProto$r=Object.prototype,hasOwnProperty$l=objectProto$r.hasOwnProperty;function baseHas$1(Xr,eo){return Xr!=null&&hasOwnProperty$l.call(Xr,eo)}var _baseHas=baseHas$1,isArray$e=Array.isArray,isArray_1=isArray$e,freeGlobal$3=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$3,freeGlobal$2=_freeGlobal,freeSelf$2=typeof self=="object"&&self&&self.Object===Object&&self,root$b=freeGlobal$2||freeSelf$2||Function("return this")(),_root=root$b,root$a=_root,Symbol$7=root$a.Symbol,_Symbol=Symbol$7,Symbol$6=_Symbol,objectProto$q=Object.prototype,hasOwnProperty$k=objectProto$q.hasOwnProperty,nativeObjectToString$3=objectProto$q.toString,symToStringTag$3=Symbol$6?Symbol$6.toStringTag:void 0;function getRawTag$2(Xr){var eo=hasOwnProperty$k.call(Xr,symToStringTag$3),to=Xr[symToStringTag$3];try{Xr[symToStringTag$3]=void 0;var ro=!0}catch{}var no=nativeObjectToString$3.call(Xr);return ro&&(eo?Xr[symToStringTag$3]=to:delete Xr[symToStringTag$3]),no}var _getRawTag=getRawTag$2,objectProto$p=Object.prototype,nativeObjectToString$2=objectProto$p.toString;function objectToString$4(Xr){return nativeObjectToString$2.call(Xr)}var _objectToString=objectToString$4,Symbol$5=_Symbol,getRawTag$1=_getRawTag,objectToString$3=_objectToString,nullTag$1="[object Null]",undefinedTag$1="[object Undefined]",symToStringTag$2=Symbol$5?Symbol$5.toStringTag:void 0;function baseGetTag$6(Xr){return Xr==null?Xr===void 0?undefinedTag$1:nullTag$1:symToStringTag$2&&symToStringTag$2 in Object(Xr)?getRawTag$1(Xr):objectToString$3(Xr)}var _baseGetTag=baseGetTag$6;function isObjectLike$6(Xr){return Xr!=null&&typeof Xr=="object"}var isObjectLike_1=isObjectLike$6,baseGetTag$5=_baseGetTag,isObjectLike$5=isObjectLike_1,symbolTag$4="[object Symbol]";function isSymbol$4(Xr){return typeof Xr=="symbol"||isObjectLike$5(Xr)&&baseGetTag$5(Xr)==symbolTag$4}var isSymbol_1=isSymbol$4,isArray$d=isArray_1,isSymbol$3=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(Xr,eo){if(isArray$d(Xr))return!1;var to=typeof Xr;return to=="number"||to=="symbol"||to=="boolean"||Xr==null||isSymbol$3(Xr)?!0:reIsPlainProp.test(Xr)||!reIsDeepProp.test(Xr)||eo!=null&&Xr in Object(eo)}var _isKey=isKey$3;function isObject$f(Xr){var eo=typeof Xr;return Xr!=null&&(eo=="object"||eo=="function")}var isObject_1=isObject$f,baseGetTag$4=_baseGetTag,isObject$e=isObject_1,asyncTag$1="[object AsyncFunction]",funcTag$5="[object Function]",genTag$3="[object GeneratorFunction]",proxyTag$1="[object Proxy]";function isFunction$5(Xr){if(!isObject$e(Xr))return!1;var eo=baseGetTag$4(Xr);return eo==funcTag$5||eo==genTag$3||eo==asyncTag$1||eo==proxyTag$1}var isFunction_1=isFunction$5,root$9=_root,coreJsData$3=root$9["__core-js_shared__"],_coreJsData=coreJsData$3,coreJsData$2=_coreJsData,maskSrcKey$2=function(){var Xr=/[^.]+$/.exec(coreJsData$2&&coreJsData$2.keys&&coreJsData$2.keys.IE_PROTO||"");return Xr?"Symbol(src)_1."+Xr:""}();function isMasked$3(Xr){return!!maskSrcKey$2&&maskSrcKey$2 in Xr}var _isMasked=isMasked$3,funcProto$5=Function.prototype,funcToString$5=funcProto$5.toString;function toSource$4(Xr){if(Xr!=null){try{return funcToString$5.call(Xr)}catch{}try{return Xr+""}catch{}}return""}var _toSource=toSource$4,isFunction$4=isFunction_1,isMasked$2=_isMasked,isObject$d=isObject_1,toSource$3=_toSource,reRegExpChar$2=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor$2=/^\[object .+?Constructor\]$/,funcProto$4=Function.prototype,objectProto$o=Object.prototype,funcToString$4=funcProto$4.toString,hasOwnProperty$j=objectProto$o.hasOwnProperty,reIsNative$2=RegExp("^"+funcToString$4.call(hasOwnProperty$j).replace(reRegExpChar$2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$3(Xr){if(!isObject$d(Xr)||isMasked$2(Xr))return!1;var eo=isFunction$4(Xr)?reIsNative$2:reIsHostCtor$2;return eo.test(toSource$3(Xr))}var _baseIsNative=baseIsNative$3;function getValue$4(Xr,eo){return Xr==null?void 0:Xr[eo]}var _getValue=getValue$4,baseIsNative$2=_baseIsNative,getValue$3=_getValue;function getNative$9(Xr,eo){var to=getValue$3(Xr,eo);return baseIsNative$2(to)?to:void 0}var _getNative=getNative$9,getNative$8=_getNative,nativeCreate$5=getNative$8(Object,"create"),_nativeCreate=nativeCreate$5,nativeCreate$4=_nativeCreate;function hashClear$2(){this.__data__=nativeCreate$4?nativeCreate$4(null):{},this.size=0}var _hashClear=hashClear$2;function hashDelete$2(Xr){var eo=this.has(Xr)&&delete this.__data__[Xr];return this.size-=eo?1:0,eo}var _hashDelete=hashDelete$2,nativeCreate$3=_nativeCreate,HASH_UNDEFINED$4="__lodash_hash_undefined__",objectProto$n=Object.prototype,hasOwnProperty$i=objectProto$n.hasOwnProperty;function hashGet$2(Xr){var eo=this.__data__;if(nativeCreate$3){var to=eo[Xr];return to===HASH_UNDEFINED$4?void 0:to}return hasOwnProperty$i.call(eo,Xr)?eo[Xr]:void 0}var _hashGet=hashGet$2,nativeCreate$2=_nativeCreate,objectProto$m=Object.prototype,hasOwnProperty$h=objectProto$m.hasOwnProperty;function hashHas$2(Xr){var eo=this.__data__;return nativeCreate$2?eo[Xr]!==void 0:hasOwnProperty$h.call(eo,Xr)}var _hashHas=hashHas$2,nativeCreate$1=_nativeCreate,HASH_UNDEFINED$3="__lodash_hash_undefined__";function hashSet$2(Xr,eo){var to=this.__data__;return this.size+=this.has(Xr)?0:1,to[Xr]=nativeCreate$1&&eo===void 0?HASH_UNDEFINED$3:eo,this}var _hashSet=hashSet$2,hashClear$1=_hashClear,hashDelete$1=_hashDelete,hashGet$1=_hashGet,hashHas$1=_hashHas,hashSet$1=_hashSet;function Hash$4(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1}var _listCacheHas=listCacheHas$2,assocIndexOf$1=_assocIndexOf;function listCacheSet$2(Xr,eo){var to=this.__data__,ro=assocIndexOf$1(to,Xr);return ro<0?(++this.size,to.push([Xr,eo])):to[ro][1]=eo,this}var _listCacheSet=listCacheSet$2,listCacheClear$1=_listCacheClear,listCacheDelete$1=_listCacheDelete,listCacheGet$1=_listCacheGet,listCacheHas$1=_listCacheHas,listCacheSet$1=_listCacheSet;function ListCache$5(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1&&Xr%1==0&&Xr-1&&Xr%1==0&&Xr<=MAX_SAFE_INTEGER$4}var isLength_1=isLength$4,isSymbol$1=isSymbol_1,INFINITY$2=1/0;function toKey$5(Xr){if(typeof Xr=="string"||isSymbol$1(Xr))return Xr;var eo=Xr+"";return eo=="0"&&1/Xr==-INFINITY$2?"-0":eo}var _toKey=toKey$5,castPath$1=_castPath,isArguments$3=isArguments_1,isArray$a=isArray_1,isIndex$2=_isIndex,isLength$3=isLength_1,toKey$4=_toKey;function hasPath$2(Xr,eo,to){eo=castPath$1(eo,Xr);for(var ro=-1,no=eo.length,io=!1;++roXr&&Xr.__isYupSchema__;class Condition{constructor(eo,to){if(this.fn=void 0,this.refs=eo,this.refs=eo,typeof to=="function"){this.fn=to;return}if(!has$1(to,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!to.then&&!to.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:ro,then:no,otherwise:io}=to,oo=typeof ro=="function"?ro:(...ao)=>ao.every(so=>so===ro);this.fn=function(...ao){let so=ao.pop(),co=ao.pop(),lo=oo(...ao)?no:io;if(lo)return typeof lo=="function"?lo(co):co.concat(lo.resolve(so))}}resolve(eo,to){let ro=this.refs.map(io=>io.getValue(to==null?void 0:to.value,to==null?void 0:to.parent,to==null?void 0:to.context)),no=this.fn.apply(eo,ro.concat(eo,to));if(no===void 0||no===eo)return eo;if(!isSchema(no))throw new TypeError("conditions must return a schema object");return no.resolve(to)}}function toArray$1(Xr){return Xr==null?[]:[].concat(Xr)}function _extends$1m(){return _extends$1m=Object.assign||function(Xr){for(var eo=1;eoprintValue(to[io])):typeof eo=="function"?eo(to):eo}static isError(eo){return eo&&eo.name==="ValidationError"}constructor(eo,to,ro,no){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=to,this.path=ro,this.type=no,this.errors=[],this.inner=[],toArray$1(eo).forEach(io=>{ValidationError.isError(io)?(this.errors.push(...io.errors),this.inner=this.inner.concat(io.inner.length?io.inner:io)):this.errors.push(io)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,ValidationError)}}const once$1=Xr=>{let eo=!1;return(...to)=>{eo||(eo=!0,Xr(...to))}};function runTests(Xr,eo){let{endEarly:to,tests:ro,args:no,value:io,errors:oo,sort:ao,path:so}=Xr,co=once$1(eo),lo=ro.length;const uo=[];if(oo=oo||[],!lo)return oo.length?co(new ValidationError(oo,io,so)):co(null,io);for(let ho=0;hoao))return!1;var co=io.get(Xr),lo=io.get(eo);if(co&&lo)return co==eo&&lo==Xr;var uo=-1,ho=!0,go=to&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(io.set(Xr,eo),io.set(eo,Xr);++uo=this._maxSize&&this.clear(),Xr in this._values||this._size++,this._values[Xr]=eo};var SPLIT_REGEX=/[^.^\]^[]+|(?=\[\]|\.\.)/g,DIGIT_REGEX=/^\d+$/,LEAD_DIGIT_REGEX=/^\d/,SPEC_CHAR_REGEX=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,CLEAN_QUOTES_REGEX=/^\s*(['"]?)(.*?)(\1)\s*$/,MAX_CACHE_SIZE=512,pathCache=new Cache(MAX_CACHE_SIZE),setCache=new Cache(MAX_CACHE_SIZE),getCache=new Cache(MAX_CACHE_SIZE),propertyExpr={Cache,split:split$1,normalizePath,setter:function(Xr){var eo=normalizePath(Xr);return setCache.get(Xr)||setCache.set(Xr,function(ro,no){for(var io=0,oo=eo.length,ao=ro;io=0)&&(to[no]=Xr[no]);return to}function createValidation(Xr){function eo(to,ro){let{value:no,path:io="",label:oo,options:ao,originalValue:so,sync:co}=to,lo=_objectWithoutPropertiesLoose$1h(to,["value","path","label","options","originalValue","sync"]);const{name:uo,test:ho,params:go,message:bo}=Xr;let{parent:wo,context:Eo}=ao;function $o(Bo){return Reference$1.isRef(Bo)?Bo.getValue(no,wo,Eo):Bo}function Co(Bo={}){const Mo=mapValues$1(_extends$1l({value:no,originalValue:so,label:oo,path:Bo.path||io},go,Bo.params),$o),Fo=new ValidationError(ValidationError.formatError(Bo.message||bo,Mo),no,Mo.path,Bo.type||uo);return Fo.params=Mo,Fo}let Ro=_extends$1l({path:io,parent:wo,type:uo,createError:Co,resolve:$o,options:ao,originalValue:so},lo);if(!co){try{Promise.resolve(ho.call(Ro,no,Ro)).then(Bo=>{ValidationError.isError(Bo)?ro(Bo):Bo?ro(null,Bo):ro(Co())}).catch(ro)}catch(Bo){ro(Bo)}return}let Oo;try{var jo;if(Oo=ho.call(Ro,no,Ro),typeof((jo=Oo)==null?void 0:jo.then)=="function")throw new Error(`Validation test of type: "${Ro.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(Bo){ro(Bo);return}ValidationError.isError(Oo)?ro(Oo):Oo?ro(null,Oo):ro(Co())}return eo.OPTIONS=Xr,eo}let trim=Xr=>Xr.substr(0,Xr.length-1).substr(1);function getIn$1(Xr,eo,to,ro=to){let no,io,oo;return eo?(propertyExpr.forEach(eo,(ao,so,co)=>{let lo=so?trim(ao):ao;if(Xr=Xr.resolve({context:ro,parent:no,value:to}),Xr.innerType){let uo=co?parseInt(lo,10):0;if(to&&uo>=to.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${ao}, in the path: ${eo}. because there is no value at that index. `);no=to,to=to&&to[uo],Xr=Xr.innerType}if(!co){if(!Xr.fields||!Xr.fields[lo])throw new Error(`The schema does not contain the path: ${eo}. (failed at: ${oo} which is a type: "${Xr._type}")`);no=to,to=to&&to[lo],Xr=Xr.fields[lo]}io=lo,oo=so?"["+ao+"]":"."+ao}),{schema:Xr,parent:no,parentPath:io}):{parent:no,parentPath:eo,schema:Xr}}class ReferenceSet{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const eo=[];for(const to of this.list)eo.push(to);for(const[,to]of this.refs)eo.push(to.describe());return eo}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(eo){return this.toArray().reduce((to,ro)=>to.concat(Reference$1.isRef(ro)?eo(ro):ro),[])}add(eo){Reference$1.isRef(eo)?this.refs.set(eo.key,eo):this.list.add(eo)}delete(eo){Reference$1.isRef(eo)?this.refs.delete(eo.key):this.list.delete(eo)}clone(){const eo=new ReferenceSet;return eo.list=new Set(this.list),eo.refs=new Map(this.refs),eo}merge(eo,to){const ro=this.clone();return eo.list.forEach(no=>ro.add(no)),eo.refs.forEach(no=>ro.add(no)),to.list.forEach(no=>ro.delete(no)),to.refs.forEach(no=>ro.delete(no)),ro}}function _extends$1k(){return _extends$1k=Object.assign||function(Xr){for(var eo=1;eo{this.typeError(mixed.notType)}),this.type=(eo==null?void 0:eo.type)||"mixed",this.spec=_extends$1k({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},eo==null?void 0:eo.spec)}get _type(){return this.type}_typeCheck(eo){return!0}clone(eo){if(this._mutate)return eo&&Object.assign(this.spec,eo),this;const to=Object.create(Object.getPrototypeOf(this));return to.type=this.type,to._typeError=this._typeError,to._whitelistError=this._whitelistError,to._blacklistError=this._blacklistError,to._whitelist=this._whitelist.clone(),to._blacklist=this._blacklist.clone(),to.exclusiveTests=_extends$1k({},this.exclusiveTests),to.deps=[...this.deps],to.conditions=[...this.conditions],to.tests=[...this.tests],to.transforms=[...this.transforms],to.spec=clone$1(_extends$1k({},this.spec,eo)),to}label(eo){let to=this.clone();return to.spec.label=eo,to}meta(...eo){if(eo.length===0)return this.spec.meta;let to=this.clone();return to.spec.meta=Object.assign(to.spec.meta||{},eo[0]),to}withMutation(eo){let to=this._mutate;this._mutate=!0;let ro=eo(this);return this._mutate=to,ro}concat(eo){if(!eo||eo===this)return this;if(eo.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${eo.type}`);let to=this,ro=eo.clone();const no=_extends$1k({},to.spec,ro.spec);return ro.spec=no,ro._typeError||(ro._typeError=to._typeError),ro._whitelistError||(ro._whitelistError=to._whitelistError),ro._blacklistError||(ro._blacklistError=to._blacklistError),ro._whitelist=to._whitelist.merge(eo._whitelist,eo._blacklist),ro._blacklist=to._blacklist.merge(eo._blacklist,eo._whitelist),ro.tests=to.tests,ro.exclusiveTests=to.exclusiveTests,ro.withMutation(io=>{eo.tests.forEach(oo=>{io.test(oo.OPTIONS)})}),ro.transforms=[...to.transforms,...ro.transforms],ro}isType(eo){return this.spec.nullable&&eo===null?!0:this._typeCheck(eo)}resolve(eo){let to=this;if(to.conditions.length){let ro=to.conditions;to=to.clone(),to.conditions=[],to=ro.reduce((no,io)=>io.resolve(no,eo),to),to=to.resolve(eo)}return to}cast(eo,to={}){let ro=this.resolve(_extends$1k({value:eo},to)),no=ro._cast(eo,to);if(eo!==void 0&&to.assert!==!1&&ro.isType(no)!==!0){let io=printValue(eo),oo=printValue(no);throw new TypeError(`The value of ${to.path||"field"} could not be cast to a value that satisfies the schema type: "${ro._type}". attempted value: ${io} -`+(oo!==io?`result of cast: ${oo}`:""))}return no}_cast(eo,to){let ro=eo===void 0?eo:this.transforms.reduce((no,io)=>io.call(this,no,eo,this),eo);return ro===void 0&&(ro=this.getDefault()),ro}_validate(eo,to={},ro){let{sync:no,path:io,from:oo=[],originalValue:ao=eo,strict:so=this.spec.strict,abortEarly:co=this.spec.abortEarly}=to,lo=eo;so||(lo=this._cast(lo,_extends$1j({assert:!1},to)));let fo={value:lo,path:io,options:to,originalValue:ao,schema:this,label:this.spec.label,sync:no,from:oo},ho=[];this._typeError&&ho.push(this._typeError);let go=[];this._whitelistError&&go.push(this._whitelistError),this._blacklistError&&go.push(this._blacklistError),runTests({args:fo,value:lo,path:io,sync:no,tests:ho,endEarly:co},yo=>{if(yo)return void ro(yo,lo);runTests({tests:this.tests.concat(go),args:fo,path:io,sync:no,value:lo,endEarly:co},ro)})}validate(eo,to,ro){let no=this.resolve(_extends$1j({},to,{value:eo}));return typeof ro=="function"?no._validate(eo,to,ro):new Promise((io,oo)=>no._validate(eo,to,(ao,so)=>{ao?oo(ao):io(so)}))}validateSync(eo,to){let ro=this.resolve(_extends$1j({},to,{value:eo})),no;return ro._validate(eo,_extends$1j({},to,{sync:!0}),(io,oo)=>{if(io)throw io;no=oo}),no}isValid(eo,to){return this.validate(eo,to).then(()=>!0,ro=>{if(ValidationError.isError(ro))return!1;throw ro})}isValidSync(eo,to){try{return this.validateSync(eo,to),!0}catch(ro){if(ValidationError.isError(ro))return!1;throw ro}}_getDefault(){let eo=this.spec.default;return eo==null?eo:typeof eo=="function"?eo.call(this):clone$1(eo)}getDefault(eo){return this.resolve(eo||{})._getDefault()}default(eo){return arguments.length===0?this._getDefault():this.clone({default:eo})}strict(eo=!0){let to=this.clone();return to.spec.strict=eo,to}_isPresent(eo){return eo!=null}defined(eo=mixed.defined){return this.test({message:eo,name:"defined",exclusive:!0,test(to){return to!==void 0}})}required(eo=mixed.required){return this.clone({presence:"required"}).withMutation(to=>to.test({message:eo,name:"required",exclusive:!0,test(ro){return this.schema._isPresent(ro)}}))}notRequired(){let eo=this.clone({presence:"optional"});return eo.tests=eo.tests.filter(to=>to.OPTIONS.name!=="required"),eo}nullable(eo=!0){return this.clone({nullable:eo!==!1})}transform(eo){let to=this.clone();return to.transforms.push(eo),to}test(...eo){let to;if(eo.length===1?typeof eo[0]=="function"?to={test:eo[0]}:to=eo[0]:eo.length===2?to={name:eo[0],test:eo[1]}:to={name:eo[0],message:eo[1],test:eo[2]},to.message===void 0&&(to.message=mixed.default),typeof to.test!="function")throw new TypeError("`test` is a required parameters");let ro=this.clone(),no=createValidation(to),io=to.exclusive||to.name&&ro.exclusiveTests[to.name]===!0;if(to.exclusive&&!to.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return to.name&&(ro.exclusiveTests[to.name]=!!to.exclusive),ro.tests=ro.tests.filter(oo=>!(oo.OPTIONS.name===to.name&&(io||oo.OPTIONS.test===no.OPTIONS.test))),ro.tests.push(no),ro}when(eo,to){!Array.isArray(eo)&&typeof eo!="string"&&(to=eo,eo=".");let ro=this.clone(),no=toArray$1(eo).map(io=>new Reference$1(io));return no.forEach(io=>{io.isSibling&&ro.deps.push(io.key)}),ro.conditions.push(new Condition(no,to)),ro}typeError(eo){let to=this.clone();return to._typeError=createValidation({message:eo,name:"typeError",test(ro){return ro!==void 0&&!this.schema.isType(ro)?this.createError({params:{type:this.schema._type}}):!0}}),to}oneOf(eo,to=mixed.oneOf){let ro=this.clone();return eo.forEach(no=>{ro._whitelist.add(no),ro._blacklist.delete(no)}),ro._whitelistError=createValidation({message:to,name:"oneOf",test(no){if(no===void 0)return!0;let io=this.schema._whitelist,oo=io.resolveAll(this.resolve);return oo.includes(no)?!0:this.createError({params:{values:io.toArray().join(", "),resolved:oo}})}}),ro}notOneOf(eo,to=mixed.notOneOf){let ro=this.clone();return eo.forEach(no=>{ro._blacklist.add(no),ro._whitelist.delete(no)}),ro._blacklistError=createValidation({message:to,name:"notOneOf",test(no){let io=this.schema._blacklist,oo=io.resolveAll(this.resolve);return oo.includes(no)?this.createError({params:{values:io.toArray().join(", "),resolved:oo}}):!0}}),ro}strip(eo=!0){let to=this.clone();return to.spec.strip=eo,to}describe(){const eo=this.clone(),{label:to,meta:ro}=eo.spec;return{meta:ro,label:to,type:eo.type,oneOf:eo._whitelist.describe(),notOneOf:eo._blacklist.describe(),tests:eo.tests.map(io=>({name:io.OPTIONS.name,params:io.OPTIONS.params})).filter((io,oo,ao)=>ao.findIndex(so=>so.name===io.name)===oo)}}}BaseSchema.prototype.__isYupSchema__=!0;for(const Xr of["validate","validateSync"])BaseSchema.prototype[`${Xr}At`]=function(eo,to,ro={}){const{parent:no,parentPath:io,schema:oo}=getIn$1(this,eo,to,ro.context);return oo[Xr](no&&no[io],_extends$1j({},ro,{parent:no,path:eo}))};for(const Xr of["equals","is"])BaseSchema.prototype[Xr]=BaseSchema.prototype.oneOf;for(const Xr of["not","nope"])BaseSchema.prototype[Xr]=BaseSchema.prototype.notOneOf;BaseSchema.prototype.optional=BaseSchema.prototype.notRequired;const Mixed=BaseSchema;Mixed.prototype;const isAbsent=Xr=>Xr==null;function create$6(){return new BooleanSchema}class BooleanSchema extends BaseSchema{constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(eo){if(!this.isType(eo)){if(/^(true|1)$/i.test(String(eo)))return!0;if(/^(false|0)$/i.test(String(eo)))return!1}return eo})})}_typeCheck(eo){return eo instanceof Boolean&&(eo=eo.valueOf()),typeof eo=="boolean"}isTrue(eo=boolean$4.isValue){return this.test({message:eo,name:"is-value",exclusive:!0,params:{value:"true"},test(to){return isAbsent(to)||to===!0}})}isFalse(eo=boolean$4.isValue){return this.test({message:eo,name:"is-value",exclusive:!0,params:{value:"false"},test(to){return isAbsent(to)||to===!1}})}}create$6.prototype=BooleanSchema.prototype;let rEmail=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,rUrl=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rUUID=/^(?:[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,isTrimmed=Xr=>isAbsent(Xr)||Xr===Xr.trim(),objStringTag={}.toString();function create$5(){return new StringSchema}class StringSchema extends BaseSchema{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(eo){if(this.isType(eo)||Array.isArray(eo))return eo;const to=eo!=null&&eo.toString?eo.toString():eo;return to===objStringTag?eo:to})})}_typeCheck(eo){return eo instanceof String&&(eo=eo.valueOf()),typeof eo=="string"}_isPresent(eo){return super._isPresent(eo)&&!!eo.length}length(eo,to=string$5.length){return this.test({message:to,name:"length",exclusive:!0,params:{length:eo},test(ro){return isAbsent(ro)||ro.length===this.resolve(eo)}})}min(eo,to=string$5.min){return this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(ro){return isAbsent(ro)||ro.length>=this.resolve(eo)}})}max(eo,to=string$5.max){return this.test({name:"max",exclusive:!0,message:to,params:{max:eo},test(ro){return isAbsent(ro)||ro.length<=this.resolve(eo)}})}matches(eo,to){let ro=!1,no,io;return to&&(typeof to=="object"?{excludeEmptyString:ro=!1,message:no,name:io}=to:no=to),this.test({name:io||"matches",message:no||string$5.matches,params:{regex:eo},test:oo=>isAbsent(oo)||oo===""&&ro||oo.search(eo)!==-1})}email(eo=string$5.email){return this.matches(rEmail,{name:"email",message:eo,excludeEmptyString:!0})}url(eo=string$5.url){return this.matches(rUrl,{name:"url",message:eo,excludeEmptyString:!0})}uuid(eo=string$5.uuid){return this.matches(rUUID,{name:"uuid",message:eo,excludeEmptyString:!1})}ensure(){return this.default("").transform(eo=>eo===null?"":eo)}trim(eo=string$5.trim){return this.transform(to=>to!=null?to.trim():to).test({message:eo,name:"trim",test:isTrimmed})}lowercase(eo=string$5.lowercase){return this.transform(to=>isAbsent(to)?to:to.toLowerCase()).test({message:eo,name:"string_case",exclusive:!0,test:to=>isAbsent(to)||to===to.toLowerCase()})}uppercase(eo=string$5.uppercase){return this.transform(to=>isAbsent(to)?to:to.toUpperCase()).test({message:eo,name:"string_case",exclusive:!0,test:to=>isAbsent(to)||to===to.toUpperCase()})}}create$5.prototype=StringSchema.prototype;var isoReg=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function parseIsoDate(Xr){var eo=[1,4,5,6,7,10,11],to=0,ro,no;if(no=isoReg.exec(Xr)){for(var io=0,oo;oo=eo[io];++io)no[oo]=+no[oo]||0;no[2]=(+no[2]||1)-1,no[3]=+no[3]||1,no[7]=no[7]?String(no[7]).substr(0,3):0,(no[8]===void 0||no[8]==="")&&(no[9]===void 0||no[9]==="")?ro=+new Date(no[1],no[2],no[3],no[4],no[5],no[6],no[7]):(no[8]!=="Z"&&no[9]!==void 0&&(to=no[10]*60+no[11],no[9]==="+"&&(to=0-to)),ro=Date.UTC(no[1],no[2],no[3],no[4],no[5]+to,no[6],no[7]))}else ro=Date.parse?Date.parse(Xr):NaN;return ro}let invalidDate=new Date(""),isDate=Xr=>Object.prototype.toString.call(Xr)==="[object Date]";class DateSchema extends BaseSchema{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(eo){return this.isType(eo)?eo:(eo=parseIsoDate(eo),isNaN(eo)?invalidDate:new Date(eo))})})}_typeCheck(eo){return isDate(eo)&&!isNaN(eo.getTime())}prepareParam(eo,to){let ro;if(Reference$1.isRef(eo))ro=eo;else{let no=this.cast(eo);if(!this._typeCheck(no))throw new TypeError(`\`${to}\` must be a Date or a value that can be \`cast()\` to a Date`);ro=no}return ro}min(eo,to=date.min){let ro=this.prepareParam(eo,"min");return this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(no){return isAbsent(no)||no>=this.resolve(ro)}})}max(eo,to=date.max){let ro=this.prepareParam(eo,"max");return this.test({message:to,name:"max",exclusive:!0,params:{max:eo},test(no){return isAbsent(no)||no<=this.resolve(ro)}})}}DateSchema.INVALID_DATE=invalidDate;DateSchema.prototype;function arrayReduce$1(Xr,eo,to,ro){var no=-1,io=Xr==null?0:Xr.length;for(ro&&io&&(to=Xr[++no]);++nono?0:no+eo),to=to>no?no:to,to<0&&(to+=no),no=eo>to?0:to-eo>>>0,eo>>>=0;for(var io=Array(no);++ro=ro?Xr:baseSlice(Xr,eo,to)}var _castSlice=castSlice$1,rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsVarRange$1="\\ufe0e\\ufe0f",rsZWJ$1="\\u200d",reHasUnicode=RegExp("["+rsZWJ$1+rsAstralRange$1+rsComboRange$1+rsVarRange$1+"]");function hasUnicode$2(Xr){return reHasUnicode.test(Xr)}var _hasUnicode=hasUnicode$2;function asciiToArray$1(Xr){return Xr.split("")}var _asciiToArray=asciiToArray$1,rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsVarRange="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange+"]",rsCombo="["+rsComboRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ="\\u200d",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");function unicodeToArray$1(Xr){return Xr.match(reUnicode)||[]}var _unicodeToArray=unicodeToArray$1,asciiToArray=_asciiToArray,hasUnicode$1=_hasUnicode,unicodeToArray=_unicodeToArray;function stringToArray$1(Xr){return hasUnicode$1(Xr)?unicodeToArray(Xr):asciiToArray(Xr)}var _stringToArray=stringToArray$1,castSlice=_castSlice,hasUnicode=_hasUnicode,stringToArray=_stringToArray,toString$6=toString_1;function createCaseFirst$1(Xr){return function(eo){eo=toString$6(eo);var to=hasUnicode(eo)?stringToArray(eo):void 0,ro=to?to[0]:eo.charAt(0),no=to?castSlice(to,1).join(""):eo.slice(1);return ro[Xr]()+no}}var _createCaseFirst=createCaseFirst$1,createCaseFirst=_createCaseFirst,upperFirst$1=createCaseFirst("toUpperCase"),upperFirst_1=upperFirst$1,toString$5=toString_1,upperFirst=upperFirst_1;function capitalize$3(Xr){return upperFirst(toString$5(Xr).toLowerCase())}var capitalize_1=capitalize$3,capitalize$2=capitalize_1,createCompounder=_createCompounder,camelCase=createCompounder(function(Xr,eo,to){return eo=eo.toLowerCase(),Xr+(to?capitalize$2(eo):eo)}),camelCase_1=camelCase;const camelCase$1=getDefaultExportFromCjs$2(camelCase_1);var baseAssignValue$1=_baseAssignValue,baseForOwn=_baseForOwn,baseIteratee=_baseIteratee;function mapKeys(Xr,eo){var to={};return eo=baseIteratee(eo),baseForOwn(Xr,function(ro,no,io){baseAssignValue$1(to,eo(ro,no,io),ro)}),to}var mapKeys_1=mapKeys;const mapKeys$1=getDefaultExportFromCjs$2(mapKeys_1);var toposort$2={exports:{}};toposort$2.exports=function(Xr){return toposort(uniqueNodes(Xr),Xr)};toposort$2.exports.array=toposort;function toposort(Xr,eo){var to=Xr.length,ro=new Array(to),no={},io=to,oo=makeOutgoingEdges(eo),ao=makeNodesHash(Xr);for(eo.forEach(function(co){if(!ao.has(co[0])||!ao.has(co[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});io--;)no[io]||so(Xr[io],io,new Set);return ro;function so(co,lo,fo){if(fo.has(co)){var ho;try{ho=", node was:"+JSON.stringify(co)}catch{ho=""}throw new Error("Cyclic dependency"+ho)}if(!ao.has(co))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(co));if(!no[lo]){no[lo]=!0;var go=oo.get(co)||new Set;if(go=Array.from(go),lo=go.length){fo.add(co);do{var yo=go[--lo];so(yo,ao.get(yo),fo)}while(lo);fo.delete(co)}ro[--to]=co}}}function uniqueNodes(Xr){for(var eo=new Set,to=0,ro=Xr.length;to`${oo}-${ao}`));function io(oo,ao){let so=propertyExpr.split(oo)[0];ro.add(so),no.has(`${ao}-${so}`)||to.push([ao,so])}for(const oo in Xr)if(has$1(Xr,oo)){let ao=Xr[oo];ro.add(oo),Reference$1.isRef(ao)&&ao.isSibling?io(ao.path,oo):isSchema(ao)&&"deps"in ao&&ao.deps.forEach(so=>io(so,oo))}return toposort$1.array(Array.from(ro),to).reverse()}function findIndex(Xr,eo){let to=1/0;return Xr.some((ro,no)=>{var io;if(((io=eo.path)==null?void 0:io.indexOf(ro))!==-1)return to=no,!0}),to}function sortByKeyOrder(Xr){return(eo,to)=>findIndex(Xr,eo)-findIndex(Xr,to)}function _extends$1i(){return _extends$1i=Object.assign||function(Xr){for(var eo=1;eoObject.prototype.toString.call(Xr)==="[object Object]";function unknown$4(Xr,eo){let to=Object.keys(Xr.fields);return Object.keys(eo).filter(ro=>to.indexOf(ro)===-1)}const defaultSort=sortByKeyOrder([]);class ObjectSchema extends BaseSchema{constructor(eo){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=defaultSort,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(function(ro){if(typeof ro=="string")try{ro=JSON.parse(ro)}catch{ro=null}return this.isType(ro)?ro:null}),eo&&this.shape(eo)})}_typeCheck(eo){return isObject$b(eo)||typeof eo=="function"}_cast(eo,to={}){var ro;let no=super._cast(eo,to);if(no===void 0)return this.getDefault();if(!this._typeCheck(no))return no;let io=this.fields,oo=(ro=to.stripUnknown)!=null?ro:this.spec.noUnknown,ao=this._nodes.concat(Object.keys(no).filter(fo=>this._nodes.indexOf(fo)===-1)),so={},co=_extends$1i({},to,{parent:so,__validating:to.__validating||!1}),lo=!1;for(const fo of ao){let ho=io[fo],go=has$1(no,fo);if(ho){let yo,vo=no[fo];co.path=(to.path?`${to.path}.`:"")+fo,ho=ho.resolve({value:vo,context:to.context,parent:so});let wo="spec"in ho?ho.spec:void 0,Eo=wo==null?void 0:wo.strict;if(wo!=null&&wo.strip){lo=lo||fo in no;continue}yo=!to.__validating||!Eo?ho.cast(no[fo],co):no[fo],yo!==void 0&&(so[fo]=yo)}else go&&!oo&&(so[fo]=no[fo]);so[fo]!==no[fo]&&(lo=!0)}return lo?so:no}_validate(eo,to={},ro){let no=[],{sync:io,from:oo=[],originalValue:ao=eo,abortEarly:so=this.spec.abortEarly,recursive:co=this.spec.recursive}=to;oo=[{schema:this,value:ao},...oo],to.__validating=!0,to.originalValue=ao,to.from=oo,super._validate(eo,to,(lo,fo)=>{if(lo){if(!ValidationError.isError(lo)||so)return void ro(lo,fo);no.push(lo)}if(!co||!isObject$b(fo)){ro(no[0]||null,fo);return}ao=ao||fo;let ho=this._nodes.map(go=>(yo,vo)=>{let wo=go.indexOf(".")===-1?(to.path?`${to.path}.`:"")+go:`${to.path||""}["${go}"]`,Eo=this.fields[go];if(Eo&&"validate"in Eo){Eo.validate(fo[go],_extends$1i({},to,{path:wo,from:oo,strict:!0,parent:fo,originalValue:ao[go]}),vo);return}vo(null)});runTests({sync:io,tests:ho,value:fo,errors:no,endEarly:so,sort:this._sortErrors,path:to.path},ro)})}clone(eo){const to=super.clone(eo);return to.fields=_extends$1i({},this.fields),to._nodes=this._nodes,to._excludedEdges=this._excludedEdges,to._sortErrors=this._sortErrors,to}concat(eo){let to=super.concat(eo),ro=to.fields;for(let[no,io]of Object.entries(this.fields)){const oo=ro[no];oo===void 0?ro[no]=io:oo instanceof BaseSchema&&io instanceof BaseSchema&&(ro[no]=io.concat(oo))}return to.withMutation(()=>to.shape(ro,this._excludedEdges))}getDefaultFromShape(){let eo={};return this._nodes.forEach(to=>{const ro=this.fields[to];eo[to]="default"in ro?ro.getDefault():void 0}),eo}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(eo,to=[]){let ro=this.clone(),no=Object.assign(ro.fields,eo);return ro.fields=no,ro._sortErrors=sortByKeyOrder(Object.keys(no)),to.length&&(Array.isArray(to[0])||(to=[to]),ro._excludedEdges=[...ro._excludedEdges,...to]),ro._nodes=sortFields(no,ro._excludedEdges),ro}pick(eo){const to={};for(const ro of eo)this.fields[ro]&&(to[ro]=this.fields[ro]);return this.clone().withMutation(ro=>(ro.fields={},ro.shape(to)))}omit(eo){const to=this.clone(),ro=to.fields;to.fields={};for(const no of eo)delete ro[no];return to.withMutation(()=>to.shape(ro))}from(eo,to,ro){let no=propertyExpr.getter(eo,!0);return this.transform(io=>{if(io==null)return io;let oo=io;return has$1(io,eo)&&(oo=_extends$1i({},io),ro||delete oo[eo],oo[to]=no(io)),oo})}noUnknown(eo=!0,to=object$1.noUnknown){typeof eo=="string"&&(to=eo,eo=!0);let ro=this.test({name:"noUnknown",exclusive:!0,message:to,test(no){if(no==null)return!0;const io=unknown$4(this.schema,no);return!eo||io.length===0||this.createError({params:{unknown:io.join(", ")}})}});return ro.spec.noUnknown=eo,ro}unknown(eo=!0,to=object$1.noUnknown){return this.noUnknown(!eo,to)}transformKeys(eo){return this.transform(to=>to&&mapKeys$1(to,(ro,no)=>eo(no)))}camelCase(){return this.transformKeys(camelCase$1)}snakeCase(){return this.transformKeys(snakeCase$1)}constantCase(){return this.transformKeys(eo=>snakeCase$1(eo).toUpperCase())}describe(){let eo=super.describe();return eo.fields=mapValues$1(this.fields,to=>to.describe()),eo}}function create$4(Xr){return new ObjectSchema(Xr)}create$4.prototype=ObjectSchema.prototype;function _extends$1h(){return _extends$1h=Object.assign||function(Xr){for(var eo=1;eo{this.transform(function(to){if(typeof to=="string")try{to=JSON.parse(to)}catch{to=null}return this.isType(to)?to:null})})}_typeCheck(eo){return Array.isArray(eo)}get _subType(){return this.innerType}_cast(eo,to){const ro=super._cast(eo,to);if(!this._typeCheck(ro)||!this.innerType)return ro;let no=!1;const io=ro.map((oo,ao)=>{const so=this.innerType.cast(oo,_extends$1h({},to,{path:`${to.path||""}[${ao}]`}));return so!==oo&&(no=!0),so});return no?io:ro}_validate(eo,to={},ro){var no,io;let oo=[],ao=to.sync,so=to.path,co=this.innerType,lo=(no=to.abortEarly)!=null?no:this.spec.abortEarly,fo=(io=to.recursive)!=null?io:this.spec.recursive,ho=to.originalValue!=null?to.originalValue:eo;super._validate(eo,to,(go,yo)=>{if(go){if(!ValidationError.isError(go)||lo)return void ro(go,yo);oo.push(go)}if(!fo||!co||!this._typeCheck(yo)){ro(oo[0]||null,yo);return}ho=ho||yo;let vo=new Array(yo.length);for(let wo=0;woco.validate(Eo,Ao,jo)}runTests({sync:ao,path:so,value:yo,errors:oo,endEarly:lo,tests:vo},ro)})}clone(eo){const to=super.clone(eo);return to.innerType=this.innerType,to}concat(eo){let to=super.concat(eo);return to.innerType=this.innerType,eo.innerType&&(to.innerType=to.innerType?to.innerType.concat(eo.innerType):eo.innerType),to}of(eo){let to=this.clone();if(!isSchema(eo))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+printValue(eo));return to.innerType=eo,to}length(eo,to=array$4.length){return this.test({message:to,name:"length",exclusive:!0,params:{length:eo},test(ro){return isAbsent(ro)||ro.length===this.resolve(eo)}})}min(eo,to){return to=to||array$4.min,this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(ro){return isAbsent(ro)||ro.length>=this.resolve(eo)}})}max(eo,to){return to=to||array$4.max,this.test({message:to,name:"max",exclusive:!0,params:{max:eo},test(ro){return isAbsent(ro)||ro.length<=this.resolve(eo)}})}ensure(){return this.default(()=>[]).transform((eo,to)=>this._typeCheck(eo)?eo:to==null?[]:[].concat(to))}compact(eo){let to=eo?(ro,no,io)=>!eo(ro,no,io):ro=>!!ro;return this.transform(ro=>ro!=null?ro.filter(to):ro)}describe(){let eo=super.describe();return this.innerType&&(eo.innerType=this.innerType.describe()),eo}nullable(eo=!0){return super.nullable(eo)}defined(){return super.defined()}required(eo){return super.required(eo)}}create$3.prototype=ArraySchema.prototype;const userFieldsSchema=create$4().shape({alias:create$5(),btcWallet:create$5(),ckbWallet:create$5(),country:create$5(),discordNotification:create$6(),dogeWallet:create$5(),email:create$5(),emailNotification:create$6(),firstName:create$5(),jobTitle:create$5(),kasWallet:create$5(),kdaWallet:create$5(),lastName:create$5(),ltcWallet:create$5(),metadata:create$4(),newsletterNotification:create$6(),phoneNumber:create$5(),tShirtSize:create$5(),team:create$5(),username:create$5()}),FooterAnimationContext=reactExports.createContext(void 0),FooterAnimationContextProvider=({children:Xr})=>{const{view:eo}=useViewContext(),[to,ro]=reactExports.useState(!1);reactExports.useEffect(()=>{ro(!1)},[eo]);const no=reactExports.useMemo(()=>({isFooterExpanded:to,setIsFooterExpanded:ro}),[to]);return jsxRuntimeExports.jsx(FooterAnimationContext.Provider,{value:no,children:jsxRuntimeExports.jsx("div",{children:Xr})})},useFooterAnimationContext=()=>{const Xr=reactExports.useContext(FooterAnimationContext);if(!Xr)throw new Error("Can only call useFooterAnimationContext inside FooterAnimationContextProvider");return Xr};var _path$11,_excluded$1d=["title","titleId"];function _extends$1g(){return _extends$1g=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1f(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgError=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1d(eo,_excluded$1d);return reactExports.createElement("svg",_extends$1g({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$11||(_path$11=reactExports.createElement("path",{d:"M9.99 0C4.47 0 0 4.48 0 10s4.47 10 9.99 10C15.52 20 20 15.52 20 10S15.52 0 9.99 0ZM10 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8Zm-1-5h2v2H9v-2Zm0-8h2v6H9V5Z",fill:"currentcolor"})))};const Icon=({children:Xr,className:eo="",color:to,size:ro})=>{const no=classNames(eo,to?`icon--color-${to}`:"",ro?`icon--size-${ro}`:"");return reactExports.cloneElement(Xr,{className:no})},Typography=Xr=>{var{as:eo="p",variant:to,weight:ro,color:no,transform:io,className:oo="",truncate:ao=!1,style:so}=Xr,co=__rest$7(Xr,["as","variant","weight","color","transform","className","truncate","style"]);const lo={body_mini:"typography--body-mini",body_normal:"typography--body-normal",body_small:"typography--body-small",button_primary:"typography--button-primary",button_secondary:"typography--button-secondary",button_tertiary:"typography--button-tertiary",numbers_big:"typography--numbers-big",numbers_medium:"typography--numbers-medium",title:"typography--title"},fo={bold:"typography--bold",medium:"typography--medium",regular:"typography--regular"},ho={"brand-primary":"typography--brand-primary","error-1":"typography--dynamic-error-1","error-2":"typography--dynamic-error-2","green-1":"typography--connection-green-1",inherit:"typography--inherit",link:"typography--link",primary:"typography--primary",secondary:"typography--secondary",tertiary:"typography--tertiary",tooltip:"typography--tooltip",white:"typography--white"},go={uppercase:"typography--uppercase"},yo=classNames("typography",to?lo[to]:"",ro?fo[ro]:"",no?ho[no]:"",io?go[io]:"",{"typography--truncate":ao},oo);return jsxRuntimeExports.jsx(eo,Object.assign({style:so,className:yo},co))},errorIconMap={error:jsxRuntimeExports.jsx(SvgError,{})},Alert=({children:Xr,icon:eo,variant:to="error",contentDataTestId:ro,className:no=""})=>jsxRuntimeExports.jsxs("div",{className:classNames("alert",{"alert--error":to==="error","alert--info":to==="info","alert--warning":to==="warning"},no),children:[eo&&jsxRuntimeExports.jsx(Icon,{size:"small",className:"alert__icon",children:typeof eo=="string"?errorIconMap[eo]:eo}),jsxRuntimeExports.jsx(Typography,{variant:"body_small","data-testid":ro,children:Xr})]}),FieldsStateContext=reactExports.createContext(void 0),FieldsStateProvider=({children:Xr})=>{const eo=reactExports.useRef();return jsxRuntimeExports.jsx(FieldsStateContext.Provider,{value:{selectedPhoneCountry:eo},children:Xr})},useFieldsState=()=>{const Xr=reactExports.useContext(FieldsStateContext);if(!Xr)throw new DynamicError("Can only call useFieldsState inside FieldsStateProvider");return Xr},PHONE_NUMBER_REGEX=/^(\+[1-9]\d{1,14})?$/,validatePhoneLength=(Xr,eo)=>de$4({dialCode:eo.dialCode,phone:Xr}).length>0,customFieldValidationMap={checkbox:create$3(),select:create$5(),text:create$5()},useFields=()=>{const{t:Xr}=useTranslation(),{selectedPhoneCountry:eo}=useFieldsState();return{fieldsConfig:reactExports.useMemo(()=>({alias:{key:"dyn_collect_user_data.fields.alias.label",label:Xr("dyn_collect_user_data.fields.alias.label"),type:"string",validation:create$5().trim()},country:{key:"dyn_collect_user_data.fields.country.label",label:Xr("dyn_collect_user_data.fields.country.label"),type:"select",validation:create$5().oneOf(countryCodes.map(ro=>ro.code))},email:{autoComplete:"email",key:"dyn_collect_user_data.fields.email.label",label:Xr("dyn_collect_user_data.fields.email.label"),type:"email",validation:create$5().email(Xr("dyn_collect_user_data.fields.email.validation"))},firstName:{key:"dyn_collect_user_data.fields.first_name.label",label:Xr("dyn_collect_user_data.fields.first_name.label"),type:"string",validation:create$5().trim()},jobTitle:{key:"dyn_collect_user_data.fields.job_title.label",label:Xr("dyn_collect_user_data.fields.job_title.label"),type:"string",validation:create$5().trim()},lastName:{key:"dyn_collect_user_data.fields.last_name.label",label:Xr("dyn_collect_user_data.fields.last_name.label"),type:"string",validation:create$5().trim()},phoneNumber:{key:"dyn_collect_user_data.fields.phone_number.label",label:Xr("dyn_collect_user_data.fields.phone_number.label"),type:"string",validation:create$5().test("length",Xr("dyn_collect_user_data.fields.phone_number.too_short"),ro=>eo.current?ro===void 0||ro.length===0||validatePhoneLength(ro,eo.current):!0).matches(PHONE_NUMBER_REGEX,Xr("dyn_collect_user_data.fields.phone_number.validation"))},policiesConsent:{key:"dyn_collect_user_data.fields.policies_consent.label",label:Xr("dyn_collect_user_data.fields.policies_consent.label"),type:"boolean",validation:create$6()},tShirtSize:{key:"dyn_collect_user_data.fields.t_shirt_size.label",label:Xr("dyn_collect_user_data.fields.t_shirt_size.label"),type:"select",validation:create$5().oneOf(tShirtSizes)},team:{key:"dyn_collect_user_data.fields.team.label",label:Xr("dyn_collect_user_data.fields.team.label"),type:"select",validation:create$5().oneOf(teamNames)},username:{key:"dyn_collect_user_data.fields.username.label",label:Xr("dyn_collect_user_data.fields.username.label"),type:"string",validation:create$5().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?_-]{3,20}$/,Xr("dyn_collect_user_data.fields.username.validation"))}}),[eo,Xr])}},{getEnvironmentId,useEnvironmentId,setEnvironmentId}=createStoreState("environmentId"),{getWalletConnectorOptions,setWalletConnectorOptions,useWalletConnectorOptions,resetWalletConnectorOptions}=createStoreState("walletConnectorOptions"),IconButton=reactExports.forwardRef((Xr,eo)=>{var{className:to="",color:ro}=Xr,no=__rest$7(Xr,["className","color"]);return jsxRuntimeExports.jsx("button",Object.assign({},no,{className:classNames("icon-button",to),ref:eo}))});IconButton.displayName="IconButton";const InlineWidget=reactExports.forwardRef(({children:Xr,className:eo,dataTestId:to},ro)=>jsxRuntimeExports.jsx("div",{ref:ro,"data-testid":to,className:classNames("inline-widget",eo),children:Xr}));InlineWidget.displayName="InlineWidget";const Input=reactExports.forwardRef((Xr,eo)=>{var{className:to="",id:ro,label:no,type:io,onChange:oo,onBlur:ao,name:so,value:co,optional:lo,error:fo=!1,disabled:ho,message:go,placeholder:yo,variant:vo="dense",suffix:wo,containerClassName:Eo}=Xr,ko=__rest$7(Xr,["className","id","label","type","onChange","onBlur","name","value","optional","error","disabled","message","placeholder","variant","suffix","containerClassName"]);return jsxRuntimeExports.jsxs("div",{className:classNames("input__container",Eo,{"input__container--dense":vo==="dense","input__container--regular":vo==="regular"}),children:[jsxRuntimeExports.jsx("input",Object.assign({},ko,{name:so,value:co,onChange:oo,onBlur:ao,type:io,id:ro,placeholder:vo==="regular"||!no?yo:no,disabled:ho,className:classNames("input",to,{"input--no-label":!no,input__error:fo,input__has_trailing:lo}),ref:eo})),jsxRuntimeExports.jsx("label",{htmlFor:ro,className:classNames("input__label"),children:no}),wo&&jsxRuntimeExports.jsx("div",{className:classNames("input__suffix"),children:wo}),lo&&jsxRuntimeExports.jsx("span",{className:"input__trailing",children:"Optional"}),!!go&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:classNames("input__message",{input__message__error:fo}),children:go})]})});Input.displayName="Input";const IsNestedBrowserContext=reactExports.createContext(!1),IsBrowser=({children:Xr})=>{const eo=reactExports.useContext(IsNestedBrowserContext),[to,ro]=reactExports.useState(!1);return reactExports.useEffect(()=>{ro(!0)},[]),to||eo?jsxRuntimeExports.jsx(IsNestedBrowserContext.Provider,{value:!0,children:Xr}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},mapTransformOriginToClassName={"bottom-left":"popper-content__transform-origin-bottom-left","bottom-right":"popper-content__transform-origin-bottom-right","top-left":"popper-content__transform-origin-top-left","top-right":"popper-content__transform-origin-top-right"},PopperContent=reactExports.forwardRef(({children:Xr,transformOrigin:eo,style:to,className:ro},no)=>jsxRuntimeExports.jsx("div",{"data-testid":"popper-content",ref:no,className:classNames("popper-content",mapTransformOriginToClassName[eo],ro),style:to,children:Xr}));PopperContent.displayName="PopperContent";const popperContext=reactExports.createContext(void 0),PopperProvider=({children:Xr})=>{const{Provider:eo}=popperContext,to=reactExports.useRef(null);return jsxRuntimeExports.jsx(eo,{value:{containerRef:to},children:jsxRuntimeExports.jsx("div",{ref:to,style:{position:"relative"},children:Xr})})},usePopper=()=>{const Xr=reactExports.useContext(popperContext);if(!Xr)throw new Error("To use popper, use the PopperProvider above in the dom hierarchy");return Xr},getChildPosition=(Xr,eo)=>{const to=Xr.getBoundingClientRect(),ro=eo.getBoundingClientRect();return{left:ro.x-to.x,top:ro.y-to.y}},Popper=reactExports.forwardRef(({anchorRef:Xr,anchorOrigin:eo="top-left",transformOrigin:to="top-left",children:ro,style:no,className:io},oo)=>{const{containerRef:ao}=usePopper(),[so,co]=reactExports.useState(),lo=ao.current;reactExports.useEffect(()=>{const ho=ao.current,go=Xr.current;!ho||!go||co(getChildPosition(ho,go))},[Xr,ao,co]);const fo=reactExports.useMemo(()=>{var ho;const go=(ho=Xr.current)===null||ho===void 0?void 0:ho.getBoundingClientRect();if(!(!so||!go))switch(eo){case"top-left":return so;case"top-right":return Object.assign(Object.assign({},so),{left:so.left+go.width});case"bottom-left":return Object.assign(Object.assign({},so),{top:so.top+go.height});case"bottom-right":return Object.assign(Object.assign({},so),{left:so.left+go.width,top:so.top+go.height});default:return}},[so,Xr,eo]);return!fo||lo===null?null:reactDomExports.createPortal(jsxRuntimeExports.jsx(PopperContent,{ref:oo,transformOrigin:to,style:Object.assign(Object.assign({},fo),no),className:io,children:ro}),lo)});Popper.displayName="Popper";const useForwardedRef=Xr=>{const eo=reactExports.useRef(null);return reactExports.useEffect(()=>{Xr&&(typeof Xr=="function"?Xr(eo.current):Xr.current=eo.current)},[Xr,eo]),eo},useOnClickOutside=(Xr,eo)=>{const to=reactExports.useRef(eo);to.current=eo,reactExports.useEffect(()=>{const ro=no=>{no.stopPropagation();const io=no.composedPath().shift();!Xr.current||Xr.current.contains(no.currentTarget)||Xr.current.contains(io)||to.current(no)};return document.addEventListener("touchstart",ro),document.addEventListener("click",ro),()=>{document.removeEventListener("touchstart",ro),document.removeEventListener("click",ro)}},[Xr])},isScrollable=Xr=>{const eo=Xr.scrollHeight>Xr.clientHeight,ro=window.getComputedStyle(Xr).overflowY.indexOf("hidden")!==-1;return eo&&!ro},watchToScrollInHierarchy=(Xr,eo,to)=>{const ro=[];let no=eo;for(;no!==null;){const io=no===Xr;if(isScrollable(no)&&(no.addEventListener("scroll",to),ro.push(no)),no=no.parentElement,io)break}return()=>ro.forEach(io=>io.removeEventListener("scroll",to))},animationFrameTimeout=(Xr,eo)=>{const to=performance.now(),ro={id:-1},no=()=>{ro.id=requestAnimationFrame(io=>{io-to>eo?Xr():no()})};return no(),ro},clearAnimationFrameTimeout=Xr=>{Xr.id&&cancelAnimationFrame(Xr.id)},useIsFirstRender=()=>{const Xr=reactExports.useRef(!0);return reactExports.useEffect(()=>{Xr.current&&(Xr.current=!1)},[]),Xr.current},useUpdateEffect=(Xr,eo)=>{const to=useIsFirstRender();reactExports.useEffect(()=>{if(!to)return Xr()},eo)},useTransitionEvents=(Xr,eo)=>{const to={ENTERED:eo==null?void 0:eo.onEntered,ENTERING:eo==null?void 0:eo.onEntering,EXITING:eo==null?void 0:eo.onExiting,UNMOUNT:eo==null?void 0:eo.onUnmount};return useUpdateEffect(()=>{var ro;return(ro=to[Xr])===null||ro===void 0||ro.call(to),()=>{var no;Xr==="EXITING"&&((no=to.UNMOUNT)===null||no===void 0||no.call(to))}},[Xr])},DEFAULT_DURATION=100,useTransition=Xr=>{var{isShown:eo,inDuration:to,outDuration:ro,duration:no=DEFAULT_DURATION,delay:io,inDelay:oo,outDelay:ao,animateOnMount:so=!0}=Xr,co=__rest$7(Xr,["isShown","inDuration","outDuration","duration","delay","inDelay","outDelay","animateOnMount"]);const lo=so?"UNMOUNT":"ENTERED",fo=reactExports.useRef({id:-1}),ho=reactExports.useRef({id:-1}),[go,yo]=reactExports.useState(lo),[vo,wo]=reactExports.useState(!so),[Eo,ko]=reactExports.useState(no),Ao=(Mo,No)=>{No?ho.current=animationFrameTimeout(Mo,No):Mo()},Po=reactExports.useCallback(()=>{const Mo=to||no;ko(Mo),wo(!0),yo("ENTERING"),fo.current=animationFrameTimeout(()=>{yo("ENTERED")},Mo)},[no,to]),jo=reactExports.useCallback(()=>{const Mo=ro||no;ko(Mo),yo("EXITING"),fo.current=animationFrameTimeout(()=>{wo(!1),yo("UNMOUNT")},Mo)},[no,ro]);return reactExports.useEffect(()=>(eo&&go!=="ENTERED"?Ao(Po,oo||io):!eo&&go!=="UNMOUNT"&&Ao(jo,ao||io),()=>{clearAnimationFrameTimeout(fo.current),clearAnimationFrameTimeout(ho.current)}),[oo,ao,Po,jo,eo,io,go]),useTransitionEvents(go,co),{currentDuration:Eo,mount:vo,stage:go}},IN_DURATION=300,OUT_DURATION=300,Dropdown=reactExports.forwardRef((Xr,eo)=>{var{children:to,isOpen:ro,onClickOutside:no,onScroll:io,className:oo,style:ao,maxHeight:so=300}=Xr,co=__rest$7(Xr,["children","isOpen","onClickOutside","onScroll","className","style","maxHeight"]);const{containerRef:lo}=usePopper(),fo=useForwardedRef(eo);useOnClickOutside(fo,()=>no==null?void 0:no()),reactExports.useEffect(()=>{if(!(!lo.current||!co.anchorRef.current))return watchToScrollInHierarchy(lo.current,co.anchorRef.current,()=>io==null?void 0:io())},[lo,co.anchorRef,io]);const{mount:ho,stage:go,currentDuration:yo}=useTransition({inDuration:IN_DURATION,isShown:ro,outDuration:OUT_DURATION}),vo=classNames({"dropdown--entering":go==="ENTERING","dropdown--exiting":go==="EXITING"});return ho?jsxRuntimeExports.jsx(Popper,Object.assign({},co,{ref:fo,children:jsxRuntimeExports.jsx("div",{className:classNames("dropdown",vo,oo),style:Object.assign({"--max-height":`${so}px`,animationDuration:`${yo}ms`},ao),children:to})})):null});Dropdown.displayName="Dropdown";const getZoomTransitionDefaultStyles=Xr=>({transition:`transform ${Xr}ms linear, opacity ${Xr}ms linear`}),transitionStyles$2={ENTERED:{opacity:"1",transform:"scale(1)"},ENTERING:{opacity:"0",transform:"scale(0.9)"},EXITING:{opacity:"0",transform:"scale(1.1)"}},UnoptimizedZoomTransition=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);const{mount:no,stage:io,currentDuration:oo}=useTransition(ro),ao=getZoomTransitionDefaultStyles(oo),so=transitionStyles$2[io];return no?jsxRuntimeExports.jsx("div",{className:classNames(to,"zoom-transition__root"),style:Object.assign(Object.assign({},ao),so),children:eo}):null};React.memo(UnoptimizedZoomTransition);const getSlideInUpTransitionDefaultStyles=(Xr,eo="linear")=>({transition:`transform ${Xr}ms ${eo}, opacity ${Xr}ms ${eo}`}),transitionStyles$1={ENTERED:{transform:"translateY(0)"},ENTERING:{transform:"translateY(0.625rem)"},EXITING:{transform:"translateY(0.625rem)"}},UnoptimizedSlideInUpTransition=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);const{mount:no,stage:io,currentDuration:oo}=useTransition(ro),ao=getSlideInUpTransitionDefaultStyles(oo),so=transitionStyles$1[io];return no?jsxRuntimeExports.jsx("div",{className:to,style:Object.assign(Object.assign({},ao),so),children:eo}):null},SlideInUpTransition=React.memo(UnoptimizedSlideInUpTransition),getOpacityTransitionDefaultStyles=Xr=>({transition:`opacity ${Xr}ms linear`}),transitionStyles={ENTERED:{opacity:1},ENTERING:{opacity:0},EXITING:{opacity:0},UNMOUNT:{opacity:0}},UnoptimizedOpacityTransition=Xr=>{var{children:eo,style:to,className:ro}=Xr,no=__rest$7(Xr,["children","style","className"]);const{mount:io,stage:oo,currentDuration:ao}=useTransition(no),so=getOpacityTransitionDefaultStyles(ao),co=transitionStyles[oo];return io?jsxRuntimeExports.jsx("div",{className:ro,style:Object.assign(Object.assign(Object.assign({},so),co),to),children:eo}):null},OpacityTransition=React.memo(UnoptimizedOpacityTransition),OverlayCardContext=reactExports.createContext(void 0),OverlayCardTarget=({children:Xr})=>{const[eo,to]=reactExports.useState(null),[ro,no]=reactExports.useState(new Set);return jsxRuntimeExports.jsxs(OverlayCardContext.Provider,{value:reactExports.useMemo(()=>({closeCard:io=>no(oo=>(oo.delete(io),new Set(oo))),openCard:io=>no(oo=>(oo.add(io),new Set(oo))),portal:eo}),[eo]),children:[Xr,ro.size>0&&jsxRuntimeExports.jsx("div",{className:"overlay-card-target",ref:to})]})},useOverlayCardTarget=Xr=>{var eo;const to=reactExports.useContext(OverlayCardContext),ro=reactExports.useId();return reactExports.useEffect(()=>{if(!(!to||!Xr))return to.openCard(ro),()=>{to.closeCard(ro)}},[to,ro,Xr]),(eo=to==null?void 0:to.portal)!==null&&eo!==void 0?eo:void 0},useForceUpdate=()=>{const[,Xr]=reactExports.useState(0);return()=>Xr(eo=>eo+1)},usePrevious=Xr=>{const eo=reactExports.useRef();return reactExports.useEffect(()=>{eo.current=Xr},[Xr]),eo.current};function _objectWithoutPropertiesLoose$1e(Xr,eo){if(Xr==null)return{};var to={};for(var ro in Xr)if({}.hasOwnProperty.call(Xr,ro)){if(eo.includes(ro))continue;to[ro]=Xr[ro]}return to}var FOCUS_GROUP="data-focus-lock",FOCUS_DISABLED="data-focus-lock-disabled",FOCUS_ALLOW="data-no-focus-lock",FOCUS_AUTO="data-autofocus-inside",FOCUS_NO_AUTOFOCUS="data-no-autofocus";function assignRef(Xr,eo){return typeof Xr=="function"?Xr(eo):Xr&&(Xr.current=eo),Xr}function useCallbackRef(Xr,eo){var to=reactExports.useState(function(){return{value:Xr,callback:eo,facade:{get current(){return to.value},set current(ro){var no=to.value;no!==ro&&(to.value=ro,to.callback(ro,no))}}}})[0];return to.callback=eo,to.facade}var useIsomorphicLayoutEffect$2=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(Xr,eo){var to=useCallbackRef(null,function(ro){return Xr.forEach(function(no){return assignRef(no,ro)})});return useIsomorphicLayoutEffect$2(function(){var ro=currentValues.get(to);if(ro){var no=new Set(ro),io=new Set(Xr),oo=to.current;no.forEach(function(ao){io.has(ao)||assignRef(ao,null)}),io.forEach(function(ao){no.has(ao)||assignRef(ao,oo)})}currentValues.set(to,Xr)},[Xr]),to}var hiddenGuard={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},__assign$3=function(){return __assign$3=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0}).sort(tabSort)},tabbables=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],queryTabbables=tabbables.join(","),queryGuardTabbables="".concat(queryTabbables,", [data-focus-guard]"),getFocusablesWithShadowDom=function(Xr,eo){return toArray((Xr.shadowRoot||Xr).children).reduce(function(to,ro){return to.concat(ro.matches(eo?queryGuardTabbables:queryTabbables)?[ro]:[],getFocusablesWithShadowDom(ro))},[])},getFocusablesWithIFrame=function(Xr,eo){var to;return Xr instanceof HTMLIFrameElement&&(!((to=Xr.contentDocument)===null||to===void 0)&&to.body)?getFocusables([Xr.contentDocument.body],eo):[Xr]},getFocusables=function(Xr,eo){return Xr.reduce(function(to,ro){var no,io=getFocusablesWithShadowDom(ro,eo),oo=(no=[]).concat.apply(no,io.map(function(ao){return getFocusablesWithIFrame(ao,eo)}));return to.concat(oo,ro.parentNode?toArray(ro.parentNode.querySelectorAll(queryTabbables)).filter(function(ao){return ao===ro}):[])},[])},getParentAutofocusables=function(Xr){var eo=Xr.querySelectorAll("[".concat(FOCUS_AUTO,"]"));return toArray(eo).map(function(to){return getFocusables([to])}).reduce(function(to,ro){return to.concat(ro)},[])},filterFocusable=function(Xr,eo){return toArray(Xr).filter(function(to){return isVisibleCached(eo,to)}).filter(function(to){return notHiddenInput(to)})},filterAutoFocusable=function(Xr,eo){return eo===void 0&&(eo=new Map),toArray(Xr).filter(function(to){return isAutoFocusAllowedCached(eo,to)})},getTabbableNodes=function(Xr,eo,to){return orderByTabIndex(filterFocusable(getFocusables(Xr,to),eo),!0,to)},getAllTabbableNodes=function(Xr,eo){return orderByTabIndex(filterFocusable(getFocusables(Xr),eo),!1)},parentAutofocusables=function(Xr,eo){return filterFocusable(getParentAutofocusables(Xr),eo)},contains=function(Xr,eo){return Xr.shadowRoot?contains(Xr.shadowRoot,eo):Object.getPrototypeOf(Xr).contains!==void 0&&Object.getPrototypeOf(Xr).contains.call(Xr,eo)?!0:toArray(Xr.children).some(function(to){var ro;if(to instanceof HTMLIFrameElement){var no=(ro=to.contentDocument)===null||ro===void 0?void 0:ro.body;return no?contains(no,eo):!1}return contains(to,eo)})},filterNested=function(Xr){for(var eo=new Set,to=Xr.length,ro=0;ro0&&eo.add(no),(io&Node.DOCUMENT_POSITION_CONTAINS)>0&&eo.add(ro)}return Xr.filter(function(oo,ao){return!eo.has(ao)})},getTopParent=function(Xr){return Xr.parentNode?getTopParent(Xr.parentNode):Xr},getAllAffectedNodes=function(Xr){var eo=asArray(Xr);return eo.filter(Boolean).reduce(function(to,ro){var no=ro.getAttribute(FOCUS_GROUP);return to.push.apply(to,no?filterNested(toArray(getTopParent(ro).querySelectorAll("[".concat(FOCUS_GROUP,'="').concat(no,'"]:not([').concat(FOCUS_DISABLED,'="disabled"])')))):[ro]),to},[])},safeProbe=function(Xr){try{return Xr()}catch{return}},getActiveElement=function(Xr){if(Xr===void 0&&(Xr=document),!(!Xr||!Xr.activeElement)){var eo=Xr.activeElement;return eo.shadowRoot?getActiveElement(eo.shadowRoot):eo instanceof HTMLIFrameElement&&safeProbe(function(){return eo.contentWindow.document})?getActiveElement(eo.contentWindow.document):eo}},focusInFrame=function(Xr,eo){return Xr===eo},focusInsideIframe=function(Xr,eo){return!!toArray(Xr.querySelectorAll("iframe")).some(function(to){return focusInFrame(to,eo)})},focusInside=function(Xr,eo){return eo===void 0&&(eo=getActiveElement(getFirst(Xr).ownerDocument)),!eo||eo.dataset&&eo.dataset.focusGuard?!1:getAllAffectedNodes(Xr).some(function(to){return contains(to,eo)||focusInsideIframe(to,eo)})},focusIsHidden=function(Xr){Xr===void 0&&(Xr=document);var eo=getActiveElement(Xr);return eo?toArray(Xr.querySelectorAll("[".concat(FOCUS_ALLOW,"]"))).some(function(to){return contains(to,eo)}):!1},findSelectedRadio=function(Xr,eo){return eo.filter(isRadioElement).filter(function(to){return to.name===Xr.name}).filter(function(to){return to.checked})[0]||Xr},correctNode=function(Xr,eo){return isRadioElement(Xr)&&Xr.name?findSelectedRadio(Xr,eo):Xr},correctNodes=function(Xr){var eo=new Set;return Xr.forEach(function(to){return eo.add(correctNode(to,Xr))}),Xr.filter(function(to){return eo.has(to)})},pickFirstFocus=function(Xr){return Xr[0]&&Xr.length>1?correctNode(Xr[0],Xr):Xr[0]},pickFocusable=function(Xr,eo){return Xr.length>1?Xr.indexOf(correctNode(Xr[eo],Xr)):eo},NEW_FOCUS="NEW_FOCUS",newFocus=function(Xr,eo,to,ro){var no=Xr.length,io=Xr[0],oo=Xr[no-1],ao=isGuard(to);if(!(to&&Xr.indexOf(to)>=0)){var so=to!==void 0?eo.indexOf(to):-1,co=ro?eo.indexOf(ro):so,lo=ro?Xr.indexOf(ro):-1,fo=so-co,ho=eo.indexOf(io),go=eo.indexOf(oo),yo=correctNodes(eo),vo=to!==void 0?yo.indexOf(to):-1,wo=vo-(ro?yo.indexOf(ro):so),Eo=pickFocusable(Xr,0),ko=pickFocusable(Xr,no-1);if(so===-1||lo===-1)return NEW_FOCUS;if(!fo&&lo>=0)return lo;if(so<=ho&&ao&&Math.abs(fo)>1)return ko;if(so>=go&&ao&&Math.abs(fo)>1)return Eo;if(fo&&Math.abs(wo)>1)return lo;if(so<=ho)return ko;if(so>go)return Eo;if(fo)return Math.abs(fo)>1?lo:(no+lo+fo)%no}},findAutoFocused=function(Xr){return function(eo){var to,ro=(to=getDataset(eo))===null||to===void 0?void 0:to.autofocus;return eo.autofocus||ro!==void 0&&ro!=="false"||Xr.indexOf(eo)>=0}},pickAutofocus=function(Xr,eo,to){var ro=Xr.map(function(io){var oo=io.node;return oo}),no=filterAutoFocusable(ro.filter(findAutoFocused(to)));return no&&no.length?pickFirstFocus(no):pickFirstFocus(filterAutoFocusable(eo))},getParents=function(Xr,eo){return eo===void 0&&(eo=[]),eo.push(Xr),Xr.parentNode&&getParents(Xr.parentNode.host||Xr.parentNode,eo),eo},getCommonParent=function(Xr,eo){for(var to=getParents(Xr),ro=getParents(eo),no=0;no=0)return io}return!1},getTopCommonParent=function(Xr,eo,to){var ro=asArray(Xr),no=asArray(eo),io=ro[0],oo=!1;return no.filter(Boolean).forEach(function(ao){oo=getCommonParent(oo||ao,ao)||oo,to.filter(Boolean).forEach(function(so){var co=getCommonParent(io,so);co&&(!oo||contains(co,oo)?oo=co:oo=getCommonParent(co,oo))})}),oo},allParentAutofocusables=function(Xr,eo){return Xr.reduce(function(to,ro){return to.concat(parentAutofocusables(ro,eo))},[])},reorderNodes=function(Xr,eo){var to=new Map;return eo.forEach(function(ro){return to.set(ro.node,ro)}),Xr.map(function(ro){return to.get(ro)}).filter(isDefined)},getFocusMerge=function(Xr,eo){var to=getActiveElement(asArray(Xr).length>0?document:getFirst(Xr).ownerDocument),ro=getAllAffectedNodes(Xr).filter(isNotAGuard),no=getTopCommonParent(to||Xr,Xr,ro),io=new Map,oo=getAllTabbableNodes(ro,io),ao=getTabbableNodes(ro,io).filter(function(go){var yo=go.node;return isNotAGuard(yo)});if(!(!ao[0]&&(ao=oo,!ao[0]))){var so=getAllTabbableNodes([no],io).map(function(go){var yo=go.node;return yo}),co=reorderNodes(so,ao),lo=co.map(function(go){var yo=go.node;return yo}),fo=newFocus(lo,so,to,eo);if(fo===NEW_FOCUS){var ho=pickAutofocus(oo,lo,allParentAutofocusables(ro,io));if(ho)return{node:ho};console.warn("focus-lock: cannot find any node to move focus into");return}return fo===void 0?fo:co[fo]}},getFocusabledIn=function(Xr){var eo=getAllAffectedNodes(Xr).filter(isNotAGuard),to=getTopCommonParent(Xr,Xr,eo),ro=new Map,no=getTabbableNodes([to],ro,!0),io=getTabbableNodes(eo,ro).filter(function(oo){var ao=oo.node;return isNotAGuard(ao)}).map(function(oo){var ao=oo.node;return ao});return no.map(function(oo){var ao=oo.node,so=oo.index;return{node:ao,index:so,lockItem:io.indexOf(ao)>=0,guard:isGuard(ao)}})},focusOn=function(Xr,eo){"focus"in Xr&&Xr.focus(eo),"contentWindow"in Xr&&Xr.contentWindow&&Xr.contentWindow.focus()},guardCount=0,lockDisabled=!1,setFocus=function(Xr,eo,to){to===void 0&&(to={});var ro=getFocusMerge(Xr,eo);if(!lockDisabled&&ro){if(guardCount>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),lockDisabled=!0,setTimeout(function(){lockDisabled=!1},1);return}guardCount++,focusOn(ro.node,to.focusOptions),guardCount--}};function deferAction(Xr){var eo=window,to=eo.setImmediate;typeof to<"u"?to(Xr):setTimeout(Xr,1)}var focusOnBody=function(){return document&&document.activeElement===document.body},isFreeFocus=function(){return focusOnBody()||focusIsHidden()},lastActiveTrap=null,lastActiveFocus=null,lastPortaledElement=null,focusWasOutsideWindow=!1,defaultWhitelist=function(){return!0},focusWhitelisted=function(eo){return(lastActiveTrap.whiteList||defaultWhitelist)(eo)},recordPortal=function(eo,to){lastPortaledElement={observerNode:eo,portaledElement:to}},focusIsPortaledPair=function(eo){return lastPortaledElement&&lastPortaledElement.portaledElement===eo};function autoGuard(Xr,eo,to,ro){var no=null,io=Xr;do{var oo=ro[io];if(oo.guard)oo.node.dataset.focusAutoGuard&&(no=oo);else if(oo.lockItem){if(io!==Xr)return;no=null}else break}while((io+=to)!==eo);no&&(no.node.tabIndex=0)}var extractRef=function(eo){return eo&&"current"in eo?eo.current:eo},focusWasOutside=function(eo){return eo?!!focusWasOutsideWindow:focusWasOutsideWindow==="meanwhile"},checkInHost=function Xr(eo,to,ro){return to&&(to.host===eo&&(!to.activeElement||ro.contains(to.activeElement))||to.parentNode&&Xr(eo,to.parentNode,ro))},withinHost=function(eo,to){return to.some(function(ro){return checkInHost(eo,ro,ro)})},activateTrap=function(){var eo=!1;if(lastActiveTrap){var to=lastActiveTrap,ro=to.observed,no=to.persistentFocus,io=to.autoFocus,oo=to.shards,ao=to.crossFrame,so=to.focusOptions,co=ro||lastPortaledElement&&lastPortaledElement.portaledElement,lo=document&&document.activeElement;if(co){var fo=[co].concat(oo.map(extractRef).filter(Boolean));if((!lo||focusWhitelisted(lo))&&(no||focusWasOutside(ao)||!isFreeFocus()||!lastActiveFocus&&io)&&(co&&!(focusInside(fo)||lo&&withinHost(lo,fo)||focusIsPortaledPair(lo))&&(document&&!lastActiveFocus&&lo&&!io?(lo.blur&&lo.blur(),document.body.focus()):(eo=setFocus(fo,lastActiveFocus,{focusOptions:so}),lastPortaledElement={})),focusWasOutsideWindow=!1,lastActiveFocus=document&&document.activeElement),document){var ho=document&&document.activeElement,go=getFocusabledIn(fo),yo=go.map(function(vo){var wo=vo.node;return wo}).indexOf(ho);yo>-1&&(go.filter(function(vo){var wo=vo.guard,Eo=vo.node;return wo&&Eo.dataset.focusAutoGuard}).forEach(function(vo){var wo=vo.node;return wo.removeAttribute("tabIndex")}),autoGuard(yo,go.length,1,go),autoGuard(yo,-1,-1,go))}}}return eo},onTrap=function(eo){activateTrap()&&eo&&(eo.stopPropagation(),eo.preventDefault())},onBlur=function(){return deferAction(activateTrap)},onFocus=function(eo){var to=eo.target,ro=eo.currentTarget;ro.contains(to)||recordPortal(ro,to)},FocusWatcher=function(){return null},onWindowBlur=function(){focusWasOutsideWindow="just",setTimeout(function(){focusWasOutsideWindow="meanwhile"},0)},attachHandler=function(){document.addEventListener("focusin",onTrap),document.addEventListener("focusout",onBlur),window.addEventListener("blur",onWindowBlur)},detachHandler=function(){document.removeEventListener("focusin",onTrap),document.removeEventListener("focusout",onBlur),window.removeEventListener("blur",onWindowBlur)};function reducePropsToState(Xr){return Xr.filter(function(eo){var to=eo.disabled;return!to})}function handleStateChangeOnClient(Xr){var eo=Xr.slice(-1)[0];eo&&!lastActiveTrap&&attachHandler();var to=lastActiveTrap,ro=to&&eo&&eo.id===to.id;lastActiveTrap=eo,to&&!ro&&(to.onDeactivation(),Xr.filter(function(no){var io=no.id;return io===to.id}).length||to.returnFocus(!eo)),eo?(lastActiveFocus=null,(!ro||to.observed!==eo.observed)&&eo.onActivation(),activateTrap(),deferAction(activateTrap)):(detachHandler(),lastActiveFocus=null)}mediumFocus.assignSyncMedium(onFocus);mediumBlur.assignMedium(onBlur);mediumEffect.assignMedium(function(Xr){return Xr({moveFocusInside:setFocus,focusInside})});const FocusTrap=withSideEffect(reducePropsToState,handleStateChangeOnClient)(FocusWatcher);var FocusLockCombination=reactExports.forwardRef(function(eo,to){return reactExports.createElement(FocusLock,_extends$1m({sideCar:FocusTrap,ref:to},eo))}),_ref=FocusLock.propTypes||{};_ref.sideCar;_objectWithoutPropertiesLoose$1e(_ref,["sideCar"]);FocusLockCombination.propTypes={};var browser$h={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$a={};let toSJISFunction;const CODEWORDS_COUNT=[0,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];utils$a.getSymbolSize=function(eo){if(!eo)throw new Error('"version" cannot be null or undefined');if(eo<1||eo>40)throw new Error('"version" should be in range from 1 to 40');return eo*4+17};utils$a.getSymbolTotalCodewords=function(eo){return CODEWORDS_COUNT[eo]};utils$a.getBCHDigit=function(Xr){let eo=0;for(;Xr!==0;)eo++,Xr>>>=1;return eo};utils$a.setToSJISFunction=function(eo){if(typeof eo!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=eo};utils$a.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$a.toSJIS=function(eo){return toSJISFunction(eo)};var errorCorrectionLevel={};(function(Xr){Xr.L={bit:1},Xr.M={bit:0},Xr.Q={bit:3},Xr.H={bit:2};function eo(to){if(typeof to!="string")throw new Error("Param is not a string");switch(to.toLowerCase()){case"l":case"low":return Xr.L;case"m":case"medium":return Xr.M;case"q":case"quartile":return Xr.Q;case"h":case"high":return Xr.H;default:throw new Error("Unknown EC Level: "+to)}}Xr.isValid=function(ro){return ro&&typeof ro.bit<"u"&&ro.bit>=0&&ro.bit<4},Xr.from=function(ro,no){if(Xr.isValid(ro))return ro;try{return eo(ro)}catch{return no}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(Xr){const eo=Math.floor(Xr/8);return(this.buffer[eo]>>>7-Xr%8&1)===1},put:function(Xr,eo){for(let to=0;to>>eo-to-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(Xr){const eo=Math.floor(this.length/8);this.buffer.length<=eo&&this.buffer.push(0),Xr&&(this.buffer[eo]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(Xr){if(!Xr||Xr<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=Xr,this.data=new Uint8Array(Xr*Xr),this.reservedBit=new Uint8Array(Xr*Xr)}BitMatrix$1.prototype.set=function(Xr,eo,to,ro){const no=Xr*this.size+eo;this.data[no]=to,ro&&(this.reservedBit[no]=!0)};BitMatrix$1.prototype.get=function(Xr,eo){return this.data[Xr*this.size+eo]};BitMatrix$1.prototype.xor=function(Xr,eo,to){this.data[Xr*this.size+eo]^=to};BitMatrix$1.prototype.isReserved=function(Xr,eo){return this.reservedBit[Xr*this.size+eo]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(Xr){const eo=utils$a.getSymbolSize;Xr.getRowColCoords=function(ro){if(ro===1)return[];const no=Math.floor(ro/7)+2,io=eo(ro),oo=io===145?26:Math.ceil((io-13)/(2*no-2))*2,ao=[io-7];for(let so=1;so=0&&no<=7},Xr.from=function(no){return Xr.isValid(no)?parseInt(no,10):void 0},Xr.getPenaltyN1=function(no){const io=no.size;let oo=0,ao=0,so=0,co=null,lo=null;for(let fo=0;fo=5&&(oo+=eo.N1+(ao-5)),co=go,ao=1),go=no.get(ho,fo),go===lo?so++:(so>=5&&(oo+=eo.N1+(so-5)),lo=go,so=1)}ao>=5&&(oo+=eo.N1+(ao-5)),so>=5&&(oo+=eo.N1+(so-5))}return oo},Xr.getPenaltyN2=function(no){const io=no.size;let oo=0;for(let ao=0;ao=10&&(ao===1488||ao===93)&&oo++,so=so<<1&2047|no.get(lo,co),lo>=10&&(so===1488||so===93)&&oo++}return oo*eo.N3},Xr.getPenaltyN4=function(no){let io=0;const oo=no.data.length;for(let so=0;so=0;){const oo=io[0];for(let so=0;so0){const io=new Uint8Array(this.degree);return io.set(ro,no),io}return ro};var reedSolomonEncoder=ReedSolomonEncoder$1,version$k={},mode={},versionCheck={};versionCheck.isValid=function(eo){return!isNaN(eo)&&eo>=1&&eo<=40};var regex={};const numeric$1="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r -]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric$1,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(eo){return TEST_KANJI.test(eo)};regex.testNumeric=function(eo){return TEST_NUMERIC.test(eo)};regex.testAlphanumeric=function(eo){return TEST_ALPHANUMERIC.test(eo)};(function(Xr){const eo=versionCheck,to=regex;Xr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},Xr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},Xr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},Xr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},Xr.MIXED={bit:-1},Xr.getCharCountIndicator=function(io,oo){if(!io.ccBits)throw new Error("Invalid mode: "+io);if(!eo.isValid(oo))throw new Error("Invalid version: "+oo);return oo>=1&&oo<10?io.ccBits[0]:oo<27?io.ccBits[1]:io.ccBits[2]},Xr.getBestModeForData=function(io){return to.testNumeric(io)?Xr.NUMERIC:to.testAlphanumeric(io)?Xr.ALPHANUMERIC:to.testKanji(io)?Xr.KANJI:Xr.BYTE},Xr.toString=function(io){if(io&&io.id)return io.id;throw new Error("Invalid mode")},Xr.isValid=function(io){return io&&io.bit&&io.ccBits};function ro(no){if(typeof no!="string")throw new Error("Param is not a string");switch(no.toLowerCase()){case"numeric":return Xr.NUMERIC;case"alphanumeric":return Xr.ALPHANUMERIC;case"kanji":return Xr.KANJI;case"byte":return Xr.BYTE;default:throw new Error("Unknown mode: "+no)}}Xr.from=function(io,oo){if(Xr.isValid(io))return io;try{return ro(io)}catch{return oo}}})(mode);(function(Xr){const eo=utils$a,to=errorCorrectionCode,ro=errorCorrectionLevel,no=mode,io=versionCheck,oo=7973,ao=eo.getBCHDigit(oo);function so(ho,go,yo){for(let vo=1;vo<=40;vo++)if(go<=Xr.getCapacity(vo,yo,ho))return vo}function co(ho,go){return no.getCharCountIndicator(ho,go)+4}function lo(ho,go){let yo=0;return ho.forEach(function(vo){const wo=co(vo.mode,go);yo+=wo+vo.getBitsLength()}),yo}function fo(ho,go){for(let yo=1;yo<=40;yo++)if(lo(ho,yo)<=Xr.getCapacity(yo,go,no.MIXED))return yo}Xr.from=function(go,yo){return io.isValid(go)?parseInt(go,10):yo},Xr.getCapacity=function(go,yo,vo){if(!io.isValid(go))throw new Error("Invalid QR Code version");typeof vo>"u"&&(vo=no.BYTE);const wo=eo.getSymbolTotalCodewords(go),Eo=to.getTotalCodewordsCount(go,yo),ko=(wo-Eo)*8;if(vo===no.MIXED)return ko;const Ao=ko-co(vo,go);switch(vo){case no.NUMERIC:return Math.floor(Ao/10*3);case no.ALPHANUMERIC:return Math.floor(Ao/11*2);case no.KANJI:return Math.floor(Ao/13);case no.BYTE:default:return Math.floor(Ao/8)}},Xr.getBestVersionForData=function(go,yo){let vo;const wo=ro.from(yo,ro.M);if(Array.isArray(go)){if(go.length>1)return fo(go,wo);if(go.length===0)return 1;vo=go[0]}else vo=go;return so(vo.mode,vo.getLength(),wo)},Xr.getEncodedBits=function(go){if(!io.isValid(go)||go<7)throw new Error("Invalid QR Code version");let yo=go<<12;for(;eo.getBCHDigit(yo)-ao>=0;)yo^=oo<=0;)no^=G15<0&&(ro=this.data.substr(to),no=parseInt(ro,10),eo.put(no,io*3+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(Xr){this.mode=Mode$3.ALPHANUMERIC,this.data=Xr}AlphanumericData.getBitsLength=function(eo){return 11*Math.floor(eo/2)+6*(eo%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(eo){let to;for(to=0;to+2<=this.data.length;to+=2){let ro=ALPHA_NUM_CHARS.indexOf(this.data[to])*45;ro+=ALPHA_NUM_CHARS.indexOf(this.data[to+1]),eo.put(ro,11)}this.data.length%2&&eo.put(ALPHA_NUM_CHARS.indexOf(this.data[to]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(eo){for(var to=[],ro=eo.length,no=0;no=55296&&io<=56319&&ro>no+1){var oo=eo.charCodeAt(no+1);oo>=56320&&oo<=57343&&(io=(io-55296)*1024+oo-56320+65536,no+=1)}if(io<128){to.push(io);continue}if(io<2048){to.push(io>>6|192),to.push(io&63|128);continue}if(io<55296||io>=57344&&io<65536){to.push(io>>12|224),to.push(io>>6&63|128),to.push(io&63|128);continue}if(io>=65536&&io<=1114111){to.push(io>>18|240),to.push(io>>12&63|128),to.push(io>>6&63|128),to.push(io&63|128);continue}to.push(239,191,189)}return new Uint8Array(to).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(Xr){this.mode=Mode$2.BYTE,typeof Xr=="string"&&(Xr=encodeUtf8(Xr)),this.data=new Uint8Array(Xr)}ByteData.getBitsLength=function(eo){return eo*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(Xr){for(let eo=0,to=this.data.length;eo=33088&&to<=40956)to-=33088;else if(to>=57408&&to<=60351)to-=49472;else throw new Error("Invalid SJIS character: "+this.data[eo]+` -Make sure your charset is UTF-8`);to=(to>>>8&255)*192+(to&255),Xr.put(to,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(Xr){var eo={single_source_shortest_paths:function(to,ro,no){var io={},oo={};oo[ro]=0;var ao=eo.PriorityQueue.make();ao.push(ro,0);for(var so,co,lo,fo,ho,go,yo,vo,wo;!ao.empty();){so=ao.pop(),co=so.value,fo=so.cost,ho=to[co]||{};for(lo in ho)ho.hasOwnProperty(lo)&&(go=ho[lo],yo=fo+go,vo=oo[lo],wo=typeof oo[lo]>"u",(wo||vo>yo)&&(oo[lo]=yo,ao.push(lo,yo),io[lo]=co))}if(typeof no<"u"&&typeof oo[no]>"u"){var Eo=["Could not find a path from ",ro," to ",no,"."].join("");throw new Error(Eo)}return io},extract_shortest_path_from_predecessor_list:function(to,ro){for(var no=[],io=ro;io;)no.push(io),to[io],io=to[io];return no.reverse(),no},find_path:function(to,ro,no){var io=eo.single_source_shortest_paths(to,ro,no);return eo.extract_shortest_path_from_predecessor_list(io,no)},PriorityQueue:{make:function(to){var ro=eo.PriorityQueue,no={},io;to=to||{};for(io in ro)ro.hasOwnProperty(io)&&(no[io]=ro[io]);return no.queue=[],no.sorter=to.sorter||ro.default_sorter,no},default_sorter:function(to,ro){return to.cost-ro.cost},push:function(to,ro){var no={value:to,cost:ro};this.queue.push(no),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};Xr.exports=eo})(dijkstra);var dijkstraExports=dijkstra.exports;(function(Xr){const eo=mode,to=numericData,ro=alphanumericData,no=byteData,io=kanjiData,oo=regex,ao=utils$a,so=dijkstraExports;function co(Eo){return unescape(encodeURIComponent(Eo)).length}function lo(Eo,ko,Ao){const Po=[];let jo;for(;(jo=Eo.exec(Ao))!==null;)Po.push({data:jo[0],index:jo.index,mode:ko,length:jo[0].length});return Po}function fo(Eo){const ko=lo(oo.NUMERIC,eo.NUMERIC,Eo),Ao=lo(oo.ALPHANUMERIC,eo.ALPHANUMERIC,Eo);let Po,jo;return ao.isKanjiModeEnabled()?(Po=lo(oo.BYTE,eo.BYTE,Eo),jo=lo(oo.KANJI,eo.KANJI,Eo)):(Po=lo(oo.BYTE_KANJI,eo.BYTE,Eo),jo=[]),ko.concat(Ao,Po,jo).sort(function(No,Do){return No.index-Do.index}).map(function(No){return{data:No.data,mode:No.mode,length:No.length}})}function ho(Eo,ko){switch(ko){case eo.NUMERIC:return to.getBitsLength(Eo);case eo.ALPHANUMERIC:return ro.getBitsLength(Eo);case eo.KANJI:return io.getBitsLength(Eo);case eo.BYTE:return no.getBitsLength(Eo)}}function go(Eo){return Eo.reduce(function(ko,Ao){const Po=ko.length-1>=0?ko[ko.length-1]:null;return Po&&Po.mode===Ao.mode?(ko[ko.length-1].data+=Ao.data,ko):(ko.push(Ao),ko)},[])}function yo(Eo){const ko=[];for(let Ao=0;Ao=0&&ao<=6&&(so===0||so===6)||so>=0&&so<=6&&(ao===0||ao===6)||ao>=2&&ao<=4&&so>=2&&so<=4?Xr.set(io+ao,oo+so,!0,!0):Xr.set(io+ao,oo+so,!1,!0))}}function setupTimingPattern(Xr){const eo=Xr.size;for(let to=8;to>ao&1)===1,Xr.set(no,io,oo,!0),Xr.set(io,no,oo,!0)}function setupFormatInfo(Xr,eo,to){const ro=Xr.size,no=FormatInfo.getEncodedBits(eo,to);let io,oo;for(io=0;io<15;io++)oo=(no>>io&1)===1,io<6?Xr.set(io,8,oo,!0):io<8?Xr.set(io+1,8,oo,!0):Xr.set(ro-15+io,8,oo,!0),io<8?Xr.set(8,ro-io-1,oo,!0):io<9?Xr.set(8,15-io-1+1,oo,!0):Xr.set(8,15-io-1,oo,!0);Xr.set(ro-8,8,1,!0)}function setupData(Xr,eo){const to=Xr.size;let ro=-1,no=to-1,io=7,oo=0;for(let ao=to-1;ao>0;ao-=2)for(ao===6&&ao--;;){for(let so=0;so<2;so++)if(!Xr.isReserved(no,ao-so)){let co=!1;oo>>io&1)===1),Xr.set(no,ao-so,co),io--,io===-1&&(oo++,io=7)}if(no+=ro,no<0||to<=no){no-=ro,ro=-ro;break}}}function createData(Xr,eo,to){const ro=new BitBuffer;to.forEach(function(so){ro.put(so.mode.bit,4),ro.put(so.getLength(),Mode.getCharCountIndicator(so.mode,Xr)),so.write(ro)});const no=Utils$1.getSymbolTotalCodewords(Xr),io=ECCode.getTotalCodewordsCount(Xr,eo),oo=(no-io)*8;for(ro.getLengthInBits()+4<=oo&&ro.put(0,4);ro.getLengthInBits()%8!==0;)ro.putBit(0);const ao=(oo-ro.getLengthInBits())/8;for(let so=0;soio.call(this,no,eo,this),eo);return ro===void 0&&(ro=this.getDefault()),ro}_validate(eo,to={},ro){let{sync:no,path:io,from:oo=[],originalValue:ao=eo,strict:so=this.spec.strict,abortEarly:co=this.spec.abortEarly}=to,lo=eo;so||(lo=this._cast(lo,_extends$1k({assert:!1},to)));let uo={value:lo,path:io,options:to,originalValue:ao,schema:this,label:this.spec.label,sync:no,from:oo},ho=[];this._typeError&&ho.push(this._typeError);let go=[];this._whitelistError&&go.push(this._whitelistError),this._blacklistError&&go.push(this._blacklistError),runTests({args:uo,value:lo,path:io,sync:no,tests:ho,endEarly:co},bo=>{if(bo)return void ro(bo,lo);runTests({tests:this.tests.concat(go),args:uo,path:io,sync:no,value:lo,endEarly:co},ro)})}validate(eo,to,ro){let no=this.resolve(_extends$1k({},to,{value:eo}));return typeof ro=="function"?no._validate(eo,to,ro):new Promise((io,oo)=>no._validate(eo,to,(ao,so)=>{ao?oo(ao):io(so)}))}validateSync(eo,to){let ro=this.resolve(_extends$1k({},to,{value:eo})),no;return ro._validate(eo,_extends$1k({},to,{sync:!0}),(io,oo)=>{if(io)throw io;no=oo}),no}isValid(eo,to){return this.validate(eo,to).then(()=>!0,ro=>{if(ValidationError.isError(ro))return!1;throw ro})}isValidSync(eo,to){try{return this.validateSync(eo,to),!0}catch(ro){if(ValidationError.isError(ro))return!1;throw ro}}_getDefault(){let eo=this.spec.default;return eo==null?eo:typeof eo=="function"?eo.call(this):clone$1(eo)}getDefault(eo){return this.resolve(eo||{})._getDefault()}default(eo){return arguments.length===0?this._getDefault():this.clone({default:eo})}strict(eo=!0){let to=this.clone();return to.spec.strict=eo,to}_isPresent(eo){return eo!=null}defined(eo=mixed.defined){return this.test({message:eo,name:"defined",exclusive:!0,test(to){return to!==void 0}})}required(eo=mixed.required){return this.clone({presence:"required"}).withMutation(to=>to.test({message:eo,name:"required",exclusive:!0,test(ro){return this.schema._isPresent(ro)}}))}notRequired(){let eo=this.clone({presence:"optional"});return eo.tests=eo.tests.filter(to=>to.OPTIONS.name!=="required"),eo}nullable(eo=!0){return this.clone({nullable:eo!==!1})}transform(eo){let to=this.clone();return to.transforms.push(eo),to}test(...eo){let to;if(eo.length===1?typeof eo[0]=="function"?to={test:eo[0]}:to=eo[0]:eo.length===2?to={name:eo[0],test:eo[1]}:to={name:eo[0],message:eo[1],test:eo[2]},to.message===void 0&&(to.message=mixed.default),typeof to.test!="function")throw new TypeError("`test` is a required parameters");let ro=this.clone(),no=createValidation(to),io=to.exclusive||to.name&&ro.exclusiveTests[to.name]===!0;if(to.exclusive&&!to.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return to.name&&(ro.exclusiveTests[to.name]=!!to.exclusive),ro.tests=ro.tests.filter(oo=>!(oo.OPTIONS.name===to.name&&(io||oo.OPTIONS.test===no.OPTIONS.test))),ro.tests.push(no),ro}when(eo,to){!Array.isArray(eo)&&typeof eo!="string"&&(to=eo,eo=".");let ro=this.clone(),no=toArray$1(eo).map(io=>new Reference$1(io));return no.forEach(io=>{io.isSibling&&ro.deps.push(io.key)}),ro.conditions.push(new Condition(no,to)),ro}typeError(eo){let to=this.clone();return to._typeError=createValidation({message:eo,name:"typeError",test(ro){return ro!==void 0&&!this.schema.isType(ro)?this.createError({params:{type:this.schema._type}}):!0}}),to}oneOf(eo,to=mixed.oneOf){let ro=this.clone();return eo.forEach(no=>{ro._whitelist.add(no),ro._blacklist.delete(no)}),ro._whitelistError=createValidation({message:to,name:"oneOf",test(no){if(no===void 0)return!0;let io=this.schema._whitelist,oo=io.resolveAll(this.resolve);return oo.includes(no)?!0:this.createError({params:{values:io.toArray().join(", "),resolved:oo}})}}),ro}notOneOf(eo,to=mixed.notOneOf){let ro=this.clone();return eo.forEach(no=>{ro._blacklist.add(no),ro._whitelist.delete(no)}),ro._blacklistError=createValidation({message:to,name:"notOneOf",test(no){let io=this.schema._blacklist,oo=io.resolveAll(this.resolve);return oo.includes(no)?this.createError({params:{values:io.toArray().join(", "),resolved:oo}}):!0}}),ro}strip(eo=!0){let to=this.clone();return to.spec.strip=eo,to}describe(){const eo=this.clone(),{label:to,meta:ro}=eo.spec;return{meta:ro,label:to,type:eo.type,oneOf:eo._whitelist.describe(),notOneOf:eo._blacklist.describe(),tests:eo.tests.map(io=>({name:io.OPTIONS.name,params:io.OPTIONS.params})).filter((io,oo,ao)=>ao.findIndex(so=>so.name===io.name)===oo)}}}BaseSchema.prototype.__isYupSchema__=!0;for(const Xr of["validate","validateSync"])BaseSchema.prototype[`${Xr}At`]=function(eo,to,ro={}){const{parent:no,parentPath:io,schema:oo}=getIn$1(this,eo,to,ro.context);return oo[Xr](no&&no[io],_extends$1k({},ro,{parent:no,path:eo}))};for(const Xr of["equals","is"])BaseSchema.prototype[Xr]=BaseSchema.prototype.oneOf;for(const Xr of["not","nope"])BaseSchema.prototype[Xr]=BaseSchema.prototype.notOneOf;BaseSchema.prototype.optional=BaseSchema.prototype.notRequired;const Mixed=BaseSchema;Mixed.prototype;const isAbsent=Xr=>Xr==null;function create$6(){return new BooleanSchema}class BooleanSchema extends BaseSchema{constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(eo){if(!this.isType(eo)){if(/^(true|1)$/i.test(String(eo)))return!0;if(/^(false|0)$/i.test(String(eo)))return!1}return eo})})}_typeCheck(eo){return eo instanceof Boolean&&(eo=eo.valueOf()),typeof eo=="boolean"}isTrue(eo=boolean$4.isValue){return this.test({message:eo,name:"is-value",exclusive:!0,params:{value:"true"},test(to){return isAbsent(to)||to===!0}})}isFalse(eo=boolean$4.isValue){return this.test({message:eo,name:"is-value",exclusive:!0,params:{value:"false"},test(to){return isAbsent(to)||to===!1}})}}create$6.prototype=BooleanSchema.prototype;let rEmail=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,rUrl=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rUUID=/^(?:[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,isTrimmed=Xr=>isAbsent(Xr)||Xr===Xr.trim(),objStringTag={}.toString();function create$5(){return new StringSchema}class StringSchema extends BaseSchema{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(eo){if(this.isType(eo)||Array.isArray(eo))return eo;const to=eo!=null&&eo.toString?eo.toString():eo;return to===objStringTag?eo:to})})}_typeCheck(eo){return eo instanceof String&&(eo=eo.valueOf()),typeof eo=="string"}_isPresent(eo){return super._isPresent(eo)&&!!eo.length}length(eo,to=string$5.length){return this.test({message:to,name:"length",exclusive:!0,params:{length:eo},test(ro){return isAbsent(ro)||ro.length===this.resolve(eo)}})}min(eo,to=string$5.min){return this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(ro){return isAbsent(ro)||ro.length>=this.resolve(eo)}})}max(eo,to=string$5.max){return this.test({name:"max",exclusive:!0,message:to,params:{max:eo},test(ro){return isAbsent(ro)||ro.length<=this.resolve(eo)}})}matches(eo,to){let ro=!1,no,io;return to&&(typeof to=="object"?{excludeEmptyString:ro=!1,message:no,name:io}=to:no=to),this.test({name:io||"matches",message:no||string$5.matches,params:{regex:eo},test:oo=>isAbsent(oo)||oo===""&&ro||oo.search(eo)!==-1})}email(eo=string$5.email){return this.matches(rEmail,{name:"email",message:eo,excludeEmptyString:!0})}url(eo=string$5.url){return this.matches(rUrl,{name:"url",message:eo,excludeEmptyString:!0})}uuid(eo=string$5.uuid){return this.matches(rUUID,{name:"uuid",message:eo,excludeEmptyString:!1})}ensure(){return this.default("").transform(eo=>eo===null?"":eo)}trim(eo=string$5.trim){return this.transform(to=>to!=null?to.trim():to).test({message:eo,name:"trim",test:isTrimmed})}lowercase(eo=string$5.lowercase){return this.transform(to=>isAbsent(to)?to:to.toLowerCase()).test({message:eo,name:"string_case",exclusive:!0,test:to=>isAbsent(to)||to===to.toLowerCase()})}uppercase(eo=string$5.uppercase){return this.transform(to=>isAbsent(to)?to:to.toUpperCase()).test({message:eo,name:"string_case",exclusive:!0,test:to=>isAbsent(to)||to===to.toUpperCase()})}}create$5.prototype=StringSchema.prototype;var isoReg=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function parseIsoDate(Xr){var eo=[1,4,5,6,7,10,11],to=0,ro,no;if(no=isoReg.exec(Xr)){for(var io=0,oo;oo=eo[io];++io)no[oo]=+no[oo]||0;no[2]=(+no[2]||1)-1,no[3]=+no[3]||1,no[7]=no[7]?String(no[7]).substr(0,3):0,(no[8]===void 0||no[8]==="")&&(no[9]===void 0||no[9]==="")?ro=+new Date(no[1],no[2],no[3],no[4],no[5],no[6],no[7]):(no[8]!=="Z"&&no[9]!==void 0&&(to=no[10]*60+no[11],no[9]==="+"&&(to=0-to)),ro=Date.UTC(no[1],no[2],no[3],no[4],no[5]+to,no[6],no[7]))}else ro=Date.parse?Date.parse(Xr):NaN;return ro}let invalidDate=new Date(""),isDate=Xr=>Object.prototype.toString.call(Xr)==="[object Date]";class DateSchema extends BaseSchema{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(eo){return this.isType(eo)?eo:(eo=parseIsoDate(eo),isNaN(eo)?invalidDate:new Date(eo))})})}_typeCheck(eo){return isDate(eo)&&!isNaN(eo.getTime())}prepareParam(eo,to){let ro;if(Reference$1.isRef(eo))ro=eo;else{let no=this.cast(eo);if(!this._typeCheck(no))throw new TypeError(`\`${to}\` must be a Date or a value that can be \`cast()\` to a Date`);ro=no}return ro}min(eo,to=date.min){let ro=this.prepareParam(eo,"min");return this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(no){return isAbsent(no)||no>=this.resolve(ro)}})}max(eo,to=date.max){let ro=this.prepareParam(eo,"max");return this.test({message:to,name:"max",exclusive:!0,params:{max:eo},test(no){return isAbsent(no)||no<=this.resolve(ro)}})}}DateSchema.INVALID_DATE=invalidDate;DateSchema.prototype;function arrayReduce$1(Xr,eo,to,ro){var no=-1,io=Xr==null?0:Xr.length;for(ro&&io&&(to=Xr[++no]);++nono?0:no+eo),to=to>no?no:to,to<0&&(to+=no),no=eo>to?0:to-eo>>>0,eo>>>=0;for(var io=Array(no);++ro=ro?Xr:baseSlice(Xr,eo,to)}var _castSlice=castSlice$1,rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsVarRange$1="\\ufe0e\\ufe0f",rsZWJ$1="\\u200d",reHasUnicode=RegExp("["+rsZWJ$1+rsAstralRange$1+rsComboRange$1+rsVarRange$1+"]");function hasUnicode$2(Xr){return reHasUnicode.test(Xr)}var _hasUnicode=hasUnicode$2;function asciiToArray$1(Xr){return Xr.split("")}var _asciiToArray=asciiToArray$1,rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsVarRange="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange+"]",rsCombo="["+rsComboRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ="\\u200d",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");function unicodeToArray$1(Xr){return Xr.match(reUnicode)||[]}var _unicodeToArray=unicodeToArray$1,asciiToArray=_asciiToArray,hasUnicode$1=_hasUnicode,unicodeToArray=_unicodeToArray;function stringToArray$1(Xr){return hasUnicode$1(Xr)?unicodeToArray(Xr):asciiToArray(Xr)}var _stringToArray=stringToArray$1,castSlice=_castSlice,hasUnicode=_hasUnicode,stringToArray=_stringToArray,toString$6=toString_1;function createCaseFirst$1(Xr){return function(eo){eo=toString$6(eo);var to=hasUnicode(eo)?stringToArray(eo):void 0,ro=to?to[0]:eo.charAt(0),no=to?castSlice(to,1).join(""):eo.slice(1);return ro[Xr]()+no}}var _createCaseFirst=createCaseFirst$1,createCaseFirst=_createCaseFirst,upperFirst$1=createCaseFirst("toUpperCase"),upperFirst_1=upperFirst$1,toString$5=toString_1,upperFirst=upperFirst_1;function capitalize$3(Xr){return upperFirst(toString$5(Xr).toLowerCase())}var capitalize_1=capitalize$3,capitalize$2=capitalize_1,createCompounder=_createCompounder,camelCase=createCompounder(function(Xr,eo,to){return eo=eo.toLowerCase(),Xr+(to?capitalize$2(eo):eo)}),camelCase_1=camelCase;const camelCase$1=getDefaultExportFromCjs$2(camelCase_1);var baseAssignValue$1=_baseAssignValue,baseForOwn=_baseForOwn,baseIteratee=_baseIteratee;function mapKeys(Xr,eo){var to={};return eo=baseIteratee(eo),baseForOwn(Xr,function(ro,no,io){baseAssignValue$1(to,eo(ro,no,io),ro)}),to}var mapKeys_1=mapKeys;const mapKeys$1=getDefaultExportFromCjs$2(mapKeys_1);var toposort$2={exports:{}};toposort$2.exports=function(Xr){return toposort(uniqueNodes(Xr),Xr)};toposort$2.exports.array=toposort;function toposort(Xr,eo){var to=Xr.length,ro=new Array(to),no={},io=to,oo=makeOutgoingEdges(eo),ao=makeNodesHash(Xr);for(eo.forEach(function(co){if(!ao.has(co[0])||!ao.has(co[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});io--;)no[io]||so(Xr[io],io,new Set);return ro;function so(co,lo,uo){if(uo.has(co)){var ho;try{ho=", node was:"+JSON.stringify(co)}catch{ho=""}throw new Error("Cyclic dependency"+ho)}if(!ao.has(co))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(co));if(!no[lo]){no[lo]=!0;var go=oo.get(co)||new Set;if(go=Array.from(go),lo=go.length){uo.add(co);do{var bo=go[--lo];so(bo,ao.get(bo),uo)}while(lo);uo.delete(co)}ro[--to]=co}}}function uniqueNodes(Xr){for(var eo=new Set,to=0,ro=Xr.length;to`${oo}-${ao}`));function io(oo,ao){let so=propertyExpr.split(oo)[0];ro.add(so),no.has(`${ao}-${so}`)||to.push([ao,so])}for(const oo in Xr)if(has$1(Xr,oo)){let ao=Xr[oo];ro.add(oo),Reference$1.isRef(ao)&&ao.isSibling?io(ao.path,oo):isSchema(ao)&&"deps"in ao&&ao.deps.forEach(so=>io(so,oo))}return toposort$1.array(Array.from(ro),to).reverse()}function findIndex(Xr,eo){let to=1/0;return Xr.some((ro,no)=>{var io;if(((io=eo.path)==null?void 0:io.indexOf(ro))!==-1)return to=no,!0}),to}function sortByKeyOrder(Xr){return(eo,to)=>findIndex(Xr,eo)-findIndex(Xr,to)}function _extends$1j(){return _extends$1j=Object.assign||function(Xr){for(var eo=1;eoObject.prototype.toString.call(Xr)==="[object Object]";function unknown$4(Xr,eo){let to=Object.keys(Xr.fields);return Object.keys(eo).filter(ro=>to.indexOf(ro)===-1)}const defaultSort=sortByKeyOrder([]);class ObjectSchema extends BaseSchema{constructor(eo){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=defaultSort,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(function(ro){if(typeof ro=="string")try{ro=JSON.parse(ro)}catch{ro=null}return this.isType(ro)?ro:null}),eo&&this.shape(eo)})}_typeCheck(eo){return isObject$b(eo)||typeof eo=="function"}_cast(eo,to={}){var ro;let no=super._cast(eo,to);if(no===void 0)return this.getDefault();if(!this._typeCheck(no))return no;let io=this.fields,oo=(ro=to.stripUnknown)!=null?ro:this.spec.noUnknown,ao=this._nodes.concat(Object.keys(no).filter(uo=>this._nodes.indexOf(uo)===-1)),so={},co=_extends$1j({},to,{parent:so,__validating:to.__validating||!1}),lo=!1;for(const uo of ao){let ho=io[uo],go=has$1(no,uo);if(ho){let bo,wo=no[uo];co.path=(to.path?`${to.path}.`:"")+uo,ho=ho.resolve({value:wo,context:to.context,parent:so});let Eo="spec"in ho?ho.spec:void 0,$o=Eo==null?void 0:Eo.strict;if(Eo!=null&&Eo.strip){lo=lo||uo in no;continue}bo=!to.__validating||!$o?ho.cast(no[uo],co):no[uo],bo!==void 0&&(so[uo]=bo)}else go&&!oo&&(so[uo]=no[uo]);so[uo]!==no[uo]&&(lo=!0)}return lo?so:no}_validate(eo,to={},ro){let no=[],{sync:io,from:oo=[],originalValue:ao=eo,abortEarly:so=this.spec.abortEarly,recursive:co=this.spec.recursive}=to;oo=[{schema:this,value:ao},...oo],to.__validating=!0,to.originalValue=ao,to.from=oo,super._validate(eo,to,(lo,uo)=>{if(lo){if(!ValidationError.isError(lo)||so)return void ro(lo,uo);no.push(lo)}if(!co||!isObject$b(uo)){ro(no[0]||null,uo);return}ao=ao||uo;let ho=this._nodes.map(go=>(bo,wo)=>{let Eo=go.indexOf(".")===-1?(to.path?`${to.path}.`:"")+go:`${to.path||""}["${go}"]`,$o=this.fields[go];if($o&&"validate"in $o){$o.validate(uo[go],_extends$1j({},to,{path:Eo,from:oo,strict:!0,parent:uo,originalValue:ao[go]}),wo);return}wo(null)});runTests({sync:io,tests:ho,value:uo,errors:no,endEarly:so,sort:this._sortErrors,path:to.path},ro)})}clone(eo){const to=super.clone(eo);return to.fields=_extends$1j({},this.fields),to._nodes=this._nodes,to._excludedEdges=this._excludedEdges,to._sortErrors=this._sortErrors,to}concat(eo){let to=super.concat(eo),ro=to.fields;for(let[no,io]of Object.entries(this.fields)){const oo=ro[no];oo===void 0?ro[no]=io:oo instanceof BaseSchema&&io instanceof BaseSchema&&(ro[no]=io.concat(oo))}return to.withMutation(()=>to.shape(ro,this._excludedEdges))}getDefaultFromShape(){let eo={};return this._nodes.forEach(to=>{const ro=this.fields[to];eo[to]="default"in ro?ro.getDefault():void 0}),eo}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(eo,to=[]){let ro=this.clone(),no=Object.assign(ro.fields,eo);return ro.fields=no,ro._sortErrors=sortByKeyOrder(Object.keys(no)),to.length&&(Array.isArray(to[0])||(to=[to]),ro._excludedEdges=[...ro._excludedEdges,...to]),ro._nodes=sortFields(no,ro._excludedEdges),ro}pick(eo){const to={};for(const ro of eo)this.fields[ro]&&(to[ro]=this.fields[ro]);return this.clone().withMutation(ro=>(ro.fields={},ro.shape(to)))}omit(eo){const to=this.clone(),ro=to.fields;to.fields={};for(const no of eo)delete ro[no];return to.withMutation(()=>to.shape(ro))}from(eo,to,ro){let no=propertyExpr.getter(eo,!0);return this.transform(io=>{if(io==null)return io;let oo=io;return has$1(io,eo)&&(oo=_extends$1j({},io),ro||delete oo[eo],oo[to]=no(io)),oo})}noUnknown(eo=!0,to=object$1.noUnknown){typeof eo=="string"&&(to=eo,eo=!0);let ro=this.test({name:"noUnknown",exclusive:!0,message:to,test(no){if(no==null)return!0;const io=unknown$4(this.schema,no);return!eo||io.length===0||this.createError({params:{unknown:io.join(", ")}})}});return ro.spec.noUnknown=eo,ro}unknown(eo=!0,to=object$1.noUnknown){return this.noUnknown(!eo,to)}transformKeys(eo){return this.transform(to=>to&&mapKeys$1(to,(ro,no)=>eo(no)))}camelCase(){return this.transformKeys(camelCase$1)}snakeCase(){return this.transformKeys(snakeCase$1)}constantCase(){return this.transformKeys(eo=>snakeCase$1(eo).toUpperCase())}describe(){let eo=super.describe();return eo.fields=mapValues$1(this.fields,to=>to.describe()),eo}}function create$4(Xr){return new ObjectSchema(Xr)}create$4.prototype=ObjectSchema.prototype;function _extends$1i(){return _extends$1i=Object.assign||function(Xr){for(var eo=1;eo{this.transform(function(to){if(typeof to=="string")try{to=JSON.parse(to)}catch{to=null}return this.isType(to)?to:null})})}_typeCheck(eo){return Array.isArray(eo)}get _subType(){return this.innerType}_cast(eo,to){const ro=super._cast(eo,to);if(!this._typeCheck(ro)||!this.innerType)return ro;let no=!1;const io=ro.map((oo,ao)=>{const so=this.innerType.cast(oo,_extends$1i({},to,{path:`${to.path||""}[${ao}]`}));return so!==oo&&(no=!0),so});return no?io:ro}_validate(eo,to={},ro){var no,io;let oo=[],ao=to.sync,so=to.path,co=this.innerType,lo=(no=to.abortEarly)!=null?no:this.spec.abortEarly,uo=(io=to.recursive)!=null?io:this.spec.recursive,ho=to.originalValue!=null?to.originalValue:eo;super._validate(eo,to,(go,bo)=>{if(go){if(!ValidationError.isError(go)||lo)return void ro(go,bo);oo.push(go)}if(!uo||!co||!this._typeCheck(bo)){ro(oo[0]||null,bo);return}ho=ho||bo;let wo=new Array(bo.length);for(let Eo=0;Eoco.validate($o,Ro,jo)}runTests({sync:ao,path:so,value:bo,errors:oo,endEarly:lo,tests:wo},ro)})}clone(eo){const to=super.clone(eo);return to.innerType=this.innerType,to}concat(eo){let to=super.concat(eo);return to.innerType=this.innerType,eo.innerType&&(to.innerType=to.innerType?to.innerType.concat(eo.innerType):eo.innerType),to}of(eo){let to=this.clone();if(!isSchema(eo))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+printValue(eo));return to.innerType=eo,to}length(eo,to=array$4.length){return this.test({message:to,name:"length",exclusive:!0,params:{length:eo},test(ro){return isAbsent(ro)||ro.length===this.resolve(eo)}})}min(eo,to){return to=to||array$4.min,this.test({message:to,name:"min",exclusive:!0,params:{min:eo},test(ro){return isAbsent(ro)||ro.length>=this.resolve(eo)}})}max(eo,to){return to=to||array$4.max,this.test({message:to,name:"max",exclusive:!0,params:{max:eo},test(ro){return isAbsent(ro)||ro.length<=this.resolve(eo)}})}ensure(){return this.default(()=>[]).transform((eo,to)=>this._typeCheck(eo)?eo:to==null?[]:[].concat(to))}compact(eo){let to=eo?(ro,no,io)=>!eo(ro,no,io):ro=>!!ro;return this.transform(ro=>ro!=null?ro.filter(to):ro)}describe(){let eo=super.describe();return this.innerType&&(eo.innerType=this.innerType.describe()),eo}nullable(eo=!0){return super.nullable(eo)}defined(){return super.defined()}required(eo){return super.required(eo)}}create$3.prototype=ArraySchema.prototype;const userFieldsSchema=create$4().shape({alias:create$5(),btcWallet:create$5(),ckbWallet:create$5(),country:create$5(),discordNotification:create$6(),dogeWallet:create$5(),email:create$5(),emailNotification:create$6(),firstName:create$5(),jobTitle:create$5(),kasWallet:create$5(),kdaWallet:create$5(),lastName:create$5(),ltcWallet:create$5(),metadata:create$4(),newsletterNotification:create$6(),phoneNumber:create$5(),tShirtSize:create$5(),team:create$5(),username:create$5()}),FooterAnimationContext=reactExports.createContext(void 0),FooterAnimationContextProvider=({children:Xr})=>{const{view:eo}=useViewContext(),[to,ro]=reactExports.useState(!1);reactExports.useEffect(()=>{ro(!1)},[eo]);const no=reactExports.useMemo(()=>({isFooterExpanded:to,setIsFooterExpanded:ro}),[to]);return jsxRuntimeExports.jsx(FooterAnimationContext.Provider,{value:no,children:jsxRuntimeExports.jsx("div",{children:Xr})})},useFooterAnimationContext=()=>{const Xr=reactExports.useContext(FooterAnimationContext);if(!Xr)throw new Error("Can only call useFooterAnimationContext inside FooterAnimationContextProvider");return Xr};var _path$12,_excluded$1e=["title","titleId"];function _extends$1h(){return _extends$1h=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1g(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgError=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1e(eo,_excluded$1e);return reactExports.createElement("svg",_extends$1h({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$12||(_path$12=reactExports.createElement("path",{d:"M9.99 0C4.47 0 0 4.48 0 10s4.47 10 9.99 10C15.52 20 20 15.52 20 10S15.52 0 9.99 0ZM10 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8Zm-1-5h2v2H9v-2Zm0-8h2v6H9V5Z",fill:"currentcolor"})))};const Icon=({children:Xr,className:eo="",color:to,size:ro})=>{const no=classNames(eo,to?`icon--color-${to}`:"",ro?`icon--size-${ro}`:"");return reactExports.cloneElement(Xr,{className:no})},Typography=Xr=>{var{as:eo="p",variant:to,weight:ro,color:no,transform:io,className:oo="",truncate:ao=!1,style:so}=Xr,co=__rest$7(Xr,["as","variant","weight","color","transform","className","truncate","style"]);const lo={body_mini:"typography--body-mini",body_normal:"typography--body-normal",body_small:"typography--body-small",button_primary:"typography--button-primary",button_secondary:"typography--button-secondary",button_tertiary:"typography--button-tertiary",numbers_big:"typography--numbers-big",numbers_medium:"typography--numbers-medium",title:"typography--title"},uo={bold:"typography--bold",medium:"typography--medium",regular:"typography--regular"},ho={"brand-primary":"typography--brand-primary","error-1":"typography--dynamic-error-1","error-2":"typography--dynamic-error-2","green-1":"typography--connection-green-1",inherit:"typography--inherit",link:"typography--link",primary:"typography--primary",secondary:"typography--secondary",tertiary:"typography--tertiary",tooltip:"typography--tooltip",white:"typography--white"},go={uppercase:"typography--uppercase"},bo=classNames("typography",to?lo[to]:"",ro?uo[ro]:"",no?ho[no]:"",io?go[io]:"",{"typography--truncate":ao},oo);return jsxRuntimeExports.jsx(eo,Object.assign({style:so,className:bo},co))},errorIconMap={error:jsxRuntimeExports.jsx(SvgError,{})},Alert=({children:Xr,icon:eo,variant:to="error",contentDataTestId:ro,className:no=""})=>jsxRuntimeExports.jsxs("div",{className:classNames("alert",{"alert--error":to==="error","alert--info":to==="info","alert--warning":to==="warning"},no),children:[eo&&jsxRuntimeExports.jsx(Icon,{size:"small",className:"alert__icon",children:typeof eo=="string"?errorIconMap[eo]:eo}),jsxRuntimeExports.jsx(Typography,{variant:"body_small","data-testid":ro,children:Xr})]}),FieldsStateContext=reactExports.createContext(void 0),FieldsStateProvider=({children:Xr})=>{const eo=reactExports.useRef();return jsxRuntimeExports.jsx(FieldsStateContext.Provider,{value:{selectedPhoneCountry:eo},children:Xr})},useFieldsState=()=>{const Xr=reactExports.useContext(FieldsStateContext);if(!Xr)throw new DynamicError("Can only call useFieldsState inside FieldsStateProvider");return Xr},PHONE_NUMBER_REGEX=/^(\+[1-9]\d{1,14})?$/,validatePhoneLength=(Xr,eo)=>de$4({dialCode:eo.dialCode,phone:Xr}).length>0,customFieldValidationMap={checkbox:create$3(),select:create$5(),text:create$5()},useFields=()=>{const{t:Xr}=useTranslation(),{selectedPhoneCountry:eo}=useFieldsState();return{fieldsConfig:reactExports.useMemo(()=>({alias:{key:"dyn_collect_user_data.fields.alias.label",label:Xr("dyn_collect_user_data.fields.alias.label"),type:"string",validation:create$5().trim()},country:{key:"dyn_collect_user_data.fields.country.label",label:Xr("dyn_collect_user_data.fields.country.label"),type:"select",validation:create$5().oneOf(countryCodes.map(ro=>ro.code))},email:{autoComplete:"email",key:"dyn_collect_user_data.fields.email.label",label:Xr("dyn_collect_user_data.fields.email.label"),type:"email",validation:create$5().email(Xr("dyn_collect_user_data.fields.email.validation"))},firstName:{key:"dyn_collect_user_data.fields.first_name.label",label:Xr("dyn_collect_user_data.fields.first_name.label"),type:"string",validation:create$5().trim()},jobTitle:{key:"dyn_collect_user_data.fields.job_title.label",label:Xr("dyn_collect_user_data.fields.job_title.label"),type:"string",validation:create$5().trim()},lastName:{key:"dyn_collect_user_data.fields.last_name.label",label:Xr("dyn_collect_user_data.fields.last_name.label"),type:"string",validation:create$5().trim()},phoneNumber:{key:"dyn_collect_user_data.fields.phone_number.label",label:Xr("dyn_collect_user_data.fields.phone_number.label"),type:"string",validation:create$5().test("length",Xr("dyn_collect_user_data.fields.phone_number.too_short"),ro=>eo.current?ro===void 0||ro.length===0||validatePhoneLength(ro,eo.current):!0).matches(PHONE_NUMBER_REGEX,Xr("dyn_collect_user_data.fields.phone_number.validation"))},policiesConsent:{key:"dyn_collect_user_data.fields.policies_consent.label",label:Xr("dyn_collect_user_data.fields.policies_consent.label"),type:"boolean",validation:create$6()},tShirtSize:{key:"dyn_collect_user_data.fields.t_shirt_size.label",label:Xr("dyn_collect_user_data.fields.t_shirt_size.label"),type:"select",validation:create$5().oneOf(tShirtSizes)},team:{key:"dyn_collect_user_data.fields.team.label",label:Xr("dyn_collect_user_data.fields.team.label"),type:"select",validation:create$5().oneOf(teamNames)},username:{key:"dyn_collect_user_data.fields.username.label",label:Xr("dyn_collect_user_data.fields.username.label"),type:"string",validation:create$5().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?_-]{3,20}$/,Xr("dyn_collect_user_data.fields.username.validation"))}}),[eo,Xr])}},{getEnvironmentId,useEnvironmentId,setEnvironmentId}=createStoreState("environmentId"),{getWalletConnectorOptions,setWalletConnectorOptions,useWalletConnectorOptions,resetWalletConnectorOptions}=createStoreState("walletConnectorOptions"),IconButton=reactExports.forwardRef((Xr,eo)=>{var{className:to="",color:ro}=Xr,no=__rest$7(Xr,["className","color"]);return jsxRuntimeExports.jsx("button",Object.assign({},no,{className:classNames("icon-button",to),ref:eo}))});IconButton.displayName="IconButton";const InlineWidget=reactExports.forwardRef(({children:Xr,className:eo,dataTestId:to},ro)=>jsxRuntimeExports.jsx("div",{ref:ro,"data-testid":to,className:classNames("inline-widget",eo),children:Xr}));InlineWidget.displayName="InlineWidget";const Input=reactExports.forwardRef((Xr,eo)=>{var{className:to="",id:ro,label:no,type:io,onChange:oo,onBlur:ao,name:so,value:co,optional:lo,error:uo=!1,disabled:ho,message:go,placeholder:bo,variant:wo="dense",suffix:Eo,containerClassName:$o}=Xr,Co=__rest$7(Xr,["className","id","label","type","onChange","onBlur","name","value","optional","error","disabled","message","placeholder","variant","suffix","containerClassName"]);return jsxRuntimeExports.jsxs("div",{className:classNames("input__container",$o,{"input__container--dense":wo==="dense","input__container--regular":wo==="regular"}),children:[jsxRuntimeExports.jsx("input",Object.assign({},Co,{name:so,value:co,onChange:oo,onBlur:ao,type:io,id:ro,placeholder:wo==="regular"||!no?bo:no,disabled:ho,className:classNames("input",to,{"input--no-label":!no,input__error:uo,input__has_trailing:lo}),ref:eo})),jsxRuntimeExports.jsx("label",{htmlFor:ro,className:classNames("input__label"),children:no}),Eo&&jsxRuntimeExports.jsx("div",{className:classNames("input__suffix"),children:Eo}),lo&&jsxRuntimeExports.jsx("span",{className:"input__trailing",children:"Optional"}),!!go&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:classNames("input__message",{input__message__error:uo}),children:go})]})});Input.displayName="Input";const IsNestedBrowserContext=reactExports.createContext(!1),IsBrowser=({children:Xr})=>{const eo=reactExports.useContext(IsNestedBrowserContext),[to,ro]=reactExports.useState(!1);return reactExports.useEffect(()=>{ro(!0)},[]),to||eo?jsxRuntimeExports.jsx(IsNestedBrowserContext.Provider,{value:!0,children:Xr}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},mapTransformOriginToClassName={"bottom-left":"popper-content__transform-origin-bottom-left","bottom-right":"popper-content__transform-origin-bottom-right","top-left":"popper-content__transform-origin-top-left","top-right":"popper-content__transform-origin-top-right"},PopperContent=reactExports.forwardRef(({children:Xr,transformOrigin:eo,style:to,className:ro},no)=>jsxRuntimeExports.jsx("div",{"data-testid":"popper-content",ref:no,className:classNames("popper-content",mapTransformOriginToClassName[eo],ro),style:to,children:Xr}));PopperContent.displayName="PopperContent";const popperContext=reactExports.createContext(void 0),PopperProvider=({children:Xr})=>{const{Provider:eo}=popperContext,to=reactExports.useRef(null);return jsxRuntimeExports.jsx(eo,{value:{containerRef:to},children:jsxRuntimeExports.jsx("div",{ref:to,style:{position:"relative"},children:Xr})})},usePopper=()=>{const Xr=reactExports.useContext(popperContext);if(!Xr)throw new Error("To use popper, use the PopperProvider above in the dom hierarchy");return Xr},getChildPosition=(Xr,eo)=>{const to=Xr.getBoundingClientRect(),ro=eo.getBoundingClientRect();return{left:ro.x-to.x,top:ro.y-to.y}},Popper=reactExports.forwardRef(({anchorRef:Xr,anchorOrigin:eo="top-left",transformOrigin:to="top-left",children:ro,style:no,className:io},oo)=>{const{containerRef:ao}=usePopper(),[so,co]=reactExports.useState(),lo=ao.current;reactExports.useEffect(()=>{const ho=ao.current,go=Xr.current;!ho||!go||co(getChildPosition(ho,go))},[Xr,ao,co]);const uo=reactExports.useMemo(()=>{var ho;const go=(ho=Xr.current)===null||ho===void 0?void 0:ho.getBoundingClientRect();if(!(!so||!go))switch(eo){case"top-left":return so;case"top-right":return Object.assign(Object.assign({},so),{left:so.left+go.width});case"bottom-left":return Object.assign(Object.assign({},so),{top:so.top+go.height});case"bottom-right":return Object.assign(Object.assign({},so),{left:so.left+go.width,top:so.top+go.height});default:return}},[so,Xr,eo]);return!uo||lo===null?null:reactDomExports.createPortal(jsxRuntimeExports.jsx(PopperContent,{ref:oo,transformOrigin:to,style:Object.assign(Object.assign({},uo),no),className:io,children:ro}),lo)});Popper.displayName="Popper";const useForwardedRef=Xr=>{const eo=reactExports.useRef(null);return reactExports.useEffect(()=>{Xr&&(typeof Xr=="function"?Xr(eo.current):Xr.current=eo.current)},[Xr,eo]),eo},useOnClickOutside=(Xr,eo)=>{const to=reactExports.useRef(eo);to.current=eo,reactExports.useEffect(()=>{const ro=no=>{no.stopPropagation();const io=no.composedPath().shift();!Xr.current||Xr.current.contains(no.currentTarget)||Xr.current.contains(io)||to.current(no)};return document.addEventListener("touchstart",ro),document.addEventListener("click",ro),()=>{document.removeEventListener("touchstart",ro),document.removeEventListener("click",ro)}},[Xr])},isScrollable=Xr=>{const eo=Xr.scrollHeight>Xr.clientHeight,ro=window.getComputedStyle(Xr).overflowY.indexOf("hidden")!==-1;return eo&&!ro},watchToScrollInHierarchy=(Xr,eo,to)=>{const ro=[];let no=eo;for(;no!==null;){const io=no===Xr;if(isScrollable(no)&&(no.addEventListener("scroll",to),ro.push(no)),no=no.parentElement,io)break}return()=>ro.forEach(io=>io.removeEventListener("scroll",to))},animationFrameTimeout=(Xr,eo)=>{const to=performance.now(),ro={id:-1},no=()=>{ro.id=requestAnimationFrame(io=>{io-to>eo?Xr():no()})};return no(),ro},clearAnimationFrameTimeout=Xr=>{Xr.id&&cancelAnimationFrame(Xr.id)},useIsFirstRender=()=>{const Xr=reactExports.useRef(!0);return reactExports.useEffect(()=>{Xr.current&&(Xr.current=!1)},[]),Xr.current},useUpdateEffect=(Xr,eo)=>{const to=useIsFirstRender();reactExports.useEffect(()=>{if(!to)return Xr()},eo)},useTransitionEvents=(Xr,eo)=>{const to={ENTERED:eo==null?void 0:eo.onEntered,ENTERING:eo==null?void 0:eo.onEntering,EXITING:eo==null?void 0:eo.onExiting,UNMOUNT:eo==null?void 0:eo.onUnmount};return useUpdateEffect(()=>{var ro;return(ro=to[Xr])===null||ro===void 0||ro.call(to),()=>{var no;Xr==="EXITING"&&((no=to.UNMOUNT)===null||no===void 0||no.call(to))}},[Xr])},DEFAULT_DURATION=100,useTransition=Xr=>{var{isShown:eo,inDuration:to,outDuration:ro,duration:no=DEFAULT_DURATION,delay:io,inDelay:oo,outDelay:ao,animateOnMount:so=!0}=Xr,co=__rest$7(Xr,["isShown","inDuration","outDuration","duration","delay","inDelay","outDelay","animateOnMount"]);const lo=so?"UNMOUNT":"ENTERED",uo=reactExports.useRef({id:-1}),ho=reactExports.useRef({id:-1}),[go,bo]=reactExports.useState(lo),[wo,Eo]=reactExports.useState(!so),[$o,Co]=reactExports.useState(no),Ro=(Bo,Mo)=>{Mo?ho.current=animationFrameTimeout(Bo,Mo):Bo()},Oo=reactExports.useCallback(()=>{const Bo=to||no;Co(Bo),Eo(!0),bo("ENTERING"),uo.current=animationFrameTimeout(()=>{bo("ENTERED")},Bo)},[no,to]),jo=reactExports.useCallback(()=>{const Bo=ro||no;Co(Bo),bo("EXITING"),uo.current=animationFrameTimeout(()=>{Eo(!1),bo("UNMOUNT")},Bo)},[no,ro]);return reactExports.useEffect(()=>(eo&&go!=="ENTERED"?Ro(Oo,oo||io):!eo&&go!=="UNMOUNT"&&Ro(jo,ao||io),()=>{clearAnimationFrameTimeout(uo.current),clearAnimationFrameTimeout(ho.current)}),[oo,ao,Oo,jo,eo,io,go]),useTransitionEvents(go,co),{currentDuration:$o,mount:wo,stage:go}},IN_DURATION=300,OUT_DURATION=300,Dropdown=reactExports.forwardRef((Xr,eo)=>{var{children:to,isOpen:ro,onClickOutside:no,onScroll:io,className:oo,style:ao,maxHeight:so=300}=Xr,co=__rest$7(Xr,["children","isOpen","onClickOutside","onScroll","className","style","maxHeight"]);const{containerRef:lo}=usePopper(),uo=useForwardedRef(eo);useOnClickOutside(uo,()=>no==null?void 0:no()),reactExports.useEffect(()=>{if(!(!lo.current||!co.anchorRef.current))return watchToScrollInHierarchy(lo.current,co.anchorRef.current,()=>io==null?void 0:io())},[lo,co.anchorRef,io]);const{mount:ho,stage:go,currentDuration:bo}=useTransition({inDuration:IN_DURATION,isShown:ro,outDuration:OUT_DURATION}),wo=classNames({"dropdown--entering":go==="ENTERING","dropdown--exiting":go==="EXITING"});return ho?jsxRuntimeExports.jsx(Popper,Object.assign({},co,{ref:uo,children:jsxRuntimeExports.jsx("div",{className:classNames("dropdown",wo,oo),style:Object.assign({"--max-height":`${so}px`,animationDuration:`${bo}ms`},ao),children:to})})):null});Dropdown.displayName="Dropdown";const getZoomTransitionDefaultStyles=Xr=>({transition:`transform ${Xr}ms linear, opacity ${Xr}ms linear`}),transitionStyles$2={ENTERED:{opacity:"1",transform:"scale(1)"},ENTERING:{opacity:"0",transform:"scale(0.9)"},EXITING:{opacity:"0",transform:"scale(1.1)"}},UnoptimizedZoomTransition=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);const{mount:no,stage:io,currentDuration:oo}=useTransition(ro),ao=getZoomTransitionDefaultStyles(oo),so=transitionStyles$2[io];return no?jsxRuntimeExports.jsx("div",{className:classNames(to,"zoom-transition__root"),style:Object.assign(Object.assign({},ao),so),children:eo}):null};React.memo(UnoptimizedZoomTransition);const getSlideInUpTransitionDefaultStyles=(Xr,eo="linear")=>({transition:`transform ${Xr}ms ${eo}, opacity ${Xr}ms ${eo}`}),transitionStyles$1={ENTERED:{transform:"translateY(0)"},ENTERING:{transform:"translateY(0.625rem)"},EXITING:{transform:"translateY(0.625rem)"}},UnoptimizedSlideInUpTransition=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);const{mount:no,stage:io,currentDuration:oo}=useTransition(ro),ao=getSlideInUpTransitionDefaultStyles(oo),so=transitionStyles$1[io];return no?jsxRuntimeExports.jsx("div",{className:to,style:Object.assign(Object.assign({},ao),so),children:eo}):null},SlideInUpTransition=React.memo(UnoptimizedSlideInUpTransition),getOpacityTransitionDefaultStyles=Xr=>({transition:`opacity ${Xr}ms linear`}),transitionStyles={ENTERED:{opacity:1},ENTERING:{opacity:0},EXITING:{opacity:0},UNMOUNT:{opacity:0}},UnoptimizedOpacityTransition=Xr=>{var{children:eo,style:to,className:ro}=Xr,no=__rest$7(Xr,["children","style","className"]);const{mount:io,stage:oo,currentDuration:ao}=useTransition(no),so=getOpacityTransitionDefaultStyles(ao),co=transitionStyles[oo];return io?jsxRuntimeExports.jsx("div",{className:ro,style:Object.assign(Object.assign(Object.assign({},so),co),to),children:eo}):null},OpacityTransition=React.memo(UnoptimizedOpacityTransition),OverlayCardContext=reactExports.createContext(void 0),OverlayCardTarget=({children:Xr})=>{const[eo,to]=reactExports.useState(null),[ro,no]=reactExports.useState(new Set);return jsxRuntimeExports.jsxs(OverlayCardContext.Provider,{value:reactExports.useMemo(()=>({closeCard:io=>no(oo=>(oo.delete(io),new Set(oo))),openCard:io=>no(oo=>(oo.add(io),new Set(oo))),portal:eo}),[eo]),children:[Xr,ro.size>0&&jsxRuntimeExports.jsx("div",{className:"overlay-card-target",ref:to})]})},useOverlayCardTarget=Xr=>{var eo;const to=reactExports.useContext(OverlayCardContext),ro=reactExports.useId();return reactExports.useEffect(()=>{if(!(!to||!Xr))return to.openCard(ro),()=>{to.closeCard(ro)}},[to,ro,Xr]),(eo=to==null?void 0:to.portal)!==null&&eo!==void 0?eo:void 0},useForceUpdate=()=>{const[,Xr]=reactExports.useState(0);return()=>Xr(eo=>eo+1)},usePrevious=Xr=>{const eo=reactExports.useRef();return reactExports.useEffect(()=>{eo.current=Xr},[Xr]),eo.current};function _objectWithoutPropertiesLoose$1f(Xr,eo){if(Xr==null)return{};var to={};for(var ro in Xr)if({}.hasOwnProperty.call(Xr,ro)){if(eo.includes(ro))continue;to[ro]=Xr[ro]}return to}var FOCUS_GROUP="data-focus-lock",FOCUS_DISABLED="data-focus-lock-disabled",FOCUS_ALLOW="data-no-focus-lock",FOCUS_AUTO="data-autofocus-inside",FOCUS_NO_AUTOFOCUS="data-no-autofocus",hiddenGuard={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},mediumFocus=createMedium({},function(Xr){var eo=Xr.target,to=Xr.currentTarget;return{target:eo,currentTarget:to}}),mediumBlur=createMedium(),mediumEffect=createMedium(),mediumSidecar=createSidecarMedium({async:!0}),emptyArray=[],FocusLock=reactExports.forwardRef(function(eo,to){var ro,no=reactExports.useState(),io=no[0],oo=no[1],ao=reactExports.useRef(),so=reactExports.useRef(!1),co=reactExports.useRef(null),lo=eo.children,uo=eo.disabled,ho=eo.noFocusGuards,go=eo.persistentFocus,bo=eo.crossFrame,wo=eo.autoFocus;eo.allowTextSelection;var Eo=eo.group,$o=eo.className,Co=eo.whiteList,Ro=eo.hasPositiveIndices,Oo=eo.shards,jo=Oo===void 0?emptyArray:Oo,Bo=eo.as,Mo=Bo===void 0?"div":Bo,Fo=eo.lockProps,Wo=Fo===void 0?{}:Fo,Jo=eo.sideCar,Po=eo.returnFocus,fo=eo.focusOptions,yo=eo.onActivation,vo=eo.onDeactivation,_o=reactExports.useState({}),So=_o[0],To=reactExports.useCallback(function(){co.current=co.current||document&&document.activeElement,ao.current&&yo&&yo(ao.current),so.current=!0},[yo]),Ao=reactExports.useCallback(function(){so.current=!1,vo&&vo(ao.current)},[vo]);reactExports.useEffect(function(){uo||(co.current=null)},[]);var ko=reactExports.useCallback(function(qo){var Ko=co.current;if(Ko&&Ko.focus){var Qo=typeof Po=="function"?Po(Ko):Po;if(Qo){var zo=typeof Qo=="object"?Qo:void 0;co.current=null,qo?Promise.resolve().then(function(){return Ko.focus(zo)}):Ko.focus(zo)}}},[Po]),mo=reactExports.useCallback(function(qo){so.current&&mediumFocus.useMedium(qo)},[]),Io=mediumBlur.useMedium,Do=reactExports.useCallback(function(qo){ao.current!==qo&&(ao.current=qo,oo(qo))},[]),Lo=_extends$1n((ro={},ro[FOCUS_DISABLED]=uo&&"disabled",ro[FOCUS_GROUP]=Eo,ro),Wo),Ho=ho!==!0,Yo=Ho&&ho!=="tail",Xo=useMergeRefs([to,Do]);return reactExports.createElement(reactExports.Fragment,null,Ho&&[reactExports.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:uo?-1:0,style:hiddenGuard}),Ro?reactExports.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:uo?-1:1,style:hiddenGuard}):null],!uo&&reactExports.createElement(Jo,{id:So,sideCar:mediumSidecar,observed:io,disabled:uo,persistentFocus:go,crossFrame:bo,autoFocus:wo,whiteList:Co,shards:jo,onActivation:To,onDeactivation:Ao,returnFocus:ko,focusOptions:fo}),reactExports.createElement(Mo,_extends$1n({ref:Xo},Lo,{className:$o,onBlur:Io,onFocus:mo}),lo),Yo&&reactExports.createElement("div",{"data-focus-guard":!0,tabIndex:uo?-1:0,style:hiddenGuard}))});FocusLock.propTypes={};FocusLock.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};function withSideEffect(Xr,eo){function to(ro){return ro.displayName||ro.name||"Component"}return function(no){var io=[],oo;function ao(){oo=Xr(io.map(function(co){return co.props})),eo(oo)}var so=function(co){_inheritsLoose(lo,co);function lo(){return co.apply(this,arguments)||this}lo.peek=function(){return oo};var uo=lo.prototype;return uo.componentDidMount=function(){io.push(this),ao()},uo.componentDidUpdate=function(){ao()},uo.componentWillUnmount=function(){var go=io.indexOf(this);io.splice(go,1),ao()},uo.render=function(){return React.createElement(no,this.props)},lo}(reactExports.PureComponent);return _defineProperty$2(so,"displayName","SideEffect("+to(no)+")"),so}}var toArray=function(Xr){for(var eo=Array(Xr.length),to=0;to=0}).sort(tabSort)},tabbables=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],queryTabbables=tabbables.join(","),queryGuardTabbables="".concat(queryTabbables,", [data-focus-guard]"),getFocusablesWithShadowDom=function(Xr,eo){return toArray((Xr.shadowRoot||Xr).children).reduce(function(to,ro){return to.concat(ro.matches(eo?queryGuardTabbables:queryTabbables)?[ro]:[],getFocusablesWithShadowDom(ro))},[])},getFocusablesWithIFrame=function(Xr,eo){var to;return Xr instanceof HTMLIFrameElement&&(!((to=Xr.contentDocument)===null||to===void 0)&&to.body)?getFocusables([Xr.contentDocument.body],eo):[Xr]},getFocusables=function(Xr,eo){return Xr.reduce(function(to,ro){var no,io=getFocusablesWithShadowDom(ro,eo),oo=(no=[]).concat.apply(no,io.map(function(ao){return getFocusablesWithIFrame(ao,eo)}));return to.concat(oo,ro.parentNode?toArray(ro.parentNode.querySelectorAll(queryTabbables)).filter(function(ao){return ao===ro}):[])},[])},getParentAutofocusables=function(Xr){var eo=Xr.querySelectorAll("[".concat(FOCUS_AUTO,"]"));return toArray(eo).map(function(to){return getFocusables([to])}).reduce(function(to,ro){return to.concat(ro)},[])},filterFocusable=function(Xr,eo){return toArray(Xr).filter(function(to){return isVisibleCached(eo,to)}).filter(function(to){return notHiddenInput(to)})},filterAutoFocusable=function(Xr,eo){return eo===void 0&&(eo=new Map),toArray(Xr).filter(function(to){return isAutoFocusAllowedCached(eo,to)})},getTabbableNodes=function(Xr,eo,to){return orderByTabIndex(filterFocusable(getFocusables(Xr,to),eo),!0,to)},getAllTabbableNodes=function(Xr,eo){return orderByTabIndex(filterFocusable(getFocusables(Xr),eo),!1)},parentAutofocusables=function(Xr,eo){return filterFocusable(getParentAutofocusables(Xr),eo)},contains=function(Xr,eo){return Xr.shadowRoot?contains(Xr.shadowRoot,eo):Object.getPrototypeOf(Xr).contains!==void 0&&Object.getPrototypeOf(Xr).contains.call(Xr,eo)?!0:toArray(Xr.children).some(function(to){var ro;if(to instanceof HTMLIFrameElement){var no=(ro=to.contentDocument)===null||ro===void 0?void 0:ro.body;return no?contains(no,eo):!1}return contains(to,eo)})},filterNested=function(Xr){for(var eo=new Set,to=Xr.length,ro=0;ro0&&eo.add(no),(io&Node.DOCUMENT_POSITION_CONTAINS)>0&&eo.add(ro)}return Xr.filter(function(oo,ao){return!eo.has(ao)})},getTopParent=function(Xr){return Xr.parentNode?getTopParent(Xr.parentNode):Xr},getAllAffectedNodes=function(Xr){var eo=asArray(Xr);return eo.filter(Boolean).reduce(function(to,ro){var no=ro.getAttribute(FOCUS_GROUP);return to.push.apply(to,no?filterNested(toArray(getTopParent(ro).querySelectorAll("[".concat(FOCUS_GROUP,'="').concat(no,'"]:not([').concat(FOCUS_DISABLED,'="disabled"])')))):[ro]),to},[])},safeProbe=function(Xr){try{return Xr()}catch{return}},getActiveElement=function(Xr){if(Xr===void 0&&(Xr=document),!(!Xr||!Xr.activeElement)){var eo=Xr.activeElement;return eo.shadowRoot?getActiveElement(eo.shadowRoot):eo instanceof HTMLIFrameElement&&safeProbe(function(){return eo.contentWindow.document})?getActiveElement(eo.contentWindow.document):eo}},focusInFrame=function(Xr,eo){return Xr===eo},focusInsideIframe=function(Xr,eo){return!!toArray(Xr.querySelectorAll("iframe")).some(function(to){return focusInFrame(to,eo)})},focusInside=function(Xr,eo){return eo===void 0&&(eo=getActiveElement(getFirst(Xr).ownerDocument)),!eo||eo.dataset&&eo.dataset.focusGuard?!1:getAllAffectedNodes(Xr).some(function(to){return contains(to,eo)||focusInsideIframe(to,eo)})},focusIsHidden=function(Xr){Xr===void 0&&(Xr=document);var eo=getActiveElement(Xr);return eo?toArray(Xr.querySelectorAll("[".concat(FOCUS_ALLOW,"]"))).some(function(to){return contains(to,eo)}):!1},findSelectedRadio=function(Xr,eo){return eo.filter(isRadioElement).filter(function(to){return to.name===Xr.name}).filter(function(to){return to.checked})[0]||Xr},correctNode=function(Xr,eo){return isRadioElement(Xr)&&Xr.name?findSelectedRadio(Xr,eo):Xr},correctNodes=function(Xr){var eo=new Set;return Xr.forEach(function(to){return eo.add(correctNode(to,Xr))}),Xr.filter(function(to){return eo.has(to)})},pickFirstFocus=function(Xr){return Xr[0]&&Xr.length>1?correctNode(Xr[0],Xr):Xr[0]},pickFocusable=function(Xr,eo){return Xr.length>1?Xr.indexOf(correctNode(Xr[eo],Xr)):eo},NEW_FOCUS="NEW_FOCUS",newFocus=function(Xr,eo,to,ro){var no=Xr.length,io=Xr[0],oo=Xr[no-1],ao=isGuard(to);if(!(to&&Xr.indexOf(to)>=0)){var so=to!==void 0?eo.indexOf(to):-1,co=ro?eo.indexOf(ro):so,lo=ro?Xr.indexOf(ro):-1,uo=so-co,ho=eo.indexOf(io),go=eo.indexOf(oo),bo=correctNodes(eo),wo=to!==void 0?bo.indexOf(to):-1,Eo=wo-(ro?bo.indexOf(ro):so),$o=pickFocusable(Xr,0),Co=pickFocusable(Xr,no-1);if(so===-1||lo===-1)return NEW_FOCUS;if(!uo&&lo>=0)return lo;if(so<=ho&&ao&&Math.abs(uo)>1)return Co;if(so>=go&&ao&&Math.abs(uo)>1)return $o;if(uo&&Math.abs(Eo)>1)return lo;if(so<=ho)return Co;if(so>go)return $o;if(uo)return Math.abs(uo)>1?lo:(no+lo+uo)%no}},findAutoFocused=function(Xr){return function(eo){var to,ro=(to=getDataset(eo))===null||to===void 0?void 0:to.autofocus;return eo.autofocus||ro!==void 0&&ro!=="false"||Xr.indexOf(eo)>=0}},pickAutofocus=function(Xr,eo,to){var ro=Xr.map(function(io){var oo=io.node;return oo}),no=filterAutoFocusable(ro.filter(findAutoFocused(to)));return no&&no.length?pickFirstFocus(no):pickFirstFocus(filterAutoFocusable(eo))},getParents=function(Xr,eo){return eo===void 0&&(eo=[]),eo.push(Xr),Xr.parentNode&&getParents(Xr.parentNode.host||Xr.parentNode,eo),eo},getCommonParent=function(Xr,eo){for(var to=getParents(Xr),ro=getParents(eo),no=0;no=0)return io}return!1},getTopCommonParent=function(Xr,eo,to){var ro=asArray(Xr),no=asArray(eo),io=ro[0],oo=!1;return no.filter(Boolean).forEach(function(ao){oo=getCommonParent(oo||ao,ao)||oo,to.filter(Boolean).forEach(function(so){var co=getCommonParent(io,so);co&&(!oo||contains(co,oo)?oo=co:oo=getCommonParent(co,oo))})}),oo},allParentAutofocusables=function(Xr,eo){return Xr.reduce(function(to,ro){return to.concat(parentAutofocusables(ro,eo))},[])},reorderNodes=function(Xr,eo){var to=new Map;return eo.forEach(function(ro){return to.set(ro.node,ro)}),Xr.map(function(ro){return to.get(ro)}).filter(isDefined)},getFocusMerge=function(Xr,eo){var to=getActiveElement(asArray(Xr).length>0?document:getFirst(Xr).ownerDocument),ro=getAllAffectedNodes(Xr).filter(isNotAGuard),no=getTopCommonParent(to||Xr,Xr,ro),io=new Map,oo=getAllTabbableNodes(ro,io),ao=getTabbableNodes(ro,io).filter(function(go){var bo=go.node;return isNotAGuard(bo)});if(!(!ao[0]&&(ao=oo,!ao[0]))){var so=getAllTabbableNodes([no],io).map(function(go){var bo=go.node;return bo}),co=reorderNodes(so,ao),lo=co.map(function(go){var bo=go.node;return bo}),uo=newFocus(lo,so,to,eo);if(uo===NEW_FOCUS){var ho=pickAutofocus(oo,lo,allParentAutofocusables(ro,io));if(ho)return{node:ho};console.warn("focus-lock: cannot find any node to move focus into");return}return uo===void 0?uo:co[uo]}},getFocusabledIn=function(Xr){var eo=getAllAffectedNodes(Xr).filter(isNotAGuard),to=getTopCommonParent(Xr,Xr,eo),ro=new Map,no=getTabbableNodes([to],ro,!0),io=getTabbableNodes(eo,ro).filter(function(oo){var ao=oo.node;return isNotAGuard(ao)}).map(function(oo){var ao=oo.node;return ao});return no.map(function(oo){var ao=oo.node,so=oo.index;return{node:ao,index:so,lockItem:io.indexOf(ao)>=0,guard:isGuard(ao)}})},focusOn=function(Xr,eo){"focus"in Xr&&Xr.focus(eo),"contentWindow"in Xr&&Xr.contentWindow&&Xr.contentWindow.focus()},guardCount=0,lockDisabled=!1,setFocus=function(Xr,eo,to){to===void 0&&(to={});var ro=getFocusMerge(Xr,eo);if(!lockDisabled&&ro){if(guardCount>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),lockDisabled=!0,setTimeout(function(){lockDisabled=!1},1);return}guardCount++,focusOn(ro.node,to.focusOptions),guardCount--}};function deferAction(Xr){var eo=window,to=eo.setImmediate;typeof to<"u"?to(Xr):setTimeout(Xr,1)}var focusOnBody=function(){return document&&document.activeElement===document.body},isFreeFocus=function(){return focusOnBody()||focusIsHidden()},lastActiveTrap=null,lastActiveFocus=null,lastPortaledElement=null,focusWasOutsideWindow=!1,defaultWhitelist=function(){return!0},focusWhitelisted=function(eo){return(lastActiveTrap.whiteList||defaultWhitelist)(eo)},recordPortal=function(eo,to){lastPortaledElement={observerNode:eo,portaledElement:to}},focusIsPortaledPair=function(eo){return lastPortaledElement&&lastPortaledElement.portaledElement===eo};function autoGuard(Xr,eo,to,ro){var no=null,io=Xr;do{var oo=ro[io];if(oo.guard)oo.node.dataset.focusAutoGuard&&(no=oo);else if(oo.lockItem){if(io!==Xr)return;no=null}else break}while((io+=to)!==eo);no&&(no.node.tabIndex=0)}var extractRef=function(eo){return eo&&"current"in eo?eo.current:eo},focusWasOutside=function(eo){return eo?!!focusWasOutsideWindow:focusWasOutsideWindow==="meanwhile"},checkInHost=function Xr(eo,to,ro){return to&&(to.host===eo&&(!to.activeElement||ro.contains(to.activeElement))||to.parentNode&&Xr(eo,to.parentNode,ro))},withinHost=function(eo,to){return to.some(function(ro){return checkInHost(eo,ro,ro)})},activateTrap=function(){var eo=!1;if(lastActiveTrap){var to=lastActiveTrap,ro=to.observed,no=to.persistentFocus,io=to.autoFocus,oo=to.shards,ao=to.crossFrame,so=to.focusOptions,co=ro||lastPortaledElement&&lastPortaledElement.portaledElement,lo=document&&document.activeElement;if(co){var uo=[co].concat(oo.map(extractRef).filter(Boolean));if((!lo||focusWhitelisted(lo))&&(no||focusWasOutside(ao)||!isFreeFocus()||!lastActiveFocus&&io)&&(co&&!(focusInside(uo)||lo&&withinHost(lo,uo)||focusIsPortaledPair(lo))&&(document&&!lastActiveFocus&&lo&&!io?(lo.blur&&lo.blur(),document.body.focus()):(eo=setFocus(uo,lastActiveFocus,{focusOptions:so}),lastPortaledElement={})),focusWasOutsideWindow=!1,lastActiveFocus=document&&document.activeElement),document){var ho=document&&document.activeElement,go=getFocusabledIn(uo),bo=go.map(function(wo){var Eo=wo.node;return Eo}).indexOf(ho);bo>-1&&(go.filter(function(wo){var Eo=wo.guard,$o=wo.node;return Eo&&$o.dataset.focusAutoGuard}).forEach(function(wo){var Eo=wo.node;return Eo.removeAttribute("tabIndex")}),autoGuard(bo,go.length,1,go),autoGuard(bo,-1,-1,go))}}}return eo},onTrap=function(eo){activateTrap()&&eo&&(eo.stopPropagation(),eo.preventDefault())},onBlur=function(){return deferAction(activateTrap)},onFocus=function(eo){var to=eo.target,ro=eo.currentTarget;ro.contains(to)||recordPortal(ro,to)},FocusWatcher=function(){return null},onWindowBlur=function(){focusWasOutsideWindow="just",setTimeout(function(){focusWasOutsideWindow="meanwhile"},0)},attachHandler=function(){document.addEventListener("focusin",onTrap),document.addEventListener("focusout",onBlur),window.addEventListener("blur",onWindowBlur)},detachHandler=function(){document.removeEventListener("focusin",onTrap),document.removeEventListener("focusout",onBlur),window.removeEventListener("blur",onWindowBlur)};function reducePropsToState(Xr){return Xr.filter(function(eo){var to=eo.disabled;return!to})}function handleStateChangeOnClient(Xr){var eo=Xr.slice(-1)[0];eo&&!lastActiveTrap&&attachHandler();var to=lastActiveTrap,ro=to&&eo&&eo.id===to.id;lastActiveTrap=eo,to&&!ro&&(to.onDeactivation(),Xr.filter(function(no){var io=no.id;return io===to.id}).length||to.returnFocus(!eo)),eo?(lastActiveFocus=null,(!ro||to.observed!==eo.observed)&&eo.onActivation(),activateTrap(),deferAction(activateTrap)):(detachHandler(),lastActiveFocus=null)}mediumFocus.assignSyncMedium(onFocus);mediumBlur.assignMedium(onBlur);mediumEffect.assignMedium(function(Xr){return Xr({moveFocusInside:setFocus,focusInside})});const FocusTrap=withSideEffect(reducePropsToState,handleStateChangeOnClient)(FocusWatcher);var FocusLockCombination=reactExports.forwardRef(function(eo,to){return reactExports.createElement(FocusLock,_extends$1n({sideCar:FocusTrap,ref:to},eo))}),_ref=FocusLock.propTypes||{};_ref.sideCar;_objectWithoutPropertiesLoose$1f(_ref,["sideCar"]);FocusLockCombination.propTypes={};var browser$h={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$a={};let toSJISFunction;const CODEWORDS_COUNT=[0,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];utils$a.getSymbolSize=function(eo){if(!eo)throw new Error('"version" cannot be null or undefined');if(eo<1||eo>40)throw new Error('"version" should be in range from 1 to 40');return eo*4+17};utils$a.getSymbolTotalCodewords=function(eo){return CODEWORDS_COUNT[eo]};utils$a.getBCHDigit=function(Xr){let eo=0;for(;Xr!==0;)eo++,Xr>>>=1;return eo};utils$a.setToSJISFunction=function(eo){if(typeof eo!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=eo};utils$a.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$a.toSJIS=function(eo){return toSJISFunction(eo)};var errorCorrectionLevel={};(function(Xr){Xr.L={bit:1},Xr.M={bit:0},Xr.Q={bit:3},Xr.H={bit:2};function eo(to){if(typeof to!="string")throw new Error("Param is not a string");switch(to.toLowerCase()){case"l":case"low":return Xr.L;case"m":case"medium":return Xr.M;case"q":case"quartile":return Xr.Q;case"h":case"high":return Xr.H;default:throw new Error("Unknown EC Level: "+to)}}Xr.isValid=function(ro){return ro&&typeof ro.bit<"u"&&ro.bit>=0&&ro.bit<4},Xr.from=function(ro,no){if(Xr.isValid(ro))return ro;try{return eo(ro)}catch{return no}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(Xr){const eo=Math.floor(Xr/8);return(this.buffer[eo]>>>7-Xr%8&1)===1},put:function(Xr,eo){for(let to=0;to>>eo-to-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(Xr){const eo=Math.floor(this.length/8);this.buffer.length<=eo&&this.buffer.push(0),Xr&&(this.buffer[eo]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(Xr){if(!Xr||Xr<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=Xr,this.data=new Uint8Array(Xr*Xr),this.reservedBit=new Uint8Array(Xr*Xr)}BitMatrix$1.prototype.set=function(Xr,eo,to,ro){const no=Xr*this.size+eo;this.data[no]=to,ro&&(this.reservedBit[no]=!0)};BitMatrix$1.prototype.get=function(Xr,eo){return this.data[Xr*this.size+eo]};BitMatrix$1.prototype.xor=function(Xr,eo,to){this.data[Xr*this.size+eo]^=to};BitMatrix$1.prototype.isReserved=function(Xr,eo){return this.reservedBit[Xr*this.size+eo]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(Xr){const eo=utils$a.getSymbolSize;Xr.getRowColCoords=function(ro){if(ro===1)return[];const no=Math.floor(ro/7)+2,io=eo(ro),oo=io===145?26:Math.ceil((io-13)/(2*no-2))*2,ao=[io-7];for(let so=1;so=0&&no<=7},Xr.from=function(no){return Xr.isValid(no)?parseInt(no,10):void 0},Xr.getPenaltyN1=function(no){const io=no.size;let oo=0,ao=0,so=0,co=null,lo=null;for(let uo=0;uo=5&&(oo+=eo.N1+(ao-5)),co=go,ao=1),go=no.get(ho,uo),go===lo?so++:(so>=5&&(oo+=eo.N1+(so-5)),lo=go,so=1)}ao>=5&&(oo+=eo.N1+(ao-5)),so>=5&&(oo+=eo.N1+(so-5))}return oo},Xr.getPenaltyN2=function(no){const io=no.size;let oo=0;for(let ao=0;ao=10&&(ao===1488||ao===93)&&oo++,so=so<<1&2047|no.get(lo,co),lo>=10&&(so===1488||so===93)&&oo++}return oo*eo.N3},Xr.getPenaltyN4=function(no){let io=0;const oo=no.data.length;for(let so=0;so=0;){const oo=io[0];for(let so=0;so0){const io=new Uint8Array(this.degree);return io.set(ro,no),io}return ro};var reedSolomonEncoder=ReedSolomonEncoder$1,version$k={},mode={},versionCheck={};versionCheck.isValid=function(eo){return!isNaN(eo)&&eo>=1&&eo<=40};var regex={};const numeric$1="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r +]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric$1,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(eo){return TEST_KANJI.test(eo)};regex.testNumeric=function(eo){return TEST_NUMERIC.test(eo)};regex.testAlphanumeric=function(eo){return TEST_ALPHANUMERIC.test(eo)};(function(Xr){const eo=versionCheck,to=regex;Xr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},Xr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},Xr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},Xr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},Xr.MIXED={bit:-1},Xr.getCharCountIndicator=function(io,oo){if(!io.ccBits)throw new Error("Invalid mode: "+io);if(!eo.isValid(oo))throw new Error("Invalid version: "+oo);return oo>=1&&oo<10?io.ccBits[0]:oo<27?io.ccBits[1]:io.ccBits[2]},Xr.getBestModeForData=function(io){return to.testNumeric(io)?Xr.NUMERIC:to.testAlphanumeric(io)?Xr.ALPHANUMERIC:to.testKanji(io)?Xr.KANJI:Xr.BYTE},Xr.toString=function(io){if(io&&io.id)return io.id;throw new Error("Invalid mode")},Xr.isValid=function(io){return io&&io.bit&&io.ccBits};function ro(no){if(typeof no!="string")throw new Error("Param is not a string");switch(no.toLowerCase()){case"numeric":return Xr.NUMERIC;case"alphanumeric":return Xr.ALPHANUMERIC;case"kanji":return Xr.KANJI;case"byte":return Xr.BYTE;default:throw new Error("Unknown mode: "+no)}}Xr.from=function(io,oo){if(Xr.isValid(io))return io;try{return ro(io)}catch{return oo}}})(mode);(function(Xr){const eo=utils$a,to=errorCorrectionCode,ro=errorCorrectionLevel,no=mode,io=versionCheck,oo=7973,ao=eo.getBCHDigit(oo);function so(ho,go,bo){for(let wo=1;wo<=40;wo++)if(go<=Xr.getCapacity(wo,bo,ho))return wo}function co(ho,go){return no.getCharCountIndicator(ho,go)+4}function lo(ho,go){let bo=0;return ho.forEach(function(wo){const Eo=co(wo.mode,go);bo+=Eo+wo.getBitsLength()}),bo}function uo(ho,go){for(let bo=1;bo<=40;bo++)if(lo(ho,bo)<=Xr.getCapacity(bo,go,no.MIXED))return bo}Xr.from=function(go,bo){return io.isValid(go)?parseInt(go,10):bo},Xr.getCapacity=function(go,bo,wo){if(!io.isValid(go))throw new Error("Invalid QR Code version");typeof wo>"u"&&(wo=no.BYTE);const Eo=eo.getSymbolTotalCodewords(go),$o=to.getTotalCodewordsCount(go,bo),Co=(Eo-$o)*8;if(wo===no.MIXED)return Co;const Ro=Co-co(wo,go);switch(wo){case no.NUMERIC:return Math.floor(Ro/10*3);case no.ALPHANUMERIC:return Math.floor(Ro/11*2);case no.KANJI:return Math.floor(Ro/13);case no.BYTE:default:return Math.floor(Ro/8)}},Xr.getBestVersionForData=function(go,bo){let wo;const Eo=ro.from(bo,ro.M);if(Array.isArray(go)){if(go.length>1)return uo(go,Eo);if(go.length===0)return 1;wo=go[0]}else wo=go;return so(wo.mode,wo.getLength(),Eo)},Xr.getEncodedBits=function(go){if(!io.isValid(go)||go<7)throw new Error("Invalid QR Code version");let bo=go<<12;for(;eo.getBCHDigit(bo)-ao>=0;)bo^=oo<=0;)no^=G15<0&&(ro=this.data.substr(to),no=parseInt(ro,10),eo.put(no,io*3+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(Xr){this.mode=Mode$3.ALPHANUMERIC,this.data=Xr}AlphanumericData.getBitsLength=function(eo){return 11*Math.floor(eo/2)+6*(eo%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(eo){let to;for(to=0;to+2<=this.data.length;to+=2){let ro=ALPHA_NUM_CHARS.indexOf(this.data[to])*45;ro+=ALPHA_NUM_CHARS.indexOf(this.data[to+1]),eo.put(ro,11)}this.data.length%2&&eo.put(ALPHA_NUM_CHARS.indexOf(this.data[to]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(eo){for(var to=[],ro=eo.length,no=0;no=55296&&io<=56319&&ro>no+1){var oo=eo.charCodeAt(no+1);oo>=56320&&oo<=57343&&(io=(io-55296)*1024+oo-56320+65536,no+=1)}if(io<128){to.push(io);continue}if(io<2048){to.push(io>>6|192),to.push(io&63|128);continue}if(io<55296||io>=57344&&io<65536){to.push(io>>12|224),to.push(io>>6&63|128),to.push(io&63|128);continue}if(io>=65536&&io<=1114111){to.push(io>>18|240),to.push(io>>12&63|128),to.push(io>>6&63|128),to.push(io&63|128);continue}to.push(239,191,189)}return new Uint8Array(to).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(Xr){this.mode=Mode$2.BYTE,typeof Xr=="string"&&(Xr=encodeUtf8(Xr)),this.data=new Uint8Array(Xr)}ByteData.getBitsLength=function(eo){return eo*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(Xr){for(let eo=0,to=this.data.length;eo=33088&&to<=40956)to-=33088;else if(to>=57408&&to<=60351)to-=49472;else throw new Error("Invalid SJIS character: "+this.data[eo]+` +Make sure your charset is UTF-8`);to=(to>>>8&255)*192+(to&255),Xr.put(to,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(Xr){var eo={single_source_shortest_paths:function(to,ro,no){var io={},oo={};oo[ro]=0;var ao=eo.PriorityQueue.make();ao.push(ro,0);for(var so,co,lo,uo,ho,go,bo,wo,Eo;!ao.empty();){so=ao.pop(),co=so.value,uo=so.cost,ho=to[co]||{};for(lo in ho)ho.hasOwnProperty(lo)&&(go=ho[lo],bo=uo+go,wo=oo[lo],Eo=typeof oo[lo]>"u",(Eo||wo>bo)&&(oo[lo]=bo,ao.push(lo,bo),io[lo]=co))}if(typeof no<"u"&&typeof oo[no]>"u"){var $o=["Could not find a path from ",ro," to ",no,"."].join("");throw new Error($o)}return io},extract_shortest_path_from_predecessor_list:function(to,ro){for(var no=[],io=ro;io;)no.push(io),to[io],io=to[io];return no.reverse(),no},find_path:function(to,ro,no){var io=eo.single_source_shortest_paths(to,ro,no);return eo.extract_shortest_path_from_predecessor_list(io,no)},PriorityQueue:{make:function(to){var ro=eo.PriorityQueue,no={},io;to=to||{};for(io in ro)ro.hasOwnProperty(io)&&(no[io]=ro[io]);return no.queue=[],no.sorter=to.sorter||ro.default_sorter,no},default_sorter:function(to,ro){return to.cost-ro.cost},push:function(to,ro){var no={value:to,cost:ro};this.queue.push(no),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};Xr.exports=eo})(dijkstra);var dijkstraExports=dijkstra.exports;(function(Xr){const eo=mode,to=numericData,ro=alphanumericData,no=byteData,io=kanjiData,oo=regex,ao=utils$a,so=dijkstraExports;function co($o){return unescape(encodeURIComponent($o)).length}function lo($o,Co,Ro){const Oo=[];let jo;for(;(jo=$o.exec(Ro))!==null;)Oo.push({data:jo[0],index:jo.index,mode:Co,length:jo[0].length});return Oo}function uo($o){const Co=lo(oo.NUMERIC,eo.NUMERIC,$o),Ro=lo(oo.ALPHANUMERIC,eo.ALPHANUMERIC,$o);let Oo,jo;return ao.isKanjiModeEnabled()?(Oo=lo(oo.BYTE,eo.BYTE,$o),jo=lo(oo.KANJI,eo.KANJI,$o)):(Oo=lo(oo.BYTE_KANJI,eo.BYTE,$o),jo=[]),Co.concat(Ro,Oo,jo).sort(function(Mo,Fo){return Mo.index-Fo.index}).map(function(Mo){return{data:Mo.data,mode:Mo.mode,length:Mo.length}})}function ho($o,Co){switch(Co){case eo.NUMERIC:return to.getBitsLength($o);case eo.ALPHANUMERIC:return ro.getBitsLength($o);case eo.KANJI:return io.getBitsLength($o);case eo.BYTE:return no.getBitsLength($o)}}function go($o){return $o.reduce(function(Co,Ro){const Oo=Co.length-1>=0?Co[Co.length-1]:null;return Oo&&Oo.mode===Ro.mode?(Co[Co.length-1].data+=Ro.data,Co):(Co.push(Ro),Co)},[])}function bo($o){const Co=[];for(let Ro=0;Ro<$o.length;Ro++){const Oo=$o[Ro];switch(Oo.mode){case eo.NUMERIC:Co.push([Oo,{data:Oo.data,mode:eo.ALPHANUMERIC,length:Oo.length},{data:Oo.data,mode:eo.BYTE,length:Oo.length}]);break;case eo.ALPHANUMERIC:Co.push([Oo,{data:Oo.data,mode:eo.BYTE,length:Oo.length}]);break;case eo.KANJI:Co.push([Oo,{data:Oo.data,mode:eo.BYTE,length:co(Oo.data)}]);break;case eo.BYTE:Co.push([{data:Oo.data,mode:eo.BYTE,length:co(Oo.data)}])}}return Co}function wo($o,Co){const Ro={},Oo={start:{}};let jo=["start"];for(let Bo=0;Bo<$o.length;Bo++){const Mo=$o[Bo],Fo=[];for(let Wo=0;Wo=0&&ao<=6&&(so===0||so===6)||so>=0&&so<=6&&(ao===0||ao===6)||ao>=2&&ao<=4&&so>=2&&so<=4?Xr.set(io+ao,oo+so,!0,!0):Xr.set(io+ao,oo+so,!1,!0))}}function setupTimingPattern(Xr){const eo=Xr.size;for(let to=8;to>ao&1)===1,Xr.set(no,io,oo,!0),Xr.set(io,no,oo,!0)}function setupFormatInfo(Xr,eo,to){const ro=Xr.size,no=FormatInfo.getEncodedBits(eo,to);let io,oo;for(io=0;io<15;io++)oo=(no>>io&1)===1,io<6?Xr.set(io,8,oo,!0):io<8?Xr.set(io+1,8,oo,!0):Xr.set(ro-15+io,8,oo,!0),io<8?Xr.set(8,ro-io-1,oo,!0):io<9?Xr.set(8,15-io-1+1,oo,!0):Xr.set(8,15-io-1,oo,!0);Xr.set(ro-8,8,1,!0)}function setupData(Xr,eo){const to=Xr.size;let ro=-1,no=to-1,io=7,oo=0;for(let ao=to-1;ao>0;ao-=2)for(ao===6&&ao--;;){for(let so=0;so<2;so++)if(!Xr.isReserved(no,ao-so)){let co=!1;oo>>io&1)===1),Xr.set(no,ao-so,co),io--,io===-1&&(oo++,io=7)}if(no+=ro,no<0||to<=no){no-=ro,ro=-ro;break}}}function createData(Xr,eo,to){const ro=new BitBuffer;to.forEach(function(so){ro.put(so.mode.bit,4),ro.put(so.getLength(),Mode.getCharCountIndicator(so.mode,Xr)),so.write(ro)});const no=Utils$1.getSymbolTotalCodewords(Xr),io=ECCode.getTotalCodewordsCount(Xr,eo),oo=(no-io)*8;for(ro.getLengthInBits()+4<=oo&&ro.put(0,4);ro.getLengthInBits()%8!==0;)ro.putBit(0);const ao=(oo-ro.getLengthInBits())/8;for(let so=0;so=7&&setupVersionInfo(so,eo),setupData(so,oo),isNaN(ro)&&(ro=MaskPattern.getBestMask(so,setupFormatInfo.bind(null,so,to))),MaskPattern.applyMask(ro,so),setupFormatInfo(so,to,ro),{modules:so,version:eo,errorCorrectionLevel:to,maskPattern:ro,segments:no}}qrcode.create=function(eo,to){if(typeof eo>"u"||eo==="")throw new Error("No input text");let ro=ECLevel.M,no,io;return typeof to<"u"&&(ro=ECLevel.from(to.errorCorrectionLevel,ECLevel.M),no=Version.from(to.version),io=MaskPattern.from(to.maskPattern),to.toSJISFunc&&Utils$1.setToSJISFunction(to.toSJISFunc)),createSymbol(eo,no,ro,io)};var canvas={},utils$9={};(function(Xr){function eo(to){if(typeof to=="number"&&(to=to.toString()),typeof to!="string")throw new Error("Color should be defined as hex string");let ro=to.slice().replace("#","").split("");if(ro.length<3||ro.length===5||ro.length>8)throw new Error("Invalid hex color: "+to);(ro.length===3||ro.length===4)&&(ro=Array.prototype.concat.apply([],ro.map(function(io){return[io,io]}))),ro.length===6&&ro.push("F","F");const no=parseInt(ro.join(""),16);return{r:no>>24&255,g:no>>16&255,b:no>>8&255,a:no&255,hex:"#"+ro.slice(0,6).join("")}}Xr.getOptions=function(ro){ro||(ro={}),ro.color||(ro.color={});const no=typeof ro.margin>"u"||ro.margin===null||ro.margin<0?4:ro.margin,io=ro.width&&ro.width>=21?ro.width:void 0,oo=ro.scale||4;return{width:io,scale:io?4:oo,margin:no,color:{dark:eo(ro.color.dark||"#000000ff"),light:eo(ro.color.light||"#ffffffff")},type:ro.type,rendererOpts:ro.rendererOpts||{}}},Xr.getScale=function(ro,no){return no.width&&no.width>=ro+no.margin*2?no.width/(ro+no.margin*2):no.scale},Xr.getImageWidth=function(ro,no){const io=Xr.getScale(ro,no);return Math.floor((ro+no.margin*2)*io)},Xr.qrToImageData=function(ro,no,io){const oo=no.modules.size,ao=no.modules.data,so=Xr.getScale(oo,io),co=Math.floor((oo+io.margin*2)*so),lo=io.margin*so,fo=[io.color.light,io.color.dark];for(let ho=0;ho=lo&&go>=lo&&ho"u"&&(!oo||!oo.getContext)&&(so=oo,oo=void 0),oo||(co=ro()),so=eo.getOptions(so);const lo=eo.getImageWidth(io.modules.size,so),fo=co.getContext("2d"),ho=fo.createImageData(lo,lo);return eo.qrToImageData(ho.data,io,so),to(fo,co,lo),fo.putImageData(ho,0,0),co},Xr.renderToDataURL=function(io,oo,ao){let so=ao;typeof so>"u"&&(!oo||!oo.getContext)&&(so=oo,oo=void 0),so||(so={});const co=Xr.render(io,oo,so),lo=so.type||"image/png",fo=so.rendererOpts||{};return co.toDataURL(lo,fo.quality)}})(canvas);var svgTag={};const Utils=utils$9;function getColorAttrib(Xr,eo){const to=Xr.a/255,ro=eo+'="'+Xr.hex+'"';return to<1?ro+" "+eo+'-opacity="'+to.toFixed(2).slice(1)+'"':ro}function svgCmd(Xr,eo,to){let ro=Xr+eo;return typeof to<"u"&&(ro+=" "+to),ro}function qrToPath(Xr,eo,to){let ro="",no=0,io=!1,oo=0;for(let ao=0;ao0&&so>0&&Xr[ao-1]||(ro+=io?svgCmd("M",so+to,.5+co+to):svgCmd("m",no,0),no=0,io=!1),so+1':"",co="',lo='viewBox="0 0 '+ao+" "+ao+'"',ho=''+so+co+` -`;return typeof ro=="function"&&ro(null,ho),ho};const canPromise=canPromise$1,QRCode$1=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(Xr,eo,to,ro,no){const io=[].slice.call(arguments,1),oo=io.length,ao=typeof io[oo-1]=="function";if(!ao&&!canPromise())throw new Error("Callback required as last argument");if(ao){if(oo<2)throw new Error("Too few arguments provided");oo===2?(no=to,to=eo,eo=ro=void 0):oo===3&&(eo.getContext&&typeof no>"u"?(no=ro,ro=void 0):(no=ro,ro=to,to=eo,eo=void 0))}else{if(oo<1)throw new Error("Too few arguments provided");return oo===1?(to=eo,eo=ro=void 0):oo===2&&!eo.getContext&&(ro=to,to=eo,eo=void 0),new Promise(function(so,co){try{const lo=QRCode$1.create(to,ro);so(Xr(lo,eo,ro))}catch(lo){co(lo)}})}try{const so=QRCode$1.create(to,ro);no(null,Xr(so,eo,ro))}catch(so){no(so)}}browser$h.create=QRCode$1.create;browser$h.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$h.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$h.toString=renderCanvas.bind(null,function(Xr,eo,to){return SvgRenderer.render(Xr,to)});var isArray$5=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,hasElementType=typeof Element<"u";function equal$1(Xr,eo){if(Xr===eo)return!0;if(Xr&&eo&&typeof Xr=="object"&&typeof eo=="object"){var to=isArray$5(Xr),ro=isArray$5(eo),no,io,oo;if(to&&ro){if(io=Xr.length,io!=eo.length)return!1;for(no=io;no--!==0;)if(!equal$1(Xr[no],eo[no]))return!1;return!0}if(to!=ro)return!1;var ao=Xr instanceof Date,so=eo instanceof Date;if(ao!=so)return!1;if(ao&&so)return Xr.getTime()==eo.getTime();var co=Xr instanceof RegExp,lo=eo instanceof RegExp;if(co!=lo)return!1;if(co&&lo)return Xr.toString()==eo.toString();var fo=keyList(Xr);if(io=fo.length,io!==keyList(eo).length)return!1;for(no=io;no--!==0;)if(!hasProp.call(eo,fo[no]))return!1;if(hasElementType&&Xr instanceof Element&&eo instanceof Element)return Xr===eo;for(no=io;no--!==0;)if(oo=fo[no],!(oo==="_owner"&&Xr.$$typeof)&&!equal$1(Xr[oo],eo[oo]))return!1;return!0}return Xr!==Xr&&eo!==eo}var reactFastCompare=function(eo,to){try{return equal$1(eo,to)}catch(ro){if(ro.message&&ro.message.match(/stack|recursion/i)||ro.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",ro.name,ro.message),!1;throw ro}};const isEqual=getDefaultExportFromCjs$2(reactFastCompare);var isMergeableObject=function(eo){return isNonNullObject(eo)&&!isSpecial(eo)};function isNonNullObject(Xr){return!!Xr&&typeof Xr=="object"}function isSpecial(Xr){var eo=Object.prototype.toString.call(Xr);return eo==="[object RegExp]"||eo==="[object Date]"||isReactElement(Xr)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(Xr){return Xr.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(Xr){return Array.isArray(Xr)?[]:{}}function cloneUnlessOtherwiseSpecified(Xr,eo){return eo.clone!==!1&&eo.isMergeableObject(Xr)?deepmerge(emptyTarget(Xr),Xr,eo):Xr}function defaultArrayMerge(Xr,eo,to){return Xr.concat(eo).map(function(ro){return cloneUnlessOtherwiseSpecified(ro,to)})}function mergeObject(Xr,eo,to){var ro={};return to.isMergeableObject(Xr)&&Object.keys(Xr).forEach(function(no){ro[no]=cloneUnlessOtherwiseSpecified(Xr[no],to)}),Object.keys(eo).forEach(function(no){!to.isMergeableObject(eo[no])||!Xr[no]?ro[no]=cloneUnlessOtherwiseSpecified(eo[no],to):ro[no]=deepmerge(Xr[no],eo[no],to)}),ro}function deepmerge(Xr,eo,to){to=to||{},to.arrayMerge=to.arrayMerge||defaultArrayMerge,to.isMergeableObject=to.isMergeableObject||isMergeableObject;var ro=Array.isArray(eo),no=Array.isArray(Xr),io=ro===no;return io?ro?to.arrayMerge(Xr,eo,to):mergeObject(Xr,eo,to):cloneUnlessOtherwiseSpecified(eo,to)}deepmerge.all=function(eo,to){if(!Array.isArray(eo))throw new Error("first argument should be an array");return eo.reduce(function(ro,no){return deepmerge(ro,no,to)},{})};var deepmerge_1=deepmerge,freeGlobal$1=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1,freeSelf$1=typeof self=="object"&&self&&self.Object===Object&&self,root$2=freeGlobal$1||freeSelf$1||Function("return this")(),Symbol$2=root$2.Symbol,objectProto$e=Object.prototype,hasOwnProperty$b=objectProto$e.hasOwnProperty,nativeObjectToString$1=objectProto$e.toString,symToStringTag$1=Symbol$2?Symbol$2.toStringTag:void 0;function getRawTag(Xr){var eo=hasOwnProperty$b.call(Xr,symToStringTag$1),to=Xr[symToStringTag$1];try{Xr[symToStringTag$1]=void 0;var ro=!0}catch{}var no=nativeObjectToString$1.call(Xr);return ro&&(eo?Xr[symToStringTag$1]=to:delete Xr[symToStringTag$1]),no}var objectProto$d=Object.prototype,nativeObjectToString=objectProto$d.toString;function objectToString$2(Xr){return nativeObjectToString.call(Xr)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$2?Symbol$2.toStringTag:void 0;function baseGetTag(Xr){return Xr==null?Xr===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(Xr)?getRawTag(Xr):objectToString$2(Xr)}function overArg(Xr,eo){return function(to){return Xr(eo(to))}}var getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(Xr){return Xr!=null&&typeof Xr=="object"}var objectTag$3="[object Object]",funcProto$3=Function.prototype,objectProto$c=Object.prototype,funcToString$3=funcProto$3.toString,hasOwnProperty$a=objectProto$c.hasOwnProperty,objectCtorString=funcToString$3.call(Object);function isPlainObject$1(Xr){if(!isObjectLike(Xr)||baseGetTag(Xr)!=objectTag$3)return!1;var eo=getPrototype(Xr);if(eo===null)return!0;var to=hasOwnProperty$a.call(eo,"constructor")&&eo.constructor;return typeof to=="function"&&to instanceof to&&funcToString$3.call(to)==objectCtorString}function listCacheClear(){this.__data__=[],this.size=0}function eq$1(Xr,eo){return Xr===eo||Xr!==Xr&&eo!==eo}function assocIndexOf(Xr,eo){for(var to=Xr.length;to--;)if(eq$1(Xr[to][0],eo))return to;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(Xr){var eo=this.__data__,to=assocIndexOf(eo,Xr);if(to<0)return!1;var ro=eo.length-1;return to==ro?eo.pop():splice.call(eo,to,1),--this.size,!0}function listCacheGet(Xr){var eo=this.__data__,to=assocIndexOf(eo,Xr);return to<0?void 0:eo[to][1]}function listCacheHas(Xr){return assocIndexOf(this.__data__,Xr)>-1}function listCacheSet(Xr,eo){var to=this.__data__,ro=assocIndexOf(to,Xr);return ro<0?(++this.size,to.push([Xr,eo])):to[ro][1]=eo,this}function ListCache(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1&&Xr%1==0&&Xr-1&&Xr%1==0&&Xr<=MAX_SAFE_INTEGER$2}var argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$1="[object Error]",funcTag$2="[object Function]",mapTag$4="[object Map]",numberTag$2="[object Number]",objectTag$2="[object Object]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$2]=typedArrayTags[boolTag$2]=typedArrayTags[dataViewTag$3]=typedArrayTags[dateTag$2]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$2]=typedArrayTags[mapTag$4]=typedArrayTags[numberTag$2]=typedArrayTags[objectTag$2]=typedArrayTags[regexpTag$2]=typedArrayTags[setTag$4]=typedArrayTags[stringTag$2]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(Xr){return isObjectLike(Xr)&&isLength(Xr.length)&&!!typedArrayTags[baseGetTag(Xr)]}function baseUnary(Xr){return function(eo){return Xr(eo)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal$1.process,nodeUtil=function(){try{var Xr=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return Xr||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray$1=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function arrayLikeKeys(Xr,eo){var to=isArray$4(Xr),ro=!to&&isArguments$1(Xr),no=!to&&!ro&&isBuffer(Xr),io=!to&&!ro&&!no&&isTypedArray$1(Xr),oo=to||ro||no||io,ao=oo?baseTimes(Xr.length,String):[],so=ao.length;for(var co in Xr)(eo||hasOwnProperty$4.call(Xr,co))&&!(oo&&(co=="length"||no&&(co=="offset"||co=="parent")||io&&(co=="buffer"||co=="byteLength"||co=="byteOffset")||isIndex(co,so)))&&ao.push(co);return ao}var objectProto$5=Object.prototype;function isPrototype(Xr){var eo=Xr&&Xr.constructor,to=typeof eo=="function"&&eo.prototype||objectProto$5;return Xr===to}var nativeKeys=overArg(Object.keys,Object),objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function baseKeys(Xr){if(!isPrototype(Xr))return nativeKeys(Xr);var eo=[];for(var to in Object(Xr))hasOwnProperty$3.call(Xr,to)&&to!="constructor"&&eo.push(to);return eo}function isArrayLike(Xr){return Xr!=null&&isLength(Xr.length)&&!isFunction$2(Xr)}function keys$1(Xr){return isArrayLike(Xr)?arrayLikeKeys(Xr):baseKeys(Xr)}function baseAssign(Xr,eo){return Xr&©Object(eo,keys$1(eo),Xr)}function nativeKeysIn(Xr){var eo=[];if(Xr!=null)for(var to in Object(Xr))eo.push(to);return eo}var objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function baseKeysIn(Xr){if(!isObject$a(Xr))return nativeKeysIn(Xr);var eo=isPrototype(Xr),to=[];for(var ro in Xr)ro=="constructor"&&(eo||!hasOwnProperty$2.call(Xr,ro))||to.push(ro);return to}function keysIn(Xr){return isArrayLike(Xr)?arrayLikeKeys(Xr,!0):baseKeysIn(Xr)}function baseAssignIn(Xr,eo){return Xr&©Object(eo,keysIn(eo),Xr)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root$2.Buffer:void 0,allocUnsafe$1=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer$1(Xr,eo){if(eo)return Xr.slice();var to=Xr.length,ro=allocUnsafe$1?allocUnsafe$1(to):new Xr.constructor(to);return Xr.copy(ro),ro}function copyArray(Xr,eo){var to=-1,ro=Xr.length;for(eo||(eo=Array(ro));++to=0)&&(to[no]=Xr[no]);return to}var isFunction$1=function(eo){return typeof eo=="function"},isObject$9=function(eo){return eo!==null&&typeof eo=="object"},isInteger$2=function(eo){return String(Math.floor(Number(eo)))===eo},isString$3=function(eo){return Object.prototype.toString.call(eo)==="[object String]"},isEmptyChildren=function(eo){return reactExports.Children.count(eo)===0},isPromise=function(eo){return isObject$9(eo)&&isFunction$1(eo.then)};function getIn(Xr,eo,to,ro){ro===void 0&&(ro=0);for(var no=toPath(eo);Xr&&ro=0?[]:{}}}return(io===0?Xr:no)[oo[io]]===to?Xr:(to===void 0?delete no[oo[io]]:no[oo[io]]=to,io===0&&to===void 0&&delete ro[oo[io]],ro)}function setNestedObjectValues(Xr,eo,to,ro){to===void 0&&(to=new WeakMap),ro===void 0&&(ro={});for(var no=0,io=Object.keys(Xr);no0?Ml.map(function(Vl){return Do(Vl,getIn(Tl,Vl))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(ou).then(function(Vl){return Vl.reduce(function(Ll,uu,ru){return uu==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||uu&&(Ll=setIn(Ll,Ml[ru],uu)),Ll},{})})},[Do]),Xo=reactExports.useCallback(function(Tl){return Promise.all([Fo(Tl),ho.validationSchema?No(Tl):{},ho.validate?Mo(Tl):{}]).then(function(Ml){var ou=Ml[0],Vl=Ml[1],Ll=Ml[2],uu=deepmerge_1.all([ou,Vl,Ll],{arrayMerge});return uu})},[ho.validate,ho.validationSchema,Fo,Mo,No]),Lo=useEventCallback(function(Tl){return Tl===void 0&&(Tl=Po.values),jo({type:"SET_ISVALIDATING",payload:!0}),Xo(Tl).then(function(Ml){return Eo.current&&(jo({type:"SET_ISVALIDATING",payload:!1}),jo({type:"SET_ERRORS",payload:Ml})),Ml})});reactExports.useEffect(function(){oo&&Eo.current===!0&&isEqual(go.current,ho.initialValues)&&Lo(go.current)},[oo,Lo]);var Bo=reactExports.useCallback(function(Tl){var Ml=Tl&&Tl.values?Tl.values:go.current,ou=Tl&&Tl.errors?Tl.errors:yo.current?yo.current:ho.initialErrors||{},Vl=Tl&&Tl.touched?Tl.touched:vo.current?vo.current:ho.initialTouched||{},Ll=Tl&&Tl.status?Tl.status:wo.current?wo.current:ho.initialStatus;go.current=Ml,yo.current=ou,vo.current=Vl,wo.current=Ll;var uu=function(){jo({type:"RESET_FORM",payload:{isSubmitting:!!Tl&&!!Tl.isSubmitting,errors:ou,touched:Vl,status:Ll,values:Ml,isValidating:!!Tl&&!!Tl.isValidating,submitCount:Tl&&Tl.submitCount&&typeof Tl.submitCount=="number"?Tl.submitCount:0}})};if(ho.onReset){var ru=ho.onReset(Po.values,Ko);isPromise(ru)?ru.then(uu):uu()}else uu()},[ho.initialErrors,ho.initialStatus,ho.initialTouched]);reactExports.useEffect(function(){Eo.current===!0&&!isEqual(go.current,ho.initialValues)&&(co&&(go.current=ho.initialValues,Bo()),oo&&Lo(go.current))},[co,ho.initialValues,Bo,oo,Lo]),reactExports.useEffect(function(){co&&Eo.current===!0&&!isEqual(yo.current,ho.initialErrors)&&(yo.current=ho.initialErrors||emptyErrors,jo({type:"SET_ERRORS",payload:ho.initialErrors||emptyErrors}))},[co,ho.initialErrors]),reactExports.useEffect(function(){co&&Eo.current===!0&&!isEqual(vo.current,ho.initialTouched)&&(vo.current=ho.initialTouched||emptyTouched,jo({type:"SET_TOUCHED",payload:ho.initialTouched||emptyTouched}))},[co,ho.initialTouched]),reactExports.useEffect(function(){co&&Eo.current===!0&&!isEqual(wo.current,ho.initialStatus)&&(wo.current=ho.initialStatus,jo({type:"SET_STATUS",payload:ho.initialStatus}))},[co,ho.initialStatus,ho.initialTouched]);var xo=useEventCallback(function(Tl){if(ko.current[Tl]&&isFunction$1(ko.current[Tl].validate)){var Ml=getIn(Po.values,Tl),ou=ko.current[Tl].validate(Ml);return isPromise(ou)?(jo({type:"SET_ISVALIDATING",payload:!0}),ou.then(function(Vl){return Vl}).then(function(Vl){jo({type:"SET_FIELD_ERROR",payload:{field:Tl,value:Vl}}),jo({type:"SET_ISVALIDATING",payload:!1})})):(jo({type:"SET_FIELD_ERROR",payload:{field:Tl,value:ou}}),Promise.resolve(ou))}else if(ho.validationSchema)return jo({type:"SET_ISVALIDATING",payload:!0}),No(Po.values,Tl).then(function(Vl){return Vl}).then(function(Vl){jo({type:"SET_FIELD_ERROR",payload:{field:Tl,value:Vl[Tl]}}),jo({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),uo=reactExports.useCallback(function(Tl,Ml){var ou=Ml.validate;ko.current[Tl]={validate:ou}},[]),po=reactExports.useCallback(function(Tl){delete ko.current[Tl]},[]),bo=useEventCallback(function(Tl,Ml){jo({type:"SET_TOUCHED",payload:Tl});var ou=Ml===void 0?no:Ml;return ou?Lo(Po.values):Promise.resolve()}),_o=reactExports.useCallback(function(Tl){jo({type:"SET_ERRORS",payload:Tl})},[]),$o=useEventCallback(function(Tl,Ml){var ou=isFunction$1(Tl)?Tl(Po.values):Tl;jo({type:"SET_VALUES",payload:ou});var Vl=Ml===void 0?to:Ml;return Vl?Lo(ou):Promise.resolve()}),Co=reactExports.useCallback(function(Tl,Ml){jo({type:"SET_FIELD_ERROR",payload:{field:Tl,value:Ml}})},[]),Ro=useEventCallback(function(Tl,Ml,ou){jo({type:"SET_FIELD_VALUE",payload:{field:Tl,value:Ml}});var Vl=ou===void 0?to:ou;return Vl?Lo(setIn(Po.values,Tl,Ml)):Promise.resolve()}),So=reactExports.useCallback(function(Tl,Ml){var ou=Ml,Vl=Tl,Ll;if(!isString$3(Tl)){Tl.persist&&Tl.persist();var uu=Tl.target?Tl.target:Tl.currentTarget,ru=uu.type,tu=uu.name,ku=uu.id,au=uu.value,wl=uu.checked,Jo=uu.outerHTML,Go=uu.options,$l=uu.multiple;ou=Ml||tu||ku,Vl=/number|range/.test(ru)?(Ll=parseFloat(au),isNaN(Ll)?"":Ll):/checkbox/.test(ru)?getValueForCheckbox(getIn(Po.values,ou),wl,au):Go&&$l?getSelectedValues(Go):au}ou&&Ro(ou,Vl)},[Ro,Po.values]),mo=useEventCallback(function(Tl){if(isString$3(Tl))return function(Ml){return So(Ml,Tl)};So(Tl)}),To=useEventCallback(function(Tl,Ml,ou){Ml===void 0&&(Ml=!0),jo({type:"SET_FIELD_TOUCHED",payload:{field:Tl,value:Ml}});var Vl=ou===void 0?no:ou;return Vl?Lo(Po.values):Promise.resolve()}),Vo=reactExports.useCallback(function(Tl,Ml){Tl.persist&&Tl.persist();var ou=Tl.target,Vl=ou.name,Ll=ou.id,uu=ou.outerHTML,ru=Ml||Vl||Ll;To(ru,!0)},[To]),Zo=useEventCallback(function(Tl){if(isString$3(Tl))return function(Ml){return Vo(Ml,Tl)};Vo(Tl)}),Qo=reactExports.useCallback(function(Tl){isFunction$1(Tl)?jo({type:"SET_FORMIK_STATE",payload:Tl}):jo({type:"SET_FORMIK_STATE",payload:function(){return Tl}})},[]),qo=reactExports.useCallback(function(Tl){jo({type:"SET_STATUS",payload:Tl})},[]),Ho=reactExports.useCallback(function(Tl){jo({type:"SET_ISSUBMITTING",payload:Tl})},[]),$a=useEventCallback(function(){return jo({type:"SUBMIT_ATTEMPT"}),Lo().then(function(Tl){var Ml=Tl instanceof Error,ou=!Ml&&Object.keys(Tl).length===0;if(ou){var Vl;try{if(Vl=_c(),Vl===void 0)return}catch(Ll){throw Ll}return Promise.resolve(Vl).then(function(Ll){return Eo.current&&jo({type:"SUBMIT_SUCCESS"}),Ll}).catch(function(Ll){if(Eo.current)throw jo({type:"SUBMIT_FAILURE"}),Ll})}else if(Eo.current&&(jo({type:"SUBMIT_FAILURE"}),Ml))throw Tl})}),zo=useEventCallback(function(Tl){Tl&&Tl.preventDefault&&isFunction$1(Tl.preventDefault)&&Tl.preventDefault(),Tl&&Tl.stopPropagation&&isFunction$1(Tl.stopPropagation)&&Tl.stopPropagation(),$a().catch(function(Ml){console.warn("Warning: An unhandled error was caught from submitForm()",Ml)})}),Ko={resetForm:Bo,validateForm:Lo,validateField:xo,setErrors:_o,setFieldError:Co,setFieldTouched:To,setFieldValue:Ro,setStatus:qo,setSubmitting:Ho,setTouched:bo,setValues:$o,setFormikState:Qo,submitForm:$a},_c=useEventCallback(function(){return lo(Po.values,Ko)}),Cl=useEventCallback(function(Tl){Tl&&Tl.preventDefault&&isFunction$1(Tl.preventDefault)&&Tl.preventDefault(),Tl&&Tl.stopPropagation&&isFunction$1(Tl.stopPropagation)&&Tl.stopPropagation(),Bo()}),ga=reactExports.useCallback(function(Tl){return{value:getIn(Po.values,Tl),error:getIn(Po.errors,Tl),touched:!!getIn(Po.touched,Tl),initialValue:getIn(go.current,Tl),initialTouched:!!getIn(vo.current,Tl),initialError:getIn(yo.current,Tl)}},[Po.errors,Po.touched,Po.values]),El=reactExports.useCallback(function(Tl){return{setValue:function(ou,Vl){return Ro(Tl,ou,Vl)},setTouched:function(ou,Vl){return To(Tl,ou,Vl)},setError:function(ou){return Co(Tl,ou)}}},[Ro,To,Co]),Al=reactExports.useCallback(function(Tl){var Ml=isObject$9(Tl),ou=Ml?Tl.name:Tl,Vl=getIn(Po.values,ou),Ll={name:ou,value:Vl,onChange:mo,onBlur:Zo};if(Ml){var uu=Tl.type,ru=Tl.value,tu=Tl.as,ku=Tl.multiple;uu==="checkbox"?ru===void 0?Ll.checked=!!Vl:(Ll.checked=!!(Array.isArray(Vl)&&~Vl.indexOf(ru)),Ll.value=ru):uu==="radio"?(Ll.checked=Vl===ru,Ll.value=ru):tu==="select"&&ku&&(Ll.value=Ll.value||[],Ll.multiple=!0)}return Ll},[Zo,mo,Po.values]),Ol=reactExports.useMemo(function(){return!isEqual(go.current,Po.values)},[go.current,Po.values]),Wl=reactExports.useMemo(function(){return typeof ao<"u"?Ol?Po.errors&&Object.keys(Po.errors).length===0:ao!==!1&&isFunction$1(ao)?ao(ho):ao:Po.errors&&Object.keys(Po.errors).length===0},[ao,Ol,Po.errors,ho]),zl=_extends$1f({},Po,{initialValues:go.current,initialErrors:yo.current,initialTouched:vo.current,initialStatus:wo.current,handleBlur:Zo,handleChange:mo,handleReset:Cl,handleSubmit:zo,resetForm:Bo,setErrors:_o,setFormikState:Qo,setFieldTouched:To,setFieldValue:Ro,setFieldError:Co,setStatus:qo,setSubmitting:Ho,setTouched:bo,setValues:$o,submitForm:$a,validateForm:Lo,validateField:xo,isValid:Wl,dirty:Ol,unregisterField:po,registerField:uo,getFieldProps:Al,getFieldMeta:ga,getFieldHelpers:El,validateOnBlur:no,validateOnChange:to,validateOnMount:oo});return zl}function Formik(Xr){var eo=useFormik(Xr),to=Xr.component,ro=Xr.children,no=Xr.render,io=Xr.innerRef;return reactExports.useImperativeHandle(io,function(){return eo}),reactExports.createElement(FormikProvider,{value:eo},to?reactExports.createElement(to,eo):no?no(eo):ro?isFunction$1(ro)?ro(eo):isEmptyChildren(ro)?null:reactExports.Children.only(ro):null)}function warnAboutMissingIdentifier(Xr){var eo=Xr.htmlContent,to=Xr.documentationAnchorLink,ro=Xr.handlerName;console.warn("Warning: Formik called `"+ro+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+eo+` +`);const oo=createData(eo,to,no),ao=Utils$1.getSymbolSize(eo),so=new BitMatrix(ao);return setupFinderPattern(so,eo),setupTimingPattern(so),setupAlignmentPattern(so,eo),setupFormatInfo(so,to,0),eo>=7&&setupVersionInfo(so,eo),setupData(so,oo),isNaN(ro)&&(ro=MaskPattern.getBestMask(so,setupFormatInfo.bind(null,so,to))),MaskPattern.applyMask(ro,so),setupFormatInfo(so,to,ro),{modules:so,version:eo,errorCorrectionLevel:to,maskPattern:ro,segments:no}}qrcode.create=function(eo,to){if(typeof eo>"u"||eo==="")throw new Error("No input text");let ro=ECLevel.M,no,io;return typeof to<"u"&&(ro=ECLevel.from(to.errorCorrectionLevel,ECLevel.M),no=Version.from(to.version),io=MaskPattern.from(to.maskPattern),to.toSJISFunc&&Utils$1.setToSJISFunction(to.toSJISFunc)),createSymbol(eo,no,ro,io)};var canvas={},utils$9={};(function(Xr){function eo(to){if(typeof to=="number"&&(to=to.toString()),typeof to!="string")throw new Error("Color should be defined as hex string");let ro=to.slice().replace("#","").split("");if(ro.length<3||ro.length===5||ro.length>8)throw new Error("Invalid hex color: "+to);(ro.length===3||ro.length===4)&&(ro=Array.prototype.concat.apply([],ro.map(function(io){return[io,io]}))),ro.length===6&&ro.push("F","F");const no=parseInt(ro.join(""),16);return{r:no>>24&255,g:no>>16&255,b:no>>8&255,a:no&255,hex:"#"+ro.slice(0,6).join("")}}Xr.getOptions=function(ro){ro||(ro={}),ro.color||(ro.color={});const no=typeof ro.margin>"u"||ro.margin===null||ro.margin<0?4:ro.margin,io=ro.width&&ro.width>=21?ro.width:void 0,oo=ro.scale||4;return{width:io,scale:io?4:oo,margin:no,color:{dark:eo(ro.color.dark||"#000000ff"),light:eo(ro.color.light||"#ffffffff")},type:ro.type,rendererOpts:ro.rendererOpts||{}}},Xr.getScale=function(ro,no){return no.width&&no.width>=ro+no.margin*2?no.width/(ro+no.margin*2):no.scale},Xr.getImageWidth=function(ro,no){const io=Xr.getScale(ro,no);return Math.floor((ro+no.margin*2)*io)},Xr.qrToImageData=function(ro,no,io){const oo=no.modules.size,ao=no.modules.data,so=Xr.getScale(oo,io),co=Math.floor((oo+io.margin*2)*so),lo=io.margin*so,uo=[io.color.light,io.color.dark];for(let ho=0;ho=lo&&go>=lo&&ho"u"&&(!oo||!oo.getContext)&&(so=oo,oo=void 0),oo||(co=ro()),so=eo.getOptions(so);const lo=eo.getImageWidth(io.modules.size,so),uo=co.getContext("2d"),ho=uo.createImageData(lo,lo);return eo.qrToImageData(ho.data,io,so),to(uo,co,lo),uo.putImageData(ho,0,0),co},Xr.renderToDataURL=function(io,oo,ao){let so=ao;typeof so>"u"&&(!oo||!oo.getContext)&&(so=oo,oo=void 0),so||(so={});const co=Xr.render(io,oo,so),lo=so.type||"image/png",uo=so.rendererOpts||{};return co.toDataURL(lo,uo.quality)}})(canvas);var svgTag={};const Utils=utils$9;function getColorAttrib(Xr,eo){const to=Xr.a/255,ro=eo+'="'+Xr.hex+'"';return to<1?ro+" "+eo+'-opacity="'+to.toFixed(2).slice(1)+'"':ro}function svgCmd(Xr,eo,to){let ro=Xr+eo;return typeof to<"u"&&(ro+=" "+to),ro}function qrToPath(Xr,eo,to){let ro="",no=0,io=!1,oo=0;for(let ao=0;ao0&&so>0&&Xr[ao-1]||(ro+=io?svgCmd("M",so+to,.5+co+to):svgCmd("m",no,0),no=0,io=!1),so+1':"",co="',lo='viewBox="0 0 '+ao+" "+ao+'"',ho=''+so+co+` +`;return typeof ro=="function"&&ro(null,ho),ho};const canPromise=canPromise$1,QRCode$1=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(Xr,eo,to,ro,no){const io=[].slice.call(arguments,1),oo=io.length,ao=typeof io[oo-1]=="function";if(!ao&&!canPromise())throw new Error("Callback required as last argument");if(ao){if(oo<2)throw new Error("Too few arguments provided");oo===2?(no=to,to=eo,eo=ro=void 0):oo===3&&(eo.getContext&&typeof no>"u"?(no=ro,ro=void 0):(no=ro,ro=to,to=eo,eo=void 0))}else{if(oo<1)throw new Error("Too few arguments provided");return oo===1?(to=eo,eo=ro=void 0):oo===2&&!eo.getContext&&(ro=to,to=eo,eo=void 0),new Promise(function(so,co){try{const lo=QRCode$1.create(to,ro);so(Xr(lo,eo,ro))}catch(lo){co(lo)}})}try{const so=QRCode$1.create(to,ro);no(null,Xr(so,eo,ro))}catch(so){no(so)}}browser$h.create=QRCode$1.create;browser$h.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$h.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$h.toString=renderCanvas.bind(null,function(Xr,eo,to){return SvgRenderer.render(Xr,to)});var isArray$5=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,hasElementType=typeof Element<"u";function equal$1(Xr,eo){if(Xr===eo)return!0;if(Xr&&eo&&typeof Xr=="object"&&typeof eo=="object"){var to=isArray$5(Xr),ro=isArray$5(eo),no,io,oo;if(to&&ro){if(io=Xr.length,io!=eo.length)return!1;for(no=io;no--!==0;)if(!equal$1(Xr[no],eo[no]))return!1;return!0}if(to!=ro)return!1;var ao=Xr instanceof Date,so=eo instanceof Date;if(ao!=so)return!1;if(ao&&so)return Xr.getTime()==eo.getTime();var co=Xr instanceof RegExp,lo=eo instanceof RegExp;if(co!=lo)return!1;if(co&&lo)return Xr.toString()==eo.toString();var uo=keyList(Xr);if(io=uo.length,io!==keyList(eo).length)return!1;for(no=io;no--!==0;)if(!hasProp.call(eo,uo[no]))return!1;if(hasElementType&&Xr instanceof Element&&eo instanceof Element)return Xr===eo;for(no=io;no--!==0;)if(oo=uo[no],!(oo==="_owner"&&Xr.$$typeof)&&!equal$1(Xr[oo],eo[oo]))return!1;return!0}return Xr!==Xr&&eo!==eo}var reactFastCompare=function(eo,to){try{return equal$1(eo,to)}catch(ro){if(ro.message&&ro.message.match(/stack|recursion/i)||ro.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",ro.name,ro.message),!1;throw ro}};const isEqual=getDefaultExportFromCjs$2(reactFastCompare);var isMergeableObject=function(eo){return isNonNullObject(eo)&&!isSpecial(eo)};function isNonNullObject(Xr){return!!Xr&&typeof Xr=="object"}function isSpecial(Xr){var eo=Object.prototype.toString.call(Xr);return eo==="[object RegExp]"||eo==="[object Date]"||isReactElement(Xr)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(Xr){return Xr.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(Xr){return Array.isArray(Xr)?[]:{}}function cloneUnlessOtherwiseSpecified(Xr,eo){return eo.clone!==!1&&eo.isMergeableObject(Xr)?deepmerge(emptyTarget(Xr),Xr,eo):Xr}function defaultArrayMerge(Xr,eo,to){return Xr.concat(eo).map(function(ro){return cloneUnlessOtherwiseSpecified(ro,to)})}function mergeObject(Xr,eo,to){var ro={};return to.isMergeableObject(Xr)&&Object.keys(Xr).forEach(function(no){ro[no]=cloneUnlessOtherwiseSpecified(Xr[no],to)}),Object.keys(eo).forEach(function(no){!to.isMergeableObject(eo[no])||!Xr[no]?ro[no]=cloneUnlessOtherwiseSpecified(eo[no],to):ro[no]=deepmerge(Xr[no],eo[no],to)}),ro}function deepmerge(Xr,eo,to){to=to||{},to.arrayMerge=to.arrayMerge||defaultArrayMerge,to.isMergeableObject=to.isMergeableObject||isMergeableObject;var ro=Array.isArray(eo),no=Array.isArray(Xr),io=ro===no;return io?ro?to.arrayMerge(Xr,eo,to):mergeObject(Xr,eo,to):cloneUnlessOtherwiseSpecified(eo,to)}deepmerge.all=function(eo,to){if(!Array.isArray(eo))throw new Error("first argument should be an array");return eo.reduce(function(ro,no){return deepmerge(ro,no,to)},{})};var deepmerge_1=deepmerge,freeGlobal$1=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1,freeSelf$1=typeof self=="object"&&self&&self.Object===Object&&self,root$2=freeGlobal$1||freeSelf$1||Function("return this")(),Symbol$2=root$2.Symbol,objectProto$e=Object.prototype,hasOwnProperty$b=objectProto$e.hasOwnProperty,nativeObjectToString$1=objectProto$e.toString,symToStringTag$1=Symbol$2?Symbol$2.toStringTag:void 0;function getRawTag(Xr){var eo=hasOwnProperty$b.call(Xr,symToStringTag$1),to=Xr[symToStringTag$1];try{Xr[symToStringTag$1]=void 0;var ro=!0}catch{}var no=nativeObjectToString$1.call(Xr);return ro&&(eo?Xr[symToStringTag$1]=to:delete Xr[symToStringTag$1]),no}var objectProto$d=Object.prototype,nativeObjectToString=objectProto$d.toString;function objectToString$2(Xr){return nativeObjectToString.call(Xr)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$2?Symbol$2.toStringTag:void 0;function baseGetTag(Xr){return Xr==null?Xr===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(Xr)?getRawTag(Xr):objectToString$2(Xr)}function overArg(Xr,eo){return function(to){return Xr(eo(to))}}var getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(Xr){return Xr!=null&&typeof Xr=="object"}var objectTag$3="[object Object]",funcProto$3=Function.prototype,objectProto$c=Object.prototype,funcToString$3=funcProto$3.toString,hasOwnProperty$a=objectProto$c.hasOwnProperty,objectCtorString=funcToString$3.call(Object);function isPlainObject$1(Xr){if(!isObjectLike(Xr)||baseGetTag(Xr)!=objectTag$3)return!1;var eo=getPrototype(Xr);if(eo===null)return!0;var to=hasOwnProperty$a.call(eo,"constructor")&&eo.constructor;return typeof to=="function"&&to instanceof to&&funcToString$3.call(to)==objectCtorString}function listCacheClear(){this.__data__=[],this.size=0}function eq$1(Xr,eo){return Xr===eo||Xr!==Xr&&eo!==eo}function assocIndexOf(Xr,eo){for(var to=Xr.length;to--;)if(eq$1(Xr[to][0],eo))return to;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(Xr){var eo=this.__data__,to=assocIndexOf(eo,Xr);if(to<0)return!1;var ro=eo.length-1;return to==ro?eo.pop():splice.call(eo,to,1),--this.size,!0}function listCacheGet(Xr){var eo=this.__data__,to=assocIndexOf(eo,Xr);return to<0?void 0:eo[to][1]}function listCacheHas(Xr){return assocIndexOf(this.__data__,Xr)>-1}function listCacheSet(Xr,eo){var to=this.__data__,ro=assocIndexOf(to,Xr);return ro<0?(++this.size,to.push([Xr,eo])):to[ro][1]=eo,this}function ListCache(Xr){var eo=-1,to=Xr==null?0:Xr.length;for(this.clear();++eo-1&&Xr%1==0&&Xr-1&&Xr%1==0&&Xr<=MAX_SAFE_INTEGER$2}var argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$1="[object Error]",funcTag$2="[object Function]",mapTag$4="[object Map]",numberTag$2="[object Number]",objectTag$2="[object Object]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$2]=typedArrayTags[boolTag$2]=typedArrayTags[dataViewTag$3]=typedArrayTags[dateTag$2]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$2]=typedArrayTags[mapTag$4]=typedArrayTags[numberTag$2]=typedArrayTags[objectTag$2]=typedArrayTags[regexpTag$2]=typedArrayTags[setTag$4]=typedArrayTags[stringTag$2]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(Xr){return isObjectLike(Xr)&&isLength(Xr.length)&&!!typedArrayTags[baseGetTag(Xr)]}function baseUnary(Xr){return function(eo){return Xr(eo)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal$1.process,nodeUtil=function(){try{var Xr=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return Xr||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray$1=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function arrayLikeKeys(Xr,eo){var to=isArray$4(Xr),ro=!to&&isArguments$1(Xr),no=!to&&!ro&&isBuffer(Xr),io=!to&&!ro&&!no&&isTypedArray$1(Xr),oo=to||ro||no||io,ao=oo?baseTimes(Xr.length,String):[],so=ao.length;for(var co in Xr)(eo||hasOwnProperty$4.call(Xr,co))&&!(oo&&(co=="length"||no&&(co=="offset"||co=="parent")||io&&(co=="buffer"||co=="byteLength"||co=="byteOffset")||isIndex(co,so)))&&ao.push(co);return ao}var objectProto$5=Object.prototype;function isPrototype(Xr){var eo=Xr&&Xr.constructor,to=typeof eo=="function"&&eo.prototype||objectProto$5;return Xr===to}var nativeKeys=overArg(Object.keys,Object),objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function baseKeys(Xr){if(!isPrototype(Xr))return nativeKeys(Xr);var eo=[];for(var to in Object(Xr))hasOwnProperty$3.call(Xr,to)&&to!="constructor"&&eo.push(to);return eo}function isArrayLike(Xr){return Xr!=null&&isLength(Xr.length)&&!isFunction$2(Xr)}function keys$1(Xr){return isArrayLike(Xr)?arrayLikeKeys(Xr):baseKeys(Xr)}function baseAssign(Xr,eo){return Xr&©Object(eo,keys$1(eo),Xr)}function nativeKeysIn(Xr){var eo=[];if(Xr!=null)for(var to in Object(Xr))eo.push(to);return eo}var objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function baseKeysIn(Xr){if(!isObject$a(Xr))return nativeKeysIn(Xr);var eo=isPrototype(Xr),to=[];for(var ro in Xr)ro=="constructor"&&(eo||!hasOwnProperty$2.call(Xr,ro))||to.push(ro);return to}function keysIn(Xr){return isArrayLike(Xr)?arrayLikeKeys(Xr,!0):baseKeysIn(Xr)}function baseAssignIn(Xr,eo){return Xr&©Object(eo,keysIn(eo),Xr)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root$2.Buffer:void 0,allocUnsafe$1=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer$1(Xr,eo){if(eo)return Xr.slice();var to=Xr.length,ro=allocUnsafe$1?allocUnsafe$1(to):new Xr.constructor(to);return Xr.copy(ro),ro}function copyArray(Xr,eo){var to=-1,ro=Xr.length;for(eo||(eo=Array(ro));++to=0)&&(to[no]=Xr[no]);return to}var isFunction$1=function(eo){return typeof eo=="function"},isObject$9=function(eo){return eo!==null&&typeof eo=="object"},isInteger$2=function(eo){return String(Math.floor(Number(eo)))===eo},isString$3=function(eo){return Object.prototype.toString.call(eo)==="[object String]"},isEmptyChildren=function(eo){return reactExports.Children.count(eo)===0},isPromise=function(eo){return isObject$9(eo)&&isFunction$1(eo.then)};function getIn(Xr,eo,to,ro){ro===void 0&&(ro=0);for(var no=toPath(eo);Xr&&ro=0?[]:{}}}return(io===0?Xr:no)[oo[io]]===to?Xr:(to===void 0?delete no[oo[io]]:no[oo[io]]=to,io===0&&to===void 0&&delete ro[oo[io]],ro)}function setNestedObjectValues(Xr,eo,to,ro){to===void 0&&(to=new WeakMap),ro===void 0&&(ro={});for(var no=0,io=Object.keys(Xr);no0?Fl.map(function(cu){return Fo(cu,getIn(Dl,cu))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(Jl).then(function(cu){return cu.reduce(function(Ll,Xl,ku){return Xl==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||Xl&&(Ll=setIn(Ll,Fl[ku],Xl)),Ll},{})})},[Fo]),Jo=reactExports.useCallback(function(Dl){return Promise.all([Wo(Dl),ho.validationSchema?Mo(Dl):{},ho.validate?Bo(Dl):{}]).then(function(Fl){var Jl=Fl[0],cu=Fl[1],Ll=Fl[2],Xl=deepmerge_1.all([Jl,cu,Ll],{arrayMerge});return Xl})},[ho.validate,ho.validationSchema,Wo,Bo,Mo]),Po=useEventCallback(function(Dl){return Dl===void 0&&(Dl=Oo.values),jo({type:"SET_ISVALIDATING",payload:!0}),Jo(Dl).then(function(Fl){return $o.current&&(jo({type:"SET_ISVALIDATING",payload:!1}),jo({type:"SET_ERRORS",payload:Fl})),Fl})});reactExports.useEffect(function(){oo&&$o.current===!0&&isEqual(go.current,ho.initialValues)&&Po(go.current)},[oo,Po]);var fo=reactExports.useCallback(function(Dl){var Fl=Dl&&Dl.values?Dl.values:go.current,Jl=Dl&&Dl.errors?Dl.errors:bo.current?bo.current:ho.initialErrors||{},cu=Dl&&Dl.touched?Dl.touched:wo.current?wo.current:ho.initialTouched||{},Ll=Dl&&Dl.status?Dl.status:Eo.current?Eo.current:ho.initialStatus;go.current=Fl,bo.current=Jl,wo.current=cu,Eo.current=Ll;var Xl=function(){jo({type:"RESET_FORM",payload:{isSubmitting:!!Dl&&!!Dl.isSubmitting,errors:Jl,touched:cu,status:Ll,values:Fl,isValidating:!!Dl&&!!Dl.isValidating,submitCount:Dl&&Dl.submitCount&&typeof Dl.submitCount=="number"?Dl.submitCount:0}})};if(ho.onReset){var ku=ho.onReset(Oo.values,ga);isPromise(ku)?ku.then(Xl):Xl()}else Xl()},[ho.initialErrors,ho.initialStatus,ho.initialTouched]);reactExports.useEffect(function(){$o.current===!0&&!isEqual(go.current,ho.initialValues)&&(co&&(go.current=ho.initialValues,fo()),oo&&Po(go.current))},[co,ho.initialValues,fo,oo,Po]),reactExports.useEffect(function(){co&&$o.current===!0&&!isEqual(bo.current,ho.initialErrors)&&(bo.current=ho.initialErrors||emptyErrors,jo({type:"SET_ERRORS",payload:ho.initialErrors||emptyErrors}))},[co,ho.initialErrors]),reactExports.useEffect(function(){co&&$o.current===!0&&!isEqual(wo.current,ho.initialTouched)&&(wo.current=ho.initialTouched||emptyTouched,jo({type:"SET_TOUCHED",payload:ho.initialTouched||emptyTouched}))},[co,ho.initialTouched]),reactExports.useEffect(function(){co&&$o.current===!0&&!isEqual(Eo.current,ho.initialStatus)&&(Eo.current=ho.initialStatus,jo({type:"SET_STATUS",payload:ho.initialStatus}))},[co,ho.initialStatus,ho.initialTouched]);var yo=useEventCallback(function(Dl){if(Co.current[Dl]&&isFunction$1(Co.current[Dl].validate)){var Fl=getIn(Oo.values,Dl),Jl=Co.current[Dl].validate(Fl);return isPromise(Jl)?(jo({type:"SET_ISVALIDATING",payload:!0}),Jl.then(function(cu){return cu}).then(function(cu){jo({type:"SET_FIELD_ERROR",payload:{field:Dl,value:cu}}),jo({type:"SET_ISVALIDATING",payload:!1})})):(jo({type:"SET_FIELD_ERROR",payload:{field:Dl,value:Jl}}),Promise.resolve(Jl))}else if(ho.validationSchema)return jo({type:"SET_ISVALIDATING",payload:!0}),Mo(Oo.values,Dl).then(function(cu){return cu}).then(function(cu){jo({type:"SET_FIELD_ERROR",payload:{field:Dl,value:cu[Dl]}}),jo({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),vo=reactExports.useCallback(function(Dl,Fl){var Jl=Fl.validate;Co.current[Dl]={validate:Jl}},[]),_o=reactExports.useCallback(function(Dl){delete Co.current[Dl]},[]),So=useEventCallback(function(Dl,Fl){jo({type:"SET_TOUCHED",payload:Dl});var Jl=Fl===void 0?no:Fl;return Jl?Po(Oo.values):Promise.resolve()}),To=reactExports.useCallback(function(Dl){jo({type:"SET_ERRORS",payload:Dl})},[]),Ao=useEventCallback(function(Dl,Fl){var Jl=isFunction$1(Dl)?Dl(Oo.values):Dl;jo({type:"SET_VALUES",payload:Jl});var cu=Fl===void 0?to:Fl;return cu?Po(Jl):Promise.resolve()}),ko=reactExports.useCallback(function(Dl,Fl){jo({type:"SET_FIELD_ERROR",payload:{field:Dl,value:Fl}})},[]),mo=useEventCallback(function(Dl,Fl,Jl){jo({type:"SET_FIELD_VALUE",payload:{field:Dl,value:Fl}});var cu=Jl===void 0?to:Jl;return cu?Po(setIn(Oo.values,Dl,Fl)):Promise.resolve()}),Io=reactExports.useCallback(function(Dl,Fl){var Jl=Fl,cu=Dl,Ll;if(!isString$3(Dl)){Dl.persist&&Dl.persist();var Xl=Dl.target?Dl.target:Dl.currentTarget,ku=Xl.type,iu=Xl.name,hu=Xl.id,Cu=Xl.value,_l=Xl.checked,Go=Xl.outerHTML,yl=Xl.options,Al=Xl.multiple;Jl=Fl||iu||hu,cu=/number|range/.test(ku)?(Ll=parseFloat(Cu),isNaN(Ll)?"":Ll):/checkbox/.test(ku)?getValueForCheckbox(getIn(Oo.values,Jl),_l,Cu):yl&&Al?getSelectedValues(yl):Cu}Jl&&mo(Jl,cu)},[mo,Oo.values]),Do=useEventCallback(function(Dl){if(isString$3(Dl))return function(Fl){return Io(Fl,Dl)};Io(Dl)}),Lo=useEventCallback(function(Dl,Fl,Jl){Fl===void 0&&(Fl=!0),jo({type:"SET_FIELD_TOUCHED",payload:{field:Dl,value:Fl}});var cu=Jl===void 0?no:Jl;return cu?Po(Oo.values):Promise.resolve()}),Ho=reactExports.useCallback(function(Dl,Fl){Dl.persist&&Dl.persist();var Jl=Dl.target,cu=Jl.name,Ll=Jl.id,Xl=Jl.outerHTML,ku=Fl||cu||Ll;Lo(ku,!0)},[Lo]),Yo=useEventCallback(function(Dl){if(isString$3(Dl))return function(Fl){return Ho(Fl,Dl)};Ho(Dl)}),Xo=reactExports.useCallback(function(Dl){isFunction$1(Dl)?jo({type:"SET_FORMIK_STATE",payload:Dl}):jo({type:"SET_FORMIK_STATE",payload:function(){return Dl}})},[]),qo=reactExports.useCallback(function(Dl){jo({type:"SET_STATUS",payload:Dl})},[]),Ko=reactExports.useCallback(function(Dl){jo({type:"SET_ISSUBMITTING",payload:Dl})},[]),Qo=useEventCallback(function(){return jo({type:"SUBMIT_ATTEMPT"}),Po().then(function(Dl){var Fl=Dl instanceof Error,Jl=!Fl&&Object.keys(Dl).length===0;if(Jl){var cu;try{if(cu=$a(),cu===void 0)return}catch(Ll){throw Ll}return Promise.resolve(cu).then(function(Ll){return $o.current&&jo({type:"SUBMIT_SUCCESS"}),Ll}).catch(function(Ll){if($o.current)throw jo({type:"SUBMIT_FAILURE"}),Ll})}else if($o.current&&(jo({type:"SUBMIT_FAILURE"}),Fl))throw Dl})}),zo=useEventCallback(function(Dl){Dl&&Dl.preventDefault&&isFunction$1(Dl.preventDefault)&&Dl.preventDefault(),Dl&&Dl.stopPropagation&&isFunction$1(Dl.stopPropagation)&&Dl.stopPropagation(),Qo().catch(function(Fl){console.warn("Warning: An unhandled error was caught from submitForm()",Fl)})}),ga={resetForm:fo,validateForm:Po,validateField:yo,setErrors:To,setFieldError:ko,setFieldTouched:Lo,setFieldValue:mo,setStatus:qo,setSubmitting:Ko,setTouched:So,setValues:Ao,setFormikState:Xo,submitForm:Qo},$a=useEventCallback(function(){return lo(Oo.values,ga)}),Sl=useEventCallback(function(Dl){Dl&&Dl.preventDefault&&isFunction$1(Dl.preventDefault)&&Dl.preventDefault(),Dl&&Dl.stopPropagation&&isFunction$1(Dl.stopPropagation)&&Dl.stopPropagation(),fo()}),El=reactExports.useCallback(function(Dl){return{value:getIn(Oo.values,Dl),error:getIn(Oo.errors,Dl),touched:!!getIn(Oo.touched,Dl),initialValue:getIn(go.current,Dl),initialTouched:!!getIn(wo.current,Dl),initialError:getIn(bo.current,Dl)}},[Oo.errors,Oo.touched,Oo.values]),Tl=reactExports.useCallback(function(Dl){return{setValue:function(Jl,cu){return mo(Dl,Jl,cu)},setTouched:function(Jl,cu){return Lo(Dl,Jl,cu)},setError:function(Jl){return ko(Dl,Jl)}}},[mo,Lo,ko]),Il=reactExports.useCallback(function(Dl){var Fl=isObject$9(Dl),Jl=Fl?Dl.name:Dl,cu=getIn(Oo.values,Jl),Ll={name:Jl,value:cu,onChange:Do,onBlur:Yo};if(Fl){var Xl=Dl.type,ku=Dl.value,iu=Dl.as,hu=Dl.multiple;Xl==="checkbox"?ku===void 0?Ll.checked=!!cu:(Ll.checked=!!(Array.isArray(cu)&&~cu.indexOf(ku)),Ll.value=ku):Xl==="radio"?(Ll.checked=cu===ku,Ll.value=ku):iu==="select"&&hu&&(Ll.value=Ll.value||[],Ll.multiple=!0)}return Ll},[Yo,Do,Oo.values]),Zl=reactExports.useMemo(function(){return!isEqual(go.current,Oo.values)},[go.current,Oo.values]),Vl=reactExports.useMemo(function(){return typeof ao<"u"?Zl?Oo.errors&&Object.keys(Oo.errors).length===0:ao!==!1&&isFunction$1(ao)?ao(ho):ao:Oo.errors&&Object.keys(Oo.errors).length===0},[ao,Zl,Oo.errors,ho]),Ol=_extends$1g({},Oo,{initialValues:go.current,initialErrors:bo.current,initialTouched:wo.current,initialStatus:Eo.current,handleBlur:Yo,handleChange:Do,handleReset:Sl,handleSubmit:zo,resetForm:fo,setErrors:To,setFormikState:Xo,setFieldTouched:Lo,setFieldValue:mo,setFieldError:ko,setStatus:qo,setSubmitting:Ko,setTouched:So,setValues:Ao,submitForm:Qo,validateForm:Po,validateField:yo,isValid:Vl,dirty:Zl,unregisterField:_o,registerField:vo,getFieldProps:Il,getFieldMeta:El,getFieldHelpers:Tl,validateOnBlur:no,validateOnChange:to,validateOnMount:oo});return Ol}function Formik(Xr){var eo=useFormik(Xr),to=Xr.component,ro=Xr.children,no=Xr.render,io=Xr.innerRef;return reactExports.useImperativeHandle(io,function(){return eo}),reactExports.createElement(FormikProvider,{value:eo},to?reactExports.createElement(to,eo):no?no(eo):ro?isFunction$1(ro)?ro(eo):isEmptyChildren(ro)?null:reactExports.Children.only(ro):null)}function warnAboutMissingIdentifier(Xr){var eo=Xr.htmlContent,to=Xr.documentationAnchorLink,ro=Xr.handlerName;console.warn("Warning: Formik called `"+ro+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+eo+` Formik cannot determine which value to update. For more info see https://formik.org/docs/api/formik#`+to+` - `)}function yupToFormErrors(Xr){var eo={};if(Xr.inner){if(Xr.inner.length===0)return setIn(eo,Xr.path,Xr.message);for(var no=Xr.inner,to=Array.isArray(no),ro=0,no=to?no:no[Symbol.iterator]();;){var io;if(to){if(ro>=no.length)break;io=no[ro++]}else{if(ro=no.next(),ro.done)break;io=ro.value}var oo=io;getIn(eo,oo.path)||(eo=setIn(eo,oo.path,oo.message))}}return eo}function validateYupSchema(Xr,eo,to,ro){to===void 0&&(to=!1),ro===void 0&&(ro={});var no=prepareDataForValidation(Xr);return eo[to?"validateSync":"validate"](no,{abortEarly:!1,context:ro})}function prepareDataForValidation(Xr){var eo=Array.isArray(Xr)?[]:{};for(var to in Xr)if(Object.prototype.hasOwnProperty.call(Xr,to)){var ro=String(to);Array.isArray(Xr[ro])===!0?eo[ro]=Xr[ro].map(function(no){return Array.isArray(no)===!0||isPlainObject$1(no)?prepareDataForValidation(no):no!==""?no:void 0}):isPlainObject$1(Xr[ro])?eo[ro]=prepareDataForValidation(Xr[ro]):eo[ro]=Xr[ro]!==""?Xr[ro]:void 0}return eo}function arrayMerge(Xr,eo,to){var ro=Xr.slice();return eo.forEach(function(io,oo){if(typeof ro[oo]>"u"){var ao=to.clone!==!1,so=ao&&to.isMergeableObject(io);ro[oo]=so?deepmerge_1(Array.isArray(io)?[]:{},io,to):io}else to.isMergeableObject(io)?ro[oo]=deepmerge_1(Xr[oo],io,to):Xr.indexOf(io)===-1&&ro.push(io)}),ro}function getSelectedValues(Xr){return Array.from(Xr).filter(function(eo){return eo.selected}).map(function(eo){return eo.value})}function getValueForCheckbox(Xr,eo,to){if(typeof Xr=="boolean")return!!eo;var ro=[],no=!1,io=-1;if(Array.isArray(Xr))ro=Xr,io=Xr.indexOf(to),no=io>=0;else if(!to||to=="true"||to=="false")return!!eo;return eo&&to&&!no?ro.concat(to):no?ro.slice(0,io).concat(ro.slice(io+1)):ro}var useIsomorphicLayoutEffect$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useEventCallback(Xr){var eo=reactExports.useRef(Xr);return useIsomorphicLayoutEffect$1(function(){eo.current=Xr}),reactExports.useCallback(function(){for(var to=arguments.length,ro=new Array(to),no=0;no{if(!Xr.groupedWallets.length)throw new Error("Wallet group must have at least one wallet");const[eo]=Xr.groupedWallets;if(eo.chainGroup)return"multi-chain";if(eo.walletGroup)return"multi-wallet"},WalletGroupContext=React.createContext(void 0),useWalletGroupContext=()=>{const Xr=React.useContext(WalletGroupContext);if(Xr===void 0)throw new Error("usage of useWalletGroupContext not wrapped in `WalletGroupContextProvider`.");return Xr},WalletGroupContextProvider=({children:Xr})=>{const[eo,to]=React.useState(),{setView:ro}=useViewContext(),io={navigateToWalletGroup:React.useCallback(oo=>{to(oo);const ao=getWalletGroupType(oo),so={"multi-chain":"wallet-group","multi-wallet":"select-wallet-in-wallet-group"},co=ao?so[ao]:so["multi-chain"];ro(co)},[to,ro]),selectedWalletGroup:eo};return jsxRuntimeExports.jsx(WalletGroupContext.Provider,{value:io,children:Xr})},IpConfigurationContext=reactExports.createContext(void 0),IpConfigurationContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(null),ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(eo)return eo;try{const oo=yield fetch("http://ip-api.com/json");if(!oo.ok)return;const ao=yield oo.json();if(ao.status!=="success")return;const{country:so,countryCode:co}=ao,lo={country:so,countryCode:co};return to(lo),lo}catch(oo){logger$9.warn("Error fetching IP configuration",oo);return}}),[eo,to]),no=()=>{to(null)},io=reactExports.useMemo(()=>({getIpConfiguration:ro,removeIpConfiguration:no}),[ro]);return jsxRuntimeExports.jsx(IpConfigurationContext.Provider,{value:io,children:Xr})},useIpConfigurationContext=()=>{const Xr=reactExports.useContext(IpConfigurationContext);if(Xr===void 0)throw new Error("usage of useIpConfigurationContext not wrapped in `IpConfigurationContextProvider`.");return Xr},getReferencedAccount=(Xr,eo)=>{const to=Xr==null?void 0:Xr.verifiedCredentials.find(ro=>ro.id===eo);return Xr==null?void 0:Xr.verifiedCredentials.find(ro=>ro.id===(to==null?void 0:to.refId))},useInternalDynamicContext=()=>{const Xr=reactExports.useContext(DynamicContext);if(Xr===void 0)throw new Error("useInternalDynamicContext must be used within a DynamicContextProvider");return Xr},ACTIVE_SESSION="session_active",ERROR_SENDING_CODE="error_sending_code",ERROR_PROCESSING_REVEAL_REQUEST="error_processing_reveal_request",INVALID_REQUEST$1="invalid_request",INVALID_WALLET_DATA="invalid_wallet",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED="secure_enclave_provider_not_enabled",USER_NOT_LOGGED_IN="user_not_logged_in",CODE_SENT="code_sent",SESSION_CREATED="session_created",SESSION_RESTORED="session_restored",ACCESS_BLOCKED_ERROR_CODE=451,generateMessages=(Xr,eo,to,ro,no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){if(Xr===void 0)throw new DynamicError("Unable to fetch the public address from the wallet");if(!eo.connectedChain)throw new DynamicError("Wallet is not connected");let oo=yield eo.getNetwork();oo===void 0&&(eo.key==="bloctoevm"?oo=137:eo.connectedChain==="EVM"&&(oo=1));const ao=eo.parseAddress(Xr),so=generateMessageToSign({blockchain:eo.connectedChain,chainId:oo,domain:window.location.host,nonce:to,publicKey:ao,requestId:ro,resources:eo.providerResources,statement:no?io.replace(/(\r\n|\n|\r)/gm," ").trim():void 0,uri:window.location.href}),co=yield eo.proveOwnership(ao,so);if(!co)throw new DynamicError("Unable to sign the message");return{messageToSign:so,signedMessage:co}}),getVerifyArgs=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({walletConnector:eo,nonce:to,walletProvider:ro,environmentId:no,displaySiweStatement:io,skipEmptyAccountCheck:oo,siweStatement:ao,publicWalletAddress:so,signedMessageOverride:co,messageToSignOverride:lo}){const fo=eo.connectedChain;if(co&&lo){const[wo,Eo]=yield Promise.all([eo.getNetwork(),eo.getAdditionalAddresses(so)]);return{additionalWalletAddresses:Eo,chain:fo,messageToSign:lo,network:String(wo),publicWalletAddress:so,signedMessage:co,skipEmptyAccountCheck:oo,walletName:eo.key,walletProvider:ro}}const{messageToSign:ho,signedMessage:go}=yield generateMessages(so,eo,to,no,io,ao),[yo,vo]=yield Promise.all([eo.getNetwork(),eo.getAdditionalAddresses(so)]);return{additionalWalletAddresses:vo,chain:fo,messageToSign:ho,network:String(yo),publicWalletAddress:so,signedMessage:go,skipEmptyAccountCheck:oo,walletName:eo.key,walletProvider:ro}}),createUserProfileFromSdkUser=Xr=>{var eo,to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo,Eo,ko,Ao,Po,jo,Mo;const No={alias:(eo=Xr.alias)!==null&&eo!==void 0?eo:void 0,btcWallet:(to=Xr.btcWallet)!==null&&to!==void 0?to:void 0,ckbWallet:(ro=Xr.ckbWallet)!==null&&ro!==void 0?ro:void 0,country:(no=Xr.country)!==null&&no!==void 0?no:void 0,discordNotification:(io=Xr.discordNotification)!==null&&io!==void 0?io:void 0,dogeWallet:(oo=Xr.dogeWallet)!==null&&oo!==void 0?oo:void 0,email:(ao=Xr.email)!==null&&ao!==void 0?ao:void 0,emailNotification:(so=Xr.emailNotification)!==null&&so!==void 0?so:void 0,firstName:(co=Xr.firstName)!==null&&co!==void 0?co:void 0,jobTitle:(lo=Xr.jobTitle)!==null&&lo!==void 0?lo:void 0,kasWallet:(fo=Xr.kasWallet)!==null&&fo!==void 0?fo:void 0,kdaWallet:(ho=Xr.kdaWallet)!==null&&ho!==void 0?ho:void 0,lastName:(go=Xr.lastName)!==null&&go!==void 0?go:void 0,ltcWallet:(yo=Xr.ltcWallet)!==null&&yo!==void 0?yo:void 0,newsletterNotification:(vo=Xr.newsletterNotification)!==null&&vo!==void 0?vo:void 0,phoneNumber:(wo=Xr.phoneNumber)!==null&&wo!==void 0?wo:void 0,policiesConsent:(Eo=Xr.policiesConsent)!==null&&Eo!==void 0?Eo:void 0,tShirtSize:(ko=Xr.tShirtSize)!==null&&ko!==void 0?ko:void 0,team:(Ao=Xr.team)!==null&&Ao!==void 0?Ao:void 0,username:(Po=Xr.username)!==null&&Po!==void 0?Po:void 0};return Object.assign({environmentId:Xr.projectEnvironmentId,lastVerifiedCredentialId:(jo=Xr.lastVerifiedCredentialId)!==null&&jo!==void 0?jo:void 0,lists:Xr.lists,metadata:Xr.metadata,mfaBackupCodeAcknowledgement:Xr.mfaBackupCodeAcknowledgement,missingFields:Xr.missingFields,newUser:Xr.newUser,scope:Xr.scope,sessionId:(Mo=Xr.sessionId)!==null&&Mo!==void 0?Mo:"missing-sessionId",userId:Xr.id,verifiedCredentials:Xr.verifiedCredentials||[]},No)},storeAuthToken=(Xr,eo)=>{StorageService.setItem(AUTH_TOKEN,Xr,{priority:["secureStorage","localStorage"]}),StorageService.setItem(AUTH_MIN_TOKEN$1,eo,{priority:["secureStorage","localStorage"]})},storeExpiresAt=Xr=>{StorageService.setItem(AUTH_EXPIRES_AT,Xr)},storeAuthTokenAndUser=({user:Xr,jwt:eo,minifiedJwt:to,expiresAt:ro})=>{if(storeExpiresAt(ro),eo&&to&&(storeAuthToken(eo,to),isCookieEnabled$1())){const io=new Date(ro*1e3).toUTCString(),oo=`${DYNAMIC_AUTH_COOKIE_NAME}=${to}; expires=${io}; path=/; SameSite=Lax`;document.cookie=oo}const no=createUserProfileFromSdkUser(Xr);return setUser(no),no},storeSelectedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to}){try{const ro=yield sdkApi$1().selectUserWallet({environmentId:eo,userWalletSelectionRequest:{walletId:to}});return storeAuthTokenAndUser(ro)}catch(ro){logger$8.error("error storing selected wallet",ro);return}}),linkWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{messageToSign:ro,network:no,signedMessage:io,publicWalletAddress:oo,chain:ao,walletName:so,walletProvider:co,additionalWalletAddresses:lo,backup:fo,password:ho,passwordSource:go}){const yo=VerifyRequestFromJSON({additionalWalletAddresses:lo,backup:fo,chain:ao,messageToSign:ro,network:no,password:ho,passwordSource:go,publicWalletAddress:oo,signedMessage:io,walletName:so,walletProvider:co});try{const vo=yield sdkApi$1().verifyLink({environmentId:to,verifyRequest:yo});return storeAuthTokenAndUser(vo),vo}catch(vo){logger$8.error(vo);const wo=yield vo.json();throw wo.code==="reassign_wallet_confirm"||wo.code==="reassign_wallet_error"?new WalletUsedError(wo.code):wo.code==="merge_accounts_confirmation"?new MergeAccountsConfirmationError({code:wo.code,mergeConflicts:wo.payload.mergeConflicts,walletAddress:oo}):wo.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(wo.error.message):new DynamicError(wo.error)}}),unlinkWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,primaryWalletId:to,walletId:ro,onSuccess:no}){try{const io=yield sdkApi$1().verifyUnlink({environmentId:eo,verifyUnlinkRequest:{primaryWalletId:to,walletId:ro}});return no==null||no(),storeAuthTokenAndUser(io)}catch{return}}),transferWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{network:ro,messageToSign:no,signedMessage:io,publicWalletAddress:oo,chain:ao,walletName:so,walletProvider:co,skipEmptyAccountCheck:lo=!1}){const fo={chain:ao,messageToSign:no,network:ro,publicWalletAddress:oo,signedMessage:io,skipEmptyAccountCheck:lo,walletName:so,walletProvider:co};try{const ho=yield sdkApi$1().verifyTransfer({environmentId:to,verifyRequest:fo});return storeAuthTokenAndUser(ho)}catch(ho){logger$8.error("error transferring wallet",ho);return}}),verifyWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{messageToSign:ro,signedMessage:no,publicWalletAddress:io,chain:oo,walletName:ao,walletProvider:so,captchaToken:co,network:lo,oauth:fo,additionalWalletAddresses:ho,sessionPublicKey:go}){const yo=VerifyRequestFromJSON({additionalWalletAddresses:ho,captchaToken:co,chain:oo,messageToSign:ro,network:lo,oauth:fo,publicWalletAddress:io,sessionPublicKey:go,signedMessage:no,walletName:ao,walletProvider:so});try{return yield sdkApi$1().verify({environmentId:to,verifyRequest:yo})}catch(vo){logger$8.error(vo);const wo=yield vo.json();if(wo.code==="wallet_not_deployed")throw new WalletNotDeployedError;if(wo.error.code==="chainalysis_blocked_wallet")throw new ChainalysisError(wo.payload.walletPublicKey);if(wo.error.code==="gate_blocked")throw new GateBlockedError(wo.payload.walletPublicKey);if(wo.error.code==="missing_from_list")throw new NoAccessError({walletPublicKey:wo.payload.walletPublicKey});if(wo.code==="email_associated_with_different_provider")throw new AccountExistsError(wo.error,wo.payload);if(wo.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(wo.error.message);return}}),getSiweStatement=({appName:Xr,siweStatement:eo})=>{const to=`Welcome to ${Xr}. Signing is the only way we can truly know that you are the owner of the wallet you are connecting. Signing is a safe, gas-less transaction that does not in any way give ${Xr} permission to perform any transactions with your wallet.`;return eo||to},getWalletProvider=Xr=>Xr.isEmbeddedWallet?"embeddedWallet":Xr.canConnectViaCustodialService?"custodialService":Xr.isInstalledOnBrowser()?"browserExtension":isMobile$1()?"deepLink":"qrCode",findEmbeddedWalletFromVerifiedCredentials=(Xr,eo)=>{var to;const ro=(to=Xr==null?void 0:Xr.verifiedCredentials)===null||to===void 0?void 0:to.filter(({walletProvider:no})=>no===WalletProviderEnum.EmbeddedWallet);return ro!=null&&ro.length&&(eo!=null&&eo.length)?ro.find(({chain:no})=>no&&eo.includes(VerifiedCredentialNameToChainEnum[no])):ro==null?void 0:ro.shift()},isProviderEnabled=(Xr,eo)=>Xr.some(to=>{const ro=to.provider===eo&&!!to.enabledAt;return to.provider===ProviderEnum.MagicLink?ro&&!!to.providerProjectId:ro}),isTurnkeyEnabled=Xr=>{var eo;return isProviderEnabled((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.Turnkey)},isCoinbaseWaasEnabled=Xr=>{var eo;return isProviderEnabled((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.CoinbaseWaas)},hasEmbeddedWallet=(Xr,eo)=>{var to;return!!(Xr&&(!((to=Xr.verifiedCredentials)===null||to===void 0)&&to.some(({walletProvider:ro,walletName:no})=>ro===WalletProviderEnum.EmbeddedWallet&&(!eo||(no==null?void 0:no.startsWith(eo))))))},findPrimaryEmbeddedChain=Xr=>{var eo,to,ro;return((ro=(((to=(eo=Xr==null?void 0:Xr.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.chainConfigurations)||[]).find(io=>io.primary))===null||ro===void 0?void 0:ro.name)==="SOL"?ChainEnum.Sol:ChainEnum.Evm},getUserVerifiedCredentialType=(Xr,eo)=>{var to,ro,no;if(!Xr)return;if(eo)return(ro=(to=Xr.verifiedCredentials)===null||to===void 0?void 0:to.find(oo=>oo.format===eo))===null||ro===void 0?void 0:ro.format;const io=(no=Xr.verifiedCredentials)===null||no===void 0?void 0:no.find(oo=>oo.id===Xr.lastVerifiedCredentialId);return io==null?void 0:io.format},findWalletOptionFor=(Xr,eo)=>{var to;const ro=Xr.walletName;if(ro==="turnkeyhd"){const no=Xr.chain?VerifiedCredentialNameToChainEnum[Xr.chain]:void 0;return eo.find(io=>ro===io.key&&io.walletConnector.connectedChain===no)}return(to=eo.find(no=>ro===no.key))!==null&&to!==void 0?to:eo.find(no=>no.key==="fallbackconnector")},chainIconMap={algorand:AlgorandIcon,bitcoin:BitcoinIcon,cosmos:CosmosIcon,evm:EthereumIcon,flow:FlowIcon,solana:SolanaIcon,starknet:StarknetIcon},getChainIcon=Xr=>{var eo,to,ro;const no=(to=(eo=getChainInfo(Xr))===null||eo===void 0?void 0:eo.name)!==null&&to!==void 0?to:"";return(ro=chainIconMap[no])!==null&&ro!==void 0?ro:SvgError},getEnabledKYC=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.filter(({enabled:to})=>!!to))!==null&&eo!==void 0?eo:[]},filterFields=["social"],mapUserFieldsToKycSettings=(Xr,eo)=>Object.entries(Xr).reduce((ro,[no,io])=>{if(io){const oo=eo.find(ao=>ao.name===no);oo&&!oo.enabled&&ro.push(Object.assign({},oo))}return ro},[]),getEditableUserProfileFields=Xr=>getEnabledKYC(Xr).filter(({name:eo,type:to})=>to===KycFieldType.Custom||!filterFields.includes(eo)),getNonEditableUserProfileFields=({projectSettingsKyc:Xr=[],user:eo})=>eo?mapUserFieldsToKycSettings(eo,Xr).filter(({name:ro})=>!filterFields.includes(ro)):[],getUserProfileFields=({projectSettingsKyc:Xr=[],customFields:eo=[],user:to})=>{var ro;const no=getEditableUserProfileFields([...Xr,...eo]),io=getNonEditableUserProfileFields({projectSettingsKyc:Xr,user:to});let oo=[...no,...io];const ao=(ro=to==null?void 0:to.verifiedCredentials)===null||ro===void 0?void 0:ro.find(({walletProvider:lo})=>lo===WalletProviderEnum.EmbeddedWallet),so=!!(to!=null&&to.email),co=!!(to!=null&&to.phoneNumber);return ao&&(oo=oo.map(lo=>lo.name==="email"&&so||lo.name==="phoneNumber"&&co?Object.assign(Object.assign({},lo),{enabled:!1}):lo)),oo.sort((lo,fo)=>{const ho=Xr.findIndex(yo=>yo.name===lo.name),go=Xr.findIndex(yo=>yo.name===fo.name);return ho-go})},isSocialKycEnabled=Xr=>{var eo;return!!(!((eo=Xr==null?void 0:Xr.kyc.find(({name:to})=>to==="social"))===null||eo===void 0)&&eo.enabled)};function _assertThisInitialized(Xr){if(Xr===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Xr}function generateQuery(Xr){return Object.entries(Xr).filter(function(eo){eo[0];var to=eo[1];return to||to===!1}).map(function(eo){var to=eo[0],ro=eo[1];return encodeURIComponent(to)+"="+encodeURIComponent(ro)}).join("&")}var SCRIPT_ID="hcaptcha-api-script-id",HCAPTCHA_LOAD_FN_NAME="hcaptchaOnLoad",resolveFn,rejectFn,mountPromise=new Promise(function(Xr,eo){resolveFn=Xr,rejectFn=eo}),mountCaptchaScript=function(eo){if(eo===void 0&&(eo={}),document.getElementById(SCRIPT_ID))return mountPromise;window[HCAPTCHA_LOAD_FN_NAME]=resolveFn;var to=eo.apihost||"https://js.hcaptcha.com";delete eo.apihost;var ro=document.createElement("script");ro.id=SCRIPT_ID,ro.src=to+"/1/api.js?render=explicit&onload="+HCAPTCHA_LOAD_FN_NAME,ro.async=!0,ro.onerror=function(io){return rejectFn("script-error")};var no=generateQuery(eo);return ro.src+=no!==""?"&"+no:"",document.head.appendChild(ro),mountPromise},HCaptcha=function(Xr){_inheritsLoose(eo,Xr);function eo(ro){var no;no=Xr.call(this,ro)||this,no.renderCaptcha=no.renderCaptcha.bind(_assertThisInitialized(no)),no.resetCaptcha=no.resetCaptcha.bind(_assertThisInitialized(no)),no.removeCaptcha=no.removeCaptcha.bind(_assertThisInitialized(no)),no.isReady=no.isReady.bind(_assertThisInitialized(no)),no.loadCaptcha=no.loadCaptcha.bind(_assertThisInitialized(no)),no.handleOnLoad=no.handleOnLoad.bind(_assertThisInitialized(no)),no.handleSubmit=no.handleSubmit.bind(_assertThisInitialized(no)),no.handleExpire=no.handleExpire.bind(_assertThisInitialized(no)),no.handleError=no.handleError.bind(_assertThisInitialized(no)),no.handleOpen=no.handleOpen.bind(_assertThisInitialized(no)),no.handleClose=no.handleClose.bind(_assertThisInitialized(no)),no.handleChallengeExpired=no.handleChallengeExpired.bind(_assertThisInitialized(no));var io=typeof hcaptcha<"u";return no.ref=reactExports.createRef(),no.apiScriptRequested=!1,no.state={isApiReady:io,isRemoved:!1,elementId:ro.id,captchaId:""},no}var to=eo.prototype;return to.componentDidMount=function(){var no=this.state.isApiReady;if(no){this.renderCaptcha();return}this.loadCaptcha()},to.componentWillUnmount=function(){var no=this.state.captchaId;this.isReady()&&(hcaptcha.reset(no),hcaptcha.remove(no))},to.shouldComponentUpdate=function(no,io){return!(this.state.isApiReady!==io.isApiReady||this.state.isRemoved!==io.isRemoved)},to.componentDidUpdate=function(no){var io=this,oo=["sitekey","size","theme","tabindex","languageOverride","endpoint"],ao=oo.every(function(so){return no[so]===io.props[so]});ao||this.removeCaptcha(function(){io.renderCaptcha()})},to.loadCaptcha=function(){if(!this.apiScriptRequested){var no=this.props,io=no.apihost,oo=no.assethost,ao=no.endpoint,so=no.host,co=no.imghost,lo=no.languageOverride,fo=no.reCaptchaCompat,ho=no.reportapi,go=no.sentry,yo=no.custom,vo={apihost:io,assethost:oo,endpoint:ao,hl:lo,host:so,imghost:co,recaptchacompat:fo===!1?"off":null,reportapi:ho,sentry:go,custom:yo};mountCaptchaScript(vo).then(this.handleOnLoad).catch(this.handleError),this.apiScriptRequested=!0}},to.renderCaptcha=function(no){var io=this.state.isApiReady;if(io){var oo=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),ao=hcaptcha.render(this.ref.current,oo);this.setState({isRemoved:!1,captchaId:ao},function(){no&&no()})}},to.resetCaptcha=function(){var no=this.state.captchaId;this.isReady()&&hcaptcha.reset(no)},to.removeCaptcha=function(no){var io=this.state.captchaId;this.isReady()&&this.setState({isRemoved:!0},function(){hcaptcha.remove(io),no&&no()})},to.handleOnLoad=function(){var no=this;this.setState({isApiReady:!0},function(){no.renderCaptcha(function(){var io=no.props.onLoad;io&&io()})})},to.handleSubmit=function(no){var io=this.props.onVerify,oo=this.state,ao=oo.isRemoved,so=oo.captchaId;if(!(typeof hcaptcha>"u"||ao)){var co=hcaptcha.getResponse(so),lo=hcaptcha.getRespKey(so);io(co,lo)}},to.handleExpire=function(){var no=this.props.onExpire,io=this.state.captchaId;this.isReady()&&(hcaptcha.reset(io),no&&no())},to.handleError=function(no){var io=this.props.onError,oo=this.state.captchaId;this.isReady()&&hcaptcha.reset(oo),io&&io(no)},to.isReady=function(){var no=this.state,io=no.isApiReady,oo=no.isRemoved;return io&&!oo},to.handleOpen=function(){!this.isReady()||!this.props.onOpen||this.props.onOpen()},to.handleClose=function(){!this.isReady()||!this.props.onClose||this.props.onClose()},to.handleChallengeExpired=function(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()},to.execute=function(no){no===void 0&&(no=null);var io=this.state.captchaId;if(this.isReady())return no&&typeof no!="object"&&(no=null),hcaptcha.execute(io,no)},to.setData=function(no){var io=this.state.captchaId;this.isReady()&&(no&&typeof no!="object"&&(no=null),hcaptcha.setData(io,no))},to.getResponse=function(){return hcaptcha.getResponse(this.state.captchaId)},to.getRespKey=function(){return hcaptcha.getRespKey(this.state.captchaId)},to.render=function(){var no=this.state.elementId;return reactExports.createElement("div",{ref:this.ref,id:no})},eo}(reactExports.Component);const createTurnkeyEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({attestation:eo,challenge:to,environmentId:ro,chains:no=[EmbeddedWalletChainEnum.Evm],passkeyAlias:io}){const oo=[{chains:no,embeddedWalletProvider:EmbeddedWalletProviderEnum.Turnkeyhd,isAuthenticatorAttached:!1,passkeyAlias:io}];eo&&to&&(oo[0]=Object.assign(Object.assign({},oo[0]),{embeddedWalletSpecificOpts:{attestation:eo,challenge:to},isAuthenticatorAttached:!0}));try{const ao=yield sdkApi$1().createEmbeddedWallets({createEmbeddedWalletsRequest:{embeddedWallets:oo},environmentId:ro});return storeAuthTokenAndUser(ao)}catch(ao){logger$8.error("Error creating embedded wallet: ",ao);return}}),initEmbeddedWalletSession$1=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,walletId:to,publicKey:ro,environmentId:no}){return eo==="passkey"?sdkApi$1().initPasskeyRecovery({environmentId:no,initPasskeyRecoveryRequest:{turnkeyRecoveryTargetPublicKey:ro,walletId:to}}):sdkApi$1().initEmailAuth({environmentId:no,initEmailAuthRequest:{turnkeyEmailAuthTargetPublicKey:ro,walletId:to}})}),completePasskeyRecovery$1=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({walletId:eo,attestation:to,challenge:ro,environmentId:no}){try{const io=yield sdkApi$1().completePasskeyRecovery({completePasskeyRecoveryRequest:{attestation:to,challenge:ro,walletId:eo},environmentId:no});return storeAuthTokenAndUser(io)}catch(io){logger$8.error("Error completing passkey recovery: ",io);return}}),updatePasskeyRecoveryEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,updateRecoveryEmailRequest:to}){try{yield sdkApi$1().updateEmbeddedWalletRecoveryEmail({environmentId:eo,updateRecoveryEmailRequest:to})}catch(ro){throw logger$8.error("Error while trying to update recovery email: ",ro),new DynamicError("Error updating recovery email")}}),getUserPasskeys=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return yield sdkApi$1().getUserPasskeys({environmentId:eo})}catch(to){return logger$8.error(to),{count:0,passkeys:[]}}}),updateUserPasskey=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,id:to,alias:ro}){try{return yield sdkApi$1().updatePasskey({environmentId:eo,updateUserPasskeyRequest:{alias:ro,id:to}})}catch(no){logger$8.error(no);return}}),exportEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to,activityId:ro}){try{return yield sdkApi$1().embeddedWalletExport({activityId:ro,environmentId:eo,walletId:to})}catch(no){return logger$8.error(no),{exportBundle:""}}}),getWalletAuthToken=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to}){try{return(yield sdkApi$1().getAuthToken({environmentId:eo,type:to})).token}catch{return}}),getEmbeddedWalletBackup=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return(yield sdkApi$1().getEmbeddedWalletBackups({environmentId:eo})).secret}catch{return}}),getEmbeddedWalletPasscode=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return(yield sdkApi$1().getEmbeddedWalletPasscode({environmentId:eo})).secret}catch{return}}),claimEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to}){var ro,no;try{const io=yield sdkApi$1().claimEmbeddedWallet({embeddedWalletPasscodeClaimRequest:{walletId:to},environmentId:eo});return storeAuthTokenAndUser(io),io}catch(io){logger$8.error(io);const oo=yield(ro=io==null?void 0:io.json)===null||ro===void 0?void 0:ro.call(io);if(!(!((no=oo==null?void 0:oo.error)===null||no===void 0)&&no.code))return{code:"unknown_error"};throw io}}),registerSessionKey=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,publicKey:to}){try{return yield sdkApi$1().registerSessionKey({environmentId:eo,registerSessionKeyRequest:{publicKey:to}}),to}catch(ro){logger$8.error("Error registering session key",ro);return}}),getCreateEmbeddedWalletAccountRequest=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,chain:to}){try{return yield sdkApi$1().getCreateWalletAccountRequest({chain:to,environmentId:eo})}catch(ro){throw logger$8.error("Error fetching create embedded wallet account request: ",ro),new DynamicError("Error fetching create embedded wallet account request")}}),createEmbeddedWalletAccount=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,createEmbeddedWalletAccountRequest:to}){try{return yield sdkApi$1().createWalletAccount({createWalletAccountRequest:{turnkeySignedRequest:to},environmentId:eo})}catch(ro){throw logger$8.error("Error creating embedded wallet account: ",ro),new DynamicError("Error creating embedded wallet account")}}),createPartialStoreSetter=({get:Xr,set:eo})=>(to,ro)=>eo(Object.assign(Object.assign({},Xr()),{[to]:ro})),{getSendBalanceState,setSendBalanceState,useSendBalanceState,resetSendBalanceState}=createStoreState("sendBalanceState"),setSendBalanceVariable=createPartialStoreSetter({get:getSendBalanceState,set:setSendBalanceState}),magicRpcError=-32603,errorCodesMapping={"-32002":"Insufficient funds for this transaction.",0:"The operation either timed out or was not allowed.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature.",INSUFFICIENT_FUNDS:"Insufficient funds for this transaction.",[magicRpcError.toString()]:"A network error has occurred. Please try again later"},errorReasonsMapping={"provided ENS name resolves to null":"Invalid address. Please check that the entered address is correct."},getCode=Xr=>{var eo;const to=Xr;return(to==null?void 0:to.code)||((eo=to==null?void 0:to.cause)===null||eo===void 0?void 0:eo.code)},getMessage=Xr=>{const eo=Xr;return eo==null?void 0:eo.message},hasReason=Xr=>"reason"in Xr&&Xr.reason!==void 0,isTransactionExecutionError$1=Xr=>Xr!=null&&typeof Xr=="object"&&"walk"in Xr&&typeof Xr.walk=="function",transactionErrorMessage=Xr=>{let eo=Xr;if(isTransactionExecutionError$1(Xr)&&(eo=Xr.walk()),logger$8.debug("transaction error:",eo),TransactionGasCannotBeSponsoredError.isInstance(eo))return;if(InsufficientFundsError.isInstance(eo)||isMagicInsufficientFundsError(eo))return errorCodesMapping.INSUFFICIENT_FUNDS;const to=getCode(eo);return to!==void 0&&errorCodesMapping[to]?errorCodesMapping[to]:hasReason(eo)&&errorReasonsMapping[eo.reason]?errorReasonsMapping[eo.reason]:"Something went wrong."},isMagicInsufficientFundsError=Xr=>{const eo=getCode(Xr),to=getMessage(Xr);return eo===magicRpcError&&!!(to!=null&&to.includes("insufficient funds for gas * price + value"))},Badge=({className:Xr="",dot:eo,text:to,copykey:ro,variant:no="secondary"})=>jsxRuntimeExports.jsxs("div",{className:classNames("badge__container",`badge__container__${no}`,Xr),children:[eo&&jsxRuntimeExports.jsx("span",{"data-testid":"badge__dot",className:"badge__dot"}),jsxRuntimeExports.jsx("span",{copykey:ro,children:to})]}),{getTokenBalancesState,setTokenBalancesState,useTokenBalancesState}=createStoreState("tokenBalancesState"),setTokenBalanceVariable=createPartialStoreSetter({get:getTokenBalancesState,set:setTokenBalancesState}),DotsMenuDropdown=({options:Xr,setShowMenu:eo})=>jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__container",style:{zIndex:tooltipZIndex},children:Xr.map(to=>to.hide?null:jsxRuntimeExports.jsxs("div",{className:"dots-menu-dropdown__item",onClick:()=>{to.callback(),eo(!1)},children:[to.Icon&&jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:to.Icon}),jsxRuntimeExports.jsxs(Typography,{className:"dots-menu-dropdown__item-text",color:to.fontColor?to.fontColor:"secondary",weight:to.fontWeight,children:[to.text," ",to.badge?jsxRuntimeExports.jsx(Badge,{text:to.badge}):null]}),to.endSlot&&jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__item__end-slot",children:to.endSlot})]},to.text))});var _path$10,_excluded$1c=["title","titleId"];function _extends$1e(){return _extends$1e=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1c(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgThreeDots=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1c(eo,_excluded$1c);return reactExports.createElement("svg",_extends$1e({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$10||(_path$10=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2a1.333 1.333 0 1 1 0 2.667A1.333 1.333 0 0 1 8 2Zm0 4.667a1.333 1.333 0 1 1 0 2.666 1.333 1.333 0 0 1 0-2.666Zm0 4.666A1.333 1.333 0 1 1 8 14a1.333 1.333 0 0 1 0-2.667Z",fill:"currentColor"})))};const DotsMenu=({options:Xr,buttonClassName:eo,buttonClassNameWithOpenMenu:to,direction:ro="right",iconOverride:no})=>{const io=reactExports.useRef(null),oo=reactExports.useRef(null),[ao,so]=reactExports.useState(!1);return useOnClickOutside(oo,()=>so(!1)),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(IconButton,{ref:io,onClick:()=>so(!0),"data-testid":"dotsMenu",className:ao?to:eo,children:no||jsxRuntimeExports.jsx(Icon,{children:jsxRuntimeExports.jsx(SvgThreeDots,{})})}),jsxRuntimeExports.jsx(Dropdown,{isOpen:ao,onClickOutside:()=>so(!1),onScroll:()=>so(!1),anchorRef:io,ref:oo,anchorOrigin:ro==="right"?"bottom-left":"top-right",transformOrigin:ro==="right"?"top-left":"bottom-right",children:jsxRuntimeExports.jsx(DotsMenuDropdown,{options:Xr,setShowMenu:so})})]})},DEFAULT_BREAKPOINT=12,DEFAULT_CUT_END=4,DEFAULT_CUT_START=4,shortenString=(Xr,eo,to)=>Xr.replace(Xr.substring(eo,to),"..."),shortenEmail=(Xr,eo)=>{if(!Xr)return"";const to=(eo==null?void 0:eo.breakpoint)||DEFAULT_BREAKPOINT,ro=(eo==null?void 0:eo.cutStart)||DEFAULT_CUT_START,no=(eo==null?void 0:eo.cutEnd)||DEFAULT_CUT_END;let[io,oo]=Xr.split("@");return(io==null?void 0:io.length)>to&&(io=shortenString(io,ro,io.length-no)),(oo==null?void 0:oo.length)>to&&(oo=shortenString(oo,ro,oo.length-no)),`${io}@${oo}`},detectBrowserName=Xr=>{const eo=navigator.userAgent;if(eo.match(/brave/i))return"brave";if(eo.match(/edg/i))return"edge";if(eo.match(/chrome|chromium|crios/i))return"chrome";if(eo.match(/firefox|fxios/i))return"firefox";if(eo.match(/safari/i))return"safari"};jsxRuntimeExports.jsx(AndroidIcon,{}),jsxRuntimeExports.jsx(BraveIcon,{}),jsxRuntimeExports.jsx(ChromeIcon,{}),jsxRuntimeExports.jsx(EdgeIcon,{}),jsxRuntimeExports.jsx(FirefoxIcon,{}),jsxRuntimeExports.jsx(AppleIcon,{}),jsxRuntimeExports.jsx(OperaIcon,{}),jsxRuntimeExports.jsx(SafariIcon,{});const PasskeyContext=reactExports.createContext(void 0),PasskeyContextProviderWithBrowser=({children:Xr})=>{var eo,to,ro,no,io,oo,ao,so;const{userHasEmbeddedWallet:co}=useEmbeddedWallet(),{isSessionKeyCompatible:lo,isTurnkeyWalletWithoutAuthenticator:fo}=useIsTurnkeyWallet(),{environmentId:ho,projectSettings:go,user:yo}=useInternalDynamicContext(),[vo,wo]=reactExports.useState(!1),[Eo,ko]=reactExports.useState(void 0),[Ao,Po]=reactExports.useState(void 0),[jo,Mo]=useLocalStorage(EMBEDDED_WALLET_SECURE_BANNER,!0),No=reactExports.useMemo(()=>{var xo,uo,po,bo;const _o=!!(!((bo=(po=(uo=(xo=go==null?void 0:go.sdk)===null||xo===void 0?void 0:xo.embeddedWallets)===null||uo===void 0?void 0:uo.supportedSecurityMethods)===null||po===void 0?void 0:po.passkey)===null||bo===void 0)&&bo.isEnabled);return jo!==!1&&fo&&_o},[fo,jo,(no=(ro=(to=(eo=go==null?void 0:go.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.supportedSecurityMethods)===null||ro===void 0?void 0:ro.passkey)===null||no===void 0?void 0:no.isEnabled]),Do=reactExports.useCallback(()=>{var xo,uo,po,bo;const _o=!!(!((bo=(po=(uo=(xo=go==null?void 0:go.sdk)===null||xo===void 0?void 0:xo.embeddedWallets)===null||uo===void 0?void 0:uo.supportedSecurityMethods)===null||po===void 0?void 0:po.passkey)===null||bo===void 0)&&bo.isEnabled);return!lo&&(!No&&fo&&_o)},[(so=(ao=(oo=(io=go==null?void 0:go.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0?void 0:oo.supportedSecurityMethods)===null||ao===void 0?void 0:ao.passkey)===null||so===void 0?void 0:so.isEnabled,No,lo,fo]),Fo=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getUserPasskeys({environmentId:ho})).passkeys}),{deps:[ho,yo,co(),vo],enabled:!!(ho&&yo&&co())}),Xo=reactExports.useMemo(()=>{if(typeof window>"u")return!1;const xo=PlatformService.getHostname();return Fo.data?Fo.data.some(uo=>{if(!uo.origin)return!1;try{const po=new URL(uo.origin).hostname;return po===getTLD()||po===xo}catch(po){return logger$8.error(po),!1}}):!1},[Fo.data]),Lo=!fo&&!Xo,Bo=reactExports.useMemo(()=>{var xo;return{passkey:Eo,passkeyEdited:vo,passkeyIcon:Ao,setPasskey:ko,setPasskeyEdited:wo,setPasskeyIcon:Po,setShowSecureAccountBanner:Mo,showAlert:Do,showSecureAccountBanner:No,userHasPasskeysForCurrentOrigin:Xo,userNeedsCrossDomainPasskey:Lo,userPasskeys:(xo=Fo.data)!==null&&xo!==void 0?xo:[],userPasskeysLoading:Fo.isLoading}},[Eo,vo,Ao,Xo,Fo.data,Fo.isLoading,Lo,Do,Mo,No]);return jsxRuntimeExports.jsx(PasskeyContext.Provider,{value:Bo,children:Xr})},PasskeyContextProvider=({children:Xr})=>jsxRuntimeExports.jsx(PasskeyContextProviderWithBrowser,{children:Xr}),usePasskeyContext=()=>{const Xr=reactExports.useContext(PasskeyContext);if(Xr===void 0)throw new Error("usage of PasskeyContext not wrapped in `PasskeyContextProvider`.");return Xr},useOnlyConnectedMode=()=>{const{authMode:Xr,user:eo}=useInternalDynamicContext();return Xr==="connect-only"&&!eo},useKYCFlag=()=>{const Xr=useOnlyConnectedMode(),{projectSettings:eo,user:to}=useInternalDynamicContext();return Xr?!1:getUserProfileFields({customFields:eo==null?void 0:eo.customFields,projectSettingsKyc:eo==null?void 0:eo.kyc,user:to}).length>0||isSocialKycEnabled(eo)},useViewController=Xr=>{const[eo,to]=reactExports.useState(null);return{goToInitialView:()=>to(null),setView:to,view:eo||Xr}},DynamicWidgetContext=reactExports.createContext(void 0),DynamicWidgetContextProvider=({children:Xr})=>{const eo=reactExports.useRef(null),to=reactExports.useRef(null),ro=reactExports.useRef(null),{setShowDynamicUserProfile:no,showDynamicUserProfile:io,multiWallet:oo}=useInternalDynamicContext(),ao=useKYCFlag(),{view:so,setView:co,goToInitialView:lo}=useViewController(ao&&!oo?"profile":"wallets"),[fo,ho]=reactExports.useState({}),go=reactExports.useCallback((Eo,ko)=>{co(Eo),ho(ko||{})},[co]),yo=reactExports.useCallback(()=>{if(ao)return go("profile");go("wallets")},[ao,oo]),vo=reactExports.useMemo(()=>so==="manage-passkeys"||so==="manage-mfa"?"settings":!ao&&!oo&&so!=="settings"&&so!=="profile"?"wallets":so==="edit-profile"?"profile":so==="global-wallet"?"wallets":so,[so,ao,oo]);useInternalDynamicEvents("logout",()=>lo());const wo=reactExports.useMemo(()=>({availableWalletsContainerRef:ro,dynamicWidgetView:so,goToInitialDynamicWidgetView:lo,goToProfileView:yo,inlineControlsRef:to,isOpen:io,overridenWidgetView:vo,setDynamicWidgetView:go,setIsOpen:no,viewProps:fo,widgetRef:eo}),[so,lo,yo,io,go,no,vo,fo]);return jsxRuntimeExports.jsx(DynamicWidgetContext.Provider,{value:wo,children:Xr})},useWidgetContext=()=>{const Xr=reactExports.useContext(DynamicWidgetContext);if(Xr===void 0)throw new Error("usage of useWidgetContext not wrapped in `DynamicWidgetContextProvider`.");return Xr};var _path$$,_excluded$1b=["title","titleId"];function _extends$1d(){return _extends$1d=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1b(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAdd=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1b(eo,_excluded$1b);return reactExports.createElement("svg",_extends$1d({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$$||(_path$$=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2c.368 0 .667.298.667.667v4.666h4.666a.667.667 0 1 1 0 1.334H8.667v4.666a.667.667 0 1 1-1.334 0V8.667H2.667a.667.667 0 0 1 0-1.334h4.666V2.667C7.333 2.298 7.632 2 8 2Z",fill:"currentColor",fillOpacity:.4})))},_path$_,_excluded$1a=["title","titleId"];function _extends$1c(){return _extends$1c=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1a(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLink=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1a(eo,_excluded$1a);return reactExports.createElement("svg",_extends$1c({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$_||(_path$_=reactExports.createElement("path",{d:"M11.833 4.667H9.167V6h2.666c1.1 0 2 .9 2 2s-.9 2-2 2H9.167v1.333h2.666a3.335 3.335 0 0 0 0-6.666Zm-4 5.333H5.167c-1.1 0-2-.9-2-2s.9-2 2-2h2.666V4.667H5.167a3.335 3.335 0 0 0 0 6.666h2.666V10Zm-2-2.667h5.334v1.334H5.833V7.333Z",fill:"currentColor"})))},_g$d,_excluded$19=["title","titleId"];function _extends$1b(){return _extends$1b=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$19(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSend=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$19(eo,_excluded$19);return reactExports.createElement("svg",_extends$1b({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$d||(_g$d=reactExports.createElement("g",{clipPath:"url(#send_svg__clip0_6894_96)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m3.846 9.3.03-.01 14.64-5.728c.199-.078.399-.156.567-.205.156-.046.465-.126.794-.02.374.123.664.413.786.787.107.33.027.638-.019.794-.049.168-.127.368-.205.567L14.702 20.15c-.08.204-.16.408-.239.568-.073.147-.226.436-.537.614a1.277 1.277 0 0 1-1.136.072c-.323-.137-.496-.405-.58-.542-.09-.149-.184-.342-.278-.535l-2.693-5.52-5.546-2.724-.027-.014c-.193-.094-.385-.189-.533-.28-.137-.082-.403-.256-.54-.578a1.277 1.277 0 0 1 .074-1.136c.178-.31.466-.463.612-.536.16-.079.363-.158.567-.238Zm.972 1.425 4.88 2.396 2.912-2.913a.848.848 0 0 1 1.2-.017.848.848 0 0 1-.017 1.2l-2.898 2.898 2.384 4.888 5.433-13.888-13.894 5.436Z",fill:"currentColor",fillOpacity:.4}))))};const getActiveOauthCredential=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.verifiedCredentials)===null||eo===void 0?void 0:eo.find(to=>to.format==="oauth"&&to.id===Xr.lastVerifiedCredentialId)},getCustomCountries=Xr=>{const eo=R$7.map(M$5).map(to=>(to.iso2==="br"&&(to.format="(..) .....-...."),to.iso2==="fr"&&(to.format="(.) .. .. .. .."),Se$2(to)));return Xr?eo.filter(([,to])=>Xr.includes(to)):eo},formatPhone=Xr=>{var eo;const{country:to}=X$4({countries:getCustomCountries(),phone:Xr});if(!to)return Xr;const ro=de$4({dialCode:to.dialCode,phone:Xr}),no=Q$7({country:to,phone:Xr}),io=/\./g;if(((eo=no.match(io))!==null&&eo!==void 0?eo:[]).length!==removeNonDigits(ro).length)return Xr;let oo=0;const ao=no.replace(io,()=>ro[oo++]);return`+${to.dialCode} ${ao}`},removeNonDigits=Xr=>Xr.replace(/\D+/g,""),getUserIdentifier=Xr=>{const eo=getActiveOauthCredential(Xr);return eo!=null&&eo.publicIdentifier?eo.publicIdentifier:Xr!=null&&Xr.email?shortenEmail(Xr.email):Xr!=null&&Xr.phoneNumber?formatPhone(Xr.phoneNumber):"My Profile"};var _circle$5,_g$c,_excluded$18=["title","titleId"];function _extends$1a(){return _extends$1a=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$18(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSpinner=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$18(eo,_excluded$18);return reactExports.createElement("svg",_extends$1a({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2,style:{opacity:.1}}),reactExports.createElement("mask",{id:"spinner_svg__a",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:24,height:24},_circle$5||(_circle$5=reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2}))),_g$c||(_g$c=reactExports.createElement("g",{mask:"url(#spinner_svg__a)"},reactExports.createElement("path",{fill:"currentColor",d:"M12-16.5h27v27H12z"}))))};const Spinner$1=({className:Xr=""})=>jsxRuntimeExports.jsx(SvgSpinner,{className:classNames("spinner",Xr)}),Button=({buttonClassName:Xr="",buttonPadding:eo="medium",buttonVariant:to="primary",children:ro,feedback:no,expanded:io,dataTestId:oo,disabled:ao=!1,showInternalLoading:so=!0,loading:co=!1,onClick:lo,type:fo,startSlot:ho,endSlot:go})=>{const[yo,vo]=reactExports.useState(!1),[wo,Eo]=reactExports.useState(!1),ko={"brand-primary":"button--brand-primary",primary:"button--primary",secondary:"button--secondary",tertiary:"button--tertiary"},Po=classNames("button",{"button--expanded":!!io,"button--loading":!!co},eo?{default:"button--padding-default",large:"button--padding-large","login-screen-height":"button--padding-login-screen-height",medium:"button--padding-medium",none:"button--padding-none",small:"button--padding-small"}[eo]:"",to?ko[to]:"",Xr),jo=No=>__awaiter$j(void 0,void 0,void 0,function*(){if(lo){const Do=lo(No);if(Do instanceof Promise){so&&vo(!0);try{yield Do}finally{vo(!1)}}}no&&(Eo(!0),setTimeout(()=>{Eo(!1)},2e3))}),Mo=jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ho&&jsxRuntimeExports.jsx("div",{className:"button__start-slot",children:ho}),(no||ro)&&(wo&&no?no:ro),go&&jsxRuntimeExports.jsx("div",{className:"button__end-slot",children:go})]});return jsxRuntimeExports.jsxs("button",{type:fo,onClick:jo,className:Po,disabled:ao||yo||co,"data-testid":oo,children:[(yo||co)&&jsxRuntimeExports.jsx("div",{className:"button__spinner-container","data-testid":"button__spinner",children:jsxRuntimeExports.jsx(Spinner$1,{className:"button__spinner"})}),Mo]})},TypographyButton=Xr=>{var eo,{children:to,typographyProps:ro={variant:"button_primary"},copykey:no}=Xr,io=__rest$7(Xr,["children","typographyProps","copykey"]);return jsxRuntimeExports.jsx(Button,Object.assign({},io,{children:jsxRuntimeExports.jsx(Typography,Object.assign({variant:"button_primary",as:"span"},ro,{color:(eo=ro.color)!==null&&eo!==void 0?eo:"primary",copykey:no,children:to}))}))},Image$1=({src:Xr,alt:eo="",fallback:to,className:ro,dataTestId:no})=>{const[io,oo]=reactExports.useState(!1),ao=()=>{oo(!0)};return Xr&&!io?jsxRuntimeExports.jsx("img",{src:Xr,alt:eo,onError:ao,className:ro,"data-testid":no}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:to})},UserAvatar=({user:Xr,containerClassName:eo,renderWithFallback:to=!0})=>{const no=(()=>{var io,oo,ao;return(ao=(oo=(io=Xr==null?void 0:Xr.verifiedCredentials)===null||io===void 0?void 0:io.find(co=>{var lo;return Xr.lastVerifiedCredentialId===co.id&&((lo=co.oauthAccountPhotos)===null||lo===void 0?void 0:lo.length)}))===null||oo===void 0?void 0:oo.oauthAccountPhotos)===null||ao===void 0?void 0:ao[0]})();return!no&&!to?null:jsxRuntimeExports.jsx("div",{className:classNames("user-profile-social-account__connected-avatar",eo),children:jsxRuntimeExports.jsx(Image$1,{className:"user-profile-social-account__image",src:no,alt:"User avatar",dataTestId:"user-avatar",fallback:jsxRuntimeExports.jsx(UserProfileIcon,{})})})};var _path$Z,_excluded$17=["title","titleId"];function _extends$19(){return _extends$19=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$17(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgClose=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$17(eo,_excluded$17);return reactExports.createElement("svg",_extends$19({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Z||(_path$Z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.41 4.41a.833.833 0 0 1 1.18 0L10 8.822l4.41-4.41a.833.833 0 1 1 1.18 1.178L11.178 10l4.41 4.41a.833.833 0 1 1-1.178 1.18L10 11.177 5.588 15.59a.833.833 0 1 1-1.178-1.178L8.82 10l-4.41-4.41a.833.833 0 0 1 0-1.18Z",fill:"currentcolor"})))};const getEnabledEmbeddedWalletsAuthenticators=Xr=>{if(!Xr||!Object.keys(Xr).length)return{};const eo={};return Object.keys(Xr).filter(to=>{var ro;return(ro=Xr[to])===null||ro===void 0?void 0:ro.isEnabled}).forEach(to=>eo[to]=Xr[to]),eo},updateUserProfileFields=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().updateSelf({environmentId:Xr,userFields:eo}),ro=yield storeAuthTokenAndUser(to);return Object.assign(Object.assign({},to),{userProfile:ro})}catch(to){if(logger$8.error(to),to instanceof Response){const ro=yield to.json();if(ro.code==="email_already_exists")throw new EmailAlreadyExistsError;if(ro.code==="custom_field_data_not_unique")throw new CustomFieldNotUniqueError;if(ro.code==="username_already_exists")throw new UsernameAlreadyExistsError;if(ro.code==="too_many_verification_attempts")throw new TooManyEmailVerificationsError;if(ro.code==="invalid_phone"||ro.code==="invalid_sms_verification")throw new InvalidPhoneNumberError(ro.error)}throw to}}),mergeUserAccounts=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield sdkApi$1().mergeUsers({environmentId:Xr});return storeAuthTokenAndUser(eo)}catch(eo){throw logger$8.error(eo),eo}}),verifyMergeUsers=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().verifyMergeUsers({environmentId:Xr,mergeUserConflictResolutions:{mergeUserResolutions:eo}});return storeAuthTokenAndUser(to)}catch(to){throw logger$8.error(to),to}}),refreshUserJwt=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const to=yield sdkApi$1().refreshAuth({environmentId:eo});return storeAuthTokenAndUser(to)}catch{return}}),getAuthenticatedUser=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return yield sdkApi$1().getAuthenticatedUser({environmentId:eo})}catch(to){if(to.status===401)throw logger$8.error("No valid auth for getAuthenticatedUser",to),new CookieInvalidError;logger$8.error("Other error getting authenticated user",to);return}}),sessionExpirationUnit={days:86400,hours:3600,minutes:60},getEmbeddedWalletSessionExpiration=Xr=>{if(!Xr)return 0;const{unit:eo,amount:to}=Xr,ro=to||0,no=sessionExpirationUnit[eo]||0;return ro*no},useElementById=()=>{const Xr=reactExports.useRef(null);return{createRootElement:(to="dynamic-modal",ro)=>{if(typeof window>"u")return Xr;const no=window.document.getElementById(to);if(no)return Xr.current=no,Xr;const io=ro?window.document.getElementById(ro):void 0;return Xr.current=window.document.createElement("div"),Xr.current.setAttribute("id",to),Xr.current.setAttribute("class",to),Xr.current.setAttribute("data-testid",to),Xr.current.style.pointerEvents="auto",io?io.appendChild(Xr.current):window.document.body.appendChild(Xr.current),Xr}}},removeElementById=Xr=>{let eo;if(typeof window<"u"){eo=window.document.getElementById(Xr);const to=eo==null?void 0:eo.parentElement;if(!eo||!to)return;to.removeChild(eo)}},iframeContainerId$1="dyn-passkey-recovery-id",iframeElementId$1="dyn-passkey-recovery-element-id",initEmbeddedWalletSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,iframeContainer:to,iframeElementId:ro,environmentId:no,user:io,wallet:oo,sessionExpiration:ao}){var so;if(!io)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(oo!=null&&oo.connector)||!(oo!=null&&oo.id)||!isPasskeyWalletConnector(oo==null?void 0:oo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const co=(so=oo.connector)===null||so===void 0?void 0:so.getAuthenticatorHandler();if(eo==="passkey"&&co.isSessionActive())return addNewPasskeyAuthenticator({environmentId:no,user:io,wallet:oo});const lo=yield co.initRecovery(eo,to,ro,ao);if(!lo)throw new DynamicError("Something went wrong");const fo=yield initEmbeddedWalletSession$1({authenticatorType:eo,environmentId:no,publicKey:lo,walletId:oo.id});co.recoveryUserId=eo==="passkey"?fo.turnkeyRecoveryUserId:fo.turnkeyUserId}),passkeyRecoveryBundleValidation=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,bundleInput:to,wallet:ro}){var no,io,oo,ao;if(!to)throw new DynamicError("Code must be informed");if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!eo)throw new DynamicError(USER_NOT_LOGGED_IN);const so=(oo=(io=(no=eo.verifiedCredentials)===null||no===void 0?void 0:no.find(({walletName:fo})=>fo==null?void 0:fo.startsWith("turnkey")))===null||io===void 0?void 0:io.walletProperties)===null||oo===void 0?void 0:oo.turnkeySubOrganizationId,co=(ao=ro.connector)===null||ao===void 0?void 0:ao.getAuthenticatorHandler();yield co.verifyRecoveryCode(to,so);const lo={createdAt:new Date().getTime(),emailCode:to,userId:co.recoveryUserId};StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,lo)}),resentRecoveryEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,user:to,environmentId:ro,wallet:no}){var io;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(no!=null&&no.connector)||!(no!=null&&no.id)||!isPasskeyWalletConnector(no==null?void 0:no.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const oo=(io=no.connector)===null||io===void 0?void 0:io.getAuthenticatorHandler().publicKey;if(!oo)throw new DynamicError("Could not proceed with your request. Please restart the process.");return initEmbeddedWalletSession$1({authenticatorType:eo,environmentId:ro,publicKey:oo,walletId:no==null?void 0:no.id})}),completePasskeyRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){const{connector:no,user:io}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!1,environmentId:to,user:eo,wallet:ro});return no.getAuthenticatorHandler().clear(),removeElementById(iframeElementId$1),io}),addNewPasskeyAuthenticator=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){const{user:no}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!0,environmentId:to,user:eo,wallet:ro});return no}),recoverTurnkeyWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({wallet:eo,user:to,environmentId:ro,addPasskeyAuthenticator:no}){var io,oo,ao;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!eo||!eo.connector||!eo.id||!isPasskeyWalletConnector(eo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const so=eo.connector;so.setEmail(to.email);const co=(ao=(oo=(io=to.verifiedCredentials)===null||io===void 0?void 0:io.find(({walletName:wo})=>wo==null?void 0:wo.startsWith("turnkey")))===null||oo===void 0?void 0:oo.walletProperties)===null||ao===void 0?void 0:ao.turnkeySubOrganizationId;if(!co)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId is missing");const lo=eo.connector.getAuthenticatorHandler(),{attestation:fo,challenge:ho}=yield so.getWebAuthnAttestation();no?yield lo.addPasskeyAuthenticator({attestation:fo,challenge:ho,turnkeySubOrganizationId:co}):yield lo.completeRecovery({attestation:fo,challenge:ho,turnkeySubOrganizationId:co});const go=yield completePasskeyRecovery$1({attestation:fo,challenge:ho,environmentId:ro,walletId:eo.id});if(!go)throw new DynamicError("No user returned from passkey recovery");const yo=so.connectedChain;if(!findEmbeddedWalletFromVerifiedCredentials(go,[yo]))throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return so.setVerifiedCredentials(go.verifiedCredentials),{connector:so,user:go}}),canRestoreEmbeddedWalletSession=Xr=>{if(!(Xr!=null&&Xr.amount))return!1;const eo=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS);if(!eo)return!1;const to=Xr.amount*(Xr.unit==="minutes"?60:3600),ro=(eo==null?void 0:eo.createdAt)+to*1e3,no=new Date(ro);return new Date>=no?(StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),!1):!0},restoreEmbeddedWalletSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,iframeContainer:to,iframeElementId:ro,wallet:no,sessionExpiration:io}){var oo,ao,so,co;if(!eo)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(no!=null&&no.connector)||!(no!=null&&no.id)||!isPasskeyWalletConnector(no==null?void 0:no.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const lo=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS),fo=(oo=no.connector)===null||oo===void 0?void 0:oo.getAuthenticatorHandler();if(!lo||fo.recoveryUserId)return!1;if(!(yield fo.initRecovery("email",to,ro,io)))throw new DynamicError("Could not open embedded wallet connection communication");fo.recoveryUserId=lo.userId;const go=(co=(so=(ao=eo.verifiedCredentials)===null||ao===void 0?void 0:ao.find(({walletName:yo})=>yo==null?void 0:yo.startsWith("turnkey")))===null||so===void 0?void 0:so.walletProperties)===null||co===void 0?void 0:co.turnkeySubOrganizationId;return yield fo.verifyRecoveryCode(lo.emailCode,go),!0}),addEmailRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){var no,io;if(!(eo!=null&&eo.email))throw new DynamicError(USER_NOT_LOGGED_IN);if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector)||!isEmailWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const{turnkeySubOrganizationId:oo,turnkeyUserId:ao}=(io=(no=eo.verifiedCredentials)===null||no===void 0?void 0:no.find(({walletName:lo})=>lo==null?void 0:lo.startsWith("turnkey")))===null||io===void 0?void 0:io.walletProperties;if(!oo||!ao)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing");const so=ro.connector.getAuthenticatorHandler(),{signedRequest:co}=yield so.addEmailRecovery({email:eo.email,organizationId:oo,turnkeyUserId:ao});return yield updatePasskeyRecoveryEmail({environmentId:to,updateRecoveryEmailRequest:{turnkeySignedRequest:co}}),ro.connector.setEmail(eo.email),refreshUserJwt({environmentId:to})}),useInitEmbeddedWalletAuthMethod=()=>{const{primaryWallet:Xr,environmentId:eo,user:to,projectSettings:ro,setShowAuthFlow:no}=useInternalDynamicContext(),{setView:io}=useViewContext(),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(),{getEOAWallet:lo}=useSmartWallets();return{error:so,initAuthMethod:ho=>__awaiter$j(void 0,[ho],void 0,function*({authenticatorType:go,iframeContainer:yo,currentAction:vo}){var wo,Eo,ko,Ao,Po;ao(!0);const jo=(wo=Xr&&lo(Xr))!==null&&wo!==void 0?wo:Xr,Mo=((ko=(Eo=ro==null?void 0:ro.sdk.embeddedWallets)===null||Eo===void 0?void 0:Eo.sessionKeyDuration)===null||ko===void 0?void 0:ko.amount)||0,No=((Po=(Ao=ro==null?void 0:ro.sdk.embeddedWallets)===null||Ao===void 0?void 0:Ao.sessionKeyDuration)===null||Po===void 0?void 0:Po.unit)==="minutes"?60:3600,Do=go==="email"||!(jo==null?void 0:jo.connector).getAuthenticatorHandler().isSessionActive();try{yield initEmbeddedWalletSession({authenticatorType:go,environmentId:eo,iframeContainer:yo,iframeElementId:iframeElementId$1,sessionExpiration:Mo*No||void 0,user:to,wallet:jo}),Do?(io("passkey-recovery-bundle",{authenticatorType:go,currentAction:vo}),no(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})):no(!1)}catch(Fo){co(Fo),logger$8.error("Failed to create embedded wallet session",Fo),dynamicEvents.emit("passkeyRecoveryFailed",Fo)}finally{ao(!1)}}),isLoading:oo}},usePasskeyRecovery=()=>{var Xr,eo,to;const{environmentId:ro,primaryWallet:no,projectSettings:io,setShowAuthFlow:oo,user:ao}=useInternalDynamicContext(),{createRootElement:so}=useElementById(),co=so(iframeContainerId$1),{isTurnkeyWalletWithoutAuthenticator:lo,hasRecoveryEmail:fo}=useIsTurnkeyWallet(),{initAuthMethod:ho}=useInitEmbeddedWalletAuthMethod(),{setDisplayedDestination:go,setVerificationUUID:yo}=useVerification(),{getEOAWallet:vo}=useSmartWallets(),{setView:wo}=useViewContext(),Eo=(Xr=no&&vo(no))!==null&&Xr!==void 0?Xr:no,ko=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){var No,Do;if(!(!((No=io==null?void 0:io.sdk.embeddedWallets)===null||No===void 0)&&No.sessionKeyDuration)||!canRestoreEmbeddedWalletSession((Do=io==null?void 0:io.sdk.embeddedWallets)===null||Do===void 0?void 0:Do.sessionKeyDuration))return!1;const Fo=getEmbeddedWalletSessionExpiration(io.sdk.embeddedWallets.sessionKeyDuration);try{return yield restoreEmbeddedWalletSession({iframeContainer:co.current,iframeElementId:iframeElementId$1,sessionExpiration:Fo,user:ao,wallet:no})}catch(Xo){logger$8.error("Failed to restore embedded wallet",Xo)}return!1}),[ao,co,no,(to=(eo=io==null?void 0:io.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration]),Ao=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Eo||!isPasskeyWalletConnector(Eo.connector))return!1;const No=Eo.connector.getAuthenticatorHandler();return!(!lo||No.isSessionActive()||(yield ko()))}),[Eo,lo,ko]),Po=reactExports.useCallback((No,Do)=>__awaiter$j(void 0,void 0,void 0,function*(){var Fo;(()=>{if(!ao)throw new Error(USER_NOT_LOGGED_IN);if(!isTurnkeyEnabled(io))throw new Error("Dynamic embedded wallet is not enabled. Go to the dashboard and make sure to have both Dynamic embedded wallet and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.");if(!hasEmbeddedWallet(ao))throw new Error("Dynamic embedded wallet not found");if(Eo&&!isPasskeyWalletConnector(Eo.connector))throw new Error("Dynamic embedded wallet not found.")})();const Lo=(Eo==null?void 0:Eo.connector).getAuthenticatorHandler();if(No==="passkey"&&Lo.isSessionActive())return yield addNewPasskeyAuthenticator({environmentId:ro,user:ao,wallet:Eo}),oo(!1),Eo;const Bo=getEnabledEmbeddedWalletsAuthenticators((Fo=io==null?void 0:io.sdk.embeddedWallets)===null||Fo===void 0?void 0:Fo.supportedSecurityMethods),xo=Bo?Object.keys(Bo):[];if(!fo)wo("passkey-recovery-add-email",{shouldInitRecovery:!0}),oo(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else if(!No&&xo.length>1)wo("embedded-wallet-auth-choice",{currentAction:Do}),oo(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else{const[uo]=xo;No&&!xo.includes(No)&&(No=uo),yield ho({authenticatorType:No||uo,currentAction:Do,iframeContainer:co.current})}return new Promise((uo,po)=>{dynamicEvents.once("passkeyRecoveryCompleted",bo=>uo(bo)),dynamicEvents.once("passkeyRecoveryFailed",bo=>po(bo))})}),[Eo,io,fo,ro,ao,oo,wo,ho,co]),jo=No=>__awaiter$j(void 0,void 0,void 0,function*(){try{let Do=ao;ao!=null&&ao.email||(Do=yield Mo(No)),yield addEmailRecovery({environmentId:ro,user:Do,wallet:no}),dynamicEvents.emit("embeddedWalletRecoveryEmailCompleted","")}catch(Do){logger$8.error("Failed to add recovery email",Do),dynamicEvents.emit("embeddedWalletRecoveryEmailFailed",Do)}}),Mo=No=>__awaiter$j(void 0,void 0,void 0,function*(){try{const{nextView:Do,emailVerification:Fo,userProfile:Xo}=yield updateUserProfileFields(ro,{email:No});return Do===NextViewEnum.Done?Xo:(wo("verify-email",{isEmailRecoveryFlow:!0}),go(No),yo(Fo==null?void 0:Fo.verificationUUID),new Promise((Lo,Bo)=>{dynamicEvents.once("emailVerificationResult",xo=>{xo&&Lo(Xo),Bo("Failed to verify email")})}))}catch(Do){throw logger$8.error("Failed to update user email",Do),Do}});return{addRecoveryEmail:jo,initPasskeyRecoveryProcess:Po,shouldInitRecovery:Ao}},SecureEmbeddedWalletCard=({className:Xr})=>{const{t:eo}=useTranslation(),{primaryWallet:to}=useInternalDynamicContext(),{initPasskeyRecoveryProcess:ro}=usePasskeyRecovery(),{showSecureAccountBanner:no,setShowSecureAccountBanner:io}=usePasskeyContext(),{getEOAWallet:oo}=useSmartWallets(),ao=to&&oo(to),so=to&&isSessionKeyCompatibleWallet(to)||ao&&isSessionKeyCompatibleWallet(ao);return!no||so?null:jsxRuntimeExports.jsxs("div",{className:classNames("secure-embedded-wallet-card",Xr),children:[jsxRuntimeExports.jsxs("div",{className:"secure-embedded-wallet-card__text-content","data-testid":"secure-wallet-button",onClick:()=>ro(),children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",copykey:"dyn_secure_pregenerated_wallet.description",children:eo("dyn_secure_pregenerated_wallet.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"brand-primary",copykey:"dyn_secure_pregenerated_wallet.action",className:"secure-embedded-wallet-card__link",children:eo("dyn_secure_pregenerated_wallet.action")})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(IconButton,{color:"text-secondary",onClick:()=>io(!1),children:jsxRuntimeExports.jsx(SvgClose,{width:16,height:16})})})]})},ONRAMP_PROVIDERS=["banxa"],isOnrampProvider=Xr=>ONRAMP_PROVIDERS.includes(Xr.provider),getWalletAdditionalAddressByType=(Xr,eo)=>{var to,ro;return(ro=(to=eo==null?void 0:eo.additionalAddresses)===null||to===void 0?void 0:to.find(no=>no.type===Xr))===null||ro===void 0?void 0:ro.address},getOnrampProviders=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({chain:eo,environmentId:to,networkId:ro,token:no,walletAddress:io}){const{onramps:oo}=yield sdkApi$1().getSupportedOnramps({chain:eo,environmentId:to,networkId:ro?String(ro):void 0,token:no,walletAddress:io});if(!oo||oo.length===0)throw new Error("No onramps");return oo}),FundingContext=reactExports.createContext(void 0),FundingContextProvider=({children:Xr})=>{var eo,to;const ro=reactExports.useRef(null),[no,io]=reactExports.useState(!1),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(""),{environmentId:lo,network:fo,primaryWallet:ho,projectSettings:go}=useInternalDynamicContext(),yo=(to=(eo=go==null?void 0:go.providers)===null||eo===void 0?void 0:eo.some(Eo=>isOnrampProvider(Eo)&&!!Eo.enabledAt))!==null&&to!==void 0?to:!1,vo=reactExports.useCallback((...Eo)=>__awaiter$j(void 0,[...Eo],void 0,function*({address:ko,token:Ao}={}){var Po;if(!yo||!ho)return;const jo=(Po=getChainInfo(ho.chain))===null||Po===void 0?void 0:Po.name;if(!jo)return;const Mo=isBitcoinConnector(ho.connector)&&getWalletAdditionalAddressByType(WalletAddressType.Payment,ho),No=fo&&jo==="evm";try{const[{url:Do}]=yield getOnrampProviders({chain:jo,environmentId:lo,networkId:No?fo.toString():void 0,token:Ao,walletAddress:ko||Mo||ho.address});if(!Do)throw new Error("No onramp url found");co(Do),ao(!0)}catch{ao(!1)}}),[lo,yo,fo,ho]),wo=reactExports.useMemo(()=>({fundingEnabled:yo,fundingRef:ro,fundingUrl:so,setShowFunding:io,showFunding:no,supportsFunding:oo,updateSupportsFunding:vo}),[yo,so,no,oo,vo]);return reactExports.useEffect(()=>{vo()},[lo,yo,fo,ho==null?void 0:ho.address]),jsxRuntimeExports.jsx(FundingContext.Provider,{value:wo,children:Xr})},useFundingContext=()=>{const Xr=reactExports.useContext(FundingContext);if(Xr===void 0)throw new Error("usage of useFundingContext not wrapped in `FundingContextProvider`.");return Xr},useConfirmationModal=({elementId:Xr})=>{const{createRootElement:eo}=useElementById(),to=eo(Xr),[ro,no]=reactExports.useState(null),io=reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){return new Promise((so,co)=>{try{no(oo(so,co))}catch(lo){co(lo)}}).finally(()=>{no(void 0)})}),[no]);return{modal:ro?jsxRuntimeExports.jsx("div",{children:reactDomExports.createPortal(ro,to.current)}):void 0,open:io}},usePreventPageScroll=Xr=>{const eo=()=>{var ro;const no=document.querySelector("html"),io=document.querySelector("body");if(!no||!io)return;const oo=(ro=window==null?void 0:window.screen)===null||ro===void 0?void 0:ro.height;!(io.scrollHeight>oo)||oo===0||(no.classList.add("dynamic-no-scroll"),io.classList.add("dynamic-no-scroll"))},to=ro=>{const no=document.querySelector("html"),io=document.querySelector("body");!no||!io||(no.classList.remove("dynamic-no-scroll"),io.classList.remove("dynamic-no-scroll"),isIOS$1()&&window.scrollTo(ro.x,ro.y))};reactExports.useEffect(()=>{if(!Xr)return;const ro={x:window.scrollX,y:window.scrollY};return eo(),()=>{to(ro)}},[Xr])},useResizeObserver=(Xr,eo)=>{const[to,ro]=reactExports.useState(),no=reactExports.useCallback(io=>{if(!Array.isArray(io))return;const[oo]=io;ro(oo.contentRect)},[eo,ro]);return reactExports.useLayoutEffect(()=>{if(!Xr.current)return;let io=new ResizeObserver(no);return io.observe(Xr.current),()=>{io==null||io.disconnect(),io=null}},[Xr]),[to]},VerticalDrawerTransition=Xr=>{var{style:eo,children:to,className:ro}=Xr,no=__rest$7(Xr,["style","children","className"]);const io=reactExports.useRef(null),oo=reactExports.useRef(null),[ao]=useResizeObserver(oo),so=reactExports.useMemo(()=>ao==null?void 0:ao.height,[ao]),{mount:co,stage:lo,currentDuration:fo}=useTransition(Object.assign({animateOnMount:!1},no)),ho=reactExports.useMemo(()=>!co||lo==="EXITING"||lo==="UNMOUNT"?0:so,[lo,so,co]);return jsxRuntimeExports.jsx("div",{ref:io,className:classNames(ro,"vertical-drawer-animation"),style:Object.assign(Object.assign({},eo),{maxHeight:ho,transitionDuration:`${fo}ms`}),children:jsxRuntimeExports.jsx("div",{ref:oo,children:co&&to})})},Modal$1=({children:Xr,className:eo,isShown:to=!0,transitionProps:ro})=>jsxRuntimeExports.jsx("div",{className:classNames("modal",eo),children:jsxRuntimeExports.jsx(SlideInUpTransition,Object.assign({},ro,{isShown:to,children:jsxRuntimeExports.jsx("div",{className:"modal__items",children:Xr})}))}),ModalCard=({children:Xr,borderRadius:eo="default",border:to=!1,sharpBottomRadiusOnMobile:ro=!0,dataTestId:no="modal-card"})=>jsxRuntimeExports.jsx("div",{"data-testid":no,className:classNames("modal-card",{"modal-card--sharp-mobile-bottom-radius":ro,"modal-card--with-border":to},`modal-card--radius-${eo}`),children:Xr}),useKeyboardEventListener=({disabled:Xr,inputKey:eo,onKeyPressed:to})=>{reactExports.useEffect(()=>{const ro=no=>{Xr||no.key!==eo||to(no)};return document.addEventListener("keydown",ro),()=>{document.removeEventListener("keydown",ro)}},[Xr,eo,to])},ModalComponent=({children:Xr,handleClose:eo,withBackdrop:to=!0,zIndex:ro,whiteList:no})=>{const{view:io}=useViewContext(),oo=(io==null?void 0:io.type)&&io.type!=="collect-user-data"&&io.type!=="login-with-email-verification"&&io.type!=="login-with-sms-verification"&&io.type!=="verify-sms"&&io.type!=="verify-email"&&io.type!=="mfa-verification"&&io.type!=="mfa-display-backup-codes",ao=so=>{oo&&(so.stopPropagation(),eo(so))};return useKeyboardEventListener({disabled:!oo,inputKey:"Escape",onKeyPressed:eo}),jsxRuntimeExports.jsxs(FocusLockCombination,{className:"portal__container",whiteList:no,children:[to&&jsxRuntimeExports.jsx("div",{"data-testid":"portal-backdrop",role:"button",onClick:so=>{ao(so)},tabIndex:0,"aria-label":"Close modal",style:{zIndex:ro?ro-2:void 0},className:"portal__backdrop"}),jsxRuntimeExports.jsx("div",{style:{zIndex:ro},children:Xr})]})},Portal=({children:Xr,isShown:eo,handleClose:to,withBackdrop:ro,zIndex:no,transitionEvents:io,elementId:oo="dynamic-modal"})=>{const{createRootElement:ao}=useElementById(),so=ao(oo);return reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:no,dataTestId:"dynamic-modal-shadow",children:jsxRuntimeExports.jsx(OpacityTransition,Object.assign({isShown:eo},io,{children:jsxRuntimeExports.jsx(ModalComponent,{handleClose:to,withBackdrop:ro,whiteList:co=>so.current.contains(co),children:Xr})}))}),so.current)},ChainIcon=({chain:Xr,chainName:eo})=>{const to=getChainIcon(eo);return jsxRuntimeExports.jsx(Icon,{size:"small",children:Xr!=null&&Xr.icon?jsxRuntimeExports.jsx("img",{src:Xr.icon,alt:`${Xr.name} icon`}):jsxRuntimeExports.jsx(to,{})})};var _path$Y,_excluded$16=["title","titleId"];function _extends$18(){return _extends$18=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$16(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowLeft=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$16(eo,_excluded$16);return reactExports.createElement("svg",_extends$18({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Y||(_path$Y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.707 4.293a1 1 0 0 1 0 1.414L5.414 11H21a1 1 0 1 1 0 2H5.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",fill:"currentColor"})))};const getNetworkInfoEntry=(Xr,eo)=>{if(!Xr||!Xr.symbol)return;const to=Xr.symbol==="ETH"||Xr.symbol==="EVM"?"evm":Xr.symbol.toLowerCase(),ro=eo[to]||eo[ChainEnumToVerifiedCredentialName[to.toUpperCase()]];if(ro)return to==="evm"?ro.find(no=>no.chainId===(Xr==null?void 0:Xr.chainId)):ro[0]},getEvmChainName=Xr=>({1:"Ethereum",10:"OP Mainnet",11155111:"Sepolia",137:"Polygon",42161:"Arbitrum One",43114:"Avalanche",8453:"Base"})[Xr]||"Unknown",ModalHeader=({alignContent:Xr,children:eo,leading:to,displayLeading:ro=!0,trailing:no,displayTrailing:io=!0,style:oo,displayBorder:ao})=>{const so=ro&&to&&reactExports.Children.count(to),co=io&&no&&reactExports.Children.count(no);return jsxRuntimeExports.jsxs("div",{className:classNames("modal-header",{"modal-header--align-content-bottom":Xr==="bottom","modal-header--border":ao,"modal-header--empty":!so&&!eo&&!co}),style:oo,children:[ro&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header__leading",{"modal-header__leading--empty":!so}),children:to}),eo,io&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header__trailing",{"modal-header__trailing--empty":!co}),children:no})]})};var _g$b,_defs$b,_excluded$15=["title","titleId"];function _extends$17(){return _extends$17=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$15(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDynamicLogo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$15(eo,_excluded$15);return reactExports.createElement("svg",_extends$17({fill:"none",viewBox:"0 0 114 21",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$b||(_g$b=reactExports.createElement("g",{clipPath:"url(#dynamic-logo_svg__a)",fill:"currentColor"},reactExports.createElement("path",{d:"M10.053 2.002c-.43.4-.85.793-1.273 1.184-1.959 1.818-3.918 3.638-5.879 5.453-.45.417-.915.817-1.48 1.061C.75 9.99.365 9.81.15 9.085-.153 8.072.009 7.128.59 6.258 1.087 5.517 1.71 4.9 2.354 4.3A178.857 178.857 0 0 1 5.45 1.47c.457-.408.957-.78 1.567-.905 1.828-.368 2.994 1.384 3.038 1.436l-.002.001zM1.259 11.254c1.112-.32 1.946-1.026 2.758-1.768 2.59-2.363 5.176-4.728 7.777-7.078A16.823 16.823 0 0 1 13.609.96C14.42.408 15.303.33 16.173.855c.314.189.623.409.878.672a106.565 106.565 0 0 1 5.28 5.866c.298.358.542.774.744 1.196.375.785.279 1.561-.178 2.293-.409.655-.956 1.192-1.52 1.702a699.92 699.92 0 0 1-6.653 5.96c-.6.53-1.26 1.004-1.94 1.422-1.282.791-2.568.693-3.737-.244A16.245 16.245 0 0 1 7.14 17.92c-1.883-2.087-3.73-4.203-5.592-6.31-.094-.106-.18-.22-.29-.358v.002zM39.574.915h2.808V16.14h-2.808v-1.284c-.827 1.06-2.003 1.587-3.526 1.587-1.522 0-2.717-.555-3.755-1.664s-1.556-2.469-1.556-4.078c0-1.609.518-2.968 1.556-4.077s2.288-1.665 3.755-1.665 2.7.53 3.526 1.587V.913v.002zm-5.17 11.996c.573.572 1.294.859 2.166.859s1.589-.287 2.155-.86c.566-.572.849-1.309.849-2.207 0-.898-.283-1.635-.85-2.207-.565-.572-1.283-.859-2.154-.859s-1.593.287-2.166.86c-.574.571-.86 1.308-.86 2.206 0 .898.286 1.635.86 2.208zM51.766 5.264h3.004l-3.968 10.894c-.566 1.554-1.315 2.682-2.251 3.385-.934.704-2.098 1.02-3.489.947v-2.61c.755.015 1.352-.144 1.796-.477.442-.334.796-.87 1.057-1.61L43.453 5.268h3.069l2.837 7.308 2.409-7.308-.002-.002zM61.908 4.959c1.19 0 2.174.398 2.949 1.196.777.798 1.163 1.9 1.163 3.305v6.678h-2.808v-6.33c0-.723-.196-1.279-.588-1.664-.392-.383-.914-.576-1.567-.576-.725 0-1.306.224-1.74.674s-.654 1.124-.654 2.022v5.872h-2.808V5.261h2.808v1.218c.683-1.014 1.763-1.522 3.243-1.522l.002.002zM76.243 5.264h2.808V16.14h-2.808v-1.283c-.842 1.06-2.024 1.587-3.548 1.587s-2.695-.555-3.733-1.665-1.556-2.468-1.556-4.077c0-1.61.518-2.968 1.556-4.078C70 5.514 71.242 4.96 72.695 4.96c1.524 0 2.706.53 3.548 1.587V5.262v.002zm-5.182 7.646c.566.572 1.284.86 2.156.86s1.592-.288 2.166-.86c.573-.572.86-1.309.86-2.207 0-.898-.287-1.635-.86-2.207-.574-.572-1.295-.86-2.166-.86s-1.59.288-2.156.86c-.566.572-.849 1.309-.849 2.207 0 .898.283 1.635.85 2.207zM92.864 4.959c1.249 0 2.246.406 2.993 1.218.748.813 1.121 1.9 1.121 3.263v6.7H94.17V9.637c0-.652-.16-1.16-.48-1.523s-.769-.544-1.35-.544c-.638 0-1.135.211-1.49.631-.356.42-.533 1.03-.533 1.828v6.113h-2.808V9.638c0-.651-.16-1.159-.48-1.522-.32-.363-.77-.544-1.35-.544-.623 0-1.121.21-1.491.631-.37.42-.555 1.03-.555 1.828v6.113h-2.808V5.269h2.808v1.153c.653-.972 1.661-1.457 3.027-1.457 1.365 0 2.321.522 2.96 1.566.724-1.044 1.807-1.566 3.242-1.566l.002-.006zM100.15 3.959c-.464 0-.868-.17-1.208-.511a1.653 1.653 0 0 1-.512-1.207c0-.465.17-.87.512-1.219.34-.348.744-.522 1.208-.522.464 0 .888.174 1.23.522.341.348.511.754.511 1.219 0 .464-.17.866-.511 1.207-.34.34-.751.511-1.23.511zM98.757 16.14V5.265h2.808V16.14h-2.808zM108.69 16.443c-1.641 0-3.008-.55-4.103-1.654-1.095-1.101-1.643-2.464-1.643-4.088s.548-2.987 1.643-4.089 2.464-1.653 4.103-1.653c1.06 0 2.024.253 2.895.76.871.508 1.532 1.19 1.981 2.045l-2.416 1.413a2.464 2.464 0 0 0-.989-1.067 2.878 2.878 0 0 0-1.491-.39c-.842 0-1.539.28-2.091.837-.551.559-.827 1.272-.827 2.142 0 .87.276 1.563.827 2.12.552.56 1.249.837 2.091.837.566 0 1.069-.126 1.513-.381.442-.254.773-.606.99-1.056l2.438 1.393a5.463 5.463 0 0 1-2.024 2.055c-.871.515-1.835.772-2.895.772l-.002.004z"}))),_defs$b||(_defs$b=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"dynamic-logo_svg__a"},reactExports.createElement("path",{transform:"translate(0 .5)",fill:"#fff",d:"M0 0h113.61v20H0z"})))))};const DynamicWidgetFooter=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"dynamic-widget-footer","data-testid":"dynamic-widget-footer",children:Xr}),URL$3="https://dynamic.xyz",alignClassNames={center:"powered-by-dynamic--center",right:"powered-by-dynamic--right"},PoweredByDynamic=({align:Xr="center",classNameLogo:eo,classNameRoot:to,classNameText:ro,asFooter:no})=>{var io;const{projectSettings:oo}=useInternalDynamicContext();if(((io=oo==null?void 0:oo.sdk)===null||io===void 0?void 0:io.displayDynamicMessaging)===!1)return null;const ao=jsxRuntimeExports.jsxs("a",{target:"_blank",href:URL$3,className:classNames("powered-by-dynamic",alignClassNames[Xr],to),rel:"noreferrer",children:[jsxRuntimeExports.jsx(Typography,{as:"span",color:"tertiary",weight:"regular",variant:"body_mini",className:classNames("powered-by-dynamic__text",ro),children:"Powered by"}),jsxRuntimeExports.jsx(SvgDynamicLogo,{className:classNames("powered-by-dynamic__logo",eo)})]});return no?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:ao}):ao},useFetchChain=Xr=>{const eo=()=>__awaiter$j(void 0,void 0,void 0,function*(){var no,io;if(!Xr)return{chainId:void 0,name:"",symbol:void 0};const oo=yield Xr.getNetwork(),{connectedChain:ao}=Xr,so=getChainInfoWithOverrides(ao||""),co={chainId:oo,name:so==null?void 0:so.displayName,symbol:so==null?void 0:so.symbol};if(oo&&Xr.evmNetworks){const lo=Xr.evmNetworks.find(fo=>fo.chainId===oo);co.name=(io=(no=lo==null?void 0:lo.vanityName)!==null&&no!==void 0?no:lo==null?void 0:lo.name)!==null&&io!==void 0?io:co.name,co.icon=lo==null?void 0:lo.iconUrls[0]}return co}),{data:to,isLoading:ro}=usePromise(eo,{deps:[Xr]});return{chain:to,isLoading:ro}},getOrdinalNumber=Xr=>Xr<1?"":Xr%10===1&&Xr%100!==11?`${Xr}st`:Xr%10===2&&Xr%100!==12?`${Xr}nd`:Xr%10===3&&Xr%100!==13?`${Xr}rd`:`${Xr}th`,FormFieldLabel=({children:Xr,htmlFor:eo,className:to,divider:ro})=>jsxRuntimeExports.jsx("label",{className:classNames("form-field-label",{"form-field-label__with-divider":ro},to),htmlFor:eo,children:Xr}),roundToNthDecimal=(Xr,eo)=>{if(!Xr)return;const to=Math.pow(10,eo),ro=Math.round(Xr*to)/to,no="0".repeat(eo-1);return ro===0?`<0.${no}1`:ro};var _path$X,_excluded$14=["title","titleId"];function _extends$16(){return _extends$16=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$14(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgStroke=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$14(eo,_excluded$14);return reactExports.createElement("svg",_extends$16({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$X||(_path$X=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.293 19.707a1 1 0 0 1 0-1.414L14.586 12 8.293 5.707a1 1 0 0 1 1.414-1.414l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0Z",fill:"currentColor"})))};const Skeleton=({count:Xr=1,className:eo,style:to})=>{const ro=[];for(let no=0;nojsxRuntimeExports.jsx("span",{"data-testid":"loading-skeleton",children:no},`skeleton-${io}`))})},erc20Abi$1=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],OverlayCard=({isOpen:Xr,children:eo,onClickOverlay:to,style:ro,className:no})=>{const io=useOverlayCardTarget(Xr);usePreventPageScroll(Xr&&!io);const oo=reactExports.useRef(null);useOnClickOutside(oo,()=>to==null?void 0:to());const ao=jsxRuntimeExports.jsxs("div",{className:classNames("overlay-card",{"overlay-card--disabled":!Xr}),style:{position:io===void 0?"fixed":"absolute"},children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:Xr&&jsxRuntimeExports.jsx("div",{onClick:to,className:"overlay-card__overlay"})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(SlideInUpTransition,{className:"overlay-card__animation overlay-card__animation--limit-height"}),children:Xr&&jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:Xr&&jsxRuntimeExports.jsx("div",{ref:oo,className:classNames(no,"overlay-card__content"),style:ro,children:eo})})})]});return io?reactDomExports.createPortal(ao,io):reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{children:ao}),document.body)},MenuList=({isOpen:Xr,onClickClose:eo,popperProps:to,dropdownClassName:ro,dropdownStyle:no,overlayCardClassName:io,overlayCardStyle:oo,className:ao,style:so,children:co,mobileTitle:lo})=>{const fo=jsxRuntimeExports.jsx(IconButton,{onClick:eo,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return isMobile$1()?jsxRuntimeExports.jsxs(OverlayCard,{isOpen:Xr,onClickOverlay:eo,className:classNames(io,ao),style:Object.assign(Object.assign({},so),oo),children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:fo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",children:lo})}),jsxRuntimeExports.jsx("div",{className:"menu-list__overlay-card__container",children:co})]}):jsxRuntimeExports.jsx(Dropdown,Object.assign({isOpen:Xr,onClickOutside:eo,onScroll:eo,className:classNames(ro,ao),style:Object.assign(Object.assign({},so),no)},to,{children:co}))},TokensBalanceDropdown=({tokenBalances:Xr,currentToken:eo,setCurrentToken:to,isLoading:ro,setFieldValue:no,setErrors:io})=>{const{t:oo}=useTranslation(),[ao,so]=reactExports.useState(!1),co=(Xr==null?void 0:Xr.filter(vo=>vo.name))||[],{primaryWallet:lo}=useInternalDynamicContext(),fo=reactExports.useRef(null),ho=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!lo||!("getPublicClient"in lo)||typeof lo.getPublicClient!="function")return;const wo=yield lo.getPublicClient();if(!wo)return;const Eo={abi:erc20Abi$1,address:vo.address},ko=yield wo.multicall({contracts:[Object.assign(Object.assign({},Eo),{args:[lo==null?void 0:lo.address],functionName:"balanceOf"}),Object.assign(Object.assign({},Eo),{functionName:"decimals"})]}),[Ao,Po]=ko.map(jo=>Number(jo.result));if(Ao&&Po){if(vo.balance=Ao/Math.pow(10,Po),vo.rawBalance=Ao,Xr){const jo=Xr.findIndex(Mo=>Mo.name===vo.name);Xr[jo]=vo}vo.decimals=Po}}),go=vo=>__awaiter$j(void 0,void 0,void 0,function*(){var wo,Eo;const ko=(wo=Xr==null?void 0:Xr.find(Ao=>Ao.name===vo))!==null&&wo!==void 0?wo:void 0;ko!=null&&ko.address&&(ko!=null&&ko.address.startsWith("0x"))&&ho(ko),ko&&(Xr&&(!((Eo=Xr[0])===null||Eo===void 0)&&Eo.price)&&setSendBalanceVariable("nativePrice",Xr[0].price),to(ko),no("amount",""),setSendBalanceVariable("amount",0),io({})),so(!ao)});if(ro)return jsxRuntimeExports.jsx(Skeleton,{});const yo=(vo,wo)=>vo!=null&&vo.logoURI?jsxRuntimeExports.jsx("img",{src:vo.logoURI,alt:vo==null?void 0:vo.name,width:wo,height:wo}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"});return jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown",ref:fo,onClick:()=>so(!ao),"data-testid":"tokens-balance-dropdown",children:[!ro&&jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__selected",children:[yo(eo,"20"),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:eo==null?void 0:eo.name}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":ao}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]}),jsxRuntimeExports.jsx(MenuList,{className:"tokens-balance-dropdown__menu_list",isOpen:ao,popperProps:{anchorOrigin:"bottom-left",anchorRef:fo},mobileTitle:"Select token",children:co.length>0?co.map(vo=>jsxRuntimeExports.jsxs("button",{className:"tokens-balance-dropdown__menu_list_item",onClick:()=>go(vo.name),children:[jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__name",children:[yo(vo,"16"),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:vo.name})]}),jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:vo.symbol}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:roundToNthDecimal(vo.balance,6)})]})]},vo.address)):jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:oo("dyn_wallet_information.multi_asset.empty_state")})})})]})},useEffectOnce=Xr=>{reactExports.useEffect(Xr,[])},useCurrencySymbol=(Xr,eo)=>(Xr==null?void 0:Xr.symbol)||eo,getValueRounded=(Xr,eo)=>{let to;return Xr?to=eo.value?eo.format(eo.value):"0":to=eo!=null&&eo.nonNativeValue&&(eo!=null&&eo.formatNonNativeToken)?eo.formatNonNativeToken(eo.nonNativeValue,eo.nonNativeDecimal||18):"0",roundToNthDecimal(Number(to),6)},calculateFiatPrice=(Xr,eo,to)=>{if(Xr===void 0||isNaN(Xr)||!to||!eo)return 0;const ro=BigInt(Math.pow(10,to)),no=Number(eo.toFixed(to));try{const io=BigInt(Xr*Number(ro)),oo=BigInt(no*Number(ro)),ao=io*oo;return Number(ao/ro)/Number(ro)}catch{return}},getDisplayFiatPrice=(Xr,eo)=>{if(!(eo!=null&&eo.price))return"--";const to=calculateFiatPrice(Xr,eo.price,eo.decimals);return to===void 0?"--":to===0||to>=.01?to.toFixed(2):"<0.01"},useHandleRecovery=(Xr,eo,to,ro,no,io)=>{const oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){(yield ro())&&Xr&&!eo(Xr)&&(yield no("email","sendTransaction")),to==null||to("callHandlerOutsideModal")});useEffectOnce(()=>{io&&oo()})},useHandleSubmitWithChecks=(Xr,eo,to)=>ro=>__awaiter$j(void 0,void 0,void 0,function*(){const{walletConnector:no,usingSessionKey:io,onClickSend:oo,isTurnkeyWallet:ao,userNeedsCrossDomainPasskey:so}=Xr,{shouldInitRecovery:co,initPasskeyRecoveryProcess:lo}=eo,{setView:fo,setShowAuthFlow:ho}=to;if(no&&io(no)){oo(ro);return}if((yield co())&&(yield lo("email","sendTransaction")),ao&&so){fo("passkey-new-domain-detected"),ho(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{oo(ro)});return}oo(ro)}),sendBalanceFormInitialValues={amount:"",recipient:""},getDisplayErrorMessage$1=(Xr,eo,to,ro)=>{const no={amount:{invalidDecimals:eo("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:ro}),invalidFormat:eo("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:ro}),overBalance:eo("dyn_send_transaction.validation.amount.over_balance"),required:eo("dyn_send_transaction.validation.amount.required")},recipient:{invalidFormat:eo("dyn_send_transaction.validation.recipient.invalid_format"),required:eo("dyn_send_transaction.validation.recipient.required")}},io=Xr[to];return io?no[to][io].replace("{decimals}",getOrdinalNumber(ro??0)):""},SendBalanceForm=({initialValues:Xr,onSubmit:eo,decimals:to=18,validateAddress:ro=()=>!0,validateAmount:no=()=>!0,currentToken:io,transaction:oo,tokenBalances:ao,setCurrentToken:so,isLoading:co})=>{const{t:lo}=useTranslation(),{showFiat:fo}=useInternalDynamicContext(),ho=reactExports.useRef(null),[go,yo]=reactExports.useState(0),{amount:vo}=useSendBalanceState();reactExports.useEffect(()=>{if(ho.current){const Eo=ho.current.offsetWidth;yo(Eo+15)}},[io]);const wo=reactExports.useMemo(()=>{const Eo=new RegExp(`^\\d*(\\.\\d{1,${to}})?$`);return create$4().shape({amount:create$5().required("required").matches(/^\d*(\.\d+)?$/,"invalidFormat").matches(Eo,"invalidDecimals").test({message:"overBalance",test:ko=>no(ko)}),recipient:create$5().required("required").test({message:"invalidFormat",test:ko=>ro(ko)})})},[to,ro,no]);return jsxRuntimeExports.jsx(Formik,{initialValues:Xr||sendBalanceFormInitialValues,validationSchema:wo,onSubmit:Eo=>eo(Eo),validateOnChange:!1,validateOnBlur:!1,children:({errors:Eo,touched:ko,values:Ao,handleChange:Po,setFieldValue:jo,setErrors:Mo,handleBlur:No,setFieldTouched:Do,validateField:Fo})=>{var Xo;return jsxRuntimeExports.jsxs(Form,{className:"send-balance-form",children:[jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__balance-container",children:[jsxRuntimeExports.jsx(FormFieldLabel,{children:"Select any token"}),jsxRuntimeExports.jsx(TokensBalanceDropdown,{tokenBalances:ao??(io&&[io]),currentToken:io,setCurrentToken:so,isLoading:co,setFieldValue:jo,setErrors:Mo})]}),jsxRuntimeExports.jsxs("div",{className:"send-balance-form__amount-container",children:[jsxRuntimeExports.jsx(Field$1,{variant:"regular",className:`send-balance-form__amount-container__field ${fo?"fiat":""}`,name:"amount",id:"amount",onChange:Lo=>{const Bo=Lo.target.value;if(!(Bo!==""&&!/^(?:\d+|\d*\.\d*|)$/.test(Bo))){if(Mo({}),Po(Lo),!Bo||Number.isNaN(Bo)){setSendBalanceVariable("amount",0);return}setSendBalanceVariable("amount",io!=null&&io.price?Number(Bo):void 0)}},onBlur:Lo=>{No(Lo),Do("amount",!0),Fo("amount")},placeholder:lo("dyn_send_transaction.data.amount.placeholder"),as:Input,error:Eo.amount,copykey:"dyn_send_transaction.data.amount.label",message:ko.amount&&getDisplayErrorMessage$1(Eo,lo,"amount",to),style:{paddingLeft:`${go}px`}}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__floating_value",ref:ho,children:jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"regular",color:"secondary",children:io==null?void 0:io.symbol})}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__balance",children:fo&&!Number.isNaN(vo)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"bold",color:"secondary",children:"$"}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"regular",color:"secondary",children:getDisplayFiatPrice(vo,io)})]})})]}),jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available",variant:"body_small",weight:"regular",color:"secondary",as:"div",children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"0.225rem"},children:[jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available__line",variant:"body_small",weight:"bold",color:"primary",as:"div",children:(Xo=roundToNthDecimal(io==null?void 0:io.balance,6))!==null&&Xo!==void 0?Xo:0}),`${io==null?void 0:io.symbol} Available`]})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:"Recipient Address"}),jsxRuntimeExports.jsx(Field$1,{className:"send-balance-form__field",placeholder:lo("dyn_send_transaction.data.recipient.placeholder"),label:lo("dyn_send_transaction.data.recipient.label"),id:"recipient",name:"recipient",as:Input,error:Eo.recipient,copykey:"dyn_send_transaction.data.recipient.label",message:ko.recipient&&getDisplayErrorMessage$1(Eo,lo,"recipient")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"sendBalanceFormSubmitButton",expanded:!0,type:"submit",buttonVariant:"primary",buttonPadding:"small",buttonClassName:"send-balance-form__button",copykey:"dyn_send_transaction.preview_transaction",children:lo("dyn_send_transaction.preview_transaction")})]})}})},useNetworkConfigurationsFromProjectSettings=({projectSettings:Xr,cosmosNetworkOverrides:eo,evmNetworksOverrides:to})=>reactExports.useMemo(()=>{var ro,no,io,oo;const ao=Xr==null?void 0:Xr.networks;if(!ao)return{};const so=ao.find(Eo=>Eo.chainName==="evm"),co=ao.find(Eo=>Eo.chainName==="solana"),lo=ao.find(Eo=>Eo.chainName==="cosmos"),fo=ao.find(Eo=>Eo.chainName==="starknet");let ho=(ro=lo==null?void 0:lo.networks)===null||ro===void 0?void 0:ro.map(Eo=>createNetwork(Eo,parseInt));ho=overrideNetworks(eo,ho);let go=(no=so==null?void 0:so.networks)===null||no===void 0?void 0:no.map(Eo=>createNetwork(Eo,parseInt));go=overrideNetworks(to,go);const yo=(io=fo==null?void 0:fo.networks)===null||io===void 0?void 0:io.map(Eo=>createNetwork(Eo)),vo=(oo=co==null?void 0:co.networks)===null||oo===void 0?void 0:oo.map(Eo=>createNetwork(Eo));return to&&(Array.isArray(to)?go=to:go=to(go??[])),{cosmos:ho,evm:go,solana:vo,starknet:yo}},[Xr==null?void 0:Xr.networks,eo,to]),createNetwork=(Xr,eo=to=>to)=>({blockExplorerUrls:Xr.blockExplorerUrls,chainId:eo(Xr.chainId),iconUrls:Xr.iconUrls,lcdUrl:Xr.lcdUrl,name:Xr.name,nativeCurrency:Xr.nativeCurrency,networkId:eo(Xr.networkId),privateCustomerRpcUrls:Xr.privateCustomerRpcUrls,rpcUrls:Xr.rpcUrls,vanityName:Xr.vanityName}),overrideNetworks=(Xr,eo)=>Xr?Array.isArray(Xr)?Xr:Xr(eo??[]):eo,zeroAddress$1="0x0000000000000000000000000000000000000000",nativeSolanaAddress$1="11111111111111111111111111111111",SendBalancePageLayout=({error:Xr,onClickClose:eo,onClickBack:to,onSubmit:ro,displayPoweredByDynamicFooter:no=!1,transaction:io,networkCurrencyDecimals:oo,tokenBalances:ao,currentToken:so,setCurrentToken:co,isLoading:lo,isNativeToken:fo})=>{var ho;const{t:go}=useTranslation(),{primaryWallet:yo,projectSettings:vo,overrides:wo}=useInternalDynamicContext(),Eo=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:wo==null?void 0:wo.evmNetworks,projectSettings:vo}),ko=yo==null?void 0:yo.connector,{chain:Ao}=useFetchChain(ko),Po=eo&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:eo,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),jo=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),{data:Mo}=usePromise(()=>io.getBalance(),{deps:[io]});reactExports.useEffect(()=>{const Do=()=>__awaiter$j(void 0,void 0,void 0,function*(){const Xo=getNetworkInfoEntry(Ao,Eo);if(!Xo){logger$8.error("Token info not found. Please make sure you are on a supported chain and it is enabled. See https://docs.dynamic.xyz/chains/enabling-chains");return}const Lo={address:(Ao==null?void 0:Ao.name)==="Solana"?nativeSolanaAddress$1:zeroAddress$1,balance:0,decimals:Xo.nativeCurrency.decimals,logoURI:Xo.nativeCurrency.iconUrl||Xo.iconUrls[0],name:Xo.name,rawBalance:0,symbol:Xo.nativeCurrency.symbol},Bo=yield yo==null?void 0:yo.getBalance();Bo&&(Lo.balance=Number(Bo),Lo.rawBalance=Number(Bo)/Math.pow(10,Lo.decimals)),co(Lo)});__awaiter$j(void 0,void 0,void 0,function*(){lo||(ao===void 0||Array.isArray(ao)&&ao.length===0?yield Do():so||co(ao[0]))})},[ao,Ao]);const No=()=>fo?io.value?io.format(io.value):"":io!=null&&io.formatNonNativeToken&&(io!=null&&io.nonNativeValue)&&(io!=null&&io.nonNativeDecimal)?io.formatNonNativeToken(io.nonNativeValue,io.nonNativeDecimal):"";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:jo,trailing:Po,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.send",children:go("dyn_send_transaction.data.send")})})}),jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__body",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:Xr&&jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__error",children:jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",children:Xr})})}),jsxRuntimeExports.jsx(SendBalanceForm,{tokenBalances:ao,setCurrentToken:co,isLoading:lo,onSubmit:({amount:Do,recipient:Fo})=>{fo?io.value=io.parse(Do):io.parseNonNativeToken&&(io.nonNativeValue=io.parseNonNativeToken(Do,(so==null?void 0:so.decimals)||18),io.value=BigInt(0),io.nonNativeAddress=so==null?void 0:so.address,io.nonNativeDecimal=so==null?void 0:so.decimals),io.to=Fo,ro()},initialValues:{amount:No(),recipient:(ho=io.to)!==null&&ho!==void 0?ho:""},decimals:fo?oo:so==null?void 0:so.decimals,validateAddress:Do=>Do?io.validateAddressFormat(Do):!0,validateAmount:Do=>Do?fo?Mo?io.parse(Do)<=Mo:!1:!(so!=null&&so.rawBalance)||!io.parseNonNativeToken?!1:Number(io.parseNonNativeToken(Do,(so==null?void 0:so.decimals)||18))<=so.rawBalance:!1,currentToken:so,transaction:io}),no&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"send-balance-page-layout__footer"})]})]})};var _path$W,_excluded$13=["title","titleId"];function _extends$15(){return _extends$15=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$13(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckBlue=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$13(eo,_excluded$13);return reactExports.createElement("svg",_extends$15({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$W||(_path$W=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const shortenWalletAddress=(Xr,eo=6,to=4)=>Xr?Xr.replace(Xr.substring(eo,Number(Xr.length)-to),"..."):"",getGasFiatValue=(Xr,eo,to)=>{if(!(Xr!=null&&Xr.price)||!eo.fee.gas)return;let ro=Xr.price;return to&&(ro=to),(Number(eo.format(eo.fee.gas))*ro).toFixed(2)},getTotalFiatCost=(Xr,eo,to,ro)=>{const no=getGasFiatValue(Xr,eo,to);return!no||!(Xr!=null&&Xr.price)?void 0:(Number(no)+Number(ro)*Xr.price).toFixed(2)},TransactionStatusLayout=({destinationAddress:Xr,transactionValue:eo,networkCurrency:to,onDone:ro,displayPoweredByDynamicFooter:no=!0,onClickClose:io,transaction:oo,currentToken:ao,isNativeToken:so})=>{const{t:co}=useTranslation(),{showFiat:lo}=useInternalDynamicContext(),{nativePrice:fo}=useSendBalanceState(),ho=io&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:io,"data-testid":"close",children:jsxRuntimeExports.jsx(SvgClose,{})}),go=getTotalFiatCost(ao,oo,fo,eo);return jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ho,alignContent:"bottom",children:jsxRuntimeExports.jsx(Icon,{size:"large",className:"transaction-status-layout__status-icon",children:jsxRuntimeExports.jsx(SvgCheckBlue,{})})}),jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__sent_to",children:[jsxRuntimeExports.jsxs(Typography,{variant:"body_small",color:"secondary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[co("dyn_send_transaction.succeeded.title")," "]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:shortenWalletAddress(Xr,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__content",children:jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__rows",children:jsxRuntimeExports.jsxs(Typography,{variant:"title",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[`${getValueRounded(so,oo)} ${to} `,lo&&(ao==null?void 0:ao.price)&&`($${Number(go)<=.01?"<0.01":go})`]})})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:jsxRuntimeExports.jsx(Alert,{variant:"info",copykey:"dyn_send_transaction.info_message.refresh_balance_time",children:co("dyn_send_transaction.info_message.refresh_balance_time")})})}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",expanded:!0,onClick:ro,loading:!1,copykey:"dyn_send_transaction.succeeded.continue_button",dataTestId:"transaction-done-continue",children:co("dyn_send_transaction.succeeded.continue_button")})}),no&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-status-layout__footer"})]})]})},getAppOrigin=()=>{if(typeof window<"u")return window.location.origin},useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,useInterval=(Xr,eo)=>{const to=reactExports.useRef(Xr);useIsomorphicLayoutEffect(()=>{to.current=Xr},[Xr]),reactExports.useEffect(()=>{if(!eo&&eo!==0)return;const ro=setInterval(()=>to.current(),eo);return()=>clearInterval(ro)},[eo])},useMutation=(Xr,eo={})=>{const[to,ro]=reactExports.useState({isLoading:!1}),no=reactExports.useCallback(io=>__awaiter$j(void 0,void 0,void 0,function*(){var oo,ao;let so;ro({isLoading:!0});try{const co=Xr(io);co instanceof Promise?so=yield co:so=co,ro({data:so,isLoading:!1});try{(oo=eo==null?void 0:eo.onSuccess)===null||oo===void 0||oo.call(eo,so,io)}catch(lo){logger$9.error(lo)}return so}catch(co){ro({error:co,isLoading:!1}),logger$9.error(co);try{(ao=eo==null?void 0:eo.onFailure)===null||ao===void 0||ao.call(eo,co,io)}catch(lo){logger$9.error(lo)}}}),[Xr,eo]);return Object.assign(Object.assign({},to),{hasData:!!to.data,hasError:!!to.error,mutate:no})},useFetchCurrency=(Xr,eo)=>{const to=()=>__awaiter$j(void 0,void 0,void 0,function*(){var io,oo,ao,so;if(!Xr)return null;const co=yield Xr.getNetwork(),lo=getChainInfoWithOverrides((io=Xr.connectedChain)!==null&&io!==void 0?io:"");if(!co)return lo==null?void 0:lo.symbol;const fo=Xr.connectedChain==="STARK"?"starknetNetworks":"evmNetworks",ho=(oo=Xr[fo])===null||oo===void 0?void 0:oo.find(go=>go.chainId===co);return(so=(ao=ho==null?void 0:ho.nativeCurrency)===null||ao===void 0?void 0:ao.symbol)!==null&&so!==void 0?so:lo==null?void 0:lo.symbol}),{data:ro,isLoading:no}=usePromise(to,{deps:[eo]});return{currency:ro,isLoading:no}},usingSessionKey=Xr=>isSessionKeyCompatibleWalletConnector(Xr)||isAccountAbstractionConnector(Xr)&&isSessionKeyCompatibleWalletConnector(Xr.getEOAConnector());var _path$V,_excluded$12=["title","titleId"];function _extends$14(){return _extends$14=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$12(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgTooltip=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$12(eo,_excluded$12);return reactExports.createElement("svg",_extends$14({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$V||(_path$V=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10-5a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1Zm-1 9a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"#ABACB2"})))},_path$U,_excluded$11=["title","titleId"];function _extends$13(){return _extends$13=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$11(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgTooltipArrow=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$11(eo,_excluded$11);return reactExports.createElement("svg",_extends$13({width:8,height:4,viewBox:"0 0 8 4",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$U||(_path$U=reactExports.createElement("path",{d:"M4 3.75 7.031 0H.97L4 3.75Z",fill:"currentColor"})))};const debounce=(Xr,eo)=>{let to;const ro=()=>{Xr()};return()=>{clearTimeout(to),to=window.setTimeout(ro,eo)}},useHover=({initialValue:Xr=!1,falseOnClick:eo=!1,onHover:to,onHoverOff:ro})=>{const[no,io]=reactExports.useState(Xr);return[no,{onMouseDown:()=>io(!0),onMouseEnter:()=>{to==null||to(),io(!0)},onMouseLeave:()=>{ro==null||ro(),io(!1)},onMouseUp:()=>io(eo)}]},Tooltip=({children:Xr,content:eo,className:to,as:ro="span",copykey:no})=>{const{createRootElement:io}=useElementById(),oo=io("dynamic-tooltips"),[ao,so]=reactExports.useState([0,0]),co=reactExports.useRef(null),[lo,fo]=reactExports.useState(!1),ho=reactExports.useCallback(()=>{if(co.current){const yo=co.current.getBoundingClientRect();so([yo.left+yo.width/2,yo.top-6])}},[]),[,go]=useHover({falseOnClick:!0,initialValue:!1,onHover:()=>{ho(),fo(!0)},onHoverOff:()=>{fo(!1)}});return reactExports.useEffect(()=>{ho();const yo=debounce(()=>{ho()},3);return window.addEventListener("resize",yo),()=>{window.removeEventListener("resize",yo)}},[ho]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:tooltipZIndex,children:jsxRuntimeExports.jsxs("div",{"data-testid":"dynamicTooltip",className:classNames("dynamic-tooltip",{"dynamic-tooltip--visible":lo},to),style:{left:ao[0],top:ao[1]},copykey:no,children:[eo,jsxRuntimeExports.jsx(SvgTooltipArrow,{className:"dynamic-tooltip__arrow"})]})}),oo.current),jsxRuntimeExports.jsx(ro,Object.assign({ref:co},go,{children:Xr}))]})},TransactionCard=({transaction:Xr,currentToken:eo,currencySymbol:to,valueRounded:ro,showFiat:no,transactionValue:io,isGasSponsored:oo,gasFiatValue:ao,totalGasFiatValue:so,currency:co,total:lo,t:fo,walletKey:ho})=>{const{primaryWallet:go,projectSettings:yo,overrides:vo}=useInternalDynamicContext(),wo=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:vo==null?void 0:vo.evmNetworks,projectSettings:yo}),{chain:Eo}=useFetchChain(go==null?void 0:go.connector),ko=getNetworkInfoEntry(Eo,wo);return jsxRuntimeExports.jsxs("div",{className:"transaction-card",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__header",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon__container",children:[jsxRuntimeExports.jsx("img",{src:(eo==null?void 0:eo.logoURI)||(ko==null?void 0:ko.nativeCurrency.iconUrl),alt:to,width:25,height:25}),jsxRuntimeExports.jsx("img",{className:"transaction-card__icon__container__network",src:(ko==null?void 0:ko.iconUrls[0])||(Eo==null?void 0:Eo.icon),alt:to,width:25,height:25})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:to})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:to}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:ro||(Xr!=null&&Xr.value?Xr.format(Xr.value,{precision:6}):"")})]}),no&&io&&jsxRuntimeExports.jsxs("div",{className:"transaction-card__info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:"$"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:getDisplayFiatPrice(Number(io)||Number(ro)||0,eo)})]})]})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__arrow",children:jsxRuntimeExports.jsx("span",{children:"↓"})}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__destination",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon__container",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:ho,width:25,height:25})}),jsxRuntimeExports.jsx("img",{className:"transaction-card__icon__container__network",src:(ko==null?void 0:ko.iconUrls[0])||(Eo==null?void 0:Eo.icon),alt:to,width:30,height:30})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"transaction-card__wallet-address",children:shortenWalletAddress(Xr.to,4,4)})]}),!oo&&jsxRuntimeExports.jsxs("div",{className:"transaction-card__total",children:[jsxRuntimeExports.jsxs("div",{className:"row","data-testid":"transaction-estimated-gas-fee",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"flex-row gap-native",children:[fo("dyn_send_transaction.confirmation.data.gas_estimate"),jsxRuntimeExports.jsx(Tooltip,{content:fo("dyn_send_transaction.confirmation.data.gas_tooltip"),copykey:fo("dyn_send_transaction.confirmation.data.gas_tooltip"),className:"transaction-confirmation",children:jsxRuntimeExports.jsx(Icon,{size:"small",className:"fee-tooltip",children:jsxRuntimeExports.jsx(SvgTooltip,{})})})]})}),no&&(eo!=null&&eo.price)?jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:"~ $"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",children:Number(ao)<=.01?"<0.01":ao})]}):jsxRuntimeExports.jsxs("div",{className:"flex-row gap-native",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",children:Xr.fee.gas?Xr.format(Xr.fee.gas,{precision:6}):"--"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:co})]})]}),(eo==null?void 0:eo.price)&&jsxRuntimeExports.jsxs("div",{className:"row","data-testid":"transaction-total",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:fo("dyn_send_transaction.confirmation.data.total")})}),no?jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:"~ $"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:Number(so)<=.01?"<0.01":so})]}):jsxRuntimeExports.jsxs("div",{className:"flex-row gap-native",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:lo?Xr.format(lo,{precision:6}):fo("dyn_send_transaction.confirmation.not_applied")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:co})]})]})]})]})},TransactionConfirmationPageLayout=({onClickClose:Xr,isLoading:eo,onClickBack:to,onClickSend:ro,disableSendButton:no,displayPoweredByDynamicFooter:io=!1,alert:oo,walletConnector:ao,transaction:so,currentToken:co,children:lo,hideModal:fo,onSuccess:ho,transactionValue:go,total:yo,isGasSponsored:vo,isNativeToken:wo,walletKey:Eo})=>{var ko;const{t:Ao}=useTranslation(),{isTurnkeyWallet:Po}=useIsTurnkeyWallet(),{setShowAuthFlow:jo,showFiat:Mo}=useInternalDynamicContext(),{setView:No}=useViewContext(),{userNeedsCrossDomainPasskey:Do}=usePasskeyContext(),{initPasskeyRecoveryProcess:Fo,shouldInitRecovery:Xo}=usePasskeyRecovery(),{currency:Lo}=useFetchCurrency(ao),Bo=useCurrencySymbol(co,Lo),{nativePrice:xo}=useSendBalanceState();useHandleRecovery(ao,usingSessionKey,ho,Xo,Fo,fo);const uo=useHandleSubmitWithChecks({isTurnkeyWallet:Po,onClickSend:ro,userNeedsCrossDomainPasskey:Do,usingSessionKey,walletConnector:ao},{initPasskeyRecoveryProcess:Fo,shouldInitRecovery:Xo},{setShowAuthFlow:jo,setView:No}),po=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"close",disabled:eo,children:jsxRuntimeExports.jsx(SvgClose,{})}),bo=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),_o=getGasFiatValue(co,so,xo),$o=getTotalFiatCost(co,so,xo,go);return fo?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:po,leading:bo,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.confirmation_tx",children:Ao("dyn_send_transaction.data.confirmation_tx")})})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__content",children:[jsxRuntimeExports.jsx(TransactionCard,{transaction:so,currentToken:co,currencySymbol:Bo,valueRounded:(ko=getValueRounded(!!wo,so))===null||ko===void 0?void 0:ko.toString(),showFiat:Mo,transactionValue:go,isGasSponsored:vo,gasFiatValue:_o||"0",totalGasFiatValue:$o||"0",currency:Lo,total:yo,t:Ao,walletKey:Eo}),jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__rows",children:lo})]}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:oo&&jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:oo})}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__actions",children:[(to||Xr)&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"small",onClick:to||Xr,expanded:!0,disabled:eo,copykey:"dyn_send_transaction.confirmation.cancel_button",children:Ao("dyn_send_transaction.confirmation.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",onClick:uo,expanded:!0,loading:eo,disabled:no,copykey:"dyn_send_transaction.confirmation.send",startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),dataTestId:"transaction-confirmation-send",children:Ao("dyn_send_transaction.confirmation.send")})]}),io&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-confirmation__footer"})]})]})},useTransactionTotal=({transactionValue:Xr,gasTotalPrice:eo,isGasSponsored:to=!1})=>reactExports.useMemo(()=>to?Xr!==void 0?Xr:BigInt(0):eo!==void 0&&Xr!==void 0?eo+Xr:Xr||eo,[eo,Xr,to]),useNetworkDataFromWallet=Xr=>{var eo,to;const{data:ro}=usePromise(()=>Xr==null?void 0:Xr.connector.getNetwork(),{enabled:!!Xr}),{networkConfigurations:no}=useInternalDynamicContext();if(!(!Xr||!ro))return Xr.chain==="SOL"?(eo=no==null?void 0:no.solana)===null||eo===void 0?void 0:eo[0]:(to=no==null?void 0:no[Xr.connector.connectedChain.toLowerCase()])===null||to===void 0?void 0:to.find(io=>io.chainId===ro)},FEE_REFRESH_INTERVAL=2e4,TransactionConfirmationView=({transaction:Xr,onError:eo,onSuccess:to,mutation:ro,onClickBack:no,walletConnector:io,onClickClose:oo,title:ao,displayPoweredByDynamicFooter:so=!1,copykey:co,hideModal:lo,currentToken:fo,isNativeToken:ho,transactionValue:go,isModal:yo})=>{const{appName:vo,appLogoUrl:wo,primaryWallet:Eo}=useInternalDynamicContext(),ko=getAppOrigin(),[Ao,Po]=reactExports.useState(!1),jo=useForceUpdate(),{t:Mo}=useTranslation(),{currency:No}=useFetchCurrency(io),{chain:Do}=useFetchChain(io),Fo=()=>{(Do==null?void 0:Do.name)==="Solana"&&Xr.fee.gas!==void 0||Xr.fetchFee().finally(jo)},{isLoading:Xo}=usePromise(()=>isAccountAbstractionConnector(io)?io.canSponsorTransactionGas(Xr):!1,{initialData:!1,onReject:logger$8.error,onResolve:mo=>{Po(mo),!mo&&isAccountAbstractionConnector(io)&&io.disableGasSponsorshipOnce()}}),{mutate:Lo,isLoading:Bo,error:xo}=useMutation(ro,{onFailure:mo=>{Fo(),TransactionGasCannotBeSponsoredError.isInstance(mo)&&(logger$8.debug(mo),Po(!1),isAccountAbstractionConnector(io)&&io.disableGasSponsorshipOnce()),logger$8.error(mo),eo==null||eo(mo)},onSuccess:mo=>to==null?void 0:to(mo)});useInterval(Fo,Bo?null:FEE_REFRESH_INTERVAL),useEffectOnce(Fo);const uo=useTransactionTotal({gasTotalPrice:Xr.fee.gas,isGasSponsored:Ao,transactionValue:Xr.value}),po=xo&&transactionErrorMessage(xo),{data:bo,isLoading:_o}=usePromise(()=>Xr.getBalance()),$o=reactExports.useMemo(()=>!uo||!bo?!1:bo{if(!(!uo||!bo))return uo-bo},[uo,bo]),Ro=reactExports.useMemo(()=>{if(Xr.notEnoughFundsError)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",copykey:"dyn_send_transaction.warning_message.not_enough_solana",children:Mo("dyn_send_transaction.warning_message.not_enough_solana")});if(Xr.value===void 0)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.failed_simulation",children:Mo("dyn_send_transaction.warning_message.failed_simulation")});if(po)return null;if(TransactionGasCannotBeSponsoredError.isInstance(xo))return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",copykey:"dyn_send_transaction.error_message.gas_not_sponsored",children:Mo("dyn_send_transaction.error_message.gas_not_sponsored")});if(!ho&&!Xo&&!_o&&Co===void 0&&Xr.fee.gas)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_gas_funds",children:Mo("dyn_send_transaction.warning_message.insufficient_gas_funds",{amountLeft:Xr.format(Xr.fee.gas,{precision:6}),currencySymbol:No})});if(!($o&&Co))return;const To=Xr.format(Co,{precision:5});return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_funds",children:Mo("dyn_send_transaction.warning_message.insufficient_funds",{amountLeft:To,currencySymbol:No})})},[Xr,po,xo,$o,Co,Mo,No,Xr.fee.gas,ho,Bo]),So=useNetworkDataFromWallet(Eo);return jsxRuntimeExports.jsxs(TransactionConfirmationPageLayout,{onClickBack:no,onClickClose:oo,copykey:co,title:ao,appOrigin:ko,appName:vo,appLogoUrl:wo,hideModal:lo,isLoading:Bo,onClickSend:()=>Lo(),onSuccess:mo=>to==null?void 0:to(mo),displayPoweredByDynamicFooter:so,disableSendButton:_o,error:po,alert:Ro,walletConnector:io,transaction:Xr,total:uo,currentToken:fo,transactionValue:go,isNativeToken:ho,isGasSponsored:Ao,isGasSponsoredLoading:Xo,walletKey:(Eo==null?void 0:Eo.key)||"",children:[jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-wallet_used",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Mo("dyn_send_transaction.confirmation.data.wallet_used")}),jsxRuntimeExports.jsxs(Typography,{weight:"regular",color:"primary",className:"flex gap",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:Eo==null?void 0:Eo.key,width:20,height:20})," ",shortenWalletAddress(Xr.from,4,4)]})]}),yo&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-destination",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Mo("dyn_send_transaction.confirmation.data.destination")}),jsxRuntimeExports.jsxs(Typography,{weight:"regular",color:"primary",className:"flex gap",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:Eo==null?void 0:Eo.key,width:20,height:20})," ",shortenWalletAddress(Xr.to,4,4)]})]}),jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-amount",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Mo("dyn_send_transaction.confirmation.data.amount")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"primary",className:"flex gap",children:Xr.value?Xr.format(Xr.value,{precision:6}):""})]})]}),jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-network_used",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Mo("dyn_send_transaction.confirmation.data.network_used")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"primary",children:So==null?void 0:So.name})]})]})},getAccountTokenBalances=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,chainName:to=ChainEnum.Evm,networkId:ro,accountAddress:no,includeNative:io=!1,includePrices:oo=!1,forceRefresh:ao=!1}){return yield sdkApi$1({customHeaders:ao?{"Cache-Control":"no-cache"}:void 0}).getAccountBalances({accountAddress:no,chainName:to,environmentId:eo,includeNative:io,includePrices:oo,networkId:ro})}),useTokenBalances=({accountAddress:Xr,networkId:eo,chainName:to=ChainEnum.Evm,tokenAddresses:ro,includeFiat:no=!1,includeNativeBalance:io=!1}={})=>{const oo=useTokenBalancesState(),{tokenBalances:ao,isLoading:so,error:co}=oo,{primaryWallet:lo,environmentId:fo,network:ho,user:go}=useInternalDynamicContext(),yo=lo==null?void 0:lo.connector,vo=to??(yo==null?void 0:yo.connectedChain),wo=Xr??(lo==null?void 0:lo.address),Eo=eo??ho,ko=reactExports.useCallback((...jo)=>__awaiter$j(void 0,[...jo],void 0,function*(Mo=!1){if(!go){setTokenBalanceVariable("error",USER_NOT_LOGGED_IN);return}if(![ChainEnum.Evm,ChainEnum.Sol].includes(vo)){setTokenBalanceVariable("error",`Chain ${vo} is not supported for token balances`);return}const Do=to===ChainEnum.Evm&&Eo&&Object.values(GetAccountBalancesNetworkIdEnum).includes(Eo)||to===ChainEnum.Sol;if(so||!wo||!Do){setTokenBalanceVariable("tokenBalances",void 0);return}setTokenBalanceVariable("isLoading",!0);try{const Fo=yield getAccountTokenBalances({accountAddress:wo,chainName:vo,environmentId:fo,forceRefresh:Mo,includeNative:io,includePrices:no,networkId:to===ChainEnum.Evm?Number(Eo):0});if(!Fo)return;setTokenBalanceVariable("error",void 0),setTokenBalanceVariable("tokenBalances",Fo)}catch(Fo){const Xo=(Fo==null?void 0:Fo.code)===429?"Too many requests fetching balances":Fo==null?void 0:Fo.message;setTokenBalanceVariable("error",Xo)}finally{setTokenBalanceVariable("isLoading",!1)}}),[go,vo,to,Eo,so,wo,fo,io,no]);useInternalDynamicEvents("tokenBalancesChanged",()=>ko(!0)),reactExports.useEffect(()=>{ko()},[wo,Eo]);const Ao=ro==null?void 0:ro.map(jo=>jo.toLowerCase()),Po=Ao?ao==null?void 0:ao.filter(jo=>Ao==null?void 0:Ao.includes(jo.address.toLowerCase())):ao;return{error:co,fetchAccountBalances:ko,isError:!!co,isLoading:so,tokenBalances:Po}},zeroAddress="0x0000000000000000000000000000000000000000",nativeSolanaAddress="11111111111111111111111111111111",usingNative=Xr=>Xr.address===zeroAddress||Xr.address===nativeSolanaAddress,getTransactionValue=(Xr,eo)=>eo?Xr.value?Xr.format(Xr.value,{precision:6}):"0":Xr.nonNativeValue&&Xr.formatNonNativeToken?Xr.formatNonNativeToken(Xr.nonNativeValue,Xr.nonNativeDecimal||18):"0",SendBalanceView=({initialRecipientAddress:Xr="",initialValue:eo,onClickBack:to,onClickClose:ro,onError:no,onSuccess:io,onDone:oo,displayPoweredByDynamicFooter:ao=!1})=>{const[so,co]=reactExports.useState("form"),{primaryWallet:lo,walletUiUtils:fo}=useInternalDynamicContext(),{t:ho}=useTranslation(),[go,yo]=reactExports.useState(!1),[vo,wo]=reactExports.useState(void 0),[Eo,ko]=reactExports.useState(void 0),{showFiat:Ao}=useInternalDynamicContext(),Po=lo==null?void 0:lo.connector,{chain:jo}=useFetchChain(Po),{tokenBalances:Mo,isLoading:No}=useTokenBalances({chainName:(Po==null?void 0:Po.connectedChain)==="SOL"?ChainEnum.Sol:ChainEnum.Evm,includeFiat:Ao,includeNativeBalance:!0});if(!lo)throw new DynamicError("Primary wallet is not available, send balance cannot be displayed");const Do=Co=>{const Ro=Co.filter(mo=>mo.address!==zeroAddress&&mo.address!==nativeSolanaAddress),So=Co.find(mo=>usingNative(mo));return So?[So].concat(Ro):Ro};if(Po&&!isSendBalanceWalletConnector(Po))throw new DynamicError("Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector");const[Fo,Xo]=reactExports.useState(null);reactExports.useEffect(()=>{const Co=(Po==null?void 0:Po.connectedChain)!=="SOL"?getEvmChainName(Number(jo==null?void 0:jo.chainId)):void 0;return setSendBalanceVariable("chainName",Co||(jo==null?void 0:jo.name)||(Po==null?void 0:Po.connectedChain)),()=>{resetSendBalanceState()}},[jo==null?void 0:jo.name,Po==null?void 0:Po.connectedChain]),reactExports.useEffect(()=>{Mo&&ko(Do(Mo))},[Mo]),reactExports.useEffect(()=>{Po&&(vo&&yo(usingNative(vo)),Po.createUiTransaction(lo==null?void 0:lo.address).then(Co=>{Xr&&(Co.to=Xr),eo&&(Co.value=eo),vo&&!usingNative(vo)&&(Co.nonNativeAddress=vo==null?void 0:vo.address,Co.nonNativeValue=BigInt(0),Co.nonNativeDecimal=vo==null?void 0:vo.decimals),Xo(Co)}).catch(Co=>{if(logger$8.debug("[SendBalanceView] Error creating transaction",Co),Co instanceof DynamicError&&Co.code==="0"){oo==null||oo();return}no==null||no(Co)}))},[vo]);const Lo=useNetworkDataFromWallet(lo);if(!Fo||!Lo)return jsxRuntimeExports.jsx("div",{className:"send-balance-widget-view__spinner","data-testid":"send-balance-spinner",children:jsxRuntimeExports.jsx(Spinner$1,{})});const Bo=Co=>__awaiter$j(void 0,void 0,void 0,function*(){(Po==null?void 0:Po.connectedChain)==="SOL"&&setTimeout(()=>dynamicEvents.emit("tokenBalancesChanged"),5e3),Po!=null&&Po.confirmTransactionStatus&&(yield Po==null?void 0:Po.confirmTransactionStatus(Co),dynamicEvents.emit("tokenBalancesChanged"))}),xo=(vo==null?void 0:vo.symbol)||Lo.nativeCurrency.symbol,uo=(jo==null?void 0:jo.name)&&jsxRuntimeExports.jsx(ChainIcon,{chain:jo,chainName:jo.name}),po=()=>jsxRuntimeExports.jsx(SendBalancePageLayout,{transaction:Fo,onClickBack:to,networkName:Lo.vanityName||Lo.name,networkIcon:uo,networkCurrencyDecimals:Lo.nativeCurrency.symbol==="SOL"?9:Lo.nativeCurrency.decimals,walletAddress:shortenWalletAddress(vo==null?void 0:vo.address,3,3),walletKey:lo==null?void 0:lo.connector.key,onClickClose:ro,displayPoweredByDynamicFooter:ao,onSubmit:()=>co("confirmation"),tokenBalances:Eo??(vo&&[vo]),currentToken:vo,setCurrentToken:wo,isLoading:No,isNativeToken:go}),bo=()=>jsxRuntimeExports.jsx(TransactionConfirmationView,{walletConnector:lo==null?void 0:lo.connector,transaction:Fo,mutation:()=>(fo.disabledConfirmationOnce(),Fo.submit()),copykey:"dyn_send_transaction.confirmation.title",title:ho("dyn_send_transaction.confirmation.title"),onClickBack:()=>co("form"),onError:no,displayPoweredByDynamicFooter:ao,onSuccess:Co=>__awaiter$j(void 0,void 0,void 0,function*(){Co&&(io==null||io(Co),co("success"),Bo(Co))}),currentToken:vo,isNativeToken:go,transactionValue:getTransactionValue(Fo,go)}),_o=()=>{var Co;return jsxRuntimeExports.jsx(TransactionStatusLayout,{transactionValue:getTransactionValue(Fo,go),destinationAddress:(Co=Fo.to)!==null&&Co!==void 0?Co:"",networkCurrency:xo,networkName:Lo.name||"",NetworkIcon:uo,onClickClose:ro,onDone:()=>oo==null?void 0:oo(),displayPoweredByDynamicFooter:ao,transaction:Fo,currentToken:vo,isNativeToken:go})};return(()=>{switch(so){case"form":return po();case"confirmation":return bo();case"success":return _o()}})()},SendBalanceModal=({initialRecipientAddress:Xr,initialValue:eo,onReject:to,onSuccess:ro})=>{usePreventPageScroll(!0);const[no,io]=reactExports.useState(!0),oo=reactExports.useRef(null),ao=reactExports.useRef(null),so=reactExports.useCallback(()=>{if(ao.current){ro(ao.current);return}to(oo.current||new UserRejectedTransactionError)},[to,ro]),co=()=>{io(!1)};return jsxRuntimeExports.jsx(Portal,{handleClose:co,isShown:no,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-balance",transitionEvents:{onUnmount:so},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(VerticalDrawerTransition,{isShown:!0,children:jsxRuntimeExports.jsx(PopperProvider,{children:jsxRuntimeExports.jsx(SendBalanceView,{initialRecipientAddress:Xr,initialValue:eo,onError:lo=>oo.current=lo,onClickClose:co,onDone:co,displayPoweredByDynamicFooter:!0,onSuccess:lo=>{oo.current=null,ao.current=lo}})})})})})})},noWalletError=new DynamicError("No wallet connected"),invalidWalletTypeError=new DynamicError("Primary wallet must use embedded wallet"),SendBalanceContext=reactExports.createContext(void 0),SendBalanceContextProvider=({children:Xr})=>{const{primaryWallet:eo}=useInternalDynamicContext(),{open:to,modal:ro}=useConfirmationModal({elementId:"dynamic-send-balance"}),no=reactExports.useCallback(io=>__awaiter$j(void 0,void 0,void 0,function*(){return to((oo,ao)=>{if(!eo)throw noWalletError;if(!isSendBalanceWalletConnector(eo.connector))throw invalidWalletTypeError;return jsxRuntimeExports.jsx(SendBalanceModal,{onReject:ao,onSuccess:oo,initialRecipientAddress:io==null?void 0:io.recipientAddress,initialValue:io==null?void 0:io.value})})}),[to,eo]);return jsxRuntimeExports.jsxs(SendBalanceContext.Provider,{value:{open:no},children:[ro,Xr]})},useSendBalance=()=>{const Xr=reactExports.useContext(SendBalanceContext);if(Xr===void 0)throw new Error("usage of useSendBalance not wrapped in `SendBalanceContextProvider`.");if(reactExports.useContext(PasskeyContext)===void 0)throw new Error("usage of useSendBalance not wrapped in `PasskeyContextProvider`.");return Xr};var _path$T,_excluded$10=["title","titleId"];function _extends$12(){return _extends$12=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$10(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgChevronDown=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$10(eo,_excluded$10);return reactExports.createElement("svg",_extends$12({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$T||(_path$T=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 5.529c.26-.26.682-.26.943 0L8 9.724l4.195-4.195a.667.667 0 1 1 .943.943L8.47 11.138a.667.667 0 0 1-.943 0L2.862 6.472a.667.667 0 0 1 0-.943Z",fill:"#7B7D86"})))};const replaceAll=(Xr,eo,to)=>{const ro=new RegExp(eo,"g");return Xr.replace(ro,to)},copyToClipboard=Xr=>{navigator.clipboard.writeText(Xr)},smartFloor=Xr=>Math.floor(ceil(Xr,13)),WITHOUT_DECIMAL_VALUE=1e3,MAX_BALANCE_VALUE=1e6,PRECISION_FLOOR_DIVIDER=1e4,roundBalance=(Xr,eo=4)=>{const to=parseFloat(replaceAll(Xr,'"',""));if(to>MAX_BALANCE_VALUE){const oo=Math.floor(to);return`${Math.floor(oo/MAX_BALANCE_VALUE*PRECISION_FLOOR_DIVIDER)/PRECISION_FLOOR_DIVIDER}M`}if(to>WITHOUT_DECIMAL_VALUE)return String(Math.floor(to));const ro=Math.pow(10,eo),no=1/ro;if(to0)return`< ${no}`;const io=smartFloor(to*ro)/ro;return io===0?"0.0":String(io)},getExportKeysOption=(Xr,eo)=>{var to;if(!Xr||!(eo!=null&&eo.length)||!isMagicConnector(Xr))return;const ro=(to=eo.find(no=>no.provider===ProviderEnum.MagicLink))===null||to===void 0?void 0:to.keyExportUrl;if(ro)return()=>{window.open(ro,"_blank")}};var _path$S,_excluded$$=["title","titleId"];function _extends$11(){return _extends$11=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$$(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgEmbeddedWalletIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$$(eo,_excluded$$);return reactExports.createElement("svg",_extends$11({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$S||(_path$S=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm8.334-45.333a3.333 3.333 0 0 0-3.333-3.334h-15a6.669 6.669 0 0 0-6.56 5.473 6.649 6.649 0 0 1 4.893-2.14h20ZM42 22a6.667 6.667 0 0 1 6.667 6.667V42A6.667 6.667 0 0 1 42 48.667H22A6.667 6.667 0 0 1 15.334 42V28.667A6.667 6.667 0 0 1 22 22h20Z",fill:"#4779FF","data-testid":"wallet-icon-embedded"})))};const pixelToRem=Xr=>`${Xr/16}rem`,useMediaQuery=Xr=>{const eo=io=>typeof window<"u"?window.matchMedia(io).matches:!1,[to,ro]=reactExports.useState(eo(Xr)),no=()=>ro(eo(Xr));return reactExports.useEffect(()=>{const io=window.matchMedia(Xr);return no(),io.addEventListener("change",no),()=>{io.removeEventListener("change",no)}},[Xr]),to},useColorSchemePreference=()=>useMediaQuery("(prefers-color-scheme: dark)")?"dark":"light",useIconThemeVariant=()=>{const{theme:{theme:{name:Xr}}}=useThemeContext(),eo=useColorSchemePreference();return Xr==="auto"?eo:Xr},useFindSocialIcon=()=>{const Xr=useIconThemeVariant();return reactExports.useCallback(eo=>findSocialIcon(eo,Xr),[Xr])},WalletIconWithNetwork=({iconSize:Xr=24,chainName:eo,Icon:to,showNetwork:ro=!0,walletKey:no})=>{const io=eo?getChainIcon(eo):void 0;return jsxRuntimeExports.jsxs("div",{className:"wallet-icon-with-network__container",children:[to?jsxRuntimeExports.jsx(to,{style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}):jsxRuntimeExports.jsx(WalletIcon,{walletKey:no,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}),io&&ro&&jsxRuntimeExports.jsx("div",{"data-testid":"network-container",className:classNames("wallet-icon-with-network__network-container"),children:jsxRuntimeExports.jsx(io,{})})]})},getWalletIcon=({findSocialIcon:Xr,wallet:eo,user:to})=>{if(isEmailOTPWalletConnector(eo.connector))return SignInWithEmailIcon;if(isSocialWalletConnector(eo.connector)){const ro=getReferencedAccount(to,eo.id);if(!ro||!ro.oauthProvider)return SignInWithEmailIcon;const{oauthProvider:no}=ro;try{return Xr(no)}catch(io){logger$8.error(io)}}return isEmbeddedConnector(eo.connector)||isAccountAbstractionConnector(eo.connector)?SvgEmbeddedWalletIcon:null},AuthProviderIcon=({iconSize:Xr=64,showNetworkIcon:eo=!1,wallet:to})=>{const{primaryWallet:ro,selectedWalletConnector:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),{deniedOauthProvider:ao,deniedAddress:so}=useAccessDeniedContext(),{isLoadingEmbeddedWallet:co}=useWalletContext(),lo=useFindSocialIcon();if(ao){const go=lo(ao);return go?jsxRuntimeExports.jsx(go,{style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}):null}if(so)return jsxRuntimeExports.jsx(WalletIcon,{walletKey:no==null?void 0:no.key,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}});const fo=to||ro;if(!fo)return co?jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:Xr,Icon:SvgEmbeddedWalletIcon,chainName:"EVM",showNetwork:!1}):null;const ho=getWalletIcon({findSocialIcon:lo,user:io??oo,wallet:fo});return jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:Xr,Icon:ho??null,chainName:fo.chain,showNetwork:eo,walletKey:fo.key})},StatusDot=({variant:Xr,containerClassName:eo})=>jsxRuntimeExports.jsx("div",{"data-testid":"status-dot-container",className:classNames("status-dot__container",eo||""),children:jsxRuntimeExports.jsx("div",{"data-testid":"status-dot",className:classNames("status-dot",`status-dot--${Xr}`)})}),isNetworkUnsupported=(Xr,eo)=>!(eo!=null&&eo.find(to=>Xr&&to.chainId===parseChainId(Xr)));var _path$R,_excluded$_=["title","titleId"];function _extends$10(){return _extends$10=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$_(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheck=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$_(eo,_excluded$_);return reactExports.createElement("svg",_extends$10({width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$R||(_path$R=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.496 3.67a.583.583 0 0 1 0 .826l-5.834 5.833a.583.583 0 0 1-.824 0L2.504 7.996a.583.583 0 1 1 .825-.825L5.25 9.09l5.42-5.42a.583.583 0 0 1 .826 0Z",fill:"currentColor"})))};const defaultCustomColor="#4779FF",Spinner=({className:Xr="",size:eo=16,customSpinnerColor:to=""})=>{const{theme:ro}=useThemeContext(),no=to||ro.customColor||defaultCustomColor;return jsxRuntimeExports.jsxs("svg",{style:{height:pixelToRem(eo),width:pixelToRem(eo)},viewBox:"0 0 42 42",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Xr,"data-testid":"spinner",children:[jsxRuntimeExports.jsx("mask",{id:"path-1-inside-1_1433_60360",fill:"white",children:jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z"})}),jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z",stroke:"url(#paint0_linear_1433_60360)",strokeWidth:"4",mask:"url(#path-1-inside-1_1433_60360)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1433_60360",x1:"41",y1:"42",x2:"1.5",y2:"-1.82007e-07",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:no}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:no,stopOpacity:"0"})]})})]})},Network=({iconUrl:Xr,isActive:eo,networkName:to,className:ro,checkboxClassName:no="",isChanging:io,notSupported:oo=!1})=>jsxRuntimeExports.jsxs("div",{className:classNames("network",ro,{"network--not-supported":oo}),children:[jsxRuntimeExports.jsxs("div",{className:"network__container",children:[Xr?jsxRuntimeExports.jsx("img",{src:Xr,className:"network__title-icon",alt:`${to} icon`}):jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsxs("div",{className:"network__title-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",className:"network__title-copy",as:"span",weight:"medium",color:oo?"secondary":"primary",children:to}),oo&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"network__title-copy",as:"span",weight:"medium",color:oo?"secondary":"primary","data-testid":"network-not-supported",children:"Switch network in your wallet"})]})]}),jsxRuntimeExports.jsxs("div",{className:classNames("network__status-container",{"network__status-container--active":eo},no),"data-testid":"single-network-checkbox",children:[eo&&jsxRuntimeExports.jsx(SvgCheck,{className:"network__status-icon"}),io&&jsxRuntimeExports.jsx(Spinner,{className:"network__status-spinner-icon",size:12})]})]}),NetworkAction=({iconUrl:Xr,networkId:eo,network:to,onClick:ro,networkName:no,checkboxClassName:io="",newNetworkId:oo,notSupported:ao})=>jsxRuntimeExports.jsx("div",{className:classNames("network-action",{"network--not-supported":ao}),onClick:()=>{!ao&&ro(eo)},"data-testid":"network-action",children:jsxRuntimeExports.jsx(Network,{iconUrl:Xr,isActive:eo===to,networkName:no,checkboxClassName:io,isChanging:oo===eo,notSupported:ao})}),NetworkControlSkeleton=({className:Xr})=>jsxRuntimeExports.jsxs("div",{className:classNames("network-control-skeleton",Xr),"data-testid":"network-control-loading",children:[jsxRuntimeExports.jsx("div",{className:"network-control-skeleton__icon"}),jsxRuntimeExports.jsx(Skeleton,{className:"network-control-skeleton__skeleton"})]}),UnsupportedNetwork=({showMsg:Xr})=>{const{t:eo}=useTranslation();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgError,{})}),Xr&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",color:"error-1",variant:"body_small",copykey:"dyn_network_not_supported.button",children:eo("dyn_network_not_supported.button")})]})},EvmNetworkControl=({evmNetworks:Xr,className:eo="",activeClassName:to="",network:ro,walletConnector:no,isOpen:io,setIsOpen:oo,showNetworkName:ao=!1})=>{var so;const co=Xr==null?void 0:Xr.find(lo=>ro&&lo.chainId===parseChainId(ro));if(Xr&&!Xr.length)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames("evm-network-control__container evm-network-control__container--error",eo),children:jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao})});if(!ro)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames("evm-network-control__container",eo),children:jsxRuntimeExports.jsx(NetworkControlSkeleton,{})});if((Xr==null?void 0:Xr.length)===1){const lo=classNames(eo,"evm-network-control__container","evm-network-control__container--error",{[to]:io,"evm-network-control__container":!!(no!=null&&no.supportsNetworkSwitching())});return co?jsxRuntimeExports.jsxs("div",{"data-testid":"EvmNetworkControl",onClick:()=>ro&&oo(!io),className:classNames("evm-network-control__container",{[to]:io},eo),children:[co.iconUrls.length>0&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:co.iconUrls[0],alt:`${co.name} icon`})}),ao&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:co.vanityName||co.name})]}):jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:()=>oo(!io),className:lo,children:[jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":io}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})}return jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:lo=>{lo.stopPropagation(),ro&&oo(!io)},className:classNames(eo,{[to]:io,"evm-network-control__container":!!(no!=null&&no.supportsNetworkSwitching()),"evm-network-control__container--error":!(co!=null&&co.name)}),children:[co!=null&&co.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[((so=co==null?void 0:co.iconUrls)===null||so===void 0?void 0:so[0])&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:co.iconUrls[0],alt:`${co.name} icon`})}),ao&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:co.vanityName||co.name})]}):jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao}),Xr&&Xr.length>1&&jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":io}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})},capitalize$1=Xr=>{var eo;return((eo=Xr[0])===null||eo===void 0?void 0:eo.toUpperCase())+Xr.slice(1).toLowerCase()},NonNetworkSwitchingSupportedControl=({walletConnector:Xr,className:eo,showNetworkName:to=!1})=>{const{chain:ro,isLoading:no}=useFetchChain(Xr),io=(ro==null?void 0:ro.name)||"",oo=getChainIcon(Xr.connectedChain||"");return no?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:eo}):jsxRuntimeExports.jsxs("div",{"data-testid":"NonNetworkSwitchingSupportedControl",className:classNames("non-network-switching-supported-control",eo),children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:ro!=null&&ro.icon?jsxRuntimeExports.jsx("img",{src:ro.icon,alt:`${ro.name} icon`}):jsxRuntimeExports.jsx(oo,{})}),to&&jsxRuntimeExports.jsx(Typography,{className:classNames("non-network-switching-supported-control__network-name"),as:"span",variant:"body_small",children:capitalize$1(io)}),jsxRuntimeExports.jsx("span",{})]})},NetworkControl=({loading:Xr,walletConnector:eo,buttonClassName:to,network:ro,evmNetworks:no,activeClassName:io,isOpen:oo,setIsOpen:ao,showNetworkName:so})=>{const co=(eo==null?void 0:eo.connectedChain)===ChainEnum.Evm&&typeof ro=="string";return Xr||co?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:to}):eo!=null&&eo.connectedChain&&!eo.supportsNetworkSwitching()?jsxRuntimeExports.jsx(NonNetworkSwitchingSupportedControl,{className:to,showNetworkName:so,walletConnector:eo}):jsxRuntimeExports.jsx(EvmNetworkControl,{showNetworkName:so,evmNetworks:no,activeClassName:io,className:to,network:ro,loading:Xr,isOpen:oo,walletConnector:eo,setIsOpen:ao})},NetworkPicker=({activeClassName:Xr="",buttonClassName:eo="",checkboxClassName:to="",connector:ro,evmNetworks:no,isNetworkPickerOpen:io,listClassName:oo="",mainClassName:ao="",setIsNetworkPickerOpen:so,showNetworkName:co,customCallbackOnSuccess:lo,currentNetwork:fo,isLoading:ho=!1})=>{const go=reactExports.useRef(null),[yo,vo]=reactExports.useState(void 0),{loadingNetwork:wo}=useInternalDynamicContext(),{data:Eo}=usePromise(()=>isWalletConnectConnector(ro)?ro.getSupportedNetworks():Promise.resolve(no.map(({networkId:jo})=>`${jo}`)),{deps:[ro,no,io],initialData:void 0}),ko=isNetworkUnsupported(fo,no)||(no==null?void 0:no.length)>1,Ao=reactExports.useRef(null),Po=jo=>__awaiter$j(void 0,void 0,void 0,function*(){vo(jo);try{yield ro==null?void 0:ro.switchNetwork({networkChainId:jo}),lo==null||lo()}catch(Mo){logger$8.debug(Mo)}finally{vo(void 0),so(!1)}});return jsxRuntimeExports.jsxs("div",{className:classNames("non-widget-network-picker",ao),ref:go,"data-testid":"network-picker",children:[jsxRuntimeExports.jsxs("div",{className:"network-picker-network-control",children:[jsxRuntimeExports.jsx(NetworkControl,{evmNetworks:no,activeClassName:Xr,network:fo,loading:wo||ho,isOpen:io,setIsOpen:so,walletConnector:ro,showNetworkName:co,buttonClassName:eo}),jsxRuntimeExports.jsx("div",{ref:Ao,className:"network-picker-network-control__anchor"})]}),ko&&jsxRuntimeExports.jsx(MenuList,{className:oo,isOpen:io,onClickClose:()=>so(!1),popperProps:{anchorOrigin:"bottom-left",anchorRef:Ao},mobileTitle:"Select network",children:no.map(({name:jo,networkId:Mo,vanityName:No,iconUrls:Do})=>jsxRuntimeExports.jsx(NetworkAction,{iconUrl:Do==null?void 0:Do[0],networkId:Mo,networkName:No||jo,network:fo,onClick:Po,checkboxClassName:to,newNetworkId:yo,notSupported:Eo&&!Eo.includes(`${Mo}`)},Mo))})]})},useFetchNameService=Xr=>{const{getNameService:eo,network:to}=useInternalDynamicContext(),{data:ro}=usePromise(()=>eo(Xr),{deps:[Xr,to,eo]});return ro},useFetchBalance=({wallet:Xr,chain:eo,network:to})=>{const[ro,no]=reactExports.useState("0.0"),io=!eo||Xr.connector.supportsNetworkSwitching()&&!to,oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(io)return;const so=yield Xr.getBalance();no(so)}),{isLoading:ao}=usePromise(oo,{deps:[Xr.address,to==null?void 0:to.toString(),eo],enabled:!io});return{balance:ro,isLoading:ao}},Balance=({wallet:Xr,network:eo,className:to})=>{const{currency:ro,isLoading:no}=useFetchCurrency(Xr.connector,eo),{balance:io,isLoading:oo}=useFetchBalance({chain:ro,network:eo,wallet:Xr});return io?jsxRuntimeExports.jsxs(Typography,{className:to,variant:"body_normal",color:"primary",children:[oo?jsxRuntimeExports.jsx(Skeleton,{className:"balance-skeleton"}):roundBalance(io)," ",!no&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_normal",color:"secondary",children:ro})]}):null},MULTI_ASSET_SUPPORTED_NETWORKS=Object.values(GetAccountBalancesNetworkIdEnum),isMultiAssetSupportedNetwork=(Xr,eo)=>!!((Xr==null?void 0:Xr.connectedChain)===ChainEnum.Sol||(Xr==null?void 0:Xr.connectedChain)===ChainEnum.Evm&&typeof eo=="number"&&MULTI_ASSET_SUPPORTED_NETWORKS.includes(eo));var _path$Q,_path2$6,_excluded$Z=["title","titleId"];function _extends$$(){return _extends$$=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Z(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCopy=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Z(eo,_excluded$Z);return reactExports.createElement("svg",_extends$$({width:18,height:18,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Q||(_path$Q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.333 1.667a2.5 2.5 0 0 0-2.5 2.5v1.666H7.5V4.167c0-.46.373-.834.833-.834h7.5c.46 0 .833.373.833.834v7.5c0 .46-.373.833-.833.833h-1.667v1.667h1.667a2.5 2.5 0 0 0 2.5-2.5v-7.5a2.5 2.5 0 0 0-2.5-2.5h-7.5Z",fill:"currentColor"})),_path2$6||(_path2$6=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.667 8.333a2.5 2.5 0 0 1 2.5-2.5h7.5a2.5 2.5 0 0 1 2.5 2.5v7.5a2.5 2.5 0 0 1-2.5 2.5h-7.5a2.5 2.5 0 0 1-2.5-2.5v-7.5Zm2.5-.833a.833.833 0 0 0-.833.833v7.5c0 .46.373.834.833.834h7.5c.46 0 .833-.373.833-.834v-7.5a.833.833 0 0 0-.833-.833h-7.5Z",fill:"currentColor"})))};const TextButton=Xr=>{var{className:eo=""}=Xr,to=__rest$7(Xr,["className"]);return jsxRuntimeExports.jsx("button",Object.assign({className:classNames("text-button",eo)},to))},CopyButton=({children:Xr,className:eo="",textToCopy:to,onClick:ro,variant:no="text",copykey:io,buttonPadding:oo="small",buttonVariant:ao="primary",buttonClassName:so="",startSlot:co,disabled:lo})=>{const[fo,ho]=reactExports.useState(!1),go=()=>{navigator.clipboard.writeText(to),ho(!0),ro==null||ro()},yo=()=>jsxRuntimeExports.jsx(Tooltip,{className:"copy-button__tooltip",content:fo?"Copied":"Copy",children:Xr});return no==="text"?jsxRuntimeExports.jsx(TextButton,{className:classNames("copy-button__container",eo),onClick:()=>go(),onMouseLeave:()=>ho(!1),copykey:io,disabled:lo,children:jsxRuntimeExports.jsx(yo,{})}):jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:oo,buttonVariant:ao,buttonClassName:so,onClick:()=>go(),copykey:io,startSlot:co,disabled:lo,children:jsxRuntimeExports.jsx(yo,{})})},ActiveBitcoinWalletAddresses=({menuOption:Xr,wallet:eo})=>{var to,ro;const{t:no}=useTranslation(),io=(to=getWalletAdditionalAddressByType(WalletAddressType.Ordinals,eo))!==null&&to!==void 0?to:eo==null?void 0:eo.address,oo=(ro=getWalletAdditionalAddressByType(WalletAddressType.Payment,eo))!==null&&ro!==void 0?ro:eo==null?void 0:eo.address;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:no("dyn_active_wallet_info.ordinals_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(io,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:Xr,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu"})]}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:no("dyn_active_wallet_info.payment_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"primary",children:shortenWalletAddress(oo,4,4)})]}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:oo??"",children:jsxRuntimeExports.jsx(Icon,{size:"xsmall",children:jsxRuntimeExports.jsx(SvgCopy,{})})})]})]})};var _path$P,_excluded$Y=["title","titleId"];function _extends$_(){return _extends$_=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Y(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgGear=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Y(eo,_excluded$Y);return reactExports.createElement("svg",_extends$_({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$P||(_path$P=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.353 4.081c.674-2.775 4.62-2.775 5.294 0a.724.724 0 0 0 1.08.448c2.44-1.486 5.23 1.305 3.744 3.744a.724.724 0 0 0 .448 1.08c2.775.674 2.775 4.62 0 5.294a.724.724 0 0 0-.448 1.08c1.486 2.44-1.305 5.23-3.744 3.744a.724.724 0 0 0-1.08.448c-.674 2.775-4.62 2.775-5.294 0a.724.724 0 0 0-1.08-.448c-2.44 1.486-5.23-1.305-3.744-3.744a.724.724 0 0 0-.448-1.08c-2.775-.674-2.775-4.62 0-5.294a.724.724 0 0 0 .448-1.08c-1.486-2.44 1.305-5.23 3.744-3.744a.724.724 0 0 0 1.08-.448Zm3.35.472c-.178-.737-1.227-.737-1.407 0a2.724 2.724 0 0 1-4.064 1.684c-.648-.395-1.39.347-.995.995.96 1.575.109 3.63-1.684 4.064-.737.18-.737 1.229 0 1.408a2.724 2.724 0 0 1 1.684 4.064c-.395.648.347 1.39.995.995a2.724 2.724 0 0 1 4.064 1.684c.18.737 1.229.737 1.408 0a2.724 2.724 0 0 1 4.064-1.684c.648.395 1.39-.347.995-.995a2.724 2.724 0 0 1 1.684-4.064c.737-.18.737-1.229 0-1.408a2.724 2.724 0 0 1-1.684-4.064c.395-.648-.347-1.39-.995-.995-1.575.96-3.63.109-4.064-1.684ZM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"#ABACB2"})))};const IconWithStatus=({Icon:Xr,InnerIcon:eo,primaryWalletKey:to,containerClassName:ro,iconSize:no=16,variant:io="green"})=>{const oo=to?jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames("inner-icon"),children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to})})})}):jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames("inner-icon",`inner-icon--${io}`),children:eo&&jsxRuntimeExports.jsx(eo,{})})});return jsxRuntimeExports.jsxs("div",{className:classNames("icon-with-status__container",ro||""),children:[typeof Xr=="string"?jsxRuntimeExports.jsx("img",{style:{height:pixelToRem(no),width:pixelToRem(no)},src:Xr,alt:"",className:"icon"}):jsxRuntimeExports.jsx(Xr,{style:{height:pixelToRem(no),width:pixelToRem(no)}}),eo||to?oo:jsxRuntimeExports.jsx(StatusDot,{variant:io,containerClassName:"icon-with-status__status-dot"})]})},ActiveWalletAddress=({address:Xr,nameServiceName:eo,menuOption:to,fullWidth:ro=!1,isLoading:no=!1})=>{const{showAlert:io}=usePasskeyContext();return jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:ro?"active-wallet-information__handle--full-width":"active-wallet-information__handle",color:"primary",variant:"body_normal",children:eo}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:eo?"regular":"medium",variant:eo?"body_small":"body_normal",color:eo?"secondary":"primary",children:no?jsxRuntimeExports.jsx(Skeleton,{className:"active-wallet-information__address-skeleton"}):shortenWalletAddress(Xr,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:to,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu",iconOverride:io()?jsxRuntimeExports.jsx(IconWithStatus,{Icon:()=>jsxRuntimeExports.jsx(SvgGear,{width:16,height:16}),variant:"yellow"}):jsxRuntimeExports.jsx(SvgGear,{width:16,height:16})})]})},currencyFormatter=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),TokenBalanceItem=({tokenBalance:Xr})=>{const{showFiat:eo}=useInternalDynamicContext(),to=no=>{const io=Math.round(no*1e6)/1e6;return io===0?"<0.000001":io},ro=()=>{var no;return Xr.marketValue!==0&&!Xr.marketValue?"$-":Xr.marketValue>=.01?currencyFormatter.format(parseFloat((no=Xr.marketValue)===null||no===void 0?void 0:no.toFixed(2))):"<$0.01"};return jsxRuntimeExports.jsxs("div",{className:"token-balance-item",children:[jsxRuntimeExports.jsxs("div",{className:"token-balance-item__name",children:[Xr.logoURI?jsxRuntimeExports.jsx(Image$1,{src:Xr.logoURI,alt:Xr.symbol,className:"token-balance-item__icon",dataTestId:"token-balance-item-icon"}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"token-balance-item__title",color:"primary",children:Xr.name})})]}),jsxRuntimeExports.jsxs("div",{className:"flex",children:[eo?jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",style:{textAlign:"right"},children:ro()}):null,jsxRuntimeExports.jsx("div",{className:"token-balance-item__value",children:jsxRuntimeExports.jsxs("div",{className:"token-balance-item__value__balance","data-testid":"token-balance-item-balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",style:{marginRight:"2px"},children:to(Xr.balance)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Xr.symbol})]})})]})]},Xr.address)},Divider=({text:Xr,className:eo,style:to,fullWidth:ro=!1,children:no})=>jsxRuntimeExports.jsxs("div",{className:classNames("divider",eo,{"divider__full-width":ro}),style:to,children:[jsxRuntimeExports.jsx("div",{className:"divider__dash"}),!!Xr&&jsxRuntimeExports.jsx(Typography,{className:"divider__text",variant:"body_small",color:"secondary",children:Xr}),no&&jsxRuntimeExports.jsx("div",{children:no}),jsxRuntimeExports.jsx("div",{className:"divider__dash"})]}),TokenBalanceList=({tokenBalances:Xr})=>{const{t:eo}=useTranslation();return jsxRuntimeExports.jsx("ul",{className:"token-balance-list",children:(Xr==null?void 0:Xr.length)===0?jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:eo("dyn_wallet_information.multi_asset.empty_state")})}):Xr==null?void 0:Xr.map((to,ro)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsx(TokenBalanceItem,{tokenBalance:to}),Xr.length!==ro+1?jsxRuntimeExports.jsx(Divider,{className:"token-balance-list__divider"}):null]},ro))})},ICON_SIZE=28,ActiveWalletInformation=({isLoading:Xr=!1})=>{var eo,to,ro,no,io;const{t:oo}=useTranslation(),[ao,so]=reactExports.useState(!1),[co,lo]=reactExports.useState(!1),[fo,ho]=reactExports.useState(!1),go=reactExports.useRef(null),{primaryWallet:yo,network:vo,projectSettings:wo,user:Eo,authMode:ko,showFiat:Ao,multiAsset:Po}=useInternalDynamicContext(),{setDynamicWidgetView:jo}=useWidgetContext(),{isTurnkeyWalletWithoutAuthenticator:Mo}=useIsTurnkeyWallet(),{isLoading:No,tokenBalances:Do,error:Fo}=useTokenBalances({chainName:yo==null?void 0:yo.connector.connectedChain,includeFiat:Ao,includeNativeBalance:!0}),Xo=yo==null?void 0:yo.connector,Lo=(Do==null?void 0:Do.filter(El=>El.name))||[],Bo=yo==null?void 0:yo.address,xo=useFetchNameService(Bo),{getEOAWallet:uo}=useSmartWallets(),{data:po}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return!!(yield yo==null?void 0:yo.connector.isTestnet())}),{deps:[vo],initialData:!1}),bo=getExportKeysOption(yo==null?void 0:yo.connector,wo==null?void 0:wo.providers),{showAlert:_o}=usePasskeyContext(),$o=(eo=yo&&uo(yo))!==null&&eo!==void 0?eo:yo,Co=yo&&isBitcoinConnector(yo==null?void 0:yo.connector),Ro=!!($o&&(!((ro=(to=$o==null?void 0:$o.connector)===null||to===void 0?void 0:to.key)===null||ro===void 0)&&ro.startsWith("turnkey")||!((io=(no=$o==null?void 0:$o.connector)===null||no===void 0?void 0:no.key)===null||io===void 0)&&io.startsWith("coinbasempc"))),So=[{Icon:null,callback:()=>(xo==null?void 0:xo.name)&&navigator.clipboard.writeText(xo==null?void 0:xo.name),hide:!(xo!=null&&xo.name),text:"Copy ENS"},{Icon:null,callback:()=>Bo&&navigator.clipboard.writeText(Bo),hide:!Bo,text:"Copy wallet address"},{Icon:null,callback:()=>jo("settings"),endSlot:_o()?jsxRuntimeExports.jsx(StatusDot,{variant:"yellow"}):void 0,hide:!Ro,text:"Wallet settings"},{Icon:null,callback:bo||(()=>logger$8.info("No option to export private keys")),hide:!bo,text:"Export private keys"}],mo=(yo==null?void 0:yo.connector)&&(yo==null?void 0:yo.connector).evmNetworks||[],To=po&&!Mo,Vo=wo==null?void 0:wo.sdk.hideNetworkInDynamicWidget,Zo=()=>Co?jsxRuntimeExports.jsx(ActiveBitcoinWalletAddresses,{wallet:yo,menuOption:So}):jsxRuntimeExports.jsx(ActiveWalletAddress,{address:Bo,nameServiceName:(xo==null?void 0:xo.name)||(Eo==null?void 0:Eo.email),menuOption:So,isLoading:Xr,fullWidth:Vo}),Qo=ko==="connect-and-sign"&&Po,qo=isMultiAssetSupportedNetwork(Xo,vo),$a=!(Fo==="Too many requests fetching balances")&&qo&&Qo;Lo.sort((El,Al)=>((Al==null?void 0:Al.marketValue)||0)-((El==null?void 0:El.marketValue)||0));const zo=Lo.reduce((El,Al)=>El+((Al==null?void 0:Al.marketValue)||0),0),Ko=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),_c=()=>yo?jsxRuntimeExports.jsx(Balance,{className:"balance-header__balance",wallet:yo,network:vo}):jsxRuntimeExports.jsx(Skeleton,{className:"balance-header__skeleton"}),Cl=()=>{go.current&&ho(go.current.scrollTop>0)},ga=()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`${fo?"shadow":""}`,children:jsxRuntimeExports.jsxs("button",{onClick:()=>{No||lo(!co)},className:"balance-header",children:[jsxRuntimeExports.jsxs("div",{className:"balance-header__title",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",style:{marginRight:"8px"},children:"Balance:"}),Ao?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:zo===0||zo>=.01?Ko.format(parseFloat(zo.toFixed(2))):"<$0.01"}):_c()]}),jsxRuntimeExports.jsx("div",{className:co?"balance-header__chevron":"",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]})}),jsxRuntimeExports.jsx(AccordionItem,{isOpen:co,className:`multi-asset-balance-container__accordion ${"multi-asset-balance-container__accordion"+(co?"--expanded":"--collapsed")}`,handleScroll:Cl,ref:go,children:jsxRuntimeExports.jsx(TokenBalanceList,{tokenBalances:Lo})})]});return Xr?jsxRuntimeExports.jsx(Skeleton,{}):jsxRuntimeExports.jsxs("div",{className:"active-wallet-information-container","data-testid":"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__header",children:[jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar",children:xo!=null&&xo.avatar?jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar__name-service",children:jsxRuntimeExports.jsx("img",{src:xo==null?void 0:xo.avatar,alt:""})}):jsxRuntimeExports.jsx("div",{className:"active-wallet-information__wallet-img",children:jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:ICON_SIZE})})}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__details",children:[jsxRuntimeExports.jsx("div",{className:classNames("active-wallet-information__addresses-container",{"active-wallet-information__addresses-container--centered":!(xo!=null&&xo.name)}),children:Zo()}),!Vo&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:vo,connector:yo==null?void 0:yo.connector,isNetworkPickerOpen:ao,setIsNetworkPickerOpen:so,mainClassName:"active-wallet-information__network-picker",buttonClassName:"active-wallet-information__network-picker-button",evmNetworks:mo,showNetworkName:!0,isLoading:Xr})]})]}),To&&jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_active_wallet_info.testnet_warning",children:oo("dyn_active_wallet_info.testnet_warning")})]}),$a?jsxRuntimeExports.jsx("div",{className:"multi-asset-balance-container",children:ga()}):jsxRuntimeExports.jsxs("div",{className:"balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",children:"Balance"}),_c()]})]})},UnknownWalletInformation=({address:Xr})=>{const{handleLogOut:eo}=useInternalDynamicContext(),to=[{Icon:null,callback:()=>Xr&&navigator.clipboard.writeText(Xr),hide:!Xr,text:"Copy wallet address"},{Icon:null,callback:eo,text:"Disconnect"}];return jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information-container",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__header",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__details",children:jsxRuntimeExports.jsxs("div",{className:"unknown-wallet-information__actions-container",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{className:"unknown-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(Xr,4,4)})}),jsxRuntimeExports.jsx(DotsMenu,{options:to,buttonClassName:"unknown-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"unknown-wallet-information__dots-menu"})]})})})})})},LinkButton=React.memo(({connector:Xr})=>{const{setDynamicWidgetView:eo}=useWidgetContext(),to=()=>{eo("global-wallet")};return Xr.globalWallet?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"link-button",buttonPadding:"small",buttonVariant:"primary",onClick:to,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:"Connect"}):null});LinkButton.displayName="LinkButton";const DynamicWidgetWalletHeader=({variant:Xr})=>{const{primaryWallet:eo,user:to}=useInternalDynamicContext(),{open:ro}=useSendBalance(),{supportsFunding:no,setShowFunding:io,fundingEnabled:oo}=useFundingContext(),{setDynamicWidgetView:ao,setIsOpen:so}=useWidgetContext(),{isLoadingEmbeddedWallet:co}=useWalletContext(),{t:lo}=useTranslation(),fo=reactExports.useMemo(()=>{const vo=eo==null?void 0:eo.connector;return vo?isSendBalanceWalletConnector(vo):!1},[eo]),ho=()=>{Xr==="dropdown"?(so(!1),ro().catch(vo=>logger$8.error(vo))):ao("send-balance")},go=()=>{const vo=to==null?void 0:to.verifiedCredentials.find(wo=>wo.walletName==="unknown");return eo||co?jsxRuntimeExports.jsx(ActiveWalletInformation,{isLoading:co}):vo?jsxRuntimeExports.jsx(UnknownWalletInformation,{address:vo.address}):jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:to})})},yo=fo||oo;return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header","data-testid":"dynamic-widget-wallet-header",children:[go(),co&&jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-info",children:jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-loading",children:jsxRuntimeExports.jsx(Alert,{variant:"info",icon:jsxRuntimeExports.jsx(Spinner$1,{className:"button__spinner"}),children:lo("dyn_creating_wallet.loading_message")})})}),eo?jsxRuntimeExports.jsxs("div",{"data-testid":"primaryWalletStatus",className:"dynamic-widget-wallet-header__wallet-info",children:[jsxRuntimeExports.jsx(SecureEmbeddedWalletCard,{className:"dynamic-widget-wallet-header__wallet-info__secure-wallet"}),yo&&jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header__wallet-actions",children:[oo&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"buy-crypto-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>io(!0),disabled:!no,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgAdd,{})}),children:"Buy"}),fo&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"send-balance-button",buttonPadding:"small",buttonVariant:"primary",onClick:ho,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),children:"Send"}),jsxRuntimeExports.jsx(LinkButton,{connector:eo.connector})]})]}):jsxRuntimeExports.jsx(Typography,{className:"dynamic-widget-wallet-header__email",variant:"body_normal",weight:"regular",children:!co&&getUserIdentifier(to)})]})};React.memo(DynamicWidgetWalletHeader);const DynamicWidgetHeader=({variant:Xr})=>{const{overridenWidgetView:eo}=useWidgetContext(),{multiWallet:to}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-header",children:[jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{className:"dynamic-widget-header__passkey-success"}),(eo==="wallets"||eo==="profile"&&!to)&&jsxRuntimeExports.jsx(DynamicWidgetWalletHeader,{variant:Xr})]})};React.memo(DynamicWidgetHeader);const DynamicBridgeWalletCard=({className:Xr,networkIcon:eo,networkName:to,children:ro})=>{const{t:no}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:classNames("dynamic-bridge-wallet-card",Xr),children:[jsxRuntimeExports.jsxs("div",{className:"dynamic-bridge-wallet-card__network",children:[eo&&React.cloneElement(eo,{className:"dynamic-bridge-wallet-card__network-icon"}),to&&jsxRuntimeExports.jsx(Typography,{className:"dynamic-bridge-wallet-card__network-name",variant:"body_small",color:"primary",weight:"medium",as:"span",copykey:"dyn_bridge.widget.wallet_network",children:no("dyn_bridge.widget.wallet_network",{networkName:to})})]}),ro]})},WalletInformationCard=({address:Xr,ens:eo,balance:to,icon:ro,network:no,menu:io})=>{const{t:oo}=useTranslation(),ao=reactExports.useMemo(()=>{const so=shortenWalletAddress(Xr);return eo?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",truncate:!0,children:eo}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",children:so})]}):jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",children:so})},[eo,Xr]);return jsxRuntimeExports.jsxs("div",{className:"wallet-information-card",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__header",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__details-container",children:[ro&&jsxRuntimeExports.jsx(Icon,{className:"wallet-information-card__icon",children:ro}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__details",children:ao}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__menu",children:io})]}),no]}),jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_wallet_information.balance",children:oo("dyn_wallet_information.balance")}),to]})]})},DynamicBridgeWalletCardBody=({walletAddress:Xr,walletBalance:eo,walletKey:to,onDisconnectClick:ro})=>{const{t:no}=useTranslation(),io=useFetchNameService(Xr),oo=[{Icon:null,callback:()=>(io==null?void 0:io.name)&&navigator.clipboard.writeText(io==null?void 0:io.name),hide:!(io!=null&&io.name),text:no("dyn_bridge.widget.copy.ens")},{Icon:null,callback:()=>Xr&&navigator.clipboard.writeText(Xr),hide:!Xr,text:no("dyn_bridge.widget.copy.address")},{Icon:null,callback:()=>ro==null?void 0:ro(),hide:!ro,text:no("dyn_bridge.widget.disconnect")}];return jsxRuntimeExports.jsx(WalletInformationCard,{ens:io==null?void 0:io.name,address:Xr,icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to}),balance:eo,menu:jsxRuntimeExports.jsx(DotsMenu,{options:oo}),copykey:"dyn_bridge.widget"})},DynamicBridgeWidgetEmptyCard=({chain:Xr})=>{const{t:eo}=useTranslation(),{bridgeChainsToConnect:to,setShowAuthFlow:ro,setShowBridgeWidget:no}=useInternalDynamicContext();if(!(to!=null&&to.length)||!Xr)return null;const io=getChainInfoWithOverrides(Xr),oo=getChainIcon(Xr);return jsxRuntimeExports.jsxs("div",{role:"button",className:"dynamic-bridge-widget-empty-card",onClick:()=>{no(!1),ro(!0)},children:[jsxRuntimeExports.jsx(oo,{className:"dynamic-bridge-widget-empty-card__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",as:"span",color:"primary",className:"dynamic-bridge-widget-empty-card__text",copykey:"dyn_bridge.widget.connect_with_network",children:eo("dyn_bridge.widget.connect_with_network",{blockchainName:io==null?void 0:io.blockchainName})})]})},SecondaryWallets=({hideUnlinkAction:Xr=!1})=>{const{disconnectWallet:eo,getConnectedWalletById:to,bridgeChains:ro}=useInternalDynamicContext(),no=to("connect-wallet-1"),io=no&&getChainIcon(no==null?void 0:no.chain),oo=no&&getChainInfoWithOverrides(no==null?void 0:no.chain);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!no&&jsxRuntimeExports.jsx(DynamicBridgeWidgetEmptyCard,{chain:ro==null?void 0:ro[1].chain}),no&&io&&jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(io,{}),networkName:oo==null?void 0:oo.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:no.connector.key,walletAddress:no.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:no,network:no.chain}),onDisconnectClick:Xr?void 0:()=>eo(no.id)},no.id)})]})},MemoSecondaryWallets=React.memo(SecondaryWallets),useSmartWallets=()=>{const{user:Xr,walletConnectorOptions:eo}=useInternalDynamicContext(),to=reactExports.useCallback(io=>{const{verifiedCredentials:oo}=Xr??{};if(!oo)return;const ao=oo.find(so=>so.id===io.id);return(ao==null?void 0:ao.walletProvider)===WalletProviderEnum.SmartContractWallet?ao:void 0},[Xr]),ro=reactExports.useCallback(io=>{var oo,ao,so;const co=Xr==null?void 0:Xr.verifiedCredentials;if(!co)return;const lo=to(io),fo=co.find(vo=>vo.id===(lo==null?void 0:lo.signerRefId));if(!(fo!=null&&fo.address)||!(fo!=null&&fo.chain))return;const{walletConnector:ho}=(oo=findWalletOptionFor(fo,eo))!==null&&oo!==void 0?oo:{},yo=!((ao=fo.walletName)===null||ao===void 0?void 0:ao.startsWith("turnkey"))||!!(!((so=fo.walletProperties)===null||so===void 0)&&so.isAuthenticatorAttached);return ho==null?void 0:ho.createWallet({address:fo.address,chain:ho.connectedChain,connector:ho,id:fo.id,isAuthenticated:yo,key:ho.key})},[to,Xr==null?void 0:Xr.verifiedCredentials,eo]),no=reactExports.useCallback(io=>{var oo;const ao=Xr==null?void 0:Xr.verifiedCredentials;if(!ao)return;const so=ao.find(fo=>fo.id===io.id),co=ao.find(fo=>fo.signerRefId===(so==null?void 0:so.id));if(!(co!=null&&co.address)||!(co!=null&&co.chain))return;const{walletConnector:lo}=(oo=findWalletOptionFor(co,eo))!==null&&oo!==void 0?oo:{};return lo==null?void 0:lo.createWallet({address:co.address,chain:lo.connectedChain,connector:lo,id:co.id,isAuthenticated:!0,key:lo.key})},[Xr==null?void 0:Xr.verifiedCredentials,eo]);return reactExports.useMemo(()=>({getEOAWallet:ro,getSmartWallet:no,isSmartWallet:io=>to(io)!==void 0}),[ro,to,no])},useIsTurnkeyWallet=()=>{var Xr,eo,to;const{primaryWallet:ro,user:no}=useInternalDynamicContext(),{getEOAWallet:io}=useSmartWallets(),oo=(Xr=ro&&io(ro))!==null&&Xr!==void 0?Xr:ro,ao=()=>{if(!oo||!no||!oo.connector.key.startsWith("turnkey"))return;const wo=oo.id,Eo=no.verifiedCredentials.find(ko=>ko.id===wo);if(Eo)return Eo},so=()=>{if(!oo||!no)return!1;const wo=no.verifiedCredentials.find(ko=>{var Ao,Po;return((Ao=ko.walletName)===null||Ao===void 0?void 0:Ao.startsWith("turnkey"))&&((Po=ko.walletProperties)===null||Po===void 0?void 0:Po.isAuthenticatorAttached)===!1});return no.verifiedCredentials.find(ko=>wo&&ko.signerRefId===wo.id)},co=ao(),lo=!!so(),fo=!!(co||lo),ho=!!(!((eo=co==null?void 0:co.walletProperties)===null||eo===void 0)&&eo.isAuthenticatorAttached),go=fo&&!ho||lo,yo=fo&&!!getUserVerifiedCredentialType(no,JwtVerifiedCredentialFormatEnum.Email),vo=fo&&!!(!((to=co==null?void 0:co.walletProperties)===null||to===void 0)&&to.isSessionKeyCompatible);return{hasRecoveryEmail:yo,hasTurnkeyVerifiedCredentialAuthenticator:ho,isSessionKeyCompatible:vo,isTurnkeyWallet:fo,isTurnkeyWalletWithoutAuthenticator:go,turnkeyVerifiedCredential:co}},findTurnkeyWalletByChain=(Xr,eo)=>{const to=eo?VerifiedCredentialNameToChainEnum[eo]:void 0;return Xr==null?void 0:Xr.find(({key:ro,walletConnector:no})=>ro.startsWith("turnkey")&&(no==null?void 0:no.connectedChain)===to)},findTurnkeyWalletByPrimaryChain=(Xr,eo,to)=>{var ro;const no=((ro=eo==null?void 0:eo.find(ao=>ao.primary))===null||ro===void 0?void 0:ro.name)||ChainEnum.Evm,io=findTurnkeyWalletByChain(Xr,ChainEnumToVerifiedCredentialName[no]),oo=to==null?void 0:to.find(({walletName:ao,chain:so})=>(ao==null?void 0:ao.startsWith("turnkey"))&&so===ChainEnumToVerifiedCredentialName[no]);if(io)return Object.assign(Object.assign({},oo),io)},getUserWalletsFromVerifiedCredentials=Xr=>{var eo;return(eo=Xr.verifiedCredentials)===null||eo===void 0?void 0:eo.filter(({walletProvider:to})=>to)},addPasskeyIdentifierToWalletConnector=(Xr,eo)=>{var to;const ro=(eo==null?void 0:eo.phoneNumber)||((to=eo==null?void 0:eo.verifiedCredentials.find(no=>no.oauthDisplayName))===null||to===void 0?void 0:to.oauthDisplayName)||"";Xr.setPasskeyIdentifier(ro)},getEmbeddedWalletAuthHandler=Xr=>{if(!Xr||!("getAuthenticatorHandler"in Xr))throw new DynamicError("Invalid connector type");return Xr.getAuthenticatorHandler()},initExport=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({iframeContainer:eo,iframeElementId:to,wallet:ro}){var no;if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings",INVALID_WALLET_DATA);const io=(no=ro.connector)===null||no===void 0?void 0:no.getExportHandler();if(!(yield io.initExport(eo,to)))throw new DynamicError("Something went wrong",ERROR_PROCESSING_REVEAL_REQUEST);return io}),handleExportInitCheck=({user:Xr,wallet:eo})=>{var to,ro;if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(eo!=null&&eo.connector)||!(eo!=null&&eo.id)||!isPasskeyWalletConnector(eo==null?void 0:eo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const no=eo.connector;no.setEmail(Xr.email);const io=(ro=(to=Xr.verifiedCredentials)===null||to===void 0?void 0:to.find(({walletName:co})=>co==null?void 0:co.startsWith("turnkey")))===null||ro===void 0?void 0:ro.walletProperties,oo=io==null?void 0:io.turnkeyHDWalletId,ao=io==null?void 0:io.turnkeyPrivateKeyId,so=io==null?void 0:io.turnkeySubOrganizationId;if(!so||oo===void 0&&ao===void 0)throw new DynamicError("Invalid token!");return{connector:no,organizationId:so,privateKeyId:ao,turnkeyHDWalletId:oo}},extractExportBundle=({address:Xr,privateKeyId:eo,activity:to})=>{var ro,no,io;const oo=Xr?(ro=to.result)===null||ro===void 0?void 0:ro.exportWalletAccountResult:(no=to.result)===null||no===void 0?void 0:no.exportWalletResult,ao=eo?(io=to.result)===null||io===void 0?void 0:io.exportPrivateKeyResult:oo;return ao==null?void 0:ao.exportBundle},exportCredential=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,wallet:to,environmentId:ro,address:no}){const{connector:io,turnkeyHDWalletId:oo,privateKeyId:ao,organizationId:so}=handleExportInitCheck({user:eo,wallet:to}),co=io.getExportHandler();if(!co.publicKey)throw new DynamicError("Must initialize export first",ERROR_PROCESSING_REVEAL_REQUEST);let fo;oo?fo=yield co.exportWallet({address:no,organizationId:so,walletId:oo}):ao&&(fo=yield co.exportPrivateKey({organizationId:so,privateKeyId:ao}));const ho=fo.id,go=fo.status;let yo;if(go==="ACTIVITY_STATUS_COMPLETED")yo=extractExportBundle({activity:fo,address:no,privateKeyId:ao});else{const vo=yield exportEmbeddedWallet({activityId:ho,environmentId:ro,walletId:(to==null?void 0:to.id)||""});yo=vo==null?void 0:vo.exportBundle}if(!yo)throw new DynamicError("Invalid export response",ERROR_PROCESSING_REVEAL_REQUEST);return no||ao?co.verifyExportPrivateKey({chain:to==null?void 0:to.chain,exportBundle:yo,organizationId:so}):co.verifyExportWallet({exportBundle:yo,organizationId:so})}),cleanupExport=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({wallet:eo}){var to;const ro=eo==null?void 0:eo.connector;(to=ro==null?void 0:ro.getExportHandler())===null||to===void 0||to.clear()}),validateTurnkeyProviderEnabled=Xr=>{const eo=isTurnkeyEnabled(Xr);if(!eo)throw new DynamicError("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED);return eo},createEmbeddedWalletRequest=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,walletConnector:to,environmentId:ro,chains:no,webAuthnAttestation:io,withAuthenticator:oo}){if(!to)throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!eo)throw new DynamicError("User is not defined");to.setEmail(eo.email);let ao;if(oo||io!==void 0){eo.email||addPasskeyIdentifierToWalletConnector(to,eo);const{attestation:fo,challenge:ho,displayName:go}=io||(yield to.getWebAuthnAttestation());ao={attestation:fo,challenge:ho,passkeyAlias:go}}const so=yield createTurnkeyEmbeddedWallet(Object.assign({chains:no,environmentId:ro},ao));if(!so)throw new DynamicError("Failed to create embedded wallet");const co=to.connectedChain,lo=findEmbeddedWalletFromVerifiedCredentials(so,[co]);if(!lo)throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return to.setVerifiedCredentials(so.verifiedCredentials),{embeddedWalletVerifiedCredential:lo,updatedUser:so,walletConnector:to}}),findPasskeyEmailWalletConnector=(Xr,eo)=>Xr.map(({walletConnector:ro})=>ro).find(ro=>isPasskeyWalletConnector(ro)&&isEmailWalletConnector(ro)&&ro.connectedChain===eo),findOwner=(Xr,eo)=>eo.find(to=>to.id===Xr.signerRefId),findSmartWallet=(Xr,eo)=>eo.find(to=>to.signerRefId===Xr.id),isOwnerOfASmartWallet=(Xr,eo)=>!!findSmartWallet(Xr,eo),initializeSmartWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({account:eo,verifiedCredentials:to,walletConnectorOptions:ro,primaryWalletId:no}){var io,oo;const ao=findOwner(eo,to);if(!ao)throw new Error("could not find associated eoa account for smart wallet");const so=findWalletOptionFor(ao,ro);if(!so)throw new Error("could not find owner wallet from wallet options");if(so&&isTurnkeyWalletConnector(so.walletConnector)){const ho=(oo=(io=so.walletConnector)===null||io===void 0?void 0:io.verifiedCredentials)===null||oo===void 0?void 0:oo.reduce((go,yo)=>yo.smartWalletRefAddress&&eo.address&&eo.chain&&isSameAddress$1(yo.smartWalletRefAddress,eo.address,VerifiedCredentialNameToChainEnum[eo.chain])?[yo,...go]:[...go,yo],[]);ho&&so.walletConnector.setVerifiedCredentials(ho)}const co=findWalletOptionFor(eo,ro);if(!co)throw new Error("could not find smart wallet from wallet options");const lo=co.walletConnector;if(!isAccountAbstractionConnector(lo))throw new Error("could not initialize smart wallet");if(!ao.address||!eo.address)throw new Error("could not find owner or smart wallet address");const fo=no===ao.id||no===eo.id;yield lo.registerEoa({eoaAddress:ao.address,eoaConnector:so.walletConnector,shouldSetEoaConnector:fo,smartWalletAddress:eo.address})}),useCreateDynamicEmbeddedWalletMutation=()=>{var Xr,eo;const{setPrimaryWalletId:to,user:ro,setShowAuthFlow:no,projectSettings:io}=useInternalDynamicContext(),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(),lo=((eo=(Xr=io==null?void 0:io.sdk)===null||Xr===void 0?void 0:Xr.embeddedWallets)===null||eo===void 0?void 0:eo.chainConfigurations)||[],fo=findPrimaryEmbeddedChain(io),ho=lo.filter(yo=>yo.enabled).map(yo=>yo.name==="SOL"?EmbeddedWalletChainEnum.Sol:EmbeddedWalletChainEnum.Evm);return{createDynamicEmbeddedWalletMutation:reactExports.useCallback(yo=>__awaiter$j(void 0,[yo],void 0,function*({environmentId:vo,walletConnectorOptions:wo,withAuthenticator:Eo,options:ko,chains:Ao}){var Po,jo;if(ao(!0),!ro)throw new DynamicError(USER_NOT_LOGGED_IN);try{const{embeddedWalletVerifiedCredential:Mo,updatedUser:No,walletConnector:Do}=yield createEmbeddedWalletRequest({chains:Ao??ho,environmentId:vo,user:ro,walletConnector:findPasskeyEmailWalletConnector(wo,fo),webAuthnAttestation:ko==null?void 0:ko.webAuthnAttestation,withAuthenticator:Eo}),Fo=(Po=No.verifiedCredentials)===null||Po===void 0?void 0:Po.find(({walletName:xo})=>xo==null?void 0:xo.startsWith("turnkey")),Xo=!!(!((jo=Fo==null?void 0:Fo.walletProperties)===null||jo===void 0)&&jo.isAuthenticatorAttached),Lo=Do.createWallet({address:(yield Do.getAddress())||"",chain:Do.connectedChain,connector:Do,id:Mo.id,isAuthenticated:Xo,key:Mo.walletName||Do.key}),Bo=findSmartWallet(Mo,No.verifiedCredentials);Bo?(yield initializeSmartWallet({account:Bo,primaryWalletId:Bo.id,verifiedCredentials:No.verifiedCredentials,walletConnectorOptions:wo}),to(Bo.id)):to(Mo.id),dynamicEvents.emit("embeddedWalletCreated",Lo,Fo,No),no(!1,{performMultiWalletChecks:!1})}catch(Mo){logger$8.error("Failed to create embedded wallet",Mo),co(Mo),dynamicEvents.emit("embeddedWalletFailed",Mo)}finally{ao(!1)}}),[ho,fo,to,no,ro]),error:so,isLoading:oo}},useTurnkey=()=>{const{projectSettings:Xr,setPrimaryWalletId:eo,walletConnectorOptions:to,setShowAuthFlow:ro,environmentId:no,user:io,primaryWallet:oo}=useInternalDynamicContext(),{setView:ao}=useViewContext(),{createDynamicEmbeddedWalletMutation:so}=useCreateDynamicEmbeddedWalletMutation(),{getEOAWallet:co}=useSmartWallets(),lo=reactExports.useCallback((yo,vo)=>__awaiter$j(void 0,void 0,void 0,function*(){return new Promise((wo,Eo)=>{dynamicEvents.once("embeddedWalletCreated",ko=>{wo(ko)}),dynamicEvents.once("embeddedWalletFailed",ko=>Eo(ko)),so({chains:yo,environmentId:no,options:vo,walletConnectorOptions:to,withAuthenticator:!1}).then(()=>{ro(!1,{performMultiWalletChecks:!1})}).catch(ko=>{Eo(ko)})})}),[so,no,to,ro]),fo=reactExports.useCallback(yo=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),ao("passkey-intro",{chains:yo}),new Promise((vo,wo)=>{dynamicEvents.once("embeddedWalletCreated",Eo=>vo(Eo)),dynamicEvents.once("embeddedWalletFailed",Eo=>{if(Eo instanceof DOMException&&Eo.name==="NotAllowedError"){logger$8.error("User cancelled the passkey creation.",Eo);return}wo(Eo)})})}),[ro,ao]),ho=reactExports.useCallback(yo=>__awaiter$j(void 0,void 0,void 0,function*(){var vo,wo;const{chain:Eo}=yo,ko=findTurnkeyWalletByChain(to,Eo);let Ao=null;if(io){(vo=ko==null?void 0:ko.walletConnector)===null||vo===void 0||vo.setVerifiedCredentials(io.verifiedCredentials);const No=findSmartWallet(yo,io.verifiedCredentials);No?(yield initializeSmartWallet({account:No,primaryWalletId:No.id,verifiedCredentials:io.verifiedCredentials,walletConnectorOptions:to}),Ao=No.id):Ao=yo.id}Ao&&eo(Ao);const Po=!!(!((wo=yo.walletProperties)===null||wo===void 0)&&wo.isAuthenticatorAttached);if(!(ko!=null&&ko.walletConnector))throw new Error("Could not find the embedded wallet connector");const jo=ko.walletConnector,Mo=jo.createWallet({address:(yield jo.getAddress())||"",chain:jo.connectedChain,connector:jo,id:yo.id,isAuthenticated:Po,key:yo.walletName||jo.key||""});return Promise.resolve(Mo)}),[eo,to,io]);return{createTurnkeyWallet:reactExports.useCallback((yo,vo)=>__awaiter$j(void 0,void 0,void 0,function*(){var wo,Eo,ko,Ao,Po,jo;if(!io)throw new Error(USER_NOT_LOGGED_IN);const Mo=((wo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||wo===void 0?void 0:wo.automaticEmbeddedWalletCreation)===!1,No=((Eo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||Eo===void 0?void 0:Eo.defaultWalletVersion)===EmbeddedWalletVersionEnum.V2,Do=findPrimaryEmbeddedChain(Xr),Fo=findEmbeddedWalletFromVerifiedCredentials(io,yo??[Do]),Xo=getUserWalletsFromVerifiedCredentials(io);if(!(Xo!=null&&Xo.length)||!Fo&&Mo){const Lo=getUserVerifiedCredentialType(io,JwtVerifiedCredentialFormatEnum.Email);return!(!((ko=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||ko===void 0)&&ko.forceAuthenticatorAtSignup)&&Lo||vo!=null&&vo.webAuthnAttestation||No?lo(yo,vo):fo(yo)}else if(Fo&&io.newUser&&(!((Ao=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||Ao===void 0)&&Ao.automaticEmbeddedWalletCreation)){const Lo=findPasskeyEmailWalletConnector(to,Do);if(!Lo)throw new Error("Could not find the embedded wallet connector");const Bo=Lo.createWallet({address:(yield Lo.getAddress())||"",chain:Lo.connectedChain,connector:Lo,id:Fo.id,isAuthenticated:!!(!((Po=Fo==null?void 0:Fo.walletProperties)===null||Po===void 0)&&Po.isAuthenticatorAttached),key:(jo=Fo.walletName)!==null&&jo!==void 0?jo:Lo.key});eo(Fo.id),dynamicEvents.emit("embeddedWalletCreated",Bo,Fo,io)}if(ro(!1,{performMultiWalletChecks:!1}),!Fo)throw new Error("Primary wallet is not an embedded wallet");return ho(Fo)}),[io,Xr,oo,co,ro,ho,lo,fo,to,eo])}},isConnectorSessionKeyActive=Xr=>{var eo;return!Xr||!isSessionKeyCompatibleWalletConnector(Xr)?!1:!!(!((eo=Xr.sessionKeys)===null||eo===void 0)&&eo.publicKey)},useSecureEnclaveEmbeddedWallet=()=>{var Xr,eo,to,ro;const{projectSettings:no,primaryWallet:io,user:oo,environmentId:ao,walletConnectorOptions:so}=useInternalDynamicContext(),{createTurnkeyWallet:co}=useTurnkey(),{hasRecoveryEmail:lo}=useIsTurnkeyWallet(),{createRootElement:fo}=useElementById(),{isLoadingEmbeddedWallet:ho,setIsLoadingEmbeddedWallet:go}=useWalletContext(),{getEOAWallet:yo}=useSmartWallets(),vo=(Xr=io&&yo(io))!==null&&Xr!==void 0?Xr:io,wo=reactExports.useCallback(()=>hasEmbeddedWallet(oo,"turnkey"),[oo]),Eo=reactExports.useCallback(()=>isSessionKeyCompatibleWalletConnector(vo==null?void 0:vo.connector)?EmbeddedWalletVersion.V2:EmbeddedWalletVersion.V1,[vo==null?void 0:vo.connector]),{shouldInitRecovery:ko,initPasskeyRecoveryProcess:Ao}=usePasskeyRecovery(),Po=reactExports.useCallback((po,bo)=>__awaiter$j(void 0,void 0,void 0,function*(){var _o;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const $o=getUserWalletsFromVerifiedCredentials(oo),Co=findPrimaryEmbeddedChain(no),Ro=findEmbeddedWalletFromVerifiedCredentials(oo,po??[Co]),So=((_o=no==null?void 0:no.sdk.embeddedWallets)===null||_o===void 0?void 0:_o.automaticEmbeddedWalletCreation)===!1;if($o!=null&&$o.length&&!Ro&&!So)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");return validateTurnkeyProviderEnabled(no),go(!1),co(po,bo)}),[co,no,go,oo]),jo=reactExports.useCallback(po=>__awaiter$j(void 0,[po],void 0,function*({chain:bo}){var _o,$o,Co;if(!oo)throw new Error(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(no);const Ro=findPrimaryEmbeddedChain(no),So=findEmbeddedWalletFromVerifiedCredentials(oo,[Ro]);if(!((_o=So==null?void 0:So.walletProperties)===null||_o===void 0?void 0:_o.turnkeyHDWalletId))throw new DynamicError("No HD wallet was found for this user to derive a wallet account. Use createEmbeddedWallet first","NoHdWalletFound");const To=yield getCreateEmbeddedWalletAccountRequest({chain:bo,environmentId:ao});isSessionKeyCompatibleWalletConnector(vo==null?void 0:vo.connector)?yield($o=vo==null?void 0:vo.connector)===null||$o===void 0?void 0:$o.createOrRestoreSession({ignoreRestore:!0}):(yield ko())&&(yield Ao("email"));const Vo=yield(Co=vo==null?void 0:vo.connector)===null||Co===void 0?void 0:Co.stampCreateWalletAccountRequest({request:To});return yield createEmbeddedWalletAccount({createEmbeddedWalletAccountRequest:Vo,environmentId:ao}),refreshUserJwt({environmentId:ao})}),[ao,vo==null?void 0:vo.connector,Ao,no,ko,oo]),Mo=reactExports.useCallback(po=>__awaiter$j(void 0,void 0,void 0,function*(){var bo,_o,$o,Co,Ro,So;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const mo=io==null?void 0:io.connector;if(mo&&isSessionKeyCompatibleWalletConnector(mo))return mo.createOrRestoreSession();const To=vo==null?void 0:vo.connector;if(To&&isSessionKeyCompatibleWalletConnector(To))return To.createOrRestoreSession();const Vo=getEmbeddedWalletAuthHandler(vo==null?void 0:vo.connector);if(Vo.isSessionActive())return ACTIVE_SESSION;const Zo=fo(iframeContainerId$2);if(canRestoreEmbeddedWalletSession((bo=no==null?void 0:no.sdk.embeddedWallets)===null||bo===void 0?void 0:bo.sessionKeyDuration))try{if(yield restoreEmbeddedWalletSession({iframeContainer:Zo.current,iframeElementId:iframeElementId$2,sessionExpiration:getEmbeddedWalletSessionExpiration(($o=(_o=no==null?void 0:no.sdk)===null||_o===void 0?void 0:_o.embeddedWallets)===null||$o===void 0?void 0:$o.sessionKeyDuration),user:oo,wallet:io}))return SESSION_RESTORED}catch(Ho){logger$8.error("Failed to restore embedded wallet",Ho)}if(!(po!=null&&po.oneTimeCode))throw new DynamicError("One-time code is required to create a session.",INVALID_REQUEST$1);if(!wo()||!lo)throw new DynamicError("User does not have a secure enclave wallet or a verified email",INVALID_WALLET_DATA);const Qo=(So=(Ro=(Co=oo==null?void 0:oo.verifiedCredentials)===null||Co===void 0?void 0:Co.find(({walletName:Ho})=>Ho==null?void 0:Ho.startsWith("turnkey")))===null||Ro===void 0?void 0:Ro.walletProperties)===null||So===void 0?void 0:So.turnkeySubOrganizationId;yield Vo.verifyRecoveryCode(po.oneTimeCode,Qo);const qo={createdAt:new Date().getTime(),emailCode:po.oneTimeCode,userId:Vo.recoveryUserId};return StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,qo),SESSION_CREATED}),[fo,oo,lo,io,(to=(eo=no==null?void 0:no.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration,wo,vo==null?void 0:vo.connector]),No=reactExports.useCallback(po=>__awaiter$j(void 0,void 0,void 0,function*(){var bo,_o;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(no);const $o=findTurnkeyWalletByPrimaryChain(so,(bo=no==null?void 0:no.sdk.embeddedWallets)===null||bo===void 0?void 0:bo.chainConfigurations,oo.verifiedCredentials);if(!($o!=null&&$o.walletConnector))throw new DynamicError("Wallet connector not found",INVALID_WALLET_DATA);const Co=$o.walletConnector;Co.setEmail(oo==null?void 0:oo.email),oo&&!(oo!=null&&oo.email)&&addPasskeyIdentifierToWalletConnector(Co,oo);const Ro=getUserVerifiedCredentialType(oo,JwtVerifiedCredentialFormatEnum.Email);if(!("id"in $o)||!Ro)return Co.getWebAuthnAttestation();const So=(_o=$o==null?void 0:$o.walletProperties)===null||_o===void 0?void 0:_o.turnkeySubOrganizationId;if(!So)throw new DynamicError("No sub organization id found for the wallet",INVALID_WALLET_DATA);const mo=getEmbeddedWalletAuthHandler(Co);yield Mo(po);const{attestation:To,challenge:Vo,displayName:Zo}=yield Co.getWebAuthnAttestation();if(yield mo.addPasskeyAuthenticator({attestation:To,challenge:Vo,turnkeySubOrganizationId:So}),!(yield completePasskeyRecovery$1({attestation:To,challenge:Vo,environmentId:ao,walletId:$o==null?void 0:$o.id})))throw new DynamicError("Error completing passkey recovery");return{attestation:To,challenge:Vo,displayName:Zo}}),[Mo,ao,no,oo,so]),Do=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);return(yield getUserPasskeys({environmentId:ao})).passkeys}),[oo,ao]),Fo=reactExports.useMemo(()=>{var po;const bo=vo==null?void 0:vo.connector;return!bo||!("getAuthenticatorHandler"in bo)?!1:(po=getEmbeddedWalletAuthHandler(bo))===null||po===void 0?void 0:po.isSessionActive()},[vo==null?void 0:vo.connector]),Xo=reactExports.useMemo(()=>isConnectorSessionKeyActive(vo==null?void 0:vo.connector),[vo==null?void 0:vo.connector]),Lo=reactExports.useMemo(()=>isConnectorSessionKeyActive(io==null?void 0:io.connector),[io==null?void 0:io.connector]),Bo=Fo||Lo||Xo,xo=reactExports.useCallback(po=>__awaiter$j(void 0,[po],void 0,function*({type:bo,htmlContainerId:_o}){var $o,Co,Ro,So,mo,To;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);yield cleanupExport({wallet:vo});const Vo=findTurnkeyWalletByPrimaryChain(so,($o=no==null?void 0:no.sdk.embeddedWallets)===null||$o===void 0?void 0:$o.chainConfigurations,oo==null?void 0:oo.verifiedCredentials),Zo=(Co=Vo==null?void 0:Vo.walletProperties)===null||Co===void 0?void 0:Co.turnkeyHDWalletId;bo==="recoveryPhrase"&&!Zo&&(bo="privateKey");const Qo=fo(revealIframeElementId,_o||revealIframeContainerId);Qo.current.style.display="none",isSessionKeyCompatibleWalletConnector(vo==null?void 0:vo.connector)&&(yield(Ro=vo==null?void 0:vo.connector)===null||Ro===void 0?void 0:Ro.createOrRestoreSession()),yield initExport({iframeContainer:Qo.current,iframeElementId:revealIframeElementId,wallet:vo});try{yield exportCredential({address:bo==="privateKey"?vo==null?void 0:vo.address:void 0,environmentId:ao,user:oo,wallet:vo})}catch{isSessionKeyCompatibleWalletConnector(vo==null?void 0:vo.connector)&&(!((So=vo==null?void 0:vo.connector)===null||So===void 0)&&So.removeSessionKeys)&&(yield(mo=vo==null?void 0:vo.connector)===null||mo===void 0?void 0:mo.removeSessionKeys(),yield(To=vo==null?void 0:vo.connector)===null||To===void 0?void 0:To.createOrRestoreSession({ignoreRestore:!0})),yield exportCredential({address:bo==="privateKey"?vo==null?void 0:vo.address:void 0,environmentId:ao,user:oo,wallet:vo})}return Qo.current.style.display="block",!0}),[fo,ao,vo,(ro=no==null?void 0:no.sdk.embeddedWallets)===null||ro===void 0?void 0:ro.chainConfigurations,oo,so]),uo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){var po,bo;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const _o=findTurnkeyWalletByPrimaryChain(so,(po=no==null?void 0:no.sdk.embeddedWallets)===null||po===void 0?void 0:po.chainConfigurations,oo.verifiedCredentials);if(!_o||!("id"in _o))throw new DynamicError("User does not have a valid secure enclave wallet",INVALID_WALLET_DATA);const $o=getEmbeddedWalletAuthHandler(_o==null?void 0:_o.walletConnector),Co=_o.id;if($o.isSessionActive())throw new DynamicError("Session is active. No need to create a new one",ACTIVE_SESSION);const So=fo(iframeContainerId$2),mo=yield $o.initRecovery("email",So.current,iframeElementId$2,getEmbeddedWalletSessionExpiration((bo=no==null?void 0:no.sdk.embeddedWallets)===null||bo===void 0?void 0:bo.sessionKeyDuration));if(!mo)throw new DynamicError(ERROR_SENDING_CODE);const To=yield initEmbeddedWalletSession$1({authenticatorType:"email",environmentId:ao,publicKey:mo,walletId:Co});return $o.recoveryUserId=To.turnkeyUserId,CODE_SENT}),[fo,oo,ao,no,so]);return reactExports.useMemo(()=>({createEmbeddedWallet:Po,createEmbeddedWalletAccount:jo,createOrRestoreSession:Mo,createPasskey:No,getPasskeys:Do,getWalletVersion:Eo,isLoadingEmbeddedWallet:ho,isSessionActive:Bo,revealEmbeddedWalletKey:xo,sendOneTimeCode:uo,userHasEmbeddedWallet:wo}),[Po,jo,Mo,No,Do,Eo,ho,Bo,xo,uo,wo])},findCoinbaseMPCWallet=Xr=>Xr==null?void 0:Xr.find(({key:eo})=>eo==="coinbasempc"),requiresPasswordForEmbeddedWallet=Xr=>{var eo,to;const ro=(to=(eo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||eo===void 0?void 0:eo.supportedSecurityMethods)===null||to===void 0?void 0:to.password;return ro?ro.isEnabled&&ro.isDefault:!1},requiresPasswordForEmbeddedWalletOnSignup=Xr=>{const eo=Xr==null?void 0:Xr.sdk.embeddedWallets;return eo?requiresPasswordForEmbeddedWallet(Xr)&&!!eo.forceAuthenticatorAtSignup:!1},validateMPCProviderEnabled=Xr=>{if(!Xr)throw new Error("Project settings are missing");if(!isCoinbaseWaasEnabled(Xr))throw new Error("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.")},useEmbeddedWalletPassword=()=>{const{primaryWallet:Xr,setShowAuthFlow:eo,environmentId:to}=useInternalDynamicContext(),{setView:ro}=useViewContext(),no=reactExports.useCallback((oo,ao)=>__awaiter$j(void 0,void 0,void 0,function*(){return eo(!0,{ignoreIfIsEmbeddedWidget:!1}),oo?ro("wallet-claim-intro"):ro("create-password-view",{isSignUp:ao,notCalledFromWalletUtils:!0}),new Promise((so,co)=>{dynamicEvents.once("embeddedWalletCreatePasswordCompleted",lo=>so(lo)),dynamicEvents.once("embeddedWalletCreatePasswordFailed",lo=>co(lo))})}),[eo,ro]);return{claimWallet:reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!Xr)throw new Error("No primary wallet");if("code"in(yield claimEmbeddedWallet({environmentId:to,walletId:Xr.id}))){logger$8.error("Error updating jwt after claiming wallet");return}}catch(oo){throw logger$8.error("Error claiming wallet",oo),new Error("Error claiming wallet")}}),[to,Xr]),createPassword:no}},generateRandomPassword=(Xr=20)=>{const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";let to="";for(let ro=0;ro({fetchAuthToken:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getWalletAuthToken({environmentId:Xr,type:EmbeddedWalletAuthType.Mpc}))||""}),fetchBackupCode:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletBackup({environmentId:Xr}))||""}),fetchPasscode:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletPasscode({environmentId:Xr}))||""})}),DYNAMIC_PASSWORD_LENGTH=20,useCoinbaseMPC=()=>{const{user:Xr,setPrimaryWalletId:eo,walletConnectorOptions:to,environmentId:ro,consumeNonce:no,displaySiweStatement:io,appName:oo,siweStatement:ao,handleLogOut:so,setShowAuthFlow:co}=useInternalDynamicContext(),{setError:lo}=useErrorContext(),fo=reactExports.useCallback((vo,wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){var ko;return wo.setVerifiedCredentials(vo.verifiedCredentials),eo(Eo.id),wo.createWallet({address:(yield wo==null?void 0:wo.getAddress())||"",chain:wo.connectedChain,connector:wo,id:Eo.id,isAuthenticated:!0,key:(ko=Eo.walletName)!==null&&ko!==void 0?ko:wo.key})}),[eo]),ho=reactExports.useCallback(vo=>__awaiter$j(void 0,[vo],void 0,function*({connector:wo,backupCode:Eo,password:ko,source:Ao}){const Po=no();if(Po===void 0)throw new DynamicError("Missing nonce");const jo=yield wo.getAddress();if(!jo)throw new DynamicError("Missing address");const Mo=yield getVerifyArgs({displaySiweStatement:io,environmentId:ro,nonce:Po,publicWalletAddress:jo,siweStatement:getSiweStatement({appName:oo,siweStatement:ao}),walletConnector:wo,walletProvider:"embeddedWallet"}),No=Ao===PasswordSourceTypeEnum.Dynamic?{password:ko,passwordSource:Ao}:{},Do=yield linkWallet(ro,Object.assign(Object.assign(Object.assign({},No),Mo),{backup:Eo}));if(!Do)throw new DynamicError("Unable to link wallet");const Fo=createUserProfileFromSdkUser(Do.user),Xo=Fo.verifiedCredentials.find(Lo=>Lo.id===Fo.lastVerifiedCredentialId&&Lo.format==="blockchain");if(!Xo)throw new DynamicError("No primary wallet found");return eo(Xo.id),wo.setVerifiedCredentials(Fo.verifiedCredentials),{newSelectedCredentialWallet:Xo,updatedUser:Fo}}),[oo,no,io,ro,eo,ao]),go=reactExports.useCallback((vo,wo)=>__awaiter$j(void 0,void 0,void 0,function*(){var Eo;const ko=wo||generateRandomPassword(DYNAMIC_PASSWORD_LENGTH),Ao=wo?PasswordSourceTypeEnum.User:PasswordSourceTypeEnum.Dynamic;try{const Po=yield vo.generateWallet(Ao,ko),{updatedUser:jo,newSelectedCredentialWallet:Mo}=yield ho({backupCode:Po,connector:vo,password:ko,source:Ao}),No=vo.createWallet({address:(yield vo==null?void 0:vo.getAddress())||"",chain:vo==null?void 0:vo.connectedChain,connector:vo,id:Mo.id,isAuthenticated:!0,key:(Eo=Mo.walletName)!==null&&Eo!==void 0?Eo:vo.key});return dynamicEvents.emit("embeddedWalletCreated",No,Mo,jo),No}catch(Po){logger$8.error(Po),Po instanceof DynamicError&&Po.code==="create_embedded_wallet_error"&&(yield so(),lo(Po.message))}}),[ho,so,lo]);return{createCoinbaseMPCWallet:reactExports.useCallback((...vo)=>__awaiter$j(void 0,[...vo],void 0,function*(wo=[EmbeddedWalletChainEnum.Evm],Eo){var ko;if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);const Ao=(ko=findCoinbaseMPCWallet(to))===null||ko===void 0?void 0:ko.walletConnector;if(!Ao||!isCoinbaseMpcWalletConnector(Ao)){const Mo=new DynamicError("CoinbaseWaaSWalletConnectors not found");throw logger$8.error("Failed to create embedded wallet",Mo),dynamicEvents.emit("embeddedWalletFailed",Mo),lo(Mo.message),Mo}co(!1);const{fetchAuthToken:Po}=getCoinbaseMPCConnectorFetchers({environmentId:ro});Po&&Ao.setAuthTokenFetcher(Po);const jo=findEmbeddedWalletFromVerifiedCredentials(Xr,wo);return jo?fo(Xr,Ao,jo):go(Ao,Eo)}),[Xr,to,co,ro,go,lo,fo])}},useMPCEmbeddedWallet=()=>{const{projectSettings:Xr,walletConnectorOptions:eo,user:to}=useInternalDynamicContext(),{createPassword:ro}=useEmbeddedWalletPassword(),{createCoinbaseMPCWallet:no}=useCoinbaseMPC(),{isLoadingEmbeddedWallet:io,setIsLoadingEmbeddedWallet:oo}=useWalletContext(),ao=()=>hasEmbeddedWallet(to,"coinbase"),so=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(go)}),[ro]),co=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){var yo,vo,wo;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);const Eo=getUserWalletsFromVerifiedCredentials(to),ko=findEmbeddedWalletFromVerifiedCredentials(to,go),Ao=((yo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||yo===void 0?void 0:yo.automaticEmbeddedWalletCreation)===!1;if(Eo!=null&&Eo.length&&!ko&&!Ao)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");validateMPCProviderEnabled(Xr);const Po=(vo=findCoinbaseMPCWallet(eo))===null||vo===void 0?void 0:vo.walletConnector;if(!isCoinbaseMpcWalletConnector(Po))throw new Error("Coinbase MPC wallet connector not found");Po.setRequiredPassword((wo=requiresPasswordForEmbeddedWallet(Xr))!==null&&wo!==void 0?wo:!1)}),[to,Xr,eo]),lo=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){try{return yield co(go),!0}catch{return!1}}),[co]),fo=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);yield co(go),oo(!0);let yo;!findEmbeddedWalletFromVerifiedCredentials(to,go)&&requiresPasswordForEmbeddedWalletOnSignup(Xr)&&(yo=yield ro(!1,!0));const wo=yield no(go,yo);return oo(!1),wo}),[to,no,ro,co,Xr,oo]);return{canCreateMPCWallet:lo,createEmbeddedWallet:fo,createPassword:so,isLoadingEmbeddedWallet:io,revealEmbeddedWalletKey:()=>__awaiter$j(void 0,void 0,void 0,function*(){throw new DynamicError("Coinbase MPC wallet does not support headless reveal yet")}),userHasEmbeddedWallet:ao}},useEmbeddedWallet=()=>{const{user:Xr,projectSettings:eo,setPrimaryWalletId:to}=useInternalDynamicContext(),{isTurnkeyWallet:ro}=useIsTurnkeyWallet(),{createEmbeddedWallet:no,canCreateMPCWallet:io,createPassword:oo,revealEmbeddedWalletKey:ao}=useMPCEmbeddedWallet(),{createEmbeddedWallet:so,createEmbeddedWalletAccount:co,createOrRestoreSession:lo,createPasskey:fo,revealEmbeddedWalletKey:ho,getPasskeys:go,isSessionActive:yo,sendOneTimeCode:vo,getWalletVersion:wo}=useSecureEnclaveEmbeddedWallet(),{isLoadingEmbeddedWallet:Eo}=useWalletContext(),ko=reactExports.useCallback(()=>hasEmbeddedWallet(Xr),[Xr]),Ao=reactExports.useCallback(()=>{if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!ko())throw new DynamicError("Embedded wallet not found");if(ro)return wo()},[wo,ro,Xr,ko]),Po=reactExports.useCallback((No,Do)=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield io(No))?yield no(No):yield so(No,Do)}),[io,no,so]),jo=No=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!ko())throw new DynamicError("Embedded wallet not found");return ro?ho(No):ao()}),Mo=reactExports.useCallback(No=>{var Do,Fo,Xo,Lo,Bo;const xo=isTurnkeyEnabled(eo)||isCoinbaseWaasEnabled(eo),uo=StorageService.getItem(PRIMARY_WALLET_ID);if(!xo||uo)return!1;if(No){const po=findPrimaryEmbeddedChain(eo),bo=(Do=findEmbeddedWalletFromVerifiedCredentials(No,[po]))===null||Do===void 0?void 0:Do.id,_o=(Xo=(Fo=No.verifiedCredentials)===null||Fo===void 0?void 0:Fo.find(Co=>Co.walletProvider===WalletProviderEnum.SmartContractWallet))===null||Xo===void 0?void 0:Xo.id,$o=_o||bo;if($o)return to($o),!1}return!(!isCoinbaseWaasEnabled(eo)&&isTurnkeyEnabled(eo)&&!(!((Bo=(Lo=eo==null?void 0:eo.sdk)===null||Lo===void 0?void 0:Lo.embeddedWallets)===null||Bo===void 0)&&Bo.automaticEmbeddedWalletCreation))},[eo,to]);return{createEmbeddedWallet:Po,createEmbeddedWalletAccount:co,createOrRestoreSession:lo,createPasskey:fo,createPassword:oo,getPasskeys:go,getWalletVersion:Ao,isLoadingEmbeddedWallet:Eo,isSessionActive:yo,revealWalletKey:jo,sendOneTimeCode:vo,shouldAutoCreateEmbeddedWallet:Mo,userHasEmbeddedWallet:ko}},useHandleAuthenticatedUser=()=>{const{handlers:Xr}=useInternalDynamicContext(),{handleAuthenticatedUser:eo}=Xr??{},to=reactExports.useRef(eo);return to.current=eo,reactExports.useCallback(ro=>__awaiter$j(void 0,void 0,void 0,function*(){to.current&&(yield runSafe(()=>{var no;return(no=to.current)===null||no===void 0?void 0:no.call(to,{user:ro})}))}),[])},sleepToShowSuccessMessage=()=>sleep$1(1500),useUserAuth=({authMethod:Xr})=>{const{handleLogOut:eo,setShowAuthFlow:to,setCallback:ro,setMultiWalletWidgetState:no,walletConnectorOptions:io}=useInternalDynamicContext(),{setDeniedOauthUsername:oo,setDeniedOauthProvider:ao}=useAccessDeniedContext(),{view:so,setView:co,goToInitialView:lo}=useViewContext(),{setLoading:fo}=useLoadingContext(),{setErrorMessage:ho,setError:go}=useErrorContext(),{setExistentAccountData:yo}=useAccountExistsContext(),vo=useHandleAuthenticatedUser(),{shouldAutoCreateEmbeddedWallet:wo}=useEmbeddedWallet(),Eo=No=>No.user,ko=No=>__awaiter$j(void 0,[No],void 0,function*({isSignIn:Do=!0,verifyFunction:Fo,onVerifySuccess:Xo,onSettled:Lo,onError:Bo,showSuccessMessage:xo=!1,skipDefaultErrorHandling:uo=!1}){var po;logger$8.debug("initAuth",{authMethod:Xr,isSignIn:Do});try{const bo=yield Fo();if(!bo)throw yield Mo(),new DynamicError("No user returned from verify function");let _o;if(Eo(bo)?_o=storeAuthTokenAndUser(bo):_o=bo,Xo==null||Xo(_o),io.forEach(Co=>{Co.walletConnector.setVerifiedCredentials(_o.verifiedCredentials)}),hasPendingMfaAction(_o)||Do&&(!((po=_o.missingFields)===null||po===void 0)&&po.length))return;no("idle"),yield vo(_o);const $o=wo(_o);xo&&(yield sleepToShowSuccessMessage()),Do&&ro("authSuccess"),$o||to(!1),Lo==null||Lo()}catch(bo){if(logger$8.debug(bo),uo){Bo==null||Bo(bo);return}Ao(bo,{onError:Bo})}finally{fo(!1),Lo==null||Lo()}}),Ao=(No,{options:Do={},onError:Fo})=>{var Xo;if(No instanceof MfaInvalidOtpError||No instanceof MfaRateLimitedError||No instanceof EmailAlreadyExistsError||No instanceof CustomFieldNotUniqueError||No instanceof UsernameAlreadyExistsError||No instanceof TooManyEmailVerificationsError||No instanceof InvalidPhoneNumberError)throw No;if(No instanceof NoAccessError){ao(No==null?void 0:No.socialProvider),oo((Xo=No==null?void 0:No.socialUsername)!==null&&Xo!==void 0?Xo:""),co("no-access");return}if(No instanceof AccountExistsError){yo(No.errorPayload),co("account-exists");return}if(No instanceof SandboxMaximumThresholdReachedError){co("sandbox-maximum-threshold-reached");return}if(No instanceof UserHasAccountWithEmailError){co("merge-user-accounts-with-same-email",{returnToView:"isEmailRecoveryFlow"in Do&&Do.isEmailRecoveryFlow?"passkey-recovery-add-email":void 0});return}if(Fo){Fo==null||Fo(No);return}No.code?ho(No.code):go(No.message)},Po=No=>__awaiter$j(void 0,[No],void 0,function*({missingFields:Do,isEmailVerificationRequired:Fo,isSmsVerificationRequired:Xo}){if(Fo&&Do.find(Lo=>Lo.name==="email")){co("verify-email");return}if(Xo&&Do.find(Lo=>Lo.name==="phoneNumber")){co("verify-sms");return}co(so.type)}),jo=No=>__awaiter$j(void 0,[No],void 0,function*({completeSignInFlow:Do,updateJwtFunction:Fo,onValidUpdatedJwt:Xo,options:Lo={}}){logger$8.debug("completeAuth",{authMethod:Xr});try{const{updateUserProfileResponse:Bo,isSmsVerificationRequired:xo,isEmailVerificationRequired:uo,missingFields:po}=yield Fo();Xo==null||Xo();const bo=storeAuthTokenAndUser({expiresAt:Bo.expiresAt,jwt:Bo.jwt,minifiedJwt:Bo.minifiedJwt,user:Bo.user});if(po.length>0){yield Po({isEmailVerificationRequired:uo,isSmsVerificationRequired:xo,missingFields:po});return}if(yield vo(bo),ro("authSuccess"),Do&&(yield Do(Bo)))return;!wo()&&bo.mfaBackupCodeAcknowledgement!==MfaBackupCodeAcknowledgement.Pending&&to(!1)}catch(Bo){logger$8.debug(Bo),Ao(Bo,{options:Lo})}finally{fo(!1)}}),Mo=()=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("cancelAuth",{authMethod:Xr}),yield eo(),lo()});return{cancelAuth:Mo,completeAuth:jo,handleAuthError:Ao,initAuth:ko}},SECURE_ENCLAVE_WALLET_SESSION_KEYS="dynamic_secure_enclave_session_keys",SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS={priority:["secureStorage","localStorage"]},buf2hex$1=Xr=>[...new Uint8Array(Xr)].map(eo=>eo.toString(16).padStart(2,"0")).join(""),base64urlDecode=Xr=>(Xr=(Xr==null?void 0:Xr.replace(/-/g,"+").replace(/_/g,"/"))||"",Uint8Array.from(atob(Xr),eo=>eo.charCodeAt(0))),compressRawPublicKey=Xr=>{const eo=new Uint8Array(Xr),to=eo.byteLength,ro=eo.slice(0,1+to>>>1);return ro[0]=2|eo[to-1]&1,ro.buffer},p256Keygen=()=>__awaiter$j(void 0,void 0,void 0,function*(){const Xr=yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),eo=yield crypto.subtle.exportKey("raw",Xr.publicKey),to=yield crypto.subtle.exportKey("jwk",Xr.privateKey),ro=compressRawPublicKey(eo),no=base64urlDecode(to.d);return{private:buf2hex$1(no),public:buf2hex$1(ro),public_uncompressed:buf2hex$1(eo)}}),useEmbeddedWalletSessionKeys=Xr=>{const eo=(...io)=>__awaiter$j(void 0,[...io],void 0,function*({ignoreRestore:oo=!1}={}){const ao=StorageService.getItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);if(ao&&!oo)return JSON.parse(Buffer$3.from(ao,"base64").toString());const{publicKey:so,privateKey:co}=yield to();return yield registerSessionKey({environmentId:Xr,publicKey:so}),{privateKey:co,publicKey:so}}),to=()=>__awaiter$j(void 0,void 0,void 0,function*(){const{private:io,public:oo}=yield p256Keygen(),so=JSON.stringify({privateKey:io,publicKey:oo}),co=Buffer$3.from(so).toString("base64");return StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,co,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),{privateKey:io,publicKey:oo}}),ro=reactExports.useCallback(()=>StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),[]);return{generateSessionKey:to,registerEmbeddedWalletSessionKey:eo,removeSessionKey:ro,shouldRegisterSessionKeysOnSignin:()=>!1}},useVerifyWallet=({consumeNonce:Xr,displaySiweStatement:eo,environmentId:to,projectSettings:ro,setIsSingleWalletAccount:no})=>{const{setExistentAccountData:io}=useAccountExistsContext(),{setDeniedAddress:oo,setDeniedOauthProvider:ao}=useAccessDeniedContext(),{setView:so,goToInitialView:co}=useViewContext(),{setErrorMessage:lo,setError:fo}=useErrorContext(),{multiWalletWidgetState:ho,debugError:go,multiWallet:yo,appName:vo,primaryWalletId:wo,setShowAuthFlow:Eo,setPrimaryWalletId:ko,siweStatement:Ao,connectedWallets:Po,authMode:jo,user:Mo,setAuthMode:No,removeConnectedWalletsInfo:Do,events:Fo,primaryWallet:Xo,enableConnectOnlyFallback:Lo,selectedWalletConnector:Bo}=useInternalDynamicContext(),{addedWalletsIds:xo}=useInternalUserWallets(),{initAuth:uo}=useUserAuth({authMethod:"wallet"}),{generateSessionKey:po,shouldRegisterSessionKeysOnSignin:bo}=useEmbeddedWalletSessionKeys(to),_o=!Mo,$o=Lo&&(_o||!yo),Co=(Vo,Zo,Qo,qo,Ho,$a,zo,Ko)=>__awaiter$j(void 0,void 0,void 0,function*(){const _c=Xr();if(_c===void 0)throw new DynamicError("Missing nonce");const Cl=yield getVerifyArgs({displaySiweStatement:eo,environmentId:to,getAddressOpts:Qo,messageToSignOverride:Ko,nonce:_c,publicWalletAddress:qo,signedMessageOverride:zo,siweStatement:getSiweStatement({appName:vo,siweStatement:Ao}),walletConnector:Vo,walletProvider:Zo});if(bo()){const El=yield po();Cl.sessionPublicKey=El.publicKey}let ga;return!Mo||!yo?ga=verifyWallet(to,Object.assign(Object.assign({},Cl),{captchaToken:Ho,oauth:$a})):ga=linkWallet(to,Cl),{verifyArgs:Cl,verifyFunction:()=>ga}}),Ro=({walletConnector:Vo,verifiedCredentials:Zo,lastVerifiedCredentialId:Qo})=>{const qo=Zo.find(Ho=>Ho.id===Qo&&Ho.format==="blockchain");if(qo){const Ho=Zo.find($a=>$a.id===wo);(_o||!Xo||ho==="awaiting_signature"&&qo.walletName===(Ho==null?void 0:Ho.walletName)||(Ho==null?void 0:Ho.chain)==="flow"&&Vo.connectedChain==="FLOW")&&ko(qo.id)}},So=Vo=>{var Zo;Eo(!0),so("wallet-used"),no(!1),Vo.code==="reassign_wallet_error"&&(!((Zo=ro==null?void 0:ro.sdk)===null||Zo===void 0)&&Zo.preventOrphanedAccounts&&so("wallet-cannot-be-transferred"),no(!0))},mo=({walletConnector:Vo,endSession:Zo=!0})=>{Do(),Zo&&(Vo==null||Vo.endSession())},To=(Vo,Zo,Qo,qo)=>{var Ho;if(Vo.message==="ignore")return;if(Bo&&Bo.key===Zo.key&&dynamicEvents.emit("authFailure",{address:Qo,connectorName:Zo.name,option:Zo.name,type:"wallet"},{error:Vo}),Vo instanceof WalletUsedError)return mo({endSession:!1,walletConnector:Zo}),So(Vo);if(Vo instanceof MergeAccountsConfirmationError){so("merge-user-accounts",Object.assign({},Vo)),Eo(!0);return}if(Vo instanceof ChainalysisError){mo({walletConnector:Zo}),oo(Qo),so("chainalysis-blocked-wallet");return}if(Vo instanceof GateBlockedError){mo({walletConnector:Zo}),oo(Qo),so("gate-blocked-wallet");return}if(Vo instanceof SandboxMaximumThresholdReachedError){so("sandbox-maximum-threshold-reached");return}if(Vo instanceof NoAccessError){mo({walletConnector:Zo}),oo(Qo),isSocialWalletConnector(Zo)&&ao(qo==null?void 0:qo.provider),so("no-access");return}if(Vo instanceof AccountExistsError){mo({walletConnector:Zo}),io(Vo.errorPayload),so("account-exists");return}if(Po.length&&jo==="connect-only")throw new DynamicError(Vo.message);const $a=(Ho=Vo==null?void 0:Vo.message)===null||Ho===void 0?void 0:Ho.includes("User rejected the request");if($o&&!$a){logger$8.warn("Verification failed, changing to connect-only"),No("connect-only"),so("wallet-list");return}else mo({walletConnector:Zo}),co();logger$8.error(Vo),go?fo(`${Vo.message} - ${Vo.stack}`):lo(Vo.code)};return Vo=>__awaiter$j(void 0,[Vo],void 0,function*({walletConnector:Zo,getAddressOpts:Qo,publicWalletAddress:qo,captchaToken:Ho,oauth:$a,signedMessageOverride:zo,messageToSignOverride:Ko}){const _c=getWalletProvider(Zo);dynamicEvents.emit("authInit",{address:qo,connectorName:Zo.name,option:Zo.name,type:"wallet"});try{const{verifyFunction:Cl,verifyArgs:ga}=yield Co(Zo,_c,Qo,qo,Ho,$a,zo,Ko);yield uo({isSignIn:_o,onError:El=>{To(El,Zo,qo,$a)},onVerifySuccess:El=>{var Al;if(!El)throw new DynamicError(USER_NOT_LOGGED_IN);try{(Al=Fo==null?void 0:Fo.onSignedMessage)===null||Al===void 0||Al.call(Fo,{messageToSign:ga.messageToSign,signedMessage:ga.signedMessage})}catch{logger$8.warn("Error calling onSignedMessage callback")}StorageService.setItem(LAST_USED_WALLET,Zo.key),No("connect-and-sign"),Ro({lastVerifiedCredentialId:El.lastVerifiedCredentialId,verifiedCredentials:El.verifiedCredentials,walletConnector:Zo});const Ol=El.lastVerifiedCredentialId;Ol&&xo.current.push(Ol)},options:{address:qo,connectorName:Zo.name},skipDefaultErrorHandling:!0,verifyFunction:Cl})}catch(Cl){To(Cl,Zo,qo,$a)}})},useEffectOnceCondition=(Xr,eo)=>{const to=reactExports.useRef(!1),ro=reactExports.useRef(Xr);ro.current=Xr,reactExports.useEffect(()=>{eo&&!to.current&&(ro.current(),to.current=!0)},[eo])},SOCIAL_STORAGE_KEY="dynamic_social_storage",searchSocialStorageByState=Xr=>{var eo;const to=StorageService.getItem(SOCIAL_STORAGE_KEY);if(!to)return;const ro=Object.entries(to),[no]=(eo=ro.find(([,{state:io}])=>io===Xr))!==null&&eo!==void 0?eo:[];if(no)return to[no]},setSocialStorageFor=(Xr,eo)=>{var to;const ro=(to=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&to!==void 0?to:{};ro[Xr]=Object.assign({provider:Xr},eo),StorageService.setItem(SOCIAL_STORAGE_KEY,ro)},deleteSocialStorage=Xr=>{var eo;const to=(eo=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&eo!==void 0?eo:{};delete to[Xr],StorageService.setItem(SOCIAL_STORAGE_KEY,to)},getSocialSignInProviderForProviderEnum=Xr=>{if(!Xr)return;const eo=Object.values(SocialSignInProviderEnum);for(const to of eo)if(to===Xr)return to},digestSHA256=Xr=>{const to=new TextEncoder().encode(Xr);return window.crypto.subtle.digest("SHA-256",to)},encodeBase64URL=Xr=>{const eo=[];return new Uint8Array(Xr).forEach(to=>eo.push(to)),btoa(String.fromCharCode.apply(null,eo)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},stringifyURIQuery=Xr=>{const eo=[];for(const to in Xr)eo.push(encodeURIComponent(to)+"="+encodeURIComponent(Xr[to]));return eo.join("&")},getProviderByType=(Xr,eo)=>Xr.find(to=>to.provider===eo),APPLE_LOGIN_DATA={customMobileUrl:!0,response_mode:"form_post",response_type:["code","id_token"]},getMobileOauthUrl=(Xr,eo)=>{if(!(!(eo!=null&&eo.customMobileUrl)||!isMobile$1()||!Xr.redirectUrl))return Xr.redirectUrl.replace("redirect","authorizeHtml")},getOauthLoginUrl=(Xr,eo)=>{var to,ro;const no=getProviderByType(Xr,eo);if(!(no!=null&&no.clientId))return"";let io;eo===ProviderEnum.Apple&&(io=APPLE_LOGIN_DATA);let oo;if(eo===ProviderEnum.Telegram)oo=(to=no.authorizationUrl)!==null&&to!==void 0?to:"";else if(no.baseAuthUrl)oo=no.baseAuthUrl;else return"";const ao=getMobileOauthUrl(no,io),so={client_id:no.clientId,redirect_uri:(ro=no.redirectUrl)!==null&&ro!==void 0?ro:"",response_type:"code"};no.scopes&&(so.scope=no.scopes),io!=null&&io.prompt&&(so.prompt=io.prompt.join(" ")),io!=null&&io.response_mode&&(so.response_mode=io.response_mode),io!=null&&io.response_type&&(so.response_type=io.response_type.join(" "));const co=stringifyURIQuery(so);return`${ao??oo}?${co}`},randomString=Xr=>{const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";let to="";for(let ro=Xr;ro>0;--ro)to+=eo[Math.floor(Math.random()*eo.length)];return to},initAuth=(Xr,eo,to)=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield sdkApi$1().initAuth({environmentId:Xr,oauthInitAuthRequest:to,providerType:eo})}catch(ro){logger$8.error(ro)}}),verifyOAuth=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{code:io,codeVerifier:oo,state:ao}){const so={code:io,codeVerifier:oo,state:ao};try{const co=yield sdkApi$1().oauthVerify({environmentId:ro,oauthRequest:so,providerType:no});return storeAuthTokenAndUser(co)}catch(co){return handleVerifyError(co)}}),signInOAuth=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{code:io,codeVerifier:oo,state:ao,captchaToken:so,sessionPublicKey:co}){const lo={captchaToken:so,code:io,codeVerifier:oo,sessionPublicKey:co,state:ao};try{const fo=yield sdkApi$1().oauthSignIn({environmentId:ro,oauthRequest:lo,providerType:no});return storeAuthTokenAndUser(fo)}catch(fo){return handleSignInError(fo)}}),getOAuthResult=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{state:io}){const oo={state:io};try{return yield sdkApi$1().oauthResult({environmentId:ro,oauthResultRequest:oo,providerType:no})}catch(ao){logger$8.error(ao);return}}),farcasterSignIn=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().farcasterSignIn({environmentId:Xr,farcasterSignInRequest:eo});return storeAuthTokenAndUser(to)}catch(to){return handleSignInError(to)}}),farcasterVerify=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield sdkApi$1().farcasterVerify(Xr);return storeAuthTokenAndUser(eo)}catch(eo){return handleVerifyError(eo)}}),telegramSignIn=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{const ro=yield sdkApi$1().telegramSignIn(to);return storeAuthTokenAndUser(ro)}catch(ro){return handleSignInError(ro)}}),isUserLinkedWithTelegram=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{return yield sdkApi$1().telegramCheckAuth(to),!0}catch{return!1}}),telegramVerify=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{const ro=yield sdkApi$1().telegramVerify(to);return storeAuthTokenAndUser(ro)}catch(ro){return handleVerifyError(ro)}}),handleVerifyError=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.error(Xr);const eo=yield Xr.json();if(eo.code==="social_account_already_exists")throw new SocialAccountAlreadyExistsError;if(eo.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(eo.error.message)}),handleSignInError=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){var eo,to,ro;logger$8.error(Xr);const no=yield Xr.json();if(no.error.code==="gate_blocked")throw new GateBlockedError(no.payload.walletPublicKey);if(no.error.code==="missing_from_list")throw new NoAccessError({socialProvider:(eo=no==null?void 0:no.payload)===null||eo===void 0?void 0:eo.socialProvider,socialUsername:(to=no==null?void 0:no.payload)===null||to===void 0?void 0:to.socialUsername,walletPublicKey:(ro=no==null?void 0:no.payload)===null||ro===void 0?void 0:ro.walletPublicKey});if(no.code==="email_associated_with_different_provider")throw new AccountExistsError(no.error,no.payload);if(no.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(no.error.message)}),CONNECT_URL="https://relay.farcaster.xyz/v1/channel",STATUS_URL="https://relay.farcaster.xyz/v1/channel/status",STATUS_TIMEOUT=3e5,STATUS_INTERVAL=1e3,connect=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield FetchService.fetch(CONNECT_URL,{body:JSON.stringify(Xr),headers:{"Content-Type":"application/json"},method:"POST"});if(!eo.ok)throw new Error(`HTTP error! status: ${eo.status}`);return yield eo.json()}catch(eo){logger$8.error("Error connecting with farcaster:",eo);return}}),status=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield FetchService.fetch(STATUS_URL,{headers:{Authorization:`Bearer ${Xr.channelToken}`,"Content-Type":"application/json"},method:"GET"});if(!eo.ok)throw new Error(`HTTP error! status: ${eo.status}`);return yield eo.json()}catch(eo){logger$8.error("Error fetching farcaster connect status:",eo);return}}),watchStatus=(Xr,...eo)=>__awaiter$j(void 0,[Xr,...eo],void 0,function*(to,{timeout:ro=STATUS_TIMEOUT,interval:no=STATUS_INTERVAL}={}){const io=Date.now()+ro;let oo=!0,ao;dynamicEvents.on("farcasterConnectCancelled",()=>{oo=!1,ao==null||ao(),ao=void 0});const so=co=>{ao=co,setTimeout(co,no)};for(;oo&&Date.now(){const{environmentId:no,setShowAuthFlow:io,socialSettings:oo,projectSettings:ao,consumeNonce:so,redirectUrl:co}=useInternalDynamicContext(),lo=reactExports.useMemo(()=>(oo==null?void 0:oo.strategy)||"redirect",[oo]),{setErrorMessage:fo,setError:ho}=useErrorContext(),{initAuth:go}=useUserAuth({authMethod:"social"}),{generateSessionKey:yo,shouldRegisterSessionKeysOnSignin:vo}=useEmbeddedWalletSessionKeys(no),[wo,Eo]=reactExports.useState(!1),[ko,Ao]=reactExports.useState(),Po=reactExports.useCallback(()=>{Ao(void 0),ho(void 0)},[ho]),jo=reactExports.useCallback((xo,uo,po)=>{Eo(!1),to==null||to(),eo==null||eo(),xo&&(po!=null&&po.raiseAuthFailure)&&dynamicEvents.emit("authFailure",{option:xo,provider:xo,type:"social"},uo)},[to,eo]),Mo=reactExports.useCallback((xo,uo,po,bo)=>{const _o={code:uo,message:po};logger$8.error(po),Ao(_o),fo(uo),jo(xo,{error:_o},bo)},[jo,fo]),No=reactExports.useCallback((xo,uo)=>xo?socialProviders.includes(xo)?!0:(Mo(xo,SocialOAuthErrorCode.INVALID_PROVIDER,`Invalid social provider. Valid providers are: ${socialProviders.join(", ")}`,{raiseAuthFailure:uo==="signin"}),!1):(Mo(xo,SocialOAuthErrorCode.NO_PROVIDER,"Provider is required",{raiseAuthFailure:uo==="signin"}),!1),[Mo]),Do=reactExports.useCallback((xo,uo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!(yield uo())){Mo(xo,SocialOAuthErrorCode.VERIFICATION_ERROR,`Failed to link social account: ${xo}`,{raiseAuthFailure:!1});return}eo==null||eo()}catch(po){po instanceof SocialAccountAlreadyExistsError&&Mo(xo,SocialOAuthErrorCode.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE,`Social account already linked to a different profile: ${xo}`,{raiseAuthFailure:!1})}}),[Mo,eo]),Fo=reactExports.useCallback((xo,uo)=>__awaiter$j(void 0,void 0,void 0,function*(){yield go({onError:()=>Mo(xo,SocialOAuthErrorCode.SIGNIN_ERROR,`Failed to sign-in with social account: ${xo}`,{raiseAuthFailure:!0}),onSettled:eo,options:{provider:xo},verifyFunction:()=>uo()})}),[Mo,go,eo]),Xo=reactExports.useCallback(xo=>__awaiter$j(void 0,[xo],void 0,function*({authMode:uo,provider:po,state:bo,authCode:_o,captchaToken:$o,verifier:Co,telegramAuthToken:Ro,forceCreateUser:So=!1}){try{let mo;if(vo()&&(mo=(yield yo()).publicKey),uo==="signin"){if(po===ProviderEnum.Telegram&&Ro)return yield Fo(po,()=>telegramSignIn(no,{forceCreateUser:So,sessionPublicKey:mo,telegramAuthToken:Ro}));po===ProviderEnum.Telegram?yield Fo(po,()=>telegramSignIn(no,{code:_o,sessionPublicKey:mo,state:bo})):yield Fo(po,()=>signInOAuth(no,po,{captchaToken:$o,code:_o,codeVerifier:Co,sessionPublicKey:mo,state:bo}))}else po===ProviderEnum.Telegram?yield Do(po,()=>telegramVerify(no,{code:_o,state:bo})):yield Do(po,()=>verifyOAuth(no,po,{code:_o,codeVerifier:Co,state:bo}))}catch(mo){logger$8.error("Social connection failed with unexpected error:",mo),jo(po,{error:mo},{raiseAuthFailure:uo==="signin"})}}),[no,yo,Do,jo,vo,Fo]),Lo=reactExports.useCallback((xo,uo)=>__awaiter$j(void 0,[xo,uo],void 0,function*(po,{captchaToken:bo,redirectUrl:_o}){const $o=so(),Co=PlatformService.getHost(),Ro=yield connect({domain:Co,nonce:$o,redirectUrl:_o||co,siweUri:PlatformService.getOrigin()});if(!(Ro!=null&&Ro.url)||!(Ro!=null&&Ro.channelToken)){Mo(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return a valid url.",{raiseAuthFailure:po==="signin"});return}isMobile$1()?yield PlatformService.openURL(Ro.url):(io(!0),ro==null||ro(Ro.url));const So=yield watchStatus({channelToken:Ro.channelToken});if(So==="cancelled"){Eo(!1);return}if(So==="timeout"||So==="rejected"||!(So!=null&&So.message)||!(So!=null&&So.custody)||!(So!=null&&So.signature)||!(So!=null&&So.nonce)){Mo(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return valid data.",{raiseAuthFailure:po==="signin"});return}const{custody:mo,message:To,signature:Vo,nonce:Zo}=So;if(po==="signin"){let Qo;vo()&&(Qo=(yield yo()).publicKey);const qo=()=>farcasterSignIn(no,{address:mo,captchaToken:bo,domain:Co,message:To,nonce:Zo,sessionPublicKey:Qo,signature:Vo});yield Fo(ProviderEnum.Farcaster,qo)}else{const Qo=()=>farcasterVerify({environmentId:no,farcasterSignInRequest:{address:mo,captchaToken:bo,domain:Co,message:To,nonce:Zo,signature:Vo}});yield Do(ProviderEnum.Farcaster,Qo),io(!1,{clearErrors:!1})}Eo(!1)}),[so,co,no,yo,Mo,Do,ro,io,vo,Fo]),Bo=reactExports.useCallback(xo=>__awaiter$j(void 0,[xo],void 0,function*({authMode:uo,provider:po,validator:bo,captchaToken:_o,redirectUrl:$o,telegramAuthToken:Co}){var Ro,So;if(Po(),Eo(!0),!uo){logger$8.error('Auth mode is required. Please use either "link" or "signin"');return}if(!No(po,uo)||bo&&!bo(po))return;if(dynamicEvents.emit("authInit",{option:po,provider:po,type:"social"}),po===ProviderEnum.Farcaster)return Lo(uo,{captchaToken:_o,redirectUrl:$o});const mo=randomString(32),To=randomString(43),Vo=providersRequiringPkce.includes(po);setSocialStorageFor(po,{captchaToken:_o,codeVerifier:Vo?To:void 0,mode:uo,state:mo});const Zo=getOauthLoginUrl((Ro=ao==null?void 0:ao.providers)!==null&&Ro!==void 0?Ro:[],po);if(!Zo){Mo(po,SocialOAuthErrorCode.NO_OAUTH_URL,`Failed to get login url to connect social account: ${po}`,{raiseAuthFailure:uo==="signin"});return}const Qo=new URL(Zo);if(Qo.searchParams.set("state",mo),Vo){const Ho=yield digestSHA256(To);Qo.searchParams.set("code_challenge",encodeBase64URL(Ho)),Qo.searchParams.set("code_challenge_method","S256")}const qo=isMobile$1();try{const Ho=yield Oauth2Service.getOauthCode({apiProvider:getProviderByType((So=ao==null?void 0:ao.providers)!==null&&So!==void 0?So:[],po),getOAuthResultFromApi:()=>getOAuthResult(no,po,{state:mo}),initWebAuth:({redirectUrl:$a}={})=>initAuth(no,po,{redirectUrl:$a?removeDynamicOauthParamsFromUrl($a):void 0,state:mo}),isMobile:qo,oauthLoginUrl:Qo,onSettled:eo,provider:po,redirectUrl:$o??co,sessionTimeout:Xr,setIsProcessing:Eo,state:mo,strategy:lo});yield Xo({authCode:Ho,authMode:uo,captchaToken:_o,provider:po,state:mo,telegramAuthToken:Co,verifier:To})}catch(Ho){if(Oauth2Service.isGetOauthCodeError(Ho)){Mo(po,Ho.code,Ho.message,{raiseAuthFailure:uo==="signin"});return}logger$8.error("Social connection failed with unexpected error:",Ho),jo(po,{error:Ho},{raiseAuthFailure:uo==="signin"})}}),[No,Po,Xo,Lo,co,no,Mo,jo,eo,ao==null?void 0:ao.providers,Xr,lo]);return reactExports.useMemo(()=>({checkValidProvider:No,completeConnection:Xo,connectSocialAccount:Bo,error:ko,handleError:Mo,isProcessing:wo,setError:Ao,setIsProcessing:Eo}),[No,Xo,Bo,ko,Mo,wo])},removeDynamicOauthParamsFromUrl=Xr=>{const eo=new URL(Xr);return eo.searchParams.delete("dynamicOauthState"),eo.searchParams.delete("dynamicOauthCode"),eo.toString()},useRedirectSocialHandler=({setSocialProvider:Xr})=>{const{setView:eo}=useViewContext(),{setDynamicWidgetView:to}=useWidgetContext(),[ro,no]=reactExports.useState(null),{sdkHasLoaded:io,setShowAuthFlow:oo,isRenderingEmbeddedAuthFlow:ao,setShowDynamicUserProfile:so}=useInternalDynamicContext(),{completeConnection:co}=useSocialAuth({sessionTimeout:1e4}),lo=reactExports.useCallback(ho=>{const go=getSocialSignInProviderForProviderEnum(ho.provider);Xr(go),eo("social-redirect-view"),ao.current||oo(!0)},[Xr,eo,ao,oo]),fo=reactExports.useCallback(()=>{to("profile"),so(!0)},[to,so]);useEffectOnce(()=>{if(isSSR())return;const ho=new URL(window.location.href),go=ho.searchParams.get("dynamicOauthState"),yo=ho.searchParams.get("dynamicOauthCode");if(!go||!yo)return;const vo=searchSocialStorageByState(go);vo&&(vo.code=yo,no(vo),deleteSocialStorage(vo.provider))}),useEffectOnceCondition(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(ro){if(ro.mode==="signin"){if(getUser()){logger$8.error(new DynamicError("User is already logged in"));return}lo(ro)}else if(ro.mode==="link"){if(!getUser()){logger$8.error(new DynamicError("User not logged in"));return}fo()}yield co({authCode:ro.code,authMode:ro.mode,captchaToken:ro.captchaToken,provider:ro.provider,state:ro.state,verifier:ro.codeVerifier})}}),!!ro&&io)},SocialRedirectContext=reactExports.createContext(void 0),SocialRedirectContextProvider=({children:Xr})=>{var eo,to,ro,no;const{setShowAuthFlow:io,walletConnectorOptions:oo,setSelectedWalletConnectorKey:ao,walletUiUtils:so,consumeNonce:co,displaySiweStatement:lo,environmentId:fo,projectSettings:ho,setIsSingleWalletAccount:go,setShowDynamicUserProfile:yo,setPrimaryWalletId:vo,secondaryWallets:wo,sdkHasLoaded:Eo,user:ko,connectWallet:Ao,primaryWallet:Po,socialProvidersFilter:jo=mo=>mo}=useInternalDynamicContext(),{setErrorMessage:Mo}=useErrorContext(),{setView:No}=useViewContext(),{getCaptchaToken:Do}=useCaptchaContext(),Fo=useVerifyWallet({consumeNonce:co,displaySiweStatement:lo,environmentId:fo,projectSettings:ho,setIsSingleWalletAccount:go}),Xo=(eo=ho==null?void 0:ho.sdk.socialSignIn)===null||eo===void 0?void 0:eo.signInProvider,Lo=(ro=(to=ho==null?void 0:ho.sdk.socialSignIn)===null||to===void 0?void 0:to.providers)!==null&&ro!==void 0?ro:[],Bo=(no=jo(Lo.filter(mo=>mo.enabled).map(mo=>mo.provider)))!==null&&no!==void 0?no:[],xo=oo.map(({walletConnector:mo})=>mo).find(isSocialWalletConnector),[uo,po]=reactExports.useState("idle"),[bo,_o]=reactExports.useState(),Co=(Po?[Po,...wo]:wo).find(mo=>mo.connector.key===(xo==null?void 0:xo.key)),Ro=reactExports.useMemo(()=>Co?getReferencedAccount(ko,Co.id):void 0,[ko,Co]);useInternalDynamicEvents("logout",()=>_o(void 0));const So=reactExports.useCallback(mo=>{logger$8.error(mo),ko?(io(!1,{emitCancelAuth:!0}),yo(!0)):(io(!0),No("wallet-list"),Mo("-1"))},[ko,Mo,io,yo,No]);return reactExports.useEffect(()=>{var mo,To;if(!ho||!xo||!Eo){new URLSearchParams(window.location.search).has("magic_oauth_request_id")&&(No("social-redirect-view"),io(!0));return}const Vo=new URLSearchParams(window.location.search);if(Vo.has("error")&&Vo.has("provider")){const Zo=Vo.get("error_description");So(Zo??"Unknown error"),(mo=xo.getSession)===null||mo===void 0||mo.call(xo);return}if(Vo.has("magic_oauth_request_id")){const Zo=Vo.get("provider");_o(Zo),po("loading"),No("social-redirect-view"),io(!0),ko||ao(xo.key),(To=xo.getSession)===null||To===void 0||To.call(xo).then(Qo=>__awaiter$j(void 0,void 0,void 0,function*(){if(ko){if(!Ro)throw new Error("Social account not found");Ro.oauthAccountId===Qo.oauthId?(Co==null?void 0:Co.id)!==(Po==null?void 0:Po.id)&&(vo(Co.id),io(!1),yo(!0)):(yield xo.endSession(),No("social-wrong-account"))}else{yield Ao(xo);const qo=yield xo.getAddress();so.disabledConfirmationOnce(),yield Fo({captchaToken:Do(),oauth:{accessToken:Qo.accessToken,didToken:Qo.didToken,provider:Zo},publicWalletAddress:qo,walletConnector:xo})}_o(void 0),po("success")})).catch(Qo=>{_o(void 0),po("error"),So(Qo)})}},[Ro,ko,ho,Eo,wo,vo,ao,io,yo,No,xo,Fo,so,Co,So,Ao,Po==null?void 0:Po.id,Do]),useRedirectSocialHandler({setSocialProvider:_o}),jsxRuntimeExports.jsx(SocialRedirectContext.Provider,{value:{enabledSocialProviders:Bo,redirectStatus:uo,setSocialProvider:_o,signInProvider:Xo,socialAccount:Ro,socialProvider:bo,socialWalletConnector:xo},children:Xr})},useSocialRedirectContext=()=>{const Xr=reactExports.useContext(SocialRedirectContext);if(Xr===void 0)throw new Error("useSocialRedirectContext must be used within a SocialRedirectContextProvider");return Xr},AnimatePresence=({children:Xr,animationComponent:eo})=>{const[to,ro]=reactExports.useState(!0),no=useForceUpdate(),io=reactExports.useRef(null),oo=reactExports.useMemo(()=>!!Xr,[Xr]),ao=usePrevious(oo),so=reactExports.useCallback(()=>{io.current=null,no()},[no]);return reactExports.useEffect(()=>{reactExports.isValidElement(Xr)&&(io.current=reactExports.Children.map(Xr,co=>reactExports.cloneElement(co)))},[Xr]),reactExports.useEffect(()=>{oo&&!ao&&ro(!0),ao&&!oo&&ro(!1)},[oo,ao]),reactExports.cloneElement(eo,{children:Xr||io.current,isShown:to,onUnmount:so})},ErrorContainer=({children:Xr,className:eo,isMultiWalletError:to=!1,withIcon:ro=!0,variant:no="error",copykey:io})=>{const oo=classNames("error-container",`error-container--${no}`,eo,{"error-container--multi-wallet":to}),ao=classNames("error",{"error--with-icon":ro});return jsxRuntimeExports.jsxs("div",{className:oo,"data-testid":`error-container--${no}`,children:[ro&&jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:ao,copykey:io,children:Xr})]})};var PasskeySuccessEnum;(function(Xr){Xr[Xr.CREATED=0]="CREATED",Xr[Xr.EDITED=1]="EDITED"})(PasskeySuccessEnum||(PasskeySuccessEnum={}));const PasskeyCreatedSuccessBanner=({className:Xr})=>{const{passkeySuccessPopup:eo}=useInternalDynamicContext(),{t:to}=useTranslation();return jsxRuntimeExports.jsxs(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{}),children:[eo===PasskeySuccessEnum.EDITED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:Xr,copykey:"dyn_passkey_success.edited",children:to("dyn_passkey_success.edited")}),eo===PasskeySuccessEnum.CREATED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:Xr,copykey:"dyn_passkey_success.created",children:to("dyn_passkey_success.created")})]})};var css_248z$1='@layer shadow-reset{.dynamic-shadow-dom-content{all:initial}}@layer preflight{a,hr{color:inherit}progress,sub,sup{vertical-align:baseline}blockquote,body,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,menu,ol,p,pre,ul{margin:0}fieldset,legend,menu,ol,ul{padding:0}*,:after,:before{border:0 solid;box-sizing:border-box}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}summary{display:list-item}menu,ol,ul{list-style:none}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}}.accordion-item{overflow:hidden;position:relative;transition-duration:.15s;transition-property:max-height;transition-timing-function:ease-out}.accordion-item--full-height{height:100vh}.accordion-item__curtain{background-color:var(--dynamic-overlay);left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity 50ms ease-in;z-index:1}.accordion-item__curtain--dimmed{bottom:0;opacity:1}.vertical-accordion__container{display:flex;flex-direction:column}.alert{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);display:flex;gap:.75rem;padding:.75rem}.alert--error{background-color:var(--dynamic-error-2);color:var(--dynamic-error-1)}.alert--warning{background-color:var(--dynamic-alert-2);color:var(--dynamic-alert-1)}.alert--info{background-color:var(--dynamic-brand-secondary-color);color:var(--dynamic-brand-primary-color)}.alert__icon{flex-shrink:0}.badge__container{align-items:center;border-radius:9999px;display:flex;font-size:.625rem;font-weight:500;gap:.25rem;padding:.25rem .5rem;position:relative;transition:color .3s,background-color .3s;white-space:nowrap}.badge__container__primary{background-color:var(--dynamic-badge-primary-background);color:var(--dynamic-badge-primary-color)}.badge__container__secondary{background-color:var(--dynamic-badge-background);color:var(--dynamic-badge-color)}.badge__dot{background-color:var(--dynamic-badge-dot-background);border-radius:9999px;height:.375rem;transition:color .3s,background-color .3s;width:.375rem}.button{align-items:center;cursor:pointer;display:flex;gap:.375rem;justify-content:center;position:relative;transition:all .2s ease}.button:disabled:not(.button--loading){cursor:default;opacity:.5}.button--expanded{width:100%}.button--brand-primary{background:var(--dynamic-brand-primary-color);border:var(--dynamic-button-primary-border);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:var(--dynamic-button-primary-padding)}.button--brand-primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--brand-primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--brand-primary:active:enabled,.button--primary{box-shadow:var(--dynamic-shadow-down-1)}.button--primary{background:var(--dynamic-button-primary-background);border:var(--dynamic-button-primary-border);padding:var(--dynamic-button-primary-padding)}.button--primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--primary:active:enabled,.button--secondary{box-shadow:var(--dynamic-shadow-down-1)}.button--secondary{background:var(--dynamic-button-secondary-background);border:var(--dynamic-button-secondary-border);padding:var(--dynamic-button-secondary-padding)}.button--secondary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--secondary:hover:enabled{background:var(--dynamic-hover)}.button--secondary:active:enabled{background:var(--dynamic-base-3)}.button--tertiary,.button--tertiary .typography{color:var(--dynamic-text-secondary)}.button--tertiary:hover:enabled,.button--tertiary:hover:enabled .typography{color:var(--dynamic-text-primary)}.button--padding-default{border-radius:calc(var(--dynamic-border-radius)/2);padding:.625rem 1rem}.button--padding-large{border-radius:var(--dynamic-button-border-radius);padding:.875rem 1.25rem}.button--padding-medium{border-radius:calc(var(--dynamic-button-border-radius)/1.5);padding:.625rem 1rem}.button--padding-small{border-radius:calc(var(--dynamic-button-border-radius)/2);padding:.5rem .75rem}.button--padding-none{padding:0}.button--padding-login-screen-height{border-radius:calc(var(--dynamic-border-radius)/2);height:2.5rem;padding:0 1rem}.button__spinner{margin-left:auto;margin-right:auto}.button__end-slot,.button__start-slot{display:inline-flex}.button__spinner-container{align-items:center;bottom:0;color:var(--dynamic-text-primary);display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.button--loading>:not(.button__spinner-container){opacity:0}.checkbox--hidden{cursor:pointer;display:block;height:1rem;opacity:0;position:absolute;width:1rem;z-index:10}.checkbox--hidden:checked+.checkbox--visible{background:var(--dynamic-brand-primary-color);border-style:none}.checkbox--hidden:checked+.checkbox--visible>.checkbox__icon{opacity:1}.checkbox--hidden:disabled{pointer-events:none}.checkbox--visible{align-items:center;background:var(--dynamic-base-3);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/4);display:flex;height:1rem;justify-content:center;position:absolute;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem;z-index:0}.checkbox__container{height:1rem;position:relative;width:1rem}.checkbox__icon{color:#fff;height:.75rem;opacity:0;transition-duration:.2s;transition-property:opacity;width:.75rem}.connect-button{background:var(--dynamic-connect-button-background);border:var(--dynamic-connect-button-border);border-radius:calc(var(--dynamic-connect-button-radius, var(--dynamic-border-radius))/2);box-shadow:var(--dynamic-connect-button-shadow)}.connect-button:hover:enabled{background:var(--dynamic-connect-button-background-hover);border:var(--dynamic-connect-button-border-hover);box-shadow:var(--dynamic-connect-button-shadow-hover)}.connect-button:hover:enabled .typography{color:var(--dynamic-connect-button-color-hover)}.connect-button .typography{color:var(--dynamic-connect-button-color)}.copy-button__container{position:relative}.copy-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}@keyframes enter-tile{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.enter-list-tile-animation{animation-duration:.2s;animation-fill-mode:both;animation-iteration-count:1;animation-name:enter-tile;animation-timing-function:ease-out}.error-container{align-items:center;display:flex;justify-content:center;margin-bottom:.5rem;padding:.5rem .75rem}.error-container img,.error-container svg{height:1.25rem;width:1.25rem}.error-container--error{background:var(--dynamic-error-2);color:var(--dynamic-error-1)}.error-container--info{background:var(--dynamic-base-3);color:var(--dynamic-text-primary)}.error-container--success{background:var(--dynamic-success-2);color:var(--dynamic-success-1)}.error-container--multi-wallet{margin-bottom:.75rem}.error--with-icon{margin-left:.875rem}.icon--color-brand-primary{color:var(--dynamic-brand-primary-color)}.icon--color-text-primary{color:var(--dynamic-text-primary)}.icon--color-text-secondary{color:var(--dynamic-text-secondary)}.icon--color-text-tertiary{color:var(--dynamic-text-tertiary)}.icon--color-text-error{color:var(--dynamic-error-1)}.icon--color-success-1{color:var(--dynamic-success-1)}.icon--size-xsmall{height:.75rem;width:.75rem}.icon--size-small{height:1rem;width:1rem}.icon--size-mini{height:1.25rem;width:1.25rem}.icon--size-medium{height:1.5rem;width:1.5rem}.icon--size-mlarge{height:1.875rem;width:1.875rem}.icon--size-large{height:2.375rem;width:2.375rem}.icon-button{align-items:center;border-radius:100%;color:var(--dynamic-text-tertiary);display:flex;justify-content:center}.icon-button svg:hover{color:var(--dynamic-text-secondary)}.icon-button svg:active{color:var(--dynamic-text-primary)}.indicator__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;justify-content:center;position:absolute;right:0}.indicator__icon{background:var(--dynamic-success-1);border-radius:100%}.indicator__wallet-connect{background:#4084ed;bottom:0;color:#fff;position:absolute;right:-.125rem}.icon-with-spinner__container,.indicator__wallet-connect{align-items:center;border-radius:9999px;display:flex;justify-content:center}.icon-with-spinner__container{position:relative}.icon-with-spinner__container img{height:100%;width:100%}.icon-with-spinner__icon-container{align-items:center;display:flex;justify-content:center;position:relative}.icon-with-spinner__spinner-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));position:absolute;right:0;top:0}.icon-with-spinner__spinner{grid-column-start:2;grid-row-start:1;height:100%;width:100%}.icon-with-spinner__animation{animation:spin 1.4s linear infinite}.icon-with-status__container{margin-bottom:12px;max-width:-moz-fit-content;max-width:fit-content;position:relative}.icon-with-status__container .icon{border-radius:100%}.icon-with-status__status-dot{bottom:-.125rem;position:absolute;right:-.25rem}.icon-with-status__container .inner-icon__container{background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;padding:.1875rem;position:absolute;right:-.1875rem}.icon-with-status__container .inner-icon{border-radius:100%}.icon-with-status__container .inner-icon svg{height:1rem;width:1rem}.icon-with-status__container .inner-icon--green{background:var(--dynamic-success-1)}.icon-with-status__container .inner-icon--red{background:var(--dynamic-error-1)}.icon-with-status__container .inner-icon path{fill:var(--dynamic-base-1)}.icon-with-status__container .status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;display:flex;height:.625rem;justify-content:center;position:absolute;right:-.25rem;width:.625rem}.icon-with-status__container .status-dot{border-radius:100%;height:.375rem;width:.375rem}.icon-with-status__container .status-dot--green{background:var(--dynamic-success-1)}.icon-with-status__container .status-dot--red{background:var(--dynamic-error-1)}.info-item__container{color:var(--dynamic-text-tertiary);display:flex}.info-item__container a{text-decoration:underline}.info-item__container .info-item__icon-container{border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-tertiary);display:flex;margin-right:1.125rem}.info-item__container .info-item__icon-container svg{height:1.5rem;width:1.5rem}.info-item__container .info-item__secondary-text{margin-top:.25rem}.phone-number-field{display:flex;flex-direction:column}.phone-number-field__fields{align-items:stretch;display:flex;position:relative;width:100%}.phone-number-field__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.phone-number-field__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.phone-number-field__fields__country-code__flag{margin-right:.5rem}.phone-number-field__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.phone-number-field__fields__country-code .phone-number-field__fields__country-code__container .phone-number-field__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.phone-number-field__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.phone-number-field__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.phone-number-field__fields .phone-number-field__fields__phone-number .phone-number-field__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.phone-number-field__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.phone-number-field__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.phone-number-field__dropdown__items{display:flex;flex-direction:column}.phone-number-field__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.phone-number-field__dropdown__items__country__flag{width:1.5rem}.phone-number-field__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.phone-number-field__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.phone-number-field__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.phone-number-field input::-webkit-inner-spin-button,.phone-number-field input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.phone-number-field input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.inline-submit-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.inline-submit-button path,.inline-submit-button rect{transition:all .2s}.inline-submit-button--active,.inline-submit-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.inline-submit-button--ready,.inline-submit-button--ready:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.input__container{position:relative}.input__container .input__suffix{position:absolute;right:1rem;top:1rem}.input__container .input{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;transition:all .2s ease;width:100%}.input__container .input:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.input__container .input:disabled .input__label{color:var(--dynamic-text-tertiary)}.input__container .input__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem;pointer-events:none}.input__container .input:not(.input__error):focus,.input__container .input:not(.input__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.input__container .input__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.input__container .input__error~.input__label,.input__container .input__error~.input__trailing{color:var(--dynamic-error-1)}.input__container .input__has_trailing{padding-right:4rem}.input__container .input__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.input__container--dense .input{padding:1.125rem .75rem .375rem}.input__container--dense .input::-moz-placeholder{color:transparent}.input__container--dense .input::placeholder{color:transparent}.input__container--dense .input--no-label{padding-block:.75rem}.input__container--dense .input__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.input__container--dense .input:-moz-placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:focus~.input__label{font-size:.625rem;top:.4375rem}.input__container--regular{display:flex;flex-direction:column}.input__container--regular .input{padding:.75rem}.input__container--regular .input__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.input__container--regular .input__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.input__container--regular .input__suffix{top:2.375rem}.input__message{color:var(--dynamic-text-primary);padding:.5rem 0}.input__message__error{color:var(--dynamic-error-1)}.list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.list-tile:not(:disabled):active{transform:scale(.95)}.list-tile:not(:disabled):hover{background-color:var(--dynamic-wallet-list-tile-background-hover);border:var(--dynamic-wallet-list-tile-border-hover);box-shadow:var(--dynamic-wallet-list-tile-shadow-hover)}.list-tile__children{flex-grow:1;text-align:left}.modal-header{align-items:center;background:var(--dynamic-header-background);display:flex;justify-content:center;padding:var(--dynamic-header-padding);width:100%}.modal-header--border{border-bottom:var(--dynamic-header-border-bottom)}.modal-header--align-content-bottom{align-items:start}.modal-header--empty{padding-bottom:0}.modal-header__leading,.modal-header__trailing{align-items:center;display:flex;flex:1;gap:.25rem;height:1.5rem;justify-content:flex-start;margin-right:auto}.modal-header__leading--empty{height:0}.modal-header__trailing{justify-content:flex-end;margin-left:auto;margin-right:0}.modal-header__trailing--empty{height:0}.evm-network-control__container{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;max-width:100%;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.evm-network-control__container--error{border:1px solid var(--dynamic-error-1);color:var(--dynamic-error-1);cursor:auto}.evm-network-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.evm-network-control__arrow-icon{min-width:1rem;transform:rotate(90deg);transition:transform .15s linear}.evm-network-control__arrow-icon--active{transform:rotate(-90deg)}@keyframes spinner-animation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.network{color:var(--dynamic-text-primary);display:flex;justify-content:space-between;width:100%}.network .network__container{align-items:flex-start;display:flex}.network .network__title-icon{height:1rem;margin-right:.5rem;margin-top:.0625rem;width:1rem}.network .network__title-container{display:flex;flex-direction:column;gap:.25rem}.network .network__title-copy{white-space:nowrap}.network .network__status-container{align-items:center;border-radius:100%;display:flex;height:1rem;justify-content:center;width:1rem}.network .network__status-container .network__status-icon{color:#fff;height:.75rem;width:.75rem}.network .network__status-container .network__status-icon svg path{fill:currentcolor}.network .network__status-container .network__status-spinner-icon{animation:spinner-animation 2s linear infinite;height:.75rem;margin-right:-.9375rem;margin-top:-.75rem;transform-origin:0 100%;width:.75rem}.network .network__status-container--active{background-color:var(--dynamic-brand-primary-color)}.network-action{align-items:center;display:flex;padding:.5rem 1rem}@media (pointer:coarse){.network-action{padding:.5rem 1.5rem}}.network-action:not(.network--not-supported){cursor:pointer}.network-action:not(.network--not-supported):hover{background-color:var(--dynamic-hover)}.network-control-skeleton{align-items:center;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;gap:.375rem;justify-content:center;padding:.1875rem .25rem}.network-control-skeleton__icon{background-color:var(--dynamic-base-3);border:1px solid var(--dynamic-base-4);border-radius:100%;height:1.125rem;width:1.125rem}.network-control-skeleton__skeleton{width:1.875rem}.non-network-switching-supported-control{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;justify-content:center;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.non-network-switching-supported-control--error{background-color:var(--dynamic-error-2);cursor:auto}.non-network-switching-supported-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.network-picker-network-control{display:flex;flex-direction:column}.network-picker-network-control__anchor{padding-top:.125rem;position:relative}.pin-field__container{display:flex;flex:1;gap:2.5%;justify-content:space-between;margin-top:1rem;max-width:19.5rem;width:100%}.pin-input__input{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:.75rem;color:var(--dynamic-text-primary);font-size:1rem;height:2.75rem;max-width:2.75rem;outline:.125rem solid transparent;outline-offset:.125rem;text-align:center;width:100%}.pin-input__input:last-child{margin-right:0}.pin-input__input:disabled{cursor:not-allowed;opacity:.5}.pin-input__input--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1);color:var(--dynamic-error-1)}.pin-input__input--success{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1);color:var(--dynamic-success-1)}.portal__container{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.portal__backdrop{-webkit-backdrop-filter:var(--dynamic-modal-backdrop-filter);backdrop-filter:var(--dynamic-modal-backdrop-filter);background:var(--dynamic-modal-backdrop-background);cursor:default;height:100%;left:0;position:fixed;top:0;width:100%}.search__container{align-items:center;background:var(--dynamic-search-bar-background);border:var(--dynamic-search-bar-border);border-radius:var(--dynamic-search-border-radius);cursor:text;display:flex;gap:.625rem;height:2.625rem;justify-content:space-between;min-height:2.25rem;padding-left:.75rem;padding-right:.75rem}.search__container,.search__container svg{color:var(--dynamic-text-tertiary)}.search__container:hover:not(.search__container--active,.search__container:focus-within){background:var(--dynamic-search-bar-background-hover);border:var(--dynamic-search-bar-border-hover);color:var(--dynamic-text-secondary)}.search__container:hover:not(.search__container--active,.search__container:focus-within) svg{color:var(--dynamic-text-secondary)}.search__container--active,.search__container:focus-within{background:var(--dynamic-search-bar-background-focus);border:var(--dynamic-search-bar-border-focus);color:var(--dynamic-text-primary)}.search__container--active svg,.search__container:focus-within svg{color:var(--dynamic-text-secondary)}.search-icon__container{align-items:center;color:var(--dynamic-text-tertiary);display:flex;height:1rem;justify-content:center;width:1rem}.search__input{background:none;border:0;color:var(--dynamic-text-primary);display:flex;flex-grow:1;font-size:var(--dynamic-text-size-body-small);font-weight:500;line-height:1rem;margin:0;outline:none;padding-bottom:.25rem;padding-top:.25rem}.search__input::-moz-placeholder{color:var(--dynamic-text-tertiary)}.search__input::placeholder{color:var(--dynamic-text-tertiary)}.search__input:hover::-moz-placeholder{color:var(--dynamic-text-secondary)}.search__input:hover::placeholder{color:var(--dynamic-text-secondary)}.search__input:focus::-moz-placeholder{color:transparent}.search__input:focus::placeholder{color:transparent}.search__button--clear{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-mini)}.search__button--clear:hover{color:var(--dynamic-text-primary)}.select__container{cursor:pointer;position:relative}.select__container .select{-webkit-appearance:none;-moz-appearance:none;appearance:none;bottom:0;left:0;opacity:0;outline:none;position:absolute;right:0;top:0}.select__container .select::-moz-placeholder{color:transparent}.select__container .select::placeholder{color:transparent}.select__container .select__body{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;display:block;margin:0;padding:1.125rem .75rem .375rem;position:relative;transition:all .2s ease;width:100%}.select__container .select__value{color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400}.select__container .select__label{color:var(--dynamic-text-secondary);font-size:.9375rem;left:.75rem;pointer-events:none;position:absolute;top:.75rem;transition:all .2s ease}.select__container .select__control_icon{align-items:center;bottom:0;color:var(--dynamic-text-secondary);display:flex;position:absolute;right:.75rem;top:0}.select__container .select__has_value .select__label{font-size:.625rem;top:.4375rem}.select__container .select:has(.select__error)~.select__body{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error .select__control_icon,.select__container .select__error .select__label{color:var(--dynamic-error-1)}.select__message{color:var(--dynamic-text-primary);padding-top:.5rem}.select__message__error{color:var(--dynamic-error-1)}.separator{border-top:.0625rem solid var(--dynamic-base-3)}@keyframes shimmer{to{transform:translateX(100%)}}.skeleton{background:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/6);display:inline-flex;line-height:1;min-width:100%;overflow:hidden;position:relative;z-index:0}.skeleton:after{animation:shimmer 2s infinite;background-image:var(--dynamic-loading-animation-gradient);bottom:0;content:"";left:0;position:absolute;right:0;top:0;transform:translateX(-100%)}.spinner{animation:spin 1s linear infinite}.spinner path{stroke:var(--dynamic-brand-primary-color)}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;display:flex;height:.625rem;justify-content:center;width:.625rem}.status-dot{border-radius:100%;height:.375rem;width:.375rem}.status-dot--green{background:var(--dynamic-success-1)}.status-dot--red{background:var(--dynamic-error-1)}.status-dot--yellow{background:var(--dynamic-alert-1)}.switch__container{display:flex}.switch__container.disabled{opacity:.2;pointer-events:none}.switch__container .button{background:var(--dynamic-base-2);border-radius:0;box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);font-size:var(--dynamic-text-size-button-primary);font-weight:400;margin:0;padding:.75rem 0;width:100%}.switch__container .button:first-child{border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-right:0;border-top-left-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button:last-child{border-bottom-right-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button.active{background:var(--dynamic-brand-primary-color);color:#fff}.text-button{align-items:center;border-radius:calc(var(--dynamic-border-radius)/6);color:var(--dynamic-text-secondary);cursor:pointer;display:flex;font-size:.75rem;font-weight:500;gap:.375rem;padding:.125rem .375rem}.text-button:hover{background-color:var(--dynamic-hover)}.auth-mode-switch__container{align-items:center;color:#fff;display:flex;font-size:1rem;gap:.25rem;margin-bottom:.25rem}.auth-mode-switch__container label{cursor:pointer}.toolkit__container{background:var(--dynamic-base-1);border-bottom-right-radius:calc(var(--dynamic-border-radius)/1.5);border-top-right-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;flex-direction:column;gap:1rem;left:0;padding:1.875rem 3.5rem;position:fixed;top:50%;transform:translateY(-50%);width:18.125rem}@media (pointer:coarse){.toolkit__container{display:none}}.switcher__copy{color:var(--dynamic-text-primary);margin-bottom:.25rem}.tos-and-pp__text{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small);margin:0 auto;text-align:center}.tos-and-pp__text .tos-and-pp__link{color:var(--dynamic-text-link);text-decoration:none}.zoom-transition__root{transform-origin:50% 50%}.vertical-drawer-animation{overflow:hidden;transition-property:max-height;transition-timing-function:ease-out}.typography{font-family:var(--dynamic-font-family-primary);font-weight:400;line-height:normal}.typography--title{font-size:var(--dynamic-text-size-title)}.typography--body-normal{font-size:var(--dynamic-text-size-body-normal)}.typography--body-small{font-size:var(--dynamic-text-size-body-small)}.typography--body-mini{font-size:var(--dynamic-text-size-body-mini)}.typography--button-primary{font-size:var(--dynamic-text-size-button-primary);font-weight:700}.typography--button-secondary{font-size:var(--dynamic-text-size-button-secondary);font-weight:700}.typography--button-tertiary{font-size:var(--dynamic-text-size-button-secondary);font-weight:400}.typography--numbers-big{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-big)}.typography--numbers-medium{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-medium)}.typography--bold{font-weight:700}.typography--medium{font-weight:500}.typography--regular{font-weight:400}.typography--link{color:var(--dynamic-text-link)}.typography--brand-primary{color:var(--dynamic-brand-primary-color)}.typography--primary{color:var(--dynamic-text-primary)}.typography--secondary{color:var(--dynamic-text-secondary)}.typography--tertiary{color:var(--dynamic-text-tertiary)}.typography--uppercase{text-transform:uppercase}.typography--dynamic-error-1{color:var(--dynamic-error-1)}.typography--errror-2{color:var(--dynamic-error-2)}.typography--connection-green-1{color:var(--dynamic-success-1)}.typography--tooltip{color:var(--dynamic-tooltip-text-color)}.typography--inherit{color:inherit}.typography--white{color:#fff}.typography--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.powered-by-dynamic{align-items:center;color:var(--dynamic-text-tertiary);display:flex;text-decoration:none;width:100%}.powered-by-dynamic--center{justify-content:center}.powered-by-dynamic--right{justify-content:end}.powered-by-dynamic__logo,.powered-by-dynamic__text{display:inline-block}.powered-by-dynamic__text{margin-right:.25rem}.powered-by-dynamic__logo{display:inline-block;margin-top:.0625rem;max-width:3.6875rem;width:3.6875rem}.dynamic-footer{background:var(--dynamic-footer-background);padding:var(--dynamic-footer-padding);width:100%}.dynamic-footer:not(.dynamic-footer__top-border){padding-top:0}.dynamic-footer__top-border{border-top:var(--dynamic-footer-border-top)}.user-address,.user-address__container{align-items:center;display:flex;justify-content:center}.user-address__container{margin-top:.375rem}.user-address__status-dot{margin-right:.375rem}.user-address__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.app-origin-tile{align-items:center;display:flex;flex-direction:column;gap:.125rem}.app-origin-tile__title{align-items:center;display:flex;gap:.25rem}.app-origin-tile__logo{height:1rem;width:auto}.options-switcher{background-color:var(--dynamic-base-4);display:flex;min-height:2rem;position:relative}.options-switcher,.options-switcher__active-rail,.options-switcher__button{border-radius:calc(var(--dynamic-border-radius)/3)}.options-switcher__button{color:var(--dynamic-text-secondary);flex:1;font-size:var(--dynamic-text-size-button-secondary);font-weight:500;position:relative}.options-switcher__button--active{color:var(--dynamic-text-primary)}.options-switcher__active-rail{background-color:var(--dynamic-base-2);box-shadow:var(--dynamic-shadow-down-1);height:100%;position:absolute;transition:left .1s ease-in-out}.dynamic-verified-icon{color:var(--dynamic-success-1)}.user-profile-field__value{align-items:center;display:flex;min-height:.9375rem;overflow:auto}.user-profile-field__verify-icon{margin-left:.25rem}.user-profile-section{margin:0 0 .75rem}.user-profile-section__title{margin-bottom:.5rem}.user-profile-section__header{display:flex;flex-direction:row;justify-content:space-between}.user-profile-section__action{display:flex;margin:0 0 .5rem}.user-profile-social-account__connected-avatar{border-radius:100%;height:100%;overflow:hidden;position:relative;width:100%}.user-profile-social-account__connected-provider-icon{background-color:#fff;border-radius:100%;bottom:-.1875rem;height:.875rem;padding:.09375rem;position:absolute;right:-.3125rem;width:.875rem}.user-profile-social-account__image{-o-object-fit:cover;object-fit:cover}.user-profile-social-account{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);width:100%}.user-profile-social-account__icon{flex-shrink:0;height:1.5rem;position:relative;width:1.5rem}.user-profile-social-account__label{flex-grow:1;text-align:left}.user-profile-social-account__button{box-shadow:none;flex-shrink:0;padding:.1875rem .28125rem}.user-profile-social-account__button .button__spinner-container{left:auto}.user-profile__fields{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);padding:.75rem}.user-profile__fields,.user-profile__social-accounts{display:flex;flex-direction:column;gap:.5rem}.divider{align-items:center;display:flex;gap:.75rem;justify-content:space-between;padding:1rem 0}.divider__dash{background:var(--dynamic-base-4);height:.0625rem;width:100%}.divider__text{white-space:nowrap}.divider__full-width{width:100%}.dynamic-tooltip{background-color:var(--dynamic-tooltip-color);border-radius:calc(var(--dynamic-border-radius)/4);opacity:0;padding:.125rem .5rem;pointer-events:none;position:absolute;transform:translate(-50%,-100%);transform-origin:50% 50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;z-index:-1}.dynamic-tooltip__arrow{bottom:-.1875rem;color:var(--dynamic-tooltip-color);height:.25rem;left:50%;position:absolute;transform:translateX(-50%);width:.375rem}.dynamic-tooltip--visible{opacity:1;pointer-events:unset;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;z-index:1}.modal-header-banner{padding:.5rem .75rem;text-align:center}.modal-header-banner__error{background-color:var(--dynamic-error-2)}.modal-header-banner__success{background-color:var(--dynamic-success-2)}.modal-header-banner__notice{background-color:var(--dynamic-brand-secondary-color)}.otp-verification-view{align-items:center;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding);text-align:center}.otp-verification-view__icon-with-spinner{margin:0 auto .75rem}.otp-verification-view--message{padding:var(--dynamic-layout-content-error-padding)}.otp-verification-view__status-header{align-items:center;display:flex;justify-content:center}.otp-verification-view__footer{display:flex;flex-direction:column;gap:1rem}.otp-verification-view__destination-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.otp-verification-view__retry-container{margin:1rem auto 0}.overlay-card{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0}.overlay-card--disabled{pointer-events:none}.overlay-card__animation{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0;top:0}.overlay-card__animation--limit-height{height:80%;max-height:80%;top:unset}.overlay-card__overlay{background-color:var(--dynamic-overlay);bottom:0;left:0;position:absolute;right:0;top:0}.overlay-card__content{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/1.5);border-top:.0625rem solid var(--dynamic-base-4);bottom:0;display:flex;flex-direction:column;left:0;max-height:100%;overflow-y:auto;position:absolute;right:0}@media (pointer:coarse){.overlay-card__content{border-bottom-left-radius:0;border-bottom-right-radius:0}}.overlay-card-target{bottom:0;height:100%;left:0;max-height:100%;overflow:auto;position:absolute;right:0}.icon-list-tile{padding-left:0;padding-right:0}.icon-list-tile--children{align-items:center;display:flex;justify-content:center}.popper-content{display:flex;position:absolute;z-index:100}.popper-content__transform-origin-bottom-left{transform:translateY(-100%)}.popper-content__transform-origin-bottom-right{transform:translate(-100%,-100%)}.popper-content__transform-origin-top-left{transform:translate(0)}.popper-content__transform-origin-top-right{transform:translate(-100%)}.dropdown{align-items:stretch;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);display:flex;flex-direction:column;max-height:var(--max-height);min-width:10rem;overflow-y:auto;padding-block:.1875rem}.dropdown--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}.dropdown--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}.menu-list__overlay-card__container{align-items:stretch;display:flex;flex-direction:column;overflow-y:auto;padding-bottom:1.25rem}.transaction-confirmation.dynamic-tooltip{color:var(--dynamic-base-1)}.transaction-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-top:.5rem;width:100%}.transaction-confirmation__actions .button--brand-primary .icon--color-text-secondary,.transaction-confirmation__actions .button--brand-primary .typography--primary{color:#fff}.transaction-confirmation__footer{padding-top:1rem}.transaction-confirmation__body{align-items:stretch;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:0 1.5rem 1.5rem}.transaction-confirmation__app-origin-tile{padding:.75rem}.transaction-confirmation__content{display:flex;flex:1;flex-direction:column;justify-content:flex-start;margin-top:.25rem;overflow:auto;width:100%}.transaction-confirmation__rows{max-height:14.375rem;padding:.5rem .75rem;width:100%}.transaction-confirmation__rows .flex{display:flex;justify-content:space-between}.transaction-confirmation__rows .flex-row{flex-direction:row;gap:.5rem}.transaction-confirmation__rows .row{padding:.5rem 0}.transaction-confirmation__rows .gap{gap:.3rem}.transaction-confirmation__secure-wallet{margin-bottom:0;margin-top:1rem}.transaction-confirmation__info{text-align:right}.transaction-confirmation__error{padding-top:.75rem}.transaction-confirmation__warning{padding-top:.5rem}.transaction-card{background-color:var(--dynamic-base-2);border-radius:.5rem;display:flex;flex-direction:column;padding:1rem 1rem .2rem}.transaction-card__icon{display:flex;gap:.5rem}.transaction-card__icon p{padding-top:.125rem}.transaction-card__icon__container{position:relative}.transaction-card__icon__container__network{align-items:center;background-color:var(--dynamic-base-1);border:1px solid var(--dynamic-base-1);border-radius:100%;bottom:-5px;display:flex;height:1rem;justify-content:center;position:absolute;right:-5px;width:1rem}.transaction-card__total p .typography{gap:.3rem}.transaction-card__info{display:flex;flex-direction:row;gap:.225rem;justify-content:end}.transaction-card__header{align-items:center;display:flex;justify-content:space-between}.transaction-card__header__info{align-items:flex-end;display:flex;flex-direction:column}.transaction-card__arrow{color:var(--dynamic-text-secondary);font-size:1.25rem;margin-left:.5rem}.transaction-card__destination{align-items:center;display:flex;gap:.5rem;margin-bottom:.75rem;margin-top:.25rem}.transaction-card .row{border-top:1px solid var(--dynamic-base-3);display:flex;justify-content:space-between;padding:.6rem 0}.transaction-card .flex-row{display:flex;flex-direction:row;gap:.1rem}.transaction-card .gap-native{gap:.3rem}.transaction-status-layout{display:flex;flex:1;flex-direction:column;overflow:hidden}.transaction-status-layout .modal-header{padding:3rem .3125rem .625rem}.transaction-status-layout__status-icon{color:var(--dynamic-brand-primary-color);height:4rem;width:4rem}.transaction-status-layout__title{text-align:center}.transaction-status-layout__body{align-items:stretch;display:flex;flex:1;flex-direction:column;padding:.25rem 1.5rem 1.5rem}.transaction-status-layout__sent_to{text-align:center}.transaction-status-layout__sent_to p{display:inline}.transaction-status-layout__content{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-top:.375rem;width:100%}.transaction-status-layout__rows{max-height:14.375rem;overflow-y:auto;padding:.375rem .75rem;width:100%}.transaction-status-layout__rows p{font-size:1.5rem}.transaction-status-layout__rows>.transaction-row:not(:first-child){border-top:1px solid var(--dynamic-base-4)}.transaction-status-layout__actions{margin-top:auto;padding-top:1rem}.transaction-status-layout__actions .button--brand-primary .typography--primary{color:var(--dynamic-base-2)}.transaction-status-layout__footer{padding-top:1rem}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__wallet-icon{display:inline-block}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__text,.transaction-origin-destination__wallet-icon{vertical-align:middle}.transaction-origin-destination__wallet-icon{height:1rem;margin-right:.375rem;width:1rem}.transaction-origin-destination__arrow-icon{color:var(--dynamic-text-tertiary);margin:0 .5625rem}.tokens-balance-dropdown{background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-button-border-radius)/1);cursor:pointer;padding:.875rem .75rem}.tokens-balance-dropdown,.tokens-balance-dropdown__selected{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.tokens-balance-dropdown__selected .evm-network-control__arrow-icon{position:absolute;right:2.625rem}.tokens-balance-dropdown__menu_list{border-radius:calc(var(--dynamic-button-border-radius)/1);padding:.5rem 1rem;width:19.375rem}@media (max-width:640px){.tokens-balance-dropdown__menu_list{margin:0 auto;width:100%}.tokens-balance-dropdown__menu_list .modal-header{padding:1rem 0 1rem 1.25rem}}.tokens-balance-dropdown__menu_list .modal-header__leading,.tokens-balance-dropdown__menu_list .modal-header__trailing{flex:none}.tokens-balance-dropdown__menu_list_item{align-items:center;display:flex;gap:.625rem;justify-content:space-between;padding:.5rem 0;text-align:left}.tokens-balance-dropdown__menu_list_item__name{display:flex;gap:.3125rem;min-width:9.375rem}.tokens-balance-dropdown__menu_list_item__balance{display:flex;gap:.3125rem}.tokens-balance-dropdown__chain{align-items:center;display:flex;gap:.375rem}.tokens-balance-dropdown__chain__icon{height:1rem;width:1rem}.tokens-balance-dropdown__balance-container{align-items:center;display:flex;gap:.25rem}.tokens-balance-dropdown__balance{align-items:center;display:flex;gap:.125rem}.send-balance-page-layout__header-content{align-items:center;display:flex;gap:.5rem}.send-balance-page-layout__body{display:flex;flex:1;flex-direction:column;overflow:auto;padding:.25rem 1.5rem 1.5rem}.send-balance-page-layout__balance-container{display:flex;flex-direction:column;gap:.5rem;padding-bottom:.5rem}.send-balance-page-layout__error{padding-bottom:1rem}.send-balance-page-layout__footer{padding-top:1.5rem}.send-balance-page-layout__network-container{display:flex;justify-content:center;padding-bottom:.5rem}.send-balance-form{display:flex;flex:1;flex-direction:column;gap:.5rem}.send-balance-form__button{margin-top:auto}.send-balance-form__secure-wallet{margin:0}.send-balance-form__field.fiat{padding-left:1.5625rem}.send-balance-form__amount-container{position:relative}.send-balance-form__amount-container__fiat_sign{left:.625rem;position:absolute;top:.6875rem}.send-balance-form__amount-container__double_arrow{position:absolute;right:.625rem;top:.875rem}.send-balance-form__amount-container__balance{display:flex;gap:.25rem;position:absolute;right:.75rem;top:1.4375rem}.send-balance-form__amount-container__field.input{padding-left:3.125rem;transition:none}.send-balance-form__amount-container__floating_value{color:#000;font-size:1rem;left:10px;pointer-events:none;position:absolute;top:1.1875rem;white-space:nowrap}.send-balance-form__amount_available{border-bottom:1px solid var(--dynamic-base-3);padding-bottom:.75rem}.send-balance-form .input__container--regular .input__label:after{content:"";height:0}.select-network-button__icon{display:inline;margin:0 6px 3px;max-height:16px;max-width:16px;vertical-align:middle}.chip{align-items:center;background:var(--dynamic-base-2);border-radius:.75rem;color:var(--dynamic-text-primary);display:inline-flex;gap:.1875rem;height:1.5rem;justify-content:center;padding:.125rem .25rem}.chip__with-icon{padding:.125rem .25rem .125rem .125rem}.chip--icon{border-radius:50%;height:1.25rem;justify-content:center;overflow:hidden;width:1.25rem}.chip--icon,.form-field-label{align-items:center;display:flex}.form-field-label{color:var(--dynamic-text-secondary);cursor:text;font-size:.75rem}.form-field-label__with-divider:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.step{counter-increment:step;gap:.5rem}.step,.step__icon{align-items:center;display:flex}.step__icon{flex-shrink:0;height:1.25rem;justify-content:center;width:1.25rem}.step__icon--done{background-color:var(--dynamic-success-1);border-radius:50%}.step__icon__check-mark{color:var(--dynamic-base-1);height:1rem;width:1rem}.step__index{align-items:center;border:1px solid var(--dynamic-base-4);border-radius:.625rem;display:flex;height:1.25rem;justify-content:center;min-width:1.25rem;padding:0 .25rem}.step__index-label:before{content:counter(step)}.step__leading{max-width:-moz-fit-content;max-width:fit-content;position:relative}.stepper{counter-reset:step;display:flex;gap:1rem;width:100%}.stepper__divider{flex-grow:1}.modal{left:50%;margin:auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:var(--dynamic-modal-width)}@media (max-width:640px){.modal{bottom:0;max-width:37.5rem;top:auto;transform:translate(-50%);width:100%}}.modal__items{display:flex;flex-direction:column;gap:.75rem}.modal-card{background:var(--dynamic-base-1);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);overflow:hidden;width:100%}.modal-card--radius-small{border-radius:calc(var(--dynamic-border-radius)*.75)}.modal-card--with-border{border:1px solid var(--dynamic-base-4)}@media (max-width:640px){.modal-card{bottom:0;max-width:37.5rem;top:auto;transform:translateY(0);width:100%}.modal-card--sharp-mobile-bottom-radius:last-child{border-radius:var(--dynamic-border-radius) var(--dynamic-border-radius) 0 0}}.inline-widget-button{align-items:center;background-color:var(--dynamic-base-1);display:flex;gap:.5rem;min-height:100%;padding:.5rem .75rem;width:-moz-fit-content;width:fit-content}.inline-widget-button:hover{background-color:var(--dynamic-hover)}.inline-widget-button__icon{height:1.25rem;width:1.25rem}.inline-widget-button__vertical-divider{background-color:var(--dynamic-base-3);content:"";height:1rem;width:.0625rem}.inline-widget{align-items:center;background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;justify-content:center;overflow:hidden;width:-moz-fit-content;width:fit-content}.inline-widget>*{border-right:1px solid var(--dynamic-base-3)}.inline-widget>:last-child{border-right:none}.wallet-information-card{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.wallet-information-card__header{border-bottom:1px solid var(--dynamic-base-3);display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.wallet-information-card__details-container{align-items:center;display:flex;gap:.75rem;justify-content:space-between;min-width:0}.wallet-information-card__menu{flex-shrink:0}.wallet-information-card__icon{height:1.75rem;width:1.75rem}.wallet-information-card__details{display:flex;flex-direction:column;overflow:hidden}.wallet-information-card__balance-container{align-items:center;display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.social-sign-in{display:flex;flex-wrap:wrap;gap:.375rem;justify-content:space-between}.social-sign-in--tile{flex:1;height:2.5rem}.social-sign-in--tile__full-width{flex:1 0 100%}.social-sign-in--card{display:flex;flex-direction:column;min-height:11.5625rem}.social-sign-in--card--body{display:grid;gap:.375rem;grid-template-columns:auto auto auto auto;padding:.25rem 1.5rem 1.5rem}.social-sign-in--card--tile{height:2.5rem}.sign-typed-data-preview--attribute-row{display:flex;gap:.5rem}.sign-typed-data-preview--fields-list,.sign-typed-data-preview--type-container{display:flex;flex-direction:column;gap:.25rem}.sign-typed-data-preview--type-container{padding-left:1rem}.need-help-section{align-items:center;display:flex;flex-direction:column;gap:.125rem;margin-bottom:.5rem}.need-help-section__links{display:flex;gap:.5rem}.need-help-section__links>*+*{padding-left:.5rem;position:relative}.need-help-section__links>*+:after{border-left:1px solid var(--dynamic-text-secondary);bottom:15%;content:"";left:0;position:absolute;top:15%;width:50%}.need-help-section__helper-link{color:var(--dynamic-text-link)}.textarea__container{position:relative}.textarea__container .textarea__suffix{position:absolute;right:1rem;top:1rem}.textarea__container .textarea{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;resize:none;transition:all .2s ease;width:100%}.textarea__container .textarea:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.textarea__container .textarea:disabled .textarea__label{color:var(--dynamic-text-tertiary)}.textarea__container .textarea__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem}.textarea__container .textarea:not(.textarea__error):focus,.textarea__container .textarea:not(.textarea__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.textarea__container .textarea__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.textarea__container .textarea__error~.textarea__label,.textarea__container .textarea__error~.textarea__trailing{color:var(--dynamic-error-1)}.textarea__container .textarea__valid{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1)}.textarea__container .textarea__valid~.textarea__label,.textarea__container .textarea__valid~.textarea__trailing{color:var(--dynamic-success-1)}.textarea__container .textarea__has_trailing{padding-right:4rem}.textarea__container .textarea__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.textarea__container--dense .textarea{padding:1.125rem .75rem .375rem}.textarea__container--dense .textarea::-moz-placeholder{color:transparent}.textarea__container--dense .textarea::placeholder{color:transparent}.textarea__container--dense .textarea__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textarea__container--dense .textarea:-moz-placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:focus~.textarea__label{font-size:.625rem;top:.4375rem}.textarea__container--regular{display:flex;flex-direction:column}.textarea__container--regular .textarea{padding:.75rem}.textarea__container--regular .textarea__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.textarea__container--regular .textarea__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.textarea__container--regular .textarea__suffix{top:2.375rem}.textarea__message{color:var(--dynamic-text-primary);padding:.5rem 0}.textarea__message__error{color:var(--dynamic-error-1)}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover,select:-webkit-autofill,select:-webkit-autofill:focus,select:-webkit-autofill:hover,textarea:-webkit-autofill,textarea:-webkit-autofill:focus,textarea:-webkit-autofill:hover{-webkit-text-fill-color:var(--dynamic-text-primary)!important;background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary)!important;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s}.secure-embedded-wallet-card{background:var(--dynamic-brand-secondary-color);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:.75rem;transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.secure-embedded-wallet-card__text-content{align-items:flex-start;cursor:pointer;display:flex;flex-direction:column;flex-grow:1;padding:0;text-align:left}.secure-embedded-wallet-card__text-content,.secure-embedded-wallet-card__text-content:hover{background-color:transparent;box-shadow:none}.secure-embedded-wallet-card__link{line-height:20px;text-decoration:underline}.toggle{-webkit-tap-highlight-color:transparent;cursor:pointer;display:inline-block}.toggle--input{display:none}.toggle--input:checked+.toggle--content__variant-primary{background-color:var(--dynamic-brand-primary-color);color:var(--dynamic-brand-primary-color)}.toggle--input:checked+.toggle--content .toggle--knob{left:1.09375rem}.toggle--input:checked+.toggle--content .toggle--knob>*{opacity:1}.toggle--content{background-color:var(--dynamic-base-3);border-radius:.625rem;height:1.25rem;position:relative;transition:background-color .2s ease;width:2.25rem}.toggle--knob{align-items:center;background-color:#fff;border-radius:100%;display:flex;height:1.0625rem;justify-content:center;left:.09375rem;position:absolute;top:.09375rem;transition:left .2s ease;width:1.0625rem}.toggle--knob>*{opacity:0;transition:opacity .2s ease}.list-tile-animated-trailing{position:relative}.list-tile-animated-trailing__child{position:absolute;right:0;transform:translateY(-50%);transition-duration:.2s;transition-property:opacity,transform;transition-timing-function:ease-in}.list-tile-animated-trailing__hover-element{opacity:0;position:absolute;right:0;transform:translate(-.625rem,-50%);transition-duration:.3s}.list-tile:hover .list-tile-animated-trailing__hover-element{opacity:1;transform:translateY(-50%)}.list-tile:hover .list-tile-animated-trailing__child{opacity:0;transform:translate(-.625rem,-50%)}.wallet-group-view-layout__container{padding:var(--dynamic-layout-content-padding)}.wallet-group-view-layout__icon{height:4rem;margin:0 auto .75rem;width:4rem}.wallet-group-view-layout__list{display:flex;flex-direction:column;gap:.5rem}.wallet-group-view-layout__title{padding-bottom:1rem;text-align:center}.retry-send-verification-code-section{align-items:center;display:flex;flex-direction:column}.retry-send-verification-code-section__confirmation{color:var(--dynamic-success-1);display:flex;gap:.3125rem;padding:.125rem .375rem}.toggle-visibility-button__container{position:relative}.toggle-visibility-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.qrcode{--background:var(--dynamic-base-1);color:var(--dynamic-text-primary);position:relative}.qrcode__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;height:18.125rem;justify-content:center;margin:auto;width:18.125rem}.qrcode__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.qrcode-container__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.qrcode-container__container--message{padding:var(--dynamic-layout-content-error-padding)}.qrcode-container__container .button__content{display:flex;gap:.375rem}.qrcode-container__top{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin-bottom:1.25rem;padding:.75rem}.qrcode-container__top .button-container{align-items:center;display:flex;gap:.5rem;width:100%}.qrcode-container__top .button-container svg path{fill-opacity:100%}.qrcode-container__top .button-container .qr-code-button{height:2.375rem}.qrcode-container__content{max-width:20rem;text-align:center}.qrcode-container__tos{margin-top:1rem;max-width:17.5rem;text-align:center}.qrcode-container__tos .tos__link{color:var(--dynamic-text-link)}.qrcode-container__tos .tos__link:hover{text-decoration:underline}.qr-code-wrapper__scan-issue-message{align-items:center;background:var(--dynamic-base-2);border-bottom:var(--dynamic-button-primary-border);border-radius:0;border-top:var(--dynamic-button-primary-border);color:var(--dynamic-text-primary);display:flex;justify-content:center;padding:.5rem .75rem;text-align:center;width:100%}.qr-code-wrapper__scan-issue-button{color:var(--dynamic-text-link);font-size:.75rem;text-decoration:underline}.radio-button{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.5rem;padding:.75rem;width:100%}.radio-button input{height:1.5rem;width:1.5rem}.mfa-device-skeleton{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.mfa-device-skeleton__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.phantom-ledger-icon{position:absolute}.phantom-ledger-icon__container{align-items:center;display:flex;height:100%;position:relative}.account-exists__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.account-exists__main{padding:var(--dynamic-modal-padding)}.account-exists__social-icon{margin:auto}.account-exists__image{padding:.3125rem;width:4.375rem}.account-exists__content{text-align:center}.account-exists__content--primary{margin-bottom:.375rem}.account-exists__content--secondary{margin-bottom:1rem}.account-exists__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.user-data-form__form{display:flex;flex-direction:column}.user-data-form__error{margin-bottom:.625rem}.user-field__checkbox-container{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column;padding:.625rem}.user-field__checkbox-container--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.user-field__consent-checkbox{display:flex;margin-bottom:.5rem}.user-field__consent-checkbox a{color:var(--dynamic-text-link)}.user-field__consent-checkbox:last-child{margin-bottom:0}.user-field__checkbox-label{padding-left:.75rem}.user-field__error-message{color:var(--dynamic-error-1);padding:.25rem}.user-phone-field__optional-label{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;pointer-events:none;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.user-data-fields__fields-column{display:flex;flex-direction:column;gap:.375rem;margin-bottom:.5rem;max-height:11.25rem;overflow:auto}.user-data-fields__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.collect-user-data::-webkit-scrollbar,.collect-user-data::-webkit-scrollbar-thumb,.collect-user-data::-webkit-scrollbar-track{display:none}.collect-user-data__main-img{width:100%}.collect-user-data__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data__form--error{padding:var(--dynamic-layout-content-error-padding)}.collect-user-data__img-container{align-items:center;display:flex;justify-content:center}.collect-user-data__img{height:1.75rem;width:1.75rem}.collect-user-data__img--rounded{border-radius:9999px}.collect-user-data__wallet-address{margin-left:.5rem}.collect-user-data__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data__success-icon svg{height:4rem;width:4rem}.collect-user-data__welcome-container{margin:1rem 0;text-align:center}.collect-user-data__welcome-title{margin-bottom:.25rem}.collect-user-data__log-out{margin:.75rem auto 0}.collect-user-data__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.collect-user-data__network-picker{margin:auto 0;max-width:-moz-fit-content;max-width:fit-content}.collect-user-data__network-picker-button{border:1px solid var(--dynamic-base-4);position:static;transform:translateX(0)}.collect-user-data__network-picker-button:hover{background:var(--dynamic-hover)}.collect-user-data__network-container{border:var(--dynamic-header-border-bottom);display:flex;justify-content:space-between;padding:var(--dynamic-header-padding);position:relative}.collect-user-data-login-no-wallet::-webkit-scrollbar,.collect-user-data-login-no-wallet::-webkit-scrollbar-thumb,.collect-user-data-login-no-wallet::-webkit-scrollbar-track{display:none}.collect-user-data-login-no-wallet__main-img{width:100%}.collect-user-data-login-no-wallet__user-info-container{align-items:center;border:var(--dynamic-header-border-bottom);display:flex;justify-content:center;padding:var(--dynamic-header-padding)}.collect-user-data-login-no-wallet__user-identification{margin-left:.5rem}.collect-user-data-login-no-wallet__icon-container{height:1.5rem;width:1.5rem}.collect-user-data-login-no-wallet__icon-container .user-profile-social-account__connected-avatar{margin-top:.125rem}.collect-user-data-login-no-wallet__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data-login-no-wallet__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data-login-no-wallet__success-icon svg{height:4rem;width:4rem}.collect-user-data-login-no-wallet__welcome-container{margin:1rem 0;text-align:center}.collect-user-data-login-no-wallet__welcome-title{margin-bottom:.375rem}.collect-user-data-login-no-wallet__log-out{margin:.75rem auto 0}.email-verification__retry-container{margin:1rem auto 0}.email-verification__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.email-verification__container--error{padding:var(--dynamic-layout-content-error-padding)}.email-verification__icon-with-spinner{margin:0 auto .75rem}.email-verification__error-message{margin:0}.email-verification__error-message,.email-verification__transfer-message{align-items:center;border-radius:0;display:flex;justify-content:center;width:100%}.email-verification__transfer-message{background:var(--dynamic-success-2);color:var(--dynamic-success-1);margin-bottom:.5rem;padding:.5rem .75rem;text-align:center}.email-verification__icon--verified{margin:0 auto 1rem}.email-verification__title{margin-top:.5rem;text-align:center}.email-verification__retry-copy{margin-top:1rem}.email-verification__copy-text-container{margin:0;text-align:center}.email-verification__text-button{color:var(--dynamic-text-link)}.email-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.email-verification__log-out{margin:.75rem auto 0}.no-qr-code-installed__container{align-items:center;color:var(--dynamic-text-primary);flex-direction:column;margin:-2.25rem 0 0;padding:var(--dynamic-modal-padding);padding-top:0;width:100%}.no-qr-code-installed__container:first-child,.no-qr-code-installed__container:last-child{margin-right:0}.no-qr-code-installed__img{display:flex;height:auto;justify-content:center;margin:auto;text-align:center}.no-qr-code-installed__typography{text-align:center}.no-qr-code-installed__typography--title{margin:1rem 0 .375rem;text-align:center}.no-qr-code-installed__links-section{flex-direction:column;margin:1rem 0}.wallet-help-link__anchor{align-items:center;background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);display:flex;gap:.625rem;margin-bottom:.5rem;padding:.75rem;position:relative;width:100%}.pending-connect__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-connect__copy-text{color:var(--dynamic-text-secondary);max-width:20rem;text-align:center}.pending-connect__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-signature__container .pending-signature__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container .pending-signature__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;max-width:20rem;text-align:center}.pending-signature__container .pending-signature__copy--mini{line-height:1rem;margin-top:.25rem}.pending-signature__container .pending-signature__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-wrong-account-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.social-wrong-account-view__container .social-wrong-account-view__title{color:var(--dynamic-text-primary);line-height:1.5rem}.social-wrong-account-view__container .social-wrong-account-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-top:.375rem;max-width:20rem;text-align:center}.social-wrong-account-view__container .social-wrong-account-view__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.social-redirect-view__container .social-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.social-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.sms-verification__text-button{color:var(--dynamic-text-link)}.sms-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.sms-verification__log-out{margin:.75rem auto 0}.search-instead__container{font-size:.75rem;line-height:1rem;margin-top:2.5rem;padding-bottom:1rem;text-align:center;transition-duration:.3s;transition-property:background-color,border-color,color,fill,stroke;width:100%}.search-instead__container__image{display:flex;justify-content:center;margin:.5rem auto}.wallet-list-item__tile{border-radius:var(--dynamic-wallet-list-tile-border-radius)}.wallet-list-grid-tabs{border-bottom:1px solid var(--dynamic-base-4);border-top:1px solid var(--dynamic-base-4);display:flex;width:100%}.wallet-list-grid-tabs__button{align-items:center;border-left:1px solid var(--dynamic-base-4);display:flex;flex-basis:50%;gap:.25rem;justify-content:center;outline:none;padding:.5rem .625rem}.wallet-list-grid-tabs__button:first-child{border-left:none}.wallet-list-grid-tabs__button--selected{background-color:var(--dynamic-wallet-list-tile-background)}.wallet-list-grid-tabs__button--text{flex-basis:100%}.wallet-list-grid-tabs__icon--selected{filter:grayscale(100%)}.wallet-list__error-container{margin:0}.wallet-list__search-container{padding:var(--dynamic-search-padding)}.wallet-list__tabs-container{margin-bottom:.5rem}.wallet-list__scroll-container{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow:auto;padding:var(--dynamic-initial-view-content-padding)}.wallet-list__scroll-container--error{padding:var(--dynamic-layout-content-error-padding)}.wallet-list__scroll-container::-webkit-scrollbar,.wallet-list__scroll-container::-webkit-scrollbar-track{display:none}.wallet-list__scroll-container::-webkit-scrollbar-thumb{display:none}.wallet-list__scroll-container:empty{display:flex}.wallet-list__scroll-container--fixed-height{height:var(--dynamic-wallet-list-max-height)}.wallet-list__search-skeleton{height:2.625rem}.wallet-list__search-skeleton,.wallet-list__tile-skeleton{border-radius:calc(var(--dynamic-border-radius)/2);margin-bottom:.5rem}.wallet-list__tile-skeleton{height:3rem;padding:.75rem}.wallet-list__tiny-footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible}.wallet-list__tiny-footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-no-access__container{background:var(--dynamic-base-1)}.wallet-no-access__main{padding:var(--dynamic-modal-padding)}.wallet-no-access__social-info-container{align-items:center;display:flex;justify-content:center;margin-top:1.5rem}.wallet-no-access__waitlist-link{align-items:center;display:flex;gap:8px;justify-content:center}.wallet-no-access__social-icon{margin:auto}.wallet-no-access__image{width:100%}.wallet-no-access__user-info-container{align-items:center;display:flex;flex-direction:column;margin-bottom:1rem}.wallet-no-access__content{text-align:center}.wallet-no-access__content--primary{margin-bottom:.375rem}.wallet-no-access__content--secondary{margin-bottom:1rem}.wallet-no-access__wallet-address{margin-left:.375rem}.wallet-no-access__wallet-address-container{align-items:center;display:flex;justify-content:center}.wallet-no-access__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.wallet-no-access__icon--verified{margin:0 auto 1rem}.wallet-sign-spinner__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.wallet-sign-spinner__copy{color:var(--dynamic-text-secondary);margin:0;text-align:center}.wallet-sign-spinner__button{box-shadow:var(--dynamic-shadow-down-1);margin:.75rem 0 0}.wallet-used-view__container{padding:var(--dynamic-layout-content-padding);text-align:center}.wallet-used-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-used-view__icon svg{margin:0 auto}.wallet-used-view__shorten-wallet-address{margin:0 0 1rem}.wallet-used-view__copy{margin:0 0 .75rem}.wallet-used-view__accept-button,.wallet-used-view__footer{margin:0 0 .5rem}.wallet-used-view__logout{background:none;border:none;box-shadow:none;margin:auto}.wallet-used-view__checkbox-label{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);cursor:pointer;display:flex;gap:.5rem;justify-content:center;margin:1rem auto .5rem;padding:.75rem;text-align:left}.wallet-used-view__checkbox-container{flex-shrink:0}.network-not-supported__content-container{padding:var(--dynamic-layout-content-padding)}.network-not-supported__content-container--error{padding:var(--dynamic-layout-content-error-padding)}.network-not-supported__main-img{width:100%}.network-not-supported__img-container{align-items:center;display:flex;justify-content:center}.network-not-supported__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported__welcome-container{margin:1rem 0;text-align:center}.network-not-supported__welcome-title{margin-bottom:.375rem}.network-not-supported__continue{margin-top:1rem}.network-not-supported__log-out{margin:.75rem auto 0}.network-not-supported__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.network-not-supported__network-container{margin-top:.5rem;position:relative}.network-not-supported__network-picker{margin:auto;max-width:-moz-fit-content;max-width:fit-content}.network-not-supported__network-picker-button{position:static;transform:translateX(0)}.email-confirmation-waiting-view{align-items:center;display:flex;flex-direction:column;padding-bottom:1.625rem;text-align:center}.email-confirmation-waiting-view__title{padding-bottom:.375rem}.email-confirmation-waiting-view__email-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.email-confirmation-waiting-view__edit-icon-button{display:inline-flex}.email-confirmation-waiting-view__header-icon{display:flex;justify-content:center;margin-top:-2rem}.email-confirmation-waiting-view__note{max-width:16.25rem;padding-top:1rem;text-align:center}.email-confirmation-waiting-view__powered_by_dynamic_footer{padding-top:1rem;width:100%}.login-with-email-form{display:flex;flex-direction:column;gap:.375rem}.login-with-email-form .input__suffix{top:.6875rem}.login-with-email-form .input__suffix .icon-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.login-with-email-form .input__suffix .icon-button path,.login-with-email-form .input__suffix .icon-button rect{transition:all .2s}.login-with-email-form .input__suffix .icon-button--active,.login-with-email-form .input__suffix .icon-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.login-with-email-form .input__suffix .icon-button--has-content,.login-with-email-form .input__suffix .icon-button--has-content:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.list-item-button{background:none;box-shadow:none}.list-item-button__trailing{position:relative}.list-item-button__trailing-child{position:absolute;right:0;transition-property:opacity,transform;transition-timing-function:ease-in}.list-item-button__trailing-label{transform:translateY(-50%);transition-duration:.2s}.list-item-button__trailing-icon{transition-duration:.3s}.list-item-button:hover .list-item-button__trailing-label,.list-item-button__trailing-icon{opacity:0;transform:translate(-.625rem,-50%)}.list-item-button:hover .list-item-button__trailing-icon{opacity:1;transform:translateY(-50%)}.login-with-email-wallet-list__skeleton{border-radius:calc(var(--dynamic-border-radius)/2);height:2.625rem;margin-bottom:.5rem}.login-with-email-wallet-list__container{display:flex;flex-direction:column;gap:.375rem}.connect-with-wallet-button{height:2.5rem}.toggleable-section{align-items:stretch;display:flex;flex-direction:column;gap:.75rem}.toggleable-section__toggle-prompt{align-items:center;display:flex;justify-content:space-between}.toggleable-section__toggle-prompt__button{cursor:pointer;margin:-.75rem 0 0 -.75rem;outline:none;padding:.75rem 0 0 .75rem}.toggleable-section__toggle-prompt__button__text{outline:none;transition:all .2s}.toggleable-section__toggle-prompt__button:focus .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:focus-visible .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:hover .toggleable-section__toggle-prompt__button__text{background-color:var(--dynamic-brand-secondary-color)}.login-with-phone-number-form{display:flex;flex-direction:column;gap:.375rem}.login-with-phone-number-form__fields{align-items:stretch;display:flex;position:relative;width:100%}.login-with-phone-number-form__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.login-with-phone-number-form__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.login-with-phone-number-form__fields__country-code__flag{margin-right:.5rem}.login-with-phone-number-form__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.login-with-phone-number-form__fields__country-code__container .login-with-phone-number-form__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.login-with-phone-number-form__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.login-with-phone-number-form__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.login-with-phone-number-form__fields__phone-number .login-with-phone-number-form__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.login-with-phone-number-form__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.login-with-phone-number-form__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.login-with-phone-number-form__dropdown__items{display:flex;flex-direction:column}.login-with-phone-number-form__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.login-with-phone-number-form__dropdown__items__country__flag{width:1.5rem}.login-with-phone-number-form__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.login-with-phone-number-form__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.login-with-phone-number-form__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.login-with-phone-number-form input::-webkit-inner-spin-button,.login-with-phone-number-form input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.login-with-phone-number-form input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.login-view__text{padding:.5rem 0}.login-view__error-container{margin:0}.login-view__container{padding:var(--dynamic-initial-view-content-padding)}.login-view__container--error{padding:var(--dynamic-layout-content-error-padding)}@media (pointer:coarse){.login-view__container{padding:.75rem}}.login-view__scroll{align-items:stretch;gap:.375rem;height:100%;max-height:36.25rem;overflow:auto}.login-view__scroll,.login-view__scroll__section{display:flex;flex-direction:column}.login-view__scroll__section--emailAndPhone+.login-view__scroll__section--social{margin-top:1rem}.login-view__scroll::-webkit-scrollbar,.login-view__scroll::-webkit-scrollbar-track{display:none}.login-view__scroll::-webkit-scrollbar-thumb{display:none}.login-view__scroll:empty{display:flex}.login-view__scroll--full-height{height:100vh}.login-view__scroll--email-first{flex-direction:column-reverse}.login-view__scroll__web2{display:flex;flex-direction:column;gap:.75rem}.mobile-wallet-redirect{align-items:stretch;display:flex;flex-direction:column;gap:1.5rem;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mobile-wallet-redirect__icon-with-spinner{align-self:center}.mobile-wallet-redirect__copy-text{align-self:center;max-width:20rem;text-align:center}.mobile-wallet-redirect__wallet-app{align-items:center;background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex-wrap:wrap;gap:.875rem;justify-content:space-between;padding:.625rem .75rem}.mobile-wallet-redirect__wallet-app__group{align-items:center;display:flex;gap:.5rem}.mobile-wallet-redirect__wallet-app__group__app-store{text-align:right}.captcha-verify-user__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 1.5rem 1.5rem;text-align:center}.captcha-verify-user__icon{height:4rem;margin-bottom:1rem;width:4rem}.captcha-verify-user__title{margin-bottom:.375rem}.captcha-verify-user__subtitle{margin-bottom:1rem}.captcha-verify-user__dynamic-logo{margin-top:1rem}.network-not-supported-switch-manual{margin-top:-1.5rem;padding:0 1.5rem 1.5rem}.network-not-supported-switch-manual__img-container{align-items:center;display:flex;justify-content:center;margin-bottom:1rem}.network-not-supported-switch-manual__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported-switch-manual__network-container{position:relative}.network-not-supported-switch-manual__content{text-align:center}.network-not-supported-switch-manual__title{margin:0 0 .375rem}.wallet-group__list{display:flex;flex-direction:column}.wallet-locked-view__error-container{align-items:center;display:flex;justify-content:center}.wallet-locked-view__button-header{margin:.75rem}.wallet-locked-view__button{margin:.75rem auto auto}.wallet-locked-view__icon{margin:auto}.wallet-locked-view__content{padding:0 var(--dynamic-modal-padding) 2.1875rem;text-align:center}@media (pointer:coarse){.wallet-locked-view__content{padding:0 .75rem}}.wallet-locked-view__title{margin-top:.75rem}.wallet-locked-view__log-out{margin:.75rem auto 0}.merge-user-accounts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts__container{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__container{display:flex;flex-direction:column}@media (pointer:coarse){.merge-user-accounts-conflicts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__description{padding:0 1.5rem .75rem}.merge-user-accounts-conflicts__fields{display:flex;flex-direction:column;gap:1rem;max-height:22.5rem;overflow-y:auto;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__fields__item{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-conflicts__fields__item__button{padding:.5rem .75rem}.merge-user-accounts-conflicts__buttons{background:var(--dynamic-base-1);box-shadow:0 -8px 48px -8px rgba(109,121,165,.16);display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1.5rem}.merge-user-accounts-with-same-email__container{padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts-with-same-email__container{padding:0 .75rem}}.merge-user-accounts-with-same-email__accounts{align-items:center;display:flex;justify-content:space-between;margin:-1.5rem auto 1.5rem;max-width:270px;width:100%}.merge-user-accounts-with-same-email__accounts__item{align-items:center;display:flex;flex-direction:column;gap:.625rem;justify-content:center;width:100%}.merge-user-accounts-with-same-email__accounts__item__icon{height:3.5rem;width:3.5rem}.merge-user-accounts-with-same-email__accounts__divider{height:16px;margin-top:-1.5rem;width:16px}.merge-user-accounts-with-same-email__accounts__divider__icon>path{fill:var(--dynamic-text-secondary)}.merge-user-accounts-with-same-email__text{text-align:center}.merge-user-accounts-with-same-email__text__header{color:var(--dynamic-text-primary);margin-bottom:.5rem}.merge-user-accounts-with-same-email__text__body{color:var(--dynamic-text-secondary);margin-bottom:1rem}.merge-user-accounts-with-same-email__text--bold{font-weight:700}.merge-user-accounts-with-same-email__buttons{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-with-same-email__buttons__button{width:100%}.wallet-cannot-be-transferred-view__container{padding:var(--dynamic-modal-padding);text-align:center}.wallet-cannot-be-transferred-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-cannot-be-transferred-view__icon svg{margin:0 auto}.wallet-cannot-be-transferred-view__shorten-wallet-address{margin:0 0 1rem}.wallet-cannot-be-transferred-view__title{margin:0 0 .375rem}.wallet-cannot-be-transferred-view__copy{margin:0 0 .75rem}.wallet-cannot-be-transferred-view__transfer-alt-wallet-button{margin:0 0 1rem}.wallet-cannot-be-transferred-view__footer{margin:0 0 .5rem}.wallet-cannot-be-transferred-view__cancel{background:none;border:none;box-shadow:none;margin:auto}.user-field-editor__header{align-items:center;display:flex;flex-direction:column;gap:1.25rem;text-align:center}.user-field-editor__header__icon{align-items:center;background-color:var(--dynamic-base-2);border-radius:50%;display:flex;height:4rem;justify-content:center;width:4rem}.user-field-editor__body{align-items:center;display:flex;flex-direction:column;gap:.5rem;margin:0 1.5rem 1.5rem;text-align:center}.user-field-editor__body__subtitle{margin-block:-.375rem .5rem}.user-field-editor__body__form{width:100%}.passkey-intro-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-intro-view__header{display:flex;width:100%}.passkey-intro-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-intro-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-intro-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-intro-view__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-intro-view__log-out:hover{background-color:transparent}.passkey-intro-view__skip{color:var(--dynamic-text-secondary);font-size:.875rem;justify-content:center;line-height:1rem}.passkey-intro-view__skip:hover{background-color:transparent}.passkey-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-recovery-view__header{align-items:center;display:flex;justify-content:center;margin-bottom:-5rem;width:12.875rem}.passkey-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-recovery-view__input-valid{background:var(--dynamic-success-2)!important;border-color:var(--dynamic-success-1)!important}.passkey-recovery-view__input-valid,.passkey-recovery-view__input-valid~.input__label{color:var(--dynamic-success-1)!important}.passkey-recovery-view__form{display:flex;flex-direction:column;width:100%}.passkey-recovery-view__skip{justify-content:center;margin-top:1.5rem}.passkey-recovery-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-recovery-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-recovery-view__resend-code{align-items:center;display:flex;flex-direction:column}.passkey-recovery-view button.text-button:not(.passkey-recovery-view__skip){color:inherit}.edit-passkeys-widget-view,.edit-passkeys-widget-view__body{display:flex;flex-direction:column}.edit-passkeys-widget-view__body{flex:1;gap:.25rem;justify-content:space-between;margin-top:20px;padding:0 1.5rem 1.5rem}.edit-passkeys-widget-view__icon{height:100px;margin-left:auto;margin-right:auto;margin-top:-40px;width:100px}.edit-passkeys-widget-view__title{margin-left:auto;margin-right:auto;margin-top:20px}.passkey-new-domain-detected{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-new-domain-detected__header{align-items:center;display:flex;justify-content:center}.passkey-new-domain-detected__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-new-domain-detected__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-new-domain-detected__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-new-domain-detected__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-new-domain-detected__log-out:hover{background-color:transparent}.embedded-reveal-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.embedded-reveal-view__header{align-items:center;display:flex;justify-content:center}.embedded-reveal-view__zerodev-warning{background-color:var(--dynamic-error-1);border-radius:.5rem;margin-bottom:1rem;padding:1.25rem}.embedded-reveal-view__zerodev-warning__title-row{align-items:center;display:flex;margin-bottom:.5rem}.embedded-reveal-view__zerodev-warning__icon{flex-shrink:0;height:1.25rem;margin-right:.5rem;width:1.25rem}.embedded-reveal-view__zerodev-warning__link-button{background:none;border:none;cursor:pointer;display:inline;font:inherit;margin-left:.25rem;padding:0}.embedded-reveal-view__zerodev-warning .typography{color:inherit}.embedded-reveal-view__zerodev-warning .typography.underline{text-decoration:underline}.embedded-reveal-view__coinbase{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);color:var(--dynamic-text-secondary);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;overflow-wrap:break-word;padding:.75rem}.embedded-reveal-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.embedded-reveal-view__body__description{display:flex;justify-content:center;text-align:center}.embedded-reveal-view__body__badge{font-size:.75rem}.embedded-reveal-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.embedded-reveal-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.embedded-reveal-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.embedded-reveal-view__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.embedded-reveal-view__body__card__skeleton{border-radius:.75rem;height:3.75rem}.embedded-reveal-view__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.embedded-reveal-view__body__button{color:#fff}.embedded-auth-choice{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.embedded-auth-choice__header{align-items:center;display:flex;justify-content:center;width:100%}.embedded-auth-choice__skip-button{margin-top:-.25rem}.action-card{background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);display:flex;padding:1rem;text-align:left;transition:all .2s ease}.action-card:hover{box-shadow:var(--dynamic-button-shadow)}.action-card__icon{height:1.75rem;min-width:1.75rem;width:1.75rem}.action-card__icon,.action-card__icon path{fill:var(--dynamic-text-tertiary)}.action-card__action-icon{margin-left:auto;min-width:1rem;transform:rotate(180deg);width:1rem}.action-card__content{display:flex;flex-direction:column;gap:.25rem;margin-left:8px}.action-card__content__row{align-items:flex-start;display:flex;gap:.375rem}.action-card__content__row__badge--primary{background:var(--dynamic-brand-primary-color);color:var(--dynamic-base-2)}.embedded-auth-choice-cards{display:flex;flex-direction:column;gap:.625rem;width:100%}.auth-choice-info{align-items:flex-start;align-self:stretch;background:var(--default-base-2,#fff);border:1px solid var(--default-base-4,#e7e8ed);border-radius:12px;display:flex;flex-direction:column;gap:12px;justify-content:center;padding:16px 12px 12px}.auth-choice-info__container-item{display:flex;flex-direction:row;gap:.5rem;text-align:start}.select-hardware-wallet-view__container{align-items:stretch;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding)}.select-hardware-wallet-view__icon{height:6rem;margin:0 auto .75rem;width:4rem}.select-hardware-wallet-view__text{padding-bottom:1rem;text-align:center}.enter-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.enter-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.enter-password-view__body__icon{display:flex;justify-content:center;text-align:center}.enter-password-view__body__description{text-align:center}.enter-password-view__password-input__suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.wallet-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.wallet-redirect-view__container .wallet-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.wallet-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.create-password{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.create-password__body{display:flex;flex:1;flex-direction:column;gap:.5rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.create-password__body__header{align-items:center;display:flex;flex-direction:column;gap:1rem;padding:.5rem 0}.create-password__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.3125rem;max-height:21.875rem;overflow:auto;padding:.75rem}.create-password__progress-bar{display:flex;margin:8px 0}.create-password__progress-bar__element{background-color:var(--default-base-4,#e7e8ed);border-radius:24px;height:4px;margin:0 4px;width:100%}.create-password__progress-bar__element__1{background:var(--dynamic-error-1)}.create-password__progress-bar__element__2{background:var(--dynamic-alert-1)}.create-password__progress-bar__element__3{background:var(--dynamic-success-1)}.create-password__password-input__suffix{align-items:center;display:flex;gap:.375rem;margin-top:-.25rem}.create-password__password-input__suffix__icon{color:var(--dynamic-text-tertiary);height:1.375rem;width:1.375rem}.create-password__password-criteria-icon{height:.9375rem;width:.9375rem}.create-password__password-criteria-list{align-items:center;display:flex;gap:.5rem;margin:.125rem 0}.create-password__password-criteria-list__success{color:var(--dynamic-success-1)}.create-password__password-criteria-list__error{color:var(--dynamic-error-1)}.create-password__log-out{margin:0 auto}.save-password-suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.save-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.save-password-view__header{align-items:center;display:flex;justify-content:center}.save-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.save-password-view__body__icon{display:flex;justify-content:center;text-align:center}.save-password-view__body__badge{background-color:var(--default-alert-2,#faedd9);color:var(--dynamic-alert-1);font-size:.75rem}.save-password-view__body__description{text-align:center}.save-password-view__body__actions{display:flex;gap:8px;justify-content:space-between}.save-password-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.save-password-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.save-password-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.save-password-view__body__confirm-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.5rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:.625rem}.mpc-claim-intro{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.mpc-claim-intro__header{align-items:center;display:flex;justify-content:center}.mpc-claim-intro__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.mpc-claim-intro__body__description{display:flex;justify-content:center;text-align:center}.mpc-claim-intro__body__badge{font-size:.75rem}.mpc-claim-intro__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.mpc-claim-intro__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.mpc-claim-intro__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.mpc-claim-intro__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.mpc-claim-intro__body__card__skeleton{border-radius:.75rem;height:3.75rem}.mpc-claim-intro__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.mpc-claim-intro__body__button{color:#fff}#dyn-turnkey-export-container-id{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;overflow:auto;padding:.75rem}#dyn-turnkey-export-element-id{word-wrap:break-word;max-height:-moz-min-content;max-height:min-content;width:100%}.mfa-choose-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-choose-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-choose-device-view__button{box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.25rem;margin-top:.75rem;text-align:left}.mfa-choose-device-view__button__header{align-items:center;display:flex;justify-content:space-between;width:100%}.mfa-choose-device-view__button__description.mfa-choose-device-view__button__description{font-size:var(--dynamic-text-size-body-small)}.mfa-choose-device-view__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.mfa-choose-device-view__logout{margin-top:1.125rem}.mfa-secure-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-secure-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-secure-device-view__button,.mfa-secure-device-view__logout-button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.mfa-secure-device-view__loading-spinner{height:394px}.mfa-secure-device-view__qrcode{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin:1rem 0;padding:.75rem}.mfa-secure-device-view__qrcode .button-container{display:flex;gap:.5rem;justify-content:center;width:100%}.mfa-secure-device-view__qrcode .button-container svg path{fill-opacity:100%}.mfa-secure-device-view__qrcode .button-container .qr-code-button{height:2.375rem}.mfa-display-backup-codes-view__body{align-items:center;display:flex;flex-direction:column;gap:1rem;justify-content:center;padding:var(--dynamic-layout-content-padding);text-align:center}.mfa-display-backup-codes-view__warning{border-radius:var(--dynamic-border-radius);padding:.25rem .5rem}.mfa-display-backup-codes-view__loading-spinner{height:19.5rem}.mfa-display-backup-codes-view__codes{display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center}.mfa-display-backup-codes-view__code{background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-button-primary-border);border-radius:var(--dynamic-border-radius);color:var(--dynamic-text-secondary);padding:.75rem 1.125rem;text-align:center;width:8.75rem}.mfa-display-backup-codes-view__actions{display:flex;gap:.5rem;width:100%}.mfa-display-backup-codes-view__actions button{border-radius:calc(var(--dynamic-button-border-radius)/1.5)}.mfa-display-backup-codes-view__complete{display:flex;flex-direction:column;gap:.5rem;width:100%}.mfa-display-backup-codes-view__acknowledgement{border-radius:calc(var(--dynamic-button-border-radius)/1.5);justify-content:left}.mfa-display-backup-codes-view__acknowledgement .typography{font-size:var(--dynamic-text-size-button-secondary);font-weight:500}.mfa-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.mfa-recovery-view__body{padding:.3125rem,0}.mfa-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.mfa-recovery-view__get-help{padding:.3125rem,0}.mfa-verification-view__choose-another-method{display:flex;justify-content:center;margin-bottom:1.5rem;width:100%}.mfa-verification-view__choose-another-method-button{color:var(--dynamic-text-link)}.access-blocked__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.access-blocked__icon{margin-bottom:.3125rem}.access-blocked__content{margin:.9375rem 0;padding:0 .625rem .625rem;text-align:center}.switch-wallet{white-space:pre-line}.switch-wallet__body{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);margin-top:.625rem;padding:1rem 0;width:100%}.switch-wallet__body__divider{gap:0;padding:.75rem 0}.switch-wallet__body__divider svg{transform:rotate(90deg)}.switch-wallet__body__expected-address__prompt{margin-bottom:.5rem;margin-top:1rem}.switch-wallet__body__expected-address__address{font-size:1.5rem;line-height:1.25rem}.sync-wallet-view .qr-code-wrapper{padding-top:.5rem}.sync-wallet-view .prompt-modal-portal,.sync-wallet-view .prompt-modal-portal__container{position:relative}.mfa-qrcode-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.mfa-qrcode-help-content__vertical-container{background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.mfa-qrcode-help-content__setup-container{font-family:Arial,sans-serif;margin:0 auto;max-width:400px;width:100%}.mfa-qrcode-help-content__step{align-items:center;background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);color:gray;display:flex;flex-direction:row;height:100%;justify-content:flex-start;margin-bottom:.625rem;max-width:100%;padding:1rem}.mfa-qrcode-help-content__step__title{margin-bottom:.3125rem}.mfa-qrcode-help-content__step__number{align-items:center;align-self:flex-start;background-color:#e3ebff;border-radius:50%;color:#4779ff;display:flex;height:1.5rem;justify-content:center;margin-right:.625rem;min-width:1.5rem;width:1.5rem}.mfa-qrcode-help-content__step__nocopy-box{align-items:center;border:.0625rem solid #e0e0e0;border-radius:.3125rem;display:flex;justify-content:space-between;padding:.625rem}.mfa-qrcode-help-content__step__nocopy-text{word-break:break-all}.mfa-qrcode-help-content__copy-button{background-color:transparent;border:none;cursor:pointer}.sandbox-threshold__main{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.sandbox-threshold__title{color:var(--dynamic-text-primary);line-height:1.5rem;text-align:center}.sandbox-threshold__description{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-bottom:1.5rem;margin-top:.75rem;text-align:center}.sandbox-threshold__button{box-shadow:var(--dynamic-shadow-down-1)}.global-wallet-confirm .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;padding:24px}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-icon{height:64px;margin-bottom:16px;width:64px}.global-wallet-confirm .popup-content .wallet-connection-view .connection-title{color:var(--dynamic-text-primary);margin-bottom:16px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-url{color:var(--dynamic-text-secondary);margin-bottom:24px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;width:100%}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.connect-global-button{background-color:#3b82f6;color:#fff}.info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;gap:.75rem;padding:1.5rem;text-align:left}.inline-icon-text{display:inline}.inline-icon-text svg{display:inline-block;height:1em;margin:0 .25em;vertical-align:middle;width:1em}.nowrap{align-items:center;display:inline-flex;white-space:nowrap}.learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.malicious-site-view .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:24px;text-align:center}.malicious-site-view .popup-content .wallet-connection-view .header{align-items:center;display:flex;justify-content:center;margin-bottom:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .header .back-button{background:none;border:none;cursor:pointer;left:24px;padding:8px;position:absolute}.malicious-site-view .popup-content .wallet-connection-view .header h1{color:var(--dynamic-text-primary);margin:0}.malicious-site-view .popup-content .wallet-connection-view .warning-card{align-items:center;border-radius:8px;display:flex;flex-direction:column;justify-content:center;margin-bottom:16px;padding:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .warning-card .warning-icon{height:48px;margin-bottom:8px;width:48px}.malicious-site-view .popup-content .wallet-connection-view .connection-title{margin-top:16px}.malicious-site-view .popup-content .wallet-connection-view .site-info{color:var(--dynamic-text-secondary);padding:16px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container{border-radius:12px;display:flex;flex-direction:column;margin-top:16px;padding:16px;position:relative}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.definitely-malicious{background-color:var(--dynamic-error-2)}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.unknown{background-color:#f4d09a}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container{align-items:flex-start;display:flex;margin-bottom:4px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .caution-icon{height:24px;left:16px;position:absolute;top:16px;width:24px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .subtitle-header{flex:1;margin-bottom:0;margin-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle{margin-top:0;padding-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;margin-top:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.malicious-site-view .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.malicious-site-view .popup-content .wallet-connection-view .button-group button.proceed-button{background-color:inherit;box-shadow:none}.sign-message-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-bottom:1rem;width:100%}.sign-message-confirmation__body{align-items:stretch;display:flex;flex-direction:column;padding:.5rem 1.5rem 1.5rem}.sign-message-confirmation__message-container{align-items:center;background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);margin-bottom:.5rem;margin-top:.75rem;max-height:18.75rem;overflow-y:scroll;padding:.75rem;width:100%}.sign-message-confirmation__secure-wallet{margin-block:.5rem}.sign-message-confirmation__message{overflow-wrap:break-word;padding-top:.75rem}.sign-message-confirmation__title{text-align:center}.sign-message-confirmation__error{padding-top:.75rem}.bridge-welcome-layout{display:flex;flex-direction:column;gap:.75rem}.bridge-welcome-layout__body{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}.bridge-welcome-layout__message-container{display:flex;flex-direction:column;gap:.25rem;text-align:center}.bridge-welcome-layout__chain-icon-group{align-items:center;display:flex;flex-direction:row-reverse;padding-top:.875rem}.bridge-welcome-layout__chain-icon{background-color:var(--dynamic-base-1);border-radius:50%;height:4rem;margin-left:-1.375rem;outline:.25rem solid var(--dynamic-base-1);overflow:hidden;width:4rem}.bridge-welcome-layout__chain-icon:last-child{margin-left:0}.select-wallet-list-layout{display:flex;flex-direction:column;min-height:320px}.select-wallet-list-layout__wallet-list{display:flex;flex-direction:column;flex-grow:1;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow-y:auto;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout{display:flex;flex-direction:column}.connected-wallets-list-layout__body{display:flex;flex-direction:column;gap:1rem;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout__body__text{text-align:center}.bridge-next-wallet-to-connect-layout__chain-icon{height:4rem;margin:1rem 1rem 0;width:4rem}.bridge-next-wallet-to-connect-layout__body{align-items:center;display:flex;flex-direction:column;gap:1.5rem;padding:1rem 1.5rem 1.5rem;text-align:center}.account-control__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-control__icon{min-width:1rem}.account-control__social_icon{height:1rem;width:1rem}.account-control__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-primary);display:flex;gap:.375rem;min-height:100%;padding:.75rem;z-index:10}.account-control__container--multiwallet-disabled{border-bottom-left-radius:0;border-top-left-radius:0}.account-control__container--active,.account-control__container:hover{background-color:var(--dynamic-hover)}.dynamic-widget-inline-controls{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;font-size:var(--dynamic-text-size-body-small);max-height:2.5rem;min-width:100%;position:relative}.dynamic-widget-inline-controls__network-picker-main{min-width:60px}.dynamic-widget-inline-controls__account-control{max-width:100%;min-width:max(100%,45px)}.dynamic-widget-inline-controls__account-control .account-control__icon{margin-left:auto}.dynamic-widget-inline-controls__account-control-container{min-width:60px;overflow:hidden}.dynamic-widget-inline-controls__network-picker{background:unset;border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-bottom-right-radius:unset;border-top-left-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:unset;min-width:100%;padding:.75rem;position:unset;transform:unset}.dynamic-widget-inline-controls__network-picker--active,.dynamic-widget-inline-controls__network-picker:hover{background:var(--dynamic-hover)}.dynamic-widget-inline-controls__network-picker-checkbox{margin:0 0 0 .5rem}.dynamic-widget-inline-controls__network-picker-list{top:2.5rem}@media (pointer:coarse){.dynamic-widget-inline-controls__network-picker-list{top:unset}}.dynamic-widget-dropdown{position:absolute;right:0;top:3.0625rem}.dynamic-widget-dropdown__root{min-width:22.5rem}.dynamic-widget-modal{left:50%;margin:0 auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:min(100%,22.5rem)}@media (pointer:coarse){.dynamic-widget-modal{bottom:0;top:unset;transform:translate(-50%);width:100%}}.dynamic-widget-card{background-color:var(--dynamic-base-1);border:.0625rem solid var(--dynamic-base-4);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);height:100%;position:relative;transition:max-height .1s linear}@media (pointer:coarse){.dynamic-widget-card{border-bottom-left-radius:0;border-bottom-right-radius:0}}.dynamic-widget-header{padding:1.5rem 1.5rem 0;position:relative}.dynamic-widget-header__switcher{margin:0 0 1rem}.dynamic-widget-header__passkey-success{margin-inline:-1.5rem}.dynamic-widget-wallet-header{position:relative}.dynamic-widget-wallet-header__email{color:var(--dynamic-text-primary);margin:.5rem 0;text-align:center}.dynamic-widget-wallet-header__icon-container{height:4rem;margin:auto;position:relative;width:4rem}.dynamic-widget-wallet-header__icon-container img,.dynamic-widget-wallet-header__icon-container svg{height:100%;width:100%}.dynamic-widget-wallet-header__wallet-info{align-items:center;display:flex;flex-direction:column;justify-content:center;margin:0 0 1rem}.dynamic-widget-wallet-header__wallet-info .text-button{padding:0}.dynamic-widget-wallet-header__wallet-info__secure-wallet{margin-bottom:0;margin-top:1rem}.dynamic-widget-wallet-header__wallet-address{align-items:center;display:flex;justify-content:center}.dynamic-widget-wallet-header__balance{margin-bottom:.0625rem}.dynamic-widget-wallet-header__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.dynamic-widget-wallet-header__status-dot{margin-right:.375rem}.dynamic-widget-wallet-header__ens-name{max-width:12.5rem}.dynamic-widget-wallet-header__network-picker.evm-network-control__container{height:1.5rem}.dynamic-widget-wallet-header__network-picker.non-network-switching-supported-control{height:1.5rem;width:1.5rem}.dynamic-widget-wallet-header__network-picker.network-control-skeleton{bottom:0;height:1.5rem;position:absolute;right:0;width:1.5rem}.dynamic-widget-wallet-header__network-picker .evm-network-control__network-name,.dynamic-widget-wallet-header__network-picker .non-network-switching-supported-control__network-name{display:none}.dynamic-widget-wallet-header__wallet-avatar{border-radius:100%;overflow:hidden}.dynamic-widget-wallet-header__wallet-avatar img{height:4rem;width:4rem}.dynamic-widget-wallet-header__wallet-actions{align-items:center;display:flex;gap:.5rem;justify-content:stretch;margin-top:.5rem;width:100%}.dynamic-widget-wallet-header__wallet-loading{margin-bottom:.5rem;margin-top:.5rem;width:100%}.empty-wallet__container{align-items:center;background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.75rem;justify-content:center;padding:.5rem;text-align:center;width:100%}.empty-wallet__container--big{margin:0 0 1rem;padding:.75rem}.empty-wallet__icon{height:1.5rem;width:1.5rem}.empty-wallet__icon--big{height:3rem;width:3rem}.empty-wallet__icon>path{fill:var(--dynamic-text-tertiary)}.empty-wallet__text-container{max-width:10rem}.wallet__container{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:row;padding:.75rem}.wallet__container:not(:last-child){border-bottom-left-radius:0;border-bottom-right-radius:0;margin-bottom:-.75rem;padding-bottom:1.5rem}.wallet__container:hover .wallet__menu{opacity:1}.wallet__menu{color:var(--dynamic-text-tertiary);opacity:0;transition:opacity .15s ease-in-out}@media (pointer:coarse){.wallet__menu{opacity:1}}.wallet__row{align-items:center;display:flex;flex:1}.wallet__row__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.wallet__icon-container{margin-right:.375rem}.wallet__ens-name{max-width:9.375rem}.wallet__actions{max-height:0;overflow:hidden;transition:max-height .3s ease-in-out}.wallet__actions__expanded{max-height:6.25rem}.wallet__actions__inner{padding-top:.75rem}.dynamic-widget-footer{border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);border-top:.0625rem solid var(--dynamic-base-4);color:var(--dynamic-text-primary);display:flex;gap:.5rem;margin-top:auto;padding:1rem 1.5rem}.dynamic-widget-footer__button:hover:enabled svg{color:var(--dynamic-text-secondary)}.dynamic-widget-footer__button svg{color:var(--dynamic-text-tertiary)}.dynamic-widget-footer__button-align-right{margin-left:auto}@media (pointer:coarse){.dynamic-widget-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}}.wallet-icon-with-status__container{position:relative}.wallet-icon-with-status__dot-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;height:.75rem;justify-content:center;position:absolute;right:0;width:.75rem}.wallet-icon-with-status__dot-container .dot{background-color:var(--dynamic-error-1);border-radius:100%;bottom:0;height:.5rem;right:0;width:.5rem}.wallet-icon-with-status__dot-container .dot--green{background-color:var(--dynamic-success-1)}.wallet-icon-with-status__dot-container--secondary{bottom:0;height:.625rem;right:0;transform:translate(25%,25%);width:.625rem}.wallet-icon-with-status__dot-container--secondary .dot{height:.375rem;width:.375rem}.wallet-icon-with-network__container{position:relative}.wallet-icon-with-network__network-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:-.1875rem;display:flex;height:.75rem;justify-content:center;position:absolute;right:-.1875rem;width:.75rem}.dots-menu-dropdown__container{padding:.375rem 0}.dots-menu-dropdown__item{align-items:center;cursor:pointer;display:flex;font-size:var(--dynamic-text-size-body-small);gap:.5rem;padding:.5rem .75rem;width:100%}.dots-menu-dropdown__item .typography{white-space:nowrap}.dots-menu-dropdown__item__end-slot{position:absolute;right:.75rem}.dots-menu-dropdown__item:hover{background-color:var(--dynamic-hover)}.dots-menu-dropdown__item:hover .typography{color:var(--dynamic-text-primary)}@media (pointer:coarse){.dots-menu-dropdown__item{font-size:var(--dynamic-text-size-body-normal)}}.dots-menu-dropdown__item-text{align-items:center;display:flex;gap:.5rem}@keyframes desktop-dropdown-entering-animation{0%{opacity:0;transform:scale(.8) translateY(0)}70%{transform:scale(1) translateY(0)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes desktop-dropdown-exiting-animation{0%{opacity:1;transform:scale(1) translateY(0)}25%{opacity:1}50%{transform:scale(1.01) translateY(0)}to{opacity:0;transform:scale(1.02) translateY(1.875rem)}}@keyframes mobile-dropdown-entering-animation{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes mobile-dropdown-exiting-animation{0%{transform:translateY(0)}50%{transform:translateY(0)}to{transform:translateY(200%)}}.dots-menu-wrapper{position:relative}.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-entering-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-exiting-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container{background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);margin-top:.5rem;position:absolute;right:0;z-index:2147483647}.dots-menu-wrapper__container__alignment__top{bottom:1.375rem}.dots-menu-wrapper__container__alignment__bottom{top:1.375rem}@media (min-width:768px){.dots-menu-wrapper__container{min-width:9.375rem}}@media (pointer:coarse){.dots-menu-wrapper__container{border:none;border-radius:var(--dynamic-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:calc(50% - 18.75rem);margin:auto;max-width:37.5rem;padding-bottom:2rem;padding-top:0;position:fixed;right:calc(50% - 18.75rem);top:unset;width:100%}}.dots-menu-wrapper__header{display:none;padding:.75rem 1.5rem .25rem}@media (pointer:coarse){.dots-menu-wrapper__header{align-items:center;display:flex;justify-content:space-between}}.dots-menu-wrapper__header__icon{min-height:1.5rem;min-width:1.5rem}.dots-menu-wrapper__backdrop{cursor:default;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10}@media (pointer:coarse){.dots-menu-wrapper__backdrop{background-color:var(--dynamic-overlay);display:block}}.dynamic-widget-wallets-header{display:flex;flex-direction:row;justify-content:space-between;margin:0 1.5rem}.dynamic-widget-wallets-header__title{margin:0 0 .5rem}.dynamic-widget-wallets-header__add_wallet{display:flex;margin:0 0 .5rem}.dynamic-widget-wallets{margin:0 1.5rem;overflow:auto}.dynamic-widget-wallets__body{display:flex;flex-direction:column;gap:1rem}.dynamic-widget-wallets__body__wallet-list{max-height:13rem}.widget-portal{background-color:var(--dynamic-overlay);top:0;z-index:50}.widget-portal,.widget-portal__container{border-radius:calc(var(--dynamic-border-radius)/1.5);bottom:0;left:0;position:absolute;right:0}.widget-portal__container{background-color:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);padding:1.5rem}@media (pointer:coarse){.widget-portal__container{border-bottom-left-radius:0;border-bottom-right-radius:0}}.widget-portal__container--no-padding{padding:0}.widget-portal__container__header{position:relative}.widget-portal__container__close-button{position:absolute;right:0}.single-wallet-buttons{display:flex;gap:.625rem;padding:0 1.5rem 1.5rem}.single-wallet-buttons--center{align-items:center;display:flex;justify-content:center}.single-wallet-buttons__copied{align-items:center;display:flex;gap:8px}.single-wallet-buttons__copied svg{color:var(--dynamic-success-1)}.email-connector-pending-sign-modal-content{align-items:center;display:flex;flex-direction:column;text-align:center;width:100%}.email-connector-pending-sign-modal-content__body{align-items:center;display:flex;flex-direction:column;gap:.5rem}.active-wallet-information{border-bottom:1px solid var(--dynamic-base-3);display:flex;flex-flow:column;gap:.5rem;padding:.75rem}.active-wallet-information__header{display:flex;gap:.5rem}.active-wallet-information__handle{max-width:80px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__handle--full-width{max-width:230px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.active-wallet-information__dots-menu .icon-with-status__container{margin-bottom:0}.active-wallet-information__dots-menu .icon-with-status__container .status-dot__container{right:-.05rem;top:-.05rem}.active-wallet-information-container{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2)}.active-wallet-information__details{display:flex;flex:1;gap:.5rem;justify-content:space-between;overflow:hidden}.active-wallet-information__avatar img{height:2rem;min-height:2rem;min-width:2rem;width:2rem}.active-wallet-information__avatar__name-service{align-items:center;border-radius:100%;display:flex;overflow:hidden}.active-wallet-information__addresses-container{display:flex;flex-direction:column;gap:.5rem}.active-wallet-information__addresses-container--centered{justify-content:center}.active-wallet-information__address-container{display:flex}.active-wallet-information__address{align-items:center;display:flex}.active-wallet-information__address-skeleton{width:60px}.active-wallet-information__network-picker{overflow:hidden}.active-wallet-information__network-picker-button{border:1px solid var(--dynamic-base-4);height:100%;position:relative;transform:translateX(0)}.active-wallet-information__network-picker-button:hover{background:var(--dynamic-hover)}.balance-header{justify-content:space-between;padding:1rem .75rem;width:100%}.balance-header,.balance-header__title{align-items:center;display:flex}.balance-header__chevron{rotate:180deg}.balance-header__skeleton{display:table-cell;width:2.5rem}.balance-container{align-items:center;display:flex;justify-content:space-between;padding:1rem .75rem;position:relative}.balance-container__skeleton{display:table-cell;width:2.5rem}.multi-asset-balance-container{align-items:center;position:relative}.multi-asset-balance-container .shadow{border-bottom:1px solid var(--dynamic-base-3)}.multi-asset-balance-container__accordion{overflow-y:auto}.multi-asset-balance-container__accordion--collapsed{max-height:0!important}.multi-asset-balance-container__accordion--expanded{height:100%!important;max-height:11.25rem!important}.prompt-modal{padding:1.5rem}.prompt-modal__header{position:relative;width:100%}.prompt-modal__close-button{position:absolute;right:1rem;top:1rem}.balance-skeleton{display:table-cell;width:1.875rem}.token-balance-item{justify-content:space-between;padding:8px 0;width:100%}.token-balance-item,.token-balance-item__name{align-items:center;display:flex}.token-balance-item__title{max-width:8.4375rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-balance-item__icon,.token-balance-item__skeleton-icon{border-radius:100%;height:20px;margin-right:6px;overflow:hidden;width:20px}.token-balance-item__skeleton-icon{background-color:var(--dynamic-base-3)}.token-balance-item__value,.token-balance-item__value__balance{display:flex}.token-balance-list{padding:0 .75rem .75rem}.token-balance-list__empty{align-items:center;display:flex;justify-content:center;padding:.625rem}.token-balance-list__divider{padding:0}.footer-options-switcher__container{background-color:var(--dynamic-base-2);border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);display:flex;justify-content:space-around;margin-top:auto;padding:.75rem 0}.footer-options-switcher__label{font-size:12px;margin-top:.25rem}.footer-options-switcher__tab{align-items:center;color:var(--dynamic-text-secondary);cursor:pointer;display:flex;flex-direction:column;text-align:center}.footer-options-switcher__tab--active{color:var(--dynamic-text-primary)}.dynamic-widget-index-view__email-container{display:flex;flex-direction:column;gap:1rem;text-align:center}.dynamic-widget-index-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-index-view__user-profile{margin:0 0 1rem;padding:0 1.5rem}.dynamic-widget-index-view__user-profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.profile-view{flex:1;overflow:auto;padding:0 1.5rem 1.5rem}.profile-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-edit-profile-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.dynamic-widget-edit-profile-view__fields{flex:1;overflow:auto;padding:0 1.5rem 1rem}.dynamic-widget-edit-profile-view__profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.send-balance-widget-view{display:flex;flex:1;flex-direction:column;max-width:22.5rem;overflow:auto}.send-balance-widget-view__spinner{align-items:center;display:flex;flex:1;justify-content:center}.passkey-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);padding:.75rem;width:100%}.passkey-card__body{display:flex;flex-direction:row;justify-content:space-between}.passkey-card__left{align-items:center;display:flex;gap:.5rem}.passkey-card__info{align-items:center;border-bottom:1px solid var(--dynamic-base-4);gap:.5rem;padding-bottom:.5rem}.passkey-card__info__icon{justify-self:start;width:1.5rem}.passkey-card__info__tooltip{display:none}@media (hover:none),(pointer:coarse){.passkey-card__info__tooltip{background-color:#555;border:1px solid;border-radius:6px;color:#fff;display:block;font-size:12px;opacity:0;padding:3px;position:absolute;transition:opacity .5s;visibility:hidden;width:-moz-fit-content;width:fit-content}.passkey-card__info__tooltip--visible{opacity:1;transition:opacity .3s;visibility:visible}}.passkey-card__date{padding-top:.5rem}.manage-passkeys-widget-view,.manage-passkeys-widget-view__body{display:flex;flex:1;flex-direction:column}.manage-passkeys-widget-view__body{gap:1rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.manage-passkeys-widget-view__body__cards{display:flex;flex:1;flex-direction:column;gap:.5rem;max-height:23.75rem;overflow:auto}.manage-passkeys-widget-view__body__cards__skeleton{border-radius:.75rem;height:3.75rem}.manage-passkeys-widget-view__reveal{display:flex;flex:1;flex-direction:column;gap:.5rem}.manage-passkeys-widget-view__reveal-helper-text{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.manage-passkeys-widget-view__reveal-button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.manage-passkeys-widget-view__reveal-button__start-slot{align-items:center;display:flex;font-size:.9375rem}.manage-passkeys-widget-view__reveal-button__icon{color:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.5rem}.manage-passkeys-widget-view__reveal-button__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg)}.settings-view{display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem}.settings-view__logout-button-container{bottom:60px;color:var(--dynamic-text-secondary);width:100%}.settings-view__logout-button-container__button{width:100%}.settings-view__header{align-items:center;display:flex;gap:.5rem}.settings-view__body{display:flex;flex-direction:column;gap:1rem;height:100%;margin-bottom:1.5rem;overflow-y:auto}.settings-view__body__section{display:flex;flex-direction:column;gap:.75rem}.settings-view__body__section__title{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.settings-view__body__section__title__info-icon{align-items:center;display:flex;gap:5px}.settings-view__body__section__title__info-icon svg path{fill:var(--dynamic-alert-1)}.settings-view__body__section__button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.settings-view__body__section__button__start-slot{align-items:center;display:flex;font-size:.9375rem}.settings-view__body__section__button__badge .badge__container.badge__container__secondary{margin-left:.625rem}.settings-view__body__section__button__icon{color:var(--dynamic-text-tertiary);height:1.75rem!important;margin-right:.625rem;width:1.75rem!important}.settings-view__body__section__button__icon.email{color:transparent}.settings-view__body__section__button__icon__stroke{stroke:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.625rem;width:1.75rem}.settings-view__body__section__button__icon-secondary{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--success{color:var(--dynamic-success-1);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.manage-mfa-widget-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.manage-mfa-widget-view__description-container{background:var(--dynamic-base-4)}.manage-mfa-widget-view__description-container__text{margin:.625rem}.manage-mfa-widget-view__add-mfa-button-container{bottom:60px;padding:.625rem 1.5rem 1.5rem;width:100%}.manage-mfa-widget-view__add-mfa-button-container__button{width:100%}.manage-mfa-widget-view__no-devices{align-items:center;display:flex;flex-direction:column;gap:1rem;height:100%;justify-content:center;padding:1rem}.manage-mfa-widget-view__scroll-container{flex:1;overflow-y:auto;padding:.625rem 1.5rem 1.5rem}.manage-mfa-widget-view__list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.manage-mfa-widget-view__list-tile__icon{height:1.5rem;position:relative;width:1.5rem}.manage-mfa-widget-view__list-tile__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.manage-mfa-widget-view__list-tile__details__title{display:flex;flex-direction:row;gap:.25rem}.manage-mfa-widget-view__list-tile__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.connect-dapps-view{max-width:400px;padding:1.5rem;position:relative}.connect-dapps-view .header{align-items:center;display:flex;justify-content:space-between;margin-bottom:1rem;position:relative}.connect-dapps-view .header h1{flex-grow:1;margin:0 auto;text-align:center}.connect-dapps-view .header button{background:none;border:none;cursor:pointer;padding:.5rem;position:absolute;top:50%;transform:translateY(-50%)}.connect-dapps-view .header button:first-child{left:0}.connect-dapps-view .header button:last-child{right:0}.connect-dapps-view .scanner-wrapper{aspect-ratio:1/1;height:200px;margin-left:-24px;margin-right:-24px;overflow:hidden;position:relative;width:calc(100% + 48px)}.connect-dapps-view .scanner-wrapper video{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.connect-dapps-view .scanner-overlay{align-items:center;bottom:0;display:flex;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0}.connect-dapps-view .scanner-frame{border-radius:12px;height:80%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}.connect-dapps-view .corner{border:4px solid #fff;height:16px;position:absolute;width:16px}.connect-dapps-view .top-left{border-bottom:none;border-right:none;border-top-left-radius:8px;left:-3px;top:-3px}.connect-dapps-view .top-right{border-bottom:none;border-left:none;border-top-right-radius:8px;right:-3px;top:-3px}.connect-dapps-view .bottom-left{border-bottom-left-radius:8px;border-right:none;border-top:none;bottom:-3px;left:-3px}.connect-dapps-view .bottom-right{border-bottom-right-radius:8px;border-left:none;border-top:none;bottom:-3px;right:-3px}.connect-dapps-view .scanner-overlay-content{align-items:center;border-radius:8px;display:flex;flex-direction:column;padding:16px;z-index:1}.connect-dapps-view .scanner-icon{height:20px;margin-bottom:2px;-o-object-fit:contain;object-fit:contain;width:20px}.connect-dapps-view .info-card,.connect-dapps-view .wallet-connect-card{margin-bottom:1rem;position:relative}.connect-dapps-view .wallet-connect-card{align-items:center;display:flex;flex-direction:column}.connect-dapps-view .wallet-connect-card h2{align-self:flex-start;margin-bottom:.5rem;width:100%}.connect-dapps-view .input-group{width:100%}.connect-dapps-view .input-suffix{transform:translateY(-20%)}.connect-dapps-view .banner{border-radius:8px;margin-top:.5rem;padding:6px;text-align:center;width:100%}.connect-dapps-view .banner.success{background-color:var(--dynamic-success-2)}.connect-dapps-view .banner.error{background-color:var(--dynamic-error-2)}.connect-dapps-view .info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;padding:1.5rem;text-align:left}.connect-dapps-view .info-card .learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.connect-dapps-view .info-card .learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.connect-dapps-view .inline-logo-text{align-items:center;display:flex;flex-wrap:nowrap}.connect-dapps-view .inline-logo-text .inline-logo{flex-shrink:0;margin:0 4px}.connected-apps-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem;position:relative}.connected-apps-view .header{align-items:center;display:flex;justify-content:space-between;padding-bottom:.25rem;position:relative}.connected-apps-view .header .title{flex-grow:1;text-align:center}.connected-apps-view .header .arrow-left-icon{transform:rotate(90deg)}.connected-apps-view .subheader{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-bottom:.25rem;position:relative;text-align:center}.connected-apps-view .connected-apps-list{display:flex;flex-direction:column;gap:.75rem;list-style-type:none;margin:0;padding:0}.connected-apps-view .connected-app-item{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;padding:.75rem}.connected-apps-view .connected-app-item .app-icon{border-radius:50%;height:2rem;margin-right:.75rem;width:2rem}.connected-apps-view .connected-app-item .app-info{display:flex;flex:1;flex-direction:column}.connected-apps-view .connected-app-item .app-actions{display:flex;gap:.5rem;margin-left:10px}.connected-apps-view .success-message{align-items:center;background-color:var(--dynamic-success-2);border:1px solid var(--dynamic-border-1);border-radius:.5rem;display:flex;padding:.75rem;text-align:left}.connected-apps-view .success-message svg{color:#30a67b;flex-shrink:0;height:1.5rem;margin-right:.75rem;width:1.5rem}.default-prompt-modal{align-items:center;display:flex;flex-direction:column;text-align:center}.default-prompt-modal__icon-with-spinner{margin:0 auto .75rem}.default-prompt-modal__content{flex-direction:column;width:100%}.default-prompt-modal__button .typography,.default-prompt-modal__content{align-items:center;display:flex;gap:.375rem;justify-content:center}.detected-new-wallet-modal__content{align-items:center;display:flex;flex-direction:column;gap:.75rem;text-align:center}.detected-new-wallet-modal__top-section{align-items:center;display:flex;flex-direction:column;gap:1.125rem;text-align:center}.no-qr-code-not-installed-modal-view{align-items:center;display:flex;flex-direction:column;gap:1rem}.no-qr-code-not-installed-modal-view__links-section{width:100%}.qr-code-modal-view{display:flex;flex-direction:column;gap:.5rem}.qr-code-modal-view__title{text-align:center}.qr-code-modal-view .qrcode__container{height:10.9375rem;width:10.9375rem}.qr-code-modal-view__container{align-items:center;display:flex;justify-content:center}.qr-code-modal-view__wrapper{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*3/4);padding:.5rem}.qr-code-modal-view .info-item{margin-bottom:.75rem}.qr-code-modal-view .info-item__text{font-size:var(--dynamic-text-size-body-small)}.qr-code-modal-view .info-item svg path{fill:var(--dynamic-text-secondary)}.qr-code-modal-view .button__container{flex-direction:column}.qr-code-modal-view .button__container,.qr-code-modal-view .button__container span{align-items:center;display:flex;gap:.375rem}.unlink-wallet-popup__container{align-items:center;display:flex;flex-direction:column;width:100%}.unlink-wallet-popup__button,.unlink-wallet-popup__label,.unlink-wallet-popup__title{text-align:center}.unlink-wallet-popup__title{padding-bottom:.5rem}.unlink-wallet-popup__label{padding-bottom:.5rem;padding-top:.5rem}.unlink-wallet-popup__button{margin-top:.5rem}.unlink-wallet-popup__button--shadow{box-shadow:var(--dynamic-shadow-down-1)}.dynamic-widget__container{z-index:2147483646}.fund-wallet__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:rgba(0,0,0,.25);inset:0;position:fixed;z-index:2147483645}.fund-wallet__modal-container{align-items:center;display:flex;inset:0;justify-content:center;overflow-y:auto;padding:1rem;position:fixed;z-index:2147483646}@media (pointer:coarse){.fund-wallet__modal-container{padding:0}}.fund-wallet__modal{border-radius:1.5rem;margin:auto;max-width:470px;overflow:hidden;width:100%}@media (pointer:coarse){.fund-wallet__modal{border-bottom-left-radius:0;border-bottom-right-radius:0;margin:initial;margin-top:auto}}.fund-wallet__modal-content{text-align:center}#onramp-iframe{border:none;height:635px;width:100%;z-index:2147483647}.embedded-widget{max-width:100%;width:var(--dynamic-modal-width)}.embedded-widget--background-default,.embedded-widget--background-none{background:none}.dynamic-bridge-user-profile__switcher{margin:0 0 1rem;padding:1.5rem 1.5rem 0}.dynamic-bridge-wallet-card__network{margin:0 0 .5rem}.dynamic-bridge-wallet-card__network,.dynamic-bridge-wallet-card__network-icon,.dynamic-bridge-wallet-card__network-name{display:inline-block;vertical-align:middle}.dynamic-bridge-wallet-card__network-icon{height:1rem;margin-right:.375rem;width:1rem}.dynamic-bridge-widget-empty-card{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);padding:.75rem;transition:transform .1s linear}.dynamic-bridge-widget-empty-card:active{transform:scale(.98)}.dynamic-bridge-widget-empty-card__icon{display:inline-flex;height:1.75rem;margin-right:.63rem;vertical-align:middle;width:1.75rem}.dynamic-bridge-widget-empty-card__text{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.dynamic-bridge-widget-wallets-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem}.dynamic-bridge-widget-wallets-view__logout-button{margin:0 auto}.dynamic-bridge-widget-wallets-view__unlink-button{color:var(--dynamic-text-secondary);margin:auto 0 0 auto}.footer-buttons-item{align-items:center;background:var(--dynamic-base-2);border:0;border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);cursor:pointer;display:flex;padding:.75rem;transition:all .3s;width:100%}.footer-buttons-item__icon--left{margin-right:.625rem}.footer-buttons-item__icon--left img,.footer-buttons-item__icon--left svg{height:1.25rem;width:1.25rem}.new-to-web3-buttons__container{margin-top:1rem}.new-to-web3-buttons__container button{background:var(--dynamic-brand-primary-color);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:.75rem;width:100%}.walletlist-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.walletlist-help-content__icon{align-items:center;display:flex;height:3.5rem;justify-content:center;margin:0 auto;width:3.5rem}.walletlist-help-content__typography-wrapper{color:var(--dynamic-text-primary);margin:1rem 0;text-align:center}.walletlist-help-content__typography-wrapper .walletlist-help-content__typography--label{margin-top:.375rem}.walletlist-help-content__buttons-wrapper{display:flex;flex-direction:column;gap:.375rem;margin-top:1rem}.walletlist-help-content__buttons-wrapper button{text-align:left;width:100%}.walletlist-help-content__custodial-wallet-area--title{margin:.75rem 0;text-align:center}.footer-more-info-content__wrapper{display:flex;flex-direction:column;gap:.75rem;padding:1.5rem}.footer-more-info-content__item--phantom-ledger{font-size:.6875rem;margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p{margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p:last-child,.footer-more-info-content__item:last-child{margin-bottom:0}.back-button{rotate:-90deg}.help-header{border-bottom:1px solid var(--dynamic-base-4)}.passkey-info-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.passkey-info-help-content__typography-wrapper{color:var(--dynamic-text-primary);display:flex;flex-direction:column;gap:1rem;text-align:left}.passkey-info-help-content__wrapper{flex:1}.passkey-info-help-content__details{display:flex;flex-direction:row;gap:1rem}.header__skeleton{width:7.5rem}.header__typography{margin:0;text-align:center}.header__typography img,.header__typography svg{display:inline-block}.header__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.header__icon svg{height:1.5rem;width:1.5rem}.tos-and-pp__footer{background:var(--dynamic-footer-background);border-top:var(--dynamic-footer-border-top);bottom:0;padding:var(--dynamic-footer-padding);position:relative;width:100%}.default-footer__footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible;width:100%}.default-footer__footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-progress-stepper{padding:.5rem 1rem}.dynamic-user-profile-layout{display:flex;flex-direction:column;height:33.125rem;overflow:hidden}.dynamic-user-profile-layout--unset-max-height{height:unset}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{box-shadow:unset!important}.dynamic-modal{display:flex;flex-direction:column-reverse;left:50%;letter-spacing:0;position:absolute}.dynamic-shadow-dom-content{font-family:var(--dynamic-font-family-primary)}';const LegacySafariCssOverrides=()=>jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:"https://app.dynamic.xyz/assets/legacySafari/styles.css"}),isShadowDOMFlagEnabled=()=>{if(isSSR())return!1;const Xr="shadowDOM.enabled",eo=new URLSearchParams(window.location.search);return eo.has(Xr)?eo.get(Xr)==="true":!0},ShadowDOMContext=React.createContext({}),useShadowDOMContext=()=>React.useContext(ShadowDOMContext),ShadowDOMStyle=()=>jsxRuntimeExports.jsx("style",{children:css_248z$1}),ShadowDOM=({mode:Xr="open",id:eo,className:to,children:ro,dataTestId:no,zIndex:io})=>{const{shadowDOMEnabled:oo,cssOverrides:ao}=useInternalDynamicContext(),co=isShadowDOMFlagEnabled()&&oo,[lo,fo]=reactExports.useState(null),[ho,go]=reactExports.useState(),yo=reactExports.useMemo(()=>ao&&typeof ao!="string"?()=>ao:ao&&typeof ao=="string"?()=>jsxRuntimeExports.jsx("style",{children:ao}):null,[ao]);reactExports.useLayoutEffect(()=>{if(lo&&co)try{const wo=lo.attachShadow({mode:Xr});go(wo)}catch{}},[co,lo,Xr]);const vo=!!Object.keys(css_248z$1).length;return co?jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(ShadowDOMContext.Provider,{value:{shadowRoot:ho},children:jsxRuntimeExports.jsx("div",{"data-testid":no,ref:fo,id:eo,className:classNames("dynamic-shadow-dom",to),style:{zIndex:io},children:ho&&reactDomExports.createPortal(jsxRuntimeExports.jsxs("div",{className:"dynamic-shadow-dom-content",children:[ro,vo&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),yo&&jsxRuntimeExports.jsx(yo,{})]}),ho)})})}):jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsxs("div",{"data-testid":no,ref:fo,id:eo,className:classNames("dynamic-shadow-dom",to),style:{zIndex:io},children:[ro,vo&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),yo&&jsxRuntimeExports.jsx(yo,{})]})})},useUserDataForm=({onSubmit:Xr,onError:eo,userProfile:to,shouldEnforcePolicies:ro=!0,fields:no})=>{var io;const{mockedSDK:oo}=useMockContext(),[ao,so]=reactExports.useState(!1),{fieldsConfig:co}=useFields(),lo=ro&&((io=no.find(vo=>vo.name==="policiesConsent"))===null||io===void 0?void 0:io.enabled),fo=vo=>`${vo.charAt(0).toUpperCase()+vo.slice(1)} is required`,ho=reactExports.useMemo(()=>create$4().shape(Object.fromEntries(no.map(({name:vo,required:wo,type:Eo,validationType:ko,validationRules:Ao})=>{let Po=Eo===KycFieldType.Custom?getValueByKey(customFieldValidationMap,ko):getValueByKey(co,vo).validation;return Eo===KycFieldType.Custom&&Ao&&(ko===CustomFieldType.Select||ko===CustomFieldType.Text)&&(Po=Po,Ao.validOptions?Po=Po.oneOf(Ao.validOptions.map(jo=>jo.label),"Select a valid option"):Ao.regex&&(Po=Po.matches(new RegExp(Ao.regex),"Invalid field format"))),[vo,wo?Po.required(fo(vo)):Po]}))),[no]),go=reactExports.useMemo(()=>Object.fromEntries(no.map(({name:vo,type:wo,validationRules:Eo,validationType:ko})=>{var Ao,Po,jo,Mo;const No=to??{};if(wo===KycFieldType.Custom){let Xo="";return ko===CustomFieldType.Select&&(Eo!=null&&Eo.validOptions)&&(Xo=(Ao=Eo.validOptions[0].label)!==null&&Ao!==void 0?Ao:""),[vo,(()=>{var Lo;const Bo=No.metadata?getValueByKey(No.metadata,vo):void 0;return Array.isArray(Bo)?Bo:(Lo=Bo==null?void 0:Bo.toString())!==null&&Lo!==void 0?Lo:Xo})()]}const Fo=(Po={country:countryCodes[0].code,policiesConsent:!1,tShirtSize:tShirtSizes[0],team:teamNames[0]}[vo])!==null&&Po!==void 0?Po:"";return[vo,(Mo=(jo=getValueByKey(No,vo))===null||jo===void 0?void 0:jo.toString())!==null&&Mo!==void 0?Mo:Fo]}))||{},[no,to]),yo=reactExports.useCallback((vo,wo)=>__awaiter$j(void 0,void 0,void 0,function*(){const Eo={},ko={};if(!oo)try{if(!(to!=null&&to.environmentId))throw new DynamicError("Invalid environment ID");so(!0);let Ao=vo;Object.entries(Ao).forEach(([Po,jo])=>{const Mo=no.find(No=>No.name===Po&&No.type===KycFieldType.Custom);Mo&&(Eo[Po]=jo,delete Ao[Po],Mo.unique&&(ko[Po]=jo))}),Object.keys(Eo).length>0&&(Ao.metadata=Eo),lo&&(Ao=Object.assign(Object.assign({},Ao),{policiesConsent:!0}),delete Ao.policiesConsentArray),yield Xr==null?void 0:Xr(Ao)}catch(Ao){logger$8.error(Ao),eo==null||eo(Ao),Ao instanceof EmailAlreadyExistsError?wo.setErrors({email:"Email already exists"}):Ao instanceof CustomFieldNotUniqueError?wo.setFormikState(Po=>Object.assign(Object.assign({},Po),{errors:Object.fromEntries(Object.entries(ko).map(([jo])=>[jo,Object.entries(ko).length>1?"One or more fields are already tied to another user":`${jo} is already tied to another user`])),touched:Object.fromEntries(Object.entries(ko).map(([jo])=>[jo,!0])),values:Object.assign(Object.assign({},go),ko)})):Ao instanceof TooManyEmailVerificationsError?wo.setErrors({email:"Too many email verification attempts."}):Ao instanceof UsernameAlreadyExistsError?wo.setErrors({username:"Username already exists"}):Ao instanceof InvalidPhoneNumberError?wo.setErrors({phoneNumber:Ao.message}):wo.setErrors({api:"Something went wrong. Please try again."})}finally{so(!1)}}),[oo,to==null?void 0:to.environmentId,lo,Xr,no,eo,go]);return{enforcePolicies:lo,fetch:ao,formikInitialValues:go,formikValidationSchema:ho,onFormSubmit:yo}},getSupportedCountriesForVerificationFromProjectSettings=Xr=>{var eo,to;const ro=getProviderByType((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.Sms);return((to=ro==null?void 0:ro.enabledCountries)!==null&&to!==void 0?to:[]).map(no=>no.isoCountryCode.toLowerCase())},defaultCountries=["us","ca"],getDefaultCountriesIfEmpty=Xr=>Xr.length?Xr:defaultCountries,useThrottle=(Xr,eo)=>{const to=reactExports.useRef(!1),ro=reactExports.useRef(Xr);return ro.current=Xr,reactExports.useCallback((...no)=>{to.current||(ro.current(...no),to.current=!0,setTimeout(()=>to.current=!1,eo))},[eo])},modulo=(Xr,eo)=>(Xr%eo+eo)%eo,parseDefaultCountry=({defaultIso2:Xr,countries:eo,initialPhone:to})=>{if(to){const{country:so}=X$4({countries:eo,phone:to});if(so)return so}const ro=eo.map(M$5),no=StorageService.getItem(PHONE_INPUT_DEFAULT_COUNTRY),io=ro.find(({iso2:so})=>so===no);if(io)return io;const oo=ro.find(({iso2:so})=>so===Xr);if(oo)return oo;const ao=ro.find(({iso2:so})=>so==="us");if(ao)return ao;if(ro[0])return ro[0];throw new Error("No country list was provided")},MENU_DISPLAY_THROTTLE=50,COUNTRY_INPUT_SCROLL_DELAY=20,usePhoneInputLogic=({countryInputRef:Xr,setCountryDropdownOpen:eo,setInvalidNumberMessage:to,onUpdate:ro,initialPhone:no,countries:io,defaultIso2:oo})=>{const ao=reactExports.useRef(ro);ao.current=ro;const so=reactExports.useMemo(()=>parseDefaultCountry({countries:io,defaultIso2:oo,initialPhone:no}),[io,oo,no]),{inputValue:co,phone:lo,country:fo,setCountry:ho,handlePhoneValueChange:go,inputRef:yo}=ee$5({countries:io,defaultCountry:so.iso2,disableDialCodeAndPrefix:!0,value:no}),[vo,wo]=reactExports.useState(so.dialCode),Eo=reactExports.useMemo(()=>lo.length===("+"+fo.dialCode).length?"":lo,[fo.dialCode,lo]);reactExports.useEffect(()=>{var Co;(Co=ao.current)===null||Co===void 0||Co.call(ao,{country:fo,formattedPhone:co,phone:Eo})},[fo.iso2,co,Eo]);const[ko,Ao]=reactExports.useState(""),Po=reactExports.useMemo(()=>ko?isNaN(parseInt(ko))?io.filter(Co=>{const{name:Ro,iso2:So}=M$5(Co);return Ro.toLowerCase().includes(ko.toLowerCase())||So===ko.toLowerCase()||fo.iso2===So}):io.filter(Co=>{const{dialCode:Ro,iso2:So}=M$5(Co);return Ro.includes(ko)||fo.iso2===So}):io,[io,fo.iso2,ko]),jo=()=>{Ao(""),eo(!0)},Mo=reactExports.useCallback(()=>{eo(!1)},[eo]),No=reactExports.useRef(so),Do=({target:Co})=>{const Ro=Co.value.slice(0,4);wo(Ro),Ao(Ro);const{country:So}=X$4({countries:io,currentCountryIso2:fo.iso2,phone:Ro});So&&(No.current=So,ho(So.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,So.iso2),setTimeout(()=>po(So.iso2),COUNTRY_INPUT_SCROLL_DELAY))},Fo=()=>{!No.current||vo===No.current.dialCode||(ho(No.current.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,No.current.iso2),wo(No.current.dialCode),to(void 0))},Xo=reactExports.useCallback(Co=>{Co.preventDefault();const Ro=Po.findIndex(To=>M$5(To).iso2===fo.iso2),So=Co.key==="ArrowUp"?-1:1,mo=M$5(Po[modulo(Ro+So,Po.length)]);po(mo.iso2),wo(mo.dialCode),ho(mo.iso2),No.current=mo,StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,mo.iso2),to(void 0)},[fo.iso2,Po,to,ho]),Lo=reactExports.useCallback(()=>{var Co;Mo(),(Co=yo.current)===null||Co===void 0||Co.select()},[Mo,yo]),Bo=reactExports.useCallback(Co=>{if(Co.key==="Tab")return Mo();if(Co.key==="ArrowUp"||Co.key==="ArrowDown")return Xo(Co);if(Co.key==="Enter")return Lo(Co)},[Mo,Xo,Lo]),xo=reactExports.useMemo(()=>de$4({charAfterDialCode:"+",dialCode:fo.dialCode,phone:lo}).length>0,[fo.dialCode,lo]),uo=reactExports.useRef(null),po=Co=>{var Ro;const So=(Ro=uo.current)===null||Ro===void 0?void 0:Ro.querySelector("#"+Co);So==null||So.scrollIntoView({behavior:"instant",block:"center",inline:"center"})},bo=useThrottle(Co=>{var Ro;const So=!!uo.current,mo=!!Co;uo.current=Co,!(So||!mo)&&((Ro=Xr.current)===null||Ro===void 0||Ro.select(),po(fo.iso2))},MENU_DISPLAY_THROTTLE),_o=Co=>{wo(Co.dialCode),ho(Co.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Co.iso2),No.current=Co,to(void 0)},$o=reactExports.useMemo(()=>vo.length>3?"var(--dynamic-text-size-body-mini)":vo.length>2?"var(--dynamic-text-size-body-small)":"var(--dynamic-text-size-body-normal)",[vo.length]);return{closeDropdown:Mo,countryFontSize:$o,countryInput:vo,currentCountry:fo,filteredCountries:Po,formattedPhone:co,handleCountryInput:Do,handleCountryKeyDown:Bo,handlePhoneInput:go,hasInput:xo,inputRef:yo,onBlurCountry:Fo,onFocusCountry:jo,onMenuDisplayToggle:bo,openDropdown:jo,setCountry:_o}},PhoneNumberField=({isLoading:Xr,disabled:eo,error:to,label:ro,onUpdate:no,appendRight:io,setIsFocused:oo,setIsHovered:ao,initialPhone:so,onBlur:co,countries:lo})=>{const{t:fo}=useTranslation(),ho=reactExports.useRef(null),[go,yo]=reactExports.useState(!1),vo=reactExports.useRef(null),{defaultPhoneInputIso2:wo}=useInternalDynamicContext(),[Eo,ko]=reactExports.useState(void 0),{formattedPhone:Ao,currentCountry:Po,handleCountryInput:jo,handlePhoneInput:Mo,hasInput:No,inputRef:Do,countryInput:Fo,onBlurCountry:Xo,filteredCountries:Lo,openDropdown:Bo,handleCountryKeyDown:xo,closeDropdown:uo,setCountry:po,onMenuDisplayToggle:bo,onFocusCountry:_o,countryFontSize:$o}=usePhoneInputLogic({countries:lo,countryInputRef:ho,defaultIso2:wo,initialPhone:so,onUpdate:no,setCountryDropdownOpen:yo,setInvalidNumberMessage:ko});return jsxRuntimeExports.jsxs("div",{className:"phone-number-field",children:[jsxRuntimeExports.jsxs("div",{className:"phone-number-field__fields",onPointerEnter:()=>ao==null?void 0:ao(!0),onPointerLeave:()=>ao==null?void 0:ao(!1),onFocus:()=>oo==null?void 0:oo(!0),onBlur:Co=>{oo==null||oo(!1),co==null||co(Co)},ref:vo,children:[jsxRuntimeExports.jsxs("div",{className:classNames("phone-number-field__fields__country-code",{"phone-number-field__fields__country-code--disabled":Xr||eo}),onClick:Bo,"data-testid":"country-code",children:[jsxRuntimeExports.jsx(q$8,{iso2:Po.iso2,size:"24px",className:"phone-number-field__fields__country-code__flag"}),jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__country-code__plus",variant:"body_normal",weight:"regular",style:{fontSize:$o},color:"primary",children:"+"}),jsxRuntimeExports.jsx(Input,{label:"",id:"country_code_field",value:Fo,onChange:jo,disabled:Xr||eo,containerClassName:"phone-number-field__fields__country-code__container",className:"phone-number-field__fields__country-code__container__input",onBlur:Xo,ref:ho,onKeyDown:xo,onFocus:_o,style:{fontSize:$o},"data-testid":"country-code-input",inputMode:"numeric",autoComplete:"tel-country-code"}),jsxRuntimeExports.jsx(Icon,{className:"phone-number-field__fields__country-code__chevron",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]}),jsxRuntimeExports.jsx(Input,{label:"",id:"phoneNumber",value:Ao,onChange:Mo,disabled:Xr||eo,containerClassName:"phone-number-field__fields__phone-number",className:"phone-number-field__fields__phone-number__input",ref:Do,error:!!(Eo||to),inputMode:"numeric","data-testid":"phone_number_input",autoComplete:"tel-national"}),!No&&jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__placeholder",variant:"body_normal",weight:"regular",copykey:"dyn_collect_user_data.fields.phone_number.label",children:ro??fo("dyn_collect_user_data.fields.phone_number.label")}),io]}),jsxRuntimeExports.jsx(MenuList,{isOpen:go,onClickClose:uo,popperProps:{anchorOrigin:"bottom-left",anchorRef:vo},mobileTitle:"Select country",dropdownClassName:"phone-number-field__dropdown",children:jsxRuntimeExports.jsx("div",{className:"phone-number-field__dropdown__items",ref:bo,children:Lo.map(Co=>{const Ro=M$5(Co),{iso2:So,name:mo,dialCode:To}=Ro,Vo=So===Po.iso2;return jsxRuntimeExports.jsxs("div",{className:classNames("phone-number-field__dropdown__items__country",{"phone-number-field__dropdown__items__country--selected":Vo}),onClick:()=>{po(Ro),uo()},id:So,children:[jsxRuntimeExports.jsx(q$8,{iso2:So,size:"24px"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:mo}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:To})]},So)})})}),!!(Eo||to)&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"phone-number-field__error-message",children:to??Eo})]})},UserPhoneField=({onChange:Xr,value:eo,onBlur:to,disabled:ro,label:no,required:io,error:oo,name:ao,verify:so})=>{const{selectedPhoneCountry:co}=useFieldsState(),{projectSettings:lo}=useInternalDynamicContext(),fo=({country:go,phone:yo})=>{co.current=go,yo!==eo&&Xr({target:{name:ao,value:yo}})},ho=reactExports.useMemo(()=>{const go=getSupportedCountriesForVerificationFromProjectSettings(lo);return getCustomCountries(so?getDefaultCountriesIfEmpty(go):void 0)},[so,lo]);return jsxRuntimeExports.jsx(PhoneNumberField,{countries:ho,initialPhone:eo,disabled:ro,onUpdate:fo,onBlur:to,label:no,appendRight:!ro&&!io?jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"user-phone-field__optional-label",children:"Optional"}):void 0,error:oo})},getDisplayErrorMessage=(Xr,eo)=>{var to;if(!eo)return;const ro={required:no=>`${no} is required`};return((to=ro[eo])===null||to===void 0?void 0:to.call(ro,Xr))||eo},Checkbox=({ariaLabel:Xr,checked:eo,className:to="",defaultChecked:ro,disabled:no,id:io,name:oo,onChange:ao,value:so})=>jsxRuntimeExports.jsxs("div",{className:classNames("checkbox__container",to),children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:io,"aria-label":Xr,"aria-checked":eo,className:"checkbox--hidden",value:so,checked:eo,name:oo,disabled:no,defaultChecked:ro,onChange:co=>!!ao&&(ao==null?void 0:ao(co,co.currentTarget.value)),"data-testid":"input-checkbox"}),jsxRuntimeExports.jsx("div",{className:"checkbox--visible",children:jsxRuntimeExports.jsx(SvgCheck,{className:"checkbox__icon"})})]});var _path$O,_excluded$X=["title","titleId"];function _extends$Z(){return _extends$Z=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$X(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowDown=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$X(eo,_excluded$X);return reactExports.createElement("svg",_extends$Z({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$O||(_path$O=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.862 9.529c.26-.26.682-.26.943 0L12 13.724l4.195-4.195a.667.667 0 1 1 .943.942l-4.667 4.667a.667.667 0 0 1-.942 0l-4.667-4.667a.667.667 0 0 1 0-.942Z",fill:"currentColor"})))};const getDisplayValue=Xr=>{if(!Xr)return;const{selectedIndex:eo}=Xr;if(eo===void 0)return;const to=Xr.options[eo];if(to.hasAttribute("value"))return to.text},Select=Xr=>{var{children:eo,className:to="",id:ro,label:no,value:io,error:oo=!1,selectDataTestId:ao,message:so}=Xr,co=__rest$7(Xr,["children","className","id","label","value","error","selectDataTestId","message"]);const lo=reactExports.useRef(null),[fo,ho]=reactExports.useState();return reactExports.useLayoutEffect(()=>{if(!io)return;const go=lo.current;ho(getDisplayValue(go))},[io,ho]),jsxRuntimeExports.jsxs("div",{className:"select__field",children:[jsxRuntimeExports.jsxs("div",{className:classNames(to,"select__container"),children:[jsxRuntimeExports.jsxs("label",{className:classNames("select__body",{select__error:oo,select__has_value:!!fo}),htmlFor:ro,children:[jsxRuntimeExports.jsx("span",{className:"select__value",children:fo||jsxRuntimeExports.jsx("span",{children:" "})}),jsxRuntimeExports.jsx("span",{className:"select__label",children:no}),jsxRuntimeExports.jsx("div",{className:"select__control_icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(SvgArrowDown,{})})})]}),jsxRuntimeExports.jsx("select",Object.assign({},co,{"data-testid":ao,ref:lo,id:ro,value:io,placeholder:no,className:"select",children:eo}))]}),so&&jsxRuntimeExports.jsx(Typography,{className:classNames("select__message",{select__message__error:oo}),variant:"body_mini",children:so})]})},renderSelectField=({key:Xr,name:eo,label:to,type:ro,options:no,disabled:io,dataTestId:oo},{errors:ao,touched:so})=>jsxRuntimeExports.jsx(Field$1,{copykey:Xr,as:Select,type:ro,id:eo,name:eo,label:to,error:!!(ao[eo]&&so[eo]),selectDataTestId:oo,message:so[eo]&&getDisplayErrorMessage(to,ao[eo]),disabled:io,children:no.map(co=>typeof co=="string"?jsxRuntimeExports.jsx("option",{value:co,children:co},co):jsxRuntimeExports.jsx("option",{value:co.value,children:co.label},co.value))},eo),renderCheckboxGroup=(Xr,eo,to,ro,no,io,oo)=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:`user-field__checkbox-container ${no[eo]&&io[eo]?"user-field__checkbox-container--error":""}`,children:(ro==null?void 0:ro.checkboxText)&&jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$1,{as:Checkbox,id:Xr,name:eo,type:"checkbox",value:"0",disabled:oo,selectDataTestId:"customFieldCheckbox"},Xr),jsxRuntimeExports.jsx("label",{htmlFor:Xr,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:ro.checkboxText})})]},Xr)},"customConsentGroup"),io[eo]&&getDisplayErrorMessage(to,no[eo])&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"user-field__error-message",children:`${eo.charAt(0).toUpperCase()+eo.slice(1)} is required`})]}),renderPoliciesConsentGroup=(Xr,eo,to)=>jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:"user-field__checkbox-container",children:eo==null?void 0:eo.map((ro,no)=>jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$1,{copykey:Xr,as:Checkbox,id:`policiesConsent_${no}`,name:"policiesConsentArray",type:"checkbox",value:`${no}`,disabled:to},`policiesConsent_${no}`),jsxRuntimeExports.jsx("label",{htmlFor:`policiesConsent_${no}`,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:ro})})]},`policiesConsent_${no}`))},"policiesConsentGroup"),UserField=({fieldData:{validationRules:Xr,isCustom:eo,key:to,label:ro,type:no,autoComplete:io},fieldSettings:{enabled:oo,name:ao,required:so,verify:co,label:lo=ro},errors:fo,touched:ho,disabled:go,policiesConsentInnerComponentArray:yo})=>{if(eo){if(no===CustomFieldType.Select&&(Xr!=null&&Xr.validOptions)){const vo=Xr.validOptions.map(wo=>wo.label);return renderSelectField({dataTestId:"customFieldSelect",disabled:go,key:to,label:lo,name:ao,options:vo,type:no},{errors:fo,touched:ho})}else if(no===CustomFieldType.Checkbox)return renderCheckboxGroup(to,ao,lo,Xr,fo,ho,go)}switch(ao){case"tShirtSize":return renderSelectField({dataTestId:"tShirtSizeSelect",disabled:go,key:to,label:lo,name:ao,options:tShirtSizes,type:no},{errors:fo,touched:ho});case"team":return renderSelectField({dataTestId:"teamSelect",disabled:go,key:to,label:lo,name:ao,options:teamNames,type:no},{errors:fo,touched:ho});case"country":return renderSelectField({dataTestId:"countrySelect",disabled:go,key:to,label:lo,name:ao,options:countryCodes.map(vo=>({label:vo.name,value:vo.code})),type:no},{errors:fo,touched:ho});case"policiesConsent":return renderPoliciesConsentGroup(to,yo,go);case"phoneNumber":return jsxRuntimeExports.jsx(Field$1,{name:ao,as:UserPhoneField,disabled:go,label:lo,required:so,error:ho[ao]&&fo[ao]?getDisplayErrorMessage(lo,fo[ao]):void 0,verify:co,autoComplete:io},ao);default:return jsxRuntimeExports.jsx(Field$1,{copykey:to,disabled:go,as:Input,type:no,id:ao,name:ao,label:lo,optional:oo&&!so,error:fo[ao]&&ho[ao],message:ho[ao]&&getDisplayErrorMessage(lo,fo[ao]),autoComplete:io},ao)}},getTooltipMessageKeyForField=({enabled:Xr,name:eo,lockForVerification:to})=>{if(eo==="email"&&!Xr)return"dyn_collect_user_data.update_email_tooltip";if(eo==="phoneNumber"&&!Xr)return"dyn_collect_user_data.update_phone_number_tooltip";if(to)return"dyn_collect_user_data.lock_editing_multiple_verified_fields"},UserDataFields=({errors:Xr,policiesConsentInnerComponentArray:eo,fields:to,touched:ro,currentValues:no,disableEditingMultipleFieldsWithVerification:io,initialValues:oo})=>{const{fieldsConfig:ao}=useFields(),{t:so}=useTranslation(),co=reactExports.useMemo(()=>oo&&no&&to?to.filter(lo=>lo.verify&&oo[lo.name]!==no[lo.name]).map(lo=>lo.name):[],[no,to,oo]);return jsxRuntimeExports.jsx("div",{className:"user-data-fields__fields-column",children:to==null?void 0:to.map(lo=>{const{enabled:fo,name:ho,verify:go}=lo,yo=io&&go&&co.length>0&&!co.includes(ho),vo=!fo||yo,wo=getTooltipMessageKeyForField({enabled:fo,lockForVerification:yo,name:ho});let Eo;lo.type!==KycFieldType.Custom?Eo=ao[ho]:Eo={isCustom:!0,key:lo.name,label:lo.name,type:lo.validationType,validation:customFieldValidationMap[lo.validationType],validationRules:lo.validationRules};const ko=jsxRuntimeExports.jsx(UserField,{disabled:!!vo,errors:Xr,fieldData:Eo,fieldSettings:lo,touched:ro,policiesConsentInnerComponentArray:eo},Eo.key);return wo?jsxRuntimeExports.jsx(Tooltip,{content:so(wo),className:"user-data-fields__tooltip",copykey:wo,children:ko},Eo.key+"__tooltip"):ko})})},UserProfileForm=({filterFields:Xr,formClassName:eo,fieldsContainerStyle:to,onEditProfileSubmit:ro,onEditProfileCancel:no,options:io={buttonsAsFooter:!0,cancelText:"Cancel",shouldEnforcePolicies:!1,submitText:"Save"}})=>{const{projectSettings:oo,user:ao}=useInternalDynamicContext(),so=reactExports.useMemo(()=>{const yo=getUserProfileFields({customFields:oo==null?void 0:oo.customFields,projectSettingsKyc:oo==null?void 0:oo.kyc,user:ao});return Xr?yo.filter(({name:vo})=>Xr.includes(vo)):yo},[Xr,oo==null?void 0:oo.customFields,oo==null?void 0:oo.kyc,ao]),{fetch:co,formikInitialValues:lo,formikValidationSchema:fo,onFormSubmit:ho}=useUserDataForm({fields:so,onSubmit:ro,shouldEnforcePolicies:io.shouldEnforcePolicies,userProfile:ao}),go=(yo,vo,wo)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!io.hideCancelButton&&jsxRuntimeExports.jsx(TypographyButton,Object.assign({disabled:co,expanded:!0,buttonPadding:"medium",buttonVariant:"secondary",type:"button",typographyProps:{variant:"button_secondary"},onClick:no,dataTestId:"cancel-button"},io.cancelButtonProps,{children:io.cancelText})),jsxRuntimeExports.jsx(TypographyButton,Object.assign({buttonClassName:"dynamic-widget-footer__button",disabled:co||!vo||!wo,expanded:!0,type:"submit",buttonPadding:"medium",typographyProps:{variant:"button_secondary"},loading:yo,startSlot:jsxRuntimeExports.jsx(SvgCheck,{}),dataTestId:"submit-button"},io.submitButtonProps,{children:io.submitText}))]});return jsxRuntimeExports.jsx(Formik,{onSubmit:ho,initialValues:lo,validationSchema:fo,validateOnChange:!0,children:({errors:yo,touched:vo,isSubmitting:wo,isValid:Eo,dirty:ko,values:Ao})=>jsxRuntimeExports.jsxs(Form,{className:classNames("dynamic-widget-edit-profile-view",eo),"data-testid":"editUserProfileForm",children:[jsxRuntimeExports.jsx("div",{className:"dynamic-widget-edit-profile-view__fields",style:to,children:jsxRuntimeExports.jsx(UserDataFields,{errors:yo,fields:so,touched:vo,currentValues:Ao,initialValues:lo,disableEditingMultipleFieldsWithVerification:!0})}),io.buttonsAsFooter?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:go(wo,Eo,ko)}):go(wo,Eo,ko)]})})},splitCamelCase=Xr=>Xr.replace(/([a-z])([A-Z])/g,"$1 $2"),useAssignDefaultValues=(Xr,eo)=>{const{appName:to,user:ro}=useInternalDynamicContext(),no=to?`${to} `:"";if(Xr.submitText||(Xr.submitText="Update"),eo.length!==1)return Xr.title||(Xr.title="Update your info"),Xr.subtitle||(Xr.subtitle=`Fill out your info for your ${no}account`),Xr;const[io]=eo,oo=splitCamelCase(io).toLowerCase(),ao=ro!=null&&ro[io]?"Update":"Enter";return Xr.title||(Xr.title=`${ao} your ${oo}`),Xr.subtitle||(Xr.subtitle=`Add your ${oo} to your ${no}account`),Xr};var _path$N,_excluded$W=["title","titleId"];function _extends$Y(){return _extends$Y=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$W(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAt=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$W(eo,_excluded$W);return reactExports.createElement("svg",_extends$Y({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$N||(_path$N=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 4 14.928 1 1 0 1 1 1 1.732A9.96 9.96 0 0 1 11.942 22C6.446 21.968 2 17.503 2 12 2 6.477 6.477 2 12 2s10 4.477 10 10v1.5a3.5 3.5 0 0 1-6.396 1.966A5 5 0 1 1 17 12v1.5a1.5 1.5 0 0 0 3 0V12a8 8 0 0 0-8-8Zm3 8a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z",fill:"currentColor"})))},_path$M,_excluded$V=["title","titleId"];function _extends$X(){return _extends$X=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$V(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgJustifiedText=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$V(eo,_excluded$V);return reactExports.createElement("svg",_extends$X({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$M||(_path$M=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h7a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$L,_excluded$U=["title","titleId"];function _extends$W(){return _extends$W=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$U(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLocation=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$U(eo,_excluded$U);return reactExports.createElement("svg",_extends$W({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$L||(_path$L=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.6 8.067a9.333 9.333 0 0 0-13.2 13.2l5.658 5.657c.52.52 1.363.52 1.884 0l5.658-5.658a9.333 9.333 0 0 0 0-13.199ZM7.515 6.181c4.686-4.686 12.284-4.686 16.97 0 4.687 4.687 4.687 12.285 0 16.97l-4.67 4.67c-.041.042.019-.018-.023.024l-.964.964a3.998 3.998 0 0 1-5.655 0l-5.658-5.657c-4.687-4.686-4.687-12.284 0-16.97ZM16 12a2.667 2.667 0 1 0 0 5.333A2.667 2.667 0 0 0 16 12Zm-5.333 2.667a5.333 5.333 0 1 1 10.666 0 5.333 5.333 0 0 1-10.666 0Z",fill:"currentColor"})))},_path$K,_excluded$T=["title","titleId"];function _extends$V(){return _extends$V=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$T(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMail=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$T(eo,_excluded$T);return reactExports.createElement("svg",_extends$V({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$K||(_path$K=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 7a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7Zm2 2.869V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9.869l-6.336 4.223a3 3 0 0 1-3.328 0L4 9.87Zm16-2.404-7.445 4.963a1 1 0 0 1-1.11 0L4 7.465V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v.465Z",fill:"currentColor"})))},_path$J,_excluded$S=["title","titleId"];function _extends$U(){return _extends$U=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$S(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPhone=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$S(eo,_excluded$S);return reactExports.createElement("svg",_extends$U({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$J||(_path$J=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V5Zm3-1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H8Zm3 14a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$I,_excluded$R=["title","titleId"];function _extends$T(){return _extends$T=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$R(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSizeLabels=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$R(eo,_excluded$R);return reactExports.createElement("svg",_extends$T({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$I||(_path$I=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 2.93 3 3 0 0 1 4.192.05l2.829 2.828A3 3 0 0 1 19.069 12 3 3 0 0 1 22 15v4a3 3 0 0 1-3 3H7a5 5 0 0 1-5-5V5Zm9.071 15H19a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-1.929l-6 6Zm4.878-7.707h.001l1.657-1.657a1 1 0 0 0 0-1.414l-2.829-2.829a1 1 0 0 0-1.414 0L12 7.757v8.486l3.95-3.95ZM9.123 19.12A2.99 2.99 0 0 0 10 17V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a3 3 0 0 0 5.123 2.12ZM6 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$H,_excluded$Q=["title","titleId"];function _extends$S(){return _extends$S=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Q(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUserCard=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Q(eo,_excluded$Q);return reactExports.createElement("svg",_extends$S({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$H||(_path$H=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 5a3 3 0 1 1 6 0h4a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h4Zm.17 2H5a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-4.17a3.001 3.001 0 0 1-5.66 0ZM12 4a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V5a1 1 0 0 0-1-1Zm-3 7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2.4 2.8a3 3 0 1 0-4.8 0 4.01 4.01 0 0 0-1.372 1.867 1 1 0 1 0 1.885.666 2.001 2.001 0 0 1 3.773 0 1 1 0 1 0 1.886-.666A4.01 4.01 0 0 0 11.4 13.8ZM14 11a1 1 0 0 1 1-1h3a1 1 0 1 1 0 2h-3a1 1 0 0 1-1-1Zm0 4a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2h-2a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$G,_excluded$P=["title","titleId"];function _extends$R(){return _extends$R=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$P(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUser=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$P(eo,_excluded$P);return reactExports.createElement("svg",_extends$R({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$G||(_path$G=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 0 0-6.598 12.526A14.943 14.943 0 0 1 12 15c2.366 0 4.606.548 6.598 1.526A8 8 0 0 0 12 4Zm7.654 14.436A9.96 9.96 0 0 0 22 12c0-5.523-4.477-10-10-10S2 6.477 2 12a9.96 9.96 0 0 0 2.37 6.464A9.978 9.978 0 0 0 12 22a9.978 9.978 0 0 0 7.654-3.564ZM17.2 18.08A12.954 12.954 0 0 0 12 17c-1.85 0-3.607.386-5.199 1.08A7.968 7.968 0 0 0 12 20c1.985 0 3.8-.723 5.199-1.92ZM12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"currentColor"})))},_path$F,_excluded$O=["title","titleId"];function _extends$Q(){return _extends$Q=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$O(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWorkSuitcase=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$O(eo,_excluded$O);return reactExports.createElement("svg",_extends$Q({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$F||(_path$F=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h2a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2V4ZM5 7a1 1 0 0 0-1 1v4.57A22.95 22.95 0 0 0 12 14c2.815 0 5.51-.505 8-1.43V8a1 1 0 0 0-1-1H5Zm10-2H9V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1Zm5 9.692A24.971 24.971 0 0 1 12 16c-2.796 0-5.487-.46-8-1.308V18a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3.308ZM11 12a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))};const mapFieldToIcon={alias:SvgUser,country:SvgLocation,email:SvgMail,firstName:SvgUserCard,jobTitle:SvgWorkSuitcase,lastName:SvgUserCard,phoneNumber:SvgPhone,tShirtSize:SvgSizeLabels,username:SvgAt},UserFieldsToIcon=({fields:Xr,className:eo})=>{const to=Xr.length===1?mapFieldToIcon[Xr[0]]:void 0;return to?jsxRuntimeExports.jsx(to,{className:eo}):jsxRuntimeExports.jsx(SvgJustifiedText,{className:eo})},UserFieldEditorView=({onClickClose:Xr,onSubmit:eo,fields:to,submitText:ro,subtitle:no,title:io})=>{({submitText:ro,subtitle:no,title:io}=useAssignDefaultValues({submitText:ro,subtitle:no,title:io},to));const oo=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",trailing:oo,children:jsxRuntimeExports.jsxs("div",{className:"user-field-editor__header",children:[jsxRuntimeExports.jsx("div",{className:"user-field-editor__header__icon",children:jsxRuntimeExports.jsx(Icon,{color:"brand-primary",size:"large",children:jsxRuntimeExports.jsx(UserFieldsToIcon,{fields:to})})}),io&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",children:io})]})}),jsxRuntimeExports.jsxs("div",{className:"user-field-editor__body",children:[no&&jsxRuntimeExports.jsx(Typography,{className:"user-field-editor__body__subtitle",variant:"body_normal",color:"secondary",children:no}),jsxRuntimeExports.jsx(UserProfileForm,{filterFields:to,onEditProfileSubmit:eo,formClassName:"user-field-editor__body__form",fieldsContainerStyle:{padding:0},options:{buttonsAsFooter:!1,hideCancelButton:!0,submitButtonProps:{buttonPadding:"large",startSlot:void 0,typographyProps:{variant:"button_primary"}},submitText:ro}})]}),jsxRuntimeExports.jsx(PoweredByDynamic,{asFooter:!0})]})},UserFieldEditorModal=Xr=>{var{onCancel:eo,onSubmit:to,fields:ro}=Xr,no=__rest$7(Xr,["onCancel","onSubmit","fields"]);const[io,oo]=reactExports.useState(!0),ao=reactExports.useRef(!1),so=reactExports.useCallback(()=>{ao.current||eo("User cancelled"),ao.current=!0},[eo]),co=fo=>__awaiter$j(void 0,void 0,void 0,function*(){return to(fo).then(()=>{ao.current=!0,oo(!1)})}),lo=()=>oo(!1);return jsxRuntimeExports.jsx(Portal,{handleClose:lo,isShown:io,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-edit-user-field",transitionEvents:{onUnmount:so},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(UserFieldEditorView,Object.assign({onSubmit:co,onClickClose:lo,fields:ro},no))})})})},DynamicBaseWidget=({children:Xr,shadowDOMProps:eo})=>jsxRuntimeExports.jsx(ShadowDOM,Object.assign({},eo,{children:jsxRuntimeExports.jsx(PopperProvider,{children:Xr})})),UserFieldEditorContext=reactExports.createContext(void 0),UserFieldEditorContextProvider=({children:Xr})=>{const{modal:eo,open:to}=useConfirmationModal({elementId:"dynamic-edit-user-field"}),ro=reactExports.useCallback((no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){return to((oo,ao)=>{const so=co=>io(co).then(lo=>oo({fields:co,updateUserResult:lo}));return jsxRuntimeExports.jsx(DynamicBaseWidget,{children:jsxRuntimeExports.jsx(UserFieldEditorModal,{fields:no.fields,submitText:no.submitText,title:no.title,subtitle:no.subtitle,onCancel:ao,onSubmit:so})})})}),[to]);return jsxRuntimeExports.jsxs(UserFieldEditorContext.Provider,{value:{open:ro},children:[eo,Xr]})},VerticalAccordion=({children:Xr,className:eo,style:to})=>jsxRuntimeExports.jsx("div",{className:classNames(eo,"vertical-accordion__container"),style:to,children:Xr}),isUserLinkingWallet=(Xr,eo,to)=>(Xr==null?void 0:Xr.verifiedCredentials)!==void 0&&eo==="multi-wallet-wallet-list"&&!to,useDynamicLayoutData=({view:Xr,authMode:eo})=>{const{t:to}=useTranslation(),{isTurnkeyWalletWithoutAuthenticator:ro}=useIsTurnkeyWallet(),{selectedWalletConnector:no}=useInternalDynamicContext(),io=reactExports.useMemo(()=>({"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.helper.all_wallet_list",heading:to("dyn_login.helper.all_wallet_list")},"login-with-wallet-only":{copykey:"dyn_login.helper.wallet_only",heading:to("dyn_login.helper.wallet_only")},"passkey-intro":{copykey:"dyn_passkey_intro.helper.title",heading:to("dyn_passkey_intro.helper.title")},"pending-connect":{copykey:"dyn_login.helper.pending_connect.title",heading:to("dyn_login.helper.pending_connect.title")},"pending-signature":{copykey:"dyn_login.helper.pending_signature.title",heading:to("dyn_login.helper.pending_signature.title")},"pending-signature-without-back-button":{copykey:"dyn_login.helper.pending_signature_without_back_button.title",heading:to("dyn_login.helper.pending_signature_without_back_button.title")},"qr-code":{copykey:"dyn_login.helper.qr_code.title",heading:to("dyn_login.helper.qr_code.title")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.helper",heading:to("dyn_wallet_conect.mobile.wallet_list.helper")},"wallet-list":{copykey:"dyn_wallet_list.helper",heading:to("dyn_wallet_list.helper")}}),[to]),oo=reactExports.useMemo(()=>{var co;return{"account-exists":{copykey:"dyn_account_exists.title",heading:to("dyn_account_exists.title")},"chainalysis-blocked-wallet":{copykey:"dyn_chainalysis_blocked_wallet.title",heading:to("dyn_chainalysis_blocked_wallet.title")},"farcaster-connect-view":{copykey:"dyn_login.qr_code.title",heading:to("dyn_login.qr_code.title")},"login-with-email-or-wallet":{copykey:"dyn_login.title.all",heading:to("dyn_login.title.all")},"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.title.all_wallet_list",heading:to("dyn_login.title.all_wallet_list")},"login-with-email-verification":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"login-with-sms-verification":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"login-with-wallet-only":{copykey:"dyn_login.title.wallet_only",heading:to("dyn_login.title.wallet_only")},"merge-user-accounts":{copykey:"dyn_merge_user_accounts.wallet.title",heading:to("dyn_merge_user_accounts.wallet.title")},"merge-user-accounts-conflicts":{copykey:"dyn_merge_user_accounts_conflicts.title",heading:to("dyn_merge_user_accounts_conflicts.title")},"mfa-choose-device":{copykey:"dyn_mfa.choose_device_view.title",heading:to("dyn_mfa.choose_device_view.title")},"mfa-display-backup-codes":{copykey:"dyn_mfa.display_backup_codes_view.title",heading:to("dyn_mfa.display_backup_codes_view.title")},"mfa-recovery":{copykey:"dyn_mfa.recovery_view.title",heading:to("dyn_mfa.recovery_view.title")},"mfa-secure-device":{copykey:"dyn_mfa.secure_device_view.title",heading:to("dyn_mfa.secure_device_view.title")},"mfa-secure-device-help":{copykey:"dyn_mfa.secure_device_view.helper.title",heading:to("dyn_mfa.secure_device_view.helper.title")},"mfa-verification":{copykey:"dyn_mfa.otp_verification_view.title",heading:to("dyn_mfa.otp_verification_view.title")},"mobile-wallet-redirect-view":{copykey:"dyn_login.mobile_wallet_redirect.backup_title",heading:(co=no==null?void 0:no.name)!==null&&co!==void 0?co:to("dyn_login.mobile_wallet_redirect.backup_title")},"multi-wallet-wallet-list":{copykey:eo==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link",heading:to(eo==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link")},"network-not-supported":{copykey:"dyn_network_not_supported.title",heading:to("dyn_network_not_supported.title")},"passkey-recovery-complete":{copykey:ro?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title",heading:to(ro?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title")},"passkey-recovery-start":{copykey:ro?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title",heading:to(ro?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title")},"pending-connect":{copykey:"dyn_login.connect_wallet.title",heading:to("dyn_login.connect_wallet.title")},"pending-signature":{copykey:"dyn_login.sign_wallet.title",heading:to("dyn_login.sign_wallet.title")},"qr-code":{copykey:"dyn_login.qr_code.title",heading:to("dyn_login.qr_code.title")},"select-hardware-wallet":{copykey:"dyn_select_hardware_wallet.title",heading:to("dyn_select_hardware_wallet.title")},"select-wallet-in-wallet-group":{copykey:"dyn_login.select_wallet_in_wallet_group.title",heading:to("dyn_login.select_wallet_in_wallet_group.title")},"verify-email":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"verify-sms":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.title",heading:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(WalletConnectIcon,{style:{height:"1.5rem",width:"1.5rem"}})," ",to("dyn_wallet_conect.mobile.wallet_list.title")]})},"wallet-group":{copykey:"dyn_login.wallet_group.title",heading:to("dyn_login.wallet_group.title")},"wallet-list":{copykey:"dyn_wallet_list.title.select",heading:to("dyn_wallet_list.title.select")},"wallet-sign":{copykey:"dyn_wallet_transfer.sign.title",heading:to("dyn_wallet_transfer.sign.title")},"wallet-used":{copykey:"dyn_wallet_link.title",heading:to("dyn_wallet_link.title")}}},[eo,ro,no==null?void 0:no.name,to]);if(Xr==="no-access")return{headerData:{copykey:"dyn_no_access.title",heading:to("dyn_no_access.title")}};if(Xr==="access-blocked")return{headerData:{copykey:"dyn_access_blocked.title",heading:to("dyn_access_blocked.title")}};const ao=io[Xr];return{headerData:oo[Xr],helpHeaderData:ao}},useAuthLayoutChecks=()=>{var Xr;const{view:eo}=useViewContext(),{user:to,customPrivacyPolicy:ro,customTermsOfServices:no,privacyPolicyUrl:io,termsOfServiceUrl:oo,isBridgeFlow:ao,authMode:so,projectSettings:co}=useInternalDynamicContext(),{isFooterExpanded:lo}=useFooterAnimationContext(),{mockedSDK:fo}=useMockContext(),{helpHeaderData:ho}=useDynamicLayoutData({authMode:so,view:eo.type}),go=eo.type!=="wallet-list"&&eo.type!=="login-with-email-or-wallet-full-wallet-list"&&eo.type!=="multi-wallet-wallet-list"&&eo.type!=="login-with-wallet-only"||lo,yo=eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="wallet-list"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only",vo=!!(ho&&!(eo.type==="qr-code"||eo.type==="no-qr-not-installed"||eo.type==="wallet-used"||eo.type==="chainalysis-blocked-wallet"||eo.type==="wallet-sign"||eo.type==="collect-user-data"||eo.type==="passkey-new-domain-detected"||isUserLinkingWallet(to,eo.type,fo))),wo=eo.type!=="collect-user-data"&&eo.type!=="no-access"&&eo.type!=="chainalysis-blocked-wallet"&&eo.type!=="wallet-locked-view"&&eo.type!=="gate-blocked-wallet"&&eo.type!=="email-wallet-otp-verification-view"&&eo.type!=="bridge-welcome"&&eo.type!=="bridge-summary"&&eo.type!=="bridge-next-wallet-connection"&&eo.type!=="passkey-intro"&&eo.type!=="passkey-new-domain-detected"&&eo.type!=="social-redirect-view"&&eo.type!=="collect-user-data-login-no-wallet"&&eo.type!=="passkey-recovery-bundle"&&eo.type!=="passkey-recovery-start"&&eo.type!=="embedded-reveal-view"&&eo.type!=="embedded-reveal-account-view"&&eo.type!=="rename-passkey"&&eo.type!=="create-password-view"&&eo.type!=="embedded-wallet-auth-choice"&&eo.type!=="wallet-claim-intro"&&eo.type!=="passkey-recovery-add-email"&&eo.type!=="global-wallet-confirm"&&eo.type!=="global-wallet-malicious"&&eo.type!=="global-wallet-info"&&eo.type!=="mfa-choose-device"&&eo.type!=="mfa-verification",Eo=ao&&(eo.type==="wallet-list"||eo.type==="qr-code"||eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="pending-connect"||eo.type==="pending-signature"||eo.type==="pending-signature-without-back-button"||eo.type==="bridge-next-wallet-connection"||eo.type==="bridge-summary"),ko=!!(!isUserLinkingWallet(to,eo.type,fo)&&(eo.type==="wallet-list"||eo.type==="wallet-connect-mobile-wallets-list"||(eo.type==="login-with-email-or-wallet"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only"||eo.type==="multi-wallet-wallet-list")&&(oo||io||ro||no))),Ao=!!(!((Xr=co==null?void 0:co.sdk)===null||Xr===void 0)&&Xr.displayDynamicMessaging)&&(eo.type==="login-with-email-or-wallet"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only"||eo.type==="login-with-email-verification"||eo.type==="login-with-sms-verification"||eo.type==="verify-email"||eo.type==="verify-sms"||eo.type==="pending-connect"||eo.type==="wallet-group"||eo.type==="select-wallet-in-wallet-group"||eo.type==="select-hardware-wallet"||eo.type==="pending-signature"||eo.type==="qr-code"||eo.type==="wallet-used"||eo.type==="email-wallet-otp-verification-view"||eo.type==="farcaster-connect-view"||eo.type==="merge-user-accounts"||eo.type==="merge-user-accounts-conflicts"||eo.type==="mfa-verification"||eo.type==="mfa-display-backup-codes"||eo.type==="mfa-recovery"),Po=eo.type!=="login-with-email-or-wallet-full-wallet-list"&&eo.type!=="login-with-email-verification"&&eo.type!=="login-with-sms-verification"&&eo.type!=="network-not-supported"&&eo.type!=="passkey-recovery-complete"&&eo.type!=="passkey-recovery-start"&&eo.type!=="passkey-recovery-bundle"&&eo.type!=="rename-passkey"&&eo.type!=="mobile-wallet-redirect-view"&&eo.type!=="qr-code"&&eo.type!=="mfa-verification"&&eo.type!=="mfa-display-backup-codes"&&eo.type!=="mfa-recovery",jo=eo.type==="pending-signature"||eo.type==="no-qr-not-installed"||eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="login-with-email-verification"||eo.type==="login-with-sms-verification"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="wallet-group"||eo.type==="select-wallet-in-wallet-group"||eo.type==="select-hardware-wallet"||eo.type==="pending-connect"||eo.type==="mobile-wallet-redirect-view"||eo.type==="account-exists"||eo.type==="passkey-intro"||eo.type==="qr-code"||eo.type==="farcaster-connect-view"||eo.type==="mfa-verification"||eo.type==="mfa-secure-device-help"||eo.type==="merge-user-accounts-conflicts"||eo.type==="mfa-recovery"||eo.type==="merge-user-accounts-with-same-email"&&!to;return{displayBorderBelowHeader:go,isWalletListTypeView:yo,shouldHideDynamicFooterSeparator:Ao&&ko,showBackButton:jo,showCloseButton:Po,showConnectedWalletProgress:Eo,showDefaultFooter:!Eo&&!Ao&&!ko,showDynamicFooter:Ao,showHeader:wo,showHelpContent:vo,showToSFooter:ko}},DynamicFooter=()=>{const{shouldHideDynamicFooterSeparator:Xr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{"data-testid":"dynamic-footer",className:classNames("dynamic-footer",{"dynamic-footer__top-border":!Xr}),children:jsxRuntimeExports.jsx(PoweredByDynamic,{})})};var _path$E,_excluded$N=["title","titleId"];function _extends$P(){return _extends$P=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$N(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterInfoIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$N(eo,_excluded$N);return reactExports.createElement("svg",_extends$P({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$E||(_path$E=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.833ZM8.333 10c0-.46.374-.833.834-.833H10c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 8.333 10Z",fill:"currentcolor"})))},_path$D,_path2$5,_excluded$M=["title","titleId"];function _extends$O(){return _extends$O=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$M(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgQuestionMark=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$M(eo,_excluded$M);return reactExports.createElement("svg",_extends$O({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$D||(_path$D=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.25a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Z",fill:"currentcolor"})),_path2$5||(_path2$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.31 7.044a1.784 1.784 0 0 0-1.133.192 1.513 1.513 0 0 0-.699.783.792.792 0 0 1-1.481-.559c.26-.689.768-1.257 1.42-1.613a3.368 3.368 0 0 1 2.144-.367 3.262 3.262 0 0 1 1.908 1.023c.496.55.775 1.254.774 1.99 0 1.201-.948 1.972-1.587 2.369a6.63 6.63 0 0 1-1.354.635l-.028.01-.008.002h-.003l-.002.001-.235-.756.235.756A.792.792 0 0 1 9.789 10h.001m0 0 .014-.005.06-.021a5.054 5.054 0 0 0 .956-.456c.575-.357.84-.717.84-1.024 0-.332-.125-.66-.367-.928a1.68 1.68 0 0 0-.982-.521M9.265 13.77c0-.438.355-.792.792-.792h.01a.792.792 0 1 1 0 1.584h-.01a.792.792 0 0 1-.792-.792Z",fill:"currentcolor"})))};const Header=({onClose:Xr,heading:eo,projectSettings:to,copykey:ro})=>{const{setError:no}=useErrorContext(),{isFooterExpanded:io,setIsFooterExpanded:oo}=useFooterAnimationContext(),{selectedWalletConnector:ao}=useInternalDynamicContext(),{goToInitialView:so,view:co,setView:lo}=useViewContext(),{showBackButton:fo,showCloseButton:ho,showHelpContent:go,isWalletListTypeView:yo,displayBorderBelowHeader:vo}=useAuthLayoutChecks(),{setExistentAccountData:wo}=useAccountExistsContext(),{setSocialProvider:Eo}=useSocialRedirectContext(),ko=reactExports.useCallback(()=>{var Mo;if(!((Mo=co.events)===null||Mo===void 0)&&Mo.onBackClick){co.events.onBackClick();return}if(co.type==="farcaster-connect-view"&&(Eo(void 0),dynamicEvents.emit("farcasterConnectCancelled"),dynamicEvents.emit("authFailure",{option:ProviderEnum.Farcaster,provider:ProviderEnum.Farcaster,type:"social"},"user-cancelled")),wo(void 0),no(void 0),co.type==="no-qr-not-installed"&&(ao!=null&&ao.canConnectViaQrCode)){lo("qr-code");return}so()},[co.type,co.events,so,wo,no,Eo,lo,ao]),Ao=ho&&Xr&&jsxRuntimeExports.jsx(IconButton,{onClick:Xr,type:"button",id:"close-button","data-testid":"close-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgClose,{})}),Po=go&&jsxRuntimeExports.jsx(Tooltip,{content:"Need some help?",className:"header__tooltip",children:jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>oo(!io),"data-testid":"info-button",className:"header__icon",children:yo?jsxRuntimeExports.jsx(SvgQuestionMark,{}):jsxRuntimeExports.jsx(SvgFooterInfoIcon,{})})},"info-button"),jo=[];return fo&&jo.push(jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ko,"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})},"back-button")),Ao&&Po&&jo.push(Po),jsxRuntimeExports.jsx(ModalHeader,{leading:jo,trailing:Ao||Po,displayBorder:vo,children:(!to||!!eo)&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:ro,children:to?eo:jsxRuntimeExports.jsx(Skeleton,{className:"header__skeleton"})})})},EmptyHelpContent=()=>jsxRuntimeExports.jsx("div",{"data-testid":"empty-help-content"});var _path$C,_excluded$L=["title","titleId"];function _extends$N(){return _extends$N=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$L(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterEyeIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$L(eo,_excluded$L);return reactExports.createElement("svg",_extends$N({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$C||(_path$C=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.995 4.167c3.965 0 6.643 2.655 7.937 4.675a2.14 2.14 0 0 1 0 2.316c-1.294 2.02-3.972 4.675-7.937 4.675-3.965 0-6.643-2.655-7.937-4.675a2.14 2.14 0 0 1 0-2.316c1.294-2.02 3.972-4.675 7.937-4.675ZM14.16 10a4.167 4.167 0 1 1-8.333 0 4.167 4.167 0 0 1 8.333 0Zm-4.12 2.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",fill:"currentColor"})))},_path$B,_excluded$K=["title","titleId"];function _extends$M(){return _extends$M=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$K(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterGasIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$K(eo,_excluded$K);return reactExports.createElement("svg",_extends$M({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$B||(_path$B=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.667 18.333a2 2 0 0 0 2-2V3.667a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v12.666a2 2 0 0 0 2 2h6ZM9 8.333a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1H4.333a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1H9ZM17.5 5.833c.46 0 .833.373.833.834v7.5H17.5h.833V14.186a1.201 1.201 0 0 1-.005.113 2.881 2.881 0 0 1-.29 1.075c-.155.307-.398.64-.779.893-.386.258-.863.4-1.426.4-.562 0-1.04-.142-1.425-.4a2.295 2.295 0 0 1-.778-.893 2.878 2.878 0 0 1-.296-1.16v-.045l.833-.001h-.834V9.185l-.001-.011a.2.2 0 0 0-.015-.051v-.001s.005.008.016.02V7.5c.354 0 .675.091.944.27.264.176.43.404.53.607A1.856 1.856 0 0 1 15 9.13v.035c0 .001 0 .002-.832.002H15v4.992l.001.02a1.228 1.228 0 0 0 .12.448c.054.11.123.194.211.253.083.055.23.12.501.12s.419-.065.502-.12a.633.633 0 0 0 .211-.253 1.218 1.218 0 0 0 .12-.468V6.667c0-.46.374-.834.834-.834ZM13.378 9.17h.002-.002Z",fill:"currentColor"})))},_path$A,_excluded$J=["title","titleId"];function _extends$L(){return _extends$L=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$J(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterKeyIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$J(eo,_excluded$J);return reactExports.createElement("svg",_extends$L({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$A||(_path$A=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.125 6.875a5 5 0 1 0-10 0 5 5 0 0 0 10 0Zm-2.5 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Zm-7.809 3.243a6.258 6.258 0 0 0 1.671 1.865L7.13 14.34l1.752 1.753-1.768 1.767-1.752-1.752-1.718 1.718-1.768-1.767 5.941-5.942Z",fill:"currentColor"})))};const isHardwareWalletEnabled=Xr=>Xr!=null&&isHardwareWalletConnector(Xr)&&Xr.isHardwareWalletEnabled,EnterTileAnimation=({children:Xr,className:eo="",delay:to=0,dataTestId:ro})=>{const no=reactExports.useMemo(()=>({animationDelay:to}),[to]);return jsxRuntimeExports.jsx("div",{"data-testid":ro,className:classNames(eo,"enter-list-tile-animation"),style:no,children:Xr})},InfoItem=({title:Xr,content:eo,Icon:to,className:ro="",iconClassName:no="",textClassName:io=""})=>jsxRuntimeExports.jsxs("div",{className:classNames("info-item__container",ro),children:[jsxRuntimeExports.jsx("div",{className:classNames("info-item__icon-container",no,{"icon-container--has-content":!!eo}),children:jsxRuntimeExports.jsx(to,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{as:"h2",className:io,variant:"body_normal",color:"primary",weight:"medium",children:Xr}),eo&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"info-item__secondary-text",children:eo})]})]}),WalletMoreInfoContent=({variant:Xr,wallet:eo})=>{const to={info:[{content:"Signing proves you have access to your wallet. It’s a bit like verifying your email by clicking an email confirmation link in your inbox during signup. This does not approve a transaction.",icon:SvgFooterKeyIcon,title:"Confirms you own your wallet"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},ro=isHardwareWalletEnabled(eo)?{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{content:jsxRuntimeExports.jsxs("div",{className:"footer-more-info-content__item--phantom-ledger",children:[jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Ledger does not support message signing functionality, commonly used to log in to sites. Instead, we sign a transaction as a proxy to prove ownership of the wallet."}),jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"body_small",weight:"regular",children:[jsxRuntimeExports.jsx("strong",{children:"Important"}),": we do not"," ",jsxRuntimeExports.jsx("strong",{children:"broadcast"})," this transaction, meaning Ledger based login will still be gasless."]}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Phantom in turn shows that a fee may apply as part of the “transaction”."}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"As always, please be cautious of the extensions and websites you use to prevent unwanted transactions from being broadcasted to the network."})]}),icon:SvgFooterGasIcon,title:"Why do I see a fee when using ledger"}]}:to,no={connect:{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},sign:ro};return jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__wrapper",children:no[Xr].info.map((io,oo)=>jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__item",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:`${.3+oo*.2}s`,children:jsxRuntimeExports.jsx(InfoItem,{Icon:io.icon,title:io.title,content:io.content})})},oo))})};var _path$z,_excluded$I=["title","titleId"];function _extends$K(){return _extends$K=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$I(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPuzzle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$I(eo,_excluded$I);return reactExports.createElement("svg",_extends$K({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$z||(_path$z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.044 20.998a.693.693 0 0 0 .7-.68V16.59c.239-2.01 1.121-1.413 2.16-.791 2.51 1.502 4.177-2.45 2.148-3.67-1.592-.956-2.281.689-3.448.52-.45-.067-.763-.54-.862-1.261V8.693a.692.692 0 0 0-.7-.68h-3.21c-2.65-.327-.297-1.755-.297-3.083.001-1.066-.99-1.93-2.214-1.93-1.222 0-2.344.864-2.344 1.93 0 1.253 2.435 2.756-.253 3.083H3.7a.692.692 0 0 0-.699.68v2.688c.205 1.146 1.001 1.411 2.021.655.344-.256.924-.554 1.344-.554 1.094 0 1.982.965 1.982 2.154 0 1.19-.887 2.416-1.982 2.416-.39 0-.755-.123-1.063-.338 0 .091-1.913-1.674-2.302.486v4.121c0 .375.315.68.699.68L10.16 21c.085-.393-.191-.844-.45-1.234-2.04-3.075 5.895-3.382 3.855.095-.1.172-.2.338-.277.5-.098.202-.162.45-.149.639l2.905-.002Z",fill:"currentColor"})))};const parseWalletLinks=Xr=>{const eo=isIPhone()||isIPad(),to=detectBrowserName()||"chrome";let ro;switch(to){case"edge":ro=Xr.edge;break;case"firefox":ro=Xr.firefox;break;case"chrome":default:ro=Xr.chrome;break}const no=!eo&&!!Xr.android,io=(eo||!isMobile$1())&&!!Xr.ios;return{canShowAndroidAppButton:no,canShowIosAppButton:io,currentDesktopUrl:ro,hasMobileAppUrl:no||io,userBrowser:to}},isWalletGroup=Xr=>{var eo;return!!(!((eo=Xr.groupedWallets)===null||eo===void 0)&&eo.length)},getLastUsedWalletKey=()=>StorageService.getItem(LAST_USED_WALLET),getWalletGroupLabel=(Xr,eo)=>{const to=eo==null?void 0:eo.find(oo=>Xr.groupedWallets.some(ao=>oo.walletKey===ao.walletConnector.key));if(to)return{isRecommended:!0,label:to.label||"Recommended"};const ro=getLastUsedWalletKey();if(Xr.groupedWallets.some(oo=>oo.walletConnector.key===ro))return{label:"Last used"};if(Xr.groupedWallets.some(oo=>oo.isInstalledOnBrowser))return{label:"Installed"};if(getWalletGroupType(Xr)==="multi-chain")return{label:"Multichain"}},getWalletLabel=(Xr,eo)=>{const to=getLastUsedWalletKey(),{key:ro}=Xr.walletConnector,no=eo==null?void 0:eo.find(oo=>oo.walletKey===ro);if(no)return{isRecommended:!0,label:no.label||"Recommended"};if(ro===to)return{label:"Last used"};if(Xr.isInstalledOnBrowser)return{label:"Installed"}},getWalletListItemLabel=({wallet:Xr,recommendedWallets:eo})=>isWalletGroup(Xr)?getWalletGroupLabel(Xr,eo):getWalletLabel(Xr,eo),isProgrammableNetworkSwitchSupported=Xr=>{const to=new URLSearchParams(window.location.search).get("dev_isProgrammableNetworkSwitchSupported");return to?to==="true":Xr.switchNetworkOnlyFromWallet!==!0},getWalletConnectorNetworks=Xr=>{if(!Xr)return[];const eo=Xr;return eo.evmNetworks||eo.starknetNetworks||[]},isSupportedNetwork=({walletConnector:Xr,network:eo})=>{const to=getWalletConnectorNetworks(Xr);return to.length?to.some(({chainId:no})=>String(no)===String(eo)):!0},useHandleWalletsToConnect=()=>{const{bridgeChains:Xr,bridgeChainsToConnect:eo,setShowAuthFlow:to,bridgeOnboardingCompleted:ro,setBridgeOnboardingCompleted:no}=useInternalDynamicContext(),{setView:io,goToInitialView:oo}=useViewContext();return{handleWalletsToConnect:({walletConnector:so})=>{if(!Xr){to(!1);return}if(!eo){no(!0),to(!1);return}if(eo.length===0||!so||!so.connectedChain)return to(!1),oo();if(eo.filter(fo=>fo.chain!==(so==null?void 0:so.connectedChain)).length===0){ro?(to(!1),oo()):(no(!0),io("bridge-summary"));return}io("bridge-next-wallet-connection")}}},specialCareWallets=["bloctoevm","perawallet","metamaskstarknet"],showPendingConnectView=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to=getWalletProvider(Xr);if(to==="walletConnect"||to==="qrCode")return;specialCareWallets.forEach(no=>{Xr.key===no&&eo("pending-connect")}),(yield Xr.getConnectedAccounts()).length===0&&eo("pending-connect")}),isConnectOnly=(Xr,eo)=>eo==="connect-only"&&!(Xr!==void 0),useConnectAndSign=({shouldUpdateWallets:Xr=!0,shouldCallCallback:eo=!0}={})=>{const{setView:to,goToInitialView:ro}=useViewContext(),{engageCaptcha:no,getCaptchaToken:io}=useCaptchaContext(),{setErrorMessage:oo}=useErrorContext(),{authMode:ao,connectWallet:so,consumeNonce:co,displaySiweStatement:lo,environmentId:fo,projectSettings:ho,networkValidationMode:go,setIsSingleWalletAccount:yo,user:vo,walletUiUtils:wo}=useInternalDynamicContext(),{handleWalletsToConnect:Eo}=useHandleWalletsToConnect(),ko=useVerifyWallet({consumeNonce:co,displaySiweStatement:lo,environmentId:fo,projectSettings:ho,setIsSingleWalletAccount:yo}),Ao=(jo,Mo,No)=>__awaiter$j(void 0,void 0,void 0,function*(){!isEmailWalletConnector(jo)||isBloctoConnector(jo)?to("pending-signature"):wo.disabledConfirmationOnce(),yield ko({captchaToken:No,publicWalletAddress:Mo,walletConnector:jo})}),Po=jo=>{var Mo;(jo==null?void 0:jo.code)==="user-cancelled"||logger$8.debug(jo),oo((Mo=jo==null?void 0:jo.code)===null||Mo===void 0?void 0:Mo.toString()),ro()};return jo=>__awaiter$j(void 0,[jo],void 0,function*({walletConnector:Mo,getAddressOpts:No=void 0}){var Do;try{yield showPendingConnectView(Mo,to),isEmailWalletConnector(Mo)&&(isEmailOTPWalletConnector(Mo)?to("email-wallet-otp-verification-view"):isBloctoConnector(Mo)||to("wait-for-email-confirmation-view"));const Fo=yield so(Mo,No,{applyHandleConnectedWallet:eo});if(!(Fo!=null&&Fo.address))return;const{address:Xo}=Fo,Lo=yield Mo.getNetwork();if(!isSupportedNetwork({network:Lo,walletConnector:Mo})&&(go==="always"||go==="sign-in"))return isProgrammableNetworkSwitchSupported(Mo)?to("network-not-supported"):to("network-not-supported-manual");if(isConnectOnly(vo,ao)){StorageService.setItem(LAST_USED_WALLET,Mo.key),Xr&&Eo({walletConnector:Mo});return}if(!((Do=ho==null?void 0:ho.security.hCaptcha)===null||Do===void 0)&&Do.enabled){no({authMethod:"wallet",onCaptchaSuccess:uo=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield Ao(Mo,Xo,uo)}catch(po){Po(po)}})});return}yield Ao(Mo,Xo,io())}catch(Fo){Po(Fo)}})},walletsRequiringTwoStepAuthentication=["dapper"],requiresTwoStepAuthentication=Xr=>isMobile$1()&&!(Xr!=null&&Xr.canConnectViaCustodialService)||walletsRequiringTwoStepAuthentication.includes((Xr==null?void 0:Xr.key)||""),useConnectAndSignSplitSteps=()=>{const{setView:Xr,goToInitialView:eo}=useViewContext(),{setErrorMessage:to}=useErrorContext(),{getCaptchaToken:ro,engageCaptcha:no}=useCaptchaContext(),{connectWallet:io,consumeNonce:oo,displaySiweStatement:ao,projectSettings:so,environmentId:co,networkValidationMode:lo,setIsSingleWalletAccount:fo,setShowAuthFlow:ho,user:go,authMode:yo}=useInternalDynamicContext(),{handleWalletsToConnect:vo}=useHandleWalletsToConnect(),wo=useVerifyWallet({consumeNonce:oo,displaySiweStatement:ao,environmentId:co,projectSettings:so,setIsSingleWalletAccount:fo}),Eo=Po=>{var jo;logger$8.debug(Po),!(Po instanceof MissingPublicAddressError&&isMobile$1())&&(eo(),to((jo=Po.code)!==null&&jo!==void 0?jo:Po.toString()))};return{onlyConnectUser:Po=>__awaiter$j(void 0,[Po],void 0,function*({walletConnector:jo,getAddressOpts:Mo=void 0,shouldShowPendingConnectView:No=!0}){var Do;No&&(yield showPendingConnectView(jo,Xr));try{if(yield io(jo,Mo),isConnectOnly(go,yo)){StorageService.setItem(LAST_USED_WALLET,jo.key),vo({walletConnector:jo});return}if(!((Do=so==null?void 0:so.security.hCaptcha)===null||Do===void 0)&&Do.enabled){no({authMethod:"wallet",onCaptchaSuccess:Fo=>__awaiter$j(void 0,void 0,void 0,function*(){ho(!0),Xr("pending-signature")})});return}ho(!0),Xr("pending-signature")}catch(Fo){Eo(Fo);return}}),signAlreadyConnectedUser:Po=>__awaiter$j(void 0,[Po],void 0,function*({walletConnector:jo,getAddressOpts:Mo=void 0}){try{const No=yield io(jo,Mo);if(!(No!=null&&No.address))return;const Do=yield jo.getNetwork();if(!isSupportedNetwork({network:Do,walletConnector:jo})&&(lo==="always"||lo==="sign-in"))return isProgrammableNetworkSwitchSupported(jo)?Xr("network-not-supported"):Xr("network-not-supported-manual");yield wo({captchaToken:ro(),publicWalletAddress:No.address,walletConnector:jo})}catch(No){Eo(No);return}})}},isSelectedWalletAlreadyConnected=(Xr,eo,to)=>to?Xr.map(({connector:ro})=>ro.key).includes(eo.key):!1,useWalletItemActions=()=>{const{setMultiWalletWidgetState:Xr,setShowAuthFlow:eo,setSelectedWalletConnectorKey:to,walletConnectorOptions:ro,setQrcodeUri:no,setDesktopUri:io,user:oo,linkedWallets:ao,setLegacyIsVerifying:so,authMode:co}=useInternalDynamicContext(),{mockedSDK:lo}=useMockContext(),{setError:fo,setErrorMessage:ho}=useErrorContext(),{setView:go,goToInitialView:yo}=useViewContext(),{onlyConnectUser:vo}=useConnectAndSignSplitSteps(),wo=useConnectAndSign(),Eo=Do=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleCustodialWalletClick",Do);const Fo=requiresTwoStepAuthentication(Do);logger$8.logVerboseTroubleshootingMessage("[handleCustodialWalletClick]",{twoStepAuthentication:Fo}),Fo?(to(Do.key),yield vo({walletConnector:Do})):(to(Do.key),Xr("awaiting_signature",void 0,"linking_new_wallet")),go("pending-signature")}),ko=Do=>__awaiter$j(void 0,void 0,void 0,function*(){var Fo;if(logger$8.debug("handleMobileWalletClick",Do),to(Do.key),Do.key==="phantom"){const Lo=StorageService.getItem(PHANTOM_SIGNATURE_STATE);StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:(Fo=Lo==null?void 0:Lo.loseOriginalAccountOnTransfer)!==null&&Fo!==void 0?Fo:!1,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_verification"})}const Xo=()=>{vo({shouldShowPendingConnectView:!1,walletConnector:Do})};go("mobile-wallet-redirect-view",{onRetry:Xo}),Xo()}),Ao=Do=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleInstalledExtensionClick",Do),to(Do.key),co==="connect-only"?(go("pending-connect"),vo({walletConnector:Do})):Xr("awaiting_signature",void 0,"linking_new_wallet")}),Po=Do=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleUninstalledClick",Do),to(Do.key),Do.canConnectViaQrCode?(wo({getAddressOpts:{onDesktopUri:Fo=>__awaiter$j(void 0,void 0,void 0,function*(){io(Fo)}),onDisplayUri:Fo=>__awaiter$j(void 0,void 0,void 0,function*(){no(Fo)})},walletConnector:Do}),go("qr-code")):go("no-qr-not-installed"),fo(void 0)}),jo=Do=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleAlreadyConnectedWallet",Do),eo(!1);const Fo=yield Do.getConnectedAccounts(),Xo=ao.find(Lo=>{var Bo;return Lo.address.toLowerCase()===((Bo=Fo[0])===null||Bo===void 0?void 0:Bo.toLowerCase())});logger$8.logVerboseTroubleshootingMessage("[handleAlreadyConnectedWallet]",{activeAccountAlreadyLinked:Xo,connectedAccounts:Fo,linkedWallets:ao}),Xo?Xr("awaiting_account_switch","linking_new_wallet"):Xr("awaiting_signature",void 0,"linking_new_wallet"),to(Do.key)});return{handleAlreadyConnectedWallet:jo,handleCustodialWalletClick:Eo,handleInstalledExtensionClick:Ao,handleMobileWalletClick:ko,handleUninstalledClick:Po,handleWalletItemClick:Do=>__awaiter$j(void 0,void 0,void 0,function*(){const{walletConnector:Fo,isInstalledOnBrowser:Xo}=Do,Lo=Fo.connectedChain==="FLOW"||isPhantomRedirectConnector(Fo);if(logger$8.logVerboseTroubleshootingMessage("[handleWalletItemClick]",{mockedSDK:lo,shouldEndWalletConnectorSession:Lo,wallet:Do}),!lo){if(Lo&&(yield Fo.endSession()),so(!1),co!=="connect-only")try{yield Fo.chooseAccountsToConnect()}catch(Bo){if(Bo instanceof UserRejectedRequestError){ho("connection_rejected"),yo();return}}isSelectedWalletAlreadyConnected(ao,Fo,oo)&&Fo.connectedChain!=="FLOW"?jo(Fo):Fo.canConnectViaCustodialService?Eo(Fo):isMobile$1()?Fo.key==="walletconnect"?go("wallet-connect-mobile-wallets-list"):ko(Fo):Xo?Ao(Fo):Po(Fo)}}),openWallet:(Do,Fo)=>{var Xo;const{openMobileWallet:Lo=ko,openCustodialWallet:Bo=Eo,openExtensionWallet:xo=Ao}=Fo||{},uo=(Xo=ro.find(po=>po.key===Do))===null||Xo===void 0?void 0:Xo.walletConnector;uo&&(isMobile$1()?Lo(uo):uo.canConnectViaCustodialService?Bo(uo):uo.isInstalledOnBrowser()&&xo(uo))}}},ListTileAnimatedTrailing=({hoverElement:Xr,children:eo})=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"list-tile-animated-trailing",children:[jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__child",children:eo}),jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__hover-element",children:Xr})]})}),ListTile=({children:Xr,onClick:eo,leading:to,disabled:ro=!1,trailing:no,style:io,className:oo="",dataTestId:ao,copykey:so})=>jsxRuntimeExports.jsxs("button",{"data-testid":ao,type:"button",className:classNames(oo,"list-tile"),onClick:eo,style:io,disabled:ro,children:[to,jsxRuntimeExports.jsx("div",{className:"list-tile__children",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",copykey:so,children:Xr})}),no]}),WalletListItem=({disabled:Xr=!1,wallet:eo,onResetSearchValue:to,recommendedWallets:ro,tile:no=({leading:io,name:oo,onClick:ao,trailing:so})=>jsxRuntimeExports.jsx(ListTile,{leading:io,trailing:so,onClick:ao,className:"wallet-list-item__tile",dataTestId:"ListTile",children:oo})})=>{const{navigateToWalletGroup:io}=useWalletGroupContext(),{setView:oo}=useViewContext(),ao=isWalletGroup(eo),{walletBook:so}=useWalletBookContext(),{handleWalletItemClick:co}=useWalletItemActions(),lo=getWalletListItemLabel({recommendedWallets:ro,wallet:eo}),fo=no,ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr){if(to==null||to(""),ao)return io(eo);if(isHardwareWalletConnector(eo.walletConnector)&&eo.walletConnector.canConnectWithHardwareWallet()){oo("select-hardware-wallet",{onSelectWallet:co,wallet:eo});return}yield co(eo)}}),go=ao?getWalletGroup(so,eo.key).name:getWalletBookWallet(so,eo.key).name,yo=jsxRuntimeExports.jsx(WalletIcon,{className:"wallet-list-item__leading",walletKey:eo.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}),vo=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:lo&&jsxRuntimeExports.jsx(Badge,{dot:!lo.isRecommended,variant:lo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:lo.label})})});return jsxRuntimeExports.jsx(fo,{leading:yo,trailing:vo,name:go,onClick:ho})},NewToWeb3WalletItem=({children:Xr,style:eo,wallet:to})=>jsxRuntimeExports.jsx(WalletListItem,{wallet:to,tile:Xr?({onClick:ro})=>jsxRuntimeExports.jsx("button",{className:"new-to-web3--button",style:eo,onClick:ro,children:Xr}):void 0}),Item=({heading:Xr,StartIcon:eo,EndIcon:to,message:ro,url:no})=>jsxRuntimeExports.jsxs("a",{className:"footer-buttons-item",href:no,rel:"noopener noreferrer",target:"_blank",children:[jsxRuntimeExports.jsx("div",{className:"footer-buttons-item__icon--left",children:jsxRuntimeExports.jsx(eo,{})}),jsxRuntimeExports.jsxs("div",{className:"footer-buttons-item__typography",children:[jsxRuntimeExports.jsx(Typography,{as:"h2",weight:"regular",color:"primary",variant:"body_normal",children:Xr}),ro&&jsxRuntimeExports.jsx(Typography,{as:"p",weight:"regular",color:"secondary",children:ro})]}),to&&jsxRuntimeExports.jsx(to,{style:{height:"1.5rem",width:"1.5rem"}})]}),WalletExtensionOrAppContinueButton=({wallet:Xr,selectedUrl:eo})=>{const to=!!eo.length&&!(Xr!=null&&Xr.isInstalledOnBrowser),ro=()=>{Xr!=null&&Xr.key&&(StorageService.setItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY,Xr.key),window.location.reload())};return jsxRuntimeExports.jsxs("div",{className:"new-to-web3-buttons__container",children:[!isMobile$1()&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(Xr==null?void 0:Xr.isInstalledOnBrowser)&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Xr,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"desktop-interactive-wallet-item",variant:"body_normal",weight:"bold",children:"Continue"})}),to&&jsxRuntimeExports.jsx("button",{onClick:ro,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"refresh-once-installed-button",variant:"body_normal",weight:"bold",children:"Continue once installed"})})]}),Xr&&isMobile$1()&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Xr,children:jsxRuntimeExports.jsx("p",{"data-testid":"mobile-interactive-wallet-item",children:"Continue once installed"})})]})},WalletListHelpContent=({chains:Xr,newToWeb3WalletChainMap:eo})=>{var to,ro;const{walletConnectorOptions:no}=useInternalDynamicContext(),{walletBook:io}=useWalletBookContext(),[oo,ao]=reactExports.useState(""),so=((to=Xr==null?void 0:Xr.filter(Eo=>!!Eo.enabled).find(Eo=>Eo.name===eo.primary_chain))===null||to===void 0?void 0:to.name)||"evm",co=getValueByKey(eo==null?void 0:eo.wallets,so),lo=no.find(Eo=>Eo.key===co),fo=lo==null?void 0:lo.walletConnector.canConnectViaCustodialService,ho=getWalletLinks(io,co),{currentDesktopUrl:go,canShowAndroidAppButton:yo,canShowIosAppButton:vo}=parseWalletLinks(ho),wo=[{content:"Install Desktop extension",icon:SvgPuzzle,isEnabled:!!(go!=null&&go.length)&&!isMobile$1(),url:go},{content:"Install iOS app",icon:AppleIcon,isEnabled:vo,url:ho.ios},{content:"Install Android app",icon:AndroidIcon,isEnabled:yo,url:ho.android}];return Object.keys((ro=io==null?void 0:io.wallets)!==null&&ro!==void 0?ro:{}).length?jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__container",children:jsxRuntimeExports.jsxs(EnterTileAnimation,{delay:"300ms",children:[jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:co,style:{height:pixelToRem(56),width:pixelToRem(56)}})}),jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"title",weight:"medium",children:["We recommend installing"," ",getWalletBookWallet(io,co).name]}),jsxRuntimeExports.jsx(Typography,{as:"label",variant:"body_normal",weight:"regular",color:"secondary",className:"walletlist-help-content__typography--label",children:"Select your preferred option below:"})]}),jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__buttons-wrapper",children:wo.map((Eo,ko)=>Eo.isEnabled?jsxRuntimeExports.jsx("button",{onClick:()=>ao(Eo.url),children:jsxRuntimeExports.jsx(Item,{StartIcon:Eo.icon,heading:Eo.content,url:Eo.url})},ko):void 0)}),fo&&jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__custodial-wallet-area",children:[jsxRuntimeExports.jsx(Typography,{className:"walletlist-help-content__custodial-wallet-area--title",as:"p",color:"secondary",variant:"body_normal",weight:"regular",children:"If you don't want to install a wallet, then use:"}),jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:lo})]}),jsxRuntimeExports.jsx(WalletExtensionOrAppContinueButton,{selectedUrl:oo,wallet:lo})]})}):jsxRuntimeExports.jsx(Skeleton,{className:"walletlist-footer-content__container"})};var _path$y,_excluded$H=["title","titleId"];function _extends$J(){return _extends$J=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$H(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgChevronLeft=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$H(eo,_excluded$H);return reactExports.createElement("svg",_extends$J({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$y||(_path$y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.09 3.577a.833.833 0 0 1 0 1.179L7.844 10l5.244 5.244a.833.833 0 0 1-1.178 1.179l-5.834-5.834a.833.833 0 0 1 0-1.178l5.834-5.834a.833.833 0 0 1 1.178 0Z",fill:"currentcolor"})))};const HelpHeader=()=>{const{authMode:Xr}=useInternalDynamicContext(),{setIsFooterExpanded:eo}=useFooterAnimationContext(),{view:to}=useViewContext(),{helpHeaderData:ro}=useDynamicLayoutData({authMode:Xr,view:to.type}),{displayBorderBelowHeader:no}=useAuthLayoutChecks(),io=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>eo(!1),"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgChevronLeft,{className:"back-button "})});return jsxRuntimeExports.jsx("div",{className:"help-header",children:jsxRuntimeExports.jsx(ModalHeader,{trailing:io,displayLeading:!1,displayBorder:no,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-help-heading",className:"header__typography",copykey:ro==null?void 0:ro.copykey,children:ro==null?void 0:ro.heading})})})};var _path$x,_excluded$G=["title","titleId"];function _extends$I(){return _extends$I=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$G(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUserAccount2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$G(eo,_excluded$G);return reactExports.createElement("svg",_extends$I({width:60,height:50,viewBox:"0 0 60 50",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$x||(_path$x=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.931 49.48A29.223 29.223 0 0 0 59.333 30C59.333 13.8 46.2.667 30 .667S.667 13.8.667 30A29.224 29.224 0 0 0 8.07 49.483c5.52-6.63 16.005-9.007 22.387-9.007 6.383 0 15.962 1.903 21.473 9.004ZM19 22.667c0-6.076 4.925-11 11-11s11 4.924 11 11c0 6.075-4.925 11-11 11s-11-4.925-11-11Z",fill:"#4779FF"})))};const PasskeyInfoHelper=()=>{const{t:Xr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"passkey-info-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgUserAccount2,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_1.title",children:Xr("dyn_passkey_intro.helper.section_1.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_1.description",children:Xr("dyn_passkey_intro.helper.section_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgFooterKeyIcon,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_2.title",children:Xr("dyn_passkey_intro.helper.section_2.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_2.description",children:Xr("dyn_passkey_intro.helper.section_2.description")})]})]})]})})})},HelpContent=()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(HelpHeader,{}),jsxRuntimeExports.jsx(HelpContentSwitch,{})]}),HelpContentSwitch=()=>{const{view:Xr}=useViewContext(),{projectSettings:eo,newToWeb3WalletChainMap:to,selectedWalletConnector:ro}=useInternalDynamicContext(),no=reactExports.useMemo(()=>Xr.type==="wallet-connect-mobile-wallets-list"||Xr.type==="wallet-list"||Xr.type==="login-with-email-or-wallet-full-wallet-list"||Xr.type==="login-with-wallet-only",[Xr]),io=reactExports.useMemo(()=>Xr.type==="pending-signature-without-back-button"||Xr.type==="pending-signature",[Xr]),oo=reactExports.useMemo(()=>Xr.type==="pending-connect"||Xr.type==="qr-code",[Xr]),ao=reactExports.useMemo(()=>Xr.type==="passkey-intro",[Xr]);return no?jsxRuntimeExports.jsx(WalletListHelpContent,{chains:eo==null?void 0:eo.chains,newToWeb3WalletChainMap:to}):io?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"sign",wallet:ro||void 0}):oo?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"connect"}):ao?jsxRuntimeExports.jsx(PasskeyInfoHelper,{}):jsxRuntimeExports.jsx(EmptyHelpContent,{})},TosAndPp=()=>{const{user:Xr,authMode:eo,customPrivacyPolicy:to,customTermsOfServices:ro,privacyPolicyUrl:no,termsOfServiceUrl:io}=useInternalDynamicContext(),oo=isConnectOnly(Xr,eo)?"connecting":"logging in",ao=()=>{if(io)return jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:io,target:"_blank",rel:"noreferrer",children:"Terms of Service"})},so=()=>{if(no)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[io&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" & "}),jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:no,target:"_blank",rel:"noreferrer",children:"Privacy Policy"})]})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(no||io)&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:"tos-and-pp__text",children:["By ",oo,", you agree to",jsxRuntimeExports.jsx("br",{}),"our ",ao(),so(),"."]}),ro,to]})},ToSFooter=()=>{const{showToSFooter:Xr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{className:"tos-and-pp__footer",children:Xr&&jsxRuntimeExports.jsx(TosAndPp,{})})},getChainStepState=(Xr,eo)=>{const to=Xr===eo[0],ro=!eo.includes(Xr);return to?"current":ro?"done":"upcoming"},typographyOpacityMap={current:"1",default:"1",done:"0.4",upcoming:"0.15"},Step=({children:Xr,className:eo,icon:to,state:ro="default"})=>{const no=reactExports.useMemo(()=>({opacity:ro==="upcoming"?.5:1}),[ro]),io=reactExports.useMemo(()=>ro==="done"?jsxRuntimeExports.jsx("div",{className:"step__icon step__icon--done",children:jsxRuntimeExports.jsx(Icon,{className:"step__icon__check-mark",children:jsxRuntimeExports.jsx(SvgCheck,{style:no})})}):to?jsxRuntimeExports.jsx(Icon,{className:"step__icon",children:jsxRuntimeExports.jsx("div",{style:no,children:to})}):jsxRuntimeExports.jsx("div",{className:"step__index",children:jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:no,children:jsxRuntimeExports.jsx("span",{className:"step__index-label"})})}),[to,ro,no]);return jsxRuntimeExports.jsxs("div",{className:classNames("step",eo),children:[io,jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:{opacity:typographyOpacityMap[ro]},children:Xr})]})},Stepper=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"stepper",children:reactExports.Children.map(Xr,(eo,to)=>{const ro=to===0?void 0:jsxRuntimeExports.jsx(Divider,{className:"stepper__divider"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ro,eo]})})}),WalletProgressStepper=()=>{const{bridgeChainsToConnect:Xr=[],bridgeChains:eo=[]}=useInternalDynamicContext(),to=eo.map(({chain:no})=>no),ro=[...Xr].map(({chain:no})=>no);return jsxRuntimeExports.jsx("div",{className:"wallet-progress-stepper","data-testid":"wallet-progress-stepper",children:jsxRuntimeExports.jsx(Stepper,{children:to.map((no,io)=>{var oo;const ao=getChainInfoWithOverrides(no),so=getChainIcon(no);return jsxRuntimeExports.jsx(Step,{state:getChainStepState(no,ro),icon:jsxRuntimeExports.jsx(so,{}),children:(oo=ao==null?void 0:ao.blockchainName)!==null&&oo!==void 0?oo:ao==null?void 0:ao.displayName},no)})})})},DynamicAuthLayout=({children:Xr,className:eo,style:to,onClose:ro,projectSettings:no,hideBridgeProgressSteppers:io})=>{const{view:oo}=useViewContext(),{authMode:ao}=useInternalDynamicContext(),{isFooterExpanded:so}=useFooterAnimationContext(),{headerData:co,helpHeaderData:lo}=useDynamicLayoutData({authMode:ao,view:oo.type}),{showConnectedWalletProgress:fo,showHeader:ho,showHelpContent:go,showToSFooter:yo,showDynamicFooter:vo}=useAuthLayoutChecks();return jsxRuntimeExports.jsx(OverlayCardTarget,{children:jsxRuntimeExports.jsxs(VerticalAccordion,{style:to,className:eo,children:[jsxRuntimeExports.jsxs(AccordionItem,{isOpen:!so,dimOnHide:!0,children:[fo&&!io&&jsxRuntimeExports.jsx(WalletProgressStepper,{}),ho&&jsxRuntimeExports.jsx(Header,{onClose:ro,heading:(co==null?void 0:co.heading)||"",projectSettings:no,copykey:co==null?void 0:co.copykey}),Xr,yo&&jsxRuntimeExports.jsx(ToSFooter,{}),vo&&jsxRuntimeExports.jsx(DynamicFooter,{})]}),lo&&go&&jsxRuntimeExports.jsx(AccordionItem,{isOpen:so,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(HelpContent,{})},so.toString())})]})})},SandboxIndicatorWrapper=({children:Xr})=>{const{projectSettings:eo}=useInternalDynamicContext(),to=reactExports.useRef(null),[ro,no]=reactExports.useState(void 0),io=(eo==null?void 0:eo.environmentName)===EnvironmentEnum.Sandbox;return reactExports.useEffect(()=>{var oo;const ao=(oo=to.current)===null||oo===void 0?void 0:oo.clientHeight;no(ao)},[to,no]),io?jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[jsxRuntimeExports.jsx("div",{ref:to,style:{background:"var(--dynamic-alert-1)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",color:"white",left:"calc( var(--dynamic-border-radius) + 8px)",padding:"2px 8px 4px",position:"absolute",top:-(ro||0)},"data-testid":"sandbox-indicator",children:capitalize$1((eo==null?void 0:eo.environmentName)||"")}),Xr]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xr})},DynamicAuthModal=({children:Xr,onClose:eo,transitionProps:to,projectSettings:ro,className:no})=>{const{showConnectedWalletProgress:io}=useAuthLayoutChecks();return jsxRuntimeExports.jsxs(Modal$1,{isShown:!!(to!=null&&to.isShown),children:[io&&jsxRuntimeExports.jsx(ModalCard,{borderRadius:"small",children:jsxRuntimeExports.jsx(WalletProgressStepper,{})}),jsxRuntimeExports.jsx(SandboxIndicatorWrapper,{children:jsxRuntimeExports.jsx(ModalCard,{dataTestId:"dynamic-auth-modal",children:jsxRuntimeExports.jsx(DynamicAuthLayout,{className:no,projectSettings:ro,onClose:eo,hideBridgeProgressSteppers:!0,children:Xr})})})]})},MockContext=reactExports.createContext(void 0),useMockContext=()=>{const Xr=reactExports.useContext(MockContext);return Xr===void 0?{mockedSDK:!1}:Xr},LoadingContext=reactExports.createContext(void 0),LoadingContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(!1);useInternalDynamicEvents("logout",()=>to(!1)),useInternalDynamicEvents("embeddedWalletCreated",()=>to(!1));const ro=reactExports.useMemo(()=>({loading:eo,setLoading:to}),[eo]);return jsxRuntimeExports.jsx(LoadingContext.Provider,{value:ro,children:Xr})},useLoadingContext=()=>{const Xr=reactExports.useContext(LoadingContext);if(Xr===void 0)throw new Error("usage of useLoadingContext not wrapped in `LoadingContextProvider`.");return Xr},{getProjectSettings,setProjectSettings,useProjectSettings,resetProjectSettings}=createStoreState("projectSettings"),useFetchProjectSettings=({environmentId:Xr,retries:eo=2})=>{const to=useProjectSettings(),ro=!!(to!=null&&to.settings),{retrigger:no}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const io=yield fetchProjectSettings(Xr);if(!io)throw new DynamicError("Settings are not defined");return io}),{deps:[Xr],enabled:!ro,onResolve:io=>{const oo=new Date().getTime()+3e5;setProjectSettings({expiresAt:oo,settings:io})},retries:eo});useDynamicEvents("logout",no)},AccordionItem=reactExports.forwardRef(({children:Xr,className:eo="",isOpen:to,dataTestId:ro,dimOnHide:no=!1,handleScroll:io=()=>{}},oo)=>{const ao=reactExports.useRef(null),so=reactExports.useRef(),[co]=useResizeObserver(ao),lo=reactExports.useMemo(()=>to?co?co.height:so.current:0,[to,co]);return reactExports.useEffect(()=>{const fo=co==null?void 0:co.height;fo&&(so.current=fo)},[co]),jsxRuntimeExports.jsxs("div",{"data-testid":ro,style:{maxHeight:lo},className:classNames(eo,"accordion-item",{"accordion-item--full-height":!!lo}),onScroll:io,ref:oo,children:[no&&jsxRuntimeExports.jsx("div",{"data-testid":"accordion-item-curtain",className:classNames("accordion-item__curtain",{"accordion-item__curtain--dimmed":!to})}),jsxRuntimeExports.jsx("div",{ref:ao,children:Xr})]})});AccordionItem.displayName="AccordionItem";var _g$a,_defs$a,_excluded$F=["title","titleId"];function _extends$H(){return _extends$H=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$F(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAccessBlocked=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$F(eo,_excluded$F);return reactExports.createElement("svg",_extends$H({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$a||(_g$a=reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#access-blocked_svg__b)",fillOpacity:.12}),reactExports.createElement("circle",{cx:220.352,cy:29.265,r:15.729,transform:"rotate(15 220.352 29.265)",fill:"#4779FF"}),reactExports.createElement("path",{d:"M223.594 23.62a1.573 1.573 0 1 0-3.038-.815l-1.629 6.078a1.573 1.573 0 1 0 3.039.814l1.628-6.077ZM219.225 33.848a1.573 1.573 0 0 0-.814 3.039l.015.004a1.574 1.574 0 0 0 .814-3.039l-.015-.004Z",fill:"#F9F9FB"}),reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M101.972 36.04a8 8 0 0 1 9.798 5.657l-2.897.777a5 5 0 0 0-9.66 2.588l-2.897.776a8 8 0 0 1 5.656-9.797ZM118.498 47.487a5.333 5.333 0 0 0-6.532-3.772l-14.81 3.969a5.333 5.333 0 0 0-3.772 6.532l1.898 7.084a5.333 5.333 0 0 0 6.532 3.77l14.811-3.968a5.334 5.334 0 0 0 3.771-6.532l-1.898-7.083Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-3.344 46.703c-1.172-2.936-2.026-7.051-2.236-11.797h9.298c-.21 4.746-1.064 8.861-2.236 11.797-.683 1.709-1.393 2.816-1.971 3.428-.198.21-.346.328-.442.393a2.703 2.703 0 0 1-.442-.392c-.578-.613-1.288-1.72-1.971-3.429Zm0-28.13c-1.208 3.025-2.078 7.301-2.253 12.228h9.332c-.175-4.927-1.045-9.203-2.253-12.227-.683-1.709-1.393-2.816-1.971-3.429a2.703 2.703 0 0 0-.442-.392 2.703 2.703 0 0 0-.442.392c-.578.613-1.288 1.72-1.971 3.429Zm-15.106 12.228h8.746c.21-6.38 1.506-11.989 3.423-15.668-6.57 2.184-11.466 8.283-12.169 15.668Zm.046 4.105h8.716c.253 6.201 1.533 11.642 3.407 15.238-6.442-2.141-11.274-8.046-12.123-15.238Zm34.946 0h-8.716c-.253 6.201-1.533 11.642-3.407 15.238 6.442-2.141 11.275-8.046 12.123-15.238Zm.133-2.267v.065-.131.066Zm-8.833-1.838h8.746c-.703-7.385-5.599-13.484-12.169-15.668 1.917 3.68 3.213 9.289 3.423 15.668Zm-8.909 19.795c0-.001.007-.004.023-.008a.077.077 0 0 1-.023.008Zm.25-.008a.064.064 0 0 1 .022.008s-.007-.001-.022-.008Zm.022-35.907c0 .001-.007.004-.023.008a.077.077 0 0 1 .023-.008Zm-.249.008c-.016-.004-.023-.007-.023-.008 0 0 .007.001.023.008Z",fill:"#4779FF"}))),_defs$a||(_defs$a=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"access-blocked_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"access-blocked_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 188.268 -307.493)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"access-blocked_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AccessBlockedView=()=>{const[Xr,eo]=reactExports.useState(),{t:to}=useTranslation(),{getIpConfiguration:ro}=useIpConfigurationContext();return usePromise(ro,{deps:[ro,Xr],onResolve:no=>eo(no==null?void 0:no.country),retries:2}),jsxRuntimeExports.jsxs("div",{className:"access-blocked__container",children:[jsxRuntimeExports.jsx("div",{className:"access-blocked__icon",children:jsxRuntimeExports.jsx(SvgAccessBlocked,{})}),jsxRuntimeExports.jsx("div",{className:"access-blocked__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:to("dyn_access_blocked.content",{jurisdiction:Xr})})})]})};var _path$w,_excluded$E=["title","titleId"];function _extends$G(){return _extends$G=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$E(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletConnectLogo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$E(eo,_excluded$E);return reactExports.createElement("svg",_extends$G({width:17,height:12,viewBox:"0 0 17 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$w||(_path$w=reactExports.createElement("path",{d:"M3.84 2.345c2.573-3.127 6.747-3.127 9.32 0l.31.376a.463.463 0 0 1 0 .566l-1.06 1.287a.145.145 0 0 1-.232 0l-.427-.518c-1.795-2.18-4.707-2.18-6.502 0l-.457.555a.145.145 0 0 1-.233 0L3.5 3.324a.463.463 0 0 1 0-.566l.34-.413Zm11.512 2.661.943 1.146a.463.463 0 0 1 0 .566l-4.252 5.165a.29.29 0 0 1-.466 0L8.558 8.217a.073.073 0 0 0-.116 0l-3.018 3.666a.29.29 0 0 1-.466 0L.705 6.718a.463.463 0 0 1 0-.566l.943-1.146a.29.29 0 0 1 .466 0l3.018 3.666c.032.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0l3.018 3.666c.033.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0Z",fill:"currentColor"})))};const Indicator=({indicator:Xr,iconSize:eo})=>{const to={container:eo*4/15,icon:eo*3/15},ro={container:eo/6,icon:eo/9};return Xr==="walletConnect"?jsxRuntimeExports.jsx("div",{className:"indicator__wallet-connect",style:{height:pixelToRem(to.container),width:pixelToRem(to.container)},children:jsxRuntimeExports.jsx(SvgWalletConnectLogo,{style:{height:pixelToRem(to.icon),width:pixelToRem(to.icon)}})}):jsxRuntimeExports.jsx("div",{className:"indicator__container indicator__container--connected",style:{height:pixelToRem(ro.container),width:pixelToRem(ro.container)},"data-testid":"connected-indicator",children:jsxRuntimeExports.jsx("div",{className:"indicator__icon",style:{height:pixelToRem(ro.icon),width:pixelToRem(ro.icon)}})})},iconRatio=7/11,IconWithSpinner=({iconSize:Xr=24,Icon:eo,isSpinning:to=!1,className:ro="",indicator:no,customSpinnerColor:io,treatAsFunctionComponent:oo})=>{const ao=Xr*iconRatio,so=Xr/2,co=classNames("icon-with-spinner__container",ro),lo=eo;return jsxRuntimeExports.jsxs("div",{className:co,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)},children:[eo&&jsxRuntimeExports.jsxs("div",{style:{height:pixelToRem(ao),width:pixelToRem(ao)},className:"icon-with-spinner__icon-container",children:[oo||typeof eo=="function"?jsxRuntimeExports.jsx(lo,{height:ao,width:ao}):eo,no&&jsxRuntimeExports.jsx(Indicator,{indicator:no,iconSize:Xr})]}),to&&!isLegacySafari()&&jsxRuntimeExports.jsx("div",{className:"icon-with-spinner__spinner-container icon-with-spinner__animation","data-chromatic":"ignore",style:{height:pixelToRem(Xr),width:pixelToRem(Xr)},children:jsxRuntimeExports.jsx(Spinner,{className:"icon-with-spinner__spinner",customSpinnerColor:io,size:so})})]})},IconListTile=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);return jsxRuntimeExports.jsx(ListTile,Object.assign({},ro,{className:classNames(to,"icon-list-tile"),children:jsxRuntimeExports.jsx("div",{className:"icon-list-tile--children",children:eo})}))},isEmailProviderEnabled=Xr=>Xr!==void 0&&(isProviderEnabled(Xr,ProviderEnum.Dynamic)||isProviderEnabled(Xr,ProviderEnum.Blocto)||isProviderEnabled(Xr,ProviderEnum.MagicLink)),findEmailOtpWalletConnector=Xr=>Xr.map(({walletConnector:to})=>to).find(to=>isEmailWalletConnector(to)&&to.requiresNonDynamicEmailOtp),getEmailProvider=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to}){try{return yield sdkApi$1().getEmailProvider({email:eo,environmentId:to})}catch(ro){const no=yield ro.json();throw logger$8.error(no.error),new EmailProviderError(no.code)}}),createEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to,captchaToken:ro}){try{return yield sdkApi$1().createEmailVerification({emailVerificationCreateRequest:{captchaToken:ro,email:eo},environmentId:to})}catch(no){const io=yield no.json();throw logger$8.error(io.error),new EmailVerificationError(io.code)}}),signInWithEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro,captchaToken:no,sessionPublicKey:io}){try{return yield sdkApi$1().signInWithEmailVerification({emailVerificationVerifyRequest:{captchaToken:no,sessionPublicKey:io,verificationToken:eo,verificationUUID:to},environmentId:ro})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),ao.error.code==="missing_from_list"?new NoAccessError({email:ao.payload.email}):ao.code==="email_associated_with_different_provider"?new AccountExistsError(ao.error,ao.payload):ao.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(ao.error.message):new EmailVerificationError(ao.code)}}),retryEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to,verificationUUID:ro}){try{return yield sdkApi$1().retryEmailVerification({emailVerificationRetryRequest:{email:eo,verificationUUID:ro},environmentId:to})}catch(no){const io=yield no.json();throw logger$8.error(io.error),new EmailVerificationError(io.code)}}),verifyEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro}){try{return yield sdkApi$1().verifyEmailVerification({emailVerificationVerifyRequest:{verificationToken:eo,verificationUUID:to},environmentId:ro})}catch(no){const io=yield no.json();throw logger$8.error(io.error),io.code===UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail?new UserHasAccountWithEmailError(io.error):io.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(io.error.message):new EmailVerificationError(io.code)}}),useConnectWithEmail=({emailWalletConnector:Xr,handleConnect:eo})=>{const{error:to}=useErrorContext(),[ro,no]=reactExports.useState(!1),io=oo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!(!oo||!Xr||ro)){no(!0),Xr.setEmail(oo);try{yield eo(Xr)}catch(ao){logger$8.error(ao),no(!1)}}});return reactExports.useEffect(()=>{to&&ro&&no(!1)},[to,ro]),{connectWithEmail:io,loading:ro}},useEmailProvider=({emailWalletConnector:Xr})=>{const{projectSettings:eo,environmentId:to}=useInternalDynamicContext(),{setDisplayedDestination:ro,setVerificationUUID:no}=useVerification(),{setView:io}=useViewContext(),{handleInstalledExtensionClick:oo}=useWalletItemActions(),{connectWithEmail:ao,loading:so}=useConnectWithEmail({emailWalletConnector:Xr,handleConnect:oo}),{providers:co}=eo||{},fo=Xr!==void 0&&(isProviderEnabled(co||[],ProviderEnum.MagicLink)||isProviderEnabled(co||[],ProviderEnum.Blocto)),ho=(wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const{email:ko,verificationUUID:Ao}=yield createEmailVerification({captchaToken:Eo,email:wo,environmentId:to});io("login-with-email-verification"),ro(ko),no(Ao)}),go=wo=>__awaiter$j(void 0,void 0,void 0,function*(){yield ao(wo)}),yo=(wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){if(fo){yield go(wo);return}yield ho(wo,Eo)});return{handleEmailSubmitWithOptionalCaptcha:(wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){dynamicEvents.emit("authInit",{email:wo,option:wo,type:"email"});try{if((Xr!==void 0||isTurnkeyEnabled(eo))&&(eo!=null&&eo.sdk.confirmEmailProviderForVerify)){const{emailProvider:ko}=yield getEmailProvider({email:wo,environmentId:to});if(ko===ProviderEnum.Dynamic){yield ho(wo,Eo);return}}yield yo(wo,Eo)}catch(ko){throw dynamicEvents.emit("authFailure",{email:wo,option:wo,type:"email"},{error:ko}),ko}}),isEmailProviderLoading:so}},EMAIL_REGEX=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isEmailValid=Xr=>EMAIL_REGEX.test(Xr);var _rect$1,_path$v,_excluded$D=["title","titleId"];function _extends$F(){return _extends$F=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$D(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowRightBackground=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$D(eo,_excluded$D);return reactExports.createElement("svg",_extends$F({width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_rect$1||(_rect$1=reactExports.createElement("rect",{x:.5,width:24,height:24,rx:12,fill:"var(--icon-background, var(--dynamic-hover))"})),_path$v||(_path$v=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.22 7.47a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H7.5a.75.75 0 0 1 0-1.5h8.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",fill:"var(--icon-arrow, var(--dynamic-text-secondary))"})))};const InlineSubmitButton=({disabled:Xr,highlighted:eo,isFocused:to,isHovered:ro,className:no,style:io,emailSubmitButtonInsideInput:oo=!1})=>oo?jsxRuntimeExports.jsx(IconButton,{"data-testid":"in_line_submit_button",type:"submit",className:classNames("inline-submit-button",no,{"inline-submit-button--active":to||ro,"inline-submit-button--ready":eo}),disabled:Xr,style:io,children:jsxRuntimeExports.jsx(SvgArrowRightBackground,{})}):null,EmailForm=({isLoading:Xr,onSubmit:eo,isEmailInvalid:to=!1,currentEmail:ro,emailSubmitButtonInsideInput:no=!1,buttonCopyKey:io="dyn_login.email_form.submit_button.label",isDisabled:oo=!1,className:ao,style:so})=>{const{t:co}=useTranslation(),[lo,fo]=reactExports.useState(ro??""),[ho,go]=reactExports.useState(!1),[yo,vo]=reactExports.useState(!1),wo=ko=>{const{value:Ao}=ko.currentTarget;fo(Ao)},Eo=ko=>__awaiter$j(void 0,void 0,void 0,function*(){ko.preventDefault(),isEmailValid(lo)&&(eo==null||eo(lo))});return jsxRuntimeExports.jsxs("form",{className:classNames("login-with-email-form",ao),style:so,"data-testid":"email-form",onSubmit:ko=>Eo(ko),children:[jsxRuntimeExports.jsx(Input,{id:"email_field",value:lo,onChange:wo,copykey:"dyn_login.email_form.email_field.label",label:co("dyn_login.email_form.email_field.label"),error:to,message:to&&co("dyn_login.helper.email_form.invalid_email"),suffix:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:Xr||oo,highlighted:lo.length>0,isFocused:yo,isHovered:ho,emailSubmitButtonInsideInput:no}),disabled:Xr||oo,type:"email",onPointerEnter:()=>go(!0),onPointerLeave:()=>go(!1),onFocus:()=>vo(!0),onBlur:()=>vo(!1),autoComplete:"email"}),!no&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"submit_button",buttonClassName:"login-with-email-form__button",type:"submit",loading:Xr,disabled:Xr||lo.length<3||oo,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,copykey:io,typographyProps:{color:"inherit"},children:co(io)})]})},LoginEmailForm=({isLoading:Xr,onSubmit:eo,onSubmitError:to,currentEmail:ro,className:no,style:io})=>{var oo,ao;const{walletConnectorOptions:so,projectSettings:co}=useInternalDynamicContext(),{view:lo,setView:fo}=useViewContext(),{setErrorMessage:ho}=useErrorContext(),{engageCaptcha:go}=useCaptchaContext(),[yo,vo]=reactExports.useState(!1),wo=findEmailOtpWalletConnector(so),{handleEmailSubmitWithOptionalCaptcha:Eo,isEmailProviderLoading:ko}=useEmailProvider({emailWalletConnector:wo}),Ao=reactExports.useMemo(()=>ko||Xr,[ko,Xr]),Po=Mo=>{Mo.code==="invalid_email_address"?vo(!0):ho(Mo.code),logger$8.debug(Mo),to==null||to()},jo=Mo=>__awaiter$j(void 0,void 0,void 0,function*(){var No;try{if(eo==null||eo(),!((No=co==null?void 0:co.security.hCaptcha)===null||No===void 0)&&No.enabled&&(wo==null?void 0:wo.key)!=="magicemailotp"){go({authMethod:"email",onCaptchaSuccess:Do=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield Eo(Mo,Do)}catch(Fo){fo(lo.type),Po(Fo)}})});return}yield Eo(Mo)}catch(Do){Po(Do)}});return isEmailProviderEnabled((oo=co==null?void 0:co.providers)!==null&&oo!==void 0?oo:[])?jsxRuntimeExports.jsx(EmailForm,{onSubmit:jo,isLoading:Ao,currentEmail:ro,emailSubmitButtonInsideInput:(ao=co==null?void 0:co.design.modal)===null||ao===void 0?void 0:ao.emailSubmitButtonInsideInput,isEmailInvalid:yo,className:no,style:io}):(logger$8.error("Failed to render EmailSignInSection - no sign in provider enabled"),null)},AccountExistsView=()=>{const{existentAccountData:Xr}=useAccountExistsContext(),{t:eo}=useTranslation(),{email:to,embeddedSocialSigninProvider:ro}=Xr||{},no=getSocialSignInProviderForProviderEnum(ro),{socialProvider:io,setSocialProvider:oo,socialWalletConnector:ao}=useSocialRedirectContext(),so=useFindSocialIcon(),{mutate:co}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){return oo(no),yield ao==null?void 0:ao.endSession(),ao==null?void 0:ao.connect(ro)})),lo=()=>ro?eo("dyn_account_exists.description_social"):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[eo("dyn_account_exists.description_email")," ",jsxRuntimeExports.jsx("strong",{children:to})," ",eo("dyn_account_exists.trail_message_email")]});return jsxRuntimeExports.jsxs("div",{className:"account-exists__container",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"account-exists__image"}),jsxRuntimeExports.jsxs("div",{className:"account-exists__main",children:[jsxRuntimeExports.jsx("div",{className:"account-exists__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"account-exists__content--secondary",copykey:"dyn_account_exists",children:lo()})}),ro?jsxRuntimeExports.jsxs(IconListTile,{dataTestId:`inline-${ro}`,onClick:()=>co(),className:"social-sign-in--tile",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so(ro),isSpinning:io===no,iconSize:32}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_account_exists.connect",children:eo("dyn_account_exists.connect",{socialOauth:capitalize$1(ro==null?void 0:ro.toString())})})]},ro):jsxRuntimeExports.jsx(LoginEmailForm,{isLoading:!1,currentEmail:to})]})]})},BridgeNextWalletToConnectLayout=({chainName:Xr,chainIcon:eo,onClickAction:to,onClickClose:ro})=>{const no=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:no,alignContent:"bottom",children:eo&&jsxRuntimeExports.jsx("div",{className:"bridge-next-wallet-to-connect-layout__chain-icon",children:eo})}),jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout__body",children:[jsxRuntimeExports.jsxs(Typography,{color:"primary",variant:"title",children:["Nice! Now let’s connect your ",Xr," wallet"]}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",onClick:to,children:`Connect ${Xr} wallet`})]})]})},BridgeNextWalletConnectionView=()=>{const{setShowAuthFlow:Xr,bridgeChainsToConnect:eo}=useInternalDynamicContext(),{setView:to}=useViewContext();if(!(eo!=null&&eo.length))throw new DynamicError("No wallets to connect");const[ro]=eo,{chain:no}=ro,io=getChainInfoWithOverrides(no),oo=getChainIcon(no);if(!io)throw new DynamicError("No chain info found for chain",no);return jsxRuntimeExports.jsx(BridgeNextWalletToConnectLayout,{chainName:io.blockchainName,chainIcon:jsxRuntimeExports.jsx(oo,{}),onClickAction:()=>to("wallet-list"),onClickClose:()=>Xr(!1,{emitCancelAuth:!0})})},ConnectedWalletsListLayout=({title:Xr,body:eo,onClickBack:to,onClickClose:ro,onClickAction:no,actionButtonText:io="Continue",children:oo,copykey:ao})=>{const so=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),co=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})});return jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:co,trailing:so,children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:ao,children:Xr})}),jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",className:"connected-wallets-list-layout__body__text",children:eo}),oo,jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"primary",onClick:no,children:io})]})]})},BridgeSummaryView=()=>{const{primaryWallet:Xr,setShowAuthFlow:eo,appName:to,bridgeChains:ro=[]}=useInternalDynamicContext(),{t:no}=useTranslation(),io=()=>eo(!1,{emitCancelAuth:!0}),oo=reactExports.useMemo(()=>{const so=ro.map(({chain:fo})=>{var ho;return(ho=getChainInfoWithOverrides(fo))===null||ho===void 0?void 0:ho.blockchainName}),[co,lo]=so;return no("dyn_bridge.summary_view.connection_succeed",{firstBlockchainName:co,secondBlockchainName:lo})},[ro,no]),ao=so=>{const co=getChainIcon(so.chain),lo=getChainInfoWithOverrides(so.chain);return jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(co,{}),networkName:lo==null?void 0:lo.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:so.connector.key,walletAddress:so.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:so,network:so.chain})})})};return jsxRuntimeExports.jsxs(ConnectedWalletsListLayout,{onClickClose:io,onClickAction:io,copykey:"dyn_bridge.summary_view.title",title:no("dyn_bridge.summary_view.title",{appName:to}),body:oo,children:[Xr&&ao(Xr),jsxRuntimeExports.jsx(MemoSecondaryWallets,{hideUnlinkAction:!0})]})},BridgeWelcomeLayout=({body:Xr,chains:eo=[],onClickAction:to,onClickClose:ro,title:no,actionButtonText:io,copykey:oo})=>{const ao=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ao,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon-group",children:[...eo].reverse().map((so,co)=>jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon",style:{zIndex:co},children:so.icon},so.id))})}),jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__message-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:oo,children:no}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:Xr})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Stepper,{children:eo.map(so=>jsxRuntimeExports.jsx(Step,{children:so.name},so.id))})}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:to,children:io})]})]})},isChainInfoDefined=Xr=>Xr!==void 0,BridgeWelcomeView=()=>{const{appName:Xr,bridgeChains:eo=[],setShowAuthFlow:to}=useInternalDynamicContext(),{setView:ro}=useViewContext(),{t:no}=useTranslation(),io=reactExports.useMemo(()=>{const ao=eo.map(({chain:lo})=>{var fo;return(fo=getChainInfoWithOverrides(lo))===null||fo===void 0?void 0:fo.blockchainName}),[so,co]=ao;return no("dyn_bridge.welcome_view.description",{firstBlockchainName:so,secondBlockchainName:co})},[eo,no]),oo=reactExports.useMemo(()=>eo.map(({chain:ao},so)=>{const co=getChainInfoWithOverrides(ao),lo=getChainIcon(ao);if(co&&lo)return{icon:jsxRuntimeExports.jsx(lo,{}),id:so,name:co.blockchainName}}).filter(isChainInfoDefined),[eo]);return jsxRuntimeExports.jsx(BridgeWelcomeLayout,{onClickClose:()=>to(!1,{emitCancelAuth:!0}),title:no("dyn_bridge.welcome_view.title",{appName:Xr}),copykey:"dyn_bridge.welcome_view.title",body:io,chains:oo,actionButtonText:no("dyn_bridge.welcome_view.button"),onClickAction:()=>ro("wallet-list")})},Captcha=({handleSuccess:Xr})=>{var eo;const{projectSettings:to}=useInternalDynamicContext();return!((eo=to==null?void 0:to.security.hCaptcha)===null||eo===void 0)&&eo.siteKey?jsxRuntimeExports.jsx("form",{"data-testid":"captcha-form",children:jsxRuntimeExports.jsx(HCaptcha,{sitekey:to.security.hCaptcha.siteKey,onVerify:ro=>Xr(ro),theme:document.body.dataset.dynamicTheme})}):null},CaptchaVerifyUser=()=>{const{t:Xr}=useTranslation(),{captchaAuthState:eo,setCaptchaToken:to}=useCaptchaContext(),ro=no=>__awaiter$j(void 0,void 0,void 0,function*(){var io;to(no),yield(io=eo==null?void 0:eo.onCaptchaSuccess)===null||io===void 0?void 0:io.call(eo,no)});return jsxRuntimeExports.jsxs("div",{className:"captcha-verify-user__container",children:[jsxRuntimeExports.jsx(CaptchaWaveIcon,{className:"captcha-verify-user__icon"}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"captcha-verify-user__title",copykey:"dyn_captcha.verify_user_title",children:Xr("dyn_captcha.verify_user_title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"captcha-verify-user__subtitle",copykey:"dyn_captcha.verify_user_subtitle",children:Xr("dyn_captcha.verify_user_subtitle")}),jsxRuntimeExports.jsx(Captcha,{handleSuccess:ro}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"captcha-verify-user__dynamic-logo"})]})};var _path$u,_excluded$C=["title","titleId"];function _extends$E(){return _extends$E=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$C(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAltKey=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$C(eo,_excluded$C);return reactExports.createElement("svg",_extends$E({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$u||(_path$u=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 4a5 5 0 0 0-4.786 6.453 1 1 0 0 1-.25.997L4 17.414V20h2v-1a1 1 0 0 1 1-1h1v-1a1 1 0 0 1 1-1h1.586l1.964-1.964a1 1 0 0 1 .997-.25A5 5 0 1 0 15 4ZM8 20v1a1 1 0 0 1-1 1H4a2 2 0 0 1-2-2v-2.586A2 2 0 0 1 2.586 16l5.562-5.562a7 7 0 1 1 5.414 5.414l-1.855 1.855A1 1 0 0 1 11 18h-1v1a1 1 0 0 1-1 1H8Zm6-13a1 1 0 0 1 1-1 3 3 0 0 1 3 3 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 0 1-1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$t,_excluded$B=["title","titleId"];function _extends$D(){return _extends$D=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$B(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLock=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$B(eo,_excluded$B);return reactExports.createElement("svg",_extends$D({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$t||(_path$t=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$s,_path2$4,_path3$3,_path4$2,_g$9,_path5$2,_defs$9,_excluded$A=["title","titleId"];function _extends$C(){return _extends$C=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$A(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletClaimHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$A(eo,_excluded$A);return reactExports.createElement("svg",_extends$C({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("g",{clipPath:"url(#wallet-claim-hero_svg__a)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$s||(_path$s=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__b)"},_path2$4||(_path2$4=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#wallet-claim-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"wallet-claim-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$3||(_path3$3=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__d)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$2||(_path4$2=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$9||(_g$9=reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.825 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"})))),_path5$2||(_path5$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.89 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.815.527l-.135.05-16.681 6.256-.406.152c-1.922.718-3.61 1.348-4.91 2.493a9.333 9.333 0 0 0-2.552 3.683c-.616 1.62-.614 3.421-.611 5.473l.001.434V66.01c0 8.793 4.782 16.125 9.952 21.51 5.205 5.422 11.159 9.252 14.308 11.089l.127.075c.575.337 1.321.775 2.307.987a6.624 6.624 0 0 0 2.61 0c.986-.212 1.732-.65 2.307-.987l.127-.075c3.149-1.837 9.103-5.667 14.308-11.088 5.17-5.386 9.952-12.718 9.952-21.511V51.13l.001-.433c.003-2.052.005-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.988-1.775-4.91-2.493-.134-.05-.27-.1-.406-.152l-16.681-6.255-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-6.946 16.362a9.282 9.282 0 1 1 13.127 13.128 9.282 9.282 0 0 1-13.127-13.128Zm3.282 3.282a4.64 4.64 0 1 1 6.563 6.563 4.64 4.64 0 0 1-6.563-6.563Zm3.515 14.885a11.63 11.63 0 0 1-2.945-.377v15.598h4.641v-4.51h4.601v-4.642h-4.601V66.47a11.69 11.69 0 0 1-1.696.123Z",fill:"#4779FF"})))),_defs$9||(_defs$9=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"wallet-claim-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"wallet-claim-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const CoinbaseMPCClaimIntro=()=>{const{setShowAuthFlow:Xr}=useInternalDynamicContext(),{setView:eo}=useViewContext(),{t:to}=useTranslation(),ro=jsxRuntimeExports.jsx(IconButton,{onClick:()=>Xr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ro,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.intro.title",children:to("dyn_create_password.intro.title")})}),jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro",children:jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__description",children:jsxRuntimeExports.jsx(SvgWalletClaimHero,{})}),jsxRuntimeExports.jsx("div",{className:"confirm-password-description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_create_password.intro.description",children:to("dyn_create_password.intro.description.title")})}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgLock,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.additional_protection.title",children:to("dyn_create_password.intro.description.additional_protection.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.additional_protection.description",children:to("dyn_create_password.intro.description.additional_protection.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgAltKey,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.restore_access.title",children:to("dyn_create_password.intro.description.restore_access.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.restore_access.description",children:to("dyn_create_password.intro.description.restore_access.description")})]})]})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>{eo("create-password-view",{notCalledFromWalletUtils:!0})},copykey:"dyn_create_password.intro.continue",children:to("dyn_create_password.intro.continue")})]})})]})};var _path$r,_excluded$z=["title","titleId"];function _extends$B(){return _extends$B=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$z(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckConnection=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$z(eo,_excluded$z);return reactExports.createElement("svg",_extends$B({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$r||(_path$r=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const createSmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({isoCountryCode:eo,phoneNumber:to,phoneCountryCode:ro,environmentId:no,captchaToken:io}){try{return yield sdkApi$1().createSmsVerification({environmentId:no,smsVerificationCreateRequest:{captchaToken:io,isoCountryCode:eo,phoneCountryCode:ro,phoneNumber:to}})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),new SmsVerificationError(ao.error,ao.code)}}),signInWithSmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro,captchaToken:no,sessionPublicKey:io}){var oo;try{return yield sdkApi$1().signInWithSmsVerification({environmentId:ro,smsVerificationVerifyRequest:{captchaToken:no,sessionPublicKey:io,verificationToken:eo,verificationUUID:to}})}catch(ao){const so=yield ao.json();throw logger$8.error(so.error),((oo=so.error)===null||oo===void 0?void 0:oo.code)==="missing_from_list"?new NoAccessError({phoneNumber:so.payload.phoneNumber}):so.code==="wrong_sms_verification_token"?new SmsVerificationError(Locale.getInstance().t("dyn_login.helper.phone_number_form.invalid_sms_verification"),so.code):so.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(so.error.message):new SmsVerificationError(so.error,so.code)}}),retrySmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({isoCountryCode:eo,phoneCountryCode:to,phoneNumber:ro,environmentId:no,verificationUUID:io}){try{return yield sdkApi$1().retrySmsVerification({environmentId:no,smsVerificationRetryRequest:{isoCountryCode:eo,phoneCountryCode:to,phoneNumber:ro,verificationUUID:io}})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),new SmsVerificationError(ao.error,ao.code)}}),verifySms=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro}){try{return yield sdkApi$1().verifySmsVerification({environmentId:ro,smsVerificationVerifyRequest:{verificationToken:eo,verificationUUID:to}})}catch(no){const io=yield no.json();throw logger$8.error(io.error),io.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(io.error.message):new SmsVerificationError(io.error,io.code)}}),useOtpVerificationRequestRaw=()=>{const{environmentId:Xr,user:eo,userWithMissingInfo:to}=useInternalDynamicContext(),{verificationUUID:ro}=useVerification();return{verifyOtp:reactExports.useCallback((io,oo,ao,so)=>__awaiter$j(void 0,void 0,void 0,function*(){var co;if(!eo&&!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!so&&!ro)throw new DynamicError("No verification UUID is available");const ho=yield(ao==="email"?verifyEmail:verifySms)({environmentId:Xr,verificationToken:oo,verificationUUID:so??ro}),go=ho.user,yo=(co=go==null?void 0:go.missingFields)!==null&&co!==void 0?co:[],vo=getVerificationDestination(ho.nextView);return storeAuthTokenAndUser(ho),vo?io({destination:vo,missingFields:yo,updateUserProfileResponse:ho}):{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:yo,updateUserProfileResponse:ho}}),[ro,Xr,eo,to])}},useOtpVerificationRequest=()=>{const Xr=useHandleVerificationRequired(),{verifyOtp:eo}=useOtpVerificationRequestRaw();return reactExports.useMemo(()=>({verifyOtp:(to,ro,no)=>eo(Xr,to,ro,no)}),[Xr,eo])},getResponseInfo=(Xr,eo)=>{var to,ro,no,io,oo,ao,so;return eo==="email"?{displayDestination:(to=Xr.emailVerification)===null||to===void 0?void 0:to.email,verificationUUID:(ro=Xr.emailVerification)===null||ro===void 0?void 0:ro.verificationUUID}:{displayDestination:formatPhone("+"+((io=(no=Xr.smsVerification)===null||no===void 0?void 0:no.phoneCountryCode)!==null&&io!==void 0?io:"")+((ao=(oo=Xr.smsVerification)===null||oo===void 0?void 0:oo.phoneNumber)!==null&&ao!==void 0?ao:"")),verificationUUID:(so=Xr.smsVerification)===null||so===void 0?void 0:so.verificationUUID}},getVerificationDestination=Xr=>{if(Xr===NextViewEnum.VerifyEmail)return"email";if(Xr===NextViewEnum.VerifySms)return"sms"},useHandleVerificationRequired=()=>{const{setVerificationUUID:Xr,setDisplayedDestination:eo}=useVerification(),{environmentId:to}=useInternalDynamicContext(),{verifyOtp:ro}=useOtpVerificationRequestRaw(),no=reactExports.useCallback((oo,ao)=>__awaiter$j(void 0,void 0,void 0,function*(){if(oo==="email"&&ao.emailVerification||oo==="sms"&&ao.smsVerification)return ao;const so=oo==="email"?"email":"phoneNumber";if(!ao.user[so])throw new VerificationDataCollectionError(`missing ${so} field to perform update`);const co=yield userFieldsSchema.validate({[so]:ao.user[so]}),{emailVerification:lo,smsVerification:fo}=yield updateUserProfileFields(to,co);if(oo==="email"&&!lo||oo==="sms"&&!fo)throw new VerificationDataCollectionError(`could not get ${oo} verification data from api`);return Object.assign(Object.assign({},ao),{emailVerification:lo,smsVerification:fo})}),[to]),io=reactExports.useCallback(oo=>__awaiter$j(void 0,[oo],void 0,function*({updateUserProfileResponse:ao,missingFields:so,destination:co}){const lo=yield no(co,ao),{displayDestination:fo,verificationUUID:ho}=getResponseInfo(lo,co);eo(fo),Xr(ho);const go=yo=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(io,yo,co,ho)});return co==="email"?{isEmailVerificationRequired:!0,isSmsVerificationRequired:!1,missingFields:so,updateUserProfileResponse:lo,verifyOtp:go}:{isEmailVerificationRequired:!1,isSmsVerificationRequired:!0,missingFields:so,updateUserProfileResponse:lo,verifyOtp:go}}),[no,eo,Xr,ro]);return io},useUpdateUser=Xr=>{const{environmentId:eo,userWithMissingInfo:to,setCallback:ro}=useInternalDynamicContext(),{setRetryData:no}=useVerification(),{selectedPhoneCountry:io}=useFieldsState(),oo=useHandleVerificationRequired();return reactExports.useCallback((so,co)=>__awaiter$j(void 0,void 0,void 0,function*(){var lo,fo;let{metadata:ho}=so;ho=ho?Object.assign(Object.assign({},to==null?void 0:to.metadata),ho):to==null?void 0:to.metadata;const go=yield userFieldsSchema.validate(so,{stripUnknown:Xr});go.phoneNumber&&go.phoneNumber.length>0&&io.current&&no({dialCode:io.current.dialCode,iso2:io.current.iso2,phone:go.phoneNumber});const yo=yield updateUserProfileFields((lo=co==null?void 0:co.userEnvironmentId)!==null&&lo!==void 0?lo:eo,Object.assign(Object.assign({},go),{metadata:ho})),vo=(fo=yo.user.missingFields)!==null&&fo!==void 0?fo:[],wo=getVerificationDestination(yo.nextView);return wo?oo({destination:wo,missingFields:vo,updateUserProfileResponse:yo}):(ro("userProfileUpdate"),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:vo,updateUserProfileResponse:yo})}),[to==null?void 0:to.metadata,Xr,io,no,eo,oo,ro])},validateUpdateRequest=(Xr,eo,to)=>{if(!Xr.length)return"At least one field must be provided for editing";if(!eo)return"No signed-in user";const ro=getUserProfileFields({customFields:to==null?void 0:to.customFields,projectSettingsKyc:to==null?void 0:to.kyc,user:eo});for(const no of Xr)if(!ro.find(({name:io})=>io===no))return`Please ensure field "${no}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;return""},saveUserValues=(Xr,eo,to,ro,no)=>__awaiter$j(void 0,[Xr,eo,to,ro,no],void 0,function*({fields:io,updateUserResult:{isEmailVerificationRequired:oo,isSmsVerificationRequired:ao}},so,co,lo,fo){if(!oo&&!ao){lo(io);return}if(so(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),oo){co("verify-email"),dynamicEvents.once("emailVerificationResult",(ho,go)=>{io.email=go,ho?lo(io):fo("Failed to verify email, no fields were updated")});return}co("verify-sms"),dynamicEvents.once("smsVerificationResult",(ho,{phone:go})=>{io.phoneNumber=go,ho?lo(io):fo("Failed to verify phone number, no fields were updated")})}),useUpdateUserWithModal=Xr=>{const{user:eo,projectSettings:to,setShowAuthFlow:ro}=useInternalDynamicContext(),{setView:no}=useViewContext(),io=reactExports.useContext(UserFieldEditorContext);if(!io)throw new DynamicError("useUserUpdateRequest can only be used inside the context of DynamicContextProvider");const{open:oo}=io;return reactExports.useCallback((so,co)=>new Promise((lo,fo)=>{const ho=validateUpdateRequest(so,eo,to);if(ho){fo(ho);return}oo({fields:so,submitText:co==null?void 0:co.submitText,subtitle:co==null?void 0:co.subtitle,title:co==null?void 0:co.title},Xr).then(go=>saveUserValues(go,ro,no,lo,fo)).catch(go=>{if(/email already exists/gi.test(go))throw go;fo(go)})}),[eo,to,oo,Xr,ro,no])},useUserUpdateRequestInternal=({validationSchemaStripUnknown:Xr})=>{const eo=useUpdateUser(Xr),to=useUpdateUserWithModal(eo);return{updateUser:eo,updateUserWithModal:to}},OnboardingUserDataForm=({children:Xr,userProfile:eo,disableSubmit:to})=>{const{policiesConsentInnerComponent:ro,userWithMissingInfo:no}=useInternalDynamicContext(),{error:io}=useErrorContext(),{completeAuth:oo}=useUserAuth({}),{updateUser:ao}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),so=reactExports.useCallback(vo=>__awaiter$j(void 0,void 0,void 0,function*(){yield oo({updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return ao(vo)})})}),[oo,ao]),{fetch:co,formikInitialValues:lo,formikValidationSchema:fo,enforcePolicies:ho,onFormSubmit:go}=useUserDataForm({fields:(no==null?void 0:no.missingFields)||[],onSubmit:so,userProfile:eo}),yo=[ro].flat();return jsxRuntimeExports.jsx(Formik,{onSubmit:go,initialValues:lo,validationSchema:fo,children:({errors:vo,touched:wo,values:Eo})=>{var ko;const Ao=to||ho&&(yo==null?void 0:yo.length)!==((ko=Eo.policiesConsentArray)===null||ko===void 0?void 0:ko.length);return jsxRuntimeExports.jsx(Form,{className:"user-data-form__form",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Xr,io&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"user-data-form__error",children:io}),jsxRuntimeExports.jsx(UserDataFields,{fields:no==null?void 0:no.missingFields,errors:vo,touched:wo,policiesConsentInnerComponentArray:yo}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",loading:co,disabled:Ao,buttonVariant:"primary",expanded:!0,buttonPadding:"login-screen-height",children:"Continue"})]})})}})},CollectUserDataView=()=>{var Xr;const{appName:eo,projectSettings:to,network:ro,selectedWalletConnector:no,handleLogOut:io,onboardingImageUrl:oo,userWithMissingInfo:ao}=useInternalDynamicContext(),[so,co]=reactExports.useState(!1),lo=useFetchNameService(),{t:fo}=useTranslation();if(!ao)return null;const ho=(no==null?void 0:no.evmNetworks)||[],yo=!(!ro||isSupportedNetwork({network:ro,walletConnector:no}))&&!!no,vo=(Xr=ao==null?void 0:ao.verifiedCredentials.find(wo=>wo.id===ao.lastVerifiedCredentialId))===null||Xr===void 0?void 0:Xr.address;return jsxRuntimeExports.jsxs("div",{className:"collect-user-data","data-testid":"collect-user-data-view",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__network-container",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__img-container",children:[lo!=null&&lo.avatar?jsxRuntimeExports.jsx("img",{src:lo.avatar,alt:"",className:"collect-user-data__img collect-user-data__img--rounded"}):jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:28}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data__wallet-address",children:(lo==null?void 0:lo.name)||shortenWalletAddress(vo,3,3)})]}),no&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:ro,evmNetworks:ho,connector:no,showNetworkName:!0,isNetworkPickerOpen:so,setIsNetworkPickerOpen:co,buttonClassName:"collect-user-data__network-picker-button",mainClassName:"collect-user-data__network-picker"})]}),oo&&jsxRuntimeExports.jsx("img",{className:"collect-user-data__main-img",src:oo,alt:"onboarding"}),yo&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"collect-user-data__error--not-supported",copykey:"dyn_collect_user_data.not_supported_network.error_message",children:fo("dyn_collect_user_data.not_supported_network.error_message")}),jsxRuntimeExports.jsxs("div",{className:classNames("collect-user-data__form",{"collect-user-data__form--error":yo}),children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{disableSubmit:yo,userProfile:ao,children:yo?jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.not_supported_network.title",children:fo("dyn_collect_user_data.not_supported_network.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.not_supported_network.description",children:fo("dyn_collect_user_data.not_supported_network.description")})]}):jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(to==null?void 0:to.general.collectUserDataWelcomeHeader)||fo("dyn_collect_user_data.greeting",{appName:eo})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(to==null?void 0:to.general.collectUserDataWelcomeMessage)||fo("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data__log-out",onClick:io,copykey:"dyn_collect_user_data.log_out_button",children:fo("dyn_collect_user_data.log_out_button")})]})]})},CollectUserDataViewNoWallet=({userIdentification:Xr,userIdentificationOverride:eo})=>{var to;const{appName:ro,handleLogOut:no,projectSettings:io,onboardingImageUrl:oo,userWithMissingInfo:ao}=useInternalDynamicContext(),{t:so}=useTranslation();return ao?jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet","data-testid":"collect-user-data-login-no-wallet",children:[oo&&jsxRuntimeExports.jsx("img",{className:"collect-user-data-login-no-wallet__main-img",src:oo,alt:"onboarding"}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__user-info-container",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:ao})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data-login-no-wallet__user-identification",children:(to=eo??ao[Xr])!==null&&to!==void 0?to:getUserIdentifier(ao)})]}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__form",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{userProfile:ao,children:jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data-login-no-wallet__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(io==null?void 0:io.general.collectUserDataWelcomeHeader)||so("dyn_collect_user_data.greeting",{appName:ro})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(io==null?void 0:io.general.collectUserDataWelcomeMessage)||so("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data-login-no-wallet__log-out",onClick:no,copykey:"dyn_collect_user_data.log_out_button",children:so("dyn_collect_user_data.log_out_button")})]})]}):null};var _path$q,_excluded$y=["title","titleId"];function _extends$A(){return _extends$A=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$y(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasswordHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$y(eo,_excluded$y);return reactExports.createElement("svg",_extends$A({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$q||(_path$q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-7.618-38.89v-4.037a8.074 8.074 0 0 1 16.147 0v4.036a13.436 13.436 0 0 1 5.383 10.766c0 7.431-6.025 13.456-13.456 13.456-7.432 0-13.456-6.025-13.456-13.456 0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.074 5.074 0 0 0-10.147 0v2.336a13.416 13.416 0 0 1 5.074-.99c1.795 0 3.507.352 5.073.99ZM34.5 36.663a3.5 3.5 0 1 0-3 0V39.5a1.5 1.5 0 0 0 3 0v-2.837Z",fill:"#4779FF"})))};const validatePassword=Xr=>{const eo=Xr.length>=6,to=/[A-Z]/.test(Xr),ro=/[a-z]/.test(Xr),no=/\d/.test(Xr),io=/\W/.test(Xr);let oo=[ro,to,no,io,eo].filter(Boolean).length;return oo>=3&&Xr.length>=12&&(oo=5),{hasLowerCase:ro,hasNonalphas:io,hasNumbers:no,hasProperLength:eo,hasUpperCase:to,securityCriteria:[{description:"Password is atleast 6 characters in length",key:"hasProperLength",value:eo},{description:"Contains at least one uppercase letter",key:"hasUpperCase",value:to},{description:"Contains at least one lowercase letter",key:"hasLowerCase",value:ro},{description:"Contains at least one number",key:"hasNumbers",value:no},{description:"Contains at least one non-alphanumeric character",key:"hasNonalphas",value:io}],strength:oo}};var _path$p,_excluded$x=["title","titleId"];function _extends$z(){return _extends$z=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$x(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgEyeOffIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$x(eo,_excluded$x);return reactExports.createElement("svg",_extends$z({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$p||(_path$p=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.793 2.293a1 1 0 0 1 1.414 0l3.04 3.04A10.955 10.955 0 0 1 12.5 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6 11.014 11.014 0 0 1-3.552 5.231l2.762 2.762a1 1 0 0 1-1.414 1.414l-18-18a1 1 0 0 1 0-1.414Zm5.943 4.53 1.732 1.731a4 4 0 0 1 5.478 5.478l2.076 2.076A9.022 9.022 0 0 0 20.989 12 9.004 9.004 0 0 0 8.736 6.822Zm5.696 5.695a2 2 0 0 0-2.45-2.45l2.45 2.45ZM5.125 8.174a1 1 0 0 1 .194 1.4A8.975 8.975 0 0 0 4.012 12a9.004 9.004 0 0 0 10.177 5.842 1 1 0 0 1 .372 1.965c-.668.127-1.357.193-2.06.193-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6 10.97 10.97 0 0 1 1.72-3.332 1 1 0 0 1 1.4-.194Z",fill:"#ABACB2"})))};const ToggleVisibilityButton=({initialState:Xr=!1,onClick:eo,className:to=""})=>{const[ro,no]=reactExports.useState(Xr),io=oo=>{oo.preventDefault(),no(ao=>{const so=!ao;return eo==null||eo(so),so})};return jsxRuntimeExports.jsx(TextButton,{className:classNames("toggle-visibility-button__container",to),onClick:oo=>io(oo),children:jsxRuntimeExports.jsx(Tooltip,{className:"toggle-visibility-button__tooltip",content:ro?"Show":"Hide",children:jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:ro?jsxRuntimeExports.jsx(SvgFooterEyeIcon,{}):jsxRuntimeExports.jsx(SvgEyeOffIcon,{})})})})},CreatePasswordStep=({password:Xr,setPassword:eo,currentPassword:to,setCurrentPassword:ro,onContinue:no,isChangingPassword:io,onClose:oo,onLogout:ao})=>{const{primaryWallet:so}=useInternalDynamicContext(),[co,lo]=reactExports.useState("password"),[fo,ho]=reactExports.useState("password"),go=validatePassword(Xr).strength,[yo,vo]=reactExports.useState(go),[wo,Eo]=reactExports.useState(""),[ko,Ao]=reactExports.useState("password"),[Po,jo]=reactExports.useState(!1),[Mo,No]=reactExports.useState(""),{t:Do}=useTranslation(),Fo=!!((Xr==null?void 0:Xr.length)>=6&&yo>=5&&wo===Xr&&(!io||to&&to!==Xr)),Xo=oo&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>oo(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Lo=(po,bo,_o=!0)=>jsxRuntimeExports.jsxs("div",{className:"create-password__password-input__suffix",children:[_o&&jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(CopyButton,{textToCopy:Xr,copykey:"dyn_qr_code.copy_button",className:"create-password__password-input__suffix__icon",children:jsxRuntimeExports.jsx(SvgCopy,{className:"create-password__password-input__suffix__icon",onClick:$o=>{$o.preventDefault()}})})}),jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:po==="password",onClick:$o=>bo($o?"password":"text"),className:"create-password__password-input__suffix__icon"})]}),Bo=po=>__awaiter$j(void 0,void 0,void 0,function*(){po.preventDefault();const bo=so==null?void 0:so.connector;if(io&&isCoinbaseMpcWalletConnector(bo)){jo(!0);try{if(!(yield bo.validatePasscode(to))){No(Do("dyn_create_password.errors.invalid_current_password"));return}}catch{No(Do("dyn_create_password.errors.error_changing_password"));return}finally{jo(!1)}}Fo&&no()}),xo=po=>{const bo=po.target.value,{strength:_o}=validatePassword(bo);if(vo(_o),eo(bo),io){No(to===bo?Do("dyn_create_password.errors.new_password_same_as_old"):bo&&wo&&bo!==wo?Do("dyn_create_password.errors.password_mismatch"):"");return}bo!=null&&bo.length||No("")},uo=po=>{const bo=po.target.value;No(bo!==Xr?Do("dyn_create_password.errors.password_mismatch"):""),Eo(bo)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Xo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.title",children:Do(io?"dyn_create_password.title.update":"dyn_create_password.title.create")})}),jsxRuntimeExports.jsx("div",{className:"create-password",children:jsxRuntimeExports.jsxs("form",{className:"create-password__body","data-testid":"create-password-form",onSubmit:Bo,children:[jsxRuntimeExports.jsxs("div",{className:"create-password__body__header",children:[jsxRuntimeExports.jsx(SvgPasswordHero,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:Do("dyn_create_password.description")})]}),Mo&&jsxRuntimeExports.jsx(ErrorContainer,{children:Mo}),io&&jsxRuntimeExports.jsx(Input,{id:"current-password",placeholder:Do("dyn_create_password.current_password_input.placeholder"),type:co,suffix:Lo(co,lo,!1),label:Do("dyn_create_password.current_password_input.label"),value:to,onChange:po=>ro(po.target.value),autoFocus:!0,copykey:"dyn_create_password.current_password_input"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:Do(io?"dyn_create_password.update_input.placeholder":"dyn_create_password.create_input.placeholder"),type:fo,suffix:Lo(fo,ho),label:Do(io?"dyn_create_password.update_input.label":"dyn_create_password.create_input.label"),value:Xr,onChange:xo,autoFocus:!io,copykey:"dyn_create_password.create_input"})}),Xr.length>=1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"create-password__body__card",children:validatePassword(Xr).securityCriteria.map(po=>jsxRuntimeExports.jsxs("div",{className:`create-password__password-criteria-list ${po.value?"create-password__password-criteria-list__success":"create-password__password-criteria-list__error"}`,children:[jsxRuntimeExports.jsx("div",{children:po.value?jsxRuntimeExports.jsx(SvgCheck,{className:"create-password__password-criteria-icon"}):jsxRuntimeExports.jsx(SvgClose,{className:"create-password__password-criteria-icon"})}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",children:po.description})]},po.key))}),jsxRuntimeExports.jsx(Input,{id:"confirm-password",placeholder:Do("dyn_create_password.confirm_input.placeholder"),type:ko,suffix:Lo(ko,Ao,!1),label:Do("dyn_create_password.confirm_input.label"),value:wo,onChange:uo,copykey:"dyn_create_password.confirm_input"})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!Fo,copykey:"dyn_create_password.continue",type:"submit",loading:Po,children:Do("dyn_create_password.continue")}),ao&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:ao,copykey:"dyn_create_password.logout",children:Do("dyn_create_password.logout")})]})})]})};var _path$o,_excluded$w=["title","titleId"];function _extends$y(){return _extends$y=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$w(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDownload=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$w(eo,_excluded$w);return reactExports.createElement("svg",_extends$y({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$o||(_path$o=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.417 14.167c0 .92.746 1.666 1.666 1.666h8.334c.92 0 1.666-.746 1.666-1.666v-.834a.833.833 0 0 1 1.667 0v.834a3.333 3.333 0 0 1-3.333 3.333H6.083a3.333 3.333 0 0 1-3.333-3.333v-.834a.833.833 0 0 1 1.667 0v.834Zm1.91-4.756a.833.833 0 0 1 1.179 0l1.91 1.91V3.333a.833.833 0 0 1 1.667 0v7.989l1.911-1.911a.833.833 0 1 1 1.179 1.178l-3.334 3.334a.833.833 0 0 1-1.178 0l-3.334-3.334a.833.833 0 0 1 0-1.178Z",fill:"#ABACB2"})))},_path$n,_path2$3,_path3$2,_path4$1,_g$8,_path5$1,_defs$8,_excluded$v=["title","titleId"];function _extends$x(){return _extends$x=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$v(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSavePasswordHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$v(eo,_excluded$v);return reactExports.createElement("svg",_extends$x({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("g",{clipPath:"url(#save-password-hero_svg__a)"},reactExports.createElement("mask",{id:"save-password-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$n||(_path$n=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__b)"},_path2$3||(_path2$3=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#save-password-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"save-password-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$2||(_path3$2=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__d)"},reactExports.createElement("mask",{id:"save-password-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$1||(_path4$1=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$8||(_g$8=reactExports.createElement("g",{mask:"url(#save-password-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.467 10.138-10.37 17.962a14.612 14.612 0 0 0 6.096 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.374-8.688a5.5 5.5 0 1 1 10.624-2.848 5.5 5.5 0 0 1-10.624 2.848Z",fill:"#DD8500"})))),_path5$1||(_path5$1=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.944 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.816.527l-.134.05-16.681 6.255-.406.152c-1.922.718-3.61 1.347-4.91 2.493a9.331 9.331 0 0 0-2.552 3.682c-.616 1.619-.614 3.42-.611 5.472l.001.434v14.875c0 8.792 4.782 16.123 9.952 21.508 5.204 5.42 11.159 9.25 14.308 11.086l.127.075c.575.337 1.32.775 2.307.987a6.623 6.623 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.149-1.836 9.103-5.665 14.308-11.086 5.169-5.385 9.952-12.716 9.952-21.508V50.695c.003-2.052.006-3.853-.61-5.472a9.331 9.331 0 0 0-2.552-3.682c-1.3-1.145-2.988-1.775-4.91-2.493l-.407-.152-16.68-6.254-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-.36 18.497c1.726 0 3.126 1.4 3.126 3.126v12.504a3.126 3.126 0 0 1-6.253 0V53.687c0-1.726 1.4-3.126 3.127-3.126Zm-3.127 28.135c0-1.727 1.4-3.126 3.127-3.126h.031a3.127 3.127 0 1 1 0 6.252h-.031a3.127 3.127 0 0 1-3.127-3.126Z",fill:"#DD8500"})))),_defs$8||(_defs$8=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"save-password-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#DD8500"}),reactExports.createElement("stop",{offset:.985,stopColor:"#DD8500",stopOpacity:0})),reactExports.createElement("clipPath",{id:"save-password-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const downloadFile=(Xr,eo)=>{const to=document.createElement("a"),ro=new Blob([eo],{type:"text/plain"});to.href=URL.createObjectURL(ro),to.download=Xr,document.body.appendChild(to),to.click()},SavePasswordStep=({password:Xr,error:eo,isLoading:to,onSave:ro,onBack:no,onClose:io,onLogout:oo})=>{const{t:ao}=useTranslation(),[so,co]=reactExports.useState("password"),[lo,fo]=reactExports.useState(!1),[ho,go]=reactExports.useState(!1),yo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>no(),"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),vo=io&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>io(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),wo=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:so==="password",onClick:ko=>co(ko?"password":"text"),className:"save-password-suffix-icon"}),Eo=ko=>__awaiter$j(void 0,void 0,void 0,function*(){ko.preventDefault(),ro()});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:yo,trailing:vo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_save_password.title",children:ao("dyn_save_password.title")})}),jsxRuntimeExports.jsx("div",{className:"save-password-view",children:jsxRuntimeExports.jsxs("form",{className:"save-password-view__body","data-testid":"save-password-form",onSubmit:Eo,children:[jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgSavePasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(Badge,{text:ao("dyn_save_password.badge_text"),className:"save-password-view__body__badge",copykey:"dyn_save_password.badge_text"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__body__description",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_save_password.description",children:ao("dyn_save_password.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",copykey:"dyn_save_password.description",children:ao("dyn_save_password.warning")})]}),eo&&jsxRuntimeExports.jsx(ErrorContainer,{children:eo}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:ao("dyn_save_password.password_input.placeholder"),type:so,suffix:wo,disabled:!0,label:ao("dyn_save_password.password_input.label"),value:Xr,autoFocus:!0,copykey:"dyn_save_password.password_input"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-copy",buttonPadding:"small",buttonVariant:"primary",onClick:ko=>{ko.preventDefault(),copyToClipboard(Xr),go(!0)},startSlot:jsxRuntimeExports.jsx(SvgCopy,{}),expanded:!0,copykey:"dyn_save_password.copy_button",children:ao(ho?"dyn_save_password.copy_button.copied":"dyn_save_password.copy_button.copy")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-download",buttonPadding:"small",buttonVariant:"primary",onClick:ko=>{ko.preventDefault(),downloadFile("wallet-recovery.txt",Xr)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_save_password.download_button",children:ao("dyn_save_password.download_button")})]}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__confirm-card",children:jsxRuntimeExports.jsxs("button",{className:"save-password-view__body__card__acknowledgement",onClick:ko=>{ko.stopPropagation(),fo(!lo)},type:"button",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:lo,onChange:ko=>{ko.stopPropagation(),fo(!lo)},className:"save-password-view__body__card__statement__checkbox"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",style:{letterSpacing:"-0.15px"},color:"primary",copykey:"dyn_save_password.checkbox_label",children:ao("dyn_save_password.checkbox_label")})})]})}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-submit",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!lo,loading:to,type:"submit",copykey:"dyn_save_password.continue",children:ao("dyn_save_password.continue")}),oo&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:oo,copykey:"dyn_save_password.logout",children:ao("dyn_save_password.logout")})]})})]})},CreatePasswordView=({onSuccess:Xr,onError:eo,closeView:to,notCalledFromWalletUtils:ro,isSignUp:no})=>{var io;const{setShowAuthFlow:oo,user:ao,projectSettings:so,primaryWallet:co,handleLogOut:lo,walletConnectorOptions:fo}=useInternalDynamicContext(),{t:ho}=useTranslation(),{claimWallet:go}=useEmbeddedWalletPassword(),[yo,vo]=reactExports.useState("create-password"),wo=(io=ao==null?void 0:ao.verifiedCredentials.find(_o=>_o.walletName==="coinbasempc"))===null||io===void 0?void 0:io.walletProperties,Eo=!!(wo!=null&&wo.claimed),ko=to??!0,[Ao,Po]=reactExports.useState(""),[jo,Mo]=reactExports.useState(""),[No,Do]=reactExports.useState(!1),[Fo,Xo]=reactExports.useState(""),Lo=requiresPasswordForEmbeddedWallet(so),Bo=Eo||!Lo,xo=()=>__awaiter$j(void 0,void 0,void 0,function*(){vo("save-password")}),uo=()=>__awaiter$j(void 0,void 0,void 0,function*(){var _o,$o,Co;Do(!0);try{if(!no){const Ro=(Co=(_o=co==null?void 0:co.connector)!==null&&_o!==void 0?_o:($o=findCoinbaseMPCWallet(fo))===null||$o===void 0?void 0:$o.walletConnector)!==null&&Co!==void 0?Co:void 0;ro&&isCoinbaseMpcWalletConnector(Ro)&&(yield Ro.changePasscode(jo,Ao)),Eo||(yield go())}Xr==null||Xr(jo),ko&&oo(!1,{ignoreIfIsEmbeddedWidget:!1}),dynamicEvents.emit("embeddedWalletCreatePasswordCompleted",jo)}catch(Ro){logger$8.debug(`Error ${Eo?"updating":"creating"} password`,Ro),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",Ro),Ro instanceof Error&&Xo(Ro.message),eo==null||eo(Ro)}finally{Do(!1)}}),po=()=>{if(Lo){const _o=new Error(ho("dyn_create_password.errors.user_closed_view"));eo==null||eo(_o,!0),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",_o)}oo(!1)},bo=_o=>{_o==null||_o.preventDefault();const $o=new Error(ho("dyn_create_password.errors.user_closed_view"));eo==null||eo($o,!0),lo()};return yo==="save-password"?jsxRuntimeExports.jsx(SavePasswordStep,{password:jo,onBack:()=>vo("create-password"),error:Fo,isLoading:No,onSave:()=>uo(),onClose:Bo?()=>po():void 0,onLogout:Bo?void 0:bo}):jsxRuntimeExports.jsx(CreatePasswordStep,{password:jo,setPassword:Mo,currentPassword:Ao,setCurrentPassword:Po,onContinue:()=>xo(),isChangingPassword:Eo,onClose:Bo?()=>po():void 0,onLogout:Bo?void 0:bo})};var _path$m,_excluded$u=["title","titleId"];function _extends$w(){return _extends$w=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$u(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPencilAltIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$u(eo,_excluded$u);return reactExports.createElement("svg",_extends$w({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$m||(_path$m=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.638 2.862a.667.667 0 0 0-.943 0L7.167 8.391v.943h.942l5.53-5.53a.667.667 0 0 0 0-.942Zm-1.886-.943a2 2 0 1 1 2.829 2.829l-5.724 5.724a.667.667 0 0 1-.471.195H6.5A.667.667 0 0 1 5.833 10V8.115c0-.177.07-.347.196-.472l5.723-5.724ZM4.5 4a.667.667 0 0 0-.667.667V12c0 .368.299.667.667.667h7.333A.667.667 0 0 0 12.5 12V8.667a.667.667 0 0 1 1.333 0V12a2 2 0 0 1-2 2H4.5a2 2 0 0 1-2-2V4.667a2 2 0 0 1 2-2h3.333a.667.667 0 0 1 0 1.333H4.5Z",fill:"currentColor"})))};const EmailConfirmationWaitingView=()=>{const{setView:Xr}=useViewContext(),{clearStatesOnBackClick:eo,selectedWalletConnector:to}=useInternalDynamicContext(),{t:ro}=useTranslation();if(to&&!isEmailWalletConnector(to))throw new Error("Wallet connector is not email provider");const no=to,io=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){yield no==null?void 0:no.endSession(),Xr("login-with-email-or-wallet"),eo()}),[Xr,no,eo]);return jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view",children:[jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__header-icon",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:SignInWithEmailIcon,iconSize:80,isSpinning:!0})}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"email-confirmation-waiting-view__title",copykey:"dyn_email_confirmation.title",children:ro("dyn_email_confirmation.title")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_normal",color:"secondary",copykey:"dyn_email_confirmation.description",children:ro("dyn_email_confirmation.description")}),jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view__email-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"medium",as:"span",children:no==null?void 0:no.email}),jsxRuntimeExports.jsx(IconButton,{onClick:io,className:"email-confirmation-waiting-view__edit-icon-button","data-testid":"email-confirmation-waiting-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]}),jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__note",children:jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",copykey:"dyn_email_confirmation.note",children:ro("dyn_email_confirmation.note")})}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"email-confirmation-waiting-view__powered_by_dynamic_footer"})]})};var _circle$4,_path$l,_path2$2,_excluded$t=["title","titleId"];function _extends$v(){return _extends$v=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$t(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignInWithEmail=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$t(eo,_excluded$t);return reactExports.createElement("svg",_extends$v({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$4||(_circle$4=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$l||(_path$l=reactExports.createElement("path",{d:"M51 29.333a1.333 1.333 0 0 0-1.333 0l-17.334 9.8L15 29.333a1.333 1.333 0 0 0-2 1.16V42a4 4 0 0 0 4 4h30.667a4 4 0 0 0 4-4V30.5A1.333 1.333 0 0 0 51 29.333Z",fill:"#fff"})),_path2$2||(_path2$2=reactExports.createElement("path",{d:"M47.667 18H17a4 4 0 0 0-4 4v2.5a1.334 1.334 0 0 0 .667 1.16l18 10.167a1.333 1.333 0 0 0 1.333 0L51 25.66a1.334 1.334 0 0 0 .667-1.16V22a4 4 0 0 0-4-4Z",fill:"#fff"})))};const MIN_EVENT_TIME=10,useOnUnmount=Xr=>{const eo=reactExports.useRef(Xr);eo.current=Xr,reactExports.useEffect(()=>{const to=new Date;return()=>{new Date().getTime()-to.getTime()!Xr||eo.length>2?eo.split(""):eo===""?[]:Xr[0]===eo[0]?[eo[1]]:[eo[0]],PinInput=({autoFocus:Xr,disabled:eo,inputIndex:to,inputMode:ro,isValidated:no,name:io,onChange:oo,pattern:ao,type:so,value:co,values:lo,hasError:fo})=>{const ho=reactExports.useRef(null),go=vo=>{const wo=lo[to],Eo=vo.target.value.replace(/\s+/g,""),ko=[...lo],Ao=normalizeNewValue(wo,Eo).slice(0,ko.length-to),Po=(Do,Fo)=>ko[to+Fo]=Do,jo=so==="number"?/(^$)|(\d+)/:/.*/,Mo=Ao.every(Do=>jo.test(Do));let No=ho.current;if(Mo){Ao.length?Ao.forEach(Po):ko[to]="",oo(ko);for(let Do=0;Do{var wo;if(vo==="Backspace"&&lo[to]===""&&to>0){const Eo=(wo=ho.current)===null||wo===void 0?void 0:wo.previousElementSibling;Eo instanceof HTMLInputElement&&Eo.focus()}};return reactExports.useEffect(()=>{var vo;Xr&&to===0&&((vo=ho==null?void 0:ho.current)===null||vo===void 0||vo.focus())},[Xr,to]),jsxRuntimeExports.jsx("input",{ref:ho,className:classNames("pin-input__input",{"pin-input__input--error":!!fo,"pin-input__input--success":!!no}),disabled:eo,name:io,value:co,onChange:go,onKeyDown:yo,"data-testid":to,pattern:ao,inputMode:ro})},isComplete=Xr=>Xr.every(eo=>eo),PinField=({handleComplete:Xr,initialValue:eo,inputMode:to,isLoading:ro,isValidated:no,pattern:io,type:oo="number",hasError:ao,onChange:so,disabled:co})=>{const[lo,fo]=reactExports.useState(eo),ho=go=>{const yo=go.join("");fo(go),so==null||so(yo),isComplete(go)&&Xr(yo)};return jsxRuntimeExports.jsx("div",{className:"pin-field__container",children:lo.map((go,yo)=>jsxRuntimeExports.jsx(PinInput,{values:lo,inputIndex:yo,value:go,onChange:ho,disabled:ro||co,inputMode:to,isValidated:no,pattern:io,type:oo,autoFocus:!0,hasError:ao},`pin_input_${yo}`))})};var _path$k,_excluded$s=["title","titleId"];function _extends$u(){return _extends$u=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$s(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$s(eo,_excluded$s);return reactExports.createElement("svg",_extends$u({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$k||(_path$k=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2.666a5.333 5.333 0 1 0 0 10.667A5.333 5.333 0 0 0 8 2.666ZM1.333 8a6.667 6.667 0 1 1 13.333 0A6.667 6.667 0 0 1 1.333 8Zm9.138-1.805c.26.26.26.682 0 .943L7.804 9.804a.667.667 0 0 1-.942 0L5.528 8.471a.667.667 0 1 1 .943-.943l.862.862 2.195-2.195c.26-.26.683-.26.943 0Z",fill:"currentColor"})))};const useCountdown=({callback:Xr,seconds:eo})=>{const[to,ro]=reactExports.useState(eo),no=reactExports.useRef(),io=()=>{if(no.current)return ro(eo);ao()},oo=()=>{clearTimeout(no.current),no.current=void 0},ao=()=>{no.current=setTimeout(()=>{ro(so=>so-1)},1e3)};return reactExports.useEffect(()=>{if(no.current){if(to<=0){Xr&&Xr();return}return ao(),()=>clearTimeout(no.current)}},[to,Xr]),{remainingSeconds:to,startCountdown:io,stopCountdown:oo}},RetrySendVerificationCodeSection=({retryHandler:Xr,secondsToRetry:eo=15,disabled:to=!1,className:ro})=>{const{t:no}=useTranslation(),[io,oo]=reactExports.useState(!1),{remainingSeconds:ao,startCountdown:so}=useCountdown({callback:()=>oo(!1),seconds:eo}),{isLoading:co,mutate:lo}=useMutation(Xr,{onSuccess:()=>{oo(!0),so()}}),fo=classNames("retry-send-verification-code-section",ro);return io?jsxRuntimeExports.jsxs("div",{className:fo,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_otp_verification.resend_code_in",children:no("dyn_otp_verification.resend_code_in",{remainingSeconds:ao})}),jsxRuntimeExports.jsxs("span",{className:"retry-send-verification-code-section__confirmation",children:[jsxRuntimeExports.jsx(Icon,{color:"success-1",children:jsxRuntimeExports.jsx(SvgCheckCircle,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"primary",copykey:"dyn_otp_verification.code_sent",children:no("dyn_otp_verification.code_sent")})]})]}):jsxRuntimeExports.jsxs("div",{className:fo,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",copykey:"dyn_otp_verification.code_not_received",children:no("dyn_otp_verification.code_not_received")}),jsxRuntimeExports.jsx(TextButton,{className:"email-verification__text-button",disabled:co||to,onClick:()=>lo(),copykey:"dyn_otp_verification.resend_code",children:no("dyn_otp_verification.resend_code")})]})},SECONDS_TO_RETRY=15,EmailVerification=({isEmailRecoveryFlow:Xr=!1,showRetryButton:eo=!0,showTransferMessage:to=!1})=>{var ro,no,io,oo;const{environmentId:ao,handleLogOut:so,setPrimaryWalletId:co,setShowAuthFlow:lo,projectSettings:fo,user:ho,userWithMissingInfo:go,walletConnectorOptions:yo,primaryWallet:vo}=useInternalDynamicContext(),{setView:wo,goToInitialView:Eo}=useViewContext(),{error:ko,setError:Ao,setErrorMessage:Po}=useErrorContext(),{loading:jo,setLoading:Mo}=useLoadingContext(),[No,Do]=reactExports.useState(eo),[Fo,Xo]=reactExports.useState(to),{getEOAWallet:Lo}=useSmartWallets(),[Bo,xo]=reactExports.useState(!1),uo=reactExports.useRef(Bo),po=Al=>{xo(Al),uo.current=Al},{displayedDestination:bo,verificationUUID:_o,setVerificationUUID:$o}=useVerification(),{t:Co}=useTranslation(),{addRecoveryEmail:Ro}=usePasskeyRecovery(),{isTurnkeyWallet:So,hasTurnkeyVerifiedCredentialAuthenticator:mo,hasRecoveryEmail:To}=useIsTurnkeyWallet(),Vo=isTurnkeyEnabled(fo),{initAuth:Zo,completeAuth:Qo,cancelAuth:qo}=useUserAuth({authMethod:"email"}),{generateSessionKey:Ho,shouldRegisterSessionKeysOnSignin:$a}=useEmbeddedWalletSessionKeys(ao),zo=reactExports.useRef(!0);useOnUnmount(()=>{if(!zo.current)return;const Al=bo??"";dynamicEvents.emit("emailVerificationResult",uo.current,Al),uo.current||dynamicEvents.emit("authFailure",{email:Al,option:Al,type:"email"},"user-cancelled"),bo||logger$8.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined")});const{verifyOtp:Ko}=useOtpVerificationRequest(),_c=reactExports.useCallback(Al=>__awaiter$j(void 0,void 0,void 0,function*(){var Ol,Wl,zl,Tl,Ml,ou;if(Al.nextView==="verified-and-transferred"&&(Xo==null||Xo(!0)),Xr)return wo("passkey-recovery-add-email",{canSkipAddingEmail:!1,isFromEmailVerification:!0}),!0;if(!So)return!1;if(mo&&!To&&(!((Ol=Al==null?void 0:Al.user)===null||Ol===void 0)&&Ol.email))return storeAuthTokenAndUser(Al),yield Ro(Al.user.email),lo(!1),!0;if(Vo){const Vl=(zl=(Wl=fo==null?void 0:fo.sdk)===null||Wl===void 0?void 0:Wl.embeddedWallets)===null||zl===void 0?void 0:zl.automaticEmbeddedWalletCreation,Ll=vo&&Lo(vo),uu=vo&&isSessionKeyCompatibleWallet(vo)||Ll&&isSessionKeyCompatibleWallet(Ll),ru=!!(Vl&&(!(!((Ml=(Tl=fo==null?void 0:fo.sdk)===null||Tl===void 0?void 0:Tl.embeddedWallets)===null||Ml===void 0)&&Ml.forceAuthenticatorAtSignup)||uu));if(ru){const tu=findPrimaryEmbeddedChain(fo),ku=findEmbeddedWalletFromVerifiedCredentials(createUserProfileFromSdkUser(Al.user),[tu]);if(!ku)throw new Error("Could not find an embedded wallet");const au=yo==null?void 0:yo.find(Jo=>Jo.key===ku.walletName);if(!(au!=null&&au.walletConnector))throw new Error("Could not find connector for embedded wallet");const wl=au.walletConnector.createWallet({address:ku.address||"",chain:au.walletConnector.connectedChain,connector:au.walletConnector,id:ku.id,isAuthenticated:!1,key:(ou=ku.walletName)!==null&&ou!==void 0?ou:""});co(ku.id),dynamicEvents.emit("embeddedWalletCreated",wl,ku,ho)}if(ru||!Vl)return lo(!1),!0}return!1}),[Xr,So,mo,To,Vo,wo,Ro,lo,(no=(ro=fo==null?void 0:fo.sdk)===null||ro===void 0?void 0:ro.embeddedWallets)===null||no===void 0?void 0:no.automaticEmbeddedWalletCreation,(oo=(io=fo==null?void 0:fo.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0?void 0:oo.forceAuthenticatorAtSignup,vo,Lo,yo,co,ho]),Cl=reactExports.useCallback(Al=>__awaiter$j(void 0,void 0,void 0,function*(){return Ao(void 0),Mo(!0),_o?!ho&&!go?Zo({onVerifySuccess:()=>po(!0),options:{email:bo},showSuccessMessage:!0,verifyFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){let Ol;return $a()&&(Ol=(yield Ho()).publicKey),signInWithEmailVerification({environmentId:ao,sessionPublicKey:Ol,verificationToken:Al,verificationUUID:_o})})}):Qo({completeSignInFlow:Ol=>__awaiter$j(void 0,void 0,void 0,function*(){return _c(Ol)}),onValidUpdatedJwt:()=>{po(!0)},options:{email:bo,isEmailRecoveryFlow:Xr},updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return Ko(Al,"email",_o)})}):qo()}),[Ao,Mo,_o,ho,go,Qo,bo,Xr,qo,Zo,ao,_c,Ko]),ga=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!_o||!bo)return;Mo(!0);const{verificationUUID:Al}=yield retryEmailVerification({email:bo,environmentId:ao,verificationUUID:_o});$o(Al),Ao(void 0)}catch(Al){logger$8.debug(Al),Po(Al.code),Al.code==="too_many_email_verification_attempts"&&Do(!1),Al.code==="invalid_email_verification"&&Eo()}finally{Mo(!1)}}),El=reactExports.useMemo(()=>Ol=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},Ol))}),[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ko&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"email-verification__error-message",children:ko}),jsxRuntimeExports.jsxs("div",{className:classNames("email-verification__container",{"email-verification__container--error":!!ko}),children:[Fo&&jsxRuntimeExports.jsx("div",{className:"email-verification__transfer-message",copykey:"dyn_otp_verification.email.complete",children:Co("dyn_otp_verification.email.complete")}),Bo?jsxRuntimeExports.jsx("div",{className:"email-verification__icon-container",children:jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"email-verification__icon--verified",Icon:El,iconSize:64,InnerIcon:SvgCheck})}):jsxRuntimeExports.jsx(IconWithSpinner,{Icon:El,iconSize:96,isSpinning:!0,className:"email-verification__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"email-verification__copy-text-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:Co("dyn_otp_verification.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:shortenEmail(bo)})]}),jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:jo,handleComplete:Cl,isValidated:Bo,inputMode:"numeric",pattern:"[0-9]*",hasError:!!ko,onChange:()=>Ao(void 0)}),No&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"email-verification__retry-container",retryHandler:ga,secondsToRetry:SECONDS_TO_RETRY}),(ho||go)&&!Xr&&jsxRuntimeExports.jsx(TextButton,{className:"email-verification__log-out",onClick:so,copykey:"dyn_otp_verification.log_out_button",children:Co("dyn_otp_verification.log_out_button")})]})]})},EmailIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},Xr,{"data-testid":"sign-in-with-email-icon"}))}),typographyColor={error:"error-1",notice:"brand-primary",success:"green-1"},ModalHeaderBanner=({messageKey:Xr,type:eo="error",disableTruncate:to=!1})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:!!Xr&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header-banner",{"modal-header-banner__error":eo==="error","modal-header-banner__notice":eo==="notice","modal-header-banner__success":eo==="success"}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:typographyColor[eo],truncate:to===!1,copykey:Xr,children:ro(Xr||"")})})})},OTPVerificationView=({onClickBack:Xr,onClickEditDestination:eo,isLoading:to,disabled:ro,displayedDestination:no,description:io,onPinComplete:oo,isValid:ao,error:so,retryHandler:co,onPinChange:lo,successBannerTextKey:fo,MainIcon:ho,hideHeader:go,appendAboveOTPInput:yo,appendToEnd:vo})=>{const{t:wo}=useTranslation(),Eo=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),ko=reactExports.useMemo(()=>ao?"dyn_otp_verification.verification_succeeded":"dyn_otp_verification.confirm_code",[ao]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!go&&jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",leading:Xr&&Eo,children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",copykey:ko,children:wo(ko)})})}),fo&&jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"notice",messageKey:fo,disableTruncate:!0}),jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"error",messageKey:so==null?void 0:so.message}),jsxRuntimeExports.jsxs("div",{className:classNames("otp-verification-view",{"otp-verification-view--message":!!(fo||so)}),children:[ao&&jsxRuntimeExports.jsx(IconWithStatus,{Icon:ho,iconSize:64,InnerIcon:SvgCheck}),!ao&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ho,iconSize:96,isSpinning:to,className:"otp-verification-view__icon-with-spinner",treatAsFunctionComponent:!0}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__body",children:[ao&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.hang_tight",children:wo("dyn_otp_verification.hang_tight")}),!ao&&(io?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:io}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:wo("dyn_otp_verification.description")}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__destination-container",children:[no&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:no}),eo&&jsxRuntimeExports.jsx(IconButton,{onClick:eo,"data-testid":"otp-verification-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]})]}))]}),yo,jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:to,handleComplete:oo,isValidated:ao,inputMode:"numeric",pattern:"[0-9]*",hasError:!!so,onChange:lo,disabled:ro}),co&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"otp-verification-view__retry-container",retryHandler:co}),vo]})]})},EmailWalletOTPVerificationView=()=>{const{setView:Xr}=useViewContext(),[eo,to]=reactExports.useState(),{selectedWalletConnector:ro,clearStatesOnBackClick:no}=useInternalDynamicContext();if(!ro||!isEmailOTPWalletConnector(ro))throw new Error("Current wallet is not EmailWalletConnector");const{email:io}=ro;if(!io)throw new Error("EmailWalletOtpVerificationView requires a email");const oo=()=>{ro.clearEmail(),no(),Xr("login-with-email-or-wallet"),dynamicEvents.emit("authFailure",{email:io,option:io,type:"email"},"user-cancelled")},{data:ao,isLoading:so,mutate:co}=useMutation(lo=>ro.verifyOneTimePassword(lo),{onFailure:lo=>{to(lo),dynamicEvents.emit("emailVerificationResult",!1,io)},onSuccess:()=>{dynamicEvents.emit("emailVerificationResult",!0,io)}});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:EmailIcon,displayedDestination:shortenEmail(io),error:eo,onClickBack:oo,isLoading:so,onPinComplete:co,isValid:ao===!0,retryHandler:ro.retryOneTimePassword.bind(ro),onPinChange:()=>to(void 0),onClickEditDestination:oo,successBannerTextKey:"dyn_magic_verification.banner_text"})};var _g$7,_defs$7,_excluded$r=["title","titleId"];function _extends$t(){return _extends$t=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$r(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExportEmbeddedHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$r(eo,_excluded$r);return reactExports.createElement("svg",_extends$t({width:329,height:88,viewBox:"0 0 329 88",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$7||(_g$7=reactExports.createElement("g",{clipPath:"url(#export-embedded-hero_svg__a)"},reactExports.createElement("circle",{cx:164.5,cy:114,r:114,fill:"url(#export-embedded-hero_svg__b)",fillOpacity:.12}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M195 23a4 4 0 0 1 4-4h40a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4h-40a4 4 0 0 1-4-4v-8Zm13.585 4c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667Zm6.34 2.667c1.5 0 2.717-1.194 2.717-2.667 0-1.473-1.217-2.667-2.717-2.667-1.501 0-2.717 1.194-2.717 2.667 0 1.473 1.216 2.667 2.717 2.667ZM226.698 27c0 1.473-1.216 2.667-2.717 2.667-1.5 0-2.717-1.194-2.717-2.667 0-1.473 1.217-2.667 2.717-2.667 1.501 0 2.717 1.194 2.717 2.667Zm8.057 0c0 .903-.751 1.667-1.717 1.667-.966 0-1.717-.764-1.717-1.667s.751-1.667 1.717-1.667c.966 0 1.717.764 1.717 1.667Zm1 0c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667ZM110.237 57.018c8.535-2.287 13.601-11.06 11.314-19.596-2.287-8.535-11.061-13.6-19.596-11.313-8.536 2.287-13.601 11.06-11.314 19.596 2.287 8.535 11.061 13.6 19.596 11.313Zm-8.712-17.797-.522-1.949a4.037 4.037 0 0 1 7.798-2.09l.522 1.95a6.727 6.727 0 1 1-7.798 2.09Zm4.573-2.535-.195-.727a1.036 1.036 0 1 0-2.002.537l.194.726a6.81 6.81 0 0 1 2.003-.536Zm1.567 6.87a1.749 1.749 0 0 0-1.586-3.023 1.75 1.75 0 0 0 .137 3.412l.368 1.37a.75.75 0 1 0 1.448-.388l-.367-1.37Z",fill:"#4779FF"}),reactExports.createElement("path",{d:"M171.501 40.667a4.666 4.666 0 0 1 4.667 4.666h-28a9.306 9.306 0 0 0-6.85 2.995c.788-4.357 4.6-7.661 9.183-7.661h21ZM187.834 59.333A9.334 9.334 0 0 0 178.5 50h-28a9.333 9.333 0 0 0-9.333 9.333V78a9.333 9.333 0 0 0 9.333 9.333h28A9.334 9.334 0 0 0 187.834 78V59.333Z",fill:"#4779FF"}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M174.25 65.25a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-3 0a3 3 0 1 0-6 0 3 3 0 0 0 6 0Zm-9.37 3.892a7.497 7.497 0 0 0 2.005 2.237l-2.831 2.83 2.103 2.103-2.121 2.122-2.103-2.103-2.062 2.062-2.121-2.121 7.13-7.13Z",fill:"#fff"}))),_defs$7||(_defs$7=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"export-embedded-hero_svg__b",x1:164.5,y1:0,x2:164.5,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"export-embedded-hero_svg__a"},reactExports.createElement("rect",{x:.5,width:328,height:88,rx:12,fill:"#fff"})))))},_path$j,_excluded$q=["title","titleId"];function _extends$s(){return _extends$s=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$q(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgInfo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$q(eo,_excluded$q);return reactExports.createElement("svg",_extends$s({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$j||(_path$j=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 2.333a6.667 6.667 0 1 0 0 13.334A6.667 6.667 0 0 0 9 2.333ZM.667 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .667 9Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 0 1 0 1.667H9a.833.833 0 0 1-.833-.833ZM7.333 9c0-.46.373-.833.834-.833H9c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H9a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 7.333 9Z",fill:"#383C48"})))},_path$i,_excluded$p=["title","titleId"];function _extends$r(){return _extends$r=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$p(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletV2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$p(eo,_excluded$p);return reactExports.createElement("svg",_extends$r({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$i||(_path$i=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 4a1 1 0 0 0 0 2h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-14a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h12a1 1 0 1 1 0 2h-12Zm-1 3.83V19a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1h-14c-.35 0-.687-.06-1-.17Zm11 6.17a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",fill:"#ABACB2"})))};const TurnkeyErrorMap={0:"Operation was canceled.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature. Select the passkey for this account and device.",7:"The code is invalid or expired."},reactNativePasskeyErrors={RequestFailed:"Request failed. Please try again.",UserCancelled:TurnkeyErrorMap[0]},DOMExceptionErrorMap={NotAllowedError:"Request Cancelled. Select a device or password manager to set up a passkey."},getProperErrorMessage=Xr=>{var eo;if(typeof Xr=="string")return Xr;if("reason"in Xr)return Xr.reason;if(Xr instanceof DOMException)return DOMExceptionErrorMap[Xr.name]||"Something went wrong";if("cause"in Xr){if(((eo=Xr==null?void 0:Xr.cause)===null||eo===void 0?void 0:eo.code)!==void 0){if(Xr.cause.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[Xr.cause.code]}if(Xr.cause&&"error"in Xr.cause&&typeof Xr.cause.error=="string"&&reactNativePasskeyErrors[Xr.cause.error])return reactNativePasskeyErrors[Xr.cause.error]}if("code"in Xr&&Xr.code){if(Xr.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[Xr.code]}return"error"in Xr&&typeof Xr.error=="string"&&reactNativePasskeyErrors[Xr.error]?reactNativePasskeyErrors[Xr.error]:"Something went wrong"},iframeContainerId="dyn-turnkey-export-container-id",iframeElementId="dyn-turnkey-export-element-id",EmbeddedRevealView=({exportPrivateKey:Xr})=>{var eo,to,ro,no;const{primaryWallet:io,user:oo,setShowAuthFlow:ao,environmentId:so}=useInternalDynamicContext(),{isTurnkeyWallet:co}=useIsTurnkeyWallet(),{shadowRoot:lo}=useShadowDOMContext(),{setDynamicWidgetView:fo}=useWidgetContext(),{setView:ho}=useViewContext(),{getEOAWallet:go,isSmartWallet:yo}=useSmartWallets(),[vo,wo]=reactExports.useState(!1),[Eo,ko]=reactExports.useState(!1),Ao=reactExports.useRef(null),Po=(to=(eo=oo==null?void 0:oo.verifiedCredentials)===null||eo===void 0?void 0:eo.find(({walletName:So})=>So==null?void 0:So.startsWith("turnkey")))===null||to===void 0?void 0:to.walletProperties,jo=Po==null?void 0:Po.turnkeyHDWalletId,Mo=(ro=io&&go(io))!==null&&ro!==void 0?ro:io,No=Mo&&isCoinbaseMpcWalletConnector(Mo.connector);reactExports.useEffect(()=>()=>{co&&cleanupExport({wallet:Mo})},[]);const{isLoading:Do}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){var So,mo;const To=Ao.current;if(!(!To||((So=To==null?void 0:To.children)===null||So===void 0?void 0:So.length)>0))return isSessionKeyCompatibleWalletConnector(Mo==null?void 0:Mo.connector)&&(yield(mo=Mo==null?void 0:Mo.connector)===null||mo===void 0?void 0:mo.createOrRestoreSession()),initExport({iframeContainer:To,iframeElementId,wallet:Mo})})),{mutate:Fo,isLoading:Xo,error:Lo,data:Bo}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){var So,mo,To;if(No)return(Mo==null?void 0:Mo.connector).exportWalletKeys();if(co)try{return yield exportCredential({address:Xr?Mo==null?void 0:Mo.address:void 0,environmentId:so,user:oo,wallet:Mo})}catch{return isSessionKeyCompatibleWalletConnector(Mo==null?void 0:Mo.connector)&&(!((So=Mo==null?void 0:Mo.connector)===null||So===void 0)&&So.removeSessionKeys)&&(yield(mo=Mo==null?void 0:Mo.connector)===null||mo===void 0?void 0:mo.removeSessionKeys(),yield(To=Mo==null?void 0:Mo.connector)===null||To===void 0?void 0:To.createOrRestoreSession({ignoreRestore:!0})),exportCredential({address:Xr?Mo==null?void 0:Mo.address:void 0,environmentId:so,user:oo,wallet:Mo})}}),{onFailure:So=>{logger$8.error("Failed to export",So),dynamicEvents.emit("embeddedWalletRevealFailed",So)},onSuccess:So=>{var mo,To;if(No&&So&&(So!=null&&So.length)){const Vo=lo==null?void 0:lo.getElementById("coinbase-waas-key-export");(mo=Vo==null?void 0:Vo.contentWindow)===null||mo===void 0||mo.postMessage({key:(To=So[0])===null||To===void 0?void 0:To.ecKeyPrivate,type:"export_key"},"*"),ko(!0)}}}),xo=reactExports.useMemo(()=>{if(Lo){if(Lo instanceof DynamicError)return Lo.message;try{return getProperErrorMessage(Lo)}catch(So){So instanceof AccessBlockedError&&ho("access-blocked");return}}},[Lo,ho]),{t:uo}=useTranslation(),po=jsxRuntimeExports.jsxs("div",{children:[io&&yo(io)&&!Xo&&Bo&&!Lo&&jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning__title-row",children:[jsxRuntimeExports.jsx(SvgInfo,{className:"embedded-reveal-view__zerodev-warning__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",copykey:"dyn_embedded_reveal.aa_warning.title",children:uo("dyn_embedded_reveal.aa_warning.title")})]}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",copykey:"dyn_embedded_reveal.aa_warning.subtitle",children:[uo("dyn_embedded_reveal.aa_warning.subtitle"),jsxRuntimeExports.jsx("button",{onClick:()=>{ao(!1),fo("send-balance")},className:"embedded-reveal-view__zerodev-warning__link-button",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",className:"underline",copykey:"dyn_embedded_reveal.aa_warning.button",children:uo("dyn_embedded_reveal.aa_warning.button")})})]})]}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:!Xo&&Bo&&!Lo?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:uo("dyn_embedded_reveal.reveal_description")}):jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__header",children:jsxRuntimeExports.jsx(SvgExportEmbeddedHero,{})})})]});reactExports.useEffect(()=>{var So;if(!((So=Ao==null?void 0:Ao.current)===null||So===void 0)&&So.children&&Bo){const mo=Ao.current.children[0];mo==null||mo.setAttribute("style",!jo||Xr?"height: 60px":"height: 100px")}},[Ao,Bo,jo,Xr]);const bo=jsxRuntimeExports.jsx(IconButton,{onClick:()=>ao(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),_o=!Xo&&Bo&&!Lo,$o=uo(!jo||Xr?"dyn_embedded_reveal.private_key_title":"dyn_embedded_reveal.recovery_phrase_title"),Co=_o?$o:uo("dyn_embedded_reveal.agreement_title"),Ro=jsxRuntimeExports.jsx("iframe",{src:(no=ApiEndpoint$1==null?void 0:ApiEndpoint$1.getBaseUrl())===null||no===void 0?void 0:no.replace("api/v0","coinbase-waas-key-export.html"),id:"coinbase-waas-key-export",title:"Coinbase WaaS key export",height:Eo?"100%":0,width:Eo?"100%":0,style:{borderRadius:"0.75rem"},allow:"clipboard-write"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:bo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:Co})}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view",children:jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body",children:[po,No&&Ro,co?jsxRuntimeExports.jsx("div",{id:iframeContainerId,style:{display:Bo?"block":"none"},ref:Ao}):null,_o?jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",onClick:()=>ao(!1),loading:Xo,copykey:"dyn_embedded_reveal.done_button_label",typographyProps:{color:"inherit"},children:uo("dyn_embedded_reveal.done_button_label")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:jsxRuntimeExports.jsx(Badge,{text:uo("dyn_embedded_reveal.badge_label"),className:"embedded-reveal-view__body__badge"})}),xo&&jsxRuntimeExports.jsx(ErrorContainer,{children:xo}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgWalletV2,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_1.title",children:uo("dyn_embedded_reveal.statement_1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_1.description",children:uo("dyn_embedded_reveal.statement_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgEyeOffIcon,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_2.title",children:uo("dyn_embedded_reveal.statement_2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_2.description",children:uo("dyn_embedded_reveal.statement_2.description",{credential_type:$o==null?void 0:$o.toLowerCase()})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__confirm_card",children:[jsxRuntimeExports.jsxs("button",{className:"embedded-reveal-view__body__card__acknowledgement",onClick:()=>wo(!vo),children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:vo,onChange:()=>wo(!vo),className:"embedded-reveal-view__body__card__statement__checkbox",id:"embedded-reveal-checkbox-1"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.checkbox_label",children:uo("dyn_embedded_reveal.checkbox_label")})})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>Fo(),disabled:!vo||Do,loading:Xo,dataTestId:"embedded-reveal-button",copykey:"dyn_embedded_reveal.reveal_button_label",children:uo("dyn_embedded_reveal.reveal_button_label")})]})]})]})})]})},useTimeout=(Xr,eo)=>{const to=reactExports.useRef(Xr);useIsomorphicLayoutEffect(()=>{to.current=Xr},[Xr]),reactExports.useEffect(()=>{if(!eo&&eo!==0)return;const ro=setTimeout(()=>to.current(),eo);return()=>clearTimeout(ro)},[eo])};var _path$h,_excluded$o=["title","titleId"];function _extends$q(){return _extends$q=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$o(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExternalLink=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$o(eo,_excluded$o);return reactExports.createElement("svg",_extends$q({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$h||(_path$h=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.333 1.333a.667.667 0 1 1 0-1.333h4c.368 0 .667.298.667.667v4a.667.667 0 0 1-1.333 0v-2.39L5.138 7.804a.667.667 0 1 1-.943-.943l5.529-5.529h-2.39ZM2 2.667a.667.667 0 0 0-.667.666V10c0 .368.299.667.667.667h6.667A.667.667 0 0 0 9.333 10V7.333a.667.667 0 0 1 1.334 0V10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3.333a2 2 0 0 1 2-2h2.667a.667.667 0 0 1 0 1.334H2Z",fill:"currentColor"})))};const browserIconMap={brave:BraveIcon,chrome:ChromeIcon,edge:EdgeIcon,firefox:FirefoxIcon,safari:SafariIcon},getBrowserIcon=Xr=>browserIconMap[Xr],useWalletDownloadLinks=Xr=>{const{walletBook:eo}=useWalletBookContext();if(!Xr)return[];const to=getWalletLinks(eo,Xr.key),{currentDesktopUrl:ro,userBrowser:no}=parseWalletLinks(to);return no&&ro?[{Icon:getBrowserIcon(no),key:no,link:ro,name:no}]:Object.entries(to).filter(([,io])=>io!=="").filter(([io])=>io!=="ios"&&io!=="android").map(([io,oo])=>({Icon:getBrowserIcon(io),key:io,link:oo,name:io}))},generateMatrix=(Xr,eo)=>{const to=Array.prototype.slice.call(browser$h.create(Xr,{errorCorrectionLevel:eo}).modules.data,0),ro=Math.sqrt(to.length);return to.reduce((no,io,oo)=>(oo%ro===0?no.push([io]):no[no.length-1].push(io))&&no,[])},QRCode=({ecl:Xr="M",Icon:eo,logoMargin:to=0,logoSize:ro=40,size:no=250,value:io,accentColor:oo="currentColor",walletKey:ao=void 0,showQrCodeImage:so})=>{const{data:co}=usePromise(()=>browser$h.toDataURL(io)),lo=reactExports.useMemo(()=>{const yo=[],vo=generateMatrix(io||"QR Code value",Xr),wo=no/vo.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:jo,y:Mo})=>{const No=(vo.length-7)*wo*jo,Do=(vo.length-7)*wo*Mo;for(let Fo=0;Fo<3;Fo++)yo.push(jsxRuntimeExports.jsx("rect",{"data-key":`corner-square-${jo}-${Mo}-${Fo}`,fill:Fo%2!==0?"var(--background)":oo,height:wo*(7-Fo*2),rx:Fo===0?10:Fo===1?7:20,ry:Fo===0?10:Fo===1?7:20,width:wo*(7-Fo*2),x:No+wo*Fo,y:Do+wo*Fo},`corner-square-${jo}-${Mo}-${Fo}`))});const ko=Math.floor(ro*1.5/wo),Ao=vo.length/2-ko/2,Po=vo.length/2+ko/2-1;for(let jo=0;jovo.length-8&&Mo<7||jo<7&&Mo>vo.length-8||jo>Ao&&joAo&&Mo.9?oo:"currentColor",r:wo/2.25},`dot-${jo}-${Mo}`)));return yo},[Xr,ro,no,io,oo]),fo=no/2-ro/2-to,go=!ao||["coinbase","walletconnect"].includes(ao)?void 0:"walletConnect";return jsxRuntimeExports.jsx("div",{className:"qrcode__container",children:jsxRuntimeExports.jsx("div",{className:"qrcode",children:so?jsxRuntimeExports.jsx("img",{"data-testid":"qr-code-image",src:co,alt:""}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("svg",{height:"100%",width:"100%",viewBox:`0 0 ${no} ${no}`,"data-testid":"qr-code",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip-logo",children:jsxRuntimeExports.jsx("rect",{height:ro,width:ro,x:fo,y:fo,rx:7,ry:7})})}),jsxRuntimeExports.jsx("rect",{fill:"none",height:no,width:no}),lo]}),jsxRuntimeExports.jsx(IconWithSpinner,{Icon:eo,iconSize:ro,isSpinning:!0,className:"qrcode__icon",indicator:go})]})})})},LoadingQrCode=({Icon:Xr,logoSize:eo})=>jsxRuntimeExports.jsx("div",{className:"qrcode__container qrcode","data-testid":"loading-qrcode",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Xr,iconSize:eo,isSpinning:!0,className:"qrcode__icon"})}),QrCodeContainer=({accentColor:Xr,walletConnector:eo,qrcodeValue:to,Icon:ro,showCopyToClipboardButton:no=!1,desktopUri:io,showQrCodeMessage:oo,showQrCodeImage:ao})=>{const{t:so}=useTranslation(),{setView:co}=useViewContext(),lo=useWalletDownloadLinks(eo),fo=()=>io?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>window.open(io),copykey:"dyn_qr_code.open_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:so("dyn_qr_code.open_button")}):lo!=null&&lo.length?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>co("no-qr-not-installed"),copykey:"dyn_qr_code.get_extension_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:so("dyn_qr_code.get_extension_button")}):null;return jsxRuntimeExports.jsxs("div",{className:classNames("qrcode-container__container",{"qrcode-container__container--message":oo}),children:[jsxRuntimeExports.jsxs("div",{className:"qrcode-container__top",children:[to.length?jsxRuntimeExports.jsx(QRCode,{Icon:ro,accentColor:Xr,value:to,logoSize:50,walletKey:eo==null?void 0:eo.key,showQrCodeImage:ao}):jsxRuntimeExports.jsx(LoadingQrCode,{Icon:ro,logoSize:50}),jsxRuntimeExports.jsxs("div",{className:"button-container",children:[no&&jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:to,disabled:!to.length,buttonClassName:"qr-code-button",copykey:"dyn_qr_code.copy_button",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:so("dyn_qr_code.copy_button")}),fo()]})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"qrcode-container__content",copykey:"dyn_qr_code.scan_title",children:so("dyn_qr_code.scan_title",{app:eo?"wallet":"app"})})]})},QrCodeWrapper=({uri:Xr,desktopUri:eo,icon:to,accentColor:ro,showCopyToClipboardButton:no,walletConnector:io})=>{const[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(!1);return useTimeout(()=>ao(!0),Xr.length?5e3:null),jsxRuntimeExports.jsxs("div",{"data-testid":"qr-code-wrapper",className:"qr-code-wrapper",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:oo&&!so&&jsxRuntimeExports.jsxs("div",{className:"qr-code-wrapper__scan-issue-message",children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",children:"If you're having issues scanning, click "}),jsxRuntimeExports.jsx("button",{"data-testid":"qr-code-wrapper__scan-issue-button",className:"qr-code-wrapper__scan-issue-button",onClick:()=>co(!0),children:"here"})]})}),jsxRuntimeExports.jsx(QrCodeContainer,{showQrCodeMessage:oo,desktopUri:eo,accentColor:ro,walletConnector:io,qrcodeValue:Xr,Icon:to,showCopyToClipboardButton:no,showQrCodeImage:so})]})},FarcasterConnectView=({url:Xr})=>{const{theme:{theme:eo}}=useThemeContext(),to=useIconThemeVariant(),ro=jsxRuntimeExports.jsx(SocialIcon,{name:"farcaster",variant:to});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:Xr,accentColor:to==="dark"?eo.colors.textPrimary:"#7b65c0",icon:ro,showCopyToClipboardButton:!0})},GlobalWalletConfirmView=({pairingInfo:Xr,onConfirm:eo,onCancel:to})=>{const{t:ro}=useTranslation(),[no,io]=reactExports.useState(!1),oo=()=>{io(!0)};return jsxRuntimeExports.jsx("div",{className:"global-wallet-confirm",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[!no&&jsxRuntimeExports.jsx("img",{src:Xr.icons[0],alt:`${Xr.name} icon`,className:"dapp-icon",onError:oo}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",children:ro("global_wallet.confirm.description",{name:Xr.name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"dapp-url",children:Xr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",onClick:to,type:"submit",buttonPadding:"large",children:ro("global_wallet.confirm.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"connect-global-button",onClick:eo,type:"submit",buttonPadding:"large",typographyProps:{color:"white"},children:ro("global_wallet.confirm.connect_button")})]})]})})})};var _g$6,_defs$6,_excluded$n=["title","titleId"];function _extends$p(){return _extends$p=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$n(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgBlueWalletconnect=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$n(eo,_excluded$n);return reactExports.createElement("svg",_extends$p({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$6||(_g$6=reactExports.createElement("g",{clipPath:"url(#blue-walletconnect_svg__a)"},reactExports.createElement("path",{d:"M6 12A6 6 0 1 0 6 0a6 6 0 0 0 0 12Z",fill:"#4084ED"}),reactExports.createElement("path",{d:"M3.343 4.286a3.761 3.761 0 0 1 5.314 0l.176.176a.186.186 0 0 1 0 .265l-.603.603a.096.096 0 0 1-.133 0l-.243-.244a2.624 2.624 0 0 0-3.708 0l-.26.26a.096.096 0 0 1-.132 0l-.606-.6a.186.186 0 0 1 0-.266l.195-.194Zm6.563 1.248.538.537a.185.185 0 0 1 0 .265L8.018 8.757a.187.187 0 0 1-.264 0L6.034 7.04a.047.047 0 0 0-.068 0l-1.72 1.718a.187.187 0 0 1-.264 0l-2.426-2.42a.186.186 0 0 1 0-.266l.538-.537a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .067 0l1.72-1.718a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .068 0l1.72-1.718a.19.19 0 0 1 .267 0Z",fill:"#fff"}))),_defs$6||(_defs$6=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"blue-walletconnect_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h12v12H0z"})))))};const InlineIconTypography=({children:Xr})=>jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:jsxRuntimeExports.jsx("span",{className:"inline-icon-text",children:Xr})}),GlobalWalletInfoView=()=>{const{t:Xr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"info-card",children:jsxRuntimeExports.jsxs("div",{className:"wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",as:"h2",children:"How do I find the URI or QR code?"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:Xr("global_wallet.help.step.1")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:Xr("global_wallet.help.step.2")}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["3. Open"," ",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:["WalletConnect ",jsxRuntimeExports.jsx(SvgBlueWalletconnect,{})]}),"from the list, this should show a QR code to scan"]}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["4. If you are not using the QR code, locate and click",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:[jsxRuntimeExports.jsx(SvgCopy,{})," to copy"]})," ","the URI code"]})]})})};var _path$g,_excluded$m=["title","titleId"];function _extends$o(){return _extends$o=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$m(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExclamation=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$m(eo,_excluded$m);return reactExports.createElement("svg",_extends$o({width:7,height:32,viewBox:"0 0 7 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$g||(_path$g=reactExports.createElement("path",{d:"M6.4 3.2a3.2 3.2 0 0 0-6.4 0V16a3.2 3.2 0 0 0 6.4 0V3.2ZM3.2 25.6a3.2 3.2 0 0 0 0 6.4h.032a3.2 3.2 0 0 0 0-6.4H3.2Z",fill:"#F9F9FB"})))},_path$f,_excluded$l=["title","titleId"];function _extends$n(){return _extends$n=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$l(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExclamationCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$l(eo,_excluded$l);return reactExports.createElement("svg",_extends$n({width:17,height:18,viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$f||(_path$f=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 2.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM.167 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .167 9ZM8.5 4.833c.46 0 .833.373.833.834V9a.833.833 0 1 1-1.667 0V5.667c0-.46.374-.834.834-.834Zm-.833 7.5c0-.46.373-.833.833-.833h.008a.833.833 0 0 1 0 1.667H8.5a.833.833 0 0 1-.833-.834Z",fill:"#FF4646"})))},_path$e,_excluded$k=["title","titleId"];function _extends$m(){return _extends$m=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$k(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCautionTriangle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$k(eo,_excluded$k);return reactExports.createElement("svg",_extends$m({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$e||(_path$e=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.335 1.917c.962-1.667 3.368-1.667 4.33 0l5.774 10c.962 1.666-.241 3.75-2.166 3.75H2.726c-1.924 0-3.127-2.084-2.165-3.75l5.774-10Zm2.887.833a.833.833 0 0 0-1.444 0l-5.773 10A.833.833 0 0 0 2.726 14h11.547a.833.833 0 0 0 .722-1.25l-5.773-10ZM8.5 5.667c.46 0 .833.373.833.833v1.667a.833.833 0 0 1-1.666 0V6.5c0-.46.373-.833.833-.833ZM7.667 11.5c0-.46.373-.833.833-.833h.008a.833.833 0 1 1 0 1.666H8.5a.833.833 0 0 1-.833-.833Z",fill:"#DD8500"})))},_circle$3,_excluded$j=["title","titleId"];function _extends$l(){return _extends$l=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$j(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWarningRed=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$j(eo,_excluded$j);return reactExports.createElement("svg",_extends$l({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$3||(_circle$3=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#FF4646"})))},_circle$2,_excluded$i=["title","titleId"];function _extends$k(){return _extends$k=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$i(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWarningOrange=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$i(eo,_excluded$i);return reactExports.createElement("svg",_extends$k({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$2||(_circle$2=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#DD8500"})))};const GlobalWalletMaliciousView=({maliciousSiteInfo:Xr})=>{const{t:eo}=useTranslation(),{setDynamicWidgetView:to}=useWidgetContext(),{setShowAuthFlow:ro}=useInternalDynamicContext(),no=()=>{to("global-wallet"),ro(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},io=()=>{var oo;(oo=Xr.proceedFlow)===null||oo===void 0||oo.call(Xr)};return jsxRuntimeExports.jsx("div",{className:"malicious-site-view",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[jsxRuntimeExports.jsxs("div",{className:"warning-icon-container",style:{position:"relative"},children:[Xr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgWarningRed,{className:"warning-icon"}):jsxRuntimeExports.jsx(SvgWarningOrange,{className:"warning-icon"}),jsxRuntimeExports.jsx(SvgExclamation,{className:"exclamation-icon",style:{left:"50%",position:"absolute",top:"50%",transform:"translate(-50%, -50%)"}})]}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",color:"primary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.title"):eo("global_wallet.malicious_site.unknown.title")}),jsxRuntimeExports.jsxs("div",{className:`subtitle-container ${Xr.isDefinitelyMalicious?"definitely-malicious":"unknown"}`,children:[jsxRuntimeExports.jsxs("div",{className:"subtitle-header-container",children:[Xr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgExclamationCircle,{className:"caution-icon"}):jsxRuntimeExports.jsx(SvgCautionTriangle,{className:"caution-icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle-header",color:"primary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.subtitle_header"):eo("global_wallet.malicious_site.unknown.subtitle_header")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle",color:"secondary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.subtitle_text"):eo("global_wallet.malicious_site.unknown.subtitle_text")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"site-info",color:"secondary",children:Xr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",buttonVariant:"primary",type:"submit",buttonPadding:"large",onClick:no,copykey:"global_wallet.malicious_site.go_back",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.go_back"):eo("global_wallet.malicious_site.unknown.go_back")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"proceed-button",buttonVariant:"secondary",type:"submit",buttonPadding:"large",onClick:io,copykey:"global_wallet.malicious_site.proceed",typographyProps:{color:"error-1"},children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.proceed"):eo("global_wallet.malicious_site.unknown.proceed")})]})]})})})},DefaultFooter=({hideBorder:Xr})=>jsxRuntimeExports.jsx("div",{className:classNames("default-footer__footer",{"default-footer__footer--hidden":Xr}),"data-testid":"default-footer"});var _path$d,_excluded$h=["title","titleId"];function _extends$j(){return _extends$j=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$h(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSearch=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$h(eo,_excluded$h);return reactExports.createElement("svg",_extends$j({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$d||(_path$d=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.667 2.667a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-5.333 4a5.333 5.333 0 1 1 9.546 3.27l3.592 3.592a.667.667 0 0 1-.943.942L9.937 10.88a5.333 5.333 0 0 1-8.604-4.213Z",fill:"currentColor"})))};const Search=({className:Xr="",id:eo,label:to,type:ro,onChange:no,onBlur:io,name:oo,value:ao,onClickClear:so,copykey:co})=>jsxRuntimeExports.jsxs("label",{htmlFor:eo,className:classNames("search__container",ao?"search__container--active":void 0),children:[jsxRuntimeExports.jsx("div",{className:"search-icon__container",children:jsxRuntimeExports.jsx(SvgSearch,{})}),jsxRuntimeExports.jsx("input",{name:oo,value:ao,onChange:no,onBlur:io,type:ro,id:eo,placeholder:to,className:classNames("search__input",Xr),"data-testid":"Search",copykey:co}),ao.length>0&&jsxRuntimeExports.jsx("button",{type:"button",onClick:so,className:"search__button--clear",children:"Clear"})]}),findLastPriorityIndex=(Xr,eo)=>eo.reduce((to,ro)=>{const no=Xr.indexOf(ro.toLowerCase());return no>to?no:to},-1),getCalculatedOffset=({hasWalletFilter:Xr,defaultOffset:eo,list:to,priorityList:ro})=>{const no=findLastPriorityIndex(to,ro);return eo===DEFAULT_NUMBER_OF_WALLETS_TO_SHOW&&!Xr&&to.length>eo&&no!==-1?no+1:eo},findGroupIndex=(Xr,eo)=>eo.findIndex(to=>isWalletGroup(to)&&to.key===Xr),groupWalletOptions=(Xr,eo)=>{const to=[];return eo.forEach(ro=>{var no;if(!ro.group)return to.push(ro);const io=findGroupIndex(ro.group,to);if(io>-1)return(no=to[io].groupedWallets)===null||no===void 0?void 0:no.push(ro);if(!eo.some(co=>{var lo;const fo=ro.group===co.group,ho=ro.key!==co.key,go=((lo=co.injectedConfig)===null||lo===void 0?void 0:lo.length)&&co.injectedConfig.length>1;return fo&&(go||ho)}))return to.push(ro);const ao=getWalletGroup(Xr,ro.group),so={groupedWallets:[ro],key:ao.key,name:ao.name};return to.push(so)}),to},filterConnectedWallets=({walletOptions:Xr,userWallets:eo})=>{const to=new Set(eo.map(ro=>ro.connector.key));return(to.has("phantom")||to.has("phantomledger"))&&(to.add("phantom"),to.add("phantomledger")),Xr.filter(ro=>!to.has(ro.walletConnector.key))},getPlatformForConnector=Xr=>isMobile$1()||Xr.isWalletConnect?"mobile":"browserExtension",staticWalletFilter=(Xr,eo,to)=>eo.filter(ro=>isWalletEventSupported(findWalletBookWallet(to,ro.key),"accountChanged",getPlatformForConnector(ro.walletConnector))?!0:!Xr.some(no=>no.connector.key===ro.key)),filterWalletConnectWallets=({walletOptions:Xr,userWallets:eo})=>eo.some(ro=>ro.connector.isWalletConnect)?Xr.filter(ro=>!ro.walletConnector.isWalletConnect):Xr,applyMultiWalletFilters=({authMode:Xr,userWallets:eo,walletOptions:to,walletBook:ro})=>{const no=filterWalletConnectWallets({userWallets:eo,walletOptions:to});return Xr==="connect-only"?filterConnectedWallets({userWallets:eo,walletOptions:no}):staticWalletFilter(eo,no,ro)},PRIORITY_WALLET_LIST=["metamask","coinbase","walletconnect","phantom","argentx","blocto","solflare","braavos","trust","rainbow","dapper","glow","lilico"],sortedInputList=(Xr,eo)=>{const to=[],ro=[],no=[];Xr.forEach(ao=>{const so=eo.includes(ao.key);so?to.push(ao):PRIORITY_WALLET_LIST.includes(ao.key)&&!so?ro.push(ao):no.push(ao)});const io=ro.slice().sort((ao,so)=>PRIORITY_WALLET_LIST.indexOf(ao.key)-PRIORITY_WALLET_LIST.indexOf(so.key));return[...to.slice().sort((ao,so)=>eo.indexOf(ao.key)-eo.indexOf(so.key)),...io,...no]},walletListBuilder=({authMode:Xr,userWallets:eo,multiWallet:to,numberOfWalletsToShow:ro,inputList:no,isWalletConnectList:io,lastUsedWalletKey:oo,searchFilter:ao,walletsFilter:so,loginWithEmail:co,groupWallets:lo,walletBook:fo,showMoreWalletsWithFilter:ho,recommendedWallets:go})=>{let yo=no;io&&(yo=no.filter(Xo=>Xo.walletConnector.isWalletConnect&&Xo.key!=="walletconnect")),to&&(yo=applyMultiWalletFilters({authMode:Xr,userWallets:eo,walletBook:fo,walletOptions:yo}));let vo;const wo=!!so,Eo=[],ko=[],Ao=[],Po=Array.from(new Set((go||[]).map(Xo=>Xo.walletKey))),jo=orderAndFilterList(yo,so,io,Po);jo.forEach(Xo=>{const Lo=Po==null?void 0:Po.includes(Xo.key);if(!isEmbeddedConnector(Xo.walletConnector)){if(Xo.key==="unknown"||!Xo.walletConnector.isAvailable)return;Lo?Eo.push(Xo):oo===Xo.key?vo=Xo:Xo.isInstalledOnBrowser?ko.push(Xo):Ao.push(Xo)}});const Mo=[...vo?[vo]:[]],No=[...Eo,...Mo,...ko,...Ao],Do=lo?groupWalletOptions(fo,No):No,Fo=ho&&wo?calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(jo,Mo.concat(ko),ro):ro;return{numberOfWallets:No.length,walletsList:listToDisplay(Do,ao,io,Fo,wo,co)}},orderAndFilterList=(Xr,eo,to,ro)=>{const no=sortedInputList(Xr,ro);return!to&&eo?eo(no):no},KEEP_WALLETS_NAME_LIST=["walletconnect","bitcoin.com wallet"],applySearchFilterToWalletOptionList=(Xr,eo)=>{const to=Xr.trim().toLowerCase(),ro=no=>{const io=no.trim().toLowerCase();return KEEP_WALLETS_NAME_LIST.includes(io)?io:io.replace("wallet","").replace("evm","").replace("starknet","").replace("solana","").replace("flow","").replace("bitcoin","")};return eo.filter(no=>{var io;return ro(no.name).includes(to)||((io=no.groupedWallets)===null||io===void 0?void 0:io.some(oo=>ro(oo.name).includes(to)))})},listToDisplay=(Xr,eo,to,ro,no,io)=>{if(eo)return applySearchFilterToWalletOptionList(eo,Xr);if(to)return Xr;if(io)return Xr.slice(0,ro);{const oo=Xr.map(so=>so.name.toLowerCase()),ao=getCalculatedOffset({defaultOffset:ro,hasWalletFilter:no,list:oo,priorityList:PRIORITY_WALLET_LIST});return Xr.slice(0,ao)}},calculateWalletOffsetBasedOnInstalledAndLastUsedWallets=(Xr,eo,to)=>{const ro=Xr.slice(0,to),no=eo.filter(io=>!ro.includes(io)).length;return to+no};var _path$c,_rect,_rect2,_rect3,_excluded$g=["title","titleId"];function _extends$i(){return _extends$i=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$g(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgNoWalletFound=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$g(eo,_excluded$g);return reactExports.createElement("svg",_extends$i({width:121,height:81,viewBox:"0 0 121 81",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$c||(_path$c=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M99.064 34.016c-6.654 0-12.048 5.394-12.048 12.048 0 6.653 5.394 12.047 12.048 12.047 6.653 0 12.047-5.394 12.047-12.047 0-6.654-5.394-12.048-12.047-12.048ZM83 46.064C83 37.192 90.192 30 99.064 30c8.871 0 16.063 7.192 16.063 16.064 0 3.712-1.259 7.13-3.373 9.85l8.658 8.658a2.008 2.008 0 0 1-2.84 2.84l-8.658-8.658a15.994 15.994 0 0 1-9.85 3.373C90.192 62.127 83 54.935 83 46.064Z",fill:"currentColor",fillOpacity:.35})),_rect||(_rect=reactExports.createElement("rect",{y:8,width:121,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect2||(_rect2=reactExports.createElement("rect",{y:30,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect3||(_rect3=reactExports.createElement("rect",{y:52,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})))};const FilterBridgeChainsName=Xr=>eo=>eo.filter(to=>to.walletConnector.supportedChains.includes(Xr)),SearchNotFoundMessage=({title:Xr,subtitle:eo,image:to})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:"search-instead__container",children:[to&&jsxRuntimeExports.jsx(Icon,{className:"search-instead__container__image",color:"text-tertiary",children:to}),jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.title",children:Xr||ro("dyn_wallet_list.wallet_missing.title")}),jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"button_primary",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.description",children:eo||ro("dyn_wallet_list.wallet_missing.description")})]})},WalletListGridTabs=({items:Xr,onSelect:eo,value:to})=>jsxRuntimeExports.jsx("div",{className:"wallet-list-grid-tabs",children:Xr.map((ro,no)=>{const io=to===no,{icon:oo,text:ao}=ro.label,so=`${ao}-${oo}-${Xr.indexOf(ro)}`,co=typeof oo=="string"?jsxRuntimeExports.jsx("img",{src:oo,alt:ao}):oo;return jsxRuntimeExports.jsxs("button",{type:"button",className:classNames("wallet-list-grid-tabs__button",{"wallet-list-grid-tabs__button--selected":io,"wallet-list-grid-tabs__button--text":!!ao}),tabIndex:-1,"aria-label":ao,onClick:()=>eo(no),children:[co&&jsxRuntimeExports.jsx(Icon,{size:"small",className:classNames({"wallet-list-grid-tabs__icon--selected":!io}),children:co}),ao&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_small",weight:io?"bold":"medium",color:io?"primary":"secondary",children:ao})]},so)})}),getEffectiveWalletFilter=(Xr,eo)=>Xr&&(Xr!=null&&Xr.walletsFilter)?Xr.walletsFilter:eo,getEffectiveRecommendedWallets=(Xr,eo)=>Xr&&(Xr!=null&&Xr.recommendedWallets)?Xr.recommendedWallets:eo,WalletList=({isWalletConnectList:Xr=!1})=>{var eo;useEffectOnce(()=>()=>StorageService==null?void 0:StorageService.setItem(WALLET_PICKER_SEARCH_KEY,""));const{walletsFilter:to,walletConnectorOptions:ro,projectSettings:no,defaultNumberOfWalletsToShow:io,bridgeChainsToConnect:oo,authMode:ao,multiWallet:so,recommendedWallets:co,selectedTabIndex:lo,setSelectedTabIndex:fo,selectedTabSettings:ho,tabsItems:go}=useInternalDynamicContext(),yo=useUserWallets(),{walletBook:vo}=useWalletBookContext(),{error:wo}=useErrorContext(),{showDefaultFooter:Eo}=useAuthLayoutChecks(),[ko,Ao]=reactExports.useState(!0),{t:Po}=useTranslation(),[jo,Mo]=reactExports.useState((eo=StorageService.getItem(WALLET_PICKER_SEARCH_KEY))!==null&&eo!==void 0?eo:""),No=(oo==null?void 0:oo.length)&&FilterBridgeChainsName(oo[0].chain),Do=No&&No(ro),Fo=getEffectiveRecommendedWallets(ho,co),{numberOfWallets:Xo,walletsList:Lo}=walletListBuilder({authMode:ao,groupWallets:!0,inputList:Do||ro,isWalletConnectList:Xr,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),multiWallet:so,numberOfWalletsToShow:io,recommendedWallets:Fo,searchFilter:jo,showMoreWalletsWithFilter:!0,userWallets:yo,walletBook:vo,walletsFilter:getEffectiveWalletFilter(ho,to)}),Bo=!!jo||Xo>io&&Lo.length!==Xo,xo=!!(go!=null&&go.length),uo=reactExports.useRef(null),po=()=>{const $o=uo.current;$o&&(($o==null?void 0:$o.scrollTop)>($o==null?void 0:$o.clientHeight)*1.25?Ao(!1):Ao(!0))},bo=$o=>{StorageService.setItem(WALLET_PICKER_SEARCH_KEY,$o),Mo($o)},_o=no?Bo&&jsxRuntimeExports.jsx("div",{className:classNames("wallet-list__search-container",{"wallet-list__search-container--scroll":!wo}),children:jsxRuntimeExports.jsx(Search,{copykey:"dyn_wallet_list.search.label",label:Po("dyn_wallet_list.search.label",{numberOfWallets:Xo}),value:jo,onChange:({target:{value:$o}})=>bo($o),onClickClear:()=>bo("")})}):jsxRuntimeExports.jsx(Skeleton,{className:"wallet-list__search-skeleton"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[xo&&jsxRuntimeExports.jsx("div",{className:"wallet-list__tabs-container",children:jsxRuntimeExports.jsx(WalletListGridTabs,{items:go,value:lo||0,onSelect:fo})}),_o,!!wo&&jsxRuntimeExports.jsx(ErrorContainer,{className:"wallet-list__error-container",withIcon:!1,children:wo}),jsxRuntimeExports.jsx("div",{className:"wallet-list__container",children:jsxRuntimeExports.jsxs("div",{className:classNames("wallet-list__scroll-container",{"wallet-list__scroll-container--error":!!wo,"wallet-list__scroll-container--fixed-height":xo}),"data-testid":"wallet-list-scroll-container",ref:uo,onScroll:po,children:[no?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ro.length===0&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_wallet_list.configuration_mismatch",children:Po("dyn_wallet_list.configuration_mismatch")}),ro.length&&Lo.length===0?jsxRuntimeExports.jsx(SearchNotFoundMessage,{title:Po("dyn_wallet_list.search.not_found.title"),subtitle:Po("dyn_wallet_list.search.not_found.description"),image:jsxRuntimeExports.jsx(SvgNoWalletFound,{})}):Lo.map(($o,Co)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:$o,onResetSearchValue:()=>bo(""),recommendedWallets:Fo},`${$o.key}_${Co}`))]}):jsxRuntimeExports.jsx(Skeleton,{count:10,className:"wallet-list__tile-skeleton"}),Bo&&!jo&&no&&jsxRuntimeExports.jsx(SearchNotFoundMessage,{})]})}),Eo&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!ko})]})},FarcasterQrCodeView=()=>{const{setError:Xr}=useErrorContext(),[eo,to]=reactExports.useState(void 0),{connectSocialAccount:ro}=useSocialAuth({onError:()=>Xr("Something went wrong"),onFarcasterUrl:no=>to(no),sessionTimeout:2e4});return useEffectOnce(()=>{ro({authMode:"signin",provider:ProviderEnum.Farcaster})}),jsxRuntimeExports.jsx(FarcasterConnectView,{url:eo??""})},isPhoneNumberProviderEnabled=Xr=>!!(Xr&&isProviderEnabled(Xr,ProviderEnum.Sms)),useSubmitPhoneNumber=({onSubmit:Xr,onSubmitError:eo,country:to,phone:ro,setInvalidNumberMessage:no})=>{const{engageCaptcha:io}=useCaptchaContext(),{view:oo,setView:ao}=useViewContext(),{environmentId:so,projectSettings:co}=useInternalDynamicContext(),{setDisplayedDestination:lo,setVerificationUUID:fo,setRetryData:ho}=useVerification(),{fieldsConfig:go}=useFields(),{t:yo}=useTranslation(),vo=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(to)try{const Eo=de$4({dialCode:to.dialCode,phone:ro}),{verificationUUID:ko}=yield createSmsVerification({captchaToken:wo,environmentId:so,isoCountryCode:to.iso2,phoneCountryCode:to.dialCode,phoneNumber:Eo});ho({dialCode:to.dialCode,iso2:to.iso2,phone:Eo}),ao("login-with-sms-verification"),lo(formatPhone(ro)),fo(ko);const Ao={dialCode:to.dialCode,iso2:to.iso2,phone:Eo};dynamicEvents.emit("authInit",{option:Ao,phone:Ao,type:"sms"}),Xr==null||Xr()}catch(Eo){if(ao(oo.type),Eo instanceof SmsVerificationError){let ko=yo("dyn_login.helper.phone_number_form.invalid_phone");Eo.code==="too_many_sms_verification_attempts"&&(ko=yo("dyn_login.helper.phone_number_form.too_many_sms_verification_attempts")),Eo.code&&Eo.code in translation.dyn_login.helper.phone_number_form&&(ko=yo("dyn_login.helper.phone_number_form."+Eo.code)),no(ko)}else typeof Eo=="string"&&no(Eo);eo==null||eo()}});return wo=>__awaiter$j(void 0,void 0,void 0,function*(){var Eo;if(to){wo.preventDefault();try{go.phoneNumber.validation.validateSync(ro)}catch(ko){const{message:Ao}=ko;no(Ao),eo==null||eo();return}if(!((Eo=co==null?void 0:co.security.hCaptcha)===null||Eo===void 0)&&Eo.enabled){io({authMethod:"phone",onCaptchaSuccess:vo});return}vo()}})},PhoneNumberSignInSection=({isLoading:Xr,onSubmit:eo,onSubmitError:to})=>{var ro,no;const{projectSettings:io}=useInternalDynamicContext(),oo=reactExports.useMemo(()=>{const Po=getSupportedCountriesForVerificationFromProjectSettings(io);return getCustomCountries(getDefaultCountriesIfEmpty(Po))},[io]),[ao,so]=reactExports.useState(void 0),[co,lo]=reactExports.useState(!1),[fo,ho]=reactExports.useState({country:void 0,phone:""}),go=reactExports.useCallback(Po=>{ho(Po),lo(validatePhoneLength(Po.phone,Po.country))},[]),[yo,vo]=reactExports.useState(!1),[wo,Eo]=reactExports.useState(!1),ko=useSubmitPhoneNumber({country:fo.country,onSubmit:eo,onSubmitError:to,phone:fo.phone,setInvalidNumberMessage:so});if(!isPhoneNumberProviderEnabled((ro=io==null?void 0:io.providers)!==null&&ro!==void 0?ro:[]))return logger$8.error("Failed to render PhoneNumberSignInSection - no sign in provider enabled"),null;const Ao=!(!((no=io==null?void 0:io.design.modal)===null||no===void 0)&&no.emailSubmitButtonInsideInput);return jsxRuntimeExports.jsxs("form",{className:"login-with-phone-number-form",onSubmit:Po=>ko(Po),children:[jsxRuntimeExports.jsx(PhoneNumberField,{countries:oo,onUpdate:go,error:ao,setIsHovered:vo,setIsFocused:Eo,appendRight:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:Xr||!co,highlighted:co,isFocused:wo,isHovered:yo,className:"login-with-phone-number-form__fields__inline-submit",emailSubmitButtonInsideInput:!Ao})}),Ao&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"big-submit-button",buttonClassName:"login-with-phone-number-form__button",type:"submit",loading:Xr,disabled:Xr||!co,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,typographyProps:{color:"inherit"},children:"Continue"})]})},getSocialSignInProviderFromString=Xr=>{if(!Xr)return;const eo=Object.values(SocialSignInProviderEnum);for(const to of eo)if(to===Xr)return to};var _path$b,_excluded$f=["title","titleId"];function _extends$h(){return _extends$h=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$f(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDotsHorizontal=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$f(eo,_excluded$f);return reactExports.createElement("svg",_extends$h({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$b||(_path$b=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.7 10a1.667 1.667 0 1 1 3.333 0A1.667 1.667 0 0 1 2.7 10Zm5.833 0a1.667 1.667 0 1 1 3.334 0 1.667 1.667 0 0 1-3.334 0Zm5.834 0a1.667 1.667 0 1 1 3.333 0 1.667 1.667 0 0 1-3.333 0Z",fill:"currentColor",fillOpacity:.4})))};const providerLabel=Xr=>{if(Xr)return Xr===SocialSignInProviderEnum.Coinbasesocial?"Coinbase":capitalize$1(Xr)},INTERNAL_MAX_INLINE_ITEMS=5,SocialSignIn=({providers:Xr,onSelectProvider:eo,isLoading:to,selectedProvider:ro,testId:no,defaultProvider:io,numOfItemsToDisplay:oo=5,collapsedLayout:ao})=>{const{t:so}=useTranslation(),co=useIconThemeVariant();io&&!Xr.includes(io)&&([io]=Xr);const lo=Xr.filter(jo=>jo!==io),fo=Math.min(oo,INTERNAL_MAX_INLINE_ITEMS),ho=lo.length>fo,go=ho?lo.slice(0,fo-1):lo.slice(0,fo),[yo,vo]=reactExports.useState(!1),wo=()=>!to&&vo(!1),Eo=Xr.length===1||!ao&&Xr.length<4,ko=jo=>jo,Ao=jsxRuntimeExports.jsx(IconButton,{onClick:wo,type:"button",id:"close-button",disabled:to,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Po=(jo,Mo=!1,No=!1)=>jsxRuntimeExports.jsxs(IconListTile,{dataTestId:No?`card-${jo}`:`inline-${jo}`,onClick:()=>eo(jo),disabled:!!ro,className:classNames({"social-sign-in--card--tile":No,"social-sign-in--tile":!No,"social-sign-in--tile__full-width":Mo}),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:jsxRuntimeExports.jsx(SocialIcon,{name:ko(jo),variant:co}),isSpinning:ro===jo,iconSize:32}),!No&&Mo&&jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.social.button_label",children:so("dyn_login.social.button_label",{provider:providerLabel(jo)})})]},ko(jo));return Xr.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"social-sign-in","data-testid":no,children:[io&&Po(io,!0),go.map(jo=>Po(jo,Eo)),ho&&jsxRuntimeExports.jsx(IconListTile,{dataTestId:"show-more-options",onClick:()=>vo(!0),className:"social-sign-in--tile",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",children:jsxRuntimeExports.jsx(SvgDotsHorizontal,{})})},"show-more-options")]}),jsxRuntimeExports.jsx(OverlayCard,{isOpen:yo,onClickOverlay:wo,children:jsxRuntimeExports.jsxs("div",{className:"social-sign-in--card",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Ao,children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",children:"Choose a social account"})}),jsxRuntimeExports.jsx("div",{className:"social-sign-in--card--body",children:Xr.map(jo=>Po(jo,!1,!0))})]})})]}):(logger$8.error("Failed to render SocialSignInSection - no social providers enabled"),null)},MagicSocialSignIn=({defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})=>{const{projectSettings:ro}=useInternalDynamicContext(),{socialProvider:no,setSocialProvider:io,socialWalletConnector:oo,enabledSocialProviders:ao}=useSocialRedirectContext(),{engageCaptcha:so}=useCaptchaContext(),{mutate:co,isLoading:lo}=useMutation(fo=>__awaiter$j(void 0,void 0,void 0,function*(){var ho;if(!((ho=ro==null?void 0:ro.security.hCaptcha)===null||ho===void 0)&&ho.enabled){so({authMethod:"social",onCaptchaSuccess:go=>__awaiter$j(void 0,void 0,void 0,function*(){return io(fo),yield oo==null?void 0:oo.endSession(),oo==null?void 0:oo.connect(fo)})});return}return io(fo),yield oo==null?void 0:oo.endSession(),oo==null?void 0:oo.connect(fo)}));return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:co,providers:ao,selectedProvider:no,isLoading:lo,testId:"magic-social-sign-in",defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})},getProviderEnumForSocialSignInProvider=Xr=>{if(!Xr)return null;const eo=Object.values(ProviderEnum);for(const to of eo)if(to===Xr)return to;return null},DynamicSocialSignIn=({defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})=>{const{setShowAuthFlow:ro,projectSettings:no}=useInternalDynamicContext(),{setSocialProvider:io,socialProvider:oo,enabledSocialProviders:ao}=useSocialRedirectContext(),{setView:so,goToInitialView:co}=useViewContext(),{engageCaptcha:lo}=useCaptchaContext(),{isProcessing:fo,connectSocialAccount:ho}=useSocialAuth({onError:()=>{co()},onFarcasterUrl:yo=>so("farcaster-connect-view",{url:yo}),onSettled:()=>{io(void 0)},sessionTimeout:2e4}),go=yo=>{var vo;const wo=getProviderEnumForSocialSignInProvider(yo);if(io(yo),!((vo=no==null?void 0:no.security.hCaptcha)===null||vo===void 0)&&vo.enabled){lo({authMethod:"social",onCaptchaSuccess:Eo=>__awaiter$j(void 0,void 0,void 0,function*(){so("social-redirect-view"),ro(!0),ho({authMode:"signin",captchaToken:Eo,provider:wo})})});return}so("social-redirect-view"),ro(!0),ho({authMode:"signin",provider:wo})};return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:go,providers:ao,selectedProvider:oo,isLoading:fo,testId:"dynamic-social-sign-in",defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})},SocialSignInSection=({sectionData:Xr,collapsedLayout:eo})=>{var to,ro,no;const{projectSettings:io}=useInternalDynamicContext(),oo=(to=io==null?void 0:io.providers)!==null&&to!==void 0?to:[],ao={collapsedLayout:eo,defaultProvider:getSocialSignInProviderFromString(Xr.defaultItem),numOfItemsToDisplay:Xr.numOfItemsToDisplay};return isProviderEnabled(oo,ProviderEnum.MagicLink)&&((ro=io==null?void 0:io.sdk.socialSignIn)===null||ro===void 0?void 0:ro.signInProvider)===SignInProviderEnum.MagicLink?jsxRuntimeExports.jsx(MagicSocialSignIn,Object.assign({},ao)):((no=io==null?void 0:io.sdk.socialSignIn)===null||no===void 0?void 0:no.signInProvider)===SignInProviderEnum.Dynamic?jsxRuntimeExports.jsx(DynamicSocialSignIn,Object.assign({},ao)):(logger$8.error("Failed to render SocialSignInSection - no sign in provider enabled"),null)},ToggleableSection=({sections:Xr})=>{const[eo,to]=reactExports.useState(!0),ro=eo?Xr[0]:Xr[1];return jsxRuntimeExports.jsxs("div",{className:"toggleable-section",children:[ro.component,jsxRuntimeExports.jsxs("div",{className:"toggleable-section__toggle-prompt",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:ro.labelCopyKey,children:ro.label}),jsxRuntimeExports.jsx("button",{className:"toggleable-section__toggle-prompt__button",onClick:()=>to(!eo),children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_small",color:"brand-primary",className:"toggleable-section__toggle-prompt__button__text",copykey:ro.buttonCopyKey,children:ro.button})})]})]})},ListItemButton=({text:Xr,onClick:eo,numberOfWallets:to,disabled:ro=!1,copykey:no})=>{const io=reactExports.useMemo(()=>to<=10?to:`${Math.floor(to/10)*10}+`,[to]),oo=jsxRuntimeExports.jsxs("div",{className:"list-item-button__trailing",children:[jsxRuntimeExports.jsx("div",{className:classNames("list-item-button__trailing-child","list-item-button__trailing-label"),children:jsxRuntimeExports.jsx(Badge,{text:`${io} available`})}),jsxRuntimeExports.jsx("div",{className:classNames("list-item-button__trailing-child","list-item-button__trailing-icon"),children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",children:jsxRuntimeExports.jsx(SvgStroke,{})})})]});return jsxRuntimeExports.jsx(ListTile,{trailing:oo,onClick:eo,className:"list-item-button",disabled:ro,copykey:no,children:Xr})},WalletSimpleSignIn=({previewWalletsNumber:Xr,disabled:eo=!1,onshowAllWallets:to})=>{const{t:ro}=useTranslation(),{walletConnectorOptions:no,projectSettings:io,walletsFilter:oo,authMode:ao,multiWallet:so,recommendedWallets:co}=useInternalDynamicContext(),lo=useUserWallets(),{walletBook:fo}=useWalletBookContext(),{numberOfWallets:ho,walletsList:go}=walletListBuilder({authMode:ao,groupWallets:!0,inputList:no,isWalletConnectList:!1,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),loginWithEmail:!0,multiWallet:so,numberOfWalletsToShow:Xr,recommendedWallets:co,searchFilter:void 0,userWallets:lo,walletBook:fo,walletsFilter:oo});return io?jsxRuntimeExports.jsxs("div",{className:"login-with-email-wallet-list__container","data-testid":"top-wallets-list",children:[go.map((yo,vo)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:yo,disabled:eo,recommendedWallets:co},`${yo.key}_${vo}`)),jsxRuntimeExports.jsx(ListItemButton,{copykey:"dyn_wallet_list.view_all",text:ro("dyn_wallet_list.view_all"),onClick:to,numberOfWallets:ho,disabled:eo})]}):jsxRuntimeExports.jsx(Skeleton,{count:Xr+1,className:"login-with-email-wallet-list__skeleton"})},WalletSignInSection=({numberOfItensToShow:Xr,isLoading:eo,onSubmit:to})=>{const{t:ro}=useTranslation();return Xr>0?jsxRuntimeExports.jsx(WalletSimpleSignIn,{previewWalletsNumber:Xr,onshowAllWallets:()=>to==null?void 0:to(),disabled:eo}):jsxRuntimeExports.jsx(IconListTile,{onClick:()=>to==null?void 0:to(),disabled:eo,className:"connect-with-wallet-button",children:jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.wallet_list.button_only",children:ro("dyn_login.wallet_list.button_only")})})},LoginViewSection=({viewSection:Xr,index:eo,walletCount:to,gotToWalletList:ro})=>{const{loading:no}=useLoadingContext(),{t:io}=useTranslation(),{setView:oo}=useViewContext(),[ao,so]=reactExports.useState(no);switch(Xr.type){case SdkViewSectionType.Separator:return jsxRuntimeExports.jsx(Divider,{text:Xr.label});case SdkViewSectionType.Email:return jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao});case SdkViewSectionType.Phone:return jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao});case SdkViewSectionType.EmailAndPhone:const co=[{button:io("dyn_login.email_or_phone.use_phone"),buttonCopyKey:"dyn_login.email_or_phone.use_phone",component:jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao}),label:io("dyn_login.email_or_phone.prefer_phone"),labelCopyKey:"dyn_login.email_or_phone.prefer_phone"},{button:io("dyn_login.email_or_phone.use_email"),buttonCopyKey:"dyn_login.email_or_phone.use_email",component:jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao}),label:io("dyn_login.email_or_phone.prefer_email"),labelCopyKey:"dyn_login.email_or_phone.prefer_email"}];return Xr.defaultItem==="phone"&&co.reverse(),jsxRuntimeExports.jsx(ToggleableSection,{sections:co});case SdkViewSectionType.Wallet:return jsxRuntimeExports.jsx(WalletSignInSection,{numberOfItensToShow:Xr.numOfItemsToDisplay||0,onSubmit:()=>{oo("login-with-email-or-wallet-full-wallet-list"),ro()},isLoading:ao});case SdkViewSectionType.Social:return jsxRuntimeExports.jsx(SocialSignInSection,{collapsedLayout:to>1,sectionData:Xr});case SdkViewSectionType.Text:return Xr.label?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",align:Xr.alignment,className:"login-view__text","data-testid":"login-view-section__text",children:Xr.label}):null}},getWalletsSection=Xr=>({numOfItemsToDisplay:Xr,type:SdkViewSectionType.Wallet}),getSocialsSection=(Xr,eo)=>({defaultItem:eo,numOfItemsToDisplay:Xr,type:SdkViewSectionType.Social}),getSimpleSection=Xr=>({type:Xr}),getLoginViewStructure=({socialAboveEmail:Xr,showWallets:eo,web3Layout:to,numOfWalletsToDisplay:ro,showEmail:no,showPhone:io,showSocial:oo,splitEmailAndSocial:ao,defaultSocialItem:so})=>{const co=!ao&&(no||io),lo=ao?so:void 0;return[{condition:eo&&to,section:getWalletsSection(ro)},{condition:oo&&Xr,hideSeparator:co?"below":void 0,section:getSocialsSection(5,lo)},{condition:no&&!io,section:getSimpleSection(SdkViewSectionType.Email)},{condition:!no&&io,section:getSimpleSection(SdkViewSectionType.Phone)},{condition:no&&io,section:getSimpleSection(SdkViewSectionType.EmailAndPhone)},{condition:oo&&!Xr,hideSeparator:co?"above":void 0,section:getSocialsSection(5,lo)},{condition:eo&&!to,section:getWalletsSection(ro)}]},useViewSettings=Xr=>{var eo,to,ro;const{projectSettings:no,overrides:io}=useInternalDynamicContext(),oo=(to=(eo=no==null?void 0:no.sdk)===null||eo===void 0?void 0:eo.views)===null||to===void 0?void 0:to.find(so=>so.type===Xr);return((ro=io==null?void 0:io.views)===null||ro===void 0?void 0:ro.find(so=>so.type===Xr))||oo},NUMBER_OF_WALLETS=3,useLoginView=()=>{const Xr=useViewSettings(SdkViewType.Login),{projectSettings:eo,authorizationViewDisplayOrder:to,loginWithEmail:ro,walletConnectorOptions:no,walletsFilter:io}=useInternalDynamicContext(),{t:oo}=useTranslation(),{enabledSocialProviders:ao}=useSocialRedirectContext(),so=!!(ao!=null&&ao.length),co=isEmailProviderEnabled(eo==null?void 0:eo.providers),lo=isPhoneNumberProviderEnabled(eo==null?void 0:eo.providers),fo=(io?io(no):no).filter(({key:vo})=>vo!=="turnkey"),ho=reactExports.useMemo(()=>{var vo;return eo?!ro&&!lo&&!so?!0:!((vo=Xr==null?void 0:Xr.sections)===null||vo===void 0)&&vo.length?Xr.sections.length===1&&Xr.sections[0].type==="wallet":!co&&!lo&&!so:!1},[Xr==null?void 0:Xr.sections,eo,ro,so,lo,co]),go=reactExports.useCallback(vo=>{var wo;const Eo=Ao=>{var Po;return(Po=Ao.networks)===null||Po===void 0?void 0:Po.some(jo=>jo.enabled)};return!((wo=eo==null?void 0:eo.chains)===null||wo===void 0?void 0:wo.some(Ao=>Ao.enabled&&Eo(Ao)))&&vo.find(Ao=>Ao.type==="wallet")&&logger$8.error("Failed to render WalletSignInSection - no chains enabled"),fo!=null&&fo.length?vo:vo.filter(Ao=>Ao.type!=="wallet")},[fo==null?void 0:fo.length,eo==null?void 0:eo.chains]),yo=reactExports.useMemo(()=>{var vo,wo,Eo,ko,Ao,Po;if(!((vo=Xr==null?void 0:Xr.sections)===null||vo===void 0)&&vo.length)return go(Xr==null?void 0:Xr.sections);const{splitEmailAndSocial:jo=!1,socialAboveEmail:Mo=!1}=(wo=eo==null?void 0:eo.design.modal)!==null&&wo!==void 0?wo:{},No=[],Do=getLoginViewStructure({defaultSocialItem:ao[0],numOfWalletsToDisplay:!((ko=(Eo=eo==null?void 0:eo.design)===null||Eo===void 0?void 0:Eo.modal)===null||ko===void 0)&&ko.showWalletsButton?0:NUMBER_OF_WALLETS,showEmail:co,showPhone:lo,showSocial:!!(ao!=null&&ao.length),showWallets:!!(fo!=null&&fo.length)&&!(!((Po=(Ao=eo==null?void 0:eo.design)===null||Ao===void 0?void 0:Ao.modal)===null||Po===void 0)&&Po.emailOnly),socialAboveEmail:Mo,splitEmailAndSocial:jo,web3Layout:to==="web3"}),Fo={label:oo("dyn_login.separators.default"),type:SdkViewSectionType.Separator};let Xo=!1;for(const Lo of Do)Lo.condition&&(No.length>0&&!Xo&&Lo.hideSeparator!=="above"&&No.push(Fo),No.push(Lo.section),Xo=Lo.hideSeparator==="below");return No},[to,ao,go,co,lo,Xr==null?void 0:Xr.sections,eo==null?void 0:eo.design.modal,fo==null?void 0:fo.length,oo]);return{isWalletOnly:ho,loginViewSections:yo}},showFarcasterQrCodeView=(Xr,eo)=>Xr.length===1&&Xr[0].type===SdkViewSectionType.Social&&eo.length===1&&eo.includes(SocialSignInProviderEnum.Farcaster)&&!isMobile$1(),LoginView=()=>{var Xr;const{error:eo}=useErrorContext(),{setView:to}=useViewContext(),{isWalletOnly:ro,loginViewSections:no}=useLoginView(),{enabledSocialProviders:io}=useSocialRedirectContext(),{showDefaultFooter:oo}=useAuthLayoutChecks(),ao=((Xr=no.find(fo=>fo.type===SdkViewSectionType.Wallet))===null||Xr===void 0?void 0:Xr.numOfItemsToDisplay)||0,so=reactExports.useMemo(()=>no.map((fo,ho)=>jsxRuntimeExports.jsx("div",{className:classNames("login-view__scroll__section",`login-view__scroll__section--${fo.type}`),children:jsxRuntimeExports.jsx(LoginViewSection,{gotToWalletList:()=>to("login-with-email-or-wallet-full-wallet-list"),index:ho,viewSection:fo,walletCount:ao})},`${fo.type}__${ho}`)),[no,ao]),co=eo&&jsxRuntimeExports.jsx(ErrorContainer,{className:"login-view__error-container",withIcon:!1,children:eo});if(showFarcasterQrCodeView(no,io))return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[co,jsxRuntimeExports.jsx(FarcasterQrCodeView,{})]});if(ro)return jsxRuntimeExports.jsx(WalletList,{});const lo=isMobile$1()&&oo;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[co,jsxRuntimeExports.jsx("div",{className:classNames("login-view__container",{"login-view__container--error":!!eo}),children:jsxRuntimeExports.jsx("div",{className:"login-view__scroll","data-testid":"login-view-scroll",children:so})}),lo&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!0})]})},useMergeUserAccounts=()=>{const{environmentId:Xr,setShowAuthFlow:eo,selectedWalletConnector:to}=useInternalDynamicContext(),{addedWalletsIds:ro}=useInternalUserWallets();return{mergeUserAccounts:io=>__awaiter$j(void 0,void 0,void 0,function*(){const ao=(yield verifyMergeUsers(Xr,io)).lastVerifiedCredentialId;ao&&ro.current.push(ao);const so=yield to==null?void 0:to.getConnectedAccounts();so!=null&&so.length&&dynamicEvents.emit("triggerComputePrimaryWalletMultiWalletStateFromAccounts",{accounts:so}),eo(!1)})}},RadioButton=({children:Xr,checked:eo,value:to,name:ro,disabled:no=!1,className:io="",onChange:oo})=>{const ao=`${ro}_${to}`;return jsxRuntimeExports.jsxs("div",{className:classNames("radio-button",io),children:[jsxRuntimeExports.jsx("input",{type:"radio",id:ao,name:ro,value:to,disabled:no,defaultChecked:eo,onChange:oo}),jsxRuntimeExports.jsx("label",{htmlFor:ao,children:Xr})]})},MergeUserAccountsConflictsView=({mergeConflicts:Xr})=>{const{mergeUserAccounts:eo}=useMergeUserAccounts(),{t:to}=useTranslation(),[ro,no]=reactExports.useState(""),io=reactExports.useRef(Object.fromEntries(Xr.map(({field:so,currentUser:co})=>[`${so.name}_${so.type}`,{fieldKey:so.name,type:so.type||KycFieldType.Standard,userId:co.userId}]))),oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){const so=Object.values(io.current).map(({fieldKey:co,type:lo,userId:fo})=>({fieldKey:co,type:lo,userId:fo}));try{yield eo(so)}catch(co){logger$8.error("Error merging user accounts",co),no(to("dyn_merge_user_accounts_conflicts.errors.merge_error"))}});if(!(Xr!=null&&Xr.length))return null;const ao=(so,co,lo,fo)=>{no(""),fo&&(io.current[`${so}_${co}`]={fieldKey:so,type:co||KycFieldType.Standard,userId:lo})};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__container",children:[ro&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts-conflicts__error",children:ro}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_merge_user_accounts_conflicts.description",children:to("dyn_merge_user_accounts_conflicts.description")})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__fields",children:Xr.map(({field:so,currentUser:co,fromUser:lo})=>{var fo;return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__fields__item",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts-conflicts__fields__item__name",children:(fo=so.label)!==null&&fo!==void 0?fo:capitalize$1(so.name)}),jsxRuntimeExports.jsx(RadioButton,{name:so.name,value:co.value,checked:!0,className:"merge-user-accounts-conflicts__fields__item__button",onChange:ho=>ao(so.name,so.type,co.userId,ho.target.checked),children:co.value}),jsxRuntimeExports.jsx(RadioButton,{name:so.name,value:lo.value,className:"merge-user-accounts-conflicts__fields__item__button",onChange:ho=>ao(so.name,so.type,lo.userId,ho.target.checked),children:lo.value})]},so.name)})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__buttons",children:jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-conflicts__buttons__button",onClick:oo,buttonVariant:"primary",buttonPadding:"large",expanded:!0,copykey:"dyn_merge_user_accounts_conflicts.confirm_button",children:to("dyn_merge_user_accounts_conflicts.confirm_button")})})]})},MergeUserAccountsView=Xr=>{const{setView:eo}=useViewContext(),{mergeUserAccounts:to}=useMergeUserAccounts(),{t:ro}=useTranslation(),[no,io]=reactExports.useState(""),{mergeConflicts:oo}=Xr,ao=()=>{const co=()=>{eo("merge-user-accounts",Xr)};eo("merge-user-accounts-conflicts",{mergeConflicts:(oo==null?void 0:oo.conflicts)||[]},{onBackClick:co})},so=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(oo!=null&&oo.conflicts.length){ao();return}try{yield to([])}catch(co){logger$8.error("Error merging user accounts",co),io(ro("dyn_merge_user_accounts.errors.merge_error"))}});return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts",children:[no&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts__error",children:no}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts__container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts__title",copykey:"dyn_merge_user_accounts.wallet.content",children:ro("dyn_merge_user_accounts.wallet.content")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:so,buttonClassName:"merge-user-accounts__button",buttonVariant:"brand-primary",buttonPadding:"large",typographyProps:{color:"inherit"},expanded:!0,copykey:"dyn_merge_user_accounts.confirm_button",children:ro("dyn_merge_user_accounts.confirm_button")})]})]})};var _path$a,_excluded$e=["title","titleId"];function _extends$g(){return _extends$g=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$e(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDoubleArrowRight=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$e(eo,_excluded$e);return reactExports.createElement("svg",_extends$g({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$a||(_path$a=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",fill:"currentColor"})))};const MergeUserAccountsWithSameEmailView=({returnToView:Xr})=>{const{environmentId:eo,setShowAuthFlow:to,setCallback:ro,primaryWallet:no,user:io}=useInternalDynamicContext(),oo=useHandleAuthenticatedUser(),{t:ao}=useTranslation(),{setError:so}=useErrorContext(),{setView:co,goToInitialView:lo}=useViewContext(),{displayedDestination:fo}=useVerification(),ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{const yo=yield mergeUserAccounts(eo);if(!yo)throw new DynamicError("Something went wrong, please try again.");yield oo(yo),to(!1),ro("authSuccess")}catch{if(so(ao("dyn_merge_user_accounts_with_same_email.errors.merge_error")),io){to(!1,{emitCancelAuth:!0});return}lo()}}),go=()=>{if(so(void 0),Xr){co(Xr);return}if(io){to(!1);return}co("collect-user-data")};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__container",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:no==null?void 0:no.connector.key,className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenWalletAddress(no==null?void 0:no.address,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-with-same-email__accounts__divider",children:jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgDoubleArrowRight,{})})}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenEmail(fo,{breakpoint:4,cutEnd:1,cutStart:2})})]})]}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"title",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__header",copykey:"dyn_merge_user_accounts_with_same_email.title",children:ao("dyn_merge_user_accounts_with_same_email.title")}),jsxRuntimeExports.jsxs(Typography,{weight:"medium",variant:"body_normal",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__body",copykey:"dyn_merge_user_accounts_with_same_email.existing_account",children:[ao("dyn_merge_user_accounts_with_same_email.existing_account")," ",jsxRuntimeExports.jsx("span",{className:"merge-user-accounts-with-same-email__text--bold",children:shortenEmail(fo,{breakpoint:14})})," ",ao("dyn_merge_user_accounts_with_same_email.existing_account_trail")]}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__buttons",children:[jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:ho,buttonVariant:"primary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.confirm_button",children:ao("dyn_merge_user_accounts_with_same_email.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:go,buttonVariant:"secondary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.cancel_button",children:ao("dyn_merge_user_accounts_with_same_email.cancel_button")})]})]})};var _path$9,_path2$1,_path3$1,_path4,_g$5,_path5,_defs$5,_excluded$d=["title","titleId"];function _extends$f(){return _extends$f=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$d(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSecureAccount=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$d(eo,_excluded$d);return reactExports.createElement("svg",_extends$f({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("mask",{id:"secure-account_svg__a",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$9||(_path$9=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__a)"},_path2$1||(_path2$1=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#secure-account_svg__b)",fillOpacity:.12})),reactExports.createElement("mask",{id:"secure-account_svg__c",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$1||(_path3$1=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__c)"},reactExports.createElement("mask",{id:"secure-account_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4||(_path4=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.825-10.139-12.468-17.963-10.371-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.825 10.139 12.468 17.963 10.371 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$5||(_g$5=reactExports.createElement("g",{mask:"url(#secure-account_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.825 2.096-12.468 10.138-10.371 17.962a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.847 5.5 5.5 0 0 1-10.625 2.847Z",fill:"#4779FF"})))),_path5||(_path5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$5||(_defs$5=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"secure-account_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const useIsLoggedIn=()=>{var Xr,eo,to;const{user:ro,primaryWallet:no,authMode:io,projectSettings:oo}=useInternalDynamicContext(),{getEOAWallet:ao}=useSmartWallets(),so=no&&ao(no),co=no&&isSessionKeyCompatibleWallet(no)||so&&isSessionKeyCompatibleWallet(so),lo=isTurnkeyEnabled(oo),fo=!!ro||io==="connect-only"&&!!no,ho=(Xr=ro==null?void 0:ro.verifiedCredentials)===null||Xr===void 0?void 0:Xr.filter(({walletProvider:wo})=>wo),go=!!(ho!=null&&ho.find(({walletProvider:wo})=>wo==="embeddedWallet")),vo=lo&&((to=(eo=oo==null?void 0:oo.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.automaticEmbeddedWalletCreation)&&(!(oo!=null&&oo.sdk.embeddedWallets.forceAuthenticatorAtSignup)||co)&&(!(ho!=null&&ho.length)||go);return logger$8.logVerboseTroubleshootingMessage("useIsLoggedIn",{authMode:io,eoaWallet:so,isSessionKeyCompatible:co,isTurnkeyProviderEnabled:lo,primaryWallet:no,projectSettings:oo,user:ro}),vo?!!(no&&fo):fo},useOverrides=Xr=>{const eo=reactExports.useRef(Xr),to=useIsLoggedIn();return eo.current=Xr,reactExports.useMemo(()=>({setAuthMode:ro=>{const{setAuthMode:no}=eo.current;if(to){logger$8.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");return}return no(ro)}}),[to])},useDynamicContext=()=>{const Xr=reactExports.useContext(DynamicContext);if(Xr===void 0)throw new Error("useDynamicContext must be used within a DynamicContextProvider");const{accountSwitchState:eo,authMode:to,authToken:ro,awaitingSignatureState:no,getNameService:io,handleLogOut:oo,handleUnlinkWallet:ao,loadingNetwork:so,locale:co,loginWithEmail:lo,multiWalletWidgetState:fo,network:ho,networkConfigurations:go,qrcodeUri:yo,sdkHasLoaded:vo,setLogInWithEmail:wo,setMultiWalletWidgetState:Eo,setShowAuthFlow:ko,setShowDynamicUserProfile:Ao,setShowQrcodeModal:Po,shadowDOMEnabled:jo,showAuthFlow:Mo,showQrcodeModal:No,user:Do,userWithMissingInfo:Fo,bridgeChains:Xo,bridgeChainsToConnect:Lo,primaryWallet:Bo,setShowBridgeWidget:xo,sendWagmiSettings:uo,showDynamicUserProfile:po,minAuthToken:bo,selectedTabIndex:_o,setSelectedTabIndex:$o}=Xr,{setAuthMode:Co}=useOverrides(Xr);return{accountSwitchState:eo,authMode:to,authToken:ro,awaitingSignatureState:no,bridgeChains:Xo,bridgeChainsToConnect:Lo,getNameService:io,handleLogOut:oo,handleUnlinkWallet:ao,loadingNetwork:so,locale:co,loginWithEmail:lo,minAuthToken:bo,multiWalletWidgetState:fo,network:ho,networkConfigurations:go,primaryWallet:Bo,qrcodeUri:yo,sdkHasLoaded:vo,selectedTabIndex:_o,sendWagmiSettings:uo,setAuthMode:Co,setLogInWithEmail:wo,setMultiWalletWidgetState:Eo,setSelectedTabIndex:$o,setShowAuthFlow:Ro=>ko(Ro,{clearErrors:!0,emitCancelAuth:!0,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!0}),setShowBridgeWidget:xo,setShowDynamicUserProfile:Ao,setShowQrcodeModal:Po,shadowDOMEnabled:jo,showAuthFlow:Mo,showDynamicUserProfile:po,showQrcodeModal:No,user:Do,userWithMissingInfo:Fo}},getMfaOptions=Xr=>{const eo=[{Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.authenticator_app_description",labelKey:"dyn_mfa.choose_device_view.authenticator_app",type:MFADeviceType.Totp}];if(!Xr){const to={Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.backup_code_description",labelKey:"dyn_mfa.choose_device_view.backup_code",type:"backupCode"};eo.push(to)}return eo},MfaChooseDeviceView=({isInitialSetup:Xr=!0})=>{const{handleLogOut:eo}=useDynamicContext(),{t:to}=useTranslation(),{setView:ro}=useViewContext(),no=getMfaOptions(Xr),io=oo=>{if(oo.type==="backupCode"){ro("mfa-recovery",void 0,{onBackClick:()=>{ro("mfa-choose-device",{isInitialSetup:!1})}});return}if(Xr){ro("mfa-secure-device",{type:oo.type});return}ro("mfa-verification",{isInitialSetup:Xr,showBackButton:!0,type:oo.type})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",children:to(Xr?"dyn_mfa.choose_device_view.title":"dyn_mfa.choose_device_view.choose_another_method")})})}),jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__body","data-testid":"mfa-choose-device-view",children:[jsxRuntimeExports.jsx(SvgSecureAccount,{}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:to(Xr?"dyn_mfa.choose_device_view.select_options":"dyn_mfa.choose_device_view.choose_another_method_description")}),no.map(oo=>jsxRuntimeExports.jsxs(Button,{buttonClassName:"mfa-choose-device-view__button",expanded:!0,onClick:()=>io(oo),children:[jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__button__header",children:[jsxRuntimeExports.jsx(Typography,{copykey:oo.labelKey,color:"primary",children:to(oo.labelKey)}),jsxRuntimeExports.jsx(SvgChevronLeft,{className:"mfa-choose-device-view__icon--rotate"})]}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__button__description",color:"secondary",copykey:oo.descriptionKey,children:to(oo.descriptionKey)})]},oo.type)),jsxRuntimeExports.jsx(TextButton,{className:"mfa-choose-device-view__logout",onClick:eo,copykey:"dyn_mfa.choose_device_view.logout",children:to("dyn_mfa.choose_device_view.logout")})]})]})},getUserMfaDevices=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{devices:to}=yield sdkApi$1().getUserMfaDevices({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),addMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to}){try{if(to===MFADeviceType.Totp)return yield sdkApi$1().registerTotpMfaDevice({environmentId:eo});throw new Error("Unsupported MFA device type")}catch(ro){const no=ro instanceof Error?ro.message:(yield ro.json()).error;throw logger$8.error(no),new Error(no)}}),updateUserMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,mfaDeviceId:to}){try{yield sdkApi$1().updateUserMfaDevice({environmentId:eo,mfaDeviceId:to})}catch(ro){const no=yield ro.json();logger$8.error(no.error)}}),deleteMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,mfaDeviceId:to,mfaAuthToken:ro}){try{yield sdkApi$1().deleteMfaDevice({environmentId:eo,mfaDeviceId:to,xMfaAuthToken:ro})}catch(no){const io=yield no.json();logger$8.error(io.error)}}),verifyMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to,code:ro}){try{if(to===MFADeviceType.Totp){const no={code:ro,type:to};return yield sdkApi$1().registerTotpMfaDeviceVerify({environmentId:eo,mFARegisterTotpDevicePostRequest:no})}throw new Error("Unsupported MFA device type")}catch(no){const io=no instanceof Error?no.message:(yield no.json()).error;logger$8.error(io);return}}),authMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({deviceId:eo,environmentId:to,type:ro,code:no,createMfaToken:io}){try{if(ro===MFADeviceType.Totp){const oo={code:no,createMfaToken:io,id:eo||void 0};return yield sdkApi$1().authMfaTotpDevice({environmentId:to,mFAAuthTotpDevicePostRequest:oo})}throw new Error("Unsupported MFA device type")}catch(oo){if(logger$8.error(oo),oo instanceof Response){const ao=yield oo.json();if(ao.code==="mfa_invalid_code")throw new MfaInvalidOtpError;if(ao.code==="mfa_rate_limited")throw new MfaRateLimitedError}throw oo}}),getRecoveryCodes=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{recoveryCodes:to}=yield sdkApi$1().getRecoveryCodes({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),createNewRecoveryCodes=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{recoveryCodes:to}=yield sdkApi$1().createNewRecoveryCodes({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),authMfaRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,code:to}){try{const ro={code:to};return yield sdkApi$1().authMfaRecovery({environmentId:eo,mFAAuthRecoveryDevicePostRequest:ro})}catch(ro){throw logger$8.error(ro),ro instanceof Response&&(yield ro.json()).code==="mfa_invalid_code"?new MfaInvalidOtpError:ro}}),useMfa=()=>{const{completeAuth:Xr}=useUserAuth({}),{user:eo,userWithMissingInfo:to,environmentId:ro}=useInternalDynamicContext(),no=eo||to,io=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);return yield getUserMfaDevices({environmentId:ro})}),oo=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);yield updateUserMfaDevice({environmentId:ro,mfaDeviceId:vo})}),ao=(vo,wo)=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);yield deleteMfaDevice({environmentId:ro,mfaAuthToken:wo,mfaDeviceId:vo})}),so=(...vo)=>__awaiter$j(void 0,[...vo],void 0,function*(wo=MFADeviceType.Totp){if(!no)throw new Error(USER_NOT_LOGGED_IN);const{id:Eo,secret:ko,uri:Ao}=yield addMfaDevice({environmentId:ro,type:wo});return{id:Eo,secret:ko,uri:Ao}}),co=(vo,...wo)=>__awaiter$j(void 0,[vo,...wo],void 0,function*(Eo,ko=MFADeviceType.Totp,Ao){try{if(!no)throw new Error(USER_NOT_LOGGED_IN);let Po=!1;return yield Xr({onValidUpdatedJwt:()=>__awaiter$j(void 0,void 0,void 0,function*(){Po=!0}),updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){const jo=yield authMfaDevice({code:Eo,createMfaToken:{singleUse:!0},deviceId:Ao,environmentId:ro,type:ko});return dynamicEvents.emit("mfaCompletionSuccess",{mfaToken:jo.mfaToken}),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:jo}})}),Po}catch(Po){throw dynamicEvents.emit("mfaCompletionFailure",{error:Po}),Po}}),lo=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);let wo=!1;return yield Xr({onValidUpdatedJwt:()=>__awaiter$j(void 0,void 0,void 0,function*(){wo=!0}),updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){const Eo=yield authMfaRecovery({code:vo,environmentId:ro});if(!Eo)throw new Error("Failed to authenticate recovey code");return{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:Eo}})}),wo}),fo=(vo,...wo)=>__awaiter$j(void 0,[vo,...wo],void 0,function*(Eo,ko=MFADeviceType.Totp){if(!no)throw new Error(USER_NOT_LOGGED_IN);const Ao=yield verifyMfaDevice({code:Eo,environmentId:ro,type:ko});if(!Ao)throw new Error("Failed to verify device");return Ao}),ho=(...vo)=>__awaiter$j(void 0,[...vo],void 0,function*(wo=!1){if(!no)throw new Error(USER_NOT_LOGGED_IN);const ko=yield(wo?createNewRecoveryCodes:getRecoveryCodes)({environmentId:ro});if(!ko)throw new Error("Recovery codes not found");return ko}),{updateUser:go}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1});return{addDevice:so,authDevice:co,authRecoveryCode:lo,completeAcknowledgement:()=>__awaiter$j(void 0,void 0,void 0,function*(){yield go({mfaBackupCodeAcknowledgement:MfaBackupCodeAcknowledgement.Complete})}),deleteUserDevice:ao,getRecoveryCodes:ho,getUserDevices:io,updateUserDevice:oo,verifyDevice:fo}},MfaDisplayBackupCodesView=({regenerateCodes:Xr=!1})=>{const{setShowAuthFlow:eo}=useInternalDynamicContext(),[to,ro]=reactExports.useState(!1),{t:no}=useTranslation(),{getRecoveryCodes:io,completeAcknowledgement:oo}=useMfa(),{data:ao,isLoading:so}=usePromise(()=>io(Xr)),co=(ao||[]).join(` -`),lo=()=>__awaiter$j(void 0,void 0,void 0,function*(){eo(!1),yield oo()});return jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__body","data-testid":"mfa-display-backup-codes-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-display-backup-codes-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:no("dyn_mfa.display_backup_codes_view.body")}),jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_mfa.display_backup_codes_view.warning",className:"mfa-display-backup-codes-view__warning",children:no("dyn_mfa.display_backup_codes_view.warning")}),so?jsxRuntimeExports.jsx(Spinner$1,{className:"mfa-display-backup-codes-view__loading-spinner"}):jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__codes",children:[ao==null?void 0:ao.map((fo,ho)=>jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"mfa-display-backup-codes-view__code",children:fo},ho)),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__actions",children:[jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:co,copykey:"dyn_mfa.display_backup_codes_view.copy_all",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgCopy,{})}),children:no("dyn_mfa.display_backup_codes_view.copy_all")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"download-button",buttonPadding:"small",buttonVariant:"primary",onClick:fo=>{fo.preventDefault(),downloadFile("mfa-backup-codes.txt",co)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.download",children:no("dyn_mfa.display_backup_codes_view.download")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__complete",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"mfa-display-backup-codes-view__acknowledgement",dataTestId:"ack-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>ro(!to),startSlot:jsxRuntimeExports.jsx(Checkbox,{checked:to,onChange:()=>{ro(!to)},className:"mfa-display-backup-codes-view__acknowledgement__checkbox"}),expanded:!0,typographyProps:{color:"secondary"},copykey:"dyn_mfa.display_backup_codes_view.checkbox",children:no("dyn_mfa.display_backup_codes_view.checkbox")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"complete-button",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!to,expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.complete",onClick:lo,children:no("dyn_mfa.display_backup_codes_view.complete")})]})]})},isValidMfaRecoveryCode=Xr=>/^[a-zA-Z0-9]{10}$/.test(Xr);var _path$8,_excluded$c=["title","titleId"];function _extends$e(){return _extends$e=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$c(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMfaRecoveryIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$c(eo,_excluded$c);return reactExports.createElement("svg",_extends$e({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$8||(_path$8=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-9.322-18.117a1.828 1.828 0 1 0 3.613.568l1.152-7.457h7.144l-1.1 6.89a1.828 1.828 0 1 0 3.612.567l1.153-7.457h3.504a1.691 1.691 0 0 0 0-3.383h-2.948l1.16-7.222h3.597a1.691 1.691 0 0 0 0-3.383h-3.087l1.1-6.89a1.829 1.829 0 1 0-3.612-.567l-1.153 7.457H30.17l1.1-6.89a1.828 1.828 0 1 0-3.613-.567l-1.152 7.457h-3.458a1.691 1.691 0 0 0 0 3.383h2.901l-1.16 7.222h-3.597a1.691 1.691 0 0 0 0 3.383h3.087l-1.1 6.89Zm12.42-10.272H28.5l1.16-7.222h7.097l-1.16 7.222Z",fill:"#4779FF"})))};const MfaRecoveryScreenIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgMfaRecoveryIcon,Object.assign({},Xr,{"data-testid":"mfa-recovery-icon"}))}),MfaRecoveryView=()=>{var Xr;const{t:eo}=useTranslation(),{projectSettings:to}=useInternalDynamicContext(),{authRecoveryCode:ro}=useMfa(),[no,io]=reactExports.useState(""),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(""),lo=(Xr=to==null?void 0:to.general)===null||Xr===void 0?void 0:Xr.supportEmail,fo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(no)try{ao(!0),yield ro(no)}catch(go){co(go.message||"Something went wrong")}finally{ao(!1)}}),ho=go=>{const yo=go.target.value;io(yo),co("")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[so&&jsxRuntimeExports.jsx(ErrorContainer,{children:so}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:MfaRecoveryScreenIcon,isSpinning:oo,iconSize:96}),jsxRuntimeExports.jsx("div",{className:"mfa-recovery-view__body",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:eo("dyn_mfa.recovery_view.body")})}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__actions",children:[jsxRuntimeExports.jsx(Input,{id:"mfa-recovery-input","data-testid":"mfa-recovery-input",label:eo("dyn_mfa.recovery_view.input_label"),onChange:ho,value:no}),jsxRuntimeExports.jsx(Button,{expanded:!0,buttonVariant:"brand-primary",disabled:oo||!isValidMfaRecoveryCode(no),onClick:fo,dataTestId:"mfa-recovery-submit",children:jsxRuntimeExports.jsx(Typography,{children:eo("dyn_mfa.recovery_view.button_label")})})]}),lo&&jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__get-help",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:eo("dyn_mfa.recovery_view.get_help.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${lo}`,children:eo("dyn_mfa.recovery_view.get_help.button_label")})})]})]})]})},MfaSecureDeviceHelper=({uri:Xr,secret:eo})=>{const{t:to}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__setup-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"1"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.step1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:to("dyn_mfa.secure_device_view.helper.step1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"2"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.step2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:to("dyn_mfa.secure_device_view.helper.step2.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:eo}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:eo,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-secret",onClick:ro=>{ro.preventDefault()}})})]})]}),jsxRuntimeExports.jsx(Divider,{text:"OR"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step",children:jsxRuntimeExports.jsxs("div",{className:"uri-section",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.uri.title")}),jsxRuntimeExports.jsx(Typography,{className:"uri-subtext",variant:"body_small",children:to("dyn_mfa.secure_device_view.helper.uri.description")})]})}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:Xr}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:Xr,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-uri",onClick:ro=>{ro.preventDefault()}})})]})]})]})})})},MfaSecureDeviceView=({type:Xr,isInitialSetup:eo=!1})=>{const{t:to}=useTranslation(),{handleLogOut:ro}=useDynamicContext(),{setView:no}=useViewContext(),{addDevice:io}=useMfa(),{data:oo,isLoading:ao}=usePromise(()=>io(Xr)),so=()=>{const lo=()=>{no("mfa-secure-device",{type:Xr})};no("mfa-verification",{deviceId:oo==null?void 0:oo.id,isInitialSetup:eo,showBackButton:!0,type:Xr},{onBackClick:lo})},co=({secret:lo,uri:fo})=>{no("mfa-secure-device-help",{secret:lo,uri:fo},{onBackClick:()=>{no("mfa-secure-device",{isInitialSetup:eo,type:Xr})}})};return jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__body","data-testid":"mfa-secure-device-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-secure-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:to("dyn_mfa.secure_device_view.body")}),ao&&jsxRuntimeExports.jsx(Spinner$1,{className:"mfa-secure-device-view__loading-spinner"}),oo&&jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__qrcode",children:[jsxRuntimeExports.jsx(QRCode,{Icon:jsxRuntimeExports.jsx(SvgPasswordHero,{}),value:oo.uri,logoSize:50}),jsxRuntimeExports.jsx("div",{className:"button-container",children:jsxRuntimeExports.jsx("button",{onClick:()=>co({secret:oo.secret,uri:oo.uri}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",children:to("dyn_mfa.secure_device_view.helper.button")})})})]}),jsxRuntimeExports.jsx(TypographyButton,{className:"mfa-secure-device-view__button",expanded:!0,onClick:so,children:to("dyn_mfa.secure_device_view.continue")}),jsxRuntimeExports.jsx(TextButton,{className:"mfa-secure-device-view__logout-button",onClick:ro,copykey:"dyn_mfa.choose_device_view.logout",children:to("dyn_mfa.secure_device_view.logout")})]})},MfaVerificationView=({type:Xr,isInitialSetup:eo=!1,showBackButton:to=!1,deviceId:ro})=>{const{t:no}=useTranslation(),{setView:io}=useViewContext(),{authDevice:oo}=useMfa(),[ao,so]=reactExports.useState(""),[co,lo]=reactExports.useState(),[fo,ho]=reactExports.useState(!1),{data:go,isLoading:yo}=usePromise(()=>oo(ao,Xr,ro),{deps:[ao],enabled:(ao==null?void 0:ao.length)===6,initialData:!1,onReject:ko=>{ko instanceof MfaRateLimitedError?(ho(!0),lo(new DynamicError(no("dyn_mfa.otp_verification_view.rate_limit_error")))):lo(new DynamicError(no("dyn_mfa.otp_verification_view.error")))},onResolve:()=>__awaiter$j(void 0,void 0,void 0,function*(){const ko=getUser();(ko==null?void 0:ko.mfaBackupCodeAcknowledgement)!==MfaBackupCodeAcknowledgement.Complete&&io("mfa-display-backup-codes")})}),vo=ko=>{lo(void 0),so(ko)},wo=ko=>{so(ko)},Eo=()=>{if(!eo){io("mfa-choose-device",{isInitialSetup:eo});return}io("mfa-secure-device",{isInitialSetup:eo,type:Xr})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:SvgPasswordHero,error:co,isLoading:yo,onPinComplete:wo,isValid:!!go,onPinChange:vo,description:no("dyn_mfa.otp_verification_view.body"),onClickBack:to?Eo:void 0,disabled:fo}),!eo&&jsxRuntimeExports.jsx("div",{className:"mfa-verification-view__choose-another-method",children:jsxRuntimeExports.jsx(TextButton,{className:"mfa-verification-view__choose-another-method-button",onClick:()=>io("mfa-choose-device",{isInitialSetup:eo}),copykey:"dyn_mfa.otp_verification_view.choose_another_method",children:no("dyn_mfa.otp_verification_view.choose_another_method")})})]})},MobileWalletRedirectView=({onRetry:Xr})=>{const{selectedWalletConnector:eo}=useInternalDynamicContext(),{walletBook:to}=useWalletBookContext(),{t:ro}=useTranslation(),{storeName:no,walletLink:io}=reactExports.useMemo(()=>{const so=eo&&getWalletLinks(to,eo.key);return so&&isIOS$1()?{storeName:"App Store",walletLink:so==null?void 0:so.ios}:so&&(isAndroid$1()||isSamsungBrowser())?{storeName:"Play Store",walletLink:so==null?void 0:so.android}:{storeName:void 0,walletLink:void 0}},[eo,to]),oo=()=>io&&window.open(io,"_blank","noopener,noreferrer"),ao=so=>jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo==null?void 0:eo.key,style:{height:pixelToRem(so),width:pixelToRem(so)}});return jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ao(94*iconRatio),iconSize:94,isSpinning:!0,className:"mobile-wallet-redirect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"mobile-wallet-redirect__copy-text",copykey:"dyn_login.mobile_wallet_redirect.prompt",children:ro("dyn_login.mobile_wallet_redirect.prompt")}),jsxRuntimeExports.jsxs(TypographyButton,{buttonVariant:"brand-primary",typographyProps:{color:"white",variant:"button_secondary"},onClick:Xr,buttonPadding:"small",children:[ro("dyn_login.mobile_wallet_redirect.open_prompt")," ",eo==null?void 0:eo.name]}),jsxRuntimeExports.jsx(Alert,{variant:"info",className:"mobile-wallet-redirect__alert",icon:jsxRuntimeExports.jsx(SvgFooterInfoIcon,{}),children:ro("dyn_login.mobile_wallet_redirect.redirect_fail_message",{walletName:eo==null?void 0:eo.name})}),no&&jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app",onClick:oo,children:[jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[ao(26),jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"bold",children:[ro("dyn_login.mobile_wallet_redirect.get_app_prompt")," ",eo==null?void 0:eo.name]})]}),jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[jsxRuntimeExports.jsx(Typography,{className:"mobile-wallet-redirect__wallet-app__group__app-store",variant:"body_small",weight:"bold",color:"secondary",children:no}),jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgExternalLink,{})})]})]})]})},useWalletConnectorEvent=(Xr,eo,to)=>{const ro=reactExports.useRef(to);ro.current=to,reactExports.useEffect(()=>{if(!Xr)return;const no=Array.isArray(Xr)?Xr:[Xr];no.forEach(ao=>ao.initEventListener());const oo=Array.from(new Set(no)).map(ao=>{const so=(...co)=>{ro.current(...co,ao)};return ao.on(eo,so),()=>ao.off(eo,so)});return()=>oo.forEach(ao=>ao())},[Xr,eo])},useWalletConnectorNetwork=(Xr,{onChange:eo}={onChange:()=>{}})=>{const[to,ro]=reactExports.useState(),{isLoading:no}=usePromise(()=>Xr==null?void 0:Xr.getNetwork(),{deps:[Xr],onResolve:io=>{ro(io)}});return useWalletConnectorEvent(Xr||void 0,"chainChange",({chain:io})=>{const oo=(Xr==null?void 0:Xr.connectedChain)==="STARK"?io:parseInt(io);ro(oo),eo==null||eo(oo)}),useWalletConnectorEvent(Xr||void 0,"disconnect",()=>__awaiter$j(void 0,void 0,void 0,function*(){if((Xr==null?void 0:Xr.key)!=="argentx")return;const io=yield Xr.getNetwork();ro(io),eo==null||eo(io)})),{isLoading:no,network:to}},useNetworkNotSupported=()=>{const{selectedWalletConnector:Xr,setShowAuthFlow:eo,bridgeChainsToConnect:to,bridgeOnboardingCompleted:ro,isBridgeFlow:no,user:io,authMode:oo}=useInternalDynamicContext(),ao=useConnectAndSign({shouldCallCallback:!1,shouldUpdateWallets:!!(to!=null&&to.length)}),{network:so}=useWalletConnectorNetwork(Xr,{onChange:co=>{!Xr||!isSupportedNetwork({network:co,walletConnector:Xr})||ao({walletConnector:Xr}).then(()=>{!io&&oo==="connect-and-sign"||(!no||ro||!(to!=null&&to.length))&&eo(!1)})}});return{currentNetwork:so}},UserAddress=({userProfile:Xr,walletConnector:eo})=>{var to;const ro=(to=Xr==null?void 0:Xr.verifiedCredentials.find(oo=>oo.id===Xr.lastVerifiedCredentialId))===null||to===void 0?void 0:to.address,no=useFetchNameService(ro),{data:io}=usePromise(()=>eo==null?void 0:eo.getAddress(),{enabled:!Xr&&!!eo});return jsxRuntimeExports.jsxs("div",{className:"user-address__container",children:[jsxRuntimeExports.jsx(StatusDot,{variant:"green",containerClassName:"user-address__status-dot"}),no!=null&&no.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:no.name}),jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__seperator"}),jsxRuntimeExports.jsx(Typography,{variant:"numbers_medium",color:"secondary",className:"user-address",children:shortenWalletAddress(ro,3,3)})]}):jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:shortenWalletAddress(ro||io,4,4)})]})},SelectNetworkButton=({networkId:Xr,networkName:eo,networkIconUrl:to,onClick:ro})=>{const no=jsxRuntimeExports.jsx("img",{alt:eo,className:"select-network-button__icon",src:to});return jsxRuntimeExports.jsxs(TypographyButton,{dataTestId:"SelectNetworkButton",onClick:()=>ro(Xr),expanded:!0,className:"select-network-button",children:["Select",no,eo," network"]})},NetworkNotSupported=()=>{const{onboardingImageUrl:Xr,selectedWalletConnector:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),{currentNetwork:ro}=useNetworkNotSupported(),[no,io]=reactExports.useState(!1);if(!eo)return null;const oo=co=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield eo.switchNetwork({networkChainId:co})}catch(lo){logger$8.debug(lo)}}),ao=eo.evmNetworks||[],so=isSupportedNetwork({network:ro,walletConnector:eo});return jsxRuntimeExports.jsxs("div",{className:"network-not-supported","data-testid":"network-not-supported",children:[Xr&&jsxRuntimeExports.jsx("img",{className:"network-not-supported__main-img",src:Xr,alt:"onboarding"}),!so&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"info",withIcon:!1,className:"network-not-supported__error--not-supported",copykey:"dyn_network_not_supported.warning_message",children:to("dyn_network_not_supported.warning_message")}),jsxRuntimeExports.jsxs("div",{className:classNames("network-not-supported__content-container",{"network-not-supported__content-container--error":!so}),children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported__img-container",children:jsxRuntimeExports.jsx(WalletIcon,{style:{height:64,width:64},walletKey:eo.key})}),jsxRuntimeExports.jsx(UserAddress,{walletConnector:eo}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__network-container",children:ao.length>1&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:ro,evmNetworks:ao,connector:eo,isNetworkPickerOpen:no,setIsNetworkPickerOpen:io,showNetworkName:!0,buttonClassName:"network-not-supported__network-picker-button",mainClassName:"network-not-supported__network-picker"})}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__welcome-container",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_network_not_supported.subtitle",children:to("dyn_network_not_supported.subtitle")})}),ao.length===1&&jsxRuntimeExports.jsx(SelectNetworkButton,{onClick:oo,networkId:ao[0].networkId,networkName:ao[0].vanityName||ao[0].name,networkIconUrl:ao[0].iconUrls[0]})]})]})},NetworkNotSupportedSwitchManual=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext();useNetworkNotSupported();const{t:eo}=useTranslation(),to=80,ro=jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr==null?void 0:Xr.key,style:{height:pixelToRem(to*iconRatio),width:pixelToRem(to*iconRatio)}}),no=getWalletConnectorNetworks(Xr),io=()=>(Xr==null?void 0:Xr.key)==="metamaskstarknet"?"dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet":no.length?"dyn_network_not_supported_manual_switch.subtitle_network_defined":"dyn_network_not_supported_manual_switch.subtitle_no_network_defined",oo=()=>(Xr==null?void 0:Xr.key)==="metamaskstarknet"?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[eo("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet",{network:no[0].name}),jsxRuntimeExports.jsxs("a",{href:"https://snaps.consensys.io/starknet",target:"_blank",rel:"noreferrer",children:[" ",eo("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet_companion_app")," ",jsxRuntimeExports.jsx(SvgExternalLink,{style:{display:"inline-block"}})]})]}):no.length?eo("dyn_network_not_supported_manual_switch.subtitle_network_defined",{network:no[0].name}):eo("dyn_network_not_supported_manual_switch.subtitle_no_network_defined");return jsxRuntimeExports.jsxs("div",{"data-testid":"network-not-supported",className:"network-not-supported-switch-manual",children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__img-container",children:jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__network-container",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:to,isSpinning:!0})})}),jsxRuntimeExports.jsxs("div",{className:"network-not-supported-switch-manual__content",children:[jsxRuntimeExports.jsx(Typography,{className:"network-not-supported-switch-manual__title",weight:"medium",variant:"title",color:"primary",copykey:"dyn_network_not_supported_manual_switch.title",children:eo("dyn_network_not_supported_manual_switch.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:io(),children:oo()})]})]})},socialNetworkIconMap={discord:DiscordIcon,helpdesk:HelpdeskIcon,slack:SlackIcon,twitter:TwitterIcon},getSocialNetworkIcon=Xr=>socialNetworkIconMap[Xr],useNoAccessText=()=>{const{socialMediaLinkText:Xr,socialMediaUrl:eo,accessDeniedMessagePrimary:to,accessDeniedMessageSecondary:ro}=useInternalDynamicContext(),{view:no}=useViewContext(),{t:io}=useTranslation(),oo=no.type==="chainalysis-blocked-wallet",ao=no.type==="gate-blocked-wallet",so=no.type==="no-access",co=()=>{if(oo)return io(textData.chainalysis._socialMediaLinkText);if(!ao)return Xr},lo=()=>{if(oo)return io(textData.chainalysis._socialMediaUrl);if(!ao)return eo},fo=()=>oo?io(textData.chainalysis.title):ao?io(textData.gate.title):to||io(textData.default.title),ho=()=>oo?io(textData.chainalysis.subtitle):ao?io(textData.gate.subtitle):ro||io(textData.default.subtitle),go=()=>io(oo?textData.chainalysis.buttonTitle:ao?textData.gate.buttonTitle:textData.default.buttonTitle);return{_socialMediaLinkText:co(),_socialMediaUrl:lo(),buttonTitle:go(),isAccessListView:so,isChainalysisView:oo,isGateBlockedView:ao,subtitle:ho(),title:fo()}},textData={chainalysis:{_socialMediaLinkText:"dyn_no_access.chainalysis.social_media_link_text",_socialMediaUrl:"dyn_no_access.chainalysis.social_media_link_url",buttonTitle:"dyn_no_access.chainalysis.button_text",subtitle:"dyn_no_access.chainalysis.description",title:"dyn_no_access.chainalysis.title"},default:{buttonTitle:"dyn_no_access.default.button_text",subtitle:"dyn_no_access.default.description",title:"dyn_no_access.default.title"},gate:{_socialMediaLinkText:void 0,_socialMediaUrl:void 0,buttonTitle:"dyn_no_access.gate.button_text",subtitle:"dyn_no_access.gate.description",title:"dyn_no_access.gate.title"}},NoAccess=()=>{const{deniedAddress:Xr,setDeniedAddress:eo,setDeniedOauthProvider:to,deniedOauthProvider:ro,deniedOauthUsername:no}=useAccessDeniedContext(),{t:io}=useTranslation(),oo=ro?findSocialIcon(ro):void 0,{selectedWalletConnector:ao,socialMediaIconUrl:so,notInTheListImageUrl:co,accessDeniedButton:lo}=useInternalDynamicContext(),{displayedDestination:fo}=useVerification(),{goToInitialView:ho}=useViewContext(),{_socialMediaLinkText:go,_socialMediaUrl:yo,isAccessListView:vo,isGateBlockedView:wo,subtitle:Eo,title:ko,buttonTitle:Ao}=useNoAccessText(),Po=()=>{ho(),eo(""),to(void 0),ao==null||ao.endSession()},jo=!so||typeof so=="string"?null:getSocialNetworkIcon(Object.keys(so)[0]),Mo=reactExports.useMemo(()=>ao?jsxRuntimeExports.jsx(AuthProviderIcon,{}):jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"wallet-no-access__icon--verified",Icon:oo??SignInWithEmailIcon,iconSize:50,InnerIcon:SvgError,variant:"red"}),[oo,ao]),No=shortenWalletAddress(Xr,6,4),Do=(lo==null?void 0:lo.title)||Ao,Fo=(lo==null?void 0:lo.action)||Po,Lo=ro===void 0?fo??No:no,Bo=!!co&&(vo||wo),xo=jo&&(vo||wo);return jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__container",children:[Bo&&jsxRuntimeExports.jsx("img",{src:co,alt:io("dyn_no_access.not_in_the_list_image_alt"),className:"wallet-no-access__image",copykey:"dyn_no_access.not_in_the_list_image_alt"}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__main",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__user-info-container",children:[Mo,jsxRuntimeExports.jsxs("div",{"data-testid":"walletAddress",className:"wallet-no-access__wallet-address-container",children:[ao&&jsxRuntimeExports.jsx(StatusDot,{variant:"red",containerClassName:"user-info__status-dot"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"wallet-no-access__wallet-address",children:Lo})]})]}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__content",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"wallet-no-access__content--primary",children:ko}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"wallet-no-access__content--secondary",children:Eo})]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:Fo,className:"wallet-no-access__button--primary",expanded:!0,buttonPadding:"large",children:Do}),yo&&go&&jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__social-info-container",children:[jsxRuntimeExports.jsxs("a",{href:yo,className:"wallet-no-access__waitlist-link",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",color:"primary",children:go}),xo&&jsxRuntimeExports.jsx(jo,{className:"wallet-no-access__social-icon",style:{height:pixelToRem(24),width:pixelToRem(24)}})]}),typeof so=="string"&&jsxRuntimeExports.jsx("img",{alt:"social media",src:so,style:{height:"1.5rem",width:"1.5rem"}})]})]})]})},capitalize=Xr=>Xr[0].toUpperCase()+Xr.slice(1),WalletHelpLink=({name:Xr,link:eo,Icon:to})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"wallet-help-link",children:jsxRuntimeExports.jsxs("a",{className:"wallet-help-link__anchor",href:eo,target:"_blank",rel:"noreferrer",children:[jsxRuntimeExports.jsx(to,{style:{height:"1.5rem",width:"1.5rem"}}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",weight:"medium",copykey:"dyn_qr_code.wallet_not_installed.browser_install",children:ro("dyn_qr_code.wallet_not_installed.browser_install",{browser:capitalize(Xr)})})]})})},NoQrNotInstalledView=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext(),{walletBook:eo}=useWalletBookContext(),{t:to}=useTranslation();if(!Xr)return null;const ro=Object.entries(getWalletLinks(eo,Xr.key)).filter(([,no])=>no!=="").filter(([no])=>no!=="ios"&&no!=="android").map(([no,io])=>jsxRuntimeExports.jsx(WalletHelpLink,{name:no,link:io,Icon:getBrowserIcon(no)},no));return jsxRuntimeExports.jsxs("div",{className:"no-qr-code-installed__container","data-testid":"no-qr-code-installed",children:[jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__img",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr.key,style:{height:pixelToRem(64),width:pixelToRem(64)}})}),jsxRuntimeExports.jsx(Typography,{className:"no-qr-code-installed__typography--title",variant:"title",copykey:"dyn_qr_code.wallet_not_installed.install",children:to("dyn_qr_code.wallet_not_installed.install",{wallet:getWalletBookWallet(eo,Xr.key).name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"no-qr-code-installed__typography",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.select",children:to("dyn_qr_code.wallet_not_installed.select")}),jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__links-section",children:ro}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"no-qr-code-installed__typography",weight:"medium",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.refresh",children:to("dyn_qr_code.wallet_not_installed.refresh")})]})};var _g$4,_defs$4,_excluded$b=["title","titleId"];function _extends$d(){return _extends$d=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$b(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyIntro2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$b(eo,_excluded$b);return reactExports.createElement("svg",_extends$d({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$4||(_g$4=reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-intro2_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.106ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.333 5.333 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.314.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.325 9.325 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.732-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 0 0 1.775 3.069 12.347 12.347 0 0 1 6.203-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.069-1.775 15.891 15.891 0 0 0-2.135 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.604-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944-.121.196a1.774 1.774 0 0 0 3.049 1.81 26.434 26.434 0 0 0 4.135-14.253 5.318 5.318 0 0 1 10.636 0c0 1.723-.118 3.418-.345 5.078a1.773 1.773 0 0 0 3.513.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs$4||(_defs$4=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro2_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-intro2_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-intro2_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_path$7,_path2,_path3,_excluded$a=["title","titleId"];function _extends$c(){return _extends$c=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$a(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAndroidFaceId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$a(eo,_excluded$a);return reactExports.createElement("svg",_extends$c({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$7||(_path$7=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 57.887c14.297 0 25.887-11.59 25.887-25.887S46.297 6.113 32 6.113 6.113 17.703 6.113 32 17.703 57.887 32 57.887ZM32 60c15.464 0 28-12.536 28-28S47.464 4 32 4 4 16.536 4 32s12.536 28 28 28Z",fill:"#1A73E8"})),_path2||(_path2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M36.752 46.831c.27.582.018 1.274-.565 1.544-2.69 1.25-5.356 1.479-7.54.476-2.215-1.017-3.66-3.173-4.134-6.099l2.295-.372c.383 2.364 1.466 3.742 2.809 4.359 1.374.63 3.299.592 5.591-.472a1.162 1.162 0 0 1 1.544.564ZM33.585 35.17v-4.755h2.113v6.868h-5.811V35.17h3.698Z",fill:"#1A73E8"})),_path3||(_path3=reactExports.createElement("path",{d:"M46.792 25.132a2.113 2.113 0 1 1-4.226 0 2.113 2.113 0 0 1 4.226 0ZM21.434 25.132a2.113 2.113 0 1 1-4.227 0 2.113 2.113 0 0 1 4.227 0Z",fill:"#1A73E8"})))},_path$6,_excluded$9=["title","titleId"];function _extends$b(){return _extends$b=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$9(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAndroidTouchId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$9(eo,_excluded$9);return reactExports.createElement("svg",_extends$b({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$6||(_path$6=reactExports.createElement("path",{d:"M47.493 11.92c-.213 0-.426-.053-.613-.16C41.76 9.12 37.333 8 32.027 8c-5.28 0-10.294 1.253-14.854 3.76-.64.347-1.44.107-1.813-.533a1.35 1.35 0 0 1 .533-1.814c4.96-2.693 10.4-4.08 16.134-4.08 5.68 0 10.64 1.254 16.08 4.054.666.346.906 1.146.56 1.786-.24.48-.694.747-1.174.747Zm-38.16 14a1.33 1.33 0 0 1-1.093-2.107c2.64-3.733 6-6.666 10-8.72 8.373-4.32 19.093-4.346 27.493-.026 4 2.053 7.36 4.96 10 8.666.427.587.294 1.44-.32 1.867a1.33 1.33 0 0 1-1.866-.32c-2.4-3.36-5.44-6-9.04-7.84-7.654-3.92-17.44-3.92-25.067.027-3.627 1.866-6.667 4.533-9.067 7.893-.213.373-.613.56-1.04.56ZM26 58.107c-.347 0-.693-.134-.933-.4-2.32-2.32-3.574-3.814-5.36-7.04-1.84-3.28-2.8-7.28-2.8-11.574 0-7.92 6.773-14.373 15.093-14.373s15.093 6.453 15.093 14.373a1.32 1.32 0 0 1-1.333 1.334 1.32 1.32 0 0 1-1.333-1.334c0-6.453-5.574-11.706-12.427-11.706S19.573 32.64 19.573 39.093c0 3.84.854 7.387 2.48 10.267 1.707 3.067 2.88 4.373 4.934 6.453a1.37 1.37 0 0 1 0 1.894c-.294.266-.64.4-.987.4Zm19.12-4.934c-3.173 0-5.973-.8-8.267-2.373-3.973-2.693-6.346-7.067-6.346-11.707a1.32 1.32 0 0 1 1.333-1.333 1.32 1.32 0 0 1 1.333 1.333c0 3.76 1.92 7.307 5.174 9.494 1.893 1.28 4.106 1.893 6.773 1.893.64 0 1.707-.08 2.773-.267a1.33 1.33 0 0 1 1.547 1.094 1.33 1.33 0 0 1-1.093 1.546c-1.52.294-2.854.32-3.227.32Zm-5.36 5.494a1.56 1.56 0 0 1-.347-.054c-4.24-1.173-7.013-2.746-9.92-5.6-3.733-3.706-5.786-8.64-5.786-13.92 0-4.32 3.68-7.84 8.213-7.84 4.533 0 8.213 3.52 8.213 7.84 0 2.854 2.48 5.174 5.547 5.174 3.067 0 5.547-2.32 5.547-5.174 0-10.053-8.667-18.213-19.334-18.213-7.573 0-14.506 4.213-17.626 10.747-1.04 2.16-1.574 4.693-1.574 7.466 0 2.08.187 5.36 1.787 9.627a1.301 1.301 0 0 1-.773 1.707A1.323 1.323 0 0 1 12 49.653c-1.307-3.493-1.947-6.96-1.947-10.56 0-3.2.614-6.106 1.814-8.64 3.546-7.44 11.413-12.266 20.026-12.266 12.134 0 22 9.36 22 20.88 0 4.32-3.68 7.84-8.213 7.84-4.533 0-8.213-3.52-8.213-7.84 0-2.854-2.48-5.174-5.547-5.174-3.067 0-5.547 2.32-5.547 5.174 0 4.56 1.76 8.826 4.987 12.026 2.533 2.507 4.96 3.894 8.72 4.934.72.186 1.12.933.933 1.626a1.301 1.301 0 0 1-1.253 1.014Z",fill:"#1A73E8"})))},_path$5,_excluded$8=["title","titleId"];function _extends$a(){return _extends$a=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$8(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFaceId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$8(eo,_excluded$8);return reactExports.createElement("svg",_extends$a({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$5||(_path$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.055 2.4A3.548 3.548 0 0 1 21.6 5.945v2.013a1.095 1.095 0 0 1-2.19 0V5.945c0-.747-.608-1.355-1.355-1.355h-2.012a1.095 1.095 0 1 1 0-2.19h2.012Zm-10.098 0a1.095 1.095 0 0 1 0 2.19H5.945c-.747 0-1.355.608-1.355 1.355v2.013a1.095 1.095 0 0 1-2.19 0V5.945A3.548 3.548 0 0 1 5.945 2.4h2.012Zm7.692 5.083c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 1 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm-4.121 0c.614 0 1.112.498 1.112 1.112v2.982h.008a1.113 1.113 0 0 1 0 2.226h-.386a1.849 1.849 0 0 1-1.847-1.848v-3.36c0-.614.498-1.112 1.113-1.112Zm-3.282 0c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 0 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm12.259 7.465c.605 0 1.095.49 1.095 1.095v2.012a3.548 3.548 0 0 1-3.545 3.545h-2.012a1.095 1.095 0 1 1 0-2.19h2.012c.747 0 1.355-.608 1.355-1.355v-2.012c0-.605.49-1.095 1.095-1.095Zm-17.01 0c.605 0 1.095.49 1.095 1.095v2.012c0 .747.608 1.355 1.355 1.355h2.012a1.095 1.095 0 0 1 0 2.19H5.945A3.548 3.548 0 0 1 2.4 18.055v-2.012c0-.605.49-1.095 1.095-1.095Zm5.365 1.337a.473.473 0 0 0 0 0l-.434.47a1.113 1.113 0 0 1 1.51-1.634c.563.52 1.296.806 2.064.806s1.5-.286 2.065-.807a1.113 1.113 0 0 1 1.51 1.634A5.255 5.255 0 0 1 12 18.153a5.255 5.255 0 0 1-3.574-1.397l.434-.47a4.615 4.615 0 0 1 0 0Zm5.947.28a4.694 4.694 0 0 1 0 0Z",fill:"#ABACB2"})))},_g$3,_defs$3,_excluded$7=["title","titleId"];function _extends$9(){return _extends$9=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$7(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgIphoneTouchId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$7(eo,_excluded$7);return reactExports.createElement("svg",_extends$9({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$3||(_g$3=reactExports.createElement("g",{clipPath:"url(#iphone-touch-id_svg__a)",fill:"#000"},reactExports.createElement("path",{d:"M38.635.943c-4.483-1.118-9.2-1.278-13.79-.287a.657.657 0 0 0 .277 1.285c4.396-.95 8.924-.793 13.232.287 10.3 2.582 18.875 10.327 22.14 20.444 1.264 3.912 1.8 8.078 1.908 12.445a.657.657 0 0 0 1.313-.033c-.108-4.426-.651-8.7-1.945-12.74C58.378 11.75 49.417 3.632 38.635.943ZM21.51 2.932a.657.657 0 1 0-.35-1.267c-4.801 1.324-11.554 5.9-15.728 12.014a.754.754 0 0 0-.004.007C1.763 19.208-.534 26.148.108 32.883l.001.019c.154 1.23.412 2.457.67 3.686.544 2.588 1.09 5.183.665 7.818a.657.657 0 1 0 1.297.21c.445-2.755-.107-5.443-.66-8.13-.254-1.244-.51-2.487-.666-3.737-.604-6.364 1.57-13.002 5.105-18.333 4.015-5.879 10.516-10.25 14.99-11.484Z"}),reactExports.createElement("path",{d:"M30.133 4.4c8.25-.504 16.499 2.863 22.039 9.314a.657.657 0 1 1-.997.856c-5.268-6.134-13.118-9.339-20.966-8.858H30.2c-9.925.48-19.22 7.214-22.638 16.648a.657.657 0 1 1-1.236-.447C9.928 11.973 19.688 4.907 30.133 4.4ZM54.174 16.585a.657.657 0 0 0-1.091.733c3.07 4.572 4.34 9.548 4.843 15.454a.657.657 0 0 0 1.31-.112c-.514-6.034-1.823-11.252-5.062-16.075ZM58.796 35.45a.657.657 0 0 1 .697.615c.247 3.963.25 8.446-.189 11.76a.657.657 0 1 1-1.303-.173c.423-3.193.425-7.582.18-11.505a.657.657 0 0 1 .615-.697ZM6.57 25.543a.657.657 0 1 0-1.278-.308 26.58 26.58 0 0 0-.743 6.104c-.01 2.117.385 4.184.78 6.25.323 1.692.646 3.384.747 5.104.134 2.26-.341 4.523-1.163 6.677a.657.657 0 1 0 1.228.469c.868-2.277 1.395-4.73 1.247-7.223-.1-1.709-.424-3.39-.747-5.072-.394-2.051-.788-4.102-.778-6.199.01-1.952.248-3.902.706-5.802Z"}),reactExports.createElement("path",{d:"M23.813 10.94a.657.657 0 0 1-.365.855c-6.813 2.736-11.93 8.91-12.973 16.19-.436 3.042.035 6.055.506 9.067.265 1.696.53 3.392.634 5.093.223 3.688-.197 7.739-2.597 11.425a.657.657 0 0 1-1.101-.718c2.186-3.358 2.6-7.088 2.386-10.627-.105-1.726-.368-3.442-.632-5.156-.472-3.077-.944-6.15-.497-9.27 1.115-7.774 6.563-14.324 13.784-17.224a.657.657 0 0 1 .855.365ZM46.882 14.681c-5.374-5.034-13.164-6.79-20.244-5.238a.657.657 0 1 0 .282 1.284c6.704-1.47 14.039.207 19.064 4.914 4.235 3.967 6.695 9.739 7.339 16.037a.657.657 0 0 0 1.307-.134c-.668-6.54-3.232-12.633-7.748-16.863ZM54.493 34.674a.657.657 0 0 1 .72.586c.625 6.077.356 12.64-.587 18.99a.657.657 0 0 1-1.3-.193c.93-6.261 1.191-12.713.58-18.662a.657.657 0 0 1 .587-.721Z"}),reactExports.createElement("path",{d:"M31.582 13.355c-10.07 0-18.252 8.034-18.252 17.967 0 1.06.094 2.1.274 3.111a.657.657 0 0 0 1.294-.23 16.469 16.469 0 0 1-.254-2.881c0-9.187 7.574-16.652 16.938-16.652 4.232 0 8.098 1.525 11.066 4.045a.657.657 0 0 0 .85-1.002 18.353 18.353 0 0 0-11.916-4.358ZM44.971 20.163a.657.657 0 0 1 .93.02c2.9 3.024 3.828 7.777 4.442 11.766.692 4.494.798 8.877.798 10.91a.657.657 0 0 1-1.315 0c0-2-.104-6.31-.782-10.71-.57-3.703-1.392-8.24-4.092-11.056a.657.657 0 0 1 .02-.93ZM50.974 46.622a.657.657 0 0 0-1.31-.105c-.323 4.048-.745 8.092-1.6 11.827a.657.657 0 1 0 1.28.293c.879-3.833 1.306-7.956 1.63-12.015ZM14.662 36.852a.657.657 0 0 1 .771.518c1.39 7.056.43 13.466-3.25 19.08a.657.657 0 0 1-1.099-.72c3.462-5.283 4.394-11.331 3.06-18.106a.657.657 0 0 1 .518-.772Z"}),reactExports.createElement("path",{d:"M31.582 17.631c-6.537 0-12.95 5.06-13.604 11.42-.287 2.784.116 5.526.519 8.27.351 2.395.703 4.791.596 7.217-.244 5.552-1.873 10.135-4.672 13.91a.657.657 0 1 0 1.056.782c2.968-4.003 4.674-8.844 4.93-14.634.106-2.415-.247-4.804-.6-7.19-.403-2.73-.806-5.459-.521-8.221.574-5.587 6.325-10.24 12.296-10.24 2.785 0 9.991 1.508 12.283 8.976 1.437 4.679 1.828 11.012 1.48 17.164-.347 6.151-1.43 12.035-2.885 15.808a.657.657 0 0 0 1.227.473c1.522-3.947 2.619-9.98 2.97-16.207.353-6.226-.034-12.734-1.535-17.624-2.545-8.289-10.52-9.904-13.54-9.904Z"}),reactExports.createElement("path",{d:"M21.47 56.451c.303.198.389.606.19.91-.407.624-.765 1.278-1.124 1.932-.359.654-.717 1.307-1.125 1.932a.657.657 0 1 1-1.1-.718c.407-.624.765-1.278 1.124-1.932.359-.654.717-1.308 1.125-1.932a.657.657 0 0 1 .91-.192ZM27.096 24.453a.657.657 0 1 0-.73-1.093c-2.603 1.74-4.2 4.134-4.2 7.64 0 2.088.37 3.795.75 5.545.567 2.62.953 5.233.883 7.923-.084 3.267-.723 6.252-1.952 9.096a.657.657 0 1 0 1.207.521c1.299-3.007 1.971-6.158 2.06-9.583.071-2.796-.325-5.513-.913-8.235-.38-1.758-.72-3.328-.72-5.267 0-3.004 1.321-5.013 3.615-6.547ZM29.66 22.144c2.728-.556 5.662.13 7.822 1.879 3.858 3.122 4.371 8.817 4.787 13.432l.021.235c.538 5.949-.077 11.726-1.316 17.529a.657.657 0 1 1-1.286-.275c1.22-5.715 1.815-11.355 1.293-17.136l-.052-.582v-.002c-.37-4.17-.832-9.394-4.274-12.18-1.846-1.494-4.379-2.092-6.732-1.613a.657.657 0 1 1-.262-1.287ZM40.045 58.489a.657.657 0 1 0-1.274-.325 15.88 15.88 0 0 1-1.785 4.266.657.657 0 1 0 1.127.675 17.188 17.188 0 0 0 1.932-4.616ZM36.831 48.952c.36.043.618.37.576.73-.62 5.245-2.022 9.922-4.27 13.98a.657.657 0 0 1-1.15-.638c2.152-3.882 3.51-8.39 4.115-13.496a.657.657 0 0 1 .73-.576Z"}),reactExports.createElement("path",{d:"M36.696 30.656c-.456-2.435-2.545-4.297-5.081-4.297-3.435 0-5.845 3.462-4.996 6.683 1.437 5.686 1.673 11.166.7 16.444v.003c-.845 4.739-2.465 9.002-4.677 12.614a.657.657 0 0 0 1.121.686c2.302-3.76 3.978-8.178 4.85-13.067 1.01-5.482.759-11.154-.72-17.005l-.002-.007c-.637-2.41 1.138-5.037 3.724-5.037 1.865 0 3.44 1.373 3.788 3.22.957 5.548 1.455 10.693 1.1 15.123a.657.657 0 1 0 1.31.105c.368-4.592-.151-9.863-1.115-15.456l-.002-.01ZM29.654 59.117c.323.166.45.562.284.885l-1.741 3.389a.657.657 0 1 1-1.17-.601L28.77 59.4a.657.657 0 0 1 .885-.284Z"}),reactExports.createElement("path",{d:"M32.103 31.29a.657.657 0 1 0-1.28.3c2.217 9.433 1.913 17.717-.787 24.773a.657.657 0 1 0 1.228.47c2.814-7.358 3.1-15.919.84-25.544Z"}))),_defs$3||(_defs$3=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"iphone-touch-id_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h64v64H0z"})))))};const PasskeyDeviceIcon=({defaultIcon:Xr,className:eo,size:to="small"})=>{let ro=Xr||null;if(isIPhone()&&(isIPhone8OrEarlier()?ro=jsxRuntimeExports.jsx(SvgIphoneTouchId,{"data-testid":"iphone-8-icon"}):ro=jsxRuntimeExports.jsx(SvgFaceId,{"data-testid":"iphone-icon"})),isAndroid$1()){const no=getAndroidVersion();no&&no>=9?ro=jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"android-9-icon"}):ro=jsxRuntimeExports.jsx(SvgAndroidFaceId,{"data-testid":"android-icon"})}return ro?jsxRuntimeExports.jsx(Icon,{className:eo,size:to,children:ro}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},AuthChoiceInfo=({choice:Xr,variant:eo="default"})=>{const{t:to}=useTranslation(),ro={passkey:{default:[{description:"dyn_embedded_authenticator.passkey.auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.auth_info.security.description",title:"dyn_embedded_authenticator.passkey.auth_info.security.title"}],noEmailSignup:[{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.title"}]}};return jsxRuntimeExports.jsx("div",{className:"auth-choice-info",children:ro[Xr][eo].map((no,io)=>jsxRuntimeExports.jsxs("div",{className:"auth-choice-info__container-item",children:[jsxRuntimeExports.jsx("div",{className:"auth-choice-info__container-icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",className:"auth-choice-info__icon",children:jsxRuntimeExports.jsx(SvgAdd,{})})}),jsxRuntimeExports.jsxs("div",{className:"action-card__item-title",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",copykey:no.title,children:to(no.title)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",copykey:no.description,children:to(no.description)})]})]},`authChoiceInfo_${io}`))})},PasskeyIntroView=({chains:Xr})=>{var eo;const{walletConnectorOptions:to,environmentId:ro,handleLogOut:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),ao=((eo=io==null?void 0:io.verifiedCredentials)===null||eo===void 0?void 0:eo.length)===1&&!getUserVerifiedCredentialType(io,JwtVerifiedCredentialFormatEnum.Email),{t:so}=useTranslation(),[co,lo]=reactExports.useState(!1);reactExports.useEffect(()=>StorageService.removeItem(LAST_USED_WALLET),[]);const{createDynamicEmbeddedWalletMutation:fo,isLoading:ho,error:go}=useCreateDynamicEmbeddedWalletMutation(),yo=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!io&&!oo)throw new Error("User is not logged in");lo(wo),yield fo({chains:Xr,environmentId:ro,walletConnectorOptions:to,withAuthenticator:wo})}),vo=reactExports.useMemo(()=>{if(go)return go instanceof DynamicError?go.message:getProperErrorMessage(go)},[go]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_intro.title",children:so("dyn_passkey_intro.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-intro-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntro2,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-intro-view__subtitle",copykey:"dyn_passkey_intro.subtitle",children:so("dyn_passkey_intro.subtitle")}),vo&&jsxRuntimeExports.jsx(ErrorContainer,{children:vo}),jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey",variant:ao?"noEmailSignup":"default"}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",onClick:()=>yo(!0),dataTestId:"setup-passkey-button",loading:ho&&co,disabled:ho,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{copykey:"dyn_passkey_intro.button",children:so("dyn_passkey_intro.button")})]})}),jsxRuntimeExports.jsx(TextButton,{"data-testid":"setup-passkey-logout-button",className:"passkey-intro-view__log-out",onClick:no,copykey:"dyn_passkey_intro.button_logout",children:so("dyn_passkey_intro.button_logout")})]})]})]})};var _circle$1,_path$4,_g$2,_defs$2,_excluded$6=["title","titleId"];function _extends$8(){return _extends$8=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$6(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyIntroIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$6(eo,_excluded$6);return reactExports.createElement("svg",_extends$8({width:206,height:206,viewBox:"0 0 206 206",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$1||(_circle$1=reactExports.createElement("circle",{cx:103,cy:103,r:103,fill:"url(#passkey-intro-icon_svg__a)",fillOpacity:.12})),_path$4||(_path$4=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M101.59 42.066a6.37 6.37 0 0 1 1.822 0c.696.1 1.343.345 1.858.54l.138.051 17.072 6.402.416.156c1.967.734 3.695 1.38 5.025 2.551a9.553 9.553 0 0 1 2.612 3.77c.631 1.657.628 3.501.625 5.6v15.672c0 9-4.895 16.504-10.187 22.016-5.326 5.55-11.421 9.469-14.643 11.349l-.131.077c-.588.345-1.351.793-2.361 1.01a6.78 6.78 0 0 1-2.67 0c-1.01-.217-1.774-.665-2.362-1.01l-.13-.077c-3.223-1.88-9.317-5.799-14.644-11.349-5.291-5.512-10.186-13.015-10.186-22.016V61.137c-.003-2.1-.006-3.944.625-5.601a9.553 9.553 0 0 1 2.612-3.77c1.33-1.172 3.058-1.817 5.025-2.551l.416-.156 17.072-6.402.138-.052c.514-.194 1.162-.439 1.858-.54ZM94.382 69.11v-4.037a8.073 8.073 0 1 1 16.147 0v4.036a13.434 13.434 0 0 1 5.383 10.766c0 7.431-6.024 13.456-13.456 13.456C95.025 93.33 89 87.306 89 79.875c0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.073 5.073 0 1 0-10.147 0v2.336a13.414 13.414 0 0 1 5.074-.99c1.795 0 3.508.352 5.073.99ZM106 77.5a3.5 3.5 0 0 1-2 3.163V83.5a1.5 1.5 0 1 1-3 0v-2.837a3.5 3.5 0 1 1 5-3.163ZM126 22a4 4 0 0 1 4-4h45a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4h-45a4 4 0 0 1-4-4V22Zm15 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm7 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm13-3a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm9 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm1 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z",fill:"#4779FF"})),_g$2||(_g$2=reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__b)"},reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__c)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.731 54.983a15.068 15.068 0 0 0 1.087-10.69C58.656 36.226 50.362 31.438 42.294 33.6c-8.069 2.162-12.857 10.455-10.695 18.524a15.068 15.068 0 0 0 6.288 8.715c1.864-4.039 6.77-6.622 9.948-7.473 3.179-.852 8.204-1.183 11.896 1.618Zm-19.98-8.96a5.672 5.672 0 1 1 10.957-2.935 5.672 5.672 0 0 1-10.957 2.936Z",fill:"#4779FF"})))),_defs$2||(_defs$2=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__b"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 151.778 -80.474)",d:"M0 0h33v33H0z"})),reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__c"},reactExports.createElement("rect",{x:27.684,y:37.513,width:30.25,height:30.25,rx:15.125,transform:"rotate(-15 27.684 37.513)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"passkey-intro-icon_svg__a",x1:103,y1:0,x2:103,y2:105.711,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AddRecoveryEmail=({canSkipAddingEmail:Xr=!0,shouldInitRecovery:eo=!1,authenticatorType:to,currentAction:ro,isFromEmailVerification:no=!1})=>{const{user:io,setShowAuthFlow:oo}=useInternalDynamicContext(),{t:ao}=useTranslation(),{addRecoveryEmail:so,initPasskeyRecoveryProcess:co}=usePasskeyRecovery(),[lo,fo]=reactExports.useState(!1),[ho,go]=reactExports.useState(void 0);useEffectOnce(()=>{dynamicEvents.once("embeddedWalletRecoveryEmailCompleted",()=>__awaiter$j(void 0,void 0,void 0,function*(){if(fo(!0),go(void 0),!eo){setTimeout(()=>{oo(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},5e3);return}return co(to,ro)})),dynamicEvents.once("embeddedWalletRecoveryEmailFailed",Ao=>__awaiter$j(void 0,void 0,void 0,function*(){go(Ao)}))});const{mutate:yo,isLoading:vo}=useMutation(Ao=>__awaiter$j(void 0,void 0,void 0,function*(){yield so(Ao)})),wo=()=>{oo(!1)},Eo=()=>{if(ho)return ho instanceof DynamicError?ho.message:getProperErrorMessage(ho)},ko=Xr&&jsxRuntimeExports.jsx(IconButton,{onClick:wo,type:"button","data-testid":"add-recovery-email-close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ko,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"passkey-recovery-heading",className:"header__typography",copykey:"dyn_passkey_recovery.add_email.title",children:ao("dyn_passkey_recovery.add_email.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),lo&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",copykey:"dyn_passkey_recovery.add_email.success_message",children:ao("dyn_passkey_recovery.add_email.success_message")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:"dyn_passkey_recovery.add_email.description",children:ao("dyn_passkey_recovery.add_email.description")}),ho!==void 0&&jsxRuntimeExports.jsx(ErrorContainer,{children:Eo()}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__form",children:jsxRuntimeExports.jsx(EmailForm,{onSubmit:yo,currentEmail:io==null?void 0:io.email,isLoading:(vo||no)&&!ho,buttonCopyKey:"dyn_passkey_recovery.add_email.confirm_button",isDisabled:no&&!ho&&!lo})})]})]})},bundleRegex=new RegExp(/^([A-Za-z0-9\s_+@\.-]+)$/),PasskeyBundleRecovery=({authenticatorType:Xr,currentAction:eo})=>{const{primaryWallet:to,environmentId:ro,user:no,setShowAuthFlow:io}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:oo}=useIsTurnkeyWallet(),{getEOAWallet:ao}=useSmartWallets(),[so,co]=reactExports.useState(""),[lo,fo]=reactExports.useState(!1),[ho,go]=reactExports.useState(!1),{t:yo}=useTranslation(),{setView:vo}=useViewContext(),{mutate:wo,isLoading:Eo,error:ko}=useMutation(Xo=>__awaiter$j(void 0,void 0,void 0,function*(){var Lo;const Bo=(Lo=to&&ao(to))!==null&&Lo!==void 0?Lo:to;yield passkeyRecoveryBundleValidation({bundleInput:Xo,user:no,wallet:Bo}),go(!0),Xr==="email"&&dynamicEvents.emit("passkeyRecoveryCompleted",to),setTimeout(()=>{if(Xr==="passkey")return vo("passkey-recovery-complete");eo!=="reveal"&&io(!1)},2e3)})),Ao=Xo=>!(!(Xo!=null&&Xo.length)||Xo.length<100||Xo.length>=256||!bundleRegex.test(Xo)),Po=Xo=>{var Lo;const Bo=(Lo=Xo.target.value)===null||Lo===void 0?void 0:Lo.trim();co(Bo),Ao(Bo)&&wo(Bo)},jo=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{fo(!0),yield resentRecoveryEmail({authenticatorType:Xr,environmentId:ro,user:no,wallet:to})}catch(Xo){logger$8.error("Failed to complete passkey recovery",Xo)}finally{fo(!1)}}),Mo=reactExports.useMemo(()=>{if(ko)return ko instanceof DynamicError?ko.message:getProperErrorMessage(ko)},[ko]),No=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SignInWithEmailIcon,{})}),Do=oo?"dyn_passkey_secure_modal":"dyn_passkey_recovery",Fo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{io(!1,{emitCancelAuth:!0}),dynamicEvents.emit("passkeyRecoveryFailed",new DynamicError("Validation request cancelled"))},"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Fo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:`${Do}.code.title`,children:yo(`${Do}.code.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[!ko&&!ho?jsxRuntimeExports.jsx(IconWithSpinner,{Icon:No,isSpinning:!ko&&!ho,iconSize:96}):jsxRuntimeExports.jsx(IconWithStatus,{Icon:SignInWithEmailIcon,iconSize:64,variant:ko?"red":"green",InnerIcon:ko?SvgError:SvgCheck}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:`${Do}.code.description`,children:yo(`${Do}.code.description`,{email:no==null?void 0:no.email})}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(Input,{id:"passkey-recovery-bundle","data-testid":"passkey-recovery-bundle-input",value:so,onChange:Po,label:yo(`${Do}.code.input_label`),disabled:Eo||lo,error:!!ko,className:ho?"passkey-recovery-view__input-valid":"",autoFocus:!0,message:Mo})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__resend-code",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:`${Do}.code.resend.text`,children:yo(`${Do}.code.resend.text`)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:`${Do}.code.resend.button`,children:jsxRuntimeExports.jsx(TextButton,{"data-testid":"resend-email-button",onClick:jo,disabled:lo||Eo||so.length>0&&!ko,children:yo(`${Do}.code.resend.button`)})})]})]})]})},NeedHelpSection=({isRecoveryFlow:Xr=!1})=>{var eo,to,ro,no,io,oo;const{projectSettings:ao,primaryWallet:so}=useInternalDynamicContext(),{t:co}=useTranslation(),{initPasskeyRecoveryProcess:lo}=usePasskeyRecovery(),fo=(eo=ao==null?void 0:ao.general)===null||eo===void 0?void 0:eo.supportEmail,ho=((to=ao==null?void 0:ao.general)===null||to===void 0?void 0:to.supportUrls)&&((ro=Object.values(ao==null?void 0:ao.general.supportUrls))===null||ro===void 0?void 0:ro[0]),go=!Xr&&((no=ao==null?void 0:ao.providers)===null||no===void 0?void 0:no.find(Po=>Po.provider===ProviderEnum.Turnkey&&Po.enabledAt))&&!!(!((oo=(io=ao==null?void 0:ao.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0)&&oo.emailRecoveryEnabled),{getEOAWallet:yo}=useSmartWallets(),vo=so&&yo(so),wo=so&&isSessionKeyCompatibleWallet(so)||vo&&isSessionKeyCompatibleWallet(vo),Eo=!!(fo||ho),ko=()=>Eo?jsxRuntimeExports.jsxs("div",{className:"need-help-section__links",children:[ho&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:"dyn_need_help_section.contact_support",children:jsxRuntimeExports.jsx("a",{href:ho,rel:"noreferrer",target:"_blank",children:co("dyn_need_help_section.contact_support")})}),fo&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${fo}`,children:fo})})]}):null,Ao=()=>{if(!go)return null;const Po=co("dyn_need_help_section.help_button"),jo=Eo?Po:Po.slice(0,1).toUpperCase()+Po.slice(1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Eo&&jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.divider",children:co("dyn_need_help_section.divider")}),jsxRuntimeExports.jsx(TextButton,{copykey:"dyn_need_help_section.help_button",className:classNames("need-help-section__helper-link"),onClick:()=>lo(void 0,"helpSession"),children:jo})]})};return!Eo&&(!go||wo)?null:jsxRuntimeExports.jsxs("div",{className:"need-help-section",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.info",children:co("dyn_need_help_section.info")}),ko(),Ao()]})},PasskeyCompleteRecovery=()=>{const{primaryWallet:Xr,environmentId:eo,user:to,setShowAuthFlow:ro,setPasskeySuccessPopup:no}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:io}=useIsTurnkeyWallet(),{getEOAWallet:oo}=useSmartWallets(),{t:ao}=useTranslation(),{mutate:so,isLoading:co,error:lo}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){var go;const yo=(go=Xr&&oo(Xr))!==null&&go!==void 0?go:Xr;if(!(yield completePasskeyRecovery({environmentId:eo,user:to,wallet:yo})))throw new DynamicError("Error completing passkey recovery");dynamicEvents.emit("passkeyRecoveryCompleted",Xr),ro(!1),no(PasskeySuccessEnum.CREATED)}),{onFailure:go=>{logger$8.error("Failed to init passkey recovery",go),dynamicEvents.emit("passkeyRecoveryFailed",go)}}),fo=reactExports.useMemo(()=>{if(lo)return lo instanceof DynamicError?lo.message:getProperErrorMessage(lo)},[lo]),ho=io?"dyn_passkey_secure_modal":"dyn_passkey_recovery";return jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:ao(`${ho}.complete.description`)}),fo&&jsxRuntimeExports.jsx(ErrorContainer,{children:fo}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",dataTestId:"passkey-recovery-complete-button",onClick:()=>so(),disabled:co,showInternalLoading:!1,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{children:ao(`${ho}.complete.complete_button`)})]})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})},PasskeyInitRecovery=({authenticatorType:Xr})=>{const{setShowAuthFlow:eo}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:to}=useIsTurnkeyWallet(),{initAuthMethod:ro,isLoading:no,error:io}=useInitEmbeddedWalletAuthMethod(),{createRootElement:oo}=useElementById(),ao=oo(iframeContainerId$1),{t:so}=useTranslation(),co=reactExports.useMemo(()=>{if(io)return io instanceof DynamicError?io.message:"Something went wrong."},[io]),lo=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,{})}),fo=to?"dyn_passkey_secure_modal":"dyn_passkey_recovery",ho=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>eo(!1,{emitCancelAuth:!0}),"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ho,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:so(`${fo}.start.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:lo,isSpinning:no,iconSize:96}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:so(`${fo}.start.description`)}),co&&jsxRuntimeExports.jsx(ErrorContainer,{children:co}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",dataTestId:"passkey-recovery-button",onClick:()=>ro({authenticatorType:Xr,iframeContainer:ao.current}),disabled:no,showInternalLoading:!1,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{children:so(`${fo}.start.start_button`)})})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},RenamePasskeyView=()=>{var Xr;const{passkey:eo,setPasskey:to,passkeyIcon:ro,passkeyEdited:no,setPasskeyEdited:io}=usePasskeyContext(),{t:oo}=useTranslation(),{environmentId:ao,setShowAuthFlow:so,setPasskeySuccessPopup:co}=useInternalDynamicContext(),[lo,fo]=reactExports.useState(!1),ho=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(vo&&(eo!=null&&eo.id)){const wo=yield updateUserPasskey({alias:vo.trim(),environmentId:ao,id:eo.id});wo?(to(wo),io(!no),so(!1),co(PasskeySuccessEnum.EDITED)):fo(!0)}else fo(!0)}),go=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{so(!1)},"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),yo=jsxRuntimeExports.jsx(IconButton,{onClick:()=>so(!1),type:"button",id:"close-button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return eo?jsxRuntimeExports.jsxs("div",{className:"edit-passkeys-widget-view",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:go,trailing:yo}),jsxRuntimeExports.jsx("div",{className:"edit-passkeys-widget-view__icon",children:ro}),jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",copykey:"dyn_rename_passkeys.title",children:oo("dyn_rename_passkeys.title")}),jsxRuntimeExports.jsx(Formik,{initialValues:{alias:(Xr=eo.alias)!==null&&Xr!==void 0?Xr:""},onSubmit:vo=>{ho(vo.alias)},children:({values:vo})=>jsxRuntimeExports.jsxs(Form,{className:"edit-passkeys-widget-view__body",children:[jsxRuntimeExports.jsx(Field$1,{"data-testid":"input-field",name:"alias",type:"text",label:oo("dyn_rename_passkeys.input_label"),copykey:"dyn_rename_passkeys.input_label",className:"edit-passkeys-widget-view__input",as:Input,error:lo,maxLength:32}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",className:"edit-passkeys-widget-view__body",buttonPadding:"large",disabled:!vo.alias,copykey:"dyn_rename_passkeys.save",children:oo("dyn_rename_passkeys.save")}),lo&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"body_small",color:"error-1",copykey:"dyn_rename_passkeys.error",children:oo("dyn_rename_passkeys.error")})]})})]}):jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",children:oo("dyn_rename_passkeys.not_found")})};var _g$1,_defs$1,_excluded$5=["title","titleId"];function _extends$7(){return _extends$7=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$5(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMultipleAccountSecurity=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$5(eo,_excluded$5);return reactExports.createElement("svg",_extends$7({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$1||(_g$1=reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#multiple-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__c)"},reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"}))),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$1||(_defs$1=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"multiple-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__d"},reactExports.createElement("rect",{x:87.633,y:38.225,width:29.333,height:29.333,rx:14.667,transform:"rotate(-15 87.633 38.225)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"multiple-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_g,_defs,_excluded$4=["title","titleId"];function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$4(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyAccountSecurity=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$4(eo,_excluded$4);return reactExports.createElement("svg",_extends$6({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g||(_g=reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.105ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.334 5.334 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.846 9.846 0 0 0-3.409-1.665 9.849 9.849 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 1 0 1.776 3.069 12.34 12.34 0 0 1 6.202-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.068-1.775 15.882 15.882 0 0 0-2.136 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.605-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944a8.75 8.75 0 0 0-.12.196 1.773 1.773 0 1 0 3.048 1.81c.023-.04.048-.079.072-.118a26.434 26.434 0 0 0 4.063-14.134 5.318 5.318 0 0 1 10.636 0c0 1.722-.118 3.417-.344 5.077a1.772 1.772 0 1 0 3.512.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs||(_defs=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const ActionCard=({titleKey:Xr,descriptionKey:eo,description:to,LeadingIcon:ro,action:no,badgeVariant:io,badgeKey:oo,isLoading:ao,dataTestId:so})=>{const{t:co}=useTranslation();return jsxRuntimeExports.jsxs("button",{className:"action-card",onClick:no,"data-testid":so,children:[jsxRuntimeExports.jsx(Icon,{className:"action-card__icon",children:ro}),jsxRuntimeExports.jsxs("div",{className:"action-card__content",children:[jsxRuntimeExports.jsxs("div",{className:"action-card__content__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",copykey:Xr,children:co(Xr)}),jsxRuntimeExports.jsx(Badge,{text:co(oo),className:classNames("action-card__content__row__badge",{"action-card__content__row__badge--primary":io==="primary"},{"action-card__content__row__badge--secondary":io==="secondary"}),copykey:oo})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:eo,children:to})]}),jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",className:"action-card__action-icon",children:ao?jsxRuntimeExports.jsx(Spinner$1,{}):jsxRuntimeExports.jsx(SvgChevronLeft,{})})]})},EmbeddedAuthChoiceCards=({currentAction:Xr,supportedAuthenticators:eo})=>{var to,ro;const[no,io]=reactExports.useState(),{projectSettings:oo}=useInternalDynamicContext(),{t:ao}=useTranslation(),{initAuthMethod:so,isLoading:co}=useInitEmbeddedWalletAuthMethod(),{createRootElement:lo}=useElementById(),fo=lo(iframeContainerId$1),ho={email:{badgeKey:"dyn_embedded_authenticator.email.badge",description:ao("dyn_embedded_authenticator.email.description",{expiration:(ro=(to=oo==null?void 0:oo.sdk.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration)===null||ro===void 0?void 0:ro.amount}),descriptionKey:"dyn_embedded_authenticator.email.description",icon:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"small",children:jsxRuntimeExports.jsx(SvgMail,{})},"one-time-code-icon"),titleKey:"dyn_embedded_authenticator.email.title"},passkey:{badgeKey:"dyn_embedded_authenticator.passkey.badge",description:ao("dyn_embedded_authenticator.passkey.description"),descriptionKey:"dyn_embedded_authenticator.passkey.description",icon:jsxRuntimeExports.jsx(PasskeyDeviceIcon,{defaultIcon:jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"default-icon"})}),titleKey:Xr==="reveal"?"dyn_embedded_authenticator.passkey.reveal_title":"dyn_embedded_authenticator.passkey.title"}},go=yo=>()=>__awaiter$j(void 0,void 0,void 0,function*(){io(yo),yield so({authenticatorType:yo,currentAction:Xr,iframeContainer:fo.current})});return jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice-cards",children:eo&&eo.map(yo=>jsxRuntimeExports.jsx(ActionCard,{LeadingIcon:ho[yo].icon,action:go(yo),badgeKey:ho[yo].badgeKey,badgeVariant:yo==="passkey"?"primary":"secondary",descriptionKey:ho[yo].descriptionKey,description:ho[yo].description,titleKey:ho[yo].titleKey,isLoading:co&&yo===no,dataTestId:`embedded-auth-choice__item-${yo}`},yo))})},titleDescriptionMap={helpSession:{description:"dyn_embedded_authenticator.need_help_description",title:"dyn_embedded_authenticator.need_help_title"},reveal:{description:"dyn_embedded_authenticator.reveal_description",title:"dyn_embedded_authenticator.reveal_title"},sendTransaction:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"},signMessage:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"}},EmbeddedAuthChoice=({currentAction:Xr})=>{var eo;const{t:to}=useTranslation(),{primaryWallet:ro,projectSettings:no,setShowAuthFlow:io}=useInternalDynamicContext(),{getEOAWallet:oo}=useSmartWallets(),ao=(eo=ro&&oo(ro))!==null&&eo!==void 0?eo:ro,{initPasskeyRecoveryProcess:so}=usePasskeyRecovery(),{isTurnkeyWallet:co}=useIsTurnkeyWallet(),lo=reactExports.useMemo(()=>{var wo;const Eo=getEnabledEmbeddedWalletsAuthenticators((wo=no==null?void 0:no.sdk.embeddedWallets)===null||wo===void 0?void 0:wo.supportedSecurityMethods),ko=Object.keys(Eo);return!Xr||!["helpSession","reveal"].includes(Xr)?ko.filter(Ao=>Ao!=="email"):ko},[no==null?void 0:no.sdk.embeddedWallets]),fo=()=>!ao||!co?!1:ao.connector.getAuthenticatorHandler().isSessionActive(),ho=()=>lo.length>1?jsxRuntimeExports.jsx(SvgMultipleAccountSecurity,{}):jsxRuntimeExports.jsx(SvgPasskeyAccountSecurity,{}),go=fo()?"dyn_embedded_authenticator.passkey.auth_info.start_button":"dyn_embedded_authenticator.passkey.auth_info.add_button",{title:yo,description:vo}=titleDescriptionMap[Xr||"signMessage"];return lo!=null&&lo.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:yo,children:to(yo)})}),jsxRuntimeExports.jsxs("div",{className:"embedded-auth-choice",children:[jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice__header",children:ho()}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"embedded-auth-choice__subtitle",copykey:vo,children:to(vo)}),lo.length>1?jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{currentAction:Xr,supportedAuthenticators:lo}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey"}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"passkey-only-choice-button",buttonVariant:"brand-primary",color:"brand-primary",expanded:!0,onClick:()=>so("passkey"),copykey:go,typographyProps:{color:"inherit"},children:to(go)})]}),Xr!=="reveal"&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonClassName:"embedded-auth-choice__skip-button",expanded:!0,onClick:()=>io(!1),copykey:"dyn_embedded_authenticator.skip",children:to("dyn_embedded_authenticator.skip")})]})]}):null},PendingSignatureView=()=>{const[Xr,eo]=reactExports.useState(!1),{selectedWalletConnector:to}=useInternalDynamicContext(),{signAlreadyConnectedUser:ro}=useConnectAndSignSplitSteps(),{t:no}=useTranslation(),io=96,oo=isHardwareWalletEnabled(to);if(!to)return null;const ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{eo(!0),yield ro({walletConnector:to})}catch(lo){logger$8.error(lo)}finally{eo(!1)}}),so=jsxRuntimeExports.jsx(WalletIcon,{walletKey:to.key,style:{height:pixelToRem(io*iconRatio),width:pixelToRem(io*iconRatio)}}),co=no(oo?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description");return jsxRuntimeExports.jsxs("div",{className:"pending-signature__container","data-testid":"pending-signature-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so,iconSize:io,isSpinning:!0,indicator:"connected",className:"pending-signature__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("pending-signature__copy"),copykey:oo?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description",children:co}),oo&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:classNames("pending-signature__copy","pending-signature__copy--mini"),copykey:"dyn_pending_signature.phantom_ledger_warning",children:[jsxRuntimeExports.jsx("strong",{children:no("dyn_pending_signature.note")}),no("dyn_pending_signature.phantom_ledger_warning")]}),requiresTwoStepAuthentication(to)&&jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"pending-signature__button",onClick:ao,loading:Xr,buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_pending_signature.click_to_sign",children:no("dyn_pending_signature.click_to_sign")})]})},QrCodeView=()=>{var Xr;const{theme:{theme:eo}}=useThemeContext(),{name:to}=eo,{qrcodeUri:ro,desktopUri:no,selectedWalletConnector:io}=useInternalDynamicContext(),{walletBook:oo}=useWalletBookContext();if(!io)return null;const ao=jsxRuntimeExports.jsx(WalletIcon,{walletKey:io.key,style:{height:pixelToRem(32),width:pixelToRem(32)}});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:ro,desktopUri:no,accentColor:to==="dark"?eo.colors.textPrimary:(Xr=getWalletPrimaryColor(oo,io.key))!==null&&Xr!==void 0?Xr:"",icon:ao,showCopyToClipboardButton:io.isWalletConnect,walletConnector:io})},PendingConnectView=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext(),{t:eo}=useTranslation(),to=94,ro=jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr==null?void 0:Xr.key,style:{height:pixelToRem(to*iconRatio),width:pixelToRem(to*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"pending-connect__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:to,isSpinning:!0,className:"pending-connect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"pending-connect__copy-text",copykey:isMobile$1()?"dyn_pending_connection.mobile":"dyn_pending_connection.computer",children:isMobile$1()?eo("dyn_pending_connection.mobile"):eo("dyn_pending_connection.computer")})]})},SandboxMaximumThresholdReached=()=>{const{t:Xr}=useTranslation(),{goToInitialView:eo}=useViewContext(),to=()=>{eo()};return jsxRuntimeExports.jsxs("div",{className:"sandbox-threshold__main",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sandbox-threshold__title",children:Xr("dyn_sandbox_maximum_threshold.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"sandbox-threshold__description",children:Xr("dyn_sandbox_maximum_threshold.description")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:to,className:"sandbox-threshold__button",expanded:!0,buttonPadding:"large",children:Xr("dyn_sandbox_maximum_threshold.button")})]})},Toggle=Xr=>{var{icon:eo,variant:to="primary",className:ro}=Xr,no=__rest$7(Xr,["icon","variant","className"]);return jsxRuntimeExports.jsxs("label",{className:classNames("toggle",ro),children:[jsxRuntimeExports.jsx("input",Object.assign({type:"checkbox",className:"toggle--input"},no)),jsxRuntimeExports.jsx("div",{className:classNames("toggle--content",`toggle--content__variant-${to}`),children:jsxRuntimeExports.jsx("div",{className:"toggle--knob",children:eo})})]})},HardwareWalletToggle=({connectors:Xr,label:eo,copykey:to})=>{const ro=jsxRuntimeExports.jsx(Toggle,{defaultChecked:Xr.some(no=>no.isHardwareWalletEnabled),onChange:no=>{Xr.forEach(io=>{io.isHardwareWalletEnabled=no.target.checked})},"data-testid":"hardware-wallet-toggle",icon:jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgCheck,{})})});return jsxRuntimeExports.jsx(ListTile,{trailing:ro,children:jsxRuntimeExports.jsx("span",{copykey:to,children:eo})})},SelectHardwareWalletView=({wallet:Xr,onSelectWallet:eo})=>{const{t:to}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"select-hardware-wallet-view",children:jsxRuntimeExports.jsxs("div",{className:"select-hardware-wallet-view__container",children:[jsxRuntimeExports.jsx(Icon,{className:"select-hardware-wallet-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr.key})}),jsxRuntimeExports.jsx(Typography,{className:"select-hardware-wallet-view__text",as:"p",color:"secondary",variant:"body_normal",copykey:"dyn_select_hardware_wallet.description",children:to("dyn_select_hardware_wallet.description")}),isHardwareWalletConnector(Xr.walletConnector)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:[Xr.walletConnector],copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:to("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",onClick:()=>eo==null?void 0:eo(Xr),copykey:"dyn_select_hardware_wallet.button",dataTestId:"select-hardware-wallet-connect-button",children:to("dyn_select_hardware_wallet.button")})]})})},WalletGroupViewLayout=({icon:Xr,title:eo,titleCopyKey:to,children:ro})=>jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{className:"wallet-group-view-layout__icon",Icon:Xr,iconSize:96}),jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__body",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-group-view-layout__title",as:"p",color:"secondary",variant:"body_normal",copykey:to,children:eo}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:ro})]})]}),WalletGroupItem$1=({groupKey:Xr,wallet:eo,onClick:to})=>{const{recommendedWallets:ro}=useInternalDynamicContext(),{walletBook:no}=useWalletBookContext(),io=findWalletGroupOverride(no,Xr,eo.key),oo=findWalletBookWallet(no,eo.key),ao=(io==null?void 0:io.brand)||(oo==null?void 0:oo.brand),so=(io==null?void 0:io.name)||(oo==null?void 0:oo.name),co=ao?jsxRuntimeExports.jsx(BrandIcon,{brand:ao,walletKey:eo.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}):null,lo=getWalletListItemLabel({recommendedWallets:ro,wallet:eo}),fo=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:lo&&jsxRuntimeExports.jsx(Badge,{dot:!lo.isRecommended,variant:lo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:lo.label})})});return jsxRuntimeExports.jsx(ListTile,{onClick:to,leading:co,trailing:fo,children:so})},SelectWalletInWalletGroupView=()=>{const{selectedWalletGroup:Xr}=useWalletGroupContext(),{walletBook:eo}=useWalletBookContext(),{handleWalletItemClick:to}=useWalletItemActions(),{t:ro}=useTranslation();if(!Xr)throw new Error("Could not access WalletGroup view without selected group");const no=getWalletGroup(eo,Xr==null?void 0:Xr.key);return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:no.key}),title:ro("dyn_select_wallet.description",{walletName:no.name}),titleCopyKey:"dyn_select_wallet.description",children:Xr.groupedWallets.map((io,oo)=>jsxRuntimeExports.jsx(WalletGroupItem$1,{groupKey:Xr.key,wallet:io,onClick:()=>to(io)},`${io.key}_${oo}`))})};var _path$3,_excluded$3=["title","titleId"];function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$3(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignInWithPhone=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$3(eo,_excluded$3);return reactExports.createElement("svg",_extends$5({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$3||(_path$3=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm-7.91-50h14.892a4.092 4.092 0 0 1 4.09 4.09v27.82a4.092 4.092 0 0 1-4.09 4.09H24.09A4.092 4.092 0 0 1 20 45.91V18.09A4.092 4.092 0 0 1 24.09 14Zm4.992 31.91a2.451 2.451 0 0 0 2.454 2.454 2.451 2.451 0 0 0 2.455-2.455 2.451 2.451 0 0 0-2.455-2.454 2.451 2.451 0 0 0-2.454 2.454Zm-5.81-4.092H39.8V18.91H23.273v22.91Z",fill:"#4779FF"})))};const PhoneIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithPhone,Object.assign({},Xr,{"data-testid":"sign-in-with-sms-icon"}))}),useSmsVerification=Xr=>{const{verificationUUID:eo,displayedDestination:to,retryData:ro}=useVerification(),{environmentId:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),[ao,so]=reactExports.useState(),{verifyOtp:co}=useOtpVerificationRequest(),{generateSessionKey:lo,shouldRegisterSessionKeysOnSignin:fo}=useEmbeddedWalletSessionKeys(no),{initAuth:ho,completeAuth:go,cancelAuth:yo}=useUserAuth({authMethod:"sms"}),vo=reactExports.useRef(!1);useOnUnmount(()=>{const jo=ro??{dialCode:"",iso2:"",phone:""};ro||logger$8.warn("WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined"),dynamicEvents.emit("smsVerificationResult",vo.current,jo),vo.current||dynamicEvents.emit("authFailure",{option:jo,phone:jo,type:"sms"},"user-cancelled")});const wo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(so(void 0),!eo||!ro){yield yo();return}retrySmsVerification({environmentId:no,isoCountryCode:ro.iso2,phoneCountryCode:ro.dialCode,phoneNumber:de$4({dialCode:ro.dialCode,phone:ro.phone}),verificationUUID:eo})}),Eo=reactExports.useCallback(jo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!eo||!io&&!oo){yield yo();return}yield go({onValidUpdatedJwt:()=>vo.current=!0,updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return co(jo,"sms",eo)})})}),[yo,go,io,oo,eo,co]),ko=reactExports.useCallback(jo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!eo){yield yo();return}yield ho({onError:Mo=>so(Mo),onVerifySuccess:()=>{vo.current=!0},options:{phone:ro},showSuccessMessage:!0,verifyFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){let Mo;return fo()&&(Mo=(yield lo()).publicKey),signInWithSmsVerification({environmentId:no,sessionPublicKey:Mo,verificationToken:jo,verificationUUID:eo})})})}),[eo,ho,ro,yo,no]),{isLoading:Ao,mutate:Po}=useMutation(Xr==="login"?ko:Eo,{onFailure:jo=>{so(jo)}});return{error:ao,formattedPhone:to??"",isLoading:Ao,isValid:vo.current,onSubmit:Po,retryOneTimePassword:wo,setError:so}},SmsVerification=()=>{const{view:Xr}=useViewContext(),{handleLogOut:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),ro=Xr.type==="login-with-sms-verification",{error:no,formattedPhone:io,isLoading:oo,isValid:ao,onSubmit:so,retryOneTimePassword:co,setError:lo}=useSmsVerification(ro?"login":"verify-only"),fo=ro?void 0:jsxRuntimeExports.jsx(TextButton,{className:"sms-verification__log-out",onClick:eo,copykey:"dyn_otp_verification.log_out_button",children:to("dyn_otp_verification.log_out_button")});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:PhoneIcon,displayedDestination:io,error:no,hideHeader:!0,isLoading:oo,onPinComplete:so,isValid:ao,retryHandler:co,onPinChange:()=>lo(void 0),appendToEnd:fo})},SocialRedirectView=()=>{const{socialProvider:Xr,signInProvider:eo}=useSocialRedirectContext(),to=useFindSocialIcon(),{t:ro}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:classNames("social-redirect-view__container"),children:[Xr&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:to(Xr),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("social-redirect-view__title"),copykey:"dyn_social_redirect.logging_in",children:ro("dyn_social_redirect.logging_in")}),eo!==SignInProviderEnum.MagicLink&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"powered-by-dynamic"})]})},SocialWrongAccountView=()=>{const[Xr,eo]=reactExports.useState(!1),{socialWalletConnector:to,socialAccount:ro}=useSocialRedirectContext(),{t:no}=useTranslation(),io=useFindSocialIcon();return!ro||!to?null:jsxRuntimeExports.jsxs("div",{className:classNames("social-wrong-account-view__container"),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:io(ro.oauthProvider),isSpinning:Xr,iconSize:64}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("social-wrong-account-view__title"),copykey:"dyn_login.wrong_social_account.title",children:no("dyn_login.wrong_social_account.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.subtitle",children:no("dyn_login.wrong_social_account.subtitle")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",className:classNames("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.retry_title",children:[no("dyn_login.wrong_social_account.retry_title"),jsxRuntimeExports.jsx("b",{children:ro.oauthUsername})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"social-wrong-account-view__button",buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},disabled:Xr,onClick:()=>{eo(!0),to.connect(ro.oauthProvider)},copykey:"dyn_login.wrong_social_account.retry_button",children:no("dyn_login.wrong_social_account.retry_button")})]})},WalletCannotBeTransferredView=()=>{const{goToInitialView:Xr}=useViewContext(),{selectedWalletConnector:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),{data:ro}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const no=yield eo==null?void 0:eo.getConnectedAccounts();return shortenWalletAddress(no==null?void 0:no[0])}),{deps:[eo]});return jsxRuntimeExports.jsxs("div",{className:"wallet-cannot-be-transferred-view__container",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__title",as:"h6",variant:"title",color:"primary",weight:"medium",copykey:"dyn_wallet_link.cannot_link.title",children:to("dyn_wallet_link.cannot_link.title")}),jsxRuntimeExports.jsx("div",{className:"wallet-cannot-be-transferred-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo==null?void 0:eo.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__shorten-wallet-address",variant:"body_normal",weight:"regular",color:"primary",children:ro}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.cannot_link.description",children:to("dyn_wallet_link.cannot_link.description")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-cannot-be-transferred-view__transfer-alt-wallet-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:Xr,dataTestId:"wallet-cannot-be-transferred-view-transfer-alt-wallet",copykey:"dyn_wallet_link.cannot_link.link_other_button",children:to("dyn_wallet_link.cannot_link.link_other_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-cannot-be-transferred-view-cancel",buttonPadding:"small",buttonClassName:"wallet-cannot-be-transferred-view__cancel",onClick:Xr,copykey:"dyn_wallet_link.cannot_link.cancel_button",children:to("dyn_wallet_link.cannot_link.cancel_button")})]})},WalletGroupItem=({wallet:Xr,onClick:eo})=>{const[to]=Xr.walletConnector.supportedChains,{walletBook:ro}=useWalletBookContext(),no=getChainInfoWithOverrides(to),io=Xr.group?findWalletGroupOverride(ro,Xr.group,Xr.key):void 0,oo=getWalletListItemLabel({wallet:Xr}),ao=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:oo&&jsxRuntimeExports.jsx(Badge,{dot:!oo.isRecommended,variant:oo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:oo.label})})}),so=reactExports.useMemo(()=>{const lo={height:pixelToRem(28),width:pixelToRem(28)};if(io!=null&&io.brand)return jsxRuntimeExports.jsx(BrandIcon,{brand:io.brand,walletKey:Xr.key,style:lo});const fo=getChainIcon(to);return jsxRuntimeExports.jsx(fo,{style:lo})},[to,Xr.key,io]),co=(io==null?void 0:io.name)||(no==null?void 0:no.displayName)||Xr.name;return jsxRuntimeExports.jsx(ListTile,{className:"chain-card",onClick:eo,leading:so,trailing:ao,children:co},Xr.key)},WalletGroupView=()=>{const{selectedWalletGroup:Xr}=useWalletGroupContext(),{walletBook:eo}=useWalletBookContext(),{handleWalletItemClick:to}=useWalletItemActions(),{t:ro}=useTranslation();if(!Xr)throw new Error("Could not access WalletGroup view without selected group");const no=getWalletGroup(eo,Xr==null?void 0:Xr.key),io=Xr.groupedWallets.map(({walletConnector:oo})=>oo).filter(oo=>isHardwareWalletConnector(oo)&&oo.canConnectWithHardwareWallet());return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:no.key}),title:ro("dyn_select_chain.description"),titleCopyKey:"dyn_select_chain.description",children:jsxRuntimeExports.jsxs("div",{className:"wallet-group__list",children:[!!io.length&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:io,copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:ro("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:Xr.groupedWallets.map((oo,ao)=>jsxRuntimeExports.jsx(WalletGroupItem,{wallet:oo,onClick:()=>to(oo)},`${oo.key}_${ao}`))})]})})},iconSize=64,WalletLockedView=()=>{const{handleLogOut:Xr,primaryWallet:eo,setShowAuthFlow:to,appName:ro}=useInternalDynamicContext(),{t:no}=useTranslation();if(!eo)return null;const io=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield eo.connector.connect(),to(!1)}catch{logger$8.info("could not connect wallet")}}),oo=jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.connector.key,style:{height:pixelToRem(iconSize*iconRatio),width:pixelToRem(iconSize*iconRatio)}});return jsxRuntimeExports.jsxs("div",{"data-testid":"wallet-locked-view",children:[jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,variant:"success",className:"wallet-locked-view__error-container",copykey:"dyn_wallet_locked.connect_continue",children:no("dyn_wallet_locked.connect_continue")}),jsxRuntimeExports.jsxs("div",{className:"wallet-locked-view__content",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:oo,iconSize,className:"wallet-locked-view__icon",isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",weight:"medium",className:"wallet-locked-view__title",copykey:"dyn_wallet_locked.title",children:no("dyn_wallet_locked.title")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_locked.subtitle",children:[no("dyn_wallet_locked.subtitle"),ro,"."]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:()=>io(),buttonClassName:"wallet-locked-view__button",copykey:"dyn_wallet_locked.connect",children:no("dyn_wallet_locked.connect")}),jsxRuntimeExports.jsx(Divider,{text:"Or"}),jsxRuntimeExports.jsx(TextButton,{className:"wallet-locked-view__log-out",onClick:Xr,copykey:"dyn_wallet_locked.logout",children:no("dyn_wallet_locked.logout")})]})]})},WalletRedirectView=()=>{const{t:Xr}=useTranslation(),{selectedWalletConnector:eo}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:classNames("wallet-redirect-view__container"),children:[eo&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.key}),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("wallet-redirect-view__title"),copykey:"dyn_wallet_redirect.loading",children:Xr("dyn_wallet_redirect.loading")}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"powered-by-dynamic"})]})},WalletSignSpinnerView=()=>{const{goToInitialView:Xr}=useViewContext(),{t:eo}=useTranslation(),{setMultiWalletWidgetState:to,setSelectedWalletConnectorKey:ro,selectedWalletConnector:no}=useInternalDynamicContext();if(!no)return null;const{key:io}=no,oo=96,ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){Xr(),to("idle"),ro(null),yield no==null?void 0:no.endSession()}),so=jsxRuntimeExports.jsx(WalletIcon,{walletKey:io,style:{height:pixelToRem(oo*iconRatio),width:pixelToRem(oo*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"wallet-sign-spinner__container","data-testid":"wallet-sign-spinner-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so,iconSize:oo,isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("wallet-sign-spinner__copy"),copykey:"dyn_wallet_transfer.sign.spinner.confirm_transfer",children:eo("dyn_wallet_transfer.sign.spinner.confirm_transfer")}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",buttonVariant:"primary",buttonClassName:"wallet-sign-spinner__button",onClick:()=>ao(),typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_wallet_transfer.sign.spinner.cancel",children:eo("dyn_wallet_transfer.sign.spinner.cancel")})]})},useTransferWallet=()=>{const{displaySiweStatement:Xr,environmentId:eo,user:to,primaryWallet:ro,setPrimaryWalletId:no}=useInternalDynamicContext(),{addedWalletsIds:io}=useInternalUserWallets(),oo=reactExports.useCallback((ao,so)=>{const co=ao.key;if(so.lastVerifiedCredentialId){if(!ro){no(so.lastVerifiedCredentialId);return}const lo=ro.connector.key;co===lo&&no(so.lastVerifiedCredentialId),ro.connector.connectedChain==="FLOW"&&ao.connectedChain==="FLOW"&&no(so.lastVerifiedCredentialId)}},[ro,no]);return reactExports.useCallback(ao=>__awaiter$j(void 0,void 0,void 0,function*(){if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);const{overrideSiweStatement:so,walletConnector:co}=ao,lo="nonce"in ao?Object.assign(Object.assign({},ao),{displaySiweStatement:Xr,environmentId:eo,siweStatement:so,walletProvider:getWalletProvider(co)}):Object.assign(Object.assign({},ao),{displaySiweStatement:Xr,environmentId:eo,nonce:"",siweStatement:ao.overrideSiweStatement,walletProvider:getWalletProvider(co)}),fo=yield getVerifyArgs(lo),ho=yield transferWallet(eo,fo);if(!ho)throw new DynamicError("Error transferring wallet.");oo(co,ho);const go=ho.lastVerifiedCredentialId;go&&io.current.push(go)}),[io,Xr,eo,oo,to])},WalletUsedView=()=>{const[Xr,eo]=reactExports.useState(!1),{t:to}=useTranslation(),{setErrorMessage:ro}=useErrorContext(),{loading:no,setLoading:io}=useLoadingContext(),{setView:oo,goToInitialView:ao}=useViewContext(),{setShowAuthFlow:so,appName:co,siweStatement:lo,setMultiWalletWidgetState:fo,connectWallet:ho,selectedWalletConnector:go,isSingleWalletAccount:yo,consumeNonce:vo,handleLogOut:wo}=useInternalDynamicContext(),{data:Eo}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const jo=yield go==null?void 0:go.getConnectedAccounts();return jo==null?void 0:jo[0]}),{deps:[go]}),ko=shortenWalletAddress(Eo),Ao=useTransferWallet(),Po=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!go)return;const jo=vo();if(!jo){ao(),ro("missing-nonce");return}fo("awaiting_signature",void 0,"transferring_wallet"),io(!0),oo("wallet-sign");const Mo=getSiweStatement({appName:co,siweStatement:lo});try{const No=yield ho(go);if(!(No!=null&&No.address))return;go.key==="phantom"&&isMobile$1()&&StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:Xr,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_transfer"}),yield Ao({nonce:jo,overrideSiweStatement:Mo,publicWalletAddress:No.address,skipEmptyAccountCheck:Xr,walletConnector:go}),so(!1)}catch(No){logger$8.error(No),so(!1,{emitCancelAuth:!0})}finally{io(!1),fo("idle")}});return jsxRuntimeExports.jsxs("div",{className:"wallet-used-view__container",children:[jsxRuntimeExports.jsx("div",{className:"wallet-used-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:go==null?void 0:go.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__shorten-wallet-address",variant:"body_normal",weight:"medium",color:"primary",children:ko}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.existent_account.warning",children:to("dyn_wallet_link.existent_account.warning")}),yo&&jsxRuntimeExports.jsxs("label",{htmlFor:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-label",children:[jsxRuntimeExports.jsx(Checkbox,{id:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-container",defaultChecked:Xr,onChange:()=>eo(!Xr),ariaLabel:"skip empty account check"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_wallet_link.existent_account.acceptance",children:to("dyn_wallet_link.existent_account.acceptance")})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-used-view__accept-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:()=>Po(),disabled:!Xr&&yo||no,dataTestId:"wallet-used-view-transfer-wallet",copykey:"dyn_wallet_link.confirm_button",children:to("dyn_wallet_link.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-used-view-log-out",buttonPadding:"small",buttonClassName:"wallet-used-view__logout",onClick:wo,copykey:"dyn_wallet_link.log_out_button",children:to("dyn_wallet_link.log_out_button")})]})};var _path$2,_excluded$2=["title","titleId"];function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$2(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDomain=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$2(eo,_excluded$2);return reactExports.createElement("svg",_extends$4({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$2||(_path$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-4.928-29.305h9.717c-.207 4.908-1.087 9.168-2.3 12.206-.7 1.756-1.433 2.9-2.036 3.54-.245.26-.42.387-.523.448-.102-.06-.277-.189-.522-.449-.603-.638-1.336-1.783-2.037-3.539-1.213-3.038-2.092-7.298-2.3-12.206Zm2.3-16.655c-1.242 3.108-2.134 7.497-2.314 12.55h9.744c-.18-5.053-1.071-9.442-2.313-12.55-.7-1.756-1.433-2.9-2.036-3.54-.245-.26-.42-.388-.523-.449-.102.061-.277.19-.522.45-.603.638-1.336 1.783-2.037 3.539ZM14.5 30.59h8.951c.216-6.53 1.541-12.27 3.503-16.036C20.23 16.789 15.22 23.03 14.5 30.59Zm.036 4.105h8.928c.25 6.387 1.563 11.993 3.49 15.692-6.622-2.201-11.582-8.288-12.418-15.692Zm35.789 0h-8.928c-.25 6.387-1.563 11.993-3.49 15.692 6.621-2.201 11.581-8.288 12.418-15.692Zm.125-2.224v.066-.133.066Zm-9.04-1.88h8.95c-.719-7.56-5.73-13.802-12.454-16.037 1.962 3.766 3.288 9.507 3.503 16.036Zm-9.09 20.35c0-.001.008-.004.023-.007-.015.006-.023.008-.023.007Zm.198-.007a.072.072 0 0 1 .023.007s-.008-.001-.023-.007ZM32.541 14s-.008.004-.023.007c.015-.006.023-.008.023-.007Zm-.198.007A.068.068 0 0 1 32.32 14s.008.001.023.007Z",fill:"#4779FF"})))};const PasskeyNewDomainDetectedView=()=>{const{t:Xr}=useTranslation(),{projectSettings:eo}=useInternalDynamicContext(),to=reactExports.useMemo(()=>{var ro;const no=getEnabledEmbeddedWalletsAuthenticators((ro=eo==null?void 0:eo.sdk.embeddedWallets)===null||ro===void 0?void 0:ro.supportedSecurityMethods);return Object.keys(no).filter(io=>io!=="email")},[eo==null?void 0:eo.sdk.embeddedWallets]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_new_domain_detected.title",children:Xr("dyn_passkey_new_domain_detected.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-new-domain-detected",children:[jsxRuntimeExports.jsx(SvgDomain,{className:"passkey-new-domain-detected__header"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:Xr("dyn_passkey_new_domain_detected.description")}),jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{supportedAuthenticators:to}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},viewToComponentMap={"access-blocked":AccessBlockedView,"account-exists":AccountExistsView,"bridge-next-wallet-connection":BridgeNextWalletConnectionView,"bridge-summary":BridgeSummaryView,"bridge-welcome":BridgeWelcomeView,captcha:CaptchaVerifyUser,"chainalysis-blocked-wallet":NoAccess,"collect-user-data":CollectUserDataView,"collect-user-data-login-no-wallet":CollectUserDataViewNoWallet,"create-password-view":CreatePasswordView,"email-wallet-otp-verification-view":EmailWalletOTPVerificationView,"embedded-reveal-account-view":EmbeddedRevealView,"embedded-reveal-view":EmbeddedRevealView,"embedded-wallet-auth-choice":EmbeddedAuthChoice,"farcaster-connect-view":FarcasterConnectView,"gate-blocked-wallet":NoAccess,"global-wallet-confirm":GlobalWalletConfirmView,"global-wallet-info":GlobalWalletInfoView,"global-wallet-malicious":GlobalWalletMaliciousView,"login-with-email-or-wallet":LoginView,"login-with-email-or-wallet-full-wallet-list":WalletList,"login-with-email-verification":EmailVerification,"login-with-sms-verification":SmsVerification,"login-with-wallet-only":LoginView,"merge-user-accounts":MergeUserAccountsView,"merge-user-accounts-conflicts":MergeUserAccountsConflictsView,"merge-user-accounts-with-same-email":MergeUserAccountsWithSameEmailView,"mfa-choose-device":MfaChooseDeviceView,"mfa-display-backup-codes":MfaDisplayBackupCodesView,"mfa-recovery":MfaRecoveryView,"mfa-secure-device":MfaSecureDeviceView,"mfa-secure-device-help":MfaSecureDeviceHelper,"mfa-verification":MfaVerificationView,"mobile-wallet-redirect-view":MobileWalletRedirectView,"multi-wallet-wallet-list":WalletList,"network-not-supported":NetworkNotSupported,"network-not-supported-manual":NetworkNotSupportedSwitchManual,"no-access":NoAccess,"no-qr-not-installed":NoQrNotInstalledView,"passkey-intro":PasskeyIntroView,"passkey-new-domain-detected":PasskeyNewDomainDetectedView,"passkey-recovery-add-email":AddRecoveryEmail,"passkey-recovery-bundle":PasskeyBundleRecovery,"passkey-recovery-complete":PasskeyCompleteRecovery,"passkey-recovery-start":PasskeyInitRecovery,"pending-connect":PendingConnectView,"pending-signature":PendingSignatureView,"pending-signature-without-back-button":PendingSignatureView,"qr-code":QrCodeView,"rename-passkey":RenamePasskeyView,"sandbox-maximum-threshold-reached":SandboxMaximumThresholdReached,"select-hardware-wallet":SelectHardwareWalletView,"select-wallet-in-wallet-group":SelectWalletInWalletGroupView,"social-redirect-view":SocialRedirectView,"social-wrong-account":SocialWrongAccountView,"verify-email":EmailVerification,"verify-sms":SmsVerification,"wait-for-email-confirmation-view":EmailConfirmationWaitingView,"wallet-cannot-be-transferred":WalletCannotBeTransferredView,"wallet-claim-intro":CoinbaseMPCClaimIntro,"wallet-connect-mobile-wallets-list":()=>jsxRuntimeExports.jsx(WalletList,{isWalletConnectList:!0}),"wallet-group":WalletGroupView,"wallet-list":WalletList,"wallet-locked-view":WalletLockedView,"wallet-redirect-view":WalletRedirectView,"wallet-sign":WalletSignSpinnerView,"wallet-used":WalletUsedView},RenderView=()=>{const{view:Xr}=useViewContext(),eo=viewToComponentMap[Xr.type];return jsxRuntimeExports.jsx(eo,Object.assign({},Xr.props||{}))};function styleInject(Xr,eo){eo===void 0&&(eo={});var to=eo.insertAt;if(!(typeof document>"u")){var ro=document.head||document.getElementsByTagName("head")[0],no=document.createElement("style");no.type="text/css",to==="top"&&ro.firstChild?ro.insertBefore(no,ro.firstChild):ro.appendChild(no),no.styleSheet?no.styleSheet.cssText=Xr:no.appendChild(document.createTextNode(Xr))}}var css_248z='@layer dynamic-sdk-styles{#argent-mobile-modal-overlay,iframe[src*="wallet-dev.blocto.app"],iframe[src*="wallet-staging.blocto.app"],iframe[src*="wallet-testnet.blocto.app"],iframe[src*="wallet.blocto.app"]{z-index:2147483647!important}iframe[id*=dyn-passkey-recovery-element-id],iframe[id*=dyn-secure-enclave-element-id]{display:none!important}#pera-wallet-connect-modal-wrapper{position:relative;z-index:2147483647!important}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff) format("woff")}@layer light-theme-default{:root{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme-brand=bold],:root[data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme-brand=subtle],:root[data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}@media (prefers-color-scheme:light){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}:root [data-dynamic-theme=light]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=light][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=light][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}@layer dark-theme-default{@media (prefers-color-scheme:dark){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}:root [data-dynamic-theme=dark]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}.dynamic-shadow-dom{position:relative}#dynamic-tooltips{left:0;position:absolute;top:0}@supports (overflow:clip){.dynamic-no-scroll{overflow:clip}}@supports not (overflow:clip){.dynamic-no-scroll{overflow:hidden}}}';styleInject(css_248z);const useVerifyOnAwaitingSignature=()=>{const{awaitingSignatureState:Xr,multiWalletWidgetState:eo,setMultiWalletWidgetState:to,legacyIsVerifying:ro,setLegacyIsVerifying:no,selectedWalletConnector:io}=useInternalDynamicContext(),oo=useConnectAndSign(),ao=reactExports.useRef(!1),so=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(logger$8.debug("runConnectAndSign",{selectedWalletConnector:io}),!!io){ao.current=!0,no(!0);try{yield oo({walletConnector:io})}catch(co){logger$8.error(co)}to("idle"),no(!1),ao.current=!1}}),[io==null?void 0:io.key,no,to,oo]);reactExports.useEffect(()=>{!ro&&!ao.current&&eo==="awaiting_signature"&&io&&Xr==="linking_new_wallet"&&!requiresTwoStepAuthentication(io)&&so()},[so,Xr,ro,eo,io==null?void 0:io.key,no,to]),useInternalDynamicEvents("triggerConnectAndSign",so)},viewsToDisableCloseOnOverlayClick=["email-wallet-otp-verification-view","social-redirect-view","passkey-intro"],Main=()=>{const{selectedWalletConnector:Xr,linkedWallets:eo,projectSettings:to,setShowAuthFlow:ro,showAuthFlow:no,walletConnectorOptions:io,clearStatesOnBackClick:oo,user:ao,disconnectWallet:so,authMode:co,connectedWallets:lo,handleLogOut:fo}=useInternalDynamicContext(),{view:ho,goToInitialView:go}=useViewContext(),{setDeniedAddress:yo,setDeniedOauthProvider:vo}=useAccessDeniedContext(),{setExistentAccountData:wo}=useAccountExistsContext(),{setSocialProvider:Eo}=useSocialRedirectContext();usePreventPageScroll(no);const ko=useUserWallets(),Ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){var xo;if(!viewsToDisableCloseOnOverlayClick.includes(ho.type)){if(!((xo=ho.events)===null||xo===void 0)&&xo.onClose){ho.events.onClose();return}(ho.type==="network-not-supported"||ho.type==="network-not-supported-manual")&&ko.length===1&&(yield fo()),ho.type==="farcaster-connect-view"&&(Eo(void 0),dynamicEvents.emit("farcasterConnectCancelled")),ro(!1,{emitCancelAuth:!0}),yo(""),vo(void 0),wo(void 0),oo()}}),Po=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const xo=["network-not-supported","network-not-supported-manual"];if(!isConnectOnly(ao,co)||!xo.includes(ho.type)||!Xr)return;const uo=lo.find(po=>po.connector.key===Xr.key);uo&&(isSupportedNetwork({network:yield uo.connector.getNetwork(),walletConnector:uo.connector})||so(uo.id))}),[Xr,co,lo,so,ao,ho]),jo=reactExports.useCallback(()=>{go()},[go]);useVerifyOnAwaitingSignature();const{handleAlreadyConnectedWallet:Mo,handleCustodialWalletClick:No,handleInstalledExtensionClick:Do,handleMobileWalletClick:Fo,handleUninstalledClick:Xo}=useWalletItemActions(),Lo=xo=>__awaiter$j(void 0,void 0,void 0,function*(){ro(!0),isSelectedWalletAlreadyConnected(eo,xo,ao)?Mo(xo):xo.canConnectViaCustodialService?No(xo):isMobile$1()?Fo(xo):xo.isInstalledOnBrowser()?Do(xo):Xo(xo)});reactExports.useEffect(()=>{const xo=StorageService.getItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY);if(io!=null&&io.length&&xo){const uo=io.find(po=>po.key===xo);uo!=null&&uo.walletConnector&&Lo(uo.walletConnector),StorageService.removeItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY)}},[io]);const Bo=no&&!!to;return jsxRuntimeExports.jsx(FooterAnimationContextProvider,{children:jsxRuntimeExports.jsx(Portal,{zIndex:authModalZIndex,isShown:Bo,handleClose:Ao,withBackdrop:!0,transitionEvents:{onExiting:Po,onUnmount:jo},children:jsxRuntimeExports.jsx(PopperProvider,{children:jsxRuntimeExports.jsx(DynamicAuthModal,{transitionProps:{isShown:Bo},onClose:Ao,projectSettings:to,children:jsxRuntimeExports.jsx(RenderView,{})})})})})},DynamicAuthFlow=()=>jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(Main,{})}),lastAuthenticatedAccount=Xr=>Xr.verifiedCredentials.find(eo=>eo.id===Xr.lastVerifiedCredentialId),useGlobalLoading=({authMode:Xr,connectedInfo:eo,connectedWallets:to,projectSettings:ro,primaryWalletId:no,primaryWallet:io,user:oo,isLoadingUserFromCookie:ao,walletBook:so,enableInstrumentation:co,appName:lo,environmentId:fo})=>{var ho,go;const yo=reactExports.useRef(!1),vo=reactExports.useRef(new Date().getTime()),{sessionValidation:wo}=useLoadingAndLifecycle(),Eo=()=>{if(!yo.current&&(yo.current=!0,logger$8.debug("[useGlobalLoading] SDK finished loading",{authMode:Xr,enableInstrumentation:co,primaryWallet:io,user:oo}),co)){const Fo=new Date().getTime()-vo.current;logger$8.instrument(`SDK loaded in (ms) ${Fo}`,{appName:lo,environmentId:fo,key:"sdkHasLoaded",primaryWalletId:no,time:Fo,userId:oo==null?void 0:oo.userId})}};if(yo.current)return!0;const ko=!Object.keys((ho=so==null?void 0:so.wallets)!==null&&ho!==void 0?ho:{}).length,Ao=!ro,Po=ao,Mo=!!((no||oo&&((go=lastAuthenticatedAccount(oo))===null||go===void 0?void 0:go.format)==="blockchain")&&!io),No=Xr==="connect-only"&&eo&&to.length===0,Do=!wo;return logger$8.logVerboseTroubleshootingMessage("[useGlobalLoading] SDK loading",{isConnectOnlyWalletsLoading:No,isPrimaryWalletLoading:Mo,isProjectSettingsLoading:Ao,isUserLoading:Po,isValidatingSession:Do,isWalletBookLoading:ko}),!ko&&!Ao&&!Po&&!Mo&&!No&&!Do&&Eo(),yo.current},usePrefetch=({as:Xr,href:eo,id:to,type:ro})=>{if(isSSR()||document.head.querySelector(`#${to}`))return;const io=document.createElement("link");io.setAttribute("id",to),io.setAttribute("rel","prefetch"),io.setAttribute("href",eo),io.setAttribute("as",Xr),io.setAttribute("type",ro),document.head.insertAdjacentElement("beforeend",io)},fetchNonce=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{return(yield sdkApi$1().getNonce({environmentId:Xr})).nonce}catch{return}}),validateLocalStorageExpiry=Xr=>!(!Xr||new Date().getTime()>Xr.expiry),useFetchNonce=(Xr,eo=2)=>{const[to,ro,no]=useLocalStorage(NONCE_STORAGE_KEY,void 0,validateLocalStorageExpiry),io=(to==null?void 0:to.value)!==""&&(to==null?void 0:to.value)!==void 0;to&&to.environmentId&&to.environmentId!==Xr&&no(),usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return fetchNonce(Xr).then(ao=>{if(!ao)throw new DynamicError("Nonce is not defined");const so=new Date().getTime()+6e4*60*24;return{environmentId:Xr,expiry:so,value:ao}})}),{deps:[Xr,io],enabled:!io,initialData:void 0,onResolve:ro,retries:eo});const oo=reactExports.useCallback(()=>{const ao=to==null?void 0:to.value;return no(),ao},[no,to==null?void 0:to.value]);return{consumeNonce:()=>oo()}},useSetWalletConnectorVerifiedCredentials=(Xr,eo)=>{!Xr||!(eo!=null&&eo.length)||eo.forEach(to=>{to.walletConnector.setVerifiedCredentials(Xr.verifiedCredentials)})},handleStoreAndEnvironmentMismatch=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,logout:to}){const ro=getEnvironmentId();return!ro||eo===ro?!0:(yield to("store and environment are out of sync",{currentEnvId:eo,storedEnvId:ro}),setEnvironmentId(eo),!1)}),handleUserDataOutOfSync=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,logout:to}){const ro=isCookieEnabled$1(),no=getAuthToken(),io=getUser();if(no||!io)return!0;if(io&&!no&&ro){try{yield getAuthenticatedUser({environmentId:eo})}catch(oo){if(oo instanceof CookieInvalidError)return yield to("user auth cookie invalid",{authToken:no,user:io}),!1}return!0}return yield to("user data out of sync",{authToken:no,user:io}),!1}),useValidateSession=({environmentId:Xr,handleLogOut:eo})=>{const to=reactExports.useCallback((no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){return logger$8.debug(`Logging out due to invalid session - Reason: ${no}`,Object.assign({},io)),eo()}),[eo]),ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const no={environmentId:Xr,logout:to};yield Promise.all([handleStoreAndEnvironmentMismatch(no),handleUserDataOutOfSync(no)]),setLoadingAndLifecycle({sessionValidation:!0})}),[Xr,to]);useEffectOnce(()=>{ro()}),useInternalDynamicEvents("triggerSessionValidation",ro)},serializeWalletConnectors=Xr=>{try{return Xr?Xr.map(eo=>eo.name):void 0}catch(eo){logger$8.error("error serializing walletConnectors",eo);return}};class ConnectorSetupError extends DynamicError{constructor(eo,to){super(`${eo} is enabled but ${to} is not in your walletConnectors list. See https://docs.dynamic.xyz/react-sdk/wallet-connectors for more information.`)}}const magicEmailOtpWalletConnectorKey="magicemailotp",magicSocialWalletConnectorKey="magicsocial",verifyMagicIsSetup=(Xr,eo)=>{var to;const ro=isProviderEnabled((to=Xr.providers)!==null&&to!==void 0?to:[],ProviderEnum.MagicLink),no=eo.some(({key:io})=>[magicEmailOtpWalletConnectorKey,magicSocialWalletConnectorKey].includes(io));if(ro&&!no)throw new ConnectorSetupError("Magic","MagicWalletConnectors")},zeroDevWalletConnectorKey="zerodev",verifyZeroDevIsSetup=(Xr,eo)=>{var to;const ro=isProviderEnabled((to=Xr.providers)!==null&&to!==void 0?to:[],ProviderEnum.Zerodev),no=eo.some(({key:io})=>io===zeroDevWalletConnectorKey);if(ro&&!no)throw new ConnectorSetupError("ZeroDev","ZeroDevSmartWalletConnectors")},verifyRequiredConnectorsAreSetup=(Xr,eo)=>{verifyMagicIsSetup(Xr,eo),verifyZeroDevIsSetup(Xr,eo)},useCreateWalletConnectorOptions=({projectSettings:Xr,appLogoUrl:eo,appName:to,coinbaseWalletPreference:ro,deepLinkPreference:no,flowNetwork:io,mobileExperience:oo,networkConfigurations:ao,walletBook:so,walletUiUtils:co,walletConnectorsProp:lo,walletConnectPreferredChains:fo,walletConnectorExtensions:ho})=>{const go=reactExports.useMemo(()=>{var wo;return(wo=serializeWalletConnectors(lo))===null||wo===void 0?void 0:wo.join(",")},[lo]),yo=reactExports.useMemo(()=>Object.keys(so??{}).length,[so]),vo=reactExports.useMemo(()=>!Xr||!Object.keys(so??{}).length||!ao?[]:getWallets$1({getSupportedWalletOpts:{appLogoUrl:eo,appName:to,coinbaseWalletPreference:ro,deepLinkPreference:no,flowNetwork:io,mobileExperience:oo,networkConfigurations:ao,settings:Xr,skipMemo:!0,walletBook:so,walletConnectPreferredChains:fo,walletConnectorsProp:lo??[],walletUiUtils:co},walletConnectorExtensions:ho}),[eo,to,Xr,go,fo,io,yo,ao]);return reactExports.useEffect(()=>{!Xr||vo.length===0||(verifyRequiredConnectorsAreSetup(Xr,vo.map(({walletConnector:wo})=>wo)),setWalletConnectorOptions(vo))},[vo,Xr]),{walletConnectorOptions:vo}},shouldManuallyReconnectOnRefresh=Xr=>Xr.connectedChain==="STARK"||Xr.connectedChain==="FLOW",convertLegacyPhantomLedgerConnector=Xr=>Object.assign(Object.assign({},Xr),{walletName:"phantom",walletProperties:{hardwareWallet:HardwareWalletEnum.Ledger}}),createLinkedWalletsFromWalletOptions=({user:Xr,walletConnectorOptions:eo,primaryWalletId:to})=>!eo||!Xr?[]:Xr.verifiedCredentials.map(convertLegacyPhantomLedger).map(ro=>{var no,io;const oo=findWalletOptionFor(ro,eo);return!oo||(ro.id===to&&shouldManuallyReconnectOnRefresh(oo.walletConnector)&&oo.walletConnector.connect(),((no=ro.walletProperties)===null||no===void 0?void 0:no.hardwareWallet)===HardwareWalletEnum.Ledger&&isHardwareWalletConnector(oo.walletConnector)&&(oo.walletConnector.isHardwareWalletEnabled=!0),isOwnerOfASmartWallet(ro,Xr.verifiedCredentials))?null:ro.address&&ro.chain?(ro.walletProvider===WalletProviderEnum.SmartContractWallet&&initializeSmartWallet({account:ro,primaryWalletId:to,verifiedCredentials:Xr.verifiedCredentials,walletConnectorOptions:eo}),oo.walletConnector.createWallet({additionalAddresses:ro.walletAdditionalAddresses,address:ro.address,chain:oo.walletConnector.connectedChain,connector:oo.walletConnector,id:ro.id,isAuthenticated:!0,key:(io=ro.walletName)!==null&&io!==void 0?io:oo.walletConnector.key})):null}).filter(ro=>ro!==null),convertLegacyPhantomLedger=Xr=>Xr.walletName==="phantomledger"?convertLegacyPhantomLedgerConnector(Xr):Xr,updateUserWalletsFromLinkedWallets=(Xr,eo)=>{const to=[...Xr],ro=new Set;for(const no of eo){ro.add(no.address);const io=to.findIndex(oo=>oo.address===no.address);if(io===-1){to.push(no);continue}to[io]=no}return to.filter(no=>ro.has(no.address))},useWalletConnectors=({authMode:Xr,connectedWallets:eo,walletConnectorOptions:to,setMultiWalletWidgetState:ro,primaryWalletId:no,setPrimaryWalletId:io,user:oo,canHaveMultipleWalletsConnected:ao})=>{const[so,co]=reactExports.useState(!1),lo=reactExports.useMemo(()=>oo?createLinkedWalletsFromWalletOptions({primaryWalletId:no,user:oo,walletConnectorOptions:to}):[],[oo,no,to]);logger$8.logVerboseTroubleshootingMessage("linkedWallets",lo);const fo=reactExports.useMemo(()=>Xr==="connect-and-sign"&&oo||Xr==="connect-only"&&lo.find(Eo=>isEmbeddedConnector(Eo.connector))?lo:eo??[],[Xr,eo,lo,oo]);logger$8.logVerboseTroubleshootingMessage("wallets",fo),reactExports.useEffect(()=>fo.forEach(Eo=>{Eo.connector.initEventListener()}),[fo]);const{setUserWallets:ho}=useInternalUserWallets();reactExports.useEffect(()=>{logger$8.logVerboseTroubleshootingMessage("[useWalletConnectors] will call setUserWallets",fo),ho(Eo=>updateUserWalletsFromLinkedWallets(Eo,fo))},[ho,fo]);const go=reactExports.useMemo(()=>{var Eo;return(Eo=fo.find(ko=>ko.id===no))!==null&&Eo!==void 0?Eo:null},[no,fo]),yo=reactExports.useMemo(()=>ao?fo.filter(Eo=>Eo.id!==no):[],[no,fo,ao]),vo=reactExports.useCallback(Eo=>__awaiter$j(void 0,void 0,void 0,function*(){const ko=fo.find(({id:Ao})=>Ao===Eo);if(!ko)throw new DynamicError(`Wallet with id: ${Eo} not found`);return ko}),[fo]),wo=reactExports.useCallback(Eo=>__awaiter$j(void 0,void 0,void 0,function*(){const ko=yield vo(Eo);if(!no){yield ko.connector.connect(),io(Eo);return}if(no!==Eo){if(isEmailWalletConnector(ko.connector)){const Ao=ko.connector,Po=localStorage.getItem("magic-link-email");Po&&Ao.setEmail(Po)}io(Eo),ro("idle")}}),[vo,no,ro,io]);return{primaryWallet:go,secondaryWallets:yo,setPrimaryWallet:wo,setShowQrcodeModal:co,showQrcodeModal:so,wallets:fo}},ConfirmationModal=({modalId:Xr,closeModal:eo,show:to,zIndex:ro,handleOnModalUnmount:no,children:io})=>jsxRuntimeExports.jsx(Portal,{elementId:Xr,handleClose:eo,isShown:to,zIndex:ro??authModalZIndex+1,withBackdrop:!0,transitionEvents:{onUnmount:no},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:io})})}),useConfirmationPortal=({onResolve:Xr,onReject:eo,defaultErrorMessage:to})=>{usePreventPageScroll(!0);const[ro,no]=reactExports.useState(!0),io=reactExports.useRef(null),oo=reactExports.useRef(null),ao=reactExports.useCallback(()=>{no(!1)},[no]),so=reactExports.useCallback(()=>{if(oo.current)return Xr(oo.current);const fo=io.current||new DynamicError(to||"Something went wrong");return eo(fo)},[Xr,eo,to]);return{closeModal:ao,handleOnModalUnmount:so,onError:(fo,ho=!1)=>{oo.current=null,io.current=fo,ho&&ao()},onSuccess:(fo,ho=!0)=>{io.current=null,oo.current=fo,ho&&ao()},show:ro}},CreatePasswordModal=({onResolve:Xr,onReject:eo,closeView:to})=>{const{onSuccess:ro,onError:no,show:io,handleOnModalUnmount:oo,closeModal:ao}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:eo,onResolve:Xr});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"create-password-modal",show:io,closeModal:ao,handleOnModalUnmount:oo,children:jsxRuntimeExports.jsx(CreatePasswordView,{closeView:to,onSuccess:ro,onError:no})})},EnterPasswordView=({mutation:Xr,onSuccess:eo,onError:to,closeView:ro=!0})=>{const{setShowAuthFlow:no}=useInternalDynamicContext(),[io,oo]=reactExports.useState(""),[ao,so]=reactExports.useState("password"),{t:co}=useTranslation(),{mutate:lo,isLoading:fo,hasError:ho}=useMutation(()=>Xr(io),{onFailure:to,onSuccess:()=>{ro&&no(!1),eo==null||eo(io)}}),go=()=>{if(to){to==null||to(co("dyn_enter_password.error.invalid_password"));return}no(!1)},yo=ho?co("dyn_enter_password.error.invalid_password"):void 0,vo=jsxRuntimeExports.jsx(IconButton,{onClick:go,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),wo=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:ao==="password",onClick:ko=>so(ko?"password":"text"),className:"enter-password-view__password-input__suffix-icon"}),Eo=ko=>{const Ao=ko.target.value;oo(Ao)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:vo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"header__typography",copykey:"dyn_enter_password.title",children:co("dyn_enter_password.title")})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view",children:jsxRuntimeExports.jsxs("form",{className:"enter-password-view__body",onSubmit:ko=>{ko.preventDefault(),lo()},children:[jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgPasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_enter_password.description",children:co("dyn_enter_password.description")})}),!!yo&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_enter_password.error",children:yo}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:co("dyn_enter_password.input.placeholder"),type:ao,suffix:wo,label:co("dyn_enter_password.input.label"),value:io,onChange:Eo,copykey:"dyn_enter_password.input"})}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!io&&!yo,loading:fo,copykey:"dyn_enter_password.continue_button_label",type:"submit",children:co("dyn_enter_password.continue_button_label")})]})})]})},EnterPasswordModal=({handler:Xr,onResolve:eo,onReject:to,closeView:ro})=>{const{onSuccess:no,onError:io,show:oo,handleOnModalUnmount:ao,closeModal:so}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:to,onResolve:eo});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"enter-password-modal",show:oo,closeModal:so,handleOnModalUnmount:ao,children:jsxRuntimeExports.jsx(EnterPasswordView,{mutation:Xr,closeView:ro,onSuccess:no,onError:io})})},AppOriginTile=({appLogoUrl:Xr,appName:eo,appOrigin:to})=>{const ro=reactExports.useRef(null),[no,io]=reactExports.useState(!1);return reactExports.useLayoutEffect(()=>{if(ro.current){const{width:oo,height:ao}=ro.current.getBoundingClientRect();oo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1(eo,_excluded$1);return reactExports.createElement("svg",_extends$3({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle||(_circle=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$1||(_path$1=reactExports.createElement("path",{d:"M34.048 17.611a5.5 5.5 0 1 1 7.779 7.779l-.611.61.193.193a4.5 4.5 0 0 1 0 6.364l-3.238 3.239a1.125 1.125 0 0 1-1.592-1.591l3.239-3.239a2.25 2.25 0 0 0 0-3.182l-.193-.193-12.704 12.705a1.123 1.123 0 0 1-.523.296l-9 2.25a1.125 1.125 0 0 1-1.34-1.447l2.812-8.438c.055-.166.148-.316.272-.44l14.906-14.906Zm6.188 1.591a3.25 3.25 0 0 0-4.597 0L20.921 33.92l-2.08 6.242 6.709-1.678 14.686-14.686a3.25 3.25 0 0 0 0-4.596ZM24.925 47.375c-2.779 0-4.967-1.275-6.424-2.49l2.89-.723c1.003.562 2.19.963 3.534.963.912 0 1.853-.369 2.856-1.028 1.005-.66 1.976-1.546 2.956-2.465l.255-.24c.865-.812 1.764-1.658 2.624-2.242.918-.624 2.135-1.191 3.413-.7.844.325 1.393.925 1.78 1.658.362.687.612 1.548.855 2.485.111.427.3.841.515 1.12.105.137.196.214.26.253.055.034.08.034.086.034.274 0 .745-.185 1.417-.643.417-.284.774-.568 1.13-.852.221-.177.443-.354.679-.53.628-.47 1.171-.785 1.57-.986a6.86 6.86 0 0 1 .625-.28l.045-.016.016-.006.006-.002h.003s.002-.002.359 1.065l-.357-1.067a1.125 1.125 0 0 1 .721 2.132l-.008.003a4.59 4.59 0 0 0-.394.178 8.472 8.472 0 0 0-1.238.78c-.132.098-.304.235-.5.391-.409.324-.921.73-1.39 1.05-.7.476-1.67 1.033-2.684 1.033-.98 0-1.69-.595-2.127-1.162-.447-.578-.746-1.29-.912-1.93-.247-.95-.442-1.573-.667-2-.201-.38-.383-.525-.598-.608-.184-.07-.552-.075-1.34.46-.704.48-1.472 1.2-2.38 2.053l-.225.211c-.97.91-2.071 1.922-3.26 2.703-1.19.783-2.566 1.398-4.091 1.398Z",fill:"#fff"})))};const isSignTypedData=Xr=>{if(typeof Xr!="object"||Xr===null)return!1;const{types:eo,message:to,primaryType:ro}=Xr;return typeof eo=="object"&&eo!==null&&typeof to=="object"&&to!==null&&typeof ro=="string"},isRawMessage=Xr=>typeof Xr!="object"||Xr===null?!1:typeof Xr.raw=="string",SignTypedDataPreview=({currentType:Xr,types:eo,showTypeName:to=!1,data:ro})=>{const no=eo[Xr].map(io=>{var oo;const ao=io.type.replace("[]",""),so=io.type.endsWith("[]"),co=ao in eo;if(so&&co)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(io.name),children:(oo=ro==null?void 0:ro[io.name])===null||oo===void 0?void 0:oo.map((ho,go)=>jsxRuntimeExports.jsx(TypeSection,{title:go.toString(),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:ao,types:eo,data:ho})},go))},io.name);if(co)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(io.name),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:ao,types:eo,data:ro==null?void 0:ro[io.name]})},io.name);const lo=ro==null?void 0:ro[io.name],fo=io.type;return jsxRuntimeExports.jsx(FieldRow,{name:capitalize$1(io.name),data:lo,displayValue:fo==="address"?shortenWalletAddress(lo,4,4):lo},io.name)});return to?jsxRuntimeExports.jsx(TypeSection,{title:Xr,children:no}):jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--fields-list",children:no})},TypeTitle=({children:Xr})=>jsxRuntimeExports.jsx(Typography,{color:"secondary",weight:"medium",children:Xr}),AttributeName=TypeTitle,AttributeValue=({children:Xr,title:eo})=>jsxRuntimeExports.jsx(Typography,{as:"span",weight:"regular",color:"primary",title:eo,children:Xr}),PaddedContent=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--type-container",children:Xr}),TypeSection=({title:Xr,children:eo})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(TypeTitle,{children:Xr}),jsxRuntimeExports.jsx(PaddedContent,{children:eo})]}),FieldRow=({name:Xr,displayValue:eo,data:to})=>jsxRuntimeExports.jsxs("div",{className:"sign-typed-data-preview--attribute-row",children:[jsxRuntimeExports.jsxs(AttributeName,{children:[capitalize$1(Xr),": "]}),jsxRuntimeExports.jsx(AttributeValue,{title:to,children:eo})]}),containsSpecialCharacters=Xr=>/[^ -~\s]/.test(Xr),SignMessagePreview=({message:Xr})=>{const eo=reactExports.useMemo(()=>{try{return JSON.parse(Xr)}catch{return}},[Xr]),to=reactExports.useMemo(()=>{const ro=isRawMessage(eo)?eo.raw:Xr,no=isHex$3(ro)?hexToString(ro):ro;return containsSpecialCharacters(no)?ro:no},[eo,Xr]);return isSignTypedData(eo)?jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:eo.primaryType,types:eo.types,showTypeName:!0,data:eo.message}):jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",children:jsxRuntimeExports.jsx("span",{style:{whiteSpace:"pre-line"},children:to})})},SignMessageConfirmationModal=({appLogoUrl:Xr,appName:eo,message:to,handler:ro,onReject:no,onSignMessage:io,hideModal:oo})=>{usePreventPageScroll(!0);const ao=reactExports.useRef(!1),[so,co]=reactExports.useState(!0),{initPasskeyRecoveryProcess:lo,shouldInitRecovery:fo}=usePasskeyRecovery(),{isTurnkeyWallet:ho}=useIsTurnkeyWallet(),{setShowAuthFlow:go,primaryWallet:yo}=useInternalDynamicContext(),{setView:vo}=useViewContext(),{userNeedsCrossDomainPasskey:wo}=usePasskeyContext(),{t:Eo}=useTranslation(),{getEOAWallet:ko}=useSmartWallets(),Ao=yo&&ko(yo),Po=reactExports.useCallback(()=>{ao.current=!1,co(!1)},[co]),{isLoading:jo,mutate:Mo,data:No,error:Do}=useMutation(()=>ro(to),{onSuccess:()=>{ao.current=!0,co(!1)}}),Fo=reactExports.useMemo(()=>{if(Do){if(Do instanceof DynamicError)return Do.message;try{return getProperErrorMessage(Do)}catch(xo){xo instanceof AccessBlockedError&&vo("access-blocked");return}}},[Do,vo]),Xo=reactExports.useCallback(()=>{if(No)return io(No);no(Do||new UserRejectedRequestError)},[No,io,no,Do]),Lo=xo=>__awaiter$j(void 0,void 0,void 0,function*(){const uo=yo&&isSessionKeyCompatibleWallet(yo)||Ao&&isSessionKeyCompatibleWallet(Ao);if((yield fo())&&!uo&&(yield lo("email","signMessage")),xo===!0){io("callHandlerOutsideModal");return}if(uo){Mo();return}if(ho&&wo){vo("passkey-new-domain-detected"),go(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{Mo()});return}Mo()});useEffectOnce(()=>{oo&&Lo(!0)});const Bo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Po,"data-testid":"close",disabled:jo,children:jsxRuntimeExports.jsx(SvgClose,{})});return oo?null:jsxRuntimeExports.jsx(Portal,{handleClose:Po,isShown:so,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-sign-message",transitionEvents:{onUnmount:Xo},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsxs(ModalCard,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Bo,alignContent:"bottom",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:xo=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignCircle,Object.assign({},xo))}),iconSize:64,isSpinning:!0})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sign-message-confirmation__title",copykey:"dyn_sign_message.title",children:Eo("dyn_sign_message.title")}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:Do&&jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__error",children:jsxRuntimeExports.jsx(ErrorContainer,{children:Fo})})}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__message-container",children:[jsxRuntimeExports.jsx(AppOriginTile,{appLogoUrl:Xr,appName:eo,appOrigin:PlatformService.getDisplayOrigin()}),jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__message",children:jsxRuntimeExports.jsx(SignMessagePreview,{message:to.toString().replace(/^"(.*)"$/,"$1").replace(/\\n/g,` -`)})})]}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"secondary",onClick:Po,expanded:!0,buttonPadding:"large",disabled:jo,copykey:"dyn_sign_message.cancel_button",children:Eo("dyn_sign_message.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:Lo,expanded:!0,loading:jo,copykey:"dyn_sign_message.sign_button",dataTestId:"sign-button",children:Eo("dyn_sign_message.sign_button")})]}),jsxRuntimeExports.jsx(NeedHelpSection,{}),jsxRuntimeExports.jsx(PoweredByDynamic,{})]})]})})})},WidgetPortal=({children:Xr,onClose:eo,disablePadding:to,portalClassName:ro,portalContainerClassName:no})=>jsxRuntimeExports.jsx("div",{className:classNames(ro,"widget-portal"),onClick:eo,"data-testid":"backdrop",children:jsxRuntimeExports.jsxs("div",{className:classNames(no,"widget-portal__container",{"widget-portal__container--no-padding":to}),onClick:io=>io.stopPropagation(),children:[eo&&jsxRuntimeExports.jsx("div",{className:"widget-portal__container__header",children:jsxRuntimeExports.jsx(IconButton,{className:"widget-portal__container__close-button",onClick:io=>eo(io),type:"button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})})}),Xr]})}),DefaultPromptLayout=({children:Xr,className:eo="",dataTestId:to="",icon:ro,showSpinnerInIcon:no=!0,title:io})=>jsxRuntimeExports.jsxs("div",{className:classNames("default-prompt-modal",eo),"data-testid":to,children:[ro&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:96,isSpinning:no,className:"default-prompt-modal__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"default-prompt-modal__content",children:[io&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary","data-testid":"title",children:io}),Xr]})]}),DefaultPromptModal=Xr=>jsxRuntimeExports.jsx(WidgetPortal,{onClose:Xr.onClose,portalClassName:"prompt-modal-portal",portalContainerClassName:"prompt-modal-portal__container",children:jsxRuntimeExports.jsx(DefaultPromptLayout,Object.assign({},Xr))});var _path,_excluded=["title","titleId"];function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowCircleRight=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties(eo,_excluded);return reactExports.createElement("svg",_extends$2({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path||(_path=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10.293-3.707a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 0 1-1.414-1.414L13.586 13H8a1 1 0 1 1 0-2h5.586l-1.293-1.293a1 1 0 0 1 0-1.414Z",fill:"#ABACB2"})))};const SwitchWalletView=({onCancel:Xr,connector:eo,expectedAddress:to,activeAddress:ro})=>{const{t:no}=useTranslation();return jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"switch-wallet",className:"switch-wallet",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.key}),title:no("dyn_sync_wallet.switch_wallet.title"),onClose:Xr,children:jsxRuntimeExports.jsxs("div",{className:"switch-wallet__body",children:[ro&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.active_address.heading",children:no("dyn_sync_wallet.switch_wallet.active_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",children:shortenWalletAddress(ro,3,3)}),jsxRuntimeExports.jsx(Divider,{className:"switch-wallet__body__divider",children:jsxRuntimeExports.jsx(SvgArrowCircleRight,{})})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.heading",children:no("dyn_sync_wallet.switch_wallet.expected_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.prompt",className:"switch-wallet__body__expected-address__prompt",children:no("dyn_sync_wallet.switch_wallet.expected_address.prompt")}),jsxRuntimeExports.jsx(Typography,{color:"green-1",weight:"bold",className:"switch-wallet__body__expected-address__address",children:shortenWalletAddress(to,3,3)})]})})},ReconnectWithQrCodeView=({onCancel:Xr,onSuccess:eo,connector:to,expectedAddress:ro})=>{var no;const{t:io}=useTranslation(),{walletBook:oo}=useWalletBookContext(),{theme:{theme:ao}}=useThemeContext(),{name:so}=ao,[co,lo]=reactExports.useState(),[fo,ho]=reactExports.useState();return usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const go=yield to.getAddress({onDesktopUri:yo=>__awaiter$j(void 0,void 0,void 0,function*(){ho(yo)}),onDisplayUri:yo=>__awaiter$j(void 0,void 0,void 0,function*(){lo(yo)})});if(go&&isSameAddress$1(go,ro,to.connectedChain)){eo();return}to.endSession(),Xr()}),{deps:[to],retries:3}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"reconnect-qr-code",title:io("dyn_sync_wallet.reconnect_with_qr_code.title"),onClose:Xr,children:co&&jsxRuntimeExports.jsx(QrCodeWrapper,{uri:co,desktopUri:fo,accentColor:so==="dark"?ao.colors.textPrimary:(no=getWalletPrimaryColor(oo,to.key))!==null&&no!==void 0?no:"",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to==null?void 0:to.key}),showCopyToClipboardButton:!0,walletConnector:to})})},reconnectSocialWallet=(Xr,eo,to,ro)=>__awaiter$j(void 0,void 0,void 0,function*(){if(!isSocialWalletConnector(eo))return;const no=Xr==null?void 0:Xr.verifiedCredentials.find(io=>io.format===JwtVerifiedCredentialFormatEnum.Oauth&&io.address&&isSameAddress$1(io.address,to,ro));!no||!no.oauthProvider||(yield eo.connect(no.oauthProvider))}),AutoReconnectingView=({onCancel:Xr,onSuccess:eo,connector:to,expectedAddress:ro})=>{const{t:no}=useTranslation(),{user:io}=useInternalDynamicContext();return usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){isSocialWalletConnector(to)&&(yield reconnectSocialWallet(io,to,ro,to.connectedChain),eo())}),{deps:[to]}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"auto-reconnecting",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to==null?void 0:to.key}),title:no("dyn_sync_wallet.reconnecting.title"),onClose:Xr,children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:no("dyn_sync_wallet.reconnecting.description",{walletAddress:shortenWalletAddress(ro,3,3)})})})},SyncWalletView=({onSuccess:Xr,onError:eo,expectedAddress:to,activeAddress:ro,connector:no})=>{const io=no.canConnectViaQrCode&&!no.isInstalledOnBrowser()&&!no.canConnectViaCustodialService;logger$8.logVerboseTroubleshootingMessage("[SyncWallet]",{canConnectViaCustodialService:no.canConnectViaCustodialService,canConnectViaQrCode:no.canConnectViaQrCode,isEmbeddedWallet:no.isEmbeddedWallet,isInstalledOnBrowser:no.isInstalledOnBrowser()}),useWalletConnectorEvent(no,"accountChange",({accounts:so})=>{logger$8.logVerboseTroubleshootingMessage("[SyncWallet] accountChange",{accounts:so,expectedAddress:to});const[co]=so;isSameAddress$1(co,to,no.connectedChain)&&Xr(!0)}),useInternalDynamicEvents("logout",()=>eo(new Error("user logged out"),!0));const oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){const so=yield no.getAddress();so&&isSameAddress$1(so,to,no.connectedChain)&&Xr(!0)}),ao=()=>{logger$8.logVerboseTroubleshootingMessage("[SyncWallet] handleCancel called"),eo(new DynamicError("User cancelled","0"),!0)};return no.isEmbeddedWallet?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(AutoReconnectingView,{connector:no,expectedAddress:to,onCancel:ao,onSuccess:()=>Xr(!0)})}):io?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(ReconnectWithQrCodeView,{connector:no,expectedAddress:to,onCancel:ao,onSuccess:()=>Xr(!0)})}):jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(SwitchWalletView,{connector:no,expectedAddress:to,activeAddress:ro,onCancel:ao,onTryToReconnect:oo})})},SyncWalletPromptModal=({expectedAddress:Xr,connector:eo,onResolve:to,onReject:ro,activeAddress:no})=>{const{onSuccess:io,onError:oo,show:ao,handleOnModalUnmount:so}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:ro,onResolve:to});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"sync-wallet-modal",show:ao,closeModal:()=>{},handleOnModalUnmount:so,children:jsxRuntimeExports.jsx(SyncWalletView,{onSuccess:io,onError:oo,expectedAddress:Xr,connector:eo,activeAddress:no})})},TransactionConfirmationModal=({title:Xr,onReject:eo,onTransactionResponseSuccess:to,transaction:ro,copykey:no,walletConnector:io,hideModal:oo,isNativeToken:ao,currentToken:so})=>{usePreventPageScroll(!0);const[co,lo]=reactExports.useState(!0),fo=reactExports.useRef(null),ho=reactExports.useRef(null),go=reactExports.useCallback(()=>{lo(!1)},[lo]),yo=reactExports.useCallback(()=>ho.current?to(ho.current):eo(fo.current||new UserRejectedTransactionError),[to,eo]);return jsxRuntimeExports.jsx(Portal,{handleClose:go,isShown:co,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-transaction",transitionEvents:{onUnmount:yo},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(TransactionConfirmationView,{transaction:ro,title:Xr,copykey:no,hideModal:oo,mutation:()=>ro.submit(),onClickClose:go,onError:vo=>fo.current=vo,displayPoweredByDynamicFooter:!0,walletConnector:io,onSuccess:vo=>{fo.current=null,ho.current=vo,go()},isNativeToken:ao,currentToken:so,isModal:!0})})})})},useWalletUiUtils=({appLogoUrl:Xr,appName:eo,hideEmbeddedWalletTransactionUIs:to=!1})=>{const ro=reactExports.useRef("enabled"),{t:no}=useTranslation(),{modal:io,open:oo}=useConfirmationModal({elementId:"dynamic-send-transaction"}),{modal:ao,open:so}=useConfirmationModal({elementId:"dynamic-sign-message"}),{modal:co,open:lo}=useConfirmationModal({elementId:"dynamic-enter-password"}),{modal:fo,open:ho}=useConfirmationModal({elementId:"dynamic-create-password"}),{modal:go,open:yo}=useConfirmationModal({elementId:"dynamic-sync-wallet"}),vo=reactExports.useCallback(()=>ro.current==="disabled"?(ro.current="enabled",!1):!0,[ro]),wo=reactExports.useCallback(No=>__awaiter$j(void 0,[No],void 0,function*({walletConnector:Do,message:Fo,handler:Xo}){return vo()?so((Lo,Bo)=>jsxRuntimeExports.jsx(SignMessageConfirmationModal,{appLogoUrl:Xr,appName:eo,message:Fo,handler:Xo,onSignMessage:Lo,onReject:Bo,hideModal:to&&!(Do!=null&&Do.isGlobalTransaction)})).then(Lo=>__awaiter$j(void 0,void 0,void 0,function*(){return Lo==="callHandlerOutsideModal"?Xo():Lo})):Xo()}),[Xr,eo,to,so,vo]),Eo=reactExports.useCallback((No,Do)=>__awaiter$j(void 0,void 0,void 0,function*(){return vo()?oo((Fo,Xo)=>jsxRuntimeExports.jsx(TransactionConfirmationModal,{copykey:"dyn_send_transaction.confirmation.title",title:no("dyn_send_transaction.confirmation.title"),transaction:Do,onTransactionResponseSuccess:Fo,onReject:Xo,walletConnector:No,hideModal:to&&!(No!=null&&No.isGlobalTransaction)})).then(Fo=>__awaiter$j(void 0,void 0,void 0,function*(){return Fo==="callHandlerOutsideModal"?Do.submit():Fo})):Do.submit()}),[to,oo,vo,no]),ko=reactExports.useCallback(No=>__awaiter$j(void 0,[No],void 0,function*({handler:Do,closeView:Fo=!0}){return lo((Xo,Lo)=>jsxRuntimeExports.jsx(EnterPasswordModal,{handler:Do,onResolve:Xo,onReject:Lo,closeView:Fo}))}),[lo]),Ao=reactExports.useCallback(No=>__awaiter$j(void 0,[No],void 0,function*({closeView:Do=!0}){return ho((Fo,Xo)=>jsxRuntimeExports.jsx(CreatePasswordModal,{onResolve:Fo,onReject:Xo,closeView:Do}))}),[ho]),Po=reactExports.useCallback(No=>__awaiter$j(void 0,[No],void 0,function*({walletConnector:Do,activeAddress:Fo,expectedAddress:Xo}){yield yo((Lo,Bo)=>jsxRuntimeExports.jsx(SyncWalletPromptModal,{onResolve:Lo,onReject:Bo,connector:Do,expectedAddress:Xo,activeAddress:Fo}))}),[yo]),jo=reactExports.useCallback(()=>{ro.current="disabled"},[]),Mo=reactExports.useMemo(()=>({createPassword:Ao,disabledConfirmationOnce:jo,enterPassword:ko,sendTransaction:Eo,signMessage:wo,syncWallet:Po}),[wo,jo,Eo,ko,Ao,Po]);return reactExports.useMemo(()=>[ao||io||co||fo||go,Mo],[ao,io,co,fo,go,Mo])},useSetWalletConnectorFetchers=(Xr,eo)=>{const{registerEmbeddedWalletSessionKey:to,removeSessionKey:ro}=useEmbeddedWalletSessionKeys(eo);if(!(Xr!=null&&Xr.length))return;const{fetchAuthToken:no,fetchBackupCode:io,fetchPasscode:oo}=getCoinbaseMPCConnectorFetchers({environmentId:eo});Xr.forEach(ao=>{var so,co;isCoinbaseMpcWalletConnector(ao.walletConnector)&&(ao.walletConnector.setAuthTokenFetcher(no),ao.walletConnector.setBackupCodeFetcher(io),ao.walletConnector.setPasscodeFetcher(oo)),isSessionKeyCompatibleWalletConnector(ao.walletConnector)&&((so=ao.walletConnector)===null||so===void 0||so.setSessionKeyFetcher(to),(co=ao.walletConnector)===null||co===void 0||co.setSessionKeyRemoveFunction(()=>ro()))})},useSendDynamicProps=({settings:Xr,environmentId:eo})=>{useEffectOnce(()=>{const to={settings:Object.assign(Object.assign({},Xr),{customPrivacyPolicy:!!Xr.customPrivacyPolicy,customTermsOfServices:!!Xr.customTermsOfServices,policiesConsentInnerComponent:!!Xr.policiesConsentInnerComponent})},ro=serializeEventsCallbacks(Xr.events),no=serializeWalletConnectors(Xr.walletConnectors),io=Object.assign(Object.assign({},to),{settings:Object.assign(Object.assign({},to.settings),{events:ro,walletConnectors:no})});sendDynamicProps(eo,{dynamicContextProps:io,frameworkSettings:getFrameworkSettings()})})},serializeEventsCallbacks=Xr=>{try{if(!Xr)return;const eo=Object.values(Xr);return Object.keys(Xr).filter((ro,no)=>eo[no]===void 0?!1:ro)}catch(eo){logger$8.error("error serializing events",eo);return}},getFrameworkSettings=()=>{var Xr;return{nextJs:{version:(Xr=window.next)===null||Xr===void 0?void 0:Xr.version},react:{version:reactExports.version}}},useResetCookieLocalStorage=({environmentId:Xr,projectSettings:eo,setPrimaryWalletId:to})=>{const ro=reactExports.useRef(!0),no=reactExports.useRef(!1),io=getUser(),oo=reactExports.useRef(!1);return useInternalDynamicEvents("logout",()=>oo.current=!0),reactExports.useEffect(()=>{const ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!io&&isCookieEnabled$1()&&!oo.current){no.current=!0;try{const so=yield refreshUserJwt({environmentId:Xr}),co=so==null?void 0:so.verifiedCredentials.find(lo=>lo.format===JwtVerifiedCredentialFormatEnum.Blockchain&&lo.id===so.lastVerifiedCredentialId);co&&to(co.id)}catch{logger$8.debug("Ignore failed refreshUserJwt in useResetCookieLocalStorage")}}eo&&(ro.current=!1)});no.current||ao()},[io,eo,Xr,to]),{isLoading:ro.current}},useSyncEmbeddedWalletFlow=()=>{const{projectSettings:Xr,user:eo,primaryWalletId:to,walletConnectorOptions:ro,setShowAuthFlow:no}=useInternalDynamicContext(),{isLoadingEmbeddedWallet:io}=useWalletContext(),{loading:oo}=useLoadingContext(),{createEmbeddedWallet:ao,shouldAutoCreateEmbeddedWallet:so}=useEmbeddedWallet(),co=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{co.current=!1}),reactExports.useEffect(()=>{const lo=()=>__awaiter$j(void 0,void 0,void 0,function*(){co.current=!0;try{yield ao()}catch(ho){ho instanceof EmbeddedWalletException?logger$8.debug("Error creating embedded wallet",ho):logger$8.error("Error creating embedded wallet",ho),no(!1)}});!so()||!eo||!Xr||!ro.length||io||oo||co.current||lo()},[eo,Xr,to,ao,io,ro,oo,so,no])},useSyncOnboardingFlow=({handler:Xr}={})=>{const{setShowAuthFlow:eo,userWithMissingInfo:to,sdkHasLoaded:ro,setSelectedWalletConnectorKey:no}=useInternalDynamicContext(),{setView:io}=useViewContext(),{updateUser:oo}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),{completeAuth:ao,handleAuthError:so}=useUserAuth({}),{displayedDestination:co}=useVerification(),lo=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{lo.current=!1}),reactExports.useEffect(()=>{var fo;const ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){var yo;if(!(!Xr||!(!((yo=to==null?void 0:to.missingFields)===null||yo===void 0)&&yo.length))){lo.current=!0;try{const vo=to.missingFields.map(Ao=>({isCustom:Ao.type==="custom",key:Ao.name,label:Ao.label,required:Ao.required})),wo=yield Xr(vo),Eo={},ko=Object.assign({},to==null?void 0:to.metadata);wo.forEach(Ao=>{Ao.isCustom?ko[Ao.key]=Ao.value:Eo[Ao.key]=Ao.value}),yield ao({updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return oo(Object.assign(Object.assign({},Eo),{metadata:ko}))})})}catch(vo){logger$8.error("Error handling user onboarding",vo),so(vo,{})}}}),go=()=>__awaiter$j(void 0,void 0,void 0,function*(){lo.current=!0,eo(!0);const yo=to==null?void 0:to.verifiedCredentials.find(vo=>vo.id===(to==null?void 0:to.lastVerifiedCredentialId));switch(yo!=null&&yo.walletName&&no(yo==null?void 0:yo.walletName),yo==null?void 0:yo.format){case JwtVerifiedCredentialFormatEnum.Email:case JwtVerifiedCredentialFormatEnum.Oauth:io("collect-user-data-login-no-wallet",{userIdentification:"email"});break;case JwtVerifiedCredentialFormatEnum.PhoneNumber:io("collect-user-data-login-no-wallet",{userIdentification:"phoneNumber",userIdentificationOverride:co});break;default:io("collect-user-data")}});if(!(!ro||lo.current||!(!((fo=to==null?void 0:to.missingFields)===null||fo===void 0)&&fo.length)||hasPendingMfaAction(to))){if(Xr){ho();return}go()}},[ro,to,Xr,ao,oo,eo,io,co,so,no])},useSyncMfaFlow=({handler:Xr}={})=>{const{setShowAuthFlow:eo,userWithMissingInfo:to,sdkHasLoaded:ro}=useInternalDynamicContext(),{setView:no}=useViewContext(),{getUserDevices:io}=useMfa(),oo=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{oo.current=!1}),reactExports.useEffect(()=>{var ao;if(!(!ro||oo.current)&&!(!to||!hasPendingMfaAction(to))){if(oo.current=!0,Xr){eo(!1),Xr();return}eo(!0),!((ao=to.scope)===null||ao===void 0)&&ao.includes("requiresAdditionalAuth")?io().then(so=>{so.length===0?no("mfa-choose-device"):no("mfa-verification")}):no("mfa-display-backup-codes")}},[io,ro,eo,no,to,Xr])},SyncAuthFlow=()=>(useSyncOnboardingFlow(),useSyncEmbeddedWalletFlow(),useSyncMfaFlow(),null),Switch=({disabled:Xr=!1,firstButton:eo,secondButton:to,thirdButton:ro})=>jsxRuntimeExports.jsxs("div",{className:classNames("switch__container",{disabled:Xr}),children:[jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:eo.active}),onClick:eo.handleButtonClick,children:eo.name}),jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:to.active}),onClick:to.handleButtonClick,children:to.name}),ro&&jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:ro.active}),onClick:ro.handleButtonClick,children:ro.name})]}),ThemeSwitch=()=>{const{changeTheme:Xr,theme:eo}=useThemeContext();return jsxRuntimeExports.jsx(Switch,{firstButton:{active:eo.theme.name==="light",handleButtonClick:()=>Xr("light"),name:"Light"},secondButton:{active:eo.theme.name==="dark",handleButtonClick:()=>Xr("dark"),name:"Dark"},thirdButton:{active:eo.theme.name==="auto",handleButtonClick:()=>Xr("auto"),name:"Auto"}})},PrimaryColorInput=()=>{const{changePrimaryColor:Xr,theme:eo}=useThemeContext(),[to,ro]=reactExports.useState(eo.customColor);return jsxRuntimeExports.jsx(Input,{id:"primary-color",label:"Primary color",value:to,onChange:no=>ro(no.target.value),onBlur:no=>{const io=to||eo.customColor;ro(io),Xr(io)}})},AuthModeSwitch=({authMode:Xr,setAuthMode:eo})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:Xr==="connect-and-sign",onChange:()=>eo("connect-and-sign"),id:"connect-and-sign"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-and-sign",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect and sign"})})]}),jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:Xr==="connect-only",onChange:()=>eo("connect-only"),id:"connect-only"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-only",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect only"})})]})]}),LoginWithEmailSwitch=()=>{const{loginWithEmail:Xr,setLogInWithEmail:eo}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch,{firstButton:{active:Xr,handleButtonClick:()=>eo(!0),name:"True"},secondButton:{active:!Xr,handleButtonClick:()=>eo(!1),name:"False"}})},LoginWithEmailViewDisplayPriorityOrderSwitch=()=>{const{authorizationViewDisplayOrder:Xr,setAuthorizationViewDisplayOrder:eo,loginWithEmail:to}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch,{disabled:!to,firstButton:{active:Xr==="web2",handleButtonClick:()=>eo("web2"),name:"Email"},secondButton:{active:Xr==="web3",handleButtonClick:()=>eo("web3"),name:"Wallet"}})},TemplateSelect=()=>{const{theme:Xr,changeTemplate:eo}=useThemeContext(),to=ro=>{eo(ro.target.value)};return jsxRuntimeExports.jsxs(Select,{label:"template",value:Xr.template,onChange:to,selectDataTestId:"template-select",children:[jsxRuntimeExports.jsx("option",{value:"default",children:"Default"}),jsxRuntimeExports.jsx("option",{value:"matrix",children:"Matrix"}),jsxRuntimeExports.jsx("option",{value:"minimal",children:"Minimal"}),jsxRuntimeExports.jsx("option",{value:"rounded",children:"Rounded"}),jsxRuntimeExports.jsx("option",{value:"trinity",children:"Trinity"})]})},Toolkit=()=>{const{projectSettings:Xr,user:eo,showAuthFlow:to,showDynamicUserProfile:ro,toolkitEnabled:no,authMode:io,setAuthMode:oo}=useInternalDynamicContext();return reactExports.useMemo(()=>no?ro||to:!1,[to,ro,no])?jsxRuntimeExports.jsx(ShadowDOM,{dataTestId:"toolkit-shadowdom",className:"toolkit-shadowdom",zIndex:toolkitZIndex,children:jsxRuntimeExports.jsxs("div",{className:"toolkit__container",children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Theme"}),jsxRuntimeExports.jsx(ThemeSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Template"}),jsxRuntimeExports.jsx(TemplateSelect,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Primary Color"}),jsxRuntimeExports.jsx(PrimaryColorInput,{})]}),!eo&&jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Auth mode"}),jsxRuntimeExports.jsx(AuthModeSwitch,{authMode:io,setAuthMode:oo})]}),isEmailProviderEnabled((Xr==null?void 0:Xr.providers)||[])&&!eo&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Log in with Email"}),jsxRuntimeExports.jsx(LoginWithEmailSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Email vs Wallet priority"}),jsxRuntimeExports.jsx(LoginWithEmailViewDisplayPriorityOrderSwitch,{})]})]})]})}):null},useTelegramLogin=()=>{const{sdkHasLoaded:Xr,user:eo,projectSettings:to,environmentId:ro}=useInternalDynamicContext(),no=(to==null?void 0:to.providers)||[],{completeConnection:io}=useSocialAuth({sessionTimeout:2e4}),oo=()=>typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("telegramAuthToken")||void 0,ao=lo=>isProviderEnabled(no,ProviderEnum.Telegram)&&Xr&&!eo&&lo;return{isAuthWithTelegram:()=>__awaiter$j(void 0,void 0,void 0,function*(){const lo=oo();if(ao(lo))return isUserLinkedWithTelegram(ro,{telegramAuthToken:lo})}),telegramSignIn:(...lo)=>__awaiter$j(void 0,[...lo],void 0,function*({forceCreateUser:fo=!1}={}){const ho=oo();ao(ho)&&(yield io({authMode:"signin",forceCreateUser:fo,provider:ProviderEnum.Telegram,state:"",telegramAuthToken:ho}))})}},TelegramAutoLogin=()=>(useTelegramLogin(),null),WalletConnectorEvents=()=>{const{walletConnectorOptions:Xr,primaryWallet:eo}=useInternalDynamicContext(),{handleWalletItemClick:to}=useWalletItemActions();return reactExports.useEffect(()=>{const ro=({connector:no})=>{logger$8.debug("[WalletConnectorEvents] handleProviderReady - onProviderReady");const io=Xr.map(oo=>oo.key===no.key?Object.assign(Object.assign({},oo),{isInstalledOnBrowser:no.isInstalledOnBrowser(),walletConnector:no}):oo);setWalletConnectorOptions(io)};return walletConnectorEvents.on("providerReady",ro),()=>{walletConnectorEvents.off("providerReady",ro)}},[Xr]),reactExports.useEffect(()=>{const ro=({connector:no})=>{logger$8.debug("[useWalletItemActions] handleAutoConnect",{connector:no});const io=Xr.find(oo=>oo.walletConnector.key===no.key);io&&to(io)};if(!eo)return walletConnectorEvents.on("autoConnect",ro),()=>{walletConnectorEvents.off("autoConnect",ro)}},[to,Xr,eo]),null},getMissingChains=(Xr,eo)=>{if(!Xr||!eo)return;const to=new Set(eo.map(no=>no.walletChain));return Xr.filter(no=>!to.has(no.chain))},themeModes=["light","dark","auto"],isThemeSetting=Xr=>themeModes.includes(Xr),parseTheme=(Xr,eo)=>isThemeSetting(Xr)?getThemeConfig(eo,Xr):Xr,validTransitions$2={idle:["linking_new_wallet","primary_not_connected","switching_primary"],linking_new_wallet:["idle"],primary_not_connected:["idle"],switching_primary:["idle"]},validateStateTransition$2=({from:Xr,to:eo})=>{if(Xr!==eo&&!validTransitions$2[Xr].includes(eo))throw new Error(`Invalid AccountSwitch state transition from ${Xr} to ${eo}`);return!0},validateMultiWalletWidgetState$1=Xr=>{if(Xr!=="awaiting_account_switch")throw new Error(`Invalid MultiWalletWidget state while trying to set AccountSwitch state: ${Xr} + `)}function yupToFormErrors(Xr){var eo={};if(Xr.inner){if(Xr.inner.length===0)return setIn(eo,Xr.path,Xr.message);for(var no=Xr.inner,to=Array.isArray(no),ro=0,no=to?no:no[Symbol.iterator]();;){var io;if(to){if(ro>=no.length)break;io=no[ro++]}else{if(ro=no.next(),ro.done)break;io=ro.value}var oo=io;getIn(eo,oo.path)||(eo=setIn(eo,oo.path,oo.message))}}return eo}function validateYupSchema(Xr,eo,to,ro){to===void 0&&(to=!1),ro===void 0&&(ro={});var no=prepareDataForValidation(Xr);return eo[to?"validateSync":"validate"](no,{abortEarly:!1,context:ro})}function prepareDataForValidation(Xr){var eo=Array.isArray(Xr)?[]:{};for(var to in Xr)if(Object.prototype.hasOwnProperty.call(Xr,to)){var ro=String(to);Array.isArray(Xr[ro])===!0?eo[ro]=Xr[ro].map(function(no){return Array.isArray(no)===!0||isPlainObject$1(no)?prepareDataForValidation(no):no!==""?no:void 0}):isPlainObject$1(Xr[ro])?eo[ro]=prepareDataForValidation(Xr[ro]):eo[ro]=Xr[ro]!==""?Xr[ro]:void 0}return eo}function arrayMerge(Xr,eo,to){var ro=Xr.slice();return eo.forEach(function(io,oo){if(typeof ro[oo]>"u"){var ao=to.clone!==!1,so=ao&&to.isMergeableObject(io);ro[oo]=so?deepmerge_1(Array.isArray(io)?[]:{},io,to):io}else to.isMergeableObject(io)?ro[oo]=deepmerge_1(Xr[oo],io,to):Xr.indexOf(io)===-1&&ro.push(io)}),ro}function getSelectedValues(Xr){return Array.from(Xr).filter(function(eo){return eo.selected}).map(function(eo){return eo.value})}function getValueForCheckbox(Xr,eo,to){if(typeof Xr=="boolean")return!!eo;var ro=[],no=!1,io=-1;if(Array.isArray(Xr))ro=Xr,io=Xr.indexOf(to),no=io>=0;else if(!to||to=="true"||to=="false")return!!eo;return eo&&to&&!no?ro.concat(to):no?ro.slice(0,io).concat(ro.slice(io+1)):ro}var useIsomorphicLayoutEffect$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useEventCallback(Xr){var eo=reactExports.useRef(Xr);return useIsomorphicLayoutEffect$1(function(){eo.current=Xr}),reactExports.useCallback(function(){for(var to=arguments.length,ro=new Array(to),no=0;no{if(!Xr.groupedWallets.length)throw new Error("Wallet group must have at least one wallet");const[eo]=Xr.groupedWallets;if(eo.chainGroup)return"multi-chain";if(eo.walletGroup)return"multi-wallet"},WalletGroupContext=React.createContext(void 0),useWalletGroupContext=()=>{const Xr=React.useContext(WalletGroupContext);if(Xr===void 0)throw new Error("usage of useWalletGroupContext not wrapped in `WalletGroupContextProvider`.");return Xr},WalletGroupContextProvider=({children:Xr})=>{const[eo,to]=React.useState(),{setView:ro}=useViewContext(),io={navigateToWalletGroup:React.useCallback(oo=>{to(oo);const ao=getWalletGroupType(oo),so={"multi-chain":"wallet-group","multi-wallet":"select-wallet-in-wallet-group"},co=ao?so[ao]:so["multi-chain"];ro(co)},[to,ro]),selectedWalletGroup:eo};return jsxRuntimeExports.jsx(WalletGroupContext.Provider,{value:io,children:Xr})},IpConfigurationContext=reactExports.createContext(void 0),IpConfigurationContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(null),ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(eo)return eo;try{const oo=yield fetch("http://ip-api.com/json");if(!oo.ok)return;const ao=yield oo.json();if(ao.status!=="success")return;const{country:so,countryCode:co}=ao,lo={country:so,countryCode:co};return to(lo),lo}catch(oo){logger$9.warn("Error fetching IP configuration",oo);return}}),[eo,to]),no=()=>{to(null)},io=reactExports.useMemo(()=>({getIpConfiguration:ro,removeIpConfiguration:no}),[ro]);return jsxRuntimeExports.jsx(IpConfigurationContext.Provider,{value:io,children:Xr})},useIpConfigurationContext=()=>{const Xr=reactExports.useContext(IpConfigurationContext);if(Xr===void 0)throw new Error("usage of useIpConfigurationContext not wrapped in `IpConfigurationContextProvider`.");return Xr},getReferencedAccount=(Xr,eo)=>{const to=Xr==null?void 0:Xr.verifiedCredentials.find(ro=>ro.id===eo);return Xr==null?void 0:Xr.verifiedCredentials.find(ro=>ro.id===(to==null?void 0:to.refId))},useInternalDynamicContext=()=>{const Xr=reactExports.useContext(DynamicContext);if(Xr===void 0)throw new Error("useInternalDynamicContext must be used within a DynamicContextProvider");return Xr},ACTIVE_SESSION="session_active",ERROR_SENDING_CODE="error_sending_code",ERROR_PROCESSING_REVEAL_REQUEST="error_processing_reveal_request",INVALID_REQUEST$1="invalid_request",INVALID_WALLET_DATA="invalid_wallet",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED="secure_enclave_provider_not_enabled",USER_NOT_LOGGED_IN="user_not_logged_in",CODE_SENT="code_sent",SESSION_CREATED="session_created",SESSION_RESTORED="session_restored",ACCESS_BLOCKED_ERROR_CODE=451,generateMessages=(Xr,eo,to,ro,no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){if(Xr===void 0)throw new DynamicError("Unable to fetch the public address from the wallet");if(!eo.connectedChain)throw new DynamicError("Wallet is not connected");let oo=yield eo.getNetwork();oo===void 0&&(eo.key==="bloctoevm"?oo=137:eo.connectedChain==="EVM"&&(oo=1));const ao=eo.parseAddress(Xr),so=generateMessageToSign({blockchain:eo.connectedChain,chainId:oo,domain:window.location.host,nonce:to,publicKey:ao,requestId:ro,resources:eo.providerResources,statement:no?io.replace(/(\r\n|\n|\r)/gm," ").trim():void 0,uri:window.location.href}),co=yield eo.proveOwnership(ao,so);if(!co)throw new DynamicError("Unable to sign the message");return{messageToSign:so,signedMessage:co}}),getVerifyArgs=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({walletConnector:eo,nonce:to,walletProvider:ro,environmentId:no,displaySiweStatement:io,skipEmptyAccountCheck:oo,siweStatement:ao,publicWalletAddress:so,signedMessageOverride:co,messageToSignOverride:lo}){const uo=eo.connectedChain;if(co&&lo){const[Eo,$o]=yield Promise.all([eo.getNetwork(),eo.getAdditionalAddresses(so)]);return{additionalWalletAddresses:$o,chain:uo,messageToSign:lo,network:String(Eo),publicWalletAddress:so,signedMessage:co,skipEmptyAccountCheck:oo,walletName:eo.key,walletProvider:ro}}const{messageToSign:ho,signedMessage:go}=yield generateMessages(so,eo,to,no,io,ao),[bo,wo]=yield Promise.all([eo.getNetwork(),eo.getAdditionalAddresses(so)]);return{additionalWalletAddresses:wo,chain:uo,messageToSign:ho,network:String(bo),publicWalletAddress:so,signedMessage:go,skipEmptyAccountCheck:oo,walletName:eo.key,walletProvider:ro}}),createUserProfileFromSdkUser=Xr=>{var eo,to,ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo,$o,Co,Ro,Oo,jo,Bo;const Mo={alias:(eo=Xr.alias)!==null&&eo!==void 0?eo:void 0,btcWallet:(to=Xr.btcWallet)!==null&&to!==void 0?to:void 0,ckbWallet:(ro=Xr.ckbWallet)!==null&&ro!==void 0?ro:void 0,country:(no=Xr.country)!==null&&no!==void 0?no:void 0,discordNotification:(io=Xr.discordNotification)!==null&&io!==void 0?io:void 0,dogeWallet:(oo=Xr.dogeWallet)!==null&&oo!==void 0?oo:void 0,email:(ao=Xr.email)!==null&&ao!==void 0?ao:void 0,emailNotification:(so=Xr.emailNotification)!==null&&so!==void 0?so:void 0,firstName:(co=Xr.firstName)!==null&&co!==void 0?co:void 0,jobTitle:(lo=Xr.jobTitle)!==null&&lo!==void 0?lo:void 0,kasWallet:(uo=Xr.kasWallet)!==null&&uo!==void 0?uo:void 0,kdaWallet:(ho=Xr.kdaWallet)!==null&&ho!==void 0?ho:void 0,lastName:(go=Xr.lastName)!==null&&go!==void 0?go:void 0,ltcWallet:(bo=Xr.ltcWallet)!==null&&bo!==void 0?bo:void 0,newsletterNotification:(wo=Xr.newsletterNotification)!==null&&wo!==void 0?wo:void 0,phoneNumber:(Eo=Xr.phoneNumber)!==null&&Eo!==void 0?Eo:void 0,policiesConsent:($o=Xr.policiesConsent)!==null&&$o!==void 0?$o:void 0,tShirtSize:(Co=Xr.tShirtSize)!==null&&Co!==void 0?Co:void 0,team:(Ro=Xr.team)!==null&&Ro!==void 0?Ro:void 0,username:(Oo=Xr.username)!==null&&Oo!==void 0?Oo:void 0};return Object.assign({environmentId:Xr.projectEnvironmentId,lastVerifiedCredentialId:(jo=Xr.lastVerifiedCredentialId)!==null&&jo!==void 0?jo:void 0,lists:Xr.lists,metadata:Xr.metadata,mfaBackupCodeAcknowledgement:Xr.mfaBackupCodeAcknowledgement,missingFields:Xr.missingFields,newUser:Xr.newUser,scope:Xr.scope,sessionId:(Bo=Xr.sessionId)!==null&&Bo!==void 0?Bo:"missing-sessionId",userId:Xr.id,verifiedCredentials:Xr.verifiedCredentials||[]},Mo)},storeAuthToken=(Xr,eo)=>{StorageService.setItem(AUTH_TOKEN,Xr,{priority:["secureStorage","localStorage"]}),StorageService.setItem(AUTH_MIN_TOKEN$1,eo,{priority:["secureStorage","localStorage"]})},storeExpiresAt=Xr=>{StorageService.setItem(AUTH_EXPIRES_AT,Xr)},storeAuthTokenAndUser=({user:Xr,jwt:eo,minifiedJwt:to,expiresAt:ro})=>{if(storeExpiresAt(ro),eo&&to&&(storeAuthToken(eo,to),isCookieEnabled$1())){const io=new Date(ro*1e3).toUTCString(),oo=`${DYNAMIC_AUTH_COOKIE_NAME}=${to}; expires=${io}; path=/; SameSite=Lax`;document.cookie=oo}const no=createUserProfileFromSdkUser(Xr);return setUser(no),no},storeSelectedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to}){try{const ro=yield sdkApi$1().selectUserWallet({environmentId:eo,userWalletSelectionRequest:{walletId:to}});return storeAuthTokenAndUser(ro)}catch(ro){logger$8.error("error storing selected wallet",ro);return}}),linkWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{messageToSign:ro,network:no,signedMessage:io,publicWalletAddress:oo,chain:ao,walletName:so,walletProvider:co,additionalWalletAddresses:lo,backup:uo,password:ho,passwordSource:go}){const bo=VerifyRequestFromJSON({additionalWalletAddresses:lo,backup:uo,chain:ao,messageToSign:ro,network:no,password:ho,passwordSource:go,publicWalletAddress:oo,signedMessage:io,walletName:so,walletProvider:co});try{const wo=yield sdkApi$1().verifyLink({environmentId:to,verifyRequest:bo});return storeAuthTokenAndUser(wo),wo}catch(wo){logger$8.error(wo);const Eo=yield wo.json();throw Eo.code==="reassign_wallet_confirm"||Eo.code==="reassign_wallet_error"?new WalletUsedError(Eo.code):Eo.code==="merge_accounts_confirmation"?new MergeAccountsConfirmationError({code:Eo.code,mergeConflicts:Eo.payload.mergeConflicts,walletAddress:oo}):Eo.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(Eo.error.message):new DynamicError(Eo.error)}}),unlinkWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,primaryWalletId:to,walletId:ro,onSuccess:no}){try{const io=yield sdkApi$1().verifyUnlink({environmentId:eo,verifyUnlinkRequest:{primaryWalletId:to,walletId:ro}});return no==null||no(),storeAuthTokenAndUser(io)}catch{return}}),transferWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{network:ro,messageToSign:no,signedMessage:io,publicWalletAddress:oo,chain:ao,walletName:so,walletProvider:co,skipEmptyAccountCheck:lo=!1}){const uo={chain:ao,messageToSign:no,network:ro,publicWalletAddress:oo,signedMessage:io,skipEmptyAccountCheck:lo,walletName:so,walletProvider:co};try{const ho=yield sdkApi$1().verifyTransfer({environmentId:to,verifyRequest:uo});return storeAuthTokenAndUser(ho)}catch(ho){logger$8.error("error transferring wallet",ho);return}}),verifyWallet=(Xr,eo)=>__awaiter$j(void 0,[Xr,eo],void 0,function*(to,{messageToSign:ro,signedMessage:no,publicWalletAddress:io,chain:oo,walletName:ao,walletProvider:so,captchaToken:co,network:lo,oauth:uo,additionalWalletAddresses:ho,sessionPublicKey:go}){const bo=VerifyRequestFromJSON({additionalWalletAddresses:ho,captchaToken:co,chain:oo,messageToSign:ro,network:lo,oauth:uo,publicWalletAddress:io,sessionPublicKey:go,signedMessage:no,walletName:ao,walletProvider:so});try{return yield sdkApi$1().verify({environmentId:to,verifyRequest:bo})}catch(wo){logger$8.error(wo);const Eo=yield wo.json();if(Eo.code==="wallet_not_deployed")throw new WalletNotDeployedError;if(Eo.error.code==="chainalysis_blocked_wallet")throw new ChainalysisError(Eo.payload.walletPublicKey);if(Eo.error.code==="gate_blocked")throw new GateBlockedError(Eo.payload.walletPublicKey);if(Eo.error.code==="missing_from_list")throw new NoAccessError({walletPublicKey:Eo.payload.walletPublicKey});if(Eo.code==="email_associated_with_different_provider")throw new AccountExistsError(Eo.error,Eo.payload);if(Eo.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(Eo.error.message);return}}),getSiweStatement=({appName:Xr,siweStatement:eo})=>{const to=`Welcome to ${Xr}. Signing is the only way we can truly know that you are the owner of the wallet you are connecting. Signing is a safe, gas-less transaction that does not in any way give ${Xr} permission to perform any transactions with your wallet.`;return eo||to},getWalletProvider=Xr=>Xr.isEmbeddedWallet?"embeddedWallet":Xr.canConnectViaCustodialService?"custodialService":Xr.isInstalledOnBrowser()?"browserExtension":isMobile$1()?"deepLink":"qrCode",findEmbeddedWalletFromVerifiedCredentials=(Xr,eo)=>{var to;const ro=(to=Xr==null?void 0:Xr.verifiedCredentials)===null||to===void 0?void 0:to.filter(({walletProvider:no})=>no===WalletProviderEnum.EmbeddedWallet);return ro!=null&&ro.length&&(eo!=null&&eo.length)?ro.find(({chain:no})=>no&&eo.includes(VerifiedCredentialNameToChainEnum[no])):ro==null?void 0:ro.shift()},isProviderEnabled=(Xr,eo)=>Xr.some(to=>{const ro=to.provider===eo&&!!to.enabledAt;return to.provider===ProviderEnum.MagicLink?ro&&!!to.providerProjectId:ro}),isTurnkeyEnabled=Xr=>{var eo;return isProviderEnabled((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.Turnkey)},isCoinbaseWaasEnabled=Xr=>{var eo;return isProviderEnabled((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.CoinbaseWaas)},hasEmbeddedWallet=(Xr,eo)=>{var to;return!!(Xr&&(!((to=Xr.verifiedCredentials)===null||to===void 0)&&to.some(({walletProvider:ro,walletName:no})=>ro===WalletProviderEnum.EmbeddedWallet&&(!eo||(no==null?void 0:no.startsWith(eo))))))},findPrimaryEmbeddedChain=Xr=>{var eo,to,ro;return((ro=(((to=(eo=Xr==null?void 0:Xr.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.chainConfigurations)||[]).find(io=>io.primary))===null||ro===void 0?void 0:ro.name)==="SOL"?ChainEnum.Sol:ChainEnum.Evm},getUserVerifiedCredentialType=(Xr,eo)=>{var to,ro,no;if(!Xr)return;if(eo)return(ro=(to=Xr.verifiedCredentials)===null||to===void 0?void 0:to.find(oo=>oo.format===eo))===null||ro===void 0?void 0:ro.format;const io=(no=Xr.verifiedCredentials)===null||no===void 0?void 0:no.find(oo=>oo.id===Xr.lastVerifiedCredentialId);return io==null?void 0:io.format},findWalletOptionFor=(Xr,eo)=>{var to;const ro=Xr.walletName;if(ro==="turnkeyhd"){const no=Xr.chain?VerifiedCredentialNameToChainEnum[Xr.chain]:void 0;return eo.find(io=>ro===io.key&&io.walletConnector.connectedChain===no)}return(to=eo.find(no=>ro===no.key))!==null&&to!==void 0?to:eo.find(no=>no.key==="fallbackconnector")},chainIconMap={algorand:AlgorandIcon,bitcoin:BitcoinIcon,cosmos:CosmosIcon,evm:EthereumIcon,flow:FlowIcon,solana:SolanaIcon,starknet:StarknetIcon},getChainIcon=Xr=>{var eo,to,ro;const no=(to=(eo=getChainInfo(Xr))===null||eo===void 0?void 0:eo.name)!==null&&to!==void 0?to:"";return(ro=chainIconMap[no])!==null&&ro!==void 0?ro:SvgError},getEnabledKYC=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.filter(({enabled:to})=>!!to))!==null&&eo!==void 0?eo:[]},filterFields=["social"],mapUserFieldsToKycSettings=(Xr,eo)=>Object.entries(Xr).reduce((ro,[no,io])=>{if(io){const oo=eo.find(ao=>ao.name===no);oo&&!oo.enabled&&ro.push(Object.assign({},oo))}return ro},[]),getEditableUserProfileFields=Xr=>getEnabledKYC(Xr).filter(({name:eo,type:to})=>to===KycFieldType.Custom||!filterFields.includes(eo)),getNonEditableUserProfileFields=({projectSettingsKyc:Xr=[],user:eo})=>eo?mapUserFieldsToKycSettings(eo,Xr).filter(({name:ro})=>!filterFields.includes(ro)):[],getUserProfileFields=({projectSettingsKyc:Xr=[],customFields:eo=[],user:to})=>{var ro;const no=getEditableUserProfileFields([...Xr,...eo]),io=getNonEditableUserProfileFields({projectSettingsKyc:Xr,user:to});let oo=[...no,...io];const ao=(ro=to==null?void 0:to.verifiedCredentials)===null||ro===void 0?void 0:ro.find(({walletProvider:lo})=>lo===WalletProviderEnum.EmbeddedWallet),so=!!(to!=null&&to.email),co=!!(to!=null&&to.phoneNumber);return ao&&(oo=oo.map(lo=>lo.name==="email"&&so||lo.name==="phoneNumber"&&co?Object.assign(Object.assign({},lo),{enabled:!1}):lo)),oo.sort((lo,uo)=>{const ho=Xr.findIndex(bo=>bo.name===lo.name),go=Xr.findIndex(bo=>bo.name===uo.name);return ho-go})},isSocialKycEnabled=Xr=>{var eo;return!!(!((eo=Xr==null?void 0:Xr.kyc.find(({name:to})=>to==="social"))===null||eo===void 0)&&eo.enabled)};function _assertThisInitialized(Xr){if(Xr===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Xr}function generateQuery(Xr){return Object.entries(Xr).filter(function(eo){eo[0];var to=eo[1];return to||to===!1}).map(function(eo){var to=eo[0],ro=eo[1];return encodeURIComponent(to)+"="+encodeURIComponent(ro)}).join("&")}var SCRIPT_ID="hcaptcha-api-script-id",HCAPTCHA_LOAD_FN_NAME="hcaptchaOnLoad",resolveFn,rejectFn,mountPromise=new Promise(function(Xr,eo){resolveFn=Xr,rejectFn=eo}),mountCaptchaScript=function(eo){if(eo===void 0&&(eo={}),document.getElementById(SCRIPT_ID))return mountPromise;window[HCAPTCHA_LOAD_FN_NAME]=resolveFn;var to=eo.apihost||"https://js.hcaptcha.com";delete eo.apihost;var ro=document.createElement("script");ro.id=SCRIPT_ID,ro.src=to+"/1/api.js?render=explicit&onload="+HCAPTCHA_LOAD_FN_NAME,ro.async=!0,ro.onerror=function(io){return rejectFn("script-error")};var no=generateQuery(eo);return ro.src+=no!==""?"&"+no:"",document.head.appendChild(ro),mountPromise},HCaptcha=function(Xr){_inheritsLoose(eo,Xr);function eo(ro){var no;no=Xr.call(this,ro)||this,no.renderCaptcha=no.renderCaptcha.bind(_assertThisInitialized(no)),no.resetCaptcha=no.resetCaptcha.bind(_assertThisInitialized(no)),no.removeCaptcha=no.removeCaptcha.bind(_assertThisInitialized(no)),no.isReady=no.isReady.bind(_assertThisInitialized(no)),no.loadCaptcha=no.loadCaptcha.bind(_assertThisInitialized(no)),no.handleOnLoad=no.handleOnLoad.bind(_assertThisInitialized(no)),no.handleSubmit=no.handleSubmit.bind(_assertThisInitialized(no)),no.handleExpire=no.handleExpire.bind(_assertThisInitialized(no)),no.handleError=no.handleError.bind(_assertThisInitialized(no)),no.handleOpen=no.handleOpen.bind(_assertThisInitialized(no)),no.handleClose=no.handleClose.bind(_assertThisInitialized(no)),no.handleChallengeExpired=no.handleChallengeExpired.bind(_assertThisInitialized(no));var io=typeof hcaptcha<"u";return no.ref=reactExports.createRef(),no.apiScriptRequested=!1,no.state={isApiReady:io,isRemoved:!1,elementId:ro.id,captchaId:""},no}var to=eo.prototype;return to.componentDidMount=function(){var no=this.state.isApiReady;if(no){this.renderCaptcha();return}this.loadCaptcha()},to.componentWillUnmount=function(){var no=this.state.captchaId;this.isReady()&&(hcaptcha.reset(no),hcaptcha.remove(no))},to.shouldComponentUpdate=function(no,io){return!(this.state.isApiReady!==io.isApiReady||this.state.isRemoved!==io.isRemoved)},to.componentDidUpdate=function(no){var io=this,oo=["sitekey","size","theme","tabindex","languageOverride","endpoint"],ao=oo.every(function(so){return no[so]===io.props[so]});ao||this.removeCaptcha(function(){io.renderCaptcha()})},to.loadCaptcha=function(){if(!this.apiScriptRequested){var no=this.props,io=no.apihost,oo=no.assethost,ao=no.endpoint,so=no.host,co=no.imghost,lo=no.languageOverride,uo=no.reCaptchaCompat,ho=no.reportapi,go=no.sentry,bo=no.custom,wo={apihost:io,assethost:oo,endpoint:ao,hl:lo,host:so,imghost:co,recaptchacompat:uo===!1?"off":null,reportapi:ho,sentry:go,custom:bo};mountCaptchaScript(wo).then(this.handleOnLoad).catch(this.handleError),this.apiScriptRequested=!0}},to.renderCaptcha=function(no){var io=this.state.isApiReady;if(io){var oo=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),ao=hcaptcha.render(this.ref.current,oo);this.setState({isRemoved:!1,captchaId:ao},function(){no&&no()})}},to.resetCaptcha=function(){var no=this.state.captchaId;this.isReady()&&hcaptcha.reset(no)},to.removeCaptcha=function(no){var io=this.state.captchaId;this.isReady()&&this.setState({isRemoved:!0},function(){hcaptcha.remove(io),no&&no()})},to.handleOnLoad=function(){var no=this;this.setState({isApiReady:!0},function(){no.renderCaptcha(function(){var io=no.props.onLoad;io&&io()})})},to.handleSubmit=function(no){var io=this.props.onVerify,oo=this.state,ao=oo.isRemoved,so=oo.captchaId;if(!(typeof hcaptcha>"u"||ao)){var co=hcaptcha.getResponse(so),lo=hcaptcha.getRespKey(so);io(co,lo)}},to.handleExpire=function(){var no=this.props.onExpire,io=this.state.captchaId;this.isReady()&&(hcaptcha.reset(io),no&&no())},to.handleError=function(no){var io=this.props.onError,oo=this.state.captchaId;this.isReady()&&hcaptcha.reset(oo),io&&io(no)},to.isReady=function(){var no=this.state,io=no.isApiReady,oo=no.isRemoved;return io&&!oo},to.handleOpen=function(){!this.isReady()||!this.props.onOpen||this.props.onOpen()},to.handleClose=function(){!this.isReady()||!this.props.onClose||this.props.onClose()},to.handleChallengeExpired=function(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()},to.execute=function(no){no===void 0&&(no=null);var io=this.state.captchaId;if(this.isReady())return no&&typeof no!="object"&&(no=null),hcaptcha.execute(io,no)},to.setData=function(no){var io=this.state.captchaId;this.isReady()&&(no&&typeof no!="object"&&(no=null),hcaptcha.setData(io,no))},to.getResponse=function(){return hcaptcha.getResponse(this.state.captchaId)},to.getRespKey=function(){return hcaptcha.getRespKey(this.state.captchaId)},to.render=function(){var no=this.state.elementId;return reactExports.createElement("div",{ref:this.ref,id:no})},eo}(reactExports.Component);const createTurnkeyEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({attestation:eo,challenge:to,environmentId:ro,chains:no=[EmbeddedWalletChainEnum.Evm],passkeyAlias:io}){const oo=[{chains:no,embeddedWalletProvider:EmbeddedWalletProviderEnum.Turnkeyhd,isAuthenticatorAttached:!1,passkeyAlias:io}];eo&&to&&(oo[0]=Object.assign(Object.assign({},oo[0]),{embeddedWalletSpecificOpts:{attestation:eo,challenge:to},isAuthenticatorAttached:!0}));try{const ao=yield sdkApi$1().createEmbeddedWallets({createEmbeddedWalletsRequest:{embeddedWallets:oo},environmentId:ro});return storeAuthTokenAndUser(ao)}catch(ao){logger$8.error("Error creating embedded wallet: ",ao);return}}),initEmbeddedWalletSession$1=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,walletId:to,publicKey:ro,environmentId:no}){return eo==="passkey"?sdkApi$1().initPasskeyRecovery({environmentId:no,initPasskeyRecoveryRequest:{turnkeyRecoveryTargetPublicKey:ro,walletId:to}}):sdkApi$1().initEmailAuth({environmentId:no,initEmailAuthRequest:{turnkeyEmailAuthTargetPublicKey:ro,walletId:to}})}),completePasskeyRecovery$1=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({walletId:eo,attestation:to,challenge:ro,environmentId:no}){try{const io=yield sdkApi$1().completePasskeyRecovery({completePasskeyRecoveryRequest:{attestation:to,challenge:ro,walletId:eo},environmentId:no});return storeAuthTokenAndUser(io)}catch(io){logger$8.error("Error completing passkey recovery: ",io);return}}),updatePasskeyRecoveryEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,updateRecoveryEmailRequest:to}){try{yield sdkApi$1().updateEmbeddedWalletRecoveryEmail({environmentId:eo,updateRecoveryEmailRequest:to})}catch(ro){throw logger$8.error("Error while trying to update recovery email: ",ro),new DynamicError("Error updating recovery email")}}),getUserPasskeys=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return yield sdkApi$1().getUserPasskeys({environmentId:eo})}catch(to){return logger$8.error(to),{count:0,passkeys:[]}}}),updateUserPasskey=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,id:to,alias:ro}){try{return yield sdkApi$1().updatePasskey({environmentId:eo,updateUserPasskeyRequest:{alias:ro,id:to}})}catch(no){logger$8.error(no);return}}),exportEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to,activityId:ro}){try{return yield sdkApi$1().embeddedWalletExport({activityId:ro,environmentId:eo,walletId:to})}catch(no){return logger$8.error(no),{exportBundle:""}}}),getWalletAuthToken=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to}){try{return(yield sdkApi$1().getAuthToken({environmentId:eo,type:to})).token}catch{return}}),getEmbeddedWalletBackup=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return(yield sdkApi$1().getEmbeddedWalletBackups({environmentId:eo})).secret}catch{return}}),getEmbeddedWalletPasscode=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return(yield sdkApi$1().getEmbeddedWalletPasscode({environmentId:eo})).secret}catch{return}}),claimEmbeddedWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,walletId:to}){var ro,no;try{const io=yield sdkApi$1().claimEmbeddedWallet({embeddedWalletPasscodeClaimRequest:{walletId:to},environmentId:eo});return storeAuthTokenAndUser(io),io}catch(io){logger$8.error(io);const oo=yield(ro=io==null?void 0:io.json)===null||ro===void 0?void 0:ro.call(io);if(!(!((no=oo==null?void 0:oo.error)===null||no===void 0)&&no.code))return{code:"unknown_error"};throw io}}),registerSessionKey=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,publicKey:to}){try{return yield sdkApi$1().registerSessionKey({environmentId:eo,registerSessionKeyRequest:{publicKey:to}}),to}catch(ro){logger$8.error("Error registering session key",ro);return}}),getCreateEmbeddedWalletAccountRequest=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,chain:to}){try{return yield sdkApi$1().getCreateWalletAccountRequest({chain:to,environmentId:eo})}catch(ro){throw logger$8.error("Error fetching create embedded wallet account request: ",ro),new DynamicError("Error fetching create embedded wallet account request")}}),createEmbeddedWalletAccount=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,createEmbeddedWalletAccountRequest:to}){try{return yield sdkApi$1().createWalletAccount({createWalletAccountRequest:{turnkeySignedRequest:to},environmentId:eo})}catch(ro){throw logger$8.error("Error creating embedded wallet account: ",ro),new DynamicError("Error creating embedded wallet account")}}),createPartialStoreSetter=({get:Xr,set:eo})=>(to,ro)=>eo(Object.assign(Object.assign({},Xr()),{[to]:ro})),{getSendBalanceState,setSendBalanceState,useSendBalanceState,resetSendBalanceState}=createStoreState("sendBalanceState"),setSendBalanceVariable=createPartialStoreSetter({get:getSendBalanceState,set:setSendBalanceState}),magicRpcError=-32603,errorCodesMapping={"-32002":"Insufficient funds for this transaction.",0:"The operation either timed out or was not allowed.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature.",INSUFFICIENT_FUNDS:"Insufficient funds for this transaction.",[magicRpcError.toString()]:"A network error has occurred. Please try again later"},errorReasonsMapping={"provided ENS name resolves to null":"Invalid address. Please check that the entered address is correct."},getCode=Xr=>{var eo;const to=Xr;return(to==null?void 0:to.code)||((eo=to==null?void 0:to.cause)===null||eo===void 0?void 0:eo.code)},getMessage=Xr=>{const eo=Xr;return eo==null?void 0:eo.message},hasReason=Xr=>"reason"in Xr&&Xr.reason!==void 0,isTransactionExecutionError$1=Xr=>Xr!=null&&typeof Xr=="object"&&"walk"in Xr&&typeof Xr.walk=="function",transactionErrorMessage=Xr=>{let eo=Xr;if(isTransactionExecutionError$1(Xr)&&(eo=Xr.walk()),logger$8.debug("transaction error:",eo),TransactionGasCannotBeSponsoredError.isInstance(eo))return;if(InsufficientFundsError.isInstance(eo)||isMagicInsufficientFundsError(eo))return errorCodesMapping.INSUFFICIENT_FUNDS;const to=getCode(eo);return to!==void 0&&errorCodesMapping[to]?errorCodesMapping[to]:hasReason(eo)&&errorReasonsMapping[eo.reason]?errorReasonsMapping[eo.reason]:"Something went wrong."},isMagicInsufficientFundsError=Xr=>{const eo=getCode(Xr),to=getMessage(Xr);return eo===magicRpcError&&!!(to!=null&&to.includes("insufficient funds for gas * price + value"))},Badge=({className:Xr="",dot:eo,text:to,copykey:ro,variant:no="secondary"})=>jsxRuntimeExports.jsxs("div",{className:classNames("badge__container",`badge__container__${no}`,Xr),children:[eo&&jsxRuntimeExports.jsx("span",{"data-testid":"badge__dot",className:"badge__dot"}),jsxRuntimeExports.jsx("span",{copykey:ro,children:to})]}),{getTokenBalancesState,setTokenBalancesState,useTokenBalancesState}=createStoreState("tokenBalancesState"),setTokenBalanceVariable=createPartialStoreSetter({get:getTokenBalancesState,set:setTokenBalancesState}),DotsMenuDropdown=({options:Xr,setShowMenu:eo})=>jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__container",style:{zIndex:tooltipZIndex},children:Xr.map(to=>to.hide?null:jsxRuntimeExports.jsxs("div",{className:"dots-menu-dropdown__item",onClick:()=>{to.callback(),eo(!1)},children:[to.Icon&&jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:to.Icon}),jsxRuntimeExports.jsxs(Typography,{className:"dots-menu-dropdown__item-text",color:to.fontColor?to.fontColor:"secondary",weight:to.fontWeight,children:[to.text," ",to.badge?jsxRuntimeExports.jsx(Badge,{text:to.badge}):null]}),to.endSlot&&jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__item__end-slot",children:to.endSlot})]},to.text))});var _path$11,_excluded$1d=["title","titleId"];function _extends$1f(){return _extends$1f=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1d(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgThreeDots=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1d(eo,_excluded$1d);return reactExports.createElement("svg",_extends$1f({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$11||(_path$11=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2a1.333 1.333 0 1 1 0 2.667A1.333 1.333 0 0 1 8 2Zm0 4.667a1.333 1.333 0 1 1 0 2.666 1.333 1.333 0 0 1 0-2.666Zm0 4.666A1.333 1.333 0 1 1 8 14a1.333 1.333 0 0 1 0-2.667Z",fill:"currentColor"})))};const DotsMenu=({options:Xr,buttonClassName:eo,buttonClassNameWithOpenMenu:to,direction:ro="right",iconOverride:no})=>{const io=reactExports.useRef(null),oo=reactExports.useRef(null),[ao,so]=reactExports.useState(!1);return useOnClickOutside(oo,()=>so(!1)),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(IconButton,{ref:io,onClick:()=>so(!0),"data-testid":"dotsMenu",className:ao?to:eo,children:no||jsxRuntimeExports.jsx(Icon,{children:jsxRuntimeExports.jsx(SvgThreeDots,{})})}),jsxRuntimeExports.jsx(Dropdown,{isOpen:ao,onClickOutside:()=>so(!1),onScroll:()=>so(!1),anchorRef:io,ref:oo,anchorOrigin:ro==="right"?"bottom-left":"top-right",transformOrigin:ro==="right"?"top-left":"bottom-right",children:jsxRuntimeExports.jsx(DotsMenuDropdown,{options:Xr,setShowMenu:so})})]})},DEFAULT_BREAKPOINT=12,DEFAULT_CUT_END=4,DEFAULT_CUT_START=4,shortenString=(Xr,eo,to)=>Xr.replace(Xr.substring(eo,to),"..."),shortenEmail=(Xr,eo)=>{if(!Xr)return"";const to=(eo==null?void 0:eo.breakpoint)||DEFAULT_BREAKPOINT,ro=(eo==null?void 0:eo.cutStart)||DEFAULT_CUT_START,no=(eo==null?void 0:eo.cutEnd)||DEFAULT_CUT_END;let[io,oo]=Xr.split("@");return(io==null?void 0:io.length)>to&&(io=shortenString(io,ro,io.length-no)),(oo==null?void 0:oo.length)>to&&(oo=shortenString(oo,ro,oo.length-no)),`${io}@${oo}`},detectBrowserName=Xr=>{const eo=navigator.userAgent;if(eo.match(/brave/i))return"brave";if(eo.match(/edg/i))return"edge";if(eo.match(/chrome|chromium|crios/i))return"chrome";if(eo.match(/firefox|fxios/i))return"firefox";if(eo.match(/safari/i))return"safari"};jsxRuntimeExports.jsx(AndroidIcon,{}),jsxRuntimeExports.jsx(BraveIcon,{}),jsxRuntimeExports.jsx(ChromeIcon,{}),jsxRuntimeExports.jsx(EdgeIcon,{}),jsxRuntimeExports.jsx(FirefoxIcon,{}),jsxRuntimeExports.jsx(AppleIcon,{}),jsxRuntimeExports.jsx(OperaIcon,{}),jsxRuntimeExports.jsx(SafariIcon,{});const PasskeyContext=reactExports.createContext(void 0),PasskeyContextProviderWithBrowser=({children:Xr})=>{var eo,to,ro,no,io,oo,ao,so;const{userHasEmbeddedWallet:co}=useEmbeddedWallet(),{isSessionKeyCompatible:lo,isTurnkeyWalletWithoutAuthenticator:uo}=useIsTurnkeyWallet(),{environmentId:ho,projectSettings:go,user:bo}=useInternalDynamicContext(),[wo,Eo]=reactExports.useState(!1),[$o,Co]=reactExports.useState(void 0),[Ro,Oo]=reactExports.useState(void 0),[jo,Bo]=useLocalStorage(EMBEDDED_WALLET_SECURE_BANNER,!0),Mo=reactExports.useMemo(()=>{var yo,vo,_o,So;const To=!!(!((So=(_o=(vo=(yo=go==null?void 0:go.sdk)===null||yo===void 0?void 0:yo.embeddedWallets)===null||vo===void 0?void 0:vo.supportedSecurityMethods)===null||_o===void 0?void 0:_o.passkey)===null||So===void 0)&&So.isEnabled);return jo!==!1&&uo&&To},[uo,jo,(no=(ro=(to=(eo=go==null?void 0:go.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.supportedSecurityMethods)===null||ro===void 0?void 0:ro.passkey)===null||no===void 0?void 0:no.isEnabled]),Fo=reactExports.useCallback(()=>{var yo,vo,_o,So;const To=!!(!((So=(_o=(vo=(yo=go==null?void 0:go.sdk)===null||yo===void 0?void 0:yo.embeddedWallets)===null||vo===void 0?void 0:vo.supportedSecurityMethods)===null||_o===void 0?void 0:_o.passkey)===null||So===void 0)&&So.isEnabled);return!lo&&(!Mo&&uo&&To)},[(so=(ao=(oo=(io=go==null?void 0:go.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0?void 0:oo.supportedSecurityMethods)===null||ao===void 0?void 0:ao.passkey)===null||so===void 0?void 0:so.isEnabled,Mo,lo,uo]),Wo=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getUserPasskeys({environmentId:ho})).passkeys}),{deps:[ho,bo,co(),wo],enabled:!!(ho&&bo&&co())}),Jo=reactExports.useMemo(()=>{if(typeof window>"u")return!1;const yo=PlatformService.getHostname();return Wo.data?Wo.data.some(vo=>{if(!vo.origin)return!1;try{const _o=new URL(vo.origin).hostname;return _o===getTLD()||_o===yo}catch(_o){return logger$8.error(_o),!1}}):!1},[Wo.data]),Po=!uo&&!Jo,fo=reactExports.useMemo(()=>{var yo;return{passkey:$o,passkeyEdited:wo,passkeyIcon:Ro,setPasskey:Co,setPasskeyEdited:Eo,setPasskeyIcon:Oo,setShowSecureAccountBanner:Bo,showAlert:Fo,showSecureAccountBanner:Mo,userHasPasskeysForCurrentOrigin:Jo,userNeedsCrossDomainPasskey:Po,userPasskeys:(yo=Wo.data)!==null&&yo!==void 0?yo:[],userPasskeysLoading:Wo.isLoading}},[$o,wo,Ro,Jo,Wo.data,Wo.isLoading,Po,Fo,Bo,Mo]);return jsxRuntimeExports.jsx(PasskeyContext.Provider,{value:fo,children:Xr})},PasskeyContextProvider=({children:Xr})=>jsxRuntimeExports.jsx(PasskeyContextProviderWithBrowser,{children:Xr}),usePasskeyContext=()=>{const Xr=reactExports.useContext(PasskeyContext);if(Xr===void 0)throw new Error("usage of PasskeyContext not wrapped in `PasskeyContextProvider`.");return Xr},useOnlyConnectedMode=()=>{const{authMode:Xr,user:eo}=useInternalDynamicContext();return Xr==="connect-only"&&!eo},useKYCFlag=()=>{const Xr=useOnlyConnectedMode(),{projectSettings:eo,user:to}=useInternalDynamicContext();return Xr?!1:getUserProfileFields({customFields:eo==null?void 0:eo.customFields,projectSettingsKyc:eo==null?void 0:eo.kyc,user:to}).length>0||isSocialKycEnabled(eo)},useViewController=Xr=>{const[eo,to]=reactExports.useState(null);return{goToInitialView:()=>to(null),setView:to,view:eo||Xr}},DynamicWidgetContext=reactExports.createContext(void 0),DynamicWidgetContextProvider=({children:Xr})=>{const eo=reactExports.useRef(null),to=reactExports.useRef(null),ro=reactExports.useRef(null),{setShowDynamicUserProfile:no,showDynamicUserProfile:io,multiWallet:oo}=useInternalDynamicContext(),ao=useKYCFlag(),{view:so,setView:co,goToInitialView:lo}=useViewController(ao&&!oo?"profile":"wallets"),[uo,ho]=reactExports.useState({}),go=reactExports.useCallback(($o,Co)=>{co($o),ho(Co||{})},[co]),bo=reactExports.useCallback(()=>{if(ao)return go("profile");go("wallets")},[ao,oo]),wo=reactExports.useMemo(()=>so==="manage-passkeys"||so==="manage-mfa"?"settings":!ao&&!oo&&so!=="settings"&&so!=="profile"?"wallets":so==="edit-profile"?"profile":so==="global-wallet"?"wallets":so,[so,ao,oo]);useInternalDynamicEvents("logout",()=>lo());const Eo=reactExports.useMemo(()=>({availableWalletsContainerRef:ro,dynamicWidgetView:so,goToInitialDynamicWidgetView:lo,goToProfileView:bo,inlineControlsRef:to,isOpen:io,overridenWidgetView:wo,setDynamicWidgetView:go,setIsOpen:no,viewProps:uo,widgetRef:eo}),[so,lo,bo,io,go,no,wo,uo]);return jsxRuntimeExports.jsx(DynamicWidgetContext.Provider,{value:Eo,children:Xr})},useWidgetContext=()=>{const Xr=reactExports.useContext(DynamicWidgetContext);if(Xr===void 0)throw new Error("usage of useWidgetContext not wrapped in `DynamicWidgetContextProvider`.");return Xr};var _path$10,_excluded$1c=["title","titleId"];function _extends$1e(){return _extends$1e=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1c(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAdd=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1c(eo,_excluded$1c);return reactExports.createElement("svg",_extends$1e({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$10||(_path$10=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2c.368 0 .667.298.667.667v4.666h4.666a.667.667 0 1 1 0 1.334H8.667v4.666a.667.667 0 1 1-1.334 0V8.667H2.667a.667.667 0 0 1 0-1.334h4.666V2.667C7.333 2.298 7.632 2 8 2Z",fill:"currentColor",fillOpacity:.4})))},_path$$,_excluded$1b=["title","titleId"];function _extends$1d(){return _extends$1d=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1b(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLink=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1b(eo,_excluded$1b);return reactExports.createElement("svg",_extends$1d({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$$||(_path$$=reactExports.createElement("path",{d:"M11.833 4.667H9.167V6h2.666c1.1 0 2 .9 2 2s-.9 2-2 2H9.167v1.333h2.666a3.335 3.335 0 0 0 0-6.666Zm-4 5.333H5.167c-1.1 0-2-.9-2-2s.9-2 2-2h2.666V4.667H5.167a3.335 3.335 0 0 0 0 6.666h2.666V10Zm-2-2.667h5.334v1.334H5.833V7.333Z",fill:"currentColor"})))},_g$d,_excluded$1a=["title","titleId"];function _extends$1c(){return _extends$1c=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1a(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSend=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1a(eo,_excluded$1a);return reactExports.createElement("svg",_extends$1c({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$d||(_g$d=reactExports.createElement("g",{clipPath:"url(#send_svg__clip0_6894_96)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m3.846 9.3.03-.01 14.64-5.728c.199-.078.399-.156.567-.205.156-.046.465-.126.794-.02.374.123.664.413.786.787.107.33.027.638-.019.794-.049.168-.127.368-.205.567L14.702 20.15c-.08.204-.16.408-.239.568-.073.147-.226.436-.537.614a1.277 1.277 0 0 1-1.136.072c-.323-.137-.496-.405-.58-.542-.09-.149-.184-.342-.278-.535l-2.693-5.52-5.546-2.724-.027-.014c-.193-.094-.385-.189-.533-.28-.137-.082-.403-.256-.54-.578a1.277 1.277 0 0 1 .074-1.136c.178-.31.466-.463.612-.536.16-.079.363-.158.567-.238Zm.972 1.425 4.88 2.396 2.912-2.913a.848.848 0 0 1 1.2-.017.848.848 0 0 1-.017 1.2l-2.898 2.898 2.384 4.888 5.433-13.888-13.894 5.436Z",fill:"currentColor",fillOpacity:.4}))))};const getActiveOauthCredential=Xr=>{var eo;return(eo=Xr==null?void 0:Xr.verifiedCredentials)===null||eo===void 0?void 0:eo.find(to=>to.format==="oauth"&&to.id===Xr.lastVerifiedCredentialId)},getCustomCountries=Xr=>{const eo=R$7.map(M$5).map(to=>(to.iso2==="br"&&(to.format="(..) .....-...."),to.iso2==="fr"&&(to.format="(.) .. .. .. .."),Se$2(to)));return Xr?eo.filter(([,to])=>Xr.includes(to)):eo},formatPhone=Xr=>{var eo;const{country:to}=X$4({countries:getCustomCountries(),phone:Xr});if(!to)return Xr;const ro=de$4({dialCode:to.dialCode,phone:Xr}),no=Q$7({country:to,phone:Xr}),io=/\./g;if(((eo=no.match(io))!==null&&eo!==void 0?eo:[]).length!==removeNonDigits(ro).length)return Xr;let oo=0;const ao=no.replace(io,()=>ro[oo++]);return`+${to.dialCode} ${ao}`},removeNonDigits=Xr=>Xr.replace(/\D+/g,""),getUserIdentifier=Xr=>{const eo=getActiveOauthCredential(Xr);return eo!=null&&eo.publicIdentifier?eo.publicIdentifier:Xr!=null&&Xr.email?shortenEmail(Xr.email):Xr!=null&&Xr.phoneNumber?formatPhone(Xr.phoneNumber):"My Profile"};var _circle$5,_g$c,_excluded$19=["title","titleId"];function _extends$1b(){return _extends$1b=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$19(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSpinner=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$19(eo,_excluded$19);return reactExports.createElement("svg",_extends$1b({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2,style:{opacity:.1}}),reactExports.createElement("mask",{id:"spinner_svg__a",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:24,height:24},_circle$5||(_circle$5=reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2}))),_g$c||(_g$c=reactExports.createElement("g",{mask:"url(#spinner_svg__a)"},reactExports.createElement("path",{fill:"currentColor",d:"M12-16.5h27v27H12z"}))))};const Spinner$1=({className:Xr=""})=>jsxRuntimeExports.jsx(SvgSpinner,{className:classNames("spinner",Xr)}),Button=({buttonClassName:Xr="",buttonPadding:eo="medium",buttonVariant:to="primary",children:ro,feedback:no,expanded:io,dataTestId:oo,disabled:ao=!1,showInternalLoading:so=!0,loading:co=!1,onClick:lo,type:uo,startSlot:ho,endSlot:go})=>{const[bo,wo]=reactExports.useState(!1),[Eo,$o]=reactExports.useState(!1),Co={"brand-primary":"button--brand-primary",primary:"button--primary",secondary:"button--secondary",tertiary:"button--tertiary"},Oo=classNames("button",{"button--expanded":!!io,"button--loading":!!co},eo?{default:"button--padding-default",large:"button--padding-large","login-screen-height":"button--padding-login-screen-height",medium:"button--padding-medium",none:"button--padding-none",small:"button--padding-small"}[eo]:"",to?Co[to]:"",Xr),jo=Mo=>__awaiter$j(void 0,void 0,void 0,function*(){if(lo){const Fo=lo(Mo);if(Fo instanceof Promise){so&&wo(!0);try{yield Fo}finally{wo(!1)}}}no&&($o(!0),setTimeout(()=>{$o(!1)},2e3))}),Bo=jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ho&&jsxRuntimeExports.jsx("div",{className:"button__start-slot",children:ho}),(no||ro)&&(Eo&&no?no:ro),go&&jsxRuntimeExports.jsx("div",{className:"button__end-slot",children:go})]});return jsxRuntimeExports.jsxs("button",{type:uo,onClick:jo,className:Oo,disabled:ao||bo||co,"data-testid":oo,children:[(bo||co)&&jsxRuntimeExports.jsx("div",{className:"button__spinner-container","data-testid":"button__spinner",children:jsxRuntimeExports.jsx(Spinner$1,{className:"button__spinner"})}),Bo]})},TypographyButton=Xr=>{var eo,{children:to,typographyProps:ro={variant:"button_primary"},copykey:no}=Xr,io=__rest$7(Xr,["children","typographyProps","copykey"]);return jsxRuntimeExports.jsx(Button,Object.assign({},io,{children:jsxRuntimeExports.jsx(Typography,Object.assign({variant:"button_primary",as:"span"},ro,{color:(eo=ro.color)!==null&&eo!==void 0?eo:"primary",copykey:no,children:to}))}))},Image$1=({src:Xr,alt:eo="",fallback:to,className:ro,dataTestId:no})=>{const[io,oo]=reactExports.useState(!1),ao=()=>{oo(!0)};return Xr&&!io?jsxRuntimeExports.jsx("img",{src:Xr,alt:eo,onError:ao,className:ro,"data-testid":no}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:to})},UserAvatar=({user:Xr,containerClassName:eo,renderWithFallback:to=!0})=>{const no=(()=>{var io,oo,ao;return(ao=(oo=(io=Xr==null?void 0:Xr.verifiedCredentials)===null||io===void 0?void 0:io.find(co=>{var lo;return Xr.lastVerifiedCredentialId===co.id&&((lo=co.oauthAccountPhotos)===null||lo===void 0?void 0:lo.length)}))===null||oo===void 0?void 0:oo.oauthAccountPhotos)===null||ao===void 0?void 0:ao[0]})();return!no&&!to?null:jsxRuntimeExports.jsx("div",{className:classNames("user-profile-social-account__connected-avatar",eo),children:jsxRuntimeExports.jsx(Image$1,{className:"user-profile-social-account__image",src:no,alt:"User avatar",dataTestId:"user-avatar",fallback:jsxRuntimeExports.jsx(UserProfileIcon,{})})})};var _path$_,_excluded$18=["title","titleId"];function _extends$1a(){return _extends$1a=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$18(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgClose=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$18(eo,_excluded$18);return reactExports.createElement("svg",_extends$1a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$_||(_path$_=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.41 4.41a.833.833 0 0 1 1.18 0L10 8.822l4.41-4.41a.833.833 0 1 1 1.18 1.178L11.178 10l4.41 4.41a.833.833 0 1 1-1.178 1.18L10 11.177 5.588 15.59a.833.833 0 1 1-1.178-1.178L8.82 10l-4.41-4.41a.833.833 0 0 1 0-1.18Z",fill:"currentcolor"})))};const getEnabledEmbeddedWalletsAuthenticators=Xr=>{if(!Xr||!Object.keys(Xr).length)return{};const eo={};return Object.keys(Xr).filter(to=>{var ro;return(ro=Xr[to])===null||ro===void 0?void 0:ro.isEnabled}).forEach(to=>eo[to]=Xr[to]),eo},updateUserProfileFields=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().updateSelf({environmentId:Xr,userFields:eo}),ro=yield storeAuthTokenAndUser(to);return Object.assign(Object.assign({},to),{userProfile:ro})}catch(to){if(logger$8.error(to),to instanceof Response){const ro=yield to.json();if(ro.code==="email_already_exists")throw new EmailAlreadyExistsError;if(ro.code==="custom_field_data_not_unique")throw new CustomFieldNotUniqueError;if(ro.code==="username_already_exists")throw new UsernameAlreadyExistsError;if(ro.code==="too_many_verification_attempts")throw new TooManyEmailVerificationsError;if(ro.code==="invalid_phone"||ro.code==="invalid_sms_verification")throw new InvalidPhoneNumberError(ro.error)}throw to}}),mergeUserAccounts=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield sdkApi$1().mergeUsers({environmentId:Xr});return storeAuthTokenAndUser(eo)}catch(eo){throw logger$8.error(eo),eo}}),verifyMergeUsers=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().verifyMergeUsers({environmentId:Xr,mergeUserConflictResolutions:{mergeUserResolutions:eo}});return storeAuthTokenAndUser(to)}catch(to){throw logger$8.error(to),to}}),refreshUserJwt=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const to=yield sdkApi$1().refreshAuth({environmentId:eo});return storeAuthTokenAndUser(to)}catch{return}}),getAuthenticatedUser=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{return yield sdkApi$1().getAuthenticatedUser({environmentId:eo})}catch(to){if(to.status===401)throw logger$8.error("No valid auth for getAuthenticatedUser",to),new CookieInvalidError;logger$8.error("Other error getting authenticated user",to);return}}),sessionExpirationUnit={days:86400,hours:3600,minutes:60},getEmbeddedWalletSessionExpiration=Xr=>{if(!Xr)return 0;const{unit:eo,amount:to}=Xr,ro=to||0,no=sessionExpirationUnit[eo]||0;return ro*no},useElementById=()=>{const Xr=reactExports.useRef(null);return{createRootElement:(to="dynamic-modal",ro)=>{if(typeof window>"u")return Xr;const no=window.document.getElementById(to);if(no)return Xr.current=no,Xr;const io=ro?window.document.getElementById(ro):void 0;return Xr.current=window.document.createElement("div"),Xr.current.setAttribute("id",to),Xr.current.setAttribute("class",to),Xr.current.setAttribute("data-testid",to),Xr.current.style.pointerEvents="auto",io?io.appendChild(Xr.current):window.document.body.appendChild(Xr.current),Xr}}},removeElementById=Xr=>{let eo;if(typeof window<"u"){eo=window.document.getElementById(Xr);const to=eo==null?void 0:eo.parentElement;if(!eo||!to)return;to.removeChild(eo)}},iframeContainerId$1="dyn-passkey-recovery-id",iframeElementId$1="dyn-passkey-recovery-element-id",initEmbeddedWalletSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,iframeContainer:to,iframeElementId:ro,environmentId:no,user:io,wallet:oo,sessionExpiration:ao}){var so;if(!io)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(oo!=null&&oo.connector)||!(oo!=null&&oo.id)||!isPasskeyWalletConnector(oo==null?void 0:oo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const co=(so=oo.connector)===null||so===void 0?void 0:so.getAuthenticatorHandler();if(eo==="passkey"&&co.isSessionActive())return addNewPasskeyAuthenticator({environmentId:no,user:io,wallet:oo});const lo=yield co.initRecovery(eo,to,ro,ao);if(!lo)throw new DynamicError("Something went wrong");const uo=yield initEmbeddedWalletSession$1({authenticatorType:eo,environmentId:no,publicKey:lo,walletId:oo.id});co.recoveryUserId=eo==="passkey"?uo.turnkeyRecoveryUserId:uo.turnkeyUserId}),passkeyRecoveryBundleValidation=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,bundleInput:to,wallet:ro}){var no,io,oo,ao;if(!to)throw new DynamicError("Code must be informed");if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!eo)throw new DynamicError(USER_NOT_LOGGED_IN);const so=(oo=(io=(no=eo.verifiedCredentials)===null||no===void 0?void 0:no.find(({walletName:uo})=>uo==null?void 0:uo.startsWith("turnkey")))===null||io===void 0?void 0:io.walletProperties)===null||oo===void 0?void 0:oo.turnkeySubOrganizationId,co=(ao=ro.connector)===null||ao===void 0?void 0:ao.getAuthenticatorHandler();yield co.verifyRecoveryCode(to,so);const lo={createdAt:new Date().getTime(),emailCode:to,userId:co.recoveryUserId};StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,lo)}),resentRecoveryEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authenticatorType:eo,user:to,environmentId:ro,wallet:no}){var io;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(no!=null&&no.connector)||!(no!=null&&no.id)||!isPasskeyWalletConnector(no==null?void 0:no.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const oo=(io=no.connector)===null||io===void 0?void 0:io.getAuthenticatorHandler().publicKey;if(!oo)throw new DynamicError("Could not proceed with your request. Please restart the process.");return initEmbeddedWalletSession$1({authenticatorType:eo,environmentId:ro,publicKey:oo,walletId:no==null?void 0:no.id})}),completePasskeyRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){const{connector:no,user:io}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!1,environmentId:to,user:eo,wallet:ro});return no.getAuthenticatorHandler().clear(),removeElementById(iframeElementId$1),io}),addNewPasskeyAuthenticator=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){const{user:no}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!0,environmentId:to,user:eo,wallet:ro});return no}),recoverTurnkeyWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({wallet:eo,user:to,environmentId:ro,addPasskeyAuthenticator:no}){var io,oo,ao;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!eo||!eo.connector||!eo.id||!isPasskeyWalletConnector(eo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const so=eo.connector;so.setEmail(to.email);const co=(ao=(oo=(io=to.verifiedCredentials)===null||io===void 0?void 0:io.find(({walletName:Eo})=>Eo==null?void 0:Eo.startsWith("turnkey")))===null||oo===void 0?void 0:oo.walletProperties)===null||ao===void 0?void 0:ao.turnkeySubOrganizationId;if(!co)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId is missing");const lo=eo.connector.getAuthenticatorHandler(),{attestation:uo,challenge:ho}=yield so.getWebAuthnAttestation();no?yield lo.addPasskeyAuthenticator({attestation:uo,challenge:ho,turnkeySubOrganizationId:co}):yield lo.completeRecovery({attestation:uo,challenge:ho,turnkeySubOrganizationId:co});const go=yield completePasskeyRecovery$1({attestation:uo,challenge:ho,environmentId:ro,walletId:eo.id});if(!go)throw new DynamicError("No user returned from passkey recovery");const bo=so.connectedChain;if(!findEmbeddedWalletFromVerifiedCredentials(go,[bo]))throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return so.setVerifiedCredentials(go.verifiedCredentials),{connector:so,user:go}}),canRestoreEmbeddedWalletSession=Xr=>{if(!(Xr!=null&&Xr.amount))return!1;const eo=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS);if(!eo)return!1;const to=Xr.amount*(Xr.unit==="minutes"?60:3600),ro=(eo==null?void 0:eo.createdAt)+to*1e3,no=new Date(ro);return new Date>=no?(StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),!1):!0},restoreEmbeddedWalletSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,iframeContainer:to,iframeElementId:ro,wallet:no,sessionExpiration:io}){var oo,ao,so,co;if(!eo)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(no!=null&&no.connector)||!(no!=null&&no.id)||!isPasskeyWalletConnector(no==null?void 0:no.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const lo=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS),uo=(oo=no.connector)===null||oo===void 0?void 0:oo.getAuthenticatorHandler();if(!lo||uo.recoveryUserId)return!1;if(!(yield uo.initRecovery("email",to,ro,io)))throw new DynamicError("Could not open embedded wallet connection communication");uo.recoveryUserId=lo.userId;const go=(co=(so=(ao=eo.verifiedCredentials)===null||ao===void 0?void 0:ao.find(({walletName:bo})=>bo==null?void 0:bo.startsWith("turnkey")))===null||so===void 0?void 0:so.walletProperties)===null||co===void 0?void 0:co.turnkeySubOrganizationId;return yield uo.verifyRecoveryCode(lo.emailCode,go),!0}),addEmailRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,environmentId:to,wallet:ro}){var no,io;if(!(eo!=null&&eo.email))throw new DynamicError(USER_NOT_LOGGED_IN);if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector)||!isEmailWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const{turnkeySubOrganizationId:oo,turnkeyUserId:ao}=(io=(no=eo.verifiedCredentials)===null||no===void 0?void 0:no.find(({walletName:lo})=>lo==null?void 0:lo.startsWith("turnkey")))===null||io===void 0?void 0:io.walletProperties;if(!oo||!ao)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing");const so=ro.connector.getAuthenticatorHandler(),{signedRequest:co}=yield so.addEmailRecovery({email:eo.email,organizationId:oo,turnkeyUserId:ao});return yield updatePasskeyRecoveryEmail({environmentId:to,updateRecoveryEmailRequest:{turnkeySignedRequest:co}}),ro.connector.setEmail(eo.email),refreshUserJwt({environmentId:to})}),useInitEmbeddedWalletAuthMethod=()=>{const{primaryWallet:Xr,environmentId:eo,user:to,projectSettings:ro,setShowAuthFlow:no}=useInternalDynamicContext(),{setView:io}=useViewContext(),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(),{getEOAWallet:lo}=useSmartWallets();return{error:so,initAuthMethod:ho=>__awaiter$j(void 0,[ho],void 0,function*({authenticatorType:go,iframeContainer:bo,currentAction:wo}){var Eo,$o,Co,Ro,Oo;ao(!0);const jo=(Eo=Xr&&lo(Xr))!==null&&Eo!==void 0?Eo:Xr,Bo=((Co=($o=ro==null?void 0:ro.sdk.embeddedWallets)===null||$o===void 0?void 0:$o.sessionKeyDuration)===null||Co===void 0?void 0:Co.amount)||0,Mo=((Oo=(Ro=ro==null?void 0:ro.sdk.embeddedWallets)===null||Ro===void 0?void 0:Ro.sessionKeyDuration)===null||Oo===void 0?void 0:Oo.unit)==="minutes"?60:3600,Fo=go==="email"||!(jo==null?void 0:jo.connector).getAuthenticatorHandler().isSessionActive();try{yield initEmbeddedWalletSession({authenticatorType:go,environmentId:eo,iframeContainer:bo,iframeElementId:iframeElementId$1,sessionExpiration:Bo*Mo||void 0,user:to,wallet:jo}),Fo?(io("passkey-recovery-bundle",{authenticatorType:go,currentAction:wo}),no(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})):no(!1)}catch(Wo){co(Wo),logger$8.error("Failed to create embedded wallet session",Wo),dynamicEvents.emit("passkeyRecoveryFailed",Wo)}finally{ao(!1)}}),isLoading:oo}},usePasskeyRecovery=()=>{var Xr,eo,to;const{environmentId:ro,primaryWallet:no,projectSettings:io,setShowAuthFlow:oo,user:ao}=useInternalDynamicContext(),{createRootElement:so}=useElementById(),co=so(iframeContainerId$1),{isTurnkeyWalletWithoutAuthenticator:lo,hasRecoveryEmail:uo}=useIsTurnkeyWallet(),{initAuthMethod:ho}=useInitEmbeddedWalletAuthMethod(),{setDisplayedDestination:go,setVerificationUUID:bo}=useVerification(),{getEOAWallet:wo}=useSmartWallets(),{setView:Eo}=useViewContext(),$o=(Xr=no&&wo(no))!==null&&Xr!==void 0?Xr:no,Co=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){var Mo,Fo;if(!(!((Mo=io==null?void 0:io.sdk.embeddedWallets)===null||Mo===void 0)&&Mo.sessionKeyDuration)||!canRestoreEmbeddedWalletSession((Fo=io==null?void 0:io.sdk.embeddedWallets)===null||Fo===void 0?void 0:Fo.sessionKeyDuration))return!1;const Wo=getEmbeddedWalletSessionExpiration(io.sdk.embeddedWallets.sessionKeyDuration);try{return yield restoreEmbeddedWalletSession({iframeContainer:co.current,iframeElementId:iframeElementId$1,sessionExpiration:Wo,user:ao,wallet:no})}catch(Jo){logger$8.error("Failed to restore embedded wallet",Jo)}return!1}),[ao,co,no,(to=(eo=io==null?void 0:io.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration]),Ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!$o||!isPasskeyWalletConnector($o.connector))return!1;const Mo=$o.connector.getAuthenticatorHandler();return!(!lo||Mo.isSessionActive()||(yield Co()))}),[$o,lo,Co]),Oo=reactExports.useCallback((Mo,Fo)=>__awaiter$j(void 0,void 0,void 0,function*(){var Wo;(()=>{if(!ao)throw new Error(USER_NOT_LOGGED_IN);if(!isTurnkeyEnabled(io))throw new Error("Dynamic embedded wallet is not enabled. Go to the dashboard and make sure to have both Dynamic embedded wallet and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.");if(!hasEmbeddedWallet(ao))throw new Error("Dynamic embedded wallet not found");if($o&&!isPasskeyWalletConnector($o.connector))throw new Error("Dynamic embedded wallet not found.")})();const Po=($o==null?void 0:$o.connector).getAuthenticatorHandler();if(Mo==="passkey"&&Po.isSessionActive())return yield addNewPasskeyAuthenticator({environmentId:ro,user:ao,wallet:$o}),oo(!1),$o;const fo=getEnabledEmbeddedWalletsAuthenticators((Wo=io==null?void 0:io.sdk.embeddedWallets)===null||Wo===void 0?void 0:Wo.supportedSecurityMethods),yo=fo?Object.keys(fo):[];if(!uo)Eo("passkey-recovery-add-email",{shouldInitRecovery:!0}),oo(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else if(!Mo&&yo.length>1)Eo("embedded-wallet-auth-choice",{currentAction:Fo}),oo(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else{const[vo]=yo;Mo&&!yo.includes(Mo)&&(Mo=vo),yield ho({authenticatorType:Mo||vo,currentAction:Fo,iframeContainer:co.current})}return new Promise((vo,_o)=>{dynamicEvents.once("passkeyRecoveryCompleted",So=>vo(So)),dynamicEvents.once("passkeyRecoveryFailed",So=>_o(So))})}),[$o,io,uo,ro,ao,oo,Eo,ho,co]),jo=Mo=>__awaiter$j(void 0,void 0,void 0,function*(){try{let Fo=ao;ao!=null&&ao.email||(Fo=yield Bo(Mo)),yield addEmailRecovery({environmentId:ro,user:Fo,wallet:no}),dynamicEvents.emit("embeddedWalletRecoveryEmailCompleted","")}catch(Fo){logger$8.error("Failed to add recovery email",Fo),dynamicEvents.emit("embeddedWalletRecoveryEmailFailed",Fo)}}),Bo=Mo=>__awaiter$j(void 0,void 0,void 0,function*(){try{const{nextView:Fo,emailVerification:Wo,userProfile:Jo}=yield updateUserProfileFields(ro,{email:Mo});return Fo===NextViewEnum.Done?Jo:(Eo("verify-email",{isEmailRecoveryFlow:!0}),go(Mo),bo(Wo==null?void 0:Wo.verificationUUID),new Promise((Po,fo)=>{dynamicEvents.once("emailVerificationResult",yo=>{yo&&Po(Jo),fo("Failed to verify email")})}))}catch(Fo){throw logger$8.error("Failed to update user email",Fo),Fo}});return{addRecoveryEmail:jo,initPasskeyRecoveryProcess:Oo,shouldInitRecovery:Ro}},SecureEmbeddedWalletCard=({className:Xr})=>{const{t:eo}=useTranslation(),{primaryWallet:to}=useInternalDynamicContext(),{initPasskeyRecoveryProcess:ro}=usePasskeyRecovery(),{showSecureAccountBanner:no,setShowSecureAccountBanner:io}=usePasskeyContext(),{getEOAWallet:oo}=useSmartWallets(),ao=to&&oo(to),so=to&&isSessionKeyCompatibleWallet(to)||ao&&isSessionKeyCompatibleWallet(ao);return!no||so?null:jsxRuntimeExports.jsxs("div",{className:classNames("secure-embedded-wallet-card",Xr),children:[jsxRuntimeExports.jsxs("div",{className:"secure-embedded-wallet-card__text-content","data-testid":"secure-wallet-button",onClick:()=>ro(),children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",copykey:"dyn_secure_pregenerated_wallet.description",children:eo("dyn_secure_pregenerated_wallet.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"brand-primary",copykey:"dyn_secure_pregenerated_wallet.action",className:"secure-embedded-wallet-card__link",children:eo("dyn_secure_pregenerated_wallet.action")})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(IconButton,{color:"text-secondary",onClick:()=>io(!1),children:jsxRuntimeExports.jsx(SvgClose,{width:16,height:16})})})]})},ONRAMP_PROVIDERS=["banxa"],isOnrampProvider=Xr=>ONRAMP_PROVIDERS.includes(Xr.provider),getWalletAdditionalAddressByType=(Xr,eo)=>{var to,ro;return(ro=(to=eo==null?void 0:eo.additionalAddresses)===null||to===void 0?void 0:to.find(no=>no.type===Xr))===null||ro===void 0?void 0:ro.address},getOnrampProviders=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({chain:eo,environmentId:to,networkId:ro,token:no,walletAddress:io}){const{onramps:oo}=yield sdkApi$1().getSupportedOnramps({chain:eo,environmentId:to,networkId:ro?String(ro):void 0,token:no,walletAddress:io});if(!oo||oo.length===0)throw new Error("No onramps");return oo}),FundingContext=reactExports.createContext(void 0),FundingContextProvider=({children:Xr})=>{var eo,to;const ro=reactExports.useRef(null),[no,io]=reactExports.useState(!1),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(""),{environmentId:lo,network:uo,primaryWallet:ho,projectSettings:go}=useInternalDynamicContext(),bo=(to=(eo=go==null?void 0:go.providers)===null||eo===void 0?void 0:eo.some($o=>isOnrampProvider($o)&&!!$o.enabledAt))!==null&&to!==void 0?to:!1,wo=reactExports.useCallback((...$o)=>__awaiter$j(void 0,[...$o],void 0,function*({address:Co,token:Ro}={}){var Oo;if(!bo||!ho)return;const jo=(Oo=getChainInfo(ho.chain))===null||Oo===void 0?void 0:Oo.name;if(!jo)return;const Bo=isBitcoinConnector(ho.connector)&&getWalletAdditionalAddressByType(WalletAddressType.Payment,ho),Mo=uo&&jo==="evm";try{const[{url:Fo}]=yield getOnrampProviders({chain:jo,environmentId:lo,networkId:Mo?uo.toString():void 0,token:Ro,walletAddress:Co||Bo||ho.address});if(!Fo)throw new Error("No onramp url found");co(Fo),ao(!0)}catch{ao(!1)}}),[lo,bo,uo,ho]),Eo=reactExports.useMemo(()=>({fundingEnabled:bo,fundingRef:ro,fundingUrl:so,setShowFunding:io,showFunding:no,supportsFunding:oo,updateSupportsFunding:wo}),[bo,so,no,oo,wo]);return reactExports.useEffect(()=>{wo()},[lo,bo,uo,ho==null?void 0:ho.address]),jsxRuntimeExports.jsx(FundingContext.Provider,{value:Eo,children:Xr})},useFundingContext=()=>{const Xr=reactExports.useContext(FundingContext);if(Xr===void 0)throw new Error("usage of useFundingContext not wrapped in `FundingContextProvider`.");return Xr},useConfirmationModal=({elementId:Xr})=>{const{createRootElement:eo}=useElementById(),to=eo(Xr),[ro,no]=reactExports.useState(null),io=reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){return new Promise((so,co)=>{try{no(oo(so,co))}catch(lo){co(lo)}}).finally(()=>{no(void 0)})}),[no]);return{modal:ro?jsxRuntimeExports.jsx("div",{children:reactDomExports.createPortal(ro,to.current)}):void 0,open:io}},usePreventPageScroll=Xr=>{const eo=()=>{var ro;const no=document.querySelector("html"),io=document.querySelector("body");if(!no||!io)return;const oo=(ro=window==null?void 0:window.screen)===null||ro===void 0?void 0:ro.height;!(io.scrollHeight>oo)||oo===0||(no.classList.add("dynamic-no-scroll"),io.classList.add("dynamic-no-scroll"))},to=ro=>{const no=document.querySelector("html"),io=document.querySelector("body");!no||!io||(no.classList.remove("dynamic-no-scroll"),io.classList.remove("dynamic-no-scroll"),isIOS$1()&&window.scrollTo(ro.x,ro.y))};reactExports.useEffect(()=>{if(!Xr)return;const ro={x:window.scrollX,y:window.scrollY};return eo(),()=>{to(ro)}},[Xr])},useResizeObserver=(Xr,eo)=>{const[to,ro]=reactExports.useState(),no=reactExports.useCallback(io=>{if(!Array.isArray(io))return;const[oo]=io;ro(oo.contentRect)},[eo,ro]);return reactExports.useLayoutEffect(()=>{if(!Xr.current)return;let io=new ResizeObserver(no);return io.observe(Xr.current),()=>{io==null||io.disconnect(),io=null}},[Xr]),[to]},VerticalDrawerTransition=Xr=>{var{style:eo,children:to,className:ro}=Xr,no=__rest$7(Xr,["style","children","className"]);const io=reactExports.useRef(null),oo=reactExports.useRef(null),[ao]=useResizeObserver(oo),so=reactExports.useMemo(()=>ao==null?void 0:ao.height,[ao]),{mount:co,stage:lo,currentDuration:uo}=useTransition(Object.assign({animateOnMount:!1},no)),ho=reactExports.useMemo(()=>!co||lo==="EXITING"||lo==="UNMOUNT"?0:so,[lo,so,co]);return jsxRuntimeExports.jsx("div",{ref:io,className:classNames(ro,"vertical-drawer-animation"),style:Object.assign(Object.assign({},eo),{maxHeight:ho,transitionDuration:`${uo}ms`}),children:jsxRuntimeExports.jsx("div",{ref:oo,children:co&&to})})},Modal$1=({children:Xr,className:eo,isShown:to=!0,transitionProps:ro})=>jsxRuntimeExports.jsx("div",{className:classNames("modal",eo),children:jsxRuntimeExports.jsx(SlideInUpTransition,Object.assign({},ro,{isShown:to,children:jsxRuntimeExports.jsx("div",{className:"modal__items",children:Xr})}))}),ModalCard=({children:Xr,borderRadius:eo="default",border:to=!1,sharpBottomRadiusOnMobile:ro=!0,dataTestId:no="modal-card"})=>jsxRuntimeExports.jsx("div",{"data-testid":no,className:classNames("modal-card",{"modal-card--sharp-mobile-bottom-radius":ro,"modal-card--with-border":to},`modal-card--radius-${eo}`),children:Xr}),useKeyboardEventListener=({disabled:Xr,inputKey:eo,onKeyPressed:to})=>{reactExports.useEffect(()=>{const ro=no=>{Xr||no.key!==eo||to(no)};return document.addEventListener("keydown",ro),()=>{document.removeEventListener("keydown",ro)}},[Xr,eo,to])},ModalComponent=({children:Xr,handleClose:eo,withBackdrop:to=!0,zIndex:ro,whiteList:no})=>{const{view:io}=useViewContext(),oo=(io==null?void 0:io.type)&&io.type!=="collect-user-data"&&io.type!=="login-with-email-verification"&&io.type!=="login-with-sms-verification"&&io.type!=="verify-sms"&&io.type!=="verify-email"&&io.type!=="mfa-verification"&&io.type!=="mfa-display-backup-codes",ao=so=>{oo&&(so.stopPropagation(),eo(so))};return useKeyboardEventListener({disabled:!oo,inputKey:"Escape",onKeyPressed:eo}),jsxRuntimeExports.jsxs(FocusLockCombination,{className:"portal__container",whiteList:no,children:[to&&jsxRuntimeExports.jsx("div",{"data-testid":"portal-backdrop",role:"button",onClick:so=>{ao(so)},tabIndex:0,"aria-label":"Close modal",style:{zIndex:ro?ro-2:void 0},className:"portal__backdrop"}),jsxRuntimeExports.jsx("div",{style:{zIndex:ro},children:Xr})]})},Portal=({children:Xr,isShown:eo,handleClose:to,withBackdrop:ro,zIndex:no,transitionEvents:io,elementId:oo="dynamic-modal"})=>{const{createRootElement:ao}=useElementById(),so=ao(oo);return reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:no,dataTestId:"dynamic-modal-shadow",children:jsxRuntimeExports.jsx(OpacityTransition,Object.assign({isShown:eo},io,{children:jsxRuntimeExports.jsx(ModalComponent,{handleClose:to,withBackdrop:ro,whiteList:co=>so.current.contains(co),children:Xr})}))}),so.current)},ChainIcon=({chain:Xr,chainName:eo})=>{const to=getChainIcon(eo);return jsxRuntimeExports.jsx(Icon,{size:"small",children:Xr!=null&&Xr.icon?jsxRuntimeExports.jsx("img",{src:Xr.icon,alt:`${Xr.name} icon`}):jsxRuntimeExports.jsx(to,{})})};var _path$Z,_excluded$17=["title","titleId"];function _extends$19(){return _extends$19=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$17(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowLeft=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$17(eo,_excluded$17);return reactExports.createElement("svg",_extends$19({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Z||(_path$Z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.707 4.293a1 1 0 0 1 0 1.414L5.414 11H21a1 1 0 1 1 0 2H5.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",fill:"currentColor"})))};const getNetworkInfoEntry=(Xr,eo)=>{if(!Xr||!Xr.symbol)return;const to=Xr.symbol==="ETH"||Xr.symbol==="EVM"?"evm":Xr.symbol.toLowerCase(),ro=eo[to]||eo[ChainEnumToVerifiedCredentialName[to.toUpperCase()]];if(ro)return to==="evm"?ro.find(no=>no.chainId===(Xr==null?void 0:Xr.chainId)):ro[0]},getEvmChainName=Xr=>({1:"Ethereum",10:"OP Mainnet",11155111:"Sepolia",137:"Polygon",42161:"Arbitrum One",43114:"Avalanche",8453:"Base"})[Xr]||"Unknown",ModalHeader=({alignContent:Xr,children:eo,leading:to,displayLeading:ro=!0,trailing:no,displayTrailing:io=!0,style:oo,displayBorder:ao})=>{const so=ro&&to&&reactExports.Children.count(to),co=io&&no&&reactExports.Children.count(no);return jsxRuntimeExports.jsxs("div",{className:classNames("modal-header",{"modal-header--align-content-bottom":Xr==="bottom","modal-header--border":ao,"modal-header--empty":!so&&!eo&&!co}),style:oo,children:[ro&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header__leading",{"modal-header__leading--empty":!so}),children:to}),eo,io&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header__trailing",{"modal-header__trailing--empty":!co}),children:no})]})};var _g$b,_defs$b,_excluded$16=["title","titleId"];function _extends$18(){return _extends$18=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$16(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDynamicLogo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$16(eo,_excluded$16);return reactExports.createElement("svg",_extends$18({fill:"none",viewBox:"0 0 114 21",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$b||(_g$b=reactExports.createElement("g",{clipPath:"url(#dynamic-logo_svg__a)",fill:"currentColor"},reactExports.createElement("path",{d:"M10.053 2.002c-.43.4-.85.793-1.273 1.184-1.959 1.818-3.918 3.638-5.879 5.453-.45.417-.915.817-1.48 1.061C.75 9.99.365 9.81.15 9.085-.153 8.072.009 7.128.59 6.258 1.087 5.517 1.71 4.9 2.354 4.3A178.857 178.857 0 0 1 5.45 1.47c.457-.408.957-.78 1.567-.905 1.828-.368 2.994 1.384 3.038 1.436l-.002.001zM1.259 11.254c1.112-.32 1.946-1.026 2.758-1.768 2.59-2.363 5.176-4.728 7.777-7.078A16.823 16.823 0 0 1 13.609.96C14.42.408 15.303.33 16.173.855c.314.189.623.409.878.672a106.565 106.565 0 0 1 5.28 5.866c.298.358.542.774.744 1.196.375.785.279 1.561-.178 2.293-.409.655-.956 1.192-1.52 1.702a699.92 699.92 0 0 1-6.653 5.96c-.6.53-1.26 1.004-1.94 1.422-1.282.791-2.568.693-3.737-.244A16.245 16.245 0 0 1 7.14 17.92c-1.883-2.087-3.73-4.203-5.592-6.31-.094-.106-.18-.22-.29-.358v.002zM39.574.915h2.808V16.14h-2.808v-1.284c-.827 1.06-2.003 1.587-3.526 1.587-1.522 0-2.717-.555-3.755-1.664s-1.556-2.469-1.556-4.078c0-1.609.518-2.968 1.556-4.077s2.288-1.665 3.755-1.665 2.7.53 3.526 1.587V.913v.002zm-5.17 11.996c.573.572 1.294.859 2.166.859s1.589-.287 2.155-.86c.566-.572.849-1.309.849-2.207 0-.898-.283-1.635-.85-2.207-.565-.572-1.283-.859-2.154-.859s-1.593.287-2.166.86c-.574.571-.86 1.308-.86 2.206 0 .898.286 1.635.86 2.208zM51.766 5.264h3.004l-3.968 10.894c-.566 1.554-1.315 2.682-2.251 3.385-.934.704-2.098 1.02-3.489.947v-2.61c.755.015 1.352-.144 1.796-.477.442-.334.796-.87 1.057-1.61L43.453 5.268h3.069l2.837 7.308 2.409-7.308-.002-.002zM61.908 4.959c1.19 0 2.174.398 2.949 1.196.777.798 1.163 1.9 1.163 3.305v6.678h-2.808v-6.33c0-.723-.196-1.279-.588-1.664-.392-.383-.914-.576-1.567-.576-.725 0-1.306.224-1.74.674s-.654 1.124-.654 2.022v5.872h-2.808V5.261h2.808v1.218c.683-1.014 1.763-1.522 3.243-1.522l.002.002zM76.243 5.264h2.808V16.14h-2.808v-1.283c-.842 1.06-2.024 1.587-3.548 1.587s-2.695-.555-3.733-1.665-1.556-2.468-1.556-4.077c0-1.61.518-2.968 1.556-4.078C70 5.514 71.242 4.96 72.695 4.96c1.524 0 2.706.53 3.548 1.587V5.262v.002zm-5.182 7.646c.566.572 1.284.86 2.156.86s1.592-.288 2.166-.86c.573-.572.86-1.309.86-2.207 0-.898-.287-1.635-.86-2.207-.574-.572-1.295-.86-2.166-.86s-1.59.288-2.156.86c-.566.572-.849 1.309-.849 2.207 0 .898.283 1.635.85 2.207zM92.864 4.959c1.249 0 2.246.406 2.993 1.218.748.813 1.121 1.9 1.121 3.263v6.7H94.17V9.637c0-.652-.16-1.16-.48-1.523s-.769-.544-1.35-.544c-.638 0-1.135.211-1.49.631-.356.42-.533 1.03-.533 1.828v6.113h-2.808V9.638c0-.651-.16-1.159-.48-1.522-.32-.363-.77-.544-1.35-.544-.623 0-1.121.21-1.491.631-.37.42-.555 1.03-.555 1.828v6.113h-2.808V5.269h2.808v1.153c.653-.972 1.661-1.457 3.027-1.457 1.365 0 2.321.522 2.96 1.566.724-1.044 1.807-1.566 3.242-1.566l.002-.006zM100.15 3.959c-.464 0-.868-.17-1.208-.511a1.653 1.653 0 0 1-.512-1.207c0-.465.17-.87.512-1.219.34-.348.744-.522 1.208-.522.464 0 .888.174 1.23.522.341.348.511.754.511 1.219 0 .464-.17.866-.511 1.207-.34.34-.751.511-1.23.511zM98.757 16.14V5.265h2.808V16.14h-2.808zM108.69 16.443c-1.641 0-3.008-.55-4.103-1.654-1.095-1.101-1.643-2.464-1.643-4.088s.548-2.987 1.643-4.089 2.464-1.653 4.103-1.653c1.06 0 2.024.253 2.895.76.871.508 1.532 1.19 1.981 2.045l-2.416 1.413a2.464 2.464 0 0 0-.989-1.067 2.878 2.878 0 0 0-1.491-.39c-.842 0-1.539.28-2.091.837-.551.559-.827 1.272-.827 2.142 0 .87.276 1.563.827 2.12.552.56 1.249.837 2.091.837.566 0 1.069-.126 1.513-.381.442-.254.773-.606.99-1.056l2.438 1.393a5.463 5.463 0 0 1-2.024 2.055c-.871.515-1.835.772-2.895.772l-.002.004z"}))),_defs$b||(_defs$b=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"dynamic-logo_svg__a"},reactExports.createElement("path",{transform:"translate(0 .5)",fill:"#fff",d:"M0 0h113.61v20H0z"})))))};const DynamicWidgetFooter=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"dynamic-widget-footer","data-testid":"dynamic-widget-footer",children:Xr}),URL$3="https://dynamic.xyz",alignClassNames={center:"powered-by-dynamic--center",right:"powered-by-dynamic--right"},PoweredByDynamic=({align:Xr="center",classNameLogo:eo,classNameRoot:to,classNameText:ro,asFooter:no})=>{var io;const{projectSettings:oo}=useInternalDynamicContext();if(((io=oo==null?void 0:oo.sdk)===null||io===void 0?void 0:io.displayDynamicMessaging)===!1)return null;const ao=jsxRuntimeExports.jsxs("a",{target:"_blank",href:URL$3,className:classNames("powered-by-dynamic",alignClassNames[Xr],to),rel:"noreferrer",children:[jsxRuntimeExports.jsx(Typography,{as:"span",color:"tertiary",weight:"regular",variant:"body_mini",className:classNames("powered-by-dynamic__text",ro),children:"Powered by"}),jsxRuntimeExports.jsx(SvgDynamicLogo,{className:classNames("powered-by-dynamic__logo",eo)})]});return no?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:ao}):ao},useFetchChain=Xr=>{const eo=()=>__awaiter$j(void 0,void 0,void 0,function*(){var no,io;if(!Xr)return{chainId:void 0,name:"",symbol:void 0};const oo=yield Xr.getNetwork(),{connectedChain:ao}=Xr,so=getChainInfoWithOverrides(ao||""),co={chainId:oo,name:so==null?void 0:so.displayName,symbol:so==null?void 0:so.symbol};if(oo&&Xr.evmNetworks){const lo=Xr.evmNetworks.find(uo=>uo.chainId===oo);co.name=(io=(no=lo==null?void 0:lo.vanityName)!==null&&no!==void 0?no:lo==null?void 0:lo.name)!==null&&io!==void 0?io:co.name,co.icon=lo==null?void 0:lo.iconUrls[0]}return co}),{data:to,isLoading:ro}=usePromise(eo,{deps:[Xr]});return{chain:to,isLoading:ro}},getOrdinalNumber=Xr=>Xr<1?"":Xr%10===1&&Xr%100!==11?`${Xr}st`:Xr%10===2&&Xr%100!==12?`${Xr}nd`:Xr%10===3&&Xr%100!==13?`${Xr}rd`:`${Xr}th`,FormFieldLabel=({children:Xr,htmlFor:eo,className:to,divider:ro})=>jsxRuntimeExports.jsx("label",{className:classNames("form-field-label",{"form-field-label__with-divider":ro},to),htmlFor:eo,children:Xr}),roundToNthDecimal=(Xr,eo)=>{if(!Xr)return;const to=Math.pow(10,eo),ro=Math.round(Xr*to)/to,no="0".repeat(eo-1);return ro===0?`<0.${no}1`:ro};var _path$Y,_excluded$15=["title","titleId"];function _extends$17(){return _extends$17=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$15(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgStroke=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$15(eo,_excluded$15);return reactExports.createElement("svg",_extends$17({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Y||(_path$Y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.293 19.707a1 1 0 0 1 0-1.414L14.586 12 8.293 5.707a1 1 0 0 1 1.414-1.414l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0Z",fill:"currentColor"})))};const Skeleton=({count:Xr=1,className:eo,style:to})=>{const ro=[];for(let no=0;nojsxRuntimeExports.jsx("span",{"data-testid":"loading-skeleton",children:no},`skeleton-${io}`))})},erc20Abi$1=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],OverlayCard=({isOpen:Xr,children:eo,onClickOverlay:to,style:ro,className:no})=>{const io=useOverlayCardTarget(Xr);usePreventPageScroll(Xr&&!io);const oo=reactExports.useRef(null);useOnClickOutside(oo,()=>to==null?void 0:to());const ao=jsxRuntimeExports.jsxs("div",{className:classNames("overlay-card",{"overlay-card--disabled":!Xr}),style:{position:io===void 0?"fixed":"absolute"},children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:Xr&&jsxRuntimeExports.jsx("div",{onClick:to,className:"overlay-card__overlay"})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(SlideInUpTransition,{className:"overlay-card__animation overlay-card__animation--limit-height"}),children:Xr&&jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:Xr&&jsxRuntimeExports.jsx("div",{ref:oo,className:classNames(no,"overlay-card__content"),style:ro,children:eo})})})]});return io?reactDomExports.createPortal(ao,io):reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{children:ao}),document.body)},MenuList=({isOpen:Xr,onClickClose:eo,popperProps:to,dropdownClassName:ro,dropdownStyle:no,overlayCardClassName:io,overlayCardStyle:oo,className:ao,style:so,children:co,mobileTitle:lo})=>{const uo=jsxRuntimeExports.jsx(IconButton,{onClick:eo,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return isMobile$1()?jsxRuntimeExports.jsxs(OverlayCard,{isOpen:Xr,onClickOverlay:eo,className:classNames(io,ao),style:Object.assign(Object.assign({},so),oo),children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:uo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",children:lo})}),jsxRuntimeExports.jsx("div",{className:"menu-list__overlay-card__container",children:co})]}):jsxRuntimeExports.jsx(Dropdown,Object.assign({isOpen:Xr,onClickOutside:eo,onScroll:eo,className:classNames(ro,ao),style:Object.assign(Object.assign({},so),no)},to,{children:co}))},TokensBalanceDropdown=({tokenBalances:Xr,currentToken:eo,setCurrentToken:to,isLoading:ro,setFieldValue:no,setErrors:io})=>{const{t:oo}=useTranslation(),[ao,so]=reactExports.useState(!1),co=(Xr==null?void 0:Xr.filter(wo=>wo.name))||[],{primaryWallet:lo}=useInternalDynamicContext(),uo=reactExports.useRef(null),ho=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!lo||!("getPublicClient"in lo)||typeof lo.getPublicClient!="function")return;const Eo=yield lo.getPublicClient();if(!Eo)return;const $o={abi:erc20Abi$1,address:wo.address},Co=yield Eo.multicall({contracts:[Object.assign(Object.assign({},$o),{args:[lo==null?void 0:lo.address],functionName:"balanceOf"}),Object.assign(Object.assign({},$o),{functionName:"decimals"})]}),[Ro,Oo]=Co.map(jo=>Number(jo.result));if(Ro&&Oo){if(wo.balance=Ro/Math.pow(10,Oo),wo.rawBalance=Ro,Xr){const jo=Xr.findIndex(Bo=>Bo.name===wo.name);Xr[jo]=wo}wo.decimals=Oo}}),go=wo=>__awaiter$j(void 0,void 0,void 0,function*(){var Eo,$o;const Co=(Eo=Xr==null?void 0:Xr.find(Ro=>Ro.name===wo))!==null&&Eo!==void 0?Eo:void 0;Co!=null&&Co.address&&(Co!=null&&Co.address.startsWith("0x"))&&ho(Co),Co&&(Xr&&(!(($o=Xr[0])===null||$o===void 0)&&$o.price)&&setSendBalanceVariable("nativePrice",Xr[0].price),to(Co),no("amount",""),setSendBalanceVariable("amount",0),io({})),so(!ao)});if(ro)return jsxRuntimeExports.jsx(Skeleton,{});const bo=(wo,Eo)=>wo!=null&&wo.logoURI?jsxRuntimeExports.jsx("img",{src:wo.logoURI,alt:wo==null?void 0:wo.name,width:Eo,height:Eo}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"});return jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown",ref:uo,onClick:()=>so(!ao),"data-testid":"tokens-balance-dropdown",children:[!ro&&jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__selected",children:[bo(eo,"20"),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:eo==null?void 0:eo.name}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":ao}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]}),jsxRuntimeExports.jsx(MenuList,{className:"tokens-balance-dropdown__menu_list",isOpen:ao,popperProps:{anchorOrigin:"bottom-left",anchorRef:uo},mobileTitle:"Select token",children:co.length>0?co.map(wo=>jsxRuntimeExports.jsxs("button",{className:"tokens-balance-dropdown__menu_list_item",onClick:()=>go(wo.name),children:[jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__name",children:[bo(wo,"16"),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:wo.name})]}),jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:wo.symbol}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:roundToNthDecimal(wo.balance,6)})]})]},wo.address)):jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:oo("dyn_wallet_information.multi_asset.empty_state")})})})]})},useEffectOnce=Xr=>{reactExports.useEffect(Xr,[])},useCurrencySymbol=(Xr,eo)=>(Xr==null?void 0:Xr.symbol)||eo,getValueRounded=(Xr,eo)=>{let to;return Xr?to=eo.value?eo.format(eo.value):"0":to=eo!=null&&eo.nonNativeValue&&(eo!=null&&eo.formatNonNativeToken)?eo.formatNonNativeToken(eo.nonNativeValue,eo.nonNativeDecimal||18):"0",roundToNthDecimal(Number(to),6)},calculateFiatPrice=(Xr,eo,to)=>{if(Xr===void 0||isNaN(Xr)||!to||!eo)return 0;const ro=BigInt(Math.pow(10,to)),no=Number(eo.toFixed(to));try{const io=BigInt(Xr*Number(ro)),oo=BigInt(no*Number(ro)),ao=io*oo;return Number(ao/ro)/Number(ro)}catch{return}},getDisplayFiatPrice=(Xr,eo)=>{if(!(eo!=null&&eo.price))return"--";const to=calculateFiatPrice(Xr,eo.price,eo.decimals);return to===void 0?"--":to===0||to>=.01?to.toFixed(2):"<0.01"},useHandleRecovery=(Xr,eo,to,ro,no,io)=>{const oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){(yield ro())&&Xr&&!eo(Xr)&&(yield no("email","sendTransaction")),to==null||to("callHandlerOutsideModal")});useEffectOnce(()=>{io&&oo()})},useHandleSubmitWithChecks=(Xr,eo,to)=>ro=>__awaiter$j(void 0,void 0,void 0,function*(){const{walletConnector:no,usingSessionKey:io,onClickSend:oo,isTurnkeyWallet:ao,userNeedsCrossDomainPasskey:so}=Xr,{shouldInitRecovery:co,initPasskeyRecoveryProcess:lo}=eo,{setView:uo,setShowAuthFlow:ho}=to;if(no&&io(no)){oo(ro);return}if((yield co())&&(yield lo("email","sendTransaction")),ao&&so){uo("passkey-new-domain-detected"),ho(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{oo(ro)});return}oo(ro)}),sendBalanceFormInitialValues={amount:"",recipient:""},getDisplayErrorMessage$1=(Xr,eo,to,ro)=>{const no={amount:{invalidDecimals:eo("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:ro}),invalidFormat:eo("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:ro}),overBalance:eo("dyn_send_transaction.validation.amount.over_balance"),required:eo("dyn_send_transaction.validation.amount.required")},recipient:{invalidFormat:eo("dyn_send_transaction.validation.recipient.invalid_format"),required:eo("dyn_send_transaction.validation.recipient.required")}},io=Xr[to];return io?no[to][io].replace("{decimals}",getOrdinalNumber(ro??0)):""},SendBalanceForm=({initialValues:Xr,onSubmit:eo,decimals:to=18,validateAddress:ro=()=>!0,validateAmount:no=()=>!0,currentToken:io,transaction:oo,tokenBalances:ao,setCurrentToken:so,isLoading:co})=>{const{t:lo}=useTranslation(),{showFiat:uo}=useInternalDynamicContext(),ho=reactExports.useRef(null),[go,bo]=reactExports.useState(0),{amount:wo}=useSendBalanceState();reactExports.useEffect(()=>{if(ho.current){const $o=ho.current.offsetWidth;bo($o+15)}},[io]);const Eo=reactExports.useMemo(()=>{const $o=new RegExp(`^\\d*(\\.\\d{1,${to}})?$`);return create$4().shape({amount:create$5().required("required").matches(/^\d*(\.\d+)?$/,"invalidFormat").matches($o,"invalidDecimals").test({message:"overBalance",test:Co=>no(Co)}),recipient:create$5().required("required").test({message:"invalidFormat",test:Co=>ro(Co)})})},[to,ro,no]);return jsxRuntimeExports.jsx(Formik,{initialValues:Xr||sendBalanceFormInitialValues,validationSchema:Eo,onSubmit:$o=>eo($o),validateOnChange:!1,validateOnBlur:!1,children:({errors:$o,touched:Co,values:Ro,handleChange:Oo,setFieldValue:jo,setErrors:Bo,handleBlur:Mo,setFieldTouched:Fo,validateField:Wo})=>{var Jo;return jsxRuntimeExports.jsxs(Form,{className:"send-balance-form",children:[jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__balance-container",children:[jsxRuntimeExports.jsx(FormFieldLabel,{children:"Select any token"}),jsxRuntimeExports.jsx(TokensBalanceDropdown,{tokenBalances:ao??(io&&[io]),currentToken:io,setCurrentToken:so,isLoading:co,setFieldValue:jo,setErrors:Bo})]}),jsxRuntimeExports.jsxs("div",{className:"send-balance-form__amount-container",children:[jsxRuntimeExports.jsx(Field$1,{variant:"regular",className:`send-balance-form__amount-container__field ${uo?"fiat":""}`,name:"amount",id:"amount",onChange:Po=>{const fo=Po.target.value;if(!(fo!==""&&!/^(?:\d+|\d*\.\d*|)$/.test(fo))){if(Bo({}),Oo(Po),!fo||Number.isNaN(fo)){setSendBalanceVariable("amount",0);return}setSendBalanceVariable("amount",io!=null&&io.price?Number(fo):void 0)}},onBlur:Po=>{Mo(Po),Fo("amount",!0),Wo("amount")},placeholder:lo("dyn_send_transaction.data.amount.placeholder"),as:Input,error:$o.amount,copykey:"dyn_send_transaction.data.amount.label",message:Co.amount&&getDisplayErrorMessage$1($o,lo,"amount",to),style:{paddingLeft:`${go}px`}}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__floating_value",ref:ho,children:jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"regular",color:"secondary",children:io==null?void 0:io.symbol})}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__balance",children:uo&&!Number.isNaN(wo)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"bold",color:"secondary",children:"$"}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"regular",color:"secondary",children:getDisplayFiatPrice(wo,io)})]})})]}),jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available",variant:"body_small",weight:"regular",color:"secondary",as:"div",children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"0.225rem"},children:[jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available__line",variant:"body_small",weight:"bold",color:"primary",as:"div",children:(Jo=roundToNthDecimal(io==null?void 0:io.balance,6))!==null&&Jo!==void 0?Jo:0}),`${io==null?void 0:io.symbol} Available`]})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:"Recipient Address"}),jsxRuntimeExports.jsx(Field$1,{className:"send-balance-form__field",placeholder:lo("dyn_send_transaction.data.recipient.placeholder"),label:lo("dyn_send_transaction.data.recipient.label"),id:"recipient",name:"recipient",as:Input,error:$o.recipient,copykey:"dyn_send_transaction.data.recipient.label",message:Co.recipient&&getDisplayErrorMessage$1($o,lo,"recipient")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"sendBalanceFormSubmitButton",expanded:!0,type:"submit",buttonVariant:"primary",buttonPadding:"small",buttonClassName:"send-balance-form__button",copykey:"dyn_send_transaction.preview_transaction",children:lo("dyn_send_transaction.preview_transaction")})]})}})},useNetworkConfigurationsFromProjectSettings=({projectSettings:Xr,cosmosNetworkOverrides:eo,evmNetworksOverrides:to})=>reactExports.useMemo(()=>{var ro,no,io,oo;const ao=Xr==null?void 0:Xr.networks;if(!ao)return{};const so=ao.find($o=>$o.chainName==="evm"),co=ao.find($o=>$o.chainName==="solana"),lo=ao.find($o=>$o.chainName==="cosmos"),uo=ao.find($o=>$o.chainName==="starknet");let ho=(ro=lo==null?void 0:lo.networks)===null||ro===void 0?void 0:ro.map($o=>createNetwork($o,parseInt));ho=overrideNetworks(eo,ho);let go=(no=so==null?void 0:so.networks)===null||no===void 0?void 0:no.map($o=>createNetwork($o,parseInt));go=overrideNetworks(to,go);const bo=(io=uo==null?void 0:uo.networks)===null||io===void 0?void 0:io.map($o=>createNetwork($o)),wo=(oo=co==null?void 0:co.networks)===null||oo===void 0?void 0:oo.map($o=>createNetwork($o));return to&&(Array.isArray(to)?go=to:go=to(go??[])),{cosmos:ho,evm:go,solana:wo,starknet:bo}},[Xr==null?void 0:Xr.networks,eo,to]),createNetwork=(Xr,eo=to=>to)=>({bech32Prefix:Xr.bech32Prefix,blockExplorerUrls:Xr.blockExplorerUrls,chainId:eo(Xr.chainId),iconUrls:Xr.iconUrls,lcdUrl:Xr.lcdUrl,name:Xr.name,nativeCurrency:Xr.nativeCurrency,networkId:eo(Xr.networkId),privateCustomerRpcUrls:Xr.privateCustomerRpcUrls,rpcUrls:Xr.rpcUrls,vanityName:Xr.vanityName}),overrideNetworks=(Xr,eo)=>Xr?Array.isArray(Xr)?Xr:Xr(eo??[]):eo,zeroAddress$1="0x0000000000000000000000000000000000000000",nativeSolanaAddress$1="11111111111111111111111111111111",SendBalancePageLayout=({error:Xr,onClickClose:eo,onClickBack:to,onSubmit:ro,displayPoweredByDynamicFooter:no=!1,transaction:io,networkCurrencyDecimals:oo,tokenBalances:ao,currentToken:so,setCurrentToken:co,isLoading:lo,isNativeToken:uo})=>{var ho;const{t:go}=useTranslation(),{primaryWallet:bo,projectSettings:wo,overrides:Eo}=useInternalDynamicContext(),$o=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:Eo==null?void 0:Eo.evmNetworks,projectSettings:wo}),Co=bo==null?void 0:bo.connector,{chain:Ro}=useFetchChain(Co),Oo=eo&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:eo,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),jo=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),{data:Bo}=usePromise(()=>io.getBalance(),{deps:[io]});reactExports.useEffect(()=>{const Fo=()=>__awaiter$j(void 0,void 0,void 0,function*(){const Jo=getNetworkInfoEntry(Ro,$o);if(!Jo){logger$8.error("Token info not found. Please make sure you are on a supported chain and it is enabled. See https://docs.dynamic.xyz/chains/enabling-chains");return}const Po={address:(Ro==null?void 0:Ro.name)==="Solana"?nativeSolanaAddress$1:zeroAddress$1,balance:0,decimals:Jo.nativeCurrency.decimals,logoURI:Jo.nativeCurrency.iconUrl||Jo.iconUrls[0],name:Jo.name,rawBalance:0,symbol:Jo.nativeCurrency.symbol},fo=yield bo==null?void 0:bo.getBalance();fo&&(Po.balance=Number(fo),Po.rawBalance=Number(fo)/Math.pow(10,Po.decimals)),co(Po)});__awaiter$j(void 0,void 0,void 0,function*(){lo||(ao===void 0||Array.isArray(ao)&&ao.length===0?yield Fo():so||co(ao[0]))})},[ao,Ro]);const Mo=()=>uo?io.value?io.format(io.value):"":io!=null&&io.formatNonNativeToken&&(io!=null&&io.nonNativeValue)&&(io!=null&&io.nonNativeDecimal)?io.formatNonNativeToken(io.nonNativeValue,io.nonNativeDecimal):"";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:jo,trailing:Oo,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.send",children:go("dyn_send_transaction.data.send")})})}),jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__body",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:Xr&&jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__error",children:jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",children:Xr})})}),jsxRuntimeExports.jsx(SendBalanceForm,{tokenBalances:ao,setCurrentToken:co,isLoading:lo,onSubmit:({amount:Fo,recipient:Wo})=>{uo?io.value=io.parse(Fo):io.parseNonNativeToken&&(io.nonNativeValue=io.parseNonNativeToken(Fo,(so==null?void 0:so.decimals)||18),io.value=BigInt(0),io.nonNativeAddress=so==null?void 0:so.address,io.nonNativeDecimal=so==null?void 0:so.decimals),io.to=Wo,ro()},initialValues:{amount:Mo(),recipient:(ho=io.to)!==null&&ho!==void 0?ho:""},decimals:uo?oo:so==null?void 0:so.decimals,validateAddress:Fo=>Fo?io.validateAddressFormat(Fo):!0,validateAmount:Fo=>Fo?uo?Bo?io.parse(Fo)<=Bo:!1:!(so!=null&&so.rawBalance)||!io.parseNonNativeToken?!1:Number(io.parseNonNativeToken(Fo,(so==null?void 0:so.decimals)||18))<=so.rawBalance:!1,currentToken:so,transaction:io}),no&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"send-balance-page-layout__footer"})]})]})};var _path$X,_excluded$14=["title","titleId"];function _extends$16(){return _extends$16=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$14(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckBlue=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$14(eo,_excluded$14);return reactExports.createElement("svg",_extends$16({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$X||(_path$X=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const shortenWalletAddress=(Xr,eo=6,to=4)=>Xr?Xr.replace(Xr.substring(eo,Number(Xr.length)-to),"..."):"",getGasFiatValue=(Xr,eo,to)=>{if(!(Xr!=null&&Xr.price)||!eo.fee.gas)return;let ro=Xr.price;return to&&(ro=to),(Number(eo.format(eo.fee.gas))*ro).toFixed(2)},getTotalFiatCost=(Xr,eo,to,ro)=>{const no=getGasFiatValue(Xr,eo,to);return!no||!(Xr!=null&&Xr.price)?void 0:(Number(no)+Number(ro)*Xr.price).toFixed(2)},TransactionStatusLayout=({destinationAddress:Xr,transactionValue:eo,networkCurrency:to,onDone:ro,displayPoweredByDynamicFooter:no=!0,onClickClose:io,transaction:oo,currentToken:ao,isNativeToken:so})=>{const{t:co}=useTranslation(),{showFiat:lo}=useInternalDynamicContext(),{nativePrice:uo}=useSendBalanceState(),ho=io&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:io,"data-testid":"close",children:jsxRuntimeExports.jsx(SvgClose,{})}),go=getTotalFiatCost(ao,oo,uo,eo);return jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ho,alignContent:"bottom",children:jsxRuntimeExports.jsx(Icon,{size:"large",className:"transaction-status-layout__status-icon",children:jsxRuntimeExports.jsx(SvgCheckBlue,{})})}),jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__sent_to",children:[jsxRuntimeExports.jsxs(Typography,{variant:"body_small",color:"secondary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[co("dyn_send_transaction.succeeded.title")," "]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:shortenWalletAddress(Xr,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__content",children:jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__rows",children:jsxRuntimeExports.jsxs(Typography,{variant:"title",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[`${getValueRounded(so,oo)} ${to} `,lo&&(ao==null?void 0:ao.price)&&`($${Number(go)<=.01?"<0.01":go})`]})})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:jsxRuntimeExports.jsx(Alert,{variant:"info",copykey:"dyn_send_transaction.info_message.refresh_balance_time",children:co("dyn_send_transaction.info_message.refresh_balance_time")})})}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",expanded:!0,onClick:ro,loading:!1,copykey:"dyn_send_transaction.succeeded.continue_button",dataTestId:"transaction-done-continue",children:co("dyn_send_transaction.succeeded.continue_button")})}),no&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-status-layout__footer"})]})]})},getAppOrigin=()=>{if(typeof window<"u")return window.location.origin},useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,useInterval=(Xr,eo)=>{const to=reactExports.useRef(Xr);useIsomorphicLayoutEffect(()=>{to.current=Xr},[Xr]),reactExports.useEffect(()=>{if(!eo&&eo!==0)return;const ro=setInterval(()=>to.current(),eo);return()=>clearInterval(ro)},[eo])},useMutation=(Xr,eo={})=>{const[to,ro]=reactExports.useState({isLoading:!1}),no=reactExports.useCallback(io=>__awaiter$j(void 0,void 0,void 0,function*(){var oo,ao;let so;ro({isLoading:!0});try{const co=Xr(io);co instanceof Promise?so=yield co:so=co,ro({data:so,isLoading:!1});try{(oo=eo==null?void 0:eo.onSuccess)===null||oo===void 0||oo.call(eo,so,io)}catch(lo){logger$9.error(lo)}return so}catch(co){ro({error:co,isLoading:!1}),logger$9.error(co);try{(ao=eo==null?void 0:eo.onFailure)===null||ao===void 0||ao.call(eo,co,io)}catch(lo){logger$9.error(lo)}}}),[Xr,eo]);return Object.assign(Object.assign({},to),{hasData:!!to.data,hasError:!!to.error,mutate:no})},useFetchCurrency=(Xr,eo)=>{const to=()=>__awaiter$j(void 0,void 0,void 0,function*(){var io,oo,ao,so;if(!Xr)return null;const co=yield Xr.getNetwork(),lo=getChainInfoWithOverrides((io=Xr.connectedChain)!==null&&io!==void 0?io:"");if(!co)return lo==null?void 0:lo.symbol;const uo=Xr.connectedChain==="STARK"?"starknetNetworks":"evmNetworks",ho=(oo=Xr[uo])===null||oo===void 0?void 0:oo.find(go=>go.chainId===co);return(so=(ao=ho==null?void 0:ho.nativeCurrency)===null||ao===void 0?void 0:ao.symbol)!==null&&so!==void 0?so:lo==null?void 0:lo.symbol}),{data:ro,isLoading:no}=usePromise(to,{deps:[eo]});return{currency:ro,isLoading:no}},usingSessionKey=Xr=>isSessionKeyCompatibleWalletConnector(Xr)||isAccountAbstractionConnector(Xr)&&isSessionKeyCompatibleWalletConnector(Xr.getEOAConnector());var _path$W,_excluded$13=["title","titleId"];function _extends$15(){return _extends$15=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$13(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgTooltip=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$13(eo,_excluded$13);return reactExports.createElement("svg",_extends$15({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$W||(_path$W=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10-5a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1Zm-1 9a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"#ABACB2"})))},_path$V,_excluded$12=["title","titleId"];function _extends$14(){return _extends$14=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$12(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgTooltipArrow=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$12(eo,_excluded$12);return reactExports.createElement("svg",_extends$14({width:8,height:4,viewBox:"0 0 8 4",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$V||(_path$V=reactExports.createElement("path",{d:"M4 3.75 7.031 0H.97L4 3.75Z",fill:"currentColor"})))};const debounce=(Xr,eo)=>{let to;const ro=()=>{Xr()};return()=>{clearTimeout(to),to=window.setTimeout(ro,eo)}},useHover=({initialValue:Xr=!1,falseOnClick:eo=!1,onHover:to,onHoverOff:ro})=>{const[no,io]=reactExports.useState(Xr);return[no,{onMouseDown:()=>io(!0),onMouseEnter:()=>{to==null||to(),io(!0)},onMouseLeave:()=>{ro==null||ro(),io(!1)},onMouseUp:()=>io(eo)}]},Tooltip=({children:Xr,content:eo,className:to,as:ro="span",copykey:no})=>{const{createRootElement:io}=useElementById(),oo=io("dynamic-tooltips"),[ao,so]=reactExports.useState([0,0]),co=reactExports.useRef(null),[lo,uo]=reactExports.useState(!1),ho=reactExports.useCallback(()=>{if(co.current){const bo=co.current.getBoundingClientRect();so([bo.left+bo.width/2,bo.top-6])}},[]),[,go]=useHover({falseOnClick:!0,initialValue:!1,onHover:()=>{ho(),uo(!0)},onHoverOff:()=>{uo(!1)}});return reactExports.useEffect(()=>{ho();const bo=debounce(()=>{ho()},3);return window.addEventListener("resize",bo),()=>{window.removeEventListener("resize",bo)}},[ho]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:tooltipZIndex,children:jsxRuntimeExports.jsxs("div",{"data-testid":"dynamicTooltip",className:classNames("dynamic-tooltip",{"dynamic-tooltip--visible":lo},to),style:{left:ao[0],top:ao[1]},copykey:no,children:[eo,jsxRuntimeExports.jsx(SvgTooltipArrow,{className:"dynamic-tooltip__arrow"})]})}),oo.current),jsxRuntimeExports.jsx(ro,Object.assign({ref:co},go,{children:Xr}))]})},TransactionCard=({transaction:Xr,currentToken:eo,currencySymbol:to,valueRounded:ro,showFiat:no,transactionValue:io,isGasSponsored:oo,gasFiatValue:ao,totalGasFiatValue:so,currency:co,total:lo,t:uo,walletKey:ho})=>{const{primaryWallet:go,projectSettings:bo,overrides:wo}=useInternalDynamicContext(),Eo=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:wo==null?void 0:wo.evmNetworks,projectSettings:bo}),{chain:$o}=useFetchChain(go==null?void 0:go.connector),Co=getNetworkInfoEntry($o,Eo);return jsxRuntimeExports.jsxs("div",{className:"transaction-card",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__header",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon__container",children:[jsxRuntimeExports.jsx("img",{src:(eo==null?void 0:eo.logoURI)||(Co==null?void 0:Co.nativeCurrency.iconUrl),alt:to,width:25,height:25}),jsxRuntimeExports.jsx("img",{className:"transaction-card__icon__container__network",src:(Co==null?void 0:Co.iconUrls[0])||($o==null?void 0:$o.icon),alt:to,width:25,height:25})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:to})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:to}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:ro||(Xr!=null&&Xr.value?Xr.format(Xr.value,{precision:6}):"")})]}),no&&io&&jsxRuntimeExports.jsxs("div",{className:"transaction-card__info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:"$"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:getDisplayFiatPrice(Number(io)||Number(ro)||0,eo)})]})]})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__arrow",children:jsxRuntimeExports.jsx("span",{children:"↓"})}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__destination",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__icon__container",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:ho,width:25,height:25})}),jsxRuntimeExports.jsx("img",{className:"transaction-card__icon__container__network",src:(Co==null?void 0:Co.iconUrls[0])||($o==null?void 0:$o.icon),alt:to,width:30,height:30})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"transaction-card__wallet-address",children:shortenWalletAddress(Xr.to,4,4)})]}),!oo&&jsxRuntimeExports.jsxs("div",{className:"transaction-card__total",children:[jsxRuntimeExports.jsxs("div",{className:"row","data-testid":"transaction-estimated-gas-fee",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"flex-row gap-native",children:[uo("dyn_send_transaction.confirmation.data.gas_estimate"),jsxRuntimeExports.jsx(Tooltip,{content:uo("dyn_send_transaction.confirmation.data.gas_tooltip"),copykey:uo("dyn_send_transaction.confirmation.data.gas_tooltip"),className:"transaction-confirmation",children:jsxRuntimeExports.jsx(Icon,{size:"small",className:"fee-tooltip",children:jsxRuntimeExports.jsx(SvgTooltip,{})})})]})}),no&&(eo!=null&&eo.price)?jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:"~ $"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",children:Number(ao)<=.01?"<0.01":ao})]}):jsxRuntimeExports.jsxs("div",{className:"flex-row gap-native",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",children:Xr.fee.gas?Xr.format(Xr.fee.gas,{precision:6}):"--"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:co})]})]}),(eo==null?void 0:eo.price)&&jsxRuntimeExports.jsxs("div",{className:"row","data-testid":"transaction-total",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:uo("dyn_send_transaction.confirmation.data.total")})}),no?jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:"~ $"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:Number(so)<=.01?"<0.01":so})]}):jsxRuntimeExports.jsxs("div",{className:"flex-row gap-native",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:lo?Xr.format(lo,{precision:6}):uo("dyn_send_transaction.confirmation.not_applied")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"primary",children:co})]})]})]})]})},TransactionConfirmationPageLayout=({onClickClose:Xr,isLoading:eo,onClickBack:to,onClickSend:ro,disableSendButton:no,displayPoweredByDynamicFooter:io=!1,alert:oo,walletConnector:ao,transaction:so,currentToken:co,children:lo,hideModal:uo,onSuccess:ho,transactionValue:go,total:bo,isGasSponsored:wo,isNativeToken:Eo,walletKey:$o})=>{var Co;const{t:Ro}=useTranslation(),{isTurnkeyWallet:Oo}=useIsTurnkeyWallet(),{setShowAuthFlow:jo,showFiat:Bo}=useInternalDynamicContext(),{setView:Mo}=useViewContext(),{userNeedsCrossDomainPasskey:Fo}=usePasskeyContext(),{initPasskeyRecoveryProcess:Wo,shouldInitRecovery:Jo}=usePasskeyRecovery(),{currency:Po}=useFetchCurrency(ao),fo=useCurrencySymbol(co,Po),{nativePrice:yo}=useSendBalanceState();useHandleRecovery(ao,usingSessionKey,ho,Jo,Wo,uo);const vo=useHandleSubmitWithChecks({isTurnkeyWallet:Oo,onClickSend:ro,userNeedsCrossDomainPasskey:Fo,usingSessionKey,walletConnector:ao},{initPasskeyRecoveryProcess:Wo,shouldInitRecovery:Jo},{setShowAuthFlow:jo,setView:Mo}),_o=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"close",disabled:eo,children:jsxRuntimeExports.jsx(SvgClose,{})}),So=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),To=getGasFiatValue(co,so,yo),Ao=getTotalFiatCost(co,so,yo,go);return uo?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:_o,leading:So,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.confirmation_tx",children:Ro("dyn_send_transaction.data.confirmation_tx")})})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__content",children:[jsxRuntimeExports.jsx(TransactionCard,{transaction:so,currentToken:co,currencySymbol:fo,valueRounded:(Co=getValueRounded(!!Eo,so))===null||Co===void 0?void 0:Co.toString(),showFiat:Bo,transactionValue:go,isGasSponsored:wo,gasFiatValue:To||"0",totalGasFiatValue:Ao||"0",currency:Po,total:bo,t:Ro,walletKey:$o}),jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__rows",children:lo})]}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:oo&&jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:oo})}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__actions",children:[(to||Xr)&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"small",onClick:to||Xr,expanded:!0,disabled:eo,copykey:"dyn_send_transaction.confirmation.cancel_button",children:Ro("dyn_send_transaction.confirmation.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",onClick:vo,expanded:!0,loading:eo,disabled:no,copykey:"dyn_send_transaction.confirmation.send",startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),dataTestId:"transaction-confirmation-send",children:Ro("dyn_send_transaction.confirmation.send")})]}),io&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-confirmation__footer"})]})]})},useTransactionTotal=({transactionValue:Xr,gasTotalPrice:eo,isGasSponsored:to=!1})=>reactExports.useMemo(()=>to?Xr!==void 0?Xr:BigInt(0):eo!==void 0&&Xr!==void 0?eo+Xr:Xr||eo,[eo,Xr,to]),useNetworkDataFromWallet=Xr=>{var eo,to;const{data:ro}=usePromise(()=>Xr==null?void 0:Xr.connector.getNetwork(),{enabled:!!Xr}),{networkConfigurations:no}=useInternalDynamicContext();if(!(!Xr||!ro))return Xr.chain==="SOL"?(eo=no==null?void 0:no.solana)===null||eo===void 0?void 0:eo[0]:(to=no==null?void 0:no[Xr.connector.connectedChain.toLowerCase()])===null||to===void 0?void 0:to.find(io=>io.chainId===ro)},FEE_REFRESH_INTERVAL=2e4,TransactionConfirmationView=({transaction:Xr,onError:eo,onSuccess:to,mutation:ro,onClickBack:no,walletConnector:io,onClickClose:oo,title:ao,displayPoweredByDynamicFooter:so=!1,copykey:co,hideModal:lo,currentToken:uo,isNativeToken:ho,transactionValue:go,isModal:bo})=>{const{appName:wo,appLogoUrl:Eo,primaryWallet:$o}=useInternalDynamicContext(),Co=getAppOrigin(),[Ro,Oo]=reactExports.useState(!1),jo=useForceUpdate(),{t:Bo}=useTranslation(),{currency:Mo}=useFetchCurrency(io),{chain:Fo}=useFetchChain(io),Wo=()=>{(Fo==null?void 0:Fo.name)==="Solana"&&Xr.fee.gas!==void 0||Xr.fetchFee().finally(jo)},{isLoading:Jo}=usePromise(()=>isAccountAbstractionConnector(io)?io.canSponsorTransactionGas(Xr):!1,{initialData:!1,onReject:logger$8.error,onResolve:Do=>{Oo(Do),!Do&&isAccountAbstractionConnector(io)&&io.disableGasSponsorshipOnce()}}),{mutate:Po,isLoading:fo,error:yo}=useMutation(ro,{onFailure:Do=>{Wo(),TransactionGasCannotBeSponsoredError.isInstance(Do)&&(logger$8.debug(Do),Oo(!1),isAccountAbstractionConnector(io)&&io.disableGasSponsorshipOnce()),logger$8.error(Do),eo==null||eo(Do)},onSuccess:Do=>to==null?void 0:to(Do)});useInterval(Wo,fo?null:FEE_REFRESH_INTERVAL),useEffectOnce(Wo);const vo=useTransactionTotal({gasTotalPrice:Xr.fee.gas,isGasSponsored:Ro,transactionValue:Xr.value}),_o=yo&&transactionErrorMessage(yo),{data:So,isLoading:To}=usePromise(()=>Xr.getBalance()),Ao=reactExports.useMemo(()=>!vo||!So?!1:So{if(!(!vo||!So))return vo-So},[vo,So]),mo=reactExports.useMemo(()=>{if(Xr.notEnoughFundsError)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",copykey:"dyn_send_transaction.warning_message.not_enough_solana",children:Bo("dyn_send_transaction.warning_message.not_enough_solana")});if(Xr.value===void 0)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.failed_simulation",children:Bo("dyn_send_transaction.warning_message.failed_simulation")});if(_o)return null;if(TransactionGasCannotBeSponsoredError.isInstance(yo))return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",copykey:"dyn_send_transaction.error_message.gas_not_sponsored",children:Bo("dyn_send_transaction.error_message.gas_not_sponsored")});if(!ho&&!Jo&&!To&&ko===void 0&&Xr.fee.gas)return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_gas_funds",children:Bo("dyn_send_transaction.warning_message.insufficient_gas_funds",{amountLeft:Xr.format(Xr.fee.gas,{precision:6}),currencySymbol:Mo})});if(!(Ao&&ko))return;const Lo=Xr.format(ko,{precision:5});return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_funds",children:Bo("dyn_send_transaction.warning_message.insufficient_funds",{amountLeft:Lo,currencySymbol:Mo})})},[Xr,_o,yo,Ao,ko,Bo,Mo,Xr.fee.gas,ho,fo]),Io=useNetworkDataFromWallet($o);return jsxRuntimeExports.jsxs(TransactionConfirmationPageLayout,{onClickBack:no,onClickClose:oo,copykey:co,title:ao,appOrigin:Co,appName:wo,appLogoUrl:Eo,hideModal:lo,isLoading:fo,onClickSend:()=>Po(),onSuccess:Do=>to==null?void 0:to(Do),displayPoweredByDynamicFooter:so,disableSendButton:To,error:_o,alert:mo,walletConnector:io,transaction:Xr,total:vo,currentToken:uo,transactionValue:go,isNativeToken:ho,isGasSponsored:Ro,isGasSponsoredLoading:Jo,walletKey:($o==null?void 0:$o.key)||"",children:[jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-wallet_used",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Bo("dyn_send_transaction.confirmation.data.wallet_used")}),jsxRuntimeExports.jsxs(Typography,{weight:"regular",color:"primary",className:"flex gap",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:$o==null?void 0:$o.key,width:20,height:20})," ",shortenWalletAddress(Xr.from,4,4)]})]}),bo&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-destination",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Bo("dyn_send_transaction.confirmation.data.destination")}),jsxRuntimeExports.jsxs(Typography,{weight:"regular",color:"primary",className:"flex gap",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:$o==null?void 0:$o.key,width:20,height:20})," ",shortenWalletAddress(Xr.to,4,4)]})]}),jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-amount",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Bo("dyn_send_transaction.confirmation.data.amount")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"primary",className:"flex gap",children:Xr.value?Xr.format(Xr.value,{precision:6}):""})]})]}),jsxRuntimeExports.jsxs("div",{className:"row flex","data-testid":"transaction-network_used",children:[jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"secondary",className:"label",children:Bo("dyn_send_transaction.confirmation.data.network_used")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",color:"primary",children:Io==null?void 0:Io.name})]})]})},getAccountTokenBalances=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,chainName:to=ChainEnum.Evm,networkId:ro,accountAddress:no,includeNative:io=!1,includePrices:oo=!1,forceRefresh:ao=!1}){return yield sdkApi$1({customHeaders:ao?{"Cache-Control":"no-cache"}:void 0}).getAccountBalances({accountAddress:no,chainName:to,environmentId:eo,includeNative:io,includePrices:oo,networkId:ro})}),useTokenBalances=({accountAddress:Xr,networkId:eo,chainName:to=ChainEnum.Evm,tokenAddresses:ro,includeFiat:no=!1,includeNativeBalance:io=!1}={})=>{const oo=useTokenBalancesState(),{tokenBalances:ao,isLoading:so,error:co}=oo,{primaryWallet:lo,environmentId:uo,network:ho,user:go}=useInternalDynamicContext(),bo=lo==null?void 0:lo.connector,wo=to??(bo==null?void 0:bo.connectedChain),Eo=Xr??(lo==null?void 0:lo.address),$o=eo??ho,Co=reactExports.useCallback((...jo)=>__awaiter$j(void 0,[...jo],void 0,function*(Bo=!1){if(!go){setTokenBalanceVariable("error",USER_NOT_LOGGED_IN);return}if(![ChainEnum.Evm,ChainEnum.Sol].includes(wo)){setTokenBalanceVariable("error",`Chain ${wo} is not supported for token balances`);return}const Fo=to===ChainEnum.Evm&&$o&&Object.values(GetAccountBalancesNetworkIdEnum).includes($o)||to===ChainEnum.Sol;if(so||!Eo||!Fo){setTokenBalanceVariable("tokenBalances",void 0);return}setTokenBalanceVariable("isLoading",!0);try{const Wo=yield getAccountTokenBalances({accountAddress:Eo,chainName:wo,environmentId:uo,forceRefresh:Bo,includeNative:io,includePrices:no,networkId:to===ChainEnum.Evm?Number($o):0});if(!Wo)return;setTokenBalanceVariable("error",void 0),setTokenBalanceVariable("tokenBalances",Wo)}catch(Wo){const Jo=(Wo==null?void 0:Wo.code)===429?"Too many requests fetching balances":Wo==null?void 0:Wo.message;setTokenBalanceVariable("error",Jo)}finally{setTokenBalanceVariable("isLoading",!1)}}),[go,wo,to,$o,so,Eo,uo,io,no]);useInternalDynamicEvents("tokenBalancesChanged",()=>Co(!0)),reactExports.useEffect(()=>{Co()},[Eo,$o]);const Ro=ro==null?void 0:ro.map(jo=>jo.toLowerCase()),Oo=Ro?ao==null?void 0:ao.filter(jo=>Ro==null?void 0:Ro.includes(jo.address.toLowerCase())):ao;return{error:co,fetchAccountBalances:Co,isError:!!co,isLoading:so,tokenBalances:Oo}},zeroAddress="0x0000000000000000000000000000000000000000",nativeSolanaAddress="11111111111111111111111111111111",usingNative=Xr=>Xr.address===zeroAddress||Xr.address===nativeSolanaAddress,getTransactionValue=(Xr,eo)=>eo?Xr.value?Xr.format(Xr.value,{precision:6}):"0":Xr.nonNativeValue&&Xr.formatNonNativeToken?Xr.formatNonNativeToken(Xr.nonNativeValue,Xr.nonNativeDecimal||18):"0",SendBalanceView=({initialRecipientAddress:Xr="",initialValue:eo,onClickBack:to,onClickClose:ro,onError:no,onSuccess:io,onDone:oo,displayPoweredByDynamicFooter:ao=!1})=>{const[so,co]=reactExports.useState("form"),{primaryWallet:lo,walletUiUtils:uo}=useInternalDynamicContext(),{t:ho}=useTranslation(),[go,bo]=reactExports.useState(!1),[wo,Eo]=reactExports.useState(void 0),[$o,Co]=reactExports.useState(void 0),{showFiat:Ro}=useInternalDynamicContext(),Oo=lo==null?void 0:lo.connector,{chain:jo}=useFetchChain(Oo),{tokenBalances:Bo,isLoading:Mo}=useTokenBalances({chainName:(Oo==null?void 0:Oo.connectedChain)==="SOL"?ChainEnum.Sol:ChainEnum.Evm,includeFiat:Ro,includeNativeBalance:!0});if(!lo)throw new DynamicError("Primary wallet is not available, send balance cannot be displayed");const Fo=ko=>{const mo=ko.filter(Do=>Do.address!==zeroAddress&&Do.address!==nativeSolanaAddress),Io=ko.find(Do=>usingNative(Do));return Io?[Io].concat(mo):mo};if(Oo&&!isSendBalanceWalletConnector(Oo))throw new DynamicError("Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector");const[Wo,Jo]=reactExports.useState(null);reactExports.useEffect(()=>{const ko=(Oo==null?void 0:Oo.connectedChain)!=="SOL"?getEvmChainName(Number(jo==null?void 0:jo.chainId)):void 0;return setSendBalanceVariable("chainName",ko||(jo==null?void 0:jo.name)||(Oo==null?void 0:Oo.connectedChain)),()=>{resetSendBalanceState()}},[jo==null?void 0:jo.name,Oo==null?void 0:Oo.connectedChain]),reactExports.useEffect(()=>{Bo&&Co(Fo(Bo))},[Bo]),reactExports.useEffect(()=>{Oo&&(wo&&bo(usingNative(wo)),Oo.createUiTransaction(lo==null?void 0:lo.address).then(ko=>{Xr&&(ko.to=Xr),eo&&(ko.value=eo),wo&&!usingNative(wo)&&(ko.nonNativeAddress=wo==null?void 0:wo.address,ko.nonNativeValue=BigInt(0),ko.nonNativeDecimal=wo==null?void 0:wo.decimals),Jo(ko)}).catch(ko=>{if(logger$8.debug("[SendBalanceView] Error creating transaction",ko),ko instanceof DynamicError&&ko.code==="0"){oo==null||oo();return}no==null||no(ko)}))},[wo]);const Po=useNetworkDataFromWallet(lo);if(!Wo||!Po)return jsxRuntimeExports.jsx("div",{className:"send-balance-widget-view__spinner","data-testid":"send-balance-spinner",children:jsxRuntimeExports.jsx(Spinner$1,{})});const fo=ko=>__awaiter$j(void 0,void 0,void 0,function*(){(Oo==null?void 0:Oo.connectedChain)==="SOL"&&setTimeout(()=>dynamicEvents.emit("tokenBalancesChanged"),5e3),Oo!=null&&Oo.confirmTransactionStatus&&(yield Oo==null?void 0:Oo.confirmTransactionStatus(ko),dynamicEvents.emit("tokenBalancesChanged"))}),yo=(wo==null?void 0:wo.symbol)||Po.nativeCurrency.symbol,vo=(jo==null?void 0:jo.name)&&jsxRuntimeExports.jsx(ChainIcon,{chain:jo,chainName:jo.name}),_o=()=>jsxRuntimeExports.jsx(SendBalancePageLayout,{transaction:Wo,onClickBack:to,networkName:Po.vanityName||Po.name,networkIcon:vo,networkCurrencyDecimals:Po.nativeCurrency.symbol==="SOL"?9:Po.nativeCurrency.decimals,walletAddress:shortenWalletAddress(wo==null?void 0:wo.address,3,3),walletKey:lo==null?void 0:lo.connector.key,onClickClose:ro,displayPoweredByDynamicFooter:ao,onSubmit:()=>co("confirmation"),tokenBalances:$o??(wo&&[wo]),currentToken:wo,setCurrentToken:Eo,isLoading:Mo,isNativeToken:go}),So=()=>jsxRuntimeExports.jsx(TransactionConfirmationView,{walletConnector:lo==null?void 0:lo.connector,transaction:Wo,mutation:()=>(uo.disabledConfirmationOnce(),Wo.submit()),copykey:"dyn_send_transaction.confirmation.title",title:ho("dyn_send_transaction.confirmation.title"),onClickBack:()=>co("form"),onError:no,displayPoweredByDynamicFooter:ao,onSuccess:ko=>__awaiter$j(void 0,void 0,void 0,function*(){ko&&(io==null||io(ko),co("success"),fo(ko))}),currentToken:wo,isNativeToken:go,transactionValue:getTransactionValue(Wo,go)}),To=()=>{var ko;return jsxRuntimeExports.jsx(TransactionStatusLayout,{transactionValue:getTransactionValue(Wo,go),destinationAddress:(ko=Wo.to)!==null&&ko!==void 0?ko:"",networkCurrency:yo,networkName:Po.name||"",NetworkIcon:vo,onClickClose:ro,onDone:()=>oo==null?void 0:oo(),displayPoweredByDynamicFooter:ao,transaction:Wo,currentToken:wo,isNativeToken:go})};return(()=>{switch(so){case"form":return _o();case"confirmation":return So();case"success":return To()}})()},SendBalanceModal=({initialRecipientAddress:Xr,initialValue:eo,onReject:to,onSuccess:ro})=>{usePreventPageScroll(!0);const[no,io]=reactExports.useState(!0),oo=reactExports.useRef(null),ao=reactExports.useRef(null),so=reactExports.useCallback(()=>{if(ao.current){ro(ao.current);return}to(oo.current||new UserRejectedTransactionError)},[to,ro]),co=()=>{io(!1)};return jsxRuntimeExports.jsx(Portal,{handleClose:co,isShown:no,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-balance",transitionEvents:{onUnmount:so},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(VerticalDrawerTransition,{isShown:!0,children:jsxRuntimeExports.jsx(PopperProvider,{children:jsxRuntimeExports.jsx(SendBalanceView,{initialRecipientAddress:Xr,initialValue:eo,onError:lo=>oo.current=lo,onClickClose:co,onDone:co,displayPoweredByDynamicFooter:!0,onSuccess:lo=>{oo.current=null,ao.current=lo}})})})})})})},noWalletError=new DynamicError("No wallet connected"),invalidWalletTypeError=new DynamicError("Primary wallet must use embedded wallet"),SendBalanceContext=reactExports.createContext(void 0),SendBalanceContextProvider=({children:Xr})=>{const{primaryWallet:eo}=useInternalDynamicContext(),{open:to,modal:ro}=useConfirmationModal({elementId:"dynamic-send-balance"}),no=reactExports.useCallback(io=>__awaiter$j(void 0,void 0,void 0,function*(){return to((oo,ao)=>{if(!eo)throw noWalletError;if(!isSendBalanceWalletConnector(eo.connector))throw invalidWalletTypeError;return jsxRuntimeExports.jsx(SendBalanceModal,{onReject:ao,onSuccess:oo,initialRecipientAddress:io==null?void 0:io.recipientAddress,initialValue:io==null?void 0:io.value})})}),[to,eo]);return jsxRuntimeExports.jsxs(SendBalanceContext.Provider,{value:{open:no},children:[ro,Xr]})},useSendBalance=()=>{const Xr=reactExports.useContext(SendBalanceContext);if(Xr===void 0)throw new Error("usage of useSendBalance not wrapped in `SendBalanceContextProvider`.");if(reactExports.useContext(PasskeyContext)===void 0)throw new Error("usage of useSendBalance not wrapped in `PasskeyContextProvider`.");return Xr};var _path$U,_excluded$11=["title","titleId"];function _extends$13(){return _extends$13=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$11(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgChevronDown=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$11(eo,_excluded$11);return reactExports.createElement("svg",_extends$13({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$U||(_path$U=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 5.529c.26-.26.682-.26.943 0L8 9.724l4.195-4.195a.667.667 0 1 1 .943.943L8.47 11.138a.667.667 0 0 1-.943 0L2.862 6.472a.667.667 0 0 1 0-.943Z",fill:"#7B7D86"})))};const replaceAll=(Xr,eo,to)=>{const ro=new RegExp(eo,"g");return Xr.replace(ro,to)},copyToClipboard=Xr=>{navigator.clipboard.writeText(Xr)},smartFloor=Xr=>Math.floor(ceil(Xr,13)),WITHOUT_DECIMAL_VALUE=1e3,MAX_BALANCE_VALUE=1e6,PRECISION_FLOOR_DIVIDER=1e4,roundBalance=(Xr,eo=4)=>{const to=parseFloat(replaceAll(Xr,'"',""));if(to>MAX_BALANCE_VALUE){const oo=Math.floor(to);return`${Math.floor(oo/MAX_BALANCE_VALUE*PRECISION_FLOOR_DIVIDER)/PRECISION_FLOOR_DIVIDER}M`}if(to>WITHOUT_DECIMAL_VALUE)return String(Math.floor(to));const ro=Math.pow(10,eo),no=1/ro;if(to0)return`< ${no}`;const io=smartFloor(to*ro)/ro;return io===0?"0.0":String(io)},getExportKeysOption=(Xr,eo)=>{var to;if(!Xr||!(eo!=null&&eo.length)||!isMagicConnector(Xr))return;const ro=(to=eo.find(no=>no.provider===ProviderEnum.MagicLink))===null||to===void 0?void 0:to.keyExportUrl;if(ro)return()=>{window.open(ro,"_blank")}};var _path$T,_excluded$10=["title","titleId"];function _extends$12(){return _extends$12=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$10(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgEmbeddedWalletIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$10(eo,_excluded$10);return reactExports.createElement("svg",_extends$12({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$T||(_path$T=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm8.334-45.333a3.333 3.333 0 0 0-3.333-3.334h-15a6.669 6.669 0 0 0-6.56 5.473 6.649 6.649 0 0 1 4.893-2.14h20ZM42 22a6.667 6.667 0 0 1 6.667 6.667V42A6.667 6.667 0 0 1 42 48.667H22A6.667 6.667 0 0 1 15.334 42V28.667A6.667 6.667 0 0 1 22 22h20Z",fill:"#4779FF","data-testid":"wallet-icon-embedded"})))},_path$S,_path2$7,_excluded$$=["title","titleId"];function _extends$11(){return _extends$11=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$$(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSmartWallet=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$$(eo,_excluded$$);return reactExports.createElement("svg",_extends$11({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$S||(_path$S=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16Zm4.667-23.467c0-1.03-.836-1.866-1.867-1.866h-8.4A3.734 3.734 0 0 0 6.727 9.73a3.723 3.723 0 0 1 2.74-1.198h11.2ZM21.6 10.4a3.733 3.733 0 0 1 3.733 3.733V21.6a3.733 3.733 0 0 1-3.733 3.733H10.4A3.733 3.733 0 0 1 6.667 21.6v-7.467A3.733 3.733 0 0 1 10.4 10.4h11.2Z",fill:"#4779FF"})),_path2$7||(_path2$7=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.455 12.667c.2 0 .38.123.452.31l.572 1.486c.145.379.191.488.254.576a.97.97 0 0 0 .228.228c.088.063.197.109.576.255l1.486.57a.485.485 0 0 1 0 .906l-1.486.571c-.379.146-.488.192-.576.255a.97.97 0 0 0-.228.228c-.063.088-.109.197-.254.576l-.572 1.485a.485.485 0 0 1-.905 0l-.571-1.485c-.146-.379-.192-.488-.254-.576a.97.97 0 0 0-.229-.229c-.088-.062-.197-.108-.576-.254l-1.485-.571a.485.485 0 0 1 0-.905l1.485-.572c.38-.145.488-.191.576-.254a.97.97 0 0 0 .229-.228c.062-.088.108-.197.254-.576l.571-1.486a.485.485 0 0 1 .453-.31ZM13.333 18c.184 0 .352.104.434.268l.38.76c.137.275.18.353.23.42.05.065.11.124.176.175.066.051.144.093.418.23l.761.38a.485.485 0 0 1 0 .867l-.76.38c-.274.138-.353.18-.42.23a.968.968 0 0 0-.175.176c-.05.066-.093.145-.23.419l-.38.76a.485.485 0 0 1-.867 0l-.38-.76c-.138-.274-.18-.353-.23-.419a.968.968 0 0 0-.176-.176c-.066-.05-.145-.092-.419-.23l-.76-.38a.485.485 0 0 1 0-.867l.76-.38c.274-.137.353-.179.419-.23a.968.968 0 0 0 .176-.176c.05-.066.092-.144.23-.418l.38-.761a.485.485 0 0 1 .433-.268Z",fill:"#4779FF"})))};const pixelToRem=Xr=>`${Xr/16}rem`,useMediaQuery=Xr=>{const eo=io=>typeof window<"u"?window.matchMedia(io).matches:!1,[to,ro]=reactExports.useState(eo(Xr)),no=()=>ro(eo(Xr));return reactExports.useEffect(()=>{const io=window.matchMedia(Xr);return no(),io.addEventListener("change",no),()=>{io.removeEventListener("change",no)}},[Xr]),to},useColorSchemePreference=()=>useMediaQuery("(prefers-color-scheme: dark)")?"dark":"light",useIconThemeVariant=()=>{const{theme:{theme:{name:Xr}}}=useThemeContext(),eo=useColorSchemePreference();return Xr==="auto"?eo:Xr},useFindSocialIcon=()=>{const Xr=useIconThemeVariant();return reactExports.useCallback(eo=>findSocialIcon(eo,Xr),[Xr])},WalletIconWithNetwork=({iconSize:Xr=24,chainName:eo,Icon:to,showNetwork:ro=!0,walletKey:no})=>{const io=eo?getChainIcon(eo):void 0;return jsxRuntimeExports.jsxs("div",{className:"wallet-icon-with-network__container",children:[to?jsxRuntimeExports.jsx(to,{style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}):jsxRuntimeExports.jsx(WalletIcon,{walletKey:no,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}),io&&ro&&jsxRuntimeExports.jsx("div",{"data-testid":"network-container",className:classNames("wallet-icon-with-network__network-container"),children:jsxRuntimeExports.jsx(io,{})})]})},getWalletIcon=({findSocialIcon:Xr,wallet:eo,user:to})=>{if(isEmailOTPWalletConnector(eo.connector))return SignInWithEmailIcon;if(isSocialWalletConnector(eo.connector)){const ro=getReferencedAccount(to,eo.id);if(!ro||!ro.oauthProvider)return SignInWithEmailIcon;const{oauthProvider:no}=ro;try{return Xr(no)}catch(io){logger$8.error(io)}}return isAccountAbstractionConnector(eo.connector)?SvgSmartWallet:isEmbeddedConnector(eo.connector)?SvgEmbeddedWalletIcon:null},AuthProviderIcon=({iconSize:Xr=64,showNetworkIcon:eo=!1,wallet:to})=>{const{primaryWallet:ro,selectedWalletConnector:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),{deniedOauthProvider:ao,deniedAddress:so}=useAccessDeniedContext(),{isLoadingEmbeddedWallet:co}=useWalletContext(),lo=useFindSocialIcon();if(ao){const go=lo(ao);return go?jsxRuntimeExports.jsx(go,{style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}}):null}if(so)return jsxRuntimeExports.jsx(WalletIcon,{walletKey:no==null?void 0:no.key,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)}});const uo=to||ro;if(!uo)return co?jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:Xr,Icon:SvgEmbeddedWalletIcon,chainName:"EVM",showNetwork:!1}):null;const ho=getWalletIcon({findSocialIcon:lo,user:io??oo,wallet:uo});return jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:Xr,Icon:ho??null,chainName:uo.chain,showNetwork:eo,walletKey:uo.key})},StatusDot=({variant:Xr,containerClassName:eo})=>jsxRuntimeExports.jsx("div",{"data-testid":"status-dot-container",className:classNames("status-dot__container",eo||""),children:jsxRuntimeExports.jsx("div",{"data-testid":"status-dot",className:classNames("status-dot",`status-dot--${Xr}`)})}),isNetworkUnsupported=(Xr,eo)=>!(eo!=null&&eo.find(to=>Xr&&to.chainId===parseChainId(Xr)));var _path$R,_excluded$_=["title","titleId"];function _extends$10(){return _extends$10=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$_(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheck=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$_(eo,_excluded$_);return reactExports.createElement("svg",_extends$10({width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$R||(_path$R=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.496 3.67a.583.583 0 0 1 0 .826l-5.834 5.833a.583.583 0 0 1-.824 0L2.504 7.996a.583.583 0 1 1 .825-.825L5.25 9.09l5.42-5.42a.583.583 0 0 1 .826 0Z",fill:"currentColor"})))};const defaultCustomColor="#4779FF",Spinner=({className:Xr="",size:eo=16,customSpinnerColor:to=""})=>{const{theme:ro}=useThemeContext(),no=to||ro.customColor||defaultCustomColor;return jsxRuntimeExports.jsxs("svg",{style:{height:pixelToRem(eo),width:pixelToRem(eo)},viewBox:"0 0 42 42",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Xr,"data-testid":"spinner",children:[jsxRuntimeExports.jsx("mask",{id:"path-1-inside-1_1433_60360",fill:"white",children:jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z"})}),jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z",stroke:"url(#paint0_linear_1433_60360)",strokeWidth:"4",mask:"url(#path-1-inside-1_1433_60360)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1433_60360",x1:"41",y1:"42",x2:"1.5",y2:"-1.82007e-07",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:no}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:no,stopOpacity:"0"})]})})]})},Network=({iconUrl:Xr,isActive:eo,networkName:to,className:ro,checkboxClassName:no="",isChanging:io,notSupported:oo=!1})=>jsxRuntimeExports.jsxs("div",{className:classNames("network",ro,{"network--not-supported":oo}),children:[jsxRuntimeExports.jsxs("div",{className:"network__container",children:[Xr?jsxRuntimeExports.jsx("img",{src:Xr,className:"network__title-icon",alt:`${to} icon`}):jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsxs("div",{className:"network__title-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",className:"network__title-copy",as:"span",weight:"medium",color:oo?"secondary":"primary",children:to}),oo&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"network__title-copy",as:"span",weight:"medium",color:oo?"secondary":"primary","data-testid":"network-not-supported",children:"Switch network in your wallet"})]})]}),jsxRuntimeExports.jsxs("div",{className:classNames("network__status-container",{"network__status-container--active":eo},no),"data-testid":"single-network-checkbox",children:[eo&&jsxRuntimeExports.jsx(SvgCheck,{className:"network__status-icon"}),io&&jsxRuntimeExports.jsx(Spinner,{className:"network__status-spinner-icon",size:12})]})]}),NetworkAction=({iconUrl:Xr,networkId:eo,network:to,onClick:ro,networkName:no,checkboxClassName:io="",newNetworkId:oo,notSupported:ao})=>jsxRuntimeExports.jsx("div",{className:classNames("network-action",{"network--not-supported":ao}),onClick:()=>{!ao&&ro(eo)},"data-testid":"network-action",children:jsxRuntimeExports.jsx(Network,{iconUrl:Xr,isActive:eo===to,networkName:no,checkboxClassName:io,isChanging:oo===eo,notSupported:ao})}),NetworkControlSkeleton=({className:Xr})=>jsxRuntimeExports.jsxs("div",{className:classNames("network-control-skeleton",Xr),"data-testid":"network-control-loading",children:[jsxRuntimeExports.jsx("div",{className:"network-control-skeleton__icon"}),jsxRuntimeExports.jsx(Skeleton,{className:"network-control-skeleton__skeleton"})]}),UnsupportedNetwork=({showMsg:Xr})=>{const{t:eo}=useTranslation();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgError,{})}),Xr&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",color:"error-1",variant:"body_small",copykey:"dyn_network_not_supported.button",children:eo("dyn_network_not_supported.button")})]})},EvmNetworkControl=({evmNetworks:Xr,className:eo="",activeClassName:to="",network:ro,walletConnector:no,isOpen:io,setIsOpen:oo,showNetworkName:ao=!1})=>{var so;const co=Xr==null?void 0:Xr.find(lo=>ro&&lo.chainId===parseChainId(ro));if(Xr&&!Xr.length)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames("evm-network-control__container evm-network-control__container--error",eo),children:jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao})});if(!ro)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames("evm-network-control__container",eo),children:jsxRuntimeExports.jsx(NetworkControlSkeleton,{})});if((Xr==null?void 0:Xr.length)===1){const lo=classNames(eo,"evm-network-control__container","evm-network-control__container--error",{[to]:io,"evm-network-control__container":!!(no!=null&&no.supportsNetworkSwitching())});return co?jsxRuntimeExports.jsxs("div",{"data-testid":"EvmNetworkControl",onClick:()=>ro&&oo(!io),className:classNames("evm-network-control__container",{[to]:io},eo),children:[co.iconUrls.length>0&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:co.iconUrls[0],alt:`${co.name} icon`})}),ao&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:co.vanityName||co.name})]}):jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:()=>oo(!io),className:lo,children:[jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":io}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})}return jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:lo=>{lo.stopPropagation(),ro&&oo(!io)},className:classNames(eo,{[to]:io,"evm-network-control__container":!!(no!=null&&no.supportsNetworkSwitching()),"evm-network-control__container--error":!(co!=null&&co.name)}),children:[co!=null&&co.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[((so=co==null?void 0:co.iconUrls)===null||so===void 0?void 0:so[0])&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:co.iconUrls[0],alt:`${co.name} icon`})}),ao&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:co.vanityName||co.name})]}):jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:ao}),Xr&&Xr.length>1&&jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":io}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})},capitalize$1=Xr=>{var eo;return((eo=Xr[0])===null||eo===void 0?void 0:eo.toUpperCase())+Xr.slice(1).toLowerCase()},NonNetworkSwitchingSupportedControl=({walletConnector:Xr,className:eo,showNetworkName:to=!1})=>{const{chain:ro,isLoading:no}=useFetchChain(Xr),io=(ro==null?void 0:ro.name)||"",oo=getChainIcon(Xr.connectedChain||"");return no?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:eo}):jsxRuntimeExports.jsxs("div",{"data-testid":"NonNetworkSwitchingSupportedControl",className:classNames("non-network-switching-supported-control",eo),children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:ro!=null&&ro.icon?jsxRuntimeExports.jsx("img",{src:ro.icon,alt:`${ro.name} icon`}):jsxRuntimeExports.jsx(oo,{})}),to&&jsxRuntimeExports.jsx(Typography,{className:classNames("non-network-switching-supported-control__network-name"),as:"span",variant:"body_small",children:capitalize$1(io)}),jsxRuntimeExports.jsx("span",{})]})},NetworkControl=({loading:Xr,walletConnector:eo,buttonClassName:to,network:ro,evmNetworks:no,activeClassName:io,isOpen:oo,setIsOpen:ao,showNetworkName:so})=>{const co=(eo==null?void 0:eo.connectedChain)===ChainEnum.Evm&&typeof ro=="string";return Xr||co?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:to}):eo!=null&&eo.connectedChain&&!eo.supportsNetworkSwitching()?jsxRuntimeExports.jsx(NonNetworkSwitchingSupportedControl,{className:to,showNetworkName:so,walletConnector:eo}):jsxRuntimeExports.jsx(EvmNetworkControl,{showNetworkName:so,evmNetworks:no,activeClassName:io,className:to,network:ro,loading:Xr,isOpen:oo,walletConnector:eo,setIsOpen:ao})},NetworkPicker=({activeClassName:Xr="",buttonClassName:eo="",checkboxClassName:to="",connector:ro,evmNetworks:no,isNetworkPickerOpen:io,listClassName:oo="",mainClassName:ao="",setIsNetworkPickerOpen:so,showNetworkName:co,customCallbackOnSuccess:lo,currentNetwork:uo,isLoading:ho=!1})=>{const go=reactExports.useRef(null),[bo,wo]=reactExports.useState(void 0),{loadingNetwork:Eo}=useInternalDynamicContext(),{data:$o}=usePromise(()=>isWalletConnectConnector(ro)?ro.getSupportedNetworks():Promise.resolve(no.map(({networkId:jo})=>`${jo}`)),{deps:[ro,no,io],initialData:void 0}),Co=isNetworkUnsupported(uo,no)||(no==null?void 0:no.length)>1,Ro=reactExports.useRef(null),Oo=jo=>__awaiter$j(void 0,void 0,void 0,function*(){wo(jo);try{yield ro==null?void 0:ro.switchNetwork({networkChainId:jo}),lo==null||lo()}catch(Bo){logger$8.debug(Bo)}finally{wo(void 0),so(!1)}});return jsxRuntimeExports.jsxs("div",{className:classNames("non-widget-network-picker",ao),ref:go,"data-testid":"network-picker",children:[jsxRuntimeExports.jsxs("div",{className:"network-picker-network-control",children:[jsxRuntimeExports.jsx(NetworkControl,{evmNetworks:no,activeClassName:Xr,network:uo,loading:Eo||ho,isOpen:io,setIsOpen:so,walletConnector:ro,showNetworkName:co,buttonClassName:eo}),jsxRuntimeExports.jsx("div",{ref:Ro,className:"network-picker-network-control__anchor"})]}),Co&&jsxRuntimeExports.jsx(MenuList,{className:oo,isOpen:io,onClickClose:()=>so(!1),popperProps:{anchorOrigin:"bottom-left",anchorRef:Ro},mobileTitle:"Select network",children:no.map(({name:jo,networkId:Bo,vanityName:Mo,iconUrls:Fo})=>jsxRuntimeExports.jsx(NetworkAction,{iconUrl:Fo==null?void 0:Fo[0],networkId:Bo,networkName:Mo||jo,network:uo,onClick:Oo,checkboxClassName:to,newNetworkId:bo,notSupported:$o&&!$o.includes(`${Bo}`)},Bo))})]})},useFetchNameService=Xr=>{const{getNameService:eo,network:to}=useInternalDynamicContext(),{data:ro}=usePromise(()=>eo(Xr),{deps:[Xr,to,eo]});return ro},useFetchBalance=({wallet:Xr,chain:eo,network:to})=>{const[ro,no]=reactExports.useState("0.0"),io=!eo||Xr.connector.supportsNetworkSwitching()&&!to,oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(io)return;const so=yield Xr.getBalance();no(so)}),{isLoading:ao}=usePromise(oo,{deps:[Xr.address,to==null?void 0:to.toString(),eo],enabled:!io});return{balance:ro,isLoading:ao}},Balance=({wallet:Xr,network:eo,className:to})=>{const{currency:ro,isLoading:no}=useFetchCurrency(Xr.connector,eo),{balance:io,isLoading:oo}=useFetchBalance({chain:ro,network:eo,wallet:Xr});return io?jsxRuntimeExports.jsxs(Typography,{className:to,variant:"body_normal",color:"primary",children:[oo?jsxRuntimeExports.jsx(Skeleton,{className:"balance-skeleton"}):roundBalance(io)," ",!no&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_normal",color:"secondary",children:ro})]}):null},MULTI_ASSET_SUPPORTED_NETWORKS=Object.values(GetAccountBalancesNetworkIdEnum),isMultiAssetSupportedNetwork=(Xr,eo)=>!!((Xr==null?void 0:Xr.connectedChain)===ChainEnum.Sol||(Xr==null?void 0:Xr.connectedChain)===ChainEnum.Evm&&typeof eo=="number"&&MULTI_ASSET_SUPPORTED_NETWORKS.includes(eo));var _path$Q,_path2$6,_excluded$Z=["title","titleId"];function _extends$$(){return _extends$$=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Z(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCopy=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Z(eo,_excluded$Z);return reactExports.createElement("svg",_extends$$({width:18,height:18,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$Q||(_path$Q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.333 1.667a2.5 2.5 0 0 0-2.5 2.5v1.666H7.5V4.167c0-.46.373-.834.833-.834h7.5c.46 0 .833.373.833.834v7.5c0 .46-.373.833-.833.833h-1.667v1.667h1.667a2.5 2.5 0 0 0 2.5-2.5v-7.5a2.5 2.5 0 0 0-2.5-2.5h-7.5Z",fill:"currentColor"})),_path2$6||(_path2$6=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.667 8.333a2.5 2.5 0 0 1 2.5-2.5h7.5a2.5 2.5 0 0 1 2.5 2.5v7.5a2.5 2.5 0 0 1-2.5 2.5h-7.5a2.5 2.5 0 0 1-2.5-2.5v-7.5Zm2.5-.833a.833.833 0 0 0-.833.833v7.5c0 .46.373.834.833.834h7.5c.46 0 .833-.373.833-.834v-7.5a.833.833 0 0 0-.833-.833h-7.5Z",fill:"currentColor"})))};const TextButton=Xr=>{var{className:eo=""}=Xr,to=__rest$7(Xr,["className"]);return jsxRuntimeExports.jsx("button",Object.assign({className:classNames("text-button",eo)},to))},CopyButton=({children:Xr,className:eo="",textToCopy:to,onClick:ro,variant:no="text",copykey:io,buttonPadding:oo="small",buttonVariant:ao="primary",buttonClassName:so="",startSlot:co,disabled:lo})=>{const[uo,ho]=reactExports.useState(!1),go=()=>{navigator.clipboard.writeText(to),ho(!0),ro==null||ro()},bo=()=>jsxRuntimeExports.jsx(Tooltip,{className:"copy-button__tooltip",content:uo?"Copied":"Copy",children:Xr});return no==="text"?jsxRuntimeExports.jsx(TextButton,{className:classNames("copy-button__container",eo),onClick:()=>go(),onMouseLeave:()=>ho(!1),copykey:io,disabled:lo,children:jsxRuntimeExports.jsx(bo,{})}):jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:oo,buttonVariant:ao,buttonClassName:so,onClick:()=>go(),copykey:io,startSlot:co,disabled:lo,children:jsxRuntimeExports.jsx(bo,{})})},ActiveBitcoinWalletAddresses=({menuOption:Xr,wallet:eo})=>{var to,ro;const{t:no}=useTranslation(),io=(to=getWalletAdditionalAddressByType(WalletAddressType.Ordinals,eo))!==null&&to!==void 0?to:eo==null?void 0:eo.address,oo=(ro=getWalletAdditionalAddressByType(WalletAddressType.Payment,eo))!==null&&ro!==void 0?ro:eo==null?void 0:eo.address;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:no("dyn_active_wallet_info.ordinals_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(io,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:Xr,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu"})]}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:no("dyn_active_wallet_info.payment_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"primary",children:shortenWalletAddress(oo,4,4)})]}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:oo??"",children:jsxRuntimeExports.jsx(Icon,{size:"xsmall",children:jsxRuntimeExports.jsx(SvgCopy,{})})})]})]})};var _path$P,_excluded$Y=["title","titleId"];function _extends$_(){return _extends$_=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Y(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgGear=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Y(eo,_excluded$Y);return reactExports.createElement("svg",_extends$_({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$P||(_path$P=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.353 4.081c.674-2.775 4.62-2.775 5.294 0a.724.724 0 0 0 1.08.448c2.44-1.486 5.23 1.305 3.744 3.744a.724.724 0 0 0 .448 1.08c2.775.674 2.775 4.62 0 5.294a.724.724 0 0 0-.448 1.08c1.486 2.44-1.305 5.23-3.744 3.744a.724.724 0 0 0-1.08.448c-.674 2.775-4.62 2.775-5.294 0a.724.724 0 0 0-1.08-.448c-2.44 1.486-5.23-1.305-3.744-3.744a.724.724 0 0 0-.448-1.08c-2.775-.674-2.775-4.62 0-5.294a.724.724 0 0 0 .448-1.08c-1.486-2.44 1.305-5.23 3.744-3.744a.724.724 0 0 0 1.08-.448Zm3.35.472c-.178-.737-1.227-.737-1.407 0a2.724 2.724 0 0 1-4.064 1.684c-.648-.395-1.39.347-.995.995.96 1.575.109 3.63-1.684 4.064-.737.18-.737 1.229 0 1.408a2.724 2.724 0 0 1 1.684 4.064c-.395.648.347 1.39.995.995a2.724 2.724 0 0 1 4.064 1.684c.18.737 1.229.737 1.408 0a2.724 2.724 0 0 1 4.064-1.684c.648.395 1.39-.347.995-.995a2.724 2.724 0 0 1 1.684-4.064c.737-.18.737-1.229 0-1.408a2.724 2.724 0 0 1-1.684-4.064c.395-.648-.347-1.39-.995-.995-1.575.96-3.63.109-4.064-1.684ZM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"#ABACB2"})))};const IconWithStatus=({Icon:Xr,InnerIcon:eo,primaryWalletKey:to,containerClassName:ro,iconSize:no=16,variant:io="green"})=>{const oo=to?jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames("inner-icon"),children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to})})})}):jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames("inner-icon",`inner-icon--${io}`),children:eo&&jsxRuntimeExports.jsx(eo,{})})});return jsxRuntimeExports.jsxs("div",{className:classNames("icon-with-status__container",ro||""),children:[typeof Xr=="string"?jsxRuntimeExports.jsx("img",{style:{height:pixelToRem(no),width:pixelToRem(no)},src:Xr,alt:"",className:"icon"}):jsxRuntimeExports.jsx(Xr,{style:{height:pixelToRem(no),width:pixelToRem(no)}}),eo||to?oo:jsxRuntimeExports.jsx(StatusDot,{variant:io,containerClassName:"icon-with-status__status-dot"})]})},ActiveWalletAddress=({address:Xr,nameServiceName:eo,menuOption:to,fullWidth:ro=!1,isLoading:no=!1})=>{const{showAlert:io}=usePasskeyContext();return jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:ro?"active-wallet-information__handle--full-width":"active-wallet-information__handle",color:"primary",variant:"body_normal",children:eo}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:eo?"regular":"medium",variant:eo?"body_small":"body_normal",color:eo?"secondary":"primary",children:no?jsxRuntimeExports.jsx(Skeleton,{className:"active-wallet-information__address-skeleton"}):shortenWalletAddress(Xr,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:to,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu",iconOverride:io()?jsxRuntimeExports.jsx(IconWithStatus,{Icon:()=>jsxRuntimeExports.jsx(SvgGear,{width:16,height:16}),variant:"yellow"}):jsxRuntimeExports.jsx(SvgGear,{width:16,height:16})})]})},currencyFormatter=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),TokenBalanceItem=({tokenBalance:Xr})=>{const{showFiat:eo}=useInternalDynamicContext(),to=no=>{const io=Math.round(no*1e6)/1e6;return io===0?"<0.000001":io},ro=()=>{var no;return Xr.marketValue!==0&&!Xr.marketValue?"$-":Xr.marketValue>=.01?currencyFormatter.format(parseFloat((no=Xr.marketValue)===null||no===void 0?void 0:no.toFixed(2))):"<$0.01"};return jsxRuntimeExports.jsxs("div",{className:"token-balance-item",children:[jsxRuntimeExports.jsxs("div",{className:"token-balance-item__name",children:[Xr.logoURI?jsxRuntimeExports.jsx(Image$1,{src:Xr.logoURI,alt:Xr.symbol,className:"token-balance-item__icon",dataTestId:"token-balance-item-icon"}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"token-balance-item__title",color:"primary",children:Xr.name})})]}),jsxRuntimeExports.jsxs("div",{className:"flex",children:[eo?jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",style:{textAlign:"right"},children:ro()}):null,jsxRuntimeExports.jsx("div",{className:"token-balance-item__value",children:jsxRuntimeExports.jsxs("div",{className:"token-balance-item__value__balance","data-testid":"token-balance-item-balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",style:{marginRight:"2px"},children:to(Xr.balance)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Xr.symbol})]})})]})]},Xr.address)},Divider=({text:Xr,className:eo,style:to,fullWidth:ro=!1,children:no})=>jsxRuntimeExports.jsxs("div",{className:classNames("divider",eo,{"divider__full-width":ro}),style:to,children:[jsxRuntimeExports.jsx("div",{className:"divider__dash"}),!!Xr&&jsxRuntimeExports.jsx(Typography,{className:"divider__text",variant:"body_small",color:"secondary",children:Xr}),no&&jsxRuntimeExports.jsx("div",{children:no}),jsxRuntimeExports.jsx("div",{className:"divider__dash"})]}),TokenBalanceList=({tokenBalances:Xr})=>{const{t:eo}=useTranslation();return jsxRuntimeExports.jsx("ul",{className:"token-balance-list",children:(Xr==null?void 0:Xr.length)===0?jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:eo("dyn_wallet_information.multi_asset.empty_state")})}):Xr==null?void 0:Xr.map((to,ro)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsx(TokenBalanceItem,{tokenBalance:to}),Xr.length!==ro+1?jsxRuntimeExports.jsx(Divider,{className:"token-balance-list__divider"}):null]},ro))})},ICON_SIZE=28,ActiveWalletInformation=({isLoading:Xr=!1})=>{var eo,to,ro,no,io;const{t:oo}=useTranslation(),[ao,so]=reactExports.useState(!1),[co,lo]=reactExports.useState(!1),[uo,ho]=reactExports.useState(!1),go=reactExports.useRef(null),{primaryWallet:bo,network:wo,projectSettings:Eo,user:$o,authMode:Co,showFiat:Ro,multiAsset:Oo}=useInternalDynamicContext(),{setDynamicWidgetView:jo}=useWidgetContext(),{isTurnkeyWalletWithoutAuthenticator:Bo}=useIsTurnkeyWallet(),{isLoading:Mo,tokenBalances:Fo,error:Wo}=useTokenBalances({chainName:bo==null?void 0:bo.connector.connectedChain,includeFiat:Ro,includeNativeBalance:!0}),Jo=bo==null?void 0:bo.connector,Po=(Fo==null?void 0:Fo.filter(Tl=>Tl.name))||[],fo=bo==null?void 0:bo.address,yo=useFetchNameService(fo),{getEOAWallet:vo}=useSmartWallets(),{data:_o}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return!!(yield bo==null?void 0:bo.connector.isTestnet())}),{deps:[wo],initialData:!1}),So=getExportKeysOption(bo==null?void 0:bo.connector,Eo==null?void 0:Eo.providers),{showAlert:To}=usePasskeyContext(),Ao=(eo=bo&&vo(bo))!==null&&eo!==void 0?eo:bo,ko=bo&&isBitcoinConnector(bo==null?void 0:bo.connector),mo=!!(Ao&&(!((ro=(to=Ao==null?void 0:Ao.connector)===null||to===void 0?void 0:to.key)===null||ro===void 0)&&ro.startsWith("turnkey")||!((io=(no=Ao==null?void 0:Ao.connector)===null||no===void 0?void 0:no.key)===null||io===void 0)&&io.startsWith("coinbasempc"))),Io=[{Icon:null,callback:()=>(yo==null?void 0:yo.name)&&navigator.clipboard.writeText(yo==null?void 0:yo.name),hide:!(yo!=null&&yo.name),text:"Copy ENS"},{Icon:null,callback:()=>fo&&navigator.clipboard.writeText(fo),hide:!fo,text:"Copy wallet address"},{Icon:null,callback:()=>jo("settings"),endSlot:To()?jsxRuntimeExports.jsx(StatusDot,{variant:"yellow"}):void 0,hide:!mo,text:"Wallet settings"},{Icon:null,callback:So||(()=>logger$8.info("No option to export private keys")),hide:!So,text:"Export private keys"}],Do=(bo==null?void 0:bo.connector)&&(bo==null?void 0:bo.connector).evmNetworks||[],Lo=_o&&!Bo,Ho=Eo==null?void 0:Eo.sdk.hideNetworkInDynamicWidget,Yo=()=>ko?jsxRuntimeExports.jsx(ActiveBitcoinWalletAddresses,{wallet:bo,menuOption:Io}):jsxRuntimeExports.jsx(ActiveWalletAddress,{address:fo,nameServiceName:(yo==null?void 0:yo.name)||($o==null?void 0:$o.email),menuOption:Io,isLoading:Xr,fullWidth:Ho}),Xo=Co==="connect-and-sign"&&Oo,qo=isMultiAssetSupportedNetwork(Jo,wo),Qo=!(Wo==="Too many requests fetching balances")&&qo&&Xo;Po.sort((Tl,Il)=>((Il==null?void 0:Il.marketValue)||0)-((Tl==null?void 0:Tl.marketValue)||0));const zo=Po.reduce((Tl,Il)=>Tl+((Il==null?void 0:Il.marketValue)||0),0),ga=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),$a=()=>bo?jsxRuntimeExports.jsx(Balance,{className:"balance-header__balance",wallet:bo,network:wo}):jsxRuntimeExports.jsx(Skeleton,{className:"balance-header__skeleton"}),Sl=()=>{go.current&&ho(go.current.scrollTop>0)},El=()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`${uo?"shadow":""}`,children:jsxRuntimeExports.jsxs("button",{onClick:()=>{Mo||lo(!co)},className:"balance-header",children:[jsxRuntimeExports.jsxs("div",{className:"balance-header__title",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",style:{marginRight:"8px"},children:"Balance:"}),Ro?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:zo===0||zo>=.01?ga.format(parseFloat(zo.toFixed(2))):"<$0.01"}):$a()]}),jsxRuntimeExports.jsx("div",{className:co?"balance-header__chevron":"",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]})}),jsxRuntimeExports.jsx(AccordionItem,{isOpen:co,className:`multi-asset-balance-container__accordion ${"multi-asset-balance-container__accordion"+(co?"--expanded":"--collapsed")}`,handleScroll:Sl,ref:go,children:jsxRuntimeExports.jsx(TokenBalanceList,{tokenBalances:Po})})]});return Xr?jsxRuntimeExports.jsx(Skeleton,{}):jsxRuntimeExports.jsxs("div",{className:"active-wallet-information-container","data-testid":"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__header",children:[jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar",children:yo!=null&&yo.avatar?jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar__name-service",children:jsxRuntimeExports.jsx("img",{src:yo==null?void 0:yo.avatar,alt:""})}):jsxRuntimeExports.jsx("div",{className:"active-wallet-information__wallet-img",children:jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:ICON_SIZE})})}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__details",children:[jsxRuntimeExports.jsx("div",{className:classNames("active-wallet-information__addresses-container",{"active-wallet-information__addresses-container--centered":!(yo!=null&&yo.name)}),children:Yo()}),!Ho&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:wo,connector:bo==null?void 0:bo.connector,isNetworkPickerOpen:ao,setIsNetworkPickerOpen:so,mainClassName:"active-wallet-information__network-picker",buttonClassName:"active-wallet-information__network-picker-button",evmNetworks:Do,showNetworkName:!0,isLoading:Xr})]})]}),Lo&&jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_active_wallet_info.testnet_warning",children:oo("dyn_active_wallet_info.testnet_warning")})]}),Qo?jsxRuntimeExports.jsx("div",{className:"multi-asset-balance-container",children:El()}):jsxRuntimeExports.jsxs("div",{className:"balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",children:"Balance"}),$a()]})]})},UnknownWalletInformation=({address:Xr})=>{const{handleLogOut:eo}=useInternalDynamicContext(),to=[{Icon:null,callback:()=>Xr&&navigator.clipboard.writeText(Xr),hide:!Xr,text:"Copy wallet address"},{Icon:null,callback:eo,text:"Disconnect"}];return jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information-container",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__header",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__details",children:jsxRuntimeExports.jsxs("div",{className:"unknown-wallet-information__actions-container",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{className:"unknown-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(Xr,4,4)})}),jsxRuntimeExports.jsx(DotsMenu,{options:to,buttonClassName:"unknown-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"unknown-wallet-information__dots-menu"})]})})})})})},LinkButton=React.memo(({connector:Xr})=>{const{setDynamicWidgetView:eo}=useWidgetContext(),to=()=>{eo("global-wallet")};return Xr.globalWallet?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"link-button",buttonPadding:"small",buttonVariant:"primary",onClick:to,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:"Connect"}):null});LinkButton.displayName="LinkButton";const DynamicWidgetWalletHeader=({variant:Xr})=>{const{primaryWallet:eo,user:to}=useInternalDynamicContext(),{open:ro}=useSendBalance(),{supportsFunding:no,setShowFunding:io,fundingEnabled:oo}=useFundingContext(),{setDynamicWidgetView:ao,setIsOpen:so}=useWidgetContext(),{isLoadingEmbeddedWallet:co}=useWalletContext(),{t:lo}=useTranslation(),uo=reactExports.useMemo(()=>{const wo=eo==null?void 0:eo.connector;return wo?isSendBalanceWalletConnector(wo):!1},[eo]),ho=()=>{Xr==="dropdown"?(so(!1),ro().catch(wo=>logger$8.error(wo))):ao("send-balance")},go=()=>{const wo=to==null?void 0:to.verifiedCredentials.find(Eo=>Eo.walletName==="unknown");return eo||co?jsxRuntimeExports.jsx(ActiveWalletInformation,{isLoading:co}):wo?jsxRuntimeExports.jsx(UnknownWalletInformation,{address:wo.address}):jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:to})})},bo=uo||oo;return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header","data-testid":"dynamic-widget-wallet-header",children:[go(),co&&jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-info",children:jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-loading",children:jsxRuntimeExports.jsx(Alert,{variant:"info",icon:jsxRuntimeExports.jsx(Spinner$1,{className:"button__spinner"}),children:lo("dyn_creating_wallet.loading_message")})})}),eo?jsxRuntimeExports.jsxs("div",{"data-testid":"primaryWalletStatus",className:"dynamic-widget-wallet-header__wallet-info",children:[jsxRuntimeExports.jsx(SecureEmbeddedWalletCard,{className:"dynamic-widget-wallet-header__wallet-info__secure-wallet"}),bo&&jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header__wallet-actions",children:[oo&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"buy-crypto-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>io(!0),disabled:!no,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgAdd,{})}),children:"Buy"}),uo&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"send-balance-button",buttonPadding:"small",buttonVariant:"primary",onClick:ho,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),children:"Send"}),jsxRuntimeExports.jsx(LinkButton,{connector:eo.connector})]})]}):jsxRuntimeExports.jsx(Typography,{className:"dynamic-widget-wallet-header__email",variant:"body_normal",weight:"regular",children:!co&&getUserIdentifier(to)})]})};React.memo(DynamicWidgetWalletHeader);const DynamicWidgetHeader=({variant:Xr})=>{const{overridenWidgetView:eo}=useWidgetContext(),{multiWallet:to}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-header",children:[jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{className:"dynamic-widget-header__passkey-success"}),(eo==="wallets"||eo==="profile"&&!to)&&jsxRuntimeExports.jsx(DynamicWidgetWalletHeader,{variant:Xr})]})};React.memo(DynamicWidgetHeader);const DynamicBridgeWalletCard=({className:Xr,networkIcon:eo,networkName:to,children:ro})=>{const{t:no}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:classNames("dynamic-bridge-wallet-card",Xr),children:[jsxRuntimeExports.jsxs("div",{className:"dynamic-bridge-wallet-card__network",children:[eo&&React.cloneElement(eo,{className:"dynamic-bridge-wallet-card__network-icon"}),to&&jsxRuntimeExports.jsx(Typography,{className:"dynamic-bridge-wallet-card__network-name",variant:"body_small",color:"primary",weight:"medium",as:"span",copykey:"dyn_bridge.widget.wallet_network",children:no("dyn_bridge.widget.wallet_network",{networkName:to})})]}),ro]})},WalletInformationCard=({address:Xr,ens:eo,balance:to,icon:ro,network:no,menu:io})=>{const{t:oo}=useTranslation(),ao=reactExports.useMemo(()=>{const so=shortenWalletAddress(Xr);return eo?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",truncate:!0,children:eo}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",children:so})]}):jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",children:so})},[eo,Xr]);return jsxRuntimeExports.jsxs("div",{className:"wallet-information-card",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__header",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__details-container",children:[ro&&jsxRuntimeExports.jsx(Icon,{className:"wallet-information-card__icon",children:ro}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__details",children:ao}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__menu",children:io})]}),no]}),jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_wallet_information.balance",children:oo("dyn_wallet_information.balance")}),to]})]})},DynamicBridgeWalletCardBody=({walletAddress:Xr,walletBalance:eo,walletKey:to,onDisconnectClick:ro})=>{const{t:no}=useTranslation(),io=useFetchNameService(Xr),oo=[{Icon:null,callback:()=>(io==null?void 0:io.name)&&navigator.clipboard.writeText(io==null?void 0:io.name),hide:!(io!=null&&io.name),text:no("dyn_bridge.widget.copy.ens")},{Icon:null,callback:()=>Xr&&navigator.clipboard.writeText(Xr),hide:!Xr,text:no("dyn_bridge.widget.copy.address")},{Icon:null,callback:()=>ro==null?void 0:ro(),hide:!ro,text:no("dyn_bridge.widget.disconnect")}];return jsxRuntimeExports.jsx(WalletInformationCard,{ens:io==null?void 0:io.name,address:Xr,icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to}),balance:eo,menu:jsxRuntimeExports.jsx(DotsMenu,{options:oo}),copykey:"dyn_bridge.widget"})},DynamicBridgeWidgetEmptyCard=({chain:Xr})=>{const{t:eo}=useTranslation(),{bridgeChainsToConnect:to,setShowAuthFlow:ro,setShowBridgeWidget:no}=useInternalDynamicContext();if(!(to!=null&&to.length)||!Xr)return null;const io=getChainInfoWithOverrides(Xr),oo=getChainIcon(Xr);return jsxRuntimeExports.jsxs("div",{role:"button",className:"dynamic-bridge-widget-empty-card",onClick:()=>{no(!1),ro(!0)},children:[jsxRuntimeExports.jsx(oo,{className:"dynamic-bridge-widget-empty-card__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",as:"span",color:"primary",className:"dynamic-bridge-widget-empty-card__text",copykey:"dyn_bridge.widget.connect_with_network",children:eo("dyn_bridge.widget.connect_with_network",{blockchainName:io==null?void 0:io.blockchainName})})]})},SecondaryWallets=({hideUnlinkAction:Xr=!1})=>{const{disconnectWallet:eo,getConnectedWalletById:to,bridgeChains:ro}=useInternalDynamicContext(),no=to("connect-wallet-1"),io=no&&getChainIcon(no==null?void 0:no.chain),oo=no&&getChainInfoWithOverrides(no==null?void 0:no.chain);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!no&&jsxRuntimeExports.jsx(DynamicBridgeWidgetEmptyCard,{chain:ro==null?void 0:ro[1].chain}),no&&io&&jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(io,{}),networkName:oo==null?void 0:oo.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:no.connector.key,walletAddress:no.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:no,network:no.chain}),onDisconnectClick:Xr?void 0:()=>eo(no.id)},no.id)})]})},MemoSecondaryWallets=React.memo(SecondaryWallets),useSmartWallets=()=>{const{user:Xr,walletConnectorOptions:eo}=useInternalDynamicContext(),to=reactExports.useCallback(io=>{const{verifiedCredentials:oo}=Xr??{};if(!oo)return;const ao=oo.find(so=>so.id===io.id);return(ao==null?void 0:ao.walletProvider)===WalletProviderEnum.SmartContractWallet?ao:void 0},[Xr]),ro=reactExports.useCallback(io=>{var oo,ao,so;const co=Xr==null?void 0:Xr.verifiedCredentials;if(!co)return;const lo=to(io),uo=co.find(wo=>wo.id===(lo==null?void 0:lo.signerRefId));if(!(uo!=null&&uo.address)||!(uo!=null&&uo.chain))return;const{walletConnector:ho}=(oo=findWalletOptionFor(uo,eo))!==null&&oo!==void 0?oo:{},bo=!((ao=uo.walletName)===null||ao===void 0?void 0:ao.startsWith("turnkey"))||!!(!((so=uo.walletProperties)===null||so===void 0)&&so.isAuthenticatorAttached);return ho==null?void 0:ho.createWallet({address:uo.address,chain:ho.connectedChain,connector:ho,id:uo.id,isAuthenticated:bo,key:ho.key})},[to,Xr==null?void 0:Xr.verifiedCredentials,eo]),no=reactExports.useCallback(io=>{var oo;const ao=Xr==null?void 0:Xr.verifiedCredentials;if(!ao)return;const so=ao.find(uo=>uo.id===io.id),co=ao.find(uo=>uo.signerRefId===(so==null?void 0:so.id));if(!(co!=null&&co.address)||!(co!=null&&co.chain))return;const{walletConnector:lo}=(oo=findWalletOptionFor(co,eo))!==null&&oo!==void 0?oo:{};return lo==null?void 0:lo.createWallet({address:co.address,chain:lo.connectedChain,connector:lo,id:co.id,isAuthenticated:!0,key:lo.key})},[Xr==null?void 0:Xr.verifiedCredentials,eo]);return reactExports.useMemo(()=>({getEOAWallet:ro,getSmartWallet:no,isSmartWallet:io=>to(io)!==void 0}),[ro,to,no])},useIsTurnkeyWallet=()=>{var Xr,eo,to;const{primaryWallet:ro,user:no}=useInternalDynamicContext(),{getEOAWallet:io}=useSmartWallets(),oo=(Xr=ro&&io(ro))!==null&&Xr!==void 0?Xr:ro,ao=()=>{if(!oo||!no||!oo.connector.key.startsWith("turnkey"))return;const Eo=oo.id,$o=no.verifiedCredentials.find(Co=>Co.id===Eo);if($o)return $o},so=()=>{if(!oo||!no)return!1;const Eo=no.verifiedCredentials.find(Co=>{var Ro,Oo;return((Ro=Co.walletName)===null||Ro===void 0?void 0:Ro.startsWith("turnkey"))&&((Oo=Co.walletProperties)===null||Oo===void 0?void 0:Oo.isAuthenticatorAttached)===!1});return no.verifiedCredentials.find(Co=>Eo&&Co.signerRefId===Eo.id)},co=ao(),lo=!!so(),uo=!!(co||lo),ho=!!(!((eo=co==null?void 0:co.walletProperties)===null||eo===void 0)&&eo.isAuthenticatorAttached),go=uo&&!ho||lo,bo=uo&&!!getUserVerifiedCredentialType(no,JwtVerifiedCredentialFormatEnum.Email),wo=uo&&!!(!((to=co==null?void 0:co.walletProperties)===null||to===void 0)&&to.isSessionKeyCompatible);return{hasRecoveryEmail:bo,hasTurnkeyVerifiedCredentialAuthenticator:ho,isSessionKeyCompatible:wo,isTurnkeyWallet:uo,isTurnkeyWalletWithoutAuthenticator:go,turnkeyVerifiedCredential:co}},findTurnkeyWalletByChain=(Xr,eo)=>{const to=eo?VerifiedCredentialNameToChainEnum[eo]:void 0;return Xr==null?void 0:Xr.find(({key:ro,walletConnector:no})=>ro.startsWith("turnkey")&&(no==null?void 0:no.connectedChain)===to)},findTurnkeyWalletByPrimaryChain=(Xr,eo,to)=>{var ro;const no=((ro=eo==null?void 0:eo.find(ao=>ao.primary))===null||ro===void 0?void 0:ro.name)||ChainEnum.Evm,io=findTurnkeyWalletByChain(Xr,ChainEnumToVerifiedCredentialName[no]),oo=to==null?void 0:to.find(({walletName:ao,chain:so})=>(ao==null?void 0:ao.startsWith("turnkey"))&&so===ChainEnumToVerifiedCredentialName[no]);if(io)return Object.assign(Object.assign({},oo),io)},getUserWalletsFromVerifiedCredentials=Xr=>{var eo;return(eo=Xr.verifiedCredentials)===null||eo===void 0?void 0:eo.filter(({walletProvider:to})=>to)},addPasskeyIdentifierToWalletConnector=(Xr,eo)=>{var to;const ro=(eo==null?void 0:eo.phoneNumber)||((to=eo==null?void 0:eo.verifiedCredentials.find(no=>no.oauthDisplayName))===null||to===void 0?void 0:to.oauthDisplayName)||"";Xr.setPasskeyIdentifier(ro)},getEmbeddedWalletAuthHandler=Xr=>{if(!Xr||!("getAuthenticatorHandler"in Xr))throw new DynamicError("Invalid connector type");return Xr.getAuthenticatorHandler()},initExport=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({iframeContainer:eo,iframeElementId:to,wallet:ro}){var no;if(!(ro!=null&&ro.connector)||!(ro!=null&&ro.id)||!isPasskeyWalletConnector(ro==null?void 0:ro.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings",INVALID_WALLET_DATA);const io=(no=ro.connector)===null||no===void 0?void 0:no.getExportHandler();if(!(yield io.initExport(eo,to)))throw new DynamicError("Something went wrong",ERROR_PROCESSING_REVEAL_REQUEST);return io}),handleExportInitCheck=({user:Xr,wallet:eo})=>{var to,ro;if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(eo!=null&&eo.connector)||!(eo!=null&&eo.id)||!isPasskeyWalletConnector(eo==null?void 0:eo.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const no=eo.connector;no.setEmail(Xr.email);const io=(ro=(to=Xr.verifiedCredentials)===null||to===void 0?void 0:to.find(({walletName:co})=>co==null?void 0:co.startsWith("turnkey")))===null||ro===void 0?void 0:ro.walletProperties,oo=io==null?void 0:io.turnkeyHDWalletId,ao=io==null?void 0:io.turnkeyPrivateKeyId,so=io==null?void 0:io.turnkeySubOrganizationId;if(!so||oo===void 0&&ao===void 0)throw new DynamicError("Invalid token!");return{connector:no,organizationId:so,privateKeyId:ao,turnkeyHDWalletId:oo}},extractExportBundle=({address:Xr,privateKeyId:eo,activity:to})=>{var ro,no,io;const oo=Xr?(ro=to.result)===null||ro===void 0?void 0:ro.exportWalletAccountResult:(no=to.result)===null||no===void 0?void 0:no.exportWalletResult,ao=eo?(io=to.result)===null||io===void 0?void 0:io.exportPrivateKeyResult:oo;return ao==null?void 0:ao.exportBundle},exportCredential=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,wallet:to,environmentId:ro,address:no}){const{connector:io,turnkeyHDWalletId:oo,privateKeyId:ao,organizationId:so}=handleExportInitCheck({user:eo,wallet:to}),co=io.getExportHandler();if(!co.publicKey)throw new DynamicError("Must initialize export first",ERROR_PROCESSING_REVEAL_REQUEST);let uo;oo?uo=yield co.exportWallet({address:no,organizationId:so,walletId:oo}):ao&&(uo=yield co.exportPrivateKey({organizationId:so,privateKeyId:ao}));const ho=uo.id,go=uo.status;let bo;if(go==="ACTIVITY_STATUS_COMPLETED")bo=extractExportBundle({activity:uo,address:no,privateKeyId:ao});else{const wo=yield exportEmbeddedWallet({activityId:ho,environmentId:ro,walletId:(to==null?void 0:to.id)||""});bo=wo==null?void 0:wo.exportBundle}if(!bo)throw new DynamicError("Invalid export response",ERROR_PROCESSING_REVEAL_REQUEST);return no||ao?co.verifyExportPrivateKey({chain:to==null?void 0:to.chain,exportBundle:bo,organizationId:so}):co.verifyExportWallet({exportBundle:bo,organizationId:so})}),cleanupExport=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({wallet:eo}){var to;const ro=eo==null?void 0:eo.connector;(to=ro==null?void 0:ro.getExportHandler())===null||to===void 0||to.clear()}),validateTurnkeyProviderEnabled=Xr=>{const eo=isTurnkeyEnabled(Xr);if(!eo)throw new DynamicError("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED);return eo},createEmbeddedWalletRequest=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({user:eo,walletConnector:to,environmentId:ro,chains:no,webAuthnAttestation:io,withAuthenticator:oo}){if(!to)throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!eo)throw new DynamicError("User is not defined");to.setEmail(eo.email);let ao;if(oo||io!==void 0){eo.email||addPasskeyIdentifierToWalletConnector(to,eo);const{attestation:uo,challenge:ho,displayName:go}=io||(yield to.getWebAuthnAttestation());ao={attestation:uo,challenge:ho,passkeyAlias:go}}const so=yield createTurnkeyEmbeddedWallet(Object.assign({chains:no,environmentId:ro},ao));if(!so)throw new DynamicError("Failed to create embedded wallet");const co=to.connectedChain,lo=findEmbeddedWalletFromVerifiedCredentials(so,[co]);if(!lo)throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return to.setVerifiedCredentials(so.verifiedCredentials),{embeddedWalletVerifiedCredential:lo,updatedUser:so,walletConnector:to}}),findPasskeyEmailWalletConnector=(Xr,eo)=>Xr.map(({walletConnector:ro})=>ro).find(ro=>isPasskeyWalletConnector(ro)&&isEmailWalletConnector(ro)&&ro.connectedChain===eo),findOwner=(Xr,eo)=>eo.find(to=>to.id===Xr.signerRefId),findSmartWallet=(Xr,eo)=>eo.find(to=>to.signerRefId===Xr.id),isOwnerOfASmartWallet=(Xr,eo)=>!!findSmartWallet(Xr,eo),initializeSmartWallet=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({account:eo,verifiedCredentials:to,walletConnectorOptions:ro,primaryWalletId:no}){var io,oo;const ao=findOwner(eo,to);if(!ao)throw new Error("could not find associated eoa account for smart wallet");const so=findWalletOptionFor(ao,ro);if(!so)throw new Error("could not find owner wallet from wallet options");if(so&&isTurnkeyWalletConnector(so.walletConnector)){const ho=(oo=(io=so.walletConnector)===null||io===void 0?void 0:io.verifiedCredentials)===null||oo===void 0?void 0:oo.reduce((go,bo)=>bo.smartWalletRefAddress&&eo.address&&eo.chain&&isSameAddress$1(bo.smartWalletRefAddress,eo.address,VerifiedCredentialNameToChainEnum[eo.chain])?[bo,...go]:[...go,bo],[]);ho&&so.walletConnector.setVerifiedCredentials(ho)}const co=findWalletOptionFor(eo,ro);if(!co)throw new Error("could not find smart wallet from wallet options");const lo=co.walletConnector;if(!isAccountAbstractionConnector(lo))throw new Error("could not initialize smart wallet");if(!ao.address||!eo.address)throw new Error("could not find owner or smart wallet address");const uo=no===ao.id||no===eo.id;yield lo.registerEoa({eoaAddress:ao.address,eoaConnector:so.walletConnector,shouldSetEoaConnector:uo,smartWalletAddress:eo.address})}),useCreateDynamicEmbeddedWalletMutation=()=>{var Xr,eo;const{setPrimaryWalletId:to,user:ro,setShowAuthFlow:no,projectSettings:io}=useInternalDynamicContext(),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(),lo=((eo=(Xr=io==null?void 0:io.sdk)===null||Xr===void 0?void 0:Xr.embeddedWallets)===null||eo===void 0?void 0:eo.chainConfigurations)||[],uo=findPrimaryEmbeddedChain(io),ho=lo.filter(bo=>bo.enabled).map(bo=>bo.name==="SOL"?EmbeddedWalletChainEnum.Sol:EmbeddedWalletChainEnum.Evm);return{createDynamicEmbeddedWalletMutation:reactExports.useCallback(bo=>__awaiter$j(void 0,[bo],void 0,function*({environmentId:wo,walletConnectorOptions:Eo,withAuthenticator:$o,options:Co,chains:Ro}){var Oo,jo;if(ao(!0),!ro)throw new DynamicError(USER_NOT_LOGGED_IN);try{const{embeddedWalletVerifiedCredential:Bo,updatedUser:Mo,walletConnector:Fo}=yield createEmbeddedWalletRequest({chains:Ro??ho,environmentId:wo,user:ro,walletConnector:findPasskeyEmailWalletConnector(Eo,uo),webAuthnAttestation:Co==null?void 0:Co.webAuthnAttestation,withAuthenticator:$o}),Wo=(Oo=Mo.verifiedCredentials)===null||Oo===void 0?void 0:Oo.find(({walletName:yo})=>yo==null?void 0:yo.startsWith("turnkey")),Jo=!!(!((jo=Wo==null?void 0:Wo.walletProperties)===null||jo===void 0)&&jo.isAuthenticatorAttached),Po=Fo.createWallet({address:(yield Fo.getAddress())||"",chain:Fo.connectedChain,connector:Fo,id:Bo.id,isAuthenticated:Jo,key:Bo.walletName||Fo.key}),fo=findSmartWallet(Bo,Mo.verifiedCredentials);fo?(yield initializeSmartWallet({account:fo,primaryWalletId:fo.id,verifiedCredentials:Mo.verifiedCredentials,walletConnectorOptions:Eo}),to(fo.id)):to(Bo.id),dynamicEvents.emit("embeddedWalletCreated",Po,Wo,Mo),no(!1,{performMultiWalletChecks:!1})}catch(Bo){logger$8.error("Failed to create embedded wallet",Bo),co(Bo),dynamicEvents.emit("embeddedWalletFailed",Bo)}finally{ao(!1)}}),[ho,uo,to,no,ro]),error:so,isLoading:oo}},useTurnkey=()=>{const{projectSettings:Xr,setPrimaryWalletId:eo,walletConnectorOptions:to,setShowAuthFlow:ro,environmentId:no,user:io,primaryWallet:oo}=useInternalDynamicContext(),{setView:ao}=useViewContext(),{createDynamicEmbeddedWalletMutation:so}=useCreateDynamicEmbeddedWalletMutation(),{getEOAWallet:co}=useSmartWallets(),lo=reactExports.useCallback((bo,wo)=>__awaiter$j(void 0,void 0,void 0,function*(){return new Promise((Eo,$o)=>{dynamicEvents.once("embeddedWalletCreated",Co=>{Eo(Co)}),dynamicEvents.once("embeddedWalletFailed",Co=>$o(Co)),so({chains:bo,environmentId:no,options:wo,walletConnectorOptions:to,withAuthenticator:!1}).then(()=>{ro(!1,{performMultiWalletChecks:!1})}).catch(Co=>{$o(Co)})})}),[so,no,to,ro]),uo=reactExports.useCallback(bo=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),ao("passkey-intro",{chains:bo}),new Promise((wo,Eo)=>{dynamicEvents.once("embeddedWalletCreated",$o=>wo($o)),dynamicEvents.once("embeddedWalletFailed",$o=>{if($o instanceof DOMException&&$o.name==="NotAllowedError"){logger$8.error("User cancelled the passkey creation.",$o);return}Eo($o)})})}),[ro,ao]),ho=reactExports.useCallback(bo=>__awaiter$j(void 0,void 0,void 0,function*(){var wo,Eo;const{chain:$o}=bo,Co=findTurnkeyWalletByChain(to,$o);let Ro=null;if(io){(wo=Co==null?void 0:Co.walletConnector)===null||wo===void 0||wo.setVerifiedCredentials(io.verifiedCredentials);const Mo=findSmartWallet(bo,io.verifiedCredentials);Mo?(yield initializeSmartWallet({account:Mo,primaryWalletId:Mo.id,verifiedCredentials:io.verifiedCredentials,walletConnectorOptions:to}),Ro=Mo.id):Ro=bo.id}Ro&&eo(Ro);const Oo=!!(!((Eo=bo.walletProperties)===null||Eo===void 0)&&Eo.isAuthenticatorAttached);if(!(Co!=null&&Co.walletConnector))throw new Error("Could not find the embedded wallet connector");const jo=Co.walletConnector,Bo=jo.createWallet({address:(yield jo.getAddress())||"",chain:jo.connectedChain,connector:jo,id:bo.id,isAuthenticated:Oo,key:bo.walletName||jo.key||""});return Promise.resolve(Bo)}),[eo,to,io]);return{createTurnkeyWallet:reactExports.useCallback((bo,wo)=>__awaiter$j(void 0,void 0,void 0,function*(){var Eo,$o,Co,Ro,Oo,jo;if(!io)throw new Error(USER_NOT_LOGGED_IN);const Bo=((Eo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||Eo===void 0?void 0:Eo.automaticEmbeddedWalletCreation)===!1,Mo=(($o=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||$o===void 0?void 0:$o.defaultWalletVersion)===EmbeddedWalletVersionEnum.V2,Fo=findPrimaryEmbeddedChain(Xr),Wo=findEmbeddedWalletFromVerifiedCredentials(io,bo??[Fo]),Jo=getUserWalletsFromVerifiedCredentials(io);if(!(Jo!=null&&Jo.length)||!Wo&&Bo){const Po=getUserVerifiedCredentialType(io,JwtVerifiedCredentialFormatEnum.Email);return!(!((Co=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||Co===void 0)&&Co.forceAuthenticatorAtSignup)&&Po||wo!=null&&wo.webAuthnAttestation||Mo?lo(bo,wo):uo(bo)}else if(Wo&&io.newUser&&(!((Ro=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||Ro===void 0)&&Ro.automaticEmbeddedWalletCreation)){const Po=findPasskeyEmailWalletConnector(to,Fo);if(!Po)throw new Error("Could not find the embedded wallet connector");const fo=Po.createWallet({address:(yield Po.getAddress())||"",chain:Po.connectedChain,connector:Po,id:Wo.id,isAuthenticated:!!(!((Oo=Wo==null?void 0:Wo.walletProperties)===null||Oo===void 0)&&Oo.isAuthenticatorAttached),key:(jo=Wo.walletName)!==null&&jo!==void 0?jo:Po.key});eo(Wo.id),dynamicEvents.emit("embeddedWalletCreated",fo,Wo,io)}if(ro(!1,{performMultiWalletChecks:!1}),!Wo)throw new Error("Primary wallet is not an embedded wallet");return ho(Wo)}),[io,Xr,oo,co,ro,ho,lo,uo,to,eo])}},isConnectorSessionKeyActive=Xr=>{var eo;return!Xr||!isSessionKeyCompatibleWalletConnector(Xr)?!1:!!(!((eo=Xr.sessionKeys)===null||eo===void 0)&&eo.publicKey)},useSecureEnclaveEmbeddedWallet=()=>{var Xr,eo,to,ro;const{projectSettings:no,primaryWallet:io,user:oo,environmentId:ao,walletConnectorOptions:so}=useInternalDynamicContext(),{createTurnkeyWallet:co}=useTurnkey(),{hasRecoveryEmail:lo}=useIsTurnkeyWallet(),{createRootElement:uo}=useElementById(),{isLoadingEmbeddedWallet:ho,setIsLoadingEmbeddedWallet:go}=useWalletContext(),{getEOAWallet:bo}=useSmartWallets(),wo=(Xr=io&&bo(io))!==null&&Xr!==void 0?Xr:io,Eo=reactExports.useCallback(()=>hasEmbeddedWallet(oo,"turnkey"),[oo]),$o=reactExports.useCallback(()=>isSessionKeyCompatibleWalletConnector(wo==null?void 0:wo.connector)?EmbeddedWalletVersion.V2:EmbeddedWalletVersion.V1,[wo==null?void 0:wo.connector]),{shouldInitRecovery:Co,initPasskeyRecoveryProcess:Ro}=usePasskeyRecovery(),Oo=reactExports.useCallback((_o,So)=>__awaiter$j(void 0,void 0,void 0,function*(){var To;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const Ao=getUserWalletsFromVerifiedCredentials(oo),ko=findPrimaryEmbeddedChain(no),mo=findEmbeddedWalletFromVerifiedCredentials(oo,_o??[ko]),Io=((To=no==null?void 0:no.sdk.embeddedWallets)===null||To===void 0?void 0:To.automaticEmbeddedWalletCreation)===!1;if(Ao!=null&&Ao.length&&!mo&&!Io)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");return validateTurnkeyProviderEnabled(no),go(!1),co(_o,So)}),[co,no,go,oo]),jo=reactExports.useCallback(_o=>__awaiter$j(void 0,[_o],void 0,function*({chain:So}){var To,Ao,ko;if(!oo)throw new Error(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(no);const mo=findPrimaryEmbeddedChain(no),Io=findEmbeddedWalletFromVerifiedCredentials(oo,[mo]);if(!((To=Io==null?void 0:Io.walletProperties)===null||To===void 0?void 0:To.turnkeyHDWalletId))throw new DynamicError("No HD wallet was found for this user to derive a wallet account. Use createEmbeddedWallet first","NoHdWalletFound");const Lo=yield getCreateEmbeddedWalletAccountRequest({chain:So,environmentId:ao});isSessionKeyCompatibleWalletConnector(wo==null?void 0:wo.connector)?yield(Ao=wo==null?void 0:wo.connector)===null||Ao===void 0?void 0:Ao.createOrRestoreSession({ignoreRestore:!0}):(yield Co())&&(yield Ro("email"));const Ho=yield(ko=wo==null?void 0:wo.connector)===null||ko===void 0?void 0:ko.stampCreateWalletAccountRequest({request:Lo});return yield createEmbeddedWalletAccount({createEmbeddedWalletAccountRequest:Ho,environmentId:ao}),refreshUserJwt({environmentId:ao})}),[ao,wo==null?void 0:wo.connector,Ro,no,Co,oo]),Bo=reactExports.useCallback(_o=>__awaiter$j(void 0,void 0,void 0,function*(){var So,To,Ao,ko,mo,Io;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const Do=io==null?void 0:io.connector;if(Do&&isSessionKeyCompatibleWalletConnector(Do))return Do.createOrRestoreSession();const Lo=wo==null?void 0:wo.connector;if(Lo&&isSessionKeyCompatibleWalletConnector(Lo))return Lo.createOrRestoreSession();const Ho=getEmbeddedWalletAuthHandler(wo==null?void 0:wo.connector);if(Ho.isSessionActive())return ACTIVE_SESSION;const Yo=uo(iframeContainerId$2);if(canRestoreEmbeddedWalletSession((So=no==null?void 0:no.sdk.embeddedWallets)===null||So===void 0?void 0:So.sessionKeyDuration))try{if(yield restoreEmbeddedWalletSession({iframeContainer:Yo.current,iframeElementId:iframeElementId$2,sessionExpiration:getEmbeddedWalletSessionExpiration((Ao=(To=no==null?void 0:no.sdk)===null||To===void 0?void 0:To.embeddedWallets)===null||Ao===void 0?void 0:Ao.sessionKeyDuration),user:oo,wallet:io}))return SESSION_RESTORED}catch(Ko){logger$8.error("Failed to restore embedded wallet",Ko)}if(!(_o!=null&&_o.oneTimeCode))throw new DynamicError("One-time code is required to create a session.",INVALID_REQUEST$1);if(!Eo()||!lo)throw new DynamicError("User does not have a secure enclave wallet or a verified email",INVALID_WALLET_DATA);const Xo=(Io=(mo=(ko=oo==null?void 0:oo.verifiedCredentials)===null||ko===void 0?void 0:ko.find(({walletName:Ko})=>Ko==null?void 0:Ko.startsWith("turnkey")))===null||mo===void 0?void 0:mo.walletProperties)===null||Io===void 0?void 0:Io.turnkeySubOrganizationId;yield Ho.verifyRecoveryCode(_o.oneTimeCode,Xo);const qo={createdAt:new Date().getTime(),emailCode:_o.oneTimeCode,userId:Ho.recoveryUserId};return StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,qo),SESSION_CREATED}),[uo,oo,lo,io,(to=(eo=no==null?void 0:no.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration,Eo,wo==null?void 0:wo.connector]),Mo=reactExports.useCallback(_o=>__awaiter$j(void 0,void 0,void 0,function*(){var So,To;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(no);const Ao=findTurnkeyWalletByPrimaryChain(so,(So=no==null?void 0:no.sdk.embeddedWallets)===null||So===void 0?void 0:So.chainConfigurations,oo.verifiedCredentials);if(!(Ao!=null&&Ao.walletConnector))throw new DynamicError("Wallet connector not found",INVALID_WALLET_DATA);const ko=Ao.walletConnector;ko.setEmail(oo==null?void 0:oo.email),oo&&!(oo!=null&&oo.email)&&addPasskeyIdentifierToWalletConnector(ko,oo);const mo=getUserVerifiedCredentialType(oo,JwtVerifiedCredentialFormatEnum.Email);if(!("id"in Ao)||!mo)return ko.getWebAuthnAttestation();const Io=(To=Ao==null?void 0:Ao.walletProperties)===null||To===void 0?void 0:To.turnkeySubOrganizationId;if(!Io)throw new DynamicError("No sub organization id found for the wallet",INVALID_WALLET_DATA);const Do=getEmbeddedWalletAuthHandler(ko);yield Bo(_o);const{attestation:Lo,challenge:Ho,displayName:Yo}=yield ko.getWebAuthnAttestation();if(yield Do.addPasskeyAuthenticator({attestation:Lo,challenge:Ho,turnkeySubOrganizationId:Io}),!(yield completePasskeyRecovery$1({attestation:Lo,challenge:Ho,environmentId:ao,walletId:Ao==null?void 0:Ao.id})))throw new DynamicError("Error completing passkey recovery");return{attestation:Lo,challenge:Ho,displayName:Yo}}),[Bo,ao,no,oo,so]),Fo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);return(yield getUserPasskeys({environmentId:ao})).passkeys}),[oo,ao]),Wo=reactExports.useMemo(()=>{var _o;const So=wo==null?void 0:wo.connector;return!So||!("getAuthenticatorHandler"in So)?!1:(_o=getEmbeddedWalletAuthHandler(So))===null||_o===void 0?void 0:_o.isSessionActive()},[wo==null?void 0:wo.connector]),Jo=reactExports.useMemo(()=>isConnectorSessionKeyActive(wo==null?void 0:wo.connector),[wo==null?void 0:wo.connector]),Po=reactExports.useMemo(()=>isConnectorSessionKeyActive(io==null?void 0:io.connector),[io==null?void 0:io.connector]),fo=Wo||Po||Jo,yo=reactExports.useCallback(_o=>__awaiter$j(void 0,[_o],void 0,function*({type:So,htmlContainerId:To}){var Ao,ko,mo,Io,Do,Lo;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);yield cleanupExport({wallet:wo});const Ho=findTurnkeyWalletByPrimaryChain(so,(Ao=no==null?void 0:no.sdk.embeddedWallets)===null||Ao===void 0?void 0:Ao.chainConfigurations,oo==null?void 0:oo.verifiedCredentials),Yo=(ko=Ho==null?void 0:Ho.walletProperties)===null||ko===void 0?void 0:ko.turnkeyHDWalletId;So==="recoveryPhrase"&&!Yo&&(So="privateKey");const Xo=uo(revealIframeElementId,To||revealIframeContainerId);Xo.current.style.display="none",isSessionKeyCompatibleWalletConnector(wo==null?void 0:wo.connector)&&(yield(mo=wo==null?void 0:wo.connector)===null||mo===void 0?void 0:mo.createOrRestoreSession()),yield initExport({iframeContainer:Xo.current,iframeElementId:revealIframeElementId,wallet:wo});try{yield exportCredential({address:So==="privateKey"?wo==null?void 0:wo.address:void 0,environmentId:ao,user:oo,wallet:wo})}catch{isSessionKeyCompatibleWalletConnector(wo==null?void 0:wo.connector)&&(!((Io=wo==null?void 0:wo.connector)===null||Io===void 0)&&Io.removeSessionKeys)&&(yield(Do=wo==null?void 0:wo.connector)===null||Do===void 0?void 0:Do.removeSessionKeys(),yield(Lo=wo==null?void 0:wo.connector)===null||Lo===void 0?void 0:Lo.createOrRestoreSession({ignoreRestore:!0})),yield exportCredential({address:So==="privateKey"?wo==null?void 0:wo.address:void 0,environmentId:ao,user:oo,wallet:wo})}return Xo.current.style.display="block",!0}),[uo,ao,wo,(ro=no==null?void 0:no.sdk.embeddedWallets)===null||ro===void 0?void 0:ro.chainConfigurations,oo,so]),vo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){var _o,So;if(!oo)throw new DynamicError(USER_NOT_LOGGED_IN);const To=findTurnkeyWalletByPrimaryChain(so,(_o=no==null?void 0:no.sdk.embeddedWallets)===null||_o===void 0?void 0:_o.chainConfigurations,oo.verifiedCredentials);if(!To||!("id"in To))throw new DynamicError("User does not have a valid secure enclave wallet",INVALID_WALLET_DATA);const Ao=getEmbeddedWalletAuthHandler(To==null?void 0:To.walletConnector),ko=To.id;if(Ao.isSessionActive())throw new DynamicError("Session is active. No need to create a new one",ACTIVE_SESSION);const Io=uo(iframeContainerId$2),Do=yield Ao.initRecovery("email",Io.current,iframeElementId$2,getEmbeddedWalletSessionExpiration((So=no==null?void 0:no.sdk.embeddedWallets)===null||So===void 0?void 0:So.sessionKeyDuration));if(!Do)throw new DynamicError(ERROR_SENDING_CODE);const Lo=yield initEmbeddedWalletSession$1({authenticatorType:"email",environmentId:ao,publicKey:Do,walletId:ko});return Ao.recoveryUserId=Lo.turnkeyUserId,CODE_SENT}),[uo,oo,ao,no,so]);return reactExports.useMemo(()=>({createEmbeddedWallet:Oo,createEmbeddedWalletAccount:jo,createOrRestoreSession:Bo,createPasskey:Mo,getPasskeys:Fo,getWalletVersion:$o,isLoadingEmbeddedWallet:ho,isSessionActive:fo,revealEmbeddedWalletKey:yo,sendOneTimeCode:vo,userHasEmbeddedWallet:Eo}),[Oo,jo,Bo,Mo,Fo,$o,ho,fo,yo,vo,Eo])},findCoinbaseMPCWallet=Xr=>Xr==null?void 0:Xr.find(({key:eo})=>eo==="coinbasempc"),requiresPasswordForEmbeddedWallet=Xr=>{var eo,to;const ro=(to=(eo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||eo===void 0?void 0:eo.supportedSecurityMethods)===null||to===void 0?void 0:to.password;return ro?ro.isEnabled&&ro.isDefault:!1},requiresPasswordForEmbeddedWalletOnSignup=Xr=>{const eo=Xr==null?void 0:Xr.sdk.embeddedWallets;return eo?requiresPasswordForEmbeddedWallet(Xr)&&!!eo.forceAuthenticatorAtSignup:!1},validateMPCProviderEnabled=Xr=>{if(!Xr)throw new Error("Project settings are missing");if(!isCoinbaseWaasEnabled(Xr))throw new Error("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.")},useEmbeddedWalletPassword=()=>{const{primaryWallet:Xr,setShowAuthFlow:eo,environmentId:to}=useInternalDynamicContext(),{setView:ro}=useViewContext(),no=reactExports.useCallback((oo,ao)=>__awaiter$j(void 0,void 0,void 0,function*(){return eo(!0,{ignoreIfIsEmbeddedWidget:!1}),oo?ro("wallet-claim-intro"):ro("create-password-view",{isSignUp:ao,notCalledFromWalletUtils:!0}),new Promise((so,co)=>{dynamicEvents.once("embeddedWalletCreatePasswordCompleted",lo=>so(lo)),dynamicEvents.once("embeddedWalletCreatePasswordFailed",lo=>co(lo))})}),[eo,ro]);return{claimWallet:reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!Xr)throw new Error("No primary wallet");if("code"in(yield claimEmbeddedWallet({environmentId:to,walletId:Xr.id}))){logger$8.error("Error updating jwt after claiming wallet");return}}catch(oo){throw logger$8.error("Error claiming wallet",oo),new Error("Error claiming wallet")}}),[to,Xr]),createPassword:no}},generateRandomPassword=(Xr=20)=>{const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";let to="";for(let ro=0;ro({fetchAuthToken:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getWalletAuthToken({environmentId:Xr,type:EmbeddedWalletAuthType.Mpc}))||""}),fetchBackupCode:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletBackup({environmentId:Xr}))||""}),fetchPasscode:()=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletPasscode({environmentId:Xr}))||""})}),DYNAMIC_PASSWORD_LENGTH=20,useCoinbaseMPC=()=>{const{user:Xr,setPrimaryWalletId:eo,walletConnectorOptions:to,environmentId:ro,consumeNonce:no,displaySiweStatement:io,appName:oo,siweStatement:ao,handleLogOut:so,setShowAuthFlow:co}=useInternalDynamicContext(),{setError:lo}=useErrorContext(),uo=reactExports.useCallback((wo,Eo,$o)=>__awaiter$j(void 0,void 0,void 0,function*(){var Co;return Eo.setVerifiedCredentials(wo.verifiedCredentials),eo($o.id),Eo.createWallet({address:(yield Eo==null?void 0:Eo.getAddress())||"",chain:Eo.connectedChain,connector:Eo,id:$o.id,isAuthenticated:!0,key:(Co=$o.walletName)!==null&&Co!==void 0?Co:Eo.key})}),[eo]),ho=reactExports.useCallback(wo=>__awaiter$j(void 0,[wo],void 0,function*({connector:Eo,backupCode:$o,password:Co,source:Ro}){const Oo=no();if(Oo===void 0)throw new DynamicError("Missing nonce");const jo=yield Eo.getAddress();if(!jo)throw new DynamicError("Missing address");const Bo=yield getVerifyArgs({displaySiweStatement:io,environmentId:ro,nonce:Oo,publicWalletAddress:jo,siweStatement:getSiweStatement({appName:oo,siweStatement:ao}),walletConnector:Eo,walletProvider:"embeddedWallet"}),Mo=Ro===PasswordSourceTypeEnum.Dynamic?{password:Co,passwordSource:Ro}:{},Fo=yield linkWallet(ro,Object.assign(Object.assign(Object.assign({},Mo),Bo),{backup:$o}));if(!Fo)throw new DynamicError("Unable to link wallet");const Wo=createUserProfileFromSdkUser(Fo.user),Jo=Wo.verifiedCredentials.find(Po=>Po.id===Wo.lastVerifiedCredentialId&&Po.format==="blockchain");if(!Jo)throw new DynamicError("No primary wallet found");return eo(Jo.id),Eo.setVerifiedCredentials(Wo.verifiedCredentials),{newSelectedCredentialWallet:Jo,updatedUser:Wo}}),[oo,no,io,ro,eo,ao]),go=reactExports.useCallback((wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){var $o;const Co=Eo||generateRandomPassword(DYNAMIC_PASSWORD_LENGTH),Ro=Eo?PasswordSourceTypeEnum.User:PasswordSourceTypeEnum.Dynamic;try{const Oo=yield wo.generateWallet(Ro,Co),{updatedUser:jo,newSelectedCredentialWallet:Bo}=yield ho({backupCode:Oo,connector:wo,password:Co,source:Ro}),Mo=wo.createWallet({address:(yield wo==null?void 0:wo.getAddress())||"",chain:wo==null?void 0:wo.connectedChain,connector:wo,id:Bo.id,isAuthenticated:!0,key:($o=Bo.walletName)!==null&&$o!==void 0?$o:wo.key});return dynamicEvents.emit("embeddedWalletCreated",Mo,Bo,jo),Mo}catch(Oo){logger$8.error(Oo),Oo instanceof DynamicError&&Oo.code==="create_embedded_wallet_error"&&(yield so(),lo(Oo.message))}}),[ho,so,lo]);return{createCoinbaseMPCWallet:reactExports.useCallback((...wo)=>__awaiter$j(void 0,[...wo],void 0,function*(Eo=[EmbeddedWalletChainEnum.Evm],$o){var Co;if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);const Ro=(Co=findCoinbaseMPCWallet(to))===null||Co===void 0?void 0:Co.walletConnector;if(!Ro||!isCoinbaseMpcWalletConnector(Ro)){const Bo=new DynamicError("CoinbaseWaaSWalletConnectors not found");throw logger$8.error("Failed to create embedded wallet",Bo),dynamicEvents.emit("embeddedWalletFailed",Bo),lo(Bo.message),Bo}co(!1);const{fetchAuthToken:Oo}=getCoinbaseMPCConnectorFetchers({environmentId:ro});Oo&&Ro.setAuthTokenFetcher(Oo);const jo=findEmbeddedWalletFromVerifiedCredentials(Xr,Eo);return jo?uo(Xr,Ro,jo):go(Ro,$o)}),[Xr,to,co,ro,go,lo,uo])}},useMPCEmbeddedWallet=()=>{const{projectSettings:Xr,walletConnectorOptions:eo,user:to}=useInternalDynamicContext(),{createPassword:ro}=useEmbeddedWalletPassword(),{createCoinbaseMPCWallet:no}=useCoinbaseMPC(),{isLoadingEmbeddedWallet:io,setIsLoadingEmbeddedWallet:oo}=useWalletContext(),ao=()=>hasEmbeddedWallet(to,"coinbase"),so=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(go)}),[ro]),co=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){var bo,wo,Eo;if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);const $o=getUserWalletsFromVerifiedCredentials(to),Co=findEmbeddedWalletFromVerifiedCredentials(to,go),Ro=((bo=Xr==null?void 0:Xr.sdk.embeddedWallets)===null||bo===void 0?void 0:bo.automaticEmbeddedWalletCreation)===!1;if($o!=null&&$o.length&&!Co&&!Ro)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");validateMPCProviderEnabled(Xr);const Oo=(wo=findCoinbaseMPCWallet(eo))===null||wo===void 0?void 0:wo.walletConnector;if(!isCoinbaseMpcWalletConnector(Oo))throw new Error("Coinbase MPC wallet connector not found");Oo.setRequiredPassword((Eo=requiresPasswordForEmbeddedWallet(Xr))!==null&&Eo!==void 0?Eo:!1)}),[to,Xr,eo]),lo=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){try{return yield co(go),!0}catch{return!1}}),[co]),uo=reactExports.useCallback(go=>__awaiter$j(void 0,void 0,void 0,function*(){if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);yield co(go),oo(!0);let bo;!findEmbeddedWalletFromVerifiedCredentials(to,go)&&requiresPasswordForEmbeddedWalletOnSignup(Xr)&&(bo=yield ro(!1,!0));const Eo=yield no(go,bo);return oo(!1),Eo}),[to,no,ro,co,Xr,oo]);return{canCreateMPCWallet:lo,createEmbeddedWallet:uo,createPassword:so,isLoadingEmbeddedWallet:io,revealEmbeddedWalletKey:()=>__awaiter$j(void 0,void 0,void 0,function*(){throw new DynamicError("Coinbase MPC wallet does not support headless reveal yet")}),userHasEmbeddedWallet:ao}},useEmbeddedWallet=()=>{const{user:Xr,projectSettings:eo,setPrimaryWalletId:to}=useInternalDynamicContext(),{isTurnkeyWallet:ro}=useIsTurnkeyWallet(),{createEmbeddedWallet:no,canCreateMPCWallet:io,createPassword:oo,revealEmbeddedWalletKey:ao}=useMPCEmbeddedWallet(),{createEmbeddedWallet:so,createEmbeddedWalletAccount:co,createOrRestoreSession:lo,createPasskey:uo,revealEmbeddedWalletKey:ho,getPasskeys:go,isSessionActive:bo,sendOneTimeCode:wo,getWalletVersion:Eo}=useSecureEnclaveEmbeddedWallet(),{isLoadingEmbeddedWallet:$o}=useWalletContext(),Co=reactExports.useCallback(()=>hasEmbeddedWallet(Xr),[Xr]),Ro=reactExports.useCallback(()=>{if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!Co())throw new DynamicError("Embedded wallet not found");if(ro)return Eo()},[Eo,ro,Xr,Co]),Oo=reactExports.useCallback((Mo,Fo)=>__awaiter$j(void 0,void 0,void 0,function*(){return(yield io(Mo))?yield no(Mo):yield so(Mo,Fo)}),[io,no,so]),jo=Mo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!Co())throw new DynamicError("Embedded wallet not found");return ro?ho(Mo):ao()}),Bo=reactExports.useCallback(Mo=>{var Fo,Wo,Jo,Po,fo;const yo=isTurnkeyEnabled(eo)||isCoinbaseWaasEnabled(eo),vo=StorageService.getItem(PRIMARY_WALLET_ID);if(!yo||vo)return!1;if(Mo){const _o=findPrimaryEmbeddedChain(eo),So=(Fo=findEmbeddedWalletFromVerifiedCredentials(Mo,[_o]))===null||Fo===void 0?void 0:Fo.id,To=(Jo=(Wo=Mo.verifiedCredentials)===null||Wo===void 0?void 0:Wo.find(ko=>ko.walletProvider===WalletProviderEnum.SmartContractWallet))===null||Jo===void 0?void 0:Jo.id,Ao=To||So;if(Ao)return to(Ao),!1}return!(!isCoinbaseWaasEnabled(eo)&&isTurnkeyEnabled(eo)&&!(!((fo=(Po=eo==null?void 0:eo.sdk)===null||Po===void 0?void 0:Po.embeddedWallets)===null||fo===void 0)&&fo.automaticEmbeddedWalletCreation))},[eo,to]);return{createEmbeddedWallet:Oo,createEmbeddedWalletAccount:co,createOrRestoreSession:lo,createPasskey:uo,createPassword:oo,getPasskeys:go,getWalletVersion:Ro,isLoadingEmbeddedWallet:$o,isSessionActive:bo,revealWalletKey:jo,sendOneTimeCode:wo,shouldAutoCreateEmbeddedWallet:Bo,userHasEmbeddedWallet:Co}},useHandleAuthenticatedUser=()=>{const{handlers:Xr}=useInternalDynamicContext(),{handleAuthenticatedUser:eo}=Xr??{},to=reactExports.useRef(eo);return to.current=eo,reactExports.useCallback(ro=>__awaiter$j(void 0,void 0,void 0,function*(){to.current&&(yield runSafe(()=>{var no;return(no=to.current)===null||no===void 0?void 0:no.call(to,{user:ro})}))}),[])},sleepToShowSuccessMessage=()=>sleep$1(1500),useUserAuth=({authMethod:Xr})=>{const{handleLogOut:eo,setShowAuthFlow:to,setCallback:ro,setMultiWalletWidgetState:no,walletConnectorOptions:io}=useInternalDynamicContext(),{setDeniedOauthUsername:oo,setDeniedOauthProvider:ao}=useAccessDeniedContext(),{view:so,setView:co,goToInitialView:lo}=useViewContext(),{setLoading:uo}=useLoadingContext(),{setErrorMessage:ho,setError:go}=useErrorContext(),{setExistentAccountData:bo}=useAccountExistsContext(),wo=useHandleAuthenticatedUser(),{shouldAutoCreateEmbeddedWallet:Eo}=useEmbeddedWallet(),$o=Mo=>Mo.user,Co=Mo=>__awaiter$j(void 0,[Mo],void 0,function*({isSignIn:Fo=!0,verifyFunction:Wo,onVerifySuccess:Jo,onSettled:Po,onError:fo,showSuccessMessage:yo=!1,skipDefaultErrorHandling:vo=!1}){var _o;logger$8.debug("initAuth",{authMethod:Xr,isSignIn:Fo});try{const So=yield Wo();if(!So)throw yield Bo(),new DynamicError("No user returned from verify function");let To;if($o(So)?To=storeAuthTokenAndUser(So):To=So,Jo==null||Jo(To),io.forEach(ko=>{ko.walletConnector.setVerifiedCredentials(To.verifiedCredentials)}),hasPendingMfaAction(To)||Fo&&(!((_o=To.missingFields)===null||_o===void 0)&&_o.length))return;no("idle"),yield wo(To);const Ao=Eo(To);yo&&(yield sleepToShowSuccessMessage()),Fo&&ro("authSuccess"),Ao||to(!1),Po==null||Po()}catch(So){if(logger$8.debug(So),vo){fo==null||fo(So);return}Ro(So,{onError:fo})}finally{uo(!1),Po==null||Po()}}),Ro=(Mo,{options:Fo={},onError:Wo})=>{var Jo;if(Mo instanceof MfaInvalidOtpError||Mo instanceof MfaRateLimitedError||Mo instanceof EmailAlreadyExistsError||Mo instanceof CustomFieldNotUniqueError||Mo instanceof UsernameAlreadyExistsError||Mo instanceof TooManyEmailVerificationsError||Mo instanceof InvalidPhoneNumberError)throw Mo;if(Mo instanceof NoAccessError){ao(Mo==null?void 0:Mo.socialProvider),oo((Jo=Mo==null?void 0:Mo.socialUsername)!==null&&Jo!==void 0?Jo:""),co("no-access");return}if(Mo instanceof AccountExistsError){bo(Mo.errorPayload),co("account-exists");return}if(Mo instanceof SandboxMaximumThresholdReachedError){co("sandbox-maximum-threshold-reached");return}if(Mo instanceof UserHasAccountWithEmailError){co("merge-user-accounts-with-same-email",{returnToView:"isEmailRecoveryFlow"in Fo&&Fo.isEmailRecoveryFlow?"passkey-recovery-add-email":void 0});return}if(Wo){Wo==null||Wo(Mo);return}Mo.code?ho(Mo.code):go(Mo.message)},Oo=Mo=>__awaiter$j(void 0,[Mo],void 0,function*({missingFields:Fo,isEmailVerificationRequired:Wo,isSmsVerificationRequired:Jo}){if(Wo&&Fo.find(Po=>Po.name==="email")){co("verify-email");return}if(Jo&&Fo.find(Po=>Po.name==="phoneNumber")){co("verify-sms");return}co(so.type)}),jo=Mo=>__awaiter$j(void 0,[Mo],void 0,function*({completeSignInFlow:Fo,updateJwtFunction:Wo,onValidUpdatedJwt:Jo,options:Po={}}){logger$8.debug("completeAuth",{authMethod:Xr});try{const{updateUserProfileResponse:fo,isSmsVerificationRequired:yo,isEmailVerificationRequired:vo,missingFields:_o}=yield Wo();Jo==null||Jo();const So=storeAuthTokenAndUser({expiresAt:fo.expiresAt,jwt:fo.jwt,minifiedJwt:fo.minifiedJwt,user:fo.user});if(_o.length>0){yield Oo({isEmailVerificationRequired:vo,isSmsVerificationRequired:yo,missingFields:_o});return}if(yield wo(So),ro("authSuccess"),Fo&&(yield Fo(fo)))return;!Eo()&&So.mfaBackupCodeAcknowledgement!==MfaBackupCodeAcknowledgement.Pending&&to(!1)}catch(fo){logger$8.debug(fo),Ro(fo,{options:Po})}finally{uo(!1)}}),Bo=()=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("cancelAuth",{authMethod:Xr}),yield eo(),lo()});return{cancelAuth:Bo,completeAuth:jo,handleAuthError:Ro,initAuth:Co}},SECURE_ENCLAVE_WALLET_SESSION_KEYS="dynamic_secure_enclave_session_keys",SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS={priority:["secureStorage","localStorage"]},buf2hex$1=Xr=>[...new Uint8Array(Xr)].map(eo=>eo.toString(16).padStart(2,"0")).join(""),base64urlDecode=Xr=>(Xr=(Xr==null?void 0:Xr.replace(/-/g,"+").replace(/_/g,"/"))||"",Uint8Array.from(atob(Xr),eo=>eo.charCodeAt(0))),compressRawPublicKey=Xr=>{const eo=new Uint8Array(Xr),to=eo.byteLength,ro=eo.slice(0,1+to>>>1);return ro[0]=2|eo[to-1]&1,ro.buffer},p256Keygen=()=>__awaiter$j(void 0,void 0,void 0,function*(){const Xr=yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),eo=yield crypto.subtle.exportKey("raw",Xr.publicKey),to=yield crypto.subtle.exportKey("jwk",Xr.privateKey),ro=compressRawPublicKey(eo),no=base64urlDecode(to.d);return{private:buf2hex$1(no),public:buf2hex$1(ro),public_uncompressed:buf2hex$1(eo)}}),useEmbeddedWalletSessionKeys=Xr=>{const eo=(...io)=>__awaiter$j(void 0,[...io],void 0,function*({ignoreRestore:oo=!1}={}){const ao=StorageService.getItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);if(ao&&!oo)return JSON.parse(Buffer$3.from(ao,"base64").toString());const{publicKey:so,privateKey:co}=yield to();return yield registerSessionKey({environmentId:Xr,publicKey:so}),{privateKey:co,publicKey:so}}),to=()=>__awaiter$j(void 0,void 0,void 0,function*(){const{private:io,public:oo}=yield p256Keygen(),so=JSON.stringify({privateKey:io,publicKey:oo}),co=Buffer$3.from(so).toString("base64");return StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,co,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),{privateKey:io,publicKey:oo}}),ro=reactExports.useCallback(()=>StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),[]);return{generateSessionKey:to,registerEmbeddedWalletSessionKey:eo,removeSessionKey:ro,shouldRegisterSessionKeysOnSignin:()=>!1}},useVerifyWallet=({consumeNonce:Xr,displaySiweStatement:eo,environmentId:to,projectSettings:ro,setIsSingleWalletAccount:no})=>{const{setExistentAccountData:io}=useAccountExistsContext(),{setDeniedAddress:oo,setDeniedOauthProvider:ao}=useAccessDeniedContext(),{setView:so,goToInitialView:co}=useViewContext(),{setErrorMessage:lo,setError:uo}=useErrorContext(),{multiWalletWidgetState:ho,debugError:go,multiWallet:bo,appName:wo,primaryWalletId:Eo,setShowAuthFlow:$o,setPrimaryWalletId:Co,siweStatement:Ro,connectedWallets:Oo,authMode:jo,user:Bo,setAuthMode:Mo,removeConnectedWalletsInfo:Fo,events:Wo,primaryWallet:Jo,enableConnectOnlyFallback:Po,selectedWalletConnector:fo}=useInternalDynamicContext(),{addedWalletsIds:yo}=useInternalUserWallets(),{initAuth:vo}=useUserAuth({authMethod:"wallet"}),{generateSessionKey:_o,shouldRegisterSessionKeysOnSignin:So}=useEmbeddedWalletSessionKeys(to),To=!Bo,Ao=Po&&(To||!bo),ko=(Ho,Yo,Xo,qo,Ko,Qo,zo,ga)=>__awaiter$j(void 0,void 0,void 0,function*(){const $a=Xr();if($a===void 0)throw new DynamicError("Missing nonce");const Sl=yield getVerifyArgs({displaySiweStatement:eo,environmentId:to,getAddressOpts:Xo,messageToSignOverride:ga,nonce:$a,publicWalletAddress:qo,signedMessageOverride:zo,siweStatement:getSiweStatement({appName:wo,siweStatement:Ro}),walletConnector:Ho,walletProvider:Yo});if(So()){const Tl=yield _o();Sl.sessionPublicKey=Tl.publicKey}let El;return!Bo||!bo?El=verifyWallet(to,Object.assign(Object.assign({},Sl),{captchaToken:Ko,oauth:Qo})):El=linkWallet(to,Sl),{verifyArgs:Sl,verifyFunction:()=>El}}),mo=({walletConnector:Ho,verifiedCredentials:Yo,lastVerifiedCredentialId:Xo})=>{const qo=Yo.find(Ko=>Ko.id===Xo&&Ko.format==="blockchain");if(qo){const Ko=Yo.find(Qo=>Qo.id===Eo);(To||!Jo||ho==="awaiting_signature"&&qo.walletName===(Ko==null?void 0:Ko.walletName)||(Ko==null?void 0:Ko.chain)==="flow"&&Ho.connectedChain==="FLOW")&&Co(qo.id)}},Io=Ho=>{var Yo;$o(!0),so("wallet-used"),no(!1),Ho.code==="reassign_wallet_error"&&(!((Yo=ro==null?void 0:ro.sdk)===null||Yo===void 0)&&Yo.preventOrphanedAccounts&&so("wallet-cannot-be-transferred"),no(!0))},Do=({walletConnector:Ho,endSession:Yo=!0})=>{Fo(),Yo&&(Ho==null||Ho.endSession())},Lo=(Ho,Yo,Xo,qo)=>{var Ko;if(Ho.message==="ignore")return;if(fo&&fo.key===Yo.key&&dynamicEvents.emit("authFailure",{address:Xo,connectorName:Yo.name,option:Yo.name,type:"wallet"},{error:Ho}),Ho instanceof WalletUsedError)return Do({endSession:!1,walletConnector:Yo}),Io(Ho);if(Ho instanceof MergeAccountsConfirmationError){so("merge-user-accounts",Object.assign({},Ho)),$o(!0);return}if(Ho instanceof ChainalysisError){Do({walletConnector:Yo}),oo(Xo),so("chainalysis-blocked-wallet");return}if(Ho instanceof GateBlockedError){Do({walletConnector:Yo}),oo(Xo),so("gate-blocked-wallet");return}if(Ho instanceof SandboxMaximumThresholdReachedError){so("sandbox-maximum-threshold-reached");return}if(Ho instanceof NoAccessError){Do({walletConnector:Yo}),oo(Xo),isSocialWalletConnector(Yo)&&ao(qo==null?void 0:qo.provider),so("no-access");return}if(Ho instanceof AccountExistsError){Do({walletConnector:Yo}),io(Ho.errorPayload),so("account-exists");return}if(Oo.length&&jo==="connect-only")throw new DynamicError(Ho.message);const Qo=(Ko=Ho==null?void 0:Ho.message)===null||Ko===void 0?void 0:Ko.includes("User rejected the request");if(Ao&&!Qo){logger$8.warn("Verification failed, changing to connect-only"),Mo("connect-only"),so("wallet-list");return}else Do({walletConnector:Yo}),co();logger$8.error(Ho),go?uo(`${Ho.message} + ${Ho.stack}`):lo(Ho.code)};return Ho=>__awaiter$j(void 0,[Ho],void 0,function*({walletConnector:Yo,getAddressOpts:Xo,publicWalletAddress:qo,captchaToken:Ko,oauth:Qo,signedMessageOverride:zo,messageToSignOverride:ga}){const $a=getWalletProvider(Yo);dynamicEvents.emit("authInit",{address:qo,connectorName:Yo.name,option:Yo.name,type:"wallet"});try{const{verifyFunction:Sl,verifyArgs:El}=yield ko(Yo,$a,Xo,qo,Ko,Qo,zo,ga);yield vo({isSignIn:To,onError:Tl=>{Lo(Tl,Yo,qo,Qo)},onVerifySuccess:Tl=>{var Il;if(!Tl)throw new DynamicError(USER_NOT_LOGGED_IN);try{(Il=Wo==null?void 0:Wo.onSignedMessage)===null||Il===void 0||Il.call(Wo,{messageToSign:El.messageToSign,signedMessage:El.signedMessage})}catch{logger$8.warn("Error calling onSignedMessage callback")}StorageService.setItem(LAST_USED_WALLET,Yo.key),Mo("connect-and-sign"),mo({lastVerifiedCredentialId:Tl.lastVerifiedCredentialId,verifiedCredentials:Tl.verifiedCredentials,walletConnector:Yo});const Zl=Tl.lastVerifiedCredentialId;Zl&&yo.current.push(Zl)},options:{address:qo,connectorName:Yo.name},skipDefaultErrorHandling:!0,verifyFunction:Sl})}catch(Sl){Lo(Sl,Yo,qo,Qo)}})},useEffectOnceCondition=(Xr,eo)=>{const to=reactExports.useRef(!1),ro=reactExports.useRef(Xr);ro.current=Xr,reactExports.useEffect(()=>{eo&&!to.current&&(ro.current(),to.current=!0)},[eo])},SOCIAL_STORAGE_KEY="dynamic_social_storage",searchSocialStorageByState=Xr=>{var eo;const to=StorageService.getItem(SOCIAL_STORAGE_KEY);if(!to)return;const ro=Object.entries(to),[no]=(eo=ro.find(([,{state:io}])=>io===Xr))!==null&&eo!==void 0?eo:[];if(no)return to[no]},setSocialStorageFor=(Xr,eo)=>{var to;const ro=(to=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&to!==void 0?to:{};ro[Xr]=Object.assign({provider:Xr},eo),StorageService.setItem(SOCIAL_STORAGE_KEY,ro)},deleteSocialStorage=Xr=>{var eo;const to=(eo=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&eo!==void 0?eo:{};delete to[Xr],StorageService.setItem(SOCIAL_STORAGE_KEY,to)},getSocialSignInProviderForProviderEnum=Xr=>{if(!Xr)return;const eo=Object.values(SocialSignInProviderEnum);for(const to of eo)if(to===Xr)return to},digestSHA256=Xr=>{const to=new TextEncoder().encode(Xr);return window.crypto.subtle.digest("SHA-256",to)},encodeBase64URL=Xr=>{const eo=[];return new Uint8Array(Xr).forEach(to=>eo.push(to)),btoa(String.fromCharCode.apply(null,eo)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},stringifyURIQuery=Xr=>{const eo=[];for(const to in Xr)eo.push(encodeURIComponent(to)+"="+encodeURIComponent(Xr[to]));return eo.join("&")},getProviderByType=(Xr,eo)=>Xr.find(to=>to.provider===eo),APPLE_LOGIN_DATA={customMobileUrl:!0,response_mode:"form_post",response_type:["code","id_token"]},getMobileOauthUrl=(Xr,eo)=>{if(!(!(eo!=null&&eo.customMobileUrl)||!isMobile$1()||!Xr.redirectUrl))return Xr.redirectUrl.replace("redirect","authorizeHtml")},getOauthLoginUrl=(Xr,eo)=>{var to,ro;const no=getProviderByType(Xr,eo);if(!(no!=null&&no.clientId))return"";let io;eo===ProviderEnum.Apple&&(io=APPLE_LOGIN_DATA);let oo;if(eo===ProviderEnum.Telegram)oo=(to=no.authorizationUrl)!==null&&to!==void 0?to:"";else if(no.baseAuthUrl)oo=no.baseAuthUrl;else return"";const ao=getMobileOauthUrl(no,io),so={client_id:no.clientId,redirect_uri:(ro=no.redirectUrl)!==null&&ro!==void 0?ro:"",response_type:"code"};no.scopes&&(so.scope=no.scopes),io!=null&&io.prompt&&(so.prompt=io.prompt.join(" ")),io!=null&&io.response_mode&&(so.response_mode=io.response_mode),io!=null&&io.response_type&&(so.response_type=io.response_type.join(" "));const co=stringifyURIQuery(so);return`${ao??oo}?${co}`},randomString=Xr=>{const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";let to="";for(let ro=Xr;ro>0;--ro)to+=eo[Math.floor(Math.random()*eo.length)];return to},initAuth=(Xr,eo,to)=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield sdkApi$1().initAuth({environmentId:Xr,oauthInitAuthRequest:to,providerType:eo})}catch(ro){logger$8.error(ro)}}),verifyOAuth=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{code:io,codeVerifier:oo,state:ao}){const so={code:io,codeVerifier:oo,state:ao};try{const co=yield sdkApi$1().oauthVerify({environmentId:ro,oauthRequest:so,providerType:no});return storeAuthTokenAndUser(co)}catch(co){return handleVerifyError(co)}}),signInOAuth=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{code:io,codeVerifier:oo,state:ao,captchaToken:so,sessionPublicKey:co}){const lo={captchaToken:so,code:io,codeVerifier:oo,sessionPublicKey:co,state:ao};try{const uo=yield sdkApi$1().oauthSignIn({environmentId:ro,oauthRequest:lo,providerType:no});return storeAuthTokenAndUser(uo)}catch(uo){return handleSignInError(uo)}}),getOAuthResult=(Xr,eo,to)=>__awaiter$j(void 0,[Xr,eo,to],void 0,function*(ro,no,{state:io}){const oo={state:io};try{return yield sdkApi$1().oauthResult({environmentId:ro,oauthResultRequest:oo,providerType:no})}catch(ao){logger$8.error(ao);return}}),farcasterSignIn=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{const to=yield sdkApi$1().farcasterSignIn({environmentId:Xr,farcasterSignInRequest:eo});return storeAuthTokenAndUser(to)}catch(to){return handleSignInError(to)}}),farcasterVerify=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield sdkApi$1().farcasterVerify(Xr);return storeAuthTokenAndUser(eo)}catch(eo){return handleVerifyError(eo)}}),telegramSignIn=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{const ro=yield sdkApi$1().telegramSignIn(to);return storeAuthTokenAndUser(ro)}catch(ro){return handleSignInError(ro)}}),isUserLinkedWithTelegram=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{return yield sdkApi$1().telegramCheckAuth(to),!0}catch{return!1}}),telegramVerify=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to={environmentId:Xr,oauthResultRequest:eo};try{const ro=yield sdkApi$1().telegramVerify(to);return storeAuthTokenAndUser(ro)}catch(ro){return handleVerifyError(ro)}}),handleVerifyError=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.error(Xr);const eo=yield Xr.json();if(eo.code==="social_account_already_exists")throw new SocialAccountAlreadyExistsError;if(eo.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(eo.error.message)}),handleSignInError=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){var eo,to,ro;logger$8.error(Xr);const no=yield Xr.json();if(no.error.code==="gate_blocked")throw new GateBlockedError(no.payload.walletPublicKey);if(no.error.code==="missing_from_list")throw new NoAccessError({socialProvider:(eo=no==null?void 0:no.payload)===null||eo===void 0?void 0:eo.socialProvider,socialUsername:(to=no==null?void 0:no.payload)===null||to===void 0?void 0:to.socialUsername,walletPublicKey:(ro=no==null?void 0:no.payload)===null||ro===void 0?void 0:ro.walletPublicKey});if(no.code==="email_associated_with_different_provider")throw new AccountExistsError(no.error,no.payload);if(no.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(no.error.message)}),CONNECT_URL="https://relay.farcaster.xyz/v1/channel",STATUS_URL="https://relay.farcaster.xyz/v1/channel/status",STATUS_TIMEOUT=3e5,STATUS_INTERVAL=1e3,connect=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield FetchService.fetch(CONNECT_URL,{body:JSON.stringify(Xr),headers:{"Content-Type":"application/json"},method:"POST"});if(!eo.ok)throw new Error(`HTTP error! status: ${eo.status}`);return yield eo.json()}catch(eo){logger$8.error("Error connecting with farcaster:",eo);return}}),status=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{const eo=yield FetchService.fetch(STATUS_URL,{headers:{Authorization:`Bearer ${Xr.channelToken}`,"Content-Type":"application/json"},method:"GET"});if(!eo.ok)throw new Error(`HTTP error! status: ${eo.status}`);return yield eo.json()}catch(eo){logger$8.error("Error fetching farcaster connect status:",eo);return}}),watchStatus=(Xr,...eo)=>__awaiter$j(void 0,[Xr,...eo],void 0,function*(to,{timeout:ro=STATUS_TIMEOUT,interval:no=STATUS_INTERVAL}={}){const io=Date.now()+ro;let oo=!0,ao;dynamicEvents.on("farcasterConnectCancelled",()=>{oo=!1,ao==null||ao(),ao=void 0});const so=co=>{ao=co,setTimeout(co,no)};for(;oo&&Date.now(){const{environmentId:no,setShowAuthFlow:io,socialSettings:oo,projectSettings:ao,consumeNonce:so,redirectUrl:co}=useInternalDynamicContext(),lo=reactExports.useMemo(()=>(oo==null?void 0:oo.strategy)||"redirect",[oo]),{setErrorMessage:uo,setError:ho}=useErrorContext(),{initAuth:go}=useUserAuth({authMethod:"social"}),{generateSessionKey:bo,shouldRegisterSessionKeysOnSignin:wo}=useEmbeddedWalletSessionKeys(no),[Eo,$o]=reactExports.useState(!1),[Co,Ro]=reactExports.useState(),Oo=reactExports.useCallback(()=>{Ro(void 0),ho(void 0)},[ho]),jo=reactExports.useCallback((yo,vo,_o)=>{$o(!1),to==null||to(),eo==null||eo(),yo&&(_o!=null&&_o.raiseAuthFailure)&&dynamicEvents.emit("authFailure",{option:yo,provider:yo,type:"social"},vo)},[to,eo]),Bo=reactExports.useCallback((yo,vo,_o,So)=>{const To={code:vo,message:_o};logger$8.error(_o),Ro(To),uo(vo),jo(yo,{error:To},So)},[jo,uo]),Mo=reactExports.useCallback((yo,vo)=>yo?socialProviders.includes(yo)?!0:(Bo(yo,SocialOAuthErrorCode.INVALID_PROVIDER,`Invalid social provider. Valid providers are: ${socialProviders.join(", ")}`,{raiseAuthFailure:vo==="signin"}),!1):(Bo(yo,SocialOAuthErrorCode.NO_PROVIDER,"Provider is required",{raiseAuthFailure:vo==="signin"}),!1),[Bo]),Fo=reactExports.useCallback((yo,vo)=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!(yield vo())){Bo(yo,SocialOAuthErrorCode.VERIFICATION_ERROR,`Failed to link social account: ${yo}`,{raiseAuthFailure:!1});return}eo==null||eo()}catch(_o){_o instanceof SocialAccountAlreadyExistsError&&Bo(yo,SocialOAuthErrorCode.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE,`Social account already linked to a different profile: ${yo}`,{raiseAuthFailure:!1})}}),[Bo,eo]),Wo=reactExports.useCallback((yo,vo)=>__awaiter$j(void 0,void 0,void 0,function*(){yield go({onError:()=>Bo(yo,SocialOAuthErrorCode.SIGNIN_ERROR,`Failed to sign-in with social account: ${yo}`,{raiseAuthFailure:!0}),onSettled:eo,options:{provider:yo},verifyFunction:()=>vo()})}),[Bo,go,eo]),Jo=reactExports.useCallback(yo=>__awaiter$j(void 0,[yo],void 0,function*({authMode:vo,provider:_o,state:So,authCode:To,captchaToken:Ao,verifier:ko,telegramAuthToken:mo,forceCreateUser:Io=!1}){try{let Do;if(wo()&&(Do=(yield bo()).publicKey),vo==="signin"){if(_o===ProviderEnum.Telegram&&mo)return yield Wo(_o,()=>telegramSignIn(no,{forceCreateUser:Io,sessionPublicKey:Do,telegramAuthToken:mo}));_o===ProviderEnum.Telegram?yield Wo(_o,()=>telegramSignIn(no,{code:To,sessionPublicKey:Do,state:So})):yield Wo(_o,()=>signInOAuth(no,_o,{captchaToken:Ao,code:To,codeVerifier:ko,sessionPublicKey:Do,state:So}))}else _o===ProviderEnum.Telegram?yield Fo(_o,()=>telegramVerify(no,{code:To,state:So})):yield Fo(_o,()=>verifyOAuth(no,_o,{code:To,codeVerifier:ko,state:So}))}catch(Do){logger$8.error("Social connection failed with unexpected error:",Do),jo(_o,{error:Do},{raiseAuthFailure:vo==="signin"})}}),[no,bo,Fo,jo,wo,Wo]),Po=reactExports.useCallback((yo,vo)=>__awaiter$j(void 0,[yo,vo],void 0,function*(_o,{captchaToken:So,redirectUrl:To}){const Ao=so(),ko=PlatformService.getHost(),mo=yield connect({domain:ko,nonce:Ao,redirectUrl:To||co,siweUri:PlatformService.getOrigin()});if(!(mo!=null&&mo.url)||!(mo!=null&&mo.channelToken)){Bo(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return a valid url.",{raiseAuthFailure:_o==="signin"});return}isMobile$1()?yield PlatformService.openURL(mo.url):(io(!0),ro==null||ro(mo.url));const Io=yield watchStatus({channelToken:mo.channelToken});if(Io==="cancelled"){$o(!1);return}if(Io==="timeout"||Io==="rejected"||!(Io!=null&&Io.message)||!(Io!=null&&Io.custody)||!(Io!=null&&Io.signature)||!(Io!=null&&Io.nonce)){Bo(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return valid data.",{raiseAuthFailure:_o==="signin"});return}const{custody:Do,message:Lo,signature:Ho,nonce:Yo}=Io;if(_o==="signin"){let Xo;wo()&&(Xo=(yield bo()).publicKey);const qo=()=>farcasterSignIn(no,{address:Do,captchaToken:So,domain:ko,message:Lo,nonce:Yo,sessionPublicKey:Xo,signature:Ho});yield Wo(ProviderEnum.Farcaster,qo)}else{const Xo=()=>farcasterVerify({environmentId:no,farcasterSignInRequest:{address:Do,captchaToken:So,domain:ko,message:Lo,nonce:Yo,signature:Ho}});yield Fo(ProviderEnum.Farcaster,Xo),io(!1,{clearErrors:!1})}$o(!1)}),[so,co,no,bo,Bo,Fo,ro,io,wo,Wo]),fo=reactExports.useCallback(yo=>__awaiter$j(void 0,[yo],void 0,function*({authMode:vo,provider:_o,validator:So,captchaToken:To,redirectUrl:Ao,telegramAuthToken:ko}){var mo,Io;if(Oo(),$o(!0),!vo){logger$8.error('Auth mode is required. Please use either "link" or "signin"');return}if(!Mo(_o,vo)||So&&!So(_o))return;if(dynamicEvents.emit("authInit",{option:_o,provider:_o,type:"social"}),_o===ProviderEnum.Farcaster)return Po(vo,{captchaToken:To,redirectUrl:Ao});const Do=randomString(32),Lo=randomString(43),Ho=providersRequiringPkce.includes(_o);setSocialStorageFor(_o,{captchaToken:To,codeVerifier:Ho?Lo:void 0,mode:vo,state:Do});const Yo=getOauthLoginUrl((mo=ao==null?void 0:ao.providers)!==null&&mo!==void 0?mo:[],_o);if(!Yo){Bo(_o,SocialOAuthErrorCode.NO_OAUTH_URL,`Failed to get login url to connect social account: ${_o}`,{raiseAuthFailure:vo==="signin"});return}const Xo=new URL(Yo);if(Xo.searchParams.set("state",Do),Ho){const Ko=yield digestSHA256(Lo);Xo.searchParams.set("code_challenge",encodeBase64URL(Ko)),Xo.searchParams.set("code_challenge_method","S256")}const qo=isMobile$1();try{const Ko=yield Oauth2Service.getOauthCode({apiProvider:getProviderByType((Io=ao==null?void 0:ao.providers)!==null&&Io!==void 0?Io:[],_o),getOAuthResultFromApi:()=>getOAuthResult(no,_o,{state:Do}),initWebAuth:({redirectUrl:Qo}={})=>initAuth(no,_o,{redirectUrl:Qo?removeDynamicOauthParamsFromUrl(Qo):void 0,state:Do}),isMobile:qo,oauthLoginUrl:Xo,onSettled:eo,provider:_o,redirectUrl:Ao??co,sessionTimeout:Xr,setIsProcessing:$o,state:Do,strategy:lo});yield Jo({authCode:Ko,authMode:vo,captchaToken:To,provider:_o,state:Do,telegramAuthToken:ko,verifier:Lo})}catch(Ko){if(Oauth2Service.isGetOauthCodeError(Ko)){Bo(_o,Ko.code,Ko.message,{raiseAuthFailure:vo==="signin"});return}logger$8.error("Social connection failed with unexpected error:",Ko),jo(_o,{error:Ko},{raiseAuthFailure:vo==="signin"})}}),[Mo,Oo,Jo,Po,co,no,Bo,jo,eo,ao==null?void 0:ao.providers,Xr,lo]);return reactExports.useMemo(()=>({checkValidProvider:Mo,completeConnection:Jo,connectSocialAccount:fo,error:Co,handleError:Bo,isProcessing:Eo,setError:Ro,setIsProcessing:$o}),[Mo,Jo,fo,Co,Bo,Eo])},removeDynamicOauthParamsFromUrl=Xr=>{const eo=new URL(Xr);return eo.searchParams.delete("dynamicOauthState"),eo.searchParams.delete("dynamicOauthCode"),eo.toString()},useRedirectSocialHandler=({setSocialProvider:Xr})=>{const{setView:eo}=useViewContext(),{setDynamicWidgetView:to}=useWidgetContext(),[ro,no]=reactExports.useState(null),{sdkHasLoaded:io,setShowAuthFlow:oo,isRenderingEmbeddedAuthFlow:ao,setShowDynamicUserProfile:so}=useInternalDynamicContext(),{completeConnection:co}=useSocialAuth({sessionTimeout:1e4}),lo=reactExports.useCallback(ho=>{const go=getSocialSignInProviderForProviderEnum(ho.provider);Xr(go),eo("social-redirect-view"),ao.current||oo(!0)},[Xr,eo,ao,oo]),uo=reactExports.useCallback(()=>{to("profile"),so(!0)},[to,so]);useEffectOnce(()=>{if(isSSR())return;const ho=new URL(window.location.href),go=ho.searchParams.get("dynamicOauthState"),bo=ho.searchParams.get("dynamicOauthCode");if(!go||!bo)return;const wo=searchSocialStorageByState(go);wo&&(wo.code=bo,no(wo),deleteSocialStorage(wo.provider))}),useEffectOnceCondition(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(ro){if(ro.mode==="signin"){if(getUser()){logger$8.error(new DynamicError("User is already logged in"));return}lo(ro)}else if(ro.mode==="link"){if(!getUser()){logger$8.error(new DynamicError("User not logged in"));return}uo()}yield co({authCode:ro.code,authMode:ro.mode,captchaToken:ro.captchaToken,provider:ro.provider,state:ro.state,verifier:ro.codeVerifier})}}),!!ro&&io)},SocialRedirectContext=reactExports.createContext(void 0),SocialRedirectContextProvider=({children:Xr})=>{var eo,to,ro,no;const{setShowAuthFlow:io,walletConnectorOptions:oo,setSelectedWalletConnectorKey:ao,walletUiUtils:so,consumeNonce:co,displaySiweStatement:lo,environmentId:uo,projectSettings:ho,setIsSingleWalletAccount:go,setShowDynamicUserProfile:bo,setPrimaryWalletId:wo,secondaryWallets:Eo,sdkHasLoaded:$o,user:Co,connectWallet:Ro,primaryWallet:Oo,socialProvidersFilter:jo=Do=>Do}=useInternalDynamicContext(),{setErrorMessage:Bo}=useErrorContext(),{setView:Mo}=useViewContext(),{getCaptchaToken:Fo}=useCaptchaContext(),Wo=useVerifyWallet({consumeNonce:co,displaySiweStatement:lo,environmentId:uo,projectSettings:ho,setIsSingleWalletAccount:go}),Jo=(eo=ho==null?void 0:ho.sdk.socialSignIn)===null||eo===void 0?void 0:eo.signInProvider,Po=(ro=(to=ho==null?void 0:ho.sdk.socialSignIn)===null||to===void 0?void 0:to.providers)!==null&&ro!==void 0?ro:[],fo=(no=jo(Po.filter(Do=>Do.enabled).map(Do=>Do.provider)))!==null&&no!==void 0?no:[],yo=oo.map(({walletConnector:Do})=>Do).find(isSocialWalletConnector),[vo,_o]=reactExports.useState("idle"),[So,To]=reactExports.useState(),ko=(Oo?[Oo,...Eo]:Eo).find(Do=>Do.connector.key===(yo==null?void 0:yo.key)),mo=reactExports.useMemo(()=>ko?getReferencedAccount(Co,ko.id):void 0,[Co,ko]);useInternalDynamicEvents("logout",()=>To(void 0));const Io=reactExports.useCallback(Do=>{logger$8.error(Do),Co?(io(!1,{emitCancelAuth:!0}),bo(!0)):(io(!0),Mo("wallet-list"),Bo("-1"))},[Co,Bo,io,bo,Mo]);return reactExports.useEffect(()=>{var Do,Lo;if(!ho||!yo||!$o){new URLSearchParams(window.location.search).has("magic_oauth_request_id")&&(Mo("social-redirect-view"),io(!0));return}const Ho=new URLSearchParams(window.location.search);if(Ho.has("error")&&Ho.has("provider")){const Yo=Ho.get("error_description");Io(Yo??"Unknown error"),(Do=yo.getSession)===null||Do===void 0||Do.call(yo);return}if(Ho.has("magic_oauth_request_id")){const Yo=Ho.get("provider");To(Yo),_o("loading"),Mo("social-redirect-view"),io(!0),Co||ao(yo.key),(Lo=yo.getSession)===null||Lo===void 0||Lo.call(yo).then(Xo=>__awaiter$j(void 0,void 0,void 0,function*(){if(Co){if(!mo)throw new Error("Social account not found");mo.oauthAccountId===Xo.oauthId?(ko==null?void 0:ko.id)!==(Oo==null?void 0:Oo.id)&&(wo(ko.id),io(!1),bo(!0)):(yield yo.endSession(),Mo("social-wrong-account"))}else{yield Ro(yo);const qo=yield yo.getAddress();so.disabledConfirmationOnce(),yield Wo({captchaToken:Fo(),oauth:{accessToken:Xo.accessToken,didToken:Xo.didToken,provider:Yo},publicWalletAddress:qo,walletConnector:yo})}To(void 0),_o("success")})).catch(Xo=>{To(void 0),_o("error"),Io(Xo)})}},[mo,Co,ho,$o,Eo,wo,ao,io,bo,Mo,yo,Wo,so,ko,Io,Ro,Oo==null?void 0:Oo.id,Fo]),useRedirectSocialHandler({setSocialProvider:To}),jsxRuntimeExports.jsx(SocialRedirectContext.Provider,{value:{enabledSocialProviders:fo,redirectStatus:vo,setSocialProvider:To,signInProvider:Jo,socialAccount:mo,socialProvider:So,socialWalletConnector:yo},children:Xr})},useSocialRedirectContext=()=>{const Xr=reactExports.useContext(SocialRedirectContext);if(Xr===void 0)throw new Error("useSocialRedirectContext must be used within a SocialRedirectContextProvider");return Xr},AnimatePresence=({children:Xr,animationComponent:eo})=>{const[to,ro]=reactExports.useState(!0),no=useForceUpdate(),io=reactExports.useRef(null),oo=reactExports.useMemo(()=>!!Xr,[Xr]),ao=usePrevious(oo),so=reactExports.useCallback(()=>{io.current=null,no()},[no]);return reactExports.useEffect(()=>{reactExports.isValidElement(Xr)&&(io.current=reactExports.Children.map(Xr,co=>reactExports.cloneElement(co)))},[Xr]),reactExports.useEffect(()=>{oo&&!ao&&ro(!0),ao&&!oo&&ro(!1)},[oo,ao]),reactExports.cloneElement(eo,{children:Xr||io.current,isShown:to,onUnmount:so})},ErrorContainer=({children:Xr,className:eo,isMultiWalletError:to=!1,withIcon:ro=!0,variant:no="error",copykey:io})=>{const oo=classNames("error-container",`error-container--${no}`,eo,{"error-container--multi-wallet":to}),ao=classNames("error",{"error--with-icon":ro});return jsxRuntimeExports.jsxs("div",{className:oo,"data-testid":`error-container--${no}`,children:[ro&&jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:ao,copykey:io,children:Xr})]})};var PasskeySuccessEnum;(function(Xr){Xr[Xr.CREATED=0]="CREATED",Xr[Xr.EDITED=1]="EDITED"})(PasskeySuccessEnum||(PasskeySuccessEnum={}));const PasskeyCreatedSuccessBanner=({className:Xr})=>{const{passkeySuccessPopup:eo}=useInternalDynamicContext(),{t:to}=useTranslation();return jsxRuntimeExports.jsxs(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{}),children:[eo===PasskeySuccessEnum.EDITED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:Xr,copykey:"dyn_passkey_success.edited",children:to("dyn_passkey_success.edited")}),eo===PasskeySuccessEnum.CREATED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:Xr,copykey:"dyn_passkey_success.created",children:to("dyn_passkey_success.created")})]})};var css_248z$1='@layer shadow-reset{.dynamic-shadow-dom-content{all:initial}}@layer preflight{a,hr{color:inherit}progress,sub,sup{vertical-align:baseline}blockquote,body,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,menu,ol,p,pre,ul{margin:0}fieldset,legend,menu,ol,ul{padding:0}*,:after,:before{border:0 solid;box-sizing:border-box}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}summary{display:list-item}menu,ol,ul{list-style:none}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}}.accordion-item{overflow:hidden;position:relative;transition-duration:.15s;transition-property:max-height;transition-timing-function:ease-out}.accordion-item--full-height{height:100vh}.accordion-item__curtain{background-color:var(--dynamic-overlay);left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity 50ms ease-in;z-index:1}.accordion-item__curtain--dimmed{bottom:0;opacity:1}.vertical-accordion__container{display:flex;flex-direction:column}.alert{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);display:flex;gap:.75rem;padding:.75rem}.alert--error{background-color:var(--dynamic-error-2);color:var(--dynamic-error-1)}.alert--warning{background-color:var(--dynamic-alert-2);color:var(--dynamic-alert-1)}.alert--info{background-color:var(--dynamic-brand-secondary-color);color:var(--dynamic-brand-primary-color)}.alert__icon{flex-shrink:0}.badge__container{align-items:center;border-radius:9999px;display:flex;font-size:.625rem;font-weight:500;gap:.25rem;padding:.25rem .5rem;position:relative;transition:color .3s,background-color .3s;white-space:nowrap}.badge__container__primary{background-color:var(--dynamic-badge-primary-background);color:var(--dynamic-badge-primary-color)}.badge__container__secondary{background-color:var(--dynamic-badge-background);color:var(--dynamic-badge-color)}.badge__dot{background-color:var(--dynamic-badge-dot-background);border-radius:9999px;height:.375rem;transition:color .3s,background-color .3s;width:.375rem}.button{align-items:center;cursor:pointer;display:flex;gap:.375rem;justify-content:center;position:relative;transition:all .2s ease}.button:disabled:not(.button--loading){cursor:default;opacity:.5}.button--expanded{width:100%}.button--brand-primary{background:var(--dynamic-brand-primary-color);border:var(--dynamic-button-primary-border);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:var(--dynamic-button-primary-padding)}.button--brand-primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--brand-primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--brand-primary:active:enabled,.button--primary{box-shadow:var(--dynamic-shadow-down-1)}.button--primary{background:var(--dynamic-button-primary-background);border:var(--dynamic-button-primary-border);padding:var(--dynamic-button-primary-padding)}.button--primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--primary:active:enabled,.button--secondary{box-shadow:var(--dynamic-shadow-down-1)}.button--secondary{background:var(--dynamic-button-secondary-background);border:var(--dynamic-button-secondary-border);padding:var(--dynamic-button-secondary-padding)}.button--secondary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--secondary:hover:enabled{background:var(--dynamic-hover)}.button--secondary:active:enabled{background:var(--dynamic-base-3)}.button--tertiary,.button--tertiary .typography{color:var(--dynamic-text-secondary)}.button--tertiary:hover:enabled,.button--tertiary:hover:enabled .typography{color:var(--dynamic-text-primary)}.button--padding-default{border-radius:calc(var(--dynamic-border-radius)/2);padding:.625rem 1rem}.button--padding-large{border-radius:var(--dynamic-button-border-radius);padding:.875rem 1.25rem}.button--padding-medium{border-radius:calc(var(--dynamic-button-border-radius)/1.5);padding:.625rem 1rem}.button--padding-small{border-radius:calc(var(--dynamic-button-border-radius)/2);padding:.5rem .75rem}.button--padding-none{padding:0}.button--padding-login-screen-height{border-radius:calc(var(--dynamic-border-radius)/2);height:2.5rem;padding:0 1rem}.button__spinner{margin-left:auto;margin-right:auto}.button__end-slot,.button__start-slot{display:inline-flex}.button__spinner-container{align-items:center;bottom:0;color:var(--dynamic-text-primary);display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.button--loading>:not(.button__spinner-container){opacity:0}.checkbox--hidden{cursor:pointer;display:block;height:1rem;opacity:0;position:absolute;width:1rem;z-index:10}.checkbox--hidden:checked+.checkbox--visible{background:var(--dynamic-brand-primary-color);border-style:none}.checkbox--hidden:checked+.checkbox--visible>.checkbox__icon{opacity:1}.checkbox--hidden:disabled{pointer-events:none}.checkbox--visible{align-items:center;background:var(--dynamic-base-3);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/4);display:flex;height:1rem;justify-content:center;position:absolute;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem;z-index:0}.checkbox__container{height:1rem;position:relative;width:1rem}.checkbox__icon{color:#fff;height:.75rem;opacity:0;transition-duration:.2s;transition-property:opacity;width:.75rem}.connect-button{background:var(--dynamic-connect-button-background);border:var(--dynamic-connect-button-border);border-radius:calc(var(--dynamic-connect-button-radius, var(--dynamic-border-radius))/2);box-shadow:var(--dynamic-connect-button-shadow)}.connect-button:hover:enabled{background:var(--dynamic-connect-button-background-hover);border:var(--dynamic-connect-button-border-hover);box-shadow:var(--dynamic-connect-button-shadow-hover)}.connect-button:hover:enabled .typography{color:var(--dynamic-connect-button-color-hover)}.connect-button .typography{color:var(--dynamic-connect-button-color)}.copy-button__container{position:relative}.copy-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}@keyframes enter-tile{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.enter-list-tile-animation{animation-duration:.2s;animation-fill-mode:both;animation-iteration-count:1;animation-name:enter-tile;animation-timing-function:ease-out}.error-container{align-items:center;display:flex;justify-content:center;margin-bottom:.5rem;padding:.5rem .75rem}.error-container img,.error-container svg{height:1.25rem;width:1.25rem}.error-container--error{background:var(--dynamic-error-2);color:var(--dynamic-error-1)}.error-container--info{background:var(--dynamic-base-3);color:var(--dynamic-text-primary)}.error-container--success{background:var(--dynamic-success-2);color:var(--dynamic-success-1)}.error-container--multi-wallet{margin-bottom:.75rem}.error--with-icon{margin-left:.875rem}.icon--color-brand-primary{color:var(--dynamic-brand-primary-color)}.icon--color-text-primary{color:var(--dynamic-text-primary)}.icon--color-text-secondary{color:var(--dynamic-text-secondary)}.icon--color-text-tertiary{color:var(--dynamic-text-tertiary)}.icon--color-text-error{color:var(--dynamic-error-1)}.icon--color-success-1{color:var(--dynamic-success-1)}.icon--size-xsmall{height:.75rem;width:.75rem}.icon--size-small{height:1rem;width:1rem}.icon--size-mini{height:1.25rem;width:1.25rem}.icon--size-medium{height:1.5rem;width:1.5rem}.icon--size-mlarge{height:1.875rem;width:1.875rem}.icon--size-large{height:2.375rem;width:2.375rem}.icon-button{align-items:center;border-radius:100%;color:var(--dynamic-text-tertiary);display:flex;justify-content:center}.icon-button svg:hover{color:var(--dynamic-text-secondary)}.icon-button svg:active{color:var(--dynamic-text-primary)}.indicator__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;justify-content:center;position:absolute;right:0}.indicator__icon{background:var(--dynamic-success-1);border-radius:100%}.indicator__wallet-connect{background:#4084ed;bottom:0;color:#fff;position:absolute;right:-.125rem}.icon-with-spinner__container,.indicator__wallet-connect{align-items:center;border-radius:9999px;display:flex;justify-content:center}.icon-with-spinner__container{position:relative}.icon-with-spinner__container img{height:100%;width:100%}.icon-with-spinner__icon-container{align-items:center;display:flex;justify-content:center;position:relative}.icon-with-spinner__spinner-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));position:absolute;right:0;top:0}.icon-with-spinner__spinner{grid-column-start:2;grid-row-start:1;height:100%;width:100%}.icon-with-spinner__animation{animation:spin 1.4s linear infinite}.icon-with-status__container{margin-bottom:12px;max-width:-moz-fit-content;max-width:fit-content;position:relative}.icon-with-status__container .icon{border-radius:100%}.icon-with-status__status-dot{bottom:-.125rem;position:absolute;right:-.25rem}.icon-with-status__container .inner-icon__container{background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;padding:.1875rem;position:absolute;right:-.1875rem}.icon-with-status__container .inner-icon{border-radius:100%}.icon-with-status__container .inner-icon svg{height:1rem;width:1rem}.icon-with-status__container .inner-icon--green{background:var(--dynamic-success-1)}.icon-with-status__container .inner-icon--red{background:var(--dynamic-error-1)}.icon-with-status__container .inner-icon path{fill:var(--dynamic-base-1)}.icon-with-status__container .status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;display:flex;height:.625rem;justify-content:center;position:absolute;right:-.25rem;width:.625rem}.icon-with-status__container .status-dot{border-radius:100%;height:.375rem;width:.375rem}.icon-with-status__container .status-dot--green{background:var(--dynamic-success-1)}.icon-with-status__container .status-dot--red{background:var(--dynamic-error-1)}.info-item__container{color:var(--dynamic-text-tertiary);display:flex}.info-item__container a{text-decoration:underline}.info-item__container .info-item__icon-container{border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-tertiary);display:flex;margin-right:1.125rem}.info-item__container .info-item__icon-container svg{height:1.5rem;width:1.5rem}.info-item__container .info-item__secondary-text{margin-top:.25rem}.phone-number-field{display:flex;flex-direction:column}.phone-number-field__fields{align-items:stretch;display:flex;position:relative;width:100%}.phone-number-field__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.phone-number-field__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.phone-number-field__fields__country-code__flag{margin-right:.5rem}.phone-number-field__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.phone-number-field__fields__country-code .phone-number-field__fields__country-code__container .phone-number-field__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.phone-number-field__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.phone-number-field__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.phone-number-field__fields .phone-number-field__fields__phone-number .phone-number-field__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.phone-number-field__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.phone-number-field__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.phone-number-field__dropdown__items{display:flex;flex-direction:column}.phone-number-field__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.phone-number-field__dropdown__items__country__flag{width:1.5rem}.phone-number-field__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.phone-number-field__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.phone-number-field__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.phone-number-field input::-webkit-inner-spin-button,.phone-number-field input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.phone-number-field input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.inline-submit-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.inline-submit-button path,.inline-submit-button rect{transition:all .2s}.inline-submit-button--active,.inline-submit-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.inline-submit-button--ready,.inline-submit-button--ready:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.input__container{position:relative}.input__container .input__suffix{position:absolute;right:1rem;top:1rem}.input__container .input{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;transition:all .2s ease;width:100%}.input__container .input:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.input__container .input:disabled .input__label{color:var(--dynamic-text-tertiary)}.input__container .input__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem;pointer-events:none}.input__container .input:not(.input__error):focus,.input__container .input:not(.input__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.input__container .input__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.input__container .input__error~.input__label,.input__container .input__error~.input__trailing{color:var(--dynamic-error-1)}.input__container .input__has_trailing{padding-right:4rem}.input__container .input__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.input__container--dense .input{padding:1.125rem .75rem .375rem}.input__container--dense .input::-moz-placeholder{color:transparent}.input__container--dense .input::placeholder{color:transparent}.input__container--dense .input--no-label{padding-block:.75rem}.input__container--dense .input__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.input__container--dense .input:-moz-placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:focus~.input__label{font-size:.625rem;top:.4375rem}.input__container--regular{display:flex;flex-direction:column}.input__container--regular .input{padding:.75rem}.input__container--regular .input__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.input__container--regular .input__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.input__container--regular .input__suffix{top:2.375rem}.input__message{color:var(--dynamic-text-primary);padding:.5rem 0}.input__message__error{color:var(--dynamic-error-1)}.list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.list-tile:not(:disabled):active{transform:scale(.95)}.list-tile:not(:disabled):hover{background-color:var(--dynamic-wallet-list-tile-background-hover);border:var(--dynamic-wallet-list-tile-border-hover);box-shadow:var(--dynamic-wallet-list-tile-shadow-hover)}.list-tile__children{flex-grow:1;text-align:left}.modal-header{align-items:center;background:var(--dynamic-header-background);display:flex;justify-content:center;padding:var(--dynamic-header-padding);width:100%}.modal-header--border{border-bottom:var(--dynamic-header-border-bottom)}.modal-header--align-content-bottom{align-items:start}.modal-header--empty{padding-bottom:0}.modal-header__leading,.modal-header__trailing{align-items:center;display:flex;flex:1;gap:.25rem;height:1.5rem;justify-content:flex-start;margin-right:auto}.modal-header__leading--empty{height:0}.modal-header__trailing{justify-content:flex-end;margin-left:auto;margin-right:0}.modal-header__trailing--empty{height:0}.evm-network-control__container{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;max-width:100%;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.evm-network-control__container--error{border:1px solid var(--dynamic-error-1);color:var(--dynamic-error-1);cursor:auto}.evm-network-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.evm-network-control__arrow-icon{min-width:1rem;transform:rotate(90deg);transition:transform .15s linear}.evm-network-control__arrow-icon--active{transform:rotate(-90deg)}@keyframes spinner-animation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.network{color:var(--dynamic-text-primary);display:flex;justify-content:space-between;width:100%}.network .network__container{align-items:flex-start;display:flex}.network .network__title-icon{height:1rem;margin-right:.5rem;margin-top:.0625rem;width:1rem}.network .network__title-container{display:flex;flex-direction:column;gap:.25rem}.network .network__title-copy{white-space:nowrap}.network .network__status-container{align-items:center;border-radius:100%;display:flex;height:1rem;justify-content:center;width:1rem}.network .network__status-container .network__status-icon{color:#fff;height:.75rem;width:.75rem}.network .network__status-container .network__status-icon svg path{fill:currentcolor}.network .network__status-container .network__status-spinner-icon{animation:spinner-animation 2s linear infinite;height:.75rem;margin-right:-.9375rem;margin-top:-.75rem;transform-origin:0 100%;width:.75rem}.network .network__status-container--active{background-color:var(--dynamic-brand-primary-color)}.network-action{align-items:center;display:flex;padding:.5rem 1rem}@media (pointer:coarse){.network-action{padding:.5rem 1.5rem}}.network-action:not(.network--not-supported){cursor:pointer}.network-action:not(.network--not-supported):hover{background-color:var(--dynamic-hover)}.network-control-skeleton{align-items:center;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;gap:.375rem;justify-content:center;padding:.1875rem .25rem}.network-control-skeleton__icon{background-color:var(--dynamic-base-3);border:1px solid var(--dynamic-base-4);border-radius:100%;height:1.125rem;width:1.125rem}.network-control-skeleton__skeleton{width:1.875rem}.non-network-switching-supported-control{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;justify-content:center;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.non-network-switching-supported-control--error{background-color:var(--dynamic-error-2);cursor:auto}.non-network-switching-supported-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.network-picker-network-control{display:flex;flex-direction:column}.network-picker-network-control__anchor{padding-top:.125rem;position:relative}.pin-field__container{display:flex;flex:1;gap:2.5%;justify-content:space-between;margin-top:1rem;max-width:19.5rem;width:100%}.pin-input__input{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:.75rem;color:var(--dynamic-text-primary);font-size:1rem;height:2.75rem;max-width:2.75rem;outline:.125rem solid transparent;outline-offset:.125rem;text-align:center;width:100%}.pin-input__input:last-child{margin-right:0}.pin-input__input:disabled{cursor:not-allowed;opacity:.5}.pin-input__input--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1);color:var(--dynamic-error-1)}.pin-input__input--success{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1);color:var(--dynamic-success-1)}.portal__container{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.portal__backdrop{-webkit-backdrop-filter:var(--dynamic-modal-backdrop-filter);backdrop-filter:var(--dynamic-modal-backdrop-filter);background:var(--dynamic-modal-backdrop-background);cursor:default;height:100%;left:0;position:fixed;top:0;width:100%}.search__container{align-items:center;background:var(--dynamic-search-bar-background);border:var(--dynamic-search-bar-border);border-radius:var(--dynamic-search-border-radius);cursor:text;display:flex;gap:.625rem;height:2.625rem;justify-content:space-between;min-height:2.25rem;padding-left:.75rem;padding-right:.75rem}.search__container,.search__container svg{color:var(--dynamic-text-tertiary)}.search__container:hover:not(.search__container--active,.search__container:focus-within){background:var(--dynamic-search-bar-background-hover);border:var(--dynamic-search-bar-border-hover);color:var(--dynamic-text-secondary)}.search__container:hover:not(.search__container--active,.search__container:focus-within) svg{color:var(--dynamic-text-secondary)}.search__container--active,.search__container:focus-within{background:var(--dynamic-search-bar-background-focus);border:var(--dynamic-search-bar-border-focus);color:var(--dynamic-text-primary)}.search__container--active svg,.search__container:focus-within svg{color:var(--dynamic-text-secondary)}.search-icon__container{align-items:center;color:var(--dynamic-text-tertiary);display:flex;height:1rem;justify-content:center;width:1rem}.search__input{background:none;border:0;color:var(--dynamic-text-primary);display:flex;flex-grow:1;font-size:var(--dynamic-text-size-body-small);font-weight:500;line-height:1rem;margin:0;outline:none;padding-bottom:.25rem;padding-top:.25rem}.search__input::-moz-placeholder{color:var(--dynamic-text-tertiary)}.search__input::placeholder{color:var(--dynamic-text-tertiary)}.search__input:hover::-moz-placeholder{color:var(--dynamic-text-secondary)}.search__input:hover::placeholder{color:var(--dynamic-text-secondary)}.search__input:focus::-moz-placeholder{color:transparent}.search__input:focus::placeholder{color:transparent}.search__button--clear{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-mini)}.search__button--clear:hover{color:var(--dynamic-text-primary)}.select__container{cursor:pointer;position:relative}.select__container .select{-webkit-appearance:none;-moz-appearance:none;appearance:none;bottom:0;left:0;opacity:0;outline:none;position:absolute;right:0;top:0}.select__container .select::-moz-placeholder{color:transparent}.select__container .select::placeholder{color:transparent}.select__container .select__body{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;display:block;margin:0;padding:1.125rem .75rem .375rem;position:relative;transition:all .2s ease;width:100%}.select__container .select__value{color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400}.select__container .select__label{color:var(--dynamic-text-secondary);font-size:.9375rem;left:.75rem;pointer-events:none;position:absolute;top:.75rem;transition:all .2s ease}.select__container .select__control_icon{align-items:center;bottom:0;color:var(--dynamic-text-secondary);display:flex;position:absolute;right:.75rem;top:0}.select__container .select__has_value .select__label{font-size:.625rem;top:.4375rem}.select__container .select:has(.select__error)~.select__body{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error .select__control_icon,.select__container .select__error .select__label{color:var(--dynamic-error-1)}.select__message{color:var(--dynamic-text-primary);padding-top:.5rem}.select__message__error{color:var(--dynamic-error-1)}.separator{border-top:.0625rem solid var(--dynamic-base-3)}@keyframes shimmer{to{transform:translateX(100%)}}.skeleton{background:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/6);display:inline-flex;line-height:1;min-width:100%;overflow:hidden;position:relative;z-index:0}.skeleton:after{animation:shimmer 2s infinite;background-image:var(--dynamic-loading-animation-gradient);bottom:0;content:"";left:0;position:absolute;right:0;top:0;transform:translateX(-100%)}.spinner{animation:spin 1s linear infinite}.spinner path{stroke:var(--dynamic-brand-primary-color)}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;display:flex;height:.625rem;justify-content:center;width:.625rem}.status-dot{border-radius:100%;height:.375rem;width:.375rem}.status-dot--green{background:var(--dynamic-success-1)}.status-dot--red{background:var(--dynamic-error-1)}.status-dot--yellow{background:var(--dynamic-alert-1)}.switch__container{display:flex}.switch__container.disabled{opacity:.2;pointer-events:none}.switch__container .button{background:var(--dynamic-base-2);border-radius:0;box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);font-size:var(--dynamic-text-size-button-primary);font-weight:400;margin:0;padding:.75rem 0;width:100%}.switch__container .button:first-child{border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-right:0;border-top-left-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button:last-child{border-bottom-right-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button.active{background:var(--dynamic-brand-primary-color);color:#fff}.text-button{align-items:center;border-radius:calc(var(--dynamic-border-radius)/6);color:var(--dynamic-text-secondary);cursor:pointer;display:flex;font-size:.75rem;font-weight:500;gap:.375rem;padding:.125rem .375rem}.text-button:hover{background-color:var(--dynamic-hover)}.auth-mode-switch__container{align-items:center;color:#fff;display:flex;font-size:1rem;gap:.25rem;margin-bottom:.25rem}.auth-mode-switch__container label{cursor:pointer}.toolkit__container{background:var(--dynamic-base-1);border-bottom-right-radius:calc(var(--dynamic-border-radius)/1.5);border-top-right-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;flex-direction:column;gap:1rem;left:0;padding:1.875rem 3.5rem;position:fixed;top:50%;transform:translateY(-50%);width:18.125rem}@media (pointer:coarse){.toolkit__container{display:none}}.switcher__copy{color:var(--dynamic-text-primary);margin-bottom:.25rem}.tos-and-pp__text{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small);margin:0 auto;text-align:center}.tos-and-pp__text .tos-and-pp__link{color:var(--dynamic-text-link);text-decoration:none}.zoom-transition__root{transform-origin:50% 50%}.vertical-drawer-animation{overflow:hidden;transition-property:max-height;transition-timing-function:ease-out}.typography{font-family:var(--dynamic-font-family-primary);font-weight:400;line-height:normal}.typography--title{font-size:var(--dynamic-text-size-title)}.typography--body-normal{font-size:var(--dynamic-text-size-body-normal)}.typography--body-small{font-size:var(--dynamic-text-size-body-small)}.typography--body-mini{font-size:var(--dynamic-text-size-body-mini)}.typography--button-primary{font-size:var(--dynamic-text-size-button-primary);font-weight:700}.typography--button-secondary{font-size:var(--dynamic-text-size-button-secondary);font-weight:700}.typography--button-tertiary{font-size:var(--dynamic-text-size-button-secondary);font-weight:400}.typography--numbers-big{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-big)}.typography--numbers-medium{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-medium)}.typography--bold{font-weight:700}.typography--medium{font-weight:500}.typography--regular{font-weight:400}.typography--link{color:var(--dynamic-text-link)}.typography--brand-primary{color:var(--dynamic-brand-primary-color)}.typography--primary{color:var(--dynamic-text-primary)}.typography--secondary{color:var(--dynamic-text-secondary)}.typography--tertiary{color:var(--dynamic-text-tertiary)}.typography--uppercase{text-transform:uppercase}.typography--dynamic-error-1{color:var(--dynamic-error-1)}.typography--errror-2{color:var(--dynamic-error-2)}.typography--connection-green-1{color:var(--dynamic-success-1)}.typography--tooltip{color:var(--dynamic-tooltip-text-color)}.typography--inherit{color:inherit}.typography--white{color:#fff}.typography--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.powered-by-dynamic{align-items:center;color:var(--dynamic-text-tertiary);display:flex;text-decoration:none;width:100%}.powered-by-dynamic--center{justify-content:center}.powered-by-dynamic--right{justify-content:end}.powered-by-dynamic__logo,.powered-by-dynamic__text{display:inline-block}.powered-by-dynamic__text{margin-right:.25rem}.powered-by-dynamic__logo{display:inline-block;margin-top:.0625rem;max-width:3.6875rem;width:3.6875rem}.dynamic-footer{background:var(--dynamic-footer-background);padding:var(--dynamic-footer-padding);width:100%}.dynamic-footer:not(.dynamic-footer__top-border){padding-top:0}.dynamic-footer__top-border{border-top:var(--dynamic-footer-border-top)}.user-address,.user-address__container{align-items:center;display:flex;justify-content:center}.user-address__container{margin-top:.375rem}.user-address__status-dot{margin-right:.375rem}.user-address__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.app-origin-tile{align-items:center;display:flex;flex-direction:column;gap:.125rem}.app-origin-tile__title{align-items:center;display:flex;gap:.25rem}.app-origin-tile__logo{height:1rem;width:auto}.options-switcher{background-color:var(--dynamic-base-4);display:flex;min-height:2rem;position:relative}.options-switcher,.options-switcher__active-rail,.options-switcher__button{border-radius:calc(var(--dynamic-border-radius)/3)}.options-switcher__button{color:var(--dynamic-text-secondary);flex:1;font-size:var(--dynamic-text-size-button-secondary);font-weight:500;position:relative}.options-switcher__button--active{color:var(--dynamic-text-primary)}.options-switcher__active-rail{background-color:var(--dynamic-base-2);box-shadow:var(--dynamic-shadow-down-1);height:100%;position:absolute;transition:left .1s ease-in-out}.dynamic-verified-icon{color:var(--dynamic-success-1)}.user-profile-field__value{align-items:center;display:flex;min-height:.9375rem;overflow:auto}.user-profile-field__verify-icon{margin-left:.25rem}.user-profile-section{margin:0 0 .75rem}.user-profile-section__title{margin-bottom:.5rem}.user-profile-section__header{display:flex;flex-direction:row;justify-content:space-between}.user-profile-section__action{display:flex;margin:0 0 .5rem}.user-profile-social-account__connected-avatar{border-radius:100%;height:100%;overflow:hidden;position:relative;width:100%}.user-profile-social-account__connected-provider-icon{background-color:#fff;border-radius:100%;bottom:-.1875rem;height:.875rem;padding:.09375rem;position:absolute;right:-.3125rem;width:.875rem}.user-profile-social-account__image{-o-object-fit:cover;object-fit:cover}.user-profile-social-account{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);width:100%}.user-profile-social-account__icon{flex-shrink:0;height:1.5rem;position:relative;width:1.5rem}.user-profile-social-account__label{flex-grow:1;text-align:left}.user-profile-social-account__button{box-shadow:none;flex-shrink:0;padding:.1875rem .28125rem}.user-profile-social-account__button .button__spinner-container{left:auto}.user-profile__fields{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);padding:.75rem}.user-profile__fields,.user-profile__social-accounts{display:flex;flex-direction:column;gap:.5rem}.divider{align-items:center;display:flex;gap:.75rem;justify-content:space-between;padding:1rem 0}.divider__dash{background:var(--dynamic-base-4);height:.0625rem;width:100%}.divider__text{white-space:nowrap}.divider__full-width{width:100%}.dynamic-tooltip{background-color:var(--dynamic-tooltip-color);border-radius:calc(var(--dynamic-border-radius)/4);opacity:0;padding:.125rem .5rem;pointer-events:none;position:absolute;transform:translate(-50%,-100%);transform-origin:50% 50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;z-index:-1}.dynamic-tooltip__arrow{bottom:-.1875rem;color:var(--dynamic-tooltip-color);height:.25rem;left:50%;position:absolute;transform:translateX(-50%);width:.375rem}.dynamic-tooltip--visible{opacity:1;pointer-events:unset;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;z-index:1}.modal-header-banner{padding:.5rem .75rem;text-align:center}.modal-header-banner__error{background-color:var(--dynamic-error-2)}.modal-header-banner__success{background-color:var(--dynamic-success-2)}.modal-header-banner__notice{background-color:var(--dynamic-brand-secondary-color)}.otp-verification-view{align-items:center;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding);text-align:center}.otp-verification-view__icon-with-spinner{margin:0 auto .75rem}.otp-verification-view--message{padding:var(--dynamic-layout-content-error-padding)}.otp-verification-view__status-header{align-items:center;display:flex;justify-content:center}.otp-verification-view__footer{display:flex;flex-direction:column;gap:1rem}.otp-verification-view__destination-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.otp-verification-view__retry-container{margin:1rem auto 0}.overlay-card{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0}.overlay-card--disabled{pointer-events:none}.overlay-card__animation{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0;top:0}.overlay-card__animation--limit-height{height:80%;max-height:80%;top:unset}.overlay-card__overlay{background-color:var(--dynamic-overlay);bottom:0;left:0;position:absolute;right:0;top:0}.overlay-card__content{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/1.5);border-top:.0625rem solid var(--dynamic-base-4);bottom:0;display:flex;flex-direction:column;left:0;max-height:100%;overflow-y:auto;position:absolute;right:0}@media (pointer:coarse){.overlay-card__content{border-bottom-left-radius:0;border-bottom-right-radius:0}}.overlay-card-target{bottom:0;height:100%;left:0;max-height:100%;overflow:auto;position:absolute;right:0}.icon-list-tile{padding-left:0;padding-right:0}.icon-list-tile--children{align-items:center;display:flex;justify-content:center}.popper-content{display:flex;position:absolute;z-index:100}.popper-content__transform-origin-bottom-left{transform:translateY(-100%)}.popper-content__transform-origin-bottom-right{transform:translate(-100%,-100%)}.popper-content__transform-origin-top-left{transform:translate(0)}.popper-content__transform-origin-top-right{transform:translate(-100%)}.dropdown{align-items:stretch;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);display:flex;flex-direction:column;max-height:var(--max-height);min-width:10rem;overflow-y:auto;padding-block:.1875rem}.dropdown--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}.dropdown--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}.menu-list__overlay-card__container{align-items:stretch;display:flex;flex-direction:column;overflow-y:auto;padding-bottom:1.25rem}.transaction-confirmation.dynamic-tooltip{color:var(--dynamic-base-1)}.transaction-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-top:.5rem;width:100%}.transaction-confirmation__actions .button--brand-primary .icon--color-text-secondary,.transaction-confirmation__actions .button--brand-primary .typography--primary{color:#fff}.transaction-confirmation__footer{padding-top:1rem}.transaction-confirmation__body{align-items:stretch;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:0 1.5rem 1.5rem}.transaction-confirmation__app-origin-tile{padding:.75rem}.transaction-confirmation__content{display:flex;flex:1;flex-direction:column;justify-content:flex-start;margin-top:.25rem;overflow:auto;width:100%}.transaction-confirmation__rows{max-height:14.375rem;padding:.5rem .75rem;width:100%}.transaction-confirmation__rows .flex{display:flex;justify-content:space-between}.transaction-confirmation__rows .flex-row{flex-direction:row;gap:.5rem}.transaction-confirmation__rows .row{padding:.5rem 0}.transaction-confirmation__rows .gap{gap:.3rem}.transaction-confirmation__secure-wallet{margin-bottom:0;margin-top:1rem}.transaction-confirmation__info{text-align:right}.transaction-confirmation__error{padding-top:.75rem}.transaction-confirmation__warning{padding-top:.5rem}.transaction-card{background-color:var(--dynamic-base-2);border-radius:.5rem;display:flex;flex-direction:column;padding:1rem 1rem .2rem}.transaction-card__icon{display:flex;gap:.5rem}.transaction-card__icon p{padding-top:.125rem}.transaction-card__icon__container{position:relative}.transaction-card__icon__container__network{align-items:center;background-color:var(--dynamic-base-1);border:1px solid var(--dynamic-base-1);border-radius:100%;bottom:-5px;display:flex;height:1rem;justify-content:center;position:absolute;right:-5px;width:1rem}.transaction-card__total p .typography{gap:.3rem}.transaction-card__info{display:flex;flex-direction:row;gap:.225rem;justify-content:end}.transaction-card__header{align-items:center;display:flex;justify-content:space-between}.transaction-card__header__info{align-items:flex-end;display:flex;flex-direction:column}.transaction-card__arrow{color:var(--dynamic-text-secondary);font-size:1.25rem;margin-left:.5rem}.transaction-card__destination{align-items:center;display:flex;gap:.5rem;margin-bottom:.75rem;margin-top:.25rem}.transaction-card .row{border-top:1px solid var(--dynamic-base-3);display:flex;justify-content:space-between;padding:.6rem 0}.transaction-card .flex-row{display:flex;flex-direction:row;gap:.1rem}.transaction-card .gap-native{gap:.3rem}.transaction-status-layout{display:flex;flex:1;flex-direction:column;overflow:hidden}.transaction-status-layout .modal-header{padding:3rem .3125rem .625rem}.transaction-status-layout__status-icon{color:var(--dynamic-brand-primary-color);height:4rem;width:4rem}.transaction-status-layout__title{text-align:center}.transaction-status-layout__body{align-items:stretch;display:flex;flex:1;flex-direction:column;padding:.25rem 1.5rem 1.5rem}.transaction-status-layout__sent_to{text-align:center}.transaction-status-layout__sent_to p{display:inline}.transaction-status-layout__content{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-top:.375rem;width:100%}.transaction-status-layout__rows{max-height:14.375rem;overflow-y:auto;padding:.375rem .75rem;width:100%}.transaction-status-layout__rows p{font-size:1.5rem}.transaction-status-layout__rows>.transaction-row:not(:first-child){border-top:1px solid var(--dynamic-base-4)}.transaction-status-layout__actions{margin-top:auto;padding-top:1rem}.transaction-status-layout__actions .button--brand-primary .typography--primary{color:var(--dynamic-base-2)}.transaction-status-layout__footer{padding-top:1rem}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__wallet-icon{display:inline-block}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__text,.transaction-origin-destination__wallet-icon{vertical-align:middle}.transaction-origin-destination__wallet-icon{height:1rem;margin-right:.375rem;width:1rem}.transaction-origin-destination__arrow-icon{color:var(--dynamic-text-tertiary);margin:0 .5625rem}.tokens-balance-dropdown{background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-button-border-radius)/1);cursor:pointer;padding:.875rem .75rem}.tokens-balance-dropdown,.tokens-balance-dropdown__selected{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.tokens-balance-dropdown__selected .evm-network-control__arrow-icon{position:absolute;right:2.625rem}.tokens-balance-dropdown__menu_list{border-radius:calc(var(--dynamic-button-border-radius)/1);padding:.5rem 1rem;width:19.375rem}@media (max-width:640px){.tokens-balance-dropdown__menu_list{margin:0 auto;width:100%}.tokens-balance-dropdown__menu_list .modal-header{padding:1rem 0 1rem 1.25rem}}.tokens-balance-dropdown__menu_list .modal-header__leading,.tokens-balance-dropdown__menu_list .modal-header__trailing{flex:none}.tokens-balance-dropdown__menu_list_item{align-items:center;display:flex;gap:.625rem;justify-content:space-between;padding:.5rem 0;text-align:left}.tokens-balance-dropdown__menu_list_item__name{display:flex;gap:.3125rem;min-width:9.375rem}.tokens-balance-dropdown__menu_list_item__balance{display:flex;gap:.3125rem}.tokens-balance-dropdown__chain{align-items:center;display:flex;gap:.375rem}.tokens-balance-dropdown__chain__icon{height:1rem;width:1rem}.tokens-balance-dropdown__balance-container{align-items:center;display:flex;gap:.25rem}.tokens-balance-dropdown__balance{align-items:center;display:flex;gap:.125rem}.send-balance-page-layout__header-content{align-items:center;display:flex;gap:.5rem}.send-balance-page-layout__body{display:flex;flex:1;flex-direction:column;overflow:auto;padding:.25rem 1.5rem 1.5rem}.send-balance-page-layout__balance-container{display:flex;flex-direction:column;gap:.5rem;padding-bottom:.5rem}.send-balance-page-layout__error{padding-bottom:1rem}.send-balance-page-layout__footer{padding-top:1.5rem}.send-balance-page-layout__network-container{display:flex;justify-content:center;padding-bottom:.5rem}.send-balance-form{display:flex;flex:1;flex-direction:column;gap:.5rem}.send-balance-form__button{margin-top:auto}.send-balance-form__secure-wallet{margin:0}.send-balance-form__field.fiat{padding-left:1.5625rem}.send-balance-form__amount-container{position:relative}.send-balance-form__amount-container__fiat_sign{left:.625rem;position:absolute;top:.6875rem}.send-balance-form__amount-container__double_arrow{position:absolute;right:.625rem;top:.875rem}.send-balance-form__amount-container__balance{display:flex;gap:.25rem;position:absolute;right:.75rem;top:1.4375rem}.send-balance-form__amount-container__field.input{padding-left:3.125rem;transition:none}.send-balance-form__amount-container__floating_value{color:#000;font-size:1rem;left:10px;pointer-events:none;position:absolute;top:1.1875rem;white-space:nowrap}.send-balance-form__amount_available{border-bottom:1px solid var(--dynamic-base-3);padding-bottom:.75rem}.send-balance-form .input__container--regular .input__label:after{content:"";height:0}.select-network-button__icon{display:inline;margin:0 6px 3px;max-height:16px;max-width:16px;vertical-align:middle}.chip{align-items:center;background:var(--dynamic-base-2);border-radius:.75rem;color:var(--dynamic-text-primary);display:inline-flex;gap:.1875rem;height:1.5rem;justify-content:center;padding:.125rem .25rem}.chip__with-icon{padding:.125rem .25rem .125rem .125rem}.chip--icon{border-radius:50%;height:1.25rem;justify-content:center;overflow:hidden;width:1.25rem}.chip--icon,.form-field-label{align-items:center;display:flex}.form-field-label{color:var(--dynamic-text-secondary);cursor:text;font-size:.75rem}.form-field-label__with-divider:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.step{counter-increment:step;gap:.5rem}.step,.step__icon{align-items:center;display:flex}.step__icon{flex-shrink:0;height:1.25rem;justify-content:center;width:1.25rem}.step__icon--done{background-color:var(--dynamic-success-1);border-radius:50%}.step__icon__check-mark{color:var(--dynamic-base-1);height:1rem;width:1rem}.step__index{align-items:center;border:1px solid var(--dynamic-base-4);border-radius:.625rem;display:flex;height:1.25rem;justify-content:center;min-width:1.25rem;padding:0 .25rem}.step__index-label:before{content:counter(step)}.step__leading{max-width:-moz-fit-content;max-width:fit-content;position:relative}.stepper{counter-reset:step;display:flex;gap:1rem;width:100%}.stepper__divider{flex-grow:1}.modal{left:50%;margin:auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:var(--dynamic-modal-width)}@media (max-width:640px){.modal{bottom:0;max-width:37.5rem;top:auto;transform:translate(-50%);width:100%}}.modal__items{display:flex;flex-direction:column;gap:.75rem}.modal-card{background:var(--dynamic-base-1);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);overflow:hidden;width:100%}.modal-card--radius-small{border-radius:calc(var(--dynamic-border-radius)*.75)}.modal-card--with-border{border:1px solid var(--dynamic-base-4)}@media (max-width:640px){.modal-card{bottom:0;max-width:37.5rem;top:auto;transform:translateY(0);width:100%}.modal-card--sharp-mobile-bottom-radius:last-child{border-radius:var(--dynamic-border-radius) var(--dynamic-border-radius) 0 0}}.inline-widget-button{align-items:center;background-color:var(--dynamic-base-1);display:flex;gap:.5rem;min-height:100%;padding:.5rem .75rem;width:-moz-fit-content;width:fit-content}.inline-widget-button:hover{background-color:var(--dynamic-hover)}.inline-widget-button__icon{height:1.25rem;width:1.25rem}.inline-widget-button__vertical-divider{background-color:var(--dynamic-base-3);content:"";height:1rem;width:.0625rem}.inline-widget{align-items:center;background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;justify-content:center;overflow:hidden;width:-moz-fit-content;width:fit-content}.inline-widget>*{border-right:1px solid var(--dynamic-base-3)}.inline-widget>:last-child{border-right:none}.wallet-information-card{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.wallet-information-card__header{border-bottom:1px solid var(--dynamic-base-3);display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.wallet-information-card__details-container{align-items:center;display:flex;gap:.75rem;justify-content:space-between;min-width:0}.wallet-information-card__menu{flex-shrink:0}.wallet-information-card__icon{height:1.75rem;width:1.75rem}.wallet-information-card__details{display:flex;flex-direction:column;overflow:hidden}.wallet-information-card__balance-container{align-items:center;display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.social-sign-in{display:flex;flex-wrap:wrap;gap:.375rem;justify-content:space-between}.social-sign-in--tile{flex:1;height:2.5rem}.social-sign-in--tile__full-width{flex:1 0 100%}.social-sign-in--card{display:flex;flex-direction:column;min-height:11.5625rem}.social-sign-in--card--body{display:grid;gap:.375rem;grid-template-columns:auto auto auto auto;padding:.25rem 1.5rem 1.5rem}.social-sign-in--card--tile{height:2.5rem}.sign-typed-data-preview--attribute-row{display:flex;gap:.5rem}.sign-typed-data-preview--fields-list,.sign-typed-data-preview--type-container{display:flex;flex-direction:column;gap:.25rem}.sign-typed-data-preview--type-container{padding-left:1rem}.need-help-section{align-items:center;display:flex;flex-direction:column;gap:.125rem;margin-bottom:.5rem}.need-help-section__links{display:flex;gap:.5rem}.need-help-section__links>*+*{padding-left:.5rem;position:relative}.need-help-section__links>*+:after{border-left:1px solid var(--dynamic-text-secondary);bottom:15%;content:"";left:0;position:absolute;top:15%;width:50%}.need-help-section__helper-link{color:var(--dynamic-text-link)}.textarea__container{position:relative}.textarea__container .textarea__suffix{position:absolute;right:1rem;top:1rem}.textarea__container .textarea{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;resize:none;transition:all .2s ease;width:100%}.textarea__container .textarea:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.textarea__container .textarea:disabled .textarea__label{color:var(--dynamic-text-tertiary)}.textarea__container .textarea__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem}.textarea__container .textarea:not(.textarea__error):focus,.textarea__container .textarea:not(.textarea__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.textarea__container .textarea__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.textarea__container .textarea__error~.textarea__label,.textarea__container .textarea__error~.textarea__trailing{color:var(--dynamic-error-1)}.textarea__container .textarea__valid{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1)}.textarea__container .textarea__valid~.textarea__label,.textarea__container .textarea__valid~.textarea__trailing{color:var(--dynamic-success-1)}.textarea__container .textarea__has_trailing{padding-right:4rem}.textarea__container .textarea__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.textarea__container--dense .textarea{padding:1.125rem .75rem .375rem}.textarea__container--dense .textarea::-moz-placeholder{color:transparent}.textarea__container--dense .textarea::placeholder{color:transparent}.textarea__container--dense .textarea__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textarea__container--dense .textarea:-moz-placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:focus~.textarea__label{font-size:.625rem;top:.4375rem}.textarea__container--regular{display:flex;flex-direction:column}.textarea__container--regular .textarea{padding:.75rem}.textarea__container--regular .textarea__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.textarea__container--regular .textarea__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.textarea__container--regular .textarea__suffix{top:2.375rem}.textarea__message{color:var(--dynamic-text-primary);padding:.5rem 0}.textarea__message__error{color:var(--dynamic-error-1)}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover,select:-webkit-autofill,select:-webkit-autofill:focus,select:-webkit-autofill:hover,textarea:-webkit-autofill,textarea:-webkit-autofill:focus,textarea:-webkit-autofill:hover{-webkit-text-fill-color:var(--dynamic-text-primary)!important;background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary)!important;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s}.secure-embedded-wallet-card{background:var(--dynamic-brand-secondary-color);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:.75rem;transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.secure-embedded-wallet-card__text-content{align-items:flex-start;cursor:pointer;display:flex;flex-direction:column;flex-grow:1;padding:0;text-align:left}.secure-embedded-wallet-card__text-content,.secure-embedded-wallet-card__text-content:hover{background-color:transparent;box-shadow:none}.secure-embedded-wallet-card__link{line-height:20px;text-decoration:underline}.toggle{-webkit-tap-highlight-color:transparent;cursor:pointer;display:inline-block}.toggle--input{display:none}.toggle--input:checked+.toggle--content__variant-primary{background-color:var(--dynamic-brand-primary-color);color:var(--dynamic-brand-primary-color)}.toggle--input:checked+.toggle--content .toggle--knob{left:1.09375rem}.toggle--input:checked+.toggle--content .toggle--knob>*{opacity:1}.toggle--content{background-color:var(--dynamic-base-3);border-radius:.625rem;height:1.25rem;position:relative;transition:background-color .2s ease;width:2.25rem}.toggle--knob{align-items:center;background-color:#fff;border-radius:100%;display:flex;height:1.0625rem;justify-content:center;left:.09375rem;position:absolute;top:.09375rem;transition:left .2s ease;width:1.0625rem}.toggle--knob>*{opacity:0;transition:opacity .2s ease}.list-tile-animated-trailing{position:relative}.list-tile-animated-trailing__child{position:absolute;right:0;transform:translateY(-50%);transition-duration:.2s;transition-property:opacity,transform;transition-timing-function:ease-in}.list-tile-animated-trailing__hover-element{opacity:0;position:absolute;right:0;transform:translate(-.625rem,-50%);transition-duration:.3s}.list-tile:hover .list-tile-animated-trailing__hover-element{opacity:1;transform:translateY(-50%)}.list-tile:hover .list-tile-animated-trailing__child{opacity:0;transform:translate(-.625rem,-50%)}.wallet-group-view-layout__container{padding:var(--dynamic-layout-content-padding)}.wallet-group-view-layout__icon{height:4rem;margin:0 auto .75rem;width:4rem}.wallet-group-view-layout__list{display:flex;flex-direction:column;gap:.5rem}.wallet-group-view-layout__title{padding-bottom:1rem;text-align:center}.retry-send-verification-code-section{align-items:center;display:flex;flex-direction:column}.retry-send-verification-code-section__confirmation{color:var(--dynamic-success-1);display:flex;gap:.3125rem;padding:.125rem .375rem}.toggle-visibility-button__container{position:relative}.toggle-visibility-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.qrcode{--background:var(--dynamic-base-1);color:var(--dynamic-text-primary);position:relative}.qrcode__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;height:18.125rem;justify-content:center;margin:auto;width:18.125rem}.qrcode__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.qrcode-container__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.qrcode-container__container--message{padding:var(--dynamic-layout-content-error-padding)}.qrcode-container__container .button__content{display:flex;gap:.375rem}.qrcode-container__top{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin-bottom:1.25rem;padding:.75rem}.qrcode-container__top .button-container{align-items:center;display:flex;gap:.5rem;width:100%}.qrcode-container__top .button-container svg path{fill-opacity:100%}.qrcode-container__top .button-container .qr-code-button{height:2.375rem}.qrcode-container__content{max-width:20rem;text-align:center}.qrcode-container__tos{margin-top:1rem;max-width:17.5rem;text-align:center}.qrcode-container__tos .tos__link{color:var(--dynamic-text-link)}.qrcode-container__tos .tos__link:hover{text-decoration:underline}.qr-code-wrapper__scan-issue-message{align-items:center;background:var(--dynamic-base-2);border-bottom:var(--dynamic-button-primary-border);border-radius:0;border-top:var(--dynamic-button-primary-border);color:var(--dynamic-text-primary);display:flex;justify-content:center;padding:.5rem .75rem;text-align:center;width:100%}.qr-code-wrapper__scan-issue-button{color:var(--dynamic-text-link);font-size:.75rem;text-decoration:underline}.radio-button{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.5rem;padding:.75rem;width:100%}.radio-button input{height:1.5rem;width:1.5rem}.mfa-device-skeleton{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.mfa-device-skeleton__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.phantom-ledger-icon{position:absolute}.phantom-ledger-icon__container{align-items:center;display:flex;height:100%;position:relative}.account-exists__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.account-exists__main{padding:var(--dynamic-modal-padding)}.account-exists__social-icon{margin:auto}.account-exists__image{padding:.3125rem;width:4.375rem}.account-exists__content{text-align:center}.account-exists__content--primary{margin-bottom:.375rem}.account-exists__content--secondary{margin-bottom:1rem}.account-exists__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.user-data-form__form{display:flex;flex-direction:column}.user-data-form__error{margin-bottom:.625rem}.user-field__checkbox-container{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column;padding:.625rem}.user-field__checkbox-container--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.user-field__consent-checkbox{display:flex;margin-bottom:.5rem}.user-field__consent-checkbox a{color:var(--dynamic-text-link)}.user-field__consent-checkbox:last-child{margin-bottom:0}.user-field__checkbox-label{padding-left:.75rem}.user-field__error-message{color:var(--dynamic-error-1);padding:.25rem}.user-phone-field__optional-label{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;pointer-events:none;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.user-data-fields__fields-column{display:flex;flex-direction:column;gap:.375rem;margin-bottom:.5rem;max-height:11.25rem;overflow:auto}.user-data-fields__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.collect-user-data::-webkit-scrollbar,.collect-user-data::-webkit-scrollbar-thumb,.collect-user-data::-webkit-scrollbar-track{display:none}.collect-user-data__main-img{width:100%}.collect-user-data__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data__form--error{padding:var(--dynamic-layout-content-error-padding)}.collect-user-data__img-container{align-items:center;display:flex;justify-content:center}.collect-user-data__img{height:1.75rem;width:1.75rem}.collect-user-data__img--rounded{border-radius:9999px}.collect-user-data__wallet-address{margin-left:.5rem}.collect-user-data__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data__success-icon svg{height:4rem;width:4rem}.collect-user-data__welcome-container{margin:1rem 0;text-align:center}.collect-user-data__welcome-title{margin-bottom:.25rem}.collect-user-data__log-out{margin:.75rem auto 0}.collect-user-data__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.collect-user-data__network-picker{margin:auto 0;max-width:-moz-fit-content;max-width:fit-content}.collect-user-data__network-picker-button{border:1px solid var(--dynamic-base-4);position:static;transform:translateX(0)}.collect-user-data__network-picker-button:hover{background:var(--dynamic-hover)}.collect-user-data__network-container{border:var(--dynamic-header-border-bottom);display:flex;justify-content:space-between;padding:var(--dynamic-header-padding);position:relative}.collect-user-data-login-no-wallet::-webkit-scrollbar,.collect-user-data-login-no-wallet::-webkit-scrollbar-thumb,.collect-user-data-login-no-wallet::-webkit-scrollbar-track{display:none}.collect-user-data-login-no-wallet__main-img{width:100%}.collect-user-data-login-no-wallet__user-info-container{align-items:center;border:var(--dynamic-header-border-bottom);display:flex;justify-content:center;padding:var(--dynamic-header-padding)}.collect-user-data-login-no-wallet__user-identification{margin-left:.5rem}.collect-user-data-login-no-wallet__icon-container{height:1.5rem;width:1.5rem}.collect-user-data-login-no-wallet__icon-container .user-profile-social-account__connected-avatar{margin-top:.125rem}.collect-user-data-login-no-wallet__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data-login-no-wallet__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data-login-no-wallet__success-icon svg{height:4rem;width:4rem}.collect-user-data-login-no-wallet__welcome-container{margin:1rem 0;text-align:center}.collect-user-data-login-no-wallet__welcome-title{margin-bottom:.375rem}.collect-user-data-login-no-wallet__log-out{margin:.75rem auto 0}.email-verification__retry-container{margin:1rem auto 0}.email-verification__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.email-verification__container--error{padding:var(--dynamic-layout-content-error-padding)}.email-verification__icon-with-spinner{margin:0 auto .75rem}.email-verification__error-message{margin:0}.email-verification__error-message,.email-verification__transfer-message{align-items:center;border-radius:0;display:flex;justify-content:center;width:100%}.email-verification__transfer-message{background:var(--dynamic-success-2);color:var(--dynamic-success-1);margin-bottom:.5rem;padding:.5rem .75rem;text-align:center}.email-verification__icon--verified{margin:0 auto 1rem}.email-verification__title{margin-top:.5rem;text-align:center}.email-verification__retry-copy{margin-top:1rem}.email-verification__copy-text-container{margin:0;text-align:center}.email-verification__text-button{color:var(--dynamic-text-link)}.email-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.email-verification__log-out{margin:.75rem auto 0}.no-qr-code-installed__container{align-items:center;color:var(--dynamic-text-primary);flex-direction:column;margin:-2.25rem 0 0;padding:var(--dynamic-modal-padding);padding-top:0;width:100%}.no-qr-code-installed__container:first-child,.no-qr-code-installed__container:last-child{margin-right:0}.no-qr-code-installed__img{display:flex;height:auto;justify-content:center;margin:auto;text-align:center}.no-qr-code-installed__typography{text-align:center}.no-qr-code-installed__typography--title{margin:1rem 0 .375rem;text-align:center}.no-qr-code-installed__links-section{flex-direction:column;margin:1rem 0}.wallet-help-link__anchor{align-items:center;background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);display:flex;gap:.625rem;margin-bottom:.5rem;padding:.75rem;position:relative;width:100%}.pending-connect__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-connect__copy-text{color:var(--dynamic-text-secondary);max-width:20rem;text-align:center}.pending-connect__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-signature__container .pending-signature__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container .pending-signature__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;max-width:20rem;text-align:center}.pending-signature__container .pending-signature__copy--mini{line-height:1rem;margin-top:.25rem}.pending-signature__container .pending-signature__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-wrong-account-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.social-wrong-account-view__container .social-wrong-account-view__title{color:var(--dynamic-text-primary);line-height:1.5rem}.social-wrong-account-view__container .social-wrong-account-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-top:.375rem;max-width:20rem;text-align:center}.social-wrong-account-view__container .social-wrong-account-view__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.social-redirect-view__container .social-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.social-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.sms-verification__text-button{color:var(--dynamic-text-link)}.sms-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.sms-verification__log-out{margin:.75rem auto 0}.search-instead__container{font-size:.75rem;line-height:1rem;margin-top:2.5rem;padding-bottom:1rem;text-align:center;transition-duration:.3s;transition-property:background-color,border-color,color,fill,stroke;width:100%}.search-instead__container__image{display:flex;justify-content:center;margin:.5rem auto}.wallet-list-item__tile{border-radius:var(--dynamic-wallet-list-tile-border-radius)}.wallet-list-grid-tabs{border-bottom:1px solid var(--dynamic-base-4);border-top:1px solid var(--dynamic-base-4);display:flex;width:100%}.wallet-list-grid-tabs__button{align-items:center;border-left:1px solid var(--dynamic-base-4);display:flex;flex-basis:50%;gap:.25rem;justify-content:center;outline:none;padding:.5rem .625rem}.wallet-list-grid-tabs__button:first-child{border-left:none}.wallet-list-grid-tabs__button--selected{background-color:var(--dynamic-wallet-list-tile-background)}.wallet-list-grid-tabs__button--text{flex-basis:100%}.wallet-list-grid-tabs__icon--selected{filter:grayscale(100%)}.wallet-list__error-container{margin:0}.wallet-list__search-container{padding:var(--dynamic-search-padding)}.wallet-list__tabs-container{margin-bottom:.5rem}.wallet-list__scroll-container{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow:auto;padding:var(--dynamic-initial-view-content-padding)}.wallet-list__scroll-container--error{padding:var(--dynamic-layout-content-error-padding)}.wallet-list__scroll-container::-webkit-scrollbar,.wallet-list__scroll-container::-webkit-scrollbar-track{display:none}.wallet-list__scroll-container::-webkit-scrollbar-thumb{display:none}.wallet-list__scroll-container:empty{display:flex}.wallet-list__scroll-container--fixed-height{height:var(--dynamic-wallet-list-max-height)}.wallet-list__search-skeleton{height:2.625rem}.wallet-list__search-skeleton,.wallet-list__tile-skeleton{border-radius:calc(var(--dynamic-border-radius)/2);margin-bottom:.5rem}.wallet-list__tile-skeleton{height:3rem;padding:.75rem}.wallet-list__tiny-footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible}.wallet-list__tiny-footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-no-access__container{background:var(--dynamic-base-1)}.wallet-no-access__main{padding:var(--dynamic-modal-padding)}.wallet-no-access__social-info-container{align-items:center;display:flex;justify-content:center;margin-top:1.5rem}.wallet-no-access__waitlist-link{align-items:center;display:flex;gap:8px;justify-content:center}.wallet-no-access__social-icon{margin:auto}.wallet-no-access__image{width:100%}.wallet-no-access__user-info-container{align-items:center;display:flex;flex-direction:column;margin-bottom:1rem}.wallet-no-access__content{text-align:center}.wallet-no-access__content--primary{margin-bottom:.375rem}.wallet-no-access__content--secondary{margin-bottom:1rem}.wallet-no-access__wallet-address{margin-left:.375rem}.wallet-no-access__wallet-address-container{align-items:center;display:flex;justify-content:center}.wallet-no-access__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.wallet-no-access__icon--verified{margin:0 auto 1rem}.wallet-sign-spinner__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.wallet-sign-spinner__copy{color:var(--dynamic-text-secondary);margin:0;text-align:center}.wallet-sign-spinner__button{box-shadow:var(--dynamic-shadow-down-1);margin:.75rem 0 0}.wallet-used-view__container{padding:var(--dynamic-layout-content-padding);text-align:center}.wallet-used-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-used-view__icon svg{margin:0 auto}.wallet-used-view__shorten-wallet-address{margin:0 0 1rem}.wallet-used-view__copy{margin:0 0 .75rem}.wallet-used-view__accept-button,.wallet-used-view__footer{margin:0 0 .5rem}.wallet-used-view__logout{background:none;border:none;box-shadow:none;margin:auto}.wallet-used-view__checkbox-label{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);cursor:pointer;display:flex;gap:.5rem;justify-content:center;margin:1rem auto .5rem;padding:.75rem;text-align:left}.wallet-used-view__checkbox-container{flex-shrink:0}.network-not-supported__content-container{padding:var(--dynamic-layout-content-padding)}.network-not-supported__content-container--error{padding:var(--dynamic-layout-content-error-padding)}.network-not-supported__main-img{width:100%}.network-not-supported__img-container{align-items:center;display:flex;justify-content:center}.network-not-supported__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported__welcome-container{margin:1rem 0;text-align:center}.network-not-supported__welcome-title{margin-bottom:.375rem}.network-not-supported__continue{margin-top:1rem}.network-not-supported__log-out{margin:.75rem auto 0}.network-not-supported__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.network-not-supported__network-container{margin-top:.5rem;position:relative}.network-not-supported__network-picker{margin:auto;max-width:-moz-fit-content;max-width:fit-content}.network-not-supported__network-picker-button{position:static;transform:translateX(0)}.email-confirmation-waiting-view{align-items:center;display:flex;flex-direction:column;padding-bottom:1.625rem;text-align:center}.email-confirmation-waiting-view__title{padding-bottom:.375rem}.email-confirmation-waiting-view__email-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.email-confirmation-waiting-view__edit-icon-button{display:inline-flex}.email-confirmation-waiting-view__header-icon{display:flex;justify-content:center;margin-top:-2rem}.email-confirmation-waiting-view__note{max-width:16.25rem;padding-top:1rem;text-align:center}.email-confirmation-waiting-view__powered_by_dynamic_footer{padding-top:1rem;width:100%}.login-with-email-form{display:flex;flex-direction:column;gap:.375rem}.login-with-email-form .input__suffix{top:.6875rem}.login-with-email-form .input__suffix .icon-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.login-with-email-form .input__suffix .icon-button path,.login-with-email-form .input__suffix .icon-button rect{transition:all .2s}.login-with-email-form .input__suffix .icon-button--active,.login-with-email-form .input__suffix .icon-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.login-with-email-form .input__suffix .icon-button--has-content,.login-with-email-form .input__suffix .icon-button--has-content:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.list-item-button{background:none;box-shadow:none}.list-item-button__trailing{position:relative}.list-item-button__trailing-child{position:absolute;right:0;transition-property:opacity,transform;transition-timing-function:ease-in}.list-item-button__trailing-label{transform:translateY(-50%);transition-duration:.2s}.list-item-button__trailing-icon{transition-duration:.3s}.list-item-button:hover .list-item-button__trailing-label,.list-item-button__trailing-icon{opacity:0;transform:translate(-.625rem,-50%)}.list-item-button:hover .list-item-button__trailing-icon{opacity:1;transform:translateY(-50%)}.login-with-email-wallet-list__skeleton{border-radius:calc(var(--dynamic-border-radius)/2);height:2.625rem;margin-bottom:.5rem}.login-with-email-wallet-list__container{display:flex;flex-direction:column;gap:.375rem}.connect-with-wallet-button{height:2.5rem}.toggleable-section{align-items:stretch;display:flex;flex-direction:column;gap:.75rem}.toggleable-section__toggle-prompt{align-items:center;display:flex;justify-content:space-between}.toggleable-section__toggle-prompt__button{cursor:pointer;margin:-.75rem 0 0 -.75rem;outline:none;padding:.75rem 0 0 .75rem}.toggleable-section__toggle-prompt__button__text{outline:none;transition:all .2s}.toggleable-section__toggle-prompt__button:focus .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:focus-visible .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:hover .toggleable-section__toggle-prompt__button__text{background-color:var(--dynamic-brand-secondary-color)}.login-with-phone-number-form{display:flex;flex-direction:column;gap:.375rem}.login-with-phone-number-form__fields{align-items:stretch;display:flex;position:relative;width:100%}.login-with-phone-number-form__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.login-with-phone-number-form__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.login-with-phone-number-form__fields__country-code__flag{margin-right:.5rem}.login-with-phone-number-form__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.login-with-phone-number-form__fields__country-code__container .login-with-phone-number-form__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.login-with-phone-number-form__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.login-with-phone-number-form__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.login-with-phone-number-form__fields__phone-number .login-with-phone-number-form__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.login-with-phone-number-form__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.login-with-phone-number-form__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.login-with-phone-number-form__dropdown__items{display:flex;flex-direction:column}.login-with-phone-number-form__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.login-with-phone-number-form__dropdown__items__country__flag{width:1.5rem}.login-with-phone-number-form__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.login-with-phone-number-form__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.login-with-phone-number-form__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.login-with-phone-number-form input::-webkit-inner-spin-button,.login-with-phone-number-form input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.login-with-phone-number-form input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.login-view__text{padding:.5rem 0}.login-view__error-container{margin:0}.login-view__container{padding:var(--dynamic-initial-view-content-padding)}.login-view__container--error{padding:var(--dynamic-layout-content-error-padding)}@media (pointer:coarse){.login-view__container{padding:.75rem}}.login-view__scroll{align-items:stretch;gap:.375rem;height:100%;max-height:36.25rem;overflow:auto}.login-view__scroll,.login-view__scroll__section{display:flex;flex-direction:column}.login-view__scroll__section--emailAndPhone+.login-view__scroll__section--social{margin-top:1rem}.login-view__scroll::-webkit-scrollbar,.login-view__scroll::-webkit-scrollbar-track{display:none}.login-view__scroll::-webkit-scrollbar-thumb{display:none}.login-view__scroll:empty{display:flex}.login-view__scroll--full-height{height:100vh}.login-view__scroll--email-first{flex-direction:column-reverse}.login-view__scroll__web2{display:flex;flex-direction:column;gap:.75rem}.mobile-wallet-redirect{align-items:stretch;display:flex;flex-direction:column;gap:1.5rem;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mobile-wallet-redirect__icon-with-spinner{align-self:center}.mobile-wallet-redirect__copy-text{align-self:center;max-width:20rem;text-align:center}.mobile-wallet-redirect__alert{text-align:center}.mobile-wallet-redirect__wallet-app{align-items:center;background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex-wrap:wrap;gap:.875rem;justify-content:space-between;padding:.625rem .75rem}.mobile-wallet-redirect__wallet-app__group{align-items:center;display:flex;gap:.5rem}.mobile-wallet-redirect__wallet-app__group__app-store{text-align:right}.captcha-verify-user__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 1.5rem 1.5rem;text-align:center}.captcha-verify-user__icon{height:4rem;margin-bottom:1rem;width:4rem}.captcha-verify-user__title{margin-bottom:.375rem}.captcha-verify-user__subtitle{margin-bottom:1rem}.captcha-verify-user__dynamic-logo{margin-top:1rem}.network-not-supported-switch-manual{margin-top:-1.5rem;padding:0 1.5rem 1.5rem}.network-not-supported-switch-manual__img-container{align-items:center;display:flex;justify-content:center;margin-bottom:1rem}.network-not-supported-switch-manual__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported-switch-manual__network-container{position:relative}.network-not-supported-switch-manual__content{text-align:center}.network-not-supported-switch-manual__title{margin:0 0 .375rem}.wallet-group__list{display:flex;flex-direction:column}.wallet-locked-view__error-container{align-items:center;display:flex;justify-content:center}.wallet-locked-view__button-header{margin:.75rem}.wallet-locked-view__button{margin:.75rem auto auto}.wallet-locked-view__icon{margin:auto}.wallet-locked-view__content{padding:0 var(--dynamic-modal-padding) 2.1875rem;text-align:center}@media (pointer:coarse){.wallet-locked-view__content{padding:0 .75rem}}.wallet-locked-view__title{margin-top:.75rem}.wallet-locked-view__log-out{margin:.75rem auto 0}.merge-user-accounts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts__container{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__container{display:flex;flex-direction:column}@media (pointer:coarse){.merge-user-accounts-conflicts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__description{padding:0 1.5rem .75rem}.merge-user-accounts-conflicts__fields{display:flex;flex-direction:column;gap:1rem;max-height:22.5rem;overflow-y:auto;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__fields__item{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-conflicts__fields__item__button{padding:.5rem .75rem}.merge-user-accounts-conflicts__buttons{background:var(--dynamic-base-1);box-shadow:0 -8px 48px -8px rgba(109,121,165,.16);display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1.5rem}.merge-user-accounts-with-same-email__container{padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts-with-same-email__container{padding:0 .75rem}}.merge-user-accounts-with-same-email__accounts{align-items:center;display:flex;justify-content:space-between;margin:-1.5rem auto 1.5rem;max-width:270px;width:100%}.merge-user-accounts-with-same-email__accounts__item{align-items:center;display:flex;flex-direction:column;gap:.625rem;justify-content:center;width:100%}.merge-user-accounts-with-same-email__accounts__item__icon{height:3.5rem;width:3.5rem}.merge-user-accounts-with-same-email__accounts__divider{height:16px;margin-top:-1.5rem;width:16px}.merge-user-accounts-with-same-email__accounts__divider__icon>path{fill:var(--dynamic-text-secondary)}.merge-user-accounts-with-same-email__text{text-align:center}.merge-user-accounts-with-same-email__text__header{color:var(--dynamic-text-primary);margin-bottom:.5rem}.merge-user-accounts-with-same-email__text__body{color:var(--dynamic-text-secondary);margin-bottom:1rem}.merge-user-accounts-with-same-email__text--bold{font-weight:700}.merge-user-accounts-with-same-email__buttons{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-with-same-email__buttons__button{width:100%}.wallet-cannot-be-transferred-view__container{padding:var(--dynamic-modal-padding);text-align:center}.wallet-cannot-be-transferred-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-cannot-be-transferred-view__icon svg{margin:0 auto}.wallet-cannot-be-transferred-view__shorten-wallet-address{margin:0 0 1rem}.wallet-cannot-be-transferred-view__title{margin:0 0 .375rem}.wallet-cannot-be-transferred-view__copy{margin:0 0 .75rem}.wallet-cannot-be-transferred-view__transfer-alt-wallet-button{margin:0 0 1rem}.wallet-cannot-be-transferred-view__footer{margin:0 0 .5rem}.wallet-cannot-be-transferred-view__cancel{background:none;border:none;box-shadow:none;margin:auto}.user-field-editor__header{align-items:center;display:flex;flex-direction:column;gap:1.25rem;text-align:center}.user-field-editor__header__icon{align-items:center;background-color:var(--dynamic-base-2);border-radius:50%;display:flex;height:4rem;justify-content:center;width:4rem}.user-field-editor__body{align-items:center;display:flex;flex-direction:column;gap:.5rem;margin:0 1.5rem 1.5rem;text-align:center}.user-field-editor__body__subtitle{margin-block:-.375rem .5rem}.user-field-editor__body__form{width:100%}.passkey-intro-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-intro-view__header{display:flex;width:100%}.passkey-intro-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-intro-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-intro-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-intro-view__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-intro-view__log-out:hover{background-color:transparent}.passkey-intro-view__skip{color:var(--dynamic-text-secondary);font-size:.875rem;justify-content:center;line-height:1rem}.passkey-intro-view__skip:hover{background-color:transparent}.passkey-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-recovery-view__header{align-items:center;display:flex;justify-content:center;margin-bottom:-5rem;width:12.875rem}.passkey-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-recovery-view__input-valid{background:var(--dynamic-success-2)!important;border-color:var(--dynamic-success-1)!important}.passkey-recovery-view__input-valid,.passkey-recovery-view__input-valid~.input__label{color:var(--dynamic-success-1)!important}.passkey-recovery-view__form{display:flex;flex-direction:column;width:100%}.passkey-recovery-view__skip{justify-content:center;margin-top:1.5rem}.passkey-recovery-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-recovery-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-recovery-view__resend-code{align-items:center;display:flex;flex-direction:column}.passkey-recovery-view button.text-button:not(.passkey-recovery-view__skip){color:inherit}.edit-passkeys-widget-view,.edit-passkeys-widget-view__body{display:flex;flex-direction:column}.edit-passkeys-widget-view__body{flex:1;gap:.25rem;justify-content:space-between;margin-top:20px;padding:0 1.5rem 1.5rem}.edit-passkeys-widget-view__icon{height:100px;margin-left:auto;margin-right:auto;margin-top:-40px;width:100px}.edit-passkeys-widget-view__title{margin-left:auto;margin-right:auto;margin-top:20px}.passkey-new-domain-detected{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-new-domain-detected__header{align-items:center;display:flex;justify-content:center}.passkey-new-domain-detected__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-new-domain-detected__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-new-domain-detected__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-new-domain-detected__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-new-domain-detected__log-out:hover{background-color:transparent}.embedded-reveal-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.embedded-reveal-view__header{align-items:center;display:flex;justify-content:center}.embedded-reveal-view__zerodev-warning{background-color:var(--dynamic-error-1);border-radius:.5rem;margin-bottom:1rem;padding:1.25rem}.embedded-reveal-view__zerodev-warning__title-row{align-items:center;display:flex;margin-bottom:.5rem}.embedded-reveal-view__zerodev-warning__icon{flex-shrink:0;height:1.25rem;margin-right:.5rem;width:1.25rem}.embedded-reveal-view__zerodev-warning__link-button{background:none;border:none;cursor:pointer;display:inline;font:inherit;margin-left:.25rem;padding:0}.embedded-reveal-view__zerodev-warning .typography{color:inherit}.embedded-reveal-view__zerodev-warning .typography.underline{text-decoration:underline}.embedded-reveal-view__coinbase{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);color:var(--dynamic-text-secondary);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;overflow-wrap:break-word;padding:.75rem}.embedded-reveal-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.embedded-reveal-view__body__description{display:flex;justify-content:center;text-align:center}.embedded-reveal-view__body__badge{font-size:.75rem}.embedded-reveal-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.embedded-reveal-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.embedded-reveal-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.embedded-reveal-view__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.embedded-reveal-view__body__card__skeleton{border-radius:.75rem;height:3.75rem}.embedded-reveal-view__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.embedded-reveal-view__body__button{color:#fff}.embedded-auth-choice{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.embedded-auth-choice__header{align-items:center;display:flex;justify-content:center;width:100%}.embedded-auth-choice__skip-button{margin-top:-.25rem}.action-card{background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);display:flex;padding:1rem;text-align:left;transition:all .2s ease}.action-card:hover{box-shadow:var(--dynamic-button-shadow)}.action-card__icon{height:1.75rem;min-width:1.75rem;width:1.75rem}.action-card__icon,.action-card__icon path{fill:var(--dynamic-text-tertiary)}.action-card__action-icon{margin-left:auto;min-width:1rem;transform:rotate(180deg);width:1rem}.action-card__content{display:flex;flex-direction:column;gap:.25rem;margin-left:8px}.action-card__content__row{align-items:flex-start;display:flex;gap:.375rem}.action-card__content__row__badge--primary{background:var(--dynamic-brand-primary-color);color:var(--dynamic-base-2)}.embedded-auth-choice-cards{display:flex;flex-direction:column;gap:.625rem;width:100%}.auth-choice-info{align-items:flex-start;align-self:stretch;background:var(--default-base-2,#fff);border:1px solid var(--default-base-4,#e7e8ed);border-radius:12px;display:flex;flex-direction:column;gap:12px;justify-content:center;padding:16px 12px 12px}.auth-choice-info__container-item{display:flex;flex-direction:row;gap:.5rem;text-align:start}.select-hardware-wallet-view__container{align-items:stretch;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding)}.select-hardware-wallet-view__icon{height:6rem;margin:0 auto .75rem;width:4rem}.select-hardware-wallet-view__text{padding-bottom:1rem;text-align:center}.enter-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.enter-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.enter-password-view__body__icon{display:flex;justify-content:center;text-align:center}.enter-password-view__body__description{text-align:center}.enter-password-view__password-input__suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.wallet-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.wallet-redirect-view__container .wallet-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.wallet-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.create-password{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.create-password__body{display:flex;flex:1;flex-direction:column;gap:.5rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.create-password__body__header{align-items:center;display:flex;flex-direction:column;gap:1rem;padding:.5rem 0}.create-password__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.3125rem;max-height:21.875rem;overflow:auto;padding:.75rem}.create-password__progress-bar{display:flex;margin:8px 0}.create-password__progress-bar__element{background-color:var(--default-base-4,#e7e8ed);border-radius:24px;height:4px;margin:0 4px;width:100%}.create-password__progress-bar__element__1{background:var(--dynamic-error-1)}.create-password__progress-bar__element__2{background:var(--dynamic-alert-1)}.create-password__progress-bar__element__3{background:var(--dynamic-success-1)}.create-password__password-input__suffix{align-items:center;display:flex;gap:.375rem;margin-top:-.25rem}.create-password__password-input__suffix__icon{color:var(--dynamic-text-tertiary);height:1.375rem;width:1.375rem}.create-password__password-criteria-icon{height:.9375rem;width:.9375rem}.create-password__password-criteria-list{align-items:center;display:flex;gap:.5rem;margin:.125rem 0}.create-password__password-criteria-list__success{color:var(--dynamic-success-1)}.create-password__password-criteria-list__error{color:var(--dynamic-error-1)}.create-password__log-out{margin:0 auto}.save-password-suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.save-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.save-password-view__header{align-items:center;display:flex;justify-content:center}.save-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.save-password-view__body__icon{display:flex;justify-content:center;text-align:center}.save-password-view__body__badge{background-color:var(--default-alert-2,#faedd9);color:var(--dynamic-alert-1);font-size:.75rem}.save-password-view__body__description{text-align:center}.save-password-view__body__actions{display:flex;gap:8px;justify-content:space-between}.save-password-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.save-password-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.save-password-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.save-password-view__body__confirm-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.5rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:.625rem}.mpc-claim-intro{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.mpc-claim-intro__header{align-items:center;display:flex;justify-content:center}.mpc-claim-intro__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.mpc-claim-intro__body__description{display:flex;justify-content:center;text-align:center}.mpc-claim-intro__body__badge{font-size:.75rem}.mpc-claim-intro__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.mpc-claim-intro__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.mpc-claim-intro__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.mpc-claim-intro__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.mpc-claim-intro__body__card__skeleton{border-radius:.75rem;height:3.75rem}.mpc-claim-intro__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.mpc-claim-intro__body__button{color:#fff}#dyn-turnkey-export-container-id{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;overflow:auto;padding:.75rem}#dyn-turnkey-export-element-id{word-wrap:break-word;max-height:-moz-min-content;max-height:min-content;width:100%}.mfa-choose-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-choose-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-choose-device-view__button{box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.25rem;margin-top:.75rem;text-align:left}.mfa-choose-device-view__button__header{align-items:center;display:flex;justify-content:space-between;width:100%}.mfa-choose-device-view__button__description.mfa-choose-device-view__button__description{font-size:var(--dynamic-text-size-body-small)}.mfa-choose-device-view__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.mfa-choose-device-view__logout{margin-top:1.125rem}.mfa-secure-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-secure-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-secure-device-view__button,.mfa-secure-device-view__logout-button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.mfa-secure-device-view__loading-spinner{height:394px}.mfa-secure-device-view__qrcode{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin:1rem 0;padding:.75rem}.mfa-secure-device-view__qrcode .button-container{display:flex;gap:.5rem;justify-content:center;width:100%}.mfa-secure-device-view__qrcode .button-container svg path{fill-opacity:100%}.mfa-secure-device-view__qrcode .button-container .qr-code-button{height:2.375rem}.mfa-display-backup-codes-view__body{align-items:center;display:flex;flex-direction:column;gap:1rem;justify-content:center;padding:var(--dynamic-layout-content-padding);text-align:center}.mfa-display-backup-codes-view__warning{border-radius:var(--dynamic-border-radius);padding:.25rem .5rem}.mfa-display-backup-codes-view__loading-spinner{height:19.5rem}.mfa-display-backup-codes-view__codes{display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center}.mfa-display-backup-codes-view__code{background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-button-primary-border);border-radius:var(--dynamic-border-radius);color:var(--dynamic-text-secondary);padding:.75rem 1.125rem;text-align:center;width:8.75rem}.mfa-display-backup-codes-view__actions{display:flex;gap:.5rem;width:100%}.mfa-display-backup-codes-view__actions button{border-radius:calc(var(--dynamic-button-border-radius)/1.5)}.mfa-display-backup-codes-view__complete{display:flex;flex-direction:column;gap:.5rem;width:100%}.mfa-display-backup-codes-view__acknowledgement{border-radius:calc(var(--dynamic-button-border-radius)/1.5);justify-content:left}.mfa-display-backup-codes-view__acknowledgement .typography{font-size:var(--dynamic-text-size-button-secondary);font-weight:500}.mfa-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.mfa-recovery-view__body{padding:.3125rem,0}.mfa-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.mfa-recovery-view__get-help{padding:.3125rem,0}.mfa-verification-view__choose-another-method{display:flex;justify-content:center;margin-bottom:1.5rem;width:100%}.mfa-verification-view__choose-another-method-button{color:var(--dynamic-text-link)}.access-blocked__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.access-blocked__icon{margin-bottom:.3125rem}.access-blocked__content{margin:.9375rem 0;padding:0 .625rem .625rem;text-align:center}.switch-wallet{white-space:pre-line}.switch-wallet__body{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);margin-top:.625rem;padding:1rem 0;width:100%}.switch-wallet__body__divider{gap:0;padding:.75rem 0}.switch-wallet__body__divider svg{transform:rotate(90deg)}.switch-wallet__body__expected-address__prompt{margin-bottom:.5rem;margin-top:1rem}.switch-wallet__body__expected-address__address{font-size:1.5rem;line-height:1.25rem}.sync-wallet-view .qr-code-wrapper{padding-top:.5rem}.sync-wallet-view .prompt-modal-portal,.sync-wallet-view .prompt-modal-portal__container{position:relative}.mfa-qrcode-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.mfa-qrcode-help-content__vertical-container{background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.mfa-qrcode-help-content__setup-container{font-family:Arial,sans-serif;margin:0 auto;max-width:400px;width:100%}.mfa-qrcode-help-content__step{align-items:center;background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);color:gray;display:flex;flex-direction:row;height:100%;justify-content:flex-start;margin-bottom:.625rem;max-width:100%;padding:1rem}.mfa-qrcode-help-content__step__title{margin-bottom:.3125rem}.mfa-qrcode-help-content__step__number{align-items:center;align-self:flex-start;background-color:#e3ebff;border-radius:50%;color:#4779ff;display:flex;height:1.5rem;justify-content:center;margin-right:.625rem;min-width:1.5rem;width:1.5rem}.mfa-qrcode-help-content__step__nocopy-box{align-items:center;border:.0625rem solid #e0e0e0;border-radius:.3125rem;display:flex;justify-content:space-between;padding:.625rem}.mfa-qrcode-help-content__step__nocopy-text{word-break:break-all}.mfa-qrcode-help-content__copy-button{background-color:transparent;border:none;cursor:pointer}.sandbox-threshold__main{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.sandbox-threshold__title{color:var(--dynamic-text-primary);line-height:1.5rem;text-align:center}.sandbox-threshold__description{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-bottom:1.5rem;margin-top:.75rem;text-align:center}.sandbox-threshold__button{box-shadow:var(--dynamic-shadow-down-1)}.global-wallet-confirm .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;padding:24px}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-icon{height:64px;margin-bottom:16px;width:64px}.global-wallet-confirm .popup-content .wallet-connection-view .connection-title{color:var(--dynamic-text-primary);margin-bottom:16px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-url{color:var(--dynamic-text-secondary);margin-bottom:24px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;width:100%}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.connect-global-button{background-color:#3b82f6;color:#fff}.info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;gap:.75rem;padding:1.5rem;text-align:left}.inline-icon-text{display:inline}.inline-icon-text svg{display:inline-block;height:1em;margin:0 .25em;vertical-align:middle;width:1em}.nowrap{align-items:center;display:inline-flex;white-space:nowrap}.learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.malicious-site-view .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:24px;text-align:center}.malicious-site-view .popup-content .wallet-connection-view .header{align-items:center;display:flex;justify-content:center;margin-bottom:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .header .back-button{background:none;border:none;cursor:pointer;left:24px;padding:8px;position:absolute}.malicious-site-view .popup-content .wallet-connection-view .header h1{color:var(--dynamic-text-primary);margin:0}.malicious-site-view .popup-content .wallet-connection-view .warning-card{align-items:center;border-radius:8px;display:flex;flex-direction:column;justify-content:center;margin-bottom:16px;padding:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .warning-card .warning-icon{height:48px;margin-bottom:8px;width:48px}.malicious-site-view .popup-content .wallet-connection-view .connection-title{margin-top:16px}.malicious-site-view .popup-content .wallet-connection-view .site-info{color:var(--dynamic-text-secondary);padding:16px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container{border-radius:12px;display:flex;flex-direction:column;margin-top:16px;padding:16px;position:relative}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.definitely-malicious{background-color:var(--dynamic-error-2)}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.unknown{background-color:#f4d09a}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container{align-items:flex-start;display:flex;margin-bottom:4px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .caution-icon{height:24px;left:16px;position:absolute;top:16px;width:24px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .subtitle-header{flex:1;margin-bottom:0;margin-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle{margin-top:0;padding-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;margin-top:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.malicious-site-view .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.malicious-site-view .popup-content .wallet-connection-view .button-group button.proceed-button{background-color:inherit;box-shadow:none}.sign-message-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-bottom:1rem;width:100%}.sign-message-confirmation__body{align-items:stretch;display:flex;flex-direction:column;padding:.5rem 1.5rem 1.5rem}.sign-message-confirmation__message-container{align-items:center;background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);margin-bottom:.5rem;margin-top:.75rem;max-height:18.75rem;overflow-y:scroll;padding:.75rem;width:100%}.sign-message-confirmation__secure-wallet{margin-block:.5rem}.sign-message-confirmation__message{overflow-wrap:break-word;padding-top:.75rem}.sign-message-confirmation__title{text-align:center}.sign-message-confirmation__error{padding-top:.75rem}.bridge-welcome-layout{display:flex;flex-direction:column;gap:.75rem}.bridge-welcome-layout__body{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}.bridge-welcome-layout__message-container{display:flex;flex-direction:column;gap:.25rem;text-align:center}.bridge-welcome-layout__chain-icon-group{align-items:center;display:flex;flex-direction:row-reverse;padding-top:.875rem}.bridge-welcome-layout__chain-icon{background-color:var(--dynamic-base-1);border-radius:50%;height:4rem;margin-left:-1.375rem;outline:.25rem solid var(--dynamic-base-1);overflow:hidden;width:4rem}.bridge-welcome-layout__chain-icon:last-child{margin-left:0}.select-wallet-list-layout{display:flex;flex-direction:column;min-height:320px}.select-wallet-list-layout__wallet-list{display:flex;flex-direction:column;flex-grow:1;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow-y:auto;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout{display:flex;flex-direction:column}.connected-wallets-list-layout__body{display:flex;flex-direction:column;gap:1rem;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout__body__text{text-align:center}.bridge-next-wallet-to-connect-layout__chain-icon{height:4rem;margin:1rem 1rem 0;width:4rem}.bridge-next-wallet-to-connect-layout__body{align-items:center;display:flex;flex-direction:column;gap:1.5rem;padding:1rem 1.5rem 1.5rem;text-align:center}.account-control__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-control__icon{min-width:1rem}.account-control__social_icon{height:1rem;width:1rem}.account-control__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-primary);display:flex;gap:.375rem;min-height:100%;padding:.75rem;z-index:10}.account-control__container--multiwallet-disabled{border-bottom-left-radius:0;border-top-left-radius:0}.account-control__container--active,.account-control__container:hover{background-color:var(--dynamic-hover)}.dynamic-widget-inline-controls{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;font-size:var(--dynamic-text-size-body-small);max-height:2.5rem;min-width:100%;position:relative}.dynamic-widget-inline-controls__network-picker-main{min-width:60px}.dynamic-widget-inline-controls__account-control{max-width:100%;min-width:max(100%,45px)}.dynamic-widget-inline-controls__account-control .account-control__icon{margin-left:auto}.dynamic-widget-inline-controls__account-control-container{min-width:60px;overflow:hidden}.dynamic-widget-inline-controls__network-picker{background:unset;border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-bottom-right-radius:unset;border-top-left-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:unset;min-width:100%;padding:.75rem;position:unset;transform:unset}.dynamic-widget-inline-controls__network-picker--active,.dynamic-widget-inline-controls__network-picker:hover{background:var(--dynamic-hover)}.dynamic-widget-inline-controls__network-picker-checkbox{margin:0 0 0 .5rem}.dynamic-widget-inline-controls__network-picker-list{top:2.5rem}@media (pointer:coarse){.dynamic-widget-inline-controls__network-picker-list{top:unset}}.dynamic-widget-dropdown{position:absolute;right:0;top:3.0625rem}.dynamic-widget-dropdown__root{min-width:22.5rem}.dynamic-widget-modal{left:50%;margin:0 auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:min(100%,22.5rem)}@media (pointer:coarse){.dynamic-widget-modal{bottom:0;top:unset;transform:translate(-50%);width:100%}}.dynamic-widget-card{background-color:var(--dynamic-base-1);border:.0625rem solid var(--dynamic-base-4);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);height:100%;position:relative;transition:max-height .1s linear}@media (pointer:coarse){.dynamic-widget-card{border-bottom-left-radius:0;border-bottom-right-radius:0}}.dynamic-widget-header{padding:1.5rem 1.5rem 0;position:relative}.dynamic-widget-header__switcher{margin:0 0 1rem}.dynamic-widget-header__passkey-success{margin-inline:-1.5rem}.dynamic-widget-wallet-header{position:relative}.dynamic-widget-wallet-header__email{color:var(--dynamic-text-primary);margin:.5rem 0;text-align:center}.dynamic-widget-wallet-header__icon-container{height:4rem;margin:auto;position:relative;width:4rem}.dynamic-widget-wallet-header__icon-container img,.dynamic-widget-wallet-header__icon-container svg{height:100%;width:100%}.dynamic-widget-wallet-header__wallet-info{align-items:center;display:flex;flex-direction:column;justify-content:center;margin:0 0 1rem}.dynamic-widget-wallet-header__wallet-info .text-button{padding:0}.dynamic-widget-wallet-header__wallet-info__secure-wallet{margin-bottom:0;margin-top:1rem}.dynamic-widget-wallet-header__wallet-address{align-items:center;display:flex;justify-content:center}.dynamic-widget-wallet-header__balance{margin-bottom:.0625rem}.dynamic-widget-wallet-header__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.dynamic-widget-wallet-header__status-dot{margin-right:.375rem}.dynamic-widget-wallet-header__ens-name{max-width:12.5rem}.dynamic-widget-wallet-header__network-picker.evm-network-control__container{height:1.5rem}.dynamic-widget-wallet-header__network-picker.non-network-switching-supported-control{height:1.5rem;width:1.5rem}.dynamic-widget-wallet-header__network-picker.network-control-skeleton{bottom:0;height:1.5rem;position:absolute;right:0;width:1.5rem}.dynamic-widget-wallet-header__network-picker .evm-network-control__network-name,.dynamic-widget-wallet-header__network-picker .non-network-switching-supported-control__network-name{display:none}.dynamic-widget-wallet-header__wallet-avatar{border-radius:100%;overflow:hidden}.dynamic-widget-wallet-header__wallet-avatar img{height:4rem;width:4rem}.dynamic-widget-wallet-header__wallet-actions{align-items:center;display:flex;gap:.5rem;justify-content:stretch;margin-top:.5rem;width:100%}.dynamic-widget-wallet-header__wallet-loading{margin-bottom:.5rem;margin-top:.5rem;width:100%}.empty-wallet__container{align-items:center;background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.75rem;justify-content:center;padding:.5rem;text-align:center;width:100%}.empty-wallet__container--big{margin:0 0 1rem;padding:.75rem}.empty-wallet__icon{height:1.5rem;width:1.5rem}.empty-wallet__icon--big{height:3rem;width:3rem}.empty-wallet__icon>path{fill:var(--dynamic-text-tertiary)}.empty-wallet__text-container{max-width:10rem}.wallet__container{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:row;padding:.75rem}.wallet__container:not(:last-child){border-bottom-left-radius:0;border-bottom-right-radius:0;margin-bottom:-.75rem;padding-bottom:1.5rem}.wallet__container:hover .wallet__menu{opacity:1}.wallet__menu{color:var(--dynamic-text-tertiary);opacity:0;transition:opacity .15s ease-in-out}@media (pointer:coarse){.wallet__menu{opacity:1}}.wallet__row{align-items:center;display:flex;flex:1}.wallet__row__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.wallet__icon-container{margin-right:.375rem}.wallet__ens-name{max-width:9.375rem}.wallet__actions{max-height:0;overflow:hidden;transition:max-height .3s ease-in-out}.wallet__actions__expanded{max-height:6.25rem}.wallet__actions__inner{padding-top:.75rem}.dynamic-widget-footer{border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);border-top:.0625rem solid var(--dynamic-base-4);color:var(--dynamic-text-primary);display:flex;gap:.5rem;margin-top:auto;padding:1rem 1.5rem}.dynamic-widget-footer__button:hover:enabled svg{color:var(--dynamic-text-secondary)}.dynamic-widget-footer__button svg{color:var(--dynamic-text-tertiary)}.dynamic-widget-footer__button-align-right{margin-left:auto}@media (pointer:coarse){.dynamic-widget-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}}.wallet-icon-with-status__container{position:relative}.wallet-icon-with-status__dot-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;height:.75rem;justify-content:center;position:absolute;right:0;width:.75rem}.wallet-icon-with-status__dot-container .dot{background-color:var(--dynamic-error-1);border-radius:100%;bottom:0;height:.5rem;right:0;width:.5rem}.wallet-icon-with-status__dot-container .dot--green{background-color:var(--dynamic-success-1)}.wallet-icon-with-status__dot-container--secondary{bottom:0;height:.625rem;right:0;transform:translate(25%,25%);width:.625rem}.wallet-icon-with-status__dot-container--secondary .dot{height:.375rem;width:.375rem}.wallet-icon-with-network__container{position:relative}.wallet-icon-with-network__network-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:-.1875rem;display:flex;height:.75rem;justify-content:center;position:absolute;right:-.1875rem;width:.75rem}.dots-menu-dropdown__container{padding:.375rem 0}.dots-menu-dropdown__item{align-items:center;cursor:pointer;display:flex;font-size:var(--dynamic-text-size-body-small);gap:.5rem;padding:.5rem .75rem;width:100%}.dots-menu-dropdown__item .typography{white-space:nowrap}.dots-menu-dropdown__item__end-slot{position:absolute;right:.75rem}.dots-menu-dropdown__item:hover{background-color:var(--dynamic-hover)}.dots-menu-dropdown__item:hover .typography{color:var(--dynamic-text-primary)}@media (pointer:coarse){.dots-menu-dropdown__item{font-size:var(--dynamic-text-size-body-normal)}}.dots-menu-dropdown__item-text{align-items:center;display:flex;gap:.5rem}@keyframes desktop-dropdown-entering-animation{0%{opacity:0;transform:scale(.8) translateY(0)}70%{transform:scale(1) translateY(0)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes desktop-dropdown-exiting-animation{0%{opacity:1;transform:scale(1) translateY(0)}25%{opacity:1}50%{transform:scale(1.01) translateY(0)}to{opacity:0;transform:scale(1.02) translateY(1.875rem)}}@keyframes mobile-dropdown-entering-animation{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes mobile-dropdown-exiting-animation{0%{transform:translateY(0)}50%{transform:translateY(0)}to{transform:translateY(200%)}}.dots-menu-wrapper{position:relative}.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-entering-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-exiting-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container{background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);margin-top:.5rem;position:absolute;right:0;z-index:2147483647}.dots-menu-wrapper__container__alignment__top{bottom:1.375rem}.dots-menu-wrapper__container__alignment__bottom{top:1.375rem}@media (min-width:768px){.dots-menu-wrapper__container{min-width:9.375rem}}@media (pointer:coarse){.dots-menu-wrapper__container{border:none;border-radius:var(--dynamic-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:calc(50% - 18.75rem);margin:auto;max-width:37.5rem;padding-bottom:2rem;padding-top:0;position:fixed;right:calc(50% - 18.75rem);top:unset;width:100%}}.dots-menu-wrapper__header{display:none;padding:.75rem 1.5rem .25rem}@media (pointer:coarse){.dots-menu-wrapper__header{align-items:center;display:flex;justify-content:space-between}}.dots-menu-wrapper__header__icon{min-height:1.5rem;min-width:1.5rem}.dots-menu-wrapper__backdrop{cursor:default;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10}@media (pointer:coarse){.dots-menu-wrapper__backdrop{background-color:var(--dynamic-overlay);display:block}}.dynamic-widget-wallets-header{display:flex;flex-direction:row;justify-content:space-between;margin:0 1.5rem}.dynamic-widget-wallets-header__title{margin:0 0 .5rem}.dynamic-widget-wallets-header__add_wallet{display:flex;margin:0 0 .5rem}.dynamic-widget-wallets{margin:0 1.5rem;overflow:auto}.dynamic-widget-wallets__body{display:flex;flex-direction:column;gap:1rem}.dynamic-widget-wallets__body__wallet-list{max-height:13rem}.widget-portal{background-color:var(--dynamic-overlay);top:0;z-index:50}.widget-portal,.widget-portal__container{border-radius:calc(var(--dynamic-border-radius)/1.5);bottom:0;left:0;position:absolute;right:0}.widget-portal__container{background-color:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);padding:1.5rem}@media (pointer:coarse){.widget-portal__container{border-bottom-left-radius:0;border-bottom-right-radius:0}}.widget-portal__container--no-padding{padding:0}.widget-portal__container__header{position:relative}.widget-portal__container__close-button{position:absolute;right:0}.single-wallet-buttons{display:flex;gap:.625rem;padding:0 1.5rem 1.5rem}.single-wallet-buttons--center{align-items:center;display:flex;justify-content:center}.single-wallet-buttons__copied{align-items:center;display:flex;gap:8px}.single-wallet-buttons__copied svg{color:var(--dynamic-success-1)}.email-connector-pending-sign-modal-content{align-items:center;display:flex;flex-direction:column;text-align:center;width:100%}.email-connector-pending-sign-modal-content__body{align-items:center;display:flex;flex-direction:column;gap:.5rem}.active-wallet-information{border-bottom:1px solid var(--dynamic-base-3);display:flex;flex-flow:column;gap:.5rem;padding:.75rem}.active-wallet-information__header{display:flex;gap:.5rem}.active-wallet-information__handle{max-width:80px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__handle--full-width{max-width:230px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.active-wallet-information__dots-menu .icon-with-status__container{margin-bottom:0}.active-wallet-information__dots-menu .icon-with-status__container .status-dot__container{right:-.05rem;top:-.05rem}.active-wallet-information-container{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2)}.active-wallet-information__details{display:flex;flex:1;gap:.5rem;justify-content:space-between;overflow:hidden}.active-wallet-information__avatar img{height:2rem;min-height:2rem;min-width:2rem;width:2rem}.active-wallet-information__avatar__name-service{align-items:center;border-radius:100%;display:flex;overflow:hidden}.active-wallet-information__addresses-container{display:flex;flex-direction:column;gap:.5rem}.active-wallet-information__addresses-container--centered{justify-content:center}.active-wallet-information__address-container{display:flex}.active-wallet-information__address{align-items:center;display:flex}.active-wallet-information__address-skeleton{width:60px}.active-wallet-information__network-picker{overflow:hidden}.active-wallet-information__network-picker-button{border:1px solid var(--dynamic-base-4);height:100%;position:relative;transform:translateX(0)}.active-wallet-information__network-picker-button:hover{background:var(--dynamic-hover)}.balance-header{justify-content:space-between;padding:1rem .75rem;width:100%}.balance-header,.balance-header__title{align-items:center;display:flex}.balance-header__chevron{rotate:180deg}.balance-header__skeleton{display:table-cell;width:2.5rem}.balance-container{align-items:center;display:flex;justify-content:space-between;padding:1rem .75rem;position:relative}.balance-container__skeleton{display:table-cell;width:2.5rem}.multi-asset-balance-container{align-items:center;position:relative}.multi-asset-balance-container .shadow{border-bottom:1px solid var(--dynamic-base-3)}.multi-asset-balance-container__accordion{overflow-y:auto}.multi-asset-balance-container__accordion--collapsed{max-height:0!important}.multi-asset-balance-container__accordion--expanded{height:100%!important;max-height:11.25rem!important}.prompt-modal{padding:1.5rem}.prompt-modal__header{position:relative;width:100%}.prompt-modal__close-button{position:absolute;right:1rem;top:1rem}.balance-skeleton{display:table-cell;width:1.875rem}.token-balance-item{justify-content:space-between;padding:8px 0;width:100%}.token-balance-item,.token-balance-item__name{align-items:center;display:flex}.token-balance-item__title{max-width:8.4375rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-balance-item__icon,.token-balance-item__skeleton-icon{border-radius:100%;height:20px;margin-right:6px;overflow:hidden;width:20px}.token-balance-item__skeleton-icon{background-color:var(--dynamic-base-3)}.token-balance-item__value,.token-balance-item__value__balance{display:flex}.token-balance-list{padding:0 .75rem .75rem}.token-balance-list__empty{align-items:center;display:flex;justify-content:center;padding:.625rem}.token-balance-list__divider{padding:0}.footer-options-switcher__container{background-color:var(--dynamic-base-2);border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);display:flex;justify-content:space-around;margin-top:auto;padding:.75rem 0}.footer-options-switcher__label{font-size:12px;margin-top:.25rem}.footer-options-switcher__tab{align-items:center;color:var(--dynamic-text-secondary);cursor:pointer;display:flex;flex-direction:column;text-align:center}.footer-options-switcher__tab--active{color:var(--dynamic-text-primary)}.dynamic-widget-index-view__email-container{display:flex;flex-direction:column;gap:1rem;text-align:center}.dynamic-widget-index-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-index-view__user-profile{margin:0 0 1rem;padding:0 1.5rem}.dynamic-widget-index-view__user-profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.profile-view{flex:1;overflow:auto;padding:0 1.5rem 1.5rem}.profile-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-edit-profile-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.dynamic-widget-edit-profile-view__fields{flex:1;overflow:auto;padding:0 1.5rem 1rem}.dynamic-widget-edit-profile-view__profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.send-balance-widget-view{display:flex;flex:1;flex-direction:column;max-width:22.5rem;overflow:auto}.send-balance-widget-view__spinner{align-items:center;display:flex;flex:1;justify-content:center}.passkey-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);padding:.75rem;width:100%}.passkey-card__body{display:flex;flex-direction:row;justify-content:space-between}.passkey-card__left{align-items:center;display:flex;gap:.5rem}.passkey-card__info{align-items:center;border-bottom:1px solid var(--dynamic-base-4);gap:.5rem;padding-bottom:.5rem}.passkey-card__info__icon{justify-self:start;width:1.5rem}.passkey-card__info__tooltip{display:none}@media (hover:none),(pointer:coarse){.passkey-card__info__tooltip{background-color:#555;border:1px solid;border-radius:6px;color:#fff;display:block;font-size:12px;opacity:0;padding:3px;position:absolute;transition:opacity .5s;visibility:hidden;width:-moz-fit-content;width:fit-content}.passkey-card__info__tooltip--visible{opacity:1;transition:opacity .3s;visibility:visible}}.passkey-card__date{padding-top:.5rem}.manage-passkeys-widget-view,.manage-passkeys-widget-view__body{display:flex;flex:1;flex-direction:column}.manage-passkeys-widget-view__body{gap:1rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.manage-passkeys-widget-view__body__cards{display:flex;flex:1;flex-direction:column;gap:.5rem;max-height:23.75rem;overflow:auto}.manage-passkeys-widget-view__body__cards__skeleton{border-radius:.75rem;height:3.75rem}.manage-passkeys-widget-view__reveal{display:flex;flex:1;flex-direction:column;gap:.5rem}.manage-passkeys-widget-view__reveal-helper-text{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.manage-passkeys-widget-view__reveal-button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.manage-passkeys-widget-view__reveal-button__start-slot{align-items:center;display:flex;font-size:.9375rem}.manage-passkeys-widget-view__reveal-button__icon{color:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.5rem}.manage-passkeys-widget-view__reveal-button__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg)}.settings-view{display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem}.settings-view__logout-button-container{bottom:60px;color:var(--dynamic-text-secondary);width:100%}.settings-view__logout-button-container__button{width:100%}.settings-view__header{align-items:center;display:flex;gap:.5rem}.settings-view__body{display:flex;flex-direction:column;gap:1rem;height:100%;margin-bottom:1.5rem;overflow-y:auto}.settings-view__body__section{display:flex;flex-direction:column;gap:.75rem}.settings-view__body__section__title{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.settings-view__body__section__title__info-icon{align-items:center;display:flex;gap:5px}.settings-view__body__section__title__info-icon svg path{fill:var(--dynamic-alert-1)}.settings-view__body__section__button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.settings-view__body__section__button__start-slot{align-items:center;display:flex;font-size:.9375rem}.settings-view__body__section__button__badge .badge__container.badge__container__secondary{margin-left:.625rem}.settings-view__body__section__button__icon{color:var(--dynamic-text-tertiary);height:1.75rem!important;margin-right:.625rem;width:1.75rem!important}.settings-view__body__section__button__icon.email{color:transparent}.settings-view__body__section__button__icon__stroke{stroke:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.625rem;width:1.75rem}.settings-view__body__section__button__icon-secondary{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--success{color:var(--dynamic-success-1);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.manage-mfa-widget-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.manage-mfa-widget-view__description-container{background:var(--dynamic-base-4)}.manage-mfa-widget-view__description-container__text{margin:.625rem}.manage-mfa-widget-view__add-mfa-button-container{bottom:60px;padding:.625rem 1.5rem 1.5rem;width:100%}.manage-mfa-widget-view__add-mfa-button-container__button{width:100%}.manage-mfa-widget-view__no-devices{align-items:center;display:flex;flex-direction:column;gap:1rem;height:100%;justify-content:center;padding:1rem}.manage-mfa-widget-view__scroll-container{flex:1;overflow-y:auto;padding:.625rem 1.5rem 1.5rem}.manage-mfa-widget-view__list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.manage-mfa-widget-view__list-tile__icon{height:1.5rem;position:relative;width:1.5rem}.manage-mfa-widget-view__list-tile__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.manage-mfa-widget-view__list-tile__details__title{display:flex;flex-direction:row;gap:.25rem}.manage-mfa-widget-view__list-tile__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.connect-dapps-view{max-width:400px;padding:1.5rem;position:relative}.connect-dapps-view .header{align-items:center;display:flex;justify-content:space-between;margin-bottom:1rem;position:relative}.connect-dapps-view .header h1{flex-grow:1;margin:0 auto;text-align:center}.connect-dapps-view .header button{background:none;border:none;cursor:pointer;padding:.5rem;position:absolute;top:50%;transform:translateY(-50%)}.connect-dapps-view .header button:first-child{left:0}.connect-dapps-view .header button:last-child{right:0}.connect-dapps-view .scanner-wrapper{aspect-ratio:1/1;height:200px;margin-left:-24px;margin-right:-24px;overflow:hidden;position:relative;width:calc(100% + 48px)}.connect-dapps-view .scanner-wrapper video{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.connect-dapps-view .scanner-overlay{align-items:center;bottom:0;display:flex;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0}.connect-dapps-view .scanner-frame{border-radius:12px;height:80%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}.connect-dapps-view .corner{border:4px solid #fff;height:16px;position:absolute;width:16px}.connect-dapps-view .top-left{border-bottom:none;border-right:none;border-top-left-radius:8px;left:-3px;top:-3px}.connect-dapps-view .top-right{border-bottom:none;border-left:none;border-top-right-radius:8px;right:-3px;top:-3px}.connect-dapps-view .bottom-left{border-bottom-left-radius:8px;border-right:none;border-top:none;bottom:-3px;left:-3px}.connect-dapps-view .bottom-right{border-bottom-right-radius:8px;border-left:none;border-top:none;bottom:-3px;right:-3px}.connect-dapps-view .scanner-overlay-content{align-items:center;border-radius:8px;display:flex;flex-direction:column;padding:16px;z-index:1}.connect-dapps-view .scanner-icon{height:20px;margin-bottom:2px;-o-object-fit:contain;object-fit:contain;width:20px}.connect-dapps-view .info-card,.connect-dapps-view .wallet-connect-card{margin-bottom:1rem;position:relative}.connect-dapps-view .wallet-connect-card{align-items:center;display:flex;flex-direction:column}.connect-dapps-view .wallet-connect-card h2{align-self:flex-start;margin-bottom:.5rem;width:100%}.connect-dapps-view .input-group{width:100%}.connect-dapps-view .input-suffix{transform:translateY(-20%)}.connect-dapps-view .banner{border-radius:8px;margin-top:.5rem;padding:6px;text-align:center;width:100%}.connect-dapps-view .banner.success{background-color:var(--dynamic-success-2)}.connect-dapps-view .banner.error{background-color:var(--dynamic-error-2)}.connect-dapps-view .info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;padding:1.5rem;text-align:left}.connect-dapps-view .info-card .learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.connect-dapps-view .info-card .learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.connect-dapps-view .inline-logo-text{align-items:center;display:flex;flex-wrap:nowrap}.connect-dapps-view .inline-logo-text .inline-logo{flex-shrink:0;margin:0 4px}.connected-apps-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem;position:relative}.connected-apps-view .header{align-items:center;display:flex;justify-content:space-between;padding-bottom:.25rem;position:relative}.connected-apps-view .header .title{flex-grow:1;text-align:center}.connected-apps-view .header .arrow-left-icon{transform:rotate(90deg)}.connected-apps-view .subheader{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-bottom:.25rem;position:relative;text-align:center}.connected-apps-view .connected-apps-list{display:flex;flex-direction:column;gap:.75rem;list-style-type:none;margin:0;padding:0}.connected-apps-view .connected-app-item{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;padding:.75rem}.connected-apps-view .connected-app-item .app-icon{border-radius:50%;height:2rem;margin-right:.75rem;width:2rem}.connected-apps-view .connected-app-item .app-info{display:flex;flex:1;flex-direction:column}.connected-apps-view .connected-app-item .app-actions{display:flex;gap:.5rem;margin-left:10px}.connected-apps-view .success-message{align-items:center;background-color:var(--dynamic-success-2);border:1px solid var(--dynamic-border-1);border-radius:.5rem;display:flex;padding:.75rem;text-align:left}.connected-apps-view .success-message svg{color:#30a67b;flex-shrink:0;height:1.5rem;margin-right:.75rem;width:1.5rem}.default-prompt-modal{align-items:center;display:flex;flex-direction:column;text-align:center}.default-prompt-modal__icon-with-spinner{margin:0 auto .75rem}.default-prompt-modal__content{flex-direction:column;width:100%}.default-prompt-modal__button .typography,.default-prompt-modal__content{align-items:center;display:flex;gap:.375rem;justify-content:center}.detected-new-wallet-modal__content{align-items:center;display:flex;flex-direction:column;gap:.75rem;text-align:center}.detected-new-wallet-modal__top-section{align-items:center;display:flex;flex-direction:column;gap:1.125rem;text-align:center}.no-qr-code-not-installed-modal-view{align-items:center;display:flex;flex-direction:column;gap:1rem}.no-qr-code-not-installed-modal-view__links-section{width:100%}.qr-code-modal-view{display:flex;flex-direction:column;gap:.5rem}.qr-code-modal-view__title{text-align:center}.qr-code-modal-view .qrcode__container{height:10.9375rem;width:10.9375rem}.qr-code-modal-view__container{align-items:center;display:flex;justify-content:center}.qr-code-modal-view__wrapper{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*3/4);padding:.5rem}.qr-code-modal-view .info-item{margin-bottom:.75rem}.qr-code-modal-view .info-item__text{font-size:var(--dynamic-text-size-body-small)}.qr-code-modal-view .info-item svg path{fill:var(--dynamic-text-secondary)}.qr-code-modal-view .button__container{flex-direction:column}.qr-code-modal-view .button__container,.qr-code-modal-view .button__container span{align-items:center;display:flex;gap:.375rem}.unlink-wallet-popup__container{align-items:center;display:flex;flex-direction:column;width:100%}.unlink-wallet-popup__button,.unlink-wallet-popup__label,.unlink-wallet-popup__title{text-align:center}.unlink-wallet-popup__title{padding-bottom:.5rem}.unlink-wallet-popup__label{padding-bottom:.5rem;padding-top:.5rem}.unlink-wallet-popup__button{margin-top:.5rem}.unlink-wallet-popup__button--shadow{box-shadow:var(--dynamic-shadow-down-1)}.dynamic-widget__container{z-index:2147483646}.fund-wallet__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:rgba(0,0,0,.25);inset:0;position:fixed;z-index:2147483645}.fund-wallet__modal-container{align-items:center;display:flex;inset:0;justify-content:center;overflow-y:auto;padding:1rem;position:fixed;z-index:2147483646}@media (pointer:coarse){.fund-wallet__modal-container{padding:0}}.fund-wallet__modal{border-radius:1.5rem;margin:auto;max-width:470px;overflow:hidden;width:100%}@media (pointer:coarse){.fund-wallet__modal{border-bottom-left-radius:0;border-bottom-right-radius:0;margin:initial;margin-top:auto}}.fund-wallet__modal-content{text-align:center}#onramp-iframe{border:none;height:635px;width:100%;z-index:2147483647}.embedded-widget{max-width:100%;width:var(--dynamic-modal-width)}.embedded-widget--background-default,.embedded-widget--background-none{background:none}.dynamic-bridge-user-profile__switcher{margin:0 0 1rem;padding:1.5rem 1.5rem 0}.dynamic-bridge-wallet-card__network{margin:0 0 .5rem}.dynamic-bridge-wallet-card__network,.dynamic-bridge-wallet-card__network-icon,.dynamic-bridge-wallet-card__network-name{display:inline-block;vertical-align:middle}.dynamic-bridge-wallet-card__network-icon{height:1rem;margin-right:.375rem;width:1rem}.dynamic-bridge-widget-empty-card{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);padding:.75rem;transition:transform .1s linear}.dynamic-bridge-widget-empty-card:active{transform:scale(.98)}.dynamic-bridge-widget-empty-card__icon{display:inline-flex;height:1.75rem;margin-right:.63rem;vertical-align:middle;width:1.75rem}.dynamic-bridge-widget-empty-card__text{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.dynamic-bridge-widget-wallets-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem}.dynamic-bridge-widget-wallets-view__logout-button{margin:0 auto}.dynamic-bridge-widget-wallets-view__unlink-button{color:var(--dynamic-text-secondary);margin:auto 0 0 auto}.footer-buttons-item{align-items:center;background:var(--dynamic-base-2);border:0;border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);cursor:pointer;display:flex;padding:.75rem;transition:all .3s;width:100%}.footer-buttons-item__icon--left{margin-right:.625rem}.footer-buttons-item__icon--left img,.footer-buttons-item__icon--left svg{height:1.25rem;width:1.25rem}.new-to-web3-buttons__container{margin-top:1rem}.new-to-web3-buttons__container button{background:var(--dynamic-brand-primary-color);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:.75rem;width:100%}.walletlist-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.walletlist-help-content__icon{align-items:center;display:flex;height:3.5rem;justify-content:center;margin:0 auto;width:3.5rem}.walletlist-help-content__typography-wrapper{color:var(--dynamic-text-primary);margin:1rem 0;text-align:center}.walletlist-help-content__typography-wrapper .walletlist-help-content__typography--label{margin-top:.375rem}.walletlist-help-content__buttons-wrapper{display:flex;flex-direction:column;gap:.375rem;margin-top:1rem}.walletlist-help-content__buttons-wrapper button{text-align:left;width:100%}.walletlist-help-content__custodial-wallet-area--title{margin:.75rem 0;text-align:center}.footer-more-info-content__wrapper{display:flex;flex-direction:column;gap:.75rem;padding:1.5rem}.footer-more-info-content__item--phantom-ledger{font-size:.6875rem;margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p{margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p:last-child,.footer-more-info-content__item:last-child{margin-bottom:0}.back-button{rotate:-90deg}.help-header{border-bottom:1px solid var(--dynamic-base-4)}.passkey-info-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.passkey-info-help-content__typography-wrapper{color:var(--dynamic-text-primary);display:flex;flex-direction:column;gap:1rem;text-align:left}.passkey-info-help-content__wrapper{flex:1}.passkey-info-help-content__details{display:flex;flex-direction:row;gap:1rem}.header__skeleton{width:7.5rem}.header__typography{margin:0;text-align:center}.header__typography img,.header__typography svg{display:inline-block}.header__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.header__icon svg{height:1.5rem;width:1.5rem}.tos-and-pp__footer{background:var(--dynamic-footer-background);border-top:var(--dynamic-footer-border-top);bottom:0;padding:var(--dynamic-footer-padding);position:relative;width:100%}.default-footer__footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible;width:100%}.default-footer__footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-progress-stepper{padding:.5rem 1rem}.dynamic-user-profile-layout{display:flex;flex-direction:column;height:33.125rem;overflow:hidden}.dynamic-user-profile-layout--unset-max-height{height:unset}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{box-shadow:unset!important}.dynamic-modal{display:flex;flex-direction:column-reverse;left:50%;letter-spacing:0;position:absolute}.dynamic-shadow-dom-content{font-family:var(--dynamic-font-family-primary)}';const LegacySafariCssOverrides=()=>jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:"https://app.dynamic.xyz/assets/legacySafari/styles.css"}),isShadowDOMFlagEnabled=()=>{if(isSSR())return!1;const Xr="shadowDOM.enabled",eo=new URLSearchParams(window.location.search);return eo.has(Xr)?eo.get(Xr)==="true":!0},ShadowDOMContext=React.createContext({}),useShadowDOMContext=()=>React.useContext(ShadowDOMContext),ShadowDOMStyle=()=>jsxRuntimeExports.jsx("style",{children:css_248z$1}),ShadowDOM=({mode:Xr="open",id:eo,className:to,children:ro,dataTestId:no,zIndex:io})=>{const{shadowDOMEnabled:oo,cssOverrides:ao}=useInternalDynamicContext(),co=isShadowDOMFlagEnabled()&&oo,[lo,uo]=reactExports.useState(null),[ho,go]=reactExports.useState(),bo=reactExports.useMemo(()=>ao&&typeof ao!="string"?()=>ao:ao&&typeof ao=="string"?()=>jsxRuntimeExports.jsx("style",{children:ao}):null,[ao]);reactExports.useLayoutEffect(()=>{if(lo&&co)try{const Eo=lo.attachShadow({mode:Xr});go(Eo)}catch{}},[co,lo,Xr]);const wo=!!Object.keys(css_248z$1).length;return co?jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(ShadowDOMContext.Provider,{value:{shadowRoot:ho},children:jsxRuntimeExports.jsx("div",{"data-testid":no,ref:uo,id:eo,className:classNames("dynamic-shadow-dom",to),style:{zIndex:io},children:ho&&reactDomExports.createPortal(jsxRuntimeExports.jsxs("div",{className:"dynamic-shadow-dom-content",children:[ro,wo&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),bo&&jsxRuntimeExports.jsx(bo,{})]}),ho)})})}):jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsxs("div",{"data-testid":no,ref:uo,id:eo,className:classNames("dynamic-shadow-dom",to),style:{zIndex:io},children:[ro,wo&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),bo&&jsxRuntimeExports.jsx(bo,{})]})})},useUserDataForm=({onSubmit:Xr,onError:eo,userProfile:to,shouldEnforcePolicies:ro=!0,fields:no})=>{var io;const{mockedSDK:oo}=useMockContext(),[ao,so]=reactExports.useState(!1),{fieldsConfig:co}=useFields(),lo=ro&&((io=no.find(wo=>wo.name==="policiesConsent"))===null||io===void 0?void 0:io.enabled),uo=wo=>`${wo.charAt(0).toUpperCase()+wo.slice(1)} is required`,ho=reactExports.useMemo(()=>create$4().shape(Object.fromEntries(no.map(({name:wo,required:Eo,type:$o,validationType:Co,validationRules:Ro})=>{let Oo=$o===KycFieldType.Custom?getValueByKey(customFieldValidationMap,Co):getValueByKey(co,wo).validation;return $o===KycFieldType.Custom&&Ro&&(Co===CustomFieldType.Select||Co===CustomFieldType.Text)&&(Oo=Oo,Ro.validOptions?Oo=Oo.oneOf(Ro.validOptions.map(jo=>jo.label),"Select a valid option"):Ro.regex&&(Oo=Oo.matches(new RegExp(Ro.regex),"Invalid field format"))),[wo,Eo?Oo.required(uo(wo)):Oo]}))),[no]),go=reactExports.useMemo(()=>Object.fromEntries(no.map(({name:wo,type:Eo,validationRules:$o,validationType:Co})=>{var Ro,Oo,jo,Bo;const Mo=to??{};if(Eo===KycFieldType.Custom){let Jo="";return Co===CustomFieldType.Select&&($o!=null&&$o.validOptions)&&(Jo=(Ro=$o.validOptions[0].label)!==null&&Ro!==void 0?Ro:""),[wo,(()=>{var Po;const fo=Mo.metadata?getValueByKey(Mo.metadata,wo):void 0;return Array.isArray(fo)?fo:(Po=fo==null?void 0:fo.toString())!==null&&Po!==void 0?Po:Jo})()]}const Wo=(Oo={country:countryCodes[0].code,policiesConsent:!1,tShirtSize:tShirtSizes[0],team:teamNames[0]}[wo])!==null&&Oo!==void 0?Oo:"";return[wo,(Bo=(jo=getValueByKey(Mo,wo))===null||jo===void 0?void 0:jo.toString())!==null&&Bo!==void 0?Bo:Wo]}))||{},[no,to]),bo=reactExports.useCallback((wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const $o={},Co={};if(!oo)try{if(!(to!=null&&to.environmentId))throw new DynamicError("Invalid environment ID");so(!0);let Ro=wo;Object.entries(Ro).forEach(([Oo,jo])=>{const Bo=no.find(Mo=>Mo.name===Oo&&Mo.type===KycFieldType.Custom);Bo&&($o[Oo]=jo,delete Ro[Oo],Bo.unique&&(Co[Oo]=jo))}),Object.keys($o).length>0&&(Ro.metadata=$o),lo&&(Ro=Object.assign(Object.assign({},Ro),{policiesConsent:!0}),delete Ro.policiesConsentArray),yield Xr==null?void 0:Xr(Ro)}catch(Ro){logger$8.error(Ro),eo==null||eo(Ro),Ro instanceof EmailAlreadyExistsError?Eo.setErrors({email:"Email already exists"}):Ro instanceof CustomFieldNotUniqueError?Eo.setFormikState(Oo=>Object.assign(Object.assign({},Oo),{errors:Object.fromEntries(Object.entries(Co).map(([jo])=>[jo,Object.entries(Co).length>1?"One or more fields are already tied to another user":`${jo} is already tied to another user`])),touched:Object.fromEntries(Object.entries(Co).map(([jo])=>[jo,!0])),values:Object.assign(Object.assign({},go),Co)})):Ro instanceof TooManyEmailVerificationsError?Eo.setErrors({email:"Too many email verification attempts."}):Ro instanceof UsernameAlreadyExistsError?Eo.setErrors({username:"Username already exists"}):Ro instanceof InvalidPhoneNumberError?Eo.setErrors({phoneNumber:Ro.message}):Eo.setErrors({api:"Something went wrong. Please try again."})}finally{so(!1)}}),[oo,to==null?void 0:to.environmentId,lo,Xr,no,eo,go]);return{enforcePolicies:lo,fetch:ao,formikInitialValues:go,formikValidationSchema:ho,onFormSubmit:bo}},getSupportedCountriesForVerificationFromProjectSettings=Xr=>{var eo,to;const ro=getProviderByType((eo=Xr==null?void 0:Xr.providers)!==null&&eo!==void 0?eo:[],ProviderEnum.Sms);return((to=ro==null?void 0:ro.enabledCountries)!==null&&to!==void 0?to:[]).map(no=>no.isoCountryCode.toLowerCase())},defaultCountries=["us","ca"],getDefaultCountriesIfEmpty=Xr=>Xr.length?Xr:defaultCountries,useThrottle=(Xr,eo)=>{const to=reactExports.useRef(!1),ro=reactExports.useRef(Xr);return ro.current=Xr,reactExports.useCallback((...no)=>{to.current||(ro.current(...no),to.current=!0,setTimeout(()=>to.current=!1,eo))},[eo])},modulo=(Xr,eo)=>(Xr%eo+eo)%eo,parseDefaultCountry=({defaultIso2:Xr,countries:eo,initialPhone:to})=>{if(to){const{country:so}=X$4({countries:eo,phone:to});if(so)return so}const ro=eo.map(M$5),no=StorageService.getItem(PHONE_INPUT_DEFAULT_COUNTRY),io=ro.find(({iso2:so})=>so===no);if(io)return io;const oo=ro.find(({iso2:so})=>so===Xr);if(oo)return oo;const ao=ro.find(({iso2:so})=>so==="us");if(ao)return ao;if(ro[0])return ro[0];throw new Error("No country list was provided")},MENU_DISPLAY_THROTTLE=50,COUNTRY_INPUT_SCROLL_DELAY=20,usePhoneInputLogic=({countryInputRef:Xr,setCountryDropdownOpen:eo,setInvalidNumberMessage:to,onUpdate:ro,initialPhone:no,countries:io,defaultIso2:oo})=>{const ao=reactExports.useRef(ro);ao.current=ro;const so=reactExports.useMemo(()=>parseDefaultCountry({countries:io,defaultIso2:oo,initialPhone:no}),[io,oo,no]),{inputValue:co,phone:lo,country:uo,setCountry:ho,handlePhoneValueChange:go,inputRef:bo}=ee$5({countries:io,defaultCountry:so.iso2,disableDialCodeAndPrefix:!0,value:no}),[wo,Eo]=reactExports.useState(so.dialCode),$o=reactExports.useMemo(()=>lo.length===("+"+uo.dialCode).length?"":lo,[uo.dialCode,lo]);reactExports.useEffect(()=>{var ko;(ko=ao.current)===null||ko===void 0||ko.call(ao,{country:uo,formattedPhone:co,phone:$o})},[uo.iso2,co,$o]);const[Co,Ro]=reactExports.useState(""),Oo=reactExports.useMemo(()=>Co?isNaN(parseInt(Co))?io.filter(ko=>{const{name:mo,iso2:Io}=M$5(ko);return mo.toLowerCase().includes(Co.toLowerCase())||Io===Co.toLowerCase()||uo.iso2===Io}):io.filter(ko=>{const{dialCode:mo,iso2:Io}=M$5(ko);return mo.includes(Co)||uo.iso2===Io}):io,[io,uo.iso2,Co]),jo=()=>{Ro(""),eo(!0)},Bo=reactExports.useCallback(()=>{eo(!1)},[eo]),Mo=reactExports.useRef(so),Fo=({target:ko})=>{const mo=ko.value.slice(0,4);Eo(mo),Ro(mo);const{country:Io}=X$4({countries:io,currentCountryIso2:uo.iso2,phone:mo});Io&&(Mo.current=Io,ho(Io.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Io.iso2),setTimeout(()=>_o(Io.iso2),COUNTRY_INPUT_SCROLL_DELAY))},Wo=()=>{!Mo.current||wo===Mo.current.dialCode||(ho(Mo.current.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Mo.current.iso2),Eo(Mo.current.dialCode),to(void 0))},Jo=reactExports.useCallback(ko=>{ko.preventDefault();const mo=Oo.findIndex(Lo=>M$5(Lo).iso2===uo.iso2),Io=ko.key==="ArrowUp"?-1:1,Do=M$5(Oo[modulo(mo+Io,Oo.length)]);_o(Do.iso2),Eo(Do.dialCode),ho(Do.iso2),Mo.current=Do,StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Do.iso2),to(void 0)},[uo.iso2,Oo,to,ho]),Po=reactExports.useCallback(()=>{var ko;Bo(),(ko=bo.current)===null||ko===void 0||ko.select()},[Bo,bo]),fo=reactExports.useCallback(ko=>{if(ko.key==="Tab")return Bo();if(ko.key==="ArrowUp"||ko.key==="ArrowDown")return Jo(ko);if(ko.key==="Enter")return Po(ko)},[Bo,Jo,Po]),yo=reactExports.useMemo(()=>de$4({charAfterDialCode:"+",dialCode:uo.dialCode,phone:lo}).length>0,[uo.dialCode,lo]),vo=reactExports.useRef(null),_o=ko=>{var mo;const Io=(mo=vo.current)===null||mo===void 0?void 0:mo.querySelector("#"+ko);Io==null||Io.scrollIntoView({behavior:"instant",block:"center",inline:"center"})},So=useThrottle(ko=>{var mo;const Io=!!vo.current,Do=!!ko;vo.current=ko,!(Io||!Do)&&((mo=Xr.current)===null||mo===void 0||mo.select(),_o(uo.iso2))},MENU_DISPLAY_THROTTLE),To=ko=>{Eo(ko.dialCode),ho(ko.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,ko.iso2),Mo.current=ko,to(void 0)},Ao=reactExports.useMemo(()=>wo.length>3?"var(--dynamic-text-size-body-mini)":wo.length>2?"var(--dynamic-text-size-body-small)":"var(--dynamic-text-size-body-normal)",[wo.length]);return{closeDropdown:Bo,countryFontSize:Ao,countryInput:wo,currentCountry:uo,filteredCountries:Oo,formattedPhone:co,handleCountryInput:Fo,handleCountryKeyDown:fo,handlePhoneInput:go,hasInput:yo,inputRef:bo,onBlurCountry:Wo,onFocusCountry:jo,onMenuDisplayToggle:So,openDropdown:jo,setCountry:To}},PhoneNumberField=({isLoading:Xr,disabled:eo,error:to,label:ro,onUpdate:no,appendRight:io,setIsFocused:oo,setIsHovered:ao,initialPhone:so,onBlur:co,countries:lo})=>{const{t:uo}=useTranslation(),ho=reactExports.useRef(null),[go,bo]=reactExports.useState(!1),wo=reactExports.useRef(null),{defaultPhoneInputIso2:Eo}=useInternalDynamicContext(),[$o,Co]=reactExports.useState(void 0),{formattedPhone:Ro,currentCountry:Oo,handleCountryInput:jo,handlePhoneInput:Bo,hasInput:Mo,inputRef:Fo,countryInput:Wo,onBlurCountry:Jo,filteredCountries:Po,openDropdown:fo,handleCountryKeyDown:yo,closeDropdown:vo,setCountry:_o,onMenuDisplayToggle:So,onFocusCountry:To,countryFontSize:Ao}=usePhoneInputLogic({countries:lo,countryInputRef:ho,defaultIso2:Eo,initialPhone:so,onUpdate:no,setCountryDropdownOpen:bo,setInvalidNumberMessage:Co});return jsxRuntimeExports.jsxs("div",{className:"phone-number-field",children:[jsxRuntimeExports.jsxs("div",{className:"phone-number-field__fields",onPointerEnter:()=>ao==null?void 0:ao(!0),onPointerLeave:()=>ao==null?void 0:ao(!1),onFocus:()=>oo==null?void 0:oo(!0),onBlur:ko=>{oo==null||oo(!1),co==null||co(ko)},ref:wo,children:[jsxRuntimeExports.jsxs("div",{className:classNames("phone-number-field__fields__country-code",{"phone-number-field__fields__country-code--disabled":Xr||eo}),onClick:fo,"data-testid":"country-code",children:[jsxRuntimeExports.jsx(q$7,{iso2:Oo.iso2,size:"24px",className:"phone-number-field__fields__country-code__flag"}),jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__country-code__plus",variant:"body_normal",weight:"regular",style:{fontSize:Ao},color:"primary",children:"+"}),jsxRuntimeExports.jsx(Input,{label:"",id:"country_code_field",value:Wo,onChange:jo,disabled:Xr||eo,containerClassName:"phone-number-field__fields__country-code__container",className:"phone-number-field__fields__country-code__container__input",onBlur:Jo,ref:ho,onKeyDown:yo,onFocus:To,style:{fontSize:Ao},"data-testid":"country-code-input",inputMode:"numeric",autoComplete:"tel-country-code"}),jsxRuntimeExports.jsx(Icon,{className:"phone-number-field__fields__country-code__chevron",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]}),jsxRuntimeExports.jsx(Input,{label:"",id:"phoneNumber",value:Ro,onChange:Bo,disabled:Xr||eo,containerClassName:"phone-number-field__fields__phone-number",className:"phone-number-field__fields__phone-number__input",ref:Fo,error:!!($o||to),inputMode:"numeric","data-testid":"phone_number_input",autoComplete:"tel-national"}),!Mo&&jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__placeholder",variant:"body_normal",weight:"regular",copykey:"dyn_collect_user_data.fields.phone_number.label",children:ro??uo("dyn_collect_user_data.fields.phone_number.label")}),io]}),jsxRuntimeExports.jsx(MenuList,{isOpen:go,onClickClose:vo,popperProps:{anchorOrigin:"bottom-left",anchorRef:wo},mobileTitle:"Select country",dropdownClassName:"phone-number-field__dropdown",children:jsxRuntimeExports.jsx("div",{className:"phone-number-field__dropdown__items",ref:So,children:Po.map(ko=>{const mo=M$5(ko),{iso2:Io,name:Do,dialCode:Lo}=mo,Ho=Io===Oo.iso2;return jsxRuntimeExports.jsxs("div",{className:classNames("phone-number-field__dropdown__items__country",{"phone-number-field__dropdown__items__country--selected":Ho}),onClick:()=>{_o(mo),vo()},id:Io,children:[jsxRuntimeExports.jsx(q$7,{iso2:Io,size:"24px"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:Do}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Lo})]},Io)})})}),!!($o||to)&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"phone-number-field__error-message",children:to??$o})]})},UserPhoneField=({onChange:Xr,value:eo,onBlur:to,disabled:ro,label:no,required:io,error:oo,name:ao,verify:so})=>{const{selectedPhoneCountry:co}=useFieldsState(),{projectSettings:lo}=useInternalDynamicContext(),uo=({country:go,phone:bo})=>{co.current=go,bo!==eo&&Xr({target:{name:ao,value:bo}})},ho=reactExports.useMemo(()=>{const go=getSupportedCountriesForVerificationFromProjectSettings(lo);return getCustomCountries(so?getDefaultCountriesIfEmpty(go):void 0)},[so,lo]);return jsxRuntimeExports.jsx(PhoneNumberField,{countries:ho,initialPhone:eo,disabled:ro,onUpdate:uo,onBlur:to,label:no,appendRight:!ro&&!io?jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"user-phone-field__optional-label",children:"Optional"}):void 0,error:oo})},getDisplayErrorMessage=(Xr,eo)=>{var to;if(!eo)return;const ro={required:no=>`${no} is required`};return((to=ro[eo])===null||to===void 0?void 0:to.call(ro,Xr))||eo},Checkbox=({ariaLabel:Xr,checked:eo,className:to="",defaultChecked:ro,disabled:no,id:io,name:oo,onChange:ao,value:so})=>jsxRuntimeExports.jsxs("div",{className:classNames("checkbox__container",to),children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:io,"aria-label":Xr,"aria-checked":eo,className:"checkbox--hidden",value:so,checked:eo,name:oo,disabled:no,defaultChecked:ro,onChange:co=>!!ao&&(ao==null?void 0:ao(co,co.currentTarget.value)),"data-testid":"input-checkbox"}),jsxRuntimeExports.jsx("div",{className:"checkbox--visible",children:jsxRuntimeExports.jsx(SvgCheck,{className:"checkbox__icon"})})]});var _path$O,_excluded$X=["title","titleId"];function _extends$Z(){return _extends$Z=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$X(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowDown=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$X(eo,_excluded$X);return reactExports.createElement("svg",_extends$Z({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$O||(_path$O=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.862 9.529c.26-.26.682-.26.943 0L12 13.724l4.195-4.195a.667.667 0 1 1 .943.942l-4.667 4.667a.667.667 0 0 1-.942 0l-4.667-4.667a.667.667 0 0 1 0-.942Z",fill:"currentColor"})))};const getDisplayValue=Xr=>{if(!Xr)return;const{selectedIndex:eo}=Xr;if(eo===void 0)return;const to=Xr.options[eo];if(to.hasAttribute("value"))return to.text},Select=Xr=>{var{children:eo,className:to="",id:ro,label:no,value:io,error:oo=!1,selectDataTestId:ao,message:so}=Xr,co=__rest$7(Xr,["children","className","id","label","value","error","selectDataTestId","message"]);const lo=reactExports.useRef(null),[uo,ho]=reactExports.useState();return reactExports.useLayoutEffect(()=>{if(!io)return;const go=lo.current;ho(getDisplayValue(go))},[io,ho]),jsxRuntimeExports.jsxs("div",{className:"select__field",children:[jsxRuntimeExports.jsxs("div",{className:classNames(to,"select__container"),children:[jsxRuntimeExports.jsxs("label",{className:classNames("select__body",{select__error:oo,select__has_value:!!uo}),htmlFor:ro,children:[jsxRuntimeExports.jsx("span",{className:"select__value",children:uo||jsxRuntimeExports.jsx("span",{children:" "})}),jsxRuntimeExports.jsx("span",{className:"select__label",children:no}),jsxRuntimeExports.jsx("div",{className:"select__control_icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(SvgArrowDown,{})})})]}),jsxRuntimeExports.jsx("select",Object.assign({},co,{"data-testid":ao,ref:lo,id:ro,value:io,placeholder:no,className:"select",children:eo}))]}),so&&jsxRuntimeExports.jsx(Typography,{className:classNames("select__message",{select__message__error:oo}),variant:"body_mini",children:so})]})},renderSelectField=({key:Xr,name:eo,label:to,type:ro,options:no,disabled:io,dataTestId:oo},{errors:ao,touched:so})=>jsxRuntimeExports.jsx(Field$1,{copykey:Xr,as:Select,type:ro,id:eo,name:eo,label:to,error:!!(ao[eo]&&so[eo]),selectDataTestId:oo,message:so[eo]&&getDisplayErrorMessage(to,ao[eo]),disabled:io,children:no.map(co=>typeof co=="string"?jsxRuntimeExports.jsx("option",{value:co,children:co},co):jsxRuntimeExports.jsx("option",{value:co.value,children:co.label},co.value))},eo),renderCheckboxGroup=(Xr,eo,to,ro,no,io,oo)=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:`user-field__checkbox-container ${no[eo]&&io[eo]?"user-field__checkbox-container--error":""}`,children:(ro==null?void 0:ro.checkboxText)&&jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$1,{as:Checkbox,id:Xr,name:eo,type:"checkbox",value:"0",disabled:oo,selectDataTestId:"customFieldCheckbox"},Xr),jsxRuntimeExports.jsx("label",{htmlFor:Xr,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:ro.checkboxText})})]},Xr)},"customConsentGroup"),io[eo]&&getDisplayErrorMessage(to,no[eo])&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"user-field__error-message",children:`${eo.charAt(0).toUpperCase()+eo.slice(1)} is required`})]}),renderPoliciesConsentGroup=(Xr,eo,to)=>jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:"user-field__checkbox-container",children:eo==null?void 0:eo.map((ro,no)=>jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$1,{copykey:Xr,as:Checkbox,id:`policiesConsent_${no}`,name:"policiesConsentArray",type:"checkbox",value:`${no}`,disabled:to},`policiesConsent_${no}`),jsxRuntimeExports.jsx("label",{htmlFor:`policiesConsent_${no}`,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:ro})})]},`policiesConsent_${no}`))},"policiesConsentGroup"),UserField=({fieldData:{validationRules:Xr,isCustom:eo,key:to,label:ro,type:no,autoComplete:io},fieldSettings:{enabled:oo,name:ao,required:so,verify:co,label:lo=ro},errors:uo,touched:ho,disabled:go,policiesConsentInnerComponentArray:bo})=>{if(eo){if(no===CustomFieldType.Select&&(Xr!=null&&Xr.validOptions)){const wo=Xr.validOptions.map(Eo=>Eo.label);return renderSelectField({dataTestId:"customFieldSelect",disabled:go,key:to,label:lo,name:ao,options:wo,type:no},{errors:uo,touched:ho})}else if(no===CustomFieldType.Checkbox)return renderCheckboxGroup(to,ao,lo,Xr,uo,ho,go)}switch(ao){case"tShirtSize":return renderSelectField({dataTestId:"tShirtSizeSelect",disabled:go,key:to,label:lo,name:ao,options:tShirtSizes,type:no},{errors:uo,touched:ho});case"team":return renderSelectField({dataTestId:"teamSelect",disabled:go,key:to,label:lo,name:ao,options:teamNames,type:no},{errors:uo,touched:ho});case"country":return renderSelectField({dataTestId:"countrySelect",disabled:go,key:to,label:lo,name:ao,options:countryCodes.map(wo=>({label:wo.name,value:wo.code})),type:no},{errors:uo,touched:ho});case"policiesConsent":return renderPoliciesConsentGroup(to,bo,go);case"phoneNumber":return jsxRuntimeExports.jsx(Field$1,{name:ao,as:UserPhoneField,disabled:go,label:lo,required:so,error:ho[ao]&&uo[ao]?getDisplayErrorMessage(lo,uo[ao]):void 0,verify:co,autoComplete:io},ao);default:return jsxRuntimeExports.jsx(Field$1,{copykey:to,disabled:go,as:Input,type:no,id:ao,name:ao,label:lo,optional:oo&&!so,error:uo[ao]&&ho[ao],message:ho[ao]&&getDisplayErrorMessage(lo,uo[ao]),autoComplete:io},ao)}},getTooltipMessageKeyForField=({enabled:Xr,name:eo,lockForVerification:to})=>{if(eo==="email"&&!Xr)return"dyn_collect_user_data.update_email_tooltip";if(eo==="phoneNumber"&&!Xr)return"dyn_collect_user_data.update_phone_number_tooltip";if(to)return"dyn_collect_user_data.lock_editing_multiple_verified_fields"},UserDataFields=({errors:Xr,policiesConsentInnerComponentArray:eo,fields:to,touched:ro,currentValues:no,disableEditingMultipleFieldsWithVerification:io,initialValues:oo})=>{const{fieldsConfig:ao}=useFields(),{t:so}=useTranslation(),co=reactExports.useMemo(()=>oo&&no&&to?to.filter(lo=>lo.verify&&oo[lo.name]!==no[lo.name]).map(lo=>lo.name):[],[no,to,oo]);return jsxRuntimeExports.jsx("div",{className:"user-data-fields__fields-column",children:to==null?void 0:to.map(lo=>{const{enabled:uo,name:ho,verify:go}=lo,bo=io&&go&&co.length>0&&!co.includes(ho),wo=!uo||bo,Eo=getTooltipMessageKeyForField({enabled:uo,lockForVerification:bo,name:ho});let $o;lo.type!==KycFieldType.Custom?$o=ao[ho]:$o={isCustom:!0,key:lo.name,label:lo.name,type:lo.validationType,validation:customFieldValidationMap[lo.validationType],validationRules:lo.validationRules};const Co=jsxRuntimeExports.jsx(UserField,{disabled:!!wo,errors:Xr,fieldData:$o,fieldSettings:lo,touched:ro,policiesConsentInnerComponentArray:eo},$o.key);return Eo?jsxRuntimeExports.jsx(Tooltip,{content:so(Eo),className:"user-data-fields__tooltip",copykey:Eo,children:Co},$o.key+"__tooltip"):Co})})},UserProfileForm=({filterFields:Xr,formClassName:eo,fieldsContainerStyle:to,onEditProfileSubmit:ro,onEditProfileCancel:no,options:io={buttonsAsFooter:!0,cancelText:"Cancel",shouldEnforcePolicies:!1,submitText:"Save"}})=>{const{projectSettings:oo,user:ao}=useInternalDynamicContext(),so=reactExports.useMemo(()=>{const bo=getUserProfileFields({customFields:oo==null?void 0:oo.customFields,projectSettingsKyc:oo==null?void 0:oo.kyc,user:ao});return Xr?bo.filter(({name:wo})=>Xr.includes(wo)):bo},[Xr,oo==null?void 0:oo.customFields,oo==null?void 0:oo.kyc,ao]),{fetch:co,formikInitialValues:lo,formikValidationSchema:uo,onFormSubmit:ho}=useUserDataForm({fields:so,onSubmit:ro,shouldEnforcePolicies:io.shouldEnforcePolicies,userProfile:ao}),go=(bo,wo,Eo)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!io.hideCancelButton&&jsxRuntimeExports.jsx(TypographyButton,Object.assign({disabled:co,expanded:!0,buttonPadding:"medium",buttonVariant:"secondary",type:"button",typographyProps:{variant:"button_secondary"},onClick:no,dataTestId:"cancel-button"},io.cancelButtonProps,{children:io.cancelText})),jsxRuntimeExports.jsx(TypographyButton,Object.assign({buttonClassName:"dynamic-widget-footer__button",disabled:co||!wo||!Eo,expanded:!0,type:"submit",buttonPadding:"medium",typographyProps:{variant:"button_secondary"},loading:bo,startSlot:jsxRuntimeExports.jsx(SvgCheck,{}),dataTestId:"submit-button"},io.submitButtonProps,{children:io.submitText}))]});return jsxRuntimeExports.jsx(Formik,{onSubmit:ho,initialValues:lo,validationSchema:uo,validateOnChange:!0,children:({errors:bo,touched:wo,isSubmitting:Eo,isValid:$o,dirty:Co,values:Ro})=>jsxRuntimeExports.jsxs(Form,{className:classNames("dynamic-widget-edit-profile-view",eo),"data-testid":"editUserProfileForm",children:[jsxRuntimeExports.jsx("div",{className:"dynamic-widget-edit-profile-view__fields",style:to,children:jsxRuntimeExports.jsx(UserDataFields,{errors:bo,fields:so,touched:wo,currentValues:Ro,initialValues:lo,disableEditingMultipleFieldsWithVerification:!0})}),io.buttonsAsFooter?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:go(Eo,$o,Co)}):go(Eo,$o,Co)]})})},splitCamelCase=Xr=>Xr.replace(/([a-z])([A-Z])/g,"$1 $2"),useAssignDefaultValues=(Xr,eo)=>{const{appName:to,user:ro}=useInternalDynamicContext(),no=to?`${to} `:"";if(Xr.submitText||(Xr.submitText="Update"),eo.length!==1)return Xr.title||(Xr.title="Update your info"),Xr.subtitle||(Xr.subtitle=`Fill out your info for your ${no}account`),Xr;const[io]=eo,oo=splitCamelCase(io).toLowerCase(),ao=ro!=null&&ro[io]?"Update":"Enter";return Xr.title||(Xr.title=`${ao} your ${oo}`),Xr.subtitle||(Xr.subtitle=`Add your ${oo} to your ${no}account`),Xr};var _path$N,_excluded$W=["title","titleId"];function _extends$Y(){return _extends$Y=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$W(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAt=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$W(eo,_excluded$W);return reactExports.createElement("svg",_extends$Y({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$N||(_path$N=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 4 14.928 1 1 0 1 1 1 1.732A9.96 9.96 0 0 1 11.942 22C6.446 21.968 2 17.503 2 12 2 6.477 6.477 2 12 2s10 4.477 10 10v1.5a3.5 3.5 0 0 1-6.396 1.966A5 5 0 1 1 17 12v1.5a1.5 1.5 0 0 0 3 0V12a8 8 0 0 0-8-8Zm3 8a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z",fill:"currentColor"})))},_path$M,_excluded$V=["title","titleId"];function _extends$X(){return _extends$X=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$V(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgJustifiedText=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$V(eo,_excluded$V);return reactExports.createElement("svg",_extends$X({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$M||(_path$M=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h7a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$L,_excluded$U=["title","titleId"];function _extends$W(){return _extends$W=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$U(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLocation=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$U(eo,_excluded$U);return reactExports.createElement("svg",_extends$W({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$L||(_path$L=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.6 8.067a9.333 9.333 0 0 0-13.2 13.2l5.658 5.657c.52.52 1.363.52 1.884 0l5.658-5.658a9.333 9.333 0 0 0 0-13.199ZM7.515 6.181c4.686-4.686 12.284-4.686 16.97 0 4.687 4.687 4.687 12.285 0 16.97l-4.67 4.67c-.041.042.019-.018-.023.024l-.964.964a3.998 3.998 0 0 1-5.655 0l-5.658-5.657c-4.687-4.686-4.687-12.284 0-16.97ZM16 12a2.667 2.667 0 1 0 0 5.333A2.667 2.667 0 0 0 16 12Zm-5.333 2.667a5.333 5.333 0 1 1 10.666 0 5.333 5.333 0 0 1-10.666 0Z",fill:"currentColor"})))},_path$K,_excluded$T=["title","titleId"];function _extends$V(){return _extends$V=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$T(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMail=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$T(eo,_excluded$T);return reactExports.createElement("svg",_extends$V({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$K||(_path$K=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 7a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7Zm2 2.869V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9.869l-6.336 4.223a3 3 0 0 1-3.328 0L4 9.87Zm16-2.404-7.445 4.963a1 1 0 0 1-1.11 0L4 7.465V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v.465Z",fill:"currentColor"})))},_path$J,_excluded$S=["title","titleId"];function _extends$U(){return _extends$U=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$S(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPhone=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$S(eo,_excluded$S);return reactExports.createElement("svg",_extends$U({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$J||(_path$J=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V5Zm3-1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H8Zm3 14a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$I,_excluded$R=["title","titleId"];function _extends$T(){return _extends$T=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$R(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSizeLabels=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$R(eo,_excluded$R);return reactExports.createElement("svg",_extends$T({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$I||(_path$I=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 2.93 3 3 0 0 1 4.192.05l2.829 2.828A3 3 0 0 1 19.069 12 3 3 0 0 1 22 15v4a3 3 0 0 1-3 3H7a5 5 0 0 1-5-5V5Zm9.071 15H19a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-1.929l-6 6Zm4.878-7.707h.001l1.657-1.657a1 1 0 0 0 0-1.414l-2.829-2.829a1 1 0 0 0-1.414 0L12 7.757v8.486l3.95-3.95ZM9.123 19.12A2.99 2.99 0 0 0 10 17V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a3 3 0 0 0 5.123 2.12ZM6 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$H,_excluded$Q=["title","titleId"];function _extends$S(){return _extends$S=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$Q(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUserCard=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$Q(eo,_excluded$Q);return reactExports.createElement("svg",_extends$S({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$H||(_path$H=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 5a3 3 0 1 1 6 0h4a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h4Zm.17 2H5a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-4.17a3.001 3.001 0 0 1-5.66 0ZM12 4a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V5a1 1 0 0 0-1-1Zm-3 7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2.4 2.8a3 3 0 1 0-4.8 0 4.01 4.01 0 0 0-1.372 1.867 1 1 0 1 0 1.885.666 2.001 2.001 0 0 1 3.773 0 1 1 0 1 0 1.886-.666A4.01 4.01 0 0 0 11.4 13.8ZM14 11a1 1 0 0 1 1-1h3a1 1 0 1 1 0 2h-3a1 1 0 0 1-1-1Zm0 4a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2h-2a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$G,_excluded$P=["title","titleId"];function _extends$R(){return _extends$R=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$P(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUser=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$P(eo,_excluded$P);return reactExports.createElement("svg",_extends$R({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$G||(_path$G=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 0 0-6.598 12.526A14.943 14.943 0 0 1 12 15c2.366 0 4.606.548 6.598 1.526A8 8 0 0 0 12 4Zm7.654 14.436A9.96 9.96 0 0 0 22 12c0-5.523-4.477-10-10-10S2 6.477 2 12a9.96 9.96 0 0 0 2.37 6.464A9.978 9.978 0 0 0 12 22a9.978 9.978 0 0 0 7.654-3.564ZM17.2 18.08A12.954 12.954 0 0 0 12 17c-1.85 0-3.607.386-5.199 1.08A7.968 7.968 0 0 0 12 20c1.985 0 3.8-.723 5.199-1.92ZM12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"currentColor"})))},_path$F,_excluded$O=["title","titleId"];function _extends$Q(){return _extends$Q=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$O(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWorkSuitcase=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$O(eo,_excluded$O);return reactExports.createElement("svg",_extends$Q({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$F||(_path$F=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h2a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2V4ZM5 7a1 1 0 0 0-1 1v4.57A22.95 22.95 0 0 0 12 14c2.815 0 5.51-.505 8-1.43V8a1 1 0 0 0-1-1H5Zm10-2H9V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1Zm5 9.692A24.971 24.971 0 0 1 12 16c-2.796 0-5.487-.46-8-1.308V18a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3.308ZM11 12a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))};const mapFieldToIcon={alias:SvgUser,country:SvgLocation,email:SvgMail,firstName:SvgUserCard,jobTitle:SvgWorkSuitcase,lastName:SvgUserCard,phoneNumber:SvgPhone,tShirtSize:SvgSizeLabels,username:SvgAt},UserFieldsToIcon=({fields:Xr,className:eo})=>{const to=Xr.length===1?mapFieldToIcon[Xr[0]]:void 0;return to?jsxRuntimeExports.jsx(to,{className:eo}):jsxRuntimeExports.jsx(SvgJustifiedText,{className:eo})},UserFieldEditorView=({onClickClose:Xr,onSubmit:eo,fields:to,submitText:ro,subtitle:no,title:io})=>{({submitText:ro,subtitle:no,title:io}=useAssignDefaultValues({submitText:ro,subtitle:no,title:io},to));const oo=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",trailing:oo,children:jsxRuntimeExports.jsxs("div",{className:"user-field-editor__header",children:[jsxRuntimeExports.jsx("div",{className:"user-field-editor__header__icon",children:jsxRuntimeExports.jsx(Icon,{color:"brand-primary",size:"large",children:jsxRuntimeExports.jsx(UserFieldsToIcon,{fields:to})})}),io&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",children:io})]})}),jsxRuntimeExports.jsxs("div",{className:"user-field-editor__body",children:[no&&jsxRuntimeExports.jsx(Typography,{className:"user-field-editor__body__subtitle",variant:"body_normal",color:"secondary",children:no}),jsxRuntimeExports.jsx(UserProfileForm,{filterFields:to,onEditProfileSubmit:eo,formClassName:"user-field-editor__body__form",fieldsContainerStyle:{padding:0},options:{buttonsAsFooter:!1,hideCancelButton:!0,submitButtonProps:{buttonPadding:"large",startSlot:void 0,typographyProps:{variant:"button_primary"}},submitText:ro}})]}),jsxRuntimeExports.jsx(PoweredByDynamic,{asFooter:!0})]})},UserFieldEditorModal=Xr=>{var{onCancel:eo,onSubmit:to,fields:ro}=Xr,no=__rest$7(Xr,["onCancel","onSubmit","fields"]);const[io,oo]=reactExports.useState(!0),ao=reactExports.useRef(!1),so=reactExports.useCallback(()=>{ao.current||eo("User cancelled"),ao.current=!0},[eo]),co=uo=>__awaiter$j(void 0,void 0,void 0,function*(){return to(uo).then(()=>{ao.current=!0,oo(!1)})}),lo=()=>oo(!1);return jsxRuntimeExports.jsx(Portal,{handleClose:lo,isShown:io,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-edit-user-field",transitionEvents:{onUnmount:so},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(UserFieldEditorView,Object.assign({onSubmit:co,onClickClose:lo,fields:ro},no))})})})},DynamicBaseWidget=({children:Xr,shadowDOMProps:eo})=>jsxRuntimeExports.jsx(ShadowDOM,Object.assign({},eo,{children:jsxRuntimeExports.jsx(PopperProvider,{children:Xr})})),UserFieldEditorContext=reactExports.createContext(void 0),UserFieldEditorContextProvider=({children:Xr})=>{const{modal:eo,open:to}=useConfirmationModal({elementId:"dynamic-edit-user-field"}),ro=reactExports.useCallback((no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){return to((oo,ao)=>{const so=co=>io(co).then(lo=>oo({fields:co,updateUserResult:lo}));return jsxRuntimeExports.jsx(DynamicBaseWidget,{children:jsxRuntimeExports.jsx(UserFieldEditorModal,{fields:no.fields,submitText:no.submitText,title:no.title,subtitle:no.subtitle,onCancel:ao,onSubmit:so})})})}),[to]);return jsxRuntimeExports.jsxs(UserFieldEditorContext.Provider,{value:{open:ro},children:[eo,Xr]})},VerticalAccordion=({children:Xr,className:eo,style:to})=>jsxRuntimeExports.jsx("div",{className:classNames(eo,"vertical-accordion__container"),style:to,children:Xr}),isUserLinkingWallet=(Xr,eo,to)=>(Xr==null?void 0:Xr.verifiedCredentials)!==void 0&&eo==="multi-wallet-wallet-list"&&!to,useDynamicLayoutData=({view:Xr,authMode:eo})=>{const{t:to}=useTranslation(),{isTurnkeyWalletWithoutAuthenticator:ro}=useIsTurnkeyWallet(),{selectedWalletConnector:no}=useInternalDynamicContext(),io=reactExports.useMemo(()=>({"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.helper.all_wallet_list",heading:to("dyn_login.helper.all_wallet_list")},"login-with-wallet-only":{copykey:"dyn_login.helper.wallet_only",heading:to("dyn_login.helper.wallet_only")},"passkey-intro":{copykey:"dyn_passkey_intro.helper.title",heading:to("dyn_passkey_intro.helper.title")},"pending-connect":{copykey:"dyn_login.helper.pending_connect.title",heading:to("dyn_login.helper.pending_connect.title")},"pending-signature":{copykey:"dyn_login.helper.pending_signature.title",heading:to("dyn_login.helper.pending_signature.title")},"pending-signature-without-back-button":{copykey:"dyn_login.helper.pending_signature_without_back_button.title",heading:to("dyn_login.helper.pending_signature_without_back_button.title")},"qr-code":{copykey:"dyn_login.helper.qr_code.title",heading:to("dyn_login.helper.qr_code.title")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.helper",heading:to("dyn_wallet_conect.mobile.wallet_list.helper")},"wallet-list":{copykey:"dyn_wallet_list.helper",heading:to("dyn_wallet_list.helper")}}),[to]),oo=reactExports.useMemo(()=>{var co;return{"account-exists":{copykey:"dyn_account_exists.title",heading:to("dyn_account_exists.title")},"chainalysis-blocked-wallet":{copykey:"dyn_chainalysis_blocked_wallet.title",heading:to("dyn_chainalysis_blocked_wallet.title")},"farcaster-connect-view":{copykey:"dyn_login.qr_code.title",heading:to("dyn_login.qr_code.title")},"login-with-email-or-wallet":{copykey:"dyn_login.title.all",heading:to("dyn_login.title.all")},"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.title.all_wallet_list",heading:to("dyn_login.title.all_wallet_list")},"login-with-email-verification":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"login-with-sms-verification":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"login-with-wallet-only":{copykey:"dyn_login.title.wallet_only",heading:to("dyn_login.title.wallet_only")},"merge-user-accounts":{copykey:"dyn_merge_user_accounts.wallet.title",heading:to("dyn_merge_user_accounts.wallet.title")},"merge-user-accounts-conflicts":{copykey:"dyn_merge_user_accounts_conflicts.title",heading:to("dyn_merge_user_accounts_conflicts.title")},"mfa-choose-device":{copykey:"dyn_mfa.choose_device_view.title",heading:to("dyn_mfa.choose_device_view.title")},"mfa-display-backup-codes":{copykey:"dyn_mfa.display_backup_codes_view.title",heading:to("dyn_mfa.display_backup_codes_view.title")},"mfa-recovery":{copykey:"dyn_mfa.recovery_view.title",heading:to("dyn_mfa.recovery_view.title")},"mfa-secure-device":{copykey:"dyn_mfa.secure_device_view.title",heading:to("dyn_mfa.secure_device_view.title")},"mfa-secure-device-help":{copykey:"dyn_mfa.secure_device_view.helper.title",heading:to("dyn_mfa.secure_device_view.helper.title")},"mfa-verification":{copykey:"dyn_mfa.otp_verification_view.title",heading:to("dyn_mfa.otp_verification_view.title")},"mobile-wallet-redirect-view":{copykey:"dyn_login.mobile_wallet_redirect.backup_title",heading:(co=no==null?void 0:no.name)!==null&&co!==void 0?co:to("dyn_login.mobile_wallet_redirect.backup_title")},"multi-wallet-wallet-list":{copykey:eo==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link",heading:to(eo==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link")},"network-not-supported":{copykey:"dyn_network_not_supported.title",heading:to("dyn_network_not_supported.title")},"passkey-recovery-complete":{copykey:ro?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title",heading:to(ro?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title")},"passkey-recovery-start":{copykey:ro?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title",heading:to(ro?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title")},"pending-connect":{copykey:"dyn_login.connect_wallet.title",heading:to("dyn_login.connect_wallet.title")},"pending-signature":{copykey:"dyn_login.sign_wallet.title",heading:to("dyn_login.sign_wallet.title")},"qr-code":{copykey:"dyn_login.qr_code.title",heading:to("dyn_login.qr_code.title")},"select-hardware-wallet":{copykey:"dyn_select_hardware_wallet.title",heading:to("dyn_select_hardware_wallet.title")},"select-wallet-in-wallet-group":{copykey:"dyn_login.select_wallet_in_wallet_group.title",heading:to("dyn_login.select_wallet_in_wallet_group.title")},"verify-email":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"verify-sms":{copykey:"dyn_otp_verification.confirm_code",heading:to("dyn_otp_verification.confirm_code")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.title",heading:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(WalletConnectIcon,{style:{height:"1.5rem",width:"1.5rem"}})," ",to("dyn_wallet_conect.mobile.wallet_list.title")]})},"wallet-group":{copykey:"dyn_login.wallet_group.title",heading:to("dyn_login.wallet_group.title")},"wallet-list":{copykey:"dyn_wallet_list.title.select",heading:to("dyn_wallet_list.title.select")},"wallet-sign":{copykey:"dyn_wallet_transfer.sign.title",heading:to("dyn_wallet_transfer.sign.title")},"wallet-used":{copykey:"dyn_wallet_link.title",heading:to("dyn_wallet_link.title")}}},[eo,ro,no==null?void 0:no.name,to]);if(Xr==="no-access")return{headerData:{copykey:"dyn_no_access.title",heading:to("dyn_no_access.title")}};if(Xr==="access-blocked")return{headerData:{copykey:"dyn_access_blocked.title",heading:to("dyn_access_blocked.title")}};const ao=io[Xr];return{headerData:oo[Xr],helpHeaderData:ao}},useAuthLayoutChecks=()=>{var Xr;const{view:eo}=useViewContext(),{user:to,customPrivacyPolicy:ro,customTermsOfServices:no,privacyPolicyUrl:io,termsOfServiceUrl:oo,isBridgeFlow:ao,authMode:so,projectSettings:co}=useInternalDynamicContext(),{isFooterExpanded:lo}=useFooterAnimationContext(),{mockedSDK:uo}=useMockContext(),{helpHeaderData:ho}=useDynamicLayoutData({authMode:so,view:eo.type}),go=eo.type!=="wallet-list"&&eo.type!=="login-with-email-or-wallet-full-wallet-list"&&eo.type!=="multi-wallet-wallet-list"&&eo.type!=="login-with-wallet-only"||lo,bo=eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="wallet-list"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only",wo=!!(ho&&!(eo.type==="qr-code"||eo.type==="no-qr-not-installed"||eo.type==="wallet-used"||eo.type==="chainalysis-blocked-wallet"||eo.type==="wallet-sign"||eo.type==="collect-user-data"||eo.type==="passkey-new-domain-detected"||isUserLinkingWallet(to,eo.type,uo))),Eo=eo.type!=="collect-user-data"&&eo.type!=="no-access"&&eo.type!=="chainalysis-blocked-wallet"&&eo.type!=="wallet-locked-view"&&eo.type!=="gate-blocked-wallet"&&eo.type!=="email-wallet-otp-verification-view"&&eo.type!=="bridge-welcome"&&eo.type!=="bridge-summary"&&eo.type!=="bridge-next-wallet-connection"&&eo.type!=="passkey-intro"&&eo.type!=="passkey-new-domain-detected"&&eo.type!=="social-redirect-view"&&eo.type!=="collect-user-data-login-no-wallet"&&eo.type!=="passkey-recovery-bundle"&&eo.type!=="passkey-recovery-start"&&eo.type!=="embedded-reveal-view"&&eo.type!=="embedded-reveal-account-view"&&eo.type!=="rename-passkey"&&eo.type!=="create-password-view"&&eo.type!=="embedded-wallet-auth-choice"&&eo.type!=="wallet-claim-intro"&&eo.type!=="passkey-recovery-add-email"&&eo.type!=="global-wallet-confirm"&&eo.type!=="global-wallet-malicious"&&eo.type!=="global-wallet-info"&&eo.type!=="mfa-choose-device"&&eo.type!=="mfa-verification",$o=ao&&(eo.type==="wallet-list"||eo.type==="qr-code"||eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="pending-connect"||eo.type==="pending-signature"||eo.type==="pending-signature-without-back-button"||eo.type==="bridge-next-wallet-connection"||eo.type==="bridge-summary"),Co=!!(!isUserLinkingWallet(to,eo.type,uo)&&(eo.type==="wallet-list"||eo.type==="wallet-connect-mobile-wallets-list"||(eo.type==="login-with-email-or-wallet"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only"||eo.type==="multi-wallet-wallet-list")&&(oo||io||ro||no))),Ro=!!(!((Xr=co==null?void 0:co.sdk)===null||Xr===void 0)&&Xr.displayDynamicMessaging)&&(eo.type==="login-with-email-or-wallet"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="login-with-wallet-only"||eo.type==="login-with-email-verification"||eo.type==="login-with-sms-verification"||eo.type==="verify-email"||eo.type==="verify-sms"||eo.type==="pending-connect"||eo.type==="wallet-group"||eo.type==="select-wallet-in-wallet-group"||eo.type==="select-hardware-wallet"||eo.type==="pending-signature"||eo.type==="qr-code"||eo.type==="wallet-used"||eo.type==="email-wallet-otp-verification-view"||eo.type==="farcaster-connect-view"||eo.type==="merge-user-accounts"||eo.type==="merge-user-accounts-conflicts"||eo.type==="mfa-verification"||eo.type==="mfa-display-backup-codes"||eo.type==="mfa-recovery"),Oo=eo.type!=="login-with-email-or-wallet-full-wallet-list"&&eo.type!=="login-with-email-verification"&&eo.type!=="login-with-sms-verification"&&eo.type!=="network-not-supported"&&eo.type!=="passkey-recovery-complete"&&eo.type!=="passkey-recovery-start"&&eo.type!=="passkey-recovery-bundle"&&eo.type!=="rename-passkey"&&eo.type!=="mobile-wallet-redirect-view"&&eo.type!=="qr-code"&&eo.type!=="mfa-verification"&&eo.type!=="mfa-display-backup-codes"&&eo.type!=="mfa-recovery",jo=eo.type==="pending-signature"||eo.type==="no-qr-not-installed"||eo.type==="wallet-connect-mobile-wallets-list"||eo.type==="login-with-email-verification"||eo.type==="login-with-sms-verification"||eo.type==="login-with-email-or-wallet-full-wallet-list"||eo.type==="wallet-group"||eo.type==="select-wallet-in-wallet-group"||eo.type==="select-hardware-wallet"||eo.type==="pending-connect"||eo.type==="mobile-wallet-redirect-view"||eo.type==="account-exists"||eo.type==="passkey-intro"||eo.type==="qr-code"||eo.type==="farcaster-connect-view"||eo.type==="mfa-verification"||eo.type==="mfa-secure-device-help"||eo.type==="merge-user-accounts-conflicts"||eo.type==="mfa-recovery"||eo.type==="merge-user-accounts-with-same-email"&&!to;return{displayBorderBelowHeader:go,isWalletListTypeView:bo,shouldHideDynamicFooterSeparator:Ro&&Co,showBackButton:jo,showCloseButton:Oo,showConnectedWalletProgress:$o,showDefaultFooter:!$o&&!Ro&&!Co,showDynamicFooter:Ro,showHeader:Eo,showHelpContent:wo,showToSFooter:Co}},DynamicFooter=()=>{const{shouldHideDynamicFooterSeparator:Xr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{"data-testid":"dynamic-footer",className:classNames("dynamic-footer",{"dynamic-footer__top-border":!Xr}),children:jsxRuntimeExports.jsx(PoweredByDynamic,{})})};var _path$E,_excluded$N=["title","titleId"];function _extends$P(){return _extends$P=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$N(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterInfoIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$N(eo,_excluded$N);return reactExports.createElement("svg",_extends$P({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$E||(_path$E=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.833ZM8.333 10c0-.46.374-.833.834-.833H10c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 8.333 10Z",fill:"currentcolor"})))},_path$D,_path2$5,_excluded$M=["title","titleId"];function _extends$O(){return _extends$O=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$M(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgQuestionMark=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$M(eo,_excluded$M);return reactExports.createElement("svg",_extends$O({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$D||(_path$D=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.25a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Z",fill:"currentcolor"})),_path2$5||(_path2$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.31 7.044a1.784 1.784 0 0 0-1.133.192 1.513 1.513 0 0 0-.699.783.792.792 0 0 1-1.481-.559c.26-.689.768-1.257 1.42-1.613a3.368 3.368 0 0 1 2.144-.367 3.262 3.262 0 0 1 1.908 1.023c.496.55.775 1.254.774 1.99 0 1.201-.948 1.972-1.587 2.369a6.63 6.63 0 0 1-1.354.635l-.028.01-.008.002h-.003l-.002.001-.235-.756.235.756A.792.792 0 0 1 9.789 10h.001m0 0 .014-.005.06-.021a5.054 5.054 0 0 0 .956-.456c.575-.357.84-.717.84-1.024 0-.332-.125-.66-.367-.928a1.68 1.68 0 0 0-.982-.521M9.265 13.77c0-.438.355-.792.792-.792h.01a.792.792 0 1 1 0 1.584h-.01a.792.792 0 0 1-.792-.792Z",fill:"currentcolor"})))};const Header=({onClose:Xr,heading:eo,projectSettings:to,copykey:ro})=>{const{setError:no}=useErrorContext(),{isFooterExpanded:io,setIsFooterExpanded:oo}=useFooterAnimationContext(),{selectedWalletConnector:ao}=useInternalDynamicContext(),{goToInitialView:so,view:co,setView:lo}=useViewContext(),{showBackButton:uo,showCloseButton:ho,showHelpContent:go,isWalletListTypeView:bo,displayBorderBelowHeader:wo}=useAuthLayoutChecks(),{setExistentAccountData:Eo}=useAccountExistsContext(),{setSocialProvider:$o}=useSocialRedirectContext(),Co=reactExports.useCallback(()=>{var Bo;if(!((Bo=co.events)===null||Bo===void 0)&&Bo.onBackClick){co.events.onBackClick();return}if(co.type==="farcaster-connect-view"&&($o(void 0),dynamicEvents.emit("farcasterConnectCancelled"),dynamicEvents.emit("authFailure",{option:ProviderEnum.Farcaster,provider:ProviderEnum.Farcaster,type:"social"},"user-cancelled")),Eo(void 0),no(void 0),co.type==="no-qr-not-installed"&&(ao!=null&&ao.canConnectViaQrCode)){lo("qr-code");return}so()},[co.type,co.events,so,Eo,no,$o,lo,ao]),Ro=ho&&Xr&&jsxRuntimeExports.jsx(IconButton,{onClick:Xr,type:"button",id:"close-button","data-testid":"close-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgClose,{})}),Oo=go&&jsxRuntimeExports.jsx(Tooltip,{content:"Need some help?",className:"header__tooltip",children:jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>oo(!io),"data-testid":"info-button",className:"header__icon",children:bo?jsxRuntimeExports.jsx(SvgQuestionMark,{}):jsxRuntimeExports.jsx(SvgFooterInfoIcon,{})})},"info-button"),jo=[];return uo&&jo.push(jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Co,"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})},"back-button")),Ro&&Oo&&jo.push(Oo),jsxRuntimeExports.jsx(ModalHeader,{leading:jo,trailing:Ro||Oo,displayBorder:wo,children:(!to||!!eo)&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:ro,children:to?eo:jsxRuntimeExports.jsx(Skeleton,{className:"header__skeleton"})})})},EmptyHelpContent=()=>jsxRuntimeExports.jsx("div",{"data-testid":"empty-help-content"});var _path$C,_excluded$L=["title","titleId"];function _extends$N(){return _extends$N=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$L(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterEyeIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$L(eo,_excluded$L);return reactExports.createElement("svg",_extends$N({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$C||(_path$C=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.995 4.167c3.965 0 6.643 2.655 7.937 4.675a2.14 2.14 0 0 1 0 2.316c-1.294 2.02-3.972 4.675-7.937 4.675-3.965 0-6.643-2.655-7.937-4.675a2.14 2.14 0 0 1 0-2.316c1.294-2.02 3.972-4.675 7.937-4.675ZM14.16 10a4.167 4.167 0 1 1-8.333 0 4.167 4.167 0 0 1 8.333 0Zm-4.12 2.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",fill:"currentColor"})))},_path$B,_excluded$K=["title","titleId"];function _extends$M(){return _extends$M=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$K(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterGasIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$K(eo,_excluded$K);return reactExports.createElement("svg",_extends$M({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$B||(_path$B=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.667 18.333a2 2 0 0 0 2-2V3.667a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v12.666a2 2 0 0 0 2 2h6ZM9 8.333a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1H4.333a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1H9ZM17.5 5.833c.46 0 .833.373.833.834v7.5H17.5h.833V14.186a1.201 1.201 0 0 1-.005.113 2.881 2.881 0 0 1-.29 1.075c-.155.307-.398.64-.779.893-.386.258-.863.4-1.426.4-.562 0-1.04-.142-1.425-.4a2.295 2.295 0 0 1-.778-.893 2.878 2.878 0 0 1-.296-1.16v-.045l.833-.001h-.834V9.185l-.001-.011a.2.2 0 0 0-.015-.051v-.001s.005.008.016.02V7.5c.354 0 .675.091.944.27.264.176.43.404.53.607A1.856 1.856 0 0 1 15 9.13v.035c0 .001 0 .002-.832.002H15v4.992l.001.02a1.228 1.228 0 0 0 .12.448c.054.11.123.194.211.253.083.055.23.12.501.12s.419-.065.502-.12a.633.633 0 0 0 .211-.253 1.218 1.218 0 0 0 .12-.468V6.667c0-.46.374-.834.834-.834ZM13.378 9.17h.002-.002Z",fill:"currentColor"})))},_path$A,_excluded$J=["title","titleId"];function _extends$L(){return _extends$L=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$J(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFooterKeyIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$J(eo,_excluded$J);return reactExports.createElement("svg",_extends$L({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$A||(_path$A=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.125 6.875a5 5 0 1 0-10 0 5 5 0 0 0 10 0Zm-2.5 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Zm-7.809 3.243a6.258 6.258 0 0 0 1.671 1.865L7.13 14.34l1.752 1.753-1.768 1.767-1.752-1.752-1.718 1.718-1.768-1.767 5.941-5.942Z",fill:"currentColor"})))};const isHardwareWalletEnabled=Xr=>Xr!=null&&isHardwareWalletConnector(Xr)&&Xr.isHardwareWalletEnabled,EnterTileAnimation=({children:Xr,className:eo="",delay:to=0,dataTestId:ro})=>{const no=reactExports.useMemo(()=>({animationDelay:to}),[to]);return jsxRuntimeExports.jsx("div",{"data-testid":ro,className:classNames(eo,"enter-list-tile-animation"),style:no,children:Xr})},InfoItem=({title:Xr,content:eo,Icon:to,className:ro="",iconClassName:no="",textClassName:io=""})=>jsxRuntimeExports.jsxs("div",{className:classNames("info-item__container",ro),children:[jsxRuntimeExports.jsx("div",{className:classNames("info-item__icon-container",no,{"icon-container--has-content":!!eo}),children:jsxRuntimeExports.jsx(to,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{as:"h2",className:io,variant:"body_normal",color:"primary",weight:"medium",children:Xr}),eo&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"info-item__secondary-text",children:eo})]})]}),WalletMoreInfoContent=({variant:Xr,wallet:eo})=>{const to={info:[{content:"Signing proves you have access to your wallet. It’s a bit like verifying your email by clicking an email confirmation link in your inbox during signup. This does not approve a transaction.",icon:SvgFooterKeyIcon,title:"Confirms you own your wallet"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},ro=isHardwareWalletEnabled(eo)?{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{content:jsxRuntimeExports.jsxs("div",{className:"footer-more-info-content__item--phantom-ledger",children:[jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Ledger does not support message signing functionality, commonly used to log in to sites. Instead, we sign a transaction as a proxy to prove ownership of the wallet."}),jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"body_small",weight:"regular",children:[jsxRuntimeExports.jsx("strong",{children:"Important"}),": we do not"," ",jsxRuntimeExports.jsx("strong",{children:"broadcast"})," this transaction, meaning Ledger based login will still be gasless."]}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Phantom in turn shows that a fee may apply as part of the “transaction”."}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"As always, please be cautious of the extensions and websites you use to prevent unwanted transactions from being broadcasted to the network."})]}),icon:SvgFooterGasIcon,title:"Why do I see a fee when using ledger"}]}:to,no={connect:{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},sign:ro};return jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__wrapper",children:no[Xr].info.map((io,oo)=>jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__item",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:`${.3+oo*.2}s`,children:jsxRuntimeExports.jsx(InfoItem,{Icon:io.icon,title:io.title,content:io.content})})},oo))})};var _path$z,_excluded$I=["title","titleId"];function _extends$K(){return _extends$K=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$I(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPuzzle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$I(eo,_excluded$I);return reactExports.createElement("svg",_extends$K({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$z||(_path$z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.044 20.998a.693.693 0 0 0 .7-.68V16.59c.239-2.01 1.121-1.413 2.16-.791 2.51 1.502 4.177-2.45 2.148-3.67-1.592-.956-2.281.689-3.448.52-.45-.067-.763-.54-.862-1.261V8.693a.692.692 0 0 0-.7-.68h-3.21c-2.65-.327-.297-1.755-.297-3.083.001-1.066-.99-1.93-2.214-1.93-1.222 0-2.344.864-2.344 1.93 0 1.253 2.435 2.756-.253 3.083H3.7a.692.692 0 0 0-.699.68v2.688c.205 1.146 1.001 1.411 2.021.655.344-.256.924-.554 1.344-.554 1.094 0 1.982.965 1.982 2.154 0 1.19-.887 2.416-1.982 2.416-.39 0-.755-.123-1.063-.338 0 .091-1.913-1.674-2.302.486v4.121c0 .375.315.68.699.68L10.16 21c.085-.393-.191-.844-.45-1.234-2.04-3.075 5.895-3.382 3.855.095-.1.172-.2.338-.277.5-.098.202-.162.45-.149.639l2.905-.002Z",fill:"currentColor"})))};const parseWalletLinks=Xr=>{const eo=isIPhone()||isIPad(),to=detectBrowserName()||"chrome";let ro;switch(to){case"edge":ro=Xr.edge;break;case"firefox":ro=Xr.firefox;break;case"chrome":default:ro=Xr.chrome;break}const no=!eo&&!!Xr.android,io=(eo||!isMobile$1())&&!!Xr.ios;return{canShowAndroidAppButton:no,canShowIosAppButton:io,currentDesktopUrl:ro,hasMobileAppUrl:no||io,userBrowser:to}},isWalletGroup=Xr=>{var eo;return!!(!((eo=Xr.groupedWallets)===null||eo===void 0)&&eo.length)},getLastUsedWalletKey=()=>StorageService.getItem(LAST_USED_WALLET),getWalletGroupLabel=(Xr,eo)=>{const to=eo==null?void 0:eo.find(oo=>Xr.groupedWallets.some(ao=>oo.walletKey===ao.walletConnector.key));if(to)return{isRecommended:!0,label:to.label||"Recommended"};const ro=getLastUsedWalletKey();if(Xr.groupedWallets.some(oo=>oo.walletConnector.key===ro))return{label:"Last used"};if(Xr.groupedWallets.some(oo=>oo.isInstalledOnBrowser))return{label:"Installed"};if(getWalletGroupType(Xr)==="multi-chain")return{label:"Multichain"}},getWalletLabel=(Xr,eo)=>{const to=getLastUsedWalletKey(),{key:ro}=Xr.walletConnector,no=eo==null?void 0:eo.find(oo=>oo.walletKey===ro);if(no)return{isRecommended:!0,label:no.label||"Recommended"};if(ro===to)return{label:"Last used"};if(Xr.isInstalledOnBrowser)return{label:"Installed"}},getWalletListItemLabel=({wallet:Xr,recommendedWallets:eo})=>isWalletGroup(Xr)?getWalletGroupLabel(Xr,eo):getWalletLabel(Xr,eo),isProgrammableNetworkSwitchSupported=Xr=>{const to=new URLSearchParams(window.location.search).get("dev_isProgrammableNetworkSwitchSupported");return to?to==="true":Xr.switchNetworkOnlyFromWallet!==!0},getWalletConnectorNetworks=Xr=>{if(!Xr)return[];const eo=Xr;return eo.evmNetworks||eo.starknetNetworks||[]},isSupportedNetwork=({walletConnector:Xr,network:eo})=>{const to=getWalletConnectorNetworks(Xr);return to.length?to.some(({chainId:no})=>String(no)===String(eo)):!0},useHandleWalletsToConnect=()=>{const{bridgeChains:Xr,bridgeChainsToConnect:eo,setShowAuthFlow:to,bridgeOnboardingCompleted:ro,setBridgeOnboardingCompleted:no}=useInternalDynamicContext(),{setView:io,goToInitialView:oo}=useViewContext();return{handleWalletsToConnect:({walletConnector:so})=>{if(!Xr){to(!1);return}if(!eo){no(!0),to(!1);return}if(eo.length===0||!so||!so.connectedChain)return to(!1),oo();if(eo.filter(uo=>uo.chain!==(so==null?void 0:so.connectedChain)).length===0){ro?(to(!1),oo()):(no(!0),io("bridge-summary"));return}io("bridge-next-wallet-connection")}}},specialCareWallets=["bloctoevm","perawallet","metamaskstarknet"],showPendingConnectView=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const to=getWalletProvider(Xr);if(to==="walletConnect"||to==="qrCode")return;specialCareWallets.forEach(no=>{Xr.key===no&&eo("pending-connect")}),(yield Xr.getConnectedAccounts()).length===0&&eo("pending-connect")}),isConnectOnly=(Xr,eo)=>eo==="connect-only"&&!(Xr!==void 0),useConnectAndSign=({shouldUpdateWallets:Xr=!0,shouldCallCallback:eo=!0}={})=>{const{setView:to,goToInitialView:ro}=useViewContext(),{engageCaptcha:no,getCaptchaToken:io}=useCaptchaContext(),{setErrorMessage:oo}=useErrorContext(),{authMode:ao,connectWallet:so,consumeNonce:co,displaySiweStatement:lo,environmentId:uo,projectSettings:ho,networkValidationMode:go,setIsSingleWalletAccount:bo,user:wo,walletUiUtils:Eo}=useInternalDynamicContext(),{handleWalletsToConnect:$o}=useHandleWalletsToConnect(),Co=useVerifyWallet({consumeNonce:co,displaySiweStatement:lo,environmentId:uo,projectSettings:ho,setIsSingleWalletAccount:bo}),Ro=(jo,Bo,Mo)=>__awaiter$j(void 0,void 0,void 0,function*(){!isEmailWalletConnector(jo)||isBloctoConnector(jo)?to("pending-signature"):Eo.disabledConfirmationOnce(),yield Co({captchaToken:Mo,publicWalletAddress:Bo,walletConnector:jo})}),Oo=jo=>{var Bo;(jo==null?void 0:jo.code)==="user-cancelled"||logger$8.debug(jo),oo((Bo=jo==null?void 0:jo.code)===null||Bo===void 0?void 0:Bo.toString()),ro()};return jo=>__awaiter$j(void 0,[jo],void 0,function*({walletConnector:Bo,getAddressOpts:Mo=void 0}){var Fo;try{yield showPendingConnectView(Bo,to),isEmailWalletConnector(Bo)&&(isEmailOTPWalletConnector(Bo)?to("email-wallet-otp-verification-view"):isBloctoConnector(Bo)||to("wait-for-email-confirmation-view"));const Wo=yield so(Bo,Mo,{applyHandleConnectedWallet:eo});if(!(Wo!=null&&Wo.address))return;const{address:Jo}=Wo,Po=yield Bo.getNetwork();if(!isSupportedNetwork({network:Po,walletConnector:Bo})&&(go==="always"||go==="sign-in"))return isProgrammableNetworkSwitchSupported(Bo)?to("network-not-supported"):to("network-not-supported-manual");if(isConnectOnly(wo,ao)){StorageService.setItem(LAST_USED_WALLET,Bo.key),Xr&&$o({walletConnector:Bo});return}if(!((Fo=ho==null?void 0:ho.security.hCaptcha)===null||Fo===void 0)&&Fo.enabled){no({authMethod:"wallet",onCaptchaSuccess:vo=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield Ro(Bo,Jo,vo)}catch(_o){Oo(_o)}})});return}yield Ro(Bo,Jo,io())}catch(Wo){Oo(Wo)}})},walletsRequiringTwoStepAuthentication=["dapper"],requiresTwoStepAuthentication=Xr=>isMobile$1()&&!(Xr!=null&&Xr.canConnectViaCustodialService)||walletsRequiringTwoStepAuthentication.includes((Xr==null?void 0:Xr.key)||""),useConnectAndSignSplitSteps=()=>{const{setView:Xr,goToInitialView:eo}=useViewContext(),{setErrorMessage:to}=useErrorContext(),{getCaptchaToken:ro,engageCaptcha:no}=useCaptchaContext(),{connectWallet:io,consumeNonce:oo,displaySiweStatement:ao,projectSettings:so,environmentId:co,networkValidationMode:lo,setIsSingleWalletAccount:uo,setShowAuthFlow:ho,user:go,authMode:bo}=useInternalDynamicContext(),{handleWalletsToConnect:wo}=useHandleWalletsToConnect(),Eo=useVerifyWallet({consumeNonce:oo,displaySiweStatement:ao,environmentId:co,projectSettings:so,setIsSingleWalletAccount:uo}),$o=Oo=>{var jo;logger$8.debug(Oo),!(Oo instanceof MissingPublicAddressError&&isMobile$1())&&(eo(),to((jo=Oo.code)!==null&&jo!==void 0?jo:Oo.toString()))};return{onlyConnectUser:Oo=>__awaiter$j(void 0,[Oo],void 0,function*({walletConnector:jo,getAddressOpts:Bo=void 0,shouldShowPendingConnectView:Mo=!0}){var Fo;Mo&&(yield showPendingConnectView(jo,Xr));try{if(yield io(jo,Bo),isConnectOnly(go,bo)){StorageService.setItem(LAST_USED_WALLET,jo.key),wo({walletConnector:jo});return}if(!((Fo=so==null?void 0:so.security.hCaptcha)===null||Fo===void 0)&&Fo.enabled){no({authMethod:"wallet",onCaptchaSuccess:Wo=>__awaiter$j(void 0,void 0,void 0,function*(){ho(!0),Xr("pending-signature")})});return}ho(!0),Xr("pending-signature")}catch(Wo){$o(Wo);return}}),signAlreadyConnectedUser:Oo=>__awaiter$j(void 0,[Oo],void 0,function*({walletConnector:jo,getAddressOpts:Bo=void 0}){try{const Mo=yield io(jo,Bo);if(!(Mo!=null&&Mo.address))return;const Fo=yield jo.getNetwork();if(!isSupportedNetwork({network:Fo,walletConnector:jo})&&(lo==="always"||lo==="sign-in"))return isProgrammableNetworkSwitchSupported(jo)?Xr("network-not-supported"):Xr("network-not-supported-manual");yield Eo({captchaToken:ro(),publicWalletAddress:Mo.address,walletConnector:jo})}catch(Mo){$o(Mo);return}})}},isSelectedWalletAlreadyConnected=(Xr,eo,to)=>to?Xr.map(({connector:ro})=>ro.key).includes(eo.key):!1,useWalletItemActions=()=>{const{setMultiWalletWidgetState:Xr,setShowAuthFlow:eo,setSelectedWalletConnectorKey:to,walletConnectorOptions:ro,setQrcodeUri:no,setDesktopUri:io,user:oo,linkedWallets:ao,setLegacyIsVerifying:so,authMode:co}=useInternalDynamicContext(),{mockedSDK:lo}=useMockContext(),{setError:uo,setErrorMessage:ho}=useErrorContext(),{setView:go,goToInitialView:bo}=useViewContext(),{onlyConnectUser:wo}=useConnectAndSignSplitSteps(),Eo=useConnectAndSign(),$o=Fo=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleCustodialWalletClick",Fo);const Wo=requiresTwoStepAuthentication(Fo);logger$8.logVerboseTroubleshootingMessage("[handleCustodialWalletClick]",{twoStepAuthentication:Wo}),Wo?(to(Fo.key),yield wo({walletConnector:Fo})):(to(Fo.key),Xr("awaiting_signature",void 0,"linking_new_wallet")),go("pending-signature")}),Co=Fo=>__awaiter$j(void 0,void 0,void 0,function*(){var Wo;if(logger$8.debug("handleMobileWalletClick",Fo),to(Fo.key),Fo.key==="phantom"){const Po=StorageService.getItem(PHANTOM_SIGNATURE_STATE);StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:(Wo=Po==null?void 0:Po.loseOriginalAccountOnTransfer)!==null&&Wo!==void 0?Wo:!1,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_verification"})}const Jo=()=>{wo({shouldShowPendingConnectView:!1,walletConnector:Fo})};go("mobile-wallet-redirect-view",{onRetry:Jo}),Jo()}),Ro=Fo=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleInstalledExtensionClick",Fo),to(Fo.key),co==="connect-only"?(go("pending-connect"),wo({walletConnector:Fo})):Xr("awaiting_signature",void 0,"linking_new_wallet")}),Oo=Fo=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleUninstalledClick",Fo),to(Fo.key),Fo.canConnectViaQrCode?(Eo({getAddressOpts:{onDesktopUri:Wo=>__awaiter$j(void 0,void 0,void 0,function*(){io(Wo)}),onDisplayUri:Wo=>__awaiter$j(void 0,void 0,void 0,function*(){no(Wo)})},walletConnector:Fo}),go("qr-code")):go("no-qr-not-installed"),uo(void 0)}),jo=Fo=>__awaiter$j(void 0,void 0,void 0,function*(){logger$8.debug("handleAlreadyConnectedWallet",Fo),eo(!1);const Wo=yield Fo.getConnectedAccounts(),Jo=ao.find(Po=>{var fo;return Po.address.toLowerCase()===((fo=Wo[0])===null||fo===void 0?void 0:fo.toLowerCase())});logger$8.logVerboseTroubleshootingMessage("[handleAlreadyConnectedWallet]",{activeAccountAlreadyLinked:Jo,connectedAccounts:Wo,linkedWallets:ao}),Jo?Xr("awaiting_account_switch","linking_new_wallet"):Xr("awaiting_signature",void 0,"linking_new_wallet"),to(Fo.key)});return{handleAlreadyConnectedWallet:jo,handleCustodialWalletClick:$o,handleInstalledExtensionClick:Ro,handleMobileWalletClick:Co,handleUninstalledClick:Oo,handleWalletItemClick:Fo=>__awaiter$j(void 0,void 0,void 0,function*(){const{walletConnector:Wo,isInstalledOnBrowser:Jo}=Fo,Po=Wo.connectedChain==="FLOW"||isPhantomRedirectConnector(Wo);if(logger$8.logVerboseTroubleshootingMessage("[handleWalletItemClick]",{mockedSDK:lo,shouldEndWalletConnectorSession:Po,wallet:Fo}),lo)return;Po&&(yield Wo.endSession()),so(!1);const fo=Wo.key==="metamask";if(co!=="connect-only"&&fo)try{to(Wo.key),go("pending-connect"),yield Wo.chooseAccountsToConnect()}catch(yo){if(yo instanceof UserRejectedRequestError){ho("connection_rejected"),bo();return}}isSelectedWalletAlreadyConnected(ao,Wo,oo)&&Wo.connectedChain!=="FLOW"?jo(Wo):Wo.canConnectViaCustodialService?$o(Wo):isMobile$1()?Wo.key==="walletconnect"?go("wallet-connect-mobile-wallets-list"):Co(Wo):Jo?Ro(Wo):Oo(Wo)}),openWallet:(Fo,Wo)=>{var Jo;const{openMobileWallet:Po=Co,openCustodialWallet:fo=$o,openExtensionWallet:yo=Ro}=Wo||{},vo=(Jo=ro.find(_o=>_o.key===Fo))===null||Jo===void 0?void 0:Jo.walletConnector;vo&&(isMobile$1()?Po(vo):vo.canConnectViaCustodialService?fo(vo):vo.isInstalledOnBrowser()&&yo(vo))}}},ListTileAnimatedTrailing=({hoverElement:Xr,children:eo})=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"list-tile-animated-trailing",children:[jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__child",children:eo}),jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__hover-element",children:Xr})]})}),ListTile=({children:Xr,onClick:eo,leading:to,disabled:ro=!1,trailing:no,style:io,className:oo="",dataTestId:ao,copykey:so})=>jsxRuntimeExports.jsxs("button",{"data-testid":ao,type:"button",className:classNames(oo,"list-tile"),onClick:eo,style:io,disabled:ro,children:[to,jsxRuntimeExports.jsx("div",{className:"list-tile__children",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",copykey:so,children:Xr})}),no]}),WalletListItem=({disabled:Xr=!1,wallet:eo,onResetSearchValue:to,recommendedWallets:ro,tile:no=({leading:io,name:oo,onClick:ao,trailing:so})=>jsxRuntimeExports.jsx(ListTile,{leading:io,trailing:so,onClick:ao,className:"wallet-list-item__tile",dataTestId:"ListTile",children:oo})})=>{const{navigateToWalletGroup:io}=useWalletGroupContext(),{setView:oo}=useViewContext(),ao=isWalletGroup(eo),{walletBook:so}=useWalletBookContext(),{handleWalletItemClick:co}=useWalletItemActions(),lo=getWalletListItemLabel({recommendedWallets:ro,wallet:eo}),uo=no,ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr){if(to==null||to(""),ao)return io(eo);if(isHardwareWalletConnector(eo.walletConnector)&&eo.walletConnector.canConnectWithHardwareWallet()){oo("select-hardware-wallet",{onSelectWallet:co,wallet:eo});return}yield co(eo)}}),go=ao?getWalletGroup(so,eo.key).name:getWalletBookWallet(so,eo.key).name,bo=jsxRuntimeExports.jsx(WalletIcon,{className:"wallet-list-item__leading",walletKey:eo.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}),wo=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:lo&&jsxRuntimeExports.jsx(Badge,{dot:!lo.isRecommended,variant:lo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:lo.label})})});return jsxRuntimeExports.jsx(uo,{leading:bo,trailing:wo,name:go,onClick:ho})},NewToWeb3WalletItem=({children:Xr,style:eo,wallet:to})=>jsxRuntimeExports.jsx(WalletListItem,{wallet:to,tile:Xr?({onClick:ro})=>jsxRuntimeExports.jsx("button",{className:"new-to-web3--button",style:eo,onClick:ro,children:Xr}):void 0}),Item=({heading:Xr,StartIcon:eo,EndIcon:to,message:ro,url:no})=>jsxRuntimeExports.jsxs("a",{className:"footer-buttons-item",href:no,rel:"noopener noreferrer",target:"_blank",children:[jsxRuntimeExports.jsx("div",{className:"footer-buttons-item__icon--left",children:jsxRuntimeExports.jsx(eo,{})}),jsxRuntimeExports.jsxs("div",{className:"footer-buttons-item__typography",children:[jsxRuntimeExports.jsx(Typography,{as:"h2",weight:"regular",color:"primary",variant:"body_normal",children:Xr}),ro&&jsxRuntimeExports.jsx(Typography,{as:"p",weight:"regular",color:"secondary",children:ro})]}),to&&jsxRuntimeExports.jsx(to,{style:{height:"1.5rem",width:"1.5rem"}})]}),WalletExtensionOrAppContinueButton=({wallet:Xr,selectedUrl:eo})=>{const to=!!eo.length&&!(Xr!=null&&Xr.isInstalledOnBrowser),ro=()=>{Xr!=null&&Xr.key&&(StorageService.setItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY,Xr.key),window.location.reload())};return jsxRuntimeExports.jsxs("div",{className:"new-to-web3-buttons__container",children:[!isMobile$1()&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(Xr==null?void 0:Xr.isInstalledOnBrowser)&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Xr,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"desktop-interactive-wallet-item",variant:"body_normal",weight:"bold",children:"Continue"})}),to&&jsxRuntimeExports.jsx("button",{onClick:ro,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"refresh-once-installed-button",variant:"body_normal",weight:"bold",children:"Continue once installed"})})]}),Xr&&isMobile$1()&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Xr,children:jsxRuntimeExports.jsx("p",{"data-testid":"mobile-interactive-wallet-item",children:"Continue once installed"})})]})},WalletListHelpContent=({chains:Xr,newToWeb3WalletChainMap:eo})=>{var to,ro;const{walletConnectorOptions:no}=useInternalDynamicContext(),{walletBook:io}=useWalletBookContext(),[oo,ao]=reactExports.useState(""),so=((to=Xr==null?void 0:Xr.filter($o=>!!$o.enabled).find($o=>$o.name===eo.primary_chain))===null||to===void 0?void 0:to.name)||"evm",co=getValueByKey(eo==null?void 0:eo.wallets,so),lo=no.find($o=>$o.key===co),uo=lo==null?void 0:lo.walletConnector.canConnectViaCustodialService,ho=getWalletLinks(io,co),{currentDesktopUrl:go,canShowAndroidAppButton:bo,canShowIosAppButton:wo}=parseWalletLinks(ho),Eo=[{content:"Install Desktop extension",icon:SvgPuzzle,isEnabled:!!(go!=null&&go.length)&&!isMobile$1(),url:go},{content:"Install iOS app",icon:AppleIcon,isEnabled:wo,url:ho.ios},{content:"Install Android app",icon:AndroidIcon,isEnabled:bo,url:ho.android}];return Object.keys((ro=io==null?void 0:io.wallets)!==null&&ro!==void 0?ro:{}).length?jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__container",children:jsxRuntimeExports.jsxs(EnterTileAnimation,{delay:"300ms",children:[jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:co,style:{height:pixelToRem(56),width:pixelToRem(56)}})}),jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"title",weight:"medium",children:["We recommend installing"," ",getWalletBookWallet(io,co).name]}),jsxRuntimeExports.jsx(Typography,{as:"label",variant:"body_normal",weight:"regular",color:"secondary",className:"walletlist-help-content__typography--label",children:"Select your preferred option below:"})]}),jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__buttons-wrapper",children:Eo.map(($o,Co)=>$o.isEnabled?jsxRuntimeExports.jsx("button",{onClick:()=>ao($o.url),children:jsxRuntimeExports.jsx(Item,{StartIcon:$o.icon,heading:$o.content,url:$o.url})},Co):void 0)}),uo&&jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__custodial-wallet-area",children:[jsxRuntimeExports.jsx(Typography,{className:"walletlist-help-content__custodial-wallet-area--title",as:"p",color:"secondary",variant:"body_normal",weight:"regular",children:"If you don't want to install a wallet, then use:"}),jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:lo})]}),jsxRuntimeExports.jsx(WalletExtensionOrAppContinueButton,{selectedUrl:oo,wallet:lo})]})}):jsxRuntimeExports.jsx(Skeleton,{className:"walletlist-footer-content__container"})};var _path$y,_excluded$H=["title","titleId"];function _extends$J(){return _extends$J=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$H(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgChevronLeft=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$H(eo,_excluded$H);return reactExports.createElement("svg",_extends$J({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$y||(_path$y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.09 3.577a.833.833 0 0 1 0 1.179L7.844 10l5.244 5.244a.833.833 0 0 1-1.178 1.179l-5.834-5.834a.833.833 0 0 1 0-1.178l5.834-5.834a.833.833 0 0 1 1.178 0Z",fill:"currentcolor"})))};const HelpHeader=()=>{const{authMode:Xr}=useInternalDynamicContext(),{setIsFooterExpanded:eo}=useFooterAnimationContext(),{view:to}=useViewContext(),{helpHeaderData:ro}=useDynamicLayoutData({authMode:Xr,view:to.type}),{displayBorderBelowHeader:no}=useAuthLayoutChecks(),io=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>eo(!1),"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgChevronLeft,{className:"back-button "})});return jsxRuntimeExports.jsx("div",{className:"help-header",children:jsxRuntimeExports.jsx(ModalHeader,{trailing:io,displayLeading:!1,displayBorder:no,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-help-heading",className:"header__typography",copykey:ro==null?void 0:ro.copykey,children:ro==null?void 0:ro.heading})})})};var _path$x,_excluded$G=["title","titleId"];function _extends$I(){return _extends$I=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$G(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgUserAccount2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$G(eo,_excluded$G);return reactExports.createElement("svg",_extends$I({width:60,height:50,viewBox:"0 0 60 50",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$x||(_path$x=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.931 49.48A29.223 29.223 0 0 0 59.333 30C59.333 13.8 46.2.667 30 .667S.667 13.8.667 30A29.224 29.224 0 0 0 8.07 49.483c5.52-6.63 16.005-9.007 22.387-9.007 6.383 0 15.962 1.903 21.473 9.004ZM19 22.667c0-6.076 4.925-11 11-11s11 4.924 11 11c0 6.075-4.925 11-11 11s-11-4.925-11-11Z",fill:"#4779FF"})))};const PasskeyInfoHelper=()=>{const{t:Xr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"passkey-info-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgUserAccount2,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_1.title",children:Xr("dyn_passkey_intro.helper.section_1.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_1.description",children:Xr("dyn_passkey_intro.helper.section_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgFooterKeyIcon,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_2.title",children:Xr("dyn_passkey_intro.helper.section_2.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_2.description",children:Xr("dyn_passkey_intro.helper.section_2.description")})]})]})]})})})},HelpContent=()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(HelpHeader,{}),jsxRuntimeExports.jsx(HelpContentSwitch,{})]}),HelpContentSwitch=()=>{const{view:Xr}=useViewContext(),{projectSettings:eo,newToWeb3WalletChainMap:to,selectedWalletConnector:ro}=useInternalDynamicContext(),no=reactExports.useMemo(()=>Xr.type==="wallet-connect-mobile-wallets-list"||Xr.type==="wallet-list"||Xr.type==="login-with-email-or-wallet-full-wallet-list"||Xr.type==="login-with-wallet-only",[Xr]),io=reactExports.useMemo(()=>Xr.type==="pending-signature-without-back-button"||Xr.type==="pending-signature",[Xr]),oo=reactExports.useMemo(()=>Xr.type==="pending-connect"||Xr.type==="qr-code",[Xr]),ao=reactExports.useMemo(()=>Xr.type==="passkey-intro",[Xr]);return no?jsxRuntimeExports.jsx(WalletListHelpContent,{chains:eo==null?void 0:eo.chains,newToWeb3WalletChainMap:to}):io?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"sign",wallet:ro||void 0}):oo?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"connect"}):ao?jsxRuntimeExports.jsx(PasskeyInfoHelper,{}):jsxRuntimeExports.jsx(EmptyHelpContent,{})},TosAndPp=()=>{const{user:Xr,authMode:eo,customPrivacyPolicy:to,customTermsOfServices:ro,privacyPolicyUrl:no,termsOfServiceUrl:io}=useInternalDynamicContext(),oo=isConnectOnly(Xr,eo)?"connecting":"logging in",ao=()=>{if(io)return jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:io,target:"_blank",rel:"noreferrer",children:"Terms of Service"})},so=()=>{if(no)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[io&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" & "}),jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:no,target:"_blank",rel:"noreferrer",children:"Privacy Policy"})]})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(no||io)&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:"tos-and-pp__text",children:["By ",oo,", you agree to",jsxRuntimeExports.jsx("br",{}),"our ",ao(),so(),"."]}),ro,to]})},ToSFooter=()=>{const{showToSFooter:Xr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{className:"tos-and-pp__footer",children:Xr&&jsxRuntimeExports.jsx(TosAndPp,{})})},getChainStepState=(Xr,eo)=>{const to=Xr===eo[0],ro=!eo.includes(Xr);return to?"current":ro?"done":"upcoming"},typographyOpacityMap={current:"1",default:"1",done:"0.4",upcoming:"0.15"},Step=({children:Xr,className:eo,icon:to,state:ro="default"})=>{const no=reactExports.useMemo(()=>({opacity:ro==="upcoming"?.5:1}),[ro]),io=reactExports.useMemo(()=>ro==="done"?jsxRuntimeExports.jsx("div",{className:"step__icon step__icon--done",children:jsxRuntimeExports.jsx(Icon,{className:"step__icon__check-mark",children:jsxRuntimeExports.jsx(SvgCheck,{style:no})})}):to?jsxRuntimeExports.jsx(Icon,{className:"step__icon",children:jsxRuntimeExports.jsx("div",{style:no,children:to})}):jsxRuntimeExports.jsx("div",{className:"step__index",children:jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:no,children:jsxRuntimeExports.jsx("span",{className:"step__index-label"})})}),[to,ro,no]);return jsxRuntimeExports.jsxs("div",{className:classNames("step",eo),children:[io,jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:{opacity:typographyOpacityMap[ro]},children:Xr})]})},Stepper=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"stepper",children:reactExports.Children.map(Xr,(eo,to)=>{const ro=to===0?void 0:jsxRuntimeExports.jsx(Divider,{className:"stepper__divider"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ro,eo]})})}),WalletProgressStepper=()=>{const{bridgeChainsToConnect:Xr=[],bridgeChains:eo=[]}=useInternalDynamicContext(),to=eo.map(({chain:no})=>no),ro=[...Xr].map(({chain:no})=>no);return jsxRuntimeExports.jsx("div",{className:"wallet-progress-stepper","data-testid":"wallet-progress-stepper",children:jsxRuntimeExports.jsx(Stepper,{children:to.map((no,io)=>{var oo;const ao=getChainInfoWithOverrides(no),so=getChainIcon(no);return jsxRuntimeExports.jsx(Step,{state:getChainStepState(no,ro),icon:jsxRuntimeExports.jsx(so,{}),children:(oo=ao==null?void 0:ao.blockchainName)!==null&&oo!==void 0?oo:ao==null?void 0:ao.displayName},no)})})})},DynamicAuthLayout=({children:Xr,className:eo,style:to,onClose:ro,projectSettings:no,hideBridgeProgressSteppers:io})=>{const{view:oo}=useViewContext(),{authMode:ao}=useInternalDynamicContext(),{isFooterExpanded:so}=useFooterAnimationContext(),{headerData:co,helpHeaderData:lo}=useDynamicLayoutData({authMode:ao,view:oo.type}),{showConnectedWalletProgress:uo,showHeader:ho,showHelpContent:go,showToSFooter:bo,showDynamicFooter:wo}=useAuthLayoutChecks();return jsxRuntimeExports.jsx(OverlayCardTarget,{children:jsxRuntimeExports.jsxs(VerticalAccordion,{style:to,className:eo,children:[jsxRuntimeExports.jsxs(AccordionItem,{isOpen:!so,dimOnHide:!0,children:[uo&&!io&&jsxRuntimeExports.jsx(WalletProgressStepper,{}),ho&&jsxRuntimeExports.jsx(Header,{onClose:ro,heading:(co==null?void 0:co.heading)||"",projectSettings:no,copykey:co==null?void 0:co.copykey}),Xr,bo&&jsxRuntimeExports.jsx(ToSFooter,{}),wo&&jsxRuntimeExports.jsx(DynamicFooter,{})]}),lo&&go&&jsxRuntimeExports.jsx(AccordionItem,{isOpen:so,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(HelpContent,{})},so.toString())})]})})},SandboxIndicatorWrapper=({children:Xr})=>{const{projectSettings:eo}=useInternalDynamicContext(),to=reactExports.useRef(null),[ro,no]=reactExports.useState(void 0),io=(eo==null?void 0:eo.environmentName)===EnvironmentEnum.Sandbox;return reactExports.useEffect(()=>{var oo;const ao=(oo=to.current)===null||oo===void 0?void 0:oo.clientHeight;no(ao)},[to,no]),io?jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[jsxRuntimeExports.jsx("div",{ref:to,style:{background:"var(--dynamic-alert-1)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",color:"white",left:"calc( var(--dynamic-border-radius) + 8px)",padding:"2px 8px 4px",position:"absolute",top:-(ro||0)},"data-testid":"sandbox-indicator",children:capitalize$1((eo==null?void 0:eo.environmentName)||"")}),Xr]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Xr})},DynamicAuthModal=({children:Xr,onClose:eo,transitionProps:to,projectSettings:ro,className:no})=>{const{showConnectedWalletProgress:io}=useAuthLayoutChecks();return jsxRuntimeExports.jsxs(Modal$1,{isShown:!!(to!=null&&to.isShown),children:[io&&jsxRuntimeExports.jsx(ModalCard,{borderRadius:"small",children:jsxRuntimeExports.jsx(WalletProgressStepper,{})}),jsxRuntimeExports.jsx(SandboxIndicatorWrapper,{children:jsxRuntimeExports.jsx(ModalCard,{dataTestId:"dynamic-auth-modal",children:jsxRuntimeExports.jsx(DynamicAuthLayout,{className:no,projectSettings:ro,onClose:eo,hideBridgeProgressSteppers:!0,children:Xr})})})]})},MockContext=reactExports.createContext(void 0),useMockContext=()=>{const Xr=reactExports.useContext(MockContext);return Xr===void 0?{mockedSDK:!1}:Xr},LoadingContext=reactExports.createContext(void 0),LoadingContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState(!1);useInternalDynamicEvents("logout",()=>to(!1)),useInternalDynamicEvents("embeddedWalletCreated",()=>to(!1));const ro=reactExports.useMemo(()=>({loading:eo,setLoading:to}),[eo]);return jsxRuntimeExports.jsx(LoadingContext.Provider,{value:ro,children:Xr})},useLoadingContext=()=>{const Xr=reactExports.useContext(LoadingContext);if(Xr===void 0)throw new Error("usage of useLoadingContext not wrapped in `LoadingContextProvider`.");return Xr},{getProjectSettings,setProjectSettings,useProjectSettings,resetProjectSettings}=createStoreState("projectSettings"),useFetchProjectSettings=({environmentId:Xr,retries:eo=2})=>{const to=useProjectSettings(),ro=!!(to!=null&&to.settings),{retrigger:no}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const io=yield fetchProjectSettings(Xr);if(!io)throw new DynamicError("Settings are not defined");return io}),{deps:[Xr],enabled:!ro,onResolve:io=>{const oo=new Date().getTime()+3e5;setProjectSettings({expiresAt:oo,settings:io})},retries:eo});useDynamicEvents("logout",no)},AccordionItem=reactExports.forwardRef(({children:Xr,className:eo="",isOpen:to,dataTestId:ro,dimOnHide:no=!1,handleScroll:io=()=>{}},oo)=>{const ao=reactExports.useRef(null),so=reactExports.useRef(),[co]=useResizeObserver(ao),lo=reactExports.useMemo(()=>to?co?co.height:so.current:0,[to,co]);return reactExports.useEffect(()=>{const uo=co==null?void 0:co.height;uo&&(so.current=uo)},[co]),jsxRuntimeExports.jsxs("div",{"data-testid":ro,style:{maxHeight:lo},className:classNames(eo,"accordion-item",{"accordion-item--full-height":!!lo}),onScroll:io,ref:oo,children:[no&&jsxRuntimeExports.jsx("div",{"data-testid":"accordion-item-curtain",className:classNames("accordion-item__curtain",{"accordion-item__curtain--dimmed":!to})}),jsxRuntimeExports.jsx("div",{ref:ao,children:Xr})]})});AccordionItem.displayName="AccordionItem";var _g$a,_defs$a,_excluded$F=["title","titleId"];function _extends$H(){return _extends$H=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$F(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAccessBlocked=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$F(eo,_excluded$F);return reactExports.createElement("svg",_extends$H({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$a||(_g$a=reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#access-blocked_svg__b)",fillOpacity:.12}),reactExports.createElement("circle",{cx:220.352,cy:29.265,r:15.729,transform:"rotate(15 220.352 29.265)",fill:"#4779FF"}),reactExports.createElement("path",{d:"M223.594 23.62a1.573 1.573 0 1 0-3.038-.815l-1.629 6.078a1.573 1.573 0 1 0 3.039.814l1.628-6.077ZM219.225 33.848a1.573 1.573 0 0 0-.814 3.039l.015.004a1.574 1.574 0 0 0 .814-3.039l-.015-.004Z",fill:"#F9F9FB"}),reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M101.972 36.04a8 8 0 0 1 9.798 5.657l-2.897.777a5 5 0 0 0-9.66 2.588l-2.897.776a8 8 0 0 1 5.656-9.797ZM118.498 47.487a5.333 5.333 0 0 0-6.532-3.772l-14.81 3.969a5.333 5.333 0 0 0-3.772 6.532l1.898 7.084a5.333 5.333 0 0 0 6.532 3.77l14.811-3.968a5.334 5.334 0 0 0 3.771-6.532l-1.898-7.083Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-3.344 46.703c-1.172-2.936-2.026-7.051-2.236-11.797h9.298c-.21 4.746-1.064 8.861-2.236 11.797-.683 1.709-1.393 2.816-1.971 3.428-.198.21-.346.328-.442.393a2.703 2.703 0 0 1-.442-.392c-.578-.613-1.288-1.72-1.971-3.429Zm0-28.13c-1.208 3.025-2.078 7.301-2.253 12.228h9.332c-.175-4.927-1.045-9.203-2.253-12.227-.683-1.709-1.393-2.816-1.971-3.429a2.703 2.703 0 0 0-.442-.392 2.703 2.703 0 0 0-.442.392c-.578.613-1.288 1.72-1.971 3.429Zm-15.106 12.228h8.746c.21-6.38 1.506-11.989 3.423-15.668-6.57 2.184-11.466 8.283-12.169 15.668Zm.046 4.105h8.716c.253 6.201 1.533 11.642 3.407 15.238-6.442-2.141-11.274-8.046-12.123-15.238Zm34.946 0h-8.716c-.253 6.201-1.533 11.642-3.407 15.238 6.442-2.141 11.275-8.046 12.123-15.238Zm.133-2.267v.065-.131.066Zm-8.833-1.838h8.746c-.703-7.385-5.599-13.484-12.169-15.668 1.917 3.68 3.213 9.289 3.423 15.668Zm-8.909 19.795c0-.001.007-.004.023-.008a.077.077 0 0 1-.023.008Zm.25-.008a.064.064 0 0 1 .022.008s-.007-.001-.022-.008Zm.022-35.907c0 .001-.007.004-.023.008a.077.077 0 0 1 .023-.008Zm-.249.008c-.016-.004-.023-.007-.023-.008 0 0 .007.001.023.008Z",fill:"#4779FF"}))),_defs$a||(_defs$a=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"access-blocked_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"access-blocked_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 188.268 -307.493)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"access-blocked_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AccessBlockedView=()=>{const[Xr,eo]=reactExports.useState(),{t:to}=useTranslation(),{getIpConfiguration:ro}=useIpConfigurationContext();return usePromise(ro,{deps:[ro,Xr],onResolve:no=>eo(no==null?void 0:no.country),retries:2}),jsxRuntimeExports.jsxs("div",{className:"access-blocked__container",children:[jsxRuntimeExports.jsx("div",{className:"access-blocked__icon",children:jsxRuntimeExports.jsx(SvgAccessBlocked,{})}),jsxRuntimeExports.jsx("div",{className:"access-blocked__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:to("dyn_access_blocked.content",{jurisdiction:Xr})})})]})};var _path$w,_excluded$E=["title","titleId"];function _extends$G(){return _extends$G=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$E(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletConnectLogo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$E(eo,_excluded$E);return reactExports.createElement("svg",_extends$G({width:17,height:12,viewBox:"0 0 17 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$w||(_path$w=reactExports.createElement("path",{d:"M3.84 2.345c2.573-3.127 6.747-3.127 9.32 0l.31.376a.463.463 0 0 1 0 .566l-1.06 1.287a.145.145 0 0 1-.232 0l-.427-.518c-1.795-2.18-4.707-2.18-6.502 0l-.457.555a.145.145 0 0 1-.233 0L3.5 3.324a.463.463 0 0 1 0-.566l.34-.413Zm11.512 2.661.943 1.146a.463.463 0 0 1 0 .566l-4.252 5.165a.29.29 0 0 1-.466 0L8.558 8.217a.073.073 0 0 0-.116 0l-3.018 3.666a.29.29 0 0 1-.466 0L.705 6.718a.463.463 0 0 1 0-.566l.943-1.146a.29.29 0 0 1 .466 0l3.018 3.666c.032.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0l3.018 3.666c.033.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0Z",fill:"currentColor"})))};const Indicator=({indicator:Xr,iconSize:eo})=>{const to={container:eo*4/15,icon:eo*3/15},ro={container:eo/6,icon:eo/9};return Xr==="walletConnect"?jsxRuntimeExports.jsx("div",{className:"indicator__wallet-connect",style:{height:pixelToRem(to.container),width:pixelToRem(to.container)},children:jsxRuntimeExports.jsx(SvgWalletConnectLogo,{style:{height:pixelToRem(to.icon),width:pixelToRem(to.icon)}})}):jsxRuntimeExports.jsx("div",{className:"indicator__container indicator__container--connected",style:{height:pixelToRem(ro.container),width:pixelToRem(ro.container)},"data-testid":"connected-indicator",children:jsxRuntimeExports.jsx("div",{className:"indicator__icon",style:{height:pixelToRem(ro.icon),width:pixelToRem(ro.icon)}})})},iconRatio=7/11,IconWithSpinner=({iconSize:Xr=24,Icon:eo,isSpinning:to=!1,className:ro="",indicator:no,customSpinnerColor:io,treatAsFunctionComponent:oo})=>{const ao=Xr*iconRatio,so=Xr/2,co=classNames("icon-with-spinner__container",ro),lo=eo;return jsxRuntimeExports.jsxs("div",{className:co,style:{height:pixelToRem(Xr),width:pixelToRem(Xr)},children:[eo&&jsxRuntimeExports.jsxs("div",{style:{height:pixelToRem(ao),width:pixelToRem(ao)},className:"icon-with-spinner__icon-container",children:[oo||typeof eo=="function"?jsxRuntimeExports.jsx(lo,{height:ao,width:ao}):eo,no&&jsxRuntimeExports.jsx(Indicator,{indicator:no,iconSize:Xr})]}),to&&!isLegacySafari()&&jsxRuntimeExports.jsx("div",{className:"icon-with-spinner__spinner-container icon-with-spinner__animation","data-chromatic":"ignore",style:{height:pixelToRem(Xr),width:pixelToRem(Xr)},children:jsxRuntimeExports.jsx(Spinner,{className:"icon-with-spinner__spinner",customSpinnerColor:io,size:so})})]})},IconListTile=Xr=>{var{children:eo,className:to}=Xr,ro=__rest$7(Xr,["children","className"]);return jsxRuntimeExports.jsx(ListTile,Object.assign({},ro,{className:classNames(to,"icon-list-tile"),children:jsxRuntimeExports.jsx("div",{className:"icon-list-tile--children",children:eo})}))},isEmailProviderEnabled=Xr=>Xr!==void 0&&(isProviderEnabled(Xr,ProviderEnum.Dynamic)||isProviderEnabled(Xr,ProviderEnum.Blocto)||isProviderEnabled(Xr,ProviderEnum.MagicLink)),findEmailOtpWalletConnector=Xr=>Xr.map(({walletConnector:to})=>to).find(to=>isEmailWalletConnector(to)&&to.requiresNonDynamicEmailOtp),getEmailProvider=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to}){try{return yield sdkApi$1().getEmailProvider({email:eo,environmentId:to})}catch(ro){const no=yield ro.json();throw logger$8.error(no.error),new EmailProviderError(no.code)}}),createEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to,captchaToken:ro}){try{return yield sdkApi$1().createEmailVerification({emailVerificationCreateRequest:{captchaToken:ro,email:eo},environmentId:to})}catch(no){const io=yield no.json();throw logger$8.error(io.error),new EmailVerificationError(io.code)}}),signInWithEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro,captchaToken:no,sessionPublicKey:io}){try{return yield sdkApi$1().signInWithEmailVerification({emailVerificationVerifyRequest:{captchaToken:no,sessionPublicKey:io,verificationToken:eo,verificationUUID:to},environmentId:ro})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),ao.error.code==="missing_from_list"?new NoAccessError({email:ao.payload.email}):ao.code==="email_associated_with_different_provider"?new AccountExistsError(ao.error,ao.payload):ao.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(ao.error.message):new EmailVerificationError(ao.code)}}),retryEmailVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({email:eo,environmentId:to,verificationUUID:ro}){try{return yield sdkApi$1().retryEmailVerification({emailVerificationRetryRequest:{email:eo,verificationUUID:ro},environmentId:to})}catch(no){const io=yield no.json();throw logger$8.error(io.error),new EmailVerificationError(io.code)}}),verifyEmail=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro}){try{return yield sdkApi$1().verifyEmailVerification({emailVerificationVerifyRequest:{verificationToken:eo,verificationUUID:to},environmentId:ro})}catch(no){const io=yield no.json();throw logger$8.error(io.error),io.code===UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail?new UserHasAccountWithEmailError(io.error):io.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(io.error.message):new EmailVerificationError(io.code)}}),useConnectWithEmail=({emailWalletConnector:Xr,handleConnect:eo})=>{const{error:to}=useErrorContext(),[ro,no]=reactExports.useState(!1),io=oo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!(!oo||!Xr||ro)){no(!0),Xr.setEmail(oo);try{yield eo(Xr)}catch(ao){logger$8.error(ao),no(!1)}}});return reactExports.useEffect(()=>{to&&ro&&no(!1)},[to,ro]),{connectWithEmail:io,loading:ro}},useEmailProvider=({emailWalletConnector:Xr})=>{const{projectSettings:eo,environmentId:to}=useInternalDynamicContext(),{setDisplayedDestination:ro,setVerificationUUID:no}=useVerification(),{setView:io}=useViewContext(),{handleInstalledExtensionClick:oo}=useWalletItemActions(),{connectWithEmail:ao,loading:so}=useConnectWithEmail({emailWalletConnector:Xr,handleConnect:oo}),{providers:co}=eo||{},uo=Xr!==void 0&&(isProviderEnabled(co||[],ProviderEnum.MagicLink)||isProviderEnabled(co||[],ProviderEnum.Blocto)),ho=(Eo,$o)=>__awaiter$j(void 0,void 0,void 0,function*(){const{email:Co,verificationUUID:Ro}=yield createEmailVerification({captchaToken:$o,email:Eo,environmentId:to});io("login-with-email-verification"),ro(Co),no(Ro)}),go=Eo=>__awaiter$j(void 0,void 0,void 0,function*(){yield ao(Eo)}),bo=(Eo,$o)=>__awaiter$j(void 0,void 0,void 0,function*(){if(uo){yield go(Eo);return}yield ho(Eo,$o)});return{handleEmailSubmitWithOptionalCaptcha:(Eo,$o)=>__awaiter$j(void 0,void 0,void 0,function*(){dynamicEvents.emit("authInit",{email:Eo,option:Eo,type:"email"});try{if((Xr!==void 0||isTurnkeyEnabled(eo))&&(eo!=null&&eo.sdk.confirmEmailProviderForVerify)){const{emailProvider:Co}=yield getEmailProvider({email:Eo,environmentId:to});if(Co===ProviderEnum.Dynamic){yield ho(Eo,$o);return}}yield bo(Eo,$o)}catch(Co){throw dynamicEvents.emit("authFailure",{email:Eo,option:Eo,type:"email"},{error:Co}),Co}}),isEmailProviderLoading:so}},EMAIL_REGEX=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isEmailValid=Xr=>EMAIL_REGEX.test(Xr);var _rect$1,_path$v,_excluded$D=["title","titleId"];function _extends$F(){return _extends$F=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$D(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowRightBackground=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$D(eo,_excluded$D);return reactExports.createElement("svg",_extends$F({width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_rect$1||(_rect$1=reactExports.createElement("rect",{x:.5,width:24,height:24,rx:12,fill:"var(--icon-background, var(--dynamic-hover))"})),_path$v||(_path$v=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.22 7.47a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H7.5a.75.75 0 0 1 0-1.5h8.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",fill:"var(--icon-arrow, var(--dynamic-text-secondary))"})))};const InlineSubmitButton=({disabled:Xr,highlighted:eo,isFocused:to,isHovered:ro,className:no,style:io,emailSubmitButtonInsideInput:oo=!1})=>oo?jsxRuntimeExports.jsx(IconButton,{"data-testid":"in_line_submit_button",type:"submit",className:classNames("inline-submit-button",no,{"inline-submit-button--active":to||ro,"inline-submit-button--ready":eo}),disabled:Xr,style:io,children:jsxRuntimeExports.jsx(SvgArrowRightBackground,{})}):null,EmailForm=({isLoading:Xr,onSubmit:eo,isEmailInvalid:to=!1,currentEmail:ro,emailSubmitButtonInsideInput:no=!1,buttonCopyKey:io="dyn_login.email_form.submit_button.label",isDisabled:oo=!1,className:ao,style:so})=>{const{t:co}=useTranslation(),[lo,uo]=reactExports.useState(ro??""),[ho,go]=reactExports.useState(!1),[bo,wo]=reactExports.useState(!1),Eo=Co=>{const{value:Ro}=Co.currentTarget;uo(Ro)},$o=Co=>__awaiter$j(void 0,void 0,void 0,function*(){Co.preventDefault(),isEmailValid(lo)&&(eo==null||eo(lo))});return jsxRuntimeExports.jsxs("form",{className:classNames("login-with-email-form",ao),style:so,"data-testid":"email-form",onSubmit:Co=>$o(Co),children:[jsxRuntimeExports.jsx(Input,{id:"email_field",value:lo,onChange:Eo,copykey:"dyn_login.email_form.email_field.label",label:co("dyn_login.email_form.email_field.label"),error:to,message:to&&co("dyn_login.helper.email_form.invalid_email"),suffix:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:Xr||oo,highlighted:lo.length>0,isFocused:bo,isHovered:ho,emailSubmitButtonInsideInput:no}),disabled:Xr||oo,type:"email",onPointerEnter:()=>go(!0),onPointerLeave:()=>go(!1),onFocus:()=>wo(!0),onBlur:()=>wo(!1),autoComplete:"email"}),!no&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"submit_button",buttonClassName:"login-with-email-form__button",type:"submit",loading:Xr,disabled:Xr||lo.length<3||oo,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,copykey:io,typographyProps:{color:"inherit"},children:co(io)})]})},LoginEmailForm=({isLoading:Xr,onSubmit:eo,onSubmitError:to,currentEmail:ro,className:no,style:io})=>{var oo,ao;const{walletConnectorOptions:so,projectSettings:co}=useInternalDynamicContext(),{view:lo,setView:uo}=useViewContext(),{setErrorMessage:ho}=useErrorContext(),{engageCaptcha:go}=useCaptchaContext(),[bo,wo]=reactExports.useState(!1),Eo=findEmailOtpWalletConnector(so),{handleEmailSubmitWithOptionalCaptcha:$o,isEmailProviderLoading:Co}=useEmailProvider({emailWalletConnector:Eo}),Ro=reactExports.useMemo(()=>Co||Xr,[Co,Xr]),Oo=Bo=>{Bo.code==="invalid_email_address"?wo(!0):ho(Bo.code),logger$8.debug(Bo),to==null||to()},jo=Bo=>__awaiter$j(void 0,void 0,void 0,function*(){var Mo;try{if(eo==null||eo(),!((Mo=co==null?void 0:co.security.hCaptcha)===null||Mo===void 0)&&Mo.enabled&&(Eo==null?void 0:Eo.key)!=="magicemailotp"){go({authMethod:"email",onCaptchaSuccess:Fo=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield $o(Bo,Fo)}catch(Wo){uo(lo.type),Oo(Wo)}})});return}yield $o(Bo)}catch(Fo){Oo(Fo)}});return isEmailProviderEnabled((oo=co==null?void 0:co.providers)!==null&&oo!==void 0?oo:[])?jsxRuntimeExports.jsx(EmailForm,{onSubmit:jo,isLoading:Ro,currentEmail:ro,emailSubmitButtonInsideInput:(ao=co==null?void 0:co.design.modal)===null||ao===void 0?void 0:ao.emailSubmitButtonInsideInput,isEmailInvalid:bo,className:no,style:io}):(logger$8.error("Failed to render EmailSignInSection - no sign in provider enabled"),null)},AccountExistsView=()=>{const{existentAccountData:Xr}=useAccountExistsContext(),{t:eo}=useTranslation(),{email:to,embeddedSocialSigninProvider:ro}=Xr||{},no=getSocialSignInProviderForProviderEnum(ro),{socialProvider:io,setSocialProvider:oo,socialWalletConnector:ao}=useSocialRedirectContext(),so=useFindSocialIcon(),{mutate:co}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){return oo(no),yield ao==null?void 0:ao.endSession(),ao==null?void 0:ao.connect(ro)})),lo=()=>ro?eo("dyn_account_exists.description_social"):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[eo("dyn_account_exists.description_email")," ",jsxRuntimeExports.jsx("strong",{children:to})," ",eo("dyn_account_exists.trail_message_email")]});return jsxRuntimeExports.jsxs("div",{className:"account-exists__container",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"account-exists__image"}),jsxRuntimeExports.jsxs("div",{className:"account-exists__main",children:[jsxRuntimeExports.jsx("div",{className:"account-exists__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"account-exists__content--secondary",copykey:"dyn_account_exists",children:lo()})}),ro?jsxRuntimeExports.jsxs(IconListTile,{dataTestId:`inline-${ro}`,onClick:()=>co(),className:"social-sign-in--tile",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so(ro),isSpinning:io===no,iconSize:32}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_account_exists.connect",children:eo("dyn_account_exists.connect",{socialOauth:capitalize$1(ro==null?void 0:ro.toString())})})]},ro):jsxRuntimeExports.jsx(LoginEmailForm,{isLoading:!1,currentEmail:to})]})]})},BridgeNextWalletToConnectLayout=({chainName:Xr,chainIcon:eo,onClickAction:to,onClickClose:ro})=>{const no=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:no,alignContent:"bottom",children:eo&&jsxRuntimeExports.jsx("div",{className:"bridge-next-wallet-to-connect-layout__chain-icon",children:eo})}),jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout__body",children:[jsxRuntimeExports.jsxs(Typography,{color:"primary",variant:"title",children:["Nice! Now let’s connect your ",Xr," wallet"]}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",onClick:to,children:`Connect ${Xr} wallet`})]})]})},BridgeNextWalletConnectionView=()=>{const{setShowAuthFlow:Xr,bridgeChainsToConnect:eo}=useInternalDynamicContext(),{setView:to}=useViewContext();if(!(eo!=null&&eo.length))throw new DynamicError("No wallets to connect");const[ro]=eo,{chain:no}=ro,io=getChainInfoWithOverrides(no),oo=getChainIcon(no);if(!io)throw new DynamicError("No chain info found for chain",no);return jsxRuntimeExports.jsx(BridgeNextWalletToConnectLayout,{chainName:io.blockchainName,chainIcon:jsxRuntimeExports.jsx(oo,{}),onClickAction:()=>to("wallet-list"),onClickClose:()=>Xr(!1,{emitCancelAuth:!0})})},ConnectedWalletsListLayout=({title:Xr,body:eo,onClickBack:to,onClickClose:ro,onClickAction:no,actionButtonText:io="Continue",children:oo,copykey:ao})=>{const so=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),co=to&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:to,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})});return jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:co,trailing:so,children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:ao,children:Xr})}),jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",className:"connected-wallets-list-layout__body__text",children:eo}),oo,jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"primary",onClick:no,children:io})]})]})},BridgeSummaryView=()=>{const{primaryWallet:Xr,setShowAuthFlow:eo,appName:to,bridgeChains:ro=[]}=useInternalDynamicContext(),{t:no}=useTranslation(),io=()=>eo(!1,{emitCancelAuth:!0}),oo=reactExports.useMemo(()=>{const so=ro.map(({chain:uo})=>{var ho;return(ho=getChainInfoWithOverrides(uo))===null||ho===void 0?void 0:ho.blockchainName}),[co,lo]=so;return no("dyn_bridge.summary_view.connection_succeed",{firstBlockchainName:co,secondBlockchainName:lo})},[ro,no]),ao=so=>{const co=getChainIcon(so.chain),lo=getChainInfoWithOverrides(so.chain);return jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(co,{}),networkName:lo==null?void 0:lo.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:so.connector.key,walletAddress:so.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:so,network:so.chain})})})};return jsxRuntimeExports.jsxs(ConnectedWalletsListLayout,{onClickClose:io,onClickAction:io,copykey:"dyn_bridge.summary_view.title",title:no("dyn_bridge.summary_view.title",{appName:to}),body:oo,children:[Xr&&ao(Xr),jsxRuntimeExports.jsx(MemoSecondaryWallets,{hideUnlinkAction:!0})]})},BridgeWelcomeLayout=({body:Xr,chains:eo=[],onClickAction:to,onClickClose:ro,title:no,actionButtonText:io,copykey:oo})=>{const ao=ro&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:ro,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ao,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon-group",children:[...eo].reverse().map((so,co)=>jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon",style:{zIndex:co},children:so.icon},so.id))})}),jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__message-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:oo,children:no}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:Xr})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Stepper,{children:eo.map(so=>jsxRuntimeExports.jsx(Step,{children:so.name},so.id))})}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:to,children:io})]})]})},isChainInfoDefined=Xr=>Xr!==void 0,BridgeWelcomeView=()=>{const{appName:Xr,bridgeChains:eo=[],setShowAuthFlow:to}=useInternalDynamicContext(),{setView:ro}=useViewContext(),{t:no}=useTranslation(),io=reactExports.useMemo(()=>{const ao=eo.map(({chain:lo})=>{var uo;return(uo=getChainInfoWithOverrides(lo))===null||uo===void 0?void 0:uo.blockchainName}),[so,co]=ao;return no("dyn_bridge.welcome_view.description",{firstBlockchainName:so,secondBlockchainName:co})},[eo,no]),oo=reactExports.useMemo(()=>eo.map(({chain:ao},so)=>{const co=getChainInfoWithOverrides(ao),lo=getChainIcon(ao);if(co&&lo)return{icon:jsxRuntimeExports.jsx(lo,{}),id:so,name:co.blockchainName}}).filter(isChainInfoDefined),[eo]);return jsxRuntimeExports.jsx(BridgeWelcomeLayout,{onClickClose:()=>to(!1,{emitCancelAuth:!0}),title:no("dyn_bridge.welcome_view.title",{appName:Xr}),copykey:"dyn_bridge.welcome_view.title",body:io,chains:oo,actionButtonText:no("dyn_bridge.welcome_view.button"),onClickAction:()=>ro("wallet-list")})},Captcha=({handleSuccess:Xr})=>{var eo;const{projectSettings:to}=useInternalDynamicContext();return!((eo=to==null?void 0:to.security.hCaptcha)===null||eo===void 0)&&eo.siteKey?jsxRuntimeExports.jsx("form",{"data-testid":"captcha-form",children:jsxRuntimeExports.jsx(HCaptcha,{sitekey:to.security.hCaptcha.siteKey,onVerify:ro=>Xr(ro),theme:document.body.dataset.dynamicTheme})}):null},CaptchaVerifyUser=()=>{const{t:Xr}=useTranslation(),{captchaAuthState:eo,setCaptchaToken:to}=useCaptchaContext(),ro=no=>__awaiter$j(void 0,void 0,void 0,function*(){var io;to(no),yield(io=eo==null?void 0:eo.onCaptchaSuccess)===null||io===void 0?void 0:io.call(eo,no)});return jsxRuntimeExports.jsxs("div",{className:"captcha-verify-user__container",children:[jsxRuntimeExports.jsx(CaptchaWaveIcon,{className:"captcha-verify-user__icon"}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"captcha-verify-user__title",copykey:"dyn_captcha.verify_user_title",children:Xr("dyn_captcha.verify_user_title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"captcha-verify-user__subtitle",copykey:"dyn_captcha.verify_user_subtitle",children:Xr("dyn_captcha.verify_user_subtitle")}),jsxRuntimeExports.jsx(Captcha,{handleSuccess:ro}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"captcha-verify-user__dynamic-logo"})]})};var _path$u,_excluded$C=["title","titleId"];function _extends$E(){return _extends$E=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$C(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAltKey=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$C(eo,_excluded$C);return reactExports.createElement("svg",_extends$E({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$u||(_path$u=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 4a5 5 0 0 0-4.786 6.453 1 1 0 0 1-.25.997L4 17.414V20h2v-1a1 1 0 0 1 1-1h1v-1a1 1 0 0 1 1-1h1.586l1.964-1.964a1 1 0 0 1 .997-.25A5 5 0 1 0 15 4ZM8 20v1a1 1 0 0 1-1 1H4a2 2 0 0 1-2-2v-2.586A2 2 0 0 1 2.586 16l5.562-5.562a7 7 0 1 1 5.414 5.414l-1.855 1.855A1 1 0 0 1 11 18h-1v1a1 1 0 0 1-1 1H8Zm6-13a1 1 0 0 1 1-1 3 3 0 0 1 3 3 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 0 1-1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$t,_excluded$B=["title","titleId"];function _extends$D(){return _extends$D=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$B(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgLock=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$B(eo,_excluded$B);return reactExports.createElement("svg",_extends$D({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$t||(_path$t=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$s,_path2$4,_path3$3,_path4$2,_g$9,_path5$2,_defs$9,_excluded$A=["title","titleId"];function _extends$C(){return _extends$C=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$A(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletClaimHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$A(eo,_excluded$A);return reactExports.createElement("svg",_extends$C({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("g",{clipPath:"url(#wallet-claim-hero_svg__a)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$s||(_path$s=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__b)"},_path2$4||(_path2$4=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#wallet-claim-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"wallet-claim-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$3||(_path3$3=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__d)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$2||(_path4$2=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$9||(_g$9=reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.825 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"})))),_path5$2||(_path5$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.89 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.815.527l-.135.05-16.681 6.256-.406.152c-1.922.718-3.61 1.348-4.91 2.493a9.333 9.333 0 0 0-2.552 3.683c-.616 1.62-.614 3.421-.611 5.473l.001.434V66.01c0 8.793 4.782 16.125 9.952 21.51 5.205 5.422 11.159 9.252 14.308 11.089l.127.075c.575.337 1.321.775 2.307.987a6.624 6.624 0 0 0 2.61 0c.986-.212 1.732-.65 2.307-.987l.127-.075c3.149-1.837 9.103-5.667 14.308-11.088 5.17-5.386 9.952-12.718 9.952-21.511V51.13l.001-.433c.003-2.052.005-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.988-1.775-4.91-2.493-.134-.05-.27-.1-.406-.152l-16.681-6.255-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-6.946 16.362a9.282 9.282 0 1 1 13.127 13.128 9.282 9.282 0 0 1-13.127-13.128Zm3.282 3.282a4.64 4.64 0 1 1 6.563 6.563 4.64 4.64 0 0 1-6.563-6.563Zm3.515 14.885a11.63 11.63 0 0 1-2.945-.377v15.598h4.641v-4.51h4.601v-4.642h-4.601V66.47a11.69 11.69 0 0 1-1.696.123Z",fill:"#4779FF"})))),_defs$9||(_defs$9=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"wallet-claim-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"wallet-claim-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const CoinbaseMPCClaimIntro=()=>{const{setShowAuthFlow:Xr}=useInternalDynamicContext(),{setView:eo}=useViewContext(),{t:to}=useTranslation(),ro=jsxRuntimeExports.jsx(IconButton,{onClick:()=>Xr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ro,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.intro.title",children:to("dyn_create_password.intro.title")})}),jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro",children:jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__description",children:jsxRuntimeExports.jsx(SvgWalletClaimHero,{})}),jsxRuntimeExports.jsx("div",{className:"confirm-password-description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_create_password.intro.description",children:to("dyn_create_password.intro.description.title")})}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgLock,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.additional_protection.title",children:to("dyn_create_password.intro.description.additional_protection.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.additional_protection.description",children:to("dyn_create_password.intro.description.additional_protection.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgAltKey,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.restore_access.title",children:to("dyn_create_password.intro.description.restore_access.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.restore_access.description",children:to("dyn_create_password.intro.description.restore_access.description")})]})]})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>{eo("create-password-view",{notCalledFromWalletUtils:!0})},copykey:"dyn_create_password.intro.continue",children:to("dyn_create_password.intro.continue")})]})})]})};var _path$r,_excluded$z=["title","titleId"];function _extends$B(){return _extends$B=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$z(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckConnection=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$z(eo,_excluded$z);return reactExports.createElement("svg",_extends$B({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$r||(_path$r=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const createSmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({isoCountryCode:eo,phoneNumber:to,phoneCountryCode:ro,environmentId:no,captchaToken:io}){try{return yield sdkApi$1().createSmsVerification({environmentId:no,smsVerificationCreateRequest:{captchaToken:io,isoCountryCode:eo,phoneCountryCode:ro,phoneNumber:to}})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),new SmsVerificationError(ao.error,ao.code)}}),signInWithSmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro,captchaToken:no,sessionPublicKey:io}){var oo;try{return yield sdkApi$1().signInWithSmsVerification({environmentId:ro,smsVerificationVerifyRequest:{captchaToken:no,sessionPublicKey:io,verificationToken:eo,verificationUUID:to}})}catch(ao){const so=yield ao.json();throw logger$8.error(so.error),((oo=so.error)===null||oo===void 0?void 0:oo.code)==="missing_from_list"?new NoAccessError({phoneNumber:so.payload.phoneNumber}):so.code==="wrong_sms_verification_token"?new SmsVerificationError(Locale.getInstance().t("dyn_login.helper.phone_number_form.invalid_sms_verification"),so.code):so.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(so.error.message):new SmsVerificationError(so.error,so.code)}}),retrySmsVerification=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({isoCountryCode:eo,phoneCountryCode:to,phoneNumber:ro,environmentId:no,verificationUUID:io}){try{return yield sdkApi$1().retrySmsVerification({environmentId:no,smsVerificationRetryRequest:{isoCountryCode:eo,phoneCountryCode:to,phoneNumber:ro,verificationUUID:io}})}catch(oo){const ao=yield oo.json();throw logger$8.error(ao.error),new SmsVerificationError(ao.error,ao.code)}}),verifySms=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({verificationToken:eo,verificationUUID:to,environmentId:ro}){try{return yield sdkApi$1().verifySmsVerification({environmentId:ro,smsVerificationVerifyRequest:{verificationToken:eo,verificationUUID:to}})}catch(no){const io=yield no.json();throw logger$8.error(io.error),io.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(io.error.message):new SmsVerificationError(io.error,io.code)}}),useOtpVerificationRequestRaw=()=>{const{environmentId:Xr,user:eo,userWithMissingInfo:to}=useInternalDynamicContext(),{verificationUUID:ro}=useVerification();return{verifyOtp:reactExports.useCallback((io,oo,ao,so)=>__awaiter$j(void 0,void 0,void 0,function*(){var co;if(!eo&&!to)throw new DynamicError(USER_NOT_LOGGED_IN);if(!so&&!ro)throw new DynamicError("No verification UUID is available");const ho=yield(ao==="email"?verifyEmail:verifySms)({environmentId:Xr,verificationToken:oo,verificationUUID:so??ro}),go=ho.user,bo=(co=go==null?void 0:go.missingFields)!==null&&co!==void 0?co:[],wo=getVerificationDestination(ho.nextView);return storeAuthTokenAndUser(ho),wo?io({destination:wo,missingFields:bo,updateUserProfileResponse:ho}):{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:bo,updateUserProfileResponse:ho}}),[ro,Xr,eo,to])}},useOtpVerificationRequest=()=>{const Xr=useHandleVerificationRequired(),{verifyOtp:eo}=useOtpVerificationRequestRaw();return reactExports.useMemo(()=>({verifyOtp:(to,ro,no)=>eo(Xr,to,ro,no)}),[Xr,eo])},getResponseInfo=(Xr,eo)=>{var to,ro,no,io,oo,ao,so;return eo==="email"?{displayDestination:(to=Xr.emailVerification)===null||to===void 0?void 0:to.email,verificationUUID:(ro=Xr.emailVerification)===null||ro===void 0?void 0:ro.verificationUUID}:{displayDestination:formatPhone("+"+((io=(no=Xr.smsVerification)===null||no===void 0?void 0:no.phoneCountryCode)!==null&&io!==void 0?io:"")+((ao=(oo=Xr.smsVerification)===null||oo===void 0?void 0:oo.phoneNumber)!==null&&ao!==void 0?ao:"")),verificationUUID:(so=Xr.smsVerification)===null||so===void 0?void 0:so.verificationUUID}},getVerificationDestination=Xr=>{if(Xr===NextViewEnum.VerifyEmail)return"email";if(Xr===NextViewEnum.VerifySms)return"sms"},useHandleVerificationRequired=()=>{const{setVerificationUUID:Xr,setDisplayedDestination:eo}=useVerification(),{environmentId:to}=useInternalDynamicContext(),{verifyOtp:ro}=useOtpVerificationRequestRaw(),no=reactExports.useCallback((oo,ao)=>__awaiter$j(void 0,void 0,void 0,function*(){if(oo==="email"&&ao.emailVerification||oo==="sms"&&ao.smsVerification)return ao;const so=oo==="email"?"email":"phoneNumber";if(!ao.user[so])throw new VerificationDataCollectionError(`missing ${so} field to perform update`);const co=yield userFieldsSchema.validate({[so]:ao.user[so]}),{emailVerification:lo,smsVerification:uo}=yield updateUserProfileFields(to,co);if(oo==="email"&&!lo||oo==="sms"&&!uo)throw new VerificationDataCollectionError(`could not get ${oo} verification data from api`);return Object.assign(Object.assign({},ao),{emailVerification:lo,smsVerification:uo})}),[to]),io=reactExports.useCallback(oo=>__awaiter$j(void 0,[oo],void 0,function*({updateUserProfileResponse:ao,missingFields:so,destination:co}){const lo=yield no(co,ao),{displayDestination:uo,verificationUUID:ho}=getResponseInfo(lo,co);eo(uo),Xr(ho);const go=bo=>__awaiter$j(void 0,void 0,void 0,function*(){return ro(io,bo,co,ho)});return co==="email"?{isEmailVerificationRequired:!0,isSmsVerificationRequired:!1,missingFields:so,updateUserProfileResponse:lo,verifyOtp:go}:{isEmailVerificationRequired:!1,isSmsVerificationRequired:!0,missingFields:so,updateUserProfileResponse:lo,verifyOtp:go}}),[no,eo,Xr,ro]);return io},useUpdateUser=Xr=>{const{environmentId:eo,userWithMissingInfo:to,setCallback:ro}=useInternalDynamicContext(),{setRetryData:no}=useVerification(),{selectedPhoneCountry:io}=useFieldsState(),oo=useHandleVerificationRequired();return reactExports.useCallback((so,co)=>__awaiter$j(void 0,void 0,void 0,function*(){var lo,uo;let{metadata:ho}=so;ho=ho?Object.assign(Object.assign({},to==null?void 0:to.metadata),ho):to==null?void 0:to.metadata;const go=yield userFieldsSchema.validate(so,{stripUnknown:Xr});go.phoneNumber&&go.phoneNumber.length>0&&io.current&&no({dialCode:io.current.dialCode,iso2:io.current.iso2,phone:go.phoneNumber});const bo=yield updateUserProfileFields((lo=co==null?void 0:co.userEnvironmentId)!==null&&lo!==void 0?lo:eo,Object.assign(Object.assign({},go),{metadata:ho})),wo=(uo=bo.user.missingFields)!==null&&uo!==void 0?uo:[],Eo=getVerificationDestination(bo.nextView);return Eo?oo({destination:Eo,missingFields:wo,updateUserProfileResponse:bo}):(ro("userProfileUpdate"),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:wo,updateUserProfileResponse:bo})}),[to==null?void 0:to.metadata,Xr,io,no,eo,oo,ro])},validateUpdateRequest=(Xr,eo,to)=>{if(!Xr.length)return"At least one field must be provided for editing";if(!eo)return"No signed-in user";const ro=getUserProfileFields({customFields:to==null?void 0:to.customFields,projectSettingsKyc:to==null?void 0:to.kyc,user:eo});for(const no of Xr)if(!ro.find(({name:io})=>io===no))return`Please ensure field "${no}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;return""},saveUserValues=(Xr,eo,to,ro,no)=>__awaiter$j(void 0,[Xr,eo,to,ro,no],void 0,function*({fields:io,updateUserResult:{isEmailVerificationRequired:oo,isSmsVerificationRequired:ao}},so,co,lo,uo){if(!oo&&!ao){lo(io);return}if(so(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),oo){co("verify-email"),dynamicEvents.once("emailVerificationResult",(ho,go)=>{io.email=go,ho?lo(io):uo("Failed to verify email, no fields were updated")});return}co("verify-sms"),dynamicEvents.once("smsVerificationResult",(ho,{phone:go})=>{io.phoneNumber=go,ho?lo(io):uo("Failed to verify phone number, no fields were updated")})}),useUpdateUserWithModal=Xr=>{const{user:eo,projectSettings:to,setShowAuthFlow:ro}=useInternalDynamicContext(),{setView:no}=useViewContext(),io=reactExports.useContext(UserFieldEditorContext);if(!io)throw new DynamicError("useUserUpdateRequest can only be used inside the context of DynamicContextProvider");const{open:oo}=io;return reactExports.useCallback((so,co)=>new Promise((lo,uo)=>{const ho=validateUpdateRequest(so,eo,to);if(ho){uo(ho);return}oo({fields:so,submitText:co==null?void 0:co.submitText,subtitle:co==null?void 0:co.subtitle,title:co==null?void 0:co.title},Xr).then(go=>saveUserValues(go,ro,no,lo,uo)).catch(go=>{if(/email already exists/gi.test(go))throw go;uo(go)})}),[eo,to,oo,Xr,ro,no])},useUserUpdateRequestInternal=({validationSchemaStripUnknown:Xr})=>{const eo=useUpdateUser(Xr),to=useUpdateUserWithModal(eo);return{updateUser:eo,updateUserWithModal:to}},OnboardingUserDataForm=({children:Xr,userProfile:eo,disableSubmit:to})=>{const{policiesConsentInnerComponent:ro,userWithMissingInfo:no}=useInternalDynamicContext(),{error:io}=useErrorContext(),{completeAuth:oo}=useUserAuth({}),{updateUser:ao}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),so=reactExports.useCallback(wo=>__awaiter$j(void 0,void 0,void 0,function*(){yield oo({updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return ao(wo)})})}),[oo,ao]),{fetch:co,formikInitialValues:lo,formikValidationSchema:uo,enforcePolicies:ho,onFormSubmit:go}=useUserDataForm({fields:(no==null?void 0:no.missingFields)||[],onSubmit:so,userProfile:eo}),bo=[ro].flat();return jsxRuntimeExports.jsx(Formik,{onSubmit:go,initialValues:lo,validationSchema:uo,children:({errors:wo,touched:Eo,values:$o})=>{var Co;const Ro=to||ho&&(bo==null?void 0:bo.length)!==((Co=$o.policiesConsentArray)===null||Co===void 0?void 0:Co.length);return jsxRuntimeExports.jsx(Form,{className:"user-data-form__form",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Xr,io&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"user-data-form__error",children:io}),jsxRuntimeExports.jsx(UserDataFields,{fields:no==null?void 0:no.missingFields,errors:wo,touched:Eo,policiesConsentInnerComponentArray:bo}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",loading:co,disabled:Ro,buttonVariant:"primary",expanded:!0,buttonPadding:"login-screen-height",children:"Continue"})]})})}})},CollectUserDataView=()=>{var Xr;const{appName:eo,projectSettings:to,network:ro,selectedWalletConnector:no,handleLogOut:io,onboardingImageUrl:oo,userWithMissingInfo:ao}=useInternalDynamicContext(),[so,co]=reactExports.useState(!1),lo=useFetchNameService(),{t:uo}=useTranslation();if(!ao)return null;const ho=(no==null?void 0:no.evmNetworks)||[],bo=!(!ro||isSupportedNetwork({network:ro,walletConnector:no}))&&!!no,wo=(Xr=ao==null?void 0:ao.verifiedCredentials.find(Eo=>Eo.id===ao.lastVerifiedCredentialId))===null||Xr===void 0?void 0:Xr.address;return jsxRuntimeExports.jsxs("div",{className:"collect-user-data","data-testid":"collect-user-data-view",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__network-container",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__img-container",children:[lo!=null&&lo.avatar?jsxRuntimeExports.jsx("img",{src:lo.avatar,alt:"",className:"collect-user-data__img collect-user-data__img--rounded"}):jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:28}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data__wallet-address",children:(lo==null?void 0:lo.name)||shortenWalletAddress(wo,3,3)})]}),no&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:ro,evmNetworks:ho,connector:no,showNetworkName:!0,isNetworkPickerOpen:so,setIsNetworkPickerOpen:co,buttonClassName:"collect-user-data__network-picker-button",mainClassName:"collect-user-data__network-picker"})]}),oo&&jsxRuntimeExports.jsx("img",{className:"collect-user-data__main-img",src:oo,alt:"onboarding"}),bo&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"collect-user-data__error--not-supported",copykey:"dyn_collect_user_data.not_supported_network.error_message",children:uo("dyn_collect_user_data.not_supported_network.error_message")}),jsxRuntimeExports.jsxs("div",{className:classNames("collect-user-data__form",{"collect-user-data__form--error":bo}),children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{disableSubmit:bo,userProfile:ao,children:bo?jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.not_supported_network.title",children:uo("dyn_collect_user_data.not_supported_network.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.not_supported_network.description",children:uo("dyn_collect_user_data.not_supported_network.description")})]}):jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(to==null?void 0:to.general.collectUserDataWelcomeHeader)||uo("dyn_collect_user_data.greeting",{appName:eo})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(to==null?void 0:to.general.collectUserDataWelcomeMessage)||uo("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data__log-out",onClick:io,copykey:"dyn_collect_user_data.log_out_button",children:uo("dyn_collect_user_data.log_out_button")})]})]})},CollectUserDataViewNoWallet=({userIdentification:Xr,userIdentificationOverride:eo})=>{var to;const{appName:ro,handleLogOut:no,projectSettings:io,onboardingImageUrl:oo,userWithMissingInfo:ao}=useInternalDynamicContext(),{t:so}=useTranslation();return ao?jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet","data-testid":"collect-user-data-login-no-wallet",children:[oo&&jsxRuntimeExports.jsx("img",{className:"collect-user-data-login-no-wallet__main-img",src:oo,alt:"onboarding"}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__user-info-container",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:ao})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data-login-no-wallet__user-identification",children:(to=eo??ao[Xr])!==null&&to!==void 0?to:getUserIdentifier(ao)})]}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__form",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{userProfile:ao,children:jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data-login-no-wallet__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(io==null?void 0:io.general.collectUserDataWelcomeHeader)||so("dyn_collect_user_data.greeting",{appName:ro})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(io==null?void 0:io.general.collectUserDataWelcomeMessage)||so("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data-login-no-wallet__log-out",onClick:no,copykey:"dyn_collect_user_data.log_out_button",children:so("dyn_collect_user_data.log_out_button")})]})]}):null};var _path$q,_excluded$y=["title","titleId"];function _extends$A(){return _extends$A=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$y(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasswordHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$y(eo,_excluded$y);return reactExports.createElement("svg",_extends$A({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$q||(_path$q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-7.618-38.89v-4.037a8.074 8.074 0 0 1 16.147 0v4.036a13.436 13.436 0 0 1 5.383 10.766c0 7.431-6.025 13.456-13.456 13.456-7.432 0-13.456-6.025-13.456-13.456 0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.074 5.074 0 0 0-10.147 0v2.336a13.416 13.416 0 0 1 5.074-.99c1.795 0 3.507.352 5.073.99ZM34.5 36.663a3.5 3.5 0 1 0-3 0V39.5a1.5 1.5 0 0 0 3 0v-2.837Z",fill:"#4779FF"})))};const validatePassword=Xr=>{const eo=Xr.length>=6,to=/[A-Z]/.test(Xr),ro=/[a-z]/.test(Xr),no=/\d/.test(Xr),io=/\W/.test(Xr);let oo=[ro,to,no,io,eo].filter(Boolean).length;return oo>=3&&Xr.length>=12&&(oo=5),{hasLowerCase:ro,hasNonalphas:io,hasNumbers:no,hasProperLength:eo,hasUpperCase:to,securityCriteria:[{description:"Password is atleast 6 characters in length",key:"hasProperLength",value:eo},{description:"Contains at least one uppercase letter",key:"hasUpperCase",value:to},{description:"Contains at least one lowercase letter",key:"hasLowerCase",value:ro},{description:"Contains at least one number",key:"hasNumbers",value:no},{description:"Contains at least one non-alphanumeric character",key:"hasNonalphas",value:io}],strength:oo}};var _path$p,_excluded$x=["title","titleId"];function _extends$z(){return _extends$z=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$x(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgEyeOffIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$x(eo,_excluded$x);return reactExports.createElement("svg",_extends$z({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$p||(_path$p=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.793 2.293a1 1 0 0 1 1.414 0l3.04 3.04A10.955 10.955 0 0 1 12.5 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6 11.014 11.014 0 0 1-3.552 5.231l2.762 2.762a1 1 0 0 1-1.414 1.414l-18-18a1 1 0 0 1 0-1.414Zm5.943 4.53 1.732 1.731a4 4 0 0 1 5.478 5.478l2.076 2.076A9.022 9.022 0 0 0 20.989 12 9.004 9.004 0 0 0 8.736 6.822Zm5.696 5.695a2 2 0 0 0-2.45-2.45l2.45 2.45ZM5.125 8.174a1 1 0 0 1 .194 1.4A8.975 8.975 0 0 0 4.012 12a9.004 9.004 0 0 0 10.177 5.842 1 1 0 0 1 .372 1.965c-.668.127-1.357.193-2.06.193-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6 10.97 10.97 0 0 1 1.72-3.332 1 1 0 0 1 1.4-.194Z",fill:"#ABACB2"})))};const ToggleVisibilityButton=({initialState:Xr=!1,onClick:eo,className:to=""})=>{const[ro,no]=reactExports.useState(Xr),io=oo=>{oo.preventDefault(),no(ao=>{const so=!ao;return eo==null||eo(so),so})};return jsxRuntimeExports.jsx(TextButton,{className:classNames("toggle-visibility-button__container",to),onClick:oo=>io(oo),children:jsxRuntimeExports.jsx(Tooltip,{className:"toggle-visibility-button__tooltip",content:ro?"Show":"Hide",children:jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:ro?jsxRuntimeExports.jsx(SvgFooterEyeIcon,{}):jsxRuntimeExports.jsx(SvgEyeOffIcon,{})})})})},CreatePasswordStep=({password:Xr,setPassword:eo,currentPassword:to,setCurrentPassword:ro,onContinue:no,isChangingPassword:io,onClose:oo,onLogout:ao})=>{const{primaryWallet:so}=useInternalDynamicContext(),[co,lo]=reactExports.useState("password"),[uo,ho]=reactExports.useState("password"),go=validatePassword(Xr).strength,[bo,wo]=reactExports.useState(go),[Eo,$o]=reactExports.useState(""),[Co,Ro]=reactExports.useState("password"),[Oo,jo]=reactExports.useState(!1),[Bo,Mo]=reactExports.useState(""),{t:Fo}=useTranslation(),Wo=!!((Xr==null?void 0:Xr.length)>=6&&bo>=5&&Eo===Xr&&(!io||to&&to!==Xr)),Jo=oo&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>oo(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Po=(_o,So,To=!0)=>jsxRuntimeExports.jsxs("div",{className:"create-password__password-input__suffix",children:[To&&jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(CopyButton,{textToCopy:Xr,copykey:"dyn_qr_code.copy_button",className:"create-password__password-input__suffix__icon",children:jsxRuntimeExports.jsx(SvgCopy,{className:"create-password__password-input__suffix__icon",onClick:Ao=>{Ao.preventDefault()}})})}),jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:_o==="password",onClick:Ao=>So(Ao?"password":"text"),className:"create-password__password-input__suffix__icon"})]}),fo=_o=>__awaiter$j(void 0,void 0,void 0,function*(){_o.preventDefault();const So=so==null?void 0:so.connector;if(io&&isCoinbaseMpcWalletConnector(So)){jo(!0);try{if(!(yield So.validatePasscode(to))){Mo(Fo("dyn_create_password.errors.invalid_current_password"));return}}catch{Mo(Fo("dyn_create_password.errors.error_changing_password"));return}finally{jo(!1)}}Wo&&no()}),yo=_o=>{const So=_o.target.value,{strength:To}=validatePassword(So);if(wo(To),eo(So),io){Mo(to===So?Fo("dyn_create_password.errors.new_password_same_as_old"):So&&Eo&&So!==Eo?Fo("dyn_create_password.errors.password_mismatch"):"");return}So!=null&&So.length||Mo("")},vo=_o=>{const So=_o.target.value;Mo(So!==Xr?Fo("dyn_create_password.errors.password_mismatch"):""),$o(So)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Jo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.title",children:Fo(io?"dyn_create_password.title.update":"dyn_create_password.title.create")})}),jsxRuntimeExports.jsx("div",{className:"create-password",children:jsxRuntimeExports.jsxs("form",{className:"create-password__body","data-testid":"create-password-form",onSubmit:fo,children:[jsxRuntimeExports.jsxs("div",{className:"create-password__body__header",children:[jsxRuntimeExports.jsx(SvgPasswordHero,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:Fo("dyn_create_password.description")})]}),Bo&&jsxRuntimeExports.jsx(ErrorContainer,{children:Bo}),io&&jsxRuntimeExports.jsx(Input,{id:"current-password",placeholder:Fo("dyn_create_password.current_password_input.placeholder"),type:co,suffix:Po(co,lo,!1),label:Fo("dyn_create_password.current_password_input.label"),value:to,onChange:_o=>ro(_o.target.value),autoFocus:!0,copykey:"dyn_create_password.current_password_input"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:Fo(io?"dyn_create_password.update_input.placeholder":"dyn_create_password.create_input.placeholder"),type:uo,suffix:Po(uo,ho),label:Fo(io?"dyn_create_password.update_input.label":"dyn_create_password.create_input.label"),value:Xr,onChange:yo,autoFocus:!io,copykey:"dyn_create_password.create_input"})}),Xr.length>=1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"create-password__body__card",children:validatePassword(Xr).securityCriteria.map(_o=>jsxRuntimeExports.jsxs("div",{className:`create-password__password-criteria-list ${_o.value?"create-password__password-criteria-list__success":"create-password__password-criteria-list__error"}`,children:[jsxRuntimeExports.jsx("div",{children:_o.value?jsxRuntimeExports.jsx(SvgCheck,{className:"create-password__password-criteria-icon"}):jsxRuntimeExports.jsx(SvgClose,{className:"create-password__password-criteria-icon"})}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",children:_o.description})]},_o.key))}),jsxRuntimeExports.jsx(Input,{id:"confirm-password",placeholder:Fo("dyn_create_password.confirm_input.placeholder"),type:Co,suffix:Po(Co,Ro,!1),label:Fo("dyn_create_password.confirm_input.label"),value:Eo,onChange:vo,copykey:"dyn_create_password.confirm_input"})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!Wo,copykey:"dyn_create_password.continue",type:"submit",loading:Oo,children:Fo("dyn_create_password.continue")}),ao&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:ao,copykey:"dyn_create_password.logout",children:Fo("dyn_create_password.logout")})]})})]})};var _path$o,_excluded$w=["title","titleId"];function _extends$y(){return _extends$y=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$w(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDownload=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$w(eo,_excluded$w);return reactExports.createElement("svg",_extends$y({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$o||(_path$o=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.417 14.167c0 .92.746 1.666 1.666 1.666h8.334c.92 0 1.666-.746 1.666-1.666v-.834a.833.833 0 0 1 1.667 0v.834a3.333 3.333 0 0 1-3.333 3.333H6.083a3.333 3.333 0 0 1-3.333-3.333v-.834a.833.833 0 0 1 1.667 0v.834Zm1.91-4.756a.833.833 0 0 1 1.179 0l1.91 1.91V3.333a.833.833 0 0 1 1.667 0v7.989l1.911-1.911a.833.833 0 1 1 1.179 1.178l-3.334 3.334a.833.833 0 0 1-1.178 0l-3.334-3.334a.833.833 0 0 1 0-1.178Z",fill:"#ABACB2"})))},_path$n,_path2$3,_path3$2,_path4$1,_g$8,_path5$1,_defs$8,_excluded$v=["title","titleId"];function _extends$x(){return _extends$x=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$v(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSavePasswordHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$v(eo,_excluded$v);return reactExports.createElement("svg",_extends$x({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("g",{clipPath:"url(#save-password-hero_svg__a)"},reactExports.createElement("mask",{id:"save-password-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$n||(_path$n=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__b)"},_path2$3||(_path2$3=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#save-password-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"save-password-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$2||(_path3$2=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__d)"},reactExports.createElement("mask",{id:"save-password-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$1||(_path4$1=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$8||(_g$8=reactExports.createElement("g",{mask:"url(#save-password-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.467 10.138-10.37 17.962a14.612 14.612 0 0 0 6.096 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.374-8.688a5.5 5.5 0 1 1 10.624-2.848 5.5 5.5 0 0 1-10.624 2.848Z",fill:"#DD8500"})))),_path5$1||(_path5$1=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.944 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.816.527l-.134.05-16.681 6.255-.406.152c-1.922.718-3.61 1.347-4.91 2.493a9.331 9.331 0 0 0-2.552 3.682c-.616 1.619-.614 3.42-.611 5.472l.001.434v14.875c0 8.792 4.782 16.123 9.952 21.508 5.204 5.42 11.159 9.25 14.308 11.086l.127.075c.575.337 1.32.775 2.307.987a6.623 6.623 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.149-1.836 9.103-5.665 14.308-11.086 5.169-5.385 9.952-12.716 9.952-21.508V50.695c.003-2.052.006-3.853-.61-5.472a9.331 9.331 0 0 0-2.552-3.682c-1.3-1.145-2.988-1.775-4.91-2.493l-.407-.152-16.68-6.254-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-.36 18.497c1.726 0 3.126 1.4 3.126 3.126v12.504a3.126 3.126 0 0 1-6.253 0V53.687c0-1.726 1.4-3.126 3.127-3.126Zm-3.127 28.135c0-1.727 1.4-3.126 3.127-3.126h.031a3.127 3.127 0 1 1 0 6.252h-.031a3.127 3.127 0 0 1-3.127-3.126Z",fill:"#DD8500"})))),_defs$8||(_defs$8=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"save-password-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#DD8500"}),reactExports.createElement("stop",{offset:.985,stopColor:"#DD8500",stopOpacity:0})),reactExports.createElement("clipPath",{id:"save-password-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const downloadFile=(Xr,eo)=>{const to=document.createElement("a"),ro=new Blob([eo],{type:"text/plain"});to.href=URL.createObjectURL(ro),to.download=Xr,document.body.appendChild(to),to.click()},SavePasswordStep=({password:Xr,error:eo,isLoading:to,onSave:ro,onBack:no,onClose:io,onLogout:oo})=>{const{t:ao}=useTranslation(),[so,co]=reactExports.useState("password"),[lo,uo]=reactExports.useState(!1),[ho,go]=reactExports.useState(!1),bo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>no(),"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),wo=io&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>io(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Eo=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:so==="password",onClick:Co=>co(Co?"password":"text"),className:"save-password-suffix-icon"}),$o=Co=>__awaiter$j(void 0,void 0,void 0,function*(){Co.preventDefault(),ro()});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:bo,trailing:wo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_save_password.title",children:ao("dyn_save_password.title")})}),jsxRuntimeExports.jsx("div",{className:"save-password-view",children:jsxRuntimeExports.jsxs("form",{className:"save-password-view__body","data-testid":"save-password-form",onSubmit:$o,children:[jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgSavePasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(Badge,{text:ao("dyn_save_password.badge_text"),className:"save-password-view__body__badge",copykey:"dyn_save_password.badge_text"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__body__description",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_save_password.description",children:ao("dyn_save_password.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",copykey:"dyn_save_password.description",children:ao("dyn_save_password.warning")})]}),eo&&jsxRuntimeExports.jsx(ErrorContainer,{children:eo}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:ao("dyn_save_password.password_input.placeholder"),type:so,suffix:Eo,disabled:!0,label:ao("dyn_save_password.password_input.label"),value:Xr,autoFocus:!0,copykey:"dyn_save_password.password_input"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-copy",buttonPadding:"small",buttonVariant:"primary",onClick:Co=>{Co.preventDefault(),copyToClipboard(Xr),go(!0)},startSlot:jsxRuntimeExports.jsx(SvgCopy,{}),expanded:!0,copykey:"dyn_save_password.copy_button",children:ao(ho?"dyn_save_password.copy_button.copied":"dyn_save_password.copy_button.copy")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-download",buttonPadding:"small",buttonVariant:"primary",onClick:Co=>{Co.preventDefault(),downloadFile("wallet-recovery.txt",Xr)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_save_password.download_button",children:ao("dyn_save_password.download_button")})]}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__confirm-card",children:jsxRuntimeExports.jsxs("button",{className:"save-password-view__body__card__acknowledgement",onClick:Co=>{Co.stopPropagation(),uo(!lo)},type:"button",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:lo,onChange:Co=>{Co.stopPropagation(),uo(!lo)},className:"save-password-view__body__card__statement__checkbox"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",style:{letterSpacing:"-0.15px"},color:"primary",copykey:"dyn_save_password.checkbox_label",children:ao("dyn_save_password.checkbox_label")})})]})}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-submit",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!lo,loading:to,type:"submit",copykey:"dyn_save_password.continue",children:ao("dyn_save_password.continue")}),oo&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:oo,copykey:"dyn_save_password.logout",children:ao("dyn_save_password.logout")})]})})]})},CreatePasswordView=({onSuccess:Xr,onError:eo,closeView:to,notCalledFromWalletUtils:ro,isSignUp:no})=>{var io;const{setShowAuthFlow:oo,user:ao,projectSettings:so,primaryWallet:co,handleLogOut:lo,walletConnectorOptions:uo}=useInternalDynamicContext(),{t:ho}=useTranslation(),{claimWallet:go}=useEmbeddedWalletPassword(),[bo,wo]=reactExports.useState("create-password"),Eo=(io=ao==null?void 0:ao.verifiedCredentials.find(To=>To.walletName==="coinbasempc"))===null||io===void 0?void 0:io.walletProperties,$o=!!(Eo!=null&&Eo.claimed),Co=to??!0,[Ro,Oo]=reactExports.useState(""),[jo,Bo]=reactExports.useState(""),[Mo,Fo]=reactExports.useState(!1),[Wo,Jo]=reactExports.useState(""),Po=requiresPasswordForEmbeddedWallet(so),fo=$o||!Po,yo=()=>__awaiter$j(void 0,void 0,void 0,function*(){wo("save-password")}),vo=()=>__awaiter$j(void 0,void 0,void 0,function*(){var To,Ao,ko;Fo(!0);try{if(!no){const mo=(ko=(To=co==null?void 0:co.connector)!==null&&To!==void 0?To:(Ao=findCoinbaseMPCWallet(uo))===null||Ao===void 0?void 0:Ao.walletConnector)!==null&&ko!==void 0?ko:void 0;ro&&isCoinbaseMpcWalletConnector(mo)&&(yield mo.changePasscode(jo,Ro)),$o||(yield go())}Xr==null||Xr(jo),Co&&oo(!1,{ignoreIfIsEmbeddedWidget:!1}),dynamicEvents.emit("embeddedWalletCreatePasswordCompleted",jo)}catch(mo){logger$8.debug(`Error ${$o?"updating":"creating"} password`,mo),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",mo),mo instanceof Error&&Jo(mo.message),eo==null||eo(mo)}finally{Fo(!1)}}),_o=()=>{if(Po){const To=new Error(ho("dyn_create_password.errors.user_closed_view"));eo==null||eo(To,!0),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",To)}oo(!1)},So=To=>{To==null||To.preventDefault();const Ao=new Error(ho("dyn_create_password.errors.user_closed_view"));eo==null||eo(Ao,!0),lo()};return bo==="save-password"?jsxRuntimeExports.jsx(SavePasswordStep,{password:jo,onBack:()=>wo("create-password"),error:Wo,isLoading:Mo,onSave:()=>vo(),onClose:fo?()=>_o():void 0,onLogout:fo?void 0:So}):jsxRuntimeExports.jsx(CreatePasswordStep,{password:jo,setPassword:Bo,currentPassword:Ro,setCurrentPassword:Oo,onContinue:()=>yo(),isChangingPassword:$o,onClose:fo?()=>_o():void 0,onLogout:fo?void 0:So})};var _path$m,_excluded$u=["title","titleId"];function _extends$w(){return _extends$w=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$u(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPencilAltIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$u(eo,_excluded$u);return reactExports.createElement("svg",_extends$w({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$m||(_path$m=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.638 2.862a.667.667 0 0 0-.943 0L7.167 8.391v.943h.942l5.53-5.53a.667.667 0 0 0 0-.942Zm-1.886-.943a2 2 0 1 1 2.829 2.829l-5.724 5.724a.667.667 0 0 1-.471.195H6.5A.667.667 0 0 1 5.833 10V8.115c0-.177.07-.347.196-.472l5.723-5.724ZM4.5 4a.667.667 0 0 0-.667.667V12c0 .368.299.667.667.667h7.333A.667.667 0 0 0 12.5 12V8.667a.667.667 0 0 1 1.333 0V12a2 2 0 0 1-2 2H4.5a2 2 0 0 1-2-2V4.667a2 2 0 0 1 2-2h3.333a.667.667 0 0 1 0 1.333H4.5Z",fill:"currentColor"})))};const EmailConfirmationWaitingView=()=>{const{setView:Xr}=useViewContext(),{clearStatesOnBackClick:eo,selectedWalletConnector:to}=useInternalDynamicContext(),{t:ro}=useTranslation();if(to&&!isEmailWalletConnector(to))throw new Error("Wallet connector is not email provider");const no=to,io=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){yield no==null?void 0:no.endSession(),Xr("login-with-email-or-wallet"),eo()}),[Xr,no,eo]);return jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view",children:[jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__header-icon",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:SignInWithEmailIcon,iconSize:80,isSpinning:!0})}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"email-confirmation-waiting-view__title",copykey:"dyn_email_confirmation.title",children:ro("dyn_email_confirmation.title")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_normal",color:"secondary",copykey:"dyn_email_confirmation.description",children:ro("dyn_email_confirmation.description")}),jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view__email-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"medium",as:"span",children:no==null?void 0:no.email}),jsxRuntimeExports.jsx(IconButton,{onClick:io,className:"email-confirmation-waiting-view__edit-icon-button","data-testid":"email-confirmation-waiting-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]}),jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__note",children:jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",copykey:"dyn_email_confirmation.note",children:ro("dyn_email_confirmation.note")})}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"email-confirmation-waiting-view__powered_by_dynamic_footer"})]})};var _circle$4,_path$l,_path2$2,_excluded$t=["title","titleId"];function _extends$v(){return _extends$v=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$t(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignInWithEmail=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$t(eo,_excluded$t);return reactExports.createElement("svg",_extends$v({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$4||(_circle$4=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$l||(_path$l=reactExports.createElement("path",{d:"M51 29.333a1.333 1.333 0 0 0-1.333 0l-17.334 9.8L15 29.333a1.333 1.333 0 0 0-2 1.16V42a4 4 0 0 0 4 4h30.667a4 4 0 0 0 4-4V30.5A1.333 1.333 0 0 0 51 29.333Z",fill:"#fff"})),_path2$2||(_path2$2=reactExports.createElement("path",{d:"M47.667 18H17a4 4 0 0 0-4 4v2.5a1.334 1.334 0 0 0 .667 1.16l18 10.167a1.333 1.333 0 0 0 1.333 0L51 25.66a1.334 1.334 0 0 0 .667-1.16V22a4 4 0 0 0-4-4Z",fill:"#fff"})))};const MIN_EVENT_TIME=10,useOnUnmount=Xr=>{const eo=reactExports.useRef(Xr);eo.current=Xr,reactExports.useEffect(()=>{const to=new Date;return()=>{new Date().getTime()-to.getTime()!Xr||eo.length>2?eo.split(""):eo===""?[]:Xr[0]===eo[0]?[eo[1]]:[eo[0]],PinInput=({autoFocus:Xr,disabled:eo,inputIndex:to,inputMode:ro,isValidated:no,name:io,onChange:oo,pattern:ao,type:so,value:co,values:lo,hasError:uo})=>{const ho=reactExports.useRef(null),go=wo=>{const Eo=lo[to],$o=wo.target.value.replace(/\s+/g,""),Co=[...lo],Ro=normalizeNewValue(Eo,$o).slice(0,Co.length-to),Oo=(Fo,Wo)=>Co[to+Wo]=Fo,jo=so==="number"?/(^$)|(\d+)/:/.*/,Bo=Ro.every(Fo=>jo.test(Fo));let Mo=ho.current;if(Bo){Ro.length?Ro.forEach(Oo):Co[to]="",oo(Co);for(let Fo=0;Fo{var Eo;if(wo==="Backspace"&&lo[to]===""&&to>0){const $o=(Eo=ho.current)===null||Eo===void 0?void 0:Eo.previousElementSibling;$o instanceof HTMLInputElement&&$o.focus()}};return reactExports.useEffect(()=>{var wo;Xr&&to===0&&((wo=ho==null?void 0:ho.current)===null||wo===void 0||wo.focus())},[Xr,to]),jsxRuntimeExports.jsx("input",{ref:ho,className:classNames("pin-input__input",{"pin-input__input--error":!!uo,"pin-input__input--success":!!no}),disabled:eo,name:io,value:co,onChange:go,onKeyDown:bo,"data-testid":to,pattern:ao,inputMode:ro})},isComplete=Xr=>Xr.every(eo=>eo),PinField=({handleComplete:Xr,initialValue:eo,inputMode:to,isLoading:ro,isValidated:no,pattern:io,type:oo="number",hasError:ao,onChange:so,disabled:co})=>{const[lo,uo]=reactExports.useState(eo),ho=go=>{const bo=go.join("");uo(go),so==null||so(bo),isComplete(go)&&Xr(bo)};return jsxRuntimeExports.jsx("div",{className:"pin-field__container",children:lo.map((go,bo)=>jsxRuntimeExports.jsx(PinInput,{values:lo,inputIndex:bo,value:go,onChange:ho,disabled:ro||co,inputMode:to,isValidated:no,pattern:io,type:oo,autoFocus:!0,hasError:ao},`pin_input_${bo}`))})};var _path$k,_excluded$s=["title","titleId"];function _extends$u(){return _extends$u=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$s(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCheckCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$s(eo,_excluded$s);return reactExports.createElement("svg",_extends$u({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$k||(_path$k=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2.666a5.333 5.333 0 1 0 0 10.667A5.333 5.333 0 0 0 8 2.666ZM1.333 8a6.667 6.667 0 1 1 13.333 0A6.667 6.667 0 0 1 1.333 8Zm9.138-1.805c.26.26.26.682 0 .943L7.804 9.804a.667.667 0 0 1-.942 0L5.528 8.471a.667.667 0 1 1 .943-.943l.862.862 2.195-2.195c.26-.26.683-.26.943 0Z",fill:"currentColor"})))};const useCountdown=({callback:Xr,seconds:eo})=>{const[to,ro]=reactExports.useState(eo),no=reactExports.useRef(),io=()=>{if(no.current)return ro(eo);ao()},oo=()=>{clearTimeout(no.current),no.current=void 0},ao=()=>{no.current=setTimeout(()=>{ro(so=>so-1)},1e3)};return reactExports.useEffect(()=>{if(no.current){if(to<=0){Xr&&Xr();return}return ao(),()=>clearTimeout(no.current)}},[to,Xr]),{remainingSeconds:to,startCountdown:io,stopCountdown:oo}},RetrySendVerificationCodeSection=({retryHandler:Xr,secondsToRetry:eo=15,disabled:to=!1,className:ro})=>{const{t:no}=useTranslation(),[io,oo]=reactExports.useState(!1),{remainingSeconds:ao,startCountdown:so}=useCountdown({callback:()=>oo(!1),seconds:eo}),{isLoading:co,mutate:lo}=useMutation(Xr,{onSuccess:()=>{oo(!0),so()}}),uo=classNames("retry-send-verification-code-section",ro);return io?jsxRuntimeExports.jsxs("div",{className:uo,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_otp_verification.resend_code_in",children:no("dyn_otp_verification.resend_code_in",{remainingSeconds:ao})}),jsxRuntimeExports.jsxs("span",{className:"retry-send-verification-code-section__confirmation",children:[jsxRuntimeExports.jsx(Icon,{color:"success-1",children:jsxRuntimeExports.jsx(SvgCheckCircle,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"primary",copykey:"dyn_otp_verification.code_sent",children:no("dyn_otp_verification.code_sent")})]})]}):jsxRuntimeExports.jsxs("div",{className:uo,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",copykey:"dyn_otp_verification.code_not_received",children:no("dyn_otp_verification.code_not_received")}),jsxRuntimeExports.jsx(TextButton,{className:"email-verification__text-button",disabled:co||to,onClick:()=>lo(),copykey:"dyn_otp_verification.resend_code",children:no("dyn_otp_verification.resend_code")})]})},SECONDS_TO_RETRY=15,EmailVerification=({isEmailRecoveryFlow:Xr=!1,showRetryButton:eo=!0,showTransferMessage:to=!1})=>{var ro,no,io,oo;const{environmentId:ao,handleLogOut:so,setPrimaryWalletId:co,setShowAuthFlow:lo,projectSettings:uo,user:ho,userWithMissingInfo:go,walletConnectorOptions:bo,primaryWallet:wo}=useInternalDynamicContext(),{setView:Eo,goToInitialView:$o}=useViewContext(),{error:Co,setError:Ro,setErrorMessage:Oo}=useErrorContext(),{loading:jo,setLoading:Bo}=useLoadingContext(),[Mo,Fo]=reactExports.useState(eo),[Wo,Jo]=reactExports.useState(to),{getEOAWallet:Po}=useSmartWallets(),[fo,yo]=reactExports.useState(!1),vo=reactExports.useRef(fo),_o=Il=>{yo(Il),vo.current=Il},{displayedDestination:So,verificationUUID:To,setVerificationUUID:Ao}=useVerification(),{t:ko}=useTranslation(),{addRecoveryEmail:mo}=usePasskeyRecovery(),{isTurnkeyWallet:Io,hasTurnkeyVerifiedCredentialAuthenticator:Do,hasRecoveryEmail:Lo}=useIsTurnkeyWallet(),Ho=isTurnkeyEnabled(uo),{initAuth:Yo,completeAuth:Xo,cancelAuth:qo}=useUserAuth({authMethod:"email"}),{generateSessionKey:Ko,shouldRegisterSessionKeysOnSignin:Qo}=useEmbeddedWalletSessionKeys(ao),zo=reactExports.useRef(!0);useOnUnmount(()=>{if(!zo.current)return;const Il=So??"";dynamicEvents.emit("emailVerificationResult",vo.current,Il),vo.current||dynamicEvents.emit("authFailure",{email:Il,option:Il,type:"email"},"user-cancelled"),So||logger$8.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined")});const{verifyOtp:ga}=useOtpVerificationRequest(),$a=reactExports.useCallback(Il=>__awaiter$j(void 0,void 0,void 0,function*(){var Zl,Vl,Ol,Dl,Fl,Jl;if(Il.nextView==="verified-and-transferred"&&(Jo==null||Jo(!0)),Xr)return Eo("passkey-recovery-add-email",{canSkipAddingEmail:!1,isFromEmailVerification:!0}),!0;if(!Io)return!1;if(Do&&!Lo&&(!((Zl=Il==null?void 0:Il.user)===null||Zl===void 0)&&Zl.email))return storeAuthTokenAndUser(Il),yield mo(Il.user.email),lo(!1),!0;if(Ho){const cu=(Ol=(Vl=uo==null?void 0:uo.sdk)===null||Vl===void 0?void 0:Vl.embeddedWallets)===null||Ol===void 0?void 0:Ol.automaticEmbeddedWalletCreation,Ll=wo&&Po(wo),Xl=wo&&isSessionKeyCompatibleWallet(wo)||Ll&&isSessionKeyCompatibleWallet(Ll),ku=!!(cu&&(!(!((Fl=(Dl=uo==null?void 0:uo.sdk)===null||Dl===void 0?void 0:Dl.embeddedWallets)===null||Fl===void 0)&&Fl.forceAuthenticatorAtSignup)||Xl));if(ku){const iu=findPrimaryEmbeddedChain(uo),hu=findEmbeddedWalletFromVerifiedCredentials(createUserProfileFromSdkUser(Il.user),[iu]);if(!hu)throw new Error("Could not find an embedded wallet");const Cu=bo==null?void 0:bo.find(Go=>Go.key===hu.walletName);if(!(Cu!=null&&Cu.walletConnector))throw new Error("Could not find connector for embedded wallet");const _l=Cu.walletConnector.createWallet({address:hu.address||"",chain:Cu.walletConnector.connectedChain,connector:Cu.walletConnector,id:hu.id,isAuthenticated:!1,key:(Jl=hu.walletName)!==null&&Jl!==void 0?Jl:""});co(hu.id),dynamicEvents.emit("embeddedWalletCreated",_l,hu,ho)}if(ku||!cu)return lo(!1),!0}return!1}),[Xr,Io,Do,Lo,Ho,Eo,mo,lo,(no=(ro=uo==null?void 0:uo.sdk)===null||ro===void 0?void 0:ro.embeddedWallets)===null||no===void 0?void 0:no.automaticEmbeddedWalletCreation,(oo=(io=uo==null?void 0:uo.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0?void 0:oo.forceAuthenticatorAtSignup,wo,Po,bo,co,ho]),Sl=reactExports.useCallback(Il=>__awaiter$j(void 0,void 0,void 0,function*(){return Ro(void 0),Bo(!0),To?!ho&&!go?Yo({onVerifySuccess:()=>_o(!0),options:{email:So},showSuccessMessage:!0,verifyFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){let Zl;return Qo()&&(Zl=(yield Ko()).publicKey),signInWithEmailVerification({environmentId:ao,sessionPublicKey:Zl,verificationToken:Il,verificationUUID:To})})}):Xo({completeSignInFlow:Zl=>__awaiter$j(void 0,void 0,void 0,function*(){return $a(Zl)}),onValidUpdatedJwt:()=>{_o(!0)},options:{email:So,isEmailRecoveryFlow:Xr},updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return ga(Il,"email",To)})}):qo()}),[Ro,Bo,To,ho,go,Xo,So,Xr,qo,Yo,ao,$a,ga]),El=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{if(!To||!So)return;Bo(!0);const{verificationUUID:Il}=yield retryEmailVerification({email:So,environmentId:ao,verificationUUID:To});Ao(Il),Ro(void 0)}catch(Il){logger$8.debug(Il),Oo(Il.code),Il.code==="too_many_email_verification_attempts"&&Fo(!1),Il.code==="invalid_email_verification"&&$o()}finally{Bo(!1)}}),Tl=reactExports.useMemo(()=>Zl=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},Zl))}),[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Co&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"email-verification__error-message",children:Co}),jsxRuntimeExports.jsxs("div",{className:classNames("email-verification__container",{"email-verification__container--error":!!Co}),children:[Wo&&jsxRuntimeExports.jsx("div",{className:"email-verification__transfer-message",copykey:"dyn_otp_verification.email.complete",children:ko("dyn_otp_verification.email.complete")}),fo?jsxRuntimeExports.jsx("div",{className:"email-verification__icon-container",children:jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"email-verification__icon--verified",Icon:Tl,iconSize:64,InnerIcon:SvgCheck})}):jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Tl,iconSize:96,isSpinning:!0,className:"email-verification__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"email-verification__copy-text-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:ko("dyn_otp_verification.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:shortenEmail(So)})]}),jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:jo,handleComplete:Sl,isValidated:fo,inputMode:"numeric",pattern:"[0-9]*",hasError:!!Co,onChange:()=>Ro(void 0)}),Mo&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"email-verification__retry-container",retryHandler:El,secondsToRetry:SECONDS_TO_RETRY}),(ho||go)&&!Xr&&jsxRuntimeExports.jsx(TextButton,{className:"email-verification__log-out",onClick:so,copykey:"dyn_otp_verification.log_out_button",children:ko("dyn_otp_verification.log_out_button")})]})]})},EmailIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},Xr,{"data-testid":"sign-in-with-email-icon"}))}),typographyColor={error:"error-1",notice:"brand-primary",success:"green-1"},ModalHeaderBanner=({messageKey:Xr,type:eo="error",disableTruncate:to=!1})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:!!Xr&&jsxRuntimeExports.jsx("div",{className:classNames("modal-header-banner",{"modal-header-banner__error":eo==="error","modal-header-banner__notice":eo==="notice","modal-header-banner__success":eo==="success"}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:typographyColor[eo],truncate:to===!1,copykey:Xr,children:ro(Xr||"")})})})},OTPVerificationView=({onClickBack:Xr,onClickEditDestination:eo,isLoading:to,disabled:ro,displayedDestination:no,description:io,onPinComplete:oo,isValid:ao,error:so,retryHandler:co,onPinChange:lo,successBannerTextKey:uo,MainIcon:ho,hideHeader:go,appendAboveOTPInput:bo,appendToEnd:wo})=>{const{t:Eo}=useTranslation(),$o=Xr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Xr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),Co=reactExports.useMemo(()=>ao?"dyn_otp_verification.verification_succeeded":"dyn_otp_verification.confirm_code",[ao]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!go&&jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",leading:Xr&&$o,children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",copykey:Co,children:Eo(Co)})})}),uo&&jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"notice",messageKey:uo,disableTruncate:!0}),jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"error",messageKey:so==null?void 0:so.message}),jsxRuntimeExports.jsxs("div",{className:classNames("otp-verification-view",{"otp-verification-view--message":!!(uo||so)}),children:[ao&&jsxRuntimeExports.jsx(IconWithStatus,{Icon:ho,iconSize:64,InnerIcon:SvgCheck}),!ao&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ho,iconSize:96,isSpinning:to,className:"otp-verification-view__icon-with-spinner",treatAsFunctionComponent:!0}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__body",children:[ao&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.hang_tight",children:Eo("dyn_otp_verification.hang_tight")}),!ao&&(io?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:io}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:Eo("dyn_otp_verification.description")}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__destination-container",children:[no&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:no}),eo&&jsxRuntimeExports.jsx(IconButton,{onClick:eo,"data-testid":"otp-verification-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]})]}))]}),bo,jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:to,handleComplete:oo,isValidated:ao,inputMode:"numeric",pattern:"[0-9]*",hasError:!!so,onChange:lo,disabled:ro}),co&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"otp-verification-view__retry-container",retryHandler:co}),wo]})]})},EmailWalletOTPVerificationView=()=>{const{setView:Xr}=useViewContext(),[eo,to]=reactExports.useState(),{selectedWalletConnector:ro,clearStatesOnBackClick:no}=useInternalDynamicContext();if(!ro||!isEmailOTPWalletConnector(ro))throw new Error("Current wallet is not EmailWalletConnector");const{email:io}=ro;if(!io)throw new Error("EmailWalletOtpVerificationView requires a email");const oo=()=>{ro.clearEmail(),no(),Xr("login-with-email-or-wallet"),dynamicEvents.emit("authFailure",{email:io,option:io,type:"email"},"user-cancelled")},{data:ao,isLoading:so,mutate:co}=useMutation(lo=>ro.verifyOneTimePassword(lo),{onFailure:lo=>{to(lo),dynamicEvents.emit("emailVerificationResult",!1,io)},onSuccess:()=>{dynamicEvents.emit("emailVerificationResult",!0,io)}});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:EmailIcon,displayedDestination:shortenEmail(io),error:eo,onClickBack:oo,isLoading:so,onPinComplete:co,isValid:ao===!0,retryHandler:ro.retryOneTimePassword.bind(ro),onPinChange:()=>to(void 0),onClickEditDestination:oo,successBannerTextKey:"dyn_magic_verification.banner_text"})};var _g$7,_defs$7,_excluded$r=["title","titleId"];function _extends$t(){return _extends$t=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$r(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExportEmbeddedHero=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$r(eo,_excluded$r);return reactExports.createElement("svg",_extends$t({width:329,height:88,viewBox:"0 0 329 88",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$7||(_g$7=reactExports.createElement("g",{clipPath:"url(#export-embedded-hero_svg__a)"},reactExports.createElement("circle",{cx:164.5,cy:114,r:114,fill:"url(#export-embedded-hero_svg__b)",fillOpacity:.12}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M195 23a4 4 0 0 1 4-4h40a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4h-40a4 4 0 0 1-4-4v-8Zm13.585 4c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667Zm6.34 2.667c1.5 0 2.717-1.194 2.717-2.667 0-1.473-1.217-2.667-2.717-2.667-1.501 0-2.717 1.194-2.717 2.667 0 1.473 1.216 2.667 2.717 2.667ZM226.698 27c0 1.473-1.216 2.667-2.717 2.667-1.5 0-2.717-1.194-2.717-2.667 0-1.473 1.217-2.667 2.717-2.667 1.501 0 2.717 1.194 2.717 2.667Zm8.057 0c0 .903-.751 1.667-1.717 1.667-.966 0-1.717-.764-1.717-1.667s.751-1.667 1.717-1.667c.966 0 1.717.764 1.717 1.667Zm1 0c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667ZM110.237 57.018c8.535-2.287 13.601-11.06 11.314-19.596-2.287-8.535-11.061-13.6-19.596-11.313-8.536 2.287-13.601 11.06-11.314 19.596 2.287 8.535 11.061 13.6 19.596 11.313Zm-8.712-17.797-.522-1.949a4.037 4.037 0 0 1 7.798-2.09l.522 1.95a6.727 6.727 0 1 1-7.798 2.09Zm4.573-2.535-.195-.727a1.036 1.036 0 1 0-2.002.537l.194.726a6.81 6.81 0 0 1 2.003-.536Zm1.567 6.87a1.749 1.749 0 0 0-1.586-3.023 1.75 1.75 0 0 0 .137 3.412l.368 1.37a.75.75 0 1 0 1.448-.388l-.367-1.37Z",fill:"#4779FF"}),reactExports.createElement("path",{d:"M171.501 40.667a4.666 4.666 0 0 1 4.667 4.666h-28a9.306 9.306 0 0 0-6.85 2.995c.788-4.357 4.6-7.661 9.183-7.661h21ZM187.834 59.333A9.334 9.334 0 0 0 178.5 50h-28a9.333 9.333 0 0 0-9.333 9.333V78a9.333 9.333 0 0 0 9.333 9.333h28A9.334 9.334 0 0 0 187.834 78V59.333Z",fill:"#4779FF"}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M174.25 65.25a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-3 0a3 3 0 1 0-6 0 3 3 0 0 0 6 0Zm-9.37 3.892a7.497 7.497 0 0 0 2.005 2.237l-2.831 2.83 2.103 2.103-2.121 2.122-2.103-2.103-2.062 2.062-2.121-2.121 7.13-7.13Z",fill:"#fff"}))),_defs$7||(_defs$7=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"export-embedded-hero_svg__b",x1:164.5,y1:0,x2:164.5,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"export-embedded-hero_svg__a"},reactExports.createElement("rect",{x:.5,width:328,height:88,rx:12,fill:"#fff"})))))},_path$j,_excluded$q=["title","titleId"];function _extends$s(){return _extends$s=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$q(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgInfo=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$q(eo,_excluded$q);return reactExports.createElement("svg",_extends$s({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$j||(_path$j=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 2.333a6.667 6.667 0 1 0 0 13.334A6.667 6.667 0 0 0 9 2.333ZM.667 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .667 9Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 0 1 0 1.667H9a.833.833 0 0 1-.833-.833ZM7.333 9c0-.46.373-.833.834-.833H9c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H9a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 7.333 9Z",fill:"#383C48"})))},_path$i,_excluded$p=["title","titleId"];function _extends$r(){return _extends$r=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$p(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWalletV2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$p(eo,_excluded$p);return reactExports.createElement("svg",_extends$r({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$i||(_path$i=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 4a1 1 0 0 0 0 2h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-14a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h12a1 1 0 1 1 0 2h-12Zm-1 3.83V19a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1h-14c-.35 0-.687-.06-1-.17Zm11 6.17a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",fill:"#ABACB2"})))};const TurnkeyErrorMap={0:"Operation was canceled.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature. Select the passkey for this account and device.",7:"The code is invalid or expired."},reactNativePasskeyErrors={RequestFailed:"Request failed. Please try again.",UserCancelled:TurnkeyErrorMap[0]},DOMExceptionErrorMap={NotAllowedError:"Request Cancelled. Select a device or password manager to set up a passkey."},getProperErrorMessage=Xr=>{var eo;if(typeof Xr=="string")return Xr;if("reason"in Xr)return Xr.reason;if(Xr instanceof DOMException)return DOMExceptionErrorMap[Xr.name]||"Something went wrong";if("cause"in Xr){if(((eo=Xr==null?void 0:Xr.cause)===null||eo===void 0?void 0:eo.code)!==void 0){if(Xr.cause.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[Xr.cause.code]}if(Xr.cause&&"error"in Xr.cause&&typeof Xr.cause.error=="string"&&reactNativePasskeyErrors[Xr.cause.error])return reactNativePasskeyErrors[Xr.cause.error]}if("code"in Xr&&Xr.code){if(Xr.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[Xr.code]}return"error"in Xr&&typeof Xr.error=="string"&&reactNativePasskeyErrors[Xr.error]?reactNativePasskeyErrors[Xr.error]:"Something went wrong"},iframeContainerId="dyn-turnkey-export-container-id",iframeElementId="dyn-turnkey-export-element-id",EmbeddedRevealView=({exportPrivateKey:Xr})=>{var eo,to,ro,no;const{primaryWallet:io,user:oo,setShowAuthFlow:ao,environmentId:so}=useInternalDynamicContext(),{isTurnkeyWallet:co}=useIsTurnkeyWallet(),{shadowRoot:lo}=useShadowDOMContext(),{setDynamicWidgetView:uo}=useWidgetContext(),{setView:ho}=useViewContext(),{getEOAWallet:go,isSmartWallet:bo}=useSmartWallets(),[wo,Eo]=reactExports.useState(!1),[$o,Co]=reactExports.useState(!1),Ro=reactExports.useRef(null),Oo=(to=(eo=oo==null?void 0:oo.verifiedCredentials)===null||eo===void 0?void 0:eo.find(({walletName:Io})=>Io==null?void 0:Io.startsWith("turnkey")))===null||to===void 0?void 0:to.walletProperties,jo=Oo==null?void 0:Oo.turnkeyHDWalletId,Bo=(ro=io&&go(io))!==null&&ro!==void 0?ro:io,Mo=Bo&&isCoinbaseMpcWalletConnector(Bo.connector);reactExports.useEffect(()=>()=>{co&&cleanupExport({wallet:Bo})},[]);const{isLoading:Fo}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){var Io,Do;const Lo=Ro.current;if(!(!Lo||((Io=Lo==null?void 0:Lo.children)===null||Io===void 0?void 0:Io.length)>0))return isSessionKeyCompatibleWalletConnector(Bo==null?void 0:Bo.connector)&&(yield(Do=Bo==null?void 0:Bo.connector)===null||Do===void 0?void 0:Do.createOrRestoreSession()),initExport({iframeContainer:Lo,iframeElementId,wallet:Bo})})),{mutate:Wo,isLoading:Jo,error:Po,data:fo}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){var Io,Do,Lo;if(Mo)return(Bo==null?void 0:Bo.connector).exportWalletKeys();if(co)try{return yield exportCredential({address:Xr?Bo==null?void 0:Bo.address:void 0,environmentId:so,user:oo,wallet:Bo})}catch{return isSessionKeyCompatibleWalletConnector(Bo==null?void 0:Bo.connector)&&(!((Io=Bo==null?void 0:Bo.connector)===null||Io===void 0)&&Io.removeSessionKeys)&&(yield(Do=Bo==null?void 0:Bo.connector)===null||Do===void 0?void 0:Do.removeSessionKeys(),yield(Lo=Bo==null?void 0:Bo.connector)===null||Lo===void 0?void 0:Lo.createOrRestoreSession({ignoreRestore:!0})),exportCredential({address:Xr?Bo==null?void 0:Bo.address:void 0,environmentId:so,user:oo,wallet:Bo})}}),{onFailure:Io=>{logger$8.error("Failed to export",Io),dynamicEvents.emit("embeddedWalletRevealFailed",Io)},onSuccess:Io=>{var Do,Lo;if(Mo&&Io&&(Io!=null&&Io.length)){const Ho=lo==null?void 0:lo.getElementById("coinbase-waas-key-export");(Do=Ho==null?void 0:Ho.contentWindow)===null||Do===void 0||Do.postMessage({key:(Lo=Io[0])===null||Lo===void 0?void 0:Lo.ecKeyPrivate,type:"export_key"},"*"),Co(!0)}}}),yo=reactExports.useMemo(()=>{if(Po){if(Po instanceof DynamicError)return Po.message;try{return getProperErrorMessage(Po)}catch(Io){Io instanceof AccessBlockedError&&ho("access-blocked");return}}},[Po,ho]),{t:vo}=useTranslation(),_o=jsxRuntimeExports.jsxs("div",{children:[io&&bo(io)&&!Jo&&fo&&!Po&&jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning__title-row",children:[jsxRuntimeExports.jsx(SvgInfo,{className:"embedded-reveal-view__zerodev-warning__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",copykey:"dyn_embedded_reveal.aa_warning.title",children:vo("dyn_embedded_reveal.aa_warning.title")})]}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",copykey:"dyn_embedded_reveal.aa_warning.subtitle",children:[vo("dyn_embedded_reveal.aa_warning.subtitle"),jsxRuntimeExports.jsx("button",{onClick:()=>{ao(!1),uo("send-balance")},className:"embedded-reveal-view__zerodev-warning__link-button",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",className:"underline",copykey:"dyn_embedded_reveal.aa_warning.button",children:vo("dyn_embedded_reveal.aa_warning.button")})})]})]}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:!Jo&&fo&&!Po?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:vo("dyn_embedded_reveal.reveal_description")}):jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__header",children:jsxRuntimeExports.jsx(SvgExportEmbeddedHero,{})})})]});reactExports.useEffect(()=>{var Io;if(!((Io=Ro==null?void 0:Ro.current)===null||Io===void 0)&&Io.children&&fo){const Do=Ro.current.children[0];Do==null||Do.setAttribute("style",!jo||Xr?"height: 60px":"height: 100px")}},[Ro,fo,jo,Xr]);const So=jsxRuntimeExports.jsx(IconButton,{onClick:()=>ao(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),To=!Jo&&fo&&!Po,Ao=vo(!jo||Xr?"dyn_embedded_reveal.private_key_title":"dyn_embedded_reveal.recovery_phrase_title"),ko=To?Ao:vo("dyn_embedded_reveal.agreement_title"),mo=jsxRuntimeExports.jsx("iframe",{src:(no=ApiEndpoint$1==null?void 0:ApiEndpoint$1.getBaseUrl())===null||no===void 0?void 0:no.replace("api/v0","coinbase-waas-key-export.html"),id:"coinbase-waas-key-export",title:"Coinbase WaaS key export",height:$o?"100%":0,width:$o?"100%":0,style:{borderRadius:"0.75rem"},allow:"clipboard-write"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:So,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:ko})}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view",children:jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body",children:[_o,Mo&&mo,co?jsxRuntimeExports.jsx("div",{id:iframeContainerId,style:{display:fo?"block":"none"},ref:Ro}):null,To?jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",onClick:()=>ao(!1),loading:Jo,copykey:"dyn_embedded_reveal.done_button_label",typographyProps:{color:"inherit"},children:vo("dyn_embedded_reveal.done_button_label")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:jsxRuntimeExports.jsx(Badge,{text:vo("dyn_embedded_reveal.badge_label"),className:"embedded-reveal-view__body__badge"})}),yo&&jsxRuntimeExports.jsx(ErrorContainer,{children:yo}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgWalletV2,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_1.title",children:vo("dyn_embedded_reveal.statement_1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_1.description",children:vo("dyn_embedded_reveal.statement_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgEyeOffIcon,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_2.title",children:vo("dyn_embedded_reveal.statement_2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_2.description",children:vo("dyn_embedded_reveal.statement_2.description",{credential_type:Ao==null?void 0:Ao.toLowerCase()})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__confirm_card",children:[jsxRuntimeExports.jsxs("button",{className:"embedded-reveal-view__body__card__acknowledgement",onClick:()=>Eo(!wo),children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:wo,onChange:()=>Eo(!wo),className:"embedded-reveal-view__body__card__statement__checkbox",id:"embedded-reveal-checkbox-1"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.checkbox_label",children:vo("dyn_embedded_reveal.checkbox_label")})})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>Wo(),disabled:!wo||Fo,loading:Jo,dataTestId:"embedded-reveal-button",copykey:"dyn_embedded_reveal.reveal_button_label",children:vo("dyn_embedded_reveal.reveal_button_label")})]})]})]})})]})},useTimeout=(Xr,eo)=>{const to=reactExports.useRef(Xr);useIsomorphicLayoutEffect(()=>{to.current=Xr},[Xr]),reactExports.useEffect(()=>{if(!eo&&eo!==0)return;const ro=setTimeout(()=>to.current(),eo);return()=>clearTimeout(ro)},[eo])};var _path$h,_excluded$o=["title","titleId"];function _extends$q(){return _extends$q=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$o(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExternalLink=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$o(eo,_excluded$o);return reactExports.createElement("svg",_extends$q({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$h||(_path$h=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.333 1.333a.667.667 0 1 1 0-1.333h4c.368 0 .667.298.667.667v4a.667.667 0 0 1-1.333 0v-2.39L5.138 7.804a.667.667 0 1 1-.943-.943l5.529-5.529h-2.39ZM2 2.667a.667.667 0 0 0-.667.666V10c0 .368.299.667.667.667h6.667A.667.667 0 0 0 9.333 10V7.333a.667.667 0 0 1 1.334 0V10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3.333a2 2 0 0 1 2-2h2.667a.667.667 0 0 1 0 1.334H2Z",fill:"currentColor"})))};const browserIconMap={brave:BraveIcon,chrome:ChromeIcon,edge:EdgeIcon,firefox:FirefoxIcon,safari:SafariIcon},getBrowserIcon=Xr=>browserIconMap[Xr],useWalletDownloadLinks=Xr=>{const{walletBook:eo}=useWalletBookContext();if(!Xr)return[];const to=getWalletLinks(eo,Xr.key),{currentDesktopUrl:ro,userBrowser:no}=parseWalletLinks(to);return no&&ro?[{Icon:getBrowserIcon(no),key:no,link:ro,name:no}]:Object.entries(to).filter(([,io])=>io!=="").filter(([io])=>io!=="ios"&&io!=="android").map(([io,oo])=>({Icon:getBrowserIcon(io),key:io,link:oo,name:io}))},generateMatrix=(Xr,eo)=>{const to=Array.prototype.slice.call(browser$h.create(Xr,{errorCorrectionLevel:eo}).modules.data,0),ro=Math.sqrt(to.length);return to.reduce((no,io,oo)=>(oo%ro===0?no.push([io]):no[no.length-1].push(io))&&no,[])},QRCode=({ecl:Xr="M",Icon:eo,logoMargin:to=0,logoSize:ro=40,size:no=250,value:io,accentColor:oo="currentColor",walletKey:ao=void 0,showQrCodeImage:so})=>{const{data:co}=usePromise(()=>browser$h.toDataURL(io)),lo=reactExports.useMemo(()=>{const bo=[],wo=generateMatrix(io||"QR Code value",Xr),Eo=no/wo.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:jo,y:Bo})=>{const Mo=(wo.length-7)*Eo*jo,Fo=(wo.length-7)*Eo*Bo;for(let Wo=0;Wo<3;Wo++)bo.push(jsxRuntimeExports.jsx("rect",{"data-key":`corner-square-${jo}-${Bo}-${Wo}`,fill:Wo%2!==0?"var(--background)":oo,height:Eo*(7-Wo*2),rx:Wo===0?10:Wo===1?7:20,ry:Wo===0?10:Wo===1?7:20,width:Eo*(7-Wo*2),x:Mo+Eo*Wo,y:Fo+Eo*Wo},`corner-square-${jo}-${Bo}-${Wo}`))});const Co=Math.floor(ro*1.5/Eo),Ro=wo.length/2-Co/2,Oo=wo.length/2+Co/2-1;for(let jo=0;jowo.length-8&&Bo<7||jo<7&&Bo>wo.length-8||jo>Ro&&joRo&&Bo.9?oo:"currentColor",r:Eo/2.25},`dot-${jo}-${Bo}`)));return bo},[Xr,ro,no,io,oo]),uo=no/2-ro/2-to,go=!ao||["coinbase","walletconnect"].includes(ao)?void 0:"walletConnect";return jsxRuntimeExports.jsx("div",{className:"qrcode__container",children:jsxRuntimeExports.jsx("div",{className:"qrcode",children:so?jsxRuntimeExports.jsx("img",{"data-testid":"qr-code-image",src:co,alt:""}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("svg",{height:"100%",width:"100%",viewBox:`0 0 ${no} ${no}`,"data-testid":"qr-code",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip-logo",children:jsxRuntimeExports.jsx("rect",{height:ro,width:ro,x:uo,y:uo,rx:7,ry:7})})}),jsxRuntimeExports.jsx("rect",{fill:"none",height:no,width:no}),lo]}),jsxRuntimeExports.jsx(IconWithSpinner,{Icon:eo,iconSize:ro,isSpinning:!0,className:"qrcode__icon",indicator:go})]})})})},LoadingQrCode=({Icon:Xr,logoSize:eo})=>jsxRuntimeExports.jsx("div",{className:"qrcode__container qrcode","data-testid":"loading-qrcode",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Xr,iconSize:eo,isSpinning:!0,className:"qrcode__icon"})}),QrCodeContainer=({accentColor:Xr,walletConnector:eo,qrcodeValue:to,Icon:ro,showCopyToClipboardButton:no=!1,desktopUri:io,showQrCodeMessage:oo,showQrCodeImage:ao})=>{const{t:so}=useTranslation(),{setView:co}=useViewContext(),lo=useWalletDownloadLinks(eo),uo=()=>io?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>window.open(io),copykey:"dyn_qr_code.open_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:so("dyn_qr_code.open_button")}):lo!=null&&lo.length?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>co("no-qr-not-installed"),copykey:"dyn_qr_code.get_extension_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:so("dyn_qr_code.get_extension_button")}):null;return jsxRuntimeExports.jsxs("div",{className:classNames("qrcode-container__container",{"qrcode-container__container--message":oo}),children:[jsxRuntimeExports.jsxs("div",{className:"qrcode-container__top",children:[to.length?jsxRuntimeExports.jsx(QRCode,{Icon:ro,accentColor:Xr,value:to,logoSize:50,walletKey:eo==null?void 0:eo.key,showQrCodeImage:ao}):jsxRuntimeExports.jsx(LoadingQrCode,{Icon:ro,logoSize:50}),jsxRuntimeExports.jsxs("div",{className:"button-container",children:[no&&jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:to,disabled:!to.length,buttonClassName:"qr-code-button",copykey:"dyn_qr_code.copy_button",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:so("dyn_qr_code.copy_button")}),uo()]})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"qrcode-container__content",copykey:"dyn_qr_code.scan_title",children:so("dyn_qr_code.scan_title",{app:eo?"wallet":"app"})})]})},QrCodeWrapper=({uri:Xr,desktopUri:eo,icon:to,accentColor:ro,showCopyToClipboardButton:no,walletConnector:io})=>{const[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(!1);return useTimeout(()=>ao(!0),Xr.length?5e3:null),jsxRuntimeExports.jsxs("div",{"data-testid":"qr-code-wrapper",className:"qr-code-wrapper",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:oo&&!so&&jsxRuntimeExports.jsxs("div",{className:"qr-code-wrapper__scan-issue-message",children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",children:"If you're having issues scanning, click "}),jsxRuntimeExports.jsx("button",{"data-testid":"qr-code-wrapper__scan-issue-button",className:"qr-code-wrapper__scan-issue-button",onClick:()=>co(!0),children:"here"})]})}),jsxRuntimeExports.jsx(QrCodeContainer,{showQrCodeMessage:oo,desktopUri:eo,accentColor:ro,walletConnector:io,qrcodeValue:Xr,Icon:to,showCopyToClipboardButton:no,showQrCodeImage:so})]})},FarcasterConnectView=({url:Xr})=>{const{theme:{theme:eo}}=useThemeContext(),to=useIconThemeVariant(),ro=jsxRuntimeExports.jsx(SocialIcon,{name:"farcaster",variant:to});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:Xr,accentColor:to==="dark"?eo.colors.textPrimary:"#7b65c0",icon:ro,showCopyToClipboardButton:!0})},GlobalWalletConfirmView=({pairingInfo:Xr,onConfirm:eo,onCancel:to})=>{const{t:ro}=useTranslation(),[no,io]=reactExports.useState(!1),oo=()=>{io(!0)};return jsxRuntimeExports.jsx("div",{className:"global-wallet-confirm",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[!no&&jsxRuntimeExports.jsx("img",{src:Xr.icons[0],alt:`${Xr.name} icon`,className:"dapp-icon",onError:oo}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",children:ro("global_wallet.confirm.description",{name:Xr.name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"dapp-url",children:Xr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",onClick:to,type:"submit",buttonPadding:"large",children:ro("global_wallet.confirm.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"connect-global-button",onClick:eo,type:"submit",buttonPadding:"large",typographyProps:{color:"white"},children:ro("global_wallet.confirm.connect_button")})]})]})})})};var _g$6,_defs$6,_excluded$n=["title","titleId"];function _extends$p(){return _extends$p=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$n(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgBlueWalletconnect=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$n(eo,_excluded$n);return reactExports.createElement("svg",_extends$p({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$6||(_g$6=reactExports.createElement("g",{clipPath:"url(#blue-walletconnect_svg__a)"},reactExports.createElement("path",{d:"M6 12A6 6 0 1 0 6 0a6 6 0 0 0 0 12Z",fill:"#4084ED"}),reactExports.createElement("path",{d:"M3.343 4.286a3.761 3.761 0 0 1 5.314 0l.176.176a.186.186 0 0 1 0 .265l-.603.603a.096.096 0 0 1-.133 0l-.243-.244a2.624 2.624 0 0 0-3.708 0l-.26.26a.096.096 0 0 1-.132 0l-.606-.6a.186.186 0 0 1 0-.266l.195-.194Zm6.563 1.248.538.537a.185.185 0 0 1 0 .265L8.018 8.757a.187.187 0 0 1-.264 0L6.034 7.04a.047.047 0 0 0-.068 0l-1.72 1.718a.187.187 0 0 1-.264 0l-2.426-2.42a.186.186 0 0 1 0-.266l.538-.537a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .067 0l1.72-1.718a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .068 0l1.72-1.718a.19.19 0 0 1 .267 0Z",fill:"#fff"}))),_defs$6||(_defs$6=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"blue-walletconnect_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h12v12H0z"})))))};const InlineIconTypography=({children:Xr})=>jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:jsxRuntimeExports.jsx("span",{className:"inline-icon-text",children:Xr})}),GlobalWalletInfoView=()=>{const{t:Xr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"info-card",children:jsxRuntimeExports.jsxs("div",{className:"wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",as:"h2",children:"How do I find the URI or QR code?"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:Xr("global_wallet.help.step.1")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:Xr("global_wallet.help.step.2")}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["3. Open"," ",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:["WalletConnect ",jsxRuntimeExports.jsx(SvgBlueWalletconnect,{})]}),"from the list, this should show a QR code to scan"]}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["4. If you are not using the QR code, locate and click",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:[jsxRuntimeExports.jsx(SvgCopy,{})," to copy"]})," ","the URI code"]})]})})};var _path$g,_excluded$m=["title","titleId"];function _extends$o(){return _extends$o=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$m(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExclamation=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$m(eo,_excluded$m);return reactExports.createElement("svg",_extends$o({width:7,height:32,viewBox:"0 0 7 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$g||(_path$g=reactExports.createElement("path",{d:"M6.4 3.2a3.2 3.2 0 0 0-6.4 0V16a3.2 3.2 0 0 0 6.4 0V3.2ZM3.2 25.6a3.2 3.2 0 0 0 0 6.4h.032a3.2 3.2 0 0 0 0-6.4H3.2Z",fill:"#F9F9FB"})))},_path$f,_excluded$l=["title","titleId"];function _extends$n(){return _extends$n=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$l(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgExclamationCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$l(eo,_excluded$l);return reactExports.createElement("svg",_extends$n({width:17,height:18,viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$f||(_path$f=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 2.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM.167 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .167 9ZM8.5 4.833c.46 0 .833.373.833.834V9a.833.833 0 1 1-1.667 0V5.667c0-.46.374-.834.834-.834Zm-.833 7.5c0-.46.373-.833.833-.833h.008a.833.833 0 0 1 0 1.667H8.5a.833.833 0 0 1-.833-.834Z",fill:"#FF4646"})))},_path$e,_excluded$k=["title","titleId"];function _extends$m(){return _extends$m=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$k(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgCautionTriangle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$k(eo,_excluded$k);return reactExports.createElement("svg",_extends$m({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$e||(_path$e=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.335 1.917c.962-1.667 3.368-1.667 4.33 0l5.774 10c.962 1.666-.241 3.75-2.166 3.75H2.726c-1.924 0-3.127-2.084-2.165-3.75l5.774-10Zm2.887.833a.833.833 0 0 0-1.444 0l-5.773 10A.833.833 0 0 0 2.726 14h11.547a.833.833 0 0 0 .722-1.25l-5.773-10ZM8.5 5.667c.46 0 .833.373.833.833v1.667a.833.833 0 0 1-1.666 0V6.5c0-.46.373-.833.833-.833ZM7.667 11.5c0-.46.373-.833.833-.833h.008a.833.833 0 1 1 0 1.666H8.5a.833.833 0 0 1-.833-.833Z",fill:"#DD8500"})))},_circle$3,_excluded$j=["title","titleId"];function _extends$l(){return _extends$l=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$j(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWarningRed=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$j(eo,_excluded$j);return reactExports.createElement("svg",_extends$l({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$3||(_circle$3=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#FF4646"})))},_circle$2,_excluded$i=["title","titleId"];function _extends$k(){return _extends$k=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$i(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgWarningOrange=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$i(eo,_excluded$i);return reactExports.createElement("svg",_extends$k({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$2||(_circle$2=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#DD8500"})))};const GlobalWalletMaliciousView=({maliciousSiteInfo:Xr})=>{const{t:eo}=useTranslation(),{setDynamicWidgetView:to}=useWidgetContext(),{setShowAuthFlow:ro}=useInternalDynamicContext(),no=()=>{to("global-wallet"),ro(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},io=()=>{var oo;(oo=Xr.proceedFlow)===null||oo===void 0||oo.call(Xr)};return jsxRuntimeExports.jsx("div",{className:"malicious-site-view",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[jsxRuntimeExports.jsxs("div",{className:"warning-icon-container",style:{position:"relative"},children:[Xr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgWarningRed,{className:"warning-icon"}):jsxRuntimeExports.jsx(SvgWarningOrange,{className:"warning-icon"}),jsxRuntimeExports.jsx(SvgExclamation,{className:"exclamation-icon",style:{left:"50%",position:"absolute",top:"50%",transform:"translate(-50%, -50%)"}})]}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",color:"primary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.title"):eo("global_wallet.malicious_site.unknown.title")}),jsxRuntimeExports.jsxs("div",{className:`subtitle-container ${Xr.isDefinitelyMalicious?"definitely-malicious":"unknown"}`,children:[jsxRuntimeExports.jsxs("div",{className:"subtitle-header-container",children:[Xr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgExclamationCircle,{className:"caution-icon"}):jsxRuntimeExports.jsx(SvgCautionTriangle,{className:"caution-icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle-header",color:"primary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.subtitle_header"):eo("global_wallet.malicious_site.unknown.subtitle_header")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle",color:"secondary",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.subtitle_text"):eo("global_wallet.malicious_site.unknown.subtitle_text")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"site-info",color:"secondary",children:Xr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",buttonVariant:"primary",type:"submit",buttonPadding:"large",onClick:no,copykey:"global_wallet.malicious_site.go_back",children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.go_back"):eo("global_wallet.malicious_site.unknown.go_back")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"proceed-button",buttonVariant:"secondary",type:"submit",buttonPadding:"large",onClick:io,copykey:"global_wallet.malicious_site.proceed",typographyProps:{color:"error-1"},children:Xr.isDefinitelyMalicious?eo("global_wallet.malicious_site.certain.proceed"):eo("global_wallet.malicious_site.unknown.proceed")})]})]})})})},DefaultFooter=({hideBorder:Xr})=>jsxRuntimeExports.jsx("div",{className:classNames("default-footer__footer",{"default-footer__footer--hidden":Xr}),"data-testid":"default-footer"});var _path$d,_excluded$h=["title","titleId"];function _extends$j(){return _extends$j=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$h(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSearch=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$h(eo,_excluded$h);return reactExports.createElement("svg",_extends$j({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$d||(_path$d=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.667 2.667a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-5.333 4a5.333 5.333 0 1 1 9.546 3.27l3.592 3.592a.667.667 0 0 1-.943.942L9.937 10.88a5.333 5.333 0 0 1-8.604-4.213Z",fill:"currentColor"})))};const Search=({className:Xr="",id:eo,label:to,type:ro,onChange:no,onBlur:io,name:oo,value:ao,onClickClear:so,copykey:co})=>jsxRuntimeExports.jsxs("label",{htmlFor:eo,className:classNames("search__container",ao?"search__container--active":void 0),children:[jsxRuntimeExports.jsx("div",{className:"search-icon__container",children:jsxRuntimeExports.jsx(SvgSearch,{})}),jsxRuntimeExports.jsx("input",{name:oo,value:ao,onChange:no,onBlur:io,type:ro,id:eo,placeholder:to,className:classNames("search__input",Xr),"data-testid":"Search",copykey:co}),ao.length>0&&jsxRuntimeExports.jsx("button",{type:"button",onClick:so,className:"search__button--clear",children:"Clear"})]}),findLastPriorityIndex=(Xr,eo)=>eo.reduce((to,ro)=>{const no=Xr.indexOf(ro.toLowerCase());return no>to?no:to},-1),getCalculatedOffset=({hasWalletFilter:Xr,defaultOffset:eo,list:to,priorityList:ro})=>{const no=findLastPriorityIndex(to,ro);return eo===DEFAULT_NUMBER_OF_WALLETS_TO_SHOW&&!Xr&&to.length>eo&&no!==-1?no+1:eo},findGroupIndex=(Xr,eo)=>eo.findIndex(to=>isWalletGroup(to)&&to.key===Xr),groupWalletOptions=(Xr,eo)=>{const to=[];return eo.forEach(ro=>{var no;if(!ro.group)return to.push(ro);const io=findGroupIndex(ro.group,to);if(io>-1)return(no=to[io].groupedWallets)===null||no===void 0?void 0:no.push(ro);if(!eo.some(co=>{var lo;const uo=ro.group===co.group,ho=ro.key!==co.key,go=((lo=co.injectedConfig)===null||lo===void 0?void 0:lo.length)&&co.injectedConfig.length>1;return uo&&(go||ho)}))return to.push(ro);const ao=getWalletGroup(Xr,ro.group),so={groupedWallets:[ro],key:ao.key,name:ao.name};return to.push(so)}),to},filterConnectedWallets=({walletOptions:Xr,userWallets:eo})=>{const to=new Set(eo.map(ro=>ro.connector.key));return(to.has("phantom")||to.has("phantomledger"))&&(to.add("phantom"),to.add("phantomledger")),Xr.filter(ro=>!to.has(ro.walletConnector.key))},getPlatformForConnector=Xr=>isMobile$1()||Xr.isWalletConnect?"mobile":"browserExtension",staticWalletFilter=(Xr,eo,to)=>eo.filter(ro=>isWalletEventSupported(findWalletBookWallet(to,ro.key),"accountChanged",getPlatformForConnector(ro.walletConnector))?!0:!Xr.some(no=>no.connector.key===ro.key)),filterWalletConnectWallets=({walletOptions:Xr,userWallets:eo})=>eo.some(ro=>ro.connector.isWalletConnect)?Xr.filter(ro=>!ro.walletConnector.isWalletConnect):Xr,applyMultiWalletFilters=({authMode:Xr,userWallets:eo,walletOptions:to,walletBook:ro})=>{const no=filterWalletConnectWallets({userWallets:eo,walletOptions:to});return Xr==="connect-only"?filterConnectedWallets({userWallets:eo,walletOptions:no}):staticWalletFilter(eo,no,ro)},PRIORITY_WALLET_LIST=["metamask","coinbase","walletconnect","phantom","argentx","blocto","solflare","braavos","trust","rainbow","dapper","glow","lilico"],sortedInputList=(Xr,eo)=>{const to=[],ro=[],no=[];Xr.forEach(ao=>{const so=eo.includes(ao.key);so?to.push(ao):PRIORITY_WALLET_LIST.includes(ao.key)&&!so?ro.push(ao):no.push(ao)});const io=ro.slice().sort((ao,so)=>PRIORITY_WALLET_LIST.indexOf(ao.key)-PRIORITY_WALLET_LIST.indexOf(so.key));return[...to.slice().sort((ao,so)=>eo.indexOf(ao.key)-eo.indexOf(so.key)),...io,...no]},walletListBuilder=({authMode:Xr,userWallets:eo,multiWallet:to,numberOfWalletsToShow:ro,inputList:no,isWalletConnectList:io,lastUsedWalletKey:oo,searchFilter:ao,walletsFilter:so,loginWithEmail:co,groupWallets:lo,walletBook:uo,showMoreWalletsWithFilter:ho,recommendedWallets:go})=>{let bo=no;io&&(bo=no.filter(Jo=>Jo.walletConnector.isWalletConnect&&Jo.key!=="walletconnect")),to&&(bo=applyMultiWalletFilters({authMode:Xr,userWallets:eo,walletBook:uo,walletOptions:bo}));let wo;const Eo=!!so,$o=[],Co=[],Ro=[],Oo=Array.from(new Set((go||[]).map(Jo=>Jo.walletKey))),jo=orderAndFilterList(bo,so,io,Oo);jo.forEach(Jo=>{const Po=Oo==null?void 0:Oo.includes(Jo.key);if(!isEmbeddedConnector(Jo.walletConnector)){if(Jo.key==="unknown"||!Jo.walletConnector.isAvailable)return;Po?$o.push(Jo):oo===Jo.key?wo=Jo:Jo.isInstalledOnBrowser?Co.push(Jo):Ro.push(Jo)}});const Bo=[...wo?[wo]:[]],Mo=[...$o,...Bo,...Co,...Ro],Fo=lo?groupWalletOptions(uo,Mo):Mo,Wo=ho&&Eo?calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(jo,Bo.concat(Co),ro):ro;return{numberOfWallets:Mo.length,walletsList:listToDisplay(Fo,ao,io,Wo,Eo,co)}},orderAndFilterList=(Xr,eo,to,ro)=>{const no=sortedInputList(Xr,ro);return!to&&eo?eo(no):no},KEEP_WALLETS_NAME_LIST=["walletconnect","bitcoin.com wallet"],applySearchFilterToWalletOptionList=(Xr,eo)=>{const to=Xr.trim().toLowerCase(),ro=no=>{const io=no.trim().toLowerCase();return KEEP_WALLETS_NAME_LIST.includes(io)?io:io.replace("wallet","").replace("evm","").replace("starknet","").replace("solana","").replace("flow","").replace("bitcoin","")};return eo.filter(no=>{var io;return ro(no.name).includes(to)||((io=no.groupedWallets)===null||io===void 0?void 0:io.some(oo=>ro(oo.name).includes(to)))})},listToDisplay=(Xr,eo,to,ro,no,io)=>{if(eo)return applySearchFilterToWalletOptionList(eo,Xr);if(to)return Xr;if(io)return Xr.slice(0,ro);{const oo=Xr.map(so=>so.name.toLowerCase()),ao=getCalculatedOffset({defaultOffset:ro,hasWalletFilter:no,list:oo,priorityList:PRIORITY_WALLET_LIST});return Xr.slice(0,ao)}},calculateWalletOffsetBasedOnInstalledAndLastUsedWallets=(Xr,eo,to)=>{const ro=Xr.slice(0,to),no=eo.filter(io=>!ro.includes(io)).length;return to+no};var _path$c,_rect,_rect2,_rect3,_excluded$g=["title","titleId"];function _extends$i(){return _extends$i=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$g(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgNoWalletFound=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$g(eo,_excluded$g);return reactExports.createElement("svg",_extends$i({width:121,height:81,viewBox:"0 0 121 81",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$c||(_path$c=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M99.064 34.016c-6.654 0-12.048 5.394-12.048 12.048 0 6.653 5.394 12.047 12.048 12.047 6.653 0 12.047-5.394 12.047-12.047 0-6.654-5.394-12.048-12.047-12.048ZM83 46.064C83 37.192 90.192 30 99.064 30c8.871 0 16.063 7.192 16.063 16.064 0 3.712-1.259 7.13-3.373 9.85l8.658 8.658a2.008 2.008 0 0 1-2.84 2.84l-8.658-8.658a15.994 15.994 0 0 1-9.85 3.373C90.192 62.127 83 54.935 83 46.064Z",fill:"currentColor",fillOpacity:.35})),_rect||(_rect=reactExports.createElement("rect",{y:8,width:121,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect2||(_rect2=reactExports.createElement("rect",{y:30,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect3||(_rect3=reactExports.createElement("rect",{y:52,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})))};const FilterBridgeChainsName=Xr=>eo=>eo.filter(to=>to.walletConnector.supportedChains.includes(Xr)),SearchNotFoundMessage=({title:Xr,subtitle:eo,image:to})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:"search-instead__container",children:[to&&jsxRuntimeExports.jsx(Icon,{className:"search-instead__container__image",color:"text-tertiary",children:to}),jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.title",children:Xr||ro("dyn_wallet_list.wallet_missing.title")}),jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"button_primary",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.description",children:eo||ro("dyn_wallet_list.wallet_missing.description")})]})},WalletListGridTabs=({items:Xr,onSelect:eo,value:to})=>jsxRuntimeExports.jsx("div",{className:"wallet-list-grid-tabs",children:Xr.map((ro,no)=>{const io=to===no,{icon:oo,text:ao}=ro.label,so=`${ao}-${oo}-${Xr.indexOf(ro)}`,co=typeof oo=="string"?jsxRuntimeExports.jsx("img",{src:oo,alt:ao}):oo;return jsxRuntimeExports.jsxs("button",{type:"button",className:classNames("wallet-list-grid-tabs__button",{"wallet-list-grid-tabs__button--selected":io,"wallet-list-grid-tabs__button--text":!!ao}),tabIndex:-1,"aria-label":ao,onClick:()=>eo(no),children:[co&&jsxRuntimeExports.jsx(Icon,{size:"small",className:classNames({"wallet-list-grid-tabs__icon--selected":!io}),children:co}),ao&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_small",weight:io?"bold":"medium",color:io?"primary":"secondary",children:ao})]},so)})}),getEffectiveWalletFilter=(Xr,eo)=>Xr&&(Xr!=null&&Xr.walletsFilter)?Xr.walletsFilter:eo,getEffectiveRecommendedWallets=(Xr,eo)=>Xr&&(Xr!=null&&Xr.recommendedWallets)?Xr.recommendedWallets:eo,WalletList=({isWalletConnectList:Xr=!1})=>{var eo;useEffectOnce(()=>()=>StorageService==null?void 0:StorageService.setItem(WALLET_PICKER_SEARCH_KEY,""));const{walletsFilter:to,walletConnectorOptions:ro,projectSettings:no,defaultNumberOfWalletsToShow:io,bridgeChainsToConnect:oo,authMode:ao,multiWallet:so,recommendedWallets:co,selectedTabIndex:lo,setSelectedTabIndex:uo,selectedTabSettings:ho,tabsItems:go}=useInternalDynamicContext(),bo=useUserWallets(),{walletBook:wo}=useWalletBookContext(),{error:Eo}=useErrorContext(),{showDefaultFooter:$o}=useAuthLayoutChecks(),[Co,Ro]=reactExports.useState(!0),{t:Oo}=useTranslation(),[jo,Bo]=reactExports.useState((eo=StorageService.getItem(WALLET_PICKER_SEARCH_KEY))!==null&&eo!==void 0?eo:""),Mo=(oo==null?void 0:oo.length)&&FilterBridgeChainsName(oo[0].chain),Fo=Mo&&Mo(ro),Wo=getEffectiveRecommendedWallets(ho,co),{numberOfWallets:Jo,walletsList:Po}=walletListBuilder({authMode:ao,groupWallets:!0,inputList:Fo||ro,isWalletConnectList:Xr,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),multiWallet:so,numberOfWalletsToShow:io,recommendedWallets:Wo,searchFilter:jo,showMoreWalletsWithFilter:!0,userWallets:bo,walletBook:wo,walletsFilter:getEffectiveWalletFilter(ho,to)}),fo=!!jo||Jo>io&&Po.length!==Jo,yo=!!(go!=null&&go.length),vo=reactExports.useRef(null),_o=()=>{const Ao=vo.current;Ao&&((Ao==null?void 0:Ao.scrollTop)>(Ao==null?void 0:Ao.clientHeight)*1.25?Ro(!1):Ro(!0))},So=Ao=>{StorageService.setItem(WALLET_PICKER_SEARCH_KEY,Ao),Bo(Ao)},To=no?fo&&jsxRuntimeExports.jsx("div",{className:classNames("wallet-list__search-container",{"wallet-list__search-container--scroll":!Eo}),children:jsxRuntimeExports.jsx(Search,{copykey:"dyn_wallet_list.search.label",label:Oo("dyn_wallet_list.search.label",{numberOfWallets:Jo}),value:jo,onChange:({target:{value:Ao}})=>So(Ao),onClickClear:()=>So("")})}):jsxRuntimeExports.jsx(Skeleton,{className:"wallet-list__search-skeleton"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[yo&&jsxRuntimeExports.jsx("div",{className:"wallet-list__tabs-container",children:jsxRuntimeExports.jsx(WalletListGridTabs,{items:go,value:lo||0,onSelect:uo})}),To,!!Eo&&jsxRuntimeExports.jsx(ErrorContainer,{className:"wallet-list__error-container",withIcon:!1,children:Eo}),jsxRuntimeExports.jsx("div",{className:"wallet-list__container",children:jsxRuntimeExports.jsxs("div",{className:classNames("wallet-list__scroll-container",{"wallet-list__scroll-container--error":!!Eo,"wallet-list__scroll-container--fixed-height":yo}),"data-testid":"wallet-list-scroll-container",ref:vo,onScroll:_o,children:[no?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ro.length===0&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_wallet_list.configuration_mismatch",children:Oo("dyn_wallet_list.configuration_mismatch")}),ro.length&&Po.length===0?jsxRuntimeExports.jsx(SearchNotFoundMessage,{title:Oo("dyn_wallet_list.search.not_found.title"),subtitle:Oo("dyn_wallet_list.search.not_found.description"),image:jsxRuntimeExports.jsx(SvgNoWalletFound,{})}):Po.map((Ao,ko)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:Ao,onResetSearchValue:()=>So(""),recommendedWallets:Wo},`${Ao.key}_${ko}`))]}):jsxRuntimeExports.jsx(Skeleton,{count:10,className:"wallet-list__tile-skeleton"}),fo&&!jo&&no&&jsxRuntimeExports.jsx(SearchNotFoundMessage,{})]})}),$o&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!Co})]})},FarcasterQrCodeView=()=>{const{setError:Xr}=useErrorContext(),[eo,to]=reactExports.useState(void 0),{connectSocialAccount:ro}=useSocialAuth({onError:()=>Xr("Something went wrong"),onFarcasterUrl:no=>to(no),sessionTimeout:2e4});return useEffectOnce(()=>{ro({authMode:"signin",provider:ProviderEnum.Farcaster})}),jsxRuntimeExports.jsx(FarcasterConnectView,{url:eo??""})},isPhoneNumberProviderEnabled=Xr=>!!(Xr&&isProviderEnabled(Xr,ProviderEnum.Sms)),useSubmitPhoneNumber=({onSubmit:Xr,onSubmitError:eo,country:to,phone:ro,setInvalidNumberMessage:no})=>{const{engageCaptcha:io}=useCaptchaContext(),{view:oo,setView:ao}=useViewContext(),{environmentId:so,projectSettings:co}=useInternalDynamicContext(),{setDisplayedDestination:lo,setVerificationUUID:uo,setRetryData:ho}=useVerification(),{fieldsConfig:go}=useFields(),{t:bo}=useTranslation(),wo=Eo=>__awaiter$j(void 0,void 0,void 0,function*(){if(to)try{const $o=de$4({dialCode:to.dialCode,phone:ro}),{verificationUUID:Co}=yield createSmsVerification({captchaToken:Eo,environmentId:so,isoCountryCode:to.iso2,phoneCountryCode:to.dialCode,phoneNumber:$o});ho({dialCode:to.dialCode,iso2:to.iso2,phone:$o}),ao("login-with-sms-verification"),lo(formatPhone(ro)),uo(Co);const Ro={dialCode:to.dialCode,iso2:to.iso2,phone:$o};dynamicEvents.emit("authInit",{option:Ro,phone:Ro,type:"sms"}),Xr==null||Xr()}catch($o){if(ao(oo.type),$o instanceof SmsVerificationError){let Co=bo("dyn_login.helper.phone_number_form.invalid_phone");$o.code==="too_many_sms_verification_attempts"&&(Co=bo("dyn_login.helper.phone_number_form.too_many_sms_verification_attempts")),$o.code&&$o.code in translation.dyn_login.helper.phone_number_form&&(Co=bo("dyn_login.helper.phone_number_form."+$o.code)),no(Co)}else typeof $o=="string"&&no($o);eo==null||eo()}});return Eo=>__awaiter$j(void 0,void 0,void 0,function*(){var $o;if(to){Eo.preventDefault();try{go.phoneNumber.validation.validateSync(ro)}catch(Co){const{message:Ro}=Co;no(Ro),eo==null||eo();return}if(!(($o=co==null?void 0:co.security.hCaptcha)===null||$o===void 0)&&$o.enabled){io({authMethod:"phone",onCaptchaSuccess:wo});return}wo()}})},PhoneNumberSignInSection=({isLoading:Xr,onSubmit:eo,onSubmitError:to})=>{var ro,no;const{projectSettings:io}=useInternalDynamicContext(),oo=reactExports.useMemo(()=>{const Oo=getSupportedCountriesForVerificationFromProjectSettings(io);return getCustomCountries(getDefaultCountriesIfEmpty(Oo))},[io]),[ao,so]=reactExports.useState(void 0),[co,lo]=reactExports.useState(!1),[uo,ho]=reactExports.useState({country:void 0,phone:""}),go=reactExports.useCallback(Oo=>{ho(Oo),lo(validatePhoneLength(Oo.phone,Oo.country))},[]),[bo,wo]=reactExports.useState(!1),[Eo,$o]=reactExports.useState(!1),Co=useSubmitPhoneNumber({country:uo.country,onSubmit:eo,onSubmitError:to,phone:uo.phone,setInvalidNumberMessage:so});if(!isPhoneNumberProviderEnabled((ro=io==null?void 0:io.providers)!==null&&ro!==void 0?ro:[]))return logger$8.error("Failed to render PhoneNumberSignInSection - no sign in provider enabled"),null;const Ro=!(!((no=io==null?void 0:io.design.modal)===null||no===void 0)&&no.emailSubmitButtonInsideInput);return jsxRuntimeExports.jsxs("form",{className:"login-with-phone-number-form",onSubmit:Oo=>Co(Oo),children:[jsxRuntimeExports.jsx(PhoneNumberField,{countries:oo,onUpdate:go,error:ao,setIsHovered:wo,setIsFocused:$o,appendRight:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:Xr||!co,highlighted:co,isFocused:Eo,isHovered:bo,className:"login-with-phone-number-form__fields__inline-submit",emailSubmitButtonInsideInput:!Ro})}),Ro&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"big-submit-button",buttonClassName:"login-with-phone-number-form__button",type:"submit",loading:Xr,disabled:Xr||!co,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,typographyProps:{color:"inherit"},children:"Continue"})]})},getSocialSignInProviderFromString=Xr=>{if(!Xr)return;const eo=Object.values(SocialSignInProviderEnum);for(const to of eo)if(to===Xr)return to};var _path$b,_excluded$f=["title","titleId"];function _extends$h(){return _extends$h=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$f(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDotsHorizontal=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$f(eo,_excluded$f);return reactExports.createElement("svg",_extends$h({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$b||(_path$b=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.7 10a1.667 1.667 0 1 1 3.333 0A1.667 1.667 0 0 1 2.7 10Zm5.833 0a1.667 1.667 0 1 1 3.334 0 1.667 1.667 0 0 1-3.334 0Zm5.834 0a1.667 1.667 0 1 1 3.333 0 1.667 1.667 0 0 1-3.333 0Z",fill:"currentColor",fillOpacity:.4})))};const providerLabel=Xr=>{if(Xr)return Xr===SocialSignInProviderEnum.Coinbasesocial?"Coinbase":capitalize$1(Xr)},INTERNAL_MAX_INLINE_ITEMS=5,SocialSignIn=({providers:Xr,onSelectProvider:eo,isLoading:to,selectedProvider:ro,testId:no,defaultProvider:io,numOfItemsToDisplay:oo=5,collapsedLayout:ao})=>{const{t:so}=useTranslation(),co=useIconThemeVariant();io&&!Xr.includes(io)&&([io]=Xr);const lo=Xr.filter(jo=>jo!==io),uo=Math.min(oo,INTERNAL_MAX_INLINE_ITEMS),ho=lo.length>uo,go=ho?lo.slice(0,uo-1):lo.slice(0,uo),[bo,wo]=reactExports.useState(!1),Eo=()=>!to&&wo(!1),$o=Xr.length===1||!ao&&Xr.length<4,Co=jo=>jo,Ro=jsxRuntimeExports.jsx(IconButton,{onClick:Eo,type:"button",id:"close-button",disabled:to,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Oo=(jo,Bo=!1,Mo=!1)=>jsxRuntimeExports.jsxs(IconListTile,{dataTestId:Mo?`card-${jo}`:`inline-${jo}`,onClick:()=>eo(jo),disabled:!!ro,className:classNames({"social-sign-in--card--tile":Mo,"social-sign-in--tile":!Mo,"social-sign-in--tile__full-width":Bo}),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:jsxRuntimeExports.jsx(SocialIcon,{name:Co(jo),variant:co}),isSpinning:ro===jo,iconSize:32}),!Mo&&Bo&&jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.social.button_label",children:so("dyn_login.social.button_label",{provider:providerLabel(jo)})})]},Co(jo));return Xr.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"social-sign-in","data-testid":no,children:[io&&Oo(io,!0),go.map(jo=>Oo(jo,$o)),ho&&jsxRuntimeExports.jsx(IconListTile,{dataTestId:"show-more-options",onClick:()=>wo(!0),className:"social-sign-in--tile",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",children:jsxRuntimeExports.jsx(SvgDotsHorizontal,{})})},"show-more-options")]}),jsxRuntimeExports.jsx(OverlayCard,{isOpen:bo,onClickOverlay:Eo,children:jsxRuntimeExports.jsxs("div",{className:"social-sign-in--card",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Ro,children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",children:"Choose a social account"})}),jsxRuntimeExports.jsx("div",{className:"social-sign-in--card--body",children:Xr.map(jo=>Oo(jo,!1,!0))})]})})]}):(logger$8.error("Failed to render SocialSignInSection - no social providers enabled"),null)},MagicSocialSignIn=({defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})=>{const{projectSettings:ro}=useInternalDynamicContext(),{socialProvider:no,setSocialProvider:io,socialWalletConnector:oo,enabledSocialProviders:ao}=useSocialRedirectContext(),{engageCaptcha:so}=useCaptchaContext(),{mutate:co,isLoading:lo}=useMutation(uo=>__awaiter$j(void 0,void 0,void 0,function*(){var ho;if(!((ho=ro==null?void 0:ro.security.hCaptcha)===null||ho===void 0)&&ho.enabled){so({authMethod:"social",onCaptchaSuccess:go=>__awaiter$j(void 0,void 0,void 0,function*(){return io(uo),yield oo==null?void 0:oo.endSession(),oo==null?void 0:oo.connect(uo)})});return}return io(uo),yield oo==null?void 0:oo.endSession(),oo==null?void 0:oo.connect(uo)}));return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:co,providers:ao,selectedProvider:no,isLoading:lo,testId:"magic-social-sign-in",defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})},getProviderEnumForSocialSignInProvider=Xr=>{if(!Xr)return null;const eo=Object.values(ProviderEnum);for(const to of eo)if(to===Xr)return to;return null},DynamicSocialSignIn=({defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})=>{const{setShowAuthFlow:ro,projectSettings:no}=useInternalDynamicContext(),{setSocialProvider:io,socialProvider:oo,enabledSocialProviders:ao}=useSocialRedirectContext(),{setView:so,goToInitialView:co}=useViewContext(),{engageCaptcha:lo}=useCaptchaContext(),{isProcessing:uo,connectSocialAccount:ho}=useSocialAuth({onError:()=>{co()},onFarcasterUrl:bo=>so("farcaster-connect-view",{url:bo}),onSettled:()=>{io(void 0)},sessionTimeout:2e4}),go=bo=>{var wo;const Eo=getProviderEnumForSocialSignInProvider(bo);if(io(bo),!((wo=no==null?void 0:no.security.hCaptcha)===null||wo===void 0)&&wo.enabled){lo({authMethod:"social",onCaptchaSuccess:$o=>__awaiter$j(void 0,void 0,void 0,function*(){so("social-redirect-view"),ro(!0),ho({authMode:"signin",captchaToken:$o,provider:Eo})})});return}so("social-redirect-view"),ro(!0),ho({authMode:"signin",provider:Eo})};return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:go,providers:ao,selectedProvider:oo,isLoading:uo,testId:"dynamic-social-sign-in",defaultProvider:Xr,numOfItemsToDisplay:eo,collapsedLayout:to})},SocialSignInSection=({sectionData:Xr,collapsedLayout:eo})=>{var to,ro,no;const{projectSettings:io}=useInternalDynamicContext(),oo=(to=io==null?void 0:io.providers)!==null&&to!==void 0?to:[],ao={collapsedLayout:eo,defaultProvider:getSocialSignInProviderFromString(Xr.defaultItem),numOfItemsToDisplay:Xr.numOfItemsToDisplay};return isProviderEnabled(oo,ProviderEnum.MagicLink)&&((ro=io==null?void 0:io.sdk.socialSignIn)===null||ro===void 0?void 0:ro.signInProvider)===SignInProviderEnum.MagicLink?jsxRuntimeExports.jsx(MagicSocialSignIn,Object.assign({},ao)):((no=io==null?void 0:io.sdk.socialSignIn)===null||no===void 0?void 0:no.signInProvider)===SignInProviderEnum.Dynamic?jsxRuntimeExports.jsx(DynamicSocialSignIn,Object.assign({},ao)):(logger$8.error("Failed to render SocialSignInSection - no sign in provider enabled"),null)},ToggleableSection=({sections:Xr})=>{const[eo,to]=reactExports.useState(!0),ro=eo?Xr[0]:Xr[1];return jsxRuntimeExports.jsxs("div",{className:"toggleable-section",children:[ro.component,jsxRuntimeExports.jsxs("div",{className:"toggleable-section__toggle-prompt",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:ro.labelCopyKey,children:ro.label}),jsxRuntimeExports.jsx("button",{className:"toggleable-section__toggle-prompt__button",onClick:()=>to(!eo),children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_small",color:"brand-primary",className:"toggleable-section__toggle-prompt__button__text",copykey:ro.buttonCopyKey,children:ro.button})})]})]})},ListItemButton=({text:Xr,onClick:eo,numberOfWallets:to,disabled:ro=!1,copykey:no})=>{const io=reactExports.useMemo(()=>to<=10?to:`${Math.floor(to/10)*10}+`,[to]),oo=jsxRuntimeExports.jsxs("div",{className:"list-item-button__trailing",children:[jsxRuntimeExports.jsx("div",{className:classNames("list-item-button__trailing-child","list-item-button__trailing-label"),children:jsxRuntimeExports.jsx(Badge,{text:`${io} available`})}),jsxRuntimeExports.jsx("div",{className:classNames("list-item-button__trailing-child","list-item-button__trailing-icon"),children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",children:jsxRuntimeExports.jsx(SvgStroke,{})})})]});return jsxRuntimeExports.jsx(ListTile,{trailing:oo,onClick:eo,className:"list-item-button",disabled:ro,copykey:no,children:Xr})},WalletSimpleSignIn=({previewWalletsNumber:Xr,disabled:eo=!1,onshowAllWallets:to})=>{const{t:ro}=useTranslation(),{walletConnectorOptions:no,projectSettings:io,walletsFilter:oo,authMode:ao,multiWallet:so,recommendedWallets:co}=useInternalDynamicContext(),lo=useUserWallets(),{walletBook:uo}=useWalletBookContext(),{numberOfWallets:ho,walletsList:go}=walletListBuilder({authMode:ao,groupWallets:!0,inputList:no,isWalletConnectList:!1,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),loginWithEmail:!0,multiWallet:so,numberOfWalletsToShow:Xr,recommendedWallets:co,searchFilter:void 0,userWallets:lo,walletBook:uo,walletsFilter:oo});return io?jsxRuntimeExports.jsxs("div",{className:"login-with-email-wallet-list__container","data-testid":"top-wallets-list",children:[go.map((bo,wo)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:bo,disabled:eo,recommendedWallets:co},`${bo.key}_${wo}`)),jsxRuntimeExports.jsx(ListItemButton,{copykey:"dyn_wallet_list.view_all",text:ro("dyn_wallet_list.view_all"),onClick:to,numberOfWallets:ho,disabled:eo})]}):jsxRuntimeExports.jsx(Skeleton,{count:Xr+1,className:"login-with-email-wallet-list__skeleton"})},WalletSignInSection=({numberOfItensToShow:Xr,isLoading:eo,onSubmit:to})=>{const{t:ro}=useTranslation();return Xr>0?jsxRuntimeExports.jsx(WalletSimpleSignIn,{previewWalletsNumber:Xr,onshowAllWallets:()=>to==null?void 0:to(),disabled:eo}):jsxRuntimeExports.jsx(IconListTile,{onClick:()=>to==null?void 0:to(),disabled:eo,className:"connect-with-wallet-button",children:jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.wallet_list.button_only",children:ro("dyn_login.wallet_list.button_only")})})},LoginViewSection=({viewSection:Xr,index:eo,walletCount:to,gotToWalletList:ro})=>{const{loading:no}=useLoadingContext(),{t:io}=useTranslation(),{setView:oo}=useViewContext(),[ao,so]=reactExports.useState(no);switch(Xr.type){case SdkViewSectionType.Separator:return jsxRuntimeExports.jsx(Divider,{text:Xr.label});case SdkViewSectionType.Email:return jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao});case SdkViewSectionType.Phone:return jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao});case SdkViewSectionType.EmailAndPhone:const co=[{button:io("dyn_login.email_or_phone.use_phone"),buttonCopyKey:"dyn_login.email_or_phone.use_phone",component:jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao}),label:io("dyn_login.email_or_phone.prefer_phone"),labelCopyKey:"dyn_login.email_or_phone.prefer_phone"},{button:io("dyn_login.email_or_phone.use_email"),buttonCopyKey:"dyn_login.email_or_phone.use_email",component:jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>so(!0),onSubmitError:()=>so(!1),isLoading:ao}),label:io("dyn_login.email_or_phone.prefer_email"),labelCopyKey:"dyn_login.email_or_phone.prefer_email"}];return Xr.defaultItem==="phone"&&co.reverse(),jsxRuntimeExports.jsx(ToggleableSection,{sections:co});case SdkViewSectionType.Wallet:return jsxRuntimeExports.jsx(WalletSignInSection,{numberOfItensToShow:Xr.numOfItemsToDisplay||0,onSubmit:()=>{oo("login-with-email-or-wallet-full-wallet-list"),ro()},isLoading:ao});case SdkViewSectionType.Social:return jsxRuntimeExports.jsx(SocialSignInSection,{collapsedLayout:to>1,sectionData:Xr});case SdkViewSectionType.Text:return Xr.label?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",align:Xr.alignment,className:"login-view__text","data-testid":"login-view-section__text",children:Xr.label}):null}},getWalletsSection=Xr=>({numOfItemsToDisplay:Xr,type:SdkViewSectionType.Wallet}),getSocialsSection=(Xr,eo)=>({defaultItem:eo,numOfItemsToDisplay:Xr,type:SdkViewSectionType.Social}),getSimpleSection=Xr=>({type:Xr}),getLoginViewStructure=({socialAboveEmail:Xr,showWallets:eo,web3Layout:to,numOfWalletsToDisplay:ro,showEmail:no,showPhone:io,showSocial:oo,splitEmailAndSocial:ao,defaultSocialItem:so})=>{const co=!ao&&(no||io),lo=ao?so:void 0;return[{condition:eo&&to,section:getWalletsSection(ro)},{condition:oo&&Xr,hideSeparator:co?"below":void 0,section:getSocialsSection(5,lo)},{condition:no&&!io,section:getSimpleSection(SdkViewSectionType.Email)},{condition:!no&&io,section:getSimpleSection(SdkViewSectionType.Phone)},{condition:no&&io,section:getSimpleSection(SdkViewSectionType.EmailAndPhone)},{condition:oo&&!Xr,hideSeparator:co?"above":void 0,section:getSocialsSection(5,lo)},{condition:eo&&!to,section:getWalletsSection(ro)}]},useViewSettings=Xr=>{var eo,to,ro;const{projectSettings:no,overrides:io}=useInternalDynamicContext(),oo=(to=(eo=no==null?void 0:no.sdk)===null||eo===void 0?void 0:eo.views)===null||to===void 0?void 0:to.find(so=>so.type===Xr);return((ro=io==null?void 0:io.views)===null||ro===void 0?void 0:ro.find(so=>so.type===Xr))||oo},NUMBER_OF_WALLETS=3,useLoginView=()=>{const Xr=useViewSettings(SdkViewType.Login),{projectSettings:eo,authorizationViewDisplayOrder:to,loginWithEmail:ro,walletConnectorOptions:no,walletsFilter:io}=useInternalDynamicContext(),{t:oo}=useTranslation(),{enabledSocialProviders:ao}=useSocialRedirectContext(),so=!!(ao!=null&&ao.length),co=isEmailProviderEnabled(eo==null?void 0:eo.providers),lo=isPhoneNumberProviderEnabled(eo==null?void 0:eo.providers),uo=(io?io(no):no).filter(({key:wo})=>wo!=="turnkey"),ho=reactExports.useMemo(()=>{var wo;return eo?!ro&&!lo&&!so?!0:!((wo=Xr==null?void 0:Xr.sections)===null||wo===void 0)&&wo.length?Xr.sections.length===1&&Xr.sections[0].type==="wallet":!co&&!lo&&!so:!1},[Xr==null?void 0:Xr.sections,eo,ro,so,lo,co]),go=reactExports.useCallback(wo=>{var Eo;const $o=Ro=>{var Oo;return(Oo=Ro.networks)===null||Oo===void 0?void 0:Oo.some(jo=>jo.enabled)};return!((Eo=eo==null?void 0:eo.chains)===null||Eo===void 0?void 0:Eo.some(Ro=>Ro.enabled&&$o(Ro)))&&wo.find(Ro=>Ro.type==="wallet")&&logger$8.error("Failed to render WalletSignInSection - no chains enabled"),uo!=null&&uo.length?wo:wo.filter(Ro=>Ro.type!=="wallet")},[uo==null?void 0:uo.length,eo==null?void 0:eo.chains]),bo=reactExports.useMemo(()=>{var wo,Eo,$o,Co,Ro,Oo;if(!((wo=Xr==null?void 0:Xr.sections)===null||wo===void 0)&&wo.length)return go(Xr==null?void 0:Xr.sections);const{splitEmailAndSocial:jo=!1,socialAboveEmail:Bo=!1}=(Eo=eo==null?void 0:eo.design.modal)!==null&&Eo!==void 0?Eo:{},Mo=[],Fo=getLoginViewStructure({defaultSocialItem:ao[0],numOfWalletsToDisplay:!((Co=($o=eo==null?void 0:eo.design)===null||$o===void 0?void 0:$o.modal)===null||Co===void 0)&&Co.showWalletsButton?0:NUMBER_OF_WALLETS,showEmail:co,showPhone:lo,showSocial:!!(ao!=null&&ao.length),showWallets:!!(uo!=null&&uo.length)&&!(!((Oo=(Ro=eo==null?void 0:eo.design)===null||Ro===void 0?void 0:Ro.modal)===null||Oo===void 0)&&Oo.emailOnly),socialAboveEmail:Bo,splitEmailAndSocial:jo,web3Layout:to==="web3"}),Wo={label:oo("dyn_login.separators.default"),type:SdkViewSectionType.Separator};let Jo=!1;for(const Po of Fo)Po.condition&&(Mo.length>0&&!Jo&&Po.hideSeparator!=="above"&&Mo.push(Wo),Mo.push(Po.section),Jo=Po.hideSeparator==="below");return Mo},[to,ao,go,co,lo,Xr==null?void 0:Xr.sections,eo==null?void 0:eo.design.modal,uo==null?void 0:uo.length,oo]);return{isWalletOnly:ho,loginViewSections:bo}},showFarcasterQrCodeView=(Xr,eo)=>Xr.length===1&&Xr[0].type===SdkViewSectionType.Social&&eo.length===1&&eo.includes(SocialSignInProviderEnum.Farcaster)&&!isMobile$1(),LoginView=()=>{var Xr;const{error:eo}=useErrorContext(),{setView:to}=useViewContext(),{isWalletOnly:ro,loginViewSections:no}=useLoginView(),{enabledSocialProviders:io}=useSocialRedirectContext(),{showDefaultFooter:oo}=useAuthLayoutChecks(),ao=((Xr=no.find(uo=>uo.type===SdkViewSectionType.Wallet))===null||Xr===void 0?void 0:Xr.numOfItemsToDisplay)||0,so=reactExports.useMemo(()=>no.map((uo,ho)=>jsxRuntimeExports.jsx("div",{className:classNames("login-view__scroll__section",`login-view__scroll__section--${uo.type}`),children:jsxRuntimeExports.jsx(LoginViewSection,{gotToWalletList:()=>to("login-with-email-or-wallet-full-wallet-list"),index:ho,viewSection:uo,walletCount:ao})},`${uo.type}__${ho}`)),[no,ao]),co=eo&&jsxRuntimeExports.jsx(ErrorContainer,{className:"login-view__error-container",withIcon:!1,children:eo});if(showFarcasterQrCodeView(no,io))return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[co,jsxRuntimeExports.jsx(FarcasterQrCodeView,{})]});if(ro)return jsxRuntimeExports.jsx(WalletList,{});const lo=isMobile$1()&&oo;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[co,jsxRuntimeExports.jsx("div",{className:classNames("login-view__container",{"login-view__container--error":!!eo}),children:jsxRuntimeExports.jsx("div",{className:"login-view__scroll","data-testid":"login-view-scroll",children:so})}),lo&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!0})]})},useMergeUserAccounts=()=>{const{environmentId:Xr,setShowAuthFlow:eo,selectedWalletConnector:to}=useInternalDynamicContext(),{addedWalletsIds:ro}=useInternalUserWallets();return{mergeUserAccounts:io=>__awaiter$j(void 0,void 0,void 0,function*(){const ao=(yield verifyMergeUsers(Xr,io)).lastVerifiedCredentialId;ao&&ro.current.push(ao);const so=yield to==null?void 0:to.getConnectedAccounts();so!=null&&so.length&&dynamicEvents.emit("triggerComputePrimaryWalletMultiWalletStateFromAccounts",{accounts:so}),eo(!1)})}},RadioButton=({children:Xr,checked:eo,value:to,name:ro,disabled:no=!1,className:io="",onChange:oo})=>{const ao=`${ro}_${to}`;return jsxRuntimeExports.jsxs("div",{className:classNames("radio-button",io),children:[jsxRuntimeExports.jsx("input",{type:"radio",id:ao,name:ro,value:to,disabled:no,defaultChecked:eo,onChange:oo}),jsxRuntimeExports.jsx("label",{htmlFor:ao,children:Xr})]})},MergeUserAccountsConflictsView=({mergeConflicts:Xr})=>{const{mergeUserAccounts:eo}=useMergeUserAccounts(),{t:to}=useTranslation(),[ro,no]=reactExports.useState(""),io=reactExports.useRef(Object.fromEntries(Xr.map(({field:so,currentUser:co})=>[`${so.name}_${so.type}`,{fieldKey:so.name,type:so.type||KycFieldType.Standard,userId:co.userId}]))),oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){const so=Object.values(io.current).map(({fieldKey:co,type:lo,userId:uo})=>({fieldKey:co,type:lo,userId:uo}));try{yield eo(so)}catch(co){logger$8.error("Error merging user accounts",co),no(to("dyn_merge_user_accounts_conflicts.errors.merge_error"))}});if(!(Xr!=null&&Xr.length))return null;const ao=(so,co,lo,uo)=>{no(""),uo&&(io.current[`${so}_${co}`]={fieldKey:so,type:co||KycFieldType.Standard,userId:lo})};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__container",children:[ro&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts-conflicts__error",children:ro}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_merge_user_accounts_conflicts.description",children:to("dyn_merge_user_accounts_conflicts.description")})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__fields",children:Xr.map(({field:so,currentUser:co,fromUser:lo})=>{var uo;return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__fields__item",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts-conflicts__fields__item__name",children:(uo=so.label)!==null&&uo!==void 0?uo:capitalize$1(so.name)}),jsxRuntimeExports.jsx(RadioButton,{name:so.name,value:co.value,checked:!0,className:"merge-user-accounts-conflicts__fields__item__button",onChange:ho=>ao(so.name,so.type,co.userId,ho.target.checked),children:co.value}),jsxRuntimeExports.jsx(RadioButton,{name:so.name,value:lo.value,className:"merge-user-accounts-conflicts__fields__item__button",onChange:ho=>ao(so.name,so.type,lo.userId,ho.target.checked),children:lo.value})]},so.name)})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__buttons",children:jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-conflicts__buttons__button",onClick:oo,buttonVariant:"primary",buttonPadding:"large",expanded:!0,copykey:"dyn_merge_user_accounts_conflicts.confirm_button",children:to("dyn_merge_user_accounts_conflicts.confirm_button")})})]})},MergeUserAccountsView=Xr=>{const{setView:eo}=useViewContext(),{mergeUserAccounts:to}=useMergeUserAccounts(),{t:ro}=useTranslation(),[no,io]=reactExports.useState(""),{mergeConflicts:oo}=Xr,ao=()=>{const co=()=>{eo("merge-user-accounts",Xr)};eo("merge-user-accounts-conflicts",{mergeConflicts:(oo==null?void 0:oo.conflicts)||[]},{onBackClick:co})},so=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(oo!=null&&oo.conflicts.length){ao();return}try{yield to([])}catch(co){logger$8.error("Error merging user accounts",co),io(ro("dyn_merge_user_accounts.errors.merge_error"))}});return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts",children:[no&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts__error",children:no}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts__container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts__title",copykey:"dyn_merge_user_accounts.wallet.content",children:ro("dyn_merge_user_accounts.wallet.content")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:so,buttonClassName:"merge-user-accounts__button",buttonVariant:"brand-primary",buttonPadding:"large",typographyProps:{color:"inherit"},expanded:!0,copykey:"dyn_merge_user_accounts.confirm_button",children:ro("dyn_merge_user_accounts.confirm_button")})]})]})};var _path$a,_excluded$e=["title","titleId"];function _extends$g(){return _extends$g=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$e(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDoubleArrowRight=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$e(eo,_excluded$e);return reactExports.createElement("svg",_extends$g({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$a||(_path$a=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",fill:"currentColor"})))};const MergeUserAccountsWithSameEmailView=({returnToView:Xr})=>{const{environmentId:eo,setShowAuthFlow:to,setCallback:ro,primaryWallet:no,user:io}=useInternalDynamicContext(),oo=useHandleAuthenticatedUser(),{t:ao}=useTranslation(),{setError:so}=useErrorContext(),{setView:co,goToInitialView:lo}=useViewContext(),{displayedDestination:uo}=useVerification(),ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{const bo=yield mergeUserAccounts(eo);if(!bo)throw new DynamicError("Something went wrong, please try again.");yield oo(bo),to(!1),ro("authSuccess")}catch{if(so(ao("dyn_merge_user_accounts_with_same_email.errors.merge_error")),io){to(!1,{emitCancelAuth:!0});return}lo()}}),go=()=>{if(so(void 0),Xr){co(Xr);return}if(io){to(!1);return}co("collect-user-data")};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__container",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:no==null?void 0:no.connector.key,className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenWalletAddress(no==null?void 0:no.address,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-with-same-email__accounts__divider",children:jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgDoubleArrowRight,{})})}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenEmail(uo,{breakpoint:4,cutEnd:1,cutStart:2})})]})]}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"title",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__header",copykey:"dyn_merge_user_accounts_with_same_email.title",children:ao("dyn_merge_user_accounts_with_same_email.title")}),jsxRuntimeExports.jsxs(Typography,{weight:"medium",variant:"body_normal",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__body",copykey:"dyn_merge_user_accounts_with_same_email.existing_account",children:[ao("dyn_merge_user_accounts_with_same_email.existing_account")," ",jsxRuntimeExports.jsx("span",{className:"merge-user-accounts-with-same-email__text--bold",children:shortenEmail(uo,{breakpoint:14})})," ",ao("dyn_merge_user_accounts_with_same_email.existing_account_trail")]}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__buttons",children:[jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:ho,buttonVariant:"primary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.confirm_button",children:ao("dyn_merge_user_accounts_with_same_email.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:go,buttonVariant:"secondary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.cancel_button",children:ao("dyn_merge_user_accounts_with_same_email.cancel_button")})]})]})};var _path$9,_path2$1,_path3$1,_path4,_g$5,_path5,_defs$5,_excluded$d=["title","titleId"];function _extends$f(){return _extends$f=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$d(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSecureAccount=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$d(eo,_excluded$d);return reactExports.createElement("svg",_extends$f({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,reactExports.createElement("mask",{id:"secure-account_svg__a",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$9||(_path$9=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__a)"},_path2$1||(_path2$1=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#secure-account_svg__b)",fillOpacity:.12})),reactExports.createElement("mask",{id:"secure-account_svg__c",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$1||(_path3$1=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__c)"},reactExports.createElement("mask",{id:"secure-account_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4||(_path4=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.825-10.139-12.468-17.963-10.371-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.825 10.139 12.468 17.963 10.371 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$5||(_g$5=reactExports.createElement("g",{mask:"url(#secure-account_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.825 2.096-12.468 10.138-10.371 17.962a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.847 5.5 5.5 0 0 1-10.625 2.847Z",fill:"#4779FF"})))),_path5||(_path5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$5||(_defs$5=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"secure-account_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const useIsLoggedIn=()=>{var Xr,eo,to;const{user:ro,primaryWallet:no,authMode:io,projectSettings:oo}=useInternalDynamicContext(),{getEOAWallet:ao}=useSmartWallets(),so=no&&ao(no),co=no&&isSessionKeyCompatibleWallet(no)||so&&isSessionKeyCompatibleWallet(so),lo=isTurnkeyEnabled(oo),uo=!!ro||io==="connect-only"&&!!no,ho=(Xr=ro==null?void 0:ro.verifiedCredentials)===null||Xr===void 0?void 0:Xr.filter(({walletProvider:Eo})=>Eo),go=!!(ho!=null&&ho.find(({walletProvider:Eo})=>Eo==="embeddedWallet")),wo=lo&&((to=(eo=oo==null?void 0:oo.sdk)===null||eo===void 0?void 0:eo.embeddedWallets)===null||to===void 0?void 0:to.automaticEmbeddedWalletCreation)&&(!(oo!=null&&oo.sdk.embeddedWallets.forceAuthenticatorAtSignup)||co)&&(!(ho!=null&&ho.length)||go);return logger$8.logVerboseTroubleshootingMessage("useIsLoggedIn",{authMode:io,eoaWallet:so,isSessionKeyCompatible:co,isTurnkeyProviderEnabled:lo,primaryWallet:no,projectSettings:oo,user:ro}),wo?!!(no&&uo):uo},useOverrides=Xr=>{const eo=reactExports.useRef(Xr),to=useIsLoggedIn();return eo.current=Xr,reactExports.useMemo(()=>({setAuthMode:ro=>{const{setAuthMode:no}=eo.current;if(to){logger$8.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");return}return no(ro)}}),[to])},useDynamicContext=()=>{const Xr=reactExports.useContext(DynamicContext);if(Xr===void 0)throw new Error("useDynamicContext must be used within a DynamicContextProvider");const{accountSwitchState:eo,authMode:to,authToken:ro,awaitingSignatureState:no,getNameService:io,handleLogOut:oo,handleUnlinkWallet:ao,loadingNetwork:so,locale:co,loginWithEmail:lo,multiWalletWidgetState:uo,network:ho,networkConfigurations:go,qrcodeUri:bo,sdkHasLoaded:wo,setLogInWithEmail:Eo,setMultiWalletWidgetState:$o,setShowAuthFlow:Co,setShowDynamicUserProfile:Ro,setShowQrcodeModal:Oo,shadowDOMEnabled:jo,showAuthFlow:Bo,showQrcodeModal:Mo,user:Fo,userWithMissingInfo:Wo,bridgeChains:Jo,bridgeChainsToConnect:Po,primaryWallet:fo,setShowBridgeWidget:yo,sendWagmiSettings:vo,showDynamicUserProfile:_o,minAuthToken:So,selectedTabIndex:To,setSelectedTabIndex:Ao}=Xr,{setAuthMode:ko}=useOverrides(Xr);return{accountSwitchState:eo,authMode:to,authToken:ro,awaitingSignatureState:no,bridgeChains:Jo,bridgeChainsToConnect:Po,getNameService:io,handleLogOut:oo,handleUnlinkWallet:ao,loadingNetwork:so,locale:co,loginWithEmail:lo,minAuthToken:So,multiWalletWidgetState:uo,network:ho,networkConfigurations:go,primaryWallet:fo,qrcodeUri:bo,sdkHasLoaded:wo,selectedTabIndex:To,sendWagmiSettings:vo,setAuthMode:ko,setLogInWithEmail:Eo,setMultiWalletWidgetState:$o,setSelectedTabIndex:Ao,setShowAuthFlow:mo=>Co(mo,{clearErrors:!0,emitCancelAuth:!0,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!0}),setShowBridgeWidget:yo,setShowDynamicUserProfile:Ro,setShowQrcodeModal:Oo,shadowDOMEnabled:jo,showAuthFlow:Bo,showDynamicUserProfile:_o,showQrcodeModal:Mo,user:Fo,userWithMissingInfo:Wo}},getMfaOptions=Xr=>{const eo=[{Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.authenticator_app_description",labelKey:"dyn_mfa.choose_device_view.authenticator_app",type:MFADeviceType.Totp}];if(!Xr){const to={Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.backup_code_description",labelKey:"dyn_mfa.choose_device_view.backup_code",type:"backupCode"};eo.push(to)}return eo},MfaChooseDeviceView=({isInitialSetup:Xr=!0})=>{const{handleLogOut:eo}=useDynamicContext(),{t:to}=useTranslation(),{setView:ro}=useViewContext(),no=getMfaOptions(Xr),io=oo=>{if(oo.type==="backupCode"){ro("mfa-recovery",void 0,{onBackClick:()=>{ro("mfa-choose-device",{isInitialSetup:!1})}});return}if(Xr){ro("mfa-secure-device",{type:oo.type});return}ro("mfa-verification",{isInitialSetup:Xr,showBackButton:!0,type:oo.type})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",children:to(Xr?"dyn_mfa.choose_device_view.title":"dyn_mfa.choose_device_view.choose_another_method")})})}),jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__body","data-testid":"mfa-choose-device-view",children:[jsxRuntimeExports.jsx(SvgSecureAccount,{}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:to(Xr?"dyn_mfa.choose_device_view.select_options":"dyn_mfa.choose_device_view.choose_another_method_description")}),no.map(oo=>jsxRuntimeExports.jsxs(Button,{buttonClassName:"mfa-choose-device-view__button",expanded:!0,onClick:()=>io(oo),children:[jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__button__header",children:[jsxRuntimeExports.jsx(Typography,{copykey:oo.labelKey,color:"primary",children:to(oo.labelKey)}),jsxRuntimeExports.jsx(SvgChevronLeft,{className:"mfa-choose-device-view__icon--rotate"})]}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__button__description",color:"secondary",copykey:oo.descriptionKey,children:to(oo.descriptionKey)})]},oo.type)),jsxRuntimeExports.jsx(TextButton,{className:"mfa-choose-device-view__logout",onClick:eo,copykey:"dyn_mfa.choose_device_view.logout",children:to("dyn_mfa.choose_device_view.logout")})]})]})},getUserMfaDevices=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{devices:to}=yield sdkApi$1().getUserMfaDevices({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),addMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to}){try{if(to===MFADeviceType.Totp)return yield sdkApi$1().registerTotpMfaDevice({environmentId:eo});throw new Error("Unsupported MFA device type")}catch(ro){const no=ro instanceof Error?ro.message:(yield ro.json()).error;throw logger$8.error(no),new Error(no)}}),updateUserMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,mfaDeviceId:to}){try{yield sdkApi$1().updateUserMfaDevice({environmentId:eo,mfaDeviceId:to})}catch(ro){const no=yield ro.json();logger$8.error(no.error)}}),deleteMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,mfaDeviceId:to,mfaAuthToken:ro}){try{yield sdkApi$1().deleteMfaDevice({environmentId:eo,mfaDeviceId:to,xMfaAuthToken:ro})}catch(no){const io=yield no.json();logger$8.error(io.error)}}),verifyMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,type:to,code:ro}){try{if(to===MFADeviceType.Totp){const no={code:ro,type:to};return yield sdkApi$1().registerTotpMfaDeviceVerify({environmentId:eo,mFARegisterTotpDevicePostRequest:no})}throw new Error("Unsupported MFA device type")}catch(no){const io=no instanceof Error?no.message:(yield no.json()).error;logger$8.error(io);return}}),authMfaDevice=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({deviceId:eo,environmentId:to,type:ro,code:no,createMfaToken:io}){try{if(ro===MFADeviceType.Totp){const oo={code:no,createMfaToken:io,id:eo||void 0};return yield sdkApi$1().authMfaTotpDevice({environmentId:to,mFAAuthTotpDevicePostRequest:oo})}throw new Error("Unsupported MFA device type")}catch(oo){if(logger$8.error(oo),oo instanceof Response){const ao=yield oo.json();if(ao.code==="mfa_invalid_code")throw new MfaInvalidOtpError;if(ao.code==="mfa_rate_limited")throw new MfaRateLimitedError}throw oo}}),getRecoveryCodes=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{recoveryCodes:to}=yield sdkApi$1().getRecoveryCodes({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),createNewRecoveryCodes=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo}){try{const{recoveryCodes:to}=yield sdkApi$1().createNewRecoveryCodes({environmentId:eo});return to}catch(to){const ro=yield to.json();return logger$8.error(ro.error),[]}}),authMfaRecovery=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,code:to}){try{const ro={code:to};return yield sdkApi$1().authMfaRecovery({environmentId:eo,mFAAuthRecoveryDevicePostRequest:ro})}catch(ro){throw logger$8.error(ro),ro instanceof Response&&(yield ro.json()).code==="mfa_invalid_code"?new MfaInvalidOtpError:ro}}),useMfa=()=>{const{completeAuth:Xr}=useUserAuth({}),{user:eo,userWithMissingInfo:to,environmentId:ro}=useInternalDynamicContext(),no=eo||to,io=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);return yield getUserMfaDevices({environmentId:ro})}),oo=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);yield updateUserMfaDevice({environmentId:ro,mfaDeviceId:wo})}),ao=(wo,Eo)=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);yield deleteMfaDevice({environmentId:ro,mfaAuthToken:Eo,mfaDeviceId:wo})}),so=(...wo)=>__awaiter$j(void 0,[...wo],void 0,function*(Eo=MFADeviceType.Totp){if(!no)throw new Error(USER_NOT_LOGGED_IN);const{id:$o,secret:Co,uri:Ro}=yield addMfaDevice({environmentId:ro,type:Eo});return{id:$o,secret:Co,uri:Ro}}),co=(wo,...Eo)=>__awaiter$j(void 0,[wo,...Eo],void 0,function*($o,Co=MFADeviceType.Totp,Ro){try{if(!no)throw new Error(USER_NOT_LOGGED_IN);let Oo=!1;return yield Xr({onValidUpdatedJwt:()=>__awaiter$j(void 0,void 0,void 0,function*(){Oo=!0}),updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){const jo=yield authMfaDevice({code:$o,createMfaToken:{singleUse:!0},deviceId:Ro,environmentId:ro,type:Co});return dynamicEvents.emit("mfaCompletionSuccess",{mfaToken:jo.mfaToken}),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:jo}})}),Oo}catch(Oo){throw dynamicEvents.emit("mfaCompletionFailure",{error:Oo}),Oo}}),lo=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!no)throw new Error(USER_NOT_LOGGED_IN);let Eo=!1;return yield Xr({onValidUpdatedJwt:()=>__awaiter$j(void 0,void 0,void 0,function*(){Eo=!0}),updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){const $o=yield authMfaRecovery({code:wo,environmentId:ro});if(!$o)throw new Error("Failed to authenticate recovey code");return{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:$o}})}),Eo}),uo=(wo,...Eo)=>__awaiter$j(void 0,[wo,...Eo],void 0,function*($o,Co=MFADeviceType.Totp){if(!no)throw new Error(USER_NOT_LOGGED_IN);const Ro=yield verifyMfaDevice({code:$o,environmentId:ro,type:Co});if(!Ro)throw new Error("Failed to verify device");return Ro}),ho=(...wo)=>__awaiter$j(void 0,[...wo],void 0,function*(Eo=!1){if(!no)throw new Error(USER_NOT_LOGGED_IN);const Co=yield(Eo?createNewRecoveryCodes:getRecoveryCodes)({environmentId:ro});if(!Co)throw new Error("Recovery codes not found");return Co}),{updateUser:go}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1});return{addDevice:so,authDevice:co,authRecoveryCode:lo,completeAcknowledgement:()=>__awaiter$j(void 0,void 0,void 0,function*(){yield go({mfaBackupCodeAcknowledgement:MfaBackupCodeAcknowledgement.Complete})}),deleteUserDevice:ao,getRecoveryCodes:ho,getUserDevices:io,updateUserDevice:oo,verifyDevice:uo}},MfaDisplayBackupCodesView=({regenerateCodes:Xr=!1})=>{const{setShowAuthFlow:eo}=useInternalDynamicContext(),[to,ro]=reactExports.useState(!1),{t:no}=useTranslation(),{getRecoveryCodes:io,completeAcknowledgement:oo}=useMfa(),{data:ao,isLoading:so}=usePromise(()=>io(Xr)),co=(ao||[]).join(` +`),lo=()=>__awaiter$j(void 0,void 0,void 0,function*(){eo(!1),yield oo()});return jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__body","data-testid":"mfa-display-backup-codes-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-display-backup-codes-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:no("dyn_mfa.display_backup_codes_view.body")}),jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_mfa.display_backup_codes_view.warning",className:"mfa-display-backup-codes-view__warning",children:no("dyn_mfa.display_backup_codes_view.warning")}),so?jsxRuntimeExports.jsx(Spinner$1,{className:"mfa-display-backup-codes-view__loading-spinner"}):jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__codes",children:[ao==null?void 0:ao.map((uo,ho)=>jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"mfa-display-backup-codes-view__code",children:uo},ho)),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__actions",children:[jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:co,copykey:"dyn_mfa.display_backup_codes_view.copy_all",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgCopy,{})}),children:no("dyn_mfa.display_backup_codes_view.copy_all")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"download-button",buttonPadding:"small",buttonVariant:"primary",onClick:uo=>{uo.preventDefault(),downloadFile("mfa-backup-codes.txt",co)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.download",children:no("dyn_mfa.display_backup_codes_view.download")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__complete",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"mfa-display-backup-codes-view__acknowledgement",dataTestId:"ack-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>ro(!to),startSlot:jsxRuntimeExports.jsx(Checkbox,{checked:to,onChange:()=>{ro(!to)},className:"mfa-display-backup-codes-view__acknowledgement__checkbox"}),expanded:!0,typographyProps:{color:"secondary"},copykey:"dyn_mfa.display_backup_codes_view.checkbox",children:no("dyn_mfa.display_backup_codes_view.checkbox")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"complete-button",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!to,expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.complete",onClick:lo,children:no("dyn_mfa.display_backup_codes_view.complete")})]})]})},isValidMfaRecoveryCode=Xr=>/^[a-zA-Z0-9]{10}$/.test(Xr);var _path$8,_excluded$c=["title","titleId"];function _extends$e(){return _extends$e=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$c(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMfaRecoveryIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$c(eo,_excluded$c);return reactExports.createElement("svg",_extends$e({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$8||(_path$8=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-9.322-18.117a1.828 1.828 0 1 0 3.613.568l1.152-7.457h7.144l-1.1 6.89a1.828 1.828 0 1 0 3.612.567l1.153-7.457h3.504a1.691 1.691 0 0 0 0-3.383h-2.948l1.16-7.222h3.597a1.691 1.691 0 0 0 0-3.383h-3.087l1.1-6.89a1.829 1.829 0 1 0-3.612-.567l-1.153 7.457H30.17l1.1-6.89a1.828 1.828 0 1 0-3.613-.567l-1.152 7.457h-3.458a1.691 1.691 0 0 0 0 3.383h2.901l-1.16 7.222h-3.597a1.691 1.691 0 0 0 0 3.383h3.087l-1.1 6.89Zm12.42-10.272H28.5l1.16-7.222h7.097l-1.16 7.222Z",fill:"#4779FF"})))};const MfaRecoveryScreenIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgMfaRecoveryIcon,Object.assign({},Xr,{"data-testid":"mfa-recovery-icon"}))}),MfaRecoveryView=()=>{var Xr;const{t:eo}=useTranslation(),{projectSettings:to}=useInternalDynamicContext(),{authRecoveryCode:ro}=useMfa(),[no,io]=reactExports.useState(""),[oo,ao]=reactExports.useState(!1),[so,co]=reactExports.useState(""),lo=(Xr=to==null?void 0:to.general)===null||Xr===void 0?void 0:Xr.supportEmail,uo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(no)try{ao(!0),yield ro(no)}catch(go){co(go.message||"Something went wrong")}finally{ao(!1)}}),ho=go=>{const bo=go.target.value;io(bo),co("")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[so&&jsxRuntimeExports.jsx(ErrorContainer,{children:so}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:MfaRecoveryScreenIcon,isSpinning:oo,iconSize:96}),jsxRuntimeExports.jsx("div",{className:"mfa-recovery-view__body",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:eo("dyn_mfa.recovery_view.body")})}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__actions",children:[jsxRuntimeExports.jsx(Input,{id:"mfa-recovery-input","data-testid":"mfa-recovery-input",label:eo("dyn_mfa.recovery_view.input_label"),onChange:ho,value:no}),jsxRuntimeExports.jsx(Button,{expanded:!0,buttonVariant:"brand-primary",disabled:oo||!isValidMfaRecoveryCode(no),onClick:uo,dataTestId:"mfa-recovery-submit",children:jsxRuntimeExports.jsx(Typography,{children:eo("dyn_mfa.recovery_view.button_label")})})]}),lo&&jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__get-help",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:eo("dyn_mfa.recovery_view.get_help.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${lo}`,children:eo("dyn_mfa.recovery_view.get_help.button_label")})})]})]})]})},MfaSecureDeviceHelper=({uri:Xr,secret:eo})=>{const{t:to}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__setup-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"1"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.step1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:to("dyn_mfa.secure_device_view.helper.step1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"2"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.step2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:to("dyn_mfa.secure_device_view.helper.step2.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:eo}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:eo,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-secret",onClick:ro=>{ro.preventDefault()}})})]})]}),jsxRuntimeExports.jsx(Divider,{text:"OR"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step",children:jsxRuntimeExports.jsxs("div",{className:"uri-section",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:to("dyn_mfa.secure_device_view.helper.uri.title")}),jsxRuntimeExports.jsx(Typography,{className:"uri-subtext",variant:"body_small",children:to("dyn_mfa.secure_device_view.helper.uri.description")})]})}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:Xr}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:Xr,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-uri",onClick:ro=>{ro.preventDefault()}})})]})]})]})})})},MfaSecureDeviceView=({type:Xr,isInitialSetup:eo=!1})=>{const{t:to}=useTranslation(),{handleLogOut:ro}=useDynamicContext(),{setView:no}=useViewContext(),{addDevice:io}=useMfa(),{data:oo,isLoading:ao}=usePromise(()=>io(Xr)),so=()=>{const lo=()=>{no("mfa-secure-device",{type:Xr})};no("mfa-verification",{deviceId:oo==null?void 0:oo.id,isInitialSetup:eo,showBackButton:!0,type:Xr},{onBackClick:lo})},co=({secret:lo,uri:uo})=>{no("mfa-secure-device-help",{secret:lo,uri:uo},{onBackClick:()=>{no("mfa-secure-device",{isInitialSetup:eo,type:Xr})}})};return jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__body","data-testid":"mfa-secure-device-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-secure-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:to("dyn_mfa.secure_device_view.body")}),ao&&jsxRuntimeExports.jsx(Spinner$1,{className:"mfa-secure-device-view__loading-spinner"}),oo&&jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__qrcode",children:[jsxRuntimeExports.jsx(QRCode,{Icon:jsxRuntimeExports.jsx(SvgPasswordHero,{}),value:oo.uri,logoSize:50}),jsxRuntimeExports.jsx("div",{className:"button-container",children:jsxRuntimeExports.jsx("button",{onClick:()=>co({secret:oo.secret,uri:oo.uri}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",children:to("dyn_mfa.secure_device_view.helper.button")})})})]}),jsxRuntimeExports.jsx(TypographyButton,{className:"mfa-secure-device-view__button",expanded:!0,onClick:so,children:to("dyn_mfa.secure_device_view.continue")}),jsxRuntimeExports.jsx(TextButton,{className:"mfa-secure-device-view__logout-button",onClick:ro,copykey:"dyn_mfa.choose_device_view.logout",children:to("dyn_mfa.secure_device_view.logout")})]})},MfaVerificationView=({type:Xr,isInitialSetup:eo=!1,showBackButton:to=!1,deviceId:ro})=>{const{t:no}=useTranslation(),{setView:io}=useViewContext(),{authDevice:oo}=useMfa(),[ao,so]=reactExports.useState(""),[co,lo]=reactExports.useState(),[uo,ho]=reactExports.useState(!1),{data:go,isLoading:bo}=usePromise(()=>oo(ao,Xr,ro),{deps:[ao],enabled:(ao==null?void 0:ao.length)===6,initialData:!1,onReject:Co=>{Co instanceof MfaRateLimitedError?(ho(!0),lo(new DynamicError(no("dyn_mfa.otp_verification_view.rate_limit_error")))):lo(new DynamicError(no("dyn_mfa.otp_verification_view.error")))},onResolve:()=>__awaiter$j(void 0,void 0,void 0,function*(){const Co=getUser();(Co==null?void 0:Co.mfaBackupCodeAcknowledgement)!==MfaBackupCodeAcknowledgement.Complete&&io("mfa-display-backup-codes")})}),wo=Co=>{lo(void 0),so(Co)},Eo=Co=>{so(Co)},$o=()=>{if(!eo){io("mfa-choose-device",{isInitialSetup:eo});return}io("mfa-secure-device",{isInitialSetup:eo,type:Xr})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:SvgPasswordHero,error:co,isLoading:bo,onPinComplete:Eo,isValid:!!go,onPinChange:wo,description:no("dyn_mfa.otp_verification_view.body"),onClickBack:to?$o:void 0,disabled:uo}),!eo&&jsxRuntimeExports.jsx("div",{className:"mfa-verification-view__choose-another-method",children:jsxRuntimeExports.jsx(TextButton,{className:"mfa-verification-view__choose-another-method-button",onClick:()=>io("mfa-choose-device",{isInitialSetup:eo}),copykey:"dyn_mfa.otp_verification_view.choose_another_method",children:no("dyn_mfa.otp_verification_view.choose_another_method")})})]})},MobileWalletRedirectView=({onRetry:Xr})=>{const{selectedWalletConnector:eo}=useInternalDynamicContext(),{walletBook:to}=useWalletBookContext(),{t:ro}=useTranslation(),{storeName:no,walletLink:io}=reactExports.useMemo(()=>{const so=eo&&getWalletLinks(to,eo.key);return so&&isIOS$1()?{storeName:"App Store",walletLink:so==null?void 0:so.ios}:so&&(isAndroid$1()||isSamsungBrowser())?{storeName:"Play Store",walletLink:so==null?void 0:so.android}:{storeName:void 0,walletLink:void 0}},[eo,to]),oo=()=>io&&window.open(io,"_blank","noopener,noreferrer"),ao=so=>jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo==null?void 0:eo.key,style:{height:pixelToRem(so),width:pixelToRem(so)}});return jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ao(94*iconRatio),iconSize:94,isSpinning:!0,className:"mobile-wallet-redirect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"mobile-wallet-redirect__copy-text",copykey:"dyn_login.mobile_wallet_redirect.prompt",children:ro("dyn_login.mobile_wallet_redirect.prompt")}),jsxRuntimeExports.jsxs(TypographyButton,{buttonVariant:"brand-primary",typographyProps:{color:"white",variant:"button_secondary"},onClick:Xr,buttonPadding:"small",children:[ro("dyn_login.mobile_wallet_redirect.open_prompt")," ",eo==null?void 0:eo.name]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"mobile-wallet-redirect__alert",children:ro("dyn_login.mobile_wallet_redirect.redirect_fail_message",{walletName:eo==null?void 0:eo.name})}),no&&jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app",onClick:oo,children:[jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[ao(26),jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"bold",children:[ro("dyn_login.mobile_wallet_redirect.get_app_prompt")," ",eo==null?void 0:eo.name]})]}),jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[jsxRuntimeExports.jsx(Typography,{className:"mobile-wallet-redirect__wallet-app__group__app-store",variant:"body_small",weight:"bold",color:"secondary",children:no}),jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgExternalLink,{})})]})]})]})},useWalletConnectorEvent=(Xr,eo,to)=>{const ro=reactExports.useRef(to);ro.current=to,reactExports.useEffect(()=>{if(!Xr)return;const no=Array.isArray(Xr)?Xr:[Xr];no.forEach(ao=>ao.initEventListener());const oo=Array.from(new Set(no)).map(ao=>{const so=(...co)=>{ro.current(...co,ao)};return ao.on(eo,so),()=>ao.off(eo,so)});return()=>oo.forEach(ao=>ao())},[Xr,eo])},useWalletConnectorNetwork=(Xr,{onChange:eo}={onChange:()=>{}})=>{const[to,ro]=reactExports.useState(),{isLoading:no}=usePromise(()=>Xr==null?void 0:Xr.getNetwork(),{deps:[Xr],onResolve:io=>{ro(io)}});return useWalletConnectorEvent(Xr||void 0,"chainChange",({chain:io})=>{const oo=(Xr==null?void 0:Xr.connectedChain)==="STARK"?io:parseInt(io);ro(oo),eo==null||eo(oo)}),useWalletConnectorEvent(Xr||void 0,"disconnect",()=>__awaiter$j(void 0,void 0,void 0,function*(){if((Xr==null?void 0:Xr.key)!=="argentx")return;const io=yield Xr.getNetwork();ro(io),eo==null||eo(io)})),{isLoading:no,network:to}},useNetworkNotSupported=()=>{const{selectedWalletConnector:Xr,setShowAuthFlow:eo,bridgeChainsToConnect:to,bridgeOnboardingCompleted:ro,isBridgeFlow:no,user:io,authMode:oo}=useInternalDynamicContext(),ao=useConnectAndSign({shouldCallCallback:!1,shouldUpdateWallets:!!(to!=null&&to.length)}),{network:so}=useWalletConnectorNetwork(Xr,{onChange:co=>{!Xr||!isSupportedNetwork({network:co,walletConnector:Xr})||ao({walletConnector:Xr}).then(()=>{!io&&oo==="connect-and-sign"||(!no||ro||!(to!=null&&to.length))&&eo(!1)})}});return{currentNetwork:so}},UserAddress=({userProfile:Xr,walletConnector:eo})=>{var to;const ro=(to=Xr==null?void 0:Xr.verifiedCredentials.find(oo=>oo.id===Xr.lastVerifiedCredentialId))===null||to===void 0?void 0:to.address,no=useFetchNameService(ro),{data:io}=usePromise(()=>eo==null?void 0:eo.getAddress(),{enabled:!Xr&&!!eo});return jsxRuntimeExports.jsxs("div",{className:"user-address__container",children:[jsxRuntimeExports.jsx(StatusDot,{variant:"green",containerClassName:"user-address__status-dot"}),no!=null&&no.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:no.name}),jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__seperator"}),jsxRuntimeExports.jsx(Typography,{variant:"numbers_medium",color:"secondary",className:"user-address",children:shortenWalletAddress(ro,3,3)})]}):jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:shortenWalletAddress(ro||io,4,4)})]})},SelectNetworkButton=({networkId:Xr,networkName:eo,networkIconUrl:to,onClick:ro})=>{const no=jsxRuntimeExports.jsx("img",{alt:eo,className:"select-network-button__icon",src:to});return jsxRuntimeExports.jsxs(TypographyButton,{dataTestId:"SelectNetworkButton",onClick:()=>ro(Xr),expanded:!0,className:"select-network-button",children:["Select",no,eo," network"]})},NetworkNotSupported=()=>{const{onboardingImageUrl:Xr,selectedWalletConnector:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),{currentNetwork:ro}=useNetworkNotSupported(),[no,io]=reactExports.useState(!1);if(!eo)return null;const oo=co=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield eo.switchNetwork({networkChainId:co})}catch(lo){logger$8.debug(lo)}}),ao=eo.evmNetworks||[],so=isSupportedNetwork({network:ro,walletConnector:eo});return jsxRuntimeExports.jsxs("div",{className:"network-not-supported","data-testid":"network-not-supported",children:[Xr&&jsxRuntimeExports.jsx("img",{className:"network-not-supported__main-img",src:Xr,alt:"onboarding"}),!so&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"info",withIcon:!1,className:"network-not-supported__error--not-supported",copykey:"dyn_network_not_supported.warning_message",children:to("dyn_network_not_supported.warning_message")}),jsxRuntimeExports.jsxs("div",{className:classNames("network-not-supported__content-container",{"network-not-supported__content-container--error":!so}),children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported__img-container",children:jsxRuntimeExports.jsx(WalletIcon,{style:{height:64,width:64},walletKey:eo.key})}),jsxRuntimeExports.jsx(UserAddress,{walletConnector:eo}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__network-container",children:ao.length>1&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:ro,evmNetworks:ao,connector:eo,isNetworkPickerOpen:no,setIsNetworkPickerOpen:io,showNetworkName:!0,buttonClassName:"network-not-supported__network-picker-button",mainClassName:"network-not-supported__network-picker"})}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__welcome-container",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_network_not_supported.subtitle",children:to("dyn_network_not_supported.subtitle")})}),ao.length===1&&jsxRuntimeExports.jsx(SelectNetworkButton,{onClick:oo,networkId:ao[0].networkId,networkName:ao[0].vanityName||ao[0].name,networkIconUrl:ao[0].iconUrls[0]})]})]})},NetworkNotSupportedSwitchManual=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext();useNetworkNotSupported();const{t:eo}=useTranslation(),to=80,ro=jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr==null?void 0:Xr.key,style:{height:pixelToRem(to*iconRatio),width:pixelToRem(to*iconRatio)}}),no=getWalletConnectorNetworks(Xr),io=()=>(Xr==null?void 0:Xr.key)==="metamaskstarknet"?"dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet":no.length?"dyn_network_not_supported_manual_switch.subtitle_network_defined":"dyn_network_not_supported_manual_switch.subtitle_no_network_defined",oo=()=>(Xr==null?void 0:Xr.key)==="metamaskstarknet"?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[eo("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet",{network:no[0].name}),jsxRuntimeExports.jsxs("a",{href:"https://snaps.consensys.io/starknet",target:"_blank",rel:"noreferrer",children:[" ",eo("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet_companion_app")," ",jsxRuntimeExports.jsx(SvgExternalLink,{style:{display:"inline-block"}})]})]}):no.length?eo("dyn_network_not_supported_manual_switch.subtitle_network_defined",{network:no[0].name}):eo("dyn_network_not_supported_manual_switch.subtitle_no_network_defined");return jsxRuntimeExports.jsxs("div",{"data-testid":"network-not-supported",className:"network-not-supported-switch-manual",children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__img-container",children:jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__network-container",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:to,isSpinning:!0})})}),jsxRuntimeExports.jsxs("div",{className:"network-not-supported-switch-manual__content",children:[jsxRuntimeExports.jsx(Typography,{className:"network-not-supported-switch-manual__title",weight:"medium",variant:"title",color:"primary",copykey:"dyn_network_not_supported_manual_switch.title",children:eo("dyn_network_not_supported_manual_switch.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:io(),children:oo()})]})]})},socialNetworkIconMap={discord:DiscordIcon,helpdesk:HelpdeskIcon,slack:SlackIcon,twitter:TwitterIcon},getSocialNetworkIcon=Xr=>socialNetworkIconMap[Xr],useNoAccessText=()=>{const{socialMediaLinkText:Xr,socialMediaUrl:eo,accessDeniedMessagePrimary:to,accessDeniedMessageSecondary:ro}=useInternalDynamicContext(),{view:no}=useViewContext(),{t:io}=useTranslation(),oo=no.type==="chainalysis-blocked-wallet",ao=no.type==="gate-blocked-wallet",so=no.type==="no-access",co=()=>{if(oo)return io(textData.chainalysis._socialMediaLinkText);if(!ao)return Xr},lo=()=>{if(oo)return io(textData.chainalysis._socialMediaUrl);if(!ao)return eo},uo=()=>oo?io(textData.chainalysis.title):ao?io(textData.gate.title):to||io(textData.default.title),ho=()=>oo?io(textData.chainalysis.subtitle):ao?io(textData.gate.subtitle):ro||io(textData.default.subtitle),go=()=>io(oo?textData.chainalysis.buttonTitle:ao?textData.gate.buttonTitle:textData.default.buttonTitle);return{_socialMediaLinkText:co(),_socialMediaUrl:lo(),buttonTitle:go(),isAccessListView:so,isChainalysisView:oo,isGateBlockedView:ao,subtitle:ho(),title:uo()}},textData={chainalysis:{_socialMediaLinkText:"dyn_no_access.chainalysis.social_media_link_text",_socialMediaUrl:"dyn_no_access.chainalysis.social_media_link_url",buttonTitle:"dyn_no_access.chainalysis.button_text",subtitle:"dyn_no_access.chainalysis.description",title:"dyn_no_access.chainalysis.title"},default:{buttonTitle:"dyn_no_access.default.button_text",subtitle:"dyn_no_access.default.description",title:"dyn_no_access.default.title"},gate:{_socialMediaLinkText:void 0,_socialMediaUrl:void 0,buttonTitle:"dyn_no_access.gate.button_text",subtitle:"dyn_no_access.gate.description",title:"dyn_no_access.gate.title"}},NoAccess=()=>{const{deniedAddress:Xr,setDeniedAddress:eo,setDeniedOauthProvider:to,deniedOauthProvider:ro,deniedOauthUsername:no}=useAccessDeniedContext(),{t:io}=useTranslation(),oo=ro?findSocialIcon(ro):void 0,{selectedWalletConnector:ao,socialMediaIconUrl:so,notInTheListImageUrl:co,accessDeniedButton:lo}=useInternalDynamicContext(),{displayedDestination:uo}=useVerification(),{goToInitialView:ho}=useViewContext(),{_socialMediaLinkText:go,_socialMediaUrl:bo,isAccessListView:wo,isGateBlockedView:Eo,subtitle:$o,title:Co,buttonTitle:Ro}=useNoAccessText(),Oo=()=>{ho(),eo(""),to(void 0),ao==null||ao.endSession()},jo=!so||typeof so=="string"?null:getSocialNetworkIcon(Object.keys(so)[0]),Bo=reactExports.useMemo(()=>ao?jsxRuntimeExports.jsx(AuthProviderIcon,{}):jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"wallet-no-access__icon--verified",Icon:oo??SignInWithEmailIcon,iconSize:50,InnerIcon:SvgError,variant:"red"}),[oo,ao]),Mo=shortenWalletAddress(Xr,6,4),Fo=(lo==null?void 0:lo.title)||Ro,Wo=(lo==null?void 0:lo.action)||Oo,Po=ro===void 0?uo??Mo:no,fo=!!co&&(wo||Eo),yo=jo&&(wo||Eo);return jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__container",children:[fo&&jsxRuntimeExports.jsx("img",{src:co,alt:io("dyn_no_access.not_in_the_list_image_alt"),className:"wallet-no-access__image",copykey:"dyn_no_access.not_in_the_list_image_alt"}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__main",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__user-info-container",children:[Bo,jsxRuntimeExports.jsxs("div",{"data-testid":"walletAddress",className:"wallet-no-access__wallet-address-container",children:[ao&&jsxRuntimeExports.jsx(StatusDot,{variant:"red",containerClassName:"user-info__status-dot"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"wallet-no-access__wallet-address",children:Po})]})]}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__content",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"wallet-no-access__content--primary",children:Co}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"wallet-no-access__content--secondary",children:$o})]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:Wo,className:"wallet-no-access__button--primary",expanded:!0,buttonPadding:"large",children:Fo}),bo&&go&&jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__social-info-container",children:[jsxRuntimeExports.jsxs("a",{href:bo,className:"wallet-no-access__waitlist-link",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",color:"primary",children:go}),yo&&jsxRuntimeExports.jsx(jo,{className:"wallet-no-access__social-icon",style:{height:pixelToRem(24),width:pixelToRem(24)}})]}),typeof so=="string"&&jsxRuntimeExports.jsx("img",{alt:"social media",src:so,style:{height:"1.5rem",width:"1.5rem"}})]})]})]})},capitalize=Xr=>Xr[0].toUpperCase()+Xr.slice(1),WalletHelpLink=({name:Xr,link:eo,Icon:to})=>{const{t:ro}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"wallet-help-link",children:jsxRuntimeExports.jsxs("a",{className:"wallet-help-link__anchor",href:eo,target:"_blank",rel:"noreferrer",children:[jsxRuntimeExports.jsx(to,{style:{height:"1.5rem",width:"1.5rem"}}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",weight:"medium",copykey:"dyn_qr_code.wallet_not_installed.browser_install",children:ro("dyn_qr_code.wallet_not_installed.browser_install",{browser:capitalize(Xr)})})]})})},NoQrNotInstalledView=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext(),{walletBook:eo}=useWalletBookContext(),{t:to}=useTranslation();if(!Xr)return null;const ro=Object.entries(getWalletLinks(eo,Xr.key)).filter(([,no])=>no!=="").filter(([no])=>no!=="ios"&&no!=="android").map(([no,io])=>jsxRuntimeExports.jsx(WalletHelpLink,{name:no,link:io,Icon:getBrowserIcon(no)},no));return jsxRuntimeExports.jsxs("div",{className:"no-qr-code-installed__container","data-testid":"no-qr-code-installed",children:[jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__img",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr.key,style:{height:pixelToRem(64),width:pixelToRem(64)}})}),jsxRuntimeExports.jsx(Typography,{className:"no-qr-code-installed__typography--title",variant:"title",copykey:"dyn_qr_code.wallet_not_installed.install",children:to("dyn_qr_code.wallet_not_installed.install",{wallet:getWalletBookWallet(eo,Xr.key).name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"no-qr-code-installed__typography",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.select",children:to("dyn_qr_code.wallet_not_installed.select")}),jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__links-section",children:ro}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"no-qr-code-installed__typography",weight:"medium",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.refresh",children:to("dyn_qr_code.wallet_not_installed.refresh")})]})};var _g$4,_defs$4,_excluded$b=["title","titleId"];function _extends$d(){return _extends$d=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$b(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyIntro2=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$b(eo,_excluded$b);return reactExports.createElement("svg",_extends$d({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$4||(_g$4=reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-intro2_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.106ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.333 5.333 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.314.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.325 9.325 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.732-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 0 0 1.775 3.069 12.347 12.347 0 0 1 6.203-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.069-1.775 15.891 15.891 0 0 0-2.135 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.604-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944-.121.196a1.774 1.774 0 0 0 3.049 1.81 26.434 26.434 0 0 0 4.135-14.253 5.318 5.318 0 0 1 10.636 0c0 1.723-.118 3.418-.345 5.078a1.773 1.773 0 0 0 3.513.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs$4||(_defs$4=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro2_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-intro2_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-intro2_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_path$7,_path2,_path3,_excluded$a=["title","titleId"];function _extends$c(){return _extends$c=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$a(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAndroidFaceId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$a(eo,_excluded$a);return reactExports.createElement("svg",_extends$c({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$7||(_path$7=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 57.887c14.297 0 25.887-11.59 25.887-25.887S46.297 6.113 32 6.113 6.113 17.703 6.113 32 17.703 57.887 32 57.887ZM32 60c15.464 0 28-12.536 28-28S47.464 4 32 4 4 16.536 4 32s12.536 28 28 28Z",fill:"#1A73E8"})),_path2||(_path2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M36.752 46.831c.27.582.018 1.274-.565 1.544-2.69 1.25-5.356 1.479-7.54.476-2.215-1.017-3.66-3.173-4.134-6.099l2.295-.372c.383 2.364 1.466 3.742 2.809 4.359 1.374.63 3.299.592 5.591-.472a1.162 1.162 0 0 1 1.544.564ZM33.585 35.17v-4.755h2.113v6.868h-5.811V35.17h3.698Z",fill:"#1A73E8"})),_path3||(_path3=reactExports.createElement("path",{d:"M46.792 25.132a2.113 2.113 0 1 1-4.226 0 2.113 2.113 0 0 1 4.226 0ZM21.434 25.132a2.113 2.113 0 1 1-4.227 0 2.113 2.113 0 0 1 4.227 0Z",fill:"#1A73E8"})))},_path$6,_excluded$9=["title","titleId"];function _extends$b(){return _extends$b=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$9(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgAndroidTouchId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$9(eo,_excluded$9);return reactExports.createElement("svg",_extends$b({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$6||(_path$6=reactExports.createElement("path",{d:"M47.493 11.92c-.213 0-.426-.053-.613-.16C41.76 9.12 37.333 8 32.027 8c-5.28 0-10.294 1.253-14.854 3.76-.64.347-1.44.107-1.813-.533a1.35 1.35 0 0 1 .533-1.814c4.96-2.693 10.4-4.08 16.134-4.08 5.68 0 10.64 1.254 16.08 4.054.666.346.906 1.146.56 1.786-.24.48-.694.747-1.174.747Zm-38.16 14a1.33 1.33 0 0 1-1.093-2.107c2.64-3.733 6-6.666 10-8.72 8.373-4.32 19.093-4.346 27.493-.026 4 2.053 7.36 4.96 10 8.666.427.587.294 1.44-.32 1.867a1.33 1.33 0 0 1-1.866-.32c-2.4-3.36-5.44-6-9.04-7.84-7.654-3.92-17.44-3.92-25.067.027-3.627 1.866-6.667 4.533-9.067 7.893-.213.373-.613.56-1.04.56ZM26 58.107c-.347 0-.693-.134-.933-.4-2.32-2.32-3.574-3.814-5.36-7.04-1.84-3.28-2.8-7.28-2.8-11.574 0-7.92 6.773-14.373 15.093-14.373s15.093 6.453 15.093 14.373a1.32 1.32 0 0 1-1.333 1.334 1.32 1.32 0 0 1-1.333-1.334c0-6.453-5.574-11.706-12.427-11.706S19.573 32.64 19.573 39.093c0 3.84.854 7.387 2.48 10.267 1.707 3.067 2.88 4.373 4.934 6.453a1.37 1.37 0 0 1 0 1.894c-.294.266-.64.4-.987.4Zm19.12-4.934c-3.173 0-5.973-.8-8.267-2.373-3.973-2.693-6.346-7.067-6.346-11.707a1.32 1.32 0 0 1 1.333-1.333 1.32 1.32 0 0 1 1.333 1.333c0 3.76 1.92 7.307 5.174 9.494 1.893 1.28 4.106 1.893 6.773 1.893.64 0 1.707-.08 2.773-.267a1.33 1.33 0 0 1 1.547 1.094 1.33 1.33 0 0 1-1.093 1.546c-1.52.294-2.854.32-3.227.32Zm-5.36 5.494a1.56 1.56 0 0 1-.347-.054c-4.24-1.173-7.013-2.746-9.92-5.6-3.733-3.706-5.786-8.64-5.786-13.92 0-4.32 3.68-7.84 8.213-7.84 4.533 0 8.213 3.52 8.213 7.84 0 2.854 2.48 5.174 5.547 5.174 3.067 0 5.547-2.32 5.547-5.174 0-10.053-8.667-18.213-19.334-18.213-7.573 0-14.506 4.213-17.626 10.747-1.04 2.16-1.574 4.693-1.574 7.466 0 2.08.187 5.36 1.787 9.627a1.301 1.301 0 0 1-.773 1.707A1.323 1.323 0 0 1 12 49.653c-1.307-3.493-1.947-6.96-1.947-10.56 0-3.2.614-6.106 1.814-8.64 3.546-7.44 11.413-12.266 20.026-12.266 12.134 0 22 9.36 22 20.88 0 4.32-3.68 7.84-8.213 7.84-4.533 0-8.213-3.52-8.213-7.84 0-2.854-2.48-5.174-5.547-5.174-3.067 0-5.547 2.32-5.547 5.174 0 4.56 1.76 8.826 4.987 12.026 2.533 2.507 4.96 3.894 8.72 4.934.72.186 1.12.933.933 1.626a1.301 1.301 0 0 1-1.253 1.014Z",fill:"#1A73E8"})))},_path$5,_excluded$8=["title","titleId"];function _extends$a(){return _extends$a=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$8(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgFaceId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$8(eo,_excluded$8);return reactExports.createElement("svg",_extends$a({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$5||(_path$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.055 2.4A3.548 3.548 0 0 1 21.6 5.945v2.013a1.095 1.095 0 0 1-2.19 0V5.945c0-.747-.608-1.355-1.355-1.355h-2.012a1.095 1.095 0 1 1 0-2.19h2.012Zm-10.098 0a1.095 1.095 0 0 1 0 2.19H5.945c-.747 0-1.355.608-1.355 1.355v2.013a1.095 1.095 0 0 1-2.19 0V5.945A3.548 3.548 0 0 1 5.945 2.4h2.012Zm7.692 5.083c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 1 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm-4.121 0c.614 0 1.112.498 1.112 1.112v2.982h.008a1.113 1.113 0 0 1 0 2.226h-.386a1.849 1.849 0 0 1-1.847-1.848v-3.36c0-.614.498-1.112 1.113-1.112Zm-3.282 0c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 0 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm12.259 7.465c.605 0 1.095.49 1.095 1.095v2.012a3.548 3.548 0 0 1-3.545 3.545h-2.012a1.095 1.095 0 1 1 0-2.19h2.012c.747 0 1.355-.608 1.355-1.355v-2.012c0-.605.49-1.095 1.095-1.095Zm-17.01 0c.605 0 1.095.49 1.095 1.095v2.012c0 .747.608 1.355 1.355 1.355h2.012a1.095 1.095 0 0 1 0 2.19H5.945A3.548 3.548 0 0 1 2.4 18.055v-2.012c0-.605.49-1.095 1.095-1.095Zm5.365 1.337a.473.473 0 0 0 0 0l-.434.47a1.113 1.113 0 0 1 1.51-1.634c.563.52 1.296.806 2.064.806s1.5-.286 2.065-.807a1.113 1.113 0 0 1 1.51 1.634A5.255 5.255 0 0 1 12 18.153a5.255 5.255 0 0 1-3.574-1.397l.434-.47a4.615 4.615 0 0 1 0 0Zm5.947.28a4.694 4.694 0 0 1 0 0Z",fill:"#ABACB2"})))},_g$3,_defs$3,_excluded$7=["title","titleId"];function _extends$9(){return _extends$9=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$7(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgIphoneTouchId=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$7(eo,_excluded$7);return reactExports.createElement("svg",_extends$9({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$3||(_g$3=reactExports.createElement("g",{clipPath:"url(#iphone-touch-id_svg__a)",fill:"#000"},reactExports.createElement("path",{d:"M38.635.943c-4.483-1.118-9.2-1.278-13.79-.287a.657.657 0 0 0 .277 1.285c4.396-.95 8.924-.793 13.232.287 10.3 2.582 18.875 10.327 22.14 20.444 1.264 3.912 1.8 8.078 1.908 12.445a.657.657 0 0 0 1.313-.033c-.108-4.426-.651-8.7-1.945-12.74C58.378 11.75 49.417 3.632 38.635.943ZM21.51 2.932a.657.657 0 1 0-.35-1.267c-4.801 1.324-11.554 5.9-15.728 12.014a.754.754 0 0 0-.004.007C1.763 19.208-.534 26.148.108 32.883l.001.019c.154 1.23.412 2.457.67 3.686.544 2.588 1.09 5.183.665 7.818a.657.657 0 1 0 1.297.21c.445-2.755-.107-5.443-.66-8.13-.254-1.244-.51-2.487-.666-3.737-.604-6.364 1.57-13.002 5.105-18.333 4.015-5.879 10.516-10.25 14.99-11.484Z"}),reactExports.createElement("path",{d:"M30.133 4.4c8.25-.504 16.499 2.863 22.039 9.314a.657.657 0 1 1-.997.856c-5.268-6.134-13.118-9.339-20.966-8.858H30.2c-9.925.48-19.22 7.214-22.638 16.648a.657.657 0 1 1-1.236-.447C9.928 11.973 19.688 4.907 30.133 4.4ZM54.174 16.585a.657.657 0 0 0-1.091.733c3.07 4.572 4.34 9.548 4.843 15.454a.657.657 0 0 0 1.31-.112c-.514-6.034-1.823-11.252-5.062-16.075ZM58.796 35.45a.657.657 0 0 1 .697.615c.247 3.963.25 8.446-.189 11.76a.657.657 0 1 1-1.303-.173c.423-3.193.425-7.582.18-11.505a.657.657 0 0 1 .615-.697ZM6.57 25.543a.657.657 0 1 0-1.278-.308 26.58 26.58 0 0 0-.743 6.104c-.01 2.117.385 4.184.78 6.25.323 1.692.646 3.384.747 5.104.134 2.26-.341 4.523-1.163 6.677a.657.657 0 1 0 1.228.469c.868-2.277 1.395-4.73 1.247-7.223-.1-1.709-.424-3.39-.747-5.072-.394-2.051-.788-4.102-.778-6.199.01-1.952.248-3.902.706-5.802Z"}),reactExports.createElement("path",{d:"M23.813 10.94a.657.657 0 0 1-.365.855c-6.813 2.736-11.93 8.91-12.973 16.19-.436 3.042.035 6.055.506 9.067.265 1.696.53 3.392.634 5.093.223 3.688-.197 7.739-2.597 11.425a.657.657 0 0 1-1.101-.718c2.186-3.358 2.6-7.088 2.386-10.627-.105-1.726-.368-3.442-.632-5.156-.472-3.077-.944-6.15-.497-9.27 1.115-7.774 6.563-14.324 13.784-17.224a.657.657 0 0 1 .855.365ZM46.882 14.681c-5.374-5.034-13.164-6.79-20.244-5.238a.657.657 0 1 0 .282 1.284c6.704-1.47 14.039.207 19.064 4.914 4.235 3.967 6.695 9.739 7.339 16.037a.657.657 0 0 0 1.307-.134c-.668-6.54-3.232-12.633-7.748-16.863ZM54.493 34.674a.657.657 0 0 1 .72.586c.625 6.077.356 12.64-.587 18.99a.657.657 0 0 1-1.3-.193c.93-6.261 1.191-12.713.58-18.662a.657.657 0 0 1 .587-.721Z"}),reactExports.createElement("path",{d:"M31.582 13.355c-10.07 0-18.252 8.034-18.252 17.967 0 1.06.094 2.1.274 3.111a.657.657 0 0 0 1.294-.23 16.469 16.469 0 0 1-.254-2.881c0-9.187 7.574-16.652 16.938-16.652 4.232 0 8.098 1.525 11.066 4.045a.657.657 0 0 0 .85-1.002 18.353 18.353 0 0 0-11.916-4.358ZM44.971 20.163a.657.657 0 0 1 .93.02c2.9 3.024 3.828 7.777 4.442 11.766.692 4.494.798 8.877.798 10.91a.657.657 0 0 1-1.315 0c0-2-.104-6.31-.782-10.71-.57-3.703-1.392-8.24-4.092-11.056a.657.657 0 0 1 .02-.93ZM50.974 46.622a.657.657 0 0 0-1.31-.105c-.323 4.048-.745 8.092-1.6 11.827a.657.657 0 1 0 1.28.293c.879-3.833 1.306-7.956 1.63-12.015ZM14.662 36.852a.657.657 0 0 1 .771.518c1.39 7.056.43 13.466-3.25 19.08a.657.657 0 0 1-1.099-.72c3.462-5.283 4.394-11.331 3.06-18.106a.657.657 0 0 1 .518-.772Z"}),reactExports.createElement("path",{d:"M31.582 17.631c-6.537 0-12.95 5.06-13.604 11.42-.287 2.784.116 5.526.519 8.27.351 2.395.703 4.791.596 7.217-.244 5.552-1.873 10.135-4.672 13.91a.657.657 0 1 0 1.056.782c2.968-4.003 4.674-8.844 4.93-14.634.106-2.415-.247-4.804-.6-7.19-.403-2.73-.806-5.459-.521-8.221.574-5.587 6.325-10.24 12.296-10.24 2.785 0 9.991 1.508 12.283 8.976 1.437 4.679 1.828 11.012 1.48 17.164-.347 6.151-1.43 12.035-2.885 15.808a.657.657 0 0 0 1.227.473c1.522-3.947 2.619-9.98 2.97-16.207.353-6.226-.034-12.734-1.535-17.624-2.545-8.289-10.52-9.904-13.54-9.904Z"}),reactExports.createElement("path",{d:"M21.47 56.451c.303.198.389.606.19.91-.407.624-.765 1.278-1.124 1.932-.359.654-.717 1.307-1.125 1.932a.657.657 0 1 1-1.1-.718c.407-.624.765-1.278 1.124-1.932.359-.654.717-1.308 1.125-1.932a.657.657 0 0 1 .91-.192ZM27.096 24.453a.657.657 0 1 0-.73-1.093c-2.603 1.74-4.2 4.134-4.2 7.64 0 2.088.37 3.795.75 5.545.567 2.62.953 5.233.883 7.923-.084 3.267-.723 6.252-1.952 9.096a.657.657 0 1 0 1.207.521c1.299-3.007 1.971-6.158 2.06-9.583.071-2.796-.325-5.513-.913-8.235-.38-1.758-.72-3.328-.72-5.267 0-3.004 1.321-5.013 3.615-6.547ZM29.66 22.144c2.728-.556 5.662.13 7.822 1.879 3.858 3.122 4.371 8.817 4.787 13.432l.021.235c.538 5.949-.077 11.726-1.316 17.529a.657.657 0 1 1-1.286-.275c1.22-5.715 1.815-11.355 1.293-17.136l-.052-.582v-.002c-.37-4.17-.832-9.394-4.274-12.18-1.846-1.494-4.379-2.092-6.732-1.613a.657.657 0 1 1-.262-1.287ZM40.045 58.489a.657.657 0 1 0-1.274-.325 15.88 15.88 0 0 1-1.785 4.266.657.657 0 1 0 1.127.675 17.188 17.188 0 0 0 1.932-4.616ZM36.831 48.952c.36.043.618.37.576.73-.62 5.245-2.022 9.922-4.27 13.98a.657.657 0 0 1-1.15-.638c2.152-3.882 3.51-8.39 4.115-13.496a.657.657 0 0 1 .73-.576Z"}),reactExports.createElement("path",{d:"M36.696 30.656c-.456-2.435-2.545-4.297-5.081-4.297-3.435 0-5.845 3.462-4.996 6.683 1.437 5.686 1.673 11.166.7 16.444v.003c-.845 4.739-2.465 9.002-4.677 12.614a.657.657 0 0 0 1.121.686c2.302-3.76 3.978-8.178 4.85-13.067 1.01-5.482.759-11.154-.72-17.005l-.002-.007c-.637-2.41 1.138-5.037 3.724-5.037 1.865 0 3.44 1.373 3.788 3.22.957 5.548 1.455 10.693 1.1 15.123a.657.657 0 1 0 1.31.105c.368-4.592-.151-9.863-1.115-15.456l-.002-.01ZM29.654 59.117c.323.166.45.562.284.885l-1.741 3.389a.657.657 0 1 1-1.17-.601L28.77 59.4a.657.657 0 0 1 .885-.284Z"}),reactExports.createElement("path",{d:"M32.103 31.29a.657.657 0 1 0-1.28.3c2.217 9.433 1.913 17.717-.787 24.773a.657.657 0 1 0 1.228.47c2.814-7.358 3.1-15.919.84-25.544Z"}))),_defs$3||(_defs$3=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"iphone-touch-id_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h64v64H0z"})))))};const PasskeyDeviceIcon=({defaultIcon:Xr,className:eo,size:to="small"})=>{let ro=Xr||null;if(isIPhone()&&(isIPhone8OrEarlier()?ro=jsxRuntimeExports.jsx(SvgIphoneTouchId,{"data-testid":"iphone-8-icon"}):ro=jsxRuntimeExports.jsx(SvgFaceId,{"data-testid":"iphone-icon"})),isAndroid$1()){const no=getAndroidVersion();no&&no>=9?ro=jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"android-9-icon"}):ro=jsxRuntimeExports.jsx(SvgAndroidFaceId,{"data-testid":"android-icon"})}return ro?jsxRuntimeExports.jsx(Icon,{className:eo,size:to,children:ro}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},AuthChoiceInfo=({choice:Xr,variant:eo="default"})=>{const{t:to}=useTranslation(),ro={passkey:{default:[{description:"dyn_embedded_authenticator.passkey.auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.auth_info.security.description",title:"dyn_embedded_authenticator.passkey.auth_info.security.title"}],noEmailSignup:[{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.title"}]}};return jsxRuntimeExports.jsx("div",{className:"auth-choice-info",children:ro[Xr][eo].map((no,io)=>jsxRuntimeExports.jsxs("div",{className:"auth-choice-info__container-item",children:[jsxRuntimeExports.jsx("div",{className:"auth-choice-info__container-icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",className:"auth-choice-info__icon",children:jsxRuntimeExports.jsx(SvgAdd,{})})}),jsxRuntimeExports.jsxs("div",{className:"action-card__item-title",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",copykey:no.title,children:to(no.title)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",copykey:no.description,children:to(no.description)})]})]},`authChoiceInfo_${io}`))})},PasskeyIntroView=({chains:Xr})=>{var eo;const{walletConnectorOptions:to,environmentId:ro,handleLogOut:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),ao=((eo=io==null?void 0:io.verifiedCredentials)===null||eo===void 0?void 0:eo.length)===1&&!getUserVerifiedCredentialType(io,JwtVerifiedCredentialFormatEnum.Email),{t:so}=useTranslation(),[co,lo]=reactExports.useState(!1);reactExports.useEffect(()=>StorageService.removeItem(LAST_USED_WALLET),[]);const{createDynamicEmbeddedWalletMutation:uo,isLoading:ho,error:go}=useCreateDynamicEmbeddedWalletMutation(),bo=Eo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!io&&!oo)throw new Error("User is not logged in");lo(Eo),yield uo({chains:Xr,environmentId:ro,walletConnectorOptions:to,withAuthenticator:Eo})}),wo=reactExports.useMemo(()=>{if(go)return go instanceof DynamicError?go.message:getProperErrorMessage(go)},[go]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_intro.title",children:so("dyn_passkey_intro.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-intro-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntro2,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-intro-view__subtitle",copykey:"dyn_passkey_intro.subtitle",children:so("dyn_passkey_intro.subtitle")}),wo&&jsxRuntimeExports.jsx(ErrorContainer,{children:wo}),jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey",variant:ao?"noEmailSignup":"default"}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",onClick:()=>bo(!0),dataTestId:"setup-passkey-button",loading:ho&&co,disabled:ho,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{copykey:"dyn_passkey_intro.button",children:so("dyn_passkey_intro.button")})]})}),jsxRuntimeExports.jsx(TextButton,{"data-testid":"setup-passkey-logout-button",className:"passkey-intro-view__log-out",onClick:no,copykey:"dyn_passkey_intro.button_logout",children:so("dyn_passkey_intro.button_logout")})]})]})]})};var _circle$1,_path$4,_g$2,_defs$2,_excluded$6=["title","titleId"];function _extends$8(){return _extends$8=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$6(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyIntroIcon=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$6(eo,_excluded$6);return reactExports.createElement("svg",_extends$8({width:206,height:206,viewBox:"0 0 206 206",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle$1||(_circle$1=reactExports.createElement("circle",{cx:103,cy:103,r:103,fill:"url(#passkey-intro-icon_svg__a)",fillOpacity:.12})),_path$4||(_path$4=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M101.59 42.066a6.37 6.37 0 0 1 1.822 0c.696.1 1.343.345 1.858.54l.138.051 17.072 6.402.416.156c1.967.734 3.695 1.38 5.025 2.551a9.553 9.553 0 0 1 2.612 3.77c.631 1.657.628 3.501.625 5.6v15.672c0 9-4.895 16.504-10.187 22.016-5.326 5.55-11.421 9.469-14.643 11.349l-.131.077c-.588.345-1.351.793-2.361 1.01a6.78 6.78 0 0 1-2.67 0c-1.01-.217-1.774-.665-2.362-1.01l-.13-.077c-3.223-1.88-9.317-5.799-14.644-11.349-5.291-5.512-10.186-13.015-10.186-22.016V61.137c-.003-2.1-.006-3.944.625-5.601a9.553 9.553 0 0 1 2.612-3.77c1.33-1.172 3.058-1.817 5.025-2.551l.416-.156 17.072-6.402.138-.052c.514-.194 1.162-.439 1.858-.54ZM94.382 69.11v-4.037a8.073 8.073 0 1 1 16.147 0v4.036a13.434 13.434 0 0 1 5.383 10.766c0 7.431-6.024 13.456-13.456 13.456C95.025 93.33 89 87.306 89 79.875c0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.073 5.073 0 1 0-10.147 0v2.336a13.414 13.414 0 0 1 5.074-.99c1.795 0 3.508.352 5.073.99ZM106 77.5a3.5 3.5 0 0 1-2 3.163V83.5a1.5 1.5 0 1 1-3 0v-2.837a3.5 3.5 0 1 1 5-3.163ZM126 22a4 4 0 0 1 4-4h45a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4h-45a4 4 0 0 1-4-4V22Zm15 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm7 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm13-3a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm9 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm1 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z",fill:"#4779FF"})),_g$2||(_g$2=reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__b)"},reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__c)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.731 54.983a15.068 15.068 0 0 0 1.087-10.69C58.656 36.226 50.362 31.438 42.294 33.6c-8.069 2.162-12.857 10.455-10.695 18.524a15.068 15.068 0 0 0 6.288 8.715c1.864-4.039 6.77-6.622 9.948-7.473 3.179-.852 8.204-1.183 11.896 1.618Zm-19.98-8.96a5.672 5.672 0 1 1 10.957-2.935 5.672 5.672 0 0 1-10.957 2.936Z",fill:"#4779FF"})))),_defs$2||(_defs$2=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__b"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 151.778 -80.474)",d:"M0 0h33v33H0z"})),reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__c"},reactExports.createElement("rect",{x:27.684,y:37.513,width:30.25,height:30.25,rx:15.125,transform:"rotate(-15 27.684 37.513)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"passkey-intro-icon_svg__a",x1:103,y1:0,x2:103,y2:105.711,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AddRecoveryEmail=({canSkipAddingEmail:Xr=!0,shouldInitRecovery:eo=!1,authenticatorType:to,currentAction:ro,isFromEmailVerification:no=!1})=>{const{user:io,setShowAuthFlow:oo}=useInternalDynamicContext(),{t:ao}=useTranslation(),{addRecoveryEmail:so,initPasskeyRecoveryProcess:co}=usePasskeyRecovery(),[lo,uo]=reactExports.useState(!1),[ho,go]=reactExports.useState(void 0);useEffectOnce(()=>{dynamicEvents.once("embeddedWalletRecoveryEmailCompleted",()=>__awaiter$j(void 0,void 0,void 0,function*(){if(uo(!0),go(void 0),!eo){setTimeout(()=>{oo(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},5e3);return}return co(to,ro)})),dynamicEvents.once("embeddedWalletRecoveryEmailFailed",Ro=>__awaiter$j(void 0,void 0,void 0,function*(){go(Ro)}))});const{mutate:bo,isLoading:wo}=useMutation(Ro=>__awaiter$j(void 0,void 0,void 0,function*(){yield so(Ro)})),Eo=()=>{oo(!1)},$o=()=>{if(ho)return ho instanceof DynamicError?ho.message:getProperErrorMessage(ho)},Co=Xr&&jsxRuntimeExports.jsx(IconButton,{onClick:Eo,type:"button","data-testid":"add-recovery-email-close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Co,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"passkey-recovery-heading",className:"header__typography",copykey:"dyn_passkey_recovery.add_email.title",children:ao("dyn_passkey_recovery.add_email.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),lo&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",copykey:"dyn_passkey_recovery.add_email.success_message",children:ao("dyn_passkey_recovery.add_email.success_message")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:"dyn_passkey_recovery.add_email.description",children:ao("dyn_passkey_recovery.add_email.description")}),ho!==void 0&&jsxRuntimeExports.jsx(ErrorContainer,{children:$o()}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__form",children:jsxRuntimeExports.jsx(EmailForm,{onSubmit:bo,currentEmail:io==null?void 0:io.email,isLoading:(wo||no)&&!ho,buttonCopyKey:"dyn_passkey_recovery.add_email.confirm_button",isDisabled:no&&!ho&&!lo})})]})]})},bundleRegex=new RegExp(/^([A-Za-z0-9\s_+@\.-]+)$/),PasskeyBundleRecovery=({authenticatorType:Xr,currentAction:eo})=>{const{primaryWallet:to,environmentId:ro,user:no,setShowAuthFlow:io}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:oo}=useIsTurnkeyWallet(),{getEOAWallet:ao}=useSmartWallets(),[so,co]=reactExports.useState(""),[lo,uo]=reactExports.useState(!1),[ho,go]=reactExports.useState(!1),{t:bo}=useTranslation(),{setView:wo}=useViewContext(),{mutate:Eo,isLoading:$o,error:Co}=useMutation(Jo=>__awaiter$j(void 0,void 0,void 0,function*(){var Po;const fo=(Po=to&&ao(to))!==null&&Po!==void 0?Po:to;yield passkeyRecoveryBundleValidation({bundleInput:Jo,user:no,wallet:fo}),go(!0),Xr==="email"&&dynamicEvents.emit("passkeyRecoveryCompleted",to),setTimeout(()=>{if(Xr==="passkey")return wo("passkey-recovery-complete");eo!=="reveal"&&io(!1)},2e3)})),Ro=Jo=>!(!(Jo!=null&&Jo.length)||Jo.length<100||Jo.length>=256||!bundleRegex.test(Jo)),Oo=Jo=>{var Po;const fo=(Po=Jo.target.value)===null||Po===void 0?void 0:Po.trim();co(fo),Ro(fo)&&Eo(fo)},jo=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{uo(!0),yield resentRecoveryEmail({authenticatorType:Xr,environmentId:ro,user:no,wallet:to})}catch(Jo){logger$8.error("Failed to complete passkey recovery",Jo)}finally{uo(!1)}}),Bo=reactExports.useMemo(()=>{if(Co)return Co instanceof DynamicError?Co.message:getProperErrorMessage(Co)},[Co]),Mo=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SignInWithEmailIcon,{})}),Fo=oo?"dyn_passkey_secure_modal":"dyn_passkey_recovery",Wo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{io(!1,{emitCancelAuth:!0}),dynamicEvents.emit("passkeyRecoveryFailed",new DynamicError("Validation request cancelled"))},"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Wo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:`${Fo}.code.title`,children:bo(`${Fo}.code.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[!Co&&!ho?jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Mo,isSpinning:!Co&&!ho,iconSize:96}):jsxRuntimeExports.jsx(IconWithStatus,{Icon:SignInWithEmailIcon,iconSize:64,variant:Co?"red":"green",InnerIcon:Co?SvgError:SvgCheck}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:`${Fo}.code.description`,children:bo(`${Fo}.code.description`,{email:no==null?void 0:no.email})}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(Input,{id:"passkey-recovery-bundle","data-testid":"passkey-recovery-bundle-input",value:so,onChange:Oo,label:bo(`${Fo}.code.input_label`),disabled:$o||lo,error:!!Co,className:ho?"passkey-recovery-view__input-valid":"",autoFocus:!0,message:Bo})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__resend-code",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:`${Fo}.code.resend.text`,children:bo(`${Fo}.code.resend.text`)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:`${Fo}.code.resend.button`,children:jsxRuntimeExports.jsx(TextButton,{"data-testid":"resend-email-button",onClick:jo,disabled:lo||$o||so.length>0&&!Co,children:bo(`${Fo}.code.resend.button`)})})]})]})]})},NeedHelpSection=({isRecoveryFlow:Xr=!1})=>{var eo,to,ro,no,io,oo;const{projectSettings:ao,primaryWallet:so}=useInternalDynamicContext(),{t:co}=useTranslation(),{initPasskeyRecoveryProcess:lo}=usePasskeyRecovery(),uo=(eo=ao==null?void 0:ao.general)===null||eo===void 0?void 0:eo.supportEmail,ho=((to=ao==null?void 0:ao.general)===null||to===void 0?void 0:to.supportUrls)&&((ro=Object.values(ao==null?void 0:ao.general.supportUrls))===null||ro===void 0?void 0:ro[0]),go=!Xr&&((no=ao==null?void 0:ao.providers)===null||no===void 0?void 0:no.find(Oo=>Oo.provider===ProviderEnum.Turnkey&&Oo.enabledAt))&&!!(!((oo=(io=ao==null?void 0:ao.sdk)===null||io===void 0?void 0:io.embeddedWallets)===null||oo===void 0)&&oo.emailRecoveryEnabled),{getEOAWallet:bo}=useSmartWallets(),wo=so&&bo(so),Eo=so&&isSessionKeyCompatibleWallet(so)||wo&&isSessionKeyCompatibleWallet(wo),$o=!!(uo||ho),Co=()=>$o?jsxRuntimeExports.jsxs("div",{className:"need-help-section__links",children:[ho&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:"dyn_need_help_section.contact_support",children:jsxRuntimeExports.jsx("a",{href:ho,rel:"noreferrer",target:"_blank",children:co("dyn_need_help_section.contact_support")})}),uo&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${uo}`,children:uo})})]}):null,Ro=()=>{if(!go)return null;const Oo=co("dyn_need_help_section.help_button"),jo=$o?Oo:Oo.slice(0,1).toUpperCase()+Oo.slice(1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$o&&jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.divider",children:co("dyn_need_help_section.divider")}),jsxRuntimeExports.jsx(TextButton,{copykey:"dyn_need_help_section.help_button",className:classNames("need-help-section__helper-link"),onClick:()=>lo(void 0,"helpSession"),children:jo})]})};return!$o&&(!go||Eo)?null:jsxRuntimeExports.jsxs("div",{className:"need-help-section",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.info",children:co("dyn_need_help_section.info")}),Co(),Ro()]})},PasskeyCompleteRecovery=()=>{const{primaryWallet:Xr,environmentId:eo,user:to,setShowAuthFlow:ro,setPasskeySuccessPopup:no}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:io}=useIsTurnkeyWallet(),{getEOAWallet:oo}=useSmartWallets(),{t:ao}=useTranslation(),{mutate:so,isLoading:co,error:lo}=useMutation(()=>__awaiter$j(void 0,void 0,void 0,function*(){var go;const bo=(go=Xr&&oo(Xr))!==null&&go!==void 0?go:Xr;if(!(yield completePasskeyRecovery({environmentId:eo,user:to,wallet:bo})))throw new DynamicError("Error completing passkey recovery");dynamicEvents.emit("passkeyRecoveryCompleted",Xr),ro(!1),no(PasskeySuccessEnum.CREATED)}),{onFailure:go=>{logger$8.error("Failed to init passkey recovery",go),dynamicEvents.emit("passkeyRecoveryFailed",go)}}),uo=reactExports.useMemo(()=>{if(lo)return lo instanceof DynamicError?lo.message:getProperErrorMessage(lo)},[lo]),ho=io?"dyn_passkey_secure_modal":"dyn_passkey_recovery";return jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:ao(`${ho}.complete.description`)}),uo&&jsxRuntimeExports.jsx(ErrorContainer,{children:uo}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",dataTestId:"passkey-recovery-complete-button",onClick:()=>so(),disabled:co,showInternalLoading:!1,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{children:ao(`${ho}.complete.complete_button`)})]})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})},PasskeyInitRecovery=({authenticatorType:Xr})=>{const{setShowAuthFlow:eo}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:to}=useIsTurnkeyWallet(),{initAuthMethod:ro,isLoading:no,error:io}=useInitEmbeddedWalletAuthMethod(),{createRootElement:oo}=useElementById(),ao=oo(iframeContainerId$1),{t:so}=useTranslation(),co=reactExports.useMemo(()=>{if(io)return io instanceof DynamicError?io.message:"Something went wrong."},[io]),lo=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,{})}),uo=to?"dyn_passkey_secure_modal":"dyn_passkey_recovery",ho=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>eo(!1,{emitCancelAuth:!0}),"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:ho,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:so(`${uo}.start.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:lo,isSpinning:no,iconSize:96}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:so(`${uo}.start.description`)}),co&&jsxRuntimeExports.jsx(ErrorContainer,{children:co}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",dataTestId:"passkey-recovery-button",onClick:()=>ro({authenticatorType:Xr,iframeContainer:ao.current}),disabled:no,showInternalLoading:!1,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{children:so(`${uo}.start.start_button`)})})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},RenamePasskeyView=()=>{var Xr;const{passkey:eo,setPasskey:to,passkeyIcon:ro,passkeyEdited:no,setPasskeyEdited:io}=usePasskeyContext(),{t:oo}=useTranslation(),{environmentId:ao,setShowAuthFlow:so,setPasskeySuccessPopup:co}=useInternalDynamicContext(),[lo,uo]=reactExports.useState(!1),ho=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(wo&&(eo!=null&&eo.id)){const Eo=yield updateUserPasskey({alias:wo.trim(),environmentId:ao,id:eo.id});Eo?(to(Eo),io(!no),so(!1),co(PasskeySuccessEnum.EDITED)):uo(!0)}else uo(!0)}),go=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{so(!1)},"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),bo=jsxRuntimeExports.jsx(IconButton,{onClick:()=>so(!1),type:"button",id:"close-button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return eo?jsxRuntimeExports.jsxs("div",{className:"edit-passkeys-widget-view",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:go,trailing:bo}),jsxRuntimeExports.jsx("div",{className:"edit-passkeys-widget-view__icon",children:ro}),jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",copykey:"dyn_rename_passkeys.title",children:oo("dyn_rename_passkeys.title")}),jsxRuntimeExports.jsx(Formik,{initialValues:{alias:(Xr=eo.alias)!==null&&Xr!==void 0?Xr:""},onSubmit:wo=>{ho(wo.alias)},children:({values:wo})=>jsxRuntimeExports.jsxs(Form,{className:"edit-passkeys-widget-view__body",children:[jsxRuntimeExports.jsx(Field$1,{"data-testid":"input-field",name:"alias",type:"text",label:oo("dyn_rename_passkeys.input_label"),copykey:"dyn_rename_passkeys.input_label",className:"edit-passkeys-widget-view__input",as:Input,error:lo,maxLength:32}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",className:"edit-passkeys-widget-view__body",buttonPadding:"large",disabled:!wo.alias,copykey:"dyn_rename_passkeys.save",children:oo("dyn_rename_passkeys.save")}),lo&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"body_small",color:"error-1",copykey:"dyn_rename_passkeys.error",children:oo("dyn_rename_passkeys.error")})]})})]}):jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",children:oo("dyn_rename_passkeys.not_found")})};var _g$1,_defs$1,_excluded$5=["title","titleId"];function _extends$7(){return _extends$7=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$5(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgMultipleAccountSecurity=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$5(eo,_excluded$5);return reactExports.createElement("svg",_extends$7({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g$1||(_g$1=reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#multiple-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__c)"},reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"}))),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$1||(_defs$1=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"multiple-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__d"},reactExports.createElement("rect",{x:87.633,y:38.225,width:29.333,height:29.333,rx:14.667,transform:"rotate(-15 87.633 38.225)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"multiple-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_g,_defs,_excluded$4=["title","titleId"];function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$4(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgPasskeyAccountSecurity=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$4(eo,_excluded$4);return reactExports.createElement("svg",_extends$6({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_g||(_g=reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.105ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.334 5.334 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.846 9.846 0 0 0-3.409-1.665 9.849 9.849 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 1 0 1.776 3.069 12.34 12.34 0 0 1 6.202-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.068-1.775 15.882 15.882 0 0 0-2.136 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.605-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944a8.75 8.75 0 0 0-.12.196 1.773 1.773 0 1 0 3.048 1.81c.023-.04.048-.079.072-.118a26.434 26.434 0 0 0 4.063-14.134 5.318 5.318 0 0 1 10.636 0c0 1.722-.118 3.417-.344 5.077a1.772 1.772 0 1 0 3.512.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs||(_defs=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const ActionCard=({titleKey:Xr,descriptionKey:eo,description:to,LeadingIcon:ro,action:no,badgeVariant:io,badgeKey:oo,isLoading:ao,dataTestId:so})=>{const{t:co}=useTranslation();return jsxRuntimeExports.jsxs("button",{className:"action-card",onClick:no,"data-testid":so,children:[jsxRuntimeExports.jsx(Icon,{className:"action-card__icon",children:ro}),jsxRuntimeExports.jsxs("div",{className:"action-card__content",children:[jsxRuntimeExports.jsxs("div",{className:"action-card__content__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",copykey:Xr,children:co(Xr)}),jsxRuntimeExports.jsx(Badge,{text:co(oo),className:classNames("action-card__content__row__badge",{"action-card__content__row__badge--primary":io==="primary"},{"action-card__content__row__badge--secondary":io==="secondary"}),copykey:oo})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:eo,children:to})]}),jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",className:"action-card__action-icon",children:ao?jsxRuntimeExports.jsx(Spinner$1,{}):jsxRuntimeExports.jsx(SvgChevronLeft,{})})]})},EmbeddedAuthChoiceCards=({currentAction:Xr,supportedAuthenticators:eo})=>{var to,ro;const[no,io]=reactExports.useState(),{projectSettings:oo}=useInternalDynamicContext(),{t:ao}=useTranslation(),{initAuthMethod:so,isLoading:co}=useInitEmbeddedWalletAuthMethod(),{createRootElement:lo}=useElementById(),uo=lo(iframeContainerId$1),ho={email:{badgeKey:"dyn_embedded_authenticator.email.badge",description:ao("dyn_embedded_authenticator.email.description",{expiration:(ro=(to=oo==null?void 0:oo.sdk.embeddedWallets)===null||to===void 0?void 0:to.sessionKeyDuration)===null||ro===void 0?void 0:ro.amount}),descriptionKey:"dyn_embedded_authenticator.email.description",icon:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"small",children:jsxRuntimeExports.jsx(SvgMail,{})},"one-time-code-icon"),titleKey:"dyn_embedded_authenticator.email.title"},passkey:{badgeKey:"dyn_embedded_authenticator.passkey.badge",description:ao("dyn_embedded_authenticator.passkey.description"),descriptionKey:"dyn_embedded_authenticator.passkey.description",icon:jsxRuntimeExports.jsx(PasskeyDeviceIcon,{defaultIcon:jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"default-icon"})}),titleKey:Xr==="reveal"?"dyn_embedded_authenticator.passkey.reveal_title":"dyn_embedded_authenticator.passkey.title"}},go=bo=>()=>__awaiter$j(void 0,void 0,void 0,function*(){io(bo),yield so({authenticatorType:bo,currentAction:Xr,iframeContainer:uo.current})});return jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice-cards",children:eo&&eo.map(bo=>jsxRuntimeExports.jsx(ActionCard,{LeadingIcon:ho[bo].icon,action:go(bo),badgeKey:ho[bo].badgeKey,badgeVariant:bo==="passkey"?"primary":"secondary",descriptionKey:ho[bo].descriptionKey,description:ho[bo].description,titleKey:ho[bo].titleKey,isLoading:co&&bo===no,dataTestId:`embedded-auth-choice__item-${bo}`},bo))})},titleDescriptionMap={helpSession:{description:"dyn_embedded_authenticator.need_help_description",title:"dyn_embedded_authenticator.need_help_title"},reveal:{description:"dyn_embedded_authenticator.reveal_description",title:"dyn_embedded_authenticator.reveal_title"},sendTransaction:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"},signMessage:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"}},EmbeddedAuthChoice=({currentAction:Xr})=>{var eo;const{t:to}=useTranslation(),{primaryWallet:ro,projectSettings:no,setShowAuthFlow:io}=useInternalDynamicContext(),{getEOAWallet:oo}=useSmartWallets(),ao=(eo=ro&&oo(ro))!==null&&eo!==void 0?eo:ro,{initPasskeyRecoveryProcess:so}=usePasskeyRecovery(),{isTurnkeyWallet:co}=useIsTurnkeyWallet(),lo=reactExports.useMemo(()=>{var Eo;const $o=getEnabledEmbeddedWalletsAuthenticators((Eo=no==null?void 0:no.sdk.embeddedWallets)===null||Eo===void 0?void 0:Eo.supportedSecurityMethods),Co=Object.keys($o);return!Xr||!["helpSession","reveal"].includes(Xr)?Co.filter(Ro=>Ro!=="email"):Co},[no==null?void 0:no.sdk.embeddedWallets]),uo=()=>!ao||!co?!1:ao.connector.getAuthenticatorHandler().isSessionActive(),ho=()=>lo.length>1?jsxRuntimeExports.jsx(SvgMultipleAccountSecurity,{}):jsxRuntimeExports.jsx(SvgPasskeyAccountSecurity,{}),go=uo()?"dyn_embedded_authenticator.passkey.auth_info.start_button":"dyn_embedded_authenticator.passkey.auth_info.add_button",{title:bo,description:wo}=titleDescriptionMap[Xr||"signMessage"];return lo!=null&&lo.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:bo,children:to(bo)})}),jsxRuntimeExports.jsxs("div",{className:"embedded-auth-choice",children:[jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice__header",children:ho()}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"embedded-auth-choice__subtitle",copykey:wo,children:to(wo)}),lo.length>1?jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{currentAction:Xr,supportedAuthenticators:lo}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey"}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"passkey-only-choice-button",buttonVariant:"brand-primary",color:"brand-primary",expanded:!0,onClick:()=>so("passkey"),copykey:go,typographyProps:{color:"inherit"},children:to(go)})]}),Xr!=="reveal"&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonClassName:"embedded-auth-choice__skip-button",expanded:!0,onClick:()=>io(!1),copykey:"dyn_embedded_authenticator.skip",children:to("dyn_embedded_authenticator.skip")})]})]}):null},PendingSignatureView=()=>{const[Xr,eo]=reactExports.useState(!1),{selectedWalletConnector:to}=useInternalDynamicContext(),{signAlreadyConnectedUser:ro}=useConnectAndSignSplitSteps(),{t:no}=useTranslation(),io=96,oo=isHardwareWalletEnabled(to);if(!to)return null;const ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{eo(!0),yield ro({walletConnector:to})}catch(lo){logger$8.error(lo)}finally{eo(!1)}}),so=jsxRuntimeExports.jsx(WalletIcon,{walletKey:to.key,style:{height:pixelToRem(io*iconRatio),width:pixelToRem(io*iconRatio)}}),co=no(oo?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description");return jsxRuntimeExports.jsxs("div",{className:"pending-signature__container","data-testid":"pending-signature-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so,iconSize:io,isSpinning:!0,indicator:"connected",className:"pending-signature__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("pending-signature__copy"),copykey:oo?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description",children:co}),oo&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:classNames("pending-signature__copy","pending-signature__copy--mini"),copykey:"dyn_pending_signature.phantom_ledger_warning",children:[jsxRuntimeExports.jsx("strong",{children:no("dyn_pending_signature.note")}),no("dyn_pending_signature.phantom_ledger_warning")]}),requiresTwoStepAuthentication(to)&&jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"pending-signature__button",onClick:ao,loading:Xr,buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_pending_signature.click_to_sign",children:no("dyn_pending_signature.click_to_sign")})]})},QrCodeView=()=>{var Xr;const{theme:{theme:eo}}=useThemeContext(),{name:to}=eo,{qrcodeUri:ro,desktopUri:no,selectedWalletConnector:io}=useInternalDynamicContext(),{walletBook:oo}=useWalletBookContext();if(!io)return null;const ao=jsxRuntimeExports.jsx(WalletIcon,{walletKey:io.key,style:{height:pixelToRem(32),width:pixelToRem(32)}});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:ro,desktopUri:no,accentColor:to==="dark"?eo.colors.textPrimary:(Xr=getWalletPrimaryColor(oo,io.key))!==null&&Xr!==void 0?Xr:"",icon:ao,showCopyToClipboardButton:io.isWalletConnect,walletConnector:io})},PendingConnectView=()=>{const{selectedWalletConnector:Xr}=useInternalDynamicContext(),{t:eo}=useTranslation(),to=94,ro=jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr==null?void 0:Xr.key,style:{height:pixelToRem(to*iconRatio),width:pixelToRem(to*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"pending-connect__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:to,isSpinning:!0,className:"pending-connect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"pending-connect__copy-text",copykey:isMobile$1()?"dyn_pending_connection.mobile":"dyn_pending_connection.computer",children:isMobile$1()?eo("dyn_pending_connection.mobile"):eo("dyn_pending_connection.computer")})]})},SandboxMaximumThresholdReached=()=>{const{t:Xr}=useTranslation(),{goToInitialView:eo}=useViewContext(),to=()=>{eo()};return jsxRuntimeExports.jsxs("div",{className:"sandbox-threshold__main",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sandbox-threshold__title",children:Xr("dyn_sandbox_maximum_threshold.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"sandbox-threshold__description",children:Xr("dyn_sandbox_maximum_threshold.description")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:to,className:"sandbox-threshold__button",expanded:!0,buttonPadding:"large",children:Xr("dyn_sandbox_maximum_threshold.button")})]})},Toggle=Xr=>{var{icon:eo,variant:to="primary",className:ro}=Xr,no=__rest$7(Xr,["icon","variant","className"]);return jsxRuntimeExports.jsxs("label",{className:classNames("toggle",ro),children:[jsxRuntimeExports.jsx("input",Object.assign({type:"checkbox",className:"toggle--input"},no)),jsxRuntimeExports.jsx("div",{className:classNames("toggle--content",`toggle--content__variant-${to}`),children:jsxRuntimeExports.jsx("div",{className:"toggle--knob",children:eo})})]})},HardwareWalletToggle=({connectors:Xr,label:eo,copykey:to})=>{const ro=jsxRuntimeExports.jsx(Toggle,{defaultChecked:Xr.some(no=>no.isHardwareWalletEnabled),onChange:no=>{Xr.forEach(io=>{io.isHardwareWalletEnabled=no.target.checked})},"data-testid":"hardware-wallet-toggle",icon:jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgCheck,{})})});return jsxRuntimeExports.jsx(ListTile,{trailing:ro,children:jsxRuntimeExports.jsx("span",{copykey:to,children:eo})})},SelectHardwareWalletView=({wallet:Xr,onSelectWallet:eo})=>{const{t:to}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"select-hardware-wallet-view",children:jsxRuntimeExports.jsxs("div",{className:"select-hardware-wallet-view__container",children:[jsxRuntimeExports.jsx(Icon,{className:"select-hardware-wallet-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Xr.key})}),jsxRuntimeExports.jsx(Typography,{className:"select-hardware-wallet-view__text",as:"p",color:"secondary",variant:"body_normal",copykey:"dyn_select_hardware_wallet.description",children:to("dyn_select_hardware_wallet.description")}),isHardwareWalletConnector(Xr.walletConnector)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:[Xr.walletConnector],copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:to("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",onClick:()=>eo==null?void 0:eo(Xr),copykey:"dyn_select_hardware_wallet.button",dataTestId:"select-hardware-wallet-connect-button",children:to("dyn_select_hardware_wallet.button")})]})})},WalletGroupViewLayout=({icon:Xr,title:eo,titleCopyKey:to,children:ro})=>jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{className:"wallet-group-view-layout__icon",Icon:Xr,iconSize:96}),jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__body",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-group-view-layout__title",as:"p",color:"secondary",variant:"body_normal",copykey:to,children:eo}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:ro})]})]}),WalletGroupItem$1=({groupKey:Xr,wallet:eo,onClick:to})=>{const{recommendedWallets:ro}=useInternalDynamicContext(),{walletBook:no}=useWalletBookContext(),io=findWalletGroupOverride(no,Xr,eo.key),oo=findWalletBookWallet(no,eo.key),ao=(io==null?void 0:io.brand)||(oo==null?void 0:oo.brand),so=(io==null?void 0:io.name)||(oo==null?void 0:oo.name),co=ao?jsxRuntimeExports.jsx(BrandIcon,{brand:ao,walletKey:eo.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}):null,lo=getWalletListItemLabel({recommendedWallets:ro,wallet:eo}),uo=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:lo&&jsxRuntimeExports.jsx(Badge,{dot:!lo.isRecommended,variant:lo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:lo.label})})});return jsxRuntimeExports.jsx(ListTile,{onClick:to,leading:co,trailing:uo,children:so})},SelectWalletInWalletGroupView=()=>{const{selectedWalletGroup:Xr}=useWalletGroupContext(),{walletBook:eo}=useWalletBookContext(),{handleWalletItemClick:to}=useWalletItemActions(),{t:ro}=useTranslation();if(!Xr)throw new Error("Could not access WalletGroup view without selected group");const no=getWalletGroup(eo,Xr==null?void 0:Xr.key);return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:no.key}),title:ro("dyn_select_wallet.description",{walletName:no.name}),titleCopyKey:"dyn_select_wallet.description",children:Xr.groupedWallets.map((io,oo)=>jsxRuntimeExports.jsx(WalletGroupItem$1,{groupKey:Xr.key,wallet:io,onClick:()=>to(io)},`${io.key}_${oo}`))})};var _path$3,_excluded$3=["title","titleId"];function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$3(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignInWithPhone=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$3(eo,_excluded$3);return reactExports.createElement("svg",_extends$5({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$3||(_path$3=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm-7.91-50h14.892a4.092 4.092 0 0 1 4.09 4.09v27.82a4.092 4.092 0 0 1-4.09 4.09H24.09A4.092 4.092 0 0 1 20 45.91V18.09A4.092 4.092 0 0 1 24.09 14Zm4.992 31.91a2.451 2.451 0 0 0 2.454 2.454 2.451 2.451 0 0 0 2.455-2.455 2.451 2.451 0 0 0-2.455-2.454 2.451 2.451 0 0 0-2.454 2.454Zm-5.81-4.092H39.8V18.91H23.273v22.91Z",fill:"#4779FF"})))};const PhoneIcon=Xr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithPhone,Object.assign({},Xr,{"data-testid":"sign-in-with-sms-icon"}))}),useSmsVerification=Xr=>{const{verificationUUID:eo,displayedDestination:to,retryData:ro}=useVerification(),{environmentId:no,user:io,userWithMissingInfo:oo}=useInternalDynamicContext(),[ao,so]=reactExports.useState(),{verifyOtp:co}=useOtpVerificationRequest(),{generateSessionKey:lo,shouldRegisterSessionKeysOnSignin:uo}=useEmbeddedWalletSessionKeys(no),{initAuth:ho,completeAuth:go,cancelAuth:bo}=useUserAuth({authMethod:"sms"}),wo=reactExports.useRef(!1);useOnUnmount(()=>{const jo=ro??{dialCode:"",iso2:"",phone:""};ro||logger$8.warn("WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined"),dynamicEvents.emit("smsVerificationResult",wo.current,jo),wo.current||dynamicEvents.emit("authFailure",{option:jo,phone:jo,type:"sms"},"user-cancelled")});const Eo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(so(void 0),!eo||!ro){yield bo();return}retrySmsVerification({environmentId:no,isoCountryCode:ro.iso2,phoneCountryCode:ro.dialCode,phoneNumber:de$4({dialCode:ro.dialCode,phone:ro.phone}),verificationUUID:eo})}),$o=reactExports.useCallback(jo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!eo||!io&&!oo){yield bo();return}yield go({onValidUpdatedJwt:()=>wo.current=!0,updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return co(jo,"sms",eo)})})}),[bo,go,io,oo,eo,co]),Co=reactExports.useCallback(jo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!eo){yield bo();return}yield ho({onError:Bo=>so(Bo),onVerifySuccess:()=>{wo.current=!0},options:{phone:ro},showSuccessMessage:!0,verifyFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){let Bo;return uo()&&(Bo=(yield lo()).publicKey),signInWithSmsVerification({environmentId:no,sessionPublicKey:Bo,verificationToken:jo,verificationUUID:eo})})})}),[eo,ho,ro,bo,no]),{isLoading:Ro,mutate:Oo}=useMutation(Xr==="login"?Co:$o,{onFailure:jo=>{so(jo)}});return{error:ao,formattedPhone:to??"",isLoading:Ro,isValid:wo.current,onSubmit:Oo,retryOneTimePassword:Eo,setError:so}},SmsVerification=()=>{const{view:Xr}=useViewContext(),{handleLogOut:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),ro=Xr.type==="login-with-sms-verification",{error:no,formattedPhone:io,isLoading:oo,isValid:ao,onSubmit:so,retryOneTimePassword:co,setError:lo}=useSmsVerification(ro?"login":"verify-only"),uo=ro?void 0:jsxRuntimeExports.jsx(TextButton,{className:"sms-verification__log-out",onClick:eo,copykey:"dyn_otp_verification.log_out_button",children:to("dyn_otp_verification.log_out_button")});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:PhoneIcon,displayedDestination:io,error:no,hideHeader:!0,isLoading:oo,onPinComplete:so,isValid:ao,retryHandler:co,onPinChange:()=>lo(void 0),appendToEnd:uo})},SocialRedirectView=()=>{const{socialProvider:Xr,signInProvider:eo}=useSocialRedirectContext(),to=useFindSocialIcon(),{t:ro}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:classNames("social-redirect-view__container"),children:[Xr&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:to(Xr),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("social-redirect-view__title"),copykey:"dyn_social_redirect.logging_in",children:ro("dyn_social_redirect.logging_in")}),eo!==SignInProviderEnum.MagicLink&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"powered-by-dynamic"})]})},SocialWrongAccountView=()=>{const[Xr,eo]=reactExports.useState(!1),{socialWalletConnector:to,socialAccount:ro}=useSocialRedirectContext(),{t:no}=useTranslation(),io=useFindSocialIcon();return!ro||!to?null:jsxRuntimeExports.jsxs("div",{className:classNames("social-wrong-account-view__container"),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:io(ro.oauthProvider),isSpinning:Xr,iconSize:64}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("social-wrong-account-view__title"),copykey:"dyn_login.wrong_social_account.title",children:no("dyn_login.wrong_social_account.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.subtitle",children:no("dyn_login.wrong_social_account.subtitle")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",className:classNames("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.retry_title",children:[no("dyn_login.wrong_social_account.retry_title"),jsxRuntimeExports.jsx("b",{children:ro.oauthUsername})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"social-wrong-account-view__button",buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},disabled:Xr,onClick:()=>{eo(!0),to.connect(ro.oauthProvider)},copykey:"dyn_login.wrong_social_account.retry_button",children:no("dyn_login.wrong_social_account.retry_button")})]})},WalletCannotBeTransferredView=()=>{const{goToInitialView:Xr}=useViewContext(),{selectedWalletConnector:eo}=useInternalDynamicContext(),{t:to}=useTranslation(),{data:ro}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const no=yield eo==null?void 0:eo.getConnectedAccounts();return shortenWalletAddress(no==null?void 0:no[0])}),{deps:[eo]});return jsxRuntimeExports.jsxs("div",{className:"wallet-cannot-be-transferred-view__container",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__title",as:"h6",variant:"title",color:"primary",weight:"medium",copykey:"dyn_wallet_link.cannot_link.title",children:to("dyn_wallet_link.cannot_link.title")}),jsxRuntimeExports.jsx("div",{className:"wallet-cannot-be-transferred-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo==null?void 0:eo.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__shorten-wallet-address",variant:"body_normal",weight:"regular",color:"primary",children:ro}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.cannot_link.description",children:to("dyn_wallet_link.cannot_link.description")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-cannot-be-transferred-view__transfer-alt-wallet-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:Xr,dataTestId:"wallet-cannot-be-transferred-view-transfer-alt-wallet",copykey:"dyn_wallet_link.cannot_link.link_other_button",children:to("dyn_wallet_link.cannot_link.link_other_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-cannot-be-transferred-view-cancel",buttonPadding:"small",buttonClassName:"wallet-cannot-be-transferred-view__cancel",onClick:Xr,copykey:"dyn_wallet_link.cannot_link.cancel_button",children:to("dyn_wallet_link.cannot_link.cancel_button")})]})},WalletGroupItem=({wallet:Xr,onClick:eo})=>{const[to]=Xr.walletConnector.supportedChains,{walletBook:ro}=useWalletBookContext(),no=getChainInfoWithOverrides(to),io=Xr.group?findWalletGroupOverride(ro,Xr.group,Xr.key):void 0,oo=getWalletListItemLabel({wallet:Xr}),ao=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:oo&&jsxRuntimeExports.jsx(Badge,{dot:!oo.isRecommended,variant:oo.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:oo.label})})}),so=reactExports.useMemo(()=>{const lo={height:pixelToRem(28),width:pixelToRem(28)};if(io!=null&&io.brand)return jsxRuntimeExports.jsx(BrandIcon,{brand:io.brand,walletKey:Xr.key,style:lo});const uo=getChainIcon(to);return jsxRuntimeExports.jsx(uo,{style:lo})},[to,Xr.key,io]),co=(io==null?void 0:io.name)||(no==null?void 0:no.displayName)||Xr.name;return jsxRuntimeExports.jsx(ListTile,{className:"chain-card",onClick:eo,leading:so,trailing:ao,children:co},Xr.key)},WalletGroupView=()=>{const{selectedWalletGroup:Xr}=useWalletGroupContext(),{walletBook:eo}=useWalletBookContext(),{handleWalletItemClick:to}=useWalletItemActions(),{t:ro}=useTranslation();if(!Xr)throw new Error("Could not access WalletGroup view without selected group");const no=getWalletGroup(eo,Xr==null?void 0:Xr.key),io=Xr.groupedWallets.map(({walletConnector:oo})=>oo).filter(oo=>isHardwareWalletConnector(oo)&&oo.canConnectWithHardwareWallet());return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:no.key}),title:ro("dyn_select_chain.description"),titleCopyKey:"dyn_select_chain.description",children:jsxRuntimeExports.jsxs("div",{className:"wallet-group__list",children:[!!io.length&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:io,copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:ro("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:Xr.groupedWallets.map((oo,ao)=>jsxRuntimeExports.jsx(WalletGroupItem,{wallet:oo,onClick:()=>to(oo)},`${oo.key}_${ao}`))})]})})},iconSize=64,WalletLockedView=()=>{const{handleLogOut:Xr,primaryWallet:eo,setShowAuthFlow:to,appName:ro}=useInternalDynamicContext(),{t:no}=useTranslation();if(!eo)return null;const io=()=>__awaiter$j(void 0,void 0,void 0,function*(){try{yield eo.connector.connect(),to(!1)}catch{logger$8.info("could not connect wallet")}}),oo=jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.connector.key,style:{height:pixelToRem(iconSize*iconRatio),width:pixelToRem(iconSize*iconRatio)}});return jsxRuntimeExports.jsxs("div",{"data-testid":"wallet-locked-view",children:[jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,variant:"success",className:"wallet-locked-view__error-container",copykey:"dyn_wallet_locked.connect_continue",children:no("dyn_wallet_locked.connect_continue")}),jsxRuntimeExports.jsxs("div",{className:"wallet-locked-view__content",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:oo,iconSize,className:"wallet-locked-view__icon",isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",weight:"medium",className:"wallet-locked-view__title",copykey:"dyn_wallet_locked.title",children:no("dyn_wallet_locked.title")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_locked.subtitle",children:[no("dyn_wallet_locked.subtitle"),ro,"."]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:()=>io(),buttonClassName:"wallet-locked-view__button",copykey:"dyn_wallet_locked.connect",children:no("dyn_wallet_locked.connect")}),jsxRuntimeExports.jsx(Divider,{text:"Or"}),jsxRuntimeExports.jsx(TextButton,{className:"wallet-locked-view__log-out",onClick:Xr,copykey:"dyn_wallet_locked.logout",children:no("dyn_wallet_locked.logout")})]})]})},WalletRedirectView=()=>{const{t:Xr}=useTranslation(),{selectedWalletConnector:eo}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:classNames("wallet-redirect-view__container"),children:[eo&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.key}),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames("wallet-redirect-view__title"),copykey:"dyn_wallet_redirect.loading",children:Xr("dyn_wallet_redirect.loading")}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"powered-by-dynamic"})]})},WalletSignSpinnerView=()=>{const{goToInitialView:Xr}=useViewContext(),{t:eo}=useTranslation(),{setMultiWalletWidgetState:to,setSelectedWalletConnectorKey:ro,selectedWalletConnector:no}=useInternalDynamicContext();if(!no)return null;const{key:io}=no,oo=96,ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){Xr(),to("idle"),ro(null),yield no==null?void 0:no.endSession()}),so=jsxRuntimeExports.jsx(WalletIcon,{walletKey:io,style:{height:pixelToRem(oo*iconRatio),width:pixelToRem(oo*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"wallet-sign-spinner__container","data-testid":"wallet-sign-spinner-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:so,iconSize:oo,isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames("wallet-sign-spinner__copy"),copykey:"dyn_wallet_transfer.sign.spinner.confirm_transfer",children:eo("dyn_wallet_transfer.sign.spinner.confirm_transfer")}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",buttonVariant:"primary",buttonClassName:"wallet-sign-spinner__button",onClick:()=>ao(),typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_wallet_transfer.sign.spinner.cancel",children:eo("dyn_wallet_transfer.sign.spinner.cancel")})]})},useTransferWallet=()=>{const{displaySiweStatement:Xr,environmentId:eo,user:to,primaryWallet:ro,setPrimaryWalletId:no}=useInternalDynamicContext(),{addedWalletsIds:io}=useInternalUserWallets(),oo=reactExports.useCallback((ao,so)=>{const co=ao.key;if(so.lastVerifiedCredentialId){if(!ro){no(so.lastVerifiedCredentialId);return}const lo=ro.connector.key;co===lo&&no(so.lastVerifiedCredentialId),ro.connector.connectedChain==="FLOW"&&ao.connectedChain==="FLOW"&&no(so.lastVerifiedCredentialId)}},[ro,no]);return reactExports.useCallback(ao=>__awaiter$j(void 0,void 0,void 0,function*(){if(!to)throw new DynamicError(USER_NOT_LOGGED_IN);const{overrideSiweStatement:so,walletConnector:co}=ao,lo="nonce"in ao?Object.assign(Object.assign({},ao),{displaySiweStatement:Xr,environmentId:eo,siweStatement:so,walletProvider:getWalletProvider(co)}):Object.assign(Object.assign({},ao),{displaySiweStatement:Xr,environmentId:eo,nonce:"",siweStatement:ao.overrideSiweStatement,walletProvider:getWalletProvider(co)}),uo=yield getVerifyArgs(lo),ho=yield transferWallet(eo,uo);if(!ho)throw new DynamicError("Error transferring wallet.");oo(co,ho);const go=ho.lastVerifiedCredentialId;go&&io.current.push(go)}),[io,Xr,eo,oo,to])},WalletUsedView=()=>{const[Xr,eo]=reactExports.useState(!1),{t:to}=useTranslation(),{setErrorMessage:ro}=useErrorContext(),{loading:no,setLoading:io}=useLoadingContext(),{setView:oo,goToInitialView:ao}=useViewContext(),{setShowAuthFlow:so,appName:co,siweStatement:lo,setMultiWalletWidgetState:uo,connectWallet:ho,selectedWalletConnector:go,isSingleWalletAccount:bo,consumeNonce:wo,handleLogOut:Eo}=useInternalDynamicContext(),{data:$o}=usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const jo=yield go==null?void 0:go.getConnectedAccounts();return jo==null?void 0:jo[0]}),{deps:[go]}),Co=shortenWalletAddress($o),Ro=useTransferWallet(),Oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!go)return;const jo=wo();if(!jo){ao(),ro("missing-nonce");return}uo("awaiting_signature",void 0,"transferring_wallet"),io(!0),oo("wallet-sign");const Bo=getSiweStatement({appName:co,siweStatement:lo});try{const Mo=yield ho(go);if(!(Mo!=null&&Mo.address))return;go.key==="phantom"&&isMobile$1()&&StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:Xr,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_transfer"}),yield Ro({nonce:jo,overrideSiweStatement:Bo,publicWalletAddress:Mo.address,skipEmptyAccountCheck:Xr,walletConnector:go}),so(!1)}catch(Mo){logger$8.error(Mo),so(!1,{emitCancelAuth:!0})}finally{io(!1),uo("idle")}});return jsxRuntimeExports.jsxs("div",{className:"wallet-used-view__container",children:[jsxRuntimeExports.jsx("div",{className:"wallet-used-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:go==null?void 0:go.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__shorten-wallet-address",variant:"body_normal",weight:"medium",color:"primary",children:Co}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.existent_account.warning",children:to("dyn_wallet_link.existent_account.warning")}),bo&&jsxRuntimeExports.jsxs("label",{htmlFor:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-label",children:[jsxRuntimeExports.jsx(Checkbox,{id:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-container",defaultChecked:Xr,onChange:()=>eo(!Xr),ariaLabel:"skip empty account check"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_wallet_link.existent_account.acceptance",children:to("dyn_wallet_link.existent_account.acceptance")})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-used-view__accept-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:()=>Oo(),disabled:!Xr&&bo||no,dataTestId:"wallet-used-view-transfer-wallet",copykey:"dyn_wallet_link.confirm_button",children:to("dyn_wallet_link.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-used-view-log-out",buttonPadding:"small",buttonClassName:"wallet-used-view__logout",onClick:Eo,copykey:"dyn_wallet_link.log_out_button",children:to("dyn_wallet_link.log_out_button")})]})};var _path$2,_excluded$2=["title","titleId"];function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$2(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgDomain=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$2(eo,_excluded$2);return reactExports.createElement("svg",_extends$4({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path$2||(_path$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-4.928-29.305h9.717c-.207 4.908-1.087 9.168-2.3 12.206-.7 1.756-1.433 2.9-2.036 3.54-.245.26-.42.387-.523.448-.102-.06-.277-.189-.522-.449-.603-.638-1.336-1.783-2.037-3.539-1.213-3.038-2.092-7.298-2.3-12.206Zm2.3-16.655c-1.242 3.108-2.134 7.497-2.314 12.55h9.744c-.18-5.053-1.071-9.442-2.313-12.55-.7-1.756-1.433-2.9-2.036-3.54-.245-.26-.42-.388-.523-.449-.102.061-.277.19-.522.45-.603.638-1.336 1.783-2.037 3.539ZM14.5 30.59h8.951c.216-6.53 1.541-12.27 3.503-16.036C20.23 16.789 15.22 23.03 14.5 30.59Zm.036 4.105h8.928c.25 6.387 1.563 11.993 3.49 15.692-6.622-2.201-11.582-8.288-12.418-15.692Zm35.789 0h-8.928c-.25 6.387-1.563 11.993-3.49 15.692 6.621-2.201 11.581-8.288 12.418-15.692Zm.125-2.224v.066-.133.066Zm-9.04-1.88h8.95c-.719-7.56-5.73-13.802-12.454-16.037 1.962 3.766 3.288 9.507 3.503 16.036Zm-9.09 20.35c0-.001.008-.004.023-.007-.015.006-.023.008-.023.007Zm.198-.007a.072.072 0 0 1 .023.007s-.008-.001-.023-.007ZM32.541 14s-.008.004-.023.007c.015-.006.023-.008.023-.007Zm-.198.007A.068.068 0 0 1 32.32 14s.008.001.023.007Z",fill:"#4779FF"})))};const PasskeyNewDomainDetectedView=()=>{const{t:Xr}=useTranslation(),{projectSettings:eo}=useInternalDynamicContext(),to=reactExports.useMemo(()=>{var ro;const no=getEnabledEmbeddedWalletsAuthenticators((ro=eo==null?void 0:eo.sdk.embeddedWallets)===null||ro===void 0?void 0:ro.supportedSecurityMethods);return Object.keys(no).filter(io=>io!=="email")},[eo==null?void 0:eo.sdk.embeddedWallets]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_new_domain_detected.title",children:Xr("dyn_passkey_new_domain_detected.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-new-domain-detected",children:[jsxRuntimeExports.jsx(SvgDomain,{className:"passkey-new-domain-detected__header"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:Xr("dyn_passkey_new_domain_detected.description")}),jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{supportedAuthenticators:to}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},viewToComponentMap={"access-blocked":AccessBlockedView,"account-exists":AccountExistsView,"bridge-next-wallet-connection":BridgeNextWalletConnectionView,"bridge-summary":BridgeSummaryView,"bridge-welcome":BridgeWelcomeView,captcha:CaptchaVerifyUser,"chainalysis-blocked-wallet":NoAccess,"collect-user-data":CollectUserDataView,"collect-user-data-login-no-wallet":CollectUserDataViewNoWallet,"create-password-view":CreatePasswordView,"email-wallet-otp-verification-view":EmailWalletOTPVerificationView,"embedded-reveal-account-view":EmbeddedRevealView,"embedded-reveal-view":EmbeddedRevealView,"embedded-wallet-auth-choice":EmbeddedAuthChoice,"farcaster-connect-view":FarcasterConnectView,"gate-blocked-wallet":NoAccess,"global-wallet-confirm":GlobalWalletConfirmView,"global-wallet-info":GlobalWalletInfoView,"global-wallet-malicious":GlobalWalletMaliciousView,"login-with-email-or-wallet":LoginView,"login-with-email-or-wallet-full-wallet-list":WalletList,"login-with-email-verification":EmailVerification,"login-with-sms-verification":SmsVerification,"login-with-wallet-only":LoginView,"merge-user-accounts":MergeUserAccountsView,"merge-user-accounts-conflicts":MergeUserAccountsConflictsView,"merge-user-accounts-with-same-email":MergeUserAccountsWithSameEmailView,"mfa-choose-device":MfaChooseDeviceView,"mfa-display-backup-codes":MfaDisplayBackupCodesView,"mfa-recovery":MfaRecoveryView,"mfa-secure-device":MfaSecureDeviceView,"mfa-secure-device-help":MfaSecureDeviceHelper,"mfa-verification":MfaVerificationView,"mobile-wallet-redirect-view":MobileWalletRedirectView,"multi-wallet-wallet-list":WalletList,"network-not-supported":NetworkNotSupported,"network-not-supported-manual":NetworkNotSupportedSwitchManual,"no-access":NoAccess,"no-qr-not-installed":NoQrNotInstalledView,"passkey-intro":PasskeyIntroView,"passkey-new-domain-detected":PasskeyNewDomainDetectedView,"passkey-recovery-add-email":AddRecoveryEmail,"passkey-recovery-bundle":PasskeyBundleRecovery,"passkey-recovery-complete":PasskeyCompleteRecovery,"passkey-recovery-start":PasskeyInitRecovery,"pending-connect":PendingConnectView,"pending-signature":PendingSignatureView,"pending-signature-without-back-button":PendingSignatureView,"qr-code":QrCodeView,"rename-passkey":RenamePasskeyView,"sandbox-maximum-threshold-reached":SandboxMaximumThresholdReached,"select-hardware-wallet":SelectHardwareWalletView,"select-wallet-in-wallet-group":SelectWalletInWalletGroupView,"social-redirect-view":SocialRedirectView,"social-wrong-account":SocialWrongAccountView,"verify-email":EmailVerification,"verify-sms":SmsVerification,"wait-for-email-confirmation-view":EmailConfirmationWaitingView,"wallet-cannot-be-transferred":WalletCannotBeTransferredView,"wallet-claim-intro":CoinbaseMPCClaimIntro,"wallet-connect-mobile-wallets-list":()=>jsxRuntimeExports.jsx(WalletList,{isWalletConnectList:!0}),"wallet-group":WalletGroupView,"wallet-list":WalletList,"wallet-locked-view":WalletLockedView,"wallet-redirect-view":WalletRedirectView,"wallet-sign":WalletSignSpinnerView,"wallet-used":WalletUsedView},RenderView=()=>{const{view:Xr}=useViewContext(),eo=viewToComponentMap[Xr.type];return jsxRuntimeExports.jsx(eo,Object.assign({},Xr.props||{}))};function styleInject(Xr,eo){eo===void 0&&(eo={});var to=eo.insertAt;if(!(typeof document>"u")){var ro=document.head||document.getElementsByTagName("head")[0],no=document.createElement("style");no.type="text/css",to==="top"&&ro.firstChild?ro.insertBefore(no,ro.firstChild):ro.appendChild(no),no.styleSheet?no.styleSheet.cssText=Xr:no.appendChild(document.createTextNode(Xr))}}var css_248z='@layer dynamic-sdk-styles{#argent-mobile-modal-overlay,iframe[src*="wallet-dev.blocto.app"],iframe[src*="wallet-staging.blocto.app"],iframe[src*="wallet-testnet.blocto.app"],iframe[src*="wallet.blocto.app"]{z-index:2147483647!important}iframe[id*=dyn-passkey-recovery-element-id],iframe[id*=dyn-secure-enclave-element-id]{display:none!important}#pera-wallet-connect-modal-wrapper{position:relative;z-index:2147483647!important}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff) format("woff")}@layer light-theme-default{:root{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme-brand=bold],:root[data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme-brand=subtle],:root[data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}@media (prefers-color-scheme:light){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}:root [data-dynamic-theme=light]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=light][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=light][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}@layer dark-theme-default{@media (prefers-color-scheme:dark){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}:root [data-dynamic-theme=dark]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}.dynamic-shadow-dom{position:relative}#dynamic-tooltips{left:0;position:absolute;top:0}@supports (overflow:clip){.dynamic-no-scroll{overflow:clip}}@supports not (overflow:clip){.dynamic-no-scroll{overflow:hidden}}}';styleInject(css_248z);const useVerifyOnAwaitingSignature=()=>{const{awaitingSignatureState:Xr,multiWalletWidgetState:eo,setMultiWalletWidgetState:to,legacyIsVerifying:ro,setLegacyIsVerifying:no,selectedWalletConnector:io}=useInternalDynamicContext(),oo=useConnectAndSign(),ao=reactExports.useRef(!1),so=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(logger$8.debug("runConnectAndSign",{selectedWalletConnector:io}),!!io){ao.current=!0,no(!0);try{yield oo({walletConnector:io})}catch(co){logger$8.error(co)}to("idle"),no(!1),ao.current=!1}}),[io==null?void 0:io.key,no,to,oo]);reactExports.useEffect(()=>{!ro&&!ao.current&&eo==="awaiting_signature"&&io&&Xr==="linking_new_wallet"&&!requiresTwoStepAuthentication(io)&&so()},[so,Xr,ro,eo,io==null?void 0:io.key,no,to]),useInternalDynamicEvents("triggerConnectAndSign",so)},viewsToDisableCloseOnOverlayClick=["email-wallet-otp-verification-view","social-redirect-view","passkey-intro"],Main=()=>{const{selectedWalletConnector:Xr,linkedWallets:eo,projectSettings:to,setShowAuthFlow:ro,showAuthFlow:no,walletConnectorOptions:io,clearStatesOnBackClick:oo,user:ao,disconnectWallet:so,authMode:co,connectedWallets:lo,handleLogOut:uo}=useInternalDynamicContext(),{view:ho,goToInitialView:go}=useViewContext(),{setDeniedAddress:bo,setDeniedOauthProvider:wo}=useAccessDeniedContext(),{setExistentAccountData:Eo}=useAccountExistsContext(),{setSocialProvider:$o}=useSocialRedirectContext();usePreventPageScroll(no);const Co=useUserWallets(),Ro=()=>__awaiter$j(void 0,void 0,void 0,function*(){var yo;if(!viewsToDisableCloseOnOverlayClick.includes(ho.type)){if(!((yo=ho.events)===null||yo===void 0)&&yo.onClose){ho.events.onClose();return}(ho.type==="network-not-supported"||ho.type==="network-not-supported-manual")&&Co.length===1&&(yield uo()),ho.type==="farcaster-connect-view"&&($o(void 0),dynamicEvents.emit("farcasterConnectCancelled")),ro(!1,{emitCancelAuth:!0}),bo(""),wo(void 0),Eo(void 0),oo()}}),Oo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const yo=["network-not-supported","network-not-supported-manual"];if(!isConnectOnly(ao,co)||!yo.includes(ho.type)||!Xr)return;const vo=lo.find(_o=>_o.connector.key===Xr.key);vo&&(isSupportedNetwork({network:yield vo.connector.getNetwork(),walletConnector:vo.connector})||so(vo.id))}),[Xr,co,lo,so,ao,ho]),jo=reactExports.useCallback(()=>{go()},[go]);useVerifyOnAwaitingSignature();const{handleAlreadyConnectedWallet:Bo,handleCustodialWalletClick:Mo,handleInstalledExtensionClick:Fo,handleMobileWalletClick:Wo,handleUninstalledClick:Jo}=useWalletItemActions(),Po=yo=>__awaiter$j(void 0,void 0,void 0,function*(){ro(!0),isSelectedWalletAlreadyConnected(eo,yo,ao)?Bo(yo):yo.canConnectViaCustodialService?Mo(yo):isMobile$1()?Wo(yo):yo.isInstalledOnBrowser()?Fo(yo):Jo(yo)});reactExports.useEffect(()=>{const yo=StorageService.getItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY);if(io!=null&&io.length&&yo){const vo=io.find(_o=>_o.key===yo);vo!=null&&vo.walletConnector&&Po(vo.walletConnector),StorageService.removeItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY)}},[io]);const fo=no&&!!to;return jsxRuntimeExports.jsx(FooterAnimationContextProvider,{children:jsxRuntimeExports.jsx(Portal,{zIndex:authModalZIndex,isShown:fo,handleClose:Ro,withBackdrop:!0,transitionEvents:{onExiting:Oo,onUnmount:jo},children:jsxRuntimeExports.jsx(PopperProvider,{children:jsxRuntimeExports.jsx(DynamicAuthModal,{transitionProps:{isShown:fo},onClose:Ro,projectSettings:to,children:jsxRuntimeExports.jsx(RenderView,{})})})})})},DynamicAuthFlow=()=>jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(Main,{})}),lastAuthenticatedAccount=Xr=>Xr.verifiedCredentials.find(eo=>eo.id===Xr.lastVerifiedCredentialId),useGlobalLoading=({authMode:Xr,connectedInfo:eo,connectedWallets:to,projectSettings:ro,primaryWalletId:no,primaryWallet:io,user:oo,isLoadingUserFromCookie:ao,walletBook:so,enableInstrumentation:co,appName:lo,environmentId:uo})=>{var ho,go;const bo=reactExports.useRef(!1),wo=reactExports.useRef(new Date().getTime()),{sessionValidation:Eo}=useLoadingAndLifecycle(),$o=()=>{if(!bo.current&&(bo.current=!0,logger$8.debug("[useGlobalLoading] SDK finished loading",{authMode:Xr,enableInstrumentation:co,primaryWallet:io,user:oo}),co)){const Wo=new Date().getTime()-wo.current;logger$8.instrument(`SDK loaded in (ms) ${Wo}`,{appName:lo,environmentId:uo,key:"sdkHasLoaded",primaryWalletId:no,time:Wo,userId:oo==null?void 0:oo.userId})}};if(bo.current)return!0;const Co=!Object.keys((ho=so==null?void 0:so.wallets)!==null&&ho!==void 0?ho:{}).length,Ro=!ro,Oo=ao,Bo=!!((no||oo&&((go=lastAuthenticatedAccount(oo))===null||go===void 0?void 0:go.format)==="blockchain")&&!io),Mo=Xr==="connect-only"&&eo&&to.length===0,Fo=!Eo;return logger$8.logVerboseTroubleshootingMessage("[useGlobalLoading] SDK loading",{isConnectOnlyWalletsLoading:Mo,isPrimaryWalletLoading:Bo,isProjectSettingsLoading:Ro,isUserLoading:Oo,isValidatingSession:Fo,isWalletBookLoading:Co}),!Co&&!Ro&&!Oo&&!Bo&&!Mo&&!Fo&&$o(),bo.current},usePrefetch=({as:Xr,href:eo,id:to,type:ro})=>{if(isSSR()||document.head.querySelector(`#${to}`))return;const io=document.createElement("link");io.setAttribute("id",to),io.setAttribute("rel","prefetch"),io.setAttribute("href",eo),io.setAttribute("as",Xr),io.setAttribute("type",ro),document.head.insertAdjacentElement("beforeend",io)},fetchNonce=Xr=>__awaiter$j(void 0,void 0,void 0,function*(){try{return(yield sdkApi$1().getNonce({environmentId:Xr})).nonce}catch{return}}),validateLocalStorageExpiry=Xr=>!(!Xr||new Date().getTime()>Xr.expiry),useFetchNonce=(Xr,eo=2)=>{const[to,ro,no]=useLocalStorage(NONCE_STORAGE_KEY,void 0,validateLocalStorageExpiry),io=(to==null?void 0:to.value)!==""&&(to==null?void 0:to.value)!==void 0;to&&to.environmentId&&to.environmentId!==Xr&&no(),usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){return fetchNonce(Xr).then(ao=>{if(!ao)throw new DynamicError("Nonce is not defined");const so=new Date().getTime()+6e4*60*24;return{environmentId:Xr,expiry:so,value:ao}})}),{deps:[Xr,io],enabled:!io,initialData:void 0,onResolve:ro,retries:eo});const oo=reactExports.useCallback(()=>{const ao=to==null?void 0:to.value;return no(),ao},[no,to==null?void 0:to.value]);return{consumeNonce:()=>oo()}},useSetWalletConnectorVerifiedCredentials=(Xr,eo)=>{!Xr||!(eo!=null&&eo.length)||eo.forEach(to=>{to.walletConnector.setVerifiedCredentials(Xr.verifiedCredentials)})},handleStoreAndEnvironmentMismatch=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,logout:to}){const ro=getEnvironmentId();return!ro||eo===ro?!0:(yield to("store and environment are out of sync",{currentEnvId:eo,storedEnvId:ro}),setEnvironmentId(eo),!1)}),handleUserDataOutOfSync=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,logout:to}){const ro=isCookieEnabled$1(),no=getAuthToken(),io=getUser();if(no||!io)return!0;if(io&&!no&&ro){try{yield getAuthenticatedUser({environmentId:eo})}catch(oo){if(oo instanceof CookieInvalidError)return yield to("user auth cookie invalid",{authToken:no,user:io}),!1}return!0}return yield to("user data out of sync",{authToken:no,user:io}),!1}),useValidateSession=({environmentId:Xr,handleLogOut:eo})=>{const to=reactExports.useCallback((no,io)=>__awaiter$j(void 0,void 0,void 0,function*(){return logger$8.debug(`Logging out due to invalid session - Reason: ${no}`,Object.assign({},io)),eo()}),[eo]),ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const no={environmentId:Xr,logout:to};yield Promise.all([handleStoreAndEnvironmentMismatch(no),handleUserDataOutOfSync(no)]),setLoadingAndLifecycle({sessionValidation:!0})}),[Xr,to]);useEffectOnce(()=>{ro()}),useInternalDynamicEvents("triggerSessionValidation",ro)},serializeWalletConnectors=Xr=>{try{return Xr?Xr.map(eo=>eo.name):void 0}catch(eo){logger$8.error("error serializing walletConnectors",eo);return}};class ConnectorSetupError extends DynamicError{constructor(eo,to){super(`${eo} is enabled but ${to} is not in your walletConnectors list. See https://docs.dynamic.xyz/react-sdk/wallet-connectors for more information.`)}}const magicEmailOtpWalletConnectorKey="magicemailotp",magicSocialWalletConnectorKey="magicsocial",verifyMagicIsSetup=(Xr,eo)=>{var to;const ro=isProviderEnabled((to=Xr.providers)!==null&&to!==void 0?to:[],ProviderEnum.MagicLink),no=eo.some(({key:io})=>[magicEmailOtpWalletConnectorKey,magicSocialWalletConnectorKey].includes(io));if(ro&&!no)throw new ConnectorSetupError("Magic","MagicWalletConnectors")},zeroDevWalletConnectorKey="zerodev",verifyZeroDevIsSetup=(Xr,eo)=>{var to;const ro=isProviderEnabled((to=Xr.providers)!==null&&to!==void 0?to:[],ProviderEnum.Zerodev),no=eo.some(({key:io})=>io===zeroDevWalletConnectorKey);if(ro&&!no)throw new ConnectorSetupError("ZeroDev","ZeroDevSmartWalletConnectors")},verifyRequiredConnectorsAreSetup=(Xr,eo)=>{verifyMagicIsSetup(Xr,eo),verifyZeroDevIsSetup(Xr,eo)},useCreateWalletConnectorOptions=({projectSettings:Xr,appLogoUrl:eo,appName:to,coinbaseWalletPreference:ro,deepLinkPreference:no,flowNetwork:io,mobileExperience:oo,networkConfigurations:ao,walletBook:so,walletUiUtils:co,walletConnectorsProp:lo,walletConnectPreferredChains:uo,walletConnectorExtensions:ho})=>{const go=reactExports.useMemo(()=>{var Eo;return(Eo=serializeWalletConnectors(lo))===null||Eo===void 0?void 0:Eo.join(",")},[lo]),bo=reactExports.useMemo(()=>Object.keys(so??{}).length,[so]),wo=reactExports.useMemo(()=>!Xr||!Object.keys(so??{}).length||!ao?[]:getWallets$1({getSupportedWalletOpts:{appLogoUrl:eo,appName:to,coinbaseWalletPreference:ro,deepLinkPreference:no,flowNetwork:io,mobileExperience:oo,networkConfigurations:ao,settings:Xr,skipMemo:!0,walletBook:so,walletConnectPreferredChains:uo,walletConnectorsProp:lo??[],walletUiUtils:co},walletConnectorExtensions:ho}),[eo,to,Xr,go,uo,io,bo,ao]);return reactExports.useEffect(()=>{!Xr||wo.length===0||(verifyRequiredConnectorsAreSetup(Xr,wo.map(({walletConnector:Eo})=>Eo)),setWalletConnectorOptions(wo))},[wo,Xr]),{walletConnectorOptions:wo}},shouldManuallyReconnectOnRefresh=Xr=>Xr.connectedChain==="STARK"||Xr.connectedChain==="FLOW",convertLegacyPhantomLedgerConnector=Xr=>Object.assign(Object.assign({},Xr),{walletName:"phantom",walletProperties:{hardwareWallet:HardwareWalletEnum.Ledger}}),createLinkedWalletsFromWalletOptions=({user:Xr,walletConnectorOptions:eo,primaryWalletId:to,separateSmartWalletAndSigner:ro})=>!eo||!Xr?[]:Xr.verifiedCredentials.map(convertLegacyPhantomLedger).map(no=>{var io,oo;const ao=findWalletOptionFor(no,eo);return!ao||(no.id===to&&shouldManuallyReconnectOnRefresh(ao.walletConnector)&&ao.walletConnector.connect(),((io=no.walletProperties)===null||io===void 0?void 0:io.hardwareWallet)===HardwareWalletEnum.Ledger&&isHardwareWalletConnector(ao.walletConnector)&&(ao.walletConnector.isHardwareWalletEnabled=!0),!ro&&isOwnerOfASmartWallet(no,Xr.verifiedCredentials))?null:no.address&&no.chain?(no.walletProvider===WalletProviderEnum.SmartContractWallet&&initializeSmartWallet({account:no,primaryWalletId:to,verifiedCredentials:Xr.verifiedCredentials,walletConnectorOptions:eo}),ao.walletConnector.createWallet({additionalAddresses:no.walletAdditionalAddresses,address:no.address,chain:ao.walletConnector.connectedChain,connector:ao.walletConnector,id:no.id,isAuthenticated:!0,key:(oo=no.walletName)!==null&&oo!==void 0?oo:ao.walletConnector.key})):null}).filter(no=>no!==null),convertLegacyPhantomLedger=Xr=>Xr.walletName==="phantomledger"?convertLegacyPhantomLedgerConnector(Xr):Xr,updateUserWalletsFromLinkedWallets=(Xr,eo)=>{const to=[...Xr],ro=new Set;for(const no of eo){ro.add(no.address);const io=to.findIndex(oo=>oo.address===no.address);if(io===-1){to.push(no);continue}to[io]=no}return to.filter(no=>ro.has(no.address))},useWalletConnectors=({authMode:Xr,connectedWallets:eo,walletConnectorOptions:to,setMultiWalletWidgetState:ro,primaryWalletId:no,setPrimaryWalletId:io,user:oo,canHaveMultipleWalletsConnected:ao,separateSmartWalletAndSigner:so=!1})=>{const[co,lo]=reactExports.useState(!1),uo=reactExports.useMemo(()=>oo?createLinkedWalletsFromWalletOptions({primaryWalletId:no,separateSmartWalletAndSigner:so,user:oo,walletConnectorOptions:to}):[],[oo,no,to,so]);logger$8.logVerboseTroubleshootingMessage("linkedWallets",uo);const ho=reactExports.useMemo(()=>Xr==="connect-and-sign"&&oo||Xr==="connect-only"&&uo.find(Co=>isEmbeddedConnector(Co.connector))?uo:eo??[],[Xr,eo,uo,oo]);logger$8.logVerboseTroubleshootingMessage("wallets",ho),reactExports.useEffect(()=>ho.forEach(Co=>{Co.connector.initEventListener()}),[ho]);const{setUserWallets:go}=useInternalUserWallets();reactExports.useEffect(()=>{logger$8.logVerboseTroubleshootingMessage("[useWalletConnectors] will call setUserWallets",ho),go(Co=>updateUserWalletsFromLinkedWallets(Co,ho))},[go,ho]);const bo=reactExports.useMemo(()=>{var Co;return(Co=ho.find(Ro=>Ro.id===no))!==null&&Co!==void 0?Co:null},[no,ho]),wo=reactExports.useMemo(()=>ao?ho.filter(Co=>Co.id!==no):[],[no,ho,ao]),Eo=reactExports.useCallback(Co=>__awaiter$j(void 0,void 0,void 0,function*(){const Ro=ho.find(({id:Oo})=>Oo===Co);if(!Ro)throw new DynamicError(`Wallet with id: ${Co} not found`);return Ro}),[ho]),$o=reactExports.useCallback(Co=>__awaiter$j(void 0,void 0,void 0,function*(){const Ro=yield Eo(Co);if(!no){yield Ro.connector.connect(),io(Co);return}if(no!==Co){if(isEmailWalletConnector(Ro.connector)){const Oo=Ro.connector,jo=localStorage.getItem("magic-link-email");jo&&Oo.setEmail(jo)}io(Co),ro("idle")}}),[Eo,no,ro,io]);return{primaryWallet:bo,secondaryWallets:wo,setPrimaryWallet:$o,setShowQrcodeModal:lo,showQrcodeModal:co,wallets:ho}},ConfirmationModal=({modalId:Xr,closeModal:eo,show:to,zIndex:ro,handleOnModalUnmount:no,children:io})=>jsxRuntimeExports.jsx(Portal,{elementId:Xr,handleClose:eo,isShown:to,zIndex:ro??authModalZIndex+1,withBackdrop:!0,transitionEvents:{onUnmount:no},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:io})})}),useConfirmationPortal=({onResolve:Xr,onReject:eo,defaultErrorMessage:to})=>{usePreventPageScroll(!0);const[ro,no]=reactExports.useState(!0),io=reactExports.useRef(null),oo=reactExports.useRef(null),ao=reactExports.useCallback(()=>{no(!1)},[no]),so=reactExports.useCallback(()=>{if(oo.current)return Xr(oo.current);const uo=io.current||new DynamicError(to||"Something went wrong");return eo(uo)},[Xr,eo,to]);return{closeModal:ao,handleOnModalUnmount:so,onError:(uo,ho=!1)=>{oo.current=null,io.current=uo,ho&&ao()},onSuccess:(uo,ho=!0)=>{io.current=null,oo.current=uo,ho&&ao()},show:ro}},CreatePasswordModal=({onResolve:Xr,onReject:eo,closeView:to})=>{const{onSuccess:ro,onError:no,show:io,handleOnModalUnmount:oo,closeModal:ao}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:eo,onResolve:Xr});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"create-password-modal",show:io,closeModal:ao,handleOnModalUnmount:oo,children:jsxRuntimeExports.jsx(CreatePasswordView,{closeView:to,onSuccess:ro,onError:no})})},EnterPasswordView=({mutation:Xr,onSuccess:eo,onError:to,closeView:ro=!0})=>{const{setShowAuthFlow:no}=useInternalDynamicContext(),[io,oo]=reactExports.useState(""),[ao,so]=reactExports.useState("password"),{t:co}=useTranslation(),{mutate:lo,isLoading:uo,hasError:ho}=useMutation(()=>Xr(io),{onFailure:to,onSuccess:()=>{ro&&no(!1),eo==null||eo(io)}}),go=()=>{if(to){to==null||to(co("dyn_enter_password.error.invalid_password"));return}no(!1)},bo=ho?co("dyn_enter_password.error.invalid_password"):void 0,wo=jsxRuntimeExports.jsx(IconButton,{onClick:go,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Eo=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:ao==="password",onClick:Co=>so(Co?"password":"text"),className:"enter-password-view__password-input__suffix-icon"}),$o=Co=>{const Ro=Co.target.value;oo(Ro)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:wo,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"header__typography",copykey:"dyn_enter_password.title",children:co("dyn_enter_password.title")})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view",children:jsxRuntimeExports.jsxs("form",{className:"enter-password-view__body",onSubmit:Co=>{Co.preventDefault(),lo()},children:[jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgPasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_enter_password.description",children:co("dyn_enter_password.description")})}),!!bo&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_enter_password.error",children:bo}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:co("dyn_enter_password.input.placeholder"),type:ao,suffix:Eo,label:co("dyn_enter_password.input.label"),value:io,onChange:$o,copykey:"dyn_enter_password.input"})}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!io&&!bo,loading:uo,copykey:"dyn_enter_password.continue_button_label",type:"submit",children:co("dyn_enter_password.continue_button_label")})]})})]})},EnterPasswordModal=({handler:Xr,onResolve:eo,onReject:to,closeView:ro})=>{const{onSuccess:no,onError:io,show:oo,handleOnModalUnmount:ao,closeModal:so}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:to,onResolve:eo});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"enter-password-modal",show:oo,closeModal:so,handleOnModalUnmount:ao,children:jsxRuntimeExports.jsx(EnterPasswordView,{mutation:Xr,closeView:ro,onSuccess:no,onError:io})})},AppOriginTile=({appLogoUrl:Xr,appName:eo,appOrigin:to})=>{const ro=reactExports.useRef(null),[no,io]=reactExports.useState(!1);return reactExports.useLayoutEffect(()=>{if(ro.current){const{width:oo,height:ao}=ro.current.getBoundingClientRect();oo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose$1(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgSignCircle=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties$1(eo,_excluded$1);return reactExports.createElement("svg",_extends$3({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_circle||(_circle=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$1||(_path$1=reactExports.createElement("path",{d:"M34.048 17.611a5.5 5.5 0 1 1 7.779 7.779l-.611.61.193.193a4.5 4.5 0 0 1 0 6.364l-3.238 3.239a1.125 1.125 0 0 1-1.592-1.591l3.239-3.239a2.25 2.25 0 0 0 0-3.182l-.193-.193-12.704 12.705a1.123 1.123 0 0 1-.523.296l-9 2.25a1.125 1.125 0 0 1-1.34-1.447l2.812-8.438c.055-.166.148-.316.272-.44l14.906-14.906Zm6.188 1.591a3.25 3.25 0 0 0-4.597 0L20.921 33.92l-2.08 6.242 6.709-1.678 14.686-14.686a3.25 3.25 0 0 0 0-4.596ZM24.925 47.375c-2.779 0-4.967-1.275-6.424-2.49l2.89-.723c1.003.562 2.19.963 3.534.963.912 0 1.853-.369 2.856-1.028 1.005-.66 1.976-1.546 2.956-2.465l.255-.24c.865-.812 1.764-1.658 2.624-2.242.918-.624 2.135-1.191 3.413-.7.844.325 1.393.925 1.78 1.658.362.687.612 1.548.855 2.485.111.427.3.841.515 1.12.105.137.196.214.26.253.055.034.08.034.086.034.274 0 .745-.185 1.417-.643.417-.284.774-.568 1.13-.852.221-.177.443-.354.679-.53.628-.47 1.171-.785 1.57-.986a6.86 6.86 0 0 1 .625-.28l.045-.016.016-.006.006-.002h.003s.002-.002.359 1.065l-.357-1.067a1.125 1.125 0 0 1 .721 2.132l-.008.003a4.59 4.59 0 0 0-.394.178 8.472 8.472 0 0 0-1.238.78c-.132.098-.304.235-.5.391-.409.324-.921.73-1.39 1.05-.7.476-1.67 1.033-2.684 1.033-.98 0-1.69-.595-2.127-1.162-.447-.578-.746-1.29-.912-1.93-.247-.95-.442-1.573-.667-2-.201-.38-.383-.525-.598-.608-.184-.07-.552-.075-1.34.46-.704.48-1.472 1.2-2.38 2.053l-.225.211c-.97.91-2.071 1.922-3.26 2.703-1.19.783-2.566 1.398-4.091 1.398Z",fill:"#fff"})))};const isSignTypedData=Xr=>{if(typeof Xr!="object"||Xr===null)return!1;const{types:eo,message:to,primaryType:ro}=Xr;return typeof eo=="object"&&eo!==null&&typeof to=="object"&&to!==null&&typeof ro=="string"},isRawMessage=Xr=>typeof Xr!="object"||Xr===null?!1:typeof Xr.raw=="string",SignTypedDataPreview=({currentType:Xr,types:eo,showTypeName:to=!1,data:ro})=>{const no=eo[Xr].map(io=>{var oo;const ao=io.type.replace("[]",""),so=io.type.endsWith("[]"),co=ao in eo;if(so&&co)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(io.name),children:(oo=ro==null?void 0:ro[io.name])===null||oo===void 0?void 0:oo.map((ho,go)=>jsxRuntimeExports.jsx(TypeSection,{title:go.toString(),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:ao,types:eo,data:ho})},go))},io.name);if(co)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(io.name),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:ao,types:eo,data:ro==null?void 0:ro[io.name]})},io.name);const lo=ro==null?void 0:ro[io.name],uo=io.type;return jsxRuntimeExports.jsx(FieldRow,{name:capitalize$1(io.name),data:lo,displayValue:uo==="address"?shortenWalletAddress(lo,4,4):lo},io.name)});return to?jsxRuntimeExports.jsx(TypeSection,{title:Xr,children:no}):jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--fields-list",children:no})},TypeTitle=({children:Xr})=>jsxRuntimeExports.jsx(Typography,{color:"secondary",weight:"medium",children:Xr}),AttributeName=TypeTitle,AttributeValue=({children:Xr,title:eo})=>jsxRuntimeExports.jsx(Typography,{as:"span",weight:"regular",color:"primary",title:eo,children:Xr}),PaddedContent=({children:Xr})=>jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--type-container",children:Xr}),TypeSection=({title:Xr,children:eo})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(TypeTitle,{children:Xr}),jsxRuntimeExports.jsx(PaddedContent,{children:eo})]}),FieldRow=({name:Xr,displayValue:eo,data:to})=>jsxRuntimeExports.jsxs("div",{className:"sign-typed-data-preview--attribute-row",children:[jsxRuntimeExports.jsxs(AttributeName,{children:[capitalize$1(Xr),": "]}),jsxRuntimeExports.jsx(AttributeValue,{title:to,children:eo})]}),containsSpecialCharacters=Xr=>/[^ -~\s]/.test(Xr),SignMessagePreview=({message:Xr})=>{const eo=reactExports.useMemo(()=>{try{return JSON.parse(Xr)}catch{return}},[Xr]),to=reactExports.useMemo(()=>{const ro=isRawMessage(eo)?eo.raw:Xr,no=isHex$3(ro)?hexToString(ro):ro;return containsSpecialCharacters(no)?ro:no},[eo,Xr]);return isSignTypedData(eo)?jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:eo.primaryType,types:eo.types,showTypeName:!0,data:eo.message}):jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",children:jsxRuntimeExports.jsx("span",{style:{whiteSpace:"pre-line"},children:to})})},SignMessageConfirmationModal=({appLogoUrl:Xr,appName:eo,message:to,handler:ro,onReject:no,onSignMessage:io,hideModal:oo})=>{usePreventPageScroll(!0);const ao=reactExports.useRef(!1),[so,co]=reactExports.useState(!0),{initPasskeyRecoveryProcess:lo,shouldInitRecovery:uo}=usePasskeyRecovery(),{isTurnkeyWallet:ho}=useIsTurnkeyWallet(),{setShowAuthFlow:go,primaryWallet:bo}=useInternalDynamicContext(),{setView:wo}=useViewContext(),{userNeedsCrossDomainPasskey:Eo}=usePasskeyContext(),{t:$o}=useTranslation(),{getEOAWallet:Co}=useSmartWallets(),Ro=bo&&Co(bo),Oo=reactExports.useCallback(()=>{ao.current=!1,co(!1)},[co]),{isLoading:jo,mutate:Bo,data:Mo,error:Fo}=useMutation(()=>ro(to),{onSuccess:()=>{ao.current=!0,co(!1)}}),Wo=reactExports.useMemo(()=>{if(Fo){if(Fo instanceof DynamicError)return Fo.message;try{return getProperErrorMessage(Fo)}catch(yo){yo instanceof AccessBlockedError&&wo("access-blocked");return}}},[Fo,wo]),Jo=reactExports.useCallback(()=>{if(Mo)return io(Mo);no(Fo||new UserRejectedRequestError)},[Mo,io,no,Fo]),Po=yo=>__awaiter$j(void 0,void 0,void 0,function*(){const vo=bo&&isSessionKeyCompatibleWallet(bo)||Ro&&isSessionKeyCompatibleWallet(Ro);if((yield uo())&&!vo&&(yield lo("email","signMessage")),yo===!0){io("callHandlerOutsideModal");return}if(vo){Bo();return}if(ho&&Eo){wo("passkey-new-domain-detected"),go(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{Bo()});return}Bo()});useEffectOnce(()=>{oo&&Po(!0)});const fo=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Oo,"data-testid":"close",disabled:jo,children:jsxRuntimeExports.jsx(SvgClose,{})});return oo?null:jsxRuntimeExports.jsx(Portal,{handleClose:Oo,isShown:so,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-sign-message",transitionEvents:{onUnmount:Jo},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsxs(ModalCard,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:fo,alignContent:"bottom",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:yo=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignCircle,Object.assign({},yo))}),iconSize:64,isSpinning:!0})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sign-message-confirmation__title",copykey:"dyn_sign_message.title",children:$o("dyn_sign_message.title")}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:Fo&&jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__error",children:jsxRuntimeExports.jsx(ErrorContainer,{children:Wo})})}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__message-container",children:[jsxRuntimeExports.jsx(AppOriginTile,{appLogoUrl:Xr,appName:eo,appOrigin:PlatformService.getDisplayOrigin()}),jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__message",children:jsxRuntimeExports.jsx(SignMessagePreview,{message:to.toString().replace(/^"(.*)"$/,"$1").replace(/\\n/g,` +`)})})]}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"secondary",onClick:Oo,expanded:!0,buttonPadding:"large",disabled:jo,copykey:"dyn_sign_message.cancel_button",children:$o("dyn_sign_message.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:Po,expanded:!0,loading:jo,copykey:"dyn_sign_message.sign_button",dataTestId:"sign-button",children:$o("dyn_sign_message.sign_button")})]}),jsxRuntimeExports.jsx(NeedHelpSection,{}),jsxRuntimeExports.jsx(PoweredByDynamic,{})]})]})})})},WidgetPortal=({children:Xr,onClose:eo,disablePadding:to,portalClassName:ro,portalContainerClassName:no})=>jsxRuntimeExports.jsx("div",{className:classNames(ro,"widget-portal"),onClick:eo,"data-testid":"backdrop",children:jsxRuntimeExports.jsxs("div",{className:classNames(no,"widget-portal__container",{"widget-portal__container--no-padding":to}),onClick:io=>io.stopPropagation(),children:[eo&&jsxRuntimeExports.jsx("div",{className:"widget-portal__container__header",children:jsxRuntimeExports.jsx(IconButton,{className:"widget-portal__container__close-button",onClick:io=>eo(io),type:"button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})})}),Xr]})}),DefaultPromptLayout=({children:Xr,className:eo="",dataTestId:to="",icon:ro,showSpinnerInIcon:no=!0,title:io})=>jsxRuntimeExports.jsxs("div",{className:classNames("default-prompt-modal",eo),"data-testid":to,children:[ro&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:ro,iconSize:96,isSpinning:no,className:"default-prompt-modal__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"default-prompt-modal__content",children:[io&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary","data-testid":"title",children:io}),Xr]})]}),DefaultPromptModal=Xr=>jsxRuntimeExports.jsx(WidgetPortal,{onClose:Xr.onClose,portalClassName:"prompt-modal-portal",portalContainerClassName:"prompt-modal-portal__container",children:jsxRuntimeExports.jsx(DefaultPromptLayout,Object.assign({},Xr))});var _path,_excluded=["title","titleId"];function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(Xr){for(var eo=1;eo=0)&&Object.prototype.propertyIsEnumerable.call(Xr,ro)&&(to[ro]=Xr[ro])}return to}function _objectWithoutPropertiesLoose(Xr,eo){if(Xr==null)return{};var to={},ro=Object.keys(Xr),no,io;for(io=0;io=0)&&(to[no]=Xr[no]);return to}var SvgArrowCircleRight=function(eo){var to=eo.title,ro=eo.titleId,no=_objectWithoutProperties(eo,_excluded);return reactExports.createElement("svg",_extends$2({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":ro},no),to?reactExports.createElement("title",{id:ro},to):null,_path||(_path=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10.293-3.707a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 0 1-1.414-1.414L13.586 13H8a1 1 0 1 1 0-2h5.586l-1.293-1.293a1 1 0 0 1 0-1.414Z",fill:"#ABACB2"})))};const SwitchWalletView=({onCancel:Xr,connector:eo,expectedAddress:to,activeAddress:ro})=>{const{t:no}=useTranslation();return jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"switch-wallet",className:"switch-wallet",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:eo.key}),title:no("dyn_sync_wallet.switch_wallet.title"),onClose:Xr,children:jsxRuntimeExports.jsxs("div",{className:"switch-wallet__body",children:[ro&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.active_address.heading",children:no("dyn_sync_wallet.switch_wallet.active_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",children:shortenWalletAddress(ro,3,3)}),jsxRuntimeExports.jsx(Divider,{className:"switch-wallet__body__divider",children:jsxRuntimeExports.jsx(SvgArrowCircleRight,{})})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.heading",children:no("dyn_sync_wallet.switch_wallet.expected_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.prompt",className:"switch-wallet__body__expected-address__prompt",children:no("dyn_sync_wallet.switch_wallet.expected_address.prompt")}),jsxRuntimeExports.jsx(Typography,{color:"green-1",weight:"bold",className:"switch-wallet__body__expected-address__address",children:shortenWalletAddress(to,3,3)})]})})},ReconnectWithQrCodeView=({onCancel:Xr,onSuccess:eo,connector:to,expectedAddress:ro})=>{var no;const{t:io}=useTranslation(),{walletBook:oo}=useWalletBookContext(),{theme:{theme:ao}}=useThemeContext(),{name:so}=ao,[co,lo]=reactExports.useState(),[uo,ho]=reactExports.useState();return usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){const go=yield to.getAddress({onDesktopUri:bo=>__awaiter$j(void 0,void 0,void 0,function*(){ho(bo)}),onDisplayUri:bo=>__awaiter$j(void 0,void 0,void 0,function*(){lo(bo)})});if(go&&isSameAddress$1(go,ro,to.connectedChain)){eo();return}to.endSession(),Xr()}),{deps:[to],retries:3}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"reconnect-qr-code",title:io("dyn_sync_wallet.reconnect_with_qr_code.title"),onClose:Xr,children:co&&jsxRuntimeExports.jsx(QrCodeWrapper,{uri:co,desktopUri:uo,accentColor:so==="dark"?ao.colors.textPrimary:(no=getWalletPrimaryColor(oo,to.key))!==null&&no!==void 0?no:"",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to==null?void 0:to.key}),showCopyToClipboardButton:!0,walletConnector:to})})},reconnectSocialWallet=(Xr,eo,to,ro)=>__awaiter$j(void 0,void 0,void 0,function*(){if(!isSocialWalletConnector(eo))return;const no=Xr==null?void 0:Xr.verifiedCredentials.find(io=>io.format===JwtVerifiedCredentialFormatEnum.Oauth&&io.address&&isSameAddress$1(io.address,to,ro));!no||!no.oauthProvider||(yield eo.connect(no.oauthProvider))}),AutoReconnectingView=({onCancel:Xr,onSuccess:eo,connector:to,expectedAddress:ro})=>{const{t:no}=useTranslation(),{user:io}=useInternalDynamicContext();return usePromise(()=>__awaiter$j(void 0,void 0,void 0,function*(){isSocialWalletConnector(to)&&(yield reconnectSocialWallet(io,to,ro,to.connectedChain),eo())}),{deps:[to]}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"auto-reconnecting",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:to==null?void 0:to.key}),title:no("dyn_sync_wallet.reconnecting.title"),onClose:Xr,children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:no("dyn_sync_wallet.reconnecting.description",{walletAddress:shortenWalletAddress(ro,3,3)})})})},SyncWalletView=({onSuccess:Xr,onError:eo,expectedAddress:to,activeAddress:ro,connector:no})=>{const io=no.canConnectViaQrCode&&!no.isInstalledOnBrowser()&&!no.canConnectViaCustodialService;logger$8.logVerboseTroubleshootingMessage("[SyncWallet]",{canConnectViaCustodialService:no.canConnectViaCustodialService,canConnectViaQrCode:no.canConnectViaQrCode,isEmbeddedWallet:no.isEmbeddedWallet,isInstalledOnBrowser:no.isInstalledOnBrowser()}),useWalletConnectorEvent(no,"accountChange",({accounts:so})=>{logger$8.logVerboseTroubleshootingMessage("[SyncWallet] accountChange",{accounts:so,expectedAddress:to});const[co]=so;isSameAddress$1(co,to,no.connectedChain)&&Xr(!0)}),useInternalDynamicEvents("logout",()=>eo(new Error("user logged out"),!0));const oo=()=>__awaiter$j(void 0,void 0,void 0,function*(){const so=yield no.getAddress();so&&isSameAddress$1(so,to,no.connectedChain)&&Xr(!0)}),ao=()=>{logger$8.logVerboseTroubleshootingMessage("[SyncWallet] handleCancel called"),eo(new DynamicError("User cancelled","0"),!0)};return no.isEmbeddedWallet?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(AutoReconnectingView,{connector:no,expectedAddress:to,onCancel:ao,onSuccess:()=>Xr(!0)})}):io?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(ReconnectWithQrCodeView,{connector:no,expectedAddress:to,onCancel:ao,onSuccess:()=>Xr(!0)})}):jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(SwitchWalletView,{connector:no,expectedAddress:to,activeAddress:ro,onCancel:ao,onTryToReconnect:oo})})},SyncWalletPromptModal=({expectedAddress:Xr,connector:eo,onResolve:to,onReject:ro,activeAddress:no})=>{const{onSuccess:io,onError:oo,show:ao,handleOnModalUnmount:so}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:ro,onResolve:to});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"sync-wallet-modal",show:ao,closeModal:()=>{},handleOnModalUnmount:so,children:jsxRuntimeExports.jsx(SyncWalletView,{onSuccess:io,onError:oo,expectedAddress:Xr,connector:eo,activeAddress:no})})},TransactionConfirmationModal=({title:Xr,onReject:eo,onTransactionResponseSuccess:to,transaction:ro,copykey:no,walletConnector:io,hideModal:oo,isNativeToken:ao,currentToken:so})=>{usePreventPageScroll(!0);const[co,lo]=reactExports.useState(!0),uo=reactExports.useRef(null),ho=reactExports.useRef(null),go=reactExports.useCallback(()=>{lo(!1)},[lo]),bo=reactExports.useCallback(()=>ho.current?to(ho.current):eo(uo.current||new UserRejectedTransactionError),[to,eo]);return jsxRuntimeExports.jsx(Portal,{handleClose:go,isShown:co,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-transaction",transitionEvents:{onUnmount:bo},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(TransactionConfirmationView,{transaction:ro,title:Xr,copykey:no,hideModal:oo,mutation:()=>ro.submit(),onClickClose:go,onError:wo=>uo.current=wo,displayPoweredByDynamicFooter:!0,walletConnector:io,onSuccess:wo=>{uo.current=null,ho.current=wo,go()},isNativeToken:ao,currentToken:so,isModal:!0})})})})},useWalletUiUtils=({appLogoUrl:Xr,appName:eo,hideEmbeddedWalletTransactionUIs:to=!1})=>{const ro=reactExports.useRef("enabled"),{t:no}=useTranslation(),{modal:io,open:oo}=useConfirmationModal({elementId:"dynamic-send-transaction"}),{modal:ao,open:so}=useConfirmationModal({elementId:"dynamic-sign-message"}),{modal:co,open:lo}=useConfirmationModal({elementId:"dynamic-enter-password"}),{modal:uo,open:ho}=useConfirmationModal({elementId:"dynamic-create-password"}),{modal:go,open:bo}=useConfirmationModal({elementId:"dynamic-sync-wallet"}),wo=reactExports.useCallback(()=>ro.current==="disabled"?(ro.current="enabled",!1):!0,[ro]),Eo=reactExports.useCallback(Mo=>__awaiter$j(void 0,[Mo],void 0,function*({walletConnector:Fo,message:Wo,handler:Jo}){return wo()?so((Po,fo)=>jsxRuntimeExports.jsx(SignMessageConfirmationModal,{appLogoUrl:Xr,appName:eo,message:Wo,handler:Jo,onSignMessage:Po,onReject:fo,hideModal:to&&!(Fo!=null&&Fo.isGlobalTransaction)})).then(Po=>__awaiter$j(void 0,void 0,void 0,function*(){return Po==="callHandlerOutsideModal"?Jo():Po})):Jo()}),[Xr,eo,to,so,wo]),$o=reactExports.useCallback((Mo,Fo)=>__awaiter$j(void 0,void 0,void 0,function*(){return wo()?oo((Wo,Jo)=>jsxRuntimeExports.jsx(TransactionConfirmationModal,{copykey:"dyn_send_transaction.confirmation.title",title:no("dyn_send_transaction.confirmation.title"),transaction:Fo,onTransactionResponseSuccess:Wo,onReject:Jo,walletConnector:Mo,hideModal:to&&!(Mo!=null&&Mo.isGlobalTransaction)})).then(Wo=>__awaiter$j(void 0,void 0,void 0,function*(){return Wo==="callHandlerOutsideModal"?Fo.submit():Wo})):Fo.submit()}),[to,oo,wo,no]),Co=reactExports.useCallback(Mo=>__awaiter$j(void 0,[Mo],void 0,function*({handler:Fo,closeView:Wo=!0}){return lo((Jo,Po)=>jsxRuntimeExports.jsx(EnterPasswordModal,{handler:Fo,onResolve:Jo,onReject:Po,closeView:Wo}))}),[lo]),Ro=reactExports.useCallback(Mo=>__awaiter$j(void 0,[Mo],void 0,function*({closeView:Fo=!0}){return ho((Wo,Jo)=>jsxRuntimeExports.jsx(CreatePasswordModal,{onResolve:Wo,onReject:Jo,closeView:Fo}))}),[ho]),Oo=reactExports.useCallback(Mo=>__awaiter$j(void 0,[Mo],void 0,function*({walletConnector:Fo,activeAddress:Wo,expectedAddress:Jo}){yield bo((Po,fo)=>jsxRuntimeExports.jsx(SyncWalletPromptModal,{onResolve:Po,onReject:fo,connector:Fo,expectedAddress:Jo,activeAddress:Wo}))}),[bo]),jo=reactExports.useCallback(()=>{ro.current="disabled"},[]),Bo=reactExports.useMemo(()=>({createPassword:Ro,disabledConfirmationOnce:jo,enterPassword:Co,sendTransaction:$o,signMessage:Eo,syncWallet:Oo}),[Eo,jo,$o,Co,Ro,Oo]);return reactExports.useMemo(()=>[ao||io||co||uo||go,Bo],[ao,io,co,uo,go,Bo])},useSetWalletConnectorFetchers=(Xr,eo)=>{const{registerEmbeddedWalletSessionKey:to,removeSessionKey:ro}=useEmbeddedWalletSessionKeys(eo);if(!(Xr!=null&&Xr.length))return;const{fetchAuthToken:no,fetchBackupCode:io,fetchPasscode:oo}=getCoinbaseMPCConnectorFetchers({environmentId:eo});Xr.forEach(ao=>{var so,co;isCoinbaseMpcWalletConnector(ao.walletConnector)&&(ao.walletConnector.setAuthTokenFetcher(no),ao.walletConnector.setBackupCodeFetcher(io),ao.walletConnector.setPasscodeFetcher(oo)),isSessionKeyCompatibleWalletConnector(ao.walletConnector)&&((so=ao.walletConnector)===null||so===void 0||so.setSessionKeyFetcher(to),(co=ao.walletConnector)===null||co===void 0||co.setSessionKeyRemoveFunction(()=>ro()))})},useSendDynamicProps=({settings:Xr,environmentId:eo})=>{useEffectOnce(()=>{const to={settings:Object.assign(Object.assign({},Xr),{customPrivacyPolicy:!!Xr.customPrivacyPolicy,customTermsOfServices:!!Xr.customTermsOfServices,policiesConsentInnerComponent:!!Xr.policiesConsentInnerComponent})},ro=serializeEventsCallbacks(Xr.events),no=serializeWalletConnectors(Xr.walletConnectors),io=Object.assign(Object.assign({},to),{settings:Object.assign(Object.assign({},to.settings),{events:ro,walletConnectors:no})});sendDynamicProps(eo,{dynamicContextProps:io,frameworkSettings:getFrameworkSettings()})})},serializeEventsCallbacks=Xr=>{try{if(!Xr)return;const eo=Object.values(Xr);return Object.keys(Xr).filter((ro,no)=>eo[no]===void 0?!1:ro)}catch(eo){logger$8.error("error serializing events",eo);return}},getFrameworkSettings=()=>{var Xr;return{nextJs:{version:(Xr=window.next)===null||Xr===void 0?void 0:Xr.version},react:{version:reactExports.version}}},useResetCookieLocalStorage=({environmentId:Xr,projectSettings:eo,setPrimaryWalletId:to})=>{const ro=reactExports.useRef(!0),no=reactExports.useRef(!1),io=getUser(),oo=reactExports.useRef(!1);return useInternalDynamicEvents("logout",()=>oo.current=!0),reactExports.useEffect(()=>{const ao=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!io&&isCookieEnabled$1()&&!oo.current){no.current=!0;try{const so=yield refreshUserJwt({environmentId:Xr}),co=so==null?void 0:so.verifiedCredentials.find(lo=>lo.format===JwtVerifiedCredentialFormatEnum.Blockchain&&lo.id===so.lastVerifiedCredentialId);co&&to(co.id)}catch{logger$8.debug("Ignore failed refreshUserJwt in useResetCookieLocalStorage")}}eo&&(ro.current=!1)});no.current||ao()},[io,eo,Xr,to]),{isLoading:ro.current}},useSyncEmbeddedWalletFlow=()=>{const{projectSettings:Xr,user:eo,primaryWalletId:to,walletConnectorOptions:ro,setShowAuthFlow:no}=useInternalDynamicContext(),{isLoadingEmbeddedWallet:io}=useWalletContext(),{loading:oo}=useLoadingContext(),{createEmbeddedWallet:ao,shouldAutoCreateEmbeddedWallet:so}=useEmbeddedWallet(),co=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{co.current=!1}),reactExports.useEffect(()=>{const lo=()=>__awaiter$j(void 0,void 0,void 0,function*(){co.current=!0;try{yield ao()}catch(ho){ho instanceof EmbeddedWalletException?logger$8.debug("Error creating embedded wallet",ho):logger$8.error("Error creating embedded wallet",ho),no(!1)}});!so()||!eo||!Xr||!ro.length||io||oo||co.current||lo()},[eo,Xr,to,ao,io,ro,oo,so,no])},useSyncOnboardingFlow=({handler:Xr}={})=>{const{setShowAuthFlow:eo,userWithMissingInfo:to,sdkHasLoaded:ro,setSelectedWalletConnectorKey:no}=useInternalDynamicContext(),{setView:io}=useViewContext(),{updateUser:oo}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),{completeAuth:ao,handleAuthError:so}=useUserAuth({}),{displayedDestination:co}=useVerification(),lo=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{lo.current=!1}),reactExports.useEffect(()=>{var uo;const ho=()=>__awaiter$j(void 0,void 0,void 0,function*(){var bo;if(!(!Xr||!(!((bo=to==null?void 0:to.missingFields)===null||bo===void 0)&&bo.length))){lo.current=!0;try{const wo=to.missingFields.map(Ro=>({isCustom:Ro.type==="custom",key:Ro.name,label:Ro.label,required:Ro.required})),Eo=yield Xr(wo),$o={},Co=Object.assign({},to==null?void 0:to.metadata);Eo.forEach(Ro=>{Ro.isCustom?Co[Ro.key]=Ro.value:$o[Ro.key]=Ro.value}),yield ao({updateJwtFunction:()=>__awaiter$j(void 0,void 0,void 0,function*(){return oo(Object.assign(Object.assign({},$o),{metadata:Co}))})})}catch(wo){logger$8.error("Error handling user onboarding",wo),so(wo,{})}}}),go=()=>__awaiter$j(void 0,void 0,void 0,function*(){lo.current=!0,eo(!0);const bo=to==null?void 0:to.verifiedCredentials.find(wo=>wo.id===(to==null?void 0:to.lastVerifiedCredentialId));switch(bo!=null&&bo.walletName&&no(bo==null?void 0:bo.walletName),bo==null?void 0:bo.format){case JwtVerifiedCredentialFormatEnum.Email:case JwtVerifiedCredentialFormatEnum.Oauth:io("collect-user-data-login-no-wallet",{userIdentification:"email"});break;case JwtVerifiedCredentialFormatEnum.PhoneNumber:io("collect-user-data-login-no-wallet",{userIdentification:"phoneNumber",userIdentificationOverride:co});break;default:io("collect-user-data")}});if(!(!ro||lo.current||!(!((uo=to==null?void 0:to.missingFields)===null||uo===void 0)&&uo.length)||hasPendingMfaAction(to))){if(Xr){ho();return}go()}},[ro,to,Xr,ao,oo,eo,io,co,so,no])},useSyncMfaFlow=({handler:Xr}={})=>{const{setShowAuthFlow:eo,userWithMissingInfo:to,sdkHasLoaded:ro}=useInternalDynamicContext(),{setView:no}=useViewContext(),{getUserDevices:io}=useMfa(),oo=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{oo.current=!1}),reactExports.useEffect(()=>{var ao;if(!(!ro||oo.current)&&!(!to||!hasPendingMfaAction(to))){if(oo.current=!0,Xr){eo(!1),Xr();return}eo(!0),!((ao=to.scope)===null||ao===void 0)&&ao.includes("requiresAdditionalAuth")?io().then(so=>{so.length===0?no("mfa-choose-device"):no("mfa-verification")}):no("mfa-display-backup-codes")}},[io,ro,eo,no,to,Xr])},SyncAuthFlow=()=>(useSyncOnboardingFlow(),useSyncEmbeddedWalletFlow(),useSyncMfaFlow(),null),Switch=({disabled:Xr=!1,firstButton:eo,secondButton:to,thirdButton:ro})=>jsxRuntimeExports.jsxs("div",{className:classNames("switch__container",{disabled:Xr}),children:[jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:eo.active}),onClick:eo.handleButtonClick,children:eo.name}),jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:to.active}),onClick:to.handleButtonClick,children:to.name}),ro&&jsxRuntimeExports.jsx("button",{disabled:Xr,className:classNames("button",{active:ro.active}),onClick:ro.handleButtonClick,children:ro.name})]}),ThemeSwitch=()=>{const{changeTheme:Xr,theme:eo}=useThemeContext();return jsxRuntimeExports.jsx(Switch,{firstButton:{active:eo.theme.name==="light",handleButtonClick:()=>Xr("light"),name:"Light"},secondButton:{active:eo.theme.name==="dark",handleButtonClick:()=>Xr("dark"),name:"Dark"},thirdButton:{active:eo.theme.name==="auto",handleButtonClick:()=>Xr("auto"),name:"Auto"}})},PrimaryColorInput=()=>{const{changePrimaryColor:Xr,theme:eo}=useThemeContext(),[to,ro]=reactExports.useState(eo.customColor);return jsxRuntimeExports.jsx(Input,{id:"primary-color",label:"Primary color",value:to,onChange:no=>ro(no.target.value),onBlur:no=>{const io=to||eo.customColor;ro(io),Xr(io)}})},AuthModeSwitch=({authMode:Xr,setAuthMode:eo})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:Xr==="connect-and-sign",onChange:()=>eo("connect-and-sign"),id:"connect-and-sign"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-and-sign",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect and sign"})})]}),jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:Xr==="connect-only",onChange:()=>eo("connect-only"),id:"connect-only"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-only",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect only"})})]})]}),LoginWithEmailSwitch=()=>{const{loginWithEmail:Xr,setLogInWithEmail:eo}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch,{firstButton:{active:Xr,handleButtonClick:()=>eo(!0),name:"True"},secondButton:{active:!Xr,handleButtonClick:()=>eo(!1),name:"False"}})},LoginWithEmailViewDisplayPriorityOrderSwitch=()=>{const{authorizationViewDisplayOrder:Xr,setAuthorizationViewDisplayOrder:eo,loginWithEmail:to}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch,{disabled:!to,firstButton:{active:Xr==="web2",handleButtonClick:()=>eo("web2"),name:"Email"},secondButton:{active:Xr==="web3",handleButtonClick:()=>eo("web3"),name:"Wallet"}})},TemplateSelect=()=>{const{theme:Xr,changeTemplate:eo}=useThemeContext(),to=ro=>{eo(ro.target.value)};return jsxRuntimeExports.jsxs(Select,{label:"template",value:Xr.template,onChange:to,selectDataTestId:"template-select",children:[jsxRuntimeExports.jsx("option",{value:"default",children:"Default"}),jsxRuntimeExports.jsx("option",{value:"matrix",children:"Matrix"}),jsxRuntimeExports.jsx("option",{value:"minimal",children:"Minimal"}),jsxRuntimeExports.jsx("option",{value:"rounded",children:"Rounded"}),jsxRuntimeExports.jsx("option",{value:"trinity",children:"Trinity"})]})},Toolkit=()=>{const{projectSettings:Xr,user:eo,showAuthFlow:to,showDynamicUserProfile:ro,toolkitEnabled:no,authMode:io,setAuthMode:oo}=useInternalDynamicContext();return reactExports.useMemo(()=>no?ro||to:!1,[to,ro,no])?jsxRuntimeExports.jsx(ShadowDOM,{dataTestId:"toolkit-shadowdom",className:"toolkit-shadowdom",zIndex:toolkitZIndex,children:jsxRuntimeExports.jsxs("div",{className:"toolkit__container",children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Theme"}),jsxRuntimeExports.jsx(ThemeSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Template"}),jsxRuntimeExports.jsx(TemplateSelect,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Primary Color"}),jsxRuntimeExports.jsx(PrimaryColorInput,{})]}),!eo&&jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Auth mode"}),jsxRuntimeExports.jsx(AuthModeSwitch,{authMode:io,setAuthMode:oo})]}),isEmailProviderEnabled((Xr==null?void 0:Xr.providers)||[])&&!eo&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Log in with Email"}),jsxRuntimeExports.jsx(LoginWithEmailSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Email vs Wallet priority"}),jsxRuntimeExports.jsx(LoginWithEmailViewDisplayPriorityOrderSwitch,{})]})]})]})}):null},useTelegramLogin=()=>{const{sdkHasLoaded:Xr,user:eo,projectSettings:to,environmentId:ro}=useInternalDynamicContext(),no=(to==null?void 0:to.providers)||[],{completeConnection:io}=useSocialAuth({sessionTimeout:2e4}),oo=()=>typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("telegramAuthToken")||void 0,ao=lo=>isProviderEnabled(no,ProviderEnum.Telegram)&&Xr&&!eo&&lo;return{isAuthWithTelegram:()=>__awaiter$j(void 0,void 0,void 0,function*(){const lo=oo();if(ao(lo))return isUserLinkedWithTelegram(ro,{telegramAuthToken:lo})}),telegramSignIn:(...lo)=>__awaiter$j(void 0,[...lo],void 0,function*({forceCreateUser:uo=!1}={}){const ho=oo();ao(ho)&&(yield io({authMode:"signin",forceCreateUser:uo,provider:ProviderEnum.Telegram,state:"",telegramAuthToken:ho}))})}},TelegramAutoLogin=()=>(useTelegramLogin(),null),WalletConnectorEvents=()=>{const{walletConnectorOptions:Xr,primaryWallet:eo}=useInternalDynamicContext(),{handleWalletItemClick:to}=useWalletItemActions();return reactExports.useEffect(()=>{const ro=({connector:no})=>{logger$8.debug("[WalletConnectorEvents] handleProviderReady",{connector:no});const io=Xr.map(oo=>oo.key===no.key?Object.assign(Object.assign({},oo),{isInstalledOnBrowser:no.isInstalledOnBrowser(),walletConnector:no}):oo);setWalletConnectorOptions(io)};return walletConnectorEvents.on("providerReady",ro),()=>{walletConnectorEvents.off("providerReady",ro)}},[Xr]),reactExports.useEffect(()=>{const ro=({connector:no})=>{logger$8.debug("[WalletConnectorEvents] handleAutoConnect",{connector:no});const io=Xr.find(oo=>oo.walletConnector.key===no.key);io&&to(io)};if(!eo)return walletConnectorEvents.on("autoConnect",ro),()=>{walletConnectorEvents.off("autoConnect",ro)}},[to,Xr,eo]),null},getMissingChains=(Xr,eo)=>{if(!Xr||!eo)return;const to=new Set(eo.map(no=>no.walletChain));return Xr.filter(no=>!to.has(no.chain))},themeModes=["light","dark","auto"],isThemeSetting=Xr=>themeModes.includes(Xr),parseTheme=(Xr,eo)=>isThemeSetting(Xr)?getThemeConfig(eo,Xr):Xr,validTransitions$2={idle:["linking_new_wallet","primary_not_connected","switching_primary"],linking_new_wallet:["idle"],primary_not_connected:["idle"],switching_primary:["idle"]},validateStateTransition$2=({from:Xr,to:eo})=>{if(Xr!==eo&&!validTransitions$2[Xr].includes(eo))throw new Error(`Invalid AccountSwitch state transition from ${Xr} to ${eo}`);return!0},validateMultiWalletWidgetState$1=Xr=>{if(Xr!=="awaiting_account_switch")throw new Error(`Invalid MultiWalletWidget state while trying to set AccountSwitch state: ${Xr} Expected: awaiting_account_switch`)},useAwaitingAccountSwitch=()=>{const[Xr,eo]=reactExports.useState("idle"),to=reactExports.useCallback(()=>{eo("idle")},[eo]),ro=reactExports.useCallback((no,io)=>{validateMultiWalletWidgetState$1(io),validateStateTransition$2({from:Xr,to:no}),eo(no)},[Xr]);return[Xr,ro,to]},validTransitions$1={idle:["linking_new_wallet","transferring_wallet"],linking_new_wallet:["idle"],transferring_wallet:["idle"]},validateStateTransition$1=({from:Xr,to:eo})=>{if(Xr!==eo&&!validTransitions$1[Xr].includes(eo))throw new Error(`Invalid AwaitingSignature state transition from ${Xr} to ${eo}`);return!0},validateMultiWalletWidgetState=Xr=>{if(Xr!=="awaiting_signature")throw new Error(`Invalid MultiWalletWidget state while trying to set AwaitingSignature state: ${Xr} -Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[Xr,eo]=reactExports.useState("idle"),to=reactExports.useCallback(()=>{eo("idle")},[eo]),ro=reactExports.useCallback((no,io)=>{validateMultiWalletWidgetState(io),validateStateTransition$1({from:Xr,to:no}),eo(no)},[Xr]);return[Xr,ro,to]},validTransitions={awaiting_account_switch:["awaiting_signature","idle"],awaiting_connection:["idle"],awaiting_signature:["idle"],detected_new_wallet:["awaiting_signature","idle"],idle:["awaiting_account_switch","awaiting_connection","awaiting_signature","detected_new_wallet"]},validateStateTransition=({from:Xr,to:eo})=>{if(Xr!==eo&&!validTransitions[Xr].includes(eo))throw new Error(`Invalid MultiWalletWidget state transition from ${Xr} to ${eo}`);return!0},useMultiWalletWidgetState=()=>{const[Xr,eo]=reactExports.useState("idle"),[to,ro,no]=useAwaitingAccountSwitch(),[io,oo,ao]=useAwaitingSignature(),so=reactExports.useCallback(()=>{no(),ao()},[no,ao]),co=reactExports.useCallback((lo,fo,ho)=>{validateStateTransition({from:Xr,to:lo}),eo(lo),so(),fo&&ro(fo,lo),ho&&oo(ho,lo)},[Xr,so,ro,oo]);return[Xr,co,{awaiting_account_switch:[to,ro],awaiting_signature:[io,oo]}]},useClearWalletConnectSessions=({connectors:Xr})=>{const eo=()=>{if(!(typeof window>"u")){for(const to of StorageService.getKeys())(to.startsWith("walletconnect")||to.startsWith("walletlink")||to.startsWith("wc@2"))&&localStorage.removeItem(to);Xr==null||Xr.forEach(to=>{var ro,no,io;!((no=(ro=to==null?void 0:to.name)===null||ro===void 0?void 0:ro.toLowerCase())===null||no===void 0)&&no.startsWith("turnkey")&&((io=to.getAuthenticatorHandler())===null||io===void 0||io.clear(),StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),StorageService.removeItem(EMBEDDED_WALLET_SECURE_BANNER))})}};return reactExports.useEffect(()=>{if(typeof window>"u"||Xr.length===0)return;const to=new Set(Xr.map(ro=>ro.key));for(const ro of StorageService.getKeys())ro.startsWith("walletconnect")&&!to.has(ro.replace("walletconnect-",""))&&localStorage.removeItem(ro)},[Xr]),{clearAllWalletConnectSessions:eo}},revokeSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,sessionId:to}){try{yield sdkApi$1().revokeSession({environmentId:eo})}catch(ro){const no=yield ro.json();logger$8.error(Error(no.error.message))}}),mapChainToChainEnum=Xr=>{const eo=Object.values(ChainEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid chain ${Xr}`);return eo},mapProviderToProviderEnum=Xr=>{const eo=Object.values(WalletProviderEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid provider ${Xr}`);return eo},mapAuthModeTypeToEnum=Xr=>{const eo=Object.values(AuthModeEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid authMode ${Xr}`);return eo},createVisit=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authMode:eo,chain:to,environmentId:ro,walletProvider:no,publicWalletAddress:io,walletName:oo}){try{const ao={address:io,authMode:mapAuthModeTypeToEnum(eo),chain:mapChainToChainEnum(to),provider:mapProviderToProviderEnum(no),walletName:oo};yield sdkApi$1().createVisit({connectRequest:ao,environmentId:ro})}catch(ao){logger$8.error(ao)}}),getWalletConnectorForWallet=Xr=>{var eo,to;if(!Xr)return;const ro=getWalletConnectorOptions(),{key:no,chain:io}=Xr,oo=(eo=ro.find(so=>no===so.key&&so.walletConnector.connectedChain===io))===null||eo===void 0?void 0:eo.walletConnector;return oo||((to=ro.find(so=>so.key==="fallbackconnector"))===null||to===void 0?void 0:to.walletConnector)},updateUserWalletsFromConnectedWallets=(Xr,eo)=>{const to=[...Xr],ro=new Set;for(const no of eo)ro.add(no.address),to.find(oo=>oo.address===no.address)||to.push(no);return to.filter(no=>ro.has(no.address)||no.isAuthenticated)},useConnectWallet=({authMode:Xr,clearPrimaryWalletId:eo,enableVisitTrackingOnConnectOnly:to,environmentId:ro,primaryWalletId:no,setPrimaryWalletId:io,walletConnectorOptions:oo,handleConnectedWallet:ao,setShowAuthFlow:so,isBridgeFlow:co,user:lo})=>{const[fo,ho,go]=useLocalStorage(CONNECTED_WALLETS_INFO,[]),[yo,vo]=reactExports.useState([]),{setUserWallets:wo,addedWalletsIds:Eo,removedWalletsIds:ko}=useInternalUserWallets(),Ao=reactExports.useCallback(Bo=>{vo(Bo),wo(xo=>updateUserWalletsFromConnectedWallets(xo,Bo))},[wo]),Po=reactExports.useCallback(Bo=>__awaiter$j(void 0,void 0,void 0,function*(){const xo=yo.find(bo=>bo.id===Bo);yield xo==null?void 0:xo.connector.endSession();const uo=fo.filter(bo=>bo.id!==Bo);if(ho(uo),ko.current.push(Bo),Bo!==no)return;const po=uo.length>0;co||!po?eo():io(uo[0].id)}),[eo,yo,fo,co,no,ko,ho,io]),jo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const Bo=oo.map(uo=>uo.walletConnector);if(!Bo.length)return;const xo=(yield Promise.all(fo.map(uo=>__awaiter$j(void 0,void 0,void 0,function*(){const po=getWalletConnectorByKey(Bo,uo.walletConnectorKey);if(!po)return logger$9.error("Could not find walletConnector: "+uo.walletConnectorKey),yield Po(uo.id),null;isHardwareWalletConnector(po)&&uo.hardwareWallet===HardwareWalletEnum.Ledger&&(po.isHardwareWalletEnabled=!0);const[bo]=yield po.getConnectedAccounts();if(!bo)return yield Po(uo.id),null;const _o=yield po.getAdditionalAddresses(bo),$o=po.connectedChain;return po.createWallet({additionalAddresses:_o,address:bo,chain:$o,connector:po,id:uo.id,isAuthenticated:!1,key:po.key})})))).filter(uo=>!!uo);Ao(xo)}),[fo,Po,Ao,oo]);reactExports.useEffect(()=>{jo()},[fo,oo]);const Mo=reactExports.useCallback(Bo=>{const uo=Bo.map(({id:po})=>po).map(po=>Number(po.replace("connect-wallet-",""))).sort((po,bo)=>po-bo);for(let po=0;po{var uo;const po=[...yo],bo=po.findIndex(_o=>_o.id===Bo);bo<0||(po[bo]=po[bo].connector.createWallet(Object.assign(Object.assign({},po[bo]),{address:(uo=xo.address)!==null&&uo!==void 0?uo:po[bo].address,connector:getWalletConnectorForWallet(po[bo])})),Ao(po))},[yo,Ao]),Do=({walletId:Bo,walletConnectorKey:xo,walletChain:uo,provider:po})=>{const bo=[...fo],_o=oo.map(Ro=>Ro.walletConnector),$o=getWalletConnectorByKey(_o,xo),Co=$o&&isHardwareWalletConnector($o)&&$o.isHardwareWalletEnabled?HardwareWalletEnum.Ledger:void 0;bo.push({hardwareWallet:Co,id:Bo,provider:po,walletChain:uo,walletConnectorKey:xo}),ho(bo)},Fo=(Bo,xo)=>__awaiter$j(void 0,void 0,void 0,function*(){shouldManuallyReconnectOnRefresh(xo)&&(yield xo.connect());const uo=yield xo.getAddress();if(uo&&ao&&!(yield ao({address:uo,chain:xo.connectedChain,connector:xo}))){logger$9.info("Connection was not established because handleConnectedWallet returned false"),Po(Bo),so(!1,{emitCancelAuth:!0});return}No(Bo,{address:uo})}),Xo=(Bo,xo,uo)=>__awaiter$j(void 0,void 0,void 0,function*(){const{applyHandleConnectedWallet:po=!0}=uo??{},bo=yield Bo.getAddress(xo);if(!bo)throw new MissingPublicAddressError;if(ao&&po&&!(yield ao({address:bo,chain:Bo.connectedChain,connector:Bo}))){logger$9.info("Connection was not established because handleConnectedWallet returned false"),so(!1);return}const _o=fo.some(({walletConnectorKey:So})=>So===Bo.key),$o=Bo.connectedChain;if(!_o&&(Xr!=="connect-only"||to)&&createVisit({authMode:Xr,chain:$o||"",environmentId:ro,publicWalletAddress:bo,walletName:Bo.key,walletProvider:getWalletProvider(Bo)}),!isConnectOnly(lo,Xr))return{address:bo,id:""};const Ro=`connect-wallet-${Mo(fo)}`;return no||io(Ro),Eo.current.push(Ro),_o?yield jo():Do({provider:getWalletProvider(Bo),walletAddress:bo,walletChain:$o,walletConnectorKey:Bo.key,walletId:Ro}),{address:bo,id:Ro}}),Lo=reactExports.useCallback(Bo=>yo.find(xo=>xo.id===Bo),[yo]);return{connectWallet:Xo,connectedWallets:yo,connectedWalletsInfo:fo,disconnectWallet:Po,getConnectedWalletById:Lo,refreshConnectedWallet:Fo,removeConnectedWalletsInfo:go}},useFetchWalletsForChainsMap=Xr=>({walletsForChainsMap:reactExports.useMemo(()=>Xr?Object.assign(Object.assign({},defaultWalletsForChains),{primary_chain:Xr.primary_chain,wallets:Object.assign(Object.assign({},defaultWalletsForChains.wallets),!!Xr.wallets&&Xr.wallets)}):defaultWalletsForChains,[Xr])}),useHandleUnlinkWallet=({verifiedCredentials:Xr,environmentId:eo,primaryWalletId:to,secondaryWallets:ro})=>{const{removedWalletsIds:no}=useInternalUserWallets();return reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){var ao;const so=(ao=StorageService.getItem(PRIMARY_WALLET_ID))!==null&&ao!==void 0?ao:to;if(oo===so)return;yield unlinkWallet({environmentId:eo,onSuccess:()=>{no.current.push(oo)},primaryWalletId:so,walletId:oo});const co=ro.find(fo=>fo.id===oo);Xr.filter(fo=>fo.walletName===((co==null?void 0:co.connector.key)||"")).length===1&&(yield co==null?void 0:co.connector.endSession())}),[to,eo,ro,Xr,no])},primaryWalletIdValidator=Xr=>typeof Xr=="string"||typeof Xr>"u",usePrimaryWalletId=({environmentId:Xr,user:eo})=>{const[to,ro,no]=useLocalStorage(PRIMARY_WALLET_ID,void 0,primaryWalletIdValidator),io=reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){ro(oo),eo&&(yield storeSelectedWallet({environmentId:Xr,walletId:oo}))}),[Xr,ro,eo]);return{clearPrimaryWalletId:no,primaryWalletId:to,setPrimaryWalletId:io}},useWalletEventListeners=({disconnectWallet:Xr,handleLogOut:eo,multiWallet:to,multiWalletWidgetState:ro,primaryWallet:no,secondaryWallets:io,selectedWalletConnector:oo,selectedWalletWithAction:ao,setSelectedWalletConnectorKey:so,setSelectedWalletWithAction:co,setMultiWalletWidgetState:lo,user:fo,setPrimaryWalletId:ho,authMode:go,refreshConnectedWallet:yo,detectNewWalletsForLinking:vo})=>{const wo=reactExports.useCallback((Ao,Po)=>{logger$8.debug("handleAccountChangeWhenAwaitingAccountSwitch",{isPrimaryWallet:Ao,newAddress:Po});const jo=io.find(No=>isSameAddress$1(No.address,Po,No.chain));if(logger$8.logVerboseTroubleshootingMessage("[handleAccountChangeWhenAwaitingAccountSwitch]",{linkedSecondaryWallet:jo}),!jo){lo("awaiting_signature",void 0,"linking_new_wallet"),Ao&&no&&so(no.connector.key);return}if(jo.connector.key==="unknown"){dynamicEvents.emit("triggerConnectAndSign");return}co(null),ho(jo.id),lo("idle")},[lo,no,io,so,co,ho]),Eo=reactExports.useCallback(({accounts:Ao})=>{if(logger$8.debug("calculatePrimaryWalletMultiWalletStateFromAccounts",{accounts:Ao,authMode:go,multiWallet:to,multiWalletWidgetState:ro,primaryWallet:no}),!no)return;const[Po]=Ao;if(!!isSameAddress$1(Po,no.address,no.chain)){lo("idle");return}if(go==="connect-only"){yo(no.id,no.connector);return}if(!to)return;if(ro==="awaiting_account_switch"){wo(!0,Po);return}ro!=="idle"&&(logger$8.error(`Unexpected multiWalletWidgetState (${ro}) and onAccountChange combination. Resetting state to idle.`),lo("idle"));const Mo=io.find(No=>isSameAddress$1(No.address,Po,No.chain));if(Mo){ho(Mo.id);return}fo&&vo&&(lo("detected_new_wallet"),so(no.connector.key))},[go,vo,wo,to,ro,no,yo,io,lo,ho,so,fo]);useInternalDynamicEvents("triggerComputePrimaryWalletMultiWalletStateFromAccounts",Eo),useWalletConnectorEvent(no==null?void 0:no.connector,"accountChange",({accounts:Ao})=>{logger$8.debug("primary wallet account change",{accounts:Ao}),Eo({accounts:Ao})});const ko=reactExports.useMemo(()=>{const Ao=no==null?void 0:no.connector,Po=io.map(({connector:Mo})=>Mo),jo=new Set([...Po,Ao,oo].filter(Mo=>!!Mo));return Ao&&jo.delete(Ao),Array.from(jo)},[io,oo,no==null?void 0:no.connector]);useWalletConnectorEvent(ko,"accountChange",(Ao,Po)=>__awaiter$j(void 0,void 0,void 0,function*(){if(logger$8.debug("secondary wallet account change"),go==="connect-only"&&io.length){const jo=io.filter(({connector:Mo})=>Mo.key===Po.key);for(const Mo of jo)yo(Mo.id,Mo.connector);return}ro==="awaiting_account_switch"&&wo(!1,(ao==null?void 0:ao.wallet.address)||"")})),useWalletConnectorEvent(no==null?void 0:no.connector,"disconnect",()=>{logger$8.debug("primary wallet disconnect"),go==="connect-only"&&eo()}),useWalletConnectorEvent(ko,"disconnect",Ao=>{if(logger$8.debug("secondary wallet disconnect"),go==="connect-only"){const Po=io.filter(({connector:jo})=>jo.key===Ao.key);for(const jo of Po)Xr(jo.id)}})},useTabState=({settingsOverrides:Xr})=>{var eo,to,ro;const no=(eo=Xr==null?void 0:Xr.views)===null||eo===void 0?void 0:eo.find(so=>so.type==="wallet-list"),[io,oo]=reactExports.useState(0),ao=io===null||(to=no==null?void 0:no.tabs)===null||to===void 0?void 0:to.items[io];return{selectedTabIndex:io,selectedTabSettings:ao,setSelectedTabIndex:oo,tabsItems:(ro=no==null?void 0:no.tabs)===null||ro===void 0?void 0:ro.items}},DynamicBridgeWidgetContext=React.createContext(void 0),initialView="wallets",DynamicBridgeWidgetContextProvider=({children:Xr})=>{const eo=reactExports.useRef(null),to=reactExports.useRef(null),[ro,no]=reactExports.useState(initialView),io=reactExports.useCallback(()=>{no(initialView)},[]),oo=reactExports.useCallback(()=>{no("profile")},[]),ao={bridgeWidgetView:ro,events:{onDynamicBridgeWidgetClose:io},goToProfileView:oo,inlineControlsRef:to,setBridgeWidgetView:no,widgetRef:eo};return jsxRuntimeExports.jsx(DynamicBridgeWidgetContext.Provider,{value:ao,children:Xr})},DynamicWidgetCard=reactExports.forwardRef(({children:Xr},eo)=>jsxRuntimeExports.jsx("div",{ref:eo,className:"dynamic-widget-card",children:Xr}));DynamicWidgetCard.displayName="DynamicWidgetCard";const widgetRegistryContext=reactExports.createContext(null),WidgetRegistryContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState({}),ro=reactExports.useCallback((oo,ao)=>{to(so=>Object.assign(Object.assign({},so),{[oo]:{type:ao}}))},[to]),no=reactExports.useCallback(oo=>{to(ao=>{const so=Object.assign({},ao);return delete so[oo],so})},[to]),io=reactExports.useCallback(oo=>Object.values(eo).some(ao=>ao.type===oo),[eo]);return jsxRuntimeExports.jsx(widgetRegistryContext.Provider,{value:{checkWidgetPresence:io,registerId:ro,removeId:no},children:Xr})},Modal=({onrampUrl:Xr})=>{const{fundingRef:eo,setShowFunding:to}=useFundingContext();return useOnClickOutside(eo,()=>{to(!1)}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal","data-testid":"fund-wallet-modal",children:jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-content",ref:eo,children:jsxRuntimeExports.jsx("iframe",{id:"onramp-iframe",src:Xr,allow:"camera *;geolocation *",title:"Crypto Onramp"})})})},FundWalletView=()=>{const{primaryWallet:Xr}=useInternalDynamicContext(),{showFunding:eo,fundingUrl:to,fundingEnabled:ro}=useFundingContext();return!ro||!eo||!to||!(Xr!=null&&Xr.address)?null:jsxRuntimeExports.jsx(ShadowDOM,{children:jsxRuntimeExports.jsxs(OpacityTransition,{isShown:eo,children:[jsxRuntimeExports.jsx("div",{className:"fund-wallet__backdrop","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-container",children:jsxRuntimeExports.jsx(Modal,{onrampUrl:to})})]})})},FundingWidget=()=>jsxRuntimeExports.jsx(FundWalletView,{}),ConnectWithOtpContext=reactExports.createContext(void 0),createEmailHandler=(Xr,{shouldRegisterSessionKeysOnSignin:eo,generateSessionKey:to})=>ro=>__awaiter$j(void 0,void 0,void 0,function*(){const no=yield createEmailVerification({email:ro,environmentId:Xr});let{verificationUUID:io}=no;return{retry:()=>__awaiter$j(void 0,void 0,void 0,function*(){io=(yield retryEmailVerification({email:ro,environmentId:Xr,verificationUUID:io})).verificationUUID}),type:"email",verify:oo=>__awaiter$j(void 0,void 0,void 0,function*(){let ao;eo()&&(ao=(yield to()).publicKey);const so=yield signInWithEmailVerification({environmentId:Xr,sessionPublicKey:ao,verificationToken:oo,verificationUUID:io});return storeAuthTokenAndUser(so),{destination:ro,verified:!!so.jwt}})}}),createMagicHandler=(Xr,eo)=>to=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr)throw new Error("OTP wallet connector was not found");return Xr.setEmail(to),eo(Xr),{retry:()=>Xr.retryOneTimePassword(),type:"email",verify:ro=>__awaiter$j(void 0,void 0,void 0,function*(){return{destination:to,verified:yield Xr.verifyOneTimePassword(ro)}})}}),createSmsHandler=Xr=>eo=>__awaiter$j(void 0,void 0,void 0,function*(){const{generateSessionKey:to,shouldRegisterSessionKeysOnSignin:ro}=useEmbeddedWalletSessionKeys(Xr),{verificationUUID:no}=yield createSmsVerification({environmentId:Xr,isoCountryCode:eo.iso2,phoneCountryCode:eo.dialCode,phoneNumber:eo.phone});return{type:"sms",verify:io=>__awaiter$j(void 0,void 0,void 0,function*(){let oo;ro()&&(oo=(yield to()).publicKey);const ao=yield signInWithSmsVerification({environmentId:Xr,sessionPublicKey:oo,verificationToken:io,verificationUUID:no});return storeAuthTokenAndUser(ao),{destination:eo,verified:!!ao.jwt}})}}),mapEmailProviderToProviderEnum={dynamic:ProviderEnum.Dynamic,magicLink:ProviderEnum.MagicLink},allSupportedProviders=Object.values(mapEmailProviderToProviderEnum),findEmailProvider=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const{emailProvider:to}=yield getEmailProvider({email:eo,environmentId:Xr});if(!allSupportedProviders.includes(to))throw new Error("Email provider is not supported");return to}),{Provider:Provider$1}=ConnectWithOtpContext,ConnectWithOtpProvider=({children:Xr})=>{const{walletConnectorOptions:eo,environmentId:to,projectSettings:ro,setCallback:no}=useInternalDynamicContext(),io=useEmbeddedWalletSessionKeys(to),{handleInstalledExtensionClick:oo}=useWalletItemActions(),ao=reactExports.useRef(null),so=(ro==null?void 0:ro.providers)||[],co=eo.map(({walletConnector:vo})=>vo).find(isEmailOTPWalletConnector),lo={[ProviderEnum.Dynamic]:{enabled:isProviderEnabled(so,ProviderEnum.Dynamic),handler:createEmailHandler(to,io)},[ProviderEnum.MagicLink]:{enabled:isProviderEnabled(so,ProviderEnum.MagicLink),handler:createMagicHandler(co,oo)}},fo=(vo,...wo)=>__awaiter$j(void 0,[vo,...wo],void 0,function*(Eo,{provider:ko}={}){if(!isEmailValid(Eo))throw new Error("Email is not valid");const Ao=ko||(yield findEmailProvider(to,Eo));if(!lo[Ao].enabled)throw new Error("Email provider is not enabled");const Po=yield lo[Ao].handler(Eo);ao.current=Po}),ho=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!isProviderEnabled(so,ProviderEnum.Sms))throw new Error("SMS provider is not enabled");const Eo=yield createSmsHandler(to)(vo);ao.current=Eo}),go=vo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!ao.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");const{type:wo,verify:Eo}=ao.current,{destination:ko,verified:Ao}=yield Eo(vo);if(wo==="sms"?dynamicEvents.emit("smsVerificationResult",Ao,ko):dynamicEvents.emit("emailVerificationResult",Ao,ko),Ao)no("authSuccess");else throw new Error(`${wo==="sms"?"SMS":"Email"} verification failed`)}),yo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!ao.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");if(!ao.current.retry)throw new Error("Re-send is not supported");return ao.current.retry()});return jsxRuntimeExports.jsx(Provider$1,{value:{connectWithEmail:fo,connectWithSms:ho,retryOneTimePassword:yo,verifyOneTimePassword:go},children:Xr})},ERROR_BOUNDARY_CONTEXT_NOT_FOUND="ERROR_BOUNDARY_CONTEXT_NOT_FOUND",ErrorBoundaryContext=reactExports.createContext(null);function assertErrorBoundaryContext(Xr){if(Xr===null||typeof Xr.hasError!="boolean"||typeof Xr.error!="object"||typeof Xr.isDynamicSdkError!="boolean"){const eo=new Error("ErrorBoundaryContext not found");throw eo.cause=ERROR_BOUNDARY_CONTEXT_NOT_FOUND,eo}}class ErrorBoundaryBase extends reactExports.Component{static getDerivedStateFromError(eo){return{error:eo,hasError:!0}}renderOrError(eo,{isDynamicSdkError:to}){try{assertErrorBoundaryContext(this.context),this.context.isDynamicSdkError=to}catch(ro){return logger$8.error(ro),reactExports.createElement(ErrorContainer,null,"ErrorBoundary must be used within ErrorBoundaryContext")}return eo}}ErrorBoundaryBase.contextType=ErrorBoundaryContext;class ErrorBoundaryReporter extends ErrorBoundaryBase{constructor(eo){super(eo),this.state={error:null,hasError:!1}}componentDidCatch(eo,to){var ro;const{onError:no}=this.props;throw!((ro=this.context)===null||ro===void 0)&&ro.isDynamicSdkError&&(no==null||no(eo,to),logger$8.error(eo,{error:{bundleStack:eo.stack,message:eo,stack:to.componentStack}})),eo}render(){const{children:eo}=this.props,{hasError:to,error:ro}=this.state;return to?(assertErrorBoundaryContext(this.context),this.context.error=ro,this.context.hasError=to,null):eo}}const ErrorBoundary=Xr=>{var{children:eo}=Xr,to=__rest$7(Xr,["children"]);return jsxRuntimeExports.jsx(ErrorBoundaryContext.Provider,{value:{error:null,hasError:!1,isDynamicSdkError:!0},children:jsxRuntimeExports.jsx(ErrorBoundaryReporter,Object.assign({},to,{children:eo}))})};class ErrorBoundaryExclude extends ErrorBoundaryBase{render(){const{children:eo}=this.props;return this.renderOrError(eo,{isDynamicSdkError:!1})}}const useResponseHandlers=()=>{const{walletConnectorOptions:Xr,consumeNonce:eo,displaySiweStatement:to,environmentId:ro,projectSettings:no,setIsSingleWalletAccount:io,connectWallet:oo,setShowAuthFlow:ao,setSelectedWalletConnectorKey:so,siweStatement:co,appName:lo,user:fo}=useInternalDynamicContext(),{setView:ho}=useViewContext(),{setErrorMessage:go}=useErrorContext(),{getCaptchaToken:yo}=useCaptchaContext(),vo=useVerifyWallet({consumeNonce:eo,displaySiweStatement:to,environmentId:ro,projectSettings:no,setIsSingleWalletAccount:io}),wo=Xr.map(({walletConnector:jo})=>jo).find(isPhantomRedirectConnector),Eo=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){wo&&(yield wo.getSession(),yield oo(wo),ao(!0,{ignoreIfIsEmbeddedWidget:!0}),ho("pending-signature"),so("phantom"))}),[oo,wo,so,ao,ho]),ko=useTransferWallet(),Ao=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!wo)return;so("phantom");const[jo]=yield wo.getConnectedAccounts();switch(wo.consumeMethod()){case"signAndSendTransaction":{const{signature:No}=wo.extractSignature();wo.emit("signAndSendTransaction",{signature:No});break}case"signAllTransactions":wo.emit("signAllTransactions",{transactions:wo.extractTransactions()});break;case"signTransaction":wo.emit("signTransaction",{transaction:wo.extractTransaction()});break;case"signMessage":{const{signature:No,message:Do}=wo.extractSignature(),Fo=StorageService.getItem(PHANTOM_SIGNATURE_STATE);if(StorageService.removeItem(PHANTOM_SIGNATURE_STATE),(Fo==null?void 0:Fo.verificationType)==="awaiting_transfer"){const Xo=getSiweStatement({appName:lo,siweStatement:co});yield ko({messageToSignOverride:Do,overrideSiweStatement:Xo,publicWalletAddress:jo,signedMessageOverride:No,skipEmptyAccountCheck:Fo.loseOriginalAccountOnTransfer,walletConnector:wo})}else(Fo==null?void 0:Fo.verificationType)==="awaiting_verification"||!fo?(ho("wallet-redirect-view"),yield vo({captchaToken:yo(),messageToSignOverride:Do,publicWalletAddress:jo,signedMessageOverride:No,walletConnector:wo})):wo.emit("signMessage",{signature:No});break}}}),[wo,so,fo,lo,co,ko,ho,vo,yo]),Po=reactExports.useCallback(jo=>{var Mo;if(!wo)return;const No=jo.get("errorCode"),Do=(Mo=jo.get("errorMessage"))!==null&&Mo!==void 0?Mo:void 0;if(!No)return;switch(go(No),jo.delete("errorCode"),jo.delete("errorMessage"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${jo.toString()}`),wo.consumeMethod()){case"signAndSendTransaction":wo.emit("signAndSendTransaction",{errorCode:No,errorMessage:Do});break;case"signAllTransactions":wo.emit("signAllTransactions",{errorCode:No,errorMessage:Do});break;case"signTransaction":wo.emit("signTransaction",{errorCode:No,errorMessage:Do});break;case"signMessage":wo.emit("signMessage",{errorCode:No,errorMessage:Do});break}},[wo,go]);return{handleConnectResponse:Eo,handleErrorResponse:Po,handleUserResponse:Ao,phantomRedirectConnector:wo}},PhantomRedirectContext=reactExports.createContext(void 0),PhantomRedirectContextProvider=({children:Xr})=>{const{sdkHasLoaded:eo}=useInternalDynamicContext(),{phantomRedirectConnector:to,handleConnectResponse:ro,handleUserResponse:no,handleErrorResponse:io}=useResponseHandlers();return reactExports.useEffect(()=>{if(!to||!isMobile$1()||!eo)return;const oo=new URLSearchParams(window.location.search);if(oo.has("errorCode")){io(oo);return}if(oo.has("phantom_encryption_public_key")){ro();return}if(oo.has("data")){no();return}},[ro,no,io,to,eo]),jsxRuntimeExports.jsx(PhantomRedirectContext.Provider,{value:{phantomRedirectConnector:to},children:Xr})},reinitializeContext=reactExports.createContext(void 0),ReinitializeContextProvider=({children:Xr,onReinitialize:eo})=>{const[to,ro]=reactExports.useState(),no=reactExports.useRef(eo);no.current=eo;const io=reactExports.useCallback(()=>{var oo;const ao=randomString(8);(oo=no.current)===null||oo===void 0||oo.call(no,ao),ro(ao)},[]);return jsxRuntimeExports.jsx(reinitializeContext.Provider,{value:{key:to,reinitialize:io},children:reactExports.cloneElement(Xr,{key:to})})},useConnectedWalletsNetworkValidation=()=>{const{connectedWallets:Xr,selectedWalletConnector:eo,setSelectedWalletConnectorKey:to,setShowAuthFlow:ro,bridgeChainsToConnect:no,sdkHasLoaded:io}=useInternalDynamicContext(),{setView:oo}=useViewContext(),ao=useIsLoggedIn(),so=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const fo=[];for(const ho of Xr){const go=no==null?void 0:no.some(wo=>wo.chain===ho.chain),yo=yield ho.connector.getNetwork(),vo=isSupportedNetwork({network:yo,walletConnector:ho.connector});!go&&!vo&&fo.push(ho)}return fo}),[no,Xr]),co=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const fo=yield so();if(!fo.length)return;const[ho]=fo;ho.connector.key!==(eo==null?void 0:eo.key)&&to(ho.connector.key);const go=isProgrammableNetworkSwitchSupported(ho.connector)?"network-not-supported":"network-not-supported-manual";ro(!0),oo(go)}),[so,eo==null?void 0:eo.key,to,ro,oo]),lo=reactExports.useMemo(()=>{const fo=Xr.map(({connector:go})=>go),ho=new Set([...fo].filter(go=>!!go));return Array.from(ho)},[Xr]);useWalletConnectorEvent(lo,"chainChange",({chain:fo})=>{co()}),reactExports.useEffect(()=>{!io||!ao||co()},[io,ao,co])},UseNetworkValidation=()=>(useConnectedWalletsNetworkValidation(),null),isDisplayOrderPriorityForWeb3=Xr=>{if(Xr.length!==2)return!1;const[eo,to]=Xr;return eo==="wallet"&&to==="email"},useDisplayOrderState=Xr=>{const[eo,to]=reactExports.useState(null),ro=reactExports.useMemo(()=>{var no;const io=(no=Xr==null?void 0:Xr.design.modal)===null||no===void 0?void 0:no.displayOrder;return io?isDisplayOrderPriorityForWeb3(io)?"web3":"web2":"web3"},[Xr]);return[eo||ro,to]},useEmailLoginState=(Xr,eo)=>{const[to,ro]=reactExports.useState(null),no=()=>{ro(null)},io=ao=>{ro(ao)},oo=reactExports.useMemo(()=>eo?!1:isEmailProviderEnabled(Xr),[Xr,eo]);return[to??oo,io,no]},useHandleLogout=Xr=>{const eo=reactExports.useRef(Xr);eo.current=Xr;const to=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const ro=eo.current;ro.setSelectedWalletConnectorKey(null),ro.clearAllWalletConnectSessions(),ro.setShowDynamicUserProfile(!1),ro.setShowBridgeWidget(!1),ro.resetLoginWithEmail(),ro.user&&(document.cookie=`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`,revokeSession({environmentId:ro.environmentId,sessionId:ro.user.sessionId})),ro.setLegacyIsVerifying(!1),StorageService.removeItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),StorageService.removeItem(AUTH_EXPIRES_AT),ro.setAuthMode(ro.initialAuthenticationMode),ro.setShowAuthFlow(!1,{emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!1,initializeWalletConnect:!1,performMultiWalletChecks:!1}),ro.setMultiWalletWidgetState("idle"),ro.removeConnectedWalletsInfo(),ro.removeBridgeOnboardingCompleted(),ro.clearPrimaryWalletId(),ro.removeConnectedNameService(),ro.removeSessionStorageSessionKeys(),dynamicEvents.removeListener("embeddedWalletCreatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletCreatePasswordFailed"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordFailed"),dynamicEvents.emit("logout"),setUser(void 0),yield Promise.all(ro.walletConnectors.map(no=>no.endSession())),yield Promise.all(ro.connectedWallets.map(no=>no.connector.endSession()))}),[]);return reactExports.useEffect(()=>(StorageService.events.on("parseFailure",to),()=>{StorageService.events.off("parseFailure",to)}),[to]),to},getWalletVerifiedCredential=(Xr,eo,to)=>eo==null?void 0:eo.find(({address:ro})=>isSameAddress$1(ro||"",Xr||"",to)),useNameService=({currentWallet:Xr,user:eo})=>{const[to,ro,no]=useLocalStorage(CONNECTED_WALLET_NAME_SERVICE,null),io=reactExports.useRef(),oo=reactExports.useRef(),ao=reactExports.useCallback(co=>__awaiter$j(void 0,void 0,void 0,function*(){const{address:lo,connector:fo}=co,ho=yield fo.getNetwork();if(lo===io.current&&ho===oo.current)return;ro(null),io.current=lo,oo.current=ho;let go;try{go=yield co.getNameService()}catch{}if(io.current===lo&&oo.current===ho)return ro({address:lo,avatar:go==null?void 0:go.avatar,name:go==null?void 0:go.name,network:ho}),go}),[ro]);return{getNameService:co=>__awaiter$j(void 0,void 0,void 0,function*(){var lo;if(!Xr)return;const fo=yield Xr.connector.getNetwork(),ho=eo==null?void 0:eo.verifiedCredentials;if(ho){const go=getWalletVerifiedCredential(Xr==null?void 0:Xr.address,ho,Xr.chain);if(go&&(!((lo=go.nameService)===null||lo===void 0)&&lo.name))return go.nameService}if(!(co&&(Xr==null?void 0:Xr.address)!==co))return to&&to.address===(Xr==null?void 0:Xr.address)&&to.network===fo?{avatar:to.avatar,name:to.name}:ao(Xr)}),removeConnectedNameService:no}},useSelectedWalletConnector=({walletConnectorOptions:Xr})=>{const[eo,to]=reactExports.useState(null);return{selectedWalletConnector:reactExports.useMemo(()=>{var no,io;return eo&&(io=(no=Xr.find(({walletConnector:oo})=>oo.key===eo))===null||no===void 0?void 0:no.walletConnector)!==null&&io!==void 0?io:null},[eo,Xr]),setSelectedWalletConnectorKey:to}},useShowAuthFlow=({isAuthenticated:Xr,isRenderingEmbeddedAuthFlow:eo,isMultiWalletEnabled:to,walletConnectorOptions:ro,setShowDynamicUserProfile:no})=>{const[io,oo]=reactExports.useState(!1),{setError:ao}=useErrorContext(),so=reactExports.useCallback((co,lo={})=>{var fo;const{emitCancelAuth:ho,ignoreIfIsEmbeddedWidget:go,initializeWalletConnect:yo,performMultiWalletChecks:vo,clearErrors:wo}=Object.assign({clearErrors:!0,emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!1},lo);if(logger$8.logVerboseTroubleshootingMessage("setShowAuthFlow",{clearErrors:wo,emitCancelAuth:ho,ignoreIfIsEmbeddedWidget:go,initializeWalletConnect:yo,performMultiWalletChecks:vo}),!io&&co?dynamicEvents.emit("authFlowOpen"):io&&!co&&dynamicEvents.emit("authFlowClose"),co){if(go&&eo.current)return;if(vo&&Xr){if(!to)return no(!0);logger$8.warn("Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext");return}yo&&((fo=ro.find(Eo=>Eo.walletConnector.key==="walletconnect"))===null||fo===void 0||fo.walletConnector.init())}else ho&&io&&dynamicEvents.emit("authFlowCancelled");wo&&ao(void 0),oo(co)},[Xr,to,eo,ao,no,io,ro]);return[io,so]},usePasskeySuccessPopup=()=>{const[Xr,eo]=reactExports.useState(void 0);return{passkeySuccessPopup:Xr,setPasskeySuccessPopup:ro=>{eo(ro),setTimeout(()=>{eo(void 0)},2e3)}}},useTieCallbacksToEvents=({clientCallbacks:Xr,user:eo})=>{useInternalDynamicEvents("emailVerificationResult",(to,ro)=>{var no;return(no=Xr==null?void 0:Xr.onOtpVerificationResult)===null||no===void 0?void 0:no.call(Xr,to,{type:"email",value:ro})}),useInternalDynamicEvents("smsVerificationResult",(to,ro)=>{var no;return(no=Xr==null?void 0:Xr.onOtpVerificationResult)===null||no===void 0?void 0:no.call(Xr,to,{type:"sms",value:ro})}),useInternalDynamicEvents("authFlowCancelled",()=>{var to;return(to=Xr==null?void 0:Xr.onAuthFlowCancel)===null||to===void 0?void 0:to.call(Xr)}),useInternalDynamicEvents("authFlowOpen",()=>{var to;(to=Xr==null?void 0:Xr.onAuthFlowOpen)===null||to===void 0||to.call(Xr)}),useInternalDynamicEvents("authFlowClose",()=>{var to;(to=Xr==null?void 0:Xr.onAuthFlowClose)===null||to===void 0||to.call(Xr)}),useInternalDynamicEvents("walletAdded",(to,ro)=>{var no;dynamicEvents.emit("triggerSessionValidation"),logger$8.debug("[walletAdded]",{userWallets:ro,wallet:to}),(no=Xr==null?void 0:Xr.onWalletAdded)===null||no===void 0||no.call(Xr,{userWallets:ro,wallet:to})}),useInternalDynamicEvents("walletRemoved",(to,ro)=>{var no;logger$8.debug("[walletRemoved]",{userWallets:ro,wallet:to}),(no=Xr==null?void 0:Xr.onWalletRemoved)===null||no===void 0||no.call(Xr,{userWallets:ro,wallet:to})}),useInternalDynamicEvents("embeddedWalletCreated",(to,ro,no)=>{var io;logger$8.debug("[embeddedWalletCreated]",{_wallet:to,jwtVerifiedCredential:ro,user:no}),(io=Xr==null?void 0:Xr.onEmbeddedWalletCreated)===null||io===void 0||io.call(Xr,ro,no)}),useInternalDynamicEvents("logout",()=>{var to;(to=Xr==null?void 0:Xr.onLogout)===null||to===void 0||to.call(Xr,eo)}),useInternalDynamicEvents("authFailure",(to,ro)=>{var no;logger$8.debug("[authFailure]",{data:to,reason:ro}),(no=Xr==null?void 0:Xr.onAuthFailure)===null||no===void 0||no.call(Xr,to,ro)}),useInternalDynamicEvents("authInit",to=>{var ro;logger$8.debug("[authInit]",{data:to}),(ro=Xr==null?void 0:Xr.onAuthInit)===null||ro===void 0||ro.call(Xr,to)})},useMultiWallet=({isBridgeFlow:Xr,multiWalletOverride:eo,multiWalletSettings:to})=>{var ro;return eo!==void 0?eo:(ro=to||Xr)!==null&&ro!==void 0?ro:!1},useMultiAsset=({multiAssetOverride:Xr,multiAssetSettings:eo})=>Xr!==void 0?Xr:eo??!0,useParentDynamicContextGuard=()=>{if(reactExports.useContext(DynamicContext))throw new Error("DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.")},useShowFiat=({showFiatOverride:Xr,showFiatSettings:eo})=>Xr!==void 0?Xr:eo??!0,isAuthenticatedWithAWallet=Xr=>{const eo=Xr.verifiedCredentials.find(to=>to.id===Xr.lastVerifiedCredentialId);return(eo==null?void 0:eo.format)===JwtVerifiedCredentialFormatEnum.Blockchain},useCustomerCallbacks=({callbacks:{onAuthSuccess:Xr,onUserProfileUpdate:eo},handleLogOut:to,primaryWallet:ro,user:no,isAuthenticated:io})=>{const[oo,ao]=reactExports.useState([]),so=reactExports.useCallback((lo,fo)=>{switch(lo==null?void 0:lo.callback){case"authSuccess":{try{Xr==null||Xr({handleLogOut:to,isAuthenticated:io,primaryWallet:ro,user:fo}),dynamicEvents.emit("triggerSessionValidation")}catch(ho){logger$8.error("Error calling onAuthSuccess: ",ho)}break}case"userProfileUpdate":{try{eo==null||eo(fo)}catch(ho){logger$8.error("Error calling userProfileUpdate: ",ho)}break}}},[to,io,Xr,eo,ro]);return reactExports.useEffect(()=>{!oo.length||!no||isAuthenticatedWithAWallet(no)&&!ro||(so(oo[0],no),ao(lo=>{const[fo,...ho]=lo;return fo&&(logger$8.debug("Resolved callback: ",fo.callback),logger$8.debug("Callbacks in queue: ",ho.map(go=>go.callback))),ho}))},[oo,so,ro,no]),{setCallback:reactExports.useCallback((lo,fo)=>{ao(ho=>[...ho,{callback:lo,params:fo}])},[])}},useRegisterStorageService=({storagePostfix:Xr})=>{const eo={clear:()=>{},getItem:()=>null,key:()=>null,length:0,removeItem:()=>{},setItem:()=>null},to=isSSR()?eo:window.localStorage,ro=isSSR()?eo:window.sessionStorage;StorageService.getSourceStorage("localStorage")||StorageService.registerSourceStorage("localStorage",createStorageService({postfix:Xr,storage:to})),StorageService.getSourceStorage("sessionStorage")||StorageService.registerSourceStorage("sessionStorage",createStorageService({postfix:Xr,storage:ro}))};var define_process_env_default$5={};const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID="2762a57b-faa4-41ce-9f16-abff9300e2c9",DynamicContext=reactExports.createContext(void 0),InnerDynamicContextProvider=({children:Xr,theme:eo,settings:to,locale:ro,enableInstrumentation:no=!1})=>{var io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo,Eo,ko;const{accessDeniedMessagePrimary:Ao,accessDeniedMessageSecondary:Po,accessDeniedButton:jo,defaultPhoneInputIso2:Mo,apiBaseUrl:No,coinbaseWalletPreference:Do,detectNewWalletsForLinking:Fo=!1,enableConnectOnlyFallback:Xo=!1,deepLinkPreference:Lo="native",bridgeChains:Bo,cssOverrides:xo,defaultNumberOfWalletsToShow:uo=DEFAULT_NUMBER_OF_WALLETS_TO_SHOW,flowNetwork:po,initialAuthenticationMode:bo="connect-and-sign",debugError:_o=!1,displaySiweStatement:$o=!0,newToWeb3WalletChainMap:Co,enableVisitTrackingOnConnectOnly:Ro=!0,environmentId:So,walletsFilter:mo,logLevel:To="WARN",mobileExperience:Vo,notInTheListImageUrl:Zo,onboardingImageUrl:Qo,policiesConsentInnerComponent:qo,customPrivacyPolicy:Ho,privacyPolicyUrl:$a,socialMediaLinkText:zo,socialMediaIconUrl:Ko,socialMediaUrl:_c,customTermsOfServices:Cl,termsOfServiceUrl:ga,toolkitEnabled:El,siweStatement:Al,shadowDOMEnabled:Ol=!0,walletConnectors:Wl,socialProvidersFilter:zl,showLockedWalletView:Tl=!1,walletConnectPreferredChains:Ml,walletConnectorExtensions:ou,recommendedWallets:Vl,handlers:Ll}=to;useRegisterStorageService({storagePostfix:to.localStorageSuffix}),initializeStore({environmentId:So,storageSuffix:to.localStorageSuffix}),setChainInfoOverrides((io=to.overrides)===null||io===void 0?void 0:io.chainDisplayValues);const uu=(oo=to.events)!==null&&oo!==void 0?oo:to.eventsCallbacks,ru=resolveNetworkValidationMode({bridgeChains:to.bridgeChains,networkValidationMode:to.networkValidationMode});let{appLogoUrl:tu="https://demo.dynamic.xyz/assets/dynamic-logo.svg",appName:ku="Dynamic Example"}=to;if(!So)throw new MissingEnvironmentIdError;logger$8.setLogLevel(To),logger$9.setLogLevel(To),So===PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID&&logger$8.warn(`WARNING: DYNAMIC is using a test environment ID ${So}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`),ApiEndpoint$1.setBaseUrl((ao=define_process_env_default$5.DYNAMIC_API_BASE_URL)!==null&&ao!==void 0?ao:No);const au=Locale.setup(ro),wl=!!Bo,Jo=getDeepLinkPreference(Lo,wl),{selectedTabIndex:Go,setSelectedTabIndex:$l,selectedTabSettings:Zl,tabsItems:Ul}=useTabState({settingsOverrides:to.overrides}),[Gl,Nu,hu]=useLocalStorage(BRIDGE_ONBOARDING_COMPLETED,!1),[cu,Wu]=reactExports.useState(!1),[mu,yu]=reactExports.useState(!1),[Yu,_u]=reactExports.useState(!1),{user:Il,userWithMissingInfo:Nl}=useUser(),Pl=!!Il;Il?logger$8.setMetaData("user",Il):logger$8.setMetaData("user",void 0);const{consumeNonce:Bl}=useFetchNonce(So),[fu,eu]=reactExports.useState(""),[Xl,$u]=reactExports.useState(""),[Yo,_l,{awaiting_account_switch:[Sl],awaiting_signature:[Wo]}]=useMultiWalletWidgetState(),{settings:xl}=useProjectSettings(),Ql=useNetworkConfigurationsFromProjectSettings({cosmosNetworkOverrides:(so=to.overrides)===null||so===void 0?void 0:so.cosmosNetworks,evmNetworksOverrides:(co=to.overrides)===null||co===void 0?void 0:co.evmNetworks,projectSettings:xl});useSendDynamicProps({environmentId:So,settings:to});const Fl=useMultiWallet({isBridgeFlow:wl,multiWalletOverride:(lo=to.overrides)===null||lo===void 0?void 0:lo.multiWallet,multiWalletSettings:(fo=xl==null?void 0:xl.sdk)===null||fo===void 0?void 0:fo.multiWallet}),Jl=useMultiAsset({multiAssetOverride:(ho=to.overrides)===null||ho===void 0?void 0:ho.multiAsset,multiAssetSettings:(go=xl==null?void 0:xl.sdk)===null||go===void 0?void 0:go.enableMultiAsset}),xu=useShowFiat({showFiatOverride:(yo=to.overrides)===null||yo===void 0?void 0:yo.showFiat,showFiatSettings:(vo=xl==null?void 0:xl.sdk)===null||vo===void 0?void 0:vo.showFiat}),[lu,su]=reactExports.useState(!1),Xu=useWalletBookCdn(),{imageUserInAccessList:ju,imageUserNotInAccessList:zu,displayName:Ku,appLogo:Hu}=(xl==null?void 0:xl.general)||{};tu=Hu||tu,ku=Ku||ku;const[Gu,Zu,Vu]=useEmailLoginState((xl==null?void 0:xl.providers)||[],Il),[Ju,Uu]=useDisplayOrderState(xl),[qu,Mu]=useWalletUiUtils({appLogoUrl:tu,appName:ku,hideEmbeddedWalletTransactionUIs:!(!((Eo=(wo=xl==null?void 0:xl.sdk)===null||wo===void 0?void 0:wo.embeddedWallets)===null||Eo===void 0)&&Eo.showEmbeddedWalletActionsUI)});useCreateWalletConnectorOptions({appLogoUrl:tu,appName:ku,coinbaseWalletPreference:Do,deepLinkPreference:Jo,flowNetwork:po,mobileExperience:Vo,networkConfigurations:Ql,projectSettings:xl,walletBook:Xu,walletConnectPreferredChains:Ml,walletConnectorExtensions:ou,walletConnectorsProp:Wl,walletUiUtils:Mu});const Bu=useWalletConnectorOptions(),[Au,Du]=useLocalStorage(AUTH_MODE,bo),{clearPrimaryWalletId:wu,primaryWalletId:vu,setPrimaryWalletId:Cu}=usePrimaryWalletId({environmentId:So,user:Il}),[Eu,Ru]=reactExports.useState(!1),Lu=!!(Au==="connect-and-sign"?Il:Eu),ep=reactExports.useRef(!1),[rp,ip]=useShowAuthFlow({isAuthenticated:Lu,isMultiWalletEnabled:Fl,isRenderingEmbeddedAuthFlow:ep,setShowDynamicUserProfile:Wu,walletConnectorOptions:Bu}),{connectWallet:np,removeConnectedWalletsInfo:nu,connectedWalletsInfo:lp,getConnectedWalletById:yp,connectedWallets:up,disconnectWallet:op,refreshConnectedWallet:bp}=useConnectWallet({authMode:Au,clearPrimaryWalletId:wu,enableVisitTrackingOnConnectOnly:Ro,environmentId:So,handleConnectedWallet:Ll==null?void 0:Ll.handleConnectedWallet,isBridgeFlow:wl,primaryWalletId:vu,setPrimaryWalletId:Cu,setShowAuthFlow:ip,user:Il,walletConnectorOptions:Bu}),dp=reactExports.useMemo(()=>getMissingChains(Bo,lp),[Bo,lp]),{selectedWalletConnector:Ep,setSelectedWalletConnectorKey:pp}=useSelectedWalletConnector({walletConnectorOptions:Bu}),[wp,Ap]=reactExports.useState(null);useSetWalletConnectorVerifiedCredentials(Il??Nl,Bu),useSetWalletConnectorFetchers(Bu,So);const{primaryWallet:fp,showQrcodeModal:Tp,secondaryWallets:Lp,setPrimaryWallet:zp,setShowQrcodeModal:Hp,wallets:r0}=useWalletConnectors({authMode:Au,canHaveMultipleWalletsConnected:Fl,connectedWallets:up,primaryWalletId:vu,setMultiWalletWidgetState:_l,setPrimaryWalletId:Cu,user:Il||Nl,walletConnectorOptions:Bu});reactExports.useEffect(()=>{Ru(!(dp!=null&&dp.length)&&!!fp)},[dp,fp]);const p0=r0.map(Tu=>Tu.connector);useFetchProjectSettings({environmentId:So});const{getNameService:Em,removeConnectedNameService:A0}=useNameService({currentWallet:fp??up[0],user:Il}),{clearAllWalletConnectSessions:n0}=useClearWalletConnectSessions({connectors:p0}),Pm=useHandleLogout({bridgeChains:Bo,clearAllWalletConnectSessions:n0,clearPrimaryWalletId:wu,connectedWallets:up,environmentId:So,events:uu,initialAuthenticationMode:bo,removeBridgeOnboardingCompleted:hu,removeConnectedNameService:A0,removeConnectedWalletsInfo:nu,removeSessionStorageSessionKeys:()=>{StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),p0.forEach(Tu=>{isSessionKeyCompatibleWalletConnector(Tu)&&typeof(Tu==null?void 0:Tu.removeSessionKeys)=="function"&&(Tu==null||Tu.removeSessionKeys())})},resetLoginWithEmail:Vu,setAuthMode:Du,setLegacyIsVerifying:su,setMultiWalletWidgetState:_l,setSelectedWalletConnectorKey:pp,setShowAuthFlow:ip,setShowBridgeWidget:yu,setShowDynamicUserProfile:Wu,user:Il,walletConnectors:p0});useValidateSession({environmentId:So,handleLogOut:Pm});const{isLoading:g0}=useResetCookieLocalStorage({environmentId:So,projectSettings:xl,setPrimaryWalletId:Cu}),P0=useGlobalLoading({appName:ku,authMode:Au,connectedInfo:lp[0],connectedWallets:up,enableInstrumentation:no,environmentId:So,isLoadingUserFromCookie:g0,primaryWallet:fp,primaryWalletId:vu,projectSettings:xl,user:Il??Nl,walletBook:Xu});useTieCallbacksToEvents({clientCallbacks:uu,user:Il});const Vm=useHandleUnlinkWallet({environmentId:So,primaryWalletId:vu,secondaryWallets:Lp,verifiedCredentials:(Il==null?void 0:Il.verifiedCredentials)||[]}),{isLoading:y0,network:v0}=useWalletConnectorNetwork(fp==null?void 0:fp.connector);useWalletEventListeners({authMode:Au,detectNewWalletsForLinking:Fo,disconnectWallet:op,handleLogOut:Pm,multiWallet:Fl,multiWalletWidgetState:Yo,primaryWallet:fp,refreshConnectedWallet:bp,secondaryWallets:Lp,selectedWalletConnector:Ep,selectedWalletWithAction:wp,setMultiWalletWidgetState:_l,setPrimaryWalletId:Cu,setSelectedWalletConnectorKey:pp,setSelectedWalletWithAction:Ap,user:Il});const{walletsForChainsMap:Um}=useFetchWalletsForChainsMap(Co);reactExports.useEffect(()=>{initExpirationTime(Pm)},[Pm,Pl]);const{setCallback:b0}=useCustomerCallbacks({callbacks:{onAuthSuccess:uu==null?void 0:uu.onAuthSuccess,onUserProfileUpdate:uu==null?void 0:uu.onUserProfileUpdate},handleLogOut:Pm,isAuthenticated:Pl,primaryWallet:fp,user:Il}),O0=reactExports.useCallback(()=>Tu=>{const{dynamicWagmiSettings:_f}=Tu;_f&&sendDynamicProps(So,{dynamicWagmiSettings:{dynamicWagmiSettings:_f}})},[So]),Pp=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){$u(""),su(!1),Il||n0(),_l("idle"),Au!=="connect-only"&&nu(),StorageService.getItem(WALLET_PICKER_SEARCH_KEY)&&StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),Ep&&(!fp||fp.connector.key!==Ep.key)&&(yield Ep==null?void 0:Ep.endSession())}),[Il,_l,Au,Ep,fp,n0,nu]),{passkeySuccessPopup:Ip,setPasskeySuccessPopup:Yl}=usePasskeySuccessPopup(),pu=reactExports.useMemo(()=>{var Tu;return{accessDeniedButton:jo,accessDeniedMessagePrimary:Ao,accessDeniedMessageSecondary:Po,accountSwitchState:Sl,appLogoUrl:tu,appName:ku,authMode:Au,authToken:getAuthToken(),authorizationViewDisplayOrder:Ju,awaitingSignatureState:Wo,bridgeChains:Bo,bridgeChainsToConnect:dp,bridgeOnboardingCompleted:Gl,clearStatesOnBackClick:Pp,connectWallet:np,connectedWallets:up,consumeNonce:Bl,cssOverrides:xo,customPrivacyPolicy:Ho,customTermsOfServices:Cl,debugError:_o,defaultNumberOfWalletsToShow:uo,defaultPhoneInputIso2:Mo,desktopUri:Xl,detectNewWalletsForLinking:Fo,disconnectWallet:op,displaySiweStatement:$o,enableConnectOnlyFallback:Xo,environmentId:So,events:uu,getConnectedWalletById:yp,getNameService:Em,handleLogOut:Pm,handleUnlinkWallet:Au==="connect-only"?op:Vm,handlers:Ll,i18nSDKInstance:au,isBridgeFlow:wl,isRenderingEmbeddedAuthFlow:ep,isSingleWalletAccount:Yu,legacyIsVerifying:lu,linkedWallets:Au==="connect-only"||!Il?[]:r0,loadingNetwork:y0,locale:{changeLanguage:Locale.getInstance().changeLanguage},loginWithEmail:Gu,minAuthToken:getMinAuthToken$1(),multiAsset:Jl,multiWallet:Fl,multiWalletWidgetState:Yo,network:v0,networkConfigurations:Ql,networkValidationMode:ru,newToWeb3WalletChainMap:Um,notInTheListImageUrl:zu||Zo,onboardingImageUrl:ju||Qo,overrides:to.overrides,passkeySuccessPopup:Ip,policiesConsentInnerComponent:qo,primaryWallet:fp,primaryWalletId:vu,privacyPolicyUrl:$a,projectSettings:xl,qrcodeUri:fu,recommendedWallets:Vl,redirectUrl:to.redirectUrl,removeBridgeOnboardingCompleted:hu,removeConnectedWalletsInfo:nu,sdkHasLoaded:P0,secondaryWallets:Lp,selectedTabIndex:Go,selectedTabSettings:Zl,selectedWalletConnector:Ep,selectedWalletWithAction:wp,sendWagmiSettings:O0,setAuthMode:Du,setAuthorizationViewDisplayOrder:Uu,setBridgeOnboardingCompleted:Nu,setCallback:b0,setDesktopUri:$u,setIsSingleWalletAccount:_u,setLegacyIsVerifying:su,setLogInWithEmail:Zu,setMultiWalletWidgetState:_l,setPasskeySuccessPopup:Yl,setPrimaryWallet:zp,setPrimaryWalletId:Cu,setQrcodeUri:eu,setSelectedTabIndex:$l,setSelectedWalletConnectorKey:pp,setSelectedWalletWithAction:Ap,setShowAuthFlow:ip,setShowBridgeWidget:yu,setShowDynamicUserProfile:Wu,setShowQrcodeModal:Hp,shadowDOMEnabled:Ol,showAuthFlow:rp,showBridgeWidget:mu,showDynamicUserProfile:cu,showFiat:xu,showLockedWalletView:Tl,showQrcodeModal:Tp,siweStatement:Al,socialMediaIconUrl:((Tu=xl==null?void 0:xl.general)===null||Tu===void 0?void 0:Tu.supportUrls)||Ko,socialMediaLinkText:zo,socialMediaUrl:_c,socialProvidersFilter:zl,socialSettings:to.social,tabsItems:Ul,termsOfServiceUrl:ga,theme:eo,toolkitEnabled:El,user:Il,userWithMissingInfo:Nl,walletConnectorOptions:Bu,walletUiUtils:Mu,walletsFilter:mo}},[jo,Ao,Po,Sl,tu,ku,Au,Ju,Wo,Bo,dp,Gl,Pp,np,up,Bl,xo,Ho,Cl,_o,uo,Mo,Xl,Fo,op,$o,Xo,So,uu,yp,Em,Pm,Vm,Ll,au,wl,Yu,lu,Il,r0,y0,Gu,Jl,Fl,Yo,v0,Ql,ru,Um,zu,Zo,ju,Qo,to.overrides,to.redirectUrl,to.social,Ip,qo,fp,vu,$a,xl,fu,Vl,hu,nu,P0,Lp,Go,Zl,Ep,wp,O0,Du,Uu,Nu,b0,Zu,_l,Yl,zp,Cu,$l,pp,ip,Hp,Ol,rp,mu,cu,xu,Tl,Tp,Al,Ko,zo,_c,zl,Ul,ga,eo,El,Nl,Bu,Mu,mo]);return usePrefetch({as:"image",href:getIconicSpriteUrl$1(),id:"sprite",type:"image/svg+xml"}),usePrefetch({as:"fetch",href:getWalletBookCdnUrl(),id:"wallet-book",type:"application/json"}),usePrefetch({as:"fetch",href:`${ApiEndpoint$1.getBaseUrl()}/sdk/${So}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION$4}`)}`,id:`project-settings-${So}`,type:"application/json"}),reactExports.useEffect(()=>{!Fl&&Yo!=="awaiting_account_switch"||Il&&Yo!=="idle"&&!cu&&Wu(!0)},[Fl,Yo,cu]),jsxRuntimeExports.jsx(I18nextProvider,{i18n:au,children:jsxRuntimeExports.jsx(DynamicContext.Provider,{value:pu,children:jsxRuntimeExports.jsx(WalletBookContextProvider,{walletBook:Xu,children:jsxRuntimeExports.jsx(ThemeContextProvider,{customerTheme:parseTheme(eo,((ko=xl==null?void 0:xl.design)===null||ko===void 0?void 0:ko.modal)||void 0),designSettings:xl==null?void 0:xl.design,children:jsxRuntimeExports.jsx(LoadingContextProvider,{children:jsxRuntimeExports.jsxs(ViewContextProvider,{initialView:getInitialView({bridgeOnboardingCompleted:Gl,connectedWallets:up,isAuthenticated:Pl||!!fp,isBridgeFlow:wl,isMultiWalletEnabled:Fl}),children:[ru==="always"&&jsxRuntimeExports.jsx(UseNetworkValidation,{}),jsxRuntimeExports.jsx(CaptchaContextProvider,{children:jsxRuntimeExports.jsx(AccountExistsContextProvider,{children:jsxRuntimeExports.jsx(WalletContextProvider,{children:jsxRuntimeExports.jsx(VerificationProvider,{children:jsxRuntimeExports.jsx(PasskeyContextProvider,{children:jsxRuntimeExports.jsx(DynamicWidgetContextProvider,{children:jsxRuntimeExports.jsx(DynamicBridgeWidgetContextProvider,{children:jsxRuntimeExports.jsx(FundingContextProvider,{children:jsxRuntimeExports.jsx(AccessDeniedContextProvider,{children:jsxRuntimeExports.jsx(SendBalanceContextProvider,{children:jsxRuntimeExports.jsx(WalletGroupContextProvider,{children:jsxRuntimeExports.jsx(UserFieldEditorContextProvider,{children:jsxRuntimeExports.jsx(ConnectWithOtpProvider,{children:jsxRuntimeExports.jsx(PhantomRedirectContextProvider,{children:jsxRuntimeExports.jsxs(SocialRedirectContextProvider,{children:[jsxRuntimeExports.jsx(DynamicAuthFlow,{}),jsxRuntimeExports.jsx(Toolkit,{}),jsxRuntimeExports.jsx(FundingWidget,{}),jsxRuntimeExports.jsx(SyncAuthFlow,{}),jsxRuntimeExports.jsx(TelegramAutoLogin,{}),jsxRuntimeExports.jsx(WalletConnectorEvents,{}),qu,jsxRuntimeExports.jsx(ErrorBoundaryExclude,{children:Xr})]})})})})})})})})})})})})})})})]})})})})})})},DynamicContextProvider=Xr=>(Logger$2.setEnvironmentId(Xr.settings.environmentId),Logger$2.setEmitErrors(Xr.emitErrors),useParentDynamicContextGuard(),jsxRuntimeExports.jsx(ReinitializeContextProvider,{onReinitialize:removeStoreInstance,children:jsxRuntimeExports.jsx(ErrorBoundary,{children:jsxRuntimeExports.jsx(ErrorContextProvider,{children:jsxRuntimeExports.jsx(UserWalletsProvider,{children:jsxRuntimeExports.jsx(FieldsStateProvider,{children:jsxRuntimeExports.jsx(IpConfigurationContextProvider,{children:jsxRuntimeExports.jsx(WidgetRegistryContextProvider,{children:jsxRuntimeExports.jsx(InnerDynamicContextProvider,Object.assign({},Xr))})})})})})})}));assertPackageVersion("@dynamic-labs/sdk-react-core",version$u);function Signup(){const[Xr,eo]=reactExports.useState(1),[to,ro]=reactExports.useState(!1),[no,io]=reactExports.useState(null),[oo,ao]=reactExports.useState([]),[so,co]=reactExports.useState(Array(12).fill("")),{setShowAuthFlow:lo,primaryWallet:fo,handleLogOut:ho}=useDynamicContext(),[go,yo]=reactExports.useState(null),{dispatch:vo}=useGlobalState(),wo=useNavigate();reactExports.useEffect(()=>{if(no!=null&&no.mnemonic){const Do=no.mnemonic.split(" ");co(Do)}},[no]);const Eo=()=>eo(Xr+1),ko=async()=>{if(no){ro(!0);try{await no.registerPushAccount(),vo({type:"INITIALIZE_WALLET",payload:no}),wo("/")}catch(Do){alert(Do)}ro(!1)}},Ao=async()=>{try{const Do=await PushWallet.signUp(config$3.APP_ENV);io(Do),ao(Object.keys(Do.walletToEncDerivedKey))}catch(Do){alert(Do)}},Po=async()=>{const Do=await PushSigner.initialize(fo,"DYNAMIC");await(no==null?void 0:no.connectWalletWithAccount(Do)),ao(Object.keys(no.walletToEncDerivedKey))},jo=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 text-center",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("button",{onClick:async()=>{yo("mnemonic"),await Ao()},className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64 mx-10",children:"Using Mnemonic"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("button",{onClick:()=>yo("social"),className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-lg w-64",disabled:!0,children:["Social Signup ",jsxRuntimeExports.jsx("br",{})," Coming Soon 🚀"]})})]}),Mo=()=>{const Do=()=>{const Fo=so.join(" ");navigator.clipboard.writeText(Fo).then(()=>alert("Copied to clipboard")).catch(()=>alert("Failed to copy"))};return jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("h2",{className:"text-2xl mb-6",children:"Store Seed Phrase Safely"}),jsxRuntimeExports.jsx(MnemonicGrid,{words:so,disabled:!0}),jsxRuntimeExports.jsx("button",{className:"border border-blue-600 text-blue-600 px-4 py-2 rounded-lg w-30",onClick:Do,children:"Copy"}),jsxRuntimeExports.jsx("p",{className:"mb-6 mt-20 text-gray-600",children:"Your wallet needs to be registered on the Push network to be able to send transactions on the network."}),jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-40",onClick:Eo,children:"Next"})]})},No=()=>jsxRuntimeExports.jsxs("div",{className:"text-center space-y-6 mt-6",children:[jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-4",children:fo?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("button",{className:"border border-blue-600 text-blue-600 px-6 py-3 rounded-md",onClick:()=>{ho()},children:["Disconnect ",jsxRuntimeExports.jsx("b",{children:fo.address})]}),jsxRuntimeExports.jsx("button",{className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",onClick:Po,children:"Add to Push Account"})]}):jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",onClick:()=>lo(!0),children:"Connect Web3 Account"})}),jsxRuntimeExports.jsx("button",{disabled:to,onClick:ko,className:to?"w-full py-3 bg-grey flex items-center justify-center":"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:to?"Registering":jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Register Push Account"]})})]});return jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"p-8 w-full max-w-4xl",children:[Xr===1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!go&&jo(),go==="mnemonic"&&Mo()]}),Xr===2&&jsxRuntimeExports.jsx("div",{className:"space-y-2 text-center",children:oo.map(Do=>jsxRuntimeExports.jsx("div",{className:"inline-flex items-center bg-blue-100 text-blue-800 text-sm font-medium rounded-full px-4 py-2 border border-blue-300",children:jsxRuntimeExports.jsx("span",{className:"font-mono",children:Do})},Do))}),Xr===2&&No()]})})}function Login(){const[Xr,eo]=reactExports.useState(null),[to,ro]=reactExports.useState(Array(12).fill("")),{setShowAuthFlow:no,primaryWallet:io,handleLogOut:oo}=useDynamicContext(),{dispatch:ao}=useGlobalState(),so=useNavigate(),co=(yo,vo)=>{const wo=[...to];wo[yo]=vo,ro(wo)},lo=async()=>{try{let yo;switch(Xr){case"mnemonic":{yo=await PushWallet.logInWithMnemonic(to.join(" "),config$3.APP_ENV);break}case"wallet":{const vo=await PushSigner.initialize(io,"DYNAMIC");yo=await PushWallet.loginWithWallet(vo,config$3.APP_ENV);break}}ao({type:"INITIALIZE_WALLET",payload:yo}),so("/")}catch(yo){alert(yo)}},fo=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 text-center",children:[jsxRuntimeExports.jsx("button",{onClick:()=>eo("mnemonic"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",children:"Using Mnemonic"}),jsxRuntimeExports.jsx("button",{onClick:()=>eo("wallet"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",children:"Using Web3 Account"}),jsxRuntimeExports.jsxs("button",{onClick:()=>eo("social"),className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-lg w-64",disabled:!0,children:["Social Login ",jsxRuntimeExports.jsx("br",{})," Coming Soon 🚀"]})]}),ho=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx(MnemonicGrid,{words:to,disabled:!1,handleMnemonicChange:co}),jsxRuntimeExports.jsxs("button",{onClick:lo,disabled:to.some(yo=>yo===""),className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Unlock Push Account"]})]}),go=()=>jsxRuntimeExports.jsxs("div",{className:"text-center space-y-6",children:[jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-4",children:io?jsxRuntimeExports.jsxs("button",{className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-md",onClick:()=>{oo()},children:["Disconnect ",io.address]}):jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",onClick:()=>no(!0),children:"Connect Web3 Account"})}),jsxRuntimeExports.jsxs("button",{onClick:lo,disabled:!io,className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Unlock Push Account"]})]});return jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"p-8 w-full max-w-lg",children:[!Xr&&fo(),Xr==="mnemonic"&&ho(),Xr==="wallet"&&go()]})})}const __vite_import_meta_env__={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"};var define_process_env_default$4={};function getAppBasePath(){if(typeof import.meta<"u"&&__vite_import_meta_env__)return"/push-wallet/";if(typeof process$1$1<"u"&&define_process_env_default$4){if(define_process_env_default$4.VITE_DEV_MODE==="preview")return"/push-wallet/pr-preview/";if(define_process_env_default$4.VITE_DEV_MODE==="testing")return"/push-wallet/"}return"/"}function App(){return jsxRuntimeExports.jsx(GlobalProvider,{children:jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex flex-col",children:[jsxRuntimeExports.jsx("h1",{className:"text-4xl font-bold mt-8 text-center",children:config$3.APP_NAME}),jsxRuntimeExports.jsx("div",{className:"flex-1 flex items-center justify-center",children:jsxRuntimeExports.jsx(BrowserRouter,{basename:getAppBasePath(),children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"login",element:jsxRuntimeExports.jsx(Login,{})}),jsxRuntimeExports.jsx(Route,{path:"signup",element:jsxRuntimeExports.jsx(Signup,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/"})})]})})})]})})}var version$j="3.4.4";function __awaiter$i(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var funcTag="[object Function]",genTag="[object GeneratorFunction]",reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal||freeSelf||Function("return this")();function getValue$1(Xr,eo){return Xr==null?void 0:Xr[eo]}function isHostObject(Xr){var eo=!1;if(Xr!=null&&typeof Xr.toString!="function")try{eo=!!(Xr+"")}catch{}return eo}var funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root$1["__core-js_shared__"],maskSrcKey=function(){var Xr=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return Xr?"Symbol(src)_1."+Xr:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString$1=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root$1.Symbol;Symbol$1&&Symbol$1.isConcatSpreadable;getNative(root$1,"Map");getNative(Object,"create");function baseIsNative(Xr){if(!isObject$8(Xr)||isMasked(Xr))return!1;var eo=isFunction(Xr)||isHostObject(Xr)?reIsNative:reIsHostCtor;return eo.test(toSource(Xr))}function getNative(Xr,eo){var to=getValue$1(Xr,eo);return baseIsNative(to)?to:void 0}function isMasked(Xr){return!!maskSrcKey&&maskSrcKey in Xr}function toSource(Xr){if(Xr!=null){try{return funcToString.call(Xr)}catch{}try{return Xr+""}catch{}}return""}function isFunction(Xr){var eo=isObject$8(Xr)?objectToString$1.call(Xr):"";return eo==funcTag||eo==genTag}function isObject$8(Xr){var eo=typeof Xr;return!!Xr&&(eo=="object"||eo=="function")}var store2;function getGlobalMessage(Xr){return store2==null?void 0:store2.get(Xr)}var store3;function getSchemaMessage(Xr){return store3==null?void 0:store3.get(Xr)}var store4;function getSpecificMessage(Xr,eo){var to;return(to=store4==null?void 0:store4.get(Xr))==null?void 0:to.get(eo)}function _stringify(Xr){var to,ro;let eo=typeof Xr;return eo==="object"&&(eo=(Xr&&((ro=(to=Object.getPrototypeOf(Xr))==null?void 0:to.constructor)==null?void 0:ro.name))??"null"),eo==="string"?`"${Xr}"`:eo==="number"||eo==="bigint"||eo==="boolean"?`${Xr}`:eo}function _addIssue(Xr,eo,to,ro,no){const io=no&&"input"in no?no.input:to.value,oo=(no==null?void 0:no.expected)??Xr.expects??null,ao=(no==null?void 0:no.received)??_stringify(io),so={kind:Xr.kind,type:Xr.type,input:io,expected:oo,received:ao,message:`Invalid ${eo}: ${oo?`Expected ${oo} but r`:"R"}eceived ${ao}`,requirement:Xr.requirement,path:no==null?void 0:no.path,issues:no==null?void 0:no.issues,lang:ro.lang,abortEarly:ro.abortEarly,abortPipeEarly:ro.abortPipeEarly},co=Xr.kind==="schema",lo=(no==null?void 0:no.message)??Xr.message??getSpecificMessage(Xr.reference,so.lang)??(co?getSchemaMessage(so.lang):null)??ro.message??getGlobalMessage(so.lang);lo&&(so.message=typeof lo=="function"?lo(so):lo),co&&(to.typed=!1),to.issues?to.issues.push(so):to.issues=[so]}function _isValidObjectKey(Xr,eo){return Object.hasOwn(Xr,eo)&&eo!=="__proto__"&&eo!=="prototype"&&eo!=="constructor"}function getDefault(Xr,eo,to){return typeof Xr.default=="function"?Xr.default(eo,to):Xr.default}function is$7(Xr,eo){return!Xr._run({typed:!1,value:eo},{abortEarly:!0}).issues}function array$3(Xr,eo){return{kind:"schema",type:"array",reference:array$3,expects:"Array",async:!1,item:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(Array.isArray(no)){to.typed=!0,to.value=[];for(let oo=0;ooisNaN(+ro)).map(([,ro])=>ro);return{kind:"schema",type:"enum",reference:enum_,expects:to.map(_stringify).join(" | ")||"never",async:!1,enum:Xr,options:to,message:eo,_run(ro,no){return this.options.includes(ro.value)?ro.typed=!0:_addIssue(this,"type",ro,no),ro}}}function literal$3(Xr,eo){return{kind:"schema",type:"literal",reference:literal$3,expects:_stringify(Xr),async:!1,literal:Xr,message:eo,_run(to,ro){return to.value===this.literal?to.typed=!0:_addIssue(this,"type",to,ro),to}}}function looseObject(Xr,eo){return{kind:"schema",type:"loose_object",reference:looseObject,expects:"Object",async:!1,entries:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(no&&typeof no=="object"){to.typed=!0,to.value={};for(const oo in this.entries){const ao=no[oo],so=this.entries[oo]._run({typed:!1,value:ao},ro);if(so.issues){const co={type:"object",origin:"value",input:no,key:oo,value:ao};for(const lo of so.issues)lo.path?lo.path.unshift(co):lo.path=[co],(io=to.issues)==null||io.push(lo);if(to.issues||(to.issues=so.issues),ro.abortEarly){to.typed=!1;break}}so.typed||(to.typed=!1),(so.value!==void 0||oo in no)&&(to.value[oo]=so.value)}if(!to.issues||!ro.abortEarly)for(const oo in no)_isValidObjectKey(no,oo)&&!(oo in this.entries)&&(to.value[oo]=no[oo])}else _addIssue(this,"type",to,ro);return to}}}function nonOptional(Xr,eo){return{kind:"schema",type:"non_optional",reference:nonOptional,expects:"!undefined",async:!1,wrapped:Xr,message:eo,_run(to,ro){return to.value===void 0?(_addIssue(this,"type",to,ro),to):this.wrapped._run(to,ro)}}}function null_(Xr){return{kind:"schema",type:"null",reference:null_,expects:"null",async:!1,message:Xr,_run(eo,to){return eo.value===null?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function nullish(Xr,...eo){const to={kind:"schema",type:"nullish",reference:nullish,expects:`${Xr.expects} | null | undefined`,async:!1,wrapped:Xr,_run(ro,no){return(ro.value===null||ro.value===void 0)&&("default"in this&&(ro.value=getDefault(this,ro,no)),ro.value===null||ro.value===void 0)?(ro.typed=!0,ro):this.wrapped._run(ro,no)}};return 0 in eo&&(to.default=eo[0]),to}function number$4(Xr){return{kind:"schema",type:"number",reference:number$4,expects:"number",async:!1,message:Xr,_run(eo,to){return typeof eo.value=="number"&&!isNaN(eo.value)?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function object(Xr,eo){return{kind:"schema",type:"object",reference:object,expects:"Object",async:!1,entries:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(no&&typeof no=="object"){to.typed=!0,to.value={};for(const oo in this.entries){const ao=no[oo],so=this.entries[oo]._run({typed:!1,value:ao},ro);if(so.issues){const co={type:"object",origin:"value",input:no,key:oo,value:ao};for(const lo of so.issues)lo.path?lo.path.unshift(co):lo.path=[co],(io=to.issues)==null||io.push(lo);if(to.issues||(to.issues=so.issues),ro.abortEarly){to.typed=!1;break}}so.typed||(to.typed=!1),(so.value!==void 0||oo in no)&&(to.value[oo]=so.value)}}else _addIssue(this,"type",to,ro);return to}}}function optional$4(Xr,...eo){const to={kind:"schema",type:"optional",reference:optional$4,expects:`${Xr.expects} | undefined`,async:!1,wrapped:Xr,_run(ro,no){return ro.value===void 0&&("default"in this&&(ro.value=getDefault(this,ro,no)),ro.value===void 0)?(ro.typed=!0,ro):this.wrapped._run(ro,no)}};return 0 in eo&&(to.default=eo[0]),to}function picklist(Xr,eo){return{kind:"schema",type:"picklist",reference:picklist,expects:Xr.map(_stringify).join(" | ")||"never",async:!1,options:Xr,message:eo,_run(to,ro){return this.options.includes(to.value)?to.typed=!0:_addIssue(this,"type",to,ro),to}}}function string$4(Xr){return{kind:"schema",type:"string",reference:string$4,expects:"string",async:!1,message:Xr,_run(eo,to){return typeof eo.value=="string"?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function undefined_(Xr){return{kind:"schema",type:"undefined",reference:undefined_,expects:"undefined",async:!1,message:Xr,_run(eo,to){return eo.value===void 0?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function _subIssues(Xr){let eo;if(Xr)for(const to of Xr)eo?eo.push(...to.issues):eo=to.issues;return eo}function union$3(Xr,eo){return{kind:"schema",type:"union",reference:union$3,expects:[...new Set(Xr.map(to=>to.expects))].join(" | ")||"never",async:!1,options:Xr,message:eo,_run(to,ro){let no,io,oo;for(const ao of this.options){const so=ao._run({typed:!1,value:to.value},ro);if(so.typed)if(so.issues)io?io.push(so):io=[so];else{no=so;break}else oo?oo.push(so):oo=[so]}if(no)return no;if(io){if(io.length===1)return io[0];_addIssue(this,"type",to,ro,{issues:_subIssues(io)}),to.typed=!0}else{if((oo==null?void 0:oo.length)===1)return oo[0];_addIssue(this,"type",to,ro,{issues:_subIssues(oo)})}return to}}}function unknown$3(){return{kind:"schema",type:"unknown",reference:unknown$3,expects:"unknown",async:!1,_run(Xr){return Xr.typed=!0,Xr}}}var lib$2={},signer={},base64Url={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$6=0,len=code.length;i$60)throw new Error("Invalid string. Length must be a multiple of 4");var to=Xr.indexOf("=");to===-1&&(to=eo);var ro=to===eo?0:4-to%4;return[to,ro]}function byteLength(Xr){var eo=getLens(Xr),to=eo[0],ro=eo[1];return(to+ro)*3/4-ro}function _byteLength(Xr,eo,to){return(eo+to)*3/4-to}function toByteArray(Xr){var eo,to=getLens(Xr),ro=to[0],no=to[1],io=new Arr(_byteLength(Xr,ro,no)),oo=0,ao=no>0?ro-4:ro,so;for(so=0;so>16&255,io[oo++]=eo>>8&255,io[oo++]=eo&255;return no===2&&(eo=revLookup[Xr.charCodeAt(so)]<<2|revLookup[Xr.charCodeAt(so+1)]>>4,io[oo++]=eo&255),no===1&&(eo=revLookup[Xr.charCodeAt(so)]<<10|revLookup[Xr.charCodeAt(so+1)]<<4|revLookup[Xr.charCodeAt(so+2)]>>2,io[oo++]=eo>>8&255,io[oo++]=eo&255),io}function tripletToBase64(Xr){return lookup[Xr>>18&63]+lookup[Xr>>12&63]+lookup[Xr>>6&63]+lookup[Xr&63]}function encodeChunk(Xr,eo,to){for(var ro,no=[],io=eo;ioao?ao:oo+io));return ro===1?(eo=Xr[to-1],no.push(lookup[eo>>2]+lookup[eo<<4&63]+"==")):ro===2&&(eo=(Xr[to-2]<<8)+Xr[to-1],no.push(lookup[eo>>10]+lookup[eo>>4&63]+lookup[eo<<2&63]+"=")),no.join("")}Object.defineProperty(base64Url,"__esModule",{value:!0});base64Url.decode=base64Url.encode=base64Url.unescape=base64Url.escape=base64Url.pad=void 0;const base64_js_1$1=base64Js;function pad(Xr){return`${Xr}${"=".repeat(4-(Xr.length%4||4))}`}base64Url.pad=pad;function escape(Xr){return Xr.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}base64Url.escape=escape;function unescape$1(Xr){return pad(Xr).replace(/-/g,"+").replace(/_/g,"/")}base64Url.unescape=unescape$1;function encode$n(Xr){return escape((0,base64_js_1$1.fromByteArray)(new TextEncoder().encode(Xr)))}base64Url.encode=encode$n;function decode$q(Xr){return new TextDecoder().decode((0,base64_js_1$1.toByteArray)(pad(unescape$1(Xr))))}base64Url.decode=decode$q;var cryptoClients={},secp256k1$1={};const require$$0$a=getAugmentedNamespace(hmac$5);var lib$1={},cryptoBrowserify={},browser$g={exports:{}},safeBuffer$1={exports:{}};const require$$0$9=getAugmentedNamespace(dist$2);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(Xr,eo){var to=require$$0$9,ro=to.Buffer;function no(oo,ao){for(var so in oo)ao[so]=oo[so]}ro.from&&ro.alloc&&ro.allocUnsafe&&ro.allocUnsafeSlow?Xr.exports=to:(no(to,eo),eo.Buffer=io);function io(oo,ao,so){return ro(oo,ao,so)}io.prototype=Object.create(ro.prototype),no(ro,io),io.from=function(oo,ao,so){if(typeof oo=="number")throw new TypeError("Argument must not be a number");return ro(oo,ao,so)},io.alloc=function(oo,ao,so){if(typeof oo!="number")throw new TypeError("Argument must be a number");var co=ro(oo);return ao!==void 0?typeof so=="string"?co.fill(ao,so):co.fill(ao):co.fill(0),co},io.allocUnsafe=function(oo){if(typeof oo!="number")throw new TypeError("Argument must be a number");return ro(oo)},io.allocUnsafeSlow=function(oo){if(typeof oo!="number")throw new TypeError("Argument must be a number");return to.SlowBuffer(oo)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,hasRequiredBrowser$b;function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$g.exports;hasRequiredBrowser$b=1;var Xr=65536,eo=4294967295;function to(){throw new Error(`Secure random number generation is not supported by this browser. -Use Chrome, Firefox or Internet Explorer 11`)}var ro=safeBufferExports.Buffer,no=commonjsGlobal.crypto||commonjsGlobal.msCrypto;no&&no.getRandomValues?browser$g.exports=io:browser$g.exports=to;function io(oo,ao){if(oo>eo)throw new RangeError("requested too many random bytes");var so=ro.allocUnsafe(oo);if(oo>0)if(oo>Xr)for(var co=0;co0&&(oo=to[0]),oo instanceof Error)throw oo;var ao=new Error("Unhandled error."+(oo?" ("+oo.message+")":""));throw ao.context=oo,ao}var so=io[eo];if(so===void 0)return!1;if(typeof so=="function")ReflectApply(so,this,to);else for(var co=so.length,lo=arrayClone(so,co),ro=0;ro0&&oo.length>no&&!oo.warned){oo.warned=!0;var ao=new Error("Possible EventEmitter memory leak detected. "+oo.length+" "+String(eo)+" listeners added. Use emitter.setMaxListeners() to increase limit");ao.name="MaxListenersExceededWarning",ao.emitter=Xr,ao.type=eo,ao.count=oo.length,ProcessEmitWarning(ao)}return Xr}EventEmitter.prototype.addListener=function(eo,to){return _addListener(this,eo,to,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(eo,to){return _addListener(this,eo,to,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(Xr,eo,to){var ro={fired:!1,wrapFn:void 0,target:Xr,type:eo,listener:to},no=onceWrapper.bind(ro);return no.listener=to,ro.wrapFn=no,no}EventEmitter.prototype.once=function(eo,to){return checkListener(to),this.on(eo,_onceWrap(this,eo,to)),this};EventEmitter.prototype.prependOnceListener=function(eo,to){return checkListener(to),this.prependListener(eo,_onceWrap(this,eo,to)),this};EventEmitter.prototype.removeListener=function(eo,to){var ro,no,io,oo,ao;if(checkListener(to),no=this._events,no===void 0)return this;if(ro=no[eo],ro===void 0)return this;if(ro===to||ro.listener===to)--this._eventsCount===0?this._events=Object.create(null):(delete no[eo],no.removeListener&&this.emit("removeListener",eo,ro.listener||to));else if(typeof ro!="function"){for(io=-1,oo=ro.length-1;oo>=0;oo--)if(ro[oo]===to||ro[oo].listener===to){ao=ro[oo].listener,io=oo;break}if(io<0)return this;io===0?ro.shift():spliceOne(ro,io),ro.length===1&&(no[eo]=ro[0]),no.removeListener!==void 0&&this.emit("removeListener",eo,ao||to)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(eo){var to,ro,no;if(ro=this._events,ro===void 0)return this;if(ro.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ro[eo]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete ro[eo]),this;if(arguments.length===0){var io=Object.keys(ro),oo;for(no=0;no=0;no--)this.removeListener(eo,to[no]);return this};function _listeners(Xr,eo,to){var ro=Xr._events;if(ro===void 0)return[];var no=ro[eo];return no===void 0?[]:typeof no=="function"?to?[no.listener||no]:[no]:to?unwrapListeners(no):arrayClone(no,no.length)}EventEmitter.prototype.listeners=function(eo){return _listeners(this,eo,!0)};EventEmitter.prototype.rawListeners=function(eo){return _listeners(this,eo,!1)};EventEmitter.listenerCount=function(Xr,eo){return typeof Xr.listenerCount=="function"?Xr.listenerCount(eo):listenerCount.call(Xr,eo)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(Xr){var eo=this._events;if(eo!==void 0){var to=eo[Xr];if(typeof to=="function")return 1;if(to!==void 0)return to.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(Xr,eo){for(var to=new Array(eo),ro=0;ro"u"||!vo?Xr:vo(Uint8Array),ko={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Xr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Xr:ArrayBuffer,"%ArrayIteratorPrototype%":go&&vo?vo([][Symbol.iterator]()):Xr,"%AsyncFromSyncIteratorPrototype%":Xr,"%AsyncFunction%":wo,"%AsyncGenerator%":wo,"%AsyncGeneratorFunction%":wo,"%AsyncIteratorPrototype%":wo,"%Atomics%":typeof Atomics>"u"?Xr:Atomics,"%BigInt%":typeof BigInt>"u"?Xr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Xr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Xr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Xr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eo,"%eval%":eval,"%EvalError%":to,"%Float32Array%":typeof Float32Array>"u"?Xr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Xr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Xr:FinalizationRegistry,"%Function%":so,"%GeneratorFunction%":wo,"%Int8Array%":typeof Int8Array>"u"?Xr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Xr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Xr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":go&&vo?vo(vo([][Symbol.iterator]())):Xr,"%JSON%":typeof JSON=="object"?JSON:Xr,"%Map%":typeof Map>"u"?Xr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!go||!vo?Xr:vo(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Xr:Promise,"%Proxy%":typeof Proxy>"u"?Xr:Proxy,"%RangeError%":ro,"%ReferenceError%":no,"%Reflect%":typeof Reflect>"u"?Xr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Xr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!go||!vo?Xr:vo(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Xr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":go&&vo?vo(""[Symbol.iterator]()):Xr,"%Symbol%":go?Symbol:Xr,"%SyntaxError%":io,"%ThrowTypeError%":ho,"%TypedArray%":Eo,"%TypeError%":oo,"%Uint8Array%":typeof Uint8Array>"u"?Xr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Xr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Xr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Xr:Uint32Array,"%URIError%":ao,"%WeakMap%":typeof WeakMap>"u"?Xr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Xr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Xr:WeakSet};if(vo)try{null.error}catch(_o){var Ao=vo(vo(_o));ko["%Error.prototype%"]=Ao}var Po=function _o($o){var Co;if($o==="%AsyncFunction%")Co=co("async function () {}");else if($o==="%GeneratorFunction%")Co=co("function* () {}");else if($o==="%AsyncGeneratorFunction%")Co=co("async function* () {}");else if($o==="%AsyncGenerator%"){var Ro=_o("%AsyncGeneratorFunction%");Ro&&(Co=Ro.prototype)}else if($o==="%AsyncIteratorPrototype%"){var So=_o("%AsyncGenerator%");So&&vo&&(Co=vo(So.prototype))}return ko[$o]=Co,Co},jo={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Mo=requireFunctionBind(),No=requireHasown(),Do=Mo.call(Function.call,Array.prototype.concat),Fo=Mo.call(Function.apply,Array.prototype.splice),Xo=Mo.call(Function.call,String.prototype.replace),Lo=Mo.call(Function.call,String.prototype.slice),Bo=Mo.call(Function.call,RegExp.prototype.exec),xo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,uo=/\\(\\)?/g,po=function($o){var Co=Lo($o,0,1),Ro=Lo($o,-1);if(Co==="%"&&Ro!=="%")throw new io("invalid intrinsic syntax, expected closing `%`");if(Ro==="%"&&Co!=="%")throw new io("invalid intrinsic syntax, expected opening `%`");var So=[];return Xo($o,xo,function(mo,To,Vo,Zo){So[So.length]=Vo?Xo(Zo,uo,"$1"):To||mo}),So},bo=function($o,Co){var Ro=$o,So;if(No(jo,Ro)&&(So=jo[Ro],Ro="%"+So[0]+"%"),No(ko,Ro)){var mo=ko[Ro];if(mo===wo&&(mo=Po(Ro)),typeof mo>"u"&&!Co)throw new oo("intrinsic "+$o+" exists, but is not available. Please file an issue!");return{alias:So,name:Ro,value:mo}}throw new io("intrinsic "+$o+" does not exist!")};return getIntrinsic=function($o,Co){if(typeof $o!="string"||$o.length===0)throw new oo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Co!="boolean")throw new oo('"allowMissing" argument must be a boolean');if(Bo(/^%?[^%]*%?$/,$o)===null)throw new io("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Ro=po($o),So=Ro.length>0?Ro[0]:"",mo=bo("%"+So+"%",Co),To=mo.name,Vo=mo.value,Zo=!1,Qo=mo.alias;Qo&&(So=Qo[0],Fo(Ro,Do([0,1],Qo)));for(var qo=1,Ho=!0;qo=Ro.length){var _c=lo(Vo,$a);Ho=!!_c,Ho&&"get"in _c&&!("originalValue"in _c.get)?Vo=_c.get:Vo=Vo[$a]}else Ho=No(Vo,$a),Vo=Vo[$a];Ho&&!Zo&&(ko[To]=Vo)}}return Vo},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var Xr=requireGetIntrinsic(),eo=Xr("%Object.defineProperty%",!0)||!1;if(eo)try{eo({},"a",{value:1})}catch{eo=!1}return esDefineProperty=eo,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var Xr=requireGetIntrinsic(),eo=Xr("%Object.getOwnPropertyDescriptor%",!0);if(eo)try{eo([],"length")}catch{eo=null}return gopd=eo,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var Xr=requireEsDefineProperty(),eo=requireSyntax(),to=requireType(),ro=requireGopd();return defineDataProperty=function(io,oo,ao){if(!io||typeof io!="object"&&typeof io!="function")throw new to("`obj` must be an object or a function`");if(typeof oo!="string"&&typeof oo!="symbol")throw new to("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new to("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new to("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new to("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new to("`loose`, if provided, must be a boolean");var so=arguments.length>3?arguments[3]:null,co=arguments.length>4?arguments[4]:null,lo=arguments.length>5?arguments[5]:null,fo=arguments.length>6?arguments[6]:!1,ho=!!ro&&ro(io,oo);if(Xr)Xr(io,oo,{configurable:lo===null&&ho?ho.configurable:!lo,enumerable:so===null&&ho?ho.enumerable:!so,value:ao,writable:co===null&&ho?ho.writable:!co});else if(fo||!so&&!co&&!lo)io[oo]=ao;else throw new eo("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var Xr=requireEsDefineProperty(),eo=function(){return!!Xr};return eo.hasArrayLengthDefineBug=function(){if(!Xr)return null;try{return Xr([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=eo,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var Xr=requireGetIntrinsic(),eo=requireDefineDataProperty(),to=requireHasPropertyDescriptors()(),ro=requireGopd(),no=requireType(),io=Xr("%Math.floor%");return setFunctionLength=function(ao,so){if(typeof ao!="function")throw new no("`fn` is not a function");if(typeof so!="number"||so<0||so>4294967295||io(so)!==so)throw new no("`length` must be a positive 32-bit integer");var co=arguments.length>2&&!!arguments[2],lo=!0,fo=!0;if("length"in ao&&ro){var ho=ro(ao,"length");ho&&!ho.configurable&&(lo=!1),ho&&!ho.writable&&(fo=!1)}return(lo||fo||!co)&&(to?eo(ao,"length",so,!0,!0):eo(ao,"length",so)),ao},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(Xr){var eo=requireFunctionBind(),to=requireGetIntrinsic(),ro=requireSetFunctionLength(),no=requireType(),io=to("%Function.prototype.apply%"),oo=to("%Function.prototype.call%"),ao=to("%Reflect.apply%",!0)||eo.call(oo,io),so=requireEsDefineProperty(),co=to("%Math.max%");Xr.exports=function(ho){if(typeof ho!="function")throw new no("a function is required");var go=ao(eo,oo,arguments);return ro(go,1+co(0,ho.length-(arguments.length-1)),!0)};var lo=function(){return ao(eo,io,arguments)};so?so(Xr.exports,"apply",{value:lo}):Xr.exports.apply=lo}(callBind)),callBind.exports}var callBound,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var Xr=requireGetIntrinsic(),eo=requireCallBind(),to=eo(Xr("String.prototype.indexOf"));return callBound=function(no,io){var oo=Xr(no,!!io);return typeof oo=="function"&&to(no,".prototype.")>-1?eo(oo):oo},callBound}var isArguments,hasRequiredIsArguments;function requireIsArguments(){if(hasRequiredIsArguments)return isArguments;hasRequiredIsArguments=1;var Xr=requireShams()(),eo=requireCallBound(),to=eo("Object.prototype.toString"),ro=function(ao){return Xr&&ao&&typeof ao=="object"&&Symbol.toStringTag in ao?!1:to(ao)==="[object Arguments]"},no=function(ao){return ro(ao)?!0:ao!==null&&typeof ao=="object"&&typeof ao.length=="number"&&ao.length>=0&&to(ao)!=="[object Array]"&&to(ao.callee)==="[object Function]"},io=function(){return ro(arguments)}();return ro.isLegacyArguments=no,isArguments=io?ro:no,isArguments}var isGeneratorFunction,hasRequiredIsGeneratorFunction;function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var Xr=Object.prototype.toString,eo=Function.prototype.toString,to=/^\s*(?:function)?\*/,ro=requireShams()(),no=Object.getPrototypeOf,io=function(){if(!ro)return!1;try{return Function("return function*() {}")()}catch{}},oo;return isGeneratorFunction=function(so){if(typeof so!="function")return!1;if(to.test(eo.call(so)))return!0;if(!ro){var co=Xr.call(so);return co==="[object GeneratorFunction]"}if(!no)return!1;if(typeof oo>"u"){var lo=io();oo=lo?no(lo):!1}return no(so)===oo},isGeneratorFunction}var isCallable,hasRequiredIsCallable;function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var Xr=Function.prototype.toString,eo=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,to,ro;if(typeof eo=="function"&&typeof Object.defineProperty=="function")try{to=Object.defineProperty({},"length",{get:function(){throw ro}}),ro={},eo(function(){throw 42},null,to)}catch(ko){ko!==ro&&(eo=null)}else eo=null;var no=/^\s*class\b/,io=function(Ao){try{var Po=Xr.call(Ao);return no.test(Po)}catch{return!1}},oo=function(Ao){try{return io(Ao)?!1:(Xr.call(Ao),!0)}catch{return!1}},ao=Object.prototype.toString,so="[object Object]",co="[object Function]",lo="[object GeneratorFunction]",fo="[object HTMLAllCollection]",ho="[object HTML document.all class]",go="[object HTMLCollection]",yo=typeof Symbol=="function"&&!!Symbol.toStringTag,vo=!(0 in[,]),wo=function(){return!1};if(typeof document=="object"){var Eo=document.all;ao.call(Eo)===ao.call(document.all)&&(wo=function(Ao){if((vo||!Ao)&&(typeof Ao>"u"||typeof Ao=="object"))try{var Po=ao.call(Ao);return(Po===fo||Po===ho||Po===go||Po===so)&&Ao("")==null}catch{}return!1})}return isCallable=eo?function(Ao){if(wo(Ao))return!0;if(!Ao||typeof Ao!="function"&&typeof Ao!="object")return!1;try{eo(Ao,null,to)}catch(Po){if(Po!==ro)return!1}return!io(Ao)&&oo(Ao)}:function(Ao){if(wo(Ao))return!0;if(!Ao||typeof Ao!="function"&&typeof Ao!="object")return!1;if(yo)return oo(Ao);if(io(Ao))return!1;var Po=ao.call(Ao);return Po!==co&&Po!==lo&&!/^\[object HTML/.test(Po)?!1:oo(Ao)},isCallable}var forEach_1,hasRequiredForEach;function requireForEach(){if(hasRequiredForEach)return forEach_1;hasRequiredForEach=1;var Xr=requireIsCallable(),eo=Object.prototype.toString,to=Object.prototype.hasOwnProperty,ro=function(so,co,lo){for(var fo=0,ho=so.length;fo=3&&(fo=lo),eo.call(so)==="[object Array]"?ro(so,co,fo):typeof so=="string"?no(so,co,fo):io(so,co,fo)};return forEach_1=oo,forEach_1}var possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames;function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames||(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),possibleTypedArrayNames}var availableTypedArrays,hasRequiredAvailableTypedArrays;function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var Xr=requirePossibleTypedArrayNames(),eo=typeof globalThis>"u"?commonjsGlobal:globalThis;return availableTypedArrays=function(){for(var ro=[],no=0;no"u"?commonjsGlobal:globalThis,so=eo(),co=ro("String.prototype.slice"),lo=Object.getPrototypeOf,fo=ro("Array.prototype.indexOf",!0)||function(wo,Eo){for(var ko=0;ko-1?Eo:Eo!=="Object"?!1:yo(wo)}return no?go(wo):null},whichTypedArray}var isTypedArray,hasRequiredIsTypedArray;function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray;hasRequiredIsTypedArray=1;var Xr=requireWhichTypedArray();return isTypedArray=function(to){return!!Xr(to)},isTypedArray}var hasRequiredTypes$2;function requireTypes$2(){return hasRequiredTypes$2||(hasRequiredTypes$2=1,function(Xr){var eo=requireIsArguments(),to=requireIsGeneratorFunction(),ro=requireWhichTypedArray(),no=requireIsTypedArray();function io(zl){return zl.call.bind(zl)}var oo=typeof BigInt<"u",ao=typeof Symbol<"u",so=io(Object.prototype.toString),co=io(Number.prototype.valueOf),lo=io(String.prototype.valueOf),fo=io(Boolean.prototype.valueOf);if(oo)var ho=io(BigInt.prototype.valueOf);if(ao)var go=io(Symbol.prototype.valueOf);function yo(zl,Tl){if(typeof zl!="object")return!1;try{return Tl(zl),!0}catch{return!1}}Xr.isArgumentsObject=eo,Xr.isGeneratorFunction=to,Xr.isTypedArray=no;function vo(zl){return typeof Promise<"u"&&zl instanceof Promise||zl!==null&&typeof zl=="object"&&typeof zl.then=="function"&&typeof zl.catch=="function"}Xr.isPromise=vo;function wo(zl){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(zl):no(zl)||To(zl)}Xr.isArrayBufferView=wo;function Eo(zl){return ro(zl)==="Uint8Array"}Xr.isUint8Array=Eo;function ko(zl){return ro(zl)==="Uint8ClampedArray"}Xr.isUint8ClampedArray=ko;function Ao(zl){return ro(zl)==="Uint16Array"}Xr.isUint16Array=Ao;function Po(zl){return ro(zl)==="Uint32Array"}Xr.isUint32Array=Po;function jo(zl){return ro(zl)==="Int8Array"}Xr.isInt8Array=jo;function Mo(zl){return ro(zl)==="Int16Array"}Xr.isInt16Array=Mo;function No(zl){return ro(zl)==="Int32Array"}Xr.isInt32Array=No;function Do(zl){return ro(zl)==="Float32Array"}Xr.isFloat32Array=Do;function Fo(zl){return ro(zl)==="Float64Array"}Xr.isFloat64Array=Fo;function Xo(zl){return ro(zl)==="BigInt64Array"}Xr.isBigInt64Array=Xo;function Lo(zl){return ro(zl)==="BigUint64Array"}Xr.isBigUint64Array=Lo;function Bo(zl){return so(zl)==="[object Map]"}Bo.working=typeof Map<"u"&&Bo(new Map);function xo(zl){return typeof Map>"u"?!1:Bo.working?Bo(zl):zl instanceof Map}Xr.isMap=xo;function uo(zl){return so(zl)==="[object Set]"}uo.working=typeof Set<"u"&&uo(new Set);function po(zl){return typeof Set>"u"?!1:uo.working?uo(zl):zl instanceof Set}Xr.isSet=po;function bo(zl){return so(zl)==="[object WeakMap]"}bo.working=typeof WeakMap<"u"&&bo(new WeakMap);function _o(zl){return typeof WeakMap>"u"?!1:bo.working?bo(zl):zl instanceof WeakMap}Xr.isWeakMap=_o;function $o(zl){return so(zl)==="[object WeakSet]"}$o.working=typeof WeakSet<"u"&&$o(new WeakSet);function Co(zl){return $o(zl)}Xr.isWeakSet=Co;function Ro(zl){return so(zl)==="[object ArrayBuffer]"}Ro.working=typeof ArrayBuffer<"u"&&Ro(new ArrayBuffer);function So(zl){return typeof ArrayBuffer>"u"?!1:Ro.working?Ro(zl):zl instanceof ArrayBuffer}Xr.isArrayBuffer=So;function mo(zl){return so(zl)==="[object DataView]"}mo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&mo(new DataView(new ArrayBuffer(1),0,1));function To(zl){return typeof DataView>"u"?!1:mo.working?mo(zl):zl instanceof DataView}Xr.isDataView=To;var Vo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Zo(zl){return so(zl)==="[object SharedArrayBuffer]"}function Qo(zl){return typeof Vo>"u"?!1:(typeof Zo.working>"u"&&(Zo.working=Zo(new Vo)),Zo.working?Zo(zl):zl instanceof Vo)}Xr.isSharedArrayBuffer=Qo;function qo(zl){return so(zl)==="[object AsyncFunction]"}Xr.isAsyncFunction=qo;function Ho(zl){return so(zl)==="[object Map Iterator]"}Xr.isMapIterator=Ho;function $a(zl){return so(zl)==="[object Set Iterator]"}Xr.isSetIterator=$a;function zo(zl){return so(zl)==="[object Generator]"}Xr.isGeneratorObject=zo;function Ko(zl){return so(zl)==="[object WebAssembly.Module]"}Xr.isWebAssemblyCompiledModule=Ko;function _c(zl){return yo(zl,co)}Xr.isNumberObject=_c;function Cl(zl){return yo(zl,lo)}Xr.isStringObject=Cl;function ga(zl){return yo(zl,fo)}Xr.isBooleanObject=ga;function El(zl){return oo&&yo(zl,ho)}Xr.isBigIntObject=El;function Al(zl){return ao&&yo(zl,go)}Xr.isSymbolObject=Al;function Ol(zl){return _c(zl)||Cl(zl)||ga(zl)||El(zl)||Al(zl)}Xr.isBoxedPrimitive=Ol;function Wl(zl){return typeof Uint8Array<"u"&&(So(zl)||Qo(zl))}Xr.isAnyArrayBuffer=Wl,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(zl){Object.defineProperty(Xr,zl,{enumerable:!1,value:function(){throw new Error(zl+" is not supported in userland")}})})}(types$8)),types$8}var isBufferBrowser,hasRequiredIsBufferBrowser;function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser||(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(eo){return eo&&typeof eo=="object"&&typeof eo.copy=="function"&&typeof eo.fill=="function"&&typeof eo.readUInt8=="function"}),isBufferBrowser}var hasRequiredUtil$1;function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,function(Xr){var eo={},to=Object.getOwnPropertyDescriptors||function(Vo){for(var Zo=Object.keys(Vo),Qo={},qo=0;qo=qo)return zo;switch(zo){case"%s":return String(Qo[Zo++]);case"%d":return Number(Qo[Zo++]);case"%j":try{return JSON.stringify(Qo[Zo++])}catch{return"[Circular]"}default:return zo}}),$a=Qo[Zo];Zo"u")return function(){return Xr.deprecate(To,Vo).apply(this,arguments)};var Zo=!1;function Qo(){if(!Zo){if(process$1$1.throwDeprecation)throw new Error(Vo);process$1$1.traceDeprecation?console.trace(Vo):console.error(Vo),Zo=!0}return To.apply(this,arguments)}return Qo};var no={},io=/^$/;if(eo.NODE_DEBUG){var oo=eo.NODE_DEBUG;oo=oo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),io=new RegExp("^"+oo+"$","i")}Xr.debuglog=function(To){if(To=To.toUpperCase(),!no[To])if(io.test(To)){var Vo=process$1$1.pid;no[To]=function(){var Zo=Xr.format.apply(Xr,arguments);console.error("%s %d: %s",To,Vo,Zo)}}else no[To]=function(){};return no[To]};function ao(To,Vo){var Zo={seen:[],stylize:co};return arguments.length>=3&&(Zo.depth=arguments[2]),arguments.length>=4&&(Zo.colors=arguments[3]),ko(Vo)?Zo.showHidden=Vo:Vo&&Xr._extend(Zo,Vo),Do(Zo.showHidden)&&(Zo.showHidden=!1),Do(Zo.depth)&&(Zo.depth=2),Do(Zo.colors)&&(Zo.colors=!1),Do(Zo.customInspect)&&(Zo.customInspect=!0),Zo.colors&&(Zo.stylize=so),fo(Zo,To,Zo.depth)}Xr.inspect=ao,ao.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]},ao.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function so(To,Vo){var Zo=ao.styles[Vo];return Zo?"\x1B["+ao.colors[Zo][0]+"m"+To+"\x1B["+ao.colors[Zo][1]+"m":To}function co(To,Vo){return To}function lo(To){var Vo={};return To.forEach(function(Zo,Qo){Vo[Zo]=!0}),Vo}function fo(To,Vo,Zo){if(To.customInspect&&Vo&&xo(Vo.inspect)&&Vo.inspect!==Xr.inspect&&!(Vo.constructor&&Vo.constructor.prototype===Vo)){var Qo=Vo.inspect(Zo,To);return Mo(Qo)||(Qo=fo(To,Qo,Zo)),Qo}var qo=ho(To,Vo);if(qo)return qo;var Ho=Object.keys(Vo),$a=lo(Ho);if(To.showHidden&&(Ho=Object.getOwnPropertyNames(Vo)),Bo(Vo)&&(Ho.indexOf("message")>=0||Ho.indexOf("description")>=0))return go(Vo);if(Ho.length===0){if(xo(Vo)){var zo=Vo.name?": "+Vo.name:"";return To.stylize("[Function"+zo+"]","special")}if(Fo(Vo))return To.stylize(RegExp.prototype.toString.call(Vo),"regexp");if(Lo(Vo))return To.stylize(Date.prototype.toString.call(Vo),"date");if(Bo(Vo))return go(Vo)}var Ko="",_c=!1,Cl=["{","}"];if(Eo(Vo)&&(_c=!0,Cl=["[","]"]),xo(Vo)){var ga=Vo.name?": "+Vo.name:"";Ko=" [Function"+ga+"]"}if(Fo(Vo)&&(Ko=" "+RegExp.prototype.toString.call(Vo)),Lo(Vo)&&(Ko=" "+Date.prototype.toUTCString.call(Vo)),Bo(Vo)&&(Ko=" "+go(Vo)),Ho.length===0&&(!_c||Vo.length==0))return Cl[0]+Ko+Cl[1];if(Zo<0)return Fo(Vo)?To.stylize(RegExp.prototype.toString.call(Vo),"regexp"):To.stylize("[Object]","special");To.seen.push(Vo);var El;return _c?El=yo(To,Vo,Zo,$a,Ho):El=Ho.map(function(Al){return vo(To,Vo,Zo,$a,Al,_c)}),To.seen.pop(),wo(El,Ko,Cl)}function ho(To,Vo){if(Do(Vo))return To.stylize("undefined","undefined");if(Mo(Vo)){var Zo="'"+JSON.stringify(Vo).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return To.stylize(Zo,"string")}if(jo(Vo))return To.stylize(""+Vo,"number");if(ko(Vo))return To.stylize(""+Vo,"boolean");if(Ao(Vo))return To.stylize("null","null")}function go(To){return"["+Error.prototype.toString.call(To)+"]"}function yo(To,Vo,Zo,Qo,qo){for(var Ho=[],$a=0,zo=Vo.length;$a-1&&(Ho?zo=zo.split(` -`).map(function(_c){return" "+_c}).join(` +Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[Xr,eo]=reactExports.useState("idle"),to=reactExports.useCallback(()=>{eo("idle")},[eo]),ro=reactExports.useCallback((no,io)=>{validateMultiWalletWidgetState(io),validateStateTransition$1({from:Xr,to:no}),eo(no)},[Xr]);return[Xr,ro,to]},validTransitions={awaiting_account_switch:["awaiting_signature","idle"],awaiting_connection:["idle"],awaiting_signature:["idle"],detected_new_wallet:["awaiting_signature","idle"],idle:["awaiting_account_switch","awaiting_connection","awaiting_signature","detected_new_wallet"]},validateStateTransition=({from:Xr,to:eo})=>{if(Xr!==eo&&!validTransitions[Xr].includes(eo))throw new Error(`Invalid MultiWalletWidget state transition from ${Xr} to ${eo}`);return!0},useMultiWalletWidgetState=()=>{const[Xr,eo]=reactExports.useState("idle"),[to,ro,no]=useAwaitingAccountSwitch(),[io,oo,ao]=useAwaitingSignature(),so=reactExports.useCallback(()=>{no(),ao()},[no,ao]),co=reactExports.useCallback((lo,uo,ho)=>{validateStateTransition({from:Xr,to:lo}),eo(lo),so(),uo&&ro(uo,lo),ho&&oo(ho,lo)},[Xr,so,ro,oo]);return[Xr,co,{awaiting_account_switch:[to,ro],awaiting_signature:[io,oo]}]},useClearWalletConnectSessions=({connectors:Xr})=>{const eo=()=>{if(!(typeof window>"u")){for(const to of StorageService.getKeys())(to.startsWith("walletconnect")||to.startsWith("walletlink")||to.startsWith("wc@2"))&&localStorage.removeItem(to);Xr==null||Xr.forEach(to=>{var ro,no,io;!((no=(ro=to==null?void 0:to.name)===null||ro===void 0?void 0:ro.toLowerCase())===null||no===void 0)&&no.startsWith("turnkey")&&((io=to.getAuthenticatorHandler())===null||io===void 0||io.clear(),StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),StorageService.removeItem(EMBEDDED_WALLET_SECURE_BANNER))})}};return reactExports.useEffect(()=>{if(typeof window>"u"||Xr.length===0)return;const to=new Set(Xr.map(ro=>ro.key));for(const ro of StorageService.getKeys())ro.startsWith("walletconnect")&&!to.has(ro.replace("walletconnect-",""))&&localStorage.removeItem(ro)},[Xr]),{clearAllWalletConnectSessions:eo}},revokeSession=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({environmentId:eo,sessionId:to}){try{yield sdkApi$1().revokeSession({environmentId:eo})}catch(ro){const no=yield ro.json();logger$8.error(Error(no.error.message))}}),mapChainToChainEnum=Xr=>{const eo=Object.values(ChainEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid chain ${Xr}`);return eo},mapProviderToProviderEnum=Xr=>{const eo=Object.values(WalletProviderEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid provider ${Xr}`);return eo},mapAuthModeTypeToEnum=Xr=>{const eo=Object.values(AuthModeEnum).find(to=>to===Xr);if(!eo)throw new DynamicError(`Invalid authMode ${Xr}`);return eo},createVisit=Xr=>__awaiter$j(void 0,[Xr],void 0,function*({authMode:eo,chain:to,environmentId:ro,walletProvider:no,publicWalletAddress:io,walletName:oo}){try{const ao={address:io,authMode:mapAuthModeTypeToEnum(eo),chain:mapChainToChainEnum(to),provider:mapProviderToProviderEnum(no),walletName:oo};yield sdkApi$1().createVisit({connectRequest:ao,environmentId:ro})}catch(ao){logger$8.error(ao)}}),getWalletConnectorForWallet=Xr=>{var eo,to;if(!Xr)return;const ro=getWalletConnectorOptions(),{key:no,chain:io}=Xr,oo=(eo=ro.find(so=>no===so.key&&so.walletConnector.connectedChain===io))===null||eo===void 0?void 0:eo.walletConnector;return oo||((to=ro.find(so=>so.key==="fallbackconnector"))===null||to===void 0?void 0:to.walletConnector)},useDebounce=(Xr,eo)=>{const to=reactExports.useRef(null),ro=reactExports.useRef(Xr);return ro.current=Xr,reactExports.useCallback((...no)=>{to.current&&clearTimeout(to.current),to.current=window.setTimeout(()=>{ro.current(...no)},eo)},[eo])},updateUserWalletsFromConnectedWallets=(Xr,eo)=>{const to=[...Xr],ro=new Set;for(const no of eo)ro.add(no.address),to.find(oo=>oo.address===no.address)||to.push(no);return to.filter(no=>ro.has(no.address)||no.isAuthenticated)},useConnectWallet=({authMode:Xr,clearPrimaryWalletId:eo,enableVisitTrackingOnConnectOnly:to,environmentId:ro,primaryWalletId:no,setPrimaryWalletId:io,walletConnectorOptions:oo,handleConnectedWallet:ao,setShowAuthFlow:so,isBridgeFlow:co,user:lo})=>{const[uo,ho,go]=useLocalStorage(CONNECTED_WALLETS_INFO,[]),[bo,wo]=reactExports.useState([]),{setUserWallets:Eo,addedWalletsIds:$o,removedWalletsIds:Co}=useInternalUserWallets(),Ro=reactExports.useCallback(fo=>{wo(fo),Eo(yo=>updateUserWalletsFromConnectedWallets(yo,fo))},[Eo]),Oo=reactExports.useCallback(fo=>__awaiter$j(void 0,void 0,void 0,function*(){const yo=bo.find(So=>So.id===fo);yield yo==null?void 0:yo.connector.endSession();const vo=uo.filter(So=>So.id!==fo);if(ho(vo),Co.current.push(fo),fo!==no)return;const _o=vo.length>0;co||!_o?eo():io(vo[0].id)}),[eo,bo,uo,co,no,Co,ho,io]),jo=useDebounce(()=>__awaiter$j(void 0,void 0,void 0,function*(){const fo=oo.map(vo=>vo.walletConnector);if(!fo.length)return;const yo=(yield Promise.all(uo.map(vo=>__awaiter$j(void 0,void 0,void 0,function*(){const _o=getWalletConnectorByKey(fo,vo.walletConnectorKey);if(!_o)return logger$9.error("Could not find walletConnector: "+vo.walletConnectorKey),yield Oo(vo.id),null;isHardwareWalletConnector(_o)&&vo.hardwareWallet===HardwareWalletEnum.Ledger&&(_o.isHardwareWalletEnabled=!0);const[So]=yield _o.getConnectedAccounts();if(!So)return yield Oo(vo.id),null;const To=yield _o.getAdditionalAddresses(So),Ao=_o.connectedChain;return _o.createWallet({additionalAddresses:To,address:So,chain:Ao,connector:_o,id:vo.id,isAuthenticated:!1,key:_o.key})})))).filter(vo=>!!vo);Ro(yo)}),300);reactExports.useEffect(()=>{jo()},[uo,oo]);const Bo=reactExports.useCallback(fo=>{const vo=fo.map(({id:_o})=>_o).map(_o=>Number(_o.replace("connect-wallet-",""))).sort((_o,So)=>_o-So);for(let _o=0;_o{var vo;const _o=[...bo],So=_o.findIndex(To=>To.id===fo);So<0||(_o[So]=_o[So].connector.createWallet(Object.assign(Object.assign({},_o[So]),{address:(vo=yo.address)!==null&&vo!==void 0?vo:_o[So].address,connector:getWalletConnectorForWallet(_o[So])})),Ro(_o))},[bo,Ro]),Fo=({walletId:fo,walletConnectorKey:yo,walletChain:vo,provider:_o})=>{const So=[...uo],To=oo.map(mo=>mo.walletConnector),Ao=getWalletConnectorByKey(To,yo),ko=Ao&&isHardwareWalletConnector(Ao)&&Ao.isHardwareWalletEnabled?HardwareWalletEnum.Ledger:void 0;So.push({hardwareWallet:ko,id:fo,provider:_o,walletChain:vo,walletConnectorKey:yo}),ho(So)},Wo=(fo,yo)=>__awaiter$j(void 0,void 0,void 0,function*(){shouldManuallyReconnectOnRefresh(yo)&&(yield yo.connect());const vo=yield yo.getAddress();if(vo&&ao&&!(yield ao({address:vo,chain:yo.connectedChain,connector:yo}))){logger$9.info("Connection was not established because handleConnectedWallet returned false"),Oo(fo),so(!1,{emitCancelAuth:!0});return}Mo(fo,{address:vo})}),Jo=(fo,yo,vo)=>__awaiter$j(void 0,void 0,void 0,function*(){const{applyHandleConnectedWallet:_o=!0}=vo??{},So=yield fo.getAddress(yo);if(!So)throw new MissingPublicAddressError;if(ao&&_o&&!(yield ao({address:So,chain:fo.connectedChain,connector:fo}))){logger$9.info("Connection was not established because handleConnectedWallet returned false"),so(!1);return}const To=uo.some(({walletConnectorKey:Io})=>Io===fo.key),Ao=fo.connectedChain;if(!To&&(Xr!=="connect-only"||to)&&createVisit({authMode:Xr,chain:Ao||"",environmentId:ro,publicWalletAddress:So,walletName:fo.key,walletProvider:getWalletProvider(fo)}),!isConnectOnly(lo,Xr))return{address:So,id:""};const mo=`connect-wallet-${Bo(uo)}`;return no||io(mo),$o.current.push(mo),To?yield jo():Fo({provider:getWalletProvider(fo),walletAddress:So,walletChain:Ao,walletConnectorKey:fo.key,walletId:mo}),{address:So,id:mo}}),Po=reactExports.useCallback(fo=>bo.find(yo=>yo.id===fo),[bo]);return{connectWallet:Jo,connectedWallets:bo,connectedWalletsInfo:uo,disconnectWallet:Oo,getConnectedWalletById:Po,refreshConnectedWallet:Wo,removeConnectedWalletsInfo:go}},useFetchWalletsForChainsMap=Xr=>({walletsForChainsMap:reactExports.useMemo(()=>Xr?Object.assign(Object.assign({},defaultWalletsForChains),{primary_chain:Xr.primary_chain,wallets:Object.assign(Object.assign({},defaultWalletsForChains.wallets),!!Xr.wallets&&Xr.wallets)}):defaultWalletsForChains,[Xr])}),useHandleUnlinkWallet=({verifiedCredentials:Xr,environmentId:eo,primaryWalletId:to,secondaryWallets:ro})=>{const{removedWalletsIds:no}=useInternalUserWallets();return reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){var ao;const so=(ao=StorageService.getItem(PRIMARY_WALLET_ID))!==null&&ao!==void 0?ao:to;if(oo===so)return;yield unlinkWallet({environmentId:eo,onSuccess:()=>{no.current.push(oo)},primaryWalletId:so,walletId:oo});const co=ro.find(uo=>uo.id===oo);Xr.filter(uo=>uo.walletName===((co==null?void 0:co.connector.key)||"")).length===1&&(yield co==null?void 0:co.connector.endSession())}),[to,eo,ro,Xr,no])},primaryWalletIdValidator=Xr=>typeof Xr=="string"||typeof Xr>"u",usePrimaryWalletId=({environmentId:Xr,user:eo})=>{const[to,ro,no]=useLocalStorage(PRIMARY_WALLET_ID,void 0,primaryWalletIdValidator),io=reactExports.useCallback(oo=>__awaiter$j(void 0,void 0,void 0,function*(){ro(oo),eo&&(yield storeSelectedWallet({environmentId:Xr,walletId:oo}))}),[Xr,ro,eo]);return{clearPrimaryWalletId:no,primaryWalletId:to,setPrimaryWalletId:io}},useWalletEventListeners=({disconnectWallet:Xr,handleLogOut:eo,multiWallet:to,multiWalletWidgetState:ro,primaryWallet:no,secondaryWallets:io,selectedWalletConnector:oo,selectedWalletWithAction:ao,setSelectedWalletConnectorKey:so,setSelectedWalletWithAction:co,setMultiWalletWidgetState:lo,user:uo,setPrimaryWalletId:ho,authMode:go,refreshConnectedWallet:bo,detectNewWalletsForLinking:wo})=>{const Eo=reactExports.useCallback((Ro,Oo)=>{logger$8.debug("handleAccountChangeWhenAwaitingAccountSwitch",{isPrimaryWallet:Ro,newAddress:Oo});const jo=io.find(Mo=>isSameAddress$1(Mo.address,Oo,Mo.chain));if(logger$8.logVerboseTroubleshootingMessage("[handleAccountChangeWhenAwaitingAccountSwitch]",{linkedSecondaryWallet:jo}),!jo){lo("awaiting_signature",void 0,"linking_new_wallet"),Ro&&no&&so(no.connector.key);return}if(jo.connector.key==="unknown"){dynamicEvents.emit("triggerConnectAndSign");return}co(null),ho(jo.id),lo("idle")},[lo,no,io,so,co,ho]),$o=reactExports.useCallback(({accounts:Ro})=>{if(logger$8.debug("calculatePrimaryWalletMultiWalletStateFromAccounts",{accounts:Ro,authMode:go,multiWallet:to,multiWalletWidgetState:ro,primaryWallet:no}),!no)return;const[Oo]=Ro;if(!!isSameAddress$1(Oo,no.address,no.chain)){lo("idle");return}if(go==="connect-only"){bo(no.id,no.connector);return}if(!to)return;if(ro==="awaiting_account_switch"){Eo(!0,Oo);return}ro!=="idle"&&(logger$8.error(`Unexpected multiWalletWidgetState (${ro}) and onAccountChange combination. Resetting state to idle.`),lo("idle"));const Bo=io.find(Mo=>isSameAddress$1(Mo.address,Oo,Mo.chain));if(Bo){ho(Bo.id);return}uo&&wo&&(lo("detected_new_wallet"),so(no.connector.key))},[go,wo,Eo,to,ro,no,bo,io,lo,ho,so,uo]);useInternalDynamicEvents("triggerComputePrimaryWalletMultiWalletStateFromAccounts",$o),useWalletConnectorEvent(no==null?void 0:no.connector,"accountChange",({accounts:Ro})=>{logger$8.debug("primary wallet account change",{accounts:Ro}),$o({accounts:Ro})});const Co=reactExports.useMemo(()=>{const Ro=no==null?void 0:no.connector,Oo=io.map(({connector:Bo})=>Bo),jo=new Set([...Oo,Ro,oo].filter(Bo=>!!Bo));return Ro&&jo.delete(Ro),Array.from(jo)},[io,oo,no==null?void 0:no.connector]);useWalletConnectorEvent(Co,"accountChange",(Ro,Oo)=>__awaiter$j(void 0,void 0,void 0,function*(){if(logger$8.debug("secondary wallet account change"),go==="connect-only"&&io.length){const jo=io.filter(({connector:Bo})=>Bo.key===Oo.key);for(const Bo of jo)bo(Bo.id,Bo.connector);return}ro==="awaiting_account_switch"&&Eo(!1,(ao==null?void 0:ao.wallet.address)||"")})),useWalletConnectorEvent(no==null?void 0:no.connector,"disconnect",()=>{logger$8.debug("primary wallet disconnect"),go==="connect-only"&&eo()}),useWalletConnectorEvent(Co,"disconnect",Ro=>{if(logger$8.debug("secondary wallet disconnect"),go==="connect-only"){const Oo=io.filter(({connector:jo})=>jo.key===Ro.key);for(const jo of Oo)Xr(jo.id)}})},useTabState=({settingsOverrides:Xr})=>{var eo,to,ro;const no=(eo=Xr==null?void 0:Xr.views)===null||eo===void 0?void 0:eo.find(so=>so.type==="wallet-list"),[io,oo]=reactExports.useState(0),ao=io===null||(to=no==null?void 0:no.tabs)===null||to===void 0?void 0:to.items[io];return{selectedTabIndex:io,selectedTabSettings:ao,setSelectedTabIndex:oo,tabsItems:(ro=no==null?void 0:no.tabs)===null||ro===void 0?void 0:ro.items}},DynamicBridgeWidgetContext=React.createContext(void 0),initialView="wallets",DynamicBridgeWidgetContextProvider=({children:Xr})=>{const eo=reactExports.useRef(null),to=reactExports.useRef(null),[ro,no]=reactExports.useState(initialView),io=reactExports.useCallback(()=>{no(initialView)},[]),oo=reactExports.useCallback(()=>{no("profile")},[]),ao={bridgeWidgetView:ro,events:{onDynamicBridgeWidgetClose:io},goToProfileView:oo,inlineControlsRef:to,setBridgeWidgetView:no,widgetRef:eo};return jsxRuntimeExports.jsx(DynamicBridgeWidgetContext.Provider,{value:ao,children:Xr})},DynamicWidgetCard=reactExports.forwardRef(({children:Xr},eo)=>jsxRuntimeExports.jsx("div",{ref:eo,className:"dynamic-widget-card",children:Xr}));DynamicWidgetCard.displayName="DynamicWidgetCard";const widgetRegistryContext=reactExports.createContext(null),WidgetRegistryContextProvider=({children:Xr})=>{const[eo,to]=reactExports.useState({}),ro=reactExports.useCallback((oo,ao)=>{to(so=>Object.assign(Object.assign({},so),{[oo]:{type:ao}}))},[to]),no=reactExports.useCallback(oo=>{to(ao=>{const so=Object.assign({},ao);return delete so[oo],so})},[to]),io=reactExports.useCallback(oo=>Object.values(eo).some(ao=>ao.type===oo),[eo]);return jsxRuntimeExports.jsx(widgetRegistryContext.Provider,{value:{checkWidgetPresence:io,registerId:ro,removeId:no},children:Xr})},Modal=({onrampUrl:Xr})=>{const{fundingRef:eo,setShowFunding:to}=useFundingContext();return useOnClickOutside(eo,()=>{to(!1)}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal","data-testid":"fund-wallet-modal",children:jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-content",ref:eo,children:jsxRuntimeExports.jsx("iframe",{id:"onramp-iframe",src:Xr,allow:"camera *;geolocation *",title:"Crypto Onramp"})})})},FundWalletView=()=>{const{primaryWallet:Xr}=useInternalDynamicContext(),{showFunding:eo,fundingUrl:to,fundingEnabled:ro}=useFundingContext();return!ro||!eo||!to||!(Xr!=null&&Xr.address)?null:jsxRuntimeExports.jsx(ShadowDOM,{children:jsxRuntimeExports.jsxs(OpacityTransition,{isShown:eo,children:[jsxRuntimeExports.jsx("div",{className:"fund-wallet__backdrop","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-container",children:jsxRuntimeExports.jsx(Modal,{onrampUrl:to})})]})})},FundingWidget=()=>jsxRuntimeExports.jsx(FundWalletView,{}),ConnectWithOtpContext=reactExports.createContext(void 0),createEmailHandler=(Xr,{shouldRegisterSessionKeysOnSignin:eo,generateSessionKey:to})=>ro=>__awaiter$j(void 0,void 0,void 0,function*(){const no=yield createEmailVerification({email:ro,environmentId:Xr});let{verificationUUID:io}=no;return{retry:()=>__awaiter$j(void 0,void 0,void 0,function*(){io=(yield retryEmailVerification({email:ro,environmentId:Xr,verificationUUID:io})).verificationUUID}),type:"email",verify:oo=>__awaiter$j(void 0,void 0,void 0,function*(){let ao;eo()&&(ao=(yield to()).publicKey);const so=yield signInWithEmailVerification({environmentId:Xr,sessionPublicKey:ao,verificationToken:oo,verificationUUID:io});return storeAuthTokenAndUser(so),{destination:ro,verified:!!so.jwt}})}}),createMagicHandler=(Xr,eo)=>to=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Xr)throw new Error("OTP wallet connector was not found");return Xr.setEmail(to),eo(Xr),{retry:()=>Xr.retryOneTimePassword(),type:"email",verify:ro=>__awaiter$j(void 0,void 0,void 0,function*(){return{destination:to,verified:yield Xr.verifyOneTimePassword(ro)}})}}),createSmsHandler=Xr=>eo=>__awaiter$j(void 0,void 0,void 0,function*(){const{generateSessionKey:to,shouldRegisterSessionKeysOnSignin:ro}=useEmbeddedWalletSessionKeys(Xr),{verificationUUID:no}=yield createSmsVerification({environmentId:Xr,isoCountryCode:eo.iso2,phoneCountryCode:eo.dialCode,phoneNumber:eo.phone});return{type:"sms",verify:io=>__awaiter$j(void 0,void 0,void 0,function*(){let oo;ro()&&(oo=(yield to()).publicKey);const ao=yield signInWithSmsVerification({environmentId:Xr,sessionPublicKey:oo,verificationToken:io,verificationUUID:no});return storeAuthTokenAndUser(ao),{destination:eo,verified:!!ao.jwt}})}}),mapEmailProviderToProviderEnum={dynamic:ProviderEnum.Dynamic,magicLink:ProviderEnum.MagicLink},allSupportedProviders=Object.values(mapEmailProviderToProviderEnum),findEmailProvider=(Xr,eo)=>__awaiter$j(void 0,void 0,void 0,function*(){const{emailProvider:to}=yield getEmailProvider({email:eo,environmentId:Xr});if(!allSupportedProviders.includes(to))throw new Error("Email provider is not supported");return to}),{Provider:Provider$1}=ConnectWithOtpContext,ConnectWithOtpProvider=({children:Xr})=>{const{walletConnectorOptions:eo,environmentId:to,projectSettings:ro,setCallback:no}=useInternalDynamicContext(),io=useEmbeddedWalletSessionKeys(to),{handleInstalledExtensionClick:oo}=useWalletItemActions(),ao=reactExports.useRef(null),so=(ro==null?void 0:ro.providers)||[],co=eo.map(({walletConnector:wo})=>wo).find(isEmailOTPWalletConnector),lo={[ProviderEnum.Dynamic]:{enabled:isProviderEnabled(so,ProviderEnum.Dynamic),handler:createEmailHandler(to,io)},[ProviderEnum.MagicLink]:{enabled:isProviderEnabled(so,ProviderEnum.MagicLink),handler:createMagicHandler(co,oo)}},uo=(wo,...Eo)=>__awaiter$j(void 0,[wo,...Eo],void 0,function*($o,{provider:Co}={}){if(!isEmailValid($o))throw new Error("Email is not valid");const Ro=Co||(yield findEmailProvider(to,$o));if(!lo[Ro].enabled)throw new Error("Email provider is not enabled");const Oo=yield lo[Ro].handler($o);ao.current=Oo}),ho=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!isProviderEnabled(so,ProviderEnum.Sms))throw new Error("SMS provider is not enabled");const $o=yield createSmsHandler(to)(wo);ao.current=$o}),go=wo=>__awaiter$j(void 0,void 0,void 0,function*(){if(!ao.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");const{type:Eo,verify:$o}=ao.current,{destination:Co,verified:Ro}=yield $o(wo);if(Eo==="sms"?dynamicEvents.emit("smsVerificationResult",Ro,Co):dynamicEvents.emit("emailVerificationResult",Ro,Co),Ro)no("authSuccess");else throw new Error(`${Eo==="sms"?"SMS":"Email"} verification failed`)}),bo=()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!ao.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");if(!ao.current.retry)throw new Error("Re-send is not supported");return ao.current.retry()});return jsxRuntimeExports.jsx(Provider$1,{value:{connectWithEmail:uo,connectWithSms:ho,retryOneTimePassword:bo,verifyOneTimePassword:go},children:Xr})},ERROR_BOUNDARY_CONTEXT_NOT_FOUND="ERROR_BOUNDARY_CONTEXT_NOT_FOUND",ErrorBoundaryContext=reactExports.createContext(null);function assertErrorBoundaryContext(Xr){if(Xr===null||typeof Xr.hasError!="boolean"||typeof Xr.error!="object"||typeof Xr.isDynamicSdkError!="boolean"){const eo=new Error("ErrorBoundaryContext not found");throw eo.cause=ERROR_BOUNDARY_CONTEXT_NOT_FOUND,eo}}class ErrorBoundaryBase extends reactExports.Component{static getDerivedStateFromError(eo){return{error:eo,hasError:!0}}renderOrError(eo,{isDynamicSdkError:to}){try{assertErrorBoundaryContext(this.context),this.context.isDynamicSdkError=to}catch(ro){return logger$8.error(ro),reactExports.createElement(ErrorContainer,null,"ErrorBoundary must be used within ErrorBoundaryContext")}return eo}}ErrorBoundaryBase.contextType=ErrorBoundaryContext;class ErrorBoundaryReporter extends ErrorBoundaryBase{constructor(eo){super(eo),this.state={error:null,hasError:!1}}componentDidCatch(eo,to){var ro;const{onError:no}=this.props;throw!((ro=this.context)===null||ro===void 0)&&ro.isDynamicSdkError&&(no==null||no(eo,to),logger$8.error(eo,{error:{bundleStack:eo.stack,message:eo,stack:to.componentStack}})),eo}render(){const{children:eo}=this.props,{hasError:to,error:ro}=this.state;return to?(assertErrorBoundaryContext(this.context),this.context.error=ro,this.context.hasError=to,null):eo}}const ErrorBoundary=Xr=>{var{children:eo}=Xr,to=__rest$7(Xr,["children"]);return jsxRuntimeExports.jsx(ErrorBoundaryContext.Provider,{value:{error:null,hasError:!1,isDynamicSdkError:!0},children:jsxRuntimeExports.jsx(ErrorBoundaryReporter,Object.assign({},to,{children:eo}))})};class ErrorBoundaryExclude extends ErrorBoundaryBase{render(){const{children:eo}=this.props;return this.renderOrError(eo,{isDynamicSdkError:!1})}}const useResponseHandlers=()=>{const{walletConnectorOptions:Xr,consumeNonce:eo,displaySiweStatement:to,environmentId:ro,projectSettings:no,setIsSingleWalletAccount:io,connectWallet:oo,setShowAuthFlow:ao,setSelectedWalletConnectorKey:so,siweStatement:co,appName:lo,user:uo}=useInternalDynamicContext(),{setView:ho}=useViewContext(),{setErrorMessage:go}=useErrorContext(),{getCaptchaToken:bo}=useCaptchaContext(),wo=useVerifyWallet({consumeNonce:eo,displaySiweStatement:to,environmentId:ro,projectSettings:no,setIsSingleWalletAccount:io}),Eo=Xr.map(({walletConnector:jo})=>jo).find(isPhantomRedirectConnector),$o=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){Eo&&(yield Eo.getSession(),yield oo(Eo),ao(!0,{ignoreIfIsEmbeddedWidget:!0}),ho("pending-signature"),so("phantom"))}),[oo,Eo,so,ao,ho]),Co=useTransferWallet(),Ro=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){if(!Eo)return;so("phantom");const[jo]=yield Eo.getConnectedAccounts();switch(Eo.consumeMethod()){case"signAndSendTransaction":{const{signature:Mo}=Eo.extractSignature();Eo.emit("signAndSendTransaction",{signature:Mo});break}case"signAllTransactions":Eo.emit("signAllTransactions",{transactions:Eo.extractTransactions()});break;case"signTransaction":Eo.emit("signTransaction",{transaction:Eo.extractTransaction()});break;case"signMessage":{const{signature:Mo,message:Fo}=Eo.extractSignature(),Wo=StorageService.getItem(PHANTOM_SIGNATURE_STATE);if(StorageService.removeItem(PHANTOM_SIGNATURE_STATE),(Wo==null?void 0:Wo.verificationType)==="awaiting_transfer"){const Jo=getSiweStatement({appName:lo,siweStatement:co});yield Co({messageToSignOverride:Fo,overrideSiweStatement:Jo,publicWalletAddress:jo,signedMessageOverride:Mo,skipEmptyAccountCheck:Wo.loseOriginalAccountOnTransfer,walletConnector:Eo})}else(Wo==null?void 0:Wo.verificationType)==="awaiting_verification"||!uo?(ho("wallet-redirect-view"),yield wo({captchaToken:bo(),messageToSignOverride:Fo,publicWalletAddress:jo,signedMessageOverride:Mo,walletConnector:Eo})):Eo.emit("signMessage",{signature:Mo});break}}}),[Eo,so,uo,lo,co,Co,ho,wo,bo]),Oo=reactExports.useCallback(jo=>{var Bo;if(!Eo)return;const Mo=jo.get("errorCode"),Fo=(Bo=jo.get("errorMessage"))!==null&&Bo!==void 0?Bo:void 0;if(!Mo)return;switch(go(Mo),jo.delete("errorCode"),jo.delete("errorMessage"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${jo.toString()}`),Eo.consumeMethod()){case"signAndSendTransaction":Eo.emit("signAndSendTransaction",{errorCode:Mo,errorMessage:Fo});break;case"signAllTransactions":Eo.emit("signAllTransactions",{errorCode:Mo,errorMessage:Fo});break;case"signTransaction":Eo.emit("signTransaction",{errorCode:Mo,errorMessage:Fo});break;case"signMessage":Eo.emit("signMessage",{errorCode:Mo,errorMessage:Fo});break}},[Eo,go]);return{handleConnectResponse:$o,handleErrorResponse:Oo,handleUserResponse:Ro,phantomRedirectConnector:Eo}},PhantomRedirectContext=reactExports.createContext(void 0),PhantomRedirectContextProvider=({children:Xr})=>{const{sdkHasLoaded:eo}=useInternalDynamicContext(),{phantomRedirectConnector:to,handleConnectResponse:ro,handleUserResponse:no,handleErrorResponse:io}=useResponseHandlers();return reactExports.useEffect(()=>{if(!to||!isMobile$1()||!eo)return;const oo=new URLSearchParams(window.location.search);if(oo.has("errorCode")){io(oo);return}if(oo.has("phantom_encryption_public_key")){ro();return}if(oo.has("data")){no();return}},[ro,no,io,to,eo]),jsxRuntimeExports.jsx(PhantomRedirectContext.Provider,{value:{phantomRedirectConnector:to},children:Xr})},reinitializeContext=reactExports.createContext(void 0),ReinitializeContextProvider=({children:Xr,onReinitialize:eo})=>{const[to,ro]=reactExports.useState(),no=reactExports.useRef(eo);no.current=eo;const io=reactExports.useCallback(()=>{var oo;const ao=randomString(8);(oo=no.current)===null||oo===void 0||oo.call(no,ao),ro(ao)},[]);return jsxRuntimeExports.jsx(reinitializeContext.Provider,{value:{key:to,reinitialize:io},children:reactExports.cloneElement(Xr,{key:to})})},useConnectedWalletsNetworkValidation=()=>{const{connectedWallets:Xr,selectedWalletConnector:eo,setSelectedWalletConnectorKey:to,setShowAuthFlow:ro,bridgeChainsToConnect:no,sdkHasLoaded:io}=useInternalDynamicContext(),{setView:oo}=useViewContext(),ao=useIsLoggedIn(),so=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const uo=[];for(const ho of Xr){const go=no==null?void 0:no.some(Eo=>Eo.chain===ho.chain),bo=yield ho.connector.getNetwork(),wo=isSupportedNetwork({network:bo,walletConnector:ho.connector});!go&&!wo&&uo.push(ho)}return uo}),[no,Xr]),co=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const uo=yield so();if(!uo.length)return;const[ho]=uo;ho.connector.key!==(eo==null?void 0:eo.key)&&to(ho.connector.key);const go=isProgrammableNetworkSwitchSupported(ho.connector)?"network-not-supported":"network-not-supported-manual";ro(!0),oo(go)}),[so,eo==null?void 0:eo.key,to,ro,oo]),lo=reactExports.useMemo(()=>{const uo=Xr.map(({connector:go})=>go),ho=new Set([...uo].filter(go=>!!go));return Array.from(ho)},[Xr]);useWalletConnectorEvent(lo,"chainChange",({chain:uo})=>{co()}),reactExports.useEffect(()=>{!io||!ao||co()},[io,ao,co])},UseNetworkValidation=()=>(useConnectedWalletsNetworkValidation(),null),isDisplayOrderPriorityForWeb3=Xr=>{if(Xr.length!==2)return!1;const[eo,to]=Xr;return eo==="wallet"&&to==="email"},useDisplayOrderState=Xr=>{const[eo,to]=reactExports.useState(null),ro=reactExports.useMemo(()=>{var no;const io=(no=Xr==null?void 0:Xr.design.modal)===null||no===void 0?void 0:no.displayOrder;return io?isDisplayOrderPriorityForWeb3(io)?"web3":"web2":"web3"},[Xr]);return[eo||ro,to]},useEmailLoginState=(Xr,eo)=>{const[to,ro]=reactExports.useState(null),no=()=>{ro(null)},io=ao=>{ro(ao)},oo=reactExports.useMemo(()=>eo?!1:isEmailProviderEnabled(Xr),[Xr,eo]);return[to??oo,io,no]},useHandleLogout=Xr=>{const eo=reactExports.useRef(Xr);eo.current=Xr;const to=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){const ro=eo.current;ro.setSelectedWalletConnectorKey(null),ro.clearAllWalletConnectSessions(),ro.setShowDynamicUserProfile(!1),ro.setShowBridgeWidget(!1),ro.resetLoginWithEmail(),ro.user&&(document.cookie=`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`,revokeSession({environmentId:ro.environmentId,sessionId:ro.user.sessionId})),ro.setLegacyIsVerifying(!1),StorageService.removeItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),StorageService.removeItem(AUTH_EXPIRES_AT),ro.setAuthMode(ro.initialAuthenticationMode),ro.setShowAuthFlow(!1,{emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!1,initializeWalletConnect:!1,performMultiWalletChecks:!1}),ro.setMultiWalletWidgetState("idle"),ro.removeConnectedWalletsInfo(),ro.removeBridgeOnboardingCompleted(),ro.clearPrimaryWalletId(),ro.removeConnectedNameService(),ro.removeSessionStorageSessionKeys(),dynamicEvents.removeListener("embeddedWalletCreatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletCreatePasswordFailed"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordFailed"),dynamicEvents.emit("logout"),setUser(void 0),yield Promise.all(ro.walletConnectors.map(no=>no.endSession())),yield Promise.all(ro.connectedWallets.map(no=>no.connector.endSession()))}),[]);return reactExports.useEffect(()=>(StorageService.events.on("parseFailure",to),()=>{StorageService.events.off("parseFailure",to)}),[to]),to},getWalletVerifiedCredential=(Xr,eo,to)=>eo==null?void 0:eo.find(({address:ro})=>isSameAddress$1(ro||"",Xr||"",to)),useNameService=({currentWallet:Xr,user:eo})=>{const[to,ro,no]=useLocalStorage(CONNECTED_WALLET_NAME_SERVICE,null),io=reactExports.useRef(),oo=reactExports.useRef(),ao=reactExports.useCallback(co=>__awaiter$j(void 0,void 0,void 0,function*(){const{address:lo,connector:uo}=co,ho=yield uo.getNetwork();if(lo===io.current&&ho===oo.current)return;ro(null),io.current=lo,oo.current=ho;let go;try{go=yield co.getNameService()}catch{}if(io.current===lo&&oo.current===ho)return ro({address:lo,avatar:go==null?void 0:go.avatar,name:go==null?void 0:go.name,network:ho}),go}),[ro]);return{getNameService:co=>__awaiter$j(void 0,void 0,void 0,function*(){var lo;if(!Xr)return;const uo=yield Xr.connector.getNetwork(),ho=eo==null?void 0:eo.verifiedCredentials;if(ho){const go=getWalletVerifiedCredential(Xr==null?void 0:Xr.address,ho,Xr.chain);if(go&&(!((lo=go.nameService)===null||lo===void 0)&&lo.name))return go.nameService}if(!(co&&(Xr==null?void 0:Xr.address)!==co))return to&&to.address===(Xr==null?void 0:Xr.address)&&to.network===uo?{avatar:to.avatar,name:to.name}:ao(Xr)}),removeConnectedNameService:no}},useSelectedWalletConnector=({walletConnectorOptions:Xr})=>{const[eo,to]=reactExports.useState(null);return{selectedWalletConnector:reactExports.useMemo(()=>{var no,io;return eo&&(io=(no=Xr.find(({walletConnector:oo})=>oo.key===eo))===null||no===void 0?void 0:no.walletConnector)!==null&&io!==void 0?io:null},[eo,Xr]),setSelectedWalletConnectorKey:to}},useShowAuthFlow=({isAuthenticated:Xr,isRenderingEmbeddedAuthFlow:eo,isMultiWalletEnabled:to,setShowDynamicUserProfile:ro})=>{const[no,io]=reactExports.useState(!1),{setError:oo}=useErrorContext(),ao=reactExports.useCallback((so,co={})=>{const{emitCancelAuth:lo,ignoreIfIsEmbeddedWidget:uo,initializeWalletConnect:ho,performMultiWalletChecks:go,clearErrors:bo}=Object.assign({clearErrors:!0,emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!1},co);if(logger$8.logVerboseTroubleshootingMessage("setShowAuthFlow",{clearErrors:bo,emitCancelAuth:lo,ignoreIfIsEmbeddedWidget:uo,initializeWalletConnect:ho,performMultiWalletChecks:go}),!no&&so?dynamicEvents.emit("authFlowOpen"):no&&!so&&dynamicEvents.emit("authFlowClose"),so){if(uo&&eo.current)return;if(go&&Xr){if(!to)return ro(!0);logger$8.warn("Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext");return}}else lo&&no&&dynamicEvents.emit("authFlowCancelled");bo&&oo(void 0),io(so)},[Xr,to,eo,oo,ro,no]);return[no,ao]},usePasskeySuccessPopup=()=>{const[Xr,eo]=reactExports.useState(void 0);return{passkeySuccessPopup:Xr,setPasskeySuccessPopup:ro=>{eo(ro),setTimeout(()=>{eo(void 0)},2e3)}}},useTieCallbacksToEvents=({clientCallbacks:Xr,user:eo})=>{useInternalDynamicEvents("emailVerificationResult",(to,ro)=>{var no;return(no=Xr==null?void 0:Xr.onOtpVerificationResult)===null||no===void 0?void 0:no.call(Xr,to,{type:"email",value:ro})}),useInternalDynamicEvents("smsVerificationResult",(to,ro)=>{var no;return(no=Xr==null?void 0:Xr.onOtpVerificationResult)===null||no===void 0?void 0:no.call(Xr,to,{type:"sms",value:ro})}),useInternalDynamicEvents("authFlowCancelled",()=>{var to;return(to=Xr==null?void 0:Xr.onAuthFlowCancel)===null||to===void 0?void 0:to.call(Xr)}),useInternalDynamicEvents("authFlowOpen",()=>{var to;(to=Xr==null?void 0:Xr.onAuthFlowOpen)===null||to===void 0||to.call(Xr)}),useInternalDynamicEvents("authFlowClose",()=>{var to;(to=Xr==null?void 0:Xr.onAuthFlowClose)===null||to===void 0||to.call(Xr)}),useInternalDynamicEvents("walletAdded",(to,ro)=>{var no;dynamicEvents.emit("triggerSessionValidation"),logger$8.debug("[walletAdded]",{userWallets:ro,wallet:to}),(no=Xr==null?void 0:Xr.onWalletAdded)===null||no===void 0||no.call(Xr,{userWallets:ro,wallet:to})}),useInternalDynamicEvents("walletRemoved",(to,ro)=>{var no;logger$8.debug("[walletRemoved]",{userWallets:ro,wallet:to}),(no=Xr==null?void 0:Xr.onWalletRemoved)===null||no===void 0||no.call(Xr,{userWallets:ro,wallet:to})}),useInternalDynamicEvents("embeddedWalletCreated",(to,ro,no)=>{var io;logger$8.debug("[embeddedWalletCreated]",{_wallet:to,jwtVerifiedCredential:ro,user:no}),(io=Xr==null?void 0:Xr.onEmbeddedWalletCreated)===null||io===void 0||io.call(Xr,ro,no)}),useInternalDynamicEvents("logout",()=>{var to;(to=Xr==null?void 0:Xr.onLogout)===null||to===void 0||to.call(Xr,eo)}),useInternalDynamicEvents("authFailure",(to,ro)=>{var no;logger$8.debug("[authFailure]",{data:to,reason:ro}),(no=Xr==null?void 0:Xr.onAuthFailure)===null||no===void 0||no.call(Xr,to,ro)}),useInternalDynamicEvents("authInit",to=>{var ro;logger$8.debug("[authInit]",{data:to}),(ro=Xr==null?void 0:Xr.onAuthInit)===null||ro===void 0||ro.call(Xr,to)})},useMultiWallet=({isBridgeFlow:Xr,multiWalletOverride:eo,multiWalletSettings:to})=>{var ro;return eo!==void 0?eo:(ro=to||Xr)!==null&&ro!==void 0?ro:!1},useMultiAsset=({multiAssetOverride:Xr,multiAssetSettings:eo})=>Xr!==void 0?Xr:eo??!0,useParentDynamicContextGuard=()=>{if(reactExports.useContext(DynamicContext))throw new Error("DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.")},useShowFiat=({showFiatOverride:Xr,showFiatSettings:eo})=>Xr!==void 0?Xr:eo??!0,isAuthenticatedWithAWallet=Xr=>{const eo=Xr.verifiedCredentials.find(to=>to.id===Xr.lastVerifiedCredentialId);return(eo==null?void 0:eo.format)===JwtVerifiedCredentialFormatEnum.Blockchain},useCustomerCallbacks=({callbacks:{onAuthSuccess:Xr,onUserProfileUpdate:eo},handleLogOut:to,primaryWallet:ro,user:no,isAuthenticated:io})=>{const[oo,ao]=reactExports.useState([]),so=reactExports.useCallback((lo,uo)=>{switch(lo==null?void 0:lo.callback){case"authSuccess":{try{Xr==null||Xr({handleLogOut:to,isAuthenticated:io,primaryWallet:ro,user:uo}),dynamicEvents.emit("triggerSessionValidation")}catch(ho){logger$8.error("Error calling onAuthSuccess: ",ho)}break}case"userProfileUpdate":{try{eo==null||eo(uo)}catch(ho){logger$8.error("Error calling userProfileUpdate: ",ho)}break}}},[to,io,Xr,eo,ro]);return reactExports.useEffect(()=>{!oo.length||!no||isAuthenticatedWithAWallet(no)&&!ro||(so(oo[0],no),ao(lo=>{const[uo,...ho]=lo;return uo&&(logger$8.debug("Resolved callback: ",uo.callback),logger$8.debug("Callbacks in queue: ",ho.map(go=>go.callback))),ho}))},[oo,so,ro,no]),{setCallback:reactExports.useCallback((lo,uo)=>{ao(ho=>[...ho,{callback:lo,params:uo}])},[])}},useRegisterStorageService=({storagePostfix:Xr})=>{const eo={clear:()=>{},getItem:()=>null,key:()=>null,length:0,removeItem:()=>{},setItem:()=>null},to=isSSR()?eo:window.localStorage,ro=isSSR()?eo:window.sessionStorage;StorageService.getSourceStorage("localStorage")||StorageService.registerSourceStorage("localStorage",createStorageService({postfix:Xr,storage:to})),StorageService.getSourceStorage("sessionStorage")||StorageService.registerSourceStorage("sessionStorage",createStorageService({postfix:Xr,storage:ro}))};var define_process_env_default$4={};const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID="2762a57b-faa4-41ce-9f16-abff9300e2c9",DynamicContext=reactExports.createContext(void 0),InnerDynamicContextProvider=({children:Xr,theme:eo,settings:to,locale:ro,enableInstrumentation:no=!1})=>{var io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo,$o,Co,Ro,Oo;const{accessDeniedMessagePrimary:jo,accessDeniedMessageSecondary:Bo,accessDeniedButton:Mo,defaultPhoneInputIso2:Fo,apiBaseUrl:Wo,coinbaseWalletPreference:Jo,detectNewWalletsForLinking:Po=!1,enableConnectOnlyFallback:fo=!1,deepLinkPreference:yo="native",bridgeChains:vo,cssOverrides:_o,defaultNumberOfWalletsToShow:So=DEFAULT_NUMBER_OF_WALLETS_TO_SHOW,flowNetwork:To,initialAuthenticationMode:Ao="connect-and-sign",debugError:ko=!1,displaySiweStatement:mo=!0,newToWeb3WalletChainMap:Io,enableVisitTrackingOnConnectOnly:Do=!0,environmentId:Lo,walletsFilter:Ho,logLevel:Yo="WARN",mobileExperience:Xo,notInTheListImageUrl:qo,onboardingImageUrl:Ko,policiesConsentInnerComponent:Qo,customPrivacyPolicy:zo,privacyPolicyUrl:ga,socialMediaLinkText:$a,socialMediaIconUrl:Sl,socialMediaUrl:El,customTermsOfServices:Tl,termsOfServiceUrl:Il,toolkitEnabled:Zl,siweStatement:Vl,shadowDOMEnabled:Ol=!0,walletConnectors:Dl,socialProvidersFilter:Fl,showLockedWalletView:Jl=!1,walletConnectPreferredChains:cu,walletConnectorExtensions:Ll,recommendedWallets:Xl,handlers:ku}=to;useRegisterStorageService({storagePostfix:to.localStorageSuffix}),initializeStore({environmentId:Lo,storageSuffix:to.localStorageSuffix}),setChainInfoOverrides((io=to.overrides)===null||io===void 0?void 0:io.chainDisplayValues);const iu=(oo=to.events)!==null&&oo!==void 0?oo:to.eventsCallbacks,hu=resolveNetworkValidationMode({bridgeChains:to.bridgeChains,networkValidationMode:to.networkValidationMode});let{appLogoUrl:Cu="https://demo.dynamic.xyz/assets/dynamic-logo.svg",appName:_l="Dynamic Example"}=to;if(!Lo)throw new MissingEnvironmentIdError;logger$8.setLogLevel(Yo),logger$9.setLogLevel(Yo),Lo===PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID&&logger$8.warn(`WARNING: DYNAMIC is using a test environment ID ${Lo}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`),ApiEndpoint$1.setBaseUrl((ao=define_process_env_default$4.DYNAMIC_API_BASE_URL)!==null&&ao!==void 0?ao:Wo);const Go=Locale.setup(ro),yl=!!vo,Al=getDeepLinkPreference(yo,yl),{selectedTabIndex:Ul,setSelectedTabIndex:su,selectedTabSettings:Ql,tabsItems:vu}=useTabState({settingsOverrides:to.overrides}),[qu,pu,xu]=useLocalStorage(BRIDGE_ONBOARDING_COMPLETED,!1),[Au,yu]=reactExports.useState(!1),[wu,Gu]=reactExports.useState(!1),[Ml,Nl]=reactExports.useState(!1),{user:Yl,userWithMissingInfo:Wl}=useUser(),eu=!!Yl;Yl?logger$8.setMetaData("user",Yl):logger$8.setMetaData("user",void 0);const{consumeNonce:Su}=useFetchNonce(Lo),[ru,uu]=reactExports.useState(""),[xl,$l]=reactExports.useState(""),[Cl,Zo,{awaiting_account_switch:[Rl],awaiting_signature:[Hl]}]=useMultiWalletWidgetState(),{settings:au}=useProjectSettings(),tu=useNetworkConfigurationsFromProjectSettings({cosmosNetworkOverrides:(so=to.overrides)===null||so===void 0?void 0:so.cosmosNetworks,evmNetworksOverrides:(co=to.overrides)===null||co===void 0?void 0:co.evmNetworks,projectSettings:au});useSendDynamicProps({environmentId:Lo,settings:to});const lu=useMultiWallet({isBridgeFlow:yl,multiWalletOverride:(lo=to.overrides)===null||lo===void 0?void 0:lo.multiWallet,multiWalletSettings:(uo=au==null?void 0:au.sdk)===null||uo===void 0?void 0:uo.multiWallet}),Nu=useMultiAsset({multiAssetOverride:(ho=to.overrides)===null||ho===void 0?void 0:ho.multiAsset,multiAssetSettings:(go=au==null?void 0:au.sdk)===null||go===void 0?void 0:go.enableMultiAsset}),Pu=useShowFiat({showFiatOverride:(bo=to.overrides)===null||bo===void 0?void 0:bo.showFiat,showFiatSettings:(wo=au==null?void 0:au.sdk)===null||wo===void 0?void 0:wo.showFiat}),[ip,Lu]=reactExports.useState(!1),Yu=useWalletBookCdn(),{imageUserInAccessList:_d,imageUserNotInAccessList:Qu,displayName:_f,appLogo:ep}=(au==null?void 0:au.general)||{};Cu=ep||Cu,_l=_f||_l;const[Xu,_h,zu]=useEmailLoginState((au==null?void 0:au.providers)||[],Yl),[Vu,Fu]=useDisplayOrderState(au),[Tu,Ru]=useWalletUiUtils({appLogoUrl:Cu,appName:_l,hideEmbeddedWalletTransactionUIs:!(!(($o=(Eo=au==null?void 0:au.sdk)===null||Eo===void 0?void 0:Eo.embeddedWallets)===null||$o===void 0)&&$o.showEmbeddedWalletActionsUI)});useCreateWalletConnectorOptions({appLogoUrl:Cu,appName:_l,coinbaseWalletPreference:Jo,deepLinkPreference:Al,flowNetwork:To,mobileExperience:Xo,networkConfigurations:tu,projectSettings:au,walletBook:Yu,walletConnectPreferredChains:cu,walletConnectorExtensions:Ll,walletConnectorsProp:Dl,walletUiUtils:Ru});const Ou=useWalletConnectorOptions(),[_u,$u]=useLocalStorage(AUTH_MODE,Ao),{clearPrimaryWalletId:Uu,primaryWalletId:ju,setPrimaryWalletId:Bu}=usePrimaryWalletId({environmentId:Lo,user:Yl}),[Hu,fp]=reactExports.useState(!1),wp=!!(_u==="connect-and-sign"?Yl:Hu),xp=reactExports.useRef(!1),[gp,fu]=useShowAuthFlow({isAuthenticated:wp,isMultiWalletEnabled:lu,isRenderingEmbeddedAuthFlow:xp,setShowDynamicUserProfile:yu}),{connectWallet:Cp,removeConnectedWalletsInfo:Rp,connectedWalletsInfo:Np,getConnectedWalletById:_p,connectedWallets:Tp,disconnectWallet:Ap,refreshConnectedWallet:Kp}=useConnectWallet({authMode:_u,clearPrimaryWalletId:Uu,enableVisitTrackingOnConnectOnly:Do,environmentId:Lo,handleConnectedWallet:ku==null?void 0:ku.handleConnectedWallet,isBridgeFlow:yl,primaryWalletId:ju,setPrimaryWalletId:Bu,setShowAuthFlow:fu,user:Yl,walletConnectorOptions:Ou}),Sp=reactExports.useMemo(()=>getMissingChains(vo,Np),[vo,Np]),{selectedWalletConnector:Ep,setSelectedWalletConnectorKey:qp}=useSelectedWalletConnector({walletConnectorOptions:Ou}),[Gp,Hp]=reactExports.useState(null);useSetWalletConnectorVerifiedCredentials(Yl??Wl,Ou),useSetWalletConnectorFetchers(Ou,Lo);const{primaryWallet:Dp,showQrcodeModal:lm,secondaryWallets:rm,setPrimaryWallet:V0,setShowQrcodeModal:Uy,wallets:t0}=useWalletConnectors({authMode:_u,canHaveMultipleWalletsConnected:lu,connectedWallets:Tp,primaryWalletId:ju,separateSmartWalletAndSigner:(Ro=(Co=au==null?void 0:au.sdk)===null||Co===void 0?void 0:Co.accountAbstraction)===null||Ro===void 0?void 0:Ro.separateSmartWalletAndSigner,setMultiWalletWidgetState:Zo,setPrimaryWalletId:Bu,user:Yl||Wl,walletConnectorOptions:Ou});reactExports.useEffect(()=>{fp(!(Sp!=null&&Sp.length)&&!!Dp)},[Sp,Dp]);const K0=t0.map(Op=>Op.connector);useFetchProjectSettings({environmentId:Lo});const{getNameService:G0,removeConnectedNameService:Z0}=useNameService({currentWallet:Dp??Tp[0],user:Yl}),{clearAllWalletConnectSessions:X0}=useClearWalletConnectSessions({connectors:K0}),f0=useHandleLogout({bridgeChains:vo,clearAllWalletConnectSessions:X0,clearPrimaryWalletId:Uu,connectedWallets:Tp,environmentId:Lo,events:iu,initialAuthenticationMode:Ao,removeBridgeOnboardingCompleted:xu,removeConnectedNameService:Z0,removeConnectedWalletsInfo:Rp,removeSessionStorageSessionKeys:()=>{StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),K0.forEach(Op=>{isSessionKeyCompatibleWalletConnector(Op)&&typeof(Op==null?void 0:Op.removeSessionKeys)=="function"&&(Op==null||Op.removeSessionKeys())})},resetLoginWithEmail:zu,setAuthMode:$u,setLegacyIsVerifying:Lu,setMultiWalletWidgetState:Zo,setSelectedWalletConnectorKey:qp,setShowAuthFlow:fu,setShowBridgeWidget:Gu,setShowDynamicUserProfile:yu,user:Yl,walletConnectors:K0});useValidateSession({environmentId:Lo,handleLogOut:f0});const{isLoading:C0}=useResetCookieLocalStorage({environmentId:Lo,projectSettings:au,setPrimaryWalletId:Bu}),Q0=useGlobalLoading({appName:_l,authMode:_u,connectedInfo:Np[0],connectedWallets:Tp,enableInstrumentation:no,environmentId:Lo,isLoadingUserFromCookie:C0,primaryWallet:Dp,primaryWalletId:ju,projectSettings:au,user:Yl??Wl,walletBook:Yu});useTieCallbacksToEvents({clientCallbacks:iu,user:Yl});const ey=useHandleUnlinkWallet({environmentId:Lo,primaryWalletId:ju,secondaryWallets:rm,verifiedCredentials:(Yl==null?void 0:Yl.verifiedCredentials)||[]}),{isLoading:T0,network:ty}=useWalletConnectorNetwork(Dp==null?void 0:Dp.connector);useWalletEventListeners({authMode:_u,detectNewWalletsForLinking:Po,disconnectWallet:Ap,handleLogOut:f0,multiWallet:lu,multiWalletWidgetState:Cl,primaryWallet:Dp,refreshConnectedWallet:Kp,secondaryWallets:rm,selectedWalletConnector:Ep,selectedWalletWithAction:Gp,setMultiWalletWidgetState:Zo,setPrimaryWalletId:Bu,setSelectedWalletConnectorKey:qp,setSelectedWalletWithAction:Hp,user:Yl});const{walletsForChainsMap:zy}=useFetchWalletsForChainsMap(Io);reactExports.useEffect(()=>{initExpirationTime(f0)},[f0,eu]);const{setCallback:vp}=useCustomerCallbacks({callbacks:{onAuthSuccess:iu==null?void 0:iu.onAuthSuccess,onUserProfileUpdate:iu==null?void 0:iu.onUserProfileUpdate},handleLogOut:f0,isAuthenticated:eu,primaryWallet:Dp,user:Yl}),yp=reactExports.useCallback(()=>Op=>{const{dynamicWagmiSettings:Ip}=Op;Ip&&sendDynamicProps(Lo,{dynamicWagmiSettings:{dynamicWagmiSettings:Ip}})},[Lo]),ou=reactExports.useCallback(()=>__awaiter$j(void 0,void 0,void 0,function*(){$l(""),Lu(!1),Yl||X0(),Zo("idle"),_u!=="connect-only"&&Rp(),StorageService.getItem(WALLET_PICKER_SEARCH_KEY)&&StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),Ep&&(!Dp||Dp.connector.key!==Ep.key)&&(yield Ep==null?void 0:Ep.endSession())}),[Yl,Zo,_u,Ep,Dp,X0,Rp]),{passkeySuccessPopup:Eu,setPasskeySuccessPopup:Wu}=usePasskeySuccessPopup(),up=reactExports.useMemo(()=>{var Op;return{accessDeniedButton:Mo,accessDeniedMessagePrimary:jo,accessDeniedMessageSecondary:Bo,accountSwitchState:Rl,appLogoUrl:Cu,appName:_l,authMode:_u,authToken:getAuthToken(),authorizationViewDisplayOrder:Vu,awaitingSignatureState:Hl,bridgeChains:vo,bridgeChainsToConnect:Sp,bridgeOnboardingCompleted:qu,clearStatesOnBackClick:ou,connectWallet:Cp,connectedWallets:Tp,consumeNonce:Su,cssOverrides:_o,customPrivacyPolicy:zo,customTermsOfServices:Tl,debugError:ko,defaultNumberOfWalletsToShow:So,defaultPhoneInputIso2:Fo,desktopUri:xl,detectNewWalletsForLinking:Po,disconnectWallet:Ap,displaySiweStatement:mo,enableConnectOnlyFallback:fo,environmentId:Lo,events:iu,getConnectedWalletById:_p,getNameService:G0,handleLogOut:f0,handleUnlinkWallet:_u==="connect-only"?Ap:ey,handlers:ku,i18nSDKInstance:Go,isBridgeFlow:yl,isRenderingEmbeddedAuthFlow:xp,isSingleWalletAccount:Ml,legacyIsVerifying:ip,linkedWallets:_u==="connect-only"||!Yl?[]:t0,loadingNetwork:T0,locale:{changeLanguage:Locale.getInstance().changeLanguage},loginWithEmail:Xu,minAuthToken:getMinAuthToken$1(),multiAsset:Nu,multiWallet:lu,multiWalletWidgetState:Cl,network:ty,networkConfigurations:tu,networkValidationMode:hu,newToWeb3WalletChainMap:zy,notInTheListImageUrl:Qu||qo,onboardingImageUrl:_d||Ko,overrides:to.overrides,passkeySuccessPopup:Eu,policiesConsentInnerComponent:Qo,primaryWallet:Dp,primaryWalletId:ju,privacyPolicyUrl:ga,projectSettings:au,qrcodeUri:ru,recommendedWallets:Xl,redirectUrl:to.redirectUrl,removeBridgeOnboardingCompleted:xu,removeConnectedWalletsInfo:Rp,sdkHasLoaded:Q0,secondaryWallets:rm,selectedTabIndex:Ul,selectedTabSettings:Ql,selectedWalletConnector:Ep,selectedWalletWithAction:Gp,sendWagmiSettings:yp,setAuthMode:$u,setAuthorizationViewDisplayOrder:Fu,setBridgeOnboardingCompleted:pu,setCallback:vp,setDesktopUri:$l,setIsSingleWalletAccount:Nl,setLegacyIsVerifying:Lu,setLogInWithEmail:_h,setMultiWalletWidgetState:Zo,setPasskeySuccessPopup:Wu,setPrimaryWallet:V0,setPrimaryWalletId:Bu,setQrcodeUri:uu,setSelectedTabIndex:su,setSelectedWalletConnectorKey:qp,setSelectedWalletWithAction:Hp,setShowAuthFlow:fu,setShowBridgeWidget:Gu,setShowDynamicUserProfile:yu,setShowQrcodeModal:Uy,shadowDOMEnabled:Ol,showAuthFlow:gp,showBridgeWidget:wu,showDynamicUserProfile:Au,showFiat:Pu,showLockedWalletView:Jl,showQrcodeModal:lm,siweStatement:Vl,socialMediaIconUrl:((Op=au==null?void 0:au.general)===null||Op===void 0?void 0:Op.supportUrls)||Sl,socialMediaLinkText:$a,socialMediaUrl:El,socialProvidersFilter:Fl,socialSettings:to.social,tabsItems:vu,termsOfServiceUrl:Il,theme:eo,toolkitEnabled:Zl,user:Yl,userWithMissingInfo:Wl,walletConnectorOptions:Ou,walletUiUtils:Ru,walletsFilter:Ho}},[Mo,jo,Bo,Rl,Cu,_l,_u,Vu,Hl,vo,Sp,qu,ou,Cp,Tp,Su,_o,zo,Tl,ko,So,Fo,xl,Po,Ap,mo,fo,Lo,iu,_p,G0,f0,ey,ku,Go,yl,Ml,ip,Yl,t0,T0,Xu,Nu,lu,Cl,ty,tu,hu,zy,Qu,qo,_d,Ko,to.overrides,to.redirectUrl,to.social,Eu,Qo,Dp,ju,ga,au,ru,Xl,xu,Rp,Q0,rm,Ul,Ql,Ep,Gp,yp,$u,Fu,pu,vp,_h,Zo,Wu,V0,Bu,su,qp,fu,Uy,Ol,gp,wu,Au,Pu,Jl,lm,Vl,Sl,$a,El,Fl,vu,Il,eo,Zl,Wl,Ou,Ru,Ho]);return usePrefetch({as:"image",href:getIconicSpriteUrl$1(),id:"sprite",type:"image/svg+xml"}),usePrefetch({as:"fetch",href:getWalletBookCdnUrl(),id:"wallet-book",type:"application/json"}),usePrefetch({as:"fetch",href:`${ApiEndpoint$1.getBaseUrl()}/sdk/${Lo}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION$4}`)}`,id:`project-settings-${Lo}`,type:"application/json"}),reactExports.useEffect(()=>{!lu&&Cl!=="awaiting_account_switch"||Yl&&Cl!=="idle"&&!Au&&yu(!0)},[lu,Cl,Au]),jsxRuntimeExports.jsx(I18nextProvider,{i18n:Go,children:jsxRuntimeExports.jsx(DynamicContext.Provider,{value:up,children:jsxRuntimeExports.jsx(WalletBookContextProvider,{walletBook:Yu,children:jsxRuntimeExports.jsx(ThemeContextProvider,{customerTheme:parseTheme(eo,((Oo=au==null?void 0:au.design)===null||Oo===void 0?void 0:Oo.modal)||void 0),designSettings:au==null?void 0:au.design,children:jsxRuntimeExports.jsx(LoadingContextProvider,{children:jsxRuntimeExports.jsxs(ViewContextProvider,{initialView:getInitialView({bridgeOnboardingCompleted:qu,connectedWallets:Tp,isAuthenticated:eu||!!Dp,isBridgeFlow:yl,isMultiWalletEnabled:lu}),children:[hu==="always"&&jsxRuntimeExports.jsx(UseNetworkValidation,{}),jsxRuntimeExports.jsx(CaptchaContextProvider,{children:jsxRuntimeExports.jsx(AccountExistsContextProvider,{children:jsxRuntimeExports.jsx(WalletContextProvider,{children:jsxRuntimeExports.jsx(VerificationProvider,{children:jsxRuntimeExports.jsx(PasskeyContextProvider,{children:jsxRuntimeExports.jsx(DynamicWidgetContextProvider,{children:jsxRuntimeExports.jsx(DynamicBridgeWidgetContextProvider,{children:jsxRuntimeExports.jsx(FundingContextProvider,{children:jsxRuntimeExports.jsx(AccessDeniedContextProvider,{children:jsxRuntimeExports.jsx(SendBalanceContextProvider,{children:jsxRuntimeExports.jsx(WalletGroupContextProvider,{children:jsxRuntimeExports.jsx(UserFieldEditorContextProvider,{children:jsxRuntimeExports.jsx(ConnectWithOtpProvider,{children:jsxRuntimeExports.jsx(PhantomRedirectContextProvider,{children:jsxRuntimeExports.jsxs(SocialRedirectContextProvider,{children:[jsxRuntimeExports.jsx(DynamicAuthFlow,{}),jsxRuntimeExports.jsx(Toolkit,{}),jsxRuntimeExports.jsx(FundingWidget,{}),jsxRuntimeExports.jsx(SyncAuthFlow,{}),jsxRuntimeExports.jsx(TelegramAutoLogin,{}),jsxRuntimeExports.jsx(WalletConnectorEvents,{}),Tu,jsxRuntimeExports.jsx(ErrorBoundaryExclude,{children:Xr})]})})})})})})})})})})})})})})})]})})})})})})},DynamicContextProvider=Xr=>(Logger$2.setEnvironmentId(Xr.settings.environmentId),Logger$2.setEmitErrors(Xr.emitErrors),useParentDynamicContextGuard(),jsxRuntimeExports.jsx(ReinitializeContextProvider,{onReinitialize:removeStoreInstance,children:jsxRuntimeExports.jsx(ErrorBoundary,{children:jsxRuntimeExports.jsx(ErrorContextProvider,{children:jsxRuntimeExports.jsx(UserWalletsProvider,{children:jsxRuntimeExports.jsx(FieldsStateProvider,{children:jsxRuntimeExports.jsx(IpConfigurationContextProvider,{children:jsxRuntimeExports.jsx(WidgetRegistryContextProvider,{children:jsxRuntimeExports.jsx(InnerDynamicContextProvider,Object.assign({},Xr))})})})})})})}));assertPackageVersion("@dynamic-labs/sdk-react-core",version$u);function Signup(){const[Xr,eo]=reactExports.useState(1),[to,ro]=reactExports.useState(!1),[no,io]=reactExports.useState(null),[oo,ao]=reactExports.useState([]),[so,co]=reactExports.useState(Array(12).fill("")),{setShowAuthFlow:lo,primaryWallet:uo,handleLogOut:ho}=useDynamicContext(),[go,bo]=reactExports.useState(null),{dispatch:wo}=useGlobalState(),Eo=useNavigate();reactExports.useEffect(()=>{if(no!=null&&no.mnemonic){const Fo=no.mnemonic.split(" ");co(Fo)}},[no]);const $o=()=>eo(Xr+1),Co=async()=>{if(no){ro(!0);try{await no.registerPushAccount(),wo({type:"INITIALIZE_WALLET",payload:no}),Eo("/")}catch(Fo){alert(Fo)}ro(!1)}},Ro=async()=>{try{const Fo=await PushWallet.signUp(config$3.APP_ENV);io(Fo),ao(Object.keys(Fo.walletToEncDerivedKey))}catch(Fo){alert(Fo)}},Oo=async()=>{const Fo=await PushSigner.initialize(uo,"DYNAMIC");await(no==null?void 0:no.connectWalletWithAccount(Fo)),ao(Object.keys(no.walletToEncDerivedKey))},jo=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 text-center",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("button",{onClick:async()=>{bo("mnemonic"),await Ro()},className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64 mx-10",children:"Using Mnemonic"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("button",{onClick:()=>bo("social"),className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-lg w-64",disabled:!0,children:["Social Signup ",jsxRuntimeExports.jsx("br",{})," Coming Soon 🚀"]})})]}),Bo=()=>{const Fo=()=>{const Wo=so.join(" ");navigator.clipboard.writeText(Wo).then(()=>alert("Copied to clipboard")).catch(()=>alert("Failed to copy"))};return jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("h2",{className:"text-2xl mb-6",children:"Store Seed Phrase Safely"}),jsxRuntimeExports.jsx(MnemonicGrid,{words:so,disabled:!0}),jsxRuntimeExports.jsx("button",{className:"border border-blue-600 text-blue-600 px-4 py-2 rounded-lg w-30",onClick:Fo,children:"Copy"}),jsxRuntimeExports.jsx("p",{className:"mb-6 mt-20 text-gray-600",children:"Your wallet needs to be registered on the Push network to be able to send transactions on the network."}),jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-40",onClick:$o,children:"Next"})]})},Mo=()=>jsxRuntimeExports.jsxs("div",{className:"text-center space-y-6 mt-6",children:[jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-4",children:uo?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("button",{className:"border border-blue-600 text-blue-600 px-6 py-3 rounded-md",onClick:()=>{ho()},children:["Disconnect ",jsxRuntimeExports.jsx("b",{children:uo.address})]}),jsxRuntimeExports.jsx("button",{className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",onClick:Oo,children:"Add to Push Account"})]}):jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",onClick:()=>lo(!0),children:"Connect Web3 Account"})}),jsxRuntimeExports.jsx("button",{disabled:to,onClick:Co,className:to?"w-full py-3 bg-grey flex items-center justify-center":"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:to?"Registering":jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Register Push Account"]})})]});return jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"p-8 w-full max-w-4xl",children:[Xr===1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!go&&jo(),go==="mnemonic"&&Bo()]}),Xr===2&&jsxRuntimeExports.jsx("div",{className:"space-y-2 text-center",children:oo.map(Fo=>jsxRuntimeExports.jsx("div",{className:"inline-flex items-center bg-blue-100 text-blue-800 text-sm font-medium rounded-full px-4 py-2 border border-blue-300",children:jsxRuntimeExports.jsx("span",{className:"font-mono",children:Fo})},Fo))}),Xr===2&&Mo()]})})}function Login(){const[Xr,eo]=reactExports.useState(null),[to,ro]=reactExports.useState(Array(12).fill("")),{setShowAuthFlow:no,primaryWallet:io,handleLogOut:oo}=useDynamicContext(),{dispatch:ao}=useGlobalState(),so=useNavigate(),co=(bo,wo)=>{const Eo=[...to];Eo[bo]=wo,ro(Eo)},lo=async()=>{try{let bo;switch(Xr){case"mnemonic":{bo=await PushWallet.logInWithMnemonic(to.join(" "),config$3.APP_ENV);break}case"wallet":{const wo=await PushSigner.initialize(io,"DYNAMIC");bo=await PushWallet.loginWithWallet(wo,config$3.APP_ENV);break}}ao({type:"INITIALIZE_WALLET",payload:bo}),so("/")}catch(bo){alert(bo)}},uo=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 text-center",children:[jsxRuntimeExports.jsx("button",{onClick:()=>eo("mnemonic"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",children:"Using Mnemonic"}),jsxRuntimeExports.jsx("button",{onClick:()=>eo("wallet"),className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",children:"Using Web3 Account"}),jsxRuntimeExports.jsxs("button",{onClick:()=>eo("social"),className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-lg w-64",disabled:!0,children:["Social Login ",jsxRuntimeExports.jsx("br",{})," Coming Soon 🚀"]})]}),ho=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx(MnemonicGrid,{words:to,disabled:!1,handleMnemonicChange:co}),jsxRuntimeExports.jsxs("button",{onClick:lo,disabled:to.some(bo=>bo===""),className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Unlock Push Account"]})]}),go=()=>jsxRuntimeExports.jsxs("div",{className:"text-center space-y-6",children:[jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-4",children:io?jsxRuntimeExports.jsxs("button",{className:"border border-blue-600 text-blue-600 px-6 py-1 rounded-md",onClick:()=>{oo()},children:["Disconnect ",io.address]}):jsxRuntimeExports.jsx("button",{className:"bg-blue-600 text-white px-6 py-3 rounded-lg w-64",onClick:()=>no(!0),children:"Connect Web3 Account"})}),jsxRuntimeExports.jsxs("button",{onClick:lo,disabled:!io,className:"w-full py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 flex items-center justify-center",children:[jsxRuntimeExports.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Unlock Push Account"]})]});return jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"p-8 w-full max-w-lg",children:[!Xr&&uo(),Xr==="mnemonic"&&ho(),Xr==="wallet"&&go()]})})}const GlobalStyle=$e$3` + /* Font Family */ + --font-family: 'FK Grotesk Neu'; + + /* New blocks theme css variables*/ + ${Xr=>getBlocksCSSVariables(Xr.theme.blocksTheme)} + } +`,themeConfig={dark:{blocksTheme:blocksTheme.dark,scheme:"dark"},light:{blocksTheme:blocksTheme.light,scheme:"light"}};function App(){const{isDarkMode:Xr}=useDarkMode();return jsxRuntimeExports.jsxs(Le$4,{theme:Xr?themeConfig.dark:themeConfig.light,children:[jsxRuntimeExports.jsx(GlobalStyle,{}),jsxRuntimeExports.jsx(GlobalProvider,{children:jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex flex-col",children:[jsxRuntimeExports.jsx("h1",{className:"text-4xl font-bold mt-8 text-center",children:config$3.APP_NAME}),jsxRuntimeExports.jsx("div",{className:"flex-1 flex items-center justify-center",children:jsxRuntimeExports.jsx(BrowserRouter,{basename:getAppBasePath(),children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"login",element:jsxRuntimeExports.jsx(Login,{})}),jsxRuntimeExports.jsx(Route,{path:"signup",element:jsxRuntimeExports.jsx(Signup,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/"})})]})})})]})})]})}var version$j="3.5.1";function __awaiter$i(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var funcTag="[object Function]",genTag="[object GeneratorFunction]",reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal||freeSelf||Function("return this")();function getValue$1(Xr,eo){return Xr==null?void 0:Xr[eo]}function isHostObject(Xr){var eo=!1;if(Xr!=null&&typeof Xr.toString!="function")try{eo=!!(Xr+"")}catch{}return eo}var funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root$1["__core-js_shared__"],maskSrcKey=function(){var Xr=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return Xr?"Symbol(src)_1."+Xr:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString$1=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol$1=root$1.Symbol;Symbol$1&&Symbol$1.isConcatSpreadable;getNative(root$1,"Map");getNative(Object,"create");function baseIsNative(Xr){if(!isObject$8(Xr)||isMasked(Xr))return!1;var eo=isFunction(Xr)||isHostObject(Xr)?reIsNative:reIsHostCtor;return eo.test(toSource(Xr))}function getNative(Xr,eo){var to=getValue$1(Xr,eo);return baseIsNative(to)?to:void 0}function isMasked(Xr){return!!maskSrcKey&&maskSrcKey in Xr}function toSource(Xr){if(Xr!=null){try{return funcToString.call(Xr)}catch{}try{return Xr+""}catch{}}return""}function isFunction(Xr){var eo=isObject$8(Xr)?objectToString$1.call(Xr):"";return eo==funcTag||eo==genTag}function isObject$8(Xr){var eo=typeof Xr;return!!Xr&&(eo=="object"||eo=="function")}var store2;function getGlobalMessage(Xr){return store2==null?void 0:store2.get(Xr)}var store3;function getSchemaMessage(Xr){return store3==null?void 0:store3.get(Xr)}var store4;function getSpecificMessage(Xr,eo){var to;return(to=store4==null?void 0:store4.get(Xr))==null?void 0:to.get(eo)}function _stringify(Xr){var to,ro;let eo=typeof Xr;return eo==="object"&&(eo=(Xr&&((ro=(to=Object.getPrototypeOf(Xr))==null?void 0:to.constructor)==null?void 0:ro.name))??"null"),eo==="string"?`"${Xr}"`:eo==="number"||eo==="bigint"||eo==="boolean"?`${Xr}`:eo}function _addIssue(Xr,eo,to,ro,no){const io=no&&"input"in no?no.input:to.value,oo=(no==null?void 0:no.expected)??Xr.expects??null,ao=(no==null?void 0:no.received)??_stringify(io),so={kind:Xr.kind,type:Xr.type,input:io,expected:oo,received:ao,message:`Invalid ${eo}: ${oo?`Expected ${oo} but r`:"R"}eceived ${ao}`,requirement:Xr.requirement,path:no==null?void 0:no.path,issues:no==null?void 0:no.issues,lang:ro.lang,abortEarly:ro.abortEarly,abortPipeEarly:ro.abortPipeEarly},co=Xr.kind==="schema",lo=(no==null?void 0:no.message)??Xr.message??getSpecificMessage(Xr.reference,so.lang)??(co?getSchemaMessage(so.lang):null)??ro.message??getGlobalMessage(so.lang);lo&&(so.message=typeof lo=="function"?lo(so):lo),co&&(to.typed=!1),to.issues?to.issues.push(so):to.issues=[so]}function _isValidObjectKey(Xr,eo){return Object.hasOwn(Xr,eo)&&eo!=="__proto__"&&eo!=="prototype"&&eo!=="constructor"}function getDefault(Xr,eo,to){return typeof Xr.default=="function"?Xr.default(eo,to):Xr.default}function is$7(Xr,eo){return!Xr._run({typed:!1,value:eo},{abortEarly:!0}).issues}function array$3(Xr,eo){return{kind:"schema",type:"array",reference:array$3,expects:"Array",async:!1,item:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(Array.isArray(no)){to.typed=!0,to.value=[];for(let oo=0;ooisNaN(+ro)).map(([,ro])=>ro);return{kind:"schema",type:"enum",reference:enum_,expects:to.map(_stringify).join(" | ")||"never",async:!1,enum:Xr,options:to,message:eo,_run(ro,no){return this.options.includes(ro.value)?ro.typed=!0:_addIssue(this,"type",ro,no),ro}}}function literal$3(Xr,eo){return{kind:"schema",type:"literal",reference:literal$3,expects:_stringify(Xr),async:!1,literal:Xr,message:eo,_run(to,ro){return to.value===this.literal?to.typed=!0:_addIssue(this,"type",to,ro),to}}}function looseObject(Xr,eo){return{kind:"schema",type:"loose_object",reference:looseObject,expects:"Object",async:!1,entries:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(no&&typeof no=="object"){to.typed=!0,to.value={};for(const oo in this.entries){const ao=no[oo],so=this.entries[oo]._run({typed:!1,value:ao},ro);if(so.issues){const co={type:"object",origin:"value",input:no,key:oo,value:ao};for(const lo of so.issues)lo.path?lo.path.unshift(co):lo.path=[co],(io=to.issues)==null||io.push(lo);if(to.issues||(to.issues=so.issues),ro.abortEarly){to.typed=!1;break}}so.typed||(to.typed=!1),(so.value!==void 0||oo in no)&&(to.value[oo]=so.value)}if(!to.issues||!ro.abortEarly)for(const oo in no)_isValidObjectKey(no,oo)&&!(oo in this.entries)&&(to.value[oo]=no[oo])}else _addIssue(this,"type",to,ro);return to}}}function nonOptional(Xr,eo){return{kind:"schema",type:"non_optional",reference:nonOptional,expects:"!undefined",async:!1,wrapped:Xr,message:eo,_run(to,ro){return to.value===void 0?(_addIssue(this,"type",to,ro),to):this.wrapped._run(to,ro)}}}function null_(Xr){return{kind:"schema",type:"null",reference:null_,expects:"null",async:!1,message:Xr,_run(eo,to){return eo.value===null?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function nullish(Xr,...eo){const to={kind:"schema",type:"nullish",reference:nullish,expects:`${Xr.expects} | null | undefined`,async:!1,wrapped:Xr,_run(ro,no){return(ro.value===null||ro.value===void 0)&&("default"in this&&(ro.value=getDefault(this,ro,no)),ro.value===null||ro.value===void 0)?(ro.typed=!0,ro):this.wrapped._run(ro,no)}};return 0 in eo&&(to.default=eo[0]),to}function number$4(Xr){return{kind:"schema",type:"number",reference:number$4,expects:"number",async:!1,message:Xr,_run(eo,to){return typeof eo.value=="number"&&!isNaN(eo.value)?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function object(Xr,eo){return{kind:"schema",type:"object",reference:object,expects:"Object",async:!1,entries:Xr,message:eo,_run(to,ro){var io;const no=to.value;if(no&&typeof no=="object"){to.typed=!0,to.value={};for(const oo in this.entries){const ao=no[oo],so=this.entries[oo]._run({typed:!1,value:ao},ro);if(so.issues){const co={type:"object",origin:"value",input:no,key:oo,value:ao};for(const lo of so.issues)lo.path?lo.path.unshift(co):lo.path=[co],(io=to.issues)==null||io.push(lo);if(to.issues||(to.issues=so.issues),ro.abortEarly){to.typed=!1;break}}so.typed||(to.typed=!1),(so.value!==void 0||oo in no)&&(to.value[oo]=so.value)}}else _addIssue(this,"type",to,ro);return to}}}function optional$4(Xr,...eo){const to={kind:"schema",type:"optional",reference:optional$4,expects:`${Xr.expects} | undefined`,async:!1,wrapped:Xr,_run(ro,no){return ro.value===void 0&&("default"in this&&(ro.value=getDefault(this,ro,no)),ro.value===void 0)?(ro.typed=!0,ro):this.wrapped._run(ro,no)}};return 0 in eo&&(to.default=eo[0]),to}function picklist(Xr,eo){return{kind:"schema",type:"picklist",reference:picklist,expects:Xr.map(_stringify).join(" | ")||"never",async:!1,options:Xr,message:eo,_run(to,ro){return this.options.includes(to.value)?to.typed=!0:_addIssue(this,"type",to,ro),to}}}function string$4(Xr){return{kind:"schema",type:"string",reference:string$4,expects:"string",async:!1,message:Xr,_run(eo,to){return typeof eo.value=="string"?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function undefined_(Xr){return{kind:"schema",type:"undefined",reference:undefined_,expects:"undefined",async:!1,message:Xr,_run(eo,to){return eo.value===void 0?eo.typed=!0:_addIssue(this,"type",eo,to),eo}}}function _subIssues(Xr){let eo;if(Xr)for(const to of Xr)eo?eo.push(...to.issues):eo=to.issues;return eo}function union$3(Xr,eo){return{kind:"schema",type:"union",reference:union$3,expects:[...new Set(Xr.map(to=>to.expects))].join(" | ")||"never",async:!1,options:Xr,message:eo,_run(to,ro){let no,io,oo;for(const ao of this.options){const so=ao._run({typed:!1,value:to.value},ro);if(so.typed)if(so.issues)io?io.push(so):io=[so];else{no=so;break}else oo?oo.push(so):oo=[so]}if(no)return no;if(io){if(io.length===1)return io[0];_addIssue(this,"type",to,ro,{issues:_subIssues(io)}),to.typed=!0}else{if((oo==null?void 0:oo.length)===1)return oo[0];_addIssue(this,"type",to,ro,{issues:_subIssues(oo)})}return to}}}function unknown$3(){return{kind:"schema",type:"unknown",reference:unknown$3,expects:"unknown",async:!1,_run(Xr){return Xr.typed=!0,Xr}}}var lib$2={},signer={},base64Url={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$6=0,len=code.length;i$60)throw new Error("Invalid string. Length must be a multiple of 4");var to=Xr.indexOf("=");to===-1&&(to=eo);var ro=to===eo?0:4-to%4;return[to,ro]}function byteLength(Xr){var eo=getLens(Xr),to=eo[0],ro=eo[1];return(to+ro)*3/4-ro}function _byteLength(Xr,eo,to){return(eo+to)*3/4-to}function toByteArray(Xr){var eo,to=getLens(Xr),ro=to[0],no=to[1],io=new Arr(_byteLength(Xr,ro,no)),oo=0,ao=no>0?ro-4:ro,so;for(so=0;so>16&255,io[oo++]=eo>>8&255,io[oo++]=eo&255;return no===2&&(eo=revLookup[Xr.charCodeAt(so)]<<2|revLookup[Xr.charCodeAt(so+1)]>>4,io[oo++]=eo&255),no===1&&(eo=revLookup[Xr.charCodeAt(so)]<<10|revLookup[Xr.charCodeAt(so+1)]<<4|revLookup[Xr.charCodeAt(so+2)]>>2,io[oo++]=eo>>8&255,io[oo++]=eo&255),io}function tripletToBase64(Xr){return lookup[Xr>>18&63]+lookup[Xr>>12&63]+lookup[Xr>>6&63]+lookup[Xr&63]}function encodeChunk(Xr,eo,to){for(var ro,no=[],io=eo;ioao?ao:oo+io));return ro===1?(eo=Xr[to-1],no.push(lookup[eo>>2]+lookup[eo<<4&63]+"==")):ro===2&&(eo=(Xr[to-2]<<8)+Xr[to-1],no.push(lookup[eo>>10]+lookup[eo>>4&63]+lookup[eo<<2&63]+"=")),no.join("")}Object.defineProperty(base64Url,"__esModule",{value:!0});base64Url.decode=base64Url.encode=base64Url.unescape=base64Url.escape=base64Url.pad=void 0;const base64_js_1$1=base64Js;function pad(Xr){return`${Xr}${"=".repeat(4-(Xr.length%4||4))}`}base64Url.pad=pad;function escape(Xr){return Xr.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}base64Url.escape=escape;function unescape$1(Xr){return pad(Xr).replace(/-/g,"+").replace(/_/g,"/")}base64Url.unescape=unescape$1;function encode$n(Xr){return escape((0,base64_js_1$1.fromByteArray)(new TextEncoder().encode(Xr)))}base64Url.encode=encode$n;function decode$q(Xr){return new TextDecoder().decode((0,base64_js_1$1.toByteArray)(pad(unescape$1(Xr))))}base64Url.decode=decode$q;var cryptoClients={},secp256k1$1={};const require$$0$a=getAugmentedNamespace(hmac$5);var lib$1={},cryptoBrowserify={},browser$g={exports:{}},safeBuffer$1={exports:{}};const require$$0$9=getAugmentedNamespace(dist$2);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(Xr,eo){var to=require$$0$9,ro=to.Buffer;function no(oo,ao){for(var so in oo)ao[so]=oo[so]}ro.from&&ro.alloc&&ro.allocUnsafe&&ro.allocUnsafeSlow?Xr.exports=to:(no(to,eo),eo.Buffer=io);function io(oo,ao,so){return ro(oo,ao,so)}io.prototype=Object.create(ro.prototype),no(ro,io),io.from=function(oo,ao,so){if(typeof oo=="number")throw new TypeError("Argument must not be a number");return ro(oo,ao,so)},io.alloc=function(oo,ao,so){if(typeof oo!="number")throw new TypeError("Argument must be a number");var co=ro(oo);return ao!==void 0?typeof so=="string"?co.fill(ao,so):co.fill(ao):co.fill(0),co},io.allocUnsafe=function(oo){if(typeof oo!="number")throw new TypeError("Argument must be a number");return ro(oo)},io.allocUnsafeSlow=function(oo){if(typeof oo!="number")throw new TypeError("Argument must be a number");return to.SlowBuffer(oo)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,hasRequiredBrowser$b;function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$g.exports;hasRequiredBrowser$b=1;var Xr=65536,eo=4294967295;function to(){throw new Error(`Secure random number generation is not supported by this browser. +Use Chrome, Firefox or Internet Explorer 11`)}var ro=safeBufferExports.Buffer,no=commonjsGlobal.crypto||commonjsGlobal.msCrypto;no&&no.getRandomValues?browser$g.exports=io:browser$g.exports=to;function io(oo,ao){if(oo>eo)throw new RangeError("requested too many random bytes");var so=ro.allocUnsafe(oo);if(oo>0)if(oo>Xr)for(var co=0;co0&&(oo=to[0]),oo instanceof Error)throw oo;var ao=new Error("Unhandled error."+(oo?" ("+oo.message+")":""));throw ao.context=oo,ao}var so=io[eo];if(so===void 0)return!1;if(typeof so=="function")ReflectApply(so,this,to);else for(var co=so.length,lo=arrayClone(so,co),ro=0;ro0&&oo.length>no&&!oo.warned){oo.warned=!0;var ao=new Error("Possible EventEmitter memory leak detected. "+oo.length+" "+String(eo)+" listeners added. Use emitter.setMaxListeners() to increase limit");ao.name="MaxListenersExceededWarning",ao.emitter=Xr,ao.type=eo,ao.count=oo.length,ProcessEmitWarning(ao)}return Xr}EventEmitter.prototype.addListener=function(eo,to){return _addListener(this,eo,to,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(eo,to){return _addListener(this,eo,to,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(Xr,eo,to){var ro={fired:!1,wrapFn:void 0,target:Xr,type:eo,listener:to},no=onceWrapper.bind(ro);return no.listener=to,ro.wrapFn=no,no}EventEmitter.prototype.once=function(eo,to){return checkListener(to),this.on(eo,_onceWrap(this,eo,to)),this};EventEmitter.prototype.prependOnceListener=function(eo,to){return checkListener(to),this.prependListener(eo,_onceWrap(this,eo,to)),this};EventEmitter.prototype.removeListener=function(eo,to){var ro,no,io,oo,ao;if(checkListener(to),no=this._events,no===void 0)return this;if(ro=no[eo],ro===void 0)return this;if(ro===to||ro.listener===to)--this._eventsCount===0?this._events=Object.create(null):(delete no[eo],no.removeListener&&this.emit("removeListener",eo,ro.listener||to));else if(typeof ro!="function"){for(io=-1,oo=ro.length-1;oo>=0;oo--)if(ro[oo]===to||ro[oo].listener===to){ao=ro[oo].listener,io=oo;break}if(io<0)return this;io===0?ro.shift():spliceOne(ro,io),ro.length===1&&(no[eo]=ro[0]),no.removeListener!==void 0&&this.emit("removeListener",eo,ao||to)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(eo){var to,ro,no;if(ro=this._events,ro===void 0)return this;if(ro.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ro[eo]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete ro[eo]),this;if(arguments.length===0){var io=Object.keys(ro),oo;for(no=0;no=0;no--)this.removeListener(eo,to[no]);return this};function _listeners(Xr,eo,to){var ro=Xr._events;if(ro===void 0)return[];var no=ro[eo];return no===void 0?[]:typeof no=="function"?to?[no.listener||no]:[no]:to?unwrapListeners(no):arrayClone(no,no.length)}EventEmitter.prototype.listeners=function(eo){return _listeners(this,eo,!0)};EventEmitter.prototype.rawListeners=function(eo){return _listeners(this,eo,!1)};EventEmitter.listenerCount=function(Xr,eo){return typeof Xr.listenerCount=="function"?Xr.listenerCount(eo):listenerCount.call(Xr,eo)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(Xr){var eo=this._events;if(eo!==void 0){var to=eo[Xr];if(typeof to=="function")return 1;if(to!==void 0)return to.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(Xr,eo){for(var to=new Array(eo),ro=0;ro"u"||!wo?Xr:wo(Uint8Array),Co={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Xr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Xr:ArrayBuffer,"%ArrayIteratorPrototype%":go&&wo?wo([][Symbol.iterator]()):Xr,"%AsyncFromSyncIteratorPrototype%":Xr,"%AsyncFunction%":Eo,"%AsyncGenerator%":Eo,"%AsyncGeneratorFunction%":Eo,"%AsyncIteratorPrototype%":Eo,"%Atomics%":typeof Atomics>"u"?Xr:Atomics,"%BigInt%":typeof BigInt>"u"?Xr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Xr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Xr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Xr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eo,"%eval%":eval,"%EvalError%":to,"%Float32Array%":typeof Float32Array>"u"?Xr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Xr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Xr:FinalizationRegistry,"%Function%":so,"%GeneratorFunction%":Eo,"%Int8Array%":typeof Int8Array>"u"?Xr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Xr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Xr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":go&&wo?wo(wo([][Symbol.iterator]())):Xr,"%JSON%":typeof JSON=="object"?JSON:Xr,"%Map%":typeof Map>"u"?Xr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!go||!wo?Xr:wo(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Xr:Promise,"%Proxy%":typeof Proxy>"u"?Xr:Proxy,"%RangeError%":ro,"%ReferenceError%":no,"%Reflect%":typeof Reflect>"u"?Xr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Xr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!go||!wo?Xr:wo(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Xr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":go&&wo?wo(""[Symbol.iterator]()):Xr,"%Symbol%":go?Symbol:Xr,"%SyntaxError%":io,"%ThrowTypeError%":ho,"%TypedArray%":$o,"%TypeError%":oo,"%Uint8Array%":typeof Uint8Array>"u"?Xr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Xr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Xr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Xr:Uint32Array,"%URIError%":ao,"%WeakMap%":typeof WeakMap>"u"?Xr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Xr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Xr:WeakSet};if(wo)try{null.error}catch(To){var Ro=wo(wo(To));Co["%Error.prototype%"]=Ro}var Oo=function To(Ao){var ko;if(Ao==="%AsyncFunction%")ko=co("async function () {}");else if(Ao==="%GeneratorFunction%")ko=co("function* () {}");else if(Ao==="%AsyncGeneratorFunction%")ko=co("async function* () {}");else if(Ao==="%AsyncGenerator%"){var mo=To("%AsyncGeneratorFunction%");mo&&(ko=mo.prototype)}else if(Ao==="%AsyncIteratorPrototype%"){var Io=To("%AsyncGenerator%");Io&&wo&&(ko=wo(Io.prototype))}return Co[Ao]=ko,ko},jo={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Bo=requireFunctionBind(),Mo=requireHasown(),Fo=Bo.call(Function.call,Array.prototype.concat),Wo=Bo.call(Function.apply,Array.prototype.splice),Jo=Bo.call(Function.call,String.prototype.replace),Po=Bo.call(Function.call,String.prototype.slice),fo=Bo.call(Function.call,RegExp.prototype.exec),yo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vo=/\\(\\)?/g,_o=function(Ao){var ko=Po(Ao,0,1),mo=Po(Ao,-1);if(ko==="%"&&mo!=="%")throw new io("invalid intrinsic syntax, expected closing `%`");if(mo==="%"&&ko!=="%")throw new io("invalid intrinsic syntax, expected opening `%`");var Io=[];return Jo(Ao,yo,function(Do,Lo,Ho,Yo){Io[Io.length]=Ho?Jo(Yo,vo,"$1"):Lo||Do}),Io},So=function(Ao,ko){var mo=Ao,Io;if(Mo(jo,mo)&&(Io=jo[mo],mo="%"+Io[0]+"%"),Mo(Co,mo)){var Do=Co[mo];if(Do===Eo&&(Do=Oo(mo)),typeof Do>"u"&&!ko)throw new oo("intrinsic "+Ao+" exists, but is not available. Please file an issue!");return{alias:Io,name:mo,value:Do}}throw new io("intrinsic "+Ao+" does not exist!")};return getIntrinsic=function(Ao,ko){if(typeof Ao!="string"||Ao.length===0)throw new oo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ko!="boolean")throw new oo('"allowMissing" argument must be a boolean');if(fo(/^%?[^%]*%?$/,Ao)===null)throw new io("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var mo=_o(Ao),Io=mo.length>0?mo[0]:"",Do=So("%"+Io+"%",ko),Lo=Do.name,Ho=Do.value,Yo=!1,Xo=Do.alias;Xo&&(Io=Xo[0],Wo(mo,Fo([0,1],Xo)));for(var qo=1,Ko=!0;qo=mo.length){var $a=lo(Ho,Qo);Ko=!!$a,Ko&&"get"in $a&&!("originalValue"in $a.get)?Ho=$a.get:Ho=Ho[Qo]}else Ko=Mo(Ho,Qo),Ho=Ho[Qo];Ko&&!Yo&&(Co[Lo]=Ho)}}return Ho},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var Xr=requireGetIntrinsic(),eo=Xr("%Object.defineProperty%",!0)||!1;if(eo)try{eo({},"a",{value:1})}catch{eo=!1}return esDefineProperty=eo,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var Xr=requireGetIntrinsic(),eo=Xr("%Object.getOwnPropertyDescriptor%",!0);if(eo)try{eo([],"length")}catch{eo=null}return gopd=eo,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var Xr=requireEsDefineProperty(),eo=requireSyntax(),to=requireType(),ro=requireGopd();return defineDataProperty=function(io,oo,ao){if(!io||typeof io!="object"&&typeof io!="function")throw new to("`obj` must be an object or a function`");if(typeof oo!="string"&&typeof oo!="symbol")throw new to("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new to("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new to("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new to("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new to("`loose`, if provided, must be a boolean");var so=arguments.length>3?arguments[3]:null,co=arguments.length>4?arguments[4]:null,lo=arguments.length>5?arguments[5]:null,uo=arguments.length>6?arguments[6]:!1,ho=!!ro&&ro(io,oo);if(Xr)Xr(io,oo,{configurable:lo===null&&ho?ho.configurable:!lo,enumerable:so===null&&ho?ho.enumerable:!so,value:ao,writable:co===null&&ho?ho.writable:!co});else if(uo||!so&&!co&&!lo)io[oo]=ao;else throw new eo("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var Xr=requireEsDefineProperty(),eo=function(){return!!Xr};return eo.hasArrayLengthDefineBug=function(){if(!Xr)return null;try{return Xr([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=eo,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var Xr=requireGetIntrinsic(),eo=requireDefineDataProperty(),to=requireHasPropertyDescriptors()(),ro=requireGopd(),no=requireType(),io=Xr("%Math.floor%");return setFunctionLength=function(ao,so){if(typeof ao!="function")throw new no("`fn` is not a function");if(typeof so!="number"||so<0||so>4294967295||io(so)!==so)throw new no("`length` must be a positive 32-bit integer");var co=arguments.length>2&&!!arguments[2],lo=!0,uo=!0;if("length"in ao&&ro){var ho=ro(ao,"length");ho&&!ho.configurable&&(lo=!1),ho&&!ho.writable&&(uo=!1)}return(lo||uo||!co)&&(to?eo(ao,"length",so,!0,!0):eo(ao,"length",so)),ao},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(Xr){var eo=requireFunctionBind(),to=requireGetIntrinsic(),ro=requireSetFunctionLength(),no=requireType(),io=to("%Function.prototype.apply%"),oo=to("%Function.prototype.call%"),ao=to("%Reflect.apply%",!0)||eo.call(oo,io),so=requireEsDefineProperty(),co=to("%Math.max%");Xr.exports=function(ho){if(typeof ho!="function")throw new no("a function is required");var go=ao(eo,oo,arguments);return ro(go,1+co(0,ho.length-(arguments.length-1)),!0)};var lo=function(){return ao(eo,io,arguments)};so?so(Xr.exports,"apply",{value:lo}):Xr.exports.apply=lo}(callBind)),callBind.exports}var callBound,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var Xr=requireGetIntrinsic(),eo=requireCallBind(),to=eo(Xr("String.prototype.indexOf"));return callBound=function(no,io){var oo=Xr(no,!!io);return typeof oo=="function"&&to(no,".prototype.")>-1?eo(oo):oo},callBound}var isArguments,hasRequiredIsArguments;function requireIsArguments(){if(hasRequiredIsArguments)return isArguments;hasRequiredIsArguments=1;var Xr=requireShams()(),eo=requireCallBound(),to=eo("Object.prototype.toString"),ro=function(ao){return Xr&&ao&&typeof ao=="object"&&Symbol.toStringTag in ao?!1:to(ao)==="[object Arguments]"},no=function(ao){return ro(ao)?!0:ao!==null&&typeof ao=="object"&&typeof ao.length=="number"&&ao.length>=0&&to(ao)!=="[object Array]"&&to(ao.callee)==="[object Function]"},io=function(){return ro(arguments)}();return ro.isLegacyArguments=no,isArguments=io?ro:no,isArguments}var isGeneratorFunction,hasRequiredIsGeneratorFunction;function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var Xr=Object.prototype.toString,eo=Function.prototype.toString,to=/^\s*(?:function)?\*/,ro=requireShams()(),no=Object.getPrototypeOf,io=function(){if(!ro)return!1;try{return Function("return function*() {}")()}catch{}},oo;return isGeneratorFunction=function(so){if(typeof so!="function")return!1;if(to.test(eo.call(so)))return!0;if(!ro){var co=Xr.call(so);return co==="[object GeneratorFunction]"}if(!no)return!1;if(typeof oo>"u"){var lo=io();oo=lo?no(lo):!1}return no(so)===oo},isGeneratorFunction}var isCallable,hasRequiredIsCallable;function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var Xr=Function.prototype.toString,eo=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,to,ro;if(typeof eo=="function"&&typeof Object.defineProperty=="function")try{to=Object.defineProperty({},"length",{get:function(){throw ro}}),ro={},eo(function(){throw 42},null,to)}catch(Co){Co!==ro&&(eo=null)}else eo=null;var no=/^\s*class\b/,io=function(Ro){try{var Oo=Xr.call(Ro);return no.test(Oo)}catch{return!1}},oo=function(Ro){try{return io(Ro)?!1:(Xr.call(Ro),!0)}catch{return!1}},ao=Object.prototype.toString,so="[object Object]",co="[object Function]",lo="[object GeneratorFunction]",uo="[object HTMLAllCollection]",ho="[object HTML document.all class]",go="[object HTMLCollection]",bo=typeof Symbol=="function"&&!!Symbol.toStringTag,wo=!(0 in[,]),Eo=function(){return!1};if(typeof document=="object"){var $o=document.all;ao.call($o)===ao.call(document.all)&&(Eo=function(Ro){if((wo||!Ro)&&(typeof Ro>"u"||typeof Ro=="object"))try{var Oo=ao.call(Ro);return(Oo===uo||Oo===ho||Oo===go||Oo===so)&&Ro("")==null}catch{}return!1})}return isCallable=eo?function(Ro){if(Eo(Ro))return!0;if(!Ro||typeof Ro!="function"&&typeof Ro!="object")return!1;try{eo(Ro,null,to)}catch(Oo){if(Oo!==ro)return!1}return!io(Ro)&&oo(Ro)}:function(Ro){if(Eo(Ro))return!0;if(!Ro||typeof Ro!="function"&&typeof Ro!="object")return!1;if(bo)return oo(Ro);if(io(Ro))return!1;var Oo=ao.call(Ro);return Oo!==co&&Oo!==lo&&!/^\[object HTML/.test(Oo)?!1:oo(Ro)},isCallable}var forEach_1,hasRequiredForEach;function requireForEach(){if(hasRequiredForEach)return forEach_1;hasRequiredForEach=1;var Xr=requireIsCallable(),eo=Object.prototype.toString,to=Object.prototype.hasOwnProperty,ro=function(so,co,lo){for(var uo=0,ho=so.length;uo=3&&(uo=lo),eo.call(so)==="[object Array]"?ro(so,co,uo):typeof so=="string"?no(so,co,uo):io(so,co,uo)};return forEach_1=oo,forEach_1}var possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames;function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames||(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),possibleTypedArrayNames}var availableTypedArrays,hasRequiredAvailableTypedArrays;function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var Xr=requirePossibleTypedArrayNames(),eo=typeof globalThis>"u"?commonjsGlobal:globalThis;return availableTypedArrays=function(){for(var ro=[],no=0;no"u"?commonjsGlobal:globalThis,so=eo(),co=ro("String.prototype.slice"),lo=Object.getPrototypeOf,uo=ro("Array.prototype.indexOf",!0)||function(Eo,$o){for(var Co=0;Co-1?$o:$o!=="Object"?!1:bo(Eo)}return no?go(Eo):null},whichTypedArray}var isTypedArray,hasRequiredIsTypedArray;function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray;hasRequiredIsTypedArray=1;var Xr=requireWhichTypedArray();return isTypedArray=function(to){return!!Xr(to)},isTypedArray}var hasRequiredTypes$2;function requireTypes$2(){return hasRequiredTypes$2||(hasRequiredTypes$2=1,function(Xr){var eo=requireIsArguments(),to=requireIsGeneratorFunction(),ro=requireWhichTypedArray(),no=requireIsTypedArray();function io(Ol){return Ol.call.bind(Ol)}var oo=typeof BigInt<"u",ao=typeof Symbol<"u",so=io(Object.prototype.toString),co=io(Number.prototype.valueOf),lo=io(String.prototype.valueOf),uo=io(Boolean.prototype.valueOf);if(oo)var ho=io(BigInt.prototype.valueOf);if(ao)var go=io(Symbol.prototype.valueOf);function bo(Ol,Dl){if(typeof Ol!="object")return!1;try{return Dl(Ol),!0}catch{return!1}}Xr.isArgumentsObject=eo,Xr.isGeneratorFunction=to,Xr.isTypedArray=no;function wo(Ol){return typeof Promise<"u"&&Ol instanceof Promise||Ol!==null&&typeof Ol=="object"&&typeof Ol.then=="function"&&typeof Ol.catch=="function"}Xr.isPromise=wo;function Eo(Ol){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Ol):no(Ol)||Lo(Ol)}Xr.isArrayBufferView=Eo;function $o(Ol){return ro(Ol)==="Uint8Array"}Xr.isUint8Array=$o;function Co(Ol){return ro(Ol)==="Uint8ClampedArray"}Xr.isUint8ClampedArray=Co;function Ro(Ol){return ro(Ol)==="Uint16Array"}Xr.isUint16Array=Ro;function Oo(Ol){return ro(Ol)==="Uint32Array"}Xr.isUint32Array=Oo;function jo(Ol){return ro(Ol)==="Int8Array"}Xr.isInt8Array=jo;function Bo(Ol){return ro(Ol)==="Int16Array"}Xr.isInt16Array=Bo;function Mo(Ol){return ro(Ol)==="Int32Array"}Xr.isInt32Array=Mo;function Fo(Ol){return ro(Ol)==="Float32Array"}Xr.isFloat32Array=Fo;function Wo(Ol){return ro(Ol)==="Float64Array"}Xr.isFloat64Array=Wo;function Jo(Ol){return ro(Ol)==="BigInt64Array"}Xr.isBigInt64Array=Jo;function Po(Ol){return ro(Ol)==="BigUint64Array"}Xr.isBigUint64Array=Po;function fo(Ol){return so(Ol)==="[object Map]"}fo.working=typeof Map<"u"&&fo(new Map);function yo(Ol){return typeof Map>"u"?!1:fo.working?fo(Ol):Ol instanceof Map}Xr.isMap=yo;function vo(Ol){return so(Ol)==="[object Set]"}vo.working=typeof Set<"u"&&vo(new Set);function _o(Ol){return typeof Set>"u"?!1:vo.working?vo(Ol):Ol instanceof Set}Xr.isSet=_o;function So(Ol){return so(Ol)==="[object WeakMap]"}So.working=typeof WeakMap<"u"&&So(new WeakMap);function To(Ol){return typeof WeakMap>"u"?!1:So.working?So(Ol):Ol instanceof WeakMap}Xr.isWeakMap=To;function Ao(Ol){return so(Ol)==="[object WeakSet]"}Ao.working=typeof WeakSet<"u"&&Ao(new WeakSet);function ko(Ol){return Ao(Ol)}Xr.isWeakSet=ko;function mo(Ol){return so(Ol)==="[object ArrayBuffer]"}mo.working=typeof ArrayBuffer<"u"&&mo(new ArrayBuffer);function Io(Ol){return typeof ArrayBuffer>"u"?!1:mo.working?mo(Ol):Ol instanceof ArrayBuffer}Xr.isArrayBuffer=Io;function Do(Ol){return so(Ol)==="[object DataView]"}Do.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Do(new DataView(new ArrayBuffer(1),0,1));function Lo(Ol){return typeof DataView>"u"?!1:Do.working?Do(Ol):Ol instanceof DataView}Xr.isDataView=Lo;var Ho=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Yo(Ol){return so(Ol)==="[object SharedArrayBuffer]"}function Xo(Ol){return typeof Ho>"u"?!1:(typeof Yo.working>"u"&&(Yo.working=Yo(new Ho)),Yo.working?Yo(Ol):Ol instanceof Ho)}Xr.isSharedArrayBuffer=Xo;function qo(Ol){return so(Ol)==="[object AsyncFunction]"}Xr.isAsyncFunction=qo;function Ko(Ol){return so(Ol)==="[object Map Iterator]"}Xr.isMapIterator=Ko;function Qo(Ol){return so(Ol)==="[object Set Iterator]"}Xr.isSetIterator=Qo;function zo(Ol){return so(Ol)==="[object Generator]"}Xr.isGeneratorObject=zo;function ga(Ol){return so(Ol)==="[object WebAssembly.Module]"}Xr.isWebAssemblyCompiledModule=ga;function $a(Ol){return bo(Ol,co)}Xr.isNumberObject=$a;function Sl(Ol){return bo(Ol,lo)}Xr.isStringObject=Sl;function El(Ol){return bo(Ol,uo)}Xr.isBooleanObject=El;function Tl(Ol){return oo&&bo(Ol,ho)}Xr.isBigIntObject=Tl;function Il(Ol){return ao&&bo(Ol,go)}Xr.isSymbolObject=Il;function Zl(Ol){return $a(Ol)||Sl(Ol)||El(Ol)||Tl(Ol)||Il(Ol)}Xr.isBoxedPrimitive=Zl;function Vl(Ol){return typeof Uint8Array<"u"&&(Io(Ol)||Xo(Ol))}Xr.isAnyArrayBuffer=Vl,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Ol){Object.defineProperty(Xr,Ol,{enumerable:!1,value:function(){throw new Error(Ol+" is not supported in userland")}})})}(types$8)),types$8}var isBufferBrowser,hasRequiredIsBufferBrowser;function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser||(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(eo){return eo&&typeof eo=="object"&&typeof eo.copy=="function"&&typeof eo.fill=="function"&&typeof eo.readUInt8=="function"}),isBufferBrowser}var hasRequiredUtil$1;function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,function(Xr){var eo={},to=Object.getOwnPropertyDescriptors||function(Ho){for(var Yo=Object.keys(Ho),Xo={},qo=0;qo=qo)return zo;switch(zo){case"%s":return String(Xo[Yo++]);case"%d":return Number(Xo[Yo++]);case"%j":try{return JSON.stringify(Xo[Yo++])}catch{return"[Circular]"}default:return zo}}),Qo=Xo[Yo];Yo"u")return function(){return Xr.deprecate(Lo,Ho).apply(this,arguments)};var Yo=!1;function Xo(){if(!Yo){if(process$1$1.throwDeprecation)throw new Error(Ho);process$1$1.traceDeprecation?console.trace(Ho):console.error(Ho),Yo=!0}return Lo.apply(this,arguments)}return Xo};var no={},io=/^$/;if(eo.NODE_DEBUG){var oo=eo.NODE_DEBUG;oo=oo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),io=new RegExp("^"+oo+"$","i")}Xr.debuglog=function(Lo){if(Lo=Lo.toUpperCase(),!no[Lo])if(io.test(Lo)){var Ho=process$1$1.pid;no[Lo]=function(){var Yo=Xr.format.apply(Xr,arguments);console.error("%s %d: %s",Lo,Ho,Yo)}}else no[Lo]=function(){};return no[Lo]};function ao(Lo,Ho){var Yo={seen:[],stylize:co};return arguments.length>=3&&(Yo.depth=arguments[2]),arguments.length>=4&&(Yo.colors=arguments[3]),Co(Ho)?Yo.showHidden=Ho:Ho&&Xr._extend(Yo,Ho),Fo(Yo.showHidden)&&(Yo.showHidden=!1),Fo(Yo.depth)&&(Yo.depth=2),Fo(Yo.colors)&&(Yo.colors=!1),Fo(Yo.customInspect)&&(Yo.customInspect=!0),Yo.colors&&(Yo.stylize=so),uo(Yo,Lo,Yo.depth)}Xr.inspect=ao,ao.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]},ao.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function so(Lo,Ho){var Yo=ao.styles[Ho];return Yo?"\x1B["+ao.colors[Yo][0]+"m"+Lo+"\x1B["+ao.colors[Yo][1]+"m":Lo}function co(Lo,Ho){return Lo}function lo(Lo){var Ho={};return Lo.forEach(function(Yo,Xo){Ho[Yo]=!0}),Ho}function uo(Lo,Ho,Yo){if(Lo.customInspect&&Ho&&yo(Ho.inspect)&&Ho.inspect!==Xr.inspect&&!(Ho.constructor&&Ho.constructor.prototype===Ho)){var Xo=Ho.inspect(Yo,Lo);return Bo(Xo)||(Xo=uo(Lo,Xo,Yo)),Xo}var qo=ho(Lo,Ho);if(qo)return qo;var Ko=Object.keys(Ho),Qo=lo(Ko);if(Lo.showHidden&&(Ko=Object.getOwnPropertyNames(Ho)),fo(Ho)&&(Ko.indexOf("message")>=0||Ko.indexOf("description")>=0))return go(Ho);if(Ko.length===0){if(yo(Ho)){var zo=Ho.name?": "+Ho.name:"";return Lo.stylize("[Function"+zo+"]","special")}if(Wo(Ho))return Lo.stylize(RegExp.prototype.toString.call(Ho),"regexp");if(Po(Ho))return Lo.stylize(Date.prototype.toString.call(Ho),"date");if(fo(Ho))return go(Ho)}var ga="",$a=!1,Sl=["{","}"];if($o(Ho)&&($a=!0,Sl=["[","]"]),yo(Ho)){var El=Ho.name?": "+Ho.name:"";ga=" [Function"+El+"]"}if(Wo(Ho)&&(ga=" "+RegExp.prototype.toString.call(Ho)),Po(Ho)&&(ga=" "+Date.prototype.toUTCString.call(Ho)),fo(Ho)&&(ga=" "+go(Ho)),Ko.length===0&&(!$a||Ho.length==0))return Sl[0]+ga+Sl[1];if(Yo<0)return Wo(Ho)?Lo.stylize(RegExp.prototype.toString.call(Ho),"regexp"):Lo.stylize("[Object]","special");Lo.seen.push(Ho);var Tl;return $a?Tl=bo(Lo,Ho,Yo,Qo,Ko):Tl=Ko.map(function(Il){return wo(Lo,Ho,Yo,Qo,Il,$a)}),Lo.seen.pop(),Eo(Tl,ga,Sl)}function ho(Lo,Ho){if(Fo(Ho))return Lo.stylize("undefined","undefined");if(Bo(Ho)){var Yo="'"+JSON.stringify(Ho).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Lo.stylize(Yo,"string")}if(jo(Ho))return Lo.stylize(""+Ho,"number");if(Co(Ho))return Lo.stylize(""+Ho,"boolean");if(Ro(Ho))return Lo.stylize("null","null")}function go(Lo){return"["+Error.prototype.toString.call(Lo)+"]"}function bo(Lo,Ho,Yo,Xo,qo){for(var Ko=[],Qo=0,zo=Ho.length;Qo-1&&(Ko?zo=zo.split(` +`).map(function($a){return" "+$a}).join(` `).slice(2):zo=` `+zo.split(` -`).map(function(_c){return" "+_c}).join(` -`))):zo=To.stylize("[Circular]","special")),Do($a)){if(Ho&&qo.match(/^\d+$/))return zo;$a=JSON.stringify(""+qo),$a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?($a=$a.slice(1,-1),$a=To.stylize($a,"name")):($a=$a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),$a=To.stylize($a,"string"))}return $a+": "+zo}function wo(To,Vo,Zo){var Qo=To.reduce(function(qo,Ho){return Ho.indexOf(` -`)>=0,qo+Ho.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Qo>60?Zo[0]+(Vo===""?"":Vo+` - `)+" "+To.join(`, - `)+" "+Zo[1]:Zo[0]+Vo+" "+To.join(", ")+" "+Zo[1]}Xr.types=requireTypes$2();function Eo(To){return Array.isArray(To)}Xr.isArray=Eo;function ko(To){return typeof To=="boolean"}Xr.isBoolean=ko;function Ao(To){return To===null}Xr.isNull=Ao;function Po(To){return To==null}Xr.isNullOrUndefined=Po;function jo(To){return typeof To=="number"}Xr.isNumber=jo;function Mo(To){return typeof To=="string"}Xr.isString=Mo;function No(To){return typeof To=="symbol"}Xr.isSymbol=No;function Do(To){return To===void 0}Xr.isUndefined=Do;function Fo(To){return Xo(To)&&po(To)==="[object RegExp]"}Xr.isRegExp=Fo,Xr.types.isRegExp=Fo;function Xo(To){return typeof To=="object"&&To!==null}Xr.isObject=Xo;function Lo(To){return Xo(To)&&po(To)==="[object Date]"}Xr.isDate=Lo,Xr.types.isDate=Lo;function Bo(To){return Xo(To)&&(po(To)==="[object Error]"||To instanceof Error)}Xr.isError=Bo,Xr.types.isNativeError=Bo;function xo(To){return typeof To=="function"}Xr.isFunction=xo;function uo(To){return To===null||typeof To=="boolean"||typeof To=="number"||typeof To=="string"||typeof To=="symbol"||typeof To>"u"}Xr.isPrimitive=uo,Xr.isBuffer=requireIsBufferBrowser();function po(To){return Object.prototype.toString.call(To)}function bo(To){return To<10?"0"+To.toString(10):To.toString(10)}var _o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function $o(){var To=new Date,Vo=[bo(To.getHours()),bo(To.getMinutes()),bo(To.getSeconds())].join(":");return[To.getDate(),_o[To.getMonth()],Vo].join(" ")}Xr.log=function(){console.log("%s - %s",$o(),Xr.format.apply(Xr,arguments))},Xr.inherits=requireInherits_browser(),Xr._extend=function(To,Vo){if(!Vo||!Xo(Vo))return To;for(var Zo=Object.keys(Vo),Qo=Zo.length;Qo--;)To[Zo[Qo]]=Vo[Zo[Qo]];return To};function Co(To,Vo){return Object.prototype.hasOwnProperty.call(To,Vo)}var Ro=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Xr.promisify=function(Vo){if(typeof Vo!="function")throw new TypeError('The "original" argument must be of type Function');if(Ro&&Vo[Ro]){var Zo=Vo[Ro];if(typeof Zo!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Zo,Ro,{value:Zo,enumerable:!1,writable:!1,configurable:!0}),Zo}function Zo(){for(var Qo,qo,Ho=new Promise(function(Ko,_c){Qo=Ko,qo=_c}),$a=[],zo=0;zo0?this.tail.next=Eo:this.head=Eo,this.tail=Eo,++this.length}},{key:"unshift",value:function(wo){var Eo={data:wo,next:this.head};this.length===0&&(this.tail=Eo),this.head=Eo,++this.length}},{key:"shift",value:function(){if(this.length!==0){var wo=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,wo}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(wo){if(this.length===0)return"";for(var Eo=this.head,ko=""+Eo.data;Eo=Eo.next;)ko+=wo+Eo.data;return ko}},{key:"concat",value:function(wo){if(this.length===0)return co.alloc(0);for(var Eo=co.allocUnsafe(wo>>>0),ko=this.head,Ao=0;ko;)go(ko.data,Eo,Ao),Ao+=ko.data.length,ko=ko.next;return Eo}},{key:"consume",value:function(wo,Eo){var ko;return woPo.length?Po.length:wo;if(jo===Po.length?Ao+=Po:Ao+=Po.slice(0,wo),wo-=jo,wo===0){jo===Po.length?(++ko,Eo.next?this.head=Eo.next:this.head=this.tail=null):(this.head=Eo,Eo.data=Po.slice(jo));break}++ko}return this.length-=ko,Ao}},{key:"_getBuffer",value:function(wo){var Eo=co.allocUnsafe(wo),ko=this.head,Ao=1;for(ko.data.copy(Eo),wo-=ko.data.length;ko=ko.next;){var Po=ko.data,jo=wo>Po.length?Po.length:wo;if(Po.copy(Eo,Eo.length-wo,0,jo),wo-=jo,wo===0){jo===Po.length?(++Ao,ko.next?this.head=ko.next:this.head=this.tail=null):(this.head=ko,ko.data=Po.slice(jo));break}++Ao}return this.length-=Ao,Eo}},{key:ho,value:function(wo,Eo){return fo(this,eo(eo({},Eo),{},{depth:0,customInspect:!1}))}}]),yo}(),buffer_list}var destroy_1$1,hasRequiredDestroy$1;function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;hasRequiredDestroy$1=1;function Xr(oo,ao){var so=this,co=this._readableState&&this._readableState.destroyed,lo=this._writableState&&this._writableState.destroyed;return co||lo?(ao?ao(oo):oo&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(no,this,oo)):process$1$1.nextTick(no,this,oo)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(oo||null,function(fo){!ao&&fo?so._writableState?so._writableState.errorEmitted?process$1$1.nextTick(to,so):(so._writableState.errorEmitted=!0,process$1$1.nextTick(eo,so,fo)):process$1$1.nextTick(eo,so,fo):ao?(process$1$1.nextTick(to,so),ao(fo)):process$1$1.nextTick(to,so)}),this)}function eo(oo,ao){no(oo,ao),to(oo)}function to(oo){oo._writableState&&!oo._writableState.emitClose||oo._readableState&&!oo._readableState.emitClose||oo.emit("close")}function ro(){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)}function no(oo,ao){oo.emit("error",ao)}function io(oo,ao){var so=oo._readableState,co=oo._writableState;so&&so.autoDestroy||co&&co.autoDestroy?oo.destroy(ao):oo.emit("error",ao)}return destroy_1$1={destroy:Xr,undestroy:ro,errorOrDestroy:io},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function Xr(ao,so){ao.prototype=Object.create(so.prototype),ao.prototype.constructor=ao,ao.__proto__=so}var eo={};function to(ao,so,co){co||(co=Error);function lo(ho,go,yo){return typeof so=="string"?so:so(ho,go,yo)}var fo=function(ho){Xr(go,ho);function go(yo,vo,wo){return ho.call(this,lo(yo,vo,wo))||this}return go}(co);fo.prototype.name=co.name,fo.prototype.code=ao,eo[ao]=fo}function ro(ao,so){if(Array.isArray(ao)){var co=ao.length;return ao=ao.map(function(lo){return String(lo)}),co>2?"one of ".concat(so," ").concat(ao.slice(0,co-1).join(", "),", or ")+ao[co-1]:co===2?"one of ".concat(so," ").concat(ao[0]," or ").concat(ao[1]):"of ".concat(so," ").concat(ao[0])}else return"of ".concat(so," ").concat(String(ao))}function no(ao,so,co){return ao.substr(0,so.length)===so}function io(ao,so,co){return(co===void 0||co>ao.length)&&(co=ao.length),ao.substring(co-so.length,co)===so}function oo(ao,so,co){return typeof co!="number"&&(co=0),co+so.length>ao.length?!1:ao.indexOf(so,co)!==-1}return to("ERR_INVALID_OPT_VALUE",function(ao,so){return'The value "'+so+'" is invalid for option "'+ao+'"'},TypeError),to("ERR_INVALID_ARG_TYPE",function(ao,so,co){var lo;typeof so=="string"&&no(so,"not ")?(lo="must not be",so=so.replace(/^not /,"")):lo="must be";var fo;if(io(ao," argument"))fo="The ".concat(ao," ").concat(lo," ").concat(ro(so,"type"));else{var ho=oo(ao,".")?"property":"argument";fo='The "'.concat(ao,'" ').concat(ho," ").concat(lo," ").concat(ro(so,"type"))}return fo+=". Received type ".concat(typeof co),fo},TypeError),to("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),to("ERR_METHOD_NOT_IMPLEMENTED",function(ao){return"The "+ao+" method is not implemented"}),to("ERR_STREAM_PREMATURE_CLOSE","Premature close"),to("ERR_STREAM_DESTROYED",function(ao){return"Cannot call "+ao+" after a stream was destroyed"}),to("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),to("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),to("ERR_STREAM_WRITE_AFTER_END","write after end"),to("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),to("ERR_UNKNOWN_ENCODING",function(ao){return"Unknown encoding: "+ao},TypeError),to("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=eo,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var Xr=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function eo(ro,no,io){return ro.highWaterMark!=null?ro.highWaterMark:no?ro[io]:null}function to(ro,no,io,oo){var ao=eo(no,oo,io);if(ao!=null){if(!(isFinite(ao)&&Math.floor(ao)===ao)||ao<0){var so=oo?io:"highWaterMark";throw new Xr(so,ao)}return Math.floor(ao)}return ro.objectMode?16:16*1024}return state={getHighWaterMark:to},state}var browser$f,hasRequiredBrowser$a;function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$f;hasRequiredBrowser$a=1,browser$f=Xr;function Xr(to,ro){if(eo("noDeprecation"))return to;var no=!1;function io(){if(!no){if(eo("throwDeprecation"))throw new Error(ro);eo("traceDeprecation")?console.trace(ro):console.warn(ro),no=!0}return to.apply(this,arguments)}return io}function eo(to){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var ro=commonjsGlobal.localStorage[to];return ro==null?!1:String(ro).toLowerCase()==="true"}return browser$f}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=Do;function Xr(Qo){var qo=this;this.next=null,this.entry=null,this.finish=function(){Zo(qo,Qo)}}var eo;Do.WritableState=Mo;var to={deprecate:requireBrowser$a()},ro=requireStreamBrowser$1(),no=require$$0$9.Buffer,io=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oo(Qo){return no.from(Qo)}function ao(Qo){return no.isBuffer(Qo)||Qo instanceof io}var so=requireDestroy$1(),co=requireState(),lo=co.getHighWaterMark,fo=requireErrorsBrowser().codes,ho=fo.ERR_INVALID_ARG_TYPE,go=fo.ERR_METHOD_NOT_IMPLEMENTED,yo=fo.ERR_MULTIPLE_CALLBACK,vo=fo.ERR_STREAM_CANNOT_PIPE,wo=fo.ERR_STREAM_DESTROYED,Eo=fo.ERR_STREAM_NULL_VALUES,ko=fo.ERR_STREAM_WRITE_AFTER_END,Ao=fo.ERR_UNKNOWN_ENCODING,Po=so.errorOrDestroy;requireInherits_browser()(Do,ro);function jo(){}function Mo(Qo,qo,Ho){eo=eo||require_stream_duplex$1(),Qo=Qo||{},typeof Ho!="boolean"&&(Ho=qo instanceof eo),this.objectMode=!!Qo.objectMode,Ho&&(this.objectMode=this.objectMode||!!Qo.writableObjectMode),this.highWaterMark=lo(this,Qo,"writableHighWaterMark",Ho),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var $a=Qo.decodeStrings===!1;this.decodeStrings=!$a,this.defaultEncoding=Qo.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(zo){bo(qo,zo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Qo.emitClose!==!1,this.autoDestroy=!!Qo.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Xr(this)}Mo.prototype.getBuffer=function(){for(var qo=this.bufferedRequest,Ho=[];qo;)Ho.push(qo),qo=qo.next;return Ho},function(){try{Object.defineProperty(Mo.prototype,"buffer",{get:to.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var No;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(No=Function.prototype[Symbol.hasInstance],Object.defineProperty(Do,Symbol.hasInstance,{value:function(qo){return No.call(this,qo)?!0:this!==Do?!1:qo&&qo._writableState instanceof Mo}})):No=function(qo){return qo instanceof this};function Do(Qo){eo=eo||require_stream_duplex$1();var qo=this instanceof eo;if(!qo&&!No.call(Do,this))return new Do(Qo);this._writableState=new Mo(Qo,this,qo),this.writable=!0,Qo&&(typeof Qo.write=="function"&&(this._write=Qo.write),typeof Qo.writev=="function"&&(this._writev=Qo.writev),typeof Qo.destroy=="function"&&(this._destroy=Qo.destroy),typeof Qo.final=="function"&&(this._final=Qo.final)),ro.call(this)}Do.prototype.pipe=function(){Po(this,new vo)};function Fo(Qo,qo){var Ho=new ko;Po(Qo,Ho),process$1$1.nextTick(qo,Ho)}function Xo(Qo,qo,Ho,$a){var zo;return Ho===null?zo=new Eo:typeof Ho!="string"&&!qo.objectMode&&(zo=new ho("chunk",["string","Buffer"],Ho)),zo?(Po(Qo,zo),process$1$1.nextTick($a,zo),!1):!0}Do.prototype.write=function(Qo,qo,Ho){var $a=this._writableState,zo=!1,Ko=!$a.objectMode&&ao(Qo);return Ko&&!no.isBuffer(Qo)&&(Qo=oo(Qo)),typeof qo=="function"&&(Ho=qo,qo=null),Ko?qo="buffer":qo||(qo=$a.defaultEncoding),typeof Ho!="function"&&(Ho=jo),$a.ending?Fo(this,Ho):(Ko||Xo(this,$a,Qo,Ho))&&($a.pendingcb++,zo=Bo(this,$a,Ko,Qo,qo,Ho)),zo},Do.prototype.cork=function(){this._writableState.corked++},Do.prototype.uncork=function(){var Qo=this._writableState;Qo.corked&&(Qo.corked--,!Qo.writing&&!Qo.corked&&!Qo.bufferProcessing&&Qo.bufferedRequest&&Co(this,Qo))},Do.prototype.setDefaultEncoding=function(qo){if(typeof qo=="string"&&(qo=qo.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((qo+"").toLowerCase())>-1))throw new Ao(qo);return this._writableState.defaultEncoding=qo,this},Object.defineProperty(Do.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Lo(Qo,qo,Ho){return!Qo.objectMode&&Qo.decodeStrings!==!1&&typeof qo=="string"&&(qo=no.from(qo,Ho)),qo}Object.defineProperty(Do.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Bo(Qo,qo,Ho,$a,zo,Ko){if(!Ho){var _c=Lo(qo,$a,zo);$a!==_c&&(Ho=!0,zo="buffer",$a=_c)}var Cl=qo.objectMode?1:$a.length;qo.length+=Cl;var ga=qo.length>5===6?2:Eo>>4===14?3:Eo>>3===30?4:Eo>>6===2?-1:-2}function oo(Eo,ko,Ao){var Po=ko.length-1;if(Po=0?(jo>0&&(Eo.lastNeed=jo-1),jo):--Po=0?(jo>0&&(Eo.lastNeed=jo-2),jo):--Po=0?(jo>0&&(jo===2?jo=0:Eo.lastNeed=jo-3),jo):0))}function ao(Eo,ko,Ao){if((ko[0]&192)!==128)return Eo.lastNeed=0,"�";if(Eo.lastNeed>1&&ko.length>1){if((ko[1]&192)!==128)return Eo.lastNeed=1,"�";if(Eo.lastNeed>2&&ko.length>2&&(ko[2]&192)!==128)return Eo.lastNeed=2,"�"}}function so(Eo){var ko=this.lastTotal-this.lastNeed,Ao=ao(this,Eo);if(Ao!==void 0)return Ao;if(this.lastNeed<=Eo.length)return Eo.copy(this.lastChar,ko,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Eo.copy(this.lastChar,ko,0,Eo.length),this.lastNeed-=Eo.length}function co(Eo,ko){var Ao=oo(this,Eo,ko);if(!this.lastNeed)return Eo.toString("utf8",ko);this.lastTotal=Ao;var Po=Eo.length-(Ao-this.lastNeed);return Eo.copy(this.lastChar,0,Po),Eo.toString("utf8",ko,Po)}function lo(Eo){var ko=Eo&&Eo.length?this.write(Eo):"";return this.lastNeed?ko+"�":ko}function fo(Eo,ko){if((Eo.length-ko)%2===0){var Ao=Eo.toString("utf16le",ko);if(Ao){var Po=Ao.charCodeAt(Ao.length-1);if(Po>=55296&&Po<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=Eo[Eo.length-2],this.lastChar[1]=Eo[Eo.length-1],Ao.slice(0,-1)}return Ao}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Eo[Eo.length-1],Eo.toString("utf16le",ko,Eo.length-1)}function ho(Eo){var ko=Eo&&Eo.length?this.write(Eo):"";if(this.lastNeed){var Ao=this.lastTotal-this.lastNeed;return ko+this.lastChar.toString("utf16le",0,Ao)}return ko}function go(Eo,ko){var Ao=(Eo.length-ko)%3;return Ao===0?Eo.toString("base64",ko):(this.lastNeed=3-Ao,this.lastTotal=3,Ao===1?this.lastChar[0]=Eo[Eo.length-1]:(this.lastChar[0]=Eo[Eo.length-2],this.lastChar[1]=Eo[Eo.length-1]),Eo.toString("base64",ko,Eo.length-Ao))}function yo(Eo){var ko=Eo&&Eo.length?this.write(Eo):"";return this.lastNeed?ko+this.lastChar.toString("base64",0,3-this.lastNeed):ko}function vo(Eo){return Eo.toString(this.encoding)}function wo(Eo){return Eo&&Eo.length?this.write(Eo):""}return string_decoder}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var Xr=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function eo(io){var oo=!1;return function(){if(!oo){oo=!0;for(var ao=arguments.length,so=new Array(ao),co=0;co0)if(typeof _c!="string"&&!Al.objectMode&&Object.getPrototypeOf(_c)!==ro.prototype&&(_c=io(_c)),ga)Al.endEmitted?jo(Ko,new Eo):Lo(Ko,Al,_c,!0);else if(Al.ended)jo(Ko,new vo);else{if(Al.destroyed)return!1;Al.reading=!1,Al.decoder&&!Cl?(_c=Al.decoder.write(_c),Al.objectMode||_c.length!==0?Lo(Ko,Al,_c,!1):Co(Ko,Al)):Lo(Ko,Al,_c,!1)}else ga||(Al.reading=!1,Co(Ko,Al))}return!Al.ended&&(Al.length=xo?Ko=xo:(Ko--,Ko|=Ko>>>1,Ko|=Ko>>>2,Ko|=Ko>>>4,Ko|=Ko>>>8,Ko|=Ko>>>16,Ko++),Ko}function po(Ko,_c){return Ko<=0||_c.length===0&&_c.ended?0:_c.objectMode?1:Ko!==Ko?_c.flowing&&_c.length?_c.buffer.head.data.length:_c.length:(Ko>_c.highWaterMark&&(_c.highWaterMark=uo(Ko)),Ko<=_c.length?Ko:_c.ended?_c.length:(_c.needReadable=!0,0))}Fo.prototype.read=function(Ko){so("read",Ko),Ko=parseInt(Ko,10);var _c=this._readableState,Cl=Ko;if(Ko!==0&&(_c.emittedReadable=!1),Ko===0&&_c.needReadable&&((_c.highWaterMark!==0?_c.length>=_c.highWaterMark:_c.length>0)||_c.ended))return so("read: emitReadable",_c.length,_c.ended),_c.length===0&&_c.ended?Ho(this):_o(this),null;if(Ko=po(Ko,_c),Ko===0&&_c.ended)return _c.length===0&&Ho(this),null;var ga=_c.needReadable;so("need readable",ga),(_c.length===0||_c.length-Ko<_c.highWaterMark)&&(ga=!0,so("length less than watermark",ga)),_c.ended||_c.reading?(ga=!1,so("reading or ended",ga)):ga&&(so("do read"),_c.reading=!0,_c.sync=!0,_c.length===0&&(_c.needReadable=!0),this._read(_c.highWaterMark),_c.sync=!1,_c.reading||(Ko=po(Cl,_c)));var El;return Ko>0?El=qo(Ko,_c):El=null,El===null?(_c.needReadable=_c.length<=_c.highWaterMark,Ko=0):(_c.length-=Ko,_c.awaitDrain=0),_c.length===0&&(_c.ended||(_c.needReadable=!0),Cl!==Ko&&_c.ended&&Ho(this)),El!==null&&this.emit("data",El),El};function bo(Ko,_c){if(so("onEofChunk"),!_c.ended){if(_c.decoder){var Cl=_c.decoder.end();Cl&&Cl.length&&(_c.buffer.push(Cl),_c.length+=_c.objectMode?1:Cl.length)}_c.ended=!0,_c.sync?_o(Ko):(_c.needReadable=!1,_c.emittedReadable||(_c.emittedReadable=!0,$o(Ko)))}}function _o(Ko){var _c=Ko._readableState;so("emitReadable",_c.needReadable,_c.emittedReadable),_c.needReadable=!1,_c.emittedReadable||(so("emitReadable",_c.flowing),_c.emittedReadable=!0,process$1$1.nextTick($o,Ko))}function $o(Ko){var _c=Ko._readableState;so("emitReadable_",_c.destroyed,_c.length,_c.ended),!_c.destroyed&&(_c.length||_c.ended)&&(Ko.emit("readable"),_c.emittedReadable=!1),_c.needReadable=!_c.flowing&&!_c.ended&&_c.length<=_c.highWaterMark,Qo(Ko)}function Co(Ko,_c){_c.readingMore||(_c.readingMore=!0,process$1$1.nextTick(Ro,Ko,_c))}function Ro(Ko,_c){for(;!_c.reading&&!_c.ended&&(_c.length<_c.highWaterMark||_c.flowing&&_c.length===0);){var Cl=_c.length;if(so("maybeReadMore read 0"),Ko.read(0),Cl===_c.length)break}_c.readingMore=!1}Fo.prototype._read=function(Ko){jo(this,new wo("_read()"))},Fo.prototype.pipe=function(Ko,_c){var Cl=this,ga=this._readableState;switch(ga.pipesCount){case 0:ga.pipes=Ko;break;case 1:ga.pipes=[ga.pipes,Ko];break;default:ga.pipes.push(Ko);break}ga.pipesCount+=1,so("pipe count=%d opts=%j",ga.pipesCount,_c);var El=(!_c||_c.end!==!1)&&Ko!==process$1$1.stdout&&Ko!==process$1$1.stderr,Al=El?Wl:ru;ga.endEmitted?process$1$1.nextTick(Al):Cl.once("end",Al),Ko.on("unpipe",Ol);function Ol(tu,ku){so("onunpipe"),tu===Cl&&ku&&ku.hasUnpiped===!1&&(ku.hasUnpiped=!0,Ml())}function Wl(){so("onend"),Ko.end()}var zl=So(Cl);Ko.on("drain",zl);var Tl=!1;function Ml(){so("cleanup"),Ko.removeListener("close",Ll),Ko.removeListener("finish",uu),Ko.removeListener("drain",zl),Ko.removeListener("error",Vl),Ko.removeListener("unpipe",Ol),Cl.removeListener("end",Wl),Cl.removeListener("end",ru),Cl.removeListener("data",ou),Tl=!0,ga.awaitDrain&&(!Ko._writableState||Ko._writableState.needDrain)&&zl()}Cl.on("data",ou);function ou(tu){so("ondata");var ku=Ko.write(tu);so("dest.write",ku),ku===!1&&((ga.pipesCount===1&&ga.pipes===Ko||ga.pipesCount>1&&zo(ga.pipes,Ko)!==-1)&&!Tl&&(so("false write response, pause",ga.awaitDrain),ga.awaitDrain++),Cl.pause())}function Vl(tu){so("onerror",tu),ru(),Ko.removeListener("error",Vl),eo(Ko,"error")===0&&jo(Ko,tu)}No(Ko,"error",Vl);function Ll(){Ko.removeListener("finish",uu),ru()}Ko.once("close",Ll);function uu(){so("onfinish"),Ko.removeListener("close",Ll),ru()}Ko.once("finish",uu);function ru(){so("unpipe"),Cl.unpipe(Ko)}return Ko.emit("pipe",Cl),ga.flowing||(so("pipe resume"),Cl.resume()),Ko};function So(Ko){return function(){var Cl=Ko._readableState;so("pipeOnDrain",Cl.awaitDrain),Cl.awaitDrain&&Cl.awaitDrain--,Cl.awaitDrain===0&&eo(Ko,"data")&&(Cl.flowing=!0,Qo(Ko))}}Fo.prototype.unpipe=function(Ko){var _c=this._readableState,Cl={hasUnpiped:!1};if(_c.pipesCount===0)return this;if(_c.pipesCount===1)return Ko&&Ko!==_c.pipes?this:(Ko||(Ko=_c.pipes),_c.pipes=null,_c.pipesCount=0,_c.flowing=!1,Ko&&Ko.emit("unpipe",this,Cl),this);if(!Ko){var ga=_c.pipes,El=_c.pipesCount;_c.pipes=null,_c.pipesCount=0,_c.flowing=!1;for(var Al=0;Al0,ga.flowing!==!1&&this.resume()):Ko==="readable"&&!ga.endEmitted&&!ga.readableListening&&(ga.readableListening=ga.needReadable=!0,ga.flowing=!1,ga.emittedReadable=!1,so("on readable",ga.length,ga.reading),ga.length?_o(this):ga.reading||process$1$1.nextTick(To,this)),Cl},Fo.prototype.addListener=Fo.prototype.on,Fo.prototype.removeListener=function(Ko,_c){var Cl=to.prototype.removeListener.call(this,Ko,_c);return Ko==="readable"&&process$1$1.nextTick(mo,this),Cl},Fo.prototype.removeAllListeners=function(Ko){var _c=to.prototype.removeAllListeners.apply(this,arguments);return(Ko==="readable"||Ko===void 0)&&process$1$1.nextTick(mo,this),_c};function mo(Ko){var _c=Ko._readableState;_c.readableListening=Ko.listenerCount("readable")>0,_c.resumeScheduled&&!_c.paused?_c.flowing=!0:Ko.listenerCount("data")>0&&Ko.resume()}function To(Ko){so("readable nexttick read 0"),Ko.read(0)}Fo.prototype.resume=function(){var Ko=this._readableState;return Ko.flowing||(so("resume"),Ko.flowing=!Ko.readableListening,Vo(this,Ko)),Ko.paused=!1,this};function Vo(Ko,_c){_c.resumeScheduled||(_c.resumeScheduled=!0,process$1$1.nextTick(Zo,Ko,_c))}function Zo(Ko,_c){so("resume",_c.reading),_c.reading||Ko.read(0),_c.resumeScheduled=!1,Ko.emit("resume"),Qo(Ko),_c.flowing&&!_c.reading&&Ko.read(0)}Fo.prototype.pause=function(){return so("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(so("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Qo(Ko){var _c=Ko._readableState;for(so("flow",_c.flowing);_c.flowing&&Ko.read()!==null;);}Fo.prototype.wrap=function(Ko){var _c=this,Cl=this._readableState,ga=!1;Ko.on("end",function(){if(so("wrapped end"),Cl.decoder&&!Cl.ended){var Ol=Cl.decoder.end();Ol&&Ol.length&&_c.push(Ol)}_c.push(null)}),Ko.on("data",function(Ol){if(so("wrapped data"),Cl.decoder&&(Ol=Cl.decoder.write(Ol)),!(Cl.objectMode&&Ol==null)&&!(!Cl.objectMode&&(!Ol||!Ol.length))){var Wl=_c.push(Ol);Wl||(ga=!0,Ko.pause())}});for(var El in Ko)this[El]===void 0&&typeof Ko[El]=="function"&&(this[El]=function(Wl){return function(){return Ko[Wl].apply(Ko,arguments)}}(El));for(var Al=0;Al=_c.length?(_c.decoder?Cl=_c.buffer.join(""):_c.buffer.length===1?Cl=_c.buffer.first():Cl=_c.buffer.concat(_c.length),_c.buffer.clear()):Cl=_c.buffer.consume(Ko,_c.decoder),Cl}function Ho(Ko){var _c=Ko._readableState;so("endReadable",_c.endEmitted),_c.endEmitted||(_c.ended=!0,process$1$1.nextTick($a,_c,Ko))}function $a(Ko,_c){if(so("endReadableNT",Ko.endEmitted,Ko.length),!Ko.endEmitted&&Ko.length===0&&(Ko.endEmitted=!0,_c.readable=!1,_c.emit("end"),Ko.autoDestroy)){var Cl=_c._writableState;(!Cl||Cl.autoDestroy&&Cl.finished)&&_c.destroy()}}typeof Symbol=="function"&&(Fo.from=function(Ko,_c){return Po===void 0&&(Po=requireFromBrowser()),Po(Fo,Ko,_c)});function zo(Ko,_c){for(var Cl=0,ga=Ko.length;Cl0;return ao(ko,Po,jo,function(Mo){wo||(wo=Mo),Mo&&Eo.forEach(so),!Po&&(Eo.forEach(so),vo(wo))})});return go.reduce(co)}return pipeline_1=fo,pipeline_1}var hasRequiredReadableBrowser$1;function requireReadableBrowser$1(){return hasRequiredReadableBrowser$1||(hasRequiredReadableBrowser$1=1,function(Xr,eo){eo=Xr.exports=require_stream_readable$1(),eo.Stream=eo,eo.Readable=eo,eo.Writable=require_stream_writable$1(),eo.Duplex=require_stream_duplex$1(),eo.Transform=require_stream_transform$1(),eo.PassThrough=require_stream_passthrough$1(),eo.finished=requireEndOfStream(),eo.pipeline=requirePipeline()}(readableBrowser$1,readableBrowser$1.exports)),readableBrowser$1.exports}var hashBase$1,hasRequiredHashBase$1;function requireHashBase$1(){if(hasRequiredHashBase$1)return hashBase$1;hasRequiredHashBase$1=1;var Xr=safeBufferExports.Buffer,eo=requireReadableBrowser$1().Transform,to=requireInherits_browser();function ro(io,oo){if(!Xr.isBuffer(io)&&typeof io!="string")throw new TypeError(oo+" must be a string or a buffer")}function no(io){eo.call(this),this._block=Xr.allocUnsafe(io),this._blockSize=io,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return to(no,eo),no.prototype._transform=function(io,oo,ao){var so=null;try{this.update(io,oo)}catch(co){so=co}ao(so)},no.prototype._flush=function(io){var oo=null;try{this.push(this.digest())}catch(ao){oo=ao}io(oo)},no.prototype.update=function(io,oo){if(ro(io,"Data"),this._finalized)throw new Error("Digest already called");Xr.isBuffer(io)||(io=Xr.from(io,oo));for(var ao=this._block,so=0;this._blockOffset+io.length-so>=this._blockSize;){for(var co=this._blockOffset;co0;++lo)this._length[lo]+=fo,fo=this._length[lo]/4294967296|0,fo>0&&(this._length[lo]-=4294967296*fo);return this},no.prototype._update=function(){throw new Error("_update is not implemented")},no.prototype.digest=function(io){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var oo=this._digest();io!==void 0&&(oo=oo.toString(io)),this._block.fill(0),this._blockOffset=0;for(var ao=0;ao<4;++ao)this._length[ao]=0;return oo},no.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase$1=no,hashBase$1}var md5_js,hasRequiredMd5_js;function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var Xr=requireInherits_browser(),eo=requireHashBase$1(),to=safeBufferExports.Buffer,ro=new Array(16);function no(){eo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}Xr(no,eo),no.prototype._update=function(){for(var lo=ro,fo=0;fo<16;++fo)lo[fo]=this._block.readInt32LE(fo*4);var ho=this._a,go=this._b,yo=this._c,vo=this._d;ho=oo(ho,go,yo,vo,lo[0],3614090360,7),vo=oo(vo,ho,go,yo,lo[1],3905402710,12),yo=oo(yo,vo,ho,go,lo[2],606105819,17),go=oo(go,yo,vo,ho,lo[3],3250441966,22),ho=oo(ho,go,yo,vo,lo[4],4118548399,7),vo=oo(vo,ho,go,yo,lo[5],1200080426,12),yo=oo(yo,vo,ho,go,lo[6],2821735955,17),go=oo(go,yo,vo,ho,lo[7],4249261313,22),ho=oo(ho,go,yo,vo,lo[8],1770035416,7),vo=oo(vo,ho,go,yo,lo[9],2336552879,12),yo=oo(yo,vo,ho,go,lo[10],4294925233,17),go=oo(go,yo,vo,ho,lo[11],2304563134,22),ho=oo(ho,go,yo,vo,lo[12],1804603682,7),vo=oo(vo,ho,go,yo,lo[13],4254626195,12),yo=oo(yo,vo,ho,go,lo[14],2792965006,17),go=oo(go,yo,vo,ho,lo[15],1236535329,22),ho=ao(ho,go,yo,vo,lo[1],4129170786,5),vo=ao(vo,ho,go,yo,lo[6],3225465664,9),yo=ao(yo,vo,ho,go,lo[11],643717713,14),go=ao(go,yo,vo,ho,lo[0],3921069994,20),ho=ao(ho,go,yo,vo,lo[5],3593408605,5),vo=ao(vo,ho,go,yo,lo[10],38016083,9),yo=ao(yo,vo,ho,go,lo[15],3634488961,14),go=ao(go,yo,vo,ho,lo[4],3889429448,20),ho=ao(ho,go,yo,vo,lo[9],568446438,5),vo=ao(vo,ho,go,yo,lo[14],3275163606,9),yo=ao(yo,vo,ho,go,lo[3],4107603335,14),go=ao(go,yo,vo,ho,lo[8],1163531501,20),ho=ao(ho,go,yo,vo,lo[13],2850285829,5),vo=ao(vo,ho,go,yo,lo[2],4243563512,9),yo=ao(yo,vo,ho,go,lo[7],1735328473,14),go=ao(go,yo,vo,ho,lo[12],2368359562,20),ho=so(ho,go,yo,vo,lo[5],4294588738,4),vo=so(vo,ho,go,yo,lo[8],2272392833,11),yo=so(yo,vo,ho,go,lo[11],1839030562,16),go=so(go,yo,vo,ho,lo[14],4259657740,23),ho=so(ho,go,yo,vo,lo[1],2763975236,4),vo=so(vo,ho,go,yo,lo[4],1272893353,11),yo=so(yo,vo,ho,go,lo[7],4139469664,16),go=so(go,yo,vo,ho,lo[10],3200236656,23),ho=so(ho,go,yo,vo,lo[13],681279174,4),vo=so(vo,ho,go,yo,lo[0],3936430074,11),yo=so(yo,vo,ho,go,lo[3],3572445317,16),go=so(go,yo,vo,ho,lo[6],76029189,23),ho=so(ho,go,yo,vo,lo[9],3654602809,4),vo=so(vo,ho,go,yo,lo[12],3873151461,11),yo=so(yo,vo,ho,go,lo[15],530742520,16),go=so(go,yo,vo,ho,lo[2],3299628645,23),ho=co(ho,go,yo,vo,lo[0],4096336452,6),vo=co(vo,ho,go,yo,lo[7],1126891415,10),yo=co(yo,vo,ho,go,lo[14],2878612391,15),go=co(go,yo,vo,ho,lo[5],4237533241,21),ho=co(ho,go,yo,vo,lo[12],1700485571,6),vo=co(vo,ho,go,yo,lo[3],2399980690,10),yo=co(yo,vo,ho,go,lo[10],4293915773,15),go=co(go,yo,vo,ho,lo[1],2240044497,21),ho=co(ho,go,yo,vo,lo[8],1873313359,6),vo=co(vo,ho,go,yo,lo[15],4264355552,10),yo=co(yo,vo,ho,go,lo[6],2734768916,15),go=co(go,yo,vo,ho,lo[13],1309151649,21),ho=co(ho,go,yo,vo,lo[4],4149444226,6),vo=co(vo,ho,go,yo,lo[11],3174756917,10),yo=co(yo,vo,ho,go,lo[2],718787259,15),go=co(go,yo,vo,ho,lo[9],3951481745,21),this._a=this._a+ho|0,this._b=this._b+go|0,this._c=this._c+yo|0,this._d=this._d+vo|0},no.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var lo=to.allocUnsafe(16);return lo.writeInt32LE(this._a,0),lo.writeInt32LE(this._b,4),lo.writeInt32LE(this._c,8),lo.writeInt32LE(this._d,12),lo};function io(lo,fo){return lo<>>32-fo}function oo(lo,fo,ho,go,yo,vo,wo){return io(lo+(fo&ho|~fo&go)+yo+vo|0,wo)+fo|0}function ao(lo,fo,ho,go,yo,vo,wo){return io(lo+(fo&go|ho&~go)+yo+vo|0,wo)+fo|0}function so(lo,fo,ho,go,yo,vo,wo){return io(lo+(fo^ho^go)+yo+vo|0,wo)+fo|0}function co(lo,fo,ho,go,yo,vo,wo){return io(lo+(ho^(fo|~go))+yo+vo|0,wo)+fo|0}return md5_js=no,md5_js}var hashBase,hasRequiredHashBase;function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var Xr=safeBufferExports.Buffer,eo=requireReadableBrowser$1().Transform,to=requireInherits_browser();function ro(io,oo){if(!Xr.isBuffer(io)&&typeof io!="string")throw new TypeError(oo+" must be a string or a buffer")}function no(io){eo.call(this),this._block=Xr.allocUnsafe(io),this._blockSize=io,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return to(no,eo),no.prototype._transform=function(io,oo,ao){var so=null;try{this.update(io,oo)}catch(co){so=co}ao(so)},no.prototype._flush=function(io){var oo=null;try{this.push(this.digest())}catch(ao){oo=ao}io(oo)},no.prototype.update=function(io,oo){if(ro(io,"Data"),this._finalized)throw new Error("Digest already called");Xr.isBuffer(io)||(io=Xr.from(io,oo));for(var ao=this._block,so=0;this._blockOffset+io.length-so>=this._blockSize;){for(var co=this._blockOffset;co0;++lo)this._length[lo]+=fo,fo=this._length[lo]/4294967296|0,fo>0&&(this._length[lo]-=4294967296*fo);return this},no.prototype._update=function(){throw new Error("_update is not implemented")},no.prototype.digest=function(io){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var oo=this._digest();io!==void 0&&(oo=oo.toString(io)),this._block.fill(0),this._blockOffset=0;for(var ao=0;ao<4;++ao)this._length[ao]=0;return oo},no.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=no,hashBase}var ripemd160,hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var Xr=require$$0$9.Buffer,eo=requireInherits_browser(),to=requireHashBase(),ro=new Array(16),no=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],io=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],oo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ao=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],so=[0,1518500249,1859775393,2400959708,2840853838],co=[1352829926,1548603684,1836072691,2053994217,0];function lo(){to.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}eo(lo,to),lo.prototype._update=function(){for(var Eo=ro,ko=0;ko<16;++ko)Eo[ko]=this._block.readInt32LE(ko*4);for(var Ao=this._a|0,Po=this._b|0,jo=this._c|0,Mo=this._d|0,No=this._e|0,Do=this._a|0,Fo=this._b|0,Xo=this._c|0,Lo=this._d|0,Bo=this._e|0,xo=0;xo<80;xo+=1){var uo,po;xo<16?(uo=ho(Ao,Po,jo,Mo,No,Eo[no[xo]],so[0],oo[xo]),po=wo(Do,Fo,Xo,Lo,Bo,Eo[io[xo]],co[0],ao[xo])):xo<32?(uo=go(Ao,Po,jo,Mo,No,Eo[no[xo]],so[1],oo[xo]),po=vo(Do,Fo,Xo,Lo,Bo,Eo[io[xo]],co[1],ao[xo])):xo<48?(uo=yo(Ao,Po,jo,Mo,No,Eo[no[xo]],so[2],oo[xo]),po=yo(Do,Fo,Xo,Lo,Bo,Eo[io[xo]],co[2],ao[xo])):xo<64?(uo=vo(Ao,Po,jo,Mo,No,Eo[no[xo]],so[3],oo[xo]),po=go(Do,Fo,Xo,Lo,Bo,Eo[io[xo]],co[3],ao[xo])):(uo=wo(Ao,Po,jo,Mo,No,Eo[no[xo]],so[4],oo[xo]),po=ho(Do,Fo,Xo,Lo,Bo,Eo[io[xo]],co[4],ao[xo])),Ao=No,No=Mo,Mo=fo(jo,10),jo=Po,Po=uo,Do=Bo,Bo=Lo,Lo=fo(Xo,10),Xo=Fo,Fo=po}var bo=this._b+jo+Lo|0;this._b=this._c+Mo+Bo|0,this._c=this._d+No+Do|0,this._d=this._e+Ao+Fo|0,this._e=this._a+Po+Xo|0,this._a=bo},lo.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var Eo=Xr.alloc?Xr.alloc(20):new Xr(20);return Eo.writeInt32LE(this._a,0),Eo.writeInt32LE(this._b,4),Eo.writeInt32LE(this._c,8),Eo.writeInt32LE(this._d,12),Eo.writeInt32LE(this._e,16),Eo};function fo(Eo,ko){return Eo<>>32-ko}function ho(Eo,ko,Ao,Po,jo,Mo,No,Do){return fo(Eo+(ko^Ao^Po)+Mo+No|0,Do)+jo|0}function go(Eo,ko,Ao,Po,jo,Mo,No,Do){return fo(Eo+(ko&Ao|~ko&Po)+Mo+No|0,Do)+jo|0}function yo(Eo,ko,Ao,Po,jo,Mo,No,Do){return fo(Eo+((ko|~Ao)^Po)+Mo+No|0,Do)+jo|0}function vo(Eo,ko,Ao,Po,jo,Mo,No,Do){return fo(Eo+(ko&Po|Ao&~Po)+Mo+No|0,Do)+jo|0}function wo(Eo,ko,Ao,Po,jo,Mo,No,Do){return fo(Eo+(ko^(Ao|~Po))+Mo+No|0,Do)+jo|0}return ripemd160=lo,ripemd160}var sha_js={exports:{}},hash$3,hasRequiredHash$1;function requireHash$1(){if(hasRequiredHash$1)return hash$3;hasRequiredHash$1=1;var Xr=safeBufferExports.Buffer;function eo(to,ro){this._block=Xr.alloc(to),this._finalSize=ro,this._blockSize=to,this._len=0}return eo.prototype.update=function(to,ro){typeof to=="string"&&(ro=ro||"utf8",to=Xr.from(to,ro));for(var no=this._block,io=this._blockSize,oo=to.length,ao=this._len,so=0;so=this._finalSize&&(this._update(this._block),this._block.fill(0));var no=this._len*8;if(no<=4294967295)this._block.writeUInt32BE(no,this._blockSize-4);else{var io=(no&4294967295)>>>0,oo=(no-io)/4294967296;this._block.writeUInt32BE(oo,this._blockSize-8),this._block.writeUInt32BE(io,this._blockSize-4)}this._update(this._block);var ao=this._hash();return to?ao.toString(to):ao},eo.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$3=eo,hash$3}var sha$1,hasRequiredSha$1;function requireSha$1(){if(hasRequiredSha$1)return sha$1;hasRequiredSha$1=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1518500249,1859775393,-1894007588,-899497514],no=new Array(80);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function oo(co){return co<<5|co>>>27}function ao(co){return co<<30|co>>>2}function so(co,lo,fo,ho){return co===0?lo&fo|~lo&ho:co===2?lo&fo|lo&ho|fo&ho:lo^fo^ho}return io.prototype._update=function(co){for(var lo=this._w,fo=this._a|0,ho=this._b|0,go=this._c|0,yo=this._d|0,vo=this._e|0,wo=0;wo<16;++wo)lo[wo]=co.readInt32BE(wo*4);for(;wo<80;++wo)lo[wo]=lo[wo-3]^lo[wo-8]^lo[wo-14]^lo[wo-16];for(var Eo=0;Eo<80;++Eo){var ko=~~(Eo/20),Ao=oo(fo)+so(ko,ho,go,yo)+vo+lo[Eo]+ro[ko]|0;vo=yo,yo=go,go=ao(ho),ho=fo,fo=Ao}this._a=fo+this._a|0,this._b=ho+this._b|0,this._c=go+this._c|0,this._d=yo+this._d|0,this._e=vo+this._e|0},io.prototype._hash=function(){var co=to.allocUnsafe(20);return co.writeInt32BE(this._a|0,0),co.writeInt32BE(this._b|0,4),co.writeInt32BE(this._c|0,8),co.writeInt32BE(this._d|0,12),co.writeInt32BE(this._e|0,16),co},sha$1=io,sha$1}var sha1$2,hasRequiredSha1;function requireSha1(){if(hasRequiredSha1)return sha1$2;hasRequiredSha1=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1518500249,1859775393,-1894007588,-899497514],no=new Array(80);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function oo(lo){return lo<<1|lo>>>31}function ao(lo){return lo<<5|lo>>>27}function so(lo){return lo<<30|lo>>>2}function co(lo,fo,ho,go){return lo===0?fo&ho|~fo&go:lo===2?fo&ho|fo&go|ho&go:fo^ho^go}return io.prototype._update=function(lo){for(var fo=this._w,ho=this._a|0,go=this._b|0,yo=this._c|0,vo=this._d|0,wo=this._e|0,Eo=0;Eo<16;++Eo)fo[Eo]=lo.readInt32BE(Eo*4);for(;Eo<80;++Eo)fo[Eo]=oo(fo[Eo-3]^fo[Eo-8]^fo[Eo-14]^fo[Eo-16]);for(var ko=0;ko<80;++ko){var Ao=~~(ko/20),Po=ao(ho)+co(Ao,go,yo,vo)+wo+fo[ko]+ro[Ao]|0;wo=vo,vo=yo,yo=so(go),go=ho,ho=Po}this._a=ho+this._a|0,this._b=go+this._b|0,this._c=yo+this._c|0,this._d=vo+this._d|0,this._e=wo+this._e|0},io.prototype._hash=function(){var lo=to.allocUnsafe(20);return lo.writeInt32BE(this._a|0,0),lo.writeInt32BE(this._b|0,4),lo.writeInt32BE(this._c|0,8),lo.writeInt32BE(this._d|0,12),lo.writeInt32BE(this._e|0,16),lo},sha1$2=io,sha1$2}var sha256$5,hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256$5;hasRequiredSha256=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[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],no=new Array(64);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function oo(ho,go,yo){return yo^ho&(go^yo)}function ao(ho,go,yo){return ho&go|yo&(ho|go)}function so(ho){return(ho>>>2|ho<<30)^(ho>>>13|ho<<19)^(ho>>>22|ho<<10)}function co(ho){return(ho>>>6|ho<<26)^(ho>>>11|ho<<21)^(ho>>>25|ho<<7)}function lo(ho){return(ho>>>7|ho<<25)^(ho>>>18|ho<<14)^ho>>>3}function fo(ho){return(ho>>>17|ho<<15)^(ho>>>19|ho<<13)^ho>>>10}return io.prototype._update=function(ho){for(var go=this._w,yo=this._a|0,vo=this._b|0,wo=this._c|0,Eo=this._d|0,ko=this._e|0,Ao=this._f|0,Po=this._g|0,jo=this._h|0,Mo=0;Mo<16;++Mo)go[Mo]=ho.readInt32BE(Mo*4);for(;Mo<64;++Mo)go[Mo]=fo(go[Mo-2])+go[Mo-7]+lo(go[Mo-15])+go[Mo-16]|0;for(var No=0;No<64;++No){var Do=jo+co(ko)+oo(ko,Ao,Po)+ro[No]+go[No]|0,Fo=so(yo)+ao(yo,vo,wo)|0;jo=Po,Po=Ao,Ao=ko,ko=Eo+Do|0,Eo=wo,wo=vo,vo=yo,yo=Do+Fo|0}this._a=yo+this._a|0,this._b=vo+this._b|0,this._c=wo+this._c|0,this._d=Eo+this._d|0,this._e=ko+this._e|0,this._f=Ao+this._f|0,this._g=Po+this._g|0,this._h=jo+this._h|0},io.prototype._hash=function(){var ho=to.allocUnsafe(32);return ho.writeInt32BE(this._a,0),ho.writeInt32BE(this._b,4),ho.writeInt32BE(this._c,8),ho.writeInt32BE(this._d,12),ho.writeInt32BE(this._e,16),ho.writeInt32BE(this._f,20),ho.writeInt32BE(this._g,24),ho.writeInt32BE(this._h,28),ho},sha256$5=io,sha256$5}var sha224$1,hasRequiredSha224;function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var Xr=requireInherits_browser(),eo=requireSha256(),to=requireHash$1(),ro=safeBufferExports.Buffer,no=new Array(64);function io(){this.init(),this._w=no,to.call(this,64,56)}return Xr(io,eo),io.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},io.prototype._hash=function(){var oo=ro.allocUnsafe(28);return oo.writeInt32BE(this._a,0),oo.writeInt32BE(this._b,4),oo.writeInt32BE(this._c,8),oo.writeInt32BE(this._d,12),oo.writeInt32BE(this._e,16),oo.writeInt32BE(this._f,20),oo.writeInt32BE(this._g,24),oo},sha224$1=io,sha224$1}var sha512$2,hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512$2;hasRequiredSha512=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],no=new Array(160);function io(){this.init(),this._w=no,eo.call(this,128,112)}Xr(io,eo),io.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function oo(vo,wo,Eo){return Eo^vo&(wo^Eo)}function ao(vo,wo,Eo){return vo&wo|Eo&(vo|wo)}function so(vo,wo){return(vo>>>28|wo<<4)^(wo>>>2|vo<<30)^(wo>>>7|vo<<25)}function co(vo,wo){return(vo>>>14|wo<<18)^(vo>>>18|wo<<14)^(wo>>>9|vo<<23)}function lo(vo,wo){return(vo>>>1|wo<<31)^(vo>>>8|wo<<24)^vo>>>7}function fo(vo,wo){return(vo>>>1|wo<<31)^(vo>>>8|wo<<24)^(vo>>>7|wo<<25)}function ho(vo,wo){return(vo>>>19|wo<<13)^(wo>>>29|vo<<3)^vo>>>6}function go(vo,wo){return(vo>>>19|wo<<13)^(wo>>>29|vo<<3)^(vo>>>6|wo<<26)}function yo(vo,wo){return vo>>>0>>0?1:0}return io.prototype._update=function(vo){for(var wo=this._w,Eo=this._ah|0,ko=this._bh|0,Ao=this._ch|0,Po=this._dh|0,jo=this._eh|0,Mo=this._fh|0,No=this._gh|0,Do=this._hh|0,Fo=this._al|0,Xo=this._bl|0,Lo=this._cl|0,Bo=this._dl|0,xo=this._el|0,uo=this._fl|0,po=this._gl|0,bo=this._hl|0,_o=0;_o<32;_o+=2)wo[_o]=vo.readInt32BE(_o*4),wo[_o+1]=vo.readInt32BE(_o*4+4);for(;_o<160;_o+=2){var $o=wo[_o-30],Co=wo[_o-15*2+1],Ro=lo($o,Co),So=fo(Co,$o);$o=wo[_o-2*2],Co=wo[_o-2*2+1];var mo=ho($o,Co),To=go(Co,$o),Vo=wo[_o-7*2],Zo=wo[_o-7*2+1],Qo=wo[_o-16*2],qo=wo[_o-16*2+1],Ho=So+Zo|0,$a=Ro+Vo+yo(Ho,So)|0;Ho=Ho+To|0,$a=$a+mo+yo(Ho,To)|0,Ho=Ho+qo|0,$a=$a+Qo+yo(Ho,qo)|0,wo[_o]=$a,wo[_o+1]=Ho}for(var zo=0;zo<160;zo+=2){$a=wo[zo],Ho=wo[zo+1];var Ko=ao(Eo,ko,Ao),_c=ao(Fo,Xo,Lo),Cl=so(Eo,Fo),ga=so(Fo,Eo),El=co(jo,xo),Al=co(xo,jo),Ol=ro[zo],Wl=ro[zo+1],zl=oo(jo,Mo,No),Tl=oo(xo,uo,po),Ml=bo+Al|0,ou=Do+El+yo(Ml,bo)|0;Ml=Ml+Tl|0,ou=ou+zl+yo(Ml,Tl)|0,Ml=Ml+Wl|0,ou=ou+Ol+yo(Ml,Wl)|0,Ml=Ml+Ho|0,ou=ou+$a+yo(Ml,Ho)|0;var Vl=ga+_c|0,Ll=Cl+Ko+yo(Vl,ga)|0;Do=No,bo=po,No=Mo,po=uo,Mo=jo,uo=xo,xo=Bo+Ml|0,jo=Po+ou+yo(xo,Bo)|0,Po=Ao,Bo=Lo,Ao=ko,Lo=Xo,ko=Eo,Xo=Fo,Fo=Ml+Vl|0,Eo=ou+Ll+yo(Fo,Ml)|0}this._al=this._al+Fo|0,this._bl=this._bl+Xo|0,this._cl=this._cl+Lo|0,this._dl=this._dl+Bo|0,this._el=this._el+xo|0,this._fl=this._fl+uo|0,this._gl=this._gl+po|0,this._hl=this._hl+bo|0,this._ah=this._ah+Eo+yo(this._al,Fo)|0,this._bh=this._bh+ko+yo(this._bl,Xo)|0,this._ch=this._ch+Ao+yo(this._cl,Lo)|0,this._dh=this._dh+Po+yo(this._dl,Bo)|0,this._eh=this._eh+jo+yo(this._el,xo)|0,this._fh=this._fh+Mo+yo(this._fl,uo)|0,this._gh=this._gh+No+yo(this._gl,po)|0,this._hh=this._hh+Do+yo(this._hl,bo)|0},io.prototype._hash=function(){var vo=to.allocUnsafe(64);function wo(Eo,ko,Ao){vo.writeInt32BE(Eo,Ao),vo.writeInt32BE(ko,Ao+4)}return wo(this._ah,this._al,0),wo(this._bh,this._bl,8),wo(this._ch,this._cl,16),wo(this._dh,this._dl,24),wo(this._eh,this._el,32),wo(this._fh,this._fl,40),wo(this._gh,this._gl,48),wo(this._hh,this._hl,56),vo},sha512$2=io,sha512$2}var sha384$1,hasRequiredSha384;function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var Xr=requireInherits_browser(),eo=requireSha512(),to=requireHash$1(),ro=safeBufferExports.Buffer,no=new Array(160);function io(){this.init(),this._w=no,to.call(this,128,112)}return Xr(io,eo),io.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},io.prototype._hash=function(){var oo=ro.allocUnsafe(48);function ao(so,co,lo){oo.writeInt32BE(so,lo),oo.writeInt32BE(co,lo+4)}return ao(this._ah,this._al,0),ao(this._bh,this._bl,8),ao(this._ch,this._cl,16),ao(this._dh,this._dl,24),ao(this._eh,this._el,32),ao(this._fh,this._fl,40),oo},sha384$1=io,sha384$1}var hasRequiredSha_js;function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var Xr=sha_js.exports=function(to){to=to.toLowerCase();var ro=Xr[to];if(!ro)throw new Error(to+" is not supported (we accept pull requests)");return new ro};return Xr.sha=requireSha$1(),Xr.sha1=requireSha1(),Xr.sha224=requireSha224(),Xr.sha256=requireSha256(),Xr.sha384=requireSha384(),Xr.sha512=requireSha512(),sha_js.exports}var streamBrowserify,hasRequiredStreamBrowserify;function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=to;var Xr=eventsExports.EventEmitter,eo=requireInherits_browser();eo(to,Xr),to.Readable=require_stream_readable$1(),to.Writable=require_stream_writable$1(),to.Duplex=require_stream_duplex$1(),to.Transform=require_stream_transform$1(),to.PassThrough=require_stream_passthrough$1(),to.finished=requireEndOfStream(),to.pipeline=requirePipeline(),to.Stream=to;function to(){Xr.call(this)}return to.prototype.pipe=function(ro,no){var io=this;function oo(go){ro.writable&&ro.write(go)===!1&&io.pause&&io.pause()}io.on("data",oo);function ao(){io.readable&&io.resume&&io.resume()}ro.on("drain",ao),!ro._isStdio&&(!no||no.end!==!1)&&(io.on("end",co),io.on("close",lo));var so=!1;function co(){so||(so=!0,ro.end())}function lo(){so||(so=!0,typeof ro.destroy=="function"&&ro.destroy())}function fo(go){if(ho(),Xr.listenerCount(this,"error")===0)throw go}io.on("error",fo),ro.on("error",fo);function ho(){io.removeListener("data",oo),ro.removeListener("drain",ao),io.removeListener("end",co),io.removeListener("close",lo),io.removeListener("error",fo),ro.removeListener("error",fo),io.removeListener("end",ho),io.removeListener("close",ho),ro.removeListener("close",ho)}return io.on("end",ho),io.on("close",ho),ro.on("close",ho),ro.emit("pipe",io),ro},streamBrowserify}var cipherBase,hasRequiredCipherBase;function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var Xr=safeBufferExports.Buffer,eo=requireStreamBrowserify().Transform,to=requireString_decoder().StringDecoder,ro=requireInherits_browser();function no(io){eo.call(this),this.hashMode=typeof io=="string",this.hashMode?this[io]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return ro(no,eo),no.prototype.update=function(io,oo,ao){typeof io=="string"&&(io=Xr.from(io,oo));var so=this._update(io);return this.hashMode?this:(ao&&(so=this._toString(so,ao)),so)},no.prototype.setAutoPadding=function(){},no.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},no.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},no.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},no.prototype._transform=function(io,oo,ao){var so;try{this.hashMode?this._update(io):this.push(this._update(io))}catch(co){so=co}finally{ao(so)}},no.prototype._flush=function(io){var oo;try{this.push(this.__final())}catch(ao){oo=ao}io(oo)},no.prototype._finalOrDigest=function(io){var oo=this.__final()||Xr.alloc(0);return io&&(oo=this._toString(oo,io,!0)),oo},no.prototype._toString=function(io,oo,ao){if(this._decoder||(this._decoder=new to(oo),this._encoding=oo),this._encoding!==oo)throw new Error("can't switch encodings");var so=this._decoder.write(io);return ao&&(so+=this._decoder.end()),so},cipherBase=no,cipherBase}var browser$e,hasRequiredBrowser$9;function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$e;hasRequiredBrowser$9=1;var Xr=requireInherits_browser(),eo=requireMd5_js(),to=requireRipemd160(),ro=requireSha_js(),no=requireCipherBase();function io(oo){no.call(this,"digest"),this._hash=oo}return Xr(io,no),io.prototype._update=function(oo){this._hash.update(oo)},io.prototype._final=function(){return this._hash.digest()},browser$e=function(ao){return ao=ao.toLowerCase(),ao==="md5"?new eo:ao==="rmd160"||ao==="ripemd160"?new to:new io(ro(ao))},browser$e}var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var Xr=requireInherits_browser(),eo=safeBufferExports.Buffer,to=requireCipherBase(),ro=eo.alloc(128),no=64;function io(oo,ao){to.call(this,"digest"),typeof ao=="string"&&(ao=eo.from(ao)),this._alg=oo,this._key=ao,ao.length>no?ao=oo(ao):ao.lengthfo){var ho=co==="rmd160"?new io:oo(co);lo=ho.update(lo).digest()}else lo.lengthXr||to!==to)throw new TypeError("Bad key length")},precondition}var defaultEncoding_1,hasRequiredDefaultEncoding;function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;hasRequiredDefaultEncoding=1;var Xr;if(commonjsGlobal.process&&commonjsGlobal.process.browser)Xr="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var eo=parseInt(process$1$1.version.split(".")[0].slice(1),10);Xr=eo>=6?"utf-8":"binary"}else Xr="utf-8";return defaultEncoding_1=Xr,defaultEncoding_1}var toBuffer$6,hasRequiredToBuffer;function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer$6;hasRequiredToBuffer=1;var Xr=safeBufferExports.Buffer;return toBuffer$6=function(eo,to,ro){if(Xr.isBuffer(eo))return eo;if(typeof eo=="string")return Xr.from(eo,to);if(ArrayBuffer.isView(eo))return Xr.from(eo.buffer);throw new TypeError(ro+" must be a string, a Buffer, a typed array or a DataView")},toBuffer$6}var syncBrowser,hasRequiredSyncBrowser;function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var Xr=requireMd5(),eo=requireRipemd160(),to=requireSha_js(),ro=safeBufferExports.Buffer,no=requirePrecondition(),io=requireDefaultEncoding(),oo=requireToBuffer(),ao=ro.alloc(128),so={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function co(ho,go,yo){var vo=lo(ho),wo=ho==="sha512"||ho==="sha384"?128:64;go.length>wo?go=vo(go):go.length>>0},utils$8.writeUInt32BE=function(no,io,oo){no[0+oo]=io>>>24,no[1+oo]=io>>>16&255,no[2+oo]=io>>>8&255,no[3+oo]=io&255},utils$8.ip=function(no,io,oo,ao){for(var so=0,co=0,lo=6;lo>=0;lo-=2){for(var fo=0;fo<=24;fo+=8)so<<=1,so|=io>>>fo+lo&1;for(var fo=0;fo<=24;fo+=8)so<<=1,so|=no>>>fo+lo&1}for(var lo=6;lo>=0;lo-=2){for(var fo=1;fo<=25;fo+=8)co<<=1,co|=io>>>fo+lo&1;for(var fo=1;fo<=25;fo+=8)co<<=1,co|=no>>>fo+lo&1}oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.rip=function(no,io,oo,ao){for(var so=0,co=0,lo=0;lo<4;lo++)for(var fo=24;fo>=0;fo-=8)so<<=1,so|=io>>>fo+lo&1,so<<=1,so|=no>>>fo+lo&1;for(var lo=4;lo<8;lo++)for(var fo=24;fo>=0;fo-=8)co<<=1,co|=io>>>fo+lo&1,co<<=1,co|=no>>>fo+lo&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.pc1=function(no,io,oo,ao){for(var so=0,co=0,lo=7;lo>=5;lo--){for(var fo=0;fo<=24;fo+=8)so<<=1,so|=io>>fo+lo&1;for(var fo=0;fo<=24;fo+=8)so<<=1,so|=no>>fo+lo&1}for(var fo=0;fo<=24;fo+=8)so<<=1,so|=io>>fo+lo&1;for(var lo=1;lo<=3;lo++){for(var fo=0;fo<=24;fo+=8)co<<=1,co|=io>>fo+lo&1;for(var fo=0;fo<=24;fo+=8)co<<=1,co|=no>>fo+lo&1}for(var fo=0;fo<=24;fo+=8)co<<=1,co|=no>>fo+lo&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.r28shl=function(no,io){return no<>>28-io};var Xr=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$8.pc2=function(no,io,oo,ao){for(var so=0,co=0,lo=Xr.length>>>1,fo=0;fo>>Xr[fo]&1;for(var fo=lo;fo>>Xr[fo]&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.expand=function(no,io,oo){var ao=0,so=0;ao=(no&1)<<5|no>>>27;for(var co=23;co>=15;co-=4)ao<<=6,ao|=no>>>co&63;for(var co=11;co>=3;co-=4)so|=no>>>co&63,so<<=6;so|=(no&31)<<1|no>>>31,io[oo+0]=ao>>>0,io[oo+1]=so>>>0};var eo=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$8.substitute=function(no,io){for(var oo=0,ao=0;ao<4;ao++){var so=no>>>18-ao*6&63,co=eo[ao*64+so];oo<<=4,oo|=co}for(var ao=0;ao<4;ao++){var so=io>>>18-ao*6&63,co=eo[4*64+ao*64+so];oo<<=4,oo|=co}return oo>>>0};var to=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$8.permute=function(no){for(var io=0,oo=0;oo>>to[oo]&1;return io>>>0},utils$8.padSplit=function(no,io,oo){for(var ao=no.toString(2);ao.length0;oo--)no+=this._buffer(ro,no),io+=this._flushBuffer(ao,io);return no+=this._buffer(ro,no),ao},eo.prototype.final=function(ro){var no;ro&&(no=this.update(ro));var io;return this.type==="encrypt"?io=this._finalEncrypt():io=this._finalDecrypt(),no?no.concat(io):io},eo.prototype._pad=function(ro,no){if(no===0)return!1;for(;no>>1];lo=to.r28shl(lo,go),fo=to.r28shl(fo,go),to.pc2(lo,fo,so.keys,ho)}},io.prototype._update=function(so,co,lo,fo){var ho=this._desState,go=to.readUInt32BE(so,co),yo=to.readUInt32BE(so,co+4);to.ip(go,yo,ho.tmp,0),go=ho.tmp[0],yo=ho.tmp[1],this.type==="encrypt"?this._encrypt(ho,go,yo,ho.tmp,0):this._decrypt(ho,go,yo,ho.tmp,0),go=ho.tmp[0],yo=ho.tmp[1],to.writeUInt32BE(lo,go,fo),to.writeUInt32BE(lo,yo,fo+4)},io.prototype._pad=function(so,co){if(this.padding===!1)return!1;for(var lo=so.length-co,fo=co;fo>>0,go=Po}to.rip(yo,go,fo,ho)},io.prototype._decrypt=function(so,co,lo,fo,ho){for(var go=lo,yo=co,vo=so.keys.length-2;vo>=0;vo-=2){var wo=so.keys[vo],Eo=so.keys[vo+1];to.expand(go,so.tmp,0),wo^=so.tmp[0],Eo^=so.tmp[1];var ko=to.substitute(wo,Eo),Ao=to.permute(ko),Po=go;go=(yo^Ao)>>>0,yo=Po}to.rip(go,yo,fo,ho)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var Xr=requireMinimalisticAssert(),eo=requireInherits_browser(),to={};function ro(io){Xr.equal(io.length,8,"Invalid IV length"),this.iv=new Array(8);for(var oo=0;oo>ao%8,ro._prev=to(ro._prev,io?lo:fo);return co}function to(ro,no){var io=ro.length,oo=-1,ao=Xr.allocUnsafe(ro.length);for(ro=Xr.concat([ro,Xr.from([no])]);++oo>7;return ao}return cfb1.encrypt=function(ro,no,io){for(var oo=no.length,ao=Xr.allocUnsafe(oo),so=-1;++so>>24]^go[Eo>>>16&255]^yo[ko>>>8&255]^vo[Ao&255]^so[Do++],jo=ho[Eo>>>24]^go[ko>>>16&255]^yo[Ao>>>8&255]^vo[wo&255]^so[Do++],Mo=ho[ko>>>24]^go[Ao>>>16&255]^yo[wo>>>8&255]^vo[Eo&255]^so[Do++],No=ho[Ao>>>24]^go[wo>>>16&255]^yo[Eo>>>8&255]^vo[ko&255]^so[Do++],wo=Po,Eo=jo,ko=Mo,Ao=No;return Po=(lo[wo>>>24]<<24|lo[Eo>>>16&255]<<16|lo[ko>>>8&255]<<8|lo[Ao&255])^so[Do++],jo=(lo[Eo>>>24]<<24|lo[ko>>>16&255]<<16|lo[Ao>>>8&255]<<8|lo[wo&255])^so[Do++],Mo=(lo[ko>>>24]<<24|lo[Ao>>>16&255]<<16|lo[wo>>>8&255]<<8|lo[Eo&255])^so[Do++],No=(lo[Ao>>>24]<<24|lo[wo>>>16&255]<<16|lo[Eo>>>8&255]<<8|lo[ko&255])^so[Do++],Po=Po>>>0,jo=jo>>>0,Mo=Mo>>>0,No=No>>>0,[Po,jo,Mo,No]}var no=[0,1,2,4,8,16,32,64,128,27,54],io=function(){for(var ao=new Array(256),so=0;so<256;so++)so<128?ao[so]=so<<1:ao[so]=so<<1^283;for(var co=[],lo=[],fo=[[],[],[],[]],ho=[[],[],[],[]],go=0,yo=0,vo=0;vo<256;++vo){var wo=yo^yo<<1^yo<<2^yo<<3^yo<<4;wo=wo>>>8^wo&255^99,co[go]=wo,lo[wo]=go;var Eo=ao[go],ko=ao[Eo],Ao=ao[ko],Po=ao[wo]*257^wo*16843008;fo[0][go]=Po<<24|Po>>>8,fo[1][go]=Po<<16|Po>>>16,fo[2][go]=Po<<8|Po>>>24,fo[3][go]=Po,Po=Ao*16843009^ko*65537^Eo*257^go*16843008,ho[0][wo]=Po<<24|Po>>>8,ho[1][wo]=Po<<16|Po>>>16,ho[2][wo]=Po<<8|Po>>>24,ho[3][wo]=Po,go===0?go=yo=1:(go=Eo^ao[ao[ao[Ao^Eo]]],yo^=ao[ao[yo]])}return{SBOX:co,INV_SBOX:lo,SUB_MIX:fo,INV_SUB_MIX:ho}}();function oo(ao){this._key=eo(ao),this._reset()}return oo.blockSize=4*4,oo.keySize=256/8,oo.prototype.blockSize=oo.blockSize,oo.prototype.keySize=oo.keySize,oo.prototype._reset=function(){for(var ao=this._key,so=ao.length,co=so+6,lo=(co+1)*4,fo=[],ho=0;ho>>24,go=io.SBOX[go>>>24]<<24|io.SBOX[go>>>16&255]<<16|io.SBOX[go>>>8&255]<<8|io.SBOX[go&255],go^=no[ho/so|0]<<24):so>6&&ho%so===4&&(go=io.SBOX[go>>>24]<<24|io.SBOX[go>>>16&255]<<16|io.SBOX[go>>>8&255]<<8|io.SBOX[go&255]),fo[ho]=fo[ho-so]^go}for(var yo=[],vo=0;vo>>24]]^io.INV_SUB_MIX[1][io.SBOX[Eo>>>16&255]]^io.INV_SUB_MIX[2][io.SBOX[Eo>>>8&255]]^io.INV_SUB_MIX[3][io.SBOX[Eo&255]]}this._nRounds=co,this._keySchedule=fo,this._invKeySchedule=yo},oo.prototype.encryptBlockRaw=function(ao){return ao=eo(ao),ro(ao,this._keySchedule,io.SUB_MIX,io.SBOX,this._nRounds)},oo.prototype.encryptBlock=function(ao){var so=this.encryptBlockRaw(ao),co=Xr.allocUnsafe(16);return co.writeUInt32BE(so[0],0),co.writeUInt32BE(so[1],4),co.writeUInt32BE(so[2],8),co.writeUInt32BE(so[3],12),co},oo.prototype.decryptBlock=function(ao){ao=eo(ao);var so=ao[1];ao[1]=ao[3],ao[3]=so;var co=ro(ao,this._invKeySchedule,io.INV_SUB_MIX,io.INV_SBOX,this._nRounds),lo=Xr.allocUnsafe(16);return lo.writeUInt32BE(co[0],0),lo.writeUInt32BE(co[3],4),lo.writeUInt32BE(co[2],8),lo.writeUInt32BE(co[1],12),lo},oo.prototype.scrub=function(){to(this._keySchedule),to(this._invKeySchedule),to(this._key)},aes.AES=oo,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var Xr=safeBufferExports.Buffer,eo=Xr.alloc(16,0);function to(io){return[io.readUInt32BE(0),io.readUInt32BE(4),io.readUInt32BE(8),io.readUInt32BE(12)]}function ro(io){var oo=Xr.allocUnsafe(16);return oo.writeUInt32BE(io[0]>>>0,0),oo.writeUInt32BE(io[1]>>>0,4),oo.writeUInt32BE(io[2]>>>0,8),oo.writeUInt32BE(io[3]>>>0,12),oo}function no(io){this.h=io,this.state=Xr.alloc(16,0),this.cache=Xr.allocUnsafe(0)}return no.prototype.ghash=function(io){for(var oo=-1;++oo0;ao--)io[ao]=io[ao]>>>1|(io[ao-1]&1)<<31;io[0]=io[0]>>>1,co&&(io[0]=io[0]^225<<24)}this.state=ro(oo)},no.prototype.update=function(io){this.cache=Xr.concat([this.cache,io]);for(var oo;this.cache.length>=16;)oo=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(oo)},no.prototype.final=function(io,oo){return this.cache.length&&this.ghash(Xr.concat([this.cache,eo],16)),this.ghash(ro([0,io,0,oo])),this.state},ghash=no,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var Xr=requireAes(),eo=safeBufferExports.Buffer,to=requireCipherBase(),ro=requireInherits_browser(),no=requireGhash(),io=requireBufferXor(),oo=requireIncr32();function ao(lo,fo){var ho=0;lo.length!==fo.length&&ho++;for(var go=Math.min(lo.length,fo.length),yo=0;yo0||oo>0;){var fo=new eo;fo.update(lo),fo.update(ro),no&&fo.update(no),lo=fo.digest();var ho=0;if(ao>0){var go=so.length-ao;ho=Math.min(ao,lo.length),lo.copy(so,go,0,ho),ao-=ho}if(ho0){var yo=co.length-oo,vo=Math.min(oo,lo.length-ho);lo.copy(co,yo,ho,ho+vo),oo-=vo}}return lo.fill(0),{key:so,iv:co}}return evp_bytestokey=to,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var Xr=requireModes$1(),eo=requireAuthCipher(),to=safeBufferExports.Buffer,ro=requireStreamCipher(),no=requireCipherBase(),io=requireAes(),oo=requireEvp_bytestokey(),ao=requireInherits_browser();function so(go,yo,vo){no.call(this),this._cache=new lo,this._cipher=new io.AES(yo),this._prev=to.from(vo),this._mode=go,this._autopadding=!0}ao(so,no),so.prototype._update=function(go){this._cache.add(go);for(var yo,vo,wo=[];yo=this._cache.get();)vo=this._mode.encrypt(this,yo),wo.push(vo);return to.concat(wo)};var co=to.alloc(16,16);so.prototype._final=function(){var go=this._cache.flush();if(this._autopadding)return go=this._mode.encrypt(this,go),this._cipher.scrub(),go;if(!go.equals(co))throw this._cipher.scrub(),new Error("data not multiple of block length")},so.prototype.setAutoPadding=function(go){return this._autopadding=!!go,this};function lo(){this.cache=to.allocUnsafe(0)}lo.prototype.add=function(go){this.cache=to.concat([this.cache,go])},lo.prototype.get=function(){if(this.cache.length>15){var go=this.cache.slice(0,16);return this.cache=this.cache.slice(16),go}return null},lo.prototype.flush=function(){for(var go=16-this.cache.length,yo=to.allocUnsafe(go),vo=-1;++vo16)return yo=this.cache.slice(0,16),this.cache=this.cache.slice(16),yo}else if(this.cache.length>=16)return yo=this.cache.slice(0,16),this.cache=this.cache.slice(16),yo;return null},co.prototype.flush=function(){if(this.cache.length)return this.cache};function lo(go){var yo=go[15];if(yo<1||yo>16)throw new Error("unable to decrypt data");for(var vo=-1;++vo0?Bo:xo},io.min=function(Bo,xo){return Bo.cmp(xo)<0?Bo:xo},io.prototype._init=function(Bo,xo,uo){if(typeof Bo=="number")return this._initNumber(Bo,xo,uo);if(typeof Bo=="object")return this._initArray(Bo,xo,uo);xo==="hex"&&(xo=16),ro(xo===(xo|0)&&xo>=2&&xo<=36),Bo=Bo.toString().replace(/\s+/g,"");var po=0;Bo[0]==="-"&&(po++,this.negative=1),po=0;po-=3)_o=Bo[po]|Bo[po-1]<<8|Bo[po-2]<<16,this.words[bo]|=_o<<$o&67108863,this.words[bo+1]=_o>>>26-$o&67108863,$o+=24,$o>=26&&($o-=26,bo++);else if(uo==="le")for(po=0,bo=0;po>>26-$o&67108863,$o+=24,$o>=26&&($o-=26,bo++);return this.strip()};function ao(Lo,Bo){var xo=Lo.charCodeAt(Bo);return xo>=65&&xo<=70?xo-55:xo>=97&&xo<=102?xo-87:xo-48&15}function so(Lo,Bo,xo){var uo=ao(Lo,xo);return xo-1>=Bo&&(uo|=ao(Lo,xo-1)<<4),uo}io.prototype._parseHex=function(Bo,xo,uo){this.length=Math.ceil((Bo.length-xo)/6),this.words=new Array(this.length);for(var po=0;po=xo;po-=2)$o=so(Bo,xo,po)<=18?(bo-=18,_o+=1,this.words[_o]|=$o>>>26):bo+=8;else{var Co=Bo.length-xo;for(po=Co%2===0?xo+1:xo;po=18?(bo-=18,_o+=1,this.words[_o]|=$o>>>26):bo+=8}this.strip()};function co(Lo,Bo,xo,uo){for(var po=0,bo=Math.min(Lo.length,xo),_o=Bo;_o=49?po+=$o-49+10:$o>=17?po+=$o-17+10:po+=$o}return po}io.prototype._parseBase=function(Bo,xo,uo){this.words=[0],this.length=1;for(var po=0,bo=1;bo<=67108863;bo*=xo)po++;po--,bo=bo/xo|0;for(var _o=Bo.length-uo,$o=_o%po,Co=Math.min(_o,_o-$o)+uo,Ro=0,So=uo;So1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],fo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(Bo,xo){Bo=Bo||10,xo=xo|0||1;var uo;if(Bo===16||Bo==="hex"){uo="";for(var po=0,bo=0,_o=0;_o>>24-po&16777215,bo!==0||_o!==this.length-1?uo=lo[6-Co.length]+Co+uo:uo=Co+uo,po+=2,po>=26&&(po-=26,_o--)}for(bo!==0&&(uo=bo.toString(16)+uo);uo.length%xo!==0;)uo="0"+uo;return this.negative!==0&&(uo="-"+uo),uo}if(Bo===(Bo|0)&&Bo>=2&&Bo<=36){var Ro=fo[Bo],So=ho[Bo];uo="";var mo=this.clone();for(mo.negative=0;!mo.isZero();){var To=mo.modn(So).toString(Bo);mo=mo.idivn(So),mo.isZero()?uo=To+uo:uo=lo[Ro-To.length]+To+uo}for(this.isZero()&&(uo="0"+uo);uo.length%xo!==0;)uo="0"+uo;return this.negative!==0&&(uo="-"+uo),uo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var Bo=this.words[0];return this.length===2?Bo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Bo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Bo:Bo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(Bo,xo){return ro(typeof oo<"u"),this.toArrayLike(oo,Bo,xo)},io.prototype.toArray=function(Bo,xo){return this.toArrayLike(Array,Bo,xo)},io.prototype.toArrayLike=function(Bo,xo,uo){var po=this.byteLength(),bo=uo||Math.max(1,po);ro(po<=bo,"byte array longer than desired length"),ro(bo>0,"Requested array length <= 0"),this.strip();var _o=xo==="le",$o=new Bo(bo),Co,Ro,So=this.clone();if(_o){for(Ro=0;!So.isZero();Ro++)Co=So.andln(255),So.iushrn(8),$o[Ro]=Co;for(;Ro=4096&&(uo+=13,xo>>>=13),xo>=64&&(uo+=7,xo>>>=7),xo>=8&&(uo+=4,xo>>>=4),xo>=2&&(uo+=2,xo>>>=2),uo+xo},io.prototype._zeroBits=function(Bo){if(Bo===0)return 26;var xo=Bo,uo=0;return xo&8191||(uo+=13,xo>>>=13),xo&127||(uo+=7,xo>>>=7),xo&15||(uo+=4,xo>>>=4),xo&3||(uo+=2,xo>>>=2),xo&1||uo++,uo},io.prototype.bitLength=function(){var Bo=this.words[this.length-1],xo=this._countBits(Bo);return(this.length-1)*26+xo};function go(Lo){for(var Bo=new Array(Lo.bitLength()),xo=0;xo>>po}return Bo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Bo=0,xo=0;xoBo.length?this.clone().ior(Bo):Bo.clone().ior(this)},io.prototype.uor=function(Bo){return this.length>Bo.length?this.clone().iuor(Bo):Bo.clone().iuor(this)},io.prototype.iuand=function(Bo){var xo;this.length>Bo.length?xo=Bo:xo=this;for(var uo=0;uoBo.length?this.clone().iand(Bo):Bo.clone().iand(this)},io.prototype.uand=function(Bo){return this.length>Bo.length?this.clone().iuand(Bo):Bo.clone().iuand(this)},io.prototype.iuxor=function(Bo){var xo,uo;this.length>Bo.length?(xo=this,uo=Bo):(xo=Bo,uo=this);for(var po=0;poBo.length?this.clone().ixor(Bo):Bo.clone().ixor(this)},io.prototype.uxor=function(Bo){return this.length>Bo.length?this.clone().iuxor(Bo):Bo.clone().iuxor(this)},io.prototype.inotn=function(Bo){ro(typeof Bo=="number"&&Bo>=0);var xo=Math.ceil(Bo/26)|0,uo=Bo%26;this._expand(xo),uo>0&&xo--;for(var po=0;po0&&(this.words[po]=~this.words[po]&67108863>>26-uo),this.strip()},io.prototype.notn=function(Bo){return this.clone().inotn(Bo)},io.prototype.setn=function(Bo,xo){ro(typeof Bo=="number"&&Bo>=0);var uo=Bo/26|0,po=Bo%26;return this._expand(uo+1),xo?this.words[uo]=this.words[uo]|1<Bo.length?(uo=this,po=Bo):(uo=Bo,po=this);for(var bo=0,_o=0;_o>>26;for(;bo!==0&&_o>>26;if(this.length=uo.length,bo!==0)this.words[this.length]=bo,this.length++;else if(uo!==this)for(;_oBo.length?this.clone().iadd(Bo):Bo.clone().iadd(this)},io.prototype.isub=function(Bo){if(Bo.negative!==0){Bo.negative=0;var xo=this.iadd(Bo);return Bo.negative=1,xo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Bo),this.negative=1,this._normSign();var uo=this.cmp(Bo);if(uo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var po,bo;uo>0?(po=this,bo=Bo):(po=Bo,bo=this);for(var _o=0,$o=0;$o>26,this.words[$o]=xo&67108863;for(;_o!==0&&$o>26,this.words[$o]=xo&67108863;if(_o===0&&$o>>26,mo=Co&67108863,To=Math.min(Ro,Bo.length-1),Vo=Math.max(0,Ro-Lo.length+1);Vo<=To;Vo++){var Zo=Ro-Vo|0;po=Lo.words[Zo]|0,bo=Bo.words[Vo]|0,_o=po*bo+mo,So+=_o/67108864|0,mo=_o&67108863}xo.words[Ro]=mo|0,Co=So|0}return Co!==0?xo.words[Ro]=Co|0:xo.length--,xo.strip()}var vo=function(Bo,xo,uo){var po=Bo.words,bo=xo.words,_o=uo.words,$o=0,Co,Ro,So,mo=po[0]|0,To=mo&8191,Vo=mo>>>13,Zo=po[1]|0,Qo=Zo&8191,qo=Zo>>>13,Ho=po[2]|0,$a=Ho&8191,zo=Ho>>>13,Ko=po[3]|0,_c=Ko&8191,Cl=Ko>>>13,ga=po[4]|0,El=ga&8191,Al=ga>>>13,Ol=po[5]|0,Wl=Ol&8191,zl=Ol>>>13,Tl=po[6]|0,Ml=Tl&8191,ou=Tl>>>13,Vl=po[7]|0,Ll=Vl&8191,uu=Vl>>>13,ru=po[8]|0,tu=ru&8191,ku=ru>>>13,au=po[9]|0,wl=au&8191,Jo=au>>>13,Go=bo[0]|0,$l=Go&8191,Zl=Go>>>13,Ul=bo[1]|0,Gl=Ul&8191,Nu=Ul>>>13,hu=bo[2]|0,cu=hu&8191,Wu=hu>>>13,mu=bo[3]|0,yu=mu&8191,Yu=mu>>>13,_u=bo[4]|0,Il=_u&8191,Nl=_u>>>13,Pl=bo[5]|0,Bl=Pl&8191,fu=Pl>>>13,eu=bo[6]|0,Xl=eu&8191,$u=eu>>>13,Yo=bo[7]|0,_l=Yo&8191,Sl=Yo>>>13,Wo=bo[8]|0,xl=Wo&8191,Ql=Wo>>>13,Fl=bo[9]|0,Jl=Fl&8191,xu=Fl>>>13;uo.negative=Bo.negative^xo.negative,uo.length=19,Co=Math.imul(To,$l),Ro=Math.imul(To,Zl),Ro=Ro+Math.imul(Vo,$l)|0,So=Math.imul(Vo,Zl);var lu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(lu>>>26)|0,lu&=67108863,Co=Math.imul(Qo,$l),Ro=Math.imul(Qo,Zl),Ro=Ro+Math.imul(qo,$l)|0,So=Math.imul(qo,Zl),Co=Co+Math.imul(To,Gl)|0,Ro=Ro+Math.imul(To,Nu)|0,Ro=Ro+Math.imul(Vo,Gl)|0,So=So+Math.imul(Vo,Nu)|0;var su=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(su>>>26)|0,su&=67108863,Co=Math.imul($a,$l),Ro=Math.imul($a,Zl),Ro=Ro+Math.imul(zo,$l)|0,So=Math.imul(zo,Zl),Co=Co+Math.imul(Qo,Gl)|0,Ro=Ro+Math.imul(Qo,Nu)|0,Ro=Ro+Math.imul(qo,Gl)|0,So=So+Math.imul(qo,Nu)|0,Co=Co+Math.imul(To,cu)|0,Ro=Ro+Math.imul(To,Wu)|0,Ro=Ro+Math.imul(Vo,cu)|0,So=So+Math.imul(Vo,Wu)|0;var Xu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,Co=Math.imul(_c,$l),Ro=Math.imul(_c,Zl),Ro=Ro+Math.imul(Cl,$l)|0,So=Math.imul(Cl,Zl),Co=Co+Math.imul($a,Gl)|0,Ro=Ro+Math.imul($a,Nu)|0,Ro=Ro+Math.imul(zo,Gl)|0,So=So+Math.imul(zo,Nu)|0,Co=Co+Math.imul(Qo,cu)|0,Ro=Ro+Math.imul(Qo,Wu)|0,Ro=Ro+Math.imul(qo,cu)|0,So=So+Math.imul(qo,Wu)|0,Co=Co+Math.imul(To,yu)|0,Ro=Ro+Math.imul(To,Yu)|0,Ro=Ro+Math.imul(Vo,yu)|0,So=So+Math.imul(Vo,Yu)|0;var ju=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(ju>>>26)|0,ju&=67108863,Co=Math.imul(El,$l),Ro=Math.imul(El,Zl),Ro=Ro+Math.imul(Al,$l)|0,So=Math.imul(Al,Zl),Co=Co+Math.imul(_c,Gl)|0,Ro=Ro+Math.imul(_c,Nu)|0,Ro=Ro+Math.imul(Cl,Gl)|0,So=So+Math.imul(Cl,Nu)|0,Co=Co+Math.imul($a,cu)|0,Ro=Ro+Math.imul($a,Wu)|0,Ro=Ro+Math.imul(zo,cu)|0,So=So+Math.imul(zo,Wu)|0,Co=Co+Math.imul(Qo,yu)|0,Ro=Ro+Math.imul(Qo,Yu)|0,Ro=Ro+Math.imul(qo,yu)|0,So=So+Math.imul(qo,Yu)|0,Co=Co+Math.imul(To,Il)|0,Ro=Ro+Math.imul(To,Nl)|0,Ro=Ro+Math.imul(Vo,Il)|0,So=So+Math.imul(Vo,Nl)|0;var zu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(zu>>>26)|0,zu&=67108863,Co=Math.imul(Wl,$l),Ro=Math.imul(Wl,Zl),Ro=Ro+Math.imul(zl,$l)|0,So=Math.imul(zl,Zl),Co=Co+Math.imul(El,Gl)|0,Ro=Ro+Math.imul(El,Nu)|0,Ro=Ro+Math.imul(Al,Gl)|0,So=So+Math.imul(Al,Nu)|0,Co=Co+Math.imul(_c,cu)|0,Ro=Ro+Math.imul(_c,Wu)|0,Ro=Ro+Math.imul(Cl,cu)|0,So=So+Math.imul(Cl,Wu)|0,Co=Co+Math.imul($a,yu)|0,Ro=Ro+Math.imul($a,Yu)|0,Ro=Ro+Math.imul(zo,yu)|0,So=So+Math.imul(zo,Yu)|0,Co=Co+Math.imul(Qo,Il)|0,Ro=Ro+Math.imul(Qo,Nl)|0,Ro=Ro+Math.imul(qo,Il)|0,So=So+Math.imul(qo,Nl)|0,Co=Co+Math.imul(To,Bl)|0,Ro=Ro+Math.imul(To,fu)|0,Ro=Ro+Math.imul(Vo,Bl)|0,So=So+Math.imul(Vo,fu)|0;var Ku=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,Co=Math.imul(Ml,$l),Ro=Math.imul(Ml,Zl),Ro=Ro+Math.imul(ou,$l)|0,So=Math.imul(ou,Zl),Co=Co+Math.imul(Wl,Gl)|0,Ro=Ro+Math.imul(Wl,Nu)|0,Ro=Ro+Math.imul(zl,Gl)|0,So=So+Math.imul(zl,Nu)|0,Co=Co+Math.imul(El,cu)|0,Ro=Ro+Math.imul(El,Wu)|0,Ro=Ro+Math.imul(Al,cu)|0,So=So+Math.imul(Al,Wu)|0,Co=Co+Math.imul(_c,yu)|0,Ro=Ro+Math.imul(_c,Yu)|0,Ro=Ro+Math.imul(Cl,yu)|0,So=So+Math.imul(Cl,Yu)|0,Co=Co+Math.imul($a,Il)|0,Ro=Ro+Math.imul($a,Nl)|0,Ro=Ro+Math.imul(zo,Il)|0,So=So+Math.imul(zo,Nl)|0,Co=Co+Math.imul(Qo,Bl)|0,Ro=Ro+Math.imul(Qo,fu)|0,Ro=Ro+Math.imul(qo,Bl)|0,So=So+Math.imul(qo,fu)|0,Co=Co+Math.imul(To,Xl)|0,Ro=Ro+Math.imul(To,$u)|0,Ro=Ro+Math.imul(Vo,Xl)|0,So=So+Math.imul(Vo,$u)|0;var Hu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,Co=Math.imul(Ll,$l),Ro=Math.imul(Ll,Zl),Ro=Ro+Math.imul(uu,$l)|0,So=Math.imul(uu,Zl),Co=Co+Math.imul(Ml,Gl)|0,Ro=Ro+Math.imul(Ml,Nu)|0,Ro=Ro+Math.imul(ou,Gl)|0,So=So+Math.imul(ou,Nu)|0,Co=Co+Math.imul(Wl,cu)|0,Ro=Ro+Math.imul(Wl,Wu)|0,Ro=Ro+Math.imul(zl,cu)|0,So=So+Math.imul(zl,Wu)|0,Co=Co+Math.imul(El,yu)|0,Ro=Ro+Math.imul(El,Yu)|0,Ro=Ro+Math.imul(Al,yu)|0,So=So+Math.imul(Al,Yu)|0,Co=Co+Math.imul(_c,Il)|0,Ro=Ro+Math.imul(_c,Nl)|0,Ro=Ro+Math.imul(Cl,Il)|0,So=So+Math.imul(Cl,Nl)|0,Co=Co+Math.imul($a,Bl)|0,Ro=Ro+Math.imul($a,fu)|0,Ro=Ro+Math.imul(zo,Bl)|0,So=So+Math.imul(zo,fu)|0,Co=Co+Math.imul(Qo,Xl)|0,Ro=Ro+Math.imul(Qo,$u)|0,Ro=Ro+Math.imul(qo,Xl)|0,So=So+Math.imul(qo,$u)|0,Co=Co+Math.imul(To,_l)|0,Ro=Ro+Math.imul(To,Sl)|0,Ro=Ro+Math.imul(Vo,_l)|0,So=So+Math.imul(Vo,Sl)|0;var Gu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,Co=Math.imul(tu,$l),Ro=Math.imul(tu,Zl),Ro=Ro+Math.imul(ku,$l)|0,So=Math.imul(ku,Zl),Co=Co+Math.imul(Ll,Gl)|0,Ro=Ro+Math.imul(Ll,Nu)|0,Ro=Ro+Math.imul(uu,Gl)|0,So=So+Math.imul(uu,Nu)|0,Co=Co+Math.imul(Ml,cu)|0,Ro=Ro+Math.imul(Ml,Wu)|0,Ro=Ro+Math.imul(ou,cu)|0,So=So+Math.imul(ou,Wu)|0,Co=Co+Math.imul(Wl,yu)|0,Ro=Ro+Math.imul(Wl,Yu)|0,Ro=Ro+Math.imul(zl,yu)|0,So=So+Math.imul(zl,Yu)|0,Co=Co+Math.imul(El,Il)|0,Ro=Ro+Math.imul(El,Nl)|0,Ro=Ro+Math.imul(Al,Il)|0,So=So+Math.imul(Al,Nl)|0,Co=Co+Math.imul(_c,Bl)|0,Ro=Ro+Math.imul(_c,fu)|0,Ro=Ro+Math.imul(Cl,Bl)|0,So=So+Math.imul(Cl,fu)|0,Co=Co+Math.imul($a,Xl)|0,Ro=Ro+Math.imul($a,$u)|0,Ro=Ro+Math.imul(zo,Xl)|0,So=So+Math.imul(zo,$u)|0,Co=Co+Math.imul(Qo,_l)|0,Ro=Ro+Math.imul(Qo,Sl)|0,Ro=Ro+Math.imul(qo,_l)|0,So=So+Math.imul(qo,Sl)|0,Co=Co+Math.imul(To,xl)|0,Ro=Ro+Math.imul(To,Ql)|0,Ro=Ro+Math.imul(Vo,xl)|0,So=So+Math.imul(Vo,Ql)|0;var Zu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,Co=Math.imul(wl,$l),Ro=Math.imul(wl,Zl),Ro=Ro+Math.imul(Jo,$l)|0,So=Math.imul(Jo,Zl),Co=Co+Math.imul(tu,Gl)|0,Ro=Ro+Math.imul(tu,Nu)|0,Ro=Ro+Math.imul(ku,Gl)|0,So=So+Math.imul(ku,Nu)|0,Co=Co+Math.imul(Ll,cu)|0,Ro=Ro+Math.imul(Ll,Wu)|0,Ro=Ro+Math.imul(uu,cu)|0,So=So+Math.imul(uu,Wu)|0,Co=Co+Math.imul(Ml,yu)|0,Ro=Ro+Math.imul(Ml,Yu)|0,Ro=Ro+Math.imul(ou,yu)|0,So=So+Math.imul(ou,Yu)|0,Co=Co+Math.imul(Wl,Il)|0,Ro=Ro+Math.imul(Wl,Nl)|0,Ro=Ro+Math.imul(zl,Il)|0,So=So+Math.imul(zl,Nl)|0,Co=Co+Math.imul(El,Bl)|0,Ro=Ro+Math.imul(El,fu)|0,Ro=Ro+Math.imul(Al,Bl)|0,So=So+Math.imul(Al,fu)|0,Co=Co+Math.imul(_c,Xl)|0,Ro=Ro+Math.imul(_c,$u)|0,Ro=Ro+Math.imul(Cl,Xl)|0,So=So+Math.imul(Cl,$u)|0,Co=Co+Math.imul($a,_l)|0,Ro=Ro+Math.imul($a,Sl)|0,Ro=Ro+Math.imul(zo,_l)|0,So=So+Math.imul(zo,Sl)|0,Co=Co+Math.imul(Qo,xl)|0,Ro=Ro+Math.imul(Qo,Ql)|0,Ro=Ro+Math.imul(qo,xl)|0,So=So+Math.imul(qo,Ql)|0,Co=Co+Math.imul(To,Jl)|0,Ro=Ro+Math.imul(To,xu)|0,Ro=Ro+Math.imul(Vo,Jl)|0,So=So+Math.imul(Vo,xu)|0;var Vu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,Co=Math.imul(wl,Gl),Ro=Math.imul(wl,Nu),Ro=Ro+Math.imul(Jo,Gl)|0,So=Math.imul(Jo,Nu),Co=Co+Math.imul(tu,cu)|0,Ro=Ro+Math.imul(tu,Wu)|0,Ro=Ro+Math.imul(ku,cu)|0,So=So+Math.imul(ku,Wu)|0,Co=Co+Math.imul(Ll,yu)|0,Ro=Ro+Math.imul(Ll,Yu)|0,Ro=Ro+Math.imul(uu,yu)|0,So=So+Math.imul(uu,Yu)|0,Co=Co+Math.imul(Ml,Il)|0,Ro=Ro+Math.imul(Ml,Nl)|0,Ro=Ro+Math.imul(ou,Il)|0,So=So+Math.imul(ou,Nl)|0,Co=Co+Math.imul(Wl,Bl)|0,Ro=Ro+Math.imul(Wl,fu)|0,Ro=Ro+Math.imul(zl,Bl)|0,So=So+Math.imul(zl,fu)|0,Co=Co+Math.imul(El,Xl)|0,Ro=Ro+Math.imul(El,$u)|0,Ro=Ro+Math.imul(Al,Xl)|0,So=So+Math.imul(Al,$u)|0,Co=Co+Math.imul(_c,_l)|0,Ro=Ro+Math.imul(_c,Sl)|0,Ro=Ro+Math.imul(Cl,_l)|0,So=So+Math.imul(Cl,Sl)|0,Co=Co+Math.imul($a,xl)|0,Ro=Ro+Math.imul($a,Ql)|0,Ro=Ro+Math.imul(zo,xl)|0,So=So+Math.imul(zo,Ql)|0,Co=Co+Math.imul(Qo,Jl)|0,Ro=Ro+Math.imul(Qo,xu)|0,Ro=Ro+Math.imul(qo,Jl)|0,So=So+Math.imul(qo,xu)|0;var Ju=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,Co=Math.imul(wl,cu),Ro=Math.imul(wl,Wu),Ro=Ro+Math.imul(Jo,cu)|0,So=Math.imul(Jo,Wu),Co=Co+Math.imul(tu,yu)|0,Ro=Ro+Math.imul(tu,Yu)|0,Ro=Ro+Math.imul(ku,yu)|0,So=So+Math.imul(ku,Yu)|0,Co=Co+Math.imul(Ll,Il)|0,Ro=Ro+Math.imul(Ll,Nl)|0,Ro=Ro+Math.imul(uu,Il)|0,So=So+Math.imul(uu,Nl)|0,Co=Co+Math.imul(Ml,Bl)|0,Ro=Ro+Math.imul(Ml,fu)|0,Ro=Ro+Math.imul(ou,Bl)|0,So=So+Math.imul(ou,fu)|0,Co=Co+Math.imul(Wl,Xl)|0,Ro=Ro+Math.imul(Wl,$u)|0,Ro=Ro+Math.imul(zl,Xl)|0,So=So+Math.imul(zl,$u)|0,Co=Co+Math.imul(El,_l)|0,Ro=Ro+Math.imul(El,Sl)|0,Ro=Ro+Math.imul(Al,_l)|0,So=So+Math.imul(Al,Sl)|0,Co=Co+Math.imul(_c,xl)|0,Ro=Ro+Math.imul(_c,Ql)|0,Ro=Ro+Math.imul(Cl,xl)|0,So=So+Math.imul(Cl,Ql)|0,Co=Co+Math.imul($a,Jl)|0,Ro=Ro+Math.imul($a,xu)|0,Ro=Ro+Math.imul(zo,Jl)|0,So=So+Math.imul(zo,xu)|0;var Uu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,Co=Math.imul(wl,yu),Ro=Math.imul(wl,Yu),Ro=Ro+Math.imul(Jo,yu)|0,So=Math.imul(Jo,Yu),Co=Co+Math.imul(tu,Il)|0,Ro=Ro+Math.imul(tu,Nl)|0,Ro=Ro+Math.imul(ku,Il)|0,So=So+Math.imul(ku,Nl)|0,Co=Co+Math.imul(Ll,Bl)|0,Ro=Ro+Math.imul(Ll,fu)|0,Ro=Ro+Math.imul(uu,Bl)|0,So=So+Math.imul(uu,fu)|0,Co=Co+Math.imul(Ml,Xl)|0,Ro=Ro+Math.imul(Ml,$u)|0,Ro=Ro+Math.imul(ou,Xl)|0,So=So+Math.imul(ou,$u)|0,Co=Co+Math.imul(Wl,_l)|0,Ro=Ro+Math.imul(Wl,Sl)|0,Ro=Ro+Math.imul(zl,_l)|0,So=So+Math.imul(zl,Sl)|0,Co=Co+Math.imul(El,xl)|0,Ro=Ro+Math.imul(El,Ql)|0,Ro=Ro+Math.imul(Al,xl)|0,So=So+Math.imul(Al,Ql)|0,Co=Co+Math.imul(_c,Jl)|0,Ro=Ro+Math.imul(_c,xu)|0,Ro=Ro+Math.imul(Cl,Jl)|0,So=So+Math.imul(Cl,xu)|0;var qu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(qu>>>26)|0,qu&=67108863,Co=Math.imul(wl,Il),Ro=Math.imul(wl,Nl),Ro=Ro+Math.imul(Jo,Il)|0,So=Math.imul(Jo,Nl),Co=Co+Math.imul(tu,Bl)|0,Ro=Ro+Math.imul(tu,fu)|0,Ro=Ro+Math.imul(ku,Bl)|0,So=So+Math.imul(ku,fu)|0,Co=Co+Math.imul(Ll,Xl)|0,Ro=Ro+Math.imul(Ll,$u)|0,Ro=Ro+Math.imul(uu,Xl)|0,So=So+Math.imul(uu,$u)|0,Co=Co+Math.imul(Ml,_l)|0,Ro=Ro+Math.imul(Ml,Sl)|0,Ro=Ro+Math.imul(ou,_l)|0,So=So+Math.imul(ou,Sl)|0,Co=Co+Math.imul(Wl,xl)|0,Ro=Ro+Math.imul(Wl,Ql)|0,Ro=Ro+Math.imul(zl,xl)|0,So=So+Math.imul(zl,Ql)|0,Co=Co+Math.imul(El,Jl)|0,Ro=Ro+Math.imul(El,xu)|0,Ro=Ro+Math.imul(Al,Jl)|0,So=So+Math.imul(Al,xu)|0;var Mu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,Co=Math.imul(wl,Bl),Ro=Math.imul(wl,fu),Ro=Ro+Math.imul(Jo,Bl)|0,So=Math.imul(Jo,fu),Co=Co+Math.imul(tu,Xl)|0,Ro=Ro+Math.imul(tu,$u)|0,Ro=Ro+Math.imul(ku,Xl)|0,So=So+Math.imul(ku,$u)|0,Co=Co+Math.imul(Ll,_l)|0,Ro=Ro+Math.imul(Ll,Sl)|0,Ro=Ro+Math.imul(uu,_l)|0,So=So+Math.imul(uu,Sl)|0,Co=Co+Math.imul(Ml,xl)|0,Ro=Ro+Math.imul(Ml,Ql)|0,Ro=Ro+Math.imul(ou,xl)|0,So=So+Math.imul(ou,Ql)|0,Co=Co+Math.imul(Wl,Jl)|0,Ro=Ro+Math.imul(Wl,xu)|0,Ro=Ro+Math.imul(zl,Jl)|0,So=So+Math.imul(zl,xu)|0;var Bu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,Co=Math.imul(wl,Xl),Ro=Math.imul(wl,$u),Ro=Ro+Math.imul(Jo,Xl)|0,So=Math.imul(Jo,$u),Co=Co+Math.imul(tu,_l)|0,Ro=Ro+Math.imul(tu,Sl)|0,Ro=Ro+Math.imul(ku,_l)|0,So=So+Math.imul(ku,Sl)|0,Co=Co+Math.imul(Ll,xl)|0,Ro=Ro+Math.imul(Ll,Ql)|0,Ro=Ro+Math.imul(uu,xl)|0,So=So+Math.imul(uu,Ql)|0,Co=Co+Math.imul(Ml,Jl)|0,Ro=Ro+Math.imul(Ml,xu)|0,Ro=Ro+Math.imul(ou,Jl)|0,So=So+Math.imul(ou,xu)|0;var Au=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Au>>>26)|0,Au&=67108863,Co=Math.imul(wl,_l),Ro=Math.imul(wl,Sl),Ro=Ro+Math.imul(Jo,_l)|0,So=Math.imul(Jo,Sl),Co=Co+Math.imul(tu,xl)|0,Ro=Ro+Math.imul(tu,Ql)|0,Ro=Ro+Math.imul(ku,xl)|0,So=So+Math.imul(ku,Ql)|0,Co=Co+Math.imul(Ll,Jl)|0,Ro=Ro+Math.imul(Ll,xu)|0,Ro=Ro+Math.imul(uu,Jl)|0,So=So+Math.imul(uu,xu)|0;var Du=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(Du>>>26)|0,Du&=67108863,Co=Math.imul(wl,xl),Ro=Math.imul(wl,Ql),Ro=Ro+Math.imul(Jo,xl)|0,So=Math.imul(Jo,Ql),Co=Co+Math.imul(tu,Jl)|0,Ro=Ro+Math.imul(tu,xu)|0,Ro=Ro+Math.imul(ku,Jl)|0,So=So+Math.imul(ku,xu)|0;var wu=($o+Co|0)+((Ro&8191)<<13)|0;$o=(So+(Ro>>>13)|0)+(wu>>>26)|0,wu&=67108863,Co=Math.imul(wl,Jl),Ro=Math.imul(wl,xu),Ro=Ro+Math.imul(Jo,Jl)|0,So=Math.imul(Jo,xu);var vu=($o+Co|0)+((Ro&8191)<<13)|0;return $o=(So+(Ro>>>13)|0)+(vu>>>26)|0,vu&=67108863,_o[0]=lu,_o[1]=su,_o[2]=Xu,_o[3]=ju,_o[4]=zu,_o[5]=Ku,_o[6]=Hu,_o[7]=Gu,_o[8]=Zu,_o[9]=Vu,_o[10]=Ju,_o[11]=Uu,_o[12]=qu,_o[13]=Mu,_o[14]=Bu,_o[15]=Au,_o[16]=Du,_o[17]=wu,_o[18]=vu,$o!==0&&(_o[19]=$o,uo.length++),uo};Math.imul||(vo=yo);function wo(Lo,Bo,xo){xo.negative=Bo.negative^Lo.negative,xo.length=Lo.length+Bo.length;for(var uo=0,po=0,bo=0;bo>>26)|0,po+=_o>>>26,_o&=67108863}xo.words[bo]=$o,uo=_o,_o=po}return uo!==0?xo.words[bo]=uo:xo.length--,xo.strip()}function Eo(Lo,Bo,xo){var uo=new ko;return uo.mulp(Lo,Bo,xo)}io.prototype.mulTo=function(Bo,xo){var uo,po=this.length+Bo.length;return this.length===10&&Bo.length===10?uo=vo(this,Bo,xo):po<63?uo=yo(this,Bo,xo):po<1024?uo=wo(this,Bo,xo):uo=Eo(this,Bo,xo),uo};function ko(Lo,Bo){this.x=Lo,this.y=Bo}ko.prototype.makeRBT=function(Bo){for(var xo=new Array(Bo),uo=io.prototype._countBits(Bo)-1,po=0;po>=1;return po},ko.prototype.permute=function(Bo,xo,uo,po,bo,_o){for(var $o=0;$o<_o;$o++)po[$o]=xo[Bo[$o]],bo[$o]=uo[Bo[$o]]},ko.prototype.transform=function(Bo,xo,uo,po,bo,_o){this.permute(_o,Bo,xo,uo,po,bo);for(var $o=1;$o>>1)bo++;return 1<>>13,uo[2*_o+1]=bo&8191,bo=bo>>>13;for(_o=2*xo;_o>=26,xo+=po/67108864|0,xo+=bo>>>26,this.words[uo]=bo&67108863}return xo!==0&&(this.words[uo]=xo,this.length++),this},io.prototype.muln=function(Bo){return this.clone().imuln(Bo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(Bo){var xo=go(Bo);if(xo.length===0)return new io(1);for(var uo=this,po=0;po=0);var xo=Bo%26,uo=(Bo-xo)/26,po=67108863>>>26-xo<<26-xo,bo;if(xo!==0){var _o=0;for(bo=0;bo>>26-xo}_o&&(this.words[bo]=_o,this.length++)}if(uo!==0){for(bo=this.length-1;bo>=0;bo--)this.words[bo+uo]=this.words[bo];for(bo=0;bo=0);var po;xo?po=(xo-xo%26)/26:po=0;var bo=Bo%26,_o=Math.min((Bo-bo)/26,this.length),$o=67108863^67108863>>>bo<_o)for(this.length-=_o,Ro=0;Ro=0&&(So!==0||Ro>=po);Ro--){var mo=this.words[Ro]|0;this.words[Ro]=So<<26-bo|mo>>>bo,So=mo&$o}return Co&&So!==0&&(Co.words[Co.length++]=So),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(Bo,xo,uo){return ro(this.negative===0),this.iushrn(Bo,xo,uo)},io.prototype.shln=function(Bo){return this.clone().ishln(Bo)},io.prototype.ushln=function(Bo){return this.clone().iushln(Bo)},io.prototype.shrn=function(Bo){return this.clone().ishrn(Bo)},io.prototype.ushrn=function(Bo){return this.clone().iushrn(Bo)},io.prototype.testn=function(Bo){ro(typeof Bo=="number"&&Bo>=0);var xo=Bo%26,uo=(Bo-xo)/26,po=1<=0);var xo=Bo%26,uo=(Bo-xo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=uo)return this;if(xo!==0&&uo++,this.length=Math.min(uo,this.length),xo!==0){var po=67108863^67108863>>>xo<=67108864;xo++)this.words[xo]-=67108864,xo===this.length-1?this.words[xo+1]=1:this.words[xo+1]++;return this.length=Math.max(this.length,xo+1),this},io.prototype.isubn=function(Bo){if(ro(typeof Bo=="number"),ro(Bo<67108864),Bo<0)return this.iaddn(-Bo);if(this.negative!==0)return this.negative=0,this.iaddn(Bo),this.negative=1,this;if(this.words[0]-=Bo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var xo=0;xo>26)-(Co/67108864|0),this.words[bo+uo]=_o&67108863}for(;bo>26,this.words[bo+uo]=_o&67108863;if($o===0)return this.strip();for(ro($o===-1),$o=0,bo=0;bo>26,this.words[bo]=_o&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(Bo,xo){var uo=this.length-Bo.length,po=this.clone(),bo=Bo,_o=bo.words[bo.length-1]|0,$o=this._countBits(_o);uo=26-$o,uo!==0&&(bo=bo.ushln(uo),po.iushln(uo),_o=bo.words[bo.length-1]|0);var Co=po.length-bo.length,Ro;if(xo!=="mod"){Ro=new io(null),Ro.length=Co+1,Ro.words=new Array(Ro.length);for(var So=0;So=0;To--){var Vo=(po.words[bo.length+To]|0)*67108864+(po.words[bo.length+To-1]|0);for(Vo=Math.min(Vo/_o|0,67108863),po._ishlnsubmul(bo,Vo,To);po.negative!==0;)Vo--,po.negative=0,po._ishlnsubmul(bo,1,To),po.isZero()||(po.negative^=1);Ro&&(Ro.words[To]=Vo)}return Ro&&Ro.strip(),po.strip(),xo!=="div"&&uo!==0&&po.iushrn(uo),{div:Ro||null,mod:po}},io.prototype.divmod=function(Bo,xo,uo){if(ro(!Bo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var po,bo,_o;return this.negative!==0&&Bo.negative===0?(_o=this.neg().divmod(Bo,xo),xo!=="mod"&&(po=_o.div.neg()),xo!=="div"&&(bo=_o.mod.neg(),uo&&bo.negative!==0&&bo.iadd(Bo)),{div:po,mod:bo}):this.negative===0&&Bo.negative!==0?(_o=this.divmod(Bo.neg(),xo),xo!=="mod"&&(po=_o.div.neg()),{div:po,mod:_o.mod}):this.negative&Bo.negative?(_o=this.neg().divmod(Bo.neg(),xo),xo!=="div"&&(bo=_o.mod.neg(),uo&&bo.negative!==0&&bo.isub(Bo)),{div:_o.div,mod:bo}):Bo.length>this.length||this.cmp(Bo)<0?{div:new io(0),mod:this}:Bo.length===1?xo==="div"?{div:this.divn(Bo.words[0]),mod:null}:xo==="mod"?{div:null,mod:new io(this.modn(Bo.words[0]))}:{div:this.divn(Bo.words[0]),mod:new io(this.modn(Bo.words[0]))}:this._wordDiv(Bo,xo)},io.prototype.div=function(Bo){return this.divmod(Bo,"div",!1).div},io.prototype.mod=function(Bo){return this.divmod(Bo,"mod",!1).mod},io.prototype.umod=function(Bo){return this.divmod(Bo,"mod",!0).mod},io.prototype.divRound=function(Bo){var xo=this.divmod(Bo);if(xo.mod.isZero())return xo.div;var uo=xo.div.negative!==0?xo.mod.isub(Bo):xo.mod,po=Bo.ushrn(1),bo=Bo.andln(1),_o=uo.cmp(po);return _o<0||bo===1&&_o===0?xo.div:xo.div.negative!==0?xo.div.isubn(1):xo.div.iaddn(1)},io.prototype.modn=function(Bo){ro(Bo<=67108863);for(var xo=(1<<26)%Bo,uo=0,po=this.length-1;po>=0;po--)uo=(xo*uo+(this.words[po]|0))%Bo;return uo},io.prototype.idivn=function(Bo){ro(Bo<=67108863);for(var xo=0,uo=this.length-1;uo>=0;uo--){var po=(this.words[uo]|0)+xo*67108864;this.words[uo]=po/Bo|0,xo=po%Bo}return this.strip()},io.prototype.divn=function(Bo){return this.clone().idivn(Bo)},io.prototype.egcd=function(Bo){ro(Bo.negative===0),ro(!Bo.isZero());var xo=this,uo=Bo.clone();xo.negative!==0?xo=xo.umod(Bo):xo=xo.clone();for(var po=new io(1),bo=new io(0),_o=new io(0),$o=new io(1),Co=0;xo.isEven()&&uo.isEven();)xo.iushrn(1),uo.iushrn(1),++Co;for(var Ro=uo.clone(),So=xo.clone();!xo.isZero();){for(var mo=0,To=1;!(xo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(xo.iushrn(mo);mo-- >0;)(po.isOdd()||bo.isOdd())&&(po.iadd(Ro),bo.isub(So)),po.iushrn(1),bo.iushrn(1);for(var Vo=0,Zo=1;!(uo.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(uo.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(Ro),$o.isub(So)),_o.iushrn(1),$o.iushrn(1);xo.cmp(uo)>=0?(xo.isub(uo),po.isub(_o),bo.isub($o)):(uo.isub(xo),_o.isub(po),$o.isub(bo))}return{a:_o,b:$o,gcd:uo.iushln(Co)}},io.prototype._invmp=function(Bo){ro(Bo.negative===0),ro(!Bo.isZero());var xo=this,uo=Bo.clone();xo.negative!==0?xo=xo.umod(Bo):xo=xo.clone();for(var po=new io(1),bo=new io(0),_o=uo.clone();xo.cmpn(1)>0&&uo.cmpn(1)>0;){for(var $o=0,Co=1;!(xo.words[0]&Co)&&$o<26;++$o,Co<<=1);if($o>0)for(xo.iushrn($o);$o-- >0;)po.isOdd()&&po.iadd(_o),po.iushrn(1);for(var Ro=0,So=1;!(uo.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(uo.iushrn(Ro);Ro-- >0;)bo.isOdd()&&bo.iadd(_o),bo.iushrn(1);xo.cmp(uo)>=0?(xo.isub(uo),po.isub(bo)):(uo.isub(xo),bo.isub(po))}var mo;return xo.cmpn(1)===0?mo=po:mo=bo,mo.cmpn(0)<0&&mo.iadd(Bo),mo},io.prototype.gcd=function(Bo){if(this.isZero())return Bo.abs();if(Bo.isZero())return this.abs();var xo=this.clone(),uo=Bo.clone();xo.negative=0,uo.negative=0;for(var po=0;xo.isEven()&&uo.isEven();po++)xo.iushrn(1),uo.iushrn(1);do{for(;xo.isEven();)xo.iushrn(1);for(;uo.isEven();)uo.iushrn(1);var bo=xo.cmp(uo);if(bo<0){var _o=xo;xo=uo,uo=_o}else if(bo===0||uo.cmpn(1)===0)break;xo.isub(uo)}while(!0);return uo.iushln(po)},io.prototype.invm=function(Bo){return this.egcd(Bo).a.umod(Bo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(Bo){return this.words[0]&Bo},io.prototype.bincn=function(Bo){ro(typeof Bo=="number");var xo=Bo%26,uo=(Bo-xo)/26,po=1<>>26,$o&=67108863,this.words[_o]=$o}return bo!==0&&(this.words[_o]=bo,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(Bo){var xo=Bo<0;if(this.negative!==0&&!xo)return-1;if(this.negative===0&&xo)return 1;this.strip();var uo;if(this.length>1)uo=1;else{xo&&(Bo=-Bo),ro(Bo<=67108863,"Number is too big");var po=this.words[0]|0;uo=po===Bo?0:poBo.length)return 1;if(this.length=0;uo--){var po=this.words[uo]|0,bo=Bo.words[uo]|0;if(po!==bo){pobo&&(xo=1);break}}return xo},io.prototype.gtn=function(Bo){return this.cmpn(Bo)===1},io.prototype.gt=function(Bo){return this.cmp(Bo)===1},io.prototype.gten=function(Bo){return this.cmpn(Bo)>=0},io.prototype.gte=function(Bo){return this.cmp(Bo)>=0},io.prototype.ltn=function(Bo){return this.cmpn(Bo)===-1},io.prototype.lt=function(Bo){return this.cmp(Bo)===-1},io.prototype.lten=function(Bo){return this.cmpn(Bo)<=0},io.prototype.lte=function(Bo){return this.cmp(Bo)<=0},io.prototype.eqn=function(Bo){return this.cmpn(Bo)===0},io.prototype.eq=function(Bo){return this.cmp(Bo)===0},io.red=function(Bo){return new Fo(Bo)},io.prototype.toRed=function(Bo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),Bo.convertTo(this)._forceRed(Bo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(Bo){return this.red=Bo,this},io.prototype.forceRed=function(Bo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(Bo)},io.prototype.redAdd=function(Bo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,Bo)},io.prototype.redIAdd=function(Bo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Bo)},io.prototype.redSub=function(Bo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,Bo)},io.prototype.redISub=function(Bo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,Bo)},io.prototype.redShl=function(Bo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,Bo)},io.prototype.redMul=function(Bo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,Bo),this.red.mul(this,Bo)},io.prototype.redIMul=function(Bo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,Bo),this.red.imul(this,Bo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(Bo){return ro(this.red&&!Bo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Bo)};var Ao={k256:null,p224:null,p192:null,p25519:null};function Po(Lo,Bo){this.name=Lo,this.p=new io(Bo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Po.prototype._tmp=function(){var Bo=new io(null);return Bo.words=new Array(Math.ceil(this.n/13)),Bo},Po.prototype.ireduce=function(Bo){var xo=Bo,uo;do this.split(xo,this.tmp),xo=this.imulK(xo),xo=xo.iadd(this.tmp),uo=xo.bitLength();while(uo>this.n);var po=uo0?xo.isub(this.p):xo.strip!==void 0?xo.strip():xo._strip(),xo},Po.prototype.split=function(Bo,xo){Bo.iushrn(this.n,0,xo)},Po.prototype.imulK=function(Bo){return Bo.imul(this.k)};function jo(){Po.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Po),jo.prototype.split=function(Bo,xo){for(var uo=4194303,po=Math.min(Bo.length,9),bo=0;bo>>22,_o=$o}_o>>>=22,Bo.words[bo-10]=_o,_o===0&&Bo.length>10?Bo.length-=10:Bo.length-=9},jo.prototype.imulK=function(Bo){Bo.words[Bo.length]=0,Bo.words[Bo.length+1]=0,Bo.length+=2;for(var xo=0,uo=0;uo>>=26,Bo.words[uo]=bo,xo=po}return xo!==0&&(Bo.words[Bo.length++]=xo),Bo},io._prime=function(Bo){if(Ao[Bo])return Ao[Bo];var xo;if(Bo==="k256")xo=new jo;else if(Bo==="p224")xo=new Mo;else if(Bo==="p192")xo=new No;else if(Bo==="p25519")xo=new Do;else throw new Error("Unknown prime "+Bo);return Ao[Bo]=xo,xo};function Fo(Lo){if(typeof Lo=="string"){var Bo=io._prime(Lo);this.m=Bo.p,this.prime=Bo}else ro(Lo.gtn(1),"modulus must be greater than 1"),this.m=Lo,this.prime=null}Fo.prototype._verify1=function(Bo){ro(Bo.negative===0,"red works only with positives"),ro(Bo.red,"red works only with red numbers")},Fo.prototype._verify2=function(Bo,xo){ro((Bo.negative|xo.negative)===0,"red works only with positives"),ro(Bo.red&&Bo.red===xo.red,"red works only with red numbers")},Fo.prototype.imod=function(Bo){return this.prime?this.prime.ireduce(Bo)._forceRed(this):Bo.umod(this.m)._forceRed(this)},Fo.prototype.neg=function(Bo){return Bo.isZero()?Bo.clone():this.m.sub(Bo)._forceRed(this)},Fo.prototype.add=function(Bo,xo){this._verify2(Bo,xo);var uo=Bo.add(xo);return uo.cmp(this.m)>=0&&uo.isub(this.m),uo._forceRed(this)},Fo.prototype.iadd=function(Bo,xo){this._verify2(Bo,xo);var uo=Bo.iadd(xo);return uo.cmp(this.m)>=0&&uo.isub(this.m),uo},Fo.prototype.sub=function(Bo,xo){this._verify2(Bo,xo);var uo=Bo.sub(xo);return uo.cmpn(0)<0&&uo.iadd(this.m),uo._forceRed(this)},Fo.prototype.isub=function(Bo,xo){this._verify2(Bo,xo);var uo=Bo.isub(xo);return uo.cmpn(0)<0&&uo.iadd(this.m),uo},Fo.prototype.shl=function(Bo,xo){return this._verify1(Bo),this.imod(Bo.ushln(xo))},Fo.prototype.imul=function(Bo,xo){return this._verify2(Bo,xo),this.imod(Bo.imul(xo))},Fo.prototype.mul=function(Bo,xo){return this._verify2(Bo,xo),this.imod(Bo.mul(xo))},Fo.prototype.isqr=function(Bo){return this.imul(Bo,Bo.clone())},Fo.prototype.sqr=function(Bo){return this.mul(Bo,Bo)},Fo.prototype.sqrt=function(Bo){if(Bo.isZero())return Bo.clone();var xo=this.m.andln(3);if(ro(xo%2===1),xo===3){var uo=this.m.add(new io(1)).iushrn(2);return this.pow(Bo,uo)}for(var po=this.m.subn(1),bo=0;!po.isZero()&&po.andln(1)===0;)bo++,po.iushrn(1);ro(!po.isZero());var _o=new io(1).toRed(this),$o=_o.redNeg(),Co=this.m.subn(1).iushrn(1),Ro=this.m.bitLength();for(Ro=new io(2*Ro*Ro).toRed(this);this.pow(Ro,Co).cmp($o)!==0;)Ro.redIAdd($o);for(var So=this.pow(Ro,po),mo=this.pow(Bo,po.addn(1).iushrn(1)),To=this.pow(Bo,po),Vo=bo;To.cmp(_o)!==0;){for(var Zo=To,Qo=0;Zo.cmp(_o)!==0;Qo++)Zo=Zo.redSqr();ro(Qo=0;bo--){for(var So=xo.words[bo],mo=Ro-1;mo>=0;mo--){var To=So>>mo&1;if(_o!==po[0]&&(_o=this.sqr(_o)),To===0&&$o===0){Co=0;continue}$o<<=1,$o|=To,Co++,!(Co!==uo&&(bo!==0||mo!==0))&&(_o=this.mul(_o,po[$o]),Co=0,$o=0)}Ro=26}return _o},Fo.prototype.convertTo=function(Bo){var xo=Bo.umod(this.m);return xo===Bo?xo.clone():xo},Fo.prototype.convertFrom=function(Bo){var xo=Bo.clone();return xo.red=null,xo},io.mont=function(Bo){return new Xo(Bo)};function Xo(Lo){Fo.call(this,Lo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Xo,Fo),Xo.prototype.convertTo=function(Bo){return this.imod(Bo.ushln(this.shift))},Xo.prototype.convertFrom=function(Bo){var xo=this.imod(Bo.mul(this.rinv));return xo.red=null,xo},Xo.prototype.imul=function(Bo,xo){if(Bo.isZero()||xo.isZero())return Bo.words[0]=0,Bo.length=1,Bo;var uo=Bo.imul(xo),po=uo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),bo=uo.isub(po).iushrn(this.shift),_o=bo;return bo.cmp(this.m)>=0?_o=bo.isub(this.m):bo.cmpn(0)<0&&(_o=bo.iadd(this.m)),_o._forceRed(this)},Xo.prototype.mul=function(Bo,xo){if(Bo.isZero()||xo.isZero())return new io(0)._forceRed(this);var uo=Bo.mul(xo),po=uo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),bo=uo.isub(po).iushrn(this.shift),_o=bo;return bo.cmp(this.m)>=0?_o=bo.isub(this.m):bo.cmpn(0)<0&&(_o=bo.iadd(this.m)),_o._forceRed(this)},Xo.prototype.invm=function(Bo){var xo=this.imod(Bo._invmp(this.m).mul(this.r2));return xo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$7)),bn$7.exports}var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var Xr;brorand.exports=function(no){return Xr||(Xr=new eo(null)),Xr.generate(no)};function eo(ro){this.rand=ro}if(brorand.exports.Rand=eo,eo.prototype.generate=function(no){return this._rand(no)},eo.prototype._rand=function(no){if(this.rand.getBytes)return this.rand.getBytes(no);for(var io=new Uint8Array(no),oo=0;oo=0);return ao},to.prototype._randrange=function(no,io){var oo=io.sub(no);return no.add(this._randbelow(oo))},to.prototype.test=function(no,io,oo){var ao=no.bitLength(),so=Xr.mont(no),co=new Xr(1).toRed(so);io||(io=Math.max(1,ao/48|0));for(var lo=no.subn(1),fo=0;!lo.testn(fo);fo++);for(var ho=no.shrn(fo),go=lo.toRed(so),yo=!0;io>0;io--){var vo=this._randrange(new Xr(2),lo);oo&&oo(vo);var wo=vo.toRed(so).redPow(ho);if(!(wo.cmp(co)===0||wo.cmp(go)===0)){for(var Eo=1;Eo0;io--){var go=this._randrange(new Xr(2),co),yo=no.gcd(go);if(yo.cmpn(1)!==0)return yo;var vo=go.toRed(ao).redPow(fo);if(!(vo.cmp(so)===0||vo.cmp(ho)===0)){for(var wo=1;woEo;)Ao.ishrn(1);if(Ao.isEven()&&Ao.iadd(io),Ao.testn(1)||Ao.iadd(oo),ko.cmp(oo)){if(!ko.cmp(ao))for(;Ao.mod(so).cmp(co);)Ao.iadd(fo)}else for(;Ao.mod(to).cmp(lo);)Ao.iadd(fo);if(Po=Ao.shrn(1),yo(Po)&&yo(Ao)&&vo(Po)&&vo(Ao)&&no.test(Po)&&no.test(Ao))return Ao}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var Xr=requireBn$2(),eo=requireMr(),to=new eo,ro=new Xr(24),no=new Xr(11),io=new Xr(10),oo=new Xr(3),ao=new Xr(7),so=requireGeneratePrime(),co=requireBrowser$b();dh=yo;function lo(wo,Eo){return Eo=Eo||"utf8",Buffer$3.isBuffer(wo)||(wo=new Buffer$3(wo,Eo)),this._pub=new Xr(wo),this}function fo(wo,Eo){return Eo=Eo||"utf8",Buffer$3.isBuffer(wo)||(wo=new Buffer$3(wo,Eo)),this._priv=new Xr(wo),this}var ho={};function go(wo,Eo){var ko=Eo.toString("hex"),Ao=[ko,wo.toString(16)].join("_");if(Ao in ho)return ho[Ao];var Po=0;if(wo.isEven()||!so.simpleSieve||!so.fermatTest(wo)||!to.test(wo))return Po+=1,ko==="02"||ko==="05"?Po+=8:Po+=4,ho[Ao]=Po,Po;to.test(wo.shrn(1))||(Po+=2);var jo;switch(ko){case"02":wo.mod(ro).cmp(no)&&(Po+=8);break;case"05":jo=wo.mod(io),jo.cmp(oo)&&jo.cmp(ao)&&(Po+=8);break;default:Po+=4}return ho[Ao]=Po,Po}function yo(wo,Eo,ko){this.setGenerator(Eo),this.__prime=new Xr(wo),this._prime=Xr.mont(this.__prime),this._primeLen=wo.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,ko?(this.setPublicKey=lo,this.setPrivateKey=fo):this._primeCode=8}Object.defineProperty(yo.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=go(this.__prime,this.__gen)),this._primeCode}}),yo.prototype.generateKeys=function(){return this._priv||(this._priv=new Xr(co(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},yo.prototype.computeSecret=function(wo){wo=new Xr(wo),wo=wo.toRed(this._prime);var Eo=wo.redPow(this._priv).fromRed(),ko=new Buffer$3(Eo.toArray()),Ao=this.getPrime();if(ko.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:Xr}:processNextickArgs.exports=process$1$1;function Xr(eo,to,ro,no){if(typeof eo!="function")throw new TypeError('"callback" argument must be a function');var io=arguments.length,oo,ao;switch(io){case 0:case 1:return process$1$1.nextTick(eo);case 2:return process$1$1.nextTick(function(){eo.call(null,to)});case 3:return process$1$1.nextTick(function(){eo.call(null,to,ro)});case 4:return process$1$1.nextTick(function(){eo.call(null,to,ro,no)});default:for(oo=new Array(io-1),ao=0;ao"u"}util$7.isPrimitive=go,util$7.isBuffer=require$$0$9.Buffer.isBuffer;function yo(vo){return Object.prototype.toString.call(vo)}return util$7}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(Xr){function eo(io,oo){if(!(io instanceof oo))throw new TypeError("Cannot call a class as a function")}var to=requireSafeBuffer().Buffer,ro=requireUtil$1();function no(io,oo,ao){io.copy(oo,ao)}Xr.exports=function(){function io(){eo(this,io),this.head=null,this.tail=null,this.length=0}return io.prototype.push=function(ao){var so={data:ao,next:null};this.length>0?this.tail.next=so:this.head=so,this.tail=so,++this.length},io.prototype.unshift=function(ao){var so={data:ao,next:this.head};this.length===0&&(this.tail=so),this.head=so,++this.length},io.prototype.shift=function(){if(this.length!==0){var ao=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ao}},io.prototype.clear=function(){this.head=this.tail=null,this.length=0},io.prototype.join=function(ao){if(this.length===0)return"";for(var so=this.head,co=""+so.data;so=so.next;)co+=ao+so.data;return co},io.prototype.concat=function(ao){if(this.length===0)return to.alloc(0);for(var so=to.allocUnsafe(ao>>>0),co=this.head,lo=0;co;)no(co.data,so,lo),lo+=co.data.length,co=co.next;return so},io}(),ro&&ro.inspect&&ro.inspect.custom&&(Xr.exports.prototype[ro.inspect.custom]=function(){var io=ro.inspect({length:this.length});return this.constructor.name+" "+io})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var Xr=requireProcessNextickArgs();function eo(no,io){var oo=this,ao=this._readableState&&this._readableState.destroyed,so=this._writableState&&this._writableState.destroyed;return ao||so?(io?io(no):no&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Xr.nextTick(ro,this,no)):Xr.nextTick(ro,this,no)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(no||null,function(co){!io&&co?oo._writableState?oo._writableState.errorEmitted||(oo._writableState.errorEmitted=!0,Xr.nextTick(ro,oo,co)):Xr.nextTick(ro,oo,co):io&&io(co)}),this)}function to(){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)}function ro(no,io){no.emit("error",io)}return destroy_1={destroy:eo,undestroy:to},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var Xr=requireProcessNextickArgs();_stream_writable=vo;function eo(_o){var $o=this;this.next=null,this.entry=null,this.finish=function(){bo($o,_o)}}var to=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:Xr.nextTick,ro;vo.WritableState=go;var no=Object.create(requireUtil());no.inherits=requireInherits_browser();var io={deprecate:requireBrowser$a()},oo=requireStreamBrowser(),ao=requireSafeBuffer().Buffer,so=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function co(_o){return ao.from(_o)}function lo(_o){return ao.isBuffer(_o)||_o instanceof so}var fo=requireDestroy();no.inherits(vo,oo);function ho(){}function go(_o,$o){ro=ro||require_stream_duplex(),_o=_o||{};var Co=$o instanceof ro;this.objectMode=!!_o.objectMode,Co&&(this.objectMode=this.objectMode||!!_o.writableObjectMode);var Ro=_o.highWaterMark,So=_o.writableHighWaterMark,mo=this.objectMode?16:16*1024;Ro||Ro===0?this.highWaterMark=Ro:Co&&(So||So===0)?this.highWaterMark=So:this.highWaterMark=mo,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var To=_o.decodeStrings===!1;this.decodeStrings=!To,this.defaultEncoding=_o.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Vo){No($o,Vo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new eo(this)}go.prototype.getBuffer=function(){for(var $o=this.bufferedRequest,Co=[];$o;)Co.push($o),$o=$o.next;return Co},function(){try{Object.defineProperty(go.prototype,"buffer",{get:io.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var yo;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(yo=Function.prototype[Symbol.hasInstance],Object.defineProperty(vo,Symbol.hasInstance,{value:function(_o){return yo.call(this,_o)?!0:this!==vo?!1:_o&&_o._writableState instanceof go}})):yo=function(_o){return _o instanceof this};function vo(_o){if(ro=ro||require_stream_duplex(),!yo.call(vo,this)&&!(this instanceof ro))return new vo(_o);this._writableState=new go(_o,this),this.writable=!0,_o&&(typeof _o.write=="function"&&(this._write=_o.write),typeof _o.writev=="function"&&(this._writev=_o.writev),typeof _o.destroy=="function"&&(this._destroy=_o.destroy),typeof _o.final=="function"&&(this._final=_o.final)),oo.call(this)}vo.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function wo(_o,$o){var Co=new Error("write after end");_o.emit("error",Co),Xr.nextTick($o,Co)}function Eo(_o,$o,Co,Ro){var So=!0,mo=!1;return Co===null?mo=new TypeError("May not write null values to stream"):typeof Co!="string"&&Co!==void 0&&!$o.objectMode&&(mo=new TypeError("Invalid non-string/buffer chunk")),mo&&(_o.emit("error",mo),Xr.nextTick(Ro,mo),So=!1),So}vo.prototype.write=function(_o,$o,Co){var Ro=this._writableState,So=!1,mo=!Ro.objectMode&&lo(_o);return mo&&!ao.isBuffer(_o)&&(_o=co(_o)),typeof $o=="function"&&(Co=$o,$o=null),mo?$o="buffer":$o||($o=Ro.defaultEncoding),typeof Co!="function"&&(Co=ho),Ro.ended?wo(this,Co):(mo||Eo(this,Ro,_o,Co))&&(Ro.pendingcb++,So=Ao(this,Ro,mo,_o,$o,Co)),So},vo.prototype.cork=function(){var _o=this._writableState;_o.corked++},vo.prototype.uncork=function(){var _o=this._writableState;_o.corked&&(_o.corked--,!_o.writing&&!_o.corked&&!_o.bufferProcessing&&_o.bufferedRequest&&Xo(this,_o))},vo.prototype.setDefaultEncoding=function($o){if(typeof $o=="string"&&($o=$o.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($o+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+$o);return this._writableState.defaultEncoding=$o,this};function ko(_o,$o,Co){return!_o.objectMode&&_o.decodeStrings!==!1&&typeof $o=="string"&&($o=ao.from($o,Co)),$o}Object.defineProperty(vo.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ao(_o,$o,Co,Ro,So,mo){if(!Co){var To=ko($o,Ro,So);Ro!==To&&(Co=!0,So="buffer",Ro=To)}var Vo=$o.objectMode?1:Ro.length;$o.length+=Vo;var Zo=$o.length<$o.highWaterMark;if(Zo||($o.needDrain=!0),$o.writing||$o.corked){var Qo=$o.lastBufferedRequest;$o.lastBufferedRequest={chunk:Ro,encoding:So,isBuf:Co,callback:mo,next:null},Qo?Qo.next=$o.lastBufferedRequest:$o.bufferedRequest=$o.lastBufferedRequest,$o.bufferedRequestCount+=1}else Po(_o,$o,!1,Vo,Ro,So,mo);return Zo}function Po(_o,$o,Co,Ro,So,mo,To){$o.writelen=Ro,$o.writecb=To,$o.writing=!0,$o.sync=!0,Co?_o._writev(So,$o.onwrite):_o._write(So,mo,$o.onwrite),$o.sync=!1}function jo(_o,$o,Co,Ro,So){--$o.pendingcb,Co?(Xr.nextTick(So,Ro),Xr.nextTick(uo,_o,$o),_o._writableState.errorEmitted=!0,_o.emit("error",Ro)):(So(Ro),_o._writableState.errorEmitted=!0,_o.emit("error",Ro),uo(_o,$o))}function Mo(_o){_o.writing=!1,_o.writecb=null,_o.length-=_o.writelen,_o.writelen=0}function No(_o,$o){var Co=_o._writableState,Ro=Co.sync,So=Co.writecb;if(Mo(Co),$o)jo(_o,Co,Ro,$o,So);else{var mo=Lo(Co);!mo&&!Co.corked&&!Co.bufferProcessing&&Co.bufferedRequest&&Xo(_o,Co),Ro?to(Do,_o,Co,mo,So):Do(_o,Co,mo,So)}}function Do(_o,$o,Co,Ro){Co||Fo(_o,$o),$o.pendingcb--,Ro(),uo(_o,$o)}function Fo(_o,$o){$o.length===0&&$o.needDrain&&($o.needDrain=!1,_o.emit("drain"))}function Xo(_o,$o){$o.bufferProcessing=!0;var Co=$o.bufferedRequest;if(_o._writev&&Co&&Co.next){var Ro=$o.bufferedRequestCount,So=new Array(Ro),mo=$o.corkedRequestsFree;mo.entry=Co;for(var To=0,Vo=!0;Co;)So[To]=Co,Co.isBuf||(Vo=!1),Co=Co.next,To+=1;So.allBuffers=Vo,Po(_o,$o,!0,$o.length,So,"",mo.finish),$o.pendingcb++,$o.lastBufferedRequest=null,mo.next?($o.corkedRequestsFree=mo.next,mo.next=null):$o.corkedRequestsFree=new eo($o),$o.bufferedRequestCount=0}else{for(;Co;){var Zo=Co.chunk,Qo=Co.encoding,qo=Co.callback,Ho=$o.objectMode?1:Zo.length;if(Po(_o,$o,!1,Ho,Zo,Qo,qo),Co=Co.next,$o.bufferedRequestCount--,$o.writing)break}Co===null&&($o.lastBufferedRequest=null)}$o.bufferedRequest=Co,$o.bufferProcessing=!1}vo.prototype._write=function(_o,$o,Co){Co(new Error("_write() is not implemented"))},vo.prototype._writev=null,vo.prototype.end=function(_o,$o,Co){var Ro=this._writableState;typeof _o=="function"?(Co=_o,_o=null,$o=null):typeof $o=="function"&&(Co=$o,$o=null),_o!=null&&this.write(_o,$o),Ro.corked&&(Ro.corked=1,this.uncork()),Ro.ending||po(this,Ro,Co)};function Lo(_o){return _o.ending&&_o.length===0&&_o.bufferedRequest===null&&!_o.finished&&!_o.writing}function Bo(_o,$o){_o._final(function(Co){$o.pendingcb--,Co&&_o.emit("error",Co),$o.prefinished=!0,_o.emit("prefinish"),uo(_o,$o)})}function xo(_o,$o){!$o.prefinished&&!$o.finalCalled&&(typeof _o._final=="function"?($o.pendingcb++,$o.finalCalled=!0,Xr.nextTick(Bo,_o,$o)):($o.prefinished=!0,_o.emit("prefinish")))}function uo(_o,$o){var Co=Lo($o);return Co&&(xo(_o,$o),$o.pendingcb===0&&($o.finished=!0,_o.emit("finish"))),Co}function po(_o,$o,Co){$o.ending=!0,uo(_o,$o),Co&&($o.finished?Xr.nextTick(Co):_o.once("finish",Co)),$o.ended=!0,_o.writable=!1}function bo(_o,$o,Co){var Ro=_o.entry;for(_o.entry=null;Ro;){var So=Ro.callback;$o.pendingcb--,So(Co),Ro=Ro.next}$o.corkedRequestsFree.next=_o}return Object.defineProperty(vo.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(_o){this._writableState&&(this._writableState.destroyed=_o)}}),vo.prototype.destroy=fo.destroy,vo.prototype._undestroy=fo.undestroy,vo.prototype._destroy=function(_o,$o){this.end(),$o(_o)},_stream_writable}var _stream_duplex,hasRequired_stream_duplex;function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var Xr=requireProcessNextickArgs(),eo=Object.keys||function(fo){var ho=[];for(var go in fo)ho.push(go);return ho};_stream_duplex=so;var to=Object.create(requireUtil());to.inherits=requireInherits_browser();var ro=require_stream_readable(),no=require_stream_writable();to.inherits(so,ro);for(var io=eo(no.prototype),oo=0;oo0?(typeof Ho!="string"&&!_c.objectMode&&Object.getPrototypeOf(Ho)!==io.prototype&&(Ho=ao(Ho)),zo?_c.endEmitted?qo.emit("error",new Error("stream.unshift() after end event")):Po(qo,_c,Ho,!0):_c.ended?qo.emit("error",new Error("stream.push() after EOF")):(_c.reading=!1,_c.decoder&&!$a?(Ho=_c.decoder.write(Ho),_c.objectMode||Ho.length!==0?Po(qo,_c,Ho,!1):xo(qo,_c)):Po(qo,_c,Ho,!1))):zo||(_c.reading=!1)}return Mo(_c)}function Po(qo,Ho,$a,zo){Ho.flowing&&Ho.length===0&&!Ho.sync?(qo.emit("data",$a),qo.read(0)):(Ho.length+=Ho.objectMode?1:$a.length,zo?Ho.buffer.unshift($a):Ho.buffer.push($a),Ho.needReadable&&Lo(qo)),xo(qo,Ho)}function jo(qo,Ho){var $a;return!so(Ho)&&typeof Ho!="string"&&Ho!==void 0&&!qo.objectMode&&($a=new TypeError("Invalid non-string/buffer chunk")),$a}function Mo(qo){return!qo.ended&&(qo.needReadable||qo.length=No?qo=No:(qo--,qo|=qo>>>1,qo|=qo>>>2,qo|=qo>>>4,qo|=qo>>>8,qo|=qo>>>16,qo++),qo}function Fo(qo,Ho){return qo<=0||Ho.length===0&&Ho.ended?0:Ho.objectMode?1:qo!==qo?Ho.flowing&&Ho.length?Ho.buffer.head.data.length:Ho.length:(qo>Ho.highWaterMark&&(Ho.highWaterMark=Do(qo)),qo<=Ho.length?qo:Ho.ended?Ho.length:(Ho.needReadable=!0,0))}ko.prototype.read=function(qo){fo("read",qo),qo=parseInt(qo,10);var Ho=this._readableState,$a=qo;if(qo!==0&&(Ho.emittedReadable=!1),qo===0&&Ho.needReadable&&(Ho.length>=Ho.highWaterMark||Ho.ended))return fo("read: emitReadable",Ho.length,Ho.ended),Ho.length===0&&Ho.ended?Vo(this):Lo(this),null;if(qo=Fo(qo,Ho),qo===0&&Ho.ended)return Ho.length===0&&Vo(this),null;var zo=Ho.needReadable;fo("need readable",zo),(Ho.length===0||Ho.length-qo0?Ko=Ro(qo,Ho):Ko=null,Ko===null?(Ho.needReadable=!0,qo=0):Ho.length-=qo,Ho.length===0&&(Ho.ended||(Ho.needReadable=!0),$a!==qo&&Ho.ended&&Vo(this)),Ko!==null&&this.emit("data",Ko),Ko};function Xo(qo,Ho){if(!Ho.ended){if(Ho.decoder){var $a=Ho.decoder.end();$a&&$a.length&&(Ho.buffer.push($a),Ho.length+=Ho.objectMode?1:$a.length)}Ho.ended=!0,Lo(qo)}}function Lo(qo){var Ho=qo._readableState;Ho.needReadable=!1,Ho.emittedReadable||(fo("emitReadable",Ho.flowing),Ho.emittedReadable=!0,Ho.sync?Xr.nextTick(Bo,qo):Bo(qo))}function Bo(qo){fo("emit readable"),qo.emit("readable"),Co(qo)}function xo(qo,Ho){Ho.readingMore||(Ho.readingMore=!0,Xr.nextTick(uo,qo,Ho))}function uo(qo,Ho){for(var $a=Ho.length;!Ho.reading&&!Ho.flowing&&!Ho.ended&&Ho.length1&&Qo(zo.pipes,qo)!==-1)&&!Al&&(fo("false write response, pause",zo.awaitDrain),zo.awaitDrain++,Wl=!0),$a.pause())}function Tl(Ll){fo("onerror",Ll),Vl(),qo.removeListener("error",Tl),ro(qo,"error")===0&&qo.emit("error",Ll)}wo(qo,"error",Tl);function Ml(){qo.removeListener("finish",ou),Vl()}qo.once("close",Ml);function ou(){fo("onfinish"),qo.removeListener("close",Ml),Vl()}qo.once("finish",ou);function Vl(){fo("unpipe"),$a.unpipe(qo)}return qo.emit("pipe",$a),zo.flowing||(fo("pipe resume"),$a.resume()),qo};function po(qo){return function(){var Ho=qo._readableState;fo("pipeOnDrain",Ho.awaitDrain),Ho.awaitDrain&&Ho.awaitDrain--,Ho.awaitDrain===0&&ro(qo,"data")&&(Ho.flowing=!0,Co(qo))}}ko.prototype.unpipe=function(qo){var Ho=this._readableState,$a={hasUnpiped:!1};if(Ho.pipesCount===0)return this;if(Ho.pipesCount===1)return qo&&qo!==Ho.pipes?this:(qo||(qo=Ho.pipes),Ho.pipes=null,Ho.pipesCount=0,Ho.flowing=!1,qo&&qo.emit("unpipe",this,$a),this);if(!qo){var zo=Ho.pipes,Ko=Ho.pipesCount;Ho.pipes=null,Ho.pipesCount=0,Ho.flowing=!1;for(var _c=0;_c=Ho.length?(Ho.decoder?$a=Ho.buffer.join(""):Ho.buffer.length===1?$a=Ho.buffer.head.data:$a=Ho.buffer.concat(Ho.length),Ho.buffer.clear()):$a=So(qo,Ho.buffer,Ho.decoder),$a}function So(qo,Ho,$a){var zo;return qo_c.length?_c.length:qo;if(Cl===_c.length?Ko+=_c:Ko+=_c.slice(0,qo),qo-=Cl,qo===0){Cl===_c.length?(++zo,$a.next?Ho.head=$a.next:Ho.head=Ho.tail=null):(Ho.head=$a,$a.data=_c.slice(Cl));break}++zo}return Ho.length-=zo,Ko}function To(qo,Ho){var $a=io.allocUnsafe(qo),zo=Ho.head,Ko=1;for(zo.data.copy($a),qo-=zo.data.length;zo=zo.next;){var _c=zo.data,Cl=qo>_c.length?_c.length:qo;if(_c.copy($a,$a.length-qo,0,Cl),qo-=Cl,qo===0){Cl===_c.length?(++Ko,zo.next?Ho.head=zo.next:Ho.head=Ho.tail=null):(Ho.head=zo,zo.data=_c.slice(Cl));break}++Ko}return Ho.length-=Ko,$a}function Vo(qo){var Ho=qo._readableState;if(Ho.length>0)throw new Error('"endReadable()" called on non-empty stream');Ho.endEmitted||(Ho.ended=!0,Xr.nextTick(Zo,Ho,qo))}function Zo(qo,Ho){!qo.endEmitted&&qo.length===0&&(qo.endEmitted=!0,Ho.readable=!1,Ho.emit("end"))}function Qo(qo,Ho){for(var $a=0,zo=qo.length;$a0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)}(bn$6)),bn$6.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var Xr=requireBn$1(),eo=requireBrowser$b(),to=safeBufferExports.Buffer;function ro(oo){var ao=oo.modulus.byteLength(),so;do so=new Xr(eo(ao));while(so.cmp(oo.modulus)>=0||!so.umod(oo.prime1)||!so.umod(oo.prime2));return so}function no(oo){var ao=ro(oo),so=ao.toRed(Xr.mont(oo.modulus)).redPow(new Xr(oo.publicExponent)).fromRed();return{blinder:so,unblinder:ao.invm(oo.modulus)}}function io(oo,ao){var so=no(ao),co=ao.modulus.byteLength(),lo=new Xr(oo).mul(so.blinder).umod(ao.modulus),fo=lo.toRed(Xr.mont(ao.prime1)),ho=lo.toRed(Xr.mont(ao.prime2)),go=ao.coefficient,yo=ao.prime1,vo=ao.prime2,wo=fo.redPow(ao.exponent1).fromRed(),Eo=ho.redPow(ao.exponent2).fromRed(),ko=wo.isub(Eo).imul(go).umod(yo).imul(vo);return Eo.iadd(ko).imul(so.unblinder).umod(ao.modulus).toArrayLike(to,"be",co)}return io.getr=ro,browserifyRsa=io,browserifyRsa}var elliptic={};const name$1="elliptic",version$i="6.6.0",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$8={name:name$1,version:version$i,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies:dependencies$1};var utils$7={},utils$6={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(Xr){var eo=Xr;function to(io,oo){if(Array.isArray(io))return io.slice();if(!io)return[];var ao=[];if(typeof io!="string"){for(var so=0;so>8,fo=co&255;lo?ao.push(lo,fo):ao.push(fo)}return ao}eo.toArray=to;function ro(io){return io.length===1?"0"+io:io}eo.zero2=ro;function no(io){for(var oo="",ao=0;ao(vo>>1)-1?Eo=(vo>>1)-ko:Eo=ko,wo.isubn(Eo)):Eo=0,go[yo]=Eo,wo.iushrn(1)}return go}eo.getNAF=io;function oo(lo,fo){var ho=[[],[]];lo=lo.clone(),fo=fo.clone();for(var go=0,yo=0,vo;lo.cmpn(-go)>0||fo.cmpn(-yo)>0;){var wo=lo.andln(3)+go&3,Eo=fo.andln(3)+yo&3;wo===3&&(wo=-1),Eo===3&&(Eo=-1);var ko;wo&1?(vo=lo.andln(7)+go&7,(vo===3||vo===5)&&Eo===2?ko=-wo:ko=wo):ko=0,ho[0].push(ko);var Ao;Eo&1?(vo=fo.andln(7)+yo&7,(vo===3||vo===5)&&wo===2?Ao=-Eo:Ao=Eo):Ao=0,ho[1].push(Ao),2*go===ko+1&&(go=1-go),2*yo===Ao+1&&(yo=1-yo),lo.iushrn(1),fo.iushrn(1)}return ho}eo.getJSF=oo;function ao(lo,fo,ho){var go="_"+fo;lo.prototype[fo]=function(){return this[go]!==void 0?this[go]:this[go]=ho.call(this)}}eo.cachedProperty=ao;function so(lo){return typeof lo=="string"?eo.toArray(lo,"hex"):lo}eo.parseBytes=so;function co(lo){return new to(lo,"hex","le")}eo.intFromLE=co}(utils$7)),utils$7}var curve$1={},base$5,hasRequiredBase$1;function requireBase$1(){if(hasRequiredBase$1)return base$5;hasRequiredBase$1=1;var Xr=requireBn$2(),eo=requireUtils$2(),to=eo.getNAF,ro=eo.getJSF,no=eo.assert;function io(ao,so){this.type=ao,this.p=new Xr(so.p,16),this.red=so.prime?Xr.red(so.prime):Xr.mont(this.p),this.zero=new Xr(0).toRed(this.red),this.one=new Xr(1).toRed(this.red),this.two=new Xr(2).toRed(this.red),this.n=so.n&&new Xr(so.n,16),this.g=so.g&&this.pointFromJSON(so.g,so.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var co=this.n&&this.p.div(this.n);!co||co.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$5=io,io.prototype.point=function(){throw new Error("Not implemented")},io.prototype.validate=function(){throw new Error("Not implemented")},io.prototype._fixedNafMul=function(so,co){no(so.precomputed);var lo=so._getDoubles(),fo=to(co,1,this._bitLength),ho=(1<=yo;wo--)vo=(vo<<1)+fo[wo];go.push(vo)}for(var Eo=this.jpoint(null,null,null),ko=this.jpoint(null,null,null),Ao=ho;Ao>0;Ao--){for(yo=0;yo=0;vo--){for(var wo=0;vo>=0&&go[vo]===0;vo--)wo++;if(vo>=0&&wo++,yo=yo.dblp(wo),vo<0)break;var Eo=go[vo];no(Eo!==0),so.type==="affine"?Eo>0?yo=yo.mixedAdd(ho[Eo-1>>1]):yo=yo.mixedAdd(ho[-Eo-1>>1].neg()):Eo>0?yo=yo.add(ho[Eo-1>>1]):yo=yo.add(ho[-Eo-1>>1].neg())}return so.type==="affine"?yo.toP():yo},io.prototype._wnafMulAdd=function(so,co,lo,fo,ho){var go=this._wnafT1,yo=this._wnafT2,vo=this._wnafT3,wo=0,Eo,ko,Ao;for(Eo=0;Eo=1;Eo-=2){var jo=Eo-1,Mo=Eo;if(go[jo]!==1||go[Mo]!==1){vo[jo]=to(lo[jo],go[jo],this._bitLength),vo[Mo]=to(lo[Mo],go[Mo],this._bitLength),wo=Math.max(vo[jo].length,wo),wo=Math.max(vo[Mo].length,wo);continue}var No=[co[jo],null,null,co[Mo]];co[jo].y.cmp(co[Mo].y)===0?(No[1]=co[jo].add(co[Mo]),No[2]=co[jo].toJ().mixedAdd(co[Mo].neg())):co[jo].y.cmp(co[Mo].y.redNeg())===0?(No[1]=co[jo].toJ().mixedAdd(co[Mo]),No[2]=co[jo].add(co[Mo].neg())):(No[1]=co[jo].toJ().mixedAdd(co[Mo]),No[2]=co[jo].toJ().mixedAdd(co[Mo].neg()));var Do=[-3,-1,-5,-7,0,7,5,1,3],Fo=ro(lo[jo],lo[Mo]);for(wo=Math.max(Fo[0].length,wo),vo[jo]=new Array(wo),vo[Mo]=new Array(wo),ko=0;ko=0;Eo--){for(var uo=0;Eo>=0;){var po=!0;for(ko=0;ko=0&&uo++,Bo=Bo.dblp(uo),Eo<0)break;for(ko=0;ko0?Ao=yo[ko][bo-1>>1]:bo<0&&(Ao=yo[ko][-bo-1>>1].neg()),Ao.type==="affine"?Bo=Bo.mixedAdd(Ao):Bo=Bo.add(Ao))}}for(Eo=0;Eo=Math.ceil((so.bitLength()+1)/co.step):!1},oo.prototype._getDoubles=function(so,co){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var lo=[this],fo=this,ho=0;ho=0&&(jo=Eo,Mo=ko),Ao.negative&&(Ao=Ao.neg(),Po=Po.neg()),jo.negative&&(jo=jo.neg(),Mo=Mo.neg()),[{a:Ao,b:Po},{a:jo,b:Mo}]},io.prototype._endoSplit=function(co){var lo=this.endo.basis,fo=lo[0],ho=lo[1],go=ho.b.mul(co).divRound(this.n),yo=fo.b.neg().mul(co).divRound(this.n),vo=go.mul(fo.a),wo=yo.mul(ho.a),Eo=go.mul(fo.b),ko=yo.mul(ho.b),Ao=co.sub(vo).sub(wo),Po=Eo.add(ko).neg();return{k1:Ao,k2:Po}},io.prototype.pointFromX=function(co,lo){co=new eo(co,16),co.red||(co=co.toRed(this.red));var fo=co.redSqr().redMul(co).redIAdd(co.redMul(this.a)).redIAdd(this.b),ho=fo.redSqrt();if(ho.redSqr().redSub(fo).cmp(this.zero)!==0)throw new Error("invalid point");var go=ho.fromRed().isOdd();return(lo&&!go||!lo&&go)&&(ho=ho.redNeg()),this.point(co,ho)},io.prototype.validate=function(co){if(co.inf)return!0;var lo=co.x,fo=co.y,ho=this.a.redMul(lo),go=lo.redSqr().redMul(lo).redIAdd(ho).redIAdd(this.b);return fo.redSqr().redISub(go).cmpn(0)===0},io.prototype._endoWnafMulAdd=function(co,lo,fo){for(var ho=this._endoWnafT1,go=this._endoWnafT2,yo=0;yo":""},oo.prototype.isInfinity=function(){return this.inf},oo.prototype.add=function(co){if(this.inf)return co;if(co.inf)return this;if(this.eq(co))return this.dbl();if(this.neg().eq(co))return this.curve.point(null,null);if(this.x.cmp(co.x)===0)return this.curve.point(null,null);var lo=this.y.redSub(co.y);lo.cmpn(0)!==0&&(lo=lo.redMul(this.x.redSub(co.x).redInvm()));var fo=lo.redSqr().redISub(this.x).redISub(co.x),ho=lo.redMul(this.x.redSub(fo)).redISub(this.y);return this.curve.point(fo,ho)},oo.prototype.dbl=function(){if(this.inf)return this;var co=this.y.redAdd(this.y);if(co.cmpn(0)===0)return this.curve.point(null,null);var lo=this.curve.a,fo=this.x.redSqr(),ho=co.redInvm(),go=fo.redAdd(fo).redIAdd(fo).redIAdd(lo).redMul(ho),yo=go.redSqr().redISub(this.x.redAdd(this.x)),vo=go.redMul(this.x.redSub(yo)).redISub(this.y);return this.curve.point(yo,vo)},oo.prototype.getX=function(){return this.x.fromRed()},oo.prototype.getY=function(){return this.y.fromRed()},oo.prototype.mul=function(co){return co=new eo(co,16),this.isInfinity()?this:this._hasDoubles(co)?this.curve._fixedNafMul(this,co):this.curve.endo?this.curve._endoWnafMulAdd([this],[co]):this.curve._wnafMul(this,co)},oo.prototype.mulAdd=function(co,lo,fo){var ho=[this,lo],go=[co,fo];return this.curve.endo?this.curve._endoWnafMulAdd(ho,go):this.curve._wnafMulAdd(1,ho,go,2)},oo.prototype.jmulAdd=function(co,lo,fo){var ho=[this,lo],go=[co,fo];return this.curve.endo?this.curve._endoWnafMulAdd(ho,go,!0):this.curve._wnafMulAdd(1,ho,go,2,!0)},oo.prototype.eq=function(co){return this===co||this.inf===co.inf&&(this.inf||this.x.cmp(co.x)===0&&this.y.cmp(co.y)===0)},oo.prototype.neg=function(co){if(this.inf)return this;var lo=this.curve.point(this.x,this.y.redNeg());if(co&&this.precomputed){var fo=this.precomputed,ho=function(go){return go.neg()};lo.precomputed={naf:fo.naf&&{wnd:fo.naf.wnd,points:fo.naf.points.map(ho)},doubles:fo.doubles&&{step:fo.doubles.step,points:fo.doubles.points.map(ho)}}}return lo},oo.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var co=this.curve.jpoint(this.x,this.y,this.curve.one);return co};function ao(so,co,lo,fo){ro.BasePoint.call(this,so,"jacobian"),co===null&&lo===null&&fo===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new eo(0)):(this.x=new eo(co,16),this.y=new eo(lo,16),this.z=new eo(fo,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return to(ao,ro.BasePoint),io.prototype.jpoint=function(co,lo,fo){return new ao(this,co,lo,fo)},ao.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var co=this.z.redInvm(),lo=co.redSqr(),fo=this.x.redMul(lo),ho=this.y.redMul(lo).redMul(co);return this.curve.point(fo,ho)},ao.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},ao.prototype.add=function(co){if(this.isInfinity())return co;if(co.isInfinity())return this;var lo=co.z.redSqr(),fo=this.z.redSqr(),ho=this.x.redMul(lo),go=co.x.redMul(fo),yo=this.y.redMul(lo.redMul(co.z)),vo=co.y.redMul(fo.redMul(this.z)),wo=ho.redSub(go),Eo=yo.redSub(vo);if(wo.cmpn(0)===0)return Eo.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ko=wo.redSqr(),Ao=ko.redMul(wo),Po=ho.redMul(ko),jo=Eo.redSqr().redIAdd(Ao).redISub(Po).redISub(Po),Mo=Eo.redMul(Po.redISub(jo)).redISub(yo.redMul(Ao)),No=this.z.redMul(co.z).redMul(wo);return this.curve.jpoint(jo,Mo,No)},ao.prototype.mixedAdd=function(co){if(this.isInfinity())return co.toJ();if(co.isInfinity())return this;var lo=this.z.redSqr(),fo=this.x,ho=co.x.redMul(lo),go=this.y,yo=co.y.redMul(lo).redMul(this.z),vo=fo.redSub(ho),wo=go.redSub(yo);if(vo.cmpn(0)===0)return wo.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Eo=vo.redSqr(),ko=Eo.redMul(vo),Ao=fo.redMul(Eo),Po=wo.redSqr().redIAdd(ko).redISub(Ao).redISub(Ao),jo=wo.redMul(Ao.redISub(Po)).redISub(go.redMul(ko)),Mo=this.z.redMul(vo);return this.curve.jpoint(Po,jo,Mo)},ao.prototype.dblp=function(co){if(co===0)return this;if(this.isInfinity())return this;if(!co)return this.dbl();var lo;if(this.curve.zeroA||this.curve.threeA){var fo=this;for(lo=0;lo=0)return!1;if(fo.redIAdd(go),this.x.cmp(fo)===0)return!0}},ao.prototype.inspect=function(){return this.isInfinity()?"":""},ao.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short}var mont,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont;hasRequiredMont=1;var Xr=requireBn$2(),eo=requireInherits_browser(),to=requireBase$1(),ro=requireUtils$2();function no(oo){to.call(this,"mont",oo),this.a=new Xr(oo.a,16).toRed(this.red),this.b=new Xr(oo.b,16).toRed(this.red),this.i4=new Xr(4).toRed(this.red).redInvm(),this.two=new Xr(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}eo(no,to),mont=no,no.prototype.validate=function(ao){var so=ao.normalize().x,co=so.redSqr(),lo=co.redMul(so).redAdd(co.redMul(this.a)).redAdd(so),fo=lo.redSqrt();return fo.redSqr().cmp(lo)===0};function io(oo,ao,so){to.BasePoint.call(this,oo,"projective"),ao===null&&so===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Xr(ao,16),this.z=new Xr(so,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return eo(io,to.BasePoint),no.prototype.decodePoint=function(ao,so){return this.point(ro.toArray(ao,so),1)},no.prototype.point=function(ao,so){return new io(this,ao,so)},no.prototype.pointFromJSON=function(ao){return io.fromJSON(this,ao)},io.prototype.precompute=function(){},io.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},io.fromJSON=function(ao,so){return new io(ao,so[0],so[1]||ao.one)},io.prototype.inspect=function(){return this.isInfinity()?"":""},io.prototype.isInfinity=function(){return this.z.cmpn(0)===0},io.prototype.dbl=function(){var ao=this.x.redAdd(this.z),so=ao.redSqr(),co=this.x.redSub(this.z),lo=co.redSqr(),fo=so.redSub(lo),ho=so.redMul(lo),go=fo.redMul(lo.redAdd(this.curve.a24.redMul(fo)));return this.curve.point(ho,go)},io.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.diffAdd=function(ao,so){var co=this.x.redAdd(this.z),lo=this.x.redSub(this.z),fo=ao.x.redAdd(ao.z),ho=ao.x.redSub(ao.z),go=ho.redMul(co),yo=fo.redMul(lo),vo=so.z.redMul(go.redAdd(yo).redSqr()),wo=so.x.redMul(go.redISub(yo).redSqr());return this.curve.point(vo,wo)},io.prototype.mul=function(ao){for(var so=ao.clone(),co=this,lo=this.curve.point(null,null),fo=this,ho=[];so.cmpn(0)!==0;so.iushrn(1))ho.push(so.andln(1));for(var go=ho.length-1;go>=0;go--)ho[go]===0?(co=co.diffAdd(lo,fo),lo=lo.dbl()):(lo=co.diffAdd(lo,fo),co=co.dbl());return lo},io.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.eq=function(ao){return this.getX().cmp(ao.getX())===0},io.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},io.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont}var edwards,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1;var Xr=requireUtils$2(),eo=requireBn$2(),to=requireInherits_browser(),ro=requireBase$1(),no=Xr.assert;function io(ao){this.twisted=(ao.a|0)!==1,this.mOneA=this.twisted&&(ao.a|0)===-1,this.extended=this.mOneA,ro.call(this,"edwards",ao),this.a=new eo(ao.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new eo(ao.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new eo(ao.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),no(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(ao.c|0)===1}to(io,ro),edwards=io,io.prototype._mulA=function(so){return this.mOneA?so.redNeg():this.a.redMul(so)},io.prototype._mulC=function(so){return this.oneC?so:this.c.redMul(so)},io.prototype.jpoint=function(so,co,lo,fo){return this.point(so,co,lo,fo)},io.prototype.pointFromX=function(so,co){so=new eo(so,16),so.red||(so=so.toRed(this.red));var lo=so.redSqr(),fo=this.c2.redSub(this.a.redMul(lo)),ho=this.one.redSub(this.c2.redMul(this.d).redMul(lo)),go=fo.redMul(ho.redInvm()),yo=go.redSqrt();if(yo.redSqr().redSub(go).cmp(this.zero)!==0)throw new Error("invalid point");var vo=yo.fromRed().isOdd();return(co&&!vo||!co&&vo)&&(yo=yo.redNeg()),this.point(so,yo)},io.prototype.pointFromY=function(so,co){so=new eo(so,16),so.red||(so=so.toRed(this.red));var lo=so.redSqr(),fo=lo.redSub(this.c2),ho=lo.redMul(this.d).redMul(this.c2).redSub(this.a),go=fo.redMul(ho.redInvm());if(go.cmp(this.zero)===0){if(co)throw new Error("invalid point");return this.point(this.zero,so)}var yo=go.redSqrt();if(yo.redSqr().redSub(go).cmp(this.zero)!==0)throw new Error("invalid point");return yo.fromRed().isOdd()!==co&&(yo=yo.redNeg()),this.point(yo,so)},io.prototype.validate=function(so){if(so.isInfinity())return!0;so.normalize();var co=so.x.redSqr(),lo=so.y.redSqr(),fo=co.redMul(this.a).redAdd(lo),ho=this.c2.redMul(this.one.redAdd(this.d.redMul(co).redMul(lo)));return fo.cmp(ho)===0};function oo(ao,so,co,lo,fo){ro.BasePoint.call(this,ao,"projective"),so===null&&co===null&&lo===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new eo(so,16),this.y=new eo(co,16),this.z=lo?new eo(lo,16):this.curve.one,this.t=fo&&new eo(fo,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return to(oo,ro.BasePoint),io.prototype.pointFromJSON=function(so){return oo.fromJSON(this,so)},io.prototype.point=function(so,co,lo,fo){return new oo(this,so,co,lo,fo)},oo.fromJSON=function(so,co){return new oo(so,co[0],co[1],co[2])},oo.prototype.inspect=function(){return this.isInfinity()?"":""},oo.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},oo.prototype._extDbl=function(){var so=this.x.redSqr(),co=this.y.redSqr(),lo=this.z.redSqr();lo=lo.redIAdd(lo);var fo=this.curve._mulA(so),ho=this.x.redAdd(this.y).redSqr().redISub(so).redISub(co),go=fo.redAdd(co),yo=go.redSub(lo),vo=fo.redSub(co),wo=ho.redMul(yo),Eo=go.redMul(vo),ko=ho.redMul(vo),Ao=yo.redMul(go);return this.curve.point(wo,Eo,Ao,ko)},oo.prototype._projDbl=function(){var so=this.x.redAdd(this.y).redSqr(),co=this.x.redSqr(),lo=this.y.redSqr(),fo,ho,go,yo,vo,wo;if(this.curve.twisted){yo=this.curve._mulA(co);var Eo=yo.redAdd(lo);this.zOne?(fo=so.redSub(co).redSub(lo).redMul(Eo.redSub(this.curve.two)),ho=Eo.redMul(yo.redSub(lo)),go=Eo.redSqr().redSub(Eo).redSub(Eo)):(vo=this.z.redSqr(),wo=Eo.redSub(vo).redISub(vo),fo=so.redSub(co).redISub(lo).redMul(wo),ho=Eo.redMul(yo.redSub(lo)),go=Eo.redMul(wo))}else yo=co.redAdd(lo),vo=this.curve._mulC(this.z).redSqr(),wo=yo.redSub(vo).redSub(vo),fo=this.curve._mulC(so.redISub(yo)).redMul(wo),ho=this.curve._mulC(yo).redMul(co.redISub(lo)),go=yo.redMul(wo);return this.curve.point(fo,ho,go)},oo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},oo.prototype._extAdd=function(so){var co=this.y.redSub(this.x).redMul(so.y.redSub(so.x)),lo=this.y.redAdd(this.x).redMul(so.y.redAdd(so.x)),fo=this.t.redMul(this.curve.dd).redMul(so.t),ho=this.z.redMul(so.z.redAdd(so.z)),go=lo.redSub(co),yo=ho.redSub(fo),vo=ho.redAdd(fo),wo=lo.redAdd(co),Eo=go.redMul(yo),ko=vo.redMul(wo),Ao=go.redMul(wo),Po=yo.redMul(vo);return this.curve.point(Eo,ko,Po,Ao)},oo.prototype._projAdd=function(so){var co=this.z.redMul(so.z),lo=co.redSqr(),fo=this.x.redMul(so.x),ho=this.y.redMul(so.y),go=this.curve.d.redMul(fo).redMul(ho),yo=lo.redSub(go),vo=lo.redAdd(go),wo=this.x.redAdd(this.y).redMul(so.x.redAdd(so.y)).redISub(fo).redISub(ho),Eo=co.redMul(yo).redMul(wo),ko,Ao;return this.curve.twisted?(ko=co.redMul(vo).redMul(ho.redSub(this.curve._mulA(fo))),Ao=yo.redMul(vo)):(ko=co.redMul(vo).redMul(ho.redSub(fo)),Ao=this.curve._mulC(yo).redMul(vo)),this.curve.point(Eo,ko,Ao)},oo.prototype.add=function(so){return this.isInfinity()?so:so.isInfinity()?this:this.curve.extended?this._extAdd(so):this._projAdd(so)},oo.prototype.mul=function(so){return this._hasDoubles(so)?this.curve._fixedNafMul(this,so):this.curve._wnafMul(this,so)},oo.prototype.mulAdd=function(so,co,lo){return this.curve._wnafMulAdd(1,[this,co],[so,lo],2,!1)},oo.prototype.jmulAdd=function(so,co,lo){return this.curve._wnafMulAdd(1,[this,co],[so,lo],2,!0)},oo.prototype.normalize=function(){if(this.zOne)return this;var so=this.z.redInvm();return this.x=this.x.redMul(so),this.y=this.y.redMul(so),this.t&&(this.t=this.t.redMul(so)),this.z=this.curve.one,this.zOne=!0,this},oo.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},oo.prototype.getX=function(){return this.normalize(),this.x.fromRed()},oo.prototype.getY=function(){return this.normalize(),this.y.fromRed()},oo.prototype.eq=function(so){return this===so||this.getX().cmp(so.getX())===0&&this.getY().cmp(so.getY())===0},oo.prototype.eqXToP=function(so){var co=so.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(co)===0)return!0;for(var lo=so.clone(),fo=this.curve.redN.redMul(this.z);;){if(lo.iadd(this.curve.n),lo.cmp(this.curve.p)>=0)return!1;if(co.redIAdd(fo),this.x.cmp(co)===0)return!0}},oo.prototype.toP=oo.prototype.normalize,oo.prototype.mixedAdd=oo.prototype.add,edwards}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(Xr){var eo=Xr;eo.base=requireBase$1(),eo.short=requireShort(),eo.mont=requireMont(),eo.edwards=requireEdwards()}(curve$1)),curve$1}var curves={},hash$2={},utils$5={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$5;hasRequiredUtils$1=1;var Xr=requireMinimalisticAssert(),eo=requireInherits_browser();utils$5.inherits=eo;function to(Bo,xo){return(Bo.charCodeAt(xo)&64512)!==55296||xo<0||xo+1>=Bo.length?!1:(Bo.charCodeAt(xo+1)&64512)===56320}function ro(Bo,xo){if(Array.isArray(Bo))return Bo.slice();if(!Bo)return[];var uo=[];if(typeof Bo=="string")if(xo){if(xo==="hex")for(Bo=Bo.replace(/[^a-z0-9]+/ig,""),Bo.length%2!==0&&(Bo="0"+Bo),bo=0;bo>6|192,uo[po++]=_o&63|128):to(Bo,bo)?(_o=65536+((_o&1023)<<10)+(Bo.charCodeAt(++bo)&1023),uo[po++]=_o>>18|240,uo[po++]=_o>>12&63|128,uo[po++]=_o>>6&63|128,uo[po++]=_o&63|128):(uo[po++]=_o>>12|224,uo[po++]=_o>>6&63|128,uo[po++]=_o&63|128)}else for(bo=0;bo>>24|Bo>>>8&65280|Bo<<8&16711680|(Bo&255)<<24;return xo>>>0}utils$5.htonl=io;function oo(Bo,xo){for(var uo="",po=0;po>>0}return _o}utils$5.join32=co;function lo(Bo,xo){for(var uo=new Array(Bo.length*4),po=0,bo=0;po>>24,uo[bo+1]=_o>>>16&255,uo[bo+2]=_o>>>8&255,uo[bo+3]=_o&255):(uo[bo+3]=_o>>>24,uo[bo+2]=_o>>>16&255,uo[bo+1]=_o>>>8&255,uo[bo]=_o&255)}return uo}utils$5.split32=lo;function fo(Bo,xo){return Bo>>>xo|Bo<<32-xo}utils$5.rotr32=fo;function ho(Bo,xo){return Bo<>>32-xo}utils$5.rotl32=ho;function go(Bo,xo){return Bo+xo>>>0}utils$5.sum32=go;function yo(Bo,xo,uo){return Bo+xo+uo>>>0}utils$5.sum32_3=yo;function vo(Bo,xo,uo,po){return Bo+xo+uo+po>>>0}utils$5.sum32_4=vo;function wo(Bo,xo,uo,po,bo){return Bo+xo+uo+po+bo>>>0}utils$5.sum32_5=wo;function Eo(Bo,xo,uo,po){var bo=Bo[xo],_o=Bo[xo+1],$o=po+_o>>>0,Co=($o>>0,Bo[xo+1]=$o}utils$5.sum64=Eo;function ko(Bo,xo,uo,po){var bo=xo+po>>>0,_o=(bo>>0}utils$5.sum64_hi=ko;function Ao(Bo,xo,uo,po){var bo=xo+po;return bo>>>0}utils$5.sum64_lo=Ao;function Po(Bo,xo,uo,po,bo,_o,$o,Co){var Ro=0,So=xo;So=So+po>>>0,Ro+=So>>0,Ro+=So<_o?1:0,So=So+Co>>>0,Ro+=So>>0}utils$5.sum64_4_hi=Po;function jo(Bo,xo,uo,po,bo,_o,$o,Co){var Ro=xo+po+_o+Co;return Ro>>>0}utils$5.sum64_4_lo=jo;function Mo(Bo,xo,uo,po,bo,_o,$o,Co,Ro,So){var mo=0,To=xo;To=To+po>>>0,mo+=To>>0,mo+=To<_o?1:0,To=To+Co>>>0,mo+=To>>0,mo+=To>>0}utils$5.sum64_5_hi=Mo;function No(Bo,xo,uo,po,bo,_o,$o,Co,Ro,So){var mo=xo+po+_o+Co+So;return mo>>>0}utils$5.sum64_5_lo=No;function Do(Bo,xo,uo){var po=xo<<32-uo|Bo>>>uo;return po>>>0}utils$5.rotr64_hi=Do;function Fo(Bo,xo,uo){var po=Bo<<32-uo|xo>>>uo;return po>>>0}utils$5.rotr64_lo=Fo;function Xo(Bo,xo,uo){return Bo>>>uo}utils$5.shr64_hi=Xo;function Lo(Bo,xo,uo){var po=Bo<<32-uo|xo>>>uo;return po>>>0}return utils$5.shr64_lo=Lo,utils$5}var common$2={},hasRequiredCommon$1;function requireCommon$1(){if(hasRequiredCommon$1)return common$2;hasRequiredCommon$1=1;var Xr=requireUtils$1(),eo=requireMinimalisticAssert();function to(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return common$2.BlockHash=to,to.prototype.update=function(no,io){if(no=Xr.toArray(no,io),this.pending?this.pending=this.pending.concat(no):this.pending=no,this.pendingTotal+=no.length,this.pending.length>=this._delta8){no=this.pending;var oo=no.length%this._delta8;this.pending=no.slice(no.length-oo,no.length),this.pending.length===0&&(this.pending=null),no=Xr.join32(no,0,no.length-oo,this.endian);for(var ao=0;ao>>24&255,ao[so++]=no>>>16&255,ao[so++]=no>>>8&255,ao[so++]=no&255}else for(ao[so++]=no&255,ao[so++]=no>>>8&255,ao[so++]=no>>>16&255,ao[so++]=no>>>24&255,ao[so++]=0,ao[so++]=0,ao[so++]=0,ao[so++]=0,co=8;co>>3}common$1.g0_256=so;function co(lo){return eo(lo,17)^eo(lo,19)^lo>>>10}return common$1.g1_256=co,common$1}var _1$1,hasRequired_1;function require_1(){if(hasRequired_1)return _1$1;hasRequired_1=1;var Xr=requireUtils$1(),eo=requireCommon$1(),to=requireCommon(),ro=Xr.rotl32,no=Xr.sum32,io=Xr.sum32_5,oo=to.ft_1,ao=eo.BlockHash,so=[1518500249,1859775393,2400959708,3395469782];function co(){if(!(this instanceof co))return new co;ao.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return Xr.inherits(co,ao),_1$1=co,co.blockSize=512,co.outSize=160,co.hmacStrength=80,co.padLength=64,co.prototype._update=function(fo,ho){for(var go=this.W,yo=0;yo<16;yo++)go[yo]=fo[ho+yo];for(;yothis.blockSize&&(no=new this.Hash().update(no).digest()),eo(no.length<=this.blockSize);for(var io=no.length;io=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(io,oo,ao)}return hmacDrbg=ro,ro.prototype._init=function(io,oo,ao){var so=io.concat(oo).concat(ao);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var co=0;co=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(io.concat(ao||[])),this._reseed=1},ro.prototype.generate=function(io,oo,ao,so){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof oo!="string"&&(so=ao,ao=oo,oo=null),ao&&(ao=eo.toArray(ao,so||"hex"),this._update(ao));for(var co=[];co.length"},key$1}var signature$2,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$2;hasRequiredSignature$1=1;var Xr=requireBn$2(),eo=requireUtils$2(),to=eo.assert;function ro(so,co){if(so instanceof ro)return so;this._importDER(so,co)||(to(so.r&&so.s,"Signature without r or s"),this.r=new Xr(so.r,16),this.s=new Xr(so.s,16),so.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=so.recoveryParam)}signature$2=ro;function no(){this.place=0}function io(so,co){var lo=so[co.place++];if(!(lo&128))return lo;var fo=lo&15;if(fo===0||fo>4||so[co.place]===0)return!1;for(var ho=0,go=0,yo=co.place;go>>=0;return ho<=127?!1:(co.place=yo,ho)}function oo(so){for(var co=0,lo=so.length-1;!so[co]&&!(so[co+1]&128)&&co>>3);for(so.push(lo|128);--lo;)so.push(co>>>(lo<<3)&255);so.push(co)}return ro.prototype.toDER=function(co){var lo=this.r.toArray(),fo=this.s.toArray();for(lo[0]&128&&(lo=[0].concat(lo)),fo[0]&128&&(fo=[0].concat(fo)),lo=oo(lo),fo=oo(fo);!fo[0]&&!(fo[1]&128);)fo=fo.slice(1);var ho=[2];ao(ho,lo.length),ho=ho.concat(lo),ho.push(2),ao(ho,fo.length);var go=ho.concat(fo),yo=[48];return ao(yo,go.length),yo=yo.concat(go),eo.encode(yo,co)},signature$2}var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var Xr=requireBn$2(),eo=requireHmacDrbg(),to=requireUtils$2(),ro=requireCurves(),no=requireBrorand(),io=to.assert,oo=requireKey$1(),ao=requireSignature$1();function so(co){if(!(this instanceof so))return new so(co);typeof co=="string"&&(io(Object.prototype.hasOwnProperty.call(ro,co),"Unknown curve "+co),co=ro[co]),co instanceof ro.PresetCurve&&(co={curve:co}),this.curve=co.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=co.curve.g,this.g.precompute(co.curve.n.bitLength()+1),this.hash=co.hash||co.curve.hash}return ec=so,so.prototype.keyPair=function(lo){return new oo(this,lo)},so.prototype.keyFromPrivate=function(lo,fo){return oo.fromPrivate(this,lo,fo)},so.prototype.keyFromPublic=function(lo,fo){return oo.fromPublic(this,lo,fo)},so.prototype.genKeyPair=function(lo){lo||(lo={});for(var fo=new eo({hash:this.hash,pers:lo.pers,persEnc:lo.persEnc||"utf8",entropy:lo.entropy||no(this.hash.hmacStrength),entropyEnc:lo.entropy&&lo.entropyEnc||"utf8",nonce:this.n.toArray()}),ho=this.n.byteLength(),go=this.n.sub(new Xr(2));;){var yo=new Xr(fo.generate(ho));if(!(yo.cmp(go)>0))return yo.iaddn(1),this.keyFromPrivate(yo)}},so.prototype._truncateToN=function(lo,fo,ho){var go;if(Xr.isBN(lo)||typeof lo=="number")lo=new Xr(lo,16),go=lo.byteLength();else if(typeof lo=="object")go=lo.length,lo=new Xr(lo,16);else{var yo=lo.toString();go=yo.length+1>>>1,lo=new Xr(yo,16)}typeof ho!="number"&&(ho=go*8);var vo=ho-this.n.bitLength();return vo>0&&(lo=lo.ushrn(vo)),!fo&&lo.cmp(this.n)>=0?lo.sub(this.n):lo},so.prototype.sign=function(lo,fo,ho,go){typeof ho=="object"&&(go=ho,ho=null),go||(go={}),fo=this.keyFromPrivate(fo,ho),lo=this._truncateToN(lo,!1,go.msgBitLength);for(var yo=this.n.byteLength(),vo=fo.getPrivate().toArray("be",yo),wo=lo.toArray("be",yo),Eo=new eo({hash:this.hash,entropy:vo,nonce:wo,pers:go.pers,persEnc:go.persEnc||"utf8"}),ko=this.n.sub(new Xr(1)),Ao=0;;Ao++){var Po=go.k?go.k(Ao):new Xr(Eo.generate(this.n.byteLength()));if(Po=this._truncateToN(Po,!0),!(Po.cmpn(1)<=0||Po.cmp(ko)>=0)){var jo=this.g.mul(Po);if(!jo.isInfinity()){var Mo=jo.getX(),No=Mo.umod(this.n);if(No.cmpn(0)!==0){var Do=Po.invm(this.n).mul(No.mul(fo.getPrivate()).iadd(lo));if(Do=Do.umod(this.n),Do.cmpn(0)!==0){var Fo=(jo.getY().isOdd()?1:0)|(Mo.cmp(No)!==0?2:0);return go.canonical&&Do.cmp(this.nh)>0&&(Do=this.n.sub(Do),Fo^=1),new ao({r:No,s:Do,recoveryParam:Fo})}}}}}},so.prototype.verify=function(lo,fo,ho,go,yo){yo||(yo={}),lo=this._truncateToN(lo,!1,yo.msgBitLength),ho=this.keyFromPublic(ho,go),fo=new ao(fo,"hex");var vo=fo.r,wo=fo.s;if(vo.cmpn(1)<0||vo.cmp(this.n)>=0||wo.cmpn(1)<0||wo.cmp(this.n)>=0)return!1;var Eo=wo.invm(this.n),ko=Eo.mul(lo).umod(this.n),Ao=Eo.mul(vo).umod(this.n),Po;return this.curve._maxwellTrick?(Po=this.g.jmulAdd(ko,ho.getPublic(),Ao),Po.isInfinity()?!1:Po.eqXToP(vo)):(Po=this.g.mulAdd(ko,ho.getPublic(),Ao),Po.isInfinity()?!1:Po.getX().umod(this.n).cmp(vo)===0)},so.prototype.recoverPubKey=function(co,lo,fo,ho){io((3&fo)===fo,"The recovery param is more than two bits"),lo=new ao(lo,ho);var go=this.n,yo=new Xr(co),vo=lo.r,wo=lo.s,Eo=fo&1,ko=fo>>1;if(vo.cmp(this.curve.p.umod(this.curve.n))>=0&&ko)throw new Error("Unable to find sencond key candinate");ko?vo=this.curve.pointFromX(vo.add(this.curve.n),Eo):vo=this.curve.pointFromX(vo,Eo);var Ao=lo.r.invm(go),Po=go.sub(yo).mul(Ao).umod(go),jo=wo.mul(Ao).umod(go);return this.g.mulAdd(Po,vo,jo)},so.prototype.getKeyRecoveryParam=function(co,lo,fo,ho){if(lo=new ao(lo,ho),lo.recoveryParam!==null)return lo.recoveryParam;for(var go=0;go<4;go++){var yo;try{yo=this.recoverPubKey(co,lo,go)}catch{continue}if(yo.eq(fo))return go}throw new Error("Unable to find valid recovery factor")},ec}var key,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key;hasRequiredKey=1;var Xr=requireUtils$2(),eo=Xr.assert,to=Xr.parseBytes,ro=Xr.cachedProperty;function no(io,oo){this.eddsa=io,this._secret=to(oo.secret),io.isPoint(oo.pub)?this._pub=oo.pub:this._pubBytes=to(oo.pub)}return no.fromPublic=function(oo,ao){return ao instanceof no?ao:new no(oo,{pub:ao})},no.fromSecret=function(oo,ao){return ao instanceof no?ao:new no(oo,{secret:ao})},no.prototype.secret=function(){return this._secret},ro(no,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),ro(no,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),ro(no,"privBytes",function(){var oo=this.eddsa,ao=this.hash(),so=oo.encodingLength-1,co=ao.slice(0,oo.encodingLength);return co[0]&=248,co[so]&=127,co[so]|=64,co}),ro(no,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),ro(no,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),ro(no,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),no.prototype.sign=function(oo){return eo(this._secret,"KeyPair can only verify"),this.eddsa.sign(oo,this)},no.prototype.verify=function(oo,ao){return this.eddsa.verify(oo,ao,this)},no.prototype.getSecret=function(oo){return eo(this._secret,"KeyPair is public only"),Xr.encode(this.secret(),oo)},no.prototype.getPublic=function(oo){return Xr.encode(this.pubBytes(),oo)},key=no,key}var signature$1,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$1;hasRequiredSignature=1;var Xr=requireBn$2(),eo=requireUtils$2(),to=eo.assert,ro=eo.cachedProperty,no=eo.parseBytes;function io(oo,ao){this.eddsa=oo,typeof ao!="object"&&(ao=no(ao)),Array.isArray(ao)&&(to(ao.length===oo.encodingLength*2,"Signature has invalid size"),ao={R:ao.slice(0,oo.encodingLength),S:ao.slice(oo.encodingLength)}),to(ao.R&&ao.S,"Signature without R or S"),oo.isPoint(ao.R)&&(this._R=ao.R),ao.S instanceof Xr&&(this._S=ao.S),this._Rencoded=Array.isArray(ao.R)?ao.R:ao.Rencoded,this._Sencoded=Array.isArray(ao.S)?ao.S:ao.Sencoded}return ro(io,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),ro(io,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),ro(io,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),ro(io,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),io.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},io.prototype.toHex=function(){return eo.encode(this.toBytes(),"hex").toUpperCase()},signature$1=io,signature$1}var eddsa,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa;hasRequiredEddsa=1;var Xr=requireHash(),eo=requireCurves(),to=requireUtils$2(),ro=to.assert,no=to.parseBytes,io=requireKey(),oo=requireSignature();function ao(so){if(ro(so==="ed25519","only tested with ed25519 so far"),!(this instanceof ao))return new ao(so);so=eo[so].curve,this.curve=so,this.g=so.g,this.g.precompute(so.n.bitLength()+1),this.pointClass=so.point().constructor,this.encodingLength=Math.ceil(so.n.bitLength()/8),this.hash=Xr.sha512}return eddsa=ao,ao.prototype.sign=function(co,lo){co=no(co);var fo=this.keyFromSecret(lo),ho=this.hashInt(fo.messagePrefix(),co),go=this.g.mul(ho),yo=this.encodePoint(go),vo=this.hashInt(yo,fo.pubBytes(),co).mul(fo.priv()),wo=ho.add(vo).umod(this.curve.n);return this.makeSignature({R:go,S:wo,Rencoded:yo})},ao.prototype.verify=function(co,lo,fo){if(co=no(co),lo=this.makeSignature(lo),lo.S().gte(lo.eddsa.curve.n)||lo.S().isNeg())return!1;var ho=this.keyFromPublic(fo),go=this.hashInt(lo.Rencoded(),ho.pubBytes(),co),yo=this.g.mul(lo.S()),vo=lo.R().add(ho.pub().mul(go));return vo.eq(yo)},ao.prototype.hashInt=function(){for(var co=this.hash(),lo=0;lo0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)}(bn$5)),bn$5.exports}var asn1$1={},asn1={},api$1={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(Xr,eo){if(Xr.indexOf)return Xr.indexOf(eo);for(var to=0;to=0,qo+Ko.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Xo>60?Yo[0]+(Ho===""?"":Ho+` + `)+" "+Lo.join(`, + `)+" "+Yo[1]:Yo[0]+Ho+" "+Lo.join(", ")+" "+Yo[1]}Xr.types=requireTypes$2();function $o(Lo){return Array.isArray(Lo)}Xr.isArray=$o;function Co(Lo){return typeof Lo=="boolean"}Xr.isBoolean=Co;function Ro(Lo){return Lo===null}Xr.isNull=Ro;function Oo(Lo){return Lo==null}Xr.isNullOrUndefined=Oo;function jo(Lo){return typeof Lo=="number"}Xr.isNumber=jo;function Bo(Lo){return typeof Lo=="string"}Xr.isString=Bo;function Mo(Lo){return typeof Lo=="symbol"}Xr.isSymbol=Mo;function Fo(Lo){return Lo===void 0}Xr.isUndefined=Fo;function Wo(Lo){return Jo(Lo)&&_o(Lo)==="[object RegExp]"}Xr.isRegExp=Wo,Xr.types.isRegExp=Wo;function Jo(Lo){return typeof Lo=="object"&&Lo!==null}Xr.isObject=Jo;function Po(Lo){return Jo(Lo)&&_o(Lo)==="[object Date]"}Xr.isDate=Po,Xr.types.isDate=Po;function fo(Lo){return Jo(Lo)&&(_o(Lo)==="[object Error]"||Lo instanceof Error)}Xr.isError=fo,Xr.types.isNativeError=fo;function yo(Lo){return typeof Lo=="function"}Xr.isFunction=yo;function vo(Lo){return Lo===null||typeof Lo=="boolean"||typeof Lo=="number"||typeof Lo=="string"||typeof Lo=="symbol"||typeof Lo>"u"}Xr.isPrimitive=vo,Xr.isBuffer=requireIsBufferBrowser();function _o(Lo){return Object.prototype.toString.call(Lo)}function So(Lo){return Lo<10?"0"+Lo.toString(10):Lo.toString(10)}var To=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ao(){var Lo=new Date,Ho=[So(Lo.getHours()),So(Lo.getMinutes()),So(Lo.getSeconds())].join(":");return[Lo.getDate(),To[Lo.getMonth()],Ho].join(" ")}Xr.log=function(){console.log("%s - %s",Ao(),Xr.format.apply(Xr,arguments))},Xr.inherits=requireInherits_browser(),Xr._extend=function(Lo,Ho){if(!Ho||!Jo(Ho))return Lo;for(var Yo=Object.keys(Ho),Xo=Yo.length;Xo--;)Lo[Yo[Xo]]=Ho[Yo[Xo]];return Lo};function ko(Lo,Ho){return Object.prototype.hasOwnProperty.call(Lo,Ho)}var mo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Xr.promisify=function(Ho){if(typeof Ho!="function")throw new TypeError('The "original" argument must be of type Function');if(mo&&Ho[mo]){var Yo=Ho[mo];if(typeof Yo!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Yo,mo,{value:Yo,enumerable:!1,writable:!1,configurable:!0}),Yo}function Yo(){for(var Xo,qo,Ko=new Promise(function(ga,$a){Xo=ga,qo=$a}),Qo=[],zo=0;zo0?this.tail.next=$o:this.head=$o,this.tail=$o,++this.length}},{key:"unshift",value:function(Eo){var $o={data:Eo,next:this.head};this.length===0&&(this.tail=$o),this.head=$o,++this.length}},{key:"shift",value:function(){if(this.length!==0){var Eo=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Eo}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(Eo){if(this.length===0)return"";for(var $o=this.head,Co=""+$o.data;$o=$o.next;)Co+=Eo+$o.data;return Co}},{key:"concat",value:function(Eo){if(this.length===0)return co.alloc(0);for(var $o=co.allocUnsafe(Eo>>>0),Co=this.head,Ro=0;Co;)go(Co.data,$o,Ro),Ro+=Co.data.length,Co=Co.next;return $o}},{key:"consume",value:function(Eo,$o){var Co;return EoOo.length?Oo.length:Eo;if(jo===Oo.length?Ro+=Oo:Ro+=Oo.slice(0,Eo),Eo-=jo,Eo===0){jo===Oo.length?(++Co,$o.next?this.head=$o.next:this.head=this.tail=null):(this.head=$o,$o.data=Oo.slice(jo));break}++Co}return this.length-=Co,Ro}},{key:"_getBuffer",value:function(Eo){var $o=co.allocUnsafe(Eo),Co=this.head,Ro=1;for(Co.data.copy($o),Eo-=Co.data.length;Co=Co.next;){var Oo=Co.data,jo=Eo>Oo.length?Oo.length:Eo;if(Oo.copy($o,$o.length-Eo,0,jo),Eo-=jo,Eo===0){jo===Oo.length?(++Ro,Co.next?this.head=Co.next:this.head=this.tail=null):(this.head=Co,Co.data=Oo.slice(jo));break}++Ro}return this.length-=Ro,$o}},{key:ho,value:function(Eo,$o){return uo(this,eo(eo({},$o),{},{depth:0,customInspect:!1}))}}]),bo}(),buffer_list}var destroy_1$1,hasRequiredDestroy$1;function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;hasRequiredDestroy$1=1;function Xr(oo,ao){var so=this,co=this._readableState&&this._readableState.destroyed,lo=this._writableState&&this._writableState.destroyed;return co||lo?(ao?ao(oo):oo&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(no,this,oo)):process$1$1.nextTick(no,this,oo)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(oo||null,function(uo){!ao&&uo?so._writableState?so._writableState.errorEmitted?process$1$1.nextTick(to,so):(so._writableState.errorEmitted=!0,process$1$1.nextTick(eo,so,uo)):process$1$1.nextTick(eo,so,uo):ao?(process$1$1.nextTick(to,so),ao(uo)):process$1$1.nextTick(to,so)}),this)}function eo(oo,ao){no(oo,ao),to(oo)}function to(oo){oo._writableState&&!oo._writableState.emitClose||oo._readableState&&!oo._readableState.emitClose||oo.emit("close")}function ro(){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)}function no(oo,ao){oo.emit("error",ao)}function io(oo,ao){var so=oo._readableState,co=oo._writableState;so&&so.autoDestroy||co&&co.autoDestroy?oo.destroy(ao):oo.emit("error",ao)}return destroy_1$1={destroy:Xr,undestroy:ro,errorOrDestroy:io},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function Xr(ao,so){ao.prototype=Object.create(so.prototype),ao.prototype.constructor=ao,ao.__proto__=so}var eo={};function to(ao,so,co){co||(co=Error);function lo(ho,go,bo){return typeof so=="string"?so:so(ho,go,bo)}var uo=function(ho){Xr(go,ho);function go(bo,wo,Eo){return ho.call(this,lo(bo,wo,Eo))||this}return go}(co);uo.prototype.name=co.name,uo.prototype.code=ao,eo[ao]=uo}function ro(ao,so){if(Array.isArray(ao)){var co=ao.length;return ao=ao.map(function(lo){return String(lo)}),co>2?"one of ".concat(so," ").concat(ao.slice(0,co-1).join(", "),", or ")+ao[co-1]:co===2?"one of ".concat(so," ").concat(ao[0]," or ").concat(ao[1]):"of ".concat(so," ").concat(ao[0])}else return"of ".concat(so," ").concat(String(ao))}function no(ao,so,co){return ao.substr(0,so.length)===so}function io(ao,so,co){return(co===void 0||co>ao.length)&&(co=ao.length),ao.substring(co-so.length,co)===so}function oo(ao,so,co){return typeof co!="number"&&(co=0),co+so.length>ao.length?!1:ao.indexOf(so,co)!==-1}return to("ERR_INVALID_OPT_VALUE",function(ao,so){return'The value "'+so+'" is invalid for option "'+ao+'"'},TypeError),to("ERR_INVALID_ARG_TYPE",function(ao,so,co){var lo;typeof so=="string"&&no(so,"not ")?(lo="must not be",so=so.replace(/^not /,"")):lo="must be";var uo;if(io(ao," argument"))uo="The ".concat(ao," ").concat(lo," ").concat(ro(so,"type"));else{var ho=oo(ao,".")?"property":"argument";uo='The "'.concat(ao,'" ').concat(ho," ").concat(lo," ").concat(ro(so,"type"))}return uo+=". Received type ".concat(typeof co),uo},TypeError),to("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),to("ERR_METHOD_NOT_IMPLEMENTED",function(ao){return"The "+ao+" method is not implemented"}),to("ERR_STREAM_PREMATURE_CLOSE","Premature close"),to("ERR_STREAM_DESTROYED",function(ao){return"Cannot call "+ao+" after a stream was destroyed"}),to("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),to("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),to("ERR_STREAM_WRITE_AFTER_END","write after end"),to("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),to("ERR_UNKNOWN_ENCODING",function(ao){return"Unknown encoding: "+ao},TypeError),to("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=eo,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var Xr=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function eo(ro,no,io){return ro.highWaterMark!=null?ro.highWaterMark:no?ro[io]:null}function to(ro,no,io,oo){var ao=eo(no,oo,io);if(ao!=null){if(!(isFinite(ao)&&Math.floor(ao)===ao)||ao<0){var so=oo?io:"highWaterMark";throw new Xr(so,ao)}return Math.floor(ao)}return ro.objectMode?16:16*1024}return state={getHighWaterMark:to},state}var browser$f,hasRequiredBrowser$a;function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$f;hasRequiredBrowser$a=1,browser$f=Xr;function Xr(to,ro){if(eo("noDeprecation"))return to;var no=!1;function io(){if(!no){if(eo("throwDeprecation"))throw new Error(ro);eo("traceDeprecation")?console.trace(ro):console.warn(ro),no=!0}return to.apply(this,arguments)}return io}function eo(to){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var ro=commonjsGlobal.localStorage[to];return ro==null?!1:String(ro).toLowerCase()==="true"}return browser$f}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=Fo;function Xr(Xo){var qo=this;this.next=null,this.entry=null,this.finish=function(){Yo(qo,Xo)}}var eo;Fo.WritableState=Bo;var to={deprecate:requireBrowser$a()},ro=requireStreamBrowser$1(),no=require$$0$9.Buffer,io=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oo(Xo){return no.from(Xo)}function ao(Xo){return no.isBuffer(Xo)||Xo instanceof io}var so=requireDestroy$1(),co=requireState(),lo=co.getHighWaterMark,uo=requireErrorsBrowser().codes,ho=uo.ERR_INVALID_ARG_TYPE,go=uo.ERR_METHOD_NOT_IMPLEMENTED,bo=uo.ERR_MULTIPLE_CALLBACK,wo=uo.ERR_STREAM_CANNOT_PIPE,Eo=uo.ERR_STREAM_DESTROYED,$o=uo.ERR_STREAM_NULL_VALUES,Co=uo.ERR_STREAM_WRITE_AFTER_END,Ro=uo.ERR_UNKNOWN_ENCODING,Oo=so.errorOrDestroy;requireInherits_browser()(Fo,ro);function jo(){}function Bo(Xo,qo,Ko){eo=eo||require_stream_duplex$1(),Xo=Xo||{},typeof Ko!="boolean"&&(Ko=qo instanceof eo),this.objectMode=!!Xo.objectMode,Ko&&(this.objectMode=this.objectMode||!!Xo.writableObjectMode),this.highWaterMark=lo(this,Xo,"writableHighWaterMark",Ko),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Qo=Xo.decodeStrings===!1;this.decodeStrings=!Qo,this.defaultEncoding=Xo.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(zo){So(qo,zo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Xo.emitClose!==!1,this.autoDestroy=!!Xo.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Xr(this)}Bo.prototype.getBuffer=function(){for(var qo=this.bufferedRequest,Ko=[];qo;)Ko.push(qo),qo=qo.next;return Ko},function(){try{Object.defineProperty(Bo.prototype,"buffer",{get:to.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Mo;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Mo=Function.prototype[Symbol.hasInstance],Object.defineProperty(Fo,Symbol.hasInstance,{value:function(qo){return Mo.call(this,qo)?!0:this!==Fo?!1:qo&&qo._writableState instanceof Bo}})):Mo=function(qo){return qo instanceof this};function Fo(Xo){eo=eo||require_stream_duplex$1();var qo=this instanceof eo;if(!qo&&!Mo.call(Fo,this))return new Fo(Xo);this._writableState=new Bo(Xo,this,qo),this.writable=!0,Xo&&(typeof Xo.write=="function"&&(this._write=Xo.write),typeof Xo.writev=="function"&&(this._writev=Xo.writev),typeof Xo.destroy=="function"&&(this._destroy=Xo.destroy),typeof Xo.final=="function"&&(this._final=Xo.final)),ro.call(this)}Fo.prototype.pipe=function(){Oo(this,new wo)};function Wo(Xo,qo){var Ko=new Co;Oo(Xo,Ko),process$1$1.nextTick(qo,Ko)}function Jo(Xo,qo,Ko,Qo){var zo;return Ko===null?zo=new $o:typeof Ko!="string"&&!qo.objectMode&&(zo=new ho("chunk",["string","Buffer"],Ko)),zo?(Oo(Xo,zo),process$1$1.nextTick(Qo,zo),!1):!0}Fo.prototype.write=function(Xo,qo,Ko){var Qo=this._writableState,zo=!1,ga=!Qo.objectMode&&ao(Xo);return ga&&!no.isBuffer(Xo)&&(Xo=oo(Xo)),typeof qo=="function"&&(Ko=qo,qo=null),ga?qo="buffer":qo||(qo=Qo.defaultEncoding),typeof Ko!="function"&&(Ko=jo),Qo.ending?Wo(this,Ko):(ga||Jo(this,Qo,Xo,Ko))&&(Qo.pendingcb++,zo=fo(this,Qo,ga,Xo,qo,Ko)),zo},Fo.prototype.cork=function(){this._writableState.corked++},Fo.prototype.uncork=function(){var Xo=this._writableState;Xo.corked&&(Xo.corked--,!Xo.writing&&!Xo.corked&&!Xo.bufferProcessing&&Xo.bufferedRequest&&ko(this,Xo))},Fo.prototype.setDefaultEncoding=function(qo){if(typeof qo=="string"&&(qo=qo.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((qo+"").toLowerCase())>-1))throw new Ro(qo);return this._writableState.defaultEncoding=qo,this},Object.defineProperty(Fo.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Po(Xo,qo,Ko){return!Xo.objectMode&&Xo.decodeStrings!==!1&&typeof qo=="string"&&(qo=no.from(qo,Ko)),qo}Object.defineProperty(Fo.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function fo(Xo,qo,Ko,Qo,zo,ga){if(!Ko){var $a=Po(qo,Qo,zo);Qo!==$a&&(Ko=!0,zo="buffer",Qo=$a)}var Sl=qo.objectMode?1:Qo.length;qo.length+=Sl;var El=qo.length>5===6?2:$o>>4===14?3:$o>>3===30?4:$o>>6===2?-1:-2}function oo($o,Co,Ro){var Oo=Co.length-1;if(Oo=0?(jo>0&&($o.lastNeed=jo-1),jo):--Oo=0?(jo>0&&($o.lastNeed=jo-2),jo):--Oo=0?(jo>0&&(jo===2?jo=0:$o.lastNeed=jo-3),jo):0))}function ao($o,Co,Ro){if((Co[0]&192)!==128)return $o.lastNeed=0,"�";if($o.lastNeed>1&&Co.length>1){if((Co[1]&192)!==128)return $o.lastNeed=1,"�";if($o.lastNeed>2&&Co.length>2&&(Co[2]&192)!==128)return $o.lastNeed=2,"�"}}function so($o){var Co=this.lastTotal-this.lastNeed,Ro=ao(this,$o);if(Ro!==void 0)return Ro;if(this.lastNeed<=$o.length)return $o.copy(this.lastChar,Co,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$o.copy(this.lastChar,Co,0,$o.length),this.lastNeed-=$o.length}function co($o,Co){var Ro=oo(this,$o,Co);if(!this.lastNeed)return $o.toString("utf8",Co);this.lastTotal=Ro;var Oo=$o.length-(Ro-this.lastNeed);return $o.copy(this.lastChar,0,Oo),$o.toString("utf8",Co,Oo)}function lo($o){var Co=$o&&$o.length?this.write($o):"";return this.lastNeed?Co+"�":Co}function uo($o,Co){if(($o.length-Co)%2===0){var Ro=$o.toString("utf16le",Co);if(Ro){var Oo=Ro.charCodeAt(Ro.length-1);if(Oo>=55296&&Oo<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$o[$o.length-2],this.lastChar[1]=$o[$o.length-1],Ro.slice(0,-1)}return Ro}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$o[$o.length-1],$o.toString("utf16le",Co,$o.length-1)}function ho($o){var Co=$o&&$o.length?this.write($o):"";if(this.lastNeed){var Ro=this.lastTotal-this.lastNeed;return Co+this.lastChar.toString("utf16le",0,Ro)}return Co}function go($o,Co){var Ro=($o.length-Co)%3;return Ro===0?$o.toString("base64",Co):(this.lastNeed=3-Ro,this.lastTotal=3,Ro===1?this.lastChar[0]=$o[$o.length-1]:(this.lastChar[0]=$o[$o.length-2],this.lastChar[1]=$o[$o.length-1]),$o.toString("base64",Co,$o.length-Ro))}function bo($o){var Co=$o&&$o.length?this.write($o):"";return this.lastNeed?Co+this.lastChar.toString("base64",0,3-this.lastNeed):Co}function wo($o){return $o.toString(this.encoding)}function Eo($o){return $o&&$o.length?this.write($o):""}return string_decoder}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var Xr=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function eo(io){var oo=!1;return function(){if(!oo){oo=!0;for(var ao=arguments.length,so=new Array(ao),co=0;co0)if(typeof $a!="string"&&!Il.objectMode&&Object.getPrototypeOf($a)!==ro.prototype&&($a=io($a)),El)Il.endEmitted?jo(ga,new $o):Po(ga,Il,$a,!0);else if(Il.ended)jo(ga,new wo);else{if(Il.destroyed)return!1;Il.reading=!1,Il.decoder&&!Sl?($a=Il.decoder.write($a),Il.objectMode||$a.length!==0?Po(ga,Il,$a,!1):ko(ga,Il)):Po(ga,Il,$a,!1)}else El||(Il.reading=!1,ko(ga,Il))}return!Il.ended&&(Il.length=yo?ga=yo:(ga--,ga|=ga>>>1,ga|=ga>>>2,ga|=ga>>>4,ga|=ga>>>8,ga|=ga>>>16,ga++),ga}function _o(ga,$a){return ga<=0||$a.length===0&&$a.ended?0:$a.objectMode?1:ga!==ga?$a.flowing&&$a.length?$a.buffer.head.data.length:$a.length:(ga>$a.highWaterMark&&($a.highWaterMark=vo(ga)),ga<=$a.length?ga:$a.ended?$a.length:($a.needReadable=!0,0))}Wo.prototype.read=function(ga){so("read",ga),ga=parseInt(ga,10);var $a=this._readableState,Sl=ga;if(ga!==0&&($a.emittedReadable=!1),ga===0&&$a.needReadable&&(($a.highWaterMark!==0?$a.length>=$a.highWaterMark:$a.length>0)||$a.ended))return so("read: emitReadable",$a.length,$a.ended),$a.length===0&&$a.ended?Ko(this):To(this),null;if(ga=_o(ga,$a),ga===0&&$a.ended)return $a.length===0&&Ko(this),null;var El=$a.needReadable;so("need readable",El),($a.length===0||$a.length-ga<$a.highWaterMark)&&(El=!0,so("length less than watermark",El)),$a.ended||$a.reading?(El=!1,so("reading or ended",El)):El&&(so("do read"),$a.reading=!0,$a.sync=!0,$a.length===0&&($a.needReadable=!0),this._read($a.highWaterMark),$a.sync=!1,$a.reading||(ga=_o(Sl,$a)));var Tl;return ga>0?Tl=qo(ga,$a):Tl=null,Tl===null?($a.needReadable=$a.length<=$a.highWaterMark,ga=0):($a.length-=ga,$a.awaitDrain=0),$a.length===0&&($a.ended||($a.needReadable=!0),Sl!==ga&&$a.ended&&Ko(this)),Tl!==null&&this.emit("data",Tl),Tl};function So(ga,$a){if(so("onEofChunk"),!$a.ended){if($a.decoder){var Sl=$a.decoder.end();Sl&&Sl.length&&($a.buffer.push(Sl),$a.length+=$a.objectMode?1:Sl.length)}$a.ended=!0,$a.sync?To(ga):($a.needReadable=!1,$a.emittedReadable||($a.emittedReadable=!0,Ao(ga)))}}function To(ga){var $a=ga._readableState;so("emitReadable",$a.needReadable,$a.emittedReadable),$a.needReadable=!1,$a.emittedReadable||(so("emitReadable",$a.flowing),$a.emittedReadable=!0,process$1$1.nextTick(Ao,ga))}function Ao(ga){var $a=ga._readableState;so("emitReadable_",$a.destroyed,$a.length,$a.ended),!$a.destroyed&&($a.length||$a.ended)&&(ga.emit("readable"),$a.emittedReadable=!1),$a.needReadable=!$a.flowing&&!$a.ended&&$a.length<=$a.highWaterMark,Xo(ga)}function ko(ga,$a){$a.readingMore||($a.readingMore=!0,process$1$1.nextTick(mo,ga,$a))}function mo(ga,$a){for(;!$a.reading&&!$a.ended&&($a.length<$a.highWaterMark||$a.flowing&&$a.length===0);){var Sl=$a.length;if(so("maybeReadMore read 0"),ga.read(0),Sl===$a.length)break}$a.readingMore=!1}Wo.prototype._read=function(ga){jo(this,new Eo("_read()"))},Wo.prototype.pipe=function(ga,$a){var Sl=this,El=this._readableState;switch(El.pipesCount){case 0:El.pipes=ga;break;case 1:El.pipes=[El.pipes,ga];break;default:El.pipes.push(ga);break}El.pipesCount+=1,so("pipe count=%d opts=%j",El.pipesCount,$a);var Tl=(!$a||$a.end!==!1)&&ga!==process$1$1.stdout&&ga!==process$1$1.stderr,Il=Tl?Vl:ku;El.endEmitted?process$1$1.nextTick(Il):Sl.once("end",Il),ga.on("unpipe",Zl);function Zl(iu,hu){so("onunpipe"),iu===Sl&&hu&&hu.hasUnpiped===!1&&(hu.hasUnpiped=!0,Fl())}function Vl(){so("onend"),ga.end()}var Ol=Io(Sl);ga.on("drain",Ol);var Dl=!1;function Fl(){so("cleanup"),ga.removeListener("close",Ll),ga.removeListener("finish",Xl),ga.removeListener("drain",Ol),ga.removeListener("error",cu),ga.removeListener("unpipe",Zl),Sl.removeListener("end",Vl),Sl.removeListener("end",ku),Sl.removeListener("data",Jl),Dl=!0,El.awaitDrain&&(!ga._writableState||ga._writableState.needDrain)&&Ol()}Sl.on("data",Jl);function Jl(iu){so("ondata");var hu=ga.write(iu);so("dest.write",hu),hu===!1&&((El.pipesCount===1&&El.pipes===ga||El.pipesCount>1&&zo(El.pipes,ga)!==-1)&&!Dl&&(so("false write response, pause",El.awaitDrain),El.awaitDrain++),Sl.pause())}function cu(iu){so("onerror",iu),ku(),ga.removeListener("error",cu),eo(ga,"error")===0&&jo(ga,iu)}Mo(ga,"error",cu);function Ll(){ga.removeListener("finish",Xl),ku()}ga.once("close",Ll);function Xl(){so("onfinish"),ga.removeListener("close",Ll),ku()}ga.once("finish",Xl);function ku(){so("unpipe"),Sl.unpipe(ga)}return ga.emit("pipe",Sl),El.flowing||(so("pipe resume"),Sl.resume()),ga};function Io(ga){return function(){var Sl=ga._readableState;so("pipeOnDrain",Sl.awaitDrain),Sl.awaitDrain&&Sl.awaitDrain--,Sl.awaitDrain===0&&eo(ga,"data")&&(Sl.flowing=!0,Xo(ga))}}Wo.prototype.unpipe=function(ga){var $a=this._readableState,Sl={hasUnpiped:!1};if($a.pipesCount===0)return this;if($a.pipesCount===1)return ga&&ga!==$a.pipes?this:(ga||(ga=$a.pipes),$a.pipes=null,$a.pipesCount=0,$a.flowing=!1,ga&&ga.emit("unpipe",this,Sl),this);if(!ga){var El=$a.pipes,Tl=$a.pipesCount;$a.pipes=null,$a.pipesCount=0,$a.flowing=!1;for(var Il=0;Il0,El.flowing!==!1&&this.resume()):ga==="readable"&&!El.endEmitted&&!El.readableListening&&(El.readableListening=El.needReadable=!0,El.flowing=!1,El.emittedReadable=!1,so("on readable",El.length,El.reading),El.length?To(this):El.reading||process$1$1.nextTick(Lo,this)),Sl},Wo.prototype.addListener=Wo.prototype.on,Wo.prototype.removeListener=function(ga,$a){var Sl=to.prototype.removeListener.call(this,ga,$a);return ga==="readable"&&process$1$1.nextTick(Do,this),Sl},Wo.prototype.removeAllListeners=function(ga){var $a=to.prototype.removeAllListeners.apply(this,arguments);return(ga==="readable"||ga===void 0)&&process$1$1.nextTick(Do,this),$a};function Do(ga){var $a=ga._readableState;$a.readableListening=ga.listenerCount("readable")>0,$a.resumeScheduled&&!$a.paused?$a.flowing=!0:ga.listenerCount("data")>0&&ga.resume()}function Lo(ga){so("readable nexttick read 0"),ga.read(0)}Wo.prototype.resume=function(){var ga=this._readableState;return ga.flowing||(so("resume"),ga.flowing=!ga.readableListening,Ho(this,ga)),ga.paused=!1,this};function Ho(ga,$a){$a.resumeScheduled||($a.resumeScheduled=!0,process$1$1.nextTick(Yo,ga,$a))}function Yo(ga,$a){so("resume",$a.reading),$a.reading||ga.read(0),$a.resumeScheduled=!1,ga.emit("resume"),Xo(ga),$a.flowing&&!$a.reading&&ga.read(0)}Wo.prototype.pause=function(){return so("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(so("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Xo(ga){var $a=ga._readableState;for(so("flow",$a.flowing);$a.flowing&&ga.read()!==null;);}Wo.prototype.wrap=function(ga){var $a=this,Sl=this._readableState,El=!1;ga.on("end",function(){if(so("wrapped end"),Sl.decoder&&!Sl.ended){var Zl=Sl.decoder.end();Zl&&Zl.length&&$a.push(Zl)}$a.push(null)}),ga.on("data",function(Zl){if(so("wrapped data"),Sl.decoder&&(Zl=Sl.decoder.write(Zl)),!(Sl.objectMode&&Zl==null)&&!(!Sl.objectMode&&(!Zl||!Zl.length))){var Vl=$a.push(Zl);Vl||(El=!0,ga.pause())}});for(var Tl in ga)this[Tl]===void 0&&typeof ga[Tl]=="function"&&(this[Tl]=function(Vl){return function(){return ga[Vl].apply(ga,arguments)}}(Tl));for(var Il=0;Il=$a.length?($a.decoder?Sl=$a.buffer.join(""):$a.buffer.length===1?Sl=$a.buffer.first():Sl=$a.buffer.concat($a.length),$a.buffer.clear()):Sl=$a.buffer.consume(ga,$a.decoder),Sl}function Ko(ga){var $a=ga._readableState;so("endReadable",$a.endEmitted),$a.endEmitted||($a.ended=!0,process$1$1.nextTick(Qo,$a,ga))}function Qo(ga,$a){if(so("endReadableNT",ga.endEmitted,ga.length),!ga.endEmitted&&ga.length===0&&(ga.endEmitted=!0,$a.readable=!1,$a.emit("end"),ga.autoDestroy)){var Sl=$a._writableState;(!Sl||Sl.autoDestroy&&Sl.finished)&&$a.destroy()}}typeof Symbol=="function"&&(Wo.from=function(ga,$a){return Oo===void 0&&(Oo=requireFromBrowser()),Oo(Wo,ga,$a)});function zo(ga,$a){for(var Sl=0,El=ga.length;Sl0;return ao(Co,Oo,jo,function(Bo){Eo||(Eo=Bo),Bo&&$o.forEach(so),!Oo&&($o.forEach(so),wo(Eo))})});return go.reduce(co)}return pipeline_1=uo,pipeline_1}var hasRequiredReadableBrowser$1;function requireReadableBrowser$1(){return hasRequiredReadableBrowser$1||(hasRequiredReadableBrowser$1=1,function(Xr,eo){eo=Xr.exports=require_stream_readable$1(),eo.Stream=eo,eo.Readable=eo,eo.Writable=require_stream_writable$1(),eo.Duplex=require_stream_duplex$1(),eo.Transform=require_stream_transform$1(),eo.PassThrough=require_stream_passthrough$1(),eo.finished=requireEndOfStream(),eo.pipeline=requirePipeline()}(readableBrowser$1,readableBrowser$1.exports)),readableBrowser$1.exports}var hashBase$1,hasRequiredHashBase$1;function requireHashBase$1(){if(hasRequiredHashBase$1)return hashBase$1;hasRequiredHashBase$1=1;var Xr=safeBufferExports.Buffer,eo=requireReadableBrowser$1().Transform,to=requireInherits_browser();function ro(io,oo){if(!Xr.isBuffer(io)&&typeof io!="string")throw new TypeError(oo+" must be a string or a buffer")}function no(io){eo.call(this),this._block=Xr.allocUnsafe(io),this._blockSize=io,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return to(no,eo),no.prototype._transform=function(io,oo,ao){var so=null;try{this.update(io,oo)}catch(co){so=co}ao(so)},no.prototype._flush=function(io){var oo=null;try{this.push(this.digest())}catch(ao){oo=ao}io(oo)},no.prototype.update=function(io,oo){if(ro(io,"Data"),this._finalized)throw new Error("Digest already called");Xr.isBuffer(io)||(io=Xr.from(io,oo));for(var ao=this._block,so=0;this._blockOffset+io.length-so>=this._blockSize;){for(var co=this._blockOffset;co0;++lo)this._length[lo]+=uo,uo=this._length[lo]/4294967296|0,uo>0&&(this._length[lo]-=4294967296*uo);return this},no.prototype._update=function(){throw new Error("_update is not implemented")},no.prototype.digest=function(io){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var oo=this._digest();io!==void 0&&(oo=oo.toString(io)),this._block.fill(0),this._blockOffset=0;for(var ao=0;ao<4;++ao)this._length[ao]=0;return oo},no.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase$1=no,hashBase$1}var md5_js,hasRequiredMd5_js;function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var Xr=requireInherits_browser(),eo=requireHashBase$1(),to=safeBufferExports.Buffer,ro=new Array(16);function no(){eo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}Xr(no,eo),no.prototype._update=function(){for(var lo=ro,uo=0;uo<16;++uo)lo[uo]=this._block.readInt32LE(uo*4);var ho=this._a,go=this._b,bo=this._c,wo=this._d;ho=oo(ho,go,bo,wo,lo[0],3614090360,7),wo=oo(wo,ho,go,bo,lo[1],3905402710,12),bo=oo(bo,wo,ho,go,lo[2],606105819,17),go=oo(go,bo,wo,ho,lo[3],3250441966,22),ho=oo(ho,go,bo,wo,lo[4],4118548399,7),wo=oo(wo,ho,go,bo,lo[5],1200080426,12),bo=oo(bo,wo,ho,go,lo[6],2821735955,17),go=oo(go,bo,wo,ho,lo[7],4249261313,22),ho=oo(ho,go,bo,wo,lo[8],1770035416,7),wo=oo(wo,ho,go,bo,lo[9],2336552879,12),bo=oo(bo,wo,ho,go,lo[10],4294925233,17),go=oo(go,bo,wo,ho,lo[11],2304563134,22),ho=oo(ho,go,bo,wo,lo[12],1804603682,7),wo=oo(wo,ho,go,bo,lo[13],4254626195,12),bo=oo(bo,wo,ho,go,lo[14],2792965006,17),go=oo(go,bo,wo,ho,lo[15],1236535329,22),ho=ao(ho,go,bo,wo,lo[1],4129170786,5),wo=ao(wo,ho,go,bo,lo[6],3225465664,9),bo=ao(bo,wo,ho,go,lo[11],643717713,14),go=ao(go,bo,wo,ho,lo[0],3921069994,20),ho=ao(ho,go,bo,wo,lo[5],3593408605,5),wo=ao(wo,ho,go,bo,lo[10],38016083,9),bo=ao(bo,wo,ho,go,lo[15],3634488961,14),go=ao(go,bo,wo,ho,lo[4],3889429448,20),ho=ao(ho,go,bo,wo,lo[9],568446438,5),wo=ao(wo,ho,go,bo,lo[14],3275163606,9),bo=ao(bo,wo,ho,go,lo[3],4107603335,14),go=ao(go,bo,wo,ho,lo[8],1163531501,20),ho=ao(ho,go,bo,wo,lo[13],2850285829,5),wo=ao(wo,ho,go,bo,lo[2],4243563512,9),bo=ao(bo,wo,ho,go,lo[7],1735328473,14),go=ao(go,bo,wo,ho,lo[12],2368359562,20),ho=so(ho,go,bo,wo,lo[5],4294588738,4),wo=so(wo,ho,go,bo,lo[8],2272392833,11),bo=so(bo,wo,ho,go,lo[11],1839030562,16),go=so(go,bo,wo,ho,lo[14],4259657740,23),ho=so(ho,go,bo,wo,lo[1],2763975236,4),wo=so(wo,ho,go,bo,lo[4],1272893353,11),bo=so(bo,wo,ho,go,lo[7],4139469664,16),go=so(go,bo,wo,ho,lo[10],3200236656,23),ho=so(ho,go,bo,wo,lo[13],681279174,4),wo=so(wo,ho,go,bo,lo[0],3936430074,11),bo=so(bo,wo,ho,go,lo[3],3572445317,16),go=so(go,bo,wo,ho,lo[6],76029189,23),ho=so(ho,go,bo,wo,lo[9],3654602809,4),wo=so(wo,ho,go,bo,lo[12],3873151461,11),bo=so(bo,wo,ho,go,lo[15],530742520,16),go=so(go,bo,wo,ho,lo[2],3299628645,23),ho=co(ho,go,bo,wo,lo[0],4096336452,6),wo=co(wo,ho,go,bo,lo[7],1126891415,10),bo=co(bo,wo,ho,go,lo[14],2878612391,15),go=co(go,bo,wo,ho,lo[5],4237533241,21),ho=co(ho,go,bo,wo,lo[12],1700485571,6),wo=co(wo,ho,go,bo,lo[3],2399980690,10),bo=co(bo,wo,ho,go,lo[10],4293915773,15),go=co(go,bo,wo,ho,lo[1],2240044497,21),ho=co(ho,go,bo,wo,lo[8],1873313359,6),wo=co(wo,ho,go,bo,lo[15],4264355552,10),bo=co(bo,wo,ho,go,lo[6],2734768916,15),go=co(go,bo,wo,ho,lo[13],1309151649,21),ho=co(ho,go,bo,wo,lo[4],4149444226,6),wo=co(wo,ho,go,bo,lo[11],3174756917,10),bo=co(bo,wo,ho,go,lo[2],718787259,15),go=co(go,bo,wo,ho,lo[9],3951481745,21),this._a=this._a+ho|0,this._b=this._b+go|0,this._c=this._c+bo|0,this._d=this._d+wo|0},no.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var lo=to.allocUnsafe(16);return lo.writeInt32LE(this._a,0),lo.writeInt32LE(this._b,4),lo.writeInt32LE(this._c,8),lo.writeInt32LE(this._d,12),lo};function io(lo,uo){return lo<>>32-uo}function oo(lo,uo,ho,go,bo,wo,Eo){return io(lo+(uo&ho|~uo&go)+bo+wo|0,Eo)+uo|0}function ao(lo,uo,ho,go,bo,wo,Eo){return io(lo+(uo&go|ho&~go)+bo+wo|0,Eo)+uo|0}function so(lo,uo,ho,go,bo,wo,Eo){return io(lo+(uo^ho^go)+bo+wo|0,Eo)+uo|0}function co(lo,uo,ho,go,bo,wo,Eo){return io(lo+(ho^(uo|~go))+bo+wo|0,Eo)+uo|0}return md5_js=no,md5_js}var hashBase,hasRequiredHashBase;function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var Xr=safeBufferExports.Buffer,eo=requireReadableBrowser$1().Transform,to=requireInherits_browser();function ro(io,oo){if(!Xr.isBuffer(io)&&typeof io!="string")throw new TypeError(oo+" must be a string or a buffer")}function no(io){eo.call(this),this._block=Xr.allocUnsafe(io),this._blockSize=io,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return to(no,eo),no.prototype._transform=function(io,oo,ao){var so=null;try{this.update(io,oo)}catch(co){so=co}ao(so)},no.prototype._flush=function(io){var oo=null;try{this.push(this.digest())}catch(ao){oo=ao}io(oo)},no.prototype.update=function(io,oo){if(ro(io,"Data"),this._finalized)throw new Error("Digest already called");Xr.isBuffer(io)||(io=Xr.from(io,oo));for(var ao=this._block,so=0;this._blockOffset+io.length-so>=this._blockSize;){for(var co=this._blockOffset;co0;++lo)this._length[lo]+=uo,uo=this._length[lo]/4294967296|0,uo>0&&(this._length[lo]-=4294967296*uo);return this},no.prototype._update=function(){throw new Error("_update is not implemented")},no.prototype.digest=function(io){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var oo=this._digest();io!==void 0&&(oo=oo.toString(io)),this._block.fill(0),this._blockOffset=0;for(var ao=0;ao<4;++ao)this._length[ao]=0;return oo},no.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=no,hashBase}var ripemd160,hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var Xr=require$$0$9.Buffer,eo=requireInherits_browser(),to=requireHashBase(),ro=new Array(16),no=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],io=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],oo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ao=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],so=[0,1518500249,1859775393,2400959708,2840853838],co=[1352829926,1548603684,1836072691,2053994217,0];function lo(){to.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}eo(lo,to),lo.prototype._update=function(){for(var $o=ro,Co=0;Co<16;++Co)$o[Co]=this._block.readInt32LE(Co*4);for(var Ro=this._a|0,Oo=this._b|0,jo=this._c|0,Bo=this._d|0,Mo=this._e|0,Fo=this._a|0,Wo=this._b|0,Jo=this._c|0,Po=this._d|0,fo=this._e|0,yo=0;yo<80;yo+=1){var vo,_o;yo<16?(vo=ho(Ro,Oo,jo,Bo,Mo,$o[no[yo]],so[0],oo[yo]),_o=Eo(Fo,Wo,Jo,Po,fo,$o[io[yo]],co[0],ao[yo])):yo<32?(vo=go(Ro,Oo,jo,Bo,Mo,$o[no[yo]],so[1],oo[yo]),_o=wo(Fo,Wo,Jo,Po,fo,$o[io[yo]],co[1],ao[yo])):yo<48?(vo=bo(Ro,Oo,jo,Bo,Mo,$o[no[yo]],so[2],oo[yo]),_o=bo(Fo,Wo,Jo,Po,fo,$o[io[yo]],co[2],ao[yo])):yo<64?(vo=wo(Ro,Oo,jo,Bo,Mo,$o[no[yo]],so[3],oo[yo]),_o=go(Fo,Wo,Jo,Po,fo,$o[io[yo]],co[3],ao[yo])):(vo=Eo(Ro,Oo,jo,Bo,Mo,$o[no[yo]],so[4],oo[yo]),_o=ho(Fo,Wo,Jo,Po,fo,$o[io[yo]],co[4],ao[yo])),Ro=Mo,Mo=Bo,Bo=uo(jo,10),jo=Oo,Oo=vo,Fo=fo,fo=Po,Po=uo(Jo,10),Jo=Wo,Wo=_o}var So=this._b+jo+Po|0;this._b=this._c+Bo+fo|0,this._c=this._d+Mo+Fo|0,this._d=this._e+Ro+Wo|0,this._e=this._a+Oo+Jo|0,this._a=So},lo.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var $o=Xr.alloc?Xr.alloc(20):new Xr(20);return $o.writeInt32LE(this._a,0),$o.writeInt32LE(this._b,4),$o.writeInt32LE(this._c,8),$o.writeInt32LE(this._d,12),$o.writeInt32LE(this._e,16),$o};function uo($o,Co){return $o<>>32-Co}function ho($o,Co,Ro,Oo,jo,Bo,Mo,Fo){return uo($o+(Co^Ro^Oo)+Bo+Mo|0,Fo)+jo|0}function go($o,Co,Ro,Oo,jo,Bo,Mo,Fo){return uo($o+(Co&Ro|~Co&Oo)+Bo+Mo|0,Fo)+jo|0}function bo($o,Co,Ro,Oo,jo,Bo,Mo,Fo){return uo($o+((Co|~Ro)^Oo)+Bo+Mo|0,Fo)+jo|0}function wo($o,Co,Ro,Oo,jo,Bo,Mo,Fo){return uo($o+(Co&Oo|Ro&~Oo)+Bo+Mo|0,Fo)+jo|0}function Eo($o,Co,Ro,Oo,jo,Bo,Mo,Fo){return uo($o+(Co^(Ro|~Oo))+Bo+Mo|0,Fo)+jo|0}return ripemd160=lo,ripemd160}var sha_js={exports:{}},hash$3,hasRequiredHash$1;function requireHash$1(){if(hasRequiredHash$1)return hash$3;hasRequiredHash$1=1;var Xr=safeBufferExports.Buffer;function eo(to,ro){this._block=Xr.alloc(to),this._finalSize=ro,this._blockSize=to,this._len=0}return eo.prototype.update=function(to,ro){typeof to=="string"&&(ro=ro||"utf8",to=Xr.from(to,ro));for(var no=this._block,io=this._blockSize,oo=to.length,ao=this._len,so=0;so=this._finalSize&&(this._update(this._block),this._block.fill(0));var no=this._len*8;if(no<=4294967295)this._block.writeUInt32BE(no,this._blockSize-4);else{var io=(no&4294967295)>>>0,oo=(no-io)/4294967296;this._block.writeUInt32BE(oo,this._blockSize-8),this._block.writeUInt32BE(io,this._blockSize-4)}this._update(this._block);var ao=this._hash();return to?ao.toString(to):ao},eo.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$3=eo,hash$3}var sha$1,hasRequiredSha$1;function requireSha$1(){if(hasRequiredSha$1)return sha$1;hasRequiredSha$1=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1518500249,1859775393,-1894007588,-899497514],no=new Array(80);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function oo(co){return co<<5|co>>>27}function ao(co){return co<<30|co>>>2}function so(co,lo,uo,ho){return co===0?lo&uo|~lo&ho:co===2?lo&uo|lo&ho|uo&ho:lo^uo^ho}return io.prototype._update=function(co){for(var lo=this._w,uo=this._a|0,ho=this._b|0,go=this._c|0,bo=this._d|0,wo=this._e|0,Eo=0;Eo<16;++Eo)lo[Eo]=co.readInt32BE(Eo*4);for(;Eo<80;++Eo)lo[Eo]=lo[Eo-3]^lo[Eo-8]^lo[Eo-14]^lo[Eo-16];for(var $o=0;$o<80;++$o){var Co=~~($o/20),Ro=oo(uo)+so(Co,ho,go,bo)+wo+lo[$o]+ro[Co]|0;wo=bo,bo=go,go=ao(ho),ho=uo,uo=Ro}this._a=uo+this._a|0,this._b=ho+this._b|0,this._c=go+this._c|0,this._d=bo+this._d|0,this._e=wo+this._e|0},io.prototype._hash=function(){var co=to.allocUnsafe(20);return co.writeInt32BE(this._a|0,0),co.writeInt32BE(this._b|0,4),co.writeInt32BE(this._c|0,8),co.writeInt32BE(this._d|0,12),co.writeInt32BE(this._e|0,16),co},sha$1=io,sha$1}var sha1$2,hasRequiredSha1;function requireSha1(){if(hasRequiredSha1)return sha1$2;hasRequiredSha1=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1518500249,1859775393,-1894007588,-899497514],no=new Array(80);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function oo(lo){return lo<<1|lo>>>31}function ao(lo){return lo<<5|lo>>>27}function so(lo){return lo<<30|lo>>>2}function co(lo,uo,ho,go){return lo===0?uo&ho|~uo&go:lo===2?uo&ho|uo&go|ho&go:uo^ho^go}return io.prototype._update=function(lo){for(var uo=this._w,ho=this._a|0,go=this._b|0,bo=this._c|0,wo=this._d|0,Eo=this._e|0,$o=0;$o<16;++$o)uo[$o]=lo.readInt32BE($o*4);for(;$o<80;++$o)uo[$o]=oo(uo[$o-3]^uo[$o-8]^uo[$o-14]^uo[$o-16]);for(var Co=0;Co<80;++Co){var Ro=~~(Co/20),Oo=ao(ho)+co(Ro,go,bo,wo)+Eo+uo[Co]+ro[Ro]|0;Eo=wo,wo=bo,bo=so(go),go=ho,ho=Oo}this._a=ho+this._a|0,this._b=go+this._b|0,this._c=bo+this._c|0,this._d=wo+this._d|0,this._e=Eo+this._e|0},io.prototype._hash=function(){var lo=to.allocUnsafe(20);return lo.writeInt32BE(this._a|0,0),lo.writeInt32BE(this._b|0,4),lo.writeInt32BE(this._c|0,8),lo.writeInt32BE(this._d|0,12),lo.writeInt32BE(this._e|0,16),lo},sha1$2=io,sha1$2}var sha256$5,hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256$5;hasRequiredSha256=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[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],no=new Array(64);function io(){this.init(),this._w=no,eo.call(this,64,56)}Xr(io,eo),io.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function oo(ho,go,bo){return bo^ho&(go^bo)}function ao(ho,go,bo){return ho&go|bo&(ho|go)}function so(ho){return(ho>>>2|ho<<30)^(ho>>>13|ho<<19)^(ho>>>22|ho<<10)}function co(ho){return(ho>>>6|ho<<26)^(ho>>>11|ho<<21)^(ho>>>25|ho<<7)}function lo(ho){return(ho>>>7|ho<<25)^(ho>>>18|ho<<14)^ho>>>3}function uo(ho){return(ho>>>17|ho<<15)^(ho>>>19|ho<<13)^ho>>>10}return io.prototype._update=function(ho){for(var go=this._w,bo=this._a|0,wo=this._b|0,Eo=this._c|0,$o=this._d|0,Co=this._e|0,Ro=this._f|0,Oo=this._g|0,jo=this._h|0,Bo=0;Bo<16;++Bo)go[Bo]=ho.readInt32BE(Bo*4);for(;Bo<64;++Bo)go[Bo]=uo(go[Bo-2])+go[Bo-7]+lo(go[Bo-15])+go[Bo-16]|0;for(var Mo=0;Mo<64;++Mo){var Fo=jo+co(Co)+oo(Co,Ro,Oo)+ro[Mo]+go[Mo]|0,Wo=so(bo)+ao(bo,wo,Eo)|0;jo=Oo,Oo=Ro,Ro=Co,Co=$o+Fo|0,$o=Eo,Eo=wo,wo=bo,bo=Fo+Wo|0}this._a=bo+this._a|0,this._b=wo+this._b|0,this._c=Eo+this._c|0,this._d=$o+this._d|0,this._e=Co+this._e|0,this._f=Ro+this._f|0,this._g=Oo+this._g|0,this._h=jo+this._h|0},io.prototype._hash=function(){var ho=to.allocUnsafe(32);return ho.writeInt32BE(this._a,0),ho.writeInt32BE(this._b,4),ho.writeInt32BE(this._c,8),ho.writeInt32BE(this._d,12),ho.writeInt32BE(this._e,16),ho.writeInt32BE(this._f,20),ho.writeInt32BE(this._g,24),ho.writeInt32BE(this._h,28),ho},sha256$5=io,sha256$5}var sha224$1,hasRequiredSha224;function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var Xr=requireInherits_browser(),eo=requireSha256(),to=requireHash$1(),ro=safeBufferExports.Buffer,no=new Array(64);function io(){this.init(),this._w=no,to.call(this,64,56)}return Xr(io,eo),io.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},io.prototype._hash=function(){var oo=ro.allocUnsafe(28);return oo.writeInt32BE(this._a,0),oo.writeInt32BE(this._b,4),oo.writeInt32BE(this._c,8),oo.writeInt32BE(this._d,12),oo.writeInt32BE(this._e,16),oo.writeInt32BE(this._f,20),oo.writeInt32BE(this._g,24),oo},sha224$1=io,sha224$1}var sha512$2,hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512$2;hasRequiredSha512=1;var Xr=requireInherits_browser(),eo=requireHash$1(),to=safeBufferExports.Buffer,ro=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],no=new Array(160);function io(){this.init(),this._w=no,eo.call(this,128,112)}Xr(io,eo),io.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function oo(wo,Eo,$o){return $o^wo&(Eo^$o)}function ao(wo,Eo,$o){return wo&Eo|$o&(wo|Eo)}function so(wo,Eo){return(wo>>>28|Eo<<4)^(Eo>>>2|wo<<30)^(Eo>>>7|wo<<25)}function co(wo,Eo){return(wo>>>14|Eo<<18)^(wo>>>18|Eo<<14)^(Eo>>>9|wo<<23)}function lo(wo,Eo){return(wo>>>1|Eo<<31)^(wo>>>8|Eo<<24)^wo>>>7}function uo(wo,Eo){return(wo>>>1|Eo<<31)^(wo>>>8|Eo<<24)^(wo>>>7|Eo<<25)}function ho(wo,Eo){return(wo>>>19|Eo<<13)^(Eo>>>29|wo<<3)^wo>>>6}function go(wo,Eo){return(wo>>>19|Eo<<13)^(Eo>>>29|wo<<3)^(wo>>>6|Eo<<26)}function bo(wo,Eo){return wo>>>0>>0?1:0}return io.prototype._update=function(wo){for(var Eo=this._w,$o=this._ah|0,Co=this._bh|0,Ro=this._ch|0,Oo=this._dh|0,jo=this._eh|0,Bo=this._fh|0,Mo=this._gh|0,Fo=this._hh|0,Wo=this._al|0,Jo=this._bl|0,Po=this._cl|0,fo=this._dl|0,yo=this._el|0,vo=this._fl|0,_o=this._gl|0,So=this._hl|0,To=0;To<32;To+=2)Eo[To]=wo.readInt32BE(To*4),Eo[To+1]=wo.readInt32BE(To*4+4);for(;To<160;To+=2){var Ao=Eo[To-30],ko=Eo[To-15*2+1],mo=lo(Ao,ko),Io=uo(ko,Ao);Ao=Eo[To-2*2],ko=Eo[To-2*2+1];var Do=ho(Ao,ko),Lo=go(ko,Ao),Ho=Eo[To-7*2],Yo=Eo[To-7*2+1],Xo=Eo[To-16*2],qo=Eo[To-16*2+1],Ko=Io+Yo|0,Qo=mo+Ho+bo(Ko,Io)|0;Ko=Ko+Lo|0,Qo=Qo+Do+bo(Ko,Lo)|0,Ko=Ko+qo|0,Qo=Qo+Xo+bo(Ko,qo)|0,Eo[To]=Qo,Eo[To+1]=Ko}for(var zo=0;zo<160;zo+=2){Qo=Eo[zo],Ko=Eo[zo+1];var ga=ao($o,Co,Ro),$a=ao(Wo,Jo,Po),Sl=so($o,Wo),El=so(Wo,$o),Tl=co(jo,yo),Il=co(yo,jo),Zl=ro[zo],Vl=ro[zo+1],Ol=oo(jo,Bo,Mo),Dl=oo(yo,vo,_o),Fl=So+Il|0,Jl=Fo+Tl+bo(Fl,So)|0;Fl=Fl+Dl|0,Jl=Jl+Ol+bo(Fl,Dl)|0,Fl=Fl+Vl|0,Jl=Jl+Zl+bo(Fl,Vl)|0,Fl=Fl+Ko|0,Jl=Jl+Qo+bo(Fl,Ko)|0;var cu=El+$a|0,Ll=Sl+ga+bo(cu,El)|0;Fo=Mo,So=_o,Mo=Bo,_o=vo,Bo=jo,vo=yo,yo=fo+Fl|0,jo=Oo+Jl+bo(yo,fo)|0,Oo=Ro,fo=Po,Ro=Co,Po=Jo,Co=$o,Jo=Wo,Wo=Fl+cu|0,$o=Jl+Ll+bo(Wo,Fl)|0}this._al=this._al+Wo|0,this._bl=this._bl+Jo|0,this._cl=this._cl+Po|0,this._dl=this._dl+fo|0,this._el=this._el+yo|0,this._fl=this._fl+vo|0,this._gl=this._gl+_o|0,this._hl=this._hl+So|0,this._ah=this._ah+$o+bo(this._al,Wo)|0,this._bh=this._bh+Co+bo(this._bl,Jo)|0,this._ch=this._ch+Ro+bo(this._cl,Po)|0,this._dh=this._dh+Oo+bo(this._dl,fo)|0,this._eh=this._eh+jo+bo(this._el,yo)|0,this._fh=this._fh+Bo+bo(this._fl,vo)|0,this._gh=this._gh+Mo+bo(this._gl,_o)|0,this._hh=this._hh+Fo+bo(this._hl,So)|0},io.prototype._hash=function(){var wo=to.allocUnsafe(64);function Eo($o,Co,Ro){wo.writeInt32BE($o,Ro),wo.writeInt32BE(Co,Ro+4)}return Eo(this._ah,this._al,0),Eo(this._bh,this._bl,8),Eo(this._ch,this._cl,16),Eo(this._dh,this._dl,24),Eo(this._eh,this._el,32),Eo(this._fh,this._fl,40),Eo(this._gh,this._gl,48),Eo(this._hh,this._hl,56),wo},sha512$2=io,sha512$2}var sha384$1,hasRequiredSha384;function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var Xr=requireInherits_browser(),eo=requireSha512(),to=requireHash$1(),ro=safeBufferExports.Buffer,no=new Array(160);function io(){this.init(),this._w=no,to.call(this,128,112)}return Xr(io,eo),io.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},io.prototype._hash=function(){var oo=ro.allocUnsafe(48);function ao(so,co,lo){oo.writeInt32BE(so,lo),oo.writeInt32BE(co,lo+4)}return ao(this._ah,this._al,0),ao(this._bh,this._bl,8),ao(this._ch,this._cl,16),ao(this._dh,this._dl,24),ao(this._eh,this._el,32),ao(this._fh,this._fl,40),oo},sha384$1=io,sha384$1}var hasRequiredSha_js;function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var Xr=sha_js.exports=function(to){to=to.toLowerCase();var ro=Xr[to];if(!ro)throw new Error(to+" is not supported (we accept pull requests)");return new ro};return Xr.sha=requireSha$1(),Xr.sha1=requireSha1(),Xr.sha224=requireSha224(),Xr.sha256=requireSha256(),Xr.sha384=requireSha384(),Xr.sha512=requireSha512(),sha_js.exports}var streamBrowserify,hasRequiredStreamBrowserify;function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=to;var Xr=eventsExports.EventEmitter,eo=requireInherits_browser();eo(to,Xr),to.Readable=require_stream_readable$1(),to.Writable=require_stream_writable$1(),to.Duplex=require_stream_duplex$1(),to.Transform=require_stream_transform$1(),to.PassThrough=require_stream_passthrough$1(),to.finished=requireEndOfStream(),to.pipeline=requirePipeline(),to.Stream=to;function to(){Xr.call(this)}return to.prototype.pipe=function(ro,no){var io=this;function oo(go){ro.writable&&ro.write(go)===!1&&io.pause&&io.pause()}io.on("data",oo);function ao(){io.readable&&io.resume&&io.resume()}ro.on("drain",ao),!ro._isStdio&&(!no||no.end!==!1)&&(io.on("end",co),io.on("close",lo));var so=!1;function co(){so||(so=!0,ro.end())}function lo(){so||(so=!0,typeof ro.destroy=="function"&&ro.destroy())}function uo(go){if(ho(),Xr.listenerCount(this,"error")===0)throw go}io.on("error",uo),ro.on("error",uo);function ho(){io.removeListener("data",oo),ro.removeListener("drain",ao),io.removeListener("end",co),io.removeListener("close",lo),io.removeListener("error",uo),ro.removeListener("error",uo),io.removeListener("end",ho),io.removeListener("close",ho),ro.removeListener("close",ho)}return io.on("end",ho),io.on("close",ho),ro.on("close",ho),ro.emit("pipe",io),ro},streamBrowserify}var cipherBase,hasRequiredCipherBase;function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var Xr=safeBufferExports.Buffer,eo=requireStreamBrowserify().Transform,to=requireString_decoder().StringDecoder,ro=requireInherits_browser();function no(io){eo.call(this),this.hashMode=typeof io=="string",this.hashMode?this[io]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return ro(no,eo),no.prototype.update=function(io,oo,ao){typeof io=="string"&&(io=Xr.from(io,oo));var so=this._update(io);return this.hashMode?this:(ao&&(so=this._toString(so,ao)),so)},no.prototype.setAutoPadding=function(){},no.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},no.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},no.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},no.prototype._transform=function(io,oo,ao){var so;try{this.hashMode?this._update(io):this.push(this._update(io))}catch(co){so=co}finally{ao(so)}},no.prototype._flush=function(io){var oo;try{this.push(this.__final())}catch(ao){oo=ao}io(oo)},no.prototype._finalOrDigest=function(io){var oo=this.__final()||Xr.alloc(0);return io&&(oo=this._toString(oo,io,!0)),oo},no.prototype._toString=function(io,oo,ao){if(this._decoder||(this._decoder=new to(oo),this._encoding=oo),this._encoding!==oo)throw new Error("can't switch encodings");var so=this._decoder.write(io);return ao&&(so+=this._decoder.end()),so},cipherBase=no,cipherBase}var browser$e,hasRequiredBrowser$9;function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$e;hasRequiredBrowser$9=1;var Xr=requireInherits_browser(),eo=requireMd5_js(),to=requireRipemd160(),ro=requireSha_js(),no=requireCipherBase();function io(oo){no.call(this,"digest"),this._hash=oo}return Xr(io,no),io.prototype._update=function(oo){this._hash.update(oo)},io.prototype._final=function(){return this._hash.digest()},browser$e=function(ao){return ao=ao.toLowerCase(),ao==="md5"?new eo:ao==="rmd160"||ao==="ripemd160"?new to:new io(ro(ao))},browser$e}var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var Xr=requireInherits_browser(),eo=safeBufferExports.Buffer,to=requireCipherBase(),ro=eo.alloc(128),no=64;function io(oo,ao){to.call(this,"digest"),typeof ao=="string"&&(ao=eo.from(ao)),this._alg=oo,this._key=ao,ao.length>no?ao=oo(ao):ao.lengthuo){var ho=co==="rmd160"?new io:oo(co);lo=ho.update(lo).digest()}else lo.lengthXr||to!==to)throw new TypeError("Bad key length")},precondition}var defaultEncoding_1,hasRequiredDefaultEncoding;function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;hasRequiredDefaultEncoding=1;var Xr;if(commonjsGlobal.process&&commonjsGlobal.process.browser)Xr="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var eo=parseInt(process$1$1.version.split(".")[0].slice(1),10);Xr=eo>=6?"utf-8":"binary"}else Xr="utf-8";return defaultEncoding_1=Xr,defaultEncoding_1}var toBuffer$6,hasRequiredToBuffer;function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer$6;hasRequiredToBuffer=1;var Xr=safeBufferExports.Buffer;return toBuffer$6=function(eo,to,ro){if(Xr.isBuffer(eo))return eo;if(typeof eo=="string")return Xr.from(eo,to);if(ArrayBuffer.isView(eo))return Xr.from(eo.buffer);throw new TypeError(ro+" must be a string, a Buffer, a typed array or a DataView")},toBuffer$6}var syncBrowser,hasRequiredSyncBrowser;function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var Xr=requireMd5(),eo=requireRipemd160(),to=requireSha_js(),ro=safeBufferExports.Buffer,no=requirePrecondition(),io=requireDefaultEncoding(),oo=requireToBuffer(),ao=ro.alloc(128),so={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function co(ho,go,bo){var wo=lo(ho),Eo=ho==="sha512"||ho==="sha384"?128:64;go.length>Eo?go=wo(go):go.length>>0},utils$8.writeUInt32BE=function(no,io,oo){no[0+oo]=io>>>24,no[1+oo]=io>>>16&255,no[2+oo]=io>>>8&255,no[3+oo]=io&255},utils$8.ip=function(no,io,oo,ao){for(var so=0,co=0,lo=6;lo>=0;lo-=2){for(var uo=0;uo<=24;uo+=8)so<<=1,so|=io>>>uo+lo&1;for(var uo=0;uo<=24;uo+=8)so<<=1,so|=no>>>uo+lo&1}for(var lo=6;lo>=0;lo-=2){for(var uo=1;uo<=25;uo+=8)co<<=1,co|=io>>>uo+lo&1;for(var uo=1;uo<=25;uo+=8)co<<=1,co|=no>>>uo+lo&1}oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.rip=function(no,io,oo,ao){for(var so=0,co=0,lo=0;lo<4;lo++)for(var uo=24;uo>=0;uo-=8)so<<=1,so|=io>>>uo+lo&1,so<<=1,so|=no>>>uo+lo&1;for(var lo=4;lo<8;lo++)for(var uo=24;uo>=0;uo-=8)co<<=1,co|=io>>>uo+lo&1,co<<=1,co|=no>>>uo+lo&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.pc1=function(no,io,oo,ao){for(var so=0,co=0,lo=7;lo>=5;lo--){for(var uo=0;uo<=24;uo+=8)so<<=1,so|=io>>uo+lo&1;for(var uo=0;uo<=24;uo+=8)so<<=1,so|=no>>uo+lo&1}for(var uo=0;uo<=24;uo+=8)so<<=1,so|=io>>uo+lo&1;for(var lo=1;lo<=3;lo++){for(var uo=0;uo<=24;uo+=8)co<<=1,co|=io>>uo+lo&1;for(var uo=0;uo<=24;uo+=8)co<<=1,co|=no>>uo+lo&1}for(var uo=0;uo<=24;uo+=8)co<<=1,co|=no>>uo+lo&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.r28shl=function(no,io){return no<>>28-io};var Xr=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$8.pc2=function(no,io,oo,ao){for(var so=0,co=0,lo=Xr.length>>>1,uo=0;uo>>Xr[uo]&1;for(var uo=lo;uo>>Xr[uo]&1;oo[ao+0]=so>>>0,oo[ao+1]=co>>>0},utils$8.expand=function(no,io,oo){var ao=0,so=0;ao=(no&1)<<5|no>>>27;for(var co=23;co>=15;co-=4)ao<<=6,ao|=no>>>co&63;for(var co=11;co>=3;co-=4)so|=no>>>co&63,so<<=6;so|=(no&31)<<1|no>>>31,io[oo+0]=ao>>>0,io[oo+1]=so>>>0};var eo=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$8.substitute=function(no,io){for(var oo=0,ao=0;ao<4;ao++){var so=no>>>18-ao*6&63,co=eo[ao*64+so];oo<<=4,oo|=co}for(var ao=0;ao<4;ao++){var so=io>>>18-ao*6&63,co=eo[4*64+ao*64+so];oo<<=4,oo|=co}return oo>>>0};var to=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$8.permute=function(no){for(var io=0,oo=0;oo>>to[oo]&1;return io>>>0},utils$8.padSplit=function(no,io,oo){for(var ao=no.toString(2);ao.length0;oo--)no+=this._buffer(ro,no),io+=this._flushBuffer(ao,io);return no+=this._buffer(ro,no),ao},eo.prototype.final=function(ro){var no;ro&&(no=this.update(ro));var io;return this.type==="encrypt"?io=this._finalEncrypt():io=this._finalDecrypt(),no?no.concat(io):io},eo.prototype._pad=function(ro,no){if(no===0)return!1;for(;no>>1];lo=to.r28shl(lo,go),uo=to.r28shl(uo,go),to.pc2(lo,uo,so.keys,ho)}},io.prototype._update=function(so,co,lo,uo){var ho=this._desState,go=to.readUInt32BE(so,co),bo=to.readUInt32BE(so,co+4);to.ip(go,bo,ho.tmp,0),go=ho.tmp[0],bo=ho.tmp[1],this.type==="encrypt"?this._encrypt(ho,go,bo,ho.tmp,0):this._decrypt(ho,go,bo,ho.tmp,0),go=ho.tmp[0],bo=ho.tmp[1],to.writeUInt32BE(lo,go,uo),to.writeUInt32BE(lo,bo,uo+4)},io.prototype._pad=function(so,co){if(this.padding===!1)return!1;for(var lo=so.length-co,uo=co;uo>>0,go=Oo}to.rip(bo,go,uo,ho)},io.prototype._decrypt=function(so,co,lo,uo,ho){for(var go=lo,bo=co,wo=so.keys.length-2;wo>=0;wo-=2){var Eo=so.keys[wo],$o=so.keys[wo+1];to.expand(go,so.tmp,0),Eo^=so.tmp[0],$o^=so.tmp[1];var Co=to.substitute(Eo,$o),Ro=to.permute(Co),Oo=go;go=(bo^Ro)>>>0,bo=Oo}to.rip(go,bo,uo,ho)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var Xr=requireMinimalisticAssert(),eo=requireInherits_browser(),to={};function ro(io){Xr.equal(io.length,8,"Invalid IV length"),this.iv=new Array(8);for(var oo=0;oo>ao%8,ro._prev=to(ro._prev,io?lo:uo);return co}function to(ro,no){var io=ro.length,oo=-1,ao=Xr.allocUnsafe(ro.length);for(ro=Xr.concat([ro,Xr.from([no])]);++oo>7;return ao}return cfb1.encrypt=function(ro,no,io){for(var oo=no.length,ao=Xr.allocUnsafe(oo),so=-1;++so>>24]^go[$o>>>16&255]^bo[Co>>>8&255]^wo[Ro&255]^so[Fo++],jo=ho[$o>>>24]^go[Co>>>16&255]^bo[Ro>>>8&255]^wo[Eo&255]^so[Fo++],Bo=ho[Co>>>24]^go[Ro>>>16&255]^bo[Eo>>>8&255]^wo[$o&255]^so[Fo++],Mo=ho[Ro>>>24]^go[Eo>>>16&255]^bo[$o>>>8&255]^wo[Co&255]^so[Fo++],Eo=Oo,$o=jo,Co=Bo,Ro=Mo;return Oo=(lo[Eo>>>24]<<24|lo[$o>>>16&255]<<16|lo[Co>>>8&255]<<8|lo[Ro&255])^so[Fo++],jo=(lo[$o>>>24]<<24|lo[Co>>>16&255]<<16|lo[Ro>>>8&255]<<8|lo[Eo&255])^so[Fo++],Bo=(lo[Co>>>24]<<24|lo[Ro>>>16&255]<<16|lo[Eo>>>8&255]<<8|lo[$o&255])^so[Fo++],Mo=(lo[Ro>>>24]<<24|lo[Eo>>>16&255]<<16|lo[$o>>>8&255]<<8|lo[Co&255])^so[Fo++],Oo=Oo>>>0,jo=jo>>>0,Bo=Bo>>>0,Mo=Mo>>>0,[Oo,jo,Bo,Mo]}var no=[0,1,2,4,8,16,32,64,128,27,54],io=function(){for(var ao=new Array(256),so=0;so<256;so++)so<128?ao[so]=so<<1:ao[so]=so<<1^283;for(var co=[],lo=[],uo=[[],[],[],[]],ho=[[],[],[],[]],go=0,bo=0,wo=0;wo<256;++wo){var Eo=bo^bo<<1^bo<<2^bo<<3^bo<<4;Eo=Eo>>>8^Eo&255^99,co[go]=Eo,lo[Eo]=go;var $o=ao[go],Co=ao[$o],Ro=ao[Co],Oo=ao[Eo]*257^Eo*16843008;uo[0][go]=Oo<<24|Oo>>>8,uo[1][go]=Oo<<16|Oo>>>16,uo[2][go]=Oo<<8|Oo>>>24,uo[3][go]=Oo,Oo=Ro*16843009^Co*65537^$o*257^go*16843008,ho[0][Eo]=Oo<<24|Oo>>>8,ho[1][Eo]=Oo<<16|Oo>>>16,ho[2][Eo]=Oo<<8|Oo>>>24,ho[3][Eo]=Oo,go===0?go=bo=1:(go=$o^ao[ao[ao[Ro^$o]]],bo^=ao[ao[bo]])}return{SBOX:co,INV_SBOX:lo,SUB_MIX:uo,INV_SUB_MIX:ho}}();function oo(ao){this._key=eo(ao),this._reset()}return oo.blockSize=4*4,oo.keySize=256/8,oo.prototype.blockSize=oo.blockSize,oo.prototype.keySize=oo.keySize,oo.prototype._reset=function(){for(var ao=this._key,so=ao.length,co=so+6,lo=(co+1)*4,uo=[],ho=0;ho>>24,go=io.SBOX[go>>>24]<<24|io.SBOX[go>>>16&255]<<16|io.SBOX[go>>>8&255]<<8|io.SBOX[go&255],go^=no[ho/so|0]<<24):so>6&&ho%so===4&&(go=io.SBOX[go>>>24]<<24|io.SBOX[go>>>16&255]<<16|io.SBOX[go>>>8&255]<<8|io.SBOX[go&255]),uo[ho]=uo[ho-so]^go}for(var bo=[],wo=0;wo>>24]]^io.INV_SUB_MIX[1][io.SBOX[$o>>>16&255]]^io.INV_SUB_MIX[2][io.SBOX[$o>>>8&255]]^io.INV_SUB_MIX[3][io.SBOX[$o&255]]}this._nRounds=co,this._keySchedule=uo,this._invKeySchedule=bo},oo.prototype.encryptBlockRaw=function(ao){return ao=eo(ao),ro(ao,this._keySchedule,io.SUB_MIX,io.SBOX,this._nRounds)},oo.prototype.encryptBlock=function(ao){var so=this.encryptBlockRaw(ao),co=Xr.allocUnsafe(16);return co.writeUInt32BE(so[0],0),co.writeUInt32BE(so[1],4),co.writeUInt32BE(so[2],8),co.writeUInt32BE(so[3],12),co},oo.prototype.decryptBlock=function(ao){ao=eo(ao);var so=ao[1];ao[1]=ao[3],ao[3]=so;var co=ro(ao,this._invKeySchedule,io.INV_SUB_MIX,io.INV_SBOX,this._nRounds),lo=Xr.allocUnsafe(16);return lo.writeUInt32BE(co[0],0),lo.writeUInt32BE(co[3],4),lo.writeUInt32BE(co[2],8),lo.writeUInt32BE(co[1],12),lo},oo.prototype.scrub=function(){to(this._keySchedule),to(this._invKeySchedule),to(this._key)},aes.AES=oo,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var Xr=safeBufferExports.Buffer,eo=Xr.alloc(16,0);function to(io){return[io.readUInt32BE(0),io.readUInt32BE(4),io.readUInt32BE(8),io.readUInt32BE(12)]}function ro(io){var oo=Xr.allocUnsafe(16);return oo.writeUInt32BE(io[0]>>>0,0),oo.writeUInt32BE(io[1]>>>0,4),oo.writeUInt32BE(io[2]>>>0,8),oo.writeUInt32BE(io[3]>>>0,12),oo}function no(io){this.h=io,this.state=Xr.alloc(16,0),this.cache=Xr.allocUnsafe(0)}return no.prototype.ghash=function(io){for(var oo=-1;++oo0;ao--)io[ao]=io[ao]>>>1|(io[ao-1]&1)<<31;io[0]=io[0]>>>1,co&&(io[0]=io[0]^225<<24)}this.state=ro(oo)},no.prototype.update=function(io){this.cache=Xr.concat([this.cache,io]);for(var oo;this.cache.length>=16;)oo=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(oo)},no.prototype.final=function(io,oo){return this.cache.length&&this.ghash(Xr.concat([this.cache,eo],16)),this.ghash(ro([0,io,0,oo])),this.state},ghash=no,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var Xr=requireAes(),eo=safeBufferExports.Buffer,to=requireCipherBase(),ro=requireInherits_browser(),no=requireGhash(),io=requireBufferXor(),oo=requireIncr32();function ao(lo,uo){var ho=0;lo.length!==uo.length&&ho++;for(var go=Math.min(lo.length,uo.length),bo=0;bo0||oo>0;){var uo=new eo;uo.update(lo),uo.update(ro),no&&uo.update(no),lo=uo.digest();var ho=0;if(ao>0){var go=so.length-ao;ho=Math.min(ao,lo.length),lo.copy(so,go,0,ho),ao-=ho}if(ho0){var bo=co.length-oo,wo=Math.min(oo,lo.length-ho);lo.copy(co,bo,ho,ho+wo),oo-=wo}}return lo.fill(0),{key:so,iv:co}}return evp_bytestokey=to,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var Xr=requireModes$1(),eo=requireAuthCipher(),to=safeBufferExports.Buffer,ro=requireStreamCipher(),no=requireCipherBase(),io=requireAes(),oo=requireEvp_bytestokey(),ao=requireInherits_browser();function so(go,bo,wo){no.call(this),this._cache=new lo,this._cipher=new io.AES(bo),this._prev=to.from(wo),this._mode=go,this._autopadding=!0}ao(so,no),so.prototype._update=function(go){this._cache.add(go);for(var bo,wo,Eo=[];bo=this._cache.get();)wo=this._mode.encrypt(this,bo),Eo.push(wo);return to.concat(Eo)};var co=to.alloc(16,16);so.prototype._final=function(){var go=this._cache.flush();if(this._autopadding)return go=this._mode.encrypt(this,go),this._cipher.scrub(),go;if(!go.equals(co))throw this._cipher.scrub(),new Error("data not multiple of block length")},so.prototype.setAutoPadding=function(go){return this._autopadding=!!go,this};function lo(){this.cache=to.allocUnsafe(0)}lo.prototype.add=function(go){this.cache=to.concat([this.cache,go])},lo.prototype.get=function(){if(this.cache.length>15){var go=this.cache.slice(0,16);return this.cache=this.cache.slice(16),go}return null},lo.prototype.flush=function(){for(var go=16-this.cache.length,bo=to.allocUnsafe(go),wo=-1;++wo16)return bo=this.cache.slice(0,16),this.cache=this.cache.slice(16),bo}else if(this.cache.length>=16)return bo=this.cache.slice(0,16),this.cache=this.cache.slice(16),bo;return null},co.prototype.flush=function(){if(this.cache.length)return this.cache};function lo(go){var bo=go[15];if(bo<1||bo>16)throw new Error("unable to decrypt data");for(var wo=-1;++wo0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$7)),bn$7.exports}var bn$6={exports:{}};bn$6.exports;var hasRequiredBn$4;function requireBn$4(){return hasRequiredBn$4||(hasRequiredBn$4=1,function(Xr){(function(eo,to){function ro(Po,fo){if(!Po)throw new Error(fo||"Assertion failed")}function no(Po,fo){Po.super_=fo;var yo=function(){};yo.prototype=fo.prototype,Po.prototype=new yo,Po.prototype.constructor=Po}function io(Po,fo,yo){if(io.isBN(Po))return Po;this.negative=0,this.words=null,this.length=0,this.red=null,Po!==null&&((fo==="le"||fo==="be")&&(yo=fo,fo=10),this._init(Po||0,fo||10,yo||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(fo){return fo instanceof io?!0:fo!==null&&typeof fo=="object"&&fo.constructor.wordSize===io.wordSize&&Array.isArray(fo.words)},io.max=function(fo,yo){return fo.cmp(yo)>0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$6)),bn$6.exports}var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var Xr;brorand.exports=function(no){return Xr||(Xr=new eo(null)),Xr.generate(no)};function eo(ro){this.rand=ro}if(brorand.exports.Rand=eo,eo.prototype.generate=function(no){return this._rand(no)},eo.prototype._rand=function(no){if(this.rand.getBytes)return this.rand.getBytes(no);for(var io=new Uint8Array(no),oo=0;oo=0);return ao},to.prototype._randrange=function(no,io){var oo=io.sub(no);return no.add(this._randbelow(oo))},to.prototype.test=function(no,io,oo){var ao=no.bitLength(),so=Xr.mont(no),co=new Xr(1).toRed(so);io||(io=Math.max(1,ao/48|0));for(var lo=no.subn(1),uo=0;!lo.testn(uo);uo++);for(var ho=no.shrn(uo),go=lo.toRed(so),bo=!0;io>0;io--){var wo=this._randrange(new Xr(2),lo);oo&&oo(wo);var Eo=wo.toRed(so).redPow(ho);if(!(Eo.cmp(co)===0||Eo.cmp(go)===0)){for(var $o=1;$o0;io--){var go=this._randrange(new Xr(2),co),bo=no.gcd(go);if(bo.cmpn(1)!==0)return bo;var wo=go.toRed(ao).redPow(uo);if(!(wo.cmp(so)===0||wo.cmp(ho)===0)){for(var Eo=1;Eo$o;)Ro.ishrn(1);if(Ro.isEven()&&Ro.iadd(io),Ro.testn(1)||Ro.iadd(oo),Co.cmp(oo)){if(!Co.cmp(ao))for(;Ro.mod(so).cmp(co);)Ro.iadd(uo)}else for(;Ro.mod(to).cmp(lo);)Ro.iadd(uo);if(Oo=Ro.shrn(1),bo(Oo)&&bo(Ro)&&wo(Oo)&&wo(Ro)&&no.test(Oo)&&no.test(Ro))return Ro}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var Xr=requireBn$5(),eo=requireMr(),to=new eo,ro=new Xr(24),no=new Xr(11),io=new Xr(10),oo=new Xr(3),ao=new Xr(7),so=requireGeneratePrime(),co=requireBrowser$b();dh=bo;function lo(Eo,$o){return $o=$o||"utf8",Buffer$3.isBuffer(Eo)||(Eo=new Buffer$3(Eo,$o)),this._pub=new Xr(Eo),this}function uo(Eo,$o){return $o=$o||"utf8",Buffer$3.isBuffer(Eo)||(Eo=new Buffer$3(Eo,$o)),this._priv=new Xr(Eo),this}var ho={};function go(Eo,$o){var Co=$o.toString("hex"),Ro=[Co,Eo.toString(16)].join("_");if(Ro in ho)return ho[Ro];var Oo=0;if(Eo.isEven()||!so.simpleSieve||!so.fermatTest(Eo)||!to.test(Eo))return Oo+=1,Co==="02"||Co==="05"?Oo+=8:Oo+=4,ho[Ro]=Oo,Oo;to.test(Eo.shrn(1))||(Oo+=2);var jo;switch(Co){case"02":Eo.mod(ro).cmp(no)&&(Oo+=8);break;case"05":jo=Eo.mod(io),jo.cmp(oo)&&jo.cmp(ao)&&(Oo+=8);break;default:Oo+=4}return ho[Ro]=Oo,Oo}function bo(Eo,$o,Co){this.setGenerator($o),this.__prime=new Xr(Eo),this._prime=Xr.mont(this.__prime),this._primeLen=Eo.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,Co?(this.setPublicKey=lo,this.setPrivateKey=uo):this._primeCode=8}Object.defineProperty(bo.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=go(this.__prime,this.__gen)),this._primeCode}}),bo.prototype.generateKeys=function(){return this._priv||(this._priv=new Xr(co(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},bo.prototype.computeSecret=function(Eo){Eo=new Xr(Eo),Eo=Eo.toRed(this._prime);var $o=Eo.redPow(this._priv).fromRed(),Co=new Buffer$3($o.toArray()),Ro=this.getPrime();if(Co.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:Xr}:processNextickArgs.exports=process$1$1;function Xr(eo,to,ro,no){if(typeof eo!="function")throw new TypeError('"callback" argument must be a function');var io=arguments.length,oo,ao;switch(io){case 0:case 1:return process$1$1.nextTick(eo);case 2:return process$1$1.nextTick(function(){eo.call(null,to)});case 3:return process$1$1.nextTick(function(){eo.call(null,to,ro)});case 4:return process$1$1.nextTick(function(){eo.call(null,to,ro,no)});default:for(oo=new Array(io-1),ao=0;ao"u"}util$7.isPrimitive=go,util$7.isBuffer=require$$0$9.Buffer.isBuffer;function bo(wo){return Object.prototype.toString.call(wo)}return util$7}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(Xr){function eo(io,oo){if(!(io instanceof oo))throw new TypeError("Cannot call a class as a function")}var to=requireSafeBuffer().Buffer,ro=requireUtil$1();function no(io,oo,ao){io.copy(oo,ao)}Xr.exports=function(){function io(){eo(this,io),this.head=null,this.tail=null,this.length=0}return io.prototype.push=function(ao){var so={data:ao,next:null};this.length>0?this.tail.next=so:this.head=so,this.tail=so,++this.length},io.prototype.unshift=function(ao){var so={data:ao,next:this.head};this.length===0&&(this.tail=so),this.head=so,++this.length},io.prototype.shift=function(){if(this.length!==0){var ao=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ao}},io.prototype.clear=function(){this.head=this.tail=null,this.length=0},io.prototype.join=function(ao){if(this.length===0)return"";for(var so=this.head,co=""+so.data;so=so.next;)co+=ao+so.data;return co},io.prototype.concat=function(ao){if(this.length===0)return to.alloc(0);for(var so=to.allocUnsafe(ao>>>0),co=this.head,lo=0;co;)no(co.data,so,lo),lo+=co.data.length,co=co.next;return so},io}(),ro&&ro.inspect&&ro.inspect.custom&&(Xr.exports.prototype[ro.inspect.custom]=function(){var io=ro.inspect({length:this.length});return this.constructor.name+" "+io})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var Xr=requireProcessNextickArgs();function eo(no,io){var oo=this,ao=this._readableState&&this._readableState.destroyed,so=this._writableState&&this._writableState.destroyed;return ao||so?(io?io(no):no&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Xr.nextTick(ro,this,no)):Xr.nextTick(ro,this,no)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(no||null,function(co){!io&&co?oo._writableState?oo._writableState.errorEmitted||(oo._writableState.errorEmitted=!0,Xr.nextTick(ro,oo,co)):Xr.nextTick(ro,oo,co):io&&io(co)}),this)}function to(){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)}function ro(no,io){no.emit("error",io)}return destroy_1={destroy:eo,undestroy:to},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var Xr=requireProcessNextickArgs();_stream_writable=wo;function eo(To){var Ao=this;this.next=null,this.entry=null,this.finish=function(){So(Ao,To)}}var to=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:Xr.nextTick,ro;wo.WritableState=go;var no=Object.create(requireUtil());no.inherits=requireInherits_browser();var io={deprecate:requireBrowser$a()},oo=requireStreamBrowser(),ao=requireSafeBuffer().Buffer,so=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function co(To){return ao.from(To)}function lo(To){return ao.isBuffer(To)||To instanceof so}var uo=requireDestroy();no.inherits(wo,oo);function ho(){}function go(To,Ao){ro=ro||require_stream_duplex(),To=To||{};var ko=Ao instanceof ro;this.objectMode=!!To.objectMode,ko&&(this.objectMode=this.objectMode||!!To.writableObjectMode);var mo=To.highWaterMark,Io=To.writableHighWaterMark,Do=this.objectMode?16:16*1024;mo||mo===0?this.highWaterMark=mo:ko&&(Io||Io===0)?this.highWaterMark=Io:this.highWaterMark=Do,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Lo=To.decodeStrings===!1;this.decodeStrings=!Lo,this.defaultEncoding=To.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ho){Mo(Ao,Ho)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new eo(this)}go.prototype.getBuffer=function(){for(var Ao=this.bufferedRequest,ko=[];Ao;)ko.push(Ao),Ao=Ao.next;return ko},function(){try{Object.defineProperty(go.prototype,"buffer",{get:io.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var bo;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(bo=Function.prototype[Symbol.hasInstance],Object.defineProperty(wo,Symbol.hasInstance,{value:function(To){return bo.call(this,To)?!0:this!==wo?!1:To&&To._writableState instanceof go}})):bo=function(To){return To instanceof this};function wo(To){if(ro=ro||require_stream_duplex(),!bo.call(wo,this)&&!(this instanceof ro))return new wo(To);this._writableState=new go(To,this),this.writable=!0,To&&(typeof To.write=="function"&&(this._write=To.write),typeof To.writev=="function"&&(this._writev=To.writev),typeof To.destroy=="function"&&(this._destroy=To.destroy),typeof To.final=="function"&&(this._final=To.final)),oo.call(this)}wo.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Eo(To,Ao){var ko=new Error("write after end");To.emit("error",ko),Xr.nextTick(Ao,ko)}function $o(To,Ao,ko,mo){var Io=!0,Do=!1;return ko===null?Do=new TypeError("May not write null values to stream"):typeof ko!="string"&&ko!==void 0&&!Ao.objectMode&&(Do=new TypeError("Invalid non-string/buffer chunk")),Do&&(To.emit("error",Do),Xr.nextTick(mo,Do),Io=!1),Io}wo.prototype.write=function(To,Ao,ko){var mo=this._writableState,Io=!1,Do=!mo.objectMode&&lo(To);return Do&&!ao.isBuffer(To)&&(To=co(To)),typeof Ao=="function"&&(ko=Ao,Ao=null),Do?Ao="buffer":Ao||(Ao=mo.defaultEncoding),typeof ko!="function"&&(ko=ho),mo.ended?Eo(this,ko):(Do||$o(this,mo,To,ko))&&(mo.pendingcb++,Io=Ro(this,mo,Do,To,Ao,ko)),Io},wo.prototype.cork=function(){var To=this._writableState;To.corked++},wo.prototype.uncork=function(){var To=this._writableState;To.corked&&(To.corked--,!To.writing&&!To.corked&&!To.bufferProcessing&&To.bufferedRequest&&Jo(this,To))},wo.prototype.setDefaultEncoding=function(Ao){if(typeof Ao=="string"&&(Ao=Ao.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Ao+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Ao);return this._writableState.defaultEncoding=Ao,this};function Co(To,Ao,ko){return!To.objectMode&&To.decodeStrings!==!1&&typeof Ao=="string"&&(Ao=ao.from(Ao,ko)),Ao}Object.defineProperty(wo.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ro(To,Ao,ko,mo,Io,Do){if(!ko){var Lo=Co(Ao,mo,Io);mo!==Lo&&(ko=!0,Io="buffer",mo=Lo)}var Ho=Ao.objectMode?1:mo.length;Ao.length+=Ho;var Yo=Ao.length0?(typeof Ko!="string"&&!$a.objectMode&&Object.getPrototypeOf(Ko)!==io.prototype&&(Ko=ao(Ko)),zo?$a.endEmitted?qo.emit("error",new Error("stream.unshift() after end event")):Oo(qo,$a,Ko,!0):$a.ended?qo.emit("error",new Error("stream.push() after EOF")):($a.reading=!1,$a.decoder&&!Qo?(Ko=$a.decoder.write(Ko),$a.objectMode||Ko.length!==0?Oo(qo,$a,Ko,!1):yo(qo,$a)):Oo(qo,$a,Ko,!1))):zo||($a.reading=!1)}return Bo($a)}function Oo(qo,Ko,Qo,zo){Ko.flowing&&Ko.length===0&&!Ko.sync?(qo.emit("data",Qo),qo.read(0)):(Ko.length+=Ko.objectMode?1:Qo.length,zo?Ko.buffer.unshift(Qo):Ko.buffer.push(Qo),Ko.needReadable&&Po(qo)),yo(qo,Ko)}function jo(qo,Ko){var Qo;return!so(Ko)&&typeof Ko!="string"&&Ko!==void 0&&!qo.objectMode&&(Qo=new TypeError("Invalid non-string/buffer chunk")),Qo}function Bo(qo){return!qo.ended&&(qo.needReadable||qo.length=Mo?qo=Mo:(qo--,qo|=qo>>>1,qo|=qo>>>2,qo|=qo>>>4,qo|=qo>>>8,qo|=qo>>>16,qo++),qo}function Wo(qo,Ko){return qo<=0||Ko.length===0&&Ko.ended?0:Ko.objectMode?1:qo!==qo?Ko.flowing&&Ko.length?Ko.buffer.head.data.length:Ko.length:(qo>Ko.highWaterMark&&(Ko.highWaterMark=Fo(qo)),qo<=Ko.length?qo:Ko.ended?Ko.length:(Ko.needReadable=!0,0))}Co.prototype.read=function(qo){uo("read",qo),qo=parseInt(qo,10);var Ko=this._readableState,Qo=qo;if(qo!==0&&(Ko.emittedReadable=!1),qo===0&&Ko.needReadable&&(Ko.length>=Ko.highWaterMark||Ko.ended))return uo("read: emitReadable",Ko.length,Ko.ended),Ko.length===0&&Ko.ended?Ho(this):Po(this),null;if(qo=Wo(qo,Ko),qo===0&&Ko.ended)return Ko.length===0&&Ho(this),null;var zo=Ko.needReadable;uo("need readable",zo),(Ko.length===0||Ko.length-qo0?ga=mo(qo,Ko):ga=null,ga===null?(Ko.needReadable=!0,qo=0):Ko.length-=qo,Ko.length===0&&(Ko.ended||(Ko.needReadable=!0),Qo!==qo&&Ko.ended&&Ho(this)),ga!==null&&this.emit("data",ga),ga};function Jo(qo,Ko){if(!Ko.ended){if(Ko.decoder){var Qo=Ko.decoder.end();Qo&&Qo.length&&(Ko.buffer.push(Qo),Ko.length+=Ko.objectMode?1:Qo.length)}Ko.ended=!0,Po(qo)}}function Po(qo){var Ko=qo._readableState;Ko.needReadable=!1,Ko.emittedReadable||(uo("emitReadable",Ko.flowing),Ko.emittedReadable=!0,Ko.sync?Xr.nextTick(fo,qo):fo(qo))}function fo(qo){uo("emit readable"),qo.emit("readable"),ko(qo)}function yo(qo,Ko){Ko.readingMore||(Ko.readingMore=!0,Xr.nextTick(vo,qo,Ko))}function vo(qo,Ko){for(var Qo=Ko.length;!Ko.reading&&!Ko.flowing&&!Ko.ended&&Ko.length1&&Xo(zo.pipes,qo)!==-1)&&!Il&&(uo("false write response, pause",zo.awaitDrain),zo.awaitDrain++,Vl=!0),Qo.pause())}function Dl(Ll){uo("onerror",Ll),cu(),qo.removeListener("error",Dl),ro(qo,"error")===0&&qo.emit("error",Ll)}Eo(qo,"error",Dl);function Fl(){qo.removeListener("finish",Jl),cu()}qo.once("close",Fl);function Jl(){uo("onfinish"),qo.removeListener("close",Fl),cu()}qo.once("finish",Jl);function cu(){uo("unpipe"),Qo.unpipe(qo)}return qo.emit("pipe",Qo),zo.flowing||(uo("pipe resume"),Qo.resume()),qo};function _o(qo){return function(){var Ko=qo._readableState;uo("pipeOnDrain",Ko.awaitDrain),Ko.awaitDrain&&Ko.awaitDrain--,Ko.awaitDrain===0&&ro(qo,"data")&&(Ko.flowing=!0,ko(qo))}}Co.prototype.unpipe=function(qo){var Ko=this._readableState,Qo={hasUnpiped:!1};if(Ko.pipesCount===0)return this;if(Ko.pipesCount===1)return qo&&qo!==Ko.pipes?this:(qo||(qo=Ko.pipes),Ko.pipes=null,Ko.pipesCount=0,Ko.flowing=!1,qo&&qo.emit("unpipe",this,Qo),this);if(!qo){var zo=Ko.pipes,ga=Ko.pipesCount;Ko.pipes=null,Ko.pipesCount=0,Ko.flowing=!1;for(var $a=0;$a=Ko.length?(Ko.decoder?Qo=Ko.buffer.join(""):Ko.buffer.length===1?Qo=Ko.buffer.head.data:Qo=Ko.buffer.concat(Ko.length),Ko.buffer.clear()):Qo=Io(qo,Ko.buffer,Ko.decoder),Qo}function Io(qo,Ko,Qo){var zo;return qo$a.length?$a.length:qo;if(Sl===$a.length?ga+=$a:ga+=$a.slice(0,qo),qo-=Sl,qo===0){Sl===$a.length?(++zo,Qo.next?Ko.head=Qo.next:Ko.head=Ko.tail=null):(Ko.head=Qo,Qo.data=$a.slice(Sl));break}++zo}return Ko.length-=zo,ga}function Lo(qo,Ko){var Qo=io.allocUnsafe(qo),zo=Ko.head,ga=1;for(zo.data.copy(Qo),qo-=zo.data.length;zo=zo.next;){var $a=zo.data,Sl=qo>$a.length?$a.length:qo;if($a.copy(Qo,Qo.length-qo,0,Sl),qo-=Sl,qo===0){Sl===$a.length?(++ga,zo.next?Ko.head=zo.next:Ko.head=Ko.tail=null):(Ko.head=zo,zo.data=$a.slice(Sl));break}++ga}return Ko.length-=ga,Qo}function Ho(qo){var Ko=qo._readableState;if(Ko.length>0)throw new Error('"endReadable()" called on non-empty stream');Ko.endEmitted||(Ko.ended=!0,Xr.nextTick(Yo,Ko,qo))}function Yo(qo,Ko){!qo.endEmitted&&qo.length===0&&(qo.endEmitted=!0,Ko.readable=!1,Ko.emit("end"))}function Xo(qo,Ko){for(var Qo=0,zo=qo.length;Qo0?vo:_o},io.min=function(vo,_o){return vo.cmp(_o)<0?vo:_o},io.prototype._init=function(vo,_o,So){if(typeof vo=="number")return this._initNumber(vo,_o,So);if(typeof vo=="object")return this._initArray(vo,_o,So);_o==="hex"&&(_o=16),ro(_o===(_o|0)&&_o>=2&&_o<=36),vo=vo.toString().replace(/\s+/g,"");var To=0;vo[0]==="-"&&(To++,this.negative=1),To=0;To-=3)ko=vo[To]|vo[To-1]<<8|vo[To-2]<<16,this.words[Ao]|=ko<>>26-mo&67108863,mo+=24,mo>=26&&(mo-=26,Ao++);else if(So==="le")for(To=0,Ao=0;To>>26-mo&67108863,mo+=24,mo>=26&&(mo-=26,Ao++);return this._strip()};function ao(yo,vo){var _o=yo.charCodeAt(vo);if(_o>=48&&_o<=57)return _o-48;if(_o>=65&&_o<=70)return _o-55;if(_o>=97&&_o<=102)return _o-87;ro(!1,"Invalid character in "+yo)}function so(yo,vo,_o){var So=ao(yo,_o);return _o-1>=vo&&(So|=ao(yo,_o-1)<<4),So}io.prototype._parseHex=function(vo,_o,So){this.length=Math.ceil((vo.length-_o)/6),this.words=new Array(this.length);for(var To=0;To=_o;To-=2)mo=so(vo,_o,To)<=18?(Ao-=18,ko+=1,this.words[ko]|=mo>>>26):Ao+=8;else{var Io=vo.length-_o;for(To=Io%2===0?_o+1:_o;To=18?(Ao-=18,ko+=1,this.words[ko]|=mo>>>26):Ao+=8}this._strip()};function co(yo,vo,_o,So){for(var To=0,Ao=0,ko=Math.min(yo.length,_o),mo=vo;mo=49?Ao=Io-49+10:Io>=17?Ao=Io-17+10:Ao=Io,ro(Io>=0&&Ao1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=uo}catch{io.prototype.inspect=uo}else io.prototype.inspect=uo;function uo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],bo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(vo,_o){vo=vo||10,_o=_o|0||1;var So;if(vo===16||vo==="hex"){So="";for(var To=0,Ao=0,ko=0;ko>>24-To&16777215,To+=2,To>=26&&(To-=26,ko--),Ao!==0||ko!==this.length-1?So=ho[6-Io.length]+Io+So:So=Io+So}for(Ao!==0&&(So=Ao.toString(16)+So);So.length%_o!==0;)So="0"+So;return this.negative!==0&&(So="-"+So),So}if(vo===(vo|0)&&vo>=2&&vo<=36){var Do=go[vo],Lo=bo[vo];So="";var Ho=this.clone();for(Ho.negative=0;!Ho.isZero();){var Yo=Ho.modrn(Lo).toString(vo);Ho=Ho.idivn(Lo),Ho.isZero()?So=Yo+So:So=ho[Do-Yo.length]+Yo+So}for(this.isZero()&&(So="0"+So);So.length%_o!==0;)So="0"+So;return this.negative!==0&&(So="-"+So),So}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var vo=this.words[0];return this.length===2?vo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?vo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-vo:vo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(vo,_o){return this.toArrayLike(oo,vo,_o)}),io.prototype.toArray=function(vo,_o){return this.toArrayLike(Array,vo,_o)};var wo=function(vo,_o){return vo.allocUnsafe?vo.allocUnsafe(_o):new vo(_o)};io.prototype.toArrayLike=function(vo,_o,So){this._strip();var To=this.byteLength(),Ao=So||Math.max(1,To);ro(To<=Ao,"byte array longer than desired length"),ro(Ao>0,"Requested array length <= 0");var ko=wo(vo,Ao),mo=_o==="le"?"LE":"BE";return this["_toArrayLike"+mo](ko,To),ko},io.prototype._toArrayLikeLE=function(vo,_o){for(var So=0,To=0,Ao=0,ko=0;Ao>8&255),So>16&255),ko===6?(So>24&255),To=0,ko=0):(To=mo>>>24,ko+=2)}if(So=0&&(vo[So--]=mo>>8&255),So>=0&&(vo[So--]=mo>>16&255),ko===6?(So>=0&&(vo[So--]=mo>>24&255),To=0,ko=0):(To=mo>>>24,ko+=2)}if(So>=0)for(vo[So--]=To;So>=0;)vo[So--]=0},Math.clz32?io.prototype._countBits=function(vo){return 32-Math.clz32(vo)}:io.prototype._countBits=function(vo){var _o=vo,So=0;return _o>=4096&&(So+=13,_o>>>=13),_o>=64&&(So+=7,_o>>>=7),_o>=8&&(So+=4,_o>>>=4),_o>=2&&(So+=2,_o>>>=2),So+_o},io.prototype._zeroBits=function(vo){if(vo===0)return 26;var _o=vo,So=0;return _o&8191||(So+=13,_o>>>=13),_o&127||(So+=7,_o>>>=7),_o&15||(So+=4,_o>>>=4),_o&3||(So+=2,_o>>>=2),_o&1||So++,So},io.prototype.bitLength=function(){var vo=this.words[this.length-1],_o=this._countBits(vo);return(this.length-1)*26+_o};function Eo(yo){for(var vo=new Array(yo.bitLength()),_o=0;_o>>To&1}return vo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var vo=0,_o=0;_ovo.length?this.clone().ior(vo):vo.clone().ior(this)},io.prototype.uor=function(vo){return this.length>vo.length?this.clone().iuor(vo):vo.clone().iuor(this)},io.prototype.iuand=function(vo){var _o;this.length>vo.length?_o=vo:_o=this;for(var So=0;So<_o.length;So++)this.words[So]=this.words[So]&vo.words[So];return this.length=_o.length,this._strip()},io.prototype.iand=function(vo){return ro((this.negative|vo.negative)===0),this.iuand(vo)},io.prototype.and=function(vo){return this.length>vo.length?this.clone().iand(vo):vo.clone().iand(this)},io.prototype.uand=function(vo){return this.length>vo.length?this.clone().iuand(vo):vo.clone().iuand(this)},io.prototype.iuxor=function(vo){var _o,So;this.length>vo.length?(_o=this,So=vo):(_o=vo,So=this);for(var To=0;Tovo.length?this.clone().ixor(vo):vo.clone().ixor(this)},io.prototype.uxor=function(vo){return this.length>vo.length?this.clone().iuxor(vo):vo.clone().iuxor(this)},io.prototype.inotn=function(vo){ro(typeof vo=="number"&&vo>=0);var _o=Math.ceil(vo/26)|0,So=vo%26;this._expand(_o),So>0&&_o--;for(var To=0;To<_o;To++)this.words[To]=~this.words[To]&67108863;return So>0&&(this.words[To]=~this.words[To]&67108863>>26-So),this._strip()},io.prototype.notn=function(vo){return this.clone().inotn(vo)},io.prototype.setn=function(vo,_o){ro(typeof vo=="number"&&vo>=0);var So=vo/26|0,To=vo%26;return this._expand(So+1),_o?this.words[So]=this.words[So]|1<vo.length?(So=this,To=vo):(So=vo,To=this);for(var Ao=0,ko=0;ko>>26;for(;Ao!==0&&ko>>26;if(this.length=So.length,Ao!==0)this.words[this.length]=Ao,this.length++;else if(So!==this)for(;kovo.length?this.clone().iadd(vo):vo.clone().iadd(this)},io.prototype.isub=function(vo){if(vo.negative!==0){vo.negative=0;var _o=this.iadd(vo);return vo.negative=1,_o._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(vo),this.negative=1,this._normSign();var So=this.cmp(vo);if(So===0)return this.negative=0,this.length=1,this.words[0]=0,this;var To,Ao;So>0?(To=this,Ao=vo):(To=vo,Ao=this);for(var ko=0,mo=0;mo>26,this.words[mo]=_o&67108863;for(;ko!==0&&mo>26,this.words[mo]=_o&67108863;if(ko===0&&mo>>26,Ho=Io&67108863,Yo=Math.min(Do,vo.length-1),Xo=Math.max(0,Do-yo.length+1);Xo<=Yo;Xo++){var qo=Do-Xo|0;To=yo.words[qo]|0,Ao=vo.words[Xo]|0,ko=To*Ao+Ho,Lo+=ko/67108864|0,Ho=ko&67108863}_o.words[Do]=Ho|0,Io=Lo|0}return Io!==0?_o.words[Do]=Io|0:_o.length--,_o._strip()}var Co=function(vo,_o,So){var To=vo.words,Ao=_o.words,ko=So.words,mo=0,Io,Do,Lo,Ho=To[0]|0,Yo=Ho&8191,Xo=Ho>>>13,qo=To[1]|0,Ko=qo&8191,Qo=qo>>>13,zo=To[2]|0,ga=zo&8191,$a=zo>>>13,Sl=To[3]|0,El=Sl&8191,Tl=Sl>>>13,Il=To[4]|0,Zl=Il&8191,Vl=Il>>>13,Ol=To[5]|0,Dl=Ol&8191,Fl=Ol>>>13,Jl=To[6]|0,cu=Jl&8191,Ll=Jl>>>13,Xl=To[7]|0,ku=Xl&8191,iu=Xl>>>13,hu=To[8]|0,Cu=hu&8191,_l=hu>>>13,Go=To[9]|0,yl=Go&8191,Al=Go>>>13,Ul=Ao[0]|0,su=Ul&8191,Ql=Ul>>>13,vu=Ao[1]|0,qu=vu&8191,pu=vu>>>13,xu=Ao[2]|0,Au=xu&8191,yu=xu>>>13,wu=Ao[3]|0,Gu=wu&8191,Ml=wu>>>13,Nl=Ao[4]|0,Yl=Nl&8191,Wl=Nl>>>13,eu=Ao[5]|0,Su=eu&8191,ru=eu>>>13,uu=Ao[6]|0,xl=uu&8191,$l=uu>>>13,Cl=Ao[7]|0,Zo=Cl&8191,Rl=Cl>>>13,Hl=Ao[8]|0,au=Hl&8191,tu=Hl>>>13,lu=Ao[9]|0,Nu=lu&8191,Pu=lu>>>13;So.negative=vo.negative^_o.negative,So.length=19,Io=Math.imul(Yo,su),Do=Math.imul(Yo,Ql),Do=Do+Math.imul(Xo,su)|0,Lo=Math.imul(Xo,Ql);var ip=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(ip>>>26)|0,ip&=67108863,Io=Math.imul(Ko,su),Do=Math.imul(Ko,Ql),Do=Do+Math.imul(Qo,su)|0,Lo=Math.imul(Qo,Ql),Io=Io+Math.imul(Yo,qu)|0,Do=Do+Math.imul(Yo,pu)|0,Do=Do+Math.imul(Xo,qu)|0,Lo=Lo+Math.imul(Xo,pu)|0;var Lu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,Io=Math.imul(ga,su),Do=Math.imul(ga,Ql),Do=Do+Math.imul($a,su)|0,Lo=Math.imul($a,Ql),Io=Io+Math.imul(Ko,qu)|0,Do=Do+Math.imul(Ko,pu)|0,Do=Do+Math.imul(Qo,qu)|0,Lo=Lo+Math.imul(Qo,pu)|0,Io=Io+Math.imul(Yo,Au)|0,Do=Do+Math.imul(Yo,yu)|0,Do=Do+Math.imul(Xo,Au)|0,Lo=Lo+Math.imul(Xo,yu)|0;var Yu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,Io=Math.imul(El,su),Do=Math.imul(El,Ql),Do=Do+Math.imul(Tl,su)|0,Lo=Math.imul(Tl,Ql),Io=Io+Math.imul(ga,qu)|0,Do=Do+Math.imul(ga,pu)|0,Do=Do+Math.imul($a,qu)|0,Lo=Lo+Math.imul($a,pu)|0,Io=Io+Math.imul(Ko,Au)|0,Do=Do+Math.imul(Ko,yu)|0,Do=Do+Math.imul(Qo,Au)|0,Lo=Lo+Math.imul(Qo,yu)|0,Io=Io+Math.imul(Yo,Gu)|0,Do=Do+Math.imul(Yo,Ml)|0,Do=Do+Math.imul(Xo,Gu)|0,Lo=Lo+Math.imul(Xo,Ml)|0;var _d=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(_d>>>26)|0,_d&=67108863,Io=Math.imul(Zl,su),Do=Math.imul(Zl,Ql),Do=Do+Math.imul(Vl,su)|0,Lo=Math.imul(Vl,Ql),Io=Io+Math.imul(El,qu)|0,Do=Do+Math.imul(El,pu)|0,Do=Do+Math.imul(Tl,qu)|0,Lo=Lo+Math.imul(Tl,pu)|0,Io=Io+Math.imul(ga,Au)|0,Do=Do+Math.imul(ga,yu)|0,Do=Do+Math.imul($a,Au)|0,Lo=Lo+Math.imul($a,yu)|0,Io=Io+Math.imul(Ko,Gu)|0,Do=Do+Math.imul(Ko,Ml)|0,Do=Do+Math.imul(Qo,Gu)|0,Lo=Lo+Math.imul(Qo,Ml)|0,Io=Io+Math.imul(Yo,Yl)|0,Do=Do+Math.imul(Yo,Wl)|0,Do=Do+Math.imul(Xo,Yl)|0,Lo=Lo+Math.imul(Xo,Wl)|0;var Qu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,Io=Math.imul(Dl,su),Do=Math.imul(Dl,Ql),Do=Do+Math.imul(Fl,su)|0,Lo=Math.imul(Fl,Ql),Io=Io+Math.imul(Zl,qu)|0,Do=Do+Math.imul(Zl,pu)|0,Do=Do+Math.imul(Vl,qu)|0,Lo=Lo+Math.imul(Vl,pu)|0,Io=Io+Math.imul(El,Au)|0,Do=Do+Math.imul(El,yu)|0,Do=Do+Math.imul(Tl,Au)|0,Lo=Lo+Math.imul(Tl,yu)|0,Io=Io+Math.imul(ga,Gu)|0,Do=Do+Math.imul(ga,Ml)|0,Do=Do+Math.imul($a,Gu)|0,Lo=Lo+Math.imul($a,Ml)|0,Io=Io+Math.imul(Ko,Yl)|0,Do=Do+Math.imul(Ko,Wl)|0,Do=Do+Math.imul(Qo,Yl)|0,Lo=Lo+Math.imul(Qo,Wl)|0,Io=Io+Math.imul(Yo,Su)|0,Do=Do+Math.imul(Yo,ru)|0,Do=Do+Math.imul(Xo,Su)|0,Lo=Lo+Math.imul(Xo,ru)|0;var _f=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(_f>>>26)|0,_f&=67108863,Io=Math.imul(cu,su),Do=Math.imul(cu,Ql),Do=Do+Math.imul(Ll,su)|0,Lo=Math.imul(Ll,Ql),Io=Io+Math.imul(Dl,qu)|0,Do=Do+Math.imul(Dl,pu)|0,Do=Do+Math.imul(Fl,qu)|0,Lo=Lo+Math.imul(Fl,pu)|0,Io=Io+Math.imul(Zl,Au)|0,Do=Do+Math.imul(Zl,yu)|0,Do=Do+Math.imul(Vl,Au)|0,Lo=Lo+Math.imul(Vl,yu)|0,Io=Io+Math.imul(El,Gu)|0,Do=Do+Math.imul(El,Ml)|0,Do=Do+Math.imul(Tl,Gu)|0,Lo=Lo+Math.imul(Tl,Ml)|0,Io=Io+Math.imul(ga,Yl)|0,Do=Do+Math.imul(ga,Wl)|0,Do=Do+Math.imul($a,Yl)|0,Lo=Lo+Math.imul($a,Wl)|0,Io=Io+Math.imul(Ko,Su)|0,Do=Do+Math.imul(Ko,ru)|0,Do=Do+Math.imul(Qo,Su)|0,Lo=Lo+Math.imul(Qo,ru)|0,Io=Io+Math.imul(Yo,xl)|0,Do=Do+Math.imul(Yo,$l)|0,Do=Do+Math.imul(Xo,xl)|0,Lo=Lo+Math.imul(Xo,$l)|0;var ep=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(ep>>>26)|0,ep&=67108863,Io=Math.imul(ku,su),Do=Math.imul(ku,Ql),Do=Do+Math.imul(iu,su)|0,Lo=Math.imul(iu,Ql),Io=Io+Math.imul(cu,qu)|0,Do=Do+Math.imul(cu,pu)|0,Do=Do+Math.imul(Ll,qu)|0,Lo=Lo+Math.imul(Ll,pu)|0,Io=Io+Math.imul(Dl,Au)|0,Do=Do+Math.imul(Dl,yu)|0,Do=Do+Math.imul(Fl,Au)|0,Lo=Lo+Math.imul(Fl,yu)|0,Io=Io+Math.imul(Zl,Gu)|0,Do=Do+Math.imul(Zl,Ml)|0,Do=Do+Math.imul(Vl,Gu)|0,Lo=Lo+Math.imul(Vl,Ml)|0,Io=Io+Math.imul(El,Yl)|0,Do=Do+Math.imul(El,Wl)|0,Do=Do+Math.imul(Tl,Yl)|0,Lo=Lo+Math.imul(Tl,Wl)|0,Io=Io+Math.imul(ga,Su)|0,Do=Do+Math.imul(ga,ru)|0,Do=Do+Math.imul($a,Su)|0,Lo=Lo+Math.imul($a,ru)|0,Io=Io+Math.imul(Ko,xl)|0,Do=Do+Math.imul(Ko,$l)|0,Do=Do+Math.imul(Qo,xl)|0,Lo=Lo+Math.imul(Qo,$l)|0,Io=Io+Math.imul(Yo,Zo)|0,Do=Do+Math.imul(Yo,Rl)|0,Do=Do+Math.imul(Xo,Zo)|0,Lo=Lo+Math.imul(Xo,Rl)|0;var Xu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,Io=Math.imul(Cu,su),Do=Math.imul(Cu,Ql),Do=Do+Math.imul(_l,su)|0,Lo=Math.imul(_l,Ql),Io=Io+Math.imul(ku,qu)|0,Do=Do+Math.imul(ku,pu)|0,Do=Do+Math.imul(iu,qu)|0,Lo=Lo+Math.imul(iu,pu)|0,Io=Io+Math.imul(cu,Au)|0,Do=Do+Math.imul(cu,yu)|0,Do=Do+Math.imul(Ll,Au)|0,Lo=Lo+Math.imul(Ll,yu)|0,Io=Io+Math.imul(Dl,Gu)|0,Do=Do+Math.imul(Dl,Ml)|0,Do=Do+Math.imul(Fl,Gu)|0,Lo=Lo+Math.imul(Fl,Ml)|0,Io=Io+Math.imul(Zl,Yl)|0,Do=Do+Math.imul(Zl,Wl)|0,Do=Do+Math.imul(Vl,Yl)|0,Lo=Lo+Math.imul(Vl,Wl)|0,Io=Io+Math.imul(El,Su)|0,Do=Do+Math.imul(El,ru)|0,Do=Do+Math.imul(Tl,Su)|0,Lo=Lo+Math.imul(Tl,ru)|0,Io=Io+Math.imul(ga,xl)|0,Do=Do+Math.imul(ga,$l)|0,Do=Do+Math.imul($a,xl)|0,Lo=Lo+Math.imul($a,$l)|0,Io=Io+Math.imul(Ko,Zo)|0,Do=Do+Math.imul(Ko,Rl)|0,Do=Do+Math.imul(Qo,Zo)|0,Lo=Lo+Math.imul(Qo,Rl)|0,Io=Io+Math.imul(Yo,au)|0,Do=Do+Math.imul(Yo,tu)|0,Do=Do+Math.imul(Xo,au)|0,Lo=Lo+Math.imul(Xo,tu)|0;var _h=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(_h>>>26)|0,_h&=67108863,Io=Math.imul(yl,su),Do=Math.imul(yl,Ql),Do=Do+Math.imul(Al,su)|0,Lo=Math.imul(Al,Ql),Io=Io+Math.imul(Cu,qu)|0,Do=Do+Math.imul(Cu,pu)|0,Do=Do+Math.imul(_l,qu)|0,Lo=Lo+Math.imul(_l,pu)|0,Io=Io+Math.imul(ku,Au)|0,Do=Do+Math.imul(ku,yu)|0,Do=Do+Math.imul(iu,Au)|0,Lo=Lo+Math.imul(iu,yu)|0,Io=Io+Math.imul(cu,Gu)|0,Do=Do+Math.imul(cu,Ml)|0,Do=Do+Math.imul(Ll,Gu)|0,Lo=Lo+Math.imul(Ll,Ml)|0,Io=Io+Math.imul(Dl,Yl)|0,Do=Do+Math.imul(Dl,Wl)|0,Do=Do+Math.imul(Fl,Yl)|0,Lo=Lo+Math.imul(Fl,Wl)|0,Io=Io+Math.imul(Zl,Su)|0,Do=Do+Math.imul(Zl,ru)|0,Do=Do+Math.imul(Vl,Su)|0,Lo=Lo+Math.imul(Vl,ru)|0,Io=Io+Math.imul(El,xl)|0,Do=Do+Math.imul(El,$l)|0,Do=Do+Math.imul(Tl,xl)|0,Lo=Lo+Math.imul(Tl,$l)|0,Io=Io+Math.imul(ga,Zo)|0,Do=Do+Math.imul(ga,Rl)|0,Do=Do+Math.imul($a,Zo)|0,Lo=Lo+Math.imul($a,Rl)|0,Io=Io+Math.imul(Ko,au)|0,Do=Do+Math.imul(Ko,tu)|0,Do=Do+Math.imul(Qo,au)|0,Lo=Lo+Math.imul(Qo,tu)|0,Io=Io+Math.imul(Yo,Nu)|0,Do=Do+Math.imul(Yo,Pu)|0,Do=Do+Math.imul(Xo,Nu)|0,Lo=Lo+Math.imul(Xo,Pu)|0;var zu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(zu>>>26)|0,zu&=67108863,Io=Math.imul(yl,qu),Do=Math.imul(yl,pu),Do=Do+Math.imul(Al,qu)|0,Lo=Math.imul(Al,pu),Io=Io+Math.imul(Cu,Au)|0,Do=Do+Math.imul(Cu,yu)|0,Do=Do+Math.imul(_l,Au)|0,Lo=Lo+Math.imul(_l,yu)|0,Io=Io+Math.imul(ku,Gu)|0,Do=Do+Math.imul(ku,Ml)|0,Do=Do+Math.imul(iu,Gu)|0,Lo=Lo+Math.imul(iu,Ml)|0,Io=Io+Math.imul(cu,Yl)|0,Do=Do+Math.imul(cu,Wl)|0,Do=Do+Math.imul(Ll,Yl)|0,Lo=Lo+Math.imul(Ll,Wl)|0,Io=Io+Math.imul(Dl,Su)|0,Do=Do+Math.imul(Dl,ru)|0,Do=Do+Math.imul(Fl,Su)|0,Lo=Lo+Math.imul(Fl,ru)|0,Io=Io+Math.imul(Zl,xl)|0,Do=Do+Math.imul(Zl,$l)|0,Do=Do+Math.imul(Vl,xl)|0,Lo=Lo+Math.imul(Vl,$l)|0,Io=Io+Math.imul(El,Zo)|0,Do=Do+Math.imul(El,Rl)|0,Do=Do+Math.imul(Tl,Zo)|0,Lo=Lo+Math.imul(Tl,Rl)|0,Io=Io+Math.imul(ga,au)|0,Do=Do+Math.imul(ga,tu)|0,Do=Do+Math.imul($a,au)|0,Lo=Lo+Math.imul($a,tu)|0,Io=Io+Math.imul(Ko,Nu)|0,Do=Do+Math.imul(Ko,Pu)|0,Do=Do+Math.imul(Qo,Nu)|0,Lo=Lo+Math.imul(Qo,Pu)|0;var Vu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,Io=Math.imul(yl,Au),Do=Math.imul(yl,yu),Do=Do+Math.imul(Al,Au)|0,Lo=Math.imul(Al,yu),Io=Io+Math.imul(Cu,Gu)|0,Do=Do+Math.imul(Cu,Ml)|0,Do=Do+Math.imul(_l,Gu)|0,Lo=Lo+Math.imul(_l,Ml)|0,Io=Io+Math.imul(ku,Yl)|0,Do=Do+Math.imul(ku,Wl)|0,Do=Do+Math.imul(iu,Yl)|0,Lo=Lo+Math.imul(iu,Wl)|0,Io=Io+Math.imul(cu,Su)|0,Do=Do+Math.imul(cu,ru)|0,Do=Do+Math.imul(Ll,Su)|0,Lo=Lo+Math.imul(Ll,ru)|0,Io=Io+Math.imul(Dl,xl)|0,Do=Do+Math.imul(Dl,$l)|0,Do=Do+Math.imul(Fl,xl)|0,Lo=Lo+Math.imul(Fl,$l)|0,Io=Io+Math.imul(Zl,Zo)|0,Do=Do+Math.imul(Zl,Rl)|0,Do=Do+Math.imul(Vl,Zo)|0,Lo=Lo+Math.imul(Vl,Rl)|0,Io=Io+Math.imul(El,au)|0,Do=Do+Math.imul(El,tu)|0,Do=Do+Math.imul(Tl,au)|0,Lo=Lo+Math.imul(Tl,tu)|0,Io=Io+Math.imul(ga,Nu)|0,Do=Do+Math.imul(ga,Pu)|0,Do=Do+Math.imul($a,Nu)|0,Lo=Lo+Math.imul($a,Pu)|0;var Fu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,Io=Math.imul(yl,Gu),Do=Math.imul(yl,Ml),Do=Do+Math.imul(Al,Gu)|0,Lo=Math.imul(Al,Ml),Io=Io+Math.imul(Cu,Yl)|0,Do=Do+Math.imul(Cu,Wl)|0,Do=Do+Math.imul(_l,Yl)|0,Lo=Lo+Math.imul(_l,Wl)|0,Io=Io+Math.imul(ku,Su)|0,Do=Do+Math.imul(ku,ru)|0,Do=Do+Math.imul(iu,Su)|0,Lo=Lo+Math.imul(iu,ru)|0,Io=Io+Math.imul(cu,xl)|0,Do=Do+Math.imul(cu,$l)|0,Do=Do+Math.imul(Ll,xl)|0,Lo=Lo+Math.imul(Ll,$l)|0,Io=Io+Math.imul(Dl,Zo)|0,Do=Do+Math.imul(Dl,Rl)|0,Do=Do+Math.imul(Fl,Zo)|0,Lo=Lo+Math.imul(Fl,Rl)|0,Io=Io+Math.imul(Zl,au)|0,Do=Do+Math.imul(Zl,tu)|0,Do=Do+Math.imul(Vl,au)|0,Lo=Lo+Math.imul(Vl,tu)|0,Io=Io+Math.imul(El,Nu)|0,Do=Do+Math.imul(El,Pu)|0,Do=Do+Math.imul(Tl,Nu)|0,Lo=Lo+Math.imul(Tl,Pu)|0;var Tu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Io=Math.imul(yl,Yl),Do=Math.imul(yl,Wl),Do=Do+Math.imul(Al,Yl)|0,Lo=Math.imul(Al,Wl),Io=Io+Math.imul(Cu,Su)|0,Do=Do+Math.imul(Cu,ru)|0,Do=Do+Math.imul(_l,Su)|0,Lo=Lo+Math.imul(_l,ru)|0,Io=Io+Math.imul(ku,xl)|0,Do=Do+Math.imul(ku,$l)|0,Do=Do+Math.imul(iu,xl)|0,Lo=Lo+Math.imul(iu,$l)|0,Io=Io+Math.imul(cu,Zo)|0,Do=Do+Math.imul(cu,Rl)|0,Do=Do+Math.imul(Ll,Zo)|0,Lo=Lo+Math.imul(Ll,Rl)|0,Io=Io+Math.imul(Dl,au)|0,Do=Do+Math.imul(Dl,tu)|0,Do=Do+Math.imul(Fl,au)|0,Lo=Lo+Math.imul(Fl,tu)|0,Io=Io+Math.imul(Zl,Nu)|0,Do=Do+Math.imul(Zl,Pu)|0,Do=Do+Math.imul(Vl,Nu)|0,Lo=Lo+Math.imul(Vl,Pu)|0;var Ru=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,Io=Math.imul(yl,Su),Do=Math.imul(yl,ru),Do=Do+Math.imul(Al,Su)|0,Lo=Math.imul(Al,ru),Io=Io+Math.imul(Cu,xl)|0,Do=Do+Math.imul(Cu,$l)|0,Do=Do+Math.imul(_l,xl)|0,Lo=Lo+Math.imul(_l,$l)|0,Io=Io+Math.imul(ku,Zo)|0,Do=Do+Math.imul(ku,Rl)|0,Do=Do+Math.imul(iu,Zo)|0,Lo=Lo+Math.imul(iu,Rl)|0,Io=Io+Math.imul(cu,au)|0,Do=Do+Math.imul(cu,tu)|0,Do=Do+Math.imul(Ll,au)|0,Lo=Lo+Math.imul(Ll,tu)|0,Io=Io+Math.imul(Dl,Nu)|0,Do=Do+Math.imul(Dl,Pu)|0,Do=Do+Math.imul(Fl,Nu)|0,Lo=Lo+Math.imul(Fl,Pu)|0;var Ou=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,Io=Math.imul(yl,xl),Do=Math.imul(yl,$l),Do=Do+Math.imul(Al,xl)|0,Lo=Math.imul(Al,$l),Io=Io+Math.imul(Cu,Zo)|0,Do=Do+Math.imul(Cu,Rl)|0,Do=Do+Math.imul(_l,Zo)|0,Lo=Lo+Math.imul(_l,Rl)|0,Io=Io+Math.imul(ku,au)|0,Do=Do+Math.imul(ku,tu)|0,Do=Do+Math.imul(iu,au)|0,Lo=Lo+Math.imul(iu,tu)|0,Io=Io+Math.imul(cu,Nu)|0,Do=Do+Math.imul(cu,Pu)|0,Do=Do+Math.imul(Ll,Nu)|0,Lo=Lo+Math.imul(Ll,Pu)|0;var _u=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(_u>>>26)|0,_u&=67108863,Io=Math.imul(yl,Zo),Do=Math.imul(yl,Rl),Do=Do+Math.imul(Al,Zo)|0,Lo=Math.imul(Al,Rl),Io=Io+Math.imul(Cu,au)|0,Do=Do+Math.imul(Cu,tu)|0,Do=Do+Math.imul(_l,au)|0,Lo=Lo+Math.imul(_l,tu)|0,Io=Io+Math.imul(ku,Nu)|0,Do=Do+Math.imul(ku,Pu)|0,Do=Do+Math.imul(iu,Nu)|0,Lo=Lo+Math.imul(iu,Pu)|0;var $u=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+($u>>>26)|0,$u&=67108863,Io=Math.imul(yl,au),Do=Math.imul(yl,tu),Do=Do+Math.imul(Al,au)|0,Lo=Math.imul(Al,tu),Io=Io+Math.imul(Cu,Nu)|0,Do=Do+Math.imul(Cu,Pu)|0,Do=Do+Math.imul(_l,Nu)|0,Lo=Lo+Math.imul(_l,Pu)|0;var Uu=(mo+Io|0)+((Do&8191)<<13)|0;mo=(Lo+(Do>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,Io=Math.imul(yl,Nu),Do=Math.imul(yl,Pu),Do=Do+Math.imul(Al,Nu)|0,Lo=Math.imul(Al,Pu);var ju=(mo+Io|0)+((Do&8191)<<13)|0;return mo=(Lo+(Do>>>13)|0)+(ju>>>26)|0,ju&=67108863,ko[0]=ip,ko[1]=Lu,ko[2]=Yu,ko[3]=_d,ko[4]=Qu,ko[5]=_f,ko[6]=ep,ko[7]=Xu,ko[8]=_h,ko[9]=zu,ko[10]=Vu,ko[11]=Fu,ko[12]=Tu,ko[13]=Ru,ko[14]=Ou,ko[15]=_u,ko[16]=$u,ko[17]=Uu,ko[18]=ju,mo!==0&&(ko[19]=mo,So.length++),So};Math.imul||(Co=$o);function Ro(yo,vo,_o){_o.negative=vo.negative^yo.negative,_o.length=yo.length+vo.length;for(var So=0,To=0,Ao=0;Ao<_o.length-1;Ao++){var ko=To;To=0;for(var mo=So&67108863,Io=Math.min(Ao,vo.length-1),Do=Math.max(0,Ao-yo.length+1);Do<=Io;Do++){var Lo=Ao-Do,Ho=yo.words[Lo]|0,Yo=vo.words[Do]|0,Xo=Ho*Yo,qo=Xo&67108863;ko=ko+(Xo/67108864|0)|0,qo=qo+mo|0,mo=qo&67108863,ko=ko+(qo>>>26)|0,To+=ko>>>26,ko&=67108863}_o.words[Ao]=mo,So=ko,ko=To}return So!==0?_o.words[Ao]=So:_o.length--,_o._strip()}function Oo(yo,vo,_o){return Ro(yo,vo,_o)}io.prototype.mulTo=function(vo,_o){var So,To=this.length+vo.length;return this.length===10&&vo.length===10?So=Co(this,vo,_o):To<63?So=$o(this,vo,_o):To<1024?So=Ro(this,vo,_o):So=Oo(this,vo,_o),So},io.prototype.mul=function(vo){var _o=new io(null);return _o.words=new Array(this.length+vo.length),this.mulTo(vo,_o)},io.prototype.mulf=function(vo){var _o=new io(null);return _o.words=new Array(this.length+vo.length),Oo(this,vo,_o)},io.prototype.imul=function(vo){return this.clone().mulTo(vo,this)},io.prototype.imuln=function(vo){var _o=vo<0;_o&&(vo=-vo),ro(typeof vo=="number"),ro(vo<67108864);for(var So=0,To=0;To>=26,So+=Ao/67108864|0,So+=ko>>>26,this.words[To]=ko&67108863}return So!==0&&(this.words[To]=So,this.length++),_o?this.ineg():this},io.prototype.muln=function(vo){return this.clone().imuln(vo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(vo){var _o=Eo(vo);if(_o.length===0)return new io(1);for(var So=this,To=0;To<_o.length&&_o[To]===0;To++,So=So.sqr());if(++To<_o.length)for(var Ao=So.sqr();To<_o.length;To++,Ao=Ao.sqr())_o[To]!==0&&(So=So.mul(Ao));return So},io.prototype.iushln=function(vo){ro(typeof vo=="number"&&vo>=0);var _o=vo%26,So=(vo-_o)/26,To=67108863>>>26-_o<<26-_o,Ao;if(_o!==0){var ko=0;for(Ao=0;Ao>>26-_o}ko&&(this.words[Ao]=ko,this.length++)}if(So!==0){for(Ao=this.length-1;Ao>=0;Ao--)this.words[Ao+So]=this.words[Ao];for(Ao=0;Ao=0);var To;_o?To=(_o-_o%26)/26:To=0;var Ao=vo%26,ko=Math.min((vo-Ao)/26,this.length),mo=67108863^67108863>>>Ao<ko)for(this.length-=ko,Do=0;Do=0&&(Lo!==0||Do>=To);Do--){var Ho=this.words[Do]|0;this.words[Do]=Lo<<26-Ao|Ho>>>Ao,Lo=Ho&mo}return Io&&Lo!==0&&(Io.words[Io.length++]=Lo),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(vo,_o,So){return ro(this.negative===0),this.iushrn(vo,_o,So)},io.prototype.shln=function(vo){return this.clone().ishln(vo)},io.prototype.ushln=function(vo){return this.clone().iushln(vo)},io.prototype.shrn=function(vo){return this.clone().ishrn(vo)},io.prototype.ushrn=function(vo){return this.clone().iushrn(vo)},io.prototype.testn=function(vo){ro(typeof vo=="number"&&vo>=0);var _o=vo%26,So=(vo-_o)/26,To=1<<_o;if(this.length<=So)return!1;var Ao=this.words[So];return!!(Ao&To)},io.prototype.imaskn=function(vo){ro(typeof vo=="number"&&vo>=0);var _o=vo%26,So=(vo-_o)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=So)return this;if(_o!==0&&So++,this.length=Math.min(So,this.length),_o!==0){var To=67108863^67108863>>>_o<<_o;this.words[this.length-1]&=To}return this._strip()},io.prototype.maskn=function(vo){return this.clone().imaskn(vo)},io.prototype.iaddn=function(vo){return ro(typeof vo=="number"),ro(vo<67108864),vo<0?this.isubn(-vo):this.negative!==0?this.length===1&&(this.words[0]|0)<=vo?(this.words[0]=vo-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(vo),this.negative=1,this):this._iaddn(vo)},io.prototype._iaddn=function(vo){this.words[0]+=vo;for(var _o=0;_o=67108864;_o++)this.words[_o]-=67108864,_o===this.length-1?this.words[_o+1]=1:this.words[_o+1]++;return this.length=Math.max(this.length,_o+1),this},io.prototype.isubn=function(vo){if(ro(typeof vo=="number"),ro(vo<67108864),vo<0)return this.iaddn(-vo);if(this.negative!==0)return this.negative=0,this.iaddn(vo),this.negative=1,this;if(this.words[0]-=vo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _o=0;_o>26)-(Io/67108864|0),this.words[Ao+So]=ko&67108863}for(;Ao>26,this.words[Ao+So]=ko&67108863;if(mo===0)return this._strip();for(ro(mo===-1),mo=0,Ao=0;Ao>26,this.words[Ao]=ko&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(vo,_o){var So=this.length-vo.length,To=this.clone(),Ao=vo,ko=Ao.words[Ao.length-1]|0,mo=this._countBits(ko);So=26-mo,So!==0&&(Ao=Ao.ushln(So),To.iushln(So),ko=Ao.words[Ao.length-1]|0);var Io=To.length-Ao.length,Do;if(_o!=="mod"){Do=new io(null),Do.length=Io+1,Do.words=new Array(Do.length);for(var Lo=0;Lo=0;Yo--){var Xo=(To.words[Ao.length+Yo]|0)*67108864+(To.words[Ao.length+Yo-1]|0);for(Xo=Math.min(Xo/ko|0,67108863),To._ishlnsubmul(Ao,Xo,Yo);To.negative!==0;)Xo--,To.negative=0,To._ishlnsubmul(Ao,1,Yo),To.isZero()||(To.negative^=1);Do&&(Do.words[Yo]=Xo)}return Do&&Do._strip(),To._strip(),_o!=="div"&&So!==0&&To.iushrn(So),{div:Do||null,mod:To}},io.prototype.divmod=function(vo,_o,So){if(ro(!vo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var To,Ao,ko;return this.negative!==0&&vo.negative===0?(ko=this.neg().divmod(vo,_o),_o!=="mod"&&(To=ko.div.neg()),_o!=="div"&&(Ao=ko.mod.neg(),So&&Ao.negative!==0&&Ao.iadd(vo)),{div:To,mod:Ao}):this.negative===0&&vo.negative!==0?(ko=this.divmod(vo.neg(),_o),_o!=="mod"&&(To=ko.div.neg()),{div:To,mod:ko.mod}):this.negative&vo.negative?(ko=this.neg().divmod(vo.neg(),_o),_o!=="div"&&(Ao=ko.mod.neg(),So&&Ao.negative!==0&&Ao.isub(vo)),{div:ko.div,mod:Ao}):vo.length>this.length||this.cmp(vo)<0?{div:new io(0),mod:this}:vo.length===1?_o==="div"?{div:this.divn(vo.words[0]),mod:null}:_o==="mod"?{div:null,mod:new io(this.modrn(vo.words[0]))}:{div:this.divn(vo.words[0]),mod:new io(this.modrn(vo.words[0]))}:this._wordDiv(vo,_o)},io.prototype.div=function(vo){return this.divmod(vo,"div",!1).div},io.prototype.mod=function(vo){return this.divmod(vo,"mod",!1).mod},io.prototype.umod=function(vo){return this.divmod(vo,"mod",!0).mod},io.prototype.divRound=function(vo){var _o=this.divmod(vo);if(_o.mod.isZero())return _o.div;var So=_o.div.negative!==0?_o.mod.isub(vo):_o.mod,To=vo.ushrn(1),Ao=vo.andln(1),ko=So.cmp(To);return ko<0||Ao===1&&ko===0?_o.div:_o.div.negative!==0?_o.div.isubn(1):_o.div.iaddn(1)},io.prototype.modrn=function(vo){var _o=vo<0;_o&&(vo=-vo),ro(vo<=67108863);for(var So=(1<<26)%vo,To=0,Ao=this.length-1;Ao>=0;Ao--)To=(So*To+(this.words[Ao]|0))%vo;return _o?-To:To},io.prototype.modn=function(vo){return this.modrn(vo)},io.prototype.idivn=function(vo){var _o=vo<0;_o&&(vo=-vo),ro(vo<=67108863);for(var So=0,To=this.length-1;To>=0;To--){var Ao=(this.words[To]|0)+So*67108864;this.words[To]=Ao/vo|0,So=Ao%vo}return this._strip(),_o?this.ineg():this},io.prototype.divn=function(vo){return this.clone().idivn(vo)},io.prototype.egcd=function(vo){ro(vo.negative===0),ro(!vo.isZero());var _o=this,So=vo.clone();_o.negative!==0?_o=_o.umod(vo):_o=_o.clone();for(var To=new io(1),Ao=new io(0),ko=new io(0),mo=new io(1),Io=0;_o.isEven()&&So.isEven();)_o.iushrn(1),So.iushrn(1),++Io;for(var Do=So.clone(),Lo=_o.clone();!_o.isZero();){for(var Ho=0,Yo=1;!(_o.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(_o.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(Do),Ao.isub(Lo)),To.iushrn(1),Ao.iushrn(1);for(var Xo=0,qo=1;!(So.words[0]&qo)&&Xo<26;++Xo,qo<<=1);if(Xo>0)for(So.iushrn(Xo);Xo-- >0;)(ko.isOdd()||mo.isOdd())&&(ko.iadd(Do),mo.isub(Lo)),ko.iushrn(1),mo.iushrn(1);_o.cmp(So)>=0?(_o.isub(So),To.isub(ko),Ao.isub(mo)):(So.isub(_o),ko.isub(To),mo.isub(Ao))}return{a:ko,b:mo,gcd:So.iushln(Io)}},io.prototype._invmp=function(vo){ro(vo.negative===0),ro(!vo.isZero());var _o=this,So=vo.clone();_o.negative!==0?_o=_o.umod(vo):_o=_o.clone();for(var To=new io(1),Ao=new io(0),ko=So.clone();_o.cmpn(1)>0&&So.cmpn(1)>0;){for(var mo=0,Io=1;!(_o.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(_o.iushrn(mo);mo-- >0;)To.isOdd()&&To.iadd(ko),To.iushrn(1);for(var Do=0,Lo=1;!(So.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(So.iushrn(Do);Do-- >0;)Ao.isOdd()&&Ao.iadd(ko),Ao.iushrn(1);_o.cmp(So)>=0?(_o.isub(So),To.isub(Ao)):(So.isub(_o),Ao.isub(To))}var Ho;return _o.cmpn(1)===0?Ho=To:Ho=Ao,Ho.cmpn(0)<0&&Ho.iadd(vo),Ho},io.prototype.gcd=function(vo){if(this.isZero())return vo.abs();if(vo.isZero())return this.abs();var _o=this.clone(),So=vo.clone();_o.negative=0,So.negative=0;for(var To=0;_o.isEven()&&So.isEven();To++)_o.iushrn(1),So.iushrn(1);do{for(;_o.isEven();)_o.iushrn(1);for(;So.isEven();)So.iushrn(1);var Ao=_o.cmp(So);if(Ao<0){var ko=_o;_o=So,So=ko}else if(Ao===0||So.cmpn(1)===0)break;_o.isub(So)}while(!0);return So.iushln(To)},io.prototype.invm=function(vo){return this.egcd(vo).a.umod(vo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(vo){return this.words[0]&vo},io.prototype.bincn=function(vo){ro(typeof vo=="number");var _o=vo%26,So=(vo-_o)/26,To=1<<_o;if(this.length<=So)return this._expand(So+1),this.words[So]|=To,this;for(var Ao=To,ko=So;Ao!==0&&ko>>26,mo&=67108863,this.words[ko]=mo}return Ao!==0&&(this.words[ko]=Ao,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(vo){var _o=vo<0;if(this.negative!==0&&!_o)return-1;if(this.negative===0&&_o)return 1;this._strip();var So;if(this.length>1)So=1;else{_o&&(vo=-vo),ro(vo<=67108863,"Number is too big");var To=this.words[0]|0;So=To===vo?0:Tovo.length)return 1;if(this.length=0;So--){var To=this.words[So]|0,Ao=vo.words[So]|0;if(To!==Ao){ToAo&&(_o=1);break}}return _o},io.prototype.gtn=function(vo){return this.cmpn(vo)===1},io.prototype.gt=function(vo){return this.cmp(vo)===1},io.prototype.gten=function(vo){return this.cmpn(vo)>=0},io.prototype.gte=function(vo){return this.cmp(vo)>=0},io.prototype.ltn=function(vo){return this.cmpn(vo)===-1},io.prototype.lt=function(vo){return this.cmp(vo)===-1},io.prototype.lten=function(vo){return this.cmpn(vo)<=0},io.prototype.lte=function(vo){return this.cmp(vo)<=0},io.prototype.eqn=function(vo){return this.cmpn(vo)===0},io.prototype.eq=function(vo){return this.cmp(vo)===0},io.red=function(vo){return new Po(vo)},io.prototype.toRed=function(vo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),vo.convertTo(this)._forceRed(vo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(vo){return this.red=vo,this},io.prototype.forceRed=function(vo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(vo)},io.prototype.redAdd=function(vo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,vo)},io.prototype.redIAdd=function(vo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,vo)},io.prototype.redSub=function(vo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,vo)},io.prototype.redISub=function(vo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,vo)},io.prototype.redShl=function(vo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,vo)},io.prototype.redMul=function(vo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,vo),this.red.mul(this,vo)},io.prototype.redIMul=function(vo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,vo),this.red.imul(this,vo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(vo){return ro(this.red&&!vo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,vo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Bo(yo,vo){this.name=yo,this.p=new io(vo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Bo.prototype._tmp=function(){var vo=new io(null);return vo.words=new Array(Math.ceil(this.n/13)),vo},Bo.prototype.ireduce=function(vo){var _o=vo,So;do this.split(_o,this.tmp),_o=this.imulK(_o),_o=_o.iadd(this.tmp),So=_o.bitLength();while(So>this.n);var To=So0?_o.isub(this.p):_o.strip!==void 0?_o.strip():_o._strip(),_o},Bo.prototype.split=function(vo,_o){vo.iushrn(this.n,0,_o)},Bo.prototype.imulK=function(vo){return vo.imul(this.k)};function Mo(){Bo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(Mo,Bo),Mo.prototype.split=function(vo,_o){for(var So=4194303,To=Math.min(vo.length,9),Ao=0;Ao>>22,ko=mo}ko>>>=22,vo.words[Ao-10]=ko,ko===0&&vo.length>10?vo.length-=10:vo.length-=9},Mo.prototype.imulK=function(vo){vo.words[vo.length]=0,vo.words[vo.length+1]=0,vo.length+=2;for(var _o=0,So=0;So>>=26,vo.words[So]=Ao,_o=To}return _o!==0&&(vo.words[vo.length++]=_o),vo},io._prime=function(vo){if(jo[vo])return jo[vo];var _o;if(vo==="k256")_o=new Mo;else if(vo==="p224")_o=new Fo;else if(vo==="p192")_o=new Wo;else if(vo==="p25519")_o=new Jo;else throw new Error("Unknown prime "+vo);return jo[vo]=_o,_o};function Po(yo){if(typeof yo=="string"){var vo=io._prime(yo);this.m=vo.p,this.prime=vo}else ro(yo.gtn(1),"modulus must be greater than 1"),this.m=yo,this.prime=null}Po.prototype._verify1=function(vo){ro(vo.negative===0,"red works only with positives"),ro(vo.red,"red works only with red numbers")},Po.prototype._verify2=function(vo,_o){ro((vo.negative|_o.negative)===0,"red works only with positives"),ro(vo.red&&vo.red===_o.red,"red works only with red numbers")},Po.prototype.imod=function(vo){return this.prime?this.prime.ireduce(vo)._forceRed(this):(lo(vo,vo.umod(this.m)._forceRed(this)),vo)},Po.prototype.neg=function(vo){return vo.isZero()?vo.clone():this.m.sub(vo)._forceRed(this)},Po.prototype.add=function(vo,_o){this._verify2(vo,_o);var So=vo.add(_o);return So.cmp(this.m)>=0&&So.isub(this.m),So._forceRed(this)},Po.prototype.iadd=function(vo,_o){this._verify2(vo,_o);var So=vo.iadd(_o);return So.cmp(this.m)>=0&&So.isub(this.m),So},Po.prototype.sub=function(vo,_o){this._verify2(vo,_o);var So=vo.sub(_o);return So.cmpn(0)<0&&So.iadd(this.m),So._forceRed(this)},Po.prototype.isub=function(vo,_o){this._verify2(vo,_o);var So=vo.isub(_o);return So.cmpn(0)<0&&So.iadd(this.m),So},Po.prototype.shl=function(vo,_o){return this._verify1(vo),this.imod(vo.ushln(_o))},Po.prototype.imul=function(vo,_o){return this._verify2(vo,_o),this.imod(vo.imul(_o))},Po.prototype.mul=function(vo,_o){return this._verify2(vo,_o),this.imod(vo.mul(_o))},Po.prototype.isqr=function(vo){return this.imul(vo,vo.clone())},Po.prototype.sqr=function(vo){return this.mul(vo,vo)},Po.prototype.sqrt=function(vo){if(vo.isZero())return vo.clone();var _o=this.m.andln(3);if(ro(_o%2===1),_o===3){var So=this.m.add(new io(1)).iushrn(2);return this.pow(vo,So)}for(var To=this.m.subn(1),Ao=0;!To.isZero()&&To.andln(1)===0;)Ao++,To.iushrn(1);ro(!To.isZero());var ko=new io(1).toRed(this),mo=ko.redNeg(),Io=this.m.subn(1).iushrn(1),Do=this.m.bitLength();for(Do=new io(2*Do*Do).toRed(this);this.pow(Do,Io).cmp(mo)!==0;)Do.redIAdd(mo);for(var Lo=this.pow(Do,To),Ho=this.pow(vo,To.addn(1).iushrn(1)),Yo=this.pow(vo,To),Xo=Ao;Yo.cmp(ko)!==0;){for(var qo=Yo,Ko=0;qo.cmp(ko)!==0;Ko++)qo=qo.redSqr();ro(Ko=0;Ao--){for(var Lo=_o.words[Ao],Ho=Do-1;Ho>=0;Ho--){var Yo=Lo>>Ho&1;if(ko!==To[0]&&(ko=this.sqr(ko)),Yo===0&&mo===0){Io=0;continue}mo<<=1,mo|=Yo,Io++,!(Io!==So&&(Ao!==0||Ho!==0))&&(ko=this.mul(ko,To[mo]),Io=0,mo=0)}Do=26}return ko},Po.prototype.convertTo=function(vo){var _o=vo.umod(this.m);return _o===vo?_o.clone():_o},Po.prototype.convertFrom=function(vo){var _o=vo.clone();return _o.red=null,_o},io.mont=function(vo){return new fo(vo)};function fo(yo){Po.call(this,yo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(fo,Po),fo.prototype.convertTo=function(vo){return this.imod(vo.ushln(this.shift))},fo.prototype.convertFrom=function(vo){var _o=this.imod(vo.mul(this.rinv));return _o.red=null,_o},fo.prototype.imul=function(vo,_o){if(vo.isZero()||_o.isZero())return vo.words[0]=0,vo.length=1,vo;var So=vo.imul(_o),To=So.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Ao=So.isub(To).iushrn(this.shift),ko=Ao;return Ao.cmp(this.m)>=0?ko=Ao.isub(this.m):Ao.cmpn(0)<0&&(ko=Ao.iadd(this.m)),ko._forceRed(this)},fo.prototype.mul=function(vo,_o){if(vo.isZero()||_o.isZero())return new io(0)._forceRed(this);var So=vo.mul(_o),To=So.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Ao=So.isub(To).iushrn(this.shift),ko=Ao;return Ao.cmp(this.m)>=0?ko=Ao.isub(this.m):Ao.cmpn(0)<0&&(ko=Ao.iadd(this.m)),ko._forceRed(this)},fo.prototype.invm=function(vo){var _o=this.imod(vo._invmp(this.m).mul(this.r2));return _o._forceRed(this)}})(Xr,commonjsGlobal)})(bn$5);var bnExports=bn$5.exports;const BN=getDefaultExportFromCjs$2(bnExports);var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var Xr=bnExports,eo=requireBrowser$b(),to=safeBufferExports.Buffer;function ro(oo){var ao=oo.modulus.byteLength(),so;do so=new Xr(eo(ao));while(so.cmp(oo.modulus)>=0||!so.umod(oo.prime1)||!so.umod(oo.prime2));return so}function no(oo){var ao=ro(oo),so=ao.toRed(Xr.mont(oo.modulus)).redPow(new Xr(oo.publicExponent)).fromRed();return{blinder:so,unblinder:ao.invm(oo.modulus)}}function io(oo,ao){var so=no(ao),co=ao.modulus.byteLength(),lo=new Xr(oo).mul(so.blinder).umod(ao.modulus),uo=lo.toRed(Xr.mont(ao.prime1)),ho=lo.toRed(Xr.mont(ao.prime2)),go=ao.coefficient,bo=ao.prime1,wo=ao.prime2,Eo=uo.redPow(ao.exponent1).fromRed(),$o=ho.redPow(ao.exponent2).fromRed(),Co=Eo.isub($o).imul(go).umod(bo).imul(wo);return $o.iadd(Co).imul(so.unblinder).umod(ao.modulus).toArrayLike(to,"be",co)}return io.getr=ro,browserifyRsa=io,browserifyRsa}var elliptic={};const name$1="elliptic",version$i="6.6.0",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$8={name:name$1,version:version$i,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies:dependencies$1};var utils$7={},bn$4={exports:{}};bn$4.exports;var hasRequiredBn$3;function requireBn$3(){return hasRequiredBn$3||(hasRequiredBn$3=1,function(Xr){(function(eo,to){function ro(Po,fo){if(!Po)throw new Error(fo||"Assertion failed")}function no(Po,fo){Po.super_=fo;var yo=function(){};yo.prototype=fo.prototype,Po.prototype=new yo,Po.prototype.constructor=Po}function io(Po,fo,yo){if(io.isBN(Po))return Po;this.negative=0,this.words=null,this.length=0,this.red=null,Po!==null&&((fo==="le"||fo==="be")&&(yo=fo,fo=10),this._init(Po||0,fo||10,yo||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(fo){return fo instanceof io?!0:fo!==null&&typeof fo=="object"&&fo.constructor.wordSize===io.wordSize&&Array.isArray(fo.words)},io.max=function(fo,yo){return fo.cmp(yo)>0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$4)),bn$4.exports}var utils$6={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(Xr){var eo=Xr;function to(io,oo){if(Array.isArray(io))return io.slice();if(!io)return[];var ao=[];if(typeof io!="string"){for(var so=0;so>8,uo=co&255;lo?ao.push(lo,uo):ao.push(uo)}return ao}eo.toArray=to;function ro(io){return io.length===1?"0"+io:io}eo.zero2=ro;function no(io){for(var oo="",ao=0;ao(wo>>1)-1?$o=(wo>>1)-Co:$o=Co,Eo.isubn($o)):$o=0,go[bo]=$o,Eo.iushrn(1)}return go}eo.getNAF=io;function oo(lo,uo){var ho=[[],[]];lo=lo.clone(),uo=uo.clone();for(var go=0,bo=0,wo;lo.cmpn(-go)>0||uo.cmpn(-bo)>0;){var Eo=lo.andln(3)+go&3,$o=uo.andln(3)+bo&3;Eo===3&&(Eo=-1),$o===3&&($o=-1);var Co;Eo&1?(wo=lo.andln(7)+go&7,(wo===3||wo===5)&&$o===2?Co=-Eo:Co=Eo):Co=0,ho[0].push(Co);var Ro;$o&1?(wo=uo.andln(7)+bo&7,(wo===3||wo===5)&&Eo===2?Ro=-$o:Ro=$o):Ro=0,ho[1].push(Ro),2*go===Co+1&&(go=1-go),2*bo===Ro+1&&(bo=1-bo),lo.iushrn(1),uo.iushrn(1)}return ho}eo.getJSF=oo;function ao(lo,uo,ho){var go="_"+uo;lo.prototype[uo]=function(){return this[go]!==void 0?this[go]:this[go]=ho.call(this)}}eo.cachedProperty=ao;function so(lo){return typeof lo=="string"?eo.toArray(lo,"hex"):lo}eo.parseBytes=so;function co(lo){return new to(lo,"hex","le")}eo.intFromLE=co}(utils$7)),utils$7}var curve$1={},base$5,hasRequiredBase$1;function requireBase$1(){if(hasRequiredBase$1)return base$5;hasRequiredBase$1=1;var Xr=requireBn$3(),eo=requireUtils$2(),to=eo.getNAF,ro=eo.getJSF,no=eo.assert;function io(ao,so){this.type=ao,this.p=new Xr(so.p,16),this.red=so.prime?Xr.red(so.prime):Xr.mont(this.p),this.zero=new Xr(0).toRed(this.red),this.one=new Xr(1).toRed(this.red),this.two=new Xr(2).toRed(this.red),this.n=so.n&&new Xr(so.n,16),this.g=so.g&&this.pointFromJSON(so.g,so.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var co=this.n&&this.p.div(this.n);!co||co.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$5=io,io.prototype.point=function(){throw new Error("Not implemented")},io.prototype.validate=function(){throw new Error("Not implemented")},io.prototype._fixedNafMul=function(so,co){no(so.precomputed);var lo=so._getDoubles(),uo=to(co,1,this._bitLength),ho=(1<=bo;Eo--)wo=(wo<<1)+uo[Eo];go.push(wo)}for(var $o=this.jpoint(null,null,null),Co=this.jpoint(null,null,null),Ro=ho;Ro>0;Ro--){for(bo=0;bo=0;wo--){for(var Eo=0;wo>=0&&go[wo]===0;wo--)Eo++;if(wo>=0&&Eo++,bo=bo.dblp(Eo),wo<0)break;var $o=go[wo];no($o!==0),so.type==="affine"?$o>0?bo=bo.mixedAdd(ho[$o-1>>1]):bo=bo.mixedAdd(ho[-$o-1>>1].neg()):$o>0?bo=bo.add(ho[$o-1>>1]):bo=bo.add(ho[-$o-1>>1].neg())}return so.type==="affine"?bo.toP():bo},io.prototype._wnafMulAdd=function(so,co,lo,uo,ho){var go=this._wnafT1,bo=this._wnafT2,wo=this._wnafT3,Eo=0,$o,Co,Ro;for($o=0;$o=1;$o-=2){var jo=$o-1,Bo=$o;if(go[jo]!==1||go[Bo]!==1){wo[jo]=to(lo[jo],go[jo],this._bitLength),wo[Bo]=to(lo[Bo],go[Bo],this._bitLength),Eo=Math.max(wo[jo].length,Eo),Eo=Math.max(wo[Bo].length,Eo);continue}var Mo=[co[jo],null,null,co[Bo]];co[jo].y.cmp(co[Bo].y)===0?(Mo[1]=co[jo].add(co[Bo]),Mo[2]=co[jo].toJ().mixedAdd(co[Bo].neg())):co[jo].y.cmp(co[Bo].y.redNeg())===0?(Mo[1]=co[jo].toJ().mixedAdd(co[Bo]),Mo[2]=co[jo].add(co[Bo].neg())):(Mo[1]=co[jo].toJ().mixedAdd(co[Bo]),Mo[2]=co[jo].toJ().mixedAdd(co[Bo].neg()));var Fo=[-3,-1,-5,-7,0,7,5,1,3],Wo=ro(lo[jo],lo[Bo]);for(Eo=Math.max(Wo[0].length,Eo),wo[jo]=new Array(Eo),wo[Bo]=new Array(Eo),Co=0;Co=0;$o--){for(var vo=0;$o>=0;){var _o=!0;for(Co=0;Co=0&&vo++,fo=fo.dblp(vo),$o<0)break;for(Co=0;Co0?Ro=bo[Co][So-1>>1]:So<0&&(Ro=bo[Co][-So-1>>1].neg()),Ro.type==="affine"?fo=fo.mixedAdd(Ro):fo=fo.add(Ro))}}for($o=0;$o=Math.ceil((so.bitLength()+1)/co.step):!1},oo.prototype._getDoubles=function(so,co){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var lo=[this],uo=this,ho=0;ho=0&&(jo=$o,Bo=Co),Ro.negative&&(Ro=Ro.neg(),Oo=Oo.neg()),jo.negative&&(jo=jo.neg(),Bo=Bo.neg()),[{a:Ro,b:Oo},{a:jo,b:Bo}]},io.prototype._endoSplit=function(co){var lo=this.endo.basis,uo=lo[0],ho=lo[1],go=ho.b.mul(co).divRound(this.n),bo=uo.b.neg().mul(co).divRound(this.n),wo=go.mul(uo.a),Eo=bo.mul(ho.a),$o=go.mul(uo.b),Co=bo.mul(ho.b),Ro=co.sub(wo).sub(Eo),Oo=$o.add(Co).neg();return{k1:Ro,k2:Oo}},io.prototype.pointFromX=function(co,lo){co=new eo(co,16),co.red||(co=co.toRed(this.red));var uo=co.redSqr().redMul(co).redIAdd(co.redMul(this.a)).redIAdd(this.b),ho=uo.redSqrt();if(ho.redSqr().redSub(uo).cmp(this.zero)!==0)throw new Error("invalid point");var go=ho.fromRed().isOdd();return(lo&&!go||!lo&&go)&&(ho=ho.redNeg()),this.point(co,ho)},io.prototype.validate=function(co){if(co.inf)return!0;var lo=co.x,uo=co.y,ho=this.a.redMul(lo),go=lo.redSqr().redMul(lo).redIAdd(ho).redIAdd(this.b);return uo.redSqr().redISub(go).cmpn(0)===0},io.prototype._endoWnafMulAdd=function(co,lo,uo){for(var ho=this._endoWnafT1,go=this._endoWnafT2,bo=0;bo":""},oo.prototype.isInfinity=function(){return this.inf},oo.prototype.add=function(co){if(this.inf)return co;if(co.inf)return this;if(this.eq(co))return this.dbl();if(this.neg().eq(co))return this.curve.point(null,null);if(this.x.cmp(co.x)===0)return this.curve.point(null,null);var lo=this.y.redSub(co.y);lo.cmpn(0)!==0&&(lo=lo.redMul(this.x.redSub(co.x).redInvm()));var uo=lo.redSqr().redISub(this.x).redISub(co.x),ho=lo.redMul(this.x.redSub(uo)).redISub(this.y);return this.curve.point(uo,ho)},oo.prototype.dbl=function(){if(this.inf)return this;var co=this.y.redAdd(this.y);if(co.cmpn(0)===0)return this.curve.point(null,null);var lo=this.curve.a,uo=this.x.redSqr(),ho=co.redInvm(),go=uo.redAdd(uo).redIAdd(uo).redIAdd(lo).redMul(ho),bo=go.redSqr().redISub(this.x.redAdd(this.x)),wo=go.redMul(this.x.redSub(bo)).redISub(this.y);return this.curve.point(bo,wo)},oo.prototype.getX=function(){return this.x.fromRed()},oo.prototype.getY=function(){return this.y.fromRed()},oo.prototype.mul=function(co){return co=new eo(co,16),this.isInfinity()?this:this._hasDoubles(co)?this.curve._fixedNafMul(this,co):this.curve.endo?this.curve._endoWnafMulAdd([this],[co]):this.curve._wnafMul(this,co)},oo.prototype.mulAdd=function(co,lo,uo){var ho=[this,lo],go=[co,uo];return this.curve.endo?this.curve._endoWnafMulAdd(ho,go):this.curve._wnafMulAdd(1,ho,go,2)},oo.prototype.jmulAdd=function(co,lo,uo){var ho=[this,lo],go=[co,uo];return this.curve.endo?this.curve._endoWnafMulAdd(ho,go,!0):this.curve._wnafMulAdd(1,ho,go,2,!0)},oo.prototype.eq=function(co){return this===co||this.inf===co.inf&&(this.inf||this.x.cmp(co.x)===0&&this.y.cmp(co.y)===0)},oo.prototype.neg=function(co){if(this.inf)return this;var lo=this.curve.point(this.x,this.y.redNeg());if(co&&this.precomputed){var uo=this.precomputed,ho=function(go){return go.neg()};lo.precomputed={naf:uo.naf&&{wnd:uo.naf.wnd,points:uo.naf.points.map(ho)},doubles:uo.doubles&&{step:uo.doubles.step,points:uo.doubles.points.map(ho)}}}return lo},oo.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var co=this.curve.jpoint(this.x,this.y,this.curve.one);return co};function ao(so,co,lo,uo){ro.BasePoint.call(this,so,"jacobian"),co===null&&lo===null&&uo===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new eo(0)):(this.x=new eo(co,16),this.y=new eo(lo,16),this.z=new eo(uo,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return to(ao,ro.BasePoint),io.prototype.jpoint=function(co,lo,uo){return new ao(this,co,lo,uo)},ao.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var co=this.z.redInvm(),lo=co.redSqr(),uo=this.x.redMul(lo),ho=this.y.redMul(lo).redMul(co);return this.curve.point(uo,ho)},ao.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},ao.prototype.add=function(co){if(this.isInfinity())return co;if(co.isInfinity())return this;var lo=co.z.redSqr(),uo=this.z.redSqr(),ho=this.x.redMul(lo),go=co.x.redMul(uo),bo=this.y.redMul(lo.redMul(co.z)),wo=co.y.redMul(uo.redMul(this.z)),Eo=ho.redSub(go),$o=bo.redSub(wo);if(Eo.cmpn(0)===0)return $o.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Co=Eo.redSqr(),Ro=Co.redMul(Eo),Oo=ho.redMul(Co),jo=$o.redSqr().redIAdd(Ro).redISub(Oo).redISub(Oo),Bo=$o.redMul(Oo.redISub(jo)).redISub(bo.redMul(Ro)),Mo=this.z.redMul(co.z).redMul(Eo);return this.curve.jpoint(jo,Bo,Mo)},ao.prototype.mixedAdd=function(co){if(this.isInfinity())return co.toJ();if(co.isInfinity())return this;var lo=this.z.redSqr(),uo=this.x,ho=co.x.redMul(lo),go=this.y,bo=co.y.redMul(lo).redMul(this.z),wo=uo.redSub(ho),Eo=go.redSub(bo);if(wo.cmpn(0)===0)return Eo.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var $o=wo.redSqr(),Co=$o.redMul(wo),Ro=uo.redMul($o),Oo=Eo.redSqr().redIAdd(Co).redISub(Ro).redISub(Ro),jo=Eo.redMul(Ro.redISub(Oo)).redISub(go.redMul(Co)),Bo=this.z.redMul(wo);return this.curve.jpoint(Oo,jo,Bo)},ao.prototype.dblp=function(co){if(co===0)return this;if(this.isInfinity())return this;if(!co)return this.dbl();var lo;if(this.curve.zeroA||this.curve.threeA){var uo=this;for(lo=0;lo=0)return!1;if(uo.redIAdd(go),this.x.cmp(uo)===0)return!0}},ao.prototype.inspect=function(){return this.isInfinity()?"":""},ao.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short}var mont,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont;hasRequiredMont=1;var Xr=requireBn$3(),eo=requireInherits_browser(),to=requireBase$1(),ro=requireUtils$2();function no(oo){to.call(this,"mont",oo),this.a=new Xr(oo.a,16).toRed(this.red),this.b=new Xr(oo.b,16).toRed(this.red),this.i4=new Xr(4).toRed(this.red).redInvm(),this.two=new Xr(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}eo(no,to),mont=no,no.prototype.validate=function(ao){var so=ao.normalize().x,co=so.redSqr(),lo=co.redMul(so).redAdd(co.redMul(this.a)).redAdd(so),uo=lo.redSqrt();return uo.redSqr().cmp(lo)===0};function io(oo,ao,so){to.BasePoint.call(this,oo,"projective"),ao===null&&so===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Xr(ao,16),this.z=new Xr(so,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return eo(io,to.BasePoint),no.prototype.decodePoint=function(ao,so){return this.point(ro.toArray(ao,so),1)},no.prototype.point=function(ao,so){return new io(this,ao,so)},no.prototype.pointFromJSON=function(ao){return io.fromJSON(this,ao)},io.prototype.precompute=function(){},io.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},io.fromJSON=function(ao,so){return new io(ao,so[0],so[1]||ao.one)},io.prototype.inspect=function(){return this.isInfinity()?"":""},io.prototype.isInfinity=function(){return this.z.cmpn(0)===0},io.prototype.dbl=function(){var ao=this.x.redAdd(this.z),so=ao.redSqr(),co=this.x.redSub(this.z),lo=co.redSqr(),uo=so.redSub(lo),ho=so.redMul(lo),go=uo.redMul(lo.redAdd(this.curve.a24.redMul(uo)));return this.curve.point(ho,go)},io.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.diffAdd=function(ao,so){var co=this.x.redAdd(this.z),lo=this.x.redSub(this.z),uo=ao.x.redAdd(ao.z),ho=ao.x.redSub(ao.z),go=ho.redMul(co),bo=uo.redMul(lo),wo=so.z.redMul(go.redAdd(bo).redSqr()),Eo=so.x.redMul(go.redISub(bo).redSqr());return this.curve.point(wo,Eo)},io.prototype.mul=function(ao){for(var so=ao.clone(),co=this,lo=this.curve.point(null,null),uo=this,ho=[];so.cmpn(0)!==0;so.iushrn(1))ho.push(so.andln(1));for(var go=ho.length-1;go>=0;go--)ho[go]===0?(co=co.diffAdd(lo,uo),lo=lo.dbl()):(lo=co.diffAdd(lo,uo),co=co.dbl());return lo},io.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},io.prototype.eq=function(ao){return this.getX().cmp(ao.getX())===0},io.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},io.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont}var edwards,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1;var Xr=requireUtils$2(),eo=requireBn$3(),to=requireInherits_browser(),ro=requireBase$1(),no=Xr.assert;function io(ao){this.twisted=(ao.a|0)!==1,this.mOneA=this.twisted&&(ao.a|0)===-1,this.extended=this.mOneA,ro.call(this,"edwards",ao),this.a=new eo(ao.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new eo(ao.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new eo(ao.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),no(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(ao.c|0)===1}to(io,ro),edwards=io,io.prototype._mulA=function(so){return this.mOneA?so.redNeg():this.a.redMul(so)},io.prototype._mulC=function(so){return this.oneC?so:this.c.redMul(so)},io.prototype.jpoint=function(so,co,lo,uo){return this.point(so,co,lo,uo)},io.prototype.pointFromX=function(so,co){so=new eo(so,16),so.red||(so=so.toRed(this.red));var lo=so.redSqr(),uo=this.c2.redSub(this.a.redMul(lo)),ho=this.one.redSub(this.c2.redMul(this.d).redMul(lo)),go=uo.redMul(ho.redInvm()),bo=go.redSqrt();if(bo.redSqr().redSub(go).cmp(this.zero)!==0)throw new Error("invalid point");var wo=bo.fromRed().isOdd();return(co&&!wo||!co&&wo)&&(bo=bo.redNeg()),this.point(so,bo)},io.prototype.pointFromY=function(so,co){so=new eo(so,16),so.red||(so=so.toRed(this.red));var lo=so.redSqr(),uo=lo.redSub(this.c2),ho=lo.redMul(this.d).redMul(this.c2).redSub(this.a),go=uo.redMul(ho.redInvm());if(go.cmp(this.zero)===0){if(co)throw new Error("invalid point");return this.point(this.zero,so)}var bo=go.redSqrt();if(bo.redSqr().redSub(go).cmp(this.zero)!==0)throw new Error("invalid point");return bo.fromRed().isOdd()!==co&&(bo=bo.redNeg()),this.point(bo,so)},io.prototype.validate=function(so){if(so.isInfinity())return!0;so.normalize();var co=so.x.redSqr(),lo=so.y.redSqr(),uo=co.redMul(this.a).redAdd(lo),ho=this.c2.redMul(this.one.redAdd(this.d.redMul(co).redMul(lo)));return uo.cmp(ho)===0};function oo(ao,so,co,lo,uo){ro.BasePoint.call(this,ao,"projective"),so===null&&co===null&&lo===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new eo(so,16),this.y=new eo(co,16),this.z=lo?new eo(lo,16):this.curve.one,this.t=uo&&new eo(uo,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return to(oo,ro.BasePoint),io.prototype.pointFromJSON=function(so){return oo.fromJSON(this,so)},io.prototype.point=function(so,co,lo,uo){return new oo(this,so,co,lo,uo)},oo.fromJSON=function(so,co){return new oo(so,co[0],co[1],co[2])},oo.prototype.inspect=function(){return this.isInfinity()?"":""},oo.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},oo.prototype._extDbl=function(){var so=this.x.redSqr(),co=this.y.redSqr(),lo=this.z.redSqr();lo=lo.redIAdd(lo);var uo=this.curve._mulA(so),ho=this.x.redAdd(this.y).redSqr().redISub(so).redISub(co),go=uo.redAdd(co),bo=go.redSub(lo),wo=uo.redSub(co),Eo=ho.redMul(bo),$o=go.redMul(wo),Co=ho.redMul(wo),Ro=bo.redMul(go);return this.curve.point(Eo,$o,Ro,Co)},oo.prototype._projDbl=function(){var so=this.x.redAdd(this.y).redSqr(),co=this.x.redSqr(),lo=this.y.redSqr(),uo,ho,go,bo,wo,Eo;if(this.curve.twisted){bo=this.curve._mulA(co);var $o=bo.redAdd(lo);this.zOne?(uo=so.redSub(co).redSub(lo).redMul($o.redSub(this.curve.two)),ho=$o.redMul(bo.redSub(lo)),go=$o.redSqr().redSub($o).redSub($o)):(wo=this.z.redSqr(),Eo=$o.redSub(wo).redISub(wo),uo=so.redSub(co).redISub(lo).redMul(Eo),ho=$o.redMul(bo.redSub(lo)),go=$o.redMul(Eo))}else bo=co.redAdd(lo),wo=this.curve._mulC(this.z).redSqr(),Eo=bo.redSub(wo).redSub(wo),uo=this.curve._mulC(so.redISub(bo)).redMul(Eo),ho=this.curve._mulC(bo).redMul(co.redISub(lo)),go=bo.redMul(Eo);return this.curve.point(uo,ho,go)},oo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},oo.prototype._extAdd=function(so){var co=this.y.redSub(this.x).redMul(so.y.redSub(so.x)),lo=this.y.redAdd(this.x).redMul(so.y.redAdd(so.x)),uo=this.t.redMul(this.curve.dd).redMul(so.t),ho=this.z.redMul(so.z.redAdd(so.z)),go=lo.redSub(co),bo=ho.redSub(uo),wo=ho.redAdd(uo),Eo=lo.redAdd(co),$o=go.redMul(bo),Co=wo.redMul(Eo),Ro=go.redMul(Eo),Oo=bo.redMul(wo);return this.curve.point($o,Co,Oo,Ro)},oo.prototype._projAdd=function(so){var co=this.z.redMul(so.z),lo=co.redSqr(),uo=this.x.redMul(so.x),ho=this.y.redMul(so.y),go=this.curve.d.redMul(uo).redMul(ho),bo=lo.redSub(go),wo=lo.redAdd(go),Eo=this.x.redAdd(this.y).redMul(so.x.redAdd(so.y)).redISub(uo).redISub(ho),$o=co.redMul(bo).redMul(Eo),Co,Ro;return this.curve.twisted?(Co=co.redMul(wo).redMul(ho.redSub(this.curve._mulA(uo))),Ro=bo.redMul(wo)):(Co=co.redMul(wo).redMul(ho.redSub(uo)),Ro=this.curve._mulC(bo).redMul(wo)),this.curve.point($o,Co,Ro)},oo.prototype.add=function(so){return this.isInfinity()?so:so.isInfinity()?this:this.curve.extended?this._extAdd(so):this._projAdd(so)},oo.prototype.mul=function(so){return this._hasDoubles(so)?this.curve._fixedNafMul(this,so):this.curve._wnafMul(this,so)},oo.prototype.mulAdd=function(so,co,lo){return this.curve._wnafMulAdd(1,[this,co],[so,lo],2,!1)},oo.prototype.jmulAdd=function(so,co,lo){return this.curve._wnafMulAdd(1,[this,co],[so,lo],2,!0)},oo.prototype.normalize=function(){if(this.zOne)return this;var so=this.z.redInvm();return this.x=this.x.redMul(so),this.y=this.y.redMul(so),this.t&&(this.t=this.t.redMul(so)),this.z=this.curve.one,this.zOne=!0,this},oo.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},oo.prototype.getX=function(){return this.normalize(),this.x.fromRed()},oo.prototype.getY=function(){return this.normalize(),this.y.fromRed()},oo.prototype.eq=function(so){return this===so||this.getX().cmp(so.getX())===0&&this.getY().cmp(so.getY())===0},oo.prototype.eqXToP=function(so){var co=so.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(co)===0)return!0;for(var lo=so.clone(),uo=this.curve.redN.redMul(this.z);;){if(lo.iadd(this.curve.n),lo.cmp(this.curve.p)>=0)return!1;if(co.redIAdd(uo),this.x.cmp(co)===0)return!0}},oo.prototype.toP=oo.prototype.normalize,oo.prototype.mixedAdd=oo.prototype.add,edwards}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(Xr){var eo=Xr;eo.base=requireBase$1(),eo.short=requireShort(),eo.mont=requireMont(),eo.edwards=requireEdwards()}(curve$1)),curve$1}var curves={},hash$2={},utils$5={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$5;hasRequiredUtils$1=1;var Xr=requireMinimalisticAssert(),eo=requireInherits_browser();utils$5.inherits=eo;function to(fo,yo){return(fo.charCodeAt(yo)&64512)!==55296||yo<0||yo+1>=fo.length?!1:(fo.charCodeAt(yo+1)&64512)===56320}function ro(fo,yo){if(Array.isArray(fo))return fo.slice();if(!fo)return[];var vo=[];if(typeof fo=="string")if(yo){if(yo==="hex")for(fo=fo.replace(/[^a-z0-9]+/ig,""),fo.length%2!==0&&(fo="0"+fo),So=0;So>6|192,vo[_o++]=To&63|128):to(fo,So)?(To=65536+((To&1023)<<10)+(fo.charCodeAt(++So)&1023),vo[_o++]=To>>18|240,vo[_o++]=To>>12&63|128,vo[_o++]=To>>6&63|128,vo[_o++]=To&63|128):(vo[_o++]=To>>12|224,vo[_o++]=To>>6&63|128,vo[_o++]=To&63|128)}else for(So=0;So>>24|fo>>>8&65280|fo<<8&16711680|(fo&255)<<24;return yo>>>0}utils$5.htonl=io;function oo(fo,yo){for(var vo="",_o=0;_o>>0}return To}utils$5.join32=co;function lo(fo,yo){for(var vo=new Array(fo.length*4),_o=0,So=0;_o>>24,vo[So+1]=To>>>16&255,vo[So+2]=To>>>8&255,vo[So+3]=To&255):(vo[So+3]=To>>>24,vo[So+2]=To>>>16&255,vo[So+1]=To>>>8&255,vo[So]=To&255)}return vo}utils$5.split32=lo;function uo(fo,yo){return fo>>>yo|fo<<32-yo}utils$5.rotr32=uo;function ho(fo,yo){return fo<>>32-yo}utils$5.rotl32=ho;function go(fo,yo){return fo+yo>>>0}utils$5.sum32=go;function bo(fo,yo,vo){return fo+yo+vo>>>0}utils$5.sum32_3=bo;function wo(fo,yo,vo,_o){return fo+yo+vo+_o>>>0}utils$5.sum32_4=wo;function Eo(fo,yo,vo,_o,So){return fo+yo+vo+_o+So>>>0}utils$5.sum32_5=Eo;function $o(fo,yo,vo,_o){var So=fo[yo],To=fo[yo+1],Ao=_o+To>>>0,ko=(Ao<_o?1:0)+vo+So;fo[yo]=ko>>>0,fo[yo+1]=Ao}utils$5.sum64=$o;function Co(fo,yo,vo,_o){var So=yo+_o>>>0,To=(So>>0}utils$5.sum64_hi=Co;function Ro(fo,yo,vo,_o){var So=yo+_o;return So>>>0}utils$5.sum64_lo=Ro;function Oo(fo,yo,vo,_o,So,To,Ao,ko){var mo=0,Io=yo;Io=Io+_o>>>0,mo+=Io>>0,mo+=Io>>0,mo+=Io>>0}utils$5.sum64_4_hi=Oo;function jo(fo,yo,vo,_o,So,To,Ao,ko){var mo=yo+_o+To+ko;return mo>>>0}utils$5.sum64_4_lo=jo;function Bo(fo,yo,vo,_o,So,To,Ao,ko,mo,Io){var Do=0,Lo=yo;Lo=Lo+_o>>>0,Do+=Lo>>0,Do+=Lo>>0,Do+=Lo>>0,Do+=Lo>>0}utils$5.sum64_5_hi=Bo;function Mo(fo,yo,vo,_o,So,To,Ao,ko,mo,Io){var Do=yo+_o+To+ko+Io;return Do>>>0}utils$5.sum64_5_lo=Mo;function Fo(fo,yo,vo){var _o=yo<<32-vo|fo>>>vo;return _o>>>0}utils$5.rotr64_hi=Fo;function Wo(fo,yo,vo){var _o=fo<<32-vo|yo>>>vo;return _o>>>0}utils$5.rotr64_lo=Wo;function Jo(fo,yo,vo){return fo>>>vo}utils$5.shr64_hi=Jo;function Po(fo,yo,vo){var _o=fo<<32-vo|yo>>>vo;return _o>>>0}return utils$5.shr64_lo=Po,utils$5}var common$2={},hasRequiredCommon$1;function requireCommon$1(){if(hasRequiredCommon$1)return common$2;hasRequiredCommon$1=1;var Xr=requireUtils$1(),eo=requireMinimalisticAssert();function to(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return common$2.BlockHash=to,to.prototype.update=function(no,io){if(no=Xr.toArray(no,io),this.pending?this.pending=this.pending.concat(no):this.pending=no,this.pendingTotal+=no.length,this.pending.length>=this._delta8){no=this.pending;var oo=no.length%this._delta8;this.pending=no.slice(no.length-oo,no.length),this.pending.length===0&&(this.pending=null),no=Xr.join32(no,0,no.length-oo,this.endian);for(var ao=0;ao>>24&255,ao[so++]=no>>>16&255,ao[so++]=no>>>8&255,ao[so++]=no&255}else for(ao[so++]=no&255,ao[so++]=no>>>8&255,ao[so++]=no>>>16&255,ao[so++]=no>>>24&255,ao[so++]=0,ao[so++]=0,ao[so++]=0,ao[so++]=0,co=8;co>>3}common$1.g0_256=so;function co(lo){return eo(lo,17)^eo(lo,19)^lo>>>10}return common$1.g1_256=co,common$1}var _1$1,hasRequired_1;function require_1(){if(hasRequired_1)return _1$1;hasRequired_1=1;var Xr=requireUtils$1(),eo=requireCommon$1(),to=requireCommon(),ro=Xr.rotl32,no=Xr.sum32,io=Xr.sum32_5,oo=to.ft_1,ao=eo.BlockHash,so=[1518500249,1859775393,2400959708,3395469782];function co(){if(!(this instanceof co))return new co;ao.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return Xr.inherits(co,ao),_1$1=co,co.blockSize=512,co.outSize=160,co.hmacStrength=80,co.padLength=64,co.prototype._update=function(uo,ho){for(var go=this.W,bo=0;bo<16;bo++)go[bo]=uo[ho+bo];for(;bothis.blockSize&&(no=new this.Hash().update(no).digest()),eo(no.length<=this.blockSize);for(var io=no.length;io=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(io,oo,ao)}return hmacDrbg=ro,ro.prototype._init=function(io,oo,ao){var so=io.concat(oo).concat(ao);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var co=0;co=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(io.concat(ao||[])),this._reseed=1},ro.prototype.generate=function(io,oo,ao,so){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof oo!="string"&&(so=ao,ao=oo,oo=null),ao&&(ao=eo.toArray(ao,so||"hex"),this._update(ao));for(var co=[];co.length"},key$1}var signature$2,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$2;hasRequiredSignature$1=1;var Xr=requireBn$3(),eo=requireUtils$2(),to=eo.assert;function ro(so,co){if(so instanceof ro)return so;this._importDER(so,co)||(to(so.r&&so.s,"Signature without r or s"),this.r=new Xr(so.r,16),this.s=new Xr(so.s,16),so.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=so.recoveryParam)}signature$2=ro;function no(){this.place=0}function io(so,co){var lo=so[co.place++];if(!(lo&128))return lo;var uo=lo&15;if(uo===0||uo>4||so[co.place]===0)return!1;for(var ho=0,go=0,bo=co.place;go>>=0;return ho<=127?!1:(co.place=bo,ho)}function oo(so){for(var co=0,lo=so.length-1;!so[co]&&!(so[co+1]&128)&&co>>3);for(so.push(lo|128);--lo;)so.push(co>>>(lo<<3)&255);so.push(co)}return ro.prototype.toDER=function(co){var lo=this.r.toArray(),uo=this.s.toArray();for(lo[0]&128&&(lo=[0].concat(lo)),uo[0]&128&&(uo=[0].concat(uo)),lo=oo(lo),uo=oo(uo);!uo[0]&&!(uo[1]&128);)uo=uo.slice(1);var ho=[2];ao(ho,lo.length),ho=ho.concat(lo),ho.push(2),ao(ho,uo.length);var go=ho.concat(uo),bo=[48];return ao(bo,go.length),bo=bo.concat(go),eo.encode(bo,co)},signature$2}var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var Xr=requireBn$3(),eo=requireHmacDrbg(),to=requireUtils$2(),ro=requireCurves(),no=requireBrorand(),io=to.assert,oo=requireKey$1(),ao=requireSignature$1();function so(co){if(!(this instanceof so))return new so(co);typeof co=="string"&&(io(Object.prototype.hasOwnProperty.call(ro,co),"Unknown curve "+co),co=ro[co]),co instanceof ro.PresetCurve&&(co={curve:co}),this.curve=co.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=co.curve.g,this.g.precompute(co.curve.n.bitLength()+1),this.hash=co.hash||co.curve.hash}return ec=so,so.prototype.keyPair=function(lo){return new oo(this,lo)},so.prototype.keyFromPrivate=function(lo,uo){return oo.fromPrivate(this,lo,uo)},so.prototype.keyFromPublic=function(lo,uo){return oo.fromPublic(this,lo,uo)},so.prototype.genKeyPair=function(lo){lo||(lo={});for(var uo=new eo({hash:this.hash,pers:lo.pers,persEnc:lo.persEnc||"utf8",entropy:lo.entropy||no(this.hash.hmacStrength),entropyEnc:lo.entropy&&lo.entropyEnc||"utf8",nonce:this.n.toArray()}),ho=this.n.byteLength(),go=this.n.sub(new Xr(2));;){var bo=new Xr(uo.generate(ho));if(!(bo.cmp(go)>0))return bo.iaddn(1),this.keyFromPrivate(bo)}},so.prototype._truncateToN=function(lo,uo,ho){var go;if(Xr.isBN(lo)||typeof lo=="number")lo=new Xr(lo,16),go=lo.byteLength();else if(typeof lo=="object")go=lo.length,lo=new Xr(lo,16);else{var bo=lo.toString();go=bo.length+1>>>1,lo=new Xr(bo,16)}typeof ho!="number"&&(ho=go*8);var wo=ho-this.n.bitLength();return wo>0&&(lo=lo.ushrn(wo)),!uo&&lo.cmp(this.n)>=0?lo.sub(this.n):lo},so.prototype.sign=function(lo,uo,ho,go){typeof ho=="object"&&(go=ho,ho=null),go||(go={}),uo=this.keyFromPrivate(uo,ho),lo=this._truncateToN(lo,!1,go.msgBitLength);for(var bo=this.n.byteLength(),wo=uo.getPrivate().toArray("be",bo),Eo=lo.toArray("be",bo),$o=new eo({hash:this.hash,entropy:wo,nonce:Eo,pers:go.pers,persEnc:go.persEnc||"utf8"}),Co=this.n.sub(new Xr(1)),Ro=0;;Ro++){var Oo=go.k?go.k(Ro):new Xr($o.generate(this.n.byteLength()));if(Oo=this._truncateToN(Oo,!0),!(Oo.cmpn(1)<=0||Oo.cmp(Co)>=0)){var jo=this.g.mul(Oo);if(!jo.isInfinity()){var Bo=jo.getX(),Mo=Bo.umod(this.n);if(Mo.cmpn(0)!==0){var Fo=Oo.invm(this.n).mul(Mo.mul(uo.getPrivate()).iadd(lo));if(Fo=Fo.umod(this.n),Fo.cmpn(0)!==0){var Wo=(jo.getY().isOdd()?1:0)|(Bo.cmp(Mo)!==0?2:0);return go.canonical&&Fo.cmp(this.nh)>0&&(Fo=this.n.sub(Fo),Wo^=1),new ao({r:Mo,s:Fo,recoveryParam:Wo})}}}}}},so.prototype.verify=function(lo,uo,ho,go,bo){bo||(bo={}),lo=this._truncateToN(lo,!1,bo.msgBitLength),ho=this.keyFromPublic(ho,go),uo=new ao(uo,"hex");var wo=uo.r,Eo=uo.s;if(wo.cmpn(1)<0||wo.cmp(this.n)>=0||Eo.cmpn(1)<0||Eo.cmp(this.n)>=0)return!1;var $o=Eo.invm(this.n),Co=$o.mul(lo).umod(this.n),Ro=$o.mul(wo).umod(this.n),Oo;return this.curve._maxwellTrick?(Oo=this.g.jmulAdd(Co,ho.getPublic(),Ro),Oo.isInfinity()?!1:Oo.eqXToP(wo)):(Oo=this.g.mulAdd(Co,ho.getPublic(),Ro),Oo.isInfinity()?!1:Oo.getX().umod(this.n).cmp(wo)===0)},so.prototype.recoverPubKey=function(co,lo,uo,ho){io((3&uo)===uo,"The recovery param is more than two bits"),lo=new ao(lo,ho);var go=this.n,bo=new Xr(co),wo=lo.r,Eo=lo.s,$o=uo&1,Co=uo>>1;if(wo.cmp(this.curve.p.umod(this.curve.n))>=0&&Co)throw new Error("Unable to find sencond key candinate");Co?wo=this.curve.pointFromX(wo.add(this.curve.n),$o):wo=this.curve.pointFromX(wo,$o);var Ro=lo.r.invm(go),Oo=go.sub(bo).mul(Ro).umod(go),jo=Eo.mul(Ro).umod(go);return this.g.mulAdd(Oo,wo,jo)},so.prototype.getKeyRecoveryParam=function(co,lo,uo,ho){if(lo=new ao(lo,ho),lo.recoveryParam!==null)return lo.recoveryParam;for(var go=0;go<4;go++){var bo;try{bo=this.recoverPubKey(co,lo,go)}catch{continue}if(bo.eq(uo))return go}throw new Error("Unable to find valid recovery factor")},ec}var key,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key;hasRequiredKey=1;var Xr=requireUtils$2(),eo=Xr.assert,to=Xr.parseBytes,ro=Xr.cachedProperty;function no(io,oo){this.eddsa=io,this._secret=to(oo.secret),io.isPoint(oo.pub)?this._pub=oo.pub:this._pubBytes=to(oo.pub)}return no.fromPublic=function(oo,ao){return ao instanceof no?ao:new no(oo,{pub:ao})},no.fromSecret=function(oo,ao){return ao instanceof no?ao:new no(oo,{secret:ao})},no.prototype.secret=function(){return this._secret},ro(no,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),ro(no,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),ro(no,"privBytes",function(){var oo=this.eddsa,ao=this.hash(),so=oo.encodingLength-1,co=ao.slice(0,oo.encodingLength);return co[0]&=248,co[so]&=127,co[so]|=64,co}),ro(no,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),ro(no,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),ro(no,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),no.prototype.sign=function(oo){return eo(this._secret,"KeyPair can only verify"),this.eddsa.sign(oo,this)},no.prototype.verify=function(oo,ao){return this.eddsa.verify(oo,ao,this)},no.prototype.getSecret=function(oo){return eo(this._secret,"KeyPair is public only"),Xr.encode(this.secret(),oo)},no.prototype.getPublic=function(oo){return Xr.encode(this.pubBytes(),oo)},key=no,key}var signature$1,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$1;hasRequiredSignature=1;var Xr=requireBn$3(),eo=requireUtils$2(),to=eo.assert,ro=eo.cachedProperty,no=eo.parseBytes;function io(oo,ao){this.eddsa=oo,typeof ao!="object"&&(ao=no(ao)),Array.isArray(ao)&&(to(ao.length===oo.encodingLength*2,"Signature has invalid size"),ao={R:ao.slice(0,oo.encodingLength),S:ao.slice(oo.encodingLength)}),to(ao.R&&ao.S,"Signature without R or S"),oo.isPoint(ao.R)&&(this._R=ao.R),ao.S instanceof Xr&&(this._S=ao.S),this._Rencoded=Array.isArray(ao.R)?ao.R:ao.Rencoded,this._Sencoded=Array.isArray(ao.S)?ao.S:ao.Sencoded}return ro(io,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),ro(io,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),ro(io,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),ro(io,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),io.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},io.prototype.toHex=function(){return eo.encode(this.toBytes(),"hex").toUpperCase()},signature$1=io,signature$1}var eddsa,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa;hasRequiredEddsa=1;var Xr=requireHash(),eo=requireCurves(),to=requireUtils$2(),ro=to.assert,no=to.parseBytes,io=requireKey(),oo=requireSignature();function ao(so){if(ro(so==="ed25519","only tested with ed25519 so far"),!(this instanceof ao))return new ao(so);so=eo[so].curve,this.curve=so,this.g=so.g,this.g.precompute(so.n.bitLength()+1),this.pointClass=so.point().constructor,this.encodingLength=Math.ceil(so.n.bitLength()/8),this.hash=Xr.sha512}return eddsa=ao,ao.prototype.sign=function(co,lo){co=no(co);var uo=this.keyFromSecret(lo),ho=this.hashInt(uo.messagePrefix(),co),go=this.g.mul(ho),bo=this.encodePoint(go),wo=this.hashInt(bo,uo.pubBytes(),co).mul(uo.priv()),Eo=ho.add(wo).umod(this.curve.n);return this.makeSignature({R:go,S:Eo,Rencoded:bo})},ao.prototype.verify=function(co,lo,uo){if(co=no(co),lo=this.makeSignature(lo),lo.S().gte(lo.eddsa.curve.n)||lo.S().isNeg())return!1;var ho=this.keyFromPublic(uo),go=this.hashInt(lo.Rencoded(),ho.pubBytes(),co),bo=this.g.mul(lo.S()),wo=lo.R().add(ho.pub().mul(go));return wo.eq(bo)},ao.prototype.hashInt=function(){for(var co=this.hash(),lo=0;lo0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$3)),bn$3.exports}var api$1={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(Xr,eo){if(Xr.indexOf)return Xr.indexOf(eo);for(var to=0;to>6],go=(fo&32)===0;if((fo&31)===31){var yo=fo;for(fo=0;(yo&128)===128;){if(yo=co.readUInt8(lo),co.isError(yo))return yo;fo<<=7,fo|=yo&127}}else fo&=31;var vo=no.tag[fo];return{cls:ho,primitive:go,tag:fo,tagStr:vo}}function so(co,lo,fo){var ho=co.readUInt8(fo);if(co.isError(ho))return ho;if(!lo&&ho===128)return null;if(!(ho&128))return ho;var go=ho&127;if(go>4)return co.error("length octect is too long");ho=0;for(var yo=0;yo=256;wo>>=8)vo++;var Eo=new eo(2+vo);Eo[0]=yo,Eo[1]=128|vo;for(var wo=1+vo,ko=go.length;ko>0;wo--,ko>>=8)Eo[wo]=ko&255;return this._createEncoderBuffer([Eo,go])},oo.prototype._encodeStr=function(lo,fo){if(fo==="bitstr")return this._createEncoderBuffer([lo.unused|0,lo.data]);if(fo==="bmpstr"){for(var ho=new eo(lo.length*2),go=0;go=40)return this.reporter.error("Second objid identifier OOB");lo.splice(0,2,lo[0]*40+lo[1])}for(var yo=0,go=0;go=128;vo>>=7)yo++}for(var wo=new eo(yo),Eo=wo.length-1,go=lo.length-1;go>=0;go--){var vo=lo[go];for(wo[Eo--]=vo&127;(vo>>=7)>0;)wo[Eo--]=128|vo&127}return this._createEncoderBuffer(wo)};function ao(co){return co<10?"0"+co:co}oo.prototype._encodeTime=function(lo,fo){var ho,go=new Date(lo);return fo==="gentime"?ho=[ao(go.getFullYear()),ao(go.getUTCMonth()+1),ao(go.getUTCDate()),ao(go.getUTCHours()),ao(go.getUTCMinutes()),ao(go.getUTCSeconds()),"Z"].join(""):fo==="utctime"?ho=[ao(go.getFullYear()%100),ao(go.getUTCMonth()+1),ao(go.getUTCDate()),ao(go.getUTCHours()),ao(go.getUTCMinutes()),ao(go.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+fo+" time is not supported yet"),this._encodeStr(ho,"octstr")},oo.prototype._encodeNull=function(){return this._createEncoderBuffer("")},oo.prototype._encodeInt=function(lo,fo){if(typeof lo=="string"){if(!fo)return this.reporter.error("String int or enum given, but no values map");if(!fo.hasOwnProperty(lo))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(lo));lo=fo[lo]}if(typeof lo!="number"&&!eo.isBuffer(lo)){var ho=lo.toArray();!lo.sign&&ho[0]&128&&ho.unshift(0),lo=new eo(ho)}if(eo.isBuffer(lo)){var go=lo.length;lo.length===0&&go++;var vo=new eo(go);return lo.copy(vo),lo.length===0&&(vo[0]=0),this._createEncoderBuffer(vo)}if(lo<128)return this._createEncoderBuffer(lo);if(lo<256)return this._createEncoderBuffer([0,lo]);for(var go=1,yo=lo;yo>=256;yo>>=8)go++;for(var vo=new Array(go),yo=vo.length-1;yo>=0;yo--)vo[yo]=lo&255,lo>>=8;return vo[0]&128&&vo.unshift(0),this._createEncoderBuffer(new eo(vo))},oo.prototype._encodeBool=function(lo){return this._createEncoderBuffer(lo?255:0)},oo.prototype._use=function(lo,fo){return typeof lo=="function"&&(lo=lo(fo)),lo._getEncoder("der").tree},oo.prototype._skipDefault=function(lo,fo,ho){var go=this._baseState,yo;if(go.default===null)return!1;var vo=lo.join();if(go.defaultBuffer===void 0&&(go.defaultBuffer=this._encodeValue(go.default,fo,ho).join()),vo.length!==go.defaultBuffer.length)return!1;for(yo=0;yo=31?ho.error("Multi-octet tag encoding unsupported"):(lo||(go|=32),go|=no.tagClassByName[fo||"universal"]<<6,go)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var Xr=requireInherits_browser(),eo=requireDer();function to(ro){eo.call(this,ro),this.enc="pem"}return Xr(to,eo),pem=to,to.prototype.encode=function(no,io){for(var oo=eo.prototype.encode.call(this,no),ao=oo.toString("base64"),so=["-----BEGIN "+io.label+"-----"],co=0;co0&&Ao.ishrn(Po),Ao}function yo(Eo,ko){Eo=go(Eo,ko),Eo=Eo.mod(ko);var Ao=Xr.from(Eo.toArray());if(Ao.length=0)throw new Error("invalid sig")}return verify_1=io,verify_1}var browser$8,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$8;hasRequiredBrowser$3=1;var Xr=safeBufferExports.Buffer,eo=requireBrowser$9(),to=requireReadableBrowser(),ro=requireInherits_browser(),no=requireSign(),io=requireVerify(),oo=require$$6;Object.keys(oo).forEach(function(fo){oo[fo].id=Xr.from(oo[fo].id,"hex"),oo[fo.toLowerCase()]=oo[fo]});function ao(fo){to.Writable.call(this);var ho=oo[fo];if(!ho)throw new Error("Unknown message digest");this._hashType=ho.hash,this._hash=eo(ho.hash),this._tag=ho.id,this._signType=ho.sign}ro(ao,to.Writable),ao.prototype._write=function(ho,go,yo){this._hash.update(ho),yo()},ao.prototype.update=function(ho,go){return this._hash.update(typeof ho=="string"?Xr.from(ho,go):ho),this},ao.prototype.sign=function(ho,go){this.end();var yo=this._hash.digest(),vo=no(yo,ho,this._hashType,this._signType,this._tag);return go?vo.toString(go):vo};function so(fo){to.Writable.call(this);var ho=oo[fo];if(!ho)throw new Error("Unknown message digest");this._hash=eo(ho.hash),this._tag=ho.id,this._signType=ho.sign}ro(so,to.Writable),so.prototype._write=function(ho,go,yo){this._hash.update(ho),yo()},so.prototype.update=function(ho,go){return this._hash.update(typeof ho=="string"?Xr.from(ho,go):ho),this},so.prototype.verify=function(ho,go,yo){var vo=typeof go=="string"?Xr.from(go,yo):go;this.end();var wo=this._hash.digest();return io(vo,wo,ho,this._signType,this._tag)};function co(fo){return new ao(fo)}function lo(fo){return new so(fo)}return browser$8={Sign:co,Verify:lo,createSign:co,createVerify:lo},browser$8}var browser$7,hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$7;hasRequiredBrowser$2=1;var Xr=requireElliptic(),eo=requireBn$2();browser$7=function(oo){return new ro(oo)};var to={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};to.p224=to.secp224r1,to.p256=to.secp256r1=to.prime256v1,to.p192=to.secp192r1=to.prime192v1,to.p384=to.secp384r1,to.p521=to.secp521r1;function ro(io){this.curveType=to[io],this.curveType||(this.curveType={name:io}),this.curve=new Xr.ec(this.curveType.name),this.keys=void 0}ro.prototype.generateKeys=function(io,oo){return this.keys=this.curve.genKeyPair(),this.getPublicKey(io,oo)},ro.prototype.computeSecret=function(io,oo,ao){oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo));var so=this.curve.keyFromPublic(io).getPublic(),co=so.mul(this.keys.getPrivate()).getX();return no(co,ao,this.curveType.byteLength)},ro.prototype.getPublicKey=function(io,oo){var ao=this.keys.getPublic(oo==="compressed",!0);return oo==="hybrid"&&(ao[ao.length-1]%2?ao[0]=7:ao[0]=6),no(ao,io)},ro.prototype.getPrivateKey=function(io){return no(this.keys.getPrivate(),io)},ro.prototype.setPublicKey=function(io,oo){return oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo)),this.keys._importPublic(io),this},ro.prototype.setPrivateKey=function(io,oo){oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo));var ao=new eo(io);return ao=ao.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(ao),this};function no(io,oo,ao){Array.isArray(io)||(io=io.toArray());var so=new Buffer$3(io);if(ao&&so.length=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return vo?ao(ko,Eo):oo(ko,Eo)};function co(ho,go){var yo=ho.modulus.byteLength(),vo=go.length,wo=to("sha1").update(so.alloc(0)).digest(),Eo=wo.length,ko=2*Eo;if(vo>yo-ko-2)throw new Error("message too long");var Ao=so.alloc(yo-vo-ko-2),Po=yo-Eo-1,jo=eo(Eo),Mo=no(so.concat([wo,Ao,so.alloc(1,1),go],Po),ro(jo,Po)),No=no(jo,ro(Mo,Eo));return new io(so.concat([so.alloc(1),No,Mo],yo))}function lo(ho,go,yo){var vo=go.length,wo=ho.modulus.byteLength();if(vo>wo-11)throw new Error("message too long");var Eo;return yo?Eo=so.alloc(wo-vo-3,255):Eo=fo(wo-vo-3),new io(so.concat([so.from([0,yo?1:2]),Eo,so.alloc(1),go],wo))}function fo(ho){for(var go=so.allocUnsafe(ho),yo=0,vo=eo(ho*2),wo=0,Eo;yoEo||new ro(go).cmp(wo.modulus)>=0)throw new Error("decryption error");var ko;yo?ko=oo(new ro(go),wo):ko=no(go,wo);var Ao=ao.alloc(Eo-ko.length);if(ko=ao.concat([Ao,ko],Eo),vo===4)return so(wo,ko);if(vo===1)return co(wo,ko,yo);if(vo===3)return ko;throw new Error("unknown padding")};function so(fo,ho){var go=fo.modulus.byteLength(),yo=io("sha1").update(ao.alloc(0)).digest(),vo=yo.length;if(ho[0]!==0)throw new Error("decryption error");var wo=ho.slice(1,vo+1),Eo=ho.slice(vo+1),ko=to(wo,eo(Eo,vo)),Ao=to(Eo,eo(ko,go-vo-1));if(lo(yo,Ao.slice(0,vo)))throw new Error("decryption error");for(var Po=vo;Ao[Po]===0;)Po++;if(Ao[Po++]!==1)throw new Error("decryption error");return Ao.slice(Po)}function co(fo,ho,go){for(var yo=ho.slice(0,2),vo=2,wo=0;ho[vo++]!==0;)if(vo>=ho.length){wo++;break}var Eo=ho.slice(2,vo-1);if((yo.toString("hex")!=="0002"&&!go||yo.toString("hex")!=="0001"&&go)&&wo++,Eo.length<8&&wo++,wo)throw new Error("decryption error");return ho.slice(vo)}function lo(fo,ho){fo=ao.from(fo),ho=ao.from(ho);var go=0,yo=fo.length;fo.length!==ho.length&&(go++,yo=Math.min(fo.length,ho.length));for(var vo=-1;++vooo||ho<0)throw new TypeError("offset must be a uint32");if(ho>no||ho>go)throw new RangeError("offset out of range")}function so(ho,go,yo){if(typeof ho!="number"||ho!==ho)throw new TypeError("size must be a number");if(ho>oo||ho<0)throw new TypeError("size must be a uint32");if(ho+go>yo||ho>no)throw new RangeError("buffer too small")}io&&io.getRandomValues||!process$1$1.browser?(browser$5.randomFill=co,browser$5.randomFillSync=fo):(browser$5.randomFill=Xr,browser$5.randomFillSync=Xr);function co(ho,go,yo,vo){if(!ro.isBuffer(ho)&&!(ho instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof go=="function")vo=go,go=0,yo=ho.length;else if(typeof yo=="function")vo=yo,yo=ho.length-go;else if(typeof vo!="function")throw new TypeError('"cb" argument must be a function');return ao(go,ho.length),so(yo,go,ho.length),lo(ho,go,yo,vo)}function lo(ho,go,yo,vo){if(process$1$1.browser){var wo=ho.buffer,Eo=new Uint8Array(wo,go,yo);if(io.getRandomValues(Eo),vo){process$1$1.nextTick(function(){vo(null,ho)});return}return ho}if(vo){to(yo,function(Ao,Po){if(Ao)return vo(Ao);Po.copy(ho,go),vo(null,ho)});return}var ko=to(yo);return ko.copy(ho,go),ho}function fo(ho,go,yo){if(typeof go>"u"&&(go=0),!ro.isBuffer(ho)&&!(ho instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return ao(go,ho.length),yo===void 0&&(yo=ho.length-go),so(yo,go,ho.length),lo(ho,go,yo)}return browser$5}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$b(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var Xr=requireAlgos(),eo=Object.keys(Xr),to=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(eo);cryptoBrowserify.getHashes=function(){return to};var ro=requireBrowser$7();cryptoBrowserify.pbkdf2=ro.pbkdf2,cryptoBrowserify.pbkdf2Sync=ro.pbkdf2Sync;var no=requireBrowser$5();cryptoBrowserify.Cipher=no.Cipher,cryptoBrowserify.createCipher=no.createCipher,cryptoBrowserify.Cipheriv=no.Cipheriv,cryptoBrowserify.createCipheriv=no.createCipheriv,cryptoBrowserify.Decipher=no.Decipher,cryptoBrowserify.createDecipher=no.createDecipher,cryptoBrowserify.Decipheriv=no.Decipheriv,cryptoBrowserify.createDecipheriv=no.createDecipheriv,cryptoBrowserify.getCiphers=no.getCiphers,cryptoBrowserify.listCiphers=no.listCiphers;var io=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=io.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=io.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=io.getDiffieHellman,cryptoBrowserify.createDiffieHellman=io.createDiffieHellman,cryptoBrowserify.DiffieHellman=io.DiffieHellman;var oo=requireBrowser$3();cryptoBrowserify.createSign=oo.createSign,cryptoBrowserify.Sign=oo.Sign,cryptoBrowserify.createVerify=oo.createVerify,cryptoBrowserify.Verify=oo.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var ao=requireBrowser$1();cryptoBrowserify.publicEncrypt=ao.publicEncrypt,cryptoBrowserify.privateEncrypt=ao.privateEncrypt,cryptoBrowserify.publicDecrypt=ao.publicDecrypt,cryptoBrowserify.privateDecrypt=ao.privateDecrypt;var so=requireBrowser();return cryptoBrowserify.randomFill=so.randomFill,cryptoBrowserify.randomFillSync=so.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet +})`)}catch{ao=function(co){this._initNamed(co)}}return to(ao,oo),ao.prototype._initNamed=function(co){oo.call(this,co)},new ao(this)},no.prototype._getDecoder=function(oo){return oo=oo||"der",this.decoders.hasOwnProperty(oo)||(this.decoders[oo]=this._createNamed(eo.decoders[oo])),this.decoders[oo]},no.prototype.decode=function(oo,ao,so){return this._getDecoder(ao).decode(oo,so)},no.prototype._getEncoder=function(oo){return oo=oo||"der",this.encoders.hasOwnProperty(oo)||(this.encoders[oo]=this._createNamed(eo.encoders[oo])),this.encoders[oo]},no.prototype.encode=function(oo,ao,so){return this._getEncoder(ao).encode(oo,so)}}(api$1)),api$1}var base$4={},reporter={},hasRequiredReporter;function requireReporter(){if(hasRequiredReporter)return reporter;hasRequiredReporter=1;var Xr=requireInherits_browser();function eo(ro){this._reporterState={obj:null,path:[],options:ro||{},errors:[]}}reporter.Reporter=eo,eo.prototype.isError=function(no){return no instanceof to},eo.prototype.save=function(){var no=this._reporterState;return{obj:no.obj,pathLen:no.path.length}},eo.prototype.restore=function(no){var io=this._reporterState;io.obj=no.obj,io.path=io.path.slice(0,no.pathLen)},eo.prototype.enterKey=function(no){return this._reporterState.path.push(no)},eo.prototype.exitKey=function(no){var io=this._reporterState;io.path=io.path.slice(0,no-1)},eo.prototype.leaveKey=function(no,io,oo){var ao=this._reporterState;this.exitKey(no),ao.obj!==null&&(ao.obj[io]=oo)},eo.prototype.path=function(){return this._reporterState.path.join("/")},eo.prototype.enterObject=function(){var no=this._reporterState,io=no.obj;return no.obj={},io},eo.prototype.leaveObject=function(no){var io=this._reporterState,oo=io.obj;return io.obj=no,oo},eo.prototype.error=function(no){var io,oo=this._reporterState,ao=no instanceof to;if(ao?io=no:io=new to(oo.path.map(function(so){return"["+JSON.stringify(so)+"]"}).join(""),no.message||no,no.stack),!oo.options.partial)throw io;return ao||oo.errors.push(io),io},eo.prototype.wrapResult=function(no){var io=this._reporterState;return io.options.partial?{result:this.isError(no)?null:no,errors:io.errors}:no};function to(ro,no){this.path=ro,this.rethrow(no)}return Xr(to,Error),to.prototype.rethrow=function(no){if(this.message=no+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,to),!this.stack)try{throw new Error(this.message)}catch(io){this.stack=io.stack}return this},reporter}var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var Xr=requireInherits_browser(),eo=requireBase().Reporter,to=require$$0$9.Buffer;function ro(io,oo){if(eo.call(this,oo),!to.isBuffer(io)){this.error("Input not Buffer");return}this.base=io,this.offset=0,this.length=io.length}Xr(ro,eo),buffer.DecoderBuffer=ro,ro.prototype.save=function(){return{offset:this.offset,reporter:eo.prototype.save.call(this)}},ro.prototype.restore=function(oo){var ao=new ro(this.base);return ao.offset=oo.offset,ao.length=this.offset,this.offset=oo.offset,eo.prototype.restore.call(this,oo.reporter),ao},ro.prototype.isEmpty=function(){return this.offset===this.length},ro.prototype.readUInt8=function(oo){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(oo||"DecoderBuffer overrun")},ro.prototype.skip=function(oo,ao){if(!(this.offset+oo<=this.length))return this.error(ao||"DecoderBuffer overrun");var so=new ro(this.base);return so._reporterState=this._reporterState,so.offset=this.offset,so.length=this.offset+oo,this.offset+=oo,so},ro.prototype.raw=function(oo){return this.base.slice(oo?oo.offset:this.offset,this.length)};function no(io,oo){if(Array.isArray(io))this.length=0,this.value=io.map(function(ao){return ao instanceof no||(ao=new no(ao,oo)),this.length+=ao.length,ao},this);else if(typeof io=="number"){if(!(0<=io&&io<=255))return oo.error("non-byte EncoderBuffer value");this.value=io,this.length=1}else if(typeof io=="string")this.value=io,this.length=to.byteLength(io);else if(to.isBuffer(io))this.value=io,this.length=io.length;else return oo.error("Unsupported type: "+typeof io)}return buffer.EncoderBuffer=no,no.prototype.join=function(oo,ao){return oo||(oo=new to(this.length)),ao||(ao=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(so){so.join(oo,ao),ao+=so.length}):(typeof this.value=="number"?oo[ao]=this.value:typeof this.value=="string"?oo.write(this.value,ao):to.isBuffer(this.value)&&this.value.copy(oo,ao),ao+=this.length)),oo},buffer}var node$1,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node$1;hasRequiredNode=1;var Xr=requireBase().Reporter,eo=requireBase().EncoderBuffer,to=requireBase().DecoderBuffer,ro=requireMinimalisticAssert(),no=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],io=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(no),oo=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function ao(co,lo){var uo={};this._baseState=uo,uo.enc=co,uo.parent=lo||null,uo.children=null,uo.tag=null,uo.args=null,uo.reverseArgs=null,uo.choice=null,uo.optional=!1,uo.any=!1,uo.obj=!1,uo.use=null,uo.useDecoder=null,uo.key=null,uo.default=null,uo.explicit=null,uo.implicit=null,uo.contains=null,uo.parent||(uo.children=[],this._wrap())}node$1=ao;var so=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return ao.prototype.clone=function(){var lo=this._baseState,uo={};so.forEach(function(go){uo[go]=lo[go]});var ho=new this.constructor(uo.parent);return ho._baseState=uo,ho},ao.prototype._wrap=function(){var lo=this._baseState;io.forEach(function(uo){this[uo]=function(){var go=new this.constructor(this);return lo.children.push(go),go[uo].apply(go,arguments)}},this)},ao.prototype._init=function(lo){var uo=this._baseState;ro(uo.parent===null),lo.call(this),uo.children=uo.children.filter(function(ho){return ho._baseState.parent===this},this),ro.equal(uo.children.length,1,"Root node can have only one child")},ao.prototype._useArgs=function(lo){var uo=this._baseState,ho=lo.filter(function(go){return go instanceof this.constructor},this);lo=lo.filter(function(go){return!(go instanceof this.constructor)},this),ho.length!==0&&(ro(uo.children===null),uo.children=ho,ho.forEach(function(go){go._baseState.parent=this},this)),lo.length!==0&&(ro(uo.args===null),uo.args=lo,uo.reverseArgs=lo.map(function(go){if(typeof go!="object"||go.constructor!==Object)return go;var bo={};return Object.keys(go).forEach(function(wo){wo==(wo|0)&&(wo|=0);var Eo=go[wo];bo[Eo]=wo}),bo}))},oo.forEach(function(co){ao.prototype[co]=function(){var uo=this._baseState;throw new Error(co+" not implemented for encoding: "+uo.enc)}}),no.forEach(function(co){ao.prototype[co]=function(){var uo=this._baseState,ho=Array.prototype.slice.call(arguments);return ro(uo.tag===null),uo.tag=co,this._useArgs(ho),this}}),ao.prototype.use=function(lo){ro(lo);var uo=this._baseState;return ro(uo.use===null),uo.use=lo,this},ao.prototype.optional=function(){var lo=this._baseState;return lo.optional=!0,this},ao.prototype.def=function(lo){var uo=this._baseState;return ro(uo.default===null),uo.default=lo,uo.optional=!0,this},ao.prototype.explicit=function(lo){var uo=this._baseState;return ro(uo.explicit===null&&uo.implicit===null),uo.explicit=lo,this},ao.prototype.implicit=function(lo){var uo=this._baseState;return ro(uo.explicit===null&&uo.implicit===null),uo.implicit=lo,this},ao.prototype.obj=function(){var lo=this._baseState,uo=Array.prototype.slice.call(arguments);return lo.obj=!0,uo.length!==0&&this._useArgs(uo),this},ao.prototype.key=function(lo){var uo=this._baseState;return ro(uo.key===null),uo.key=lo,this},ao.prototype.any=function(){var lo=this._baseState;return lo.any=!0,this},ao.prototype.choice=function(lo){var uo=this._baseState;return ro(uo.choice===null),uo.choice=lo,this._useArgs(Object.keys(lo).map(function(ho){return lo[ho]})),this},ao.prototype.contains=function(lo){var uo=this._baseState;return ro(uo.use===null),uo.contains=lo,this},ao.prototype._decode=function(lo,uo){var ho=this._baseState;if(ho.parent===null)return lo.wrapResult(ho.children[0]._decode(lo,uo));var go=ho.default,bo=!0,wo=null;if(ho.key!==null&&(wo=lo.enterKey(ho.key)),ho.optional){var Eo=null;if(ho.explicit!==null?Eo=ho.explicit:ho.implicit!==null?Eo=ho.implicit:ho.tag!==null&&(Eo=ho.tag),Eo===null&&!ho.any){var $o=lo.save();try{ho.choice===null?this._decodeGeneric(ho.tag,lo,uo):this._decodeChoice(lo,uo),bo=!0}catch{bo=!1}lo.restore($o)}else if(bo=this._peekTag(lo,Eo,ho.any),lo.isError(bo))return bo}var Co;if(ho.obj&&bo&&(Co=lo.enterObject()),bo){if(ho.explicit!==null){var Ro=this._decodeTag(lo,ho.explicit);if(lo.isError(Ro))return Ro;lo=Ro}var Oo=lo.offset;if(ho.use===null&&ho.choice===null){if(ho.any)var $o=lo.save();var jo=this._decodeTag(lo,ho.implicit!==null?ho.implicit:ho.tag,ho.any);if(lo.isError(jo))return jo;ho.any?go=lo.raw($o):lo=jo}if(uo&&uo.track&&ho.tag!==null&&uo.track(lo.path(),Oo,lo.length,"tagged"),uo&&uo.track&&ho.tag!==null&&uo.track(lo.path(),lo.offset,lo.length,"content"),ho.any?go=go:ho.choice===null?go=this._decodeGeneric(ho.tag,lo,uo):go=this._decodeChoice(lo,uo),lo.isError(go))return go;if(!ho.any&&ho.choice===null&&ho.children!==null&&ho.children.forEach(function(Fo){Fo._decode(lo,uo)}),ho.contains&&(ho.tag==="octstr"||ho.tag==="bitstr")){var Bo=new to(go);go=this._getUse(ho.contains,lo._reporterState.obj)._decode(Bo,uo)}}return ho.obj&&bo&&(go=lo.leaveObject(Co)),ho.key!==null&&(go!==null||bo===!0)?lo.leaveKey(wo,ho.key,go):wo!==null&&lo.exitKey(wo),go},ao.prototype._decodeGeneric=function(lo,uo,ho){var go=this._baseState;return lo==="seq"||lo==="set"?null:lo==="seqof"||lo==="setof"?this._decodeList(uo,lo,go.args[0],ho):/str$/.test(lo)?this._decodeStr(uo,lo,ho):lo==="objid"&&go.args?this._decodeObjid(uo,go.args[0],go.args[1],ho):lo==="objid"?this._decodeObjid(uo,null,null,ho):lo==="gentime"||lo==="utctime"?this._decodeTime(uo,lo,ho):lo==="null_"?this._decodeNull(uo,ho):lo==="bool"?this._decodeBool(uo,ho):lo==="objDesc"?this._decodeStr(uo,lo,ho):lo==="int"||lo==="enum"?this._decodeInt(uo,go.args&&go.args[0],ho):go.use!==null?this._getUse(go.use,uo._reporterState.obj)._decode(uo,ho):uo.error("unknown tag: "+lo)},ao.prototype._getUse=function(lo,uo){var ho=this._baseState;return ho.useDecoder=this._use(lo,uo),ro(ho.useDecoder._baseState.parent===null),ho.useDecoder=ho.useDecoder._baseState.children[0],ho.implicit!==ho.useDecoder._baseState.implicit&&(ho.useDecoder=ho.useDecoder.clone(),ho.useDecoder._baseState.implicit=ho.implicit),ho.useDecoder},ao.prototype._decodeChoice=function(lo,uo){var ho=this._baseState,go=null,bo=!1;return Object.keys(ho.choice).some(function(wo){var Eo=lo.save(),$o=ho.choice[wo];try{var Co=$o._decode(lo,uo);if(lo.isError(Co))return!1;go={type:wo,value:Co},bo=!0}catch{return lo.restore(Eo),!1}return!0},this),bo?go:lo.error("Choice not matched")},ao.prototype._createEncoderBuffer=function(lo){return new eo(lo,this.reporter)},ao.prototype._encode=function(lo,uo,ho){var go=this._baseState;if(!(go.default!==null&&go.default===lo)){var bo=this._encodeValue(lo,uo,ho);if(bo!==void 0&&!this._skipDefault(bo,uo,ho))return bo}},ao.prototype._encodeValue=function(lo,uo,ho){var go=this._baseState;if(go.parent===null)return go.children[0]._encode(lo,uo||new Xr);var $o=null;if(this.reporter=uo,go.optional&&lo===void 0)if(go.default!==null)lo=go.default;else return;var bo=null,wo=!1;if(go.any)$o=this._createEncoderBuffer(lo);else if(go.choice)$o=this._encodeChoice(lo,uo);else if(go.contains)bo=this._getUse(go.contains,ho)._encode(lo,uo),wo=!0;else if(go.children)bo=go.children.map(function(Oo){if(Oo._baseState.tag==="null_")return Oo._encode(null,uo,lo);if(Oo._baseState.key===null)return uo.error("Child should have a key");var jo=uo.enterKey(Oo._baseState.key);if(typeof lo!="object")return uo.error("Child expected, but input is not object");var Bo=Oo._encode(lo[Oo._baseState.key],uo,lo);return uo.leaveKey(jo),Bo},this).filter(function(Oo){return Oo}),bo=this._createEncoderBuffer(bo);else if(go.tag==="seqof"||go.tag==="setof"){if(!(go.args&&go.args.length===1))return uo.error("Too many args for : "+go.tag);if(!Array.isArray(lo))return uo.error("seqof/setof, but data is not Array");var Eo=this.clone();Eo._baseState.implicit=null,bo=this._createEncoderBuffer(lo.map(function(Oo){var jo=this._baseState;return this._getUse(jo.args[0],lo)._encode(Oo,uo)},Eo))}else go.use!==null?$o=this._getUse(go.use,ho)._encode(lo,uo):(bo=this._encodePrimitive(go.tag,lo),wo=!0);var $o;if(!go.any&&go.choice===null){var Co=go.implicit!==null?go.implicit:go.tag,Ro=go.implicit===null?"universal":"context";Co===null?go.use===null&&uo.error("Tag could be omitted only for .use()"):go.use===null&&($o=this._encodeComposite(Co,wo,Ro,bo))}return go.explicit!==null&&($o=this._encodeComposite(go.explicit,!1,"context",$o)),$o},ao.prototype._encodeChoice=function(lo,uo){var ho=this._baseState,go=ho.choice[lo.type];return go||ro(!1,lo.type+" not found in "+JSON.stringify(Object.keys(ho.choice))),go._encode(lo.value,uo)},ao.prototype._encodePrimitive=function(lo,uo){var ho=this._baseState;if(/str$/.test(lo))return this._encodeStr(uo,lo);if(lo==="objid"&&ho.args)return this._encodeObjid(uo,ho.reverseArgs[0],ho.args[1]);if(lo==="objid")return this._encodeObjid(uo,null,null);if(lo==="gentime"||lo==="utctime")return this._encodeTime(uo,lo);if(lo==="null_")return this._encodeNull();if(lo==="int"||lo==="enum")return this._encodeInt(uo,ho.args&&ho.reverseArgs[0]);if(lo==="bool")return this._encodeBool(uo);if(lo==="objDesc")return this._encodeStr(uo,lo);throw new Error("Unsupported tag: "+lo)},ao.prototype._isNumstr=function(lo){return/^[0-9 ]*$/.test(lo)},ao.prototype._isPrintstr=function(lo){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(lo)},node$1}var hasRequiredBase;function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(Xr){var eo=Xr;eo.Reporter=requireReporter().Reporter,eo.DecoderBuffer=requireBuffer().DecoderBuffer,eo.EncoderBuffer=requireBuffer().EncoderBuffer,eo.Node=requireNode()}(base$4)),base$4}var constants$8={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(Xr){var eo=requireConstants$2();Xr.tagClass={0:"universal",1:"application",2:"context",3:"private"},Xr.tagClassByName=eo._reverse(Xr.tagClass),Xr.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},Xr.tagByName=eo._reverse(Xr.tag)}(der)),der}var hasRequiredConstants$2;function requireConstants$2(){return hasRequiredConstants$2||(hasRequiredConstants$2=1,function(Xr){var eo=Xr;eo._reverse=function(ro){var no={};return Object.keys(ro).forEach(function(io){(io|0)==io&&(io=io|0);var oo=ro[io];no[oo]=io}),no},eo.der=requireDer$2()}(constants$8)),constants$8}var decoders={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var Xr=requireInherits_browser(),eo=requireAsn1$1(),to=eo.base,ro=eo.bignum,no=eo.constants.der;function io(co){this.enc="der",this.name=co.name,this.entity=co,this.tree=new oo,this.tree._init(co.body)}der_1$1=io,io.prototype.decode=function(lo,uo){return lo instanceof to.DecoderBuffer||(lo=new to.DecoderBuffer(lo,uo)),this.tree._decode(lo,uo)};function oo(co){to.Node.call(this,"der",co)}Xr(oo,to.Node),oo.prototype._peekTag=function(lo,uo,ho){if(lo.isEmpty())return!1;var go=lo.save(),bo=ao(lo,'Failed to peek tag: "'+uo+'"');return lo.isError(bo)?bo:(lo.restore(go),bo.tag===uo||bo.tagStr===uo||bo.tagStr+"of"===uo||ho)},oo.prototype._decodeTag=function(lo,uo,ho){var go=ao(lo,'Failed to decode tag of "'+uo+'"');if(lo.isError(go))return go;var bo=so(lo,go.primitive,'Failed to get length of "'+uo+'"');if(lo.isError(bo))return bo;if(!ho&&go.tag!==uo&&go.tagStr!==uo&&go.tagStr+"of"!==uo)return lo.error('Failed to match tag: "'+uo+'"');if(go.primitive||bo!==null)return lo.skip(bo,'Failed to match body of: "'+uo+'"');var wo=lo.save(),Eo=this._skipUntilEnd(lo,'Failed to skip indefinite length body: "'+this.tag+'"');return lo.isError(Eo)?Eo:(bo=lo.offset-wo.offset,lo.restore(wo),lo.skip(bo,'Failed to match body of: "'+uo+'"'))},oo.prototype._skipUntilEnd=function(lo,uo){for(;;){var ho=ao(lo,uo);if(lo.isError(ho))return ho;var go=so(lo,ho.primitive,uo);if(lo.isError(go))return go;var bo;if(ho.primitive||go!==null?bo=lo.skip(go):bo=this._skipUntilEnd(lo,uo),lo.isError(bo))return bo;if(ho.tagStr==="end")break}},oo.prototype._decodeList=function(lo,uo,ho,go){for(var bo=[];!lo.isEmpty();){var wo=this._peekTag(lo,"end");if(lo.isError(wo))return wo;var Eo=ho.decode(lo,"der",go);if(lo.isError(Eo)&&wo)break;bo.push(Eo)}return bo},oo.prototype._decodeStr=function(lo,uo){if(uo==="bitstr"){var ho=lo.readUInt8();return lo.isError(ho)?ho:{unused:ho,data:lo.raw()}}else if(uo==="bmpstr"){var go=lo.raw();if(go.length%2===1)return lo.error("Decoding of string type: bmpstr length mismatch");for(var bo="",wo=0;wo>6],go=(uo&32)===0;if((uo&31)===31){var bo=uo;for(uo=0;(bo&128)===128;){if(bo=co.readUInt8(lo),co.isError(bo))return bo;uo<<=7,uo|=bo&127}}else uo&=31;var wo=no.tag[uo];return{cls:ho,primitive:go,tag:uo,tagStr:wo}}function so(co,lo,uo){var ho=co.readUInt8(uo);if(co.isError(ho))return ho;if(!lo&&ho===128)return null;if(!(ho&128))return ho;var go=ho&127;if(go>4)return co.error("length octect is too long");ho=0;for(var bo=0;bo=256;Eo>>=8)wo++;var $o=new eo(2+wo);$o[0]=bo,$o[1]=128|wo;for(var Eo=1+wo,Co=go.length;Co>0;Eo--,Co>>=8)$o[Eo]=Co&255;return this._createEncoderBuffer([$o,go])},oo.prototype._encodeStr=function(lo,uo){if(uo==="bitstr")return this._createEncoderBuffer([lo.unused|0,lo.data]);if(uo==="bmpstr"){for(var ho=new eo(lo.length*2),go=0;go=40)return this.reporter.error("Second objid identifier OOB");lo.splice(0,2,lo[0]*40+lo[1])}for(var bo=0,go=0;go=128;wo>>=7)bo++}for(var Eo=new eo(bo),$o=Eo.length-1,go=lo.length-1;go>=0;go--){var wo=lo[go];for(Eo[$o--]=wo&127;(wo>>=7)>0;)Eo[$o--]=128|wo&127}return this._createEncoderBuffer(Eo)};function ao(co){return co<10?"0"+co:co}oo.prototype._encodeTime=function(lo,uo){var ho,go=new Date(lo);return uo==="gentime"?ho=[ao(go.getFullYear()),ao(go.getUTCMonth()+1),ao(go.getUTCDate()),ao(go.getUTCHours()),ao(go.getUTCMinutes()),ao(go.getUTCSeconds()),"Z"].join(""):uo==="utctime"?ho=[ao(go.getFullYear()%100),ao(go.getUTCMonth()+1),ao(go.getUTCDate()),ao(go.getUTCHours()),ao(go.getUTCMinutes()),ao(go.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+uo+" time is not supported yet"),this._encodeStr(ho,"octstr")},oo.prototype._encodeNull=function(){return this._createEncoderBuffer("")},oo.prototype._encodeInt=function(lo,uo){if(typeof lo=="string"){if(!uo)return this.reporter.error("String int or enum given, but no values map");if(!uo.hasOwnProperty(lo))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(lo));lo=uo[lo]}if(typeof lo!="number"&&!eo.isBuffer(lo)){var ho=lo.toArray();!lo.sign&&ho[0]&128&&ho.unshift(0),lo=new eo(ho)}if(eo.isBuffer(lo)){var go=lo.length;lo.length===0&&go++;var wo=new eo(go);return lo.copy(wo),lo.length===0&&(wo[0]=0),this._createEncoderBuffer(wo)}if(lo<128)return this._createEncoderBuffer(lo);if(lo<256)return this._createEncoderBuffer([0,lo]);for(var go=1,bo=lo;bo>=256;bo>>=8)go++;for(var wo=new Array(go),bo=wo.length-1;bo>=0;bo--)wo[bo]=lo&255,lo>>=8;return wo[0]&128&&wo.unshift(0),this._createEncoderBuffer(new eo(wo))},oo.prototype._encodeBool=function(lo){return this._createEncoderBuffer(lo?255:0)},oo.prototype._use=function(lo,uo){return typeof lo=="function"&&(lo=lo(uo)),lo._getEncoder("der").tree},oo.prototype._skipDefault=function(lo,uo,ho){var go=this._baseState,bo;if(go.default===null)return!1;var wo=lo.join();if(go.defaultBuffer===void 0&&(go.defaultBuffer=this._encodeValue(go.default,uo,ho).join()),wo.length!==go.defaultBuffer.length)return!1;for(bo=0;bo=31?ho.error("Multi-octet tag encoding unsupported"):(lo||(go|=32),go|=no.tagClassByName[uo||"universal"]<<6,go)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var Xr=requireInherits_browser(),eo=requireDer();function to(ro){eo.call(this,ro),this.enc="pem"}return Xr(to,eo),pem=to,to.prototype.encode=function(no,io){for(var oo=eo.prototype.encode.call(this,no),ao=oo.toString("base64"),so=["-----BEGIN "+io.label+"-----"],co=0;co0&&Ro.ishrn(Oo),Ro}function bo($o,Co){$o=go($o,Co),$o=$o.mod(Co);var Ro=Xr.from($o.toArray());if(Ro.length=0)throw new Error("invalid sig")}return verify_1=io,verify_1}var browser$8,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$8;hasRequiredBrowser$3=1;var Xr=safeBufferExports.Buffer,eo=requireBrowser$9(),to=requireReadableBrowser(),ro=requireInherits_browser(),no=requireSign(),io=requireVerify(),oo=require$$6;Object.keys(oo).forEach(function(uo){oo[uo].id=Xr.from(oo[uo].id,"hex"),oo[uo.toLowerCase()]=oo[uo]});function ao(uo){to.Writable.call(this);var ho=oo[uo];if(!ho)throw new Error("Unknown message digest");this._hashType=ho.hash,this._hash=eo(ho.hash),this._tag=ho.id,this._signType=ho.sign}ro(ao,to.Writable),ao.prototype._write=function(ho,go,bo){this._hash.update(ho),bo()},ao.prototype.update=function(ho,go){return this._hash.update(typeof ho=="string"?Xr.from(ho,go):ho),this},ao.prototype.sign=function(ho,go){this.end();var bo=this._hash.digest(),wo=no(bo,ho,this._hashType,this._signType,this._tag);return go?wo.toString(go):wo};function so(uo){to.Writable.call(this);var ho=oo[uo];if(!ho)throw new Error("Unknown message digest");this._hash=eo(ho.hash),this._tag=ho.id,this._signType=ho.sign}ro(so,to.Writable),so.prototype._write=function(ho,go,bo){this._hash.update(ho),bo()},so.prototype.update=function(ho,go){return this._hash.update(typeof ho=="string"?Xr.from(ho,go):ho),this},so.prototype.verify=function(ho,go,bo){var wo=typeof go=="string"?Xr.from(go,bo):go;this.end();var Eo=this._hash.digest();return io(wo,Eo,ho,this._signType,this._tag)};function co(uo){return new ao(uo)}function lo(uo){return new so(uo)}return browser$8={Sign:co,Verify:lo,createSign:co,createVerify:lo},browser$8}var bn$2={exports:{}};bn$2.exports;var hasRequiredBn$1;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(Xr){(function(eo,to){function ro(Po,fo){if(!Po)throw new Error(fo||"Assertion failed")}function no(Po,fo){Po.super_=fo;var yo=function(){};yo.prototype=fo.prototype,Po.prototype=new yo,Po.prototype.constructor=Po}function io(Po,fo,yo){if(io.isBN(Po))return Po;this.negative=0,this.words=null,this.length=0,this.red=null,Po!==null&&((fo==="le"||fo==="be")&&(yo=fo,fo=10),this._init(Po||0,fo||10,yo||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(fo){return fo instanceof io?!0:fo!==null&&typeof fo=="object"&&fo.constructor.wordSize===io.wordSize&&Array.isArray(fo.words)},io.max=function(fo,yo){return fo.cmp(yo)>0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$2)),bn$2.exports}var browser$7,hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$7;hasRequiredBrowser$2=1;var Xr=requireElliptic(),eo=requireBn$1();browser$7=function(oo){return new ro(oo)};var to={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};to.p224=to.secp224r1,to.p256=to.secp256r1=to.prime256v1,to.p192=to.secp192r1=to.prime192v1,to.p384=to.secp384r1,to.p521=to.secp521r1;function ro(io){this.curveType=to[io],this.curveType||(this.curveType={name:io}),this.curve=new Xr.ec(this.curveType.name),this.keys=void 0}ro.prototype.generateKeys=function(io,oo){return this.keys=this.curve.genKeyPair(),this.getPublicKey(io,oo)},ro.prototype.computeSecret=function(io,oo,ao){oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo));var so=this.curve.keyFromPublic(io).getPublic(),co=so.mul(this.keys.getPrivate()).getX();return no(co,ao,this.curveType.byteLength)},ro.prototype.getPublicKey=function(io,oo){var ao=this.keys.getPublic(oo==="compressed",!0);return oo==="hybrid"&&(ao[ao.length-1]%2?ao[0]=7:ao[0]=6),no(ao,io)},ro.prototype.getPrivateKey=function(io){return no(this.keys.getPrivate(),io)},ro.prototype.setPublicKey=function(io,oo){return oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo)),this.keys._importPublic(io),this},ro.prototype.setPrivateKey=function(io,oo){oo=oo||"utf8",Buffer$3.isBuffer(io)||(io=new Buffer$3(io,oo));var ao=new eo(io);return ao=ao.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(ao),this};function no(io,oo,ao){Array.isArray(io)||(io=io.toArray());var so=new Buffer$3(io);if(ao&&so.length0?fo:yo},io.min=function(fo,yo){return fo.cmp(yo)<0?fo:yo},io.prototype._init=function(fo,yo,vo){if(typeof fo=="number")return this._initNumber(fo,yo,vo);if(typeof fo=="object")return this._initArray(fo,yo,vo);yo==="hex"&&(yo=16),ro(yo===(yo|0)&&yo>=2&&yo<=36),fo=fo.toString().replace(/\s+/g,"");var _o=0;fo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)To=fo[_o]|fo[_o-1]<<8|fo[_o-2]<<16,this.words[So]|=To<>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);else if(vo==="le")for(_o=0,So=0;_o>>26-Ao&67108863,Ao+=24,Ao>=26&&(Ao-=26,So++);return this.strip()};function ao(Po,fo){var yo=Po.charCodeAt(fo);return yo>=65&&yo<=70?yo-55:yo>=97&&yo<=102?yo-87:yo-48&15}function so(Po,fo,yo){var vo=ao(Po,yo);return yo-1>=fo&&(vo|=ao(Po,yo-1)<<4),vo}io.prototype._parseHex=function(fo,yo,vo){this.length=Math.ceil((fo.length-yo)/6),this.words=new Array(this.length);for(var _o=0;_o=yo;_o-=2)Ao=so(fo,yo,_o)<=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8;else{var ko=fo.length-yo;for(_o=ko%2===0?yo+1:yo;_o=18?(So-=18,To+=1,this.words[To]|=Ao>>>26):So+=8}this.strip()};function co(Po,fo,yo,vo){for(var _o=0,So=Math.min(Po.length,yo),To=fo;To=49?_o+=Ao-49+10:Ao>=17?_o+=Ao-17+10:_o+=Ao}return _o}io.prototype._parseBase=function(fo,yo,vo){this.words=[0],this.length=1;for(var _o=0,So=1;So<=67108863;So*=yo)_o++;_o--,So=So/yo|0;for(var To=fo.length-vo,Ao=To%_o,ko=Math.min(To,To-Ao)+vo,mo=0,Io=vo;Io1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},io.prototype.inspect=function(){return(this.red?""};var lo=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],uo=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ho=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(fo,yo){fo=fo||10,yo=yo|0||1;var vo;if(fo===16||fo==="hex"){vo="";for(var _o=0,So=0,To=0;To>>24-_o&16777215,So!==0||To!==this.length-1?vo=lo[6-ko.length]+ko+vo:vo=ko+vo,_o+=2,_o>=26&&(_o-=26,To--)}for(So!==0&&(vo=So.toString(16)+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}if(fo===(fo|0)&&fo>=2&&fo<=36){var mo=uo[fo],Io=ho[fo];vo="";var Do=this.clone();for(Do.negative=0;!Do.isZero();){var Lo=Do.modn(Io).toString(fo);Do=Do.idivn(Io),Do.isZero()?vo=Lo+vo:vo=lo[mo-Lo.length]+Lo+vo}for(this.isZero()&&(vo="0"+vo);vo.length%yo!==0;)vo="0"+vo;return this.negative!==0&&(vo="-"+vo),vo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var fo=this.words[0];return this.length===2?fo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?fo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-fo:fo},io.prototype.toJSON=function(){return this.toString(16)},io.prototype.toBuffer=function(fo,yo){return ro(typeof oo<"u"),this.toArrayLike(oo,fo,yo)},io.prototype.toArray=function(fo,yo){return this.toArrayLike(Array,fo,yo)},io.prototype.toArrayLike=function(fo,yo,vo){var _o=this.byteLength(),So=vo||Math.max(1,_o);ro(_o<=So,"byte array longer than desired length"),ro(So>0,"Requested array length <= 0"),this.strip();var To=yo==="le",Ao=new fo(So),ko,mo,Io=this.clone();if(To){for(mo=0;!Io.isZero();mo++)ko=Io.andln(255),Io.iushrn(8),Ao[mo]=ko;for(;mo=4096&&(vo+=13,yo>>>=13),yo>=64&&(vo+=7,yo>>>=7),yo>=8&&(vo+=4,yo>>>=4),yo>=2&&(vo+=2,yo>>>=2),vo+yo},io.prototype._zeroBits=function(fo){if(fo===0)return 26;var yo=fo,vo=0;return yo&8191||(vo+=13,yo>>>=13),yo&127||(vo+=7,yo>>>=7),yo&15||(vo+=4,yo>>>=4),yo&3||(vo+=2,yo>>>=2),yo&1||vo++,vo},io.prototype.bitLength=function(){var fo=this.words[this.length-1],yo=this._countBits(fo);return(this.length-1)*26+yo};function go(Po){for(var fo=new Array(Po.bitLength()),yo=0;yo>>_o}return fo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var fo=0,yo=0;yofo.length?this.clone().ior(fo):fo.clone().ior(this)},io.prototype.uor=function(fo){return this.length>fo.length?this.clone().iuor(fo):fo.clone().iuor(this)},io.prototype.iuand=function(fo){var yo;this.length>fo.length?yo=fo:yo=this;for(var vo=0;vofo.length?this.clone().iand(fo):fo.clone().iand(this)},io.prototype.uand=function(fo){return this.length>fo.length?this.clone().iuand(fo):fo.clone().iuand(this)},io.prototype.iuxor=function(fo){var yo,vo;this.length>fo.length?(yo=this,vo=fo):(yo=fo,vo=this);for(var _o=0;_ofo.length?this.clone().ixor(fo):fo.clone().ixor(this)},io.prototype.uxor=function(fo){return this.length>fo.length?this.clone().iuxor(fo):fo.clone().iuxor(this)},io.prototype.inotn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=Math.ceil(fo/26)|0,vo=fo%26;this._expand(yo),vo>0&&yo--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-vo),this.strip()},io.prototype.notn=function(fo){return this.clone().inotn(fo)},io.prototype.setn=function(fo,yo){ro(typeof fo=="number"&&fo>=0);var vo=fo/26|0,_o=fo%26;return this._expand(vo+1),yo?this.words[vo]=this.words[vo]|1<<_o:this.words[vo]=this.words[vo]&~(1<<_o),this.strip()},io.prototype.iadd=function(fo){var yo;if(this.negative!==0&&fo.negative===0)return this.negative=0,yo=this.isub(fo),this.negative^=1,this._normSign();if(this.negative===0&&fo.negative!==0)return fo.negative=0,yo=this.isub(fo),fo.negative=1,yo._normSign();var vo,_o;this.length>fo.length?(vo=this,_o=fo):(vo=fo,_o=this);for(var So=0,To=0;To<_o.length;To++)yo=(vo.words[To]|0)+(_o.words[To]|0)+So,this.words[To]=yo&67108863,So=yo>>>26;for(;So!==0&&To>>26;if(this.length=vo.length,So!==0)this.words[this.length]=So,this.length++;else if(vo!==this)for(;Tofo.length?this.clone().iadd(fo):fo.clone().iadd(this)},io.prototype.isub=function(fo){if(fo.negative!==0){fo.negative=0;var yo=this.iadd(fo);return fo.negative=1,yo._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(fo),this.negative=1,this._normSign();var vo=this.cmp(fo);if(vo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,So;vo>0?(_o=this,So=fo):(_o=fo,So=this);for(var To=0,Ao=0;Ao>26,this.words[Ao]=yo&67108863;for(;To!==0&&Ao<_o.length;Ao++)yo=(_o.words[Ao]|0)+To,To=yo>>26,this.words[Ao]=yo&67108863;if(To===0&&Ao<_o.length&&_o!==this)for(;Ao<_o.length;Ao++)this.words[Ao]=_o.words[Ao];return this.length=Math.max(this.length,Ao),_o!==this&&(this.negative=1),this.strip()},io.prototype.sub=function(fo){return this.clone().isub(fo)};function bo(Po,fo,yo){yo.negative=fo.negative^Po.negative;var vo=Po.length+fo.length|0;yo.length=vo,vo=vo-1|0;var _o=Po.words[0]|0,So=fo.words[0]|0,To=_o*So,Ao=To&67108863,ko=To/67108864|0;yo.words[0]=Ao;for(var mo=1;mo>>26,Do=ko&67108863,Lo=Math.min(mo,fo.length-1),Ho=Math.max(0,mo-Po.length+1);Ho<=Lo;Ho++){var Yo=mo-Ho|0;_o=Po.words[Yo]|0,So=fo.words[Ho]|0,To=_o*So+Do,Io+=To/67108864|0,Do=To&67108863}yo.words[mo]=Do|0,ko=Io|0}return ko!==0?yo.words[mo]=ko|0:yo.length--,yo.strip()}var wo=function(fo,yo,vo){var _o=fo.words,So=yo.words,To=vo.words,Ao=0,ko,mo,Io,Do=_o[0]|0,Lo=Do&8191,Ho=Do>>>13,Yo=_o[1]|0,Xo=Yo&8191,qo=Yo>>>13,Ko=_o[2]|0,Qo=Ko&8191,zo=Ko>>>13,ga=_o[3]|0,$a=ga&8191,Sl=ga>>>13,El=_o[4]|0,Tl=El&8191,Il=El>>>13,Zl=_o[5]|0,Vl=Zl&8191,Ol=Zl>>>13,Dl=_o[6]|0,Fl=Dl&8191,Jl=Dl>>>13,cu=_o[7]|0,Ll=cu&8191,Xl=cu>>>13,ku=_o[8]|0,iu=ku&8191,hu=ku>>>13,Cu=_o[9]|0,_l=Cu&8191,Go=Cu>>>13,yl=So[0]|0,Al=yl&8191,Ul=yl>>>13,su=So[1]|0,Ql=su&8191,vu=su>>>13,qu=So[2]|0,pu=qu&8191,xu=qu>>>13,Au=So[3]|0,yu=Au&8191,wu=Au>>>13,Gu=So[4]|0,Ml=Gu&8191,Nl=Gu>>>13,Yl=So[5]|0,Wl=Yl&8191,eu=Yl>>>13,Su=So[6]|0,ru=Su&8191,uu=Su>>>13,xl=So[7]|0,$l=xl&8191,Cl=xl>>>13,Zo=So[8]|0,Rl=Zo&8191,Hl=Zo>>>13,au=So[9]|0,tu=au&8191,lu=au>>>13;vo.negative=fo.negative^yo.negative,vo.length=19,ko=Math.imul(Lo,Al),mo=Math.imul(Lo,Ul),mo=mo+Math.imul(Ho,Al)|0,Io=Math.imul(Ho,Ul);var Nu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Nu>>>26)|0,Nu&=67108863,ko=Math.imul(Xo,Al),mo=Math.imul(Xo,Ul),mo=mo+Math.imul(qo,Al)|0,Io=Math.imul(qo,Ul),ko=ko+Math.imul(Lo,Ql)|0,mo=mo+Math.imul(Lo,vu)|0,mo=mo+Math.imul(Ho,Ql)|0,Io=Io+Math.imul(Ho,vu)|0;var Pu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Pu>>>26)|0,Pu&=67108863,ko=Math.imul(Qo,Al),mo=Math.imul(Qo,Ul),mo=mo+Math.imul(zo,Al)|0,Io=Math.imul(zo,Ul),ko=ko+Math.imul(Xo,Ql)|0,mo=mo+Math.imul(Xo,vu)|0,mo=mo+Math.imul(qo,Ql)|0,Io=Io+Math.imul(qo,vu)|0,ko=ko+Math.imul(Lo,pu)|0,mo=mo+Math.imul(Lo,xu)|0,mo=mo+Math.imul(Ho,pu)|0,Io=Io+Math.imul(Ho,xu)|0;var ip=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ip>>>26)|0,ip&=67108863,ko=Math.imul($a,Al),mo=Math.imul($a,Ul),mo=mo+Math.imul(Sl,Al)|0,Io=Math.imul(Sl,Ul),ko=ko+Math.imul(Qo,Ql)|0,mo=mo+Math.imul(Qo,vu)|0,mo=mo+Math.imul(zo,Ql)|0,Io=Io+Math.imul(zo,vu)|0,ko=ko+Math.imul(Xo,pu)|0,mo=mo+Math.imul(Xo,xu)|0,mo=mo+Math.imul(qo,pu)|0,Io=Io+Math.imul(qo,xu)|0,ko=ko+Math.imul(Lo,yu)|0,mo=mo+Math.imul(Lo,wu)|0,mo=mo+Math.imul(Ho,yu)|0,Io=Io+Math.imul(Ho,wu)|0;var Lu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Lu>>>26)|0,Lu&=67108863,ko=Math.imul(Tl,Al),mo=Math.imul(Tl,Ul),mo=mo+Math.imul(Il,Al)|0,Io=Math.imul(Il,Ul),ko=ko+Math.imul($a,Ql)|0,mo=mo+Math.imul($a,vu)|0,mo=mo+Math.imul(Sl,Ql)|0,Io=Io+Math.imul(Sl,vu)|0,ko=ko+Math.imul(Qo,pu)|0,mo=mo+Math.imul(Qo,xu)|0,mo=mo+Math.imul(zo,pu)|0,Io=Io+Math.imul(zo,xu)|0,ko=ko+Math.imul(Xo,yu)|0,mo=mo+Math.imul(Xo,wu)|0,mo=mo+Math.imul(qo,yu)|0,Io=Io+Math.imul(qo,wu)|0,ko=ko+Math.imul(Lo,Ml)|0,mo=mo+Math.imul(Lo,Nl)|0,mo=mo+Math.imul(Ho,Ml)|0,Io=Io+Math.imul(Ho,Nl)|0;var Yu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,ko=Math.imul(Vl,Al),mo=Math.imul(Vl,Ul),mo=mo+Math.imul(Ol,Al)|0,Io=Math.imul(Ol,Ul),ko=ko+Math.imul(Tl,Ql)|0,mo=mo+Math.imul(Tl,vu)|0,mo=mo+Math.imul(Il,Ql)|0,Io=Io+Math.imul(Il,vu)|0,ko=ko+Math.imul($a,pu)|0,mo=mo+Math.imul($a,xu)|0,mo=mo+Math.imul(Sl,pu)|0,Io=Io+Math.imul(Sl,xu)|0,ko=ko+Math.imul(Qo,yu)|0,mo=mo+Math.imul(Qo,wu)|0,mo=mo+Math.imul(zo,yu)|0,Io=Io+Math.imul(zo,wu)|0,ko=ko+Math.imul(Xo,Ml)|0,mo=mo+Math.imul(Xo,Nl)|0,mo=mo+Math.imul(qo,Ml)|0,Io=Io+Math.imul(qo,Nl)|0,ko=ko+Math.imul(Lo,Wl)|0,mo=mo+Math.imul(Lo,eu)|0,mo=mo+Math.imul(Ho,Wl)|0,Io=Io+Math.imul(Ho,eu)|0;var _d=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_d>>>26)|0,_d&=67108863,ko=Math.imul(Fl,Al),mo=Math.imul(Fl,Ul),mo=mo+Math.imul(Jl,Al)|0,Io=Math.imul(Jl,Ul),ko=ko+Math.imul(Vl,Ql)|0,mo=mo+Math.imul(Vl,vu)|0,mo=mo+Math.imul(Ol,Ql)|0,Io=Io+Math.imul(Ol,vu)|0,ko=ko+Math.imul(Tl,pu)|0,mo=mo+Math.imul(Tl,xu)|0,mo=mo+Math.imul(Il,pu)|0,Io=Io+Math.imul(Il,xu)|0,ko=ko+Math.imul($a,yu)|0,mo=mo+Math.imul($a,wu)|0,mo=mo+Math.imul(Sl,yu)|0,Io=Io+Math.imul(Sl,wu)|0,ko=ko+Math.imul(Qo,Ml)|0,mo=mo+Math.imul(Qo,Nl)|0,mo=mo+Math.imul(zo,Ml)|0,Io=Io+Math.imul(zo,Nl)|0,ko=ko+Math.imul(Xo,Wl)|0,mo=mo+Math.imul(Xo,eu)|0,mo=mo+Math.imul(qo,Wl)|0,Io=Io+Math.imul(qo,eu)|0,ko=ko+Math.imul(Lo,ru)|0,mo=mo+Math.imul(Lo,uu)|0,mo=mo+Math.imul(Ho,ru)|0,Io=Io+Math.imul(Ho,uu)|0;var Qu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Qu>>>26)|0,Qu&=67108863,ko=Math.imul(Ll,Al),mo=Math.imul(Ll,Ul),mo=mo+Math.imul(Xl,Al)|0,Io=Math.imul(Xl,Ul),ko=ko+Math.imul(Fl,Ql)|0,mo=mo+Math.imul(Fl,vu)|0,mo=mo+Math.imul(Jl,Ql)|0,Io=Io+Math.imul(Jl,vu)|0,ko=ko+Math.imul(Vl,pu)|0,mo=mo+Math.imul(Vl,xu)|0,mo=mo+Math.imul(Ol,pu)|0,Io=Io+Math.imul(Ol,xu)|0,ko=ko+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Tl,wu)|0,mo=mo+Math.imul(Il,yu)|0,Io=Io+Math.imul(Il,wu)|0,ko=ko+Math.imul($a,Ml)|0,mo=mo+Math.imul($a,Nl)|0,mo=mo+Math.imul(Sl,Ml)|0,Io=Io+Math.imul(Sl,Nl)|0,ko=ko+Math.imul(Qo,Wl)|0,mo=mo+Math.imul(Qo,eu)|0,mo=mo+Math.imul(zo,Wl)|0,Io=Io+Math.imul(zo,eu)|0,ko=ko+Math.imul(Xo,ru)|0,mo=mo+Math.imul(Xo,uu)|0,mo=mo+Math.imul(qo,ru)|0,Io=Io+Math.imul(qo,uu)|0,ko=ko+Math.imul(Lo,$l)|0,mo=mo+Math.imul(Lo,Cl)|0,mo=mo+Math.imul(Ho,$l)|0,Io=Io+Math.imul(Ho,Cl)|0;var _f=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_f>>>26)|0,_f&=67108863,ko=Math.imul(iu,Al),mo=Math.imul(iu,Ul),mo=mo+Math.imul(hu,Al)|0,Io=Math.imul(hu,Ul),ko=ko+Math.imul(Ll,Ql)|0,mo=mo+Math.imul(Ll,vu)|0,mo=mo+Math.imul(Xl,Ql)|0,Io=Io+Math.imul(Xl,vu)|0,ko=ko+Math.imul(Fl,pu)|0,mo=mo+Math.imul(Fl,xu)|0,mo=mo+Math.imul(Jl,pu)|0,Io=Io+Math.imul(Jl,xu)|0,ko=ko+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Vl,wu)|0,mo=mo+Math.imul(Ol,yu)|0,Io=Io+Math.imul(Ol,wu)|0,ko=ko+Math.imul(Tl,Ml)|0,mo=mo+Math.imul(Tl,Nl)|0,mo=mo+Math.imul(Il,Ml)|0,Io=Io+Math.imul(Il,Nl)|0,ko=ko+Math.imul($a,Wl)|0,mo=mo+Math.imul($a,eu)|0,mo=mo+Math.imul(Sl,Wl)|0,Io=Io+Math.imul(Sl,eu)|0,ko=ko+Math.imul(Qo,ru)|0,mo=mo+Math.imul(Qo,uu)|0,mo=mo+Math.imul(zo,ru)|0,Io=Io+Math.imul(zo,uu)|0,ko=ko+Math.imul(Xo,$l)|0,mo=mo+Math.imul(Xo,Cl)|0,mo=mo+Math.imul(qo,$l)|0,Io=Io+Math.imul(qo,Cl)|0,ko=ko+Math.imul(Lo,Rl)|0,mo=mo+Math.imul(Lo,Hl)|0,mo=mo+Math.imul(Ho,Rl)|0,Io=Io+Math.imul(Ho,Hl)|0;var ep=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(ep>>>26)|0,ep&=67108863,ko=Math.imul(_l,Al),mo=Math.imul(_l,Ul),mo=mo+Math.imul(Go,Al)|0,Io=Math.imul(Go,Ul),ko=ko+Math.imul(iu,Ql)|0,mo=mo+Math.imul(iu,vu)|0,mo=mo+Math.imul(hu,Ql)|0,Io=Io+Math.imul(hu,vu)|0,ko=ko+Math.imul(Ll,pu)|0,mo=mo+Math.imul(Ll,xu)|0,mo=mo+Math.imul(Xl,pu)|0,Io=Io+Math.imul(Xl,xu)|0,ko=ko+Math.imul(Fl,yu)|0,mo=mo+Math.imul(Fl,wu)|0,mo=mo+Math.imul(Jl,yu)|0,Io=Io+Math.imul(Jl,wu)|0,ko=ko+Math.imul(Vl,Ml)|0,mo=mo+Math.imul(Vl,Nl)|0,mo=mo+Math.imul(Ol,Ml)|0,Io=Io+Math.imul(Ol,Nl)|0,ko=ko+Math.imul(Tl,Wl)|0,mo=mo+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Il,Wl)|0,Io=Io+Math.imul(Il,eu)|0,ko=ko+Math.imul($a,ru)|0,mo=mo+Math.imul($a,uu)|0,mo=mo+Math.imul(Sl,ru)|0,Io=Io+Math.imul(Sl,uu)|0,ko=ko+Math.imul(Qo,$l)|0,mo=mo+Math.imul(Qo,Cl)|0,mo=mo+Math.imul(zo,$l)|0,Io=Io+Math.imul(zo,Cl)|0,ko=ko+Math.imul(Xo,Rl)|0,mo=mo+Math.imul(Xo,Hl)|0,mo=mo+Math.imul(qo,Rl)|0,Io=Io+Math.imul(qo,Hl)|0,ko=ko+Math.imul(Lo,tu)|0,mo=mo+Math.imul(Lo,lu)|0,mo=mo+Math.imul(Ho,tu)|0,Io=Io+Math.imul(Ho,lu)|0;var Xu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,ko=Math.imul(_l,Ql),mo=Math.imul(_l,vu),mo=mo+Math.imul(Go,Ql)|0,Io=Math.imul(Go,vu),ko=ko+Math.imul(iu,pu)|0,mo=mo+Math.imul(iu,xu)|0,mo=mo+Math.imul(hu,pu)|0,Io=Io+Math.imul(hu,xu)|0,ko=ko+Math.imul(Ll,yu)|0,mo=mo+Math.imul(Ll,wu)|0,mo=mo+Math.imul(Xl,yu)|0,Io=Io+Math.imul(Xl,wu)|0,ko=ko+Math.imul(Fl,Ml)|0,mo=mo+Math.imul(Fl,Nl)|0,mo=mo+Math.imul(Jl,Ml)|0,Io=Io+Math.imul(Jl,Nl)|0,ko=ko+Math.imul(Vl,Wl)|0,mo=mo+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Ol,Wl)|0,Io=Io+Math.imul(Ol,eu)|0,ko=ko+Math.imul(Tl,ru)|0,mo=mo+Math.imul(Tl,uu)|0,mo=mo+Math.imul(Il,ru)|0,Io=Io+Math.imul(Il,uu)|0,ko=ko+Math.imul($a,$l)|0,mo=mo+Math.imul($a,Cl)|0,mo=mo+Math.imul(Sl,$l)|0,Io=Io+Math.imul(Sl,Cl)|0,ko=ko+Math.imul(Qo,Rl)|0,mo=mo+Math.imul(Qo,Hl)|0,mo=mo+Math.imul(zo,Rl)|0,Io=Io+Math.imul(zo,Hl)|0,ko=ko+Math.imul(Xo,tu)|0,mo=mo+Math.imul(Xo,lu)|0,mo=mo+Math.imul(qo,tu)|0,Io=Io+Math.imul(qo,lu)|0;var _h=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_h>>>26)|0,_h&=67108863,ko=Math.imul(_l,pu),mo=Math.imul(_l,xu),mo=mo+Math.imul(Go,pu)|0,Io=Math.imul(Go,xu),ko=ko+Math.imul(iu,yu)|0,mo=mo+Math.imul(iu,wu)|0,mo=mo+Math.imul(hu,yu)|0,Io=Io+Math.imul(hu,wu)|0,ko=ko+Math.imul(Ll,Ml)|0,mo=mo+Math.imul(Ll,Nl)|0,mo=mo+Math.imul(Xl,Ml)|0,Io=Io+Math.imul(Xl,Nl)|0,ko=ko+Math.imul(Fl,Wl)|0,mo=mo+Math.imul(Fl,eu)|0,mo=mo+Math.imul(Jl,Wl)|0,Io=Io+Math.imul(Jl,eu)|0,ko=ko+Math.imul(Vl,ru)|0,mo=mo+Math.imul(Vl,uu)|0,mo=mo+Math.imul(Ol,ru)|0,Io=Io+Math.imul(Ol,uu)|0,ko=ko+Math.imul(Tl,$l)|0,mo=mo+Math.imul(Tl,Cl)|0,mo=mo+Math.imul(Il,$l)|0,Io=Io+Math.imul(Il,Cl)|0,ko=ko+Math.imul($a,Rl)|0,mo=mo+Math.imul($a,Hl)|0,mo=mo+Math.imul(Sl,Rl)|0,Io=Io+Math.imul(Sl,Hl)|0,ko=ko+Math.imul(Qo,tu)|0,mo=mo+Math.imul(Qo,lu)|0,mo=mo+Math.imul(zo,tu)|0,Io=Io+Math.imul(zo,lu)|0;var zu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,ko=Math.imul(_l,yu),mo=Math.imul(_l,wu),mo=mo+Math.imul(Go,yu)|0,Io=Math.imul(Go,wu),ko=ko+Math.imul(iu,Ml)|0,mo=mo+Math.imul(iu,Nl)|0,mo=mo+Math.imul(hu,Ml)|0,Io=Io+Math.imul(hu,Nl)|0,ko=ko+Math.imul(Ll,Wl)|0,mo=mo+Math.imul(Ll,eu)|0,mo=mo+Math.imul(Xl,Wl)|0,Io=Io+Math.imul(Xl,eu)|0,ko=ko+Math.imul(Fl,ru)|0,mo=mo+Math.imul(Fl,uu)|0,mo=mo+Math.imul(Jl,ru)|0,Io=Io+Math.imul(Jl,uu)|0,ko=ko+Math.imul(Vl,$l)|0,mo=mo+Math.imul(Vl,Cl)|0,mo=mo+Math.imul(Ol,$l)|0,Io=Io+Math.imul(Ol,Cl)|0,ko=ko+Math.imul(Tl,Rl)|0,mo=mo+Math.imul(Tl,Hl)|0,mo=mo+Math.imul(Il,Rl)|0,Io=Io+Math.imul(Il,Hl)|0,ko=ko+Math.imul($a,tu)|0,mo=mo+Math.imul($a,lu)|0,mo=mo+Math.imul(Sl,tu)|0,Io=Io+Math.imul(Sl,lu)|0;var Vu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,ko=Math.imul(_l,Ml),mo=Math.imul(_l,Nl),mo=mo+Math.imul(Go,Ml)|0,Io=Math.imul(Go,Nl),ko=ko+Math.imul(iu,Wl)|0,mo=mo+Math.imul(iu,eu)|0,mo=mo+Math.imul(hu,Wl)|0,Io=Io+Math.imul(hu,eu)|0,ko=ko+Math.imul(Ll,ru)|0,mo=mo+Math.imul(Ll,uu)|0,mo=mo+Math.imul(Xl,ru)|0,Io=Io+Math.imul(Xl,uu)|0,ko=ko+Math.imul(Fl,$l)|0,mo=mo+Math.imul(Fl,Cl)|0,mo=mo+Math.imul(Jl,$l)|0,Io=Io+Math.imul(Jl,Cl)|0,ko=ko+Math.imul(Vl,Rl)|0,mo=mo+Math.imul(Vl,Hl)|0,mo=mo+Math.imul(Ol,Rl)|0,Io=Io+Math.imul(Ol,Hl)|0,ko=ko+Math.imul(Tl,tu)|0,mo=mo+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Il,tu)|0,Io=Io+Math.imul(Il,lu)|0;var Fu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Fu>>>26)|0,Fu&=67108863,ko=Math.imul(_l,Wl),mo=Math.imul(_l,eu),mo=mo+Math.imul(Go,Wl)|0,Io=Math.imul(Go,eu),ko=ko+Math.imul(iu,ru)|0,mo=mo+Math.imul(iu,uu)|0,mo=mo+Math.imul(hu,ru)|0,Io=Io+Math.imul(hu,uu)|0,ko=ko+Math.imul(Ll,$l)|0,mo=mo+Math.imul(Ll,Cl)|0,mo=mo+Math.imul(Xl,$l)|0,Io=Io+Math.imul(Xl,Cl)|0,ko=ko+Math.imul(Fl,Rl)|0,mo=mo+Math.imul(Fl,Hl)|0,mo=mo+Math.imul(Jl,Rl)|0,Io=Io+Math.imul(Jl,Hl)|0,ko=ko+Math.imul(Vl,tu)|0,mo=mo+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Ol,tu)|0,Io=Io+Math.imul(Ol,lu)|0;var Tu=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,ko=Math.imul(_l,ru),mo=Math.imul(_l,uu),mo=mo+Math.imul(Go,ru)|0,Io=Math.imul(Go,uu),ko=ko+Math.imul(iu,$l)|0,mo=mo+Math.imul(iu,Cl)|0,mo=mo+Math.imul(hu,$l)|0,Io=Io+Math.imul(hu,Cl)|0,ko=ko+Math.imul(Ll,Rl)|0,mo=mo+Math.imul(Ll,Hl)|0,mo=mo+Math.imul(Xl,Rl)|0,Io=Io+Math.imul(Xl,Hl)|0,ko=ko+Math.imul(Fl,tu)|0,mo=mo+Math.imul(Fl,lu)|0,mo=mo+Math.imul(Jl,tu)|0,Io=Io+Math.imul(Jl,lu)|0;var Ru=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ru>>>26)|0,Ru&=67108863,ko=Math.imul(_l,$l),mo=Math.imul(_l,Cl),mo=mo+Math.imul(Go,$l)|0,Io=Math.imul(Go,Cl),ko=ko+Math.imul(iu,Rl)|0,mo=mo+Math.imul(iu,Hl)|0,mo=mo+Math.imul(hu,Rl)|0,Io=Io+Math.imul(hu,Hl)|0,ko=ko+Math.imul(Ll,tu)|0,mo=mo+Math.imul(Ll,lu)|0,mo=mo+Math.imul(Xl,tu)|0,Io=Io+Math.imul(Xl,lu)|0;var Ou=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(Ou>>>26)|0,Ou&=67108863,ko=Math.imul(_l,Rl),mo=Math.imul(_l,Hl),mo=mo+Math.imul(Go,Rl)|0,Io=Math.imul(Go,Hl),ko=ko+Math.imul(iu,tu)|0,mo=mo+Math.imul(iu,lu)|0,mo=mo+Math.imul(hu,tu)|0,Io=Io+Math.imul(hu,lu)|0;var _u=(Ao+ko|0)+((mo&8191)<<13)|0;Ao=(Io+(mo>>>13)|0)+(_u>>>26)|0,_u&=67108863,ko=Math.imul(_l,tu),mo=Math.imul(_l,lu),mo=mo+Math.imul(Go,tu)|0,Io=Math.imul(Go,lu);var $u=(Ao+ko|0)+((mo&8191)<<13)|0;return Ao=(Io+(mo>>>13)|0)+($u>>>26)|0,$u&=67108863,To[0]=Nu,To[1]=Pu,To[2]=ip,To[3]=Lu,To[4]=Yu,To[5]=_d,To[6]=Qu,To[7]=_f,To[8]=ep,To[9]=Xu,To[10]=_h,To[11]=zu,To[12]=Vu,To[13]=Fu,To[14]=Tu,To[15]=Ru,To[16]=Ou,To[17]=_u,To[18]=$u,Ao!==0&&(To[19]=Ao,vo.length++),vo};Math.imul||(wo=bo);function Eo(Po,fo,yo){yo.negative=fo.negative^Po.negative,yo.length=Po.length+fo.length;for(var vo=0,_o=0,So=0;So>>26)|0,_o+=To>>>26,To&=67108863}yo.words[So]=Ao,vo=To,To=_o}return vo!==0?yo.words[So]=vo:yo.length--,yo.strip()}function $o(Po,fo,yo){var vo=new Co;return vo.mulp(Po,fo,yo)}io.prototype.mulTo=function(fo,yo){var vo,_o=this.length+fo.length;return this.length===10&&fo.length===10?vo=wo(this,fo,yo):_o<63?vo=bo(this,fo,yo):_o<1024?vo=Eo(this,fo,yo):vo=$o(this,fo,yo),vo};function Co(Po,fo){this.x=Po,this.y=fo}Co.prototype.makeRBT=function(fo){for(var yo=new Array(fo),vo=io.prototype._countBits(fo)-1,_o=0;_o>=1;return _o},Co.prototype.permute=function(fo,yo,vo,_o,So,To){for(var Ao=0;Ao>>1)So++;return 1<>>13,vo[2*To+1]=So&8191,So=So>>>13;for(To=2*yo;To<_o;++To)vo[To]=0;ro(So===0),ro((So&-8192)===0)},Co.prototype.stub=function(fo){for(var yo=new Array(fo),vo=0;vo>=26,yo+=_o/67108864|0,yo+=So>>>26,this.words[vo]=So&67108863}return yo!==0&&(this.words[vo]=yo,this.length++),this},io.prototype.muln=function(fo){return this.clone().imuln(fo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(fo){var yo=go(fo);if(yo.length===0)return new io(1);for(var vo=this,_o=0;_o=0);var yo=fo%26,vo=(fo-yo)/26,_o=67108863>>>26-yo<<26-yo,So;if(yo!==0){var To=0;for(So=0;So>>26-yo}To&&(this.words[So]=To,this.length++)}if(vo!==0){for(So=this.length-1;So>=0;So--)this.words[So+vo]=this.words[So];for(So=0;So=0);var _o;yo?_o=(yo-yo%26)/26:_o=0;var So=fo%26,To=Math.min((fo-So)/26,this.length),Ao=67108863^67108863>>>So<To)for(this.length-=To,mo=0;mo=0&&(Io!==0||mo>=_o);mo--){var Do=this.words[mo]|0;this.words[mo]=Io<<26-So|Do>>>So,Io=Do&Ao}return ko&&Io!==0&&(ko.words[ko.length++]=Io),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},io.prototype.ishrn=function(fo,yo,vo){return ro(this.negative===0),this.iushrn(fo,yo,vo)},io.prototype.shln=function(fo){return this.clone().ishln(fo)},io.prototype.ushln=function(fo){return this.clone().iushln(fo)},io.prototype.shrn=function(fo){return this.clone().ishrn(fo)},io.prototype.ushrn=function(fo){return this.clone().iushrn(fo)},io.prototype.testn=function(fo){ro(typeof fo=="number"&&fo>=0);var yo=fo%26,vo=(fo-yo)/26,_o=1<=0);var yo=fo%26,vo=(fo-yo)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=vo)return this;if(yo!==0&&vo++,this.length=Math.min(vo,this.length),yo!==0){var _o=67108863^67108863>>>yo<=67108864;yo++)this.words[yo]-=67108864,yo===this.length-1?this.words[yo+1]=1:this.words[yo+1]++;return this.length=Math.max(this.length,yo+1),this},io.prototype.isubn=function(fo){if(ro(typeof fo=="number"),ro(fo<67108864),fo<0)return this.iaddn(-fo);if(this.negative!==0)return this.negative=0,this.iaddn(fo),this.negative=1,this;if(this.words[0]-=fo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var yo=0;yo>26)-(ko/67108864|0),this.words[So+vo]=To&67108863}for(;So>26,this.words[So+vo]=To&67108863;if(Ao===0)return this.strip();for(ro(Ao===-1),Ao=0,So=0;So>26,this.words[So]=To&67108863;return this.negative=1,this.strip()},io.prototype._wordDiv=function(fo,yo){var vo=this.length-fo.length,_o=this.clone(),So=fo,To=So.words[So.length-1]|0,Ao=this._countBits(To);vo=26-Ao,vo!==0&&(So=So.ushln(vo),_o.iushln(vo),To=So.words[So.length-1]|0);var ko=_o.length-So.length,mo;if(yo!=="mod"){mo=new io(null),mo.length=ko+1,mo.words=new Array(mo.length);for(var Io=0;Io=0;Lo--){var Ho=(_o.words[So.length+Lo]|0)*67108864+(_o.words[So.length+Lo-1]|0);for(Ho=Math.min(Ho/To|0,67108863),_o._ishlnsubmul(So,Ho,Lo);_o.negative!==0;)Ho--,_o.negative=0,_o._ishlnsubmul(So,1,Lo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Lo]=Ho)}return mo&&mo.strip(),_o.strip(),yo!=="div"&&vo!==0&&_o.iushrn(vo),{div:mo||null,mod:_o}},io.prototype.divmod=function(fo,yo,vo){if(ro(!fo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,So,To;return this.negative!==0&&fo.negative===0?(To=this.neg().divmod(fo,yo),yo!=="mod"&&(_o=To.div.neg()),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.iadd(fo)),{div:_o,mod:So}):this.negative===0&&fo.negative!==0?(To=this.divmod(fo.neg(),yo),yo!=="mod"&&(_o=To.div.neg()),{div:_o,mod:To.mod}):this.negative&fo.negative?(To=this.neg().divmod(fo.neg(),yo),yo!=="div"&&(So=To.mod.neg(),vo&&So.negative!==0&&So.isub(fo)),{div:To.div,mod:So}):fo.length>this.length||this.cmp(fo)<0?{div:new io(0),mod:this}:fo.length===1?yo==="div"?{div:this.divn(fo.words[0]),mod:null}:yo==="mod"?{div:null,mod:new io(this.modn(fo.words[0]))}:{div:this.divn(fo.words[0]),mod:new io(this.modn(fo.words[0]))}:this._wordDiv(fo,yo)},io.prototype.div=function(fo){return this.divmod(fo,"div",!1).div},io.prototype.mod=function(fo){return this.divmod(fo,"mod",!1).mod},io.prototype.umod=function(fo){return this.divmod(fo,"mod",!0).mod},io.prototype.divRound=function(fo){var yo=this.divmod(fo);if(yo.mod.isZero())return yo.div;var vo=yo.div.negative!==0?yo.mod.isub(fo):yo.mod,_o=fo.ushrn(1),So=fo.andln(1),To=vo.cmp(_o);return To<0||So===1&&To===0?yo.div:yo.div.negative!==0?yo.div.isubn(1):yo.div.iaddn(1)},io.prototype.modn=function(fo){ro(fo<=67108863);for(var yo=(1<<26)%fo,vo=0,_o=this.length-1;_o>=0;_o--)vo=(yo*vo+(this.words[_o]|0))%fo;return vo},io.prototype.idivn=function(fo){ro(fo<=67108863);for(var yo=0,vo=this.length-1;vo>=0;vo--){var _o=(this.words[vo]|0)+yo*67108864;this.words[vo]=_o/fo|0,yo=_o%fo}return this.strip()},io.prototype.divn=function(fo){return this.clone().idivn(fo)},io.prototype.egcd=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=new io(0),Ao=new io(1),ko=0;yo.isEven()&&vo.isEven();)yo.iushrn(1),vo.iushrn(1),++ko;for(var mo=vo.clone(),Io=yo.clone();!yo.isZero();){for(var Do=0,Lo=1;!(yo.words[0]&Lo)&&Do<26;++Do,Lo<<=1);if(Do>0)for(yo.iushrn(Do);Do-- >0;)(_o.isOdd()||So.isOdd())&&(_o.iadd(mo),So.isub(Io)),_o.iushrn(1),So.iushrn(1);for(var Ho=0,Yo=1;!(vo.words[0]&Yo)&&Ho<26;++Ho,Yo<<=1);if(Ho>0)for(vo.iushrn(Ho);Ho-- >0;)(To.isOdd()||Ao.isOdd())&&(To.iadd(mo),Ao.isub(Io)),To.iushrn(1),Ao.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(To),So.isub(Ao)):(vo.isub(yo),To.isub(_o),Ao.isub(So))}return{a:To,b:Ao,gcd:vo.iushln(ko)}},io.prototype._invmp=function(fo){ro(fo.negative===0),ro(!fo.isZero());var yo=this,vo=fo.clone();yo.negative!==0?yo=yo.umod(fo):yo=yo.clone();for(var _o=new io(1),So=new io(0),To=vo.clone();yo.cmpn(1)>0&&vo.cmpn(1)>0;){for(var Ao=0,ko=1;!(yo.words[0]&ko)&&Ao<26;++Ao,ko<<=1);if(Ao>0)for(yo.iushrn(Ao);Ao-- >0;)_o.isOdd()&&_o.iadd(To),_o.iushrn(1);for(var mo=0,Io=1;!(vo.words[0]&Io)&&mo<26;++mo,Io<<=1);if(mo>0)for(vo.iushrn(mo);mo-- >0;)So.isOdd()&&So.iadd(To),So.iushrn(1);yo.cmp(vo)>=0?(yo.isub(vo),_o.isub(So)):(vo.isub(yo),So.isub(_o))}var Do;return yo.cmpn(1)===0?Do=_o:Do=So,Do.cmpn(0)<0&&Do.iadd(fo),Do},io.prototype.gcd=function(fo){if(this.isZero())return fo.abs();if(fo.isZero())return this.abs();var yo=this.clone(),vo=fo.clone();yo.negative=0,vo.negative=0;for(var _o=0;yo.isEven()&&vo.isEven();_o++)yo.iushrn(1),vo.iushrn(1);do{for(;yo.isEven();)yo.iushrn(1);for(;vo.isEven();)vo.iushrn(1);var So=yo.cmp(vo);if(So<0){var To=yo;yo=vo,vo=To}else if(So===0||vo.cmpn(1)===0)break;yo.isub(vo)}while(!0);return vo.iushln(_o)},io.prototype.invm=function(fo){return this.egcd(fo).a.umod(fo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(fo){return this.words[0]&fo},io.prototype.bincn=function(fo){ro(typeof fo=="number");var yo=fo%26,vo=(fo-yo)/26,_o=1<>>26,Ao&=67108863,this.words[To]=Ao}return So!==0&&(this.words[To]=So,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(fo){var yo=fo<0;if(this.negative!==0&&!yo)return-1;if(this.negative===0&&yo)return 1;this.strip();var vo;if(this.length>1)vo=1;else{yo&&(fo=-fo),ro(fo<=67108863,"Number is too big");var _o=this.words[0]|0;vo=_o===fo?0:_ofo.length)return 1;if(this.length=0;vo--){var _o=this.words[vo]|0,So=fo.words[vo]|0;if(_o!==So){_oSo&&(yo=1);break}}return yo},io.prototype.gtn=function(fo){return this.cmpn(fo)===1},io.prototype.gt=function(fo){return this.cmp(fo)===1},io.prototype.gten=function(fo){return this.cmpn(fo)>=0},io.prototype.gte=function(fo){return this.cmp(fo)>=0},io.prototype.ltn=function(fo){return this.cmpn(fo)===-1},io.prototype.lt=function(fo){return this.cmp(fo)===-1},io.prototype.lten=function(fo){return this.cmpn(fo)<=0},io.prototype.lte=function(fo){return this.cmp(fo)<=0},io.prototype.eqn=function(fo){return this.cmpn(fo)===0},io.prototype.eq=function(fo){return this.cmp(fo)===0},io.red=function(fo){return new Wo(fo)},io.prototype.toRed=function(fo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),fo.convertTo(this)._forceRed(fo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(fo){return this.red=fo,this},io.prototype.forceRed=function(fo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(fo)},io.prototype.redAdd=function(fo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,fo)},io.prototype.redIAdd=function(fo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,fo)},io.prototype.redSub=function(fo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,fo)},io.prototype.redISub=function(fo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,fo)},io.prototype.redShl=function(fo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,fo)},io.prototype.redMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.mul(this,fo)},io.prototype.redIMul=function(fo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,fo),this.red.imul(this,fo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(fo){return ro(this.red&&!fo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,fo)};var Ro={k256:null,p224:null,p192:null,p25519:null};function Oo(Po,fo){this.name=Po,this.p=new io(fo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Oo.prototype._tmp=function(){var fo=new io(null);return fo.words=new Array(Math.ceil(this.n/13)),fo},Oo.prototype.ireduce=function(fo){var yo=fo,vo;do this.split(yo,this.tmp),yo=this.imulK(yo),yo=yo.iadd(this.tmp),vo=yo.bitLength();while(vo>this.n);var _o=vo0?yo.isub(this.p):yo.strip!==void 0?yo.strip():yo._strip(),yo},Oo.prototype.split=function(fo,yo){fo.iushrn(this.n,0,yo)},Oo.prototype.imulK=function(fo){return fo.imul(this.k)};function jo(){Oo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(jo,Oo),jo.prototype.split=function(fo,yo){for(var vo=4194303,_o=Math.min(fo.length,9),So=0;So<_o;So++)yo.words[So]=fo.words[So];if(yo.length=_o,fo.length<=9){fo.words[0]=0,fo.length=1;return}var To=fo.words[9];for(yo.words[yo.length++]=To&vo,So=10;So>>22,To=Ao}To>>>=22,fo.words[So-10]=To,To===0&&fo.length>10?fo.length-=10:fo.length-=9},jo.prototype.imulK=function(fo){fo.words[fo.length]=0,fo.words[fo.length+1]=0,fo.length+=2;for(var yo=0,vo=0;vo>>=26,fo.words[vo]=So,yo=_o}return yo!==0&&(fo.words[fo.length++]=yo),fo},io._prime=function(fo){if(Ro[fo])return Ro[fo];var yo;if(fo==="k256")yo=new jo;else if(fo==="p224")yo=new Bo;else if(fo==="p192")yo=new Mo;else if(fo==="p25519")yo=new Fo;else throw new Error("Unknown prime "+fo);return Ro[fo]=yo,yo};function Wo(Po){if(typeof Po=="string"){var fo=io._prime(Po);this.m=fo.p,this.prime=fo}else ro(Po.gtn(1),"modulus must be greater than 1"),this.m=Po,this.prime=null}Wo.prototype._verify1=function(fo){ro(fo.negative===0,"red works only with positives"),ro(fo.red,"red works only with red numbers")},Wo.prototype._verify2=function(fo,yo){ro((fo.negative|yo.negative)===0,"red works only with positives"),ro(fo.red&&fo.red===yo.red,"red works only with red numbers")},Wo.prototype.imod=function(fo){return this.prime?this.prime.ireduce(fo)._forceRed(this):fo.umod(this.m)._forceRed(this)},Wo.prototype.neg=function(fo){return fo.isZero()?fo.clone():this.m.sub(fo)._forceRed(this)},Wo.prototype.add=function(fo,yo){this._verify2(fo,yo);var vo=fo.add(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo._forceRed(this)},Wo.prototype.iadd=function(fo,yo){this._verify2(fo,yo);var vo=fo.iadd(yo);return vo.cmp(this.m)>=0&&vo.isub(this.m),vo},Wo.prototype.sub=function(fo,yo){this._verify2(fo,yo);var vo=fo.sub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo._forceRed(this)},Wo.prototype.isub=function(fo,yo){this._verify2(fo,yo);var vo=fo.isub(yo);return vo.cmpn(0)<0&&vo.iadd(this.m),vo},Wo.prototype.shl=function(fo,yo){return this._verify1(fo),this.imod(fo.ushln(yo))},Wo.prototype.imul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.imul(yo))},Wo.prototype.mul=function(fo,yo){return this._verify2(fo,yo),this.imod(fo.mul(yo))},Wo.prototype.isqr=function(fo){return this.imul(fo,fo.clone())},Wo.prototype.sqr=function(fo){return this.mul(fo,fo)},Wo.prototype.sqrt=function(fo){if(fo.isZero())return fo.clone();var yo=this.m.andln(3);if(ro(yo%2===1),yo===3){var vo=this.m.add(new io(1)).iushrn(2);return this.pow(fo,vo)}for(var _o=this.m.subn(1),So=0;!_o.isZero()&&_o.andln(1)===0;)So++,_o.iushrn(1);ro(!_o.isZero());var To=new io(1).toRed(this),Ao=To.redNeg(),ko=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,ko).cmp(Ao)!==0;)mo.redIAdd(Ao);for(var Io=this.pow(mo,_o),Do=this.pow(fo,_o.addn(1).iushrn(1)),Lo=this.pow(fo,_o),Ho=So;Lo.cmp(To)!==0;){for(var Yo=Lo,Xo=0;Yo.cmp(To)!==0;Xo++)Yo=Yo.redSqr();ro(Xo=0;So--){for(var Io=yo.words[So],Do=mo-1;Do>=0;Do--){var Lo=Io>>Do&1;if(To!==_o[0]&&(To=this.sqr(To)),Lo===0&&Ao===0){ko=0;continue}Ao<<=1,Ao|=Lo,ko++,!(ko!==vo&&(So!==0||Do!==0))&&(To=this.mul(To,_o[Ao]),ko=0,Ao=0)}mo=26}return To},Wo.prototype.convertTo=function(fo){var yo=fo.umod(this.m);return yo===fo?yo.clone():yo},Wo.prototype.convertFrom=function(fo){var yo=fo.clone();return yo.red=null,yo},io.mont=function(fo){return new Jo(fo)};function Jo(Po){Wo.call(this,Po),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Jo,Wo),Jo.prototype.convertTo=function(fo){return this.imod(fo.ushln(this.shift))},Jo.prototype.convertFrom=function(fo){var yo=this.imod(fo.mul(this.rinv));return yo.red=null,yo},Jo.prototype.imul=function(fo,yo){if(fo.isZero()||yo.isZero())return fo.words[0]=0,fo.length=1,fo;var vo=fo.imul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.mul=function(fo,yo){if(fo.isZero()||yo.isZero())return new io(0)._forceRed(this);var vo=fo.mul(yo),_o=vo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),So=vo.isub(_o).iushrn(this.shift),To=So;return So.cmp(this.m)>=0?To=So.isub(this.m):So.cmpn(0)<0&&(To=So.iadd(this.m)),To._forceRed(this)},Jo.prototype.invm=function(fo){var yo=this.imod(fo._invmp(this.m).mul(this.r2));return yo._forceRed(this)}})(Xr,commonjsGlobal)}(bn$1)),bn$1.exports}var withPublic_1,hasRequiredWithPublic;function requireWithPublic(){if(hasRequiredWithPublic)return withPublic_1;hasRequiredWithPublic=1;var Xr=requireBn(),eo=safeBufferExports.Buffer;function to(ro,no){return eo.from(ro.toRed(Xr.mont(no.modulus)).redPow(new Xr(no.publicExponent)).fromRed().toArray())}return withPublic_1=to,withPublic_1}var publicEncrypt,hasRequiredPublicEncrypt;function requirePublicEncrypt(){if(hasRequiredPublicEncrypt)return publicEncrypt;hasRequiredPublicEncrypt=1;var Xr=requireParseAsn1(),eo=requireBrowser$b(),to=requireBrowser$9(),ro=requireMgf(),no=requireXor(),io=requireBn(),oo=requireWithPublic(),ao=requireBrowserifyRsa(),so=safeBufferExports.Buffer;publicEncrypt=function(go,bo,wo){var Eo;go.padding?Eo=go.padding:wo?Eo=1:Eo=4;var $o=Xr(go),Co;if(Eo===4)Co=co($o,bo);else if(Eo===1)Co=lo($o,bo,wo);else if(Eo===3){if(Co=new io(bo),Co.cmp($o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return wo?ao(Co,$o):oo(Co,$o)};function co(ho,go){var bo=ho.modulus.byteLength(),wo=go.length,Eo=to("sha1").update(so.alloc(0)).digest(),$o=Eo.length,Co=2*$o;if(wo>bo-Co-2)throw new Error("message too long");var Ro=so.alloc(bo-wo-Co-2),Oo=bo-$o-1,jo=eo($o),Bo=no(so.concat([Eo,Ro,so.alloc(1,1),go],Oo),ro(jo,Oo)),Mo=no(jo,ro(Bo,$o));return new io(so.concat([so.alloc(1),Mo,Bo],bo))}function lo(ho,go,bo){var wo=go.length,Eo=ho.modulus.byteLength();if(wo>Eo-11)throw new Error("message too long");var $o;return bo?$o=so.alloc(Eo-wo-3,255):$o=uo(Eo-wo-3),new io(so.concat([so.from([0,bo?1:2]),$o,so.alloc(1),go],Eo))}function uo(ho){for(var go=so.allocUnsafe(ho),bo=0,wo=eo(ho*2),Eo=0,$o;bo$o||new ro(go).cmp(Eo.modulus)>=0)throw new Error("decryption error");var Co;bo?Co=oo(new ro(go),Eo):Co=no(go,Eo);var Ro=ao.alloc($o-Co.length);if(Co=ao.concat([Ro,Co],$o),wo===4)return so(Eo,Co);if(wo===1)return co(Eo,Co,bo);if(wo===3)return Co;throw new Error("unknown padding")};function so(uo,ho){var go=uo.modulus.byteLength(),bo=io("sha1").update(ao.alloc(0)).digest(),wo=bo.length;if(ho[0]!==0)throw new Error("decryption error");var Eo=ho.slice(1,wo+1),$o=ho.slice(wo+1),Co=to(Eo,eo($o,wo)),Ro=to($o,eo(Co,go-wo-1));if(lo(bo,Ro.slice(0,wo)))throw new Error("decryption error");for(var Oo=wo;Ro[Oo]===0;)Oo++;if(Ro[Oo++]!==1)throw new Error("decryption error");return Ro.slice(Oo)}function co(uo,ho,go){for(var bo=ho.slice(0,2),wo=2,Eo=0;ho[wo++]!==0;)if(wo>=ho.length){Eo++;break}var $o=ho.slice(2,wo-1);if((bo.toString("hex")!=="0002"&&!go||bo.toString("hex")!=="0001"&&go)&&Eo++,$o.length<8&&Eo++,Eo)throw new Error("decryption error");return ho.slice(wo)}function lo(uo,ho){uo=ao.from(uo),ho=ao.from(ho);var go=0,bo=uo.length;uo.length!==ho.length&&(go++,bo=Math.min(uo.length,ho.length));for(var wo=-1;++wooo||ho<0)throw new TypeError("offset must be a uint32");if(ho>no||ho>go)throw new RangeError("offset out of range")}function so(ho,go,bo){if(typeof ho!="number"||ho!==ho)throw new TypeError("size must be a number");if(ho>oo||ho<0)throw new TypeError("size must be a uint32");if(ho+go>bo||ho>no)throw new RangeError("buffer too small")}io&&io.getRandomValues||!process$1$1.browser?(browser$5.randomFill=co,browser$5.randomFillSync=uo):(browser$5.randomFill=Xr,browser$5.randomFillSync=Xr);function co(ho,go,bo,wo){if(!ro.isBuffer(ho)&&!(ho instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof go=="function")wo=go,go=0,bo=ho.length;else if(typeof bo=="function")wo=bo,bo=ho.length-go;else if(typeof wo!="function")throw new TypeError('"cb" argument must be a function');return ao(go,ho.length),so(bo,go,ho.length),lo(ho,go,bo,wo)}function lo(ho,go,bo,wo){if(process$1$1.browser){var Eo=ho.buffer,$o=new Uint8Array(Eo,go,bo);if(io.getRandomValues($o),wo){process$1$1.nextTick(function(){wo(null,ho)});return}return ho}if(wo){to(bo,function(Ro,Oo){if(Ro)return wo(Ro);Oo.copy(ho,go),wo(null,ho)});return}var Co=to(bo);return Co.copy(ho,go),ho}function uo(ho,go,bo){if(typeof go>"u"&&(go=0),!ro.isBuffer(ho)&&!(ho instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return ao(go,ho.length),bo===void 0&&(bo=ho.length-go),so(bo,go,ho.length),lo(ho,go,bo)}return browser$5}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$b(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var Xr=requireAlgos(),eo=Object.keys(Xr),to=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(eo);cryptoBrowserify.getHashes=function(){return to};var ro=requireBrowser$7();cryptoBrowserify.pbkdf2=ro.pbkdf2,cryptoBrowserify.pbkdf2Sync=ro.pbkdf2Sync;var no=requireBrowser$5();cryptoBrowserify.Cipher=no.Cipher,cryptoBrowserify.createCipher=no.createCipher,cryptoBrowserify.Cipheriv=no.Cipheriv,cryptoBrowserify.createCipheriv=no.createCipheriv,cryptoBrowserify.Decipher=no.Decipher,cryptoBrowserify.createDecipher=no.createDecipher,cryptoBrowserify.Decipheriv=no.Decipheriv,cryptoBrowserify.createDecipheriv=no.createDecipheriv,cryptoBrowserify.getCiphers=no.getCiphers,cryptoBrowserify.listCiphers=no.listCiphers;var io=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=io.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=io.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=io.getDiffieHellman,cryptoBrowserify.createDiffieHellman=io.createDiffieHellman,cryptoBrowserify.DiffieHellman=io.DiffieHellman;var oo=requireBrowser$3();cryptoBrowserify.createSign=oo.createSign,cryptoBrowserify.Sign=oo.Sign,cryptoBrowserify.createVerify=oo.createVerify,cryptoBrowserify.Verify=oo.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var ao=requireBrowser$1();cryptoBrowserify.publicEncrypt=ao.publicEncrypt,cryptoBrowserify.privateEncrypt=ao.privateEncrypt,cryptoBrowserify.publicDecrypt=ao.publicDecrypt,cryptoBrowserify.privateDecrypt=ao.privateDecrypt;var so=requireBrowser();return cryptoBrowserify.randomFill=so.randomFill,cryptoBrowserify.randomFillSync=so.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet we accept pull requests -https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}(function(Xr){/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.utils=Xr.schnorr=Xr.verify=Xr.signSync=Xr.sign=Xr.getSharedSecret=Xr.recoverPublicKey=Xr.getPublicKey=Xr.Signature=Xr.Point=Xr.CURVE=void 0;const eo=requireCryptoBrowserify(),to=BigInt(0),ro=BigInt(1),no=BigInt(2),io=BigInt(3),oo=BigInt(8),ao=Object.freeze({a:to,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:ro,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});Xr.CURVE=ao;const so=(Il,Nl)=>(Il+Nl/no)/Nl,co={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(Il){const{n:Nl}=ao,Pl=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),Bl=-ro*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),fu=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),eu=Pl,Xl=BigInt("0x100000000000000000000000000000000"),$u=so(eu*Il,Nl),Yo=so(-Bl*Il,Nl);let _l=To(Il-$u*Pl-Yo*fu,Nl),Sl=To(-$u*Bl-Yo*eu,Nl);const Wo=_l>Xl,xl=Sl>Xl;if(Wo&&(_l=Nl-_l),xl&&(Sl=Nl-Sl),_l>Xl||Sl>Xl)throw new Error("splitScalarEndo: Endomorphism failed, k="+Il);return{k1neg:Wo,k1:_l,k2neg:xl,k2:Sl}}},lo=32,fo=32,ho=32,go=lo+1,yo=2*lo+1;function vo(Il){const{a:Nl,b:Pl}=ao,Bl=To(Il*Il),fu=To(Bl*Il);return To(fu+Nl*Il+Pl)}const wo=ao.a===to;class Eo extends Error{constructor(Nl){super(Nl)}}function ko(Il){if(!(Il instanceof Ao))throw new TypeError("JacobianPoint expected")}class Ao{constructor(Nl,Pl,Bl){this.x=Nl,this.y=Pl,this.z=Bl}static fromAffine(Nl){if(!(Nl instanceof Mo))throw new TypeError("JacobianPoint#fromAffine: expected Point");return Nl.equals(Mo.ZERO)?Ao.ZERO:new Ao(Nl.x,Nl.y,ro)}static toAffineBatch(Nl){const Pl=qo(Nl.map(Bl=>Bl.z));return Nl.map((Bl,fu)=>Bl.toAffine(Pl[fu]))}static normalizeZ(Nl){return Ao.toAffineBatch(Nl).map(Ao.fromAffine)}equals(Nl){ko(Nl);const{x:Pl,y:Bl,z:fu}=this,{x:eu,y:Xl,z:$u}=Nl,Yo=To(fu*fu),_l=To($u*$u),Sl=To(Pl*_l),Wo=To(eu*Yo),xl=To(To(Bl*$u)*_l),Ql=To(To(Xl*fu)*Yo);return Sl===Wo&&xl===Ql}negate(){return new Ao(this.x,To(-this.y),this.z)}double(){const{x:Nl,y:Pl,z:Bl}=this,fu=To(Nl*Nl),eu=To(Pl*Pl),Xl=To(eu*eu),$u=Nl+eu,Yo=To(no*(To($u*$u)-fu-Xl)),_l=To(io*fu),Sl=To(_l*_l),Wo=To(Sl-no*Yo),xl=To(_l*(Yo-Wo)-oo*Xl),Ql=To(no*Pl*Bl);return new Ao(Wo,xl,Ql)}add(Nl){ko(Nl);const{x:Pl,y:Bl,z:fu}=this,{x:eu,y:Xl,z:$u}=Nl;if(eu===to||Xl===to)return this;if(Pl===to||Bl===to)return Nl;const Yo=To(fu*fu),_l=To($u*$u),Sl=To(Pl*_l),Wo=To(eu*Yo),xl=To(To(Bl*$u)*_l),Ql=To(To(Xl*fu)*Yo),Fl=To(Wo-Sl),Jl=To(Ql-xl);if(Fl===to)return Jl===to?this.double():Ao.ZERO;const xu=To(Fl*Fl),lu=To(Fl*xu),su=To(Sl*xu),Xu=To(Jl*Jl-lu-no*su),ju=To(Jl*(su-Xu)-xl*lu),zu=To(fu*$u*Fl);return new Ao(Xu,ju,zu)}subtract(Nl){return this.add(Nl.negate())}multiplyUnsafe(Nl){const Pl=Ao.ZERO;if(typeof Nl=="bigint"&&Nl===to)return Pl;let Bl=mo(Nl);if(Bl===ro)return this;if(!wo){let Wo=Pl,xl=this;for(;Bl>to;)Bl&ro&&(Wo=Wo.add(xl)),xl=xl.double(),Bl>>=ro;return Wo}let{k1neg:fu,k1:eu,k2neg:Xl,k2:$u}=co.splitScalar(Bl),Yo=Pl,_l=Pl,Sl=this;for(;eu>to||$u>to;)eu&ro&&(Yo=Yo.add(Sl)),$u&ro&&(_l=_l.add(Sl)),Sl=Sl.double(),eu>>=ro,$u>>=ro;return fu&&(Yo=Yo.negate()),Xl&&(_l=_l.negate()),_l=new Ao(To(_l.x*co.beta),_l.y,_l.z),Yo.add(_l)}precomputeWindow(Nl){const Pl=wo?128/Nl+1:256/Nl+1,Bl=[];let fu=this,eu=fu;for(let Xl=0;Xl>=Wo,Fl>Yo&&(Fl-=Sl,Nl+=ro);const Jl=Ql,xu=Ql+Math.abs(Fl)-1,lu=xl%2!==0,su=Fl<0;Fl===0?Xl=Xl.add(Po(lu,fu[Jl])):eu=eu.add(Po(su,fu[xu]))}return{p:eu,f:Xl}}multiply(Nl,Pl){let Bl=mo(Nl),fu,eu;if(wo){const{k1neg:Xl,k1:$u,k2neg:Yo,k2:_l}=co.splitScalar(Bl);let{p:Sl,f:Wo}=this.wNAF($u,Pl),{p:xl,f:Ql}=this.wNAF(_l,Pl);Sl=Po(Xl,Sl),xl=Po(Yo,xl),xl=new Ao(To(xl.x*co.beta),xl.y,xl.z),fu=Sl.add(xl),eu=Wo.add(Ql)}else{const{p:Xl,f:$u}=this.wNAF(Bl,Pl);fu=Xl,eu=$u}return Ao.normalizeZ([fu,eu])[0]}toAffine(Nl){const{x:Pl,y:Bl,z:fu}=this,eu=this.equals(Ao.ZERO);Nl==null&&(Nl=eu?oo:Qo(fu));const Xl=Nl,$u=To(Xl*Xl),Yo=To($u*Xl),_l=To(Pl*$u),Sl=To(Bl*Yo),Wo=To(fu*Xl);if(eu)return Mo.ZERO;if(Wo!==ro)throw new Error("invZ was invalid");return new Mo(_l,Sl)}}Ao.BASE=new Ao(ao.Gx,ao.Gy,ro),Ao.ZERO=new Ao(to,ro,to);function Po(Il,Nl){const Pl=Nl.negate();return Il?Pl:Nl}const jo=new WeakMap;class Mo{constructor(Nl,Pl){this.x=Nl,this.y=Pl}_setWindowSize(Nl){this._WINDOW_SIZE=Nl,jo.delete(this)}hasEvenY(){return this.y%no===to}static fromCompressedHex(Nl){const Pl=Nl.length===32,Bl=Ro(Pl?Nl:Nl.subarray(1));if(!ga(Bl))throw new Error("Point is not on curve");const fu=vo(Bl);let eu=Zo(fu);const Xl=(eu&ro)===ro;Pl?Xl&&(eu=To(-eu)):(Nl[0]&1)===1!==Xl&&(eu=To(-eu));const $u=new Mo(Bl,eu);return $u.assertValidity(),$u}static fromUncompressedHex(Nl){const Pl=Ro(Nl.subarray(1,lo+1)),Bl=Ro(Nl.subarray(lo+1,lo*2+1)),fu=new Mo(Pl,Bl);return fu.assertValidity(),fu}static fromHex(Nl){const Pl=So(Nl),Bl=Pl.length,fu=Pl[0];if(Bl===lo)return this.fromCompressedHex(Pl);if(Bl===go&&(fu===2||fu===3))return this.fromCompressedHex(Pl);if(Bl===yo&&fu===4)return this.fromUncompressedHex(Pl);throw new Error(`Point.fromHex: received invalid point. Expected 32-${go} compressed bytes or ${yo} uncompressed bytes, not ${Bl}`)}static fromPrivateKey(Nl){return Mo.BASE.multiply(Al(Nl))}static fromSignature(Nl,Pl,Bl){const{r:fu,s:eu}=Wl(Pl);if(![0,1,2,3].includes(Bl))throw new Error("Cannot recover: invalid recovery bit");const Xl=$a(So(Nl)),{n:$u}=ao,Yo=Bl===2||Bl===3?fu+$u:fu,_l=Qo(Yo,$u),Sl=To(-Xl*_l,$u),Wo=To(eu*_l,$u),xl=Bl&1?"03":"02",Ql=Mo.fromHex(xl+po(Yo)),Fl=Mo.BASE.multiplyAndAddUnsafe(Ql,Sl,Wo);if(!Fl)throw new Error("Cannot recover signature: point at infinify");return Fl.assertValidity(),Fl}toRawBytes(Nl=!1){return Co(this.toHex(Nl))}toHex(Nl=!1){const Pl=po(this.x);return Nl?`${this.hasEvenY()?"02":"03"}${Pl}`:`04${Pl}${po(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const Nl="Point is not on elliptic curve",{x:Pl,y:Bl}=this;if(!ga(Pl)||!ga(Bl))throw new Error(Nl);const fu=To(Bl*Bl),eu=vo(Pl);if(To(fu-eu)!==to)throw new Error(Nl)}equals(Nl){return this.x===Nl.x&&this.y===Nl.y}negate(){return new Mo(this.x,To(-this.y))}double(){return Ao.fromAffine(this).double().toAffine()}add(Nl){return Ao.fromAffine(this).add(Ao.fromAffine(Nl)).toAffine()}subtract(Nl){return this.add(Nl.negate())}multiply(Nl){return Ao.fromAffine(this).multiply(Nl,this).toAffine()}multiplyAndAddUnsafe(Nl,Pl,Bl){const fu=Ao.fromAffine(this),eu=Pl===to||Pl===ro||this!==Mo.BASE?fu.multiplyUnsafe(Pl):fu.multiply(Pl),Xl=Ao.fromAffine(Nl).multiplyUnsafe(Bl),$u=eu.add(Xl);return $u.equals(Ao.ZERO)?void 0:$u.toAffine()}}Xr.Point=Mo,Mo.BASE=new Mo(ao.Gx,ao.Gy),Mo.ZERO=new Mo(to,to);function No(Il){return Number.parseInt(Il[0],16)>=8?"00"+Il:Il}function Do(Il){if(Il.length<2||Il[0]!==2)throw new Error(`Invalid signature integer tag: ${xo(Il)}`);const Nl=Il[1],Pl=Il.subarray(2,Nl+2);if(!Nl||Pl.length!==Nl)throw new Error("Invalid signature integer: wrong length");if(Pl[0]===0&&Pl[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ro(Pl),left:Il.subarray(Nl+2)}}function Fo(Il){if(Il.length<2||Il[0]!=48)throw new Error(`Invalid signature tag: ${xo(Il)}`);if(Il[1]!==Il.length-2)throw new Error("Invalid signature: incorrect length");const{data:Nl,left:Pl}=Do(Il.subarray(2)),{data:Bl,left:fu}=Do(Pl);if(fu.length)throw new Error(`Invalid signature: left bytes after parsing: ${xo(fu)}`);return{r:Nl,s:Bl}}class Xo{constructor(Nl,Pl){this.r=Nl,this.s=Pl,this.assertValidity()}static fromCompact(Nl){const Pl=Nl instanceof Uint8Array,Bl="Signature.fromCompact";if(typeof Nl!="string"&&!Pl)throw new TypeError(`${Bl}: Expected string or Uint8Array`);const fu=Pl?xo(Nl):Nl;if(fu.length!==128)throw new Error(`${Bl}: Expected 64-byte hex`);return new Xo($o(fu.slice(0,64)),$o(fu.slice(64,128)))}static fromDER(Nl){const Pl=Nl instanceof Uint8Array;if(typeof Nl!="string"&&!Pl)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:Bl,s:fu}=Fo(Pl?Nl:Co(Nl));return new Xo(Bl,fu)}static fromHex(Nl){return this.fromDER(Nl)}assertValidity(){const{r:Nl,s:Pl}=this;if(!Cl(Nl))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Cl(Pl))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const Nl=ao.n>>ro;return this.s>Nl}normalizeS(){return this.hasHighS()?new Xo(this.r,To(-this.s,ao.n)):this}toDERRawBytes(){return Co(this.toDERHex())}toDERHex(){const Nl=No(_o(this.s)),Pl=No(_o(this.r)),Bl=Nl.length/2,fu=Pl.length/2,eu=_o(Bl),Xl=_o(fu);return`30${_o(fu+Bl+4)}02${Xl}${Pl}02${eu}${Nl}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Co(this.toCompactHex())}toCompactHex(){return po(this.r)+po(this.s)}}Xr.Signature=Xo;function Lo(...Il){if(!Il.every(Bl=>Bl instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Il.length===1)return Il[0];const Nl=Il.reduce((Bl,fu)=>Bl+fu.length,0),Pl=new Uint8Array(Nl);for(let Bl=0,fu=0;BlNl.toString(16).padStart(2,"0"));function xo(Il){if(!(Il instanceof Uint8Array))throw new Error("Expected Uint8Array");let Nl="";for(let Pl=0;Pl0)return BigInt(Il);if(typeof Il=="bigint"&&Cl(Il))return Il;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function To(Il,Nl=ao.P){const Pl=Il%Nl;return Pl>=to?Pl:Nl+Pl}function Vo(Il,Nl){const{P:Pl}=ao;let Bl=Il;for(;Nl-- >to;)Bl*=Bl,Bl%=Pl;return Bl}function Zo(Il){const{P:Nl}=ao,Pl=BigInt(6),Bl=BigInt(11),fu=BigInt(22),eu=BigInt(23),Xl=BigInt(44),$u=BigInt(88),Yo=Il*Il*Il%Nl,_l=Yo*Yo*Il%Nl,Sl=Vo(_l,io)*_l%Nl,Wo=Vo(Sl,io)*_l%Nl,xl=Vo(Wo,no)*Yo%Nl,Ql=Vo(xl,Bl)*xl%Nl,Fl=Vo(Ql,fu)*Ql%Nl,Jl=Vo(Fl,Xl)*Fl%Nl,xu=Vo(Jl,$u)*Jl%Nl,lu=Vo(xu,Xl)*Fl%Nl,su=Vo(lu,io)*_l%Nl,Xu=Vo(su,eu)*Ql%Nl,ju=Vo(Xu,Pl)*Yo%Nl,zu=Vo(ju,no);if(zu*zu%Nl!==Il)throw new Error("Cannot find square root");return zu}function Qo(Il,Nl=ao.P){if(Il===to||Nl<=to)throw new Error(`invert: expected positive integers, got n=${Il} mod=${Nl}`);let Pl=To(Il,Nl),Bl=Nl,fu=to,eu=ro;for(;Pl!==to;){const $u=Bl/Pl,Yo=Bl%Pl,_l=fu-eu*$u;Bl=Pl,Pl=Yo,fu=eu,eu=_l}if(Bl!==ro)throw new Error("invert: does not exist");return To(fu,Nl)}function qo(Il,Nl=ao.P){const Pl=new Array(Il.length),Bl=Il.reduce((eu,Xl,$u)=>Xl===to?eu:(Pl[$u]=eu,To(eu*Xl,Nl)),ro),fu=Qo(Bl,Nl);return Il.reduceRight((eu,Xl,$u)=>Xl===to?eu:(Pl[$u]=To(eu*Pl[$u],Nl),To(eu*Xl,Nl)),fu),Pl}function Ho(Il){const Nl=Il.length*8-fo*8,Pl=Ro(Il);return Nl>0?Pl>>BigInt(Nl):Pl}function $a(Il,Nl=!1){const Pl=Ho(Il);if(Nl)return Pl;const{n:Bl}=ao;return Pl>=Bl?Pl-Bl:Pl}let zo,Ko;class _c{constructor(Nl,Pl){if(this.hashLen=Nl,this.qByteLen=Pl,typeof Nl!="number"||Nl<2)throw new Error("hashLen must be a number");if(typeof Pl!="number"||Pl<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(Nl).fill(1),this.k=new Uint8Array(Nl).fill(0),this.counter=0}hmac(...Nl){return Xr.utils.hmacSha256(this.k,...Nl)}hmacSync(...Nl){return Ko(this.k,...Nl)}checkSync(){if(typeof Ko!="function")throw new Eo("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(Nl=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),Nl),this.v=await this.hmac(this.v),Nl.length!==0&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),Nl),this.v=await this.hmac(this.v))}reseedSync(Nl=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),Nl),this.v=this.hmacSync(this.v),Nl.length!==0&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),Nl),this.v=this.hmacSync(this.v))}async generate(){this.incr();let Nl=0;const Pl=[];for(;Nl0)Nl=BigInt(Il);else if(typeof Il=="string"){if(Il.length!==2*fo)throw new Error("Expected 32 bytes of private key");Nl=$o(Il)}else if(Il instanceof Uint8Array){if(Il.length!==fo)throw new Error("Expected 32 bytes of private key");Nl=Ro(Il)}else throw new TypeError("Expected valid private key");if(!Cl(Nl))throw new Error("Expected private key: 0 < key < n");return Nl}function Ol(Il){return Il instanceof Mo?(Il.assertValidity(),Il):Mo.fromHex(Il)}function Wl(Il){if(Il instanceof Xo)return Il.assertValidity(),Il;try{return Xo.fromDER(Il)}catch{return Xo.fromCompact(Il)}}function zl(Il,Nl=!1){return Mo.fromPrivateKey(Il).toRawBytes(Nl)}Xr.getPublicKey=zl;function Tl(Il,Nl,Pl,Bl=!1){return Mo.fromSignature(Il,Nl,Pl).toRawBytes(Bl)}Xr.recoverPublicKey=Tl;function Ml(Il){const Nl=Il instanceof Uint8Array,Pl=typeof Il=="string",Bl=(Nl||Pl)&&Il.length;return Nl?Bl===go||Bl===yo:Pl?Bl===go*2||Bl===yo*2:Il instanceof Mo}function ou(Il,Nl,Pl=!1){if(Ml(Il))throw new TypeError("getSharedSecret: first arg must be private key");if(!Ml(Nl))throw new TypeError("getSharedSecret: second arg must be public key");const Bl=Ol(Nl);return Bl.assertValidity(),Bl.multiply(Al(Il)).toRawBytes(Pl)}Xr.getSharedSecret=ou;function Vl(Il){const Nl=Il.length>lo?Il.slice(0,lo):Il;return Ro(Nl)}function Ll(Il){const Nl=Vl(Il),Pl=To(Nl,ao.n);return uu(Pl{Il=So(Il);const Nl=fo+8;if(Il.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");const Pl=To(Ro(Il),ao.n-ro)+ro;return bo(Pl)},randomBytes:(Il=32)=>{if(yu.web)return yu.web.getRandomValues(new Uint8Array(Il));if(yu.node){const{randomBytes:Nl}=yu.node;return Uint8Array.from(Nl(Il))}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Xr.utils.hashToPrivateKey(Xr.utils.randomBytes(fo+8)),precompute(Il=8,Nl=Mo.BASE){const Pl=Nl===Mo.BASE?Nl:new Mo(Nl.x,Nl.y);return Pl._setWindowSize(Il),Pl.multiply(io),Pl},sha256:async(...Il)=>{if(yu.web){const Nl=await yu.web.subtle.digest("SHA-256",Lo(...Il));return new Uint8Array(Nl)}else if(yu.node){const{createHash:Nl}=yu.node,Pl=Nl("sha256");return Il.forEach(Bl=>Pl.update(Bl)),Uint8Array.from(Pl.digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(Il,...Nl)=>{if(yu.web){const Pl=await yu.web.subtle.importKey("raw",Il,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),Bl=Lo(...Nl),fu=await yu.web.subtle.sign("HMAC",Pl,Bl);return new Uint8Array(fu)}else if(yu.node){const{createHmac:Pl}=yu.node,Bl=Pl("sha256",Il);return Nl.forEach(fu=>Bl.update(fu)),Uint8Array.from(Bl.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(Il,...Nl)=>{let Pl=_u[Il];if(Pl===void 0){const Bl=await Xr.utils.sha256(Uint8Array.from(Il,fu=>fu.charCodeAt(0)));Pl=Lo(Bl,Bl),_u[Il]=Pl}return Xr.utils.sha256(Pl,...Nl)},taggedHashSync:(Il,...Nl)=>{if(typeof zo!="function")throw new Eo("sha256Sync is undefined, you need to set it");let Pl=_u[Il];if(Pl===void 0){const Bl=zo(Uint8Array.from(Il,fu=>fu.charCodeAt(0)));Pl=Lo(Bl,Bl),_u[Il]=Pl}return zo(Pl,...Nl)},_JacobianPoint:Ao},Object.defineProperties(Xr.utils,{sha256Sync:{configurable:!1,get(){return zo},set(Il){zo||(zo=Il)}},hmacSha256Sync:{configurable:!1,get(){return Ko},set(Il){Ko||(Ko=Il)}}})})(lib$1);var ecdsaSigFormatter={};Object.defineProperty(ecdsaSigFormatter,"__esModule",{value:!0});ecdsaSigFormatter.joseToDer=ecdsaSigFormatter.derToJose=void 0;const base64_js_1=base64Js,base64Url_1=base64Url;function getParamSize(Xr){return(Xr/8|0)+(Xr%8===0?0:1)}const paramBytesForAlg={ES256:getParamSize(256),ES384:getParamSize(384),ES512:getParamSize(521)};function getParamBytesForAlg(Xr){const eo=paramBytesForAlg[Xr];if(eo)return eo;throw new Error(`Unknown algorithm "${Xr}"`)}const MAX_OCTET=128,CLASS_UNIVERSAL=0,PRIMITIVE_BIT=32,TAG_SEQ=16,TAG_INT=2,ENCODED_TAG_SEQ=TAG_SEQ|PRIMITIVE_BIT|CLASS_UNIVERSAL<<6,ENCODED_TAG_INT=TAG_INT|CLASS_UNIVERSAL<<6;function signatureAsBytes(Xr){if(Xr instanceof Uint8Array)return Xr;if(typeof Xr=="string")return(0,base64_js_1.toByteArray)((0,base64Url_1.pad)(Xr));throw new TypeError("ECDSA signature must be a Base64 string or a Uint8Array")}function derToJose(Xr,eo){const to=signatureAsBytes(Xr),ro=getParamBytesForAlg(eo),no=ro+1,io=to.length;let oo=0;if(to[oo++]!==ENCODED_TAG_SEQ)throw new Error('Could not find expected "seq"');let ao=to[oo++];if(ao===(MAX_OCTET|1)&&(ao=to[oo++]),io-oo=MAX_OCTET&&--ro,ro}function joseToDer(Xr,eo){Xr=signatureAsBytes(Xr);const to=getParamBytesForAlg(eo),ro=Xr.length;if(ro!==to*2)throw new TypeError(`"${eo}" signatures must be "${to*2}" bytes, saw "${ro}"`);const no=countPadding(Xr,0,to),io=countPadding(Xr,to,Xr.length),oo=to-no,ao=to-io,so=2+oo+1+1+ao,co=so{const to=hmac_1$1.hmac.create(sha256_1$3.sha256,Xr);return eo.forEach(ro=>to.update(ro)),to.digest()};class SECP256K1Client{static derivePublicKey(eo,to=!0){return eo.length===66&&(eo=eo.slice(0,64)),eo.length<64&&(eo=eo.padStart(64,"0")),(0,utils_1$4.bytesToHex)(secp.getPublicKey(eo,to))}static signHash(eo,to,ro="jose"){if(!eo||!to)throw new errors_1$2.MissingParametersError("a signing input hash and private key are all required");const no=secp.signSync(eo,to.slice(0,64),{der:!0,canonical:!1});if(ro==="der")return(0,utils_1$4.bytesToHex)(no);if(ro==="jose")return(0,ecdsaSigFormatter_1.derToJose)(no,"ES256");throw Error("Invalid signature format")}static loadSignature(eo){return(0,ecdsaSigFormatter_1.joseToDer)(eo,"ES256")}static verifyHash(eo,to,ro){if(!eo||!to||!ro)throw new errors_1$2.MissingParametersError("a signing input hash, der signature, and public key are all required");return secp.verify(to,eo,ro,{strict:!1})}}secp256k1$1.SECP256K1Client=SECP256K1Client;SECP256K1Client.algorithmName="ES256K";(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.cryptoClients=Xr.SECP256K1Client=void 0;const eo=secp256k1$1;Object.defineProperty(Xr,"SECP256K1Client",{enumerable:!0,get:function(){return eo.SECP256K1Client}});const to={ES256K:eo.SECP256K1Client};Xr.cryptoClients=to})(cryptoClients);var sha256$3={},__awaiter$h=commonjsGlobal&&commonjsGlobal.__awaiter||function(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})};Object.defineProperty(sha256$3,"__esModule",{value:!0});sha256$3.hashSha256Async=sha256$3.hashSha256=void 0;const sha256_1$2=sha256$7;function hashSha256(Xr){return(0,sha256_1$2.sha256)(Xr)}sha256$3.hashSha256=hashSha256;function hashSha256Async(Xr){return __awaiter$h(this,void 0,void 0,function*(){try{if(typeof crypto<"u"&&typeof crypto.subtle<"u"){const to=typeof Xr=="string"?new TextEncoder().encode(Xr):Xr,ro=yield crypto.subtle.digest("SHA-256",to);return new Uint8Array(ro)}else{const to=requireCryptoBrowserify();if(!to.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(to.createHash("sha256").update(Xr).digest())}}catch(eo){return console.log(eo),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(hashSha256(Xr))}})}sha256$3.hashSha256Async=hashSha256Async;var __awaiter$g=commonjsGlobal&&commonjsGlobal.__awaiter||function(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})};Object.defineProperty(signer,"__esModule",{value:!0});signer.TokenSigner=signer.createUnsecuredToken=void 0;const base64url$3=base64Url,cryptoClients_1$1=cryptoClients,errors_1$1=errors$3,sha256_1$1=sha256$3;function createSigningInput(Xr,eo){const to=[],ro=base64url$3.encode(JSON.stringify(eo));to.push(ro);const no=base64url$3.encode(JSON.stringify(Xr));return to.push(no),to.join(".")}function createUnsecuredToken(Xr){return createSigningInput(Xr,{typ:"JWT",alg:"none"})+"."}signer.createUnsecuredToken=createUnsecuredToken;class TokenSigner{constructor(eo,to){if(!(eo&&to))throw new errors_1$1.MissingParametersError("a signing algorithm and private key are required");if(typeof eo!="string")throw new Error("signing algorithm parameter must be a string");if(eo=eo.toUpperCase(),!cryptoClients_1$1.cryptoClients.hasOwnProperty(eo))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=cryptoClients_1$1.cryptoClients[eo],this.rawPrivateKey=to}header(eo={}){const to={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},to,eo)}sign(eo,to=!1,ro={}){const no=this.header(ro),io=createSigningInput(eo,no),oo=(0,sha256_1$1.hashSha256)(io);return this.createWithSignedHash(eo,to,no,io,oo)}signAsync(eo,to=!1,ro={}){return __awaiter$g(this,void 0,void 0,function*(){const no=this.header(ro),io=createSigningInput(eo,no),oo=yield(0,sha256_1$1.hashSha256Async)(io);return this.createWithSignedHash(eo,to,no,io,oo)})}createWithSignedHash(eo,to,ro,no,io){const oo=this.cryptoClient.signHash(io,this.rawPrivateKey);return to?{header:[base64url$3.encode(JSON.stringify(ro))],payload:JSON.stringify(eo),signature:[oo]}:[no,oo].join(".")}}signer.TokenSigner=TokenSigner;var verifier={};Object.defineProperty(verifier,"__esModule",{value:!0});verifier.TokenVerifier=void 0;const base64url$2=base64Url,cryptoClients_1=cryptoClients,errors_1=errors$3,sha256_1=sha256$3;class TokenVerifier{constructor(eo,to){if(!(eo&&to))throw new errors_1.MissingParametersError("a signing algorithm and public key are required");if(typeof eo!="string")throw"signing algorithm parameter must be a string";if(eo=eo.toUpperCase(),!cryptoClients_1.cryptoClients.hasOwnProperty(eo))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=cryptoClients_1.cryptoClients[eo],this.rawPublicKey=to}verify(eo){return typeof eo=="string"?this.verifyCompact(eo,!1):typeof eo=="object"?this.verifyExpanded(eo,!1):!1}verifyAsync(eo){return typeof eo=="string"?this.verifyCompact(eo,!0):typeof eo=="object"?this.verifyExpanded(eo,!0):Promise.resolve(!1)}verifyCompact(eo,to){const ro=eo.split("."),no=ro[0]+"."+ro[1],io=oo=>{const ao=this.cryptoClient.loadSignature(ro[2]);return this.cryptoClient.verifyHash(oo,ao,this.rawPublicKey)};if(to)return(0,sha256_1.hashSha256Async)(no).then(oo=>io(oo));{const oo=(0,sha256_1.hashSha256)(no);return io(oo)}}verifyExpanded(eo,to){const ro=[eo.header.join("."),base64url$2.encode(eo.payload)].join(".");let no=!0;const io=oo=>(eo.signature.map(ao=>{const so=this.cryptoClient.loadSignature(ao);this.cryptoClient.verifyHash(oo,so,this.rawPublicKey)||(no=!1)}),no);if(to)return(0,sha256_1.hashSha256Async)(ro).then(oo=>io(oo));{const oo=(0,sha256_1.hashSha256)(ro);return io(oo)}}}verifier.TokenVerifier=TokenVerifier;var decode$p={};Object.defineProperty(decode$p,"__esModule",{value:!0});decode$p.decodeToken=void 0;const base64url$1=base64Url;function decodeToken(Xr){if(typeof Xr=="string"){const eo=Xr.split("."),to=JSON.parse(base64url$1.decode(eo[0])),ro=JSON.parse(base64url$1.decode(eo[1])),no=eo[2];return{header:to,payload:ro,signature:no}}else if(typeof Xr=="object"){if(typeof Xr.payload!="string")throw new Error("Expected token payload to be a base64 or json string");let eo=Xr.payload;Xr.payload[0]!=="{"&&(eo=base64url$1.decode(eo));const to=[];return Xr.header.map(ro=>{const no=JSON.parse(base64url$1.decode(ro));to.push(no)}),{header:to,payload:JSON.parse(eo),signature:Xr.signature}}}decode$p.decodeToken=decodeToken;(function(Xr){var eo=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(ro,no,io,oo){oo===void 0&&(oo=io);var ao=Object.getOwnPropertyDescriptor(no,io);(!ao||("get"in ao?!no.__esModule:ao.writable||ao.configurable))&&(ao={enumerable:!0,get:function(){return no[io]}}),Object.defineProperty(ro,oo,ao)}:function(ro,no,io,oo){oo===void 0&&(oo=io),ro[oo]=no[io]}),to=commonjsGlobal&&commonjsGlobal.__exportStar||function(ro,no){for(var io in ro)io!=="default"&&!Object.prototype.hasOwnProperty.call(no,io)&&eo(no,ro,io)};Object.defineProperty(Xr,"__esModule",{value:!0}),to(signer,Xr),to(verifier,Xr),to(decode$p,Xr),to(errors$3,Xr),to(cryptoClients,Xr)})(lib$2);/*! ***************************************************************************** +https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}(function(Xr){/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.utils=Xr.schnorr=Xr.verify=Xr.signSync=Xr.sign=Xr.getSharedSecret=Xr.recoverPublicKey=Xr.getPublicKey=Xr.Signature=Xr.Point=Xr.CURVE=void 0;const eo=requireCryptoBrowserify(),to=BigInt(0),ro=BigInt(1),no=BigInt(2),io=BigInt(3),oo=BigInt(8),ao=Object.freeze({a:to,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:ro,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});Xr.CURVE=ao;const so=(Ml,Nl)=>(Ml+Nl/no)/Nl,co={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(Ml){const{n:Nl}=ao,Yl=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),Wl=-ro*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),eu=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),Su=Yl,ru=BigInt("0x100000000000000000000000000000000"),uu=so(Su*Ml,Nl),xl=so(-Wl*Ml,Nl);let $l=Lo(Ml-uu*Yl-xl*eu,Nl),Cl=Lo(-uu*Wl-xl*Su,Nl);const Zo=$l>ru,Rl=Cl>ru;if(Zo&&($l=Nl-$l),Rl&&(Cl=Nl-Cl),$l>ru||Cl>ru)throw new Error("splitScalarEndo: Endomorphism failed, k="+Ml);return{k1neg:Zo,k1:$l,k2neg:Rl,k2:Cl}}},lo=32,uo=32,ho=32,go=lo+1,bo=2*lo+1;function wo(Ml){const{a:Nl,b:Yl}=ao,Wl=Lo(Ml*Ml),eu=Lo(Wl*Ml);return Lo(eu+Nl*Ml+Yl)}const Eo=ao.a===to;class $o extends Error{constructor(Nl){super(Nl)}}function Co(Ml){if(!(Ml instanceof Ro))throw new TypeError("JacobianPoint expected")}class Ro{constructor(Nl,Yl,Wl){this.x=Nl,this.y=Yl,this.z=Wl}static fromAffine(Nl){if(!(Nl instanceof Bo))throw new TypeError("JacobianPoint#fromAffine: expected Point");return Nl.equals(Bo.ZERO)?Ro.ZERO:new Ro(Nl.x,Nl.y,ro)}static toAffineBatch(Nl){const Yl=qo(Nl.map(Wl=>Wl.z));return Nl.map((Wl,eu)=>Wl.toAffine(Yl[eu]))}static normalizeZ(Nl){return Ro.toAffineBatch(Nl).map(Ro.fromAffine)}equals(Nl){Co(Nl);const{x:Yl,y:Wl,z:eu}=this,{x:Su,y:ru,z:uu}=Nl,xl=Lo(eu*eu),$l=Lo(uu*uu),Cl=Lo(Yl*$l),Zo=Lo(Su*xl),Rl=Lo(Lo(Wl*uu)*$l),Hl=Lo(Lo(ru*eu)*xl);return Cl===Zo&&Rl===Hl}negate(){return new Ro(this.x,Lo(-this.y),this.z)}double(){const{x:Nl,y:Yl,z:Wl}=this,eu=Lo(Nl*Nl),Su=Lo(Yl*Yl),ru=Lo(Su*Su),uu=Nl+Su,xl=Lo(no*(Lo(uu*uu)-eu-ru)),$l=Lo(io*eu),Cl=Lo($l*$l),Zo=Lo(Cl-no*xl),Rl=Lo($l*(xl-Zo)-oo*ru),Hl=Lo(no*Yl*Wl);return new Ro(Zo,Rl,Hl)}add(Nl){Co(Nl);const{x:Yl,y:Wl,z:eu}=this,{x:Su,y:ru,z:uu}=Nl;if(Su===to||ru===to)return this;if(Yl===to||Wl===to)return Nl;const xl=Lo(eu*eu),$l=Lo(uu*uu),Cl=Lo(Yl*$l),Zo=Lo(Su*xl),Rl=Lo(Lo(Wl*uu)*$l),Hl=Lo(Lo(ru*eu)*xl),au=Lo(Zo-Cl),tu=Lo(Hl-Rl);if(au===to)return tu===to?this.double():Ro.ZERO;const lu=Lo(au*au),Nu=Lo(au*lu),Pu=Lo(Cl*lu),ip=Lo(tu*tu-Nu-no*Pu),Lu=Lo(tu*(Pu-ip)-Rl*Nu),Yu=Lo(eu*uu*au);return new Ro(ip,Lu,Yu)}subtract(Nl){return this.add(Nl.negate())}multiplyUnsafe(Nl){const Yl=Ro.ZERO;if(typeof Nl=="bigint"&&Nl===to)return Yl;let Wl=Do(Nl);if(Wl===ro)return this;if(!Eo){let Zo=Yl,Rl=this;for(;Wl>to;)Wl&ro&&(Zo=Zo.add(Rl)),Rl=Rl.double(),Wl>>=ro;return Zo}let{k1neg:eu,k1:Su,k2neg:ru,k2:uu}=co.splitScalar(Wl),xl=Yl,$l=Yl,Cl=this;for(;Su>to||uu>to;)Su&ro&&(xl=xl.add(Cl)),uu&ro&&($l=$l.add(Cl)),Cl=Cl.double(),Su>>=ro,uu>>=ro;return eu&&(xl=xl.negate()),ru&&($l=$l.negate()),$l=new Ro(Lo($l.x*co.beta),$l.y,$l.z),xl.add($l)}precomputeWindow(Nl){const Yl=Eo?128/Nl+1:256/Nl+1,Wl=[];let eu=this,Su=eu;for(let ru=0;ru>=Zo,au>xl&&(au-=Cl,Nl+=ro);const tu=Hl,lu=Hl+Math.abs(au)-1,Nu=Rl%2!==0,Pu=au<0;au===0?ru=ru.add(Oo(Nu,eu[tu])):Su=Su.add(Oo(Pu,eu[lu]))}return{p:Su,f:ru}}multiply(Nl,Yl){let Wl=Do(Nl),eu,Su;if(Eo){const{k1neg:ru,k1:uu,k2neg:xl,k2:$l}=co.splitScalar(Wl);let{p:Cl,f:Zo}=this.wNAF(uu,Yl),{p:Rl,f:Hl}=this.wNAF($l,Yl);Cl=Oo(ru,Cl),Rl=Oo(xl,Rl),Rl=new Ro(Lo(Rl.x*co.beta),Rl.y,Rl.z),eu=Cl.add(Rl),Su=Zo.add(Hl)}else{const{p:ru,f:uu}=this.wNAF(Wl,Yl);eu=ru,Su=uu}return Ro.normalizeZ([eu,Su])[0]}toAffine(Nl){const{x:Yl,y:Wl,z:eu}=this,Su=this.equals(Ro.ZERO);Nl==null&&(Nl=Su?oo:Xo(eu));const ru=Nl,uu=Lo(ru*ru),xl=Lo(uu*ru),$l=Lo(Yl*uu),Cl=Lo(Wl*xl),Zo=Lo(eu*ru);if(Su)return Bo.ZERO;if(Zo!==ro)throw new Error("invZ was invalid");return new Bo($l,Cl)}}Ro.BASE=new Ro(ao.Gx,ao.Gy,ro),Ro.ZERO=new Ro(to,ro,to);function Oo(Ml,Nl){const Yl=Nl.negate();return Ml?Yl:Nl}const jo=new WeakMap;class Bo{constructor(Nl,Yl){this.x=Nl,this.y=Yl}_setWindowSize(Nl){this._WINDOW_SIZE=Nl,jo.delete(this)}hasEvenY(){return this.y%no===to}static fromCompressedHex(Nl){const Yl=Nl.length===32,Wl=mo(Yl?Nl:Nl.subarray(1));if(!El(Wl))throw new Error("Point is not on curve");const eu=wo(Wl);let Su=Yo(eu);const ru=(Su&ro)===ro;Yl?ru&&(Su=Lo(-Su)):(Nl[0]&1)===1!==ru&&(Su=Lo(-Su));const uu=new Bo(Wl,Su);return uu.assertValidity(),uu}static fromUncompressedHex(Nl){const Yl=mo(Nl.subarray(1,lo+1)),Wl=mo(Nl.subarray(lo+1,lo*2+1)),eu=new Bo(Yl,Wl);return eu.assertValidity(),eu}static fromHex(Nl){const Yl=Io(Nl),Wl=Yl.length,eu=Yl[0];if(Wl===lo)return this.fromCompressedHex(Yl);if(Wl===go&&(eu===2||eu===3))return this.fromCompressedHex(Yl);if(Wl===bo&&eu===4)return this.fromUncompressedHex(Yl);throw new Error(`Point.fromHex: received invalid point. Expected 32-${go} compressed bytes or ${bo} uncompressed bytes, not ${Wl}`)}static fromPrivateKey(Nl){return Bo.BASE.multiply(Il(Nl))}static fromSignature(Nl,Yl,Wl){const{r:eu,s:Su}=Vl(Yl);if(![0,1,2,3].includes(Wl))throw new Error("Cannot recover: invalid recovery bit");const ru=Qo(Io(Nl)),{n:uu}=ao,xl=Wl===2||Wl===3?eu+uu:eu,$l=Xo(xl,uu),Cl=Lo(-ru*$l,uu),Zo=Lo(Su*$l,uu),Rl=Wl&1?"03":"02",Hl=Bo.fromHex(Rl+_o(xl)),au=Bo.BASE.multiplyAndAddUnsafe(Hl,Cl,Zo);if(!au)throw new Error("Cannot recover signature: point at infinify");return au.assertValidity(),au}toRawBytes(Nl=!1){return ko(this.toHex(Nl))}toHex(Nl=!1){const Yl=_o(this.x);return Nl?`${this.hasEvenY()?"02":"03"}${Yl}`:`04${Yl}${_o(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const Nl="Point is not on elliptic curve",{x:Yl,y:Wl}=this;if(!El(Yl)||!El(Wl))throw new Error(Nl);const eu=Lo(Wl*Wl),Su=wo(Yl);if(Lo(eu-Su)!==to)throw new Error(Nl)}equals(Nl){return this.x===Nl.x&&this.y===Nl.y}negate(){return new Bo(this.x,Lo(-this.y))}double(){return Ro.fromAffine(this).double().toAffine()}add(Nl){return Ro.fromAffine(this).add(Ro.fromAffine(Nl)).toAffine()}subtract(Nl){return this.add(Nl.negate())}multiply(Nl){return Ro.fromAffine(this).multiply(Nl,this).toAffine()}multiplyAndAddUnsafe(Nl,Yl,Wl){const eu=Ro.fromAffine(this),Su=Yl===to||Yl===ro||this!==Bo.BASE?eu.multiplyUnsafe(Yl):eu.multiply(Yl),ru=Ro.fromAffine(Nl).multiplyUnsafe(Wl),uu=Su.add(ru);return uu.equals(Ro.ZERO)?void 0:uu.toAffine()}}Xr.Point=Bo,Bo.BASE=new Bo(ao.Gx,ao.Gy),Bo.ZERO=new Bo(to,to);function Mo(Ml){return Number.parseInt(Ml[0],16)>=8?"00"+Ml:Ml}function Fo(Ml){if(Ml.length<2||Ml[0]!==2)throw new Error(`Invalid signature integer tag: ${yo(Ml)}`);const Nl=Ml[1],Yl=Ml.subarray(2,Nl+2);if(!Nl||Yl.length!==Nl)throw new Error("Invalid signature integer: wrong length");if(Yl[0]===0&&Yl[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:mo(Yl),left:Ml.subarray(Nl+2)}}function Wo(Ml){if(Ml.length<2||Ml[0]!=48)throw new Error(`Invalid signature tag: ${yo(Ml)}`);if(Ml[1]!==Ml.length-2)throw new Error("Invalid signature: incorrect length");const{data:Nl,left:Yl}=Fo(Ml.subarray(2)),{data:Wl,left:eu}=Fo(Yl);if(eu.length)throw new Error(`Invalid signature: left bytes after parsing: ${yo(eu)}`);return{r:Nl,s:Wl}}class Jo{constructor(Nl,Yl){this.r=Nl,this.s=Yl,this.assertValidity()}static fromCompact(Nl){const Yl=Nl instanceof Uint8Array,Wl="Signature.fromCompact";if(typeof Nl!="string"&&!Yl)throw new TypeError(`${Wl}: Expected string or Uint8Array`);const eu=Yl?yo(Nl):Nl;if(eu.length!==128)throw new Error(`${Wl}: Expected 64-byte hex`);return new Jo(Ao(eu.slice(0,64)),Ao(eu.slice(64,128)))}static fromDER(Nl){const Yl=Nl instanceof Uint8Array;if(typeof Nl!="string"&&!Yl)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:Wl,s:eu}=Wo(Yl?Nl:ko(Nl));return new Jo(Wl,eu)}static fromHex(Nl){return this.fromDER(Nl)}assertValidity(){const{r:Nl,s:Yl}=this;if(!Sl(Nl))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Sl(Yl))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const Nl=ao.n>>ro;return this.s>Nl}normalizeS(){return this.hasHighS()?new Jo(this.r,Lo(-this.s,ao.n)):this}toDERRawBytes(){return ko(this.toDERHex())}toDERHex(){const Nl=Mo(To(this.s)),Yl=Mo(To(this.r)),Wl=Nl.length/2,eu=Yl.length/2,Su=To(Wl),ru=To(eu);return`30${To(eu+Wl+4)}02${ru}${Yl}02${Su}${Nl}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return ko(this.toCompactHex())}toCompactHex(){return _o(this.r)+_o(this.s)}}Xr.Signature=Jo;function Po(...Ml){if(!Ml.every(Wl=>Wl instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Ml.length===1)return Ml[0];const Nl=Ml.reduce((Wl,eu)=>Wl+eu.length,0),Yl=new Uint8Array(Nl);for(let Wl=0,eu=0;WlNl.toString(16).padStart(2,"0"));function yo(Ml){if(!(Ml instanceof Uint8Array))throw new Error("Expected Uint8Array");let Nl="";for(let Yl=0;Yl0)return BigInt(Ml);if(typeof Ml=="bigint"&&Sl(Ml))return Ml;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Lo(Ml,Nl=ao.P){const Yl=Ml%Nl;return Yl>=to?Yl:Nl+Yl}function Ho(Ml,Nl){const{P:Yl}=ao;let Wl=Ml;for(;Nl-- >to;)Wl*=Wl,Wl%=Yl;return Wl}function Yo(Ml){const{P:Nl}=ao,Yl=BigInt(6),Wl=BigInt(11),eu=BigInt(22),Su=BigInt(23),ru=BigInt(44),uu=BigInt(88),xl=Ml*Ml*Ml%Nl,$l=xl*xl*Ml%Nl,Cl=Ho($l,io)*$l%Nl,Zo=Ho(Cl,io)*$l%Nl,Rl=Ho(Zo,no)*xl%Nl,Hl=Ho(Rl,Wl)*Rl%Nl,au=Ho(Hl,eu)*Hl%Nl,tu=Ho(au,ru)*au%Nl,lu=Ho(tu,uu)*tu%Nl,Nu=Ho(lu,ru)*au%Nl,Pu=Ho(Nu,io)*$l%Nl,ip=Ho(Pu,Su)*Hl%Nl,Lu=Ho(ip,Yl)*xl%Nl,Yu=Ho(Lu,no);if(Yu*Yu%Nl!==Ml)throw new Error("Cannot find square root");return Yu}function Xo(Ml,Nl=ao.P){if(Ml===to||Nl<=to)throw new Error(`invert: expected positive integers, got n=${Ml} mod=${Nl}`);let Yl=Lo(Ml,Nl),Wl=Nl,eu=to,Su=ro;for(;Yl!==to;){const uu=Wl/Yl,xl=Wl%Yl,$l=eu-Su*uu;Wl=Yl,Yl=xl,eu=Su,Su=$l}if(Wl!==ro)throw new Error("invert: does not exist");return Lo(eu,Nl)}function qo(Ml,Nl=ao.P){const Yl=new Array(Ml.length),Wl=Ml.reduce((Su,ru,uu)=>ru===to?Su:(Yl[uu]=Su,Lo(Su*ru,Nl)),ro),eu=Xo(Wl,Nl);return Ml.reduceRight((Su,ru,uu)=>ru===to?Su:(Yl[uu]=Lo(Su*Yl[uu],Nl),Lo(Su*ru,Nl)),eu),Yl}function Ko(Ml){const Nl=Ml.length*8-uo*8,Yl=mo(Ml);return Nl>0?Yl>>BigInt(Nl):Yl}function Qo(Ml,Nl=!1){const Yl=Ko(Ml);if(Nl)return Yl;const{n:Wl}=ao;return Yl>=Wl?Yl-Wl:Yl}let zo,ga;class $a{constructor(Nl,Yl){if(this.hashLen=Nl,this.qByteLen=Yl,typeof Nl!="number"||Nl<2)throw new Error("hashLen must be a number");if(typeof Yl!="number"||Yl<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(Nl).fill(1),this.k=new Uint8Array(Nl).fill(0),this.counter=0}hmac(...Nl){return Xr.utils.hmacSha256(this.k,...Nl)}hmacSync(...Nl){return ga(this.k,...Nl)}checkSync(){if(typeof ga!="function")throw new $o("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(Nl=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),Nl),this.v=await this.hmac(this.v),Nl.length!==0&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),Nl),this.v=await this.hmac(this.v))}reseedSync(Nl=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),Nl),this.v=this.hmacSync(this.v),Nl.length!==0&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),Nl),this.v=this.hmacSync(this.v))}async generate(){this.incr();let Nl=0;const Yl=[];for(;Nl0)Nl=BigInt(Ml);else if(typeof Ml=="string"){if(Ml.length!==2*uo)throw new Error("Expected 32 bytes of private key");Nl=Ao(Ml)}else if(Ml instanceof Uint8Array){if(Ml.length!==uo)throw new Error("Expected 32 bytes of private key");Nl=mo(Ml)}else throw new TypeError("Expected valid private key");if(!Sl(Nl))throw new Error("Expected private key: 0 < key < n");return Nl}function Zl(Ml){return Ml instanceof Bo?(Ml.assertValidity(),Ml):Bo.fromHex(Ml)}function Vl(Ml){if(Ml instanceof Jo)return Ml.assertValidity(),Ml;try{return Jo.fromDER(Ml)}catch{return Jo.fromCompact(Ml)}}function Ol(Ml,Nl=!1){return Bo.fromPrivateKey(Ml).toRawBytes(Nl)}Xr.getPublicKey=Ol;function Dl(Ml,Nl,Yl,Wl=!1){return Bo.fromSignature(Ml,Nl,Yl).toRawBytes(Wl)}Xr.recoverPublicKey=Dl;function Fl(Ml){const Nl=Ml instanceof Uint8Array,Yl=typeof Ml=="string",Wl=(Nl||Yl)&&Ml.length;return Nl?Wl===go||Wl===bo:Yl?Wl===go*2||Wl===bo*2:Ml instanceof Bo}function Jl(Ml,Nl,Yl=!1){if(Fl(Ml))throw new TypeError("getSharedSecret: first arg must be private key");if(!Fl(Nl))throw new TypeError("getSharedSecret: second arg must be public key");const Wl=Zl(Nl);return Wl.assertValidity(),Wl.multiply(Il(Ml)).toRawBytes(Yl)}Xr.getSharedSecret=Jl;function cu(Ml){const Nl=Ml.length>lo?Ml.slice(0,lo):Ml;return mo(Nl)}function Ll(Ml){const Nl=cu(Ml),Yl=Lo(Nl,ao.n);return Xl(Yl{Ml=Io(Ml);const Nl=uo+8;if(Ml.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");const Yl=Lo(mo(Ml),ao.n-ro)+ro;return So(Yl)},randomBytes:(Ml=32)=>{if(yu.web)return yu.web.getRandomValues(new Uint8Array(Ml));if(yu.node){const{randomBytes:Nl}=yu.node;return Uint8Array.from(Nl(Ml))}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Xr.utils.hashToPrivateKey(Xr.utils.randomBytes(uo+8)),precompute(Ml=8,Nl=Bo.BASE){const Yl=Nl===Bo.BASE?Nl:new Bo(Nl.x,Nl.y);return Yl._setWindowSize(Ml),Yl.multiply(io),Yl},sha256:async(...Ml)=>{if(yu.web){const Nl=await yu.web.subtle.digest("SHA-256",Po(...Ml));return new Uint8Array(Nl)}else if(yu.node){const{createHash:Nl}=yu.node,Yl=Nl("sha256");return Ml.forEach(Wl=>Yl.update(Wl)),Uint8Array.from(Yl.digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(Ml,...Nl)=>{if(yu.web){const Yl=await yu.web.subtle.importKey("raw",Ml,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),Wl=Po(...Nl),eu=await yu.web.subtle.sign("HMAC",Yl,Wl);return new Uint8Array(eu)}else if(yu.node){const{createHmac:Yl}=yu.node,Wl=Yl("sha256",Ml);return Nl.forEach(eu=>Wl.update(eu)),Uint8Array.from(Wl.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(Ml,...Nl)=>{let Yl=Gu[Ml];if(Yl===void 0){const Wl=await Xr.utils.sha256(Uint8Array.from(Ml,eu=>eu.charCodeAt(0)));Yl=Po(Wl,Wl),Gu[Ml]=Yl}return Xr.utils.sha256(Yl,...Nl)},taggedHashSync:(Ml,...Nl)=>{if(typeof zo!="function")throw new $o("sha256Sync is undefined, you need to set it");let Yl=Gu[Ml];if(Yl===void 0){const Wl=zo(Uint8Array.from(Ml,eu=>eu.charCodeAt(0)));Yl=Po(Wl,Wl),Gu[Ml]=Yl}return zo(Yl,...Nl)},_JacobianPoint:Ro},Object.defineProperties(Xr.utils,{sha256Sync:{configurable:!1,get(){return zo},set(Ml){zo||(zo=Ml)}},hmacSha256Sync:{configurable:!1,get(){return ga},set(Ml){ga||(ga=Ml)}}})})(lib$1);var ecdsaSigFormatter={};Object.defineProperty(ecdsaSigFormatter,"__esModule",{value:!0});ecdsaSigFormatter.joseToDer=ecdsaSigFormatter.derToJose=void 0;const base64_js_1=base64Js,base64Url_1=base64Url;function getParamSize(Xr){return(Xr/8|0)+(Xr%8===0?0:1)}const paramBytesForAlg={ES256:getParamSize(256),ES384:getParamSize(384),ES512:getParamSize(521)};function getParamBytesForAlg(Xr){const eo=paramBytesForAlg[Xr];if(eo)return eo;throw new Error(`Unknown algorithm "${Xr}"`)}const MAX_OCTET=128,CLASS_UNIVERSAL=0,PRIMITIVE_BIT=32,TAG_SEQ=16,TAG_INT=2,ENCODED_TAG_SEQ=TAG_SEQ|PRIMITIVE_BIT|CLASS_UNIVERSAL<<6,ENCODED_TAG_INT=TAG_INT|CLASS_UNIVERSAL<<6;function signatureAsBytes(Xr){if(Xr instanceof Uint8Array)return Xr;if(typeof Xr=="string")return(0,base64_js_1.toByteArray)((0,base64Url_1.pad)(Xr));throw new TypeError("ECDSA signature must be a Base64 string or a Uint8Array")}function derToJose(Xr,eo){const to=signatureAsBytes(Xr),ro=getParamBytesForAlg(eo),no=ro+1,io=to.length;let oo=0;if(to[oo++]!==ENCODED_TAG_SEQ)throw new Error('Could not find expected "seq"');let ao=to[oo++];if(ao===(MAX_OCTET|1)&&(ao=to[oo++]),io-oo=MAX_OCTET&&--ro,ro}function joseToDer(Xr,eo){Xr=signatureAsBytes(Xr);const to=getParamBytesForAlg(eo),ro=Xr.length;if(ro!==to*2)throw new TypeError(`"${eo}" signatures must be "${to*2}" bytes, saw "${ro}"`);const no=countPadding(Xr,0,to),io=countPadding(Xr,to,Xr.length),oo=to-no,ao=to-io,so=2+oo+1+1+ao,co=so{const to=hmac_1$1.hmac.create(sha256_1$3.sha256,Xr);return eo.forEach(ro=>to.update(ro)),to.digest()};class SECP256K1Client{static derivePublicKey(eo,to=!0){return eo.length===66&&(eo=eo.slice(0,64)),eo.length<64&&(eo=eo.padStart(64,"0")),(0,utils_1$4.bytesToHex)(secp.getPublicKey(eo,to))}static signHash(eo,to,ro="jose"){if(!eo||!to)throw new errors_1$2.MissingParametersError("a signing input hash and private key are all required");const no=secp.signSync(eo,to.slice(0,64),{der:!0,canonical:!1});if(ro==="der")return(0,utils_1$4.bytesToHex)(no);if(ro==="jose")return(0,ecdsaSigFormatter_1.derToJose)(no,"ES256");throw Error("Invalid signature format")}static loadSignature(eo){return(0,ecdsaSigFormatter_1.joseToDer)(eo,"ES256")}static verifyHash(eo,to,ro){if(!eo||!to||!ro)throw new errors_1$2.MissingParametersError("a signing input hash, der signature, and public key are all required");return secp.verify(to,eo,ro,{strict:!1})}}secp256k1$1.SECP256K1Client=SECP256K1Client;SECP256K1Client.algorithmName="ES256K";(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.cryptoClients=Xr.SECP256K1Client=void 0;const eo=secp256k1$1;Object.defineProperty(Xr,"SECP256K1Client",{enumerable:!0,get:function(){return eo.SECP256K1Client}});const to={ES256K:eo.SECP256K1Client};Xr.cryptoClients=to})(cryptoClients);var sha256$3={},__awaiter$h=commonjsGlobal&&commonjsGlobal.__awaiter||function(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})};Object.defineProperty(sha256$3,"__esModule",{value:!0});sha256$3.hashSha256Async=sha256$3.hashSha256=void 0;const sha256_1$2=sha256$7;function hashSha256(Xr){return(0,sha256_1$2.sha256)(Xr)}sha256$3.hashSha256=hashSha256;function hashSha256Async(Xr){return __awaiter$h(this,void 0,void 0,function*(){try{if(typeof crypto<"u"&&typeof crypto.subtle<"u"){const to=typeof Xr=="string"?new TextEncoder().encode(Xr):Xr,ro=yield crypto.subtle.digest("SHA-256",to);return new Uint8Array(ro)}else{const to=requireCryptoBrowserify();if(!to.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(to.createHash("sha256").update(Xr).digest())}}catch(eo){return console.log(eo),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(hashSha256(Xr))}})}sha256$3.hashSha256Async=hashSha256Async;var __awaiter$g=commonjsGlobal&&commonjsGlobal.__awaiter||function(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})};Object.defineProperty(signer,"__esModule",{value:!0});signer.TokenSigner=signer.createUnsecuredToken=void 0;const base64url$3=base64Url,cryptoClients_1$1=cryptoClients,errors_1$1=errors$3,sha256_1$1=sha256$3;function createSigningInput(Xr,eo){const to=[],ro=base64url$3.encode(JSON.stringify(eo));to.push(ro);const no=base64url$3.encode(JSON.stringify(Xr));return to.push(no),to.join(".")}function createUnsecuredToken(Xr){return createSigningInput(Xr,{typ:"JWT",alg:"none"})+"."}signer.createUnsecuredToken=createUnsecuredToken;class TokenSigner{constructor(eo,to){if(!(eo&&to))throw new errors_1$1.MissingParametersError("a signing algorithm and private key are required");if(typeof eo!="string")throw new Error("signing algorithm parameter must be a string");if(eo=eo.toUpperCase(),!cryptoClients_1$1.cryptoClients.hasOwnProperty(eo))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=cryptoClients_1$1.cryptoClients[eo],this.rawPrivateKey=to}header(eo={}){const to={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},to,eo)}sign(eo,to=!1,ro={}){const no=this.header(ro),io=createSigningInput(eo,no),oo=(0,sha256_1$1.hashSha256)(io);return this.createWithSignedHash(eo,to,no,io,oo)}signAsync(eo,to=!1,ro={}){return __awaiter$g(this,void 0,void 0,function*(){const no=this.header(ro),io=createSigningInput(eo,no),oo=yield(0,sha256_1$1.hashSha256Async)(io);return this.createWithSignedHash(eo,to,no,io,oo)})}createWithSignedHash(eo,to,ro,no,io){const oo=this.cryptoClient.signHash(io,this.rawPrivateKey);return to?{header:[base64url$3.encode(JSON.stringify(ro))],payload:JSON.stringify(eo),signature:[oo]}:[no,oo].join(".")}}signer.TokenSigner=TokenSigner;var verifier={};Object.defineProperty(verifier,"__esModule",{value:!0});verifier.TokenVerifier=void 0;const base64url$2=base64Url,cryptoClients_1=cryptoClients,errors_1=errors$3,sha256_1=sha256$3;class TokenVerifier{constructor(eo,to){if(!(eo&&to))throw new errors_1.MissingParametersError("a signing algorithm and public key are required");if(typeof eo!="string")throw"signing algorithm parameter must be a string";if(eo=eo.toUpperCase(),!cryptoClients_1.cryptoClients.hasOwnProperty(eo))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=cryptoClients_1.cryptoClients[eo],this.rawPublicKey=to}verify(eo){return typeof eo=="string"?this.verifyCompact(eo,!1):typeof eo=="object"?this.verifyExpanded(eo,!1):!1}verifyAsync(eo){return typeof eo=="string"?this.verifyCompact(eo,!0):typeof eo=="object"?this.verifyExpanded(eo,!0):Promise.resolve(!1)}verifyCompact(eo,to){const ro=eo.split("."),no=ro[0]+"."+ro[1],io=oo=>{const ao=this.cryptoClient.loadSignature(ro[2]);return this.cryptoClient.verifyHash(oo,ao,this.rawPublicKey)};if(to)return(0,sha256_1.hashSha256Async)(no).then(oo=>io(oo));{const oo=(0,sha256_1.hashSha256)(no);return io(oo)}}verifyExpanded(eo,to){const ro=[eo.header.join("."),base64url$2.encode(eo.payload)].join(".");let no=!0;const io=oo=>(eo.signature.map(ao=>{const so=this.cryptoClient.loadSignature(ao);this.cryptoClient.verifyHash(oo,so,this.rawPublicKey)||(no=!1)}),no);if(to)return(0,sha256_1.hashSha256Async)(ro).then(oo=>io(oo));{const oo=(0,sha256_1.hashSha256)(ro);return io(oo)}}}verifier.TokenVerifier=TokenVerifier;var decode$p={};Object.defineProperty(decode$p,"__esModule",{value:!0});decode$p.decodeToken=void 0;const base64url$1=base64Url;function decodeToken(Xr){if(typeof Xr=="string"){const eo=Xr.split("."),to=JSON.parse(base64url$1.decode(eo[0])),ro=JSON.parse(base64url$1.decode(eo[1])),no=eo[2];return{header:to,payload:ro,signature:no}}else if(typeof Xr=="object"){if(typeof Xr.payload!="string")throw new Error("Expected token payload to be a base64 or json string");let eo=Xr.payload;Xr.payload[0]!=="{"&&(eo=base64url$1.decode(eo));const to=[];return Xr.header.map(ro=>{const no=JSON.parse(base64url$1.decode(ro));to.push(no)}),{header:to,payload:JSON.parse(eo),signature:Xr.signature}}}decode$p.decodeToken=decodeToken;(function(Xr){var eo=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(ro,no,io,oo){oo===void 0&&(oo=io);var ao=Object.getOwnPropertyDescriptor(no,io);(!ao||("get"in ao?!no.__esModule:ao.writable||ao.configurable))&&(ao={enumerable:!0,get:function(){return no[io]}}),Object.defineProperty(ro,oo,ao)}:function(ro,no,io,oo){oo===void 0&&(oo=io),ro[oo]=no[io]}),to=commonjsGlobal&&commonjsGlobal.__exportStar||function(ro,no){for(var io in ro)io!=="default"&&!Object.prototype.hasOwnProperty.call(no,io)&&eo(no,ro,io)};Object.defineProperty(Xr,"__esModule",{value:!0}),to(signer,Xr),to(verifier,Xr),to(decode$p,Xr),to(errors$3,Xr),to(cryptoClients,Xr)})(lib$2);/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -2243,16 +4073,16 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var r$5="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const Xr=Array(256).fill(-1);for(let eo=0;eo>25;return(33554431&fo)<<5^996825010&-(ho>>0&1)^642813549&-(ho>>1&1)^513874426&-(ho>>2&1)^1027748829&-(ho>>3&1)^705979059&-(ho>>4&1)}function io(fo){let ho=1;for(let go=0;go126)return"Invalid prefix ("+fo+")";ho=no(ho)^yo>>5}ho=no(ho);for(let go=0;go=go;)wo-=go,ko.push(vo>>wo&Eo);if(yo)wo>0&&ko.push(vo<=ho)return"Excess padding";if(vo<vo)return"Exceeds length limit";const wo=yo.toLowerCase(),Eo=yo.toUpperCase();if(yo!==wo&&yo!==Eo)return"Mixed-case string "+yo;const ko=(yo=wo).lastIndexOf("1");if(ko===-1)return"No separator character for "+yo;if(ko===0)return"Missing prefix for "+yo;const Ao=yo.slice(0,ko),Po=yo.slice(ko+1);if(Po.length<6)return"Data too short";let jo=io(Ao);if(typeof jo=="string")return jo;const Mo=[];for(let No=0;No=Po.length||Mo.push(Fo)}return jo!==ho?"Invalid checksum for "+yo:{prefix:Ao,words:Mo}}return ho=fo==="bech32"?1:734539939,{decodeUnsafe:function(yo,vo){const wo=go(yo,vo);if(typeof wo=="object")return wo},decode:function(yo,vo){const wo=go(yo,vo);if(typeof wo=="object")return wo;throw new Error(wo)},encode:function(yo,vo,wo){if(wo=wo||90,yo.length+7+vo.length>wo)throw new TypeError("Exceeds length limit");let Eo=io(yo=yo.toLowerCase());if(typeof Eo=="string")throw new Error(Eo);let ko=yo+"1";for(let Ao=0;Ao>5)throw new Error("Non 5-bit word");Eo=no(Eo)^Po,ko+=to.charAt(Po)}for(let Ao=0;Ao<6;++Ao)Eo=no(Eo);Eo^=ho;for(let Ao=0;Ao<6;++Ao)ko+=to.charAt(Eo>>5*(5-Ao)&31);return ko},toWords:ao,fromWordsUnsafe:so,fromWords:co}}eo.bech32=lo("bech32"),eo.bech32m=lo("bech32m")},s$4(i$5={exports:{}},i$5.exports),i$5.exports);(o$4=h$9)&&o$4.__esModule&&Object.prototype.hasOwnProperty.call(o$4,"default")&&o$4.default;h$9.bech32m;h$9.bech32;new Uint8Array(new Uint16Array([65279]).buffer)[0];var x$6,k$5;(function(Xr){Xr.mainnet="mainnet",Xr.testnet="testnet",Xr.regtest="regtest"})(x$6||(x$6={})),function(Xr){Xr.p2pkh="p2pkh",Xr.p2sh="p2sh",Xr.p2wpkh="p2wpkh",Xr.p2wsh="p2wsh",Xr.p2tr="p2tr"}(k$5||(k$5={}));k$5.p2pkh,x$6.mainnet,k$5.p2pkh,x$6.testnet,k$5.p2sh,x$6.mainnet,k$5.p2sh,x$6.testnet;var accountChangeEventName="accountChange";object({type:literal$3(accountChangeEventName)});var networkChangeEventName="networkChange";object({type:literal$3(networkChangeEventName)});async function getProviderOrThrow(Xr){var to;const eo=await(Xr==null?void 0:Xr())||((to=window.XverseProviders)==null?void 0:to.BitcoinProvider)||window.BitcoinProvider;if(!eo)throw new Error("No Bitcoin wallet installed");return eo}var BitcoinNetworkType=(Xr=>(Xr.Mainnet="Mainnet",Xr.Testnet="Testnet",Xr.Signet="Signet",Xr))(BitcoinNetworkType||{}),RpcIdSchema=optional$4(union$3([string$4(),number$4(),null_()])),rpcRequestMessageSchema=object({jsonrpc:literal$3("2.0"),method:string$4(),params:optional$4(union$3([array$3(unknown$3()),looseObject({}),null_()])),id:RpcIdSchema}),rpcSuccessResponseMessageSchema=object({jsonrpc:literal$3("2.0"),result:nonOptional(unknown$3()),id:RpcIdSchema}),rpcErrorResponseMessageSchema=object({jsonrpc:literal$3("2.0"),error:nonOptional(unknown$3()),id:RpcIdSchema});union$3([rpcSuccessResponseMessageSchema,rpcErrorResponseMessageSchema]);var AddressPurpose=(Xr=>(Xr.Ordinals="ordinals",Xr.Payment="payment",Xr.Stacks="stacks",Xr))(AddressPurpose||{}),AddressType=(Xr=>(Xr.p2pkh="p2pkh",Xr.p2sh="p2sh",Xr.p2wpkh="p2wpkh",Xr.p2wsh="p2wsh",Xr.p2tr="p2tr",Xr.stacks="stacks",Xr))(AddressType||{}),addressSchema=object({address:string$4(),publicKey:string$4(),purpose:enum_(AddressPurpose),addressType:enum_(AddressType)}),getAddress=async Xr=>{var ro,no;const eo=await getProviderOrThrow(Xr.getProvider),{purposes:to}=Xr.payload;if(!to)throw new Error("Address purposes are required");try{const io=lib$2.createUnsecuredToken(Xr.payload),oo=await eo.connect(io);(ro=Xr.onFinish)==null||ro.call(Xr,oo)}catch(io){console.error("[Connect] Error during address request",io),(no=Xr.onCancel)==null||no.call(Xr)}},stxGetAddressesMethodName="stx_getAddresses",stxGetAddressesParamsSchema=nullish(object({message:optional$4(string$4())}));object({...rpcRequestMessageSchema.entries,...object({method:literal$3(stxGetAddressesMethodName),params:stxGetAddressesParamsSchema,id:string$4()}).entries});var stxSignTransactionMethodName="stx_signTransaction",stxSignTransactionParamsSchema=object({transaction:string$4(),pubkey:optional$4(string$4()),broadcast:optional$4(boolean$3())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(stxSignTransactionMethodName),params:stxSignTransactionParamsSchema,id:string$4()}).entries});var walletTypes=["software","ledger"],walletTypeSchema=picklist(walletTypes),getInfoMethodName="getInfo",getInfoParamsSchema=nullish(null_());object({version:string$4(),methods:optional$4(array$3(string$4())),supports:array$3(string$4())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getInfoMethodName),params:getInfoParamsSchema,id:string$4()}).entries});var getAddressesMethodName="getAddresses",getAddressesParamsSchema=object({purposes:array$3(enum_(AddressPurpose)),message:optional$4(string$4())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getAddressesMethodName),params:getAddressesParamsSchema,id:string$4()}).entries});var signMessageMethodName="signMessage",MessageSigningProtocols=(Xr=>(Xr.ECDSA="ECDSA",Xr.BIP322="BIP322",Xr))(MessageSigningProtocols||{}),signMessageParamsSchema=object({address:string$4(),message:string$4(),protocol:optional$4(enum_(MessageSigningProtocols))});object({signature:string$4(),messageHash:string$4(),address:string$4(),protocol:enum_(MessageSigningProtocols)});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(signMessageMethodName),params:signMessageParamsSchema,id:string$4()}).entries});var getAccountsMethodName="getAccounts",getAccountsParamsSchema=object({purposes:array$3(enum_(AddressPurpose)),message:optional$4(string$4())});array$3(object({...addressSchema.entries,...object({walletType:walletTypeSchema}).entries}));object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getAccountsMethodName),params:getAccountsParamsSchema,id:string$4()}).entries});var getBalanceMethodName="getBalance";nullish(null_());object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getBalanceMethodName),id:string$4()}).entries});var requestPermissionsMethodName="wallet_requestPermissions",requestPermissionsParamsSchema=undefined_();literal$3(!0);object({...rpcRequestMessageSchema.entries,...object({method:literal$3(requestPermissionsMethodName),params:requestPermissionsParamsSchema,id:string$4()}).entries});var renouncePermissionsMethodName="wallet_renouncePermissions",renouncePermissionsParamsSchema=undefined_();literal$3(!0);object({...rpcRequestMessageSchema.entries,...object({method:literal$3(renouncePermissionsMethodName),params:renouncePermissionsParamsSchema,id:string$4()}).entries});var getWalletTypeMethodName="wallet_getWalletType";nullish(null_());object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getWalletTypeMethodName),id:string$4()}).entries});var getRunesBalanceMethodName="runes_getBalance",getRunesBalanceParamsSchema=nullish(null_());object({balances:array$3(object({runeName:string$4(),amount:string$4(),divisibility:number$4(),symbol:string$4(),inscriptionId:nullish(string$4())}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getRunesBalanceMethodName),params:getRunesBalanceParamsSchema,id:string$4()}).entries});var transferRunesMethodName="runes_transfer",transferRunesParamsSchema=object({recipients:array$3(object({runeName:string$4(),amount:string$4(),address:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(transferRunesMethodName),params:transferRunesParamsSchema,id:string$4()}).entries});var getInscriptionsMethodName="ord_getInscriptions",getInscriptionsParamsSchema=object({offset:number$4(),limit:number$4()});object({total:number$4(),limit:number$4(),offset:number$4(),inscriptions:array$3(object({inscriptionId:string$4(),inscriptionNumber:string$4(),address:string$4(),collectionName:optional$4(string$4()),postage:string$4(),contentLength:string$4(),contentType:string$4(),timestamp:number$4(),offset:number$4(),genesisTransaction:string$4(),output:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getInscriptionsMethodName),params:getInscriptionsParamsSchema,id:string$4()}).entries});var sendInscriptionsMethodName="ord_sendInscriptions",sendInscriptionsParamsSchema=object({transfers:array$3(object({address:string$4(),inscriptionId:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(sendInscriptionsMethodName),params:sendInscriptionsParamsSchema,id:string$4()}).entries});var request=async(Xr,eo,to)=>{var io;let ro=((io=window.XverseProviders)==null?void 0:io.BitcoinProvider)||window.BitcoinProvider;if(!ro)throw new Error("no wallet provider was found");if(!Xr)throw new Error("A wallet method is required");const no=await ro.request(Xr,eo);return is$7(rpcErrorResponseMessageSchema,no)?{status:"error",error:no.error}:is$7(rpcSuccessResponseMessageSchema,no)?{status:"success",result:no.result}:{status:"error",error:{code:-32603,message:"Received unknown response from provider.",data:no}}},addListener=(Xr,eo,to)=>{var no;let ro=((no=window.XverseProviders)==null?void 0:no.BitcoinProvider)||window.BitcoinProvider;if(!ro)throw new Error("no wallet provider was found");return ro.addListener?ro.addListener(Xr,eo):(console.error("The wallet provider you are using does not support the addListener method. Please update your wallet provider."),()=>{})},signMessage$1=async Xr=>{var no,io;const eo=await getProviderOrThrow(Xr.getProvider),{address:to,message:ro}=Xr.payload;if(!to)throw new Error("An address is required to sign a message");if(!ro)throw new Error("A message to be signed is required");try{const oo=lib$2.createUnsecuredToken(Xr.payload),ao=await eo.signMessage(oo);(no=Xr.onFinish)==null||no.call(Xr,ao)}catch(oo){console.error("[Connect] Error during sign message request",oo),(io=Xr.onCancel)==null||io.call(Xr)}},serializer=Xr=>Xr.map(eo=>{const{address:to,amountSats:ro}=eo;return{address:to,amountSats:ro.toString()}}),sendBtcTransaction=async Xr=>{var oo,ao;const eo=await getProviderOrThrow(Xr.getProvider),{recipients:to,senderAddress:ro,network:no,message:io}=Xr.payload;if(!to||to.length===0)throw new Error("At least one recipient is required");if(to.some(so=>typeof so.address!="string"||typeof so.amountSats!="bigint"))throw new Error("Incorrect recipient format");if(!ro)throw new Error("The sender address is required");try{const so=serializer(to),co={network:no,senderAddress:ro,message:io,recipients:so},lo=lib$2.createUnsecuredToken(co),fo=await eo.sendBtcTransaction(lo);(oo=Xr.onFinish)==null||oo.call(Xr,fo)}catch(so){console.error("[Connect] Error during send BTC transaction request",so),(ao=Xr.onCancel)==null||ao.call(Xr)}},signTransaction$1=async Xr=>{var no,io;const eo=await getProviderOrThrow(Xr.getProvider),{psbtBase64:to,inputsToSign:ro}=Xr.payload;if(!to)throw new Error("A value for psbtBase64 representing the tx hash is required");if(!ro)throw new Error("An array specifying the inputs to be signed by the wallet is required");try{const oo=lib$2.createUnsecuredToken(Xr.payload),ao=await eo.signTransaction(oo);(no=Xr.onFinish)==null||no.call(Xr,ao)}catch(oo){console.error("[Connect] Error during sign transaction request",oo),(io=Xr.onCancel)==null||io.call(Xr)}},signMultipleTransactions=async Xr=>{var ro,no;const eo=await getProviderOrThrow(Xr.getProvider),{psbts:to}=Xr.payload;if(!to||!to.length)throw new Error("psbts array is required");if(to.length>100)throw new Error("psbts array must contain less than 100 psbts");try{const io=lib$2.createUnsecuredToken(Xr.payload),oo=await eo.signMultipleTransactions(io);(ro=Xr.onFinish)==null||ro.call(Xr,oo)}catch(io){console.error("[Connect] Error during sign Multiple transactions request",io),(no=Xr.onCancel)==null||no.call(Xr)}};class BitcoinLocalStorageCache{constructor(eo){this.CONNECTED_ACCOUNTS_KEY=`bitcoin_${eo}_connectedAccounts`}getActiveAccount(){return __awaiter$i(this,void 0,void 0,function*(){const eo=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);if(!eo)return;const to=Object.keys(eo).find(ro=>eo[ro].active);if(to)return{additionalAddresses:eo[to].additionalAddresses,address:to}})}getConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){return yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY)})}getConnectedAccount(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);return to==null?void 0:to[eo]})}setConnectedAccount(eo,to){return __awaiter$i(this,void 0,void 0,function*(){let ro=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);return ro||(ro={}),to.active&&Object.keys(ro).forEach(no=>{ro&&(ro[no].active=!1)}),ro[eo]=to,setItemAsync(this.CONNECTED_ACCOUNTS_KEY,ro)})}clearConnectedAcccounts(){return __awaiter$i(this,void 0,void 0,function*(){return removeItemAsync(this.CONNECTED_ACCOUNTS_KEY)})}}var __classPrivateFieldSet$4=function(Xr,eo,to,ro,no){if(ro==="m")throw new TypeError("Private method is not writable");if(ro==="a"&&!no)throw new TypeError("Private accessor was defined without a setter");if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return ro==="a"?no.call(Xr,to):no?no.value=to:eo.set(Xr,to),to},__classPrivateFieldGet$4=function(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)},_AppReadyEvent_detail;let wallets;const registered=new Set,listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get:get$4,on:on$1}),typeof window>"u"))return wallets;const Xr=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:eo})=>eo(Xr))}catch(eo){console.error(`wallet-standard:register-wallet event listener could not be added +***************************************************************************** */var r$5="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const Xr=Array(256).fill(-1);for(let eo=0;eo>25;return(33554431&uo)<<5^996825010&-(ho>>0&1)^642813549&-(ho>>1&1)^513874426&-(ho>>2&1)^1027748829&-(ho>>3&1)^705979059&-(ho>>4&1)}function io(uo){let ho=1;for(let go=0;go126)return"Invalid prefix ("+uo+")";ho=no(ho)^bo>>5}ho=no(ho);for(let go=0;go=go;)Eo-=go,Co.push(wo>>Eo&$o);if(bo)Eo>0&&Co.push(wo<=ho)return"Excess padding";if(wo<wo)return"Exceeds length limit";const Eo=bo.toLowerCase(),$o=bo.toUpperCase();if(bo!==Eo&&bo!==$o)return"Mixed-case string "+bo;const Co=(bo=Eo).lastIndexOf("1");if(Co===-1)return"No separator character for "+bo;if(Co===0)return"Missing prefix for "+bo;const Ro=bo.slice(0,Co),Oo=bo.slice(Co+1);if(Oo.length<6)return"Data too short";let jo=io(Ro);if(typeof jo=="string")return jo;const Bo=[];for(let Mo=0;Mo=Oo.length||Bo.push(Wo)}return jo!==ho?"Invalid checksum for "+bo:{prefix:Ro,words:Bo}}return ho=uo==="bech32"?1:734539939,{decodeUnsafe:function(bo,wo){const Eo=go(bo,wo);if(typeof Eo=="object")return Eo},decode:function(bo,wo){const Eo=go(bo,wo);if(typeof Eo=="object")return Eo;throw new Error(Eo)},encode:function(bo,wo,Eo){if(Eo=Eo||90,bo.length+7+wo.length>Eo)throw new TypeError("Exceeds length limit");let $o=io(bo=bo.toLowerCase());if(typeof $o=="string")throw new Error($o);let Co=bo+"1";for(let Ro=0;Ro>5)throw new Error("Non 5-bit word");$o=no($o)^Oo,Co+=to.charAt(Oo)}for(let Ro=0;Ro<6;++Ro)$o=no($o);$o^=ho;for(let Ro=0;Ro<6;++Ro)Co+=to.charAt($o>>5*(5-Ro)&31);return Co},toWords:ao,fromWordsUnsafe:so,fromWords:co}}eo.bech32=lo("bech32"),eo.bech32m=lo("bech32m")},s$4(i$5={exports:{}},i$5.exports),i$5.exports);(o$4=h$9)&&o$4.__esModule&&Object.prototype.hasOwnProperty.call(o$4,"default")&&o$4.default;h$9.bech32m;h$9.bech32;new Uint8Array(new Uint16Array([65279]).buffer)[0];var x$6,k$5;(function(Xr){Xr.mainnet="mainnet",Xr.testnet="testnet",Xr.regtest="regtest"})(x$6||(x$6={})),function(Xr){Xr.p2pkh="p2pkh",Xr.p2sh="p2sh",Xr.p2wpkh="p2wpkh",Xr.p2wsh="p2wsh",Xr.p2tr="p2tr"}(k$5||(k$5={}));k$5.p2pkh,x$6.mainnet,k$5.p2pkh,x$6.testnet,k$5.p2sh,x$6.mainnet,k$5.p2sh,x$6.testnet;var accountChangeEventName="accountChange";object({type:literal$3(accountChangeEventName)});var networkChangeEventName="networkChange";object({type:literal$3(networkChangeEventName)});async function getProviderOrThrow(Xr){var to;const eo=await(Xr==null?void 0:Xr())||((to=window.XverseProviders)==null?void 0:to.BitcoinProvider)||window.BitcoinProvider;if(!eo)throw new Error("No Bitcoin wallet installed");return eo}var BitcoinNetworkType=(Xr=>(Xr.Mainnet="Mainnet",Xr.Testnet="Testnet",Xr.Signet="Signet",Xr))(BitcoinNetworkType||{}),RpcIdSchema=optional$4(union$3([string$4(),number$4(),null_()])),rpcRequestMessageSchema=object({jsonrpc:literal$3("2.0"),method:string$4(),params:optional$4(union$3([array$3(unknown$3()),looseObject({}),null_()])),id:RpcIdSchema}),rpcSuccessResponseMessageSchema=object({jsonrpc:literal$3("2.0"),result:nonOptional(unknown$3()),id:RpcIdSchema}),rpcErrorResponseMessageSchema=object({jsonrpc:literal$3("2.0"),error:nonOptional(unknown$3()),id:RpcIdSchema});union$3([rpcSuccessResponseMessageSchema,rpcErrorResponseMessageSchema]);var AddressPurpose=(Xr=>(Xr.Ordinals="ordinals",Xr.Payment="payment",Xr.Stacks="stacks",Xr))(AddressPurpose||{}),AddressType=(Xr=>(Xr.p2pkh="p2pkh",Xr.p2sh="p2sh",Xr.p2wpkh="p2wpkh",Xr.p2wsh="p2wsh",Xr.p2tr="p2tr",Xr.stacks="stacks",Xr))(AddressType||{}),addressSchema=object({address:string$4(),publicKey:string$4(),purpose:enum_(AddressPurpose),addressType:enum_(AddressType)}),getAddress=async Xr=>{var ro,no;const eo=await getProviderOrThrow(Xr.getProvider),{purposes:to}=Xr.payload;if(!to)throw new Error("Address purposes are required");try{const io=lib$2.createUnsecuredToken(Xr.payload),oo=await eo.connect(io);(ro=Xr.onFinish)==null||ro.call(Xr,oo)}catch(io){console.error("[Connect] Error during address request",io),(no=Xr.onCancel)==null||no.call(Xr)}},stxGetAddressesMethodName="stx_getAddresses",stxGetAddressesParamsSchema=nullish(object({message:optional$4(string$4())}));object({...rpcRequestMessageSchema.entries,...object({method:literal$3(stxGetAddressesMethodName),params:stxGetAddressesParamsSchema,id:string$4()}).entries});var stxSignTransactionMethodName="stx_signTransaction",stxSignTransactionParamsSchema=object({transaction:string$4(),pubkey:optional$4(string$4()),broadcast:optional$4(boolean$3())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(stxSignTransactionMethodName),params:stxSignTransactionParamsSchema,id:string$4()}).entries});var walletTypes=["software","ledger"],walletTypeSchema=picklist(walletTypes),getInfoMethodName="getInfo",getInfoParamsSchema=nullish(null_());object({version:string$4(),methods:optional$4(array$3(string$4())),supports:array$3(string$4())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getInfoMethodName),params:getInfoParamsSchema,id:string$4()}).entries});var getAddressesMethodName="getAddresses",getAddressesParamsSchema=object({purposes:array$3(enum_(AddressPurpose)),message:optional$4(string$4())});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getAddressesMethodName),params:getAddressesParamsSchema,id:string$4()}).entries});var signMessageMethodName="signMessage",MessageSigningProtocols=(Xr=>(Xr.ECDSA="ECDSA",Xr.BIP322="BIP322",Xr))(MessageSigningProtocols||{}),signMessageParamsSchema=object({address:string$4(),message:string$4(),protocol:optional$4(enum_(MessageSigningProtocols))});object({signature:string$4(),messageHash:string$4(),address:string$4(),protocol:enum_(MessageSigningProtocols)});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(signMessageMethodName),params:signMessageParamsSchema,id:string$4()}).entries});var getAccountsMethodName="getAccounts",getAccountsParamsSchema=object({purposes:array$3(enum_(AddressPurpose)),message:optional$4(string$4())});array$3(object({...addressSchema.entries,...object({walletType:walletTypeSchema}).entries}));object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getAccountsMethodName),params:getAccountsParamsSchema,id:string$4()}).entries});var getBalanceMethodName="getBalance";nullish(null_());object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getBalanceMethodName),id:string$4()}).entries});var requestPermissionsMethodName="wallet_requestPermissions",requestPermissionsParamsSchema=undefined_();literal$3(!0);object({...rpcRequestMessageSchema.entries,...object({method:literal$3(requestPermissionsMethodName),params:requestPermissionsParamsSchema,id:string$4()}).entries});var renouncePermissionsMethodName="wallet_renouncePermissions",renouncePermissionsParamsSchema=undefined_();literal$3(!0);object({...rpcRequestMessageSchema.entries,...object({method:literal$3(renouncePermissionsMethodName),params:renouncePermissionsParamsSchema,id:string$4()}).entries});var getWalletTypeMethodName="wallet_getWalletType";nullish(null_());object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getWalletTypeMethodName),id:string$4()}).entries});var getRunesBalanceMethodName="runes_getBalance",getRunesBalanceParamsSchema=nullish(null_());object({balances:array$3(object({runeName:string$4(),amount:string$4(),divisibility:number$4(),symbol:string$4(),inscriptionId:nullish(string$4())}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getRunesBalanceMethodName),params:getRunesBalanceParamsSchema,id:string$4()}).entries});var transferRunesMethodName="runes_transfer",transferRunesParamsSchema=object({recipients:array$3(object({runeName:string$4(),amount:string$4(),address:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(transferRunesMethodName),params:transferRunesParamsSchema,id:string$4()}).entries});var getInscriptionsMethodName="ord_getInscriptions",getInscriptionsParamsSchema=object({offset:number$4(),limit:number$4()});object({total:number$4(),limit:number$4(),offset:number$4(),inscriptions:array$3(object({inscriptionId:string$4(),inscriptionNumber:string$4(),address:string$4(),collectionName:optional$4(string$4()),postage:string$4(),contentLength:string$4(),contentType:string$4(),timestamp:number$4(),offset:number$4(),genesisTransaction:string$4(),output:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(getInscriptionsMethodName),params:getInscriptionsParamsSchema,id:string$4()}).entries});var sendInscriptionsMethodName="ord_sendInscriptions",sendInscriptionsParamsSchema=object({transfers:array$3(object({address:string$4(),inscriptionId:string$4()}))});object({...rpcRequestMessageSchema.entries,...object({method:literal$3(sendInscriptionsMethodName),params:sendInscriptionsParamsSchema,id:string$4()}).entries});var request=async(Xr,eo,to)=>{var io;let ro=((io=window.XverseProviders)==null?void 0:io.BitcoinProvider)||window.BitcoinProvider;if(!ro)throw new Error("no wallet provider was found");if(!Xr)throw new Error("A wallet method is required");const no=await ro.request(Xr,eo);return is$7(rpcErrorResponseMessageSchema,no)?{status:"error",error:no.error}:is$7(rpcSuccessResponseMessageSchema,no)?{status:"success",result:no.result}:{status:"error",error:{code:-32603,message:"Received unknown response from provider.",data:no}}},addListener=(Xr,eo,to)=>{var no;let ro=((no=window.XverseProviders)==null?void 0:no.BitcoinProvider)||window.BitcoinProvider;if(!ro)throw new Error("no wallet provider was found");return ro.addListener?ro.addListener(Xr,eo):(console.error("The wallet provider you are using does not support the addListener method. Please update your wallet provider."),()=>{})},signMessage$1=async Xr=>{var no,io;const eo=await getProviderOrThrow(Xr.getProvider),{address:to,message:ro}=Xr.payload;if(!to)throw new Error("An address is required to sign a message");if(!ro)throw new Error("A message to be signed is required");try{const oo=lib$2.createUnsecuredToken(Xr.payload),ao=await eo.signMessage(oo);(no=Xr.onFinish)==null||no.call(Xr,ao)}catch(oo){console.error("[Connect] Error during sign message request",oo),(io=Xr.onCancel)==null||io.call(Xr)}},serializer=Xr=>Xr.map(eo=>{const{address:to,amountSats:ro}=eo;return{address:to,amountSats:ro.toString()}}),sendBtcTransaction=async Xr=>{var oo,ao;const eo=await getProviderOrThrow(Xr.getProvider),{recipients:to,senderAddress:ro,network:no,message:io}=Xr.payload;if(!to||to.length===0)throw new Error("At least one recipient is required");if(to.some(so=>typeof so.address!="string"||typeof so.amountSats!="bigint"))throw new Error("Incorrect recipient format");if(!ro)throw new Error("The sender address is required");try{const so=serializer(to),co={network:no,senderAddress:ro,message:io,recipients:so},lo=lib$2.createUnsecuredToken(co),uo=await eo.sendBtcTransaction(lo);(oo=Xr.onFinish)==null||oo.call(Xr,uo)}catch(so){console.error("[Connect] Error during send BTC transaction request",so),(ao=Xr.onCancel)==null||ao.call(Xr)}},signTransaction$1=async Xr=>{var no,io;const eo=await getProviderOrThrow(Xr.getProvider),{psbtBase64:to,inputsToSign:ro}=Xr.payload;if(!to)throw new Error("A value for psbtBase64 representing the tx hash is required");if(!ro)throw new Error("An array specifying the inputs to be signed by the wallet is required");try{const oo=lib$2.createUnsecuredToken(Xr.payload),ao=await eo.signTransaction(oo);(no=Xr.onFinish)==null||no.call(Xr,ao)}catch(oo){console.error("[Connect] Error during sign transaction request",oo),(io=Xr.onCancel)==null||io.call(Xr)}},signMultipleTransactions=async Xr=>{var ro,no;const eo=await getProviderOrThrow(Xr.getProvider),{psbts:to}=Xr.payload;if(!to||!to.length)throw new Error("psbts array is required");if(to.length>100)throw new Error("psbts array must contain less than 100 psbts");try{const io=lib$2.createUnsecuredToken(Xr.payload),oo=await eo.signMultipleTransactions(io);(ro=Xr.onFinish)==null||ro.call(Xr,oo)}catch(io){console.error("[Connect] Error during sign Multiple transactions request",io),(no=Xr.onCancel)==null||no.call(Xr)}};class BitcoinLocalStorageCache{constructor(eo){this.CONNECTED_ACCOUNTS_KEY=`bitcoin_${eo}_connectedAccounts`}getActiveAccount(){return __awaiter$i(this,void 0,void 0,function*(){const eo=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);if(!eo)return;const to=Object.keys(eo).find(ro=>eo[ro].active);if(to)return{additionalAddresses:eo[to].additionalAddresses,address:to}})}getConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){return yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY)})}getConnectedAccount(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);return to==null?void 0:to[eo]})}setConnectedAccount(eo,to){return __awaiter$i(this,void 0,void 0,function*(){let ro=yield getItemAsync(this.CONNECTED_ACCOUNTS_KEY);return ro||(ro={}),to.active&&Object.keys(ro).forEach(no=>{ro&&(ro[no].active=!1)}),ro[eo]=to,setItemAsync(this.CONNECTED_ACCOUNTS_KEY,ro)})}clearConnectedAcccounts(){return __awaiter$i(this,void 0,void 0,function*(){return removeItemAsync(this.CONNECTED_ACCOUNTS_KEY)})}}var __classPrivateFieldSet$4=function(Xr,eo,to,ro,no){if(ro==="m")throw new TypeError("Private method is not writable");if(ro==="a"&&!no)throw new TypeError("Private accessor was defined without a setter");if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return ro==="a"?no.call(Xr,to):no?no.value=to:eo.set(Xr,to),to},__classPrivateFieldGet$4=function(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)},_AppReadyEvent_detail;let wallets;const registered=new Set,listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get:get$4,on:on$1}),typeof window>"u"))return wallets;const Xr=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:eo})=>eo(Xr))}catch(eo){console.error(`wallet-standard:register-wallet event listener could not be added `,eo)}try{window.dispatchEvent(new AppReadyEvent(Xr))}catch(eo){console.error(`wallet-standard:app-ready event could not be dispatched `,eo)}return wallets}function register(...Xr){var eo;return Xr=Xr.filter(to=>!registered.has(to)),Xr.length?(Xr.forEach(to=>registered.add(to)),(eo=listeners.register)==null||eo.forEach(to=>guard$1(()=>to(...Xr))),function(){var ro;Xr.forEach(no=>registered.delete(no)),(ro=listeners.unregister)==null||ro.forEach(no=>guard$1(()=>no(...Xr)))}):()=>{}}function get$4(){return[...registered]}function on$1(Xr,eo){var to;return(to=listeners[Xr])!=null&&to.push(eo)||(listeners[Xr]=[eo]),function(){var no;listeners[Xr]=(no=listeners[Xr])==null?void 0:no.filter(io=>eo!==io)}}function guard$1(Xr){try{Xr()}catch(eo){console.error(eo)}}class AppReadyEvent extends Event{constructor(eo){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),_AppReadyEvent_detail.set(this,void 0),__classPrivateFieldSet$4(this,_AppReadyEvent_detail,eo,"f")}get detail(){return __classPrivateFieldGet$4(this,_AppReadyEvent_detail,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}_AppReadyEvent_detail=new WeakMap;class BitcoinWalletStandardWallets{registerWallets(){this.wallets=getWallets()}}class BitcoinWalletStandardWalletsSingleton{constructor(){this.bitcoinWalletStandardWallets=new BitcoinWalletStandardWallets}static get(){var eo;return!((eo=BitcoinWalletStandardWalletsSingleton.instance)===null||eo===void 0)&&eo.bitcoinWalletStandardWallets||(BitcoinWalletStandardWalletsSingleton.instance=new BitcoinWalletStandardWalletsSingleton,BitcoinWalletStandardWalletsSingleton.instance.bitcoinWalletStandardWallets.registerWallets()),BitcoinWalletStandardWalletsSingleton.instance.bitcoinWalletStandardWallets}static getWallets(){var eo;return(eo=BitcoinWalletStandardWalletsSingleton.get().wallets)===null||eo===void 0?void 0:eo.get()}}class BitcoinProviderHelper{constructor(eo){this.walletData=eo}getInjectedConfig(){if(!this.walletData||!this.walletData.injectedConfig)return;const{injectedConfig:eo}=this.walletData;return eo.find(to=>to.chain==="btc")}getProvider(){var eo;const to=this.getInjectedConfig();if(!(!((eo=to==null?void 0:to.windowLocations)===null||eo===void 0)&&eo.length))return;const ro=getProvidersFromWindow(to.windowLocations[0]);if(ro!=null&&ro.length)return ro[0]}hasAllRequiredFeatures(eo){const to=this.getInjectedConfig();if(!(to!=null&&to.walletStandard)||!eo)return!1;const{walletStandard:ro}=to;for(const no of ro.features)if(!(no in eo.features))return!1;return!0}bitcoinWalletStandardLookup(){const eo=BitcoinWalletStandardWalletsSingleton.getWallets();return eo==null?void 0:eo.find(ro=>{var no,io;return((io=(no=this.getInjectedConfig())===null||no===void 0?void 0:no.walletStandard)===null||io===void 0?void 0:io.name)===ro.name&&this.hasAllRequiredFeatures(ro)})}findWallet(){return this.bitcoinWalletStandardLookup()}getWalletMethods(eo){var to,ro,no,io;return{connect:(to=eo.features["bitcoin:connect"])===null||to===void 0?void 0:to.connect,signAndSendTransaction:(ro=eo.features["bitcoin:signAndSendTransaction"])===null||ro===void 0?void 0:ro.signAndSendTransaction,signMessage:(no=eo.features["bitcoin:signMessage"])===null||no===void 0?void 0:no.signMessage,signTransaction:(io=eo.features["bitcoin:signTransaction"])===null||io===void 0?void 0:io.signTransaction}}}const XVERSE_KEY="xverse",SATSCONNECT_FEATURE="sats-connect:",BTCKIT_INTERFACE="btckit",HTTP_STATUS_TOO_MANY_REQUESTS=429,HTTP_STATUS_NOT_FOUND=404,MEMPOOL_API_URL="https://mempool.space/api",MEMPOOL_API_URL_TESTNET="https://mempool.space/testnet/api",getMempoolApiUrl=Xr=>Xr.startsWith("t")?MEMPOOL_API_URL_TESTNET:MEMPOOL_API_URL,satoshisToBtc=Xr=>Xr/1e8;class BitcoinWallet extends Wallet$1{sendRawTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){return yield this.sync(),this._connector.sendRawTransaction(eo)})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){return yield this.sync(),this._connector.sendBitcoin(eo)})}signMessageWithAddress(eo,to){return __awaiter$i(this,void 0,void 0,function*(){var ro;yield this.sync();const no=((ro=this.additionalAddresses.find(io=>io.type===to))===null||ro===void 0?void 0:ro.address)||this.address;return this._connector.signMessage(eo,no)})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signPsbt(eo)})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signPsbts(eo)})}}class BitcoinWalletConnector extends WalletConnectorBase{constructor(eo){var to;super(eo),this.ChainWallet=BitcoinWallet,this.connectedChain="BTC",this.supportedChains=["BTC"],this.canFetchConnectedAccounts=!1,this.isHardwareWalletEnabled=!1,this.verifiedCredentials=[],this.overrideKey=(to=eo.overrideKey)!==null&&to!==void 0?to:this.key;const ro=eo.walletData||getWalletBookWallet(this.walletBook,this.key);this.bitcoinProviderHelper=new BitcoinProviderHelper(ro),this.wallet=this.bitcoinProviderHelper.findWallet(),this.wallet&&(this.walletMethods=this.bitcoinProviderHelper.getWalletMethods(this.wallet)),this.cache=new BitcoinLocalStorageCache(this.overrideKey),this.canFetchConnectedAccounts=isWalletMethodSupported(ro,"getConnectedAccounts","browserExtension")}isSameAccountChangeRequest(eo){return this.lastAccountChange===eo}setLastAccountChangeRequest(eo){this.lastAccountChange=eo}clearConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){yield this.cache.clearConnectedAcccounts()})}canConnectWithHardwareWallet(){const eo=findWalletBookWallet(this.walletBook,this.key);return!eo||!eo.hardwareWallets?!1:eo.hardwareWallets.includes("ledger")}isInstalledOnBrowser(){var eo;return!!this.wallet||!!(!((eo=this.bitcoinProviderHelper)===null||eo===void 0)&&eo.getProvider())}getDeepLink(){}endSession(){return __awaiter$i(this,void 0,void 0,function*(){yield this.cache.clearConnectedAcccounts()})}getBalance(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=getMempoolApiUrl(eo),ro=yield fetch(`${to}/address/${eo}`);if(!ro.ok)return ro.status===HTTP_STATUS_TOO_MANY_REQUESTS||ro.status===HTTP_STATUS_NOT_FOUND?"0":void 0;const no=yield ro.json();if(!(no!=null&&no.chain_stats)||!(no!=null&&no.mempool_stats))return;const io=Number(no.chain_stats.funded_txo_sum)-Number(no.chain_stats.spent_txo_sum),oo=Number(no.mempool_stats.funded_txo_sum)-Number(no.mempool_stats.spent_txo_sum);return satoshisToBtc(io+oo).toString()})}getConnectedAccountsFromCache(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=yield this.cache.getActiveAccount(),ro=yield this.cache.getConnectedAccounts(),no=(eo=Object.keys(ro||{}))!==null&&eo!==void 0?eo:[];return to!=null&&to.address?[to.address,...no.filter(io=>io!==to.address)]:no})}getConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){if(!this.canFetchConnectedAccounts)return this.getConnectedAccountsFromCache();this.getAddressPromise||(this.getAddressPromise=this.getAddress());let eo;try{eo=yield this.getAddressPromise}catch(to){logger$9.error(`${this.key} getConnectedAccounts - error fetching connected account`,to)}return this.getAddressPromise=void 0,eo?[eo]:[]})}getAdditionalAddresses(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!eo)return[];const to=yield this.cache.getConnectedAccount(eo);return(to==null?void 0:to.additionalAddresses)||[]})}setAdditionalAddresses(eo,to){return __awaiter$i(this,void 0,void 0,function*(){return this.cache.setConnectedAccount(eo,{additionalAddresses:to})})}sendRawTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!eo)throw new DynamicError("No transaction specified!");const[to]=yield this.getConnectedAccounts();if(!to)throw new DynamicError("No connected address found!");const ro=getMempoolApiUrl(to),no=yield fetch(`${ro}/tx`,{body:eo,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"});if(!no.ok){if(no.status===HTTP_STATUS_TOO_MANY_REQUESTS)throw new DynamicError("sendRawTransaction - mempool api rate limit exceeded");const io=yield no.text();throw logger$9.debug(`sendRawTransaction - response not ok: ${JSON.stringify(io)}`),new DynamicError("sendRawTransaction - failed to send transaction")}return no.text()})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){logger$9.debug("sendBitcoin - function not implemented",eo)})}getProvider(){var eo;return(eo=this.bitcoinProviderHelper)===null||eo===void 0?void 0:eo.getProvider()}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=[];for(const ro of eo){const no=yield this.signPsbt(ro);no&&to.push(no)}return to.map(ro=>ro.signedPsbt)})}setConnectedAccountWithAddresses(eo){return __awaiter$i(this,arguments,void 0,function*({mainAddress:to,ordinalsAddress:ro,paymentAddress:no,active:io}){if(!to)return;const oo=[];ro&&oo.push({address:ro.address,publicKey:ro.publicKey,type:WalletAddressType.Ordinals}),no&&oo.push({address:no.address,publicKey:no.publicKey,type:WalletAddressType.Payment}),this.cache.setConnectedAccount(to,{active:io,additionalAddresses:oo})})}setupEventListeners(){const eo=this.getProvider();if(!(eo!=null&&eo.on))return;const{handleAccountChange:to,handleChainChange:ro,handleDisconnect:no}=eventListenerHandlers(this),io=ao=>__awaiter$i(this,void 0,void 0,function*(){let so=ao,co,lo;typeof ao[0]=="object"&&(so=ao.sort(ho=>ho.purpose===AddressPurpose.Ordinals?-1:1).map(ho=>ho.address),[co,lo]=so),!((yield this.getConnectedAccountsFromCache())[0]===so[0]||this.isSameAccountChangeRequest(so[0]))&&(this.setLastAccountChangeRequest(so[0]),(co||lo)&&this.setConnectedAccountWithAddresses({active:!0,mainAddress:co??lo,ordinalsAddress:co,paymentAddress:lo}),to(so))});eo.on("accountsChanged",io),eo.on("networkChanged",ro),eo.on("disconnect",no);const oo=()=>{const ao=this.getProvider();ao!=null&&ao.removeListener&&(ao.removeListener("accountsChanged",io),ao.removeListener("networkChanged",ro),ao.removeListener("disconnect",no))};this.teardownEventListeners=oo}setVerifiedCredentials(eo){this.verifiedCredentials=eo}isLedgerAddress(eo){return isLedgerAddressViaVerifiedCredentials(eo,this.verifiedCredentials)}proveOwnership(eo,to){return __awaiter$i(this,void 0,void 0,function*(){return this.signMessage(to,eo)})}}var src$3={},address={},networks$1={};Object.defineProperty(networks$1,"__esModule",{value:!0});networks$1.testnet=networks$1.regtest=networks$1.bitcoin=void 0;networks$1.bitcoin={messagePrefix:`Bitcoin Signed Message: `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};networks$1.regtest={messagePrefix:`Bitcoin Signed Message: `,bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};networks$1.testnet={messagePrefix:`Bitcoin Signed Message: -`,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var payments$3={},embed={},script$1={},bip66$1={};Object.defineProperty(bip66$1,"__esModule",{value:!0});bip66$1.encode=bip66$1.decode=bip66$1.check=void 0;function check$d(Xr){if(Xr.length<8||Xr.length>72||Xr[0]!==48||Xr[1]!==Xr.length-2||Xr[2]!==2)return!1;const eo=Xr[3];if(eo===0||5+eo>=Xr.length||Xr[4+eo]!==2)return!1;const to=Xr[5+eo];return!(to===0||6+eo+to!==Xr.length||Xr[4]&128||eo>1&&Xr[4]===0&&!(Xr[5]&128)||Xr[eo+6]&128||to>1&&Xr[eo+6]===0&&!(Xr[eo+7]&128))}bip66$1.check=check$d;function decode$o(Xr){if(Xr.length<8)throw new Error("DER sequence length is too short");if(Xr.length>72)throw new Error("DER sequence length is too long");if(Xr[0]!==48)throw new Error("Expected DER sequence");if(Xr[1]!==Xr.length-2)throw new Error("DER sequence length is invalid");if(Xr[2]!==2)throw new Error("Expected DER integer");const eo=Xr[3];if(eo===0)throw new Error("R length is zero");if(5+eo>=Xr.length)throw new Error("R length is too long");if(Xr[4+eo]!==2)throw new Error("Expected DER integer (2)");const to=Xr[5+eo];if(to===0)throw new Error("S length is zero");if(6+eo+to!==Xr.length)throw new Error("S length is invalid");if(Xr[4]&128)throw new Error("R value is negative");if(eo>1&&Xr[4]===0&&!(Xr[5]&128))throw new Error("R value excessively padded");if(Xr[eo+6]&128)throw new Error("S value is negative");if(to>1&&Xr[eo+6]===0&&!(Xr[eo+7]&128))throw new Error("S value excessively padded");return{r:Xr.slice(4,4+eo),s:Xr.slice(6+eo)}}bip66$1.decode=decode$o;function encode$m(Xr,eo){const to=Xr.length,ro=eo.length;if(to===0)throw new Error("R length is zero");if(ro===0)throw new Error("S length is zero");if(to>33)throw new Error("R length is too long");if(ro>33)throw new Error("S length is too long");if(Xr[0]&128)throw new Error("R value is negative");if(eo[0]&128)throw new Error("S value is negative");if(to>1&&Xr[0]===0&&!(Xr[1]&128))throw new Error("R value excessively padded");if(ro>1&&eo[0]===0&&!(eo[1]&128))throw new Error("S value excessively padded");const no=Buffer$3.allocUnsafe(6+to+ro);return no[0]=48,no[1]=no.length-2,no[2]=2,no[3]=Xr.length,Xr.copy(no,4),no[4+to]=2,no[5+to]=eo.length,eo.copy(no,6+to),no}bip66$1.encode=encode$m;var ops={};Object.defineProperty(ops,"__esModule",{value:!0});ops.REVERSE_OPS=ops.OPS=void 0;const OPS$8={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};ops.OPS=OPS$8;const REVERSE_OPS={};ops.REVERSE_OPS=REVERSE_OPS;for(const Xr of Object.keys(OPS$8)){const eo=OPS$8[Xr];REVERSE_OPS[eo]=Xr}var push_data={};Object.defineProperty(push_data,"__esModule",{value:!0});push_data.decode=push_data.encode=push_data.encodingLength=void 0;const ops_1=ops;function encodingLength$2(Xr){return XrXr.length)return null;ro=Xr.readUInt8(eo+1),no=2}else if(to===ops_1.OPS.OP_PUSHDATA2){if(eo+3>Xr.length)return null;ro=Xr.readUInt16LE(eo+1),no=3}else{if(eo+5>Xr.length)return null;if(to!==ops_1.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");ro=Xr.readUInt32LE(eo+1),no=5}return{opcode:to,number:ro,size:no}}push_data.decode=decode$n;var script_number={};Object.defineProperty(script_number,"__esModule",{value:!0});script_number.encode=script_number.decode=void 0;function decode$m(Xr,eo,to){eo=eo||4,to=to===void 0?!0:to;const ro=Xr.length;if(ro===0)return 0;if(ro>eo)throw new TypeError("Script number overflow");if(to&&!(Xr[ro-1]&127)&&(ro<=1||!(Xr[ro-2]&128)))throw new Error("Non-minimally encoded script number");if(ro===5){const io=Xr.readUInt32LE(0),oo=Xr.readUInt8(4);return oo&128?-((oo&-129)*4294967296+io):oo*4294967296+io}let no=0;for(let io=0;io2147483647?5:Xr>8388607?4:Xr>32767?3:Xr>127?2:Xr>0?1:0}function encode$k(Xr){let eo=Math.abs(Xr);const to=scriptNumSize(eo),ro=Buffer$3.allocUnsafe(to),no=Xr<0;for(let io=0;io>=8;return ro[to-1]&128?ro.writeUInt8(no?128:0,to-1):no&&(ro[to-1]|=128),ro}script_number.encode=encode$k;var script_signature={},types$7={},types$6={Array:function(Xr){return Xr!=null&&Xr.constructor===Array},Boolean:function(Xr){return typeof Xr=="boolean"},Function:function(Xr){return typeof Xr=="function"},Nil:function(Xr){return Xr==null},Number:function(Xr){return typeof Xr=="number"},Object:function(Xr){return typeof Xr=="object"},String:function(Xr){return typeof Xr=="string"},"":function(){return!0}};types$6.Null=types$6.Nil;for(var typeName$1 in types$6)types$6[typeName$1].toJSON=(function(Xr){return Xr}).bind(null,typeName$1);var native$2=types$6,native$1=native$2;function getTypeName(Xr){return Xr.name||Xr.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName$1(Xr){return native$1.Nil(Xr)?"":getTypeName(Xr.constructor)}function getValue(Xr){return native$1.Function(Xr)?"":native$1.String(Xr)?JSON.stringify(Xr):Xr&&native$1.Object(Xr)?"":Xr}function captureStackTrace(Xr,eo){Error.captureStackTrace&&Error.captureStackTrace(Xr,eo)}function tfJSON$1(Xr){return native$1.Function(Xr)?Xr.toJSON?Xr.toJSON():getTypeName(Xr):native$1.Array(Xr)?"Array":Xr&&native$1.Object(Xr)?"Object":Xr!==void 0?Xr:""}function tfErrorString(Xr,eo,to){var ro=getValue(eo);return"Expected "+tfJSON$1(Xr)+", got"+(to!==""?" "+to:"")+(ro!==""?" "+ro:"")}function TfTypeError$1(Xr,eo,to){to=to||getValueTypeName$1(eo),this.message=tfErrorString(Xr,eo,to),captureStackTrace(this,TfTypeError$1),this.__type=Xr,this.__value=eo,this.__valueTypeName=to}TfTypeError$1.prototype=Object.create(Error.prototype);TfTypeError$1.prototype.constructor=TfTypeError$1;function tfPropertyErrorString(Xr,eo,to,ro,no){var io='" of type ';return eo==="key"&&(io='" with key type '),tfErrorString('property "'+tfJSON$1(to)+io+tfJSON$1(Xr),ro,no)}function TfPropertyTypeError$1(Xr,eo,to,ro,no){Xr?(no=no||getValueTypeName$1(ro),this.message=tfPropertyErrorString(Xr,to,eo,ro,no)):this.message='Unexpected property "'+eo+'"',captureStackTrace(this,TfTypeError$1),this.__label=to,this.__property=eo,this.__type=Xr,this.__value=ro,this.__valueTypeName=no}TfPropertyTypeError$1.prototype=Object.create(Error.prototype);TfPropertyTypeError$1.prototype.constructor=TfTypeError$1;function tfCustomError(Xr,eo){return new TfTypeError$1(Xr,{},eo)}function tfSubError$1(Xr,eo,to){return Xr instanceof TfPropertyTypeError$1?(eo=eo+"."+Xr.__property,Xr=new TfPropertyTypeError$1(Xr.__type,eo,Xr.__label,Xr.__value,Xr.__valueTypeName)):Xr instanceof TfTypeError$1&&(Xr=new TfPropertyTypeError$1(Xr.__type,eo,to,Xr.__value,Xr.__valueTypeName)),captureStackTrace(Xr),Xr}var errors$2={TfTypeError:TfTypeError$1,TfPropertyTypeError:TfPropertyTypeError$1,tfCustomError,tfSubError:tfSubError$1,tfJSON:tfJSON$1,getValueTypeName:getValueTypeName$1},extra,hasRequiredExtra;function requireExtra(){if(hasRequiredExtra)return extra;hasRequiredExtra=1;var Xr=native$2,eo=errors$2;function to(Mo){return Buffer$3.isBuffer(Mo)}function ro(Mo){return typeof Mo=="string"&&/^([0-9a-f]{2})+$/i.test(Mo)}function no(Mo,No){var Do=Mo.toJSON();function Fo(Xo){if(!Mo(Xo))return!1;if(Xo.length===No)return!0;throw eo.tfCustomError(Do+"(Length: "+No+")",Do+"(Length: "+Xo.length+")")}return Fo.toJSON=function(){return Do},Fo}var io=no.bind(null,Xr.Array),oo=no.bind(null,to),ao=no.bind(null,ro),so=no.bind(null,Xr.String);function co(Mo,No,Do){Do=Do||Xr.Number;function Fo(Xo,Lo){return Do(Xo,Lo)&&Xo>Mo&&Xo>24===Mo}function go(Mo){return Mo<<16>>16===Mo}function yo(Mo){return(Mo|0)===Mo}function vo(Mo){return typeof Mo=="number"&&Mo>=-lo&&Mo<=lo&&Math.floor(Mo)===Mo}function wo(Mo){return(Mo&255)===Mo}function Eo(Mo){return(Mo&65535)===Mo}function ko(Mo){return Mo>>>0===Mo}function Ao(Mo){return typeof Mo=="number"&&Mo>=0&&Mo<=lo&&Math.floor(Mo)===Mo}var Po={ArrayN:io,Buffer:to,BufferN:oo,Finite:fo,Hex:ro,HexN:ao,Int8:ho,Int16:go,Int32:yo,Int53:vo,Range:co,StringN:so,UInt8:wo,UInt16:Eo,UInt32:ko,UInt53:Ao};for(var jo in Po)Po[jo].toJSON=(function(Mo){return Mo}).bind(null,jo);return extra=Po,extra}var ERRORS=errors$2,NATIVE=native$2,tfJSON=ERRORS.tfJSON,TfTypeError=ERRORS.TfTypeError,TfPropertyTypeError=ERRORS.TfPropertyTypeError,tfSubError=ERRORS.tfSubError,getValueTypeName=ERRORS.getValueTypeName,TYPES={arrayOf:function Xr(eo,to){eo=compile(eo),to=to||{};function ro(no,io){return!NATIVE.Array(no)||NATIVE.Nil(no)||to.minLength!==void 0&&no.lengthto.maxLength||to.length!==void 0&&no.length!==to.length?!1:no.every(function(oo,ao){try{return typeforce$4(eo,oo,io)}catch(so){throw tfSubError(so,ao)}})}return ro.toJSON=function(){var no="["+tfJSON(eo)+"]";return to.length!==void 0?no+="{"+to.length+"}":(to.minLength!==void 0||to.maxLength!==void 0)&&(no+="{"+(to.minLength===void 0?0:to.minLength)+","+(to.maxLength===void 0?1/0:to.maxLength)+"}"),no},ro},maybe:function Xr(eo){eo=compile(eo);function to(ro,no){return NATIVE.Nil(ro)||eo(ro,no,Xr)}return to.toJSON=function(){return"?"+tfJSON(eo)},to},map:function Xr(eo,to){eo=compile(eo),to&&(to=compile(to));function ro(no,io){if(!NATIVE.Object(no)||NATIVE.Nil(no))return!1;for(var oo in no){try{to&&typeforce$4(to,oo,io)}catch(so){throw tfSubError(so,oo,"key")}try{var ao=no[oo];typeforce$4(eo,ao,io)}catch(so){throw tfSubError(so,oo)}}return!0}return to?ro.toJSON=function(){return"{"+tfJSON(to)+": "+tfJSON(eo)+"}"}:ro.toJSON=function(){return"{"+tfJSON(eo)+"}"},ro},object:function Xr(eo){var to={};for(var ro in eo)to[ro]=compile(eo[ro]);function no(io,oo){if(!NATIVE.Object(io)||NATIVE.Nil(io))return!1;var ao;try{for(ao in to){var so=to[ao],co=io[ao];typeforce$4(so,co,oo)}}catch(lo){throw tfSubError(lo,ao)}if(oo){for(ao in io)if(!to[ao])throw new TfPropertyTypeError(void 0,ao)}return!0}return no.toJSON=function(){return tfJSON(to)},no},anyOf:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return eo.some(function(io){try{return typeforce$4(io,ro,no)}catch{return!1}})}return to.toJSON=function(){return eo.map(tfJSON).join("|")},to},allOf:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return eo.every(function(io){try{return typeforce$4(io,ro,no)}catch{return!1}})}return to.toJSON=function(){return eo.map(tfJSON).join(" & ")},to},quacksLike:function Xr(eo){function to(ro){return eo===getValueTypeName(ro)}return to.toJSON=function(){return eo},to},tuple:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return NATIVE.Nil(ro)||NATIVE.Nil(ro.length)||no&&ro.length!==eo.length?!1:eo.every(function(io,oo){try{return typeforce$4(io,ro[oo],no)}catch(ao){throw tfSubError(ao,oo)}})}return to.toJSON=function(){return"("+eo.map(tfJSON).join(", ")+")"},to},value:function Xr(eo){function to(ro){return ro===eo}return to.toJSON=function(){return eo},to}};TYPES.oneOf=TYPES.anyOf;function compile(Xr){if(NATIVE.String(Xr))return Xr[0]==="?"?TYPES.maybe(Xr.slice(1)):NATIVE[Xr]||TYPES.quacksLike(Xr);if(Xr&&NATIVE.Object(Xr)){if(NATIVE.Array(Xr)){if(Xr.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(Xr[0])}return TYPES.object(Xr)}else if(NATIVE.Function(Xr))return Xr;return TYPES.value(Xr)}function typeforce$4(Xr,eo,to,ro){if(NATIVE.Function(Xr)){if(Xr(eo,to))return!0;throw new TfTypeError(ro||Xr,eo)}return typeforce$4(compile(Xr),eo,to)}for(var typeName in NATIVE)typeforce$4[typeName]=NATIVE[typeName];for(typeName in TYPES)typeforce$4[typeName]=TYPES[typeName];var EXTRA$1=requireExtra();for(typeName in EXTRA$1)typeforce$4[typeName]=EXTRA$1[typeName];typeforce$4.compile=compile;typeforce$4.TfTypeError=TfTypeError;typeforce$4.TfPropertyTypeError=TfPropertyTypeError;var typeforce_1=typeforce$4;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.oneOf=Xr.Null=Xr.BufferN=Xr.Function=Xr.UInt32=Xr.UInt8=Xr.tuple=Xr.maybe=Xr.Hex=Xr.Buffer=Xr.String=Xr.Boolean=Xr.Array=Xr.Number=Xr.Hash256bit=Xr.Hash160bit=Xr.Buffer256bit=Xr.isTaptree=Xr.isTapleaf=Xr.TAPLEAF_VERSION_MASK=Xr.Network=Xr.ECPoint=Xr.Satoshi=Xr.Signer=Xr.BIP32Path=Xr.UInt31=Xr.isPoint=Xr.typeforce=void 0;const eo=require$$0$9;Xr.typeforce=typeforce_1;const to=eo.Buffer.alloc(32,0),ro=eo.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function no(go){if(!eo.Buffer.isBuffer(go)||go.length<33)return!1;const yo=go[0],vo=go.slice(1,33);if(vo.compare(to)===0||vo.compare(ro)>=0)return!1;if((yo===2||yo===3)&&go.length===33)return!0;const wo=go.slice(33);return wo.compare(to)===0||wo.compare(ro)>=0?!1:yo===4&&go.length===65}Xr.isPoint=no;const io=Math.pow(2,31)-1;function oo(go){return Xr.typeforce.UInt32(go)&&go<=io}Xr.UInt31=oo;function ao(go){return Xr.typeforce.String(go)&&!!go.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}Xr.BIP32Path=ao,ao.toJSON=()=>"BIP32 derivation path";function so(go){return(Xr.typeforce.Buffer(go.publicKey)||typeof go.getPublicKey=="function")&&typeof go.sign=="function"}Xr.Signer=so;const co=21*1e14;function lo(go){return Xr.typeforce.UInt53(go)&&go<=co}Xr.Satoshi=lo,Xr.ECPoint=Xr.typeforce.quacksLike("Point"),Xr.Network=Xr.typeforce.compile({messagePrefix:Xr.typeforce.oneOf(Xr.typeforce.Buffer,Xr.typeforce.String),bip32:{public:Xr.typeforce.UInt32,private:Xr.typeforce.UInt32},pubKeyHash:Xr.typeforce.UInt8,scriptHash:Xr.typeforce.UInt8,wif:Xr.typeforce.UInt8}),Xr.TAPLEAF_VERSION_MASK=254;function fo(go){return!go||!("output"in go)||!eo.Buffer.isBuffer(go.output)?!1:go.version!==void 0?(go.version&Xr.TAPLEAF_VERSION_MASK)===go.version:!0}Xr.isTapleaf=fo;function ho(go){return(0,Xr.Array)(go)?go.length!==2?!1:go.every(yo=>ho(yo)):fo(go)}Xr.isTaptree=ho,Xr.Buffer256bit=Xr.typeforce.BufferN(32),Xr.Hash160bit=Xr.typeforce.BufferN(20),Xr.Hash256bit=Xr.typeforce.BufferN(32),Xr.Number=Xr.typeforce.Number,Xr.Array=Xr.typeforce.Array,Xr.Boolean=Xr.typeforce.Boolean,Xr.String=Xr.typeforce.String,Xr.Buffer=Xr.typeforce.Buffer,Xr.Hex=Xr.typeforce.Hex,Xr.maybe=Xr.typeforce.maybe,Xr.tuple=Xr.typeforce.tuple,Xr.UInt8=Xr.typeforce.UInt8,Xr.UInt32=Xr.typeforce.UInt32,Xr.Function=Xr.typeforce.Function,Xr.BufferN=Xr.typeforce.BufferN,Xr.Null=Xr.typeforce.Null,Xr.oneOf=Xr.typeforce.oneOf})(types$7);Object.defineProperty(script_signature,"__esModule",{value:!0});script_signature.encode=script_signature.decode=void 0;const bip66=bip66$1,types$5=types$7,{typeforce:typeforce$3}=types$5,ZERO$2=Buffer$3.alloc(1,0);function toDER(Xr){let eo=0;for(;Xr[eo]===0;)++eo;return eo===Xr.length?ZERO$2:(Xr=Xr.slice(eo),Xr[0]&128?Buffer$3.concat([ZERO$2,Xr],1+Xr.length):Xr)}function fromDER(Xr){Xr[0]===0&&(Xr=Xr.slice(1));const eo=Buffer$3.alloc(32,0),to=Math.max(0,32-Xr.length);return Xr.copy(eo,to),eo}function decode$l(Xr){const eo=Xr.readUInt8(Xr.length-1),to=eo&-129;if(to<=0||to>=4)throw new Error("Invalid hashType "+eo);const ro=bip66.decode(Xr.slice(0,-1)),no=fromDER(ro.r),io=fromDER(ro.s);return{signature:Buffer$3.concat([no,io],64),hashType:eo}}script_signature.decode=decode$l;function encode$j(Xr,eo){typeforce$3({signature:types$5.BufferN(64),hashType:types$5.UInt8},{signature:Xr,hashType:eo});const to=eo&-129;if(to<=0||to>=4)throw new Error("Invalid hashType "+eo);const ro=Buffer$3.allocUnsafe(1);ro.writeUInt8(eo,0);const no=toDER(Xr.slice(0,32)),io=toDER(Xr.slice(32,64));return Buffer$3.concat([bip66.encode(no,io),ro])}script_signature.encode=encode$j;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.signature=Xr.number=Xr.isCanonicalScriptSignature=Xr.isDefinedHashType=Xr.isCanonicalPubKey=Xr.toStack=Xr.fromASM=Xr.toASM=Xr.decompile=Xr.compile=Xr.countNonPushOnlyOPs=Xr.isPushOnly=Xr.OPS=void 0;const eo=bip66$1,to=ops;Object.defineProperty(Xr,"OPS",{enumerable:!0,get:function(){return to.OPS}});const ro=push_data,no=script_number,io=script_signature,oo=types$7,{typeforce:ao}=oo,so=to.OPS.OP_RESERVED;function co(Fo){return oo.Number(Fo)&&(Fo===to.OPS.OP_0||Fo>=to.OPS.OP_1&&Fo<=to.OPS.OP_16||Fo===to.OPS.OP_1NEGATE)}function lo(Fo){return oo.Buffer(Fo)||co(Fo)}function fo(Fo){return oo.Array(Fo)&&Fo.every(lo)}Xr.isPushOnly=fo;function ho(Fo){return Fo.length-Fo.filter(lo).length}Xr.countNonPushOnlyOPs=ho;function go(Fo){if(Fo.length===0)return to.OPS.OP_0;if(Fo.length===1){if(Fo[0]>=1&&Fo[0]<=16)return so+Fo[0];if(Fo[0]===129)return to.OPS.OP_1NEGATE}}function yo(Fo){return Buffer$3.isBuffer(Fo)}function vo(Fo){return oo.Array(Fo)}function wo(Fo){return Buffer$3.isBuffer(Fo)}function Eo(Fo){if(yo(Fo))return Fo;ao(oo.Array,Fo);const Xo=Fo.reduce((xo,uo)=>wo(uo)?uo.length===1&&go(uo)!==void 0?xo+1:xo+ro.encodingLength(uo.length)+uo.length:xo+1,0),Lo=Buffer$3.allocUnsafe(Xo);let Bo=0;if(Fo.forEach(xo=>{if(wo(xo)){const uo=go(xo);if(uo!==void 0){Lo.writeUInt8(uo,Bo),Bo+=1;return}Bo+=ro.encode(Lo,xo.length,Bo),xo.copy(Lo,Bo),Bo+=xo.length}else Lo.writeUInt8(xo,Bo),Bo+=1}),Bo!==Lo.length)throw new Error("Could not decode chunks");return Lo}Xr.compile=Eo;function ko(Fo){if(vo(Fo))return Fo;ao(oo.Buffer,Fo);const Xo=[];let Lo=0;for(;Loto.OPS.OP_0&&Bo<=to.OPS.OP_PUSHDATA4){const xo=ro.decode(Fo,Lo);if(xo===null||(Lo+=xo.size,Lo+xo.number>Fo.length))return null;const uo=Fo.slice(Lo,Lo+xo.number);Lo+=xo.number;const po=go(uo);po!==void 0?Xo.push(po):Xo.push(uo)}else Xo.push(Bo),Lo+=1}return Xo}Xr.decompile=ko;function Ao(Fo){return yo(Fo)&&(Fo=ko(Fo)),Fo.map(Xo=>{if(wo(Xo)){const Lo=go(Xo);if(Lo===void 0)return Xo.toString("hex");Xo=Lo}return to.REVERSE_OPS[Xo]}).join(" ")}Xr.toASM=Ao;function Po(Fo){return ao(oo.String,Fo),Eo(Fo.split(" ").map(Xo=>to.OPS[Xo]!==void 0?to.OPS[Xo]:(ao(oo.Hex,Xo),Buffer$3.from(Xo,"hex"))))}Xr.fromASM=Po;function jo(Fo){return Fo=ko(Fo),ao(fo,Fo),Fo.map(Xo=>wo(Xo)?Xo:Xo===to.OPS.OP_0?Buffer$3.allocUnsafe(0):no.encode(Xo-so))}Xr.toStack=jo;function Mo(Fo){return oo.isPoint(Fo)}Xr.isCanonicalPubKey=Mo;function No(Fo){const Xo=Fo&-129;return Xo>0&&Xo<4}Xr.isDefinedHashType=No;function Do(Fo){return!Buffer$3.isBuffer(Fo)||!No(Fo[Fo.length-1])?!1:eo.check(Fo.slice(0,-1))}Xr.isCanonicalScriptSignature=Do,Xr.number=no,Xr.signature=io})(script$1);var lazy$8={};Object.defineProperty(lazy$8,"__esModule",{value:!0});lazy$8.value=lazy$8.prop=void 0;function prop(Xr,eo,to){Object.defineProperty(Xr,eo,{configurable:!0,enumerable:!0,get(){const ro=to.call(this);return this[eo]=ro,ro},set(ro){Object.defineProperty(this,eo,{configurable:!0,enumerable:!0,value:ro,writable:!0})}})}lazy$8.prop=prop;function value(Xr){let eo;return()=>(eo!==void 0||(eo=Xr()),eo)}lazy$8.value=value;Object.defineProperty(embed,"__esModule",{value:!0});embed.p2data=void 0;const networks_1$8=networks$1,bscript$b=script$1,types_1$9=types$7,lazy$7=lazy$8,OPS$7=bscript$b.OPS;function stacksEqual$4(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2data(Xr,eo){if(!Xr.data&&!Xr.output)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$9.typeforce)({network:types_1$9.typeforce.maybe(types_1$9.typeforce.Object),output:types_1$9.typeforce.maybe(types_1$9.typeforce.Buffer),data:types_1$9.typeforce.maybe(types_1$9.typeforce.arrayOf(types_1$9.typeforce.Buffer))},Xr);const ro={name:"embed",network:Xr.network||networks_1$8.bitcoin};if(lazy$7.prop(ro,"output",()=>{if(Xr.data)return bscript$b.compile([OPS$7.OP_RETURN].concat(Xr.data))}),lazy$7.prop(ro,"data",()=>{if(Xr.output)return bscript$b.decompile(Xr.output).slice(1)}),eo.validate&&Xr.output){const no=bscript$b.decompile(Xr.output);if(no[0]!==OPS$7.OP_RETURN)throw new TypeError("Output is invalid");if(!no.slice(1).every(types_1$9.typeforce.Buffer))throw new TypeError("Output is invalid");if(Xr.data&&!stacksEqual$4(Xr.data,ro.data))throw new TypeError("Data mismatch")}return Object.assign(ro,Xr)}embed.p2data=p2data;var p2ms$1={};Object.defineProperty(p2ms$1,"__esModule",{value:!0});p2ms$1.p2ms=void 0;const networks_1$7=networks$1,bscript$a=script$1,types_1$8=types$7,lazy$6=lazy$8,OPS$6=bscript$a.OPS,OP_INT_BASE=OPS$6.OP_RESERVED;function stacksEqual$3(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2ms(Xr,eo){if(!Xr.input&&!Xr.output&&!(Xr.pubkeys&&Xr.m!==void 0)&&!Xr.signatures)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{});function to(so){return bscript$a.isCanonicalScriptSignature(so)||(eo.allowIncomplete&&so===OPS$6.OP_0)!==void 0}(0,types_1$8.typeforce)({network:types_1$8.typeforce.maybe(types_1$8.typeforce.Object),m:types_1$8.typeforce.maybe(types_1$8.typeforce.Number),n:types_1$8.typeforce.maybe(types_1$8.typeforce.Number),output:types_1$8.typeforce.maybe(types_1$8.typeforce.Buffer),pubkeys:types_1$8.typeforce.maybe(types_1$8.typeforce.arrayOf(types_1$8.isPoint)),signatures:types_1$8.typeforce.maybe(types_1$8.typeforce.arrayOf(to)),input:types_1$8.typeforce.maybe(types_1$8.typeforce.Buffer)},Xr);const no={network:Xr.network||networks_1$7.bitcoin};let io=[],oo=!1;function ao(so){oo||(oo=!0,io=bscript$a.decompile(so),no.m=io[0]-OP_INT_BASE,no.n=io[io.length-2]-OP_INT_BASE,no.pubkeys=io.slice(1,-2))}if(lazy$6.prop(no,"output",()=>{if(Xr.m&&no.n&&Xr.pubkeys)return bscript$a.compile([].concat(OP_INT_BASE+Xr.m,Xr.pubkeys,OP_INT_BASE+no.n,OPS$6.OP_CHECKMULTISIG))}),lazy$6.prop(no,"m",()=>{if(no.output)return ao(no.output),no.m}),lazy$6.prop(no,"n",()=>{if(no.pubkeys)return no.pubkeys.length}),lazy$6.prop(no,"pubkeys",()=>{if(Xr.output)return ao(Xr.output),no.pubkeys}),lazy$6.prop(no,"signatures",()=>{if(Xr.input)return bscript$a.decompile(Xr.input).slice(1)}),lazy$6.prop(no,"input",()=>{if(Xr.signatures)return bscript$a.compile([OPS$6.OP_0].concat(Xr.signatures))}),lazy$6.prop(no,"witness",()=>{if(no.input)return[]}),lazy$6.prop(no,"name",()=>{if(!(!no.m||!no.n))return`p2ms(${no.m} of ${no.n})`}),eo.validate){if(Xr.output){if(ao(Xr.output),!types_1$8.typeforce.Number(io[0]))throw new TypeError("Output is invalid");if(!types_1$8.typeforce.Number(io[io.length-2]))throw new TypeError("Output is invalid");if(io[io.length-1]!==OPS$6.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(no.m<=0||no.n>16||no.m>no.n||no.n!==io.length-3)throw new TypeError("Output is invalid");if(!no.pubkeys.every(so=>(0,types_1$8.isPoint)(so)))throw new TypeError("Output is invalid");if(Xr.m!==void 0&&Xr.m!==no.m)throw new TypeError("m mismatch");if(Xr.n!==void 0&&Xr.n!==no.n)throw new TypeError("n mismatch");if(Xr.pubkeys&&!stacksEqual$3(Xr.pubkeys,no.pubkeys))throw new TypeError("Pubkeys mismatch")}if(Xr.pubkeys){if(Xr.n!==void 0&&Xr.n!==Xr.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(no.n=Xr.pubkeys.length,no.nno.m)throw new TypeError("Too many signatures provided")}if(Xr.input){if(Xr.input[0]!==OPS$6.OP_0)throw new TypeError("Input is invalid");if(no.signatures.length===0||!no.signatures.every(to))throw new TypeError("Input has invalid signature(s)");if(Xr.signatures&&!stacksEqual$3(Xr.signatures,no.signatures))throw new TypeError("Signature mismatch");if(Xr.m!==void 0&&Xr.m!==Xr.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(no,Xr)}p2ms$1.p2ms=p2ms;var p2pk$1={};Object.defineProperty(p2pk$1,"__esModule",{value:!0});p2pk$1.p2pk=void 0;const networks_1$6=networks$1,bscript$9=script$1,types_1$7=types$7,lazy$5=lazy$8,OPS$5=bscript$9.OPS;function p2pk(Xr,eo){if(!Xr.input&&!Xr.output&&!Xr.pubkey&&!Xr.input&&!Xr.signature)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$7.typeforce)({network:types_1$7.typeforce.maybe(types_1$7.typeforce.Object),output:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer),pubkey:types_1$7.typeforce.maybe(types_1$7.isPoint),signature:types_1$7.typeforce.maybe(bscript$9.isCanonicalScriptSignature),input:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer)},Xr);const to=lazy$5.value(()=>bscript$9.decompile(Xr.input)),no={name:"p2pk",network:Xr.network||networks_1$6.bitcoin};if(lazy$5.prop(no,"output",()=>{if(Xr.pubkey)return bscript$9.compile([Xr.pubkey,OPS$5.OP_CHECKSIG])}),lazy$5.prop(no,"pubkey",()=>{if(Xr.output)return Xr.output.slice(1,-1)}),lazy$5.prop(no,"signature",()=>{if(Xr.input)return to()[0]}),lazy$5.prop(no,"input",()=>{if(Xr.signature)return bscript$9.compile([Xr.signature])}),lazy$5.prop(no,"witness",()=>{if(no.input)return[]}),eo.validate){if(Xr.output){if(Xr.output[Xr.output.length-1]!==OPS$5.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,types_1$7.isPoint)(no.pubkey))throw new TypeError("Output pubkey is invalid");if(Xr.pubkey&&!Xr.pubkey.equals(no.pubkey))throw new TypeError("Pubkey mismatch")}if(Xr.signature&&Xr.input&&!Xr.input.equals(no.input))throw new TypeError("Signature mismatch");if(Xr.input){if(to().length!==1)throw new TypeError("Input is invalid");if(!bscript$9.isCanonicalScriptSignature(no.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(no,Xr)}p2pk$1.p2pk=p2pk;var p2pkh$1={},crypto$3={},sha1$1={};Object.defineProperty(sha1$1,"__esModule",{value:!0});sha1$1.sha1=sha1$1.SHA1=void 0;const _md_js_1=_md,utils_js_1=utils$e,SHA1_IV=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),SHA1_W=new Uint32Array(80);class SHA1 extends _md_js_1.HashMD{constructor(){super(64,20,8,!1),this.A=SHA1_IV[0]|0,this.B=SHA1_IV[1]|0,this.C=SHA1_IV[2]|0,this.D=SHA1_IV[3]|0,this.E=SHA1_IV[4]|0}get(){const{A:eo,B:to,C:ro,D:no,E:io}=this;return[eo,to,ro,no,io]}set(eo,to,ro,no,io){this.A=eo|0,this.B=to|0,this.C=ro|0,this.D=no|0,this.E=io|0}process(eo,to){for(let so=0;so<16;so++,to+=4)SHA1_W[so]=eo.getUint32(to,!1);for(let so=16;so<80;so++)SHA1_W[so]=(0,utils_js_1.rotl)(SHA1_W[so-3]^SHA1_W[so-8]^SHA1_W[so-14]^SHA1_W[so-16],1);let{A:ro,B:no,C:io,D:oo,E:ao}=this;for(let so=0;so<80;so++){let co,lo;so<20?(co=(0,_md_js_1.Chi)(no,io,oo),lo=1518500249):so<40?(co=no^io^oo,lo=1859775393):so<60?(co=(0,_md_js_1.Maj)(no,io,oo),lo=2400959708):(co=no^io^oo,lo=3395469782);const fo=(0,utils_js_1.rotl)(ro,5)+co+ao+lo+SHA1_W[so]|0;ao=oo,oo=io,io=(0,utils_js_1.rotl)(no,30),no=ro,ro=fo}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,this.set(ro,no,io,oo,ao)}roundClean(){SHA1_W.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}sha1$1.SHA1=SHA1;sha1$1.sha1=(0,utils_js_1.wrapConstructor)(()=>new SHA1);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.taggedHash=Xr.TAGGED_HASH_PREFIXES=Xr.TAGS=Xr.hash256=Xr.hash160=Xr.sha256=Xr.sha1=Xr.ripemd160=void 0;const eo=ripemd160$1,to=sha1$1,ro=sha256$7;function no(lo){return Buffer$3.from((0,eo.ripemd160)(Uint8Array.from(lo)))}Xr.ripemd160=no;function io(lo){return Buffer$3.from((0,to.sha1)(Uint8Array.from(lo)))}Xr.sha1=io;function oo(lo){return Buffer$3.from((0,ro.sha256)(Uint8Array.from(lo)))}Xr.sha256=oo;function ao(lo){return Buffer$3.from((0,eo.ripemd160)((0,ro.sha256)(Uint8Array.from(lo))))}Xr.hash160=ao;function so(lo){return Buffer$3.from((0,ro.sha256)((0,ro.sha256)(Uint8Array.from(lo))))}Xr.hash256=so,Xr.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],Xr.TAGGED_HASH_PREFIXES={"BIP0340/challenge":Buffer$3.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":Buffer$3.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":Buffer$3.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:Buffer$3.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:Buffer$3.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:Buffer$3.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:Buffer$3.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":Buffer$3.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":Buffer$3.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])};function co(lo,fo){return oo(Buffer$3.concat([Xr.TAGGED_HASH_PREFIXES[lo],fo]))}Xr.taggedHash=co})(crypto$3);function base$3(Xr){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var eo=new Uint8Array(256),to=0;to>>0,Ao=new Uint8Array(ko);wo!==Eo;){for(var Po=go[wo],jo=0,Mo=ko-1;(Po!==0||jo>>0,Ao[Mo]=Po%oo>>>0,Po=Po/oo>>>0;if(Po!==0)throw new Error("Non-zero carry");vo=jo,wo++}for(var No=ko-vo;No!==ko&&Ao[No]===0;)No++;for(var Do=ao.repeat(yo);No>>0,ko=new Uint8Array(Eo);go[yo];){var Ao=eo[go.charCodeAt(yo)];if(Ao===255)return;for(var Po=0,jo=Eo-1;(Ao!==0||Po>>0,ko[jo]=Ao%256>>>0,Ao=Ao/256>>>0;if(Ao!==0)throw new Error("Non-zero carry");wo=Po,yo++}for(var Mo=Eo-wo;Mo!==Eo&&ko[Mo]===0;)Mo++;for(var No=new Uint8Array(vo+(Eo-Mo)),Do=vo;Mo!==Eo;)No[Do++]=ko[Mo++];return No}function ho(go){var yo=fo(go);if(yo)return yo;throw new Error("Non-base"+oo+" character")}return{encode:lo,decodeUnsafe:fo,decode:ho}}var src$2=base$3;const basex$2=src$2,ALPHABET$2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58$4=basex$2(ALPHABET$2),base58$1=bs58$4,base$2=function(Xr){function eo(io){var oo=Uint8Array.from(io),ao=Xr(oo),so=oo.length+4,co=new Uint8Array(so);return co.set(oo,0),co.set(ao.subarray(0,4),oo.length),base58$1.encode(co,so)}function to(io){var oo=io.slice(0,-4),ao=io.slice(-4),so=Xr(oo);if(!(ao[0]^so[0]|ao[1]^so[1]|ao[2]^so[2]|ao[3]^so[3]))return oo}function ro(io){var oo=base58$1.decodeUnsafe(io);if(oo)return to(oo)}function no(io){var oo=base58$1.decode(io),ao=to(oo);if(!ao)throw new Error("Invalid checksum");return ao}return{encode:eo,decode:no,decodeUnsafe:ro}},{sha256:sha256$2}=sha256$7,bs58checkBase=base$2;function sha256x2(Xr){return sha256$2(sha256$2(Xr))}var bs58check$3=bs58checkBase(sha256x2);Object.defineProperty(p2pkh$1,"__esModule",{value:!0});p2pkh$1.p2pkh=void 0;const bcrypto$5=crypto$3,networks_1$5=networks$1,bscript$8=script$1,types_1$6=types$7,lazy$4=lazy$8,bs58check$2=bs58check$3,OPS$4=bscript$8.OPS;function p2pkh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.pubkey&&!Xr.input)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$6.typeforce)({network:types_1$6.typeforce.maybe(types_1$6.typeforce.Object),address:types_1$6.typeforce.maybe(types_1$6.typeforce.String),hash:types_1$6.typeforce.maybe(types_1$6.typeforce.BufferN(20)),output:types_1$6.typeforce.maybe(types_1$6.typeforce.BufferN(25)),pubkey:types_1$6.typeforce.maybe(types_1$6.isPoint),signature:types_1$6.typeforce.maybe(bscript$8.isCanonicalScriptSignature),input:types_1$6.typeforce.maybe(types_1$6.typeforce.Buffer)},Xr);const to=lazy$4.value(()=>{const oo=Buffer$3.from(bs58check$2.decode(Xr.address)),ao=oo.readUInt8(0),so=oo.slice(1);return{version:ao,hash:so}}),ro=lazy$4.value(()=>bscript$8.decompile(Xr.input)),no=Xr.network||networks_1$5.bitcoin,io={name:"p2pkh",network:no};if(lazy$4.prop(io,"address",()=>{if(!io.hash)return;const oo=Buffer$3.allocUnsafe(21);return oo.writeUInt8(no.pubKeyHash,0),io.hash.copy(oo,1),bs58check$2.encode(oo)}),lazy$4.prop(io,"hash",()=>{if(Xr.output)return Xr.output.slice(3,23);if(Xr.address)return to().hash;if(Xr.pubkey||io.pubkey)return bcrypto$5.hash160(Xr.pubkey||io.pubkey)}),lazy$4.prop(io,"output",()=>{if(io.hash)return bscript$8.compile([OPS$4.OP_DUP,OPS$4.OP_HASH160,io.hash,OPS$4.OP_EQUALVERIFY,OPS$4.OP_CHECKSIG])}),lazy$4.prop(io,"pubkey",()=>{if(Xr.input)return ro()[1]}),lazy$4.prop(io,"signature",()=>{if(Xr.input)return ro()[0]}),lazy$4.prop(io,"input",()=>{if(Xr.pubkey&&Xr.signature)return bscript$8.compile([Xr.signature,Xr.pubkey])}),lazy$4.prop(io,"witness",()=>{if(io.input)return[]}),eo.validate){let oo=Buffer$3.from([]);if(Xr.address){if(to().version!==no.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(to().hash.length!==20)throw new TypeError("Invalid address");oo=to().hash}if(Xr.hash){if(oo.length>0&&!oo.equals(Xr.hash))throw new TypeError("Hash mismatch");oo=Xr.hash}if(Xr.output){if(Xr.output.length!==25||Xr.output[0]!==OPS$4.OP_DUP||Xr.output[1]!==OPS$4.OP_HASH160||Xr.output[2]!==20||Xr.output[23]!==OPS$4.OP_EQUALVERIFY||Xr.output[24]!==OPS$4.OP_CHECKSIG)throw new TypeError("Output is invalid");const ao=Xr.output.slice(3,23);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.pubkey){const ao=bcrypto$5.hash160(Xr.pubkey);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.input){const ao=ro();if(ao.length!==2)throw new TypeError("Input is invalid");if(!bscript$8.isCanonicalScriptSignature(ao[0]))throw new TypeError("Input has invalid signature");if(!(0,types_1$6.isPoint)(ao[1]))throw new TypeError("Input has invalid pubkey");if(Xr.signature&&!Xr.signature.equals(ao[0]))throw new TypeError("Signature mismatch");if(Xr.pubkey&&!Xr.pubkey.equals(ao[1]))throw new TypeError("Pubkey mismatch");const so=bcrypto$5.hash160(ao[1]);if(oo.length>0&&!oo.equals(so))throw new TypeError("Hash mismatch")}}return Object.assign(io,Xr)}p2pkh$1.p2pkh=p2pkh;var p2sh$1={};Object.defineProperty(p2sh$1,"__esModule",{value:!0});p2sh$1.p2sh=void 0;const bcrypto$4=crypto$3,networks_1$4=networks$1,bscript$7=script$1,types_1$5=types$7,lazy$3=lazy$8,bs58check$1=bs58check$3,OPS$3=bscript$7.OPS;function stacksEqual$2(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2sh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.redeem&&!Xr.input)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$5.typeforce)({network:types_1$5.typeforce.maybe(types_1$5.typeforce.Object),address:types_1$5.typeforce.maybe(types_1$5.typeforce.String),hash:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(20)),output:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(23)),redeem:types_1$5.typeforce.maybe({network:types_1$5.typeforce.maybe(types_1$5.typeforce.Object),output:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),input:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),witness:types_1$5.typeforce.maybe(types_1$5.typeforce.arrayOf(types_1$5.typeforce.Buffer))}),input:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),witness:types_1$5.typeforce.maybe(types_1$5.typeforce.arrayOf(types_1$5.typeforce.Buffer))},Xr);let to=Xr.network;to||(to=Xr.redeem&&Xr.redeem.network||networks_1$4.bitcoin);const ro={network:to},no=lazy$3.value(()=>{const ao=Buffer$3.from(bs58check$1.decode(Xr.address)),so=ao.readUInt8(0),co=ao.slice(1);return{version:so,hash:co}}),io=lazy$3.value(()=>bscript$7.decompile(Xr.input)),oo=lazy$3.value(()=>{const ao=io(),so=ao[ao.length-1];return{network:to,output:so===OPS$3.OP_FALSE?Buffer$3.from([]):so,input:bscript$7.compile(ao.slice(0,-1)),witness:Xr.witness||[]}});if(lazy$3.prop(ro,"address",()=>{if(!ro.hash)return;const ao=Buffer$3.allocUnsafe(21);return ao.writeUInt8(ro.network.scriptHash,0),ro.hash.copy(ao,1),bs58check$1.encode(ao)}),lazy$3.prop(ro,"hash",()=>{if(Xr.output)return Xr.output.slice(2,22);if(Xr.address)return no().hash;if(ro.redeem&&ro.redeem.output)return bcrypto$4.hash160(ro.redeem.output)}),lazy$3.prop(ro,"output",()=>{if(ro.hash)return bscript$7.compile([OPS$3.OP_HASH160,ro.hash,OPS$3.OP_EQUAL])}),lazy$3.prop(ro,"redeem",()=>{if(Xr.input)return oo()}),lazy$3.prop(ro,"input",()=>{if(!(!Xr.redeem||!Xr.redeem.input||!Xr.redeem.output))return bscript$7.compile([].concat(bscript$7.decompile(Xr.redeem.input),Xr.redeem.output))}),lazy$3.prop(ro,"witness",()=>{if(ro.redeem&&ro.redeem.witness)return ro.redeem.witness;if(ro.input)return[]}),lazy$3.prop(ro,"name",()=>{const ao=["p2sh"];return ro.redeem!==void 0&&ro.redeem.name!==void 0&&ao.push(ro.redeem.name),ao.join("-")}),eo.validate){let ao=Buffer$3.from([]);if(Xr.address){if(no().version!==to.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(no().hash.length!==20)throw new TypeError("Invalid address");ao=no().hash}if(Xr.hash){if(ao.length>0&&!ao.equals(Xr.hash))throw new TypeError("Hash mismatch");ao=Xr.hash}if(Xr.output){if(Xr.output.length!==23||Xr.output[0]!==OPS$3.OP_HASH160||Xr.output[1]!==20||Xr.output[22]!==OPS$3.OP_EQUAL)throw new TypeError("Output is invalid");const co=Xr.output.slice(2,22);if(ao.length>0&&!ao.equals(co))throw new TypeError("Hash mismatch");ao=co}const so=co=>{if(co.output){const lo=bscript$7.decompile(co.output);if(!lo||lo.length<1)throw new TypeError("Redeem.output too short");if(co.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(bscript$7.countNonPushOnlyOPs(lo)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const fo=bcrypto$4.hash160(co.output);if(ao.length>0&&!ao.equals(fo))throw new TypeError("Hash mismatch");ao=fo}if(co.input){const lo=co.input.length>0,fo=co.witness&&co.witness.length>0;if(!lo&&!fo)throw new TypeError("Empty input");if(lo&&fo)throw new TypeError("Input and witness provided");if(lo){const ho=bscript$7.decompile(co.input);if(!bscript$7.isPushOnly(ho))throw new TypeError("Non push-only scriptSig")}}};if(Xr.input){const co=io();if(!co||co.length<1)throw new TypeError("Input too short");if(!Buffer$3.isBuffer(oo().output))throw new TypeError("Input is invalid");so(oo())}if(Xr.redeem){if(Xr.redeem.network&&Xr.redeem.network!==to)throw new TypeError("Network mismatch");if(Xr.input){const co=oo();if(Xr.redeem.output&&!Xr.redeem.output.equals(co.output))throw new TypeError("Redeem.output mismatch");if(Xr.redeem.input&&!Xr.redeem.input.equals(co.input))throw new TypeError("Redeem.input mismatch")}so(Xr.redeem)}if(Xr.witness&&Xr.redeem&&Xr.redeem.witness&&!stacksEqual$2(Xr.redeem.witness,Xr.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(ro,Xr)}p2sh$1.p2sh=p2sh;var p2wpkh$1={};Object.defineProperty(p2wpkh$1,"__esModule",{value:!0});p2wpkh$1.p2wpkh=void 0;const bcrypto$3=crypto$3,networks_1$3=networks$1,bscript$6=script$1,types_1$4=types$7,lazy$2=lazy$8,bech32_1$3=dist$1,OPS$2=bscript$6.OPS,EMPTY_BUFFER$2=Buffer$3.alloc(0);function p2wpkh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.pubkey&&!Xr.witness)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$4.typeforce)({address:types_1$4.typeforce.maybe(types_1$4.typeforce.String),hash:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(20)),input:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(0)),network:types_1$4.typeforce.maybe(types_1$4.typeforce.Object),output:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(22)),pubkey:types_1$4.typeforce.maybe(types_1$4.isPoint),signature:types_1$4.typeforce.maybe(bscript$6.isCanonicalScriptSignature),witness:types_1$4.typeforce.maybe(types_1$4.typeforce.arrayOf(types_1$4.typeforce.Buffer))},Xr);const to=lazy$2.value(()=>{const io=bech32_1$3.bech32.decode(Xr.address),oo=io.words.shift(),ao=bech32_1$3.bech32.fromWords(io.words);return{version:oo,prefix:io.prefix,data:Buffer$3.from(ao)}}),ro=Xr.network||networks_1$3.bitcoin,no={name:"p2wpkh",network:ro};if(lazy$2.prop(no,"address",()=>{if(!no.hash)return;const io=bech32_1$3.bech32.toWords(no.hash);return io.unshift(0),bech32_1$3.bech32.encode(ro.bech32,io)}),lazy$2.prop(no,"hash",()=>{if(Xr.output)return Xr.output.slice(2,22);if(Xr.address)return to().data;if(Xr.pubkey||no.pubkey)return bcrypto$3.hash160(Xr.pubkey||no.pubkey)}),lazy$2.prop(no,"output",()=>{if(no.hash)return bscript$6.compile([OPS$2.OP_0,no.hash])}),lazy$2.prop(no,"pubkey",()=>{if(Xr.pubkey)return Xr.pubkey;if(Xr.witness)return Xr.witness[1]}),lazy$2.prop(no,"signature",()=>{if(Xr.witness)return Xr.witness[0]}),lazy$2.prop(no,"input",()=>{if(no.witness)return EMPTY_BUFFER$2}),lazy$2.prop(no,"witness",()=>{if(Xr.pubkey&&Xr.signature)return[Xr.signature,Xr.pubkey]}),eo.validate){let io=Buffer$3.from([]);if(Xr.address){if(ro&&ro.bech32!==to().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==0)throw new TypeError("Invalid address version");if(to().data.length!==20)throw new TypeError("Invalid address data");io=to().data}if(Xr.hash){if(io.length>0&&!io.equals(Xr.hash))throw new TypeError("Hash mismatch");io=Xr.hash}if(Xr.output){if(Xr.output.length!==22||Xr.output[0]!==OPS$2.OP_0||Xr.output[1]!==20)throw new TypeError("Output is invalid");if(io.length>0&&!io.equals(Xr.output.slice(2)))throw new TypeError("Hash mismatch");io=Xr.output.slice(2)}if(Xr.pubkey){const oo=bcrypto$3.hash160(Xr.pubkey);if(io.length>0&&!io.equals(oo))throw new TypeError("Hash mismatch");if(io=oo,!(0,types_1$4.isPoint)(Xr.pubkey)||Xr.pubkey.length!==33)throw new TypeError("Invalid pubkey for p2wpkh")}if(Xr.witness){if(Xr.witness.length!==2)throw new TypeError("Witness is invalid");if(!bscript$6.isCanonicalScriptSignature(Xr.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,types_1$4.isPoint)(Xr.witness[1])||Xr.witness[1].length!==33)throw new TypeError("Witness has invalid pubkey");if(Xr.signature&&!Xr.signature.equals(Xr.witness[0]))throw new TypeError("Signature mismatch");if(Xr.pubkey&&!Xr.pubkey.equals(Xr.witness[1]))throw new TypeError("Pubkey mismatch");const oo=bcrypto$3.hash160(Xr.witness[1]);if(io.length>0&&!io.equals(oo))throw new TypeError("Hash mismatch")}}return Object.assign(no,Xr)}p2wpkh$1.p2wpkh=p2wpkh;var p2wsh$1={};Object.defineProperty(p2wsh$1,"__esModule",{value:!0});p2wsh$1.p2wsh=void 0;const bcrypto$2=crypto$3,networks_1$2=networks$1,bscript$5=script$1,types_1$3=types$7,lazy$1=lazy$8,bech32_1$2=dist$1,OPS$1=bscript$5.OPS,EMPTY_BUFFER$1=Buffer$3.alloc(0);function stacksEqual$1(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function chunkHasUncompressedPubkey(Xr){return!!(Buffer$3.isBuffer(Xr)&&Xr.length===65&&Xr[0]===4&&(0,types_1$3.isPoint)(Xr))}function p2wsh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.redeem&&!Xr.witness)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$3.typeforce)({network:types_1$3.typeforce.maybe(types_1$3.typeforce.Object),address:types_1$3.typeforce.maybe(types_1$3.typeforce.String),hash:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(32)),output:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(34)),redeem:types_1$3.typeforce.maybe({input:types_1$3.typeforce.maybe(types_1$3.typeforce.Buffer),network:types_1$3.typeforce.maybe(types_1$3.typeforce.Object),output:types_1$3.typeforce.maybe(types_1$3.typeforce.Buffer),witness:types_1$3.typeforce.maybe(types_1$3.typeforce.arrayOf(types_1$3.typeforce.Buffer))}),input:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(0)),witness:types_1$3.typeforce.maybe(types_1$3.typeforce.arrayOf(types_1$3.typeforce.Buffer))},Xr);const to=lazy$1.value(()=>{const oo=bech32_1$2.bech32.decode(Xr.address),ao=oo.words.shift(),so=bech32_1$2.bech32.fromWords(oo.words);return{version:ao,prefix:oo.prefix,data:Buffer$3.from(so)}}),ro=lazy$1.value(()=>bscript$5.decompile(Xr.redeem.input));let no=Xr.network;no||(no=Xr.redeem&&Xr.redeem.network||networks_1$2.bitcoin);const io={network:no};if(lazy$1.prop(io,"address",()=>{if(!io.hash)return;const oo=bech32_1$2.bech32.toWords(io.hash);return oo.unshift(0),bech32_1$2.bech32.encode(no.bech32,oo)}),lazy$1.prop(io,"hash",()=>{if(Xr.output)return Xr.output.slice(2);if(Xr.address)return to().data;if(io.redeem&&io.redeem.output)return bcrypto$2.sha256(io.redeem.output)}),lazy$1.prop(io,"output",()=>{if(io.hash)return bscript$5.compile([OPS$1.OP_0,io.hash])}),lazy$1.prop(io,"redeem",()=>{if(Xr.witness)return{output:Xr.witness[Xr.witness.length-1],input:EMPTY_BUFFER$1,witness:Xr.witness.slice(0,-1)}}),lazy$1.prop(io,"input",()=>{if(io.witness)return EMPTY_BUFFER$1}),lazy$1.prop(io,"witness",()=>{if(Xr.redeem&&Xr.redeem.input&&Xr.redeem.input.length>0&&Xr.redeem.output&&Xr.redeem.output.length>0){const oo=bscript$5.toStack(ro());return io.redeem=Object.assign({witness:oo},Xr.redeem),io.redeem.input=EMPTY_BUFFER$1,[].concat(oo,Xr.redeem.output)}if(Xr.redeem&&Xr.redeem.output&&Xr.redeem.witness)return[].concat(Xr.redeem.witness,Xr.redeem.output)}),lazy$1.prop(io,"name",()=>{const oo=["p2wsh"];return io.redeem!==void 0&&io.redeem.name!==void 0&&oo.push(io.redeem.name),oo.join("-")}),eo.validate){let oo=Buffer$3.from([]);if(Xr.address){if(to().prefix!==no.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==0)throw new TypeError("Invalid address version");if(to().data.length!==32)throw new TypeError("Invalid address data");oo=to().data}if(Xr.hash){if(oo.length>0&&!oo.equals(Xr.hash))throw new TypeError("Hash mismatch");oo=Xr.hash}if(Xr.output){if(Xr.output.length!==34||Xr.output[0]!==OPS$1.OP_0||Xr.output[1]!==32)throw new TypeError("Output is invalid");const ao=Xr.output.slice(2);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.redeem){if(Xr.redeem.network&&Xr.redeem.network!==no)throw new TypeError("Network mismatch");if(Xr.redeem.input&&Xr.redeem.input.length>0&&Xr.redeem.witness&&Xr.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(Xr.redeem.output){const ao=bscript$5.decompile(Xr.redeem.output);if(!ao||ao.length<1)throw new TypeError("Redeem.output is invalid");if(Xr.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(bscript$5.countNonPushOnlyOPs(ao)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const so=bcrypto$2.sha256(Xr.redeem.output);if(oo.length>0&&!oo.equals(so))throw new TypeError("Hash mismatch");oo=so}if(Xr.redeem.input&&!bscript$5.isPushOnly(ro()))throw new TypeError("Non push-only scriptSig");if(Xr.witness&&Xr.redeem.witness&&!stacksEqual$1(Xr.witness,Xr.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(Xr.redeem.input&&ro().some(chunkHasUncompressedPubkey)||Xr.redeem.output&&(bscript$5.decompile(Xr.redeem.output)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(Xr.witness&&Xr.witness.length>0){const ao=Xr.witness[Xr.witness.length-1];if(Xr.redeem&&Xr.redeem.output&&!Xr.redeem.output.equals(ao))throw new TypeError("Witness and redeem.output mismatch");if(Xr.witness.some(chunkHasUncompressedPubkey)||(bscript$5.decompile(ao)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(io,Xr)}p2wsh$1.p2wsh=p2wsh;var p2tr$1={},ecc_lib={};Object.defineProperty(ecc_lib,"__esModule",{value:!0});ecc_lib.getEccLib=ecc_lib.initEccLib=void 0;const _ECCLIB_CACHE={};function initEccLib(Xr){Xr?Xr!==_ECCLIB_CACHE.eccLib&&(verifyEcc(Xr),_ECCLIB_CACHE.eccLib=Xr):_ECCLIB_CACHE.eccLib=Xr}ecc_lib.initEccLib=initEccLib;function getEccLib(){if(!_ECCLIB_CACHE.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return _ECCLIB_CACHE.eccLib}ecc_lib.getEccLib=getEccLib;const h$8=Xr=>Buffer$3.from(Xr,"hex");function verifyEcc(Xr){assert$7(typeof Xr.isXOnlyPoint=="function"),assert$7(Xr.isXOnlyPoint(h$8("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert$7(Xr.isXOnlyPoint(h$8("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),assert$7(Xr.isXOnlyPoint(h$8("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),assert$7(Xr.isXOnlyPoint(h$8("0000000000000000000000000000000000000000000000000000000000000001"))),assert$7(!Xr.isXOnlyPoint(h$8("0000000000000000000000000000000000000000000000000000000000000000"))),assert$7(!Xr.isXOnlyPoint(h$8("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),assert$7(typeof Xr.xOnlyPointAddTweak=="function"),tweakAddVectors.forEach(eo=>{const to=Xr.xOnlyPointAddTweak(h$8(eo.pubkey),h$8(eo.tweak));eo.result===null?assert$7(to===null):(assert$7(to!==null),assert$7(to.parity===eo.parity),assert$7(Buffer$3.from(to.xOnlyPubkey).equals(h$8(eo.result))))})}function assert$7(Xr){if(!Xr)throw new Error("ecc library invalid")}const tweakAddVectors=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}];var bip341={},bufferutils={},Buffer=safeBufferExports.Buffer,MAX_SAFE_INTEGER$1=9007199254740991;function checkUInt53$1(Xr){if(Xr<0||Xr>MAX_SAFE_INTEGER$1||Xr%1!==0)throw new RangeError("value out of range")}function encode$i(Xr,eo,to){if(checkUInt53$1(Xr),eo||(eo=Buffer.allocUnsafe(encodingLength$1(Xr))),!Buffer.isBuffer(eo))throw new TypeError("buffer must be a Buffer instance");return to||(to=0),Xr<253?(eo.writeUInt8(Xr,to),encode$i.bytes=1):Xr<=65535?(eo.writeUInt8(253,to),eo.writeUInt16LE(Xr,to+1),encode$i.bytes=3):Xr<=4294967295?(eo.writeUInt8(254,to),eo.writeUInt32LE(Xr,to+1),encode$i.bytes=5):(eo.writeUInt8(255,to),eo.writeUInt32LE(Xr>>>0,to+1),eo.writeUInt32LE(Xr/4294967296|0,to+5),encode$i.bytes=9),eo}function decode$k(Xr,eo){if(!Buffer.isBuffer(Xr))throw new TypeError("buffer must be a Buffer instance");eo||(eo=0);var to=Xr.readUInt8(eo);if(to<253)return decode$k.bytes=1,to;if(to===253)return decode$k.bytes=3,Xr.readUInt16LE(eo+1);if(to===254)return decode$k.bytes=5,Xr.readUInt32LE(eo+1);decode$k.bytes=9;var ro=Xr.readUInt32LE(eo+1),no=Xr.readUInt32LE(eo+5),io=no*4294967296+ro;return checkUInt53$1(io),io}function encodingLength$1(Xr){return checkUInt53$1(Xr),Xr<253?1:Xr<=65535?3:Xr<=4294967295?5:9}var varuintBitcoin={encode:encode$i,decode:decode$k,encodingLength:encodingLength$1};Object.defineProperty(bufferutils,"__esModule",{value:!0});bufferutils.BufferReader=bufferutils.BufferWriter=bufferutils.cloneBuffer=bufferutils.reverseBuffer=bufferutils.writeUInt64LE=bufferutils.readUInt64LE=bufferutils.varuint=void 0;const types$4=types$7,{typeforce:typeforce$2}=types$4,varuint$7=varuintBitcoin;bufferutils.varuint=varuint$7;function verifuint$1(Xr,eo){if(typeof Xr!="number")throw new Error("cannot write a non-number as a number");if(Xr<0)throw new Error("specified a negative value for writing an unsigned value");if(Xr>eo)throw new Error("RangeError: value out of range");if(Math.floor(Xr)!==Xr)throw new Error("value has a fractional component")}function readUInt64LE$1(Xr,eo){const to=Xr.readUInt32LE(eo);let ro=Xr.readUInt32LE(eo+4);return ro*=4294967296,verifuint$1(ro+to,9007199254740991),ro+to}bufferutils.readUInt64LE=readUInt64LE$1;function writeUInt64LE$1(Xr,eo,to){return verifuint$1(eo,9007199254740991),Xr.writeInt32LE(eo&-1,to),Xr.writeUInt32LE(Math.floor(eo/4294967296),to+4),to+8}bufferutils.writeUInt64LE=writeUInt64LE$1;function reverseBuffer$1(Xr){if(Xr.length<1)return Xr;let eo=Xr.length-1,to=0;for(let ro=0;rothis.writeVarSlice(to))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}bufferutils.BufferWriter=BufferWriter;class BufferReader{constructor(eo,to=0){this.buffer=eo,this.offset=to,typeforce$2(types$4.tuple(types$4.Buffer,types$4.UInt32),[eo,to])}readUInt8(){const eo=this.buffer.readUInt8(this.offset);return this.offset++,eo}readInt32(){const eo=this.buffer.readInt32LE(this.offset);return this.offset+=4,eo}readUInt32(){const eo=this.buffer.readUInt32LE(this.offset);return this.offset+=4,eo}readUInt64(){const eo=readUInt64LE$1(this.buffer,this.offset);return this.offset+=8,eo}readVarInt(){const eo=varuint$7.decode(this.buffer,this.offset);return this.offset+=varuint$7.decode.bytes,eo}readSlice(eo){if(this.buffer.length"left"in vo&&"right"in vo;function ao(vo,wo){if(vo.length<33)throw new TypeError(`The control-block length is too small. Got ${vo.length}, expected min 33.`);const Eo=(vo.length-33)/32;let ko=wo;for(let Ao=0;AoAo.hash.compare(Po.hash));const[Eo,ko]=wo;return{hash:go(Eo.hash,ko.hash),left:Eo,right:ko}}Xr.toHashTree=so;function co(vo,wo){if(oo(vo)){const Eo=co(vo.left,wo);if(Eo!==void 0)return[...Eo,vo.right.hash];const ko=co(vo.right,wo);if(ko!==void 0)return[...ko,vo.left.hash]}else if(vo.hash.equals(wo))return[]}Xr.findScriptPath=co;function lo(vo){const wo=vo.version||Xr.LEAF_VERSION_TAPSCRIPT;return ro.taggedHash("TapLeaf",eo.Buffer.concat([eo.Buffer.from([wo]),yo(vo.output)]))}Xr.tapleafHash=lo;function fo(vo,wo){return ro.taggedHash("TapTweak",eo.Buffer.concat(wo?[vo,wo]:[vo]))}Xr.tapTweakHash=fo;function ho(vo,wo){if(!eo.Buffer.isBuffer(vo)||vo.length!==32||wo&&wo.length!==32)return null;const Eo=fo(vo,wo),ko=(0,to.getEccLib)().xOnlyPointAddTweak(vo,Eo);return!ko||ko.xOnlyPubkey===null?null:{parity:ko.parity,x:eo.Buffer.from(ko.xOnlyPubkey)}}Xr.tweakKey=ho;function go(vo,wo){return ro.taggedHash("TapBranch",eo.Buffer.concat([vo,wo]))}function yo(vo){const wo=no.varuint.encodingLength(vo.length),Eo=eo.Buffer.allocUnsafe(wo);return no.varuint.encode(vo.length,Eo),eo.Buffer.concat([Eo,vo])}})(bip341);Object.defineProperty(p2tr$1,"__esModule",{value:!0});p2tr$1.p2tr=void 0;const buffer_1$1=require$$0$9,networks_1$1=networks$1,bscript$4=script$1,types_1$2=types$7,ecc_lib_1=ecc_lib,bip341_1$2=bip341,lazy=lazy$8,bech32_1$1=dist$1,OPS=bscript$4.OPS,TAPROOT_WITNESS_VERSION=1,ANNEX_PREFIX=80;function p2tr(Xr,eo){if(!Xr.address&&!Xr.output&&!Xr.pubkey&&!Xr.internalPubkey&&!(Xr.witness&&Xr.witness.length>1))throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$2.typeforce)({address:types_1$2.typeforce.maybe(types_1$2.typeforce.String),input:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(0)),network:types_1$2.typeforce.maybe(types_1$2.typeforce.Object),output:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(34)),internalPubkey:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),hash:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),pubkey:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),signature:types_1$2.typeforce.maybe(types_1$2.typeforce.anyOf(types_1$2.typeforce.BufferN(64),types_1$2.typeforce.BufferN(65))),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer)),scriptTree:types_1$2.typeforce.maybe(types_1$2.isTaptree),redeem:types_1$2.typeforce.maybe({output:types_1$2.typeforce.maybe(types_1$2.typeforce.Buffer),redeemVersion:types_1$2.typeforce.maybe(types_1$2.typeforce.Number),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer))}),redeemVersion:types_1$2.typeforce.maybe(types_1$2.typeforce.Number)},Xr);const to=lazy.value(()=>{const ao=bech32_1$1.bech32m.decode(Xr.address),so=ao.words.shift(),co=bech32_1$1.bech32m.fromWords(ao.words);return{version:so,prefix:ao.prefix,data:buffer_1$1.Buffer.from(co)}}),ro=lazy.value(()=>{if(!(!Xr.witness||!Xr.witness.length))return Xr.witness.length>=2&&Xr.witness[Xr.witness.length-1][0]===ANNEX_PREFIX?Xr.witness.slice(0,-1):Xr.witness.slice()}),no=lazy.value(()=>{if(Xr.scriptTree)return(0,bip341_1$2.toHashTree)(Xr.scriptTree);if(Xr.hash)return{hash:Xr.hash}}),io=Xr.network||networks_1$1.bitcoin,oo={name:"p2tr",network:io};if(lazy.prop(oo,"address",()=>{if(!oo.pubkey)return;const ao=bech32_1$1.bech32m.toWords(oo.pubkey);return ao.unshift(TAPROOT_WITNESS_VERSION),bech32_1$1.bech32m.encode(io.bech32,ao)}),lazy.prop(oo,"hash",()=>{const ao=no();if(ao)return ao.hash;const so=ro();if(so&&so.length>1){const co=so[so.length-1],lo=co[0]&types_1$2.TAPLEAF_VERSION_MASK,fo=so[so.length-2],ho=(0,bip341_1$2.tapleafHash)({output:fo,version:lo});return(0,bip341_1$2.rootHashFromPath)(co,ho)}return null}),lazy.prop(oo,"output",()=>{if(oo.pubkey)return bscript$4.compile([OPS.OP_1,oo.pubkey])}),lazy.prop(oo,"redeemVersion",()=>Xr.redeemVersion?Xr.redeemVersion:Xr.redeem&&Xr.redeem.redeemVersion!==void 0&&Xr.redeem.redeemVersion!==null?Xr.redeem.redeemVersion:bip341_1$2.LEAF_VERSION_TAPSCRIPT),lazy.prop(oo,"redeem",()=>{const ao=ro();if(!(!ao||ao.length<2))return{output:ao[ao.length-2],witness:ao.slice(0,-2),redeemVersion:ao[ao.length-1][0]&types_1$2.TAPLEAF_VERSION_MASK}}),lazy.prop(oo,"pubkey",()=>{if(Xr.pubkey)return Xr.pubkey;if(Xr.output)return Xr.output.slice(2);if(Xr.address)return to().data;if(oo.internalPubkey){const ao=(0,bip341_1$2.tweakKey)(oo.internalPubkey,oo.hash);if(ao)return ao.x}}),lazy.prop(oo,"internalPubkey",()=>{if(Xr.internalPubkey)return Xr.internalPubkey;const ao=ro();if(ao&&ao.length>1)return ao[ao.length-1].slice(1,33)}),lazy.prop(oo,"signature",()=>{if(Xr.signature)return Xr.signature;const ao=ro();if(!(!ao||ao.length!==1))return ao[0]}),lazy.prop(oo,"witness",()=>{if(Xr.witness)return Xr.witness;const ao=no();if(ao&&Xr.redeem&&Xr.redeem.output&&Xr.internalPubkey){const so=(0,bip341_1$2.tapleafHash)({output:Xr.redeem.output,version:oo.redeemVersion}),co=(0,bip341_1$2.findScriptPath)(ao,so);if(!co)return;const lo=(0,bip341_1$2.tweakKey)(Xr.internalPubkey,ao.hash);if(!lo)return;const fo=buffer_1$1.Buffer.concat([buffer_1$1.Buffer.from([oo.redeemVersion|lo.parity]),Xr.internalPubkey].concat(co));return[Xr.redeem.output,fo]}if(Xr.signature)return[Xr.signature]}),eo.validate){let ao=buffer_1$1.Buffer.from([]);if(Xr.address){if(io&&io.bech32!==to().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==TAPROOT_WITNESS_VERSION)throw new TypeError("Invalid address version");if(to().data.length!==32)throw new TypeError("Invalid address data");ao=to().data}if(Xr.pubkey){if(ao.length>0&&!ao.equals(Xr.pubkey))throw new TypeError("Pubkey mismatch");ao=Xr.pubkey}if(Xr.output){if(Xr.output.length!==34||Xr.output[0]!==OPS.OP_1||Xr.output[1]!==32)throw new TypeError("Output is invalid");if(ao.length>0&&!ao.equals(Xr.output.slice(2)))throw new TypeError("Pubkey mismatch");ao=Xr.output.slice(2)}if(Xr.internalPubkey){const lo=(0,bip341_1$2.tweakKey)(Xr.internalPubkey,oo.hash);if(ao.length>0&&!ao.equals(lo.x))throw new TypeError("Pubkey mismatch");ao=lo.x}if(ao&&ao.length&&!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(ao))throw new TypeError("Invalid pubkey for p2tr");const so=no();if(Xr.hash&&so&&!Xr.hash.equals(so.hash))throw new TypeError("Hash mismatch");if(Xr.redeem&&Xr.redeem.output&&so){const lo=(0,bip341_1$2.tapleafHash)({output:Xr.redeem.output,version:oo.redeemVersion});if(!(0,bip341_1$2.findScriptPath)(so,lo))throw new TypeError("Redeem script not in tree")}const co=ro();if(Xr.redeem&&oo.redeem){if(Xr.redeem.redeemVersion&&Xr.redeem.redeemVersion!==oo.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(Xr.redeem.output){if(bscript$4.decompile(Xr.redeem.output).length===0)throw new TypeError("Redeem.output is invalid");if(oo.redeem.output&&!Xr.redeem.output.equals(oo.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(Xr.redeem.witness&&oo.redeem.witness&&!stacksEqual(Xr.redeem.witness,oo.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(co&&co.length)if(co.length===1){if(Xr.signature&&!Xr.signature.equals(co[0]))throw new TypeError("Signature mismatch")}else{const lo=co[co.length-1];if(lo.length<33)throw new TypeError(`The control-block length is too small. Got ${lo.length}, expected min 33.`);if((lo.length-33)%32!==0)throw new TypeError(`The control-block length of ${lo.length} is incorrect!`);const fo=(lo.length-33)/32;if(fo>128)throw new TypeError(`The script path is too long. Got ${fo}, expected max 128.`);const ho=lo.slice(1,33);if(Xr.internalPubkey&&!Xr.internalPubkey.equals(ho))throw new TypeError("Internal pubkey mismatch");if(!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(ho))throw new TypeError("Invalid internalPubkey for p2tr witness");const go=lo[0]&types_1$2.TAPLEAF_VERSION_MASK,yo=co[co.length-2],vo=(0,bip341_1$2.tapleafHash)({output:yo,version:go}),wo=(0,bip341_1$2.rootHashFromPath)(lo,vo),Eo=(0,bip341_1$2.tweakKey)(ho,wo);if(!Eo)throw new TypeError("Invalid outputKey for p2tr witness");if(ao.length&&!ao.equals(Eo.x))throw new TypeError("Pubkey mismatch for p2tr witness");if(Eo.parity!==(lo[0]&1))throw new Error("Incorrect parity")}}return Object.assign(oo,Xr)}p2tr$1.p2tr=p2tr;function stacksEqual(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.p2tr=Xr.p2wsh=Xr.p2wpkh=Xr.p2sh=Xr.p2pkh=Xr.p2pk=Xr.p2ms=Xr.embed=void 0;const eo=embed;Object.defineProperty(Xr,"embed",{enumerable:!0,get:function(){return eo.p2data}});const to=p2ms$1;Object.defineProperty(Xr,"p2ms",{enumerable:!0,get:function(){return to.p2ms}});const ro=p2pk$1;Object.defineProperty(Xr,"p2pk",{enumerable:!0,get:function(){return ro.p2pk}});const no=p2pkh$1;Object.defineProperty(Xr,"p2pkh",{enumerable:!0,get:function(){return no.p2pkh}});const io=p2sh$1;Object.defineProperty(Xr,"p2sh",{enumerable:!0,get:function(){return io.p2sh}});const oo=p2wpkh$1;Object.defineProperty(Xr,"p2wpkh",{enumerable:!0,get:function(){return oo.p2wpkh}});const ao=p2wsh$1;Object.defineProperty(Xr,"p2wsh",{enumerable:!0,get:function(){return ao.p2wsh}});const so=p2tr$1;Object.defineProperty(Xr,"p2tr",{enumerable:!0,get:function(){return so.p2tr}})})(payments$3);Object.defineProperty(address,"__esModule",{value:!0});address.toOutputScript=address.fromOutputScript=address.toBech32=address.toBase58Check=address.fromBech32=address.fromBase58Check=void 0;const networks=networks$1,payments$2=payments$3,bscript$3=script$1,types_1$1=types$7,bech32_1=dist$1,bs58check=bs58check$3,FUTURE_SEGWIT_MAX_SIZE=40,FUTURE_SEGWIT_MIN_SIZE=2,FUTURE_SEGWIT_MAX_VERSION=16,FUTURE_SEGWIT_MIN_VERSION=2,FUTURE_SEGWIT_VERSION_DIFF=80,FUTURE_SEGWIT_VERSION_WARNING="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function _toFutureSegwitAddress(Xr,eo){const to=Xr.slice(2);if(to.lengthFUTURE_SEGWIT_MAX_SIZE)throw new TypeError("Invalid program length for segwit address");const ro=Xr[0]-FUTURE_SEGWIT_VERSION_DIFF;if(roFUTURE_SEGWIT_MAX_VERSION)throw new TypeError("Invalid version for segwit address");if(Xr[1]!==to.length)throw new TypeError("Invalid script for segwit address");return console.warn(FUTURE_SEGWIT_VERSION_WARNING),toBech32(to,ro,eo.bech32)}function fromBase58Check(Xr){const eo=Buffer$3.from(bs58check.decode(Xr));if(eo.length<21)throw new TypeError(Xr+" is too short");if(eo.length>21)throw new TypeError(Xr+" is too long");const to=eo.readUInt8(0),ro=eo.slice(1);return{version:to,hash:ro}}address.fromBase58Check=fromBase58Check;function fromBech32(Xr){let eo,to;try{eo=bech32_1.bech32.decode(Xr)}catch{}if(eo){if(to=eo.words[0],to!==0)throw new TypeError(Xr+" uses wrong encoding")}else if(eo=bech32_1.bech32m.decode(Xr),to=eo.words[0],to===0)throw new TypeError(Xr+" uses wrong encoding");const ro=bech32_1.bech32.fromWords(eo.words.slice(1));return{version:to,prefix:eo.prefix,data:Buffer$3.from(ro)}}address.fromBech32=fromBech32;function toBase58Check(Xr,eo){(0,types_1$1.typeforce)((0,types_1$1.tuple)(types_1$1.Hash160bit,types_1$1.UInt8),arguments);const to=Buffer$3.allocUnsafe(21);return to.writeUInt8(eo,0),Xr.copy(to,1),bs58check.encode(to)}address.toBase58Check=toBase58Check;function toBech32(Xr,eo,to){const ro=bech32_1.bech32.toWords(Xr);return ro.unshift(eo),eo===0?bech32_1.bech32.encode(to,ro):bech32_1.bech32m.encode(to,ro)}address.toBech32=toBech32;function fromOutputScript(Xr,eo){eo=eo||networks.bitcoin;try{return payments$2.p2pkh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2sh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2wpkh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2wsh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2tr({output:Xr,network:eo}).address}catch{}try{return _toFutureSegwitAddress(Xr,eo)}catch{}throw new Error(bscript$3.toASM(Xr)+" has no matching Address")}address.fromOutputScript=fromOutputScript;function toOutputScript(Xr,eo){eo=eo||networks.bitcoin;let to,ro;try{to=fromBase58Check(Xr)}catch{}if(to){if(to.version===eo.pubKeyHash)return payments$2.p2pkh({hash:to.hash}).output;if(to.version===eo.scriptHash)return payments$2.p2sh({hash:to.hash}).output}else{try{ro=fromBech32(Xr)}catch{}if(ro){if(ro.prefix!==eo.bech32)throw new Error(Xr+" has an invalid prefix");if(ro.version===0){if(ro.data.length===20)return payments$2.p2wpkh({hash:ro.data}).output;if(ro.data.length===32)return payments$2.p2wsh({hash:ro.data}).output}else if(ro.version===1){if(ro.data.length===32)return payments$2.p2tr({pubkey:ro.data}).output}else if(ro.version>=FUTURE_SEGWIT_MIN_VERSION&&ro.version<=FUTURE_SEGWIT_MAX_VERSION&&ro.data.length>=FUTURE_SEGWIT_MIN_SIZE&&ro.data.length<=FUTURE_SEGWIT_MAX_SIZE)return console.warn(FUTURE_SEGWIT_VERSION_WARNING),bscript$3.compile([ro.version+FUTURE_SEGWIT_VERSION_DIFF,ro.data])}}throw new Error(Xr+" has no matching Script")}address.toOutputScript=toOutputScript;var block={},merkle={};Object.defineProperty(merkle,"__esModule",{value:!0});merkle.fastMerkleRoot=void 0;function fastMerkleRoot(Xr,eo){if(!Array.isArray(Xr))throw TypeError("Expected values Array");if(typeof eo!="function")throw TypeError("Expected digest Function");let to=Xr.length;const ro=Xr.concat();for(;to>1;){let no=0;for(let io=0;ioto+varSliceSize(ro),0)}const EMPTY_BUFFER=Buffer$3.allocUnsafe(0),EMPTY_WITNESS=[],ZERO$1=Buffer$3.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),ONE=Buffer$3.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=Buffer$3.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_BUFFER,valueBuffer:VALUE_UINT64_MAX};function isOutput(Xr){return Xr.value!==void 0}let Transaction$1=class Dp{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(eo,to){const ro=new bufferutils_1$2.BufferReader(eo),no=new Dp;no.version=ro.readInt32();const io=ro.readUInt8(),oo=ro.readUInt8();let ao=!1;io===Dp.ADVANCED_TRANSACTION_MARKER&&oo===Dp.ADVANCED_TRANSACTION_FLAG?ao=!0:ro.offset-=2;const so=ro.readVarInt();for(let lo=0;loeo.witness.length!==0)}weight(){const eo=this.byteLength(!1),to=this.byteLength(!0);return eo*3+to}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(eo=!0){const to=eo&&this.hasWitnesses();return(to?10:8)+bufferutils_1$2.varuint.encodingLength(this.ins.length)+bufferutils_1$2.varuint.encodingLength(this.outs.length)+this.ins.reduce((ro,no)=>ro+40+varSliceSize(no.script),0)+this.outs.reduce((ro,no)=>ro+8+varSliceSize(no.script),0)+(to?this.ins.reduce((ro,no)=>ro+vectorSize(no.witness),0):0)}clone(){const eo=new Dp;return eo.version=this.version,eo.locktime=this.locktime,eo.ins=this.ins.map(to=>({hash:to.hash,index:to.index,script:to.script,sequence:to.sequence,witness:to.witness})),eo.outs=this.outs.map(to=>({script:to.script,value:to.value})),eo}hashForSignature(eo,to,ro){if(typeforce$1(types$3.tuple(types$3.UInt32,types$3.Buffer,types$3.Number),arguments),eo>=this.ins.length)return ONE;const no=bscript$2.compile(bscript$2.decompile(to).filter(ao=>ao!==script_1.OPS.OP_CODESEPARATOR)),io=this.clone();if((ro&31)===Dp.SIGHASH_NONE)io.outs=[],io.ins.forEach((ao,so)=>{so!==eo&&(ao.sequence=0)});else if((ro&31)===Dp.SIGHASH_SINGLE){if(eo>=this.outs.length)return ONE;io.outs.length=eo+1;for(let ao=0;ao{so!==eo&&(ao.sequence=0)})}ro&Dp.SIGHASH_ANYONECANPAY?(io.ins=[io.ins[eo]],io.ins[0].script=no):(io.ins.forEach(ao=>{ao.script=EMPTY_BUFFER}),io.ins[eo].script=no);const oo=Buffer$3.allocUnsafe(io.byteLength(!1)+4);return oo.writeInt32LE(ro,oo.length-4),io.__toBuffer(oo,0,!1),bcrypto$1.hash256(oo)}hashForWitnessV1(eo,to,ro,no,io,oo){if(typeforce$1(types$3.tuple(types$3.UInt32,typeforce$1.arrayOf(types$3.Buffer),typeforce$1.arrayOf(types$3.Satoshi),types$3.UInt32),arguments),ro.length!==this.ins.length||to.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const ao=no===Dp.SIGHASH_DEFAULT?Dp.SIGHASH_ALL:no&Dp.SIGHASH_OUTPUT_MASK,co=(no&Dp.SIGHASH_INPUT_MASK)===Dp.SIGHASH_ANYONECANPAY,lo=ao===Dp.SIGHASH_NONE,fo=ao===Dp.SIGHASH_SINGLE;let ho=EMPTY_BUFFER,go=EMPTY_BUFFER,yo=EMPTY_BUFFER,vo=EMPTY_BUFFER,wo=EMPTY_BUFFER;if(!co){let Po=bufferutils_1$2.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach(jo=>{Po.writeSlice(jo.hash),Po.writeUInt32(jo.index)}),ho=bcrypto$1.sha256(Po.end()),Po=bufferutils_1$2.BufferWriter.withCapacity(8*this.ins.length),ro.forEach(jo=>Po.writeUInt64(jo)),go=bcrypto$1.sha256(Po.end()),Po=bufferutils_1$2.BufferWriter.withCapacity(to.map(varSliceSize).reduce((jo,Mo)=>jo+Mo)),to.forEach(jo=>Po.writeVarSlice(jo)),yo=bcrypto$1.sha256(Po.end()),Po=bufferutils_1$2.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach(jo=>Po.writeUInt32(jo.sequence)),vo=bcrypto$1.sha256(Po.end())}if(lo||fo){if(fo&&eo8+varSliceSize(Mo.script)).reduce((Mo,No)=>Mo+No),jo=bufferutils_1$2.BufferWriter.withCapacity(Po);this.outs.forEach(Mo=>{jo.writeUInt64(Mo.value),jo.writeVarSlice(Mo.script)}),wo=bcrypto$1.sha256(jo.end())}const Eo=(io?2:0)+(oo?1:0),ko=174-(co?49:0)-(lo?32:0)+(oo?32:0)+(io?37:0),Ao=bufferutils_1$2.BufferWriter.withCapacity(ko);if(Ao.writeUInt8(no),Ao.writeInt32(this.version),Ao.writeUInt32(this.locktime),Ao.writeSlice(ho),Ao.writeSlice(go),Ao.writeSlice(yo),Ao.writeSlice(vo),lo||fo||Ao.writeSlice(wo),Ao.writeUInt8(Eo),co){const Po=this.ins[eo];Ao.writeSlice(Po.hash),Ao.writeUInt32(Po.index),Ao.writeUInt64(ro[eo]),Ao.writeVarSlice(to[eo]),Ao.writeUInt32(Po.sequence)}else Ao.writeUInt32(eo);if(oo){const Po=bufferutils_1$2.BufferWriter.withCapacity(varSliceSize(oo));Po.writeVarSlice(oo),Ao.writeSlice(bcrypto$1.sha256(Po.end()))}return fo&&Ao.writeSlice(wo),io&&(Ao.writeSlice(io),Ao.writeUInt8(0),Ao.writeUInt32(4294967295)),bcrypto$1.taggedHash("TapSighash",Buffer$3.concat([Buffer$3.from([0]),Ao.end()]))}hashForWitnessV0(eo,to,ro,no){typeforce$1(types$3.tuple(types$3.UInt32,types$3.Buffer,types$3.Satoshi,types$3.UInt32),arguments);let io=Buffer$3.from([]),oo,ao=ZERO$1,so=ZERO$1,co=ZERO$1;if(no&Dp.SIGHASH_ANYONECANPAY||(io=Buffer$3.allocUnsafe(36*this.ins.length),oo=new bufferutils_1$2.BufferWriter(io,0),this.ins.forEach(fo=>{oo.writeSlice(fo.hash),oo.writeUInt32(fo.index)}),so=bcrypto$1.hash256(io)),!(no&Dp.SIGHASH_ANYONECANPAY)&&(no&31)!==Dp.SIGHASH_SINGLE&&(no&31)!==Dp.SIGHASH_NONE&&(io=Buffer$3.allocUnsafe(4*this.ins.length),oo=new bufferutils_1$2.BufferWriter(io,0),this.ins.forEach(fo=>{oo.writeUInt32(fo.sequence)}),co=bcrypto$1.hash256(io)),(no&31)!==Dp.SIGHASH_SINGLE&&(no&31)!==Dp.SIGHASH_NONE){const fo=this.outs.reduce((ho,go)=>ho+8+varSliceSize(go.script),0);io=Buffer$3.allocUnsafe(fo),oo=new bufferutils_1$2.BufferWriter(io,0),this.outs.forEach(ho=>{oo.writeUInt64(ho.value),oo.writeVarSlice(ho.script)}),ao=bcrypto$1.hash256(io)}else if((no&31)===Dp.SIGHASH_SINGLE&&eo{no.writeSlice(oo.hash),no.writeUInt32(oo.index),no.writeVarSlice(oo.script),no.writeUInt32(oo.sequence)}),no.writeVarInt(this.outs.length),this.outs.forEach(oo=>{isOutput(oo)?no.writeUInt64(oo.value):no.writeSlice(oo.valueBuffer),no.writeVarSlice(oo.script)}),io&&this.ins.forEach(oo=>{no.writeVector(oo.witness)}),no.writeUInt32(this.locktime),to!==void 0?eo.slice(to,no.offset):eo}};transaction.Transaction=Transaction$1;Transaction$1.DEFAULT_SEQUENCE=4294967295;Transaction$1.SIGHASH_DEFAULT=0;Transaction$1.SIGHASH_ALL=1;Transaction$1.SIGHASH_NONE=2;Transaction$1.SIGHASH_SINGLE=3;Transaction$1.SIGHASH_ANYONECANPAY=128;Transaction$1.SIGHASH_OUTPUT_MASK=3;Transaction$1.SIGHASH_INPUT_MASK=128;Transaction$1.ADVANCED_TRANSACTION_MARKER=0;Transaction$1.ADVANCED_TRANSACTION_FLAG=1;Object.defineProperty(block,"__esModule",{value:!0});block.Block=void 0;const bufferutils_1$1=bufferutils,bcrypto=crypto$3,merkle_1=merkle,transaction_1$3=transaction,types$2=types$7,{typeforce}=types$2,errorMerkleNoTxes=new TypeError("Cannot compute merkle root for zero transactions"),errorWitnessNotSegwit=new TypeError("Cannot compute witness commit for non-segwit block");let Block$1=class K0{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(eo){if(eo.length<80)throw new Error("Buffer too small (< 80 bytes)");const to=new bufferutils_1$1.BufferReader(eo),ro=new K0;if(ro.version=to.readInt32(),ro.prevHash=to.readSlice(32),ro.merkleRoot=to.readSlice(32),ro.timestamp=to.readUInt32(),ro.bits=to.readUInt32(),ro.nonce=to.readUInt32(),eo.length===80)return ro;const no=()=>{const ao=transaction_1$3.Transaction.fromBuffer(to.buffer.slice(to.offset),!0);return to.offset+=ao.byteLength(),ao},io=to.readVarInt();ro.transactions=[];for(let ao=0;ao>24)-3,ro=eo&8388607,no=Buffer$3.alloc(32,0);return no.writeUIntBE(ro,29-to,3),no}static calculateMerkleRoot(eo,to){if(typeforce([{getHash:types$2.Function}],eo),eo.length===0)throw errorMerkleNoTxes;if(to&&!txesHaveWitnessCommit(eo))throw errorWitnessNotSegwit;const ro=eo.map(io=>io.getHash(to)),no=(0,merkle_1.fastMerkleRoot)(ro,bcrypto.hash256);return to?bcrypto.hash256(Buffer$3.concat([no,eo[0].ins[0].witness[0]])):no}getWitnessCommit(){if(!txesHaveWitnessCommit(this.transactions))return null;const eo=this.transactions[0].outs.filter(ro=>ro.script.slice(0,6).equals(Buffer$3.from("6a24aa21a9ed","hex"))).map(ro=>ro.script.slice(6,38));if(eo.length===0)return null;const to=eo[eo.length-1];return to instanceof Buffer$3&&to.length===32?to:null}hasWitnessCommit(){return this.witnessCommit instanceof Buffer$3&&this.witnessCommit.length===32||this.getWitnessCommit()!==null}hasWitness(){return anyTxHasWitness(this.transactions)}weight(){const eo=this.byteLength(!1,!1),to=this.byteLength(!1,!0);return eo*3+to}byteLength(eo,to=!0){return eo||!this.transactions?80:80+bufferutils_1$1.varuint.encodingLength(this.transactions.length)+this.transactions.reduce((ro,no)=>ro+no.byteLength(to),0)}getHash(){return bcrypto.hash256(this.toBuffer(!0))}getId(){return(0,bufferutils_1$1.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const eo=new Date(0);return eo.setUTCSeconds(this.timestamp),eo}toBuffer(eo){const to=Buffer$3.allocUnsafe(this.byteLength(eo)),ro=new bufferutils_1$1.BufferWriter(to);return ro.writeInt32(this.version),ro.writeSlice(this.prevHash),ro.writeSlice(this.merkleRoot),ro.writeUInt32(this.timestamp),ro.writeUInt32(this.bits),ro.writeUInt32(this.nonce),eo||!this.transactions||(bufferutils_1$1.varuint.encode(this.transactions.length,to,ro.offset),ro.offset+=bufferutils_1$1.varuint.encode.bytes,this.transactions.forEach(no=>{const io=no.byteLength();no.toBuffer(to,ro.offset),ro.offset+=io})),to}toHex(eo){return this.toBuffer(eo).toString("hex")}checkTxRoots(){const eo=this.hasWitnessCommit();return!eo&&this.hasWitness()?!1:this.__checkMerkleRoot()&&(eo?this.__checkWitnessCommit():!0)}checkProofOfWork(){const eo=(0,bufferutils_1$1.reverseBuffer)(this.getHash()),to=K0.calculateTarget(this.bits);return eo.compare(to)<=0}__checkMerkleRoot(){if(!this.transactions)throw errorMerkleNoTxes;const eo=K0.calculateMerkleRoot(this.transactions);return this.merkleRoot.compare(eo)===0}__checkWitnessCommit(){if(!this.transactions)throw errorMerkleNoTxes;if(!this.hasWitnessCommit())throw errorWitnessNotSegwit;const eo=K0.calculateMerkleRoot(this.transactions,!0);return this.witnessCommit.compare(eo)===0}};block.Block=Block$1;function txesHaveWitnessCommit(Xr){return Xr instanceof Array&&Xr[0]&&Xr[0].ins&&Xr[0].ins instanceof Array&&Xr[0].ins[0]&&Xr[0].ins[0].witness&&Xr[0].ins[0].witness instanceof Array&&Xr[0].ins[0].witness.length>0}function anyTxHasWitness(Xr){return Xr instanceof Array&&Xr.some(eo=>typeof eo=="object"&&eo.ins instanceof Array&&eo.ins.some(to=>typeof to=="object"&&to.witness instanceof Array&&to.witness.length>0))}var psbt$1={},psbt={},combiner={},parser={},fromBuffer={},converter={},typeFields={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),function(eo){eo[eo.UNSIGNED_TX=0]="UNSIGNED_TX",eo[eo.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(Xr.GlobalTypes||(Xr.GlobalTypes={})),Xr.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],function(eo){eo[eo.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",eo[eo.WITNESS_UTXO=1]="WITNESS_UTXO",eo[eo.PARTIAL_SIG=2]="PARTIAL_SIG",eo[eo.SIGHASH_TYPE=3]="SIGHASH_TYPE",eo[eo.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",eo[eo.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",eo[eo.BIP32_DERIVATION=6]="BIP32_DERIVATION",eo[eo.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",eo[eo.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",eo[eo.POR_COMMITMENT=9]="POR_COMMITMENT",eo[eo.TAP_KEY_SIG=19]="TAP_KEY_SIG",eo[eo.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",eo[eo.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",eo[eo.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",eo[eo.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",eo[eo.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"}(Xr.InputTypes||(Xr.InputTypes={})),Xr.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],function(eo){eo[eo.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",eo[eo.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",eo[eo.BIP32_DERIVATION=2]="BIP32_DERIVATION",eo[eo.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",eo[eo.TAP_TREE=6]="TAP_TREE",eo[eo.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"}(Xr.OutputTypes||(Xr.OutputTypes={})),Xr.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]})(typeFields);var globalXpub$1={};Object.defineProperty(globalXpub$1,"__esModule",{value:!0});const typeFields_1$g=typeFields,range$3=Xr=>[...Array(Xr).keys()];function decode$j(Xr){if(Xr.key[0]!==typeFields_1$g.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+Xr.key.toString("hex"));if(Xr.key.length!==79||![2,3].includes(Xr.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+Xr.key.toString("hex"));if(Xr.value.length/4%1!==0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const eo=Xr.key.slice(1),to={masterFingerprint:Xr.value.slice(0,4),extendedPubkey:eo,path:"m"};for(const ro of range$3(Xr.value.length/4-1)){const no=Xr.value.readUInt32LE(ro*4+4),io=!!(no&2147483648),oo=no&2147483647;to.path+="/"+oo.toString(10)+(io?"'":"")}return to}globalXpub$1.decode=decode$j;function encode$h(Xr){const eo=Buffer$3.from([typeFields_1$g.GlobalTypes.GLOBAL_XPUB]),to=Buffer$3.concat([eo,Xr.extendedPubkey]),ro=Xr.path.split("/"),no=Buffer$3.allocUnsafe(ro.length*4);Xr.masterFingerprint.copy(no,0);let io=4;return ro.slice(1).forEach(oo=>{const ao=oo.slice(-1)==="'";let so=2147483647&parseInt(ao?oo.slice(0,-1):oo,10);ao&&(so+=2147483648),no.writeUInt32LE(so,io),io+=4}),{key:to,value:no}}globalXpub$1.encode=encode$h;globalXpub$1.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }";function check$c(Xr){const eo=Xr.extendedPubkey,to=Xr.masterFingerprint,ro=Xr.path;return Buffer$3.isBuffer(eo)&&eo.length===78&&[2,3].indexOf(eo[45])>-1&&Buffer$3.isBuffer(to)&&to.length===4&&typeof ro=="string"&&!!ro.match(/^m(\/\d+'?)*$/)}globalXpub$1.check=check$c;function canAddToArray$3(Xr,eo,to){const ro=eo.extendedPubkey.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.extendedPubkey.equals(eo.extendedPubkey)).length===0)}globalXpub$1.canAddToArray=canAddToArray$3;var unsignedTx$1={};Object.defineProperty(unsignedTx$1,"__esModule",{value:!0});const typeFields_1$f=typeFields;function encode$g(Xr){return{key:Buffer$3.from([typeFields_1$f.GlobalTypes.UNSIGNED_TX]),value:Xr.toBuffer()}}unsignedTx$1.encode=encode$g;var finalScriptSig$1={};Object.defineProperty(finalScriptSig$1,"__esModule",{value:!0});const typeFields_1$e=typeFields;function decode$i(Xr){if(Xr.key[0]!==typeFields_1$e.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+Xr.key.toString("hex"));return Xr.value}finalScriptSig$1.decode=decode$i;function encode$f(Xr){return{key:Buffer$3.from([typeFields_1$e.InputTypes.FINAL_SCRIPTSIG]),value:Xr}}finalScriptSig$1.encode=encode$f;finalScriptSig$1.expected="Buffer";function check$b(Xr){return Buffer$3.isBuffer(Xr)}finalScriptSig$1.check=check$b;function canAdd$8(Xr,eo){return!!Xr&&!!eo&&Xr.finalScriptSig===void 0}finalScriptSig$1.canAdd=canAdd$8;var finalScriptWitness$1={};Object.defineProperty(finalScriptWitness$1,"__esModule",{value:!0});const typeFields_1$d=typeFields;function decode$h(Xr){if(Xr.key[0]!==typeFields_1$d.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+Xr.key.toString("hex"));return Xr.value}finalScriptWitness$1.decode=decode$h;function encode$e(Xr){return{key:Buffer$3.from([typeFields_1$d.InputTypes.FINAL_SCRIPTWITNESS]),value:Xr}}finalScriptWitness$1.encode=encode$e;finalScriptWitness$1.expected="Buffer";function check$a(Xr){return Buffer$3.isBuffer(Xr)}finalScriptWitness$1.check=check$a;function canAdd$7(Xr,eo){return!!Xr&&!!eo&&Xr.finalScriptWitness===void 0}finalScriptWitness$1.canAdd=canAdd$7;var nonWitnessUtxo$1={};Object.defineProperty(nonWitnessUtxo$1,"__esModule",{value:!0});const typeFields_1$c=typeFields;function decode$g(Xr){if(Xr.key[0]!==typeFields_1$c.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+Xr.key.toString("hex"));return Xr.value}nonWitnessUtxo$1.decode=decode$g;function encode$d(Xr){return{key:Buffer$3.from([typeFields_1$c.InputTypes.NON_WITNESS_UTXO]),value:Xr}}nonWitnessUtxo$1.encode=encode$d;nonWitnessUtxo$1.expected="Buffer";function check$9(Xr){return Buffer$3.isBuffer(Xr)}nonWitnessUtxo$1.check=check$9;function canAdd$6(Xr,eo){return!!Xr&&!!eo&&Xr.nonWitnessUtxo===void 0}nonWitnessUtxo$1.canAdd=canAdd$6;var partialSig$1={};Object.defineProperty(partialSig$1,"__esModule",{value:!0});const typeFields_1$b=typeFields;function decode$f(Xr){if(Xr.key[0]!==typeFields_1$b.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+Xr.key.toString("hex"));if(!(Xr.key.length===34||Xr.key.length===66)||![2,3,4].includes(Xr.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+Xr.key.toString("hex"));return{pubkey:Xr.key.slice(1),signature:Xr.value}}partialSig$1.decode=decode$f;function encode$c(Xr){const eo=Buffer$3.from([typeFields_1$b.InputTypes.PARTIAL_SIG]);return{key:Buffer$3.concat([eo,Xr.pubkey]),value:Xr.signature}}partialSig$1.encode=encode$c;partialSig$1.expected="{ pubkey: Buffer; signature: Buffer; }";function check$8(Xr){return Buffer$3.isBuffer(Xr.pubkey)&&Buffer$3.isBuffer(Xr.signature)&&[33,65].includes(Xr.pubkey.length)&&[2,3,4].includes(Xr.pubkey[0])&&isDerSigWithSighash(Xr.signature)}partialSig$1.check=check$8;function isDerSigWithSighash(Xr){if(!Buffer$3.isBuffer(Xr)||Xr.length<9||Xr[0]!==48||Xr.length!==Xr[1]+3||Xr[2]!==2)return!1;const eo=Xr[3];if(eo>33||eo<1||Xr[3+eo+1]!==2)return!1;const to=Xr[3+eo+2];return!(to>33||to<1||Xr.length!==3+eo+2+to+2)}function canAddToArray$2(Xr,eo,to){const ro=eo.pubkey.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.pubkey.equals(eo.pubkey)).length===0)}partialSig$1.canAddToArray=canAddToArray$2;var porCommitment$1={};Object.defineProperty(porCommitment$1,"__esModule",{value:!0});const typeFields_1$a=typeFields;function decode$e(Xr){if(Xr.key[0]!==typeFields_1$a.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+Xr.key.toString("hex"));return Xr.value.toString("utf8")}porCommitment$1.decode=decode$e;function encode$b(Xr){return{key:Buffer$3.from([typeFields_1$a.InputTypes.POR_COMMITMENT]),value:Buffer$3.from(Xr,"utf8")}}porCommitment$1.encode=encode$b;porCommitment$1.expected="string";function check$7(Xr){return typeof Xr=="string"}porCommitment$1.check=check$7;function canAdd$5(Xr,eo){return!!Xr&&!!eo&&Xr.porCommitment===void 0}porCommitment$1.canAdd=canAdd$5;var sighashType$1={};Object.defineProperty(sighashType$1,"__esModule",{value:!0});const typeFields_1$9=typeFields;function decode$d(Xr){if(Xr.key[0]!==typeFields_1$9.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+Xr.key.toString("hex"));return Xr.value.readUInt32LE(0)}sighashType$1.decode=decode$d;function encode$a(Xr){const eo=Buffer$3.from([typeFields_1$9.InputTypes.SIGHASH_TYPE]),to=Buffer$3.allocUnsafe(4);return to.writeUInt32LE(Xr,0),{key:eo,value:to}}sighashType$1.encode=encode$a;sighashType$1.expected="number";function check$6(Xr){return typeof Xr=="number"}sighashType$1.check=check$6;function canAdd$4(Xr,eo){return!!Xr&&!!eo&&Xr.sighashType===void 0}sighashType$1.canAdd=canAdd$4;var tapKeySig$1={};Object.defineProperty(tapKeySig$1,"__esModule",{value:!0});const typeFields_1$8=typeFields;function decode$c(Xr){if(Xr.key[0]!==typeFields_1$8.InputTypes.TAP_KEY_SIG||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+Xr.key.toString("hex"));if(!check$5(Xr.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return Xr.value}tapKeySig$1.decode=decode$c;function encode$9(Xr){return{key:Buffer$3.from([typeFields_1$8.InputTypes.TAP_KEY_SIG]),value:Xr}}tapKeySig$1.encode=encode$9;tapKeySig$1.expected="Buffer";function check$5(Xr){return Buffer$3.isBuffer(Xr)&&(Xr.length===64||Xr.length===65)}tapKeySig$1.check=check$5;function canAdd$3(Xr,eo){return!!Xr&&!!eo&&Xr.tapKeySig===void 0}tapKeySig$1.canAdd=canAdd$3;var tapLeafScript$1={};Object.defineProperty(tapLeafScript$1,"__esModule",{value:!0});const typeFields_1$7=typeFields;function decode$b(Xr){if(Xr.key[0]!==typeFields_1$7.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+Xr.key.toString("hex"));if((Xr.key.length-2)%32!==0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+Xr.key.toString("hex"));const eo=Xr.value[Xr.value.length-1];if((Xr.key[1]&254)!==eo)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+Xr.key.toString("hex"));const to=Xr.value.slice(0,-1);return{controlBlock:Xr.key.slice(1),script:to,leafVersion:eo}}tapLeafScript$1.decode=decode$b;function encode$8(Xr){const eo=Buffer$3.from([typeFields_1$7.InputTypes.TAP_LEAF_SCRIPT]),to=Buffer$3.from([Xr.leafVersion]);return{key:Buffer$3.concat([eo,Xr.controlBlock]),value:Buffer$3.concat([Xr.script,to])}}tapLeafScript$1.encode=encode$8;tapLeafScript$1.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }";function check$4(Xr){return Buffer$3.isBuffer(Xr.controlBlock)&&(Xr.controlBlock.length-1)%32===0&&(Xr.controlBlock[0]&254)===Xr.leafVersion&&Buffer$3.isBuffer(Xr.script)}tapLeafScript$1.check=check$4;function canAddToArray$1(Xr,eo,to){const ro=eo.controlBlock.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.controlBlock.equals(eo.controlBlock)).length===0)}tapLeafScript$1.canAddToArray=canAddToArray$1;var tapMerkleRoot$1={};Object.defineProperty(tapMerkleRoot$1,"__esModule",{value:!0});const typeFields_1$6=typeFields;function decode$a(Xr){if(Xr.key[0]!==typeFields_1$6.InputTypes.TAP_MERKLE_ROOT||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+Xr.key.toString("hex"));if(!check$3(Xr.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return Xr.value}tapMerkleRoot$1.decode=decode$a;function encode$7(Xr){return{key:Buffer$3.from([typeFields_1$6.InputTypes.TAP_MERKLE_ROOT]),value:Xr}}tapMerkleRoot$1.encode=encode$7;tapMerkleRoot$1.expected="Buffer";function check$3(Xr){return Buffer$3.isBuffer(Xr)&&Xr.length===32}tapMerkleRoot$1.check=check$3;function canAdd$2(Xr,eo){return!!Xr&&!!eo&&Xr.tapMerkleRoot===void 0}tapMerkleRoot$1.canAdd=canAdd$2;var tapScriptSig$1={};Object.defineProperty(tapScriptSig$1,"__esModule",{value:!0});const typeFields_1$5=typeFields;function decode$9(Xr){if(Xr.key[0]!==typeFields_1$5.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+Xr.key.toString("hex"));if(Xr.key.length!==65)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+Xr.key.toString("hex"));if(Xr.value.length!==64&&Xr.value.length!==65)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+Xr.key.toString("hex"));const eo=Xr.key.slice(1,33),to=Xr.key.slice(33);return{pubkey:eo,leafHash:to,signature:Xr.value}}tapScriptSig$1.decode=decode$9;function encode$6(Xr){const eo=Buffer$3.from([typeFields_1$5.InputTypes.TAP_SCRIPT_SIG]);return{key:Buffer$3.concat([eo,Xr.pubkey,Xr.leafHash]),value:Xr.signature}}tapScriptSig$1.encode=encode$6;tapScriptSig$1.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }";function check$2(Xr){return Buffer$3.isBuffer(Xr.pubkey)&&Buffer$3.isBuffer(Xr.leafHash)&&Buffer$3.isBuffer(Xr.signature)&&Xr.pubkey.length===32&&Xr.leafHash.length===32&&(Xr.signature.length===64||Xr.signature.length===65)}tapScriptSig$1.check=check$2;function canAddToArray(Xr,eo,to){const ro=eo.pubkey.toString("hex")+eo.leafHash.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.pubkey.equals(eo.pubkey)&&no.leafHash.equals(eo.leafHash)).length===0)}tapScriptSig$1.canAddToArray=canAddToArray;var witnessUtxo$1={},tools={},varint={};Object.defineProperty(varint,"__esModule",{value:!0});const MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(Xr){if(Xr<0||Xr>MAX_SAFE_INTEGER||Xr%1!==0)throw new RangeError("value out of range")}function encode$5(Xr,eo,to){if(checkUInt53(Xr),eo||(eo=Buffer$3.allocUnsafe(encodingLength(Xr))),!Buffer$3.isBuffer(eo))throw new TypeError("buffer must be a Buffer instance");return to||(to=0),Xr<253?(eo.writeUInt8(Xr,to),Object.assign(encode$5,{bytes:1})):Xr<=65535?(eo.writeUInt8(253,to),eo.writeUInt16LE(Xr,to+1),Object.assign(encode$5,{bytes:3})):Xr<=4294967295?(eo.writeUInt8(254,to),eo.writeUInt32LE(Xr,to+1),Object.assign(encode$5,{bytes:5})):(eo.writeUInt8(255,to),eo.writeUInt32LE(Xr>>>0,to+1),eo.writeUInt32LE(Xr/4294967296|0,to+5),Object.assign(encode$5,{bytes:9})),eo}varint.encode=encode$5;function decode$8(Xr,eo){if(!Buffer$3.isBuffer(Xr))throw new TypeError("buffer must be a Buffer instance");eo||(eo=0);const to=Xr.readUInt8(eo);if(to<253)return Object.assign(decode$8,{bytes:1}),to;if(to===253)return Object.assign(decode$8,{bytes:3}),Xr.readUInt16LE(eo+1);if(to===254)return Object.assign(decode$8,{bytes:5}),Xr.readUInt32LE(eo+1);{Object.assign(decode$8,{bytes:9});const ro=Xr.readUInt32LE(eo+1),io=Xr.readUInt32LE(eo+5)*4294967296+ro;return checkUInt53(io),io}}varint.decode=decode$8;function encodingLength(Xr){return checkUInt53(Xr),Xr<253?1:Xr<=65535?3:Xr<=4294967295?5:9}varint.encodingLength=encodingLength;Object.defineProperty(tools,"__esModule",{value:!0});const varuint$6=varint;tools.range=Xr=>[...Array(Xr).keys()];function reverseBuffer(Xr){if(Xr.length<1)return Xr;let eo=Xr.length-1,to=0;for(let ro=0;roeo)throw new Error("RangeError: value out of range");if(Math.floor(Xr)!==Xr)throw new Error("value has a fractional component")}function readUInt64LE(Xr,eo){const to=Xr.readUInt32LE(eo);let ro=Xr.readUInt32LE(eo+4);return ro*=4294967296,verifuint(ro+to,9007199254740991),ro+to}tools.readUInt64LE=readUInt64LE;function writeUInt64LE(Xr,eo,to){return verifuint(eo,9007199254740991),Xr.writeInt32LE(eo&-1,to),Xr.writeUInt32LE(Math.floor(eo/4294967296),to+4),to+8}tools.writeUInt64LE=writeUInt64LE;Object.defineProperty(witnessUtxo$1,"__esModule",{value:!0});const typeFields_1$4=typeFields,tools_1$2=tools,varuint$5=varint;function decode$7(Xr){if(Xr.key[0]!==typeFields_1$4.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+Xr.key.toString("hex"));const eo=tools_1$2.readUInt64LE(Xr.value,0);let to=8;const ro=varuint$5.decode(Xr.value,to);to+=varuint$5.encodingLength(ro);const no=Xr.value.slice(to);if(no.length!==ro)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:no,value:eo}}witnessUtxo$1.decode=decode$7;function encode$4(Xr){const{script:eo,value:to}=Xr,ro=varuint$5.encodingLength(eo.length),no=Buffer$3.allocUnsafe(8+ro+eo.length);return tools_1$2.writeUInt64LE(no,to,0),varuint$5.encode(eo.length,no,8),eo.copy(no,8+ro),{key:Buffer$3.from([typeFields_1$4.InputTypes.WITNESS_UTXO]),value:no}}witnessUtxo$1.encode=encode$4;witnessUtxo$1.expected="{ script: Buffer; value: number; }";function check$1(Xr){return Buffer$3.isBuffer(Xr.script)&&typeof Xr.value=="number"}witnessUtxo$1.check=check$1;function canAdd$1(Xr,eo){return!!Xr&&!!eo&&Xr.witnessUtxo===void 0}witnessUtxo$1.canAdd=canAdd$1;var tapTree$1={};Object.defineProperty(tapTree$1,"__esModule",{value:!0});const typeFields_1$3=typeFields,varuint$4=varint;function decode$6(Xr){if(Xr.key[0]!==typeFields_1$3.OutputTypes.TAP_TREE||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapTree with key 0x"+Xr.key.toString("hex"));let eo=0;const to=[];for(;eo[Buffer$3.of(ro.depth,ro.leafVersion),varuint$4.encode(ro.script.length),ro.script]));return{key:eo,value:Buffer$3.concat(to)}}tapTree$1.encode=encode$3;tapTree$1.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }";function check(Xr){return Array.isArray(Xr.leaves)&&Xr.leaves.every(eo=>eo.depth>=0&&eo.depth<=128&&(eo.leafVersion&254)===eo.leafVersion&&Buffer$3.isBuffer(eo.script))}tapTree$1.check=check;function canAdd(Xr,eo){return!!Xr&&!!eo&&Xr.tapTree===void 0}tapTree$1.canAdd=canAdd;var bip32Derivation$2={};Object.defineProperty(bip32Derivation$2,"__esModule",{value:!0});const range$2=Xr=>[...Array(Xr).keys()],isValidDERKey=Xr=>Xr.length===33&&[2,3].includes(Xr[0])||Xr.length===65&&Xr[0]===4;function makeConverter$4(Xr,eo=isValidDERKey){function to(ao){if(ao.key[0]!==Xr)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+ao.key.toString("hex"));const so=ao.key.slice(1);if(!eo(so))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+ao.key.toString("hex"));if(ao.value.length/4%1!==0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const co={masterFingerprint:ao.value.slice(0,4),pubkey:so,path:"m"};for(const lo of range$2(ao.value.length/4-1)){const fo=ao.value.readUInt32LE(lo*4+4),ho=!!(fo&2147483648),go=fo&2147483647;co.path+="/"+go.toString(10)+(ho?"'":"")}return co}function ro(ao){const so=Buffer$3.from([Xr]),co=Buffer$3.concat([so,ao.pubkey]),lo=ao.path.split("/"),fo=Buffer$3.allocUnsafe(lo.length*4);ao.masterFingerprint.copy(fo,0);let ho=4;return lo.slice(1).forEach(go=>{const yo=go.slice(-1)==="'";let vo=2147483647&parseInt(yo?go.slice(0,-1):go,10);yo&&(vo+=2147483648),fo.writeUInt32LE(vo,ho),ho+=4}),{key:co,value:fo}}const no="{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }";function io(ao){return Buffer$3.isBuffer(ao.pubkey)&&Buffer$3.isBuffer(ao.masterFingerprint)&&typeof ao.path=="string"&&eo(ao.pubkey)&&ao.masterFingerprint.length===4}function oo(ao,so,co){const lo=so.pubkey.toString("hex");return co.has(lo)?!1:(co.add(lo),ao.filter(fo=>fo.pubkey.equals(so.pubkey)).length===0)}return{decode:to,encode:ro,check:io,expected:no,canAddToArray:oo}}bip32Derivation$2.makeConverter=makeConverter$4;var checkPubkey$1={};Object.defineProperty(checkPubkey$1,"__esModule",{value:!0});function makeChecker(Xr){return eo;function eo(to){let ro;if(Xr.includes(to.key[0])&&(ro=to.key.slice(1),!(ro.length===33||ro.length===65)||![2,3,4].includes(ro[0])))throw new Error("Format Error: invalid pubkey in key 0x"+to.key.toString("hex"));return ro}}checkPubkey$1.makeChecker=makeChecker;var redeemScript$1={};Object.defineProperty(redeemScript$1,"__esModule",{value:!0});function makeConverter$3(Xr){function eo(oo){if(oo.key[0]!==Xr)throw new Error("Decode Error: could not decode redeemScript with key 0x"+oo.key.toString("hex"));return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)}function io(oo,ao){return!!oo&&!!ao&&oo.redeemScript===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}redeemScript$1.makeConverter=makeConverter$3;var tapBip32Derivation$1={};Object.defineProperty(tapBip32Derivation$1,"__esModule",{value:!0});const varuint$3=varint,bip32Derivation$1=bip32Derivation$2,isValidBIP340Key=Xr=>Xr.length===32;function makeConverter$2(Xr){const eo=bip32Derivation$1.makeConverter(Xr,isValidBIP340Key);function to(oo){const ao=varuint$3.decode(oo.value),so=varuint$3.encodingLength(ao),co=eo.decode({key:oo.key,value:oo.value.slice(so+ao*32)}),lo=new Array(ao);for(let fo=0,ho=so;foBuffer$3.isBuffer(ao)&&ao.length===32)&&eo.check(oo)}return{decode:to,encode:ro,check:io,expected:no,canAddToArray:eo.canAddToArray}}tapBip32Derivation$1.makeConverter=makeConverter$2;var tapInternalKey$1={};Object.defineProperty(tapInternalKey$1,"__esModule",{value:!0});function makeConverter$1(Xr){function eo(oo){if(oo.key[0]!==Xr||oo.key.length!==1)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+oo.key.toString("hex"));if(oo.value.length!==32)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)&&oo.length===32}function io(oo,ao){return!!oo&&!!ao&&oo.tapInternalKey===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}tapInternalKey$1.makeConverter=makeConverter$1;var witnessScript$1={};Object.defineProperty(witnessScript$1,"__esModule",{value:!0});function makeConverter(Xr){function eo(oo){if(oo.key[0]!==Xr)throw new Error("Decode Error: could not decode witnessScript with key 0x"+oo.key.toString("hex"));return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)}function io(oo,ao){return!!oo&&!!ao&&oo.witnessScript===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}witnessScript$1.makeConverter=makeConverter;Object.defineProperty(converter,"__esModule",{value:!0});const typeFields_1$2=typeFields,globalXpub=globalXpub$1,unsignedTx=unsignedTx$1,finalScriptSig=finalScriptSig$1,finalScriptWitness=finalScriptWitness$1,nonWitnessUtxo=nonWitnessUtxo$1,partialSig=partialSig$1,porCommitment=porCommitment$1,sighashType=sighashType$1,tapKeySig=tapKeySig$1,tapLeafScript=tapLeafScript$1,tapMerkleRoot=tapMerkleRoot$1,tapScriptSig=tapScriptSig$1,witnessUtxo=witnessUtxo$1,tapTree=tapTree$1,bip32Derivation=bip32Derivation$2,checkPubkey=checkPubkey$1,redeemScript=redeemScript$1,tapBip32Derivation=tapBip32Derivation$1,tapInternalKey=tapInternalKey$1,witnessScript=witnessScript$1,globals={unsignedTx,globalXpub,checkPubkey:checkPubkey.makeChecker([])};converter.globals=globals;const inputs={nonWitnessUtxo,partialSig,sighashType,finalScriptSig,finalScriptWitness,porCommitment,witnessUtxo,bip32Derivation:bip32Derivation.makeConverter(typeFields_1$2.InputTypes.BIP32_DERIVATION),redeemScript:redeemScript.makeConverter(typeFields_1$2.InputTypes.REDEEM_SCRIPT),witnessScript:witnessScript.makeConverter(typeFields_1$2.InputTypes.WITNESS_SCRIPT),checkPubkey:checkPubkey.makeChecker([typeFields_1$2.InputTypes.PARTIAL_SIG,typeFields_1$2.InputTypes.BIP32_DERIVATION]),tapKeySig,tapScriptSig,tapLeafScript,tapBip32Derivation:tapBip32Derivation.makeConverter(typeFields_1$2.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:tapInternalKey.makeConverter(typeFields_1$2.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot};converter.inputs=inputs;const outputs={bip32Derivation:bip32Derivation.makeConverter(typeFields_1$2.OutputTypes.BIP32_DERIVATION),redeemScript:redeemScript.makeConverter(typeFields_1$2.OutputTypes.REDEEM_SCRIPT),witnessScript:witnessScript.makeConverter(typeFields_1$2.OutputTypes.WITNESS_SCRIPT),checkPubkey:checkPubkey.makeChecker([typeFields_1$2.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:tapBip32Derivation.makeConverter(typeFields_1$2.OutputTypes.TAP_BIP32_DERIVATION),tapTree,tapInternalKey:tapInternalKey.makeConverter(typeFields_1$2.OutputTypes.TAP_INTERNAL_KEY)};converter.outputs=outputs;Object.defineProperty(fromBuffer,"__esModule",{value:!0});const convert$3=converter,tools_1$1=tools,varuint$2=varint,typeFields_1$1=typeFields;function psbtFromBuffer(Xr,eo){let to=0;function ro(){const wo=varuint$2.decode(Xr,to);to+=varuint$2.encodingLength(wo);const Eo=Xr.slice(to,to+wo);return to+=wo,Eo}function no(){const wo=Xr.readUInt32BE(to);return to+=4,wo}function io(){const wo=Xr.readUInt8(to);return to+=1,wo}function oo(){const wo=ro(),Eo=ro();return{key:wo,value:Eo}}function ao(){if(to>=Xr.length)throw new Error("Format Error: Unexpected End of PSBT");const wo=Xr.readUInt8(to)===0;return wo&&to++,wo}if(no()!==1886610036)throw new Error("Format Error: Invalid Magic Number");if(io()!==255)throw new Error("Format Error: Magic Number must be followed by 0xff separator");const so=[],co={};for(;!ao();){const wo=oo(),Eo=wo.key.toString("hex");if(co[Eo])throw new Error("Format Error: Keys must be unique for global keymap: key "+Eo);co[Eo]=1,so.push(wo)}const lo=so.filter(wo=>wo.key[0]===typeFields_1$1.GlobalTypes.UNSIGNED_TX);if(lo.length!==1)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const fo=eo(lo[0].value),{inputCount:ho,outputCount:go}=fo.getInputOutputCounts(),yo=[],vo=[];for(const wo of tools_1$1.range(ho)){const Eo={},ko=[];for(;!ao();){const Ao=oo(),Po=Ao.key.toString("hex");if(Eo[Po])throw new Error("Format Error: Keys must be unique for each input: input index "+wo+" key "+Po);Eo[Po]=1,ko.push(Ao)}yo.push(ko)}for(const wo of tools_1$1.range(go)){const Eo={},ko=[];for(;!ao();){const Ao=oo(),Po=Ao.key.toString("hex");if(Eo[Po])throw new Error("Format Error: Keys must be unique for each output: output index "+wo+" key "+Po);Eo[Po]=1,ko.push(Ao)}vo.push(ko)}return psbtFromKeyVals(fo,{globalMapKeyVals:so,inputKeyVals:yo,outputKeyVals:vo})}fromBuffer.psbtFromBuffer=psbtFromBuffer;function checkKeyBuffer(Xr,eo,to){if(!eo.equals(Buffer$3.from([to])))throw new Error(`Format Error: Invalid ${Xr} key: ${eo.toString("hex")}`)}fromBuffer.checkKeyBuffer=checkKeyBuffer;function psbtFromKeyVals(Xr,{globalMapKeyVals:eo,inputKeyVals:to,outputKeyVals:ro}){const no={unsignedTx:Xr};let io=0;for(const lo of eo)switch(lo.key[0]){case typeFields_1$1.GlobalTypes.UNSIGNED_TX:if(checkKeyBuffer("global",lo.key,typeFields_1$1.GlobalTypes.UNSIGNED_TX),io>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");io++;break;case typeFields_1$1.GlobalTypes.GLOBAL_XPUB:no.globalXpub===void 0&&(no.globalXpub=[]),no.globalXpub.push(convert$3.globals.globalXpub.decode(lo));break;default:no.unknownKeyVals||(no.unknownKeyVals=[]),no.unknownKeyVals.push(lo)}const oo=to.length,ao=ro.length,so=[],co=[];for(const lo of tools_1$1.range(oo)){const fo={};for(const ho of to[lo])switch(convert$3.inputs.checkPubkey(ho),ho.key[0]){case typeFields_1$1.InputTypes.NON_WITNESS_UTXO:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.NON_WITNESS_UTXO),fo.nonWitnessUtxo!==void 0)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");fo.nonWitnessUtxo=convert$3.inputs.nonWitnessUtxo.decode(ho);break;case typeFields_1$1.InputTypes.WITNESS_UTXO:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.WITNESS_UTXO),fo.witnessUtxo!==void 0)throw new Error("Format Error: Input has multiple WITNESS_UTXO");fo.witnessUtxo=convert$3.inputs.witnessUtxo.decode(ho);break;case typeFields_1$1.InputTypes.PARTIAL_SIG:fo.partialSig===void 0&&(fo.partialSig=[]),fo.partialSig.push(convert$3.inputs.partialSig.decode(ho));break;case typeFields_1$1.InputTypes.SIGHASH_TYPE:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.SIGHASH_TYPE),fo.sighashType!==void 0)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");fo.sighashType=convert$3.inputs.sighashType.decode(ho);break;case typeFields_1$1.InputTypes.REDEEM_SCRIPT:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.REDEEM_SCRIPT),fo.redeemScript!==void 0)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");fo.redeemScript=convert$3.inputs.redeemScript.decode(ho);break;case typeFields_1$1.InputTypes.WITNESS_SCRIPT:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.WITNESS_SCRIPT),fo.witnessScript!==void 0)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");fo.witnessScript=convert$3.inputs.witnessScript.decode(ho);break;case typeFields_1$1.InputTypes.BIP32_DERIVATION:fo.bip32Derivation===void 0&&(fo.bip32Derivation=[]),fo.bip32Derivation.push(convert$3.inputs.bip32Derivation.decode(ho));break;case typeFields_1$1.InputTypes.FINAL_SCRIPTSIG:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.FINAL_SCRIPTSIG),fo.finalScriptSig=convert$3.inputs.finalScriptSig.decode(ho);break;case typeFields_1$1.InputTypes.FINAL_SCRIPTWITNESS:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.FINAL_SCRIPTWITNESS),fo.finalScriptWitness=convert$3.inputs.finalScriptWitness.decode(ho);break;case typeFields_1$1.InputTypes.POR_COMMITMENT:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.POR_COMMITMENT),fo.porCommitment=convert$3.inputs.porCommitment.decode(ho);break;case typeFields_1$1.InputTypes.TAP_KEY_SIG:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_KEY_SIG),fo.tapKeySig=convert$3.inputs.tapKeySig.decode(ho);break;case typeFields_1$1.InputTypes.TAP_SCRIPT_SIG:fo.tapScriptSig===void 0&&(fo.tapScriptSig=[]),fo.tapScriptSig.push(convert$3.inputs.tapScriptSig.decode(ho));break;case typeFields_1$1.InputTypes.TAP_LEAF_SCRIPT:fo.tapLeafScript===void 0&&(fo.tapLeafScript=[]),fo.tapLeafScript.push(convert$3.inputs.tapLeafScript.decode(ho));break;case typeFields_1$1.InputTypes.TAP_BIP32_DERIVATION:fo.tapBip32Derivation===void 0&&(fo.tapBip32Derivation=[]),fo.tapBip32Derivation.push(convert$3.inputs.tapBip32Derivation.decode(ho));break;case typeFields_1$1.InputTypes.TAP_INTERNAL_KEY:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_INTERNAL_KEY),fo.tapInternalKey=convert$3.inputs.tapInternalKey.decode(ho);break;case typeFields_1$1.InputTypes.TAP_MERKLE_ROOT:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_MERKLE_ROOT),fo.tapMerkleRoot=convert$3.inputs.tapMerkleRoot.decode(ho);break;default:fo.unknownKeyVals||(fo.unknownKeyVals=[]),fo.unknownKeyVals.push(ho)}so.push(fo)}for(const lo of tools_1$1.range(ao)){const fo={};for(const ho of ro[lo])switch(convert$3.outputs.checkPubkey(ho),ho.key[0]){case typeFields_1$1.OutputTypes.REDEEM_SCRIPT:if(checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.REDEEM_SCRIPT),fo.redeemScript!==void 0)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");fo.redeemScript=convert$3.outputs.redeemScript.decode(ho);break;case typeFields_1$1.OutputTypes.WITNESS_SCRIPT:if(checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.WITNESS_SCRIPT),fo.witnessScript!==void 0)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");fo.witnessScript=convert$3.outputs.witnessScript.decode(ho);break;case typeFields_1$1.OutputTypes.BIP32_DERIVATION:fo.bip32Derivation===void 0&&(fo.bip32Derivation=[]),fo.bip32Derivation.push(convert$3.outputs.bip32Derivation.decode(ho));break;case typeFields_1$1.OutputTypes.TAP_INTERNAL_KEY:checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.TAP_INTERNAL_KEY),fo.tapInternalKey=convert$3.outputs.tapInternalKey.decode(ho);break;case typeFields_1$1.OutputTypes.TAP_TREE:checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.TAP_TREE),fo.tapTree=convert$3.outputs.tapTree.decode(ho);break;case typeFields_1$1.OutputTypes.TAP_BIP32_DERIVATION:fo.tapBip32Derivation===void 0&&(fo.tapBip32Derivation=[]),fo.tapBip32Derivation.push(convert$3.outputs.tapBip32Derivation.decode(ho));break;default:fo.unknownKeyVals||(fo.unknownKeyVals=[]),fo.unknownKeyVals.push(ho)}co.push(fo)}return{globalMap:no,inputs:so,outputs:co}}fromBuffer.psbtFromKeyVals=psbtFromKeyVals;var toBuffer$5={};Object.defineProperty(toBuffer$5,"__esModule",{value:!0});const convert$2=converter,tools_1=tools;function psbtToBuffer({globalMap:Xr,inputs:eo,outputs:to}){const{globalKeyVals:ro,inputKeyVals:no,outputKeyVals:io}=psbtToKeyVals({globalMap:Xr,inputs:eo,outputs:to}),oo=tools_1.keyValsToBuffer(ro),ao=fo=>fo.length===0?[Buffer$3.from([0])]:fo.map(tools_1.keyValsToBuffer),so=ao(no),co=ao(io),lo=Buffer$3.allocUnsafe(5);return lo.writeUIntBE(482972169471,0,5),Buffer$3.concat([lo,oo].concat(so,co))}toBuffer$5.psbtToBuffer=psbtToBuffer;const sortKeyVals=(Xr,eo)=>Xr.key.compare(eo.key);function keyValsFromMap(Xr,eo){const to=new Set,ro=Object.entries(Xr).reduce((io,[oo,ao])=>{if(oo==="unknownKeyVals")return io;const so=eo[oo];if(so===void 0)return io;const co=(Array.isArray(ao)?ao:[ao]).map(so.encode);return co.map(fo=>fo.key.toString("hex")).forEach(fo=>{if(to.has(fo))throw new Error("Serialize Error: Duplicate key: "+fo);to.add(fo)}),io.concat(co)},[]),no=Xr.unknownKeyVals?Xr.unknownKeyVals.filter(io=>!to.has(io.key.toString("hex"))):[];return ro.concat(no).sort(sortKeyVals)}function psbtToKeyVals({globalMap:Xr,inputs:eo,outputs:to}){return{globalKeyVals:keyValsFromMap(Xr,convert$2.globals),inputKeyVals:eo.map(ro=>keyValsFromMap(ro,convert$2.inputs)),outputKeyVals:to.map(ro=>keyValsFromMap(ro,convert$2.outputs))}}toBuffer$5.psbtToKeyVals=psbtToKeyVals;(function(Xr){function eo(to){for(var ro in to)Xr.hasOwnProperty(ro)||(Xr[ro]=to[ro])}Object.defineProperty(Xr,"__esModule",{value:!0}),eo(fromBuffer),eo(toBuffer$5)})(parser);Object.defineProperty(combiner,"__esModule",{value:!0});const parser_1$1=parser;function combine(Xr){const eo=Xr[0],to=parser_1$1.psbtToKeyVals(eo),ro=Xr.slice(1);if(ro.length===0)throw new Error("Combine: Nothing to combine");const no=getTx(eo);if(no===void 0)throw new Error("Combine: Self missing transaction");const io=getKeySet(to.globalKeyVals),oo=to.inputKeyVals.map(getKeySet),ao=to.outputKeyVals.map(getKeySet);for(const so of ro){const co=getTx(so);if(co===void 0||!co.toBuffer().equals(no.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const lo=parser_1$1.psbtToKeyVals(so);getKeySet(lo.globalKeyVals).forEach(keyPusher(io,to.globalKeyVals,lo.globalKeyVals)),lo.inputKeyVals.map(getKeySet).forEach((yo,vo)=>yo.forEach(keyPusher(oo[vo],to.inputKeyVals[vo],lo.inputKeyVals[vo]))),lo.outputKeyVals.map(getKeySet).forEach((yo,vo)=>yo.forEach(keyPusher(ao[vo],to.outputKeyVals[vo],lo.outputKeyVals[vo])))}return parser_1$1.psbtFromKeyVals(no,{globalMapKeyVals:to.globalKeyVals,inputKeyVals:to.inputKeyVals,outputKeyVals:to.outputKeyVals})}combiner.combine=combine;function keyPusher(Xr,eo,to){return ro=>{if(Xr.has(ro))return;const no=to.filter(io=>io.key.toString("hex")===ro)[0];eo.push(no),Xr.add(ro)}}function getTx(Xr){return Xr.globalMap.unsignedTx}function getKeySet(Xr){const eo=new Set;return Xr.forEach(to=>{const ro=to.key.toString("hex");if(eo.has(ro))throw new Error("Combine: KeyValue Map keys should be unique");eo.add(ro)}),eo}var utils$4={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=converter;function to(go,yo){const vo=go[yo];if(vo===void 0)throw new Error(`No input #${yo}`);return vo}Xr.checkForInput=to;function ro(go,yo){const vo=go[yo];if(vo===void 0)throw new Error(`No output #${yo}`);return vo}Xr.checkForOutput=ro;function no(go,yo,vo){if(go.key[0]wo.key.equals(go.key)).length!==0)throw new Error(`Duplicate Key: ${go.key.toString("hex")}`)}Xr.checkHasKey=no;function io(go){let yo=0;return Object.keys(go).forEach(vo=>{Number(isNaN(Number(vo)))&&yo++}),yo}Xr.getEnumLength=io;function oo(go,yo){let vo=!1;if(yo.nonWitnessUtxo||yo.witnessUtxo){const wo=!!yo.redeemScript,Eo=!!yo.witnessScript,ko=!wo||!!yo.finalScriptSig,Ao=!Eo||!!yo.finalScriptWitness,Po=!!yo.finalScriptSig||!!yo.finalScriptWitness;vo=ko&&Ao&&Po}if(vo===!1)throw new Error(`Input #${go} has too much or too little data to clean`)}Xr.inputCheckUncleanFinalized=oo;function ao(go,yo,vo,wo){throw new Error(`Data for ${go} key ${yo} is incorrect: Expected ${vo} and got ${JSON.stringify(wo)}`)}function so(go){return(yo,vo)=>{for(const wo of Object.keys(yo)){const Eo=yo[wo],{canAdd:ko,canAddToArray:Ao,check:Po,expected:jo}=eo[go+"s"][wo]||{},Mo=!!Ao;if(Po)if(Mo){if(!Array.isArray(Eo)||vo[wo]&&!Array.isArray(vo[wo]))throw new Error(`Key type ${wo} must be an array`);Eo.every(Po)||ao(go,wo,jo,Eo);const No=vo[wo]||[],Do=new Set;if(!Eo.every(Fo=>Ao(No,Fo,Do)))throw new Error("Can not add duplicate data to array");vo[wo]=No.concat(Eo)}else{if(Po(Eo)||ao(go,wo,jo,Eo),!ko(vo,Eo))throw new Error(`Can not add duplicate data to ${go}`);vo[wo]=Eo}}}}Xr.updateGlobal=so("global"),Xr.updateInput=so("input"),Xr.updateOutput=so("output");function co(go,yo){const vo=go.length-1,wo=to(go,vo);Xr.updateInput(yo,wo)}Xr.addInputAttributes=co;function lo(go,yo){const vo=go.length-1,wo=ro(go,vo);Xr.updateOutput(yo,wo)}Xr.addOutputAttributes=lo;function fo(go,yo){if(!Buffer$3.isBuffer(yo)||yo.length<4)throw new Error("Set Version: Invalid Transaction");return yo.writeUInt32LE(go,0),yo}Xr.defaultVersionSetter=fo;function ho(go,yo){if(!Buffer$3.isBuffer(yo)||yo.length<4)throw new Error("Set Locktime: Invalid Transaction");return yo.writeUInt32LE(go,yo.length-4),yo}Xr.defaultLocktimeSetter=ho})(utils$4);Object.defineProperty(psbt,"__esModule",{value:!0});const combiner_1=combiner,parser_1=parser,typeFields_1=typeFields,utils_1$3=utils$4;let Psbt$1=class{constructor(eo){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:eo}}static fromBase64(eo,to){const ro=Buffer$3.from(eo,"base64");return this.fromBuffer(ro,to)}static fromHex(eo,to){const ro=Buffer$3.from(eo,"hex");return this.fromBuffer(ro,to)}static fromBuffer(eo,to){const ro=parser_1.psbtFromBuffer(eo,to),no=new this(ro.globalMap.unsignedTx);return Object.assign(no,ro),no}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return parser_1.psbtToBuffer(this)}updateGlobal(eo){return utils_1$3.updateGlobal(eo,this.globalMap),this}updateInput(eo,to){const ro=utils_1$3.checkForInput(this.inputs,eo);return utils_1$3.updateInput(to,ro),this}updateOutput(eo,to){const ro=utils_1$3.checkForOutput(this.outputs,eo);return utils_1$3.updateOutput(to,ro),this}addUnknownKeyValToGlobal(eo){return utils_1$3.checkHasKey(eo,this.globalMap.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(eo),this}addUnknownKeyValToInput(eo,to){const ro=utils_1$3.checkForInput(this.inputs,eo);return utils_1$3.checkHasKey(to,ro.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.InputTypes)),ro.unknownKeyVals||(ro.unknownKeyVals=[]),ro.unknownKeyVals.push(to),this}addUnknownKeyValToOutput(eo,to){const ro=utils_1$3.checkForOutput(this.outputs,eo);return utils_1$3.checkHasKey(to,ro.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.OutputTypes)),ro.unknownKeyVals||(ro.unknownKeyVals=[]),ro.unknownKeyVals.push(to),this}addInput(eo){this.globalMap.unsignedTx.addInput(eo),this.inputs.push({unknownKeyVals:[]});const to=eo.unknownKeyVals||[],ro=this.inputs.length-1;if(!Array.isArray(to))throw new Error("unknownKeyVals must be an Array");return to.forEach(no=>this.addUnknownKeyValToInput(ro,no)),utils_1$3.addInputAttributes(this.inputs,eo),this}addOutput(eo){this.globalMap.unsignedTx.addOutput(eo),this.outputs.push({unknownKeyVals:[]});const to=eo.unknownKeyVals||[],ro=this.outputs.length-1;if(!Array.isArray(to))throw new Error("unknownKeyVals must be an Array");return to.forEach(no=>this.addUnknownKeyValToOutput(ro,no)),utils_1$3.addOutputAttributes(this.outputs,eo),this}clearFinalizedInput(eo){const to=utils_1$3.checkForInput(this.inputs,eo);utils_1$3.inputCheckUncleanFinalized(eo,to);for(const ro of Object.keys(to))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(ro)||delete to[ro];return this}combine(...eo){const to=combiner_1.combine([this].concat(eo));return Object.assign(this,to),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}};psbt.Psbt=Psbt$1;var bip371={},psbtutils={};Object.defineProperty(psbtutils,"__esModule",{value:!0});psbtutils.signatureBlocksAction=psbtutils.checkInputForSig=psbtutils.pubkeyInScript=psbtutils.pubkeyPositionInScript=psbtutils.witnessStackToScriptWitness=psbtutils.isP2TR=psbtutils.isP2SHScript=psbtutils.isP2WSHScript=psbtutils.isP2WPKH=psbtutils.isP2PKH=psbtutils.isP2PK=psbtutils.isP2MS=void 0;const varuint$1=varint,bscript$1=script$1,transaction_1$2=transaction,crypto_1=crypto$3,payments$1=payments$3;function isPaymentFactory(Xr){return eo=>{try{return Xr({output:eo}),!0}catch{return!1}}}psbtutils.isP2MS=isPaymentFactory(payments$1.p2ms);psbtutils.isP2PK=isPaymentFactory(payments$1.p2pk);psbtutils.isP2PKH=isPaymentFactory(payments$1.p2pkh);psbtutils.isP2WPKH=isPaymentFactory(payments$1.p2wpkh);psbtutils.isP2WSHScript=isPaymentFactory(payments$1.p2wsh);psbtutils.isP2SHScript=isPaymentFactory(payments$1.p2sh);psbtutils.isP2TR=isPaymentFactory(payments$1.p2tr);function witnessStackToScriptWitness(Xr){let eo=Buffer$3.allocUnsafe(0);function to(oo){eo=Buffer$3.concat([eo,Buffer$3.from(oo)])}function ro(oo){const ao=eo.length,so=varuint$1.encodingLength(oo);eo=Buffer$3.concat([eo,Buffer$3.allocUnsafe(so)]),varuint$1.encode(oo,eo,ao)}function no(oo){ro(oo.length),to(oo)}function io(oo){ro(oo.length),oo.forEach(no)}return io(Xr),eo}psbtutils.witnessStackToScriptWitness=witnessStackToScriptWitness;function pubkeyPositionInScript(Xr,eo){const to=(0,crypto_1.hash160)(Xr),ro=Xr.slice(1,33),no=bscript$1.decompile(eo);if(no===null)throw new Error("Unknown script error");return no.findIndex(io=>typeof io=="number"?!1:io.equals(Xr)||io.equals(to)||io.equals(ro))}psbtutils.pubkeyPositionInScript=pubkeyPositionInScript;function pubkeyInScript(Xr,eo){return pubkeyPositionInScript(Xr,eo)!==-1}psbtutils.pubkeyInScript=pubkeyInScript;function checkInputForSig(Xr,eo){return extractPartialSigs(Xr).some(ro=>signatureBlocksAction(ro,bscript$1.signature.decode,eo))}psbtutils.checkInputForSig=checkInputForSig;function signatureBlocksAction(Xr,eo,to){const{hashType:ro}=eo(Xr),no=[];switch(ro&transaction_1$2.Transaction.SIGHASH_ANYONECANPAY&&no.push("addInput"),ro&31){case transaction_1$2.Transaction.SIGHASH_ALL:break;case transaction_1$2.Transaction.SIGHASH_SINGLE:case transaction_1$2.Transaction.SIGHASH_NONE:no.push("addOutput"),no.push("setInputSequence");break}return no.indexOf(to)===-1}psbtutils.signatureBlocksAction=signatureBlocksAction;function extractPartialSigs(Xr){let eo=[];if((Xr.partialSig||[]).length===0){if(!Xr.finalScriptSig&&!Xr.finalScriptWitness)return[];eo=getPsigsFromInputFinalScripts(Xr)}else eo=Xr.partialSig;return eo.map(to=>to.signature)}function getPsigsFromInputFinalScripts(Xr){const eo=Xr.finalScriptSig?bscript$1.decompile(Xr.finalScriptSig)||[]:[],to=Xr.finalScriptWitness?bscript$1.decompile(Xr.finalScriptWitness)||[]:[];return eo.concat(to).filter(ro=>Buffer$3.isBuffer(ro)&&bscript$1.isCanonicalScriptSignature(ro)).map(ro=>({signature:ro}))}Object.defineProperty(bip371,"__esModule",{value:!0});bip371.checkTaprootInputForSigs=bip371.tapTreeFromList=bip371.tapTreeToList=bip371.tweakInternalPubKey=bip371.checkTaprootOutputFields=bip371.checkTaprootInputFields=bip371.isTaprootOutput=bip371.isTaprootInput=bip371.serializeTaprootSignature=bip371.tapScriptFinalizer=bip371.toXOnly=void 0;const types_1=types$7,transaction_1$1=transaction,psbtutils_1$1=psbtutils,bip341_1$1=bip341,payments_1=payments$3,psbtutils_2=psbtutils,toXOnly=Xr=>Xr.length===32?Xr:Xr.slice(1,33);bip371.toXOnly=toXOnly;function tapScriptFinalizer(Xr,eo,to){const ro=findTapLeafToFinalize(eo,Xr,to);try{const io=sortSignatures(eo,ro).concat(ro.script).concat(ro.controlBlock);return{finalScriptWitness:(0,psbtutils_1$1.witnessStackToScriptWitness)(io)}}catch(no){throw new Error(`Can not finalize taproot input #${Xr}: ${no}`)}}bip371.tapScriptFinalizer=tapScriptFinalizer;function serializeTaprootSignature(Xr,eo){const to=eo?Buffer$3.from([eo]):Buffer$3.from([]);return Buffer$3.concat([Xr,to])}bip371.serializeTaprootSignature=serializeTaprootSignature;function isTaprootInput(Xr){return Xr&&!!(Xr.tapInternalKey||Xr.tapMerkleRoot||Xr.tapLeafScript&&Xr.tapLeafScript.length||Xr.tapBip32Derivation&&Xr.tapBip32Derivation.length||Xr.witnessUtxo&&(0,psbtutils_1$1.isP2TR)(Xr.witnessUtxo.script))}bip371.isTaprootInput=isTaprootInput;function isTaprootOutput(Xr,eo){return Xr&&!!(Xr.tapInternalKey||Xr.tapTree||Xr.tapBip32Derivation&&Xr.tapBip32Derivation.length||eo&&(0,psbtutils_1$1.isP2TR)(eo))}bip371.isTaprootOutput=isTaprootOutput;function checkTaprootInputFields(Xr,eo,to){checkMixedTaprootAndNonTaprootInputFields(Xr,eo,to),checkIfTapLeafInTree(Xr,eo,to)}bip371.checkTaprootInputFields=checkTaprootInputFields;function checkTaprootOutputFields(Xr,eo,to){checkMixedTaprootAndNonTaprootOutputFields(Xr,eo,to),checkTaprootScriptPubkey(Xr,eo)}bip371.checkTaprootOutputFields=checkTaprootOutputFields;function checkTaprootScriptPubkey(Xr,eo){if(!eo.tapTree&&!eo.tapInternalKey)return;const to=eo.tapInternalKey||Xr.tapInternalKey,ro=eo.tapTree||Xr.tapTree;if(to){const{script:no}=Xr,io=getTaprootScripPubkey(to,ro);if(no&&!no.equals(io))throw new Error("Error adding output. Script or address missmatch.")}}function getTaprootScripPubkey(Xr,eo){const to=eo&&tapTreeFromList(eo.leaves),{output:ro}=(0,payments_1.p2tr)({internalPubkey:Xr,scriptTree:to});return ro}function tweakInternalPubKey(Xr,eo){const to=eo.tapInternalKey,ro=to&&(0,bip341_1$1.tweakKey)(to,eo.tapMerkleRoot);if(!ro)throw new Error(`Cannot tweak tap internal key for input #${Xr}. Public key: ${to&&to.toString("hex")}`);return ro.x}bip371.tweakInternalPubKey=tweakInternalPubKey;function tapTreeToList(Xr){if(!(0,types_1.isTaptree)(Xr))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return _tapTreeToList(Xr)}bip371.tapTreeToList=tapTreeToList;function tapTreeFromList(Xr=[]){return Xr.length===1&&Xr[0].depth===0?{output:Xr[0].script,version:Xr[0].leafVersion}:instertLeavesInTree(Xr)}bip371.tapTreeFromList=tapTreeFromList;function checkTaprootInputForSigs(Xr,eo){return extractTaprootSigs(Xr).some(ro=>(0,psbtutils_2.signatureBlocksAction)(ro,decodeSchnorrSignature,eo))}bip371.checkTaprootInputForSigs=checkTaprootInputForSigs;function decodeSchnorrSignature(Xr){return{signature:Xr.slice(0,64),hashType:Xr.slice(64)[0]||transaction_1$1.Transaction.SIGHASH_DEFAULT}}function extractTaprootSigs(Xr){const eo=[];if(Xr.tapKeySig&&eo.push(Xr.tapKeySig),Xr.tapScriptSig&&eo.push(...Xr.tapScriptSig.map(to=>to.signature)),!eo.length){const to=getTapKeySigFromWithness(Xr.finalScriptWitness);to&&eo.push(to)}return eo}function getTapKeySigFromWithness(Xr){if(!Xr)return;const eo=Xr.slice(2);if(eo.length===64||eo.length===65)return eo}function _tapTreeToList(Xr,eo=[],to=0){if(to>bip341_1$1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return Xr?(0,types_1.isTapleaf)(Xr)?(eo.push({depth:to,leafVersion:Xr.version||bip341_1$1.LEAF_VERSION_TAPSCRIPT,script:Xr.output}),eo):(Xr[0]&&_tapTreeToList(Xr[0],eo,to+1),Xr[1]&&_tapTreeToList(Xr[1],eo,to+1),eo):[]}function instertLeavesInTree(Xr){let eo;for(const to of Xr)if(eo=instertLeafInTree(to,eo),!eo)throw new Error("No room left to insert tapleaf in tree");return eo}function instertLeafInTree(Xr,eo,to=0){if(to>bip341_1$1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(Xr.depth===to)return eo?void 0:{output:Xr.script,version:Xr.leafVersion};if((0,types_1.isTapleaf)(eo))return;const ro=instertLeafInTree(Xr,eo&&eo[0],to+1);if(ro)return[ro,eo&&eo[1]];const no=instertLeafInTree(Xr,eo&&eo[1],to+1);if(no)return[eo&&eo[0],no]}function checkMixedTaprootAndNonTaprootInputFields(Xr,eo,to){const ro=isTaprootInput(Xr)&&hasNonTaprootFields(eo),no=hasNonTaprootFields(Xr)&&isTaprootInput(eo),io=Xr===eo&&isTaprootInput(eo)&&hasNonTaprootFields(eo);if(ro||no||io)throw new Error(`Invalid arguments for Psbt.${to}. Cannot use both taproot and non-taproot fields.`)}function checkMixedTaprootAndNonTaprootOutputFields(Xr,eo,to){const ro=isTaprootOutput(Xr)&&hasNonTaprootFields(eo),no=hasNonTaprootFields(Xr)&&isTaprootOutput(eo),io=Xr===eo&&isTaprootOutput(eo)&&hasNonTaprootFields(eo);if(ro||no||io)throw new Error(`Invalid arguments for Psbt.${to}. Cannot use both taproot and non-taproot fields.`)}function checkIfTapLeafInTree(Xr,eo,to){if(eo.tapMerkleRoot){const ro=(eo.tapLeafScript||[]).every(io=>isTapLeafInTree(io,eo.tapMerkleRoot)),no=(Xr.tapLeafScript||[]).every(io=>isTapLeafInTree(io,eo.tapMerkleRoot));if(!ro||!no)throw new Error(`Invalid arguments for Psbt.${to}. Tapleaf not part of taptree.`)}else if(Xr.tapMerkleRoot&&!(eo.tapLeafScript||[]).every(no=>isTapLeafInTree(no,Xr.tapMerkleRoot)))throw new Error(`Invalid arguments for Psbt.${to}. Tapleaf not part of taptree.`)}function isTapLeafInTree(Xr,eo){if(!eo)return!0;const to=(0,bip341_1$1.tapleafHash)({output:Xr.script,version:Xr.leafVersion});return(0,bip341_1$1.rootHashFromPath)(Xr.controlBlock,to).equals(eo)}function sortSignatures(Xr,eo){const to=(0,bip341_1$1.tapleafHash)({output:eo.script,version:eo.leafVersion});return(Xr.tapScriptSig||[]).filter(ro=>ro.leafHash.equals(to)).map(ro=>addPubkeyPositionInScript(eo.script,ro)).sort((ro,no)=>no.positionInScript-ro.positionInScript).map(ro=>ro.signature)}function addPubkeyPositionInScript(Xr,eo){return Object.assign({positionInScript:(0,psbtutils_1$1.pubkeyPositionInScript)(eo.pubkey,Xr)},eo)}function findTapLeafToFinalize(Xr,eo,to){if(!Xr.tapScriptSig||!Xr.tapScriptSig.length)throw new Error(`Can not finalize taproot input #${eo}. No tapleaf script signature provided.`);const ro=(Xr.tapLeafScript||[]).sort((no,io)=>no.controlBlock.length-io.controlBlock.length).find(no=>canFinalizeLeaf(no,Xr.tapScriptSig,to));if(!ro)throw new Error(`Can not finalize taproot input #${eo}. Signature for tapleaf script not found.`);return ro}function canFinalizeLeaf(Xr,eo,to){const ro=(0,bip341_1$1.tapleafHash)({output:Xr.script,version:Xr.leafVersion});return(!to||to.equals(ro))&&eo.find(io=>io.leafHash.equals(ro))!==void 0}function hasNonTaprootFields(Xr){return Xr&&!!(Xr.redeemScript||Xr.witnessScript||Xr.bip32Derivation&&Xr.bip32Derivation.length)}Object.defineProperty(psbt$1,"__esModule",{value:!0});psbt$1.Psbt=void 0;const bip174_1=psbt,varuint=varint,utils_1$2=utils$4,address_1=address,bufferutils_1=bufferutils,networks_1=networks$1,payments=payments$3,bip341_1=bip341,bscript=script$1,transaction_1=transaction,bip371_1=bip371,psbtutils_1=psbtutils,DEFAULT_OPTS={network:networks_1.bitcoin,maximumFeeRate:5e3};class Psbt{static fromBase64(eo,to={}){const ro=Buffer$3.from(eo,"base64");return this.fromBuffer(ro,to)}static fromHex(eo,to={}){const ro=Buffer$3.from(eo,"hex");return this.fromBuffer(ro,to)}static fromBuffer(eo,to={}){const ro=bip174_1.Psbt.fromBuffer(eo,transactionFromBuffer),no=new Psbt(to,ro);return checkTxForDupeIns(no.__CACHE.__TX,no.__CACHE),no}constructor(eo={},to=new bip174_1.Psbt(new PsbtTransaction)){this.data=to,this.opts=Object.assign({},DEFAULT_OPTS,eo),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},this.data.inputs.length===0&&this.setVersion(2);const ro=(no,io,oo,ao)=>Object.defineProperty(no,io,{enumerable:oo,writable:ao});ro(this,"__CACHE",!1,!0),ro(this,"opts",!1,!0)}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(eo){this.setVersion(eo)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(eo){this.setLocktime(eo)}get txInputs(){return this.__CACHE.__TX.ins.map(eo=>({hash:(0,bufferutils_1.cloneBuffer)(eo.hash),index:eo.index,sequence:eo.sequence}))}get txOutputs(){return this.__CACHE.__TX.outs.map(eo=>{let to;try{to=(0,address_1.fromOutputScript)(eo.script,this.opts.network)}catch{}return{script:(0,bufferutils_1.cloneBuffer)(eo.script),value:eo.value,address:to}})}combine(...eo){return this.data.combine(...eo.map(to=>to.data)),this}clone(){const eo=Psbt.fromBuffer(this.data.toBuffer());return eo.opts=JSON.parse(JSON.stringify(this.opts)),eo}setMaximumFeeRate(eo){check32Bit(eo),this.opts.maximumFeeRate=eo}setVersion(eo){check32Bit(eo),checkInputsForPartialSig(this.data.inputs,"setVersion");const to=this.__CACHE;return to.__TX.version=eo,to.__EXTRACTED_TX=void 0,this}setLocktime(eo){check32Bit(eo),checkInputsForPartialSig(this.data.inputs,"setLocktime");const to=this.__CACHE;return to.__TX.locktime=eo,to.__EXTRACTED_TX=void 0,this}setInputSequence(eo,to){check32Bit(to),checkInputsForPartialSig(this.data.inputs,"setInputSequence");const ro=this.__CACHE;if(ro.__TX.ins.length<=eo)throw new Error("Input index too high");return ro.__TX.ins[eo].sequence=to,ro.__EXTRACTED_TX=void 0,this}addInputs(eo){return eo.forEach(to=>this.addInput(to)),this}addInput(eo){if(arguments.length>1||!eo||eo.hash===void 0||eo.index===void 0)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");(0,bip371_1.checkTaprootInputFields)(eo,eo,"addInput"),checkInputsForPartialSig(this.data.inputs,"addInput"),eo.witnessScript&&checkInvalidP2WSH(eo.witnessScript);const to=this.__CACHE;this.data.addInput(eo);const ro=to.__TX.ins[to.__TX.ins.length-1];checkTxInputCache(to,ro);const no=this.data.inputs.length-1,io=this.data.inputs[no];return io.nonWitnessUtxo&&addNonWitnessTxCache(this.__CACHE,io,no),to.__FEE=void 0,to.__FEE_RATE=void 0,to.__EXTRACTED_TX=void 0,this}addOutputs(eo){return eo.forEach(to=>this.addOutput(to)),this}addOutput(eo){if(arguments.length>1||!eo||eo.value===void 0||eo.address===void 0&&eo.script===void 0)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");checkInputsForPartialSig(this.data.inputs,"addOutput");const{address:to}=eo;if(typeof to=="string"){const{network:no}=this.opts,io=(0,address_1.toOutputScript)(to,no);eo=Object.assign(eo,{script:io})}(0,bip371_1.checkTaprootOutputFields)(eo,eo,"addOutput");const ro=this.__CACHE;return this.data.addOutput(eo),ro.__FEE=void 0,ro.__FEE_RATE=void 0,ro.__EXTRACTED_TX=void 0,this}extractTransaction(eo){if(!this.data.inputs.every(isFinalized))throw new Error("Not finalized");const to=this.__CACHE;if(eo||checkFees(this,to,this.opts),to.__EXTRACTED_TX)return to.__EXTRACTED_TX;const ro=to.__TX.clone();return inputFinalizeGetAmts(this.data.inputs,ro,to,!0),ro}getFeeRate(){return getTxCacheValue("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return getTxCacheValue("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,utils_1$2.checkForInput)(this.data.inputs,0),range$1(this.data.inputs.length).forEach(eo=>this.finalizeInput(eo)),this}finalizeInput(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(ro)?this._finalizeTaprootInput(eo,ro,void 0,to):this._finalizeInput(eo,ro,to)}finalizeTaprootInput(eo,to,ro=bip371_1.tapScriptFinalizer){const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(no))return this._finalizeTaprootInput(eo,no,to,ro);throw new Error(`Cannot finalize input #${eo}. Not Taproot.`)}_finalizeInput(eo,to,ro=getFinalScripts){const{script:no,isP2SH:io,isP2WSH:oo,isSegwit:ao}=getScriptFromInput(eo,to,this.__CACHE);if(!no)throw new Error(`No script found for input #${eo}`);checkPartialSigSighashes(to);const{finalScriptSig:so,finalScriptWitness:co}=ro(eo,to,no,ao,io,oo);if(so&&this.data.updateInput(eo,{finalScriptSig:so}),co&&this.data.updateInput(eo,{finalScriptWitness:co}),!so&&!co)throw new Error(`Unknown error finalizing input #${eo}`);return this.data.clearFinalizedInput(eo),this}_finalizeTaprootInput(eo,to,ro,no=bip371_1.tapScriptFinalizer){if(!to.witnessUtxo)throw new Error(`Cannot finalize input #${eo}. Missing withness utxo.`);if(to.tapKeySig){const io=payments.p2tr({output:to.witnessUtxo.script,signature:to.tapKeySig}),oo=(0,psbtutils_1.witnessStackToScriptWitness)(io.witness);this.data.updateInput(eo,{finalScriptWitness:oo})}else{const{finalScriptWitness:io}=no(eo,to,ro);this.data.updateInput(eo,{finalScriptWitness:io})}return this.data.clearFinalizedInput(eo),this}getInputType(eo){const to=(0,utils_1$2.checkForInput)(this.data.inputs,eo),ro=getScriptFromUtxo(eo,to,this.__CACHE),no=getMeaningfulScript(ro,eo,"input",to.redeemScript||redeemFromFinalScriptSig(to.finalScriptSig),to.witnessScript||redeemFromFinalWitnessScript(to.finalScriptWitness)),io=no.type==="raw"?"":no.type+"-",oo=classifyScript(no.meaningfulScript);return io+oo}inputHasPubkey(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return pubkeyInInput(to,ro,eo,this.__CACHE)}inputHasHDKey(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo),no=bip32DerivationIsMine(to);return!!ro.bip32Derivation&&ro.bip32Derivation.some(no)}outputHasPubkey(eo,to){const ro=(0,utils_1$2.checkForOutput)(this.data.outputs,eo);return pubkeyInOutput(to,ro,eo,this.__CACHE)}outputHasHDKey(eo,to){const ro=(0,utils_1$2.checkForOutput)(this.data.outputs,eo),no=bip32DerivationIsMine(to);return!!ro.bip32Derivation&&ro.bip32Derivation.some(no)}validateSignaturesOfAllInputs(eo){return(0,utils_1$2.checkForInput)(this.data.inputs,0),range$1(this.data.inputs.length).map(ro=>this.validateSignaturesOfInput(ro,eo)).reduce((ro,no)=>no===!0&&ro,!0)}validateSignaturesOfInput(eo,to,ro){const no=this.data.inputs[eo];return(0,bip371_1.isTaprootInput)(no)?this.validateSignaturesOfTaprootInput(eo,to,ro):this._validateSignaturesOfInput(eo,to,ro)}_validateSignaturesOfInput(eo,to,ro){const no=this.data.inputs[eo],io=(no||{}).partialSig;if(!no||!io||io.length<1)throw new Error("No signatures to validate");if(typeof to!="function")throw new Error("Need validator function to validate signatures");const oo=ro?io.filter(fo=>fo.pubkey.equals(ro)):io;if(oo.length<1)throw new Error("No signatures for this pubkey");const ao=[];let so,co,lo;for(const fo of oo){const ho=bscript.signature.decode(fo.signature),{hash:go,script:yo}=lo!==ho.hashType?getHashForSig(eo,Object.assign({},no,{sighashType:ho.hashType}),this.__CACHE,!0):{hash:so,script:co};lo=ho.hashType,so=go,co=yo,checkScriptForPubkey(fo.pubkey,yo,"verify"),ao.push(to(fo.pubkey,go,ho.signature))}return ao.every(fo=>fo===!0)}validateSignaturesOfTaprootInput(eo,to,ro){const no=this.data.inputs[eo],io=(no||{}).tapKeySig,oo=(no||{}).tapScriptSig;if(!no&&!io&&!(oo&&!oo.length))throw new Error("No signatures to validate");if(typeof to!="function")throw new Error("Need validator function to validate signatures");ro=ro&&(0,bip371_1.toXOnly)(ro);const ao=ro?getTaprootHashesForSig(eo,no,this.data.inputs,ro,this.__CACHE):getAllTaprootHashesForSig(eo,no,this.data.inputs,this.__CACHE);if(!ao.length)throw new Error("No signatures for this pubkey");const so=ao.find(lo=>!lo.leafHash);let co=0;if(io&&so){if(!to(so.pubkey,so.hash,trimTaprootSig(io)))return!1;co++}if(oo)for(const lo of oo){const fo=ao.find(ho=>lo.pubkey.equals(ho.pubkey));if(fo){if(!to(lo.pubkey,fo.hash,trimTaprootSig(lo.signature)))return!1;co++}}return co>0}signAllInputsHD(eo,to=[transaction_1.Transaction.SIGHASH_ALL]){if(!eo||!eo.publicKey||!eo.fingerprint)throw new Error("Need HDSigner to sign input");const ro=[];for(const no of range$1(this.data.inputs.length))try{this.signInputHD(no,eo,to),ro.push(!0)}catch{ro.push(!1)}if(ro.every(no=>no===!1))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(eo,to=[transaction_1.Transaction.SIGHASH_ALL]){return new Promise((ro,no)=>{if(!eo||!eo.publicKey||!eo.fingerprint)return no(new Error("Need HDSigner to sign input"));const io=[],oo=[];for(const ao of range$1(this.data.inputs.length))oo.push(this.signInputHDAsync(ao,eo,to).then(()=>{io.push(!0)},()=>{io.push(!1)}));return Promise.all(oo).then(()=>{if(io.every(ao=>ao===!1))return no(new Error("No inputs were signed"));ro()})})}signInputHD(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){if(!to||!to.publicKey||!to.fingerprint)throw new Error("Need HDSigner to sign input");return getSignersFromHD(eo,this.data.inputs,to).forEach(io=>this.signInput(eo,io,ro)),this}signInputHDAsync(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){return new Promise((no,io)=>{if(!to||!to.publicKey||!to.fingerprint)return io(new Error("Need HDSigner to sign input"));const ao=getSignersFromHD(eo,this.data.inputs,to).map(so=>this.signInputAsync(eo,so,ro));return Promise.all(ao).then(()=>{no()}).catch(io)})}signAllInputs(eo,to){if(!eo||!eo.publicKey)throw new Error("Need Signer to sign input");const ro=[];for(const no of range$1(this.data.inputs.length))try{this.signInput(no,eo,to),ro.push(!0)}catch{ro.push(!1)}if(ro.every(no=>no===!1))throw new Error("No inputs were signed");return this}signAllInputsAsync(eo,to){return new Promise((ro,no)=>{if(!eo||!eo.publicKey)return no(new Error("Need Signer to sign input"));const io=[],oo=[];for(const[ao]of this.data.inputs.entries())oo.push(this.signInputAsync(ao,eo,to).then(()=>{io.push(!0)},()=>{io.push(!1)}));return Promise.all(oo).then(()=>{if(io.every(ao=>ao===!1))return no(new Error("No inputs were signed"));ro()})})}signInput(eo,to,ro){if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(no)?this._signTaprootInput(eo,no,to,void 0,ro):this._signInput(eo,to,ro)}signTaprootInput(eo,to,ro,no){if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const io=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(io))return this._signTaprootInput(eo,io,to,ro,no);throw new Error(`Input #${eo} is not of type Taproot.`)}_signInput(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){const{hash:no,sighashType:io}=getHashAndSighashType(this.data.inputs,eo,to.publicKey,this.__CACHE,ro),oo=[{pubkey:to.publicKey,signature:bscript.signature.encode(to.sign(no),io)}];return this.data.updateInput(eo,{partialSig:oo}),this}_signTaprootInput(eo,to,ro,no,io=[transaction_1.Transaction.SIGHASH_DEFAULT]){const oo=this.checkTaprootHashesForSig(eo,to,ro,no,io),ao=oo.filter(co=>!co.leafHash).map(co=>(0,bip371_1.serializeTaprootSignature)(ro.signSchnorr(co.hash),to.sighashType))[0],so=oo.filter(co=>!!co.leafHash).map(co=>({pubkey:(0,bip371_1.toXOnly)(ro.publicKey),signature:(0,bip371_1.serializeTaprootSignature)(ro.signSchnorr(co.hash),to.sighashType),leafHash:co.leafHash}));return ao&&this.data.updateInput(eo,{tapKeySig:ao}),so.length&&this.data.updateInput(eo,{tapScriptSig:so}),this}signInputAsync(eo,to,ro){return Promise.resolve().then(()=>{if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(no)?this._signTaprootInputAsync(eo,no,to,void 0,ro):this._signInputAsync(eo,to,ro)})}signTaprootInputAsync(eo,to,ro,no){return Promise.resolve().then(()=>{if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const io=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(io))return this._signTaprootInputAsync(eo,io,to,ro,no);throw new Error(`Input #${eo} is not of type Taproot.`)})}_signInputAsync(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){const{hash:no,sighashType:io}=getHashAndSighashType(this.data.inputs,eo,to.publicKey,this.__CACHE,ro);return Promise.resolve(to.sign(no)).then(oo=>{const ao=[{pubkey:to.publicKey,signature:bscript.signature.encode(oo,io)}];this.data.updateInput(eo,{partialSig:ao})})}async _signTaprootInputAsync(eo,to,ro,no,io=[transaction_1.Transaction.SIGHASH_DEFAULT]){const oo=this.checkTaprootHashesForSig(eo,to,ro,no,io),ao=[],so=oo.filter(lo=>!lo.leafHash)[0];if(so){const lo=Promise.resolve(ro.signSchnorr(so.hash)).then(fo=>({tapKeySig:(0,bip371_1.serializeTaprootSignature)(fo,to.sighashType)}));ao.push(lo)}const co=oo.filter(lo=>!!lo.leafHash);if(co.length){const lo=co.map(fo=>Promise.resolve(ro.signSchnorr(fo.hash)).then(ho=>({tapScriptSig:[{pubkey:(0,bip371_1.toXOnly)(ro.publicKey),signature:(0,bip371_1.serializeTaprootSignature)(ho,to.sighashType),leafHash:fo.leafHash}]})));ao.push(...lo)}return Promise.all(ao).then(lo=>{lo.forEach(fo=>this.data.updateInput(eo,fo))})}checkTaprootHashesForSig(eo,to,ro,no,io){if(typeof ro.signSchnorr!="function")throw new Error(`Need Schnorr Signer to sign taproot input #${eo}.`);const oo=getTaprootHashesForSig(eo,to,this.data.inputs,ro.publicKey,this.__CACHE,no,io);if(!oo||!oo.length)throw new Error(`Can not sign for input #${eo} with the key ${ro.publicKey.toString("hex")}`);return oo}toBuffer(){return checkCache(this.__CACHE),this.data.toBuffer()}toHex(){return checkCache(this.__CACHE),this.data.toHex()}toBase64(){return checkCache(this.__CACHE),this.data.toBase64()}updateGlobal(eo){return this.data.updateGlobal(eo),this}updateInput(eo,to){return to.witnessScript&&checkInvalidP2WSH(to.witnessScript),(0,bip371_1.checkTaprootInputFields)(this.data.inputs[eo],to,"updateInput"),this.data.updateInput(eo,to),to.nonWitnessUtxo&&addNonWitnessTxCache(this.__CACHE,this.data.inputs[eo],eo),this}updateOutput(eo,to){const ro=this.data.outputs[eo];return(0,bip371_1.checkTaprootOutputFields)(ro,to,"updateOutput"),this.data.updateOutput(eo,to),this}addUnknownKeyValToGlobal(eo){return this.data.addUnknownKeyValToGlobal(eo),this}addUnknownKeyValToInput(eo,to){return this.data.addUnknownKeyValToInput(eo,to),this}addUnknownKeyValToOutput(eo,to){return this.data.addUnknownKeyValToOutput(eo,to),this}clearFinalizedInput(eo){return this.data.clearFinalizedInput(eo),this}}psbt$1.Psbt=Psbt;const transactionFromBuffer=Xr=>new PsbtTransaction(Xr);class PsbtTransaction{constructor(eo=Buffer$3.from([2,0,0,0,0,0,0,0,0,0])){this.tx=transaction_1.Transaction.fromBuffer(eo),checkTxEmpty(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(eo){if(eo.hash===void 0||eo.index===void 0||!Buffer$3.isBuffer(eo.hash)&&typeof eo.hash!="string"||typeof eo.index!="number")throw new Error("Error adding input.");const to=typeof eo.hash=="string"?(0,bufferutils_1.reverseBuffer)(Buffer$3.from(eo.hash,"hex")):eo.hash;this.tx.addInput(to,eo.index,eo.sequence)}addOutput(eo){if(eo.script===void 0||eo.value===void 0||!Buffer$3.isBuffer(eo.script)||typeof eo.value!="number")throw new Error("Error adding output.");this.tx.addOutput(eo.script,eo.value)}toBuffer(){return this.tx.toBuffer()}}function canFinalize(Xr,eo,to){switch(to){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return hasSigs(1,Xr.partialSig);case"multisig":const ro=payments.p2ms({output:eo});return hasSigs(ro.m,Xr.partialSig,ro.pubkeys);default:return!1}}function checkCache(Xr){if(Xr.__UNSAFE_SIGN_NONSEGWIT!==!1)throw new Error("Not BIP174 compliant, can not export")}function hasSigs(Xr,eo,to){if(!eo)return!1;let ro;if(to?ro=to.map(no=>{const io=compressPubkey(no);return eo.find(oo=>oo.pubkey.equals(io))}).filter(no=>!!no):ro=eo,ro.length>Xr)throw new Error("Too many signatures");return ro.length===Xr}function isFinalized(Xr){return!!Xr.finalScriptSig||!!Xr.finalScriptWitness}function bip32DerivationIsMine(Xr){return eo=>!(!eo.masterFingerprint.equals(Xr.fingerprint)||!Xr.derivePath(eo.path).publicKey.equals(eo.pubkey))}function check32Bit(Xr){if(typeof Xr!="number"||Xr!==Math.floor(Xr)||Xr>4294967295||Xr<0)throw new Error("Invalid 32 bit integer")}function checkFees(Xr,eo,to){const ro=eo.__FEE_RATE||Xr.getFeeRate(),no=eo.__EXTRACTED_TX.virtualSize(),io=ro*no;if(ro>=to.maximumFeeRate)throw new Error(`Warning: You are paying around ${(io/1e8).toFixed(8)} in fees, which is ${ro} satoshi per byte for a transaction with a VSize of ${no} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}function checkInputsForPartialSig(Xr,eo){Xr.forEach(to=>{if((0,bip371_1.isTaprootInput)(to)?(0,bip371_1.checkTaprootInputForSigs)(to,eo):(0,psbtutils_1.checkInputForSig)(to,eo))throw new Error("Can not modify transaction, signatures exist.")})}function checkPartialSigSighashes(Xr){if(!Xr.sighashType||!Xr.partialSig)return;const{partialSig:eo,sighashType:to}=Xr;eo.forEach(ro=>{const{hashType:no}=bscript.signature.decode(ro.signature);if(to!==no)throw new Error("Signature sighash does not match input sighash type")})}function checkScriptForPubkey(Xr,eo,to){if(!(0,psbtutils_1.pubkeyInScript)(Xr,eo))throw new Error(`Can not ${to} for this input with the key ${Xr.toString("hex")}`)}function checkTxEmpty(Xr){if(!Xr.ins.every(to=>to.script&&to.script.length===0&&to.witness&&to.witness.length===0))throw new Error("Format Error: Transaction ScriptSigs are not empty")}function checkTxForDupeIns(Xr,eo){Xr.ins.forEach(to=>{checkTxInputCache(eo,to)})}function checkTxInputCache(Xr,eo){const to=(0,bufferutils_1.reverseBuffer)(Buffer$3.from(eo.hash)).toString("hex")+":"+eo.index;if(Xr.__TX_IN_CACHE[to])throw new Error("Duplicate input detected.");Xr.__TX_IN_CACHE[to]=1}function scriptCheckerFactory(Xr,eo){return(to,ro,no,io)=>{const oo=Xr({redeem:{output:no}}).output;if(!ro.equals(oo))throw new Error(`${eo} for ${io} #${to} doesn't match the scriptPubKey in the prevout`)}}const checkRedeemScript=scriptCheckerFactory(payments.p2sh,"Redeem script"),checkWitnessScript=scriptCheckerFactory(payments.p2wsh,"Witness script");function getTxCacheValue(Xr,eo,to,ro){if(!to.every(isFinalized))throw new Error(`PSBT must be finalized to calculate ${eo}`);if(Xr==="__FEE_RATE"&&ro.__FEE_RATE)return ro.__FEE_RATE;if(Xr==="__FEE"&&ro.__FEE)return ro.__FEE;let no,io=!0;if(ro.__EXTRACTED_TX?(no=ro.__EXTRACTED_TX,io=!1):no=ro.__TX.clone(),inputFinalizeGetAmts(to,no,ro,io),Xr==="__FEE_RATE")return ro.__FEE_RATE;if(Xr==="__FEE")return ro.__FEE}function getFinalScripts(Xr,eo,to,ro,no,io){const oo=classifyScript(to);if(!canFinalize(eo,to,oo))throw new Error(`Can not finalize input #${Xr}`);return prepareFinalScripts(to,oo,eo.partialSig,ro,no,io)}function prepareFinalScripts(Xr,eo,to,ro,no,io){let oo,ao;const so=getPayment(Xr,eo,to),co=io?payments.p2wsh({redeem:so}):null,lo=no?payments.p2sh({redeem:co||so}):null;return ro?(co?ao=(0,psbtutils_1.witnessStackToScriptWitness)(co.witness):ao=(0,psbtutils_1.witnessStackToScriptWitness)(so.witness),lo&&(oo=lo.input)):lo?oo=lo.input:oo=so.input,{finalScriptSig:oo,finalScriptWitness:ao}}function getHashAndSighashType(Xr,eo,to,ro,no){const io=(0,utils_1$2.checkForInput)(Xr,eo),{hash:oo,sighashType:ao,script:so}=getHashForSig(eo,io,ro,!1,no);return checkScriptForPubkey(to,so,"sign"),{hash:oo,sighashType:ao}}function getHashForSig(Xr,eo,to,ro,no){const io=to.__TX,oo=eo.sighashType||transaction_1.Transaction.SIGHASH_ALL;checkSighashTypeAllowed(oo,no);let ao,so;if(eo.nonWitnessUtxo){const fo=nonWitnessUtxoTxFromCache(to,eo,Xr),ho=io.ins[Xr].hash,go=fo.getHash();if(!ho.equals(go))throw new Error(`Non-witness UTXO hash for input #${Xr} doesn't match the hash specified in the prevout`);const yo=io.ins[Xr].index;so=fo.outs[yo]}else if(eo.witnessUtxo)so=eo.witnessUtxo;else throw new Error("Need a Utxo input item for signing");const{meaningfulScript:co,type:lo}=getMeaningfulScript(so.script,Xr,"input",eo.redeemScript,eo.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(lo)>=0)ao=io.hashForWitnessV0(Xr,co,so.value,oo);else if((0,psbtutils_1.isP2WPKH)(co)){const fo=payments.p2pkh({hash:co.slice(2)}).output;ao=io.hashForWitnessV0(Xr,fo,so.value,oo)}else{if(eo.nonWitnessUtxo===void 0&&to.__UNSAFE_SIGN_NONSEGWIT===!1)throw new Error(`Input #${Xr} has witnessUtxo but non-segwit script: ${co.toString("hex")}`);!ro&&to.__UNSAFE_SIGN_NONSEGWIT!==!1&&console.warn(`Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant. +`,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var payments$3={},embed={},script$1={},bip66$1={};Object.defineProperty(bip66$1,"__esModule",{value:!0});bip66$1.encode=bip66$1.decode=bip66$1.check=void 0;function check$d(Xr){if(Xr.length<8||Xr.length>72||Xr[0]!==48||Xr[1]!==Xr.length-2||Xr[2]!==2)return!1;const eo=Xr[3];if(eo===0||5+eo>=Xr.length||Xr[4+eo]!==2)return!1;const to=Xr[5+eo];return!(to===0||6+eo+to!==Xr.length||Xr[4]&128||eo>1&&Xr[4]===0&&!(Xr[5]&128)||Xr[eo+6]&128||to>1&&Xr[eo+6]===0&&!(Xr[eo+7]&128))}bip66$1.check=check$d;function decode$o(Xr){if(Xr.length<8)throw new Error("DER sequence length is too short");if(Xr.length>72)throw new Error("DER sequence length is too long");if(Xr[0]!==48)throw new Error("Expected DER sequence");if(Xr[1]!==Xr.length-2)throw new Error("DER sequence length is invalid");if(Xr[2]!==2)throw new Error("Expected DER integer");const eo=Xr[3];if(eo===0)throw new Error("R length is zero");if(5+eo>=Xr.length)throw new Error("R length is too long");if(Xr[4+eo]!==2)throw new Error("Expected DER integer (2)");const to=Xr[5+eo];if(to===0)throw new Error("S length is zero");if(6+eo+to!==Xr.length)throw new Error("S length is invalid");if(Xr[4]&128)throw new Error("R value is negative");if(eo>1&&Xr[4]===0&&!(Xr[5]&128))throw new Error("R value excessively padded");if(Xr[eo+6]&128)throw new Error("S value is negative");if(to>1&&Xr[eo+6]===0&&!(Xr[eo+7]&128))throw new Error("S value excessively padded");return{r:Xr.slice(4,4+eo),s:Xr.slice(6+eo)}}bip66$1.decode=decode$o;function encode$m(Xr,eo){const to=Xr.length,ro=eo.length;if(to===0)throw new Error("R length is zero");if(ro===0)throw new Error("S length is zero");if(to>33)throw new Error("R length is too long");if(ro>33)throw new Error("S length is too long");if(Xr[0]&128)throw new Error("R value is negative");if(eo[0]&128)throw new Error("S value is negative");if(to>1&&Xr[0]===0&&!(Xr[1]&128))throw new Error("R value excessively padded");if(ro>1&&eo[0]===0&&!(eo[1]&128))throw new Error("S value excessively padded");const no=Buffer$3.allocUnsafe(6+to+ro);return no[0]=48,no[1]=no.length-2,no[2]=2,no[3]=Xr.length,Xr.copy(no,4),no[4+to]=2,no[5+to]=eo.length,eo.copy(no,6+to),no}bip66$1.encode=encode$m;var ops={};Object.defineProperty(ops,"__esModule",{value:!0});ops.REVERSE_OPS=ops.OPS=void 0;const OPS$8={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};ops.OPS=OPS$8;const REVERSE_OPS={};ops.REVERSE_OPS=REVERSE_OPS;for(const Xr of Object.keys(OPS$8)){const eo=OPS$8[Xr];REVERSE_OPS[eo]=Xr}var push_data={};Object.defineProperty(push_data,"__esModule",{value:!0});push_data.decode=push_data.encode=push_data.encodingLength=void 0;const ops_1=ops;function encodingLength$2(Xr){return XrXr.length)return null;ro=Xr.readUInt8(eo+1),no=2}else if(to===ops_1.OPS.OP_PUSHDATA2){if(eo+3>Xr.length)return null;ro=Xr.readUInt16LE(eo+1),no=3}else{if(eo+5>Xr.length)return null;if(to!==ops_1.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");ro=Xr.readUInt32LE(eo+1),no=5}return{opcode:to,number:ro,size:no}}push_data.decode=decode$n;var script_number={};Object.defineProperty(script_number,"__esModule",{value:!0});script_number.encode=script_number.decode=void 0;function decode$m(Xr,eo,to){eo=eo||4,to=to===void 0?!0:to;const ro=Xr.length;if(ro===0)return 0;if(ro>eo)throw new TypeError("Script number overflow");if(to&&!(Xr[ro-1]&127)&&(ro<=1||!(Xr[ro-2]&128)))throw new Error("Non-minimally encoded script number");if(ro===5){const io=Xr.readUInt32LE(0),oo=Xr.readUInt8(4);return oo&128?-((oo&-129)*4294967296+io):oo*4294967296+io}let no=0;for(let io=0;io2147483647?5:Xr>8388607?4:Xr>32767?3:Xr>127?2:Xr>0?1:0}function encode$k(Xr){let eo=Math.abs(Xr);const to=scriptNumSize(eo),ro=Buffer$3.allocUnsafe(to),no=Xr<0;for(let io=0;io>=8;return ro[to-1]&128?ro.writeUInt8(no?128:0,to-1):no&&(ro[to-1]|=128),ro}script_number.encode=encode$k;var script_signature={},types$7={},types$6={Array:function(Xr){return Xr!=null&&Xr.constructor===Array},Boolean:function(Xr){return typeof Xr=="boolean"},Function:function(Xr){return typeof Xr=="function"},Nil:function(Xr){return Xr==null},Number:function(Xr){return typeof Xr=="number"},Object:function(Xr){return typeof Xr=="object"},String:function(Xr){return typeof Xr=="string"},"":function(){return!0}};types$6.Null=types$6.Nil;for(var typeName$1 in types$6)types$6[typeName$1].toJSON=(function(Xr){return Xr}).bind(null,typeName$1);var native$2=types$6,native$1=native$2;function getTypeName(Xr){return Xr.name||Xr.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName$1(Xr){return native$1.Nil(Xr)?"":getTypeName(Xr.constructor)}function getValue(Xr){return native$1.Function(Xr)?"":native$1.String(Xr)?JSON.stringify(Xr):Xr&&native$1.Object(Xr)?"":Xr}function captureStackTrace(Xr,eo){Error.captureStackTrace&&Error.captureStackTrace(Xr,eo)}function tfJSON$1(Xr){return native$1.Function(Xr)?Xr.toJSON?Xr.toJSON():getTypeName(Xr):native$1.Array(Xr)?"Array":Xr&&native$1.Object(Xr)?"Object":Xr!==void 0?Xr:""}function tfErrorString(Xr,eo,to){var ro=getValue(eo);return"Expected "+tfJSON$1(Xr)+", got"+(to!==""?" "+to:"")+(ro!==""?" "+ro:"")}function TfTypeError$1(Xr,eo,to){to=to||getValueTypeName$1(eo),this.message=tfErrorString(Xr,eo,to),captureStackTrace(this,TfTypeError$1),this.__type=Xr,this.__value=eo,this.__valueTypeName=to}TfTypeError$1.prototype=Object.create(Error.prototype);TfTypeError$1.prototype.constructor=TfTypeError$1;function tfPropertyErrorString(Xr,eo,to,ro,no){var io='" of type ';return eo==="key"&&(io='" with key type '),tfErrorString('property "'+tfJSON$1(to)+io+tfJSON$1(Xr),ro,no)}function TfPropertyTypeError$1(Xr,eo,to,ro,no){Xr?(no=no||getValueTypeName$1(ro),this.message=tfPropertyErrorString(Xr,to,eo,ro,no)):this.message='Unexpected property "'+eo+'"',captureStackTrace(this,TfTypeError$1),this.__label=to,this.__property=eo,this.__type=Xr,this.__value=ro,this.__valueTypeName=no}TfPropertyTypeError$1.prototype=Object.create(Error.prototype);TfPropertyTypeError$1.prototype.constructor=TfTypeError$1;function tfCustomError(Xr,eo){return new TfTypeError$1(Xr,{},eo)}function tfSubError$1(Xr,eo,to){return Xr instanceof TfPropertyTypeError$1?(eo=eo+"."+Xr.__property,Xr=new TfPropertyTypeError$1(Xr.__type,eo,Xr.__label,Xr.__value,Xr.__valueTypeName)):Xr instanceof TfTypeError$1&&(Xr=new TfPropertyTypeError$1(Xr.__type,eo,to,Xr.__value,Xr.__valueTypeName)),captureStackTrace(Xr),Xr}var errors$2={TfTypeError:TfTypeError$1,TfPropertyTypeError:TfPropertyTypeError$1,tfCustomError,tfSubError:tfSubError$1,tfJSON:tfJSON$1,getValueTypeName:getValueTypeName$1},extra,hasRequiredExtra;function requireExtra(){if(hasRequiredExtra)return extra;hasRequiredExtra=1;var Xr=native$2,eo=errors$2;function to(Bo){return Buffer$3.isBuffer(Bo)}function ro(Bo){return typeof Bo=="string"&&/^([0-9a-f]{2})+$/i.test(Bo)}function no(Bo,Mo){var Fo=Bo.toJSON();function Wo(Jo){if(!Bo(Jo))return!1;if(Jo.length===Mo)return!0;throw eo.tfCustomError(Fo+"(Length: "+Mo+")",Fo+"(Length: "+Jo.length+")")}return Wo.toJSON=function(){return Fo},Wo}var io=no.bind(null,Xr.Array),oo=no.bind(null,to),ao=no.bind(null,ro),so=no.bind(null,Xr.String);function co(Bo,Mo,Fo){Fo=Fo||Xr.Number;function Wo(Jo,Po){return Fo(Jo,Po)&&Jo>Bo&&Jo>24===Bo}function go(Bo){return Bo<<16>>16===Bo}function bo(Bo){return(Bo|0)===Bo}function wo(Bo){return typeof Bo=="number"&&Bo>=-lo&&Bo<=lo&&Math.floor(Bo)===Bo}function Eo(Bo){return(Bo&255)===Bo}function $o(Bo){return(Bo&65535)===Bo}function Co(Bo){return Bo>>>0===Bo}function Ro(Bo){return typeof Bo=="number"&&Bo>=0&&Bo<=lo&&Math.floor(Bo)===Bo}var Oo={ArrayN:io,Buffer:to,BufferN:oo,Finite:uo,Hex:ro,HexN:ao,Int8:ho,Int16:go,Int32:bo,Int53:wo,Range:co,StringN:so,UInt8:Eo,UInt16:$o,UInt32:Co,UInt53:Ro};for(var jo in Oo)Oo[jo].toJSON=(function(Bo){return Bo}).bind(null,jo);return extra=Oo,extra}var ERRORS=errors$2,NATIVE=native$2,tfJSON=ERRORS.tfJSON,TfTypeError=ERRORS.TfTypeError,TfPropertyTypeError=ERRORS.TfPropertyTypeError,tfSubError=ERRORS.tfSubError,getValueTypeName=ERRORS.getValueTypeName,TYPES={arrayOf:function Xr(eo,to){eo=compile(eo),to=to||{};function ro(no,io){return!NATIVE.Array(no)||NATIVE.Nil(no)||to.minLength!==void 0&&no.lengthto.maxLength||to.length!==void 0&&no.length!==to.length?!1:no.every(function(oo,ao){try{return typeforce$4(eo,oo,io)}catch(so){throw tfSubError(so,ao)}})}return ro.toJSON=function(){var no="["+tfJSON(eo)+"]";return to.length!==void 0?no+="{"+to.length+"}":(to.minLength!==void 0||to.maxLength!==void 0)&&(no+="{"+(to.minLength===void 0?0:to.minLength)+","+(to.maxLength===void 0?1/0:to.maxLength)+"}"),no},ro},maybe:function Xr(eo){eo=compile(eo);function to(ro,no){return NATIVE.Nil(ro)||eo(ro,no,Xr)}return to.toJSON=function(){return"?"+tfJSON(eo)},to},map:function Xr(eo,to){eo=compile(eo),to&&(to=compile(to));function ro(no,io){if(!NATIVE.Object(no)||NATIVE.Nil(no))return!1;for(var oo in no){try{to&&typeforce$4(to,oo,io)}catch(so){throw tfSubError(so,oo,"key")}try{var ao=no[oo];typeforce$4(eo,ao,io)}catch(so){throw tfSubError(so,oo)}}return!0}return to?ro.toJSON=function(){return"{"+tfJSON(to)+": "+tfJSON(eo)+"}"}:ro.toJSON=function(){return"{"+tfJSON(eo)+"}"},ro},object:function Xr(eo){var to={};for(var ro in eo)to[ro]=compile(eo[ro]);function no(io,oo){if(!NATIVE.Object(io)||NATIVE.Nil(io))return!1;var ao;try{for(ao in to){var so=to[ao],co=io[ao];typeforce$4(so,co,oo)}}catch(lo){throw tfSubError(lo,ao)}if(oo){for(ao in io)if(!to[ao])throw new TfPropertyTypeError(void 0,ao)}return!0}return no.toJSON=function(){return tfJSON(to)},no},anyOf:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return eo.some(function(io){try{return typeforce$4(io,ro,no)}catch{return!1}})}return to.toJSON=function(){return eo.map(tfJSON).join("|")},to},allOf:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return eo.every(function(io){try{return typeforce$4(io,ro,no)}catch{return!1}})}return to.toJSON=function(){return eo.map(tfJSON).join(" & ")},to},quacksLike:function Xr(eo){function to(ro){return eo===getValueTypeName(ro)}return to.toJSON=function(){return eo},to},tuple:function Xr(){var eo=[].slice.call(arguments).map(compile);function to(ro,no){return NATIVE.Nil(ro)||NATIVE.Nil(ro.length)||no&&ro.length!==eo.length?!1:eo.every(function(io,oo){try{return typeforce$4(io,ro[oo],no)}catch(ao){throw tfSubError(ao,oo)}})}return to.toJSON=function(){return"("+eo.map(tfJSON).join(", ")+")"},to},value:function Xr(eo){function to(ro){return ro===eo}return to.toJSON=function(){return eo},to}};TYPES.oneOf=TYPES.anyOf;function compile(Xr){if(NATIVE.String(Xr))return Xr[0]==="?"?TYPES.maybe(Xr.slice(1)):NATIVE[Xr]||TYPES.quacksLike(Xr);if(Xr&&NATIVE.Object(Xr)){if(NATIVE.Array(Xr)){if(Xr.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(Xr[0])}return TYPES.object(Xr)}else if(NATIVE.Function(Xr))return Xr;return TYPES.value(Xr)}function typeforce$4(Xr,eo,to,ro){if(NATIVE.Function(Xr)){if(Xr(eo,to))return!0;throw new TfTypeError(ro||Xr,eo)}return typeforce$4(compile(Xr),eo,to)}for(var typeName in NATIVE)typeforce$4[typeName]=NATIVE[typeName];for(typeName in TYPES)typeforce$4[typeName]=TYPES[typeName];var EXTRA$1=requireExtra();for(typeName in EXTRA$1)typeforce$4[typeName]=EXTRA$1[typeName];typeforce$4.compile=compile;typeforce$4.TfTypeError=TfTypeError;typeforce$4.TfPropertyTypeError=TfPropertyTypeError;var typeforce_1=typeforce$4;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.oneOf=Xr.Null=Xr.BufferN=Xr.Function=Xr.UInt32=Xr.UInt8=Xr.tuple=Xr.maybe=Xr.Hex=Xr.Buffer=Xr.String=Xr.Boolean=Xr.Array=Xr.Number=Xr.Hash256bit=Xr.Hash160bit=Xr.Buffer256bit=Xr.isTaptree=Xr.isTapleaf=Xr.TAPLEAF_VERSION_MASK=Xr.Network=Xr.ECPoint=Xr.Satoshi=Xr.Signer=Xr.BIP32Path=Xr.UInt31=Xr.isPoint=Xr.typeforce=void 0;const eo=require$$0$9;Xr.typeforce=typeforce_1;const to=eo.Buffer.alloc(32,0),ro=eo.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function no(go){if(!eo.Buffer.isBuffer(go)||go.length<33)return!1;const bo=go[0],wo=go.slice(1,33);if(wo.compare(to)===0||wo.compare(ro)>=0)return!1;if((bo===2||bo===3)&&go.length===33)return!0;const Eo=go.slice(33);return Eo.compare(to)===0||Eo.compare(ro)>=0?!1:bo===4&&go.length===65}Xr.isPoint=no;const io=Math.pow(2,31)-1;function oo(go){return Xr.typeforce.UInt32(go)&&go<=io}Xr.UInt31=oo;function ao(go){return Xr.typeforce.String(go)&&!!go.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}Xr.BIP32Path=ao,ao.toJSON=()=>"BIP32 derivation path";function so(go){return(Xr.typeforce.Buffer(go.publicKey)||typeof go.getPublicKey=="function")&&typeof go.sign=="function"}Xr.Signer=so;const co=21*1e14;function lo(go){return Xr.typeforce.UInt53(go)&&go<=co}Xr.Satoshi=lo,Xr.ECPoint=Xr.typeforce.quacksLike("Point"),Xr.Network=Xr.typeforce.compile({messagePrefix:Xr.typeforce.oneOf(Xr.typeforce.Buffer,Xr.typeforce.String),bip32:{public:Xr.typeforce.UInt32,private:Xr.typeforce.UInt32},pubKeyHash:Xr.typeforce.UInt8,scriptHash:Xr.typeforce.UInt8,wif:Xr.typeforce.UInt8}),Xr.TAPLEAF_VERSION_MASK=254;function uo(go){return!go||!("output"in go)||!eo.Buffer.isBuffer(go.output)?!1:go.version!==void 0?(go.version&Xr.TAPLEAF_VERSION_MASK)===go.version:!0}Xr.isTapleaf=uo;function ho(go){return(0,Xr.Array)(go)?go.length!==2?!1:go.every(bo=>ho(bo)):uo(go)}Xr.isTaptree=ho,Xr.Buffer256bit=Xr.typeforce.BufferN(32),Xr.Hash160bit=Xr.typeforce.BufferN(20),Xr.Hash256bit=Xr.typeforce.BufferN(32),Xr.Number=Xr.typeforce.Number,Xr.Array=Xr.typeforce.Array,Xr.Boolean=Xr.typeforce.Boolean,Xr.String=Xr.typeforce.String,Xr.Buffer=Xr.typeforce.Buffer,Xr.Hex=Xr.typeforce.Hex,Xr.maybe=Xr.typeforce.maybe,Xr.tuple=Xr.typeforce.tuple,Xr.UInt8=Xr.typeforce.UInt8,Xr.UInt32=Xr.typeforce.UInt32,Xr.Function=Xr.typeforce.Function,Xr.BufferN=Xr.typeforce.BufferN,Xr.Null=Xr.typeforce.Null,Xr.oneOf=Xr.typeforce.oneOf})(types$7);Object.defineProperty(script_signature,"__esModule",{value:!0});script_signature.encode=script_signature.decode=void 0;const bip66=bip66$1,types$5=types$7,{typeforce:typeforce$3}=types$5,ZERO$2=Buffer$3.alloc(1,0);function toDER(Xr){let eo=0;for(;Xr[eo]===0;)++eo;return eo===Xr.length?ZERO$2:(Xr=Xr.slice(eo),Xr[0]&128?Buffer$3.concat([ZERO$2,Xr],1+Xr.length):Xr)}function fromDER(Xr){Xr[0]===0&&(Xr=Xr.slice(1));const eo=Buffer$3.alloc(32,0),to=Math.max(0,32-Xr.length);return Xr.copy(eo,to),eo}function decode$l(Xr){const eo=Xr.readUInt8(Xr.length-1),to=eo&-129;if(to<=0||to>=4)throw new Error("Invalid hashType "+eo);const ro=bip66.decode(Xr.slice(0,-1)),no=fromDER(ro.r),io=fromDER(ro.s);return{signature:Buffer$3.concat([no,io],64),hashType:eo}}script_signature.decode=decode$l;function encode$j(Xr,eo){typeforce$3({signature:types$5.BufferN(64),hashType:types$5.UInt8},{signature:Xr,hashType:eo});const to=eo&-129;if(to<=0||to>=4)throw new Error("Invalid hashType "+eo);const ro=Buffer$3.allocUnsafe(1);ro.writeUInt8(eo,0);const no=toDER(Xr.slice(0,32)),io=toDER(Xr.slice(32,64));return Buffer$3.concat([bip66.encode(no,io),ro])}script_signature.encode=encode$j;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.signature=Xr.number=Xr.isCanonicalScriptSignature=Xr.isDefinedHashType=Xr.isCanonicalPubKey=Xr.toStack=Xr.fromASM=Xr.toASM=Xr.decompile=Xr.compile=Xr.countNonPushOnlyOPs=Xr.isPushOnly=Xr.OPS=void 0;const eo=bip66$1,to=ops;Object.defineProperty(Xr,"OPS",{enumerable:!0,get:function(){return to.OPS}});const ro=push_data,no=script_number,io=script_signature,oo=types$7,{typeforce:ao}=oo,so=to.OPS.OP_RESERVED;function co(Wo){return oo.Number(Wo)&&(Wo===to.OPS.OP_0||Wo>=to.OPS.OP_1&&Wo<=to.OPS.OP_16||Wo===to.OPS.OP_1NEGATE)}function lo(Wo){return oo.Buffer(Wo)||co(Wo)}function uo(Wo){return oo.Array(Wo)&&Wo.every(lo)}Xr.isPushOnly=uo;function ho(Wo){return Wo.length-Wo.filter(lo).length}Xr.countNonPushOnlyOPs=ho;function go(Wo){if(Wo.length===0)return to.OPS.OP_0;if(Wo.length===1){if(Wo[0]>=1&&Wo[0]<=16)return so+Wo[0];if(Wo[0]===129)return to.OPS.OP_1NEGATE}}function bo(Wo){return Buffer$3.isBuffer(Wo)}function wo(Wo){return oo.Array(Wo)}function Eo(Wo){return Buffer$3.isBuffer(Wo)}function $o(Wo){if(bo(Wo))return Wo;ao(oo.Array,Wo);const Jo=Wo.reduce((yo,vo)=>Eo(vo)?vo.length===1&&go(vo)!==void 0?yo+1:yo+ro.encodingLength(vo.length)+vo.length:yo+1,0),Po=Buffer$3.allocUnsafe(Jo);let fo=0;if(Wo.forEach(yo=>{if(Eo(yo)){const vo=go(yo);if(vo!==void 0){Po.writeUInt8(vo,fo),fo+=1;return}fo+=ro.encode(Po,yo.length,fo),yo.copy(Po,fo),fo+=yo.length}else Po.writeUInt8(yo,fo),fo+=1}),fo!==Po.length)throw new Error("Could not decode chunks");return Po}Xr.compile=$o;function Co(Wo){if(wo(Wo))return Wo;ao(oo.Buffer,Wo);const Jo=[];let Po=0;for(;Poto.OPS.OP_0&&fo<=to.OPS.OP_PUSHDATA4){const yo=ro.decode(Wo,Po);if(yo===null||(Po+=yo.size,Po+yo.number>Wo.length))return null;const vo=Wo.slice(Po,Po+yo.number);Po+=yo.number;const _o=go(vo);_o!==void 0?Jo.push(_o):Jo.push(vo)}else Jo.push(fo),Po+=1}return Jo}Xr.decompile=Co;function Ro(Wo){return bo(Wo)&&(Wo=Co(Wo)),Wo.map(Jo=>{if(Eo(Jo)){const Po=go(Jo);if(Po===void 0)return Jo.toString("hex");Jo=Po}return to.REVERSE_OPS[Jo]}).join(" ")}Xr.toASM=Ro;function Oo(Wo){return ao(oo.String,Wo),$o(Wo.split(" ").map(Jo=>to.OPS[Jo]!==void 0?to.OPS[Jo]:(ao(oo.Hex,Jo),Buffer$3.from(Jo,"hex"))))}Xr.fromASM=Oo;function jo(Wo){return Wo=Co(Wo),ao(uo,Wo),Wo.map(Jo=>Eo(Jo)?Jo:Jo===to.OPS.OP_0?Buffer$3.allocUnsafe(0):no.encode(Jo-so))}Xr.toStack=jo;function Bo(Wo){return oo.isPoint(Wo)}Xr.isCanonicalPubKey=Bo;function Mo(Wo){const Jo=Wo&-129;return Jo>0&&Jo<4}Xr.isDefinedHashType=Mo;function Fo(Wo){return!Buffer$3.isBuffer(Wo)||!Mo(Wo[Wo.length-1])?!1:eo.check(Wo.slice(0,-1))}Xr.isCanonicalScriptSignature=Fo,Xr.number=no,Xr.signature=io})(script$1);var lazy$8={};Object.defineProperty(lazy$8,"__esModule",{value:!0});lazy$8.value=lazy$8.prop=void 0;function prop(Xr,eo,to){Object.defineProperty(Xr,eo,{configurable:!0,enumerable:!0,get(){const ro=to.call(this);return this[eo]=ro,ro},set(ro){Object.defineProperty(this,eo,{configurable:!0,enumerable:!0,value:ro,writable:!0})}})}lazy$8.prop=prop;function value(Xr){let eo;return()=>(eo!==void 0||(eo=Xr()),eo)}lazy$8.value=value;Object.defineProperty(embed,"__esModule",{value:!0});embed.p2data=void 0;const networks_1$8=networks$1,bscript$b=script$1,types_1$9=types$7,lazy$7=lazy$8,OPS$7=bscript$b.OPS;function stacksEqual$4(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2data(Xr,eo){if(!Xr.data&&!Xr.output)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$9.typeforce)({network:types_1$9.typeforce.maybe(types_1$9.typeforce.Object),output:types_1$9.typeforce.maybe(types_1$9.typeforce.Buffer),data:types_1$9.typeforce.maybe(types_1$9.typeforce.arrayOf(types_1$9.typeforce.Buffer))},Xr);const ro={name:"embed",network:Xr.network||networks_1$8.bitcoin};if(lazy$7.prop(ro,"output",()=>{if(Xr.data)return bscript$b.compile([OPS$7.OP_RETURN].concat(Xr.data))}),lazy$7.prop(ro,"data",()=>{if(Xr.output)return bscript$b.decompile(Xr.output).slice(1)}),eo.validate&&Xr.output){const no=bscript$b.decompile(Xr.output);if(no[0]!==OPS$7.OP_RETURN)throw new TypeError("Output is invalid");if(!no.slice(1).every(types_1$9.typeforce.Buffer))throw new TypeError("Output is invalid");if(Xr.data&&!stacksEqual$4(Xr.data,ro.data))throw new TypeError("Data mismatch")}return Object.assign(ro,Xr)}embed.p2data=p2data;var p2ms$1={};Object.defineProperty(p2ms$1,"__esModule",{value:!0});p2ms$1.p2ms=void 0;const networks_1$7=networks$1,bscript$a=script$1,types_1$8=types$7,lazy$6=lazy$8,OPS$6=bscript$a.OPS,OP_INT_BASE=OPS$6.OP_RESERVED;function stacksEqual$3(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2ms(Xr,eo){if(!Xr.input&&!Xr.output&&!(Xr.pubkeys&&Xr.m!==void 0)&&!Xr.signatures)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{});function to(so){return bscript$a.isCanonicalScriptSignature(so)||(eo.allowIncomplete&&so===OPS$6.OP_0)!==void 0}(0,types_1$8.typeforce)({network:types_1$8.typeforce.maybe(types_1$8.typeforce.Object),m:types_1$8.typeforce.maybe(types_1$8.typeforce.Number),n:types_1$8.typeforce.maybe(types_1$8.typeforce.Number),output:types_1$8.typeforce.maybe(types_1$8.typeforce.Buffer),pubkeys:types_1$8.typeforce.maybe(types_1$8.typeforce.arrayOf(types_1$8.isPoint)),signatures:types_1$8.typeforce.maybe(types_1$8.typeforce.arrayOf(to)),input:types_1$8.typeforce.maybe(types_1$8.typeforce.Buffer)},Xr);const no={network:Xr.network||networks_1$7.bitcoin};let io=[],oo=!1;function ao(so){oo||(oo=!0,io=bscript$a.decompile(so),no.m=io[0]-OP_INT_BASE,no.n=io[io.length-2]-OP_INT_BASE,no.pubkeys=io.slice(1,-2))}if(lazy$6.prop(no,"output",()=>{if(Xr.m&&no.n&&Xr.pubkeys)return bscript$a.compile([].concat(OP_INT_BASE+Xr.m,Xr.pubkeys,OP_INT_BASE+no.n,OPS$6.OP_CHECKMULTISIG))}),lazy$6.prop(no,"m",()=>{if(no.output)return ao(no.output),no.m}),lazy$6.prop(no,"n",()=>{if(no.pubkeys)return no.pubkeys.length}),lazy$6.prop(no,"pubkeys",()=>{if(Xr.output)return ao(Xr.output),no.pubkeys}),lazy$6.prop(no,"signatures",()=>{if(Xr.input)return bscript$a.decompile(Xr.input).slice(1)}),lazy$6.prop(no,"input",()=>{if(Xr.signatures)return bscript$a.compile([OPS$6.OP_0].concat(Xr.signatures))}),lazy$6.prop(no,"witness",()=>{if(no.input)return[]}),lazy$6.prop(no,"name",()=>{if(!(!no.m||!no.n))return`p2ms(${no.m} of ${no.n})`}),eo.validate){if(Xr.output){if(ao(Xr.output),!types_1$8.typeforce.Number(io[0]))throw new TypeError("Output is invalid");if(!types_1$8.typeforce.Number(io[io.length-2]))throw new TypeError("Output is invalid");if(io[io.length-1]!==OPS$6.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(no.m<=0||no.n>16||no.m>no.n||no.n!==io.length-3)throw new TypeError("Output is invalid");if(!no.pubkeys.every(so=>(0,types_1$8.isPoint)(so)))throw new TypeError("Output is invalid");if(Xr.m!==void 0&&Xr.m!==no.m)throw new TypeError("m mismatch");if(Xr.n!==void 0&&Xr.n!==no.n)throw new TypeError("n mismatch");if(Xr.pubkeys&&!stacksEqual$3(Xr.pubkeys,no.pubkeys))throw new TypeError("Pubkeys mismatch")}if(Xr.pubkeys){if(Xr.n!==void 0&&Xr.n!==Xr.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(no.n=Xr.pubkeys.length,no.nno.m)throw new TypeError("Too many signatures provided")}if(Xr.input){if(Xr.input[0]!==OPS$6.OP_0)throw new TypeError("Input is invalid");if(no.signatures.length===0||!no.signatures.every(to))throw new TypeError("Input has invalid signature(s)");if(Xr.signatures&&!stacksEqual$3(Xr.signatures,no.signatures))throw new TypeError("Signature mismatch");if(Xr.m!==void 0&&Xr.m!==Xr.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(no,Xr)}p2ms$1.p2ms=p2ms;var p2pk$1={};Object.defineProperty(p2pk$1,"__esModule",{value:!0});p2pk$1.p2pk=void 0;const networks_1$6=networks$1,bscript$9=script$1,types_1$7=types$7,lazy$5=lazy$8,OPS$5=bscript$9.OPS;function p2pk(Xr,eo){if(!Xr.input&&!Xr.output&&!Xr.pubkey&&!Xr.input&&!Xr.signature)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$7.typeforce)({network:types_1$7.typeforce.maybe(types_1$7.typeforce.Object),output:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer),pubkey:types_1$7.typeforce.maybe(types_1$7.isPoint),signature:types_1$7.typeforce.maybe(bscript$9.isCanonicalScriptSignature),input:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer)},Xr);const to=lazy$5.value(()=>bscript$9.decompile(Xr.input)),no={name:"p2pk",network:Xr.network||networks_1$6.bitcoin};if(lazy$5.prop(no,"output",()=>{if(Xr.pubkey)return bscript$9.compile([Xr.pubkey,OPS$5.OP_CHECKSIG])}),lazy$5.prop(no,"pubkey",()=>{if(Xr.output)return Xr.output.slice(1,-1)}),lazy$5.prop(no,"signature",()=>{if(Xr.input)return to()[0]}),lazy$5.prop(no,"input",()=>{if(Xr.signature)return bscript$9.compile([Xr.signature])}),lazy$5.prop(no,"witness",()=>{if(no.input)return[]}),eo.validate){if(Xr.output){if(Xr.output[Xr.output.length-1]!==OPS$5.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,types_1$7.isPoint)(no.pubkey))throw new TypeError("Output pubkey is invalid");if(Xr.pubkey&&!Xr.pubkey.equals(no.pubkey))throw new TypeError("Pubkey mismatch")}if(Xr.signature&&Xr.input&&!Xr.input.equals(no.input))throw new TypeError("Signature mismatch");if(Xr.input){if(to().length!==1)throw new TypeError("Input is invalid");if(!bscript$9.isCanonicalScriptSignature(no.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(no,Xr)}p2pk$1.p2pk=p2pk;var p2pkh$1={},crypto$3={},sha1$1={};Object.defineProperty(sha1$1,"__esModule",{value:!0});sha1$1.sha1=sha1$1.SHA1=void 0;const _md_js_1=_md,utils_js_1=utils$e,SHA1_IV=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),SHA1_W=new Uint32Array(80);class SHA1 extends _md_js_1.HashMD{constructor(){super(64,20,8,!1),this.A=SHA1_IV[0]|0,this.B=SHA1_IV[1]|0,this.C=SHA1_IV[2]|0,this.D=SHA1_IV[3]|0,this.E=SHA1_IV[4]|0}get(){const{A:eo,B:to,C:ro,D:no,E:io}=this;return[eo,to,ro,no,io]}set(eo,to,ro,no,io){this.A=eo|0,this.B=to|0,this.C=ro|0,this.D=no|0,this.E=io|0}process(eo,to){for(let so=0;so<16;so++,to+=4)SHA1_W[so]=eo.getUint32(to,!1);for(let so=16;so<80;so++)SHA1_W[so]=(0,utils_js_1.rotl)(SHA1_W[so-3]^SHA1_W[so-8]^SHA1_W[so-14]^SHA1_W[so-16],1);let{A:ro,B:no,C:io,D:oo,E:ao}=this;for(let so=0;so<80;so++){let co,lo;so<20?(co=(0,_md_js_1.Chi)(no,io,oo),lo=1518500249):so<40?(co=no^io^oo,lo=1859775393):so<60?(co=(0,_md_js_1.Maj)(no,io,oo),lo=2400959708):(co=no^io^oo,lo=3395469782);const uo=(0,utils_js_1.rotl)(ro,5)+co+ao+lo+SHA1_W[so]|0;ao=oo,oo=io,io=(0,utils_js_1.rotl)(no,30),no=ro,ro=uo}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,this.set(ro,no,io,oo,ao)}roundClean(){SHA1_W.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}sha1$1.SHA1=SHA1;sha1$1.sha1=(0,utils_js_1.wrapConstructor)(()=>new SHA1);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.taggedHash=Xr.TAGGED_HASH_PREFIXES=Xr.TAGS=Xr.hash256=Xr.hash160=Xr.sha256=Xr.sha1=Xr.ripemd160=void 0;const eo=ripemd160$1,to=sha1$1,ro=sha256$7;function no(lo){return Buffer$3.from((0,eo.ripemd160)(Uint8Array.from(lo)))}Xr.ripemd160=no;function io(lo){return Buffer$3.from((0,to.sha1)(Uint8Array.from(lo)))}Xr.sha1=io;function oo(lo){return Buffer$3.from((0,ro.sha256)(Uint8Array.from(lo)))}Xr.sha256=oo;function ao(lo){return Buffer$3.from((0,eo.ripemd160)((0,ro.sha256)(Uint8Array.from(lo))))}Xr.hash160=ao;function so(lo){return Buffer$3.from((0,ro.sha256)((0,ro.sha256)(Uint8Array.from(lo))))}Xr.hash256=so,Xr.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],Xr.TAGGED_HASH_PREFIXES={"BIP0340/challenge":Buffer$3.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":Buffer$3.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":Buffer$3.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:Buffer$3.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:Buffer$3.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:Buffer$3.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:Buffer$3.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":Buffer$3.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":Buffer$3.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])};function co(lo,uo){return oo(Buffer$3.concat([Xr.TAGGED_HASH_PREFIXES[lo],uo]))}Xr.taggedHash=co})(crypto$3);function base$3(Xr){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var eo=new Uint8Array(256),to=0;to>>0,Ro=new Uint8Array(Co);Eo!==$o;){for(var Oo=go[Eo],jo=0,Bo=Co-1;(Oo!==0||jo>>0,Ro[Bo]=Oo%oo>>>0,Oo=Oo/oo>>>0;if(Oo!==0)throw new Error("Non-zero carry");wo=jo,Eo++}for(var Mo=Co-wo;Mo!==Co&&Ro[Mo]===0;)Mo++;for(var Fo=ao.repeat(bo);Mo>>0,Co=new Uint8Array($o);go[bo];){var Ro=eo[go.charCodeAt(bo)];if(Ro===255)return;for(var Oo=0,jo=$o-1;(Ro!==0||Oo>>0,Co[jo]=Ro%256>>>0,Ro=Ro/256>>>0;if(Ro!==0)throw new Error("Non-zero carry");Eo=Oo,bo++}for(var Bo=$o-Eo;Bo!==$o&&Co[Bo]===0;)Bo++;for(var Mo=new Uint8Array(wo+($o-Bo)),Fo=wo;Bo!==$o;)Mo[Fo++]=Co[Bo++];return Mo}function ho(go){var bo=uo(go);if(bo)return bo;throw new Error("Non-base"+oo+" character")}return{encode:lo,decodeUnsafe:uo,decode:ho}}var src$2=base$3;const basex$2=src$2,ALPHABET$2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58$4=basex$2(ALPHABET$2),base58$1=bs58$4,base$2=function(Xr){function eo(io){var oo=Uint8Array.from(io),ao=Xr(oo),so=oo.length+4,co=new Uint8Array(so);return co.set(oo,0),co.set(ao.subarray(0,4),oo.length),base58$1.encode(co,so)}function to(io){var oo=io.slice(0,-4),ao=io.slice(-4),so=Xr(oo);if(!(ao[0]^so[0]|ao[1]^so[1]|ao[2]^so[2]|ao[3]^so[3]))return oo}function ro(io){var oo=base58$1.decodeUnsafe(io);if(oo)return to(oo)}function no(io){var oo=base58$1.decode(io),ao=to(oo);if(!ao)throw new Error("Invalid checksum");return ao}return{encode:eo,decode:no,decodeUnsafe:ro}},{sha256:sha256$2}=sha256$7,bs58checkBase=base$2;function sha256x2(Xr){return sha256$2(sha256$2(Xr))}var bs58check$3=bs58checkBase(sha256x2);Object.defineProperty(p2pkh$1,"__esModule",{value:!0});p2pkh$1.p2pkh=void 0;const bcrypto$5=crypto$3,networks_1$5=networks$1,bscript$8=script$1,types_1$6=types$7,lazy$4=lazy$8,bs58check$2=bs58check$3,OPS$4=bscript$8.OPS;function p2pkh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.pubkey&&!Xr.input)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$6.typeforce)({network:types_1$6.typeforce.maybe(types_1$6.typeforce.Object),address:types_1$6.typeforce.maybe(types_1$6.typeforce.String),hash:types_1$6.typeforce.maybe(types_1$6.typeforce.BufferN(20)),output:types_1$6.typeforce.maybe(types_1$6.typeforce.BufferN(25)),pubkey:types_1$6.typeforce.maybe(types_1$6.isPoint),signature:types_1$6.typeforce.maybe(bscript$8.isCanonicalScriptSignature),input:types_1$6.typeforce.maybe(types_1$6.typeforce.Buffer)},Xr);const to=lazy$4.value(()=>{const oo=Buffer$3.from(bs58check$2.decode(Xr.address)),ao=oo.readUInt8(0),so=oo.slice(1);return{version:ao,hash:so}}),ro=lazy$4.value(()=>bscript$8.decompile(Xr.input)),no=Xr.network||networks_1$5.bitcoin,io={name:"p2pkh",network:no};if(lazy$4.prop(io,"address",()=>{if(!io.hash)return;const oo=Buffer$3.allocUnsafe(21);return oo.writeUInt8(no.pubKeyHash,0),io.hash.copy(oo,1),bs58check$2.encode(oo)}),lazy$4.prop(io,"hash",()=>{if(Xr.output)return Xr.output.slice(3,23);if(Xr.address)return to().hash;if(Xr.pubkey||io.pubkey)return bcrypto$5.hash160(Xr.pubkey||io.pubkey)}),lazy$4.prop(io,"output",()=>{if(io.hash)return bscript$8.compile([OPS$4.OP_DUP,OPS$4.OP_HASH160,io.hash,OPS$4.OP_EQUALVERIFY,OPS$4.OP_CHECKSIG])}),lazy$4.prop(io,"pubkey",()=>{if(Xr.input)return ro()[1]}),lazy$4.prop(io,"signature",()=>{if(Xr.input)return ro()[0]}),lazy$4.prop(io,"input",()=>{if(Xr.pubkey&&Xr.signature)return bscript$8.compile([Xr.signature,Xr.pubkey])}),lazy$4.prop(io,"witness",()=>{if(io.input)return[]}),eo.validate){let oo=Buffer$3.from([]);if(Xr.address){if(to().version!==no.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(to().hash.length!==20)throw new TypeError("Invalid address");oo=to().hash}if(Xr.hash){if(oo.length>0&&!oo.equals(Xr.hash))throw new TypeError("Hash mismatch");oo=Xr.hash}if(Xr.output){if(Xr.output.length!==25||Xr.output[0]!==OPS$4.OP_DUP||Xr.output[1]!==OPS$4.OP_HASH160||Xr.output[2]!==20||Xr.output[23]!==OPS$4.OP_EQUALVERIFY||Xr.output[24]!==OPS$4.OP_CHECKSIG)throw new TypeError("Output is invalid");const ao=Xr.output.slice(3,23);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.pubkey){const ao=bcrypto$5.hash160(Xr.pubkey);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.input){const ao=ro();if(ao.length!==2)throw new TypeError("Input is invalid");if(!bscript$8.isCanonicalScriptSignature(ao[0]))throw new TypeError("Input has invalid signature");if(!(0,types_1$6.isPoint)(ao[1]))throw new TypeError("Input has invalid pubkey");if(Xr.signature&&!Xr.signature.equals(ao[0]))throw new TypeError("Signature mismatch");if(Xr.pubkey&&!Xr.pubkey.equals(ao[1]))throw new TypeError("Pubkey mismatch");const so=bcrypto$5.hash160(ao[1]);if(oo.length>0&&!oo.equals(so))throw new TypeError("Hash mismatch")}}return Object.assign(io,Xr)}p2pkh$1.p2pkh=p2pkh;var p2sh$1={};Object.defineProperty(p2sh$1,"__esModule",{value:!0});p2sh$1.p2sh=void 0;const bcrypto$4=crypto$3,networks_1$4=networks$1,bscript$7=script$1,types_1$5=types$7,lazy$3=lazy$8,bs58check$1=bs58check$3,OPS$3=bscript$7.OPS;function stacksEqual$2(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function p2sh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.redeem&&!Xr.input)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$5.typeforce)({network:types_1$5.typeforce.maybe(types_1$5.typeforce.Object),address:types_1$5.typeforce.maybe(types_1$5.typeforce.String),hash:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(20)),output:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(23)),redeem:types_1$5.typeforce.maybe({network:types_1$5.typeforce.maybe(types_1$5.typeforce.Object),output:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),input:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),witness:types_1$5.typeforce.maybe(types_1$5.typeforce.arrayOf(types_1$5.typeforce.Buffer))}),input:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer),witness:types_1$5.typeforce.maybe(types_1$5.typeforce.arrayOf(types_1$5.typeforce.Buffer))},Xr);let to=Xr.network;to||(to=Xr.redeem&&Xr.redeem.network||networks_1$4.bitcoin);const ro={network:to},no=lazy$3.value(()=>{const ao=Buffer$3.from(bs58check$1.decode(Xr.address)),so=ao.readUInt8(0),co=ao.slice(1);return{version:so,hash:co}}),io=lazy$3.value(()=>bscript$7.decompile(Xr.input)),oo=lazy$3.value(()=>{const ao=io(),so=ao[ao.length-1];return{network:to,output:so===OPS$3.OP_FALSE?Buffer$3.from([]):so,input:bscript$7.compile(ao.slice(0,-1)),witness:Xr.witness||[]}});if(lazy$3.prop(ro,"address",()=>{if(!ro.hash)return;const ao=Buffer$3.allocUnsafe(21);return ao.writeUInt8(ro.network.scriptHash,0),ro.hash.copy(ao,1),bs58check$1.encode(ao)}),lazy$3.prop(ro,"hash",()=>{if(Xr.output)return Xr.output.slice(2,22);if(Xr.address)return no().hash;if(ro.redeem&&ro.redeem.output)return bcrypto$4.hash160(ro.redeem.output)}),lazy$3.prop(ro,"output",()=>{if(ro.hash)return bscript$7.compile([OPS$3.OP_HASH160,ro.hash,OPS$3.OP_EQUAL])}),lazy$3.prop(ro,"redeem",()=>{if(Xr.input)return oo()}),lazy$3.prop(ro,"input",()=>{if(!(!Xr.redeem||!Xr.redeem.input||!Xr.redeem.output))return bscript$7.compile([].concat(bscript$7.decompile(Xr.redeem.input),Xr.redeem.output))}),lazy$3.prop(ro,"witness",()=>{if(ro.redeem&&ro.redeem.witness)return ro.redeem.witness;if(ro.input)return[]}),lazy$3.prop(ro,"name",()=>{const ao=["p2sh"];return ro.redeem!==void 0&&ro.redeem.name!==void 0&&ao.push(ro.redeem.name),ao.join("-")}),eo.validate){let ao=Buffer$3.from([]);if(Xr.address){if(no().version!==to.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(no().hash.length!==20)throw new TypeError("Invalid address");ao=no().hash}if(Xr.hash){if(ao.length>0&&!ao.equals(Xr.hash))throw new TypeError("Hash mismatch");ao=Xr.hash}if(Xr.output){if(Xr.output.length!==23||Xr.output[0]!==OPS$3.OP_HASH160||Xr.output[1]!==20||Xr.output[22]!==OPS$3.OP_EQUAL)throw new TypeError("Output is invalid");const co=Xr.output.slice(2,22);if(ao.length>0&&!ao.equals(co))throw new TypeError("Hash mismatch");ao=co}const so=co=>{if(co.output){const lo=bscript$7.decompile(co.output);if(!lo||lo.length<1)throw new TypeError("Redeem.output too short");if(co.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(bscript$7.countNonPushOnlyOPs(lo)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const uo=bcrypto$4.hash160(co.output);if(ao.length>0&&!ao.equals(uo))throw new TypeError("Hash mismatch");ao=uo}if(co.input){const lo=co.input.length>0,uo=co.witness&&co.witness.length>0;if(!lo&&!uo)throw new TypeError("Empty input");if(lo&&uo)throw new TypeError("Input and witness provided");if(lo){const ho=bscript$7.decompile(co.input);if(!bscript$7.isPushOnly(ho))throw new TypeError("Non push-only scriptSig")}}};if(Xr.input){const co=io();if(!co||co.length<1)throw new TypeError("Input too short");if(!Buffer$3.isBuffer(oo().output))throw new TypeError("Input is invalid");so(oo())}if(Xr.redeem){if(Xr.redeem.network&&Xr.redeem.network!==to)throw new TypeError("Network mismatch");if(Xr.input){const co=oo();if(Xr.redeem.output&&!Xr.redeem.output.equals(co.output))throw new TypeError("Redeem.output mismatch");if(Xr.redeem.input&&!Xr.redeem.input.equals(co.input))throw new TypeError("Redeem.input mismatch")}so(Xr.redeem)}if(Xr.witness&&Xr.redeem&&Xr.redeem.witness&&!stacksEqual$2(Xr.redeem.witness,Xr.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(ro,Xr)}p2sh$1.p2sh=p2sh;var p2wpkh$1={};Object.defineProperty(p2wpkh$1,"__esModule",{value:!0});p2wpkh$1.p2wpkh=void 0;const bcrypto$3=crypto$3,networks_1$3=networks$1,bscript$6=script$1,types_1$4=types$7,lazy$2=lazy$8,bech32_1$3=dist$1,OPS$2=bscript$6.OPS,EMPTY_BUFFER$2=Buffer$3.alloc(0);function p2wpkh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.pubkey&&!Xr.witness)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$4.typeforce)({address:types_1$4.typeforce.maybe(types_1$4.typeforce.String),hash:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(20)),input:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(0)),network:types_1$4.typeforce.maybe(types_1$4.typeforce.Object),output:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(22)),pubkey:types_1$4.typeforce.maybe(types_1$4.isPoint),signature:types_1$4.typeforce.maybe(bscript$6.isCanonicalScriptSignature),witness:types_1$4.typeforce.maybe(types_1$4.typeforce.arrayOf(types_1$4.typeforce.Buffer))},Xr);const to=lazy$2.value(()=>{const io=bech32_1$3.bech32.decode(Xr.address),oo=io.words.shift(),ao=bech32_1$3.bech32.fromWords(io.words);return{version:oo,prefix:io.prefix,data:Buffer$3.from(ao)}}),ro=Xr.network||networks_1$3.bitcoin,no={name:"p2wpkh",network:ro};if(lazy$2.prop(no,"address",()=>{if(!no.hash)return;const io=bech32_1$3.bech32.toWords(no.hash);return io.unshift(0),bech32_1$3.bech32.encode(ro.bech32,io)}),lazy$2.prop(no,"hash",()=>{if(Xr.output)return Xr.output.slice(2,22);if(Xr.address)return to().data;if(Xr.pubkey||no.pubkey)return bcrypto$3.hash160(Xr.pubkey||no.pubkey)}),lazy$2.prop(no,"output",()=>{if(no.hash)return bscript$6.compile([OPS$2.OP_0,no.hash])}),lazy$2.prop(no,"pubkey",()=>{if(Xr.pubkey)return Xr.pubkey;if(Xr.witness)return Xr.witness[1]}),lazy$2.prop(no,"signature",()=>{if(Xr.witness)return Xr.witness[0]}),lazy$2.prop(no,"input",()=>{if(no.witness)return EMPTY_BUFFER$2}),lazy$2.prop(no,"witness",()=>{if(Xr.pubkey&&Xr.signature)return[Xr.signature,Xr.pubkey]}),eo.validate){let io=Buffer$3.from([]);if(Xr.address){if(ro&&ro.bech32!==to().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==0)throw new TypeError("Invalid address version");if(to().data.length!==20)throw new TypeError("Invalid address data");io=to().data}if(Xr.hash){if(io.length>0&&!io.equals(Xr.hash))throw new TypeError("Hash mismatch");io=Xr.hash}if(Xr.output){if(Xr.output.length!==22||Xr.output[0]!==OPS$2.OP_0||Xr.output[1]!==20)throw new TypeError("Output is invalid");if(io.length>0&&!io.equals(Xr.output.slice(2)))throw new TypeError("Hash mismatch");io=Xr.output.slice(2)}if(Xr.pubkey){const oo=bcrypto$3.hash160(Xr.pubkey);if(io.length>0&&!io.equals(oo))throw new TypeError("Hash mismatch");if(io=oo,!(0,types_1$4.isPoint)(Xr.pubkey)||Xr.pubkey.length!==33)throw new TypeError("Invalid pubkey for p2wpkh")}if(Xr.witness){if(Xr.witness.length!==2)throw new TypeError("Witness is invalid");if(!bscript$6.isCanonicalScriptSignature(Xr.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,types_1$4.isPoint)(Xr.witness[1])||Xr.witness[1].length!==33)throw new TypeError("Witness has invalid pubkey");if(Xr.signature&&!Xr.signature.equals(Xr.witness[0]))throw new TypeError("Signature mismatch");if(Xr.pubkey&&!Xr.pubkey.equals(Xr.witness[1]))throw new TypeError("Pubkey mismatch");const oo=bcrypto$3.hash160(Xr.witness[1]);if(io.length>0&&!io.equals(oo))throw new TypeError("Hash mismatch")}}return Object.assign(no,Xr)}p2wpkh$1.p2wpkh=p2wpkh;var p2wsh$1={};Object.defineProperty(p2wsh$1,"__esModule",{value:!0});p2wsh$1.p2wsh=void 0;const bcrypto$2=crypto$3,networks_1$2=networks$1,bscript$5=script$1,types_1$3=types$7,lazy$1=lazy$8,bech32_1$2=dist$1,OPS$1=bscript$5.OPS,EMPTY_BUFFER$1=Buffer$3.alloc(0);function stacksEqual$1(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}function chunkHasUncompressedPubkey(Xr){return!!(Buffer$3.isBuffer(Xr)&&Xr.length===65&&Xr[0]===4&&(0,types_1$3.isPoint)(Xr))}function p2wsh(Xr,eo){if(!Xr.address&&!Xr.hash&&!Xr.output&&!Xr.redeem&&!Xr.witness)throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$3.typeforce)({network:types_1$3.typeforce.maybe(types_1$3.typeforce.Object),address:types_1$3.typeforce.maybe(types_1$3.typeforce.String),hash:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(32)),output:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(34)),redeem:types_1$3.typeforce.maybe({input:types_1$3.typeforce.maybe(types_1$3.typeforce.Buffer),network:types_1$3.typeforce.maybe(types_1$3.typeforce.Object),output:types_1$3.typeforce.maybe(types_1$3.typeforce.Buffer),witness:types_1$3.typeforce.maybe(types_1$3.typeforce.arrayOf(types_1$3.typeforce.Buffer))}),input:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(0)),witness:types_1$3.typeforce.maybe(types_1$3.typeforce.arrayOf(types_1$3.typeforce.Buffer))},Xr);const to=lazy$1.value(()=>{const oo=bech32_1$2.bech32.decode(Xr.address),ao=oo.words.shift(),so=bech32_1$2.bech32.fromWords(oo.words);return{version:ao,prefix:oo.prefix,data:Buffer$3.from(so)}}),ro=lazy$1.value(()=>bscript$5.decompile(Xr.redeem.input));let no=Xr.network;no||(no=Xr.redeem&&Xr.redeem.network||networks_1$2.bitcoin);const io={network:no};if(lazy$1.prop(io,"address",()=>{if(!io.hash)return;const oo=bech32_1$2.bech32.toWords(io.hash);return oo.unshift(0),bech32_1$2.bech32.encode(no.bech32,oo)}),lazy$1.prop(io,"hash",()=>{if(Xr.output)return Xr.output.slice(2);if(Xr.address)return to().data;if(io.redeem&&io.redeem.output)return bcrypto$2.sha256(io.redeem.output)}),lazy$1.prop(io,"output",()=>{if(io.hash)return bscript$5.compile([OPS$1.OP_0,io.hash])}),lazy$1.prop(io,"redeem",()=>{if(Xr.witness)return{output:Xr.witness[Xr.witness.length-1],input:EMPTY_BUFFER$1,witness:Xr.witness.slice(0,-1)}}),lazy$1.prop(io,"input",()=>{if(io.witness)return EMPTY_BUFFER$1}),lazy$1.prop(io,"witness",()=>{if(Xr.redeem&&Xr.redeem.input&&Xr.redeem.input.length>0&&Xr.redeem.output&&Xr.redeem.output.length>0){const oo=bscript$5.toStack(ro());return io.redeem=Object.assign({witness:oo},Xr.redeem),io.redeem.input=EMPTY_BUFFER$1,[].concat(oo,Xr.redeem.output)}if(Xr.redeem&&Xr.redeem.output&&Xr.redeem.witness)return[].concat(Xr.redeem.witness,Xr.redeem.output)}),lazy$1.prop(io,"name",()=>{const oo=["p2wsh"];return io.redeem!==void 0&&io.redeem.name!==void 0&&oo.push(io.redeem.name),oo.join("-")}),eo.validate){let oo=Buffer$3.from([]);if(Xr.address){if(to().prefix!==no.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==0)throw new TypeError("Invalid address version");if(to().data.length!==32)throw new TypeError("Invalid address data");oo=to().data}if(Xr.hash){if(oo.length>0&&!oo.equals(Xr.hash))throw new TypeError("Hash mismatch");oo=Xr.hash}if(Xr.output){if(Xr.output.length!==34||Xr.output[0]!==OPS$1.OP_0||Xr.output[1]!==32)throw new TypeError("Output is invalid");const ao=Xr.output.slice(2);if(oo.length>0&&!oo.equals(ao))throw new TypeError("Hash mismatch");oo=ao}if(Xr.redeem){if(Xr.redeem.network&&Xr.redeem.network!==no)throw new TypeError("Network mismatch");if(Xr.redeem.input&&Xr.redeem.input.length>0&&Xr.redeem.witness&&Xr.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(Xr.redeem.output){const ao=bscript$5.decompile(Xr.redeem.output);if(!ao||ao.length<1)throw new TypeError("Redeem.output is invalid");if(Xr.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(bscript$5.countNonPushOnlyOPs(ao)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const so=bcrypto$2.sha256(Xr.redeem.output);if(oo.length>0&&!oo.equals(so))throw new TypeError("Hash mismatch");oo=so}if(Xr.redeem.input&&!bscript$5.isPushOnly(ro()))throw new TypeError("Non push-only scriptSig");if(Xr.witness&&Xr.redeem.witness&&!stacksEqual$1(Xr.witness,Xr.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(Xr.redeem.input&&ro().some(chunkHasUncompressedPubkey)||Xr.redeem.output&&(bscript$5.decompile(Xr.redeem.output)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(Xr.witness&&Xr.witness.length>0){const ao=Xr.witness[Xr.witness.length-1];if(Xr.redeem&&Xr.redeem.output&&!Xr.redeem.output.equals(ao))throw new TypeError("Witness and redeem.output mismatch");if(Xr.witness.some(chunkHasUncompressedPubkey)||(bscript$5.decompile(ao)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(io,Xr)}p2wsh$1.p2wsh=p2wsh;var p2tr$1={},ecc_lib={};Object.defineProperty(ecc_lib,"__esModule",{value:!0});ecc_lib.getEccLib=ecc_lib.initEccLib=void 0;const _ECCLIB_CACHE={};function initEccLib(Xr){Xr?Xr!==_ECCLIB_CACHE.eccLib&&(verifyEcc(Xr),_ECCLIB_CACHE.eccLib=Xr):_ECCLIB_CACHE.eccLib=Xr}ecc_lib.initEccLib=initEccLib;function getEccLib(){if(!_ECCLIB_CACHE.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return _ECCLIB_CACHE.eccLib}ecc_lib.getEccLib=getEccLib;const h$8=Xr=>Buffer$3.from(Xr,"hex");function verifyEcc(Xr){assert$7(typeof Xr.isXOnlyPoint=="function"),assert$7(Xr.isXOnlyPoint(h$8("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert$7(Xr.isXOnlyPoint(h$8("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),assert$7(Xr.isXOnlyPoint(h$8("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),assert$7(Xr.isXOnlyPoint(h$8("0000000000000000000000000000000000000000000000000000000000000001"))),assert$7(!Xr.isXOnlyPoint(h$8("0000000000000000000000000000000000000000000000000000000000000000"))),assert$7(!Xr.isXOnlyPoint(h$8("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),assert$7(typeof Xr.xOnlyPointAddTweak=="function"),tweakAddVectors.forEach(eo=>{const to=Xr.xOnlyPointAddTweak(h$8(eo.pubkey),h$8(eo.tweak));eo.result===null?assert$7(to===null):(assert$7(to!==null),assert$7(to.parity===eo.parity),assert$7(Buffer$3.from(to.xOnlyPubkey).equals(h$8(eo.result))))})}function assert$7(Xr){if(!Xr)throw new Error("ecc library invalid")}const tweakAddVectors=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}];var bip341={},bufferutils={},Buffer=safeBufferExports.Buffer,MAX_SAFE_INTEGER$1=9007199254740991;function checkUInt53$1(Xr){if(Xr<0||Xr>MAX_SAFE_INTEGER$1||Xr%1!==0)throw new RangeError("value out of range")}function encode$i(Xr,eo,to){if(checkUInt53$1(Xr),eo||(eo=Buffer.allocUnsafe(encodingLength$1(Xr))),!Buffer.isBuffer(eo))throw new TypeError("buffer must be a Buffer instance");return to||(to=0),Xr<253?(eo.writeUInt8(Xr,to),encode$i.bytes=1):Xr<=65535?(eo.writeUInt8(253,to),eo.writeUInt16LE(Xr,to+1),encode$i.bytes=3):Xr<=4294967295?(eo.writeUInt8(254,to),eo.writeUInt32LE(Xr,to+1),encode$i.bytes=5):(eo.writeUInt8(255,to),eo.writeUInt32LE(Xr>>>0,to+1),eo.writeUInt32LE(Xr/4294967296|0,to+5),encode$i.bytes=9),eo}function decode$k(Xr,eo){if(!Buffer.isBuffer(Xr))throw new TypeError("buffer must be a Buffer instance");eo||(eo=0);var to=Xr.readUInt8(eo);if(to<253)return decode$k.bytes=1,to;if(to===253)return decode$k.bytes=3,Xr.readUInt16LE(eo+1);if(to===254)return decode$k.bytes=5,Xr.readUInt32LE(eo+1);decode$k.bytes=9;var ro=Xr.readUInt32LE(eo+1),no=Xr.readUInt32LE(eo+5),io=no*4294967296+ro;return checkUInt53$1(io),io}function encodingLength$1(Xr){return checkUInt53$1(Xr),Xr<253?1:Xr<=65535?3:Xr<=4294967295?5:9}var varuintBitcoin={encode:encode$i,decode:decode$k,encodingLength:encodingLength$1};Object.defineProperty(bufferutils,"__esModule",{value:!0});bufferutils.BufferReader=bufferutils.BufferWriter=bufferutils.cloneBuffer=bufferutils.reverseBuffer=bufferutils.writeUInt64LE=bufferutils.readUInt64LE=bufferutils.varuint=void 0;const types$4=types$7,{typeforce:typeforce$2}=types$4,varuint$7=varuintBitcoin;bufferutils.varuint=varuint$7;function verifuint$1(Xr,eo){if(typeof Xr!="number")throw new Error("cannot write a non-number as a number");if(Xr<0)throw new Error("specified a negative value for writing an unsigned value");if(Xr>eo)throw new Error("RangeError: value out of range");if(Math.floor(Xr)!==Xr)throw new Error("value has a fractional component")}function readUInt64LE$1(Xr,eo){const to=Xr.readUInt32LE(eo);let ro=Xr.readUInt32LE(eo+4);return ro*=4294967296,verifuint$1(ro+to,9007199254740991),ro+to}bufferutils.readUInt64LE=readUInt64LE$1;function writeUInt64LE$1(Xr,eo,to){return verifuint$1(eo,9007199254740991),Xr.writeInt32LE(eo&-1,to),Xr.writeUInt32LE(Math.floor(eo/4294967296),to+4),to+8}bufferutils.writeUInt64LE=writeUInt64LE$1;function reverseBuffer$1(Xr){if(Xr.length<1)return Xr;let eo=Xr.length-1,to=0;for(let ro=0;rothis.writeVarSlice(to))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}bufferutils.BufferWriter=BufferWriter;class BufferReader{constructor(eo,to=0){this.buffer=eo,this.offset=to,typeforce$2(types$4.tuple(types$4.Buffer,types$4.UInt32),[eo,to])}readUInt8(){const eo=this.buffer.readUInt8(this.offset);return this.offset++,eo}readInt32(){const eo=this.buffer.readInt32LE(this.offset);return this.offset+=4,eo}readUInt32(){const eo=this.buffer.readUInt32LE(this.offset);return this.offset+=4,eo}readUInt64(){const eo=readUInt64LE$1(this.buffer,this.offset);return this.offset+=8,eo}readVarInt(){const eo=varuint$7.decode(this.buffer,this.offset);return this.offset+=varuint$7.decode.bytes,eo}readSlice(eo){if(this.buffer.length"left"in wo&&"right"in wo;function ao(wo,Eo){if(wo.length<33)throw new TypeError(`The control-block length is too small. Got ${wo.length}, expected min 33.`);const $o=(wo.length-33)/32;let Co=Eo;for(let Ro=0;Ro<$o;Ro++){const Oo=wo.slice(33+32*Ro,65+32*Ro);Co.compare(Oo)<0?Co=go(Co,Oo):Co=go(Oo,Co)}return Co}Xr.rootHashFromPath=ao;function so(wo){if((0,io.isTapleaf)(wo))return{hash:lo(wo)};const Eo=[so(wo[0]),so(wo[1])];Eo.sort((Ro,Oo)=>Ro.hash.compare(Oo.hash));const[$o,Co]=Eo;return{hash:go($o.hash,Co.hash),left:$o,right:Co}}Xr.toHashTree=so;function co(wo,Eo){if(oo(wo)){const $o=co(wo.left,Eo);if($o!==void 0)return[...$o,wo.right.hash];const Co=co(wo.right,Eo);if(Co!==void 0)return[...Co,wo.left.hash]}else if(wo.hash.equals(Eo))return[]}Xr.findScriptPath=co;function lo(wo){const Eo=wo.version||Xr.LEAF_VERSION_TAPSCRIPT;return ro.taggedHash("TapLeaf",eo.Buffer.concat([eo.Buffer.from([Eo]),bo(wo.output)]))}Xr.tapleafHash=lo;function uo(wo,Eo){return ro.taggedHash("TapTweak",eo.Buffer.concat(Eo?[wo,Eo]:[wo]))}Xr.tapTweakHash=uo;function ho(wo,Eo){if(!eo.Buffer.isBuffer(wo)||wo.length!==32||Eo&&Eo.length!==32)return null;const $o=uo(wo,Eo),Co=(0,to.getEccLib)().xOnlyPointAddTweak(wo,$o);return!Co||Co.xOnlyPubkey===null?null:{parity:Co.parity,x:eo.Buffer.from(Co.xOnlyPubkey)}}Xr.tweakKey=ho;function go(wo,Eo){return ro.taggedHash("TapBranch",eo.Buffer.concat([wo,Eo]))}function bo(wo){const Eo=no.varuint.encodingLength(wo.length),$o=eo.Buffer.allocUnsafe(Eo);return no.varuint.encode(wo.length,$o),eo.Buffer.concat([$o,wo])}})(bip341);Object.defineProperty(p2tr$1,"__esModule",{value:!0});p2tr$1.p2tr=void 0;const buffer_1$1=require$$0$9,networks_1$1=networks$1,bscript$4=script$1,types_1$2=types$7,ecc_lib_1=ecc_lib,bip341_1$2=bip341,lazy=lazy$8,bech32_1$1=dist$1,OPS=bscript$4.OPS,TAPROOT_WITNESS_VERSION=1,ANNEX_PREFIX=80;function p2tr(Xr,eo){if(!Xr.address&&!Xr.output&&!Xr.pubkey&&!Xr.internalPubkey&&!(Xr.witness&&Xr.witness.length>1))throw new TypeError("Not enough data");eo=Object.assign({validate:!0},eo||{}),(0,types_1$2.typeforce)({address:types_1$2.typeforce.maybe(types_1$2.typeforce.String),input:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(0)),network:types_1$2.typeforce.maybe(types_1$2.typeforce.Object),output:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(34)),internalPubkey:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),hash:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),pubkey:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),signature:types_1$2.typeforce.maybe(types_1$2.typeforce.anyOf(types_1$2.typeforce.BufferN(64),types_1$2.typeforce.BufferN(65))),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer)),scriptTree:types_1$2.typeforce.maybe(types_1$2.isTaptree),redeem:types_1$2.typeforce.maybe({output:types_1$2.typeforce.maybe(types_1$2.typeforce.Buffer),redeemVersion:types_1$2.typeforce.maybe(types_1$2.typeforce.Number),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer))}),redeemVersion:types_1$2.typeforce.maybe(types_1$2.typeforce.Number)},Xr);const to=lazy.value(()=>{const ao=bech32_1$1.bech32m.decode(Xr.address),so=ao.words.shift(),co=bech32_1$1.bech32m.fromWords(ao.words);return{version:so,prefix:ao.prefix,data:buffer_1$1.Buffer.from(co)}}),ro=lazy.value(()=>{if(!(!Xr.witness||!Xr.witness.length))return Xr.witness.length>=2&&Xr.witness[Xr.witness.length-1][0]===ANNEX_PREFIX?Xr.witness.slice(0,-1):Xr.witness.slice()}),no=lazy.value(()=>{if(Xr.scriptTree)return(0,bip341_1$2.toHashTree)(Xr.scriptTree);if(Xr.hash)return{hash:Xr.hash}}),io=Xr.network||networks_1$1.bitcoin,oo={name:"p2tr",network:io};if(lazy.prop(oo,"address",()=>{if(!oo.pubkey)return;const ao=bech32_1$1.bech32m.toWords(oo.pubkey);return ao.unshift(TAPROOT_WITNESS_VERSION),bech32_1$1.bech32m.encode(io.bech32,ao)}),lazy.prop(oo,"hash",()=>{const ao=no();if(ao)return ao.hash;const so=ro();if(so&&so.length>1){const co=so[so.length-1],lo=co[0]&types_1$2.TAPLEAF_VERSION_MASK,uo=so[so.length-2],ho=(0,bip341_1$2.tapleafHash)({output:uo,version:lo});return(0,bip341_1$2.rootHashFromPath)(co,ho)}return null}),lazy.prop(oo,"output",()=>{if(oo.pubkey)return bscript$4.compile([OPS.OP_1,oo.pubkey])}),lazy.prop(oo,"redeemVersion",()=>Xr.redeemVersion?Xr.redeemVersion:Xr.redeem&&Xr.redeem.redeemVersion!==void 0&&Xr.redeem.redeemVersion!==null?Xr.redeem.redeemVersion:bip341_1$2.LEAF_VERSION_TAPSCRIPT),lazy.prop(oo,"redeem",()=>{const ao=ro();if(!(!ao||ao.length<2))return{output:ao[ao.length-2],witness:ao.slice(0,-2),redeemVersion:ao[ao.length-1][0]&types_1$2.TAPLEAF_VERSION_MASK}}),lazy.prop(oo,"pubkey",()=>{if(Xr.pubkey)return Xr.pubkey;if(Xr.output)return Xr.output.slice(2);if(Xr.address)return to().data;if(oo.internalPubkey){const ao=(0,bip341_1$2.tweakKey)(oo.internalPubkey,oo.hash);if(ao)return ao.x}}),lazy.prop(oo,"internalPubkey",()=>{if(Xr.internalPubkey)return Xr.internalPubkey;const ao=ro();if(ao&&ao.length>1)return ao[ao.length-1].slice(1,33)}),lazy.prop(oo,"signature",()=>{if(Xr.signature)return Xr.signature;const ao=ro();if(!(!ao||ao.length!==1))return ao[0]}),lazy.prop(oo,"witness",()=>{if(Xr.witness)return Xr.witness;const ao=no();if(ao&&Xr.redeem&&Xr.redeem.output&&Xr.internalPubkey){const so=(0,bip341_1$2.tapleafHash)({output:Xr.redeem.output,version:oo.redeemVersion}),co=(0,bip341_1$2.findScriptPath)(ao,so);if(!co)return;const lo=(0,bip341_1$2.tweakKey)(Xr.internalPubkey,ao.hash);if(!lo)return;const uo=buffer_1$1.Buffer.concat([buffer_1$1.Buffer.from([oo.redeemVersion|lo.parity]),Xr.internalPubkey].concat(co));return[Xr.redeem.output,uo]}if(Xr.signature)return[Xr.signature]}),eo.validate){let ao=buffer_1$1.Buffer.from([]);if(Xr.address){if(io&&io.bech32!==to().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(to().version!==TAPROOT_WITNESS_VERSION)throw new TypeError("Invalid address version");if(to().data.length!==32)throw new TypeError("Invalid address data");ao=to().data}if(Xr.pubkey){if(ao.length>0&&!ao.equals(Xr.pubkey))throw new TypeError("Pubkey mismatch");ao=Xr.pubkey}if(Xr.output){if(Xr.output.length!==34||Xr.output[0]!==OPS.OP_1||Xr.output[1]!==32)throw new TypeError("Output is invalid");if(ao.length>0&&!ao.equals(Xr.output.slice(2)))throw new TypeError("Pubkey mismatch");ao=Xr.output.slice(2)}if(Xr.internalPubkey){const lo=(0,bip341_1$2.tweakKey)(Xr.internalPubkey,oo.hash);if(ao.length>0&&!ao.equals(lo.x))throw new TypeError("Pubkey mismatch");ao=lo.x}if(ao&&ao.length&&!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(ao))throw new TypeError("Invalid pubkey for p2tr");const so=no();if(Xr.hash&&so&&!Xr.hash.equals(so.hash))throw new TypeError("Hash mismatch");if(Xr.redeem&&Xr.redeem.output&&so){const lo=(0,bip341_1$2.tapleafHash)({output:Xr.redeem.output,version:oo.redeemVersion});if(!(0,bip341_1$2.findScriptPath)(so,lo))throw new TypeError("Redeem script not in tree")}const co=ro();if(Xr.redeem&&oo.redeem){if(Xr.redeem.redeemVersion&&Xr.redeem.redeemVersion!==oo.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(Xr.redeem.output){if(bscript$4.decompile(Xr.redeem.output).length===0)throw new TypeError("Redeem.output is invalid");if(oo.redeem.output&&!Xr.redeem.output.equals(oo.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(Xr.redeem.witness&&oo.redeem.witness&&!stacksEqual(Xr.redeem.witness,oo.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(co&&co.length)if(co.length===1){if(Xr.signature&&!Xr.signature.equals(co[0]))throw new TypeError("Signature mismatch")}else{const lo=co[co.length-1];if(lo.length<33)throw new TypeError(`The control-block length is too small. Got ${lo.length}, expected min 33.`);if((lo.length-33)%32!==0)throw new TypeError(`The control-block length of ${lo.length} is incorrect!`);const uo=(lo.length-33)/32;if(uo>128)throw new TypeError(`The script path is too long. Got ${uo}, expected max 128.`);const ho=lo.slice(1,33);if(Xr.internalPubkey&&!Xr.internalPubkey.equals(ho))throw new TypeError("Internal pubkey mismatch");if(!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(ho))throw new TypeError("Invalid internalPubkey for p2tr witness");const go=lo[0]&types_1$2.TAPLEAF_VERSION_MASK,bo=co[co.length-2],wo=(0,bip341_1$2.tapleafHash)({output:bo,version:go}),Eo=(0,bip341_1$2.rootHashFromPath)(lo,wo),$o=(0,bip341_1$2.tweakKey)(ho,Eo);if(!$o)throw new TypeError("Invalid outputKey for p2tr witness");if(ao.length&&!ao.equals($o.x))throw new TypeError("Pubkey mismatch for p2tr witness");if($o.parity!==(lo[0]&1))throw new Error("Incorrect parity")}}return Object.assign(oo,Xr)}p2tr$1.p2tr=p2tr;function stacksEqual(Xr,eo){return Xr.length!==eo.length?!1:Xr.every((to,ro)=>to.equals(eo[ro]))}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.p2tr=Xr.p2wsh=Xr.p2wpkh=Xr.p2sh=Xr.p2pkh=Xr.p2pk=Xr.p2ms=Xr.embed=void 0;const eo=embed;Object.defineProperty(Xr,"embed",{enumerable:!0,get:function(){return eo.p2data}});const to=p2ms$1;Object.defineProperty(Xr,"p2ms",{enumerable:!0,get:function(){return to.p2ms}});const ro=p2pk$1;Object.defineProperty(Xr,"p2pk",{enumerable:!0,get:function(){return ro.p2pk}});const no=p2pkh$1;Object.defineProperty(Xr,"p2pkh",{enumerable:!0,get:function(){return no.p2pkh}});const io=p2sh$1;Object.defineProperty(Xr,"p2sh",{enumerable:!0,get:function(){return io.p2sh}});const oo=p2wpkh$1;Object.defineProperty(Xr,"p2wpkh",{enumerable:!0,get:function(){return oo.p2wpkh}});const ao=p2wsh$1;Object.defineProperty(Xr,"p2wsh",{enumerable:!0,get:function(){return ao.p2wsh}});const so=p2tr$1;Object.defineProperty(Xr,"p2tr",{enumerable:!0,get:function(){return so.p2tr}})})(payments$3);Object.defineProperty(address,"__esModule",{value:!0});address.toOutputScript=address.fromOutputScript=address.toBech32=address.toBase58Check=address.fromBech32=address.fromBase58Check=void 0;const networks=networks$1,payments$2=payments$3,bscript$3=script$1,types_1$1=types$7,bech32_1=dist$1,bs58check=bs58check$3,FUTURE_SEGWIT_MAX_SIZE=40,FUTURE_SEGWIT_MIN_SIZE=2,FUTURE_SEGWIT_MAX_VERSION=16,FUTURE_SEGWIT_MIN_VERSION=2,FUTURE_SEGWIT_VERSION_DIFF=80,FUTURE_SEGWIT_VERSION_WARNING="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function _toFutureSegwitAddress(Xr,eo){const to=Xr.slice(2);if(to.lengthFUTURE_SEGWIT_MAX_SIZE)throw new TypeError("Invalid program length for segwit address");const ro=Xr[0]-FUTURE_SEGWIT_VERSION_DIFF;if(roFUTURE_SEGWIT_MAX_VERSION)throw new TypeError("Invalid version for segwit address");if(Xr[1]!==to.length)throw new TypeError("Invalid script for segwit address");return console.warn(FUTURE_SEGWIT_VERSION_WARNING),toBech32(to,ro,eo.bech32)}function fromBase58Check(Xr){const eo=Buffer$3.from(bs58check.decode(Xr));if(eo.length<21)throw new TypeError(Xr+" is too short");if(eo.length>21)throw new TypeError(Xr+" is too long");const to=eo.readUInt8(0),ro=eo.slice(1);return{version:to,hash:ro}}address.fromBase58Check=fromBase58Check;function fromBech32(Xr){let eo,to;try{eo=bech32_1.bech32.decode(Xr)}catch{}if(eo){if(to=eo.words[0],to!==0)throw new TypeError(Xr+" uses wrong encoding")}else if(eo=bech32_1.bech32m.decode(Xr),to=eo.words[0],to===0)throw new TypeError(Xr+" uses wrong encoding");const ro=bech32_1.bech32.fromWords(eo.words.slice(1));return{version:to,prefix:eo.prefix,data:Buffer$3.from(ro)}}address.fromBech32=fromBech32;function toBase58Check(Xr,eo){(0,types_1$1.typeforce)((0,types_1$1.tuple)(types_1$1.Hash160bit,types_1$1.UInt8),arguments);const to=Buffer$3.allocUnsafe(21);return to.writeUInt8(eo,0),Xr.copy(to,1),bs58check.encode(to)}address.toBase58Check=toBase58Check;function toBech32(Xr,eo,to){const ro=bech32_1.bech32.toWords(Xr);return ro.unshift(eo),eo===0?bech32_1.bech32.encode(to,ro):bech32_1.bech32m.encode(to,ro)}address.toBech32=toBech32;function fromOutputScript(Xr,eo){eo=eo||networks.bitcoin;try{return payments$2.p2pkh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2sh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2wpkh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2wsh({output:Xr,network:eo}).address}catch{}try{return payments$2.p2tr({output:Xr,network:eo}).address}catch{}try{return _toFutureSegwitAddress(Xr,eo)}catch{}throw new Error(bscript$3.toASM(Xr)+" has no matching Address")}address.fromOutputScript=fromOutputScript;function toOutputScript(Xr,eo){eo=eo||networks.bitcoin;let to,ro;try{to=fromBase58Check(Xr)}catch{}if(to){if(to.version===eo.pubKeyHash)return payments$2.p2pkh({hash:to.hash}).output;if(to.version===eo.scriptHash)return payments$2.p2sh({hash:to.hash}).output}else{try{ro=fromBech32(Xr)}catch{}if(ro){if(ro.prefix!==eo.bech32)throw new Error(Xr+" has an invalid prefix");if(ro.version===0){if(ro.data.length===20)return payments$2.p2wpkh({hash:ro.data}).output;if(ro.data.length===32)return payments$2.p2wsh({hash:ro.data}).output}else if(ro.version===1){if(ro.data.length===32)return payments$2.p2tr({pubkey:ro.data}).output}else if(ro.version>=FUTURE_SEGWIT_MIN_VERSION&&ro.version<=FUTURE_SEGWIT_MAX_VERSION&&ro.data.length>=FUTURE_SEGWIT_MIN_SIZE&&ro.data.length<=FUTURE_SEGWIT_MAX_SIZE)return console.warn(FUTURE_SEGWIT_VERSION_WARNING),bscript$3.compile([ro.version+FUTURE_SEGWIT_VERSION_DIFF,ro.data])}}throw new Error(Xr+" has no matching Script")}address.toOutputScript=toOutputScript;var block={},merkle={};Object.defineProperty(merkle,"__esModule",{value:!0});merkle.fastMerkleRoot=void 0;function fastMerkleRoot(Xr,eo){if(!Array.isArray(Xr))throw TypeError("Expected values Array");if(typeof eo!="function")throw TypeError("Expected digest Function");let to=Xr.length;const ro=Xr.concat();for(;to>1;){let no=0;for(let io=0;ioto+varSliceSize(ro),0)}const EMPTY_BUFFER=Buffer$3.allocUnsafe(0),EMPTY_WITNESS=[],ZERO$1=Buffer$3.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),ONE=Buffer$3.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=Buffer$3.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_BUFFER,valueBuffer:VALUE_UINT64_MAX};function isOutput(Xr){return Xr.value!==void 0}let Transaction$1=class mm{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(eo,to){const ro=new bufferutils_1$2.BufferReader(eo),no=new mm;no.version=ro.readInt32();const io=ro.readUInt8(),oo=ro.readUInt8();let ao=!1;io===mm.ADVANCED_TRANSACTION_MARKER&&oo===mm.ADVANCED_TRANSACTION_FLAG?ao=!0:ro.offset-=2;const so=ro.readVarInt();for(let lo=0;loeo.witness.length!==0)}weight(){const eo=this.byteLength(!1),to=this.byteLength(!0);return eo*3+to}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(eo=!0){const to=eo&&this.hasWitnesses();return(to?10:8)+bufferutils_1$2.varuint.encodingLength(this.ins.length)+bufferutils_1$2.varuint.encodingLength(this.outs.length)+this.ins.reduce((ro,no)=>ro+40+varSliceSize(no.script),0)+this.outs.reduce((ro,no)=>ro+8+varSliceSize(no.script),0)+(to?this.ins.reduce((ro,no)=>ro+vectorSize(no.witness),0):0)}clone(){const eo=new mm;return eo.version=this.version,eo.locktime=this.locktime,eo.ins=this.ins.map(to=>({hash:to.hash,index:to.index,script:to.script,sequence:to.sequence,witness:to.witness})),eo.outs=this.outs.map(to=>({script:to.script,value:to.value})),eo}hashForSignature(eo,to,ro){if(typeforce$1(types$3.tuple(types$3.UInt32,types$3.Buffer,types$3.Number),arguments),eo>=this.ins.length)return ONE;const no=bscript$2.compile(bscript$2.decompile(to).filter(ao=>ao!==script_1.OPS.OP_CODESEPARATOR)),io=this.clone();if((ro&31)===mm.SIGHASH_NONE)io.outs=[],io.ins.forEach((ao,so)=>{so!==eo&&(ao.sequence=0)});else if((ro&31)===mm.SIGHASH_SINGLE){if(eo>=this.outs.length)return ONE;io.outs.length=eo+1;for(let ao=0;ao{so!==eo&&(ao.sequence=0)})}ro&mm.SIGHASH_ANYONECANPAY?(io.ins=[io.ins[eo]],io.ins[0].script=no):(io.ins.forEach(ao=>{ao.script=EMPTY_BUFFER}),io.ins[eo].script=no);const oo=Buffer$3.allocUnsafe(io.byteLength(!1)+4);return oo.writeInt32LE(ro,oo.length-4),io.__toBuffer(oo,0,!1),bcrypto$1.hash256(oo)}hashForWitnessV1(eo,to,ro,no,io,oo){if(typeforce$1(types$3.tuple(types$3.UInt32,typeforce$1.arrayOf(types$3.Buffer),typeforce$1.arrayOf(types$3.Satoshi),types$3.UInt32),arguments),ro.length!==this.ins.length||to.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const ao=no===mm.SIGHASH_DEFAULT?mm.SIGHASH_ALL:no&mm.SIGHASH_OUTPUT_MASK,co=(no&mm.SIGHASH_INPUT_MASK)===mm.SIGHASH_ANYONECANPAY,lo=ao===mm.SIGHASH_NONE,uo=ao===mm.SIGHASH_SINGLE;let ho=EMPTY_BUFFER,go=EMPTY_BUFFER,bo=EMPTY_BUFFER,wo=EMPTY_BUFFER,Eo=EMPTY_BUFFER;if(!co){let Oo=bufferutils_1$2.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach(jo=>{Oo.writeSlice(jo.hash),Oo.writeUInt32(jo.index)}),ho=bcrypto$1.sha256(Oo.end()),Oo=bufferutils_1$2.BufferWriter.withCapacity(8*this.ins.length),ro.forEach(jo=>Oo.writeUInt64(jo)),go=bcrypto$1.sha256(Oo.end()),Oo=bufferutils_1$2.BufferWriter.withCapacity(to.map(varSliceSize).reduce((jo,Bo)=>jo+Bo)),to.forEach(jo=>Oo.writeVarSlice(jo)),bo=bcrypto$1.sha256(Oo.end()),Oo=bufferutils_1$2.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach(jo=>Oo.writeUInt32(jo.sequence)),wo=bcrypto$1.sha256(Oo.end())}if(lo||uo){if(uo&&eo8+varSliceSize(Bo.script)).reduce((Bo,Mo)=>Bo+Mo),jo=bufferutils_1$2.BufferWriter.withCapacity(Oo);this.outs.forEach(Bo=>{jo.writeUInt64(Bo.value),jo.writeVarSlice(Bo.script)}),Eo=bcrypto$1.sha256(jo.end())}const $o=(io?2:0)+(oo?1:0),Co=174-(co?49:0)-(lo?32:0)+(oo?32:0)+(io?37:0),Ro=bufferutils_1$2.BufferWriter.withCapacity(Co);if(Ro.writeUInt8(no),Ro.writeInt32(this.version),Ro.writeUInt32(this.locktime),Ro.writeSlice(ho),Ro.writeSlice(go),Ro.writeSlice(bo),Ro.writeSlice(wo),lo||uo||Ro.writeSlice(Eo),Ro.writeUInt8($o),co){const Oo=this.ins[eo];Ro.writeSlice(Oo.hash),Ro.writeUInt32(Oo.index),Ro.writeUInt64(ro[eo]),Ro.writeVarSlice(to[eo]),Ro.writeUInt32(Oo.sequence)}else Ro.writeUInt32(eo);if(oo){const Oo=bufferutils_1$2.BufferWriter.withCapacity(varSliceSize(oo));Oo.writeVarSlice(oo),Ro.writeSlice(bcrypto$1.sha256(Oo.end()))}return uo&&Ro.writeSlice(Eo),io&&(Ro.writeSlice(io),Ro.writeUInt8(0),Ro.writeUInt32(4294967295)),bcrypto$1.taggedHash("TapSighash",Buffer$3.concat([Buffer$3.from([0]),Ro.end()]))}hashForWitnessV0(eo,to,ro,no){typeforce$1(types$3.tuple(types$3.UInt32,types$3.Buffer,types$3.Satoshi,types$3.UInt32),arguments);let io=Buffer$3.from([]),oo,ao=ZERO$1,so=ZERO$1,co=ZERO$1;if(no&mm.SIGHASH_ANYONECANPAY||(io=Buffer$3.allocUnsafe(36*this.ins.length),oo=new bufferutils_1$2.BufferWriter(io,0),this.ins.forEach(uo=>{oo.writeSlice(uo.hash),oo.writeUInt32(uo.index)}),so=bcrypto$1.hash256(io)),!(no&mm.SIGHASH_ANYONECANPAY)&&(no&31)!==mm.SIGHASH_SINGLE&&(no&31)!==mm.SIGHASH_NONE&&(io=Buffer$3.allocUnsafe(4*this.ins.length),oo=new bufferutils_1$2.BufferWriter(io,0),this.ins.forEach(uo=>{oo.writeUInt32(uo.sequence)}),co=bcrypto$1.hash256(io)),(no&31)!==mm.SIGHASH_SINGLE&&(no&31)!==mm.SIGHASH_NONE){const uo=this.outs.reduce((ho,go)=>ho+8+varSliceSize(go.script),0);io=Buffer$3.allocUnsafe(uo),oo=new bufferutils_1$2.BufferWriter(io,0),this.outs.forEach(ho=>{oo.writeUInt64(ho.value),oo.writeVarSlice(ho.script)}),ao=bcrypto$1.hash256(io)}else if((no&31)===mm.SIGHASH_SINGLE&&eo{no.writeSlice(oo.hash),no.writeUInt32(oo.index),no.writeVarSlice(oo.script),no.writeUInt32(oo.sequence)}),no.writeVarInt(this.outs.length),this.outs.forEach(oo=>{isOutput(oo)?no.writeUInt64(oo.value):no.writeSlice(oo.valueBuffer),no.writeVarSlice(oo.script)}),io&&this.ins.forEach(oo=>{no.writeVector(oo.witness)}),no.writeUInt32(this.locktime),to!==void 0?eo.slice(to,no.offset):eo}};transaction.Transaction=Transaction$1;Transaction$1.DEFAULT_SEQUENCE=4294967295;Transaction$1.SIGHASH_DEFAULT=0;Transaction$1.SIGHASH_ALL=1;Transaction$1.SIGHASH_NONE=2;Transaction$1.SIGHASH_SINGLE=3;Transaction$1.SIGHASH_ANYONECANPAY=128;Transaction$1.SIGHASH_OUTPUT_MASK=3;Transaction$1.SIGHASH_INPUT_MASK=128;Transaction$1.ADVANCED_TRANSACTION_MARKER=0;Transaction$1.ADVANCED_TRANSACTION_FLAG=1;Object.defineProperty(block,"__esModule",{value:!0});block.Block=void 0;const bufferutils_1$1=bufferutils,bcrypto=crypto$3,merkle_1=merkle,transaction_1$3=transaction,types$2=types$7,{typeforce}=types$2,errorMerkleNoTxes=new TypeError("Cannot compute merkle root for zero transactions"),errorWitnessNotSegwit=new TypeError("Cannot compute witness commit for non-segwit block");let Block$1=class Q1{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(eo){if(eo.length<80)throw new Error("Buffer too small (< 80 bytes)");const to=new bufferutils_1$1.BufferReader(eo),ro=new Q1;if(ro.version=to.readInt32(),ro.prevHash=to.readSlice(32),ro.merkleRoot=to.readSlice(32),ro.timestamp=to.readUInt32(),ro.bits=to.readUInt32(),ro.nonce=to.readUInt32(),eo.length===80)return ro;const no=()=>{const ao=transaction_1$3.Transaction.fromBuffer(to.buffer.slice(to.offset),!0);return to.offset+=ao.byteLength(),ao},io=to.readVarInt();ro.transactions=[];for(let ao=0;ao>24)-3,ro=eo&8388607,no=Buffer$3.alloc(32,0);return no.writeUIntBE(ro,29-to,3),no}static calculateMerkleRoot(eo,to){if(typeforce([{getHash:types$2.Function}],eo),eo.length===0)throw errorMerkleNoTxes;if(to&&!txesHaveWitnessCommit(eo))throw errorWitnessNotSegwit;const ro=eo.map(io=>io.getHash(to)),no=(0,merkle_1.fastMerkleRoot)(ro,bcrypto.hash256);return to?bcrypto.hash256(Buffer$3.concat([no,eo[0].ins[0].witness[0]])):no}getWitnessCommit(){if(!txesHaveWitnessCommit(this.transactions))return null;const eo=this.transactions[0].outs.filter(ro=>ro.script.slice(0,6).equals(Buffer$3.from("6a24aa21a9ed","hex"))).map(ro=>ro.script.slice(6,38));if(eo.length===0)return null;const to=eo[eo.length-1];return to instanceof Buffer$3&&to.length===32?to:null}hasWitnessCommit(){return this.witnessCommit instanceof Buffer$3&&this.witnessCommit.length===32||this.getWitnessCommit()!==null}hasWitness(){return anyTxHasWitness(this.transactions)}weight(){const eo=this.byteLength(!1,!1),to=this.byteLength(!1,!0);return eo*3+to}byteLength(eo,to=!0){return eo||!this.transactions?80:80+bufferutils_1$1.varuint.encodingLength(this.transactions.length)+this.transactions.reduce((ro,no)=>ro+no.byteLength(to),0)}getHash(){return bcrypto.hash256(this.toBuffer(!0))}getId(){return(0,bufferutils_1$1.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const eo=new Date(0);return eo.setUTCSeconds(this.timestamp),eo}toBuffer(eo){const to=Buffer$3.allocUnsafe(this.byteLength(eo)),ro=new bufferutils_1$1.BufferWriter(to);return ro.writeInt32(this.version),ro.writeSlice(this.prevHash),ro.writeSlice(this.merkleRoot),ro.writeUInt32(this.timestamp),ro.writeUInt32(this.bits),ro.writeUInt32(this.nonce),eo||!this.transactions||(bufferutils_1$1.varuint.encode(this.transactions.length,to,ro.offset),ro.offset+=bufferutils_1$1.varuint.encode.bytes,this.transactions.forEach(no=>{const io=no.byteLength();no.toBuffer(to,ro.offset),ro.offset+=io})),to}toHex(eo){return this.toBuffer(eo).toString("hex")}checkTxRoots(){const eo=this.hasWitnessCommit();return!eo&&this.hasWitness()?!1:this.__checkMerkleRoot()&&(eo?this.__checkWitnessCommit():!0)}checkProofOfWork(){const eo=(0,bufferutils_1$1.reverseBuffer)(this.getHash()),to=Q1.calculateTarget(this.bits);return eo.compare(to)<=0}__checkMerkleRoot(){if(!this.transactions)throw errorMerkleNoTxes;const eo=Q1.calculateMerkleRoot(this.transactions);return this.merkleRoot.compare(eo)===0}__checkWitnessCommit(){if(!this.transactions)throw errorMerkleNoTxes;if(!this.hasWitnessCommit())throw errorWitnessNotSegwit;const eo=Q1.calculateMerkleRoot(this.transactions,!0);return this.witnessCommit.compare(eo)===0}};block.Block=Block$1;function txesHaveWitnessCommit(Xr){return Xr instanceof Array&&Xr[0]&&Xr[0].ins&&Xr[0].ins instanceof Array&&Xr[0].ins[0]&&Xr[0].ins[0].witness&&Xr[0].ins[0].witness instanceof Array&&Xr[0].ins[0].witness.length>0}function anyTxHasWitness(Xr){return Xr instanceof Array&&Xr.some(eo=>typeof eo=="object"&&eo.ins instanceof Array&&eo.ins.some(to=>typeof to=="object"&&to.witness instanceof Array&&to.witness.length>0))}var psbt$1={},psbt={},combiner={},parser={},fromBuffer={},converter={},typeFields={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),function(eo){eo[eo.UNSIGNED_TX=0]="UNSIGNED_TX",eo[eo.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(Xr.GlobalTypes||(Xr.GlobalTypes={})),Xr.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],function(eo){eo[eo.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",eo[eo.WITNESS_UTXO=1]="WITNESS_UTXO",eo[eo.PARTIAL_SIG=2]="PARTIAL_SIG",eo[eo.SIGHASH_TYPE=3]="SIGHASH_TYPE",eo[eo.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",eo[eo.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",eo[eo.BIP32_DERIVATION=6]="BIP32_DERIVATION",eo[eo.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",eo[eo.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",eo[eo.POR_COMMITMENT=9]="POR_COMMITMENT",eo[eo.TAP_KEY_SIG=19]="TAP_KEY_SIG",eo[eo.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",eo[eo.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",eo[eo.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",eo[eo.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",eo[eo.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"}(Xr.InputTypes||(Xr.InputTypes={})),Xr.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],function(eo){eo[eo.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",eo[eo.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",eo[eo.BIP32_DERIVATION=2]="BIP32_DERIVATION",eo[eo.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",eo[eo.TAP_TREE=6]="TAP_TREE",eo[eo.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"}(Xr.OutputTypes||(Xr.OutputTypes={})),Xr.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]})(typeFields);var globalXpub$1={};Object.defineProperty(globalXpub$1,"__esModule",{value:!0});const typeFields_1$g=typeFields,range$3=Xr=>[...Array(Xr).keys()];function decode$j(Xr){if(Xr.key[0]!==typeFields_1$g.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+Xr.key.toString("hex"));if(Xr.key.length!==79||![2,3].includes(Xr.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+Xr.key.toString("hex"));if(Xr.value.length/4%1!==0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const eo=Xr.key.slice(1),to={masterFingerprint:Xr.value.slice(0,4),extendedPubkey:eo,path:"m"};for(const ro of range$3(Xr.value.length/4-1)){const no=Xr.value.readUInt32LE(ro*4+4),io=!!(no&2147483648),oo=no&2147483647;to.path+="/"+oo.toString(10)+(io?"'":"")}return to}globalXpub$1.decode=decode$j;function encode$h(Xr){const eo=Buffer$3.from([typeFields_1$g.GlobalTypes.GLOBAL_XPUB]),to=Buffer$3.concat([eo,Xr.extendedPubkey]),ro=Xr.path.split("/"),no=Buffer$3.allocUnsafe(ro.length*4);Xr.masterFingerprint.copy(no,0);let io=4;return ro.slice(1).forEach(oo=>{const ao=oo.slice(-1)==="'";let so=2147483647&parseInt(ao?oo.slice(0,-1):oo,10);ao&&(so+=2147483648),no.writeUInt32LE(so,io),io+=4}),{key:to,value:no}}globalXpub$1.encode=encode$h;globalXpub$1.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }";function check$c(Xr){const eo=Xr.extendedPubkey,to=Xr.masterFingerprint,ro=Xr.path;return Buffer$3.isBuffer(eo)&&eo.length===78&&[2,3].indexOf(eo[45])>-1&&Buffer$3.isBuffer(to)&&to.length===4&&typeof ro=="string"&&!!ro.match(/^m(\/\d+'?)*$/)}globalXpub$1.check=check$c;function canAddToArray$3(Xr,eo,to){const ro=eo.extendedPubkey.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.extendedPubkey.equals(eo.extendedPubkey)).length===0)}globalXpub$1.canAddToArray=canAddToArray$3;var unsignedTx$1={};Object.defineProperty(unsignedTx$1,"__esModule",{value:!0});const typeFields_1$f=typeFields;function encode$g(Xr){return{key:Buffer$3.from([typeFields_1$f.GlobalTypes.UNSIGNED_TX]),value:Xr.toBuffer()}}unsignedTx$1.encode=encode$g;var finalScriptSig$1={};Object.defineProperty(finalScriptSig$1,"__esModule",{value:!0});const typeFields_1$e=typeFields;function decode$i(Xr){if(Xr.key[0]!==typeFields_1$e.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+Xr.key.toString("hex"));return Xr.value}finalScriptSig$1.decode=decode$i;function encode$f(Xr){return{key:Buffer$3.from([typeFields_1$e.InputTypes.FINAL_SCRIPTSIG]),value:Xr}}finalScriptSig$1.encode=encode$f;finalScriptSig$1.expected="Buffer";function check$b(Xr){return Buffer$3.isBuffer(Xr)}finalScriptSig$1.check=check$b;function canAdd$8(Xr,eo){return!!Xr&&!!eo&&Xr.finalScriptSig===void 0}finalScriptSig$1.canAdd=canAdd$8;var finalScriptWitness$1={};Object.defineProperty(finalScriptWitness$1,"__esModule",{value:!0});const typeFields_1$d=typeFields;function decode$h(Xr){if(Xr.key[0]!==typeFields_1$d.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+Xr.key.toString("hex"));return Xr.value}finalScriptWitness$1.decode=decode$h;function encode$e(Xr){return{key:Buffer$3.from([typeFields_1$d.InputTypes.FINAL_SCRIPTWITNESS]),value:Xr}}finalScriptWitness$1.encode=encode$e;finalScriptWitness$1.expected="Buffer";function check$a(Xr){return Buffer$3.isBuffer(Xr)}finalScriptWitness$1.check=check$a;function canAdd$7(Xr,eo){return!!Xr&&!!eo&&Xr.finalScriptWitness===void 0}finalScriptWitness$1.canAdd=canAdd$7;var nonWitnessUtxo$1={};Object.defineProperty(nonWitnessUtxo$1,"__esModule",{value:!0});const typeFields_1$c=typeFields;function decode$g(Xr){if(Xr.key[0]!==typeFields_1$c.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+Xr.key.toString("hex"));return Xr.value}nonWitnessUtxo$1.decode=decode$g;function encode$d(Xr){return{key:Buffer$3.from([typeFields_1$c.InputTypes.NON_WITNESS_UTXO]),value:Xr}}nonWitnessUtxo$1.encode=encode$d;nonWitnessUtxo$1.expected="Buffer";function check$9(Xr){return Buffer$3.isBuffer(Xr)}nonWitnessUtxo$1.check=check$9;function canAdd$6(Xr,eo){return!!Xr&&!!eo&&Xr.nonWitnessUtxo===void 0}nonWitnessUtxo$1.canAdd=canAdd$6;var partialSig$1={};Object.defineProperty(partialSig$1,"__esModule",{value:!0});const typeFields_1$b=typeFields;function decode$f(Xr){if(Xr.key[0]!==typeFields_1$b.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+Xr.key.toString("hex"));if(!(Xr.key.length===34||Xr.key.length===66)||![2,3,4].includes(Xr.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+Xr.key.toString("hex"));return{pubkey:Xr.key.slice(1),signature:Xr.value}}partialSig$1.decode=decode$f;function encode$c(Xr){const eo=Buffer$3.from([typeFields_1$b.InputTypes.PARTIAL_SIG]);return{key:Buffer$3.concat([eo,Xr.pubkey]),value:Xr.signature}}partialSig$1.encode=encode$c;partialSig$1.expected="{ pubkey: Buffer; signature: Buffer; }";function check$8(Xr){return Buffer$3.isBuffer(Xr.pubkey)&&Buffer$3.isBuffer(Xr.signature)&&[33,65].includes(Xr.pubkey.length)&&[2,3,4].includes(Xr.pubkey[0])&&isDerSigWithSighash(Xr.signature)}partialSig$1.check=check$8;function isDerSigWithSighash(Xr){if(!Buffer$3.isBuffer(Xr)||Xr.length<9||Xr[0]!==48||Xr.length!==Xr[1]+3||Xr[2]!==2)return!1;const eo=Xr[3];if(eo>33||eo<1||Xr[3+eo+1]!==2)return!1;const to=Xr[3+eo+2];return!(to>33||to<1||Xr.length!==3+eo+2+to+2)}function canAddToArray$2(Xr,eo,to){const ro=eo.pubkey.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.pubkey.equals(eo.pubkey)).length===0)}partialSig$1.canAddToArray=canAddToArray$2;var porCommitment$1={};Object.defineProperty(porCommitment$1,"__esModule",{value:!0});const typeFields_1$a=typeFields;function decode$e(Xr){if(Xr.key[0]!==typeFields_1$a.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+Xr.key.toString("hex"));return Xr.value.toString("utf8")}porCommitment$1.decode=decode$e;function encode$b(Xr){return{key:Buffer$3.from([typeFields_1$a.InputTypes.POR_COMMITMENT]),value:Buffer$3.from(Xr,"utf8")}}porCommitment$1.encode=encode$b;porCommitment$1.expected="string";function check$7(Xr){return typeof Xr=="string"}porCommitment$1.check=check$7;function canAdd$5(Xr,eo){return!!Xr&&!!eo&&Xr.porCommitment===void 0}porCommitment$1.canAdd=canAdd$5;var sighashType$1={};Object.defineProperty(sighashType$1,"__esModule",{value:!0});const typeFields_1$9=typeFields;function decode$d(Xr){if(Xr.key[0]!==typeFields_1$9.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+Xr.key.toString("hex"));return Xr.value.readUInt32LE(0)}sighashType$1.decode=decode$d;function encode$a(Xr){const eo=Buffer$3.from([typeFields_1$9.InputTypes.SIGHASH_TYPE]),to=Buffer$3.allocUnsafe(4);return to.writeUInt32LE(Xr,0),{key:eo,value:to}}sighashType$1.encode=encode$a;sighashType$1.expected="number";function check$6(Xr){return typeof Xr=="number"}sighashType$1.check=check$6;function canAdd$4(Xr,eo){return!!Xr&&!!eo&&Xr.sighashType===void 0}sighashType$1.canAdd=canAdd$4;var tapKeySig$1={};Object.defineProperty(tapKeySig$1,"__esModule",{value:!0});const typeFields_1$8=typeFields;function decode$c(Xr){if(Xr.key[0]!==typeFields_1$8.InputTypes.TAP_KEY_SIG||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+Xr.key.toString("hex"));if(!check$5(Xr.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return Xr.value}tapKeySig$1.decode=decode$c;function encode$9(Xr){return{key:Buffer$3.from([typeFields_1$8.InputTypes.TAP_KEY_SIG]),value:Xr}}tapKeySig$1.encode=encode$9;tapKeySig$1.expected="Buffer";function check$5(Xr){return Buffer$3.isBuffer(Xr)&&(Xr.length===64||Xr.length===65)}tapKeySig$1.check=check$5;function canAdd$3(Xr,eo){return!!Xr&&!!eo&&Xr.tapKeySig===void 0}tapKeySig$1.canAdd=canAdd$3;var tapLeafScript$1={};Object.defineProperty(tapLeafScript$1,"__esModule",{value:!0});const typeFields_1$7=typeFields;function decode$b(Xr){if(Xr.key[0]!==typeFields_1$7.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+Xr.key.toString("hex"));if((Xr.key.length-2)%32!==0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+Xr.key.toString("hex"));const eo=Xr.value[Xr.value.length-1];if((Xr.key[1]&254)!==eo)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+Xr.key.toString("hex"));const to=Xr.value.slice(0,-1);return{controlBlock:Xr.key.slice(1),script:to,leafVersion:eo}}tapLeafScript$1.decode=decode$b;function encode$8(Xr){const eo=Buffer$3.from([typeFields_1$7.InputTypes.TAP_LEAF_SCRIPT]),to=Buffer$3.from([Xr.leafVersion]);return{key:Buffer$3.concat([eo,Xr.controlBlock]),value:Buffer$3.concat([Xr.script,to])}}tapLeafScript$1.encode=encode$8;tapLeafScript$1.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }";function check$4(Xr){return Buffer$3.isBuffer(Xr.controlBlock)&&(Xr.controlBlock.length-1)%32===0&&(Xr.controlBlock[0]&254)===Xr.leafVersion&&Buffer$3.isBuffer(Xr.script)}tapLeafScript$1.check=check$4;function canAddToArray$1(Xr,eo,to){const ro=eo.controlBlock.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.controlBlock.equals(eo.controlBlock)).length===0)}tapLeafScript$1.canAddToArray=canAddToArray$1;var tapMerkleRoot$1={};Object.defineProperty(tapMerkleRoot$1,"__esModule",{value:!0});const typeFields_1$6=typeFields;function decode$a(Xr){if(Xr.key[0]!==typeFields_1$6.InputTypes.TAP_MERKLE_ROOT||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+Xr.key.toString("hex"));if(!check$3(Xr.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return Xr.value}tapMerkleRoot$1.decode=decode$a;function encode$7(Xr){return{key:Buffer$3.from([typeFields_1$6.InputTypes.TAP_MERKLE_ROOT]),value:Xr}}tapMerkleRoot$1.encode=encode$7;tapMerkleRoot$1.expected="Buffer";function check$3(Xr){return Buffer$3.isBuffer(Xr)&&Xr.length===32}tapMerkleRoot$1.check=check$3;function canAdd$2(Xr,eo){return!!Xr&&!!eo&&Xr.tapMerkleRoot===void 0}tapMerkleRoot$1.canAdd=canAdd$2;var tapScriptSig$1={};Object.defineProperty(tapScriptSig$1,"__esModule",{value:!0});const typeFields_1$5=typeFields;function decode$9(Xr){if(Xr.key[0]!==typeFields_1$5.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+Xr.key.toString("hex"));if(Xr.key.length!==65)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+Xr.key.toString("hex"));if(Xr.value.length!==64&&Xr.value.length!==65)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+Xr.key.toString("hex"));const eo=Xr.key.slice(1,33),to=Xr.key.slice(33);return{pubkey:eo,leafHash:to,signature:Xr.value}}tapScriptSig$1.decode=decode$9;function encode$6(Xr){const eo=Buffer$3.from([typeFields_1$5.InputTypes.TAP_SCRIPT_SIG]);return{key:Buffer$3.concat([eo,Xr.pubkey,Xr.leafHash]),value:Xr.signature}}tapScriptSig$1.encode=encode$6;tapScriptSig$1.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }";function check$2(Xr){return Buffer$3.isBuffer(Xr.pubkey)&&Buffer$3.isBuffer(Xr.leafHash)&&Buffer$3.isBuffer(Xr.signature)&&Xr.pubkey.length===32&&Xr.leafHash.length===32&&(Xr.signature.length===64||Xr.signature.length===65)}tapScriptSig$1.check=check$2;function canAddToArray(Xr,eo,to){const ro=eo.pubkey.toString("hex")+eo.leafHash.toString("hex");return to.has(ro)?!1:(to.add(ro),Xr.filter(no=>no.pubkey.equals(eo.pubkey)&&no.leafHash.equals(eo.leafHash)).length===0)}tapScriptSig$1.canAddToArray=canAddToArray;var witnessUtxo$1={},tools={},varint={};Object.defineProperty(varint,"__esModule",{value:!0});const MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(Xr){if(Xr<0||Xr>MAX_SAFE_INTEGER||Xr%1!==0)throw new RangeError("value out of range")}function encode$5(Xr,eo,to){if(checkUInt53(Xr),eo||(eo=Buffer$3.allocUnsafe(encodingLength(Xr))),!Buffer$3.isBuffer(eo))throw new TypeError("buffer must be a Buffer instance");return to||(to=0),Xr<253?(eo.writeUInt8(Xr,to),Object.assign(encode$5,{bytes:1})):Xr<=65535?(eo.writeUInt8(253,to),eo.writeUInt16LE(Xr,to+1),Object.assign(encode$5,{bytes:3})):Xr<=4294967295?(eo.writeUInt8(254,to),eo.writeUInt32LE(Xr,to+1),Object.assign(encode$5,{bytes:5})):(eo.writeUInt8(255,to),eo.writeUInt32LE(Xr>>>0,to+1),eo.writeUInt32LE(Xr/4294967296|0,to+5),Object.assign(encode$5,{bytes:9})),eo}varint.encode=encode$5;function decode$8(Xr,eo){if(!Buffer$3.isBuffer(Xr))throw new TypeError("buffer must be a Buffer instance");eo||(eo=0);const to=Xr.readUInt8(eo);if(to<253)return Object.assign(decode$8,{bytes:1}),to;if(to===253)return Object.assign(decode$8,{bytes:3}),Xr.readUInt16LE(eo+1);if(to===254)return Object.assign(decode$8,{bytes:5}),Xr.readUInt32LE(eo+1);{Object.assign(decode$8,{bytes:9});const ro=Xr.readUInt32LE(eo+1),io=Xr.readUInt32LE(eo+5)*4294967296+ro;return checkUInt53(io),io}}varint.decode=decode$8;function encodingLength(Xr){return checkUInt53(Xr),Xr<253?1:Xr<=65535?3:Xr<=4294967295?5:9}varint.encodingLength=encodingLength;Object.defineProperty(tools,"__esModule",{value:!0});const varuint$6=varint;tools.range=Xr=>[...Array(Xr).keys()];function reverseBuffer(Xr){if(Xr.length<1)return Xr;let eo=Xr.length-1,to=0;for(let ro=0;roeo)throw new Error("RangeError: value out of range");if(Math.floor(Xr)!==Xr)throw new Error("value has a fractional component")}function readUInt64LE(Xr,eo){const to=Xr.readUInt32LE(eo);let ro=Xr.readUInt32LE(eo+4);return ro*=4294967296,verifuint(ro+to,9007199254740991),ro+to}tools.readUInt64LE=readUInt64LE;function writeUInt64LE(Xr,eo,to){return verifuint(eo,9007199254740991),Xr.writeInt32LE(eo&-1,to),Xr.writeUInt32LE(Math.floor(eo/4294967296),to+4),to+8}tools.writeUInt64LE=writeUInt64LE;Object.defineProperty(witnessUtxo$1,"__esModule",{value:!0});const typeFields_1$4=typeFields,tools_1$2=tools,varuint$5=varint;function decode$7(Xr){if(Xr.key[0]!==typeFields_1$4.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+Xr.key.toString("hex"));const eo=tools_1$2.readUInt64LE(Xr.value,0);let to=8;const ro=varuint$5.decode(Xr.value,to);to+=varuint$5.encodingLength(ro);const no=Xr.value.slice(to);if(no.length!==ro)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:no,value:eo}}witnessUtxo$1.decode=decode$7;function encode$4(Xr){const{script:eo,value:to}=Xr,ro=varuint$5.encodingLength(eo.length),no=Buffer$3.allocUnsafe(8+ro+eo.length);return tools_1$2.writeUInt64LE(no,to,0),varuint$5.encode(eo.length,no,8),eo.copy(no,8+ro),{key:Buffer$3.from([typeFields_1$4.InputTypes.WITNESS_UTXO]),value:no}}witnessUtxo$1.encode=encode$4;witnessUtxo$1.expected="{ script: Buffer; value: number; }";function check$1(Xr){return Buffer$3.isBuffer(Xr.script)&&typeof Xr.value=="number"}witnessUtxo$1.check=check$1;function canAdd$1(Xr,eo){return!!Xr&&!!eo&&Xr.witnessUtxo===void 0}witnessUtxo$1.canAdd=canAdd$1;var tapTree$1={};Object.defineProperty(tapTree$1,"__esModule",{value:!0});const typeFields_1$3=typeFields,varuint$4=varint;function decode$6(Xr){if(Xr.key[0]!==typeFields_1$3.OutputTypes.TAP_TREE||Xr.key.length!==1)throw new Error("Decode Error: could not decode tapTree with key 0x"+Xr.key.toString("hex"));let eo=0;const to=[];for(;eo[Buffer$3.of(ro.depth,ro.leafVersion),varuint$4.encode(ro.script.length),ro.script]));return{key:eo,value:Buffer$3.concat(to)}}tapTree$1.encode=encode$3;tapTree$1.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }";function check(Xr){return Array.isArray(Xr.leaves)&&Xr.leaves.every(eo=>eo.depth>=0&&eo.depth<=128&&(eo.leafVersion&254)===eo.leafVersion&&Buffer$3.isBuffer(eo.script))}tapTree$1.check=check;function canAdd(Xr,eo){return!!Xr&&!!eo&&Xr.tapTree===void 0}tapTree$1.canAdd=canAdd;var bip32Derivation$2={};Object.defineProperty(bip32Derivation$2,"__esModule",{value:!0});const range$2=Xr=>[...Array(Xr).keys()],isValidDERKey=Xr=>Xr.length===33&&[2,3].includes(Xr[0])||Xr.length===65&&Xr[0]===4;function makeConverter$4(Xr,eo=isValidDERKey){function to(ao){if(ao.key[0]!==Xr)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+ao.key.toString("hex"));const so=ao.key.slice(1);if(!eo(so))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+ao.key.toString("hex"));if(ao.value.length/4%1!==0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const co={masterFingerprint:ao.value.slice(0,4),pubkey:so,path:"m"};for(const lo of range$2(ao.value.length/4-1)){const uo=ao.value.readUInt32LE(lo*4+4),ho=!!(uo&2147483648),go=uo&2147483647;co.path+="/"+go.toString(10)+(ho?"'":"")}return co}function ro(ao){const so=Buffer$3.from([Xr]),co=Buffer$3.concat([so,ao.pubkey]),lo=ao.path.split("/"),uo=Buffer$3.allocUnsafe(lo.length*4);ao.masterFingerprint.copy(uo,0);let ho=4;return lo.slice(1).forEach(go=>{const bo=go.slice(-1)==="'";let wo=2147483647&parseInt(bo?go.slice(0,-1):go,10);bo&&(wo+=2147483648),uo.writeUInt32LE(wo,ho),ho+=4}),{key:co,value:uo}}const no="{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }";function io(ao){return Buffer$3.isBuffer(ao.pubkey)&&Buffer$3.isBuffer(ao.masterFingerprint)&&typeof ao.path=="string"&&eo(ao.pubkey)&&ao.masterFingerprint.length===4}function oo(ao,so,co){const lo=so.pubkey.toString("hex");return co.has(lo)?!1:(co.add(lo),ao.filter(uo=>uo.pubkey.equals(so.pubkey)).length===0)}return{decode:to,encode:ro,check:io,expected:no,canAddToArray:oo}}bip32Derivation$2.makeConverter=makeConverter$4;var checkPubkey$1={};Object.defineProperty(checkPubkey$1,"__esModule",{value:!0});function makeChecker(Xr){return eo;function eo(to){let ro;if(Xr.includes(to.key[0])&&(ro=to.key.slice(1),!(ro.length===33||ro.length===65)||![2,3,4].includes(ro[0])))throw new Error("Format Error: invalid pubkey in key 0x"+to.key.toString("hex"));return ro}}checkPubkey$1.makeChecker=makeChecker;var redeemScript$1={};Object.defineProperty(redeemScript$1,"__esModule",{value:!0});function makeConverter$3(Xr){function eo(oo){if(oo.key[0]!==Xr)throw new Error("Decode Error: could not decode redeemScript with key 0x"+oo.key.toString("hex"));return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)}function io(oo,ao){return!!oo&&!!ao&&oo.redeemScript===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}redeemScript$1.makeConverter=makeConverter$3;var tapBip32Derivation$1={};Object.defineProperty(tapBip32Derivation$1,"__esModule",{value:!0});const varuint$3=varint,bip32Derivation$1=bip32Derivation$2,isValidBIP340Key=Xr=>Xr.length===32;function makeConverter$2(Xr){const eo=bip32Derivation$1.makeConverter(Xr,isValidBIP340Key);function to(oo){const ao=varuint$3.decode(oo.value),so=varuint$3.encodingLength(ao),co=eo.decode({key:oo.key,value:oo.value.slice(so+ao*32)}),lo=new Array(ao);for(let uo=0,ho=so;uoBuffer$3.isBuffer(ao)&&ao.length===32)&&eo.check(oo)}return{decode:to,encode:ro,check:io,expected:no,canAddToArray:eo.canAddToArray}}tapBip32Derivation$1.makeConverter=makeConverter$2;var tapInternalKey$1={};Object.defineProperty(tapInternalKey$1,"__esModule",{value:!0});function makeConverter$1(Xr){function eo(oo){if(oo.key[0]!==Xr||oo.key.length!==1)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+oo.key.toString("hex"));if(oo.value.length!==32)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)&&oo.length===32}function io(oo,ao){return!!oo&&!!ao&&oo.tapInternalKey===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}tapInternalKey$1.makeConverter=makeConverter$1;var witnessScript$1={};Object.defineProperty(witnessScript$1,"__esModule",{value:!0});function makeConverter(Xr){function eo(oo){if(oo.key[0]!==Xr)throw new Error("Decode Error: could not decode witnessScript with key 0x"+oo.key.toString("hex"));return oo.value}function to(oo){return{key:Buffer$3.from([Xr]),value:oo}}const ro="Buffer";function no(oo){return Buffer$3.isBuffer(oo)}function io(oo,ao){return!!oo&&!!ao&&oo.witnessScript===void 0}return{decode:eo,encode:to,check:no,expected:ro,canAdd:io}}witnessScript$1.makeConverter=makeConverter;Object.defineProperty(converter,"__esModule",{value:!0});const typeFields_1$2=typeFields,globalXpub=globalXpub$1,unsignedTx=unsignedTx$1,finalScriptSig=finalScriptSig$1,finalScriptWitness=finalScriptWitness$1,nonWitnessUtxo=nonWitnessUtxo$1,partialSig=partialSig$1,porCommitment=porCommitment$1,sighashType=sighashType$1,tapKeySig=tapKeySig$1,tapLeafScript=tapLeafScript$1,tapMerkleRoot=tapMerkleRoot$1,tapScriptSig=tapScriptSig$1,witnessUtxo=witnessUtxo$1,tapTree=tapTree$1,bip32Derivation=bip32Derivation$2,checkPubkey=checkPubkey$1,redeemScript=redeemScript$1,tapBip32Derivation=tapBip32Derivation$1,tapInternalKey=tapInternalKey$1,witnessScript=witnessScript$1,globals={unsignedTx,globalXpub,checkPubkey:checkPubkey.makeChecker([])};converter.globals=globals;const inputs={nonWitnessUtxo,partialSig,sighashType,finalScriptSig,finalScriptWitness,porCommitment,witnessUtxo,bip32Derivation:bip32Derivation.makeConverter(typeFields_1$2.InputTypes.BIP32_DERIVATION),redeemScript:redeemScript.makeConverter(typeFields_1$2.InputTypes.REDEEM_SCRIPT),witnessScript:witnessScript.makeConverter(typeFields_1$2.InputTypes.WITNESS_SCRIPT),checkPubkey:checkPubkey.makeChecker([typeFields_1$2.InputTypes.PARTIAL_SIG,typeFields_1$2.InputTypes.BIP32_DERIVATION]),tapKeySig,tapScriptSig,tapLeafScript,tapBip32Derivation:tapBip32Derivation.makeConverter(typeFields_1$2.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:tapInternalKey.makeConverter(typeFields_1$2.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot};converter.inputs=inputs;const outputs={bip32Derivation:bip32Derivation.makeConverter(typeFields_1$2.OutputTypes.BIP32_DERIVATION),redeemScript:redeemScript.makeConverter(typeFields_1$2.OutputTypes.REDEEM_SCRIPT),witnessScript:witnessScript.makeConverter(typeFields_1$2.OutputTypes.WITNESS_SCRIPT),checkPubkey:checkPubkey.makeChecker([typeFields_1$2.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:tapBip32Derivation.makeConverter(typeFields_1$2.OutputTypes.TAP_BIP32_DERIVATION),tapTree,tapInternalKey:tapInternalKey.makeConverter(typeFields_1$2.OutputTypes.TAP_INTERNAL_KEY)};converter.outputs=outputs;Object.defineProperty(fromBuffer,"__esModule",{value:!0});const convert$3=converter,tools_1$1=tools,varuint$2=varint,typeFields_1$1=typeFields;function psbtFromBuffer(Xr,eo){let to=0;function ro(){const Eo=varuint$2.decode(Xr,to);to+=varuint$2.encodingLength(Eo);const $o=Xr.slice(to,to+Eo);return to+=Eo,$o}function no(){const Eo=Xr.readUInt32BE(to);return to+=4,Eo}function io(){const Eo=Xr.readUInt8(to);return to+=1,Eo}function oo(){const Eo=ro(),$o=ro();return{key:Eo,value:$o}}function ao(){if(to>=Xr.length)throw new Error("Format Error: Unexpected End of PSBT");const Eo=Xr.readUInt8(to)===0;return Eo&&to++,Eo}if(no()!==1886610036)throw new Error("Format Error: Invalid Magic Number");if(io()!==255)throw new Error("Format Error: Magic Number must be followed by 0xff separator");const so=[],co={};for(;!ao();){const Eo=oo(),$o=Eo.key.toString("hex");if(co[$o])throw new Error("Format Error: Keys must be unique for global keymap: key "+$o);co[$o]=1,so.push(Eo)}const lo=so.filter(Eo=>Eo.key[0]===typeFields_1$1.GlobalTypes.UNSIGNED_TX);if(lo.length!==1)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const uo=eo(lo[0].value),{inputCount:ho,outputCount:go}=uo.getInputOutputCounts(),bo=[],wo=[];for(const Eo of tools_1$1.range(ho)){const $o={},Co=[];for(;!ao();){const Ro=oo(),Oo=Ro.key.toString("hex");if($o[Oo])throw new Error("Format Error: Keys must be unique for each input: input index "+Eo+" key "+Oo);$o[Oo]=1,Co.push(Ro)}bo.push(Co)}for(const Eo of tools_1$1.range(go)){const $o={},Co=[];for(;!ao();){const Ro=oo(),Oo=Ro.key.toString("hex");if($o[Oo])throw new Error("Format Error: Keys must be unique for each output: output index "+Eo+" key "+Oo);$o[Oo]=1,Co.push(Ro)}wo.push(Co)}return psbtFromKeyVals(uo,{globalMapKeyVals:so,inputKeyVals:bo,outputKeyVals:wo})}fromBuffer.psbtFromBuffer=psbtFromBuffer;function checkKeyBuffer(Xr,eo,to){if(!eo.equals(Buffer$3.from([to])))throw new Error(`Format Error: Invalid ${Xr} key: ${eo.toString("hex")}`)}fromBuffer.checkKeyBuffer=checkKeyBuffer;function psbtFromKeyVals(Xr,{globalMapKeyVals:eo,inputKeyVals:to,outputKeyVals:ro}){const no={unsignedTx:Xr};let io=0;for(const lo of eo)switch(lo.key[0]){case typeFields_1$1.GlobalTypes.UNSIGNED_TX:if(checkKeyBuffer("global",lo.key,typeFields_1$1.GlobalTypes.UNSIGNED_TX),io>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");io++;break;case typeFields_1$1.GlobalTypes.GLOBAL_XPUB:no.globalXpub===void 0&&(no.globalXpub=[]),no.globalXpub.push(convert$3.globals.globalXpub.decode(lo));break;default:no.unknownKeyVals||(no.unknownKeyVals=[]),no.unknownKeyVals.push(lo)}const oo=to.length,ao=ro.length,so=[],co=[];for(const lo of tools_1$1.range(oo)){const uo={};for(const ho of to[lo])switch(convert$3.inputs.checkPubkey(ho),ho.key[0]){case typeFields_1$1.InputTypes.NON_WITNESS_UTXO:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.NON_WITNESS_UTXO),uo.nonWitnessUtxo!==void 0)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");uo.nonWitnessUtxo=convert$3.inputs.nonWitnessUtxo.decode(ho);break;case typeFields_1$1.InputTypes.WITNESS_UTXO:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.WITNESS_UTXO),uo.witnessUtxo!==void 0)throw new Error("Format Error: Input has multiple WITNESS_UTXO");uo.witnessUtxo=convert$3.inputs.witnessUtxo.decode(ho);break;case typeFields_1$1.InputTypes.PARTIAL_SIG:uo.partialSig===void 0&&(uo.partialSig=[]),uo.partialSig.push(convert$3.inputs.partialSig.decode(ho));break;case typeFields_1$1.InputTypes.SIGHASH_TYPE:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.SIGHASH_TYPE),uo.sighashType!==void 0)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");uo.sighashType=convert$3.inputs.sighashType.decode(ho);break;case typeFields_1$1.InputTypes.REDEEM_SCRIPT:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.REDEEM_SCRIPT),uo.redeemScript!==void 0)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");uo.redeemScript=convert$3.inputs.redeemScript.decode(ho);break;case typeFields_1$1.InputTypes.WITNESS_SCRIPT:if(checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.WITNESS_SCRIPT),uo.witnessScript!==void 0)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");uo.witnessScript=convert$3.inputs.witnessScript.decode(ho);break;case typeFields_1$1.InputTypes.BIP32_DERIVATION:uo.bip32Derivation===void 0&&(uo.bip32Derivation=[]),uo.bip32Derivation.push(convert$3.inputs.bip32Derivation.decode(ho));break;case typeFields_1$1.InputTypes.FINAL_SCRIPTSIG:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.FINAL_SCRIPTSIG),uo.finalScriptSig=convert$3.inputs.finalScriptSig.decode(ho);break;case typeFields_1$1.InputTypes.FINAL_SCRIPTWITNESS:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.FINAL_SCRIPTWITNESS),uo.finalScriptWitness=convert$3.inputs.finalScriptWitness.decode(ho);break;case typeFields_1$1.InputTypes.POR_COMMITMENT:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.POR_COMMITMENT),uo.porCommitment=convert$3.inputs.porCommitment.decode(ho);break;case typeFields_1$1.InputTypes.TAP_KEY_SIG:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_KEY_SIG),uo.tapKeySig=convert$3.inputs.tapKeySig.decode(ho);break;case typeFields_1$1.InputTypes.TAP_SCRIPT_SIG:uo.tapScriptSig===void 0&&(uo.tapScriptSig=[]),uo.tapScriptSig.push(convert$3.inputs.tapScriptSig.decode(ho));break;case typeFields_1$1.InputTypes.TAP_LEAF_SCRIPT:uo.tapLeafScript===void 0&&(uo.tapLeafScript=[]),uo.tapLeafScript.push(convert$3.inputs.tapLeafScript.decode(ho));break;case typeFields_1$1.InputTypes.TAP_BIP32_DERIVATION:uo.tapBip32Derivation===void 0&&(uo.tapBip32Derivation=[]),uo.tapBip32Derivation.push(convert$3.inputs.tapBip32Derivation.decode(ho));break;case typeFields_1$1.InputTypes.TAP_INTERNAL_KEY:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_INTERNAL_KEY),uo.tapInternalKey=convert$3.inputs.tapInternalKey.decode(ho);break;case typeFields_1$1.InputTypes.TAP_MERKLE_ROOT:checkKeyBuffer("input",ho.key,typeFields_1$1.InputTypes.TAP_MERKLE_ROOT),uo.tapMerkleRoot=convert$3.inputs.tapMerkleRoot.decode(ho);break;default:uo.unknownKeyVals||(uo.unknownKeyVals=[]),uo.unknownKeyVals.push(ho)}so.push(uo)}for(const lo of tools_1$1.range(ao)){const uo={};for(const ho of ro[lo])switch(convert$3.outputs.checkPubkey(ho),ho.key[0]){case typeFields_1$1.OutputTypes.REDEEM_SCRIPT:if(checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.REDEEM_SCRIPT),uo.redeemScript!==void 0)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");uo.redeemScript=convert$3.outputs.redeemScript.decode(ho);break;case typeFields_1$1.OutputTypes.WITNESS_SCRIPT:if(checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.WITNESS_SCRIPT),uo.witnessScript!==void 0)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");uo.witnessScript=convert$3.outputs.witnessScript.decode(ho);break;case typeFields_1$1.OutputTypes.BIP32_DERIVATION:uo.bip32Derivation===void 0&&(uo.bip32Derivation=[]),uo.bip32Derivation.push(convert$3.outputs.bip32Derivation.decode(ho));break;case typeFields_1$1.OutputTypes.TAP_INTERNAL_KEY:checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.TAP_INTERNAL_KEY),uo.tapInternalKey=convert$3.outputs.tapInternalKey.decode(ho);break;case typeFields_1$1.OutputTypes.TAP_TREE:checkKeyBuffer("output",ho.key,typeFields_1$1.OutputTypes.TAP_TREE),uo.tapTree=convert$3.outputs.tapTree.decode(ho);break;case typeFields_1$1.OutputTypes.TAP_BIP32_DERIVATION:uo.tapBip32Derivation===void 0&&(uo.tapBip32Derivation=[]),uo.tapBip32Derivation.push(convert$3.outputs.tapBip32Derivation.decode(ho));break;default:uo.unknownKeyVals||(uo.unknownKeyVals=[]),uo.unknownKeyVals.push(ho)}co.push(uo)}return{globalMap:no,inputs:so,outputs:co}}fromBuffer.psbtFromKeyVals=psbtFromKeyVals;var toBuffer$5={};Object.defineProperty(toBuffer$5,"__esModule",{value:!0});const convert$2=converter,tools_1=tools;function psbtToBuffer({globalMap:Xr,inputs:eo,outputs:to}){const{globalKeyVals:ro,inputKeyVals:no,outputKeyVals:io}=psbtToKeyVals({globalMap:Xr,inputs:eo,outputs:to}),oo=tools_1.keyValsToBuffer(ro),ao=uo=>uo.length===0?[Buffer$3.from([0])]:uo.map(tools_1.keyValsToBuffer),so=ao(no),co=ao(io),lo=Buffer$3.allocUnsafe(5);return lo.writeUIntBE(482972169471,0,5),Buffer$3.concat([lo,oo].concat(so,co))}toBuffer$5.psbtToBuffer=psbtToBuffer;const sortKeyVals=(Xr,eo)=>Xr.key.compare(eo.key);function keyValsFromMap(Xr,eo){const to=new Set,ro=Object.entries(Xr).reduce((io,[oo,ao])=>{if(oo==="unknownKeyVals")return io;const so=eo[oo];if(so===void 0)return io;const co=(Array.isArray(ao)?ao:[ao]).map(so.encode);return co.map(uo=>uo.key.toString("hex")).forEach(uo=>{if(to.has(uo))throw new Error("Serialize Error: Duplicate key: "+uo);to.add(uo)}),io.concat(co)},[]),no=Xr.unknownKeyVals?Xr.unknownKeyVals.filter(io=>!to.has(io.key.toString("hex"))):[];return ro.concat(no).sort(sortKeyVals)}function psbtToKeyVals({globalMap:Xr,inputs:eo,outputs:to}){return{globalKeyVals:keyValsFromMap(Xr,convert$2.globals),inputKeyVals:eo.map(ro=>keyValsFromMap(ro,convert$2.inputs)),outputKeyVals:to.map(ro=>keyValsFromMap(ro,convert$2.outputs))}}toBuffer$5.psbtToKeyVals=psbtToKeyVals;(function(Xr){function eo(to){for(var ro in to)Xr.hasOwnProperty(ro)||(Xr[ro]=to[ro])}Object.defineProperty(Xr,"__esModule",{value:!0}),eo(fromBuffer),eo(toBuffer$5)})(parser);Object.defineProperty(combiner,"__esModule",{value:!0});const parser_1$1=parser;function combine(Xr){const eo=Xr[0],to=parser_1$1.psbtToKeyVals(eo),ro=Xr.slice(1);if(ro.length===0)throw new Error("Combine: Nothing to combine");const no=getTx(eo);if(no===void 0)throw new Error("Combine: Self missing transaction");const io=getKeySet(to.globalKeyVals),oo=to.inputKeyVals.map(getKeySet),ao=to.outputKeyVals.map(getKeySet);for(const so of ro){const co=getTx(so);if(co===void 0||!co.toBuffer().equals(no.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const lo=parser_1$1.psbtToKeyVals(so);getKeySet(lo.globalKeyVals).forEach(keyPusher(io,to.globalKeyVals,lo.globalKeyVals)),lo.inputKeyVals.map(getKeySet).forEach((bo,wo)=>bo.forEach(keyPusher(oo[wo],to.inputKeyVals[wo],lo.inputKeyVals[wo]))),lo.outputKeyVals.map(getKeySet).forEach((bo,wo)=>bo.forEach(keyPusher(ao[wo],to.outputKeyVals[wo],lo.outputKeyVals[wo])))}return parser_1$1.psbtFromKeyVals(no,{globalMapKeyVals:to.globalKeyVals,inputKeyVals:to.inputKeyVals,outputKeyVals:to.outputKeyVals})}combiner.combine=combine;function keyPusher(Xr,eo,to){return ro=>{if(Xr.has(ro))return;const no=to.filter(io=>io.key.toString("hex")===ro)[0];eo.push(no),Xr.add(ro)}}function getTx(Xr){return Xr.globalMap.unsignedTx}function getKeySet(Xr){const eo=new Set;return Xr.forEach(to=>{const ro=to.key.toString("hex");if(eo.has(ro))throw new Error("Combine: KeyValue Map keys should be unique");eo.add(ro)}),eo}var utils$4={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=converter;function to(go,bo){const wo=go[bo];if(wo===void 0)throw new Error(`No input #${bo}`);return wo}Xr.checkForInput=to;function ro(go,bo){const wo=go[bo];if(wo===void 0)throw new Error(`No output #${bo}`);return wo}Xr.checkForOutput=ro;function no(go,bo,wo){if(go.key[0]Eo.key.equals(go.key)).length!==0)throw new Error(`Duplicate Key: ${go.key.toString("hex")}`)}Xr.checkHasKey=no;function io(go){let bo=0;return Object.keys(go).forEach(wo=>{Number(isNaN(Number(wo)))&&bo++}),bo}Xr.getEnumLength=io;function oo(go,bo){let wo=!1;if(bo.nonWitnessUtxo||bo.witnessUtxo){const Eo=!!bo.redeemScript,$o=!!bo.witnessScript,Co=!Eo||!!bo.finalScriptSig,Ro=!$o||!!bo.finalScriptWitness,Oo=!!bo.finalScriptSig||!!bo.finalScriptWitness;wo=Co&&Ro&&Oo}if(wo===!1)throw new Error(`Input #${go} has too much or too little data to clean`)}Xr.inputCheckUncleanFinalized=oo;function ao(go,bo,wo,Eo){throw new Error(`Data for ${go} key ${bo} is incorrect: Expected ${wo} and got ${JSON.stringify(Eo)}`)}function so(go){return(bo,wo)=>{for(const Eo of Object.keys(bo)){const $o=bo[Eo],{canAdd:Co,canAddToArray:Ro,check:Oo,expected:jo}=eo[go+"s"][Eo]||{},Bo=!!Ro;if(Oo)if(Bo){if(!Array.isArray($o)||wo[Eo]&&!Array.isArray(wo[Eo]))throw new Error(`Key type ${Eo} must be an array`);$o.every(Oo)||ao(go,Eo,jo,$o);const Mo=wo[Eo]||[],Fo=new Set;if(!$o.every(Wo=>Ro(Mo,Wo,Fo)))throw new Error("Can not add duplicate data to array");wo[Eo]=Mo.concat($o)}else{if(Oo($o)||ao(go,Eo,jo,$o),!Co(wo,$o))throw new Error(`Can not add duplicate data to ${go}`);wo[Eo]=$o}}}}Xr.updateGlobal=so("global"),Xr.updateInput=so("input"),Xr.updateOutput=so("output");function co(go,bo){const wo=go.length-1,Eo=to(go,wo);Xr.updateInput(bo,Eo)}Xr.addInputAttributes=co;function lo(go,bo){const wo=go.length-1,Eo=ro(go,wo);Xr.updateOutput(bo,Eo)}Xr.addOutputAttributes=lo;function uo(go,bo){if(!Buffer$3.isBuffer(bo)||bo.length<4)throw new Error("Set Version: Invalid Transaction");return bo.writeUInt32LE(go,0),bo}Xr.defaultVersionSetter=uo;function ho(go,bo){if(!Buffer$3.isBuffer(bo)||bo.length<4)throw new Error("Set Locktime: Invalid Transaction");return bo.writeUInt32LE(go,bo.length-4),bo}Xr.defaultLocktimeSetter=ho})(utils$4);Object.defineProperty(psbt,"__esModule",{value:!0});const combiner_1=combiner,parser_1=parser,typeFields_1=typeFields,utils_1$3=utils$4;let Psbt$1=class{constructor(eo){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:eo}}static fromBase64(eo,to){const ro=Buffer$3.from(eo,"base64");return this.fromBuffer(ro,to)}static fromHex(eo,to){const ro=Buffer$3.from(eo,"hex");return this.fromBuffer(ro,to)}static fromBuffer(eo,to){const ro=parser_1.psbtFromBuffer(eo,to),no=new this(ro.globalMap.unsignedTx);return Object.assign(no,ro),no}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return parser_1.psbtToBuffer(this)}updateGlobal(eo){return utils_1$3.updateGlobal(eo,this.globalMap),this}updateInput(eo,to){const ro=utils_1$3.checkForInput(this.inputs,eo);return utils_1$3.updateInput(to,ro),this}updateOutput(eo,to){const ro=utils_1$3.checkForOutput(this.outputs,eo);return utils_1$3.updateOutput(to,ro),this}addUnknownKeyValToGlobal(eo){return utils_1$3.checkHasKey(eo,this.globalMap.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(eo),this}addUnknownKeyValToInput(eo,to){const ro=utils_1$3.checkForInput(this.inputs,eo);return utils_1$3.checkHasKey(to,ro.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.InputTypes)),ro.unknownKeyVals||(ro.unknownKeyVals=[]),ro.unknownKeyVals.push(to),this}addUnknownKeyValToOutput(eo,to){const ro=utils_1$3.checkForOutput(this.outputs,eo);return utils_1$3.checkHasKey(to,ro.unknownKeyVals,utils_1$3.getEnumLength(typeFields_1.OutputTypes)),ro.unknownKeyVals||(ro.unknownKeyVals=[]),ro.unknownKeyVals.push(to),this}addInput(eo){this.globalMap.unsignedTx.addInput(eo),this.inputs.push({unknownKeyVals:[]});const to=eo.unknownKeyVals||[],ro=this.inputs.length-1;if(!Array.isArray(to))throw new Error("unknownKeyVals must be an Array");return to.forEach(no=>this.addUnknownKeyValToInput(ro,no)),utils_1$3.addInputAttributes(this.inputs,eo),this}addOutput(eo){this.globalMap.unsignedTx.addOutput(eo),this.outputs.push({unknownKeyVals:[]});const to=eo.unknownKeyVals||[],ro=this.outputs.length-1;if(!Array.isArray(to))throw new Error("unknownKeyVals must be an Array");return to.forEach(no=>this.addUnknownKeyValToOutput(ro,no)),utils_1$3.addOutputAttributes(this.outputs,eo),this}clearFinalizedInput(eo){const to=utils_1$3.checkForInput(this.inputs,eo);utils_1$3.inputCheckUncleanFinalized(eo,to);for(const ro of Object.keys(to))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(ro)||delete to[ro];return this}combine(...eo){const to=combiner_1.combine([this].concat(eo));return Object.assign(this,to),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}};psbt.Psbt=Psbt$1;var bip371={},psbtutils={};Object.defineProperty(psbtutils,"__esModule",{value:!0});psbtutils.signatureBlocksAction=psbtutils.checkInputForSig=psbtutils.pubkeyInScript=psbtutils.pubkeyPositionInScript=psbtutils.witnessStackToScriptWitness=psbtutils.isP2TR=psbtutils.isP2SHScript=psbtutils.isP2WSHScript=psbtutils.isP2WPKH=psbtutils.isP2PKH=psbtutils.isP2PK=psbtutils.isP2MS=void 0;const varuint$1=varint,bscript$1=script$1,transaction_1$2=transaction,crypto_1=crypto$3,payments$1=payments$3;function isPaymentFactory(Xr){return eo=>{try{return Xr({output:eo}),!0}catch{return!1}}}psbtutils.isP2MS=isPaymentFactory(payments$1.p2ms);psbtutils.isP2PK=isPaymentFactory(payments$1.p2pk);psbtutils.isP2PKH=isPaymentFactory(payments$1.p2pkh);psbtutils.isP2WPKH=isPaymentFactory(payments$1.p2wpkh);psbtutils.isP2WSHScript=isPaymentFactory(payments$1.p2wsh);psbtutils.isP2SHScript=isPaymentFactory(payments$1.p2sh);psbtutils.isP2TR=isPaymentFactory(payments$1.p2tr);function witnessStackToScriptWitness(Xr){let eo=Buffer$3.allocUnsafe(0);function to(oo){eo=Buffer$3.concat([eo,Buffer$3.from(oo)])}function ro(oo){const ao=eo.length,so=varuint$1.encodingLength(oo);eo=Buffer$3.concat([eo,Buffer$3.allocUnsafe(so)]),varuint$1.encode(oo,eo,ao)}function no(oo){ro(oo.length),to(oo)}function io(oo){ro(oo.length),oo.forEach(no)}return io(Xr),eo}psbtutils.witnessStackToScriptWitness=witnessStackToScriptWitness;function pubkeyPositionInScript(Xr,eo){const to=(0,crypto_1.hash160)(Xr),ro=Xr.slice(1,33),no=bscript$1.decompile(eo);if(no===null)throw new Error("Unknown script error");return no.findIndex(io=>typeof io=="number"?!1:io.equals(Xr)||io.equals(to)||io.equals(ro))}psbtutils.pubkeyPositionInScript=pubkeyPositionInScript;function pubkeyInScript(Xr,eo){return pubkeyPositionInScript(Xr,eo)!==-1}psbtutils.pubkeyInScript=pubkeyInScript;function checkInputForSig(Xr,eo){return extractPartialSigs(Xr).some(ro=>signatureBlocksAction(ro,bscript$1.signature.decode,eo))}psbtutils.checkInputForSig=checkInputForSig;function signatureBlocksAction(Xr,eo,to){const{hashType:ro}=eo(Xr),no=[];switch(ro&transaction_1$2.Transaction.SIGHASH_ANYONECANPAY&&no.push("addInput"),ro&31){case transaction_1$2.Transaction.SIGHASH_ALL:break;case transaction_1$2.Transaction.SIGHASH_SINGLE:case transaction_1$2.Transaction.SIGHASH_NONE:no.push("addOutput"),no.push("setInputSequence");break}return no.indexOf(to)===-1}psbtutils.signatureBlocksAction=signatureBlocksAction;function extractPartialSigs(Xr){let eo=[];if((Xr.partialSig||[]).length===0){if(!Xr.finalScriptSig&&!Xr.finalScriptWitness)return[];eo=getPsigsFromInputFinalScripts(Xr)}else eo=Xr.partialSig;return eo.map(to=>to.signature)}function getPsigsFromInputFinalScripts(Xr){const eo=Xr.finalScriptSig?bscript$1.decompile(Xr.finalScriptSig)||[]:[],to=Xr.finalScriptWitness?bscript$1.decompile(Xr.finalScriptWitness)||[]:[];return eo.concat(to).filter(ro=>Buffer$3.isBuffer(ro)&&bscript$1.isCanonicalScriptSignature(ro)).map(ro=>({signature:ro}))}Object.defineProperty(bip371,"__esModule",{value:!0});bip371.checkTaprootInputForSigs=bip371.tapTreeFromList=bip371.tapTreeToList=bip371.tweakInternalPubKey=bip371.checkTaprootOutputFields=bip371.checkTaprootInputFields=bip371.isTaprootOutput=bip371.isTaprootInput=bip371.serializeTaprootSignature=bip371.tapScriptFinalizer=bip371.toXOnly=void 0;const types_1=types$7,transaction_1$1=transaction,psbtutils_1$1=psbtutils,bip341_1$1=bip341,payments_1=payments$3,psbtutils_2=psbtutils,toXOnly=Xr=>Xr.length===32?Xr:Xr.slice(1,33);bip371.toXOnly=toXOnly;function tapScriptFinalizer(Xr,eo,to){const ro=findTapLeafToFinalize(eo,Xr,to);try{const io=sortSignatures(eo,ro).concat(ro.script).concat(ro.controlBlock);return{finalScriptWitness:(0,psbtutils_1$1.witnessStackToScriptWitness)(io)}}catch(no){throw new Error(`Can not finalize taproot input #${Xr}: ${no}`)}}bip371.tapScriptFinalizer=tapScriptFinalizer;function serializeTaprootSignature(Xr,eo){const to=eo?Buffer$3.from([eo]):Buffer$3.from([]);return Buffer$3.concat([Xr,to])}bip371.serializeTaprootSignature=serializeTaprootSignature;function isTaprootInput(Xr){return Xr&&!!(Xr.tapInternalKey||Xr.tapMerkleRoot||Xr.tapLeafScript&&Xr.tapLeafScript.length||Xr.tapBip32Derivation&&Xr.tapBip32Derivation.length||Xr.witnessUtxo&&(0,psbtutils_1$1.isP2TR)(Xr.witnessUtxo.script))}bip371.isTaprootInput=isTaprootInput;function isTaprootOutput(Xr,eo){return Xr&&!!(Xr.tapInternalKey||Xr.tapTree||Xr.tapBip32Derivation&&Xr.tapBip32Derivation.length||eo&&(0,psbtutils_1$1.isP2TR)(eo))}bip371.isTaprootOutput=isTaprootOutput;function checkTaprootInputFields(Xr,eo,to){checkMixedTaprootAndNonTaprootInputFields(Xr,eo,to),checkIfTapLeafInTree(Xr,eo,to)}bip371.checkTaprootInputFields=checkTaprootInputFields;function checkTaprootOutputFields(Xr,eo,to){checkMixedTaprootAndNonTaprootOutputFields(Xr,eo,to),checkTaprootScriptPubkey(Xr,eo)}bip371.checkTaprootOutputFields=checkTaprootOutputFields;function checkTaprootScriptPubkey(Xr,eo){if(!eo.tapTree&&!eo.tapInternalKey)return;const to=eo.tapInternalKey||Xr.tapInternalKey,ro=eo.tapTree||Xr.tapTree;if(to){const{script:no}=Xr,io=getTaprootScripPubkey(to,ro);if(no&&!no.equals(io))throw new Error("Error adding output. Script or address missmatch.")}}function getTaprootScripPubkey(Xr,eo){const to=eo&&tapTreeFromList(eo.leaves),{output:ro}=(0,payments_1.p2tr)({internalPubkey:Xr,scriptTree:to});return ro}function tweakInternalPubKey(Xr,eo){const to=eo.tapInternalKey,ro=to&&(0,bip341_1$1.tweakKey)(to,eo.tapMerkleRoot);if(!ro)throw new Error(`Cannot tweak tap internal key for input #${Xr}. Public key: ${to&&to.toString("hex")}`);return ro.x}bip371.tweakInternalPubKey=tweakInternalPubKey;function tapTreeToList(Xr){if(!(0,types_1.isTaptree)(Xr))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return _tapTreeToList(Xr)}bip371.tapTreeToList=tapTreeToList;function tapTreeFromList(Xr=[]){return Xr.length===1&&Xr[0].depth===0?{output:Xr[0].script,version:Xr[0].leafVersion}:instertLeavesInTree(Xr)}bip371.tapTreeFromList=tapTreeFromList;function checkTaprootInputForSigs(Xr,eo){return extractTaprootSigs(Xr).some(ro=>(0,psbtutils_2.signatureBlocksAction)(ro,decodeSchnorrSignature,eo))}bip371.checkTaprootInputForSigs=checkTaprootInputForSigs;function decodeSchnorrSignature(Xr){return{signature:Xr.slice(0,64),hashType:Xr.slice(64)[0]||transaction_1$1.Transaction.SIGHASH_DEFAULT}}function extractTaprootSigs(Xr){const eo=[];if(Xr.tapKeySig&&eo.push(Xr.tapKeySig),Xr.tapScriptSig&&eo.push(...Xr.tapScriptSig.map(to=>to.signature)),!eo.length){const to=getTapKeySigFromWithness(Xr.finalScriptWitness);to&&eo.push(to)}return eo}function getTapKeySigFromWithness(Xr){if(!Xr)return;const eo=Xr.slice(2);if(eo.length===64||eo.length===65)return eo}function _tapTreeToList(Xr,eo=[],to=0){if(to>bip341_1$1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return Xr?(0,types_1.isTapleaf)(Xr)?(eo.push({depth:to,leafVersion:Xr.version||bip341_1$1.LEAF_VERSION_TAPSCRIPT,script:Xr.output}),eo):(Xr[0]&&_tapTreeToList(Xr[0],eo,to+1),Xr[1]&&_tapTreeToList(Xr[1],eo,to+1),eo):[]}function instertLeavesInTree(Xr){let eo;for(const to of Xr)if(eo=instertLeafInTree(to,eo),!eo)throw new Error("No room left to insert tapleaf in tree");return eo}function instertLeafInTree(Xr,eo,to=0){if(to>bip341_1$1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(Xr.depth===to)return eo?void 0:{output:Xr.script,version:Xr.leafVersion};if((0,types_1.isTapleaf)(eo))return;const ro=instertLeafInTree(Xr,eo&&eo[0],to+1);if(ro)return[ro,eo&&eo[1]];const no=instertLeafInTree(Xr,eo&&eo[1],to+1);if(no)return[eo&&eo[0],no]}function checkMixedTaprootAndNonTaprootInputFields(Xr,eo,to){const ro=isTaprootInput(Xr)&&hasNonTaprootFields(eo),no=hasNonTaprootFields(Xr)&&isTaprootInput(eo),io=Xr===eo&&isTaprootInput(eo)&&hasNonTaprootFields(eo);if(ro||no||io)throw new Error(`Invalid arguments for Psbt.${to}. Cannot use both taproot and non-taproot fields.`)}function checkMixedTaprootAndNonTaprootOutputFields(Xr,eo,to){const ro=isTaprootOutput(Xr)&&hasNonTaprootFields(eo),no=hasNonTaprootFields(Xr)&&isTaprootOutput(eo),io=Xr===eo&&isTaprootOutput(eo)&&hasNonTaprootFields(eo);if(ro||no||io)throw new Error(`Invalid arguments for Psbt.${to}. Cannot use both taproot and non-taproot fields.`)}function checkIfTapLeafInTree(Xr,eo,to){if(eo.tapMerkleRoot){const ro=(eo.tapLeafScript||[]).every(io=>isTapLeafInTree(io,eo.tapMerkleRoot)),no=(Xr.tapLeafScript||[]).every(io=>isTapLeafInTree(io,eo.tapMerkleRoot));if(!ro||!no)throw new Error(`Invalid arguments for Psbt.${to}. Tapleaf not part of taptree.`)}else if(Xr.tapMerkleRoot&&!(eo.tapLeafScript||[]).every(no=>isTapLeafInTree(no,Xr.tapMerkleRoot)))throw new Error(`Invalid arguments for Psbt.${to}. Tapleaf not part of taptree.`)}function isTapLeafInTree(Xr,eo){if(!eo)return!0;const to=(0,bip341_1$1.tapleafHash)({output:Xr.script,version:Xr.leafVersion});return(0,bip341_1$1.rootHashFromPath)(Xr.controlBlock,to).equals(eo)}function sortSignatures(Xr,eo){const to=(0,bip341_1$1.tapleafHash)({output:eo.script,version:eo.leafVersion});return(Xr.tapScriptSig||[]).filter(ro=>ro.leafHash.equals(to)).map(ro=>addPubkeyPositionInScript(eo.script,ro)).sort((ro,no)=>no.positionInScript-ro.positionInScript).map(ro=>ro.signature)}function addPubkeyPositionInScript(Xr,eo){return Object.assign({positionInScript:(0,psbtutils_1$1.pubkeyPositionInScript)(eo.pubkey,Xr)},eo)}function findTapLeafToFinalize(Xr,eo,to){if(!Xr.tapScriptSig||!Xr.tapScriptSig.length)throw new Error(`Can not finalize taproot input #${eo}. No tapleaf script signature provided.`);const ro=(Xr.tapLeafScript||[]).sort((no,io)=>no.controlBlock.length-io.controlBlock.length).find(no=>canFinalizeLeaf(no,Xr.tapScriptSig,to));if(!ro)throw new Error(`Can not finalize taproot input #${eo}. Signature for tapleaf script not found.`);return ro}function canFinalizeLeaf(Xr,eo,to){const ro=(0,bip341_1$1.tapleafHash)({output:Xr.script,version:Xr.leafVersion});return(!to||to.equals(ro))&&eo.find(io=>io.leafHash.equals(ro))!==void 0}function hasNonTaprootFields(Xr){return Xr&&!!(Xr.redeemScript||Xr.witnessScript||Xr.bip32Derivation&&Xr.bip32Derivation.length)}Object.defineProperty(psbt$1,"__esModule",{value:!0});psbt$1.Psbt=void 0;const bip174_1=psbt,varuint=varint,utils_1$2=utils$4,address_1=address,bufferutils_1=bufferutils,networks_1=networks$1,payments=payments$3,bip341_1=bip341,bscript=script$1,transaction_1=transaction,bip371_1=bip371,psbtutils_1=psbtutils,DEFAULT_OPTS={network:networks_1.bitcoin,maximumFeeRate:5e3};class Psbt{static fromBase64(eo,to={}){const ro=Buffer$3.from(eo,"base64");return this.fromBuffer(ro,to)}static fromHex(eo,to={}){const ro=Buffer$3.from(eo,"hex");return this.fromBuffer(ro,to)}static fromBuffer(eo,to={}){const ro=bip174_1.Psbt.fromBuffer(eo,transactionFromBuffer),no=new Psbt(to,ro);return checkTxForDupeIns(no.__CACHE.__TX,no.__CACHE),no}constructor(eo={},to=new bip174_1.Psbt(new PsbtTransaction)){this.data=to,this.opts=Object.assign({},DEFAULT_OPTS,eo),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},this.data.inputs.length===0&&this.setVersion(2);const ro=(no,io,oo,ao)=>Object.defineProperty(no,io,{enumerable:oo,writable:ao});ro(this,"__CACHE",!1,!0),ro(this,"opts",!1,!0)}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(eo){this.setVersion(eo)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(eo){this.setLocktime(eo)}get txInputs(){return this.__CACHE.__TX.ins.map(eo=>({hash:(0,bufferutils_1.cloneBuffer)(eo.hash),index:eo.index,sequence:eo.sequence}))}get txOutputs(){return this.__CACHE.__TX.outs.map(eo=>{let to;try{to=(0,address_1.fromOutputScript)(eo.script,this.opts.network)}catch{}return{script:(0,bufferutils_1.cloneBuffer)(eo.script),value:eo.value,address:to}})}combine(...eo){return this.data.combine(...eo.map(to=>to.data)),this}clone(){const eo=Psbt.fromBuffer(this.data.toBuffer());return eo.opts=JSON.parse(JSON.stringify(this.opts)),eo}setMaximumFeeRate(eo){check32Bit(eo),this.opts.maximumFeeRate=eo}setVersion(eo){check32Bit(eo),checkInputsForPartialSig(this.data.inputs,"setVersion");const to=this.__CACHE;return to.__TX.version=eo,to.__EXTRACTED_TX=void 0,this}setLocktime(eo){check32Bit(eo),checkInputsForPartialSig(this.data.inputs,"setLocktime");const to=this.__CACHE;return to.__TX.locktime=eo,to.__EXTRACTED_TX=void 0,this}setInputSequence(eo,to){check32Bit(to),checkInputsForPartialSig(this.data.inputs,"setInputSequence");const ro=this.__CACHE;if(ro.__TX.ins.length<=eo)throw new Error("Input index too high");return ro.__TX.ins[eo].sequence=to,ro.__EXTRACTED_TX=void 0,this}addInputs(eo){return eo.forEach(to=>this.addInput(to)),this}addInput(eo){if(arguments.length>1||!eo||eo.hash===void 0||eo.index===void 0)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");(0,bip371_1.checkTaprootInputFields)(eo,eo,"addInput"),checkInputsForPartialSig(this.data.inputs,"addInput"),eo.witnessScript&&checkInvalidP2WSH(eo.witnessScript);const to=this.__CACHE;this.data.addInput(eo);const ro=to.__TX.ins[to.__TX.ins.length-1];checkTxInputCache(to,ro);const no=this.data.inputs.length-1,io=this.data.inputs[no];return io.nonWitnessUtxo&&addNonWitnessTxCache(this.__CACHE,io,no),to.__FEE=void 0,to.__FEE_RATE=void 0,to.__EXTRACTED_TX=void 0,this}addOutputs(eo){return eo.forEach(to=>this.addOutput(to)),this}addOutput(eo){if(arguments.length>1||!eo||eo.value===void 0||eo.address===void 0&&eo.script===void 0)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");checkInputsForPartialSig(this.data.inputs,"addOutput");const{address:to}=eo;if(typeof to=="string"){const{network:no}=this.opts,io=(0,address_1.toOutputScript)(to,no);eo=Object.assign(eo,{script:io})}(0,bip371_1.checkTaprootOutputFields)(eo,eo,"addOutput");const ro=this.__CACHE;return this.data.addOutput(eo),ro.__FEE=void 0,ro.__FEE_RATE=void 0,ro.__EXTRACTED_TX=void 0,this}extractTransaction(eo){if(!this.data.inputs.every(isFinalized))throw new Error("Not finalized");const to=this.__CACHE;if(eo||checkFees(this,to,this.opts),to.__EXTRACTED_TX)return to.__EXTRACTED_TX;const ro=to.__TX.clone();return inputFinalizeGetAmts(this.data.inputs,ro,to,!0),ro}getFeeRate(){return getTxCacheValue("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return getTxCacheValue("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,utils_1$2.checkForInput)(this.data.inputs,0),range$1(this.data.inputs.length).forEach(eo=>this.finalizeInput(eo)),this}finalizeInput(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(ro)?this._finalizeTaprootInput(eo,ro,void 0,to):this._finalizeInput(eo,ro,to)}finalizeTaprootInput(eo,to,ro=bip371_1.tapScriptFinalizer){const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(no))return this._finalizeTaprootInput(eo,no,to,ro);throw new Error(`Cannot finalize input #${eo}. Not Taproot.`)}_finalizeInput(eo,to,ro=getFinalScripts){const{script:no,isP2SH:io,isP2WSH:oo,isSegwit:ao}=getScriptFromInput(eo,to,this.__CACHE);if(!no)throw new Error(`No script found for input #${eo}`);checkPartialSigSighashes(to);const{finalScriptSig:so,finalScriptWitness:co}=ro(eo,to,no,ao,io,oo);if(so&&this.data.updateInput(eo,{finalScriptSig:so}),co&&this.data.updateInput(eo,{finalScriptWitness:co}),!so&&!co)throw new Error(`Unknown error finalizing input #${eo}`);return this.data.clearFinalizedInput(eo),this}_finalizeTaprootInput(eo,to,ro,no=bip371_1.tapScriptFinalizer){if(!to.witnessUtxo)throw new Error(`Cannot finalize input #${eo}. Missing withness utxo.`);if(to.tapKeySig){const io=payments.p2tr({output:to.witnessUtxo.script,signature:to.tapKeySig}),oo=(0,psbtutils_1.witnessStackToScriptWitness)(io.witness);this.data.updateInput(eo,{finalScriptWitness:oo})}else{const{finalScriptWitness:io}=no(eo,to,ro);this.data.updateInput(eo,{finalScriptWitness:io})}return this.data.clearFinalizedInput(eo),this}getInputType(eo){const to=(0,utils_1$2.checkForInput)(this.data.inputs,eo),ro=getScriptFromUtxo(eo,to,this.__CACHE),no=getMeaningfulScript(ro,eo,"input",to.redeemScript||redeemFromFinalScriptSig(to.finalScriptSig),to.witnessScript||redeemFromFinalWitnessScript(to.finalScriptWitness)),io=no.type==="raw"?"":no.type+"-",oo=classifyScript(no.meaningfulScript);return io+oo}inputHasPubkey(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return pubkeyInInput(to,ro,eo,this.__CACHE)}inputHasHDKey(eo,to){const ro=(0,utils_1$2.checkForInput)(this.data.inputs,eo),no=bip32DerivationIsMine(to);return!!ro.bip32Derivation&&ro.bip32Derivation.some(no)}outputHasPubkey(eo,to){const ro=(0,utils_1$2.checkForOutput)(this.data.outputs,eo);return pubkeyInOutput(to,ro,eo,this.__CACHE)}outputHasHDKey(eo,to){const ro=(0,utils_1$2.checkForOutput)(this.data.outputs,eo),no=bip32DerivationIsMine(to);return!!ro.bip32Derivation&&ro.bip32Derivation.some(no)}validateSignaturesOfAllInputs(eo){return(0,utils_1$2.checkForInput)(this.data.inputs,0),range$1(this.data.inputs.length).map(ro=>this.validateSignaturesOfInput(ro,eo)).reduce((ro,no)=>no===!0&&ro,!0)}validateSignaturesOfInput(eo,to,ro){const no=this.data.inputs[eo];return(0,bip371_1.isTaprootInput)(no)?this.validateSignaturesOfTaprootInput(eo,to,ro):this._validateSignaturesOfInput(eo,to,ro)}_validateSignaturesOfInput(eo,to,ro){const no=this.data.inputs[eo],io=(no||{}).partialSig;if(!no||!io||io.length<1)throw new Error("No signatures to validate");if(typeof to!="function")throw new Error("Need validator function to validate signatures");const oo=ro?io.filter(uo=>uo.pubkey.equals(ro)):io;if(oo.length<1)throw new Error("No signatures for this pubkey");const ao=[];let so,co,lo;for(const uo of oo){const ho=bscript.signature.decode(uo.signature),{hash:go,script:bo}=lo!==ho.hashType?getHashForSig(eo,Object.assign({},no,{sighashType:ho.hashType}),this.__CACHE,!0):{hash:so,script:co};lo=ho.hashType,so=go,co=bo,checkScriptForPubkey(uo.pubkey,bo,"verify"),ao.push(to(uo.pubkey,go,ho.signature))}return ao.every(uo=>uo===!0)}validateSignaturesOfTaprootInput(eo,to,ro){const no=this.data.inputs[eo],io=(no||{}).tapKeySig,oo=(no||{}).tapScriptSig;if(!no&&!io&&!(oo&&!oo.length))throw new Error("No signatures to validate");if(typeof to!="function")throw new Error("Need validator function to validate signatures");ro=ro&&(0,bip371_1.toXOnly)(ro);const ao=ro?getTaprootHashesForSig(eo,no,this.data.inputs,ro,this.__CACHE):getAllTaprootHashesForSig(eo,no,this.data.inputs,this.__CACHE);if(!ao.length)throw new Error("No signatures for this pubkey");const so=ao.find(lo=>!lo.leafHash);let co=0;if(io&&so){if(!to(so.pubkey,so.hash,trimTaprootSig(io)))return!1;co++}if(oo)for(const lo of oo){const uo=ao.find(ho=>lo.pubkey.equals(ho.pubkey));if(uo){if(!to(lo.pubkey,uo.hash,trimTaprootSig(lo.signature)))return!1;co++}}return co>0}signAllInputsHD(eo,to=[transaction_1.Transaction.SIGHASH_ALL]){if(!eo||!eo.publicKey||!eo.fingerprint)throw new Error("Need HDSigner to sign input");const ro=[];for(const no of range$1(this.data.inputs.length))try{this.signInputHD(no,eo,to),ro.push(!0)}catch{ro.push(!1)}if(ro.every(no=>no===!1))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(eo,to=[transaction_1.Transaction.SIGHASH_ALL]){return new Promise((ro,no)=>{if(!eo||!eo.publicKey||!eo.fingerprint)return no(new Error("Need HDSigner to sign input"));const io=[],oo=[];for(const ao of range$1(this.data.inputs.length))oo.push(this.signInputHDAsync(ao,eo,to).then(()=>{io.push(!0)},()=>{io.push(!1)}));return Promise.all(oo).then(()=>{if(io.every(ao=>ao===!1))return no(new Error("No inputs were signed"));ro()})})}signInputHD(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){if(!to||!to.publicKey||!to.fingerprint)throw new Error("Need HDSigner to sign input");return getSignersFromHD(eo,this.data.inputs,to).forEach(io=>this.signInput(eo,io,ro)),this}signInputHDAsync(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){return new Promise((no,io)=>{if(!to||!to.publicKey||!to.fingerprint)return io(new Error("Need HDSigner to sign input"));const ao=getSignersFromHD(eo,this.data.inputs,to).map(so=>this.signInputAsync(eo,so,ro));return Promise.all(ao).then(()=>{no()}).catch(io)})}signAllInputs(eo,to){if(!eo||!eo.publicKey)throw new Error("Need Signer to sign input");const ro=[];for(const no of range$1(this.data.inputs.length))try{this.signInput(no,eo,to),ro.push(!0)}catch{ro.push(!1)}if(ro.every(no=>no===!1))throw new Error("No inputs were signed");return this}signAllInputsAsync(eo,to){return new Promise((ro,no)=>{if(!eo||!eo.publicKey)return no(new Error("Need Signer to sign input"));const io=[],oo=[];for(const[ao]of this.data.inputs.entries())oo.push(this.signInputAsync(ao,eo,to).then(()=>{io.push(!0)},()=>{io.push(!1)}));return Promise.all(oo).then(()=>{if(io.every(ao=>ao===!1))return no(new Error("No inputs were signed"));ro()})})}signInput(eo,to,ro){if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(no)?this._signTaprootInput(eo,no,to,void 0,ro):this._signInput(eo,to,ro)}signTaprootInput(eo,to,ro,no){if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const io=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(io))return this._signTaprootInput(eo,io,to,ro,no);throw new Error(`Input #${eo} is not of type Taproot.`)}_signInput(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){const{hash:no,sighashType:io}=getHashAndSighashType(this.data.inputs,eo,to.publicKey,this.__CACHE,ro),oo=[{pubkey:to.publicKey,signature:bscript.signature.encode(to.sign(no),io)}];return this.data.updateInput(eo,{partialSig:oo}),this}_signTaprootInput(eo,to,ro,no,io=[transaction_1.Transaction.SIGHASH_DEFAULT]){const oo=this.checkTaprootHashesForSig(eo,to,ro,no,io),ao=oo.filter(co=>!co.leafHash).map(co=>(0,bip371_1.serializeTaprootSignature)(ro.signSchnorr(co.hash),to.sighashType))[0],so=oo.filter(co=>!!co.leafHash).map(co=>({pubkey:(0,bip371_1.toXOnly)(ro.publicKey),signature:(0,bip371_1.serializeTaprootSignature)(ro.signSchnorr(co.hash),to.sighashType),leafHash:co.leafHash}));return ao&&this.data.updateInput(eo,{tapKeySig:ao}),so.length&&this.data.updateInput(eo,{tapScriptSig:so}),this}signInputAsync(eo,to,ro){return Promise.resolve().then(()=>{if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const no=(0,utils_1$2.checkForInput)(this.data.inputs,eo);return(0,bip371_1.isTaprootInput)(no)?this._signTaprootInputAsync(eo,no,to,void 0,ro):this._signInputAsync(eo,to,ro)})}signTaprootInputAsync(eo,to,ro,no){return Promise.resolve().then(()=>{if(!to||!to.publicKey)throw new Error("Need Signer to sign input");const io=(0,utils_1$2.checkForInput)(this.data.inputs,eo);if((0,bip371_1.isTaprootInput)(io))return this._signTaprootInputAsync(eo,io,to,ro,no);throw new Error(`Input #${eo} is not of type Taproot.`)})}_signInputAsync(eo,to,ro=[transaction_1.Transaction.SIGHASH_ALL]){const{hash:no,sighashType:io}=getHashAndSighashType(this.data.inputs,eo,to.publicKey,this.__CACHE,ro);return Promise.resolve(to.sign(no)).then(oo=>{const ao=[{pubkey:to.publicKey,signature:bscript.signature.encode(oo,io)}];this.data.updateInput(eo,{partialSig:ao})})}async _signTaprootInputAsync(eo,to,ro,no,io=[transaction_1.Transaction.SIGHASH_DEFAULT]){const oo=this.checkTaprootHashesForSig(eo,to,ro,no,io),ao=[],so=oo.filter(lo=>!lo.leafHash)[0];if(so){const lo=Promise.resolve(ro.signSchnorr(so.hash)).then(uo=>({tapKeySig:(0,bip371_1.serializeTaprootSignature)(uo,to.sighashType)}));ao.push(lo)}const co=oo.filter(lo=>!!lo.leafHash);if(co.length){const lo=co.map(uo=>Promise.resolve(ro.signSchnorr(uo.hash)).then(ho=>({tapScriptSig:[{pubkey:(0,bip371_1.toXOnly)(ro.publicKey),signature:(0,bip371_1.serializeTaprootSignature)(ho,to.sighashType),leafHash:uo.leafHash}]})));ao.push(...lo)}return Promise.all(ao).then(lo=>{lo.forEach(uo=>this.data.updateInput(eo,uo))})}checkTaprootHashesForSig(eo,to,ro,no,io){if(typeof ro.signSchnorr!="function")throw new Error(`Need Schnorr Signer to sign taproot input #${eo}.`);const oo=getTaprootHashesForSig(eo,to,this.data.inputs,ro.publicKey,this.__CACHE,no,io);if(!oo||!oo.length)throw new Error(`Can not sign for input #${eo} with the key ${ro.publicKey.toString("hex")}`);return oo}toBuffer(){return checkCache(this.__CACHE),this.data.toBuffer()}toHex(){return checkCache(this.__CACHE),this.data.toHex()}toBase64(){return checkCache(this.__CACHE),this.data.toBase64()}updateGlobal(eo){return this.data.updateGlobal(eo),this}updateInput(eo,to){return to.witnessScript&&checkInvalidP2WSH(to.witnessScript),(0,bip371_1.checkTaprootInputFields)(this.data.inputs[eo],to,"updateInput"),this.data.updateInput(eo,to),to.nonWitnessUtxo&&addNonWitnessTxCache(this.__CACHE,this.data.inputs[eo],eo),this}updateOutput(eo,to){const ro=this.data.outputs[eo];return(0,bip371_1.checkTaprootOutputFields)(ro,to,"updateOutput"),this.data.updateOutput(eo,to),this}addUnknownKeyValToGlobal(eo){return this.data.addUnknownKeyValToGlobal(eo),this}addUnknownKeyValToInput(eo,to){return this.data.addUnknownKeyValToInput(eo,to),this}addUnknownKeyValToOutput(eo,to){return this.data.addUnknownKeyValToOutput(eo,to),this}clearFinalizedInput(eo){return this.data.clearFinalizedInput(eo),this}}psbt$1.Psbt=Psbt;const transactionFromBuffer=Xr=>new PsbtTransaction(Xr);class PsbtTransaction{constructor(eo=Buffer$3.from([2,0,0,0,0,0,0,0,0,0])){this.tx=transaction_1.Transaction.fromBuffer(eo),checkTxEmpty(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(eo){if(eo.hash===void 0||eo.index===void 0||!Buffer$3.isBuffer(eo.hash)&&typeof eo.hash!="string"||typeof eo.index!="number")throw new Error("Error adding input.");const to=typeof eo.hash=="string"?(0,bufferutils_1.reverseBuffer)(Buffer$3.from(eo.hash,"hex")):eo.hash;this.tx.addInput(to,eo.index,eo.sequence)}addOutput(eo){if(eo.script===void 0||eo.value===void 0||!Buffer$3.isBuffer(eo.script)||typeof eo.value!="number")throw new Error("Error adding output.");this.tx.addOutput(eo.script,eo.value)}toBuffer(){return this.tx.toBuffer()}}function canFinalize(Xr,eo,to){switch(to){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return hasSigs(1,Xr.partialSig);case"multisig":const ro=payments.p2ms({output:eo});return hasSigs(ro.m,Xr.partialSig,ro.pubkeys);default:return!1}}function checkCache(Xr){if(Xr.__UNSAFE_SIGN_NONSEGWIT!==!1)throw new Error("Not BIP174 compliant, can not export")}function hasSigs(Xr,eo,to){if(!eo)return!1;let ro;if(to?ro=to.map(no=>{const io=compressPubkey(no);return eo.find(oo=>oo.pubkey.equals(io))}).filter(no=>!!no):ro=eo,ro.length>Xr)throw new Error("Too many signatures");return ro.length===Xr}function isFinalized(Xr){return!!Xr.finalScriptSig||!!Xr.finalScriptWitness}function bip32DerivationIsMine(Xr){return eo=>!(!eo.masterFingerprint.equals(Xr.fingerprint)||!Xr.derivePath(eo.path).publicKey.equals(eo.pubkey))}function check32Bit(Xr){if(typeof Xr!="number"||Xr!==Math.floor(Xr)||Xr>4294967295||Xr<0)throw new Error("Invalid 32 bit integer")}function checkFees(Xr,eo,to){const ro=eo.__FEE_RATE||Xr.getFeeRate(),no=eo.__EXTRACTED_TX.virtualSize(),io=ro*no;if(ro>=to.maximumFeeRate)throw new Error(`Warning: You are paying around ${(io/1e8).toFixed(8)} in fees, which is ${ro} satoshi per byte for a transaction with a VSize of ${no} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}function checkInputsForPartialSig(Xr,eo){Xr.forEach(to=>{if((0,bip371_1.isTaprootInput)(to)?(0,bip371_1.checkTaprootInputForSigs)(to,eo):(0,psbtutils_1.checkInputForSig)(to,eo))throw new Error("Can not modify transaction, signatures exist.")})}function checkPartialSigSighashes(Xr){if(!Xr.sighashType||!Xr.partialSig)return;const{partialSig:eo,sighashType:to}=Xr;eo.forEach(ro=>{const{hashType:no}=bscript.signature.decode(ro.signature);if(to!==no)throw new Error("Signature sighash does not match input sighash type")})}function checkScriptForPubkey(Xr,eo,to){if(!(0,psbtutils_1.pubkeyInScript)(Xr,eo))throw new Error(`Can not ${to} for this input with the key ${Xr.toString("hex")}`)}function checkTxEmpty(Xr){if(!Xr.ins.every(to=>to.script&&to.script.length===0&&to.witness&&to.witness.length===0))throw new Error("Format Error: Transaction ScriptSigs are not empty")}function checkTxForDupeIns(Xr,eo){Xr.ins.forEach(to=>{checkTxInputCache(eo,to)})}function checkTxInputCache(Xr,eo){const to=(0,bufferutils_1.reverseBuffer)(Buffer$3.from(eo.hash)).toString("hex")+":"+eo.index;if(Xr.__TX_IN_CACHE[to])throw new Error("Duplicate input detected.");Xr.__TX_IN_CACHE[to]=1}function scriptCheckerFactory(Xr,eo){return(to,ro,no,io)=>{const oo=Xr({redeem:{output:no}}).output;if(!ro.equals(oo))throw new Error(`${eo} for ${io} #${to} doesn't match the scriptPubKey in the prevout`)}}const checkRedeemScript=scriptCheckerFactory(payments.p2sh,"Redeem script"),checkWitnessScript=scriptCheckerFactory(payments.p2wsh,"Witness script");function getTxCacheValue(Xr,eo,to,ro){if(!to.every(isFinalized))throw new Error(`PSBT must be finalized to calculate ${eo}`);if(Xr==="__FEE_RATE"&&ro.__FEE_RATE)return ro.__FEE_RATE;if(Xr==="__FEE"&&ro.__FEE)return ro.__FEE;let no,io=!0;if(ro.__EXTRACTED_TX?(no=ro.__EXTRACTED_TX,io=!1):no=ro.__TX.clone(),inputFinalizeGetAmts(to,no,ro,io),Xr==="__FEE_RATE")return ro.__FEE_RATE;if(Xr==="__FEE")return ro.__FEE}function getFinalScripts(Xr,eo,to,ro,no,io){const oo=classifyScript(to);if(!canFinalize(eo,to,oo))throw new Error(`Can not finalize input #${Xr}`);return prepareFinalScripts(to,oo,eo.partialSig,ro,no,io)}function prepareFinalScripts(Xr,eo,to,ro,no,io){let oo,ao;const so=getPayment(Xr,eo,to),co=io?payments.p2wsh({redeem:so}):null,lo=no?payments.p2sh({redeem:co||so}):null;return ro?(co?ao=(0,psbtutils_1.witnessStackToScriptWitness)(co.witness):ao=(0,psbtutils_1.witnessStackToScriptWitness)(so.witness),lo&&(oo=lo.input)):lo?oo=lo.input:oo=so.input,{finalScriptSig:oo,finalScriptWitness:ao}}function getHashAndSighashType(Xr,eo,to,ro,no){const io=(0,utils_1$2.checkForInput)(Xr,eo),{hash:oo,sighashType:ao,script:so}=getHashForSig(eo,io,ro,!1,no);return checkScriptForPubkey(to,so,"sign"),{hash:oo,sighashType:ao}}function getHashForSig(Xr,eo,to,ro,no){const io=to.__TX,oo=eo.sighashType||transaction_1.Transaction.SIGHASH_ALL;checkSighashTypeAllowed(oo,no);let ao,so;if(eo.nonWitnessUtxo){const uo=nonWitnessUtxoTxFromCache(to,eo,Xr),ho=io.ins[Xr].hash,go=uo.getHash();if(!ho.equals(go))throw new Error(`Non-witness UTXO hash for input #${Xr} doesn't match the hash specified in the prevout`);const bo=io.ins[Xr].index;so=uo.outs[bo]}else if(eo.witnessUtxo)so=eo.witnessUtxo;else throw new Error("Need a Utxo input item for signing");const{meaningfulScript:co,type:lo}=getMeaningfulScript(so.script,Xr,"input",eo.redeemScript,eo.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(lo)>=0)ao=io.hashForWitnessV0(Xr,co,so.value,oo);else if((0,psbtutils_1.isP2WPKH)(co)){const uo=payments.p2pkh({hash:co.slice(2)}).output;ao=io.hashForWitnessV0(Xr,uo,so.value,oo)}else{if(eo.nonWitnessUtxo===void 0&&to.__UNSAFE_SIGN_NONSEGWIT===!1)throw new Error(`Input #${Xr} has witnessUtxo but non-segwit script: ${co.toString("hex")}`);!ro&&to.__UNSAFE_SIGN_NONSEGWIT!==!1&&console.warn(`Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant. ********************* PROCEED WITH CAUTION! -*********************`),ao=io.hashForSignature(Xr,co,oo)}return{script:co,sighashType:oo,hash:ao}}function getAllTaprootHashesForSig(Xr,eo,to,ro){const no=[];if(eo.tapInternalKey){const oo=getPrevoutTaprootKey(Xr,eo,ro);oo&&no.push(oo)}if(eo.tapScriptSig){const oo=eo.tapScriptSig.map(ao=>ao.pubkey);no.push(...oo)}return no.map(oo=>getTaprootHashesForSig(Xr,eo,to,oo,ro)).flat()}function getPrevoutTaprootKey(Xr,eo,to){const{script:ro}=getScriptAndAmountFromUtxo(Xr,eo,to);return(0,psbtutils_1.isP2TR)(ro)?ro.subarray(2,34):null}function trimTaprootSig(Xr){return Xr.length===64?Xr:Xr.subarray(0,64)}function getTaprootHashesForSig(Xr,eo,to,ro,no,io,oo){const ao=no.__TX,so=eo.sighashType||transaction_1.Transaction.SIGHASH_DEFAULT;checkSighashTypeAllowed(so,oo);const co=to.map((yo,vo)=>getScriptAndAmountFromUtxo(vo,yo,no)),lo=co.map(yo=>yo.script),fo=co.map(yo=>yo.value),ho=[];if(eo.tapInternalKey&&!io){const yo=getPrevoutTaprootKey(Xr,eo,no)||Buffer$3.from([]);if((0,bip371_1.toXOnly)(ro).equals(yo)){const vo=ao.hashForWitnessV1(Xr,lo,fo,so);ho.push({pubkey:ro,hash:vo})}}const go=(eo.tapLeafScript||[]).filter(yo=>(0,psbtutils_1.pubkeyInScript)(ro,yo.script)).map(yo=>{const vo=(0,bip341_1.tapleafHash)({output:yo.script,version:yo.leafVersion});return Object.assign({hash:vo},yo)}).filter(yo=>!io||io.equals(yo.hash)).map(yo=>{const vo=ao.hashForWitnessV1(Xr,lo,fo,transaction_1.Transaction.SIGHASH_DEFAULT,yo.hash);return{pubkey:ro,hash:vo,leafHash:yo.hash}});return ho.concat(go)}function checkSighashTypeAllowed(Xr,eo){if(eo&&eo.indexOf(Xr)<0){const to=sighashTypeToString(Xr);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${to}`)}}function getPayment(Xr,eo,to){let ro;switch(eo){case"multisig":const no=getSortedSigs(Xr,to);ro=payments.p2ms({output:Xr,signatures:no});break;case"pubkey":ro=payments.p2pk({output:Xr,signature:to[0].signature});break;case"pubkeyhash":ro=payments.p2pkh({output:Xr,pubkey:to[0].pubkey,signature:to[0].signature});break;case"witnesspubkeyhash":ro=payments.p2wpkh({output:Xr,pubkey:to[0].pubkey,signature:to[0].signature});break}return ro}function getScriptFromInput(Xr,eo,to){const ro=to.__TX,no={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(no.isP2SH=!!eo.redeemScript,no.isP2WSH=!!eo.witnessScript,eo.witnessScript)no.script=eo.witnessScript;else if(eo.redeemScript)no.script=eo.redeemScript;else if(eo.nonWitnessUtxo){const io=nonWitnessUtxoTxFromCache(to,eo,Xr),oo=ro.ins[Xr].index;no.script=io.outs[oo].script}else eo.witnessUtxo&&(no.script=eo.witnessUtxo.script);return(eo.witnessScript||(0,psbtutils_1.isP2WPKH)(no.script))&&(no.isSegwit=!0),no}function getSignersFromHD(Xr,eo,to){const ro=(0,utils_1$2.checkForInput)(eo,Xr);if(!ro.bip32Derivation||ro.bip32Derivation.length===0)throw new Error("Need bip32Derivation to sign with HD");const no=ro.bip32Derivation.map(oo=>{if(oo.masterFingerprint.equals(to.fingerprint))return oo}).filter(oo=>!!oo);if(no.length===0)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return no.map(oo=>{const ao=to.derivePath(oo.path);if(!oo.pubkey.equals(ao.publicKey))throw new Error("pubkey did not match bip32Derivation");return ao})}function getSortedSigs(Xr,eo){return payments.p2ms({output:Xr}).pubkeys.map(ro=>(eo.filter(no=>no.pubkey.equals(ro))[0]||{}).signature).filter(ro=>!!ro)}function scriptWitnessToWitnessStack(Xr){let eo=0;function to(oo){return eo+=oo,Xr.slice(eo-oo,eo)}function ro(){const oo=varuint.decode(Xr,eo);return eo+=varuint.decode.bytes,oo}function no(){return to(ro())}function io(){const oo=ro(),ao=[];for(let so=0;so{if(ro&&so.finalScriptSig&&(eo.ins[co].script=so.finalScriptSig),ro&&so.finalScriptWitness&&(eo.ins[co].witness=scriptWitnessToWitnessStack(so.finalScriptWitness)),so.witnessUtxo)no+=so.witnessUtxo.value;else if(so.nonWitnessUtxo){const lo=nonWitnessUtxoTxFromCache(to,so,co),fo=eo.ins[co].index,ho=lo.outs[fo];no+=ho.value}});const io=eo.outs.reduce((so,co)=>so+co.value,0),oo=no-io;if(oo<0)throw new Error("Outputs are spending more than Inputs");const ao=eo.virtualSize();to.__FEE=oo,to.__EXTRACTED_TX=eo,to.__FEE_RATE=Math.floor(oo/ao)}function nonWitnessUtxoTxFromCache(Xr,eo,to){const ro=Xr.__NON_WITNESS_UTXO_TX_CACHE;return ro[to]||addNonWitnessTxCache(Xr,eo,to),ro[to]}function getScriptFromUtxo(Xr,eo,to){const{script:ro}=getScriptAndAmountFromUtxo(Xr,eo,to);return ro}function getScriptAndAmountFromUtxo(Xr,eo,to){if(eo.witnessUtxo!==void 0)return{script:eo.witnessUtxo.script,value:eo.witnessUtxo.value};if(eo.nonWitnessUtxo!==void 0){const no=nonWitnessUtxoTxFromCache(to,eo,Xr).outs[to.__TX.ins[Xr].index];return{script:no.script,value:no.value}}else throw new Error("Can't find pubkey in input without Utxo data")}function pubkeyInInput(Xr,eo,to,ro){const no=getScriptFromUtxo(to,eo,ro),{meaningfulScript:io}=getMeaningfulScript(no,to,"input",eo.redeemScript,eo.witnessScript);return(0,psbtutils_1.pubkeyInScript)(Xr,io)}function pubkeyInOutput(Xr,eo,to,ro){const no=ro.__TX.outs[to].script,{meaningfulScript:io}=getMeaningfulScript(no,to,"output",eo.redeemScript,eo.witnessScript);return(0,psbtutils_1.pubkeyInScript)(Xr,io)}function redeemFromFinalScriptSig(Xr){if(!Xr)return;const eo=bscript.decompile(Xr);if(!eo)return;const to=eo[eo.length-1];if(!(!Buffer$3.isBuffer(to)||isPubkeyLike(to)||isSigLike(to)||!bscript.decompile(to)))return to}function redeemFromFinalWitnessScript(Xr){if(!Xr)return;const eo=scriptWitnessToWitnessStack(Xr),to=eo[eo.length-1];if(!(isPubkeyLike(to)||!bscript.decompile(to)))return to}function compressPubkey(Xr){if(Xr.length===65){const eo=Xr[64]&1,to=Xr.slice(0,33);return to[0]=2|eo,to}return Xr.slice()}function isPubkeyLike(Xr){return Xr.length===33&&bscript.isCanonicalPubKey(Xr)}function isSigLike(Xr){return bscript.isCanonicalScriptSignature(Xr)}function getMeaningfulScript(Xr,eo,to,ro,no){const io=(0,psbtutils_1.isP2SHScript)(Xr),oo=io&&ro&&(0,psbtutils_1.isP2WSHScript)(ro),ao=(0,psbtutils_1.isP2WSHScript)(Xr);if(io&&ro===void 0)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((ao||oo)&&no===void 0)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let so;return oo?(so=no,checkRedeemScript(eo,Xr,ro,to),checkWitnessScript(eo,ro,no,to),checkInvalidP2WSH(so)):ao?(so=no,checkWitnessScript(eo,Xr,no,to),checkInvalidP2WSH(so)):io?(so=ro,checkRedeemScript(eo,Xr,ro,to)):so=Xr,{meaningfulScript:so,type:oo?"p2sh-p2wsh":io?"p2sh":ao?"p2wsh":"raw"}}function checkInvalidP2WSH(Xr){if((0,psbtutils_1.isP2WPKH)(Xr)||(0,psbtutils_1.isP2SHScript)(Xr))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function classifyScript(Xr){return(0,psbtutils_1.isP2WPKH)(Xr)?"witnesspubkeyhash":(0,psbtutils_1.isP2PKH)(Xr)?"pubkeyhash":(0,psbtutils_1.isP2MS)(Xr)?"multisig":(0,psbtutils_1.isP2PK)(Xr)?"pubkey":"nonstandard"}function range$1(Xr){return[...Array(Xr).keys()]}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.initEccLib=Xr.Transaction=Xr.opcodes=Xr.Psbt=Xr.Block=Xr.script=Xr.payments=Xr.networks=Xr.crypto=Xr.address=void 0;const eo=address;Xr.address=eo;const to=crypto$3;Xr.crypto=to;const ro=networks$1;Xr.networks=ro;const no=payments$3;Xr.payments=no;const io=script$1;Xr.script=io;var oo=block;Object.defineProperty(Xr,"Block",{enumerable:!0,get:function(){return oo.Block}});var ao=psbt$1;Object.defineProperty(Xr,"Psbt",{enumerable:!0,get:function(){return ao.Psbt}});var so=ops;Object.defineProperty(Xr,"opcodes",{enumerable:!0,get:function(){return so.OPS}});var co=transaction;Object.defineProperty(Xr,"Transaction",{enumerable:!0,get:function(){return co.Transaction}});var lo=ecc_lib;Object.defineProperty(Xr,"initEccLib",{enumerable:!0,get:function(){return lo.initEccLib}})})(src$3);const extractAddressFromInput=(Xr,eo,to)=>{var ro;let no;if(!((ro=to.witnessUtxo)===null||ro===void 0)&&ro.script?no=to.witnessUtxo.script:to.nonWitnessUtxo&&(no=src$3.Transaction.fromBuffer(to.nonWitnessUtxo).outs[Xr.txInputs[eo].index].script),!!no)try{return src$3.address.fromOutputScript(no)}catch{throw new Error("address not found in output script")}},validateAddress=(Xr,eo,to,ro)=>{const no=extractAddressFromInput(Xr,to,ro);if(!no)throw new DynamicError(`validateAddress - input not found for the given address: ${eo}`);if(no!==eo)throw new DynamicError("validateAddress - address mismatch with index")},getSigHashType=Xr=>{var eo;if(Xr!=null&&Xr.sighashType)return Xr.sighashType;let to=!1;if(!((eo=Xr.witnessUtxo)===null||eo===void 0)&&eo.script)try{src$3.payments.p2tr({output:Xr.witnessUtxo.script}),to=!0}catch{logger$9.debug("address is not taproot")}return to?src$3.Transaction.SIGHASH_DEFAULT:src$3.Transaction.SIGHASH_ALL},validateSigHash=(Xr,eo)=>{const to=getSigHashType(eo);if(Xr!=null&&Xr.length&&!Xr.includes(to))throw new Error(`validatePsbt - sigHashType ${to} not in allowed list`)},validatePsbt=(Xr,eo,to)=>{if(to!=null&&to.length)for(const ro of to){const{address:no,signingIndexes:io,disableAddressValidation:oo=!0}=ro;if(!(io!=null&&io.length))return;if(!no)throw new Error("validatePsbt - address not provided");for(const ao of io){const so=Xr.data.inputs[ao];if(!so)throw new Error("validatePsbt - requested input not found");oo||validateAddress(Xr,no,ao,so),validateSigHash(eo,so)}}},convertNetworkTypeForPsbt=Xr=>({[BitcoinNetworkType.Mainnet]:src$3.networks.bitcoin,[BitcoinNetworkType.Testnet]:src$3.networks.testnet,[BitcoinNetworkType.Signet]:void 0})[Xr];class BitcoinBtcKitConnector extends BitcoinWalletConnector{constructor(eo,to){super(eo),this.currentNetwork=BitcoinNetworkType.Mainnet,this.btcKit=to}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const[to]=yield this.getConnectedAccounts();if(to)return to;const ro=yield this.btcKit.request("getAddresses",{types:["p2tr","p2wpkh"]});if(!("result"in ro)){logger$9.error("Fetch public address error",ro);return}const{addresses:no}=ro.result,io=no==null?void 0:no.find(so=>so.type==="p2tr"),oo=no==null?void 0:no.find(so=>so.type==="p2wpkh"),ao=(eo=io==null?void 0:io.address)!==null&&eo!==void 0?eo:oo==null?void 0:oo.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:ao,ordinalsAddress:io,paymentAddress:oo}),ao})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!(yield this.getConnectedAccounts()).length)return;const to=yield this.btcKit.request("signMessage",{message:eo,paymentType:"p2tr"}).catch(({error:no})=>{throw no});if(!("result"in to))throw logger$9.error("Signature error",to),new Error("Failed to sign message");const{signature:ro}=to.result;return this.isHardwareWalletEnabled?JSON.stringify({signedTransaction:{data:ro}}):ro})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!(yield this.getAddress())||!this.btcKit)return;const ro=yield this.btcKit.request("sendTransfer",{address:eo.recipientAddress,amount:eo.amount.toString(),network:this.convertNetworkTypeToNetworkMode()});if(!("result"in ro))throw logger$9.error("Transaction error",ro),new Error("Failed to send transaction");return ro.result.txid})}convertNetworkTypeToNetworkMode(){return this.currentNetwork===BitcoinNetworkType.Mainnet?"mainnet":"testnet"}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to,ro;if(!(yield this.getAddress())||!this.btcKit)return;const io=convertNetworkTypeForPsbt(this.currentNetwork),oo=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64,{network:io});!((to=eo.signature)===null||to===void 0)&&to.length&&validatePsbt(oo,eo.allowedSighash,eo.signature);const ao={allowedSighash:eo.allowedSighash,hex:oo.toHex(),signAtIndex:(ro=eo.signature)===null||ro===void 0?void 0:ro.flatMap(lo=>lo.signingIndexes).filter(Number.isInteger)},so=yield this.btcKit.request("signPsbt",Object.assign({broadcast:!1,network:this.convertNetworkTypeToNetworkMode()},ao));if(!so||!("result"in so)||!("hex"in so.result))throw new Error("signPsbt - failed to sign PSBT");const co=so.result.hex;return{signedPsbt:src$3.Psbt.fromHex(co,{network:io}).toBase64()}})}}const fetchBtcKitConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).map(([to,ro])=>{var no,io;const oo=(no=ro.injectedConfig)===null||no===void 0?void 0:no.find(so=>so.chain==="btc"&&so.providerInterface===BTCKIT_INTERFACE);if(!(!((io=oo==null?void 0:oo.windowLocations)===null||io===void 0)&&io.length))return;const ao=getProvidersFromWindow(oo.windowLocations[0]);return class extends BitcoinBtcKitConnector{constructor(so){super(Object.assign(Object.assign({},so),{overrideKey:to,walletData:ro}),ao==null?void 0:ao[0]),this.name=ro.shortName||ro.name}}}).filter(to=>!!to)},createPsbtOptions=(Xr,eo)=>{var to;const ro={autoFinalized:!1};if(eo.signature){validatePsbt(Xr,eo.allowedSighash,eo.signature);const no=[];for(const io of eo.signature)if(!((to=io.signingIndexes)===null||to===void 0)&&to.length)for(const oo of io.signingIndexes)no.push({address:io.address,disableAddressValidation:io.disableAddressValidation,index:oo,sighashTypes:eo.allowedSighash});ro.toSignInputs=no}return ro},createSignPsbtOptionsForSatsConnect=(Xr,eo,to=!1)=>{var ro,no,io;!((ro=eo.signature)===null||ro===void 0)&&ro.length&&validatePsbt(Xr,eo.allowedSighash,eo.signature),logger$9.logVerboseTroubleshootingMessage("createSignPsbtOptionsForSatsConnect",{isLegacyConnector:to,psbtFromBase64:Xr,request:eo});const oo=((io=(no=eo.signature)===null||no===void 0?void 0:no.map(ao=>{var so;return((so=ao.signingIndexes)!==null&&so!==void 0?so:[]).map(co=>({address:ao.address,sigHash:to?getSigHashType(Xr.data.inputs[co]):eo.allowedSighash[0],signingIndexes:[co]}))}))!==null&&io!==void 0?io:[]).flat();return logger$9.logVerboseTroubleshootingMessage("createSignPsbtOptionsForSatsConnect",{inputsToSign:oo}),oo};class BitcoinSatsConnectConnector extends BitcoinWalletConnector{constructor(eo){var to,ro,no;super(eo),this.isLegacy=!1,this.currentNetwork=BitcoinNetworkType.Mainnet,!((ro=(to=eo.walletData)===null||to===void 0?void 0:to.injectedConfig)===null||ro===void 0)&&ro.length&&(this.providerId=(no=eo.walletData.injectedConfig[0].walletStandard)===null||no===void 0?void 0:no.providerId)}getGenericUserCancelledError(){const eo=new Error;return eo.code="-32000",eo}getAddresses(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=yield request("getAddresses",{purposes:[AddressPurpose.Payment,AddressPurpose.Ordinals]});if(to.status!=="success")throw to.error;const{addresses:ro}=to.result,no=ro==null?void 0:ro.find(ao=>ao.purpose===AddressPurpose.Ordinals),io=ro==null?void 0:ro.find(ao=>ao.purpose===AddressPurpose.Payment),oo=(eo=no==null?void 0:no.address)!==null&&eo!==void 0?eo:io==null?void 0:io.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:oo,ordinalsAddress:no,paymentAddress:io}),oo})}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=findWalletBookWallet(this.walletBook,this.key),ro=(eo=to==null?void 0:to.mobile)===null||eo===void 0?void 0:eo.inAppBrowser;if(isMobile$1()&&!this.isInstalledOnBrowser()&&ro&&this.mobileExperience==="in-app-browser"){const io=template$1(ro)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.href=io;return}try{const no=yield request("wallet_requestPermissions",void 0);if(no.status!=="success")throw no.error;return yield this.getAddresses()}catch{throw this.getGenericUserCancelledError()}})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){try{const ro=yield request("signMessage",{address:to,message:eo});if(ro.status!=="success")throw ro.error;return this.isHardwareWalletEnabled?JSON.stringify({signedTransaction:{data:ro.result.signature}}):ro.result.signature}catch{throw this.getGenericUserCancelledError()}})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){try{const to=yield request("sendTransfer",{recipients:[{address:eo.recipientAddress,amount:Number(eo.amount)}]});if(to.status!=="success")throw to.error;return to.result.txid}catch{throw this.getGenericUserCancelledError()}})}signTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){const{allowedSignHash:to,psbtBase64:ro,broadcast:no,inputsToSign:io}=eo,oo={allowedSignHash:to,broadcast:no,psbt:ro,signInputs:io.reduce((ao,so)=>(ao[so.address]||(ao[so.address]=[]),ao[so.address].push(...so.signingIndexes),ao),{})};logger$9.logVerboseTroubleshootingMessage("[BitcoinSatsConnectConnector] signTransaction",{signPbstPayload:oo});try{const ao=yield request("signPsbt",oo);if(ao.status!=="success")throw ao.error;return{psbtBase64:ao.result.psbt,txId:ao.result.txid}}catch{throw this.getGenericUserCancelledError()}})}signTransactions(eo){return __awaiter$i(this,void 0,void 0,function*(){const{message:to,psbts:ro,network:no}=eo;return logger$9.logVerboseTroubleshootingMessage("[BitcoinSatsConnectConnector] signTransactions",{transactions:eo}),new Promise((io,oo)=>{signMultipleTransactions({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ao,so;return(so=(ao=this.wallet)===null||ao===void 0?void 0:ao.features[SATSCONNECT_FEATURE])===null||so===void 0?void 0:so.provider}),onCancel:()=>{const ao=this.getGenericUserCancelledError();oo(ao)},onFinish:ao=>{io(ao)},payload:{message:to||"Sign Transaction",network:no,psbts:ro}})})})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;if(!(!((to=eo.allowedSighash)===null||to===void 0)&&to.length))throw new Error("allowedSighash cannot be an empty array");const ro=convertNetworkTypeForPsbt(this.currentNetwork),no=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64,{network:ro});logger$9.logVerboseTroubleshootingMessage("signPsbt",{isLegacy:this.isLegacy,psbtFromBase64:no,request:eo});const io=yield this.signTransaction({allowedSignHash:eo.allowedSighash[0],broadcast:!1,inputsToSign:createSignPsbtOptionsForSatsConnect(no,eo,this.isLegacy),psbtBase64:eo.unsignedPsbtBase64});if(!io)throw new Error("Failed to sign transaction with sats-connect");return{signedPsbt:io.psbtBase64}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;const ro=convertNetworkTypeForPsbt(this.currentNetwork),no={message:"Sign Transaction",network:{type:this.currentNetwork},psbts:[]};for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64,{network:ro}),so=createSignPsbtOptionsForSatsConnect(ao,oo,this.isLegacy);no.psbts.push({inputsToSign:so,psbtBase64:oo.unsignedPsbtBase64})}logger$9.logVerboseTroubleshootingMessage("signPsbts",no);const io=yield this.signTransactions(no);return(to=io==null?void 0:io.map(oo=>oo.psbtBase64))!==null&&to!==void 0?to:[]})}validateActiveWallet(eo){return __awaiter$i(this,void 0,void 0,function*(){logger$9.debug("validateActiveWallet - skipping validation for xverse",{expectedAddress:eo})})}handleXverseAccountChange(){return __awaiter$i(this,void 0,void 0,function*(){const{handleAccountChange:eo}=eventListenerHandlers(this),to=yield this.getAddresses();if(!to)return;eo([to])})}setupEventListeners(){if(this.key!=="xverse"){super.setupEventListeners();return}try{const eo=addListener("accountChange",this.handleXverseAccountChange.bind(this));this.teardownEventListeners=()=>{logger$9.debug("[BitcoinSatsConnectConnector] teardownEventListeners"),eo()}}catch(eo){logger$9.debug("[BitcoinSatsConnectConnector] setupEventListeners",{connector:this.key,error:eo})}}}const hasSatsConnectFeature=Xr=>SATSCONNECT_FEATURE in Xr,supportsSatsConnect=Xr=>{var eo,to,ro,no;if(Xr.key===XVERSE_KEY)return!0;const io=(ro=(to=(eo=findWalletBookWallet(Xr.walletBook,Xr.key))===null||eo===void 0?void 0:eo.injectedConfig)===null||to===void 0?void 0:to.find(oo=>oo.chain==="btc"))===null||ro===void 0?void 0:ro.walletStandard;return!!(Xr.wallet&&hasSatsConnectFeature(Xr.wallet.features)||!((no=io==null?void 0:io.features)===null||no===void 0)&&no.includes(SATSCONNECT_FEATURE))};class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector{constructor(){super(...arguments),this.isLegacy=!0}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;if(!supportsSatsConnect(this))return;const to=findWalletBookWallet(this.walletBook,this.key),ro=(eo=to==null?void 0:to.mobile)===null||eo===void 0?void 0:eo.inAppBrowser;if(isMobile$1()&&!this.isInstalledOnBrowser()&&ro&&this.mobileExperience==="in-app-browser"){const io=template$1(ro)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.href=io;return}return new Promise((no,io)=>{getAddress({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var oo,ao;return(ao=(oo=this.wallet)===null||oo===void 0?void 0:oo.features[SATSCONNECT_FEATURE])===null||ao===void 0?void 0:ao.provider}),onCancel:()=>{const oo=new Error;oo.code="-32000",io(oo)},onFinish:oo=>__awaiter$i(this,void 0,void 0,function*(){var ao;const{addresses:so}=oo,co=so==null?void 0:so.find(ho=>ho.purpose===AddressPurpose.Ordinals),lo=so==null?void 0:so.find(ho=>ho.purpose===AddressPurpose.Payment),fo=(ao=co==null?void 0:co.address)!==null&&ao!==void 0?ao:lo==null?void 0:lo.address;yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:fo,ordinalsAddress:co,paymentAddress:lo}),no(fo)}),payload:{message:"Address for receiving Ordinals and payments",network:{type:this.currentNetwork},purposes:[AddressPurpose.Ordinals,AddressPurpose.Payment]}})})})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){if(supportsSatsConnect(this))return new Promise((ro,no)=>{signMessage$1({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var io,oo;return(oo=(io=this.wallet)===null||io===void 0?void 0:io.features[SATSCONNECT_FEATURE])===null||oo===void 0?void 0:oo.provider}),onCancel:()=>{const io=new Error;io.code="-32000",no(io)},onFinish:io=>__awaiter$i(this,void 0,void 0,function*(){if(this.isHardwareWalletEnabled)return ro(JSON.stringify({signedTransaction:{data:io}}));ro(io)}),payload:{address:to,message:eo,network:{type:this.currentNetwork}}})})})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;const ro=yield this.getAddress(),no=(to=(yield this.getAdditionalAddresses(ro)).find(io=>io.type==="payment"))===null||to===void 0?void 0:to.address;if(!(!no||!supportsSatsConnect(this)))return new Promise((io,oo)=>{sendBtcTransaction({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ao,so;return(so=(ao=this.wallet)===null||ao===void 0?void 0:ao.features[SATSCONNECT_FEATURE])===null||so===void 0?void 0:so.provider}),onCancel:()=>{const ao=new Error;ao.code="-32000",oo(ao)},onFinish:ao=>{io(ao)},payload:{network:{type:this.currentNetwork},recipients:[{address:eo.recipientAddress,amountSats:BigInt(eo.amount)}],senderAddress:no}})})})}signTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){const{message:to,psbtBase64:ro,broadcast:no,inputsToSign:io}=eo;return new Promise((oo,ao)=>{signTransaction$1({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var so,co;return(co=(so=this.wallet)===null||so===void 0?void 0:so.features[SATSCONNECT_FEATURE])===null||co===void 0?void 0:co.provider}),onCancel:()=>{const so=new Error;so.code="-32000",ao(so)},onFinish:so=>{oo(so)},payload:{broadcast:no,inputsToSign:io,message:to||"Sign Transaction",network:{type:this.currentNetwork},psbtBase64:ro}})})})}signTransactions(eo){return __awaiter$i(this,void 0,void 0,function*(){const{message:to,psbts:ro,network:no}=eo;return new Promise((io,oo)=>{signMultipleTransactions({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ao,so;return(so=(ao=this.wallet)===null||ao===void 0?void 0:ao.features[SATSCONNECT_FEATURE])===null||so===void 0?void 0:so.provider}),onCancel:()=>{const ao=new Error;ao.code="-32000",oo(ao)},onFinish:ao=>{io(ao)},payload:{message:to||"Sign Transaction",network:no,psbts:ro}})})})}}const fetchSatsConnectConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;return(no=ro.injectedConfig)===null||no===void 0?void 0:no.find(io=>{var oo;return io.chain==="btc"&&!!(!((oo=io.walletStandard)===null||oo===void 0)&&oo.features.includes(SATSCONNECT_FEATURE))})}).map(([to,ro])=>{var no;const{shortName:io,injectedConfig:oo}=ro,ao=io||ro.name;return!((no=oo==null?void 0:oo[0].walletStandard)===null||no===void 0)&&no.providerId?class extends BitcoinSatsConnectConnector{constructor(so){super(Object.assign(Object.assign({},so),{overrideKey:to,walletData:ro})),this.name=ao}}:class extends BitcoinSatsConnectLegacyConnector{constructor(so){super(Object.assign(Object.assign({},so),{overrideKey:to,walletData:ro})),this.name=ao}}})},sighashNumberToString=Xr=>{switch(Xr){case src$3.Transaction.SIGHASH_ALL:return"ALL";case src$3.Transaction.SIGHASH_NONE:return"NONE";case src$3.Transaction.SIGHASH_SINGLE:return"SINGLE";case src$3.Transaction.SIGHASH_ALL+src$3.Transaction.SIGHASH_ANYONECANPAY:return"ALL|ANYONECANPAY";case src$3.Transaction.SIGHASH_NONE+src$3.Transaction.SIGHASH_ANYONECANPAY:return"NONE|ANYONECANPAY";case src$3.Transaction.SIGHASH_SINGLE+src$3.Transaction.SIGHASH_ANYONECANPAY:return"SINGLE|ANYONECANPAY";default:return}},decodeBase64=Xr=>Uint8Array.from(Buffer$3.from(Xr,"base64")),encodeBase64=Xr=>Buffer$3.from(Xr).toString("base64");class PhantomConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"phantombtc"})),this.name="Phantom"}connectWithInstalledExtension(){return __awaiter$i(this,void 0,void 0,function*(){var eo,to;let ro,no;if(!((eo=this.walletMethods)===null||eo===void 0)&&eo.connect){const{accounts:oo}=yield this.walletMethods.connect();[ro,no]=oo.map(so=>({address:so.address,publicKey:Buffer$3.from(so.publicKey).toString("hex")})),no||(no=ro)}else{const oo=this.getProvider();if(!oo)return;const ao=yield oo.requestAccounts();no=ao==null?void 0:ao.find(so=>so.purpose==="ordinals"),ro=ao==null?void 0:ao.find(so=>so.purpose==="payment")}const io=(to=no==null?void 0:no.address)!==null&&to!==void 0?to:ro==null?void 0:ro.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:io,ordinalsAddress:no,paymentAddress:ro}),io})}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return this.connectWithInstalledExtension();isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){var ro;if(!((ro=this.walletMethods)===null||ro===void 0)&&ro.signMessage){const[no]=yield this.walletMethods.signMessage({account:{address:to},message:new TextEncoder().encode(eo)});return Buffer$3.from(no.signature).toString("base64")}else{const no=this.getProvider();if(!no)return;const io=yield no.signMessage(to,new TextEncoder().encode(eo));return Buffer$3.from(io.signature).toString("base64")}})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to,ro,no,io,oo;const[ao]=yield this.getConnectedAccounts();if(!ao)return;const so=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),co=createPsbtOptions(so,eo);if(!((to=this.walletMethods)===null||to===void 0)&&to.signTransaction){const[lo]=yield this.walletMethods.signTransaction({inputsToSign:(no=(ro=co.toSignInputs)===null||ro===void 0?void 0:ro.map(fo=>({account:{address:fo.address},sigHash:fo.sighashTypes&&sighashNumberToString(fo.sighashTypes[0]),signingIndexes:[fo.index]})))!==null&&no!==void 0?no:[],psbt:decodeBase64(eo.unsignedPsbtBase64)});return{signedPsbt:Buffer$3.from(lo.signedPsbt).toString("base64")}}else{const lo=this.getProvider();if(!lo)return;const fo=(oo=(io=eo.signature)===null||io===void 0?void 0:io.map(go=>{var yo;return{address:go.address,sigHash:eo.allowedSighash[0],signingIndexes:(yo=go.signingIndexes)!==null&&yo!==void 0?yo:[]}}))!==null&&oo!==void 0?oo:[],ho=yield lo.signPSBT(decodeBase64(eo.unsignedPsbtBase64),{inputsToSign:fo});return{signedPsbt:encodeBase64(Uint8Array.from(ho))}}})}}class OkxConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"okxwalletbtc"})),this.name="OKX Wallet"}get walletBookWallet(){return this.walletBook.wallets[this.key]}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(!this.isInstalledOnBrowser()&&isMobile$1()&&this.walletBookWallet.mobile&&this.walletBookWallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const oo=template$1(this.walletBookWallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(oo);return}const eo=this.getProvider();if(!eo)return;const{address:to,publicKey:ro}=yield eo.connect(),no={address:to,publicKey:ro};return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:to,ordinalsAddress:no}),to})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(to)return to.signMessage(eo,"bip322-simple")})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!(!(yield this.getAddress())||!to))return to.sendBitcoin(eo.recipientAddress,eo.amount.toString())})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=yield to.signPsbt(ro.toHex(),createPsbtOptions(ro,eo));return{signedPsbt:src$3.Psbt.fromHex(no).toBase64()}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=[],no=[];for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64);ro.push(ao.toHex()),no.push(createPsbtOptions(ao,oo))}return(yield to.signPsbts(ro,no)).map(oo=>src$3.Psbt.fromHex(oo).toBase64())})}}class OylConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"oylwallet"})),this.name="Oyl Wallet",this.overrideKey="oylwallet"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=this.getProvider();if(!to)return;const ro=yield to.getAddresses(),no=ro.taproot,io=ro.nativeSegwit,oo=(eo=no==null?void 0:no.address)!==null&&eo!==void 0?eo:io==null?void 0:io.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:oo,ordinalsAddress:no,paymentAddress:io}),oo})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){const ro=this.getProvider();if(!ro)return;const{signature:no}=yield ro.signMessage({address:to,message:eo});return no})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=createPsbtOptions(ro,eo),{psbt:io}=yield to.signPsbt({broadcast:!1,finalize:no.autoFinalized,psbt:ro.toHex()});return{signedPsbt:src$3.Psbt.fromHex(io).toBase64()}})}}class UnisatConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"unisat"})),this.name="UniSat",this.overrideKey="unisat"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){const eo=this.getProvider();if(!eo)return;const[to]=yield eo.requestAccounts(),ro=yield eo.getPublicKey(),no={address:to,publicKey:ro};return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:to,ordinalsAddress:no}),to})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(to)return to.signMessage(eo,"bip322-simple")})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!(!(yield this.getAddress())||!to))return to.sendBitcoin(eo.recipientAddress,Number(eo.amount))})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=yield to.signPsbt(ro.toHex(),createPsbtOptions(ro,eo));return{signedPsbt:src$3.Psbt.fromHex(no).toBase64()}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=[],no=[];for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64);ro.push(ao.toHex()),no.push(createPsbtOptions(ao,oo))}return(yield to.signPsbts(ro,no)).map(oo=>src$3.Psbt.fromHex(oo).toBase64())})}getConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){const eo=this.getProvider();return eo?eo.getAccounts():[]})}}class UnknownInjectedConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"unknown"})),this.name="Unknown",this.overrideKey="unknown"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){})}}class FallbackBitcoinConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"fallbackconnector"})),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){})}}assertPackageVersion("@dynamic-labs/bitcoin",version$j);const BitcoinWalletConnectors=Xr=>[...fetchSatsConnectConnectors(Xr),...fetchBtcKitConnectors(Xr),PhantomConnector,OkxConnector,OylConnector,UnisatConnector,UnknownInjectedConnector,FallbackBitcoinConnector];var version$h="3.4.4";function __awaiter$f(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class CosmosWallet extends Wallet$1{getProvider(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this._connector.getProvider();if(!eo)throw new Error("unable to retrieve Cosmos provider");try{return cloneObjectWithOverrides(eo,{sendEthereumTx:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.sendEthereumTx(to,ro)}),sendTx:(to,ro,no)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.sendTx(to,ro,no)}),signAmino:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signAmino(to,ro,no,io)}),signArbitrary:(to,ro,no)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signArbitrary(to,ro,no)}),signDirect:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirect(to,ro,no,io)}),signDirectAux:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirectAux(to,ro,no,io)}),signEthereum:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signEthereum(to,ro,no,io)}),signICNSAdr36:(to,ro,no,io,oo)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signICNSAdr36(to,ro,no,io,oo)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Provider might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}getOfflineSigner(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this._connector.getOfflineSigner();if(!eo)throw new Error("unable to retrieve Cosmos offline signer");try{return cloneObjectWithOverrides(eo,{signAmino:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signAmino(to,ro)}),signDirect:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirect(to,ro)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}}class CosmosWalletConnector extends WalletConnectorBase{constructor(eo){super(eo),this.ChainWallet=CosmosWallet,this.connectedChain="COSMOS",this.supportedChains=["COSMOS"],this.evmNetworks=parseEvmNetworks(eo.cosmosNetworks),this.chainIdMapping=this.evmNetworks.map(to=>({cosmosNetworkId:to.name,dynamicChainId:parseChainId(to.networkId),evmNetwork:to}))}getSelectedNetwork(){const eo=this.chainIdMapping.find(to=>to.cosmosNetworkId===this.getChainId());return eo==null?void 0:eo.evmNetwork}getNetwork(){return __awaiter$f(this,void 0,void 0,function*(){var eo;return(eo=this.getSelectedNetwork())===null||eo===void 0?void 0:eo.chainId})}getLcdUrl(){var eo;return(eo=this.getSelectedNetwork())===null||eo===void 0?void 0:eo.lcdUrl}getDenom(){var eo;return(eo=this.getSelectedNetwork())===null||eo===void 0?void 0:eo.nativeCurrency.denom}getBalance(eo){return __awaiter$f(this,void 0,void 0,function*(){try{return(yield fetch(`${this.getLcdUrl()}/cosmos/bank/v1beta1/balances/${eo}`).then(no=>no.json())).balances.reduce((no,io)=>io.denom===this.getDenom()?Number(io.amount)/1e6:no,0).toString()}catch(to){return logger$9.error(to),"0"}})}getConnectedAccounts(){return __awaiter$f(this,void 0,void 0,function*(){return[yield this.getAddress()]})}endSession(){return __awaiter$f(this,void 0,void 0,function*(){this.setChainId(null)})}}const DYNAMIC_KEPLR_NETWORK_ID="dynamic_keplr_network_id";class KeplrWalletConnector extends CosmosWalletConnector{constructor(eo){super(eo),this.switchNetworkOnlyFromWallet=!0,this.name="Keplr",this.overrideKey="keplr",this._handleAccountChange=this._handleAccountChange.bind(this)}getDefaultChainId(){return this.chainIdMapping.length===0||this.chainIdMapping.find(eo=>eo.cosmosNetworkId==="cosmoshub-4")?"cosmoshub-4":this.chainIdMapping[0].cosmosNetworkId}getChainId(){const eo=this.getDefaultChainId(),to=localStorage.getItem(DYNAMIC_KEPLR_NETWORK_ID);return to??eo}setChainId(eo){eo?localStorage.setItem(DYNAMIC_KEPLR_NETWORK_ID,eo):localStorage.removeItem(DYNAMIC_KEPLR_NETWORK_ID)}getAccount(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this.keplr.getOfflineSigner(this.getChainId()).getAccounts();if(!eo)throw new Error("No accounts found");const[to]=eo;return to})}get keplr(){if(typeof window>"u")throw new Error("Keplr is not available");return window.keplr}connect(){return __awaiter$f(this,void 0,void 0,function*(){yield this.keplr.enable(this.chainIdMapping.map(eo=>eo.cosmosNetworkId))})}getAddress(){return __awaiter$f(this,void 0,void 0,function*(){return yield this.connect(),(yield this.getAccount()).address})}getProvider(){return __awaiter$f(this,void 0,void 0,function*(){return this.keplr})}getOfflineSigner(){return __awaiter$f(this,void 0,void 0,function*(){return this.keplr.getOfflineSigner(this.getChainId())})}isInstalledOnBrowser(){return typeof window.keplr<"u"}_handleAccountChange(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this.getAddress();this.emit("accountChange",{accounts:[eo]})})}setupEventListeners(){window.addEventListener("keplr_keystorechange",this._handleAccountChange)}teardownEventListeners(){window.removeEventListener("keplr_keystorechange",this._handleAccountChange),this.setChainId(null)}getSignDoc(eo){return{account_number:"0",chain_id:this.getChainId(),fee:{amount:[],gas:"0"},memo:"",msgs:[{type:"custom/MsgSignText",value:{text:eo}}],sequence:"0"}}signMessage(eo){return __awaiter$f(this,void 0,void 0,function*(){const to=this.getSignDoc(eo),ro=yield this.getAddress(),no=yield this.keplr.signAmino(this.getChainId(),ro,to);if(!no)throw new Error("Could not sign message");return JSON.stringify(no)})}supportsNetworkSwitching(){return!0}switchNetwork(eo){return __awaiter$f(this,arguments,void 0,function*({networkChainId:to}){to&&this.chainIdMapping.forEach(ro=>{ro.dynamicChainId===to&&(this.setChainId(ro.cosmosNetworkId),this.emit("chainChange",{chain:to.toString()}))})})}}assertPackageVersion("@dynamic-labs/cosmos",version$h);const CosmosWalletConnectors=()=>[KeplrWalletConnector];typeof window<"u"&&(window.global=globalThis,Object.assign(window,{Buffer:Buffer$1$1}));var version$g="3.4.4",version$f="3.4.4";function __awaiter$e(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __classPrivateFieldGet$3(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)}function __classPrivateFieldSet$3(Xr,eo,to,ro,no){if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no?no.value=to:eo.set(Xr,to),to}typeof SuppressedError=="function"&&SuppressedError;const DEFAULT_JWK_MEMBER_BYTE_LENGTH=32;function stringToBase64urlString(Xr){const eo=btoa$1(Xr);return base64StringToBase64UrlEncodedString(eo)}function hexStringToBase64url(Xr,eo){const to=Xr.padStart(Math.ceil(Xr.length/2)*2,"0"),ro=uint8ArrayFromHexString(to,eo);return stringToBase64urlString(ro.reduce((no,io)=>no+String.fromCharCode(io),""))}function base64StringToBase64UrlEncodedString(Xr){return Xr.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function uint8ArrayToHexString(Xr){return Xr.reduce((eo,to)=>eo+to.toString(16).padStart(2,"0"),"")}const uint8ArrayFromHexString=(Xr,eo)=>{const to=/^[0-9A-Fa-f]+$/;if(!Xr||Xr.length%2!=0||!to.test(Xr))throw new Error(`cannot create uint8array from invalid hex string: "${Xr}"`);const ro=new Uint8Array(Xr.match(/../g).map(io=>parseInt(io,16)));if(!eo)return ro;if(Xr.length/2>eo)throw new Error("hex value cannot fit in a buffer of "+eo+" byte(s)");let no=new Uint8Array(eo);return no.set(ro,eo-ro.length),no};function btoa$1(Xr){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");let eo;for(Xr=`${Xr}`,eo=0;eo255)throw new Error(`InvalidCharacterError: found code point greater than 255:${Xr.charCodeAt(eo)} at position ${eo}`);let to="";for(eo=0;eo>2,ro[1]=(Xr.charCodeAt(eo)&3)<<4,Xr.length>eo+1&&(ro[1]|=Xr.charCodeAt(eo+1)>>4,ro[2]=(Xr.charCodeAt(eo+1)&15)<<2),Xr.length>eo+2&&(ro[2]|=Xr.charCodeAt(eo+2)>>6,ro[3]=Xr.charCodeAt(eo+2)&63);for(let no=0;no"u"?to+="=":to+=btoaLookup(ro[no])}return to}function btoaLookup(Xr){const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";if(Xr>=0&&Xr<64)return eo[Xr]}const stampHeaderName$2="X-Stamp",isCryptoEnabledBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u",isNode=typeof process$1$1<"u"&&process$1$1.versions!=null&&process$1$1.versions.node!=null,signWithApiKey=async Xr=>isCryptoEnabledBrowser?(await __vitePreload(()=>import("./webcrypto-3I5ubJVL.js"),__vite__mapDeps([0,1])).then(to=>to.signWithApiKey))(Xr):isNode?(await __vitePreload(()=>import("./nodecrypto-Co9-WRDE.js"),__vite__mapDeps([2,1])).then(to=>to.signWithApiKey))(Xr):(await __vitePreload(()=>import("./purejs-IJPcfd_M.js"),[]).then(to=>to.signWithApiKey))(Xr);class ApiKeyStamper{constructor(eo){this.apiPublicKey=eo.apiPublicKey,this.apiPrivateKey=eo.apiPrivateKey}async stamp(eo){const to=await signWithApiKey({publicKey:this.apiPublicKey,privateKey:this.apiPrivateKey,content:eo}),ro={publicKey:this.apiPublicKey,scheme:"SIGNATURE_SCHEME_TK_API_P256",signature:to};return{stampHeaderName:stampHeaderName$2,stampHeaderValue:stringToBase64urlString(JSON.stringify(ro))}}}const base64UrlEncode=Xr=>Buffer$3.from(Xr).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),generateRandomBuffer=()=>{const Xr=new Uint8Array(32);return crypto.getRandomValues(Xr),Xr.buffer},transportMap={AUTHENTICATOR_TRANSPORT_BLE:AuthenticatorTransportProtocol.Ble,AUTHENTICATOR_TRANSPORT_HYBRID:AuthenticatorTransportProtocol.Hybrid,AUTHENTICATOR_TRANSPORT_INTERNAL:AuthenticatorTransportProtocol.Internal,AUTHENTICATOR_TRANSPORT_NFC:AuthenticatorTransportProtocol.Nfc,AUTHENTICATOR_TRANSPORT_USB:AuthenticatorTransportProtocol.Usb},convertAttestationTransports=Xr=>Xr.map(eo=>transportMap[eo]),TURNKEY_API_BASE_URL="https://api.turnkey.com",TURNKEY_API_KEY_EXPIRY_MESSAGE="Turnkey error 16: expired api key",TURNKEY_API_KEY_NOT_FOUND_MESSAGE="Turnkey error 16: could not find public key",WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE="The operation either timed out or was not allowed",WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",INVALID_PASSKEY_SELECTED_ERROR_MESSAGE="Turnkey error 5: webauthn authenticator not found in organization or parent organization",USER_CANCELLED_REQUEST_ERROR_MESSAGE="The user cancelled the request",TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS=[TURNKEY_API_KEY_EXPIRY_MESSAGE,TURNKEY_API_KEY_NOT_FOUND_MESSAGE],TURNKEY_SDK_BENIGN_ERRORS=[WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,INVALID_PASSKEY_SELECTED_ERROR_MESSAGE,USER_CANCELLED_REQUEST_ERROR_MESSAGE];class DynamicEmbeddedWalletsLogger extends Logger$2{constructor(eo,to){super(eo,to)}error(eo,...to){const[ro]=to;!(ro!=null&&ro.message)||!TURNKEY_SDK_BENIGN_ERRORS.some(no=>ro.message.includes(no))?(Logger$2.events.emit("error",eo),this.log(LogLevel.ERROR,eo,...to)):this.warn(eo,...to)}}const logger$6=new DynamicEmbeddedWalletsLogger("Dynamic embedded wallets",LogLevel.INFO),stampHeaderName$1="X-Stamp";var IframeEventType;(function(Xr){Xr.PublicKeyReady="PUBLIC_KEY_READY",Xr.InjectCredentialBundle="INJECT_CREDENTIAL_BUNDLE",Xr.InjectKeyExportBundle="INJECT_KEY_EXPORT_BUNDLE",Xr.InjectWalletExportBundle="INJECT_WALLET_EXPORT_BUNDLE",Xr.InjectImportBundle="INJECT_IMPORT_BUNDLE",Xr.ExtractWalletEncryptedBundle="EXTRACT_WALLET_ENCRYPTED_BUNDLE",Xr.ExtractKeyEncryptedBundle="EXTRACT_KEY_ENCRYPTED_BUNDLE",Xr.ApplySettings="APPLY_SETTINGS",Xr.BundleInjected="BUNDLE_INJECTED",Xr.EncryptedBundleExtracted="ENCRYPTED_BUNDLE_EXTRACTED",Xr.SettingsApplied="SETTINGS_APPLIED",Xr.StampRequest="STAMP_REQUEST",Xr.Stamp="STAMP",Xr.Error="ERROR"})(IframeEventType||(IframeEventType={}));var KeyFormat;(function(Xr){Xr.Hexadecimal="HEXADECIMAL",Xr.Solana="SOLANA"})(KeyFormat||(KeyFormat={}));class IframeStamper{constructor(eo){if(typeof window>"u")throw new Error("Cannot initialize iframe in non-browser environment");if(!eo.iframeContainer)throw new Error("Iframe container cannot be found");if(this.container=eo.iframeContainer,this.container.querySelector(`#${eo.iframeElementId}`))throw new Error(`Iframe element with ID ${eo.iframeElementId} already exists`);let to=window.document.createElement("iframe");to.setAttribute("sandbox","allow-scripts allow-same-origin"),to.id=eo.iframeElementId,to.src=eo.iframeUrl,this.iframe=to;const ro=new URL(eo.iframeUrl);this.iframeOrigin=ro.origin,this.iframePublicKey=null}async init(){return this.container.appendChild(this.iframe),new Promise((eo,to)=>{window.addEventListener("message",ro=>{var no;ro.origin===this.iframeOrigin&&((no=ro.data)==null?void 0:no.type)===IframeEventType.PublicKeyReady&&(this.iframePublicKey=ro.data.value,eo(ro.data.value))},!1)})}clear(){this.iframe.remove()}publicKey(){return this.iframePublicKey}async injectCredentialBundle(eo){return new Promise((to,ro)=>{var no;(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectCredentialBundle,value:eo},"*"),window.addEventListener("message",io=>{var oo,ao;io.origin===this.iframeOrigin&&(((oo=io.data)==null?void 0:oo.type)===IframeEventType.BundleInjected&&to(io.data.value),((ao=io.data)==null?void 0:ao.type)===IframeEventType.Error&&ro(io.data.value))},!1)})}async injectKeyExportBundle(eo,to,ro){var no;return(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectKeyExportBundle,value:eo,keyFormat:ro,organizationId:to},"*"),new Promise((io,oo)=>{window.addEventListener("message",ao=>{var so,co;ao.origin===this.iframeOrigin&&(((so=ao.data)==null?void 0:so.type)===IframeEventType.BundleInjected&&io(ao.data.value),((co=ao.data)==null?void 0:co.type)===IframeEventType.Error&&oo(ao.data.value))},!1)})}async injectWalletExportBundle(eo,to){var ro;return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.InjectWalletExportBundle,value:eo,organizationId:to},"*"),new Promise((no,io)=>{window.addEventListener("message",oo=>{var ao,so;oo.origin===this.iframeOrigin&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.BundleInjected&&no(oo.data.value),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}async injectImportBundle(eo,to,ro){var no;return(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectImportBundle,value:eo,organizationId:to,userId:ro},"*"),new Promise((io,oo)=>{window.addEventListener("message",ao=>{var so,co;ao.origin===this.iframeOrigin&&(((so=ao.data)==null?void 0:so.type)===IframeEventType.BundleInjected&&io(ao.data.value),((co=ao.data)==null?void 0:co.type)===IframeEventType.Error&&oo(ao.data.value))},!1)})}async extractWalletEncryptedBundle(){var eo;return(eo=this.iframe.contentWindow)==null||eo.postMessage({type:IframeEventType.ExtractWalletEncryptedBundle},"*"),new Promise((to,ro)=>{window.addEventListener("message",no=>{var io,oo;no.origin===this.iframeOrigin&&(((io=no.data)==null?void 0:io.type)===IframeEventType.EncryptedBundleExtracted&&to(no.data.value),((oo=no.data)==null?void 0:oo.type)===IframeEventType.Error&&ro(no.data.value))},!1)})}async extractKeyEncryptedBundle(eo){var to;return(to=this.iframe.contentWindow)==null||to.postMessage({type:IframeEventType.ExtractKeyEncryptedBundle,keyFormat:eo},"*"),new Promise((ro,no)=>{window.addEventListener("message",io=>{var oo,ao;io.origin===this.iframeOrigin&&(((oo=io.data)==null?void 0:oo.type)===IframeEventType.EncryptedBundleExtracted&&ro(io.data.value),((ao=io.data)==null?void 0:ao.type)===IframeEventType.Error&&no(io.data.value))},!1)})}async applySettings(eo){var ro;const to=JSON.stringify(eo);return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.ApplySettings,value:to},"*"),new Promise((no,io)=>{window.addEventListener("message",oo=>{var ao,so;oo.origin===this.iframeOrigin&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.SettingsApplied&&no(oo.data.value),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}async stamp(eo){var ro;if(this.iframePublicKey===null)throw new Error("null iframe public key. Have you called/awaited .init()?");const to=this.iframeOrigin;return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.StampRequest,value:eo},"*"),new Promise(function(no,io){window.addEventListener("message",oo=>{var ao,so;oo.origin===to&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.Stamp&&no({stampHeaderName:stampHeaderName$1,stampHeaderValue:oo.data.value}),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}}var browserPonyfill={exports:{}};(function(Xr,eo){var to=typeof self<"u"?self:commonjsGlobal,ro=function(){function io(){this.fetch=!1,this.DOMException=to.DOMException}return io.prototype=to,new io}();(function(io){(function(oo){var ao={searchParams:"URLSearchParams"in io,iterable:"Symbol"in io&&"iterator"in Symbol,blob:"FileReader"in io&&"Blob"in io&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in io,arrayBuffer:"ArrayBuffer"in io};function so(uo){return uo&&DataView.prototype.isPrototypeOf(uo)}if(ao.arrayBuffer)var co=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],lo=ArrayBuffer.isView||function(uo){return uo&&co.indexOf(Object.prototype.toString.call(uo))>-1};function fo(uo){if(typeof uo!="string"&&(uo=String(uo)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(uo))throw new TypeError("Invalid character in header field name");return uo.toLowerCase()}function ho(uo){return typeof uo!="string"&&(uo=String(uo)),uo}function go(uo){var po={next:function(){var bo=uo.shift();return{done:bo===void 0,value:bo}}};return ao.iterable&&(po[Symbol.iterator]=function(){return po}),po}function yo(uo){this.map={},uo instanceof yo?uo.forEach(function(po,bo){this.append(bo,po)},this):Array.isArray(uo)?uo.forEach(function(po){this.append(po[0],po[1])},this):uo&&Object.getOwnPropertyNames(uo).forEach(function(po){this.append(po,uo[po])},this)}yo.prototype.append=function(uo,po){uo=fo(uo),po=ho(po);var bo=this.map[uo];this.map[uo]=bo?bo+", "+po:po},yo.prototype.delete=function(uo){delete this.map[fo(uo)]},yo.prototype.get=function(uo){return uo=fo(uo),this.has(uo)?this.map[uo]:null},yo.prototype.has=function(uo){return this.map.hasOwnProperty(fo(uo))},yo.prototype.set=function(uo,po){this.map[fo(uo)]=ho(po)},yo.prototype.forEach=function(uo,po){for(var bo in this.map)this.map.hasOwnProperty(bo)&&uo.call(po,this.map[bo],bo,this)},yo.prototype.keys=function(){var uo=[];return this.forEach(function(po,bo){uo.push(bo)}),go(uo)},yo.prototype.values=function(){var uo=[];return this.forEach(function(po){uo.push(po)}),go(uo)},yo.prototype.entries=function(){var uo=[];return this.forEach(function(po,bo){uo.push([bo,po])}),go(uo)},ao.iterable&&(yo.prototype[Symbol.iterator]=yo.prototype.entries);function vo(uo){if(uo.bodyUsed)return Promise.reject(new TypeError("Already read"));uo.bodyUsed=!0}function wo(uo){return new Promise(function(po,bo){uo.onload=function(){po(uo.result)},uo.onerror=function(){bo(uo.error)}})}function Eo(uo){var po=new FileReader,bo=wo(po);return po.readAsArrayBuffer(uo),bo}function ko(uo){var po=new FileReader,bo=wo(po);return po.readAsText(uo),bo}function Ao(uo){for(var po=new Uint8Array(uo),bo=new Array(po.length),_o=0;_o-1?po:uo}function Do(uo,po){po=po||{};var bo=po.body;if(uo instanceof Do){if(uo.bodyUsed)throw new TypeError("Already read");this.url=uo.url,this.credentials=uo.credentials,po.headers||(this.headers=new yo(uo.headers)),this.method=uo.method,this.mode=uo.mode,this.signal=uo.signal,!bo&&uo._bodyInit!=null&&(bo=uo._bodyInit,uo.bodyUsed=!0)}else this.url=String(uo);if(this.credentials=po.credentials||this.credentials||"same-origin",(po.headers||!this.headers)&&(this.headers=new yo(po.headers)),this.method=No(po.method||this.method||"GET"),this.mode=po.mode||this.mode||null,this.signal=po.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&bo)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(bo)}Do.prototype.clone=function(){return new Do(this,{body:this._bodyInit})};function Fo(uo){var po=new FormData;return uo.trim().split("&").forEach(function(bo){if(bo){var _o=bo.split("="),$o=_o.shift().replace(/\+/g," "),Co=_o.join("=").replace(/\+/g," ");po.append(decodeURIComponent($o),decodeURIComponent(Co))}}),po}function Xo(uo){var po=new yo,bo=uo.replace(/\r?\n[\t ]+/g," ");return bo.split(/\r?\n/).forEach(function(_o){var $o=_o.split(":"),Co=$o.shift().trim();if(Co){var Ro=$o.join(":").trim();po.append(Co,Ro)}}),po}jo.call(Do.prototype);function Lo(uo,po){po||(po={}),this.type="default",this.status=po.status===void 0?200:po.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in po?po.statusText:"OK",this.headers=new yo(po.headers),this.url=po.url||"",this._initBody(uo)}jo.call(Lo.prototype),Lo.prototype.clone=function(){return new Lo(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new yo(this.headers),url:this.url})},Lo.error=function(){var uo=new Lo(null,{status:0,statusText:""});return uo.type="error",uo};var Bo=[301,302,303,307,308];Lo.redirect=function(uo,po){if(Bo.indexOf(po)===-1)throw new RangeError("Invalid status code");return new Lo(null,{status:po,headers:{location:uo}})},oo.DOMException=io.DOMException;try{new oo.DOMException}catch{oo.DOMException=function(po,bo){this.message=po,this.name=bo;var _o=Error(po);this.stack=_o.stack},oo.DOMException.prototype=Object.create(Error.prototype),oo.DOMException.prototype.constructor=oo.DOMException}function xo(uo,po){return new Promise(function(bo,_o){var $o=new Do(uo,po);if($o.signal&&$o.signal.aborted)return _o(new oo.DOMException("Aborted","AbortError"));var Co=new XMLHttpRequest;function Ro(){Co.abort()}Co.onload=function(){var So={status:Co.status,statusText:Co.statusText,headers:Xo(Co.getAllResponseHeaders()||"")};So.url="responseURL"in Co?Co.responseURL:So.headers.get("X-Request-URL");var mo="response"in Co?Co.response:Co.responseText;bo(new Lo(mo,So))},Co.onerror=function(){_o(new TypeError("Network request failed"))},Co.ontimeout=function(){_o(new TypeError("Network request failed"))},Co.onabort=function(){_o(new oo.DOMException("Aborted","AbortError"))},Co.open($o.method,$o.url,!0),$o.credentials==="include"?Co.withCredentials=!0:$o.credentials==="omit"&&(Co.withCredentials=!1),"responseType"in Co&&ao.blob&&(Co.responseType="blob"),$o.headers.forEach(function(So,mo){Co.setRequestHeader(mo,So)}),$o.signal&&($o.signal.addEventListener("abort",Ro),Co.onreadystatechange=function(){Co.readyState===4&&$o.signal.removeEventListener("abort",Ro)}),Co.send(typeof $o._bodyInit>"u"?null:$o._bodyInit)})}return xo.polyfill=!0,io.fetch||(io.fetch=xo,io.Headers=yo,io.Request=Do,io.Response=Lo),oo.Headers=yo,oo.Request=Do,oo.Response=Lo,oo.fetch=xo,Object.defineProperty(oo,"__esModule",{value:!0}),oo})({})})(ro),ro.fetch.ponyfill=!0,delete ro.fetch.polyfill;var no=ro;eo=no.fetch,eo.default=no.fetch,eo.fetch=no.fetch,eo.Headers=no.Headers,eo.Request=no.Request,eo.Response=no.Response,Xr.exports=eo})(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports;const fetchTransport=getDefaultExportFromCjs$2(browserPonyfillExports),fetch$2=browserPonyfillExports.fetch;class TurnkeyRequestError extends Error{constructor(eo){let to=`Turnkey error ${eo.code}: ${eo.message}`;eo.details!=null&&(to+=` (Details: ${JSON.stringify(eo.details)})`),super(to),this.name="TurnkeyRequestError",this.details=eo.details??null,this.code=eo.code}}const VERSION$3="@turnkey/http@2.12.2";class TurnkeyClient{constructor(eo,to){if(this.getActivity=async ro=>this.request("/public/v1/query/get_activity",ro),this.stampGetActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getApiKey=async ro=>this.request("/public/v1/query/get_api_key",ro),this.stampGetApiKey=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_api_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getApiKeys=async ro=>this.request("/public/v1/query/get_api_keys",ro),this.stampGetApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAttestationDocument=async ro=>this.request("/public/v1/query/get_attestation",ro),this.stampGetAttestationDocument=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_attestation",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAuthenticator=async ro=>this.request("/public/v1/query/get_authenticator",ro),this.stampGetAuthenticator=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_authenticator",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAuthenticators=async ro=>this.request("/public/v1/query/get_authenticators",ro),this.stampGetAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOauthProviders=async ro=>this.request("/public/v1/query/get_oauth_providers",ro),this.stampGetOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOrganization=async ro=>this.request("/public/v1/query/get_organization",ro),this.stampGetOrganization=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_organization",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOrganizationConfigs=async ro=>this.request("/public/v1/query/get_organization_configs",ro),this.stampGetOrganizationConfigs=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_organization_configs",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPolicy=async ro=>this.request("/public/v1/query/get_policy",ro),this.stampGetPolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPrivateKey=async ro=>this.request("/public/v1/query/get_private_key",ro),this.stampGetPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getUser=async ro=>this.request("/public/v1/query/get_user",ro),this.stampGetUser=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWallet=async ro=>this.request("/public/v1/query/get_wallet",ro),this.stampGetWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getActivities=async ro=>this.request("/public/v1/query/list_activities",ro),this.stampGetActivities=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_activities",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPolicies=async ro=>this.request("/public/v1/query/list_policies",ro),this.stampGetPolicies=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_policies",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.listPrivateKeyTags=async ro=>this.request("/public/v1/query/list_private_key_tags",ro),this.stampListPrivateKeyTags=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_private_key_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPrivateKeys=async ro=>this.request("/public/v1/query/list_private_keys",ro),this.stampGetPrivateKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_private_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getSubOrgIds=async ro=>this.request("/public/v1/query/list_suborgs",ro),this.stampGetSubOrgIds=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_suborgs",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.listUserTags=async ro=>this.request("/public/v1/query/list_user_tags",ro),this.stampListUserTags=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_user_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getUsers=async ro=>this.request("/public/v1/query/list_users",ro),this.stampGetUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWalletAccounts=async ro=>this.request("/public/v1/query/list_wallet_accounts",ro),this.stampGetWalletAccounts=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_wallet_accounts",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWallets=async ro=>this.request("/public/v1/query/list_wallets",ro),this.stampGetWallets=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_wallets",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWhoami=async ro=>this.request("/public/v1/query/whoami",ro),this.stampGetWhoami=async ro=>{const no=this.config.baseUrl+"/public/v1/query/whoami",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.approveActivity=async ro=>this.request("/public/v1/submit/approve_activity",ro),this.stampApproveActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/approve_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createApiKeys=async ro=>this.request("/public/v1/submit/create_api_keys",ro),this.stampCreateApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createApiOnlyUsers=async ro=>this.request("/public/v1/submit/create_api_only_users",ro),this.stampCreateApiOnlyUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_api_only_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createAuthenticators=async ro=>this.request("/public/v1/submit/create_authenticators",ro),this.stampCreateAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createInvitations=async ro=>this.request("/public/v1/submit/create_invitations",ro),this.stampCreateInvitations=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_invitations",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createOauthProviders=async ro=>this.request("/public/v1/submit/create_oauth_providers",ro),this.stampCreateOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPolicies=async ro=>this.request("/public/v1/submit/create_policies",ro),this.stampCreatePolicies=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_policies",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPolicy=async ro=>this.request("/public/v1/submit/create_policy",ro),this.stampCreatePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPrivateKeyTag=async ro=>this.request("/public/v1/submit/create_private_key_tag",ro),this.stampCreatePrivateKeyTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_private_key_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPrivateKeys=async ro=>this.request("/public/v1/submit/create_private_keys",ro),this.stampCreatePrivateKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_private_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createReadOnlySession=async ro=>this.request("/public/v1/submit/create_read_only_session",ro),this.stampCreateReadOnlySession=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_read_only_session",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createReadWriteSession=async ro=>this.request("/public/v1/submit/create_read_write_session",ro),this.stampCreateReadWriteSession=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_read_write_session",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createSubOrganization=async ro=>this.request("/public/v1/submit/create_sub_organization",ro),this.stampCreateSubOrganization=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_sub_organization",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createUserTag=async ro=>this.request("/public/v1/submit/create_user_tag",ro),this.stampCreateUserTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_user_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createUsers=async ro=>this.request("/public/v1/submit/create_users",ro),this.stampCreateUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createWallet=async ro=>this.request("/public/v1/submit/create_wallet",ro),this.stampCreateWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createWalletAccounts=async ro=>this.request("/public/v1/submit/create_wallet_accounts",ro),this.stampCreateWalletAccounts=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_wallet_accounts",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteApiKeys=async ro=>this.request("/public/v1/submit/delete_api_keys",ro),this.stampDeleteApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteAuthenticators=async ro=>this.request("/public/v1/submit/delete_authenticators",ro),this.stampDeleteAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteInvitation=async ro=>this.request("/public/v1/submit/delete_invitation",ro),this.stampDeleteInvitation=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_invitation",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteOauthProviders=async ro=>this.request("/public/v1/submit/delete_oauth_providers",ro),this.stampDeleteOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deletePolicy=async ro=>this.request("/public/v1/submit/delete_policy",ro),this.stampDeletePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deletePrivateKeyTags=async ro=>this.request("/public/v1/submit/delete_private_key_tags",ro),this.stampDeletePrivateKeyTags=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_private_key_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteUserTags=async ro=>this.request("/public/v1/submit/delete_user_tags",ro),this.stampDeleteUserTags=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_user_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteUsers=async ro=>this.request("/public/v1/submit/delete_users",ro),this.stampDeleteUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.emailAuth=async ro=>this.request("/public/v1/submit/email_auth",ro),this.stampEmailAuth=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/email_auth",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportPrivateKey=async ro=>this.request("/public/v1/submit/export_private_key",ro),this.stampExportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportWallet=async ro=>this.request("/public/v1/submit/export_wallet",ro),this.stampExportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportWalletAccount=async ro=>this.request("/public/v1/submit/export_wallet_account",ro),this.stampExportWalletAccount=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_wallet_account",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.importPrivateKey=async ro=>this.request("/public/v1/submit/import_private_key",ro),this.stampImportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/import_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.importWallet=async ro=>this.request("/public/v1/submit/import_wallet",ro),this.stampImportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/import_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initImportPrivateKey=async ro=>this.request("/public/v1/submit/init_import_private_key",ro),this.stampInitImportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_import_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initImportWallet=async ro=>this.request("/public/v1/submit/init_import_wallet",ro),this.stampInitImportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_import_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initUserEmailRecovery=async ro=>this.request("/public/v1/submit/init_user_email_recovery",ro),this.stampInitUserEmailRecovery=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_user_email_recovery",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.oauth=async ro=>this.request("/public/v1/submit/oauth",ro),this.stampOauth=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/oauth",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.recoverUser=async ro=>this.request("/public/v1/submit/recover_user",ro),this.stampRecoverUser=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/recover_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.rejectActivity=async ro=>this.request("/public/v1/submit/reject_activity",ro),this.stampRejectActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/reject_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.removeOrganizationFeature=async ro=>this.request("/public/v1/submit/remove_organization_feature",ro),this.stampRemoveOrganizationFeature=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/remove_organization_feature",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.setOrganizationFeature=async ro=>this.request("/public/v1/submit/set_organization_feature",ro),this.stampSetOrganizationFeature=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/set_organization_feature",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signRawPayload=async ro=>this.request("/public/v1/submit/sign_raw_payload",ro),this.stampSignRawPayload=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_raw_payload",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signRawPayloads=async ro=>this.request("/public/v1/submit/sign_raw_payloads",ro),this.stampSignRawPayloads=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_raw_payloads",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signTransaction=async ro=>this.request("/public/v1/submit/sign_transaction",ro),this.stampSignTransaction=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_transaction",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updatePolicy=async ro=>this.request("/public/v1/submit/update_policy",ro),this.stampUpdatePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updatePrivateKeyTag=async ro=>this.request("/public/v1/submit/update_private_key_tag",ro),this.stampUpdatePrivateKeyTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_private_key_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateRootQuorum=async ro=>this.request("/public/v1/submit/update_root_quorum",ro),this.stampUpdateRootQuorum=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_root_quorum",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateUser=async ro=>this.request("/public/v1/submit/update_user",ro),this.stampUpdateUser=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateUserTag=async ro=>this.request("/public/v1/submit/update_user_tag",ro),this.stampUpdateUserTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_user_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},!eo.baseUrl)throw new Error("Missing base URL. Please verify env vars.");this.config=eo,this.stamper=to}async request(eo,to){const ro=this.config.baseUrl+eo,no=JSON.stringify(to),io=await this.stamper.stamp(no),oo=await fetch$2(ro,{method:"POST",headers:{[io.stampHeaderName]:io.stampHeaderValue,"X-Client-Version":VERSION$3},body:no,redirect:"follow"});if(!oo.ok){let so;try{so=await oo.json()}catch{throw new Error(`${oo.status} ${oo.statusText}`)}throw new TurnkeyRequestError(so)}return await oo.json()}}class TurnkeyActivityError extends Error{constructor(eo){const{message:to,cause:ro,activityId:no,activityStatus:io,activityType:oo}=eo;super(to),this.name="TurnkeyActivityError",this.activityId=no??null,this.activityStatus=io??null,this.activityType=oo??null,this.cause=ro??null}}function bufferToBase64url(Xr){const eo=new Uint8Array(Xr);let to="";for(const io of eo)to+=String.fromCharCode(io);return btoa(to).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}const copyValue="copy",convertValue="convert";function convert$1(Xr,eo,to){if(eo===copyValue)return to;if(eo===convertValue)return Xr(to);if(eo instanceof Array)return to.map(ro=>convert$1(Xr,eo[0],ro));if(eo instanceof Object){const ro={};for(const[no,io]of Object.entries(eo)){if(io.derive){const oo=io.derive(to);oo!==void 0&&(to[no]=oo)}if(!(no in to)){if(io.required)throw new Error(`Missing key: ${no}`);continue}if(to[no]==null){ro[no]=null;continue}ro[no]=convert$1(Xr,io.schema,to[no])}return ro}}function derived(Xr,eo){return{required:!0,schema:Xr,derive:eo}}function required(Xr){return{required:!0,schema:Xr}}function optional$3(Xr){return{required:!1,schema:Xr}}const simplifiedClientExtensionResultsSchema={appid:optional$3(copyValue),appidExclude:optional$3(copyValue),credProps:optional$3(copyValue)},publicKeyCredentialWithAssertion={type:required(copyValue),id:required(copyValue),rawId:required(convertValue),authenticatorAttachment:optional$3(copyValue),response:required({clientDataJSON:required(convertValue),authenticatorData:required(convertValue),signature:required(convertValue),userHandle:required(convertValue)}),clientExtensionResults:derived(simplifiedClientExtensionResultsSchema,Xr=>Xr.getClientExtensionResults())};function getResponseToJSON(Xr){return convert$1(bufferToBase64url,publicKeyCredentialWithAssertion,Xr)}async function get$3(Xr){const eo=await navigator.credentials.get(Xr);return eo.toJSON=()=>getResponseToJSON(eo),eo}const K$4=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];function createHash(Xr){return new Hash$1}let Hash$1=class{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!sharedBuffer||sharedOffset>=8e3)&&(sharedBuffer=new ArrayBuffer(8e3),sharedOffset=0),this._byte=new Uint8Array(sharedBuffer,sharedOffset,80),this._word=new Int32Array(sharedBuffer,sharedOffset,20),sharedOffset+=80}update(eo){if(typeof eo=="string")return this._utf8(eo);if(eo==null)throw new TypeError("Invalid type: "+typeof eo);const to=eo.byteOffset,ro=eo.byteLength;let no=ro/64|0,io=0;if(no&&!(to&3)&&!(this._size%64)){const ao=new Int32Array(eo.buffer,to,no*16);for(;no--;)this._int32(ao,io>>2),io+=64;this._size+=io}if(eo.BYTES_PER_ELEMENT!==1&&eo.buffer){const ao=new Uint8Array(eo.buffer,to+io,ro-io);return this._uint8(ao)}return io===ro?this:this._uint8(eo,io)}_uint8(eo,to){const{_byte:ro,_word:no}=this,io=eo.length;for(to=to|0;to=64&&this._int32(no),this._size+=ao-oo}return this}_utf8(eo){const{_byte:to,_word:ro}=this,no=eo.length;let io=this._sp;for(let oo=0;oo>>6,to[so++]=128|co&63):co<55296||co>57343?(to[so++]=224|co>>>12,to[so++]=128|co>>>6&63,to[so++]=128|co&63):io?(co=((io&1023)<<10)+(co&1023)+65536,to[so++]=240|co>>>18,to[so++]=128|co>>>12&63,to[so++]=128|co>>>6&63,to[so++]=128|co&63,io=0):io=co}so>=64&&(this._int32(ro),ro[0]=ro[16]),this._size+=so-ao}return this._sp=io,this}_int32(eo,to){let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this,fo=0;for(to=to|0;fo<16;)W$5[fo++]=swap32(eo[to++]);for(fo=16;fo<64;fo++)W$5[fo]=gamma1(W$5[fo-2])+W$5[fo-7]+gamma0(W$5[fo-15])+W$5[fo-16]|0;for(fo=0;fo<64;fo++){const ho=lo+sigma1(ao)+ch(ao,so,co)+K$4[fo]+W$5[fo]|0,go=sigma0(ro)+maj(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+ho|0,oo=io,io=no,no=ro,ro=ho+go|0}this.A=ro+this.A|0,this.B=no+this.B|0,this.C=io+this.C|0,this.D=oo+this.D|0,this.E=ao+this.E|0,this.F=so+this.F|0,this.G=co+this.G|0,this.H=lo+this.H|0}digest(eo){const{_byte:to,_word:ro}=this;let no=this._size%64|0;for(to[no++]=128;no&3;)to[no++]=0;if(no>>=2,no>14){for(;no<16;)ro[no++]=0;no=0,this._int32(ro)}for(;no<16;)ro[no++]=0;const io=this._size*8,oo=(io&4294967295)>>>0,ao=(io-oo)/4294967296;return ao&&(ro[14]=swap32(ao)),oo&&(ro[15]=swap32(oo)),this._int32(ro),eo==="hex"?this._hex():this._bin()}_hex(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so}=this;return hex32(eo)+hex32(to)+hex32(ro)+hex32(no)+hex32(io)+hex32(oo)+hex32(ao)+hex32(so)}_bin(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so,_byte:co,_word:lo}=this;return lo[0]=swap32(eo),lo[1]=swap32(to),lo[2]=swap32(ro),lo[3]=swap32(no),lo[4]=swap32(io),lo[5]=swap32(oo),lo[6]=swap32(ao),lo[7]=swap32(so),co.slice(0,32)}};const W$5=new Int32Array(64);let sharedBuffer,sharedOffset=0;const hex32=Xr=>(Xr+4294967296).toString(16).substr(-8),swapLE=Xr=>Xr<<24&4278190080|Xr<<8&16711680|Xr>>8&65280|Xr>>24&255,swapBE=Xr=>Xr,swap32=isBE()?swapBE:swapLE,ch=(Xr,eo,to)=>to^Xr&(eo^to),maj=(Xr,eo,to)=>Xr&eo|to&(Xr|eo),sigma0=Xr=>(Xr>>>2|Xr<<30)^(Xr>>>13|Xr<<19)^(Xr>>>22|Xr<<10),sigma1=Xr=>(Xr>>>6|Xr<<26)^(Xr>>>11|Xr<<21)^(Xr>>>25|Xr<<7),gamma0=Xr=>(Xr>>>7|Xr<<25)^(Xr>>>18|Xr<<14)^Xr>>>3,gamma1=Xr=>(Xr>>>17|Xr<<15)^(Xr>>>19|Xr<<13)^Xr>>>10;function isBE(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const stampHeaderName="X-Stamp-Webauthn",defaultTimeout=5*60*1e3,defaultUserVerification="preferred";class WebauthnStamper{constructor(eo){this.rpId=eo.rpId,this.timeout=eo.timeout||defaultTimeout,this.userVerification=eo.userVerification||defaultUserVerification,this.allowCredentials=eo.allowCredentials||[]}async stamp(eo){const to=getChallengeFromPayload(eo),ro={publicKey:{rpId:this.rpId,challenge:to,allowCredentials:this.allowCredentials,timeout:this.timeout,userVerification:this.userVerification}},io=(await get$3(ro)).toJSON(),oo={authenticatorData:io.response.authenticatorData,clientDataJson:io.response.clientDataJSON,credentialId:io.id,signature:io.response.signature};return{stampHeaderName,stampHeaderValue:JSON.stringify(oo)}}}function getChallengeFromPayload(Xr){const eo=createHash().update(Xr).digest("hex");return new TextEncoder().encode(eo)}var version$e="3.4.4";class WebauthnNotSupportedError extends Error{constructor(){super("Webauthn is not supported on this device")}}function __awaiter$d(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function utf8StringToBuffer(Xr){return new TextEncoder().encode(Xr)}function bufferToBase64URLString(Xr){const eo=new Uint8Array(Xr);let to="";for(const no of eo)to+=String.fromCharCode(no);return btoa(to).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(Xr){const eo=Xr.replace(/-/g,"+").replace(/_/g,"/"),to=(4-eo.length%4)%4,ro=eo.padEnd(eo.length+to,"="),no=atob(ro),io=new ArrayBuffer(no.length),oo=new Uint8Array(io);for(let ao=0;aooo.type==="public-key").length===0?new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:Xr}):new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:Xr});if(Xr.name==="SecurityError"){const io=window.location.hostname;if(isValidDomain(io)){if(to.rp.id!==io)return new WebAuthnError({message:`The RP ID "${to.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:Xr})}else return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:Xr})}else if(Xr.name==="TypeError"){if(to.user.id.byteLength<1||to.user.id.byteLength>64)return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:Xr})}else if(Xr.name==="UnknownError")return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:Xr})}return Xr}class BaseWebAuthnAbortService{createNewAbortSignal(){if(this.controller){const to=new Error("Cancelling existing WebAuthn API call for new one");to.name="AbortError",this.controller.abort(to)}const eo=new AbortController;return this.controller=eo,eo.signal}cancelCeremony(){if(this.controller){const eo=new Error("Manually cancelling existing WebAuthn API call");eo.name="AbortError",this.controller.abort(eo),this.controller=void 0}}}const WebAuthnAbortService=new BaseWebAuthnAbortService,attachments=["cross-platform","platform"];function toAuthenticatorAttachment(Xr){if(Xr&&!(attachments.indexOf(Xr)<0))return Xr}async function startRegistration(Xr){var ho;if(!browserSupportsWebAuthn())throw new Error("WebAuthn is not supported in this browser");const to={publicKey:{...Xr,challenge:base64URLStringToBuffer(Xr.challenge),user:{...Xr.user,id:utf8StringToBuffer(Xr.user.id)},excludeCredentials:(ho=Xr.excludeCredentials)==null?void 0:ho.map(toPublicKeyCredentialDescriptor)}};to.signal=WebAuthnAbortService.createNewAbortSignal();let ro;try{ro=await navigator.credentials.create(to)}catch(go){throw identifyRegistrationError({error:go,options:to})}if(!ro)throw new Error("Registration was not completed");const{id:no,rawId:io,response:oo,type:ao}=ro;let so;typeof oo.getTransports=="function"&&(so=oo.getTransports());let co;if(typeof oo.getPublicKeyAlgorithm=="function")try{co=oo.getPublicKeyAlgorithm()}catch(go){warnOnBrokenImplementation("getPublicKeyAlgorithm()",go)}let lo;if(typeof oo.getPublicKey=="function")try{const go=oo.getPublicKey();go!==null&&(lo=bufferToBase64URLString(go))}catch(go){warnOnBrokenImplementation("getPublicKey()",go)}let fo;if(typeof oo.getAuthenticatorData=="function")try{fo=bufferToBase64URLString(oo.getAuthenticatorData())}catch(go){warnOnBrokenImplementation("getAuthenticatorData()",go)}return{id:no,rawId:bufferToBase64URLString(io),response:{attestationObject:bufferToBase64URLString(oo.attestationObject),clientDataJSON:bufferToBase64URLString(oo.clientDataJSON),transports:so,publicKeyAlgorithm:co,publicKey:lo,authenticatorData:fo},type:ao,clientExtensionResults:ro.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(ro.authenticatorAttachment)}}function warnOnBrokenImplementation(Xr,eo){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${Xr}. You should report this error to them. -`,eo)}const logger$5=new Logger$2("Webauthn"),createWebauthnCredential=Xr=>__awaiter$d(void 0,void 0,void 0,function*(){if(!browserSupportsWebAuthn())throw new WebauthnNotSupportedError;let eo;try{eo=yield startRegistration(Xr)}catch(to){throw logger$5.debug("Failed to create webauthn credential",to),to}return eo}),convertTransportEnumToTurnkeyEnum=Xr=>{switch(Xr){case"internal":return"AUTHENTICATOR_TRANSPORT_INTERNAL";case"usb":return"AUTHENTICATOR_TRANSPORT_USB";case"nfc":return"AUTHENTICATOR_TRANSPORT_NFC";case"ble":return"AUTHENTICATOR_TRANSPORT_BLE";case"hybrid":return"AUTHENTICATOR_TRANSPORT_HYBRID";default:throw new Error("unsupported transport format "+Xr)}},getWebAuthnAttestationTurnkeyAdapter=Xr=>__awaiter$d(void 0,void 0,void 0,function*(){var eo,to;if(!Xr.publicKey)throw new Error("Invalid options. Public key attribute must be defined");const ro=Object.assign(Object.assign({},Xr.publicKey),{challenge:bufferSourceToString(Xr.publicKey.challenge),excludeCredentials:(eo=Xr.publicKey.excludeCredentials)===null||eo===void 0?void 0:eo.map(io=>Object.assign(Object.assign({},io),{id:bufferSourceToString(io.id)})),user:Object.assign(Object.assign({},Xr.publicKey.user),{id:bufferSourceToString(Xr.publicKey.user.id)})}),no=yield createWebauthnCredential(ro);return{attestationObject:no.response.attestationObject,clientDataJson:no.response.clientDataJSON,credentialId:no.rawId,transports:((to=no.response.transports)===null||to===void 0?void 0:to.map(convertTransportEnumToTurnkeyEnum))||[]}}),bufferSourceToString=Xr=>{if(Xr instanceof ArrayBuffer)return bufferToBase64URLString(Xr);{const eo=new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);return bufferToBase64URLString(eo)}};assertPackageVersion("@dynamic-labs/webauthn",version$e);const createTurnkeyPasskeyService=()=>({createWebauthnStamper:Xr=>new WebauthnStamper(Xr),getWebAuthnAttestation:getWebAuthnAttestationTurnkeyAdapter});var _a,_PasskeyService_implementation;class PasskeyService{static get implementation(){return __classPrivateFieldGet$3(_a,_a,"f",_PasskeyService_implementation)?__classPrivateFieldGet$3(_a,_a,"f",_PasskeyService_implementation):createTurnkeyPasskeyService()}static set implementation(eo){__classPrivateFieldSet$3(_a,_a,eo,"f",_PasskeyService_implementation)}static get getWebAuthnAttestation(){return _a.implementation.getWebAuthnAttestation}static get createWebauthnStamper(){return _a.implementation.createWebauthnStamper}}_a=PasskeyService;_PasskeyService_implementation={value:void 0};const turnkeyBaseUrl$1="https://api.turnkey.com",turnkeyPasskeyRecoveryUrl="https://recovery.turnkey.com",turnkeyEmailRecoveryUrl="https://auth.turnkey.com",TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS=900,TURNKEY_SESSION_EXPIRATION_SECONDS=1800,EMAIL_AUTH_CREDENTIAL_TYPE="CREDENTIAL_TYPE_API_KEY_P256",PASSKEY_RECOVERY_CREDENTIAL_TYPE="CREDENTIAL_TYPE_RECOVER_USER_KEY_P256";class TurnkeyAuthenticatorRecoveryHandler{constructor(){this.isSessionActive=()=>!this.__createdAt||this.__recoveryType!=="email"?!1:this.isExpired(this.__createdAt,this.__sessionExpiration||TURNKEY_SESSION_EXPIRATION_SECONDS)?(this.clear(),!1):!0,this.isValidCode=eo=>__awaiter$e(this,void 0,void 0,function*(){var to,ro,no,io;if(!eo||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");const oo=yield(to=this.__client)===null||to===void 0?void 0:to.getUser({organizationId:eo,userId:this.__turnkeyRecoveryUserId}),ao={email:EMAIL_AUTH_CREDENTIAL_TYPE,passkey:PASSKEY_RECOVERY_CREDENTIAL_TYPE},so=(io=(no=(ro=oo==null?void 0:oo.user)===null||ro===void 0?void 0:ro.apiKeys)===null||no===void 0?void 0:no.filter(lo=>lo.credential.type===ao[this.__recoveryType]))===null||io===void 0?void 0:io.pop();return!so||this.isExpired(parseInt(so.createdAt.seconds,10),TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS)?!1:(this.__createdAt=parseInt(so.createdAt.seconds,10),!0)}),this.isExpired=(eo,to)=>{const ro=eo+to,no=new Date(ro*1e3);return new Date>=no}}get publicKey(){return this.__publicKey}get client(){return this.__client}get recoveryType(){return this.__recoveryType}get recoveryUserId(){return this.__turnkeyRecoveryUserId||""}set recoveryUserId(eo){this.__turnkeyRecoveryUserId=eo}clear(){var eo;(eo=this.__iframeStamper)===null||eo===void 0||eo.clear(),this.__recoveryType=void 0,this.__iframeStamper=void 0,this.__publicKey=void 0,this.__client=void 0,this.__turnkeyRecoveryUserId=void 0,this.__createdAt=void 0}initRecovery(eo,to,ro,no){return __awaiter$e(this,void 0,void 0,function*(){this.__recoveryType&&this.clear(),this.__sessionExpiration=no,this.__recoveryType=eo;const io=eo==="passkey"?turnkeyPasskeyRecoveryUrl:turnkeyEmailRecoveryUrl;return this.__iframeStamper=new IframeStamper({iframeContainer:to,iframeElementId:ro,iframeUrl:io}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),this.__publicKey})}verifyRecoveryCode(eo,to){return __awaiter$e(this,void 0,void 0,function*(){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{if(yield this.__iframeStamper.injectCredentialBundle(eo),this.__client=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},this.__iframeStamper),!to||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");if(!(yield this.isValidCode(to)))throw new DynamicError("The code is invalid or expired.")}catch(ro){throw logger$6.error("Error while verifying recovery code",ro),ro instanceof DynamicError?ro:new DynamicError("The code is invalid or expired.")}})}completeRecovery(eo){return __awaiter$e(this,arguments,void 0,function*({attestation:to,challenge:ro,turnkeySubOrganizationId:no}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.recoverUser({organizationId:no,parameters:{authenticator:{attestation:to,authenticatorName:"Passkey",challenge:ro},userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_RECOVER_USER"})}catch(io){throw logger$6.error("[TK] Error while completing recovery process",io),io}})}addPasskeyAuthenticator(eo){return __awaiter$e(this,arguments,void 0,function*({attestation:to,challenge:ro,turnkeySubOrganizationId:no}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.createAuthenticators({organizationId:no,parameters:{authenticators:[{attestation:to,authenticatorName:"Passkey",challenge:ro}],userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"})}catch(io){throw logger$6.error("[TK] Error while creating new authenticator",io),io}})}addEmailRecovery(eo){return __awaiter$e(this,arguments,void 0,function*({organizationId:to,email:ro,turnkeyUserId:no}){let io=getTLD();io||(io=PlatformService.getHostname());const oo=PasskeyService.createWebauthnStamper({rpId:io}),ao=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},oo);try{return{signedRequest:yield ao.stampUpdateUser({organizationId:to,parameters:{userEmail:ro,userId:no,userTagIds:[]},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_UPDATE_USER"}),userId:no}}catch(so){throw logger$6.error("Error while adding email recovery",so),so}})}}const turnkeyAuthenticatorRecoveryHandler=new TurnkeyAuthenticatorRecoveryHandler,turnkeyBaseUrl="https://api.turnkey.com",turnkeyExportUrl="https://export.turnkey.com";class ExportHandler{get publicKey(){return this.__publicKey}clear(){var eo;(eo=this.__iframeStamper)===null||eo===void 0||eo.clear(),this.__iframeStamper=void 0,this.__publicKey=void 0,this.__turnkeyClient=void 0}initExport(eo,to){return __awaiter$e(this,void 0,void 0,function*(){if(this.__iframeStamper=new IframeStamper({iframeContainer:eo,iframeElementId:to,iframeUrl:turnkeyExportUrl}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),turnkeyAuthenticatorRecoveryHandler.isSessionActive())this.__turnkeyClient=turnkeyAuthenticatorRecoveryHandler.client;else{let ro=getTLD();ro||(ro=PlatformService.getHostname());const no=PasskeyService.createWebauthnStamper({rpId:ro}),io=ExportHandler==null?void 0:ExportHandler.apiKeyStamper,oo=io??no;this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},oo)}return this.__publicKey})}verifyExportWallet(eo){return __awaiter$e(this,arguments,void 0,function*({exportBundle:to,organizationId:ro}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{return yield this.__iframeStamper.injectWalletExportBundle(to,ro)}catch(no){throw logger$6.error("Error while verifying export wallet",no),no}})}verifyExportPrivateKey(eo){return __awaiter$e(this,arguments,void 0,function*({exportBundle:to,organizationId:ro,chain:no}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");const io=no==="solana"||no==="SOL"?KeyFormat.Solana:KeyFormat.Hexadecimal;try{return yield this.__iframeStamper.injectKeyExportBundle(to,ro,io)}catch(oo){throw logger$6.error("Error while verifying export private key",oo),oo}})}exportPrivateKey(eo){return __awaiter$e(this,arguments,void 0,function*({privateKeyId:to,organizationId:ro}){const no=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(no&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},no)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!to)throw new DynamicError("Cannot proceed with your request");try{return(yield this.__turnkeyClient.exportPrivateKey({organizationId:ro,parameters:{privateKeyId:to,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"})).activity}catch(io){throw logger$6.error("[TK] Error while completing export private key process",io),io}})}exportWallet(eo){return __awaiter$e(this,arguments,void 0,function*({walletId:to,organizationId:ro,address:no}){const io=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(io&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},io)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!to)throw new DynamicError("Cannot proceed with your request");try{return no?(yield this.__turnkeyClient.exportWalletAccount({organizationId:ro,parameters:{address:no,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"})).activity:(yield this.__turnkeyClient.exportWallet({organizationId:ro,parameters:{targetPublicKey:this.__publicKey,walletId:to},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET"})).activity}catch(oo){throw logger$6.error("[TK] Error while completing export wallet process",oo),oo}})}}class TurnkeyWalletConnectorBase extends WalletConnectorBase{constructor(eo,to){if(super(to),this.requiresNonDynamicEmailOtp=!1,this.isEmbeddedWallet=!0,this.removeSessionKeys=()=>__awaiter$e(this,void 0,void 0,function*(){TurnkeyWalletConnectorBase.sessionKeys=void 0,TurnkeyWalletConnectorBase.apiKeyStamper=void 0,ExportHandler.apiKeyStamper=void 0,typeof(this===null||this===void 0?void 0:this.removeSessionKeysFunction)=="function"&&this.removeSessionKeysFunction()}),!to.appName)throw new Error("appName not set");this.name=eo.name,this.overrideKey=eo.key,this.appName=to.appName,this.__authenticatorMethodHandler=turnkeyAuthenticatorRecoveryHandler,this.__exportHandler=new ExportHandler}getWebAuthnAttestation(){return __awaiter$e(this,void 0,void 0,function*(){const eo=generateRandomBuffer(),to=generateRandomBuffer(),{email:ro,passkeyIdentifier:no}=this;if(!ro&&!no)throw new Error("Email or passkeyIdentifier must be set to register a webauthn credential.");const io=ro||`${this.appName} - ${no}`,oo={publicKey:{authenticatorSelection:{authenticatorAttachment:void 0,requireResidentKey:!1,residentKey:"preferred",userVerification:"discouraged"},challenge:eo,pubKeyCredParams:[{alg:-7,type:"public-key"}],rp:{id:getTLD(),name:this.appName},user:{displayName:io,id:to,name:ro||`${this.appName} - ${no}`}}};let ao;try{ao=yield PasskeyService.getWebAuthnAttestation(oo)}catch(so){logger$6.warn(`Unable to register webauthn credential on the current page's TLD ${getTLD()}. Falling back to using hostname. ${PlatformService.getHostname()}`,so),oo.publicKey.rp.id=PlatformService.getHostname(),ao=yield PasskeyService.getWebAuthnAttestation(oo)}return{attestation:{attestationObject:ao.attestationObject,clientDataJson:ao.clientDataJson,credentialId:ao.credentialId,transports:convertAttestationTransports(ao.transports)},challenge:base64UrlEncode(eo),displayName:io}})}getAuthenticatorHandler(){return this.__authenticatorMethodHandler}getExportHandler(){return this.__exportHandler}get email(){return this._email}setEmail(eo){this._email=eo}get phone(){return this._phone}setPhone(eo){this._phone=eo}get passkeyIdentifier(){return this._passkeyIdentifier}setPasskeyIdentifier(eo){this._passkeyIdentifier=eo}clearEmail(){this._email=null}getAddress(){return __awaiter$e(this,void 0,void 0,function*(){var eo;return(eo=this.verifiedCredential)===null||eo===void 0?void 0:eo.address})}getConnectedAccounts(){return __awaiter$e(this,void 0,void 0,function*(){return(this.verifiedCredentials||[]).map(ro=>ro==null?void 0:ro.address).filter(ro=>typeof ro=="string")})}get turnkeyAddress(){var eo;const{address:to}=(eo=this.verifiedCredential)!==null&&eo!==void 0?eo:{};return to}get walletProperties(){const{walletProperties:eo}=this.verifiedCredential||{};return eo}set verifiedCredentials(eo){this._verifiedCredentials=eo}get verifiedCredentials(){return this._verifiedCredentials}set verifiedCredential(eo){this._verifiedCredential=eo}get verifiedCredential(){return this._verifiedCredential}setSessionKeyFetcher(eo){this.createOrRestoreSessionFetcherFunction=eo}setSessionKeyRemoveFunction(eo){this.removeSessionKeysFunction=eo}createOrRestoreSession(){return __awaiter$e(this,arguments,void 0,function*({ignoreRestore:eo}={}){if(!this.isSessionKeyCompatible()||TurnkeyWalletConnectorBase.isLoadingSession)return;if(!this.createOrRestoreSessionFetcherFunction)throw new DynamicError("Cannot register session key to init provider");const{sessionKeys:to}=TurnkeyWalletConnectorBase;if(to!=null&&to.publicKey&&!(new Date>=new Date(to.expirationDate)))return to.publicKey;try{TurnkeyWalletConnectorBase.isLoadingSession=!0;const ro=yield this.createOrRestoreSessionFetcherFunction({ignoreRestore:eo});return TurnkeyWalletConnectorBase.sessionKeys=ro,TurnkeyWalletConnectorBase.apiKeyStamper=new ApiKeyStamper({apiPrivateKey:ro.privateKey,apiPublicKey:ro.publicKey}),ExportHandler.apiKeyStamper=TurnkeyWalletConnectorBase.apiKeyStamper,logger$6.setMetaData("sessionApiPublicKey",ro.publicKey),ro.publicKey}catch{throw new DynamicError("Failed to create or restore session")}finally{TurnkeyWalletConnectorBase.isLoadingSession=!1}})}isSessionKeyCompatible(){var eo;const to=(eo=this.verifiedCredential)===null||eo===void 0?void 0:eo.walletProperties;return!!(to==null?void 0:to.isSessionKeyCompatible)}isSessionActive(){return __awaiter$e(this,void 0,void 0,function*(){return!!((yield this.getAddress())&&TurnkeyWalletConnectorBase.sessionKeys&&TurnkeyWalletConnectorBase.apiKeyStamper)})}get sessionKeys(){return TurnkeyWalletConnectorBase.sessionKeys}setLoggerMetadata(){var eo,to,ro;logger$6.setMetaData("turnkeySubOrganizationId",(to=(eo=this._verifiedCredential)===null||eo===void 0?void 0:eo.walletProperties)===null||to===void 0?void 0:to.turnkeySubOrganizationId),logger$6.setMetaData("walletId",(ro=this._verifiedCredential)===null||ro===void 0?void 0:ro.id);let no="Unknown";this.isSessionKeyCompatible()?no="SessionKeys":this.__authenticatorMethodHandler.recoveryType==="passkey"?no="Passkey":this.__authenticatorMethodHandler.recoveryType==="email"&&(no="EmailAuth"),logger$6.setMetaData("authMethod",no)}}TurnkeyWalletConnectorBase.isLoadingSession=!1;const TurnkeyWalletConnectorInfo={Turnkey:{key:"turnkey",name:"Turnkey"},TurnkeyHD:{key:"turnkeyhd",name:"Turnkey HD"}},findTurnkeyVerifiedCredentials=(Xr,eo)=>Xr==null?void 0:Xr.filter(({walletName:to,chain:ro})=>(to==null?void 0:to.startsWith("turnkey"))&&eo===ro),findTurnkeyVerifiedCredentialsWithSmartWalletRef=(Xr,eo)=>Xr==null?void 0:Xr.reduce((to,ro)=>{var no;if(!((no=ro.walletName)===null||no===void 0)&&no.startsWith("turnkey")&&eo===ro.chain){const io=Xr.find(so=>so.signerRefId===ro.id),oo=io==null?void 0:io.id,ao=io==null?void 0:io.address;to.push(Object.assign(Object.assign({},ro),{smartWalletRefAddress:ao,smartWalletRefId:oo}))}return to},[]);assertPackageVersion("@dynamic-labs/embedded-wallet",version$f);function __awaiter$c(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;async function createAccount(Xr){var io;const{client:eo,organizationId:to,signWith:ro}=Xr;let{ethereumAddress:no}=Xr;if(!ro)throw new TurnkeyActivityError({message:"Missing signWith parameter"});if(isAddress(ro))no=ro;else if(!no&&(no=(io=(await eo.getPrivateKey({privateKeyId:ro,organizationId:to})).privateKey.addresses.find(ao=>ao.format==="ADDRESS_FORMAT_ETHEREUM"))==null?void 0:io.address,typeof no!="string"||!no))throw new TurnkeyActivityError({message:`Unable to find Ethereum address for key ${ro} under organization ${to}`});return toAccount({address:no,signMessage:function({message:oo}){return signMessage(eo,oo,to,ro)},signTransaction:function(oo,ao){const so=ao!=null&&ao.serializer?ao.serializer:serializeTransaction$4;return signTransaction(eo,oo,so,to,ro)},signTypedData:function(oo){return signTypedData(eo,oo,to,ro)}})}async function signMessage(Xr,eo,to,ro){const no=hashMessage(eo);return`${await signMessageWithErrorWrapping(Xr,no,to,ro)}`}async function signTransaction(Xr,eo,to,ro,no){const oo=to(eo).replace(/^0x/,"");return await signTransactionWithErrorWrapping(Xr,oo,ro,no)}async function signTypedData(Xr,eo,to,ro){const no=hashTypedData(eo);return await signMessageWithErrorWrapping(Xr,no,to,ro)}async function signTransactionWithErrorWrapping(Xr,eo,to,ro){let no;try{no=await signTransactionImpl(Xr,eo,to,ro)}catch(io){throw io instanceof TurnkeyActivityError?io:new TurnkeyActivityError({message:`Failed to sign transaction: ${io.message}`,cause:io})}return`0x${no}`}async function signTransactionImpl(Xr,eo,to,ro){var no,io;if(Xr instanceof TurnkeyClient){const{activity:oo}=await Xr.signTransaction({type:"ACTIVITY_TYPE_SIGN_TRANSACTION_V2",organizationId:to,parameters:{signWith:ro,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:eo},timestampMs:String(Date.now())}),{id:ao,status:so,type:co}=oo;if(oo.status!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${oo.status}`,activityId:ao,activityStatus:so,activityType:co});return assertNonNull((io=(no=oo==null?void 0:oo.result)==null?void 0:no.signTransactionResult)==null?void 0:io.signedTransaction)}else{const oo=await Xr.signTransaction({signWith:ro,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:eo});return assertNonNull(oo==null?void 0:oo.signedTransaction)}}async function signMessageWithErrorWrapping(Xr,eo,to,ro){let no;try{no=await signMessageImpl(Xr,eo,to,ro)}catch(io){throw io instanceof TurnkeyActivityError?io:new TurnkeyActivityError({message:`Failed to sign: ${io.message}`,cause:io})}return no}async function signMessageImpl(Xr,eo,to,ro){var oo;let no;if(Xr instanceof TurnkeyClient){const{activity:ao}=await Xr.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:to,parameters:{signWith:ro,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"},timestampMs:String(Date.now())}),{id:so,status:co,type:lo}=ao;if(co!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${ao.status}`,activityId:so,activityStatus:co,activityType:lo});no=assertNonNull((oo=ao==null?void 0:ao.result)==null?void 0:oo.signRawPayloadResult)}else no=await Xr.signRawPayload({signWith:ro,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"});let io=serializeSignature({r:`0x${no.r}`,s:`0x${no.s}`,v:no.v==="00"?27n:28n});return assertNonNull(io)}function assertNonNull(Xr){if(Xr==null)throw new Error(`Got unexpected ${JSON.stringify(Xr)}`);return Xr}var version$d="3.4.4";function __awaiter$b(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const logger$4=new Logger$2("ethereum-core"),gasPriceOracleAbiAddress="0x420000000000000000000000000000000000000F",gasPriceOracleAbi=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],estimateL1Fee$1=(Xr,eo)=>__awaiter$b(void 0,void 0,void 0,function*(){const to=serializeTransaction$4(Object.assign(Object.assign({chainId:Xr.chain.id},eo),{type:eo.type?eo.type:"eip1559"}));return Xr.readContract({abi:gasPriceOracleAbi,address:gasPriceOracleAbiAddress,args:[to],functionName:"getL1Fee"})}),opStackSupportedChains=[optimism.id,optimismGoerli.id,optimismSepolia.id,base$6.id,baseGoerli.id,baseSepolia$1.id],chainsMap=Object.values(viemChains).reduce((Xr,eo)=>Object.assign(Object.assign({},Xr),{[eo.id]:eo}),{}),erc20Abi=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class Eip1559FeeFeed{constructor({publicClient:eo,initialGasLimit:to,initialMaxFeePerGas:ro}){this.fee={gas:BigInt(0)},this.publicClient=eo,this.initialGasLimit=to,this.initialMaxFeePerGas=ro}fetchFee(){return __awaiter$b(this,void 0,void 0,function*(){try{const eo=yield this.estimateL1Fee();if(this.initialGasLimit&&this.initialMaxFeePerGas){this.fee.gas=this.initialGasLimit*this.initialMaxFeePerGas+eo;return}const to=yield this.estimateGas();if(this.initialMaxFeePerGas){this.fee.gas=to*this.initialMaxFeePerGas+eo;return}const ro=yield this.publicClient.estimateFeesPerGas();if(!ro||!ro.maxFeePerGas)return;this.fee.gas=to*ro.maxFeePerGas+eo,this.maxFeePerGas=ro.maxFeePerGas,this.maxPriorityFeePerGas=ro.maxPriorityFeePerGas}catch(eo){logger$4.debug(eo);return}})}}const estimateL1Fee=(Xr,eo)=>__awaiter$b(void 0,void 0,void 0,function*(){const{chain:to}=Xr;if(!to)throw new Error("Chain is not defined");const ro=Xr;if(opStackSupportedChains.includes(to.id))return estimateL1Fee$1(ro,eo);throw new Error("Chain is not supported")}),estimateL1FeeSupportedChains=[...opStackSupportedChains],isL1FeeSupportedByChain=Xr=>estimateL1FeeSupportedChains.includes(Xr),validateAddressFormat=Xr=>/^0x[0-9a-fA-F]{40}$/.test(Xr),parseEther=Xr=>parseEther$1(Xr,"wei"),formatEther=(Xr,{precision:eo}={})=>formatNumberText(formatEther$1(Xr),{precision:eo});class ViemUiTransaction extends Eip1559FeeFeed{constructor({transaction:eo,onSubmit:to,publicClient:ro,account:no}){super({initialGasLimit:eo.gas,initialMaxFeePerGas:eo.maxFeePerGas,publicClient:ro}),this.chain="EVM",this.validateAddressFormat=validateAddressFormat,this.parse=parseEther,this.parseNonNativeToken=(io,oo)=>parseUnits(io,oo),this.format=formatEther,this.formatNonNativeToken=(io,oo)=>formatUnits(io,oo),this.transaction=eo,this.onSubmit=to,this.publicClient=ro,this.address=no}get to(){return this.transaction.to||void 0}set to(eo){this.transaction.to=eo}get from(){return this.address}get value(){return this.transaction.value}set value(eo){this.transaction.value=eo}get nonNativeValue(){return this.transaction.nonNativeValue}set nonNativeValue(eo){this.transaction.nonNativeValue=eo}get nonNativeAddress(){return this.transaction.nonNativeAddress}set nonNativeAddress(eo){this.transaction.nonNativeAddress=eo}get nonNativeDecimal(){return this.transaction.nonNativeDecimal}set nonNativeDecimal(eo){this.transaction.nonNativeDecimal=eo}get data(){return this.transaction.data}submit(){return __awaiter$b(this,void 0,void 0,function*(){return this.onSubmit(this.transaction).catch(eo=>{throw eo instanceof UserRejectedTransactionError?new TransactionExecutionError(new BaseError(eo.message),this.transaction):eo})})}getBalance(){return this.publicClient.getBalance({address:this.address})}estimateGas(){return __awaiter$b(this,void 0,void 0,function*(){const eo=yield this.publicClient.transport.request({method:"eth_estimateGas",params:[{data:this.data,to:this.to,value:this.convertBigIntToHex(this.value)}]});return hexToBigInt(eo)})}convertBigIntToHex(eo){return eo?toHex$1(eo):void 0}estimateL1Fee(){return __awaiter$b(this,void 0,void 0,function*(){var eo;return isL1FeeSupportedByChain(((eo=this.publicClient.chain)===null||eo===void 0?void 0:eo.id)||0)?estimateL1Fee(this.publicClient,{data:this.transaction.data,to:this.transaction.to,value:this.transaction.value}):BigInt(0)})}set maxFeePerGas(eo){this.transaction.maxFeePerGas=eo}set maxPriorityFeePerGas(eo){this.transaction.maxPriorityFeePerGas=eo}}const createViemUiTransaction=Xr=>__awaiter$b(void 0,[Xr],void 0,function*({from:eo,publicClient:to,walletClient:ro}){return new ViemUiTransaction({account:eo,onSubmit:no=>__awaiter$b(void 0,void 0,void 0,function*(){return no.nonNativeAddress?ro.writeContract({abi:erc20Abi,account:eo,address:no.nonNativeAddress,args:[no.to,no.nonNativeValue],functionName:"transfer",maxFeePerGas:no.maxFeePerGas,maxPriorityFeePerGas:no.maxPriorityFeePerGas}):ro.sendTransaction({account:eo,maxFeePerGas:no.maxFeePerGas,maxPriorityFeePerGas:no.maxPriorityFeePerGas,to:no.to,value:no.value})}),publicClient:to,transaction:{}})}),getChain=Xr=>{for(const eo of Object.values(viemChains))if("id"in eo&&eo.id===Xr)return eo;throw new Error(`Chain with id ${Xr} not found`)},mapChain=Xr=>{var eo;return{blockExplorers:!((eo=Xr.blockExplorerUrls)===null||eo===void 0)&&eo[0]?{default:{name:Xr.blockExplorerUrls[0],url:Xr.blockExplorerUrls[0]}}:void 0,id:Xr.chainId,name:Xr.vanityName||Xr.name||Xr.chainName,nativeCurrency:Xr.nativeCurrency,rpcUrls:{default:{http:Xr.rpcUrls},public:{http:Xr.rpcUrls}}}},getOrMapViemChain=Xr=>{let eo;try{eo=getChain(Xr.chainId)}catch{logger$4.debug(`Chain with id ${Xr.chainId} not found in viem's chains`)}const to=mapChain(Xr);return eo?Object.assign(Object.assign({},eo),to):to},findEvmNetwork=({chainId:Xr,name:eo,networks:to})=>{if(!(!Xr&&!eo))return Xr&&eo?to.find(ro=>ro.chainId===Xr&&ro.name===eo):Xr?to.find(ro=>ro.chainId===Xr):to.find(ro=>ro.name===eo)};var L2ResolverAbi=[{inputs:[{internalType:"contract ENS",name:"ens_",type:"address"},{internalType:"address",name:"registrarController_",type:"address"},{internalType:"address",name:"reverseRegistrar_",type:"address"},{internalType:"address",name:"owner_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"CantSetSelfAsDelegate",type:"error"},{inputs:[],name:"CantSetSelfAsOperator",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newRegistrarController",type:"address"}],name:"RegistrarControllerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newReverseRegistrar",type:"address"}],name:"ReverseRegistrarUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"registrarController",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"}],name:"resolve",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"reverseRegistrar",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"registrarController_",type:"address"}],name:"setRegistrarController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"reverseRegistrar_",type:"address"}],name:"setReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];const getNameservice=Xr=>__awaiter$b(void 0,[Xr],void 0,function*({rpcProvider:eo,address:to}){const ro={avatar:void 0,name:void 0},no=yield eo.getChainId();if(!no)return ro;const io=(ao,so)=>{const co=ao.toLocaleLowerCase(),lo=keccak256(co.substring(2)),fo=oo(so),ho=namehash(`${fo.toLocaleUpperCase()}.reverse`);return keccak256(encodePacked(["bytes32","bytes32"],[ho,lo]))},oo=ao=>((2147483648|ao)>>>0).toString(16).toLocaleUpperCase();if(no===8453){const ao=io(to,8453);try{const so=yield eo.readContract({abi:L2ResolverAbi,address:"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD",args:[ao],functionName:"name"});if(so)return ro.name=so,ro}catch{return ro}}else ro.name=yield eo.getEnsName({address:to}),ro.avatar=ro.name?yield eo.getEnsAvatar({name:ro.name}):void 0;return ro}),isTransactionExecutionError=Xr=>Xr!=null&&typeof Xr=="object"&&"walk"in Xr&&typeof Xr.walk=="function",interceptTransport=({getAccounts:Xr,onPersonalSign:eo,onSendTransaction:to,onSignTypedData:ro,transport:no})=>io=>{const oo=no(io);return custom$1({request:ao=>__awaiter$b(void 0,void 0,void 0,function*(){var so;const{method:co,params:lo}=ao;if(Xr&&co==="eth_accounts")return Xr({provider:oo});if(eo&&co==="personal_sign"){const[fo]=lo;return eo({args:ao,message:fo,provider:oo}).catch(ho=>{throw ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}if(to&&co==="eth_sendTransaction"){const[fo]=lo;return to({args:ao,provider:oo,transaction:fo}).catch(ho=>{throw isTransactionExecutionError(ho)&&ho.walk()instanceof UserRejectedTransactionError?new UserRejectedRequestError$1(ho.walk()):ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}if(ro&&co==="eth_signTypedData_v4"){const[,fo]=(so=lo)!==null&&so!==void 0?so:[];return ro({args:ao,message:fo,provider:oo}).catch(ho=>{throw ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}return oo.request(ao)})})(io)};class EthereumWallet extends Wallet$1{getPublicClient(){return __awaiter$b(this,void 0,void 0,function*(){const eo=yield this._connector.getPublicClient();if(!eo)throw new Error("Unable to retrieve PublicClient");return eo})}getWalletClient(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=this._connector.getWalletClient(eo);if(!to)throw new Error("Unable to retrieve WalletClient");return createWalletClient({account:this.address,chain:to.chain,transport:interceptTransport({onPersonalSign:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),onSendTransaction:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),onSignTypedData:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),transport:custom$1(to.transport)})})})}}class EthWalletConnector extends WalletConnectorBase{getPublicClient(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to;const ro=(eo=yield this.getNetwork())!==null&&eo!==void 0?eo:1;if(this.evmNetworks.length===0)return;const no={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const io=this.chainRpcProviders.getProviders(no);return(to=this.chainRpcProviders.getEvmProviderByChainId(io,ro))===null||to===void 0?void 0:to.provider})}constructor(eo){var to;super(eo),this.ChainWallet=EthereumWallet,this.evmNetworkRpcMap=()=>this.evmNetworks.reduce((ro,no)=>{var io;return[ro[no.chainId]]=!((io=no==null?void 0:no.privateCustomerRpcUrls)===null||io===void 0)&&io.length?no.privateCustomerRpcUrls:no.rpcUrls,ro},{}),this.evmNetworks=parseEvmNetworks(eo.evmNetworks),this.chainRpcProviders=eo.chainRpcProviders,(to=this.chainRpcProviders)===null||to===void 0||to.registerEvmProviders()}getNetwork(){return __awaiter$b(this,void 0,void 0,function*(){const eo=this.getWalletClient();if(!this.supportsNetworkSwitching||!eo)return Promise.resolve(void 0);const to=yield retryableFn(eo.getChainId,{fallbackValue:FALLBACK_UNDEFINED,timeoutMs:1e3});return this.setActiveChain(chainsMap[to]),to})}getNameService(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient();if(to)return getNameservice({address:eo,rpcProvider:to})})}isTestnet(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to,ro;return(ro=(to=(eo=yield this.getPublicClient())===null||eo===void 0?void 0:eo.chain)===null||to===void 0?void 0:to.testnet)!==null&&ro!==void 0?ro:!1})}parseAddress(eo){try{return getAddress$1(eo)}catch(to){logger$9.debug(`Failed to parse EVM address into EIP55 format: error getting checksum, returning default ${eo}`,to)}return eo}getSigner(){return __awaiter$b(this,void 0,void 0,function*(){return this.getWalletClient()})}getBalance(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient(),ro=yield to==null?void 0:to.getBalance({address:eo});if(!(!ro&&ro!==BigInt(0)))return formatEther$1(ro)})}supportsNetworkSwitching(){return!0}switchNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({networkName:to,networkChainId:ro}){const no=findEvmNetwork({chainId:ro,name:to,networks:this.evmNetworks});if(!no)throw new DynamicError(`Could not find network mapping for chain ${to||ro}`);if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const io=this.getWalletClient();if(!io)throw new DynamicError("Provider not found");return this.providerSwitchNetwork({network:no,provider:io})})}chooseAccountsToConnect(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to,ro;const no=this.getWalletClient();if(!no)return[];try{const io=yield no.requestPermissions({eth_accounts:{}});logger$9.debug("chooseAccountsToConnect - requestPermissions result",io);const oo=(ro=(to=(eo=io==null?void 0:io.find(ao=>ao.parentCapability==="eth_accounts"))===null||eo===void 0?void 0:eo.caveats)===null||to===void 0?void 0:to[0])===null||ro===void 0?void 0:ro.value;return typeof oo=="string"?[oo]:Array.isArray(oo)?oo:[]}catch(io){if(logger$9.debug("chooseAccountsToConnect - error",io),io.code===4001)throw new UserRejectedRequestError}return[]})}getConnectedAccounts(){return __awaiter$b(this,void 0,void 0,function*(){const eo=this.getWalletClient();if(!eo)return[];const to=yield retryableFn(eo.getAddresses,{fallbackValue:[],timeoutMs:500});return to.length&&this.setActiveAccount(to[0]),to})}providerSwitchNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({network:to,provider:ro}){var no,io,oo,ao;const{chainId:so}=to,co=yield this.getNetwork();if(!(co&&co===so))try{if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const lo=getOrMapViemChain(to);if(yield ro.switchChain(lo),this.key==="magiceden"){const fo=yield ro.getChainId();this.emit("chainChange",{chain:fo.toString()})}else this.setActiveChain(lo)}catch(lo){if(lo.code===4902||!((no=lo.message)===null||no===void 0)&&no.includes("Unrecognized chain")||((oo=(io=lo.data)===null||io===void 0?void 0:io.orginalError)===null||oo===void 0?void 0:oo.code)===4902)return this.providerAddNetwork({network:to,provider:ro});throw!((ao=lo.message)===null||ao===void 0)&&ao.includes("rejected")||typeof lo=="string"&&lo.includes("rejected")?new DynamicError("User rejected the wallet's request to switch network"):lo}})}providerAddNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({network:to,provider:ro}){var no;try{return yield ro.addChain({chain:getOrMapViemChain(to)})}catch(io){throw!((no=io.message)===null||no===void 0)&&no.includes("rejected")||typeof io=="string"&&io.includes("rejected")?new DynamicError("User rejected the wallet's request to add network"):io}})}setActiveAccount(eo){this.activeAccount=eo?toAccount(eo):void 0}getActiveAccount(){return this.activeAccount}setActiveChain(eo){this.activeChain=eo}getActiveChain(){return this.activeChain}createUiTransaction(eo){return __awaiter$b(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=yield this.getWalletClient(),ro=yield this.getPublicClient();if(!ro||!to)throw new DynamicError("No public client available");return createViemUiTransaction({from:eo,publicClient:ro,walletClient:to})})}confirmTransactionStatus(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient();if(!to)throw new DynamicError("No public client available");return to.waitForTransactionReceipt({confirmations:3,hash:eo})})}}ChainRpcProviders.getEvmProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.evm)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerEvmProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.EVM,Xr=>{const eo={};return Xr!=null&&Xr.evm&&(eo.evm=parseEvmNetworks(Xr.evm).map(to=>{var ro;const no=((ro=to.privateCustomerRpcUrls)===null||ro===void 0?void 0:ro[0])||to.rpcUrls[0],io=createPublicClient({chain:getOrMapViemChain(to),transport:http(no)});return{chainId:to.chainId,chainName:to.name,provider:io}})),eo.evm})};const unFormatTransaction=Xr=>Object.assign(Object.assign({},Xr),{gas:typeof Xr.gas<"u"?hexToBigInt(Xr.gas):void 0,gasPrice:typeof Xr.gasPrice<"u"?hexToBigInt(Xr.gasPrice):void 0,maxFeePerGas:typeof Xr.maxFeePerGas<"u"?hexToBigInt(Xr.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof Xr.maxPriorityFeePerGas<"u"?hexToBigInt(Xr.maxPriorityFeePerGas):void 0,nonce:typeof Xr.nonce<"u"?hexToBigInt(Xr.nonce):void 0,value:typeof Xr.value<"u"?hexToBigInt(Xr.value):void 0}),createAccountWithUiConfirmation=({address:Xr,account:eo,provider:to,walletConnector:ro,walletUiUtils:no})=>toAccount({address:Xr,signMessage:(...io)=>__awaiter$b(void 0,void 0,void 0,function*(){return no.signMessage({handler:()=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signMessage(...io)}),message:(()=>{var oo;const ao=(oo=io[0])===null||oo===void 0?void 0:oo.message;return ao&&!(typeof ao=="string"&&Array.isArray(ao))?JSON.stringify(ao):ao==null?void 0:ao.toString()})(),walletConnector:ro})}),signTransaction:(...io)=>__awaiter$b(void 0,void 0,void 0,function*(){const oo=new ViemUiTransaction({account:Xr,onSubmit:ao=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signTransaction(ao)}),publicClient:to,transaction:io[0]});return no.sendTransaction(ro,oo)}),signTypedData:(...io)=>no.signMessage({handler:()=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signTypedData(...io)}),message:JSON.stringify(io[0]),walletConnector:ro})}),createWalletClientWithUiConfirmation=({address:Xr,account:eo,chain:to,transport:ro,walletConnector:no,walletUiUtils:io})=>{let oo=null;const ao=createPublicClient({chain:to,transport:ro}),so=createAccountWithUiConfirmation({account:eo,address:Xr,provider:ao,walletConnector:no,walletUiUtils:io}),co=interceptTransport({getAccounts:()=>__awaiter$b(void 0,void 0,void 0,function*(){return[Xr]}),onPersonalSign:lo=>__awaiter$b(void 0,[lo],void 0,function*({message:fo}){if(!oo)throw new Error("Client not initialized");return oo.signMessage({message:{raw:fo}})}),onSendTransaction:lo=>__awaiter$b(void 0,[lo],void 0,function*({transaction:fo}){if(!oo)throw new Error("Client not initialized");const ho=unFormatTransaction(fo);return oo.sendTransaction(ho)}),onSignTypedData:lo=>__awaiter$b(void 0,[lo],void 0,function*({message:fo}){if(!oo)throw new Error("Client not initialized");return oo.signTypedData(JSON.parse(fo))}),transport:ro});return oo=createWalletClient({account:so,chain:to,transport:co}),oo};assertPackageVersion("@dynamic-labs/ethereum-core",version$d);class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase{constructor(eo,to){var ro;super(eo,to),this.walletFallback={brand:{alt:"Turnkey Wallet",spriteId:"turnkey"},name:"Turnkey HD"},this.ChainWallet=EthereumWallet,this.connectedChain="EVM",this.supportedChains=["ETH","EVM"],this.verifiedCredentialChain="eip155",this.stampCreateWalletAccountRequest=no=>__awaiter$c(this,[no],void 0,function*({request:io}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(io)}),this.evmNetworks=parseEvmNetworks(to.evmNetworks),this.walletUiUtils=to.walletUiUtils,this._turnkeyAccount=void 0,this._selectedChainId=this.getLastUsedChainId(),this.chainRpcProviders=to.chainRpcProviders,(ro=this.chainRpcProviders)===null||ro===void 0||ro.registerEvmProviders(),this.__turnkeyClient=this.getTurnkeyClient()}getLastUsedChainId(){var eo;if(this.lastUsedChainId)return this.lastUsedChainId;if(!((eo=this.evmNetworks)===null||eo===void 0)&&eo.length)return this.evmNetworks[0].chainId}getNetwork(){return __awaiter$c(this,void 0,void 0,function*(){var eo;return(eo=yield this.getSigner())===null||eo===void 0?void 0:eo.getChainId()})}supportsNetworkSwitching(){return!0}switchNetwork(eo){return __awaiter$c(this,arguments,void 0,function*({networkChainId:to}){this.lastUsedChainId=to,this._selectedChainId=to,yield this.refreshTurnkeyAccount(),this.emit("chainChange",{chain:to.toString()})})}setVerifiedCredentials(eo){const to=findTurnkeyVerifiedCredentialsWithSmartWalletRef(eo,"eip155"),[ro]=to;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(to)&&(this.verifiedCredential=ro,this.verifiedCredentials=to,this.refreshTurnkeyAccount())}validateActiveWallet(eo){return __awaiter$c(this,void 0,void 0,function*(){var to,ro;const no=((to=this.verifiedCredential)===null||to===void 0?void 0:to.address)||"";if(!isSameAddress$1(no,eo,this.connectedChain)){const oo=(ro=this.verifiedCredentials)===null||ro===void 0?void 0:ro.find(ao=>(ao==null?void 0:ao.address)===eo);if(!oo)throw new DynamicError("Account not found");this.verifiedCredential=oo,this.refreshTurnkeyAccount()}})}getRpcUrl(){const eo=this._selectedChainId;return getRpcUrlForChain({chainId:eo,networks:this.evmNetworks})}getBalance(eo){return __awaiter$c(this,void 0,void 0,function*(){const to=this.getRpcUrl();if(!to)return;const no=yield createPublicClient({transport:http(to)}).getBalance({address:eo});return formatEther$1(no)})}signMessage(eo){return __awaiter$c(this,void 0,void 0,function*(){const to=yield this.getSigner();if(!to)throw new Error("Signer not found");return to.signMessage({message:eo})})}getPublicClient(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to;if(this.evmNetworks.length===0)return;const ro=(eo=yield this.getNetwork())!==null&&eo!==void 0?eo:1,no={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const io=this.chainRpcProviders.getProviders(no);return(to=this.chainRpcProviders.getEvmProviderByChainId(io,ro))===null||to===void 0?void 0:to.provider})}getSigner(){return __awaiter$c(this,void 0,void 0,function*(){return yield this.getTurnkeyAccount(),this.getWalletClient()})}getTurnkeyClient(){var eo;let to=getTLD();to||(to=PlatformService.getHostname());const ro=PasskeyService.createWebauthnStamper({rpId:to}),no=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,io=no??ro;return this.__turnkeyClient=(eo=this.getAuthenticatorHandler().client)!==null&&eo!==void 0?eo:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},io),this.__turnkeyClient}getAccount(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to,ro;return this.isSessionKeyCompatible()&&((eo=this.__turnkeyClient)===null||eo===void 0?void 0:eo.stamper)instanceof ApiKeyStamper?this._turnkeyAccount:((this.getAuthenticatorHandler().recoveryType==="passkey"&&((to=this.__turnkeyClient)===null||to===void 0?void 0:to.stamper)instanceof IframeStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((ro=this.__turnkeyClient)===null||ro===void 0?void 0:ro.stamper)instanceof WebauthnStamper||this.__turnkeyClient!==this.getAuthenticatorHandler().client)&&(yield this.refreshTurnkeyAccount()),this._turnkeyAccount)})}getWalletClient(){const eo=this.networkRpcUrl,to=this._turnkeyAccount,ro=this.currentEvmNetwork;if(!(!to||!eo||!ro))return createWalletClientWithUiConfirmation({account:this.getAccount.bind(this),address:this.turnkeyAddress,chain:getOrMapViemChain(ro),transport:http(eo),walletConnector:this,walletUiUtils:this.walletUiUtils})}get currentChainId(){var eo,to,ro;return(eo=this._selectedChainId)!==null&&eo!==void 0?eo:(ro=(to=this.evmNetworks)===null||to===void 0?void 0:to[0])===null||ro===void 0?void 0:ro.chainId}get lastUsedChainId(){const eo=localStorage.getItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey);if(eo)try{const to=parseInt(eo);if(isNaN(to))return;if(!this.evmNetworks.some(no=>no.chainId===to)){const no=this.evmNetworks[0].chainId;return this.lastUsedChainId=no,this.lastUsedChainId}return to}catch(to){logger$6.error(to);return}}set lastUsedChainId(eo){eo===void 0?localStorage.removeItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey):localStorage.setItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey,eo.toString())}get networkRpcUrl(){const eo=this.currentChainId;return this.evmNetworks.find(no=>no.chainId===eo)?getRpcUrlForChain({chainId:eo,networks:this.evmNetworks}):void 0}get currentEvmNetwork(){const eo=this.currentChainId;return this.evmNetworks.find(to=>to.chainId===eo)}internalSignTransaction(eo){return __awaiter$c(this,arguments,void 0,function*({transaction:to,args:ro,address:no,turnkeySubOrganizationId:io}){return this.doRetryableTurnkeyAction({action:oo=>oo.signTransaction(to,ro),activityType:"SignTransaction",address:no,turnkeySubOrganizationId:io})})}internalSignTypedData(eo){return __awaiter$c(this,arguments,void 0,function*({typedData:to,address:ro,turnkeySubOrganizationId:no}){return this.doRetryableTurnkeyAction({action:io=>io.signTypedData(to),activityType:"SignTypedData",address:ro,turnkeySubOrganizationId:no})})}internalSignMessage(eo){return __awaiter$c(this,arguments,void 0,function*({message:to,address:ro,turnkeySubOrganizationId:no}){return this.doRetryableTurnkeyAction({action:io=>io.signMessage({message:to}),activityType:"SignMessage",address:ro,turnkeySubOrganizationId:no})})}doRetryableTurnkeyAction(eo){return __awaiter$c(this,arguments,void 0,function*({action:to,activityType:ro,address:no,turnkeySubOrganizationId:io}){yield this.createOrRestoreSession();let oo=yield this.createTurnkeyAccount({address:no,turnkeySubOrganizationId:io});try{return yield to(oo)}catch(ao){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(so=>ao.message.includes(so)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),oo=yield this.createTurnkeyAccount({address:no,turnkeySubOrganizationId:io}),to(oo);throw logger$6.error(`[TK] failed to perform ${ro} activity`,ao),ao}})}createTurnkeyAccount(eo){return __awaiter$c(this,arguments,void 0,function*({address:to,turnkeySubOrganizationId:ro}){return createAccount({client:this.getTurnkeyClient(),ethereumAddress:to,organizationId:ro,signWith:to})})}refreshTurnkeyAccount(){return __awaiter$c(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyAccount(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to;if(this._turnkeyAccount)return this._turnkeyAccount;const{turnkeySubOrganizationId:ro}=(eo=this.walletProperties)!==null&&eo!==void 0?eo:{},{address:no}=(to=this.verifiedCredential)!==null&&to!==void 0?to:{};if(!(!ro||!no))return this._turnkeyAccount=toAccount({address:no,signMessage:io=>__awaiter$c(this,[io],void 0,function*({message:oo}){return this.internalSignMessage({address:no,message:oo,turnkeySubOrganizationId:ro})}),signTransaction:(io,oo)=>__awaiter$c(this,void 0,void 0,function*(){return this.internalSignTransaction({address:no,args:oo,transaction:io,turnkeySubOrganizationId:ro})}),signTypedData:io=>__awaiter$c(this,void 0,void 0,function*(){return this.internalSignTypedData({address:no,turnkeySubOrganizationId:ro,typedData:io})})}),this.setLoggerMetadata(),this._turnkeyAccount})}createUiTransaction(eo){return __awaiter$c(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=this.getWalletClient(),ro=yield this.getPublicClient();if(!ro||!to)throw new DynamicError("No public client available");return createViemUiTransaction({from:eo,publicClient:ro,walletClient:to})})}}TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey="turnkey-last-used-chain-id";const TurnkeyEVMWalletConnectors=Xr=>{var eo;return!((eo=Xr.apiProviders)===null||eo===void 0)&&eo.turnkey?[TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD),TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.Turnkey)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-evm",version$g);var version$c="3.4.4";function __rest$6(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);noto.chain==="evm")}installedProviders(){const eo=this.getInjectedConfig();if(!eo)return[];const to=[];if(eo.windowLocations)for(const ro of eo.windowLocations){const no=getProvidersFromWindow(ro);no&&no.length&&to.push(...no)}return window.ethereum&&(!window.ethereum.providers||!window.ethereum.providers.length?to.push(window.ethereum):window.ethereum.providers.forEach(ro=>to.push(ro))),to}installedProviderLookup(eo){const to=this.installedProviders();return ProviderLookup(to,eo)}eip6963ProviderLookup(eo){var to;const{providers:ro}=Eip6963ProviderSingleton.get();return(to=ro.find(no=>{var io;return((io=no==null?void 0:no.info)===null||io===void 0?void 0:io.rdns)===eo}))===null||to===void 0?void 0:to.provider}isInstalledHelper(){return this.findProvider()!==void 0}findProvider(){return this.connector.findProvider()}findWalletClient(eo){const to=this.findProvider();if(to)return createWalletClient({account:this.connector.getActiveAccount(),chain:eo?chainsMap[eo]:this.connector.getActiveChain(),transport:custom$1(to)})}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){const eo=this.findWalletClient();return eo?this.getAddressWithProvider(eo):Promise.resolve(void 0)})}getAddressWithProvider(eo){return __awaiter$a(this,void 0,void 0,function*(){try{const[to]=yield eo.requestAddresses(),ro=getAddress$1(to);return this.connector.setActiveAccount(ro),ro}catch(to){return logger$9.error(to),Promise.reject(to)}})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)return Promise.resolve(void 0);const ro=this.findWalletClient();return ro?yield ro.signMessage({account:to,message:eo}):Promise.resolve(void 0)})}_setupEventListeners(eo){const to=this.findProvider();if(to&&"on"in to){const{handleAccountChange:ro,handleChainChange:no,handleDisconnect:io}=eventListenerHandlers(eo);return to.on("accountsChanged",ro),to.on("chainChanged",no),to.on("disconnect",io),{tearDownEventListeners:()=>{const ao=this.findProvider();ao&&(ro&&ao.removeListener("accountsChanged",ro),no&&ao.removeListener("chainChanged",no),io&&ao.removeListener("disconnect",io))}}}return to?"on"in to||logger$9.warn("Provider does not support event listeners",{connector:eo,provider:to}):logger$9.warn("Provider not found",{connector:eo}),{tearDownEventListeners:()=>{}}}}var chacha20poly1305={},chacha={},binary={},int={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});function eo(ao,so){var co=ao>>>16&65535,lo=ao&65535,fo=so>>>16&65535,ho=so&65535;return lo*ho+(co*ho+lo*fo<<16>>>0)|0}Xr.mul=Math.imul||eo;function to(ao,so){return ao+so|0}Xr.add=to;function ro(ao,so){return ao-so|0}Xr.sub=ro;function no(ao,so){return ao<>>32-so}Xr.rotl=no;function io(ao,so){return ao<<32-so|ao>>>so}Xr.rotr=io;function oo(ao){return typeof ao=="number"&&isFinite(ao)&&Math.floor(ao)===ao}Xr.isInteger=Number.isInteger||oo,Xr.MAX_SAFE_INTEGER=9007199254740991,Xr.isSafeInteger=function(ao){return Xr.isInteger(ao)&&ao>=-Xr.MAX_SAFE_INTEGER&&ao<=Xr.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+0]<<8|Xr[eo+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+0]<<8|Xr[eo+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+1]<<8|Xr[eo])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+1]<<8|Xr[eo])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(2)),to===void 0&&(to=0),eo[to+0]=Xr>>>8,eo[to+1]=Xr>>>0,eo}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(2)),to===void 0&&(to=0),eo[to+0]=Xr>>>0,eo[to+1]=Xr>>>8,eo}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(Xr,eo){return eo===void 0&&(eo=0),Xr[eo]<<24|Xr[eo+1]<<16|Xr[eo+2]<<8|Xr[eo+3]}binary.readInt32BE=readInt32BE;function readUint32BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo]<<24|Xr[eo+1]<<16|Xr[eo+2]<<8|Xr[eo+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(Xr,eo){return eo===void 0&&(eo=0),Xr[eo+3]<<24|Xr[eo+2]<<16|Xr[eo+1]<<8|Xr[eo]}binary.readInt32LE=readInt32LE;function readUint32LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+3]<<24|Xr[eo+2]<<16|Xr[eo+1]<<8|Xr[eo])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(4)),to===void 0&&(to=0),eo[to+0]=Xr>>>24,eo[to+1]=Xr>>>16,eo[to+2]=Xr>>>8,eo[to+3]=Xr>>>0,eo}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(4)),to===void 0&&(to=0),eo[to+0]=Xr>>>0,eo[to+1]=Xr>>>8,eo[to+2]=Xr>>>16,eo[to+3]=Xr>>>24,eo}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(Xr,eo){eo===void 0&&(eo=0);var to=readInt32BE(Xr,eo),ro=readInt32BE(Xr,eo+4);return to*4294967296+ro-(ro>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(Xr,eo){eo===void 0&&(eo=0);var to=readUint32BE(Xr,eo),ro=readUint32BE(Xr,eo+4);return to*4294967296+ro}binary.readUint64BE=readUint64BE;function readInt64LE(Xr,eo){eo===void 0&&(eo=0);var to=readInt32LE(Xr,eo),ro=readInt32LE(Xr,eo+4);return ro*4294967296+to-(to>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(Xr,eo){eo===void 0&&(eo=0);var to=readUint32LE(Xr,eo),ro=readUint32LE(Xr,eo+4);return ro*4294967296+to}binary.readUint64LE=readUint64LE;function writeUint64BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(8)),to===void 0&&(to=0),writeUint32BE(Xr/4294967296>>>0,eo,to),writeUint32BE(Xr>>>0,eo,to+4),eo}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(8)),to===void 0&&(to=0),writeUint32LE(Xr>>>0,eo,to),writeUint32LE(Xr/4294967296>>>0,eo,to+4),eo}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(Xr,eo,to){if(to===void 0&&(to=0),Xr%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(Xr/8>eo.length-to)throw new Error("readUintBE: array is too short for the given bitLength");for(var ro=0,no=1,io=Xr/8+to-1;io>=to;io--)ro+=eo[io]*no,no*=256;return ro}binary.readUintBE=readUintBE;function readUintLE(Xr,eo,to){if(to===void 0&&(to=0),Xr%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(Xr/8>eo.length-to)throw new Error("readUintLE: array is too short for the given bitLength");for(var ro=0,no=1,io=to;io=ro;io--)to[io]=eo/no&255,no*=256;return to}binary.writeUintBE=writeUintBE;function writeUintLE(Xr,eo,to,ro){if(to===void 0&&(to=new Uint8Array(Xr/8)),ro===void 0&&(ro=0),Xr%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(eo))throw new Error("writeUintLE value must be an integer");for(var no=1,io=ro;io>>16|po<<16,Lo=Lo+po|0,No^=Lo,No=No>>>20|No<<12,Po=Po+Do|0,bo^=Po,bo=bo>>>16|bo<<16,Bo=Bo+bo|0,Do^=Bo,Do=Do>>>20|Do<<12,jo=jo+Fo|0,_o^=jo,_o=_o>>>16|_o<<16,xo=xo+_o|0,Fo^=xo,Fo=Fo>>>20|Fo<<12,Mo=Mo+Xo|0,$o^=Mo,$o=$o>>>16|$o<<16,uo=uo+$o|0,Xo^=uo,Xo=Xo>>>20|Xo<<12,jo=jo+Fo|0,_o^=jo,_o=_o>>>24|_o<<8,xo=xo+_o|0,Fo^=xo,Fo=Fo>>>25|Fo<<7,Mo=Mo+Xo|0,$o^=Mo,$o=$o>>>24|$o<<8,uo=uo+$o|0,Xo^=uo,Xo=Xo>>>25|Xo<<7,Po=Po+Do|0,bo^=Po,bo=bo>>>24|bo<<8,Bo=Bo+bo|0,Do^=Bo,Do=Do>>>25|Do<<7,Ao=Ao+No|0,po^=Ao,po=po>>>24|po<<8,Lo=Lo+po|0,No^=Lo,No=No>>>25|No<<7,Ao=Ao+Do|0,$o^=Ao,$o=$o>>>16|$o<<16,xo=xo+$o|0,Do^=xo,Do=Do>>>20|Do<<12,Po=Po+Fo|0,po^=Po,po=po>>>16|po<<16,uo=uo+po|0,Fo^=uo,Fo=Fo>>>20|Fo<<12,jo=jo+Xo|0,bo^=jo,bo=bo>>>16|bo<<16,Lo=Lo+bo|0,Xo^=Lo,Xo=Xo>>>20|Xo<<12,Mo=Mo+No|0,_o^=Mo,_o=_o>>>16|_o<<16,Bo=Bo+_o|0,No^=Bo,No=No>>>20|No<<12,jo=jo+Xo|0,bo^=jo,bo=bo>>>24|bo<<8,Lo=Lo+bo|0,Xo^=Lo,Xo=Xo>>>25|Xo<<7,Mo=Mo+No|0,_o^=Mo,_o=_o>>>24|_o<<8,Bo=Bo+_o|0,No^=Bo,No=No>>>25|No<<7,Po=Po+Fo|0,po^=Po,po=po>>>24|po<<8,uo=uo+po|0,Fo^=uo,Fo=Fo>>>25|Fo<<7,Ao=Ao+Do|0,$o^=Ao,$o=$o>>>24|$o<<8,xo=xo+$o|0,Do^=xo,Do=Do>>>25|Do<<7;binary_1.writeUint32LE(Ao+ro|0,Xr,0),binary_1.writeUint32LE(Po+no|0,Xr,4),binary_1.writeUint32LE(jo+io|0,Xr,8),binary_1.writeUint32LE(Mo+oo|0,Xr,12),binary_1.writeUint32LE(No+ao|0,Xr,16),binary_1.writeUint32LE(Do+so|0,Xr,20),binary_1.writeUint32LE(Fo+co|0,Xr,24),binary_1.writeUint32LE(Xo+lo|0,Xr,28),binary_1.writeUint32LE(Lo+fo|0,Xr,32),binary_1.writeUint32LE(Bo+ho|0,Xr,36),binary_1.writeUint32LE(xo+go|0,Xr,40),binary_1.writeUint32LE(uo+yo|0,Xr,44),binary_1.writeUint32LE(po+vo|0,Xr,48),binary_1.writeUint32LE(bo+wo|0,Xr,52),binary_1.writeUint32LE(_o+Eo|0,Xr,56),binary_1.writeUint32LE($o+ko|0,Xr,60)}function streamXOR(Xr,eo,to,ro,no){if(no===void 0&&(no=0),Xr.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(ro.length>>=8,eo++;if(ro>0)throw new Error("ChaCha: counter overflow")}var poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(Xr,eo,to){return~(Xr-1)&eo|Xr-1&to}constantTime.select=select;function lessOrEqual(Xr,eo){return(Xr|0)-(eo|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare$2(Xr,eo){if(Xr.length!==eo.length)return 0;for(var to=0,ro=0;ro>>8}constantTime.compare=compare$2;function equal(Xr,eo){return Xr.length===0||eo.length===0?!1:compare$2(Xr,eo)!==0}constantTime.equal=equal;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});var eo=constantTime,to=wipe$1;Xr.DIGEST_LENGTH=16;var ro=function(){function oo(ao){this.digestLength=Xr.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var so=ao[0]|ao[1]<<8;this._r[0]=so&8191;var co=ao[2]|ao[3]<<8;this._r[1]=(so>>>13|co<<3)&8191;var lo=ao[4]|ao[5]<<8;this._r[2]=(co>>>10|lo<<6)&7939;var fo=ao[6]|ao[7]<<8;this._r[3]=(lo>>>7|fo<<9)&8191;var ho=ao[8]|ao[9]<<8;this._r[4]=(fo>>>4|ho<<12)&255,this._r[5]=ho>>>1&8190;var go=ao[10]|ao[11]<<8;this._r[6]=(ho>>>14|go<<2)&8191;var yo=ao[12]|ao[13]<<8;this._r[7]=(go>>>11|yo<<5)&8065;var vo=ao[14]|ao[15]<<8;this._r[8]=(yo>>>8|vo<<8)&8191,this._r[9]=vo>>>5&127,this._pad[0]=ao[16]|ao[17]<<8,this._pad[1]=ao[18]|ao[19]<<8,this._pad[2]=ao[20]|ao[21]<<8,this._pad[3]=ao[22]|ao[23]<<8,this._pad[4]=ao[24]|ao[25]<<8,this._pad[5]=ao[26]|ao[27]<<8,this._pad[6]=ao[28]|ao[29]<<8,this._pad[7]=ao[30]|ao[31]<<8}return oo.prototype._blocks=function(ao,so,co){for(var lo=this._fin?0:2048,fo=this._h[0],ho=this._h[1],go=this._h[2],yo=this._h[3],vo=this._h[4],wo=this._h[5],Eo=this._h[6],ko=this._h[7],Ao=this._h[8],Po=this._h[9],jo=this._r[0],Mo=this._r[1],No=this._r[2],Do=this._r[3],Fo=this._r[4],Xo=this._r[5],Lo=this._r[6],Bo=this._r[7],xo=this._r[8],uo=this._r[9];co>=16;){var po=ao[so+0]|ao[so+1]<<8;fo+=po&8191;var bo=ao[so+2]|ao[so+3]<<8;ho+=(po>>>13|bo<<3)&8191;var _o=ao[so+4]|ao[so+5]<<8;go+=(bo>>>10|_o<<6)&8191;var $o=ao[so+6]|ao[so+7]<<8;yo+=(_o>>>7|$o<<9)&8191;var Co=ao[so+8]|ao[so+9]<<8;vo+=($o>>>4|Co<<12)&8191,wo+=Co>>>1&8191;var Ro=ao[so+10]|ao[so+11]<<8;Eo+=(Co>>>14|Ro<<2)&8191;var So=ao[so+12]|ao[so+13]<<8;ko+=(Ro>>>11|So<<5)&8191;var mo=ao[so+14]|ao[so+15]<<8;Ao+=(So>>>8|mo<<8)&8191,Po+=mo>>>5|lo;var To=0,Vo=To;Vo+=fo*jo,Vo+=ho*(5*uo),Vo+=go*(5*xo),Vo+=yo*(5*Bo),Vo+=vo*(5*Lo),To=Vo>>>13,Vo&=8191,Vo+=wo*(5*Xo),Vo+=Eo*(5*Fo),Vo+=ko*(5*Do),Vo+=Ao*(5*No),Vo+=Po*(5*Mo),To+=Vo>>>13,Vo&=8191;var Zo=To;Zo+=fo*Mo,Zo+=ho*jo,Zo+=go*(5*uo),Zo+=yo*(5*xo),Zo+=vo*(5*Bo),To=Zo>>>13,Zo&=8191,Zo+=wo*(5*Lo),Zo+=Eo*(5*Xo),Zo+=ko*(5*Fo),Zo+=Ao*(5*Do),Zo+=Po*(5*No),To+=Zo>>>13,Zo&=8191;var Qo=To;Qo+=fo*No,Qo+=ho*Mo,Qo+=go*jo,Qo+=yo*(5*uo),Qo+=vo*(5*xo),To=Qo>>>13,Qo&=8191,Qo+=wo*(5*Bo),Qo+=Eo*(5*Lo),Qo+=ko*(5*Xo),Qo+=Ao*(5*Fo),Qo+=Po*(5*Do),To+=Qo>>>13,Qo&=8191;var qo=To;qo+=fo*Do,qo+=ho*No,qo+=go*Mo,qo+=yo*jo,qo+=vo*(5*uo),To=qo>>>13,qo&=8191,qo+=wo*(5*xo),qo+=Eo*(5*Bo),qo+=ko*(5*Lo),qo+=Ao*(5*Xo),qo+=Po*(5*Fo),To+=qo>>>13,qo&=8191;var Ho=To;Ho+=fo*Fo,Ho+=ho*Do,Ho+=go*No,Ho+=yo*Mo,Ho+=vo*jo,To=Ho>>>13,Ho&=8191,Ho+=wo*(5*uo),Ho+=Eo*(5*xo),Ho+=ko*(5*Bo),Ho+=Ao*(5*Lo),Ho+=Po*(5*Xo),To+=Ho>>>13,Ho&=8191;var $a=To;$a+=fo*Xo,$a+=ho*Fo,$a+=go*Do,$a+=yo*No,$a+=vo*Mo,To=$a>>>13,$a&=8191,$a+=wo*jo,$a+=Eo*(5*uo),$a+=ko*(5*xo),$a+=Ao*(5*Bo),$a+=Po*(5*Lo),To+=$a>>>13,$a&=8191;var zo=To;zo+=fo*Lo,zo+=ho*Xo,zo+=go*Fo,zo+=yo*Do,zo+=vo*No,To=zo>>>13,zo&=8191,zo+=wo*Mo,zo+=Eo*jo,zo+=ko*(5*uo),zo+=Ao*(5*xo),zo+=Po*(5*Bo),To+=zo>>>13,zo&=8191;var Ko=To;Ko+=fo*Bo,Ko+=ho*Lo,Ko+=go*Xo,Ko+=yo*Fo,Ko+=vo*Do,To=Ko>>>13,Ko&=8191,Ko+=wo*No,Ko+=Eo*Mo,Ko+=ko*jo,Ko+=Ao*(5*uo),Ko+=Po*(5*xo),To+=Ko>>>13,Ko&=8191;var _c=To;_c+=fo*xo,_c+=ho*Bo,_c+=go*Lo,_c+=yo*Xo,_c+=vo*Fo,To=_c>>>13,_c&=8191,_c+=wo*Do,_c+=Eo*No,_c+=ko*Mo,_c+=Ao*jo,_c+=Po*(5*uo),To+=_c>>>13,_c&=8191;var Cl=To;Cl+=fo*uo,Cl+=ho*xo,Cl+=go*Bo,Cl+=yo*Lo,Cl+=vo*Xo,To=Cl>>>13,Cl&=8191,Cl+=wo*Fo,Cl+=Eo*Do,Cl+=ko*No,Cl+=Ao*Mo,Cl+=Po*jo,To+=Cl>>>13,Cl&=8191,To=(To<<2)+To|0,To=To+Vo|0,Vo=To&8191,To=To>>>13,Zo+=To,fo=Vo,ho=Zo,go=Qo,yo=qo,vo=Ho,wo=$a,Eo=zo,ko=Ko,Ao=_c,Po=Cl,so+=16,co-=16}this._h[0]=fo,this._h[1]=ho,this._h[2]=go,this._h[3]=yo,this._h[4]=vo,this._h[5]=wo,this._h[6]=Eo,this._h[7]=ko,this._h[8]=Ao,this._h[9]=Po},oo.prototype.finish=function(ao,so){so===void 0&&(so=0);var co=new Uint16Array(10),lo,fo,ho,go;if(this._leftover){for(go=this._leftover,this._buffer[go++]=1;go<16;go++)this._buffer[go]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(lo=this._h[1]>>>13,this._h[1]&=8191,go=2;go<10;go++)this._h[go]+=lo,lo=this._h[go]>>>13,this._h[go]&=8191;for(this._h[0]+=lo*5,lo=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=lo,lo=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=lo,co[0]=this._h[0]+5,lo=co[0]>>>13,co[0]&=8191,go=1;go<10;go++)co[go]=this._h[go]+lo,lo=co[go]>>>13,co[go]&=8191;for(co[9]-=8192,fo=(lo^1)-1,go=0;go<10;go++)co[go]&=fo;for(fo=~fo,go=0;go<10;go++)this._h[go]=this._h[go]&fo|co[go];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,ho=this._h[0]+this._pad[0],this._h[0]=ho&65535,go=1;go<8;go++)ho=(this._h[go]+this._pad[go]|0)+(ho>>>16)|0,this._h[go]=ho&65535;return ao[so+0]=this._h[0]>>>0,ao[so+1]=this._h[0]>>>8,ao[so+2]=this._h[1]>>>0,ao[so+3]=this._h[1]>>>8,ao[so+4]=this._h[2]>>>0,ao[so+5]=this._h[2]>>>8,ao[so+6]=this._h[3]>>>0,ao[so+7]=this._h[3]>>>8,ao[so+8]=this._h[4]>>>0,ao[so+9]=this._h[4]>>>8,ao[so+10]=this._h[5]>>>0,ao[so+11]=this._h[5]>>>8,ao[so+12]=this._h[6]>>>0,ao[so+13]=this._h[6]>>>8,ao[so+14]=this._h[7]>>>0,ao[so+15]=this._h[7]>>>8,this._finished=!0,this},oo.prototype.update=function(ao){var so=0,co=ao.length,lo;if(this._leftover){lo=16-this._leftover,lo>co&&(lo=co);for(var fo=0;fo=16&&(lo=co-co%16,this._blocks(ao,so,lo),so+=lo,co-=lo),co){for(var fo=0;fo16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var go=new Uint8Array(16);go.set(co,go.length-co.length);var yo=new Uint8Array(32);eo.stream(this._key,go,yo,4);var vo=lo.length+this.tagLength,wo;if(ho){if(ho.length!==vo)throw new Error("ChaCha20Poly1305: incorrect destination length");wo=ho}else wo=new Uint8Array(vo);return eo.streamXOR(this._key,go,lo,wo,4),this._authenticate(wo.subarray(wo.length-this.tagLength,wo.length),yo,wo.subarray(0,wo.length-this.tagLength),fo),ro.wipe(go),wo},so.prototype.open=function(co,lo,fo,ho){if(co.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(lo.length0&&go.update(oo.subarray(ho.length%16))),go.update(fo),fo.length%16>0&&go.update(oo.subarray(fo.length%16));var yo=new Uint8Array(8);ho&&no.writeUint64LE(ho.length,yo),go.update(yo),no.writeUint64LE(fo.length,yo),go.update(yo);for(var vo=go.digest(),wo=0;wothis.blockSize?this._inner.update(to).finish(ro).clean():ro.set(to);for(var no=0;no1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},Xr.prototype.expand=function(eo){for(var to=new Uint8Array(eo),ro=0;ro256)throw new Error("randomString charset is too long");let ho="";const go=lo.length,yo=256-256%go;for(;co>0;){const vo=no(Math.ceil(co*256/yo),fo);for(let wo=0;wo0;wo++){const Eo=vo[wo];Eo0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=so[lo++],co--;this._bufferLength===this.blockSize&&(io(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(co>=this.blockSize&&(lo=io(this._temp,this._state,so,lo,co),co%=this.blockSize);co>0;)this._buffer[this._bufferLength++]=so[lo++],co--;return this},ao.prototype.finish=function(so){if(!this._finished){var co=this._bytesHashed,lo=this._bufferLength,fo=co/536870912|0,ho=co<<3,go=co%64<56?64:128;this._buffer[lo]=128;for(var yo=lo+1;yo0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},ao.prototype.restoreState=function(so){return this._state.set(so.state),this._bufferLength=so.bufferLength,so.buffer&&this._buffer.set(so.buffer),this._bytesHashed=so.bytesHashed,this._finished=!1,this},ao.prototype.cleanSavedState=function(so){to.wipe(so.state),so.buffer&&to.wipe(so.buffer),so.bufferLength=0,so.bytesHashed=0},ao}();Xr.SHA256=ro;var no=new Int32Array([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]);function io(ao,so,co,lo,fo){for(;fo>=64;){for(var ho=so[0],go=so[1],yo=so[2],vo=so[3],wo=so[4],Eo=so[5],ko=so[6],Ao=so[7],Po=0;Po<16;Po++){var jo=lo+Po*4;ao[Po]=eo.readUint32BE(co,jo)}for(var Po=16;Po<64;Po++){var Mo=ao[Po-2],No=(Mo>>>17|Mo<<15)^(Mo>>>19|Mo<<13)^Mo>>>10;Mo=ao[Po-15];var Do=(Mo>>>7|Mo<<25)^(Mo>>>18|Mo<<14)^Mo>>>3;ao[Po]=(No+ao[Po-7]|0)+(Do+ao[Po-16]|0)}for(var Po=0;Po<64;Po++){var No=(((wo>>>6|wo<<26)^(wo>>>11|wo<<21)^(wo>>>25|wo<<7))+(wo&Eo^~wo&ko)|0)+(Ao+(no[Po]+ao[Po]|0)|0)|0,Do=((ho>>>2|ho<<30)^(ho>>>13|ho<<19)^(ho>>>22|ho<<10))+(ho&go^ho&yo^go&yo)|0;Ao=ko,ko=Eo,Eo=wo,wo=vo+No|0,vo=yo,yo=go,go=ho,ho=No+Do|0}so[0]+=ho,so[1]+=go,so[2]+=yo,so[3]+=vo,so[4]+=wo,so[5]+=Eo,so[6]+=ko,so[7]+=Ao,lo+=64,fo-=64}return lo}function oo(ao){var so=new ro;so.update(ao);var co=so.digest();return so.clean(),co}Xr.hash=oo})(sha256$1);var x25519={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.sharedKey=Xr.generateKeyPair=Xr.generateKeyPairFromSeed=Xr.scalarMultBase=Xr.scalarMult=Xr.SHARED_KEY_LENGTH=Xr.SECRET_KEY_LENGTH=Xr.PUBLIC_KEY_LENGTH=void 0;const eo=random,to=wipe$1;Xr.PUBLIC_KEY_LENGTH=32,Xr.SECRET_KEY_LENGTH=32,Xr.SHARED_KEY_LENGTH=32;function ro(Po){const jo=new Float64Array(16);if(Po)for(let Mo=0;Mo>16&1),Mo[Xo-1]&=65535;Mo[15]=No[15]-32767-(Mo[14]>>16&1);const Fo=Mo[15]>>16&1;Mo[14]&=65535,ao(No,Mo,1-Fo)}for(let Do=0;Do<16;Do++)Po[2*Do]=No[Do]&255,Po[2*Do+1]=No[Do]>>8}function co(Po,jo){for(let Mo=0;Mo<16;Mo++)Po[Mo]=jo[2*Mo]+(jo[2*Mo+1]<<8);Po[15]&=32767}function lo(Po,jo,Mo){for(let No=0;No<16;No++)Po[No]=jo[No]+Mo[No]}function fo(Po,jo,Mo){for(let No=0;No<16;No++)Po[No]=jo[No]-Mo[No]}function ho(Po,jo,Mo){let No,Do,Fo=0,Xo=0,Lo=0,Bo=0,xo=0,uo=0,po=0,bo=0,_o=0,$o=0,Co=0,Ro=0,So=0,mo=0,To=0,Vo=0,Zo=0,Qo=0,qo=0,Ho=0,$a=0,zo=0,Ko=0,_c=0,Cl=0,ga=0,El=0,Al=0,Ol=0,Wl=0,zl=0,Tl=Mo[0],Ml=Mo[1],ou=Mo[2],Vl=Mo[3],Ll=Mo[4],uu=Mo[5],ru=Mo[6],tu=Mo[7],ku=Mo[8],au=Mo[9],wl=Mo[10],Jo=Mo[11],Go=Mo[12],$l=Mo[13],Zl=Mo[14],Ul=Mo[15];No=jo[0],Fo+=No*Tl,Xo+=No*Ml,Lo+=No*ou,Bo+=No*Vl,xo+=No*Ll,uo+=No*uu,po+=No*ru,bo+=No*tu,_o+=No*ku,$o+=No*au,Co+=No*wl,Ro+=No*Jo,So+=No*Go,mo+=No*$l,To+=No*Zl,Vo+=No*Ul,No=jo[1],Xo+=No*Tl,Lo+=No*Ml,Bo+=No*ou,xo+=No*Vl,uo+=No*Ll,po+=No*uu,bo+=No*ru,_o+=No*tu,$o+=No*ku,Co+=No*au,Ro+=No*wl,So+=No*Jo,mo+=No*Go,To+=No*$l,Vo+=No*Zl,Zo+=No*Ul,No=jo[2],Lo+=No*Tl,Bo+=No*Ml,xo+=No*ou,uo+=No*Vl,po+=No*Ll,bo+=No*uu,_o+=No*ru,$o+=No*tu,Co+=No*ku,Ro+=No*au,So+=No*wl,mo+=No*Jo,To+=No*Go,Vo+=No*$l,Zo+=No*Zl,Qo+=No*Ul,No=jo[3],Bo+=No*Tl,xo+=No*Ml,uo+=No*ou,po+=No*Vl,bo+=No*Ll,_o+=No*uu,$o+=No*ru,Co+=No*tu,Ro+=No*ku,So+=No*au,mo+=No*wl,To+=No*Jo,Vo+=No*Go,Zo+=No*$l,Qo+=No*Zl,qo+=No*Ul,No=jo[4],xo+=No*Tl,uo+=No*Ml,po+=No*ou,bo+=No*Vl,_o+=No*Ll,$o+=No*uu,Co+=No*ru,Ro+=No*tu,So+=No*ku,mo+=No*au,To+=No*wl,Vo+=No*Jo,Zo+=No*Go,Qo+=No*$l,qo+=No*Zl,Ho+=No*Ul,No=jo[5],uo+=No*Tl,po+=No*Ml,bo+=No*ou,_o+=No*Vl,$o+=No*Ll,Co+=No*uu,Ro+=No*ru,So+=No*tu,mo+=No*ku,To+=No*au,Vo+=No*wl,Zo+=No*Jo,Qo+=No*Go,qo+=No*$l,Ho+=No*Zl,$a+=No*Ul,No=jo[6],po+=No*Tl,bo+=No*Ml,_o+=No*ou,$o+=No*Vl,Co+=No*Ll,Ro+=No*uu,So+=No*ru,mo+=No*tu,To+=No*ku,Vo+=No*au,Zo+=No*wl,Qo+=No*Jo,qo+=No*Go,Ho+=No*$l,$a+=No*Zl,zo+=No*Ul,No=jo[7],bo+=No*Tl,_o+=No*Ml,$o+=No*ou,Co+=No*Vl,Ro+=No*Ll,So+=No*uu,mo+=No*ru,To+=No*tu,Vo+=No*ku,Zo+=No*au,Qo+=No*wl,qo+=No*Jo,Ho+=No*Go,$a+=No*$l,zo+=No*Zl,Ko+=No*Ul,No=jo[8],_o+=No*Tl,$o+=No*Ml,Co+=No*ou,Ro+=No*Vl,So+=No*Ll,mo+=No*uu,To+=No*ru,Vo+=No*tu,Zo+=No*ku,Qo+=No*au,qo+=No*wl,Ho+=No*Jo,$a+=No*Go,zo+=No*$l,Ko+=No*Zl,_c+=No*Ul,No=jo[9],$o+=No*Tl,Co+=No*Ml,Ro+=No*ou,So+=No*Vl,mo+=No*Ll,To+=No*uu,Vo+=No*ru,Zo+=No*tu,Qo+=No*ku,qo+=No*au,Ho+=No*wl,$a+=No*Jo,zo+=No*Go,Ko+=No*$l,_c+=No*Zl,Cl+=No*Ul,No=jo[10],Co+=No*Tl,Ro+=No*Ml,So+=No*ou,mo+=No*Vl,To+=No*Ll,Vo+=No*uu,Zo+=No*ru,Qo+=No*tu,qo+=No*ku,Ho+=No*au,$a+=No*wl,zo+=No*Jo,Ko+=No*Go,_c+=No*$l,Cl+=No*Zl,ga+=No*Ul,No=jo[11],Ro+=No*Tl,So+=No*Ml,mo+=No*ou,To+=No*Vl,Vo+=No*Ll,Zo+=No*uu,Qo+=No*ru,qo+=No*tu,Ho+=No*ku,$a+=No*au,zo+=No*wl,Ko+=No*Jo,_c+=No*Go,Cl+=No*$l,ga+=No*Zl,El+=No*Ul,No=jo[12],So+=No*Tl,mo+=No*Ml,To+=No*ou,Vo+=No*Vl,Zo+=No*Ll,Qo+=No*uu,qo+=No*ru,Ho+=No*tu,$a+=No*ku,zo+=No*au,Ko+=No*wl,_c+=No*Jo,Cl+=No*Go,ga+=No*$l,El+=No*Zl,Al+=No*Ul,No=jo[13],mo+=No*Tl,To+=No*Ml,Vo+=No*ou,Zo+=No*Vl,Qo+=No*Ll,qo+=No*uu,Ho+=No*ru,$a+=No*tu,zo+=No*ku,Ko+=No*au,_c+=No*wl,Cl+=No*Jo,ga+=No*Go,El+=No*$l,Al+=No*Zl,Ol+=No*Ul,No=jo[14],To+=No*Tl,Vo+=No*Ml,Zo+=No*ou,Qo+=No*Vl,qo+=No*Ll,Ho+=No*uu,$a+=No*ru,zo+=No*tu,Ko+=No*ku,_c+=No*au,Cl+=No*wl,ga+=No*Jo,El+=No*Go,Al+=No*$l,Ol+=No*Zl,Wl+=No*Ul,No=jo[15],Vo+=No*Tl,Zo+=No*Ml,Qo+=No*ou,qo+=No*Vl,Ho+=No*Ll,$a+=No*uu,zo+=No*ru,Ko+=No*tu,_c+=No*ku,Cl+=No*au,ga+=No*wl,El+=No*Jo,Al+=No*Go,Ol+=No*$l,Wl+=No*Zl,zl+=No*Ul,Fo+=38*Zo,Xo+=38*Qo,Lo+=38*qo,Bo+=38*Ho,xo+=38*$a,uo+=38*zo,po+=38*Ko,bo+=38*_c,_o+=38*Cl,$o+=38*ga,Co+=38*El,Ro+=38*Al,So+=38*Ol,mo+=38*Wl,To+=38*zl,Do=1,No=Fo+Do+65535,Do=Math.floor(No/65536),Fo=No-Do*65536,No=Xo+Do+65535,Do=Math.floor(No/65536),Xo=No-Do*65536,No=Lo+Do+65535,Do=Math.floor(No/65536),Lo=No-Do*65536,No=Bo+Do+65535,Do=Math.floor(No/65536),Bo=No-Do*65536,No=xo+Do+65535,Do=Math.floor(No/65536),xo=No-Do*65536,No=uo+Do+65535,Do=Math.floor(No/65536),uo=No-Do*65536,No=po+Do+65535,Do=Math.floor(No/65536),po=No-Do*65536,No=bo+Do+65535,Do=Math.floor(No/65536),bo=No-Do*65536,No=_o+Do+65535,Do=Math.floor(No/65536),_o=No-Do*65536,No=$o+Do+65535,Do=Math.floor(No/65536),$o=No-Do*65536,No=Co+Do+65535,Do=Math.floor(No/65536),Co=No-Do*65536,No=Ro+Do+65535,Do=Math.floor(No/65536),Ro=No-Do*65536,No=So+Do+65535,Do=Math.floor(No/65536),So=No-Do*65536,No=mo+Do+65535,Do=Math.floor(No/65536),mo=No-Do*65536,No=To+Do+65535,Do=Math.floor(No/65536),To=No-Do*65536,No=Vo+Do+65535,Do=Math.floor(No/65536),Vo=No-Do*65536,Fo+=Do-1+37*(Do-1),Do=1,No=Fo+Do+65535,Do=Math.floor(No/65536),Fo=No-Do*65536,No=Xo+Do+65535,Do=Math.floor(No/65536),Xo=No-Do*65536,No=Lo+Do+65535,Do=Math.floor(No/65536),Lo=No-Do*65536,No=Bo+Do+65535,Do=Math.floor(No/65536),Bo=No-Do*65536,No=xo+Do+65535,Do=Math.floor(No/65536),xo=No-Do*65536,No=uo+Do+65535,Do=Math.floor(No/65536),uo=No-Do*65536,No=po+Do+65535,Do=Math.floor(No/65536),po=No-Do*65536,No=bo+Do+65535,Do=Math.floor(No/65536),bo=No-Do*65536,No=_o+Do+65535,Do=Math.floor(No/65536),_o=No-Do*65536,No=$o+Do+65535,Do=Math.floor(No/65536),$o=No-Do*65536,No=Co+Do+65535,Do=Math.floor(No/65536),Co=No-Do*65536,No=Ro+Do+65535,Do=Math.floor(No/65536),Ro=No-Do*65536,No=So+Do+65535,Do=Math.floor(No/65536),So=No-Do*65536,No=mo+Do+65535,Do=Math.floor(No/65536),mo=No-Do*65536,No=To+Do+65535,Do=Math.floor(No/65536),To=No-Do*65536,No=Vo+Do+65535,Do=Math.floor(No/65536),Vo=No-Do*65536,Fo+=Do-1+37*(Do-1),Po[0]=Fo,Po[1]=Xo,Po[2]=Lo,Po[3]=Bo,Po[4]=xo,Po[5]=uo,Po[6]=po,Po[7]=bo,Po[8]=_o,Po[9]=$o,Po[10]=Co,Po[11]=Ro,Po[12]=So,Po[13]=mo,Po[14]=To,Po[15]=Vo}function go(Po,jo){ho(Po,jo,jo)}function yo(Po,jo){const Mo=ro();for(let No=0;No<16;No++)Mo[No]=jo[No];for(let No=253;No>=0;No--)go(Mo,Mo),No!==2&&No!==4&&ho(Mo,Mo,jo);for(let No=0;No<16;No++)Po[No]=Mo[No]}function vo(Po,jo){const Mo=new Uint8Array(32),No=new Float64Array(80),Do=ro(),Fo=ro(),Xo=ro(),Lo=ro(),Bo=ro(),xo=ro();for(let _o=0;_o<31;_o++)Mo[_o]=Po[_o];Mo[31]=Po[31]&127|64,Mo[0]&=248,co(No,jo);for(let _o=0;_o<16;_o++)Fo[_o]=No[_o];Do[0]=Lo[0]=1;for(let _o=254;_o>=0;--_o){const $o=Mo[_o>>>3]>>>(_o&7)&1;ao(Do,Fo,$o),ao(Xo,Lo,$o),lo(Bo,Do,Xo),fo(Do,Do,Xo),lo(Xo,Fo,Lo),fo(Fo,Fo,Lo),go(Lo,Bo),go(xo,Do),ho(Do,Xo,Do),ho(Xo,Fo,Bo),lo(Bo,Do,Xo),fo(Do,Do,Xo),go(Fo,Do),fo(Xo,Lo,xo),ho(Do,Xo,io),lo(Do,Do,Lo),ho(Xo,Xo,Do),ho(Do,Lo,xo),ho(Lo,Fo,No),go(Fo,Bo),ao(Do,Fo,$o),ao(Xo,Lo,$o)}for(let _o=0;_o<16;_o++)No[_o+16]=Do[_o],No[_o+32]=Xo[_o],No[_o+48]=Fo[_o],No[_o+64]=Lo[_o];const uo=No.subarray(32),po=No.subarray(16);yo(uo,uo),ho(po,po,uo);const bo=new Uint8Array(32);return so(bo,po),bo}Xr.scalarMult=vo;function wo(Po){return vo(Po,no)}Xr.scalarMultBase=wo;function Eo(Po){if(Po.length!==Xr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${Xr.SECRET_KEY_LENGTH} bytes`);const jo=new Uint8Array(Po);return{publicKey:wo(jo),secretKey:jo}}Xr.generateKeyPairFromSeed=Eo;function ko(Po){const jo=(0,eo.randomBytes)(32,Po),Mo=Eo(jo);return(0,to.wipe)(jo),Mo}Xr.generateKeyPair=ko;function Ao(Po,jo,Mo=!1){if(Po.length!==Xr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(jo.length!==Xr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const No=vo(Po,jo);if(Mo){let Do=0;for(let Fo=0;Fono+io.length,0));const to=allocUnsafe(eo);let ro=0;for(const no of Xr)to.set(no,ro),ro+=no.length;return asUint8Array(to)}function base$1(Xr,eo){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var to=new Uint8Array(256),ro=0;ro>>0,Po=new Uint8Array(Ao);Eo!==ko;){for(var jo=yo[Eo],Mo=0,No=Ao-1;(jo!==0||Mo>>0,Po[No]=jo%ao>>>0,jo=jo/ao>>>0;if(jo!==0)throw new Error("Non-zero carry");wo=Mo,Eo++}for(var Do=Ao-wo;Do!==Ao&&Po[Do]===0;)Do++;for(var Fo=so.repeat(vo);Do>>0,Ao=new Uint8Array(ko);yo[vo];){var Po=to[yo.charCodeAt(vo)];if(Po===255)return;for(var jo=0,Mo=ko-1;(Po!==0||jo>>0,Ao[Mo]=Po%256>>>0,Po=Po/256>>>0;if(Po!==0)throw new Error("Non-zero carry");Eo=jo,vo++}if(yo[vo]!==" "){for(var No=ko-Eo;No!==ko&&Ao[No]===0;)No++;for(var Do=new Uint8Array(wo+(ko-No)),Fo=wo;No!==ko;)Do[Fo++]=Ao[No++];return Do}}}function go(yo){var vo=ho(yo);if(vo)return vo;throw new Error(`Non-${eo} character`)}return{encode:fo,decodeUnsafe:ho,decode:go}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;const coerce$3=Xr=>{if(Xr instanceof Uint8Array&&Xr.constructor.name==="Uint8Array")return Xr;if(Xr instanceof ArrayBuffer)return new Uint8Array(Xr);if(ArrayBuffer.isView(Xr))return new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=Xr=>new TextEncoder().encode(Xr),toString$3=Xr=>new TextDecoder().decode(Xr);class Encoder{constructor(eo,to,ro){this.name=eo,this.prefix=to,this.baseEncode=ro}encode(eo){if(eo instanceof Uint8Array)return`${this.prefix}${this.baseEncode(eo)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(eo,to,ro){if(this.name=eo,this.prefix=to,to.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=to.codePointAt(0),this.baseDecode=ro}decode(eo){if(typeof eo=="string"){if(eo.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(eo)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(eo.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(eo){return or$3(this,eo)}}class ComposedDecoder{constructor(eo){this.decoders=eo}or(eo){return or$3(this,eo)}decode(eo){const to=eo[0],ro=this.decoders[to];if(ro)return ro.decode(eo);throw RangeError(`Unable to decode multibase string ${JSON.stringify(eo)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const or$3=(Xr,eo)=>new ComposedDecoder({...Xr.decoders||{[Xr.prefix]:Xr},...eo.decoders||{[eo.prefix]:eo}});class Codec{constructor(eo,to,ro,no){this.name=eo,this.prefix=to,this.baseEncode=ro,this.baseDecode=no,this.encoder=new Encoder(eo,to,ro),this.decoder=new Decoder(eo,to,no)}encode(eo){return this.encoder.encode(eo)}decode(eo){return this.decoder.decode(eo)}}const from=({name:Xr,prefix:eo,encode:to,decode:ro})=>new Codec(Xr,eo,to,ro),baseX=({prefix:Xr,name:eo,alphabet:to})=>{const{encode:ro,decode:no}=_brrp__multiformats_scope_baseX(to,eo);return from({prefix:Xr,name:eo,encode:ro,decode:io=>coerce$3(no(io))})},decode$5=(Xr,eo,to,ro)=>{const no={};for(let lo=0;lo=8&&(ao-=8,oo[co++]=255&so>>ao)}if(ao>=to||255&so<<8-ao)throw new SyntaxError("Unexpected end of data");return oo},encode$2=(Xr,eo,to)=>{const ro=eo[eo.length-1]==="=",no=(1<to;)oo-=to,io+=eo[no&ao>>oo];if(oo&&(io+=eo[no&ao<from({prefix:eo,name:Xr,encode(no){return encode$2(no,ro,to)},decode(no){return decode$5(no,ro,to,Xr)}}),identity$2=from({prefix:"\0",name:"identity",encode:Xr=>toString$3(Xr),decode:Xr=>fromString$1(Xr)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$2},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((Xr,eo,to)=>(Xr[to]=eo,Xr),[]),alphabetCharsToBytes=alphabet.reduce((Xr,eo,to)=>(Xr[eo.codePointAt(0)]=to,Xr),[]);function encode$1(Xr){return Xr.reduce((eo,to)=>(eo+=alphabetBytesToChars[to],eo),"")}function decode$4(Xr){const eo=[];for(const to of Xr){const ro=alphabetCharsToBytes[to.codePointAt(0)];if(ro===void 0)throw new Error(`Non-base256emoji character: ${to}`);eo.push(ro)}return new Uint8Array(eo)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode:encode$1,decode:decode$4}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(Xr,eo,to,ro){return{name:Xr,prefix:eo,encoder:{name:Xr,prefix:eo,encode:to},decoder:{decode:ro}}}const string$3=createCodec("utf8","u",Xr=>"u"+new TextDecoder("utf8").decode(Xr),Xr=>new TextEncoder().encode(Xr.substring(1))),ascii=createCodec("ascii","a",Xr=>{let eo="a";for(let to=0;to{Xr=Xr.substring(1);const eo=allocUnsafe(Xr.length);for(let to=0;to"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(Xr){return Xr!==""&&userAgentRules.reduce(function(eo,to){var ro=to[0],no=to[1];if(eo)return eo;var io=no.exec(Xr);return!!io&&[ro,io]},!1)}function parseUserAgent(Xr){var eo=matchUserAgent(Xr);if(!eo)return null;var to=eo[0],ro=eo[1];if(to==="searchbot")return new BotInfo;var no=ro[1]&&ro[1].split(".").join("_").split("_").slice(0,3);no?no.lengthao.pubkey);no.push(...oo)}return no.map(oo=>getTaprootHashesForSig(Xr,eo,to,oo,ro)).flat()}function getPrevoutTaprootKey(Xr,eo,to){const{script:ro}=getScriptAndAmountFromUtxo(Xr,eo,to);return(0,psbtutils_1.isP2TR)(ro)?ro.subarray(2,34):null}function trimTaprootSig(Xr){return Xr.length===64?Xr:Xr.subarray(0,64)}function getTaprootHashesForSig(Xr,eo,to,ro,no,io,oo){const ao=no.__TX,so=eo.sighashType||transaction_1.Transaction.SIGHASH_DEFAULT;checkSighashTypeAllowed(so,oo);const co=to.map((bo,wo)=>getScriptAndAmountFromUtxo(wo,bo,no)),lo=co.map(bo=>bo.script),uo=co.map(bo=>bo.value),ho=[];if(eo.tapInternalKey&&!io){const bo=getPrevoutTaprootKey(Xr,eo,no)||Buffer$3.from([]);if((0,bip371_1.toXOnly)(ro).equals(bo)){const wo=ao.hashForWitnessV1(Xr,lo,uo,so);ho.push({pubkey:ro,hash:wo})}}const go=(eo.tapLeafScript||[]).filter(bo=>(0,psbtutils_1.pubkeyInScript)(ro,bo.script)).map(bo=>{const wo=(0,bip341_1.tapleafHash)({output:bo.script,version:bo.leafVersion});return Object.assign({hash:wo},bo)}).filter(bo=>!io||io.equals(bo.hash)).map(bo=>{const wo=ao.hashForWitnessV1(Xr,lo,uo,transaction_1.Transaction.SIGHASH_DEFAULT,bo.hash);return{pubkey:ro,hash:wo,leafHash:bo.hash}});return ho.concat(go)}function checkSighashTypeAllowed(Xr,eo){if(eo&&eo.indexOf(Xr)<0){const to=sighashTypeToString(Xr);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${to}`)}}function getPayment(Xr,eo,to){let ro;switch(eo){case"multisig":const no=getSortedSigs(Xr,to);ro=payments.p2ms({output:Xr,signatures:no});break;case"pubkey":ro=payments.p2pk({output:Xr,signature:to[0].signature});break;case"pubkeyhash":ro=payments.p2pkh({output:Xr,pubkey:to[0].pubkey,signature:to[0].signature});break;case"witnesspubkeyhash":ro=payments.p2wpkh({output:Xr,pubkey:to[0].pubkey,signature:to[0].signature});break}return ro}function getScriptFromInput(Xr,eo,to){const ro=to.__TX,no={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(no.isP2SH=!!eo.redeemScript,no.isP2WSH=!!eo.witnessScript,eo.witnessScript)no.script=eo.witnessScript;else if(eo.redeemScript)no.script=eo.redeemScript;else if(eo.nonWitnessUtxo){const io=nonWitnessUtxoTxFromCache(to,eo,Xr),oo=ro.ins[Xr].index;no.script=io.outs[oo].script}else eo.witnessUtxo&&(no.script=eo.witnessUtxo.script);return(eo.witnessScript||(0,psbtutils_1.isP2WPKH)(no.script))&&(no.isSegwit=!0),no}function getSignersFromHD(Xr,eo,to){const ro=(0,utils_1$2.checkForInput)(eo,Xr);if(!ro.bip32Derivation||ro.bip32Derivation.length===0)throw new Error("Need bip32Derivation to sign with HD");const no=ro.bip32Derivation.map(oo=>{if(oo.masterFingerprint.equals(to.fingerprint))return oo}).filter(oo=>!!oo);if(no.length===0)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return no.map(oo=>{const ao=to.derivePath(oo.path);if(!oo.pubkey.equals(ao.publicKey))throw new Error("pubkey did not match bip32Derivation");return ao})}function getSortedSigs(Xr,eo){return payments.p2ms({output:Xr}).pubkeys.map(ro=>(eo.filter(no=>no.pubkey.equals(ro))[0]||{}).signature).filter(ro=>!!ro)}function scriptWitnessToWitnessStack(Xr){let eo=0;function to(oo){return eo+=oo,Xr.slice(eo-oo,eo)}function ro(){const oo=varuint.decode(Xr,eo);return eo+=varuint.decode.bytes,oo}function no(){return to(ro())}function io(){const oo=ro(),ao=[];for(let so=0;so{if(ro&&so.finalScriptSig&&(eo.ins[co].script=so.finalScriptSig),ro&&so.finalScriptWitness&&(eo.ins[co].witness=scriptWitnessToWitnessStack(so.finalScriptWitness)),so.witnessUtxo)no+=so.witnessUtxo.value;else if(so.nonWitnessUtxo){const lo=nonWitnessUtxoTxFromCache(to,so,co),uo=eo.ins[co].index,ho=lo.outs[uo];no+=ho.value}});const io=eo.outs.reduce((so,co)=>so+co.value,0),oo=no-io;if(oo<0)throw new Error("Outputs are spending more than Inputs");const ao=eo.virtualSize();to.__FEE=oo,to.__EXTRACTED_TX=eo,to.__FEE_RATE=Math.floor(oo/ao)}function nonWitnessUtxoTxFromCache(Xr,eo,to){const ro=Xr.__NON_WITNESS_UTXO_TX_CACHE;return ro[to]||addNonWitnessTxCache(Xr,eo,to),ro[to]}function getScriptFromUtxo(Xr,eo,to){const{script:ro}=getScriptAndAmountFromUtxo(Xr,eo,to);return ro}function getScriptAndAmountFromUtxo(Xr,eo,to){if(eo.witnessUtxo!==void 0)return{script:eo.witnessUtxo.script,value:eo.witnessUtxo.value};if(eo.nonWitnessUtxo!==void 0){const no=nonWitnessUtxoTxFromCache(to,eo,Xr).outs[to.__TX.ins[Xr].index];return{script:no.script,value:no.value}}else throw new Error("Can't find pubkey in input without Utxo data")}function pubkeyInInput(Xr,eo,to,ro){const no=getScriptFromUtxo(to,eo,ro),{meaningfulScript:io}=getMeaningfulScript(no,to,"input",eo.redeemScript,eo.witnessScript);return(0,psbtutils_1.pubkeyInScript)(Xr,io)}function pubkeyInOutput(Xr,eo,to,ro){const no=ro.__TX.outs[to].script,{meaningfulScript:io}=getMeaningfulScript(no,to,"output",eo.redeemScript,eo.witnessScript);return(0,psbtutils_1.pubkeyInScript)(Xr,io)}function redeemFromFinalScriptSig(Xr){if(!Xr)return;const eo=bscript.decompile(Xr);if(!eo)return;const to=eo[eo.length-1];if(!(!Buffer$3.isBuffer(to)||isPubkeyLike(to)||isSigLike(to)||!bscript.decompile(to)))return to}function redeemFromFinalWitnessScript(Xr){if(!Xr)return;const eo=scriptWitnessToWitnessStack(Xr),to=eo[eo.length-1];if(!(isPubkeyLike(to)||!bscript.decompile(to)))return to}function compressPubkey(Xr){if(Xr.length===65){const eo=Xr[64]&1,to=Xr.slice(0,33);return to[0]=2|eo,to}return Xr.slice()}function isPubkeyLike(Xr){return Xr.length===33&&bscript.isCanonicalPubKey(Xr)}function isSigLike(Xr){return bscript.isCanonicalScriptSignature(Xr)}function getMeaningfulScript(Xr,eo,to,ro,no){const io=(0,psbtutils_1.isP2SHScript)(Xr),oo=io&&ro&&(0,psbtutils_1.isP2WSHScript)(ro),ao=(0,psbtutils_1.isP2WSHScript)(Xr);if(io&&ro===void 0)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((ao||oo)&&no===void 0)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let so;return oo?(so=no,checkRedeemScript(eo,Xr,ro,to),checkWitnessScript(eo,ro,no,to),checkInvalidP2WSH(so)):ao?(so=no,checkWitnessScript(eo,Xr,no,to),checkInvalidP2WSH(so)):io?(so=ro,checkRedeemScript(eo,Xr,ro,to)):so=Xr,{meaningfulScript:so,type:oo?"p2sh-p2wsh":io?"p2sh":ao?"p2wsh":"raw"}}function checkInvalidP2WSH(Xr){if((0,psbtutils_1.isP2WPKH)(Xr)||(0,psbtutils_1.isP2SHScript)(Xr))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function classifyScript(Xr){return(0,psbtutils_1.isP2WPKH)(Xr)?"witnesspubkeyhash":(0,psbtutils_1.isP2PKH)(Xr)?"pubkeyhash":(0,psbtutils_1.isP2MS)(Xr)?"multisig":(0,psbtutils_1.isP2PK)(Xr)?"pubkey":"nonstandard"}function range$1(Xr){return[...Array(Xr).keys()]}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.initEccLib=Xr.Transaction=Xr.opcodes=Xr.Psbt=Xr.Block=Xr.script=Xr.payments=Xr.networks=Xr.crypto=Xr.address=void 0;const eo=address;Xr.address=eo;const to=crypto$3;Xr.crypto=to;const ro=networks$1;Xr.networks=ro;const no=payments$3;Xr.payments=no;const io=script$1;Xr.script=io;var oo=block;Object.defineProperty(Xr,"Block",{enumerable:!0,get:function(){return oo.Block}});var ao=psbt$1;Object.defineProperty(Xr,"Psbt",{enumerable:!0,get:function(){return ao.Psbt}});var so=ops;Object.defineProperty(Xr,"opcodes",{enumerable:!0,get:function(){return so.OPS}});var co=transaction;Object.defineProperty(Xr,"Transaction",{enumerable:!0,get:function(){return co.Transaction}});var lo=ecc_lib;Object.defineProperty(Xr,"initEccLib",{enumerable:!0,get:function(){return lo.initEccLib}})})(src$3);const convertNetworkTypeForPsbt=Xr=>({[BitcoinNetworkType.Mainnet]:src$3.networks.bitcoin,[BitcoinNetworkType.Testnet]:src$3.networks.testnet,[BitcoinNetworkType.Signet]:void 0})[Xr],extractAddressFromInput=(Xr,eo,to)=>{var ro;let no;if(!((ro=to.witnessUtxo)===null||ro===void 0)&&ro.script?no=to.witnessUtxo.script:to.nonWitnessUtxo&&(no=src$3.Transaction.fromBuffer(to.nonWitnessUtxo).outs[Xr.txInputs[eo].index].script),!!no)try{return src$3.address.fromOutputScript(no)}catch{throw new Error("address not found in output script")}},validateAddress=(Xr,eo,to,ro)=>{const no=extractAddressFromInput(Xr,to,ro);if(!no)throw new DynamicError(`validateAddress - input not found for the given address: ${eo}`);if(no!==eo)throw new DynamicError("validateAddress - address mismatch with index")},getSigHashType=Xr=>{var eo;if(Xr!=null&&Xr.sighashType)return Xr.sighashType;let to=!1;if(!((eo=Xr.witnessUtxo)===null||eo===void 0)&&eo.script)try{src$3.payments.p2tr({output:Xr.witnessUtxo.script}),to=!0}catch{logger$9.debug("address is not taproot")}return to?src$3.Transaction.SIGHASH_DEFAULT:src$3.Transaction.SIGHASH_ALL},validateSigHash=(Xr,eo)=>{const to=getSigHashType(eo);if(Xr!=null&&Xr.length&&!Xr.includes(to))throw new Error(`validatePsbt - sigHashType ${to} not in allowed list`)},validatePsbt=(Xr,eo,to)=>{if(to!=null&&to.length)for(const ro of to){const{address:no,signingIndexes:io,disableAddressValidation:oo=!0}=ro;if(!(io!=null&&io.length))return;if(!no)throw new Error("validatePsbt - address not provided");for(const ao of io){const so=Xr.data.inputs[ao];if(!so)throw new Error("validatePsbt - requested input not found");oo||validateAddress(Xr,no,ao,so),validateSigHash(eo,so)}}},createPsbtOptions=(Xr,eo)=>{var to;const ro={autoFinalized:!1};if(eo.signature){validatePsbt(Xr,eo.allowedSighash,eo.signature);const no=[];for(const io of eo.signature)if(!((to=io.signingIndexes)===null||to===void 0)&&to.length)for(const oo of io.signingIndexes)no.push({address:io.address,disableAddressValidation:io.disableAddressValidation,index:oo,sighashTypes:eo.allowedSighash});ro.toSignInputs=no}return ro},createSignPsbtOptionsForSatsConnect=(Xr,eo,to=!1)=>{var ro,no,io;!((ro=eo.signature)===null||ro===void 0)&&ro.length&&validatePsbt(Xr,eo.allowedSighash,eo.signature),logger$9.logVerboseTroubleshootingMessage("createSignPsbtOptionsForSatsConnect",{isLegacyConnector:to,psbtFromBase64:Xr,request:eo});const oo=((io=(no=eo.signature)===null||no===void 0?void 0:no.map(ao=>{var so;return((so=ao.signingIndexes)!==null&&so!==void 0?so:[]).map(co=>({address:ao.address,sigHash:to?getSigHashType(Xr.data.inputs[co]):eo.allowedSighash[0],signingIndexes:[co]}))}))!==null&&io!==void 0?io:[]).flat();return logger$9.logVerboseTroubleshootingMessage("createSignPsbtOptionsForSatsConnect",{inputsToSign:oo}),oo};class BitcoinSatsConnectConnector extends BitcoinWalletConnector{constructor(eo){var to,ro,no;super(eo),this.isLegacy=!1,this.currentNetwork=BitcoinNetworkType.Mainnet,!((ro=(to=eo.walletData)===null||to===void 0?void 0:to.injectedConfig)===null||ro===void 0)&&ro.length&&(this.providerId=(no=eo.walletData.injectedConfig[0].walletStandard)===null||no===void 0?void 0:no.providerId)}getGenericUserCancelledError(){const eo=new Error;return eo.code="-32000",eo}getAddresses(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=yield request("getAddresses",{purposes:[AddressPurpose.Payment,AddressPurpose.Ordinals]});if(to.status!=="success")throw to.error;const{addresses:ro}=to.result,no=ro==null?void 0:ro.find(ao=>ao.purpose===AddressPurpose.Ordinals),io=ro==null?void 0:ro.find(ao=>ao.purpose===AddressPurpose.Payment),oo=(eo=no==null?void 0:no.address)!==null&&eo!==void 0?eo:io==null?void 0:io.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:oo,ordinalsAddress:no,paymentAddress:io}),oo})}handleInAppBrowserGetAddress(){var eo;const to=findWalletBookWallet(this.walletBook,this.key),ro=(eo=to==null?void 0:to.mobile)===null||eo===void 0?void 0:eo.inAppBrowser;if(!isMobile$1()||this.isInstalledOnBrowser()||!ro||this.mobileExperience!=="in-app-browser")return!1;const io=template$1(ro)({encodedDappURI:encodeURIComponent(window.location.toString())});return window.location.href=io,!0}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(!this.handleInAppBrowserGetAddress())try{const eo=yield request("wallet_requestPermissions",void 0);if(eo.status!=="success")throw eo.error;return yield this.getAddresses()}catch{throw this.getGenericUserCancelledError()}})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){try{const ro=yield request("signMessage",{address:to,message:eo});if(ro.status!=="success")throw ro.error;return this.isHardwareWalletEnabled?JSON.stringify({signedTransaction:{data:ro.result.signature}}):ro.result.signature}catch{throw this.getGenericUserCancelledError()}})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){try{const to=yield request("sendTransfer",{recipients:[{address:eo.recipientAddress,amount:Number(eo.amount)}]});if(to.status!=="success")throw to.error;return to.result.txid}catch{throw this.getGenericUserCancelledError()}})}signTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){const{allowedSignHash:to,psbtBase64:ro,broadcast:no,inputsToSign:io}=eo,oo={allowedSignHash:to,broadcast:no,psbt:ro,signInputs:io.reduce((ao,so)=>(ao[so.address]||(ao[so.address]=[]),ao[so.address].push(...so.signingIndexes),ao),{})};logger$9.logVerboseTroubleshootingMessage("[BitcoinSatsConnectConnector] signTransaction",{signPbstPayload:oo});try{const ao=yield request("signPsbt",oo);if(ao.status!=="success")throw ao.error;return{psbtBase64:ao.result.psbt,txId:ao.result.txid}}catch{throw this.getGenericUserCancelledError()}})}signTransactions(eo){return __awaiter$i(this,void 0,void 0,function*(){const{message:to,psbts:ro,network:no}=eo;return logger$9.logVerboseTroubleshootingMessage("[BitcoinSatsConnectConnector] signTransactions",{transactions:eo}),new Promise((io,oo)=>{signMultipleTransactions({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ao,so;return(so=(ao=this.wallet)===null||ao===void 0?void 0:ao.features[SATSCONNECT_FEATURE])===null||so===void 0?void 0:so.provider}),onCancel:()=>{const ao=this.getGenericUserCancelledError();oo(ao)},onFinish:ao=>{io(ao)},payload:{message:to||"Sign Transaction",network:no,psbts:ro}})})})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;if(!(!((to=eo.allowedSighash)===null||to===void 0)&&to.length))throw new Error("allowedSighash cannot be an empty array");const ro=convertNetworkTypeForPsbt(this.currentNetwork),no=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64,{network:ro});logger$9.logVerboseTroubleshootingMessage("signPsbt",{isLegacy:this.isLegacy,psbtFromBase64:no,request:eo});const io=yield this.signTransaction({allowedSignHash:eo.allowedSighash[0],broadcast:!1,inputsToSign:createSignPsbtOptionsForSatsConnect(no,eo,this.isLegacy),psbtBase64:eo.unsignedPsbtBase64});if(!io)throw new Error("Failed to sign transaction with sats-connect");return{signedPsbt:io.psbtBase64}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;const ro=convertNetworkTypeForPsbt(this.currentNetwork),no={message:"Sign Transaction",network:{type:this.currentNetwork},psbts:[]};for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64,{network:ro}),so=createSignPsbtOptionsForSatsConnect(ao,oo,this.isLegacy);no.psbts.push({inputsToSign:so,psbtBase64:oo.unsignedPsbtBase64})}logger$9.logVerboseTroubleshootingMessage("signPsbts",no);const io=yield this.signTransactions(no);return(to=io==null?void 0:io.map(oo=>oo.psbtBase64))!==null&&to!==void 0?to:[]})}validateActiveWallet(eo){const to=Object.create(null,{validateActiveWallet:{get:()=>super.validateActiveWallet}});return __awaiter$i(this,void 0,void 0,function*(){if(this.key!=="xverse"){yield to.validateActiveWallet.call(this,eo);return}logger$9.debug("validateActiveWallet - skipping validation for xverse",{expectedAddress:eo})})}handleXverseAccountChange(){return __awaiter$i(this,void 0,void 0,function*(){const{handleAccountChange:eo}=eventListenerHandlers(this),to=yield this.getAddresses();if(!to)return;eo([to])})}setupEventListeners(){if(this.key!=="xverse"){super.setupEventListeners();return}try{const eo=addListener("accountChange",this.handleXverseAccountChange.bind(this));this.teardownEventListeners=()=>{logger$9.debug("[BitcoinSatsConnectConnector] teardownEventListeners"),eo()}}catch(eo){logger$9.debug("[BitcoinSatsConnectConnector] setupEventListeners",{connector:this.key,error:eo})}}}const hasSatsConnectFeature=Xr=>SATSCONNECT_FEATURE in Xr,supportsSatsConnect=Xr=>{var eo,to,ro,no;if(Xr.key===XVERSE_KEY)return!0;const io=(ro=(to=(eo=findWalletBookWallet(Xr.walletBook,Xr.key))===null||eo===void 0?void 0:eo.injectedConfig)===null||to===void 0?void 0:to.find(oo=>oo.chain==="btc"))===null||ro===void 0?void 0:ro.walletStandard;return!!(Xr.wallet&&hasSatsConnectFeature(Xr.wallet.features)||!((no=io==null?void 0:io.features)===null||no===void 0)&&no.includes(SATSCONNECT_FEATURE))};class MagicEdenConnector extends BitcoinSatsConnectConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"magicedenbtc"})),this.name="Magic Eden",this.overrideKey="magicedenbtc",this.isLegacy=!0}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(!this.handleInAppBrowserGetAddress())return new Promise((eo,to)=>{getAddress({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ro,no;return(no=(ro=this.wallet)===null||ro===void 0?void 0:ro.features[SATSCONNECT_FEATURE])===null||no===void 0?void 0:no.provider}),onCancel:()=>{const ro=new Error;ro.code="-32000",to(ro)},onFinish:ro=>__awaiter$i(this,void 0,void 0,function*(){var no;const{addresses:io}=ro,oo=io==null?void 0:io.find(co=>co.purpose===AddressPurpose.Ordinals),ao=io==null?void 0:io.find(co=>co.purpose===AddressPurpose.Payment),so=(no=oo==null?void 0:oo.address)!==null&&no!==void 0?no:ao==null?void 0:ao.address;yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:so,ordinalsAddress:oo,paymentAddress:ao}),eo(so)}),payload:{message:"Address for receiving Ordinals and payments",network:{type:this.currentNetwork},purposes:[AddressPurpose.Ordinals,AddressPurpose.Payment]}})})})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){if(supportsSatsConnect(this))return new Promise((ro,no)=>{signMessage$1({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var io,oo;return(oo=(io=this.wallet)===null||io===void 0?void 0:io.features[SATSCONNECT_FEATURE])===null||oo===void 0?void 0:oo.provider}),onCancel:()=>{const io=new Error;io.code="-32000",no(io)},onFinish:io=>__awaiter$i(this,void 0,void 0,function*(){if(this.isHardwareWalletEnabled)return ro(JSON.stringify({signedTransaction:{data:io}}));ro(io)}),payload:{address:to,message:eo,network:{type:this.currentNetwork}}})})})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;const ro=yield this.getAddress(),no=(to=(yield this.getAdditionalAddresses(ro)).find(io=>io.type==="payment"))===null||to===void 0?void 0:to.address;if(!(!no||!supportsSatsConnect(this)))return new Promise((io,oo)=>{sendBtcTransaction({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var ao,so;return(so=(ao=this.wallet)===null||ao===void 0?void 0:ao.features[SATSCONNECT_FEATURE])===null||so===void 0?void 0:so.provider}),onCancel:()=>{const ao=new Error;ao.code="-32000",oo(ao)},onFinish:ao=>{io(ao)},payload:{network:{type:this.currentNetwork},recipients:[{address:eo.recipientAddress,amountSats:BigInt(eo.amount)}],senderAddress:no}})})})}signTransaction(eo){return __awaiter$i(this,void 0,void 0,function*(){const{message:to,psbtBase64:ro,broadcast:no,inputsToSign:io}=eo;return new Promise((oo,ao)=>{signTransaction$1({getProvider:()=>__awaiter$i(this,void 0,void 0,function*(){var so,co;return(co=(so=this.wallet)===null||so===void 0?void 0:so.features[SATSCONNECT_FEATURE])===null||co===void 0?void 0:co.provider}),onCancel:()=>{const so=new Error;so.code="-32000",ao(so)},onFinish:so=>{oo(so)},payload:{broadcast:no,inputsToSign:io,message:to||"Sign Transaction",network:{type:this.currentNetwork},psbtBase64:ro}})})})}signTransactions(eo){return __awaiter$i(this,void 0,void 0,function*(){var to;(to=eo.message)!==null&&to!==void 0||(eo.message="Sign Transaction");const ro=lib$2.createUnsecuredToken(eo),no=this.getProvider();if(!no)throw new DynamicError("signTransactions failed: Magic Eden provider not found");return no.signMultipleTransactions(ro)})}}const sighashNumberToString=Xr=>{switch(Xr){case src$3.Transaction.SIGHASH_ALL:return"ALL";case src$3.Transaction.SIGHASH_NONE:return"NONE";case src$3.Transaction.SIGHASH_SINGLE:return"SINGLE";case src$3.Transaction.SIGHASH_ALL+src$3.Transaction.SIGHASH_ANYONECANPAY:return"ALL|ANYONECANPAY";case src$3.Transaction.SIGHASH_NONE+src$3.Transaction.SIGHASH_ANYONECANPAY:return"NONE|ANYONECANPAY";case src$3.Transaction.SIGHASH_SINGLE+src$3.Transaction.SIGHASH_ANYONECANPAY:return"SINGLE|ANYONECANPAY";default:return}},decodeBase64=Xr=>Uint8Array.from(Buffer$3.from(Xr,"base64")),encodeBase64=Xr=>Buffer$3.from(Xr).toString("base64");class PhantomConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"phantombtc"})),this.name="Phantom"}connectWithInstalledExtension(){return __awaiter$i(this,void 0,void 0,function*(){var eo,to;let ro,no;if(!((eo=this.walletMethods)===null||eo===void 0)&&eo.connect){const{accounts:oo}=yield this.walletMethods.connect();[ro,no]=oo.map(so=>({address:so.address,publicKey:Buffer$3.from(so.publicKey).toString("hex")})),no||(no=ro)}else{const oo=this.getProvider();if(!oo)return;const ao=yield oo.requestAccounts();no=ao==null?void 0:ao.find(so=>so.purpose==="ordinals"),ro=ao==null?void 0:ao.find(so=>so.purpose==="payment")}const io=(to=no==null?void 0:no.address)!==null&&to!==void 0?to:ro==null?void 0:ro.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:io,ordinalsAddress:no,paymentAddress:ro}),io})}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return this.connectWithInstalledExtension();isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){var ro;if(!((ro=this.walletMethods)===null||ro===void 0)&&ro.signMessage){const[no]=yield this.walletMethods.signMessage({account:{address:to},message:new TextEncoder().encode(eo)});return Buffer$3.from(no.signature).toString("base64")}else{const no=this.getProvider();if(!no)return;const io=yield no.signMessage(to,new TextEncoder().encode(eo));return Buffer$3.from(io.signature).toString("base64")}})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to,ro,no,io,oo;const[ao]=yield this.getConnectedAccounts();if(!ao)return;const so=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),co=createPsbtOptions(so,eo);if(!((to=this.walletMethods)===null||to===void 0)&&to.signTransaction){const[lo]=yield this.walletMethods.signTransaction({inputsToSign:(no=(ro=co.toSignInputs)===null||ro===void 0?void 0:ro.map(uo=>({account:{address:uo.address},sigHash:uo.sighashTypes&&sighashNumberToString(uo.sighashTypes[0]),signingIndexes:[uo.index]})))!==null&&no!==void 0?no:[],psbt:decodeBase64(eo.unsignedPsbtBase64)});return{signedPsbt:Buffer$3.from(lo.signedPsbt).toString("base64")}}else{const lo=this.getProvider();if(!lo)return;const uo=(oo=(io=eo.signature)===null||io===void 0?void 0:io.map(go=>{var bo;return{address:go.address,sigHash:eo.allowedSighash[0],signingIndexes:(bo=go.signingIndexes)!==null&&bo!==void 0?bo:[]}}))!==null&&oo!==void 0?oo:[],ho=yield lo.signPSBT(decodeBase64(eo.unsignedPsbtBase64),{inputsToSign:uo});return{signedPsbt:encodeBase64(Uint8Array.from(ho))}}})}}class OkxConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"okxwalletbtc"})),this.name="OKX Wallet"}get walletBookWallet(){return this.walletBook.wallets[this.key]}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){if(!this.isInstalledOnBrowser()&&isMobile$1()&&this.walletBookWallet.mobile&&this.walletBookWallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const oo=template$1(this.walletBookWallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(oo);return}const eo=this.getProvider();if(!eo)return;const{address:to,publicKey:ro}=yield eo.connect(),no={address:to,publicKey:ro};return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:to,ordinalsAddress:no}),to})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(to)return to.signMessage(eo,"bip322-simple")})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!(!(yield this.getAddress())||!to))return to.sendBitcoin(eo.recipientAddress,eo.amount.toString())})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=yield to.signPsbt(ro.toHex(),createPsbtOptions(ro,eo));return{signedPsbt:src$3.Psbt.fromHex(no).toBase64()}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=[],no=[];for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64);ro.push(ao.toHex()),no.push(createPsbtOptions(ao,oo))}return(yield to.signPsbts(ro,no)).map(oo=>src$3.Psbt.fromHex(oo).toBase64())})}}class OylConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"oylwallet"})),this.name="Oyl Wallet",this.overrideKey="oylwallet"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const to=this.getProvider();if(!to)return;const ro=yield to.getAddresses(),no=ro.taproot,io=ro.nativeSegwit,oo=(eo=no==null?void 0:no.address)!==null&&eo!==void 0?eo:io==null?void 0:io.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:oo,ordinalsAddress:no,paymentAddress:io}),oo})}signMessage(eo,to){return __awaiter$i(this,void 0,void 0,function*(){const ro=this.getProvider();if(!ro)return;const{signature:no}=yield ro.signMessage({address:to,message:eo});return no})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=createPsbtOptions(ro,eo),{psbt:io}=yield to.signPsbt({broadcast:!1,finalize:no.autoFinalized,psbt:ro.toHex()});return{signedPsbt:src$3.Psbt.fromHex(io).toBase64()}})}}class UnisatConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"unisat"})),this.name="UniSat",this.overrideKey="unisat"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){const eo=this.getProvider();if(!eo)return;const[to]=yield eo.requestAccounts(),ro=yield eo.getPublicKey(),no={address:to,publicKey:ro};return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:to,ordinalsAddress:no}),to})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(to)return to.signMessage(eo,"bip322-simple")})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!(!(yield this.getAddress())||!to))return to.sendBitcoin(eo.recipientAddress,Number(eo.amount))})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64),no=yield to.signPsbt(ro.toHex(),createPsbtOptions(ro,eo));return{signedPsbt:src$3.Psbt.fromHex(no).toBase64()}})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){const to=this.getProvider();if(!to)return;const ro=[],no=[];for(const oo of eo){const ao=src$3.Psbt.fromBase64(oo.unsignedPsbtBase64);ro.push(ao.toHex()),no.push(createPsbtOptions(ao,oo))}return(yield to.signPsbts(ro,no)).map(oo=>src$3.Psbt.fromHex(oo).toBase64())})}getConnectedAccounts(){return __awaiter$i(this,void 0,void 0,function*(){const eo=this.getProvider();return eo?eo.getAccounts():[]})}}class UnknownInjectedConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"unknown"})),this.name="Unknown",this.overrideKey="unknown"}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){})}}class FallbackBitcoinConnector extends BitcoinWalletConnector{constructor(eo){super(Object.assign(Object.assign({},eo),{overrideKey:"fallbackconnector"})),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){})}signPsbts(eo){return __awaiter$i(this,void 0,void 0,function*(){})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){})}}class BitcoinBtcKitConnector extends BitcoinWalletConnector{constructor(eo,to){super(eo),this.currentNetwork=BitcoinNetworkType.Mainnet,this.btcKit=to}getAddress(){return __awaiter$i(this,void 0,void 0,function*(){var eo;const[to]=yield this.getConnectedAccounts();if(to)return to;const ro=yield this.btcKit.request("getAddresses",{types:["p2tr","p2wpkh"]});if(!("result"in ro)){logger$9.error("Fetch public address error",ro);return}const{addresses:no}=ro.result,io=no==null?void 0:no.find(so=>so.type==="p2tr"),oo=no==null?void 0:no.find(so=>so.type==="p2wpkh"),ao=(eo=io==null?void 0:io.address)!==null&&eo!==void 0?eo:oo==null?void 0:oo.address;return yield this.setConnectedAccountWithAddresses({active:!0,mainAddress:ao,ordinalsAddress:io,paymentAddress:oo}),ao})}signMessage(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!(yield this.getConnectedAccounts()).length)return;const to=yield this.btcKit.request("signMessage",{message:eo,paymentType:"p2tr"}).catch(({error:no})=>{throw no});if(!("result"in to))throw logger$9.error("Signature error",to),new Error("Failed to sign message");const{signature:ro}=to.result;return this.isHardwareWalletEnabled?JSON.stringify({signedTransaction:{data:ro}}):ro})}sendBitcoin(eo){return __awaiter$i(this,void 0,void 0,function*(){if(!(yield this.getAddress())||!this.btcKit)return;const ro=yield this.btcKit.request("sendTransfer",{address:eo.recipientAddress,amount:eo.amount.toString(),network:this.convertNetworkTypeToNetworkMode()});if(!("result"in ro))throw logger$9.error("Transaction error",ro),new Error("Failed to send transaction");return ro.result.txid})}convertNetworkTypeToNetworkMode(){return this.currentNetwork===BitcoinNetworkType.Mainnet?"mainnet":"testnet"}signPsbt(eo){return __awaiter$i(this,void 0,void 0,function*(){var to,ro;if(!(yield this.getAddress())||!this.btcKit)return;const io=convertNetworkTypeForPsbt(this.currentNetwork),oo=src$3.Psbt.fromBase64(eo.unsignedPsbtBase64,{network:io});!((to=eo.signature)===null||to===void 0)&&to.length&&validatePsbt(oo,eo.allowedSighash,eo.signature);const ao={allowedSighash:eo.allowedSighash,hex:oo.toHex(),signAtIndex:(ro=eo.signature)===null||ro===void 0?void 0:ro.flatMap(lo=>lo.signingIndexes).filter(Number.isInteger)},so=yield this.btcKit.request("signPsbt",Object.assign({broadcast:!1,network:this.convertNetworkTypeToNetworkMode()},ao));if(!so||!("result"in so)||!("hex"in so.result))throw new Error("signPsbt - failed to sign PSBT");const co=so.result.hex;return{signedPsbt:src$3.Psbt.fromHex(co,{network:io}).toBase64()}})}}const fetchBtcKitConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).map(([to,ro])=>{var no,io;const oo=(no=ro.injectedConfig)===null||no===void 0?void 0:no.find(so=>so.chain==="btc"&&so.providerInterface===BTCKIT_INTERFACE);if(!(!((io=oo==null?void 0:oo.windowLocations)===null||io===void 0)&&io.length))return;const ao=getProvidersFromWindow(oo.windowLocations[0]);return class extends BitcoinBtcKitConnector{constructor(so){super(Object.assign(Object.assign({},so),{overrideKey:to,walletData:ro}),ao==null?void 0:ao[0]),this.name=ro.shortName||ro.name}}}).filter(to=>!!to)},fetchSatsConnectConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;return(no=ro.injectedConfig)===null||no===void 0?void 0:no.find(io=>{var oo,ao;return io.chain==="btc"&&((oo=io.walletStandard)===null||oo===void 0?void 0:oo.features.includes(SATSCONNECT_FEATURE))&&((ao=io.walletStandard)===null||ao===void 0?void 0:ao.providerId)})}).map(([to,ro])=>{const{shortName:no}=ro,io=no||ro.name;return class extends BitcoinSatsConnectConnector{constructor(oo){super(Object.assign(Object.assign({},oo),{overrideKey:to,walletData:ro})),this.name=io}}})};assertPackageVersion("@dynamic-labs/bitcoin",version$j);const BitcoinWalletConnectors=Xr=>[...fetchSatsConnectConnectors(Xr),...fetchBtcKitConnectors(Xr),MagicEdenConnector,PhantomConnector,OkxConnector,OylConnector,UnisatConnector,UnknownInjectedConnector,FallbackBitcoinConnector];var version$h="3.5.1";function __awaiter$f(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class CosmosWallet extends Wallet$1{getProvider(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this._connector.getProvider();if(!eo)throw new Error("unable to retrieve Cosmos provider");try{return cloneObjectWithOverrides(eo,{sendEthereumTx:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.sendEthereumTx(to,ro)}),sendTx:(to,ro,no)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.sendTx(to,ro,no)}),signAmino:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signAmino(to,ro,no,io)}),signArbitrary:(to,ro,no)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signArbitrary(to,ro,no)}),signDirect:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirect(to,ro,no,io)}),signDirectAux:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirectAux(to,ro,no,io)}),signEthereum:(to,ro,no,io)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signEthereum(to,ro,no,io)}),signICNSAdr36:(to,ro,no,io,oo)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signICNSAdr36(to,ro,no,io,oo)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Provider might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}getOfflineSigner(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this._connector.getOfflineSigner();if(!eo)throw new Error("unable to retrieve Cosmos offline signer");try{return cloneObjectWithOverrides(eo,{signAmino:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signAmino(to,ro)}),signDirect:(to,ro)=>__awaiter$f(this,void 0,void 0,function*(){return yield this.sync(),eo.signDirect(to,ro)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}}const DYNAMIC_COSMOS_NETWORK_ID="dynamic_cosmos_network_id";class CosmosWalletConnector extends WalletConnectorBase{constructor(eo){super(eo),this.ChainWallet=CosmosWallet,this.connectedChain="COSMOS",this.supportedChains=["COSMOS"],this.evmNetworks=parseCosmosNetworks(eo.cosmosNetworks),this.chainIdMapping=this.evmNetworks.map(to=>({bech32Prefix:to.bech32Prefix,cosmosNetwork:to,cosmosNetworkId:to.name,dynamicChainId:parseChainId(to.networkId)})),this._handleAccountChange=this._handleAccountChange.bind(this)}getSelectedChain(){const eo=this.chainIdMapping.find(to=>to.cosmosNetworkId===this.getChainId());return eo==null?void 0:eo.cosmosNetwork}getNetwork(){return __awaiter$f(this,void 0,void 0,function*(){var eo;return(eo=this.getSelectedChain())===null||eo===void 0?void 0:eo.chainId})}getLcdUrl(){var eo;return(eo=this.getSelectedChain())===null||eo===void 0?void 0:eo.lcdUrl}getDenom(){var eo;return(eo=this.getSelectedChain())===null||eo===void 0?void 0:eo.nativeCurrency.denom}getBalance(eo){return __awaiter$f(this,void 0,void 0,function*(){try{return(yield fetch(`${this.getLcdUrl()}/cosmos/bank/v1beta1/balances/${eo}`).then(no=>no.json())).balances.reduce((no,io)=>io.denom===this.getDenom()?Number(io.amount)/1e6:no,0).toString()}catch(to){return logger$9.error(to),"0"}})}getConnectedAccounts(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this.getAddress();return eo?[eo]:[]})}endSession(){return __awaiter$f(this,void 0,void 0,function*(){this.setChainId(null)})}getDefaultChainId(){return this.chainIdMapping.length===0||this.chainIdMapping.find(eo=>eo.cosmosNetworkId==="cosmoshub-4")?"cosmoshub-4":this.chainIdMapping[0].cosmosNetworkId}getChainId(){const eo=this.getDefaultChainId(),to=localStorage.getItem(DYNAMIC_COSMOS_NETWORK_ID);return to??eo}setChainId(eo){eo?localStorage.setItem(DYNAMIC_COSMOS_NETWORK_ID,eo):localStorage.removeItem(DYNAMIC_COSMOS_NETWORK_ID)}getAccount(){return __awaiter$f(this,void 0,void 0,function*(){var eo;if(this.getWallet()){const ro=yield(eo=yield this.getOfflineSigner())===null||eo===void 0?void 0:eo.getAccounts();if(!ro||ro.length===0){logger$9.warn("No accounts found for chain",this.getChainId());return}const[no]=ro;return no}else return})}connect(){return __awaiter$f(this,void 0,void 0,function*(){var eo;yield(eo=this.getWallet())===null||eo===void 0?void 0:eo.enable(this.chainIdMapping.map(to=>to.cosmosNetworkId))})}getAddress(){return __awaiter$f(this,void 0,void 0,function*(){yield this.connect();const eo=yield this.getAccount();return eo==null?void 0:eo.address})}getProvider(){return __awaiter$f(this,void 0,void 0,function*(){return this.getWallet()})}getOfflineSigner(){return __awaiter$f(this,void 0,void 0,function*(){var eo;return(eo=this.getWallet())===null||eo===void 0?void 0:eo.getOfflineSigner(this.getChainId())})}isInstalledOnBrowser(){return typeof this.getWallet()<"u"}_handleAccountChange(){return __awaiter$f(this,void 0,void 0,function*(){const eo=yield this.getAddress();eo&&this.emit("accountChange",{accounts:[eo]})})}signMessage(eo){return __awaiter$f(this,void 0,void 0,function*(){var to;const ro=yield this.getAddress();if(!ro)throw new Error("No address found");const no=yield(to=this.getWallet())===null||to===void 0?void 0:to.signArbitrary(this.getChainId(),ro,eo);if(!no)throw new Error("Could not sign message");const io=this.getSelectedChain();if(!io||!io.bech32Prefix)throw new Error("Could not get bech32Prefix for chain");const oo=Object.assign(Object.assign({},no),{bech32Prefix:io.bech32Prefix});return JSON.stringify(oo)})}}class KeplrWalletConnector extends CosmosWalletConnector{constructor(){super(...arguments),this.name="Keplr",this.overrideKey="keplr",this.switchNetworkOnlyFromWallet=!0}supportsNetworkSwitching(){return!0}getWallet(){if(typeof window>"u")throw new Error("Keplr is not available");return window.keplr}setupEventListeners(){window.addEventListener("keplr_keystorechange",this._handleAccountChange)}teardownEventListeners(){window.removeEventListener("keplr_keystorechange",this._handleAccountChange),this.setChainId(null)}switchNetwork(eo){return __awaiter$f(this,arguments,void 0,function*({networkChainId:to}){to&&this.chainIdMapping.forEach(ro=>{ro.dynamicChainId===to&&(this.setChainId(ro.cosmosNetworkId),this.emit("chainChange",{chain:to.toString()}))})})}}class LeapWalletConnector extends CosmosWalletConnector{constructor(){super(...arguments),this.name="leapcosmos",this.overrideKey="leapcosmos"}getWallet(){if(typeof window>"u")throw new Error("Leap is not available");return window.leap}setupEventListeners(){window.addEventListener("leap_keystorechange",this._handleAccountChange)}teardownEventListeners(){window.removeEventListener("leap_keystorechange",this._handleAccountChange),this.setChainId(null)}}class CompassWalletConnector extends CosmosWalletConnector{constructor(){super(...arguments),this.name="compasscosmos",this.overrideKey="compasscosmos"}getWallet(){if(typeof window>"u")throw new Error("Compass is not available");return window.compass}getChainId(){if(this.chainIdMapping.find(to=>to.cosmosNetworkId==="pacific-1"))return"pacific-1";throw new Error("Sei is not available on this site")}setupEventListeners(){window.addEventListener("leap_keystorechange",this._handleAccountChange)}teardownEventListeners(){window.removeEventListener("leap_keystorechange",this._handleAccountChange),this.setChainId(null)}}assertPackageVersion("@dynamic-labs/cosmos",version$h);const CosmosWalletConnectors=()=>[KeplrWalletConnector,LeapWalletConnector,CompassWalletConnector];typeof window<"u"&&(window.global=globalThis,Object.assign(window,{Buffer:Buffer$1$1}));var version$g="3.5.1",version$f="3.5.1";function __awaiter$e(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __classPrivateFieldGet$3(Xr,eo,to,ro){if(to==="a"&&!ro)throw new TypeError("Private accessor was defined without a getter");if(typeof eo=="function"?Xr!==eo||!ro:!eo.has(Xr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return to==="m"?ro:to==="a"?ro.call(Xr):ro?ro.value:eo.get(Xr)}function __classPrivateFieldSet$3(Xr,eo,to,ro,no){if(typeof eo=="function"?Xr!==eo||!no:!eo.has(Xr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no?no.value=to:eo.set(Xr,to),to}typeof SuppressedError=="function"&&SuppressedError;const DEFAULT_JWK_MEMBER_BYTE_LENGTH=32;function stringToBase64urlString(Xr){const eo=btoa$1(Xr);return base64StringToBase64UrlEncodedString(eo)}function hexStringToBase64url(Xr,eo){const to=Xr.padStart(Math.ceil(Xr.length/2)*2,"0"),ro=uint8ArrayFromHexString(to,eo);return stringToBase64urlString(ro.reduce((no,io)=>no+String.fromCharCode(io),""))}function base64StringToBase64UrlEncodedString(Xr){return Xr.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function uint8ArrayToHexString(Xr){return Xr.reduce((eo,to)=>eo+to.toString(16).padStart(2,"0"),"")}const uint8ArrayFromHexString=(Xr,eo)=>{const to=/^[0-9A-Fa-f]+$/;if(!Xr||Xr.length%2!=0||!to.test(Xr))throw new Error(`cannot create uint8array from invalid hex string: "${Xr}"`);const ro=new Uint8Array(Xr.match(/../g).map(io=>parseInt(io,16)));if(!eo)return ro;if(Xr.length/2>eo)throw new Error("hex value cannot fit in a buffer of "+eo+" byte(s)");let no=new Uint8Array(eo);return no.set(ro,eo-ro.length),no};function btoa$1(Xr){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");let eo;for(Xr=`${Xr}`,eo=0;eo255)throw new Error(`InvalidCharacterError: found code point greater than 255:${Xr.charCodeAt(eo)} at position ${eo}`);let to="";for(eo=0;eo>2,ro[1]=(Xr.charCodeAt(eo)&3)<<4,Xr.length>eo+1&&(ro[1]|=Xr.charCodeAt(eo+1)>>4,ro[2]=(Xr.charCodeAt(eo+1)&15)<<2),Xr.length>eo+2&&(ro[2]|=Xr.charCodeAt(eo+2)>>6,ro[3]=Xr.charCodeAt(eo+2)&63);for(let no=0;no"u"?to+="=":to+=btoaLookup(ro[no])}return to}function btoaLookup(Xr){const eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";if(Xr>=0&&Xr<64)return eo[Xr]}const stampHeaderName$2="X-Stamp",isCryptoEnabledBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u",isNode=typeof process$1$1<"u"&&process$1$1.versions!=null&&process$1$1.versions.node!=null,signWithApiKey=async Xr=>isCryptoEnabledBrowser?(await __vitePreload(()=>import("./webcrypto-rHL-xC2P.js"),__vite__mapDeps([0,1])).then(to=>to.signWithApiKey))(Xr):isNode?(await __vitePreload(()=>import("./nodecrypto-DQxL8Shd.js"),__vite__mapDeps([2,1])).then(to=>to.signWithApiKey))(Xr):(await __vitePreload(()=>import("./purejs-BR1xntTC.js"),[]).then(to=>to.signWithApiKey))(Xr);class ApiKeyStamper{constructor(eo){this.apiPublicKey=eo.apiPublicKey,this.apiPrivateKey=eo.apiPrivateKey}async stamp(eo){const to=await signWithApiKey({publicKey:this.apiPublicKey,privateKey:this.apiPrivateKey,content:eo}),ro={publicKey:this.apiPublicKey,scheme:"SIGNATURE_SCHEME_TK_API_P256",signature:to};return{stampHeaderName:stampHeaderName$2,stampHeaderValue:stringToBase64urlString(JSON.stringify(ro))}}}const base64UrlEncode=Xr=>Buffer$3.from(Xr).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),generateRandomBuffer=()=>{const Xr=new Uint8Array(32);return crypto.getRandomValues(Xr),Xr.buffer},transportMap={AUTHENTICATOR_TRANSPORT_BLE:AuthenticatorTransportProtocol.Ble,AUTHENTICATOR_TRANSPORT_HYBRID:AuthenticatorTransportProtocol.Hybrid,AUTHENTICATOR_TRANSPORT_INTERNAL:AuthenticatorTransportProtocol.Internal,AUTHENTICATOR_TRANSPORT_NFC:AuthenticatorTransportProtocol.Nfc,AUTHENTICATOR_TRANSPORT_USB:AuthenticatorTransportProtocol.Usb},convertAttestationTransports=Xr=>Xr.map(eo=>transportMap[eo]),TURNKEY_API_BASE_URL="https://api.turnkey.com",TURNKEY_API_KEY_EXPIRY_MESSAGE="Turnkey error 16: expired api key",TURNKEY_API_KEY_NOT_FOUND_MESSAGE="Turnkey error 16: could not find public key",WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE="The operation either timed out or was not allowed",WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",INVALID_PASSKEY_SELECTED_ERROR_MESSAGE="Turnkey error 5: webauthn authenticator not found in organization or parent organization",USER_CANCELLED_REQUEST_ERROR_MESSAGE="The user cancelled the request",TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS=[TURNKEY_API_KEY_EXPIRY_MESSAGE,TURNKEY_API_KEY_NOT_FOUND_MESSAGE],TURNKEY_SDK_BENIGN_ERRORS=[WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,INVALID_PASSKEY_SELECTED_ERROR_MESSAGE,USER_CANCELLED_REQUEST_ERROR_MESSAGE];class DynamicEmbeddedWalletsLogger extends Logger$2{constructor(eo,to){super(eo,to)}error(eo,...to){const[ro]=to;!(ro!=null&&ro.message)||!TURNKEY_SDK_BENIGN_ERRORS.some(no=>ro.message.includes(no))?(Logger$2.events.emit("error",eo),this.log(LogLevel.ERROR,eo,...to)):this.warn(eo,...to)}}const logger$6=new DynamicEmbeddedWalletsLogger("Dynamic embedded wallets",LogLevel.INFO),stampHeaderName$1="X-Stamp";var IframeEventType;(function(Xr){Xr.PublicKeyReady="PUBLIC_KEY_READY",Xr.InjectCredentialBundle="INJECT_CREDENTIAL_BUNDLE",Xr.InjectKeyExportBundle="INJECT_KEY_EXPORT_BUNDLE",Xr.InjectWalletExportBundle="INJECT_WALLET_EXPORT_BUNDLE",Xr.InjectImportBundle="INJECT_IMPORT_BUNDLE",Xr.ExtractWalletEncryptedBundle="EXTRACT_WALLET_ENCRYPTED_BUNDLE",Xr.ExtractKeyEncryptedBundle="EXTRACT_KEY_ENCRYPTED_BUNDLE",Xr.ApplySettings="APPLY_SETTINGS",Xr.BundleInjected="BUNDLE_INJECTED",Xr.EncryptedBundleExtracted="ENCRYPTED_BUNDLE_EXTRACTED",Xr.SettingsApplied="SETTINGS_APPLIED",Xr.StampRequest="STAMP_REQUEST",Xr.Stamp="STAMP",Xr.Error="ERROR"})(IframeEventType||(IframeEventType={}));var KeyFormat;(function(Xr){Xr.Hexadecimal="HEXADECIMAL",Xr.Solana="SOLANA"})(KeyFormat||(KeyFormat={}));class IframeStamper{constructor(eo){if(typeof window>"u")throw new Error("Cannot initialize iframe in non-browser environment");if(!eo.iframeContainer)throw new Error("Iframe container cannot be found");if(this.container=eo.iframeContainer,this.container.querySelector(`#${eo.iframeElementId}`))throw new Error(`Iframe element with ID ${eo.iframeElementId} already exists`);let to=window.document.createElement("iframe");to.setAttribute("sandbox","allow-scripts allow-same-origin"),to.id=eo.iframeElementId,to.src=eo.iframeUrl,this.iframe=to;const ro=new URL(eo.iframeUrl);this.iframeOrigin=ro.origin,this.iframePublicKey=null}async init(){return this.container.appendChild(this.iframe),new Promise((eo,to)=>{window.addEventListener("message",ro=>{var no;ro.origin===this.iframeOrigin&&((no=ro.data)==null?void 0:no.type)===IframeEventType.PublicKeyReady&&(this.iframePublicKey=ro.data.value,eo(ro.data.value))},!1)})}clear(){this.iframe.remove()}publicKey(){return this.iframePublicKey}async injectCredentialBundle(eo){return new Promise((to,ro)=>{var no;(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectCredentialBundle,value:eo},"*"),window.addEventListener("message",io=>{var oo,ao;io.origin===this.iframeOrigin&&(((oo=io.data)==null?void 0:oo.type)===IframeEventType.BundleInjected&&to(io.data.value),((ao=io.data)==null?void 0:ao.type)===IframeEventType.Error&&ro(io.data.value))},!1)})}async injectKeyExportBundle(eo,to,ro){var no;return(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectKeyExportBundle,value:eo,keyFormat:ro,organizationId:to},"*"),new Promise((io,oo)=>{window.addEventListener("message",ao=>{var so,co;ao.origin===this.iframeOrigin&&(((so=ao.data)==null?void 0:so.type)===IframeEventType.BundleInjected&&io(ao.data.value),((co=ao.data)==null?void 0:co.type)===IframeEventType.Error&&oo(ao.data.value))},!1)})}async injectWalletExportBundle(eo,to){var ro;return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.InjectWalletExportBundle,value:eo,organizationId:to},"*"),new Promise((no,io)=>{window.addEventListener("message",oo=>{var ao,so;oo.origin===this.iframeOrigin&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.BundleInjected&&no(oo.data.value),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}async injectImportBundle(eo,to,ro){var no;return(no=this.iframe.contentWindow)==null||no.postMessage({type:IframeEventType.InjectImportBundle,value:eo,organizationId:to,userId:ro},"*"),new Promise((io,oo)=>{window.addEventListener("message",ao=>{var so,co;ao.origin===this.iframeOrigin&&(((so=ao.data)==null?void 0:so.type)===IframeEventType.BundleInjected&&io(ao.data.value),((co=ao.data)==null?void 0:co.type)===IframeEventType.Error&&oo(ao.data.value))},!1)})}async extractWalletEncryptedBundle(){var eo;return(eo=this.iframe.contentWindow)==null||eo.postMessage({type:IframeEventType.ExtractWalletEncryptedBundle},"*"),new Promise((to,ro)=>{window.addEventListener("message",no=>{var io,oo;no.origin===this.iframeOrigin&&(((io=no.data)==null?void 0:io.type)===IframeEventType.EncryptedBundleExtracted&&to(no.data.value),((oo=no.data)==null?void 0:oo.type)===IframeEventType.Error&&ro(no.data.value))},!1)})}async extractKeyEncryptedBundle(eo){var to;return(to=this.iframe.contentWindow)==null||to.postMessage({type:IframeEventType.ExtractKeyEncryptedBundle,keyFormat:eo},"*"),new Promise((ro,no)=>{window.addEventListener("message",io=>{var oo,ao;io.origin===this.iframeOrigin&&(((oo=io.data)==null?void 0:oo.type)===IframeEventType.EncryptedBundleExtracted&&ro(io.data.value),((ao=io.data)==null?void 0:ao.type)===IframeEventType.Error&&no(io.data.value))},!1)})}async applySettings(eo){var ro;const to=JSON.stringify(eo);return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.ApplySettings,value:to},"*"),new Promise((no,io)=>{window.addEventListener("message",oo=>{var ao,so;oo.origin===this.iframeOrigin&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.SettingsApplied&&no(oo.data.value),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}async stamp(eo){var ro;if(this.iframePublicKey===null)throw new Error("null iframe public key. Have you called/awaited .init()?");const to=this.iframeOrigin;return(ro=this.iframe.contentWindow)==null||ro.postMessage({type:IframeEventType.StampRequest,value:eo},"*"),new Promise(function(no,io){window.addEventListener("message",oo=>{var ao,so;oo.origin===to&&(((ao=oo.data)==null?void 0:ao.type)===IframeEventType.Stamp&&no({stampHeaderName:stampHeaderName$1,stampHeaderValue:oo.data.value}),((so=oo.data)==null?void 0:so.type)===IframeEventType.Error&&io(oo.data.value))},!1)})}}var browserPonyfill={exports:{}};(function(Xr,eo){var to=typeof self<"u"?self:commonjsGlobal,ro=function(){function io(){this.fetch=!1,this.DOMException=to.DOMException}return io.prototype=to,new io}();(function(io){(function(oo){var ao={searchParams:"URLSearchParams"in io,iterable:"Symbol"in io&&"iterator"in Symbol,blob:"FileReader"in io&&"Blob"in io&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in io,arrayBuffer:"ArrayBuffer"in io};function so(vo){return vo&&DataView.prototype.isPrototypeOf(vo)}if(ao.arrayBuffer)var co=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],lo=ArrayBuffer.isView||function(vo){return vo&&co.indexOf(Object.prototype.toString.call(vo))>-1};function uo(vo){if(typeof vo!="string"&&(vo=String(vo)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(vo))throw new TypeError("Invalid character in header field name");return vo.toLowerCase()}function ho(vo){return typeof vo!="string"&&(vo=String(vo)),vo}function go(vo){var _o={next:function(){var So=vo.shift();return{done:So===void 0,value:So}}};return ao.iterable&&(_o[Symbol.iterator]=function(){return _o}),_o}function bo(vo){this.map={},vo instanceof bo?vo.forEach(function(_o,So){this.append(So,_o)},this):Array.isArray(vo)?vo.forEach(function(_o){this.append(_o[0],_o[1])},this):vo&&Object.getOwnPropertyNames(vo).forEach(function(_o){this.append(_o,vo[_o])},this)}bo.prototype.append=function(vo,_o){vo=uo(vo),_o=ho(_o);var So=this.map[vo];this.map[vo]=So?So+", "+_o:_o},bo.prototype.delete=function(vo){delete this.map[uo(vo)]},bo.prototype.get=function(vo){return vo=uo(vo),this.has(vo)?this.map[vo]:null},bo.prototype.has=function(vo){return this.map.hasOwnProperty(uo(vo))},bo.prototype.set=function(vo,_o){this.map[uo(vo)]=ho(_o)},bo.prototype.forEach=function(vo,_o){for(var So in this.map)this.map.hasOwnProperty(So)&&vo.call(_o,this.map[So],So,this)},bo.prototype.keys=function(){var vo=[];return this.forEach(function(_o,So){vo.push(So)}),go(vo)},bo.prototype.values=function(){var vo=[];return this.forEach(function(_o){vo.push(_o)}),go(vo)},bo.prototype.entries=function(){var vo=[];return this.forEach(function(_o,So){vo.push([So,_o])}),go(vo)},ao.iterable&&(bo.prototype[Symbol.iterator]=bo.prototype.entries);function wo(vo){if(vo.bodyUsed)return Promise.reject(new TypeError("Already read"));vo.bodyUsed=!0}function Eo(vo){return new Promise(function(_o,So){vo.onload=function(){_o(vo.result)},vo.onerror=function(){So(vo.error)}})}function $o(vo){var _o=new FileReader,So=Eo(_o);return _o.readAsArrayBuffer(vo),So}function Co(vo){var _o=new FileReader,So=Eo(_o);return _o.readAsText(vo),So}function Ro(vo){for(var _o=new Uint8Array(vo),So=new Array(_o.length),To=0;To<_o.length;To++)So[To]=String.fromCharCode(_o[To]);return So.join("")}function Oo(vo){if(vo.slice)return vo.slice(0);var _o=new Uint8Array(vo.byteLength);return _o.set(new Uint8Array(vo)),_o.buffer}function jo(){return this.bodyUsed=!1,this._initBody=function(vo){this._bodyInit=vo,vo?typeof vo=="string"?this._bodyText=vo:ao.blob&&Blob.prototype.isPrototypeOf(vo)?this._bodyBlob=vo:ao.formData&&FormData.prototype.isPrototypeOf(vo)?this._bodyFormData=vo:ao.searchParams&&URLSearchParams.prototype.isPrototypeOf(vo)?this._bodyText=vo.toString():ao.arrayBuffer&&ao.blob&&so(vo)?(this._bodyArrayBuffer=Oo(vo.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):ao.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(vo)||lo(vo))?this._bodyArrayBuffer=Oo(vo):this._bodyText=vo=Object.prototype.toString.call(vo):this._bodyText="",this.headers.get("content-type")||(typeof vo=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):ao.searchParams&&URLSearchParams.prototype.isPrototypeOf(vo)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},ao.blob&&(this.blob=function(){var vo=wo(this);if(vo)return vo;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(){return this._bodyArrayBuffer?wo(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then($o)}),this.text=function(){var vo=wo(this);if(vo)return vo;if(this._bodyBlob)return Co(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Ro(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},ao.formData&&(this.formData=function(){return this.text().then(Wo)}),this.json=function(){return this.text().then(JSON.parse)},this}var Bo=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Mo(vo){var _o=vo.toUpperCase();return Bo.indexOf(_o)>-1?_o:vo}function Fo(vo,_o){_o=_o||{};var So=_o.body;if(vo instanceof Fo){if(vo.bodyUsed)throw new TypeError("Already read");this.url=vo.url,this.credentials=vo.credentials,_o.headers||(this.headers=new bo(vo.headers)),this.method=vo.method,this.mode=vo.mode,this.signal=vo.signal,!So&&vo._bodyInit!=null&&(So=vo._bodyInit,vo.bodyUsed=!0)}else this.url=String(vo);if(this.credentials=_o.credentials||this.credentials||"same-origin",(_o.headers||!this.headers)&&(this.headers=new bo(_o.headers)),this.method=Mo(_o.method||this.method||"GET"),this.mode=_o.mode||this.mode||null,this.signal=_o.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&So)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(So)}Fo.prototype.clone=function(){return new Fo(this,{body:this._bodyInit})};function Wo(vo){var _o=new FormData;return vo.trim().split("&").forEach(function(So){if(So){var To=So.split("="),Ao=To.shift().replace(/\+/g," "),ko=To.join("=").replace(/\+/g," ");_o.append(decodeURIComponent(Ao),decodeURIComponent(ko))}}),_o}function Jo(vo){var _o=new bo,So=vo.replace(/\r?\n[\t ]+/g," ");return So.split(/\r?\n/).forEach(function(To){var Ao=To.split(":"),ko=Ao.shift().trim();if(ko){var mo=Ao.join(":").trim();_o.append(ko,mo)}}),_o}jo.call(Fo.prototype);function Po(vo,_o){_o||(_o={}),this.type="default",this.status=_o.status===void 0?200:_o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in _o?_o.statusText:"OK",this.headers=new bo(_o.headers),this.url=_o.url||"",this._initBody(vo)}jo.call(Po.prototype),Po.prototype.clone=function(){return new Po(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new bo(this.headers),url:this.url})},Po.error=function(){var vo=new Po(null,{status:0,statusText:""});return vo.type="error",vo};var fo=[301,302,303,307,308];Po.redirect=function(vo,_o){if(fo.indexOf(_o)===-1)throw new RangeError("Invalid status code");return new Po(null,{status:_o,headers:{location:vo}})},oo.DOMException=io.DOMException;try{new oo.DOMException}catch{oo.DOMException=function(_o,So){this.message=_o,this.name=So;var To=Error(_o);this.stack=To.stack},oo.DOMException.prototype=Object.create(Error.prototype),oo.DOMException.prototype.constructor=oo.DOMException}function yo(vo,_o){return new Promise(function(So,To){var Ao=new Fo(vo,_o);if(Ao.signal&&Ao.signal.aborted)return To(new oo.DOMException("Aborted","AbortError"));var ko=new XMLHttpRequest;function mo(){ko.abort()}ko.onload=function(){var Io={status:ko.status,statusText:ko.statusText,headers:Jo(ko.getAllResponseHeaders()||"")};Io.url="responseURL"in ko?ko.responseURL:Io.headers.get("X-Request-URL");var Do="response"in ko?ko.response:ko.responseText;So(new Po(Do,Io))},ko.onerror=function(){To(new TypeError("Network request failed"))},ko.ontimeout=function(){To(new TypeError("Network request failed"))},ko.onabort=function(){To(new oo.DOMException("Aborted","AbortError"))},ko.open(Ao.method,Ao.url,!0),Ao.credentials==="include"?ko.withCredentials=!0:Ao.credentials==="omit"&&(ko.withCredentials=!1),"responseType"in ko&&ao.blob&&(ko.responseType="blob"),Ao.headers.forEach(function(Io,Do){ko.setRequestHeader(Do,Io)}),Ao.signal&&(Ao.signal.addEventListener("abort",mo),ko.onreadystatechange=function(){ko.readyState===4&&Ao.signal.removeEventListener("abort",mo)}),ko.send(typeof Ao._bodyInit>"u"?null:Ao._bodyInit)})}return yo.polyfill=!0,io.fetch||(io.fetch=yo,io.Headers=bo,io.Request=Fo,io.Response=Po),oo.Headers=bo,oo.Request=Fo,oo.Response=Po,oo.fetch=yo,Object.defineProperty(oo,"__esModule",{value:!0}),oo})({})})(ro),ro.fetch.ponyfill=!0,delete ro.fetch.polyfill;var no=ro;eo=no.fetch,eo.default=no.fetch,eo.fetch=no.fetch,eo.Headers=no.Headers,eo.Request=no.Request,eo.Response=no.Response,Xr.exports=eo})(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports;const fetchTransport=getDefaultExportFromCjs$2(browserPonyfillExports),fetch$2=browserPonyfillExports.fetch;class TurnkeyRequestError extends Error{constructor(eo){let to=`Turnkey error ${eo.code}: ${eo.message}`;eo.details!=null&&(to+=` (Details: ${JSON.stringify(eo.details)})`),super(to),this.name="TurnkeyRequestError",this.details=eo.details??null,this.code=eo.code}}const VERSION$3="@turnkey/http@2.12.2";class TurnkeyClient{constructor(eo,to){if(this.getActivity=async ro=>this.request("/public/v1/query/get_activity",ro),this.stampGetActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getApiKey=async ro=>this.request("/public/v1/query/get_api_key",ro),this.stampGetApiKey=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_api_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getApiKeys=async ro=>this.request("/public/v1/query/get_api_keys",ro),this.stampGetApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAttestationDocument=async ro=>this.request("/public/v1/query/get_attestation",ro),this.stampGetAttestationDocument=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_attestation",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAuthenticator=async ro=>this.request("/public/v1/query/get_authenticator",ro),this.stampGetAuthenticator=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_authenticator",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getAuthenticators=async ro=>this.request("/public/v1/query/get_authenticators",ro),this.stampGetAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOauthProviders=async ro=>this.request("/public/v1/query/get_oauth_providers",ro),this.stampGetOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOrganization=async ro=>this.request("/public/v1/query/get_organization",ro),this.stampGetOrganization=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_organization",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getOrganizationConfigs=async ro=>this.request("/public/v1/query/get_organization_configs",ro),this.stampGetOrganizationConfigs=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_organization_configs",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPolicy=async ro=>this.request("/public/v1/query/get_policy",ro),this.stampGetPolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPrivateKey=async ro=>this.request("/public/v1/query/get_private_key",ro),this.stampGetPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getUser=async ro=>this.request("/public/v1/query/get_user",ro),this.stampGetUser=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWallet=async ro=>this.request("/public/v1/query/get_wallet",ro),this.stampGetWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/query/get_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getActivities=async ro=>this.request("/public/v1/query/list_activities",ro),this.stampGetActivities=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_activities",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPolicies=async ro=>this.request("/public/v1/query/list_policies",ro),this.stampGetPolicies=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_policies",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.listPrivateKeyTags=async ro=>this.request("/public/v1/query/list_private_key_tags",ro),this.stampListPrivateKeyTags=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_private_key_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getPrivateKeys=async ro=>this.request("/public/v1/query/list_private_keys",ro),this.stampGetPrivateKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_private_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getSubOrgIds=async ro=>this.request("/public/v1/query/list_suborgs",ro),this.stampGetSubOrgIds=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_suborgs",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.listUserTags=async ro=>this.request("/public/v1/query/list_user_tags",ro),this.stampListUserTags=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_user_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getUsers=async ro=>this.request("/public/v1/query/list_users",ro),this.stampGetUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWalletAccounts=async ro=>this.request("/public/v1/query/list_wallet_accounts",ro),this.stampGetWalletAccounts=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_wallet_accounts",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWallets=async ro=>this.request("/public/v1/query/list_wallets",ro),this.stampGetWallets=async ro=>{const no=this.config.baseUrl+"/public/v1/query/list_wallets",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.getWhoami=async ro=>this.request("/public/v1/query/whoami",ro),this.stampGetWhoami=async ro=>{const no=this.config.baseUrl+"/public/v1/query/whoami",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.approveActivity=async ro=>this.request("/public/v1/submit/approve_activity",ro),this.stampApproveActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/approve_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createApiKeys=async ro=>this.request("/public/v1/submit/create_api_keys",ro),this.stampCreateApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createApiOnlyUsers=async ro=>this.request("/public/v1/submit/create_api_only_users",ro),this.stampCreateApiOnlyUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_api_only_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createAuthenticators=async ro=>this.request("/public/v1/submit/create_authenticators",ro),this.stampCreateAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createInvitations=async ro=>this.request("/public/v1/submit/create_invitations",ro),this.stampCreateInvitations=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_invitations",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createOauthProviders=async ro=>this.request("/public/v1/submit/create_oauth_providers",ro),this.stampCreateOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPolicies=async ro=>this.request("/public/v1/submit/create_policies",ro),this.stampCreatePolicies=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_policies",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPolicy=async ro=>this.request("/public/v1/submit/create_policy",ro),this.stampCreatePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPrivateKeyTag=async ro=>this.request("/public/v1/submit/create_private_key_tag",ro),this.stampCreatePrivateKeyTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_private_key_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createPrivateKeys=async ro=>this.request("/public/v1/submit/create_private_keys",ro),this.stampCreatePrivateKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_private_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createReadOnlySession=async ro=>this.request("/public/v1/submit/create_read_only_session",ro),this.stampCreateReadOnlySession=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_read_only_session",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createReadWriteSession=async ro=>this.request("/public/v1/submit/create_read_write_session",ro),this.stampCreateReadWriteSession=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_read_write_session",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createSubOrganization=async ro=>this.request("/public/v1/submit/create_sub_organization",ro),this.stampCreateSubOrganization=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_sub_organization",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createUserTag=async ro=>this.request("/public/v1/submit/create_user_tag",ro),this.stampCreateUserTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_user_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createUsers=async ro=>this.request("/public/v1/submit/create_users",ro),this.stampCreateUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createWallet=async ro=>this.request("/public/v1/submit/create_wallet",ro),this.stampCreateWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.createWalletAccounts=async ro=>this.request("/public/v1/submit/create_wallet_accounts",ro),this.stampCreateWalletAccounts=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/create_wallet_accounts",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteApiKeys=async ro=>this.request("/public/v1/submit/delete_api_keys",ro),this.stampDeleteApiKeys=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_api_keys",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteAuthenticators=async ro=>this.request("/public/v1/submit/delete_authenticators",ro),this.stampDeleteAuthenticators=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_authenticators",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteInvitation=async ro=>this.request("/public/v1/submit/delete_invitation",ro),this.stampDeleteInvitation=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_invitation",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteOauthProviders=async ro=>this.request("/public/v1/submit/delete_oauth_providers",ro),this.stampDeleteOauthProviders=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_oauth_providers",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deletePolicy=async ro=>this.request("/public/v1/submit/delete_policy",ro),this.stampDeletePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deletePrivateKeyTags=async ro=>this.request("/public/v1/submit/delete_private_key_tags",ro),this.stampDeletePrivateKeyTags=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_private_key_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteUserTags=async ro=>this.request("/public/v1/submit/delete_user_tags",ro),this.stampDeleteUserTags=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_user_tags",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.deleteUsers=async ro=>this.request("/public/v1/submit/delete_users",ro),this.stampDeleteUsers=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/delete_users",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.emailAuth=async ro=>this.request("/public/v1/submit/email_auth",ro),this.stampEmailAuth=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/email_auth",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportPrivateKey=async ro=>this.request("/public/v1/submit/export_private_key",ro),this.stampExportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportWallet=async ro=>this.request("/public/v1/submit/export_wallet",ro),this.stampExportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.exportWalletAccount=async ro=>this.request("/public/v1/submit/export_wallet_account",ro),this.stampExportWalletAccount=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/export_wallet_account",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.importPrivateKey=async ro=>this.request("/public/v1/submit/import_private_key",ro),this.stampImportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/import_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.importWallet=async ro=>this.request("/public/v1/submit/import_wallet",ro),this.stampImportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/import_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initImportPrivateKey=async ro=>this.request("/public/v1/submit/init_import_private_key",ro),this.stampInitImportPrivateKey=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_import_private_key",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initImportWallet=async ro=>this.request("/public/v1/submit/init_import_wallet",ro),this.stampInitImportWallet=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_import_wallet",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.initUserEmailRecovery=async ro=>this.request("/public/v1/submit/init_user_email_recovery",ro),this.stampInitUserEmailRecovery=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/init_user_email_recovery",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.oauth=async ro=>this.request("/public/v1/submit/oauth",ro),this.stampOauth=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/oauth",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.recoverUser=async ro=>this.request("/public/v1/submit/recover_user",ro),this.stampRecoverUser=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/recover_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.rejectActivity=async ro=>this.request("/public/v1/submit/reject_activity",ro),this.stampRejectActivity=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/reject_activity",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.removeOrganizationFeature=async ro=>this.request("/public/v1/submit/remove_organization_feature",ro),this.stampRemoveOrganizationFeature=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/remove_organization_feature",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.setOrganizationFeature=async ro=>this.request("/public/v1/submit/set_organization_feature",ro),this.stampSetOrganizationFeature=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/set_organization_feature",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signRawPayload=async ro=>this.request("/public/v1/submit/sign_raw_payload",ro),this.stampSignRawPayload=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_raw_payload",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signRawPayloads=async ro=>this.request("/public/v1/submit/sign_raw_payloads",ro),this.stampSignRawPayloads=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_raw_payloads",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.signTransaction=async ro=>this.request("/public/v1/submit/sign_transaction",ro),this.stampSignTransaction=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/sign_transaction",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updatePolicy=async ro=>this.request("/public/v1/submit/update_policy",ro),this.stampUpdatePolicy=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_policy",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updatePrivateKeyTag=async ro=>this.request("/public/v1/submit/update_private_key_tag",ro),this.stampUpdatePrivateKeyTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_private_key_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateRootQuorum=async ro=>this.request("/public/v1/submit/update_root_quorum",ro),this.stampUpdateRootQuorum=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_root_quorum",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateUser=async ro=>this.request("/public/v1/submit/update_user",ro),this.stampUpdateUser=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_user",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},this.updateUserTag=async ro=>this.request("/public/v1/submit/update_user_tag",ro),this.stampUpdateUserTag=async ro=>{const no=this.config.baseUrl+"/public/v1/submit/update_user_tag",io=JSON.stringify(ro),oo=await this.stamper.stamp(io);return{body:io,stamp:oo,url:no}},!eo.baseUrl)throw new Error("Missing base URL. Please verify env vars.");this.config=eo,this.stamper=to}async request(eo,to){const ro=this.config.baseUrl+eo,no=JSON.stringify(to),io=await this.stamper.stamp(no),oo=await fetch$2(ro,{method:"POST",headers:{[io.stampHeaderName]:io.stampHeaderValue,"X-Client-Version":VERSION$3},body:no,redirect:"follow"});if(!oo.ok){let so;try{so=await oo.json()}catch{throw new Error(`${oo.status} ${oo.statusText}`)}throw new TurnkeyRequestError(so)}return await oo.json()}}class TurnkeyActivityError extends Error{constructor(eo){const{message:to,cause:ro,activityId:no,activityStatus:io,activityType:oo}=eo;super(to),this.name="TurnkeyActivityError",this.activityId=no??null,this.activityStatus=io??null,this.activityType=oo??null,this.cause=ro??null}}function bufferToBase64url(Xr){const eo=new Uint8Array(Xr);let to="";for(const io of eo)to+=String.fromCharCode(io);return btoa(to).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}const copyValue="copy",convertValue="convert";function convert$1(Xr,eo,to){if(eo===copyValue)return to;if(eo===convertValue)return Xr(to);if(eo instanceof Array)return to.map(ro=>convert$1(Xr,eo[0],ro));if(eo instanceof Object){const ro={};for(const[no,io]of Object.entries(eo)){if(io.derive){const oo=io.derive(to);oo!==void 0&&(to[no]=oo)}if(!(no in to)){if(io.required)throw new Error(`Missing key: ${no}`);continue}if(to[no]==null){ro[no]=null;continue}ro[no]=convert$1(Xr,io.schema,to[no])}return ro}}function derived(Xr,eo){return{required:!0,schema:Xr,derive:eo}}function required(Xr){return{required:!0,schema:Xr}}function optional$3(Xr){return{required:!1,schema:Xr}}const simplifiedClientExtensionResultsSchema={appid:optional$3(copyValue),appidExclude:optional$3(copyValue),credProps:optional$3(copyValue)},publicKeyCredentialWithAssertion={type:required(copyValue),id:required(copyValue),rawId:required(convertValue),authenticatorAttachment:optional$3(copyValue),response:required({clientDataJSON:required(convertValue),authenticatorData:required(convertValue),signature:required(convertValue),userHandle:required(convertValue)}),clientExtensionResults:derived(simplifiedClientExtensionResultsSchema,Xr=>Xr.getClientExtensionResults())};function getResponseToJSON(Xr){return convert$1(bufferToBase64url,publicKeyCredentialWithAssertion,Xr)}async function get$3(Xr){const eo=await navigator.credentials.get(Xr);return eo.toJSON=()=>getResponseToJSON(eo),eo}const K$4=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];function createHash(Xr){return new Hash$1}let Hash$1=class{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!sharedBuffer||sharedOffset>=8e3)&&(sharedBuffer=new ArrayBuffer(8e3),sharedOffset=0),this._byte=new Uint8Array(sharedBuffer,sharedOffset,80),this._word=new Int32Array(sharedBuffer,sharedOffset,20),sharedOffset+=80}update(eo){if(typeof eo=="string")return this._utf8(eo);if(eo==null)throw new TypeError("Invalid type: "+typeof eo);const to=eo.byteOffset,ro=eo.byteLength;let no=ro/64|0,io=0;if(no&&!(to&3)&&!(this._size%64)){const ao=new Int32Array(eo.buffer,to,no*16);for(;no--;)this._int32(ao,io>>2),io+=64;this._size+=io}if(eo.BYTES_PER_ELEMENT!==1&&eo.buffer){const ao=new Uint8Array(eo.buffer,to+io,ro-io);return this._uint8(ao)}return io===ro?this:this._uint8(eo,io)}_uint8(eo,to){const{_byte:ro,_word:no}=this,io=eo.length;for(to=to|0;to=64&&this._int32(no),this._size+=ao-oo}return this}_utf8(eo){const{_byte:to,_word:ro}=this,no=eo.length;let io=this._sp;for(let oo=0;oo>>6,to[so++]=128|co&63):co<55296||co>57343?(to[so++]=224|co>>>12,to[so++]=128|co>>>6&63,to[so++]=128|co&63):io?(co=((io&1023)<<10)+(co&1023)+65536,to[so++]=240|co>>>18,to[so++]=128|co>>>12&63,to[so++]=128|co>>>6&63,to[so++]=128|co&63,io=0):io=co}so>=64&&(this._int32(ro),ro[0]=ro[16]),this._size+=so-ao}return this._sp=io,this}_int32(eo,to){let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this,uo=0;for(to=to|0;uo<16;)W$5[uo++]=swap32(eo[to++]);for(uo=16;uo<64;uo++)W$5[uo]=gamma1(W$5[uo-2])+W$5[uo-7]+gamma0(W$5[uo-15])+W$5[uo-16]|0;for(uo=0;uo<64;uo++){const ho=lo+sigma1(ao)+ch(ao,so,co)+K$4[uo]+W$5[uo]|0,go=sigma0(ro)+maj(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+ho|0,oo=io,io=no,no=ro,ro=ho+go|0}this.A=ro+this.A|0,this.B=no+this.B|0,this.C=io+this.C|0,this.D=oo+this.D|0,this.E=ao+this.E|0,this.F=so+this.F|0,this.G=co+this.G|0,this.H=lo+this.H|0}digest(eo){const{_byte:to,_word:ro}=this;let no=this._size%64|0;for(to[no++]=128;no&3;)to[no++]=0;if(no>>=2,no>14){for(;no<16;)ro[no++]=0;no=0,this._int32(ro)}for(;no<16;)ro[no++]=0;const io=this._size*8,oo=(io&4294967295)>>>0,ao=(io-oo)/4294967296;return ao&&(ro[14]=swap32(ao)),oo&&(ro[15]=swap32(oo)),this._int32(ro),eo==="hex"?this._hex():this._bin()}_hex(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so}=this;return hex32(eo)+hex32(to)+hex32(ro)+hex32(no)+hex32(io)+hex32(oo)+hex32(ao)+hex32(so)}_bin(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so,_byte:co,_word:lo}=this;return lo[0]=swap32(eo),lo[1]=swap32(to),lo[2]=swap32(ro),lo[3]=swap32(no),lo[4]=swap32(io),lo[5]=swap32(oo),lo[6]=swap32(ao),lo[7]=swap32(so),co.slice(0,32)}};const W$5=new Int32Array(64);let sharedBuffer,sharedOffset=0;const hex32=Xr=>(Xr+4294967296).toString(16).substr(-8),swapLE=Xr=>Xr<<24&4278190080|Xr<<8&16711680|Xr>>8&65280|Xr>>24&255,swapBE=Xr=>Xr,swap32=isBE()?swapBE:swapLE,ch=(Xr,eo,to)=>to^Xr&(eo^to),maj=(Xr,eo,to)=>Xr&eo|to&(Xr|eo),sigma0=Xr=>(Xr>>>2|Xr<<30)^(Xr>>>13|Xr<<19)^(Xr>>>22|Xr<<10),sigma1=Xr=>(Xr>>>6|Xr<<26)^(Xr>>>11|Xr<<21)^(Xr>>>25|Xr<<7),gamma0=Xr=>(Xr>>>7|Xr<<25)^(Xr>>>18|Xr<<14)^Xr>>>3,gamma1=Xr=>(Xr>>>17|Xr<<15)^(Xr>>>19|Xr<<13)^Xr>>>10;function isBE(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const stampHeaderName="X-Stamp-Webauthn",defaultTimeout=5*60*1e3,defaultUserVerification="preferred";class WebauthnStamper{constructor(eo){this.rpId=eo.rpId,this.timeout=eo.timeout||defaultTimeout,this.userVerification=eo.userVerification||defaultUserVerification,this.allowCredentials=eo.allowCredentials||[]}async stamp(eo){const to=getChallengeFromPayload(eo),ro={publicKey:{rpId:this.rpId,challenge:to,allowCredentials:this.allowCredentials,timeout:this.timeout,userVerification:this.userVerification}},io=(await get$3(ro)).toJSON(),oo={authenticatorData:io.response.authenticatorData,clientDataJson:io.response.clientDataJSON,credentialId:io.id,signature:io.response.signature};return{stampHeaderName,stampHeaderValue:JSON.stringify(oo)}}}function getChallengeFromPayload(Xr){const eo=createHash().update(Xr).digest("hex");return new TextEncoder().encode(eo)}var version$e="3.5.1";class WebauthnNotSupportedError extends Error{constructor(){super("Webauthn is not supported on this device")}}function __awaiter$d(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function utf8StringToBuffer(Xr){return new TextEncoder().encode(Xr)}function bufferToBase64URLString(Xr){const eo=new Uint8Array(Xr);let to="";for(const no of eo)to+=String.fromCharCode(no);return btoa(to).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(Xr){const eo=Xr.replace(/-/g,"+").replace(/_/g,"/"),to=(4-eo.length%4)%4,ro=eo.padEnd(eo.length+to,"="),no=atob(ro),io=new ArrayBuffer(no.length),oo=new Uint8Array(io);for(let ao=0;aooo.type==="public-key").length===0?new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:Xr}):new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:Xr});if(Xr.name==="SecurityError"){const io=window.location.hostname;if(isValidDomain(io)){if(to.rp.id!==io)return new WebAuthnError({message:`The RP ID "${to.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:Xr})}else return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:Xr})}else if(Xr.name==="TypeError"){if(to.user.id.byteLength<1||to.user.id.byteLength>64)return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:Xr})}else if(Xr.name==="UnknownError")return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:Xr})}return Xr}class BaseWebAuthnAbortService{createNewAbortSignal(){if(this.controller){const to=new Error("Cancelling existing WebAuthn API call for new one");to.name="AbortError",this.controller.abort(to)}const eo=new AbortController;return this.controller=eo,eo.signal}cancelCeremony(){if(this.controller){const eo=new Error("Manually cancelling existing WebAuthn API call");eo.name="AbortError",this.controller.abort(eo),this.controller=void 0}}}const WebAuthnAbortService=new BaseWebAuthnAbortService,attachments=["cross-platform","platform"];function toAuthenticatorAttachment(Xr){if(Xr&&!(attachments.indexOf(Xr)<0))return Xr}async function startRegistration(Xr){var ho;if(!browserSupportsWebAuthn())throw new Error("WebAuthn is not supported in this browser");const to={publicKey:{...Xr,challenge:base64URLStringToBuffer(Xr.challenge),user:{...Xr.user,id:utf8StringToBuffer(Xr.user.id)},excludeCredentials:(ho=Xr.excludeCredentials)==null?void 0:ho.map(toPublicKeyCredentialDescriptor)}};to.signal=WebAuthnAbortService.createNewAbortSignal();let ro;try{ro=await navigator.credentials.create(to)}catch(go){throw identifyRegistrationError({error:go,options:to})}if(!ro)throw new Error("Registration was not completed");const{id:no,rawId:io,response:oo,type:ao}=ro;let so;typeof oo.getTransports=="function"&&(so=oo.getTransports());let co;if(typeof oo.getPublicKeyAlgorithm=="function")try{co=oo.getPublicKeyAlgorithm()}catch(go){warnOnBrokenImplementation("getPublicKeyAlgorithm()",go)}let lo;if(typeof oo.getPublicKey=="function")try{const go=oo.getPublicKey();go!==null&&(lo=bufferToBase64URLString(go))}catch(go){warnOnBrokenImplementation("getPublicKey()",go)}let uo;if(typeof oo.getAuthenticatorData=="function")try{uo=bufferToBase64URLString(oo.getAuthenticatorData())}catch(go){warnOnBrokenImplementation("getAuthenticatorData()",go)}return{id:no,rawId:bufferToBase64URLString(io),response:{attestationObject:bufferToBase64URLString(oo.attestationObject),clientDataJSON:bufferToBase64URLString(oo.clientDataJSON),transports:so,publicKeyAlgorithm:co,publicKey:lo,authenticatorData:uo},type:ao,clientExtensionResults:ro.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(ro.authenticatorAttachment)}}function warnOnBrokenImplementation(Xr,eo){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${Xr}. You should report this error to them. +`,eo)}const logger$5=new Logger$2("Webauthn"),createWebauthnCredential=Xr=>__awaiter$d(void 0,void 0,void 0,function*(){if(!browserSupportsWebAuthn())throw new WebauthnNotSupportedError;let eo;try{eo=yield startRegistration(Xr)}catch(to){throw logger$5.debug("Failed to create webauthn credential",to),to}return eo}),convertTransportEnumToTurnkeyEnum=Xr=>{switch(Xr){case"internal":return"AUTHENTICATOR_TRANSPORT_INTERNAL";case"usb":return"AUTHENTICATOR_TRANSPORT_USB";case"nfc":return"AUTHENTICATOR_TRANSPORT_NFC";case"ble":return"AUTHENTICATOR_TRANSPORT_BLE";case"hybrid":return"AUTHENTICATOR_TRANSPORT_HYBRID";default:throw new Error("unsupported transport format "+Xr)}},getWebAuthnAttestationTurnkeyAdapter=Xr=>__awaiter$d(void 0,void 0,void 0,function*(){var eo,to;if(!Xr.publicKey)throw new Error("Invalid options. Public key attribute must be defined");const ro=Object.assign(Object.assign({},Xr.publicKey),{challenge:bufferSourceToString(Xr.publicKey.challenge),excludeCredentials:(eo=Xr.publicKey.excludeCredentials)===null||eo===void 0?void 0:eo.map(io=>Object.assign(Object.assign({},io),{id:bufferSourceToString(io.id)})),user:Object.assign(Object.assign({},Xr.publicKey.user),{id:bufferSourceToString(Xr.publicKey.user.id)})}),no=yield createWebauthnCredential(ro);return{attestationObject:no.response.attestationObject,clientDataJson:no.response.clientDataJSON,credentialId:no.rawId,transports:((to=no.response.transports)===null||to===void 0?void 0:to.map(convertTransportEnumToTurnkeyEnum))||[]}}),bufferSourceToString=Xr=>{if(Xr instanceof ArrayBuffer)return bufferToBase64URLString(Xr);{const eo=new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);return bufferToBase64URLString(eo)}};assertPackageVersion("@dynamic-labs/webauthn",version$e);const createTurnkeyPasskeyService=()=>({createWebauthnStamper:Xr=>new WebauthnStamper(Xr),getWebAuthnAttestation:getWebAuthnAttestationTurnkeyAdapter});var _a,_PasskeyService_implementation;class PasskeyService{static get implementation(){return __classPrivateFieldGet$3(_a,_a,"f",_PasskeyService_implementation)?__classPrivateFieldGet$3(_a,_a,"f",_PasskeyService_implementation):createTurnkeyPasskeyService()}static set implementation(eo){__classPrivateFieldSet$3(_a,_a,eo,"f",_PasskeyService_implementation)}static get getWebAuthnAttestation(){return _a.implementation.getWebAuthnAttestation}static get createWebauthnStamper(){return _a.implementation.createWebauthnStamper}}_a=PasskeyService;_PasskeyService_implementation={value:void 0};const turnkeyBaseUrl$1="https://api.turnkey.com",turnkeyPasskeyRecoveryUrl="https://recovery.turnkey.com",turnkeyEmailRecoveryUrl="https://auth.turnkey.com",TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS=900,TURNKEY_SESSION_EXPIRATION_SECONDS=1800,EMAIL_AUTH_CREDENTIAL_TYPE="CREDENTIAL_TYPE_API_KEY_P256",PASSKEY_RECOVERY_CREDENTIAL_TYPE="CREDENTIAL_TYPE_RECOVER_USER_KEY_P256";class TurnkeyAuthenticatorRecoveryHandler{constructor(){this.isSessionActive=()=>!this.__createdAt||this.__recoveryType!=="email"?!1:this.isExpired(this.__createdAt,this.__sessionExpiration||TURNKEY_SESSION_EXPIRATION_SECONDS)?(this.clear(),!1):!0,this.isValidCode=eo=>__awaiter$e(this,void 0,void 0,function*(){var to,ro,no,io;if(!eo||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");const oo=yield(to=this.__client)===null||to===void 0?void 0:to.getUser({organizationId:eo,userId:this.__turnkeyRecoveryUserId}),ao={email:EMAIL_AUTH_CREDENTIAL_TYPE,passkey:PASSKEY_RECOVERY_CREDENTIAL_TYPE},so=(io=(no=(ro=oo==null?void 0:oo.user)===null||ro===void 0?void 0:ro.apiKeys)===null||no===void 0?void 0:no.filter(lo=>lo.credential.type===ao[this.__recoveryType]))===null||io===void 0?void 0:io.pop();return!so||this.isExpired(parseInt(so.createdAt.seconds,10),TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS)?!1:(this.__createdAt=parseInt(so.createdAt.seconds,10),!0)}),this.isExpired=(eo,to)=>{const ro=eo+to,no=new Date(ro*1e3);return new Date>=no}}get publicKey(){return this.__publicKey}get client(){return this.__client}get recoveryType(){return this.__recoveryType}get recoveryUserId(){return this.__turnkeyRecoveryUserId||""}set recoveryUserId(eo){this.__turnkeyRecoveryUserId=eo}clear(){var eo;(eo=this.__iframeStamper)===null||eo===void 0||eo.clear(),this.__recoveryType=void 0,this.__iframeStamper=void 0,this.__publicKey=void 0,this.__client=void 0,this.__turnkeyRecoveryUserId=void 0,this.__createdAt=void 0}initRecovery(eo,to,ro,no){return __awaiter$e(this,void 0,void 0,function*(){this.__recoveryType&&this.clear(),this.__sessionExpiration=no,this.__recoveryType=eo;const io=eo==="passkey"?turnkeyPasskeyRecoveryUrl:turnkeyEmailRecoveryUrl;return this.__iframeStamper=new IframeStamper({iframeContainer:to,iframeElementId:ro,iframeUrl:io}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),this.__publicKey})}verifyRecoveryCode(eo,to){return __awaiter$e(this,void 0,void 0,function*(){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{if(yield this.__iframeStamper.injectCredentialBundle(eo),this.__client=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},this.__iframeStamper),!to||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");if(!(yield this.isValidCode(to)))throw new DynamicError("The code is invalid or expired.")}catch(ro){throw logger$6.error("Error while verifying recovery code",ro),ro instanceof DynamicError?ro:new DynamicError("The code is invalid or expired.")}})}completeRecovery(eo){return __awaiter$e(this,arguments,void 0,function*({attestation:to,challenge:ro,turnkeySubOrganizationId:no}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.recoverUser({organizationId:no,parameters:{authenticator:{attestation:to,authenticatorName:"Passkey",challenge:ro},userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_RECOVER_USER"})}catch(io){throw logger$6.error("[TK] Error while completing recovery process",io),io}})}addPasskeyAuthenticator(eo){return __awaiter$e(this,arguments,void 0,function*({attestation:to,challenge:ro,turnkeySubOrganizationId:no}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.createAuthenticators({organizationId:no,parameters:{authenticators:[{attestation:to,authenticatorName:"Passkey",challenge:ro}],userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"})}catch(io){throw logger$6.error("[TK] Error while creating new authenticator",io),io}})}addEmailRecovery(eo){return __awaiter$e(this,arguments,void 0,function*({organizationId:to,email:ro,turnkeyUserId:no}){let io=getTLD();io||(io=PlatformService.getHostname());const oo=PasskeyService.createWebauthnStamper({rpId:io}),ao=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},oo);try{return{signedRequest:yield ao.stampUpdateUser({organizationId:to,parameters:{userEmail:ro,userId:no,userTagIds:[]},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_UPDATE_USER"}),userId:no}}catch(so){throw logger$6.error("Error while adding email recovery",so),so}})}}const turnkeyAuthenticatorRecoveryHandler=new TurnkeyAuthenticatorRecoveryHandler,turnkeyBaseUrl="https://api.turnkey.com",turnkeyExportUrl="https://export.turnkey.com";class ExportHandler{get publicKey(){return this.__publicKey}clear(){var eo;(eo=this.__iframeStamper)===null||eo===void 0||eo.clear(),this.__iframeStamper=void 0,this.__publicKey=void 0,this.__turnkeyClient=void 0}initExport(eo,to){return __awaiter$e(this,void 0,void 0,function*(){if(this.__iframeStamper=new IframeStamper({iframeContainer:eo,iframeElementId:to,iframeUrl:turnkeyExportUrl}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),turnkeyAuthenticatorRecoveryHandler.isSessionActive())this.__turnkeyClient=turnkeyAuthenticatorRecoveryHandler.client;else{let ro=getTLD();ro||(ro=PlatformService.getHostname());const no=PasskeyService.createWebauthnStamper({rpId:ro}),io=ExportHandler==null?void 0:ExportHandler.apiKeyStamper,oo=io??no;this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},oo)}return this.__publicKey})}verifyExportWallet(eo){return __awaiter$e(this,arguments,void 0,function*({exportBundle:to,organizationId:ro}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{return yield this.__iframeStamper.injectWalletExportBundle(to,ro)}catch(no){throw logger$6.error("Error while verifying export wallet",no),no}})}verifyExportPrivateKey(eo){return __awaiter$e(this,arguments,void 0,function*({exportBundle:to,organizationId:ro,chain:no}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");const io=no==="solana"||no==="SOL"?KeyFormat.Solana:KeyFormat.Hexadecimal;try{return yield this.__iframeStamper.injectKeyExportBundle(to,ro,io)}catch(oo){throw logger$6.error("Error while verifying export private key",oo),oo}})}exportPrivateKey(eo){return __awaiter$e(this,arguments,void 0,function*({privateKeyId:to,organizationId:ro}){const no=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(no&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},no)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!to)throw new DynamicError("Cannot proceed with your request");try{return(yield this.__turnkeyClient.exportPrivateKey({organizationId:ro,parameters:{privateKeyId:to,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"})).activity}catch(io){throw logger$6.error("[TK] Error while completing export private key process",io),io}})}exportWallet(eo){return __awaiter$e(this,arguments,void 0,function*({walletId:to,organizationId:ro,address:no}){const io=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(io&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},io)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!to)throw new DynamicError("Cannot proceed with your request");try{return no?(yield this.__turnkeyClient.exportWalletAccount({organizationId:ro,parameters:{address:no,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"})).activity:(yield this.__turnkeyClient.exportWallet({organizationId:ro,parameters:{targetPublicKey:this.__publicKey,walletId:to},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET"})).activity}catch(oo){throw logger$6.error("[TK] Error while completing export wallet process",oo),oo}})}}class TurnkeyWalletConnectorBase extends WalletConnectorBase{constructor(eo,to){if(super(to),this.requiresNonDynamicEmailOtp=!1,this.isEmbeddedWallet=!0,this.removeSessionKeys=()=>__awaiter$e(this,void 0,void 0,function*(){TurnkeyWalletConnectorBase.sessionKeys=void 0,TurnkeyWalletConnectorBase.apiKeyStamper=void 0,ExportHandler.apiKeyStamper=void 0,typeof(this===null||this===void 0?void 0:this.removeSessionKeysFunction)=="function"&&this.removeSessionKeysFunction()}),!to.appName)throw new Error("appName not set");this.name=eo.name,this.overrideKey=eo.key,this.appName=to.appName,this.__authenticatorMethodHandler=turnkeyAuthenticatorRecoveryHandler,this.__exportHandler=new ExportHandler}getWebAuthnAttestation(){return __awaiter$e(this,void 0,void 0,function*(){const eo=generateRandomBuffer(),to=generateRandomBuffer(),{email:ro,passkeyIdentifier:no}=this;if(!ro&&!no)throw new Error("Email or passkeyIdentifier must be set to register a webauthn credential.");const io=ro||`${this.appName} - ${no}`,oo={publicKey:{authenticatorSelection:{authenticatorAttachment:void 0,requireResidentKey:!1,residentKey:"preferred",userVerification:"discouraged"},challenge:eo,pubKeyCredParams:[{alg:-7,type:"public-key"}],rp:{id:getTLD(),name:this.appName},user:{displayName:io,id:to,name:ro||`${this.appName} - ${no}`}}};let ao;try{ao=yield PasskeyService.getWebAuthnAttestation(oo)}catch(so){logger$6.warn(`Unable to register webauthn credential on the current page's TLD ${getTLD()}. Falling back to using hostname. ${PlatformService.getHostname()}`,so),oo.publicKey.rp.id=PlatformService.getHostname(),ao=yield PasskeyService.getWebAuthnAttestation(oo)}return{attestation:{attestationObject:ao.attestationObject,clientDataJson:ao.clientDataJson,credentialId:ao.credentialId,transports:convertAttestationTransports(ao.transports)},challenge:base64UrlEncode(eo),displayName:io}})}getAuthenticatorHandler(){return this.__authenticatorMethodHandler}getExportHandler(){return this.__exportHandler}get email(){return this._email}setEmail(eo){this._email=eo}get phone(){return this._phone}setPhone(eo){this._phone=eo}get passkeyIdentifier(){return this._passkeyIdentifier}setPasskeyIdentifier(eo){this._passkeyIdentifier=eo}clearEmail(){this._email=null}getAddress(){return __awaiter$e(this,void 0,void 0,function*(){var eo;return(eo=this.verifiedCredential)===null||eo===void 0?void 0:eo.address})}getConnectedAccounts(){return __awaiter$e(this,void 0,void 0,function*(){return(this.verifiedCredentials||[]).map(ro=>ro==null?void 0:ro.address).filter(ro=>typeof ro=="string")})}get turnkeyAddress(){var eo;const{address:to}=(eo=this.verifiedCredential)!==null&&eo!==void 0?eo:{};return to}get walletProperties(){const{walletProperties:eo}=this.verifiedCredential||{};return eo}set verifiedCredentials(eo){this._verifiedCredentials=eo}get verifiedCredentials(){return this._verifiedCredentials}set verifiedCredential(eo){this._verifiedCredential=eo}get verifiedCredential(){return this._verifiedCredential}setSessionKeyFetcher(eo){this.createOrRestoreSessionFetcherFunction=eo}setSessionKeyRemoveFunction(eo){this.removeSessionKeysFunction=eo}createOrRestoreSession(){return __awaiter$e(this,arguments,void 0,function*({ignoreRestore:eo}={}){if(!this.isSessionKeyCompatible()||TurnkeyWalletConnectorBase.isLoadingSession)return;if(!this.createOrRestoreSessionFetcherFunction)throw new DynamicError("Cannot register session key to init provider");const{sessionKeys:to}=TurnkeyWalletConnectorBase;if(to!=null&&to.publicKey&&!(new Date>=new Date(to.expirationDate)))return to.publicKey;try{TurnkeyWalletConnectorBase.isLoadingSession=!0;const ro=yield this.createOrRestoreSessionFetcherFunction({ignoreRestore:eo});return TurnkeyWalletConnectorBase.sessionKeys=ro,TurnkeyWalletConnectorBase.apiKeyStamper=new ApiKeyStamper({apiPrivateKey:ro.privateKey,apiPublicKey:ro.publicKey}),ExportHandler.apiKeyStamper=TurnkeyWalletConnectorBase.apiKeyStamper,logger$6.setMetaData("sessionApiPublicKey",ro.publicKey),ro.publicKey}catch{throw new DynamicError("Failed to create or restore session")}finally{TurnkeyWalletConnectorBase.isLoadingSession=!1}})}isSessionKeyCompatible(){var eo;const to=(eo=this.verifiedCredential)===null||eo===void 0?void 0:eo.walletProperties;return!!(to==null?void 0:to.isSessionKeyCompatible)}isSessionActive(){return __awaiter$e(this,void 0,void 0,function*(){return!!((yield this.getAddress())&&TurnkeyWalletConnectorBase.sessionKeys&&TurnkeyWalletConnectorBase.apiKeyStamper)})}get sessionKeys(){return TurnkeyWalletConnectorBase.sessionKeys}setLoggerMetadata(){var eo,to,ro;logger$6.setMetaData("turnkeySubOrganizationId",(to=(eo=this._verifiedCredential)===null||eo===void 0?void 0:eo.walletProperties)===null||to===void 0?void 0:to.turnkeySubOrganizationId),logger$6.setMetaData("walletId",(ro=this._verifiedCredential)===null||ro===void 0?void 0:ro.id);let no="Unknown";this.isSessionKeyCompatible()?no="SessionKeys":this.__authenticatorMethodHandler.recoveryType==="passkey"?no="Passkey":this.__authenticatorMethodHandler.recoveryType==="email"&&(no="EmailAuth"),logger$6.setMetaData("authMethod",no)}}TurnkeyWalletConnectorBase.isLoadingSession=!1;const TurnkeyWalletConnectorInfo={Turnkey:{key:"turnkey",name:"Turnkey"},TurnkeyHD:{key:"turnkeyhd",name:"Turnkey HD"}},findTurnkeyVerifiedCredentials=(Xr,eo)=>Xr==null?void 0:Xr.filter(({walletName:to,chain:ro})=>(to==null?void 0:to.startsWith("turnkey"))&&eo===ro),findTurnkeyVerifiedCredentialsWithSmartWalletRef=(Xr,eo)=>Xr==null?void 0:Xr.reduce((to,ro)=>{var no;if(!((no=ro.walletName)===null||no===void 0)&&no.startsWith("turnkey")&&eo===ro.chain){const io=Xr.find(so=>so.signerRefId===ro.id),oo=io==null?void 0:io.id,ao=io==null?void 0:io.address;to.push(Object.assign(Object.assign({},ro),{smartWalletRefAddress:ao,smartWalletRefId:oo}))}return to},[]);assertPackageVersion("@dynamic-labs/embedded-wallet",version$f);function __awaiter$c(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;async function createAccount(Xr){var io;const{client:eo,organizationId:to,signWith:ro}=Xr;let{ethereumAddress:no}=Xr;if(!ro)throw new TurnkeyActivityError({message:"Missing signWith parameter"});if(isAddress(ro))no=ro;else if(!no&&(no=(io=(await eo.getPrivateKey({privateKeyId:ro,organizationId:to})).privateKey.addresses.find(ao=>ao.format==="ADDRESS_FORMAT_ETHEREUM"))==null?void 0:io.address,typeof no!="string"||!no))throw new TurnkeyActivityError({message:`Unable to find Ethereum address for key ${ro} under organization ${to}`});return toAccount({address:no,signMessage:function({message:oo}){return signMessage(eo,oo,to,ro)},signTransaction:function(oo,ao){const so=ao!=null&&ao.serializer?ao.serializer:serializeTransaction$4;return signTransaction(eo,oo,so,to,ro)},signTypedData:function(oo){return signTypedData(eo,oo,to,ro)}})}async function signMessage(Xr,eo,to,ro){const no=hashMessage(eo);return`${await signMessageWithErrorWrapping(Xr,no,to,ro)}`}async function signTransaction(Xr,eo,to,ro,no){const oo=to(eo).replace(/^0x/,"");return await signTransactionWithErrorWrapping(Xr,oo,ro,no)}async function signTypedData(Xr,eo,to,ro){const no=hashTypedData(eo);return await signMessageWithErrorWrapping(Xr,no,to,ro)}async function signTransactionWithErrorWrapping(Xr,eo,to,ro){let no;try{no=await signTransactionImpl(Xr,eo,to,ro)}catch(io){throw io instanceof TurnkeyActivityError?io:new TurnkeyActivityError({message:`Failed to sign transaction: ${io.message}`,cause:io})}return`0x${no}`}async function signTransactionImpl(Xr,eo,to,ro){var no,io;if(Xr instanceof TurnkeyClient){const{activity:oo}=await Xr.signTransaction({type:"ACTIVITY_TYPE_SIGN_TRANSACTION_V2",organizationId:to,parameters:{signWith:ro,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:eo},timestampMs:String(Date.now())}),{id:ao,status:so,type:co}=oo;if(oo.status!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${oo.status}`,activityId:ao,activityStatus:so,activityType:co});return assertNonNull((io=(no=oo==null?void 0:oo.result)==null?void 0:no.signTransactionResult)==null?void 0:io.signedTransaction)}else{const oo=await Xr.signTransaction({signWith:ro,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:eo});return assertNonNull(oo==null?void 0:oo.signedTransaction)}}async function signMessageWithErrorWrapping(Xr,eo,to,ro){let no;try{no=await signMessageImpl(Xr,eo,to,ro)}catch(io){throw io instanceof TurnkeyActivityError?io:new TurnkeyActivityError({message:`Failed to sign: ${io.message}`,cause:io})}return no}async function signMessageImpl(Xr,eo,to,ro){var oo;let no;if(Xr instanceof TurnkeyClient){const{activity:ao}=await Xr.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:to,parameters:{signWith:ro,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"},timestampMs:String(Date.now())}),{id:so,status:co,type:lo}=ao;if(co!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${ao.status}`,activityId:so,activityStatus:co,activityType:lo});no=assertNonNull((oo=ao==null?void 0:ao.result)==null?void 0:oo.signRawPayloadResult)}else no=await Xr.signRawPayload({signWith:ro,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"});let io=serializeSignature({r:`0x${no.r}`,s:`0x${no.s}`,v:no.v==="00"?27n:28n});return assertNonNull(io)}function assertNonNull(Xr){if(Xr==null)throw new Error(`Got unexpected ${JSON.stringify(Xr)}`);return Xr}var version$d="3.5.1";function __awaiter$b(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const logger$4=new Logger$2("ethereum-core"),gasPriceOracleAbiAddress="0x420000000000000000000000000000000000000F",gasPriceOracleAbi=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],estimateL1Fee$1=(Xr,eo)=>__awaiter$b(void 0,void 0,void 0,function*(){const to=serializeTransaction$4(Object.assign(Object.assign({chainId:Xr.chain.id},eo),{type:eo.type?eo.type:"eip1559"}));return Xr.readContract({abi:gasPriceOracleAbi,address:gasPriceOracleAbiAddress,args:[to],functionName:"getL1Fee"})}),opStackSupportedChains=[optimism.id,optimismGoerli.id,optimismSepolia.id,base$6.id,baseGoerli.id,baseSepolia$1.id],chainsMap=Object.values(viemChains).reduce((Xr,eo)=>Object.assign(Object.assign({},Xr),{[eo.id]:eo}),{}),erc20Abi=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class Eip1559FeeFeed{constructor({publicClient:eo,initialGasLimit:to,initialMaxFeePerGas:ro}){this.fee={gas:BigInt(0)},this.publicClient=eo,this.initialGasLimit=to,this.initialMaxFeePerGas=ro}fetchFee(){return __awaiter$b(this,void 0,void 0,function*(){try{const eo=yield this.estimateL1Fee();if(this.initialGasLimit&&this.initialMaxFeePerGas){this.fee.gas=this.initialGasLimit*this.initialMaxFeePerGas+eo;return}const to=yield this.estimateGas();if(this.initialMaxFeePerGas){this.fee.gas=to*this.initialMaxFeePerGas+eo;return}const ro=yield this.publicClient.estimateFeesPerGas();if(!ro||!ro.maxFeePerGas)return;this.fee.gas=to*ro.maxFeePerGas+eo,this.maxFeePerGas=ro.maxFeePerGas,this.maxPriorityFeePerGas=ro.maxPriorityFeePerGas}catch(eo){logger$4.debug(eo);return}})}}const estimateL1Fee=(Xr,eo)=>__awaiter$b(void 0,void 0,void 0,function*(){const{chain:to}=Xr;if(!to)throw new Error("Chain is not defined");const ro=Xr;if(opStackSupportedChains.includes(to.id))return estimateL1Fee$1(ro,eo);throw new Error("Chain is not supported")}),estimateL1FeeSupportedChains=[...opStackSupportedChains],isL1FeeSupportedByChain=Xr=>estimateL1FeeSupportedChains.includes(Xr),validateAddressFormat=Xr=>/^0x[0-9a-fA-F]{40}$/.test(Xr),parseEther=Xr=>parseEther$1(Xr,"wei"),formatEther=(Xr,{precision:eo}={})=>formatNumberText(formatEther$1(Xr),{precision:eo});class ViemUiTransaction extends Eip1559FeeFeed{constructor({transaction:eo,onSubmit:to,publicClient:ro,account:no}){super({initialGasLimit:eo.gas,initialMaxFeePerGas:eo.maxFeePerGas,publicClient:ro}),this.chain="EVM",this.validateAddressFormat=validateAddressFormat,this.parse=parseEther,this.parseNonNativeToken=(io,oo)=>parseUnits(io,oo),this.format=formatEther,this.formatNonNativeToken=(io,oo)=>formatUnits(io,oo),this.transaction=eo,this.onSubmit=to,this.publicClient=ro,this.address=no}get to(){return this.transaction.to||void 0}set to(eo){this.transaction.to=eo}get from(){return this.address}get value(){return this.transaction.value}set value(eo){this.transaction.value=eo}get nonNativeValue(){return this.transaction.nonNativeValue}set nonNativeValue(eo){this.transaction.nonNativeValue=eo}get nonNativeAddress(){return this.transaction.nonNativeAddress}set nonNativeAddress(eo){this.transaction.nonNativeAddress=eo}get nonNativeDecimal(){return this.transaction.nonNativeDecimal}set nonNativeDecimal(eo){this.transaction.nonNativeDecimal=eo}get data(){return this.transaction.data}submit(){return __awaiter$b(this,void 0,void 0,function*(){return this.onSubmit(this.transaction).catch(eo=>{throw eo instanceof UserRejectedTransactionError?new TransactionExecutionError(new BaseError(eo.message),this.transaction):eo})})}getBalance(){return this.publicClient.getBalance({address:this.address})}estimateGas(){return __awaiter$b(this,void 0,void 0,function*(){const eo=yield this.publicClient.transport.request({method:"eth_estimateGas",params:[{data:this.data,to:this.to,value:this.convertBigIntToHex(this.value)}]});return hexToBigInt(eo)})}convertBigIntToHex(eo){return eo?toHex$1(eo):void 0}estimateL1Fee(){return __awaiter$b(this,void 0,void 0,function*(){var eo;return isL1FeeSupportedByChain(((eo=this.publicClient.chain)===null||eo===void 0?void 0:eo.id)||0)?estimateL1Fee(this.publicClient,{data:this.transaction.data,to:this.transaction.to,value:this.transaction.value}):BigInt(0)})}set maxFeePerGas(eo){this.transaction.maxFeePerGas=eo}set maxPriorityFeePerGas(eo){this.transaction.maxPriorityFeePerGas=eo}}const createViemUiTransaction=Xr=>__awaiter$b(void 0,[Xr],void 0,function*({from:eo,publicClient:to,walletClient:ro}){return new ViemUiTransaction({account:eo,onSubmit:no=>__awaiter$b(void 0,void 0,void 0,function*(){return no.nonNativeAddress?ro.writeContract({abi:erc20Abi,account:eo,address:no.nonNativeAddress,args:[no.to,no.nonNativeValue],functionName:"transfer",maxFeePerGas:no.maxFeePerGas,maxPriorityFeePerGas:no.maxPriorityFeePerGas}):ro.sendTransaction({account:eo,maxFeePerGas:no.maxFeePerGas,maxPriorityFeePerGas:no.maxPriorityFeePerGas,to:no.to,value:no.value})}),publicClient:to,transaction:{}})}),getChain=Xr=>{for(const eo of Object.values(viemChains))if("id"in eo&&eo.id===Xr)return eo;throw new Error(`Chain with id ${Xr} not found`)},mapChain=Xr=>{var eo;return{blockExplorers:!((eo=Xr.blockExplorerUrls)===null||eo===void 0)&&eo[0]?{default:{name:Xr.blockExplorerUrls[0],url:Xr.blockExplorerUrls[0]}}:void 0,id:Xr.chainId,name:Xr.vanityName||Xr.name||Xr.chainName,nativeCurrency:Xr.nativeCurrency,rpcUrls:{default:{http:Xr.rpcUrls},public:{http:Xr.rpcUrls}}}},getOrMapViemChain=Xr=>{let eo;try{eo=getChain(Xr.chainId)}catch{logger$4.debug(`Chain with id ${Xr.chainId} not found in viem's chains`)}const to=mapChain(Xr);return eo?Object.assign(Object.assign({},eo),to):to},findEvmNetwork=({chainId:Xr,name:eo,networks:to})=>{if(!(!Xr&&!eo))return Xr&&eo?to.find(ro=>ro.chainId===Xr&&ro.name===eo):Xr?to.find(ro=>ro.chainId===Xr):to.find(ro=>ro.name===eo)};var L2ResolverAbi=[{inputs:[{internalType:"contract ENS",name:"ens_",type:"address"},{internalType:"address",name:"registrarController_",type:"address"},{internalType:"address",name:"reverseRegistrar_",type:"address"},{internalType:"address",name:"owner_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"CantSetSelfAsDelegate",type:"error"},{inputs:[],name:"CantSetSelfAsOperator",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newRegistrarController",type:"address"}],name:"RegistrarControllerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newReverseRegistrar",type:"address"}],name:"ReverseRegistrarUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"registrarController",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"}],name:"resolve",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"reverseRegistrar",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"registrarController_",type:"address"}],name:"setRegistrarController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"reverseRegistrar_",type:"address"}],name:"setReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];const getNameservice=Xr=>__awaiter$b(void 0,[Xr],void 0,function*({rpcProvider:eo,address:to}){const ro={avatar:void 0,name:void 0},no=yield eo.getChainId();if(!no)return ro;const io=(ao,so)=>{const co=ao.toLocaleLowerCase(),lo=keccak256(co.substring(2)),uo=oo(so),ho=namehash(`${uo.toLocaleUpperCase()}.reverse`);return keccak256(encodePacked(["bytes32","bytes32"],[ho,lo]))},oo=ao=>((2147483648|ao)>>>0).toString(16).toLocaleUpperCase();if(no===8453){const ao=io(to,8453);try{const so=yield eo.readContract({abi:L2ResolverAbi,address:"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD",args:[ao],functionName:"name"});if(so)return ro.name=so,ro}catch{return ro}}else ro.name=yield eo.getEnsName({address:to}),ro.avatar=ro.name?yield eo.getEnsAvatar({name:ro.name}):void 0;return ro}),isTransactionExecutionError=Xr=>Xr!=null&&typeof Xr=="object"&&"walk"in Xr&&typeof Xr.walk=="function",interceptTransport=({getAccounts:Xr,onPersonalSign:eo,onSendTransaction:to,onSignTypedData:ro,transport:no})=>io=>{const oo=no(io);return custom$1({request:ao=>__awaiter$b(void 0,void 0,void 0,function*(){var so;const{method:co,params:lo}=ao;if(Xr&&co==="eth_accounts")return Xr({provider:oo});if(eo&&co==="personal_sign"){const[uo]=lo;return eo({args:ao,message:uo,provider:oo}).catch(ho=>{throw ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}if(to&&co==="eth_sendTransaction"){const[uo]=lo;return to({args:ao,provider:oo,transaction:uo}).catch(ho=>{throw isTransactionExecutionError(ho)&&ho.walk()instanceof UserRejectedTransactionError?new UserRejectedRequestError$1(ho.walk()):ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}if(ro&&co==="eth_signTypedData_v4"){const[,uo]=(so=lo)!==null&&so!==void 0?so:[];return ro({args:ao,message:uo,provider:oo}).catch(ho=>{throw ho instanceof UserRejectedRequestError?new UserRejectedRequestError$1(ho):ho})}return oo.request(ao)})})(io)};class EthereumWallet extends Wallet$1{getPublicClient(){return __awaiter$b(this,void 0,void 0,function*(){const eo=yield this._connector.getPublicClient();if(!eo)throw new Error("Unable to retrieve PublicClient");return eo})}getWalletClient(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=this._connector.getWalletClient(eo);if(!to)throw new Error("Unable to retrieve WalletClient");return createWalletClient({account:this.address,chain:to.chain,transport:interceptTransport({onPersonalSign:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),onSendTransaction:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),onSignTypedData:ro=>__awaiter$b(this,[ro],void 0,function*({provider:no,args:io}){return yield this.sync(),no.request(io)}),transport:custom$1(to.transport)})})})}}class EthereumWalletConnector extends WalletConnectorBase{getPublicClient(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to;const ro=(eo=yield this.getNetwork())!==null&&eo!==void 0?eo:1;if(this.evmNetworks.length===0)return;const no={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const io=this.chainRpcProviders.getProviders(no);return(to=this.chainRpcProviders.getEvmProviderByChainId(io,ro))===null||to===void 0?void 0:to.provider})}constructor(eo){var to;super(eo),this.ChainWallet=EthereumWallet,this.evmNetworkRpcMap=()=>this.evmNetworks.reduce((ro,no)=>{var io;return[ro[no.chainId]]=!((io=no==null?void 0:no.privateCustomerRpcUrls)===null||io===void 0)&&io.length?no.privateCustomerRpcUrls:no.rpcUrls,ro},{}),this.evmNetworks=parseEvmNetworks(eo.evmNetworks),this.chainRpcProviders=eo.chainRpcProviders,(to=this.chainRpcProviders)===null||to===void 0||to.registerEvmProviders()}getNetwork(){return __awaiter$b(this,void 0,void 0,function*(){const eo=this.getWalletClient();if(!this.supportsNetworkSwitching||!eo)return Promise.resolve(void 0);const to=yield retryableFn(eo.getChainId,{fallbackValue:FALLBACK_UNDEFINED,timeoutMs:1e3});return this.setActiveChain(chainsMap[to]),to})}getNameService(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient();if(to)return getNameservice({address:eo,rpcProvider:to})})}isTestnet(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to,ro;return(ro=(to=(eo=yield this.getPublicClient())===null||eo===void 0?void 0:eo.chain)===null||to===void 0?void 0:to.testnet)!==null&&ro!==void 0?ro:!1})}parseAddress(eo){try{return getAddress$1(eo)}catch(to){logger$9.debug(`Failed to parse EVM address into EIP55 format: error getting checksum, returning default ${eo}`,to)}return eo}getSigner(){return __awaiter$b(this,void 0,void 0,function*(){return this.getWalletClient()})}getBalance(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient(),ro=yield to==null?void 0:to.getBalance({address:eo});if(!(!ro&&ro!==BigInt(0)))return formatEther$1(ro)})}supportsNetworkSwitching(){return!0}switchNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({networkName:to,networkChainId:ro}){const no=findEvmNetwork({chainId:ro,name:to,networks:this.evmNetworks});if(!no)throw new DynamicError(`Could not find network mapping for chain ${to||ro}`);if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const io=this.getWalletClient();if(!io)throw new DynamicError("Provider not found");return this.providerSwitchNetwork({network:no,provider:io})})}chooseAccountsToConnect(){return __awaiter$b(this,void 0,void 0,function*(){var eo,to,ro;const no=this.getWalletClient();if(!no)return[];try{const io=yield no.requestPermissions({eth_accounts:{}});logger$9.debug("chooseAccountsToConnect - requestPermissions result",io);const oo=(ro=(to=(eo=io==null?void 0:io.find(ao=>ao.parentCapability==="eth_accounts"))===null||eo===void 0?void 0:eo.caveats)===null||to===void 0?void 0:to[0])===null||ro===void 0?void 0:ro.value;return typeof oo=="string"?[oo]:Array.isArray(oo)?oo:[]}catch(io){if(logger$9.debug("chooseAccountsToConnect - error",io),io.code===4001)throw new UserRejectedRequestError}return[]})}getConnectedAccounts(){return __awaiter$b(this,void 0,void 0,function*(){const eo=this.getWalletClient();if(!eo)return[];const to=yield retryableFn(eo.getAddresses,{fallbackValue:[],timeoutMs:500});return to.length&&this.setActiveAccount(to[0]),to})}providerSwitchNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({network:to,provider:ro}){var no,io,oo,ao;const{chainId:so}=to,co=yield this.getNetwork();if(!(co&&co===so))try{if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const lo=getOrMapViemChain(to);if(yield ro.switchChain(lo),this.key==="magiceden"){const uo=yield ro.getChainId();this.emit("chainChange",{chain:uo.toString()})}else this.setActiveChain(lo)}catch(lo){if(lo.code===4902||!((no=lo.message)===null||no===void 0)&&no.includes("Unrecognized chain")||((oo=(io=lo.data)===null||io===void 0?void 0:io.orginalError)===null||oo===void 0?void 0:oo.code)===4902)return this.providerAddNetwork({network:to,provider:ro});throw!((ao=lo.message)===null||ao===void 0)&&ao.includes("rejected")||typeof lo=="string"&&lo.includes("rejected")?new DynamicError("User rejected the wallet's request to switch network"):lo}})}providerAddNetwork(eo){return __awaiter$b(this,arguments,void 0,function*({network:to,provider:ro}){var no;try{return yield ro.addChain({chain:getOrMapViemChain(to)})}catch(io){throw!((no=io.message)===null||no===void 0)&&no.includes("rejected")||typeof io=="string"&&io.includes("rejected")?new DynamicError("User rejected the wallet's request to add network"):io}})}setActiveAccount(eo){this.activeAccount=eo?toAccount(eo):void 0}getActiveAccount(){return this.activeAccount}setActiveChain(eo){this.activeChain=eo}getActiveChain(){return this.activeChain}createUiTransaction(eo){return __awaiter$b(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=yield this.getWalletClient(),ro=yield this.getPublicClient();if(!ro||!to)throw new DynamicError("No public client available");return createViemUiTransaction({from:eo,publicClient:ro,walletClient:to})})}confirmTransactionStatus(eo){return __awaiter$b(this,void 0,void 0,function*(){const to=yield this.getPublicClient();if(!to)throw new DynamicError("No public client available");return to.waitForTransactionReceipt({confirmations:3,hash:eo})})}}ChainRpcProviders.getEvmProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.evm)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerEvmProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.EVM,Xr=>{const eo={};return Xr!=null&&Xr.evm&&(eo.evm=parseEvmNetworks(Xr.evm).map(to=>{var ro;const no=((ro=to.privateCustomerRpcUrls)===null||ro===void 0?void 0:ro[0])||to.rpcUrls[0],io=createPublicClient({chain:getOrMapViemChain(to),transport:http(no)});return{chainId:to.chainId,chainName:to.name,provider:io}})),eo.evm})};const unFormatTransaction=Xr=>Object.assign(Object.assign({},Xr),{gas:typeof Xr.gas<"u"?hexToBigInt(Xr.gas):void 0,gasPrice:typeof Xr.gasPrice<"u"?hexToBigInt(Xr.gasPrice):void 0,maxFeePerGas:typeof Xr.maxFeePerGas<"u"?hexToBigInt(Xr.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof Xr.maxPriorityFeePerGas<"u"?hexToBigInt(Xr.maxPriorityFeePerGas):void 0,nonce:typeof Xr.nonce<"u"?hexToBigInt(Xr.nonce):void 0,value:typeof Xr.value<"u"?hexToBigInt(Xr.value):void 0}),createAccountWithUiConfirmation=({address:Xr,account:eo,provider:to,walletConnector:ro,walletUiUtils:no})=>toAccount({address:Xr,signMessage:(...io)=>__awaiter$b(void 0,void 0,void 0,function*(){return no.signMessage({handler:()=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signMessage(...io)}),message:(()=>{var oo;const ao=(oo=io[0])===null||oo===void 0?void 0:oo.message;return ao&&!(typeof ao=="string"&&Array.isArray(ao))?JSON.stringify(ao):ao==null?void 0:ao.toString()})(),walletConnector:ro})}),signTransaction:(...io)=>__awaiter$b(void 0,void 0,void 0,function*(){const oo=new ViemUiTransaction({account:Xr,onSubmit:ao=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signTransaction(ao)}),publicClient:to,transaction:io[0]});return no.sendTransaction(ro,oo)}),signTypedData:(...io)=>no.signMessage({handler:()=>__awaiter$b(void 0,void 0,void 0,function*(){return(yield eo()).signTypedData(...io)}),message:JSON.stringify(io[0]),walletConnector:ro})}),createWalletClientWithUiConfirmation=({address:Xr,account:eo,chain:to,transport:ro,walletConnector:no,walletUiUtils:io})=>{let oo=null;const ao=createPublicClient({chain:to,transport:ro}),so=createAccountWithUiConfirmation({account:eo,address:Xr,provider:ao,walletConnector:no,walletUiUtils:io}),co=interceptTransport({getAccounts:()=>__awaiter$b(void 0,void 0,void 0,function*(){return[Xr]}),onPersonalSign:lo=>__awaiter$b(void 0,[lo],void 0,function*({message:uo}){if(!oo)throw new Error("Client not initialized");return oo.signMessage({message:{raw:uo}})}),onSendTransaction:lo=>__awaiter$b(void 0,[lo],void 0,function*({transaction:uo}){if(!oo)throw new Error("Client not initialized");const ho=unFormatTransaction(uo);return oo.sendTransaction(ho)}),onSignTypedData:lo=>__awaiter$b(void 0,[lo],void 0,function*({message:uo}){if(!oo)throw new Error("Client not initialized");return oo.signTypedData(JSON.parse(uo))}),transport:ro});return oo=createWalletClient({account:so,chain:to,transport:co}),oo};assertPackageVersion("@dynamic-labs/ethereum-core",version$d);class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase{constructor(eo,to){var ro;super(eo,to),this.walletFallback={brand:{alt:"Turnkey Wallet",spriteId:"turnkey"},name:"Turnkey HD"},this.ChainWallet=EthereumWallet,this.connectedChain="EVM",this.supportedChains=["ETH","EVM"],this.verifiedCredentialChain="eip155",this.stampCreateWalletAccountRequest=no=>__awaiter$c(this,[no],void 0,function*({request:io}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(io)}),this.evmNetworks=parseEvmNetworks(to.evmNetworks),this.walletUiUtils=to.walletUiUtils,this._turnkeyAccount=void 0,this._selectedChainId=this.getLastUsedChainId(),this.chainRpcProviders=to.chainRpcProviders,(ro=this.chainRpcProviders)===null||ro===void 0||ro.registerEvmProviders(),this.__turnkeyClient=this.getTurnkeyClient()}getLastUsedChainId(){var eo;if(this.lastUsedChainId)return this.lastUsedChainId;if(!((eo=this.evmNetworks)===null||eo===void 0)&&eo.length)return this.evmNetworks[0].chainId}getNetwork(){return __awaiter$c(this,void 0,void 0,function*(){var eo;return(eo=yield this.getSigner())===null||eo===void 0?void 0:eo.getChainId()})}supportsNetworkSwitching(){return!0}switchNetwork(eo){return __awaiter$c(this,arguments,void 0,function*({networkChainId:to}){this.lastUsedChainId=to,this._selectedChainId=to,yield this.refreshTurnkeyAccount(),this.emit("chainChange",{chain:to.toString()})})}setVerifiedCredentials(eo){const to=findTurnkeyVerifiedCredentialsWithSmartWalletRef(eo,"eip155"),[ro]=to;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(to)&&(this.verifiedCredential=ro,this.verifiedCredentials=to,this.refreshTurnkeyAccount())}validateActiveWallet(eo){return __awaiter$c(this,void 0,void 0,function*(){var to,ro;const no=((to=this.verifiedCredential)===null||to===void 0?void 0:to.address)||"";if(!isSameAddress$1(no,eo,this.connectedChain)){const oo=(ro=this.verifiedCredentials)===null||ro===void 0?void 0:ro.find(ao=>(ao==null?void 0:ao.address)===eo);if(!oo)throw new DynamicError("Account not found");this.verifiedCredential=oo,this.refreshTurnkeyAccount()}})}getRpcUrl(){const eo=this._selectedChainId;return getRpcUrlForChain({chainId:eo,networks:this.evmNetworks})}getBalance(eo){return __awaiter$c(this,void 0,void 0,function*(){const to=this.getRpcUrl();if(!to)return;const no=yield createPublicClient({transport:http(to)}).getBalance({address:eo});return formatEther$1(no)})}signMessage(eo){return __awaiter$c(this,void 0,void 0,function*(){const to=yield this.getSigner();if(!to)throw new Error("Signer not found");return to.signMessage({message:eo})})}getPublicClient(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to;if(this.evmNetworks.length===0)return;const ro=(eo=yield this.getNetwork())!==null&&eo!==void 0?eo:1,no={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const io=this.chainRpcProviders.getProviders(no);return(to=this.chainRpcProviders.getEvmProviderByChainId(io,ro))===null||to===void 0?void 0:to.provider})}getSigner(){return __awaiter$c(this,void 0,void 0,function*(){return yield this.getTurnkeyAccount(),this.getWalletClient()})}getTurnkeyClient(){var eo;let to=getTLD();to||(to=PlatformService.getHostname());const ro=PasskeyService.createWebauthnStamper({rpId:to}),no=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,io=no??ro;return this.__turnkeyClient=(eo=this.getAuthenticatorHandler().client)!==null&&eo!==void 0?eo:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},io),this.__turnkeyClient}getAccount(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to,ro;return this.isSessionKeyCompatible()&&((eo=this.__turnkeyClient)===null||eo===void 0?void 0:eo.stamper)instanceof ApiKeyStamper?this._turnkeyAccount:((this.getAuthenticatorHandler().recoveryType==="passkey"&&((to=this.__turnkeyClient)===null||to===void 0?void 0:to.stamper)instanceof IframeStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((ro=this.__turnkeyClient)===null||ro===void 0?void 0:ro.stamper)instanceof WebauthnStamper||this.__turnkeyClient!==this.getAuthenticatorHandler().client)&&(yield this.refreshTurnkeyAccount()),this._turnkeyAccount)})}getWalletClient(){const eo=this.networkRpcUrl,to=this._turnkeyAccount,ro=this.currentEvmNetwork;if(!(!to||!eo||!ro))return createWalletClientWithUiConfirmation({account:this.getAccount.bind(this),address:this.turnkeyAddress,chain:getOrMapViemChain(ro),transport:http(eo),walletConnector:this,walletUiUtils:this.walletUiUtils})}get currentChainId(){var eo,to,ro;return(eo=this._selectedChainId)!==null&&eo!==void 0?eo:(ro=(to=this.evmNetworks)===null||to===void 0?void 0:to[0])===null||ro===void 0?void 0:ro.chainId}get lastUsedChainId(){const eo=localStorage.getItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey);if(eo)try{const to=parseInt(eo);if(isNaN(to))return;if(!this.evmNetworks.some(no=>no.chainId===to)){const no=this.evmNetworks[0].chainId;return this.lastUsedChainId=no,this.lastUsedChainId}return to}catch(to){logger$6.error(to);return}}set lastUsedChainId(eo){eo===void 0?localStorage.removeItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey):localStorage.setItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey,eo.toString())}get networkRpcUrl(){const eo=this.currentChainId;return this.evmNetworks.find(no=>no.chainId===eo)?getRpcUrlForChain({chainId:eo,networks:this.evmNetworks}):void 0}get currentEvmNetwork(){const eo=this.currentChainId;return this.evmNetworks.find(to=>to.chainId===eo)}internalSignTransaction(eo){return __awaiter$c(this,arguments,void 0,function*({transaction:to,args:ro,address:no,turnkeySubOrganizationId:io}){return this.doRetryableTurnkeyAction({action:oo=>oo.signTransaction(to,ro),activityType:"SignTransaction",address:no,turnkeySubOrganizationId:io})})}internalSignTypedData(eo){return __awaiter$c(this,arguments,void 0,function*({typedData:to,address:ro,turnkeySubOrganizationId:no}){return this.doRetryableTurnkeyAction({action:io=>io.signTypedData(to),activityType:"SignTypedData",address:ro,turnkeySubOrganizationId:no})})}internalSignMessage(eo){return __awaiter$c(this,arguments,void 0,function*({message:to,address:ro,turnkeySubOrganizationId:no}){return this.doRetryableTurnkeyAction({action:io=>io.signMessage({message:to}),activityType:"SignMessage",address:ro,turnkeySubOrganizationId:no})})}doRetryableTurnkeyAction(eo){return __awaiter$c(this,arguments,void 0,function*({action:to,activityType:ro,address:no,turnkeySubOrganizationId:io}){yield this.createOrRestoreSession();let oo=yield this.createTurnkeyAccount({address:no,turnkeySubOrganizationId:io});try{return yield to(oo)}catch(ao){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(so=>ao.message.includes(so)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),oo=yield this.createTurnkeyAccount({address:no,turnkeySubOrganizationId:io}),to(oo);throw logger$6.error(`[TK] failed to perform ${ro} activity`,ao),ao}})}createTurnkeyAccount(eo){return __awaiter$c(this,arguments,void 0,function*({address:to,turnkeySubOrganizationId:ro}){return createAccount({client:this.getTurnkeyClient(),ethereumAddress:to,organizationId:ro,signWith:to})})}refreshTurnkeyAccount(){return __awaiter$c(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyAccount(){return __awaiter$c(this,void 0,void 0,function*(){var eo,to;if(this._turnkeyAccount)return this._turnkeyAccount;const{turnkeySubOrganizationId:ro}=(eo=this.walletProperties)!==null&&eo!==void 0?eo:{},{address:no}=(to=this.verifiedCredential)!==null&&to!==void 0?to:{};if(!(!ro||!no))return this._turnkeyAccount=toAccount({address:no,signMessage:io=>__awaiter$c(this,[io],void 0,function*({message:oo}){return this.internalSignMessage({address:no,message:oo,turnkeySubOrganizationId:ro})}),signTransaction:(io,oo)=>__awaiter$c(this,void 0,void 0,function*(){return this.internalSignTransaction({address:no,args:oo,transaction:io,turnkeySubOrganizationId:ro})}),signTypedData:io=>__awaiter$c(this,void 0,void 0,function*(){return this.internalSignTypedData({address:no,turnkeySubOrganizationId:ro,typedData:io})})}),this.setLoggerMetadata(),this._turnkeyAccount})}createUiTransaction(eo){return __awaiter$c(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=this.getWalletClient(),ro=yield this.getPublicClient();if(!ro||!to)throw new DynamicError("No public client available");return createViemUiTransaction({from:eo,publicClient:ro,walletClient:to})})}}TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey="turnkey-last-used-chain-id";const TurnkeyEVMWalletConnectors=Xr=>{var eo;return!((eo=Xr.apiProviders)===null||eo===void 0)&&eo.turnkey?[TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD),TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.Turnkey)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-evm",version$g);var version$c="3.5.1";function __rest$6(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);noto.chain==="evm")}installedProviders(){const eo=this.getInjectedConfig();if(!eo)return[];const to=[];if(eo.windowLocations)for(const ro of eo.windowLocations){const no=getProvidersFromWindow(ro);no&&no.length&&to.push(...no)}return window.ethereum&&(!window.ethereum.providers||!window.ethereum.providers.length?to.push(window.ethereum):window.ethereum.providers.forEach(ro=>to.push(ro))),to}installedProviderLookup(eo){const to=this.installedProviders();return ProviderLookup(to,eo)}eip6963ProviderLookup(eo){var to;const{providers:ro}=Eip6963ProviderSingleton.get();return(to=ro.find(no=>{var io;return((io=no==null?void 0:no.info)===null||io===void 0?void 0:io.rdns)===eo}))===null||to===void 0?void 0:to.provider}isInstalledHelper(){return this.findProvider()!==void 0}findProvider(){return this.connector.findProvider()}findWalletClient(eo){const to=this.findProvider();if(to)return createWalletClient({account:this.connector.getActiveAccount(),chain:eo?chainsMap[eo]:this.connector.getActiveChain(),transport:custom$1(to)})}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){const eo=this.findWalletClient();return eo?this.getAddressWithProvider(eo):Promise.resolve(void 0)})}getAddressWithProvider(eo){return __awaiter$a(this,void 0,void 0,function*(){try{const[to]=yield eo.requestAddresses(),ro=getAddress$1(to);return this.connector.setActiveAccount(ro),ro}catch(to){return logger$9.error(to),Promise.reject(to)}})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)return Promise.resolve(void 0);const ro=this.findWalletClient();return ro?yield ro.signMessage({account:to,message:eo}):Promise.resolve(void 0)})}_setupEventListeners(eo){const to=this.findProvider();if(!to)return logger$9.warn("Provider not found",{connector:eo}),{tearDownEventListeners:()=>{}};if(!to.on)return logger$9.warn("Provider does not support event listeners",{connector:eo,provider:to}),{tearDownEventListeners:()=>{}};const{handleAccountChange:ro,handleChainChange:no,handleDisconnect:io}=eventListenerHandlers(eo);return to.on("accountsChanged",ro),to.on("chainChanged",no),to.on("disconnect",io),{tearDownEventListeners:()=>{const ao=this.findProvider();ao&&(ro&&ao.removeListener("accountsChanged",ro),no&&ao.removeListener("chainChanged",no),io&&ao.removeListener("disconnect",io))}}}}var chacha20poly1305={},chacha={},binary={},int={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});function eo(ao,so){var co=ao>>>16&65535,lo=ao&65535,uo=so>>>16&65535,ho=so&65535;return lo*ho+(co*ho+lo*uo<<16>>>0)|0}Xr.mul=Math.imul||eo;function to(ao,so){return ao+so|0}Xr.add=to;function ro(ao,so){return ao-so|0}Xr.sub=ro;function no(ao,so){return ao<>>32-so}Xr.rotl=no;function io(ao,so){return ao<<32-so|ao>>>so}Xr.rotr=io;function oo(ao){return typeof ao=="number"&&isFinite(ao)&&Math.floor(ao)===ao}Xr.isInteger=Number.isInteger||oo,Xr.MAX_SAFE_INTEGER=9007199254740991,Xr.isSafeInteger=function(ao){return Xr.isInteger(ao)&&ao>=-Xr.MAX_SAFE_INTEGER&&ao<=Xr.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+0]<<8|Xr[eo+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+0]<<8|Xr[eo+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+1]<<8|Xr[eo])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+1]<<8|Xr[eo])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(2)),to===void 0&&(to=0),eo[to+0]=Xr>>>8,eo[to+1]=Xr>>>0,eo}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(2)),to===void 0&&(to=0),eo[to+0]=Xr>>>0,eo[to+1]=Xr>>>8,eo}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(Xr,eo){return eo===void 0&&(eo=0),Xr[eo]<<24|Xr[eo+1]<<16|Xr[eo+2]<<8|Xr[eo+3]}binary.readInt32BE=readInt32BE;function readUint32BE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo]<<24|Xr[eo+1]<<16|Xr[eo+2]<<8|Xr[eo+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(Xr,eo){return eo===void 0&&(eo=0),Xr[eo+3]<<24|Xr[eo+2]<<16|Xr[eo+1]<<8|Xr[eo]}binary.readInt32LE=readInt32LE;function readUint32LE(Xr,eo){return eo===void 0&&(eo=0),(Xr[eo+3]<<24|Xr[eo+2]<<16|Xr[eo+1]<<8|Xr[eo])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(4)),to===void 0&&(to=0),eo[to+0]=Xr>>>24,eo[to+1]=Xr>>>16,eo[to+2]=Xr>>>8,eo[to+3]=Xr>>>0,eo}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(4)),to===void 0&&(to=0),eo[to+0]=Xr>>>0,eo[to+1]=Xr>>>8,eo[to+2]=Xr>>>16,eo[to+3]=Xr>>>24,eo}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(Xr,eo){eo===void 0&&(eo=0);var to=readInt32BE(Xr,eo),ro=readInt32BE(Xr,eo+4);return to*4294967296+ro-(ro>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(Xr,eo){eo===void 0&&(eo=0);var to=readUint32BE(Xr,eo),ro=readUint32BE(Xr,eo+4);return to*4294967296+ro}binary.readUint64BE=readUint64BE;function readInt64LE(Xr,eo){eo===void 0&&(eo=0);var to=readInt32LE(Xr,eo),ro=readInt32LE(Xr,eo+4);return ro*4294967296+to-(to>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(Xr,eo){eo===void 0&&(eo=0);var to=readUint32LE(Xr,eo),ro=readUint32LE(Xr,eo+4);return ro*4294967296+to}binary.readUint64LE=readUint64LE;function writeUint64BE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(8)),to===void 0&&(to=0),writeUint32BE(Xr/4294967296>>>0,eo,to),writeUint32BE(Xr>>>0,eo,to+4),eo}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(Xr,eo,to){return eo===void 0&&(eo=new Uint8Array(8)),to===void 0&&(to=0),writeUint32LE(Xr>>>0,eo,to),writeUint32LE(Xr/4294967296>>>0,eo,to+4),eo}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(Xr,eo,to){if(to===void 0&&(to=0),Xr%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(Xr/8>eo.length-to)throw new Error("readUintBE: array is too short for the given bitLength");for(var ro=0,no=1,io=Xr/8+to-1;io>=to;io--)ro+=eo[io]*no,no*=256;return ro}binary.readUintBE=readUintBE;function readUintLE(Xr,eo,to){if(to===void 0&&(to=0),Xr%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(Xr/8>eo.length-to)throw new Error("readUintLE: array is too short for the given bitLength");for(var ro=0,no=1,io=to;io=ro;io--)to[io]=eo/no&255,no*=256;return to}binary.writeUintBE=writeUintBE;function writeUintLE(Xr,eo,to,ro){if(to===void 0&&(to=new Uint8Array(Xr/8)),ro===void 0&&(ro=0),Xr%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(eo))throw new Error("writeUintLE value must be an integer");for(var no=1,io=ro;io>>16|_o<<16,Po=Po+_o|0,Mo^=Po,Mo=Mo>>>20|Mo<<12,Oo=Oo+Fo|0,So^=Oo,So=So>>>16|So<<16,fo=fo+So|0,Fo^=fo,Fo=Fo>>>20|Fo<<12,jo=jo+Wo|0,To^=jo,To=To>>>16|To<<16,yo=yo+To|0,Wo^=yo,Wo=Wo>>>20|Wo<<12,Bo=Bo+Jo|0,Ao^=Bo,Ao=Ao>>>16|Ao<<16,vo=vo+Ao|0,Jo^=vo,Jo=Jo>>>20|Jo<<12,jo=jo+Wo|0,To^=jo,To=To>>>24|To<<8,yo=yo+To|0,Wo^=yo,Wo=Wo>>>25|Wo<<7,Bo=Bo+Jo|0,Ao^=Bo,Ao=Ao>>>24|Ao<<8,vo=vo+Ao|0,Jo^=vo,Jo=Jo>>>25|Jo<<7,Oo=Oo+Fo|0,So^=Oo,So=So>>>24|So<<8,fo=fo+So|0,Fo^=fo,Fo=Fo>>>25|Fo<<7,Ro=Ro+Mo|0,_o^=Ro,_o=_o>>>24|_o<<8,Po=Po+_o|0,Mo^=Po,Mo=Mo>>>25|Mo<<7,Ro=Ro+Fo|0,Ao^=Ro,Ao=Ao>>>16|Ao<<16,yo=yo+Ao|0,Fo^=yo,Fo=Fo>>>20|Fo<<12,Oo=Oo+Wo|0,_o^=Oo,_o=_o>>>16|_o<<16,vo=vo+_o|0,Wo^=vo,Wo=Wo>>>20|Wo<<12,jo=jo+Jo|0,So^=jo,So=So>>>16|So<<16,Po=Po+So|0,Jo^=Po,Jo=Jo>>>20|Jo<<12,Bo=Bo+Mo|0,To^=Bo,To=To>>>16|To<<16,fo=fo+To|0,Mo^=fo,Mo=Mo>>>20|Mo<<12,jo=jo+Jo|0,So^=jo,So=So>>>24|So<<8,Po=Po+So|0,Jo^=Po,Jo=Jo>>>25|Jo<<7,Bo=Bo+Mo|0,To^=Bo,To=To>>>24|To<<8,fo=fo+To|0,Mo^=fo,Mo=Mo>>>25|Mo<<7,Oo=Oo+Wo|0,_o^=Oo,_o=_o>>>24|_o<<8,vo=vo+_o|0,Wo^=vo,Wo=Wo>>>25|Wo<<7,Ro=Ro+Fo|0,Ao^=Ro,Ao=Ao>>>24|Ao<<8,yo=yo+Ao|0,Fo^=yo,Fo=Fo>>>25|Fo<<7;binary_1.writeUint32LE(Ro+ro|0,Xr,0),binary_1.writeUint32LE(Oo+no|0,Xr,4),binary_1.writeUint32LE(jo+io|0,Xr,8),binary_1.writeUint32LE(Bo+oo|0,Xr,12),binary_1.writeUint32LE(Mo+ao|0,Xr,16),binary_1.writeUint32LE(Fo+so|0,Xr,20),binary_1.writeUint32LE(Wo+co|0,Xr,24),binary_1.writeUint32LE(Jo+lo|0,Xr,28),binary_1.writeUint32LE(Po+uo|0,Xr,32),binary_1.writeUint32LE(fo+ho|0,Xr,36),binary_1.writeUint32LE(yo+go|0,Xr,40),binary_1.writeUint32LE(vo+bo|0,Xr,44),binary_1.writeUint32LE(_o+wo|0,Xr,48),binary_1.writeUint32LE(So+Eo|0,Xr,52),binary_1.writeUint32LE(To+$o|0,Xr,56),binary_1.writeUint32LE(Ao+Co|0,Xr,60)}function streamXOR(Xr,eo,to,ro,no){if(no===void 0&&(no=0),Xr.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(ro.length>>=8,eo++;if(ro>0)throw new Error("ChaCha: counter overflow")}var poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(Xr,eo,to){return~(Xr-1)&eo|Xr-1&to}constantTime.select=select;function lessOrEqual(Xr,eo){return(Xr|0)-(eo|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare$2(Xr,eo){if(Xr.length!==eo.length)return 0;for(var to=0,ro=0;ro>>8}constantTime.compare=compare$2;function equal(Xr,eo){return Xr.length===0||eo.length===0?!1:compare$2(Xr,eo)!==0}constantTime.equal=equal;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});var eo=constantTime,to=wipe$1;Xr.DIGEST_LENGTH=16;var ro=function(){function oo(ao){this.digestLength=Xr.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var so=ao[0]|ao[1]<<8;this._r[0]=so&8191;var co=ao[2]|ao[3]<<8;this._r[1]=(so>>>13|co<<3)&8191;var lo=ao[4]|ao[5]<<8;this._r[2]=(co>>>10|lo<<6)&7939;var uo=ao[6]|ao[7]<<8;this._r[3]=(lo>>>7|uo<<9)&8191;var ho=ao[8]|ao[9]<<8;this._r[4]=(uo>>>4|ho<<12)&255,this._r[5]=ho>>>1&8190;var go=ao[10]|ao[11]<<8;this._r[6]=(ho>>>14|go<<2)&8191;var bo=ao[12]|ao[13]<<8;this._r[7]=(go>>>11|bo<<5)&8065;var wo=ao[14]|ao[15]<<8;this._r[8]=(bo>>>8|wo<<8)&8191,this._r[9]=wo>>>5&127,this._pad[0]=ao[16]|ao[17]<<8,this._pad[1]=ao[18]|ao[19]<<8,this._pad[2]=ao[20]|ao[21]<<8,this._pad[3]=ao[22]|ao[23]<<8,this._pad[4]=ao[24]|ao[25]<<8,this._pad[5]=ao[26]|ao[27]<<8,this._pad[6]=ao[28]|ao[29]<<8,this._pad[7]=ao[30]|ao[31]<<8}return oo.prototype._blocks=function(ao,so,co){for(var lo=this._fin?0:2048,uo=this._h[0],ho=this._h[1],go=this._h[2],bo=this._h[3],wo=this._h[4],Eo=this._h[5],$o=this._h[6],Co=this._h[7],Ro=this._h[8],Oo=this._h[9],jo=this._r[0],Bo=this._r[1],Mo=this._r[2],Fo=this._r[3],Wo=this._r[4],Jo=this._r[5],Po=this._r[6],fo=this._r[7],yo=this._r[8],vo=this._r[9];co>=16;){var _o=ao[so+0]|ao[so+1]<<8;uo+=_o&8191;var So=ao[so+2]|ao[so+3]<<8;ho+=(_o>>>13|So<<3)&8191;var To=ao[so+4]|ao[so+5]<<8;go+=(So>>>10|To<<6)&8191;var Ao=ao[so+6]|ao[so+7]<<8;bo+=(To>>>7|Ao<<9)&8191;var ko=ao[so+8]|ao[so+9]<<8;wo+=(Ao>>>4|ko<<12)&8191,Eo+=ko>>>1&8191;var mo=ao[so+10]|ao[so+11]<<8;$o+=(ko>>>14|mo<<2)&8191;var Io=ao[so+12]|ao[so+13]<<8;Co+=(mo>>>11|Io<<5)&8191;var Do=ao[so+14]|ao[so+15]<<8;Ro+=(Io>>>8|Do<<8)&8191,Oo+=Do>>>5|lo;var Lo=0,Ho=Lo;Ho+=uo*jo,Ho+=ho*(5*vo),Ho+=go*(5*yo),Ho+=bo*(5*fo),Ho+=wo*(5*Po),Lo=Ho>>>13,Ho&=8191,Ho+=Eo*(5*Jo),Ho+=$o*(5*Wo),Ho+=Co*(5*Fo),Ho+=Ro*(5*Mo),Ho+=Oo*(5*Bo),Lo+=Ho>>>13,Ho&=8191;var Yo=Lo;Yo+=uo*Bo,Yo+=ho*jo,Yo+=go*(5*vo),Yo+=bo*(5*yo),Yo+=wo*(5*fo),Lo=Yo>>>13,Yo&=8191,Yo+=Eo*(5*Po),Yo+=$o*(5*Jo),Yo+=Co*(5*Wo),Yo+=Ro*(5*Fo),Yo+=Oo*(5*Mo),Lo+=Yo>>>13,Yo&=8191;var Xo=Lo;Xo+=uo*Mo,Xo+=ho*Bo,Xo+=go*jo,Xo+=bo*(5*vo),Xo+=wo*(5*yo),Lo=Xo>>>13,Xo&=8191,Xo+=Eo*(5*fo),Xo+=$o*(5*Po),Xo+=Co*(5*Jo),Xo+=Ro*(5*Wo),Xo+=Oo*(5*Fo),Lo+=Xo>>>13,Xo&=8191;var qo=Lo;qo+=uo*Fo,qo+=ho*Mo,qo+=go*Bo,qo+=bo*jo,qo+=wo*(5*vo),Lo=qo>>>13,qo&=8191,qo+=Eo*(5*yo),qo+=$o*(5*fo),qo+=Co*(5*Po),qo+=Ro*(5*Jo),qo+=Oo*(5*Wo),Lo+=qo>>>13,qo&=8191;var Ko=Lo;Ko+=uo*Wo,Ko+=ho*Fo,Ko+=go*Mo,Ko+=bo*Bo,Ko+=wo*jo,Lo=Ko>>>13,Ko&=8191,Ko+=Eo*(5*vo),Ko+=$o*(5*yo),Ko+=Co*(5*fo),Ko+=Ro*(5*Po),Ko+=Oo*(5*Jo),Lo+=Ko>>>13,Ko&=8191;var Qo=Lo;Qo+=uo*Jo,Qo+=ho*Wo,Qo+=go*Fo,Qo+=bo*Mo,Qo+=wo*Bo,Lo=Qo>>>13,Qo&=8191,Qo+=Eo*jo,Qo+=$o*(5*vo),Qo+=Co*(5*yo),Qo+=Ro*(5*fo),Qo+=Oo*(5*Po),Lo+=Qo>>>13,Qo&=8191;var zo=Lo;zo+=uo*Po,zo+=ho*Jo,zo+=go*Wo,zo+=bo*Fo,zo+=wo*Mo,Lo=zo>>>13,zo&=8191,zo+=Eo*Bo,zo+=$o*jo,zo+=Co*(5*vo),zo+=Ro*(5*yo),zo+=Oo*(5*fo),Lo+=zo>>>13,zo&=8191;var ga=Lo;ga+=uo*fo,ga+=ho*Po,ga+=go*Jo,ga+=bo*Wo,ga+=wo*Fo,Lo=ga>>>13,ga&=8191,ga+=Eo*Mo,ga+=$o*Bo,ga+=Co*jo,ga+=Ro*(5*vo),ga+=Oo*(5*yo),Lo+=ga>>>13,ga&=8191;var $a=Lo;$a+=uo*yo,$a+=ho*fo,$a+=go*Po,$a+=bo*Jo,$a+=wo*Wo,Lo=$a>>>13,$a&=8191,$a+=Eo*Fo,$a+=$o*Mo,$a+=Co*Bo,$a+=Ro*jo,$a+=Oo*(5*vo),Lo+=$a>>>13,$a&=8191;var Sl=Lo;Sl+=uo*vo,Sl+=ho*yo,Sl+=go*fo,Sl+=bo*Po,Sl+=wo*Jo,Lo=Sl>>>13,Sl&=8191,Sl+=Eo*Wo,Sl+=$o*Fo,Sl+=Co*Mo,Sl+=Ro*Bo,Sl+=Oo*jo,Lo+=Sl>>>13,Sl&=8191,Lo=(Lo<<2)+Lo|0,Lo=Lo+Ho|0,Ho=Lo&8191,Lo=Lo>>>13,Yo+=Lo,uo=Ho,ho=Yo,go=Xo,bo=qo,wo=Ko,Eo=Qo,$o=zo,Co=ga,Ro=$a,Oo=Sl,so+=16,co-=16}this._h[0]=uo,this._h[1]=ho,this._h[2]=go,this._h[3]=bo,this._h[4]=wo,this._h[5]=Eo,this._h[6]=$o,this._h[7]=Co,this._h[8]=Ro,this._h[9]=Oo},oo.prototype.finish=function(ao,so){so===void 0&&(so=0);var co=new Uint16Array(10),lo,uo,ho,go;if(this._leftover){for(go=this._leftover,this._buffer[go++]=1;go<16;go++)this._buffer[go]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(lo=this._h[1]>>>13,this._h[1]&=8191,go=2;go<10;go++)this._h[go]+=lo,lo=this._h[go]>>>13,this._h[go]&=8191;for(this._h[0]+=lo*5,lo=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=lo,lo=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=lo,co[0]=this._h[0]+5,lo=co[0]>>>13,co[0]&=8191,go=1;go<10;go++)co[go]=this._h[go]+lo,lo=co[go]>>>13,co[go]&=8191;for(co[9]-=8192,uo=(lo^1)-1,go=0;go<10;go++)co[go]&=uo;for(uo=~uo,go=0;go<10;go++)this._h[go]=this._h[go]&uo|co[go];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,ho=this._h[0]+this._pad[0],this._h[0]=ho&65535,go=1;go<8;go++)ho=(this._h[go]+this._pad[go]|0)+(ho>>>16)|0,this._h[go]=ho&65535;return ao[so+0]=this._h[0]>>>0,ao[so+1]=this._h[0]>>>8,ao[so+2]=this._h[1]>>>0,ao[so+3]=this._h[1]>>>8,ao[so+4]=this._h[2]>>>0,ao[so+5]=this._h[2]>>>8,ao[so+6]=this._h[3]>>>0,ao[so+7]=this._h[3]>>>8,ao[so+8]=this._h[4]>>>0,ao[so+9]=this._h[4]>>>8,ao[so+10]=this._h[5]>>>0,ao[so+11]=this._h[5]>>>8,ao[so+12]=this._h[6]>>>0,ao[so+13]=this._h[6]>>>8,ao[so+14]=this._h[7]>>>0,ao[so+15]=this._h[7]>>>8,this._finished=!0,this},oo.prototype.update=function(ao){var so=0,co=ao.length,lo;if(this._leftover){lo=16-this._leftover,lo>co&&(lo=co);for(var uo=0;uo=16&&(lo=co-co%16,this._blocks(ao,so,lo),so+=lo,co-=lo),co){for(var uo=0;uo16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var go=new Uint8Array(16);go.set(co,go.length-co.length);var bo=new Uint8Array(32);eo.stream(this._key,go,bo,4);var wo=lo.length+this.tagLength,Eo;if(ho){if(ho.length!==wo)throw new Error("ChaCha20Poly1305: incorrect destination length");Eo=ho}else Eo=new Uint8Array(wo);return eo.streamXOR(this._key,go,lo,Eo,4),this._authenticate(Eo.subarray(Eo.length-this.tagLength,Eo.length),bo,Eo.subarray(0,Eo.length-this.tagLength),uo),ro.wipe(go),Eo},so.prototype.open=function(co,lo,uo,ho){if(co.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(lo.length0&&go.update(oo.subarray(ho.length%16))),go.update(uo),uo.length%16>0&&go.update(oo.subarray(uo.length%16));var bo=new Uint8Array(8);ho&&no.writeUint64LE(ho.length,bo),go.update(bo),no.writeUint64LE(uo.length,bo),go.update(bo);for(var wo=go.digest(),Eo=0;Eothis.blockSize?this._inner.update(to).finish(ro).clean():ro.set(to);for(var no=0;no1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},Xr.prototype.expand=function(eo){for(var to=new Uint8Array(eo),ro=0;ro256)throw new Error("randomString charset is too long");let ho="";const go=lo.length,bo=256-256%go;for(;co>0;){const wo=no(Math.ceil(co*256/bo),uo);for(let Eo=0;Eo0;Eo++){const $o=wo[Eo];$o0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=so[lo++],co--;this._bufferLength===this.blockSize&&(io(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(co>=this.blockSize&&(lo=io(this._temp,this._state,so,lo,co),co%=this.blockSize);co>0;)this._buffer[this._bufferLength++]=so[lo++],co--;return this},ao.prototype.finish=function(so){if(!this._finished){var co=this._bytesHashed,lo=this._bufferLength,uo=co/536870912|0,ho=co<<3,go=co%64<56?64:128;this._buffer[lo]=128;for(var bo=lo+1;bo0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},ao.prototype.restoreState=function(so){return this._state.set(so.state),this._bufferLength=so.bufferLength,so.buffer&&this._buffer.set(so.buffer),this._bytesHashed=so.bytesHashed,this._finished=!1,this},ao.prototype.cleanSavedState=function(so){to.wipe(so.state),so.buffer&&to.wipe(so.buffer),so.bufferLength=0,so.bytesHashed=0},ao}();Xr.SHA256=ro;var no=new Int32Array([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]);function io(ao,so,co,lo,uo){for(;uo>=64;){for(var ho=so[0],go=so[1],bo=so[2],wo=so[3],Eo=so[4],$o=so[5],Co=so[6],Ro=so[7],Oo=0;Oo<16;Oo++){var jo=lo+Oo*4;ao[Oo]=eo.readUint32BE(co,jo)}for(var Oo=16;Oo<64;Oo++){var Bo=ao[Oo-2],Mo=(Bo>>>17|Bo<<15)^(Bo>>>19|Bo<<13)^Bo>>>10;Bo=ao[Oo-15];var Fo=(Bo>>>7|Bo<<25)^(Bo>>>18|Bo<<14)^Bo>>>3;ao[Oo]=(Mo+ao[Oo-7]|0)+(Fo+ao[Oo-16]|0)}for(var Oo=0;Oo<64;Oo++){var Mo=(((Eo>>>6|Eo<<26)^(Eo>>>11|Eo<<21)^(Eo>>>25|Eo<<7))+(Eo&$o^~Eo&Co)|0)+(Ro+(no[Oo]+ao[Oo]|0)|0)|0,Fo=((ho>>>2|ho<<30)^(ho>>>13|ho<<19)^(ho>>>22|ho<<10))+(ho&go^ho&bo^go&bo)|0;Ro=Co,Co=$o,$o=Eo,Eo=wo+Mo|0,wo=bo,bo=go,go=ho,ho=Mo+Fo|0}so[0]+=ho,so[1]+=go,so[2]+=bo,so[3]+=wo,so[4]+=Eo,so[5]+=$o,so[6]+=Co,so[7]+=Ro,lo+=64,uo-=64}return lo}function oo(ao){var so=new ro;so.update(ao);var co=so.digest();return so.clean(),co}Xr.hash=oo})(sha256$1);var x25519={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.sharedKey=Xr.generateKeyPair=Xr.generateKeyPairFromSeed=Xr.scalarMultBase=Xr.scalarMult=Xr.SHARED_KEY_LENGTH=Xr.SECRET_KEY_LENGTH=Xr.PUBLIC_KEY_LENGTH=void 0;const eo=random,to=wipe$1;Xr.PUBLIC_KEY_LENGTH=32,Xr.SECRET_KEY_LENGTH=32,Xr.SHARED_KEY_LENGTH=32;function ro(Oo){const jo=new Float64Array(16);if(Oo)for(let Bo=0;Bo>16&1),Bo[Jo-1]&=65535;Bo[15]=Mo[15]-32767-(Bo[14]>>16&1);const Wo=Bo[15]>>16&1;Bo[14]&=65535,ao(Mo,Bo,1-Wo)}for(let Fo=0;Fo<16;Fo++)Oo[2*Fo]=Mo[Fo]&255,Oo[2*Fo+1]=Mo[Fo]>>8}function co(Oo,jo){for(let Bo=0;Bo<16;Bo++)Oo[Bo]=jo[2*Bo]+(jo[2*Bo+1]<<8);Oo[15]&=32767}function lo(Oo,jo,Bo){for(let Mo=0;Mo<16;Mo++)Oo[Mo]=jo[Mo]+Bo[Mo]}function uo(Oo,jo,Bo){for(let Mo=0;Mo<16;Mo++)Oo[Mo]=jo[Mo]-Bo[Mo]}function ho(Oo,jo,Bo){let Mo,Fo,Wo=0,Jo=0,Po=0,fo=0,yo=0,vo=0,_o=0,So=0,To=0,Ao=0,ko=0,mo=0,Io=0,Do=0,Lo=0,Ho=0,Yo=0,Xo=0,qo=0,Ko=0,Qo=0,zo=0,ga=0,$a=0,Sl=0,El=0,Tl=0,Il=0,Zl=0,Vl=0,Ol=0,Dl=Bo[0],Fl=Bo[1],Jl=Bo[2],cu=Bo[3],Ll=Bo[4],Xl=Bo[5],ku=Bo[6],iu=Bo[7],hu=Bo[8],Cu=Bo[9],_l=Bo[10],Go=Bo[11],yl=Bo[12],Al=Bo[13],Ul=Bo[14],su=Bo[15];Mo=jo[0],Wo+=Mo*Dl,Jo+=Mo*Fl,Po+=Mo*Jl,fo+=Mo*cu,yo+=Mo*Ll,vo+=Mo*Xl,_o+=Mo*ku,So+=Mo*iu,To+=Mo*hu,Ao+=Mo*Cu,ko+=Mo*_l,mo+=Mo*Go,Io+=Mo*yl,Do+=Mo*Al,Lo+=Mo*Ul,Ho+=Mo*su,Mo=jo[1],Jo+=Mo*Dl,Po+=Mo*Fl,fo+=Mo*Jl,yo+=Mo*cu,vo+=Mo*Ll,_o+=Mo*Xl,So+=Mo*ku,To+=Mo*iu,Ao+=Mo*hu,ko+=Mo*Cu,mo+=Mo*_l,Io+=Mo*Go,Do+=Mo*yl,Lo+=Mo*Al,Ho+=Mo*Ul,Yo+=Mo*su,Mo=jo[2],Po+=Mo*Dl,fo+=Mo*Fl,yo+=Mo*Jl,vo+=Mo*cu,_o+=Mo*Ll,So+=Mo*Xl,To+=Mo*ku,Ao+=Mo*iu,ko+=Mo*hu,mo+=Mo*Cu,Io+=Mo*_l,Do+=Mo*Go,Lo+=Mo*yl,Ho+=Mo*Al,Yo+=Mo*Ul,Xo+=Mo*su,Mo=jo[3],fo+=Mo*Dl,yo+=Mo*Fl,vo+=Mo*Jl,_o+=Mo*cu,So+=Mo*Ll,To+=Mo*Xl,Ao+=Mo*ku,ko+=Mo*iu,mo+=Mo*hu,Io+=Mo*Cu,Do+=Mo*_l,Lo+=Mo*Go,Ho+=Mo*yl,Yo+=Mo*Al,Xo+=Mo*Ul,qo+=Mo*su,Mo=jo[4],yo+=Mo*Dl,vo+=Mo*Fl,_o+=Mo*Jl,So+=Mo*cu,To+=Mo*Ll,Ao+=Mo*Xl,ko+=Mo*ku,mo+=Mo*iu,Io+=Mo*hu,Do+=Mo*Cu,Lo+=Mo*_l,Ho+=Mo*Go,Yo+=Mo*yl,Xo+=Mo*Al,qo+=Mo*Ul,Ko+=Mo*su,Mo=jo[5],vo+=Mo*Dl,_o+=Mo*Fl,So+=Mo*Jl,To+=Mo*cu,Ao+=Mo*Ll,ko+=Mo*Xl,mo+=Mo*ku,Io+=Mo*iu,Do+=Mo*hu,Lo+=Mo*Cu,Ho+=Mo*_l,Yo+=Mo*Go,Xo+=Mo*yl,qo+=Mo*Al,Ko+=Mo*Ul,Qo+=Mo*su,Mo=jo[6],_o+=Mo*Dl,So+=Mo*Fl,To+=Mo*Jl,Ao+=Mo*cu,ko+=Mo*Ll,mo+=Mo*Xl,Io+=Mo*ku,Do+=Mo*iu,Lo+=Mo*hu,Ho+=Mo*Cu,Yo+=Mo*_l,Xo+=Mo*Go,qo+=Mo*yl,Ko+=Mo*Al,Qo+=Mo*Ul,zo+=Mo*su,Mo=jo[7],So+=Mo*Dl,To+=Mo*Fl,Ao+=Mo*Jl,ko+=Mo*cu,mo+=Mo*Ll,Io+=Mo*Xl,Do+=Mo*ku,Lo+=Mo*iu,Ho+=Mo*hu,Yo+=Mo*Cu,Xo+=Mo*_l,qo+=Mo*Go,Ko+=Mo*yl,Qo+=Mo*Al,zo+=Mo*Ul,ga+=Mo*su,Mo=jo[8],To+=Mo*Dl,Ao+=Mo*Fl,ko+=Mo*Jl,mo+=Mo*cu,Io+=Mo*Ll,Do+=Mo*Xl,Lo+=Mo*ku,Ho+=Mo*iu,Yo+=Mo*hu,Xo+=Mo*Cu,qo+=Mo*_l,Ko+=Mo*Go,Qo+=Mo*yl,zo+=Mo*Al,ga+=Mo*Ul,$a+=Mo*su,Mo=jo[9],Ao+=Mo*Dl,ko+=Mo*Fl,mo+=Mo*Jl,Io+=Mo*cu,Do+=Mo*Ll,Lo+=Mo*Xl,Ho+=Mo*ku,Yo+=Mo*iu,Xo+=Mo*hu,qo+=Mo*Cu,Ko+=Mo*_l,Qo+=Mo*Go,zo+=Mo*yl,ga+=Mo*Al,$a+=Mo*Ul,Sl+=Mo*su,Mo=jo[10],ko+=Mo*Dl,mo+=Mo*Fl,Io+=Mo*Jl,Do+=Mo*cu,Lo+=Mo*Ll,Ho+=Mo*Xl,Yo+=Mo*ku,Xo+=Mo*iu,qo+=Mo*hu,Ko+=Mo*Cu,Qo+=Mo*_l,zo+=Mo*Go,ga+=Mo*yl,$a+=Mo*Al,Sl+=Mo*Ul,El+=Mo*su,Mo=jo[11],mo+=Mo*Dl,Io+=Mo*Fl,Do+=Mo*Jl,Lo+=Mo*cu,Ho+=Mo*Ll,Yo+=Mo*Xl,Xo+=Mo*ku,qo+=Mo*iu,Ko+=Mo*hu,Qo+=Mo*Cu,zo+=Mo*_l,ga+=Mo*Go,$a+=Mo*yl,Sl+=Mo*Al,El+=Mo*Ul,Tl+=Mo*su,Mo=jo[12],Io+=Mo*Dl,Do+=Mo*Fl,Lo+=Mo*Jl,Ho+=Mo*cu,Yo+=Mo*Ll,Xo+=Mo*Xl,qo+=Mo*ku,Ko+=Mo*iu,Qo+=Mo*hu,zo+=Mo*Cu,ga+=Mo*_l,$a+=Mo*Go,Sl+=Mo*yl,El+=Mo*Al,Tl+=Mo*Ul,Il+=Mo*su,Mo=jo[13],Do+=Mo*Dl,Lo+=Mo*Fl,Ho+=Mo*Jl,Yo+=Mo*cu,Xo+=Mo*Ll,qo+=Mo*Xl,Ko+=Mo*ku,Qo+=Mo*iu,zo+=Mo*hu,ga+=Mo*Cu,$a+=Mo*_l,Sl+=Mo*Go,El+=Mo*yl,Tl+=Mo*Al,Il+=Mo*Ul,Zl+=Mo*su,Mo=jo[14],Lo+=Mo*Dl,Ho+=Mo*Fl,Yo+=Mo*Jl,Xo+=Mo*cu,qo+=Mo*Ll,Ko+=Mo*Xl,Qo+=Mo*ku,zo+=Mo*iu,ga+=Mo*hu,$a+=Mo*Cu,Sl+=Mo*_l,El+=Mo*Go,Tl+=Mo*yl,Il+=Mo*Al,Zl+=Mo*Ul,Vl+=Mo*su,Mo=jo[15],Ho+=Mo*Dl,Yo+=Mo*Fl,Xo+=Mo*Jl,qo+=Mo*cu,Ko+=Mo*Ll,Qo+=Mo*Xl,zo+=Mo*ku,ga+=Mo*iu,$a+=Mo*hu,Sl+=Mo*Cu,El+=Mo*_l,Tl+=Mo*Go,Il+=Mo*yl,Zl+=Mo*Al,Vl+=Mo*Ul,Ol+=Mo*su,Wo+=38*Yo,Jo+=38*Xo,Po+=38*qo,fo+=38*Ko,yo+=38*Qo,vo+=38*zo,_o+=38*ga,So+=38*$a,To+=38*Sl,Ao+=38*El,ko+=38*Tl,mo+=38*Il,Io+=38*Zl,Do+=38*Vl,Lo+=38*Ol,Fo=1,Mo=Wo+Fo+65535,Fo=Math.floor(Mo/65536),Wo=Mo-Fo*65536,Mo=Jo+Fo+65535,Fo=Math.floor(Mo/65536),Jo=Mo-Fo*65536,Mo=Po+Fo+65535,Fo=Math.floor(Mo/65536),Po=Mo-Fo*65536,Mo=fo+Fo+65535,Fo=Math.floor(Mo/65536),fo=Mo-Fo*65536,Mo=yo+Fo+65535,Fo=Math.floor(Mo/65536),yo=Mo-Fo*65536,Mo=vo+Fo+65535,Fo=Math.floor(Mo/65536),vo=Mo-Fo*65536,Mo=_o+Fo+65535,Fo=Math.floor(Mo/65536),_o=Mo-Fo*65536,Mo=So+Fo+65535,Fo=Math.floor(Mo/65536),So=Mo-Fo*65536,Mo=To+Fo+65535,Fo=Math.floor(Mo/65536),To=Mo-Fo*65536,Mo=Ao+Fo+65535,Fo=Math.floor(Mo/65536),Ao=Mo-Fo*65536,Mo=ko+Fo+65535,Fo=Math.floor(Mo/65536),ko=Mo-Fo*65536,Mo=mo+Fo+65535,Fo=Math.floor(Mo/65536),mo=Mo-Fo*65536,Mo=Io+Fo+65535,Fo=Math.floor(Mo/65536),Io=Mo-Fo*65536,Mo=Do+Fo+65535,Fo=Math.floor(Mo/65536),Do=Mo-Fo*65536,Mo=Lo+Fo+65535,Fo=Math.floor(Mo/65536),Lo=Mo-Fo*65536,Mo=Ho+Fo+65535,Fo=Math.floor(Mo/65536),Ho=Mo-Fo*65536,Wo+=Fo-1+37*(Fo-1),Fo=1,Mo=Wo+Fo+65535,Fo=Math.floor(Mo/65536),Wo=Mo-Fo*65536,Mo=Jo+Fo+65535,Fo=Math.floor(Mo/65536),Jo=Mo-Fo*65536,Mo=Po+Fo+65535,Fo=Math.floor(Mo/65536),Po=Mo-Fo*65536,Mo=fo+Fo+65535,Fo=Math.floor(Mo/65536),fo=Mo-Fo*65536,Mo=yo+Fo+65535,Fo=Math.floor(Mo/65536),yo=Mo-Fo*65536,Mo=vo+Fo+65535,Fo=Math.floor(Mo/65536),vo=Mo-Fo*65536,Mo=_o+Fo+65535,Fo=Math.floor(Mo/65536),_o=Mo-Fo*65536,Mo=So+Fo+65535,Fo=Math.floor(Mo/65536),So=Mo-Fo*65536,Mo=To+Fo+65535,Fo=Math.floor(Mo/65536),To=Mo-Fo*65536,Mo=Ao+Fo+65535,Fo=Math.floor(Mo/65536),Ao=Mo-Fo*65536,Mo=ko+Fo+65535,Fo=Math.floor(Mo/65536),ko=Mo-Fo*65536,Mo=mo+Fo+65535,Fo=Math.floor(Mo/65536),mo=Mo-Fo*65536,Mo=Io+Fo+65535,Fo=Math.floor(Mo/65536),Io=Mo-Fo*65536,Mo=Do+Fo+65535,Fo=Math.floor(Mo/65536),Do=Mo-Fo*65536,Mo=Lo+Fo+65535,Fo=Math.floor(Mo/65536),Lo=Mo-Fo*65536,Mo=Ho+Fo+65535,Fo=Math.floor(Mo/65536),Ho=Mo-Fo*65536,Wo+=Fo-1+37*(Fo-1),Oo[0]=Wo,Oo[1]=Jo,Oo[2]=Po,Oo[3]=fo,Oo[4]=yo,Oo[5]=vo,Oo[6]=_o,Oo[7]=So,Oo[8]=To,Oo[9]=Ao,Oo[10]=ko,Oo[11]=mo,Oo[12]=Io,Oo[13]=Do,Oo[14]=Lo,Oo[15]=Ho}function go(Oo,jo){ho(Oo,jo,jo)}function bo(Oo,jo){const Bo=ro();for(let Mo=0;Mo<16;Mo++)Bo[Mo]=jo[Mo];for(let Mo=253;Mo>=0;Mo--)go(Bo,Bo),Mo!==2&&Mo!==4&&ho(Bo,Bo,jo);for(let Mo=0;Mo<16;Mo++)Oo[Mo]=Bo[Mo]}function wo(Oo,jo){const Bo=new Uint8Array(32),Mo=new Float64Array(80),Fo=ro(),Wo=ro(),Jo=ro(),Po=ro(),fo=ro(),yo=ro();for(let To=0;To<31;To++)Bo[To]=Oo[To];Bo[31]=Oo[31]&127|64,Bo[0]&=248,co(Mo,jo);for(let To=0;To<16;To++)Wo[To]=Mo[To];Fo[0]=Po[0]=1;for(let To=254;To>=0;--To){const Ao=Bo[To>>>3]>>>(To&7)&1;ao(Fo,Wo,Ao),ao(Jo,Po,Ao),lo(fo,Fo,Jo),uo(Fo,Fo,Jo),lo(Jo,Wo,Po),uo(Wo,Wo,Po),go(Po,fo),go(yo,Fo),ho(Fo,Jo,Fo),ho(Jo,Wo,fo),lo(fo,Fo,Jo),uo(Fo,Fo,Jo),go(Wo,Fo),uo(Jo,Po,yo),ho(Fo,Jo,io),lo(Fo,Fo,Po),ho(Jo,Jo,Fo),ho(Fo,Po,yo),ho(Po,Wo,Mo),go(Wo,fo),ao(Fo,Wo,Ao),ao(Jo,Po,Ao)}for(let To=0;To<16;To++)Mo[To+16]=Fo[To],Mo[To+32]=Jo[To],Mo[To+48]=Wo[To],Mo[To+64]=Po[To];const vo=Mo.subarray(32),_o=Mo.subarray(16);bo(vo,vo),ho(_o,_o,vo);const So=new Uint8Array(32);return so(So,_o),So}Xr.scalarMult=wo;function Eo(Oo){return wo(Oo,no)}Xr.scalarMultBase=Eo;function $o(Oo){if(Oo.length!==Xr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${Xr.SECRET_KEY_LENGTH} bytes`);const jo=new Uint8Array(Oo);return{publicKey:Eo(jo),secretKey:jo}}Xr.generateKeyPairFromSeed=$o;function Co(Oo){const jo=(0,eo.randomBytes)(32,Oo),Bo=$o(jo);return(0,to.wipe)(jo),Bo}Xr.generateKeyPair=Co;function Ro(Oo,jo,Bo=!1){if(Oo.length!==Xr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(jo.length!==Xr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const Mo=wo(Oo,jo);if(Bo){let Fo=0;for(let Wo=0;Wono+io.length,0));const to=allocUnsafe(eo);let ro=0;for(const no of Xr)to.set(no,ro),ro+=no.length;return asUint8Array(to)}function base$1(Xr,eo){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var to=new Uint8Array(256),ro=0;ro>>0,Oo=new Uint8Array(Ro);$o!==Co;){for(var jo=bo[$o],Bo=0,Mo=Ro-1;(jo!==0||Bo>>0,Oo[Mo]=jo%ao>>>0,jo=jo/ao>>>0;if(jo!==0)throw new Error("Non-zero carry");Eo=Bo,$o++}for(var Fo=Ro-Eo;Fo!==Ro&&Oo[Fo]===0;)Fo++;for(var Wo=so.repeat(wo);Fo>>0,Ro=new Uint8Array(Co);bo[wo];){var Oo=to[bo.charCodeAt(wo)];if(Oo===255)return;for(var jo=0,Bo=Co-1;(Oo!==0||jo<$o)&&Bo!==-1;Bo--,jo++)Oo+=ao*Ro[Bo]>>>0,Ro[Bo]=Oo%256>>>0,Oo=Oo/256>>>0;if(Oo!==0)throw new Error("Non-zero carry");$o=jo,wo++}if(bo[wo]!==" "){for(var Mo=Co-$o;Mo!==Co&&Ro[Mo]===0;)Mo++;for(var Fo=new Uint8Array(Eo+(Co-Mo)),Wo=Eo;Mo!==Co;)Fo[Wo++]=Ro[Mo++];return Fo}}}function go(bo){var wo=ho(bo);if(wo)return wo;throw new Error(`Non-${eo} character`)}return{encode:uo,decodeUnsafe:ho,decode:go}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;const coerce$3=Xr=>{if(Xr instanceof Uint8Array&&Xr.constructor.name==="Uint8Array")return Xr;if(Xr instanceof ArrayBuffer)return new Uint8Array(Xr);if(ArrayBuffer.isView(Xr))return new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=Xr=>new TextEncoder().encode(Xr),toString$3=Xr=>new TextDecoder().decode(Xr);class Encoder{constructor(eo,to,ro){this.name=eo,this.prefix=to,this.baseEncode=ro}encode(eo){if(eo instanceof Uint8Array)return`${this.prefix}${this.baseEncode(eo)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(eo,to,ro){if(this.name=eo,this.prefix=to,to.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=to.codePointAt(0),this.baseDecode=ro}decode(eo){if(typeof eo=="string"){if(eo.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(eo)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(eo.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(eo){return or$3(this,eo)}}class ComposedDecoder{constructor(eo){this.decoders=eo}or(eo){return or$3(this,eo)}decode(eo){const to=eo[0],ro=this.decoders[to];if(ro)return ro.decode(eo);throw RangeError(`Unable to decode multibase string ${JSON.stringify(eo)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const or$3=(Xr,eo)=>new ComposedDecoder({...Xr.decoders||{[Xr.prefix]:Xr},...eo.decoders||{[eo.prefix]:eo}});class Codec{constructor(eo,to,ro,no){this.name=eo,this.prefix=to,this.baseEncode=ro,this.baseDecode=no,this.encoder=new Encoder(eo,to,ro),this.decoder=new Decoder(eo,to,no)}encode(eo){return this.encoder.encode(eo)}decode(eo){return this.decoder.decode(eo)}}const from=({name:Xr,prefix:eo,encode:to,decode:ro})=>new Codec(Xr,eo,to,ro),baseX=({prefix:Xr,name:eo,alphabet:to})=>{const{encode:ro,decode:no}=_brrp__multiformats_scope_baseX(to,eo);return from({prefix:Xr,name:eo,encode:ro,decode:io=>coerce$3(no(io))})},decode$5=(Xr,eo,to,ro)=>{const no={};for(let lo=0;lo=8&&(ao-=8,oo[co++]=255&so>>ao)}if(ao>=to||255&so<<8-ao)throw new SyntaxError("Unexpected end of data");return oo},encode$2=(Xr,eo,to)=>{const ro=eo[eo.length-1]==="=",no=(1<to;)oo-=to,io+=eo[no&ao>>oo];if(oo&&(io+=eo[no&ao<from({prefix:eo,name:Xr,encode(no){return encode$2(no,ro,to)},decode(no){return decode$5(no,ro,to,Xr)}}),identity$2=from({prefix:"\0",name:"identity",encode:Xr=>toString$3(Xr),decode:Xr=>fromString$1(Xr)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$2},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((Xr,eo,to)=>(Xr[to]=eo,Xr),[]),alphabetCharsToBytes=alphabet.reduce((Xr,eo,to)=>(Xr[eo.codePointAt(0)]=to,Xr),[]);function encode$1(Xr){return Xr.reduce((eo,to)=>(eo+=alphabetBytesToChars[to],eo),"")}function decode$4(Xr){const eo=[];for(const to of Xr){const ro=alphabetCharsToBytes[to.codePointAt(0)];if(ro===void 0)throw new Error(`Non-base256emoji character: ${to}`);eo.push(ro)}return new Uint8Array(eo)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode:encode$1,decode:decode$4}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(Xr,eo,to,ro){return{name:Xr,prefix:eo,encoder:{name:Xr,prefix:eo,encode:to},decoder:{decode:ro}}}const string$3=createCodec("utf8","u",Xr=>"u"+new TextDecoder("utf8").decode(Xr),Xr=>new TextEncoder().encode(Xr.substring(1))),ascii=createCodec("ascii","a",Xr=>{let eo="a";for(let to=0;to{Xr=Xr.substring(1);const eo=allocUnsafe(Xr.length);for(let to=0;to"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(Xr){return Xr!==""&&userAgentRules.reduce(function(eo,to){var ro=to[0],no=to[1];if(eo)return eo;var io=no.exec(Xr);return!!io&&[ro,io]},!1)}function parseUserAgent(Xr){var eo=matchUserAgent(Xr);if(!eo)return null;var to=eo[0],ro=eo[1];if(to==="searchbot")return new BotInfo;var no=ro[1]&&ro[1].split(".").join("_").split("_").slice(0,3);no?no.length=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param$2(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata$2(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$9(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator$2(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$2(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread$2(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(yo){fo(io[0][3],yo)}}function so(ho){ho.value instanceof __await$2?Promise.resolve(ho.value.v).then(co,lo):fo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function fo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator$2(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await$2(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues$2(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values$2=="function"?__values$2(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject$2(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$3(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$7(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet$2(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet$2(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6$2=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$2},__asyncDelegator:__asyncDelegator$2,__asyncGenerator:__asyncGenerator$2,__asyncValues:__asyncValues$2,__await:__await$2,__awaiter:__awaiter$9,__classPrivateFieldGet:__classPrivateFieldGet$2,__classPrivateFieldSet:__classPrivateFieldSet$2,__createBinding:__createBinding$3,__decorate:__decorate$3,__exportStar:__exportStar$2,__extends:__extends$2,__generator:__generator$2,__importDefault:__importDefault$7,__importStar:__importStar$3,__makeTemplateObject:__makeTemplateObject$2,__metadata:__metadata$2,__param:__param$2,__read:__read$2,__rest:__rest$5,__spread:__spread$2,__spreadArrays:__spreadArrays$2,__values:__values$2},Symbol.toStringTag,{value:"Module"})),require$$0$7=getAugmentedNamespace(tslib_es6$2);var utils$3={},delay={},hasRequiredDelay;function requireDelay(){if(hasRequiredDelay)return delay;hasRequiredDelay=1,Object.defineProperty(delay,"__esModule",{value:!0}),delay.delay=void 0;function Xr(eo){return new Promise(to=>{setTimeout(()=>{to(!0)},eo)})}return delay.delay=Xr,delay}var convert={},constants$7={},misc={},hasRequiredMisc;function requireMisc(){return hasRequiredMisc||(hasRequiredMisc=1,Object.defineProperty(misc,"__esModule",{value:!0}),misc.ONE_THOUSAND=misc.ONE_HUNDRED=void 0,misc.ONE_HUNDRED=100,misc.ONE_THOUSAND=1e3),misc}var time={},hasRequiredTime;function requireTime(){return hasRequiredTime||(hasRequiredTime=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.ONE_YEAR=Xr.FOUR_WEEKS=Xr.THREE_WEEKS=Xr.TWO_WEEKS=Xr.ONE_WEEK=Xr.THIRTY_DAYS=Xr.SEVEN_DAYS=Xr.FIVE_DAYS=Xr.THREE_DAYS=Xr.ONE_DAY=Xr.TWENTY_FOUR_HOURS=Xr.TWELVE_HOURS=Xr.SIX_HOURS=Xr.THREE_HOURS=Xr.ONE_HOUR=Xr.SIXTY_MINUTES=Xr.THIRTY_MINUTES=Xr.TEN_MINUTES=Xr.FIVE_MINUTES=Xr.ONE_MINUTE=Xr.SIXTY_SECONDS=Xr.THIRTY_SECONDS=Xr.TEN_SECONDS=Xr.FIVE_SECONDS=Xr.ONE_SECOND=void 0,Xr.ONE_SECOND=1,Xr.FIVE_SECONDS=5,Xr.TEN_SECONDS=10,Xr.THIRTY_SECONDS=30,Xr.SIXTY_SECONDS=60,Xr.ONE_MINUTE=Xr.SIXTY_SECONDS,Xr.FIVE_MINUTES=Xr.ONE_MINUTE*5,Xr.TEN_MINUTES=Xr.ONE_MINUTE*10,Xr.THIRTY_MINUTES=Xr.ONE_MINUTE*30,Xr.SIXTY_MINUTES=Xr.ONE_MINUTE*60,Xr.ONE_HOUR=Xr.SIXTY_MINUTES,Xr.THREE_HOURS=Xr.ONE_HOUR*3,Xr.SIX_HOURS=Xr.ONE_HOUR*6,Xr.TWELVE_HOURS=Xr.ONE_HOUR*12,Xr.TWENTY_FOUR_HOURS=Xr.ONE_HOUR*24,Xr.ONE_DAY=Xr.TWENTY_FOUR_HOURS,Xr.THREE_DAYS=Xr.ONE_DAY*3,Xr.FIVE_DAYS=Xr.ONE_DAY*5,Xr.SEVEN_DAYS=Xr.ONE_DAY*7,Xr.THIRTY_DAYS=Xr.ONE_DAY*30,Xr.ONE_WEEK=Xr.SEVEN_DAYS,Xr.TWO_WEEKS=Xr.ONE_WEEK*2,Xr.THREE_WEEKS=Xr.ONE_WEEK*3,Xr.FOUR_WEEKS=Xr.ONE_WEEK*4,Xr.ONE_YEAR=Xr.ONE_DAY*365}(time)),time}var hasRequiredConstants$1;function requireConstants$1(){return hasRequiredConstants$1||(hasRequiredConstants$1=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireMisc(),Xr),eo.__exportStar(requireTime(),Xr)}(constants$7)),constants$7}var hasRequiredConvert;function requireConvert(){if(hasRequiredConvert)return convert;hasRequiredConvert=1,Object.defineProperty(convert,"__esModule",{value:!0}),convert.fromMiliseconds=convert.toMiliseconds=void 0;const Xr=requireConstants$1();function eo(ro){return ro*Xr.ONE_THOUSAND}convert.toMiliseconds=eo;function to(ro){return Math.floor(ro/Xr.ONE_THOUSAND)}return convert.fromMiliseconds=to,convert}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireDelay(),Xr),eo.__exportStar(requireConvert(),Xr)}(utils$3)),utils$3}var watch$2={},hasRequiredWatch$1;function requireWatch$1(){if(hasRequiredWatch$1)return watch$2;hasRequiredWatch$1=1,Object.defineProperty(watch$2,"__esModule",{value:!0}),watch$2.Watch=void 0;class Xr{constructor(){this.timestamps=new Map}start(to){if(this.timestamps.has(to))throw new Error(`Watch already started for label: ${to}`);this.timestamps.set(to,{started:Date.now()})}stop(to){const ro=this.get(to);if(typeof ro.elapsed<"u")throw new Error(`Watch already stopped for label: ${to}`);const no=Date.now()-ro.started;this.timestamps.set(to,{started:ro.started,elapsed:no})}get(to){const ro=this.timestamps.get(to);if(typeof ro>"u")throw new Error(`No timestamp found for label: ${to}`);return ro}elapsed(to){const ro=this.get(to);return ro.elapsed||Date.now()-ro.started}}return watch$2.Watch=Xr,watch$2.default=Xr,watch$2}var types$1={},watch$1={},hasRequiredWatch;function requireWatch(){if(hasRequiredWatch)return watch$1;hasRequiredWatch=1,Object.defineProperty(watch$1,"__esModule",{value:!0}),watch$1.IWatch=void 0;class Xr{}return watch$1.IWatch=Xr,watch$1}var hasRequiredTypes$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$7.__exportStar(requireWatch(),Xr)}(types$1)),types$1}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireUtils(),Xr),eo.__exportStar(requireWatch$1(),Xr),eo.__exportStar(requireTypes$1(),Xr),eo.__exportStar(requireConstants$1(),Xr)})(cjs$4);var cjs$3={};Object.defineProperty(cjs$3,"__esModule",{value:!0});cjs$3.getLocalStorage=cjs$3.getLocalStorageOrThrow=cjs$3.getCrypto=cjs$3.getCryptoOrThrow=getLocation_1=cjs$3.getLocation=cjs$3.getLocationOrThrow=getNavigator_1=cjs$3.getNavigator=cjs$3.getNavigatorOrThrow=getDocument_1=cjs$3.getDocument=cjs$3.getDocumentOrThrow=cjs$3.getFromWindowOrThrow=cjs$3.getFromWindow=void 0;function getFromWindow(Xr){let eo;return typeof window<"u"&&typeof window[Xr]<"u"&&(eo=window[Xr]),eo}cjs$3.getFromWindow=getFromWindow;function getFromWindowOrThrow(Xr){const eo=getFromWindow(Xr);if(!eo)throw new Error(`${Xr} is not defined in Window`);return eo}cjs$3.getFromWindowOrThrow=getFromWindowOrThrow;function getDocumentOrThrow(){return getFromWindowOrThrow("document")}cjs$3.getDocumentOrThrow=getDocumentOrThrow;function getDocument(){return getFromWindow("document")}var getDocument_1=cjs$3.getDocument=getDocument;function getNavigatorOrThrow(){return getFromWindowOrThrow("navigator")}cjs$3.getNavigatorOrThrow=getNavigatorOrThrow;function getNavigator(){return getFromWindow("navigator")}var getNavigator_1=cjs$3.getNavigator=getNavigator;function getLocationOrThrow(){return getFromWindowOrThrow("location")}cjs$3.getLocationOrThrow=getLocationOrThrow;function getLocation$1(){return getFromWindow("location")}var getLocation_1=cjs$3.getLocation=getLocation$1;function getCryptoOrThrow(){return getFromWindowOrThrow("crypto")}cjs$3.getCryptoOrThrow=getCryptoOrThrow;function getCrypto(){return getFromWindow("crypto")}cjs$3.getCrypto=getCrypto;function getLocalStorageOrThrow(){return getFromWindowOrThrow("localStorage")}cjs$3.getLocalStorageOrThrow=getLocalStorageOrThrow;function getLocalStorage(){return getFromWindow("localStorage")}cjs$3.getLocalStorage=getLocalStorage;var cjs$2={};Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$3;function getWindowMetadata(){let Xr,eo;try{Xr=window_getters_1.getDocumentOrThrow(),eo=window_getters_1.getLocationOrThrow()}catch{return null}function to(){const fo=Xr.getElementsByTagName("link"),ho=[];for(let go=0;go-1){const wo=yo.getAttribute("href");if(wo)if(wo.toLowerCase().indexOf("https:")===-1&&wo.toLowerCase().indexOf("http:")===-1&&wo.indexOf("//")!==0){let Eo=eo.protocol+"//"+eo.host;if(wo.indexOf("/")===0)Eo+=wo;else{const ko=eo.pathname.split("/");ko.pop();const Ao=ko.join("/");Eo+=Ao+"/"+wo}ho.push(Eo)}else if(wo.indexOf("//")===0){const Eo=eo.protocol+wo;ho.push(Eo)}else ho.push(wo)}}return ho}function ro(...fo){const ho=Xr.getElementsByTagName("meta");for(let go=0;goyo.getAttribute(wo)).filter(wo=>wo?fo.includes(wo):!1);if(vo.length&&vo){const wo=yo.getAttribute("content");if(wo)return wo}}return""}function no(){let fo=ro("name","og:site_name","og:title","twitter:title");return fo||(fo=Xr.title),fo}function io(){return ro("description","og:description","twitter:description","keywords")}const oo=no(),ao=io(),so=eo.origin,co=to();return{description:ao,url:so,icons:co,name:oo}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var queryString={},strictUriEncode=Xr=>encodeURIComponent(Xr).replace(/[!'()*]/g,eo=>`%${eo.charCodeAt(0).toString(16).toUpperCase()}`),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(Xr,eo){try{return[decodeURIComponent(Xr.join(""))]}catch{}if(Xr.length===1)return Xr;eo=eo||1;var to=Xr.slice(0,eo),ro=Xr.slice(eo);return Array.prototype.concat.call([],decodeComponents(to),decodeComponents(ro))}function decode$3(Xr){try{return decodeURIComponent(Xr)}catch{for(var eo=Xr.match(singleMatcher)||[],to=1;to{if(!(typeof Xr=="string"&&typeof eo=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(eo==="")return[Xr];const to=Xr.indexOf(eo);return to===-1?[Xr]:[Xr.slice(0,to),Xr.slice(to+eo.length)]},filterObj=function(Xr,eo){for(var to={},ro=Object.keys(Xr),no=Array.isArray(eo),io=0;ioko==null,oo=Symbol("encodeFragmentIdentifier");function ao(ko){switch(ko.arrayFormat){case"index":return Ao=>(Po,jo)=>{const Mo=Po.length;return jo===void 0||ko.skipNull&&jo===null||ko.skipEmptyString&&jo===""?Po:jo===null?[...Po,[lo(Ao,ko),"[",Mo,"]"].join("")]:[...Po,[lo(Ao,ko),"[",lo(Mo,ko),"]=",lo(jo,ko)].join("")]};case"bracket":return Ao=>(Po,jo)=>jo===void 0||ko.skipNull&&jo===null||ko.skipEmptyString&&jo===""?Po:jo===null?[...Po,[lo(Ao,ko),"[]"].join("")]:[...Po,[lo(Ao,ko),"[]=",lo(jo,ko)].join("")];case"colon-list-separator":return Ao=>(Po,jo)=>jo===void 0||ko.skipNull&&jo===null||ko.skipEmptyString&&jo===""?Po:jo===null?[...Po,[lo(Ao,ko),":list="].join("")]:[...Po,[lo(Ao,ko),":list=",lo(jo,ko)].join("")];case"comma":case"separator":case"bracket-separator":{const Ao=ko.arrayFormat==="bracket-separator"?"[]=":"=";return Po=>(jo,Mo)=>Mo===void 0||ko.skipNull&&Mo===null||ko.skipEmptyString&&Mo===""?jo:(Mo=Mo===null?"":Mo,jo.length===0?[[lo(Po,ko),Ao,lo(Mo,ko)].join("")]:[[jo,lo(Mo,ko)].join(ko.arrayFormatSeparator)])}default:return Ao=>(Po,jo)=>jo===void 0||ko.skipNull&&jo===null||ko.skipEmptyString&&jo===""?Po:jo===null?[...Po,lo(Ao,ko)]:[...Po,[lo(Ao,ko),"=",lo(jo,ko)].join("")]}}function so(ko){let Ao;switch(ko.arrayFormat){case"index":return(Po,jo,Mo)=>{if(Ao=/\[(\d*)\]$/.exec(Po),Po=Po.replace(/\[\d*\]$/,""),!Ao){Mo[Po]=jo;return}Mo[Po]===void 0&&(Mo[Po]={}),Mo[Po][Ao[1]]=jo};case"bracket":return(Po,jo,Mo)=>{if(Ao=/(\[\])$/.exec(Po),Po=Po.replace(/\[\]$/,""),!Ao){Mo[Po]=jo;return}if(Mo[Po]===void 0){Mo[Po]=[jo];return}Mo[Po]=[].concat(Mo[Po],jo)};case"colon-list-separator":return(Po,jo,Mo)=>{if(Ao=/(:list)$/.exec(Po),Po=Po.replace(/:list$/,""),!Ao){Mo[Po]=jo;return}if(Mo[Po]===void 0){Mo[Po]=[jo];return}Mo[Po]=[].concat(Mo[Po],jo)};case"comma":case"separator":return(Po,jo,Mo)=>{const No=typeof jo=="string"&&jo.includes(ko.arrayFormatSeparator),Do=typeof jo=="string"&&!No&&fo(jo,ko).includes(ko.arrayFormatSeparator);jo=Do?fo(jo,ko):jo;const Fo=No||Do?jo.split(ko.arrayFormatSeparator).map(Xo=>fo(Xo,ko)):jo===null?jo:fo(jo,ko);Mo[Po]=Fo};case"bracket-separator":return(Po,jo,Mo)=>{const No=/(\[\])$/.test(Po);if(Po=Po.replace(/\[\]$/,""),!No){Mo[Po]=jo&&fo(jo,ko);return}const Do=jo===null?[]:jo.split(ko.arrayFormatSeparator).map(Fo=>fo(Fo,ko));if(Mo[Po]===void 0){Mo[Po]=Do;return}Mo[Po]=[].concat(Mo[Po],Do)};default:return(Po,jo,Mo)=>{if(Mo[Po]===void 0){Mo[Po]=jo;return}Mo[Po]=[].concat(Mo[Po],jo)}}}function co(ko){if(typeof ko!="string"||ko.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function lo(ko,Ao){return Ao.encode?Ao.strict?eo(ko):encodeURIComponent(ko):ko}function fo(ko,Ao){return Ao.decode?to(ko):ko}function ho(ko){return Array.isArray(ko)?ko.sort():typeof ko=="object"?ho(Object.keys(ko)).sort((Ao,Po)=>Number(Ao)-Number(Po)).map(Ao=>ko[Ao]):ko}function go(ko){const Ao=ko.indexOf("#");return Ao!==-1&&(ko=ko.slice(0,Ao)),ko}function yo(ko){let Ao="";const Po=ko.indexOf("#");return Po!==-1&&(Ao=ko.slice(Po)),Ao}function vo(ko){ko=go(ko);const Ao=ko.indexOf("?");return Ao===-1?"":ko.slice(Ao+1)}function wo(ko,Ao){return Ao.parseNumbers&&!Number.isNaN(Number(ko))&&typeof ko=="string"&&ko.trim()!==""?ko=Number(ko):Ao.parseBooleans&&ko!==null&&(ko.toLowerCase()==="true"||ko.toLowerCase()==="false")&&(ko=ko.toLowerCase()==="true"),ko}function Eo(ko,Ao){Ao=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Ao),co(Ao.arrayFormatSeparator);const Po=so(Ao),jo=Object.create(null);if(typeof ko!="string"||(ko=ko.trim().replace(/^[?#&]/,""),!ko))return jo;for(const Mo of ko.split("&")){if(Mo==="")continue;let[No,Do]=ro(Ao.decode?Mo.replace(/\+/g," "):Mo,"=");Do=Do===void 0?null:["comma","separator","bracket-separator"].includes(Ao.arrayFormat)?Do:fo(Do,Ao),Po(fo(No,Ao),Do,jo)}for(const Mo of Object.keys(jo)){const No=jo[Mo];if(typeof No=="object"&&No!==null)for(const Do of Object.keys(No))No[Do]=wo(No[Do],Ao);else jo[Mo]=wo(No,Ao)}return Ao.sort===!1?jo:(Ao.sort===!0?Object.keys(jo).sort():Object.keys(jo).sort(Ao.sort)).reduce((Mo,No)=>{const Do=jo[No];return Do&&typeof Do=="object"&&!Array.isArray(Do)?Mo[No]=ho(Do):Mo[No]=Do,Mo},Object.create(null))}Xr.extract=vo,Xr.parse=Eo,Xr.stringify=(ko,Ao)=>{if(!ko)return"";Ao=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Ao),co(Ao.arrayFormatSeparator);const Po=Do=>Ao.skipNull&&io(ko[Do])||Ao.skipEmptyString&&ko[Do]==="",jo=ao(Ao),Mo={};for(const Do of Object.keys(ko))Po(Do)||(Mo[Do]=ko[Do]);const No=Object.keys(Mo);return Ao.sort!==!1&&No.sort(Ao.sort),No.map(Do=>{const Fo=ko[Do];return Fo===void 0?"":Fo===null?lo(Do,Ao):Array.isArray(Fo)?Fo.length===0&&Ao.arrayFormat==="bracket-separator"?lo(Do,Ao)+"[]":Fo.reduce(jo(Do),[]).join("&"):lo(Do,Ao)+"="+lo(Fo,Ao)}).filter(Do=>Do.length>0).join("&")},Xr.parseUrl=(ko,Ao)=>{Ao=Object.assign({decode:!0},Ao);const[Po,jo]=ro(ko,"#");return Object.assign({url:Po.split("?")[0]||"",query:Eo(vo(ko),Ao)},Ao&&Ao.parseFragmentIdentifier&&jo?{fragmentIdentifier:fo(jo,Ao)}:{})},Xr.stringifyUrl=(ko,Ao)=>{Ao=Object.assign({encode:!0,strict:!0,[oo]:!0},Ao);const Po=go(ko.url).split("?")[0]||"",jo=Xr.extract(ko.url),Mo=Xr.parse(jo,{sort:!1}),No=Object.assign(Mo,ko.query);let Do=Xr.stringify(No,Ao);Do&&(Do=`?${Do}`);let Fo=yo(ko.url);return ko.fragmentIdentifier&&(Fo=`#${Ao[oo]?lo(ko.fragmentIdentifier,Ao):ko.fragmentIdentifier}`),`${Po}${Do}${Fo}`},Xr.pick=(ko,Ao,Po)=>{Po=Object.assign({parseFragmentIdentifier:!0,[oo]:!1},Po);const{url:jo,query:Mo,fragmentIdentifier:No}=Xr.parseUrl(ko,Po);return Xr.stringifyUrl({url:jo,query:no(Mo,Ao),fragmentIdentifier:No},Po)},Xr.exclude=(ko,Ao,Po)=>{const jo=Array.isArray(Ao)?Mo=>!Ao.includes(Mo):(Mo,No)=>!Ao(Mo,No);return Xr.pick(ko,jo,Po)}})(queryString);const C$6={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},K$3=":";function ve$2(Xr){const[eo,to]=Xr.split(K$3);return{namespace:eo,reference:to}}function Un$1(Xr,eo=[]){const to=[];return Object.keys(Xr).forEach(ro=>{if(eo.length&&!eo.includes(ro))return;const no=Xr[ro];to.push(...no.accounts)}),to}function L$8(Xr,eo){return Xr.includes(":")?[Xr]:eo.chains||[]}const J$3="base10",p$7="base16",F$7="base64pad",H$4="utf8",Q$6=0,_$9=1,Dn$1=0,Te$2=1,Z$3=12,X$3=32;function kn$1(){const Xr=x25519.generateKeyPair();return{privateKey:toString$2(Xr.secretKey,p$7),publicKey:toString$2(Xr.publicKey,p$7)}}function Vn$2(){const Xr=random.randomBytes(X$3);return toString$2(Xr,p$7)}function Mn$1(Xr,eo){const to=x25519.sharedKey(fromString(Xr,p$7),fromString(eo,p$7),!0),ro=new HKDF_1(sha256$1.SHA256,to).expand(X$3);return toString$2(ro,p$7)}function Kn$1(Xr){const eo=sha256$1.hash(fromString(Xr,p$7));return toString$2(eo,p$7)}function Ln$1(Xr){const eo=sha256$1.hash(fromString(Xr,H$4));return toString$2(eo,p$7)}function Pe$2(Xr){return fromString(`${Xr}`,J$3)}function j$9(Xr){return Number(toString$2(Xr,J$3))}function xn$1(Xr){const eo=Pe$2(typeof Xr.type<"u"?Xr.type:Q$6);if(j$9(eo)===_$9&&typeof Xr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const to=typeof Xr.senderPublicKey<"u"?fromString(Xr.senderPublicKey,p$7):void 0,ro=typeof Xr.iv<"u"?fromString(Xr.iv,p$7):random.randomBytes(Z$3),no=new chacha20poly1305.ChaCha20Poly1305(fromString(Xr.symKey,p$7)).seal(ro,fromString(Xr.message,H$4));return Re$2({type:eo,sealed:no,iv:ro,senderPublicKey:to})}function Fn$1(Xr){const eo=new chacha20poly1305.ChaCha20Poly1305(fromString(Xr.symKey,p$7)),{sealed:to,iv:ro}=ee$4(Xr.encoded),no=eo.open(ro,to);if(no===null)throw new Error("Failed to decrypt");return toString$2(no,H$4)}function Re$2(Xr){if(j$9(Xr.type)===_$9){if(typeof Xr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString$2(concat([Xr.type,Xr.senderPublicKey,Xr.iv,Xr.sealed]),F$7)}return toString$2(concat([Xr.type,Xr.iv,Xr.sealed]),F$7)}function ee$4(Xr){const eo=fromString(Xr,F$7),to=eo.slice(Dn$1,Te$2),ro=Te$2;if(j$9(to)===_$9){const ao=ro+X$3,so=ao+Z$3,co=eo.slice(ro,ao),lo=eo.slice(ao,so),fo=eo.slice(so);return{type:to,sealed:fo,iv:lo,senderPublicKey:co}}const no=ro+Z$3,io=eo.slice(ro,no),oo=eo.slice(no);return{type:to,sealed:oo,iv:io}}function Hn$1(Xr,eo){const to=ee$4(Xr);return Ae$1({type:j$9(to.type),senderPublicKey:typeof to.senderPublicKey<"u"?toString$2(to.senderPublicKey,p$7):void 0,receiverPublicKey:eo==null?void 0:eo.receiverPublicKey})}function Ae$1(Xr){const eo=(Xr==null?void 0:Xr.type)||Q$6;if(eo===_$9){if(typeof(Xr==null?void 0:Xr.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(Xr==null?void 0:Xr.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:eo,senderPublicKey:Xr==null?void 0:Xr.senderPublicKey,receiverPublicKey:Xr==null?void 0:Xr.receiverPublicKey}}function qn$1(Xr){return Xr.type===_$9&&typeof Xr.senderPublicKey=="string"&&typeof Xr.receiverPublicKey=="string"}var Bn$1=Object.defineProperty,Ue$3=Object.getOwnPropertySymbols,Gn$1=Object.prototype.hasOwnProperty,Wn$1=Object.prototype.propertyIsEnumerable,_e$2=(Xr,eo,to)=>eo in Xr?Bn$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,$e$2=(Xr,eo)=>{for(var to in eo||(eo={}))Gn$1.call(eo,to)&&_e$2(Xr,to,eo[to]);if(Ue$3)for(var to of Ue$3(eo))Wn$1.call(eo,to)&&_e$2(Xr,to,eo[to]);return Xr};const Ce$2="ReactNative",m$4={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},De$3="js";function te$3(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}function $$5(){return!getDocument_1()&&!!getNavigator_1()&&navigator.product===Ce$2}function D$7(){return!te$3()&&!!getNavigator_1()&&!!getDocument_1()}function R$5(){return $$5()?m$4.reactNative:te$3()?m$4.node:D$7()?m$4.browser:m$4.unknown}function Jn$1(){var Xr;try{return $$5()&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Application)<"u"?(Xr=global$1.Application)==null?void 0:Xr.applicationId:void 0}catch{return}}function ke$3(Xr,eo){let to=queryString.parse(Xr);return to=$e$2($e$2({},to),eo),Xr=queryString.stringify(to),Xr}function Qn$1(){return getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Ve$3(){if(R$5()===m$4.reactNative&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Platform)<"u"){const{OS:to,Version:ro}=global$1.Platform;return[to,ro].join("-")}const Xr=detect();if(Xr===null)return"unknown";const eo=Xr.os?Xr.os.replace(" ","").toLowerCase():"unknown";return Xr.type==="browser"?[eo,Xr.name,Xr.version].join("-"):[eo,Xr.version].join("-")}function Me$1(){var Xr;const eo=R$5();return eo===m$4.browser?[eo,((Xr=getLocation_1())==null?void 0:Xr.host)||"unknown"].join(":"):eo}function Ke$2(Xr,eo,to){const ro=Ve$3(),no=Me$1();return[[Xr,eo].join("-"),[De$3,to].join("-"),ro,no].join("/")}function Xn$1({protocol:Xr,version:eo,relayUrl:to,sdkVersion:ro,auth:no,projectId:io,useOnCloseEvent:oo,bundleId:ao}){const so=to.split("?"),co=Ke$2(Xr,eo,ro),lo={auth:no,ua:co,projectId:io,useOnCloseEvent:oo||void 0,origin:ao||void 0},fo=ke$3(so[1]||"",lo);return so[0]+"?"+fo}function O$a(Xr,eo){return Xr.filter(to=>eo.includes(to)).length===Xr.length}function rt$3(Xr){return Object.fromEntries(Xr.entries())}function ot$2(Xr){return new Map(Object.entries(Xr))}function at$3(Xr=cjs$4.FIVE_MINUTES,eo){const to=cjs$4.toMiliseconds(Xr||cjs$4.FIVE_MINUTES);let ro,no,io;return{resolve:oo=>{io&&ro&&(clearTimeout(io),ro(oo))},reject:oo=>{io&&no&&(clearTimeout(io),no(oo))},done:()=>new Promise((oo,ao)=>{io=setTimeout(()=>{ao(new Error(eo))},to),ro=oo,no=ao})}}function ut$5(Xr,eo,to){return new Promise(async(ro,no)=>{const io=setTimeout(()=>no(new Error(to)),eo);try{const oo=await Xr;ro(oo)}catch(oo){no(oo)}clearTimeout(io)})}function re$2(Xr,eo){if(typeof eo=="string"&&eo.startsWith(`${Xr}:`))return eo;if(Xr.toLowerCase()==="topic"){if(typeof eo!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${eo}`}else if(Xr.toLowerCase()==="id"){if(typeof eo!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${eo}`}throw new Error(`Unknown expirer target type: ${Xr}`)}function lt$3(Xr){return re$2("topic",Xr)}function dt$3(Xr){return re$2("id",Xr)}function ft$4(Xr){const[eo,to]=Xr.split(":"),ro={id:void 0,topic:void 0};if(eo==="topic"&&typeof to=="string")ro.topic=to;else if(eo==="id"&&Number.isInteger(Number(to)))ro.id=Number(to);else throw new Error(`Invalid target, expected id:number or topic:string, got ${eo}:${to}`);return ro}function pt$3(Xr,eo){return cjs$4.fromMiliseconds(Date.now()+cjs$4.toMiliseconds(Xr))}function mt$3(Xr){return Date.now()>=cjs$4.toMiliseconds(Xr)}function yt$3(Xr,eo){return`${Xr}${eo?`:${eo}`:""}`}function S$7(Xr=[],eo=[]){return[...new Set([...Xr,...eo])]}async function gt$3({id:Xr,topic:eo,wcDeepLink:to}){try{if(!to)return;const ro=typeof to=="string"?JSON.parse(to):to;let no=ro==null?void 0:ro.href;if(typeof no!="string")return;no.endsWith("/")&&(no=no.slice(0,-1));const io=`${no}/wc?requestId=${Xr}&sessionTopic=${eo}`,oo=R$5();oo===m$4.browser?io.startsWith("https://")?window.open(io,"_blank","noreferrer noopener"):window.open(io,"_self","noreferrer noopener"):oo===m$4.reactNative&&typeof(global$1==null?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(io)}catch(ro){console.error(ro)}}async function ht$3(Xr,eo){try{return await Xr.getItem(eo)||(D$7()?localStorage.getItem(eo):void 0)}catch(to){console.error(to)}}const He$3="irn";function vt$3(Xr){return(Xr==null?void 0:Xr.relay)||{protocol:He$3}}function Et$3(Xr){const eo=C$6[Xr];if(typeof eo>"u")throw new Error(`Relay Protocol not supported: ${Xr}`);return eo}var bt$3=Object.defineProperty,Nt$3=Object.defineProperties,Ot$3=Object.getOwnPropertyDescriptors,qe$3=Object.getOwnPropertySymbols,St$3=Object.prototype.hasOwnProperty,wt$3=Object.prototype.propertyIsEnumerable,Be$3=(Xr,eo,to)=>eo in Xr?bt$3(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,It$2=(Xr,eo)=>{for(var to in eo||(eo={}))St$3.call(eo,to)&&Be$3(Xr,to,eo[to]);if(qe$3)for(var to of qe$3(eo))wt$3.call(eo,to)&&Be$3(Xr,to,eo[to]);return Xr},Tt$3=(Xr,eo)=>Nt$3(Xr,Ot$3(eo));function Ge$3(Xr,eo="-"){const to={},ro="relay"+eo;return Object.keys(Xr).forEach(no=>{if(no.startsWith(ro)){const io=no.replace(ro,""),oo=Xr[no];to[io]=oo}}),to}function Pt$3(Xr){Xr=Xr.includes("wc://")?Xr.replace("wc://",""):Xr,Xr=Xr.includes("wc:")?Xr.replace("wc:",""):Xr;const eo=Xr.indexOf(":"),to=Xr.indexOf("?")!==-1?Xr.indexOf("?"):void 0,ro=Xr.substring(0,eo),no=Xr.substring(eo+1,to).split("@"),io=typeof to<"u"?Xr.substring(to):"",oo=queryString.parse(io);return{protocol:ro,topic:We$3(no[0]),version:parseInt(no[1],10),symKey:oo.symKey,relay:Ge$3(oo),expiryTimestamp:oo.expiryTimestamp?parseInt(oo.expiryTimestamp,10):void 0}}function We$3(Xr){return Xr.startsWith("//")?Xr.substring(2):Xr}function ze$2(Xr,eo="-"){const to="relay",ro={};return Object.keys(Xr).forEach(no=>{const io=to+eo+no;Xr[no]&&(ro[io]=Xr[no])}),ro}function Rt$3(Xr){return`${Xr.protocol}:${Xr.topic}@${Xr.version}?`+queryString.stringify(Tt$3(It$2({symKey:Xr.symKey},ze$2(Xr.relay)),{expiryTimestamp:Xr.expiryTimestamp}))}function A$6(Xr){const eo=[];return Xr.forEach(to=>{const[ro,no]=to.split(":");eo.push(`${ro}:${no}`)}),eo}function Qe$3(Xr){const eo=[];return Object.values(Xr).forEach(to=>{eo.push(...A$6(to.accounts))}),eo}function Ze$3(Xr,eo){const to=[];return Object.values(Xr).forEach(ro=>{A$6(ro.accounts).includes(eo)&&to.push(...ro.methods)}),to}function Xe$3(Xr,eo){const to=[];return Object.values(Xr).forEach(ro=>{A$6(ro.accounts).includes(eo)&&to.push(...ro.events)}),to}function oe$3(Xr){return Xr.includes(":")}function en$1(Xr){return oe$3(Xr)?Xr.split(":")[0]:Xr}const nn={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tn$1={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N$7(Xr,eo){const{message:to,code:ro}=tn$1[Xr];return{message:eo?`${to} ${eo}`:to,code:ro}}function U$6(Xr,eo){const{message:to,code:ro}=nn[Xr];return{message:eo?`${to} ${eo}`:to,code:ro}}function k$4(Xr,eo){return!!Array.isArray(Xr)}function B$5(Xr){return Object.getPrototypeOf(Xr)===Object.prototype&&Object.keys(Xr).length}function w$9(Xr){return typeof Xr>"u"}function g$b(Xr,eo){return eo&&w$9(Xr)?!0:typeof Xr=="string"&&!!Xr.trim().length}function G$4(Xr,eo){return typeof Xr=="number"&&!isNaN(Xr)}function Mt$2(Xr,eo){const{requiredNamespaces:to}=eo,ro=Object.keys(Xr.namespaces),no=Object.keys(to);let io=!0;return O$a(no,ro)?(ro.forEach(oo=>{const{accounts:ao,methods:so,events:co}=Xr.namespaces[oo],lo=A$6(ao),fo=to[oo];(!O$a(L$8(oo,fo),lo)||!O$a(fo.methods,so)||!O$a(fo.events,co))&&(io=!1)}),io):!1}function V$3(Xr){return g$b(Xr,!1)&&Xr.includes(":")?Xr.split(":").length===2:!1}function rn(Xr){if(g$b(Xr,!1)&&Xr.includes(":")){const eo=Xr.split(":");if(eo.length===3){const to=eo[0]+":"+eo[1];return!!eo[2]&&V$3(to)}}return!1}function Kt$3(Xr){if(g$b(Xr,!1))try{return typeof new URL(Xr)<"u"}catch{return!1}return!1}function Lt$2(Xr){var eo;return(eo=Xr==null?void 0:Xr.proposer)==null?void 0:eo.publicKey}function xt$3(Xr){return Xr==null?void 0:Xr.topic}function Ft$3(Xr,eo){let to=null;return g$b(Xr==null?void 0:Xr.publicKey,!1)||(to=N$7("MISSING_OR_INVALID",`${eo} controller public key should be a string`)),to}function ie$2(Xr){let eo=!0;return k$4(Xr)?Xr.length&&(eo=Xr.every(to=>g$b(to,!1))):eo=!1,eo}function on(Xr,eo,to){let ro=null;return k$4(eo)&&eo.length?eo.forEach(no=>{ro||V$3(no)||(ro=U$6("UNSUPPORTED_CHAINS",`${to}, chain ${no} should be a string and conform to "namespace:chainId" format`))}):V$3(Xr)||(ro=U$6("UNSUPPORTED_CHAINS",`${to}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),ro}function sn(Xr,eo,to){let ro=null;return Object.entries(Xr).forEach(([no,io])=>{if(ro)return;const oo=on(no,L$8(no,io),`${eo} ${to}`);oo&&(ro=oo)}),ro}function cn(Xr,eo){let to=null;return k$4(Xr)?Xr.forEach(ro=>{to||rn(ro)||(to=U$6("UNSUPPORTED_ACCOUNTS",`${eo}, account ${ro} should be a string and conform to "namespace:chainId:address" format`))}):to=U$6("UNSUPPORTED_ACCOUNTS",`${eo}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),to}function an(Xr,eo){let to=null;return Object.values(Xr).forEach(ro=>{if(to)return;const no=cn(ro==null?void 0:ro.accounts,`${eo} namespace`);no&&(to=no)}),to}function un$1(Xr,eo){let to=null;return ie$2(Xr==null?void 0:Xr.methods)?ie$2(Xr==null?void 0:Xr.events)||(to=U$6("UNSUPPORTED_EVENTS",`${eo}, events should be an array of strings or empty array for no events`)):to=U$6("UNSUPPORTED_METHODS",`${eo}, methods should be an array of strings or empty array for no methods`),to}function ce$4(Xr,eo){let to=null;return Object.values(Xr).forEach(ro=>{if(to)return;const no=un$1(ro,`${eo}, namespace`);no&&(to=no)}),to}function Ht$3(Xr,eo,to){let ro=null;if(Xr&&B$5(Xr)){const no=ce$4(Xr,eo);no&&(ro=no);const io=sn(Xr,eo,to);io&&(ro=io)}else ro=N$7("MISSING_OR_INVALID",`${eo}, ${to} should be an object with data`);return ro}function ln$1(Xr,eo){let to=null;if(Xr&&B$5(Xr)){const ro=ce$4(Xr,eo);ro&&(to=ro);const no=an(Xr,eo);no&&(to=no)}else to=N$7("MISSING_OR_INVALID",`${eo}, namespaces should be an object with data`);return to}function dn$1(Xr){return g$b(Xr.protocol,!0)}function qt$3(Xr,eo){let to=!1;return Xr?Xr&&k$4(Xr)&&Xr.length&&Xr.forEach(ro=>{to=dn$1(ro)}):to=!0,to}function Bt$3(Xr){return typeof Xr=="number"}function Gt$3(Xr){return typeof Xr<"u"&&typeof Xr!==null}function Wt$2(Xr){return!(!Xr||typeof Xr!="object"||!Xr.code||!G$4(Xr.code)||!Xr.message||!g$b(Xr.message,!1))}function zt$3(Xr){return!(w$9(Xr)||!g$b(Xr.method,!1))}function Yt$3(Xr){return!(w$9(Xr)||w$9(Xr.result)&&w$9(Xr.error)||!G$4(Xr.id)||!g$b(Xr.jsonrpc,!1))}function Jt$3(Xr){return!(w$9(Xr)||!g$b(Xr.name,!1))}function Qt$2(Xr,eo){return!(!V$3(eo)||!Qe$3(Xr).includes(eo))}function Zt$2(Xr,eo,to){return g$b(to,!1)?Ze$3(Xr,eo).includes(to):!1}function Xt$2(Xr,eo,to){return g$b(to,!1)?Xe$3(Xr,eo).includes(to):!1}function fn$1(Xr,eo,to){let ro=null;const no=er$3(Xr),io=nr$2(eo),oo=Object.keys(no),ao=Object.keys(io),so=pn$1(Object.keys(Xr)),co=pn$1(Object.keys(eo)),lo=so.filter(fo=>!co.includes(fo));return lo.length&&(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces keys don't satisfy requiredNamespaces. +***************************************************************************** */var extendStatics$2=function(Xr,eo){return extendStatics$2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(to,ro){to.__proto__=ro}||function(to,ro){for(var no in ro)ro.hasOwnProperty(no)&&(to[no]=ro[no])},extendStatics$2(Xr,eo)};function __extends$2(Xr,eo){extendStatics$2(Xr,eo);function to(){this.constructor=Xr}Xr.prototype=eo===null?Object.create(eo):(to.prototype=eo.prototype,new to)}var __assign$2=function(){return __assign$2=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param$2(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata$2(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$9(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator$2(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$2(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread$2(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(bo){uo(io[0][3],bo)}}function so(ho){ho.value instanceof __await$2?Promise.resolve(ho.value.v).then(co,lo):uo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function uo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator$2(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await$2(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues$2(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values$2=="function"?__values$2(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject$2(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$3(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$7(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet$2(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet$2(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6$2=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$2},__asyncDelegator:__asyncDelegator$2,__asyncGenerator:__asyncGenerator$2,__asyncValues:__asyncValues$2,__await:__await$2,__awaiter:__awaiter$9,__classPrivateFieldGet:__classPrivateFieldGet$2,__classPrivateFieldSet:__classPrivateFieldSet$2,__createBinding:__createBinding$3,__decorate:__decorate$3,__exportStar:__exportStar$2,__extends:__extends$2,__generator:__generator$2,__importDefault:__importDefault$7,__importStar:__importStar$3,__makeTemplateObject:__makeTemplateObject$2,__metadata:__metadata$2,__param:__param$2,__read:__read$2,__rest:__rest$5,__spread:__spread$2,__spreadArrays:__spreadArrays$2,__values:__values$2},Symbol.toStringTag,{value:"Module"})),require$$0$7=getAugmentedNamespace(tslib_es6$2);var utils$3={},delay={},hasRequiredDelay;function requireDelay(){if(hasRequiredDelay)return delay;hasRequiredDelay=1,Object.defineProperty(delay,"__esModule",{value:!0}),delay.delay=void 0;function Xr(eo){return new Promise(to=>{setTimeout(()=>{to(!0)},eo)})}return delay.delay=Xr,delay}var convert={},constants$7={},misc={},hasRequiredMisc;function requireMisc(){return hasRequiredMisc||(hasRequiredMisc=1,Object.defineProperty(misc,"__esModule",{value:!0}),misc.ONE_THOUSAND=misc.ONE_HUNDRED=void 0,misc.ONE_HUNDRED=100,misc.ONE_THOUSAND=1e3),misc}var time={},hasRequiredTime;function requireTime(){return hasRequiredTime||(hasRequiredTime=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.ONE_YEAR=Xr.FOUR_WEEKS=Xr.THREE_WEEKS=Xr.TWO_WEEKS=Xr.ONE_WEEK=Xr.THIRTY_DAYS=Xr.SEVEN_DAYS=Xr.FIVE_DAYS=Xr.THREE_DAYS=Xr.ONE_DAY=Xr.TWENTY_FOUR_HOURS=Xr.TWELVE_HOURS=Xr.SIX_HOURS=Xr.THREE_HOURS=Xr.ONE_HOUR=Xr.SIXTY_MINUTES=Xr.THIRTY_MINUTES=Xr.TEN_MINUTES=Xr.FIVE_MINUTES=Xr.ONE_MINUTE=Xr.SIXTY_SECONDS=Xr.THIRTY_SECONDS=Xr.TEN_SECONDS=Xr.FIVE_SECONDS=Xr.ONE_SECOND=void 0,Xr.ONE_SECOND=1,Xr.FIVE_SECONDS=5,Xr.TEN_SECONDS=10,Xr.THIRTY_SECONDS=30,Xr.SIXTY_SECONDS=60,Xr.ONE_MINUTE=Xr.SIXTY_SECONDS,Xr.FIVE_MINUTES=Xr.ONE_MINUTE*5,Xr.TEN_MINUTES=Xr.ONE_MINUTE*10,Xr.THIRTY_MINUTES=Xr.ONE_MINUTE*30,Xr.SIXTY_MINUTES=Xr.ONE_MINUTE*60,Xr.ONE_HOUR=Xr.SIXTY_MINUTES,Xr.THREE_HOURS=Xr.ONE_HOUR*3,Xr.SIX_HOURS=Xr.ONE_HOUR*6,Xr.TWELVE_HOURS=Xr.ONE_HOUR*12,Xr.TWENTY_FOUR_HOURS=Xr.ONE_HOUR*24,Xr.ONE_DAY=Xr.TWENTY_FOUR_HOURS,Xr.THREE_DAYS=Xr.ONE_DAY*3,Xr.FIVE_DAYS=Xr.ONE_DAY*5,Xr.SEVEN_DAYS=Xr.ONE_DAY*7,Xr.THIRTY_DAYS=Xr.ONE_DAY*30,Xr.ONE_WEEK=Xr.SEVEN_DAYS,Xr.TWO_WEEKS=Xr.ONE_WEEK*2,Xr.THREE_WEEKS=Xr.ONE_WEEK*3,Xr.FOUR_WEEKS=Xr.ONE_WEEK*4,Xr.ONE_YEAR=Xr.ONE_DAY*365}(time)),time}var hasRequiredConstants$1;function requireConstants$1(){return hasRequiredConstants$1||(hasRequiredConstants$1=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireMisc(),Xr),eo.__exportStar(requireTime(),Xr)}(constants$7)),constants$7}var hasRequiredConvert;function requireConvert(){if(hasRequiredConvert)return convert;hasRequiredConvert=1,Object.defineProperty(convert,"__esModule",{value:!0}),convert.fromMiliseconds=convert.toMiliseconds=void 0;const Xr=requireConstants$1();function eo(ro){return ro*Xr.ONE_THOUSAND}convert.toMiliseconds=eo;function to(ro){return Math.floor(ro/Xr.ONE_THOUSAND)}return convert.fromMiliseconds=to,convert}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireDelay(),Xr),eo.__exportStar(requireConvert(),Xr)}(utils$3)),utils$3}var watch$2={},hasRequiredWatch$1;function requireWatch$1(){if(hasRequiredWatch$1)return watch$2;hasRequiredWatch$1=1,Object.defineProperty(watch$2,"__esModule",{value:!0}),watch$2.Watch=void 0;class Xr{constructor(){this.timestamps=new Map}start(to){if(this.timestamps.has(to))throw new Error(`Watch already started for label: ${to}`);this.timestamps.set(to,{started:Date.now()})}stop(to){const ro=this.get(to);if(typeof ro.elapsed<"u")throw new Error(`Watch already stopped for label: ${to}`);const no=Date.now()-ro.started;this.timestamps.set(to,{started:ro.started,elapsed:no})}get(to){const ro=this.timestamps.get(to);if(typeof ro>"u")throw new Error(`No timestamp found for label: ${to}`);return ro}elapsed(to){const ro=this.get(to);return ro.elapsed||Date.now()-ro.started}}return watch$2.Watch=Xr,watch$2.default=Xr,watch$2}var types$1={},watch$1={},hasRequiredWatch;function requireWatch(){if(hasRequiredWatch)return watch$1;hasRequiredWatch=1,Object.defineProperty(watch$1,"__esModule",{value:!0}),watch$1.IWatch=void 0;class Xr{}return watch$1.IWatch=Xr,watch$1}var hasRequiredTypes$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$7.__exportStar(requireWatch(),Xr)}(types$1)),types$1}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$7;eo.__exportStar(requireUtils(),Xr),eo.__exportStar(requireWatch$1(),Xr),eo.__exportStar(requireTypes$1(),Xr),eo.__exportStar(requireConstants$1(),Xr)})(cjs$4);var cjs$3={};Object.defineProperty(cjs$3,"__esModule",{value:!0});cjs$3.getLocalStorage=cjs$3.getLocalStorageOrThrow=cjs$3.getCrypto=cjs$3.getCryptoOrThrow=getLocation_1=cjs$3.getLocation=cjs$3.getLocationOrThrow=getNavigator_1=cjs$3.getNavigator=cjs$3.getNavigatorOrThrow=getDocument_1=cjs$3.getDocument=cjs$3.getDocumentOrThrow=cjs$3.getFromWindowOrThrow=cjs$3.getFromWindow=void 0;function getFromWindow(Xr){let eo;return typeof window<"u"&&typeof window[Xr]<"u"&&(eo=window[Xr]),eo}cjs$3.getFromWindow=getFromWindow;function getFromWindowOrThrow(Xr){const eo=getFromWindow(Xr);if(!eo)throw new Error(`${Xr} is not defined in Window`);return eo}cjs$3.getFromWindowOrThrow=getFromWindowOrThrow;function getDocumentOrThrow(){return getFromWindowOrThrow("document")}cjs$3.getDocumentOrThrow=getDocumentOrThrow;function getDocument(){return getFromWindow("document")}var getDocument_1=cjs$3.getDocument=getDocument;function getNavigatorOrThrow(){return getFromWindowOrThrow("navigator")}cjs$3.getNavigatorOrThrow=getNavigatorOrThrow;function getNavigator(){return getFromWindow("navigator")}var getNavigator_1=cjs$3.getNavigator=getNavigator;function getLocationOrThrow(){return getFromWindowOrThrow("location")}cjs$3.getLocationOrThrow=getLocationOrThrow;function getLocation$1(){return getFromWindow("location")}var getLocation_1=cjs$3.getLocation=getLocation$1;function getCryptoOrThrow(){return getFromWindowOrThrow("crypto")}cjs$3.getCryptoOrThrow=getCryptoOrThrow;function getCrypto(){return getFromWindow("crypto")}cjs$3.getCrypto=getCrypto;function getLocalStorageOrThrow(){return getFromWindowOrThrow("localStorage")}cjs$3.getLocalStorageOrThrow=getLocalStorageOrThrow;function getLocalStorage(){return getFromWindow("localStorage")}cjs$3.getLocalStorage=getLocalStorage;var cjs$2={};Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$3;function getWindowMetadata(){let Xr,eo;try{Xr=window_getters_1.getDocumentOrThrow(),eo=window_getters_1.getLocationOrThrow()}catch{return null}function to(){const uo=Xr.getElementsByTagName("link"),ho=[];for(let go=0;go-1){const Eo=bo.getAttribute("href");if(Eo)if(Eo.toLowerCase().indexOf("https:")===-1&&Eo.toLowerCase().indexOf("http:")===-1&&Eo.indexOf("//")!==0){let $o=eo.protocol+"//"+eo.host;if(Eo.indexOf("/")===0)$o+=Eo;else{const Co=eo.pathname.split("/");Co.pop();const Ro=Co.join("/");$o+=Ro+"/"+Eo}ho.push($o)}else if(Eo.indexOf("//")===0){const $o=eo.protocol+Eo;ho.push($o)}else ho.push(Eo)}}return ho}function ro(...uo){const ho=Xr.getElementsByTagName("meta");for(let go=0;gobo.getAttribute(Eo)).filter(Eo=>Eo?uo.includes(Eo):!1);if(wo.length&&wo){const Eo=bo.getAttribute("content");if(Eo)return Eo}}return""}function no(){let uo=ro("name","og:site_name","og:title","twitter:title");return uo||(uo=Xr.title),uo}function io(){return ro("description","og:description","twitter:description","keywords")}const oo=no(),ao=io(),so=eo.origin,co=to();return{description:ao,url:so,icons:co,name:oo}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var queryString={},strictUriEncode=Xr=>encodeURIComponent(Xr).replace(/[!'()*]/g,eo=>`%${eo.charCodeAt(0).toString(16).toUpperCase()}`),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(Xr,eo){try{return[decodeURIComponent(Xr.join(""))]}catch{}if(Xr.length===1)return Xr;eo=eo||1;var to=Xr.slice(0,eo),ro=Xr.slice(eo);return Array.prototype.concat.call([],decodeComponents(to),decodeComponents(ro))}function decode$3(Xr){try{return decodeURIComponent(Xr)}catch{for(var eo=Xr.match(singleMatcher)||[],to=1;to{if(!(typeof Xr=="string"&&typeof eo=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(eo==="")return[Xr];const to=Xr.indexOf(eo);return to===-1?[Xr]:[Xr.slice(0,to),Xr.slice(to+eo.length)]},filterObj=function(Xr,eo){for(var to={},ro=Object.keys(Xr),no=Array.isArray(eo),io=0;ioCo==null,oo=Symbol("encodeFragmentIdentifier");function ao(Co){switch(Co.arrayFormat){case"index":return Ro=>(Oo,jo)=>{const Bo=Oo.length;return jo===void 0||Co.skipNull&&jo===null||Co.skipEmptyString&&jo===""?Oo:jo===null?[...Oo,[lo(Ro,Co),"[",Bo,"]"].join("")]:[...Oo,[lo(Ro,Co),"[",lo(Bo,Co),"]=",lo(jo,Co)].join("")]};case"bracket":return Ro=>(Oo,jo)=>jo===void 0||Co.skipNull&&jo===null||Co.skipEmptyString&&jo===""?Oo:jo===null?[...Oo,[lo(Ro,Co),"[]"].join("")]:[...Oo,[lo(Ro,Co),"[]=",lo(jo,Co)].join("")];case"colon-list-separator":return Ro=>(Oo,jo)=>jo===void 0||Co.skipNull&&jo===null||Co.skipEmptyString&&jo===""?Oo:jo===null?[...Oo,[lo(Ro,Co),":list="].join("")]:[...Oo,[lo(Ro,Co),":list=",lo(jo,Co)].join("")];case"comma":case"separator":case"bracket-separator":{const Ro=Co.arrayFormat==="bracket-separator"?"[]=":"=";return Oo=>(jo,Bo)=>Bo===void 0||Co.skipNull&&Bo===null||Co.skipEmptyString&&Bo===""?jo:(Bo=Bo===null?"":Bo,jo.length===0?[[lo(Oo,Co),Ro,lo(Bo,Co)].join("")]:[[jo,lo(Bo,Co)].join(Co.arrayFormatSeparator)])}default:return Ro=>(Oo,jo)=>jo===void 0||Co.skipNull&&jo===null||Co.skipEmptyString&&jo===""?Oo:jo===null?[...Oo,lo(Ro,Co)]:[...Oo,[lo(Ro,Co),"=",lo(jo,Co)].join("")]}}function so(Co){let Ro;switch(Co.arrayFormat){case"index":return(Oo,jo,Bo)=>{if(Ro=/\[(\d*)\]$/.exec(Oo),Oo=Oo.replace(/\[\d*\]$/,""),!Ro){Bo[Oo]=jo;return}Bo[Oo]===void 0&&(Bo[Oo]={}),Bo[Oo][Ro[1]]=jo};case"bracket":return(Oo,jo,Bo)=>{if(Ro=/(\[\])$/.exec(Oo),Oo=Oo.replace(/\[\]$/,""),!Ro){Bo[Oo]=jo;return}if(Bo[Oo]===void 0){Bo[Oo]=[jo];return}Bo[Oo]=[].concat(Bo[Oo],jo)};case"colon-list-separator":return(Oo,jo,Bo)=>{if(Ro=/(:list)$/.exec(Oo),Oo=Oo.replace(/:list$/,""),!Ro){Bo[Oo]=jo;return}if(Bo[Oo]===void 0){Bo[Oo]=[jo];return}Bo[Oo]=[].concat(Bo[Oo],jo)};case"comma":case"separator":return(Oo,jo,Bo)=>{const Mo=typeof jo=="string"&&jo.includes(Co.arrayFormatSeparator),Fo=typeof jo=="string"&&!Mo&&uo(jo,Co).includes(Co.arrayFormatSeparator);jo=Fo?uo(jo,Co):jo;const Wo=Mo||Fo?jo.split(Co.arrayFormatSeparator).map(Jo=>uo(Jo,Co)):jo===null?jo:uo(jo,Co);Bo[Oo]=Wo};case"bracket-separator":return(Oo,jo,Bo)=>{const Mo=/(\[\])$/.test(Oo);if(Oo=Oo.replace(/\[\]$/,""),!Mo){Bo[Oo]=jo&&uo(jo,Co);return}const Fo=jo===null?[]:jo.split(Co.arrayFormatSeparator).map(Wo=>uo(Wo,Co));if(Bo[Oo]===void 0){Bo[Oo]=Fo;return}Bo[Oo]=[].concat(Bo[Oo],Fo)};default:return(Oo,jo,Bo)=>{if(Bo[Oo]===void 0){Bo[Oo]=jo;return}Bo[Oo]=[].concat(Bo[Oo],jo)}}}function co(Co){if(typeof Co!="string"||Co.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function lo(Co,Ro){return Ro.encode?Ro.strict?eo(Co):encodeURIComponent(Co):Co}function uo(Co,Ro){return Ro.decode?to(Co):Co}function ho(Co){return Array.isArray(Co)?Co.sort():typeof Co=="object"?ho(Object.keys(Co)).sort((Ro,Oo)=>Number(Ro)-Number(Oo)).map(Ro=>Co[Ro]):Co}function go(Co){const Ro=Co.indexOf("#");return Ro!==-1&&(Co=Co.slice(0,Ro)),Co}function bo(Co){let Ro="";const Oo=Co.indexOf("#");return Oo!==-1&&(Ro=Co.slice(Oo)),Ro}function wo(Co){Co=go(Co);const Ro=Co.indexOf("?");return Ro===-1?"":Co.slice(Ro+1)}function Eo(Co,Ro){return Ro.parseNumbers&&!Number.isNaN(Number(Co))&&typeof Co=="string"&&Co.trim()!==""?Co=Number(Co):Ro.parseBooleans&&Co!==null&&(Co.toLowerCase()==="true"||Co.toLowerCase()==="false")&&(Co=Co.toLowerCase()==="true"),Co}function $o(Co,Ro){Ro=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Ro),co(Ro.arrayFormatSeparator);const Oo=so(Ro),jo=Object.create(null);if(typeof Co!="string"||(Co=Co.trim().replace(/^[?#&]/,""),!Co))return jo;for(const Bo of Co.split("&")){if(Bo==="")continue;let[Mo,Fo]=ro(Ro.decode?Bo.replace(/\+/g," "):Bo,"=");Fo=Fo===void 0?null:["comma","separator","bracket-separator"].includes(Ro.arrayFormat)?Fo:uo(Fo,Ro),Oo(uo(Mo,Ro),Fo,jo)}for(const Bo of Object.keys(jo)){const Mo=jo[Bo];if(typeof Mo=="object"&&Mo!==null)for(const Fo of Object.keys(Mo))Mo[Fo]=Eo(Mo[Fo],Ro);else jo[Bo]=Eo(Mo,Ro)}return Ro.sort===!1?jo:(Ro.sort===!0?Object.keys(jo).sort():Object.keys(jo).sort(Ro.sort)).reduce((Bo,Mo)=>{const Fo=jo[Mo];return Fo&&typeof Fo=="object"&&!Array.isArray(Fo)?Bo[Mo]=ho(Fo):Bo[Mo]=Fo,Bo},Object.create(null))}Xr.extract=wo,Xr.parse=$o,Xr.stringify=(Co,Ro)=>{if(!Co)return"";Ro=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Ro),co(Ro.arrayFormatSeparator);const Oo=Fo=>Ro.skipNull&&io(Co[Fo])||Ro.skipEmptyString&&Co[Fo]==="",jo=ao(Ro),Bo={};for(const Fo of Object.keys(Co))Oo(Fo)||(Bo[Fo]=Co[Fo]);const Mo=Object.keys(Bo);return Ro.sort!==!1&&Mo.sort(Ro.sort),Mo.map(Fo=>{const Wo=Co[Fo];return Wo===void 0?"":Wo===null?lo(Fo,Ro):Array.isArray(Wo)?Wo.length===0&&Ro.arrayFormat==="bracket-separator"?lo(Fo,Ro)+"[]":Wo.reduce(jo(Fo),[]).join("&"):lo(Fo,Ro)+"="+lo(Wo,Ro)}).filter(Fo=>Fo.length>0).join("&")},Xr.parseUrl=(Co,Ro)=>{Ro=Object.assign({decode:!0},Ro);const[Oo,jo]=ro(Co,"#");return Object.assign({url:Oo.split("?")[0]||"",query:$o(wo(Co),Ro)},Ro&&Ro.parseFragmentIdentifier&&jo?{fragmentIdentifier:uo(jo,Ro)}:{})},Xr.stringifyUrl=(Co,Ro)=>{Ro=Object.assign({encode:!0,strict:!0,[oo]:!0},Ro);const Oo=go(Co.url).split("?")[0]||"",jo=Xr.extract(Co.url),Bo=Xr.parse(jo,{sort:!1}),Mo=Object.assign(Bo,Co.query);let Fo=Xr.stringify(Mo,Ro);Fo&&(Fo=`?${Fo}`);let Wo=bo(Co.url);return Co.fragmentIdentifier&&(Wo=`#${Ro[oo]?lo(Co.fragmentIdentifier,Ro):Co.fragmentIdentifier}`),`${Oo}${Fo}${Wo}`},Xr.pick=(Co,Ro,Oo)=>{Oo=Object.assign({parseFragmentIdentifier:!0,[oo]:!1},Oo);const{url:jo,query:Bo,fragmentIdentifier:Mo}=Xr.parseUrl(Co,Oo);return Xr.stringifyUrl({url:jo,query:no(Bo,Ro),fragmentIdentifier:Mo},Oo)},Xr.exclude=(Co,Ro,Oo)=>{const jo=Array.isArray(Ro)?Bo=>!Ro.includes(Bo):(Bo,Mo)=>!Ro(Bo,Mo);return Xr.pick(Co,jo,Oo)}})(queryString);const C$6={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},K$3=":";function ve$2(Xr){const[eo,to]=Xr.split(K$3);return{namespace:eo,reference:to}}function Un$1(Xr,eo=[]){const to=[];return Object.keys(Xr).forEach(ro=>{if(eo.length&&!eo.includes(ro))return;const no=Xr[ro];to.push(...no.accounts)}),to}function L$8(Xr,eo){return Xr.includes(":")?[Xr]:eo.chains||[]}const J$3="base10",p$7="base16",F$7="base64pad",H$4="utf8",Q$6=0,_$9=1,Dn$1=0,Te$2=1,Z$3=12,X$3=32;function kn$1(){const Xr=x25519.generateKeyPair();return{privateKey:toString$2(Xr.secretKey,p$7),publicKey:toString$2(Xr.publicKey,p$7)}}function Vn$2(){const Xr=random.randomBytes(X$3);return toString$2(Xr,p$7)}function Mn$1(Xr,eo){const to=x25519.sharedKey(fromString(Xr,p$7),fromString(eo,p$7),!0),ro=new HKDF_1(sha256$1.SHA256,to).expand(X$3);return toString$2(ro,p$7)}function Kn$1(Xr){const eo=sha256$1.hash(fromString(Xr,p$7));return toString$2(eo,p$7)}function Ln$1(Xr){const eo=sha256$1.hash(fromString(Xr,H$4));return toString$2(eo,p$7)}function Pe$2(Xr){return fromString(`${Xr}`,J$3)}function j$9(Xr){return Number(toString$2(Xr,J$3))}function xn$1(Xr){const eo=Pe$2(typeof Xr.type<"u"?Xr.type:Q$6);if(j$9(eo)===_$9&&typeof Xr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const to=typeof Xr.senderPublicKey<"u"?fromString(Xr.senderPublicKey,p$7):void 0,ro=typeof Xr.iv<"u"?fromString(Xr.iv,p$7):random.randomBytes(Z$3),no=new chacha20poly1305.ChaCha20Poly1305(fromString(Xr.symKey,p$7)).seal(ro,fromString(Xr.message,H$4));return Re$2({type:eo,sealed:no,iv:ro,senderPublicKey:to})}function Fn$1(Xr){const eo=new chacha20poly1305.ChaCha20Poly1305(fromString(Xr.symKey,p$7)),{sealed:to,iv:ro}=ee$4(Xr.encoded),no=eo.open(ro,to);if(no===null)throw new Error("Failed to decrypt");return toString$2(no,H$4)}function Re$2(Xr){if(j$9(Xr.type)===_$9){if(typeof Xr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString$2(concat([Xr.type,Xr.senderPublicKey,Xr.iv,Xr.sealed]),F$7)}return toString$2(concat([Xr.type,Xr.iv,Xr.sealed]),F$7)}function ee$4(Xr){const eo=fromString(Xr,F$7),to=eo.slice(Dn$1,Te$2),ro=Te$2;if(j$9(to)===_$9){const ao=ro+X$3,so=ao+Z$3,co=eo.slice(ro,ao),lo=eo.slice(ao,so),uo=eo.slice(so);return{type:to,sealed:uo,iv:lo,senderPublicKey:co}}const no=ro+Z$3,io=eo.slice(ro,no),oo=eo.slice(no);return{type:to,sealed:oo,iv:io}}function Hn$1(Xr,eo){const to=ee$4(Xr);return Ae$1({type:j$9(to.type),senderPublicKey:typeof to.senderPublicKey<"u"?toString$2(to.senderPublicKey,p$7):void 0,receiverPublicKey:eo==null?void 0:eo.receiverPublicKey})}function Ae$1(Xr){const eo=(Xr==null?void 0:Xr.type)||Q$6;if(eo===_$9){if(typeof(Xr==null?void 0:Xr.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(Xr==null?void 0:Xr.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:eo,senderPublicKey:Xr==null?void 0:Xr.senderPublicKey,receiverPublicKey:Xr==null?void 0:Xr.receiverPublicKey}}function qn$1(Xr){return Xr.type===_$9&&typeof Xr.senderPublicKey=="string"&&typeof Xr.receiverPublicKey=="string"}var Bn$1=Object.defineProperty,Ue$3=Object.getOwnPropertySymbols,Gn$1=Object.prototype.hasOwnProperty,Wn$1=Object.prototype.propertyIsEnumerable,_e$2=(Xr,eo,to)=>eo in Xr?Bn$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,$e$2=(Xr,eo)=>{for(var to in eo||(eo={}))Gn$1.call(eo,to)&&_e$2(Xr,to,eo[to]);if(Ue$3)for(var to of Ue$3(eo))Wn$1.call(eo,to)&&_e$2(Xr,to,eo[to]);return Xr};const Ce$2="ReactNative",m$4={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},De$3="js";function te$3(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}function $$5(){return!getDocument_1()&&!!getNavigator_1()&&navigator.product===Ce$2}function D$7(){return!te$3()&&!!getNavigator_1()&&!!getDocument_1()}function R$5(){return $$5()?m$4.reactNative:te$3()?m$4.node:D$7()?m$4.browser:m$4.unknown}function Jn$1(){var Xr;try{return $$5()&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Application)<"u"?(Xr=global$1.Application)==null?void 0:Xr.applicationId:void 0}catch{return}}function ke$3(Xr,eo){let to=queryString.parse(Xr);return to=$e$2($e$2({},to),eo),Xr=queryString.stringify(to),Xr}function Qn$1(){return getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Ve$3(){if(R$5()===m$4.reactNative&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Platform)<"u"){const{OS:to,Version:ro}=global$1.Platform;return[to,ro].join("-")}const Xr=detect();if(Xr===null)return"unknown";const eo=Xr.os?Xr.os.replace(" ","").toLowerCase():"unknown";return Xr.type==="browser"?[eo,Xr.name,Xr.version].join("-"):[eo,Xr.version].join("-")}function Me$1(){var Xr;const eo=R$5();return eo===m$4.browser?[eo,((Xr=getLocation_1())==null?void 0:Xr.host)||"unknown"].join(":"):eo}function Ke$2(Xr,eo,to){const ro=Ve$3(),no=Me$1();return[[Xr,eo].join("-"),[De$3,to].join("-"),ro,no].join("/")}function Xn$1({protocol:Xr,version:eo,relayUrl:to,sdkVersion:ro,auth:no,projectId:io,useOnCloseEvent:oo,bundleId:ao}){const so=to.split("?"),co=Ke$2(Xr,eo,ro),lo={auth:no,ua:co,projectId:io,useOnCloseEvent:oo||void 0,origin:ao||void 0},uo=ke$3(so[1]||"",lo);return so[0]+"?"+uo}function O$a(Xr,eo){return Xr.filter(to=>eo.includes(to)).length===Xr.length}function rt$3(Xr){return Object.fromEntries(Xr.entries())}function ot$2(Xr){return new Map(Object.entries(Xr))}function at$3(Xr=cjs$4.FIVE_MINUTES,eo){const to=cjs$4.toMiliseconds(Xr||cjs$4.FIVE_MINUTES);let ro,no,io;return{resolve:oo=>{io&&ro&&(clearTimeout(io),ro(oo))},reject:oo=>{io&&no&&(clearTimeout(io),no(oo))},done:()=>new Promise((oo,ao)=>{io=setTimeout(()=>{ao(new Error(eo))},to),ro=oo,no=ao})}}function ut$5(Xr,eo,to){return new Promise(async(ro,no)=>{const io=setTimeout(()=>no(new Error(to)),eo);try{const oo=await Xr;ro(oo)}catch(oo){no(oo)}clearTimeout(io)})}function re$2(Xr,eo){if(typeof eo=="string"&&eo.startsWith(`${Xr}:`))return eo;if(Xr.toLowerCase()==="topic"){if(typeof eo!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${eo}`}else if(Xr.toLowerCase()==="id"){if(typeof eo!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${eo}`}throw new Error(`Unknown expirer target type: ${Xr}`)}function lt$3(Xr){return re$2("topic",Xr)}function dt$3(Xr){return re$2("id",Xr)}function ft$4(Xr){const[eo,to]=Xr.split(":"),ro={id:void 0,topic:void 0};if(eo==="topic"&&typeof to=="string")ro.topic=to;else if(eo==="id"&&Number.isInteger(Number(to)))ro.id=Number(to);else throw new Error(`Invalid target, expected id:number or topic:string, got ${eo}:${to}`);return ro}function pt$3(Xr,eo){return cjs$4.fromMiliseconds(Date.now()+cjs$4.toMiliseconds(Xr))}function mt$3(Xr){return Date.now()>=cjs$4.toMiliseconds(Xr)}function yt$3(Xr,eo){return`${Xr}${eo?`:${eo}`:""}`}function S$7(Xr=[],eo=[]){return[...new Set([...Xr,...eo])]}async function gt$3({id:Xr,topic:eo,wcDeepLink:to}){try{if(!to)return;const ro=typeof to=="string"?JSON.parse(to):to;let no=ro==null?void 0:ro.href;if(typeof no!="string")return;no.endsWith("/")&&(no=no.slice(0,-1));const io=`${no}/wc?requestId=${Xr}&sessionTopic=${eo}`,oo=R$5();oo===m$4.browser?io.startsWith("https://")?window.open(io,"_blank","noreferrer noopener"):window.open(io,"_self","noreferrer noopener"):oo===m$4.reactNative&&typeof(global$1==null?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(io)}catch(ro){console.error(ro)}}async function ht$3(Xr,eo){try{return await Xr.getItem(eo)||(D$7()?localStorage.getItem(eo):void 0)}catch(to){console.error(to)}}const He$3="irn";function vt$3(Xr){return(Xr==null?void 0:Xr.relay)||{protocol:He$3}}function Et$3(Xr){const eo=C$6[Xr];if(typeof eo>"u")throw new Error(`Relay Protocol not supported: ${Xr}`);return eo}var bt$3=Object.defineProperty,Nt$3=Object.defineProperties,Ot$3=Object.getOwnPropertyDescriptors,qe$3=Object.getOwnPropertySymbols,St$3=Object.prototype.hasOwnProperty,wt$3=Object.prototype.propertyIsEnumerable,Be$3=(Xr,eo,to)=>eo in Xr?bt$3(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,It$2=(Xr,eo)=>{for(var to in eo||(eo={}))St$3.call(eo,to)&&Be$3(Xr,to,eo[to]);if(qe$3)for(var to of qe$3(eo))wt$3.call(eo,to)&&Be$3(Xr,to,eo[to]);return Xr},Tt$3=(Xr,eo)=>Nt$3(Xr,Ot$3(eo));function Ge$3(Xr,eo="-"){const to={},ro="relay"+eo;return Object.keys(Xr).forEach(no=>{if(no.startsWith(ro)){const io=no.replace(ro,""),oo=Xr[no];to[io]=oo}}),to}function Pt$3(Xr){Xr=Xr.includes("wc://")?Xr.replace("wc://",""):Xr,Xr=Xr.includes("wc:")?Xr.replace("wc:",""):Xr;const eo=Xr.indexOf(":"),to=Xr.indexOf("?")!==-1?Xr.indexOf("?"):void 0,ro=Xr.substring(0,eo),no=Xr.substring(eo+1,to).split("@"),io=typeof to<"u"?Xr.substring(to):"",oo=queryString.parse(io);return{protocol:ro,topic:We$3(no[0]),version:parseInt(no[1],10),symKey:oo.symKey,relay:Ge$3(oo),expiryTimestamp:oo.expiryTimestamp?parseInt(oo.expiryTimestamp,10):void 0}}function We$3(Xr){return Xr.startsWith("//")?Xr.substring(2):Xr}function ze$2(Xr,eo="-"){const to="relay",ro={};return Object.keys(Xr).forEach(no=>{const io=to+eo+no;Xr[no]&&(ro[io]=Xr[no])}),ro}function Rt$3(Xr){return`${Xr.protocol}:${Xr.topic}@${Xr.version}?`+queryString.stringify(Tt$3(It$2({symKey:Xr.symKey},ze$2(Xr.relay)),{expiryTimestamp:Xr.expiryTimestamp}))}function A$6(Xr){const eo=[];return Xr.forEach(to=>{const[ro,no]=to.split(":");eo.push(`${ro}:${no}`)}),eo}function Qe$3(Xr){const eo=[];return Object.values(Xr).forEach(to=>{eo.push(...A$6(to.accounts))}),eo}function Ze$3(Xr,eo){const to=[];return Object.values(Xr).forEach(ro=>{A$6(ro.accounts).includes(eo)&&to.push(...ro.methods)}),to}function Xe$3(Xr,eo){const to=[];return Object.values(Xr).forEach(ro=>{A$6(ro.accounts).includes(eo)&&to.push(...ro.events)}),to}function oe$3(Xr){return Xr.includes(":")}function en$1(Xr){return oe$3(Xr)?Xr.split(":")[0]:Xr}const nn={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tn$1={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N$7(Xr,eo){const{message:to,code:ro}=tn$1[Xr];return{message:eo?`${to} ${eo}`:to,code:ro}}function U$6(Xr,eo){const{message:to,code:ro}=nn[Xr];return{message:eo?`${to} ${eo}`:to,code:ro}}function k$4(Xr,eo){return!!Array.isArray(Xr)}function B$5(Xr){return Object.getPrototypeOf(Xr)===Object.prototype&&Object.keys(Xr).length}function w$9(Xr){return typeof Xr>"u"}function g$b(Xr,eo){return eo&&w$9(Xr)?!0:typeof Xr=="string"&&!!Xr.trim().length}function G$4(Xr,eo){return typeof Xr=="number"&&!isNaN(Xr)}function Mt$2(Xr,eo){const{requiredNamespaces:to}=eo,ro=Object.keys(Xr.namespaces),no=Object.keys(to);let io=!0;return O$a(no,ro)?(ro.forEach(oo=>{const{accounts:ao,methods:so,events:co}=Xr.namespaces[oo],lo=A$6(ao),uo=to[oo];(!O$a(L$8(oo,uo),lo)||!O$a(uo.methods,so)||!O$a(uo.events,co))&&(io=!1)}),io):!1}function V$3(Xr){return g$b(Xr,!1)&&Xr.includes(":")?Xr.split(":").length===2:!1}function rn(Xr){if(g$b(Xr,!1)&&Xr.includes(":")){const eo=Xr.split(":");if(eo.length===3){const to=eo[0]+":"+eo[1];return!!eo[2]&&V$3(to)}}return!1}function Kt$3(Xr){if(g$b(Xr,!1))try{return typeof new URL(Xr)<"u"}catch{return!1}return!1}function Lt$2(Xr){var eo;return(eo=Xr==null?void 0:Xr.proposer)==null?void 0:eo.publicKey}function xt$3(Xr){return Xr==null?void 0:Xr.topic}function Ft$3(Xr,eo){let to=null;return g$b(Xr==null?void 0:Xr.publicKey,!1)||(to=N$7("MISSING_OR_INVALID",`${eo} controller public key should be a string`)),to}function ie$2(Xr){let eo=!0;return k$4(Xr)?Xr.length&&(eo=Xr.every(to=>g$b(to,!1))):eo=!1,eo}function on(Xr,eo,to){let ro=null;return k$4(eo)&&eo.length?eo.forEach(no=>{ro||V$3(no)||(ro=U$6("UNSUPPORTED_CHAINS",`${to}, chain ${no} should be a string and conform to "namespace:chainId" format`))}):V$3(Xr)||(ro=U$6("UNSUPPORTED_CHAINS",`${to}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),ro}function sn(Xr,eo,to){let ro=null;return Object.entries(Xr).forEach(([no,io])=>{if(ro)return;const oo=on(no,L$8(no,io),`${eo} ${to}`);oo&&(ro=oo)}),ro}function cn(Xr,eo){let to=null;return k$4(Xr)?Xr.forEach(ro=>{to||rn(ro)||(to=U$6("UNSUPPORTED_ACCOUNTS",`${eo}, account ${ro} should be a string and conform to "namespace:chainId:address" format`))}):to=U$6("UNSUPPORTED_ACCOUNTS",`${eo}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),to}function an(Xr,eo){let to=null;return Object.values(Xr).forEach(ro=>{if(to)return;const no=cn(ro==null?void 0:ro.accounts,`${eo} namespace`);no&&(to=no)}),to}function un$1(Xr,eo){let to=null;return ie$2(Xr==null?void 0:Xr.methods)?ie$2(Xr==null?void 0:Xr.events)||(to=U$6("UNSUPPORTED_EVENTS",`${eo}, events should be an array of strings or empty array for no events`)):to=U$6("UNSUPPORTED_METHODS",`${eo}, methods should be an array of strings or empty array for no methods`),to}function ce$4(Xr,eo){let to=null;return Object.values(Xr).forEach(ro=>{if(to)return;const no=un$1(ro,`${eo}, namespace`);no&&(to=no)}),to}function Ht$3(Xr,eo,to){let ro=null;if(Xr&&B$5(Xr)){const no=ce$4(Xr,eo);no&&(ro=no);const io=sn(Xr,eo,to);io&&(ro=io)}else ro=N$7("MISSING_OR_INVALID",`${eo}, ${to} should be an object with data`);return ro}function ln$1(Xr,eo){let to=null;if(Xr&&B$5(Xr)){const ro=ce$4(Xr,eo);ro&&(to=ro);const no=an(Xr,eo);no&&(to=no)}else to=N$7("MISSING_OR_INVALID",`${eo}, namespaces should be an object with data`);return to}function dn$1(Xr){return g$b(Xr.protocol,!0)}function qt$3(Xr,eo){let to=!1;return Xr?Xr&&k$4(Xr)&&Xr.length&&Xr.forEach(ro=>{to=dn$1(ro)}):to=!0,to}function Bt$3(Xr){return typeof Xr=="number"}function Gt$3(Xr){return typeof Xr<"u"&&typeof Xr!==null}function Wt$2(Xr){return!(!Xr||typeof Xr!="object"||!Xr.code||!G$4(Xr.code)||!Xr.message||!g$b(Xr.message,!1))}function zt$3(Xr){return!(w$9(Xr)||!g$b(Xr.method,!1))}function Yt$3(Xr){return!(w$9(Xr)||w$9(Xr.result)&&w$9(Xr.error)||!G$4(Xr.id)||!g$b(Xr.jsonrpc,!1))}function Jt$3(Xr){return!(w$9(Xr)||!g$b(Xr.name,!1))}function Qt$2(Xr,eo){return!(!V$3(eo)||!Qe$3(Xr).includes(eo))}function Zt$2(Xr,eo,to){return g$b(to,!1)?Ze$3(Xr,eo).includes(to):!1}function Xt$2(Xr,eo,to){return g$b(to,!1)?Xe$3(Xr,eo).includes(to):!1}function fn$1(Xr,eo,to){let ro=null;const no=er$3(Xr),io=nr$2(eo),oo=Object.keys(no),ao=Object.keys(io),so=pn$1(Object.keys(Xr)),co=pn$1(Object.keys(eo)),lo=so.filter(uo=>!co.includes(uo));return lo.length&&(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces keys don't satisfy requiredNamespaces. Required: ${lo.toString()} Received: ${Object.keys(eo).toString()}`)),O$a(oo,ao)||(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces chains don't satisfy required namespaces. Required: ${oo.toString()} - Approved: ${ao.toString()}`)),Object.keys(eo).forEach(fo=>{if(!fo.includes(":")||ro)return;const ho=A$6(eo[fo].accounts);ho.includes(fo)||(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces accounts don't satisfy namespace accounts for ${fo} - Required: ${fo} - Approved: ${ho.toString()}`))}),oo.forEach(fo=>{ro||(O$a(no[fo].methods,io[fo].methods)?O$a(no[fo].events,io[fo].events)||(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces events don't satisfy namespace events for ${fo}`)):ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces methods don't satisfy namespace methods for ${fo}`))}),ro}function er$3(Xr){const eo={};return Object.keys(Xr).forEach(to=>{var ro;to.includes(":")?eo[to]=Xr[to]:(ro=Xr[to].chains)==null||ro.forEach(no=>{eo[no]={methods:Xr[to].methods,events:Xr[to].events}})}),eo}function pn$1(Xr){return[...new Set(Xr.map(eo=>eo.includes(":")?eo.split(":")[0]:eo))]}function nr$2(Xr){const eo={};return Object.keys(Xr).forEach(to=>{if(to.includes(":"))eo[to]=Xr[to];else{const ro=A$6(Xr[to].accounts);ro==null||ro.forEach(no=>{eo[no]={accounts:Xr[to].accounts.filter(io=>io.includes(`${no}:`)),methods:Xr[to].methods,events:Xr[to].events}})}}),eo}function tr$3(Xr,eo){return G$4(Xr)&&Xr<=eo.max&&Xr>=eo.min}function rr$3(){const Xr=R$5();return new Promise(eo=>{switch(Xr){case m$4.browser:eo(mn$1());break;case m$4.reactNative:eo(yn$1());break;case m$4.node:eo(gn$1());break;default:eo(!0)}})}function mn$1(){return D$7()&&(navigator==null?void 0:navigator.onLine)}async function yn$1(){if($$5()&&typeof global$1<"u"&&global$1!=null&&global$1.NetInfo){const Xr=await(global$1==null?void 0:global$1.NetInfo.fetch());return Xr==null?void 0:Xr.isConnected}return!0}function gn$1(){return!0}function or$2(Xr){switch(R$5()){case m$4.browser:hn$1(Xr);break;case m$4.reactNative:vn$1(Xr);break}}function hn$1(Xr){!$$5()&&D$7()&&(window.addEventListener("online",()=>Xr(!0)),window.addEventListener("offline",()=>Xr(!1)))}function vn$1(Xr){$$5()&&typeof global$1<"u"&&global$1!=null&&global$1.NetInfo&&(global$1==null||global$1.NetInfo.addEventListener(eo=>Xr(eo==null?void 0:eo.isConnected)))}const ae$3={};let sr$3=class{static get(eo){return ae$3[eo]}static set(eo,to){ae$3[eo]=to}static delete(eo){delete ae$3[eo]}};const suspectProtoRx=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,suspectConstructorRx=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(Xr,eo){if(Xr==="__proto__"||Xr==="constructor"&&eo&&typeof eo=="object"&&"prototype"in eo){warnKeyDropped(Xr);return}return eo}function warnKeyDropped(Xr){console.warn(`[destr] Dropping "${Xr}" key to prevent prototype pollution.`)}function destr(Xr,eo={}){if(typeof Xr!="string")return Xr;const to=Xr.trim();if(Xr[0]==='"'&&Xr.endsWith('"')&&!Xr.includes("\\"))return to.slice(1,-1);if(to.length<=9){const ro=to.toLowerCase();if(ro==="true")return!0;if(ro==="false")return!1;if(ro==="undefined")return;if(ro==="null")return null;if(ro==="nan")return Number.NaN;if(ro==="infinity")return Number.POSITIVE_INFINITY;if(ro==="-infinity")return Number.NEGATIVE_INFINITY}if(!JsonSigRx.test(Xr)){if(eo.strict)throw new SyntaxError("[destr] Invalid JSON");return Xr}try{if(suspectProtoRx.test(Xr)||suspectConstructorRx.test(Xr)){if(eo.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(Xr,jsonParseTransform)}return JSON.parse(Xr)}catch(ro){if(eo.strict)throw ro;return Xr}}function wrapToPromise(Xr){return!Xr||typeof Xr.then!="function"?Promise.resolve(Xr):Xr}function asyncCall(Xr,...eo){try{return wrapToPromise(Xr(...eo))}catch(to){return Promise.reject(to)}}function isPrimitive(Xr){const eo=typeof Xr;return Xr===null||eo!=="object"&&eo!=="function"}function isPureObject(Xr){const eo=Object.getPrototypeOf(Xr);return!eo||eo.isPrototypeOf(Object)}function stringify$3(Xr){if(isPrimitive(Xr))return String(Xr);if(isPureObject(Xr)||Array.isArray(Xr))return JSON.stringify(Xr);if(typeof Xr.toJSON=="function")return stringify$3(Xr.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function checkBufferSupport(){if(typeof Buffer$3>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const BASE64_PREFIX="base64:";function serializeRaw(Xr){if(typeof Xr=="string")return Xr;checkBufferSupport();const eo=Buffer$3.from(Xr).toString("base64");return BASE64_PREFIX+eo}function deserializeRaw(Xr){return typeof Xr!="string"||!Xr.startsWith(BASE64_PREFIX)?Xr:(checkBufferSupport(),Buffer$3.from(Xr.slice(BASE64_PREFIX.length),"base64"))}function normalizeKey(Xr){return Xr?Xr.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function joinKeys(...Xr){return normalizeKey(Xr.join(":"))}function normalizeBaseKey(Xr){return Xr=normalizeKey(Xr),Xr?Xr+":":""}function defineDriver(Xr){return Xr}const DRIVER_NAME="memory",memory=()=>{const Xr=new Map;return{name:DRIVER_NAME,getInstance:()=>Xr,hasItem(eo){return Xr.has(eo)},getItem(eo){return Xr.get(eo)??null},getItemRaw(eo){return Xr.get(eo)??null},setItem(eo,to){Xr.set(eo,to)},setItemRaw(eo,to){Xr.set(eo,to)},removeItem(eo){Xr.delete(eo)},getKeys(){return[...Xr.keys()]},clear(){Xr.clear()},dispose(){Xr.clear()}}};function createStorage(Xr={}){const eo={mounts:{"":Xr.driver||memory()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},to=co=>{for(const lo of eo.mountpoints)if(co.startsWith(lo))return{base:lo,relativeKey:co.slice(lo.length),driver:eo.mounts[lo]};return{base:"",relativeKey:co,driver:eo.mounts[""]}},ro=(co,lo)=>eo.mountpoints.filter(fo=>fo.startsWith(co)||lo&&co.startsWith(fo)).map(fo=>({relativeBase:co.length>fo.length?co.slice(fo.length):void 0,mountpoint:fo,driver:eo.mounts[fo]})),no=(co,lo)=>{if(eo.watching){lo=normalizeKey(lo);for(const fo of eo.watchListeners)fo(co,lo)}},io=async()=>{if(!eo.watching){eo.watching=!0;for(const co in eo.mounts)eo.unwatch[co]=await watch(eo.mounts[co],no,co)}},oo=async()=>{if(eo.watching){for(const co in eo.unwatch)await eo.unwatch[co]();eo.unwatch={},eo.watching=!1}},ao=(co,lo,fo)=>{const ho=new Map,go=yo=>{let vo=ho.get(yo.base);return vo||(vo={driver:yo.driver,base:yo.base,items:[]},ho.set(yo.base,vo)),vo};for(const yo of co){const vo=typeof yo=="string",wo=normalizeKey(vo?yo:yo.key),Eo=vo?void 0:yo.value,ko=vo||!yo.options?lo:{...lo,...yo.options},Ao=to(wo);go(Ao).items.push({key:wo,value:Eo,relativeKey:Ao.relativeKey,options:ko})}return Promise.all([...ho.values()].map(yo=>fo(yo))).then(yo=>yo.flat())},so={hasItem(co,lo={}){co=normalizeKey(co);const{relativeKey:fo,driver:ho}=to(co);return asyncCall(ho.hasItem,fo,lo)},getItem(co,lo={}){co=normalizeKey(co);const{relativeKey:fo,driver:ho}=to(co);return asyncCall(ho.getItem,fo,lo).then(go=>destr(go))},getItems(co,lo){return ao(co,lo,fo=>fo.driver.getItems?asyncCall(fo.driver.getItems,fo.items.map(ho=>({key:ho.relativeKey,options:ho.options})),lo).then(ho=>ho.map(go=>({key:joinKeys(fo.base,go.key),value:destr(go.value)}))):Promise.all(fo.items.map(ho=>asyncCall(fo.driver.getItem,ho.relativeKey,ho.options).then(go=>({key:ho.key,value:destr(go)})))))},getItemRaw(co,lo={}){co=normalizeKey(co);const{relativeKey:fo,driver:ho}=to(co);return ho.getItemRaw?asyncCall(ho.getItemRaw,fo,lo):asyncCall(ho.getItem,fo,lo).then(go=>deserializeRaw(go))},async setItem(co,lo,fo={}){if(lo===void 0)return so.removeItem(co);co=normalizeKey(co);const{relativeKey:ho,driver:go}=to(co);go.setItem&&(await asyncCall(go.setItem,ho,stringify$3(lo),fo),go.watch||no("update",co))},async setItems(co,lo){await ao(co,lo,async fo=>{if(fo.driver.setItems)return asyncCall(fo.driver.setItems,fo.items.map(ho=>({key:ho.relativeKey,value:stringify$3(ho.value),options:ho.options})),lo);fo.driver.setItem&&await Promise.all(fo.items.map(ho=>asyncCall(fo.driver.setItem,ho.relativeKey,stringify$3(ho.value),ho.options)))})},async setItemRaw(co,lo,fo={}){if(lo===void 0)return so.removeItem(co,fo);co=normalizeKey(co);const{relativeKey:ho,driver:go}=to(co);if(go.setItemRaw)await asyncCall(go.setItemRaw,ho,lo,fo);else if(go.setItem)await asyncCall(go.setItem,ho,serializeRaw(lo),fo);else return;go.watch||no("update",co)},async removeItem(co,lo={}){typeof lo=="boolean"&&(lo={removeMeta:lo}),co=normalizeKey(co);const{relativeKey:fo,driver:ho}=to(co);ho.removeItem&&(await asyncCall(ho.removeItem,fo,lo),(lo.removeMeta||lo.removeMata)&&await asyncCall(ho.removeItem,fo+"$",lo),ho.watch||no("remove",co))},async getMeta(co,lo={}){typeof lo=="boolean"&&(lo={nativeOnly:lo}),co=normalizeKey(co);const{relativeKey:fo,driver:ho}=to(co),go=Object.create(null);if(ho.getMeta&&Object.assign(go,await asyncCall(ho.getMeta,fo,lo)),!lo.nativeOnly){const yo=await asyncCall(ho.getItem,fo+"$",lo).then(vo=>destr(vo));yo&&typeof yo=="object"&&(typeof yo.atime=="string"&&(yo.atime=new Date(yo.atime)),typeof yo.mtime=="string"&&(yo.mtime=new Date(yo.mtime)),Object.assign(go,yo))}return go},setMeta(co,lo,fo={}){return this.setItem(co+"$",lo,fo)},removeMeta(co,lo={}){return this.removeItem(co+"$",lo)},async getKeys(co,lo={}){co=normalizeBaseKey(co);const fo=ro(co,!0);let ho=[];const go=[];for(const yo of fo){const vo=await asyncCall(yo.driver.getKeys,yo.relativeBase,lo);for(const wo of vo){const Eo=yo.mountpoint+normalizeKey(wo);ho.some(ko=>Eo.startsWith(ko))||go.push(Eo)}ho=[yo.mountpoint,...ho.filter(wo=>!wo.startsWith(yo.mountpoint))]}return co?go.filter(yo=>yo.startsWith(co)&&yo[yo.length-1]!=="$"):go.filter(yo=>yo[yo.length-1]!=="$")},async clear(co,lo={}){co=normalizeBaseKey(co),await Promise.all(ro(co,!1).map(async fo=>{if(fo.driver.clear)return asyncCall(fo.driver.clear,fo.relativeBase,lo);if(fo.driver.removeItem){const ho=await fo.driver.getKeys(fo.relativeBase||"",lo);return Promise.all(ho.map(go=>fo.driver.removeItem(go,lo)))}}))},async dispose(){await Promise.all(Object.values(eo.mounts).map(co=>dispose(co)))},async watch(co){return await io(),eo.watchListeners.push(co),async()=>{eo.watchListeners=eo.watchListeners.filter(lo=>lo!==co),eo.watchListeners.length===0&&await oo()}},async unwatch(){eo.watchListeners=[],await oo()},mount(co,lo){if(co=normalizeBaseKey(co),co&&eo.mounts[co])throw new Error(`already mounted at ${co}`);return co&&(eo.mountpoints.push(co),eo.mountpoints.sort((fo,ho)=>ho.length-fo.length)),eo.mounts[co]=lo,eo.watching&&Promise.resolve(watch(lo,no,co)).then(fo=>{eo.unwatch[co]=fo}).catch(console.error),so},async unmount(co,lo=!0){co=normalizeBaseKey(co),!(!co||!eo.mounts[co])&&(eo.watching&&co in eo.unwatch&&(eo.unwatch[co](),delete eo.unwatch[co]),lo&&await dispose(eo.mounts[co]),eo.mountpoints=eo.mountpoints.filter(fo=>fo!==co),delete eo.mounts[co])},getMount(co=""){co=normalizeKey(co)+":";const lo=to(co);return{driver:lo.driver,base:lo.base}},getMounts(co="",lo={}){return co=normalizeKey(co),ro(co,lo.parents).map(ho=>({driver:ho.driver,base:ho.mountpoint}))},keys:(co,lo={})=>so.getKeys(co,lo),get:(co,lo={})=>so.getItem(co,lo),set:(co,lo,fo={})=>so.setItem(co,lo,fo),has:(co,lo={})=>so.hasItem(co,lo),del:(co,lo={})=>so.removeItem(co,lo),remove:(co,lo={})=>so.removeItem(co,lo)};return so}function watch(Xr,eo,to){return Xr.watch?Xr.watch((ro,no)=>eo(ro,to+no)):()=>{}}async function dispose(Xr){typeof Xr.dispose=="function"&&await asyncCall(Xr.dispose)}function promisifyRequest(Xr){return new Promise((eo,to)=>{Xr.oncomplete=Xr.onsuccess=()=>eo(Xr.result),Xr.onabort=Xr.onerror=()=>to(Xr.error)})}function createStore(Xr,eo){const to=indexedDB.open(Xr);to.onupgradeneeded=()=>to.result.createObjectStore(eo);const ro=promisifyRequest(to);return(no,io)=>ro.then(oo=>io(oo.transaction(eo,no).objectStore(eo)))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get$2(Xr,eo=defaultGetStore()){return eo("readonly",to=>promisifyRequest(to.get(Xr)))}function set$1(Xr,eo,to=defaultGetStore()){return to("readwrite",ro=>(ro.put(eo,Xr),promisifyRequest(ro.transaction)))}function del(Xr,eo=defaultGetStore()){return eo("readwrite",to=>(to.delete(Xr),promisifyRequest(to.transaction)))}function clear(Xr=defaultGetStore()){return Xr("readwrite",eo=>(eo.clear(),promisifyRequest(eo.transaction)))}function eachCursor(Xr,eo){return Xr.openCursor().onsuccess=function(){this.result&&(eo(this.result),this.result.continue())},promisifyRequest(Xr.transaction)}function keys(Xr=defaultGetStore()){return Xr("readonly",eo=>{if(eo.getAllKeys)return promisifyRequest(eo.getAllKeys());const to=[];return eachCursor(eo,ro=>to.push(ro.key)).then(()=>to)})}const JSONStringify=Xr=>JSON.stringify(Xr,(eo,to)=>typeof to=="bigint"?to.toString()+"n":to),JSONParse=Xr=>{const eo=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,to=Xr.replace(eo,'$1"$2n"$3');return JSON.parse(to,(ro,no)=>typeof no=="string"&&no.match(/^\d+n$/)?BigInt(no.substring(0,no.length-1)):no)};function safeJsonParse(Xr){if(typeof Xr!="string")throw new Error(`Cannot safe json parse value of type ${typeof Xr}`);try{return JSONParse(Xr)}catch{return Xr}}function safeJsonStringify(Xr){return typeof Xr=="string"?Xr:JSONStringify(Xr)||""}const x$5="idb-keyval";var z$7=(Xr={})=>{const eo=Xr.base&&Xr.base.length>0?`${Xr.base}:`:"",to=no=>eo+no;let ro;return Xr.dbName&&Xr.storeName&&(ro=createStore(Xr.dbName,Xr.storeName)),{name:x$5,options:Xr,async hasItem(no){return!(typeof await get$2(to(no),ro)>"u")},async getItem(no){return await get$2(to(no),ro)??null},setItem(no,io){return set$1(to(no),io,ro)},removeItem(no){return del(to(no),ro)},getKeys(){return keys(ro)},clear(){return clear(ro)}}};const D$6="WALLET_CONNECT_V2_INDEXED_DB",E$7="keyvaluestorage";let _$8=class{constructor(){this.indexedDb=createStorage({driver:z$7({dbName:D$6,storeName:E$7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(eo=>[eo.key,eo.value])}async getItem(eo){const to=await this.indexedDb.getItem(eo);if(to!==null)return to}async setItem(eo,to){await this.indexedDb.setItem(eo,safeJsonStringify(to))}async removeItem(eo){await this.indexedDb.removeItem(eo)}};var l$6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},c$5={exports:{}};(function(){let Xr;function eo(){}Xr=eo,Xr.prototype.getItem=function(to){return this.hasOwnProperty(to)?String(this[to]):null},Xr.prototype.setItem=function(to,ro){this[to]=String(ro)},Xr.prototype.removeItem=function(to){delete this[to]},Xr.prototype.clear=function(){const to=this;Object.keys(to).forEach(function(ro){to[ro]=void 0,delete to[ro]})},Xr.prototype.key=function(to){return to=to||0,Object.keys(this)[to]},Xr.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof l$6<"u"&&l$6.localStorage?c$5.exports=l$6.localStorage:typeof window<"u"&&window.localStorage?c$5.exports=window.localStorage:c$5.exports=new eo})();function k$3(Xr){var eo;return[Xr[0],safeJsonParse((eo=Xr[1])!=null?eo:"")]}let K$2=class{constructor(){this.localStorage=c$5.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k$3)}async getItem(eo){const to=this.localStorage.getItem(eo);if(to!==null)return safeJsonParse(to)}async setItem(eo,to){this.localStorage.setItem(eo,safeJsonStringify(to))}async removeItem(eo){this.localStorage.removeItem(eo)}};const N$6="wc_storage_version",y$a=1,O$9=async(Xr,eo,to)=>{const ro=N$6,no=await eo.getItem(ro);if(no&&no>=y$a){to(eo);return}const io=await Xr.getKeys();if(!io.length){to(eo);return}const oo=[];for(;io.length;){const ao=io.shift();if(!ao)continue;const so=ao.toLowerCase();if(so.includes("wc@")||so.includes("walletconnect")||so.includes("wc_")||so.includes("wallet_connect")){const co=await Xr.getItem(ao);await eo.setItem(ao,co),oo.push(ao)}}await eo.setItem(ro,y$a),to(eo),j$8(Xr,oo)},j$8=async(Xr,eo)=>{eo.length&&eo.forEach(async to=>{await Xr.removeItem(to)})};let h$7=class{constructor(){this.initialized=!1,this.setInitialized=to=>{this.storage=to,this.initialized=!0};const eo=new K$2;this.storage=eo;try{const to=new _$8;O$9(eo,to,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(eo){return await this.initialize(),this.storage.getItem(eo)}async setItem(eo,to){return await this.initialize(),this.storage.setItem(eo,to)}async removeItem(eo){return await this.initialize(),this.storage.removeItem(eo)}async initialize(){this.initialized||await new Promise(eo=>{const to=setInterval(()=>{this.initialized&&(clearInterval(to),eo())},20)})}};var cjs$1={};/*! ***************************************************************************** + Approved: ${ao.toString()}`)),Object.keys(eo).forEach(uo=>{if(!uo.includes(":")||ro)return;const ho=A$6(eo[uo].accounts);ho.includes(uo)||(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces accounts don't satisfy namespace accounts for ${uo} + Required: ${uo} + Approved: ${ho.toString()}`))}),oo.forEach(uo=>{ro||(O$a(no[uo].methods,io[uo].methods)?O$a(no[uo].events,io[uo].events)||(ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces events don't satisfy namespace events for ${uo}`)):ro=N$7("NON_CONFORMING_NAMESPACES",`${to} namespaces methods don't satisfy namespace methods for ${uo}`))}),ro}function er$3(Xr){const eo={};return Object.keys(Xr).forEach(to=>{var ro;to.includes(":")?eo[to]=Xr[to]:(ro=Xr[to].chains)==null||ro.forEach(no=>{eo[no]={methods:Xr[to].methods,events:Xr[to].events}})}),eo}function pn$1(Xr){return[...new Set(Xr.map(eo=>eo.includes(":")?eo.split(":")[0]:eo))]}function nr$2(Xr){const eo={};return Object.keys(Xr).forEach(to=>{if(to.includes(":"))eo[to]=Xr[to];else{const ro=A$6(Xr[to].accounts);ro==null||ro.forEach(no=>{eo[no]={accounts:Xr[to].accounts.filter(io=>io.includes(`${no}:`)),methods:Xr[to].methods,events:Xr[to].events}})}}),eo}function tr$3(Xr,eo){return G$4(Xr)&&Xr<=eo.max&&Xr>=eo.min}function rr$3(){const Xr=R$5();return new Promise(eo=>{switch(Xr){case m$4.browser:eo(mn$1());break;case m$4.reactNative:eo(yn$1());break;case m$4.node:eo(gn$1());break;default:eo(!0)}})}function mn$1(){return D$7()&&(navigator==null?void 0:navigator.onLine)}async function yn$1(){if($$5()&&typeof global$1<"u"&&global$1!=null&&global$1.NetInfo){const Xr=await(global$1==null?void 0:global$1.NetInfo.fetch());return Xr==null?void 0:Xr.isConnected}return!0}function gn$1(){return!0}function or$2(Xr){switch(R$5()){case m$4.browser:hn$1(Xr);break;case m$4.reactNative:vn$1(Xr);break}}function hn$1(Xr){!$$5()&&D$7()&&(window.addEventListener("online",()=>Xr(!0)),window.addEventListener("offline",()=>Xr(!1)))}function vn$1(Xr){$$5()&&typeof global$1<"u"&&global$1!=null&&global$1.NetInfo&&(global$1==null||global$1.NetInfo.addEventListener(eo=>Xr(eo==null?void 0:eo.isConnected)))}const ae$3={};let sr$3=class{static get(eo){return ae$3[eo]}static set(eo,to){ae$3[eo]=to}static delete(eo){delete ae$3[eo]}};const suspectProtoRx=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,suspectConstructorRx=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(Xr,eo){if(Xr==="__proto__"||Xr==="constructor"&&eo&&typeof eo=="object"&&"prototype"in eo){warnKeyDropped(Xr);return}return eo}function warnKeyDropped(Xr){console.warn(`[destr] Dropping "${Xr}" key to prevent prototype pollution.`)}function destr(Xr,eo={}){if(typeof Xr!="string")return Xr;const to=Xr.trim();if(Xr[0]==='"'&&Xr.endsWith('"')&&!Xr.includes("\\"))return to.slice(1,-1);if(to.length<=9){const ro=to.toLowerCase();if(ro==="true")return!0;if(ro==="false")return!1;if(ro==="undefined")return;if(ro==="null")return null;if(ro==="nan")return Number.NaN;if(ro==="infinity")return Number.POSITIVE_INFINITY;if(ro==="-infinity")return Number.NEGATIVE_INFINITY}if(!JsonSigRx.test(Xr)){if(eo.strict)throw new SyntaxError("[destr] Invalid JSON");return Xr}try{if(suspectProtoRx.test(Xr)||suspectConstructorRx.test(Xr)){if(eo.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(Xr,jsonParseTransform)}return JSON.parse(Xr)}catch(ro){if(eo.strict)throw ro;return Xr}}function wrapToPromise(Xr){return!Xr||typeof Xr.then!="function"?Promise.resolve(Xr):Xr}function asyncCall(Xr,...eo){try{return wrapToPromise(Xr(...eo))}catch(to){return Promise.reject(to)}}function isPrimitive(Xr){const eo=typeof Xr;return Xr===null||eo!=="object"&&eo!=="function"}function isPureObject(Xr){const eo=Object.getPrototypeOf(Xr);return!eo||eo.isPrototypeOf(Object)}function stringify$3(Xr){if(isPrimitive(Xr))return String(Xr);if(isPureObject(Xr)||Array.isArray(Xr))return JSON.stringify(Xr);if(typeof Xr.toJSON=="function")return stringify$3(Xr.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function checkBufferSupport(){if(typeof Buffer$3>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const BASE64_PREFIX="base64:";function serializeRaw(Xr){if(typeof Xr=="string")return Xr;checkBufferSupport();const eo=Buffer$3.from(Xr).toString("base64");return BASE64_PREFIX+eo}function deserializeRaw(Xr){return typeof Xr!="string"||!Xr.startsWith(BASE64_PREFIX)?Xr:(checkBufferSupport(),Buffer$3.from(Xr.slice(BASE64_PREFIX.length),"base64"))}function normalizeKey(Xr){return Xr?Xr.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function joinKeys(...Xr){return normalizeKey(Xr.join(":"))}function normalizeBaseKey(Xr){return Xr=normalizeKey(Xr),Xr?Xr+":":""}function defineDriver(Xr){return Xr}const DRIVER_NAME="memory",memory=()=>{const Xr=new Map;return{name:DRIVER_NAME,getInstance:()=>Xr,hasItem(eo){return Xr.has(eo)},getItem(eo){return Xr.get(eo)??null},getItemRaw(eo){return Xr.get(eo)??null},setItem(eo,to){Xr.set(eo,to)},setItemRaw(eo,to){Xr.set(eo,to)},removeItem(eo){Xr.delete(eo)},getKeys(){return[...Xr.keys()]},clear(){Xr.clear()},dispose(){Xr.clear()}}};function createStorage(Xr={}){const eo={mounts:{"":Xr.driver||memory()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},to=co=>{for(const lo of eo.mountpoints)if(co.startsWith(lo))return{base:lo,relativeKey:co.slice(lo.length),driver:eo.mounts[lo]};return{base:"",relativeKey:co,driver:eo.mounts[""]}},ro=(co,lo)=>eo.mountpoints.filter(uo=>uo.startsWith(co)||lo&&co.startsWith(uo)).map(uo=>({relativeBase:co.length>uo.length?co.slice(uo.length):void 0,mountpoint:uo,driver:eo.mounts[uo]})),no=(co,lo)=>{if(eo.watching){lo=normalizeKey(lo);for(const uo of eo.watchListeners)uo(co,lo)}},io=async()=>{if(!eo.watching){eo.watching=!0;for(const co in eo.mounts)eo.unwatch[co]=await watch(eo.mounts[co],no,co)}},oo=async()=>{if(eo.watching){for(const co in eo.unwatch)await eo.unwatch[co]();eo.unwatch={},eo.watching=!1}},ao=(co,lo,uo)=>{const ho=new Map,go=bo=>{let wo=ho.get(bo.base);return wo||(wo={driver:bo.driver,base:bo.base,items:[]},ho.set(bo.base,wo)),wo};for(const bo of co){const wo=typeof bo=="string",Eo=normalizeKey(wo?bo:bo.key),$o=wo?void 0:bo.value,Co=wo||!bo.options?lo:{...lo,...bo.options},Ro=to(Eo);go(Ro).items.push({key:Eo,value:$o,relativeKey:Ro.relativeKey,options:Co})}return Promise.all([...ho.values()].map(bo=>uo(bo))).then(bo=>bo.flat())},so={hasItem(co,lo={}){co=normalizeKey(co);const{relativeKey:uo,driver:ho}=to(co);return asyncCall(ho.hasItem,uo,lo)},getItem(co,lo={}){co=normalizeKey(co);const{relativeKey:uo,driver:ho}=to(co);return asyncCall(ho.getItem,uo,lo).then(go=>destr(go))},getItems(co,lo){return ao(co,lo,uo=>uo.driver.getItems?asyncCall(uo.driver.getItems,uo.items.map(ho=>({key:ho.relativeKey,options:ho.options})),lo).then(ho=>ho.map(go=>({key:joinKeys(uo.base,go.key),value:destr(go.value)}))):Promise.all(uo.items.map(ho=>asyncCall(uo.driver.getItem,ho.relativeKey,ho.options).then(go=>({key:ho.key,value:destr(go)})))))},getItemRaw(co,lo={}){co=normalizeKey(co);const{relativeKey:uo,driver:ho}=to(co);return ho.getItemRaw?asyncCall(ho.getItemRaw,uo,lo):asyncCall(ho.getItem,uo,lo).then(go=>deserializeRaw(go))},async setItem(co,lo,uo={}){if(lo===void 0)return so.removeItem(co);co=normalizeKey(co);const{relativeKey:ho,driver:go}=to(co);go.setItem&&(await asyncCall(go.setItem,ho,stringify$3(lo),uo),go.watch||no("update",co))},async setItems(co,lo){await ao(co,lo,async uo=>{if(uo.driver.setItems)return asyncCall(uo.driver.setItems,uo.items.map(ho=>({key:ho.relativeKey,value:stringify$3(ho.value),options:ho.options})),lo);uo.driver.setItem&&await Promise.all(uo.items.map(ho=>asyncCall(uo.driver.setItem,ho.relativeKey,stringify$3(ho.value),ho.options)))})},async setItemRaw(co,lo,uo={}){if(lo===void 0)return so.removeItem(co,uo);co=normalizeKey(co);const{relativeKey:ho,driver:go}=to(co);if(go.setItemRaw)await asyncCall(go.setItemRaw,ho,lo,uo);else if(go.setItem)await asyncCall(go.setItem,ho,serializeRaw(lo),uo);else return;go.watch||no("update",co)},async removeItem(co,lo={}){typeof lo=="boolean"&&(lo={removeMeta:lo}),co=normalizeKey(co);const{relativeKey:uo,driver:ho}=to(co);ho.removeItem&&(await asyncCall(ho.removeItem,uo,lo),(lo.removeMeta||lo.removeMata)&&await asyncCall(ho.removeItem,uo+"$",lo),ho.watch||no("remove",co))},async getMeta(co,lo={}){typeof lo=="boolean"&&(lo={nativeOnly:lo}),co=normalizeKey(co);const{relativeKey:uo,driver:ho}=to(co),go=Object.create(null);if(ho.getMeta&&Object.assign(go,await asyncCall(ho.getMeta,uo,lo)),!lo.nativeOnly){const bo=await asyncCall(ho.getItem,uo+"$",lo).then(wo=>destr(wo));bo&&typeof bo=="object"&&(typeof bo.atime=="string"&&(bo.atime=new Date(bo.atime)),typeof bo.mtime=="string"&&(bo.mtime=new Date(bo.mtime)),Object.assign(go,bo))}return go},setMeta(co,lo,uo={}){return this.setItem(co+"$",lo,uo)},removeMeta(co,lo={}){return this.removeItem(co+"$",lo)},async getKeys(co,lo={}){co=normalizeBaseKey(co);const uo=ro(co,!0);let ho=[];const go=[];for(const bo of uo){const wo=await asyncCall(bo.driver.getKeys,bo.relativeBase,lo);for(const Eo of wo){const $o=bo.mountpoint+normalizeKey(Eo);ho.some(Co=>$o.startsWith(Co))||go.push($o)}ho=[bo.mountpoint,...ho.filter(Eo=>!Eo.startsWith(bo.mountpoint))]}return co?go.filter(bo=>bo.startsWith(co)&&bo[bo.length-1]!=="$"):go.filter(bo=>bo[bo.length-1]!=="$")},async clear(co,lo={}){co=normalizeBaseKey(co),await Promise.all(ro(co,!1).map(async uo=>{if(uo.driver.clear)return asyncCall(uo.driver.clear,uo.relativeBase,lo);if(uo.driver.removeItem){const ho=await uo.driver.getKeys(uo.relativeBase||"",lo);return Promise.all(ho.map(go=>uo.driver.removeItem(go,lo)))}}))},async dispose(){await Promise.all(Object.values(eo.mounts).map(co=>dispose(co)))},async watch(co){return await io(),eo.watchListeners.push(co),async()=>{eo.watchListeners=eo.watchListeners.filter(lo=>lo!==co),eo.watchListeners.length===0&&await oo()}},async unwatch(){eo.watchListeners=[],await oo()},mount(co,lo){if(co=normalizeBaseKey(co),co&&eo.mounts[co])throw new Error(`already mounted at ${co}`);return co&&(eo.mountpoints.push(co),eo.mountpoints.sort((uo,ho)=>ho.length-uo.length)),eo.mounts[co]=lo,eo.watching&&Promise.resolve(watch(lo,no,co)).then(uo=>{eo.unwatch[co]=uo}).catch(console.error),so},async unmount(co,lo=!0){co=normalizeBaseKey(co),!(!co||!eo.mounts[co])&&(eo.watching&&co in eo.unwatch&&(eo.unwatch[co](),delete eo.unwatch[co]),lo&&await dispose(eo.mounts[co]),eo.mountpoints=eo.mountpoints.filter(uo=>uo!==co),delete eo.mounts[co])},getMount(co=""){co=normalizeKey(co)+":";const lo=to(co);return{driver:lo.driver,base:lo.base}},getMounts(co="",lo={}){return co=normalizeKey(co),ro(co,lo.parents).map(ho=>({driver:ho.driver,base:ho.mountpoint}))},keys:(co,lo={})=>so.getKeys(co,lo),get:(co,lo={})=>so.getItem(co,lo),set:(co,lo,uo={})=>so.setItem(co,lo,uo),has:(co,lo={})=>so.hasItem(co,lo),del:(co,lo={})=>so.removeItem(co,lo),remove:(co,lo={})=>so.removeItem(co,lo)};return so}function watch(Xr,eo,to){return Xr.watch?Xr.watch((ro,no)=>eo(ro,to+no)):()=>{}}async function dispose(Xr){typeof Xr.dispose=="function"&&await asyncCall(Xr.dispose)}function promisifyRequest(Xr){return new Promise((eo,to)=>{Xr.oncomplete=Xr.onsuccess=()=>eo(Xr.result),Xr.onabort=Xr.onerror=()=>to(Xr.error)})}function createStore(Xr,eo){const to=indexedDB.open(Xr);to.onupgradeneeded=()=>to.result.createObjectStore(eo);const ro=promisifyRequest(to);return(no,io)=>ro.then(oo=>io(oo.transaction(eo,no).objectStore(eo)))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get$2(Xr,eo=defaultGetStore()){return eo("readonly",to=>promisifyRequest(to.get(Xr)))}function set$1(Xr,eo,to=defaultGetStore()){return to("readwrite",ro=>(ro.put(eo,Xr),promisifyRequest(ro.transaction)))}function del(Xr,eo=defaultGetStore()){return eo("readwrite",to=>(to.delete(Xr),promisifyRequest(to.transaction)))}function clear(Xr=defaultGetStore()){return Xr("readwrite",eo=>(eo.clear(),promisifyRequest(eo.transaction)))}function eachCursor(Xr,eo){return Xr.openCursor().onsuccess=function(){this.result&&(eo(this.result),this.result.continue())},promisifyRequest(Xr.transaction)}function keys(Xr=defaultGetStore()){return Xr("readonly",eo=>{if(eo.getAllKeys)return promisifyRequest(eo.getAllKeys());const to=[];return eachCursor(eo,ro=>to.push(ro.key)).then(()=>to)})}const JSONStringify=Xr=>JSON.stringify(Xr,(eo,to)=>typeof to=="bigint"?to.toString()+"n":to),JSONParse=Xr=>{const eo=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,to=Xr.replace(eo,'$1"$2n"$3');return JSON.parse(to,(ro,no)=>typeof no=="string"&&no.match(/^\d+n$/)?BigInt(no.substring(0,no.length-1)):no)};function safeJsonParse(Xr){if(typeof Xr!="string")throw new Error(`Cannot safe json parse value of type ${typeof Xr}`);try{return JSONParse(Xr)}catch{return Xr}}function safeJsonStringify(Xr){return typeof Xr=="string"?Xr:JSONStringify(Xr)||""}const x$5="idb-keyval";var z$7=(Xr={})=>{const eo=Xr.base&&Xr.base.length>0?`${Xr.base}:`:"",to=no=>eo+no;let ro;return Xr.dbName&&Xr.storeName&&(ro=createStore(Xr.dbName,Xr.storeName)),{name:x$5,options:Xr,async hasItem(no){return!(typeof await get$2(to(no),ro)>"u")},async getItem(no){return await get$2(to(no),ro)??null},setItem(no,io){return set$1(to(no),io,ro)},removeItem(no){return del(to(no),ro)},getKeys(){return keys(ro)},clear(){return clear(ro)}}};const D$6="WALLET_CONNECT_V2_INDEXED_DB",E$7="keyvaluestorage";let _$8=class{constructor(){this.indexedDb=createStorage({driver:z$7({dbName:D$6,storeName:E$7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(eo=>[eo.key,eo.value])}async getItem(eo){const to=await this.indexedDb.getItem(eo);if(to!==null)return to}async setItem(eo,to){await this.indexedDb.setItem(eo,safeJsonStringify(to))}async removeItem(eo){await this.indexedDb.removeItem(eo)}};var l$6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},c$5={exports:{}};(function(){let Xr;function eo(){}Xr=eo,Xr.prototype.getItem=function(to){return this.hasOwnProperty(to)?String(this[to]):null},Xr.prototype.setItem=function(to,ro){this[to]=String(ro)},Xr.prototype.removeItem=function(to){delete this[to]},Xr.prototype.clear=function(){const to=this;Object.keys(to).forEach(function(ro){to[ro]=void 0,delete to[ro]})},Xr.prototype.key=function(to){return to=to||0,Object.keys(this)[to]},Xr.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof l$6<"u"&&l$6.localStorage?c$5.exports=l$6.localStorage:typeof window<"u"&&window.localStorage?c$5.exports=window.localStorage:c$5.exports=new eo})();function k$3(Xr){var eo;return[Xr[0],safeJsonParse((eo=Xr[1])!=null?eo:"")]}let K$2=class{constructor(){this.localStorage=c$5.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k$3)}async getItem(eo){const to=this.localStorage.getItem(eo);if(to!==null)return safeJsonParse(to)}async setItem(eo,to){this.localStorage.setItem(eo,safeJsonStringify(to))}async removeItem(eo){this.localStorage.removeItem(eo)}};const N$6="wc_storage_version",y$a=1,O$9=async(Xr,eo,to)=>{const ro=N$6,no=await eo.getItem(ro);if(no&&no>=y$a){to(eo);return}const io=await Xr.getKeys();if(!io.length){to(eo);return}const oo=[];for(;io.length;){const ao=io.shift();if(!ao)continue;const so=ao.toLowerCase();if(so.includes("wc@")||so.includes("walletconnect")||so.includes("wc_")||so.includes("wallet_connect")){const co=await Xr.getItem(ao);await eo.setItem(ao,co),oo.push(ao)}}await eo.setItem(ro,y$a),to(eo),j$8(Xr,oo)},j$8=async(Xr,eo)=>{eo.length&&eo.forEach(async to=>{await Xr.removeItem(to)})};let h$7=class{constructor(){this.initialized=!1,this.setInitialized=to=>{this.storage=to,this.initialized=!0};const eo=new K$2;this.storage=eo;try{const to=new _$8;O$9(eo,to,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(eo){return await this.initialize(),this.storage.getItem(eo)}async setItem(eo,to){return await this.initialize(),this.storage.setItem(eo,to)}async removeItem(eo){return await this.initialize(),this.storage.removeItem(eo)}async initialize(){this.initialized||await new Promise(eo=>{const to=setInterval(()=>{this.initialized&&(clearInterval(to),eo())},20)})}};var cjs$1={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -2284,7 +4114,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$1=function(Xr,eo){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(to,ro){to.__proto__=ro}||function(to,ro){for(var no in ro)ro.hasOwnProperty(no)&&(to[no]=ro[no])},extendStatics$1(Xr,eo)};function __extends$1(Xr,eo){extendStatics$1(Xr,eo);function to(){this.constructor=Xr}Xr.prototype=eo===null?Object.create(eo):(to.prototype=eo.prototype,new to)}var __assign$1=function(){return __assign$1=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param$1(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata$1(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$8(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator$1(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$1(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread$1(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(yo){fo(io[0][3],yo)}}function so(ho){ho.value instanceof __await$1?Promise.resolve(ho.value.v).then(co,lo):fo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function fo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator$1(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await$1(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues$1(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values$1=="function"?__values$1(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject$1(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$2(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$6(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet$1(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet$1(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$1},__asyncDelegator:__asyncDelegator$1,__asyncGenerator:__asyncGenerator$1,__asyncValues:__asyncValues$1,__await:__await$1,__awaiter:__awaiter$8,__classPrivateFieldGet:__classPrivateFieldGet$1,__classPrivateFieldSet:__classPrivateFieldSet$1,__createBinding:__createBinding$2,__decorate:__decorate$2,__exportStar:__exportStar$1,__extends:__extends$1,__generator:__generator$1,__importDefault:__importDefault$6,__importStar:__importStar$2,__makeTemplateObject:__makeTemplateObject$1,__metadata:__metadata$1,__param:__param$1,__read:__read$1,__rest:__rest$4,__spread:__spread$1,__spreadArrays:__spreadArrays$1,__values:__values$1},Symbol.toStringTag,{value:"Module"})),require$$0$6=getAugmentedNamespace(tslib_es6$1);var heartbeat$2={},types={},heartbeat$1={};class IEvents{}const esm=Object.freeze(Object.defineProperty({__proto__:null,IEvents},Symbol.toStringTag,{value:"Module"})),require$$0$5=getAugmentedNamespace(esm);var hasRequiredHeartbeat$2;function requireHeartbeat$2(){if(hasRequiredHeartbeat$2)return heartbeat$1;hasRequiredHeartbeat$2=1,Object.defineProperty(heartbeat$1,"__esModule",{value:!0}),heartbeat$1.IHeartBeat=void 0;const Xr=require$$0$5;class eo extends Xr.IEvents{constructor(ro){super()}}return heartbeat$1.IHeartBeat=eo,heartbeat$1}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$2(),Xr)}(types)),types}var constants$6={},heartbeat={},hasRequiredHeartbeat$1;function requireHeartbeat$1(){if(hasRequiredHeartbeat$1)return heartbeat;hasRequiredHeartbeat$1=1,Object.defineProperty(heartbeat,"__esModule",{value:!0}),heartbeat.HEARTBEAT_EVENTS=heartbeat.HEARTBEAT_INTERVAL=void 0;const Xr=cjs$4;return heartbeat.HEARTBEAT_INTERVAL=Xr.FIVE_SECONDS,heartbeat.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},heartbeat}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$1(),Xr)}(constants$6)),constants$6}var hasRequiredHeartbeat;function requireHeartbeat(){if(hasRequiredHeartbeat)return heartbeat$2;hasRequiredHeartbeat=1,Object.defineProperty(heartbeat$2,"__esModule",{value:!0}),heartbeat$2.HeartBeat=void 0;const Xr=require$$0$6,eo=eventsExports,to=cjs$4,ro=requireTypes(),no=requireConstants();class io extends ro.IHeartBeat{constructor(ao){super(ao),this.events=new eo.EventEmitter,this.interval=no.HEARTBEAT_INTERVAL,this.interval=(ao==null?void 0:ao.interval)||no.HEARTBEAT_INTERVAL}static init(ao){return Xr.__awaiter(this,void 0,void 0,function*(){const so=new io(ao);return yield so.init(),so})}init(){return Xr.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(ao,so){this.events.on(ao,so)}once(ao,so){this.events.once(ao,so)}off(ao,so){this.events.off(ao,so)}removeListener(ao,so){this.events.removeListener(ao,so)}initialize(){return Xr.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),to.toMiliseconds(this.interval))})}pulse(){this.events.emit(no.HEARTBEAT_EVENTS.pulse)}}return heartbeat$2.HeartBeat=io,heartbeat$2}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$6;eo.__exportStar(requireHeartbeat(),Xr),eo.__exportStar(requireTypes(),Xr),eo.__exportStar(requireConstants(),Xr)})(cjs$1);function tryStringify(Xr){try{return JSON.stringify(Xr)}catch{return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(Xr,eo,to){var ro=to&&to.stringify||tryStringify,no=1;if(typeof Xr=="object"&&Xr!==null){var io=eo.length+no;if(io===1)return Xr;var oo=new Array(io);oo[0]=ro(Xr);for(var ao=1;ao-1?fo:0,Xr.charCodeAt(go+1)){case 100:case 102:if(lo>=so||eo[lo]==null)break;fo=so||eo[lo]==null)break;fo=so||eo[lo]===void 0)break;fo",fo=go+2,go++;break}co+=ro(eo[lo]),fo=go+2,go++;break;case 115:if(lo>=so)break;fo-1&&(io=!1);const oo=["error","fatal","warn","info","debug","trace"];typeof to=="function"&&(to.error=to.fatal=to.warn=to.info=to.debug=to.trace=to),Xr.enabled===!1&&(Xr.level="silent");const ao=Xr.level||"info",so=Object.create(to);so.log||(so.log=noop$5),Object.defineProperty(so,"levelVal",{get:lo}),Object.defineProperty(so,"level",{get:fo,set:ho});const co={transmit:eo,serialize:no,asObject:Xr.browser.asObject,levels:oo,timestamp:getTimeFunction(Xr)};so.levels=pino.levels,so.level=ao,so.setMaxListeners=so.getMaxListeners=so.emit=so.addListener=so.on=so.prependListener=so.once=so.prependOnceListener=so.removeListener=so.removeAllListeners=so.listeners=so.listenerCount=so.eventNames=so.write=so.flush=noop$5,so.serializers=ro,so._serialize=no,so._stdErrSerialize=io,so.child=go,eo&&(so._logEvent=createLogEventShape());function lo(){return this.level==="silent"?1/0:this.levels.values[this.level]}function fo(){return this._level}function ho(yo){if(yo!=="silent"&&!this.levels.values[yo])throw Error("unknown level "+yo);this._level=yo,set(co,so,"error","log"),set(co,so,"fatal","error"),set(co,so,"warn","error"),set(co,so,"info","log"),set(co,so,"debug","log"),set(co,so,"trace","log")}function go(yo,vo){if(!yo)throw new Error("missing bindings for child Pino");vo=vo||{},no&&yo.serializers&&(vo.serializers=yo.serializers);const wo=vo.serializers;if(no&&wo){var Eo=Object.assign({},ro,wo),ko=Xr.browser.serialize===!0?Object.keys(Eo):no;delete yo.serializers,applySerializers([yo],ko,Eo,this._stdErrSerialize)}function Ao(Po){this._childLevel=(Po._childLevel|0)+1,this.error=bind(Po,yo,"error"),this.fatal=bind(Po,yo,"fatal"),this.warn=bind(Po,yo,"warn"),this.info=bind(Po,yo,"info"),this.debug=bind(Po,yo,"debug"),this.trace=bind(Po,yo,"trace"),Eo&&(this.serializers=Eo,this._serialize=ko),eo&&(this._logEvent=createLogEventShape([].concat(Po._logEvent.bindings,yo)))}return Ao.prototype=this,new Ao(this)}return so}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pino.stdSerializers=stdSerializers;pino.stdTimeFunctions=Object.assign({},{nullTime,epochTime,unixTime,isoTime});function set(Xr,eo,to,ro){const no=Object.getPrototypeOf(eo);eo[to]=eo.levelVal>eo.levels.values[to]?noop$5:no[to]?no[to]:_console[to]||_console[ro]||noop$5,wrap(Xr,eo,to)}function wrap(Xr,eo,to){!Xr.transmit&&eo[to]===noop$5||(eo[to]=function(ro){return function(){const io=Xr.timestamp(),oo=new Array(arguments.length),ao=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var so=0;so-1&&io in to&&(Xr[no][io]=to[io](Xr[no][io]))}function bind(Xr,eo,to){return function(){const ro=new Array(1+arguments.length);ro[0]=eo;for(var no=1;noeo in Xr?x$4(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,i$4=(Xr,eo)=>{for(var to in eo||(eo={}))T$8.call(eo,to)&&f$9(Xr,to,eo[to]);if(p$6)for(var to of p$6(eo))z$6.call(eo,to)&&f$9(Xr,to,eo[to]);return Xr},g$a=(Xr,eo)=>S$6(Xr,_$7(eo));function k$2(Xr){return g$a(i$4({},Xr),{level:(Xr==null?void 0:Xr.level)||c$4.level})}function v$7(Xr,eo=n$4){return Xr[eo]||""}function b$7(Xr,eo,to=n$4){return Xr[to]=eo,Xr}function y$9(Xr,eo=n$4){let to="";return typeof Xr.bindings>"u"?to=v$7(Xr,eo):to=Xr.bindings().context||"",to}function w$8(Xr,eo,to=n$4){const ro=y$9(Xr,to);return ro.trim()?`${ro}/${eo}`:eo}function E$6(Xr,eo,to=n$4){const ro=w$8(Xr,eo,to),no=Xr.child({context:ro});return b$7(no,ro,to)}let n$3=class extends IEvents{constructor(eo){super(),this.opts=eo,this.protocol="wc",this.version=2}},h$6=class extends IEvents{constructor(eo,to){super(),this.core=eo,this.logger=to,this.records=new Map}},a$5=class{constructor(eo,to){this.logger=eo,this.core=to}},u$5=class extends IEvents{constructor(eo,to){super(),this.relayer=eo,this.logger=to}},g$9=class extends IEvents{constructor(eo){super()}},p$5=class{constructor(eo,to,ro,no){this.core=eo,this.logger=to,this.name=ro}},d$7=class extends IEvents{constructor(eo,to){super(),this.relayer=eo,this.logger=to}},E$5=class extends IEvents{constructor(eo,to){super(),this.core=eo,this.logger=to}},y$8=class{constructor(eo,to){this.projectId=eo,this.logger=to}},v$6=class{constructor(eo,to){this.projectId=eo,this.logger=to}},b$6=class{constructor(eo){this.opts=eo,this.protocol="wc",this.version=2}},w$7=class{constructor(eo){this.client=eo}};var ed25519$1={},sha512={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});var eo=binary,to=wipe$1;Xr.DIGEST_LENGTH=64,Xr.BLOCK_SIZE=128;var ro=function(){function ao(){this.digestLength=Xr.DIGEST_LENGTH,this.blockSize=Xr.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return ao.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},ao.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},ao.prototype.clean=function(){to.wipe(this._buffer),to.wipe(this._tempHi),to.wipe(this._tempLo),this.reset()},ao.prototype.update=function(so,co){if(co===void 0&&(co=so.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var lo=0;if(this._bytesHashed+=co,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=so[lo++],co--;this._bufferLength===this.blockSize&&(io(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(co>=this.blockSize&&(lo=io(this._tempHi,this._tempLo,this._stateHi,this._stateLo,so,lo,co),co%=this.blockSize);co>0;)this._buffer[this._bufferLength++]=so[lo++],co--;return this},ao.prototype.finish=function(so){if(!this._finished){var co=this._bytesHashed,lo=this._bufferLength,fo=co/536870912|0,ho=co<<3,go=co%128<112?128:256;this._buffer[lo]=128;for(var yo=lo+1;yo0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},ao.prototype.restoreState=function(so){return this._stateHi.set(so.stateHi),this._stateLo.set(so.stateLo),this._bufferLength=so.bufferLength,so.buffer&&this._buffer.set(so.buffer),this._bytesHashed=so.bytesHashed,this._finished=!1,this},ao.prototype.cleanSavedState=function(so){to.wipe(so.stateHi),to.wipe(so.stateLo),so.buffer&&to.wipe(so.buffer),so.bufferLength=0,so.bytesHashed=0},ao}();Xr.SHA512=ro;var no=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function io(ao,so,co,lo,fo,ho,go){for(var yo=co[0],vo=co[1],wo=co[2],Eo=co[3],ko=co[4],Ao=co[5],Po=co[6],jo=co[7],Mo=lo[0],No=lo[1],Do=lo[2],Fo=lo[3],Xo=lo[4],Lo=lo[5],Bo=lo[6],xo=lo[7],uo,po,bo,_o,$o,Co,Ro,So;go>=128;){for(var mo=0;mo<16;mo++){var To=8*mo+ho;ao[mo]=eo.readUint32BE(fo,To),so[mo]=eo.readUint32BE(fo,To+4)}for(var mo=0;mo<80;mo++){var Vo=yo,Zo=vo,Qo=wo,qo=Eo,Ho=ko,$a=Ao,zo=Po,Ko=jo,_c=Mo,Cl=No,ga=Do,El=Fo,Al=Xo,Ol=Lo,Wl=Bo,zl=xo;if(uo=jo,po=xo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=(ko>>>14|Xo<<18)^(ko>>>18|Xo<<14)^(Xo>>>9|ko<<23),po=(Xo>>>14|ko<<18)^(Xo>>>18|ko<<14)^(ko>>>9|Xo<<23),$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,uo=ko&Ao^~ko&Po,po=Xo&Lo^~Xo&Bo,$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,uo=no[mo*2],po=no[mo*2+1],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,uo=ao[mo%16],po=so[mo%16],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,bo=Ro&65535|So<<16,_o=$o&65535|Co<<16,uo=bo,po=_o,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=(yo>>>28|Mo<<4)^(Mo>>>2|yo<<30)^(Mo>>>7|yo<<25),po=(Mo>>>28|yo<<4)^(yo>>>2|Mo<<30)^(yo>>>7|Mo<<25),$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,uo=yo&vo^yo&wo^vo&wo,po=Mo&No^Mo&Do^No&Do,$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,Ko=Ro&65535|So<<16,zl=$o&65535|Co<<16,uo=qo,po=El,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=bo,po=_o,$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,qo=Ro&65535|So<<16,El=$o&65535|Co<<16,vo=Vo,wo=Zo,Eo=Qo,ko=qo,Ao=Ho,Po=$a,jo=zo,yo=Ko,No=_c,Do=Cl,Fo=ga,Xo=El,Lo=Al,Bo=Ol,xo=Wl,Mo=zl,mo%16===15)for(var To=0;To<16;To++)uo=ao[To],po=so[To],$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=ao[(To+9)%16],po=so[(To+9)%16],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,bo=ao[(To+1)%16],_o=so[(To+1)%16],uo=(bo>>>1|_o<<31)^(bo>>>8|_o<<24)^bo>>>7,po=(_o>>>1|bo<<31)^(_o>>>8|bo<<24)^(_o>>>7|bo<<25),$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,bo=ao[(To+14)%16],_o=so[(To+14)%16],uo=(bo>>>19|_o<<13)^(_o>>>29|bo<<3)^bo>>>6,po=(_o>>>19|bo<<13)^(bo>>>29|_o<<3)^(_o>>>6|bo<<26),$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,ao[To]=Ro&65535|So<<16,so[To]=$o&65535|Co<<16}uo=yo,po=Mo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[0],po=lo[0],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[0]=yo=Ro&65535|So<<16,lo[0]=Mo=$o&65535|Co<<16,uo=vo,po=No,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[1],po=lo[1],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[1]=vo=Ro&65535|So<<16,lo[1]=No=$o&65535|Co<<16,uo=wo,po=Do,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[2],po=lo[2],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[2]=wo=Ro&65535|So<<16,lo[2]=Do=$o&65535|Co<<16,uo=Eo,po=Fo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[3],po=lo[3],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[3]=Eo=Ro&65535|So<<16,lo[3]=Fo=$o&65535|Co<<16,uo=ko,po=Xo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[4],po=lo[4],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[4]=ko=Ro&65535|So<<16,lo[4]=Xo=$o&65535|Co<<16,uo=Ao,po=Lo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[5],po=lo[5],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[5]=Ao=Ro&65535|So<<16,lo[5]=Lo=$o&65535|Co<<16,uo=Po,po=Bo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[6],po=lo[6],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[6]=Po=Ro&65535|So<<16,lo[6]=Bo=$o&65535|Co<<16,uo=jo,po=xo,$o=po&65535,Co=po>>>16,Ro=uo&65535,So=uo>>>16,uo=co[7],po=lo[7],$o+=po&65535,Co+=po>>>16,Ro+=uo&65535,So+=uo>>>16,Co+=$o>>>16,Ro+=Co>>>16,So+=Ro>>>16,co[7]=jo=Ro&65535|So<<16,lo[7]=xo=$o&65535|Co<<16,ho+=128,go-=128}return ho}function oo(ao){var so=new ro;so.update(ao);var co=so.digest();return so.clean(),co}Xr.hash=oo})(sha512);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.convertSecretKeyToX25519=Xr.convertPublicKeyToX25519=Xr.verify=Xr.sign=Xr.extractPublicKeyFromSecretKey=Xr.generateKeyPair=Xr.generateKeyPairFromSeed=Xr.SEED_LENGTH=Xr.SECRET_KEY_LENGTH=Xr.PUBLIC_KEY_LENGTH=Xr.SIGNATURE_LENGTH=void 0;const eo=random,to=sha512,ro=wipe$1;Xr.SIGNATURE_LENGTH=64,Xr.PUBLIC_KEY_LENGTH=32,Xr.SECRET_KEY_LENGTH=64,Xr.SEED_LENGTH=32;function no(qo){const Ho=new Float64Array(16);if(qo)for(let $a=0;$a>16&1),$a[Cl-1]&=65535;$a[15]=zo[15]-32767-($a[14]>>16&1);const _c=$a[15]>>16&1;$a[14]&=65535,vo(zo,$a,1-_c)}for(let Ko=0;Ko<16;Ko++)qo[2*Ko]=zo[Ko]&255,qo[2*Ko+1]=zo[Ko]>>8}function Eo(qo,Ho){let $a=0;for(let zo=0;zo<32;zo++)$a|=qo[zo]^Ho[zo];return(1&$a-1>>>8)-1}function ko(qo,Ho){const $a=new Uint8Array(32),zo=new Uint8Array(32);return wo($a,qo),wo(zo,Ho),Eo($a,zo)}function Ao(qo){const Ho=new Uint8Array(32);return wo(Ho,qo),Ho[0]&1}function Po(qo,Ho){for(let $a=0;$a<16;$a++)qo[$a]=Ho[2*$a]+(Ho[2*$a+1]<<8);qo[15]&=32767}function jo(qo,Ho,$a){for(let zo=0;zo<16;zo++)qo[zo]=Ho[zo]+$a[zo]}function Mo(qo,Ho,$a){for(let zo=0;zo<16;zo++)qo[zo]=Ho[zo]-$a[zo]}function No(qo,Ho,$a){let zo,Ko,_c=0,Cl=0,ga=0,El=0,Al=0,Ol=0,Wl=0,zl=0,Tl=0,Ml=0,ou=0,Vl=0,Ll=0,uu=0,ru=0,tu=0,ku=0,au=0,wl=0,Jo=0,Go=0,$l=0,Zl=0,Ul=0,Gl=0,Nu=0,hu=0,cu=0,Wu=0,mu=0,yu=0,Yu=$a[0],_u=$a[1],Il=$a[2],Nl=$a[3],Pl=$a[4],Bl=$a[5],fu=$a[6],eu=$a[7],Xl=$a[8],$u=$a[9],Yo=$a[10],_l=$a[11],Sl=$a[12],Wo=$a[13],xl=$a[14],Ql=$a[15];zo=Ho[0],_c+=zo*Yu,Cl+=zo*_u,ga+=zo*Il,El+=zo*Nl,Al+=zo*Pl,Ol+=zo*Bl,Wl+=zo*fu,zl+=zo*eu,Tl+=zo*Xl,Ml+=zo*$u,ou+=zo*Yo,Vl+=zo*_l,Ll+=zo*Sl,uu+=zo*Wo,ru+=zo*xl,tu+=zo*Ql,zo=Ho[1],Cl+=zo*Yu,ga+=zo*_u,El+=zo*Il,Al+=zo*Nl,Ol+=zo*Pl,Wl+=zo*Bl,zl+=zo*fu,Tl+=zo*eu,Ml+=zo*Xl,ou+=zo*$u,Vl+=zo*Yo,Ll+=zo*_l,uu+=zo*Sl,ru+=zo*Wo,tu+=zo*xl,ku+=zo*Ql,zo=Ho[2],ga+=zo*Yu,El+=zo*_u,Al+=zo*Il,Ol+=zo*Nl,Wl+=zo*Pl,zl+=zo*Bl,Tl+=zo*fu,Ml+=zo*eu,ou+=zo*Xl,Vl+=zo*$u,Ll+=zo*Yo,uu+=zo*_l,ru+=zo*Sl,tu+=zo*Wo,ku+=zo*xl,au+=zo*Ql,zo=Ho[3],El+=zo*Yu,Al+=zo*_u,Ol+=zo*Il,Wl+=zo*Nl,zl+=zo*Pl,Tl+=zo*Bl,Ml+=zo*fu,ou+=zo*eu,Vl+=zo*Xl,Ll+=zo*$u,uu+=zo*Yo,ru+=zo*_l,tu+=zo*Sl,ku+=zo*Wo,au+=zo*xl,wl+=zo*Ql,zo=Ho[4],Al+=zo*Yu,Ol+=zo*_u,Wl+=zo*Il,zl+=zo*Nl,Tl+=zo*Pl,Ml+=zo*Bl,ou+=zo*fu,Vl+=zo*eu,Ll+=zo*Xl,uu+=zo*$u,ru+=zo*Yo,tu+=zo*_l,ku+=zo*Sl,au+=zo*Wo,wl+=zo*xl,Jo+=zo*Ql,zo=Ho[5],Ol+=zo*Yu,Wl+=zo*_u,zl+=zo*Il,Tl+=zo*Nl,Ml+=zo*Pl,ou+=zo*Bl,Vl+=zo*fu,Ll+=zo*eu,uu+=zo*Xl,ru+=zo*$u,tu+=zo*Yo,ku+=zo*_l,au+=zo*Sl,wl+=zo*Wo,Jo+=zo*xl,Go+=zo*Ql,zo=Ho[6],Wl+=zo*Yu,zl+=zo*_u,Tl+=zo*Il,Ml+=zo*Nl,ou+=zo*Pl,Vl+=zo*Bl,Ll+=zo*fu,uu+=zo*eu,ru+=zo*Xl,tu+=zo*$u,ku+=zo*Yo,au+=zo*_l,wl+=zo*Sl,Jo+=zo*Wo,Go+=zo*xl,$l+=zo*Ql,zo=Ho[7],zl+=zo*Yu,Tl+=zo*_u,Ml+=zo*Il,ou+=zo*Nl,Vl+=zo*Pl,Ll+=zo*Bl,uu+=zo*fu,ru+=zo*eu,tu+=zo*Xl,ku+=zo*$u,au+=zo*Yo,wl+=zo*_l,Jo+=zo*Sl,Go+=zo*Wo,$l+=zo*xl,Zl+=zo*Ql,zo=Ho[8],Tl+=zo*Yu,Ml+=zo*_u,ou+=zo*Il,Vl+=zo*Nl,Ll+=zo*Pl,uu+=zo*Bl,ru+=zo*fu,tu+=zo*eu,ku+=zo*Xl,au+=zo*$u,wl+=zo*Yo,Jo+=zo*_l,Go+=zo*Sl,$l+=zo*Wo,Zl+=zo*xl,Ul+=zo*Ql,zo=Ho[9],Ml+=zo*Yu,ou+=zo*_u,Vl+=zo*Il,Ll+=zo*Nl,uu+=zo*Pl,ru+=zo*Bl,tu+=zo*fu,ku+=zo*eu,au+=zo*Xl,wl+=zo*$u,Jo+=zo*Yo,Go+=zo*_l,$l+=zo*Sl,Zl+=zo*Wo,Ul+=zo*xl,Gl+=zo*Ql,zo=Ho[10],ou+=zo*Yu,Vl+=zo*_u,Ll+=zo*Il,uu+=zo*Nl,ru+=zo*Pl,tu+=zo*Bl,ku+=zo*fu,au+=zo*eu,wl+=zo*Xl,Jo+=zo*$u,Go+=zo*Yo,$l+=zo*_l,Zl+=zo*Sl,Ul+=zo*Wo,Gl+=zo*xl,Nu+=zo*Ql,zo=Ho[11],Vl+=zo*Yu,Ll+=zo*_u,uu+=zo*Il,ru+=zo*Nl,tu+=zo*Pl,ku+=zo*Bl,au+=zo*fu,wl+=zo*eu,Jo+=zo*Xl,Go+=zo*$u,$l+=zo*Yo,Zl+=zo*_l,Ul+=zo*Sl,Gl+=zo*Wo,Nu+=zo*xl,hu+=zo*Ql,zo=Ho[12],Ll+=zo*Yu,uu+=zo*_u,ru+=zo*Il,tu+=zo*Nl,ku+=zo*Pl,au+=zo*Bl,wl+=zo*fu,Jo+=zo*eu,Go+=zo*Xl,$l+=zo*$u,Zl+=zo*Yo,Ul+=zo*_l,Gl+=zo*Sl,Nu+=zo*Wo,hu+=zo*xl,cu+=zo*Ql,zo=Ho[13],uu+=zo*Yu,ru+=zo*_u,tu+=zo*Il,ku+=zo*Nl,au+=zo*Pl,wl+=zo*Bl,Jo+=zo*fu,Go+=zo*eu,$l+=zo*Xl,Zl+=zo*$u,Ul+=zo*Yo,Gl+=zo*_l,Nu+=zo*Sl,hu+=zo*Wo,cu+=zo*xl,Wu+=zo*Ql,zo=Ho[14],ru+=zo*Yu,tu+=zo*_u,ku+=zo*Il,au+=zo*Nl,wl+=zo*Pl,Jo+=zo*Bl,Go+=zo*fu,$l+=zo*eu,Zl+=zo*Xl,Ul+=zo*$u,Gl+=zo*Yo,Nu+=zo*_l,hu+=zo*Sl,cu+=zo*Wo,Wu+=zo*xl,mu+=zo*Ql,zo=Ho[15],tu+=zo*Yu,ku+=zo*_u,au+=zo*Il,wl+=zo*Nl,Jo+=zo*Pl,Go+=zo*Bl,$l+=zo*fu,Zl+=zo*eu,Ul+=zo*Xl,Gl+=zo*$u,Nu+=zo*Yo,hu+=zo*_l,cu+=zo*Sl,Wu+=zo*Wo,mu+=zo*xl,yu+=zo*Ql,_c+=38*ku,Cl+=38*au,ga+=38*wl,El+=38*Jo,Al+=38*Go,Ol+=38*$l,Wl+=38*Zl,zl+=38*Ul,Tl+=38*Gl,Ml+=38*Nu,ou+=38*hu,Vl+=38*cu,Ll+=38*Wu,uu+=38*mu,ru+=38*yu,Ko=1,zo=_c+Ko+65535,Ko=Math.floor(zo/65536),_c=zo-Ko*65536,zo=Cl+Ko+65535,Ko=Math.floor(zo/65536),Cl=zo-Ko*65536,zo=ga+Ko+65535,Ko=Math.floor(zo/65536),ga=zo-Ko*65536,zo=El+Ko+65535,Ko=Math.floor(zo/65536),El=zo-Ko*65536,zo=Al+Ko+65535,Ko=Math.floor(zo/65536),Al=zo-Ko*65536,zo=Ol+Ko+65535,Ko=Math.floor(zo/65536),Ol=zo-Ko*65536,zo=Wl+Ko+65535,Ko=Math.floor(zo/65536),Wl=zo-Ko*65536,zo=zl+Ko+65535,Ko=Math.floor(zo/65536),zl=zo-Ko*65536,zo=Tl+Ko+65535,Ko=Math.floor(zo/65536),Tl=zo-Ko*65536,zo=Ml+Ko+65535,Ko=Math.floor(zo/65536),Ml=zo-Ko*65536,zo=ou+Ko+65535,Ko=Math.floor(zo/65536),ou=zo-Ko*65536,zo=Vl+Ko+65535,Ko=Math.floor(zo/65536),Vl=zo-Ko*65536,zo=Ll+Ko+65535,Ko=Math.floor(zo/65536),Ll=zo-Ko*65536,zo=uu+Ko+65535,Ko=Math.floor(zo/65536),uu=zo-Ko*65536,zo=ru+Ko+65535,Ko=Math.floor(zo/65536),ru=zo-Ko*65536,zo=tu+Ko+65535,Ko=Math.floor(zo/65536),tu=zo-Ko*65536,_c+=Ko-1+37*(Ko-1),Ko=1,zo=_c+Ko+65535,Ko=Math.floor(zo/65536),_c=zo-Ko*65536,zo=Cl+Ko+65535,Ko=Math.floor(zo/65536),Cl=zo-Ko*65536,zo=ga+Ko+65535,Ko=Math.floor(zo/65536),ga=zo-Ko*65536,zo=El+Ko+65535,Ko=Math.floor(zo/65536),El=zo-Ko*65536,zo=Al+Ko+65535,Ko=Math.floor(zo/65536),Al=zo-Ko*65536,zo=Ol+Ko+65535,Ko=Math.floor(zo/65536),Ol=zo-Ko*65536,zo=Wl+Ko+65535,Ko=Math.floor(zo/65536),Wl=zo-Ko*65536,zo=zl+Ko+65535,Ko=Math.floor(zo/65536),zl=zo-Ko*65536,zo=Tl+Ko+65535,Ko=Math.floor(zo/65536),Tl=zo-Ko*65536,zo=Ml+Ko+65535,Ko=Math.floor(zo/65536),Ml=zo-Ko*65536,zo=ou+Ko+65535,Ko=Math.floor(zo/65536),ou=zo-Ko*65536,zo=Vl+Ko+65535,Ko=Math.floor(zo/65536),Vl=zo-Ko*65536,zo=Ll+Ko+65535,Ko=Math.floor(zo/65536),Ll=zo-Ko*65536,zo=uu+Ko+65535,Ko=Math.floor(zo/65536),uu=zo-Ko*65536,zo=ru+Ko+65535,Ko=Math.floor(zo/65536),ru=zo-Ko*65536,zo=tu+Ko+65535,Ko=Math.floor(zo/65536),tu=zo-Ko*65536,_c+=Ko-1+37*(Ko-1),qo[0]=_c,qo[1]=Cl,qo[2]=ga,qo[3]=El,qo[4]=Al,qo[5]=Ol,qo[6]=Wl,qo[7]=zl,qo[8]=Tl,qo[9]=Ml,qo[10]=ou,qo[11]=Vl,qo[12]=Ll,qo[13]=uu,qo[14]=ru,qo[15]=tu}function Do(qo,Ho){No(qo,Ho,Ho)}function Fo(qo,Ho){const $a=no();let zo;for(zo=0;zo<16;zo++)$a[zo]=Ho[zo];for(zo=253;zo>=0;zo--)Do($a,$a),zo!==2&&zo!==4&&No($a,$a,Ho);for(zo=0;zo<16;zo++)qo[zo]=$a[zo]}function Xo(qo,Ho){const $a=no();let zo;for(zo=0;zo<16;zo++)$a[zo]=Ho[zo];for(zo=250;zo>=0;zo--)Do($a,$a),zo!==1&&No($a,$a,Ho);for(zo=0;zo<16;zo++)qo[zo]=$a[zo]}function Lo(qo,Ho){const $a=no(),zo=no(),Ko=no(),_c=no(),Cl=no(),ga=no(),El=no(),Al=no(),Ol=no();Mo($a,qo[1],qo[0]),Mo(Ol,Ho[1],Ho[0]),No($a,$a,Ol),jo(zo,qo[0],qo[1]),jo(Ol,Ho[0],Ho[1]),No(zo,zo,Ol),No(Ko,qo[3],Ho[3]),No(Ko,Ko,co),No(_c,qo[2],Ho[2]),jo(_c,_c,_c),Mo(Cl,zo,$a),Mo(ga,_c,Ko),jo(El,_c,Ko),jo(Al,zo,$a),No(qo[0],Cl,ga),No(qo[1],Al,El),No(qo[2],El,ga),No(qo[3],Cl,Al)}function Bo(qo,Ho,$a){for(let zo=0;zo<4;zo++)vo(qo[zo],Ho[zo],$a)}function xo(qo,Ho){const $a=no(),zo=no(),Ko=no();Fo(Ko,Ho[2]),No($a,Ho[0],Ko),No(zo,Ho[1],Ko),wo(qo,zo),qo[31]^=Ao($a)<<7}function uo(qo,Ho,$a){go(qo[0],oo),go(qo[1],ao),go(qo[2],ao),go(qo[3],oo);for(let zo=255;zo>=0;--zo){const Ko=$a[zo/8|0]>>(zo&7)&1;Bo(qo,Ho,Ko),Lo(Ho,qo),Lo(qo,qo),Bo(qo,Ho,Ko)}}function po(qo,Ho){const $a=[no(),no(),no(),no()];go($a[0],lo),go($a[1],fo),go($a[2],ao),No($a[3],lo,fo),uo(qo,$a,Ho)}function bo(qo){if(qo.length!==Xr.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Xr.SEED_LENGTH} bytes`);const Ho=(0,to.hash)(qo);Ho[0]&=248,Ho[31]&=127,Ho[31]|=64;const $a=new Uint8Array(32),zo=[no(),no(),no(),no()];po(zo,Ho),xo($a,zo);const Ko=new Uint8Array(64);return Ko.set(qo),Ko.set($a,32),{publicKey:$a,secretKey:Ko}}Xr.generateKeyPairFromSeed=bo;function _o(qo){const Ho=(0,eo.randomBytes)(32,qo),$a=bo(Ho);return(0,ro.wipe)(Ho),$a}Xr.generateKeyPair=_o;function $o(qo){if(qo.length!==Xr.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Xr.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(qo.subarray(32))}Xr.extractPublicKeyFromSecretKey=$o;const Co=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ro(qo,Ho){let $a,zo,Ko,_c;for(zo=63;zo>=32;--zo){for($a=0,Ko=zo-32,_c=zo-12;Ko<_c;++Ko)Ho[Ko]+=$a-16*Ho[zo]*Co[Ko-(zo-32)],$a=Math.floor((Ho[Ko]+128)/256),Ho[Ko]-=$a*256;Ho[Ko]+=$a,Ho[zo]=0}for($a=0,Ko=0;Ko<32;Ko++)Ho[Ko]+=$a-(Ho[31]>>4)*Co[Ko],$a=Ho[Ko]>>8,Ho[Ko]&=255;for(Ko=0;Ko<32;Ko++)Ho[Ko]-=$a*Co[Ko];for(zo=0;zo<32;zo++)Ho[zo+1]+=Ho[zo]>>8,qo[zo]=Ho[zo]&255}function So(qo){const Ho=new Float64Array(64);for(let $a=0;$a<64;$a++)Ho[$a]=qo[$a];for(let $a=0;$a<64;$a++)qo[$a]=0;Ro(qo,Ho)}function mo(qo,Ho){const $a=new Float64Array(64),zo=[no(),no(),no(),no()],Ko=(0,to.hash)(qo.subarray(0,32));Ko[0]&=248,Ko[31]&=127,Ko[31]|=64;const _c=new Uint8Array(64);_c.set(Ko.subarray(32),32);const Cl=new to.SHA512;Cl.update(_c.subarray(32)),Cl.update(Ho);const ga=Cl.digest();Cl.clean(),So(ga),po(zo,ga),xo(_c,zo),Cl.reset(),Cl.update(_c.subarray(0,32)),Cl.update(qo.subarray(32)),Cl.update(Ho);const El=Cl.digest();So(El);for(let Al=0;Al<32;Al++)$a[Al]=ga[Al];for(let Al=0;Al<32;Al++)for(let Ol=0;Ol<32;Ol++)$a[Al+Ol]+=El[Al]*Ko[Ol];return Ro(_c.subarray(32),$a),_c}Xr.sign=mo;function To(qo,Ho){const $a=no(),zo=no(),Ko=no(),_c=no(),Cl=no(),ga=no(),El=no();return go(qo[2],ao),Po(qo[1],Ho),Do(Ko,qo[1]),No(_c,Ko,so),Mo(Ko,Ko,qo[2]),jo(_c,qo[2],_c),Do(Cl,_c),Do(ga,Cl),No(El,ga,Cl),No($a,El,Ko),No($a,$a,_c),Xo($a,$a),No($a,$a,Ko),No($a,$a,_c),No($a,$a,_c),No(qo[0],$a,_c),Do(zo,qo[0]),No(zo,zo,_c),ko(zo,Ko)&&No(qo[0],qo[0],ho),Do(zo,qo[0]),No(zo,zo,_c),ko(zo,Ko)?-1:(Ao(qo[0])===Ho[31]>>7&&Mo(qo[0],oo,qo[0]),No(qo[3],qo[0],qo[1]),0)}function Vo(qo,Ho,$a){const zo=new Uint8Array(32),Ko=[no(),no(),no(),no()],_c=[no(),no(),no(),no()];if($a.length!==Xr.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Xr.SIGNATURE_LENGTH} bytes`);if(To(_c,qo))return!1;const Cl=new to.SHA512;Cl.update($a.subarray(0,32)),Cl.update(qo),Cl.update(Ho);const ga=Cl.digest();return So(ga),uo(Ko,_c,ga),po(_c,$a.subarray(32)),Lo(Ko,_c),xo(zo,Ko),!Eo($a,zo)}Xr.verify=Vo;function Zo(qo){let Ho=[no(),no(),no(),no()];if(To(Ho,qo))throw new Error("Ed25519: invalid public key");let $a=no(),zo=no(),Ko=Ho[1];jo($a,ao,Ko),Mo(zo,ao,Ko),Fo(zo,zo),No($a,$a,zo);let _c=new Uint8Array(32);return wo(_c,$a),_c}Xr.convertPublicKeyToX25519=Zo;function Qo(qo){const Ho=(0,to.hash)(qo.subarray(0,32));Ho[0]&=248,Ho[31]&=127,Ho[31]|=64;const $a=new Uint8Array(Ho.subarray(0,32));return(0,ro.wipe)(Ho),$a}Xr.convertSecretKeyToX25519=Qo})(ed25519$1);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function encodeJSON(Xr){return toString$2(fromString(safeJsonStringify(Xr),JSON_ENCODING),JWT_ENCODING)}function encodeIss(Xr){const eo=fromString(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),to=MULTICODEC_ED25519_BASE+toString$2(concat([eo,Xr]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,to].join(DID_DELIMITER)}function encodeSig(Xr){return toString$2(Xr,JWT_ENCODING)}function encodeData$2(Xr){return fromString([encodeJSON(Xr.header),encodeJSON(Xr.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(Xr){return[encodeJSON(Xr.header),encodeJSON(Xr.payload),encodeSig(Xr.signature)].join(JWT_DELIMITER)}function generateKeyPair$1(Xr=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519$1.generateKeyPairFromSeed(Xr)}async function signJWT(Xr,eo,to,ro,no=cjs$4.fromMiliseconds(Date.now())){const io={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},oo=encodeIss(ro.publicKey),ao=no+to,so={iss:oo,sub:Xr,aud:eo,iat:no,exp:ao},co=encodeData$2({header:io,payload:so}),lo=ed25519$1.sign(ro.secretKey,co);return encodeJWT({header:io,payload:so,signature:lo})}const PARSE_ERROR="PARSE_ERROR",INVALID_REQUEST="INVALID_REQUEST",METHOD_NOT_FOUND="METHOD_NOT_FOUND",INVALID_PARAMS="INVALID_PARAMS",INTERNAL_ERROR="INTERNAL_ERROR",SERVER_ERROR="SERVER_ERROR",RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],STANDARD_ERROR_MAP={[PARSE_ERROR]:{code:-32700,message:"Parse error"},[INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[SERVER_ERROR]:{code:-32e3,message:"Server error"}},DEFAULT_ERROR=SERVER_ERROR;function isReservedErrorCode(Xr){return RESERVED_ERROR_CODES.includes(Xr)}function getError(Xr){return Object.keys(STANDARD_ERROR_MAP).includes(Xr)?STANDARD_ERROR_MAP[Xr]:STANDARD_ERROR_MAP[DEFAULT_ERROR]}function getErrorByCode(Xr){const eo=Object.values(STANDARD_ERROR_MAP).find(to=>to.code===Xr);return eo||STANDARD_ERROR_MAP[DEFAULT_ERROR]}function parseConnectionError(Xr,eo,to){return Xr.message.includes("getaddrinfo ENOTFOUND")||Xr.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${to} RPC url at ${eo}`):Xr}var cjs={};/*! ***************************************************************************** +***************************************************************************** */var extendStatics$1=function(Xr,eo){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(to,ro){to.__proto__=ro}||function(to,ro){for(var no in ro)ro.hasOwnProperty(no)&&(to[no]=ro[no])},extendStatics$1(Xr,eo)};function __extends$1(Xr,eo){extendStatics$1(Xr,eo);function to(){this.constructor=Xr}Xr.prototype=eo===null?Object.create(eo):(to.prototype=eo.prototype,new to)}var __assign$1=function(){return __assign$1=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param$1(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata$1(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$8(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator$1(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$1(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread$1(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(bo){uo(io[0][3],bo)}}function so(ho){ho.value instanceof __await$1?Promise.resolve(ho.value.v).then(co,lo):uo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function uo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator$1(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await$1(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues$1(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values$1=="function"?__values$1(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject$1(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$2(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$6(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet$1(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet$1(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$1},__asyncDelegator:__asyncDelegator$1,__asyncGenerator:__asyncGenerator$1,__asyncValues:__asyncValues$1,__await:__await$1,__awaiter:__awaiter$8,__classPrivateFieldGet:__classPrivateFieldGet$1,__classPrivateFieldSet:__classPrivateFieldSet$1,__createBinding:__createBinding$2,__decorate:__decorate$2,__exportStar:__exportStar$1,__extends:__extends$1,__generator:__generator$1,__importDefault:__importDefault$6,__importStar:__importStar$2,__makeTemplateObject:__makeTemplateObject$1,__metadata:__metadata$1,__param:__param$1,__read:__read$1,__rest:__rest$4,__spread:__spread$1,__spreadArrays:__spreadArrays$1,__values:__values$1},Symbol.toStringTag,{value:"Module"})),require$$0$6=getAugmentedNamespace(tslib_es6$1);var heartbeat$2={},types={},heartbeat$1={};class IEvents{}const esm=Object.freeze(Object.defineProperty({__proto__:null,IEvents},Symbol.toStringTag,{value:"Module"})),require$$0$5=getAugmentedNamespace(esm);var hasRequiredHeartbeat$2;function requireHeartbeat$2(){if(hasRequiredHeartbeat$2)return heartbeat$1;hasRequiredHeartbeat$2=1,Object.defineProperty(heartbeat$1,"__esModule",{value:!0}),heartbeat$1.IHeartBeat=void 0;const Xr=require$$0$5;class eo extends Xr.IEvents{constructor(ro){super()}}return heartbeat$1.IHeartBeat=eo,heartbeat$1}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$2(),Xr)}(types)),types}var constants$6={},heartbeat={},hasRequiredHeartbeat$1;function requireHeartbeat$1(){if(hasRequiredHeartbeat$1)return heartbeat;hasRequiredHeartbeat$1=1,Object.defineProperty(heartbeat,"__esModule",{value:!0}),heartbeat.HEARTBEAT_EVENTS=heartbeat.HEARTBEAT_INTERVAL=void 0;const Xr=cjs$4;return heartbeat.HEARTBEAT_INTERVAL=Xr.FIVE_SECONDS,heartbeat.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},heartbeat}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$1(),Xr)}(constants$6)),constants$6}var hasRequiredHeartbeat;function requireHeartbeat(){if(hasRequiredHeartbeat)return heartbeat$2;hasRequiredHeartbeat=1,Object.defineProperty(heartbeat$2,"__esModule",{value:!0}),heartbeat$2.HeartBeat=void 0;const Xr=require$$0$6,eo=eventsExports,to=cjs$4,ro=requireTypes(),no=requireConstants();class io extends ro.IHeartBeat{constructor(ao){super(ao),this.events=new eo.EventEmitter,this.interval=no.HEARTBEAT_INTERVAL,this.interval=(ao==null?void 0:ao.interval)||no.HEARTBEAT_INTERVAL}static init(ao){return Xr.__awaiter(this,void 0,void 0,function*(){const so=new io(ao);return yield so.init(),so})}init(){return Xr.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(ao,so){this.events.on(ao,so)}once(ao,so){this.events.once(ao,so)}off(ao,so){this.events.off(ao,so)}removeListener(ao,so){this.events.removeListener(ao,so)}initialize(){return Xr.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),to.toMiliseconds(this.interval))})}pulse(){this.events.emit(no.HEARTBEAT_EVENTS.pulse)}}return heartbeat$2.HeartBeat=io,heartbeat$2}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$6;eo.__exportStar(requireHeartbeat(),Xr),eo.__exportStar(requireTypes(),Xr),eo.__exportStar(requireConstants(),Xr)})(cjs$1);function tryStringify(Xr){try{return JSON.stringify(Xr)}catch{return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(Xr,eo,to){var ro=to&&to.stringify||tryStringify,no=1;if(typeof Xr=="object"&&Xr!==null){var io=eo.length+no;if(io===1)return Xr;var oo=new Array(io);oo[0]=ro(Xr);for(var ao=1;ao-1?uo:0,Xr.charCodeAt(go+1)){case 100:case 102:if(lo>=so||eo[lo]==null)break;uo=so||eo[lo]==null)break;uo=so||eo[lo]===void 0)break;uo",uo=go+2,go++;break}co+=ro(eo[lo]),uo=go+2,go++;break;case 115:if(lo>=so)break;uo-1&&(io=!1);const oo=["error","fatal","warn","info","debug","trace"];typeof to=="function"&&(to.error=to.fatal=to.warn=to.info=to.debug=to.trace=to),Xr.enabled===!1&&(Xr.level="silent");const ao=Xr.level||"info",so=Object.create(to);so.log||(so.log=noop$5),Object.defineProperty(so,"levelVal",{get:lo}),Object.defineProperty(so,"level",{get:uo,set:ho});const co={transmit:eo,serialize:no,asObject:Xr.browser.asObject,levels:oo,timestamp:getTimeFunction(Xr)};so.levels=pino.levels,so.level=ao,so.setMaxListeners=so.getMaxListeners=so.emit=so.addListener=so.on=so.prependListener=so.once=so.prependOnceListener=so.removeListener=so.removeAllListeners=so.listeners=so.listenerCount=so.eventNames=so.write=so.flush=noop$5,so.serializers=ro,so._serialize=no,so._stdErrSerialize=io,so.child=go,eo&&(so._logEvent=createLogEventShape());function lo(){return this.level==="silent"?1/0:this.levels.values[this.level]}function uo(){return this._level}function ho(bo){if(bo!=="silent"&&!this.levels.values[bo])throw Error("unknown level "+bo);this._level=bo,set(co,so,"error","log"),set(co,so,"fatal","error"),set(co,so,"warn","error"),set(co,so,"info","log"),set(co,so,"debug","log"),set(co,so,"trace","log")}function go(bo,wo){if(!bo)throw new Error("missing bindings for child Pino");wo=wo||{},no&&bo.serializers&&(wo.serializers=bo.serializers);const Eo=wo.serializers;if(no&&Eo){var $o=Object.assign({},ro,Eo),Co=Xr.browser.serialize===!0?Object.keys($o):no;delete bo.serializers,applySerializers([bo],Co,$o,this._stdErrSerialize)}function Ro(Oo){this._childLevel=(Oo._childLevel|0)+1,this.error=bind(Oo,bo,"error"),this.fatal=bind(Oo,bo,"fatal"),this.warn=bind(Oo,bo,"warn"),this.info=bind(Oo,bo,"info"),this.debug=bind(Oo,bo,"debug"),this.trace=bind(Oo,bo,"trace"),$o&&(this.serializers=$o,this._serialize=Co),eo&&(this._logEvent=createLogEventShape([].concat(Oo._logEvent.bindings,bo)))}return Ro.prototype=this,new Ro(this)}return so}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pino.stdSerializers=stdSerializers;pino.stdTimeFunctions=Object.assign({},{nullTime,epochTime,unixTime,isoTime});function set(Xr,eo,to,ro){const no=Object.getPrototypeOf(eo);eo[to]=eo.levelVal>eo.levels.values[to]?noop$5:no[to]?no[to]:_console[to]||_console[ro]||noop$5,wrap(Xr,eo,to)}function wrap(Xr,eo,to){!Xr.transmit&&eo[to]===noop$5||(eo[to]=function(ro){return function(){const io=Xr.timestamp(),oo=new Array(arguments.length),ao=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var so=0;so-1&&io in to&&(Xr[no][io]=to[io](Xr[no][io]))}function bind(Xr,eo,to){return function(){const ro=new Array(1+arguments.length);ro[0]=eo;for(var no=1;noeo in Xr?x$4(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,i$4=(Xr,eo)=>{for(var to in eo||(eo={}))T$8.call(eo,to)&&f$9(Xr,to,eo[to]);if(p$6)for(var to of p$6(eo))z$6.call(eo,to)&&f$9(Xr,to,eo[to]);return Xr},g$a=(Xr,eo)=>S$6(Xr,_$7(eo));function k$2(Xr){return g$a(i$4({},Xr),{level:(Xr==null?void 0:Xr.level)||c$4.level})}function v$7(Xr,eo=n$4){return Xr[eo]||""}function b$7(Xr,eo,to=n$4){return Xr[to]=eo,Xr}function y$9(Xr,eo=n$4){let to="";return typeof Xr.bindings>"u"?to=v$7(Xr,eo):to=Xr.bindings().context||"",to}function w$8(Xr,eo,to=n$4){const ro=y$9(Xr,to);return ro.trim()?`${ro}/${eo}`:eo}function E$6(Xr,eo,to=n$4){const ro=w$8(Xr,eo,to),no=Xr.child({context:ro});return b$7(no,ro,to)}let n$3=class extends IEvents{constructor(eo){super(),this.opts=eo,this.protocol="wc",this.version=2}},h$6=class extends IEvents{constructor(eo,to){super(),this.core=eo,this.logger=to,this.records=new Map}},a$5=class{constructor(eo,to){this.logger=eo,this.core=to}},u$5=class extends IEvents{constructor(eo,to){super(),this.relayer=eo,this.logger=to}},g$9=class extends IEvents{constructor(eo){super()}},p$5=class{constructor(eo,to,ro,no){this.core=eo,this.logger=to,this.name=ro}},d$7=class extends IEvents{constructor(eo,to){super(),this.relayer=eo,this.logger=to}},E$5=class extends IEvents{constructor(eo,to){super(),this.core=eo,this.logger=to}},y$8=class{constructor(eo,to){this.projectId=eo,this.logger=to}},v$6=class{constructor(eo,to){this.projectId=eo,this.logger=to}},b$6=class{constructor(eo){this.opts=eo,this.protocol="wc",this.version=2}},w$7=class{constructor(eo){this.client=eo}};var ed25519$1={},sha512={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});var eo=binary,to=wipe$1;Xr.DIGEST_LENGTH=64,Xr.BLOCK_SIZE=128;var ro=function(){function ao(){this.digestLength=Xr.DIGEST_LENGTH,this.blockSize=Xr.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return ao.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},ao.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},ao.prototype.clean=function(){to.wipe(this._buffer),to.wipe(this._tempHi),to.wipe(this._tempLo),this.reset()},ao.prototype.update=function(so,co){if(co===void 0&&(co=so.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var lo=0;if(this._bytesHashed+=co,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=so[lo++],co--;this._bufferLength===this.blockSize&&(io(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(co>=this.blockSize&&(lo=io(this._tempHi,this._tempLo,this._stateHi,this._stateLo,so,lo,co),co%=this.blockSize);co>0;)this._buffer[this._bufferLength++]=so[lo++],co--;return this},ao.prototype.finish=function(so){if(!this._finished){var co=this._bytesHashed,lo=this._bufferLength,uo=co/536870912|0,ho=co<<3,go=co%128<112?128:256;this._buffer[lo]=128;for(var bo=lo+1;bo0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},ao.prototype.restoreState=function(so){return this._stateHi.set(so.stateHi),this._stateLo.set(so.stateLo),this._bufferLength=so.bufferLength,so.buffer&&this._buffer.set(so.buffer),this._bytesHashed=so.bytesHashed,this._finished=!1,this},ao.prototype.cleanSavedState=function(so){to.wipe(so.stateHi),to.wipe(so.stateLo),so.buffer&&to.wipe(so.buffer),so.bufferLength=0,so.bytesHashed=0},ao}();Xr.SHA512=ro;var no=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function io(ao,so,co,lo,uo,ho,go){for(var bo=co[0],wo=co[1],Eo=co[2],$o=co[3],Co=co[4],Ro=co[5],Oo=co[6],jo=co[7],Bo=lo[0],Mo=lo[1],Fo=lo[2],Wo=lo[3],Jo=lo[4],Po=lo[5],fo=lo[6],yo=lo[7],vo,_o,So,To,Ao,ko,mo,Io;go>=128;){for(var Do=0;Do<16;Do++){var Lo=8*Do+ho;ao[Do]=eo.readUint32BE(uo,Lo),so[Do]=eo.readUint32BE(uo,Lo+4)}for(var Do=0;Do<80;Do++){var Ho=bo,Yo=wo,Xo=Eo,qo=$o,Ko=Co,Qo=Ro,zo=Oo,ga=jo,$a=Bo,Sl=Mo,El=Fo,Tl=Wo,Il=Jo,Zl=Po,Vl=fo,Ol=yo;if(vo=jo,_o=yo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=(Co>>>14|Jo<<18)^(Co>>>18|Jo<<14)^(Jo>>>9|Co<<23),_o=(Jo>>>14|Co<<18)^(Jo>>>18|Co<<14)^(Co>>>9|Jo<<23),Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,vo=Co&Ro^~Co&Oo,_o=Jo&Po^~Jo&fo,Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,vo=no[Do*2],_o=no[Do*2+1],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,vo=ao[Do%16],_o=so[Do%16],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,So=mo&65535|Io<<16,To=Ao&65535|ko<<16,vo=So,_o=To,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=(bo>>>28|Bo<<4)^(Bo>>>2|bo<<30)^(Bo>>>7|bo<<25),_o=(Bo>>>28|bo<<4)^(bo>>>2|Bo<<30)^(bo>>>7|Bo<<25),Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,vo=bo&wo^bo&Eo^wo&Eo,_o=Bo&Mo^Bo&Fo^Mo&Fo,Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,ga=mo&65535|Io<<16,Ol=Ao&65535|ko<<16,vo=qo,_o=Tl,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=So,_o=To,Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,qo=mo&65535|Io<<16,Tl=Ao&65535|ko<<16,wo=Ho,Eo=Yo,$o=Xo,Co=qo,Ro=Ko,Oo=Qo,jo=zo,bo=ga,Mo=$a,Fo=Sl,Wo=El,Jo=Tl,Po=Il,fo=Zl,yo=Vl,Bo=Ol,Do%16===15)for(var Lo=0;Lo<16;Lo++)vo=ao[Lo],_o=so[Lo],Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=ao[(Lo+9)%16],_o=so[(Lo+9)%16],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,So=ao[(Lo+1)%16],To=so[(Lo+1)%16],vo=(So>>>1|To<<31)^(So>>>8|To<<24)^So>>>7,_o=(To>>>1|So<<31)^(To>>>8|So<<24)^(To>>>7|So<<25),Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,So=ao[(Lo+14)%16],To=so[(Lo+14)%16],vo=(So>>>19|To<<13)^(To>>>29|So<<3)^So>>>6,_o=(To>>>19|So<<13)^(So>>>29|To<<3)^(To>>>6|So<<26),Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,ao[Lo]=mo&65535|Io<<16,so[Lo]=Ao&65535|ko<<16}vo=bo,_o=Bo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[0],_o=lo[0],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[0]=bo=mo&65535|Io<<16,lo[0]=Bo=Ao&65535|ko<<16,vo=wo,_o=Mo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[1],_o=lo[1],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[1]=wo=mo&65535|Io<<16,lo[1]=Mo=Ao&65535|ko<<16,vo=Eo,_o=Fo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[2],_o=lo[2],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[2]=Eo=mo&65535|Io<<16,lo[2]=Fo=Ao&65535|ko<<16,vo=$o,_o=Wo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[3],_o=lo[3],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[3]=$o=mo&65535|Io<<16,lo[3]=Wo=Ao&65535|ko<<16,vo=Co,_o=Jo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[4],_o=lo[4],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[4]=Co=mo&65535|Io<<16,lo[4]=Jo=Ao&65535|ko<<16,vo=Ro,_o=Po,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[5],_o=lo[5],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[5]=Ro=mo&65535|Io<<16,lo[5]=Po=Ao&65535|ko<<16,vo=Oo,_o=fo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[6],_o=lo[6],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[6]=Oo=mo&65535|Io<<16,lo[6]=fo=Ao&65535|ko<<16,vo=jo,_o=yo,Ao=_o&65535,ko=_o>>>16,mo=vo&65535,Io=vo>>>16,vo=co[7],_o=lo[7],Ao+=_o&65535,ko+=_o>>>16,mo+=vo&65535,Io+=vo>>>16,ko+=Ao>>>16,mo+=ko>>>16,Io+=mo>>>16,co[7]=jo=mo&65535|Io<<16,lo[7]=yo=Ao&65535|ko<<16,ho+=128,go-=128}return ho}function oo(ao){var so=new ro;so.update(ao);var co=so.digest();return so.clean(),co}Xr.hash=oo})(sha512);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.convertSecretKeyToX25519=Xr.convertPublicKeyToX25519=Xr.verify=Xr.sign=Xr.extractPublicKeyFromSecretKey=Xr.generateKeyPair=Xr.generateKeyPairFromSeed=Xr.SEED_LENGTH=Xr.SECRET_KEY_LENGTH=Xr.PUBLIC_KEY_LENGTH=Xr.SIGNATURE_LENGTH=void 0;const eo=random,to=sha512,ro=wipe$1;Xr.SIGNATURE_LENGTH=64,Xr.PUBLIC_KEY_LENGTH=32,Xr.SECRET_KEY_LENGTH=64,Xr.SEED_LENGTH=32;function no(qo){const Ko=new Float64Array(16);if(qo)for(let Qo=0;Qo>16&1),Qo[Sl-1]&=65535;Qo[15]=zo[15]-32767-(Qo[14]>>16&1);const $a=Qo[15]>>16&1;Qo[14]&=65535,wo(zo,Qo,1-$a)}for(let ga=0;ga<16;ga++)qo[2*ga]=zo[ga]&255,qo[2*ga+1]=zo[ga]>>8}function $o(qo,Ko){let Qo=0;for(let zo=0;zo<32;zo++)Qo|=qo[zo]^Ko[zo];return(1&Qo-1>>>8)-1}function Co(qo,Ko){const Qo=new Uint8Array(32),zo=new Uint8Array(32);return Eo(Qo,qo),Eo(zo,Ko),$o(Qo,zo)}function Ro(qo){const Ko=new Uint8Array(32);return Eo(Ko,qo),Ko[0]&1}function Oo(qo,Ko){for(let Qo=0;Qo<16;Qo++)qo[Qo]=Ko[2*Qo]+(Ko[2*Qo+1]<<8);qo[15]&=32767}function jo(qo,Ko,Qo){for(let zo=0;zo<16;zo++)qo[zo]=Ko[zo]+Qo[zo]}function Bo(qo,Ko,Qo){for(let zo=0;zo<16;zo++)qo[zo]=Ko[zo]-Qo[zo]}function Mo(qo,Ko,Qo){let zo,ga,$a=0,Sl=0,El=0,Tl=0,Il=0,Zl=0,Vl=0,Ol=0,Dl=0,Fl=0,Jl=0,cu=0,Ll=0,Xl=0,ku=0,iu=0,hu=0,Cu=0,_l=0,Go=0,yl=0,Al=0,Ul=0,su=0,Ql=0,vu=0,qu=0,pu=0,xu=0,Au=0,yu=0,wu=Qo[0],Gu=Qo[1],Ml=Qo[2],Nl=Qo[3],Yl=Qo[4],Wl=Qo[5],eu=Qo[6],Su=Qo[7],ru=Qo[8],uu=Qo[9],xl=Qo[10],$l=Qo[11],Cl=Qo[12],Zo=Qo[13],Rl=Qo[14],Hl=Qo[15];zo=Ko[0],$a+=zo*wu,Sl+=zo*Gu,El+=zo*Ml,Tl+=zo*Nl,Il+=zo*Yl,Zl+=zo*Wl,Vl+=zo*eu,Ol+=zo*Su,Dl+=zo*ru,Fl+=zo*uu,Jl+=zo*xl,cu+=zo*$l,Ll+=zo*Cl,Xl+=zo*Zo,ku+=zo*Rl,iu+=zo*Hl,zo=Ko[1],Sl+=zo*wu,El+=zo*Gu,Tl+=zo*Ml,Il+=zo*Nl,Zl+=zo*Yl,Vl+=zo*Wl,Ol+=zo*eu,Dl+=zo*Su,Fl+=zo*ru,Jl+=zo*uu,cu+=zo*xl,Ll+=zo*$l,Xl+=zo*Cl,ku+=zo*Zo,iu+=zo*Rl,hu+=zo*Hl,zo=Ko[2],El+=zo*wu,Tl+=zo*Gu,Il+=zo*Ml,Zl+=zo*Nl,Vl+=zo*Yl,Ol+=zo*Wl,Dl+=zo*eu,Fl+=zo*Su,Jl+=zo*ru,cu+=zo*uu,Ll+=zo*xl,Xl+=zo*$l,ku+=zo*Cl,iu+=zo*Zo,hu+=zo*Rl,Cu+=zo*Hl,zo=Ko[3],Tl+=zo*wu,Il+=zo*Gu,Zl+=zo*Ml,Vl+=zo*Nl,Ol+=zo*Yl,Dl+=zo*Wl,Fl+=zo*eu,Jl+=zo*Su,cu+=zo*ru,Ll+=zo*uu,Xl+=zo*xl,ku+=zo*$l,iu+=zo*Cl,hu+=zo*Zo,Cu+=zo*Rl,_l+=zo*Hl,zo=Ko[4],Il+=zo*wu,Zl+=zo*Gu,Vl+=zo*Ml,Ol+=zo*Nl,Dl+=zo*Yl,Fl+=zo*Wl,Jl+=zo*eu,cu+=zo*Su,Ll+=zo*ru,Xl+=zo*uu,ku+=zo*xl,iu+=zo*$l,hu+=zo*Cl,Cu+=zo*Zo,_l+=zo*Rl,Go+=zo*Hl,zo=Ko[5],Zl+=zo*wu,Vl+=zo*Gu,Ol+=zo*Ml,Dl+=zo*Nl,Fl+=zo*Yl,Jl+=zo*Wl,cu+=zo*eu,Ll+=zo*Su,Xl+=zo*ru,ku+=zo*uu,iu+=zo*xl,hu+=zo*$l,Cu+=zo*Cl,_l+=zo*Zo,Go+=zo*Rl,yl+=zo*Hl,zo=Ko[6],Vl+=zo*wu,Ol+=zo*Gu,Dl+=zo*Ml,Fl+=zo*Nl,Jl+=zo*Yl,cu+=zo*Wl,Ll+=zo*eu,Xl+=zo*Su,ku+=zo*ru,iu+=zo*uu,hu+=zo*xl,Cu+=zo*$l,_l+=zo*Cl,Go+=zo*Zo,yl+=zo*Rl,Al+=zo*Hl,zo=Ko[7],Ol+=zo*wu,Dl+=zo*Gu,Fl+=zo*Ml,Jl+=zo*Nl,cu+=zo*Yl,Ll+=zo*Wl,Xl+=zo*eu,ku+=zo*Su,iu+=zo*ru,hu+=zo*uu,Cu+=zo*xl,_l+=zo*$l,Go+=zo*Cl,yl+=zo*Zo,Al+=zo*Rl,Ul+=zo*Hl,zo=Ko[8],Dl+=zo*wu,Fl+=zo*Gu,Jl+=zo*Ml,cu+=zo*Nl,Ll+=zo*Yl,Xl+=zo*Wl,ku+=zo*eu,iu+=zo*Su,hu+=zo*ru,Cu+=zo*uu,_l+=zo*xl,Go+=zo*$l,yl+=zo*Cl,Al+=zo*Zo,Ul+=zo*Rl,su+=zo*Hl,zo=Ko[9],Fl+=zo*wu,Jl+=zo*Gu,cu+=zo*Ml,Ll+=zo*Nl,Xl+=zo*Yl,ku+=zo*Wl,iu+=zo*eu,hu+=zo*Su,Cu+=zo*ru,_l+=zo*uu,Go+=zo*xl,yl+=zo*$l,Al+=zo*Cl,Ul+=zo*Zo,su+=zo*Rl,Ql+=zo*Hl,zo=Ko[10],Jl+=zo*wu,cu+=zo*Gu,Ll+=zo*Ml,Xl+=zo*Nl,ku+=zo*Yl,iu+=zo*Wl,hu+=zo*eu,Cu+=zo*Su,_l+=zo*ru,Go+=zo*uu,yl+=zo*xl,Al+=zo*$l,Ul+=zo*Cl,su+=zo*Zo,Ql+=zo*Rl,vu+=zo*Hl,zo=Ko[11],cu+=zo*wu,Ll+=zo*Gu,Xl+=zo*Ml,ku+=zo*Nl,iu+=zo*Yl,hu+=zo*Wl,Cu+=zo*eu,_l+=zo*Su,Go+=zo*ru,yl+=zo*uu,Al+=zo*xl,Ul+=zo*$l,su+=zo*Cl,Ql+=zo*Zo,vu+=zo*Rl,qu+=zo*Hl,zo=Ko[12],Ll+=zo*wu,Xl+=zo*Gu,ku+=zo*Ml,iu+=zo*Nl,hu+=zo*Yl,Cu+=zo*Wl,_l+=zo*eu,Go+=zo*Su,yl+=zo*ru,Al+=zo*uu,Ul+=zo*xl,su+=zo*$l,Ql+=zo*Cl,vu+=zo*Zo,qu+=zo*Rl,pu+=zo*Hl,zo=Ko[13],Xl+=zo*wu,ku+=zo*Gu,iu+=zo*Ml,hu+=zo*Nl,Cu+=zo*Yl,_l+=zo*Wl,Go+=zo*eu,yl+=zo*Su,Al+=zo*ru,Ul+=zo*uu,su+=zo*xl,Ql+=zo*$l,vu+=zo*Cl,qu+=zo*Zo,pu+=zo*Rl,xu+=zo*Hl,zo=Ko[14],ku+=zo*wu,iu+=zo*Gu,hu+=zo*Ml,Cu+=zo*Nl,_l+=zo*Yl,Go+=zo*Wl,yl+=zo*eu,Al+=zo*Su,Ul+=zo*ru,su+=zo*uu,Ql+=zo*xl,vu+=zo*$l,qu+=zo*Cl,pu+=zo*Zo,xu+=zo*Rl,Au+=zo*Hl,zo=Ko[15],iu+=zo*wu,hu+=zo*Gu,Cu+=zo*Ml,_l+=zo*Nl,Go+=zo*Yl,yl+=zo*Wl,Al+=zo*eu,Ul+=zo*Su,su+=zo*ru,Ql+=zo*uu,vu+=zo*xl,qu+=zo*$l,pu+=zo*Cl,xu+=zo*Zo,Au+=zo*Rl,yu+=zo*Hl,$a+=38*hu,Sl+=38*Cu,El+=38*_l,Tl+=38*Go,Il+=38*yl,Zl+=38*Al,Vl+=38*Ul,Ol+=38*su,Dl+=38*Ql,Fl+=38*vu,Jl+=38*qu,cu+=38*pu,Ll+=38*xu,Xl+=38*Au,ku+=38*yu,ga=1,zo=$a+ga+65535,ga=Math.floor(zo/65536),$a=zo-ga*65536,zo=Sl+ga+65535,ga=Math.floor(zo/65536),Sl=zo-ga*65536,zo=El+ga+65535,ga=Math.floor(zo/65536),El=zo-ga*65536,zo=Tl+ga+65535,ga=Math.floor(zo/65536),Tl=zo-ga*65536,zo=Il+ga+65535,ga=Math.floor(zo/65536),Il=zo-ga*65536,zo=Zl+ga+65535,ga=Math.floor(zo/65536),Zl=zo-ga*65536,zo=Vl+ga+65535,ga=Math.floor(zo/65536),Vl=zo-ga*65536,zo=Ol+ga+65535,ga=Math.floor(zo/65536),Ol=zo-ga*65536,zo=Dl+ga+65535,ga=Math.floor(zo/65536),Dl=zo-ga*65536,zo=Fl+ga+65535,ga=Math.floor(zo/65536),Fl=zo-ga*65536,zo=Jl+ga+65535,ga=Math.floor(zo/65536),Jl=zo-ga*65536,zo=cu+ga+65535,ga=Math.floor(zo/65536),cu=zo-ga*65536,zo=Ll+ga+65535,ga=Math.floor(zo/65536),Ll=zo-ga*65536,zo=Xl+ga+65535,ga=Math.floor(zo/65536),Xl=zo-ga*65536,zo=ku+ga+65535,ga=Math.floor(zo/65536),ku=zo-ga*65536,zo=iu+ga+65535,ga=Math.floor(zo/65536),iu=zo-ga*65536,$a+=ga-1+37*(ga-1),ga=1,zo=$a+ga+65535,ga=Math.floor(zo/65536),$a=zo-ga*65536,zo=Sl+ga+65535,ga=Math.floor(zo/65536),Sl=zo-ga*65536,zo=El+ga+65535,ga=Math.floor(zo/65536),El=zo-ga*65536,zo=Tl+ga+65535,ga=Math.floor(zo/65536),Tl=zo-ga*65536,zo=Il+ga+65535,ga=Math.floor(zo/65536),Il=zo-ga*65536,zo=Zl+ga+65535,ga=Math.floor(zo/65536),Zl=zo-ga*65536,zo=Vl+ga+65535,ga=Math.floor(zo/65536),Vl=zo-ga*65536,zo=Ol+ga+65535,ga=Math.floor(zo/65536),Ol=zo-ga*65536,zo=Dl+ga+65535,ga=Math.floor(zo/65536),Dl=zo-ga*65536,zo=Fl+ga+65535,ga=Math.floor(zo/65536),Fl=zo-ga*65536,zo=Jl+ga+65535,ga=Math.floor(zo/65536),Jl=zo-ga*65536,zo=cu+ga+65535,ga=Math.floor(zo/65536),cu=zo-ga*65536,zo=Ll+ga+65535,ga=Math.floor(zo/65536),Ll=zo-ga*65536,zo=Xl+ga+65535,ga=Math.floor(zo/65536),Xl=zo-ga*65536,zo=ku+ga+65535,ga=Math.floor(zo/65536),ku=zo-ga*65536,zo=iu+ga+65535,ga=Math.floor(zo/65536),iu=zo-ga*65536,$a+=ga-1+37*(ga-1),qo[0]=$a,qo[1]=Sl,qo[2]=El,qo[3]=Tl,qo[4]=Il,qo[5]=Zl,qo[6]=Vl,qo[7]=Ol,qo[8]=Dl,qo[9]=Fl,qo[10]=Jl,qo[11]=cu,qo[12]=Ll,qo[13]=Xl,qo[14]=ku,qo[15]=iu}function Fo(qo,Ko){Mo(qo,Ko,Ko)}function Wo(qo,Ko){const Qo=no();let zo;for(zo=0;zo<16;zo++)Qo[zo]=Ko[zo];for(zo=253;zo>=0;zo--)Fo(Qo,Qo),zo!==2&&zo!==4&&Mo(Qo,Qo,Ko);for(zo=0;zo<16;zo++)qo[zo]=Qo[zo]}function Jo(qo,Ko){const Qo=no();let zo;for(zo=0;zo<16;zo++)Qo[zo]=Ko[zo];for(zo=250;zo>=0;zo--)Fo(Qo,Qo),zo!==1&&Mo(Qo,Qo,Ko);for(zo=0;zo<16;zo++)qo[zo]=Qo[zo]}function Po(qo,Ko){const Qo=no(),zo=no(),ga=no(),$a=no(),Sl=no(),El=no(),Tl=no(),Il=no(),Zl=no();Bo(Qo,qo[1],qo[0]),Bo(Zl,Ko[1],Ko[0]),Mo(Qo,Qo,Zl),jo(zo,qo[0],qo[1]),jo(Zl,Ko[0],Ko[1]),Mo(zo,zo,Zl),Mo(ga,qo[3],Ko[3]),Mo(ga,ga,co),Mo($a,qo[2],Ko[2]),jo($a,$a,$a),Bo(Sl,zo,Qo),Bo(El,$a,ga),jo(Tl,$a,ga),jo(Il,zo,Qo),Mo(qo[0],Sl,El),Mo(qo[1],Il,Tl),Mo(qo[2],Tl,El),Mo(qo[3],Sl,Il)}function fo(qo,Ko,Qo){for(let zo=0;zo<4;zo++)wo(qo[zo],Ko[zo],Qo)}function yo(qo,Ko){const Qo=no(),zo=no(),ga=no();Wo(ga,Ko[2]),Mo(Qo,Ko[0],ga),Mo(zo,Ko[1],ga),Eo(qo,zo),qo[31]^=Ro(Qo)<<7}function vo(qo,Ko,Qo){go(qo[0],oo),go(qo[1],ao),go(qo[2],ao),go(qo[3],oo);for(let zo=255;zo>=0;--zo){const ga=Qo[zo/8|0]>>(zo&7)&1;fo(qo,Ko,ga),Po(Ko,qo),Po(qo,qo),fo(qo,Ko,ga)}}function _o(qo,Ko){const Qo=[no(),no(),no(),no()];go(Qo[0],lo),go(Qo[1],uo),go(Qo[2],ao),Mo(Qo[3],lo,uo),vo(qo,Qo,Ko)}function So(qo){if(qo.length!==Xr.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Xr.SEED_LENGTH} bytes`);const Ko=(0,to.hash)(qo);Ko[0]&=248,Ko[31]&=127,Ko[31]|=64;const Qo=new Uint8Array(32),zo=[no(),no(),no(),no()];_o(zo,Ko),yo(Qo,zo);const ga=new Uint8Array(64);return ga.set(qo),ga.set(Qo,32),{publicKey:Qo,secretKey:ga}}Xr.generateKeyPairFromSeed=So;function To(qo){const Ko=(0,eo.randomBytes)(32,qo),Qo=So(Ko);return(0,ro.wipe)(Ko),Qo}Xr.generateKeyPair=To;function Ao(qo){if(qo.length!==Xr.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Xr.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(qo.subarray(32))}Xr.extractPublicKeyFromSecretKey=Ao;const ko=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function mo(qo,Ko){let Qo,zo,ga,$a;for(zo=63;zo>=32;--zo){for(Qo=0,ga=zo-32,$a=zo-12;ga<$a;++ga)Ko[ga]+=Qo-16*Ko[zo]*ko[ga-(zo-32)],Qo=Math.floor((Ko[ga]+128)/256),Ko[ga]-=Qo*256;Ko[ga]+=Qo,Ko[zo]=0}for(Qo=0,ga=0;ga<32;ga++)Ko[ga]+=Qo-(Ko[31]>>4)*ko[ga],Qo=Ko[ga]>>8,Ko[ga]&=255;for(ga=0;ga<32;ga++)Ko[ga]-=Qo*ko[ga];for(zo=0;zo<32;zo++)Ko[zo+1]+=Ko[zo]>>8,qo[zo]=Ko[zo]&255}function Io(qo){const Ko=new Float64Array(64);for(let Qo=0;Qo<64;Qo++)Ko[Qo]=qo[Qo];for(let Qo=0;Qo<64;Qo++)qo[Qo]=0;mo(qo,Ko)}function Do(qo,Ko){const Qo=new Float64Array(64),zo=[no(),no(),no(),no()],ga=(0,to.hash)(qo.subarray(0,32));ga[0]&=248,ga[31]&=127,ga[31]|=64;const $a=new Uint8Array(64);$a.set(ga.subarray(32),32);const Sl=new to.SHA512;Sl.update($a.subarray(32)),Sl.update(Ko);const El=Sl.digest();Sl.clean(),Io(El),_o(zo,El),yo($a,zo),Sl.reset(),Sl.update($a.subarray(0,32)),Sl.update(qo.subarray(32)),Sl.update(Ko);const Tl=Sl.digest();Io(Tl);for(let Il=0;Il<32;Il++)Qo[Il]=El[Il];for(let Il=0;Il<32;Il++)for(let Zl=0;Zl<32;Zl++)Qo[Il+Zl]+=Tl[Il]*ga[Zl];return mo($a.subarray(32),Qo),$a}Xr.sign=Do;function Lo(qo,Ko){const Qo=no(),zo=no(),ga=no(),$a=no(),Sl=no(),El=no(),Tl=no();return go(qo[2],ao),Oo(qo[1],Ko),Fo(ga,qo[1]),Mo($a,ga,so),Bo(ga,ga,qo[2]),jo($a,qo[2],$a),Fo(Sl,$a),Fo(El,Sl),Mo(Tl,El,Sl),Mo(Qo,Tl,ga),Mo(Qo,Qo,$a),Jo(Qo,Qo),Mo(Qo,Qo,ga),Mo(Qo,Qo,$a),Mo(Qo,Qo,$a),Mo(qo[0],Qo,$a),Fo(zo,qo[0]),Mo(zo,zo,$a),Co(zo,ga)&&Mo(qo[0],qo[0],ho),Fo(zo,qo[0]),Mo(zo,zo,$a),Co(zo,ga)?-1:(Ro(qo[0])===Ko[31]>>7&&Bo(qo[0],oo,qo[0]),Mo(qo[3],qo[0],qo[1]),0)}function Ho(qo,Ko,Qo){const zo=new Uint8Array(32),ga=[no(),no(),no(),no()],$a=[no(),no(),no(),no()];if(Qo.length!==Xr.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Xr.SIGNATURE_LENGTH} bytes`);if(Lo($a,qo))return!1;const Sl=new to.SHA512;Sl.update(Qo.subarray(0,32)),Sl.update(qo),Sl.update(Ko);const El=Sl.digest();return Io(El),vo(ga,$a,El),_o($a,Qo.subarray(32)),Po(ga,$a),yo(zo,ga),!$o(Qo,zo)}Xr.verify=Ho;function Yo(qo){let Ko=[no(),no(),no(),no()];if(Lo(Ko,qo))throw new Error("Ed25519: invalid public key");let Qo=no(),zo=no(),ga=Ko[1];jo(Qo,ao,ga),Bo(zo,ao,ga),Wo(zo,zo),Mo(Qo,Qo,zo);let $a=new Uint8Array(32);return Eo($a,Qo),$a}Xr.convertPublicKeyToX25519=Yo;function Xo(qo){const Ko=(0,to.hash)(qo.subarray(0,32));Ko[0]&=248,Ko[31]&=127,Ko[31]|=64;const Qo=new Uint8Array(Ko.subarray(0,32));return(0,ro.wipe)(Ko),Qo}Xr.convertSecretKeyToX25519=Xo})(ed25519$1);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function encodeJSON(Xr){return toString$2(fromString(safeJsonStringify(Xr),JSON_ENCODING),JWT_ENCODING)}function encodeIss(Xr){const eo=fromString(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),to=MULTICODEC_ED25519_BASE+toString$2(concat([eo,Xr]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,to].join(DID_DELIMITER)}function encodeSig(Xr){return toString$2(Xr,JWT_ENCODING)}function encodeData$2(Xr){return fromString([encodeJSON(Xr.header),encodeJSON(Xr.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(Xr){return[encodeJSON(Xr.header),encodeJSON(Xr.payload),encodeSig(Xr.signature)].join(JWT_DELIMITER)}function generateKeyPair$1(Xr=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519$1.generateKeyPairFromSeed(Xr)}async function signJWT(Xr,eo,to,ro,no=cjs$4.fromMiliseconds(Date.now())){const io={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},oo=encodeIss(ro.publicKey),ao=no+to,so={iss:oo,sub:Xr,aud:eo,iat:no,exp:ao},co=encodeData$2({header:io,payload:so}),lo=ed25519$1.sign(ro.secretKey,co);return encodeJWT({header:io,payload:so,signature:lo})}const PARSE_ERROR="PARSE_ERROR",INVALID_REQUEST="INVALID_REQUEST",METHOD_NOT_FOUND="METHOD_NOT_FOUND",INVALID_PARAMS="INVALID_PARAMS",INTERNAL_ERROR="INTERNAL_ERROR",SERVER_ERROR="SERVER_ERROR",RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],STANDARD_ERROR_MAP={[PARSE_ERROR]:{code:-32700,message:"Parse error"},[INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[SERVER_ERROR]:{code:-32e3,message:"Server error"}},DEFAULT_ERROR=SERVER_ERROR;function isReservedErrorCode(Xr){return RESERVED_ERROR_CODES.includes(Xr)}function getError(Xr){return Object.keys(STANDARD_ERROR_MAP).includes(Xr)?STANDARD_ERROR_MAP[Xr]:STANDARD_ERROR_MAP[DEFAULT_ERROR]}function getErrorByCode(Xr){const eo=Object.values(STANDARD_ERROR_MAP).find(to=>to.code===Xr);return eo||STANDARD_ERROR_MAP[DEFAULT_ERROR]}function parseConnectionError(Xr,eo,to){return Xr.message.includes("getaddrinfo ENOTFOUND")||Xr.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${to} RPC url at ${eo}`):Xr}var cjs={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -2297,33 +4127,33 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics=function(Xr,eo){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(to,ro){to.__proto__=ro}||function(to,ro){for(var no in ro)ro.hasOwnProperty(no)&&(to[no]=ro[no])},extendStatics(Xr,eo)};function __extends(Xr,eo){extendStatics(Xr,eo);function to(){this.constructor=Xr}Xr.prototype=eo===null?Object.create(eo):(to.prototype=eo.prototype,new to)}var __assign=function(){return __assign=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$7(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(yo){fo(io[0][3],yo)}}function so(ho){ho.value instanceof __await?Promise.resolve(ho.value.v).then(co,lo):fo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function fo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values=="function"?__values(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$1(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$5(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter:__awaiter$7,__classPrivateFieldGet,__classPrivateFieldSet,__createBinding:__createBinding$1,__decorate:__decorate$1,__exportStar,__extends,__generator,__importDefault:__importDefault$5,__importStar:__importStar$1,__makeTemplateObject,__metadata,__param,__read,__rest:__rest$3,__spread,__spreadArrays,__values},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var crypto$2={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$2;hasRequiredCrypto=1,Object.defineProperty(crypto$2,"__esModule",{value:!0}),crypto$2.isBrowserCryptoAvailable=crypto$2.getSubtleCrypto=crypto$2.getBrowerCrypto=void 0;function Xr(){return(commonjsGlobal==null?void 0:commonjsGlobal.crypto)||(commonjsGlobal==null?void 0:commonjsGlobal.msCrypto)||{}}crypto$2.getBrowerCrypto=Xr;function eo(){const ro=Xr();return ro.subtle||ro.webkitSubtle}crypto$2.getSubtleCrypto=eo;function to(){return!!Xr()&&!!eo()}return crypto$2.isBrowserCryptoAvailable=to,crypto$2}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0;function Xr(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}env.isReactNative=Xr;function eo(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}env.isNode=eo;function to(){return!Xr()&&!eo()}return env.isBrowser=to,env}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$4;eo.__exportStar(requireCrypto(),Xr),eo.__exportStar(requireEnv(),Xr)})(cjs);function payloadId(Xr=3){const eo=Date.now()*Math.pow(10,Xr),to=Math.floor(Math.random()*Math.pow(10,Xr));return eo+to}function getBigIntRpcId(Xr=6){return BigInt(payloadId(Xr))}function formatJsonRpcRequest(Xr,eo,to){return{id:to||payloadId(),jsonrpc:"2.0",method:Xr,params:eo}}function formatJsonRpcResult(Xr,eo){return{id:Xr,jsonrpc:"2.0",result:eo}}function formatJsonRpcError(Xr,eo,to){return{id:Xr,jsonrpc:"2.0",error:formatErrorMessage(eo)}}function formatErrorMessage(Xr,eo){return typeof Xr>"u"?getError(INTERNAL_ERROR):(typeof Xr=="string"&&(Xr=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:Xr})),isReservedErrorCode(Xr.code)&&(Xr=getErrorByCode(Xr.code)),Xr)}let e$3=class{},n$2=class extends e$3{constructor(){super()}},r$4=class extends n$2{constructor(eo){super()}};const HTTP_REGEX="^https?:",WS_REGEX="^wss?:";function getUrlProtocol(Xr){const eo=Xr.match(new RegExp(/^\w+:/,"gi"));if(!(!eo||!eo.length))return eo[0]}function matchRegexProtocol(Xr,eo){const to=getUrlProtocol(Xr);return typeof to>"u"?!1:new RegExp(eo).test(to)}function isHttpUrl(Xr){return matchRegexProtocol(Xr,HTTP_REGEX)}function isWsUrl(Xr){return matchRegexProtocol(Xr,WS_REGEX)}function isLocalhostUrl(Xr){return new RegExp("wss?://localhost(:d{2,5})?").test(Xr)}function isJsonRpcPayload(Xr){return typeof Xr=="object"&&"id"in Xr&&"jsonrpc"in Xr&&Xr.jsonrpc==="2.0"}function isJsonRpcRequest(Xr){return isJsonRpcPayload(Xr)&&"method"in Xr}function isJsonRpcResponse(Xr){return isJsonRpcPayload(Xr)&&(isJsonRpcResult(Xr)||isJsonRpcError(Xr))}function isJsonRpcResult(Xr){return"result"in Xr}function isJsonRpcError(Xr){return"error"in Xr}let JsonRpcProvider$1=class extends r$4{constructor(eo){super(eo),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(eo),this.connection.connected&&this.registerEventListeners()}async connect(eo=this.connection){await this.open(eo)}async disconnect(){await this.close()}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async request(eo,to){return this.requestStrict(formatJsonRpcRequest(eo.method,eo.params||[],eo.id||getBigIntRpcId().toString()),to)}async requestStrict(eo,to){return new Promise(async(ro,no)=>{if(!this.connection.connected)try{await this.open()}catch(io){no(io)}this.events.on(`${eo.id}`,io=>{isJsonRpcError(io)?no(io.error):ro(io.result)});try{await this.connection.send(eo,to)}catch(io){no(io)}})}setConnection(eo=this.connection){return eo}onPayload(eo){this.events.emit("payload",eo),isJsonRpcResponse(eo)?this.events.emit(`${eo.id}`,eo):this.events.emit("message",{type:eo.method,data:eo.params})}onClose(eo){eo&&eo.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${eo.code} ${eo.reason?`(${eo.reason})`:""}`)),this.events.emit("disconnect")}async open(eo=this.connection){this.connection===eo&&this.connection.connected||(this.connection.connected&&this.close(),typeof eo=="string"&&(await this.connection.open(eo),eo=this.connection),this.connection=this.setConnection(eo),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",eo=>this.onPayload(eo)),this.connection.on("close",eo=>this.onClose(eo)),this.connection.on("error",eo=>this.events.emit("error",eo)),this.connection.on("register_error",eo=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const w$6=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$5=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$4=Xr=>Xr.split("?")[0],h$5=10,S$5=w$6();let f$8=class{constructor(eo){if(this.url=eo,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(eo))throw new Error(`Provided URL is not compatible with WebSocket connection: ${eo}`);this.url=eo}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async open(eo=this.url){await this.register(eo)}async close(){return new Promise((eo,to)=>{if(typeof this.socket>"u"){to(new Error("Connection already closed"));return}this.socket.onclose=ro=>{this.onClose(ro),eo()},this.socket.close()})}async send(eo){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify(eo))}catch(to){this.onError(eo.id,to)}}register(eo=this.url){if(!isWsUrl(eo))throw new Error(`Provided URL is not compatible with WebSocket connection: ${eo}`);if(this.registering){const to=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=to||this.events.listenerCount("open")>=to)&&this.events.setMaxListeners(to+1),new Promise((ro,no)=>{this.events.once("register_error",io=>{this.resetMaxListeners(),no(io)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return no(new Error("WebSocket connection is missing or invalid"));ro(this.socket)})})}return this.url=eo,this.registering=!0,new Promise((to,ro)=>{const no=new URLSearchParams(eo).get("origin"),io=cjs.isReactNative()?{headers:{origin:no}}:{rejectUnauthorized:!isLocalhostUrl(eo)},oo=new S$5(eo,[],io);b$5()?oo.onerror=ao=>{const so=ao;ro(this.emitError(so.error))}:oo.on("error",ao=>{ro(this.emitError(ao))}),oo.onopen=()=>{this.onOpen(oo),to(oo)}})}onOpen(eo){eo.onmessage=to=>this.onPayload(to),eo.onclose=to=>this.onClose(to),this.socket=eo,this.registering=!1,this.events.emit("open")}onClose(eo){this.socket=void 0,this.registering=!1,this.events.emit("close",eo)}onPayload(eo){if(typeof eo.data>"u")return;const to=typeof eo.data=="string"?safeJsonParse(eo.data):eo.data;this.events.emit("payload",to)}onError(eo,to){const ro=this.parseError(to),no=ro.message||ro.toString(),io=formatJsonRpcError(eo,no);this.events.emit("payload",io)}parseError(eo,to=this.url){return parseConnectionError(eo,a$4(to),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$5&&this.events.setMaxListeners(h$5)}emitError(eo){const to=this.parseError(new Error((eo==null?void 0:eo.message)||`WebSocket connection failed for host: ${a$4(this.url)}`));return this.events.emit("register_error",to),to}};var lodash_isequal={exports:{}};lodash_isequal.exports;(function(Xr,eo){var to=200,ro="__lodash_hash_undefined__",no=1,io=2,oo=9007199254740991,ao="[object Arguments]",so="[object Array]",co="[object AsyncFunction]",lo="[object Boolean]",fo="[object Date]",ho="[object Error]",go="[object Function]",yo="[object GeneratorFunction]",vo="[object Map]",wo="[object Number]",Eo="[object Null]",ko="[object Object]",Ao="[object Promise]",Po="[object Proxy]",jo="[object RegExp]",Mo="[object Set]",No="[object String]",Do="[object Symbol]",Fo="[object Undefined]",Xo="[object WeakMap]",Lo="[object ArrayBuffer]",Bo="[object DataView]",xo="[object Float32Array]",uo="[object Float64Array]",po="[object Int8Array]",bo="[object Int16Array]",_o="[object Int32Array]",$o="[object Uint8Array]",Co="[object Uint8ClampedArray]",Ro="[object Uint16Array]",So="[object Uint32Array]",mo=/[\\^$.*+?()[\]{}|]/g,To=/^\[object .+?Constructor\]$/,Vo=/^(?:0|[1-9]\d*)$/,Zo={};Zo[xo]=Zo[uo]=Zo[po]=Zo[bo]=Zo[_o]=Zo[$o]=Zo[Co]=Zo[Ro]=Zo[So]=!0,Zo[ao]=Zo[so]=Zo[Lo]=Zo[lo]=Zo[Bo]=Zo[fo]=Zo[ho]=Zo[go]=Zo[vo]=Zo[wo]=Zo[ko]=Zo[jo]=Zo[Mo]=Zo[No]=Zo[Xo]=!1;var Qo=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,qo=typeof self=="object"&&self&&self.Object===Object&&self,Ho=Qo||qo||Function("return this")(),$a=eo&&!eo.nodeType&&eo,zo=$a&&!0&&Xr&&!Xr.nodeType&&Xr,Ko=zo&&zo.exports===$a,_c=Ko&&Qo.process,Cl=function(){try{return _c&&_c.binding&&_c.binding("util")}catch{}}(),ga=Cl&&Cl.isTypedArray;function El(Yl,pu){for(var Tu=-1,_f=Yl==null?0:Yl.length,Mp=0,mp=[];++Tu<_f;){var Up=Yl[Tu];pu(Up,Tu,Yl)&&(mp[Mp++]=Up)}return mp}function Al(Yl,pu){for(var Tu=-1,_f=pu.length,Mp=Yl.length;++Tu<_f;)Yl[Mp+Tu]=pu[Tu];return Yl}function Ol(Yl,pu){for(var Tu=-1,_f=Yl==null?0:Yl.length;++Tu<_f;)if(pu(Yl[Tu],Tu,Yl))return!0;return!1}function Wl(Yl,pu){for(var Tu=-1,_f=Array(Yl);++Tu-1}function Ku(Yl,pu){var Tu=this.__data__,_f=Lu(Tu,Yl);return _f<0?(++this.size,Tu.push([Yl,pu])):Tu[_f][1]=pu,this}lu.prototype.clear=su,lu.prototype.delete=Xu,lu.prototype.get=ju,lu.prototype.has=zu,lu.prototype.set=Ku;function Hu(Yl){var pu=-1,Tu=Yl==null?0:Yl.length;for(this.clear();++puQp))return!1;var jp=mp.get(Yl);if(jp&&mp.get(pu))return jp==pu;var Jp=-1,fm=!0,em=Tu&io?new qu:void 0;for(mp.set(Yl,pu),mp.set(pu,Yl);++Jp-1&&Yl%1==0&&Yl-1&&Yl%1==0&&Yl<=oo}function v0(Yl){var pu=typeof Yl;return Yl!=null&&(pu=="object"||pu=="function")}function Um(Yl){return Yl!=null&&typeof Yl=="object"}var b0=ga?zl(ga):yp;function O0(Yl){return Pm(Yl)?Ru(Yl):up(Yl)}function Pp(){return[]}function Ip(){return!1}Xr.exports=P0})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const Gi$1=getDefaultExportFromCjs$2(lodash_isequalExports);function unfetch_module(Xr,eo){return eo=eo||{},new Promise(function(to,ro){var no=new XMLHttpRequest,io=[],oo=[],ao={},so=function(){return{ok:(no.status/100|0)==2,statusText:no.statusText,status:no.status,url:no.responseURL,text:function(){return Promise.resolve(no.responseText)},json:function(){return Promise.resolve(no.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([no.response]))},clone:so,headers:{keys:function(){return io},entries:function(){return oo},get:function(lo){return ao[lo.toLowerCase()]},has:function(lo){return lo.toLowerCase()in ao}}}};for(var co in no.open(eo.method||"get",Xr,!0),no.onload=function(){no.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(lo,fo,ho){io.push(fo=fo.toLowerCase()),oo.push([fo,ho]),ao[fo]=ao[fo]?ao[fo]+","+ho:ho}),to(so())},no.onerror=ro,no.withCredentials=eo.credentials=="include",eo.headers)no.setRequestHeader(co,eo.headers[co]);no.send(eo.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$3=getAugmentedNamespace(unfetch_module$1);var browser$2=self.fetch||(self.fetch=require$$0$3.default||require$$0$3);const Yi$1=getDefaultExportFromCjs$2(browser$2);var define_process_env_default$3={};function Hi$1(Xr,eo){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var to=new Uint8Array(256),ro=0;ro>>0,Po=new Uint8Array(Ao);Eo!==ko;){for(var jo=yo[Eo],Mo=0,No=Ao-1;(jo!==0||Mo>>0,Po[No]=jo%ao>>>0,jo=jo/ao>>>0;if(jo!==0)throw new Error("Non-zero carry");wo=Mo,Eo++}for(var Do=Ao-wo;Do!==Ao&&Po[Do]===0;)Do++;for(var Fo=so.repeat(vo);Do>>0,Ao=new Uint8Array(ko);yo[vo];){var Po=to[yo.charCodeAt(vo)];if(Po===255)return;for(var jo=0,Mo=ko-1;(Po!==0||jo>>0,Ao[Mo]=Po%256>>>0,Po=Po/256>>>0;if(Po!==0)throw new Error("Non-zero carry");Eo=jo,vo++}if(yo[vo]!==" "){for(var No=ko-Eo;No!==ko&&Ao[No]===0;)No++;for(var Do=new Uint8Array(wo+(ko-No)),Fo=wo;No!==ko;)Do[Fo++]=Ao[No++];return Do}}}function go(yo){var vo=ho(yo);if(vo)return vo;throw new Error(`Non-${eo} character`)}return{encode:fo,decodeUnsafe:ho,decode:go}}var Ji$1=Hi$1,Xi$1=Ji$1;const Ne$2=Xr=>{if(Xr instanceof Uint8Array&&Xr.constructor.name==="Uint8Array")return Xr;if(Xr instanceof ArrayBuffer)return new Uint8Array(Xr);if(ArrayBuffer.isView(Xr))return new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);throw new Error("Unknown type, must be binary type")},Wi$2=Xr=>new TextEncoder().encode(Xr),Qi$1=Xr=>new TextDecoder().decode(Xr);let Zi$1=class{constructor(eo,to,ro){this.name=eo,this.prefix=to,this.baseEncode=ro}encode(eo){if(eo instanceof Uint8Array)return`${this.prefix}${this.baseEncode(eo)}`;throw Error("Unknown type, must be binary type")}},es$1=class{constructor(eo,to,ro){if(this.name=eo,this.prefix=to,to.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=to.codePointAt(0),this.baseDecode=ro}decode(eo){if(typeof eo=="string"){if(eo.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(eo)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(eo.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(eo){return Ue$2(this,eo)}},ts$1=class{constructor(eo){this.decoders=eo}or(eo){return Ue$2(this,eo)}decode(eo){const to=eo[0],ro=this.decoders[to];if(ro)return ro.decode(eo);throw RangeError(`Unable to decode multibase string ${JSON.stringify(eo)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Ue$2=(Xr,eo)=>new ts$1({...Xr.decoders||{[Xr.prefix]:Xr},...eo.decoders||{[eo.prefix]:eo}});let is$6=class{constructor(eo,to,ro,no){this.name=eo,this.prefix=to,this.baseEncode=ro,this.baseDecode=no,this.encoder=new Zi$1(eo,to,ro),this.decoder=new es$1(eo,to,no)}encode(eo){return this.encoder.encode(eo)}decode(eo){return this.decoder.decode(eo)}};const W$4=({name:Xr,prefix:eo,encode:to,decode:ro})=>new is$6(Xr,eo,to,ro),B$4=({prefix:Xr,name:eo,alphabet:to})=>{const{encode:ro,decode:no}=Xi$1(to,eo);return W$4({prefix:Xr,name:eo,encode:ro,decode:io=>Ne$2(no(io))})},ss$1=(Xr,eo,to,ro)=>{const no={};for(let lo=0;lo=8&&(ao-=8,oo[co++]=255&so>>ao)}if(ao>=to||255&so<<8-ao)throw new SyntaxError("Unexpected end of data");return oo},rs$1=(Xr,eo,to)=>{const ro=eo[eo.length-1]==="=",no=(1<to;)oo-=to,io+=eo[no&ao>>oo];if(oo&&(io+=eo[no&ao<W$4({prefix:eo,name:Xr,encode(no){return rs$1(no,ro,to)},decode(no){return ss$1(no,ro,to,Xr)}}),ns$1=W$4({prefix:"\0",name:"identity",encode:Xr=>Qi$1(Xr),decode:Xr=>Wi$2(Xr)});var os$1=Object.freeze({__proto__:null,identity:ns$1});const as$2=g$8({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs$2=Object.freeze({__proto__:null,base2:as$2});const cs$2=g$8({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var us$2=Object.freeze({__proto__:null,base8:cs$2});const ls$2=B$4({prefix:"9",name:"base10",alphabet:"0123456789"});var ds$2=Object.freeze({__proto__:null,base10:ls$2});const gs$2=g$8({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps$2=g$8({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds$1=Object.freeze({__proto__:null,base16:gs$2,base16upper:ps$2});const ys$1=g$8({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms$1=g$8({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs$1=g$8({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs$1=g$8({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es$1=g$8({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws$2=g$8({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs$1=g$8({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is$1=g$8({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs$1=g$8({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rs$1=Object.freeze({__proto__:null,base32:ys$1,base32upper:ms$1,base32pad:bs$1,base32padupper:fs$1,base32hex:Es$1,base32hexupper:ws$2,base32hexpad:vs$1,base32hexpadupper:Is$1,base32z:Cs$1});const _s$1=B$4({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ts$1=B$4({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss$1=Object.freeze({__proto__:null,base36:_s$1,base36upper:Ts$1});const Ps$1=B$4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs$1=B$4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os$1=Object.freeze({__proto__:null,base58btc:Ps$1,base58flickr:xs$1});const As$1=g$8({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs$1=g$8({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns$1=g$8({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Us$1=g$8({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ls$1=Object.freeze({__proto__:null,base64:As$1,base64pad:zs$1,base64url:Ns$1,base64urlpad:Us$1});const Le$2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),$s$1=Le$2.reduce((Xr,eo,to)=>(Xr[to]=eo,Xr),[]),Fs$1=Le$2.reduce((Xr,eo,to)=>(Xr[eo.codePointAt(0)]=to,Xr),[]);function Ms$1(Xr){return Xr.reduce((eo,to)=>(eo+=$s$1[to],eo),"")}function ks$1(Xr){const eo=[];for(const to of Xr){const ro=Fs$1[to.codePointAt(0)];if(ro===void 0)throw new Error(`Non-base256emoji character: ${to}`);eo.push(ro)}return new Uint8Array(eo)}const Ks$1=W$4({prefix:"🚀",name:"base256emoji",encode:Ms$1,decode:ks$1});var Bs$1=Object.freeze({__proto__:null,base256emoji:Ks$1}),Vs$1=Fe$2,$e$1=128,qs$1=127,js$2=~qs$1,Gs$1=Math.pow(2,31);function Fe$2(Xr,eo,to){eo=eo||[],to=to||0;for(var ro=to;Xr>=Gs$1;)eo[to++]=Xr&255|$e$1,Xr/=128;for(;Xr&js$2;)eo[to++]=Xr&255|$e$1,Xr>>>=7;return eo[to]=Xr|0,Fe$2.bytes=to-ro+1,eo}var Ys$1=he$3,Hs$1=128,Me=127;function he$3(Xr,ro){var to=0,ro=ro||0,no=0,io=ro,oo,ao=Xr.length;do{if(io>=ao)throw he$3.bytes=0,new RangeError("Could not decode varint");oo=Xr[io++],to+=no<28?(oo&Me)<=Hs$1);return he$3.bytes=io-ro,to}var Js$1=Math.pow(2,7),Xs$1=Math.pow(2,14),Ws$1=Math.pow(2,21),Qs$1=Math.pow(2,28),Zs$1=Math.pow(2,35),er$2=Math.pow(2,42),tr$2=Math.pow(2,49),ir$2=Math.pow(2,56),sr$2=Math.pow(2,63),rr$2=function(Xr){return Xr(ke$2.encode(Xr,eo,to),eo),Be$2=Xr=>ke$2.encodingLength(Xr),ce$3=(Xr,eo)=>{const to=eo.byteLength,ro=Be$2(Xr),no=ro+Be$2(to),io=new Uint8Array(no+to);return Ke$1(Xr,io,0),Ke$1(to,io,ro),io.set(eo,no),new or$1(Xr,to,eo,io)};let or$1=class{constructor(eo,to,ro,no){this.code=eo,this.size=to,this.digest=ro,this.bytes=no}};const Ve$2=({name:Xr,code:eo,encode:to})=>new ar$2(Xr,eo,to);let ar$2=class{constructor(eo,to,ro){this.name=eo,this.code=to,this.encode=ro}digest(eo){if(eo instanceof Uint8Array){const to=this.encode(eo);return to instanceof Uint8Array?ce$3(this.code,to):to.then(ro=>ce$3(this.code,ro))}else throw Error("Unknown type, must be binary type")}};const qe$2=Xr=>async eo=>new Uint8Array(await crypto.subtle.digest(Xr,eo)),hr$2=Ve$2({name:"sha2-256",code:18,encode:qe$2("SHA-256")}),cr$3=Ve$2({name:"sha2-512",code:19,encode:qe$2("SHA-512")});var ur$2=Object.freeze({__proto__:null,sha256:hr$2,sha512:cr$3});const je$2=0,lr$3="identity",Ge$2=Ne$2,dr$2=Xr=>ce$3(je$2,Ge$2(Xr)),gr$2={code:je$2,name:lr$3,encode:Ge$2,digest:dr$2};var pr$1=Object.freeze({__proto__:null,identity:gr$2});new TextEncoder,new TextDecoder;const Ye$2={...os$1,...hs$2,...us$2,...ds$2,...Ds$1,...Rs$1,...Ss$1,...Os$1,...Ls$1,...Bs$1};({...ur$2,...pr$1});function He$2(Xr){return globalThis.Buffer!=null?new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength):Xr}function Dr$1(Xr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?He$2(globalThis.Buffer.allocUnsafe(Xr)):new Uint8Array(Xr)}function Je$1(Xr,eo,to,ro){return{name:Xr,prefix:eo,encoder:{name:Xr,prefix:eo,encode:to},decoder:{decode:ro}}}const Xe$2=Je$1("utf8","u",Xr=>"u"+new TextDecoder("utf8").decode(Xr),Xr=>new TextEncoder().encode(Xr.substring(1))),ue$3=Je$1("ascii","a",Xr=>{let eo="a";for(let to=0;to{Xr=Xr.substring(1);const eo=Dr$1(Xr.length);for(let to=0;to{if(!this.initialized){const ro=await this.getKeyChain();typeof ro<"u"&&(this.keychain=ro),this.initialized=!0}},this.has=ro=>(this.isInitialized(),this.keychain.has(ro)),this.set=async(ro,no)=>{this.isInitialized(),this.keychain.set(ro,no),await this.persist()},this.get=ro=>{this.isInitialized();const no=this.keychain.get(ro);if(typeof no>"u"){const{message:io}=N$7("NO_MATCHING_KEY",`${this.name}: ${ro}`);throw new Error(io)}return no},this.del=async ro=>{this.isInitialized(),this.keychain.delete(ro),await this.persist()},this.core=eo,this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(eo){await this.core.storage.setItem(this.storageKey,rt$3(eo))}async getKeyChain(){const eo=await this.core.storage.getItem(this.storageKey);return typeof eo<"u"?ot$2(eo):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},xt$2=class{constructor(eo,to,ro){this.core=eo,this.logger=to,this.name=et$1,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=no=>(this.isInitialized(),this.keychain.has(no)),this.getClientId=async()=>{this.isInitialized();const no=await this.getClientSeed(),io=generateKeyPair$1(no);return encodeIss(io.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const no=kn$1();return this.setPrivateKey(no.publicKey,no.privateKey)},this.signJWT=async no=>{this.isInitialized();const io=await this.getClientSeed(),oo=generateKeyPair$1(io),ao=Vn$2();return await signJWT(ao,no,tt$1,oo)},this.generateSharedKey=(no,io,oo)=>{this.isInitialized();const ao=this.getPrivateKey(no),so=Mn$1(ao,io);return this.setSymKey(so,oo)},this.setSymKey=async(no,io)=>{this.isInitialized();const oo=io||Kn$1(no);return await this.keychain.set(oo,no),oo},this.deleteKeyPair=async no=>{this.isInitialized(),await this.keychain.del(no)},this.deleteSymKey=async no=>{this.isInitialized(),await this.keychain.del(no)},this.encode=async(no,io,oo)=>{this.isInitialized();const ao=Ae$1(oo),so=safeJsonStringify(io);if(qn$1(ao)){const ho=ao.senderPublicKey,go=ao.receiverPublicKey;no=await this.generateSharedKey(ho,go)}const co=this.getSymKey(no),{type:lo,senderPublicKey:fo}=ao;return xn$1({type:lo,symKey:co,message:so,senderPublicKey:fo})},this.decode=async(no,io,oo)=>{this.isInitialized();const ao=Hn$1(io,oo);if(qn$1(ao)){const so=ao.receiverPublicKey,co=ao.senderPublicKey;no=await this.generateSharedKey(so,co)}try{const so=this.getSymKey(no),co=Fn$1({symKey:so,encoded:io});return safeJsonParse(co)}catch(so){this.logger.error(`Failed to decode message from topic: '${no}', clientId: '${await this.getClientId()}'`),this.logger.error(so)}},this.getPayloadType=no=>{const io=ee$4(no);return j$9(io.type)},this.getPayloadSenderPublicKey=no=>{const io=ee$4(no);return io.senderPublicKey?toString$2(io.senderPublicKey,p$7):void 0},this.core=eo,this.logger=E$6(to,this.name),this.keychain=ro||new Pt$2(this.core,this.logger)}get context(){return y$9(this.logger)}async setPrivateKey(eo,to){return await this.keychain.set(eo,to),eo}getPrivateKey(eo){return this.keychain.get(eo)}async getClientSeed(){let eo="";try{eo=this.keychain.get(de$3)}catch{eo=Vn$2(),await this.keychain.set(de$3,eo)}return mr$1(eo,"base16")}getSymKey(eo){return this.keychain.get(eo)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},Ot$2=class extends a$5{constructor(eo,to){super(eo,to),this.logger=eo,this.core=to,this.messages=new Map,this.name=rt$2,this.version=nt$2,this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const ro=await this.getRelayerMessages();typeof ro<"u"&&(this.messages=ro),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(ro){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(ro)}finally{this.initialized=!0}}},this.set=async(ro,no)=>{this.isInitialized();const io=Ln$1(no);let oo=this.messages.get(ro);return typeof oo>"u"&&(oo={}),typeof oo[io]<"u"||(oo[io]=no,this.messages.set(ro,oo),await this.persist()),io},this.get=ro=>{this.isInitialized();let no=this.messages.get(ro);return typeof no>"u"&&(no={}),no},this.has=(ro,no)=>{this.isInitialized();const io=this.get(ro),oo=Ln$1(no);return typeof io[oo]<"u"},this.del=async ro=>{this.isInitialized(),this.messages.delete(ro),await this.persist()},this.logger=E$6(eo,this.name),this.core=to}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(eo){await this.core.storage.setItem(this.storageKey,rt$3(eo))}async getRelayerMessages(){const eo=await this.core.storage.getItem(this.storageKey);return typeof eo<"u"?ot$2(eo):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},vr$1=class extends u$5{constructor(eo,to){super(eo,to),this.relayer=eo,this.logger=to,this.events=new eventsExports.EventEmitter,this.name=at$2,this.queue=new Map,this.publishTimeout=cjs$4.toMiliseconds(cjs$4.TEN_SECONDS*2),this.needsTransportRestart=!1,this.publish=async(ro,no,io)=>{var oo;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:ro,message:no,opts:io}});try{const ao=(io==null?void 0:io.ttl)||ot$1,so=vt$3(io),co=(io==null?void 0:io.prompt)||!1,lo=(io==null?void 0:io.tag)||0,fo=(io==null?void 0:io.id)||getBigIntRpcId().toString(),ho={topic:ro,message:no,opts:{ttl:ao,relay:so,prompt:co,tag:lo,id:fo}},go=setTimeout(()=>this.queue.set(fo,ho),this.publishTimeout);try{await await ut$5(this.rpcPublish(ro,no,ao,so,co,lo,fo),this.publishTimeout,`Failed to publish payload, please try again. id:${fo} tag:${lo}`),this.removeRequestFromQueue(fo),this.relayer.events.emit(D$5.publish,ho)}catch(yo){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(oo=io==null?void 0:io.internal)!=null&&oo.throwOnFailedPublish)throw this.removeRequestFromQueue(fo),yo;return}finally{clearTimeout(go)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:ro,message:no,opts:io}})}catch(ao){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(ao),ao}},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.relayer=eo,this.logger=E$6(to,this.name),this.registerEventListeners()}get context(){return y$9(this.logger)}rpcPublish(eo,to,ro,no,io,oo,ao){var so,co,lo,fo;const ho={method:Et$3(no.protocol).publish,params:{topic:eo,message:to,ttl:ro,prompt:io,tag:oo},id:ao};return w$9((so=ho.params)==null?void 0:so.prompt)&&((co=ho.params)==null||delete co.prompt),w$9((lo=ho.params)==null?void 0:lo.tag)&&((fo=ho.params)==null||delete fo.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:ho}),this.relayer.request(ho)}removeRequestFromQueue(eo){this.queue.delete(eo)}checkQueue(){this.queue.forEach(async eo=>{const{topic:to,message:ro,opts:no}=eo;await this.publish(to,ro,no)})}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(D$5.connection_stalled);return}this.checkQueue()}),this.relayer.on(D$5.message_ack,eo=>{this.removeRequestFromQueue(eo.id.toString())})}},Ir$1=class{constructor(){this.map=new Map,this.set=(eo,to)=>{const ro=this.get(eo);this.exists(eo,to)||this.map.set(eo,[...ro,to])},this.get=eo=>this.map.get(eo)||[],this.exists=(eo,to)=>this.get(eo).includes(to),this.delete=(eo,to)=>{if(typeof to>"u"){this.map.delete(eo);return}if(!this.map.has(eo))return;const ro=this.get(eo);if(!this.exists(eo,to))return;const no=ro.filter(io=>io!==to);if(!no.length){this.map.delete(eo);return}this.map.set(eo,no)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}};var Cr$1=Object.defineProperty,Rr$1=Object.defineProperties,_r$1=Object.getOwnPropertyDescriptors,At$1=Object.getOwnPropertySymbols,Tr$1=Object.prototype.hasOwnProperty,Sr$1=Object.prototype.propertyIsEnumerable,zt$2=(Xr,eo,to)=>eo in Xr?Cr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,q$6=(Xr,eo)=>{for(var to in eo||(eo={}))Tr$1.call(eo,to)&&zt$2(Xr,to,eo[to]);if(At$1)for(var to of At$1(eo))Sr$1.call(eo,to)&&zt$2(Xr,to,eo[to]);return Xr},De$2=(Xr,eo)=>Rr$1(Xr,_r$1(eo));let Nt$2=class extends d$7{constructor(eo,to){super(eo,to),this.relayer=eo,this.logger=to,this.subscriptions=new Map,this.topicMap=new Ir$1,this.events=new eventsExports.EventEmitter,this.name=mt$2,this.version=bt$2,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=O$8,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(ro,no)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:ro,opts:no}});try{const io=vt$3(no),oo={topic:ro,relay:io};this.pending.set(ro,oo);const ao=await this.rpcSubscribe(ro,io);return this.onSubscribe(ao,oo),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:ro,opts:no}}),ao}catch(io){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(io),io}},this.unsubscribe=async(ro,no)=>{await this.restartToComplete(),this.isInitialized(),typeof(no==null?void 0:no.id)<"u"?await this.unsubscribeById(ro,no.id,no):await this.unsubscribeByTopic(ro,no)},this.isSubscribed=async ro=>{if(this.topics.includes(ro))return!0;const no=`${this.pendingSubscriptionWatchLabel}_${ro}`;return await new Promise((io,oo)=>{const ao=new cjs$4.Watch;ao.start(no);const so=setInterval(()=>{!this.pending.has(ro)&&this.topics.includes(ro)&&(clearInterval(so),ao.stop(no),io(!0)),ao.elapsed(no)>=ft$3&&(clearInterval(so),ao.stop(no),oo(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=eo,this.logger=E$6(to,this.name),this.clientId=""}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(eo,to){let ro=!1;try{ro=this.getSubscription(eo).topic===to}catch{}return ro}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(eo,to){const ro=this.topicMap.get(eo);await Promise.all(ro.map(async no=>await this.unsubscribeById(eo,no,to)))}async unsubscribeById(eo,to,ro){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:eo,id:to,opts:ro}});try{const no=vt$3(ro);await this.rpcUnsubscribe(eo,to,no);const io=U$6("USER_DISCONNECTED",`${this.name}, ${eo}`);await this.onUnsubscribe(eo,to,io),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:eo,id:to,opts:ro}})}catch(no){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(no),no}}async rpcSubscribe(eo,to){const ro={method:Et$3(to.protocol).subscribe,params:{topic:eo}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:ro});try{await await ut$5(this.relayer.request(ro),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(D$5.connection_stalled)}return Ln$1(eo+this.clientId)}async rpcBatchSubscribe(eo){if(!eo.length)return;const to=eo[0].relay,ro={method:Et$3(to.protocol).batchSubscribe,params:{topics:eo.map(no=>no.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:ro});try{return await await ut$5(this.relayer.request(ro),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(D$5.connection_stalled)}}rpcUnsubscribe(eo,to,ro){const no={method:Et$3(ro.protocol).unsubscribe,params:{topic:eo,id:to}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:no}),this.relayer.request(no)}onSubscribe(eo,to){this.setSubscription(eo,De$2(q$6({},to),{id:eo})),this.pending.delete(to.topic)}onBatchSubscribe(eo){eo.length&&eo.forEach(to=>{this.setSubscription(to.id,q$6({},to)),this.pending.delete(to.topic)})}async onUnsubscribe(eo,to,ro){this.events.removeAllListeners(to),this.hasSubscription(to,eo)&&this.deleteSubscription(to,ro),await this.relayer.messages.del(eo)}async setRelayerSubscriptions(eo){await this.relayer.core.storage.setItem(this.storageKey,eo)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(eo,to){this.subscriptions.has(eo)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:eo,subscription:to}),this.addSubscription(eo,to))}addSubscription(eo,to){this.subscriptions.set(eo,q$6({},to)),this.topicMap.set(to.topic,eo),this.events.emit(w$5.created,to)}getSubscription(eo){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:eo});const to=this.subscriptions.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw new Error(ro)}return to}deleteSubscription(eo,to){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:eo,reason:to});const ro=this.getSubscription(eo);this.subscriptions.delete(eo),this.topicMap.delete(ro.topic,eo),this.events.emit(w$5.deleted,De$2(q$6({},ro),{reason:to}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(w$5.sync)}async reset(){if(this.cached.length){const eo=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let to=0;to"u"||!eo.length)return;if(this.subscriptions.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(eo){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(eo)}}async batchSubscribe(eo){if(!eo.length)return;const to=await this.rpcBatchSubscribe(eo);k$4(to)&&this.onBatchSubscribe(to.map((ro,no)=>De$2(q$6({},eo[no]),{id:ro})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const eo=[];this.pending.forEach(to=>{eo.push(to)}),await this.batchSubscribe(eo)}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(D$5.connect,async()=>{await this.onConnect()}),this.relayer.on(D$5.disconnect,()=>{this.onDisconnect()}),this.events.on(w$5.created,async eo=>{const to=w$5.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),await this.persist()}),this.events.on(w$5.deleted,async eo=>{const to=w$5.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}async restartToComplete(){this.restartInProgress&&await new Promise(eo=>{const to=setInterval(()=>{this.restartInProgress||(clearInterval(to),eo())},this.pollingInterval)})}};var Pr$1=Object.defineProperty,Ut$2=Object.getOwnPropertySymbols,xr$1=Object.prototype.hasOwnProperty,Or$1=Object.prototype.propertyIsEnumerable,Lt$1=(Xr,eo,to)=>eo in Xr?Pr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,Ar$1=(Xr,eo)=>{for(var to in eo||(eo={}))xr$1.call(eo,to)&&Lt$1(Xr,to,eo[to]);if(Ut$2)for(var to of Ut$2(eo))Or$1.call(eo,to)&&Lt$1(Xr,to,eo[to]);return Xr};let $t$2=class extends g$9{constructor(eo){super(eo),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ut$4,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.request=async to=>{this.logger.debug("Publishing Request Payload");const ro=to.id;try{await this.toEstablishConnection();const no=this.provider.request(to);return this.requestsInFlight.set(ro,{promise:no,request:to}),await no}catch(no){throw this.logger.debug("Failed to Publish Request"),this.logger.error(no),no}finally{this.requestsInFlight.delete(ro)}},this.onPayloadHandler=to=>{this.onProviderPayload(to)},this.onConnectHandler=()=>{this.events.emit(D$5.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=to=>{this.logger.error(to),this.events.emit(D$5.error,to),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(P$6.payload,this.onPayloadHandler),this.provider.on(P$6.connect,this.onConnectHandler),this.provider.on(P$6.disconnect,this.onDisconnectHandler),this.provider.on(P$6.error,this.onProviderErrorHandler)},this.core=eo.core,this.logger=typeof eo.logger<"u"&&typeof eo.logger!="string"?E$6(eo.logger,this.name):Hg(k$2({level:eo.logger||ct$2})),this.messages=new Ot$2(this.logger,eo.core),this.subscriber=new Nt$2(this,this.logger),this.publisher=new vr$1(this,this.logger),this.relayUrl=(eo==null?void 0:eo.relayUrl)||ge$4,this.projectId=eo.projectId,this.bundleId=Jn$1(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${pe$3}...`),await this.restartTransport(pe$3)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},pt$2)}get context(){return y$9(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(eo,to,ro){this.isInitialized(),await this.publisher.publish(eo,to,ro),await this.recordMessageEvent({topic:eo,message:to,publishedAt:Date.now()})}async subscribe(eo,to){var ro;this.isInitialized();let no=((ro=this.subscriber.topicMap.get(eo))==null?void 0:ro[0])||"";if(no)return no;let io;const oo=ao=>{ao.topic===eo&&(this.subscriber.off(w$5.created,oo),io())};return await Promise.all([new Promise(ao=>{io=ao,this.subscriber.on(w$5.created,oo)}),new Promise(async ao=>{no=await this.subscriber.subscribe(eo,to),ao()})]),no}async unsubscribe(eo,to){this.isInitialized(),await this.subscriber.unsubscribe(eo,to)}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async transportClose(){this.requestsInFlight.size>0&&(this.logger.debug("Waiting for all in-flight requests to finish before closing transport..."),this.requestsInFlight.forEach(async eo=>{await eo.promise})),this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ut$5(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(eo){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){eo&&eo!==this.relayUrl&&(this.relayUrl=eo,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(to=>{if(!this.initialized)return to();this.subscriber.once(w$5.resubscribed,()=>{to()})}),new Promise(async(to,ro)=>{try{await ut$5(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(no){ro(no);return}to()})])}catch(to){this.logger.error(to);const ro=to;if(!this.isConnectionStalled(ro.message))throw to;this.provider.events.emit(P$6.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(eo){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=eo||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await rr$3())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(eo){return this.staleConnectionErrors.some(to=>eo.includes(to))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const eo=await this.core.crypto.signJWT(this.relayUrl);this.provider=new JsonRpcProvider$1(new f$8(Xn$1({sdkVersion:gt$2,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:eo,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(eo){const{topic:to,message:ro}=eo;await this.messages.set(to,ro)}async shouldIgnoreMessageEvent(eo){const{topic:to,message:ro}=eo;if(!ro||ro.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${ro}`),!0;if(!await this.subscriber.isSubscribed(to))return this.logger.debug(`Ignoring message for non-subscribed topic ${to}`),!0;const no=this.messages.has(to,ro);return no&&this.logger.debug(`Ignoring duplicate message: ${ro}`),no}async onProviderPayload(eo){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:eo}),isJsonRpcRequest(eo)){if(!eo.method.endsWith(lt$2))return;const to=eo.params,{topic:ro,message:no,publishedAt:io}=to.data,oo={topic:ro,message:no,publishedAt:io};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar$1({type:"event",event:to.id},oo)),this.events.emit(to.id,oo),await this.acknowledgePayload(eo),await this.onMessageEvent(oo)}else isJsonRpcResponse(eo)&&this.events.emit(D$5.message_ack,eo)}async onMessageEvent(eo){await this.shouldIgnoreMessageEvent(eo)||(this.events.emit(D$5.message,eo),await this.recordMessageEvent(eo))}async acknowledgePayload(eo){const to=formatJsonRpcResult(eo.id,!0);await this.provider.connection.send(to)}unregisterProviderListeners(){this.provider.off(P$6.payload,this.onPayloadHandler),this.provider.off(P$6.connect,this.onConnectHandler),this.provider.off(P$6.disconnect,this.onDisconnectHandler),this.provider.off(P$6.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(D$5.connection_stalled,()=>{this.restartTransport().catch(to=>this.logger.error(to))});let eo=await rr$3();or$2(async to=>{this.initialized&&eo!==to&&(eo=to,to?await this.restartTransport().catch(ro=>this.logger.error(ro)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(ro=>this.logger.error(ro))))})}onProviderDisconnect(){this.events.emit(D$5.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(eo=>this.logger.error(eo))},cjs$4.toMiliseconds(dt$2)))}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(eo=>{const to=setInterval(()=>{this.connected&&(clearInterval(to),eo())},this.connectionStatusPollingInterval)});await this.restartTransport()}}};var zr$1=Object.defineProperty,Ft$2=Object.getOwnPropertySymbols,Nr$1=Object.prototype.hasOwnProperty,Ur$1=Object.prototype.propertyIsEnumerable,Mt$1=(Xr,eo,to)=>eo in Xr?zr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,kt$2=(Xr,eo)=>{for(var to in eo||(eo={}))Nr$1.call(eo,to)&&Mt$1(Xr,to,eo[to]);if(Ft$2)for(var to of Ft$2(eo))Ur$1.call(eo,to)&&Mt$1(Xr,to,eo[to]);return Xr};let Kt$2=class extends p$5{constructor(eo,to,ro,no=O$8,io=void 0){super(eo,to,ro,no),this.core=eo,this.logger=to,this.name=ro,this.map=new Map,this.version=Dt$2,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(oo=>{this.getKey&&oo!==null&&!w$9(oo)?this.map.set(this.getKey(oo),oo):Lt$2(oo)?this.map.set(oo.id,oo):xt$3(oo)&&this.map.set(oo.topic,oo)}),this.cached=[],this.initialized=!0)},this.set=async(oo,ao)=>{this.isInitialized(),this.map.has(oo)?await this.update(oo,ao):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:oo,value:ao}),this.map.set(oo,ao),await this.persist())},this.get=oo=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:oo}),this.getData(oo)),this.getAll=oo=>(this.isInitialized(),oo?this.values.filter(ao=>Object.keys(oo).every(so=>Gi$1(ao[so],oo[so]))):this.values),this.update=async(oo,ao)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:oo,update:ao});const so=kt$2(kt$2({},this.getData(oo)),ao);this.map.set(oo,so),await this.persist()},this.delete=async(oo,ao)=>{this.isInitialized(),this.map.has(oo)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:oo,reason:ao}),this.map.delete(oo),await this.persist())},this.logger=E$6(to,this.name),this.storagePrefix=no,this.getKey=io}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(eo){await this.core.storage.setItem(this.storageKey,eo)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(eo){const to=this.map.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw this.logger.error(ro),new Error(ro)}return to}async persist(){await this.setDataStore(this.values)}async restore(){try{const eo=await this.getDataStore();if(typeof eo>"u"||!eo.length)return;if(this.map.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(eo){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(eo)}}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},Bt$2=class{constructor(eo,to){this.core=eo,this.logger=to,this.name=Et$2,this.version=wt$2,this.events=new EventEmitter$1,this.initialized=!1,this.storagePrefix=O$8,this.ignoredPayloadTypes=[_$9],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:ro})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...ro])]},this.create=async()=>{this.isInitialized();const ro=Vn$2(),no=await this.core.crypto.setSymKey(ro),io=pt$3(cjs$4.FIVE_MINUTES),oo={protocol:ht$2},ao={topic:no,expiry:io,relay:oo,active:!1},so=Rt$3({protocol:this.core.protocol,version:this.core.version,topic:no,symKey:ro,relay:oo,expiryTimestamp:io});return await this.pairings.set(no,ao),await this.core.relayer.subscribe(no),this.core.expirer.set(no,io),{topic:no,uri:so}},this.pair=async ro=>{this.isInitialized(),this.isValidPair(ro);const{topic:no,symKey:io,relay:oo,expiryTimestamp:ao}=Pt$3(ro.uri);let so;if(this.pairings.keys.includes(no)&&(so=this.pairings.get(no),so.active))throw new Error(`Pairing already exists: ${no}. Please try again with a new connection URI.`);const co=ao||pt$3(cjs$4.FIVE_MINUTES),lo={topic:no,relay:oo,expiry:co,active:!1};return await this.pairings.set(no,lo),this.core.expirer.set(no,co),ro.activatePairing&&await this.activate({topic:no}),this.events.emit(V$2.create,lo),this.core.crypto.keychain.has(no)||(await this.core.crypto.setSymKey(io,no),await this.core.relayer.subscribe(no,{relay:oo})),lo},this.activate=async({topic:ro})=>{this.isInitialized();const no=pt$3(cjs$4.THIRTY_DAYS);await this.pairings.update(ro,{active:!0,expiry:no}),this.core.expirer.set(ro,no)},this.ping=async ro=>{this.isInitialized(),await this.isValidPing(ro);const{topic:no}=ro;if(this.pairings.keys.includes(no)){const io=await this.sendRequest(no,"wc_pairingPing",{}),{done:oo,resolve:ao,reject:so}=at$3();this.events.once(yt$3("pairing_ping",io),({error:co})=>{co?so(co):ao()}),await oo()}},this.updateExpiry=async({topic:ro,expiry:no})=>{this.isInitialized(),await this.pairings.update(ro,{expiry:no})},this.updateMetadata=async({topic:ro,metadata:no})=>{this.isInitialized(),await this.pairings.update(ro,{peerMetadata:no})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async ro=>{this.isInitialized(),await this.isValidDisconnect(ro);const{topic:no}=ro;this.pairings.keys.includes(no)&&(await this.sendRequest(no,"wc_pairingDelete",U$6("USER_DISCONNECTED")),await this.deletePairing(no))},this.sendRequest=async(ro,no,io)=>{const oo=formatJsonRpcRequest(no,io),ao=await this.core.crypto.encode(ro,oo),so=$$4[no].req;return this.core.history.set(ro,oo),this.core.relayer.publish(ro,ao,so),oo.id},this.sendResult=async(ro,no,io)=>{const oo=formatJsonRpcResult(ro,io),ao=await this.core.crypto.encode(no,oo),so=await this.core.history.get(no,ro),co=$$4[so.request.method].res;await this.core.relayer.publish(no,ao,co),await this.core.history.resolve(oo)},this.sendError=async(ro,no,io)=>{const oo=formatJsonRpcError(ro,io),ao=await this.core.crypto.encode(no,oo),so=await this.core.history.get(no,ro),co=$$4[so.request.method]?$$4[so.request.method].res:$$4.unregistered_method.res;await this.core.relayer.publish(no,ao,co),await this.core.history.resolve(oo)},this.deletePairing=async(ro,no)=>{await this.core.relayer.unsubscribe(ro),await Promise.all([this.pairings.delete(ro,U$6("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(ro),no?Promise.resolve():this.core.expirer.del(ro)])},this.cleanup=async()=>{const ro=this.pairings.getAll().filter(no=>mt$3(no.expiry));await Promise.all(ro.map(no=>this.deletePairing(no.topic)))},this.onRelayEventRequest=ro=>{const{topic:no,payload:io}=ro;switch(io.method){case"wc_pairingPing":return this.onPairingPingRequest(no,io);case"wc_pairingDelete":return this.onPairingDeleteRequest(no,io);default:return this.onUnknownRpcMethodRequest(no,io)}},this.onRelayEventResponse=async ro=>{const{topic:no,payload:io}=ro,oo=(await this.core.history.get(no,io.id)).request.method;switch(oo){case"wc_pairingPing":return this.onPairingPingResponse(no,io);default:return this.onUnknownRpcMethodResponse(oo)}},this.onPairingPingRequest=async(ro,no)=>{const{id:io}=no;try{this.isValidPing({topic:ro}),await this.sendResult(io,ro,!0),this.events.emit(V$2.ping,{id:io,topic:ro})}catch(oo){await this.sendError(io,ro,oo),this.logger.error(oo)}},this.onPairingPingResponse=(ro,no)=>{const{id:io}=no;setTimeout(()=>{isJsonRpcResult(no)?this.events.emit(yt$3("pairing_ping",io),{}):isJsonRpcError(no)&&this.events.emit(yt$3("pairing_ping",io),{error:no.error})},500)},this.onPairingDeleteRequest=async(ro,no)=>{const{id:io}=no;try{this.isValidDisconnect({topic:ro}),await this.deletePairing(ro),this.events.emit(V$2.delete,{id:io,topic:ro})}catch(oo){await this.sendError(io,ro,oo),this.logger.error(oo)}},this.onUnknownRpcMethodRequest=async(ro,no)=>{const{id:io,method:oo}=no;try{if(this.registeredMethods.includes(oo))return;const ao=U$6("WC_METHOD_UNSUPPORTED",oo);await this.sendError(io,ro,ao),this.logger.error(ao)}catch(ao){await this.sendError(io,ro,ao),this.logger.error(ao)}},this.onUnknownRpcMethodResponse=ro=>{this.registeredMethods.includes(ro)||this.logger.error(U$6("WC_METHOD_UNSUPPORTED",ro))},this.isValidPair=ro=>{var no;if(!Gt$3(ro)){const{message:oo}=N$7("MISSING_OR_INVALID",`pair() params: ${ro}`);throw new Error(oo)}if(!Kt$3(ro.uri)){const{message:oo}=N$7("MISSING_OR_INVALID",`pair() uri: ${ro.uri}`);throw new Error(oo)}const io=Pt$3(ro.uri);if(!((no=io==null?void 0:io.relay)!=null&&no.protocol)){const{message:oo}=N$7("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(oo)}if(!(io!=null&&io.symKey)){const{message:oo}=N$7("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(oo)}if(io!=null&&io.expiryTimestamp&&cjs$4.toMiliseconds(io==null?void 0:io.expiryTimestamp){if(!Gt$3(ro)){const{message:io}=N$7("MISSING_OR_INVALID",`ping() params: ${ro}`);throw new Error(io)}const{topic:no}=ro;await this.isValidPairingTopic(no)},this.isValidDisconnect=async ro=>{if(!Gt$3(ro)){const{message:io}=N$7("MISSING_OR_INVALID",`disconnect() params: ${ro}`);throw new Error(io)}const{topic:no}=ro;await this.isValidPairingTopic(no)},this.isValidPairingTopic=async ro=>{if(!g$b(ro,!1)){const{message:no}=N$7("MISSING_OR_INVALID",`pairing topic should be a string: ${ro}`);throw new Error(no)}if(!this.pairings.keys.includes(ro)){const{message:no}=N$7("NO_MATCHING_KEY",`pairing topic doesn't exist: ${ro}`);throw new Error(no)}if(mt$3(this.pairings.get(ro).expiry)){await this.deletePairing(ro);const{message:no}=N$7("EXPIRED",`pairing topic: ${ro}`);throw new Error(no)}},this.core=eo,this.logger=E$6(to,this.name),this.pairings=new Kt$2(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$9(this.logger)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}registerRelayerEvents(){this.core.relayer.on(D$5.message,async eo=>{const{topic:to,message:ro}=eo;if(!this.pairings.keys.includes(to)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(ro)))return;const no=await this.core.crypto.decode(to,ro);try{isJsonRpcRequest(no)?(this.core.history.set(to,no),this.onRelayEventRequest({topic:to,payload:no})):isJsonRpcResponse(no)&&(await this.core.history.resolve(no),await this.onRelayEventResponse({topic:to,payload:no}),this.core.history.delete(to,no.id))}catch(io){this.logger.error(io)}})}registerExpirerEvents(){this.core.expirer.on(v$5.expired,async eo=>{const{topic:to}=ft$4(eo.target);to&&this.pairings.keys.includes(to)&&(await this.deletePairing(to,!0),this.events.emit(V$2.expire,{topic:to}))})}},Vt$2=class extends h$6{constructor(eo,to){super(eo,to),this.core=eo,this.logger=to,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=vt$2,this.version=It$1,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(ro=>this.records.set(ro.id,ro)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(ro,no,io)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:ro,request:no,chainId:io}),this.records.has(no.id))return;const oo={id:no.id,topic:ro,request:{method:no.method,params:no.params||null},chainId:io,expiry:pt$3(cjs$4.THIRTY_DAYS)};this.records.set(oo.id,oo),this.events.emit(R$4.created,oo)},this.resolve=async ro=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:ro}),!this.records.has(ro.id))return;const no=await this.getRecord(ro.id);typeof no.response>"u"&&(no.response=isJsonRpcError(ro)?{error:ro.error}:{result:ro.result},this.records.set(no.id,no),this.events.emit(R$4.updated,no))},this.get=async(ro,no)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:ro,id:no}),await this.getRecord(no)),this.delete=(ro,no)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:no}),this.values.forEach(io=>{if(io.topic===ro){if(typeof no<"u"&&io.id!==no)return;this.records.delete(io.id),this.events.emit(R$4.deleted,io)}})},this.exists=async(ro,no)=>(this.isInitialized(),this.records.has(no)?(await this.getRecord(no)).topic===ro:!1),this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const eo=[];return this.values.forEach(to=>{if(typeof to.response<"u")return;const ro={topic:to.topic,request:formatJsonRpcRequest(to.request.method,to.request.params,to.id),chainId:to.chainId};return eo.push(ro)}),eo}async setJsonRpcRecords(eo){await this.core.storage.setItem(this.storageKey,eo)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(eo){this.isInitialized();const to=this.records.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw new Error(ro)}return to}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(R$4.sync)}async restore(){try{const eo=await this.getJsonRpcRecords();if(typeof eo>"u"||!eo.length)return;if(this.records.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(eo){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(eo)}}registerEventListeners(){this.events.on(R$4.created,eo=>{const to=R$4.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.events.on(R$4.updated,eo=>{const to=R$4.updated;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.events.on(R$4.deleted,eo=>{const to=R$4.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(eo=>{cjs$4.toMiliseconds(eo.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${eo.id}`),this.delete(eo.topic,eo.id))})}catch(eo){this.logger.warn(eo)}}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},qt$2=class extends E$5{constructor(eo,to){super(eo,to),this.core=eo,this.logger=to,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=Ct$3,this.version=Rt$2,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(ro=>this.expirations.set(ro.target,ro)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=ro=>{try{const no=this.formatTarget(ro);return typeof this.getExpiration(no)<"u"}catch{return!1}},this.set=(ro,no)=>{this.isInitialized();const io=this.formatTarget(ro),oo={target:io,expiry:no};this.expirations.set(io,oo),this.checkExpiry(io,oo),this.events.emit(v$5.created,{target:io,expiration:oo})},this.get=ro=>{this.isInitialized();const no=this.formatTarget(ro);return this.getExpiration(no)},this.del=ro=>{if(this.isInitialized(),this.has(ro)){const no=this.formatTarget(ro),io=this.getExpiration(no);this.expirations.delete(no),this.events.emit(v$5.deleted,{target:no,expiration:io})}},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(eo){if(typeof eo=="string")return lt$3(eo);if(typeof eo=="number")return dt$3(eo);const{message:to}=N$7("UNKNOWN_TYPE",`Target type: ${typeof eo}`);throw new Error(to)}async setExpirations(eo){await this.core.storage.setItem(this.storageKey,eo)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(v$5.sync)}async restore(){try{const eo=await this.getExpirations();if(typeof eo>"u"||!eo.length)return;if(this.expirations.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(eo){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(eo)}}getExpiration(eo){const to=this.expirations.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw this.logger.error(ro),new Error(ro)}return to}checkExpiry(eo,to){const{expiry:ro}=to;cjs$4.toMiliseconds(ro)-Date.now()<=0&&this.expire(eo,to)}expire(eo,to){this.expirations.delete(eo),this.events.emit(v$5.expired,{target:eo,expiration:to})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((eo,to)=>this.checkExpiry(to,eo))}registerEventListeners(){this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(v$5.created,eo=>{const to=v$5.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()}),this.events.on(v$5.expired,eo=>{const to=v$5.expired;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()}),this.events.on(v$5.deleted,eo=>{const to=v$5.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()})}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},jt$1=class extends y$8{constructor(eo,to){super(eo,to),this.projectId=eo,this.logger=to,this.name=Z$2,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async ro=>{if(this.verifyDisabled||$$5()||!D$7())return;const no=this.getVerifyUrl(ro==null?void 0:ro.verifyUrl);this.verifyUrl!==no&&this.removeIframe(),this.verifyUrl=no;try{await this.createIframe()}catch(io){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(io)}if(!this.initialized){this.removeIframe(),this.verifyUrl=ee$3;try{await this.createIframe()}catch(io){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(io),this.verifyDisabled=!0}}},this.register=async ro=>{this.initialized?this.sendPost(ro.attestationId):(this.addToQueue(ro.attestationId),await this.init())},this.resolve=async ro=>{if(this.isDevEnv)return"";const no=this.getVerifyUrl(ro==null?void 0:ro.verifyUrl);let io;try{io=await this.fetchAttestation(ro.attestationId,no)}catch(oo){this.logger.info(`failed to resolve attestation: ${ro.attestationId} from url: ${no}`),this.logger.info(oo),io=await this.fetchAttestation(ro.attestationId,ee$3)}return io},this.fetchAttestation=async(ro,no)=>{this.logger.info(`resolving attestation: ${ro} from url: ${no}`);const io=this.startAbortTimer(cjs$4.ONE_SECOND*2),oo=await fetch(`${no}/attestation/${ro}`,{signal:this.abortController.signal});return clearTimeout(io),oo.status===200?await oo.json():void 0},this.addToQueue=ro=>{this.queue.push(ro)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(ro=>this.sendPost(ro)),this.queue=[])},this.sendPost=ro=>{var no;try{if(!this.iframe)return;(no=this.iframe.contentWindow)==null||no.postMessage(ro,"*"),this.logger.info(`postMessage sent: ${ro} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let ro;const no=io=>{io.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",no),ro())};await Promise.race([new Promise(io=>{if(document.getElementById(Z$2))return io();window.addEventListener("message",no);const oo=document.createElement("iframe");oo.id=Z$2,oo.src=`${this.verifyUrl}/${this.projectId}`,oo.style.display="none",document.body.append(oo),this.iframe=oo,ro=io}),new Promise((io,oo)=>setTimeout(()=>{window.removeEventListener("message",no),oo("verify iframe load timeout")},cjs$4.toMiliseconds(cjs$4.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=ro=>{let no=ro||F$6;return _t$2.includes(no)||(this.logger.info(`verify url: ${no}, not included in trusted list, assigning default: ${F$6}`),no=F$6),no},this.logger=E$6(to,this.name),this.verifyUrl=F$6,this.abortController=new AbortController,this.isDevEnv=te$3()&&define_process_env_default$3.IS_VITEST}get context(){return y$9(this.logger)}startAbortTimer(eo){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$4.toMiliseconds(eo))}},Gt$2=class extends v$6{constructor(eo,to){super(eo,to),this.projectId=eo,this.logger=to,this.context=Tt$2,this.registerDeviceToken=async ro=>{const{clientId:no,token:io,notificationType:oo,enableEncrypted:ao=!1}=ro,so=`${St$2}/${this.projectId}/clients`;await Yi$1(so,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:no,type:oo,token:io,always_raw:ao})})},this.logger=E$6(to,this.context)}};var Lr$1=Object.defineProperty,Yt$2=Object.getOwnPropertySymbols,$r$1=Object.prototype.hasOwnProperty,Fr$1=Object.prototype.propertyIsEnumerable,Ht$2=(Xr,eo,to)=>eo in Xr?Lr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,Jt$2=(Xr,eo)=>{for(var to in eo||(eo={}))$r$1.call(eo,to)&&Ht$2(Xr,to,eo[to]);if(Yt$2)for(var to of Yt$2(eo))Fr$1.call(eo,to)&&Ht$2(Xr,to,eo[to]);return Xr};let te$2=class C_ extends n$3{constructor(eo){super(eo),this.protocol=le$3,this.version=We$2,this.name=Q$5,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(ro,no)=>this.events.on(ro,no),this.once=(ro,no)=>this.events.once(ro,no),this.off=(ro,no)=>this.events.off(ro,no),this.removeListener=(ro,no)=>this.events.removeListener(ro,no),this.projectId=eo==null?void 0:eo.projectId,this.relayUrl=(eo==null?void 0:eo.relayUrl)||ge$4,this.customStoragePrefix=eo!=null&&eo.customStoragePrefix?`:${eo.customStoragePrefix}`:"";const to=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||Qe$2.logger}));this.logger=E$6(to,this.name),this.heartbeat=new cjs$1.HeartBeat,this.crypto=new xt$2(this,this.logger,eo==null?void 0:eo.keychain),this.history=new Vt$2(this,this.logger),this.expirer=new qt$2(this,this.logger),this.storage=eo!=null&&eo.storage?eo.storage:new h$7(Jt$2(Jt$2({},Ze$2),eo==null?void 0:eo.storageOptions)),this.relayer=new $t$2({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Bt$2(this,this.logger),this.verify=new jt$1(this.projectId||"",this.logger),this.echoClient=new Gt$2(this.projectId||"",this.logger)}static async init(eo){const to=new C_(eo);await to.initialize();const ro=await to.crypto.getClientId();return await to.storage.setItem(yt$2,ro),to}get context(){return y$9(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(eo){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,eo),this.logger.error(eo.message),eo}}};const Mr$1=te$2,J$2="wc",F$5=2,X$2="client",G$3=`${J$2}@${F$5}:${X$2}:`,M$4={name:X$2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},H$3="WALLETCONNECT_DEEPLINK_CHOICE",oe$2="proposal",ae$2="Proposal expired",ce$2="session",L$7=cjs$4.SEVEN_DAYS,le$2="engine",R$3={wc_sessionPropose:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1115}}},U$5={min:cjs$4.FIVE_MINUTES,max:cjs$4.SEVEN_DAYS},I$1={idle:"IDLE",active:"ACTIVE"},pe$2="request",he$2=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var as$1=Object.defineProperty,cs$1=Object.defineProperties,ls$1=Object.getOwnPropertyDescriptors,de$2=Object.getOwnPropertySymbols,ps$1=Object.prototype.hasOwnProperty,hs$1=Object.prototype.propertyIsEnumerable,ue$2=(Xr,eo,to)=>eo in Xr?as$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,g$7=(Xr,eo)=>{for(var to in eo||(eo={}))ps$1.call(eo,to)&&ue$2(Xr,to,eo[to]);if(de$2)for(var to of de$2(eo))hs$1.call(eo,to)&&ue$2(Xr,to,eo[to]);return Xr},D$4=(Xr,eo)=>cs$1(Xr,ls$1(eo));let ds$1=class extends w$7{constructor(eo){super(eo),this.name=le$2,this.events=new EventEmitter$1,this.initialized=!1,this.ignoredPayloadTypes=[_$9],this.requestQueue={state:I$1.idle,queue:[]},this.sessionRequestQueue={state:I$1.idle,queue:[]},this.requestQueueDelay=cjs$4.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R$3)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay)))},this.connect=async to=>{await this.isInitialized();const ro=D$4(g$7({},to),{requiredNamespaces:to.requiredNamespaces||{},optionalNamespaces:to.optionalNamespaces||{}});await this.isValidConnect(ro);const{pairingTopic:no,requiredNamespaces:io,optionalNamespaces:oo,sessionProperties:ao,relays:so}=ro;let co=no,lo,fo=!1;if(co&&(fo=this.client.core.pairing.pairings.get(co).active),!co||!fo){const{topic:Po,uri:jo}=await this.client.core.pairing.create();co=Po,lo=jo}const ho=await this.client.core.crypto.generateKeyPair(),go=R$3.wc_sessionPropose.req.ttl||cjs$4.FIVE_MINUTES,yo=pt$3(go),vo=g$7({requiredNamespaces:io,optionalNamespaces:oo,relays:so??[{protocol:ht$2}],proposer:{publicKey:ho,metadata:this.client.metadata},expiryTimestamp:yo},ao&&{sessionProperties:ao}),{reject:wo,resolve:Eo,done:ko}=at$3(go,ae$2);if(this.events.once(yt$3("session_connect"),async({error:Po,session:jo})=>{if(Po)wo(Po);else if(jo){jo.self.publicKey=ho;const Mo=D$4(g$7({},jo),{requiredNamespaces:vo.requiredNamespaces,optionalNamespaces:vo.optionalNamespaces});await this.client.session.set(jo.topic,Mo),await this.setExpiry(jo.topic,jo.expiry),co&&await this.client.core.pairing.updateMetadata({topic:co,metadata:jo.peer.metadata}),Eo(Mo)}}),!co){const{message:Po}=N$7("NO_MATCHING_KEY",`connect() pairing topic: ${co}`);throw new Error(Po)}const Ao=await this.sendRequest({topic:co,method:"wc_sessionPropose",params:vo,throwOnFailedPublish:!0});return await this.setProposal(Ao,g$7({id:Ao},vo)),{uri:lo,approval:ko}},this.pair=async to=>(await this.isInitialized(),await this.client.core.pairing.pair(to)),this.approve=async to=>{await this.isInitialized(),await this.isValidApprove(to);const{id:ro,relayProtocol:no,namespaces:io,sessionProperties:oo}=to,ao=this.client.proposal.get(ro);let{pairingTopic:so,proposer:co,requiredNamespaces:lo,optionalNamespaces:fo}=ao;so=so||"";const ho=await this.client.core.crypto.generateKeyPair(),go=co.publicKey,yo=await this.client.core.crypto.generateSharedKey(ho,go);so&&ro&&(await this.client.core.pairing.updateMetadata({topic:so,metadata:co.metadata}),await this.sendResult({id:ro,topic:so,result:{relay:{protocol:no??"irn"},responderPublicKey:ho}}),await this.client.proposal.delete(ro,U$6("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:so}));const vo=g$7({relay:{protocol:no??"irn"},namespaces:io,pairingTopic:so,controller:{publicKey:ho,metadata:this.client.metadata},expiry:pt$3(L$7)},oo&&{sessionProperties:oo});await this.client.core.relayer.subscribe(yo);const wo=D$4(g$7({},vo),{topic:yo,requiredNamespaces:lo,optionalNamespaces:fo,pairingTopic:so,acknowledged:!1,self:vo.controller,peer:{publicKey:co.publicKey,metadata:co.metadata},controller:ho});await this.client.session.set(yo,wo);try{await this.sendRequest({topic:yo,method:"wc_sessionSettle",params:vo,throwOnFailedPublish:!0})}catch(Eo){throw this.client.logger.error(Eo),this.client.session.delete(yo,U$6("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(yo),Eo}return await this.setExpiry(yo,pt$3(L$7)),{topic:yo,acknowledged:()=>new Promise(Eo=>setTimeout(()=>Eo(this.client.session.get(yo)),500))}},this.reject=async to=>{await this.isInitialized(),await this.isValidReject(to);const{id:ro,reason:no}=to,{pairingTopic:io}=this.client.proposal.get(ro);io&&(await this.sendError(ro,io,no),await this.client.proposal.delete(ro,U$6("USER_DISCONNECTED")))},this.update=async to=>{await this.isInitialized(),await this.isValidUpdate(to);const{topic:ro,namespaces:no}=to,io=await this.sendRequest({topic:ro,method:"wc_sessionUpdate",params:{namespaces:no}}),{done:oo,resolve:ao,reject:so}=at$3();return this.events.once(yt$3("session_update",io),({error:co})=>{co?so(co):ao()}),await this.client.session.update(ro,{namespaces:no}),{acknowledged:oo}},this.extend=async to=>{await this.isInitialized(),await this.isValidExtend(to);const{topic:ro}=to,no=await this.sendRequest({topic:ro,method:"wc_sessionExtend",params:{}}),{done:io,resolve:oo,reject:ao}=at$3();return this.events.once(yt$3("session_extend",no),({error:so})=>{so?ao(so):oo()}),await this.setExpiry(ro,pt$3(L$7)),{acknowledged:io}},this.request=async to=>{await this.isInitialized(),await this.isValidRequest(to);const{chainId:ro,request:no,topic:io,expiry:oo=R$3.wc_sessionRequest.req.ttl}=to,ao=payloadId(),{done:so,resolve:co,reject:lo}=at$3(oo,"Request expired. Please try again.");return this.events.once(yt$3("session_request",ao),({error:fo,result:ho})=>{fo?lo(fo):co(ho)}),await Promise.all([new Promise(async fo=>{await this.sendRequest({clientRpcId:ao,topic:io,method:"wc_sessionRequest",params:{request:D$4(g$7({},no),{expiryTimestamp:pt$3(oo)}),chainId:ro},expiry:oo,throwOnFailedPublish:!0}).catch(ho=>lo(ho)),this.client.events.emit("session_request_sent",{topic:io,request:no,chainId:ro,id:ao}),fo()}),new Promise(async fo=>{const ho=await ht$3(this.client.core.storage,H$3);gt$3({id:ao,topic:io,wcDeepLink:ho}),fo()}),so()]).then(fo=>fo[2])},this.respond=async to=>{await this.isInitialized(),await this.isValidRespond(to);const{topic:ro,response:no}=to,{id:io}=no;isJsonRpcResult(no)?await this.sendResult({id:io,topic:ro,result:no.result,throwOnFailedPublish:!0}):isJsonRpcError(no)&&await this.sendError(io,ro,no.error),this.cleanupAfterResponse(to)},this.ping=async to=>{await this.isInitialized(),await this.isValidPing(to);const{topic:ro}=to;if(this.client.session.keys.includes(ro)){const no=await this.sendRequest({topic:ro,method:"wc_sessionPing",params:{}}),{done:io,resolve:oo,reject:ao}=at$3();this.events.once(yt$3("session_ping",no),({error:so})=>{so?ao(so):oo()}),await io()}else this.client.core.pairing.pairings.keys.includes(ro)&&await this.client.core.pairing.ping({topic:ro})},this.emit=async to=>{await this.isInitialized(),await this.isValidEmit(to);const{topic:ro,event:no,chainId:io}=to;await this.sendRequest({topic:ro,method:"wc_sessionEvent",params:{event:no,chainId:io}})},this.disconnect=async to=>{await this.isInitialized(),await this.isValidDisconnect(to);const{topic:ro}=to;if(this.client.session.keys.includes(ro))await this.sendRequest({topic:ro,method:"wc_sessionDelete",params:U$6("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:ro,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(ro))await this.client.core.pairing.disconnect({topic:ro});else{const{message:no}=N$7("MISMATCHED_TOPIC",`Session or pairing topic not found: ${ro}`);throw new Error(no)}},this.find=to=>(this.isInitialized(),this.client.session.getAll().filter(ro=>Mt$2(ro,to))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async to=>{if(to.pairingTopic)try{const ro=this.client.core.pairing.pairings.get(to.pairingTopic),no=this.client.core.pairing.pairings.getAll().filter(io=>{var oo,ao;return((oo=io.peerMetadata)==null?void 0:oo.url)&&((ao=io.peerMetadata)==null?void 0:ao.url)===to.peer.metadata.url&&io.topic&&io.topic!==ro.topic});if(no.length===0)return;this.client.logger.info(`Cleaning up ${no.length} duplicate pairing(s)`),await Promise.all(no.map(io=>this.client.core.pairing.disconnect({topic:io.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(ro){this.client.logger.error(ro)}},this.deleteSession=async to=>{const{topic:ro,expirerHasDeleted:no=!1,emitEvent:io=!0,id:oo=0}=to,{self:ao}=this.client.session.get(ro);await this.client.core.relayer.unsubscribe(ro),await this.client.session.delete(ro,U$6("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(ao.publicKey)&&await this.client.core.crypto.deleteKeyPair(ao.publicKey),this.client.core.crypto.keychain.has(ro)&&await this.client.core.crypto.deleteSymKey(ro),no||this.client.core.expirer.del(ro),this.client.core.storage.removeItem(H$3).catch(so=>this.client.logger.warn(so)),this.getPendingSessionRequests().forEach(so=>{so.topic===ro&&this.deletePendingSessionRequest(so.id,U$6("USER_DISCONNECTED"))}),io&&this.client.events.emit("session_delete",{id:oo,topic:ro})},this.deleteProposal=async(to,ro)=>{await Promise.all([this.client.proposal.delete(to,U$6("USER_DISCONNECTED")),ro?Promise.resolve():this.client.core.expirer.del(to)])},this.deletePendingSessionRequest=async(to,ro,no=!1)=>{await Promise.all([this.client.pendingRequest.delete(to,ro),no?Promise.resolve():this.client.core.expirer.del(to)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(io=>io.id!==to),no&&(this.sessionRequestQueue.state=I$1.idle,this.client.events.emit("session_request_expire",{id:to}))},this.setExpiry=async(to,ro)=>{this.client.session.keys.includes(to)&&await this.client.session.update(to,{expiry:ro}),this.client.core.expirer.set(to,ro)},this.setProposal=async(to,ro)=>{await this.client.proposal.set(to,ro),this.client.core.expirer.set(to,pt$3(R$3.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async to=>{const{id:ro,topic:no,params:io,verifyContext:oo}=to,ao=io.request.expiryTimestamp||pt$3(R$3.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(ro,{id:ro,topic:no,params:io,verifyContext:oo}),ao&&this.client.core.expirer.set(ro,ao)},this.sendRequest=async to=>{const{topic:ro,method:no,params:io,expiry:oo,relayRpcId:ao,clientRpcId:so,throwOnFailedPublish:co}=to,lo=formatJsonRpcRequest(no,io,so);if(D$7()&&he$2.includes(no)){const go=Ln$1(JSON.stringify(lo));this.client.core.verify.register({attestationId:go})}const fo=await this.client.core.crypto.encode(ro,lo),ho=R$3[no].req;return oo&&(ho.ttl=oo),ao&&(ho.id=ao),this.client.core.history.set(ro,lo),co?(ho.internal=D$4(g$7({},ho.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(ro,fo,ho)):this.client.core.relayer.publish(ro,fo,ho).catch(go=>this.client.logger.error(go)),lo.id},this.sendResult=async to=>{const{id:ro,topic:no,result:io,throwOnFailedPublish:oo}=to,ao=formatJsonRpcResult(ro,io),so=await this.client.core.crypto.encode(no,ao),co=await this.client.core.history.get(no,ro),lo=R$3[co.request.method].res;oo?(lo.internal=D$4(g$7({},lo.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(no,so,lo)):this.client.core.relayer.publish(no,so,lo).catch(fo=>this.client.logger.error(fo)),await this.client.core.history.resolve(ao)},this.sendError=async(to,ro,no)=>{const io=formatJsonRpcError(to,no),oo=await this.client.core.crypto.encode(ro,io),ao=await this.client.core.history.get(ro,to),so=R$3[ao.request.method].res;this.client.core.relayer.publish(ro,oo,so),await this.client.core.history.resolve(io)},this.cleanup=async()=>{const to=[],ro=[];this.client.session.getAll().forEach(no=>{let io=!1;mt$3(no.expiry)&&(io=!0),this.client.core.crypto.keychain.has(no.topic)||(io=!0),io&&to.push(no.topic)}),this.client.proposal.getAll().forEach(no=>{mt$3(no.expiryTimestamp)&&ro.push(no.id)}),await Promise.all([...to.map(no=>this.deleteSession({topic:no})),...ro.map(no=>this.deleteProposal(no))])},this.onRelayEventRequest=async to=>{this.requestQueue.queue.push(to),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===I$1.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=I$1.active;const to=this.requestQueue.queue.shift();if(to)try{this.processRequest(to),await new Promise(ro=>setTimeout(ro,300))}catch(ro){this.client.logger.warn(ro)}}this.requestQueue.state=I$1.idle},this.processRequest=to=>{const{topic:ro,payload:no}=to,io=no.method;switch(io){case"wc_sessionPropose":return this.onSessionProposeRequest(ro,no);case"wc_sessionSettle":return this.onSessionSettleRequest(ro,no);case"wc_sessionUpdate":return this.onSessionUpdateRequest(ro,no);case"wc_sessionExtend":return this.onSessionExtendRequest(ro,no);case"wc_sessionPing":return this.onSessionPingRequest(ro,no);case"wc_sessionDelete":return this.onSessionDeleteRequest(ro,no);case"wc_sessionRequest":return this.onSessionRequest(ro,no);case"wc_sessionEvent":return this.onSessionEventRequest(ro,no);default:return this.client.logger.info(`Unsupported request method ${io}`)}},this.onRelayEventResponse=async to=>{const{topic:ro,payload:no}=to,io=(await this.client.core.history.get(ro,no.id)).request.method;switch(io){case"wc_sessionPropose":return this.onSessionProposeResponse(ro,no);case"wc_sessionSettle":return this.onSessionSettleResponse(ro,no);case"wc_sessionUpdate":return this.onSessionUpdateResponse(ro,no);case"wc_sessionExtend":return this.onSessionExtendResponse(ro,no);case"wc_sessionPing":return this.onSessionPingResponse(ro,no);case"wc_sessionRequest":return this.onSessionRequestResponse(ro,no);default:return this.client.logger.info(`Unsupported response method ${io}`)}},this.onRelayEventUnknownPayload=to=>{const{topic:ro}=to,{message:no}=N$7("MISSING_OR_INVALID",`Decoded payload on topic ${ro} is not identifiable as a JSON-RPC request or a response.`);throw new Error(no)},this.onSessionProposeRequest=async(to,ro)=>{const{params:no,id:io}=ro;try{this.isValidConnect(g$7({},ro.params));const oo=no.expiryTimestamp||pt$3(R$3.wc_sessionPropose.req.ttl),ao=g$7({id:io,pairingTopic:to,expiryTimestamp:oo},no);await this.setProposal(io,ao);const so=Ln$1(JSON.stringify(ro)),co=await this.getVerifyContext(so,ao.proposer.metadata);this.client.events.emit("session_proposal",{id:io,params:ao,verifyContext:co})}catch(oo){await this.sendError(io,to,oo),this.client.logger.error(oo)}},this.onSessionProposeResponse=async(to,ro)=>{const{id:no}=ro;if(isJsonRpcResult(ro)){const{result:io}=ro;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:io});const oo=this.client.proposal.get(no);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:oo});const ao=oo.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:ao});const so=io.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:so});const co=await this.client.core.crypto.generateSharedKey(ao,so);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:co});const lo=await this.client.core.relayer.subscribe(co);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:lo}),await this.client.core.pairing.activate({topic:to})}else isJsonRpcError(ro)&&(await this.client.proposal.delete(no,U$6("USER_DISCONNECTED")),this.events.emit(yt$3("session_connect"),{error:ro.error}))},this.onSessionSettleRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{this.isValidSessionSettleRequest(io);const{relay:oo,controller:ao,expiry:so,namespaces:co,sessionProperties:lo,pairingTopic:fo}=ro.params,ho=g$7({topic:to,relay:oo,expiry:so,namespaces:co,acknowledged:!0,pairingTopic:fo,requiredNamespaces:{},optionalNamespaces:{},controller:ao.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:ao.publicKey,metadata:ao.metadata}},lo&&{sessionProperties:lo});await this.sendResult({id:ro.id,topic:to,result:!0}),this.events.emit(yt$3("session_connect"),{session:ho}),this.cleanupDuplicatePairings(ho)}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.onSessionSettleResponse=async(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?(await this.client.session.update(to,{acknowledged:!0}),this.events.emit(yt$3("session_approve",no),{})):isJsonRpcError(ro)&&(await this.client.session.delete(to,U$6("USER_DISCONNECTED")),this.events.emit(yt$3("session_approve",no),{error:ro.error}))},this.onSessionUpdateRequest=async(to,ro)=>{const{params:no,id:io}=ro;try{const oo=`${to}_session_update`,ao=sr$3.get(oo);if(ao&&this.isRequestOutOfSync(ao,io)){this.client.logger.info(`Discarding out of sync request - ${io}`);return}this.isValidUpdate(g$7({topic:to},no)),await this.client.session.update(to,{namespaces:no.namespaces}),await this.sendResult({id:io,topic:to,result:!0}),this.client.events.emit("session_update",{id:io,topic:to,params:no}),sr$3.set(oo,io)}catch(oo){await this.sendError(io,to,oo),this.client.logger.error(oo)}},this.isRequestOutOfSync=(to,ro)=>parseInt(ro.toString().slice(0,-3))<=parseInt(to.toString().slice(0,-3)),this.onSessionUpdateResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_update",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_update",no),{error:ro.error})},this.onSessionExtendRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidExtend({topic:to}),await this.setExpiry(to,pt$3(L$7)),await this.sendResult({id:no,topic:to,result:!0}),this.client.events.emit("session_extend",{id:no,topic:to})}catch(io){await this.sendError(no,to,io),this.client.logger.error(io)}},this.onSessionExtendResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_extend",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_extend",no),{error:ro.error})},this.onSessionPingRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidPing({topic:to}),await this.sendResult({id:no,topic:to,result:!0}),this.client.events.emit("session_ping",{id:no,topic:to})}catch(io){await this.sendError(no,to,io),this.client.logger.error(io)}},this.onSessionPingResponse=(to,ro)=>{const{id:no}=ro;setTimeout(()=>{isJsonRpcResult(ro)?this.events.emit(yt$3("session_ping",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_ping",no),{error:ro.error})},500)},this.onSessionDeleteRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidDisconnect({topic:to,reason:ro.params}),await Promise.all([new Promise(io=>{this.client.core.relayer.once(D$5.publish,async()=>{io(await this.deleteSession({topic:to,id:no}))})}),this.sendResult({id:no,topic:to,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:to,error:U$6("USER_DISCONNECTED")})])}catch(io){this.client.logger.error(io)}},this.onSessionRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{this.isValidRequest(g$7({topic:to},io));const oo=Ln$1(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",io,no))),ao=this.client.session.get(to),so=await this.getVerifyContext(oo,ao.peer.metadata),co={id:no,topic:to,params:io,verifyContext:so};await this.setPendingSessionRequest(co),this.addSessionRequestToSessionRequestQueue(co),this.processSessionRequestQueue()}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.onSessionRequestResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_request",no),{result:ro.result}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_request",no),{error:ro.error})},this.onSessionEventRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{const oo=`${to}_session_event_${io.event.name}`,ao=sr$3.get(oo);if(ao&&this.isRequestOutOfSync(ao,no)){this.client.logger.info(`Discarding out of sync request - ${no}`);return}this.isValidEmit(g$7({topic:to},io)),this.client.events.emit("session_event",{id:no,topic:to,params:io}),sr$3.set(oo,no)}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.addSessionRequestToSessionRequestQueue=to=>{this.sessionRequestQueue.queue.push(to)},this.cleanupAfterResponse=to=>{this.deletePendingSessionRequest(to.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=I$1.idle,this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:to,error:ro})=>{const no=this.client.core.history.pending;no.length>0&&no.filter(io=>io.topic===to&&io.request.method==="wc_sessionRequest").forEach(io=>{this.events.emit(yt$3("session_request",io.request.id),{error:ro})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===I$1.active){this.client.logger.info("session request queue is already active.");return}const to=this.sessionRequestQueue.queue[0];if(!to){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=I$1.active,this.client.events.emit("session_request",to)}catch(ro){this.client.logger.error(ro)}},this.onPairingCreated=to=>{if(to.active)return;const ro=this.client.proposal.getAll().find(no=>no.pairingTopic===to.topic);ro&&this.onSessionProposeRequest(to.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:ro.requiredNamespaces,optionalNamespaces:ro.optionalNamespaces,relays:ro.relays,proposer:ro.proposer,sessionProperties:ro.sessionProperties},ro.id))},this.isValidConnect=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(to)}`);throw new Error(so)}const{pairingTopic:ro,requiredNamespaces:no,optionalNamespaces:io,sessionProperties:oo,relays:ao}=to;if(w$9(ro)||await this.isValidPairingTopic(ro),!qt$3(ao)){const{message:so}=N$7("MISSING_OR_INVALID",`connect() relays: ${ao}`);throw new Error(so)}!w$9(no)&&B$5(no)!==0&&this.validateNamespaces(no,"requiredNamespaces"),!w$9(io)&&B$5(io)!==0&&this.validateNamespaces(io,"optionalNamespaces"),w$9(oo)||this.validateSessionProps(oo,"sessionProperties")},this.validateNamespaces=(to,ro)=>{const no=Ht$3(to,"connect()",ro);if(no)throw new Error(no.message)},this.isValidApprove=async to=>{if(!Gt$3(to))throw new Error(N$7("MISSING_OR_INVALID",`approve() params: ${to}`).message);const{id:ro,namespaces:no,relayProtocol:io,sessionProperties:oo}=to;await this.isValidProposalId(ro);const ao=this.client.proposal.get(ro),so=ln$1(no,"approve()");if(so)throw new Error(so.message);const co=fn$1(ao.requiredNamespaces,no,"approve()");if(co)throw new Error(co.message);if(!g$b(io,!0)){const{message:lo}=N$7("MISSING_OR_INVALID",`approve() relayProtocol: ${io}`);throw new Error(lo)}w$9(oo)||this.validateSessionProps(oo,"sessionProperties")},this.isValidReject=async to=>{if(!Gt$3(to)){const{message:io}=N$7("MISSING_OR_INVALID",`reject() params: ${to}`);throw new Error(io)}const{id:ro,reason:no}=to;if(await this.isValidProposalId(ro),!Wt$2(no)){const{message:io}=N$7("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(no)}`);throw new Error(io)}},this.isValidSessionSettleRequest=to=>{if(!Gt$3(to)){const{message:co}=N$7("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${to}`);throw new Error(co)}const{relay:ro,controller:no,namespaces:io,expiry:oo}=to;if(!dn$1(ro)){const{message:co}=N$7("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(co)}const ao=Ft$3(no,"onSessionSettleRequest()");if(ao)throw new Error(ao.message);const so=ln$1(io,"onSessionSettleRequest()");if(so)throw new Error(so.message);if(mt$3(oo)){const{message:co}=N$7("EXPIRED","onSessionSettleRequest()");throw new Error(co)}},this.isValidUpdate=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`update() params: ${to}`);throw new Error(so)}const{topic:ro,namespaces:no}=to;await this.isValidSessionTopic(ro);const io=this.client.session.get(ro),oo=ln$1(no,"update()");if(oo)throw new Error(oo.message);const ao=fn$1(io.requiredNamespaces,no,"update()");if(ao)throw new Error(ao.message)},this.isValidExtend=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`extend() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionTopic(ro)},this.isValidRequest=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`request() params: ${to}`);throw new Error(so)}const{topic:ro,request:no,chainId:io,expiry:oo}=to;await this.isValidSessionTopic(ro);const{namespaces:ao}=this.client.session.get(ro);if(!Qt$2(ao,io)){const{message:so}=N$7("MISSING_OR_INVALID",`request() chainId: ${io}`);throw new Error(so)}if(!zt$3(no)){const{message:so}=N$7("MISSING_OR_INVALID",`request() ${JSON.stringify(no)}`);throw new Error(so)}if(!Zt$2(ao,io,no.method)){const{message:so}=N$7("MISSING_OR_INVALID",`request() method: ${no.method}`);throw new Error(so)}if(oo&&!tr$3(oo,U$5)){const{message:so}=N$7("MISSING_OR_INVALID",`request() expiry: ${oo}. Expiry must be a number (in seconds) between ${U$5.min} and ${U$5.max}`);throw new Error(so)}},this.isValidRespond=async to=>{var ro;if(!Gt$3(to)){const{message:oo}=N$7("MISSING_OR_INVALID",`respond() params: ${to}`);throw new Error(oo)}const{topic:no,response:io}=to;try{await this.isValidSessionTopic(no)}catch(oo){throw(ro=to==null?void 0:to.response)!=null&&ro.id&&this.cleanupAfterResponse(to),oo}if(!Yt$3(io)){const{message:oo}=N$7("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(io)}`);throw new Error(oo)}},this.isValidPing=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`ping() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionOrPairingTopic(ro)},this.isValidEmit=async to=>{if(!Gt$3(to)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() params: ${to}`);throw new Error(ao)}const{topic:ro,event:no,chainId:io}=to;await this.isValidSessionTopic(ro);const{namespaces:oo}=this.client.session.get(ro);if(!Qt$2(oo,io)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() chainId: ${io}`);throw new Error(ao)}if(!Jt$3(no)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(no)}`);throw new Error(ao)}if(!Xt$2(oo,io,no.name)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(no)}`);throw new Error(ao)}},this.isValidDisconnect=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`disconnect() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionOrPairingTopic(ro)},this.getVerifyContext=async(to,ro)=>{const no={verified:{verifyUrl:ro.verifyUrl||F$6,validation:"UNKNOWN",origin:ro.url||""}};try{const io=await this.client.core.verify.resolve({attestationId:to,verifyUrl:ro.verifyUrl});io&&(no.verified.origin=io.origin,no.verified.isScam=io.isScam,no.verified.validation=io.origin===new URL(ro.url).origin?"VALID":"INVALID")}catch(io){this.client.logger.info(io)}return this.client.logger.info(`Verify context: ${JSON.stringify(no)}`),no},this.validateSessionProps=(to,ro)=>{Object.values(to).forEach(no=>{if(!g$b(no,!1)){const{message:io}=N$7("MISSING_OR_INVALID",`${ro} must be in Record format. Received: ${JSON.stringify(no)}`);throw new Error(io)}})}}async isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(D$5.message,async eo=>{const{topic:to,message:ro}=eo;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(ro)))return;const no=await this.client.core.crypto.decode(to,ro);try{isJsonRpcRequest(no)?(this.client.core.history.set(to,no),this.onRelayEventRequest({topic:to,payload:no})):isJsonRpcResponse(no)?(await this.client.core.history.resolve(no),await this.onRelayEventResponse({topic:to,payload:no}),this.client.core.history.delete(to,no.id)):this.onRelayEventUnknownPayload({topic:to,payload:no})}catch(io){this.client.logger.error(io)}})}registerExpirerEvents(){this.client.core.expirer.on(v$5.expired,async eo=>{const{topic:to,id:ro}=ft$4(eo.target);if(ro&&this.client.pendingRequest.keys.includes(ro))return await this.deletePendingSessionRequest(ro,N$7("EXPIRED"),!0);to?this.client.session.keys.includes(to)&&(await this.deleteSession({topic:to,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:to})):ro&&(await this.deleteProposal(ro,!0),this.client.events.emit("proposal_expire",{id:ro}))})}registerPairingEvents(){this.client.core.pairing.events.on(V$2.create,eo=>this.onPairingCreated(eo))}isValidPairingTopic(eo){if(!g$b(eo,!1)){const{message:to}=N$7("MISSING_OR_INVALID",`pairing topic should be a string: ${eo}`);throw new Error(to)}if(!this.client.core.pairing.pairings.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`pairing topic doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.core.pairing.pairings.get(eo).expiry)){const{message:to}=N$7("EXPIRED",`pairing topic: ${eo}`);throw new Error(to)}}async isValidSessionTopic(eo){if(!g$b(eo,!1)){const{message:to}=N$7("MISSING_OR_INVALID",`session topic should be a string: ${eo}`);throw new Error(to)}if(!this.client.session.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`session topic doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.session.get(eo).expiry)){await this.deleteSession({topic:eo});const{message:to}=N$7("EXPIRED",`session topic: ${eo}`);throw new Error(to)}if(!this.client.core.crypto.keychain.has(eo)){const{message:to}=N$7("MISSING_OR_INVALID",`session topic does not exist in keychain: ${eo}`);throw await this.deleteSession({topic:eo}),new Error(to)}}async isValidSessionOrPairingTopic(eo){if(this.client.session.keys.includes(eo))await this.isValidSessionTopic(eo);else if(this.client.core.pairing.pairings.keys.includes(eo))this.isValidPairingTopic(eo);else if(g$b(eo,!1)){const{message:to}=N$7("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${eo}`);throw new Error(to)}else{const{message:to}=N$7("MISSING_OR_INVALID",`session or pairing topic should be a string: ${eo}`);throw new Error(to)}}async isValidProposalId(eo){if(!Bt$3(eo)){const{message:to}=N$7("MISSING_OR_INVALID",`proposal id should be a number: ${eo}`);throw new Error(to)}if(!this.client.proposal.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`proposal id doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.proposal.get(eo).expiryTimestamp)){await this.deleteProposal(eo);const{message:to}=N$7("EXPIRED",`proposal id: ${eo}`);throw new Error(to)}}},us$1=class extends Kt$2{constructor(eo,to){super(eo,to,oe$2,G$3),this.core=eo,this.logger=to}},ge$3=class extends Kt$2{constructor(eo,to){super(eo,to,ce$2,G$3),this.core=eo,this.logger=to}},gs$1=class extends Kt$2{constructor(eo,to){super(eo,to,pe$2,G$3,ro=>ro.id),this.core=eo,this.logger=to}},Q$4=class T_ extends b$6{constructor(eo){super(eo),this.protocol=J$2,this.version=F$5,this.name=M$4.name,this.events=new eventsExports.EventEmitter,this.on=(ro,no)=>this.events.on(ro,no),this.once=(ro,no)=>this.events.once(ro,no),this.off=(ro,no)=>this.events.off(ro,no),this.removeListener=(ro,no)=>this.events.removeListener(ro,no),this.removeAllListeners=ro=>this.events.removeAllListeners(ro),this.connect=async ro=>{try{return await this.engine.connect(ro)}catch(no){throw this.logger.error(no.message),no}},this.pair=async ro=>{try{return await this.engine.pair(ro)}catch(no){throw this.logger.error(no.message),no}},this.approve=async ro=>{try{return await this.engine.approve(ro)}catch(no){throw this.logger.error(no.message),no}},this.reject=async ro=>{try{return await this.engine.reject(ro)}catch(no){throw this.logger.error(no.message),no}},this.update=async ro=>{try{return await this.engine.update(ro)}catch(no){throw this.logger.error(no.message),no}},this.extend=async ro=>{try{return await this.engine.extend(ro)}catch(no){throw this.logger.error(no.message),no}},this.request=async ro=>{try{return await this.engine.request(ro)}catch(no){throw this.logger.error(no.message),no}},this.respond=async ro=>{try{return await this.engine.respond(ro)}catch(no){throw this.logger.error(no.message),no}},this.ping=async ro=>{try{return await this.engine.ping(ro)}catch(no){throw this.logger.error(no.message),no}},this.emit=async ro=>{try{return await this.engine.emit(ro)}catch(no){throw this.logger.error(no.message),no}},this.disconnect=async ro=>{try{return await this.engine.disconnect(ro)}catch(no){throw this.logger.error(no.message),no}},this.find=ro=>{try{return this.engine.find(ro)}catch(no){throw this.logger.error(no.message),no}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(ro){throw this.logger.error(ro.message),ro}},this.name=(eo==null?void 0:eo.name)||M$4.name,this.metadata=(eo==null?void 0:eo.metadata)||Qn$1();const to=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||M$4.logger}));this.core=(eo==null?void 0:eo.core)||new Mr$1(eo),this.logger=E$6(to,this.name),this.session=new ge$3(this.core,this.logger),this.proposal=new us$1(this.core,this.logger),this.pendingRequest=new gs$1(this.core,this.logger),this.engine=new ds$1(this)}static async init(eo){const to=new T_(eo);return await to.initialize(),to}get context(){return y$9(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(eo){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(eo.message),eo}}};var P$5=Object.defineProperty,w$4=Object.defineProperties,E$4=Object.getOwnPropertyDescriptors,c$3=Object.getOwnPropertySymbols,L$6=Object.prototype.hasOwnProperty,O$7=Object.prototype.propertyIsEnumerable,l$5=(Xr,eo,to)=>eo in Xr?P$5(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,p$4=(Xr,eo)=>{for(var to in eo||(eo={}))L$6.call(eo,to)&&l$5(Xr,to,eo[to]);if(c$3)for(var to of c$3(eo))O$7.call(eo,to)&&l$5(Xr,to,eo[to]);return Xr},v$4=(Xr,eo)=>w$4(Xr,E$4(eo));const j$7={Accept:"application/json","Content-Type":"application/json"},T$7="POST",d$6={headers:j$7,method:T$7},g$6=10;let f$7=class{constructor(eo,to=!1){if(this.url=eo,this.disableProviderPing=to,this.events=new eventsExports.EventEmitter,this.isAvailable=!1,this.registering=!1,!isHttpUrl(eo))throw new Error(`Provided URL is not compatible with HTTP connection: ${eo}`);this.url=eo,this.disableProviderPing=to}get connected(){return this.isAvailable}get connecting(){return this.registering}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async open(eo=this.url){await this.register(eo)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(eo){this.isAvailable||await this.register();try{const to=safeJsonStringify(eo),ro=await(await fetchTransport(this.url,v$4(p$4({},d$6),{body:to}))).json();this.onPayload({data:ro})}catch(to){this.onError(eo.id,to)}}async register(eo=this.url){if(!isHttpUrl(eo))throw new Error(`Provided URL is not compatible with HTTP connection: ${eo}`);if(this.registering){const to=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=to||this.events.listenerCount("open")>=to)&&this.events.setMaxListeners(to+1),new Promise((ro,no)=>{this.events.once("register_error",io=>{this.resetMaxListeners(),no(io)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return no(new Error("HTTP connection is missing or invalid"));ro()})})}this.url=eo,this.registering=!0;try{if(!this.disableProviderPing){const to=safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});await fetchTransport(eo,v$4(p$4({},d$6),{body:to}))}this.onOpen()}catch(to){const ro=this.parseError(to);throw this.events.emit("register_error",ro),this.onClose(),ro}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(eo){if(typeof eo.data>"u")return;const to=typeof eo.data=="string"?safeJsonParse(eo.data):eo.data;this.events.emit("payload",to)}onError(eo,to){const ro=this.parseError(to),no=ro.message||ro.toString(),io=formatJsonRpcError(eo,no);this.events.emit("payload",io)}parseError(eo,to=this.url){return parseConnectionError(eo,to,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g$6&&this.events.setMaxListeners(g$6)}};class JsonRpcProvider extends r$4{constructor(eo){super(eo),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(eo),this.connection.connected&&this.registerEventListeners()}async connect(eo=this.connection){await this.open(eo)}async disconnect(){await this.close()}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async request(eo,to){return this.requestStrict(formatJsonRpcRequest(eo.method,eo.params||[],eo.id||getBigIntRpcId().toString()),to)}async requestStrict(eo,to){return new Promise(async(ro,no)=>{if(!this.connection.connected)try{await this.open()}catch(io){no(io)}this.events.on(`${eo.id}`,io=>{isJsonRpcError(io)?no(io.error):ro(io.result)});try{await this.connection.send(eo,to)}catch(io){no(io)}})}setConnection(eo=this.connection){return eo}onPayload(eo){this.events.emit("payload",eo),isJsonRpcResponse(eo)?this.events.emit(`${eo.id}`,eo):this.events.emit("message",{type:eo.method,data:eo.params})}onClose(eo){eo&&eo.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${eo.code} ${eo.reason?`(${eo.reason})`:""}`)),this.events.emit("disconnect")}async open(eo=this.connection){this.connection===eo&&this.connection.connected||(this.connection.connected&&this.close(),typeof eo=="string"&&(await this.connection.open(eo),eo=this.connection),this.connection=this.setConnection(eo),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",eo=>this.onPayload(eo)),this.connection.on("close",eo=>this.onClose(eo)),this.connection.on("error",eo=>this.events.emit("error",eo)),this.connection.on("register_error",eo=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const Ia="error",Fg="wss://relay.walletconnect.com",Mg="wc",qg="universal_provider",xa=`${Mg}@2:${qg}:`,Bg="https://rpc.walletconnect.com/v1/",Vn$1={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ge$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},Ui$1={exports:{}};/** +***************************************************************************** */var extendStatics=function(Xr,eo){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(to,ro){to.__proto__=ro}||function(to,ro){for(var no in ro)ro.hasOwnProperty(no)&&(to[no]=ro[no])},extendStatics(Xr,eo)};function __extends(Xr,eo){extendStatics(Xr,eo);function to(){this.constructor=Xr}Xr.prototype=eo===null?Object.create(eo):(to.prototype=eo.prototype,new to)}var __assign=function(){return __assign=Object.assign||function(eo){for(var to,ro=1,no=arguments.length;ro=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io}function __param(Xr,eo){return function(to,ro){eo(to,ro,Xr)}}function __metadata(Xr,eo){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Xr,eo)}function __awaiter$7(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,eo||[])).next())})}function __generator(Xr,eo){var to={label:0,sent:function(){if(io[0]&1)throw io[1];return io[1]},trys:[],ops:[]},ro,no,io,oo;return oo={next:ao(0),throw:ao(1),return:ao(2)},typeof Symbol=="function"&&(oo[Symbol.iterator]=function(){return this}),oo;function ao(co){return function(lo){return so([co,lo])}}function so(co){if(ro)throw new TypeError("Generator is already executing.");for(;to;)try{if(ro=1,no&&(io=co[0]&2?no.return:co[0]?no.throw||((io=no.return)&&io.call(no),0):no.next)&&!(io=io.call(no,co[1])).done)return io;switch(no=0,io&&(co=[co[0]&2,io.value]),co[0]){case 0:case 1:io=co;break;case 4:return to.label++,{value:co[1],done:!1};case 5:to.label++,no=co[1],co=[0];continue;case 7:co=to.ops.pop(),to.trys.pop();continue;default:if(io=to.trys,!(io=io.length>0&&io[io.length-1])&&(co[0]===6||co[0]===2)){to=0;continue}if(co[0]===3&&(!io||co[1]>io[0]&&co[1]=Xr.length&&(Xr=void 0),{value:Xr&&Xr[ro++],done:!Xr}}};throw new TypeError(eo?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(Xr,eo){var to=typeof Symbol=="function"&&Xr[Symbol.iterator];if(!to)return Xr;var ro=to.call(Xr),no,io=[],oo;try{for(;(eo===void 0||eo-- >0)&&!(no=ro.next()).done;)io.push(no.value)}catch(ao){oo={error:ao}}finally{try{no&&!no.done&&(to=ro.return)&&to.call(ro)}finally{if(oo)throw oo.error}}return io}function __spread(){for(var Xr=[],eo=0;eo1||ao(ho,go)})})}function ao(ho,go){try{so(ro[ho](go))}catch(bo){uo(io[0][3],bo)}}function so(ho){ho.value instanceof __await?Promise.resolve(ho.value.v).then(co,lo):uo(io[0][2],ho)}function co(ho){ao("next",ho)}function lo(ho){ao("throw",ho)}function uo(ho,go){ho(go),io.shift(),io.length&&ao(io[0][0],io[0][1])}}function __asyncDelegator(Xr){var eo,to;return eo={},ro("next"),ro("throw",function(no){throw no}),ro("return"),eo[Symbol.iterator]=function(){return this},eo;function ro(no,io){eo[no]=Xr[no]?function(oo){return(to=!to)?{value:__await(Xr[no](oo)),done:no==="return"}:io?io(oo):oo}:io}}function __asyncValues(Xr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var eo=Xr[Symbol.asyncIterator],to;return eo?eo.call(Xr):(Xr=typeof __values=="function"?__values(Xr):Xr[Symbol.iterator](),to={},ro("next"),ro("throw"),ro("return"),to[Symbol.asyncIterator]=function(){return this},to);function ro(io){to[io]=Xr[io]&&function(oo){return new Promise(function(ao,so){oo=Xr[io](oo),no(ao,so,oo.done,oo.value)})}}function no(io,oo,ao,so){Promise.resolve(so).then(function(co){io({value:co,done:ao})},oo)}}function __makeTemplateObject(Xr,eo){return Object.defineProperty?Object.defineProperty(Xr,"raw",{value:eo}):Xr.raw=eo,Xr}function __importStar$1(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)Object.hasOwnProperty.call(Xr,to)&&(eo[to]=Xr[to]);return eo.default=Xr,eo}function __importDefault$5(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}}function __classPrivateFieldGet(Xr,eo){if(!eo.has(Xr))throw new TypeError("attempted to get private field on non-instance");return eo.get(Xr)}function __classPrivateFieldSet(Xr,eo,to){if(!eo.has(Xr))throw new TypeError("attempted to set private field on non-instance");return eo.set(Xr,to),to}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter:__awaiter$7,__classPrivateFieldGet,__classPrivateFieldSet,__createBinding:__createBinding$1,__decorate:__decorate$1,__exportStar,__extends,__generator,__importDefault:__importDefault$5,__importStar:__importStar$1,__makeTemplateObject,__metadata,__param,__read,__rest:__rest$3,__spread,__spreadArrays,__values},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var crypto$2={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$2;hasRequiredCrypto=1,Object.defineProperty(crypto$2,"__esModule",{value:!0}),crypto$2.isBrowserCryptoAvailable=crypto$2.getSubtleCrypto=crypto$2.getBrowerCrypto=void 0;function Xr(){return(commonjsGlobal==null?void 0:commonjsGlobal.crypto)||(commonjsGlobal==null?void 0:commonjsGlobal.msCrypto)||{}}crypto$2.getBrowerCrypto=Xr;function eo(){const ro=Xr();return ro.subtle||ro.webkitSubtle}crypto$2.getSubtleCrypto=eo;function to(){return!!Xr()&&!!eo()}return crypto$2.isBrowserCryptoAvailable=to,crypto$2}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0;function Xr(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}env.isReactNative=Xr;function eo(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}env.isNode=eo;function to(){return!Xr()&&!eo()}return env.isBrowser=to,env}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});const eo=require$$0$4;eo.__exportStar(requireCrypto(),Xr),eo.__exportStar(requireEnv(),Xr)})(cjs);function payloadId(Xr=3){const eo=Date.now()*Math.pow(10,Xr),to=Math.floor(Math.random()*Math.pow(10,Xr));return eo+to}function getBigIntRpcId(Xr=6){return BigInt(payloadId(Xr))}function formatJsonRpcRequest(Xr,eo,to){return{id:to||payloadId(),jsonrpc:"2.0",method:Xr,params:eo}}function formatJsonRpcResult(Xr,eo){return{id:Xr,jsonrpc:"2.0",result:eo}}function formatJsonRpcError(Xr,eo,to){return{id:Xr,jsonrpc:"2.0",error:formatErrorMessage(eo)}}function formatErrorMessage(Xr,eo){return typeof Xr>"u"?getError(INTERNAL_ERROR):(typeof Xr=="string"&&(Xr=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:Xr})),isReservedErrorCode(Xr.code)&&(Xr=getErrorByCode(Xr.code)),Xr)}let e$3=class{},n$2=class extends e$3{constructor(){super()}},r$4=class extends n$2{constructor(eo){super()}};const HTTP_REGEX="^https?:",WS_REGEX="^wss?:";function getUrlProtocol(Xr){const eo=Xr.match(new RegExp(/^\w+:/,"gi"));if(!(!eo||!eo.length))return eo[0]}function matchRegexProtocol(Xr,eo){const to=getUrlProtocol(Xr);return typeof to>"u"?!1:new RegExp(eo).test(to)}function isHttpUrl(Xr){return matchRegexProtocol(Xr,HTTP_REGEX)}function isWsUrl(Xr){return matchRegexProtocol(Xr,WS_REGEX)}function isLocalhostUrl(Xr){return new RegExp("wss?://localhost(:d{2,5})?").test(Xr)}function isJsonRpcPayload(Xr){return typeof Xr=="object"&&"id"in Xr&&"jsonrpc"in Xr&&Xr.jsonrpc==="2.0"}function isJsonRpcRequest(Xr){return isJsonRpcPayload(Xr)&&"method"in Xr}function isJsonRpcResponse(Xr){return isJsonRpcPayload(Xr)&&(isJsonRpcResult(Xr)||isJsonRpcError(Xr))}function isJsonRpcResult(Xr){return"result"in Xr}function isJsonRpcError(Xr){return"error"in Xr}let JsonRpcProvider$1=class extends r$4{constructor(eo){super(eo),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(eo),this.connection.connected&&this.registerEventListeners()}async connect(eo=this.connection){await this.open(eo)}async disconnect(){await this.close()}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async request(eo,to){return this.requestStrict(formatJsonRpcRequest(eo.method,eo.params||[],eo.id||getBigIntRpcId().toString()),to)}async requestStrict(eo,to){return new Promise(async(ro,no)=>{if(!this.connection.connected)try{await this.open()}catch(io){no(io)}this.events.on(`${eo.id}`,io=>{isJsonRpcError(io)?no(io.error):ro(io.result)});try{await this.connection.send(eo,to)}catch(io){no(io)}})}setConnection(eo=this.connection){return eo}onPayload(eo){this.events.emit("payload",eo),isJsonRpcResponse(eo)?this.events.emit(`${eo.id}`,eo):this.events.emit("message",{type:eo.method,data:eo.params})}onClose(eo){eo&&eo.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${eo.code} ${eo.reason?`(${eo.reason})`:""}`)),this.events.emit("disconnect")}async open(eo=this.connection){this.connection===eo&&this.connection.connected||(this.connection.connected&&this.close(),typeof eo=="string"&&(await this.connection.open(eo),eo=this.connection),this.connection=this.setConnection(eo),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",eo=>this.onPayload(eo)),this.connection.on("close",eo=>this.onClose(eo)),this.connection.on("error",eo=>this.events.emit("error",eo)),this.connection.on("register_error",eo=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const w$6=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$5=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$4=Xr=>Xr.split("?")[0],h$5=10,S$5=w$6();let f$8=class{constructor(eo){if(this.url=eo,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(eo))throw new Error(`Provided URL is not compatible with WebSocket connection: ${eo}`);this.url=eo}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async open(eo=this.url){await this.register(eo)}async close(){return new Promise((eo,to)=>{if(typeof this.socket>"u"){to(new Error("Connection already closed"));return}this.socket.onclose=ro=>{this.onClose(ro),eo()},this.socket.close()})}async send(eo){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify(eo))}catch(to){this.onError(eo.id,to)}}register(eo=this.url){if(!isWsUrl(eo))throw new Error(`Provided URL is not compatible with WebSocket connection: ${eo}`);if(this.registering){const to=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=to||this.events.listenerCount("open")>=to)&&this.events.setMaxListeners(to+1),new Promise((ro,no)=>{this.events.once("register_error",io=>{this.resetMaxListeners(),no(io)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return no(new Error("WebSocket connection is missing or invalid"));ro(this.socket)})})}return this.url=eo,this.registering=!0,new Promise((to,ro)=>{const no=new URLSearchParams(eo).get("origin"),io=cjs.isReactNative()?{headers:{origin:no}}:{rejectUnauthorized:!isLocalhostUrl(eo)},oo=new S$5(eo,[],io);b$5()?oo.onerror=ao=>{const so=ao;ro(this.emitError(so.error))}:oo.on("error",ao=>{ro(this.emitError(ao))}),oo.onopen=()=>{this.onOpen(oo),to(oo)}})}onOpen(eo){eo.onmessage=to=>this.onPayload(to),eo.onclose=to=>this.onClose(to),this.socket=eo,this.registering=!1,this.events.emit("open")}onClose(eo){this.socket=void 0,this.registering=!1,this.events.emit("close",eo)}onPayload(eo){if(typeof eo.data>"u")return;const to=typeof eo.data=="string"?safeJsonParse(eo.data):eo.data;this.events.emit("payload",to)}onError(eo,to){const ro=this.parseError(to),no=ro.message||ro.toString(),io=formatJsonRpcError(eo,no);this.events.emit("payload",io)}parseError(eo,to=this.url){return parseConnectionError(eo,a$4(to),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$5&&this.events.setMaxListeners(h$5)}emitError(eo){const to=this.parseError(new Error((eo==null?void 0:eo.message)||`WebSocket connection failed for host: ${a$4(this.url)}`));return this.events.emit("register_error",to),to}};var lodash_isequal={exports:{}};lodash_isequal.exports;(function(Xr,eo){var to=200,ro="__lodash_hash_undefined__",no=1,io=2,oo=9007199254740991,ao="[object Arguments]",so="[object Array]",co="[object AsyncFunction]",lo="[object Boolean]",uo="[object Date]",ho="[object Error]",go="[object Function]",bo="[object GeneratorFunction]",wo="[object Map]",Eo="[object Number]",$o="[object Null]",Co="[object Object]",Ro="[object Promise]",Oo="[object Proxy]",jo="[object RegExp]",Bo="[object Set]",Mo="[object String]",Fo="[object Symbol]",Wo="[object Undefined]",Jo="[object WeakMap]",Po="[object ArrayBuffer]",fo="[object DataView]",yo="[object Float32Array]",vo="[object Float64Array]",_o="[object Int8Array]",So="[object Int16Array]",To="[object Int32Array]",Ao="[object Uint8Array]",ko="[object Uint8ClampedArray]",mo="[object Uint16Array]",Io="[object Uint32Array]",Do=/[\\^$.*+?()[\]{}|]/g,Lo=/^\[object .+?Constructor\]$/,Ho=/^(?:0|[1-9]\d*)$/,Yo={};Yo[yo]=Yo[vo]=Yo[_o]=Yo[So]=Yo[To]=Yo[Ao]=Yo[ko]=Yo[mo]=Yo[Io]=!0,Yo[ao]=Yo[so]=Yo[Po]=Yo[lo]=Yo[fo]=Yo[uo]=Yo[ho]=Yo[go]=Yo[wo]=Yo[Eo]=Yo[Co]=Yo[jo]=Yo[Bo]=Yo[Mo]=Yo[Jo]=!1;var Xo=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,qo=typeof self=="object"&&self&&self.Object===Object&&self,Ko=Xo||qo||Function("return this")(),Qo=eo&&!eo.nodeType&&eo,zo=Qo&&!0&&Xr&&!Xr.nodeType&&Xr,ga=zo&&zo.exports===Qo,$a=ga&&Xo.process,Sl=function(){try{return $a&&$a.binding&&$a.binding("util")}catch{}}(),El=Sl&&Sl.isTypedArray;function Tl(ou,Eu){for(var Wu=-1,up=ou==null?0:ou.length,Op=0,Ip=[];++Wu-1}function _d(ou,Eu){var Wu=this.__data__,up=Hu(Wu,ou);return up<0?(++this.size,Wu.push([ou,Eu])):Wu[up][1]=Eu,this}Nu.prototype.clear=Pu,Nu.prototype.delete=ip,Nu.prototype.get=Lu,Nu.prototype.has=Yu,Nu.prototype.set=_d;function Qu(ou){var Eu=-1,Wu=ou==null?0:ou.length;for(this.clear();++EuAm))return!1;var Xp=Ip.get(ou);if(Xp&&Ip.get(Eu))return Xp==Eu;var nm=-1,Hm=!0,Sm=Wu&io?new Vu:void 0;for(Ip.set(ou,Eu),Ip.set(Eu,ou);++nm-1&&ou%1==0&&ou-1&&ou%1==0&&ou<=oo}function ey(ou){var Eu=typeof ou;return ou!=null&&(Eu=="object"||Eu=="function")}function T0(ou){return ou!=null&&typeof ou=="object"}var ty=El?Ol(El):Rp;function zy(ou){return X0(ou)?Bu(ou):Np(ou)}function vp(){return[]}function yp(){return!1}Xr.exports=f0})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const Gi$1=getDefaultExportFromCjs$2(lodash_isequalExports);function unfetch_module(Xr,eo){return eo=eo||{},new Promise(function(to,ro){var no=new XMLHttpRequest,io=[],oo=[],ao={},so=function(){return{ok:(no.status/100|0)==2,statusText:no.statusText,status:no.status,url:no.responseURL,text:function(){return Promise.resolve(no.responseText)},json:function(){return Promise.resolve(no.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([no.response]))},clone:so,headers:{keys:function(){return io},entries:function(){return oo},get:function(lo){return ao[lo.toLowerCase()]},has:function(lo){return lo.toLowerCase()in ao}}}};for(var co in no.open(eo.method||"get",Xr,!0),no.onload=function(){no.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(lo,uo,ho){io.push(uo=uo.toLowerCase()),oo.push([uo,ho]),ao[uo]=ao[uo]?ao[uo]+","+ho:ho}),to(so())},no.onerror=ro,no.withCredentials=eo.credentials=="include",eo.headers)no.setRequestHeader(co,eo.headers[co]);no.send(eo.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$3=getAugmentedNamespace(unfetch_module$1);var browser$2=self.fetch||(self.fetch=require$$0$3.default||require$$0$3);const Yi$1=getDefaultExportFromCjs$2(browser$2);var define_process_env_default$3={};function Hi$1(Xr,eo){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var to=new Uint8Array(256),ro=0;ro>>0,Oo=new Uint8Array(Ro);$o!==Co;){for(var jo=bo[$o],Bo=0,Mo=Ro-1;(jo!==0||Bo>>0,Oo[Mo]=jo%ao>>>0,jo=jo/ao>>>0;if(jo!==0)throw new Error("Non-zero carry");Eo=Bo,$o++}for(var Fo=Ro-Eo;Fo!==Ro&&Oo[Fo]===0;)Fo++;for(var Wo=so.repeat(wo);Fo>>0,Ro=new Uint8Array(Co);bo[wo];){var Oo=to[bo.charCodeAt(wo)];if(Oo===255)return;for(var jo=0,Bo=Co-1;(Oo!==0||jo<$o)&&Bo!==-1;Bo--,jo++)Oo+=ao*Ro[Bo]>>>0,Ro[Bo]=Oo%256>>>0,Oo=Oo/256>>>0;if(Oo!==0)throw new Error("Non-zero carry");$o=jo,wo++}if(bo[wo]!==" "){for(var Mo=Co-$o;Mo!==Co&&Ro[Mo]===0;)Mo++;for(var Fo=new Uint8Array(Eo+(Co-Mo)),Wo=Eo;Mo!==Co;)Fo[Wo++]=Ro[Mo++];return Fo}}}function go(bo){var wo=ho(bo);if(wo)return wo;throw new Error(`Non-${eo} character`)}return{encode:uo,decodeUnsafe:ho,decode:go}}var Ji$1=Hi$1,Xi$1=Ji$1;const Ne$2=Xr=>{if(Xr instanceof Uint8Array&&Xr.constructor.name==="Uint8Array")return Xr;if(Xr instanceof ArrayBuffer)return new Uint8Array(Xr);if(ArrayBuffer.isView(Xr))return new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength);throw new Error("Unknown type, must be binary type")},Wi$2=Xr=>new TextEncoder().encode(Xr),Qi$1=Xr=>new TextDecoder().decode(Xr);let Zi$1=class{constructor(eo,to,ro){this.name=eo,this.prefix=to,this.baseEncode=ro}encode(eo){if(eo instanceof Uint8Array)return`${this.prefix}${this.baseEncode(eo)}`;throw Error("Unknown type, must be binary type")}},es$1=class{constructor(eo,to,ro){if(this.name=eo,this.prefix=to,to.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=to.codePointAt(0),this.baseDecode=ro}decode(eo){if(typeof eo=="string"){if(eo.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(eo)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(eo.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(eo){return Ue$2(this,eo)}},ts$1=class{constructor(eo){this.decoders=eo}or(eo){return Ue$2(this,eo)}decode(eo){const to=eo[0],ro=this.decoders[to];if(ro)return ro.decode(eo);throw RangeError(`Unable to decode multibase string ${JSON.stringify(eo)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Ue$2=(Xr,eo)=>new ts$1({...Xr.decoders||{[Xr.prefix]:Xr},...eo.decoders||{[eo.prefix]:eo}});let is$6=class{constructor(eo,to,ro,no){this.name=eo,this.prefix=to,this.baseEncode=ro,this.baseDecode=no,this.encoder=new Zi$1(eo,to,ro),this.decoder=new es$1(eo,to,no)}encode(eo){return this.encoder.encode(eo)}decode(eo){return this.decoder.decode(eo)}};const W$4=({name:Xr,prefix:eo,encode:to,decode:ro})=>new is$6(Xr,eo,to,ro),B$4=({prefix:Xr,name:eo,alphabet:to})=>{const{encode:ro,decode:no}=Xi$1(to,eo);return W$4({prefix:Xr,name:eo,encode:ro,decode:io=>Ne$2(no(io))})},ss$1=(Xr,eo,to,ro)=>{const no={};for(let lo=0;lo=8&&(ao-=8,oo[co++]=255&so>>ao)}if(ao>=to||255&so<<8-ao)throw new SyntaxError("Unexpected end of data");return oo},rs$1=(Xr,eo,to)=>{const ro=eo[eo.length-1]==="=",no=(1<to;)oo-=to,io+=eo[no&ao>>oo];if(oo&&(io+=eo[no&ao<W$4({prefix:eo,name:Xr,encode(no){return rs$1(no,ro,to)},decode(no){return ss$1(no,ro,to,Xr)}}),ns$1=W$4({prefix:"\0",name:"identity",encode:Xr=>Qi$1(Xr),decode:Xr=>Wi$2(Xr)});var os$1=Object.freeze({__proto__:null,identity:ns$1});const as$2=g$8({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs$2=Object.freeze({__proto__:null,base2:as$2});const cs$2=g$8({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var us$2=Object.freeze({__proto__:null,base8:cs$2});const ls$2=B$4({prefix:"9",name:"base10",alphabet:"0123456789"});var ds$2=Object.freeze({__proto__:null,base10:ls$2});const gs$2=g$8({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps$2=g$8({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds$1=Object.freeze({__proto__:null,base16:gs$2,base16upper:ps$2});const ys$1=g$8({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms$1=g$8({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs$1=g$8({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs$1=g$8({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es$1=g$8({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws$2=g$8({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs$1=g$8({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is$1=g$8({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs$1=g$8({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rs$1=Object.freeze({__proto__:null,base32:ys$1,base32upper:ms$1,base32pad:bs$1,base32padupper:fs$1,base32hex:Es$1,base32hexupper:ws$2,base32hexpad:vs$1,base32hexpadupper:Is$1,base32z:Cs$1});const _s$1=B$4({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ts$1=B$4({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss$1=Object.freeze({__proto__:null,base36:_s$1,base36upper:Ts$1});const Ps$1=B$4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs$1=B$4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os$1=Object.freeze({__proto__:null,base58btc:Ps$1,base58flickr:xs$1});const As$1=g$8({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs$1=g$8({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns$1=g$8({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Us$1=g$8({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ls$1=Object.freeze({__proto__:null,base64:As$1,base64pad:zs$1,base64url:Ns$1,base64urlpad:Us$1});const Le$2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),$s$1=Le$2.reduce((Xr,eo,to)=>(Xr[to]=eo,Xr),[]),Fs$1=Le$2.reduce((Xr,eo,to)=>(Xr[eo.codePointAt(0)]=to,Xr),[]);function Ms$1(Xr){return Xr.reduce((eo,to)=>(eo+=$s$1[to],eo),"")}function ks$1(Xr){const eo=[];for(const to of Xr){const ro=Fs$1[to.codePointAt(0)];if(ro===void 0)throw new Error(`Non-base256emoji character: ${to}`);eo.push(ro)}return new Uint8Array(eo)}const Ks$1=W$4({prefix:"🚀",name:"base256emoji",encode:Ms$1,decode:ks$1});var Bs$1=Object.freeze({__proto__:null,base256emoji:Ks$1}),Vs$1=Fe$2,$e$1=128,qs$1=127,js$2=~qs$1,Gs$1=Math.pow(2,31);function Fe$2(Xr,eo,to){eo=eo||[],to=to||0;for(var ro=to;Xr>=Gs$1;)eo[to++]=Xr&255|$e$1,Xr/=128;for(;Xr&js$2;)eo[to++]=Xr&255|$e$1,Xr>>>=7;return eo[to]=Xr|0,Fe$2.bytes=to-ro+1,eo}var Ys$1=he$3,Hs$1=128,Me=127;function he$3(Xr,ro){var to=0,ro=ro||0,no=0,io=ro,oo,ao=Xr.length;do{if(io>=ao)throw he$3.bytes=0,new RangeError("Could not decode varint");oo=Xr[io++],to+=no<28?(oo&Me)<=Hs$1);return he$3.bytes=io-ro,to}var Js$1=Math.pow(2,7),Xs$1=Math.pow(2,14),Ws$1=Math.pow(2,21),Qs$1=Math.pow(2,28),Zs$1=Math.pow(2,35),er$2=Math.pow(2,42),tr$2=Math.pow(2,49),ir$2=Math.pow(2,56),sr$2=Math.pow(2,63),rr$2=function(Xr){return Xr(ke$2.encode(Xr,eo,to),eo),Be$2=Xr=>ke$2.encodingLength(Xr),ce$3=(Xr,eo)=>{const to=eo.byteLength,ro=Be$2(Xr),no=ro+Be$2(to),io=new Uint8Array(no+to);return Ke$1(Xr,io,0),Ke$1(to,io,ro),io.set(eo,no),new or$1(Xr,to,eo,io)};let or$1=class{constructor(eo,to,ro,no){this.code=eo,this.size=to,this.digest=ro,this.bytes=no}};const Ve$2=({name:Xr,code:eo,encode:to})=>new ar$2(Xr,eo,to);let ar$2=class{constructor(eo,to,ro){this.name=eo,this.code=to,this.encode=ro}digest(eo){if(eo instanceof Uint8Array){const to=this.encode(eo);return to instanceof Uint8Array?ce$3(this.code,to):to.then(ro=>ce$3(this.code,ro))}else throw Error("Unknown type, must be binary type")}};const qe$2=Xr=>async eo=>new Uint8Array(await crypto.subtle.digest(Xr,eo)),hr$2=Ve$2({name:"sha2-256",code:18,encode:qe$2("SHA-256")}),cr$3=Ve$2({name:"sha2-512",code:19,encode:qe$2("SHA-512")});var ur$2=Object.freeze({__proto__:null,sha256:hr$2,sha512:cr$3});const je$2=0,lr$3="identity",Ge$2=Ne$2,dr$2=Xr=>ce$3(je$2,Ge$2(Xr)),gr$2={code:je$2,name:lr$3,encode:Ge$2,digest:dr$2};var pr$1=Object.freeze({__proto__:null,identity:gr$2});new TextEncoder,new TextDecoder;const Ye$2={...os$1,...hs$2,...us$2,...ds$2,...Ds$1,...Rs$1,...Ss$1,...Os$1,...Ls$1,...Bs$1};({...ur$2,...pr$1});function He$2(Xr){return globalThis.Buffer!=null?new Uint8Array(Xr.buffer,Xr.byteOffset,Xr.byteLength):Xr}function Dr$1(Xr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?He$2(globalThis.Buffer.allocUnsafe(Xr)):new Uint8Array(Xr)}function Je$1(Xr,eo,to,ro){return{name:Xr,prefix:eo,encoder:{name:Xr,prefix:eo,encode:to},decoder:{decode:ro}}}const Xe$2=Je$1("utf8","u",Xr=>"u"+new TextDecoder("utf8").decode(Xr),Xr=>new TextEncoder().encode(Xr.substring(1))),ue$3=Je$1("ascii","a",Xr=>{let eo="a";for(let to=0;to{Xr=Xr.substring(1);const eo=Dr$1(Xr.length);for(let to=0;to{if(!this.initialized){const ro=await this.getKeyChain();typeof ro<"u"&&(this.keychain=ro),this.initialized=!0}},this.has=ro=>(this.isInitialized(),this.keychain.has(ro)),this.set=async(ro,no)=>{this.isInitialized(),this.keychain.set(ro,no),await this.persist()},this.get=ro=>{this.isInitialized();const no=this.keychain.get(ro);if(typeof no>"u"){const{message:io}=N$7("NO_MATCHING_KEY",`${this.name}: ${ro}`);throw new Error(io)}return no},this.del=async ro=>{this.isInitialized(),this.keychain.delete(ro),await this.persist()},this.core=eo,this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(eo){await this.core.storage.setItem(this.storageKey,rt$3(eo))}async getKeyChain(){const eo=await this.core.storage.getItem(this.storageKey);return typeof eo<"u"?ot$2(eo):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},xt$2=class{constructor(eo,to,ro){this.core=eo,this.logger=to,this.name=et$1,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=no=>(this.isInitialized(),this.keychain.has(no)),this.getClientId=async()=>{this.isInitialized();const no=await this.getClientSeed(),io=generateKeyPair$1(no);return encodeIss(io.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const no=kn$1();return this.setPrivateKey(no.publicKey,no.privateKey)},this.signJWT=async no=>{this.isInitialized();const io=await this.getClientSeed(),oo=generateKeyPair$1(io),ao=Vn$2();return await signJWT(ao,no,tt$1,oo)},this.generateSharedKey=(no,io,oo)=>{this.isInitialized();const ao=this.getPrivateKey(no),so=Mn$1(ao,io);return this.setSymKey(so,oo)},this.setSymKey=async(no,io)=>{this.isInitialized();const oo=io||Kn$1(no);return await this.keychain.set(oo,no),oo},this.deleteKeyPair=async no=>{this.isInitialized(),await this.keychain.del(no)},this.deleteSymKey=async no=>{this.isInitialized(),await this.keychain.del(no)},this.encode=async(no,io,oo)=>{this.isInitialized();const ao=Ae$1(oo),so=safeJsonStringify(io);if(qn$1(ao)){const ho=ao.senderPublicKey,go=ao.receiverPublicKey;no=await this.generateSharedKey(ho,go)}const co=this.getSymKey(no),{type:lo,senderPublicKey:uo}=ao;return xn$1({type:lo,symKey:co,message:so,senderPublicKey:uo})},this.decode=async(no,io,oo)=>{this.isInitialized();const ao=Hn$1(io,oo);if(qn$1(ao)){const so=ao.receiverPublicKey,co=ao.senderPublicKey;no=await this.generateSharedKey(so,co)}try{const so=this.getSymKey(no),co=Fn$1({symKey:so,encoded:io});return safeJsonParse(co)}catch(so){this.logger.error(`Failed to decode message from topic: '${no}', clientId: '${await this.getClientId()}'`),this.logger.error(so)}},this.getPayloadType=no=>{const io=ee$4(no);return j$9(io.type)},this.getPayloadSenderPublicKey=no=>{const io=ee$4(no);return io.senderPublicKey?toString$2(io.senderPublicKey,p$7):void 0},this.core=eo,this.logger=E$6(to,this.name),this.keychain=ro||new Pt$2(this.core,this.logger)}get context(){return y$9(this.logger)}async setPrivateKey(eo,to){return await this.keychain.set(eo,to),eo}getPrivateKey(eo){return this.keychain.get(eo)}async getClientSeed(){let eo="";try{eo=this.keychain.get(de$3)}catch{eo=Vn$2(),await this.keychain.set(de$3,eo)}return mr$1(eo,"base16")}getSymKey(eo){return this.keychain.get(eo)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},Ot$2=class extends a$5{constructor(eo,to){super(eo,to),this.logger=eo,this.core=to,this.messages=new Map,this.name=rt$2,this.version=nt$2,this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const ro=await this.getRelayerMessages();typeof ro<"u"&&(this.messages=ro),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(ro){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(ro)}finally{this.initialized=!0}}},this.set=async(ro,no)=>{this.isInitialized();const io=Ln$1(no);let oo=this.messages.get(ro);return typeof oo>"u"&&(oo={}),typeof oo[io]<"u"||(oo[io]=no,this.messages.set(ro,oo),await this.persist()),io},this.get=ro=>{this.isInitialized();let no=this.messages.get(ro);return typeof no>"u"&&(no={}),no},this.has=(ro,no)=>{this.isInitialized();const io=this.get(ro),oo=Ln$1(no);return typeof io[oo]<"u"},this.del=async ro=>{this.isInitialized(),this.messages.delete(ro),await this.persist()},this.logger=E$6(eo,this.name),this.core=to}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(eo){await this.core.storage.setItem(this.storageKey,rt$3(eo))}async getRelayerMessages(){const eo=await this.core.storage.getItem(this.storageKey);return typeof eo<"u"?ot$2(eo):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},vr$1=class extends u$5{constructor(eo,to){super(eo,to),this.relayer=eo,this.logger=to,this.events=new eventsExports.EventEmitter,this.name=at$2,this.queue=new Map,this.publishTimeout=cjs$4.toMiliseconds(cjs$4.TEN_SECONDS*2),this.needsTransportRestart=!1,this.publish=async(ro,no,io)=>{var oo;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:ro,message:no,opts:io}});try{const ao=(io==null?void 0:io.ttl)||ot$1,so=vt$3(io),co=(io==null?void 0:io.prompt)||!1,lo=(io==null?void 0:io.tag)||0,uo=(io==null?void 0:io.id)||getBigIntRpcId().toString(),ho={topic:ro,message:no,opts:{ttl:ao,relay:so,prompt:co,tag:lo,id:uo}},go=setTimeout(()=>this.queue.set(uo,ho),this.publishTimeout);try{await await ut$5(this.rpcPublish(ro,no,ao,so,co,lo,uo),this.publishTimeout,`Failed to publish payload, please try again. id:${uo} tag:${lo}`),this.removeRequestFromQueue(uo),this.relayer.events.emit(D$5.publish,ho)}catch(bo){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(oo=io==null?void 0:io.internal)!=null&&oo.throwOnFailedPublish)throw this.removeRequestFromQueue(uo),bo;return}finally{clearTimeout(go)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:ro,message:no,opts:io}})}catch(ao){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(ao),ao}},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.relayer=eo,this.logger=E$6(to,this.name),this.registerEventListeners()}get context(){return y$9(this.logger)}rpcPublish(eo,to,ro,no,io,oo,ao){var so,co,lo,uo;const ho={method:Et$3(no.protocol).publish,params:{topic:eo,message:to,ttl:ro,prompt:io,tag:oo},id:ao};return w$9((so=ho.params)==null?void 0:so.prompt)&&((co=ho.params)==null||delete co.prompt),w$9((lo=ho.params)==null?void 0:lo.tag)&&((uo=ho.params)==null||delete uo.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:ho}),this.relayer.request(ho)}removeRequestFromQueue(eo){this.queue.delete(eo)}checkQueue(){this.queue.forEach(async eo=>{const{topic:to,message:ro,opts:no}=eo;await this.publish(to,ro,no)})}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(D$5.connection_stalled);return}this.checkQueue()}),this.relayer.on(D$5.message_ack,eo=>{this.removeRequestFromQueue(eo.id.toString())})}},Ir$1=class{constructor(){this.map=new Map,this.set=(eo,to)=>{const ro=this.get(eo);this.exists(eo,to)||this.map.set(eo,[...ro,to])},this.get=eo=>this.map.get(eo)||[],this.exists=(eo,to)=>this.get(eo).includes(to),this.delete=(eo,to)=>{if(typeof to>"u"){this.map.delete(eo);return}if(!this.map.has(eo))return;const ro=this.get(eo);if(!this.exists(eo,to))return;const no=ro.filter(io=>io!==to);if(!no.length){this.map.delete(eo);return}this.map.set(eo,no)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}};var Cr$1=Object.defineProperty,Rr$1=Object.defineProperties,_r$1=Object.getOwnPropertyDescriptors,At$1=Object.getOwnPropertySymbols,Tr$1=Object.prototype.hasOwnProperty,Sr$1=Object.prototype.propertyIsEnumerable,zt$2=(Xr,eo,to)=>eo in Xr?Cr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,q$6=(Xr,eo)=>{for(var to in eo||(eo={}))Tr$1.call(eo,to)&&zt$2(Xr,to,eo[to]);if(At$1)for(var to of At$1(eo))Sr$1.call(eo,to)&&zt$2(Xr,to,eo[to]);return Xr},De$2=(Xr,eo)=>Rr$1(Xr,_r$1(eo));let Nt$2=class extends d$7{constructor(eo,to){super(eo,to),this.relayer=eo,this.logger=to,this.subscriptions=new Map,this.topicMap=new Ir$1,this.events=new eventsExports.EventEmitter,this.name=mt$2,this.version=bt$2,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=O$8,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(ro,no)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:ro,opts:no}});try{const io=vt$3(no),oo={topic:ro,relay:io};this.pending.set(ro,oo);const ao=await this.rpcSubscribe(ro,io);return this.onSubscribe(ao,oo),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:ro,opts:no}}),ao}catch(io){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(io),io}},this.unsubscribe=async(ro,no)=>{await this.restartToComplete(),this.isInitialized(),typeof(no==null?void 0:no.id)<"u"?await this.unsubscribeById(ro,no.id,no):await this.unsubscribeByTopic(ro,no)},this.isSubscribed=async ro=>{if(this.topics.includes(ro))return!0;const no=`${this.pendingSubscriptionWatchLabel}_${ro}`;return await new Promise((io,oo)=>{const ao=new cjs$4.Watch;ao.start(no);const so=setInterval(()=>{!this.pending.has(ro)&&this.topics.includes(ro)&&(clearInterval(so),ao.stop(no),io(!0)),ao.elapsed(no)>=ft$3&&(clearInterval(so),ao.stop(no),oo(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=eo,this.logger=E$6(to,this.name),this.clientId=""}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(eo,to){let ro=!1;try{ro=this.getSubscription(eo).topic===to}catch{}return ro}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(eo,to){const ro=this.topicMap.get(eo);await Promise.all(ro.map(async no=>await this.unsubscribeById(eo,no,to)))}async unsubscribeById(eo,to,ro){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:eo,id:to,opts:ro}});try{const no=vt$3(ro);await this.rpcUnsubscribe(eo,to,no);const io=U$6("USER_DISCONNECTED",`${this.name}, ${eo}`);await this.onUnsubscribe(eo,to,io),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:eo,id:to,opts:ro}})}catch(no){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(no),no}}async rpcSubscribe(eo,to){const ro={method:Et$3(to.protocol).subscribe,params:{topic:eo}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:ro});try{await await ut$5(this.relayer.request(ro),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(D$5.connection_stalled)}return Ln$1(eo+this.clientId)}async rpcBatchSubscribe(eo){if(!eo.length)return;const to=eo[0].relay,ro={method:Et$3(to.protocol).batchSubscribe,params:{topics:eo.map(no=>no.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:ro});try{return await await ut$5(this.relayer.request(ro),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(D$5.connection_stalled)}}rpcUnsubscribe(eo,to,ro){const no={method:Et$3(ro.protocol).unsubscribe,params:{topic:eo,id:to}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:no}),this.relayer.request(no)}onSubscribe(eo,to){this.setSubscription(eo,De$2(q$6({},to),{id:eo})),this.pending.delete(to.topic)}onBatchSubscribe(eo){eo.length&&eo.forEach(to=>{this.setSubscription(to.id,q$6({},to)),this.pending.delete(to.topic)})}async onUnsubscribe(eo,to,ro){this.events.removeAllListeners(to),this.hasSubscription(to,eo)&&this.deleteSubscription(to,ro),await this.relayer.messages.del(eo)}async setRelayerSubscriptions(eo){await this.relayer.core.storage.setItem(this.storageKey,eo)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(eo,to){this.subscriptions.has(eo)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:eo,subscription:to}),this.addSubscription(eo,to))}addSubscription(eo,to){this.subscriptions.set(eo,q$6({},to)),this.topicMap.set(to.topic,eo),this.events.emit(w$5.created,to)}getSubscription(eo){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:eo});const to=this.subscriptions.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw new Error(ro)}return to}deleteSubscription(eo,to){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:eo,reason:to});const ro=this.getSubscription(eo);this.subscriptions.delete(eo),this.topicMap.delete(ro.topic,eo),this.events.emit(w$5.deleted,De$2(q$6({},ro),{reason:to}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(w$5.sync)}async reset(){if(this.cached.length){const eo=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let to=0;to"u"||!eo.length)return;if(this.subscriptions.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(eo){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(eo)}}async batchSubscribe(eo){if(!eo.length)return;const to=await this.rpcBatchSubscribe(eo);k$4(to)&&this.onBatchSubscribe(to.map((ro,no)=>De$2(q$6({},eo[no]),{id:ro})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const eo=[];this.pending.forEach(to=>{eo.push(to)}),await this.batchSubscribe(eo)}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(D$5.connect,async()=>{await this.onConnect()}),this.relayer.on(D$5.disconnect,()=>{this.onDisconnect()}),this.events.on(w$5.created,async eo=>{const to=w$5.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),await this.persist()}),this.events.on(w$5.deleted,async eo=>{const to=w$5.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}async restartToComplete(){this.restartInProgress&&await new Promise(eo=>{const to=setInterval(()=>{this.restartInProgress||(clearInterval(to),eo())},this.pollingInterval)})}};var Pr$1=Object.defineProperty,Ut$2=Object.getOwnPropertySymbols,xr$1=Object.prototype.hasOwnProperty,Or$1=Object.prototype.propertyIsEnumerable,Lt$1=(Xr,eo,to)=>eo in Xr?Pr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,Ar$1=(Xr,eo)=>{for(var to in eo||(eo={}))xr$1.call(eo,to)&&Lt$1(Xr,to,eo[to]);if(Ut$2)for(var to of Ut$2(eo))Or$1.call(eo,to)&&Lt$1(Xr,to,eo[to]);return Xr};let $t$2=class extends g$9{constructor(eo){super(eo),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ut$4,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.request=async to=>{this.logger.debug("Publishing Request Payload");const ro=to.id;try{await this.toEstablishConnection();const no=this.provider.request(to);return this.requestsInFlight.set(ro,{promise:no,request:to}),await no}catch(no){throw this.logger.debug("Failed to Publish Request"),this.logger.error(no),no}finally{this.requestsInFlight.delete(ro)}},this.onPayloadHandler=to=>{this.onProviderPayload(to)},this.onConnectHandler=()=>{this.events.emit(D$5.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=to=>{this.logger.error(to),this.events.emit(D$5.error,to),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(P$6.payload,this.onPayloadHandler),this.provider.on(P$6.connect,this.onConnectHandler),this.provider.on(P$6.disconnect,this.onDisconnectHandler),this.provider.on(P$6.error,this.onProviderErrorHandler)},this.core=eo.core,this.logger=typeof eo.logger<"u"&&typeof eo.logger!="string"?E$6(eo.logger,this.name):Hg(k$2({level:eo.logger||ct$2})),this.messages=new Ot$2(this.logger,eo.core),this.subscriber=new Nt$2(this,this.logger),this.publisher=new vr$1(this,this.logger),this.relayUrl=(eo==null?void 0:eo.relayUrl)||ge$4,this.projectId=eo.projectId,this.bundleId=Jn$1(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${pe$3}...`),await this.restartTransport(pe$3)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},pt$2)}get context(){return y$9(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(eo,to,ro){this.isInitialized(),await this.publisher.publish(eo,to,ro),await this.recordMessageEvent({topic:eo,message:to,publishedAt:Date.now()})}async subscribe(eo,to){var ro;this.isInitialized();let no=((ro=this.subscriber.topicMap.get(eo))==null?void 0:ro[0])||"";if(no)return no;let io;const oo=ao=>{ao.topic===eo&&(this.subscriber.off(w$5.created,oo),io())};return await Promise.all([new Promise(ao=>{io=ao,this.subscriber.on(w$5.created,oo)}),new Promise(async ao=>{no=await this.subscriber.subscribe(eo,to),ao()})]),no}async unsubscribe(eo,to){this.isInitialized(),await this.subscriber.unsubscribe(eo,to)}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async transportClose(){this.requestsInFlight.size>0&&(this.logger.debug("Waiting for all in-flight requests to finish before closing transport..."),this.requestsInFlight.forEach(async eo=>{await eo.promise})),this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ut$5(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(eo){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){eo&&eo!==this.relayUrl&&(this.relayUrl=eo,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(to=>{if(!this.initialized)return to();this.subscriber.once(w$5.resubscribed,()=>{to()})}),new Promise(async(to,ro)=>{try{await ut$5(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(no){ro(no);return}to()})])}catch(to){this.logger.error(to);const ro=to;if(!this.isConnectionStalled(ro.message))throw to;this.provider.events.emit(P$6.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(eo){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=eo||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await rr$3())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(eo){return this.staleConnectionErrors.some(to=>eo.includes(to))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const eo=await this.core.crypto.signJWT(this.relayUrl);this.provider=new JsonRpcProvider$1(new f$8(Xn$1({sdkVersion:gt$2,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:eo,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(eo){const{topic:to,message:ro}=eo;await this.messages.set(to,ro)}async shouldIgnoreMessageEvent(eo){const{topic:to,message:ro}=eo;if(!ro||ro.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${ro}`),!0;if(!await this.subscriber.isSubscribed(to))return this.logger.debug(`Ignoring message for non-subscribed topic ${to}`),!0;const no=this.messages.has(to,ro);return no&&this.logger.debug(`Ignoring duplicate message: ${ro}`),no}async onProviderPayload(eo){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:eo}),isJsonRpcRequest(eo)){if(!eo.method.endsWith(lt$2))return;const to=eo.params,{topic:ro,message:no,publishedAt:io}=to.data,oo={topic:ro,message:no,publishedAt:io};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar$1({type:"event",event:to.id},oo)),this.events.emit(to.id,oo),await this.acknowledgePayload(eo),await this.onMessageEvent(oo)}else isJsonRpcResponse(eo)&&this.events.emit(D$5.message_ack,eo)}async onMessageEvent(eo){await this.shouldIgnoreMessageEvent(eo)||(this.events.emit(D$5.message,eo),await this.recordMessageEvent(eo))}async acknowledgePayload(eo){const to=formatJsonRpcResult(eo.id,!0);await this.provider.connection.send(to)}unregisterProviderListeners(){this.provider.off(P$6.payload,this.onPayloadHandler),this.provider.off(P$6.connect,this.onConnectHandler),this.provider.off(P$6.disconnect,this.onDisconnectHandler),this.provider.off(P$6.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(D$5.connection_stalled,()=>{this.restartTransport().catch(to=>this.logger.error(to))});let eo=await rr$3();or$2(async to=>{this.initialized&&eo!==to&&(eo=to,to?await this.restartTransport().catch(ro=>this.logger.error(ro)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(ro=>this.logger.error(ro))))})}onProviderDisconnect(){this.events.emit(D$5.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(eo=>this.logger.error(eo))},cjs$4.toMiliseconds(dt$2)))}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(eo=>{const to=setInterval(()=>{this.connected&&(clearInterval(to),eo())},this.connectionStatusPollingInterval)});await this.restartTransport()}}};var zr$1=Object.defineProperty,Ft$2=Object.getOwnPropertySymbols,Nr$1=Object.prototype.hasOwnProperty,Ur$1=Object.prototype.propertyIsEnumerable,Mt$1=(Xr,eo,to)=>eo in Xr?zr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,kt$2=(Xr,eo)=>{for(var to in eo||(eo={}))Nr$1.call(eo,to)&&Mt$1(Xr,to,eo[to]);if(Ft$2)for(var to of Ft$2(eo))Ur$1.call(eo,to)&&Mt$1(Xr,to,eo[to]);return Xr};let Kt$2=class extends p$5{constructor(eo,to,ro,no=O$8,io=void 0){super(eo,to,ro,no),this.core=eo,this.logger=to,this.name=ro,this.map=new Map,this.version=Dt$2,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(oo=>{this.getKey&&oo!==null&&!w$9(oo)?this.map.set(this.getKey(oo),oo):Lt$2(oo)?this.map.set(oo.id,oo):xt$3(oo)&&this.map.set(oo.topic,oo)}),this.cached=[],this.initialized=!0)},this.set=async(oo,ao)=>{this.isInitialized(),this.map.has(oo)?await this.update(oo,ao):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:oo,value:ao}),this.map.set(oo,ao),await this.persist())},this.get=oo=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:oo}),this.getData(oo)),this.getAll=oo=>(this.isInitialized(),oo?this.values.filter(ao=>Object.keys(oo).every(so=>Gi$1(ao[so],oo[so]))):this.values),this.update=async(oo,ao)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:oo,update:ao});const so=kt$2(kt$2({},this.getData(oo)),ao);this.map.set(oo,so),await this.persist()},this.delete=async(oo,ao)=>{this.isInitialized(),this.map.has(oo)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:oo,reason:ao}),this.map.delete(oo),await this.persist())},this.logger=E$6(to,this.name),this.storagePrefix=no,this.getKey=io}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(eo){await this.core.storage.setItem(this.storageKey,eo)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(eo){const to=this.map.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw this.logger.error(ro),new Error(ro)}return to}async persist(){await this.setDataStore(this.values)}async restore(){try{const eo=await this.getDataStore();if(typeof eo>"u"||!eo.length)return;if(this.map.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(eo){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(eo)}}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},Bt$2=class{constructor(eo,to){this.core=eo,this.logger=to,this.name=Et$2,this.version=wt$2,this.events=new EventEmitter$1,this.initialized=!1,this.storagePrefix=O$8,this.ignoredPayloadTypes=[_$9],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:ro})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...ro])]},this.create=async()=>{this.isInitialized();const ro=Vn$2(),no=await this.core.crypto.setSymKey(ro),io=pt$3(cjs$4.FIVE_MINUTES),oo={protocol:ht$2},ao={topic:no,expiry:io,relay:oo,active:!1},so=Rt$3({protocol:this.core.protocol,version:this.core.version,topic:no,symKey:ro,relay:oo,expiryTimestamp:io});return await this.pairings.set(no,ao),await this.core.relayer.subscribe(no),this.core.expirer.set(no,io),{topic:no,uri:so}},this.pair=async ro=>{this.isInitialized(),this.isValidPair(ro);const{topic:no,symKey:io,relay:oo,expiryTimestamp:ao}=Pt$3(ro.uri);let so;if(this.pairings.keys.includes(no)&&(so=this.pairings.get(no),so.active))throw new Error(`Pairing already exists: ${no}. Please try again with a new connection URI.`);const co=ao||pt$3(cjs$4.FIVE_MINUTES),lo={topic:no,relay:oo,expiry:co,active:!1};return await this.pairings.set(no,lo),this.core.expirer.set(no,co),ro.activatePairing&&await this.activate({topic:no}),this.events.emit(V$2.create,lo),this.core.crypto.keychain.has(no)||(await this.core.crypto.setSymKey(io,no),await this.core.relayer.subscribe(no,{relay:oo})),lo},this.activate=async({topic:ro})=>{this.isInitialized();const no=pt$3(cjs$4.THIRTY_DAYS);await this.pairings.update(ro,{active:!0,expiry:no}),this.core.expirer.set(ro,no)},this.ping=async ro=>{this.isInitialized(),await this.isValidPing(ro);const{topic:no}=ro;if(this.pairings.keys.includes(no)){const io=await this.sendRequest(no,"wc_pairingPing",{}),{done:oo,resolve:ao,reject:so}=at$3();this.events.once(yt$3("pairing_ping",io),({error:co})=>{co?so(co):ao()}),await oo()}},this.updateExpiry=async({topic:ro,expiry:no})=>{this.isInitialized(),await this.pairings.update(ro,{expiry:no})},this.updateMetadata=async({topic:ro,metadata:no})=>{this.isInitialized(),await this.pairings.update(ro,{peerMetadata:no})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async ro=>{this.isInitialized(),await this.isValidDisconnect(ro);const{topic:no}=ro;this.pairings.keys.includes(no)&&(await this.sendRequest(no,"wc_pairingDelete",U$6("USER_DISCONNECTED")),await this.deletePairing(no))},this.sendRequest=async(ro,no,io)=>{const oo=formatJsonRpcRequest(no,io),ao=await this.core.crypto.encode(ro,oo),so=$$4[no].req;return this.core.history.set(ro,oo),this.core.relayer.publish(ro,ao,so),oo.id},this.sendResult=async(ro,no,io)=>{const oo=formatJsonRpcResult(ro,io),ao=await this.core.crypto.encode(no,oo),so=await this.core.history.get(no,ro),co=$$4[so.request.method].res;await this.core.relayer.publish(no,ao,co),await this.core.history.resolve(oo)},this.sendError=async(ro,no,io)=>{const oo=formatJsonRpcError(ro,io),ao=await this.core.crypto.encode(no,oo),so=await this.core.history.get(no,ro),co=$$4[so.request.method]?$$4[so.request.method].res:$$4.unregistered_method.res;await this.core.relayer.publish(no,ao,co),await this.core.history.resolve(oo)},this.deletePairing=async(ro,no)=>{await this.core.relayer.unsubscribe(ro),await Promise.all([this.pairings.delete(ro,U$6("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(ro),no?Promise.resolve():this.core.expirer.del(ro)])},this.cleanup=async()=>{const ro=this.pairings.getAll().filter(no=>mt$3(no.expiry));await Promise.all(ro.map(no=>this.deletePairing(no.topic)))},this.onRelayEventRequest=ro=>{const{topic:no,payload:io}=ro;switch(io.method){case"wc_pairingPing":return this.onPairingPingRequest(no,io);case"wc_pairingDelete":return this.onPairingDeleteRequest(no,io);default:return this.onUnknownRpcMethodRequest(no,io)}},this.onRelayEventResponse=async ro=>{const{topic:no,payload:io}=ro,oo=(await this.core.history.get(no,io.id)).request.method;switch(oo){case"wc_pairingPing":return this.onPairingPingResponse(no,io);default:return this.onUnknownRpcMethodResponse(oo)}},this.onPairingPingRequest=async(ro,no)=>{const{id:io}=no;try{this.isValidPing({topic:ro}),await this.sendResult(io,ro,!0),this.events.emit(V$2.ping,{id:io,topic:ro})}catch(oo){await this.sendError(io,ro,oo),this.logger.error(oo)}},this.onPairingPingResponse=(ro,no)=>{const{id:io}=no;setTimeout(()=>{isJsonRpcResult(no)?this.events.emit(yt$3("pairing_ping",io),{}):isJsonRpcError(no)&&this.events.emit(yt$3("pairing_ping",io),{error:no.error})},500)},this.onPairingDeleteRequest=async(ro,no)=>{const{id:io}=no;try{this.isValidDisconnect({topic:ro}),await this.deletePairing(ro),this.events.emit(V$2.delete,{id:io,topic:ro})}catch(oo){await this.sendError(io,ro,oo),this.logger.error(oo)}},this.onUnknownRpcMethodRequest=async(ro,no)=>{const{id:io,method:oo}=no;try{if(this.registeredMethods.includes(oo))return;const ao=U$6("WC_METHOD_UNSUPPORTED",oo);await this.sendError(io,ro,ao),this.logger.error(ao)}catch(ao){await this.sendError(io,ro,ao),this.logger.error(ao)}},this.onUnknownRpcMethodResponse=ro=>{this.registeredMethods.includes(ro)||this.logger.error(U$6("WC_METHOD_UNSUPPORTED",ro))},this.isValidPair=ro=>{var no;if(!Gt$3(ro)){const{message:oo}=N$7("MISSING_OR_INVALID",`pair() params: ${ro}`);throw new Error(oo)}if(!Kt$3(ro.uri)){const{message:oo}=N$7("MISSING_OR_INVALID",`pair() uri: ${ro.uri}`);throw new Error(oo)}const io=Pt$3(ro.uri);if(!((no=io==null?void 0:io.relay)!=null&&no.protocol)){const{message:oo}=N$7("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(oo)}if(!(io!=null&&io.symKey)){const{message:oo}=N$7("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(oo)}if(io!=null&&io.expiryTimestamp&&cjs$4.toMiliseconds(io==null?void 0:io.expiryTimestamp){if(!Gt$3(ro)){const{message:io}=N$7("MISSING_OR_INVALID",`ping() params: ${ro}`);throw new Error(io)}const{topic:no}=ro;await this.isValidPairingTopic(no)},this.isValidDisconnect=async ro=>{if(!Gt$3(ro)){const{message:io}=N$7("MISSING_OR_INVALID",`disconnect() params: ${ro}`);throw new Error(io)}const{topic:no}=ro;await this.isValidPairingTopic(no)},this.isValidPairingTopic=async ro=>{if(!g$b(ro,!1)){const{message:no}=N$7("MISSING_OR_INVALID",`pairing topic should be a string: ${ro}`);throw new Error(no)}if(!this.pairings.keys.includes(ro)){const{message:no}=N$7("NO_MATCHING_KEY",`pairing topic doesn't exist: ${ro}`);throw new Error(no)}if(mt$3(this.pairings.get(ro).expiry)){await this.deletePairing(ro);const{message:no}=N$7("EXPIRED",`pairing topic: ${ro}`);throw new Error(no)}},this.core=eo,this.logger=E$6(to,this.name),this.pairings=new Kt$2(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$9(this.logger)}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}registerRelayerEvents(){this.core.relayer.on(D$5.message,async eo=>{const{topic:to,message:ro}=eo;if(!this.pairings.keys.includes(to)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(ro)))return;const no=await this.core.crypto.decode(to,ro);try{isJsonRpcRequest(no)?(this.core.history.set(to,no),this.onRelayEventRequest({topic:to,payload:no})):isJsonRpcResponse(no)&&(await this.core.history.resolve(no),await this.onRelayEventResponse({topic:to,payload:no}),this.core.history.delete(to,no.id))}catch(io){this.logger.error(io)}})}registerExpirerEvents(){this.core.expirer.on(v$5.expired,async eo=>{const{topic:to}=ft$4(eo.target);to&&this.pairings.keys.includes(to)&&(await this.deletePairing(to,!0),this.events.emit(V$2.expire,{topic:to}))})}},Vt$2=class extends h$6{constructor(eo,to){super(eo,to),this.core=eo,this.logger=to,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=vt$2,this.version=It$1,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(ro=>this.records.set(ro.id,ro)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(ro,no,io)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:ro,request:no,chainId:io}),this.records.has(no.id))return;const oo={id:no.id,topic:ro,request:{method:no.method,params:no.params||null},chainId:io,expiry:pt$3(cjs$4.THIRTY_DAYS)};this.records.set(oo.id,oo),this.events.emit(R$4.created,oo)},this.resolve=async ro=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:ro}),!this.records.has(ro.id))return;const no=await this.getRecord(ro.id);typeof no.response>"u"&&(no.response=isJsonRpcError(ro)?{error:ro.error}:{result:ro.result},this.records.set(no.id,no),this.events.emit(R$4.updated,no))},this.get=async(ro,no)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:ro,id:no}),await this.getRecord(no)),this.delete=(ro,no)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:no}),this.values.forEach(io=>{if(io.topic===ro){if(typeof no<"u"&&io.id!==no)return;this.records.delete(io.id),this.events.emit(R$4.deleted,io)}})},this.exists=async(ro,no)=>(this.isInitialized(),this.records.has(no)?(await this.getRecord(no)).topic===ro:!1),this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const eo=[];return this.values.forEach(to=>{if(typeof to.response<"u")return;const ro={topic:to.topic,request:formatJsonRpcRequest(to.request.method,to.request.params,to.id),chainId:to.chainId};return eo.push(ro)}),eo}async setJsonRpcRecords(eo){await this.core.storage.setItem(this.storageKey,eo)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(eo){this.isInitialized();const to=this.records.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw new Error(ro)}return to}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(R$4.sync)}async restore(){try{const eo=await this.getJsonRpcRecords();if(typeof eo>"u"||!eo.length)return;if(this.records.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(eo){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(eo)}}registerEventListeners(){this.events.on(R$4.created,eo=>{const to=R$4.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.events.on(R$4.updated,eo=>{const to=R$4.updated;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.events.on(R$4.deleted,eo=>{const to=R$4.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,record:eo}),this.persist()}),this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(eo=>{cjs$4.toMiliseconds(eo.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${eo.id}`),this.delete(eo.topic,eo.id))})}catch(eo){this.logger.warn(eo)}}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},qt$2=class extends E$5{constructor(eo,to){super(eo,to),this.core=eo,this.logger=to,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=Ct$3,this.version=Rt$2,this.cached=[],this.initialized=!1,this.storagePrefix=O$8,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(ro=>this.expirations.set(ro.target,ro)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=ro=>{try{const no=this.formatTarget(ro);return typeof this.getExpiration(no)<"u"}catch{return!1}},this.set=(ro,no)=>{this.isInitialized();const io=this.formatTarget(ro),oo={target:io,expiry:no};this.expirations.set(io,oo),this.checkExpiry(io,oo),this.events.emit(v$5.created,{target:io,expiration:oo})},this.get=ro=>{this.isInitialized();const no=this.formatTarget(ro);return this.getExpiration(no)},this.del=ro=>{if(this.isInitialized(),this.has(ro)){const no=this.formatTarget(ro),io=this.getExpiration(no);this.expirations.delete(no),this.events.emit(v$5.deleted,{target:no,expiration:io})}},this.on=(ro,no)=>{this.events.on(ro,no)},this.once=(ro,no)=>{this.events.once(ro,no)},this.off=(ro,no)=>{this.events.off(ro,no)},this.removeListener=(ro,no)=>{this.events.removeListener(ro,no)},this.logger=E$6(to,this.name)}get context(){return y$9(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(eo){if(typeof eo=="string")return lt$3(eo);if(typeof eo=="number")return dt$3(eo);const{message:to}=N$7("UNKNOWN_TYPE",`Target type: ${typeof eo}`);throw new Error(to)}async setExpirations(eo){await this.core.storage.setItem(this.storageKey,eo)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(v$5.sync)}async restore(){try{const eo=await this.getExpirations();if(typeof eo>"u"||!eo.length)return;if(this.expirations.size){const{message:to}=N$7("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(to),new Error(to)}this.cached=eo,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(eo){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(eo)}}getExpiration(eo){const to=this.expirations.get(eo);if(!to){const{message:ro}=N$7("NO_MATCHING_KEY",`${this.name}: ${eo}`);throw this.logger.error(ro),new Error(ro)}return to}checkExpiry(eo,to){const{expiry:ro}=to;cjs$4.toMiliseconds(ro)-Date.now()<=0&&this.expire(eo,to)}expire(eo,to){this.expirations.delete(eo),this.events.emit(v$5.expired,{target:eo,expiration:to})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((eo,to)=>this.checkExpiry(to,eo))}registerEventListeners(){this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(v$5.created,eo=>{const to=v$5.created;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()}),this.events.on(v$5.expired,eo=>{const to=v$5.expired;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()}),this.events.on(v$5.deleted,eo=>{const to=v$5.deleted;this.logger.info(`Emitting ${to}`),this.logger.debug({type:"event",event:to,data:eo}),this.persist()})}isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}}},jt$1=class extends y$8{constructor(eo,to){super(eo,to),this.projectId=eo,this.logger=to,this.name=Z$2,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async ro=>{if(this.verifyDisabled||$$5()||!D$7())return;const no=this.getVerifyUrl(ro==null?void 0:ro.verifyUrl);this.verifyUrl!==no&&this.removeIframe(),this.verifyUrl=no;try{await this.createIframe()}catch(io){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(io)}if(!this.initialized){this.removeIframe(),this.verifyUrl=ee$3;try{await this.createIframe()}catch(io){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(io),this.verifyDisabled=!0}}},this.register=async ro=>{this.initialized?this.sendPost(ro.attestationId):(this.addToQueue(ro.attestationId),await this.init())},this.resolve=async ro=>{if(this.isDevEnv)return"";const no=this.getVerifyUrl(ro==null?void 0:ro.verifyUrl);let io;try{io=await this.fetchAttestation(ro.attestationId,no)}catch(oo){this.logger.info(`failed to resolve attestation: ${ro.attestationId} from url: ${no}`),this.logger.info(oo),io=await this.fetchAttestation(ro.attestationId,ee$3)}return io},this.fetchAttestation=async(ro,no)=>{this.logger.info(`resolving attestation: ${ro} from url: ${no}`);const io=this.startAbortTimer(cjs$4.ONE_SECOND*2),oo=await fetch(`${no}/attestation/${ro}`,{signal:this.abortController.signal});return clearTimeout(io),oo.status===200?await oo.json():void 0},this.addToQueue=ro=>{this.queue.push(ro)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(ro=>this.sendPost(ro)),this.queue=[])},this.sendPost=ro=>{var no;try{if(!this.iframe)return;(no=this.iframe.contentWindow)==null||no.postMessage(ro,"*"),this.logger.info(`postMessage sent: ${ro} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let ro;const no=io=>{io.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",no),ro())};await Promise.race([new Promise(io=>{if(document.getElementById(Z$2))return io();window.addEventListener("message",no);const oo=document.createElement("iframe");oo.id=Z$2,oo.src=`${this.verifyUrl}/${this.projectId}`,oo.style.display="none",document.body.append(oo),this.iframe=oo,ro=io}),new Promise((io,oo)=>setTimeout(()=>{window.removeEventListener("message",no),oo("verify iframe load timeout")},cjs$4.toMiliseconds(cjs$4.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=ro=>{let no=ro||F$6;return _t$2.includes(no)||(this.logger.info(`verify url: ${no}, not included in trusted list, assigning default: ${F$6}`),no=F$6),no},this.logger=E$6(to,this.name),this.verifyUrl=F$6,this.abortController=new AbortController,this.isDevEnv=te$3()&&define_process_env_default$3.IS_VITEST}get context(){return y$9(this.logger)}startAbortTimer(eo){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$4.toMiliseconds(eo))}},Gt$2=class extends v$6{constructor(eo,to){super(eo,to),this.projectId=eo,this.logger=to,this.context=Tt$2,this.registerDeviceToken=async ro=>{const{clientId:no,token:io,notificationType:oo,enableEncrypted:ao=!1}=ro,so=`${St$2}/${this.projectId}/clients`;await Yi$1(so,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:no,type:oo,token:io,always_raw:ao})})},this.logger=E$6(to,this.context)}};var Lr$1=Object.defineProperty,Yt$2=Object.getOwnPropertySymbols,$r$1=Object.prototype.hasOwnProperty,Fr$1=Object.prototype.propertyIsEnumerable,Ht$2=(Xr,eo,to)=>eo in Xr?Lr$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,Jt$2=(Xr,eo)=>{for(var to in eo||(eo={}))$r$1.call(eo,to)&&Ht$2(Xr,to,eo[to]);if(Yt$2)for(var to of Yt$2(eo))Fr$1.call(eo,to)&&Ht$2(Xr,to,eo[to]);return Xr};let te$2=class cC extends n$3{constructor(eo){super(eo),this.protocol=le$3,this.version=We$2,this.name=Q$5,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(ro,no)=>this.events.on(ro,no),this.once=(ro,no)=>this.events.once(ro,no),this.off=(ro,no)=>this.events.off(ro,no),this.removeListener=(ro,no)=>this.events.removeListener(ro,no),this.projectId=eo==null?void 0:eo.projectId,this.relayUrl=(eo==null?void 0:eo.relayUrl)||ge$4,this.customStoragePrefix=eo!=null&&eo.customStoragePrefix?`:${eo.customStoragePrefix}`:"";const to=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||Qe$2.logger}));this.logger=E$6(to,this.name),this.heartbeat=new cjs$1.HeartBeat,this.crypto=new xt$2(this,this.logger,eo==null?void 0:eo.keychain),this.history=new Vt$2(this,this.logger),this.expirer=new qt$2(this,this.logger),this.storage=eo!=null&&eo.storage?eo.storage:new h$7(Jt$2(Jt$2({},Ze$2),eo==null?void 0:eo.storageOptions)),this.relayer=new $t$2({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Bt$2(this,this.logger),this.verify=new jt$1(this.projectId||"",this.logger),this.echoClient=new Gt$2(this.projectId||"",this.logger)}static async init(eo){const to=new cC(eo);await to.initialize();const ro=await to.crypto.getClientId();return await to.storage.setItem(yt$2,ro),to}get context(){return y$9(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(eo){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,eo),this.logger.error(eo.message),eo}}};const Mr$1=te$2,J$2="wc",F$5=2,X$2="client",G$3=`${J$2}@${F$5}:${X$2}:`,M$4={name:X$2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},H$3="WALLETCONNECT_DEEPLINK_CHOICE",oe$2="proposal",ae$2="Proposal expired",ce$2="session",L$7=cjs$4.SEVEN_DAYS,le$2="engine",R$3={wc_sessionPropose:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1115}}},U$5={min:cjs$4.FIVE_MINUTES,max:cjs$4.SEVEN_DAYS},I$1={idle:"IDLE",active:"ACTIVE"},pe$2="request",he$2=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var as$1=Object.defineProperty,cs$1=Object.defineProperties,ls$1=Object.getOwnPropertyDescriptors,de$2=Object.getOwnPropertySymbols,ps$1=Object.prototype.hasOwnProperty,hs$1=Object.prototype.propertyIsEnumerable,ue$2=(Xr,eo,to)=>eo in Xr?as$1(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,g$7=(Xr,eo)=>{for(var to in eo||(eo={}))ps$1.call(eo,to)&&ue$2(Xr,to,eo[to]);if(de$2)for(var to of de$2(eo))hs$1.call(eo,to)&&ue$2(Xr,to,eo[to]);return Xr},D$4=(Xr,eo)=>cs$1(Xr,ls$1(eo));let ds$1=class extends w$7{constructor(eo){super(eo),this.name=le$2,this.events=new EventEmitter$1,this.initialized=!1,this.ignoredPayloadTypes=[_$9],this.requestQueue={state:I$1.idle,queue:[]},this.sessionRequestQueue={state:I$1.idle,queue:[]},this.requestQueueDelay=cjs$4.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R$3)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay)))},this.connect=async to=>{await this.isInitialized();const ro=D$4(g$7({},to),{requiredNamespaces:to.requiredNamespaces||{},optionalNamespaces:to.optionalNamespaces||{}});await this.isValidConnect(ro);const{pairingTopic:no,requiredNamespaces:io,optionalNamespaces:oo,sessionProperties:ao,relays:so}=ro;let co=no,lo,uo=!1;if(co&&(uo=this.client.core.pairing.pairings.get(co).active),!co||!uo){const{topic:Oo,uri:jo}=await this.client.core.pairing.create();co=Oo,lo=jo}const ho=await this.client.core.crypto.generateKeyPair(),go=R$3.wc_sessionPropose.req.ttl||cjs$4.FIVE_MINUTES,bo=pt$3(go),wo=g$7({requiredNamespaces:io,optionalNamespaces:oo,relays:so??[{protocol:ht$2}],proposer:{publicKey:ho,metadata:this.client.metadata},expiryTimestamp:bo},ao&&{sessionProperties:ao}),{reject:Eo,resolve:$o,done:Co}=at$3(go,ae$2);if(this.events.once(yt$3("session_connect"),async({error:Oo,session:jo})=>{if(Oo)Eo(Oo);else if(jo){jo.self.publicKey=ho;const Bo=D$4(g$7({},jo),{requiredNamespaces:wo.requiredNamespaces,optionalNamespaces:wo.optionalNamespaces});await this.client.session.set(jo.topic,Bo),await this.setExpiry(jo.topic,jo.expiry),co&&await this.client.core.pairing.updateMetadata({topic:co,metadata:jo.peer.metadata}),$o(Bo)}}),!co){const{message:Oo}=N$7("NO_MATCHING_KEY",`connect() pairing topic: ${co}`);throw new Error(Oo)}const Ro=await this.sendRequest({topic:co,method:"wc_sessionPropose",params:wo,throwOnFailedPublish:!0});return await this.setProposal(Ro,g$7({id:Ro},wo)),{uri:lo,approval:Co}},this.pair=async to=>(await this.isInitialized(),await this.client.core.pairing.pair(to)),this.approve=async to=>{await this.isInitialized(),await this.isValidApprove(to);const{id:ro,relayProtocol:no,namespaces:io,sessionProperties:oo}=to,ao=this.client.proposal.get(ro);let{pairingTopic:so,proposer:co,requiredNamespaces:lo,optionalNamespaces:uo}=ao;so=so||"";const ho=await this.client.core.crypto.generateKeyPair(),go=co.publicKey,bo=await this.client.core.crypto.generateSharedKey(ho,go);so&&ro&&(await this.client.core.pairing.updateMetadata({topic:so,metadata:co.metadata}),await this.sendResult({id:ro,topic:so,result:{relay:{protocol:no??"irn"},responderPublicKey:ho}}),await this.client.proposal.delete(ro,U$6("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:so}));const wo=g$7({relay:{protocol:no??"irn"},namespaces:io,pairingTopic:so,controller:{publicKey:ho,metadata:this.client.metadata},expiry:pt$3(L$7)},oo&&{sessionProperties:oo});await this.client.core.relayer.subscribe(bo);const Eo=D$4(g$7({},wo),{topic:bo,requiredNamespaces:lo,optionalNamespaces:uo,pairingTopic:so,acknowledged:!1,self:wo.controller,peer:{publicKey:co.publicKey,metadata:co.metadata},controller:ho});await this.client.session.set(bo,Eo);try{await this.sendRequest({topic:bo,method:"wc_sessionSettle",params:wo,throwOnFailedPublish:!0})}catch($o){throw this.client.logger.error($o),this.client.session.delete(bo,U$6("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(bo),$o}return await this.setExpiry(bo,pt$3(L$7)),{topic:bo,acknowledged:()=>new Promise($o=>setTimeout(()=>$o(this.client.session.get(bo)),500))}},this.reject=async to=>{await this.isInitialized(),await this.isValidReject(to);const{id:ro,reason:no}=to,{pairingTopic:io}=this.client.proposal.get(ro);io&&(await this.sendError(ro,io,no),await this.client.proposal.delete(ro,U$6("USER_DISCONNECTED")))},this.update=async to=>{await this.isInitialized(),await this.isValidUpdate(to);const{topic:ro,namespaces:no}=to,io=await this.sendRequest({topic:ro,method:"wc_sessionUpdate",params:{namespaces:no}}),{done:oo,resolve:ao,reject:so}=at$3();return this.events.once(yt$3("session_update",io),({error:co})=>{co?so(co):ao()}),await this.client.session.update(ro,{namespaces:no}),{acknowledged:oo}},this.extend=async to=>{await this.isInitialized(),await this.isValidExtend(to);const{topic:ro}=to,no=await this.sendRequest({topic:ro,method:"wc_sessionExtend",params:{}}),{done:io,resolve:oo,reject:ao}=at$3();return this.events.once(yt$3("session_extend",no),({error:so})=>{so?ao(so):oo()}),await this.setExpiry(ro,pt$3(L$7)),{acknowledged:io}},this.request=async to=>{await this.isInitialized(),await this.isValidRequest(to);const{chainId:ro,request:no,topic:io,expiry:oo=R$3.wc_sessionRequest.req.ttl}=to,ao=payloadId(),{done:so,resolve:co,reject:lo}=at$3(oo,"Request expired. Please try again.");return this.events.once(yt$3("session_request",ao),({error:uo,result:ho})=>{uo?lo(uo):co(ho)}),await Promise.all([new Promise(async uo=>{await this.sendRequest({clientRpcId:ao,topic:io,method:"wc_sessionRequest",params:{request:D$4(g$7({},no),{expiryTimestamp:pt$3(oo)}),chainId:ro},expiry:oo,throwOnFailedPublish:!0}).catch(ho=>lo(ho)),this.client.events.emit("session_request_sent",{topic:io,request:no,chainId:ro,id:ao}),uo()}),new Promise(async uo=>{const ho=await ht$3(this.client.core.storage,H$3);gt$3({id:ao,topic:io,wcDeepLink:ho}),uo()}),so()]).then(uo=>uo[2])},this.respond=async to=>{await this.isInitialized(),await this.isValidRespond(to);const{topic:ro,response:no}=to,{id:io}=no;isJsonRpcResult(no)?await this.sendResult({id:io,topic:ro,result:no.result,throwOnFailedPublish:!0}):isJsonRpcError(no)&&await this.sendError(io,ro,no.error),this.cleanupAfterResponse(to)},this.ping=async to=>{await this.isInitialized(),await this.isValidPing(to);const{topic:ro}=to;if(this.client.session.keys.includes(ro)){const no=await this.sendRequest({topic:ro,method:"wc_sessionPing",params:{}}),{done:io,resolve:oo,reject:ao}=at$3();this.events.once(yt$3("session_ping",no),({error:so})=>{so?ao(so):oo()}),await io()}else this.client.core.pairing.pairings.keys.includes(ro)&&await this.client.core.pairing.ping({topic:ro})},this.emit=async to=>{await this.isInitialized(),await this.isValidEmit(to);const{topic:ro,event:no,chainId:io}=to;await this.sendRequest({topic:ro,method:"wc_sessionEvent",params:{event:no,chainId:io}})},this.disconnect=async to=>{await this.isInitialized(),await this.isValidDisconnect(to);const{topic:ro}=to;if(this.client.session.keys.includes(ro))await this.sendRequest({topic:ro,method:"wc_sessionDelete",params:U$6("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:ro,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(ro))await this.client.core.pairing.disconnect({topic:ro});else{const{message:no}=N$7("MISMATCHED_TOPIC",`Session or pairing topic not found: ${ro}`);throw new Error(no)}},this.find=to=>(this.isInitialized(),this.client.session.getAll().filter(ro=>Mt$2(ro,to))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async to=>{if(to.pairingTopic)try{const ro=this.client.core.pairing.pairings.get(to.pairingTopic),no=this.client.core.pairing.pairings.getAll().filter(io=>{var oo,ao;return((oo=io.peerMetadata)==null?void 0:oo.url)&&((ao=io.peerMetadata)==null?void 0:ao.url)===to.peer.metadata.url&&io.topic&&io.topic!==ro.topic});if(no.length===0)return;this.client.logger.info(`Cleaning up ${no.length} duplicate pairing(s)`),await Promise.all(no.map(io=>this.client.core.pairing.disconnect({topic:io.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(ro){this.client.logger.error(ro)}},this.deleteSession=async to=>{const{topic:ro,expirerHasDeleted:no=!1,emitEvent:io=!0,id:oo=0}=to,{self:ao}=this.client.session.get(ro);await this.client.core.relayer.unsubscribe(ro),await this.client.session.delete(ro,U$6("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(ao.publicKey)&&await this.client.core.crypto.deleteKeyPair(ao.publicKey),this.client.core.crypto.keychain.has(ro)&&await this.client.core.crypto.deleteSymKey(ro),no||this.client.core.expirer.del(ro),this.client.core.storage.removeItem(H$3).catch(so=>this.client.logger.warn(so)),this.getPendingSessionRequests().forEach(so=>{so.topic===ro&&this.deletePendingSessionRequest(so.id,U$6("USER_DISCONNECTED"))}),io&&this.client.events.emit("session_delete",{id:oo,topic:ro})},this.deleteProposal=async(to,ro)=>{await Promise.all([this.client.proposal.delete(to,U$6("USER_DISCONNECTED")),ro?Promise.resolve():this.client.core.expirer.del(to)])},this.deletePendingSessionRequest=async(to,ro,no=!1)=>{await Promise.all([this.client.pendingRequest.delete(to,ro),no?Promise.resolve():this.client.core.expirer.del(to)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(io=>io.id!==to),no&&(this.sessionRequestQueue.state=I$1.idle,this.client.events.emit("session_request_expire",{id:to}))},this.setExpiry=async(to,ro)=>{this.client.session.keys.includes(to)&&await this.client.session.update(to,{expiry:ro}),this.client.core.expirer.set(to,ro)},this.setProposal=async(to,ro)=>{await this.client.proposal.set(to,ro),this.client.core.expirer.set(to,pt$3(R$3.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async to=>{const{id:ro,topic:no,params:io,verifyContext:oo}=to,ao=io.request.expiryTimestamp||pt$3(R$3.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(ro,{id:ro,topic:no,params:io,verifyContext:oo}),ao&&this.client.core.expirer.set(ro,ao)},this.sendRequest=async to=>{const{topic:ro,method:no,params:io,expiry:oo,relayRpcId:ao,clientRpcId:so,throwOnFailedPublish:co}=to,lo=formatJsonRpcRequest(no,io,so);if(D$7()&&he$2.includes(no)){const go=Ln$1(JSON.stringify(lo));this.client.core.verify.register({attestationId:go})}const uo=await this.client.core.crypto.encode(ro,lo),ho=R$3[no].req;return oo&&(ho.ttl=oo),ao&&(ho.id=ao),this.client.core.history.set(ro,lo),co?(ho.internal=D$4(g$7({},ho.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(ro,uo,ho)):this.client.core.relayer.publish(ro,uo,ho).catch(go=>this.client.logger.error(go)),lo.id},this.sendResult=async to=>{const{id:ro,topic:no,result:io,throwOnFailedPublish:oo}=to,ao=formatJsonRpcResult(ro,io),so=await this.client.core.crypto.encode(no,ao),co=await this.client.core.history.get(no,ro),lo=R$3[co.request.method].res;oo?(lo.internal=D$4(g$7({},lo.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(no,so,lo)):this.client.core.relayer.publish(no,so,lo).catch(uo=>this.client.logger.error(uo)),await this.client.core.history.resolve(ao)},this.sendError=async(to,ro,no)=>{const io=formatJsonRpcError(to,no),oo=await this.client.core.crypto.encode(ro,io),ao=await this.client.core.history.get(ro,to),so=R$3[ao.request.method].res;this.client.core.relayer.publish(ro,oo,so),await this.client.core.history.resolve(io)},this.cleanup=async()=>{const to=[],ro=[];this.client.session.getAll().forEach(no=>{let io=!1;mt$3(no.expiry)&&(io=!0),this.client.core.crypto.keychain.has(no.topic)||(io=!0),io&&to.push(no.topic)}),this.client.proposal.getAll().forEach(no=>{mt$3(no.expiryTimestamp)&&ro.push(no.id)}),await Promise.all([...to.map(no=>this.deleteSession({topic:no})),...ro.map(no=>this.deleteProposal(no))])},this.onRelayEventRequest=async to=>{this.requestQueue.queue.push(to),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===I$1.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=I$1.active;const to=this.requestQueue.queue.shift();if(to)try{this.processRequest(to),await new Promise(ro=>setTimeout(ro,300))}catch(ro){this.client.logger.warn(ro)}}this.requestQueue.state=I$1.idle},this.processRequest=to=>{const{topic:ro,payload:no}=to,io=no.method;switch(io){case"wc_sessionPropose":return this.onSessionProposeRequest(ro,no);case"wc_sessionSettle":return this.onSessionSettleRequest(ro,no);case"wc_sessionUpdate":return this.onSessionUpdateRequest(ro,no);case"wc_sessionExtend":return this.onSessionExtendRequest(ro,no);case"wc_sessionPing":return this.onSessionPingRequest(ro,no);case"wc_sessionDelete":return this.onSessionDeleteRequest(ro,no);case"wc_sessionRequest":return this.onSessionRequest(ro,no);case"wc_sessionEvent":return this.onSessionEventRequest(ro,no);default:return this.client.logger.info(`Unsupported request method ${io}`)}},this.onRelayEventResponse=async to=>{const{topic:ro,payload:no}=to,io=(await this.client.core.history.get(ro,no.id)).request.method;switch(io){case"wc_sessionPropose":return this.onSessionProposeResponse(ro,no);case"wc_sessionSettle":return this.onSessionSettleResponse(ro,no);case"wc_sessionUpdate":return this.onSessionUpdateResponse(ro,no);case"wc_sessionExtend":return this.onSessionExtendResponse(ro,no);case"wc_sessionPing":return this.onSessionPingResponse(ro,no);case"wc_sessionRequest":return this.onSessionRequestResponse(ro,no);default:return this.client.logger.info(`Unsupported response method ${io}`)}},this.onRelayEventUnknownPayload=to=>{const{topic:ro}=to,{message:no}=N$7("MISSING_OR_INVALID",`Decoded payload on topic ${ro} is not identifiable as a JSON-RPC request or a response.`);throw new Error(no)},this.onSessionProposeRequest=async(to,ro)=>{const{params:no,id:io}=ro;try{this.isValidConnect(g$7({},ro.params));const oo=no.expiryTimestamp||pt$3(R$3.wc_sessionPropose.req.ttl),ao=g$7({id:io,pairingTopic:to,expiryTimestamp:oo},no);await this.setProposal(io,ao);const so=Ln$1(JSON.stringify(ro)),co=await this.getVerifyContext(so,ao.proposer.metadata);this.client.events.emit("session_proposal",{id:io,params:ao,verifyContext:co})}catch(oo){await this.sendError(io,to,oo),this.client.logger.error(oo)}},this.onSessionProposeResponse=async(to,ro)=>{const{id:no}=ro;if(isJsonRpcResult(ro)){const{result:io}=ro;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:io});const oo=this.client.proposal.get(no);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:oo});const ao=oo.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:ao});const so=io.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:so});const co=await this.client.core.crypto.generateSharedKey(ao,so);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:co});const lo=await this.client.core.relayer.subscribe(co);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:lo}),await this.client.core.pairing.activate({topic:to})}else isJsonRpcError(ro)&&(await this.client.proposal.delete(no,U$6("USER_DISCONNECTED")),this.events.emit(yt$3("session_connect"),{error:ro.error}))},this.onSessionSettleRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{this.isValidSessionSettleRequest(io);const{relay:oo,controller:ao,expiry:so,namespaces:co,sessionProperties:lo,pairingTopic:uo}=ro.params,ho=g$7({topic:to,relay:oo,expiry:so,namespaces:co,acknowledged:!0,pairingTopic:uo,requiredNamespaces:{},optionalNamespaces:{},controller:ao.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:ao.publicKey,metadata:ao.metadata}},lo&&{sessionProperties:lo});await this.sendResult({id:ro.id,topic:to,result:!0}),this.events.emit(yt$3("session_connect"),{session:ho}),this.cleanupDuplicatePairings(ho)}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.onSessionSettleResponse=async(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?(await this.client.session.update(to,{acknowledged:!0}),this.events.emit(yt$3("session_approve",no),{})):isJsonRpcError(ro)&&(await this.client.session.delete(to,U$6("USER_DISCONNECTED")),this.events.emit(yt$3("session_approve",no),{error:ro.error}))},this.onSessionUpdateRequest=async(to,ro)=>{const{params:no,id:io}=ro;try{const oo=`${to}_session_update`,ao=sr$3.get(oo);if(ao&&this.isRequestOutOfSync(ao,io)){this.client.logger.info(`Discarding out of sync request - ${io}`);return}this.isValidUpdate(g$7({topic:to},no)),await this.client.session.update(to,{namespaces:no.namespaces}),await this.sendResult({id:io,topic:to,result:!0}),this.client.events.emit("session_update",{id:io,topic:to,params:no}),sr$3.set(oo,io)}catch(oo){await this.sendError(io,to,oo),this.client.logger.error(oo)}},this.isRequestOutOfSync=(to,ro)=>parseInt(ro.toString().slice(0,-3))<=parseInt(to.toString().slice(0,-3)),this.onSessionUpdateResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_update",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_update",no),{error:ro.error})},this.onSessionExtendRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidExtend({topic:to}),await this.setExpiry(to,pt$3(L$7)),await this.sendResult({id:no,topic:to,result:!0}),this.client.events.emit("session_extend",{id:no,topic:to})}catch(io){await this.sendError(no,to,io),this.client.logger.error(io)}},this.onSessionExtendResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_extend",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_extend",no),{error:ro.error})},this.onSessionPingRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidPing({topic:to}),await this.sendResult({id:no,topic:to,result:!0}),this.client.events.emit("session_ping",{id:no,topic:to})}catch(io){await this.sendError(no,to,io),this.client.logger.error(io)}},this.onSessionPingResponse=(to,ro)=>{const{id:no}=ro;setTimeout(()=>{isJsonRpcResult(ro)?this.events.emit(yt$3("session_ping",no),{}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_ping",no),{error:ro.error})},500)},this.onSessionDeleteRequest=async(to,ro)=>{const{id:no}=ro;try{this.isValidDisconnect({topic:to,reason:ro.params}),await Promise.all([new Promise(io=>{this.client.core.relayer.once(D$5.publish,async()=>{io(await this.deleteSession({topic:to,id:no}))})}),this.sendResult({id:no,topic:to,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:to,error:U$6("USER_DISCONNECTED")})])}catch(io){this.client.logger.error(io)}},this.onSessionRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{this.isValidRequest(g$7({topic:to},io));const oo=Ln$1(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",io,no))),ao=this.client.session.get(to),so=await this.getVerifyContext(oo,ao.peer.metadata),co={id:no,topic:to,params:io,verifyContext:so};await this.setPendingSessionRequest(co),this.addSessionRequestToSessionRequestQueue(co),this.processSessionRequestQueue()}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.onSessionRequestResponse=(to,ro)=>{const{id:no}=ro;isJsonRpcResult(ro)?this.events.emit(yt$3("session_request",no),{result:ro.result}):isJsonRpcError(ro)&&this.events.emit(yt$3("session_request",no),{error:ro.error})},this.onSessionEventRequest=async(to,ro)=>{const{id:no,params:io}=ro;try{const oo=`${to}_session_event_${io.event.name}`,ao=sr$3.get(oo);if(ao&&this.isRequestOutOfSync(ao,no)){this.client.logger.info(`Discarding out of sync request - ${no}`);return}this.isValidEmit(g$7({topic:to},io)),this.client.events.emit("session_event",{id:no,topic:to,params:io}),sr$3.set(oo,no)}catch(oo){await this.sendError(no,to,oo),this.client.logger.error(oo)}},this.addSessionRequestToSessionRequestQueue=to=>{this.sessionRequestQueue.queue.push(to)},this.cleanupAfterResponse=to=>{this.deletePendingSessionRequest(to.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=I$1.idle,this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:to,error:ro})=>{const no=this.client.core.history.pending;no.length>0&&no.filter(io=>io.topic===to&&io.request.method==="wc_sessionRequest").forEach(io=>{this.events.emit(yt$3("session_request",io.request.id),{error:ro})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===I$1.active){this.client.logger.info("session request queue is already active.");return}const to=this.sessionRequestQueue.queue[0];if(!to){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=I$1.active,this.client.events.emit("session_request",to)}catch(ro){this.client.logger.error(ro)}},this.onPairingCreated=to=>{if(to.active)return;const ro=this.client.proposal.getAll().find(no=>no.pairingTopic===to.topic);ro&&this.onSessionProposeRequest(to.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:ro.requiredNamespaces,optionalNamespaces:ro.optionalNamespaces,relays:ro.relays,proposer:ro.proposer,sessionProperties:ro.sessionProperties},ro.id))},this.isValidConnect=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(to)}`);throw new Error(so)}const{pairingTopic:ro,requiredNamespaces:no,optionalNamespaces:io,sessionProperties:oo,relays:ao}=to;if(w$9(ro)||await this.isValidPairingTopic(ro),!qt$3(ao)){const{message:so}=N$7("MISSING_OR_INVALID",`connect() relays: ${ao}`);throw new Error(so)}!w$9(no)&&B$5(no)!==0&&this.validateNamespaces(no,"requiredNamespaces"),!w$9(io)&&B$5(io)!==0&&this.validateNamespaces(io,"optionalNamespaces"),w$9(oo)||this.validateSessionProps(oo,"sessionProperties")},this.validateNamespaces=(to,ro)=>{const no=Ht$3(to,"connect()",ro);if(no)throw new Error(no.message)},this.isValidApprove=async to=>{if(!Gt$3(to))throw new Error(N$7("MISSING_OR_INVALID",`approve() params: ${to}`).message);const{id:ro,namespaces:no,relayProtocol:io,sessionProperties:oo}=to;await this.isValidProposalId(ro);const ao=this.client.proposal.get(ro),so=ln$1(no,"approve()");if(so)throw new Error(so.message);const co=fn$1(ao.requiredNamespaces,no,"approve()");if(co)throw new Error(co.message);if(!g$b(io,!0)){const{message:lo}=N$7("MISSING_OR_INVALID",`approve() relayProtocol: ${io}`);throw new Error(lo)}w$9(oo)||this.validateSessionProps(oo,"sessionProperties")},this.isValidReject=async to=>{if(!Gt$3(to)){const{message:io}=N$7("MISSING_OR_INVALID",`reject() params: ${to}`);throw new Error(io)}const{id:ro,reason:no}=to;if(await this.isValidProposalId(ro),!Wt$2(no)){const{message:io}=N$7("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(no)}`);throw new Error(io)}},this.isValidSessionSettleRequest=to=>{if(!Gt$3(to)){const{message:co}=N$7("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${to}`);throw new Error(co)}const{relay:ro,controller:no,namespaces:io,expiry:oo}=to;if(!dn$1(ro)){const{message:co}=N$7("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(co)}const ao=Ft$3(no,"onSessionSettleRequest()");if(ao)throw new Error(ao.message);const so=ln$1(io,"onSessionSettleRequest()");if(so)throw new Error(so.message);if(mt$3(oo)){const{message:co}=N$7("EXPIRED","onSessionSettleRequest()");throw new Error(co)}},this.isValidUpdate=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`update() params: ${to}`);throw new Error(so)}const{topic:ro,namespaces:no}=to;await this.isValidSessionTopic(ro);const io=this.client.session.get(ro),oo=ln$1(no,"update()");if(oo)throw new Error(oo.message);const ao=fn$1(io.requiredNamespaces,no,"update()");if(ao)throw new Error(ao.message)},this.isValidExtend=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`extend() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionTopic(ro)},this.isValidRequest=async to=>{if(!Gt$3(to)){const{message:so}=N$7("MISSING_OR_INVALID",`request() params: ${to}`);throw new Error(so)}const{topic:ro,request:no,chainId:io,expiry:oo}=to;await this.isValidSessionTopic(ro);const{namespaces:ao}=this.client.session.get(ro);if(!Qt$2(ao,io)){const{message:so}=N$7("MISSING_OR_INVALID",`request() chainId: ${io}`);throw new Error(so)}if(!zt$3(no)){const{message:so}=N$7("MISSING_OR_INVALID",`request() ${JSON.stringify(no)}`);throw new Error(so)}if(!Zt$2(ao,io,no.method)){const{message:so}=N$7("MISSING_OR_INVALID",`request() method: ${no.method}`);throw new Error(so)}if(oo&&!tr$3(oo,U$5)){const{message:so}=N$7("MISSING_OR_INVALID",`request() expiry: ${oo}. Expiry must be a number (in seconds) between ${U$5.min} and ${U$5.max}`);throw new Error(so)}},this.isValidRespond=async to=>{var ro;if(!Gt$3(to)){const{message:oo}=N$7("MISSING_OR_INVALID",`respond() params: ${to}`);throw new Error(oo)}const{topic:no,response:io}=to;try{await this.isValidSessionTopic(no)}catch(oo){throw(ro=to==null?void 0:to.response)!=null&&ro.id&&this.cleanupAfterResponse(to),oo}if(!Yt$3(io)){const{message:oo}=N$7("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(io)}`);throw new Error(oo)}},this.isValidPing=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`ping() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionOrPairingTopic(ro)},this.isValidEmit=async to=>{if(!Gt$3(to)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() params: ${to}`);throw new Error(ao)}const{topic:ro,event:no,chainId:io}=to;await this.isValidSessionTopic(ro);const{namespaces:oo}=this.client.session.get(ro);if(!Qt$2(oo,io)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() chainId: ${io}`);throw new Error(ao)}if(!Jt$3(no)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(no)}`);throw new Error(ao)}if(!Xt$2(oo,io,no.name)){const{message:ao}=N$7("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(no)}`);throw new Error(ao)}},this.isValidDisconnect=async to=>{if(!Gt$3(to)){const{message:no}=N$7("MISSING_OR_INVALID",`disconnect() params: ${to}`);throw new Error(no)}const{topic:ro}=to;await this.isValidSessionOrPairingTopic(ro)},this.getVerifyContext=async(to,ro)=>{const no={verified:{verifyUrl:ro.verifyUrl||F$6,validation:"UNKNOWN",origin:ro.url||""}};try{const io=await this.client.core.verify.resolve({attestationId:to,verifyUrl:ro.verifyUrl});io&&(no.verified.origin=io.origin,no.verified.isScam=io.isScam,no.verified.validation=io.origin===new URL(ro.url).origin?"VALID":"INVALID")}catch(io){this.client.logger.info(io)}return this.client.logger.info(`Verify context: ${JSON.stringify(no)}`),no},this.validateSessionProps=(to,ro)=>{Object.values(to).forEach(no=>{if(!g$b(no,!1)){const{message:io}=N$7("MISSING_OR_INVALID",`${ro} must be in Record format. Received: ${JSON.stringify(no)}`);throw new Error(io)}})}}async isInitialized(){if(!this.initialized){const{message:eo}=N$7("NOT_INITIALIZED",this.name);throw new Error(eo)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(D$5.message,async eo=>{const{topic:to,message:ro}=eo;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(ro)))return;const no=await this.client.core.crypto.decode(to,ro);try{isJsonRpcRequest(no)?(this.client.core.history.set(to,no),this.onRelayEventRequest({topic:to,payload:no})):isJsonRpcResponse(no)?(await this.client.core.history.resolve(no),await this.onRelayEventResponse({topic:to,payload:no}),this.client.core.history.delete(to,no.id)):this.onRelayEventUnknownPayload({topic:to,payload:no})}catch(io){this.client.logger.error(io)}})}registerExpirerEvents(){this.client.core.expirer.on(v$5.expired,async eo=>{const{topic:to,id:ro}=ft$4(eo.target);if(ro&&this.client.pendingRequest.keys.includes(ro))return await this.deletePendingSessionRequest(ro,N$7("EXPIRED"),!0);to?this.client.session.keys.includes(to)&&(await this.deleteSession({topic:to,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:to})):ro&&(await this.deleteProposal(ro,!0),this.client.events.emit("proposal_expire",{id:ro}))})}registerPairingEvents(){this.client.core.pairing.events.on(V$2.create,eo=>this.onPairingCreated(eo))}isValidPairingTopic(eo){if(!g$b(eo,!1)){const{message:to}=N$7("MISSING_OR_INVALID",`pairing topic should be a string: ${eo}`);throw new Error(to)}if(!this.client.core.pairing.pairings.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`pairing topic doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.core.pairing.pairings.get(eo).expiry)){const{message:to}=N$7("EXPIRED",`pairing topic: ${eo}`);throw new Error(to)}}async isValidSessionTopic(eo){if(!g$b(eo,!1)){const{message:to}=N$7("MISSING_OR_INVALID",`session topic should be a string: ${eo}`);throw new Error(to)}if(!this.client.session.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`session topic doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.session.get(eo).expiry)){await this.deleteSession({topic:eo});const{message:to}=N$7("EXPIRED",`session topic: ${eo}`);throw new Error(to)}if(!this.client.core.crypto.keychain.has(eo)){const{message:to}=N$7("MISSING_OR_INVALID",`session topic does not exist in keychain: ${eo}`);throw await this.deleteSession({topic:eo}),new Error(to)}}async isValidSessionOrPairingTopic(eo){if(this.client.session.keys.includes(eo))await this.isValidSessionTopic(eo);else if(this.client.core.pairing.pairings.keys.includes(eo))this.isValidPairingTopic(eo);else if(g$b(eo,!1)){const{message:to}=N$7("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${eo}`);throw new Error(to)}else{const{message:to}=N$7("MISSING_OR_INVALID",`session or pairing topic should be a string: ${eo}`);throw new Error(to)}}async isValidProposalId(eo){if(!Bt$3(eo)){const{message:to}=N$7("MISSING_OR_INVALID",`proposal id should be a number: ${eo}`);throw new Error(to)}if(!this.client.proposal.keys.includes(eo)){const{message:to}=N$7("NO_MATCHING_KEY",`proposal id doesn't exist: ${eo}`);throw new Error(to)}if(mt$3(this.client.proposal.get(eo).expiryTimestamp)){await this.deleteProposal(eo);const{message:to}=N$7("EXPIRED",`proposal id: ${eo}`);throw new Error(to)}}},us$1=class extends Kt$2{constructor(eo,to){super(eo,to,oe$2,G$3),this.core=eo,this.logger=to}},ge$3=class extends Kt$2{constructor(eo,to){super(eo,to,ce$2,G$3),this.core=eo,this.logger=to}},gs$1=class extends Kt$2{constructor(eo,to){super(eo,to,pe$2,G$3,ro=>ro.id),this.core=eo,this.logger=to}},Q$4=class lC extends b$6{constructor(eo){super(eo),this.protocol=J$2,this.version=F$5,this.name=M$4.name,this.events=new eventsExports.EventEmitter,this.on=(ro,no)=>this.events.on(ro,no),this.once=(ro,no)=>this.events.once(ro,no),this.off=(ro,no)=>this.events.off(ro,no),this.removeListener=(ro,no)=>this.events.removeListener(ro,no),this.removeAllListeners=ro=>this.events.removeAllListeners(ro),this.connect=async ro=>{try{return await this.engine.connect(ro)}catch(no){throw this.logger.error(no.message),no}},this.pair=async ro=>{try{return await this.engine.pair(ro)}catch(no){throw this.logger.error(no.message),no}},this.approve=async ro=>{try{return await this.engine.approve(ro)}catch(no){throw this.logger.error(no.message),no}},this.reject=async ro=>{try{return await this.engine.reject(ro)}catch(no){throw this.logger.error(no.message),no}},this.update=async ro=>{try{return await this.engine.update(ro)}catch(no){throw this.logger.error(no.message),no}},this.extend=async ro=>{try{return await this.engine.extend(ro)}catch(no){throw this.logger.error(no.message),no}},this.request=async ro=>{try{return await this.engine.request(ro)}catch(no){throw this.logger.error(no.message),no}},this.respond=async ro=>{try{return await this.engine.respond(ro)}catch(no){throw this.logger.error(no.message),no}},this.ping=async ro=>{try{return await this.engine.ping(ro)}catch(no){throw this.logger.error(no.message),no}},this.emit=async ro=>{try{return await this.engine.emit(ro)}catch(no){throw this.logger.error(no.message),no}},this.disconnect=async ro=>{try{return await this.engine.disconnect(ro)}catch(no){throw this.logger.error(no.message),no}},this.find=ro=>{try{return this.engine.find(ro)}catch(no){throw this.logger.error(no.message),no}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(ro){throw this.logger.error(ro.message),ro}},this.name=(eo==null?void 0:eo.name)||M$4.name,this.metadata=(eo==null?void 0:eo.metadata)||Qn$1();const to=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||M$4.logger}));this.core=(eo==null?void 0:eo.core)||new Mr$1(eo),this.logger=E$6(to,this.name),this.session=new ge$3(this.core,this.logger),this.proposal=new us$1(this.core,this.logger),this.pendingRequest=new gs$1(this.core,this.logger),this.engine=new ds$1(this)}static async init(eo){const to=new lC(eo);return await to.initialize(),to}get context(){return y$9(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(eo){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(eo.message),eo}}};var P$5=Object.defineProperty,w$4=Object.defineProperties,E$4=Object.getOwnPropertyDescriptors,c$3=Object.getOwnPropertySymbols,L$6=Object.prototype.hasOwnProperty,O$7=Object.prototype.propertyIsEnumerable,l$5=(Xr,eo,to)=>eo in Xr?P$5(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,p$4=(Xr,eo)=>{for(var to in eo||(eo={}))L$6.call(eo,to)&&l$5(Xr,to,eo[to]);if(c$3)for(var to of c$3(eo))O$7.call(eo,to)&&l$5(Xr,to,eo[to]);return Xr},v$4=(Xr,eo)=>w$4(Xr,E$4(eo));const j$7={Accept:"application/json","Content-Type":"application/json"},T$7="POST",d$6={headers:j$7,method:T$7},g$6=10;let f$7=class{constructor(eo,to=!1){if(this.url=eo,this.disableProviderPing=to,this.events=new eventsExports.EventEmitter,this.isAvailable=!1,this.registering=!1,!isHttpUrl(eo))throw new Error(`Provided URL is not compatible with HTTP connection: ${eo}`);this.url=eo,this.disableProviderPing=to}get connected(){return this.isAvailable}get connecting(){return this.registering}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async open(eo=this.url){await this.register(eo)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(eo){this.isAvailable||await this.register();try{const to=safeJsonStringify(eo),ro=await(await fetchTransport(this.url,v$4(p$4({},d$6),{body:to}))).json();this.onPayload({data:ro})}catch(to){this.onError(eo.id,to)}}async register(eo=this.url){if(!isHttpUrl(eo))throw new Error(`Provided URL is not compatible with HTTP connection: ${eo}`);if(this.registering){const to=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=to||this.events.listenerCount("open")>=to)&&this.events.setMaxListeners(to+1),new Promise((ro,no)=>{this.events.once("register_error",io=>{this.resetMaxListeners(),no(io)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return no(new Error("HTTP connection is missing or invalid"));ro()})})}this.url=eo,this.registering=!0;try{if(!this.disableProviderPing){const to=safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});await fetchTransport(eo,v$4(p$4({},d$6),{body:to}))}this.onOpen()}catch(to){const ro=this.parseError(to);throw this.events.emit("register_error",ro),this.onClose(),ro}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(eo){if(typeof eo.data>"u")return;const to=typeof eo.data=="string"?safeJsonParse(eo.data):eo.data;this.events.emit("payload",to)}onError(eo,to){const ro=this.parseError(to),no=ro.message||ro.toString(),io=formatJsonRpcError(eo,no);this.events.emit("payload",io)}parseError(eo,to=this.url){return parseConnectionError(eo,to,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g$6&&this.events.setMaxListeners(g$6)}};class JsonRpcProvider extends r$4{constructor(eo){super(eo),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(eo),this.connection.connected&&this.registerEventListeners()}async connect(eo=this.connection){await this.open(eo)}async disconnect(){await this.close()}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}off(eo,to){this.events.off(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}async request(eo,to){return this.requestStrict(formatJsonRpcRequest(eo.method,eo.params||[],eo.id||getBigIntRpcId().toString()),to)}async requestStrict(eo,to){return new Promise(async(ro,no)=>{if(!this.connection.connected)try{await this.open()}catch(io){no(io)}this.events.on(`${eo.id}`,io=>{isJsonRpcError(io)?no(io.error):ro(io.result)});try{await this.connection.send(eo,to)}catch(io){no(io)}})}setConnection(eo=this.connection){return eo}onPayload(eo){this.events.emit("payload",eo),isJsonRpcResponse(eo)?this.events.emit(`${eo.id}`,eo):this.events.emit("message",{type:eo.method,data:eo.params})}onClose(eo){eo&&eo.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${eo.code} ${eo.reason?`(${eo.reason})`:""}`)),this.events.emit("disconnect")}async open(eo=this.connection){this.connection===eo&&this.connection.connected||(this.connection.connected&&this.close(),typeof eo=="string"&&(await this.connection.open(eo),eo=this.connection),this.connection=this.setConnection(eo),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",eo=>this.onPayload(eo)),this.connection.on("close",eo=>this.onClose(eo)),this.connection.on("error",eo=>this.events.emit("error",eo)),this.connection.on("register_error",eo=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const Ia="error",Fg="wss://relay.walletconnect.com",Mg="wc",qg="universal_provider",xa=`${Mg}@2:${qg}:`,Bg="https://rpc.walletconnect.com/v1/",Vn$1={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ge$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},Ui$1={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -*/(function(Xr,eo){(function(){var to,ro="4.17.21",no=200,io="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",oo="Expected a function",ao="Invalid `variable` option passed into `_.template`",so="__lodash_hash_undefined__",co=500,lo="__lodash_placeholder__",fo=1,ho=2,go=4,yo=1,vo=2,wo=1,Eo=2,ko=4,Ao=8,Po=16,jo=32,Mo=64,No=128,Do=256,Fo=512,Xo=30,Lo="...",Bo=800,xo=16,uo=1,po=2,bo=3,_o=1/0,$o=9007199254740991,Co=17976931348623157e292,Ro=NaN,So=4294967295,mo=So-1,To=So>>>1,Vo=[["ary",No],["bind",wo],["bindKey",Eo],["curry",Ao],["curryRight",Po],["flip",Fo],["partial",jo],["partialRight",Mo],["rearg",Do]],Zo="[object Arguments]",Qo="[object Array]",qo="[object AsyncFunction]",Ho="[object Boolean]",$a="[object Date]",zo="[object DOMException]",Ko="[object Error]",_c="[object Function]",Cl="[object GeneratorFunction]",ga="[object Map]",El="[object Number]",Al="[object Null]",Ol="[object Object]",Wl="[object Promise]",zl="[object Proxy]",Tl="[object RegExp]",Ml="[object Set]",ou="[object String]",Vl="[object Symbol]",Ll="[object Undefined]",uu="[object WeakMap]",ru="[object WeakSet]",tu="[object ArrayBuffer]",ku="[object DataView]",au="[object Float32Array]",wl="[object Float64Array]",Jo="[object Int8Array]",Go="[object Int16Array]",$l="[object Int32Array]",Zl="[object Uint8Array]",Ul="[object Uint8ClampedArray]",Gl="[object Uint16Array]",Nu="[object Uint32Array]",hu=/\b__p \+= '';/g,cu=/\b(__p \+=) '' \+/g,Wu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mu=/&(?:amp|lt|gt|quot|#39);/g,yu=/[&<>"']/g,Yu=RegExp(mu.source),_u=RegExp(yu.source),Il=/<%-([\s\S]+?)%>/g,Nl=/<%([\s\S]+?)%>/g,Pl=/<%=([\s\S]+?)%>/g,Bl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fu=/^\w*$/,eu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xl=/[\\^$.*+?()[\]{}|]/g,$u=RegExp(Xl.source),Yo=/^\s+/,_l=/\s/,Sl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Wo=/\{\n\/\* \[wrapped with (.+)\] \*/,xl=/,? & /,Ql=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Fl=/[()=,{}\[\]\/\s]/,Jl=/\\(\\)?/g,xu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,lu=/\w*$/,su=/^[-+]0x[0-9a-f]+$/i,Xu=/^0b[01]+$/i,ju=/^\[object .+?Constructor\]$/,zu=/^0o[0-7]+$/i,Ku=/^(?:0|[1-9]\d*)$/,Hu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Gu=/($^)/,Zu=/['\n\r\u2028\u2029\\]/g,Vu="\\ud800-\\udfff",Ju="\\u0300-\\u036f",Uu="\\ufe20-\\ufe2f",qu="\\u20d0-\\u20ff",Mu=Ju+Uu+qu,Bu="\\u2700-\\u27bf",Au="a-z\\xdf-\\xf6\\xf8-\\xff",Du="\\xac\\xb1\\xd7\\xf7",wu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vu="\\u2000-\\u206f",Cu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Eu="A-Z\\xc0-\\xd6\\xd8-\\xde",Ru="\\ufe0e\\ufe0f",Lu=Du+wu+vu+Cu,ep="['’]",rp="["+Vu+"]",ip="["+Lu+"]",np="["+Mu+"]",nu="\\d+",lp="["+Bu+"]",yp="["+Au+"]",up="[^"+Vu+Lu+nu+Bu+Au+Eu+"]",op="\\ud83c[\\udffb-\\udfff]",bp="(?:"+np+"|"+op+")",dp="[^"+Vu+"]",Ep="(?:\\ud83c[\\udde6-\\uddff]){2}",pp="[\\ud800-\\udbff][\\udc00-\\udfff]",wp="["+Eu+"]",Ap="\\u200d",fp="(?:"+yp+"|"+up+")",Tp="(?:"+wp+"|"+up+")",Lp="(?:"+ep+"(?:d|ll|m|re|s|t|ve))?",zp="(?:"+ep+"(?:D|LL|M|RE|S|T|VE))?",Hp=bp+"?",r0="["+Ru+"]?",p0="(?:"+Ap+"(?:"+[dp,Ep,pp].join("|")+")"+r0+Hp+")*",Em="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",A0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",n0=r0+Hp+p0,m0="(?:"+[lp,Ep,pp].join("|")+")"+n0,Pm="(?:"+[dp+np+"?",np,Ep,pp,rp].join("|")+")",g0=RegExp(ep,"g"),P0=RegExp(np,"g"),Vm=RegExp(op+"(?="+op+")|"+Pm+n0,"g"),y0=RegExp([wp+"?"+yp+"+"+Lp+"(?="+[ip,wp,"$"].join("|")+")",Tp+"+"+zp+"(?="+[ip,wp+fp,"$"].join("|")+")",wp+"?"+fp+"+"+Lp,wp+"+"+zp,A0,Em,nu,m0].join("|"),"g"),v0=RegExp("["+Ap+Vu+Mu+Ru+"]"),Um=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,b0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],O0=-1,Pp={};Pp[au]=Pp[wl]=Pp[Jo]=Pp[Go]=Pp[$l]=Pp[Zl]=Pp[Ul]=Pp[Gl]=Pp[Nu]=!0,Pp[Zo]=Pp[Qo]=Pp[tu]=Pp[Ho]=Pp[ku]=Pp[$a]=Pp[Ko]=Pp[_c]=Pp[ga]=Pp[El]=Pp[Ol]=Pp[Tl]=Pp[Ml]=Pp[ou]=Pp[uu]=!1;var Ip={};Ip[Zo]=Ip[Qo]=Ip[tu]=Ip[ku]=Ip[Ho]=Ip[$a]=Ip[au]=Ip[wl]=Ip[Jo]=Ip[Go]=Ip[$l]=Ip[ga]=Ip[El]=Ip[Ol]=Ip[Tl]=Ip[Ml]=Ip[ou]=Ip[Vl]=Ip[Zl]=Ip[Ul]=Ip[Gl]=Ip[Nu]=!0,Ip[Ko]=Ip[_c]=Ip[uu]=!1;var Yl={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},pu={"&":"&","<":"<",">":">",'"':""","'":"'"},Tu={"&":"&","<":"<",">":">",""":'"',"'":"'"},_f={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mp=parseFloat,mp=parseInt,Up=typeof ge$2=="object"&&ge$2&&ge$2.Object===Object&&ge$2,Qp=typeof self=="object"&&self&&self.Object===Object&&self,kp=Up||Qp||Function("return this")(),jp=eo&&!eo.nodeType&&eo,Jp=jp&&!0&&Xr&&!Xr.nodeType&&Xr,fm=Jp&&Jp.exports===jp,em=fm&&Up.process,Wp=function(){try{var gu=Jp&&Jp.require&&Jp.require("util").types;return gu||em&&em.binding&&em.binding("util")}catch{}}(),cm=Wp&&Wp.isArrayBuffer,Om=Wp&&Wp.isDate,$m=Wp&&Wp.isMap,Fm=Wp&&Wp.isRegExp,Y0=Wp&&Wp.isSet,w0=Wp&&Wp.isTypedArray;function nm(gu,Iu,Su){switch(Su.length){case 0:return gu.call(Iu);case 1:return gu.call(Iu,Su[0]);case 2:return gu.call(Iu,Su[0],Su[1]);case 3:return gu.call(Iu,Su[0],Su[1],Su[2])}return gu.apply(Iu,Su)}function F_(gu,Iu,Su,_h){for(var hp=-1,Rp=gu==null?0:gu.length;++hp-1}function r1(gu,Iu,Su){for(var _h=-1,hp=gu==null?0:gu.length;++_h-1;);return Su}function Nv(gu,Iu){for(var Su=gu.length;Su--&&N0(Iu,gu[Su],0)>-1;);return Su}function J_(gu,Iu){for(var Su=gu.length,_h=0;Su--;)gu[Su]===Iu&&++_h;return _h}var Y_=a1(Yl),X_=a1(pu);function Q_(gu){return"\\"+_f[gu]}function ex(gu,Iu){return gu==null?to:gu[Iu]}function M0(gu){return v0.test(gu)}function tx(gu){return Um.test(gu)}function rx(gu){for(var Iu,Su=[];!(Iu=gu.next()).done;)Su.push(Iu.value);return Su}function u1(gu){var Iu=-1,Su=Array(gu.size);return gu.forEach(function(_h,hp){Su[++Iu]=[hp,_h]}),Su}function Mv(gu,Iu){return function(Su){return gu(Iu(Su))}}function a0(gu,Iu){for(var Su=-1,_h=gu.length,hp=0,Rp=[];++Su<_h;){var tm=gu[Su];(tm===Iu||tm===lo)&&(gu[Su]=lo,Rp[hp++]=Su)}return Rp}function my(gu){var Iu=-1,Su=Array(gu.size);return gu.forEach(function(_h){Su[++Iu]=_h}),Su}function nx(gu){var Iu=-1,Su=Array(gu.size);return gu.forEach(function(_h){Su[++Iu]=[_h,_h]}),Su}function ix(gu,Iu,Su){for(var _h=Su-1,hp=gu.length;++_h-1}function zx(Io,Oo){var Uo=this.__data__,yl=Ry(Uo,Io);return yl<0?(++this.size,Uo.push([Io,Oo])):Uo[yl][1]=Oo,this}Km.prototype.clear=Ux,Km.prototype.delete=Fx,Km.prototype.get=Wx,Km.prototype.has=qx,Km.prototype.set=zx;function Gm(Io){var Oo=-1,Uo=Io==null?0:Io.length;for(this.clear();++Oo=Oo?Io:Oo)),Io}function Tm(Io,Oo,Uo,yl,Rl,Hl){var iu,du=Oo&fo,bu=Oo&ho,Pu=Oo&go;if(Uo&&(iu=Rl?Uo(Io,yl,Rl,Hl):Uo(Io)),iu!==to)return iu;if(!Gp(Io))return Io;var Ou=gp(Io);if(Ou){if(iu=G2(Io),!du)return hm(Io,iu)}else{var Fu=sm(Io),_d=Fu==_c||Fu==Cl;if(f0(Io))return gw(Io,du);if(Fu==Ol||Fu==Zo||_d&&!Rl){if(iu=bu||_d?{}:Mw(Io),!du)return bu?B2(Io,a2(iu,Io)):j2(Io,Kv(iu,Io))}else{if(!Ip[Fu])return Rl?Io:{};iu=Z2(Io,Fu,du)}}Hl||(Hl=new Mm);var tp=Hl.get(Io);if(tp)return tp;Hl.set(Io,iu),u_(Io)?Io.forEach(function(cp){iu.add(Tm(cp,Oo,Uo,cp,Io,Hl))}):c_(Io)&&Io.forEach(function(cp,$p){iu.set($p,Tm(cp,Oo,Uo,$p,Io,Hl))});var sp=Pu?bu?D1:B1:bu?mm:im,_p=Ou?to:sp(Io);return Sm(_p||Io,function(cp,$p){_p&&($p=cp,cp=Io[$p]),iy(iu,$p,Tm(cp,Oo,Uo,$p,Io,Hl))}),iu}function s2(Io){var Oo=im(Io);return function(Uo){return Gv(Uo,Io,Oo)}}function Gv(Io,Oo,Uo){var yl=Uo.length;if(Io==null)return!yl;for(Io=Bp(Io);yl--;){var Rl=Uo[yl],Hl=Oo[Rl],iu=Io[Rl];if(iu===to&&!(Rl in Io)||!Hl(iu))return!1}return!0}function Zv(Io,Oo,Uo){if(typeof Io!="function")throw new km(oo);return dy(function(){Io.apply(to,Uo)},Oo)}function oy(Io,Oo,Uo,yl){var Rl=-1,Hl=hy,iu=!0,du=Io.length,bu=[],Pu=Oo.length;if(!du)return bu;Uo&&(Oo=Vp(Oo,ym(Uo))),yl?(Hl=r1,iu=!1):Oo.length>=no&&(Hl=X0,iu=!1,Oo=new E0(Oo));e:for(;++RlRl?0:Rl+Uo),yl=yl===to||yl>Rl?Rl:vp(yl),yl<0&&(yl+=Rl),yl=Uo>yl?0:f_(yl);Uo0&&Uo(du)?Oo>1?om(du,Oo-1,Uo,yl,Rl):o0(Rl,du):yl||(Rl[Rl.length]=du)}return Rl}var y1=xw(),Xv=xw(!0);function Wm(Io,Oo){return Io&&y1(Io,Oo,im)}function b1(Io,Oo){return Io&&Xv(Io,Oo,im)}function Py(Io,Oo){return i0(Oo,function(Uo){return Qm(Io[Uo])})}function S0(Io,Oo){Oo=u0(Oo,Io);for(var Uo=0,yl=Oo.length;Io!=null&&UoOo}function u2(Io,Oo){return Io!=null&&Np.call(Io,Oo)}function d2(Io,Oo){return Io!=null&&Oo in Bp(Io)}function f2(Io,Oo,Uo){return Io>=am(Oo,Uo)&&Io=120&&Ou.length>=120)?new E0(iu&&Ou):to}Ou=Io[0];var Fu=-1,_d=du[0];e:for(;++Fu-1;)du!==Io&&Ey.call(du,bu,1),Ey.call(Io,bu,1);return Io}function cw(Io,Oo){for(var Uo=Io?Oo.length:0,yl=Uo-1;Uo--;){var Rl=Oo[Uo];if(Uo==yl||Rl!==Hl){var Hl=Rl;Xm(Rl)?Ey.call(Io,Rl,1):R1(Io,Rl)}}return Io}function C1(Io,Oo){return Io+ky(qv()*(Oo-Io+1))}function S2(Io,Oo,Uo,yl){for(var Rl=-1,Hl=rm(Sy((Oo-Io)/(Uo||1)),0),iu=Su(Hl);Hl--;)iu[yl?Hl:++Rl]=Io,Io+=Uo;return iu}function T1(Io,Oo){var Uo="";if(!Io||Oo<1||Oo>$o)return Uo;do Oo%2&&(Uo+=Io),Oo=ky(Oo/2),Oo&&(Io+=Io);while(Oo);return Uo}function xp(Io,Oo){return H1(Dw(Io,Oo,gm),Io+"")}function k2(Io){return Vv(V0(Io))}function C2(Io,Oo){var Uo=V0(Io);return qy(Uo,$0(Oo,0,Uo.length))}function cy(Io,Oo,Uo,yl){if(!Gp(Io))return Io;Oo=u0(Oo,Io);for(var Rl=-1,Hl=Oo.length,iu=Hl-1,du=Io;du!=null&&++RlRl?0:Rl+Oo),Uo=Uo>Rl?Rl:Uo,Uo<0&&(Uo+=Rl),Rl=Oo>Uo?0:Uo-Oo>>>0,Oo>>>=0;for(var Hl=Su(Rl);++yl>>1,iu=Io[Hl];iu!==null&&!wm(iu)&&(Uo?iu<=Oo:iu=no){var Pu=Oo?null:F2(Io);if(Pu)return my(Pu);iu=!1,Rl=X0,bu=new E0}else bu=Oo?[]:du;e:for(;++yl=yl?Io:Im(Io,Oo,Uo)}var mw=yx||function(Io){return kp.clearTimeout(Io)};function gw(Io,Oo){if(Oo)return Io.slice();var Uo=Io.length,yl=Dv?Dv(Uo):new Io.constructor(Uo);return Io.copy(yl),yl}function N1(Io){var Oo=new Io.constructor(Io.byteLength);return new _y(Oo).set(new _y(Io)),Oo}function P2(Io,Oo){var Uo=Oo?N1(Io.buffer):Io.buffer;return new Io.constructor(Uo,Io.byteOffset,Io.byteLength)}function O2(Io){var Oo=new Io.constructor(Io.source,lu.exec(Io));return Oo.lastIndex=Io.lastIndex,Oo}function N2(Io){return ny?Bp(ny.call(Io)):{}}function yw(Io,Oo){var Uo=Oo?N1(Io.buffer):Io.buffer;return new Io.constructor(Uo,Io.byteOffset,Io.length)}function vw(Io,Oo){if(Io!==Oo){var Uo=Io!==to,yl=Io===null,Rl=Io===Io,Hl=wm(Io),iu=Oo!==to,du=Oo===null,bu=Oo===Oo,Pu=wm(Oo);if(!du&&!Pu&&!Hl&&Io>Oo||Hl&&iu&&bu&&!du&&!Pu||yl&&iu&&bu||!Uo&&bu||!Rl)return 1;if(!yl&&!Hl&&!Pu&&Io=du)return bu;var Pu=Uo[yl];return bu*(Pu=="desc"?-1:1)}}return Io.index-Oo.index}function bw(Io,Oo,Uo,yl){for(var Rl=-1,Hl=Io.length,iu=Uo.length,du=-1,bu=Oo.length,Pu=rm(Hl-iu,0),Ou=Su(bu+Pu),Fu=!yl;++du1?Uo[Rl-1]:to,iu=Rl>2?Uo[2]:to;for(Hl=Io.length>3&&typeof Hl=="function"?(Rl--,Hl):to,iu&&um(Uo[0],Uo[1],iu)&&(Hl=Rl<3?to:Hl,Rl=1),Oo=Bp(Oo);++yl-1?Rl[Hl?Oo[iu]:iu]:to}}function Sw(Io){return Ym(function(Oo){var Uo=Oo.length,yl=Uo,Rl=Cm.prototype.thru;for(Io&&Oo.reverse();yl--;){var Hl=Oo[yl];if(typeof Hl!="function")throw new km(oo);if(Rl&&!iu&&Fy(Hl)=="wrapper")var iu=new Cm([],!0)}for(yl=iu?yl:Uo;++yl1&&Cp.reverse(),Ou&&bu<$p&&(Cp.length=bu),this&&this!==kp&&this instanceof cp&&(t0=_p||ly(t0)),t0.apply(Bm,Cp)}return cp}function kw(Io,Oo){return function(Uo,yl){return h2(Uo,Io,Oo(yl),{})}}function Dy(Io,Oo){return function(Uo,yl){var Rl;if(Uo===to&&yl===to)return Oo;if(Uo!==to&&(Rl=Uo),yl!==to){if(Rl===to)return yl;typeof Uo=="string"||typeof yl=="string"?(Uo=bm(Uo),yl=bm(yl)):(Uo=dw(Uo),yl=dw(yl)),Rl=Io(Uo,yl)}return Rl}}function M1(Io){return Ym(function(Oo){return Oo=Vp(Oo,ym(ap())),xp(function(Uo){var yl=this;return Io(Oo,function(Rl){return nm(Rl,yl,Uo)})})})}function Ly(Io,Oo){Oo=Oo===to?" ":bm(Oo);var Uo=Oo.length;if(Uo<2)return Uo?T1(Oo,Io):Oo;var yl=T1(Oo,Sy(Io/j0(Oo)));return M0(Oo)?d0(Nm(yl),0,Io).join(""):yl.slice(0,Io)}function U2(Io,Oo,Uo,yl){var Rl=Oo&wo,Hl=ly(Io);function iu(){for(var du=-1,bu=arguments.length,Pu=-1,Ou=yl.length,Fu=Su(Ou+bu),_d=this&&this!==kp&&this instanceof iu?Hl:Io;++Pudu))return!1;var Pu=Hl.get(Io),Ou=Hl.get(Oo);if(Pu&&Ou)return Pu==Oo&&Ou==Io;var Fu=-1,_d=!0,tp=Uo&vo?new E0:to;for(Hl.set(Io,Oo),Hl.set(Oo,Io);++Fu1?"& ":"")+Oo[yl],Oo=Oo.join(Uo>2?", ":" "),Io.replace(Sl,`{ -/* [wrapped with `+Oo+`] */ -`)}function Y2(Io){return gp(Io)||T0(Io)||!!(Fv&&Io&&Io[Fv])}function Xm(Io,Oo){var Uo=typeof Io;return Oo=Oo??$o,!!Oo&&(Uo=="number"||Uo!="symbol"&&Ku.test(Io))&&Io>-1&&Io%1==0&&Io0){if(++Oo>=Bo)return arguments[0]}else Oo=0;return Io.apply(to,arguments)}}function qy(Io,Oo){var Uo=-1,yl=Io.length,Rl=yl-1;for(Oo=Oo===to?yl:Oo;++Uo1?Io[Oo-1]:to;return Uo=typeof Uo=="function"?(Io.pop(),Uo):to,Jw(Io,Uo)});function Yw(Io){var Oo=Dl(Io);return Oo.__chain__=!0,Oo}function c$(Io,Oo){return Oo(Io),Io}function zy(Io,Oo){return Oo(Io)}var l$=Ym(function(Io){var Oo=Io.length,Uo=Oo?Io[0]:0,yl=this.__wrapped__,Rl=function(Hl){return g1(Hl,Io)};return Oo>1||this.__actions__.length||!(yl instanceof Sp)||!Xm(Uo)?this.thru(Rl):(yl=yl.slice(Uo,+Uo+(Oo?1:0)),yl.__actions__.push({func:zy,args:[Rl],thisArg:to}),new Cm(yl,this.__chain__).thru(function(Hl){return Oo&&!Hl.length&&Hl.push(to),Hl}))});function u$(){return Yw(this)}function d$(){return new Cm(this.value(),this.__chain__)}function f$(){this.__values__===to&&(this.__values__=d_(this.value()));var Io=this.__index__>=this.__values__.length,Oo=Io?to:this.__values__[this.__index__++];return{done:Io,value:Oo}}function h$(){return this}function p$(Io){for(var Oo,Uo=this;Uo instanceof Iy;){var yl=zw(Uo);yl.__index__=0,yl.__values__=to,Oo?Rl.__wrapped__=yl:Oo=yl;var Rl=yl;Uo=Uo.__wrapped__}return Rl.__wrapped__=Io,Oo}function m$(){var Io=this.__wrapped__;if(Io instanceof Sp){var Oo=Io;return this.__actions__.length&&(Oo=new Sp(this)),Oo=Oo.reverse(),Oo.__actions__.push({func:zy,args:[V1],thisArg:to}),new Cm(Oo,this.__chain__)}return this.thru(V1)}function g$(){return hw(this.__wrapped__,this.__actions__)}var y$=jy(function(Io,Oo,Uo){Np.call(Io,Uo)?++Io[Uo]:Zm(Io,Uo,1)});function v$(Io,Oo,Uo){var yl=gp(Io)?Cv:c2;return Uo&&um(Io,Oo,Uo)&&(Oo=to),yl(Io,ap(Oo,3))}function b$(Io,Oo){var Uo=gp(Io)?i0:Yv;return Uo(Io,ap(Oo,3))}var w$=$w(Hw),_$=$w(Vw);function x$(Io,Oo){return om(Hy(Io,Oo),1)}function E$(Io,Oo){return om(Hy(Io,Oo),_o)}function $$(Io,Oo,Uo){return Uo=Uo===to?1:vp(Uo),om(Hy(Io,Oo),Uo)}function Xw(Io,Oo){var Uo=gp(Io)?Sm:c0;return Uo(Io,ap(Oo,3))}function Qw(Io,Oo){var Uo=gp(Io)?W_:Jv;return Uo(Io,ap(Oo,3))}var S$=jy(function(Io,Oo,Uo){Np.call(Io,Uo)?Io[Uo].push(Oo):Zm(Io,Uo,[Oo])});function k$(Io,Oo,Uo,yl){Io=pm(Io)?Io:V0(Io),Uo=Uo&&!yl?vp(Uo):0;var Rl=Io.length;return Uo<0&&(Uo=rm(Rl+Uo,0)),Jy(Io)?Uo<=Rl&&Io.indexOf(Oo,Uo)>-1:!!Rl&&N0(Io,Oo,Uo)>-1}var C$=xp(function(Io,Oo,Uo){var yl=-1,Rl=typeof Oo=="function",Hl=pm(Io)?Su(Io.length):[];return c0(Io,function(iu){Hl[++yl]=Rl?nm(Oo,iu,Uo):ay(iu,Oo,Uo)}),Hl}),T$=jy(function(Io,Oo,Uo){Zm(Io,Uo,Oo)});function Hy(Io,Oo){var Uo=gp(Io)?Vp:rw;return Uo(Io,ap(Oo,3))}function I$(Io,Oo,Uo,yl){return Io==null?[]:(gp(Oo)||(Oo=Oo==null?[]:[Oo]),Uo=yl?to:Uo,gp(Uo)||(Uo=Uo==null?[]:[Uo]),aw(Io,Oo,Uo))}var R$=jy(function(Io,Oo,Uo){Io[Uo?0:1].push(Oo)},function(){return[[],[]]});function A$(Io,Oo,Uo){var yl=gp(Io)?n1:Av,Rl=arguments.length<3;return yl(Io,ap(Oo,4),Uo,Rl,c0)}function P$(Io,Oo,Uo){var yl=gp(Io)?q_:Av,Rl=arguments.length<3;return yl(Io,ap(Oo,4),Uo,Rl,Jv)}function O$(Io,Oo){var Uo=gp(Io)?i0:Yv;return Uo(Io,Gy(ap(Oo,3)))}function N$(Io){var Oo=gp(Io)?Vv:k2;return Oo(Io)}function M$(Io,Oo,Uo){(Uo?um(Io,Oo,Uo):Oo===to)?Oo=1:Oo=vp(Oo);var yl=gp(Io)?n2:C2;return yl(Io,Oo)}function j$(Io){var Oo=gp(Io)?i2:I2;return Oo(Io)}function B$(Io){if(Io==null)return 0;if(pm(Io))return Jy(Io)?j0(Io):Io.length;var Oo=sm(Io);return Oo==ga||Oo==Ml?Io.size:$1(Io).length}function D$(Io,Oo,Uo){var yl=gp(Io)?i1:R2;return Uo&&um(Io,Oo,Uo)&&(Oo=to),yl(Io,ap(Oo,3))}var L$=xp(function(Io,Oo){if(Io==null)return[];var Uo=Oo.length;return Uo>1&&um(Io,Oo[0],Oo[1])?Oo=[]:Uo>2&&um(Oo[0],Oo[1],Oo[2])&&(Oo=[Oo[0]]),aw(Io,om(Oo,1),[])}),Vy=vx||function(){return kp.Date.now()};function U$(Io,Oo){if(typeof Oo!="function")throw new km(oo);return Io=vp(Io),function(){if(--Io<1)return Oo.apply(this,arguments)}}function e_(Io,Oo,Uo){return Oo=Uo?to:Oo,Oo=Io&&Oo==null?Io.length:Oo,Jm(Io,No,to,to,to,to,Oo)}function t_(Io,Oo){var Uo;if(typeof Oo!="function")throw new km(oo);return Io=vp(Io),function(){return--Io>0&&(Uo=Oo.apply(this,arguments)),Io<=1&&(Oo=to),Uo}}var G1=xp(function(Io,Oo,Uo){var yl=wo;if(Uo.length){var Rl=a0(Uo,z0(G1));yl|=jo}return Jm(Io,yl,Oo,Uo,Rl)}),r_=xp(function(Io,Oo,Uo){var yl=wo|Eo;if(Uo.length){var Rl=a0(Uo,z0(r_));yl|=jo}return Jm(Oo,yl,Io,Uo,Rl)});function n_(Io,Oo,Uo){Oo=Uo?to:Oo;var yl=Jm(Io,Ao,to,to,to,to,to,Oo);return yl.placeholder=n_.placeholder,yl}function i_(Io,Oo,Uo){Oo=Uo?to:Oo;var yl=Jm(Io,Po,to,to,to,to,to,Oo);return yl.placeholder=i_.placeholder,yl}function o_(Io,Oo,Uo){var yl,Rl,Hl,iu,du,bu,Pu=0,Ou=!1,Fu=!1,_d=!0;if(typeof Io!="function")throw new km(oo);Oo=Am(Oo)||0,Gp(Uo)&&(Ou=!!Uo.leading,Fu="maxWait"in Uo,Hl=Fu?rm(Am(Uo.maxWait)||0,Oo):Hl,_d="trailing"in Uo?!!Uo.trailing:_d);function tp(Xp){var Bm=yl,t0=Rl;return yl=Rl=to,Pu=Xp,iu=Io.apply(t0,Bm),iu}function sp(Xp){return Pu=Xp,du=dy($p,Oo),Ou?tp(Xp):iu}function _p(Xp){var Bm=Xp-bu,t0=Xp-Pu,$_=Oo-Bm;return Fu?am($_,Hl-t0):$_}function cp(Xp){var Bm=Xp-bu,t0=Xp-Pu;return bu===to||Bm>=Oo||Bm<0||Fu&&t0>=Hl}function $p(){var Xp=Vy();if(cp(Xp))return Cp(Xp);du=dy($p,_p(Xp))}function Cp(Xp){return du=to,_d&&yl?tp(Xp):(yl=Rl=to,iu)}function _m(){du!==to&&mw(du),Pu=0,yl=bu=Rl=du=to}function dm(){return du===to?iu:Cp(Vy())}function xm(){var Xp=Vy(),Bm=cp(Xp);if(yl=arguments,Rl=this,bu=Xp,Bm){if(du===to)return sp(bu);if(Fu)return mw(du),du=dy($p,Oo),tp(bu)}return du===to&&(du=dy($p,Oo)),iu}return xm.cancel=_m,xm.flush=dm,xm}var F$=xp(function(Io,Oo){return Zv(Io,1,Oo)}),W$=xp(function(Io,Oo,Uo){return Zv(Io,Am(Oo)||0,Uo)});function q$(Io){return Jm(Io,Fo)}function Ky(Io,Oo){if(typeof Io!="function"||Oo!=null&&typeof Oo!="function")throw new km(oo);var Uo=function(){var yl=arguments,Rl=Oo?Oo.apply(this,yl):yl[0],Hl=Uo.cache;if(Hl.has(Rl))return Hl.get(Rl);var iu=Io.apply(this,yl);return Uo.cache=Hl.set(Rl,iu)||Hl,iu};return Uo.cache=new(Ky.Cache||Gm),Uo}Ky.Cache=Gm;function Gy(Io){if(typeof Io!="function")throw new km(oo);return function(){var Oo=arguments;switch(Oo.length){case 0:return!Io.call(this);case 1:return!Io.call(this,Oo[0]);case 2:return!Io.call(this,Oo[0],Oo[1]);case 3:return!Io.call(this,Oo[0],Oo[1],Oo[2])}return!Io.apply(this,Oo)}}function z$(Io){return t_(2,Io)}var H$=A2(function(Io,Oo){Oo=Oo.length==1&&gp(Oo[0])?Vp(Oo[0],ym(ap())):Vp(om(Oo,1),ym(ap()));var Uo=Oo.length;return xp(function(yl){for(var Rl=-1,Hl=am(yl.length,Uo);++Rl=Oo}),T0=_b(function(){return arguments}())?_b:function(Io){return Zp(Io)&&Np.call(Io,"callee")&&!Uv.call(Io,"callee")},gp=Su.isArray,aS=cm?ym(cm):p2;function pm(Io){return Io!=null&&Zy(Io.length)&&!Qm(Io)}function Yp(Io){return Zp(Io)&&pm(Io)}function sS(Io){return Io===!0||Io===!1||Zp(Io)&&lm(Io)==Ho}var f0=wx||vv,cS=Om?ym(Om):m2;function lS(Io){return Zp(Io)&&Io.nodeType===1&&!fy(Io)}function uS(Io){if(Io==null)return!0;if(pm(Io)&&(gp(Io)||typeof Io=="string"||typeof Io.splice=="function"||f0(Io)||H0(Io)||T0(Io)))return!Io.length;var Oo=sm(Io);if(Oo==ga||Oo==Ml)return!Io.size;if(uy(Io))return!$1(Io).length;for(var Uo in Io)if(Np.call(Io,Uo))return!1;return!0}function dS(Io,Oo){return sy(Io,Oo)}function fS(Io,Oo,Uo){Uo=typeof Uo=="function"?Uo:to;var yl=Uo?Uo(Io,Oo):to;return yl===to?sy(Io,Oo,to,Uo):!!yl}function J1(Io){if(!Zp(Io))return!1;var Oo=lm(Io);return Oo==Ko||Oo==zo||typeof Io.message=="string"&&typeof Io.name=="string"&&!fy(Io)}function hS(Io){return typeof Io=="number"&&Wv(Io)}function Qm(Io){if(!Gp(Io))return!1;var Oo=lm(Io);return Oo==_c||Oo==Cl||Oo==qo||Oo==zl}function s_(Io){return typeof Io=="number"&&Io==vp(Io)}function Zy(Io){return typeof Io=="number"&&Io>-1&&Io%1==0&&Io<=$o}function Gp(Io){var Oo=typeof Io;return Io!=null&&(Oo=="object"||Oo=="function")}function Zp(Io){return Io!=null&&typeof Io=="object"}var c_=$m?ym($m):y2;function pS(Io,Oo){return Io===Oo||E1(Io,Oo,U1(Oo))}function mS(Io,Oo,Uo){return Uo=typeof Uo=="function"?Uo:to,E1(Io,Oo,U1(Oo),Uo)}function gS(Io){return l_(Io)&&Io!=+Io}function yS(Io){if(eE(Io))throw new hp(io);return ew(Io)}function vS(Io){return Io===null}function bS(Io){return Io==null}function l_(Io){return typeof Io=="number"||Zp(Io)&&lm(Io)==El}function fy(Io){if(!Zp(Io)||lm(Io)!=Ol)return!1;var Oo=xy(Io);if(Oo===null)return!0;var Uo=Np.call(Oo,"constructor")&&Oo.constructor;return typeof Uo=="function"&&Uo instanceof Uo&&vy.call(Uo)==px}var Y1=Fm?ym(Fm):v2;function wS(Io){return s_(Io)&&Io>=-$o&&Io<=$o}var u_=Y0?ym(Y0):b2;function Jy(Io){return typeof Io=="string"||!gp(Io)&&Zp(Io)&&lm(Io)==ou}function wm(Io){return typeof Io=="symbol"||Zp(Io)&&lm(Io)==Vl}var H0=w0?ym(w0):w2;function _S(Io){return Io===to}function xS(Io){return Zp(Io)&&sm(Io)==uu}function ES(Io){return Zp(Io)&&lm(Io)==ru}var $S=Uy(S1),SS=Uy(function(Io,Oo){return Io<=Oo});function d_(Io){if(!Io)return[];if(pm(Io))return Jy(Io)?Nm(Io):hm(Io);if(Q0&&Io[Q0])return rx(Io[Q0]());var Oo=sm(Io),Uo=Oo==ga?u1:Oo==Ml?my:V0;return Uo(Io)}function e0(Io){if(!Io)return Io===0?Io:0;if(Io=Am(Io),Io===_o||Io===-_o){var Oo=Io<0?-1:1;return Oo*Co}return Io===Io?Io:0}function vp(Io){var Oo=e0(Io),Uo=Oo%1;return Oo===Oo?Uo?Oo-Uo:Oo:0}function f_(Io){return Io?$0(vp(Io),0,So):0}function Am(Io){if(typeof Io=="number")return Io;if(wm(Io))return Ro;if(Gp(Io)){var Oo=typeof Io.valueOf=="function"?Io.valueOf():Io;Io=Gp(Oo)?Oo+"":Oo}if(typeof Io!="string")return Io===0?Io:+Io;Io=Pv(Io);var Uo=Xu.test(Io);return Uo||zu.test(Io)?mp(Io.slice(2),Uo?2:8):su.test(Io)?Ro:+Io}function h_(Io){return qm(Io,mm(Io))}function kS(Io){return Io?$0(vp(Io),-$o,$o):Io===0?Io:0}function Op(Io){return Io==null?"":bm(Io)}var CS=W0(function(Io,Oo){if(uy(Oo)||pm(Oo)){qm(Oo,im(Oo),Io);return}for(var Uo in Oo)Np.call(Oo,Uo)&&iy(Io,Uo,Oo[Uo])}),p_=W0(function(Io,Oo){qm(Oo,mm(Oo),Io)}),Yy=W0(function(Io,Oo,Uo,yl){qm(Oo,mm(Oo),Io,yl)}),TS=W0(function(Io,Oo,Uo,yl){qm(Oo,im(Oo),Io,yl)}),IS=Ym(g1);function RS(Io,Oo){var Uo=F0(Io);return Oo==null?Uo:Kv(Uo,Oo)}var AS=xp(function(Io,Oo){Io=Bp(Io);var Uo=-1,yl=Oo.length,Rl=yl>2?Oo[2]:to;for(Rl&&um(Oo[0],Oo[1],Rl)&&(yl=1);++Uo1),Hl}),qm(Io,D1(Io),Uo),yl&&(Uo=Tm(Uo,fo|ho|go,W2));for(var Rl=Oo.length;Rl--;)R1(Uo,Oo[Rl]);return Uo});function JS(Io,Oo){return g_(Io,Gy(ap(Oo)))}var YS=Ym(function(Io,Oo){return Io==null?{}:E2(Io,Oo)});function g_(Io,Oo){if(Io==null)return{};var Uo=Vp(D1(Io),function(yl){return[yl]});return Oo=ap(Oo),sw(Io,Uo,function(yl,Rl){return Oo(yl,Rl[0])})}function XS(Io,Oo,Uo){Oo=u0(Oo,Io);var yl=-1,Rl=Oo.length;for(Rl||(Rl=1,Io=to);++ylOo){var yl=Io;Io=Oo,Oo=yl}if(Uo||Io%1||Oo%1){var Rl=qv();return am(Io+Rl*(Oo-Io+Mp("1e-"+((Rl+"").length-1))),Oo)}return C1(Io,Oo)}var l3=q0(function(Io,Oo,Uo){return Oo=Oo.toLowerCase(),Io+(Uo?b_(Oo):Oo)});function b_(Io){return lv(Op(Io).toLowerCase())}function w_(Io){return Io=Op(Io),Io&&Io.replace(Hu,Y_).replace(P0,"")}function u3(Io,Oo,Uo){Io=Op(Io),Oo=bm(Oo);var yl=Io.length;Uo=Uo===to?yl:$0(vp(Uo),0,yl);var Rl=Uo;return Uo-=Oo.length,Uo>=0&&Io.slice(Uo,Rl)==Oo}function d3(Io){return Io=Op(Io),Io&&_u.test(Io)?Io.replace(yu,X_):Io}function f3(Io){return Io=Op(Io),Io&&$u.test(Io)?Io.replace(Xl,"\\$&"):Io}var h3=q0(function(Io,Oo,Uo){return Io+(Uo?"-":"")+Oo.toLowerCase()}),p3=q0(function(Io,Oo,Uo){return Io+(Uo?" ":"")+Oo.toLowerCase()}),m3=Ew("toLowerCase");function g3(Io,Oo,Uo){Io=Op(Io),Oo=vp(Oo);var yl=Oo?j0(Io):0;if(!Oo||yl>=Oo)return Io;var Rl=(Oo-yl)/2;return Ly(ky(Rl),Uo)+Io+Ly(Sy(Rl),Uo)}function y3(Io,Oo,Uo){Io=Op(Io),Oo=vp(Oo);var yl=Oo?j0(Io):0;return Oo&&yl>>0,Uo?(Io=Op(Io),Io&&(typeof Oo=="string"||Oo!=null&&!Y1(Oo))&&(Oo=bm(Oo),!Oo&&M0(Io))?d0(Nm(Io),0,Uo):Io.split(Oo,Uo)):[]}var k3=q0(function(Io,Oo,Uo){return Io+(Uo?" ":"")+lv(Oo)});function C3(Io,Oo,Uo){return Io=Op(Io),Uo=Uo==null?0:$0(vp(Uo),0,Io.length),Oo=bm(Oo),Io.slice(Uo,Uo+Oo.length)==Oo}function T3(Io,Oo,Uo){var yl=Dl.templateSettings;Uo&&um(Io,Oo,Uo)&&(Oo=to),Io=Op(Io),Oo=Yy({},Oo,yl,Rw);var Rl=Yy({},Oo.imports,yl.imports,Rw),Hl=im(Rl),iu=l1(Rl,Hl),du,bu,Pu=0,Ou=Oo.interpolate||Gu,Fu="__p += '",_d=d1((Oo.escape||Gu).source+"|"+Ou.source+"|"+(Ou===Pl?xu:Gu).source+"|"+(Oo.evaluate||Gu).source+"|$","g"),tp="//# sourceURL="+(Np.call(Oo,"sourceURL")?(Oo.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++O0+"]")+` -`;Io.replace(_d,function(cp,$p,Cp,_m,dm,xm){return Cp||(Cp=_m),Fu+=Io.slice(Pu,xm).replace(Zu,Q_),$p&&(du=!0,Fu+=`' + -__e(`+$p+`) + -'`),dm&&(bu=!0,Fu+=`'; -`+dm+`; -__p += '`),Cp&&(Fu+=`' + -((__t = (`+Cp+`)) == null ? '' : __t) + -'`),Pu=xm+cp.length,cp}),Fu+=`'; -`;var sp=Np.call(Oo,"variable")&&Oo.variable;if(!sp)Fu=`with (obj) { -`+Fu+` +*/(function(Xr,eo){(function(){var to,ro="4.17.21",no=200,io="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",oo="Expected a function",ao="Invalid `variable` option passed into `_.template`",so="__lodash_hash_undefined__",co=500,lo="__lodash_placeholder__",uo=1,ho=2,go=4,bo=1,wo=2,Eo=1,$o=2,Co=4,Ro=8,Oo=16,jo=32,Bo=64,Mo=128,Fo=256,Wo=512,Jo=30,Po="...",fo=800,yo=16,vo=1,_o=2,So=3,To=1/0,Ao=9007199254740991,ko=17976931348623157e292,mo=NaN,Io=4294967295,Do=Io-1,Lo=Io>>>1,Ho=[["ary",Mo],["bind",Eo],["bindKey",$o],["curry",Ro],["curryRight",Oo],["flip",Wo],["partial",jo],["partialRight",Bo],["rearg",Fo]],Yo="[object Arguments]",Xo="[object Array]",qo="[object AsyncFunction]",Ko="[object Boolean]",Qo="[object Date]",zo="[object DOMException]",ga="[object Error]",$a="[object Function]",Sl="[object GeneratorFunction]",El="[object Map]",Tl="[object Number]",Il="[object Null]",Zl="[object Object]",Vl="[object Promise]",Ol="[object Proxy]",Dl="[object RegExp]",Fl="[object Set]",Jl="[object String]",cu="[object Symbol]",Ll="[object Undefined]",Xl="[object WeakMap]",ku="[object WeakSet]",iu="[object ArrayBuffer]",hu="[object DataView]",Cu="[object Float32Array]",_l="[object Float64Array]",Go="[object Int8Array]",yl="[object Int16Array]",Al="[object Int32Array]",Ul="[object Uint8Array]",su="[object Uint8ClampedArray]",Ql="[object Uint16Array]",vu="[object Uint32Array]",qu=/\b__p \+= '';/g,pu=/\b(__p \+=) '' \+/g,xu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Au=/&(?:amp|lt|gt|quot|#39);/g,yu=/[&<>"']/g,wu=RegExp(Au.source),Gu=RegExp(yu.source),Ml=/<%-([\s\S]+?)%>/g,Nl=/<%([\s\S]+?)%>/g,Yl=/<%=([\s\S]+?)%>/g,Wl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eu=/^\w*$/,Su=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ru=/[\\^$.*+?()[\]{}|]/g,uu=RegExp(ru.source),xl=/^\s+/,$l=/\s/,Cl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Zo=/\{\n\/\* \[wrapped with (.+)\] \*/,Rl=/,? & /,Hl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,au=/[()=,{}\[\]\/\s]/,tu=/\\(\\)?/g,lu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nu=/\w*$/,Pu=/^[-+]0x[0-9a-f]+$/i,ip=/^0b[01]+$/i,Lu=/^\[object .+?Constructor\]$/,Yu=/^0o[0-7]+$/i,_d=/^(?:0|[1-9]\d*)$/,Qu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_f=/($^)/,ep=/['\n\r\u2028\u2029\\]/g,Xu="\\ud800-\\udfff",_h="\\u0300-\\u036f",zu="\\ufe20-\\ufe2f",Vu="\\u20d0-\\u20ff",Fu=_h+zu+Vu,Tu="\\u2700-\\u27bf",Ru="a-z\\xdf-\\xf6\\xf8-\\xff",Ou="\\xac\\xb1\\xd7\\xf7",_u="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",$u="\\u2000-\\u206f",Uu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ju="A-Z\\xc0-\\xd6\\xd8-\\xde",Bu="\\ufe0e\\ufe0f",Hu=Ou+_u+$u+Uu,fp="['’]",wp="["+Xu+"]",xp="["+Hu+"]",gp="["+Fu+"]",fu="\\d+",Cp="["+Tu+"]",Rp="["+Ru+"]",Np="[^"+Xu+Hu+fu+Tu+Ru+ju+"]",_p="\\ud83c[\\udffb-\\udfff]",Tp="(?:"+gp+"|"+_p+")",Ap="[^"+Xu+"]",Kp="(?:\\ud83c[\\udde6-\\uddff]){2}",Sp="[\\ud800-\\udbff][\\udc00-\\udfff]",Ep="["+ju+"]",qp="\\u200d",Gp="(?:"+Rp+"|"+Np+")",Hp="(?:"+Ep+"|"+Np+")",Dp="(?:"+fp+"(?:d|ll|m|re|s|t|ve))?",lm="(?:"+fp+"(?:D|LL|M|RE|S|T|VE))?",rm=Tp+"?",V0="["+Bu+"]?",Uy="(?:"+qp+"(?:"+[Ap,Kp,Sp].join("|")+")"+V0+rm+")*",t0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",K0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",G0=V0+rm+Uy,Z0="(?:"+[Cp,Kp,Sp].join("|")+")"+G0,X0="(?:"+[Ap+gp+"?",gp,Kp,Sp,wp].join("|")+")",Wy=RegExp(fp,"g"),f0=RegExp(gp,"g"),C0=RegExp(_p+"(?="+_p+")|"+X0+G0,"g"),Q0=RegExp([Ep+"?"+Rp+"+"+Dp+"(?="+[xp,Ep,"$"].join("|")+")",Hp+"+"+lm+"(?="+[xp,Ep+Gp,"$"].join("|")+")",Ep+"?"+Gp+"+"+Dp,Ep+"+"+lm,K0,t0,fu,Z0].join("|"),"g"),ey=RegExp("["+qp+Xu+Fu+Bu+"]"),T0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ty=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zy=-1,vp={};vp[Cu]=vp[_l]=vp[Go]=vp[yl]=vp[Al]=vp[Ul]=vp[su]=vp[Ql]=vp[vu]=!0,vp[Yo]=vp[Xo]=vp[iu]=vp[Ko]=vp[hu]=vp[Qo]=vp[ga]=vp[$a]=vp[El]=vp[Tl]=vp[Zl]=vp[Dl]=vp[Fl]=vp[Jl]=vp[Xl]=!1;var yp={};yp[Yo]=yp[Xo]=yp[iu]=yp[hu]=yp[Ko]=yp[Qo]=yp[Cu]=yp[_l]=yp[Go]=yp[yl]=yp[Al]=yp[El]=yp[Tl]=yp[Zl]=yp[Dl]=yp[Fl]=yp[Jl]=yp[cu]=yp[Ul]=yp[su]=yp[Ql]=yp[vu]=!0,yp[ga]=yp[$a]=yp[Xl]=!1;var ou={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Eu={"&":"&","<":"<",">":">",'"':""","'":"'"},Wu={"&":"&","<":"<",">":">",""":'"',"'":"'"},up={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Op=parseFloat,Ip=parseInt,cm=typeof ge$2=="object"&&ge$2&&ge$2.Object===Object&&ge$2,Am=typeof self=="object"&&self&&self.Object===Object&&self,$p=cm||Am||Function("return this")(),Xp=eo&&!eo.nodeType&&eo,nm=Xp&&!0&&Xr&&!Xr.nodeType&&Xr,Hm=nm&&nm.exports===Xp,Sm=Hm&&cm.process,Wp=function(){try{var zl=nm&&nm.require&&nm.require("util").types;return zl||Sm&&Sm.binding&&Sm.binding("util")}catch{}}(),qm=Wp&&Wp.isArrayBuffer,d0=Wp&&Wp.isDate,r0=Wp&&Wp.isMap,h0=Wp&&Wp.isRegExp,qy=Wp&&Wp.isSet,J0=Wp&&Wp.isTypedArray;function Yp(zl,du,nu){switch(nu.length){case 0:return zl.call(du);case 1:return zl.call(du,nu[0]);case 2:return zl.call(du,nu[0],nu[1]);case 3:return zl.call(du,nu[0],nu[1],nu[2])}return zl.apply(du,nu)}function y_(zl,du,nu,Mu){for(var tp=-1,hp=zl==null?0:zl.length;++tp-1}function Vy(zl,du,nu){for(var Mu=-1,tp=zl==null?0:zl.length;++Mu-1;);return nu}function xv(zl,du){for(var nu=zl.length;nu--&&p0(du,zl[nu],0)>-1;);return nu}function k_(zl,du){for(var nu=zl.length,Mu=0;nu--;)zl[nu]===du&&++Mu;return Mu}var C_=Jy(ou),T_=Jy(Eu);function I_(zl){return"\\"+up[zl]}function R_(zl,du){return zl==null?to:zl[du]}function m0(zl){return ey.test(zl)}function A_(zl){return T0.test(zl)}function P_(zl){for(var du,nu=[];!(du=zl.next()).done;)nu.push(du.value);return nu}function e1(zl){var du=-1,nu=Array(zl.size);return zl.forEach(function(Mu,tp){nu[++du]=[tp,Mu]}),nu}function Ev(zl,du){return function(nu){return zl(du(nu))}}function Gm(zl,du){for(var nu=-1,Mu=zl.length,tp=0,hp=[];++nu-1}function bx(po,xo){var No=this.__data__,Uo=by(No,po);return Uo<0?(++this.size,No.push([po,xo])):No[Uo][1]=xo,this}Mm.prototype.clear=mx,Mm.prototype.delete=gx,Mm.prototype.get=yx,Mm.prototype.has=vx,Mm.prototype.set=bx;function jm(po){var xo=-1,No=po==null?0:po.length;for(this.clear();++xo=xo?po:xo)),po}function wm(po,xo,No,Uo,Vo,wl){var Pl,Bl=xo&uo,Gl=xo&ho,mu=xo&go;if(No&&(Pl=Vo?No(po,Uo,Vo,wl):No(po)),Pl!==to)return Pl;if(!Pp(po))return po;var gu=rp(po);if(gu){if(Pl=$E(po),!Bl)return im(po,Pl)}else{var bu=Jp(po),Iu=bu==$a||bu==Sl;if(e0(po))return iw(po,Bl);if(bu==Zl||bu==Yo||Iu&&!Vo){if(Pl=Gl||Iu?{}:Ew(po),!Bl)return Gl?hE(po,jx(Pl,po)):fE(po,Mv(Pl,po))}else{if(!yp[bu])return Vo?po:{};Pl=SE(po,bu,Bl)}}wl||(wl=new Tm);var Du=wl.get(po);if(Du)return Du;wl.set(po,Pl),Xw(po)?po.forEach(function(Ju){Pl.add(wm(Ju,xo,No,Ju,po,wl))}):Jw(po)&&po.forEach(function(Ju,cp){Pl.set(cp,wm(Ju,xo,No,cp,po,wl))});var Zu=mu?Gl?T1:C1:Gl?am:zp,op=gu?to:Zu(po);return gm(op||po,function(Ju,cp){op&&(cp=Ju,Ju=po[cp]),M0(Pl,cp,wm(Ju,xo,No,cp,po,wl))}),Pl}function Bx(po){var xo=zp(po);return function(No){return jv(No,po,xo)}}function jv(po,xo,No){var Uo=No.length;if(po==null)return!Uo;for(po=bp(po);Uo--;){var Vo=No[Uo],wl=xo[Vo],Pl=po[Vo];if(Pl===to&&!(Vo in po)||!wl(Pl))return!1}return!0}function Bv(po,xo,No){if(typeof po!="function")throw new ym(oo);return W0(function(){po.apply(to,No)},xo)}function j0(po,xo,No,Uo){var Vo=-1,wl=ry,Pl=!0,Bl=po.length,Gl=[],mu=xo.length;if(!Bl)return Gl;No&&(xo=kp(xo,um(No))),Uo?(wl=Vy,Pl=!1):xo.length>=no&&(wl=I0,Pl=!1,xo=new o0(xo));e:for(;++VoVo?0:Vo+No),Uo=Uo===to||Uo>Vo?Vo:np(Uo),Uo<0&&(Uo+=Vo),Uo=No>Uo?0:e_(Uo);No0&&No(Bl)?xo>1?Vp(Bl,xo-1,No,Uo,Vo):Km(Vo,Bl):Uo||(Vo[Vo.length]=Bl)}return Vo}var s1=uw(),Fv=uw(!0);function Pm(po,xo){return po&&s1(po,xo,zp)}function c1(po,xo){return po&&Fv(po,xo,zp)}function _y(po,xo){return Vm(xo,function(No){return Um(po[No])})}function s0(po,xo){xo=Xm(xo,po);for(var No=0,Uo=xo.length;po!=null&&Noxo}function Fx(po,xo){return po!=null&&mp.call(po,xo)}function Ux(po,xo){return po!=null&&xo in bp(po)}function Wx(po,xo,No){return po>=Zp(xo,No)&&po=120&&gu.length>=120)?new o0(Pl&&gu):to}gu=po[0];var bu=-1,Iu=Bl[0];e:for(;++bu-1;)Bl!==po&&fy.call(Bl,Gl,1),fy.call(po,Gl,1);return po}function Yv(po,xo){for(var No=po?xo.length:0,Uo=No-1;No--;){var Vo=xo[No];if(No==Uo||Vo!==wl){var wl=Vo;Fm(Vo)?fy.call(po,Vo,1):b1(po,Vo)}}return po}function m1(po,xo){return po+my(Av()*(xo-po+1))}function tE(po,xo,No,Uo){for(var Vo=-1,wl=Up(py((xo-po)/(No||1)),0),Pl=nu(wl);wl--;)Pl[Uo?wl:++Vo]=po,po+=No;return Pl}function g1(po,xo){var No="";if(!po||xo<1||xo>Ao)return No;do xo%2&&(No+=po),xo=my(xo/2),xo&&(po+=po);while(xo);return No}function ap(po,xo){return M1(kw(po,xo,sm),po+"")}function rE(po){return Ov(k0(po))}function nE(po,xo){var No=k0(po);return Py(No,a0(xo,0,No.length))}function L0(po,xo,No,Uo){if(!Pp(po))return po;xo=Xm(xo,po);for(var Vo=-1,wl=xo.length,Pl=wl-1,Bl=po;Bl!=null&&++VoVo?0:Vo+xo),No=No>Vo?Vo:No,No<0&&(No+=Vo),Vo=xo>No?0:No-xo>>>0,xo>>>=0;for(var wl=nu(Vo);++Uo>>1,Pl=po[wl];Pl!==null&&!fm(Pl)&&(No?Pl<=xo:Pl=no){var mu=xo?null:yE(po);if(mu)return iy(mu);Pl=!1,Vo=I0,Gl=new o0}else Gl=xo?[]:Bl;e:for(;++Uo=Uo?po:_m(po,xo,No)}var nw=K_||function(po){return $p.clearTimeout(po)};function iw(po,xo){if(xo)return po.slice();var No=po.length,Uo=kv?kv(No):new po.constructor(No);return po.copy(Uo),Uo}function $1(po){var xo=new po.constructor(po.byteLength);return new uy(xo).set(new uy(po)),xo}function cE(po,xo){var No=xo?$1(po.buffer):po.buffer;return new po.constructor(No,po.byteOffset,po.byteLength)}function lE(po){var xo=new po.constructor(po.source,Nu.exec(po));return xo.lastIndex=po.lastIndex,xo}function uE(po){return O0?bp(O0.call(po)):{}}function ow(po,xo){var No=xo?$1(po.buffer):po.buffer;return new po.constructor(No,po.byteOffset,po.length)}function aw(po,xo){if(po!==xo){var No=po!==to,Uo=po===null,Vo=po===po,wl=fm(po),Pl=xo!==to,Bl=xo===null,Gl=xo===xo,mu=fm(xo);if(!Bl&&!mu&&!wl&&po>xo||wl&&Pl&&Gl&&!Bl&&!mu||Uo&&Pl&&Gl||!No&&Gl||!Vo)return 1;if(!Uo&&!wl&&!mu&&po=Bl)return Gl;var mu=No[Uo];return Gl*(mu=="desc"?-1:1)}}return po.index-xo.index}function sw(po,xo,No,Uo){for(var Vo=-1,wl=po.length,Pl=No.length,Bl=-1,Gl=xo.length,mu=Up(wl-Pl,0),gu=nu(Gl+mu),bu=!Uo;++Bl1?No[Vo-1]:to,Pl=Vo>2?No[2]:to;for(wl=po.length>3&&typeof wl=="function"?(Vo--,wl):to,Pl&&em(No[0],No[1],Pl)&&(wl=Vo<3?to:wl,Vo=1),xo=bp(xo);++Uo-1?Vo[wl?xo[Pl]:Pl]:to}}function hw(po){return Lm(function(xo){var No=xo.length,Uo=No,Vo=bm.prototype.thru;for(po&&xo.reverse();Uo--;){var wl=xo[Uo];if(typeof wl!="function")throw new ym(oo);if(Vo&&!Pl&&Ry(wl)=="wrapper")var Pl=new bm([],!0)}for(Uo=Pl?Uo:No;++Uo1&&dp.reverse(),gu&&GlBl))return!1;var mu=wl.get(po),gu=wl.get(xo);if(mu&&gu)return mu==xo&&gu==po;var bu=-1,Iu=!0,Du=No&wo?new o0:to;for(wl.set(po,xo),wl.set(xo,po);++bu1?"& ":"")+xo[Uo],xo=xo.join(No>2?", ":" "),po.replace(Cl,`{ +/* [wrapped with `+xo+`] */ +`)}function CE(po){return rp(po)||u0(po)||!!(Iv&&po&&po[Iv])}function Fm(po,xo){var No=typeof po;return xo=xo??Ao,!!xo&&(No=="number"||No!="symbol"&&_d.test(po))&&po>-1&&po%1==0&&po0){if(++xo>=fo)return arguments[0]}else xo=0;return po.apply(to,arguments)}}function Py(po,xo){var No=-1,Uo=po.length,Vo=Uo-1;for(xo=xo===to?Uo:xo;++No1?po[xo-1]:to;return No=typeof No=="function"?(po.pop(),No):to,Dw(po,No)});function Lw(po){var xo=_c(po);return xo.__chain__=!0,xo}function D2(po,xo){return xo(po),po}function Ny(po,xo){return xo(po)}var L2=Lm(function(po){var xo=po.length,No=xo?po[0]:0,Uo=this.__wrapped__,Vo=function(wl){return a1(wl,po)};return xo>1||this.__actions__.length||!(Uo instanceof lp)||!Fm(No)?this.thru(Vo):(Uo=Uo.slice(No,+No+(xo?1:0)),Uo.__actions__.push({func:Ny,args:[Vo],thisArg:to}),new bm(Uo,this.__chain__).thru(function(wl){return xo&&!wl.length&&wl.push(to),wl}))});function F2(){return Lw(this)}function U2(){return new bm(this.value(),this.__chain__)}function W2(){this.__values__===to&&(this.__values__=Qw(this.value()));var po=this.__index__>=this.__values__.length,xo=po?to:this.__values__[this.__index__++];return{done:po,value:xo}}function z2(){return this}function q2(po){for(var xo,No=this;No instanceof vy;){var Uo=Pw(No);Uo.__index__=0,Uo.__values__=to,xo?Vo.__wrapped__=Uo:xo=Uo;var Vo=Uo;No=No.__wrapped__}return Vo.__wrapped__=po,xo}function H2(){var po=this.__wrapped__;if(po instanceof lp){var xo=po;return this.__actions__.length&&(xo=new lp(this)),xo=xo.reverse(),xo.__actions__.push({func:Ny,args:[j1],thisArg:to}),new bm(xo,this.__chain__)}return this.thru(j1)}function V2(){return tw(this.__wrapped__,this.__actions__)}var K2=Sy(function(po,xo,No){mp.call(po,No)?++po[No]:Bm(po,No,1)});function G2(po,xo,No){var Uo=rp(po)?mv:Dx;return No&&em(po,xo,No)&&(xo=to),Uo(po,Ku(xo,3))}function Z2(po,xo){var No=rp(po)?Vm:Lv;return No(po,Ku(xo,3))}var J2=fw(Nw),Y2=fw(Ow);function X2(po,xo){return Vp(Oy(po,xo),1)}function Q2(po,xo){return Vp(Oy(po,xo),To)}function e$(po,xo,No){return No=No===to?1:np(No),Vp(Oy(po,xo),No)}function Fw(po,xo){var No=rp(po)?gm:Jm;return No(po,Ku(xo,3))}function Uw(po,xo){var No=rp(po)?v_:Dv;return No(po,Ku(xo,3))}var t$=Sy(function(po,xo,No){mp.call(po,No)?po[No].push(xo):Bm(po,No,[xo])});function r$(po,xo,No,Uo){po=om(po)?po:k0(po),No=No&&!Uo?np(No):0;var Vo=po.length;return No<0&&(No=Up(Vo+No,0)),Ly(po)?No<=Vo&&po.indexOf(xo,No)>-1:!!Vo&&p0(po,xo,No)>-1}var n$=ap(function(po,xo,No){var Uo=-1,Vo=typeof xo=="function",wl=om(po)?nu(po.length):[];return Jm(po,function(Pl){wl[++Uo]=Vo?Yp(xo,Pl,No):B0(Pl,xo,No)}),wl}),i$=Sy(function(po,xo,No){Bm(po,No,xo)});function Oy(po,xo){var No=rp(po)?kp:Hv;return No(po,Ku(xo,3))}function o$(po,xo,No,Uo){return po==null?[]:(rp(xo)||(xo=xo==null?[]:[xo]),No=Uo?to:No,rp(No)||(No=No==null?[]:[No]),Zv(po,xo,No))}var a$=Sy(function(po,xo,No){po[No?0:1].push(xo)},function(){return[[],[]]});function s$(po,xo,No){var Uo=rp(po)?Ky:bv,Vo=arguments.length<3;return Uo(po,Ku(xo,4),No,Vo,Jm)}function c$(po,xo,No){var Uo=rp(po)?b_:bv,Vo=arguments.length<3;return Uo(po,Ku(xo,4),No,Vo,Dv)}function l$(po,xo){var No=rp(po)?Vm:Lv;return No(po,By(Ku(xo,3)))}function u$(po){var xo=rp(po)?Ov:rE;return xo(po)}function d$(po,xo,No){(No?em(po,xo,No):xo===to)?xo=1:xo=np(xo);var Uo=rp(po)?Nx:nE;return Uo(po,xo)}function f$(po){var xo=rp(po)?Ox:oE;return xo(po)}function h$(po){if(po==null)return 0;if(om(po))return Ly(po)?g0(po):po.length;var xo=Jp(po);return xo==El||xo==Fl?po.size:f1(po).length}function p$(po,xo,No){var Uo=rp(po)?Gy:aE;return No&&em(po,xo,No)&&(xo=to),Uo(po,Ku(xo,3))}var m$=ap(function(po,xo){if(po==null)return[];var No=xo.length;return No>1&&em(po,xo[0],xo[1])?xo=[]:No>2&&em(xo[0],xo[1],xo[2])&&(xo=[xo[0]]),Zv(po,Vp(xo,1),[])}),My=G_||function(){return $p.Date.now()};function g$(po,xo){if(typeof xo!="function")throw new ym(oo);return po=np(po),function(){if(--po<1)return xo.apply(this,arguments)}}function Ww(po,xo,No){return xo=No?to:xo,xo=po&&xo==null?po.length:xo,Dm(po,Mo,to,to,to,to,xo)}function zw(po,xo){var No;if(typeof xo!="function")throw new ym(oo);return po=np(po),function(){return--po>0&&(No=xo.apply(this,arguments)),po<=1&&(xo=to),No}}var D1=ap(function(po,xo,No){var Uo=Eo;if(No.length){var Vo=Gm(No,$0(D1));Uo|=jo}return Dm(po,Uo,xo,No,Vo)}),qw=ap(function(po,xo,No){var Uo=Eo|$o;if(No.length){var Vo=Gm(No,$0(qw));Uo|=jo}return Dm(xo,Uo,po,No,Vo)});function Hw(po,xo,No){xo=No?to:xo;var Uo=Dm(po,Ro,to,to,to,to,to,xo);return Uo.placeholder=Hw.placeholder,Uo}function Vw(po,xo,No){xo=No?to:xo;var Uo=Dm(po,Oo,to,to,to,to,to,xo);return Uo.placeholder=Vw.placeholder,Uo}function Kw(po,xo,No){var Uo,Vo,wl,Pl,Bl,Gl,mu=0,gu=!1,bu=!1,Iu=!0;if(typeof po!="function")throw new ym(oo);xo=Em(xo)||0,Pp(No)&&(gu=!!No.leading,bu="maxWait"in No,wl=bu?Up(Em(No.maxWait)||0,xo):wl,Iu="trailing"in No?!!No.trailing:Iu);function Du(Bp){var Rm=Uo,zm=Vo;return Uo=Vo=to,mu=Bp,Pl=po.apply(zm,Rm),Pl}function Zu(Bp){return mu=Bp,Bl=W0(cp,xo),gu?Du(Bp):Pl}function op(Bp){var Rm=Bp-Gl,zm=Bp-mu,f_=xo-Rm;return bu?Zp(f_,wl-zm):f_}function Ju(Bp){var Rm=Bp-Gl,zm=Bp-mu;return Gl===to||Rm>=xo||Rm<0||bu&&zm>=wl}function cp(){var Bp=My();if(Ju(Bp))return dp(Bp);Bl=W0(cp,op(Bp))}function dp(Bp){return Bl=to,Iu&&Uo?Du(Bp):(Uo=Vo=to,Pl)}function hm(){Bl!==to&&nw(Bl),mu=0,Uo=Gl=Vo=Bl=to}function tm(){return Bl===to?Pl:dp(My())}function pm(){var Bp=My(),Rm=Ju(Bp);if(Uo=arguments,Vo=this,Gl=Bp,Rm){if(Bl===to)return Zu(Gl);if(bu)return nw(Bl),Bl=W0(cp,xo),Du(Gl)}return Bl===to&&(Bl=W0(cp,xo)),Pl}return pm.cancel=hm,pm.flush=tm,pm}var y$=ap(function(po,xo){return Bv(po,1,xo)}),v$=ap(function(po,xo,No){return Bv(po,Em(xo)||0,No)});function b$(po){return Dm(po,Wo)}function jy(po,xo){if(typeof po!="function"||xo!=null&&typeof xo!="function")throw new ym(oo);var No=function(){var Uo=arguments,Vo=xo?xo.apply(this,Uo):Uo[0],wl=No.cache;if(wl.has(Vo))return wl.get(Vo);var Pl=po.apply(this,Uo);return No.cache=wl.set(Vo,Pl)||wl,Pl};return No.cache=new(jy.Cache||jm),No}jy.Cache=jm;function By(po){if(typeof po!="function")throw new ym(oo);return function(){var xo=arguments;switch(xo.length){case 0:return!po.call(this);case 1:return!po.call(this,xo[0]);case 2:return!po.call(this,xo[0],xo[1]);case 3:return!po.call(this,xo[0],xo[1],xo[2])}return!po.apply(this,xo)}}function w$(po){return zw(2,po)}var _$=sE(function(po,xo){xo=xo.length==1&&rp(xo[0])?kp(xo[0],um(Ku())):kp(Vp(xo,1),um(Ku()));var No=xo.length;return ap(function(Uo){for(var Vo=-1,wl=Zp(Uo.length,No);++Vo=xo}),u0=Wv(function(){return arguments}())?Wv:function(po){return Mp(po)&&mp.call(po,"callee")&&!Tv.call(po,"callee")},rp=nu.isArray,j$=qm?um(qm):qx;function om(po){return po!=null&&Dy(po.length)&&!Um(po)}function jp(po){return Mp(po)&&om(po)}function B$(po){return po===!0||po===!1||Mp(po)&&Qp(po)==Ko}var e0=J_||J1,D$=d0?um(d0):Hx;function L$(po){return Mp(po)&&po.nodeType===1&&!z0(po)}function F$(po){if(po==null)return!0;if(om(po)&&(rp(po)||typeof po=="string"||typeof po.splice=="function"||e0(po)||S0(po)||u0(po)))return!po.length;var xo=Jp(po);if(xo==El||xo==Fl)return!po.size;if(U0(po))return!f1(po).length;for(var No in po)if(mp.call(po,No))return!1;return!0}function U$(po,xo){return D0(po,xo)}function W$(po,xo,No){No=typeof No=="function"?No:to;var Uo=No?No(po,xo):to;return Uo===to?D0(po,xo,to,No):!!Uo}function F1(po){if(!Mp(po))return!1;var xo=Qp(po);return xo==ga||xo==zo||typeof po.message=="string"&&typeof po.name=="string"&&!z0(po)}function z$(po){return typeof po=="number"&&Rv(po)}function Um(po){if(!Pp(po))return!1;var xo=Qp(po);return xo==$a||xo==Sl||xo==qo||xo==Ol}function Zw(po){return typeof po=="number"&&po==np(po)}function Dy(po){return typeof po=="number"&&po>-1&&po%1==0&&po<=Ao}function Pp(po){var xo=typeof po;return po!=null&&(xo=="object"||xo=="function")}function Mp(po){return po!=null&&typeof po=="object"}var Jw=r0?um(r0):Kx;function q$(po,xo){return po===xo||d1(po,xo,R1(xo))}function H$(po,xo,No){return No=typeof No=="function"?No:to,d1(po,xo,R1(xo),No)}function V$(po){return Yw(po)&&po!=+po}function K$(po){if(RE(po))throw new tp(io);return zv(po)}function G$(po){return po===null}function Z$(po){return po==null}function Yw(po){return typeof po=="number"||Mp(po)&&Qp(po)==Tl}function z0(po){if(!Mp(po)||Qp(po)!=Zl)return!1;var xo=dy(po);if(xo===null)return!0;var No=mp.call(xo,"constructor")&&xo.constructor;return typeof No=="function"&&No instanceof No&&sy.call(No)==q_}var U1=h0?um(h0):Gx;function J$(po){return Zw(po)&&po>=-Ao&&po<=Ao}var Xw=qy?um(qy):Zx;function Ly(po){return typeof po=="string"||!rp(po)&&Mp(po)&&Qp(po)==Jl}function fm(po){return typeof po=="symbol"||Mp(po)&&Qp(po)==cu}var S0=J0?um(J0):Jx;function Y$(po){return po===to}function X$(po){return Mp(po)&&Jp(po)==Xl}function Q$(po){return Mp(po)&&Qp(po)==ku}var eS=Iy(h1),tS=Iy(function(po,xo){return po<=xo});function Qw(po){if(!po)return[];if(om(po))return Ly(po)?Cm(po):im(po);if(R0&&po[R0])return P_(po[R0]());var xo=Jp(po),No=xo==El?e1:xo==Fl?iy:k0;return No(po)}function Wm(po){if(!po)return po===0?po:0;if(po=Em(po),po===To||po===-To){var xo=po<0?-1:1;return xo*ko}return po===po?po:0}function np(po){var xo=Wm(po),No=xo%1;return xo===xo?No?xo-No:xo:0}function e_(po){return po?a0(np(po),0,Io):0}function Em(po){if(typeof po=="number")return po;if(fm(po))return mo;if(Pp(po)){var xo=typeof po.valueOf=="function"?po.valueOf():po;po=Pp(xo)?xo+"":xo}if(typeof po!="string")return po===0?po:+po;po=wv(po);var No=ip.test(po);return No||Yu.test(po)?Ip(po.slice(2),No?2:8):Pu.test(po)?mo:+po}function t_(po){return Nm(po,am(po))}function rS(po){return po?a0(np(po),-Ao,Ao):po===0?po:0}function pp(po){return po==null?"":dm(po)}var nS=x0(function(po,xo){if(U0(xo)||om(xo)){Nm(xo,zp(xo),po);return}for(var No in xo)mp.call(xo,No)&&M0(po,No,xo[No])}),r_=x0(function(po,xo){Nm(xo,am(xo),po)}),Fy=x0(function(po,xo,No,Uo){Nm(xo,am(xo),po,Uo)}),iS=x0(function(po,xo,No,Uo){Nm(xo,zp(xo),po,Uo)}),oS=Lm(a1);function aS(po,xo){var No=_0(po);return xo==null?No:Mv(No,xo)}var sS=ap(function(po,xo){po=bp(po);var No=-1,Uo=xo.length,Vo=Uo>2?xo[2]:to;for(Vo&&em(xo[0],xo[1],Vo)&&(Uo=1);++No1),wl}),Nm(po,T1(po),No),Uo&&(No=wm(No,uo|ho|go,vE));for(var Vo=xo.length;Vo--;)b1(No,xo[Vo]);return No});function SS(po,xo){return i_(po,By(Ku(xo)))}var kS=Lm(function(po,xo){return po==null?{}:Qx(po,xo)});function i_(po,xo){if(po==null)return{};var No=kp(T1(po),function(Uo){return[Uo]});return xo=Ku(xo),Jv(po,No,function(Uo,Vo){return xo(Uo,Vo[0])})}function CS(po,xo,No){xo=Xm(xo,po);var Uo=-1,Vo=xo.length;for(Vo||(Vo=1,po=to);++Uoxo){var Uo=po;po=xo,xo=Uo}if(No||po%1||xo%1){var Vo=Av();return Zp(po+Vo*(xo-po+Op("1e-"+((Vo+"").length-1))),xo)}return m1(po,xo)}var FS=E0(function(po,xo,No){return xo=xo.toLowerCase(),po+(No?s_(xo):xo)});function s_(po){return q1(pp(po).toLowerCase())}function c_(po){return po=pp(po),po&&po.replace(Qu,C_).replace(f0,"")}function US(po,xo,No){po=pp(po),xo=dm(xo);var Uo=po.length;No=No===to?Uo:a0(np(No),0,Uo);var Vo=No;return No-=xo.length,No>=0&&po.slice(No,Vo)==xo}function WS(po){return po=pp(po),po&&Gu.test(po)?po.replace(yu,T_):po}function zS(po){return po=pp(po),po&&uu.test(po)?po.replace(ru,"\\$&"):po}var qS=E0(function(po,xo,No){return po+(No?"-":"")+xo.toLowerCase()}),HS=E0(function(po,xo,No){return po+(No?" ":"")+xo.toLowerCase()}),VS=dw("toLowerCase");function KS(po,xo,No){po=pp(po),xo=np(xo);var Uo=xo?g0(po):0;if(!xo||Uo>=xo)return po;var Vo=(xo-Uo)/2;return Ty(my(Vo),No)+po+Ty(py(Vo),No)}function GS(po,xo,No){po=pp(po),xo=np(xo);var Uo=xo?g0(po):0;return xo&&Uo>>0,No?(po=pp(po),po&&(typeof xo=="string"||xo!=null&&!U1(xo))&&(xo=dm(xo),!xo&&m0(po))?Qm(Cm(po),0,No):po.split(xo,No)):[]}var t3=E0(function(po,xo,No){return po+(No?" ":"")+q1(xo)});function r3(po,xo,No){return po=pp(po),No=No==null?0:a0(np(No),0,po.length),xo=dm(xo),po.slice(No,No+xo.length)==xo}function n3(po,xo,No){var Uo=_c.templateSettings;No&&em(po,xo,No)&&(xo=to),po=pp(po),xo=Fy({},xo,Uo,vw);var Vo=Fy({},xo.imports,Uo.imports,vw),wl=zp(Vo),Pl=Qy(Vo,wl),Bl,Gl,mu=0,gu=xo.interpolate||_f,bu="__p += '",Iu=t1((xo.escape||_f).source+"|"+gu.source+"|"+(gu===Yl?lu:_f).source+"|"+(xo.evaluate||_f).source+"|$","g"),Du="//# sourceURL="+(mp.call(xo,"sourceURL")?(xo.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zy+"]")+` +`;po.replace(Iu,function(Ju,cp,dp,hm,tm,pm){return dp||(dp=hm),bu+=po.slice(mu,pm).replace(ep,I_),cp&&(Bl=!0,bu+=`' + +__e(`+cp+`) + +'`),tm&&(Gl=!0,bu+=`'; +`+tm+`; +__p += '`),dp&&(bu+=`' + +((__t = (`+dp+`)) == null ? '' : __t) + +'`),mu=pm+Ju.length,Ju}),bu+=`'; +`;var Zu=mp.call(xo,"variable")&&xo.variable;if(!Zu)bu=`with (obj) { +`+bu+` } -`;else if(Fl.test(sp))throw new hp(ao);Fu=(bu?Fu.replace(hu,""):Fu).replace(cu,"$1").replace(Wu,"$1;"),Fu="function("+(sp||"obj")+`) { -`+(sp?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(du?", __e = _.escape":"")+(bu?`, __j = Array.prototype.join; +`;else if(au.test(Zu))throw new tp(ao);bu=(Gl?bu.replace(qu,""):bu).replace(pu,"$1").replace(xu,"$1;"),bu="function("+(Zu||"obj")+`) { +`+(Zu?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(Bl?", __e = _.escape":"")+(Gl?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; -`)+Fu+`return __p -}`;var _p=x_(function(){return Rp(Hl,tp+"return "+Fu).apply(to,iu)});if(_p.source=Fu,J1(_p))throw _p;return _p}function I3(Io){return Op(Io).toLowerCase()}function R3(Io){return Op(Io).toUpperCase()}function A3(Io,Oo,Uo){if(Io=Op(Io),Io&&(Uo||Oo===to))return Pv(Io);if(!Io||!(Oo=bm(Oo)))return Io;var yl=Nm(Io),Rl=Nm(Oo),Hl=Ov(yl,Rl),iu=Nv(yl,Rl)+1;return d0(yl,Hl,iu).join("")}function P3(Io,Oo,Uo){if(Io=Op(Io),Io&&(Uo||Oo===to))return Io.slice(0,jv(Io)+1);if(!Io||!(Oo=bm(Oo)))return Io;var yl=Nm(Io),Rl=Nv(yl,Nm(Oo))+1;return d0(yl,0,Rl).join("")}function O3(Io,Oo,Uo){if(Io=Op(Io),Io&&(Uo||Oo===to))return Io.replace(Yo,"");if(!Io||!(Oo=bm(Oo)))return Io;var yl=Nm(Io),Rl=Ov(yl,Nm(Oo));return d0(yl,Rl).join("")}function N3(Io,Oo){var Uo=Xo,yl=Lo;if(Gp(Oo)){var Rl="separator"in Oo?Oo.separator:Rl;Uo="length"in Oo?vp(Oo.length):Uo,yl="omission"in Oo?bm(Oo.omission):yl}Io=Op(Io);var Hl=Io.length;if(M0(Io)){var iu=Nm(Io);Hl=iu.length}if(Uo>=Hl)return Io;var du=Uo-j0(yl);if(du<1)return yl;var bu=iu?d0(iu,0,du).join(""):Io.slice(0,du);if(Rl===to)return bu+yl;if(iu&&(du+=bu.length-du),Y1(Rl)){if(Io.slice(du).search(Rl)){var Pu,Ou=bu;for(Rl.global||(Rl=d1(Rl.source,Op(lu.exec(Rl))+"g")),Rl.lastIndex=0;Pu=Rl.exec(Ou);)var Fu=Pu.index;bu=bu.slice(0,Fu===to?du:Fu)}}else if(Io.indexOf(bm(Rl),du)!=du){var _d=bu.lastIndexOf(Rl);_d>-1&&(bu=bu.slice(0,_d))}return bu+yl}function M3(Io){return Io=Op(Io),Io&&Yu.test(Io)?Io.replace(mu,ax):Io}var j3=q0(function(Io,Oo,Uo){return Io+(Uo?" ":"")+Oo.toUpperCase()}),lv=Ew("toUpperCase");function __(Io,Oo,Uo){return Io=Op(Io),Oo=Uo?to:Oo,Oo===to?tx(Io)?lx(Io):V_(Io):Io.match(Oo)||[]}var x_=xp(function(Io,Oo){try{return nm(Io,to,Oo)}catch(Uo){return J1(Uo)?Uo:new hp(Uo)}}),B3=Ym(function(Io,Oo){return Sm(Oo,function(Uo){Uo=zm(Uo),Zm(Io,Uo,G1(Io[Uo],Io))}),Io});function D3(Io){var Oo=Io==null?0:Io.length,Uo=ap();return Io=Oo?Vp(Io,function(yl){if(typeof yl[1]!="function")throw new km(oo);return[Uo(yl[0]),yl[1]]}):[],xp(function(yl){for(var Rl=-1;++Rl$o)return[];var Uo=So,yl=am(Io,So);Oo=ap(Oo),Io-=So;for(var Rl=c1(yl,Oo);++Uo0||Oo<0)?new Sp(Uo):(Io<0?Uo=Uo.takeRight(-Io):Io&&(Uo=Uo.drop(Io)),Oo!==to&&(Oo=vp(Oo),Uo=Oo<0?Uo.dropRight(-Oo):Uo.take(Oo-Io)),Uo)},Sp.prototype.takeRightWhile=function(Io){return this.reverse().takeWhile(Io).reverse()},Sp.prototype.toArray=function(){return this.take(So)},Wm(Sp.prototype,function(Io,Oo){var Uo=/^(?:filter|find|map|reject)|While$/.test(Oo),yl=/^(?:head|last)$/.test(Oo),Rl=Dl[yl?"take"+(Oo=="last"?"Right":""):Oo],Hl=yl||/^find/.test(Oo);Rl&&(Dl.prototype[Oo]=function(){var iu=this.__wrapped__,du=yl?[1]:arguments,bu=iu instanceof Sp,Pu=du[0],Ou=bu||gp(iu),Fu=function($p){var Cp=Rl.apply(Dl,o0([$p],du));return yl&&_d?Cp[0]:Cp};Ou&&Uo&&typeof Pu=="function"&&Pu.length!=1&&(bu=Ou=!1);var _d=this.__chain__,tp=!!this.__actions__.length,sp=Hl&&!_d,_p=bu&&!tp;if(!Hl&&Ou){iu=_p?iu:new Sp(this);var cp=Io.apply(iu,du);return cp.__actions__.push({func:zy,args:[Fu],thisArg:to}),new Cm(cp,_d)}return sp&&_p?Io.apply(this,du):(cp=this.thru(Fu),sp?yl?cp.value()[0]:cp.value():cp)})}),Sm(["pop","push","shift","sort","splice","unshift"],function(Io){var Oo=gy[Io],Uo=/^(?:push|sort|unshift)$/.test(Io)?"tap":"thru",yl=/^(?:pop|shift)$/.test(Io);Dl.prototype[Io]=function(){var Rl=arguments;if(yl&&!this.__chain__){var Hl=this.value();return Oo.apply(gp(Hl)?Hl:[],Rl)}return this[Uo](function(iu){return Oo.apply(gp(iu)?iu:[],Rl)})}}),Wm(Sp.prototype,function(Io,Oo){var Uo=Dl[Oo];if(Uo){var yl=Uo.name+"";Np.call(U0,yl)||(U0[yl]=[]),U0[yl].push({name:Oo,func:Uo})}}),U0[By(to,Eo).name]=[{name:"wrapper",func:to}],Sp.prototype.clone=Px,Sp.prototype.reverse=Ox,Sp.prototype.value=Nx,Dl.prototype.at=l$,Dl.prototype.chain=u$,Dl.prototype.commit=d$,Dl.prototype.next=f$,Dl.prototype.plant=p$,Dl.prototype.reverse=m$,Dl.prototype.toJSON=Dl.prototype.valueOf=Dl.prototype.value=g$,Dl.prototype.first=Dl.prototype.head,Q0&&(Dl.prototype[Q0]=h$),Dl},B0=ux();Jp?((Jp.exports=B0)._=B0,jp._=B0):kp._=B0}).call(ge$2)})(Ui$1,Ui$1.exports);var Gg=Object.defineProperty,zg=Object.defineProperties,Kg=Object.getOwnPropertyDescriptors,Ea=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,ya=(Xr,eo,to)=>eo in Xr?Gg(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,cr$2=(Xr,eo)=>{for(var to in eo||(eo={}))Yg.call(eo,to)&&ya(Xr,to,eo[to]);if(Ea)for(var to of Ea(eo))Zg.call(eo,to)&&ya(Xr,to,eo[to]);return Xr},Jg=(Xr,eo)=>zg(Xr,Kg(eo));function ft$2(Xr,eo,to){var ro;const no=ve$2(Xr);return((ro=eo.rpcMap)==null?void 0:ro[no.reference])||`${Bg}?chainId=${no.namespace}:${no.reference}&projectId=${to}`}function Ct$2(Xr){return Xr.includes(":")?Xr.split(":")[1]:Xr}function Sa(Xr){return Xr.map(eo=>`${eo.split(":")[0]}:${eo.split(":")[1]}`)}function Xg(Xr,eo){const to=Object.keys(eo.namespaces).filter(no=>no.includes(Xr));if(!to.length)return[];const ro=[];return to.forEach(no=>{const io=eo.namespaces[no].accounts;ro.push(...io)}),ro}function Oa(Xr={},eo={}){const to=Ra(Xr),ro=Ra(eo);return Ui$1.exports.merge(to,ro)}function Ra(Xr){var eo,to,ro,no;const io={};if(!B$5(Xr))return io;for(const[oo,ao]of Object.entries(Xr)){const so=oe$3(oo)?[oo]:ao.chains,co=ao.methods||[],lo=ao.events||[],fo=ao.rpcMap||{},ho=en$1(oo);io[ho]=Jg(cr$2(cr$2({},io[ho]),ao),{chains:S$7(so,(eo=io[ho])==null?void 0:eo.chains),methods:S$7(co,(to=io[ho])==null?void 0:to.methods),events:S$7(lo,(ro=io[ho])==null?void 0:ro.events),rpcMap:cr$2(cr$2({},fo),(no=io[ho])==null?void 0:no.rpcMap)})}return io}function Qg(Xr){return Xr.includes(":")?Xr.split(":")[2]:Xr}function Vg(Xr){const eo={};for(const[to,ro]of Object.entries(Xr)){const no=ro.methods||[],io=ro.events||[],oo=ro.accounts||[],ao=oe$3(to)?[to]:ro.chains?ro.chains:Sa(ro.accounts);eo[to]={chains:ao,methods:no,events:io,accounts:oo}}return eo}function Wi$1(Xr){return typeof Xr=="number"?Xr:Xr.includes("0x")?parseInt(Xr,16):(Xr=Xr.includes(":")?Xr.split(":")[1]:Xr,isNaN(Number(Xr))?Xr:Number(Xr))}const ba$1={},z$5=Xr=>ba$1[Xr],Fi$1=(Xr,eo)=>{ba$1[Xr]=eo};class kg{constructor(eo){this.name="polkadot",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getAccounts(){const eo=this.namespace.accounts;return eo?eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2])||[]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class jg{constructor(eo){this.name="eip155",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(eo){switch(eo.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(eo);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(eo.request.method)?await this.client.request(eo):this.getHttpProvider().request(eo.request)}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(parseInt(eo),to),this.chainId=parseInt(eo),this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}createHttpProvider(eo,to){const ro=to||ft$2(`${this.name}:${eo}`,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=parseInt(Ct$2(to));eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}getHttpProvider(){const eo=this.chainId,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}async handleSwitchChain(eo){var to,ro;let no=eo.request.params?(to=eo.request.params[0])==null?void 0:to.chainId:"0x0";no=no.startsWith("0x")?no:`0x${no}`;const io=parseInt(no,16);if(this.isChainApproved(io))this.setDefaultChain(`${io}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:eo.topic,request:{method:eo.request.method,params:[{chainId:no}]},chainId:(ro=this.namespace.chains)==null?void 0:ro[0]}),this.setDefaultChain(`${io}`);else throw new Error(`Failed to switch to chain 'eip155:${io}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(eo){return this.namespace.chains.includes(`${this.name}:${eo}`)}}class nv{constructor(eo){this.name="solana",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class tv{constructor(eo){this.name="cosmos",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class ev{constructor(eo){this.name="cip34",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{const ro=this.getCardanoRPCUrl(to),no=Ct$2(to);eo[no]=this.createHttpProvider(no,ro)}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}getCardanoRPCUrl(eo){const to=this.namespace.rpcMap;if(to)return to[eo]}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||this.getCardanoRPCUrl(eo);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class rv{constructor(eo){this.name="elrond",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class iv{constructor(eo){this.name="multiversx",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class sv{constructor(eo){this.name="near",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){if(this.chainId=eo,!this.httpProviders[eo]){const ro=to||ft$2(`${this.name}:${eo}`,this.namespace);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);this.setHttpProvider(eo,ro)}this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2])||[]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;eo[to]=this.createHttpProvider(to,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace);return typeof ro>"u"?void 0:new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,La=(Xr,eo,to)=>eo in Xr?uv(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,hr$1=(Xr,eo)=>{for(var to in eo||(eo={}))fv.call(eo,to)&&La(Xr,to,eo[to]);if(Ta)for(var to of Ta(eo))cv.call(eo,to)&&La(Xr,to,eo[to]);return Xr},Mi$1=(Xr,eo)=>av(Xr,ov(eo));let lr$2=class I_{constructor(eo){this.events=new EventEmitter$1,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=eo,this.logger=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||Ia})),this.disableProviderPing=(eo==null?void 0:eo.disableProviderPing)||!1}static async init(eo){const to=new I_(eo);return await to.initialize(),to}async request(eo,to,ro){const[no,io]=this.validateChain(to);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(no).request({request:hr$1({},eo),chainId:`${no}:${io}`,topic:this.session.topic,expiry:ro})}sendAsync(eo,to,ro,no){const io=new Date().getTime();this.request(eo,ro,no).then(oo=>to(null,formatJsonRpcResult(io,oo))).catch(oo=>to(oo,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var eo;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(eo=this.session)==null?void 0:eo.topic,reason:U$6("USER_DISCONNECTED")}),await this.cleanup()}async connect(eo){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(eo),await this.cleanupPendingPairings(),!eo.skipPairing)return await this.pair(eo.pairingTopic)}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}off(eo,to){this.events.off(eo,to)}get isWalletConnect(){return!0}async pair(eo){this.shouldAbortPairingAttempt=!1;let to=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(to>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:ro,approval:no}=await this.client.connect({pairingTopic:eo,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});ro&&(this.uri=ro,this.events.emit("display_uri",ro)),await no().then(io=>{this.session=io;const oo=Vg(io.namespaces);this.namespaces=Oa(this.namespaces,oo),this.persist("namespaces",this.namespaces)}).catch(io=>{if(io.message!==ae$2)throw io;to++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(eo,to){try{if(!this.session)return;const[ro,no]=this.validateChain(eo);this.getProvider(ro).setDefaultChain(no,to)}catch(ro){if(!/Please call connect/.test(ro.message))throw ro}}async cleanupPendingPairings(eo={}){this.logger.info("Cleaning up inactive pairings...");const to=this.client.pairing.getAll();if(k$4(to)){for(const ro of to)eo.deletePairings?this.client.core.expirer.set(ro.topic,0):await this.client.core.relayer.subscriber.unsubscribe(ro.topic);this.logger.info(`Inactive pairings cleared: ${to.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const eo=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[eo]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Q$4.init({logger:this.providerOpts.logger||Ia,relayUrl:this.providerOpts.relayUrl||Fg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const eo=[...new Set(Object.keys(this.session.namespaces).map(to=>en$1(to)))];Fi$1("client",this.client),Fi$1("events",this.events),Fi$1("disableProviderPing",this.disableProviderPing),eo.forEach(to=>{if(!this.session)return;const ro=Xg(to,this.session),no=Sa(ro),io=Oa(this.namespaces,this.optionalNamespaces),oo=Mi$1(hr$1({},io[to]),{accounts:ro,chains:no});switch(to){case"eip155":this.rpcProviders[to]=new jg({namespace:oo});break;case"solana":this.rpcProviders[to]=new nv({namespace:oo});break;case"cosmos":this.rpcProviders[to]=new tv({namespace:oo});break;case"polkadot":this.rpcProviders[to]=new kg({namespace:oo});break;case"cip34":this.rpcProviders[to]=new ev({namespace:oo});break;case"elrond":this.rpcProviders[to]=new rv({namespace:oo});break;case"multiversx":this.rpcProviders[to]=new iv({namespace:oo});break;case"near":this.rpcProviders[to]=new sv({namespace:oo});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",eo=>{this.events.emit("session_ping",eo)}),this.client.on("session_event",eo=>{const{params:to}=eo,{event:ro}=to;if(ro.name==="accountsChanged"){const no=ro.data;no&&k$4(no)&&this.events.emit("accountsChanged",no.map(Qg))}else if(ro.name==="chainChanged"){const no=to.chainId,io=to.event.data,oo=en$1(no),ao=Wi$1(no)!==Wi$1(io)?`${oo}:${Wi$1(io)}`:no;this.onChainChanged(ao)}else this.events.emit(ro.name,ro.data);this.events.emit("session_event",eo)}),this.client.on("session_update",({topic:eo,params:to})=>{var ro;const{namespaces:no}=to,io=(ro=this.client)==null?void 0:ro.session.get(eo);this.session=Mi$1(hr$1({},io),{namespaces:no}),this.onSessionUpdate(),this.events.emit("session_update",{topic:eo,params:to})}),this.client.on("session_delete",async eo=>{await this.cleanup(),this.events.emit("session_delete",eo),this.events.emit("disconnect",Mi$1(hr$1({},U$6("USER_DISCONNECTED")),{data:eo.topic}))}),this.on(Vn$1.DEFAULT_CHAIN_CHANGED,eo=>{this.onChainChanged(eo,!0)})}getProvider(eo){if(!this.rpcProviders[eo])throw new Error(`Provider not found: ${eo}`);return this.rpcProviders[eo]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(eo=>{var to;this.getProvider(eo).updateNamespace((to=this.session)==null?void 0:to.namespaces[eo])})}setNamespaces(eo){const{namespaces:to,optionalNamespaces:ro,sessionProperties:no}=eo;to&&Object.keys(to).length&&(this.namespaces=to),ro&&Object.keys(ro).length&&(this.optionalNamespaces=ro),this.sessionProperties=no,this.persist("namespaces",to),this.persist("optionalNamespaces",ro)}validateChain(eo){const[to,ro]=(eo==null?void 0:eo.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[to,ro];if(to&&!Object.keys(this.namespaces||{}).map(oo=>en$1(oo)).includes(to))throw new Error(`Namespace '${to}' is not configured. Please call connect() first with namespace config.`);if(to&&ro)return[to,ro];const no=en$1(Object.keys(this.namespaces)[0]),io=this.rpcProviders[no].getDefaultChain();return[no,io]}async requestAccounts(){const[eo]=this.validateChain();return await this.getProvider(eo).requestAccounts()}onChainChanged(eo,to=!1){if(!this.namespaces)return;const[ro,no]=this.validateChain(eo);no&&(to||this.getProvider(ro).setDefaultChain(no),this.namespaces[ro]?this.namespaces[ro].defaultChain=no:this.namespaces[`${ro}:${no}`]?this.namespaces[`${ro}:${no}`].defaultChain=no:this.namespaces[`${ro}:${no}`]={defaultChain:no},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",no))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(eo,to){this.client.core.storage.setItem(`${xa}/${eo}`,to)}async getFromStore(eo){return await this.client.core.storage.getItem(`${xa}/${eo}`)}};const hv=lr$2,P$4="wc",S$4="ethereum_provider",$$3=`${P$4}@2:${S$4}:`,j$6="https://rpc.walletconnect.com/v1/",u$4=["eth_sendTransaction","personal_sign"],E$3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],m$3=["chainChanged","accountsChanged"],_$6=["chainChanged","accountsChanged","message","disconnect","connect"];var N$5=Object.defineProperty,q$5=Object.defineProperties,D$3=Object.getOwnPropertyDescriptors,y$7=Object.getOwnPropertySymbols,U$4=Object.prototype.hasOwnProperty,Q$3=Object.prototype.propertyIsEnumerable,O$6=(Xr,eo,to)=>eo in Xr?N$5(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,p$3=(Xr,eo)=>{for(var to in eo||(eo={}))U$4.call(eo,to)&&O$6(Xr,to,eo[to]);if(y$7)for(var to of y$7(eo))Q$3.call(eo,to)&&O$6(Xr,to,eo[to]);return Xr},M$3=(Xr,eo)=>q$5(Xr,D$3(eo));function g$5(Xr){return Number(Xr[0].split(":")[1])}function f$6(Xr){return`0x${Xr.toString(16)}`}function L$5(Xr){const{chains:eo,optionalChains:to,methods:ro,optionalMethods:no,events:io,optionalEvents:oo,rpcMap:ao}=Xr;if(!k$4(eo))throw new Error("Invalid chains");const so={chains:eo,methods:ro||u$4,events:io||m$3,rpcMap:p$3({},eo.length?{[g$5(eo)]:ao[g$5(eo)]}:{})},co=io==null?void 0:io.filter(go=>!m$3.includes(go)),lo=ro==null?void 0:ro.filter(go=>!u$4.includes(go));if(!to&&!oo&&!no&&!(co!=null&&co.length)&&!(lo!=null&&lo.length))return{required:eo.length?so:void 0};const fo=(co==null?void 0:co.length)&&(lo==null?void 0:lo.length)||!to,ho={chains:[...new Set(fo?so.chains.concat(to||[]):to)],methods:[...new Set(so.methods.concat(no!=null&&no.length?no:E$3))],events:[...new Set(so.events.concat(oo!=null&&oo.length?oo:_$6))],rpcMap:ao};return{required:eo.length?so:void 0,optional:to.length?ho:void 0}}let v$3=class R_{constructor(){this.events=new eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$$3,this.on=(eo,to)=>(this.events.on(eo,to),this),this.once=(eo,to)=>(this.events.once(eo,to),this),this.removeListener=(eo,to)=>(this.events.removeListener(eo,to),this),this.off=(eo,to)=>(this.events.off(eo,to),this),this.parseAccount=eo=>this.isCompatibleChainId(eo)?this.parseAccountId(eo).address:eo,this.signer={},this.rpc={}}static async init(eo){const to=new R_;return await to.initialize(eo),to}async request(eo,to){return await this.signer.request(eo,this.formatChainId(this.chainId),to)}sendAsync(eo,to,ro){this.signer.sendAsync(eo,to,this.formatChainId(this.chainId),ro)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(eo){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(eo);const{required:to,optional:ro}=L$5(this.rpc);try{const no=await new Promise(async(oo,ao)=>{var so;this.rpc.showQrModal&&((so=this.modal)==null||so.subscribeModal(co=>{!co.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),ao(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(M$3(p$3({namespaces:p$3({},to&&{[this.namespace]:to})},ro&&{optionalNamespaces:{[this.namespace]:ro}}),{pairingTopic:eo==null?void 0:eo.pairingTopic})).then(co=>{oo(co)}).catch(co=>{ao(new Error(co.message))})});if(!no)return;const io=Un$1(no.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:io),this.setAccounts(io),this.events.emit("connect",{chainId:f$6(this.chainId)})}catch(no){throw this.signer.logger.error(no),no}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",eo=>{const{params:to}=eo,{event:ro}=to;ro.name==="accountsChanged"?(this.accounts=this.parseAccounts(ro.data),this.events.emit("accountsChanged",this.accounts)):ro.name==="chainChanged"?this.setChainId(this.formatChainId(ro.data)):this.events.emit(ro.name,ro.data),this.events.emit("session_event",eo)}),this.signer.on("chainChanged",eo=>{const to=parseInt(eo);this.chainId=to,this.events.emit("chainChanged",f$6(this.chainId)),this.persist()}),this.signer.on("session_update",eo=>{this.events.emit("session_update",eo)}),this.signer.on("session_delete",eo=>{this.reset(),this.events.emit("session_delete",eo),this.events.emit("disconnect",M$3(p$3({},U$6("USER_DISCONNECTED")),{data:eo.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",eo=>{var to,ro;this.rpc.showQrModal&&((to=this.modal)==null||to.closeModal(),(ro=this.modal)==null||ro.openModal({uri:eo})),this.events.emit("display_uri",eo)})}switchEthereumChain(eo){this.request({method:"wallet_switchEthereumChain",params:[{chainId:eo.toString(16)}]})}isCompatibleChainId(eo){return typeof eo=="string"?eo.startsWith(`${this.namespace}:`):!1}formatChainId(eo){return`${this.namespace}:${eo}`}parseChainId(eo){return Number(eo.split(":")[1])}setChainIds(eo){const to=eo.filter(ro=>this.isCompatibleChainId(ro)).map(ro=>this.parseChainId(ro));to.length&&(this.chainId=to[0],this.events.emit("chainChanged",f$6(this.chainId)),this.persist())}setChainId(eo){if(this.isCompatibleChainId(eo)){const to=this.parseChainId(eo);this.chainId=to,this.switchEthereumChain(to)}}parseAccountId(eo){const[to,ro,no]=eo.split(":");return{chainId:`${to}:${ro}`,address:no}}setAccounts(eo){this.accounts=eo.filter(to=>this.parseChainId(this.parseAccountId(to).chainId)===this.chainId).map(to=>this.parseAccountId(to).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(eo){var to,ro;const no=(to=eo==null?void 0:eo.chains)!=null?to:[],io=(ro=eo==null?void 0:eo.optionalChains)!=null?ro:[],oo=no.concat(io);if(!oo.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const ao=no.length?(eo==null?void 0:eo.methods)||u$4:[],so=no.length?(eo==null?void 0:eo.events)||m$3:[],co=(eo==null?void 0:eo.optionalMethods)||[],lo=(eo==null?void 0:eo.optionalEvents)||[],fo=(eo==null?void 0:eo.rpcMap)||this.buildRpcMap(oo,eo.projectId),ho=(eo==null?void 0:eo.qrModalOptions)||void 0;return{chains:no==null?void 0:no.map(go=>this.formatChainId(go)),optionalChains:io.map(go=>this.formatChainId(go)),methods:ao,events:so,optionalMethods:co,optionalEvents:lo,rpcMap:fo,showQrModal:!!(eo!=null&&eo.showQrModal),qrModalOptions:ho,projectId:eo.projectId,metadata:eo.metadata}}buildRpcMap(eo,to){const ro={};return eo.forEach(no=>{ro[no]=this.getRpcUrl(no,to)}),ro}async initialize(eo){if(this.rpc=this.getRpcConfig(eo),this.chainId=this.rpc.chains.length?g$5(this.rpc.chains):g$5(this.rpc.optionalChains),this.signer=await hv.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:eo.disableProviderPing,relayUrl:eo.relayUrl,storageOptions:eo.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let to;try{const{WalletConnectModal:ro}=await __vitePreload(()=>import("./index-B0ywuJCf.js").then(no=>no.i),[]);to=ro}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(to)try{this.modal=new to(p$3({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(ro){throw this.signer.logger.error(ro),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(eo){if(!eo)return;const{chains:to,optionalChains:ro,rpcMap:no}=eo;to&&k$4(to)&&(this.rpc.chains=to.map(io=>this.formatChainId(io)),to.forEach(io=>{this.rpc.rpcMap[io]=(no==null?void 0:no[io])||this.getRpcUrl(io)})),ro&&k$4(ro)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=ro==null?void 0:ro.map(io=>this.formatChainId(io)),ro.forEach(io=>{this.rpc.rpcMap[io]=(no==null?void 0:no[io])||this.getRpcUrl(io)}))}getRpcUrl(eo,to){var ro;return((ro=this.rpc.rpcMap)==null?void 0:ro[eo])||`${j$6}?chainId=eip155:${eo}&projectId=${to||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const eo=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),to=this.session.namespaces[`${this.namespace}:${eo}`]?this.session.namespaces[`${this.namespace}:${eo}`]:this.session.namespaces[this.namespace];this.setChainIds(eo?[this.formatChainId(eo)]:to==null?void 0:to.accounts),this.setAccounts(to==null?void 0:to.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(eo){return typeof eo=="string"||eo instanceof String?[this.parseAccount(eo)]:eo.map(to=>this.parseAccount(to))}};const parseIntSafe=(Xr,eo=10)=>{try{const to=parseInt(String(Xr),eo);if(isNaN(to)){logger$9.error(`Error parsing ${Xr}`);return}return to}catch(to){logger$9.error(`Error parsing ${Xr} to int: ${to}`)}},activeAccountKey=Xr=>`dynamic-wc2-active-account-${Xr}`,sessionTopicKey=Xr=>`dynamic-wc2-session-topic-${Xr}`,swicthedNetworkKey=Xr=>`dynamic-wc2-switched-network-${Xr}`,currentChainKey=Xr=>`dynamic-wc2-current-chain-${Xr}`,ee$2=new EventEmitter$3;class WalletConnect extends EthWalletConnector{constructor(eo){var to;super(eo),this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.isInitialized=!1,this.canConnectViaQrCode=!0,this.isWalletConnect=!0,this.preferredChains=[],this._hasSwitchedNetwork=!1,this.sessionEventHandler=()=>{},this.sessionDeleteHandler=()=>{},this.name=eo.walletName,this.projectId=eo.projectId,this.deepLinkPreference=eo.deepLinkPreference||"native",this.preferredChains=eo.walletConnectPreferredChains||[],this.hasSwitchedNetwork=(to=!!localStorage.getItem(this.swicthedNetworkKey))!==null&&to!==void 0?to:!1;const ro=localStorage.getItem(this.currentChainKey);this.currentChainId=ro?parseIntSafe(ro):void 0}getMappedChains(){return this.evmNetworks.filter(eo=>eo.chainId!==11297108109).map(eo=>`eip155:${eo.chainId}`)}getMappedChainsByPreferredOrder(){const eo=this.getMappedChains(),to=this.preferredChains.filter(no=>eo.includes(no)),ro=eo.filter(no=>!this.preferredChains.includes(no));return[...to,...ro].map(no=>Number(no.split(":")[1]))}initConnection(){return __awaiter$a(this,void 0,void 0,function*(){const{provider:eo}=WalletConnect;if(!eo)throw new DynamicError("No provider found (init connection)");eo!=null&&eo.signer.uri||eo.connect().catch(to=>{logger$9.error(to),ee$2.emit("walletconnect_connection_failed",to)})})}createProvider(){return __awaiter$a(this,void 0,void 0,function*(){return v$3.init({events:["chainChanged","accountsChanged"],methods:[],optionalChains:this.getMappedChainsByPreferredOrder(),optionalMethods:["eth_chainId","eth_signTypedData","eth_signTransaction","eth_sign","personal_sign","eth_sendTransaction","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],projectId:this.projectId,rpcMap:this.evmNetworkRpcMap(),showQrModal:!1})})}getWalletClientFromInitializedProvider(){return __awaiter$a(this,void 0,void 0,function*(){const eo=this.createProvider();return createWalletClient({account:this.getActiveAccount(),transport:custom$1(yield eo)})})}createInitProviderPromise(){return __awaiter$a(this,void 0,void 0,function*(){WalletConnect.provider=yield this.createProvider(),this.teardownEventListeners(),this.setupEventListeners()})}initProvider(){return __awaiter$a(this,void 0,void 0,function*(){const{provider:eo}=WalletConnect;eo||(this.initializePromise===void 0&&(this.initializePromise=this.createInitProviderPromise()),yield this.initializePromise)})}refreshSession(){var eo,to,ro,no,io;!((to=(eo=WalletConnect.provider)===null||eo===void 0?void 0:eo.session)===null||to===void 0)&&to.topic&&localStorage.getItem(this.sessionTopicKey)===((no=(ro=WalletConnect.provider)===null||ro===void 0?void 0:ro.session)===null||no===void 0?void 0:no.topic)&&(this.session=WalletConnect.provider.session,this.setActiveAccount((io=localStorage.getItem(this.activeAccountKey))!==null&&io!==void 0?io:void 0))}init(){return __awaiter$a(this,void 0,void 0,function*(){yield this.initProvider(),yield this.initConnection(),this.isInitialized=!0})}get sessionTopicKey(){return sessionTopicKey(this.key)}get activeAccountKey(){return activeAccountKey(this.key)}get swicthedNetworkKey(){return swicthedNetworkKey(this.key)}get currentChainKey(){return currentChainKey(this.key)}set currentChainId(eo){this._currentChainId=eo,eo?localStorage.setItem(this.currentChainKey,eo.toString()):localStorage.removeItem(this.currentChainKey)}get currentChainId(){return this._currentChainId}set hasSwitchedNetwork(eo){this._hasSwitchedNetwork=eo,eo?localStorage.setItem(this.swicthedNetworkKey,eo.toString()):localStorage.removeItem(this.swicthedNetworkKey)}get hasSwitchedNetwork(){return this._hasSwitchedNetwork}supportsNetworkSwitching(){return!0}setupEventListeners(){WalletConnect.provider&&(this.sessionEventHandler=({params:eo})=>{if(logger$9.debug("session_event was called",{params:eo}),!eo||!eo.event){logger$9.debug("session_event was called without params or params.event");return}const{name:to,data:ro}=eo.event;if(to==="chainChanged"){const no=parseIntSafe(ro);if(no===this.currentChainId){logger$9.debug(`ignoring chainChanged event with same chain id as current chain id: ${no}`);return}if(no===void 0){logger$9.debug(`received unexpected data for chainChanged: ${ro} with type ${typeof ro}}`);return}this.currentChainId=no,this.emit("chainChange",{chain:String(no)}),this.hasSwitchedNetwork=!0,this.switchNetwork({networkChainId:no})}else if(to==="accountsChanged"){if(!Array.isArray(ro)){logger$9.debug(`received unexpected data for accountsChanged: ${ro} with type ${typeof ro}}`);return}const no=ro[0].split(":")[2];this.setWCActiveAccount(no)}},WalletConnect.provider.on("session_event",this.sessionEventHandler),this.sessionDeleteHandler=()=>__awaiter$a(this,void 0,void 0,function*(){this.endSession(),this.emit("disconnect")}),WalletConnect.provider.on("session_delete",this.sessionDeleteHandler))}teardownEventListeners(){WalletConnect.provider&&(WalletConnect.provider.off("session_event",this.sessionEventHandler),WalletConnect.provider.off("session_delete",this.sessionDeleteHandler))}getWalletClient(eo){if(WalletConnect.provider)return createWalletClient({account:this.getActiveAccount(),chain:chainsMap[eo??String(this.currentChainId)],transport:custom$1(WalletConnect.provider)})}getAddress(eo){return __awaiter$a(this,void 0,void 0,function*(){var to,ro;const no=this.getActiveAccount();if(no!=null&&no.address)return no.address;if((!WalletConnect.provider||!(!((to=WalletConnect.provider)===null||to===void 0)&&to.signer.uri))&&(logger$9.debug("No WC2 provider found, re-initializing..."),yield this.endSession(),yield this.init(),yield sleep$1(1e3),!WalletConnect.provider||!(!((ro=WalletConnect.provider)===null||ro===void 0)&&ro.signer.uri)))throw logger$9.debug("No WC2 provider found, escaping and throwing error"),new DynamicError("No provider found");const io=getWalletBookWallet(this.walletBook,this.key,this.walletFallback);return performPlatformSpecificConnectionMethod(WalletConnect.provider.signer.uri,io,{onDesktopUri:eo==null?void 0:eo.onDesktopUri,onDisplayUri:eo==null?void 0:eo.onDisplayUri},this.deepLinkPreference),new Promise((oo,ao)=>{if(!WalletConnect.provider){ao(new DynamicError("No provider found"));return}const so=()=>{const fo=new DynamicError("Connection rejected. Please try again.");fo.code="connection_rejected",WalletConnect.provider&&(WalletConnect.provider.signer.uri=void 0,this.init()),ao(fo),lo()},co=()=>{var fo;const ho=(fo=WalletConnect.provider)===null||fo===void 0?void 0:fo.session;if(!ho){ao(new DynamicError("No session found"));return}this.setSession(ho),this.setWCActiveAccount(ho.namespaces.eip155.accounts[0].split(":")[2]),this.getNetwork().then(go=>{var yo;this.currentChainId=go,oo((yo=this.getActiveAccount())===null||yo===void 0?void 0:yo.address)}),lo()},lo=()=>{var fo;ee$2.off("walletconnect_connection_failed",so),(fo=WalletConnect.provider)===null||fo===void 0||fo.off("connect",co)};ee$2.on("walletconnect_connection_failed",so),WalletConnect.provider.on("connect",co)})})}waitForSignMessage(eo,to){return __awaiter$a(this,void 0,void 0,function*(){const no=yield new Promise((io,oo)=>{this.on("chainChange",()=>io({success:!1})),eo(to).then(ao=>io({signedMessage:ao,success:!0})).catch(oo)});return no.success===!1?eo(to):no.signedMessage})}getDeepLink(){var eo;if(!this.session)return;const to=getWalletBookWallet(this.walletBook,this.key),ro=getDeepLink({metadata:to,mode:"regular",preference:this.deepLinkPreference,uri:(eo=WalletConnect.provider)===null||eo===void 0?void 0:eo.signer.uri});if(ro)return`${ro}?sessionTopic=${this.session.topic}`}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){if(!this.session)throw new DynamicError("no session");const to=this.getDeepLink();isMobile$1()&&to&&(window.location.href=to);const ro=io=>__awaiter$a(this,void 0,void 0,function*(){const oo=this.getActiveAccount();return oo?(yield this.getWalletClientFromInitializedProvider()).signMessage({account:oo,message:io}):void 0});return yield this.waitForSignMessage(ro,eo)})}clearActiveAccount(){localStorage.removeItem(this.activeAccountKey),this.setActiveAccount(void 0)}clearSession(){localStorage.removeItem(this.sessionTopicKey),this.session=void 0}setWCActiveAccount(eo){localStorage.setItem(this.activeAccountKey,eo),this.setActiveAccount(eo),this.emit("accountChange",{accounts:[eo]})}setSession(eo){localStorage.setItem(this.sessionTopicKey,eo.topic),this.session=eo}endSession(){return __awaiter$a(this,void 0,void 0,function*(){var eo;if(this.clearActiveAccount(),this.clearSession(),this.hasSwitchedNetwork=!1,this.currentChainId=void 0,!!(!((eo=WalletConnect.provider)===null||eo===void 0)&&eo.session))try{yield WalletConnect.provider.disconnect(),WalletConnect.provider=void 0}catch(to){logger$9.debug(to)}})}getNetwork(){const eo=Object.create(null,{getNetwork:{get:()=>super.getNetwork}});return __awaiter$a(this,void 0,void 0,function*(){return this.currentChainId?this.currentChainId:(yield this.initProvider(),eo.getNetwork.call(this))})}providerSwitchNetwork(eo){const to=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$a(this,arguments,void 0,function*({network:ro}){const no=yield this.getSupportedNetworks();if(!(no!=null&&no.includes(ro.chainId.toString()))){const ao=new DynamicError("Network switching is not available at this time. The user should manually switch network in their wallet");throw ao.code="network_switching_only_available_in_wallet",ao}const io=yield this.getNetwork();if(io&&io===ro.chainId)return;if(this.switchNetworkOnlyFromWallet)throw new DynamicError("Network switching is only supported through the wallet");if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching not supported");const oo=yield this.getWalletClientFromInitializedProvider();if(this.isMetaMask()){const ao=this.getDeepLink();ao&&(window.location.href=ao)}yield to.providerSwitchNetwork.call(this,{network:ro,provider:oo}),this.currentChainId=ro.chainId,this.hasSwitchedNetwork=!0,this.emit("chainChange",{chain:String(ro.chainId)})})}getConnectedAccounts(){return __awaiter$a(this,void 0,void 0,function*(){this.isInitialized===!1&&(yield this.initProvider(),this.refreshSession(),this.isInitialized=!0);const eo=this.getActiveAccount();return eo!=null&&eo.address?[eo.address]:[]})}isMetaMask(){var eo,to,ro,no,io;return(io=(no=(ro=(to=(eo=this.session)===null||eo===void 0?void 0:eo.peer)===null||to===void 0?void 0:to.metadata)===null||ro===void 0?void 0:ro.name)===null||no===void 0?void 0:no.toLowerCase().startsWith("metamask"))!==null&&io!==void 0?io:!1}getSupportedNetworks(){return __awaiter$a(this,void 0,void 0,function*(){var eo;if(yield this.initProvider(),this.refreshSession(),this.isMetaMask())return this.hasSwitchedNetwork?[String(this.currentChainId)]:this.evmNetworks.map(ro=>ro.chainId.toString());if(!this.session)return[];const to=[];return Object.keys(this.session.namespaces).forEach(ro=>{ro.startsWith("eip155:")&&to.push(ro.split(":")[1])}),(eo=this.session.namespaces.eip155)===null||eo===void 0||eo.accounts.forEach(ro=>to.push(ro.split(":")[1])),to.length?to:this.evmNetworks.map(ro=>ro.chainId.toString())})}}let InjectedWalletBase$1=class extends EthWalletConnector{constructor(){super(...arguments),this.supportedChains=["ETH","EVM"],this.connectedChain="EVM",this.walletConnectorFallback=!1}getEthProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.ethProviderHelper&&(this.ethProviderHelper=new EthProviderHelper(this.wallet,this)),this.ethProviderHelper}getMobileOrInstalledWallet(){var eo,to;return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.isInstalledOnBrowser()?this:!((to=(eo=this.wallet)===null||eo===void 0?void 0:eo.mobile)===null||to===void 0)&&to.inAppBrowser&&this.mobileExperience==="in-app-browser"&&isMobile$1()?this:this.walletConnectorFallback?new WalletConnect(Object.assign(Object.assign({},this.constructorProps),{walletName:this.name})):this}findProvider(){const eo=this.getEthProviderHelper();if(eo)return eo.getInstalledProvider()}setupEventListeners(){if(!this.getWalletClient())return;const to=this.getEthProviderHelper();if(!to)return;const{tearDownEventListeners:ro}=to._setupEventListeners(this);this.teardownEventListeners=ro}getWalletClient(eo){var to;return(to=this.getEthProviderHelper())===null||to===void 0?void 0:to.findWalletClient(eo)}isInstalledOnBrowser(){var eo;return((eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.findProvider())!==void 0}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){var eo;return(eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.getAddress()})}connect(){return __awaiter$a(this,void 0,void 0,function*(){yield this.getAddress()})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){var to;return(to=this.getEthProviderHelper())===null||to===void 0?void 0:to.signMessage(eo)})}proveOwnership(eo,to){return __awaiter$a(this,void 0,void 0,function*(){return yield this.validateActiveWallet(eo),this.signMessage(to)})}endSession(){return __awaiter$a(this,void 0,void 0,function*(){})}providerSwitchNetwork(eo){const to=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$a(this,arguments,void 0,function*({network:ro,provider:no}){return to.providerSwitchNetwork.call(this,{network:ro,provider:no})})}};class PhantomEvm extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantomevm",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$a(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var eo,to;return!!(!((to=(eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.findProvider())===null||to===void 0)&&to.selectedAddress)}}class ExodusEvm extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="ExodusEvm",this.overrideKey="exodusevm",this.walletConnectorFallback=!0,this.wallet=findWalletBookWallet(this.walletBook,this.key)}}let UnknownInjected$1=class extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}};class FallbackEvmConnector extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const injectedWalletOverrides$1=[PhantomEvm,ExodusEvm],filteredInjectedWalletKeysOverrides$1=["phantomevm","coinbase","exodusevm"],fetchInjectedWalletConnector=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;return((no=ro.injectedConfig)===null||no===void 0?void 0:no.find(io=>io.chain==="evm"))&&!filteredInjectedWalletKeysOverrides$1.includes(to)}).map(([to,ro])=>{const{shortName:no}=ro,io=no||ro.name,oo=!!ro.walletConnect;return class extends InjectedWalletBase$1{constructor(ao){super(Object.assign({},ao)),this.name=io,this.wallet=ro,this.walletConnectorFallback=oo,this.overrideKey=to}getAddress(){const ao=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$a(this,void 0,void 0,function*(){var so;if(this.isInstalledOnBrowser())return ao.getAddress.call(this);const co=(so=this.wallet.mobile)===null||so===void 0?void 0:so.inAppBrowser;if(!co){const lo=new Error(`No inAppBrowserBase found for ${this.name}.`);throw logger$9.error(lo.message),lo}window.location.href=`${co}/${window.location.href}`})}}})},fetchWalletConnectWallets=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([,to])=>to.walletConnect&&!to.filterFromWalletConnect).map(([to,ro])=>{const{shortName:no}=ro,io=no||ro.name;return class extends WalletConnect{constructor(oo){super(Object.assign(Object.assign({},oo),{walletName:io})),this.overrideKey=to}}})},getWalletConnectConnector=()=>class extends WalletConnect{constructor(Xr){super(Object.assign(Object.assign({},Xr),{walletName:"WalletConnect"}))}};var dist={},CoinbaseWalletSDK$1={},walletLogo$1={};Object.defineProperty(walletLogo$1,"__esModule",{value:!0});walletLogo$1.walletLogo=void 0;const walletLogo=(Xr,eo)=>{let to;switch(Xr){case"standard":return to=eo,`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return to=eo,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${eo}' height='${to}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return to=(.1*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return to=(.25*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return to=(.1*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return to=(.25*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return to=eo,`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};walletLogo$1.walletLogo=walletLogo;var CoinbaseWalletProvider$1={};const require$$0$2=getAugmentedNamespace(eventemitter3$1);var error$2={},constants$5={};Object.defineProperty(constants$5,"__esModule",{value:!0});constants$5.errorValues=constants$5.standardErrorCodes=void 0;constants$5.standardErrorCodes={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,unsupportedChain:4902}};constants$5.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var errors$1={},utils$2={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.serialize=Xr.getErrorCode=Xr.isValidCode=Xr.getMessageFromCode=Xr.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const eo=constants$5,to="Unspecified error message.";Xr.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function ro(ho,go=to){if(ho&&Number.isInteger(ho)){const yo=ho.toString();if(lo(eo.errorValues,yo))return eo.errorValues[yo].message;if(so(ho))return Xr.JSON_RPC_SERVER_ERROR_MESSAGE}return go}Xr.getMessageFromCode=ro;function no(ho){if(!Number.isInteger(ho))return!1;const go=ho.toString();return!!(eo.errorValues[go]||so(ho))}Xr.isValidCode=no;function io(ho){var go;if(typeof ho=="number")return ho;if(oo(ho))return(go=ho.code)!==null&&go!==void 0?go:ho.errorCode}Xr.getErrorCode=io;function oo(ho){return typeof ho=="object"&&ho!==null&&(typeof ho.code=="number"||typeof ho.errorCode=="number")}function ao(ho,{shouldIncludeStack:go=!1}={}){const yo={};if(ho&&typeof ho=="object"&&!Array.isArray(ho)&&lo(ho,"code")&&no(ho.code)){const vo=ho;yo.code=vo.code,vo.message&&typeof vo.message=="string"?(yo.message=vo.message,lo(vo,"data")&&(yo.data=vo.data)):(yo.message=ro(yo.code),yo.data={originalError:co(ho)})}else yo.code=eo.standardErrorCodes.rpc.internal,yo.message=fo(ho,"message")?ho.message:to,yo.data={originalError:co(ho)};return go&&(yo.stack=fo(ho,"stack")?ho.stack:void 0),yo}Xr.serialize=ao;function so(ho){return ho>=-32099&&ho<=-32e3}function co(ho){return ho&&typeof ho=="object"&&!Array.isArray(ho)?Object.assign({},ho):ho}function lo(ho,go){return Object.prototype.hasOwnProperty.call(ho,go)}function fo(ho,go){return typeof ho=="object"&&ho!==null&&go in ho&&typeof ho[go]=="string"}})(utils$2);Object.defineProperty(errors$1,"__esModule",{value:!0});errors$1.standardErrors=void 0;const constants_1$6=constants$5,utils_1$1=utils$2;errors$1.standardErrors={rpc:{parse:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.parse,Xr),invalidRequest:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidRequest,Xr),invalidParams:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidParams,Xr),methodNotFound:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotFound,Xr),internal:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.internal,Xr),server:Xr=>{if(!Xr||typeof Xr!="object"||Array.isArray(Xr))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:eo}=Xr;if(!Number.isInteger(eo)||eo>-32005||eo<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return getEthJsonRpcError(eo,Xr)},invalidInput:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidInput,Xr),resourceNotFound:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceNotFound,Xr),resourceUnavailable:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceUnavailable,Xr),transactionRejected:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.transactionRejected,Xr),methodNotSupported:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotSupported,Xr),limitExceeded:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.limitExceeded,Xr)},provider:{userRejectedRequest:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.userRejectedRequest,Xr),unauthorized:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unauthorized,Xr),unsupportedMethod:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedMethod,Xr),disconnected:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.disconnected,Xr),chainDisconnected:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.chainDisconnected,Xr),unsupportedChain:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedChain,Xr),custom:Xr=>{if(!Xr||typeof Xr!="object"||Array.isArray(Xr))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:eo,message:to,data:ro}=Xr;if(!to||typeof to!="string")throw new Error('"message" must be a nonempty string');return new EthereumProviderError(eo,to,ro)}}};function getEthJsonRpcError(Xr,eo){const[to,ro]=parseOpts(eo);return new EthereumRpcError(Xr,to||(0,utils_1$1.getMessageFromCode)(Xr),ro)}function getEthProviderError(Xr,eo){const[to,ro]=parseOpts(eo);return new EthereumProviderError(Xr,to||(0,utils_1$1.getMessageFromCode)(Xr),ro)}function parseOpts(Xr){if(Xr){if(typeof Xr=="string")return[Xr];if(typeof Xr=="object"&&!Array.isArray(Xr)){const{message:eo,data:to}=Xr;if(eo&&typeof eo!="string")throw new Error("Must specify string message.");return[eo||void 0,to]}}return[]}class EthereumRpcError extends Error{constructor(eo,to,ro){if(!Number.isInteger(eo))throw new Error('"code" must be an integer.');if(!to||typeof to!="string")throw new Error('"message" must be a nonempty string.');super(to),this.code=eo,ro!==void 0&&(this.data=ro)}}class EthereumProviderError extends EthereumRpcError{constructor(eo,to,ro){if(!isValidEthProviderCode(eo))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(eo,to,ro)}}function isValidEthProviderCode(Xr){return Number.isInteger(Xr)&&Xr>=1e3&&Xr<=4999}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.standardErrors=Xr.standardErrorCodes=void 0;var eo=constants$5;Object.defineProperty(Xr,"standardErrorCodes",{enumerable:!0,get:function(){return eo.standardErrorCodes}});var to=errors$1;Object.defineProperty(Xr,"standardErrors",{enumerable:!0,get:function(){return to.standardErrors}})})(error$2);var serialize$1={},Web3Response={};Object.defineProperty(Web3Response,"__esModule",{value:!0});Web3Response.isErrorResponse=void 0;function isErrorResponse(Xr){return Xr.errorMessage!==void 0}Web3Response.isErrorResponse=isErrorResponse;var version$b={};Object.defineProperty(version$b,"__esModule",{value:!0});version$b.LIB_VERSION=void 0;version$b.LIB_VERSION="4.0.4";Object.defineProperty(serialize$1,"__esModule",{value:!0});serialize$1.serializeError=void 0;const Web3Response_1$2=Web3Response,version_1$3=version$b,constants_1$5=constants$5,utils_1=utils$2;function serializeError(Xr,eo){const to=(0,utils_1.serialize)(getErrorObject(Xr),{shouldIncludeStack:!0}),ro=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");ro.searchParams.set("version",version_1$3.LIB_VERSION),ro.searchParams.set("code",to.code.toString());const no=getMethod(to.data,eo);return no&&ro.searchParams.set("method",no),ro.searchParams.set("message",to.message),Object.assign(Object.assign({},to),{docUrl:ro.href})}serialize$1.serializeError=serializeError;function getErrorObject(Xr){return typeof Xr=="string"?{message:Xr,code:constants_1$5.standardErrorCodes.rpc.internal}:(0,Web3Response_1$2.isErrorResponse)(Xr)?Object.assign(Object.assign({},Xr),{message:Xr.errorMessage,code:Xr.errorCode,data:{method:Xr.method}}):Xr}function getMethod(Xr,eo){const to=Xr==null?void 0:Xr.method;if(to)return to;if(eo!==void 0){if(typeof eo=="string")return eo;if(Array.isArray(eo)){if(eo.length>0)return eo[0].method}else return eo.method}}var type$3={};Object.defineProperty(type$3,"__esModule",{value:!0});type$3.RegExpString=type$3.IntNumber=type$3.BigIntString=type$3.AddressString=type$3.HexString=type$3.OpaqueType=void 0;function OpaqueType(){return Xr=>Xr}type$3.OpaqueType=OpaqueType;type$3.HexString=OpaqueType();type$3.AddressString=OpaqueType();type$3.BigIntString=OpaqueType();function IntNumber(Xr){return Math.floor(Xr)}type$3.IntNumber=IntNumber;type$3.RegExpString=OpaqueType();var util$6={};Object.defineProperty(util$6,"__esModule",{value:!0});util$6.areAddressArraysEqual=util$6.getFavicon=util$6.range=util$6.isBigNumber=util$6.ensureParsedJSONObject=util$6.ensureBigInt=util$6.ensureRegExpString=util$6.ensureIntNumber=util$6.ensureBuffer=util$6.ensureAddressString=util$6.ensureEvenLengthHexString=util$6.ensureHexString=util$6.isHexString=util$6.prepend0x=util$6.strip0x=util$6.has0xPrefix=util$6.hexStringFromIntNumber=util$6.intNumberFromHexString=util$6.bigIntStringFromBigInt=util$6.hexStringFromBuffer=util$6.hexStringToUint8Array=util$6.uint8ArrayToHex=util$6.randomBytesHex=void 0;const error_1$8=error$2,_1=type$3,INT_STRING_REGEX=/^[0-9]*$/,HEXADECIMAL_STRING_REGEX=/^[a-f0-9]*$/;function randomBytesHex(Xr){return uint8ArrayToHex(crypto.getRandomValues(new Uint8Array(Xr)))}util$6.randomBytesHex=randomBytesHex;function uint8ArrayToHex(Xr){return[...Xr].map(eo=>eo.toString(16).padStart(2,"0")).join("")}util$6.uint8ArrayToHex=uint8ArrayToHex;function hexStringToUint8Array(Xr){return new Uint8Array(Xr.match(/.{1,2}/g).map(eo=>parseInt(eo,16)))}util$6.hexStringToUint8Array=hexStringToUint8Array;function hexStringFromBuffer(Xr,eo=!1){const to=Xr.toString("hex");return(0,_1.HexString)(eo?`0x${to}`:to)}util$6.hexStringFromBuffer=hexStringFromBuffer;function bigIntStringFromBigInt(Xr){return(0,_1.BigIntString)(Xr.toString(10))}util$6.bigIntStringFromBigInt=bigIntStringFromBigInt;function intNumberFromHexString(Xr){return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(Xr,!0))))}util$6.intNumberFromHexString=intNumberFromHexString;function hexStringFromIntNumber(Xr){return(0,_1.HexString)(`0x${BigInt(Xr).toString(16)}`)}util$6.hexStringFromIntNumber=hexStringFromIntNumber;function has0xPrefix(Xr){return Xr.startsWith("0x")||Xr.startsWith("0X")}util$6.has0xPrefix=has0xPrefix;function strip0x$1(Xr){return has0xPrefix(Xr)?Xr.slice(2):Xr}util$6.strip0x=strip0x$1;function prepend0x(Xr){return has0xPrefix(Xr)?`0x${Xr.slice(2)}`:`0x${Xr}`}util$6.prepend0x=prepend0x;function isHexString$1(Xr){if(typeof Xr!="string")return!1;const eo=strip0x$1(Xr).toLowerCase();return HEXADECIMAL_STRING_REGEX.test(eo)}util$6.isHexString=isHexString$1;function ensureHexString(Xr,eo=!1){if(typeof Xr=="string"){const to=strip0x$1(Xr).toLowerCase();if(HEXADECIMAL_STRING_REGEX.test(to))return(0,_1.HexString)(eo?`0x${to}`:to)}throw error_1$8.standardErrors.rpc.invalidParams(`"${String(Xr)}" is not a hexadecimal string`)}util$6.ensureHexString=ensureHexString;function ensureEvenLengthHexString(Xr,eo=!1){let to=ensureHexString(Xr,!1);return to.length%2===1&&(to=(0,_1.HexString)(`0${to}`)),eo?(0,_1.HexString)(`0x${to}`):to}util$6.ensureEvenLengthHexString=ensureEvenLengthHexString;function ensureAddressString(Xr){if(typeof Xr=="string"){const eo=strip0x$1(Xr).toLowerCase();if(isHexString$1(eo)&&eo.length===40)return(0,_1.AddressString)(prepend0x(eo))}throw error_1$8.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(Xr)}`)}util$6.ensureAddressString=ensureAddressString;function ensureBuffer(Xr){if(Buffer$3.isBuffer(Xr))return Xr;if(typeof Xr=="string"){if(isHexString$1(Xr)){const eo=ensureEvenLengthHexString(Xr,!1);return Buffer$3.from(eo,"hex")}return Buffer$3.from(Xr,"utf8")}throw error_1$8.standardErrors.rpc.invalidParams(`Not binary data: ${String(Xr)}`)}util$6.ensureBuffer=ensureBuffer;function ensureIntNumber(Xr){if(typeof Xr=="number"&&Number.isInteger(Xr))return(0,_1.IntNumber)(Xr);if(typeof Xr=="string"){if(INT_STRING_REGEX.test(Xr))return(0,_1.IntNumber)(Number(Xr));if(isHexString$1(Xr))return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(Xr,!0))))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(Xr)}`)}util$6.ensureIntNumber=ensureIntNumber;function ensureRegExpString(Xr){if(Xr instanceof RegExp)return(0,_1.RegExpString)(Xr.toString());throw error_1$8.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(Xr)}`)}util$6.ensureRegExpString=ensureRegExpString;function ensureBigInt(Xr){if(Xr!==null&&(typeof Xr=="bigint"||isBigNumber(Xr)))return BigInt(Xr.toString(10));if(typeof Xr=="number")return BigInt(ensureIntNumber(Xr));if(typeof Xr=="string"){if(INT_STRING_REGEX.test(Xr))return BigInt(Xr);if(isHexString$1(Xr))return BigInt(ensureEvenLengthHexString(Xr,!0))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(Xr)}`)}util$6.ensureBigInt=ensureBigInt;function ensureParsedJSONObject(Xr){if(typeof Xr=="string")return JSON.parse(Xr);if(typeof Xr=="object")return Xr;throw error_1$8.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(Xr)}`)}util$6.ensureParsedJSONObject=ensureParsedJSONObject;function isBigNumber(Xr){if(Xr==null||typeof Xr.constructor!="function")return!1;const{constructor:eo}=Xr;return typeof eo.config=="function"&&typeof eo.EUCLID=="number"}util$6.isBigNumber=isBigNumber;function range(Xr,eo){return Array.from({length:eo-Xr},(to,ro)=>Xr+ro)}util$6.range=range;function getFavicon(){const Xr=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:eo,host:to}=document.location,ro=Xr?Xr.getAttribute("href"):null;return!ro||ro.startsWith("javascript:")||ro.startsWith("vbscript:")?null:ro.startsWith("http://")||ro.startsWith("https://")||ro.startsWith("data:")?ro:ro.startsWith("//")?eo+ro:`${eo}//${to}${ro}`}util$6.getFavicon=getFavicon;function areAddressArraysEqual(Xr,eo){return Xr.length===eo.length&&Xr.every((to,ro)=>to===eo[ro])}util$6.areAddressArraysEqual=areAddressArraysEqual;var util$5={},SCWSigner$1={},SCWKeyManager$1={},cipher={};Object.defineProperty(cipher,"__esModule",{value:!0});cipher.decryptContent=cipher.encryptContent=cipher.importKeyFromHexString=cipher.exportKeyToHexString=cipher.decrypt=cipher.encrypt=cipher.deriveSharedSecret=cipher.generateKeyPair=void 0;const util_1$b=util$6;async function generateKeyPair(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}cipher.generateKeyPair=generateKeyPair;async function deriveSharedSecret(Xr,eo){return crypto.subtle.deriveKey({name:"ECDH",public:eo},Xr,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}cipher.deriveSharedSecret=deriveSharedSecret;async function encrypt(Xr,eo){const to=crypto.getRandomValues(new Uint8Array(12)),ro=await crypto.subtle.encrypt({name:"AES-GCM",iv:to},Xr,new TextEncoder().encode(eo));return{iv:to,cipherText:ro}}cipher.encrypt=encrypt;async function decrypt(Xr,{iv:eo,cipherText:to}){const ro=await crypto.subtle.decrypt({name:"AES-GCM",iv:eo},Xr,to);return new TextDecoder().decode(ro)}cipher.decrypt=decrypt;function getFormat(Xr){switch(Xr){case"public":return"spki";case"private":return"pkcs8"}}async function exportKeyToHexString(Xr,eo){const to=getFormat(Xr),ro=await crypto.subtle.exportKey(to,eo);return(0,util_1$b.uint8ArrayToHex)(new Uint8Array(ro))}cipher.exportKeyToHexString=exportKeyToHexString;async function importKeyFromHexString(Xr,eo){const to=getFormat(Xr),ro=(0,util_1$b.hexStringToUint8Array)(eo).buffer;return await crypto.subtle.importKey(to,ro,{name:"ECDH",namedCurve:"P-256"},!0,Xr==="private"?["deriveKey"]:[])}cipher.importKeyFromHexString=importKeyFromHexString;async function encryptContent(Xr,eo){const to=JSON.stringify(Xr,(ro,no)=>{if(!(no instanceof Error))return no;const io=no;return Object.assign(Object.assign({},io.code?{code:io.code}:{}),{message:io.message})});return encrypt(eo,to)}cipher.encryptContent=encryptContent;async function decryptContent(Xr,eo){return JSON.parse(await decrypt(eo,Xr))}cipher.decryptContent=decryptContent;var ScopedLocalStorage$1={};Object.defineProperty(ScopedLocalStorage$1,"__esModule",{value:!0});ScopedLocalStorage$1.ScopedLocalStorage=void 0;class ScopedLocalStorage{constructor(eo,to){this.scope=eo,this.module=to}setItem(eo,to){localStorage.setItem(this.scopedKey(eo),to)}getItem(eo){return localStorage.getItem(this.scopedKey(eo))}removeItem(eo){localStorage.removeItem(this.scopedKey(eo))}clear(){const eo=this.scopedKey(""),to=[];for(let ro=0;rolocalStorage.removeItem(ro))}scopedKey(eo){return`-${this.scope}${this.module?`:${this.module}`:""}:${eo}`}static clearAll(){new ScopedLocalStorage("CBWSDK").clear(),new ScopedLocalStorage("walletlink").clear()}}ScopedLocalStorage$1.ScopedLocalStorage=ScopedLocalStorage;Object.defineProperty(SCWKeyManager$1,"__esModule",{value:!0});SCWKeyManager$1.SCWKeyManager=void 0;const cipher_1$1=cipher,ScopedLocalStorage_1$6=ScopedLocalStorage$1,OWN_PRIVATE_KEY={storageKey:"ownPrivateKey",keyType:"private"},OWN_PUBLIC_KEY={storageKey:"ownPublicKey",keyType:"public"},PEER_PUBLIC_KEY={storageKey:"peerPublicKey",keyType:"public"};class SCWKeyManager{constructor(){this.storage=new ScopedLocalStorage_1$6.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(eo){this.sharedSecret=null,this.peerPublicKey=eo,await this.storeKey(PEER_PUBLIC_KEY,eo),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(OWN_PUBLIC_KEY.storageKey),this.storage.removeItem(OWN_PRIVATE_KEY.storageKey),this.storage.removeItem(PEER_PUBLIC_KEY.storageKey)}async generateKeyPair(){const eo=await(0,cipher_1$1.generateKeyPair)();this.ownPrivateKey=eo.privateKey,this.ownPublicKey=eo.publicKey,await this.storeKey(OWN_PRIVATE_KEY,eo.privateKey),await this.storeKey(OWN_PUBLIC_KEY,eo.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(OWN_PRIVATE_KEY)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(OWN_PUBLIC_KEY)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(PEER_PUBLIC_KEY)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,cipher_1$1.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(eo){const to=this.storage.getItem(eo.storageKey);return to?(0,cipher_1$1.importKeyFromHexString)(eo.keyType,to):null}async storeKey(eo,to){const ro=await(0,cipher_1$1.exportKeyToHexString)(eo.keyType,to);this.storage.setItem(eo.storageKey,ro)}}SCWKeyManager$1.SCWKeyManager=SCWKeyManager;var SCWStateManager$1={};Object.defineProperty(SCWStateManager$1,"__esModule",{value:!0});SCWStateManager$1.SCWStateManager=void 0;const ScopedLocalStorage_1$5=ScopedLocalStorage$1,ACCOUNTS_KEY="accounts",ACTIVE_CHAIN_STORAGE_KEY="activeChain",AVAILABLE_CHAINS_STORAGE_KEY="availableChains",WALLET_CAPABILITIES_STORAGE_KEY="walletCapabilities";class SCWStateManager{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(eo){var to,ro;this.storage=new ScopedLocalStorage_1$5.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=eo.updateListener,this.availableChains=this.loadItemFromStorage(AVAILABLE_CHAINS_STORAGE_KEY),this._walletCapabilities=this.loadItemFromStorage(WALLET_CAPABILITIES_STORAGE_KEY);const no=this.loadItemFromStorage(ACCOUNTS_KEY),io=this.loadItemFromStorage(ACTIVE_CHAIN_STORAGE_KEY);no&&this.updateListener.onAccountsUpdate({accounts:no,source:"storage"}),io&&this.updateListener.onChainUpdate({chain:io,source:"storage"}),this._accounts=no||[],this._activeChain=io||{id:(ro=(to=eo.appChainIds)===null||to===void 0?void 0:to[0])!==null&&ro!==void 0?ro:1}}updateAccounts(eo){this._accounts=eo,this.storeItemToStorage(ACCOUNTS_KEY,eo),this.updateListener.onAccountsUpdate({accounts:eo,source:"wallet"})}switchChain(eo){var to;const ro=(to=this.availableChains)===null||to===void 0?void 0:to.find(no=>no.id===eo);return ro?(ro===this._activeChain||(this._activeChain=ro,this.storeItemToStorage(ACTIVE_CHAIN_STORAGE_KEY,ro),this.updateListener.onChainUpdate({chain:ro,source:"wallet"})),!0):!1}updateAvailableChains(eo){if(!eo||Object.keys(eo).length===0)return;const to=Object.entries(eo).map(([ro,no])=>({id:Number(ro),rpcUrl:no}));this.availableChains=to,this.storeItemToStorage(AVAILABLE_CHAINS_STORAGE_KEY,to),this.switchChain(this._activeChain.id)}updateWalletCapabilities(eo){this._walletCapabilities=eo,this.storeItemToStorage(WALLET_CAPABILITIES_STORAGE_KEY,eo)}storeItemToStorage(eo,to){this.storage.setItem(eo,JSON.stringify(to))}loadItemFromStorage(eo){const to=this.storage.getItem(eo);return to?JSON.parse(to):void 0}clear(){this.storage.clear()}}SCWStateManager$1.SCWStateManager=SCWStateManager;Object.defineProperty(SCWSigner$1,"__esModule",{value:!0});SCWSigner$1.SCWSigner=void 0;const SCWKeyManager_1=SCWKeyManager$1,SCWStateManager_1=SCWStateManager$1,error_1$7=error$2,util_1$a=util$6,cipher_1=cipher;class SCWSigner{constructor(eo){this.metadata=eo.metadata,this.communicator=eo.communicator,this.keyManager=new SCWKeyManager_1.SCWKeyManager,this.stateManager=new SCWStateManager_1.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:eo.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const eo=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),to=await this.communicator.postRequestAndWaitForResponse(eo);if("failure"in to.content)throw to.content.failure;const ro=await(0,cipher_1.importKeyFromHexString)("public",to.sender);await this.keyManager.setPeerPublicKey(ro);const no=await this.decryptResponseMessage(to);this.updateInternalState({method:"eth_requestAccounts"},no);const io=no.result;if("error"in io)throw io.error;return this.stateManager.accounts}async request(eo){const to=this.tryLocalHandling(eo);if(to!==void 0){if(to instanceof Error)throw to;return to}await this.communicator.waitForPopupLoaded();const ro=await this.sendEncryptedRequest(eo),no=await this.decryptResponseMessage(ro);this.updateInternalState(eo,no);const io=no.result;if("error"in io)throw io.error;return io.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(eo){var to;switch(eo.method){case"wallet_switchEthereumChain":{const ro=eo.params;if(!ro||!(!((to=ro[0])===null||to===void 0)&&to.chainId))throw error_1$7.standardErrors.rpc.invalidParams();const no=(0,util_1$a.ensureIntNumber)(ro[0].chainId);return this.stateManager.switchChain(no)?null:void 0}case"wallet_getCapabilities":{const ro=this.stateManager.walletCapabilities;if(!ro)throw error_1$7.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return ro}default:return}}async sendEncryptedRequest(eo){const to=await this.keyManager.getSharedSecret();if(!to)throw error_1$7.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const ro=await(0,cipher_1.encryptContent)({action:eo,chainId:this.stateManager.activeChain.id},to),no=await this.createRequestMessage({encrypted:ro});return this.communicator.postRequestAndWaitForResponse(no)}async createRequestMessage(eo){const to=await(0,cipher_1.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:to,content:eo,timestamp:new Date}}async decryptResponseMessage(eo){const to=eo.content;if("failure"in to)throw to.failure;const ro=await this.keyManager.getSharedSecret();if(!ro)throw error_1$7.standardErrors.provider.unauthorized("Invalid session");return(0,cipher_1.decryptContent)(to.encrypted,ro)}updateInternalState(eo,to){var ro,no;const io=(ro=to.data)===null||ro===void 0?void 0:ro.chains;io&&this.stateManager.updateAvailableChains(io);const oo=(no=to.data)===null||no===void 0?void 0:no.capabilities;oo&&this.stateManager.updateWalletCapabilities(oo);const ao=to.result;if(!("error"in ao))switch(eo.method){case"eth_requestAccounts":{const so=ao.value;this.stateManager.updateAccounts(so);break}case"wallet_switchEthereumChain":{if(ao.value!==null)return;const so=eo.params,co=(0,util_1$a.ensureIntNumber)(so[0].chainId);this.stateManager.switchChain(co);break}}}}SCWSigner$1.SCWSigner=SCWSigner;var WalletLinkSigner$1={};const{Transform:Transform$1}=requireReadableBrowser$1();var keccak$3=Xr=>class A_ extends Transform$1{constructor(to,ro,no,io,oo){super(oo),this._rate=to,this._capacity=ro,this._delimitedSuffix=no,this._hashBitLength=io,this._options=oo,this._state=new Xr,this._state.initialize(to,ro),this._finalized=!1}_transform(to,ro,no){let io=null;try{this.update(to,ro)}catch(oo){io=oo}no(io)}_flush(to){let ro=null;try{this.push(this.digest())}catch(no){ro=no}to(ro)}update(to,ro){if(!Buffer$3.isBuffer(to)&&typeof to!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer$3.isBuffer(to)||(to=Buffer$3.from(to,ro)),this._state.absorb(to),this}digest(to){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let ro=this._state.squeeze(this._hashBitLength/8);return to!==void 0&&(ro=ro.toString(to)),this._resetState(),ro}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const to=new A_(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(to._state),to._finalized=this._finalized,to}};const{Transform}=requireReadableBrowser$1();var shake=Xr=>class P_ extends Transform{constructor(to,ro,no,io){super(io),this._rate=to,this._capacity=ro,this._delimitedSuffix=no,this._options=io,this._state=new Xr,this._state.initialize(to,ro),this._finalized=!1}_transform(to,ro,no){let io=null;try{this.update(to,ro)}catch(oo){io=oo}no(io)}_flush(){}_read(to){this.push(this.squeeze(to))}update(to,ro){if(!Buffer$3.isBuffer(to)&&typeof to!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer$3.isBuffer(to)||(to=Buffer$3.from(to,ro)),this._state.absorb(to),this}squeeze(to,ro){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let no=this._state.squeeze(to);return ro!==void 0&&(no=no.toString(ro)),no}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const to=new P_(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(to._state),to._finalized=this._finalized,to}};const createKeccak=keccak$3,createShake=shake;var api=function(Xr){const eo=createKeccak(Xr),to=createShake(Xr);return function(ro,no){switch(typeof ro=="string"?ro.toLowerCase():ro){case"keccak224":return new eo(1152,448,null,224,no);case"keccak256":return new eo(1088,512,null,256,no);case"keccak384":return new eo(832,768,null,384,no);case"keccak512":return new eo(576,1024,null,512,no);case"sha3-224":return new eo(1152,448,6,224,no);case"sha3-256":return new eo(1088,512,6,256,no);case"sha3-384":return new eo(832,768,6,384,no);case"sha3-512":return new eo(576,1024,6,512,no);case"shake128":return new to(1344,256,31,no);case"shake256":return new to(1088,512,31,no);default:throw new Error("Invald algorithm: "+ro)}}},keccakStateUnroll={};const P1600_ROUND_CONSTANTS=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];keccakStateUnroll.p1600=function(Xr){for(let eo=0;eo<24;++eo){const to=Xr[0]^Xr[10]^Xr[20]^Xr[30]^Xr[40],ro=Xr[1]^Xr[11]^Xr[21]^Xr[31]^Xr[41],no=Xr[2]^Xr[12]^Xr[22]^Xr[32]^Xr[42],io=Xr[3]^Xr[13]^Xr[23]^Xr[33]^Xr[43],oo=Xr[4]^Xr[14]^Xr[24]^Xr[34]^Xr[44],ao=Xr[5]^Xr[15]^Xr[25]^Xr[35]^Xr[45],so=Xr[6]^Xr[16]^Xr[26]^Xr[36]^Xr[46],co=Xr[7]^Xr[17]^Xr[27]^Xr[37]^Xr[47],lo=Xr[8]^Xr[18]^Xr[28]^Xr[38]^Xr[48],fo=Xr[9]^Xr[19]^Xr[29]^Xr[39]^Xr[49];let ho=lo^(no<<1|io>>>31),go=fo^(io<<1|no>>>31);const yo=Xr[0]^ho,vo=Xr[1]^go,wo=Xr[10]^ho,Eo=Xr[11]^go,ko=Xr[20]^ho,Ao=Xr[21]^go,Po=Xr[30]^ho,jo=Xr[31]^go,Mo=Xr[40]^ho,No=Xr[41]^go;ho=to^(oo<<1|ao>>>31),go=ro^(ao<<1|oo>>>31);const Do=Xr[2]^ho,Fo=Xr[3]^go,Xo=Xr[12]^ho,Lo=Xr[13]^go,Bo=Xr[22]^ho,xo=Xr[23]^go,uo=Xr[32]^ho,po=Xr[33]^go,bo=Xr[42]^ho,_o=Xr[43]^go;ho=no^(so<<1|co>>>31),go=io^(co<<1|so>>>31);const $o=Xr[4]^ho,Co=Xr[5]^go,Ro=Xr[14]^ho,So=Xr[15]^go,mo=Xr[24]^ho,To=Xr[25]^go,Vo=Xr[34]^ho,Zo=Xr[35]^go,Qo=Xr[44]^ho,qo=Xr[45]^go;ho=oo^(lo<<1|fo>>>31),go=ao^(fo<<1|lo>>>31);const Ho=Xr[6]^ho,$a=Xr[7]^go,zo=Xr[16]^ho,Ko=Xr[17]^go,_c=Xr[26]^ho,Cl=Xr[27]^go,ga=Xr[36]^ho,El=Xr[37]^go,Al=Xr[46]^ho,Ol=Xr[47]^go;ho=so^(to<<1|ro>>>31),go=co^(ro<<1|to>>>31);const Wl=Xr[8]^ho,zl=Xr[9]^go,Tl=Xr[18]^ho,Ml=Xr[19]^go,ou=Xr[28]^ho,Vl=Xr[29]^go,Ll=Xr[38]^ho,uu=Xr[39]^go,ru=Xr[48]^ho,tu=Xr[49]^go,ku=yo,au=vo,wl=Eo<<4|wo>>>28,Jo=wo<<4|Eo>>>28,Go=ko<<3|Ao>>>29,$l=Ao<<3|ko>>>29,Zl=jo<<9|Po>>>23,Ul=Po<<9|jo>>>23,Gl=Mo<<18|No>>>14,Nu=No<<18|Mo>>>14,hu=Do<<1|Fo>>>31,cu=Fo<<1|Do>>>31,Wu=Lo<<12|Xo>>>20,mu=Xo<<12|Lo>>>20,yu=Bo<<10|xo>>>22,Yu=xo<<10|Bo>>>22,_u=po<<13|uo>>>19,Il=uo<<13|po>>>19,Nl=bo<<2|_o>>>30,Pl=_o<<2|bo>>>30,Bl=Co<<30|$o>>>2,fu=$o<<30|Co>>>2,eu=Ro<<6|So>>>26,Xl=So<<6|Ro>>>26,$u=To<<11|mo>>>21,Yo=mo<<11|To>>>21,_l=Vo<<15|Zo>>>17,Sl=Zo<<15|Vo>>>17,Wo=qo<<29|Qo>>>3,xl=Qo<<29|qo>>>3,Ql=Ho<<28|$a>>>4,Fl=$a<<28|Ho>>>4,Jl=Ko<<23|zo>>>9,xu=zo<<23|Ko>>>9,lu=_c<<25|Cl>>>7,su=Cl<<25|_c>>>7,Xu=ga<<21|El>>>11,ju=El<<21|ga>>>11,zu=Ol<<24|Al>>>8,Ku=Al<<24|Ol>>>8,Hu=Wl<<27|zl>>>5,Gu=zl<<27|Wl>>>5,Zu=Tl<<20|Ml>>>12,Vu=Ml<<20|Tl>>>12,Ju=Vl<<7|ou>>>25,Uu=ou<<7|Vl>>>25,qu=Ll<<8|uu>>>24,Mu=uu<<8|Ll>>>24,Bu=ru<<14|tu>>>18,Au=tu<<14|ru>>>18;Xr[0]=ku^~Wu&$u,Xr[1]=au^~mu&Yo,Xr[10]=Ql^~Zu&Go,Xr[11]=Fl^~Vu&$l,Xr[20]=hu^~eu&lu,Xr[21]=cu^~Xl&su,Xr[30]=Hu^~wl&yu,Xr[31]=Gu^~Jo&Yu,Xr[40]=Bl^~Jl&Ju,Xr[41]=fu^~xu&Uu,Xr[2]=Wu^~$u&Xu,Xr[3]=mu^~Yo&ju,Xr[12]=Zu^~Go&_u,Xr[13]=Vu^~$l&Il,Xr[22]=eu^~lu&qu,Xr[23]=Xl^~su&Mu,Xr[32]=wl^~yu&_l,Xr[33]=Jo^~Yu&Sl,Xr[42]=Jl^~Ju&Zl,Xr[43]=xu^~Uu&Ul,Xr[4]=$u^~Xu&Bu,Xr[5]=Yo^~ju&Au,Xr[14]=Go^~_u&Wo,Xr[15]=$l^~Il&xl,Xr[24]=lu^~qu&Gl,Xr[25]=su^~Mu&Nu,Xr[34]=yu^~_l&zu,Xr[35]=Yu^~Sl&Ku,Xr[44]=Ju^~Zl&Nl,Xr[45]=Uu^~Ul&Pl,Xr[6]=Xu^~Bu&ku,Xr[7]=ju^~Au&au,Xr[16]=_u^~Wo&Ql,Xr[17]=Il^~xl&Fl,Xr[26]=qu^~Gl&hu,Xr[27]=Mu^~Nu&cu,Xr[36]=_l^~zu&Hu,Xr[37]=Sl^~Ku&Gu,Xr[46]=Zl^~Nl&Bl,Xr[47]=Ul^~Pl&fu,Xr[8]=Bu^~ku&Wu,Xr[9]=Au^~au&mu,Xr[18]=Wo^~Ql&Zu,Xr[19]=xl^~Fl&Vu,Xr[28]=Gl^~hu&eu,Xr[29]=Nu^~cu&Xl,Xr[38]=zu^~Hu&wl,Xr[39]=Ku^~Gu&Jo,Xr[48]=Nl^~Bl&Jl,Xr[49]=Pl^~fu&xu,Xr[0]^=P1600_ROUND_CONSTANTS[eo*2],Xr[1]^=P1600_ROUND_CONSTANTS[eo*2+1]}};const keccakState=keccakStateUnroll;function Keccak$1(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Keccak$1.prototype.initialize=function(Xr,eo){for(let to=0;to<50;++to)this.state[to]=0;this.blockSize=Xr/8,this.count=0,this.squeezing=!1};Keccak$1.prototype.absorb=function(Xr){for(let eo=0;eo>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return eo};Keccak$1.prototype.copy=function(Xr){for(let eo=0;eo<50;++eo)Xr.state[eo]=this.state[eo];Xr.blockSize=this.blockSize,Xr.count=this.count,Xr.squeezing=this.squeezing};var keccak$2=Keccak$1,js$1=api(keccak$2);const createKeccakHash=js$1;function zeros(Xr){return Buffer$3.allocUnsafe(Xr).fill(0)}function bitLengthFromBigInt(Xr){return Xr.toString(2).length}function bufferBEFromBigInt(Xr,eo){let to=Xr.toString(16);to.length%2!==0&&(to="0"+to);const ro=to.match(/.{1,2}/g).map(no=>parseInt(no,16));for(;ro.length"u")throw new Error("Not an array?");if(to=parseTypeArray(Xr),to!=="dynamic"&&to!==0&&eo.length>to)throw new Error("Elements exceed array size: "+to);no=[],Xr=Xr.slice(0,Xr.lastIndexOf("[")),typeof eo=="string"&&(eo=JSON.parse(eo));for(io in eo)no.push(encodeSingle(Xr,eo[io]));if(to==="dynamic"){var oo=encodeSingle("uint256",eo.length);no.unshift(oo)}return Buffer$3.concat(no)}else{if(Xr==="bytes")return eo=new Buffer$3(eo),no=Buffer$3.concat([encodeSingle("uint256",eo.length),eo]),eo.length%32!==0&&(no=Buffer$3.concat([no,util$3.zeros(32-eo.length%32)])),no;if(Xr.startsWith("bytes")){if(to=parseTypeN(Xr),to<1||to>32)throw new Error("Invalid bytes width: "+to);return util$3.setLengthRight(eo,32)}else if(Xr.startsWith("uint")){if(to=parseTypeN(Xr),to%8||to<8||to>256)throw new Error("Invalid uint width: "+to);ro=parseNumber(eo);const ao=util$3.bitLengthFromBigInt(ro);if(ao>to)throw new Error("Supplied uint exceeds width: "+to+" vs "+ao);if(ro<0)throw new Error("Supplied uint is negative");return util$3.bufferBEFromBigInt(ro,32)}else if(Xr.startsWith("int")){if(to=parseTypeN(Xr),to%8||to<8||to>256)throw new Error("Invalid int width: "+to);ro=parseNumber(eo);const ao=util$3.bitLengthFromBigInt(ro);if(ao>to)throw new Error("Supplied int exceeds width: "+to+" vs "+ao);const so=util$3.twosFromBigInt(ro,256);return util$3.bufferBEFromBigInt(so,32)}else if(Xr.startsWith("ufixed")){if(to=parseTypeNxM(Xr),ro=parseNumber(eo),ro<0)throw new Error("Supplied ufixed is negative");return encodeSingle("uint256",ro*BigInt(2)**BigInt(to[1]))}else if(Xr.startsWith("fixed"))return to=parseTypeNxM(Xr),encodeSingle("int256",parseNumber(eo)*BigInt(2)**BigInt(to[1]))}throw new Error("Unsupported or invalid type: "+Xr)}function isDynamic(Xr){return Xr==="string"||Xr==="bytes"||parseTypeArray(Xr)==="dynamic"}function isArray$3(Xr){return Xr.lastIndexOf("]")===Xr.length-1}function rawEncode(Xr,eo){var to=[],ro=[],no=32*Xr.length;for(var io in Xr){var oo=elementaryName(Xr[io]),ao=eo[io],so=encodeSingle(oo,ao);isDynamic(oo)?(to.push(encodeSingle("uint256",no)),ro.push(so),no+=so.length):to.push(so)}return Buffer$3.concat(to.concat(ro))}function solidityPack(Xr,eo){if(Xr.length!==eo.length)throw new Error("Number of types are not matching the values");for(var to,ro,no=[],io=0;io32)throw new Error("Invalid bytes width: "+to);no.push(util$3.setLengthRight(ao,to))}else if(oo.startsWith("uint")){if(to=parseTypeN(oo),to%8||to<8||to>256)throw new Error("Invalid uint width: "+to);ro=parseNumber(ao);const so=util$3.bitLengthFromBigInt(ro);if(so>to)throw new Error("Supplied uint exceeds width: "+to+" vs "+so);no.push(util$3.bufferBEFromBigInt(ro,to/8))}else if(oo.startsWith("int")){if(to=parseTypeN(oo),to%8||to<8||to>256)throw new Error("Invalid int width: "+to);ro=parseNumber(ao);const so=util$3.bitLengthFromBigInt(ro);if(so>to)throw new Error("Supplied int exceeds width: "+to+" vs "+so);const co=util$3.twosFromBigInt(ro,to);no.push(util$3.bufferBEFromBigInt(co,to/8))}else throw new Error("Unsupported or invalid type: "+oo)}return Buffer$3.concat(no)}function soliditySHA3(Xr,eo){return util$3.keccak(solidityPack(Xr,eo))}var abi$1={rawEncode,solidityPack,soliditySHA3};const util$2=util$4,abi=abi$1,TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},TypedDataUtils={encodeData(Xr,eo,to,ro=!0){const no=["bytes32"],io=[this.hashType(Xr,to)];if(ro){const oo=(ao,so,co)=>{if(to[so]!==void 0)return["bytes32",co==null?"0x0000000000000000000000000000000000000000000000000000000000000000":util$2.keccak(this.encodeData(so,co,to,ro))];if(co===void 0)throw new Error(`missing value for field ${ao} of type ${so}`);if(so==="bytes")return["bytes32",util$2.keccak(co)];if(so==="string")return typeof co=="string"&&(co=Buffer$3.from(co,"utf8")),["bytes32",util$2.keccak(co)];if(so.lastIndexOf("]")===so.length-1){const lo=so.slice(0,so.lastIndexOf("[")),fo=co.map(ho=>oo(ao,lo,ho));return["bytes32",util$2.keccak(abi.rawEncode(fo.map(([ho])=>ho),fo.map(([,ho])=>ho)))]}return[so,co]};for(const ao of to[Xr]){const[so,co]=oo(ao.name,ao.type,eo[ao.name]);no.push(so),io.push(co)}}else for(const oo of to[Xr]){let ao=eo[oo.name];if(ao!==void 0)if(oo.type==="bytes")no.push("bytes32"),ao=util$2.keccak(ao),io.push(ao);else if(oo.type==="string")no.push("bytes32"),typeof ao=="string"&&(ao=Buffer$3.from(ao,"utf8")),ao=util$2.keccak(ao),io.push(ao);else if(to[oo.type]!==void 0)no.push("bytes32"),ao=util$2.keccak(this.encodeData(oo.type,ao,to,ro)),io.push(ao);else{if(oo.type.lastIndexOf("]")===oo.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");no.push(oo.type),io.push(ao)}}return abi.rawEncode(no,io)},encodeType(Xr,eo){let to="",ro=this.findTypeDependencies(Xr,eo).filter(no=>no!==Xr);ro=[Xr].concat(ro.sort());for(const no of ro){if(!eo[no])throw new Error("No type definition specified: "+no);to+=no+"("+eo[no].map(({name:oo,type:ao})=>ao+" "+oo).join(",")+")"}return to},findTypeDependencies(Xr,eo,to=[]){if(Xr=Xr.match(/^\w*/)[0],to.includes(Xr)||eo[Xr]===void 0)return to;to.push(Xr);for(const ro of eo[Xr])for(const no of this.findTypeDependencies(ro.type,eo,to))!to.includes(no)&&to.push(no);return to},hashStruct(Xr,eo,to,ro=!0){return util$2.keccak(this.encodeData(Xr,eo,to,ro))},hashType(Xr,eo){return util$2.keccak(this.encodeType(Xr,eo))},sanitizeData(Xr){const eo={};for(const to in TYPED_MESSAGE_SCHEMA.properties)Xr[to]&&(eo[to]=Xr[to]);return eo.types&&(eo.types=Object.assign({EIP712Domain:[]},eo.types)),eo},hash(Xr,eo=!0){const to=this.sanitizeData(Xr),ro=[Buffer$3.from("1901","hex")];return ro.push(this.hashStruct("EIP712Domain",to.domain,to.types,eo)),to.primaryType!=="EIP712Domain"&&ro.push(this.hashStruct(to.primaryType,to.message,to.types,eo)),util$2.keccak(Buffer$3.concat(ro))}};var ethEip712Util={TYPED_MESSAGE_SCHEMA,TypedDataUtils,hashForSignTypedDataLegacy:function(Xr){return typedSignatureHashLegacy(Xr.data)},hashForSignTypedData_v3:function(Xr){return TypedDataUtils.hash(Xr.data,!1)},hashForSignTypedData_v4:function(Xr){return TypedDataUtils.hash(Xr.data)}};function typedSignatureHashLegacy(Xr){const eo=new Error("Expect argument to be non-empty array");if(typeof Xr!="object"||!Xr.length)throw eo;const to=Xr.map(function(io){return io.type==="bytes"?util$2.toBuffer(io.value):io.value}),ro=Xr.map(function(io){return io.type}),no=Xr.map(function(io){if(!io.name)throw eo;return io.type+" "+io.name});return abi.soliditySHA3(["bytes32","bytes32"],[abi.soliditySHA3(new Array(Xr.length).fill("string"),no),abi.soliditySHA3(ro,to)])}var constants$4={};Object.defineProperty(constants$4,"__esModule",{value:!0});constants$4.APP_VERSION_KEY=constants$4.LOCAL_STORAGE_ADDRESSES_KEY=constants$4.WALLET_USER_NAME_KEY=void 0;constants$4.WALLET_USER_NAME_KEY="walletUsername";constants$4.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";constants$4.APP_VERSION_KEY="AppVersion";var RelayEventManager$1={};Object.defineProperty(RelayEventManager$1,"__esModule",{value:!0});RelayEventManager$1.RelayEventManager=void 0;const util_1$9=util$6;class RelayEventManager{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const eo=this._nextRequestId,to=(0,util_1$9.prepend0x)(eo.toString(16));return this.callbacks.get(to)&&this.callbacks.delete(to),eo}}RelayEventManager$1.RelayEventManager=RelayEventManager;var WalletLinkRelay$1={},WalletLinkConnection$1={},WalletLinkCipher$1={};Object.defineProperty(WalletLinkCipher$1,"__esModule",{value:!0});WalletLinkCipher$1.WalletLinkCipher=void 0;const util_1$8=util$6;class WalletLinkCipher{constructor(eo){this.secret=eo}async encrypt(eo){const to=this.secret;if(to.length!==64)throw Error("secret must be 256 bits");const ro=crypto.getRandomValues(new Uint8Array(12)),no=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(to),{name:"aes-gcm"},!1,["encrypt","decrypt"]),io=new TextEncoder,oo=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:ro},no,io.encode(eo)),ao=16,so=oo.slice(oo.byteLength-ao),co=oo.slice(0,oo.byteLength-ao),lo=new Uint8Array(so),fo=new Uint8Array(co),ho=new Uint8Array([...ro,...lo,...fo]);return(0,util_1$8.uint8ArrayToHex)(ho)}async decrypt(eo){const to=this.secret;if(to.length!==64)throw Error("secret must be 256 bits");return new Promise((ro,no)=>{(async function(){const io=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(to),{name:"aes-gcm"},!1,["encrypt","decrypt"]),oo=(0,util_1$8.hexStringToUint8Array)(eo),ao=oo.slice(0,12),so=oo.slice(12,28),co=oo.slice(28),lo=new Uint8Array([...co,...so]),fo={name:"AES-GCM",iv:new Uint8Array(ao)};try{const ho=await window.crypto.subtle.decrypt(fo,io,lo),go=new TextDecoder;ro(go.decode(ho))}catch(ho){no(ho)}})()})}}WalletLinkCipher$1.WalletLinkCipher=WalletLinkCipher;var WalletLinkHTTP$1={};Object.defineProperty(WalletLinkHTTP$1,"__esModule",{value:!0});WalletLinkHTTP$1.WalletLinkHTTP=void 0;class WalletLinkHTTP{constructor(eo,to,ro){this.linkAPIUrl=eo,this.sessionId=to;const no=`${to}:${ro}`;this.auth=`Basic ${btoa(no)}`}async markUnseenEventsAsSeen(eo){return Promise.all(eo.map(to=>fetch(`${this.linkAPIUrl}/events/${to.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(to=>console.error("Unabled to mark event as failed:",to))}async fetchUnseenEvents(){var eo;const to=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(to.ok){const{events:ro,error:no}=await to.json();if(no)throw new Error(`Check unseen events failed: ${no}`);const io=(eo=ro==null?void 0:ro.filter(oo=>oo.event==="Web3Response").map(oo=>({type:"Event",sessionId:this.sessionId,eventId:oo.id,event:oo.event,data:oo.data})))!==null&&eo!==void 0?eo:[];return this.markUnseenEventsAsSeen(io),io}throw new Error(`Check unseen events failed: ${to.status}`)}}WalletLinkHTTP$1.WalletLinkHTTP=WalletLinkHTTP;var WalletLinkWebSocket$1={};Object.defineProperty(WalletLinkWebSocket$1,"__esModule",{value:!0});WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket$1.ConnectionState=void 0;var ConnectionState;(function(Xr){Xr[Xr.DISCONNECTED=0]="DISCONNECTED",Xr[Xr.CONNECTING=1]="CONNECTING",Xr[Xr.CONNECTED=2]="CONNECTED"})(ConnectionState||(WalletLinkWebSocket$1.ConnectionState=ConnectionState={}));class WalletLinkWebSocket{setConnectionStateListener(eo){this.connectionStateListener=eo}setIncomingDataListener(eo){this.incomingDataListener=eo}constructor(eo,to=WebSocket){this.WebSocketClass=to,this.webSocket=null,this.pendingData=[],this.url=eo.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((eo,to)=>{var ro;let no;try{this.webSocket=no=new this.WebSocketClass(this.url)}catch(io){to(io);return}(ro=this.connectionStateListener)===null||ro===void 0||ro.call(this,ConnectionState.CONNECTING),no.onclose=io=>{var oo;this.clearWebSocket(),to(new Error(`websocket error ${io.code}: ${io.reason}`)),(oo=this.connectionStateListener)===null||oo===void 0||oo.call(this,ConnectionState.DISCONNECTED)},no.onopen=io=>{var oo;eo(),(oo=this.connectionStateListener)===null||oo===void 0||oo.call(this,ConnectionState.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(so=>this.sendData(so)),this.pendingData=[])},no.onmessage=io=>{var oo,ao;if(io.data==="h")(oo=this.incomingDataListener)===null||oo===void 0||oo.call(this,{type:"Heartbeat"});else try{const so=JSON.parse(io.data);(ao=this.incomingDataListener)===null||ao===void 0||ao.call(this,so)}catch{}}})}disconnect(){var eo;const{webSocket:to}=this;if(to){this.clearWebSocket(),(eo=this.connectionStateListener)===null||eo===void 0||eo.call(this,ConnectionState.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{to.close()}catch{}}}sendData(eo){const{webSocket:to}=this;if(!to){this.pendingData.push(eo),this.connect();return}to.send(eo)}clearWebSocket(){const{webSocket:eo}=this;eo&&(this.webSocket=null,eo.onclose=null,eo.onerror=null,eo.onmessage=null,eo.onopen=null)}}WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket;Object.defineProperty(WalletLinkConnection$1,"__esModule",{value:!0});WalletLinkConnection$1.WalletLinkConnection=void 0;const constants_1$4=constants$4,WalletLinkCipher_1=WalletLinkCipher$1,WalletLinkHTTP_1=WalletLinkHTTP$1,WalletLinkWebSocket_1=WalletLinkWebSocket$1,type_1$1=type$3,HEARTBEAT_INTERVAL=1e4,REQUEST_TIMEOUT=6e4;class WalletLinkConnection{constructor({session:eo,linkAPIUrl:to,listener:ro,WebSocketClass:no=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,type_1$1.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=oo=>{if(!oo)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",so=>oo.JsonRpcUrl&&this.handleChainUpdated(so,oo.JsonRpcUrl)]]).forEach((so,co)=>{const lo=oo[co];lo!==void 0&&so(lo)})},this.handleDestroyed=oo=>{var ao;oo==="1"&&((ao=this.listener)===null||ao===void 0||ao.resetAndReload())},this.handleAccountUpdated=async oo=>{var ao;{const so=await this.cipher.decrypt(oo);(ao=this.listener)===null||ao===void 0||ao.accountUpdated(so)}},this.handleMetadataUpdated=async(oo,ao)=>{var so;{const co=await this.cipher.decrypt(ao);(so=this.listener)===null||so===void 0||so.metadataUpdated(oo,co)}},this.handleWalletUsernameUpdated=async oo=>{this.handleMetadataUpdated(constants_1$4.WALLET_USER_NAME_KEY,oo)},this.handleAppVersionUpdated=async oo=>{this.handleMetadataUpdated(constants_1$4.APP_VERSION_KEY,oo)},this.handleChainUpdated=async(oo,ao)=>{var so;{const co=await this.cipher.decrypt(oo),lo=await this.cipher.decrypt(ao);(so=this.listener)===null||so===void 0||so.chainUpdated(co,lo)}},this.session=eo,this.cipher=new WalletLinkCipher_1.WalletLinkCipher(eo.secret),this.listener=ro;const io=new WalletLinkWebSocket_1.WalletLinkWebSocket(`${to}/rpc`,no);io.setConnectionStateListener(async oo=>{let ao=!1;switch(oo){case WalletLinkWebSocket_1.ConnectionState.DISCONNECTED:if(!this.destroyed){const so=async()=>{await new Promise(co=>setTimeout(co,5e3)),this.destroyed||io.connect().catch(()=>{so()})};so()}break;case WalletLinkWebSocket_1.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),ao=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},HEARTBEAT_INTERVAL),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case WalletLinkWebSocket_1.ConnectionState.CONNECTING:break}this.connected!==ao&&(this.connected=ao)}),io.setIncomingDataListener(oo=>{var ao;switch(oo.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const so=oo.type==="IsLinkedOK"?oo.linked:void 0;this.linked=so||oo.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(oo.metadata);break}case"Event":{this.handleIncomingEvent(oo);break}}oo.id!==void 0&&((ao=this.requestResolutions.get(oo.id))===null||ao===void 0||ao(oo))}),this.ws=io,this.http=new WalletLinkHTTP_1.WalletLinkHTTP(to,eo.id,eo.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(eo){var to;this._connected=eo,eo&&((to=this.onceConnected)===null||to===void 0||to.call(this))}setOnceConnected(eo){return new Promise(to=>{this.connected?eo().then(to):this.onceConnected=()=>{eo().then(to),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(eo){var to,ro;this._linked=eo,eo&&((to=this.onceLinked)===null||to===void 0||to.call(this)),(ro=this.listener)===null||ro===void 0||ro.linkedUpdated(eo)}setOnceLinked(eo){return new Promise(to=>{this.linked?eo().then(to):this.onceLinked=()=>{eo().then(to),this.onceLinked=void 0}})}async handleIncomingEvent(eo){var to;if(!(eo.type!=="Event"||eo.event!=="Web3Response")){const ro=await this.cipher.decrypt(eo.data),no=JSON.parse(ro);if(no.type!=="WEB3_RESPONSE")return;(to=this.listener)===null||to===void 0||to.handleWeb3ResponseMessage(no)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(eo=>setTimeout(eo,250));try{await this.fetchUnseenEventsAPI()}catch(eo){console.error("Unable to check for unseen events",eo)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(to=>this.handleIncomingEvent(to))}async setSessionMetadata(eo,to){const ro={type:"SetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[eo]:to}};return this.setOnceConnected(async()=>{const no=await this.makeRequest(ro);if(no.type==="Fail")throw new Error(no.error||"failed to set session metadata")})}async publishEvent(eo,to,ro=!1){const no=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},to),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),io={type:"PublishEvent",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:eo,data:no,callWebhook:ro};return this.setOnceLinked(async()=>{const oo=await this.makeRequest(io);if(oo.type==="Fail")throw new Error(oo.error||"failed to publish event");return oo.eventId})}sendData(eo){this.ws.sendData(JSON.stringify(eo))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>HEARTBEAT_INTERVAL*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(eo,to=REQUEST_TIMEOUT){const ro=eo.id;this.sendData(eo);let no;return Promise.race([new Promise((io,oo)=>{no=window.setTimeout(()=>{oo(new Error(`request ${ro} timed out`))},to)}),new Promise(io=>{this.requestResolutions.set(ro,oo=>{clearTimeout(no),io(oo),this.requestResolutions.delete(ro)})})])}async authenticate(){const eo={type:"HostSession",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},to=await this.makeRequest(eo);if(to.type==="Fail")throw new Error(to.error||"failed to authenticate")}sendIsLinked(){const eo={type:"IsLinked",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(eo)}sendGetSessionConfig(){const eo={type:"GetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(eo)}}WalletLinkConnection$1.WalletLinkConnection=WalletLinkConnection;var WalletLinkSession$1={};Object.defineProperty(WalletLinkSession$1,"__esModule",{value:!0});WalletLinkSession$1.WalletLinkSession=void 0;const sha_js_1=requireSha_js(),util_1$7=util$6,STORAGE_KEY_SESSION_ID="session:id",STORAGE_KEY_SESSION_SECRET="session:secret",STORAGE_KEY_SESSION_LINKED="session:linked";class WalletLinkSession{constructor(eo,to,ro,no){this._storage=eo,this._id=to||(0,util_1$7.randomBytesHex)(16),this._secret=ro||(0,util_1$7.randomBytesHex)(32),this._key=new sha_js_1.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!no}static load(eo){const to=eo.getItem(STORAGE_KEY_SESSION_ID),ro=eo.getItem(STORAGE_KEY_SESSION_LINKED),no=eo.getItem(STORAGE_KEY_SESSION_SECRET);return to&&no?new WalletLinkSession(eo,to,no,ro==="1"):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(eo){this._linked=eo,this.persistLinked()}save(){return this._storage.setItem(STORAGE_KEY_SESSION_ID,this._id),this._storage.setItem(STORAGE_KEY_SESSION_SECRET,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(STORAGE_KEY_SESSION_LINKED,this._linked?"1":"0")}}WalletLinkSession$1.WalletLinkSession=WalletLinkSession;var util$1={};Object.defineProperty(util$1,"__esModule",{value:!0});util$1.isDarkMode=util$1.isMobileWeb=util$1.getLocation=util$1.createQrUrl=void 0;function createQrUrl(Xr,eo,to,ro,no,io){const oo=ro?"parent-id":"id",ao=new URLSearchParams({[oo]:Xr,secret:eo,server:to,v:no,chainId:io.toString()}).toString();return`${to}/#/link?${ao}`}util$1.createQrUrl=createQrUrl;function isInIFrame(){try{return window.frameElement!==null}catch{return!1}}function getLocation(){try{return isInIFrame()&&window.top?window.top.location:window.location}catch{return window.location}}util$1.getLocation=getLocation;function isMobileWeb(){var Xr;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((Xr=window==null?void 0:window.navigator)===null||Xr===void 0?void 0:Xr.userAgent)}util$1.isMobileWeb=isMobileWeb;function isDarkMode(){var Xr,eo;return(eo=(Xr=window==null?void 0:window.matchMedia)===null||Xr===void 0?void 0:Xr.call(window,"(prefers-color-scheme: dark)").matches)!==null&&eo!==void 0?eo:!1}util$1.isDarkMode=isDarkMode;var WalletLinkRelayUI$1={},cssReset={},cssResetCss={};Object.defineProperty(cssResetCss,"__esModule",{value:!0});cssResetCss.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var __importDefault$4=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(cssReset,"__esModule",{value:!0});cssReset.injectCssReset=void 0;const cssReset_css_1=__importDefault$4(cssResetCss);function injectCssReset(){const Xr=document.createElement("style");Xr.type="text/css",Xr.appendChild(document.createTextNode(cssReset_css_1.default)),document.documentElement.appendChild(Xr)}cssReset.injectCssReset=injectCssReset;var Snackbar={};function r$3(Xr){var eo,to,ro="";if(typeof Xr=="string"||typeof Xr=="number")ro+=Xr;else if(typeof Xr=="object")if(Array.isArray(Xr))for(eo=0;eo2&&(oo.children=arguments.length>3?n$1.call(arguments,2):to),typeof Xr=="function"&&Xr.defaultProps!=null)for(io in Xr.defaultProps)oo[io]===void 0&&(oo[io]=Xr.defaultProps[io]);return g$4(Xr,oo,ro,no,null)}function g$4(Xr,eo,to,ro,no){var io={type:Xr,props:eo,key:to,ref:ro,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:no??++u$3,__i:-1,__u:0};return no==null&&l$4.vnode!=null&&l$4.vnode(io),io}function m$2(){return{current:null}}function b$4(Xr){return Xr.children}function k$1(Xr,eo){this.props=Xr,this.context=eo}function x$3(Xr,eo){if(eo==null)return Xr.__?x$3(Xr.__,Xr.__i+1):null;for(var to;eoeo&&i$3.sort(f$5));M$2.__r=0}function P$3(Xr,eo,to,ro,no,io,oo,ao,so,co,lo){var fo,ho,go,yo,vo,wo=ro&&ro.__k||v$2,Eo=eo.length;for(to.__d=so,$$2(to,eo,wo),so=to.__d,fo=0;fo0?g$4(no.type,no.props,no.key,no.ref?no.ref:null,no.__v):no).__=Xr,no.__b=Xr.__b+1,io=null,(ao=no.__i=L$4(no,to,oo,lo))!==-1&&(lo--,(io=to[ao])&&(io.__u|=131072)),io==null||io.__v===null?(ao==-1&&fo--,typeof no.type!="function"&&(no.__u|=65536)):ao!==oo&&(ao==oo-1?fo--:ao==oo+1?fo++:(ao>oo?fo--:fo++,no.__u|=65536))):no=Xr.__k[ro]=null;if(lo)for(ro=0;ro(so!=null&&!(131072&so.__u)?1:0))for(;oo>=0||ao=0){if((so=eo[oo])&&!(131072&so.__u)&&no==so.key&&io===so.type)return oo;oo--}if(ao2&&(ao.children=arguments.length>3?n$1.call(arguments,2):to),g$4(Xr.type,ao,ro||Xr.key,no||Xr.ref,null)}function G$2(Xr,eo){var to={__c:eo="__cC"+a$3++,__:Xr,Consumer:function(ro,no){return ro.children(no)},Provider:function(ro){var no,io;return this.getChildContext||(no=new Set,(io={})[eo]=this,this.getChildContext=function(){return io},this.componentWillUnmount=function(){no=null},this.shouldComponentUpdate=function(oo){this.props.value!==oo.value&&no.forEach(function(ao){ao.__e=!0,S$3(ao)})},this.sub=function(oo){no.add(oo);var ao=oo.componentWillUnmount;oo.componentWillUnmount=function(){no&&no.delete(oo),ao&&ao.call(oo)}}),ro.children}};return to.Provider.__=to.Consumer.contextType=to}n$1=v$2.slice,l$4={__e:function(Xr,eo,to,ro){for(var no,io,oo;eo=eo.__;)if((no=eo.__c)&&!no.__)try{if((io=no.constructor)&&io.getDerivedStateFromError!=null&&(no.setState(io.getDerivedStateFromError(Xr)),oo=no.__d),no.componentDidCatch!=null&&(no.componentDidCatch(Xr,ro||{}),oo=no.__d),oo)return no.__E=no}catch(ao){Xr=ao}throw Xr}},u$3=0,t$3=function(Xr){return Xr!=null&&Xr.constructor==null},k$1.prototype.setState=function(Xr,eo){var to;to=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=d$5({},this.state),typeof Xr=="function"&&(Xr=Xr(d$5({},to),this.props)),Xr&&d$5(to,Xr),Xr!=null&&this.__v&&(eo&&this._sb.push(eo),S$3(this))},k$1.prototype.forceUpdate=function(Xr){this.__v&&(this.__e=!0,Xr&&this.__h.push(Xr),S$3(this))},k$1.prototype.render=b$4,i$3=[],r$2=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$5=function(Xr,eo){return Xr.__v.__b-eo.__v.__b},M$2.__r=0,e$2=0,c$2=F$4(!1),s$3=F$4(!0),a$3=0;const preact_module=Object.freeze(Object.defineProperty({__proto__:null,Component:k$1,Fragment:b$4,cloneElement:E$2,createContext:G$2,createElement:_$5,createRef:m$2,h:_$5,hydrate:D$2,get isValidElement(){return t$3},get options(){return l$4},render:B$3,toChildArray:H$2},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(preact_module);var t$2,r$1,u$2,i$2,o$2=0,f$4=[],c$1=l$4,e$1=c$1.__b,a$2=c$1.__r,v$1=c$1.diffed,l$3=c$1.__c,m$1=c$1.unmount,s$2=c$1.__;function d$4(Xr,eo){c$1.__h&&c$1.__h(r$1,Xr,o$2||eo),o$2=0;var to=r$1.__H||(r$1.__H={__:[],__h:[]});return Xr>=to.__.length&&to.__.push({}),to.__[Xr]}function h$3(Xr){return o$2=1,p$1(D$1,Xr)}function p$1(Xr,eo,to){var ro=d$4(t$2++,2);if(ro.t=Xr,!ro.__c&&(ro.__=[to?to(eo):D$1(void 0,eo),function(ao){var so=ro.__N?ro.__N[0]:ro.__[0],co=ro.t(so,ao);so!==co&&(ro.__N=[co,ro.__[1]],ro.__c.setState({}))}],ro.__c=r$1,!r$1.u)){var no=function(ao,so,co){if(!ro.__c.__H)return!0;var lo=ro.__c.__H.__.filter(function(ho){return!!ho.__c});if(lo.every(function(ho){return!ho.__N}))return!io||io.call(this,ao,so,co);var fo=!1;return lo.forEach(function(ho){if(ho.__N){var go=ho.__[0];ho.__=ho.__N,ho.__N=void 0,go!==ho.__[0]&&(fo=!0)}}),!(!fo&&ro.__c.props===ao)&&(!io||io.call(this,ao,so,co))};r$1.u=!0;var io=r$1.shouldComponentUpdate,oo=r$1.componentWillUpdate;r$1.componentWillUpdate=function(ao,so,co){if(this.__e){var lo=io;io=void 0,no(ao,so,co),io=lo}oo&&oo.call(this,ao,so,co)},r$1.shouldComponentUpdate=no}return ro.__N||ro.__}function y$5(Xr,eo){var to=d$4(t$2++,3);!c$1.__s&&C$4(to.__H,eo)&&(to.__=Xr,to.i=eo,r$1.__H.__h.push(to))}function _$4(Xr,eo){var to=d$4(t$2++,4);!c$1.__s&&C$4(to.__H,eo)&&(to.__=Xr,to.i=eo,r$1.__h.push(to))}function A$4(Xr){return o$2=5,T$5(function(){return{current:Xr}},[])}function F$3(Xr,eo,to){o$2=6,_$4(function(){return typeof Xr=="function"?(Xr(eo()),function(){return Xr(null)}):Xr?(Xr.current=eo(),function(){return Xr.current=null}):void 0},to==null?to:to.concat(Xr))}function T$5(Xr,eo){var to=d$4(t$2++,7);return C$4(to.__H,eo)&&(to.__=Xr(),to.__H=eo,to.__h=Xr),to.__}function q$3(Xr,eo){return o$2=8,T$5(function(){return Xr},eo)}function x$2(Xr){var eo=r$1.context[Xr.__c],to=d$4(t$2++,9);return to.c=Xr,eo?(to.__==null&&(to.__=!0,eo.sub(r$1)),eo.props.value):Xr.__}function P$2(Xr,eo){c$1.useDebugValue&&c$1.useDebugValue(eo?eo(Xr):Xr)}function b$3(Xr){var eo=d$4(t$2++,10),to=h$3();return eo.__=Xr,r$1.componentDidCatch||(r$1.componentDidCatch=function(ro,no){eo.__&&eo.__(ro,no),to[1](ro)}),[to[0],function(){to[1](void 0)}]}function g$3(){var Xr=d$4(t$2++,11);if(!Xr.__){for(var eo=r$1.__v;eo!==null&&!eo.__m&&eo.__!==null;)eo=eo.__;var to=eo.__m||(eo.__m=[0,0]);Xr.__="P"+to[0]+"-"+to[1]++}return Xr.__}function j$4(){for(var Xr;Xr=f$4.shift();)if(Xr.__P&&Xr.__H)try{Xr.__H.__h.forEach(z$3),Xr.__H.__h.forEach(B$2),Xr.__H.__h=[]}catch(eo){Xr.__H.__h=[],c$1.__e(eo,Xr.__v)}}c$1.__b=function(Xr){r$1=null,e$1&&e$1(Xr)},c$1.__=function(Xr,eo){Xr&&eo.__k&&eo.__k.__m&&(Xr.__m=eo.__k.__m),s$2&&s$2(Xr,eo)},c$1.__r=function(Xr){a$2&&a$2(Xr),t$2=0;var eo=(r$1=Xr.__c).__H;eo&&(u$2===r$1?(eo.__h=[],r$1.__h=[],eo.__.forEach(function(to){to.__N&&(to.__=to.__N),to.i=to.__N=void 0})):(eo.__h.forEach(z$3),eo.__h.forEach(B$2),eo.__h=[],t$2=0)),u$2=r$1},c$1.diffed=function(Xr){v$1&&v$1(Xr);var eo=Xr.__c;eo&&eo.__H&&(eo.__H.__h.length&&(f$4.push(eo)!==1&&i$2===c$1.requestAnimationFrame||((i$2=c$1.requestAnimationFrame)||w$2)(j$4)),eo.__H.__.forEach(function(to){to.i&&(to.__H=to.i),to.i=void 0})),u$2=r$1=null},c$1.__c=function(Xr,eo){eo.some(function(to){try{to.__h.forEach(z$3),to.__h=to.__h.filter(function(ro){return!ro.__||B$2(ro)})}catch(ro){eo.some(function(no){no.__h&&(no.__h=[])}),eo=[],c$1.__e(ro,to.__v)}}),l$3&&l$3(Xr,eo)},c$1.unmount=function(Xr){m$1&&m$1(Xr);var eo,to=Xr.__c;to&&to.__H&&(to.__H.__.forEach(function(ro){try{z$3(ro)}catch(no){eo=no}}),to.__H=void 0,eo&&c$1.__e(eo,to.__v))};var k=typeof requestAnimationFrame=="function";function w$2(Xr){var eo,to=function(){clearTimeout(ro),k&&cancelAnimationFrame(eo),setTimeout(Xr)},ro=setTimeout(to,100);k&&(eo=requestAnimationFrame(to))}function z$3(Xr){var eo=r$1,to=Xr.__c;typeof to=="function"&&(Xr.__c=void 0,to()),r$1=eo}function B$2(Xr){var eo=r$1;Xr.__c=Xr.__(),r$1=eo}function C$4(Xr,eo){return!Xr||Xr.length!==eo.length||eo.some(function(to,ro){return to!==Xr[ro]})}function D$1(Xr,eo){return typeof eo=="function"?eo(Xr):eo}const hooks_module=Object.freeze(Object.defineProperty({__proto__:null,useCallback:q$3,useContext:x$2,useDebugValue:P$2,useEffect:y$5,useErrorBoundary:b$3,useId:g$3,useImperativeHandle:F$3,useLayoutEffect:_$4,useMemo:T$5,useReducer:p$1,useRef:A$4,useState:h$3},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(hooks_module);var SnackbarCss={};Object.defineProperty(SnackbarCss,"__esModule",{value:!0});SnackbarCss.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(Xr){var eo=commonjsGlobal&&commonjsGlobal.__importDefault||function(ho){return ho&&ho.__esModule?ho:{default:ho}};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.SnackbarInstance=Xr.SnackbarContainer=Xr.Snackbar=void 0;const to=eo(require$$0$1),ro=require$$1,no=require$$2$1,io=util$1,oo=eo(SnackbarCss),ao="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",so="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class co{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,io.isDarkMode)()}attach(go){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",go.appendChild(this.root),this.render()}presentItem(go){const yo=this.nextItemKey++;return this.items.set(yo,go),this.render(),()=>{this.items.delete(yo),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,ro.render)((0,ro.h)("div",null,(0,ro.h)(Xr.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([go,yo])=>(0,ro.h)(Xr.SnackbarInstance,Object.assign({},yo,{key:go}))))),this.root)}}Xr.Snackbar=co;const lo=ho=>(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-container")},(0,ro.h)("style",null,oo.default),(0,ro.h)("div",{class:"-cbwsdk-snackbar"},ho.children));Xr.SnackbarContainer=lo;const fo=({autoExpand:ho,message:go,menuItems:yo})=>{const[vo,wo]=(0,no.useState)(!0),[Eo,ko]=(0,no.useState)(ho??!1);(0,no.useEffect)(()=>{const Po=[window.setTimeout(()=>{wo(!1)},1),window.setTimeout(()=>{ko(!0)},1e4)];return()=>{Po.forEach(window.clearTimeout)}});const Ao=()=>{ko(!Eo)};return(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-instance",vo&&"-cbwsdk-snackbar-instance-hidden",Eo&&"-cbwsdk-snackbar-instance-expanded")},(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:Ao},(0,ro.h)("img",{src:ao,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},go),(0,ro.h)("div",{class:"-gear-container"},!Eo&&(0,ro.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,ro.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,ro.h)("img",{src:so,class:"-gear-icon",title:"Expand"}))),yo&&yo.length>0&&(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},yo.map((Po,jo)=>(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-instance-menu-item",Po.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:Po.onClick,key:jo},(0,ro.h)("svg",{width:Po.svgWidth,height:Po.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,ro.h)("path",{"fill-rule":Po.defaultFillRule,"clip-rule":Po.defaultClipRule,d:Po.path,fill:"#AAAAAA"})),(0,ro.h)("span",{class:(0,to.default)("-cbwsdk-snackbar-instance-menu-item-info",Po.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},Po.info)))))};Xr.SnackbarInstance=fo})(Snackbar);Object.defineProperty(WalletLinkRelayUI$1,"__esModule",{value:!0});WalletLinkRelayUI$1.WalletLinkRelayUI=void 0;const cssReset_1$1=cssReset,Snackbar_1$1=Snackbar;class WalletLinkRelayUI{constructor(){this.attached=!1,this.snackbar=new Snackbar_1$1.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const eo=document.documentElement,to=document.createElement("div");to.className="-cbwsdk-css-reset",eo.appendChild(to),this.snackbar.attach(to),this.attached=!0,(0,cssReset_1$1.injectCssReset)()}showConnecting(eo){let to;return eo.isUnlinkedErrorState?to={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:eo.onResetConnection}]}:to={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:eo.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:eo.onResetConnection}]},this.snackbar.presentItem(to)}}WalletLinkRelayUI$1.WalletLinkRelayUI=WalletLinkRelayUI;var WLMobileRelayUI$1={},RedirectDialog$1={},RedirectDialogCss={};Object.defineProperty(RedirectDialogCss,"__esModule",{value:!0});RedirectDialogCss.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var __importDefault$3=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(RedirectDialog$1,"__esModule",{value:!0});RedirectDialog$1.RedirectDialog=void 0;const clsx_1=__importDefault$3(require$$0$1),preact_1=require$$1,cssReset_1=cssReset,Snackbar_1=Snackbar,util_1$6=util$1,RedirectDialog_css_1=__importDefault$3(RedirectDialogCss);class RedirectDialog{constructor(){this.root=null,this.darkMode=(0,util_1$6.isDarkMode)()}attach(){const eo=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",eo.appendChild(this.root),(0,cssReset_1.injectCssReset)()}present(eo){this.render(eo)}clear(){this.render(null)}render(eo){this.root&&((0,preact_1.render)(null,this.root),eo&&(0,preact_1.render)((0,preact_1.h)(RedirectDialogContent,Object.assign({},eo,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}RedirectDialog$1.RedirectDialog=RedirectDialog;const RedirectDialogContent=({title:Xr,buttonText:eo,darkMode:to,onButtonClick:ro,onDismiss:no})=>{const io=to?"dark":"light";return(0,preact_1.h)(Snackbar_1.SnackbarContainer,{darkMode:to},(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,preact_1.h)("style",null,RedirectDialog_css_1.default),(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:no}),(0,preact_1.h)("div",{class:(0,clsx_1.default)("-cbwsdk-redirect-dialog-box",io)},(0,preact_1.h)("p",null,Xr),(0,preact_1.h)("button",{onClick:ro},eo))))};var constants$3={};Object.defineProperty(constants$3,"__esModule",{value:!0});constants$3.CBW_MOBILE_DEEPLINK_URL=constants$3.WALLETLINK_URL=constants$3.CB_KEYS_URL=void 0;constants$3.CB_KEYS_URL="https://keys.coinbase.com/connect";constants$3.WALLETLINK_URL="https://www.walletlink.org";constants$3.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(WLMobileRelayUI$1,"__esModule",{value:!0});WLMobileRelayUI$1.WLMobileRelayUI=void 0;const RedirectDialog_1=RedirectDialog$1,util_1$5=util$1,constants_1$3=constants$3;class WLMobileRelayUI{constructor(){this.attached=!1,this.redirectDialog=new RedirectDialog_1.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(eo){const to=new URL(constants_1$3.CBW_MOBILE_DEEPLINK_URL);to.searchParams.append("redirect_url",(0,util_1$5.getLocation)().href),eo&&to.searchParams.append("wl_url",eo);const ro=document.createElement("a");ro.target="cbw-opener",ro.href=to.href,ro.rel="noreferrer noopener",ro.click()}openCoinbaseWalletDeeplink(eo){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(eo)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(eo)},99)}showConnecting(eo){return()=>{this.redirectDialog.clear()}}}WLMobileRelayUI$1.WLMobileRelayUI=WLMobileRelayUI;Object.defineProperty(WalletLinkRelay$1,"__esModule",{value:!0});WalletLinkRelay$1.WalletLinkRelay=void 0;const WalletLinkConnection_1=WalletLinkConnection$1,constants_1$2=constants$4,RelayEventManager_1$1=RelayEventManager$1,WalletLinkSession_1=WalletLinkSession$1,Web3Response_1$1=Web3Response,util_1$4=util$1,WalletLinkRelayUI_1=WalletLinkRelayUI$1,WLMobileRelayUI_1=WLMobileRelayUI$1,error_1$6=error$2,util_2$1=util$6,ScopedLocalStorage_1$4=ScopedLocalStorage$1;class WalletLinkRelay{constructor(eo){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,util_1$4.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=io=>{this.isLinked=io;const oo=this.storage.getItem(constants_1$2.LOCAL_STORAGE_ADDRESSES_KEY);if(io&&(this._session.linked=io),this.isUnlinkedErrorState=!1,oo){const ao=oo.split(" "),so=this.storage.getItem("IsStandaloneSigning")==="true";ao[0]!==""&&!io&&this._session.linked&&!so&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(io,oo)=>{this.storage.setItem(io,oo)},this.chainUpdated=(io,oo)=>{this.chainCallbackParams.chainId===io&&this.chainCallbackParams.jsonRpcUrl===oo||(this.chainCallbackParams={chainId:io,jsonRpcUrl:oo},this.chainCallback&&this.chainCallback(io,oo))},this.accountUpdated=io=>{this.accountsCallback&&this.accountsCallback([io]),WalletLinkRelay.accountRequestCallbackIds.size>0&&(Array.from(WalletLinkRelay.accountRequestCallbackIds.values()).forEach(oo=>{const ao={type:"WEB3_RESPONSE",id:oo,response:{method:"requestEthereumAccounts",result:[io]}};this.invokeCallback(Object.assign(Object.assign({},ao),{id:oo}))}),WalletLinkRelay.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=eo.linkAPIUrl,this.storage=eo.storage;const{session:to,ui:ro,connection:no}=this.subscribe();this._session=to,this.connection=no,this.relayEventManager=new RelayEventManager_1$1.RelayEventManager,this.ui=ro}subscribe(){const eo=WalletLinkSession_1.WalletLinkSession.load(this.storage)||new WalletLinkSession_1.WalletLinkSession(this.storage).save(),{linkAPIUrl:to}=this,ro=new WalletLinkConnection_1.WalletLinkConnection({session:eo,linkAPIUrl:to,listener:this}),no=this.isMobileWeb?new WLMobileRelayUI_1.WLMobileRelayUI:new WalletLinkRelayUI_1.WalletLinkRelayUI;return ro.connect(),{session:eo,ui:no,connection:ro}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(eo=>setTimeout(()=>eo(null),1e3))]).then(()=>{this.connection.destroy();const eo=WalletLinkSession_1.WalletLinkSession.load(this.storage);(eo==null?void 0:eo.id)===this._session.id&&ScopedLocalStorage_1$4.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(eo=>{})}setAppInfo(eo,to){this.appName=eo,this.appLogoUrl=to}getStorageItem(eo){return this.storage.getItem(eo)}setStorageItem(eo,to){this.storage.setItem(eo,to)}signEthereumMessage(eo,to,ro,no){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(eo,!0),address:to,addPrefix:ro,typedDataJson:no||null}})}ethereumAddressFromSignedMessage(eo,to,ro){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(eo,!0),signature:(0,util_2$1.hexStringFromBuffer)(to,!0),addPrefix:ro}})}signEthereumTransaction(eo){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:eo.fromAddress,toAddress:eo.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(eo.weiValue),data:(0,util_2$1.hexStringFromBuffer)(eo.data,!0),nonce:eo.nonce,gasPriceInWei:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxFeePerGas:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxPriorityFeePerGas:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,gasLimit:eo.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(eo.gasLimit):null,chainId:eo.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(eo){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:eo.fromAddress,toAddress:eo.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(eo.weiValue),data:(0,util_2$1.hexStringFromBuffer)(eo.data,!0),nonce:eo.nonce,gasPriceInWei:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxFeePerGas:eo.maxFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(eo.maxFeePerGas):null,maxPriorityFeePerGas:eo.maxPriorityFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(eo.maxPriorityFeePerGas):null,gasLimit:eo.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(eo.gasLimit):null,chainId:eo.chainId,shouldSubmit:!0}})}submitEthereumTransaction(eo,to){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,util_2$1.hexStringFromBuffer)(eo,!0),chainId:to}})}scanQRCode(eo){return this.sendRequest({method:"scanQRCode",params:{regExp:eo}})}getWalletLinkSession(){return this._session}genericRequest(eo,to){return this.sendRequest({method:"generic",params:{action:to,data:eo}})}sendGenericMessage(eo){return this.sendRequest(eo)}sendRequest(eo){let to=null;const ro=(0,util_2$1.randomBytesHex)(8),no=io=>{this.publishWeb3RequestCanceledEvent(ro),this.handleErrorResponse(ro,eo.method,io),to==null||to()};return new Promise((io,oo)=>{to=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:no,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(ro,ao=>{if(to==null||to(),(0,Web3Response_1$1.isErrorResponse)(ao))return oo(new Error(ao.errorMessage));io(ao)}),this.publishWeb3RequestEvent(ro,eo)})}setAccountsCallback(eo){this.accountsCallback=eo}setChainCallback(eo){this.chainCallback=eo}setDappDefaultChainCallback(eo){this.dappDefaultChain=eo}publishWeb3RequestEvent(eo,to){const ro={type:"WEB3_REQUEST",id:eo,request:to};this.publishEvent("Web3Request",ro,!0).then(no=>{}).catch(no=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:ro.id,response:{method:to.method,errorMessage:no.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(to.method)}openCoinbaseWalletDeeplink(eo){if(this.ui instanceof WLMobileRelayUI_1.WLMobileRelayUI)switch(eo){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(eo){const to={type:"WEB3_REQUEST_CANCELED",id:eo};this.publishEvent("Web3RequestCanceled",to,!1).then()}publishEvent(eo,to,ro){return this.connection.publishEvent(eo,to,ro)}handleWeb3ResponseMessage(eo){const{response:to}=eo;if(to.method==="requestEthereumAccounts"){WalletLinkRelay.accountRequestCallbackIds.forEach(ro=>this.invokeCallback(Object.assign(Object.assign({},eo),{id:ro}))),WalletLinkRelay.accountRequestCallbackIds.clear();return}this.invokeCallback(eo)}handleErrorResponse(eo,to,ro){var no;const io=(no=ro==null?void 0:ro.message)!==null&&no!==void 0?no:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:eo,response:{method:to,errorMessage:io}})}invokeCallback(eo){const to=this.relayEventManager.callbacks.get(eo.id);to&&(to(eo.response),this.relayEventManager.callbacks.delete(eo.id))}requestEthereumAccounts(){const eo={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},to=(0,util_2$1.randomBytesHex)(8);return new Promise((ro,no)=>{this.relayEventManager.callbacks.set(to,io=>{if((0,Web3Response_1$1.isErrorResponse)(io))return no(new Error(io.errorMessage));ro(io)}),WalletLinkRelay.accountRequestCallbackIds.add(to),this.publishWeb3RequestEvent(to,eo)})}watchAsset(eo,to,ro,no,io,oo){const ao={method:"watchAsset",params:{type:eo,options:{address:to,symbol:ro,decimals:no,image:io},chainId:oo}};let so=null;const co=(0,util_2$1.randomBytesHex)(8),lo=fo=>{this.publishWeb3RequestCanceledEvent(co),this.handleErrorResponse(co,ao.method,fo),so==null||so()};return so=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:lo,onResetConnection:this.resetAndReload}),new Promise((fo,ho)=>{this.relayEventManager.callbacks.set(co,go=>{if(so==null||so(),(0,Web3Response_1$1.isErrorResponse)(go))return ho(new Error(go.errorMessage));fo(go)}),this.publishWeb3RequestEvent(co,ao)})}addEthereumChain(eo,to,ro,no,io,oo){const ao={method:"addEthereumChain",params:{chainId:eo,rpcUrls:to,blockExplorerUrls:no,chainName:io,iconUrls:ro,nativeCurrency:oo}};let so=null;const co=(0,util_2$1.randomBytesHex)(8),lo=fo=>{this.publishWeb3RequestCanceledEvent(co),this.handleErrorResponse(co,ao.method,fo),so==null||so()};return so=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:lo,onResetConnection:this.resetAndReload}),new Promise((fo,ho)=>{this.relayEventManager.callbacks.set(co,go=>{if(so==null||so(),(0,Web3Response_1$1.isErrorResponse)(go))return ho(new Error(go.errorMessage));fo(go)}),this.publishWeb3RequestEvent(co,ao)})}switchEthereumChain(eo,to){const ro={method:"switchEthereumChain",params:Object.assign({chainId:eo},{address:to})},no=(0,util_2$1.randomBytesHex)(8);return new Promise((io,oo)=>{this.relayEventManager.callbacks.set(no,ao=>{if((0,Web3Response_1$1.isErrorResponse)(ao)&&ao.errorCode)return oo(error_1$6.standardErrors.provider.custom({code:ao.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Web3Response_1$1.isErrorResponse)(ao))return oo(new Error(ao.errorMessage));io(ao)}),this.publishWeb3RequestEvent(no,ro)})}}WalletLinkRelay$1.WalletLinkRelay=WalletLinkRelay;WalletLinkRelay.accountRequestCallbackIds=new Set;var __importDefault$2=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(WalletLinkSigner$1,"__esModule",{value:!0});WalletLinkSigner$1.WalletLinkSigner=void 0;const eth_eip712_util_1=__importDefault$2(ethEip712Util),constants_1$1=constants$4,RelayEventManager_1=RelayEventManager$1,Web3Response_1=Web3Response,WalletLinkRelay_1=WalletLinkRelay$1,constants_2=constants$3,error_1$5=error$2,util_1$3=util$6,ScopedLocalStorage_1$3=ScopedLocalStorage$1,DEFAULT_CHAIN_ID_KEY="DefaultChainId",DEFAULT_JSON_RPC_URL="DefaultJsonRpcUrl";class WalletLinkSigner{constructor(eo){var to,ro;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:no,appLogoUrl:io}=eo.metadata;this._appName=no,this._appLogoUrl=io,this._storage=new ScopedLocalStorage_1$3.ScopedLocalStorage("walletlink",constants_2.WALLETLINK_URL),this.updateListener=eo.updateListener,this._relayEventManager=new RelayEventManager_1.RelayEventManager,this._jsonRpcUrlFromOpts="";const oo=this._storage.getItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY);if(oo){const so=oo.split(" ");so[0]!==""&&(this._addresses=so.map(co=>(0,util_1$3.ensureAddressString)(co)),(to=this.updateListener)===null||to===void 0||to.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(DEFAULT_CHAIN_ID_KEY)&&((ro=this.updateListener)===null||ro===void 0||ro.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const eo=this.initializeRelay(),{id:to,secret:ro}=eo.getWalletLinkSession();return{id:to,secret:ro}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var eo;return(eo=this._storage.getItem(DEFAULT_JSON_RPC_URL))!==null&&eo!==void 0?eo:this._jsonRpcUrlFromOpts}set jsonRpcUrl(eo){this._storage.setItem(DEFAULT_JSON_RPC_URL,eo)}updateProviderInfo(eo,to){var ro;this.jsonRpcUrl=eo;const no=this.getChainId();this._storage.setItem(DEFAULT_CHAIN_ID_KEY,to.toString(10)),((0,util_1$3.ensureIntNumber)(to)!==no||!this.hasMadeFirstChainChangedEmission)&&((ro=this.updateListener)===null||ro===void 0||ro.onChainUpdate({chain:{id:to,rpcUrl:eo},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(eo,to,ro,no,io,oo){const so=await this.initializeRelay().watchAsset(eo,to,ro,no,io,oo==null?void 0:oo.toString());return(0,Web3Response_1.isErrorResponse)(so)?!1:!!so.result}async addEthereumChain(eo,to,ro,no,io,oo){var ao,so;if((0,util_1$3.ensureIntNumber)(eo)===this.getChainId())return!1;const co=this.initializeRelay();this._isAuthorized()||await co.requestEthereumAccounts();const lo=await co.addEthereumChain(eo.toString(),to,io,ro,no,oo);return(0,Web3Response_1.isErrorResponse)(lo)?!1:(((ao=lo.result)===null||ao===void 0?void 0:ao.isApproved)===!0&&this.updateProviderInfo(to[0],eo),((so=lo.result)===null||so===void 0?void 0:so.isApproved)===!0)}async switchEthereumChain(eo){const ro=await this.initializeRelay().switchEthereumChain(eo.toString(10),this.selectedAddress||void 0);if((0,Web3Response_1.isErrorResponse)(ro)){if(!ro.errorCode)return;throw ro.errorCode===error_1$5.standardErrorCodes.provider.unsupportedChain?error_1$5.standardErrors.provider.unsupportedChain():error_1$5.standardErrors.provider.custom({message:ro.errorMessage,code:ro.errorCode})}const no=ro.result;no.isApproved&&no.rpcUrl.length>0&&this.updateProviderInfo(no.rpcUrl,eo)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(eo){try{return this._request(eo).catch(to=>{throw to})}catch(to){return Promise.reject(to)}}async _request(eo){if(!eo||typeof eo!="object"||Array.isArray(eo))throw error_1$5.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:eo});const{method:to,params:ro}=eo;if(typeof to!="string"||to.length===0)throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:eo});if(ro!==void 0&&!Array.isArray(ro)&&(typeof ro!="object"||ro===null))throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:eo});const no=ro===void 0?[]:ro,io=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:to,params:no,jsonrpc:"2.0",id:io})).result}_setAddresses(eo,to){var ro;if(!Array.isArray(eo))throw new Error("addresses is not an array");const no=eo.map(io=>(0,util_1$3.ensureAddressString)(io));JSON.stringify(no)!==JSON.stringify(this._addresses)&&(this._addresses=no,(ro=this.updateListener)===null||ro===void 0||ro.onAccountsUpdate({accounts:no,source:"wallet"}),this._storage.setItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY,no.join(" ")))}_sendRequestAsync(eo){return new Promise((to,ro)=>{try{const no=this._handleSynchronousMethods(eo);if(no!==void 0)return to({jsonrpc:"2.0",id:eo.id,result:no})}catch(no){return ro(no)}this._handleAsynchronousMethods(eo).then(no=>no&&to(Object.assign(Object.assign({},no),{id:eo.id}))).catch(no=>ro(no))})}_handleSynchronousMethods(eo){const{method:to}=eo;switch(to){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(eo){const{method:to}=eo,ro=eo.params||[];switch(to){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(ro);case"eth_ecRecover":return this._eth_ecRecover(ro);case"personal_sign":return this._personal_sign(ro);case"personal_ecRecover":return this._personal_ecRecover(ro);case"eth_signTransaction":return this._eth_signTransaction(ro);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(ro);case"eth_sendTransaction":return this._eth_sendTransaction(ro);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(ro);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(ro);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(ro);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(ro);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(ro);case"wallet_watchAsset":return this._wallet_watchAsset(ro);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(eo){try{const to=(0,util_1$3.ensureAddressString)(eo);return this._addresses.map(no=>(0,util_1$3.ensureAddressString)(no)).includes(to)}catch{}return!1}_ensureKnownAddress(eo){if(!this._isKnownAddress(eo))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(eo){const to=eo.from?(0,util_1$3.ensureAddressString)(eo.from):this.selectedAddress;if(!to)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(to);const ro=eo.to?(0,util_1$3.ensureAddressString)(eo.to):null,no=eo.value!=null?(0,util_1$3.ensureBigInt)(eo.value):BigInt(0),io=eo.data?(0,util_1$3.ensureBuffer)(eo.data):Buffer$3.alloc(0),oo=eo.nonce!=null?(0,util_1$3.ensureIntNumber)(eo.nonce):null,ao=eo.gasPrice!=null?(0,util_1$3.ensureBigInt)(eo.gasPrice):null,so=eo.maxFeePerGas!=null?(0,util_1$3.ensureBigInt)(eo.maxFeePerGas):null,co=eo.maxPriorityFeePerGas!=null?(0,util_1$3.ensureBigInt)(eo.maxPriorityFeePerGas):null,lo=eo.gas!=null?(0,util_1$3.ensureBigInt)(eo.gas):null,fo=eo.chainId?(0,util_1$3.ensureIntNumber)(eo.chainId):this.getChainId();return{fromAddress:to,toAddress:ro,weiValue:no,data:io,nonce:oo,gasPriceInWei:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,gasLimit:lo,chainId:fo}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw error_1$5.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw error_1$5.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(eo,to,ro,no){this._ensureKnownAddress(to);try{const oo=await this.initializeRelay().signEthereumMessage(eo,to,ro,no);if((0,Web3Response_1.isErrorResponse)(oo))throw new Error(oo.errorMessage);return{jsonrpc:"2.0",id:0,result:oo.result}}catch(io){throw typeof io.message=="string"&&io.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied message signature"):io}}async _ethereumAddressFromSignedMessage(eo,to,ro){const io=await this.initializeRelay().ethereumAddressFromSignedMessage(eo,to,ro);if((0,Web3Response_1.isErrorResponse)(io))throw new Error(io.errorMessage);return{jsonrpc:"2.0",id:0,result:io.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,util_1$3.hexStringFromIntNumber)(this.getChainId())}getChainId(){const eo=this._storage.getItem(DEFAULT_CHAIN_ID_KEY);if(!eo)return(0,util_1$3.ensureIntNumber)(1);const to=parseInt(eo,10);return(0,util_1$3.ensureIntNumber)(to)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let eo;try{if(eo=await this.initializeRelay().requestEthereumAccounts(),(0,Web3Response_1.isErrorResponse)(eo))throw new Error(eo.errorMessage)}catch(to){throw typeof to.message=="string"&&to.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied account authorization"):to}if(!eo.result)throw new Error("accounts received is empty");return this._setAddresses(eo.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._signEthereumMessage(ro,to,!1)}_eth_ecRecover(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._ethereumAddressFromSignedMessage(to,ro,!1)}_personal_sign(eo){this._requireAuthorization();const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureAddressString)(eo[1]);return this._signEthereumMessage(to,ro,!0)}_personal_ecRecover(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._ethereumAddressFromSignedMessage(to,ro,!0)}async _eth_signTransaction(eo){this._requireAuthorization();const to=this._prepareTransactionParams(eo[0]||{});try{const no=await this.initializeRelay().signEthereumTransaction(to);if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}catch(ro){throw typeof ro.message=="string"&&ro.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):ro}}async _eth_sendRawTransaction(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),no=await this.initializeRelay().submitEthereumTransaction(to,this.getChainId());if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}async _eth_sendTransaction(eo){this._requireAuthorization();const to=this._prepareTransactionParams(eo[0]||{});try{const no=await this.initializeRelay().signAndSubmitEthereumTransaction(to);if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}catch(ro){throw typeof ro.message=="string"&&ro.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):ro}}async _eth_signTypedData_v1(eo){this._requireAuthorization();const to=(0,util_1$3.ensureParsedJSONObject)(eo[0]),ro=(0,util_1$3.ensureAddressString)(eo[1]);this._ensureKnownAddress(ro);const no=eth_eip712_util_1.default.hashForSignTypedDataLegacy({data:to}),io=JSON.stringify(to,null,2);return this._signEthereumMessage(no,ro,!1,io)}async _eth_signTypedData_v3(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureParsedJSONObject)(eo[1]);this._ensureKnownAddress(to);const no=eth_eip712_util_1.default.hashForSignTypedData_v3({data:ro}),io=JSON.stringify(ro,null,2);return this._signEthereumMessage(no,to,!1,io)}async _eth_signTypedData_v4(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureParsedJSONObject)(eo[1]);this._ensureKnownAddress(to);const no=eth_eip712_util_1.default.hashForSignTypedData_v4({data:ro}),io=JSON.stringify(ro,null,2);return this._signEthereumMessage(no,to,!1,io)}async _wallet_addEthereumChain(eo){var to,ro,no,io;const oo=eo[0];if(((to=oo.rpcUrls)===null||to===void 0?void 0:to.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!oo.chainName||oo.chainName.trim()==="")throw error_1$5.standardErrors.rpc.invalidParams("chainName is a required field");if(!oo.nativeCurrency)throw error_1$5.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const ao=parseInt(oo.chainId,16);return await this.addEthereumChain(ao,(ro=oo.rpcUrls)!==null&&ro!==void 0?ro:[],(no=oo.blockExplorerUrls)!==null&&no!==void 0?no:[],oo.chainName,(io=oo.iconUrls)!==null&&io!==void 0?io:[],oo.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(eo){const to=eo[0];return await this.switchEthereumChain(parseInt(to.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(eo){const to=Array.isArray(eo)?eo[0]:eo;if(!to.type)throw error_1$5.standardErrors.rpc.invalidParams("Type is required");if((to==null?void 0:to.type)!=="ERC20")throw error_1$5.standardErrors.rpc.invalidParams(`Asset of type '${to.type}' is not supported`);if(!(to!=null&&to.options))throw error_1$5.standardErrors.rpc.invalidParams("Options are required");if(!(to!=null&&to.options.address))throw error_1$5.standardErrors.rpc.invalidParams("Address is required");const ro=this.getChainId(),{address:no,symbol:io,image:oo,decimals:ao}=to.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(to.type,no,io,ao,oo,ro)}}initializeRelay(){if(!this._relay){const eo=new WalletLinkRelay_1.WalletLinkRelay({linkAPIUrl:constants_2.WALLETLINK_URL,storage:this._storage});eo.setAppInfo(this._appName,this._appLogoUrl),eo.attachUI(),eo.setAccountsCallback((to,ro)=>this._setAddresses(to,ro)),eo.setChainCallback((to,ro)=>{this.updateProviderInfo(ro,parseInt(to,10))}),this._relay=eo}return this._relay}}WalletLinkSigner$1.WalletLinkSigner=WalletLinkSigner;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});provider.checkErrorForInvalidRequestArgs=provider.getCoinbaseInjectedProvider=provider.getCoinbaseInjectedSigner=provider.fetchRPCRequest=void 0;const version_1$2=version$b,error_1$4=error$2;async function fetchRPCRequest(Xr,eo){if(!eo.rpcUrl)throw error_1$4.standardErrors.rpc.internal("No RPC URL set for chain");const to=Object.assign(Object.assign({},Xr),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(eo.rpcUrl,{method:"POST",body:JSON.stringify(to),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":version_1$2.LIB_VERSION}})).json()).result}provider.fetchRPCRequest=fetchRPCRequest;function getCoinbaseInjectedSigner(){return globalThis.coinbaseWalletSigner}provider.getCoinbaseInjectedSigner=getCoinbaseInjectedSigner;function getCoinbaseInjectedLegacyProvider(){return globalThis.coinbaseWalletExtension}function getInjectedEthereum(){var Xr,eo;try{const to=globalThis;return(Xr=to.ethereum)!==null&&Xr!==void 0?Xr:(eo=to.top)===null||eo===void 0?void 0:eo.ethereum}catch{return}}function getCoinbaseInjectedProvider({metadata:Xr,preference:eo}){var to;if(eo.options!=="smartWalletOnly"){if(getCoinbaseInjectedSigner())return;const io=getCoinbaseInjectedLegacyProvider();if(io){const{appName:oo,appLogoUrl:ao,appChainIds:so}=Xr;return(to=io.setAppInfo)===null||to===void 0||to.call(io,oo,ao,so),io}}const ro=getInjectedEthereum();if(ro!=null&&ro.isCoinbaseBrowser)return ro}provider.getCoinbaseInjectedProvider=getCoinbaseInjectedProvider;function checkErrorForInvalidRequestArgs(Xr){if(!Xr||typeof Xr!="object"||Array.isArray(Xr))return error_1$4.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:Xr});const{method:eo,params:to}=Xr;if(typeof eo!="string"||eo.length===0)return error_1$4.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:Xr});if(to!==void 0&&!Array.isArray(to)&&(typeof to!="object"||to===null))return error_1$4.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:Xr})}provider.checkErrorForInvalidRequestArgs=checkErrorForInvalidRequestArgs;Object.defineProperty(util$5,"__esModule",{value:!0});util$5.createSigner=util$5.fetchSignerType=util$5.storeSignerType=util$5.loadSignerType=void 0;const SCWSigner_1=SCWSigner$1,WalletLinkSigner_1=WalletLinkSigner$1,error_1$3=error$2,provider_1$2=provider,ScopedLocalStorage_1$2=ScopedLocalStorage$1,SIGNER_TYPE_KEY="SignerType",storage$1=new ScopedLocalStorage_1$2.ScopedLocalStorage("CBWSDK","SignerConfigurator");function loadSignerType(){return storage$1.getItem(SIGNER_TYPE_KEY)}util$5.loadSignerType=loadSignerType;function storeSignerType(Xr){storage$1.setItem(SIGNER_TYPE_KEY,Xr)}util$5.storeSignerType=storeSignerType;async function fetchSignerType(Xr){const{communicator:eo,metadata:to}=Xr;listenForWalletLinkSessionRequest(eo,to).catch(()=>{});const ro={id:crypto.randomUUID(),event:"selectSignerType",data:Xr.preference},{data:no}=await eo.postRequestAndWaitForResponse(ro);return no}util$5.fetchSignerType=fetchSignerType;function createSigner(Xr){const{signerType:eo,metadata:to,communicator:ro,updateListener:no}=Xr;switch(eo){case"scw":return new SCWSigner_1.SCWSigner({metadata:to,updateListener:no,communicator:ro});case"walletlink":return new WalletLinkSigner_1.WalletLinkSigner({metadata:to,updateListener:no});case"extension":{const io=(0,provider_1$2.getCoinbaseInjectedSigner)();if(!io)throw error_1$3.standardErrors.rpc.internal("injected signer not found");return io}}}util$5.createSigner=createSigner;async function listenForWalletLinkSessionRequest(Xr,eo){await Xr.onMessage(({event:ro})=>ro==="WalletLinkSessionRequest");const to=new WalletLinkSigner_1.WalletLinkSigner({metadata:eo});Xr.postMessage({event:"WalletLinkUpdate",data:{session:to.getSession()}}),await to.handshake(),Xr.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Communicator$1={},util={};Object.defineProperty(util,"__esModule",{value:!0});util.closePopup=util.openPopup=void 0;const error_1$2=error$2,POPUP_WIDTH=420,POPUP_HEIGHT=540;function openPopup(Xr){const eo=(window.innerWidth-POPUP_WIDTH)/2+window.screenX,to=(window.innerHeight-POPUP_HEIGHT)/2+window.screenY,ro=window.open(Xr,"Smart Wallet",`width=${POPUP_WIDTH}, height=${POPUP_HEIGHT}, left=${eo}, top=${to}`);if(ro==null||ro.focus(),!ro)throw error_1$2.standardErrors.rpc.internal("Pop up window failed to open");return ro}util.openPopup=openPopup;function closePopup(Xr){Xr&&!Xr.closed&&Xr.close()}util.closePopup=closePopup;Object.defineProperty(Communicator$1,"__esModule",{value:!0});Communicator$1.Communicator=void 0;const version_1$1=version$b,util_1$2=util,constants_1=constants$3,error_1$1=error$2;class Communicator{constructor(eo=constants_1.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async to=>{(await this.waitForPopupLoaded()).postMessage(to,this.url.origin)},this.postRequestAndWaitForResponse=async to=>{const ro=this.onMessage(({requestId:no})=>no===to.id);return this.postMessage(to),await ro},this.onMessage=async to=>new Promise((ro,no)=>{const io=oo=>{if(oo.origin!==this.url.origin)return;const ao=oo.data;to(ao)&&(ro(ao),window.removeEventListener("message",io),this.listeners.delete(io))};window.addEventListener("message",io),this.listeners.set(io,{reject:no})}),this.disconnect=()=>{(0,util_1$2.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:to},ro)=>{to(error_1$1.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",ro)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,util_1$2.openPopup)(this.url),this.onMessage(({event:to})=>to==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:to})=>to==="PopupLoaded").then(to=>{this.postMessage({requestId:to.id,data:{version:version_1$1.LIB_VERSION}})}).then(()=>{if(!this.popup)throw error_1$1.standardErrors.rpc.internal();return this.popup})),this.url=new URL(eo)}}Communicator$1.Communicator=Communicator;var method={};Object.defineProperty(method,"__esModule",{value:!0});method.determineMethodCategory=void 0;const mapping={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function determineMethodCategory(Xr){for(const eo in mapping){const to=eo;if(mapping[to].includes(Xr))return to}}method.determineMethodCategory=determineMethodCategory;var __rest$2=commonjsGlobal&&commonjsGlobal.__rest||function(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{try{if(this.connected)return this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),this.accounts;const lo=await this.requestSignerSelection(),fo=this.initSigner(lo),ho=await fo.handshake();return this.signer=fo,(0,util_2.storeSignerType)(lo),this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),ho}catch(lo){throw this.handleUnauthorizedError(lo),lo}},sign:async co=>{if(!this.connected||!this.signer)throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(co)}catch(lo){throw this.handleUnauthorizedError(lo),lo}},fetch:co=>(0,provider_1$1.fetchRPCRequest)(co,this.chain),state:co=>{const lo=()=>{if(this.connected)return this.accounts;throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(co.method){case"eth_chainId":return(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return lo();case"eth_coinbase":return lo()[0];default:return this.handlers.unsupported(co)}},deprecated:({method:co})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${co} is deprecated.`)},unsupported:({method:co})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${co} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:co,source:lo})=>{(0,util_1$1.areAddressArraysEqual)(this.accounts,co)||(this.accounts=co,lo!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:co,source:lo})=>{co.id===this.chain.id&&co.rpcUrl===this.chain.rpcUrl||(this.chain=co,lo!=="storage"&&this.emit("chainChanged",(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(co.id))))}},this.metadata=no,this.preference=ao,this.communicator=new Communicator_1.Communicator(oo),this.chain={id:(ro=(to=no.appChainIds)===null||to===void 0?void 0:to[0])!==null&&ro!==void 0?ro:1};const so=(0,util_2.loadSignerType)();this.signer=so?this.initSigner(so):null}get connected(){return this.accounts.length>0}async request(eo){var to;try{const ro=(0,provider_1$1.checkErrorForInvalidRequestArgs)(eo);if(ro)throw ro;const no=(to=(0,method_1.determineMethodCategory)(eo.method))!==null&&to!==void 0?to:"fetch";return this.handlers[no](eo)}catch(ro){return Promise.reject((0,serialize_1$1.serializeError)(ro,eo.method))}}handleUnauthorizedError(eo){eo.code===error_1.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},ScopedLocalStorage_1$1.ScopedLocalStorage.clearAll(),this.emit("disconnect",error_1.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,util_2.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(eo){return(0,util_2.createSigner)({signerType:eo,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}CoinbaseWalletProvider$1.CoinbaseWalletProvider=CoinbaseWalletProvider;Object.defineProperty(CoinbaseWalletSDK$1,"__esModule",{value:!0});CoinbaseWalletSDK$1.CoinbaseWalletSDK=void 0;const wallet_logo_1=walletLogo$1,CoinbaseWalletProvider_1=CoinbaseWalletProvider$1,ScopedLocalStorage_1=ScopedLocalStorage$1,version_1=version$b,util_1=util$6,provider_1=provider;class CoinbaseWalletSDK{constructor(eo){this.metadata={appName:eo.appName||"Dapp",appLogoUrl:eo.appLogoUrl||(0,util_1.getFavicon)(),appChainIds:eo.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(eo={options:"all"}){var to;const ro={metadata:this.metadata,preference:eo};return(to=(0,provider_1.getCoinbaseInjectedProvider)(ro))!==null&&to!==void 0?to:new CoinbaseWalletProvider_1.CoinbaseWalletProvider(ro)}getCoinbaseWalletLogo(eo,to=240){return(0,wallet_logo_1.walletLogo)(eo,to)}storeLatestVersion(){new ScopedLocalStorage_1.ScopedLocalStorage("CBWSDK").setItem("VERSION",version_1.LIB_VERSION)}}CoinbaseWalletSDK$1.CoinbaseWalletSDK=CoinbaseWalletSDK;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.CoinbaseWalletSDK=void 0;const eo=CoinbaseWalletSDK$1;Xr.default=eo.CoinbaseWalletSDK;var to=CoinbaseWalletSDK$1;Object.defineProperty(Xr,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return to.CoinbaseWalletSDK}})})(dist);let coinbaseProvider;const baseSepolia=84532,baseMainnet=8453,getCoinbaseProvider=({appLogoUrl:Xr,appName:eo,evmNetworks:to,walletPreference:ro}={})=>{const no=to==null?void 0:to.map(ao=>Number(ao.chainId));return(to==null?void 0:to.some(ao=>ao.chainId===baseSepolia))&&(no==null||no.sort((ao,so)=>ao===baseSepolia?-1:so===baseSepolia?1:0)),(to==null?void 0:to.some(ao=>ao.chainId===baseMainnet))&&(no==null||no.sort((ao,so)=>ao===baseMainnet?-1:so===baseMainnet?1:0)),coinbaseProvider||(coinbaseProvider=new dist.CoinbaseWalletSDK({appChainIds:no,appLogoUrl:Xr,appName:eo}).makeWeb3Provider({options:ro??"all"})),coinbaseProvider};class Coinbase extends EthWalletConnector{constructor(eo){var{appName:to,appLogoUrl:ro,evmNetworks:no,coinbaseWalletPreference:io}=eo,oo=__rest$6(eo,["appName","appLogoUrl","evmNetworks","coinbaseWalletPreference"]);super(Object.assign({evmNetworks:no},oo)),this.name="Coinbase",this.overrideKey="coinbase",this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.canConnectViaQrCode=!1,this.canConnectViaCustodialService=!this.isInstalledOnBrowser(),this.coinbaseProviderOpts={appLogoUrl:ro,appName:to,evmNetworks:no,walletPreference:io}}get coinbaseProvider(){return getCoinbaseProvider(this.coinbaseProviderOpts)}getConnectedAccounts(){return __awaiter$a(this,void 0,void 0,function*(){try{const eo=yield this.coinbaseProvider.request({method:"eth_accounts"});return eo[0]&&this.setActiveAccount(eo[0]),eo}catch{return[]}})}isInstalledOnBrowser(){var eo;return!!(!((eo=window==null?void 0:window.coinbaseWalletExtension)===null||eo===void 0)&&eo.isCoinbaseWallet)}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){const[eo]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});return this.setActiveAccount(eo),eo})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){const[to]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});try{return yield this.coinbaseProvider.request({method:"personal_sign",params:[toHex$1(toBytes$1(eo)),to.toLowerCase()]})}catch{return}})}setupEventListeners(){const{handleAccountChange:eo,handleChainChange:to,handleDisconnect:ro}=eventListenerHandlers(this);this.coinbaseProvider.on("accountsChanged",eo),this.coinbaseProvider.on("chainChanged",to),this.coinbaseProvider.on("disconnect",ro),this.teardownEventListeners=()=>{this.coinbaseProvider.removeListener("accountsChanged",eo),this.coinbaseProvider.removeListener("chainChanged",to),this.coinbaseProvider.removeListener("disconnect",ro)}}getWalletClient(eo){return createWalletClient({account:this.getActiveAccount(),chain:eo?chainsMap[eo]:void 0,transport:custom$1(this.coinbaseProvider)})}}assertPackageVersion("@dynamic-labs/ethereum",version$c);const EthereumWalletConnectors=Xr=>[...injectedWalletOverrides$1,...fetchInjectedWalletConnector(Xr),...fetchWalletConnectWallets(Xr),...TurnkeyEVMWalletConnectors(Xr),Coinbase,UnknownInjected$1,FallbackEvmConnector,getWalletConnectConnector()];var version$a="3.4.4";function __awaiter$6(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let config$1=null;const setConfig=Xr=>{config$1=Xr};let LEVELS=function(Xr){return Xr[Xr.debug=5]="debug",Xr[Xr.info=4]="info",Xr[Xr.log=3]="log",Xr[Xr.warn=2]="warn",Xr[Xr.error=1]="error",Xr}({});const buildLoggerMessageArgs=Xr=>{const{title:eo,message:to}=Xr;return[` +`)+bu+`return __p +}`;var op=u_(function(){return hp(wl,Du+"return "+bu).apply(to,Pl)});if(op.source=bu,F1(op))throw op;return op}function i3(po){return pp(po).toLowerCase()}function o3(po){return pp(po).toUpperCase()}function a3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return wv(po);if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=Cm(xo),wl=_v(Uo,Vo),Pl=xv(Uo,Vo)+1;return Qm(Uo,wl,Pl).join("")}function s3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return po.slice(0,$v(po)+1);if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=xv(Uo,Cm(xo))+1;return Qm(Uo,0,Vo).join("")}function c3(po,xo,No){if(po=pp(po),po&&(No||xo===to))return po.replace(xl,"");if(!po||!(xo=dm(xo)))return po;var Uo=Cm(po),Vo=_v(Uo,Cm(xo));return Qm(Uo,Vo).join("")}function l3(po,xo){var No=Jo,Uo=Po;if(Pp(xo)){var Vo="separator"in xo?xo.separator:Vo;No="length"in xo?np(xo.length):No,Uo="omission"in xo?dm(xo.omission):Uo}po=pp(po);var wl=po.length;if(m0(po)){var Pl=Cm(po);wl=Pl.length}if(No>=wl)return po;var Bl=No-g0(Uo);if(Bl<1)return Uo;var Gl=Pl?Qm(Pl,0,Bl).join(""):po.slice(0,Bl);if(Vo===to)return Gl+Uo;if(Pl&&(Bl+=Gl.length-Bl),U1(Vo)){if(po.slice(Bl).search(Vo)){var mu,gu=Gl;for(Vo.global||(Vo=t1(Vo.source,pp(Nu.exec(Vo))+"g")),Vo.lastIndex=0;mu=Vo.exec(gu);)var bu=mu.index;Gl=Gl.slice(0,bu===to?Bl:bu)}}else if(po.indexOf(dm(Vo),Bl)!=Bl){var Iu=Gl.lastIndexOf(Vo);Iu>-1&&(Gl=Gl.slice(0,Iu))}return Gl+Uo}function u3(po){return po=pp(po),po&&wu.test(po)?po.replace(Au,j_):po}var d3=E0(function(po,xo,No){return po+(No?" ":"")+xo.toUpperCase()}),q1=dw("toUpperCase");function l_(po,xo,No){return po=pp(po),xo=No?to:xo,xo===to?A_(po)?L_(po):x_(po):po.match(xo)||[]}var u_=ap(function(po,xo){try{return Yp(po,to,xo)}catch(No){return F1(No)?No:new tp(No)}}),f3=Lm(function(po,xo){return gm(xo,function(No){No=Om(No),Bm(po,No,D1(po[No],po))}),po});function h3(po){var xo=po==null?0:po.length,No=Ku();return po=xo?kp(po,function(Uo){if(typeof Uo[1]!="function")throw new ym(oo);return[No(Uo[0]),Uo[1]]}):[],ap(function(Uo){for(var Vo=-1;++VoAo)return[];var No=Io,Uo=Zp(po,Io);xo=Ku(xo),po-=Io;for(var Vo=Xy(Uo,xo);++No0||xo<0)?new lp(No):(po<0?No=No.takeRight(-po):po&&(No=No.drop(po)),xo!==to&&(xo=np(xo),No=xo<0?No.dropRight(-xo):No.take(xo-po)),No)},lp.prototype.takeRightWhile=function(po){return this.reverse().takeWhile(po).reverse()},lp.prototype.toArray=function(){return this.take(Io)},Pm(lp.prototype,function(po,xo){var No=/^(?:filter|find|map|reject)|While$/.test(xo),Uo=/^(?:head|last)$/.test(xo),Vo=_c[Uo?"take"+(xo=="last"?"Right":""):xo],wl=Uo||/^find/.test(xo);Vo&&(_c.prototype[xo]=function(){var Pl=this.__wrapped__,Bl=Uo?[1]:arguments,Gl=Pl instanceof lp,mu=Bl[0],gu=Gl||rp(Pl),bu=function(cp){var dp=Vo.apply(_c,Km([cp],Bl));return Uo&&Iu?dp[0]:dp};gu&&No&&typeof mu=="function"&&mu.length!=1&&(Gl=gu=!1);var Iu=this.__chain__,Du=!!this.__actions__.length,Zu=wl&&!Iu,op=Gl&&!Du;if(!wl&&gu){Pl=op?Pl:new lp(this);var Ju=po.apply(Pl,Bl);return Ju.__actions__.push({func:Ny,args:[bu],thisArg:to}),new bm(Ju,Iu)}return Zu&&op?po.apply(this,Bl):(Ju=this.thru(bu),Zu?Uo?Ju.value()[0]:Ju.value():Ju)})}),gm(["pop","push","shift","sort","splice","unshift"],function(po){var xo=oy[po],No=/^(?:push|sort|unshift)$/.test(po)?"tap":"thru",Uo=/^(?:pop|shift)$/.test(po);_c.prototype[po]=function(){var Vo=arguments;if(Uo&&!this.__chain__){var wl=this.value();return xo.apply(rp(wl)?wl:[],Vo)}return this[No](function(Pl){return xo.apply(rp(Pl)?Pl:[],Vo)})}}),Pm(lp.prototype,function(po,xo){var No=_c[xo];if(No){var Uo=No.name+"";mp.call(w0,Uo)||(w0[Uo]=[]),w0[Uo].push({name:xo,func:No})}}),w0[ky(to,$o).name]=[{name:"wrapper",func:to}],lp.prototype.clone=sx,lp.prototype.reverse=cx,lp.prototype.value=lx,_c.prototype.at=L2,_c.prototype.chain=F2,_c.prototype.commit=U2,_c.prototype.next=W2,_c.prototype.plant=q2,_c.prototype.reverse=H2,_c.prototype.toJSON=_c.prototype.valueOf=_c.prototype.value=V2,_c.prototype.first=_c.prototype.head,R0&&(_c.prototype[R0]=z2),_c},y0=F_();nm?((nm.exports=y0)._=y0,Xp._=y0):$p._=y0}).call(ge$2)})(Ui$1,Ui$1.exports);var Gg=Object.defineProperty,zg=Object.defineProperties,Kg=Object.getOwnPropertyDescriptors,Ea=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,ya=(Xr,eo,to)=>eo in Xr?Gg(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,cr$2=(Xr,eo)=>{for(var to in eo||(eo={}))Yg.call(eo,to)&&ya(Xr,to,eo[to]);if(Ea)for(var to of Ea(eo))Zg.call(eo,to)&&ya(Xr,to,eo[to]);return Xr},Jg=(Xr,eo)=>zg(Xr,Kg(eo));function ft$2(Xr,eo,to){var ro;const no=ve$2(Xr);return((ro=eo.rpcMap)==null?void 0:ro[no.reference])||`${Bg}?chainId=${no.namespace}:${no.reference}&projectId=${to}`}function Ct$2(Xr){return Xr.includes(":")?Xr.split(":")[1]:Xr}function Sa(Xr){return Xr.map(eo=>`${eo.split(":")[0]}:${eo.split(":")[1]}`)}function Xg(Xr,eo){const to=Object.keys(eo.namespaces).filter(no=>no.includes(Xr));if(!to.length)return[];const ro=[];return to.forEach(no=>{const io=eo.namespaces[no].accounts;ro.push(...io)}),ro}function Oa(Xr={},eo={}){const to=Ra(Xr),ro=Ra(eo);return Ui$1.exports.merge(to,ro)}function Ra(Xr){var eo,to,ro,no;const io={};if(!B$5(Xr))return io;for(const[oo,ao]of Object.entries(Xr)){const so=oe$3(oo)?[oo]:ao.chains,co=ao.methods||[],lo=ao.events||[],uo=ao.rpcMap||{},ho=en$1(oo);io[ho]=Jg(cr$2(cr$2({},io[ho]),ao),{chains:S$7(so,(eo=io[ho])==null?void 0:eo.chains),methods:S$7(co,(to=io[ho])==null?void 0:to.methods),events:S$7(lo,(ro=io[ho])==null?void 0:ro.events),rpcMap:cr$2(cr$2({},uo),(no=io[ho])==null?void 0:no.rpcMap)})}return io}function Qg(Xr){return Xr.includes(":")?Xr.split(":")[2]:Xr}function Vg(Xr){const eo={};for(const[to,ro]of Object.entries(Xr)){const no=ro.methods||[],io=ro.events||[],oo=ro.accounts||[],ao=oe$3(to)?[to]:ro.chains?ro.chains:Sa(ro.accounts);eo[to]={chains:ao,methods:no,events:io,accounts:oo}}return eo}function Wi$1(Xr){return typeof Xr=="number"?Xr:Xr.includes("0x")?parseInt(Xr,16):(Xr=Xr.includes(":")?Xr.split(":")[1]:Xr,isNaN(Number(Xr))?Xr:Number(Xr))}const ba$1={},z$5=Xr=>ba$1[Xr],Fi$1=(Xr,eo)=>{ba$1[Xr]=eo};class kg{constructor(eo){this.name="polkadot",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getAccounts(){const eo=this.namespace.accounts;return eo?eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2])||[]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class jg{constructor(eo){this.name="eip155",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(eo){switch(eo.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(eo);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(eo.request.method)?await this.client.request(eo):this.getHttpProvider().request(eo.request)}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(parseInt(eo),to),this.chainId=parseInt(eo),this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}createHttpProvider(eo,to){const ro=to||ft$2(`${this.name}:${eo}`,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=parseInt(Ct$2(to));eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}getHttpProvider(){const eo=this.chainId,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}async handleSwitchChain(eo){var to,ro;let no=eo.request.params?(to=eo.request.params[0])==null?void 0:to.chainId:"0x0";no=no.startsWith("0x")?no:`0x${no}`;const io=parseInt(no,16);if(this.isChainApproved(io))this.setDefaultChain(`${io}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:eo.topic,request:{method:eo.request.method,params:[{chainId:no}]},chainId:(ro=this.namespace.chains)==null?void 0:ro[0]}),this.setDefaultChain(`${io}`);else throw new Error(`Failed to switch to chain 'eip155:${io}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(eo){return this.namespace.chains.includes(`${this.name}:${eo}`)}}class nv{constructor(eo){this.name="solana",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class tv{constructor(eo){this.name="cosmos",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class ev{constructor(eo){this.name="cip34",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{const ro=this.getCardanoRPCUrl(to),no=Ct$2(to);eo[no]=this.createHttpProvider(no,ro)}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}getCardanoRPCUrl(eo){const to=this.namespace.rpcMap;if(to)return to[eo]}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||this.getCardanoRPCUrl(eo);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class rv{constructor(eo){this.name="elrond",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class iv{constructor(eo){this.name="multiversx",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){this.httpProviders[eo]||this.setHttpProvider(eo,to),this.chainId=eo,this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${eo}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}getAccounts(){const eo=this.namespace.accounts;return eo?[...new Set(eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2]))]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;const no=Ct$2(to);eo[no]=this.createHttpProvider(no,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace,this.client.core.projectId);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);return new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}class sv{constructor(eo){this.name="near",this.namespace=eo.namespace,this.events=z$5("events"),this.client=z$5("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(eo){this.namespace=Object.assign(this.namespace,eo)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const eo=this.namespace.chains[0];if(!eo)throw new Error("ChainId not found");return eo.split(":")[1]}request(eo){return this.namespace.methods.includes(eo.request.method)?this.client.request(eo):this.getHttpProvider().request(eo.request)}setDefaultChain(eo,to){if(this.chainId=eo,!this.httpProviders[eo]){const ro=to||ft$2(`${this.name}:${eo}`,this.namespace);if(!ro)throw new Error(`No RPC url provided for chainId: ${eo}`);this.setHttpProvider(eo,ro)}this.events.emit(Vn$1.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const eo=this.namespace.accounts;return eo?eo.filter(to=>to.split(":")[1]===this.chainId.toString()).map(to=>to.split(":")[2])||[]:[]}createHttpProviders(){const eo={};return this.namespace.chains.forEach(to=>{var ro;eo[to]=this.createHttpProvider(to,(ro=this.namespace.rpcMap)==null?void 0:ro[to])}),eo}getHttpProvider(){const eo=`${this.name}:${this.chainId}`,to=this.httpProviders[eo];if(typeof to>"u")throw new Error(`JSON-RPC provider for ${eo} not found`);return to}setHttpProvider(eo,to){const ro=this.createHttpProvider(eo,to);ro&&(this.httpProviders[eo]=ro)}createHttpProvider(eo,to){const ro=to||ft$2(eo,this.namespace);return typeof ro>"u"?void 0:new JsonRpcProvider(new f$7(ro,z$5("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,La=(Xr,eo,to)=>eo in Xr?uv(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,hr$1=(Xr,eo)=>{for(var to in eo||(eo={}))fv.call(eo,to)&&La(Xr,to,eo[to]);if(Ta)for(var to of Ta(eo))cv.call(eo,to)&&La(Xr,to,eo[to]);return Xr},Mi$1=(Xr,eo)=>av(Xr,ov(eo));let lr$2=class uC{constructor(eo){this.events=new EventEmitter$1,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=eo,this.logger=typeof(eo==null?void 0:eo.logger)<"u"&&typeof(eo==null?void 0:eo.logger)!="string"?eo.logger:Hg(k$2({level:(eo==null?void 0:eo.logger)||Ia})),this.disableProviderPing=(eo==null?void 0:eo.disableProviderPing)||!1}static async init(eo){const to=new uC(eo);return await to.initialize(),to}async request(eo,to,ro){const[no,io]=this.validateChain(to);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(no).request({request:hr$1({},eo),chainId:`${no}:${io}`,topic:this.session.topic,expiry:ro})}sendAsync(eo,to,ro,no){const io=new Date().getTime();this.request(eo,ro,no).then(oo=>to(null,formatJsonRpcResult(io,oo))).catch(oo=>to(oo,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var eo;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(eo=this.session)==null?void 0:eo.topic,reason:U$6("USER_DISCONNECTED")}),await this.cleanup()}async connect(eo){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(eo),await this.cleanupPendingPairings(),!eo.skipPairing)return await this.pair(eo.pairingTopic)}on(eo,to){this.events.on(eo,to)}once(eo,to){this.events.once(eo,to)}removeListener(eo,to){this.events.removeListener(eo,to)}off(eo,to){this.events.off(eo,to)}get isWalletConnect(){return!0}async pair(eo){this.shouldAbortPairingAttempt=!1;let to=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(to>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:ro,approval:no}=await this.client.connect({pairingTopic:eo,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});ro&&(this.uri=ro,this.events.emit("display_uri",ro)),await no().then(io=>{this.session=io;const oo=Vg(io.namespaces);this.namespaces=Oa(this.namespaces,oo),this.persist("namespaces",this.namespaces)}).catch(io=>{if(io.message!==ae$2)throw io;to++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(eo,to){try{if(!this.session)return;const[ro,no]=this.validateChain(eo);this.getProvider(ro).setDefaultChain(no,to)}catch(ro){if(!/Please call connect/.test(ro.message))throw ro}}async cleanupPendingPairings(eo={}){this.logger.info("Cleaning up inactive pairings...");const to=this.client.pairing.getAll();if(k$4(to)){for(const ro of to)eo.deletePairings?this.client.core.expirer.set(ro.topic,0):await this.client.core.relayer.subscriber.unsubscribe(ro.topic);this.logger.info(`Inactive pairings cleared: ${to.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const eo=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[eo]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Q$4.init({logger:this.providerOpts.logger||Ia,relayUrl:this.providerOpts.relayUrl||Fg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const eo=[...new Set(Object.keys(this.session.namespaces).map(to=>en$1(to)))];Fi$1("client",this.client),Fi$1("events",this.events),Fi$1("disableProviderPing",this.disableProviderPing),eo.forEach(to=>{if(!this.session)return;const ro=Xg(to,this.session),no=Sa(ro),io=Oa(this.namespaces,this.optionalNamespaces),oo=Mi$1(hr$1({},io[to]),{accounts:ro,chains:no});switch(to){case"eip155":this.rpcProviders[to]=new jg({namespace:oo});break;case"solana":this.rpcProviders[to]=new nv({namespace:oo});break;case"cosmos":this.rpcProviders[to]=new tv({namespace:oo});break;case"polkadot":this.rpcProviders[to]=new kg({namespace:oo});break;case"cip34":this.rpcProviders[to]=new ev({namespace:oo});break;case"elrond":this.rpcProviders[to]=new rv({namespace:oo});break;case"multiversx":this.rpcProviders[to]=new iv({namespace:oo});break;case"near":this.rpcProviders[to]=new sv({namespace:oo});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",eo=>{this.events.emit("session_ping",eo)}),this.client.on("session_event",eo=>{const{params:to}=eo,{event:ro}=to;if(ro.name==="accountsChanged"){const no=ro.data;no&&k$4(no)&&this.events.emit("accountsChanged",no.map(Qg))}else if(ro.name==="chainChanged"){const no=to.chainId,io=to.event.data,oo=en$1(no),ao=Wi$1(no)!==Wi$1(io)?`${oo}:${Wi$1(io)}`:no;this.onChainChanged(ao)}else this.events.emit(ro.name,ro.data);this.events.emit("session_event",eo)}),this.client.on("session_update",({topic:eo,params:to})=>{var ro;const{namespaces:no}=to,io=(ro=this.client)==null?void 0:ro.session.get(eo);this.session=Mi$1(hr$1({},io),{namespaces:no}),this.onSessionUpdate(),this.events.emit("session_update",{topic:eo,params:to})}),this.client.on("session_delete",async eo=>{await this.cleanup(),this.events.emit("session_delete",eo),this.events.emit("disconnect",Mi$1(hr$1({},U$6("USER_DISCONNECTED")),{data:eo.topic}))}),this.on(Vn$1.DEFAULT_CHAIN_CHANGED,eo=>{this.onChainChanged(eo,!0)})}getProvider(eo){if(!this.rpcProviders[eo])throw new Error(`Provider not found: ${eo}`);return this.rpcProviders[eo]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(eo=>{var to;this.getProvider(eo).updateNamespace((to=this.session)==null?void 0:to.namespaces[eo])})}setNamespaces(eo){const{namespaces:to,optionalNamespaces:ro,sessionProperties:no}=eo;to&&Object.keys(to).length&&(this.namespaces=to),ro&&Object.keys(ro).length&&(this.optionalNamespaces=ro),this.sessionProperties=no,this.persist("namespaces",to),this.persist("optionalNamespaces",ro)}validateChain(eo){const[to,ro]=(eo==null?void 0:eo.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[to,ro];if(to&&!Object.keys(this.namespaces||{}).map(oo=>en$1(oo)).includes(to))throw new Error(`Namespace '${to}' is not configured. Please call connect() first with namespace config.`);if(to&&ro)return[to,ro];const no=en$1(Object.keys(this.namespaces)[0]),io=this.rpcProviders[no].getDefaultChain();return[no,io]}async requestAccounts(){const[eo]=this.validateChain();return await this.getProvider(eo).requestAccounts()}onChainChanged(eo,to=!1){if(!this.namespaces)return;const[ro,no]=this.validateChain(eo);no&&(to||this.getProvider(ro).setDefaultChain(no),this.namespaces[ro]?this.namespaces[ro].defaultChain=no:this.namespaces[`${ro}:${no}`]?this.namespaces[`${ro}:${no}`].defaultChain=no:this.namespaces[`${ro}:${no}`]={defaultChain:no},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",no))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(eo,to){this.client.core.storage.setItem(`${xa}/${eo}`,to)}async getFromStore(eo){return await this.client.core.storage.getItem(`${xa}/${eo}`)}};const hv=lr$2,P$4="wc",S$4="ethereum_provider",$$3=`${P$4}@2:${S$4}:`,j$6="https://rpc.walletconnect.com/v1/",u$4=["eth_sendTransaction","personal_sign"],E$3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],m$3=["chainChanged","accountsChanged"],_$6=["chainChanged","accountsChanged","message","disconnect","connect"];var N$5=Object.defineProperty,q$5=Object.defineProperties,D$3=Object.getOwnPropertyDescriptors,y$7=Object.getOwnPropertySymbols,U$4=Object.prototype.hasOwnProperty,Q$3=Object.prototype.propertyIsEnumerable,O$6=(Xr,eo,to)=>eo in Xr?N$5(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,p$3=(Xr,eo)=>{for(var to in eo||(eo={}))U$4.call(eo,to)&&O$6(Xr,to,eo[to]);if(y$7)for(var to of y$7(eo))Q$3.call(eo,to)&&O$6(Xr,to,eo[to]);return Xr},M$3=(Xr,eo)=>q$5(Xr,D$3(eo));function g$5(Xr){return Number(Xr[0].split(":")[1])}function f$6(Xr){return`0x${Xr.toString(16)}`}function L$5(Xr){const{chains:eo,optionalChains:to,methods:ro,optionalMethods:no,events:io,optionalEvents:oo,rpcMap:ao}=Xr;if(!k$4(eo))throw new Error("Invalid chains");const so={chains:eo,methods:ro||u$4,events:io||m$3,rpcMap:p$3({},eo.length?{[g$5(eo)]:ao[g$5(eo)]}:{})},co=io==null?void 0:io.filter(go=>!m$3.includes(go)),lo=ro==null?void 0:ro.filter(go=>!u$4.includes(go));if(!to&&!oo&&!no&&!(co!=null&&co.length)&&!(lo!=null&&lo.length))return{required:eo.length?so:void 0};const uo=(co==null?void 0:co.length)&&(lo==null?void 0:lo.length)||!to,ho={chains:[...new Set(uo?so.chains.concat(to||[]):to)],methods:[...new Set(so.methods.concat(no!=null&&no.length?no:E$3))],events:[...new Set(so.events.concat(oo!=null&&oo.length?oo:_$6))],rpcMap:ao};return{required:eo.length?so:void 0,optional:to.length?ho:void 0}}let v$3=class dC{constructor(){this.events=new eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$$3,this.on=(eo,to)=>(this.events.on(eo,to),this),this.once=(eo,to)=>(this.events.once(eo,to),this),this.removeListener=(eo,to)=>(this.events.removeListener(eo,to),this),this.off=(eo,to)=>(this.events.off(eo,to),this),this.parseAccount=eo=>this.isCompatibleChainId(eo)?this.parseAccountId(eo).address:eo,this.signer={},this.rpc={}}static async init(eo){const to=new dC;return await to.initialize(eo),to}async request(eo,to){return await this.signer.request(eo,this.formatChainId(this.chainId),to)}sendAsync(eo,to,ro){this.signer.sendAsync(eo,to,this.formatChainId(this.chainId),ro)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(eo){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(eo);const{required:to,optional:ro}=L$5(this.rpc);try{const no=await new Promise(async(oo,ao)=>{var so;this.rpc.showQrModal&&((so=this.modal)==null||so.subscribeModal(co=>{!co.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),ao(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(M$3(p$3({namespaces:p$3({},to&&{[this.namespace]:to})},ro&&{optionalNamespaces:{[this.namespace]:ro}}),{pairingTopic:eo==null?void 0:eo.pairingTopic})).then(co=>{oo(co)}).catch(co=>{ao(new Error(co.message))})});if(!no)return;const io=Un$1(no.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:io),this.setAccounts(io),this.events.emit("connect",{chainId:f$6(this.chainId)})}catch(no){throw this.signer.logger.error(no),no}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",eo=>{const{params:to}=eo,{event:ro}=to;ro.name==="accountsChanged"?(this.accounts=this.parseAccounts(ro.data),this.events.emit("accountsChanged",this.accounts)):ro.name==="chainChanged"?this.setChainId(this.formatChainId(ro.data)):this.events.emit(ro.name,ro.data),this.events.emit("session_event",eo)}),this.signer.on("chainChanged",eo=>{const to=parseInt(eo);this.chainId=to,this.events.emit("chainChanged",f$6(this.chainId)),this.persist()}),this.signer.on("session_update",eo=>{this.events.emit("session_update",eo)}),this.signer.on("session_delete",eo=>{this.reset(),this.events.emit("session_delete",eo),this.events.emit("disconnect",M$3(p$3({},U$6("USER_DISCONNECTED")),{data:eo.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",eo=>{var to,ro;this.rpc.showQrModal&&((to=this.modal)==null||to.closeModal(),(ro=this.modal)==null||ro.openModal({uri:eo})),this.events.emit("display_uri",eo)})}switchEthereumChain(eo){this.request({method:"wallet_switchEthereumChain",params:[{chainId:eo.toString(16)}]})}isCompatibleChainId(eo){return typeof eo=="string"?eo.startsWith(`${this.namespace}:`):!1}formatChainId(eo){return`${this.namespace}:${eo}`}parseChainId(eo){return Number(eo.split(":")[1])}setChainIds(eo){const to=eo.filter(ro=>this.isCompatibleChainId(ro)).map(ro=>this.parseChainId(ro));to.length&&(this.chainId=to[0],this.events.emit("chainChanged",f$6(this.chainId)),this.persist())}setChainId(eo){if(this.isCompatibleChainId(eo)){const to=this.parseChainId(eo);this.chainId=to,this.switchEthereumChain(to)}}parseAccountId(eo){const[to,ro,no]=eo.split(":");return{chainId:`${to}:${ro}`,address:no}}setAccounts(eo){this.accounts=eo.filter(to=>this.parseChainId(this.parseAccountId(to).chainId)===this.chainId).map(to=>this.parseAccountId(to).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(eo){var to,ro;const no=(to=eo==null?void 0:eo.chains)!=null?to:[],io=(ro=eo==null?void 0:eo.optionalChains)!=null?ro:[],oo=no.concat(io);if(!oo.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const ao=no.length?(eo==null?void 0:eo.methods)||u$4:[],so=no.length?(eo==null?void 0:eo.events)||m$3:[],co=(eo==null?void 0:eo.optionalMethods)||[],lo=(eo==null?void 0:eo.optionalEvents)||[],uo=(eo==null?void 0:eo.rpcMap)||this.buildRpcMap(oo,eo.projectId),ho=(eo==null?void 0:eo.qrModalOptions)||void 0;return{chains:no==null?void 0:no.map(go=>this.formatChainId(go)),optionalChains:io.map(go=>this.formatChainId(go)),methods:ao,events:so,optionalMethods:co,optionalEvents:lo,rpcMap:uo,showQrModal:!!(eo!=null&&eo.showQrModal),qrModalOptions:ho,projectId:eo.projectId,metadata:eo.metadata}}buildRpcMap(eo,to){const ro={};return eo.forEach(no=>{ro[no]=this.getRpcUrl(no,to)}),ro}async initialize(eo){if(this.rpc=this.getRpcConfig(eo),this.chainId=this.rpc.chains.length?g$5(this.rpc.chains):g$5(this.rpc.optionalChains),this.signer=await hv.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:eo.disableProviderPing,relayUrl:eo.relayUrl,storageOptions:eo.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let to;try{const{WalletConnectModal:ro}=await __vitePreload(()=>import("./index-BobdBaP6.js").then(no=>no.i),[]);to=ro}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(to)try{this.modal=new to(p$3({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(ro){throw this.signer.logger.error(ro),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(eo){if(!eo)return;const{chains:to,optionalChains:ro,rpcMap:no}=eo;to&&k$4(to)&&(this.rpc.chains=to.map(io=>this.formatChainId(io)),to.forEach(io=>{this.rpc.rpcMap[io]=(no==null?void 0:no[io])||this.getRpcUrl(io)})),ro&&k$4(ro)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=ro==null?void 0:ro.map(io=>this.formatChainId(io)),ro.forEach(io=>{this.rpc.rpcMap[io]=(no==null?void 0:no[io])||this.getRpcUrl(io)}))}getRpcUrl(eo,to){var ro;return((ro=this.rpc.rpcMap)==null?void 0:ro[eo])||`${j$6}?chainId=eip155:${eo}&projectId=${to||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const eo=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),to=this.session.namespaces[`${this.namespace}:${eo}`]?this.session.namespaces[`${this.namespace}:${eo}`]:this.session.namespaces[this.namespace];this.setChainIds(eo?[this.formatChainId(eo)]:to==null?void 0:to.accounts),this.setAccounts(to==null?void 0:to.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(eo){return typeof eo=="string"||eo instanceof String?[this.parseAccount(eo)]:eo.map(to=>this.parseAccount(to))}};const parseIntSafe=(Xr,eo=10)=>{try{const to=parseInt(String(Xr),eo);if(isNaN(to)){logger$9.error(`Error parsing ${Xr}`);return}return to}catch(to){logger$9.error(`Error parsing ${Xr} to int: ${to}`)}},activeAccountKey=Xr=>`dynamic-wc2-active-account-${Xr}`,sessionTopicKey=Xr=>`dynamic-wc2-session-topic-${Xr}`,swicthedNetworkKey=Xr=>`dynamic-wc2-switched-network-${Xr}`,currentChainKey=Xr=>`dynamic-wc2-current-chain-${Xr}`,ee$2=new EventEmitter$3;class WalletConnect extends EthereumWalletConnector{constructor(eo){var to;super(eo),this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.isInitialized=!1,this.canConnectViaQrCode=!0,this.isWalletConnect=!0,this.preferredChains=[],this._hasSwitchedNetwork=!1,this.sessionEventHandler=()=>{},this.sessionDeleteHandler=()=>{},this.name=eo.walletName,this.projectId=eo.projectId,this.deepLinkPreference=eo.deepLinkPreference||"native",this.preferredChains=eo.walletConnectPreferredChains||[],this.hasSwitchedNetwork=(to=!!localStorage.getItem(this.swicthedNetworkKey))!==null&&to!==void 0?to:!1;const ro=localStorage.getItem(this.currentChainKey);this.currentChainId=ro?parseIntSafe(ro):void 0}getMappedChains(){return this.evmNetworks.filter(eo=>eo.chainId!==11297108109).map(eo=>`eip155:${eo.chainId}`)}getMappedChainsByPreferredOrder(){const eo=this.getMappedChains(),to=this.preferredChains.filter(no=>eo.includes(no)),ro=eo.filter(no=>!this.preferredChains.includes(no));return[...to,...ro].map(no=>Number(no.split(":")[1]))}initConnection(){return __awaiter$a(this,void 0,void 0,function*(){const{provider:eo}=WalletConnect;if(!eo)throw new DynamicError("No provider found (init connection)");eo!=null&&eo.signer.uri||eo.connect().catch(to=>{logger$9.error(to),ee$2.emit("walletconnect_connection_failed",to)})})}createProvider(){return __awaiter$a(this,void 0,void 0,function*(){return v$3.init({events:["chainChanged","accountsChanged"],methods:[],optionalChains:this.getMappedChainsByPreferredOrder(),optionalMethods:["eth_chainId","eth_signTypedData","eth_signTransaction","eth_sign","personal_sign","eth_sendTransaction","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],projectId:this.projectId,rpcMap:this.evmNetworkRpcMap(),showQrModal:!1})})}getWalletClientFromInitializedProvider(){return __awaiter$a(this,void 0,void 0,function*(){const eo=this.createProvider();return createWalletClient({account:this.getActiveAccount(),transport:custom$1(yield eo)})})}createInitProviderPromise(){return __awaiter$a(this,void 0,void 0,function*(){WalletConnect.provider=yield this.createProvider(),this.teardownEventListeners(),this.setupEventListeners()})}initProvider(){return __awaiter$a(this,void 0,void 0,function*(){const{provider:eo}=WalletConnect;eo||(this.initializePromise===void 0&&(this.initializePromise=this.createInitProviderPromise()),yield this.initializePromise)})}refreshSession(){var eo,to,ro,no,io;!((to=(eo=WalletConnect.provider)===null||eo===void 0?void 0:eo.session)===null||to===void 0)&&to.topic&&localStorage.getItem(this.sessionTopicKey)===((no=(ro=WalletConnect.provider)===null||ro===void 0?void 0:ro.session)===null||no===void 0?void 0:no.topic)&&(this.session=WalletConnect.provider.session,this.setActiveAccount((io=localStorage.getItem(this.activeAccountKey))!==null&&io!==void 0?io:void 0))}init(){return __awaiter$a(this,void 0,void 0,function*(){yield this.initProvider(),yield this.initConnection(),this.isInitialized=!0})}get sessionTopicKey(){return sessionTopicKey(this.key)}get activeAccountKey(){return activeAccountKey(this.key)}get swicthedNetworkKey(){return swicthedNetworkKey(this.key)}get currentChainKey(){return currentChainKey(this.key)}set currentChainId(eo){this._currentChainId=eo,eo?localStorage.setItem(this.currentChainKey,eo.toString()):localStorage.removeItem(this.currentChainKey)}get currentChainId(){return this._currentChainId}set hasSwitchedNetwork(eo){this._hasSwitchedNetwork=eo,eo?localStorage.setItem(this.swicthedNetworkKey,eo.toString()):localStorage.removeItem(this.swicthedNetworkKey)}get hasSwitchedNetwork(){return this._hasSwitchedNetwork}supportsNetworkSwitching(){return!0}setupEventListeners(){WalletConnect.provider&&(this.sessionEventHandler=({params:eo})=>{if(logger$9.debug("session_event was called",{params:eo}),!eo||!eo.event){logger$9.debug("session_event was called without params or params.event");return}const{name:to,data:ro}=eo.event;if(to==="chainChanged"){const no=parseIntSafe(ro);if(no===this.currentChainId){logger$9.debug(`ignoring chainChanged event with same chain id as current chain id: ${no}`);return}if(no===void 0){logger$9.debug(`received unexpected data for chainChanged: ${ro} with type ${typeof ro}}`);return}this.currentChainId=no,this.emit("chainChange",{chain:String(no)}),this.hasSwitchedNetwork=!0,this.switchNetwork({networkChainId:no})}else if(to==="accountsChanged"){if(!Array.isArray(ro)){logger$9.debug(`received unexpected data for accountsChanged: ${ro} with type ${typeof ro}}`);return}const no=ro[0].split(":")[2];this.setWCActiveAccount(no)}},WalletConnect.provider.on("session_event",this.sessionEventHandler),this.sessionDeleteHandler=()=>__awaiter$a(this,void 0,void 0,function*(){this.endSession(),this.emit("disconnect")}),WalletConnect.provider.on("session_delete",this.sessionDeleteHandler))}teardownEventListeners(){WalletConnect.provider&&(WalletConnect.provider.off("session_event",this.sessionEventHandler),WalletConnect.provider.off("session_delete",this.sessionDeleteHandler))}getWalletClient(eo){if(WalletConnect.provider)return createWalletClient({account:this.getActiveAccount(),chain:chainsMap[eo??String(this.currentChainId)],transport:custom$1(WalletConnect.provider)})}getAddress(eo){return __awaiter$a(this,void 0,void 0,function*(){var to,ro;const no=this.getActiveAccount();if(no!=null&&no.address)return no.address;if((!WalletConnect.provider||!(!((to=WalletConnect.provider)===null||to===void 0)&&to.signer.uri))&&(logger$9.debug("No WC2 provider found, re-initializing..."),yield this.endSession(),yield this.init(),yield sleep$1(1e3),!WalletConnect.provider||!(!((ro=WalletConnect.provider)===null||ro===void 0)&&ro.signer.uri)))throw logger$9.debug("No WC2 provider found, escaping and throwing error"),new DynamicError("No provider found");const io=getWalletBookWallet(this.walletBook,this.key,this.walletFallback);return performPlatformSpecificConnectionMethod(WalletConnect.provider.signer.uri,io,{onDesktopUri:eo==null?void 0:eo.onDesktopUri,onDisplayUri:eo==null?void 0:eo.onDisplayUri},this.deepLinkPreference),new Promise((oo,ao)=>{if(!WalletConnect.provider){ao(new DynamicError("No provider found"));return}const so=()=>{const uo=new DynamicError("Connection rejected. Please try again.");uo.code="connection_rejected",WalletConnect.provider&&(WalletConnect.provider.signer.uri=void 0,this.init()),ao(uo),lo()},co=()=>{var uo;const ho=(uo=WalletConnect.provider)===null||uo===void 0?void 0:uo.session;if(!ho){ao(new DynamicError("No session found"));return}this.setSession(ho),this.setWCActiveAccount(ho.namespaces.eip155.accounts[0].split(":")[2]),this.getNetwork().then(go=>{var bo;this.currentChainId=go,oo((bo=this.getActiveAccount())===null||bo===void 0?void 0:bo.address)}),lo()},lo=()=>{var uo;ee$2.off("walletconnect_connection_failed",so),(uo=WalletConnect.provider)===null||uo===void 0||uo.off("connect",co)};ee$2.on("walletconnect_connection_failed",so),WalletConnect.provider.on("connect",co)})})}waitForSignMessage(eo,to){return __awaiter$a(this,void 0,void 0,function*(){const no=yield new Promise((io,oo)=>{this.on("chainChange",()=>io({success:!1})),eo(to).then(ao=>io({signedMessage:ao,success:!0})).catch(oo)});return no.success===!1?eo(to):no.signedMessage})}getDeepLink(){var eo;if(!this.session)return;const to=getWalletBookWallet(this.walletBook,this.key),ro=getDeepLink({metadata:to,mode:"regular",preference:this.deepLinkPreference,uri:(eo=WalletConnect.provider)===null||eo===void 0?void 0:eo.signer.uri});if(ro)return`${ro}?sessionTopic=${this.session.topic}`}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){if(!this.session)throw new DynamicError("no session");const to=this.getDeepLink();isMobile$1()&&to&&(window.location.href=to);const ro=io=>__awaiter$a(this,void 0,void 0,function*(){const oo=this.getActiveAccount();return oo?(yield this.getWalletClientFromInitializedProvider()).signMessage({account:oo,message:io}):void 0});return yield this.waitForSignMessage(ro,eo)})}clearActiveAccount(){localStorage.removeItem(this.activeAccountKey),this.setActiveAccount(void 0)}clearSession(){localStorage.removeItem(this.sessionTopicKey),this.session=void 0}setWCActiveAccount(eo){localStorage.setItem(this.activeAccountKey,eo),this.setActiveAccount(eo),this.emit("accountChange",{accounts:[eo]})}setSession(eo){localStorage.setItem(this.sessionTopicKey,eo.topic),this.session=eo}endSession(){return __awaiter$a(this,void 0,void 0,function*(){var eo;if(this.clearActiveAccount(),this.clearSession(),this.hasSwitchedNetwork=!1,this.currentChainId=void 0,!!(!((eo=WalletConnect.provider)===null||eo===void 0)&&eo.session))try{yield WalletConnect.provider.disconnect(),WalletConnect.provider=void 0}catch(to){logger$9.debug(to)}})}getNetwork(){const eo=Object.create(null,{getNetwork:{get:()=>super.getNetwork}});return __awaiter$a(this,void 0,void 0,function*(){return this.currentChainId?this.currentChainId:(yield this.initProvider(),eo.getNetwork.call(this))})}providerSwitchNetwork(eo){const to=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$a(this,arguments,void 0,function*({network:ro}){const no=yield this.getSupportedNetworks();if(!(no!=null&&no.includes(ro.chainId.toString()))){const ao=new DynamicError("Network switching is not available at this time. The user should manually switch network in their wallet");throw ao.code="network_switching_only_available_in_wallet",ao}const io=yield this.getNetwork();if(io&&io===ro.chainId)return;if(this.switchNetworkOnlyFromWallet)throw new DynamicError("Network switching is only supported through the wallet");if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching not supported");const oo=yield this.getWalletClientFromInitializedProvider();if(this.isMetaMask()){const ao=this.getDeepLink();ao&&(window.location.href=ao)}yield to.providerSwitchNetwork.call(this,{network:ro,provider:oo}),this.currentChainId=ro.chainId,this.hasSwitchedNetwork=!0,this.emit("chainChange",{chain:String(ro.chainId)})})}getConnectedAccounts(){return __awaiter$a(this,void 0,void 0,function*(){this.isInitialized===!1&&(yield this.initProvider(),this.refreshSession(),this.isInitialized=!0);const eo=this.getActiveAccount();return eo!=null&&eo.address?[eo.address]:[]})}isMetaMask(){var eo,to,ro,no,io;return(io=(no=(ro=(to=(eo=this.session)===null||eo===void 0?void 0:eo.peer)===null||to===void 0?void 0:to.metadata)===null||ro===void 0?void 0:ro.name)===null||no===void 0?void 0:no.toLowerCase().startsWith("metamask"))!==null&&io!==void 0?io:!1}getSupportedNetworks(){return __awaiter$a(this,void 0,void 0,function*(){var eo;if(yield this.initProvider(),this.refreshSession(),this.isMetaMask())return this.hasSwitchedNetwork?[String(this.currentChainId)]:this.evmNetworks.map(ro=>ro.chainId.toString());if(!this.session)return[];const to=[];return Object.keys(this.session.namespaces).forEach(ro=>{ro.startsWith("eip155:")&&to.push(ro.split(":")[1])}),(eo=this.session.namespaces.eip155)===null||eo===void 0||eo.accounts.forEach(ro=>to.push(ro.split(":")[1])),to.length?to:this.evmNetworks.map(ro=>ro.chainId.toString())})}}let InjectedWalletBase$1=class extends EthereumWalletConnector{constructor(){super(...arguments),this.supportedChains=["ETH","EVM"],this.connectedChain="EVM",this.walletConnectorFallback=!1}getEthProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.ethProviderHelper&&(this.ethProviderHelper=new EthProviderHelper(this.wallet,this)),this.ethProviderHelper}getMobileOrInstalledWallet(){var eo,to;return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.isInstalledOnBrowser()?this:!((to=(eo=this.wallet)===null||eo===void 0?void 0:eo.mobile)===null||to===void 0)&&to.inAppBrowser&&this.mobileExperience==="in-app-browser"&&isMobile$1()?this:this.walletConnectorFallback?new WalletConnect(Object.assign(Object.assign({},this.constructorProps),{walletName:this.name})):this}findProvider(){const eo=this.getEthProviderHelper();if(eo)return eo.getInstalledProvider()}setupEventListeners(){if(!this.getWalletClient())return;const to=this.getEthProviderHelper();if(!to)return;const{tearDownEventListeners:ro}=to._setupEventListeners(this);this.teardownEventListeners=ro}getWalletClient(eo){var to;return(to=this.getEthProviderHelper())===null||to===void 0?void 0:to.findWalletClient(eo)}isInstalledOnBrowser(){var eo;return((eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.findProvider())!==void 0}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){var eo;return(eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.getAddress()})}connect(){return __awaiter$a(this,void 0,void 0,function*(){yield this.getAddress()})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){var to;return(to=this.getEthProviderHelper())===null||to===void 0?void 0:to.signMessage(eo)})}proveOwnership(eo,to){return __awaiter$a(this,void 0,void 0,function*(){return yield this.validateActiveWallet(eo),this.signMessage(to)})}endSession(){return __awaiter$a(this,void 0,void 0,function*(){})}providerSwitchNetwork(eo){const to=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$a(this,arguments,void 0,function*({network:ro,provider:no}){return to.providerSwitchNetwork.call(this,{network:ro,provider:no})})}};class PhantomEvm extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantomevm",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$a(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var eo,to;return!!(!((to=(eo=this.getEthProviderHelper())===null||eo===void 0?void 0:eo.findProvider())===null||to===void 0)&&to.selectedAddress)}}class ExodusEvm extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="ExodusEvm",this.overrideKey="exodusevm",this.walletConnectorFallback=!0,this.wallet=findWalletBookWallet(this.walletBook,this.key)}}let UnknownInjected$1=class extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}};class FallbackEvmConnector extends InjectedWalletBase$1{constructor(eo){super(eo),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const injectedWalletOverrides$1=[PhantomEvm,ExodusEvm],filteredInjectedWalletKeysOverrides$1=["phantomevm","coinbase","exodusevm"],fetchInjectedWalletConnector=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;return((no=ro.injectedConfig)===null||no===void 0?void 0:no.find(io=>io.chain==="evm"))&&!filteredInjectedWalletKeysOverrides$1.includes(to)}).map(([to,ro])=>{const{shortName:no}=ro,io=no||ro.name,oo=!!ro.walletConnect;return class extends InjectedWalletBase$1{constructor(ao){super(Object.assign({},ao)),this.name=io,this.wallet=ro,this.walletConnectorFallback=oo,this.overrideKey=to}getAddress(){const ao=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$a(this,void 0,void 0,function*(){var so;if(this.isInstalledOnBrowser())return ao.getAddress.call(this);const co=(so=this.wallet.mobile)===null||so===void 0?void 0:so.inAppBrowser;if(!co){const lo=new Error(`No inAppBrowserBase found for ${this.name}.`);throw logger$9.error(lo.message),lo}window.location.href=`${co}/${window.location.href}`})}}})},fetchWalletConnectWallets=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([,to])=>to.walletConnect&&!to.filterFromWalletConnect).map(([to,ro])=>{const{shortName:no}=ro,io=no||ro.name;return class extends WalletConnect{constructor(oo){super(Object.assign(Object.assign({},oo),{walletName:io})),this.overrideKey=to}}})},getWalletConnectConnector=()=>class extends WalletConnect{constructor(Xr){super(Object.assign(Object.assign({},Xr),{walletName:"WalletConnect"}))}};var dist={},CoinbaseWalletSDK$1={},walletLogo$1={};Object.defineProperty(walletLogo$1,"__esModule",{value:!0});walletLogo$1.walletLogo=void 0;const walletLogo=(Xr,eo)=>{let to;switch(Xr){case"standard":return to=eo,`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return to=eo,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${eo}' height='${to}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return to=(.1*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return to=(.25*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return to=(.1*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return to=(.25*eo).toFixed(2),`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return to=eo,`data:image/svg+xml,%3Csvg width='${eo}' height='${to}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};walletLogo$1.walletLogo=walletLogo;var CoinbaseWalletProvider$1={};const require$$0$2=getAugmentedNamespace(eventemitter3$1);var error$2={},constants$5={};Object.defineProperty(constants$5,"__esModule",{value:!0});constants$5.errorValues=constants$5.standardErrorCodes=void 0;constants$5.standardErrorCodes={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,unsupportedChain:4902}};constants$5.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var errors$1={},utils$2={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.serialize=Xr.getErrorCode=Xr.isValidCode=Xr.getMessageFromCode=Xr.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const eo=constants$5,to="Unspecified error message.";Xr.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function ro(ho,go=to){if(ho&&Number.isInteger(ho)){const bo=ho.toString();if(lo(eo.errorValues,bo))return eo.errorValues[bo].message;if(so(ho))return Xr.JSON_RPC_SERVER_ERROR_MESSAGE}return go}Xr.getMessageFromCode=ro;function no(ho){if(!Number.isInteger(ho))return!1;const go=ho.toString();return!!(eo.errorValues[go]||so(ho))}Xr.isValidCode=no;function io(ho){var go;if(typeof ho=="number")return ho;if(oo(ho))return(go=ho.code)!==null&&go!==void 0?go:ho.errorCode}Xr.getErrorCode=io;function oo(ho){return typeof ho=="object"&&ho!==null&&(typeof ho.code=="number"||typeof ho.errorCode=="number")}function ao(ho,{shouldIncludeStack:go=!1}={}){const bo={};if(ho&&typeof ho=="object"&&!Array.isArray(ho)&&lo(ho,"code")&&no(ho.code)){const wo=ho;bo.code=wo.code,wo.message&&typeof wo.message=="string"?(bo.message=wo.message,lo(wo,"data")&&(bo.data=wo.data)):(bo.message=ro(bo.code),bo.data={originalError:co(ho)})}else bo.code=eo.standardErrorCodes.rpc.internal,bo.message=uo(ho,"message")?ho.message:to,bo.data={originalError:co(ho)};return go&&(bo.stack=uo(ho,"stack")?ho.stack:void 0),bo}Xr.serialize=ao;function so(ho){return ho>=-32099&&ho<=-32e3}function co(ho){return ho&&typeof ho=="object"&&!Array.isArray(ho)?Object.assign({},ho):ho}function lo(ho,go){return Object.prototype.hasOwnProperty.call(ho,go)}function uo(ho,go){return typeof ho=="object"&&ho!==null&&go in ho&&typeof ho[go]=="string"}})(utils$2);Object.defineProperty(errors$1,"__esModule",{value:!0});errors$1.standardErrors=void 0;const constants_1$6=constants$5,utils_1$1=utils$2;errors$1.standardErrors={rpc:{parse:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.parse,Xr),invalidRequest:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidRequest,Xr),invalidParams:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidParams,Xr),methodNotFound:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotFound,Xr),internal:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.internal,Xr),server:Xr=>{if(!Xr||typeof Xr!="object"||Array.isArray(Xr))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:eo}=Xr;if(!Number.isInteger(eo)||eo>-32005||eo<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return getEthJsonRpcError(eo,Xr)},invalidInput:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidInput,Xr),resourceNotFound:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceNotFound,Xr),resourceUnavailable:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceUnavailable,Xr),transactionRejected:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.transactionRejected,Xr),methodNotSupported:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotSupported,Xr),limitExceeded:Xr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.limitExceeded,Xr)},provider:{userRejectedRequest:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.userRejectedRequest,Xr),unauthorized:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unauthorized,Xr),unsupportedMethod:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedMethod,Xr),disconnected:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.disconnected,Xr),chainDisconnected:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.chainDisconnected,Xr),unsupportedChain:Xr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedChain,Xr),custom:Xr=>{if(!Xr||typeof Xr!="object"||Array.isArray(Xr))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:eo,message:to,data:ro}=Xr;if(!to||typeof to!="string")throw new Error('"message" must be a nonempty string');return new EthereumProviderError(eo,to,ro)}}};function getEthJsonRpcError(Xr,eo){const[to,ro]=parseOpts(eo);return new EthereumRpcError(Xr,to||(0,utils_1$1.getMessageFromCode)(Xr),ro)}function getEthProviderError(Xr,eo){const[to,ro]=parseOpts(eo);return new EthereumProviderError(Xr,to||(0,utils_1$1.getMessageFromCode)(Xr),ro)}function parseOpts(Xr){if(Xr){if(typeof Xr=="string")return[Xr];if(typeof Xr=="object"&&!Array.isArray(Xr)){const{message:eo,data:to}=Xr;if(eo&&typeof eo!="string")throw new Error("Must specify string message.");return[eo||void 0,to]}}return[]}class EthereumRpcError extends Error{constructor(eo,to,ro){if(!Number.isInteger(eo))throw new Error('"code" must be an integer.');if(!to||typeof to!="string")throw new Error('"message" must be a nonempty string.');super(to),this.code=eo,ro!==void 0&&(this.data=ro)}}class EthereumProviderError extends EthereumRpcError{constructor(eo,to,ro){if(!isValidEthProviderCode(eo))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(eo,to,ro)}}function isValidEthProviderCode(Xr){return Number.isInteger(Xr)&&Xr>=1e3&&Xr<=4999}(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.standardErrors=Xr.standardErrorCodes=void 0;var eo=constants$5;Object.defineProperty(Xr,"standardErrorCodes",{enumerable:!0,get:function(){return eo.standardErrorCodes}});var to=errors$1;Object.defineProperty(Xr,"standardErrors",{enumerable:!0,get:function(){return to.standardErrors}})})(error$2);var serialize$1={},Web3Response={};Object.defineProperty(Web3Response,"__esModule",{value:!0});Web3Response.isErrorResponse=void 0;function isErrorResponse(Xr){return Xr.errorMessage!==void 0}Web3Response.isErrorResponse=isErrorResponse;var version$b={};Object.defineProperty(version$b,"__esModule",{value:!0});version$b.LIB_VERSION=void 0;version$b.LIB_VERSION="4.0.4";Object.defineProperty(serialize$1,"__esModule",{value:!0});serialize$1.serializeError=void 0;const Web3Response_1$2=Web3Response,version_1$3=version$b,constants_1$5=constants$5,utils_1=utils$2;function serializeError(Xr,eo){const to=(0,utils_1.serialize)(getErrorObject(Xr),{shouldIncludeStack:!0}),ro=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");ro.searchParams.set("version",version_1$3.LIB_VERSION),ro.searchParams.set("code",to.code.toString());const no=getMethod(to.data,eo);return no&&ro.searchParams.set("method",no),ro.searchParams.set("message",to.message),Object.assign(Object.assign({},to),{docUrl:ro.href})}serialize$1.serializeError=serializeError;function getErrorObject(Xr){return typeof Xr=="string"?{message:Xr,code:constants_1$5.standardErrorCodes.rpc.internal}:(0,Web3Response_1$2.isErrorResponse)(Xr)?Object.assign(Object.assign({},Xr),{message:Xr.errorMessage,code:Xr.errorCode,data:{method:Xr.method}}):Xr}function getMethod(Xr,eo){const to=Xr==null?void 0:Xr.method;if(to)return to;if(eo!==void 0){if(typeof eo=="string")return eo;if(Array.isArray(eo)){if(eo.length>0)return eo[0].method}else return eo.method}}var type$3={};Object.defineProperty(type$3,"__esModule",{value:!0});type$3.RegExpString=type$3.IntNumber=type$3.BigIntString=type$3.AddressString=type$3.HexString=type$3.OpaqueType=void 0;function OpaqueType(){return Xr=>Xr}type$3.OpaqueType=OpaqueType;type$3.HexString=OpaqueType();type$3.AddressString=OpaqueType();type$3.BigIntString=OpaqueType();function IntNumber(Xr){return Math.floor(Xr)}type$3.IntNumber=IntNumber;type$3.RegExpString=OpaqueType();var util$6={};Object.defineProperty(util$6,"__esModule",{value:!0});util$6.areAddressArraysEqual=util$6.getFavicon=util$6.range=util$6.isBigNumber=util$6.ensureParsedJSONObject=util$6.ensureBigInt=util$6.ensureRegExpString=util$6.ensureIntNumber=util$6.ensureBuffer=util$6.ensureAddressString=util$6.ensureEvenLengthHexString=util$6.ensureHexString=util$6.isHexString=util$6.prepend0x=util$6.strip0x=util$6.has0xPrefix=util$6.hexStringFromIntNumber=util$6.intNumberFromHexString=util$6.bigIntStringFromBigInt=util$6.hexStringFromBuffer=util$6.hexStringToUint8Array=util$6.uint8ArrayToHex=util$6.randomBytesHex=void 0;const error_1$8=error$2,_1=type$3,INT_STRING_REGEX=/^[0-9]*$/,HEXADECIMAL_STRING_REGEX=/^[a-f0-9]*$/;function randomBytesHex(Xr){return uint8ArrayToHex(crypto.getRandomValues(new Uint8Array(Xr)))}util$6.randomBytesHex=randomBytesHex;function uint8ArrayToHex(Xr){return[...Xr].map(eo=>eo.toString(16).padStart(2,"0")).join("")}util$6.uint8ArrayToHex=uint8ArrayToHex;function hexStringToUint8Array(Xr){return new Uint8Array(Xr.match(/.{1,2}/g).map(eo=>parseInt(eo,16)))}util$6.hexStringToUint8Array=hexStringToUint8Array;function hexStringFromBuffer(Xr,eo=!1){const to=Xr.toString("hex");return(0,_1.HexString)(eo?`0x${to}`:to)}util$6.hexStringFromBuffer=hexStringFromBuffer;function bigIntStringFromBigInt(Xr){return(0,_1.BigIntString)(Xr.toString(10))}util$6.bigIntStringFromBigInt=bigIntStringFromBigInt;function intNumberFromHexString(Xr){return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(Xr,!0))))}util$6.intNumberFromHexString=intNumberFromHexString;function hexStringFromIntNumber(Xr){return(0,_1.HexString)(`0x${BigInt(Xr).toString(16)}`)}util$6.hexStringFromIntNumber=hexStringFromIntNumber;function has0xPrefix(Xr){return Xr.startsWith("0x")||Xr.startsWith("0X")}util$6.has0xPrefix=has0xPrefix;function strip0x$1(Xr){return has0xPrefix(Xr)?Xr.slice(2):Xr}util$6.strip0x=strip0x$1;function prepend0x(Xr){return has0xPrefix(Xr)?`0x${Xr.slice(2)}`:`0x${Xr}`}util$6.prepend0x=prepend0x;function isHexString$1(Xr){if(typeof Xr!="string")return!1;const eo=strip0x$1(Xr).toLowerCase();return HEXADECIMAL_STRING_REGEX.test(eo)}util$6.isHexString=isHexString$1;function ensureHexString(Xr,eo=!1){if(typeof Xr=="string"){const to=strip0x$1(Xr).toLowerCase();if(HEXADECIMAL_STRING_REGEX.test(to))return(0,_1.HexString)(eo?`0x${to}`:to)}throw error_1$8.standardErrors.rpc.invalidParams(`"${String(Xr)}" is not a hexadecimal string`)}util$6.ensureHexString=ensureHexString;function ensureEvenLengthHexString(Xr,eo=!1){let to=ensureHexString(Xr,!1);return to.length%2===1&&(to=(0,_1.HexString)(`0${to}`)),eo?(0,_1.HexString)(`0x${to}`):to}util$6.ensureEvenLengthHexString=ensureEvenLengthHexString;function ensureAddressString(Xr){if(typeof Xr=="string"){const eo=strip0x$1(Xr).toLowerCase();if(isHexString$1(eo)&&eo.length===40)return(0,_1.AddressString)(prepend0x(eo))}throw error_1$8.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(Xr)}`)}util$6.ensureAddressString=ensureAddressString;function ensureBuffer(Xr){if(Buffer$3.isBuffer(Xr))return Xr;if(typeof Xr=="string"){if(isHexString$1(Xr)){const eo=ensureEvenLengthHexString(Xr,!1);return Buffer$3.from(eo,"hex")}return Buffer$3.from(Xr,"utf8")}throw error_1$8.standardErrors.rpc.invalidParams(`Not binary data: ${String(Xr)}`)}util$6.ensureBuffer=ensureBuffer;function ensureIntNumber(Xr){if(typeof Xr=="number"&&Number.isInteger(Xr))return(0,_1.IntNumber)(Xr);if(typeof Xr=="string"){if(INT_STRING_REGEX.test(Xr))return(0,_1.IntNumber)(Number(Xr));if(isHexString$1(Xr))return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(Xr,!0))))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(Xr)}`)}util$6.ensureIntNumber=ensureIntNumber;function ensureRegExpString(Xr){if(Xr instanceof RegExp)return(0,_1.RegExpString)(Xr.toString());throw error_1$8.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(Xr)}`)}util$6.ensureRegExpString=ensureRegExpString;function ensureBigInt(Xr){if(Xr!==null&&(typeof Xr=="bigint"||isBigNumber(Xr)))return BigInt(Xr.toString(10));if(typeof Xr=="number")return BigInt(ensureIntNumber(Xr));if(typeof Xr=="string"){if(INT_STRING_REGEX.test(Xr))return BigInt(Xr);if(isHexString$1(Xr))return BigInt(ensureEvenLengthHexString(Xr,!0))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(Xr)}`)}util$6.ensureBigInt=ensureBigInt;function ensureParsedJSONObject(Xr){if(typeof Xr=="string")return JSON.parse(Xr);if(typeof Xr=="object")return Xr;throw error_1$8.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(Xr)}`)}util$6.ensureParsedJSONObject=ensureParsedJSONObject;function isBigNumber(Xr){if(Xr==null||typeof Xr.constructor!="function")return!1;const{constructor:eo}=Xr;return typeof eo.config=="function"&&typeof eo.EUCLID=="number"}util$6.isBigNumber=isBigNumber;function range(Xr,eo){return Array.from({length:eo-Xr},(to,ro)=>Xr+ro)}util$6.range=range;function getFavicon(){const Xr=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:eo,host:to}=document.location,ro=Xr?Xr.getAttribute("href"):null;return!ro||ro.startsWith("javascript:")||ro.startsWith("vbscript:")?null:ro.startsWith("http://")||ro.startsWith("https://")||ro.startsWith("data:")?ro:ro.startsWith("//")?eo+ro:`${eo}//${to}${ro}`}util$6.getFavicon=getFavicon;function areAddressArraysEqual(Xr,eo){return Xr.length===eo.length&&Xr.every((to,ro)=>to===eo[ro])}util$6.areAddressArraysEqual=areAddressArraysEqual;var util$5={},SCWSigner$1={},SCWKeyManager$1={},cipher={};Object.defineProperty(cipher,"__esModule",{value:!0});cipher.decryptContent=cipher.encryptContent=cipher.importKeyFromHexString=cipher.exportKeyToHexString=cipher.decrypt=cipher.encrypt=cipher.deriveSharedSecret=cipher.generateKeyPair=void 0;const util_1$b=util$6;async function generateKeyPair(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}cipher.generateKeyPair=generateKeyPair;async function deriveSharedSecret(Xr,eo){return crypto.subtle.deriveKey({name:"ECDH",public:eo},Xr,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}cipher.deriveSharedSecret=deriveSharedSecret;async function encrypt(Xr,eo){const to=crypto.getRandomValues(new Uint8Array(12)),ro=await crypto.subtle.encrypt({name:"AES-GCM",iv:to},Xr,new TextEncoder().encode(eo));return{iv:to,cipherText:ro}}cipher.encrypt=encrypt;async function decrypt(Xr,{iv:eo,cipherText:to}){const ro=await crypto.subtle.decrypt({name:"AES-GCM",iv:eo},Xr,to);return new TextDecoder().decode(ro)}cipher.decrypt=decrypt;function getFormat(Xr){switch(Xr){case"public":return"spki";case"private":return"pkcs8"}}async function exportKeyToHexString(Xr,eo){const to=getFormat(Xr),ro=await crypto.subtle.exportKey(to,eo);return(0,util_1$b.uint8ArrayToHex)(new Uint8Array(ro))}cipher.exportKeyToHexString=exportKeyToHexString;async function importKeyFromHexString(Xr,eo){const to=getFormat(Xr),ro=(0,util_1$b.hexStringToUint8Array)(eo).buffer;return await crypto.subtle.importKey(to,ro,{name:"ECDH",namedCurve:"P-256"},!0,Xr==="private"?["deriveKey"]:[])}cipher.importKeyFromHexString=importKeyFromHexString;async function encryptContent(Xr,eo){const to=JSON.stringify(Xr,(ro,no)=>{if(!(no instanceof Error))return no;const io=no;return Object.assign(Object.assign({},io.code?{code:io.code}:{}),{message:io.message})});return encrypt(eo,to)}cipher.encryptContent=encryptContent;async function decryptContent(Xr,eo){return JSON.parse(await decrypt(eo,Xr))}cipher.decryptContent=decryptContent;var ScopedLocalStorage$1={};Object.defineProperty(ScopedLocalStorage$1,"__esModule",{value:!0});ScopedLocalStorage$1.ScopedLocalStorage=void 0;class ScopedLocalStorage{constructor(eo,to){this.scope=eo,this.module=to}setItem(eo,to){localStorage.setItem(this.scopedKey(eo),to)}getItem(eo){return localStorage.getItem(this.scopedKey(eo))}removeItem(eo){localStorage.removeItem(this.scopedKey(eo))}clear(){const eo=this.scopedKey(""),to=[];for(let ro=0;rolocalStorage.removeItem(ro))}scopedKey(eo){return`-${this.scope}${this.module?`:${this.module}`:""}:${eo}`}static clearAll(){new ScopedLocalStorage("CBWSDK").clear(),new ScopedLocalStorage("walletlink").clear()}}ScopedLocalStorage$1.ScopedLocalStorage=ScopedLocalStorage;Object.defineProperty(SCWKeyManager$1,"__esModule",{value:!0});SCWKeyManager$1.SCWKeyManager=void 0;const cipher_1$1=cipher,ScopedLocalStorage_1$6=ScopedLocalStorage$1,OWN_PRIVATE_KEY={storageKey:"ownPrivateKey",keyType:"private"},OWN_PUBLIC_KEY={storageKey:"ownPublicKey",keyType:"public"},PEER_PUBLIC_KEY={storageKey:"peerPublicKey",keyType:"public"};class SCWKeyManager{constructor(){this.storage=new ScopedLocalStorage_1$6.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(eo){this.sharedSecret=null,this.peerPublicKey=eo,await this.storeKey(PEER_PUBLIC_KEY,eo),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(OWN_PUBLIC_KEY.storageKey),this.storage.removeItem(OWN_PRIVATE_KEY.storageKey),this.storage.removeItem(PEER_PUBLIC_KEY.storageKey)}async generateKeyPair(){const eo=await(0,cipher_1$1.generateKeyPair)();this.ownPrivateKey=eo.privateKey,this.ownPublicKey=eo.publicKey,await this.storeKey(OWN_PRIVATE_KEY,eo.privateKey),await this.storeKey(OWN_PUBLIC_KEY,eo.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(OWN_PRIVATE_KEY)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(OWN_PUBLIC_KEY)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(PEER_PUBLIC_KEY)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,cipher_1$1.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(eo){const to=this.storage.getItem(eo.storageKey);return to?(0,cipher_1$1.importKeyFromHexString)(eo.keyType,to):null}async storeKey(eo,to){const ro=await(0,cipher_1$1.exportKeyToHexString)(eo.keyType,to);this.storage.setItem(eo.storageKey,ro)}}SCWKeyManager$1.SCWKeyManager=SCWKeyManager;var SCWStateManager$1={};Object.defineProperty(SCWStateManager$1,"__esModule",{value:!0});SCWStateManager$1.SCWStateManager=void 0;const ScopedLocalStorage_1$5=ScopedLocalStorage$1,ACCOUNTS_KEY="accounts",ACTIVE_CHAIN_STORAGE_KEY="activeChain",AVAILABLE_CHAINS_STORAGE_KEY="availableChains",WALLET_CAPABILITIES_STORAGE_KEY="walletCapabilities";class SCWStateManager{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(eo){var to,ro;this.storage=new ScopedLocalStorage_1$5.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=eo.updateListener,this.availableChains=this.loadItemFromStorage(AVAILABLE_CHAINS_STORAGE_KEY),this._walletCapabilities=this.loadItemFromStorage(WALLET_CAPABILITIES_STORAGE_KEY);const no=this.loadItemFromStorage(ACCOUNTS_KEY),io=this.loadItemFromStorage(ACTIVE_CHAIN_STORAGE_KEY);no&&this.updateListener.onAccountsUpdate({accounts:no,source:"storage"}),io&&this.updateListener.onChainUpdate({chain:io,source:"storage"}),this._accounts=no||[],this._activeChain=io||{id:(ro=(to=eo.appChainIds)===null||to===void 0?void 0:to[0])!==null&&ro!==void 0?ro:1}}updateAccounts(eo){this._accounts=eo,this.storeItemToStorage(ACCOUNTS_KEY,eo),this.updateListener.onAccountsUpdate({accounts:eo,source:"wallet"})}switchChain(eo){var to;const ro=(to=this.availableChains)===null||to===void 0?void 0:to.find(no=>no.id===eo);return ro?(ro===this._activeChain||(this._activeChain=ro,this.storeItemToStorage(ACTIVE_CHAIN_STORAGE_KEY,ro),this.updateListener.onChainUpdate({chain:ro,source:"wallet"})),!0):!1}updateAvailableChains(eo){if(!eo||Object.keys(eo).length===0)return;const to=Object.entries(eo).map(([ro,no])=>({id:Number(ro),rpcUrl:no}));this.availableChains=to,this.storeItemToStorage(AVAILABLE_CHAINS_STORAGE_KEY,to),this.switchChain(this._activeChain.id)}updateWalletCapabilities(eo){this._walletCapabilities=eo,this.storeItemToStorage(WALLET_CAPABILITIES_STORAGE_KEY,eo)}storeItemToStorage(eo,to){this.storage.setItem(eo,JSON.stringify(to))}loadItemFromStorage(eo){const to=this.storage.getItem(eo);return to?JSON.parse(to):void 0}clear(){this.storage.clear()}}SCWStateManager$1.SCWStateManager=SCWStateManager;Object.defineProperty(SCWSigner$1,"__esModule",{value:!0});SCWSigner$1.SCWSigner=void 0;const SCWKeyManager_1=SCWKeyManager$1,SCWStateManager_1=SCWStateManager$1,error_1$7=error$2,util_1$a=util$6,cipher_1=cipher;class SCWSigner{constructor(eo){this.metadata=eo.metadata,this.communicator=eo.communicator,this.keyManager=new SCWKeyManager_1.SCWKeyManager,this.stateManager=new SCWStateManager_1.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:eo.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const eo=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),to=await this.communicator.postRequestAndWaitForResponse(eo);if("failure"in to.content)throw to.content.failure;const ro=await(0,cipher_1.importKeyFromHexString)("public",to.sender);await this.keyManager.setPeerPublicKey(ro);const no=await this.decryptResponseMessage(to);this.updateInternalState({method:"eth_requestAccounts"},no);const io=no.result;if("error"in io)throw io.error;return this.stateManager.accounts}async request(eo){const to=this.tryLocalHandling(eo);if(to!==void 0){if(to instanceof Error)throw to;return to}await this.communicator.waitForPopupLoaded();const ro=await this.sendEncryptedRequest(eo),no=await this.decryptResponseMessage(ro);this.updateInternalState(eo,no);const io=no.result;if("error"in io)throw io.error;return io.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(eo){var to;switch(eo.method){case"wallet_switchEthereumChain":{const ro=eo.params;if(!ro||!(!((to=ro[0])===null||to===void 0)&&to.chainId))throw error_1$7.standardErrors.rpc.invalidParams();const no=(0,util_1$a.ensureIntNumber)(ro[0].chainId);return this.stateManager.switchChain(no)?null:void 0}case"wallet_getCapabilities":{const ro=this.stateManager.walletCapabilities;if(!ro)throw error_1$7.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return ro}default:return}}async sendEncryptedRequest(eo){const to=await this.keyManager.getSharedSecret();if(!to)throw error_1$7.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const ro=await(0,cipher_1.encryptContent)({action:eo,chainId:this.stateManager.activeChain.id},to),no=await this.createRequestMessage({encrypted:ro});return this.communicator.postRequestAndWaitForResponse(no)}async createRequestMessage(eo){const to=await(0,cipher_1.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:to,content:eo,timestamp:new Date}}async decryptResponseMessage(eo){const to=eo.content;if("failure"in to)throw to.failure;const ro=await this.keyManager.getSharedSecret();if(!ro)throw error_1$7.standardErrors.provider.unauthorized("Invalid session");return(0,cipher_1.decryptContent)(to.encrypted,ro)}updateInternalState(eo,to){var ro,no;const io=(ro=to.data)===null||ro===void 0?void 0:ro.chains;io&&this.stateManager.updateAvailableChains(io);const oo=(no=to.data)===null||no===void 0?void 0:no.capabilities;oo&&this.stateManager.updateWalletCapabilities(oo);const ao=to.result;if(!("error"in ao))switch(eo.method){case"eth_requestAccounts":{const so=ao.value;this.stateManager.updateAccounts(so);break}case"wallet_switchEthereumChain":{if(ao.value!==null)return;const so=eo.params,co=(0,util_1$a.ensureIntNumber)(so[0].chainId);this.stateManager.switchChain(co);break}}}}SCWSigner$1.SCWSigner=SCWSigner;var WalletLinkSigner$1={};const{Transform:Transform$1}=requireReadableBrowser$1();var keccak$3=Xr=>class fC extends Transform$1{constructor(to,ro,no,io,oo){super(oo),this._rate=to,this._capacity=ro,this._delimitedSuffix=no,this._hashBitLength=io,this._options=oo,this._state=new Xr,this._state.initialize(to,ro),this._finalized=!1}_transform(to,ro,no){let io=null;try{this.update(to,ro)}catch(oo){io=oo}no(io)}_flush(to){let ro=null;try{this.push(this.digest())}catch(no){ro=no}to(ro)}update(to,ro){if(!Buffer$3.isBuffer(to)&&typeof to!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer$3.isBuffer(to)||(to=Buffer$3.from(to,ro)),this._state.absorb(to),this}digest(to){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let ro=this._state.squeeze(this._hashBitLength/8);return to!==void 0&&(ro=ro.toString(to)),this._resetState(),ro}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const to=new fC(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(to._state),to._finalized=this._finalized,to}};const{Transform}=requireReadableBrowser$1();var shake=Xr=>class hC extends Transform{constructor(to,ro,no,io){super(io),this._rate=to,this._capacity=ro,this._delimitedSuffix=no,this._options=io,this._state=new Xr,this._state.initialize(to,ro),this._finalized=!1}_transform(to,ro,no){let io=null;try{this.update(to,ro)}catch(oo){io=oo}no(io)}_flush(){}_read(to){this.push(this.squeeze(to))}update(to,ro){if(!Buffer$3.isBuffer(to)&&typeof to!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer$3.isBuffer(to)||(to=Buffer$3.from(to,ro)),this._state.absorb(to),this}squeeze(to,ro){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let no=this._state.squeeze(to);return ro!==void 0&&(no=no.toString(ro)),no}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const to=new hC(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(to._state),to._finalized=this._finalized,to}};const createKeccak=keccak$3,createShake=shake;var api=function(Xr){const eo=createKeccak(Xr),to=createShake(Xr);return function(ro,no){switch(typeof ro=="string"?ro.toLowerCase():ro){case"keccak224":return new eo(1152,448,null,224,no);case"keccak256":return new eo(1088,512,null,256,no);case"keccak384":return new eo(832,768,null,384,no);case"keccak512":return new eo(576,1024,null,512,no);case"sha3-224":return new eo(1152,448,6,224,no);case"sha3-256":return new eo(1088,512,6,256,no);case"sha3-384":return new eo(832,768,6,384,no);case"sha3-512":return new eo(576,1024,6,512,no);case"shake128":return new to(1344,256,31,no);case"shake256":return new to(1088,512,31,no);default:throw new Error("Invald algorithm: "+ro)}}},keccakStateUnroll={};const P1600_ROUND_CONSTANTS=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];keccakStateUnroll.p1600=function(Xr){for(let eo=0;eo<24;++eo){const to=Xr[0]^Xr[10]^Xr[20]^Xr[30]^Xr[40],ro=Xr[1]^Xr[11]^Xr[21]^Xr[31]^Xr[41],no=Xr[2]^Xr[12]^Xr[22]^Xr[32]^Xr[42],io=Xr[3]^Xr[13]^Xr[23]^Xr[33]^Xr[43],oo=Xr[4]^Xr[14]^Xr[24]^Xr[34]^Xr[44],ao=Xr[5]^Xr[15]^Xr[25]^Xr[35]^Xr[45],so=Xr[6]^Xr[16]^Xr[26]^Xr[36]^Xr[46],co=Xr[7]^Xr[17]^Xr[27]^Xr[37]^Xr[47],lo=Xr[8]^Xr[18]^Xr[28]^Xr[38]^Xr[48],uo=Xr[9]^Xr[19]^Xr[29]^Xr[39]^Xr[49];let ho=lo^(no<<1|io>>>31),go=uo^(io<<1|no>>>31);const bo=Xr[0]^ho,wo=Xr[1]^go,Eo=Xr[10]^ho,$o=Xr[11]^go,Co=Xr[20]^ho,Ro=Xr[21]^go,Oo=Xr[30]^ho,jo=Xr[31]^go,Bo=Xr[40]^ho,Mo=Xr[41]^go;ho=to^(oo<<1|ao>>>31),go=ro^(ao<<1|oo>>>31);const Fo=Xr[2]^ho,Wo=Xr[3]^go,Jo=Xr[12]^ho,Po=Xr[13]^go,fo=Xr[22]^ho,yo=Xr[23]^go,vo=Xr[32]^ho,_o=Xr[33]^go,So=Xr[42]^ho,To=Xr[43]^go;ho=no^(so<<1|co>>>31),go=io^(co<<1|so>>>31);const Ao=Xr[4]^ho,ko=Xr[5]^go,mo=Xr[14]^ho,Io=Xr[15]^go,Do=Xr[24]^ho,Lo=Xr[25]^go,Ho=Xr[34]^ho,Yo=Xr[35]^go,Xo=Xr[44]^ho,qo=Xr[45]^go;ho=oo^(lo<<1|uo>>>31),go=ao^(uo<<1|lo>>>31);const Ko=Xr[6]^ho,Qo=Xr[7]^go,zo=Xr[16]^ho,ga=Xr[17]^go,$a=Xr[26]^ho,Sl=Xr[27]^go,El=Xr[36]^ho,Tl=Xr[37]^go,Il=Xr[46]^ho,Zl=Xr[47]^go;ho=so^(to<<1|ro>>>31),go=co^(ro<<1|to>>>31);const Vl=Xr[8]^ho,Ol=Xr[9]^go,Dl=Xr[18]^ho,Fl=Xr[19]^go,Jl=Xr[28]^ho,cu=Xr[29]^go,Ll=Xr[38]^ho,Xl=Xr[39]^go,ku=Xr[48]^ho,iu=Xr[49]^go,hu=bo,Cu=wo,_l=$o<<4|Eo>>>28,Go=Eo<<4|$o>>>28,yl=Co<<3|Ro>>>29,Al=Ro<<3|Co>>>29,Ul=jo<<9|Oo>>>23,su=Oo<<9|jo>>>23,Ql=Bo<<18|Mo>>>14,vu=Mo<<18|Bo>>>14,qu=Fo<<1|Wo>>>31,pu=Wo<<1|Fo>>>31,xu=Po<<12|Jo>>>20,Au=Jo<<12|Po>>>20,yu=fo<<10|yo>>>22,wu=yo<<10|fo>>>22,Gu=_o<<13|vo>>>19,Ml=vo<<13|_o>>>19,Nl=So<<2|To>>>30,Yl=To<<2|So>>>30,Wl=ko<<30|Ao>>>2,eu=Ao<<30|ko>>>2,Su=mo<<6|Io>>>26,ru=Io<<6|mo>>>26,uu=Lo<<11|Do>>>21,xl=Do<<11|Lo>>>21,$l=Ho<<15|Yo>>>17,Cl=Yo<<15|Ho>>>17,Zo=qo<<29|Xo>>>3,Rl=Xo<<29|qo>>>3,Hl=Ko<<28|Qo>>>4,au=Qo<<28|Ko>>>4,tu=ga<<23|zo>>>9,lu=zo<<23|ga>>>9,Nu=$a<<25|Sl>>>7,Pu=Sl<<25|$a>>>7,ip=El<<21|Tl>>>11,Lu=Tl<<21|El>>>11,Yu=Zl<<24|Il>>>8,_d=Il<<24|Zl>>>8,Qu=Vl<<27|Ol>>>5,_f=Ol<<27|Vl>>>5,ep=Dl<<20|Fl>>>12,Xu=Fl<<20|Dl>>>12,_h=cu<<7|Jl>>>25,zu=Jl<<7|cu>>>25,Vu=Ll<<8|Xl>>>24,Fu=Xl<<8|Ll>>>24,Tu=ku<<14|iu>>>18,Ru=iu<<14|ku>>>18;Xr[0]=hu^~xu&uu,Xr[1]=Cu^~Au&xl,Xr[10]=Hl^~ep&yl,Xr[11]=au^~Xu&Al,Xr[20]=qu^~Su&Nu,Xr[21]=pu^~ru&Pu,Xr[30]=Qu^~_l&yu,Xr[31]=_f^~Go&wu,Xr[40]=Wl^~tu&_h,Xr[41]=eu^~lu&zu,Xr[2]=xu^~uu&ip,Xr[3]=Au^~xl&Lu,Xr[12]=ep^~yl&Gu,Xr[13]=Xu^~Al&Ml,Xr[22]=Su^~Nu&Vu,Xr[23]=ru^~Pu&Fu,Xr[32]=_l^~yu&$l,Xr[33]=Go^~wu&Cl,Xr[42]=tu^~_h&Ul,Xr[43]=lu^~zu&su,Xr[4]=uu^~ip&Tu,Xr[5]=xl^~Lu&Ru,Xr[14]=yl^~Gu&Zo,Xr[15]=Al^~Ml&Rl,Xr[24]=Nu^~Vu&Ql,Xr[25]=Pu^~Fu&vu,Xr[34]=yu^~$l&Yu,Xr[35]=wu^~Cl&_d,Xr[44]=_h^~Ul&Nl,Xr[45]=zu^~su&Yl,Xr[6]=ip^~Tu&hu,Xr[7]=Lu^~Ru&Cu,Xr[16]=Gu^~Zo&Hl,Xr[17]=Ml^~Rl&au,Xr[26]=Vu^~Ql&qu,Xr[27]=Fu^~vu&pu,Xr[36]=$l^~Yu&Qu,Xr[37]=Cl^~_d&_f,Xr[46]=Ul^~Nl&Wl,Xr[47]=su^~Yl&eu,Xr[8]=Tu^~hu&xu,Xr[9]=Ru^~Cu&Au,Xr[18]=Zo^~Hl&ep,Xr[19]=Rl^~au&Xu,Xr[28]=Ql^~qu&Su,Xr[29]=vu^~pu&ru,Xr[38]=Yu^~Qu&_l,Xr[39]=_d^~_f&Go,Xr[48]=Nl^~Wl&tu,Xr[49]=Yl^~eu&lu,Xr[0]^=P1600_ROUND_CONSTANTS[eo*2],Xr[1]^=P1600_ROUND_CONSTANTS[eo*2+1]}};const keccakState=keccakStateUnroll;function Keccak$1(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Keccak$1.prototype.initialize=function(Xr,eo){for(let to=0;to<50;++to)this.state[to]=0;this.blockSize=Xr/8,this.count=0,this.squeezing=!1};Keccak$1.prototype.absorb=function(Xr){for(let eo=0;eo>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return eo};Keccak$1.prototype.copy=function(Xr){for(let eo=0;eo<50;++eo)Xr.state[eo]=this.state[eo];Xr.blockSize=this.blockSize,Xr.count=this.count,Xr.squeezing=this.squeezing};var keccak$2=Keccak$1,js$1=api(keccak$2);const createKeccakHash=js$1;function zeros(Xr){return Buffer$3.allocUnsafe(Xr).fill(0)}function bitLengthFromBigInt(Xr){return Xr.toString(2).length}function bufferBEFromBigInt(Xr,eo){let to=Xr.toString(16);to.length%2!==0&&(to="0"+to);const ro=to.match(/.{1,2}/g).map(no=>parseInt(no,16));for(;ro.length"u")throw new Error("Not an array?");if(to=parseTypeArray(Xr),to!=="dynamic"&&to!==0&&eo.length>to)throw new Error("Elements exceed array size: "+to);no=[],Xr=Xr.slice(0,Xr.lastIndexOf("[")),typeof eo=="string"&&(eo=JSON.parse(eo));for(io in eo)no.push(encodeSingle(Xr,eo[io]));if(to==="dynamic"){var oo=encodeSingle("uint256",eo.length);no.unshift(oo)}return Buffer$3.concat(no)}else{if(Xr==="bytes")return eo=new Buffer$3(eo),no=Buffer$3.concat([encodeSingle("uint256",eo.length),eo]),eo.length%32!==0&&(no=Buffer$3.concat([no,util$3.zeros(32-eo.length%32)])),no;if(Xr.startsWith("bytes")){if(to=parseTypeN(Xr),to<1||to>32)throw new Error("Invalid bytes width: "+to);return util$3.setLengthRight(eo,32)}else if(Xr.startsWith("uint")){if(to=parseTypeN(Xr),to%8||to<8||to>256)throw new Error("Invalid uint width: "+to);ro=parseNumber(eo);const ao=util$3.bitLengthFromBigInt(ro);if(ao>to)throw new Error("Supplied uint exceeds width: "+to+" vs "+ao);if(ro<0)throw new Error("Supplied uint is negative");return util$3.bufferBEFromBigInt(ro,32)}else if(Xr.startsWith("int")){if(to=parseTypeN(Xr),to%8||to<8||to>256)throw new Error("Invalid int width: "+to);ro=parseNumber(eo);const ao=util$3.bitLengthFromBigInt(ro);if(ao>to)throw new Error("Supplied int exceeds width: "+to+" vs "+ao);const so=util$3.twosFromBigInt(ro,256);return util$3.bufferBEFromBigInt(so,32)}else if(Xr.startsWith("ufixed")){if(to=parseTypeNxM(Xr),ro=parseNumber(eo),ro<0)throw new Error("Supplied ufixed is negative");return encodeSingle("uint256",ro*BigInt(2)**BigInt(to[1]))}else if(Xr.startsWith("fixed"))return to=parseTypeNxM(Xr),encodeSingle("int256",parseNumber(eo)*BigInt(2)**BigInt(to[1]))}throw new Error("Unsupported or invalid type: "+Xr)}function isDynamic(Xr){return Xr==="string"||Xr==="bytes"||parseTypeArray(Xr)==="dynamic"}function isArray$3(Xr){return Xr.lastIndexOf("]")===Xr.length-1}function rawEncode(Xr,eo){var to=[],ro=[],no=32*Xr.length;for(var io in Xr){var oo=elementaryName(Xr[io]),ao=eo[io],so=encodeSingle(oo,ao);isDynamic(oo)?(to.push(encodeSingle("uint256",no)),ro.push(so),no+=so.length):to.push(so)}return Buffer$3.concat(to.concat(ro))}function solidityPack(Xr,eo){if(Xr.length!==eo.length)throw new Error("Number of types are not matching the values");for(var to,ro,no=[],io=0;io32)throw new Error("Invalid bytes width: "+to);no.push(util$3.setLengthRight(ao,to))}else if(oo.startsWith("uint")){if(to=parseTypeN(oo),to%8||to<8||to>256)throw new Error("Invalid uint width: "+to);ro=parseNumber(ao);const so=util$3.bitLengthFromBigInt(ro);if(so>to)throw new Error("Supplied uint exceeds width: "+to+" vs "+so);no.push(util$3.bufferBEFromBigInt(ro,to/8))}else if(oo.startsWith("int")){if(to=parseTypeN(oo),to%8||to<8||to>256)throw new Error("Invalid int width: "+to);ro=parseNumber(ao);const so=util$3.bitLengthFromBigInt(ro);if(so>to)throw new Error("Supplied int exceeds width: "+to+" vs "+so);const co=util$3.twosFromBigInt(ro,to);no.push(util$3.bufferBEFromBigInt(co,to/8))}else throw new Error("Unsupported or invalid type: "+oo)}return Buffer$3.concat(no)}function soliditySHA3(Xr,eo){return util$3.keccak(solidityPack(Xr,eo))}var abi$1={rawEncode,solidityPack,soliditySHA3};const util$2=util$4,abi=abi$1,TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},TypedDataUtils={encodeData(Xr,eo,to,ro=!0){const no=["bytes32"],io=[this.hashType(Xr,to)];if(ro){const oo=(ao,so,co)=>{if(to[so]!==void 0)return["bytes32",co==null?"0x0000000000000000000000000000000000000000000000000000000000000000":util$2.keccak(this.encodeData(so,co,to,ro))];if(co===void 0)throw new Error(`missing value for field ${ao} of type ${so}`);if(so==="bytes")return["bytes32",util$2.keccak(co)];if(so==="string")return typeof co=="string"&&(co=Buffer$3.from(co,"utf8")),["bytes32",util$2.keccak(co)];if(so.lastIndexOf("]")===so.length-1){const lo=so.slice(0,so.lastIndexOf("[")),uo=co.map(ho=>oo(ao,lo,ho));return["bytes32",util$2.keccak(abi.rawEncode(uo.map(([ho])=>ho),uo.map(([,ho])=>ho)))]}return[so,co]};for(const ao of to[Xr]){const[so,co]=oo(ao.name,ao.type,eo[ao.name]);no.push(so),io.push(co)}}else for(const oo of to[Xr]){let ao=eo[oo.name];if(ao!==void 0)if(oo.type==="bytes")no.push("bytes32"),ao=util$2.keccak(ao),io.push(ao);else if(oo.type==="string")no.push("bytes32"),typeof ao=="string"&&(ao=Buffer$3.from(ao,"utf8")),ao=util$2.keccak(ao),io.push(ao);else if(to[oo.type]!==void 0)no.push("bytes32"),ao=util$2.keccak(this.encodeData(oo.type,ao,to,ro)),io.push(ao);else{if(oo.type.lastIndexOf("]")===oo.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");no.push(oo.type),io.push(ao)}}return abi.rawEncode(no,io)},encodeType(Xr,eo){let to="",ro=this.findTypeDependencies(Xr,eo).filter(no=>no!==Xr);ro=[Xr].concat(ro.sort());for(const no of ro){if(!eo[no])throw new Error("No type definition specified: "+no);to+=no+"("+eo[no].map(({name:oo,type:ao})=>ao+" "+oo).join(",")+")"}return to},findTypeDependencies(Xr,eo,to=[]){if(Xr=Xr.match(/^\w*/)[0],to.includes(Xr)||eo[Xr]===void 0)return to;to.push(Xr);for(const ro of eo[Xr])for(const no of this.findTypeDependencies(ro.type,eo,to))!to.includes(no)&&to.push(no);return to},hashStruct(Xr,eo,to,ro=!0){return util$2.keccak(this.encodeData(Xr,eo,to,ro))},hashType(Xr,eo){return util$2.keccak(this.encodeType(Xr,eo))},sanitizeData(Xr){const eo={};for(const to in TYPED_MESSAGE_SCHEMA.properties)Xr[to]&&(eo[to]=Xr[to]);return eo.types&&(eo.types=Object.assign({EIP712Domain:[]},eo.types)),eo},hash(Xr,eo=!0){const to=this.sanitizeData(Xr),ro=[Buffer$3.from("1901","hex")];return ro.push(this.hashStruct("EIP712Domain",to.domain,to.types,eo)),to.primaryType!=="EIP712Domain"&&ro.push(this.hashStruct(to.primaryType,to.message,to.types,eo)),util$2.keccak(Buffer$3.concat(ro))}};var ethEip712Util={TYPED_MESSAGE_SCHEMA,TypedDataUtils,hashForSignTypedDataLegacy:function(Xr){return typedSignatureHashLegacy(Xr.data)},hashForSignTypedData_v3:function(Xr){return TypedDataUtils.hash(Xr.data,!1)},hashForSignTypedData_v4:function(Xr){return TypedDataUtils.hash(Xr.data)}};function typedSignatureHashLegacy(Xr){const eo=new Error("Expect argument to be non-empty array");if(typeof Xr!="object"||!Xr.length)throw eo;const to=Xr.map(function(io){return io.type==="bytes"?util$2.toBuffer(io.value):io.value}),ro=Xr.map(function(io){return io.type}),no=Xr.map(function(io){if(!io.name)throw eo;return io.type+" "+io.name});return abi.soliditySHA3(["bytes32","bytes32"],[abi.soliditySHA3(new Array(Xr.length).fill("string"),no),abi.soliditySHA3(ro,to)])}var constants$4={};Object.defineProperty(constants$4,"__esModule",{value:!0});constants$4.APP_VERSION_KEY=constants$4.LOCAL_STORAGE_ADDRESSES_KEY=constants$4.WALLET_USER_NAME_KEY=void 0;constants$4.WALLET_USER_NAME_KEY="walletUsername";constants$4.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";constants$4.APP_VERSION_KEY="AppVersion";var RelayEventManager$1={};Object.defineProperty(RelayEventManager$1,"__esModule",{value:!0});RelayEventManager$1.RelayEventManager=void 0;const util_1$9=util$6;class RelayEventManager{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const eo=this._nextRequestId,to=(0,util_1$9.prepend0x)(eo.toString(16));return this.callbacks.get(to)&&this.callbacks.delete(to),eo}}RelayEventManager$1.RelayEventManager=RelayEventManager;var WalletLinkRelay$1={},WalletLinkConnection$1={},WalletLinkCipher$1={};Object.defineProperty(WalletLinkCipher$1,"__esModule",{value:!0});WalletLinkCipher$1.WalletLinkCipher=void 0;const util_1$8=util$6;class WalletLinkCipher{constructor(eo){this.secret=eo}async encrypt(eo){const to=this.secret;if(to.length!==64)throw Error("secret must be 256 bits");const ro=crypto.getRandomValues(new Uint8Array(12)),no=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(to),{name:"aes-gcm"},!1,["encrypt","decrypt"]),io=new TextEncoder,oo=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:ro},no,io.encode(eo)),ao=16,so=oo.slice(oo.byteLength-ao),co=oo.slice(0,oo.byteLength-ao),lo=new Uint8Array(so),uo=new Uint8Array(co),ho=new Uint8Array([...ro,...lo,...uo]);return(0,util_1$8.uint8ArrayToHex)(ho)}async decrypt(eo){const to=this.secret;if(to.length!==64)throw Error("secret must be 256 bits");return new Promise((ro,no)=>{(async function(){const io=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(to),{name:"aes-gcm"},!1,["encrypt","decrypt"]),oo=(0,util_1$8.hexStringToUint8Array)(eo),ao=oo.slice(0,12),so=oo.slice(12,28),co=oo.slice(28),lo=new Uint8Array([...co,...so]),uo={name:"AES-GCM",iv:new Uint8Array(ao)};try{const ho=await window.crypto.subtle.decrypt(uo,io,lo),go=new TextDecoder;ro(go.decode(ho))}catch(ho){no(ho)}})()})}}WalletLinkCipher$1.WalletLinkCipher=WalletLinkCipher;var WalletLinkHTTP$1={};Object.defineProperty(WalletLinkHTTP$1,"__esModule",{value:!0});WalletLinkHTTP$1.WalletLinkHTTP=void 0;class WalletLinkHTTP{constructor(eo,to,ro){this.linkAPIUrl=eo,this.sessionId=to;const no=`${to}:${ro}`;this.auth=`Basic ${btoa(no)}`}async markUnseenEventsAsSeen(eo){return Promise.all(eo.map(to=>fetch(`${this.linkAPIUrl}/events/${to.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(to=>console.error("Unabled to mark event as failed:",to))}async fetchUnseenEvents(){var eo;const to=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(to.ok){const{events:ro,error:no}=await to.json();if(no)throw new Error(`Check unseen events failed: ${no}`);const io=(eo=ro==null?void 0:ro.filter(oo=>oo.event==="Web3Response").map(oo=>({type:"Event",sessionId:this.sessionId,eventId:oo.id,event:oo.event,data:oo.data})))!==null&&eo!==void 0?eo:[];return this.markUnseenEventsAsSeen(io),io}throw new Error(`Check unseen events failed: ${to.status}`)}}WalletLinkHTTP$1.WalletLinkHTTP=WalletLinkHTTP;var WalletLinkWebSocket$1={};Object.defineProperty(WalletLinkWebSocket$1,"__esModule",{value:!0});WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket$1.ConnectionState=void 0;var ConnectionState;(function(Xr){Xr[Xr.DISCONNECTED=0]="DISCONNECTED",Xr[Xr.CONNECTING=1]="CONNECTING",Xr[Xr.CONNECTED=2]="CONNECTED"})(ConnectionState||(WalletLinkWebSocket$1.ConnectionState=ConnectionState={}));class WalletLinkWebSocket{setConnectionStateListener(eo){this.connectionStateListener=eo}setIncomingDataListener(eo){this.incomingDataListener=eo}constructor(eo,to=WebSocket){this.WebSocketClass=to,this.webSocket=null,this.pendingData=[],this.url=eo.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((eo,to)=>{var ro;let no;try{this.webSocket=no=new this.WebSocketClass(this.url)}catch(io){to(io);return}(ro=this.connectionStateListener)===null||ro===void 0||ro.call(this,ConnectionState.CONNECTING),no.onclose=io=>{var oo;this.clearWebSocket(),to(new Error(`websocket error ${io.code}: ${io.reason}`)),(oo=this.connectionStateListener)===null||oo===void 0||oo.call(this,ConnectionState.DISCONNECTED)},no.onopen=io=>{var oo;eo(),(oo=this.connectionStateListener)===null||oo===void 0||oo.call(this,ConnectionState.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(so=>this.sendData(so)),this.pendingData=[])},no.onmessage=io=>{var oo,ao;if(io.data==="h")(oo=this.incomingDataListener)===null||oo===void 0||oo.call(this,{type:"Heartbeat"});else try{const so=JSON.parse(io.data);(ao=this.incomingDataListener)===null||ao===void 0||ao.call(this,so)}catch{}}})}disconnect(){var eo;const{webSocket:to}=this;if(to){this.clearWebSocket(),(eo=this.connectionStateListener)===null||eo===void 0||eo.call(this,ConnectionState.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{to.close()}catch{}}}sendData(eo){const{webSocket:to}=this;if(!to){this.pendingData.push(eo),this.connect();return}to.send(eo)}clearWebSocket(){const{webSocket:eo}=this;eo&&(this.webSocket=null,eo.onclose=null,eo.onerror=null,eo.onmessage=null,eo.onopen=null)}}WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket;Object.defineProperty(WalletLinkConnection$1,"__esModule",{value:!0});WalletLinkConnection$1.WalletLinkConnection=void 0;const constants_1$4=constants$4,WalletLinkCipher_1=WalletLinkCipher$1,WalletLinkHTTP_1=WalletLinkHTTP$1,WalletLinkWebSocket_1=WalletLinkWebSocket$1,type_1$1=type$3,HEARTBEAT_INTERVAL=1e4,REQUEST_TIMEOUT=6e4;class WalletLinkConnection{constructor({session:eo,linkAPIUrl:to,listener:ro,WebSocketClass:no=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,type_1$1.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=oo=>{if(!oo)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",so=>oo.JsonRpcUrl&&this.handleChainUpdated(so,oo.JsonRpcUrl)]]).forEach((so,co)=>{const lo=oo[co];lo!==void 0&&so(lo)})},this.handleDestroyed=oo=>{var ao;oo==="1"&&((ao=this.listener)===null||ao===void 0||ao.resetAndReload())},this.handleAccountUpdated=async oo=>{var ao;{const so=await this.cipher.decrypt(oo);(ao=this.listener)===null||ao===void 0||ao.accountUpdated(so)}},this.handleMetadataUpdated=async(oo,ao)=>{var so;{const co=await this.cipher.decrypt(ao);(so=this.listener)===null||so===void 0||so.metadataUpdated(oo,co)}},this.handleWalletUsernameUpdated=async oo=>{this.handleMetadataUpdated(constants_1$4.WALLET_USER_NAME_KEY,oo)},this.handleAppVersionUpdated=async oo=>{this.handleMetadataUpdated(constants_1$4.APP_VERSION_KEY,oo)},this.handleChainUpdated=async(oo,ao)=>{var so;{const co=await this.cipher.decrypt(oo),lo=await this.cipher.decrypt(ao);(so=this.listener)===null||so===void 0||so.chainUpdated(co,lo)}},this.session=eo,this.cipher=new WalletLinkCipher_1.WalletLinkCipher(eo.secret),this.listener=ro;const io=new WalletLinkWebSocket_1.WalletLinkWebSocket(`${to}/rpc`,no);io.setConnectionStateListener(async oo=>{let ao=!1;switch(oo){case WalletLinkWebSocket_1.ConnectionState.DISCONNECTED:if(!this.destroyed){const so=async()=>{await new Promise(co=>setTimeout(co,5e3)),this.destroyed||io.connect().catch(()=>{so()})};so()}break;case WalletLinkWebSocket_1.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),ao=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},HEARTBEAT_INTERVAL),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case WalletLinkWebSocket_1.ConnectionState.CONNECTING:break}this.connected!==ao&&(this.connected=ao)}),io.setIncomingDataListener(oo=>{var ao;switch(oo.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const so=oo.type==="IsLinkedOK"?oo.linked:void 0;this.linked=so||oo.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(oo.metadata);break}case"Event":{this.handleIncomingEvent(oo);break}}oo.id!==void 0&&((ao=this.requestResolutions.get(oo.id))===null||ao===void 0||ao(oo))}),this.ws=io,this.http=new WalletLinkHTTP_1.WalletLinkHTTP(to,eo.id,eo.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(eo){var to;this._connected=eo,eo&&((to=this.onceConnected)===null||to===void 0||to.call(this))}setOnceConnected(eo){return new Promise(to=>{this.connected?eo().then(to):this.onceConnected=()=>{eo().then(to),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(eo){var to,ro;this._linked=eo,eo&&((to=this.onceLinked)===null||to===void 0||to.call(this)),(ro=this.listener)===null||ro===void 0||ro.linkedUpdated(eo)}setOnceLinked(eo){return new Promise(to=>{this.linked?eo().then(to):this.onceLinked=()=>{eo().then(to),this.onceLinked=void 0}})}async handleIncomingEvent(eo){var to;if(!(eo.type!=="Event"||eo.event!=="Web3Response")){const ro=await this.cipher.decrypt(eo.data),no=JSON.parse(ro);if(no.type!=="WEB3_RESPONSE")return;(to=this.listener)===null||to===void 0||to.handleWeb3ResponseMessage(no)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(eo=>setTimeout(eo,250));try{await this.fetchUnseenEventsAPI()}catch(eo){console.error("Unable to check for unseen events",eo)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(to=>this.handleIncomingEvent(to))}async setSessionMetadata(eo,to){const ro={type:"SetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[eo]:to}};return this.setOnceConnected(async()=>{const no=await this.makeRequest(ro);if(no.type==="Fail")throw new Error(no.error||"failed to set session metadata")})}async publishEvent(eo,to,ro=!1){const no=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},to),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),io={type:"PublishEvent",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:eo,data:no,callWebhook:ro};return this.setOnceLinked(async()=>{const oo=await this.makeRequest(io);if(oo.type==="Fail")throw new Error(oo.error||"failed to publish event");return oo.eventId})}sendData(eo){this.ws.sendData(JSON.stringify(eo))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>HEARTBEAT_INTERVAL*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(eo,to=REQUEST_TIMEOUT){const ro=eo.id;this.sendData(eo);let no;return Promise.race([new Promise((io,oo)=>{no=window.setTimeout(()=>{oo(new Error(`request ${ro} timed out`))},to)}),new Promise(io=>{this.requestResolutions.set(ro,oo=>{clearTimeout(no),io(oo),this.requestResolutions.delete(ro)})})])}async authenticate(){const eo={type:"HostSession",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},to=await this.makeRequest(eo);if(to.type==="Fail")throw new Error(to.error||"failed to authenticate")}sendIsLinked(){const eo={type:"IsLinked",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(eo)}sendGetSessionConfig(){const eo={type:"GetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(eo)}}WalletLinkConnection$1.WalletLinkConnection=WalletLinkConnection;var WalletLinkSession$1={};Object.defineProperty(WalletLinkSession$1,"__esModule",{value:!0});WalletLinkSession$1.WalletLinkSession=void 0;const sha_js_1=requireSha_js(),util_1$7=util$6,STORAGE_KEY_SESSION_ID="session:id",STORAGE_KEY_SESSION_SECRET="session:secret",STORAGE_KEY_SESSION_LINKED="session:linked";class WalletLinkSession{constructor(eo,to,ro,no){this._storage=eo,this._id=to||(0,util_1$7.randomBytesHex)(16),this._secret=ro||(0,util_1$7.randomBytesHex)(32),this._key=new sha_js_1.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!no}static load(eo){const to=eo.getItem(STORAGE_KEY_SESSION_ID),ro=eo.getItem(STORAGE_KEY_SESSION_LINKED),no=eo.getItem(STORAGE_KEY_SESSION_SECRET);return to&&no?new WalletLinkSession(eo,to,no,ro==="1"):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(eo){this._linked=eo,this.persistLinked()}save(){return this._storage.setItem(STORAGE_KEY_SESSION_ID,this._id),this._storage.setItem(STORAGE_KEY_SESSION_SECRET,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(STORAGE_KEY_SESSION_LINKED,this._linked?"1":"0")}}WalletLinkSession$1.WalletLinkSession=WalletLinkSession;var util$1={};Object.defineProperty(util$1,"__esModule",{value:!0});util$1.isDarkMode=util$1.isMobileWeb=util$1.getLocation=util$1.createQrUrl=void 0;function createQrUrl(Xr,eo,to,ro,no,io){const oo=ro?"parent-id":"id",ao=new URLSearchParams({[oo]:Xr,secret:eo,server:to,v:no,chainId:io.toString()}).toString();return`${to}/#/link?${ao}`}util$1.createQrUrl=createQrUrl;function isInIFrame(){try{return window.frameElement!==null}catch{return!1}}function getLocation(){try{return isInIFrame()&&window.top?window.top.location:window.location}catch{return window.location}}util$1.getLocation=getLocation;function isMobileWeb(){var Xr;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((Xr=window==null?void 0:window.navigator)===null||Xr===void 0?void 0:Xr.userAgent)}util$1.isMobileWeb=isMobileWeb;function isDarkMode(){var Xr,eo;return(eo=(Xr=window==null?void 0:window.matchMedia)===null||Xr===void 0?void 0:Xr.call(window,"(prefers-color-scheme: dark)").matches)!==null&&eo!==void 0?eo:!1}util$1.isDarkMode=isDarkMode;var WalletLinkRelayUI$1={},cssReset={},cssResetCss={};Object.defineProperty(cssResetCss,"__esModule",{value:!0});cssResetCss.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var __importDefault$4=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(cssReset,"__esModule",{value:!0});cssReset.injectCssReset=void 0;const cssReset_css_1=__importDefault$4(cssResetCss);function injectCssReset(){const Xr=document.createElement("style");Xr.type="text/css",Xr.appendChild(document.createTextNode(cssReset_css_1.default)),document.documentElement.appendChild(Xr)}cssReset.injectCssReset=injectCssReset;var Snackbar={};function r$3(Xr){var eo,to,ro="";if(typeof Xr=="string"||typeof Xr=="number")ro+=Xr;else if(typeof Xr=="object")if(Array.isArray(Xr))for(eo=0;eo2&&(oo.children=arguments.length>3?n$1.call(arguments,2):to),typeof Xr=="function"&&Xr.defaultProps!=null)for(io in Xr.defaultProps)oo[io]===void 0&&(oo[io]=Xr.defaultProps[io]);return g$4(Xr,oo,ro,no,null)}function g$4(Xr,eo,to,ro,no){var io={type:Xr,props:eo,key:to,ref:ro,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:no??++u$3,__i:-1,__u:0};return no==null&&l$4.vnode!=null&&l$4.vnode(io),io}function m$2(){return{current:null}}function b$4(Xr){return Xr.children}function k$1(Xr,eo){this.props=Xr,this.context=eo}function x$3(Xr,eo){if(eo==null)return Xr.__?x$3(Xr.__,Xr.__i+1):null;for(var to;eoeo&&i$3.sort(f$5));M$2.__r=0}function P$3(Xr,eo,to,ro,no,io,oo,ao,so,co,lo){var uo,ho,go,bo,wo,Eo=ro&&ro.__k||v$2,$o=eo.length;for(to.__d=so,$$2(to,eo,Eo),so=to.__d,uo=0;uo<$o;uo++)(go=to.__k[uo])!=null&&(ho=go.__i===-1?h$4:Eo[go.__i]||h$4,go.__i=uo,O$5(Xr,go,ho,no,io,oo,ao,so,co,lo),bo=go.__e,go.ref&&ho.ref!=go.ref&&(ho.ref&&N$4(ho.ref,null,go),lo.push(go.ref,go.__c||bo,go)),wo==null&&bo!=null&&(wo=bo),65536&go.__u||ho.__k===go.__k?so=I(go,so,Xr):typeof go.type=="function"&&go.__d!==void 0?so=go.__d:bo&&(so=bo.nextSibling),go.__d=void 0,go.__u&=-196609);to.__d=so,to.__e=wo}function $$2(Xr,eo,to){var ro,no,io,oo,ao,so=eo.length,co=to.length,lo=co,uo=0;for(Xr.__k=[],ro=0;ro0?g$4(no.type,no.props,no.key,no.ref?no.ref:null,no.__v):no).__=Xr,no.__b=Xr.__b+1,io=null,(ao=no.__i=L$4(no,to,oo,lo))!==-1&&(lo--,(io=to[ao])&&(io.__u|=131072)),io==null||io.__v===null?(ao==-1&&uo--,typeof no.type!="function"&&(no.__u|=65536)):ao!==oo&&(ao==oo-1?uo--:ao==oo+1?uo++:(ao>oo?uo--:uo++,no.__u|=65536))):no=Xr.__k[ro]=null;if(lo)for(ro=0;ro(so!=null&&!(131072&so.__u)?1:0))for(;oo>=0||ao=0){if((so=eo[oo])&&!(131072&so.__u)&&no==so.key&&io===so.type)return oo;oo--}if(ao2&&(ao.children=arguments.length>3?n$1.call(arguments,2):to),g$4(Xr.type,ao,ro||Xr.key,no||Xr.ref,null)}function G$2(Xr,eo){var to={__c:eo="__cC"+a$3++,__:Xr,Consumer:function(ro,no){return ro.children(no)},Provider:function(ro){var no,io;return this.getChildContext||(no=new Set,(io={})[eo]=this,this.getChildContext=function(){return io},this.componentWillUnmount=function(){no=null},this.shouldComponentUpdate=function(oo){this.props.value!==oo.value&&no.forEach(function(ao){ao.__e=!0,S$3(ao)})},this.sub=function(oo){no.add(oo);var ao=oo.componentWillUnmount;oo.componentWillUnmount=function(){no&&no.delete(oo),ao&&ao.call(oo)}}),ro.children}};return to.Provider.__=to.Consumer.contextType=to}n$1=v$2.slice,l$4={__e:function(Xr,eo,to,ro){for(var no,io,oo;eo=eo.__;)if((no=eo.__c)&&!no.__)try{if((io=no.constructor)&&io.getDerivedStateFromError!=null&&(no.setState(io.getDerivedStateFromError(Xr)),oo=no.__d),no.componentDidCatch!=null&&(no.componentDidCatch(Xr,ro||{}),oo=no.__d),oo)return no.__E=no}catch(ao){Xr=ao}throw Xr}},u$3=0,t$3=function(Xr){return Xr!=null&&Xr.constructor==null},k$1.prototype.setState=function(Xr,eo){var to;to=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=d$5({},this.state),typeof Xr=="function"&&(Xr=Xr(d$5({},to),this.props)),Xr&&d$5(to,Xr),Xr!=null&&this.__v&&(eo&&this._sb.push(eo),S$3(this))},k$1.prototype.forceUpdate=function(Xr){this.__v&&(this.__e=!0,Xr&&this.__h.push(Xr),S$3(this))},k$1.prototype.render=b$4,i$3=[],r$2=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$5=function(Xr,eo){return Xr.__v.__b-eo.__v.__b},M$2.__r=0,e$2=0,c$2=F$4(!1),s$3=F$4(!0),a$3=0;const preact_module=Object.freeze(Object.defineProperty({__proto__:null,Component:k$1,Fragment:b$4,cloneElement:E$2,createContext:G$2,createElement:_$5,createRef:m$2,h:_$5,hydrate:D$2,get isValidElement(){return t$3},get options(){return l$4},render:B$3,toChildArray:H$2},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(preact_module);var t$2,r$1,u$2,i$2,o$2=0,f$4=[],c$1=l$4,e$1=c$1.__b,a$2=c$1.__r,v$1=c$1.diffed,l$3=c$1.__c,m$1=c$1.unmount,s$2=c$1.__;function d$4(Xr,eo){c$1.__h&&c$1.__h(r$1,Xr,o$2||eo),o$2=0;var to=r$1.__H||(r$1.__H={__:[],__h:[]});return Xr>=to.__.length&&to.__.push({}),to.__[Xr]}function h$3(Xr){return o$2=1,p$1(D$1,Xr)}function p$1(Xr,eo,to){var ro=d$4(t$2++,2);if(ro.t=Xr,!ro.__c&&(ro.__=[to?to(eo):D$1(void 0,eo),function(ao){var so=ro.__N?ro.__N[0]:ro.__[0],co=ro.t(so,ao);so!==co&&(ro.__N=[co,ro.__[1]],ro.__c.setState({}))}],ro.__c=r$1,!r$1.u)){var no=function(ao,so,co){if(!ro.__c.__H)return!0;var lo=ro.__c.__H.__.filter(function(ho){return!!ho.__c});if(lo.every(function(ho){return!ho.__N}))return!io||io.call(this,ao,so,co);var uo=!1;return lo.forEach(function(ho){if(ho.__N){var go=ho.__[0];ho.__=ho.__N,ho.__N=void 0,go!==ho.__[0]&&(uo=!0)}}),!(!uo&&ro.__c.props===ao)&&(!io||io.call(this,ao,so,co))};r$1.u=!0;var io=r$1.shouldComponentUpdate,oo=r$1.componentWillUpdate;r$1.componentWillUpdate=function(ao,so,co){if(this.__e){var lo=io;io=void 0,no(ao,so,co),io=lo}oo&&oo.call(this,ao,so,co)},r$1.shouldComponentUpdate=no}return ro.__N||ro.__}function y$5(Xr,eo){var to=d$4(t$2++,3);!c$1.__s&&C$4(to.__H,eo)&&(to.__=Xr,to.i=eo,r$1.__H.__h.push(to))}function _$4(Xr,eo){var to=d$4(t$2++,4);!c$1.__s&&C$4(to.__H,eo)&&(to.__=Xr,to.i=eo,r$1.__h.push(to))}function A$4(Xr){return o$2=5,T$5(function(){return{current:Xr}},[])}function F$3(Xr,eo,to){o$2=6,_$4(function(){return typeof Xr=="function"?(Xr(eo()),function(){return Xr(null)}):Xr?(Xr.current=eo(),function(){return Xr.current=null}):void 0},to==null?to:to.concat(Xr))}function T$5(Xr,eo){var to=d$4(t$2++,7);return C$4(to.__H,eo)&&(to.__=Xr(),to.__H=eo,to.__h=Xr),to.__}function q$3(Xr,eo){return o$2=8,T$5(function(){return Xr},eo)}function x$2(Xr){var eo=r$1.context[Xr.__c],to=d$4(t$2++,9);return to.c=Xr,eo?(to.__==null&&(to.__=!0,eo.sub(r$1)),eo.props.value):Xr.__}function P$2(Xr,eo){c$1.useDebugValue&&c$1.useDebugValue(eo?eo(Xr):Xr)}function b$3(Xr){var eo=d$4(t$2++,10),to=h$3();return eo.__=Xr,r$1.componentDidCatch||(r$1.componentDidCatch=function(ro,no){eo.__&&eo.__(ro,no),to[1](ro)}),[to[0],function(){to[1](void 0)}]}function g$3(){var Xr=d$4(t$2++,11);if(!Xr.__){for(var eo=r$1.__v;eo!==null&&!eo.__m&&eo.__!==null;)eo=eo.__;var to=eo.__m||(eo.__m=[0,0]);Xr.__="P"+to[0]+"-"+to[1]++}return Xr.__}function j$4(){for(var Xr;Xr=f$4.shift();)if(Xr.__P&&Xr.__H)try{Xr.__H.__h.forEach(z$3),Xr.__H.__h.forEach(B$2),Xr.__H.__h=[]}catch(eo){Xr.__H.__h=[],c$1.__e(eo,Xr.__v)}}c$1.__b=function(Xr){r$1=null,e$1&&e$1(Xr)},c$1.__=function(Xr,eo){Xr&&eo.__k&&eo.__k.__m&&(Xr.__m=eo.__k.__m),s$2&&s$2(Xr,eo)},c$1.__r=function(Xr){a$2&&a$2(Xr),t$2=0;var eo=(r$1=Xr.__c).__H;eo&&(u$2===r$1?(eo.__h=[],r$1.__h=[],eo.__.forEach(function(to){to.__N&&(to.__=to.__N),to.i=to.__N=void 0})):(eo.__h.forEach(z$3),eo.__h.forEach(B$2),eo.__h=[],t$2=0)),u$2=r$1},c$1.diffed=function(Xr){v$1&&v$1(Xr);var eo=Xr.__c;eo&&eo.__H&&(eo.__H.__h.length&&(f$4.push(eo)!==1&&i$2===c$1.requestAnimationFrame||((i$2=c$1.requestAnimationFrame)||w$2)(j$4)),eo.__H.__.forEach(function(to){to.i&&(to.__H=to.i),to.i=void 0})),u$2=r$1=null},c$1.__c=function(Xr,eo){eo.some(function(to){try{to.__h.forEach(z$3),to.__h=to.__h.filter(function(ro){return!ro.__||B$2(ro)})}catch(ro){eo.some(function(no){no.__h&&(no.__h=[])}),eo=[],c$1.__e(ro,to.__v)}}),l$3&&l$3(Xr,eo)},c$1.unmount=function(Xr){m$1&&m$1(Xr);var eo,to=Xr.__c;to&&to.__H&&(to.__H.__.forEach(function(ro){try{z$3(ro)}catch(no){eo=no}}),to.__H=void 0,eo&&c$1.__e(eo,to.__v))};var k=typeof requestAnimationFrame=="function";function w$2(Xr){var eo,to=function(){clearTimeout(ro),k&&cancelAnimationFrame(eo),setTimeout(Xr)},ro=setTimeout(to,100);k&&(eo=requestAnimationFrame(to))}function z$3(Xr){var eo=r$1,to=Xr.__c;typeof to=="function"&&(Xr.__c=void 0,to()),r$1=eo}function B$2(Xr){var eo=r$1;Xr.__c=Xr.__(),r$1=eo}function C$4(Xr,eo){return!Xr||Xr.length!==eo.length||eo.some(function(to,ro){return to!==Xr[ro]})}function D$1(Xr,eo){return typeof eo=="function"?eo(Xr):eo}const hooks_module=Object.freeze(Object.defineProperty({__proto__:null,useCallback:q$3,useContext:x$2,useDebugValue:P$2,useEffect:y$5,useErrorBoundary:b$3,useId:g$3,useImperativeHandle:F$3,useLayoutEffect:_$4,useMemo:T$5,useReducer:p$1,useRef:A$4,useState:h$3},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(hooks_module);var SnackbarCss={};Object.defineProperty(SnackbarCss,"__esModule",{value:!0});SnackbarCss.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(Xr){var eo=commonjsGlobal&&commonjsGlobal.__importDefault||function(ho){return ho&&ho.__esModule?ho:{default:ho}};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.SnackbarInstance=Xr.SnackbarContainer=Xr.Snackbar=void 0;const to=eo(require$$0$1),ro=require$$1,no=require$$2$1,io=util$1,oo=eo(SnackbarCss),ao="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",so="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class co{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,io.isDarkMode)()}attach(go){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",go.appendChild(this.root),this.render()}presentItem(go){const bo=this.nextItemKey++;return this.items.set(bo,go),this.render(),()=>{this.items.delete(bo),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,ro.render)((0,ro.h)("div",null,(0,ro.h)(Xr.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([go,bo])=>(0,ro.h)(Xr.SnackbarInstance,Object.assign({},bo,{key:go}))))),this.root)}}Xr.Snackbar=co;const lo=ho=>(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-container")},(0,ro.h)("style",null,oo.default),(0,ro.h)("div",{class:"-cbwsdk-snackbar"},ho.children));Xr.SnackbarContainer=lo;const uo=({autoExpand:ho,message:go,menuItems:bo})=>{const[wo,Eo]=(0,no.useState)(!0),[$o,Co]=(0,no.useState)(ho??!1);(0,no.useEffect)(()=>{const Oo=[window.setTimeout(()=>{Eo(!1)},1),window.setTimeout(()=>{Co(!0)},1e4)];return()=>{Oo.forEach(window.clearTimeout)}});const Ro=()=>{Co(!$o)};return(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-instance",wo&&"-cbwsdk-snackbar-instance-hidden",$o&&"-cbwsdk-snackbar-instance-expanded")},(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:Ro},(0,ro.h)("img",{src:ao,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},go),(0,ro.h)("div",{class:"-gear-container"},!$o&&(0,ro.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,ro.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,ro.h)("img",{src:so,class:"-gear-icon",title:"Expand"}))),bo&&bo.length>0&&(0,ro.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},bo.map((Oo,jo)=>(0,ro.h)("div",{class:(0,to.default)("-cbwsdk-snackbar-instance-menu-item",Oo.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:Oo.onClick,key:jo},(0,ro.h)("svg",{width:Oo.svgWidth,height:Oo.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,ro.h)("path",{"fill-rule":Oo.defaultFillRule,"clip-rule":Oo.defaultClipRule,d:Oo.path,fill:"#AAAAAA"})),(0,ro.h)("span",{class:(0,to.default)("-cbwsdk-snackbar-instance-menu-item-info",Oo.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},Oo.info)))))};Xr.SnackbarInstance=uo})(Snackbar);Object.defineProperty(WalletLinkRelayUI$1,"__esModule",{value:!0});WalletLinkRelayUI$1.WalletLinkRelayUI=void 0;const cssReset_1$1=cssReset,Snackbar_1$1=Snackbar;class WalletLinkRelayUI{constructor(){this.attached=!1,this.snackbar=new Snackbar_1$1.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const eo=document.documentElement,to=document.createElement("div");to.className="-cbwsdk-css-reset",eo.appendChild(to),this.snackbar.attach(to),this.attached=!0,(0,cssReset_1$1.injectCssReset)()}showConnecting(eo){let to;return eo.isUnlinkedErrorState?to={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:eo.onResetConnection}]}:to={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:eo.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:eo.onResetConnection}]},this.snackbar.presentItem(to)}}WalletLinkRelayUI$1.WalletLinkRelayUI=WalletLinkRelayUI;var WLMobileRelayUI$1={},RedirectDialog$1={},RedirectDialogCss={};Object.defineProperty(RedirectDialogCss,"__esModule",{value:!0});RedirectDialogCss.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var __importDefault$3=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(RedirectDialog$1,"__esModule",{value:!0});RedirectDialog$1.RedirectDialog=void 0;const clsx_1=__importDefault$3(require$$0$1),preact_1=require$$1,cssReset_1=cssReset,Snackbar_1=Snackbar,util_1$6=util$1,RedirectDialog_css_1=__importDefault$3(RedirectDialogCss);class RedirectDialog{constructor(){this.root=null,this.darkMode=(0,util_1$6.isDarkMode)()}attach(){const eo=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",eo.appendChild(this.root),(0,cssReset_1.injectCssReset)()}present(eo){this.render(eo)}clear(){this.render(null)}render(eo){this.root&&((0,preact_1.render)(null,this.root),eo&&(0,preact_1.render)((0,preact_1.h)(RedirectDialogContent,Object.assign({},eo,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}RedirectDialog$1.RedirectDialog=RedirectDialog;const RedirectDialogContent=({title:Xr,buttonText:eo,darkMode:to,onButtonClick:ro,onDismiss:no})=>{const io=to?"dark":"light";return(0,preact_1.h)(Snackbar_1.SnackbarContainer,{darkMode:to},(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,preact_1.h)("style",null,RedirectDialog_css_1.default),(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:no}),(0,preact_1.h)("div",{class:(0,clsx_1.default)("-cbwsdk-redirect-dialog-box",io)},(0,preact_1.h)("p",null,Xr),(0,preact_1.h)("button",{onClick:ro},eo))))};var constants$3={};Object.defineProperty(constants$3,"__esModule",{value:!0});constants$3.CBW_MOBILE_DEEPLINK_URL=constants$3.WALLETLINK_URL=constants$3.CB_KEYS_URL=void 0;constants$3.CB_KEYS_URL="https://keys.coinbase.com/connect";constants$3.WALLETLINK_URL="https://www.walletlink.org";constants$3.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(WLMobileRelayUI$1,"__esModule",{value:!0});WLMobileRelayUI$1.WLMobileRelayUI=void 0;const RedirectDialog_1=RedirectDialog$1,util_1$5=util$1,constants_1$3=constants$3;class WLMobileRelayUI{constructor(){this.attached=!1,this.redirectDialog=new RedirectDialog_1.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(eo){const to=new URL(constants_1$3.CBW_MOBILE_DEEPLINK_URL);to.searchParams.append("redirect_url",(0,util_1$5.getLocation)().href),eo&&to.searchParams.append("wl_url",eo);const ro=document.createElement("a");ro.target="cbw-opener",ro.href=to.href,ro.rel="noreferrer noopener",ro.click()}openCoinbaseWalletDeeplink(eo){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(eo)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(eo)},99)}showConnecting(eo){return()=>{this.redirectDialog.clear()}}}WLMobileRelayUI$1.WLMobileRelayUI=WLMobileRelayUI;Object.defineProperty(WalletLinkRelay$1,"__esModule",{value:!0});WalletLinkRelay$1.WalletLinkRelay=void 0;const WalletLinkConnection_1=WalletLinkConnection$1,constants_1$2=constants$4,RelayEventManager_1$1=RelayEventManager$1,WalletLinkSession_1=WalletLinkSession$1,Web3Response_1$1=Web3Response,util_1$4=util$1,WalletLinkRelayUI_1=WalletLinkRelayUI$1,WLMobileRelayUI_1=WLMobileRelayUI$1,error_1$6=error$2,util_2$1=util$6,ScopedLocalStorage_1$4=ScopedLocalStorage$1;class WalletLinkRelay{constructor(eo){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,util_1$4.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=io=>{this.isLinked=io;const oo=this.storage.getItem(constants_1$2.LOCAL_STORAGE_ADDRESSES_KEY);if(io&&(this._session.linked=io),this.isUnlinkedErrorState=!1,oo){const ao=oo.split(" "),so=this.storage.getItem("IsStandaloneSigning")==="true";ao[0]!==""&&!io&&this._session.linked&&!so&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(io,oo)=>{this.storage.setItem(io,oo)},this.chainUpdated=(io,oo)=>{this.chainCallbackParams.chainId===io&&this.chainCallbackParams.jsonRpcUrl===oo||(this.chainCallbackParams={chainId:io,jsonRpcUrl:oo},this.chainCallback&&this.chainCallback(io,oo))},this.accountUpdated=io=>{this.accountsCallback&&this.accountsCallback([io]),WalletLinkRelay.accountRequestCallbackIds.size>0&&(Array.from(WalletLinkRelay.accountRequestCallbackIds.values()).forEach(oo=>{const ao={type:"WEB3_RESPONSE",id:oo,response:{method:"requestEthereumAccounts",result:[io]}};this.invokeCallback(Object.assign(Object.assign({},ao),{id:oo}))}),WalletLinkRelay.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=eo.linkAPIUrl,this.storage=eo.storage;const{session:to,ui:ro,connection:no}=this.subscribe();this._session=to,this.connection=no,this.relayEventManager=new RelayEventManager_1$1.RelayEventManager,this.ui=ro}subscribe(){const eo=WalletLinkSession_1.WalletLinkSession.load(this.storage)||new WalletLinkSession_1.WalletLinkSession(this.storage).save(),{linkAPIUrl:to}=this,ro=new WalletLinkConnection_1.WalletLinkConnection({session:eo,linkAPIUrl:to,listener:this}),no=this.isMobileWeb?new WLMobileRelayUI_1.WLMobileRelayUI:new WalletLinkRelayUI_1.WalletLinkRelayUI;return ro.connect(),{session:eo,ui:no,connection:ro}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(eo=>setTimeout(()=>eo(null),1e3))]).then(()=>{this.connection.destroy();const eo=WalletLinkSession_1.WalletLinkSession.load(this.storage);(eo==null?void 0:eo.id)===this._session.id&&ScopedLocalStorage_1$4.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(eo=>{})}setAppInfo(eo,to){this.appName=eo,this.appLogoUrl=to}getStorageItem(eo){return this.storage.getItem(eo)}setStorageItem(eo,to){this.storage.setItem(eo,to)}signEthereumMessage(eo,to,ro,no){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(eo,!0),address:to,addPrefix:ro,typedDataJson:no||null}})}ethereumAddressFromSignedMessage(eo,to,ro){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(eo,!0),signature:(0,util_2$1.hexStringFromBuffer)(to,!0),addPrefix:ro}})}signEthereumTransaction(eo){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:eo.fromAddress,toAddress:eo.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(eo.weiValue),data:(0,util_2$1.hexStringFromBuffer)(eo.data,!0),nonce:eo.nonce,gasPriceInWei:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxFeePerGas:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxPriorityFeePerGas:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,gasLimit:eo.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(eo.gasLimit):null,chainId:eo.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(eo){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:eo.fromAddress,toAddress:eo.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(eo.weiValue),data:(0,util_2$1.hexStringFromBuffer)(eo.data,!0),nonce:eo.nonce,gasPriceInWei:eo.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(eo.gasPriceInWei):null,maxFeePerGas:eo.maxFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(eo.maxFeePerGas):null,maxPriorityFeePerGas:eo.maxPriorityFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(eo.maxPriorityFeePerGas):null,gasLimit:eo.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(eo.gasLimit):null,chainId:eo.chainId,shouldSubmit:!0}})}submitEthereumTransaction(eo,to){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,util_2$1.hexStringFromBuffer)(eo,!0),chainId:to}})}scanQRCode(eo){return this.sendRequest({method:"scanQRCode",params:{regExp:eo}})}getWalletLinkSession(){return this._session}genericRequest(eo,to){return this.sendRequest({method:"generic",params:{action:to,data:eo}})}sendGenericMessage(eo){return this.sendRequest(eo)}sendRequest(eo){let to=null;const ro=(0,util_2$1.randomBytesHex)(8),no=io=>{this.publishWeb3RequestCanceledEvent(ro),this.handleErrorResponse(ro,eo.method,io),to==null||to()};return new Promise((io,oo)=>{to=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:no,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(ro,ao=>{if(to==null||to(),(0,Web3Response_1$1.isErrorResponse)(ao))return oo(new Error(ao.errorMessage));io(ao)}),this.publishWeb3RequestEvent(ro,eo)})}setAccountsCallback(eo){this.accountsCallback=eo}setChainCallback(eo){this.chainCallback=eo}setDappDefaultChainCallback(eo){this.dappDefaultChain=eo}publishWeb3RequestEvent(eo,to){const ro={type:"WEB3_REQUEST",id:eo,request:to};this.publishEvent("Web3Request",ro,!0).then(no=>{}).catch(no=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:ro.id,response:{method:to.method,errorMessage:no.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(to.method)}openCoinbaseWalletDeeplink(eo){if(this.ui instanceof WLMobileRelayUI_1.WLMobileRelayUI)switch(eo){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(eo){const to={type:"WEB3_REQUEST_CANCELED",id:eo};this.publishEvent("Web3RequestCanceled",to,!1).then()}publishEvent(eo,to,ro){return this.connection.publishEvent(eo,to,ro)}handleWeb3ResponseMessage(eo){const{response:to}=eo;if(to.method==="requestEthereumAccounts"){WalletLinkRelay.accountRequestCallbackIds.forEach(ro=>this.invokeCallback(Object.assign(Object.assign({},eo),{id:ro}))),WalletLinkRelay.accountRequestCallbackIds.clear();return}this.invokeCallback(eo)}handleErrorResponse(eo,to,ro){var no;const io=(no=ro==null?void 0:ro.message)!==null&&no!==void 0?no:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:eo,response:{method:to,errorMessage:io}})}invokeCallback(eo){const to=this.relayEventManager.callbacks.get(eo.id);to&&(to(eo.response),this.relayEventManager.callbacks.delete(eo.id))}requestEthereumAccounts(){const eo={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},to=(0,util_2$1.randomBytesHex)(8);return new Promise((ro,no)=>{this.relayEventManager.callbacks.set(to,io=>{if((0,Web3Response_1$1.isErrorResponse)(io))return no(new Error(io.errorMessage));ro(io)}),WalletLinkRelay.accountRequestCallbackIds.add(to),this.publishWeb3RequestEvent(to,eo)})}watchAsset(eo,to,ro,no,io,oo){const ao={method:"watchAsset",params:{type:eo,options:{address:to,symbol:ro,decimals:no,image:io},chainId:oo}};let so=null;const co=(0,util_2$1.randomBytesHex)(8),lo=uo=>{this.publishWeb3RequestCanceledEvent(co),this.handleErrorResponse(co,ao.method,uo),so==null||so()};return so=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:lo,onResetConnection:this.resetAndReload}),new Promise((uo,ho)=>{this.relayEventManager.callbacks.set(co,go=>{if(so==null||so(),(0,Web3Response_1$1.isErrorResponse)(go))return ho(new Error(go.errorMessage));uo(go)}),this.publishWeb3RequestEvent(co,ao)})}addEthereumChain(eo,to,ro,no,io,oo){const ao={method:"addEthereumChain",params:{chainId:eo,rpcUrls:to,blockExplorerUrls:no,chainName:io,iconUrls:ro,nativeCurrency:oo}};let so=null;const co=(0,util_2$1.randomBytesHex)(8),lo=uo=>{this.publishWeb3RequestCanceledEvent(co),this.handleErrorResponse(co,ao.method,uo),so==null||so()};return so=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:lo,onResetConnection:this.resetAndReload}),new Promise((uo,ho)=>{this.relayEventManager.callbacks.set(co,go=>{if(so==null||so(),(0,Web3Response_1$1.isErrorResponse)(go))return ho(new Error(go.errorMessage));uo(go)}),this.publishWeb3RequestEvent(co,ao)})}switchEthereumChain(eo,to){const ro={method:"switchEthereumChain",params:Object.assign({chainId:eo},{address:to})},no=(0,util_2$1.randomBytesHex)(8);return new Promise((io,oo)=>{this.relayEventManager.callbacks.set(no,ao=>{if((0,Web3Response_1$1.isErrorResponse)(ao)&&ao.errorCode)return oo(error_1$6.standardErrors.provider.custom({code:ao.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Web3Response_1$1.isErrorResponse)(ao))return oo(new Error(ao.errorMessage));io(ao)}),this.publishWeb3RequestEvent(no,ro)})}}WalletLinkRelay$1.WalletLinkRelay=WalletLinkRelay;WalletLinkRelay.accountRequestCallbackIds=new Set;var __importDefault$2=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(WalletLinkSigner$1,"__esModule",{value:!0});WalletLinkSigner$1.WalletLinkSigner=void 0;const eth_eip712_util_1=__importDefault$2(ethEip712Util),constants_1$1=constants$4,RelayEventManager_1=RelayEventManager$1,Web3Response_1=Web3Response,WalletLinkRelay_1=WalletLinkRelay$1,constants_2=constants$3,error_1$5=error$2,util_1$3=util$6,ScopedLocalStorage_1$3=ScopedLocalStorage$1,DEFAULT_CHAIN_ID_KEY="DefaultChainId",DEFAULT_JSON_RPC_URL="DefaultJsonRpcUrl";class WalletLinkSigner{constructor(eo){var to,ro;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:no,appLogoUrl:io}=eo.metadata;this._appName=no,this._appLogoUrl=io,this._storage=new ScopedLocalStorage_1$3.ScopedLocalStorage("walletlink",constants_2.WALLETLINK_URL),this.updateListener=eo.updateListener,this._relayEventManager=new RelayEventManager_1.RelayEventManager,this._jsonRpcUrlFromOpts="";const oo=this._storage.getItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY);if(oo){const so=oo.split(" ");so[0]!==""&&(this._addresses=so.map(co=>(0,util_1$3.ensureAddressString)(co)),(to=this.updateListener)===null||to===void 0||to.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(DEFAULT_CHAIN_ID_KEY)&&((ro=this.updateListener)===null||ro===void 0||ro.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const eo=this.initializeRelay(),{id:to,secret:ro}=eo.getWalletLinkSession();return{id:to,secret:ro}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var eo;return(eo=this._storage.getItem(DEFAULT_JSON_RPC_URL))!==null&&eo!==void 0?eo:this._jsonRpcUrlFromOpts}set jsonRpcUrl(eo){this._storage.setItem(DEFAULT_JSON_RPC_URL,eo)}updateProviderInfo(eo,to){var ro;this.jsonRpcUrl=eo;const no=this.getChainId();this._storage.setItem(DEFAULT_CHAIN_ID_KEY,to.toString(10)),((0,util_1$3.ensureIntNumber)(to)!==no||!this.hasMadeFirstChainChangedEmission)&&((ro=this.updateListener)===null||ro===void 0||ro.onChainUpdate({chain:{id:to,rpcUrl:eo},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(eo,to,ro,no,io,oo){const so=await this.initializeRelay().watchAsset(eo,to,ro,no,io,oo==null?void 0:oo.toString());return(0,Web3Response_1.isErrorResponse)(so)?!1:!!so.result}async addEthereumChain(eo,to,ro,no,io,oo){var ao,so;if((0,util_1$3.ensureIntNumber)(eo)===this.getChainId())return!1;const co=this.initializeRelay();this._isAuthorized()||await co.requestEthereumAccounts();const lo=await co.addEthereumChain(eo.toString(),to,io,ro,no,oo);return(0,Web3Response_1.isErrorResponse)(lo)?!1:(((ao=lo.result)===null||ao===void 0?void 0:ao.isApproved)===!0&&this.updateProviderInfo(to[0],eo),((so=lo.result)===null||so===void 0?void 0:so.isApproved)===!0)}async switchEthereumChain(eo){const ro=await this.initializeRelay().switchEthereumChain(eo.toString(10),this.selectedAddress||void 0);if((0,Web3Response_1.isErrorResponse)(ro)){if(!ro.errorCode)return;throw ro.errorCode===error_1$5.standardErrorCodes.provider.unsupportedChain?error_1$5.standardErrors.provider.unsupportedChain():error_1$5.standardErrors.provider.custom({message:ro.errorMessage,code:ro.errorCode})}const no=ro.result;no.isApproved&&no.rpcUrl.length>0&&this.updateProviderInfo(no.rpcUrl,eo)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(eo){try{return this._request(eo).catch(to=>{throw to})}catch(to){return Promise.reject(to)}}async _request(eo){if(!eo||typeof eo!="object"||Array.isArray(eo))throw error_1$5.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:eo});const{method:to,params:ro}=eo;if(typeof to!="string"||to.length===0)throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:eo});if(ro!==void 0&&!Array.isArray(ro)&&(typeof ro!="object"||ro===null))throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:eo});const no=ro===void 0?[]:ro,io=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:to,params:no,jsonrpc:"2.0",id:io})).result}_setAddresses(eo,to){var ro;if(!Array.isArray(eo))throw new Error("addresses is not an array");const no=eo.map(io=>(0,util_1$3.ensureAddressString)(io));JSON.stringify(no)!==JSON.stringify(this._addresses)&&(this._addresses=no,(ro=this.updateListener)===null||ro===void 0||ro.onAccountsUpdate({accounts:no,source:"wallet"}),this._storage.setItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY,no.join(" ")))}_sendRequestAsync(eo){return new Promise((to,ro)=>{try{const no=this._handleSynchronousMethods(eo);if(no!==void 0)return to({jsonrpc:"2.0",id:eo.id,result:no})}catch(no){return ro(no)}this._handleAsynchronousMethods(eo).then(no=>no&&to(Object.assign(Object.assign({},no),{id:eo.id}))).catch(no=>ro(no))})}_handleSynchronousMethods(eo){const{method:to}=eo;switch(to){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(eo){const{method:to}=eo,ro=eo.params||[];switch(to){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(ro);case"eth_ecRecover":return this._eth_ecRecover(ro);case"personal_sign":return this._personal_sign(ro);case"personal_ecRecover":return this._personal_ecRecover(ro);case"eth_signTransaction":return this._eth_signTransaction(ro);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(ro);case"eth_sendTransaction":return this._eth_sendTransaction(ro);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(ro);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(ro);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(ro);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(ro);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(ro);case"wallet_watchAsset":return this._wallet_watchAsset(ro);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(eo){try{const to=(0,util_1$3.ensureAddressString)(eo);return this._addresses.map(no=>(0,util_1$3.ensureAddressString)(no)).includes(to)}catch{}return!1}_ensureKnownAddress(eo){if(!this._isKnownAddress(eo))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(eo){const to=eo.from?(0,util_1$3.ensureAddressString)(eo.from):this.selectedAddress;if(!to)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(to);const ro=eo.to?(0,util_1$3.ensureAddressString)(eo.to):null,no=eo.value!=null?(0,util_1$3.ensureBigInt)(eo.value):BigInt(0),io=eo.data?(0,util_1$3.ensureBuffer)(eo.data):Buffer$3.alloc(0),oo=eo.nonce!=null?(0,util_1$3.ensureIntNumber)(eo.nonce):null,ao=eo.gasPrice!=null?(0,util_1$3.ensureBigInt)(eo.gasPrice):null,so=eo.maxFeePerGas!=null?(0,util_1$3.ensureBigInt)(eo.maxFeePerGas):null,co=eo.maxPriorityFeePerGas!=null?(0,util_1$3.ensureBigInt)(eo.maxPriorityFeePerGas):null,lo=eo.gas!=null?(0,util_1$3.ensureBigInt)(eo.gas):null,uo=eo.chainId?(0,util_1$3.ensureIntNumber)(eo.chainId):this.getChainId();return{fromAddress:to,toAddress:ro,weiValue:no,data:io,nonce:oo,gasPriceInWei:ao,maxFeePerGas:so,maxPriorityFeePerGas:co,gasLimit:lo,chainId:uo}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw error_1$5.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw error_1$5.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(eo,to,ro,no){this._ensureKnownAddress(to);try{const oo=await this.initializeRelay().signEthereumMessage(eo,to,ro,no);if((0,Web3Response_1.isErrorResponse)(oo))throw new Error(oo.errorMessage);return{jsonrpc:"2.0",id:0,result:oo.result}}catch(io){throw typeof io.message=="string"&&io.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied message signature"):io}}async _ethereumAddressFromSignedMessage(eo,to,ro){const io=await this.initializeRelay().ethereumAddressFromSignedMessage(eo,to,ro);if((0,Web3Response_1.isErrorResponse)(io))throw new Error(io.errorMessage);return{jsonrpc:"2.0",id:0,result:io.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,util_1$3.hexStringFromIntNumber)(this.getChainId())}getChainId(){const eo=this._storage.getItem(DEFAULT_CHAIN_ID_KEY);if(!eo)return(0,util_1$3.ensureIntNumber)(1);const to=parseInt(eo,10);return(0,util_1$3.ensureIntNumber)(to)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let eo;try{if(eo=await this.initializeRelay().requestEthereumAccounts(),(0,Web3Response_1.isErrorResponse)(eo))throw new Error(eo.errorMessage)}catch(to){throw typeof to.message=="string"&&to.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied account authorization"):to}if(!eo.result)throw new Error("accounts received is empty");return this._setAddresses(eo.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._signEthereumMessage(ro,to,!1)}_eth_ecRecover(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._ethereumAddressFromSignedMessage(to,ro,!1)}_personal_sign(eo){this._requireAuthorization();const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureAddressString)(eo[1]);return this._signEthereumMessage(to,ro,!0)}_personal_ecRecover(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),ro=(0,util_1$3.ensureBuffer)(eo[1]);return this._ethereumAddressFromSignedMessage(to,ro,!0)}async _eth_signTransaction(eo){this._requireAuthorization();const to=this._prepareTransactionParams(eo[0]||{});try{const no=await this.initializeRelay().signEthereumTransaction(to);if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}catch(ro){throw typeof ro.message=="string"&&ro.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):ro}}async _eth_sendRawTransaction(eo){const to=(0,util_1$3.ensureBuffer)(eo[0]),no=await this.initializeRelay().submitEthereumTransaction(to,this.getChainId());if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}async _eth_sendTransaction(eo){this._requireAuthorization();const to=this._prepareTransactionParams(eo[0]||{});try{const no=await this.initializeRelay().signAndSubmitEthereumTransaction(to);if((0,Web3Response_1.isErrorResponse)(no))throw new Error(no.errorMessage);return{jsonrpc:"2.0",id:0,result:no.result}}catch(ro){throw typeof ro.message=="string"&&ro.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):ro}}async _eth_signTypedData_v1(eo){this._requireAuthorization();const to=(0,util_1$3.ensureParsedJSONObject)(eo[0]),ro=(0,util_1$3.ensureAddressString)(eo[1]);this._ensureKnownAddress(ro);const no=eth_eip712_util_1.default.hashForSignTypedDataLegacy({data:to}),io=JSON.stringify(to,null,2);return this._signEthereumMessage(no,ro,!1,io)}async _eth_signTypedData_v3(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureParsedJSONObject)(eo[1]);this._ensureKnownAddress(to);const no=eth_eip712_util_1.default.hashForSignTypedData_v3({data:ro}),io=JSON.stringify(ro,null,2);return this._signEthereumMessage(no,to,!1,io)}async _eth_signTypedData_v4(eo){this._requireAuthorization();const to=(0,util_1$3.ensureAddressString)(eo[0]),ro=(0,util_1$3.ensureParsedJSONObject)(eo[1]);this._ensureKnownAddress(to);const no=eth_eip712_util_1.default.hashForSignTypedData_v4({data:ro}),io=JSON.stringify(ro,null,2);return this._signEthereumMessage(no,to,!1,io)}async _wallet_addEthereumChain(eo){var to,ro,no,io;const oo=eo[0];if(((to=oo.rpcUrls)===null||to===void 0?void 0:to.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!oo.chainName||oo.chainName.trim()==="")throw error_1$5.standardErrors.rpc.invalidParams("chainName is a required field");if(!oo.nativeCurrency)throw error_1$5.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const ao=parseInt(oo.chainId,16);return await this.addEthereumChain(ao,(ro=oo.rpcUrls)!==null&&ro!==void 0?ro:[],(no=oo.blockExplorerUrls)!==null&&no!==void 0?no:[],oo.chainName,(io=oo.iconUrls)!==null&&io!==void 0?io:[],oo.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(eo){const to=eo[0];return await this.switchEthereumChain(parseInt(to.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(eo){const to=Array.isArray(eo)?eo[0]:eo;if(!to.type)throw error_1$5.standardErrors.rpc.invalidParams("Type is required");if((to==null?void 0:to.type)!=="ERC20")throw error_1$5.standardErrors.rpc.invalidParams(`Asset of type '${to.type}' is not supported`);if(!(to!=null&&to.options))throw error_1$5.standardErrors.rpc.invalidParams("Options are required");if(!(to!=null&&to.options.address))throw error_1$5.standardErrors.rpc.invalidParams("Address is required");const ro=this.getChainId(),{address:no,symbol:io,image:oo,decimals:ao}=to.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(to.type,no,io,ao,oo,ro)}}initializeRelay(){if(!this._relay){const eo=new WalletLinkRelay_1.WalletLinkRelay({linkAPIUrl:constants_2.WALLETLINK_URL,storage:this._storage});eo.setAppInfo(this._appName,this._appLogoUrl),eo.attachUI(),eo.setAccountsCallback((to,ro)=>this._setAddresses(to,ro)),eo.setChainCallback((to,ro)=>{this.updateProviderInfo(ro,parseInt(to,10))}),this._relay=eo}return this._relay}}WalletLinkSigner$1.WalletLinkSigner=WalletLinkSigner;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});provider.checkErrorForInvalidRequestArgs=provider.getCoinbaseInjectedProvider=provider.getCoinbaseInjectedSigner=provider.fetchRPCRequest=void 0;const version_1$2=version$b,error_1$4=error$2;async function fetchRPCRequest(Xr,eo){if(!eo.rpcUrl)throw error_1$4.standardErrors.rpc.internal("No RPC URL set for chain");const to=Object.assign(Object.assign({},Xr),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(eo.rpcUrl,{method:"POST",body:JSON.stringify(to),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":version_1$2.LIB_VERSION}})).json()).result}provider.fetchRPCRequest=fetchRPCRequest;function getCoinbaseInjectedSigner(){return globalThis.coinbaseWalletSigner}provider.getCoinbaseInjectedSigner=getCoinbaseInjectedSigner;function getCoinbaseInjectedLegacyProvider(){return globalThis.coinbaseWalletExtension}function getInjectedEthereum(){var Xr,eo;try{const to=globalThis;return(Xr=to.ethereum)!==null&&Xr!==void 0?Xr:(eo=to.top)===null||eo===void 0?void 0:eo.ethereum}catch{return}}function getCoinbaseInjectedProvider({metadata:Xr,preference:eo}){var to;if(eo.options!=="smartWalletOnly"){if(getCoinbaseInjectedSigner())return;const io=getCoinbaseInjectedLegacyProvider();if(io){const{appName:oo,appLogoUrl:ao,appChainIds:so}=Xr;return(to=io.setAppInfo)===null||to===void 0||to.call(io,oo,ao,so),io}}const ro=getInjectedEthereum();if(ro!=null&&ro.isCoinbaseBrowser)return ro}provider.getCoinbaseInjectedProvider=getCoinbaseInjectedProvider;function checkErrorForInvalidRequestArgs(Xr){if(!Xr||typeof Xr!="object"||Array.isArray(Xr))return error_1$4.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:Xr});const{method:eo,params:to}=Xr;if(typeof eo!="string"||eo.length===0)return error_1$4.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:Xr});if(to!==void 0&&!Array.isArray(to)&&(typeof to!="object"||to===null))return error_1$4.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:Xr})}provider.checkErrorForInvalidRequestArgs=checkErrorForInvalidRequestArgs;Object.defineProperty(util$5,"__esModule",{value:!0});util$5.createSigner=util$5.fetchSignerType=util$5.storeSignerType=util$5.loadSignerType=void 0;const SCWSigner_1=SCWSigner$1,WalletLinkSigner_1=WalletLinkSigner$1,error_1$3=error$2,provider_1$2=provider,ScopedLocalStorage_1$2=ScopedLocalStorage$1,SIGNER_TYPE_KEY="SignerType",storage$1=new ScopedLocalStorage_1$2.ScopedLocalStorage("CBWSDK","SignerConfigurator");function loadSignerType(){return storage$1.getItem(SIGNER_TYPE_KEY)}util$5.loadSignerType=loadSignerType;function storeSignerType(Xr){storage$1.setItem(SIGNER_TYPE_KEY,Xr)}util$5.storeSignerType=storeSignerType;async function fetchSignerType(Xr){const{communicator:eo,metadata:to}=Xr;listenForWalletLinkSessionRequest(eo,to).catch(()=>{});const ro={id:crypto.randomUUID(),event:"selectSignerType",data:Xr.preference},{data:no}=await eo.postRequestAndWaitForResponse(ro);return no}util$5.fetchSignerType=fetchSignerType;function createSigner(Xr){const{signerType:eo,metadata:to,communicator:ro,updateListener:no}=Xr;switch(eo){case"scw":return new SCWSigner_1.SCWSigner({metadata:to,updateListener:no,communicator:ro});case"walletlink":return new WalletLinkSigner_1.WalletLinkSigner({metadata:to,updateListener:no});case"extension":{const io=(0,provider_1$2.getCoinbaseInjectedSigner)();if(!io)throw error_1$3.standardErrors.rpc.internal("injected signer not found");return io}}}util$5.createSigner=createSigner;async function listenForWalletLinkSessionRequest(Xr,eo){await Xr.onMessage(({event:ro})=>ro==="WalletLinkSessionRequest");const to=new WalletLinkSigner_1.WalletLinkSigner({metadata:eo});Xr.postMessage({event:"WalletLinkUpdate",data:{session:to.getSession()}}),await to.handshake(),Xr.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Communicator$1={},util={};Object.defineProperty(util,"__esModule",{value:!0});util.closePopup=util.openPopup=void 0;const error_1$2=error$2,POPUP_WIDTH=420,POPUP_HEIGHT=540;function openPopup(Xr){const eo=(window.innerWidth-POPUP_WIDTH)/2+window.screenX,to=(window.innerHeight-POPUP_HEIGHT)/2+window.screenY,ro=window.open(Xr,"Smart Wallet",`width=${POPUP_WIDTH}, height=${POPUP_HEIGHT}, left=${eo}, top=${to}`);if(ro==null||ro.focus(),!ro)throw error_1$2.standardErrors.rpc.internal("Pop up window failed to open");return ro}util.openPopup=openPopup;function closePopup(Xr){Xr&&!Xr.closed&&Xr.close()}util.closePopup=closePopup;Object.defineProperty(Communicator$1,"__esModule",{value:!0});Communicator$1.Communicator=void 0;const version_1$1=version$b,util_1$2=util,constants_1=constants$3,error_1$1=error$2;class Communicator{constructor(eo=constants_1.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async to=>{(await this.waitForPopupLoaded()).postMessage(to,this.url.origin)},this.postRequestAndWaitForResponse=async to=>{const ro=this.onMessage(({requestId:no})=>no===to.id);return this.postMessage(to),await ro},this.onMessage=async to=>new Promise((ro,no)=>{const io=oo=>{if(oo.origin!==this.url.origin)return;const ao=oo.data;to(ao)&&(ro(ao),window.removeEventListener("message",io),this.listeners.delete(io))};window.addEventListener("message",io),this.listeners.set(io,{reject:no})}),this.disconnect=()=>{(0,util_1$2.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:to},ro)=>{to(error_1$1.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",ro)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,util_1$2.openPopup)(this.url),this.onMessage(({event:to})=>to==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:to})=>to==="PopupLoaded").then(to=>{this.postMessage({requestId:to.id,data:{version:version_1$1.LIB_VERSION}})}).then(()=>{if(!this.popup)throw error_1$1.standardErrors.rpc.internal();return this.popup})),this.url=new URL(eo)}}Communicator$1.Communicator=Communicator;var method={};Object.defineProperty(method,"__esModule",{value:!0});method.determineMethodCategory=void 0;const mapping={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function determineMethodCategory(Xr){for(const eo in mapping){const to=eo;if(mapping[to].includes(Xr))return to}}method.determineMethodCategory=determineMethodCategory;var __rest$2=commonjsGlobal&&commonjsGlobal.__rest||function(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{try{if(this.connected)return this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),this.accounts;const lo=await this.requestSignerSelection(),uo=this.initSigner(lo),ho=await uo.handshake();return this.signer=uo,(0,util_2.storeSignerType)(lo),this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),ho}catch(lo){throw this.handleUnauthorizedError(lo),lo}},sign:async co=>{if(!this.connected||!this.signer)throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(co)}catch(lo){throw this.handleUnauthorizedError(lo),lo}},fetch:co=>(0,provider_1$1.fetchRPCRequest)(co,this.chain),state:co=>{const lo=()=>{if(this.connected)return this.accounts;throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(co.method){case"eth_chainId":return(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return lo();case"eth_coinbase":return lo()[0];default:return this.handlers.unsupported(co)}},deprecated:({method:co})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${co} is deprecated.`)},unsupported:({method:co})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${co} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:co,source:lo})=>{(0,util_1$1.areAddressArraysEqual)(this.accounts,co)||(this.accounts=co,lo!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:co,source:lo})=>{co.id===this.chain.id&&co.rpcUrl===this.chain.rpcUrl||(this.chain=co,lo!=="storage"&&this.emit("chainChanged",(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(co.id))))}},this.metadata=no,this.preference=ao,this.communicator=new Communicator_1.Communicator(oo),this.chain={id:(ro=(to=no.appChainIds)===null||to===void 0?void 0:to[0])!==null&&ro!==void 0?ro:1};const so=(0,util_2.loadSignerType)();this.signer=so?this.initSigner(so):null}get connected(){return this.accounts.length>0}async request(eo){var to;try{const ro=(0,provider_1$1.checkErrorForInvalidRequestArgs)(eo);if(ro)throw ro;const no=(to=(0,method_1.determineMethodCategory)(eo.method))!==null&&to!==void 0?to:"fetch";return this.handlers[no](eo)}catch(ro){return Promise.reject((0,serialize_1$1.serializeError)(ro,eo.method))}}handleUnauthorizedError(eo){eo.code===error_1.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},ScopedLocalStorage_1$1.ScopedLocalStorage.clearAll(),this.emit("disconnect",error_1.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,util_2.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(eo){return(0,util_2.createSigner)({signerType:eo,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}CoinbaseWalletProvider$1.CoinbaseWalletProvider=CoinbaseWalletProvider;Object.defineProperty(CoinbaseWalletSDK$1,"__esModule",{value:!0});CoinbaseWalletSDK$1.CoinbaseWalletSDK=void 0;const wallet_logo_1=walletLogo$1,CoinbaseWalletProvider_1=CoinbaseWalletProvider$1,ScopedLocalStorage_1=ScopedLocalStorage$1,version_1=version$b,util_1=util$6,provider_1=provider;class CoinbaseWalletSDK{constructor(eo){this.metadata={appName:eo.appName||"Dapp",appLogoUrl:eo.appLogoUrl||(0,util_1.getFavicon)(),appChainIds:eo.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(eo={options:"all"}){var to;const ro={metadata:this.metadata,preference:eo};return(to=(0,provider_1.getCoinbaseInjectedProvider)(ro))!==null&&to!==void 0?to:new CoinbaseWalletProvider_1.CoinbaseWalletProvider(ro)}getCoinbaseWalletLogo(eo,to=240){return(0,wallet_logo_1.walletLogo)(eo,to)}storeLatestVersion(){new ScopedLocalStorage_1.ScopedLocalStorage("CBWSDK").setItem("VERSION",version_1.LIB_VERSION)}}CoinbaseWalletSDK$1.CoinbaseWalletSDK=CoinbaseWalletSDK;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.CoinbaseWalletSDK=void 0;const eo=CoinbaseWalletSDK$1;Xr.default=eo.CoinbaseWalletSDK;var to=CoinbaseWalletSDK$1;Object.defineProperty(Xr,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return to.CoinbaseWalletSDK}})})(dist);let coinbaseProvider;const baseSepolia=84532,baseMainnet=8453,getCoinbaseProvider=({appLogoUrl:Xr,appName:eo,evmNetworks:to,walletPreference:ro}={})=>{const no=to==null?void 0:to.map(ao=>Number(ao.chainId));return(to==null?void 0:to.some(ao=>ao.chainId===baseSepolia))&&(no==null||no.sort((ao,so)=>ao===baseSepolia?-1:so===baseSepolia?1:0)),(to==null?void 0:to.some(ao=>ao.chainId===baseMainnet))&&(no==null||no.sort((ao,so)=>ao===baseMainnet?-1:so===baseMainnet?1:0)),coinbaseProvider||(coinbaseProvider=new dist.CoinbaseWalletSDK({appChainIds:no,appLogoUrl:Xr,appName:eo}).makeWeb3Provider({options:ro??"all"})),coinbaseProvider};class Coinbase extends EthereumWalletConnector{constructor(eo){var{appName:to,appLogoUrl:ro,evmNetworks:no,coinbaseWalletPreference:io}=eo,oo=__rest$6(eo,["appName","appLogoUrl","evmNetworks","coinbaseWalletPreference"]);super(Object.assign({evmNetworks:no},oo)),this.name="Coinbase",this.overrideKey="coinbase",this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.canConnectViaQrCode=!1,this.canConnectViaCustodialService=!this.isInstalledOnBrowser(),this.coinbaseProviderOpts={appLogoUrl:ro,appName:to,evmNetworks:no,walletPreference:io}}get coinbaseProvider(){return getCoinbaseProvider(this.coinbaseProviderOpts)}getConnectedAccounts(){return __awaiter$a(this,void 0,void 0,function*(){try{const eo=yield this.coinbaseProvider.request({method:"eth_accounts"});return eo[0]&&this.setActiveAccount(eo[0]),eo}catch{return[]}})}isInstalledOnBrowser(){var eo;return!!(!((eo=window==null?void 0:window.coinbaseWalletExtension)===null||eo===void 0)&&eo.isCoinbaseWallet)}getAddress(){return __awaiter$a(this,void 0,void 0,function*(){const[eo]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});return this.setActiveAccount(eo),eo})}signMessage(eo){return __awaiter$a(this,void 0,void 0,function*(){const[to]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});try{return yield this.coinbaseProvider.request({method:"personal_sign",params:[toHex$1(toBytes$1(eo)),to.toLowerCase()]})}catch{return}})}setupEventListeners(){const{handleAccountChange:eo,handleChainChange:to,handleDisconnect:ro}=eventListenerHandlers(this);this.coinbaseProvider.on("accountsChanged",eo),this.coinbaseProvider.on("chainChanged",to),this.coinbaseProvider.on("disconnect",ro),this.teardownEventListeners=()=>{this.coinbaseProvider.removeListener("accountsChanged",eo),this.coinbaseProvider.removeListener("chainChanged",to),this.coinbaseProvider.removeListener("disconnect",ro)}}getWalletClient(eo){return createWalletClient({account:this.getActiveAccount(),chain:eo?chainsMap[eo]:void 0,transport:custom$1(this.coinbaseProvider)})}}assertPackageVersion("@dynamic-labs/ethereum",version$c);const EthereumWalletConnectors=Xr=>[...injectedWalletOverrides$1,...fetchInjectedWalletConnector(Xr),...fetchWalletConnectWallets(Xr),...TurnkeyEVMWalletConnectors(Xr),Coinbase,UnknownInjected$1,FallbackEvmConnector,getWalletConnectConnector()];var version$a="3.5.1";function __awaiter$6(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let config$1=null;const setConfig=Xr=>{config$1=Xr};let LEVELS=function(Xr){return Xr[Xr.debug=5]="debug",Xr[Xr.info=4]="info",Xr[Xr.log=3]="log",Xr[Xr.warn=2]="warn",Xr[Xr.error=1]="error",Xr}({});const buildLoggerMessageArgs=Xr=>{const{title:eo,message:to}=Xr;return[` %c${eo} ============================ @@ -2347,7 +4177,7 @@ You can learn more (including a guide on common transition paths) here: ${ro}`:" --- -`),so}}let getRandomValues$1;const rnds8$1=new Uint8Array(16);function rng$1(){if(!getRandomValues$1&&(getRandomValues$1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues$1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues$1(rnds8$1)}const byteToHex$1=[];for(let Xr=0;Xr<256;++Xr)byteToHex$1.push((Xr+256).toString(16).slice(1));function unsafeStringify(Xr,eo=0){return byteToHex$1[Xr[eo+0]]+byteToHex$1[Xr[eo+1]]+byteToHex$1[Xr[eo+2]]+byteToHex$1[Xr[eo+3]]+"-"+byteToHex$1[Xr[eo+4]]+byteToHex$1[Xr[eo+5]]+"-"+byteToHex$1[Xr[eo+6]]+byteToHex$1[Xr[eo+7]]+"-"+byteToHex$1[Xr[eo+8]]+byteToHex$1[Xr[eo+9]]+"-"+byteToHex$1[Xr[eo+10]]+byteToHex$1[Xr[eo+11]]+byteToHex$1[Xr[eo+12]]+byteToHex$1[Xr[eo+13]]+byteToHex$1[Xr[eo+14]]+byteToHex$1[Xr[eo+15]]}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4$1(Xr,eo,to){if(native.randomUUID&&!eo&&!Xr)return native.randomUUID();Xr=Xr||{};const ro=Xr.random||(Xr.rng||rng$1)();return ro[6]=ro[6]&15|64,ro[8]=ro[8]&63|128,unsafeStringify(ro)}var InteractionTag=function(Xr){return Xr.UNKNOWN="UNKNOWN",Xr.SCRIPT="SCRIPT",Xr.TRANSACTION="TRANSACTION",Xr.GET_TRANSACTION_STATUS="GET_TRANSACTION_STATUS",Xr.GET_ACCOUNT="GET_ACCOUNT",Xr.GET_EVENTS="GET_EVENTS",Xr.PING="PING",Xr.GET_TRANSACTION="GET_TRANSACTION",Xr.GET_BLOCK="GET_BLOCK",Xr.GET_BLOCK_HEADER="GET_BLOCK_HEADER",Xr.GET_COLLECTION="GET_COLLECTION",Xr.GET_NETWORK_PARAMETERS="GET_NETWORK_PARAMETERS",Xr.SUBSCRIBE_EVENTS="SUBSCRIBE_EVENTS",Xr.GET_NODE_VERSION_INFO="GET_NODE_VERSION_INFO",Xr}({}),InteractionStatus=function(Xr){return Xr.BAD="BAD",Xr.OK="OK",Xr}({}),TransactionRole=function(Xr){return Xr.AUTHORIZER="authorizer",Xr.PAYER="payer",Xr.PROPOSER="proposer",Xr}({}),InteractionResolverKind=function(Xr){return Xr.ARGUMENT="ARGUMENT",Xr.ACCOUNT="ACCOUNT",Xr}({});const mailbox=()=>{const Xr=[];let eo;return{async deliver(to){Xr.push(to),eo&&(eo(Xr.shift()),eo=void 0)},receive(){return new Promise(function(ro){const no=Xr.shift();if(no)return ro(no);eo=ro})}}};let promise;const _queueMicrotask=Xr=>(promise||(promise=Promise.resolve())).then(Xr).catch(eo=>setTimeout(()=>{throw eo},0)),INIT="INIT",SUBSCRIBE="SUBSCRIBE",UNSUBSCRIBE="UNSUBSCRIBE",UPDATED$2="UPDATED",EXIT="EXIT",TERMINATE="TERMINATE",root=typeof self=="object"&&self.self===self&&self||typeof global$1=="object"&&global$1.global===global$1&&global$1||typeof window=="object"&&window.window===window&&window||{FCL_REGISTRY:null};root.FCL_REGISTRY=root.FCL_REGISTRY==null?{}:root.FCL_REGISTRY;const FCL_REGISTRY=root.FCL_REGISTRY;let pid=0;const DEFAULT_TIMEOUT=5e3;function send$2(Xr,eo,to){let ro=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{expectReply:!1};return new Promise((no,io)=>{const oo=ro.expectReply||!1,ao=ro.timeout!=null?ro.timeout:DEFAULT_TIMEOUT;oo&&ao&&setTimeout(()=>io(new Error(`Timeout: ${ao}ms passed without a response.`)),ao);const so={to:Xr,from:ro.from,tag:eo,data:to,timeout:ao,reply:no,reject:io};try{FCL_REGISTRY[Xr]&&FCL_REGISTRY[Xr].mailbox.deliver(so),oo||no(!0)}catch(co){console.error("FCL.Actor -- Could Not Deliver Message",so,FCL_REGISTRY[Xr],co),io(co)}})}const kill=Xr=>{delete FCL_REGISTRY[Xr]},fromHandlers=Xr=>async eo=>{var to;typeof Xr[INIT]=="function"&&await Xr[INIT](eo);e:for(;;){const ro=await eo.receive();try{if(ro.tag===EXIT){typeof Xr[TERMINATE]=="function"&&await Xr[TERMINATE](eo,ro,ro.data||{});break e}await((to=Xr[ro.tag])==null?void 0:to.call(Xr,eo,ro,ro.data||{}))}catch(no){console.error(`${eo.self()} Error`,ro,no)}finally{continue e}}},parseAddr=Xr=>Xr==null?String(++pid):String(Xr),spawn=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const to=parseAddr(eo);if(FCL_REGISTRY[to]!=null)return to;FCL_REGISTRY[to]={addr:to,mailbox:mailbox(),subs:new Set,kvs:{},error:null};const ro=createCtx(to);let no;return typeof Xr=="object"?no=fromHandlers(Xr):no=Xr,_queueMicrotask(async()=>{await no(ro),kill(to)}),to},createCtx=Xr=>({self:()=>Xr,receive:()=>FCL_REGISTRY[Xr].mailbox.receive(),send:function(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(eo!=null)return no.from=Xr,send$2(eo,to,ro,no)},sendSelf:function(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};FCL_REGISTRY[Xr]&&send$2(Xr,eo,to,ro)},broadcast:function(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ro.from=Xr;for(const no of FCL_REGISTRY[Xr].subs)send$2(no,eo,to,ro)},subscribe:eo=>eo!=null&&FCL_REGISTRY[Xr].subs.add(eo),unsubscribe:eo=>eo!=null&&FCL_REGISTRY[Xr].subs.delete(eo),subscriberCount:()=>FCL_REGISTRY[Xr].subs.size,hasSubs:()=>!!FCL_REGISTRY[Xr].subs.size,put:(eo,to)=>{eo!=null&&(FCL_REGISTRY[Xr].kvs[eo]=to)},get:function(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;const ro=FCL_REGISTRY[Xr].kvs[eo];return ro??to},delete:eo=>{delete FCL_REGISTRY[Xr].kvs[eo]},update:(eo,to)=>{eo!=null&&(FCL_REGISTRY[Xr].kvs[eo]=to(FCL_REGISTRY[Xr].kvs[eo]))},keys:()=>Object.keys(FCL_REGISTRY[Xr].kvs),all:()=>FCL_REGISTRY[Xr].kvs,where:eo=>Object.keys(FCL_REGISTRY[Xr].kvs).reduce((to,ro)=>eo.test(ro)?{...to,[ro]:FCL_REGISTRY[Xr].kvs[ro]}:to,{}),merge:function(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Object.keys(eo).forEach(to=>FCL_REGISTRY[Xr].kvs[to]=eo[to])},fatalError:eo=>{FCL_REGISTRY[Xr].error=eo;for(const to of FCL_REGISTRY[Xr].subs)send$2(to,UPDATED$2)}});function subscriber(Xr,eo,to){eo(Xr);const ro=spawn(async no=>{for(no.send(Xr,SUBSCRIBE);;){const io=await no.receive(),oo=FCL_REGISTRY[Xr].error;if(io.tag===EXIT){no.send(Xr,UNSUBSCRIBE);return}if(oo){to(null,oo),no.send(Xr,UNSUBSCRIBE);return}to(io.data,null)}});return()=>send$2(ro,EXIT)}const pipe$2=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;toeo.reduce((no,io)=>io(no),ro)},mergePipe=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;toeo.reduce((no,io)=>({...no,...io(ro)}),{})},isObject$7=Xr=>Xr&&typeof Xr=="object"&&!Array.isArray(Xr),mergeDeep=function(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;roArray.isArray(Xr)?mergeDeep({},...Xr):Xr,filterContracts=Xr=>Xr.contracts?Xr.contracts:{},filterDependencies=Xr=>Xr.dependencies?Xr.dependencies:{},mapContractAliasesToNetworkAddress=Xr=>eo=>Object.entries(eo).reduce((to,ro)=>{var ao;let[no,io]=ro;const oo=(ao=io==null?void 0:io.aliases)==null?void 0:ao[Xr];return oo&&(to[no]=oo),to},{}),mapDependencyAliasesToNetworkAddress=Xr=>eo=>Object.entries(eo).reduce((to,ro)=>{var ao;let[no,io]=ro;const oo=(ao=io==null?void 0:io.aliases)==null?void 0:ao[Xr];return oo&&(to[no]=oo),to},{}),mapDeploymentsToNetworkAddress=Xr=>eo=>{let{deployments:to={},accounts:ro={}}=eo;const no=to==null?void 0:to[Xr];return no?Object.entries(no).reduce((io,oo)=>{var lo;let[ao,so]=oo;const co=(lo=ro[ao])==null?void 0:lo.address;return co?so.reduce((fo,ho)=>({...fo,[ho]:co}),{}):io},{}):{}},getContracts=(Xr,eo)=>pipe$2(mergeFlowJSONs,mergePipe(mapDeploymentsToNetworkAddress(eo),pipe$2(filterContracts,mapContractAliasesToNetworkAddress(eo)),pipe$2(filterDependencies,mapDependencyAliasesToNetworkAddress(eo))))(Xr),isHexidecimal=Xr=>typeof Xr!="string"?!1:/^[0-9A-Fa-f]+$/.test(Xr),hasPrivateKeys=Xr=>Object.entries((Xr==null?void 0:Xr.accounts)??[]).reduce((eo,to)=>{let[,ro]=to;return eo?!0:ro&&Object.prototype.hasOwnProperty.call(ro,"key")&&isHexidecimal(ro==null?void 0:ro.key)},!1),anyHasPrivateKeys=Xr=>Array.isArray(Xr)?Xr.some(hasPrivateKeys):hasPrivateKeys(Xr),cleanNetwork=Xr=>{const eo=(Xr==null?void 0:Xr.toLowerCase())==="local"?"emulator":Xr==null?void 0:Xr.toLowerCase();if(eo==="emulator"||eo==="testnet"||eo==="mainnet")return eo;throw new Error(`Invalid network "${Xr}". Must be one of "emulator", "local", "testnet", or "mainnet"`)};setConfig(config);const NAME$2="config",PUT="PUT_CONFIG",GET="GET_CONFIG",GET_ALL="GET_ALL_CONFIG",UPDATE="UPDATE_CONFIG",DELETE="DELETE_CONFIG",CLEAR="CLEAR_CONFIG",WHERE="WHERE_CONFIG",UPDATED$1="CONFIG/UPDATED",identity=Xr=>Xr,HANDLERS$1={[PUT]:(Xr,eo,to)=>{let{key:ro,value:no}=to;if(ro==null)throw new Error("Missing 'key' for config/put.");Xr.put(ro,no),Xr.broadcast(UPDATED$1,{...Xr.all()})},[GET]:(Xr,eo,to)=>{let{key:ro,fallback:no}=to;if(ro==null)throw new Error("Missing 'key' for config/get");eo.reply(Xr.get(ro,no))},[GET_ALL]:(Xr,eo)=>{eo.reply({...Xr.all()})},[UPDATE]:(Xr,eo,to)=>{let{key:ro,fn:no}=to;if(ro==null)throw new Error("Missing 'key' for config/update");Xr.update(ro,no||identity),Xr.broadcast(UPDATED$1,{...Xr.all()})},[DELETE]:(Xr,eo,to)=>{let{key:ro}=to;if(ro==null)throw new Error("Missing 'key' for config/delete");Xr.delete(ro),Xr.broadcast(UPDATED$1,{...Xr.all()})},[CLEAR]:Xr=>{const eo=Object.keys(Xr.all());for(const to of eo)Xr.delete(to);Xr.broadcast(UPDATED$1,{...Xr.all()})},[WHERE]:(Xr,eo,to)=>{let{pattern:ro}=to;if(ro==null)throw new Error("Missing 'pattern' for config/where");eo.reply(Xr.where(ro))},[SUBSCRIBE]:(Xr,eo)=>{Xr.subscribe(eo.from),Xr.send(eo.from,UPDATED$1,{...Xr.all()})},[UNSUBSCRIBE]:(Xr,eo)=>{Xr.unsubscribe(eo.from)}};spawn(HANDLERS$1,NAME$2);function put$1(Xr,eo){return send$2(NAME$2,PUT,{key:Xr,value:eo}),config()}function get$1(Xr,eo){return send$2(NAME$2,GET,{key:Xr,fallback:eo},{expectReply:!0,timeout:10})}async function first(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1?arguments[1]:void 0;if(!Xr.length)return eo;const[to,...ro]=Xr,no=await get$1(to);return no??first(ro,eo)}function all(){return send$2(NAME$2,GET_ALL,null,{expectReply:!0,timeout:10})}function update$1(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:identity;return send$2(NAME$2,UPDATE,{key:Xr,fn:eo}),config()}function _delete(Xr){return send$2(NAME$2,DELETE,{key:Xr}),config()}function where(Xr){return send$2(NAME$2,WHERE,{pattern:Xr},{expectReply:!0,timeout:10})}function subscribe$1(Xr){return subscriber(NAME$2,()=>spawn(HANDLERS$1,NAME$2),Xr)}async function clearConfig(){await send$2(NAME$2,CLEAR)}async function resetConfig(Xr){return clearConfig().then(()=>config(Xr))}async function load(Xr){const eo=await get$1("flow.network"),to=cleanNetwork(eo),{flowJSON:ro}=Xr;if(invariant$1(!!ro,"config.load -- 'flowJSON' must be defined"),invariant$1(!!to,'Flow Network Required -- In order for FCL to load your contracts please define "flow.network" to "emulator", "local", "testnet", or "mainnet" in your config. See more here: https://developers.flow.com/tools/fcl-js/reference/configure-fcl'),anyHasPrivateKeys(ro)){const no=to==="emulator";log({title:"Private Keys Detected",message:"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security",level:no?LEVELS.warn:LEVELS.error}),invariant$1(no,"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security")}for(const[no,io]of Object.entries(getContracts(ro,to))){const oo=`0x${no}`,ao=await get$1(oo);ao&&ao!==io?log({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:LEVELS.warn}):put$1(oo,io);const so=`system.contracts.${no}`,co=await get$1(so);co&&co!==io?log({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:LEVELS.warn}):put$1(so,io)}}function config(Xr){return Xr!=null&&typeof Xr=="object"&&Object.keys(Xr).map(eo=>put$1(eo,Xr[eo])),{put:put$1,get:get$1,all,first,update:update$1,delete:_delete,where,subscribe:subscribe$1,overload,load}}config.put=put$1;config.get=get$1;config.all=all;config.first=first;config.update=update$1;config.delete=_delete;config.where=where;config.subscribe=subscribe$1;config.overload=overload;config.load=load;async function overload(Xr,eo){const to=await all();try{return config(Xr),await eo(await all())}finally{await resetConfig(to)}}function encode(Xr){if(Array.isArray(Xr)){const eo=[];for(let ro=0;ro{const Xr=[];let eo;return{async deliver(to){Xr.push(to),eo&&(eo(Xr.shift()),eo=void 0)},receive(){return new Promise(function(ro){const no=Xr.shift();if(no)return ro(no);eo=ro})}}};let promise;const _queueMicrotask=Xr=>(promise||(promise=Promise.resolve())).then(Xr).catch(eo=>setTimeout(()=>{throw eo},0)),INIT="INIT",SUBSCRIBE="SUBSCRIBE",UNSUBSCRIBE="UNSUBSCRIBE",UPDATED$2="UPDATED",EXIT="EXIT",TERMINATE="TERMINATE",root=typeof self=="object"&&self.self===self&&self||typeof global$1=="object"&&global$1.global===global$1&&global$1||typeof window=="object"&&window.window===window&&window||{FCL_REGISTRY:null};root.FCL_REGISTRY=root.FCL_REGISTRY==null?{}:root.FCL_REGISTRY;const FCL_REGISTRY=root.FCL_REGISTRY;let pid=0;const DEFAULT_TIMEOUT=5e3;function send$2(Xr,eo,to){let ro=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{expectReply:!1};return new Promise((no,io)=>{const oo=ro.expectReply||!1,ao=ro.timeout!=null?ro.timeout:DEFAULT_TIMEOUT;oo&&ao&&setTimeout(()=>io(new Error(`Timeout: ${ao}ms passed without a response.`)),ao);const so={to:Xr,from:ro.from,tag:eo,data:to,timeout:ao,reply:no,reject:io};try{FCL_REGISTRY[Xr]&&FCL_REGISTRY[Xr].mailbox.deliver(so),oo||no(!0)}catch(co){console.error("FCL.Actor -- Could Not Deliver Message",so,FCL_REGISTRY[Xr],co),io(co)}})}const kill=Xr=>{delete FCL_REGISTRY[Xr]},fromHandlers=Xr=>async eo=>{var to;typeof Xr[INIT]=="function"&&await Xr[INIT](eo);e:for(;;){const ro=await eo.receive();try{if(ro.tag===EXIT){typeof Xr[TERMINATE]=="function"&&await Xr[TERMINATE](eo,ro,ro.data||{});break e}await((to=Xr[ro.tag])==null?void 0:to.call(Xr,eo,ro,ro.data||{}))}catch(no){console.error(`${eo.self()} Error`,ro,no)}finally{continue e}}},parseAddr=Xr=>Xr==null?String(++pid):String(Xr),spawn=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const to=parseAddr(eo);if(FCL_REGISTRY[to]!=null)return to;FCL_REGISTRY[to]={addr:to,mailbox:mailbox(),subs:new Set,kvs:{},error:null};const ro=createCtx(to);let no;return typeof Xr=="object"?no=fromHandlers(Xr):no=Xr,_queueMicrotask(async()=>{await no(ro),kill(to)}),to},createCtx=Xr=>({self:()=>Xr,receive:()=>FCL_REGISTRY[Xr].mailbox.receive(),send:function(eo,to,ro){let no=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(eo!=null)return no.from=Xr,send$2(eo,to,ro,no)},sendSelf:function(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};FCL_REGISTRY[Xr]&&send$2(Xr,eo,to,ro)},broadcast:function(eo,to){let ro=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ro.from=Xr;for(const no of FCL_REGISTRY[Xr].subs)send$2(no,eo,to,ro)},subscribe:eo=>eo!=null&&FCL_REGISTRY[Xr].subs.add(eo),unsubscribe:eo=>eo!=null&&FCL_REGISTRY[Xr].subs.delete(eo),subscriberCount:()=>FCL_REGISTRY[Xr].subs.size,hasSubs:()=>!!FCL_REGISTRY[Xr].subs.size,put:(eo,to)=>{eo!=null&&(FCL_REGISTRY[Xr].kvs[eo]=to)},get:function(eo){let to=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;const ro=FCL_REGISTRY[Xr].kvs[eo];return ro??to},delete:eo=>{delete FCL_REGISTRY[Xr].kvs[eo]},update:(eo,to)=>{eo!=null&&(FCL_REGISTRY[Xr].kvs[eo]=to(FCL_REGISTRY[Xr].kvs[eo]))},keys:()=>Object.keys(FCL_REGISTRY[Xr].kvs),all:()=>FCL_REGISTRY[Xr].kvs,where:eo=>Object.keys(FCL_REGISTRY[Xr].kvs).reduce((to,ro)=>eo.test(ro)?{...to,[ro]:FCL_REGISTRY[Xr].kvs[ro]}:to,{}),merge:function(){let eo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Object.keys(eo).forEach(to=>FCL_REGISTRY[Xr].kvs[to]=eo[to])},fatalError:eo=>{FCL_REGISTRY[Xr].error=eo;for(const to of FCL_REGISTRY[Xr].subs)send$2(to,UPDATED$2)}});function subscriber(Xr,eo,to){eo(Xr);const ro=spawn(async no=>{for(no.send(Xr,SUBSCRIBE);;){const io=await no.receive(),oo=FCL_REGISTRY[Xr].error;if(io.tag===EXIT){no.send(Xr,UNSUBSCRIBE);return}if(oo){to(null,oo),no.send(Xr,UNSUBSCRIBE);return}to(io.data,null)}});return()=>send$2(ro,EXIT)}const pipe$2=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;toeo.reduce((no,io)=>io(no),ro)},mergePipe=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;toeo.reduce((no,io)=>({...no,...io(ro)}),{})},isObject$7=Xr=>Xr&&typeof Xr=="object"&&!Array.isArray(Xr),mergeDeep=function(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;roArray.isArray(Xr)?mergeDeep({},...Xr):Xr,filterContracts=Xr=>Xr.contracts?Xr.contracts:{},filterDependencies=Xr=>Xr.dependencies?Xr.dependencies:{},mapContractAliasesToNetworkAddress=Xr=>eo=>Object.entries(eo).reduce((to,ro)=>{var ao;let[no,io]=ro;const oo=(ao=io==null?void 0:io.aliases)==null?void 0:ao[Xr];return oo&&(to[no]=oo),to},{}),mapDependencyAliasesToNetworkAddress=Xr=>eo=>Object.entries(eo).reduce((to,ro)=>{var ao;let[no,io]=ro;const oo=(ao=io==null?void 0:io.aliases)==null?void 0:ao[Xr];return oo&&(to[no]=oo),to},{}),mapDeploymentsToNetworkAddress=Xr=>eo=>{let{deployments:to={},accounts:ro={}}=eo;const no=to==null?void 0:to[Xr];return no?Object.entries(no).reduce((io,oo)=>{var lo;let[ao,so]=oo;const co=(lo=ro[ao])==null?void 0:lo.address;return co?so.reduce((uo,ho)=>({...uo,[ho]:co}),{}):io},{}):{}},getContracts=(Xr,eo)=>pipe$2(mergeFlowJSONs,mergePipe(mapDeploymentsToNetworkAddress(eo),pipe$2(filterContracts,mapContractAliasesToNetworkAddress(eo)),pipe$2(filterDependencies,mapDependencyAliasesToNetworkAddress(eo))))(Xr),isHexidecimal=Xr=>typeof Xr!="string"?!1:/^[0-9A-Fa-f]+$/.test(Xr),hasPrivateKeys=Xr=>Object.entries((Xr==null?void 0:Xr.accounts)??[]).reduce((eo,to)=>{let[,ro]=to;return eo?!0:ro&&Object.prototype.hasOwnProperty.call(ro,"key")&&isHexidecimal(ro==null?void 0:ro.key)},!1),anyHasPrivateKeys=Xr=>Array.isArray(Xr)?Xr.some(hasPrivateKeys):hasPrivateKeys(Xr),cleanNetwork=Xr=>{const eo=(Xr==null?void 0:Xr.toLowerCase())==="local"?"emulator":Xr==null?void 0:Xr.toLowerCase();if(eo==="emulator"||eo==="testnet"||eo==="mainnet")return eo;throw new Error(`Invalid network "${Xr}". Must be one of "emulator", "local", "testnet", or "mainnet"`)};setConfig(config);const NAME$2="config",PUT="PUT_CONFIG",GET="GET_CONFIG",GET_ALL="GET_ALL_CONFIG",UPDATE="UPDATE_CONFIG",DELETE="DELETE_CONFIG",CLEAR="CLEAR_CONFIG",WHERE="WHERE_CONFIG",UPDATED$1="CONFIG/UPDATED",identity=Xr=>Xr,HANDLERS$1={[PUT]:(Xr,eo,to)=>{let{key:ro,value:no}=to;if(ro==null)throw new Error("Missing 'key' for config/put.");Xr.put(ro,no),Xr.broadcast(UPDATED$1,{...Xr.all()})},[GET]:(Xr,eo,to)=>{let{key:ro,fallback:no}=to;if(ro==null)throw new Error("Missing 'key' for config/get");eo.reply(Xr.get(ro,no))},[GET_ALL]:(Xr,eo)=>{eo.reply({...Xr.all()})},[UPDATE]:(Xr,eo,to)=>{let{key:ro,fn:no}=to;if(ro==null)throw new Error("Missing 'key' for config/update");Xr.update(ro,no||identity),Xr.broadcast(UPDATED$1,{...Xr.all()})},[DELETE]:(Xr,eo,to)=>{let{key:ro}=to;if(ro==null)throw new Error("Missing 'key' for config/delete");Xr.delete(ro),Xr.broadcast(UPDATED$1,{...Xr.all()})},[CLEAR]:Xr=>{const eo=Object.keys(Xr.all());for(const to of eo)Xr.delete(to);Xr.broadcast(UPDATED$1,{...Xr.all()})},[WHERE]:(Xr,eo,to)=>{let{pattern:ro}=to;if(ro==null)throw new Error("Missing 'pattern' for config/where");eo.reply(Xr.where(ro))},[SUBSCRIBE]:(Xr,eo)=>{Xr.subscribe(eo.from),Xr.send(eo.from,UPDATED$1,{...Xr.all()})},[UNSUBSCRIBE]:(Xr,eo)=>{Xr.unsubscribe(eo.from)}};spawn(HANDLERS$1,NAME$2);function put$1(Xr,eo){return send$2(NAME$2,PUT,{key:Xr,value:eo}),config()}function get$1(Xr,eo){return send$2(NAME$2,GET,{key:Xr,fallback:eo},{expectReply:!0,timeout:10})}async function first(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1?arguments[1]:void 0;if(!Xr.length)return eo;const[to,...ro]=Xr,no=await get$1(to);return no??first(ro,eo)}function all(){return send$2(NAME$2,GET_ALL,null,{expectReply:!0,timeout:10})}function update$1(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:identity;return send$2(NAME$2,UPDATE,{key:Xr,fn:eo}),config()}function _delete(Xr){return send$2(NAME$2,DELETE,{key:Xr}),config()}function where(Xr){return send$2(NAME$2,WHERE,{pattern:Xr},{expectReply:!0,timeout:10})}function subscribe$1(Xr){return subscriber(NAME$2,()=>spawn(HANDLERS$1,NAME$2),Xr)}async function clearConfig(){await send$2(NAME$2,CLEAR)}async function resetConfig(Xr){return clearConfig().then(()=>config(Xr))}async function load(Xr){const eo=await get$1("flow.network"),to=cleanNetwork(eo),{flowJSON:ro}=Xr;if(invariant$1(!!ro,"config.load -- 'flowJSON' must be defined"),invariant$1(!!to,'Flow Network Required -- In order for FCL to load your contracts please define "flow.network" to "emulator", "local", "testnet", or "mainnet" in your config. See more here: https://developers.flow.com/tools/fcl-js/reference/configure-fcl'),anyHasPrivateKeys(ro)){const no=to==="emulator";log({title:"Private Keys Detected",message:"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security",level:no?LEVELS.warn:LEVELS.error}),invariant$1(no,"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security")}for(const[no,io]of Object.entries(getContracts(ro,to))){const oo=`0x${no}`,ao=await get$1(oo);ao&&ao!==io?log({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:LEVELS.warn}):put$1(oo,io);const so=`system.contracts.${no}`,co=await get$1(so);co&&co!==io?log({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:LEVELS.warn}):put$1(so,io)}}function config(Xr){return Xr!=null&&typeof Xr=="object"&&Object.keys(Xr).map(eo=>put$1(eo,Xr[eo])),{put:put$1,get:get$1,all,first,update:update$1,delete:_delete,where,subscribe:subscribe$1,overload,load}}config.put=put$1;config.get=get$1;config.all=all;config.first=first;config.update=update$1;config.delete=_delete;config.where=where;config.subscribe=subscribe$1;config.overload=overload;config.load=load;async function overload(Xr,eo){const to=await all();try{return config(Xr),await eo(await all())}finally{await resetConfig(to)}}function encode(Xr){if(Array.isArray(Xr)){const eo=[];for(let ro=0;ro{go.abort()},so);return fetchTransport(new URL(to,eo).toString(),{method:ro,body:lo,headers:io,signal:go.signal}).then(async vo=>{if(vo.ok)return vo.json();const wo=await vo.text().catch(()=>null),Eo=safeParseJSON(wo);throw new HTTPRequestError({error:Eo==null?void 0:Eo.message,hostname:eo,path:to,method:ro,requestBody:lo,responseBody:wo,responseStatusText:vo.statusText,statusCode:vo.status})}).catch(async vo=>{throw vo instanceof HTTPRequestError||vo.name==="AbortError"?vo:(co&&await log({title:"Access Node Error",message:`The provided access node ${eo} does not appear to be a valid REST/HTTP access node. + `;super(lo),this.name="HTTP Request Error",this.statusCode=co,this.errorMessage=to}}async function httpRequest(Xr){let{hostname:eo,path:to,method:ro,body:no,headers:io,retryLimit:oo=5,retryIntervalMs:ao=1e3,timeoutLimit:so=3e4,enableRequestLogging:co=!0}=Xr;const lo=no?JSON.stringify(no):null;function uo(){const go=new AbortController$1,bo=setTimeout(()=>{go.abort()},so);return fetchTransport(new URL(to,eo).toString(),{method:ro,body:lo,headers:io,signal:go.signal}).then(async wo=>{if(wo.ok)return wo.json();const Eo=await wo.text().catch(()=>null),$o=safeParseJSON(Eo);throw new HTTPRequestError({error:$o==null?void 0:$o.message,hostname:eo,path:to,method:ro,requestBody:lo,responseBody:Eo,responseStatusText:wo.statusText,statusCode:wo.status})}).catch(async wo=>{throw wo instanceof HTTPRequestError||wo.name==="AbortError"?wo:(co&&await log({title:"Access Node Error",message:`The provided access node ${eo} does not appear to be a valid REST/HTTP access node. Please verify that you are not unintentionally using a GRPC access node. - See more here: https://docs.onflow.org/fcl/reference/sdk-guidelines/#connect`,level:LEVELS.error}),new HTTPRequestError({error:vo==null?void 0:vo.message,hostname:eo,path:to,method:ro,requestBody:lo}))}).finally(()=>{clearTimeout(yo)})}async function ho(){let go=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;try{return await fo()}catch(yo){const vo=[408,429,500,502,503,504];if(yo.name==="AbortError"||vo.includes(yo.statusCode))return await new Promise((wo,Eo)=>{go{wo(ho(go+1))},ao)):Eo(yo)});throw yo}}return await ho()}async function sendExecuteScriptAtBlockIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/scripts?block_id=${Xr.block.id}`,method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}async function sendExecuteScriptAtBlockHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/scripts?block_height=${Xr.block.height}`,method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}async function sendExecuteScriptAtLatestBlockRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:"/v1/scripts?block_height=sealed",method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}function constructResponse$5(Xr,eo,to){let ro=eo.response();return ro.tag=Xr.tag,ro.encodedData=JSON.parse(eo.Buffer.from(to,"base64").toString()),ro}async function sendExecuteScript(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return invariant$1(to.node,"SDK Send Execute Script Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Execute Script Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Execute Script Error: context.Buffer must be defined."),Xr=await Xr,Xr.block.id?await sendExecuteScriptAtBlockIDRequest(Xr,eo,to):Xr.block.height?await sendExecuteScriptAtBlockHeightRequest(Xr,eo,to):await sendExecuteScriptAtLatestBlockRequest(Xr,eo,to)}const HashAlgorithmIDs={SHA2_256:1,SHA2_384:2,SHA3_256:3,SHA3_384:4,KMAC128_BLS_BLS12_381:5},SignatureAlgorithmIDs={ECDSA_P256:1,ECDSA_secp256k1:2,BLS_BLS12_381:3};async function sendGetAccountAtBlockHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/accounts/${Xr.account.addr}?block_height=${Xr.block.height}&expand=contracts,keys`,method:"GET",body:null});return constructResponse$4(Xr,eo,no)}async function sendGetAccountAtLatestBlockRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/accounts/${Xr.account.addr}?block_height=sealed&expand=contracts,keys`,method:"GET",body:null});return constructResponse$4(Xr,eo,no)}function constructResponse$4(Xr,eo,to){var io;let ro=eo.response();ro.tag=Xr.tag;const no=oo=>{const ao={};if(!oo)return ao;for(let so of Object.keys(oo))ao[so]=eo.Buffer.from(oo[so],"base64").toString();return ao};return ro.account={address:to.address,balance:Number(to.balance),code:"",contracts:no(to.contracts),keys:((io=to.keys)==null?void 0:io.map(oo=>({index:Number(oo.index),publicKey:oo.public_key.replace(/^0x/,""),signAlgo:SignatureAlgorithmIDs[oo.signing_algorithm],signAlgoString:oo.signing_algorithm,hashAlgo:HashAlgorithmIDs[oo.hashing_algorithm],hashAlgoString:oo.hashing_algorithm,sequenceNumber:Number(oo.sequence_number),weight:Number(oo.weight),revoked:oo.revoked})))??[]},ro}async function sendGetAccount(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return invariant$1(to.node,"SDK Send Get Account Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Account Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Account Error: context.Buffer must be defined."),Xr=await Xr,Xr.block.height!==null?await sendGetAccountAtBlockHeightRequest(Xr,eo,to):await sendGetAccountAtLatestBlockRequest(Xr,eo,to)}async function sendGetBlockHeaderByIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks/${Xr.block.id}`,method:"GET",body:null});return constructResponse$3(Xr,eo,no)}async function sendGetBlockHeaderByHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks?height=${Xr.block.height}`,method:"GET",body:null});return constructResponse$3(Xr,eo,no)}async function sendGetLatestBlockHeaderRequest(Xr,eo,to){var oo;const ro=to.httpRequest||httpRequest,no=(oo=Xr.block)!=null&&oo.isSealed?"sealed":"final",io=await ro({hostname:to.node,path:`/v1/blocks?height=${no}`,method:"GET",body:null});return constructResponse$3(Xr,eo,io)}function constructResponse$3(Xr,eo,to){const ro=to.length?to[0]:null,no=eo.response();return no.tag=Xr.tag,no.blockHeader={id:ro.header.id,parentId:ro.header.parent_id,height:Number(ro.header.height),timestamp:ro.header.timestamp},no}async function sendGetBlockHeader(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Block Header Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Block Header Error: context.response must be defined."),Xr=await Xr;const ro=Xr.block.id!==null,no=Xr.block.height!==null;return ro?await sendGetBlockHeaderByIDRequest(Xr,eo,to):no?await sendGetBlockHeaderByHeightRequest(Xr,eo,to):await sendGetLatestBlockHeaderRequest(Xr,eo,to)}async function sendGetBlockByIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks/${Xr.block.id}?expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,no)}async function sendGetBlockByHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks?height=${Xr.block.height}&expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,no)}async function sendGetBlockRequest(Xr,eo,to){var oo;const ro=to.httpRequest||httpRequest,no=(oo=Xr.block)!=null&&oo.isSealed?"sealed":"final",io=await ro({hostname:to.node,path:`/v1/blocks?height=${no}&expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,io)}function constructResponse$2(Xr,eo,to){const ro=to.length?to[0]:null,no=eo.response();return no.tag=Xr.tag,no.block={id:ro.header.id,parentId:ro.header.parent_id,height:Number(ro.header.height),timestamp:ro.header.timestamp,collectionGuarantees:ro.payload.collection_guarantees.map(io=>({collectionId:io.collection_id,signerIds:io.signer_ids})),blockSeals:ro.payload.block_seals.map(io=>({blockId:io.block_id,executionReceiptId:io.result_id}))},no}async function sendGetBlock(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Block Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Block Error: context.response must be defined."),Xr=await Xr;const ro=Xr.block.id!==null,no=Xr.block.height!==null;return ro?await sendGetBlockByIDRequest(Xr,eo,to):no?await sendGetBlockByHeightRequest(Xr,eo,to):await sendGetBlockRequest(Xr,eo,to)}async function sendGetCollection(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Collection Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Collection Error: context.response must be defined.");const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/collections/${Xr.collection.id}?expand=transactions`,method:"GET",body:null}),io=eo.response();return io.tag=Xr.tag,io.collection={id:no.id,transactionIds:no.transactions.map(oo=>oo.id)},io}async function sendGetEventsForHeightRangeRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/events?type=${Xr.events.eventType}&start_height=${Xr.events.start}&end_height=${Xr.events.end}`,method:"GET",body:null});return constructResponse$1(Xr,eo,no)}async function sendGetEventsForBlockIDsRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/events?type=${Xr.events.eventType}&block_ids=${Xr.events.blockIds.join(",")}`,method:"GET",body:null});return constructResponse$1(Xr,eo,no)}function constructResponse$1(Xr,eo,to){let ro=eo.response();return ro.tag=Xr.tag,ro.events=[],to.forEach(no=>no.events?no.events.forEach(io=>ro.events.push({blockId:no.block_id,blockHeight:Number(no.block_height),blockTimestamp:no.block_timestamp,type:io.type,transactionId:io.transaction_id,transactionIndex:Number(io.transaction_index),eventIndex:Number(io.event_index),payload:JSON.parse(eo.Buffer.from(io.payload,"base64").toString())})):null),ro}async function sendGetEvents(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Events Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Events Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Events Error: context.Buffer must be defined."),Xr=await Xr;const ro=Xr.events.start!==null,no=Array.isArray(Xr.events.blockIds)&&Xr.events.blockIds.length>0;return invariant$1(ro||no,"SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."),ro?await sendGetEventsForHeightRangeRequest(Xr,eo,to):await sendGetEventsForBlockIDsRequest(Xr,eo,to)}async function sendGetTransaction(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Transaction Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Transaction Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Transaction Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:`/v1/transactions/${Xr.transaction.id}`,method:"GET",body:null}),io=co=>({address:co.address,keyId:Number(co.key_id),sequenceNumber:Number(co.sequence_number)}),oo=co=>({address:co.address,keyId:Number(co.key_index),signature:co.signature}),ao=co=>JSON.parse(eo.Buffer.from(co,"base64").toString());let so=eo.response();return so.tag=Xr.tag,so.transaction={script:eo.Buffer.from(no.script,"base64").toString(),args:[...no.arguments.map(ao)],referenceBlockId:no.reference_block_id,gasLimit:Number(no.gas_limit),payer:no.payer,proposalKey:no.proposal_key?io(no.proposal_key):no.proposal_key,authorizers:no.authorizers,payloadSignatures:[...no.payload_signatures.map(oo)],envelopeSignatures:[...no.envelope_signatures.map(oo)]},so}const STATUS_MAP={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5};async function sendGetTransactionStatus(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Transaction Status Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Transaction Status Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Transaction Status Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:`/v1/transaction_results/${Xr.transaction.id}`,method:"GET",body:null});let io=eo.response();return io.tag=Xr.tag,io.transactionStatus={blockId:no.block_id,status:STATUS_MAP[no.status.toUpperCase()]||"",statusString:no.status.toUpperCase(),statusCode:no.status_code,errorMessage:no.error_message,events:no.events.map(oo=>({type:oo.type,transactionId:oo.transaction_id,transactionIndex:Number(oo.transaction_index),eventIndex:Number(oo.event_index),payload:JSON.parse(eo.Buffer.from(oo.payload,"base64").toString())}))},io}async function sendPing(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(!!to.node,"SDK Send Ping Error: opts.node must be defined."),invariant$1(!!eo.response,"SDK Send Ping Error: context.response must be defined."),await(to.httpRequest||httpRequest)({hostname:to.node,path:"/v1/blocks?height=sealed",method:"GET",body:null});let no=typeof(eo==null?void 0:eo.response)=="function"?eo.response():{};return no.tag=Xr.tag,no}const idof=Xr=>`${withPrefix(Xr.addr)}-${Xr.keyId}`;async function sendTransaction(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Transaction Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Transaction Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Transaction Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;let no=[];for(let lo of Object.values(Xr.accounts))try{if(!lo.role.payer&&lo.signature!=null){const fo={address:sansPrefix(lo.addr),key_index:String(lo.keyId),signature:eo.Buffer.from(lo.signature,"hex").toString("base64")};no.find(ho=>ho.address===fo.address&&ho.key_index===fo.key_index&&ho.signature===fo.signature)||no.push(fo)}}catch(fo){throw console.error("SDK HTTP Send Error: Trouble applying payload signature",{acct:lo,ix:Xr}),fo}let io={};for(let lo of Object.values(Xr.accounts))try{if(lo.role.payer&&lo.signature!=null){let fo=lo.tempId||idof(lo);io[fo]=io[fo]||{address:sansPrefix(lo.addr),key_index:String(lo.keyId),signature:eo.Buffer.from(lo.signature,"hex").toString("base64")}}}catch(fo){throw console.error("SDK HTTP Send Error: Trouble applying envelope signature",{acct:lo,ix:Xr}),fo}io=Object.values(io);var oo=Date.now();const ao=await ro({hostname:to.node,path:"/v1/transactions",method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:[...Xr.message.arguments.map(lo=>eo.Buffer.from(JSON.stringify(Xr.arguments[lo].asArgument)).toString("base64"))],reference_block_id:Xr.message.refBlock?Xr.message.refBlock:null,gas_limit:String(Xr.message.computeLimit),payer:sansPrefix(Xr.accounts[Array.isArray(Xr.payer)?Xr.payer[0]:Xr.payer].addr),proposal_key:{address:sansPrefix(Xr.accounts[Xr.proposer].addr),key_index:String(Xr.accounts[Xr.proposer].keyId),sequence_number:String(Xr.accounts[Xr.proposer].sequenceNum)},authorizers:Xr.authorizations.map(lo=>Xr.accounts[lo].addr).reduce((lo,fo)=>lo.find(ho=>ho===fo)?lo:[...lo,fo],[]).map(sansPrefix),payload_signatures:no,envelope_signatures:io}});var so=Date.now();let co=eo.response();return co.tag=Xr.tag,co.transactionId=ao.id,typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("FLOW::TX",{detail:{txId:co.transactionId,delta:so-oo}})),co}async function sendGetNetworkParameters(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Network Parameters Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Network Parameters Error: context.response must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:"/v1/network/parameters",method:"GET",body:null,enableRequestLogging:to.enableRequestLogging??!0});let io=eo.response();return io.tag=Xr.tag,io.networkParameters={chainId:no.chain_id},io}async function sendGetNodeVersionInfo(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Node Version Info Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Node Verison Info Error: context.response must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:"/v1/node_version_info",method:"GET"});let io=eo.response();return io.tag=Xr.tag,io.nodeVersionInfo={semver:no.semver,commit:no.commit,sporkId:no.spork_id,protocolVersion:parseInt(no.protocol_version),sporkRootBlockHeight:parseInt(no.spork_root_block_height),nodeRootBlockHeight:parseInt(no.node_root_block_height)},io}const WebSocket$1=_WebSocket;class WebsocketError extends Error{constructor(eo){let{code:to,reason:ro,message:no,wasClean:io}=eo;const oo=` + See more here: https://docs.onflow.org/fcl/reference/sdk-guidelines/#connect`,level:LEVELS.error}),new HTTPRequestError({error:wo==null?void 0:wo.message,hostname:eo,path:to,method:ro,requestBody:lo}))}).finally(()=>{clearTimeout(bo)})}async function ho(){let go=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;try{return await uo()}catch(bo){const wo=[408,429,500,502,503,504];if(bo.name==="AbortError"||wo.includes(bo.statusCode))return await new Promise((Eo,$o)=>{go{Eo(ho(go+1))},ao)):$o(bo)});throw bo}}return await ho()}async function sendExecuteScriptAtBlockIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/scripts?block_id=${Xr.block.id}`,method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}async function sendExecuteScriptAtBlockHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/scripts?block_height=${Xr.block.height}`,method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}async function sendExecuteScriptAtLatestBlockRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:"/v1/scripts?block_height=sealed",method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:Xr.message.arguments.map(io=>eo.Buffer.from(JSON.stringify(Xr.arguments[io].asArgument)).toString("base64"))}});return constructResponse$5(Xr,eo,no)}function constructResponse$5(Xr,eo,to){let ro=eo.response();return ro.tag=Xr.tag,ro.encodedData=JSON.parse(eo.Buffer.from(to,"base64").toString()),ro}async function sendExecuteScript(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return invariant$1(to.node,"SDK Send Execute Script Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Execute Script Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Execute Script Error: context.Buffer must be defined."),Xr=await Xr,Xr.block.id?await sendExecuteScriptAtBlockIDRequest(Xr,eo,to):Xr.block.height?await sendExecuteScriptAtBlockHeightRequest(Xr,eo,to):await sendExecuteScriptAtLatestBlockRequest(Xr,eo,to)}const HashAlgorithmIDs={SHA2_256:1,SHA2_384:2,SHA3_256:3,SHA3_384:4,KMAC128_BLS_BLS12_381:5},SignatureAlgorithmIDs={ECDSA_P256:1,ECDSA_secp256k1:2,BLS_BLS12_381:3};async function sendGetAccountAtBlockHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/accounts/${Xr.account.addr}?block_height=${Xr.block.height}&expand=contracts,keys`,method:"GET",body:null});return constructResponse$4(Xr,eo,no)}async function sendGetAccountAtLatestBlockRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/accounts/${Xr.account.addr}?block_height=sealed&expand=contracts,keys`,method:"GET",body:null});return constructResponse$4(Xr,eo,no)}function constructResponse$4(Xr,eo,to){var io;let ro=eo.response();ro.tag=Xr.tag;const no=oo=>{const ao={};if(!oo)return ao;for(let so of Object.keys(oo))ao[so]=eo.Buffer.from(oo[so],"base64").toString();return ao};return ro.account={address:to.address,balance:Number(to.balance),code:"",contracts:no(to.contracts),keys:((io=to.keys)==null?void 0:io.map(oo=>({index:Number(oo.index),publicKey:oo.public_key.replace(/^0x/,""),signAlgo:SignatureAlgorithmIDs[oo.signing_algorithm],signAlgoString:oo.signing_algorithm,hashAlgo:HashAlgorithmIDs[oo.hashing_algorithm],hashAlgoString:oo.hashing_algorithm,sequenceNumber:Number(oo.sequence_number),weight:Number(oo.weight),revoked:oo.revoked})))??[]},ro}async function sendGetAccount(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return invariant$1(to.node,"SDK Send Get Account Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Account Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Account Error: context.Buffer must be defined."),Xr=await Xr,Xr.block.height!==null?await sendGetAccountAtBlockHeightRequest(Xr,eo,to):await sendGetAccountAtLatestBlockRequest(Xr,eo,to)}async function sendGetBlockHeaderByIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks/${Xr.block.id}`,method:"GET",body:null});return constructResponse$3(Xr,eo,no)}async function sendGetBlockHeaderByHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks?height=${Xr.block.height}`,method:"GET",body:null});return constructResponse$3(Xr,eo,no)}async function sendGetLatestBlockHeaderRequest(Xr,eo,to){var oo;const ro=to.httpRequest||httpRequest,no=(oo=Xr.block)!=null&&oo.isSealed?"sealed":"final",io=await ro({hostname:to.node,path:`/v1/blocks?height=${no}`,method:"GET",body:null});return constructResponse$3(Xr,eo,io)}function constructResponse$3(Xr,eo,to){const ro=to.length?to[0]:null,no=eo.response();return no.tag=Xr.tag,no.blockHeader={id:ro.header.id,parentId:ro.header.parent_id,height:Number(ro.header.height),timestamp:ro.header.timestamp},no}async function sendGetBlockHeader(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Block Header Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Block Header Error: context.response must be defined."),Xr=await Xr;const ro=Xr.block.id!==null,no=Xr.block.height!==null;return ro?await sendGetBlockHeaderByIDRequest(Xr,eo,to):no?await sendGetBlockHeaderByHeightRequest(Xr,eo,to):await sendGetLatestBlockHeaderRequest(Xr,eo,to)}async function sendGetBlockByIDRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks/${Xr.block.id}?expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,no)}async function sendGetBlockByHeightRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/blocks?height=${Xr.block.height}&expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,no)}async function sendGetBlockRequest(Xr,eo,to){var oo;const ro=to.httpRequest||httpRequest,no=(oo=Xr.block)!=null&&oo.isSealed?"sealed":"final",io=await ro({hostname:to.node,path:`/v1/blocks?height=${no}&expand=payload`,method:"GET",body:null});return constructResponse$2(Xr,eo,io)}function constructResponse$2(Xr,eo,to){const ro=to.length?to[0]:null,no=eo.response();return no.tag=Xr.tag,no.block={id:ro.header.id,parentId:ro.header.parent_id,height:Number(ro.header.height),timestamp:ro.header.timestamp,collectionGuarantees:ro.payload.collection_guarantees.map(io=>({collectionId:io.collection_id,signerIds:io.signer_ids})),blockSeals:ro.payload.block_seals.map(io=>({blockId:io.block_id,executionReceiptId:io.result_id}))},no}async function sendGetBlock(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Block Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Block Error: context.response must be defined."),Xr=await Xr;const ro=Xr.block.id!==null,no=Xr.block.height!==null;return ro?await sendGetBlockByIDRequest(Xr,eo,to):no?await sendGetBlockByHeightRequest(Xr,eo,to):await sendGetBlockRequest(Xr,eo,to)}async function sendGetCollection(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Collection Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Collection Error: context.response must be defined.");const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/collections/${Xr.collection.id}?expand=transactions`,method:"GET",body:null}),io=eo.response();return io.tag=Xr.tag,io.collection={id:no.id,transactionIds:no.transactions.map(oo=>oo.id)},io}async function sendGetEventsForHeightRangeRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/events?type=${Xr.events.eventType}&start_height=${Xr.events.start}&end_height=${Xr.events.end}`,method:"GET",body:null});return constructResponse$1(Xr,eo,no)}async function sendGetEventsForBlockIDsRequest(Xr,eo,to){const no=await(to.httpRequest||httpRequest)({hostname:to.node,path:`/v1/events?type=${Xr.events.eventType}&block_ids=${Xr.events.blockIds.join(",")}`,method:"GET",body:null});return constructResponse$1(Xr,eo,no)}function constructResponse$1(Xr,eo,to){let ro=eo.response();return ro.tag=Xr.tag,ro.events=[],to.forEach(no=>no.events?no.events.forEach(io=>ro.events.push({blockId:no.block_id,blockHeight:Number(no.block_height),blockTimestamp:no.block_timestamp,type:io.type,transactionId:io.transaction_id,transactionIndex:Number(io.transaction_index),eventIndex:Number(io.event_index),payload:JSON.parse(eo.Buffer.from(io.payload,"base64").toString())})):null),ro}async function sendGetEvents(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Events Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Events Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Events Error: context.Buffer must be defined."),Xr=await Xr;const ro=Xr.events.start!==null,no=Array.isArray(Xr.events.blockIds)&&Xr.events.blockIds.length>0;return invariant$1(ro||no,"SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."),ro?await sendGetEventsForHeightRangeRequest(Xr,eo,to):await sendGetEventsForBlockIDsRequest(Xr,eo,to)}async function sendGetTransaction(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Transaction Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Transaction Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Transaction Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:`/v1/transactions/${Xr.transaction.id}`,method:"GET",body:null}),io=co=>({address:co.address,keyId:Number(co.key_id),sequenceNumber:Number(co.sequence_number)}),oo=co=>({address:co.address,keyId:Number(co.key_index),signature:co.signature}),ao=co=>JSON.parse(eo.Buffer.from(co,"base64").toString());let so=eo.response();return so.tag=Xr.tag,so.transaction={script:eo.Buffer.from(no.script,"base64").toString(),args:[...no.arguments.map(ao)],referenceBlockId:no.reference_block_id,gasLimit:Number(no.gas_limit),payer:no.payer,proposalKey:no.proposal_key?io(no.proposal_key):no.proposal_key,authorizers:no.authorizers,payloadSignatures:[...no.payload_signatures.map(oo)],envelopeSignatures:[...no.envelope_signatures.map(oo)]},so}const STATUS_MAP={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5};async function sendGetTransactionStatus(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Transaction Status Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Transaction Status Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Transaction Status Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:`/v1/transaction_results/${Xr.transaction.id}`,method:"GET",body:null});let io=eo.response();return io.tag=Xr.tag,io.transactionStatus={blockId:no.block_id,status:STATUS_MAP[no.status.toUpperCase()]||"",statusString:no.status.toUpperCase(),statusCode:no.status_code,errorMessage:no.error_message,events:no.events.map(oo=>({type:oo.type,transactionId:oo.transaction_id,transactionIndex:Number(oo.transaction_index),eventIndex:Number(oo.event_index),payload:JSON.parse(eo.Buffer.from(oo.payload,"base64").toString())}))},io}async function sendPing(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(!!to.node,"SDK Send Ping Error: opts.node must be defined."),invariant$1(!!eo.response,"SDK Send Ping Error: context.response must be defined."),await(to.httpRequest||httpRequest)({hostname:to.node,path:"/v1/blocks?height=sealed",method:"GET",body:null});let no=typeof(eo==null?void 0:eo.response)=="function"?eo.response():{};return no.tag=Xr.tag,no}const idof=Xr=>`${withPrefix(Xr.addr)}-${Xr.keyId}`;async function sendTransaction(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Transaction Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Transaction Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Transaction Error: context.Buffer must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;let no=[];for(let lo of Object.values(Xr.accounts))try{if(!lo.role.payer&&lo.signature!=null){const uo={address:sansPrefix(lo.addr),key_index:String(lo.keyId),signature:eo.Buffer.from(lo.signature,"hex").toString("base64")};no.find(ho=>ho.address===uo.address&&ho.key_index===uo.key_index&&ho.signature===uo.signature)||no.push(uo)}}catch(uo){throw console.error("SDK HTTP Send Error: Trouble applying payload signature",{acct:lo,ix:Xr}),uo}let io={};for(let lo of Object.values(Xr.accounts))try{if(lo.role.payer&&lo.signature!=null){let uo=lo.tempId||idof(lo);io[uo]=io[uo]||{address:sansPrefix(lo.addr),key_index:String(lo.keyId),signature:eo.Buffer.from(lo.signature,"hex").toString("base64")}}}catch(uo){throw console.error("SDK HTTP Send Error: Trouble applying envelope signature",{acct:lo,ix:Xr}),uo}io=Object.values(io);var oo=Date.now();const ao=await ro({hostname:to.node,path:"/v1/transactions",method:"POST",body:{script:eo.Buffer.from(Xr.message.cadence).toString("base64"),arguments:[...Xr.message.arguments.map(lo=>eo.Buffer.from(JSON.stringify(Xr.arguments[lo].asArgument)).toString("base64"))],reference_block_id:Xr.message.refBlock?Xr.message.refBlock:null,gas_limit:String(Xr.message.computeLimit),payer:sansPrefix(Xr.accounts[Array.isArray(Xr.payer)?Xr.payer[0]:Xr.payer].addr),proposal_key:{address:sansPrefix(Xr.accounts[Xr.proposer].addr),key_index:String(Xr.accounts[Xr.proposer].keyId),sequence_number:String(Xr.accounts[Xr.proposer].sequenceNum)},authorizers:Xr.authorizations.map(lo=>Xr.accounts[lo].addr).reduce((lo,uo)=>lo.find(ho=>ho===uo)?lo:[...lo,uo],[]).map(sansPrefix),payload_signatures:no,envelope_signatures:io}});var so=Date.now();let co=eo.response();return co.tag=Xr.tag,co.transactionId=ao.id,typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("FLOW::TX",{detail:{txId:co.transactionId,delta:so-oo}})),co}async function sendGetNetworkParameters(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Network Parameters Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Network Parameters Error: context.response must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:"/v1/network/parameters",method:"GET",body:null,enableRequestLogging:to.enableRequestLogging??!0});let io=eo.response();return io.tag=Xr.tag,io.networkParameters={chainId:no.chain_id},io}async function sendGetNodeVersionInfo(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Node Version Info Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Node Verison Info Error: context.response must be defined.");const ro=to.httpRequest||httpRequest;Xr=await Xr;const no=await ro({hostname:to.node,path:"/v1/node_version_info",method:"GET"});let io=eo.response();return io.tag=Xr.tag,io.nodeVersionInfo={semver:no.semver,commit:no.commit,sporkId:no.spork_id,protocolVersion:parseInt(no.protocol_version),sporkRootBlockHeight:parseInt(no.spork_root_block_height),nodeRootBlockHeight:parseInt(no.node_root_block_height)},io}const WebSocket$1=_WebSocket;class WebsocketError extends Error{constructor(eo){let{code:to,reason:ro,message:no,wasClean:io}=eo;const oo=` connectWs: connection closed with error${no?`: ${no}`:""} ${to?`code: ${to}`:""} ${ro?`reason: ${ro}`:""} ${io?`wasClean: ${io}`:""} - `;super(oo),this.name="WebsocketError",this.code=to,this.reason=ro,this.wasClean=!1}}function connectWs(Xr){let{hostname:eo,path:to,params:ro,getParams:no,retryLimit:io=5,retryIntervalMs:oo=1e3}=Xr;if(no&&ro)throw new Error("connectWs: cannot specify both params and getParams");let ao=new eventsExports.EventEmitter,so=0;const co=no||(()=>ro);let lo=()=>{};return function fo(){let ho=!1,go=!1;const yo=buildConnectionUrl(eo,to,co()),vo=new WebSocket$1(yo);vo.onmessage=function(wo){const Eo=safeParseJSON(wo.data);Eo?ao.emit("data",Eo):(ao.emit("error",new WebsocketError({message:"invalid JSON data"})),this.close())},vo.onclose=function(wo){if(ho){ao.emit("close"),ao.removeAllListeners();return}go?setTimeout(fo,oo):so{ao.emit("close"),ao.removeAllListeners()}))},vo.onopen=function(){go=!0,so=0},lo=()=>{ho=!0,vo.close()}}(),{on(fo,ho){return ao.on(fo,ho),this},off(fo,ho){return ao.off(fo,ho),this},close(){lo()}}}function buildConnectionUrl(Xr,eo,to){const ro=new URL(eo||"",Xr);return ro.protocol==="https:"?ro.protocol="wss:":ro.protocol==="http:"&&(ro.protocol="ws:"),Object.entries(to||{}).forEach(no=>{let[io,oo]=no;if(oo){let ao;Array.isArray(oo)?ao=oo.join(","):ao=oo.toString(),ro.searchParams.append(io,ao)}}),ro.toString()}function constructData(Xr,eo,to){var no;const ro=eo.response();return ro.tag=Xr.tag,ro.events=((no=to.Events)==null?void 0:no.length)>0?to.Events.map(io=>({blockId:to.BlockID,blockHeight:Number(to.Height),blockTimestamp:to.Timestamp,type:io.Type,transactionId:io.TransactionID,transactionIndex:Number(io.TransactionIndex),eventIndex:Number(io.EventIndex),payload:JSON.parse(eo.Buffer.from(io.Payload,"base64").toString())})):null,ro.heartbeat={blockId:to.BlockID,blockHeight:Number(to.Height),blockTimestamp:to.Timestamp},ro}function constructResponse(Xr,eo,to){const ro=eo.response();return ro.tag=Xr.tag,ro.streamConnection=to,ro}async function connectSubscribeEvents(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Events Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Events Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const ro=await Xr,no=to.connectWs||connectWs,io=new eventsExports.EventEmitter;let oo=null;const ao=no({hostname:to.node,path:"/v1/subscribe_events",getParams:()=>{var lo,fo,ho,go,yo,vo;const co={event_types:(lo=ro.subscribeEvents)==null?void 0:lo.eventTypes,addresses:(fo=ro.subscribeEvents)==null?void 0:fo.addresses,contracts:(ho=ro.subscribeEvents)==null?void 0:ho.contracts,heartbeat_interval:(go=ro.subscribeEvents)==null?void 0:go.heartbeatInterval};return oo?co.start_height=oo+1:(co.start_block_id=(yo=ro.subscribeEvents)==null?void 0:yo.startBlockId,co.start_height=(vo=ro.subscribeEvents)==null?void 0:vo.startHeight),co}});return ao.on("data",co=>{const lo=constructData(ro,eo,co);oo=lo.heartbeat.blockHeight,io.emit("data",lo)}),ao.on("error",co=>{io.emit("error",co)}),ao.on("close",()=>{io.emit("close")}),constructResponse(ro,eo,{on(co,lo){return io.on(co,lo),this},off(co,lo){return io.off(co,lo),this},close(){ao.close()}})}const send$1=async function(Xr,eo){var ro,no,io,oo;let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};switch(invariant$1(!!(to!=null&&to.node),'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),invariant$1(!!eo.ix,"SDK Send Error: context.ix must be defined."),Xr=await Xr,!0){case eo.ix.isTransaction(Xr):return to.sendTransaction?to.sendTransaction(Xr,eo,to):sendTransaction(Xr,eo,to);case eo.ix.isGetTransactionStatus(Xr):return to.sendGetTransactionStatus?to.sendGetTransactionStatus(Xr,eo,to):sendGetTransactionStatus(Xr,eo,to);case eo.ix.isGetTransaction(Xr):return to.sendGetTransaction?to.sendGetTransaction(Xr,eo,to):sendGetTransaction(Xr,eo,to);case eo.ix.isScript(Xr):return to.sendExecuteScript?to.sendExecuteScript(Xr,eo,to):sendExecuteScript(Xr,eo,to);case eo.ix.isGetAccount(Xr):return to.sendGetAccount?to.sendGetAccount(Xr,eo,to):sendGetAccount(Xr,eo,to);case eo.ix.isGetEvents(Xr):return to.sendGetEvents?to.sendGetEvents(Xr,eo,to):sendGetEvents(Xr,eo,to);case((no=(ro=eo.ix).isSubscribeEvents)==null?void 0:no.call(ro,Xr)):return to.connectSubscribeEvents?to.connectSubscribeEvents(Xr,eo,to):connectSubscribeEvents(Xr,eo,to);case eo.ix.isGetBlock(Xr):return to.sendGetBlock?to.sendGetBlock(Xr,eo,to):sendGetBlock(Xr,eo,to);case eo.ix.isGetBlockHeader(Xr):return to.sendGetBlockHeader?to.sendGetBlockHeader(Xr,eo,to):sendGetBlockHeader(Xr,eo,to);case eo.ix.isGetCollection(Xr):return to.sendGetCollection?to.sendGetCollection(Xr,eo,to):sendGetCollection(Xr,eo,to);case eo.ix.isPing(Xr):return to.sendPing?to.sendPing(Xr,eo,to):sendPing(Xr,eo,to);case eo.ix.isGetNetworkParameters(Xr):return to.sendGetNetworkParameters?to.sendGetNetworkParameters(Xr,eo,to):sendGetNetworkParameters(Xr,eo,to);case((oo=(io=eo.ix).isGetNodeVersionInfo)==null?void 0:oo.call(io,Xr)):return to.sendGetNodeVersionInfo?to.sendGetNodeVersionInfo(Xr,eo,to):sendGetNodeVersionInfo(Xr,eo,to);default:return Xr}};var sha3={},sponge={},permute={},chi={},copy=function Xr(eo,to){return function(ro,no){var io=no*2,oo=to*2;ro[io]=eo[oo],ro[io+1]=eo[oo+1]}},copy_1=copy;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(copy_1);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){for(var ao=oo.A,so=oo.C,co=0;co<25;co+=5){for(var lo=0;lo<5;lo++)(0,eo.default)(ao,co+lo)(so,lo);for(var fo=0;fo<5;fo++){var ho=(co+fo)*2,go=(fo+1)%5*2,yo=(fo+2)%5*2;ao[ho]^=~so[go]&so[yo],ao[ho+1]^=~so[go+1]&so[yo+1]}}},no=ro;Xr.default=no})(chi);var iota={},roundConstants={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]),to=eo;Xr.default=to})(roundConstants);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(roundConstants);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){var ao=oo.A,so=oo.roundIndex,co=so*2;ao[0]^=eo.default[co],ao[1]^=eo.default[co+1]},no=ro;Xr.default=no})(iota);var rhoPi={},piShuffles={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1],to=eo;Xr.default=to})(piShuffles);var rhoOffsets={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44],to=eo;Xr.default=to})(rhoOffsets);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=no(piShuffles),to=no(rhoOffsets),ro=no(copy_1);function no(ao){return ao&&ao.__esModule?ao:{default:ao}}var io=function(so){var co=so.A,lo=so.C,fo=so.W;(0,ro.default)(co,1)(fo,0);for(var ho=0,go=0,yo=0,vo=32,wo=0;wo<24;wo++){var Eo=eo.default[wo],ko=to.default[wo];(0,ro.default)(co,Eo)(lo,0),ho=fo[0],go=fo[1],vo=32-ko,yo=ko<32?0:1,fo[yo]=ho<>>vo,fo[(yo+1)%2]=go<>>vo,(0,ro.default)(fo,0)(co,Eo),(0,ro.default)(lo,0)(fo,0)}},oo=io;Xr.default=oo})(rhoPi);var theta={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(copy_1);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){for(var ao=oo.A,so=oo.C,co=oo.D,lo=oo.W,fo=0,ho=0,go=0;go<5;go++){var yo=go*2,vo=(go+5)*2,wo=(go+10)*2,Eo=(go+15)*2,ko=(go+20)*2;so[yo]=ao[yo]^ao[vo]^ao[wo]^ao[Eo]^ao[ko],so[yo+1]=ao[yo+1]^ao[vo+1]^ao[wo+1]^ao[Eo+1]^ao[ko+1]}for(var Ao=0;Ao<5;Ao++){(0,eo.default)(so,(Ao+1)%5)(lo,0),fo=lo[0],ho=lo[1],lo[0]=fo<<1|ho>>>31,lo[1]=ho<<1|fo>>>31,co[Ao*2]=so[(Ao+4)%5*2]^lo[0],co[Ao*2+1]=so[(Ao+4)%5*2+1]^lo[1];for(var Po=0;Po<25;Po+=5)ao[(Po+Ao)*2]^=co[Ao*2],ao[(Po+Ao)*2+1]^=co[Ao*2+1]}},no=ro;Xr.default=no})(theta);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=io(chi),to=io(iota),ro=io(rhoPi),no=io(theta);function io(so){return so&&so.__esModule?so:{default:so}}var oo=function(){var co=new Uint32Array(10),lo=new Uint32Array(10),fo=new Uint32Array(2);return function(ho){for(var go=0;go<24;go++)(0,no.default)({A:ho,C:co,D:lo,W:fo}),(0,ro.default)({A:ho,C:co,W:fo}),(0,eo.default)({A:ho,C:co}),(0,to.default)({A:ho,roundIndex:go});co.fill(0),lo.fill(0),fo.fill(0)}},ao=oo;Xr.default=ao})(permute);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=require$$0$9,to=ro(permute);function ro(so){return so&&so.__esModule?so:{default:so}}var no=function(co,lo){for(var fo=0;fo>>8,lo[fo+2]=co[ho+1]>>>16,lo[fo+3]=co[ho+1]>>>24,lo[fo+4]=co[ho],lo[fo+5]=co[ho]>>>8,lo[fo+6]=co[ho]>>>16,lo[fo+7]=co[ho]>>>24}return lo},oo=function(co){var lo=this,fo=co.capacity,ho=co.padding,go=(0,to.default)(),yo=200,vo=fo/8,wo=yo-fo/4,Eo=0,ko=new Uint32Array(yo/4),Ao=eo.Buffer.allocUnsafe(wo);return this.absorb=function(Po){for(var jo=0;jo=wo&&(no(Ao,ko),go(ko),Eo=0);return lo},this.squeeze=function(){var Po=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},jo={buffer:Po.buffer||eo.Buffer.allocUnsafe(vo),padding:Po.padding||ho,queue:eo.Buffer.allocUnsafe(Ao.length),state:new Uint32Array(ko.length)};Ao.copy(jo.queue);for(var Mo=0;Mo0&&arguments[0]!==void 0?arguments[0]:go;if(!this||this.constructor!==vo)return new vo(Eo);if(ho&&!ho.includes(Eo))throw new Error("Unsupported hash length");var ko=new to.default({capacity:Eo});return this.update=function(Ao){var Po=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"utf8";if(eo.Buffer.isBuffer(Ao))return ko.absorb(Ao),wo;if(typeof Ao=="string")return wo.update(eo.Buffer.from(Ao,Po));throw new TypeError("Not a string or buffer")},this.digest=function(){var Ao=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"binary",Po=typeof Ao=="string"?{format:Ao}:Ao,jo=ko.squeeze({buffer:Po.buffer,padding:Po.padding||yo});return Po.format&&Po.format!=="binary"?jo.toString(Po.format):jo},this.reset=function(){return ko.reset(),wo},this}},io=no({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});Xr.Keccak=io;var oo=no({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});Xr.SHA3=oo;var ao=no({allowedSizes:[128,256],defaultSize:256,padding:31});Xr.SHAKE=ao;var so=io;Xr.SHA3Hash=so,oo.SHA3Hash=so;var co=oo;Xr.default=co})(sha3);function interleave(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(!Xr.length&&!eo.length||!Xr.length)return to;if(!eo.length)return to.push(...Xr),to;const[ro,...no]=Xr,[io,...oo]=eo;return ro!==void 0&&to.push(ro),io!==void 0&&to.push(io),interleave(no,oo,to)}function recApply(Xr){return function(eo){return typeof eo=="function"?(log.deprecate({pkg:"FCL/SDK",subject:"Interopolation of functions into template literals",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"}),recApply(Xr)(eo(Xr))):String(eo)}}function template(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;roXr:typeof Xr=="function"?Xr:no=>interleave([...Xr],to.map(recApply(no))).join("").trim()}const ACCT=`{ + `;super(oo),this.name="WebsocketError",this.code=to,this.reason=ro,this.wasClean=!1}}function connectWs(Xr){let{hostname:eo,path:to,params:ro,getParams:no,retryLimit:io=5,retryIntervalMs:oo=1e3}=Xr;if(no&&ro)throw new Error("connectWs: cannot specify both params and getParams");let ao=new eventsExports.EventEmitter,so=0;const co=no||(()=>ro);let lo=()=>{};return function uo(){let ho=!1,go=!1;const bo=buildConnectionUrl(eo,to,co()),wo=new WebSocket$1(bo);wo.onmessage=function(Eo){const $o=safeParseJSON(Eo.data);$o?ao.emit("data",$o):(ao.emit("error",new WebsocketError({message:"invalid JSON data"})),this.close())},wo.onclose=function(Eo){if(ho){ao.emit("close"),ao.removeAllListeners();return}go?setTimeout(uo,oo):so{ao.emit("close"),ao.removeAllListeners()}))},wo.onopen=function(){go=!0,so=0},lo=()=>{ho=!0,wo.close()}}(),{on(uo,ho){return ao.on(uo,ho),this},off(uo,ho){return ao.off(uo,ho),this},close(){lo()}}}function buildConnectionUrl(Xr,eo,to){const ro=new URL(eo||"",Xr);return ro.protocol==="https:"?ro.protocol="wss:":ro.protocol==="http:"&&(ro.protocol="ws:"),Object.entries(to||{}).forEach(no=>{let[io,oo]=no;if(oo){let ao;Array.isArray(oo)?ao=oo.join(","):ao=oo.toString(),ro.searchParams.append(io,ao)}}),ro.toString()}function constructData(Xr,eo,to){var no;const ro=eo.response();return ro.tag=Xr.tag,ro.events=((no=to.Events)==null?void 0:no.length)>0?to.Events.map(io=>({blockId:to.BlockID,blockHeight:Number(to.Height),blockTimestamp:to.Timestamp,type:io.Type,transactionId:io.TransactionID,transactionIndex:Number(io.TransactionIndex),eventIndex:Number(io.EventIndex),payload:JSON.parse(eo.Buffer.from(io.Payload,"base64").toString())})):null,ro.heartbeat={blockId:to.BlockID,blockHeight:Number(to.Height),blockTimestamp:to.Timestamp},ro}function constructResponse(Xr,eo,to){const ro=eo.response();return ro.tag=Xr.tag,ro.streamConnection=to,ro}async function connectSubscribeEvents(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};invariant$1(to.node,"SDK Send Get Events Error: opts.node must be defined."),invariant$1(eo.response,"SDK Send Get Events Error: context.response must be defined."),invariant$1(eo.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const ro=await Xr,no=to.connectWs||connectWs,io=new eventsExports.EventEmitter;let oo=null;const ao=no({hostname:to.node,path:"/v1/subscribe_events",getParams:()=>{var lo,uo,ho,go,bo,wo;const co={event_types:(lo=ro.subscribeEvents)==null?void 0:lo.eventTypes,addresses:(uo=ro.subscribeEvents)==null?void 0:uo.addresses,contracts:(ho=ro.subscribeEvents)==null?void 0:ho.contracts,heartbeat_interval:(go=ro.subscribeEvents)==null?void 0:go.heartbeatInterval};return oo?co.start_height=oo+1:(co.start_block_id=(bo=ro.subscribeEvents)==null?void 0:bo.startBlockId,co.start_height=(wo=ro.subscribeEvents)==null?void 0:wo.startHeight),co}});return ao.on("data",co=>{const lo=constructData(ro,eo,co);oo=lo.heartbeat.blockHeight,io.emit("data",lo)}),ao.on("error",co=>{io.emit("error",co)}),ao.on("close",()=>{io.emit("close")}),constructResponse(ro,eo,{on(co,lo){return io.on(co,lo),this},off(co,lo){return io.off(co,lo),this},close(){ao.close()}})}const send$1=async function(Xr,eo){var ro,no,io,oo;let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};switch(invariant$1(!!(to!=null&&to.node),'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),invariant$1(!!eo.ix,"SDK Send Error: context.ix must be defined."),Xr=await Xr,!0){case eo.ix.isTransaction(Xr):return to.sendTransaction?to.sendTransaction(Xr,eo,to):sendTransaction(Xr,eo,to);case eo.ix.isGetTransactionStatus(Xr):return to.sendGetTransactionStatus?to.sendGetTransactionStatus(Xr,eo,to):sendGetTransactionStatus(Xr,eo,to);case eo.ix.isGetTransaction(Xr):return to.sendGetTransaction?to.sendGetTransaction(Xr,eo,to):sendGetTransaction(Xr,eo,to);case eo.ix.isScript(Xr):return to.sendExecuteScript?to.sendExecuteScript(Xr,eo,to):sendExecuteScript(Xr,eo,to);case eo.ix.isGetAccount(Xr):return to.sendGetAccount?to.sendGetAccount(Xr,eo,to):sendGetAccount(Xr,eo,to);case eo.ix.isGetEvents(Xr):return to.sendGetEvents?to.sendGetEvents(Xr,eo,to):sendGetEvents(Xr,eo,to);case((no=(ro=eo.ix).isSubscribeEvents)==null?void 0:no.call(ro,Xr)):return to.connectSubscribeEvents?to.connectSubscribeEvents(Xr,eo,to):connectSubscribeEvents(Xr,eo,to);case eo.ix.isGetBlock(Xr):return to.sendGetBlock?to.sendGetBlock(Xr,eo,to):sendGetBlock(Xr,eo,to);case eo.ix.isGetBlockHeader(Xr):return to.sendGetBlockHeader?to.sendGetBlockHeader(Xr,eo,to):sendGetBlockHeader(Xr,eo,to);case eo.ix.isGetCollection(Xr):return to.sendGetCollection?to.sendGetCollection(Xr,eo,to):sendGetCollection(Xr,eo,to);case eo.ix.isPing(Xr):return to.sendPing?to.sendPing(Xr,eo,to):sendPing(Xr,eo,to);case eo.ix.isGetNetworkParameters(Xr):return to.sendGetNetworkParameters?to.sendGetNetworkParameters(Xr,eo,to):sendGetNetworkParameters(Xr,eo,to);case((oo=(io=eo.ix).isGetNodeVersionInfo)==null?void 0:oo.call(io,Xr)):return to.sendGetNodeVersionInfo?to.sendGetNodeVersionInfo(Xr,eo,to):sendGetNodeVersionInfo(Xr,eo,to);default:return Xr}};var sha3={},sponge={},permute={},chi={},copy=function Xr(eo,to){return function(ro,no){var io=no*2,oo=to*2;ro[io]=eo[oo],ro[io+1]=eo[oo+1]}},copy_1=copy;(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(copy_1);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){for(var ao=oo.A,so=oo.C,co=0;co<25;co+=5){for(var lo=0;lo<5;lo++)(0,eo.default)(ao,co+lo)(so,lo);for(var uo=0;uo<5;uo++){var ho=(co+uo)*2,go=(uo+1)%5*2,bo=(uo+2)%5*2;ao[ho]^=~so[go]&so[bo],ao[ho+1]^=~so[go+1]&so[bo+1]}}},no=ro;Xr.default=no})(chi);var iota={},roundConstants={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]),to=eo;Xr.default=to})(roundConstants);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(roundConstants);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){var ao=oo.A,so=oo.roundIndex,co=so*2;ao[0]^=eo.default[co],ao[1]^=eo.default[co+1]},no=ro;Xr.default=no})(iota);var rhoPi={},piShuffles={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1],to=eo;Xr.default=to})(piShuffles);var rhoOffsets={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44],to=eo;Xr.default=to})(rhoOffsets);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=no(piShuffles),to=no(rhoOffsets),ro=no(copy_1);function no(ao){return ao&&ao.__esModule?ao:{default:ao}}var io=function(so){var co=so.A,lo=so.C,uo=so.W;(0,ro.default)(co,1)(uo,0);for(var ho=0,go=0,bo=0,wo=32,Eo=0;Eo<24;Eo++){var $o=eo.default[Eo],Co=to.default[Eo];(0,ro.default)(co,$o)(lo,0),ho=uo[0],go=uo[1],wo=32-Co,bo=Co<32?0:1,uo[bo]=ho<>>wo,uo[(bo+1)%2]=go<>>wo,(0,ro.default)(uo,0)(co,$o),(0,ro.default)(lo,0)(uo,0)}},oo=io;Xr.default=oo})(rhoPi);var theta={};(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=to(copy_1);function to(io){return io&&io.__esModule?io:{default:io}}var ro=function(oo){for(var ao=oo.A,so=oo.C,co=oo.D,lo=oo.W,uo=0,ho=0,go=0;go<5;go++){var bo=go*2,wo=(go+5)*2,Eo=(go+10)*2,$o=(go+15)*2,Co=(go+20)*2;so[bo]=ao[bo]^ao[wo]^ao[Eo]^ao[$o]^ao[Co],so[bo+1]=ao[bo+1]^ao[wo+1]^ao[Eo+1]^ao[$o+1]^ao[Co+1]}for(var Ro=0;Ro<5;Ro++){(0,eo.default)(so,(Ro+1)%5)(lo,0),uo=lo[0],ho=lo[1],lo[0]=uo<<1|ho>>>31,lo[1]=ho<<1|uo>>>31,co[Ro*2]=so[(Ro+4)%5*2]^lo[0],co[Ro*2+1]=so[(Ro+4)%5*2+1]^lo[1];for(var Oo=0;Oo<25;Oo+=5)ao[(Oo+Ro)*2]^=co[Ro*2],ao[(Oo+Ro)*2+1]^=co[Ro*2+1]}},no=ro;Xr.default=no})(theta);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=io(chi),to=io(iota),ro=io(rhoPi),no=io(theta);function io(so){return so&&so.__esModule?so:{default:so}}var oo=function(){var co=new Uint32Array(10),lo=new Uint32Array(10),uo=new Uint32Array(2);return function(ho){for(var go=0;go<24;go++)(0,no.default)({A:ho,C:co,D:lo,W:uo}),(0,ro.default)({A:ho,C:co,W:uo}),(0,eo.default)({A:ho,C:co}),(0,to.default)({A:ho,roundIndex:go});co.fill(0),lo.fill(0),uo.fill(0)}},ao=oo;Xr.default=ao})(permute);(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.default=void 0;var eo=require$$0$9,to=ro(permute);function ro(so){return so&&so.__esModule?so:{default:so}}var no=function(co,lo){for(var uo=0;uo>>8,lo[uo+2]=co[ho+1]>>>16,lo[uo+3]=co[ho+1]>>>24,lo[uo+4]=co[ho],lo[uo+5]=co[ho]>>>8,lo[uo+6]=co[ho]>>>16,lo[uo+7]=co[ho]>>>24}return lo},oo=function(co){var lo=this,uo=co.capacity,ho=co.padding,go=(0,to.default)(),bo=200,wo=uo/8,Eo=bo-uo/4,$o=0,Co=new Uint32Array(bo/4),Ro=eo.Buffer.allocUnsafe(Eo);return this.absorb=function(Oo){for(var jo=0;jo=Eo&&(no(Ro,Co),go(Co),$o=0);return lo},this.squeeze=function(){var Oo=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},jo={buffer:Oo.buffer||eo.Buffer.allocUnsafe(wo),padding:Oo.padding||ho,queue:eo.Buffer.allocUnsafe(Ro.length),state:new Uint32Array(Co.length)};Ro.copy(jo.queue);for(var Bo=0;Bo0&&arguments[0]!==void 0?arguments[0]:go;if(!this||this.constructor!==wo)return new wo($o);if(ho&&!ho.includes($o))throw new Error("Unsupported hash length");var Co=new to.default({capacity:$o});return this.update=function(Ro){var Oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"utf8";if(eo.Buffer.isBuffer(Ro))return Co.absorb(Ro),Eo;if(typeof Ro=="string")return Eo.update(eo.Buffer.from(Ro,Oo));throw new TypeError("Not a string or buffer")},this.digest=function(){var Ro=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"binary",Oo=typeof Ro=="string"?{format:Ro}:Ro,jo=Co.squeeze({buffer:Oo.buffer,padding:Oo.padding||bo});return Oo.format&&Oo.format!=="binary"?jo.toString(Oo.format):jo},this.reset=function(){return Co.reset(),Eo},this}},io=no({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});Xr.Keccak=io;var oo=no({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});Xr.SHA3=oo;var ao=no({allowedSizes:[128,256],defaultSize:256,padding:31});Xr.SHAKE=ao;var so=io;Xr.SHA3Hash=so,oo.SHA3Hash=so;var co=oo;Xr.default=co})(sha3);function interleave(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(!Xr.length&&!eo.length||!Xr.length)return to;if(!eo.length)return to.push(...Xr),to;const[ro,...no]=Xr,[io,...oo]=eo;return ro!==void 0&&to.push(ro),io!==void 0&&to.push(io),interleave(no,oo,to)}function recApply(Xr){return function(eo){return typeof eo=="function"?(log.deprecate({pkg:"FCL/SDK",subject:"Interopolation of functions into template literals",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"}),recApply(Xr)(eo(Xr))):String(eo)}}function template(Xr){for(var eo=arguments.length,to=new Array(eo>1?eo-1:0),ro=1;roXr:typeof Xr=="function"?Xr:no=>interleave([...Xr],to.map(recApply(no))).join("").trim()}const ACCT=`{ "kind":"${InteractionResolverKind.ACCOUNT}", "tempId":null, "addr":null, @@ -2436,8 +4266,8 @@ You can learn more (including a guide on common transition paths) here: ${ro}`:" "collection": { "id":null } -}`,KEYS=new Set(Object.keys(JSON.parse(IX))),initInteraction=()=>JSON.parse(IX),interaction=()=>(log.deprecate({pkg:"FCL/SDK",message:"The interaction been deprecated from the Flow JS-SDK/FCL. use initInteraction instead",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0010-deprecate-interaction",level:LEVELS.warn}),initInteraction()),isNumber$1$1=Xr=>typeof Xr=="number",isArray$1=Xr=>Array.isArray(Xr),isObj$1=Xr=>Xr!==null&&typeof Xr=="object",isNull$1=Xr=>Xr==null,isFn$3=Xr=>typeof Xr=="function",isInteraction=Xr=>{if(!isObj$1(Xr)||isNull$1(Xr)||isNumber$1$1(Xr))return!1;for(let eo of KEYS)if(!Xr.hasOwnProperty(eo))return!1;return!0},Ok=Xr=>(Xr.status=InteractionStatus.OK,Xr),Bad=(Xr,eo)=>(Xr.status=InteractionStatus.BAD,Xr.reason=eo,Xr),makeIx=Xr=>eo=>(eo.tag=Xr,Ok(eo)),prepAccountKeyId=Xr=>Xr.keyId==null?Xr:(invariant$1(!isNaN(parseInt(Xr.keyId.toString())),"account.keyId must be an integer"),{...Xr,keyId:parseInt(Xr.keyId.toString())}),initAccount=()=>JSON.parse(ACCT),prepAccount=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return to=>{invariant$1(typeof Xr=="function"||typeof Xr=="object","prepAccount must be passed an authorization function or an account object"),invariant$1(eo.role!=null,"Account must have a role");const ro=initAccount(),no=eo.role,io=v4$1();let oo={...Xr};Xr.authorization&&isFn$3(Xr.authorization)&&(oo={resolve:Xr.authorization}),!Xr.authorization&&isFn$3(Xr)&&(oo={resolve:Xr});const ao=oo.resolve;return ao&&(oo.resolve=function(so){for(var co=arguments.length,lo=new Array(co>1?co-1:0),fo=1;fogo(await ho,...lo),so)}),oo=prepAccountKeyId(oo),to.accounts[io]={...ro,tempId:io,...oo,role:{...ro.role,...typeof Xr.role=="object"?Xr.role:{},...no?{[no]:!0}:{}}},no===TransactionRole.AUTHORIZER?to.authorizations.push(io):no===TransactionRole.PAYER?to.payer.push(io):no&&(to[no]=io),to}},makeArgument=Xr=>eo=>{let to=v4$1();return eo.message.arguments.push(to),eo.arguments[to]=JSON.parse(ARG),eo.arguments[to].tempId=to,eo.arguments[to].value=Xr.value,eo.arguments[to].asArgument=Xr.asArgument,eo.arguments[to].xform=Xr.xform,eo.arguments[to].resolve=Xr.resolve,eo.arguments[to].resolveArgument=isFn$3(Xr.resolveArgument)?Xr.resolveArgument.bind(Xr):Xr.resolveArgument,Ok(eo)},makeUnknown=makeIx(InteractionTag.UNKNOWN),makeScript=makeIx(InteractionTag.SCRIPT),makeTransaction=makeIx(InteractionTag.TRANSACTION),makeGetTransactionStatus=makeIx(InteractionTag.GET_TRANSACTION_STATUS),makeGetTransaction=makeIx(InteractionTag.GET_TRANSACTION),makeGetAccount=makeIx(InteractionTag.GET_ACCOUNT),makeGetEvents=makeIx(InteractionTag.GET_EVENTS),makePing=makeIx(InteractionTag.PING),makeGetBlock=makeIx(InteractionTag.GET_BLOCK),makeGetBlockHeader=makeIx(InteractionTag.GET_BLOCK_HEADER),makeGetCollection=makeIx(InteractionTag.GET_COLLECTION),makeGetNetworkParameters=makeIx(InteractionTag.GET_NETWORK_PARAMETERS),makeSubscribeEvents=makeIx(InteractionTag.SUBSCRIBE_EVENTS),makeGetNodeVerionInfo=makeIx(InteractionTag.GET_NODE_VERSION_INFO),is$5=Xr=>eo=>eo.tag===Xr,isUnknown=is$5(InteractionTag.UNKNOWN),isScript=is$5(InteractionTag.SCRIPT),isTransaction=is$5(InteractionTag.TRANSACTION),isGetTransactionStatus=is$5(InteractionTag.GET_TRANSACTION_STATUS),isGetTransaction=is$5(InteractionTag.GET_TRANSACTION),isGetAccount=is$5(InteractionTag.GET_ACCOUNT),isGetEvents=is$5(InteractionTag.GET_EVENTS),isPing=is$5(InteractionTag.PING),isGetBlock=is$5(InteractionTag.GET_BLOCK),isGetBlockHeader=is$5(InteractionTag.GET_BLOCK_HEADER),isGetCollection=is$5(InteractionTag.GET_COLLECTION),isGetNetworkParameters=is$5(InteractionTag.GET_NETWORK_PARAMETERS),isGetNodeVersionInfo=is$5(InteractionTag.GET_NODE_VERSION_INFO),isSubscribeEvents=is$5(InteractionTag.SUBSCRIBE_EVENTS),isOk=Xr=>Xr.status===InteractionStatus.OK,isBad=Xr=>Xr.status===InteractionStatus.BAD,why=Xr=>Xr.reason,isAccount=Xr=>Xr.kind===InteractionResolverKind.ACCOUNT,isArgument=Xr=>Xr.kind===InteractionResolverKind.ARGUMENT,hardMode=Xr=>{for(let eo of Object.keys(Xr))if(!KEYS.has(eo))throw new Error(`"${eo}" is an invalid root level Interaction property.`);return Xr},recPipe=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{if(Xr=hardMode(await Xr),isBad(Xr))throw new Error(`Interaction Error: ${Xr.reason}`);if(!eo.length)return Xr;const[to,...ro]=eo,no=await to;if(isFn$3(no))return recPipe(no(Xr),ro);if(isNull$1(no)||!no)return recPipe(Xr,ro);if(isInteraction(no))return recPipe(no,ro);throw new Error("Invalid Interaction Composition")}catch(to){throw to}};function pipe$1(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;topipe$1(ao,ro):recPipe(ro,no)}const identity$1=function(Xr){return Xr},get=(Xr,eo,to)=>Xr.assigns[eo]==null?to:Xr.assigns[eo],put=(Xr,eo)=>to=>(to.assigns[Xr]=eo,Ok(to)),update=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:identity$1;return to=>(to.assigns[Xr]=eo(to.assigns[Xr],to),Ok(to))},destroy=Xr=>eo=>(delete eo.assigns[Xr],Ok(eo));var ixModule=Object.freeze({__proto__:null,initInteraction,interaction,isNumber:isNumber$1$1,isArray:isArray$1,isObj:isObj$1,isNull:isNull$1,isFn:isFn$3,isInteraction,Ok,Bad,initAccount,prepAccount,makeArgument,makeUnknown,makeScript,makeTransaction,makeGetTransactionStatus,makeGetTransaction,makeGetAccount,makeGetEvents,makePing,makeGetBlock,makeGetBlockHeader,makeGetCollection,makeGetNetworkParameters,makeSubscribeEvents,makeGetNodeVerionInfo,isUnknown,isScript,isTransaction,isGetTransactionStatus,isGetTransaction,isGetAccount,isGetEvents,isPing,isGetBlock,isGetBlockHeader,isGetCollection,isGetNetworkParameters,isGetNodeVersionInfo,isSubscribeEvents,isOk,isBad,why,isAccount,isArgument,pipe:pipe$1,get,put,update,destroy});function build$1(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return pipe$1(initInteraction(),Xr)}const DEFAULT_RESPONSE={tag:null,transaction:null,transactionStatus:null,transactionId:null,encodedData:null,events:null,account:null,block:null,blockHeader:null,latestBlock:null,collection:null,networkParameters:null,streamConnection:null,heartbeat:null,nodeVersionInfo:null},response=()=>({...DEFAULT_RESPONSE});function getBlock(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return pipe$1([makeGetBlock,eo=>(eo.block.isSealed=Xr,Ok(eo))])}function getAccount(Xr){return pipe$1([makeGetAccount,eo=>(eo.account.addr=sansPrefix(Xr),Ok(eo))])}const decodeStream=(Xr,eo,to)=>{const ro=new EventEmitter$1;let no=taskQueue();Xr.on("data",async oo=>{const ao=Object.keys(oo).filter(co=>oo[co]!=null&&co!=="tag");let so=Promise.all(ao.map(async co=>{const lo={[co]:oo[co]},fo=await eo(lo,to);return{channel:co,message:fo}}));no.push(async()=>{(await so).forEach(lo=>{let{channel:fo,message:ho}=lo;ro.emit(fo,ho)})})});function io(oo){Xr.on(oo,ao=>{no.push(async()=>{ro.emit(oo,ao)})})}return io("close"),io("error"),{on(oo,ao){return ro.on(oo,ao),this},off(oo,ao){return ro.off(oo,ao),this},close:()=>{Xr.close()}}};function taskQueue(){let Xr=[],eo=!1;async function to(){if(!eo){for(eo=!0;Xr.length>0;){const ro=Xr.shift();await(ro==null?void 0:ro())}eo=!1}}return{push:ro=>{Xr.push(ro),to()}}}const latestBlockDeprecationNotice=()=>{log.deprecate({pkg:"@onflow/decode",subject:"Operating upon data of the latestBlock field of the response object",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field"})},decodeImplicit=async Xr=>Xr,decodeVoid=async()=>null,decodeType=async Xr=>Xr.staticType,decodePath=async Xr=>({domain:Xr.domain,identifier:Xr.identifier}),decodeCapability=async Xr=>({path:Xr.path,address:Xr.address,borrowType:Xr.borrowType}),decodeOptional=async(Xr,eo,to)=>Xr?await recurseDecode(Xr,eo,to):null,decodeReference=async Xr=>({address:Xr.address,type:Xr.type}),decodeArray=async(Xr,eo,to)=>await Promise.all(Xr.map(ro=>new Promise(async no=>no(await recurseDecode(ro,eo,[...to,ro.type]))))),decodeDictionary=async(Xr,eo,to)=>await Xr.reduce(async(ro,no)=>(ro=await ro,ro[await recurseDecode(no.key,eo,[...to,no.key])]=await recurseDecode(no.value,eo,[...to,no.key]),ro),Promise.resolve({})),decodeComposite=async(Xr,eo,to)=>{const ro=await Xr.fields.reduce(async(io,oo)=>(io=await io,io[oo.name]=await recurseDecode(oo.value,eo,[...to,oo.name]),io),Promise.resolve({})),no=Xr.id&&decoderLookup(eo,Xr.id);return no?await no(ro):ro},defaultDecoders={UInt:decodeImplicit,Int:decodeImplicit,UInt8:decodeImplicit,Int8:decodeImplicit,UInt16:decodeImplicit,Int16:decodeImplicit,UInt32:decodeImplicit,Int32:decodeImplicit,UInt64:decodeImplicit,Int64:decodeImplicit,UInt128:decodeImplicit,Int128:decodeImplicit,UInt256:decodeImplicit,Int256:decodeImplicit,Word8:decodeImplicit,Word16:decodeImplicit,Word32:decodeImplicit,Word64:decodeImplicit,UFix64:decodeImplicit,Fix64:decodeImplicit,String:decodeImplicit,Character:decodeImplicit,Bool:decodeImplicit,Address:decodeImplicit,Void:decodeVoid,Optional:decodeOptional,Reference:decodeReference,Array:decodeArray,Dictionary:decodeDictionary,Event:decodeComposite,Resource:decodeComposite,Struct:decodeComposite,Enum:decodeComposite,Type:decodeType,Path:decodePath,Capability:decodeCapability},decoderLookup=(Xr,eo)=>{const to=Object.keys(Xr).find(ro=>/^\/.*\/$/.test(ro)?new RegExp(ro.substring(1,ro.length-1)).test(eo):ro===eo);return eo&&to&&Xr[to]},recurseDecode=async(Xr,eo,to)=>{let ro=decoderLookup(eo,Xr.type);if(!ro)throw new Error(`Undefined Decoder Error: ${Xr.type}@${to.join(".")}`);return await ro(Xr.value,eo,to)},decode$1=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];const no={...Object.keys(defaultDecoders).filter(io=>!Object.keys(eo).find(oo=>new RegExp(oo).test(io))).reduce((io,oo)=>(io[oo]=defaultDecoders[oo],io),eo),...eo};return recurseDecode(Xr,no,to)},decodeResponse=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr.encodedData)return decode$1(Xr.encodedData,eo);if(Xr.transactionStatus)return{...Xr.transactionStatus,events:await Promise.all(Xr.transactionStatus.events.map(async function(ro){return{type:ro.type,transactionId:ro.transactionId,transactionIndex:ro.transactionIndex,eventIndex:ro.eventIndex,data:await decode$1(ro.payload,eo)}}))};if(Xr.transaction)return Xr.transaction;if(Xr.events)return await Promise.all(Xr.events.map(async function(ro){return{blockId:ro.blockId,blockHeight:ro.blockHeight,blockTimestamp:ro.blockTimestamp,type:ro.type,transactionId:ro.transactionId,transactionIndex:ro.transactionIndex,eventIndex:ro.eventIndex,data:await decode$1(ro.payload,eo)}}));if(Xr.account)return Xr.account;if(Xr.block)return Xr.block;if(Xr.blockHeader)return Xr.blockHeader;if(Xr.latestBlock)return latestBlockDeprecationNotice(),Xr.latestBlock;if(Xr.transactionId)return Xr.transactionId;if(Xr.collection)return Xr.collection;if(Xr.networkParameters){const to=/^flow-/,ro=Xr.networkParameters.chainId;let no;return ro==="flow-emulator"?no="local":to.test(ro)?no=ro.replace(to,""):no=ro,{chainId:no}}else{if(Xr.streamConnection)return decodeStream(Xr.streamConnection,decodeResponse,eo);if(Xr.heartbeat)return Xr.heartbeat;if(Xr.nodeVersionInfo)return Xr.nodeVersionInfo}return null},isFn$2=Xr=>typeof Xr=="function",isString$1$1=Xr=>typeof Xr=="string",oldIdentifierPatternFn=()=>/\b(0x\w+)\b/g;function isOldIdentifierSyntax(Xr){return oldIdentifierPatternFn().test(Xr)}const newIdentifierPatternFn=()=>/import\s+"(\w+)"/g;function isNewIdentifierSyntax(Xr){return newIdentifierPatternFn().test(Xr)}function getContractIdentifierSyntaxMatches(Xr){return Xr.matchAll(newIdentifierPatternFn())}async function resolveCadence(Xr){if(!isTransaction(Xr)&&!isScript(Xr))return Xr;var eo=get(Xr,"ix.cadence");if(invariant$1(isFn$2(eo)||isString$1$1(eo),"Cadence needs to be a function or a string."),isFn$2(eo)&&(eo=await eo({})),invariant$1(isString$1$1(eo),"Cadence needs to be a string at this point."),invariant$1(!isOldIdentifierSyntax(eo)||!isNewIdentifierSyntax(eo),"Both account identifier and contract identifier syntax not simultaneously supported."),isOldIdentifierSyntax(eo)&&(eo=await config().where(/^0x/).then(to=>Object.entries(to).reduce((ro,no)=>{let[io,oo]=no;const ao=new RegExp("(\\b"+io+"\\b)","g");return ro.replace(ao,oo)},eo))),isNewIdentifierSyntax(eo))for(const[to,ro]of getContractIdentifierSyntaxMatches(eo)){const no=await config().get(`system.contracts.${ro}`);no?eo=eo.replace(to,`import ${ro} from ${withPrefix$1(no)}`):log({title:"Contract Placeholder not found",message:`Cannot find a value for contract placeholder ${ro}. Please add to your flow.json or explicitly add it to the config 'contracts.*' namespace.`,level:LEVELS.warn})}return Xr.message.cadence=eo,Xr}const isFn$1=Xr=>typeof Xr=="function";function cast(Xr){if(invariant$1(typeof Xr.xform!=null,`No type specified for argument: ${Xr.value}`),isFn$1(Xr.xform))return Xr.xform(Xr.value);if(isFn$1(Xr.xform.asArgument))return Xr.xform.asArgument(Xr.value);invariant$1(!1,"Invalid Argument",Xr)}async function handleArgResolution(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;if(invariant$1(eo>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${Xr.tempId}`),isFn$1(Xr.resolveArgument)){const to=await Xr.resolveArgument();return handleArgResolution(to,eo-1)}else return Xr}async function resolveArguments(Xr){if(isTransaction(Xr)||isScript(Xr))for(let[eo,to]of Object.entries(Xr.arguments)){const ro=await handleArgResolution(to);Xr.arguments[eo].asArgument=cast(ro)}return Xr}const encodeTransactionPayload=Xr=>prependTransactionDomainTag(rlpEncode(preparePayload(Xr))),encodeTransactionEnvelope=Xr=>prependTransactionDomainTag(rlpEncode(prepareEnvelope(Xr))),rightPaddedHexBuffer=(Xr,eo)=>Buffer$1$1.from(Xr.padEnd(eo*2,"0"),"hex"),leftPaddedHexBuffer=(Xr,eo)=>Buffer$1$1.from(Xr.padStart(eo*2,"0"),"hex"),TRANSACTION_DOMAIN_TAG=rightPaddedHexBuffer(Buffer$1$1.from("FLOW-V0.0-transaction").toString("hex"),32).toString("hex"),prependTransactionDomainTag=Xr=>TRANSACTION_DOMAIN_TAG+Xr,addressBuffer=Xr=>leftPaddedHexBuffer(Xr,8),blockBuffer=Xr=>leftPaddedHexBuffer(Xr,32),argumentToString=Xr=>Buffer$1$1.from(JSON.stringify(Xr),"utf8"),scriptBuffer=Xr=>Buffer$1$1.from(Xr,"utf8"),signatureBuffer=Xr=>Buffer$1$1.from(Xr,"hex"),rlpEncode=Xr=>encode(Xr).toString("hex"),preparePayload=Xr=>(validatePayload(Xr),[scriptBuffer(Xr.cadence||""),Xr.arguments.map(argumentToString),blockBuffer(Xr.refBlock||""),Xr.computeLimit,addressBuffer(sansPrefix(Xr.proposalKey.address||"")),Xr.proposalKey.keyId,Xr.proposalKey.sequenceNum,addressBuffer(sansPrefix(Xr.payer)),Xr.authorizers.map(eo=>addressBuffer(sansPrefix(eo)))]),prepareEnvelope=Xr=>(validateEnvelope(Xr),[preparePayload(Xr),preparePayloadSignatures(Xr)]),preparePayloadSignatures=Xr=>{var to;const eo=collectSigners(Xr);return(to=Xr.payloadSigs)==null?void 0:to.map(ro=>({signerIndex:eo.get(ro.address)||"",keyId:ro.keyId,sig:ro.sig})).sort((ro,no)=>ro.signerIndex>no.signerIndex?1:ro.signerIndexno.keyId?1:ro.keyId[ro.signerIndex,ro.keyId,signatureBuffer(ro.sig)])},collectSigners=Xr=>{const eo=new Map;let to=0;const ro=no=>{eo.has(no)||(eo.set(no,to),to++)};return Xr.proposalKey.address&&ro(Xr.proposalKey.address),ro(Xr.payer),Xr.authorizers.forEach(ro),eo},validatePayload=Xr=>{payloadFields.forEach(eo=>checkField(Xr,eo)),proposalKeyFields.forEach(eo=>checkField(Xr.proposalKey,eo,"proposalKey"))},validateEnvelope=Xr=>{var eo;payloadSigsFields.forEach(to=>checkField(Xr,to)),(eo=Xr.payloadSigs)==null||eo.forEach((to,ro)=>{payloadSigFields.forEach(no=>checkField(to,no,"payloadSigs",ro))})},isNumber$2=Xr=>typeof Xr=="number",isString$2=Xr=>typeof Xr=="string",isObject$6=Xr=>Xr!==null&&typeof Xr=="object",isArray$2=Xr=>isObject$6(Xr)&&Xr instanceof Array,payloadFields=[{name:"cadence",check:isString$2},{name:"arguments",check:isArray$2},{name:"refBlock",check:isString$2,defaultVal:"0"},{name:"computeLimit",check:isNumber$2},{name:"proposalKey",check:isObject$6},{name:"payer",check:isString$2},{name:"authorizers",check:isArray$2}],proposalKeyFields=[{name:"address",check:isString$2},{name:"keyId",check:isNumber$2},{name:"sequenceNum",check:isNumber$2}],payloadSigsFields=[{name:"payloadSigs",check:isArray$2}],payloadSigFields=[{name:"address",check:isString$2},{name:"keyId",check:isNumber$2},{name:"sig",check:isString$2}],checkField=(Xr,eo,to,ro)=>{const{name:no,check:io,defaultVal:oo}=eo;if(Xr[no]==null&&oo!=null&&(Xr[no]=oo),Xr[no]==null)throw missingFieldError(no,to,ro);if(!io(Xr[no]))throw invalidFieldError(no,to,ro)},printFieldName=(Xr,eo,to)=>eo?to==null?`${eo}.${Xr}`:`${eo}.${to}.${Xr}`:Xr,missingFieldError=(Xr,eo,to)=>new Error(`Missing field ${printFieldName(Xr,eo,to)}`),invalidFieldError=(Xr,eo,to)=>new Error(`Invalid field ${printFieldName(Xr,eo,to)}`);function findInsideSigners(Xr){let eo=new Set(Xr.authorizations);return Xr.proposer&&eo.add(Xr.proposer),Array.isArray(Xr.payer)?Xr.payer.forEach(to=>eo.delete(to)):eo.delete(Xr.payer),Array.from(eo)}function findOutsideSigners(Xr){let eo=new Set(Array.isArray(Xr.payer)?Xr.payer:[Xr.payer]);return Array.from(eo)}const createSignableVoucher=Xr=>{const eo=()=>{const io=Xr.authorizations.map(oo=>withPrefix$1(Xr.accounts[oo].addr)).reduce((oo,ao)=>oo.find(so=>so===ao)?oo:[...oo,ao],[]);return io!=null&&io[0]?io:[]},to=()=>findInsideSigners(Xr).map(io=>({address:withPrefix$1(Xr.accounts[io].addr),keyId:Xr.accounts[io].keyId,sig:Xr.accounts[io].signature})),ro=()=>findOutsideSigners(Xr).map(io=>({address:withPrefix$1(Xr.accounts[io].addr),keyId:Xr.accounts[io].keyId,sig:Xr.accounts[io].signature})),no=Xr.proposer?{address:withPrefix$1(Xr.accounts[Xr.proposer].addr),keyId:Xr.accounts[Xr.proposer].keyId,sequenceNum:Xr.accounts[Xr.proposer].sequenceNum}:{};return{cadence:Xr.message.cadence,refBlock:Xr.message.refBlock||null,computeLimit:Xr.message.computeLimit,arguments:Xr.message.arguments.map(io=>Xr.arguments[io].asArgument),proposalKey:no,payer:withPrefix$1(Xr.accounts[Array.isArray(Xr.payer)?Xr.payer[0]:Xr.payer].addr),authorizers:eo(),payloadSigs:to(),envelopeSigs:ro()}},MAX_DEPTH_LIMIT=5,idof$1=Xr=>`${withPrefix$1(Xr.addr)}-${Xr.keyId}`,isFn$4=Xr=>Xr&&(Object.prototype.toString.call(Xr)==="[object Function]"||typeof Xr=="function"||Xr instanceof Function),genAccountId=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;to0&&arguments[0]!==void 0?arguments[0]:"",no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;to.push(Array(no*4).fill(Xr).join("-")+ro)},function(){return to.reduce((ro,no)=>ro+` -`+no)}]}function recurseFlatMap(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;return eo<=0||!Array.isArray(Xr)?Xr:recurseFlatMap(Xr.flatMap(to=>to),eo-1)}function buildPreSignable(Xr,eo){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:Xr.role,cadence:eo.message.cadence,args:eo.message.arguments.map(to=>eo.arguments[to].asArgument),data:{},interaction:eo,voucher:createSignableVoucher(eo)}}catch(to){throw console.error("buildPreSignable",to),to}}async function removeUnusedIxAccounts(Xr,eo){const to=Array.isArray(Xr.payer)?Xr.payer:[Xr.payer],ro=Array.isArray(Xr.authorizations)?Xr.authorizations:[Xr.authorizations],no=Xr.proposer===null?[]:Array.isArray(Xr.proposer)?Xr.proposer:[Xr.proposer],io=Object.keys(Xr.accounts),oo=[...new Set(to.concat(ro,no))];for(const ao of io)oo.find(so=>so===ao)||delete Xr.accounts[ao]}function addAccountToIx(Xr,eo){typeof eo.addr=="string"&&(typeof eo.keyId=="number"||typeof eo.keyId=="string")?eo.tempId=idof$1(eo):eo.tempId=eo.tempId||v4$1();const to=Xr.accounts[eo.tempId]||eo;return Xr.accounts[eo.tempId]||(Xr.accounts[eo.tempId]=eo),Xr.accounts[eo.tempId].role.proposer=to.role.proposer||eo.role.proposer,Xr.accounts[eo.tempId].role.payer=to.role.payer||eo.role.payer,Xr.accounts[eo.tempId].role.authorizer=to.role.authorizer||eo.role.authorizer,Xr.accounts[eo.tempId]}function uniqueAccountsFlatMap(Xr){const eo=recurseFlatMap(Xr),to=new Set;return eo.map(no=>{const io=genAccountId(no.tempId,no.role.payer,no.role.proposer,no.role.authorizer,no.role.param);return to.has(io)?null:(to.add(io),no)}).filter(no=>no!==null)}async function recurseResolveAccount(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:MAX_DEPTH_LIMIT,{debugLogger:ro}=arguments.length>3?arguments[3]:void 0;if(to<=0)throw new Error(`recurseResolveAccount Error: Depth limit (${MAX_DEPTH_LIMIT}) reached. Ensure your authorization functions resolve to an account after ${MAX_DEPTH_LIMIT} resolves.`);let no=Xr.accounts[eo];if(!no)return null;if(ro(`account: ${no.tempId}`,Math.max(MAX_DEPTH_LIMIT-to,0)),no!=null&&no.resolve)if(isFn$4(no==null?void 0:no.resolve)){ro(`account: ${no.tempId} -- cache MISS`,Math.max(MAX_DEPTH_LIMIT-to,0));const{resolve:io,...oo}=no;let ao=await io(oo,buildPreSignable(oo,Xr));ao=Array.isArray(ao)?ao:[ao];let so=recurseFlatMap(ao);so=so.map(lo=>addAccountToIx(Xr,lo)),no.resolve=so.map(lo=>lo.tempId),no=addAccountToIx(Xr,no);const co=await Promise.all(so.map(async lo=>await recurseResolveAccount(Xr,lo.tempId,to-1,{debugLogger:ro})));return co?recurseFlatMap(co):no.tempId}else return ro(`account: ${no.tempId} -- cache HIT`,Math.max(MAX_DEPTH_LIMIT-to,0)),no.resolve;return no.tempId}const getAccountTempIDs=Xr=>Xr===null?[]:Array.isArray(Xr)?Xr:[Xr];async function resolveAccountType(Xr,eo,to){let{debugLogger:ro}=to;invariant$1(Xr&&typeof Xr=="object","resolveAccountType Error: ix not defined"),invariant$1(eo===ROLES.PAYER||eo===ROLES.PROPOSER||eo===ROLES.AUTHORIZATIONS,"resolveAccountType Error: type must be 'payer', 'proposer' or 'authorizations'");let no=getAccountTempIDs(Xr[eo]),io=[];for(let oo of no){let ao=Xr.accounts[oo];invariant$1(!!ao,"resolveAccountType Error: account not found");let so=await recurseResolveAccount(Xr,oo,MAX_DEPTH_LIMIT,{debugLogger:ro});so=Array.isArray(so)?so:[so];let co=so.map(fo=>Xr.accounts[fo]),lo=uniqueAccountsFlatMap(co);io=io.concat(lo)}if(invariant$1(io.length>0,"resolveAccountType Error: failed to resolve any accounts"),eo===ROLES.PAYER&&(io=io.filter(oo=>oo.role.payer===!0)),eo===ROLES.PROPOSER&&(io=io.filter(oo=>oo.role.proposer===!0)),eo===ROLES.AUTHORIZATIONS&&(io=io.filter(oo=>oo.role.authorizer===!0)),Xr[eo]=Array.isArray(Xr[eo])?[...new Set(io.map(oo=>oo.tempId))]:io[0].tempId,eo===ROLES.PAYER){let oo;for(const ao of Xr[ROLES.PAYER]){let so=Xr.accounts[ao];if(!oo)oo=so.addr;else if(oo!==so.addr)throw new Error("resolveAccountType Error: payers from different accounts detected")}}}async function resolveAccounts(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(isTransaction(Xr)){Array.isArray(Xr.payer)||log.deprecate({pkg:"FCL",subject:'"ix.payer" must be an array. Support for ix.payer as a singular',message:"See changelog for more info."});let[to,ro]=debug$1();try{await resolveAccountType(Xr,ROLES.PROPOSER,{debugLogger:to}),await resolveAccountType(Xr,ROLES.AUTHORIZATIONS,{debugLogger:to}),await resolveAccountType(Xr,ROLES.PAYER,{debugLogger:to}),await removeUnusedIxAccounts(Xr,{debugLogger:to}),eo.enableDebug&&console.debug(ro())}catch(no){throw console.error(`=== SAD PANDA === +}`,KEYS=new Set(Object.keys(JSON.parse(IX))),initInteraction=()=>JSON.parse(IX),interaction=()=>(log.deprecate({pkg:"FCL/SDK",message:"The interaction been deprecated from the Flow JS-SDK/FCL. use initInteraction instead",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0010-deprecate-interaction",level:LEVELS.warn}),initInteraction()),isNumber$1$1=Xr=>typeof Xr=="number",isArray$1=Xr=>Array.isArray(Xr),isObj$1=Xr=>Xr!==null&&typeof Xr=="object",isNull$1=Xr=>Xr==null,isFn$3=Xr=>typeof Xr=="function",isInteraction=Xr=>{if(!isObj$1(Xr)||isNull$1(Xr)||isNumber$1$1(Xr))return!1;for(let eo of KEYS)if(!Xr.hasOwnProperty(eo))return!1;return!0},Ok=Xr=>(Xr.status=InteractionStatus.OK,Xr),Bad=(Xr,eo)=>(Xr.status=InteractionStatus.BAD,Xr.reason=eo,Xr),makeIx=Xr=>eo=>(eo.tag=Xr,Ok(eo)),prepAccountKeyId=Xr=>Xr.keyId==null?Xr:(invariant$1(!isNaN(parseInt(Xr.keyId.toString())),"account.keyId must be an integer"),{...Xr,keyId:parseInt(Xr.keyId.toString())}),initAccount=()=>JSON.parse(ACCT),prepAccount=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return to=>{invariant$1(typeof Xr=="function"||typeof Xr=="object","prepAccount must be passed an authorization function or an account object"),invariant$1(eo.role!=null,"Account must have a role");const ro=initAccount(),no=eo.role,io=v4$1();let oo={...Xr};Xr.authorization&&isFn$3(Xr.authorization)&&(oo={resolve:Xr.authorization}),!Xr.authorization&&isFn$3(Xr)&&(oo={resolve:Xr});const ao=oo.resolve;return ao&&(oo.resolve=function(so){for(var co=arguments.length,lo=new Array(co>1?co-1:0),uo=1;uogo(await ho,...lo),so)}),oo=prepAccountKeyId(oo),to.accounts[io]={...ro,tempId:io,...oo,role:{...ro.role,...typeof Xr.role=="object"?Xr.role:{},...no?{[no]:!0}:{}}},no===TransactionRole.AUTHORIZER?to.authorizations.push(io):no===TransactionRole.PAYER?to.payer.push(io):no&&(to[no]=io),to}},makeArgument=Xr=>eo=>{let to=v4$1();return eo.message.arguments.push(to),eo.arguments[to]=JSON.parse(ARG),eo.arguments[to].tempId=to,eo.arguments[to].value=Xr.value,eo.arguments[to].asArgument=Xr.asArgument,eo.arguments[to].xform=Xr.xform,eo.arguments[to].resolve=Xr.resolve,eo.arguments[to].resolveArgument=isFn$3(Xr.resolveArgument)?Xr.resolveArgument.bind(Xr):Xr.resolveArgument,Ok(eo)},makeUnknown=makeIx(InteractionTag.UNKNOWN),makeScript=makeIx(InteractionTag.SCRIPT),makeTransaction=makeIx(InteractionTag.TRANSACTION),makeGetTransactionStatus=makeIx(InteractionTag.GET_TRANSACTION_STATUS),makeGetTransaction=makeIx(InteractionTag.GET_TRANSACTION),makeGetAccount=makeIx(InteractionTag.GET_ACCOUNT),makeGetEvents=makeIx(InteractionTag.GET_EVENTS),makePing=makeIx(InteractionTag.PING),makeGetBlock=makeIx(InteractionTag.GET_BLOCK),makeGetBlockHeader=makeIx(InteractionTag.GET_BLOCK_HEADER),makeGetCollection=makeIx(InteractionTag.GET_COLLECTION),makeGetNetworkParameters=makeIx(InteractionTag.GET_NETWORK_PARAMETERS),makeSubscribeEvents=makeIx(InteractionTag.SUBSCRIBE_EVENTS),makeGetNodeVerionInfo=makeIx(InteractionTag.GET_NODE_VERSION_INFO),is$5=Xr=>eo=>eo.tag===Xr,isUnknown=is$5(InteractionTag.UNKNOWN),isScript=is$5(InteractionTag.SCRIPT),isTransaction=is$5(InteractionTag.TRANSACTION),isGetTransactionStatus=is$5(InteractionTag.GET_TRANSACTION_STATUS),isGetTransaction=is$5(InteractionTag.GET_TRANSACTION),isGetAccount=is$5(InteractionTag.GET_ACCOUNT),isGetEvents=is$5(InteractionTag.GET_EVENTS),isPing=is$5(InteractionTag.PING),isGetBlock=is$5(InteractionTag.GET_BLOCK),isGetBlockHeader=is$5(InteractionTag.GET_BLOCK_HEADER),isGetCollection=is$5(InteractionTag.GET_COLLECTION),isGetNetworkParameters=is$5(InteractionTag.GET_NETWORK_PARAMETERS),isGetNodeVersionInfo=is$5(InteractionTag.GET_NODE_VERSION_INFO),isSubscribeEvents=is$5(InteractionTag.SUBSCRIBE_EVENTS),isOk=Xr=>Xr.status===InteractionStatus.OK,isBad=Xr=>Xr.status===InteractionStatus.BAD,why=Xr=>Xr.reason,isAccount=Xr=>Xr.kind===InteractionResolverKind.ACCOUNT,isArgument=Xr=>Xr.kind===InteractionResolverKind.ARGUMENT,hardMode=Xr=>{for(let eo of Object.keys(Xr))if(!KEYS.has(eo))throw new Error(`"${eo}" is an invalid root level Interaction property.`);return Xr},recPipe=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{if(Xr=hardMode(await Xr),isBad(Xr))throw new Error(`Interaction Error: ${Xr.reason}`);if(!eo.length)return Xr;const[to,...ro]=eo,no=await to;if(isFn$3(no))return recPipe(no(Xr),ro);if(isNull$1(no)||!no)return recPipe(Xr,ro);if(isInteraction(no))return recPipe(no,ro);throw new Error("Invalid Interaction Composition")}catch(to){throw to}};function pipe$1(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;topipe$1(ao,ro):recPipe(ro,no)}const identity$1=function(Xr){return Xr},get=(Xr,eo,to)=>Xr.assigns[eo]==null?to:Xr.assigns[eo],put=(Xr,eo)=>to=>(to.assigns[Xr]=eo,Ok(to)),update=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:identity$1;return to=>(to.assigns[Xr]=eo(to.assigns[Xr],to),Ok(to))},destroy=Xr=>eo=>(delete eo.assigns[Xr],Ok(eo));var ixModule=Object.freeze({__proto__:null,initInteraction,interaction,isNumber:isNumber$1$1,isArray:isArray$1,isObj:isObj$1,isNull:isNull$1,isFn:isFn$3,isInteraction,Ok,Bad,initAccount,prepAccount,makeArgument,makeUnknown,makeScript,makeTransaction,makeGetTransactionStatus,makeGetTransaction,makeGetAccount,makeGetEvents,makePing,makeGetBlock,makeGetBlockHeader,makeGetCollection,makeGetNetworkParameters,makeSubscribeEvents,makeGetNodeVerionInfo,isUnknown,isScript,isTransaction,isGetTransactionStatus,isGetTransaction,isGetAccount,isGetEvents,isPing,isGetBlock,isGetBlockHeader,isGetCollection,isGetNetworkParameters,isGetNodeVersionInfo,isSubscribeEvents,isOk,isBad,why,isAccount,isArgument,pipe:pipe$1,get,put,update,destroy});function build$1(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return pipe$1(initInteraction(),Xr)}const DEFAULT_RESPONSE={tag:null,transaction:null,transactionStatus:null,transactionId:null,encodedData:null,events:null,account:null,block:null,blockHeader:null,latestBlock:null,collection:null,networkParameters:null,streamConnection:null,heartbeat:null,nodeVersionInfo:null},response=()=>({...DEFAULT_RESPONSE});function getBlock(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return pipe$1([makeGetBlock,eo=>(eo.block.isSealed=Xr,Ok(eo))])}function getAccount(Xr){return pipe$1([makeGetAccount,eo=>(eo.account.addr=sansPrefix(Xr),Ok(eo))])}const decodeStream=(Xr,eo,to)=>{const ro=new EventEmitter$1;let no=taskQueue();Xr.on("data",async oo=>{const ao=Object.keys(oo).filter(co=>oo[co]!=null&&co!=="tag");let so=Promise.all(ao.map(async co=>{const lo={[co]:oo[co]},uo=await eo(lo,to);return{channel:co,message:uo}}));no.push(async()=>{(await so).forEach(lo=>{let{channel:uo,message:ho}=lo;ro.emit(uo,ho)})})});function io(oo){Xr.on(oo,ao=>{no.push(async()=>{ro.emit(oo,ao)})})}return io("close"),io("error"),{on(oo,ao){return ro.on(oo,ao),this},off(oo,ao){return ro.off(oo,ao),this},close:()=>{Xr.close()}}};function taskQueue(){let Xr=[],eo=!1;async function to(){if(!eo){for(eo=!0;Xr.length>0;){const ro=Xr.shift();await(ro==null?void 0:ro())}eo=!1}}return{push:ro=>{Xr.push(ro),to()}}}const latestBlockDeprecationNotice=()=>{log.deprecate({pkg:"@onflow/decode",subject:"Operating upon data of the latestBlock field of the response object",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field"})},decodeImplicit=async Xr=>Xr,decodeVoid=async()=>null,decodeType=async Xr=>Xr.staticType,decodePath=async Xr=>({domain:Xr.domain,identifier:Xr.identifier}),decodeCapability=async Xr=>({path:Xr.path,address:Xr.address,borrowType:Xr.borrowType}),decodeOptional=async(Xr,eo,to)=>Xr?await recurseDecode(Xr,eo,to):null,decodeReference=async Xr=>({address:Xr.address,type:Xr.type}),decodeArray=async(Xr,eo,to)=>await Promise.all(Xr.map(ro=>new Promise(async no=>no(await recurseDecode(ro,eo,[...to,ro.type]))))),decodeDictionary=async(Xr,eo,to)=>await Xr.reduce(async(ro,no)=>(ro=await ro,ro[await recurseDecode(no.key,eo,[...to,no.key])]=await recurseDecode(no.value,eo,[...to,no.key]),ro),Promise.resolve({})),decodeComposite=async(Xr,eo,to)=>{const ro=await Xr.fields.reduce(async(io,oo)=>(io=await io,io[oo.name]=await recurseDecode(oo.value,eo,[...to,oo.name]),io),Promise.resolve({})),no=Xr.id&&decoderLookup(eo,Xr.id);return no?await no(ro):ro},defaultDecoders={UInt:decodeImplicit,Int:decodeImplicit,UInt8:decodeImplicit,Int8:decodeImplicit,UInt16:decodeImplicit,Int16:decodeImplicit,UInt32:decodeImplicit,Int32:decodeImplicit,UInt64:decodeImplicit,Int64:decodeImplicit,UInt128:decodeImplicit,Int128:decodeImplicit,UInt256:decodeImplicit,Int256:decodeImplicit,Word8:decodeImplicit,Word16:decodeImplicit,Word32:decodeImplicit,Word64:decodeImplicit,UFix64:decodeImplicit,Fix64:decodeImplicit,String:decodeImplicit,Character:decodeImplicit,Bool:decodeImplicit,Address:decodeImplicit,Void:decodeVoid,Optional:decodeOptional,Reference:decodeReference,Array:decodeArray,Dictionary:decodeDictionary,Event:decodeComposite,Resource:decodeComposite,Struct:decodeComposite,Enum:decodeComposite,Type:decodeType,Path:decodePath,Capability:decodeCapability},decoderLookup=(Xr,eo)=>{const to=Object.keys(Xr).find(ro=>/^\/.*\/$/.test(ro)?new RegExp(ro.substring(1,ro.length-1)).test(eo):ro===eo);return eo&&to&&Xr[to]},recurseDecode=async(Xr,eo,to)=>{let ro=decoderLookup(eo,Xr.type);if(!ro)throw new Error(`Undefined Decoder Error: ${Xr.type}@${to.join(".")}`);return await ro(Xr.value,eo,to)},decode$1=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];const no={...Object.keys(defaultDecoders).filter(io=>!Object.keys(eo).find(oo=>new RegExp(oo).test(io))).reduce((io,oo)=>(io[oo]=defaultDecoders[oo],io),eo),...eo};return recurseDecode(Xr,no,to)},decodeResponse=async function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr.encodedData)return decode$1(Xr.encodedData,eo);if(Xr.transactionStatus)return{...Xr.transactionStatus,events:await Promise.all(Xr.transactionStatus.events.map(async function(ro){return{type:ro.type,transactionId:ro.transactionId,transactionIndex:ro.transactionIndex,eventIndex:ro.eventIndex,data:await decode$1(ro.payload,eo)}}))};if(Xr.transaction)return Xr.transaction;if(Xr.events)return await Promise.all(Xr.events.map(async function(ro){return{blockId:ro.blockId,blockHeight:ro.blockHeight,blockTimestamp:ro.blockTimestamp,type:ro.type,transactionId:ro.transactionId,transactionIndex:ro.transactionIndex,eventIndex:ro.eventIndex,data:await decode$1(ro.payload,eo)}}));if(Xr.account)return Xr.account;if(Xr.block)return Xr.block;if(Xr.blockHeader)return Xr.blockHeader;if(Xr.latestBlock)return latestBlockDeprecationNotice(),Xr.latestBlock;if(Xr.transactionId)return Xr.transactionId;if(Xr.collection)return Xr.collection;if(Xr.networkParameters){const to=/^flow-/,ro=Xr.networkParameters.chainId;let no;return ro==="flow-emulator"?no="local":to.test(ro)?no=ro.replace(to,""):no=ro,{chainId:no}}else{if(Xr.streamConnection)return decodeStream(Xr.streamConnection,decodeResponse,eo);if(Xr.heartbeat)return Xr.heartbeat;if(Xr.nodeVersionInfo)return Xr.nodeVersionInfo}return null},isFn$2=Xr=>typeof Xr=="function",isString$1$1=Xr=>typeof Xr=="string",oldIdentifierPatternFn=()=>/\b(0x\w+)\b/g;function isOldIdentifierSyntax(Xr){return oldIdentifierPatternFn().test(Xr)}const newIdentifierPatternFn=()=>/import\s+"(\w+)"/g;function isNewIdentifierSyntax(Xr){return newIdentifierPatternFn().test(Xr)}function getContractIdentifierSyntaxMatches(Xr){return Xr.matchAll(newIdentifierPatternFn())}async function resolveCadence(Xr){if(!isTransaction(Xr)&&!isScript(Xr))return Xr;var eo=get(Xr,"ix.cadence");if(invariant$1(isFn$2(eo)||isString$1$1(eo),"Cadence needs to be a function or a string."),isFn$2(eo)&&(eo=await eo({})),invariant$1(isString$1$1(eo),"Cadence needs to be a string at this point."),invariant$1(!isOldIdentifierSyntax(eo)||!isNewIdentifierSyntax(eo),"Both account identifier and contract identifier syntax not simultaneously supported."),isOldIdentifierSyntax(eo)&&(eo=await config().where(/^0x/).then(to=>Object.entries(to).reduce((ro,no)=>{let[io,oo]=no;const ao=new RegExp("(\\b"+io+"\\b)","g");return ro.replace(ao,oo)},eo))),isNewIdentifierSyntax(eo))for(const[to,ro]of getContractIdentifierSyntaxMatches(eo)){const no=await config().get(`system.contracts.${ro}`);no?eo=eo.replace(to,`import ${ro} from ${withPrefix$1(no)}`):log({title:"Contract Placeholder not found",message:`Cannot find a value for contract placeholder ${ro}. Please add to your flow.json or explicitly add it to the config 'contracts.*' namespace.`,level:LEVELS.warn})}return Xr.message.cadence=eo,Xr}const isFn$1=Xr=>typeof Xr=="function";function cast(Xr){if(invariant$1(typeof Xr.xform!=null,`No type specified for argument: ${Xr.value}`),isFn$1(Xr.xform))return Xr.xform(Xr.value);if(isFn$1(Xr.xform.asArgument))return Xr.xform.asArgument(Xr.value);invariant$1(!1,"Invalid Argument",Xr)}async function handleArgResolution(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;if(invariant$1(eo>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${Xr.tempId}`),isFn$1(Xr.resolveArgument)){const to=await Xr.resolveArgument();return handleArgResolution(to,eo-1)}else return Xr}async function resolveArguments(Xr){if(isTransaction(Xr)||isScript(Xr))for(let[eo,to]of Object.entries(Xr.arguments)){const ro=await handleArgResolution(to);Xr.arguments[eo].asArgument=cast(ro)}return Xr}const encodeTransactionPayload=Xr=>prependTransactionDomainTag(rlpEncode(preparePayload(Xr))),encodeTransactionEnvelope=Xr=>prependTransactionDomainTag(rlpEncode(prepareEnvelope(Xr))),rightPaddedHexBuffer=(Xr,eo)=>Buffer$1$1.from(Xr.padEnd(eo*2,"0"),"hex"),leftPaddedHexBuffer=(Xr,eo)=>Buffer$1$1.from(Xr.padStart(eo*2,"0"),"hex"),TRANSACTION_DOMAIN_TAG=rightPaddedHexBuffer(Buffer$1$1.from("FLOW-V0.0-transaction").toString("hex"),32).toString("hex"),prependTransactionDomainTag=Xr=>TRANSACTION_DOMAIN_TAG+Xr,addressBuffer=Xr=>leftPaddedHexBuffer(Xr,8),blockBuffer=Xr=>leftPaddedHexBuffer(Xr,32),argumentToString=Xr=>Buffer$1$1.from(JSON.stringify(Xr),"utf8"),scriptBuffer=Xr=>Buffer$1$1.from(Xr,"utf8"),signatureBuffer=Xr=>Buffer$1$1.from(Xr,"hex"),rlpEncode=Xr=>encode(Xr).toString("hex"),preparePayload=Xr=>(validatePayload(Xr),[scriptBuffer(Xr.cadence||""),Xr.arguments.map(argumentToString),blockBuffer(Xr.refBlock||""),Xr.computeLimit,addressBuffer(sansPrefix(Xr.proposalKey.address||"")),Xr.proposalKey.keyId,Xr.proposalKey.sequenceNum,addressBuffer(sansPrefix(Xr.payer)),Xr.authorizers.map(eo=>addressBuffer(sansPrefix(eo)))]),prepareEnvelope=Xr=>(validateEnvelope(Xr),[preparePayload(Xr),preparePayloadSignatures(Xr)]),preparePayloadSignatures=Xr=>{var to;const eo=collectSigners(Xr);return(to=Xr.payloadSigs)==null?void 0:to.map(ro=>({signerIndex:eo.get(ro.address)||"",keyId:ro.keyId,sig:ro.sig})).sort((ro,no)=>ro.signerIndex>no.signerIndex?1:ro.signerIndexno.keyId?1:ro.keyId[ro.signerIndex,ro.keyId,signatureBuffer(ro.sig)])},collectSigners=Xr=>{const eo=new Map;let to=0;const ro=no=>{eo.has(no)||(eo.set(no,to),to++)};return Xr.proposalKey.address&&ro(Xr.proposalKey.address),ro(Xr.payer),Xr.authorizers.forEach(ro),eo},validatePayload=Xr=>{payloadFields.forEach(eo=>checkField(Xr,eo)),proposalKeyFields.forEach(eo=>checkField(Xr.proposalKey,eo,"proposalKey"))},validateEnvelope=Xr=>{var eo;payloadSigsFields.forEach(to=>checkField(Xr,to)),(eo=Xr.payloadSigs)==null||eo.forEach((to,ro)=>{payloadSigFields.forEach(no=>checkField(to,no,"payloadSigs",ro))})},isNumber$2=Xr=>typeof Xr=="number",isString$2=Xr=>typeof Xr=="string",isObject$6=Xr=>Xr!==null&&typeof Xr=="object",isArray$2=Xr=>isObject$6(Xr)&&Xr instanceof Array,payloadFields=[{name:"cadence",check:isString$2},{name:"arguments",check:isArray$2},{name:"refBlock",check:isString$2,defaultVal:"0"},{name:"computeLimit",check:isNumber$2},{name:"proposalKey",check:isObject$6},{name:"payer",check:isString$2},{name:"authorizers",check:isArray$2}],proposalKeyFields=[{name:"address",check:isString$2},{name:"keyId",check:isNumber$2},{name:"sequenceNum",check:isNumber$2}],payloadSigsFields=[{name:"payloadSigs",check:isArray$2}],payloadSigFields=[{name:"address",check:isString$2},{name:"keyId",check:isNumber$2},{name:"sig",check:isString$2}],checkField=(Xr,eo,to,ro)=>{const{name:no,check:io,defaultVal:oo}=eo;if(Xr[no]==null&&oo!=null&&(Xr[no]=oo),Xr[no]==null)throw missingFieldError(no,to,ro);if(!io(Xr[no]))throw invalidFieldError(no,to,ro)},printFieldName=(Xr,eo,to)=>eo?to==null?`${eo}.${Xr}`:`${eo}.${to}.${Xr}`:Xr,missingFieldError=(Xr,eo,to)=>new Error(`Missing field ${printFieldName(Xr,eo,to)}`),invalidFieldError=(Xr,eo,to)=>new Error(`Invalid field ${printFieldName(Xr,eo,to)}`);function findInsideSigners(Xr){let eo=new Set(Xr.authorizations);return Xr.proposer&&eo.add(Xr.proposer),Array.isArray(Xr.payer)?Xr.payer.forEach(to=>eo.delete(to)):eo.delete(Xr.payer),Array.from(eo)}function findOutsideSigners(Xr){let eo=new Set(Array.isArray(Xr.payer)?Xr.payer:[Xr.payer]);return Array.from(eo)}const createSignableVoucher=Xr=>{const eo=()=>{const io=Xr.authorizations.map(oo=>withPrefix$1(Xr.accounts[oo].addr)).reduce((oo,ao)=>oo.find(so=>so===ao)?oo:[...oo,ao],[]);return io!=null&&io[0]?io:[]},to=()=>findInsideSigners(Xr).map(io=>({address:withPrefix$1(Xr.accounts[io].addr),keyId:Xr.accounts[io].keyId,sig:Xr.accounts[io].signature})),ro=()=>findOutsideSigners(Xr).map(io=>({address:withPrefix$1(Xr.accounts[io].addr),keyId:Xr.accounts[io].keyId,sig:Xr.accounts[io].signature})),no=Xr.proposer?{address:withPrefix$1(Xr.accounts[Xr.proposer].addr),keyId:Xr.accounts[Xr.proposer].keyId,sequenceNum:Xr.accounts[Xr.proposer].sequenceNum}:{};return{cadence:Xr.message.cadence,refBlock:Xr.message.refBlock||null,computeLimit:Xr.message.computeLimit,arguments:Xr.message.arguments.map(io=>Xr.arguments[io].asArgument),proposalKey:no,payer:withPrefix$1(Xr.accounts[Array.isArray(Xr.payer)?Xr.payer[0]:Xr.payer].addr),authorizers:eo(),payloadSigs:to(),envelopeSigs:ro()}},MAX_DEPTH_LIMIT=5,idof$1=Xr=>`${withPrefix$1(Xr.addr)}-${Xr.keyId}`,isFn$4=Xr=>Xr&&(Object.prototype.toString.call(Xr)==="[object Function]"||typeof Xr=="function"||Xr instanceof Function),genAccountId=function(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;to0&&arguments[0]!==void 0?arguments[0]:"",no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;to.push(Array(no*4).fill(Xr).join("-")+ro)},function(){return to.reduce((ro,no)=>ro+` +`+no)}]}function recurseFlatMap(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3;return eo<=0||!Array.isArray(Xr)?Xr:recurseFlatMap(Xr.flatMap(to=>to),eo-1)}function buildPreSignable(Xr,eo){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:Xr.role,cadence:eo.message.cadence,args:eo.message.arguments.map(to=>eo.arguments[to].asArgument),data:{},interaction:eo,voucher:createSignableVoucher(eo)}}catch(to){throw console.error("buildPreSignable",to),to}}async function removeUnusedIxAccounts(Xr,eo){const to=Array.isArray(Xr.payer)?Xr.payer:[Xr.payer],ro=Array.isArray(Xr.authorizations)?Xr.authorizations:[Xr.authorizations],no=Xr.proposer===null?[]:Array.isArray(Xr.proposer)?Xr.proposer:[Xr.proposer],io=Object.keys(Xr.accounts),oo=[...new Set(to.concat(ro,no))];for(const ao of io)oo.find(so=>so===ao)||delete Xr.accounts[ao]}function addAccountToIx(Xr,eo){typeof eo.addr=="string"&&(typeof eo.keyId=="number"||typeof eo.keyId=="string")?eo.tempId=idof$1(eo):eo.tempId=eo.tempId||v4$1();const to=Xr.accounts[eo.tempId]||eo;return Xr.accounts[eo.tempId]||(Xr.accounts[eo.tempId]=eo),Xr.accounts[eo.tempId].role.proposer=to.role.proposer||eo.role.proposer,Xr.accounts[eo.tempId].role.payer=to.role.payer||eo.role.payer,Xr.accounts[eo.tempId].role.authorizer=to.role.authorizer||eo.role.authorizer,Xr.accounts[eo.tempId]}function uniqueAccountsFlatMap(Xr){const eo=recurseFlatMap(Xr),to=new Set;return eo.map(no=>{const io=genAccountId(no.tempId,no.role.payer,no.role.proposer,no.role.authorizer,no.role.param);return to.has(io)?null:(to.add(io),no)}).filter(no=>no!==null)}async function recurseResolveAccount(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:MAX_DEPTH_LIMIT,{debugLogger:ro}=arguments.length>3?arguments[3]:void 0;if(to<=0)throw new Error(`recurseResolveAccount Error: Depth limit (${MAX_DEPTH_LIMIT}) reached. Ensure your authorization functions resolve to an account after ${MAX_DEPTH_LIMIT} resolves.`);let no=Xr.accounts[eo];if(!no)return null;if(ro(`account: ${no.tempId}`,Math.max(MAX_DEPTH_LIMIT-to,0)),no!=null&&no.resolve)if(isFn$4(no==null?void 0:no.resolve)){ro(`account: ${no.tempId} -- cache MISS`,Math.max(MAX_DEPTH_LIMIT-to,0));const{resolve:io,...oo}=no;let ao=await io(oo,buildPreSignable(oo,Xr));ao=Array.isArray(ao)?ao:[ao];let so=recurseFlatMap(ao);so=so.map(lo=>addAccountToIx(Xr,lo)),no.resolve=so.map(lo=>lo.tempId),no=addAccountToIx(Xr,no);const co=await Promise.all(so.map(async lo=>await recurseResolveAccount(Xr,lo.tempId,to-1,{debugLogger:ro})));return co?recurseFlatMap(co):no.tempId}else return ro(`account: ${no.tempId} -- cache HIT`,Math.max(MAX_DEPTH_LIMIT-to,0)),no.resolve;return no.tempId}const getAccountTempIDs=Xr=>Xr===null?[]:Array.isArray(Xr)?Xr:[Xr];async function resolveAccountType(Xr,eo,to){let{debugLogger:ro}=to;invariant$1(Xr&&typeof Xr=="object","resolveAccountType Error: ix not defined"),invariant$1(eo===ROLES.PAYER||eo===ROLES.PROPOSER||eo===ROLES.AUTHORIZATIONS,"resolveAccountType Error: type must be 'payer', 'proposer' or 'authorizations'");let no=getAccountTempIDs(Xr[eo]),io=[];for(let oo of no){let ao=Xr.accounts[oo];invariant$1(!!ao,"resolveAccountType Error: account not found");let so=await recurseResolveAccount(Xr,oo,MAX_DEPTH_LIMIT,{debugLogger:ro});so=Array.isArray(so)?so:[so];let co=so.map(uo=>Xr.accounts[uo]),lo=uniqueAccountsFlatMap(co);io=io.concat(lo)}if(invariant$1(io.length>0,"resolveAccountType Error: failed to resolve any accounts"),eo===ROLES.PAYER&&(io=io.filter(oo=>oo.role.payer===!0)),eo===ROLES.PROPOSER&&(io=io.filter(oo=>oo.role.proposer===!0)),eo===ROLES.AUTHORIZATIONS&&(io=io.filter(oo=>oo.role.authorizer===!0)),Xr[eo]=Array.isArray(Xr[eo])?[...new Set(io.map(oo=>oo.tempId))]:io[0].tempId,eo===ROLES.PAYER){let oo;for(const ao of Xr[ROLES.PAYER]){let so=Xr.accounts[ao];if(!oo)oo=so.addr;else if(oo!==so.addr)throw new Error("resolveAccountType Error: payers from different accounts detected")}}}async function resolveAccounts(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(isTransaction(Xr)){Array.isArray(Xr.payer)||log.deprecate({pkg:"FCL",subject:'"ix.payer" must be an array. Support for ix.payer as a singular',message:"See changelog for more info."});let[to,ro]=debug$1();try{await resolveAccountType(Xr,ROLES.PROPOSER,{debugLogger:to}),await resolveAccountType(Xr,ROLES.AUTHORIZATIONS,{debugLogger:to}),await resolveAccountType(Xr,ROLES.PAYER,{debugLogger:to}),await removeUnusedIxAccounts(Xr,{debugLogger:to}),eo.enableDebug&&console.debug(ro())}catch(no){throw console.error(`=== SAD PANDA === `,no,` @@ -2448,9 +4278,9 @@ Details:`,io.accounts].filter(Boolean),no=function(){for(var io=arguments.length `,...oo,` ----`)};return await config.get(`debug.${Xr}`)&&await eo(to,no,ro),to}},resolve=pipe$1([resolveCadence,debug("cadence",(Xr,eo)=>eo(Xr.message.cadence)),resolveComputeLimit,debug("compute limit",(Xr,eo)=>eo(Xr.message.computeLimit)),resolveArguments,debug("arguments",(Xr,eo)=>eo(Xr.message.arguments,Xr.message)),resolveAccounts,debug("accounts",(Xr,eo,to)=>eo(...to(Xr))),execFetchRef,execFetchSequenceNumber,resolveSignatures,debug("signatures",(Xr,eo,to)=>eo(...to(Xr))),resolveFinalNormalization,resolveValidators,resolveVoucherIntercept,debug("resolved",(Xr,eo)=>eo(Xr))]);async function execFetchRef(Xr){if(isTransaction(Xr)&&Xr.message.refBlock==null){const eo=await config().get("accessNode.api"),to=await config.first(["sdk.transport","sdk.send"],send$1);invariant$1(to,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Xr.message.refBlock=(await to(build$1([getBlock()]),{config,response,Buffer:Buffer$1$1,ix:ixModule},{node:eo}).then(decodeResponse)).id}return Xr}async function execFetchSequenceNumber(Xr){if(isTransaction(Xr)){var eo=Object.values(Xr.accounts).find(to=>to.role.proposer);if(invariant$1(eo,"Transactions require a proposer"),eo.sequenceNum==null){const to=await config().get("accessNode.api"),ro=await config.first(["sdk.transport","sdk.send"],send$1);invariant$1(ro,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Xr.accounts[eo.tempId].sequenceNum=await ro(await build$1([getAccount(eo.addr)]),{config,response,Buffer:Buffer$1$1,ix:ixModule},{node:to}).then(decodeResponse).then(no=>no.keys).then(no=>no.find(io=>io.index===eo.keyId)).then(no=>no.sequenceNumber)}}return Xr}function invariant(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;to1){const[no,io]=eo;return invariant((oo,ao)=>{let{Ok:so,Bad:co}=ao;return no?so(oo):co(oo,io)})}const[ro]=eo;return no=>ro(no,{Ok,Bad})}const send=async function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const to=await config.first(["sdk.transport","sdk.send"],eo.send||send$1);invariant(to,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const ro=await config.first(["sdk.resolve"],eo.resolve||resolve);return eo.node=eo.node||await config().get("accessNode.api"),Array.isArray(Xr)&&(Xr=pipe$1(initInteraction(),Xr)),to(await ro(Xr),{config,response,ix:ixModule,Buffer:Buffer$1$1},eo)};async function decode$2(Xr){const eo=await config().where(/^decoder\./),to=Object.entries(eo).map(ro=>{let[no,io]=ro;return no=`/${no.replace(/^decoder\./,"")}$/`,[no,io]});return decodeResponse(Xr,Object.fromEntries(to))}function getNetworkParameters(){return pipe$1([makeGetNetworkParameters,Xr=>Ok(Xr)])}function limit(Xr){return eo=>(eo.message.computeLimit=Xr,eo)}function args(Xr){return pipe$1(Xr.map(makeArgument))}function arg(Xr,eo){return{value:Xr,xform:eo}}function script(){return pipe$1([makeScript,put("ix.cadence",template(...arguments))])}const typedef=(Xr,eo,to)=>({label:Xr,asArgument:eo,asInjection:ro=>(log.deprecate({pkg:"@onflow/types",subject:`Passing in ${Xr} as value for ${Xr}`,message:`Going forward, use ${Xr} as value for ${Xr}.`}),to(ro))}),isArray=Xr=>Array.isArray(Xr),isObj=Xr=>typeof Xr=="object",isNull=Xr=>Xr==null,isBoolean=Xr=>typeof Xr=="boolean",isNumber$1=Xr=>typeof Xr=="number",isInteger$1=Xr=>Number.isInteger(Xr),isString$1=Xr=>typeof Xr=="string",throwTypeError=Xr=>{throw new Error("Type Error: "+Xr)},numberValuesDeprecationNotice=Xr=>{log.deprecate({pkg:"@onflow/types",subject:`Passing in Number as value for ${Xr}`,message:`Going forward, use String as value for ${Xr}.`,transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0002-[U]Int*-and-Word*-as-Number"})};let identityDeprecationShown=!1;const Identity={label:"Identity",asArgument:Xr=>(identityDeprecationShown||(log.deprecate({pkg:"@onflow/types",subject:"Identity",message:"Identity type is deprecated and will be removed in v2.0.0. Please remove it from your code."}),identityDeprecationShown=!0),Xr),asInjection:Xr=>Xr},UInt$1=typedef("UInt",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt"),{type:"UInt",value:Xr.toString()}):isString$1(Xr)?{type:"UInt",value:Xr}:throwTypeError("Expected Positive Integer for type Unsigned Int"),Xr=>Xr),Int$1=typedef("Int",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int"),{type:"Int",value:Xr.toString()}):isString$1(Xr)?{type:"Int",value:Xr}:throwTypeError("Expected Integer for type Int"),Xr=>Xr),UInt8=typedef("UInt8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt8"),{type:"UInt8",value:Xr.toString()}):isString$1(Xr)?{type:"UInt8",value:Xr}:throwTypeError("Expected integer for UInt8"),Xr=>Xr),Int8=typedef("Int8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int8"),{type:"Int8",value:Xr.toString()}):isString$1(Xr)?{type:"Int8",value:Xr}:throwTypeError("Expected positive integer for Int8"),Xr=>Xr),UInt16=typedef("UInt16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt16"),{type:"UInt16",value:Xr.toString()}):isString$1(Xr)?{type:"UInt16",value:Xr}:throwTypeError("Expected integer for UInt16"),Xr=>Xr),Int16=typedef("Int16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int16"),{type:"Int16",value:Xr.toString()}):isString$1(Xr)?{type:"Int16",value:Xr}:throwTypeError("Expected positive integer for Int16"),Xr=>Xr),UInt32=typedef("UInt32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt32"),{type:"UInt32",value:Xr.toString()}):isString$1(Xr)?{type:"UInt32",value:Xr}:throwTypeError("Expected integer for UInt32"),Xr=>Xr),Int32=typedef("Int32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int32"),{type:"Int32",value:Xr.toString()}):isString$1(Xr)?{type:"Int32",value:Xr}:throwTypeError("Expected positive integer for Int32"),Xr=>Xr),UInt64=typedef("UInt64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt64"),{type:"UInt64",value:Xr.toString()}):isString$1(Xr)?{type:"UInt64",value:Xr}:throwTypeError("Expected integer for UInt64"),Xr=>Xr),Int64=typedef("Int64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int64"),{type:"Int64",value:Xr.toString()}):isString$1(Xr)?{type:"Int64",value:Xr}:throwTypeError("Expected positive integer for Int64"),Xr=>Xr),UInt128=typedef("UInt128",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt128"),{type:"UInt128",value:Xr.toString()}):isString$1(Xr)?{type:"UInt128",value:Xr}:throwTypeError("Expected integer for UInt128"),Xr=>Xr),Int128=typedef("Int128",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int128"),{type:"Int128",value:Xr.toString()}):isString$1(Xr)?{type:"Int128",value:Xr}:throwTypeError("Expected positive integer for Int128"),Xr=>Xr),UInt256=typedef("UInt256",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt256"),{type:"UInt256",value:Xr.toString()}):isString$1(Xr)?{type:"UInt256",value:Xr}:throwTypeError("Expected integer for UInt256"),Xr=>Xr),Int256=typedef("Int256",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int256"),{type:"Int256",value:Xr.toString()}):isString$1(Xr)?{type:"Int256",value:Xr}:throwTypeError("Expected integer for Int256"),Xr=>Xr),Word8=typedef("Word8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word8"),{type:"Word8",value:Xr.toString()}):isString$1(Xr)?{type:"Word8",value:Xr}:throwTypeError("Expected positive number for Word8"),Xr=>Xr),Word16=typedef("Word16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word16"),{type:"Word16",value:Xr.toString()}):isString$1(Xr)?{type:"Word16",value:Xr}:throwTypeError("Expected positive number for Word16"),Xr=>Xr),Word32=typedef("Word32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word32"),{type:"Word32",value:Xr.toString()}):isString$1(Xr)?{type:"Word32",value:Xr}:throwTypeError("Expected positive number for Word32"),Xr=>Xr),Word64=typedef("Word64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word64"),{type:"Word64",value:Xr.toString()}):isString$1(Xr)?{type:"Word64",value:Xr}:throwTypeError("Expected positive number for Word64"),Xr=>Xr),UFix64AndFix64NumberDeprecationNotice=()=>{log.deprecate({subject:"Passing in Numbers as values for Fix64 and UFix64 types",pkg:"@onflow/types",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0001-[U]Fix64-as-Number"})},UFix64=typedef("UFix64",Xr=>{if(isString$1(Xr)){const eo=Xr.split(".");return eo.length!==2?throwTypeError(`Expected one decimal but found ${eo.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):eo[1].length==0||eo[1].length>8?throwTypeError(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${eo[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(eo[1]=eo[1].padEnd(8,"0"),Xr=eo.join("."),{type:"UFix64",value:Xr})}else if(isNumber$1(Xr))return UFix64AndFix64NumberDeprecationNotice(),{type:"UFix64",value:Xr.toString()};return throwTypeError("Expected String for UFix64")},Xr=>Xr),Fix64=typedef("Fix64",Xr=>{if(isString$1(Xr)){const eo=Xr.split(".");return eo.length!==2?throwTypeError(`Expected one decimal but found ${eo.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):eo[1].length==0||eo[1].length>8?throwTypeError(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${eo[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(eo[1]=eo[1].padEnd(8,"0"),Xr=eo.join("."),{type:"Fix64",value:Xr})}else if(isNumber$1(Xr))return UFix64AndFix64NumberDeprecationNotice(),{type:"Fix64",value:Xr.toString()};return throwTypeError("Expected String for Fix64")},Xr=>Xr),String$1=typedef("String",Xr=>isString$1(Xr)?{type:"String",value:Xr}:throwTypeError("Expected String for type String"),Xr=>Xr),Character=typedef("Character",Xr=>isString$1(Xr)?{type:"Character",value:Xr}:throwTypeError("Expected Character for type Character"),Xr=>Xr),Bool=typedef("Bool",Xr=>isBoolean(Xr)?{type:"Bool",value:Xr}:throwTypeError("Expected Boolean for type Bool"),Xr=>Xr),Address=typedef("Address",Xr=>isString$1(Xr)?{type:"Address",value:Xr}:throwTypeError("Expected Address for type Address"),Xr=>Xr),Void=typedef("Void",Xr=>!Xr||isNull(Xr)?{type:"Void",value:null}:throwTypeError("Expected Void for type Void"),Xr=>Xr),Optional=Xr=>typedef("Optional",eo=>({type:"Optional",value:isNull(eo)?null:Xr.asArgument(eo)}),eo=>eo),Reference=typedef("Reference",Xr=>isObj(Xr)?{type:"Reference",value:Xr}:throwTypeError("Expected Object for type Reference"),Xr=>Xr),_Array=function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return typedef("Array",eo=>({type:"Array",value:isArray(Xr)?Xr.map((to,ro)=>to.asArgument(eo[ro])):eo.map(to=>Xr.asArgument(to))}),eo=>eo)},Dictionary=function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return typedef("Dictionary",eo=>{const to=isArray(eo),ro=isArray(Xr);return isObj(eo)?{type:"Dictionary",value:ro&&to?Xr.map((no,io)=>({key:no.key.asArgument(eo[io].key),value:no.value.asArgument(eo[io].value)})):to&&!ro?eo.map(no=>({key:Xr.key.asArgument(no.key),value:Xr.value.asArgument(no.value)})):!to&&!ro?[{key:Xr.key.asArgument(eo.key),value:Xr.value.asArgument(eo.value)}]:throwTypeError("Invalid arguments for Dictionary.")}:throwTypeError("Expected Object for type Dictionary")},eo=>eo)},Event$1=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Event",to=>isObj(to)?{type:"Event",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Event"),to=>to)},Resource=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Resource",to=>isObj(to)?{type:"Resource",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Resource"),to=>to)},Struct$6=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Struct",to=>isObj(to)?{type:"Struct",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Struct"),to=>to)},Enum=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Enum",to=>isObj(to)?{type:"Enum",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Enum"),to=>to)},Path=typedef("Path",Xr=>isObj(Xr)?isString$1(Xr.domain)?Xr.domain==="storage"||Xr.domain==="private"||Xr.domain==="public"?isString$1(Xr.identifier)?{type:"Path",value:{domain:Xr.domain,identifier:Xr.identifier}}:throwTypeError(`Expected a string for the Path identifier but found ${Xr.identifier}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError(`Expected either "storage", "private" or "public" as the Path domain but found ${Xr.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError(`Expected a string for the Path domain but found ${Xr.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError("Expected Object for type Path"),Xr=>Xr),t$1=Object.freeze(Object.defineProperty({__proto__:null,Address,Array:_Array,Bool,Character,Dictionary,Enum,Event:Event$1,Fix64,Identity,Int:Int$1,Int128,Int16,Int256,Int32,Int64,Int8,Optional,Path,Reference,Resource,String:String$1,Struct:Struct$6,UFix64,UInt:UInt$1,UInt128,UInt16,UInt256,UInt32,UInt64,UInt8,Void,Word16,Word32,Word64,Word8,_Array},Symbol.toStringTag,{value:"Module"}));var grpcWebClient_umd={exports:{}};(function(Xr,eo){(function(to,ro){Xr.exports=ro()})(commonjsGlobal,function(){return to={418:function(no,io){(function(oo,ao){for(var so in ao)oo[so]=ao[so]})(io,function(oo){var ao={};function so(co){if(ao[co])return ao[co].exports;var lo=ao[co]={i:co,l:!1,exports:{}};return oo[co].call(lo.exports,lo,lo.exports,so),lo.l=!0,lo.exports}return so.m=oo,so.c=ao,so.i=function(co){return co},so.d=function(co,lo,fo){so.o(co,lo)||Object.defineProperty(co,lo,{configurable:!1,enumerable:!0,get:fo})},so.n=function(co){var lo=co&&co.__esModule?function(){return co.default}:function(){return co};return so.d(lo,"a",lo),lo},so.o=function(co,lo){return Object.prototype.hasOwnProperty.call(co,lo)},so.p="",so(so.s=1)}([function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(3),lo=function(){function fo(ho,go){ho===void 0&&(ho={}),go===void 0&&(go={splitValues:!1});var yo,vo=this;this.headersMap={},ho&&(typeof Headers<"u"&&ho instanceof Headers?co.getHeaderKeys(ho).forEach(function(wo){co.getHeaderValues(ho,wo).forEach(function(Eo){go.splitValues?vo.append(wo,co.splitHeaderValue(Eo)):vo.append(wo,Eo)})}):typeof(yo=ho)=="object"&&typeof yo.headersMap=="object"&&typeof yo.forEach=="function"?ho.forEach(function(wo,Eo){vo.append(wo,Eo)}):typeof Map<"u"&&ho instanceof Map?ho.forEach(function(wo,Eo){vo.append(Eo,wo)}):typeof ho=="string"?this.appendFromString(ho):typeof ho=="object"&&Object.getOwnPropertyNames(ho).forEach(function(wo){var Eo=ho[wo];Array.isArray(Eo)?Eo.forEach(function(ko){vo.append(wo,ko)}):vo.append(wo,Eo)}))}return fo.prototype.appendFromString=function(ho){for(var go=ho.split(`\r -`),yo=0;yo0){var Eo=vo.substring(0,wo).trim(),ko=vo.substring(wo+1).trim();this.append(Eo,ko)}}},fo.prototype.delete=function(ho,go){var yo=co.normalizeName(ho);if(go===void 0)delete this.headersMap[yo];else{var vo=this.headersMap[yo];if(vo){var wo=vo.indexOf(go);wo>=0&&vo.splice(wo,1),vo.length===0&&delete this.headersMap[yo]}}},fo.prototype.append=function(ho,go){var yo=this,vo=co.normalizeName(ho);Array.isArray(this.headersMap[vo])||(this.headersMap[vo]=[]),Array.isArray(go)?go.forEach(function(wo){yo.headersMap[vo].push(co.normalizeValue(wo))}):this.headersMap[vo].push(co.normalizeValue(go))},fo.prototype.set=function(ho,go){var yo=co.normalizeName(ho);if(Array.isArray(go)){var vo=[];go.forEach(function(wo){vo.push(co.normalizeValue(wo))}),this.headersMap[yo]=vo}else this.headersMap[yo]=[co.normalizeValue(go)]},fo.prototype.has=function(ho,go){var yo=this.headersMap[co.normalizeName(ho)];if(!Array.isArray(yo))return!1;if(go!==void 0){var vo=co.normalizeValue(go);return yo.indexOf(vo)>=0}return!0},fo.prototype.get=function(ho){var go=this.headersMap[co.normalizeName(ho)];return go!==void 0?go.concat():[]},fo.prototype.forEach=function(ho){var go=this;Object.getOwnPropertyNames(this.headersMap).forEach(function(yo){ho(yo,go.headersMap[yo])},this)},fo.prototype.toHeaders=function(){if(typeof Headers<"u"){var ho=new Headers;return this.forEach(function(go,yo){yo.forEach(function(vo){ho.append(go,vo)})}),ho}throw new Error("Headers class is not defined")},fo}();ao.BrowserHeaders=lo},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(0);ao.BrowserHeaders=co.BrowserHeaders},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0}),ao.iterateHeaders=function(co,lo){for(var fo=co[Symbol.iterator](),ho=fo.next();!ho.done;)lo(ho.value[0]),ho=fo.next()},ao.iterateHeadersKeys=function(co,lo){for(var fo=co.keys(),ho=fo.next();!ho.done;)lo(ho.value),ho=fo.next()}},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(2);ao.normalizeName=function(lo){if(typeof lo!="string"&&(lo=String(lo)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(lo))throw new TypeError("Invalid character in header field name");return lo.toLowerCase()},ao.normalizeValue=function(lo){return typeof lo!="string"&&(lo=String(lo)),lo},ao.getHeaderValues=function(lo,fo){var ho=lo;if(ho instanceof Headers&&ho.getAll)return ho.getAll(fo);var go=ho.get(fo);return go&&typeof go=="string"?[go]:go},ao.getHeaderKeys=function(lo){var fo=lo,ho={},go=[];return fo.keys?co.iterateHeadersKeys(fo,function(yo){ho[yo]||(ho[yo]=!0,go.push(yo))}):fo.forEach?fo.forEach(function(yo,vo){ho[vo]||(ho[vo]=!0,go.push(vo))}):co.iterateHeaders(fo,function(yo){var vo=yo[0];ho[vo]||(ho[vo]=!0,go.push(vo))}),go},ao.splitHeaderValue=function(lo){var fo=[];return lo.split(", ").forEach(function(ho){ho.split(",").forEach(function(go){fo.push(go)})}),fo}}]))},617:function(no,io,oo){Object.defineProperty(io,"__esModule",{value:!0}),io.ChunkParser=io.ChunkType=io.encodeASCII=io.decodeASCII=void 0;var ao,so=oo(65);function co(wo){return(Eo=wo)===9||Eo===10||Eo===13||wo>=32&&wo<=126;var Eo}function lo(wo){for(var Eo=0;Eo!==wo.length;++Eo)if(!co(wo[Eo]))throw new Error("Metadata is not valid (printable) ASCII");return String.fromCharCode.apply(String,Array.prototype.slice.call(wo))}function fo(wo){return(128&wo.getUint8(0))==128}function ho(wo){return wo.getUint32(1,!1)}function go(wo,Eo,ko){return wo.byteLength-Eo>=ko}function yo(wo,Eo,ko){if(wo.slice)return wo.slice(Eo,ko);var Ao=wo.length;ko!==void 0&&(Ao=ko);for(var Po=new Uint8Array(Ao-Eo),jo=0,Mo=Eo;Mo=0?ko:co.httpStatusToCode(Eo);this.props.debug&&lo.debug("onHeaders.code",Ao);var Po=wo.get("grpc-message")||[];if(this.props.debug&&lo.debug("onHeaders.gRPCMessage",Po),this.rawOnHeaders(wo),Ao!==co.Code.OK){var jo=this.decodeGRPCStatus(Po[0]);this.rawOnError(Ao,jo,wo)}}},vo.prototype.onTransportChunk=function(wo){var Eo=this;if(this.closed)this.props.debug&&lo.debug("grpc.onChunk received after request was closed - ignoring");else{var ko=[];try{ko=this.parser.parse(wo)}catch(Ao){return this.props.debug&&lo.debug("onChunk.parsing error",Ao,Ao.message),void this.rawOnError(co.Code.Internal,"parsing error: "+Ao.message)}ko.forEach(function(Ao){if(Ao.chunkType===so.ChunkType.MESSAGE){var Po=Eo.methodDefinition.responseType.deserializeBinary(Ao.data);Eo.rawOnMessage(Po)}else Ao.chunkType===so.ChunkType.TRAILERS&&(Eo.responseHeaders?(Eo.responseTrailers=new ao.Metadata(Ao.trailers),Eo.props.debug&&lo.debug("onChunk.trailers",Eo.responseTrailers)):(Eo.responseHeaders=new ao.Metadata(Ao.trailers),Eo.rawOnHeaders(Eo.responseHeaders)))})}},vo.prototype.onTransportEnd=function(){if(this.props.debug&&lo.debug("grpc.onEnd"),this.closed)this.props.debug&&lo.debug("grpc.onEnd received after request was closed - ignoring");else if(this.responseTrailers!==void 0){var wo=yo(this.responseTrailers);if(wo!==null){var Eo=this.responseTrailers.get("grpc-message"),ko=this.decodeGRPCStatus(Eo[0]);this.rawOnEnd(wo,ko,this.responseTrailers)}else this.rawOnError(co.Code.Internal,"Response closed without grpc-status (Trailers provided)")}else{if(this.responseHeaders===void 0)return void this.rawOnError(co.Code.Unknown,"Response closed without headers");var Ao=yo(this.responseHeaders),Po=this.responseHeaders.get("grpc-message");if(this.props.debug&&lo.debug("grpc.headers only response ",Ao,Po),Ao===null)return void this.rawOnEnd(co.Code.Unknown,"Response closed without grpc-status (Headers only)",this.responseHeaders);var jo=this.decodeGRPCStatus(Po[0]);this.rawOnEnd(Ao,jo,this.responseHeaders)}},vo.prototype.decodeGRPCStatus=function(wo){if(!wo)return"";try{return decodeURIComponent(wo)}catch{return wo}},vo.prototype.rawOnEnd=function(wo,Eo,ko){var Ao=this;this.props.debug&&lo.debug("rawOnEnd",wo,Eo,ko),this.completed||(this.completed=!0,this.onEndCallbacks.forEach(function(Po){if(!Ao.closed)try{Po(wo,Eo,ko)}catch(jo){setTimeout(function(){throw jo},0)}}))},vo.prototype.rawOnHeaders=function(wo){this.props.debug&&lo.debug("rawOnHeaders",wo),this.completed||this.onHeadersCallbacks.forEach(function(Eo){try{Eo(wo)}catch(ko){setTimeout(function(){throw ko},0)}})},vo.prototype.rawOnError=function(wo,Eo,ko){var Ao=this;ko===void 0&&(ko=new ao.Metadata),this.props.debug&&lo.debug("rawOnError",wo,Eo),this.completed||(this.completed=!0,this.onEndCallbacks.forEach(function(Po){if(!Ao.closed)try{Po(wo,Eo,ko)}catch(jo){setTimeout(function(){throw jo},0)}}))},vo.prototype.rawOnMessage=function(wo){var Eo=this;this.props.debug&&lo.debug("rawOnMessage",wo.toObject()),this.completed||this.closed||this.onMessageCallbacks.forEach(function(ko){if(!Eo.closed)try{ko(wo)}catch(Ao){setTimeout(function(){throw Ao},0)}})},vo.prototype.onHeaders=function(wo){this.onHeadersCallbacks.push(wo)},vo.prototype.onMessage=function(wo){this.onMessageCallbacks.push(wo)},vo.prototype.onEnd=function(wo){this.onEndCallbacks.push(wo)},vo.prototype.start=function(wo){if(this.started)throw new Error("Client already started - cannot .start()");this.started=!0;var Eo=new ao.Metadata(wo||{});Eo.set("content-type","application/grpc-web+proto"),Eo.set("x-grpc-web","1"),this.transport.start(Eo)},vo.prototype.send=function(wo){if(!this.started)throw new Error("Client not started - .start() must be called before .send()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .send()");if(!this.methodDefinition.requestStream&&this.sentFirstMessage)throw new Error("Message already sent for non-client-streaming method - cannot .send()");this.sentFirstMessage=!0;var Eo=ho.frameRequest(wo);this.transport.sendMessage(Eo)},vo.prototype.finishSend=function(){if(!this.started)throw new Error("Client not started - .finishSend() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .finishSend()");this.finishedSending=!0,this.transport.finishSend()},vo.prototype.close=function(){if(!this.started)throw new Error("Client not started - .start() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .close()");this.closed=!0,this.props.debug&&lo.debug("request.abort aborting request"),this.transport.cancel()},vo}();function yo(vo){var wo=vo.get("grpc-status")||[];if(wo.length>0)try{var Eo=wo[0];return parseInt(Eo,10)}catch{return null}return null}},346:function(no,io){Object.defineProperty(io,"__esModule",{value:!0}),io.debug=void 0,io.debug=function(){for(var oo=[],ao=0;ao=55296&&ko<=56319){var Ao=wo.charCodeAt(Eo+1);Ao>=56320&&Ao<=57343&&(ko=65536+(ko-55296<<10)+(Ao-56320))}return ko}function vo(wo){for(var Eo=new Uint8Array(wo.length),ko=0,Ao=0;AoparseInt(no[io]))return 1;if(parseInt(ro[io])eo=>typeof eo===Xr,isRequired=Xr=>Xr!=null,isObject$5=is$4("object"),isString=is$4("string"),isFunc=is$4("function");function normalizeArgs(Xr){return isFunc(Xr)?Xr(arg,t$1):[]}async function httpDocumentResolver(Xr){let{url:eo}=Xr;invariant$1(typeof eo<"u","retrieve({ url }) -- url must be defined");let to;try{to=await fetchTransport(eo)}catch{throw new Error("httpDocumentResolver Error: Failed to retrieve document.")}return to.ok?await to.json():null}const DOCUMENT_RESOLVERS=new Map([["http",httpDocumentResolver],["https",httpDocumentResolver]]);async function retrieve(Xr){let{url:eo}=Xr;invariant$1(typeof eo<"u","retrieve({ url }) -- url must be defined"),invariant$1(typeof eo=="string","retrieve({ url }) -- url must be a string");const to=await config().where(/^document\.resolver\./);Object.keys(to).map(ao=>{const so=to[ao],co=ao.replace(/^document\.resolver\./,"");DOCUMENT_RESOLVERS.set(co,so)});const ro=/^(.*):\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/.exec(eo);invariant$1(ro,"Failed to parse URL");const no=ro[1];invariant$1(ro,"Failed to parse URL protocol");const io=DOCUMENT_RESOLVERS.get(no);return invariant$1(io,`No resolver found for protcol=${no}`),await io({url:eo})}function normalize(Xr){let{template:eo}=Xr;invariant(eo!=null,"generateTemplateId({ template }) -- template must be defined"),invariant(typeof eo=="object","generateTemplateId({ template }) -- template must be an object"),invariant(eo.f_type==="InteractionTemplate","generateTemplateId({ template }) -- template object must be an InteractionTemplate"),invariant(eo.f_version==="1.0.0","generateTemplateId({ template }) -- template object must be version 1.0.0");const to=eo.data,ro=Object.keys(to.messages).map(oo=>{var ao;return{key:oo,i18n:(ao=to.messages[oo])==null?void 0:ao.i18n.map(so=>{var co,lo;return{tag:so,translation:(lo=(co=to.messages[oo])==null?void 0:co.i18n)==null?void 0:lo[so]}})}}),no=Object.keys(to==null?void 0:to.arguments).map(async(oo,ao)=>{var so,co,lo,fo;return{...(so=to==null?void 0:to.arguments)==null?void 0:so[oo],label:oo,index:ao,type:(lo=(co=to==null?void 0:to.arguments)==null?void 0:co[oo])==null?void 0:lo.type,messages:Object.keys((fo=to==null?void 0:to.arguments)==null?void 0:fo[oo].messages).map(ho=>{var go,yo;return{key:ho,i18n:Object.keys((yo=(go=to==null?void 0:to.arguments)==null?void 0:go[oo].messages)==null?void 0:yo[ho]).map(vo=>{var wo,Eo,ko;return{tag:vo,translation:(ko=(Eo=(wo=to==null?void 0:to.arguments)==null?void 0:wo[oo].messages)==null?void 0:Eo[ho])==null?void 0:ko[vo]}})}})}});return{...eo,f_version:"1.1.0",data:{...eo.data,messages:ro,parameters:no}}}async function normalizeInteractionTemplate(Xr){if(Xr==null)return null;switch(Xr.f_version){case"1.0.0":return normalizeInteractionTemplate(normalize({template:Xr}));case"1.1.0":return Xr;default:throw new Error("normalizeInteractionTemplate Error: Invalid InteractionTemplate")}}async function deriveCadenceByNetwork100(Xr){var no;let{network:eo,template:to}=Xr;return invariant$1(to.f_version==="1.0.0","deriveCadenceByNetwork100({ template }) -- template must be version 1.0.0"),Object.keys((no=to==null?void 0:to.data)==null?void 0:no.dependencies).map(io=>{var co,lo;const oo=Object.values((lo=(co=to==null?void 0:to.data)==null?void 0:co.dependencies)==null?void 0:lo[io]);invariant$1(oo!==void 0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${io}`),invariant$1(oo.length>0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${io}`);const ao=oo[0],so=ao==null?void 0:ao[eo];return invariant$1(so,`deriveCadenceByNetwork100 -- Could not find ${eo} network information for dependency: ${io}`),[io,so==null?void 0:so.address]}).reduce((io,oo)=>{let[ao,so]=oo;const co=new RegExp("(\\b"+ao+"\\b)","g");return io.replace(co,so)},to.data.cadence)}function replaceStringImports(Xr){let{cadence:eo,networkDependencies:to}=Xr;return Object.keys(to).reduce((ro,no)=>{const io=to[no],oo=new RegExp(`import "\\b${no}\\b"`,"g");return ro.replace(oo,`import ${no} from ${io}`)},eo)}async function deriveCadenceByNetwork110(Xr){var no,io,oo,ao,so,co;let{network:eo,template:to}=Xr;invariant$1(to.f_version==="1.1.0","deriveCadenceByNetwork110({ template }) -- template must be version 1.0.0");const ro={};return(no=to==null?void 0:to.data)==null||no.dependencies.forEach(lo=>{lo.contracts.forEach(fo=>{const ho=fo.contract;fo.networks.forEach(go=>{go.network===eo&&(ro[ho]=go.address)}),invariant$1(ro[ho]!==void 0,`deriveCadenceByNetwork110 -- Could not find contracts Network Address: ${eo} ${ho}`)})}),invariant$1(Object.keys(ro).length===((io=to==null?void 0:to.data)==null?void 0:io.dependencies.length),`deriveCadenceByNetwork110 -- Could not find contracts for import dependencies: ${ro}`),invariant$1(Object.keys(ro).length===Object.values(ro).length,`deriveCadenceByNetwork110 -- Could not find all addresses for network ${eo} dependencies: ${ro}`),invariant$1((ao=(oo=to==null?void 0:to.data)==null?void 0:oo.cadence)==null?void 0:ao.body,`no cadence found -- Could not replace import dependencies: ${ro}`),replaceStringImports({cadence:(co=(so=to==null?void 0:to.data)==null?void 0:so.cadence)==null?void 0:co.body,networkDependencies:ro})}async function deriveCadenceByNetwork(Xr){let{network:eo,template:to}=Xr;switch(invariant$1(eo!=null,"deriveCadenceByNetwork({ network }) -- network must be defined"),invariant$1(typeof eo=="string","deriveCadenceByNetwork({ network }) -- network must be a string"),invariant$1(to!=null,"deriveCadenceByNetwork({ template }) -- template must be defined"),invariant$1(typeof to=="object","deriveCadenceByNetwork({ template }) -- template must be an object"),invariant$1(to.f_type==="InteractionTemplate","deriveCadenceByNetwork({ template }) -- template must be an InteractionTemplate"),to.f_version){case"1.1.0":return await deriveCadenceByNetwork110({network:eo,template:to});case"1.0.0":return await deriveCadenceByNetwork100({network:eo,template:to});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function fetchChainId(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(await send([getNetworkParameters()],Xr).then(decode$2)).chainId}let chainIdCache={},hasWarnedEnv=!1;async function getChainId(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},eo=await config.get("flow.network"),to=await config.get("env");to&&!hasWarnedEnv&&(log.deprecate({pkg:"FCL",subject:'Using the "env" configuration key for specifying the flow network',message:"Configuring to specify flow network is no longer required",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key"}),hasWarnedEnv=!0);const ro=Xr.node||await config.get("accessNode.api");if(!ro){if(eo)return eo;if(to)return to;throw new Error('Either the "accessNode.api" config key or opts.node must be set')}if(chainIdCache[ro])try{return await chainIdCache[ro]}catch{}chainIdCache[ro]||(chainIdCache[ro]=fetchChainId(Xr).catch(no=>{throw chainIdCache[ro]=null,no}));try{return await chainIdCache[ro]}catch(no){if(eo)return eo;if(to)return to;throw new Error(`Error getting chainId from access node - are you using the correct access node endpoint. If running locally, is your emulator up-to-date? ${no.message}`)}}function watchForChainIdChanges(){return config.subscribe(()=>{getChainId({enableRequestLogging:!1}).catch(()=>{})})}function isAndroid(){return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}function isSmallIOS(){return typeof navigator<"u"&&/iPhone|iPod/.test(navigator.userAgent)}function isLargeIOS(){return typeof navigator<"u"&&/iPad/.test(navigator.userAgent)}function isIOS(){return isSmallIOS()||isLargeIOS()}function isMobile(){return isAndroid()||isIOS()}async function deriveDependencies(){var no,io,oo,ao;let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const eo=Xr.template,to=await getChainId(Xr),ro={};switch(eo.f_version){case"1.0.0":const so=Object.keys((no=eo==null?void 0:eo.data)==null?void 0:no.dependencies);for(let co of so){let lo=(io=eo==null?void 0:eo.data)==null?void 0:io.dependencies[co];const fo=Object.keys(lo);invariant$1(fo.length>0,`FCL configureDependencies Error: No contracts found in template for placeholder=${co}`);const go=lo[fo[0]][to];invariant$1(go,`FCL configureDependencies Error: No dependency information for placeholder=${co} contract=${fo[0]} network=${to}`),invariant$1(go==null?void 0:go.address,`FCL configureDependencies Error: No address information for placeholder=${co} contract=${fo[0]} network=${to}`),ro[co]=withPrefix$1(go==null?void 0:go.address)}return ro;case"1.1.0":return(ao=(oo=eo==null?void 0:eo.data)==null?void 0:oo.dependencies)==null||ao.forEach(co=>{co.contracts.forEach(lo=>{const fo=lo.contract;lo.networks.forEach(ho=>{ho.network===to&&(ro[fo]=withPrefix$1(ho==null?void 0:ho.address))}),invariant$1(ro[fo],`networkAddress -- Could not find contracts Network Address: ${to} ${fo}`)})}),ro;default:throw new Error("FCL configureDependencies Error: Unsupported template version")}}async function prepTemplateOpts(Xr){isString(Xr==null?void 0:Xr.template)&&(Xr.template=await retrieve({url:Xr==null?void 0:Xr.template}));let eo={};Xr!=null&&Xr.template&&(Xr.template=normalizeInteractionTemplate(Xr==null?void 0:Xr.template),eo=await deriveDependencies({template:Xr.template}));const to=Xr.cadence||deriveCadenceByNetwork({template:Xr.template,network:await getChainId(Xr)});return Xr.cadence=to,Xr.dependencies=eo,Xr}async function pre(Xr,eo){invariant$1(isRequired(eo),`${Xr}(opts) -- opts is required`),invariant$1(isObject$5(eo),`${Xr}(opts) -- opts must be an object`),invariant$1(!(eo.cadence&&eo.template),`${Xr}({ template, cadence }) -- cannot pass both cadence and template`),invariant$1(isRequired(eo.cadence||(eo==null?void 0:eo.template)),`${Xr}({ cadence }) -- cadence is required`),invariant$1(isString(eo.cadence)||(eo==null?void 0:eo.template),`${Xr}({ cadence }) -- cadence must be a string`),invariant$1(await config().get("accessNode.api"),`${Xr}(opts) -- Required value for "accessNode.api" not defined in config. See: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/src/exec/query.md#configuration`)}async function preQuery(Xr){return pre("query",Xr)}async function query(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return await preQuery(Xr),Xr=await prepTemplateOpts(Xr),config().overload(Xr.dependencies||{},async()=>send([script(Xr.cadence),args(normalizeArgs(Xr.args||[])),Xr.limit&&typeof Xr.limit=="number"&&limit(Xr.limit)]).then(decode$2))}const CORE_STRATEGIES={"HTTP/RPC":"HTTP/RPC","HTTP/POST":"HTTP/POST","IFRAME/RPC":"IFRAME/RPC","POP/RPC":"POP/RPC","TAB/RPC":"TAB/RPC","EXT/RPC":"EXT/RPC","DEEPLINK/RPC":"DEEPLINK/RPC"},_URL=globalThis.URL;let URL$2=class extends _URL{constructor(eo,to){for(var ro=arguments.length,no=new Array(ro>2?ro-2:0),io=2;io{if(Xr.appIdentifier){const{appIdentifier:eo,address:to,nonce:ro,signatures:no}=Xr;return invariant$1(isString(eo),"verifyAccountProof({ appIdentifier }) -- appIdentifier must be a string"),invariant$1(isString(to)&&sansPrefix(to).length===16,"verifyAccountProof({ address }) -- address must be a valid address"),invariant$1(/^[0-9a-f]+$/i.test(ro),"nonce must be a hex string"),invariant$1(Array.isArray(no)&&no.every((io,oo,ao)=>io.f_type==="CompositeSignature"),"Must include an Array of CompositeSignatures to verify"),invariant$1(no.map(io=>io.addr).every((io,oo,ao)=>io===ao[0]),"User signatures to be verified must be from a single account address"),!0}else{const{message:eo,address:to,compSigs:ro}=Xr;return invariant$1(/^[0-9a-f]+$/i.test(eo),"Signed message must be a hex string"),invariant$1(isString(to)&&sansPrefix(to).length===16,"verifyUserSignatures({ address }) -- address must be a valid address"),invariant$1(Array.isArray(ro)&&ro.every((no,io,oo)=>no.f_type==="CompositeSignature"),"Must include an Array of CompositeSignatures to verify"),invariant$1(ro.map(no=>no.addr).every((no,io,oo)=>no===oo[0]),"User signatures to be verified must be from a single account address"),!0}},getVerifySignaturesScript=async(Xr,eo)=>{const to="verifyUserSignatures";let ro=await getChainId(eo);const no={testnet:"0x74daa6f9c7ef24b1",mainnet:"0xb4b82a1c9d21d284",previewnet:"0x40b5b8b2ce81ea4a"},io=eo.fclCryptoContract||no[ro];return invariant$1(io,`${to}({ fclCryptoContract }) -- FCLCrypto contract address is unknown for network: ${ro}. Please manually specify the FCLCrypto contract address.`),` +---`)};return await config.get(`debug.${Xr}`)&&await eo(to,no,ro),to}},resolve=pipe$1([resolveCadence,debug("cadence",(Xr,eo)=>eo(Xr.message.cadence)),resolveComputeLimit,debug("compute limit",(Xr,eo)=>eo(Xr.message.computeLimit)),resolveArguments,debug("arguments",(Xr,eo)=>eo(Xr.message.arguments,Xr.message)),resolveAccounts,debug("accounts",(Xr,eo,to)=>eo(...to(Xr))),execFetchRef,execFetchSequenceNumber,resolveSignatures,debug("signatures",(Xr,eo,to)=>eo(...to(Xr))),resolveFinalNormalization,resolveValidators,resolveVoucherIntercept,debug("resolved",(Xr,eo)=>eo(Xr))]);async function execFetchRef(Xr){if(isTransaction(Xr)&&Xr.message.refBlock==null){const eo=await config().get("accessNode.api"),to=await config.first(["sdk.transport","sdk.send"],send$1);invariant$1(to,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Xr.message.refBlock=(await to(build$1([getBlock()]),{config,response,Buffer:Buffer$1$1,ix:ixModule},{node:eo}).then(decodeResponse)).id}return Xr}async function execFetchSequenceNumber(Xr){if(isTransaction(Xr)){var eo=Object.values(Xr.accounts).find(to=>to.role.proposer);if(invariant$1(eo,"Transactions require a proposer"),eo.sequenceNum==null){const to=await config().get("accessNode.api"),ro=await config.first(["sdk.transport","sdk.send"],send$1);invariant$1(ro,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Xr.accounts[eo.tempId].sequenceNum=await ro(await build$1([getAccount(eo.addr)]),{config,response,Buffer:Buffer$1$1,ix:ixModule},{node:to}).then(decodeResponse).then(no=>no.keys).then(no=>no.find(io=>io.index===eo.keyId)).then(no=>no.sequenceNumber)}}return Xr}function invariant(){for(var Xr=arguments.length,eo=new Array(Xr),to=0;to1){const[no,io]=eo;return invariant((oo,ao)=>{let{Ok:so,Bad:co}=ao;return no?so(oo):co(oo,io)})}const[ro]=eo;return no=>ro(no,{Ok,Bad})}const send=async function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const to=await config.first(["sdk.transport","sdk.send"],eo.send||send$1);invariant(to,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const ro=await config.first(["sdk.resolve"],eo.resolve||resolve);return eo.node=eo.node||await config().get("accessNode.api"),Array.isArray(Xr)&&(Xr=pipe$1(initInteraction(),Xr)),to(await ro(Xr),{config,response,ix:ixModule,Buffer:Buffer$1$1},eo)};async function decode$2(Xr){const eo=await config().where(/^decoder\./),to=Object.entries(eo).map(ro=>{let[no,io]=ro;return no=`/${no.replace(/^decoder\./,"")}$/`,[no,io]});return decodeResponse(Xr,Object.fromEntries(to))}function getNetworkParameters(){return pipe$1([makeGetNetworkParameters,Xr=>Ok(Xr)])}function limit(Xr){return eo=>(eo.message.computeLimit=Xr,eo)}function args(Xr){return pipe$1(Xr.map(makeArgument))}function arg(Xr,eo){return{value:Xr,xform:eo}}function script(){return pipe$1([makeScript,put("ix.cadence",template(...arguments))])}const typedef=(Xr,eo,to)=>({label:Xr,asArgument:eo,asInjection:ro=>(log.deprecate({pkg:"@onflow/types",subject:`Passing in ${Xr} as value for ${Xr}`,message:`Going forward, use ${Xr} as value for ${Xr}.`}),to(ro))}),isArray=Xr=>Array.isArray(Xr),isObj=Xr=>typeof Xr=="object",isNull=Xr=>Xr==null,isBoolean=Xr=>typeof Xr=="boolean",isNumber$1=Xr=>typeof Xr=="number",isInteger$1=Xr=>Number.isInteger(Xr),isString$1=Xr=>typeof Xr=="string",throwTypeError=Xr=>{throw new Error("Type Error: "+Xr)},numberValuesDeprecationNotice=Xr=>{log.deprecate({pkg:"@onflow/types",subject:`Passing in Number as value for ${Xr}`,message:`Going forward, use String as value for ${Xr}.`,transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0002-[U]Int*-and-Word*-as-Number"})};let identityDeprecationShown=!1;const Identity={label:"Identity",asArgument:Xr=>(identityDeprecationShown||(log.deprecate({pkg:"@onflow/types",subject:"Identity",message:"Identity type is deprecated and will be removed in v2.0.0. Please remove it from your code."}),identityDeprecationShown=!0),Xr),asInjection:Xr=>Xr},UInt$1=typedef("UInt",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt"),{type:"UInt",value:Xr.toString()}):isString$1(Xr)?{type:"UInt",value:Xr}:throwTypeError("Expected Positive Integer for type Unsigned Int"),Xr=>Xr),Int$1=typedef("Int",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int"),{type:"Int",value:Xr.toString()}):isString$1(Xr)?{type:"Int",value:Xr}:throwTypeError("Expected Integer for type Int"),Xr=>Xr),UInt8=typedef("UInt8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt8"),{type:"UInt8",value:Xr.toString()}):isString$1(Xr)?{type:"UInt8",value:Xr}:throwTypeError("Expected integer for UInt8"),Xr=>Xr),Int8=typedef("Int8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int8"),{type:"Int8",value:Xr.toString()}):isString$1(Xr)?{type:"Int8",value:Xr}:throwTypeError("Expected positive integer for Int8"),Xr=>Xr),UInt16=typedef("UInt16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt16"),{type:"UInt16",value:Xr.toString()}):isString$1(Xr)?{type:"UInt16",value:Xr}:throwTypeError("Expected integer for UInt16"),Xr=>Xr),Int16=typedef("Int16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int16"),{type:"Int16",value:Xr.toString()}):isString$1(Xr)?{type:"Int16",value:Xr}:throwTypeError("Expected positive integer for Int16"),Xr=>Xr),UInt32=typedef("UInt32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt32"),{type:"UInt32",value:Xr.toString()}):isString$1(Xr)?{type:"UInt32",value:Xr}:throwTypeError("Expected integer for UInt32"),Xr=>Xr),Int32=typedef("Int32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int32"),{type:"Int32",value:Xr.toString()}):isString$1(Xr)?{type:"Int32",value:Xr}:throwTypeError("Expected positive integer for Int32"),Xr=>Xr),UInt64=typedef("UInt64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt64"),{type:"UInt64",value:Xr.toString()}):isString$1(Xr)?{type:"UInt64",value:Xr}:throwTypeError("Expected integer for UInt64"),Xr=>Xr),Int64=typedef("Int64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int64"),{type:"Int64",value:Xr.toString()}):isString$1(Xr)?{type:"Int64",value:Xr}:throwTypeError("Expected positive integer for Int64"),Xr=>Xr),UInt128=typedef("UInt128",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt128"),{type:"UInt128",value:Xr.toString()}):isString$1(Xr)?{type:"UInt128",value:Xr}:throwTypeError("Expected integer for UInt128"),Xr=>Xr),Int128=typedef("Int128",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int128"),{type:"Int128",value:Xr.toString()}):isString$1(Xr)?{type:"Int128",value:Xr}:throwTypeError("Expected positive integer for Int128"),Xr=>Xr),UInt256=typedef("UInt256",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("UInt256"),{type:"UInt256",value:Xr.toString()}):isString$1(Xr)?{type:"UInt256",value:Xr}:throwTypeError("Expected integer for UInt256"),Xr=>Xr),Int256=typedef("Int256",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Int256"),{type:"Int256",value:Xr.toString()}):isString$1(Xr)?{type:"Int256",value:Xr}:throwTypeError("Expected integer for Int256"),Xr=>Xr),Word8=typedef("Word8",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word8"),{type:"Word8",value:Xr.toString()}):isString$1(Xr)?{type:"Word8",value:Xr}:throwTypeError("Expected positive number for Word8"),Xr=>Xr),Word16=typedef("Word16",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word16"),{type:"Word16",value:Xr.toString()}):isString$1(Xr)?{type:"Word16",value:Xr}:throwTypeError("Expected positive number for Word16"),Xr=>Xr),Word32=typedef("Word32",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word32"),{type:"Word32",value:Xr.toString()}):isString$1(Xr)?{type:"Word32",value:Xr}:throwTypeError("Expected positive number for Word32"),Xr=>Xr),Word64=typedef("Word64",Xr=>isNumber$1(Xr)&&isInteger$1(Xr)?(numberValuesDeprecationNotice("Word64"),{type:"Word64",value:Xr.toString()}):isString$1(Xr)?{type:"Word64",value:Xr}:throwTypeError("Expected positive number for Word64"),Xr=>Xr),UFix64AndFix64NumberDeprecationNotice=()=>{log.deprecate({subject:"Passing in Numbers as values for Fix64 and UFix64 types",pkg:"@onflow/types",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0001-[U]Fix64-as-Number"})},UFix64=typedef("UFix64",Xr=>{if(isString$1(Xr)){const eo=Xr.split(".");return eo.length!==2?throwTypeError(`Expected one decimal but found ${eo.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):eo[1].length==0||eo[1].length>8?throwTypeError(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${eo[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(eo[1]=eo[1].padEnd(8,"0"),Xr=eo.join("."),{type:"UFix64",value:Xr})}else if(isNumber$1(Xr))return UFix64AndFix64NumberDeprecationNotice(),{type:"UFix64",value:Xr.toString()};return throwTypeError("Expected String for UFix64")},Xr=>Xr),Fix64=typedef("Fix64",Xr=>{if(isString$1(Xr)){const eo=Xr.split(".");return eo.length!==2?throwTypeError(`Expected one decimal but found ${eo.length} in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):eo[1].length==0||eo[1].length>8?throwTypeError(`Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ${eo[1].length} digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers`):(eo[1]=eo[1].padEnd(8,"0"),Xr=eo.join("."),{type:"Fix64",value:Xr})}else if(isNumber$1(Xr))return UFix64AndFix64NumberDeprecationNotice(),{type:"Fix64",value:Xr.toString()};return throwTypeError("Expected String for Fix64")},Xr=>Xr),String$1=typedef("String",Xr=>isString$1(Xr)?{type:"String",value:Xr}:throwTypeError("Expected String for type String"),Xr=>Xr),Character=typedef("Character",Xr=>isString$1(Xr)?{type:"Character",value:Xr}:throwTypeError("Expected Character for type Character"),Xr=>Xr),Bool=typedef("Bool",Xr=>isBoolean(Xr)?{type:"Bool",value:Xr}:throwTypeError("Expected Boolean for type Bool"),Xr=>Xr),Address=typedef("Address",Xr=>isString$1(Xr)?{type:"Address",value:Xr}:throwTypeError("Expected Address for type Address"),Xr=>Xr),Void=typedef("Void",Xr=>!Xr||isNull(Xr)?{type:"Void",value:null}:throwTypeError("Expected Void for type Void"),Xr=>Xr),Optional=Xr=>typedef("Optional",eo=>({type:"Optional",value:isNull(eo)?null:Xr.asArgument(eo)}),eo=>eo),Reference=typedef("Reference",Xr=>isObj(Xr)?{type:"Reference",value:Xr}:throwTypeError("Expected Object for type Reference"),Xr=>Xr),_Array=function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return typedef("Array",eo=>({type:"Array",value:isArray(Xr)?Xr.map((to,ro)=>to.asArgument(eo[ro])):eo.map(to=>Xr.asArgument(to))}),eo=>eo)},Dictionary=function(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return typedef("Dictionary",eo=>{const to=isArray(eo),ro=isArray(Xr);return isObj(eo)?{type:"Dictionary",value:ro&&to?Xr.map((no,io)=>({key:no.key.asArgument(eo[io].key),value:no.value.asArgument(eo[io].value)})):to&&!ro?eo.map(no=>({key:Xr.key.asArgument(no.key),value:Xr.value.asArgument(no.value)})):!to&&!ro?[{key:Xr.key.asArgument(eo.key),value:Xr.value.asArgument(eo.value)}]:throwTypeError("Invalid arguments for Dictionary.")}:throwTypeError("Expected Object for type Dictionary")},eo=>eo)},Event$1=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Event",to=>isObj(to)?{type:"Event",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Event"),to=>to)},Resource=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Resource",to=>isObj(to)?{type:"Resource",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Resource"),to=>to)},Struct$6=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Struct",to=>isObj(to)?{type:"Struct",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Struct"),to=>to)},Enum=function(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return typedef("Enum",to=>isObj(to)?{type:"Enum",value:{id:Xr,fields:isArray(eo)?eo.map((ro,no)=>({name:to.fields[no].name,value:ro.value.asArgument(to.fields[no].value)})):to.fields.map(ro=>({name:ro.name,value:eo.value.asArgument(ro.value)}))}}:throwTypeError("Expected Object for type Enum"),to=>to)},Path=typedef("Path",Xr=>isObj(Xr)?isString$1(Xr.domain)?Xr.domain==="storage"||Xr.domain==="private"||Xr.domain==="public"?isString$1(Xr.identifier)?{type:"Path",value:{domain:Xr.domain,identifier:Xr.identifier}}:throwTypeError(`Expected a string for the Path identifier but found ${Xr.identifier}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError(`Expected either "storage", "private" or "public" as the Path domain but found ${Xr.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError(`Expected a string for the Path domain but found ${Xr.domain}. Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path`):throwTypeError("Expected Object for type Path"),Xr=>Xr),t$1=Object.freeze(Object.defineProperty({__proto__:null,Address,Array:_Array,Bool,Character,Dictionary,Enum,Event:Event$1,Fix64,Identity,Int:Int$1,Int128,Int16,Int256,Int32,Int64,Int8,Optional,Path,Reference,Resource,String:String$1,Struct:Struct$6,UFix64,UInt:UInt$1,UInt128,UInt16,UInt256,UInt32,UInt64,UInt8,Void,Word16,Word32,Word64,Word8,_Array},Symbol.toStringTag,{value:"Module"}));var grpcWebClient_umd={exports:{}};(function(Xr,eo){(function(to,ro){Xr.exports=ro()})(commonjsGlobal,function(){return to={418:function(no,io){(function(oo,ao){for(var so in ao)oo[so]=ao[so]})(io,function(oo){var ao={};function so(co){if(ao[co])return ao[co].exports;var lo=ao[co]={i:co,l:!1,exports:{}};return oo[co].call(lo.exports,lo,lo.exports,so),lo.l=!0,lo.exports}return so.m=oo,so.c=ao,so.i=function(co){return co},so.d=function(co,lo,uo){so.o(co,lo)||Object.defineProperty(co,lo,{configurable:!1,enumerable:!0,get:uo})},so.n=function(co){var lo=co&&co.__esModule?function(){return co.default}:function(){return co};return so.d(lo,"a",lo),lo},so.o=function(co,lo){return Object.prototype.hasOwnProperty.call(co,lo)},so.p="",so(so.s=1)}([function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(3),lo=function(){function uo(ho,go){ho===void 0&&(ho={}),go===void 0&&(go={splitValues:!1});var bo,wo=this;this.headersMap={},ho&&(typeof Headers<"u"&&ho instanceof Headers?co.getHeaderKeys(ho).forEach(function(Eo){co.getHeaderValues(ho,Eo).forEach(function($o){go.splitValues?wo.append(Eo,co.splitHeaderValue($o)):wo.append(Eo,$o)})}):typeof(bo=ho)=="object"&&typeof bo.headersMap=="object"&&typeof bo.forEach=="function"?ho.forEach(function(Eo,$o){wo.append(Eo,$o)}):typeof Map<"u"&&ho instanceof Map?ho.forEach(function(Eo,$o){wo.append($o,Eo)}):typeof ho=="string"?this.appendFromString(ho):typeof ho=="object"&&Object.getOwnPropertyNames(ho).forEach(function(Eo){var $o=ho[Eo];Array.isArray($o)?$o.forEach(function(Co){wo.append(Eo,Co)}):wo.append(Eo,$o)}))}return uo.prototype.appendFromString=function(ho){for(var go=ho.split(`\r +`),bo=0;bo0){var $o=wo.substring(0,Eo).trim(),Co=wo.substring(Eo+1).trim();this.append($o,Co)}}},uo.prototype.delete=function(ho,go){var bo=co.normalizeName(ho);if(go===void 0)delete this.headersMap[bo];else{var wo=this.headersMap[bo];if(wo){var Eo=wo.indexOf(go);Eo>=0&&wo.splice(Eo,1),wo.length===0&&delete this.headersMap[bo]}}},uo.prototype.append=function(ho,go){var bo=this,wo=co.normalizeName(ho);Array.isArray(this.headersMap[wo])||(this.headersMap[wo]=[]),Array.isArray(go)?go.forEach(function(Eo){bo.headersMap[wo].push(co.normalizeValue(Eo))}):this.headersMap[wo].push(co.normalizeValue(go))},uo.prototype.set=function(ho,go){var bo=co.normalizeName(ho);if(Array.isArray(go)){var wo=[];go.forEach(function(Eo){wo.push(co.normalizeValue(Eo))}),this.headersMap[bo]=wo}else this.headersMap[bo]=[co.normalizeValue(go)]},uo.prototype.has=function(ho,go){var bo=this.headersMap[co.normalizeName(ho)];if(!Array.isArray(bo))return!1;if(go!==void 0){var wo=co.normalizeValue(go);return bo.indexOf(wo)>=0}return!0},uo.prototype.get=function(ho){var go=this.headersMap[co.normalizeName(ho)];return go!==void 0?go.concat():[]},uo.prototype.forEach=function(ho){var go=this;Object.getOwnPropertyNames(this.headersMap).forEach(function(bo){ho(bo,go.headersMap[bo])},this)},uo.prototype.toHeaders=function(){if(typeof Headers<"u"){var ho=new Headers;return this.forEach(function(go,bo){bo.forEach(function(wo){ho.append(go,wo)})}),ho}throw new Error("Headers class is not defined")},uo}();ao.BrowserHeaders=lo},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(0);ao.BrowserHeaders=co.BrowserHeaders},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0}),ao.iterateHeaders=function(co,lo){for(var uo=co[Symbol.iterator](),ho=uo.next();!ho.done;)lo(ho.value[0]),ho=uo.next()},ao.iterateHeadersKeys=function(co,lo){for(var uo=co.keys(),ho=uo.next();!ho.done;)lo(ho.value),ho=uo.next()}},function(oo,ao,so){Object.defineProperty(ao,"__esModule",{value:!0});var co=so(2);ao.normalizeName=function(lo){if(typeof lo!="string"&&(lo=String(lo)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(lo))throw new TypeError("Invalid character in header field name");return lo.toLowerCase()},ao.normalizeValue=function(lo){return typeof lo!="string"&&(lo=String(lo)),lo},ao.getHeaderValues=function(lo,uo){var ho=lo;if(ho instanceof Headers&&ho.getAll)return ho.getAll(uo);var go=ho.get(uo);return go&&typeof go=="string"?[go]:go},ao.getHeaderKeys=function(lo){var uo=lo,ho={},go=[];return uo.keys?co.iterateHeadersKeys(uo,function(bo){ho[bo]||(ho[bo]=!0,go.push(bo))}):uo.forEach?uo.forEach(function(bo,wo){ho[wo]||(ho[wo]=!0,go.push(wo))}):co.iterateHeaders(uo,function(bo){var wo=bo[0];ho[wo]||(ho[wo]=!0,go.push(wo))}),go},ao.splitHeaderValue=function(lo){var uo=[];return lo.split(", ").forEach(function(ho){ho.split(",").forEach(function(go){uo.push(go)})}),uo}}]))},617:function(no,io,oo){Object.defineProperty(io,"__esModule",{value:!0}),io.ChunkParser=io.ChunkType=io.encodeASCII=io.decodeASCII=void 0;var ao,so=oo(65);function co(Eo){return($o=Eo)===9||$o===10||$o===13||Eo>=32&&Eo<=126;var $o}function lo(Eo){for(var $o=0;$o!==Eo.length;++$o)if(!co(Eo[$o]))throw new Error("Metadata is not valid (printable) ASCII");return String.fromCharCode.apply(String,Array.prototype.slice.call(Eo))}function uo(Eo){return(128&Eo.getUint8(0))==128}function ho(Eo){return Eo.getUint32(1,!1)}function go(Eo,$o,Co){return Eo.byteLength-$o>=Co}function bo(Eo,$o,Co){if(Eo.slice)return Eo.slice($o,Co);var Ro=Eo.length;Co!==void 0&&(Ro=Co);for(var Oo=new Uint8Array(Ro-$o),jo=0,Bo=$o;Bo=0?Co:co.httpStatusToCode($o);this.props.debug&&lo.debug("onHeaders.code",Ro);var Oo=Eo.get("grpc-message")||[];if(this.props.debug&&lo.debug("onHeaders.gRPCMessage",Oo),this.rawOnHeaders(Eo),Ro!==co.Code.OK){var jo=this.decodeGRPCStatus(Oo[0]);this.rawOnError(Ro,jo,Eo)}}},wo.prototype.onTransportChunk=function(Eo){var $o=this;if(this.closed)this.props.debug&&lo.debug("grpc.onChunk received after request was closed - ignoring");else{var Co=[];try{Co=this.parser.parse(Eo)}catch(Ro){return this.props.debug&&lo.debug("onChunk.parsing error",Ro,Ro.message),void this.rawOnError(co.Code.Internal,"parsing error: "+Ro.message)}Co.forEach(function(Ro){if(Ro.chunkType===so.ChunkType.MESSAGE){var Oo=$o.methodDefinition.responseType.deserializeBinary(Ro.data);$o.rawOnMessage(Oo)}else Ro.chunkType===so.ChunkType.TRAILERS&&($o.responseHeaders?($o.responseTrailers=new ao.Metadata(Ro.trailers),$o.props.debug&&lo.debug("onChunk.trailers",$o.responseTrailers)):($o.responseHeaders=new ao.Metadata(Ro.trailers),$o.rawOnHeaders($o.responseHeaders)))})}},wo.prototype.onTransportEnd=function(){if(this.props.debug&&lo.debug("grpc.onEnd"),this.closed)this.props.debug&&lo.debug("grpc.onEnd received after request was closed - ignoring");else if(this.responseTrailers!==void 0){var Eo=bo(this.responseTrailers);if(Eo!==null){var $o=this.responseTrailers.get("grpc-message"),Co=this.decodeGRPCStatus($o[0]);this.rawOnEnd(Eo,Co,this.responseTrailers)}else this.rawOnError(co.Code.Internal,"Response closed without grpc-status (Trailers provided)")}else{if(this.responseHeaders===void 0)return void this.rawOnError(co.Code.Unknown,"Response closed without headers");var Ro=bo(this.responseHeaders),Oo=this.responseHeaders.get("grpc-message");if(this.props.debug&&lo.debug("grpc.headers only response ",Ro,Oo),Ro===null)return void this.rawOnEnd(co.Code.Unknown,"Response closed without grpc-status (Headers only)",this.responseHeaders);var jo=this.decodeGRPCStatus(Oo[0]);this.rawOnEnd(Ro,jo,this.responseHeaders)}},wo.prototype.decodeGRPCStatus=function(Eo){if(!Eo)return"";try{return decodeURIComponent(Eo)}catch{return Eo}},wo.prototype.rawOnEnd=function(Eo,$o,Co){var Ro=this;this.props.debug&&lo.debug("rawOnEnd",Eo,$o,Co),this.completed||(this.completed=!0,this.onEndCallbacks.forEach(function(Oo){if(!Ro.closed)try{Oo(Eo,$o,Co)}catch(jo){setTimeout(function(){throw jo},0)}}))},wo.prototype.rawOnHeaders=function(Eo){this.props.debug&&lo.debug("rawOnHeaders",Eo),this.completed||this.onHeadersCallbacks.forEach(function($o){try{$o(Eo)}catch(Co){setTimeout(function(){throw Co},0)}})},wo.prototype.rawOnError=function(Eo,$o,Co){var Ro=this;Co===void 0&&(Co=new ao.Metadata),this.props.debug&&lo.debug("rawOnError",Eo,$o),this.completed||(this.completed=!0,this.onEndCallbacks.forEach(function(Oo){if(!Ro.closed)try{Oo(Eo,$o,Co)}catch(jo){setTimeout(function(){throw jo},0)}}))},wo.prototype.rawOnMessage=function(Eo){var $o=this;this.props.debug&&lo.debug("rawOnMessage",Eo.toObject()),this.completed||this.closed||this.onMessageCallbacks.forEach(function(Co){if(!$o.closed)try{Co(Eo)}catch(Ro){setTimeout(function(){throw Ro},0)}})},wo.prototype.onHeaders=function(Eo){this.onHeadersCallbacks.push(Eo)},wo.prototype.onMessage=function(Eo){this.onMessageCallbacks.push(Eo)},wo.prototype.onEnd=function(Eo){this.onEndCallbacks.push(Eo)},wo.prototype.start=function(Eo){if(this.started)throw new Error("Client already started - cannot .start()");this.started=!0;var $o=new ao.Metadata(Eo||{});$o.set("content-type","application/grpc-web+proto"),$o.set("x-grpc-web","1"),this.transport.start($o)},wo.prototype.send=function(Eo){if(!this.started)throw new Error("Client not started - .start() must be called before .send()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .send()");if(!this.methodDefinition.requestStream&&this.sentFirstMessage)throw new Error("Message already sent for non-client-streaming method - cannot .send()");this.sentFirstMessage=!0;var $o=ho.frameRequest(Eo);this.transport.sendMessage($o)},wo.prototype.finishSend=function(){if(!this.started)throw new Error("Client not started - .finishSend() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .finishSend()");this.finishedSending=!0,this.transport.finishSend()},wo.prototype.close=function(){if(!this.started)throw new Error("Client not started - .start() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .close()");this.closed=!0,this.props.debug&&lo.debug("request.abort aborting request"),this.transport.cancel()},wo}();function bo(wo){var Eo=wo.get("grpc-status")||[];if(Eo.length>0)try{var $o=Eo[0];return parseInt($o,10)}catch{return null}return null}},346:function(no,io){Object.defineProperty(io,"__esModule",{value:!0}),io.debug=void 0,io.debug=function(){for(var oo=[],ao=0;ao=55296&&Co<=56319){var Ro=Eo.charCodeAt($o+1);Ro>=56320&&Ro<=57343&&(Co=65536+(Co-55296<<10)+(Ro-56320))}return Co}function wo(Eo){for(var $o=new Uint8Array(Eo.length),Co=0,Ro=0;RoparseInt(no[io]))return 1;if(parseInt(ro[io])eo=>typeof eo===Xr,isRequired=Xr=>Xr!=null,isObject$5=is$4("object"),isString=is$4("string"),isFunc=is$4("function");function normalizeArgs(Xr){return isFunc(Xr)?Xr(arg,t$1):[]}async function httpDocumentResolver(Xr){let{url:eo}=Xr;invariant$1(typeof eo<"u","retrieve({ url }) -- url must be defined");let to;try{to=await fetchTransport(eo)}catch{throw new Error("httpDocumentResolver Error: Failed to retrieve document.")}return to.ok?await to.json():null}const DOCUMENT_RESOLVERS=new Map([["http",httpDocumentResolver],["https",httpDocumentResolver]]);async function retrieve(Xr){let{url:eo}=Xr;invariant$1(typeof eo<"u","retrieve({ url }) -- url must be defined"),invariant$1(typeof eo=="string","retrieve({ url }) -- url must be a string");const to=await config().where(/^document\.resolver\./);Object.keys(to).map(ao=>{const so=to[ao],co=ao.replace(/^document\.resolver\./,"");DOCUMENT_RESOLVERS.set(co,so)});const ro=/^(.*):\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/.exec(eo);invariant$1(ro,"Failed to parse URL");const no=ro[1];invariant$1(ro,"Failed to parse URL protocol");const io=DOCUMENT_RESOLVERS.get(no);return invariant$1(io,`No resolver found for protcol=${no}`),await io({url:eo})}function normalize(Xr){let{template:eo}=Xr;invariant(eo!=null,"generateTemplateId({ template }) -- template must be defined"),invariant(typeof eo=="object","generateTemplateId({ template }) -- template must be an object"),invariant(eo.f_type==="InteractionTemplate","generateTemplateId({ template }) -- template object must be an InteractionTemplate"),invariant(eo.f_version==="1.0.0","generateTemplateId({ template }) -- template object must be version 1.0.0");const to=eo.data,ro=Object.keys(to.messages).map(oo=>{var ao;return{key:oo,i18n:(ao=to.messages[oo])==null?void 0:ao.i18n.map(so=>{var co,lo;return{tag:so,translation:(lo=(co=to.messages[oo])==null?void 0:co.i18n)==null?void 0:lo[so]}})}}),no=Object.keys(to==null?void 0:to.arguments).map(async(oo,ao)=>{var so,co,lo,uo;return{...(so=to==null?void 0:to.arguments)==null?void 0:so[oo],label:oo,index:ao,type:(lo=(co=to==null?void 0:to.arguments)==null?void 0:co[oo])==null?void 0:lo.type,messages:Object.keys((uo=to==null?void 0:to.arguments)==null?void 0:uo[oo].messages).map(ho=>{var go,bo;return{key:ho,i18n:Object.keys((bo=(go=to==null?void 0:to.arguments)==null?void 0:go[oo].messages)==null?void 0:bo[ho]).map(wo=>{var Eo,$o,Co;return{tag:wo,translation:(Co=($o=(Eo=to==null?void 0:to.arguments)==null?void 0:Eo[oo].messages)==null?void 0:$o[ho])==null?void 0:Co[wo]}})}})}});return{...eo,f_version:"1.1.0",data:{...eo.data,messages:ro,parameters:no}}}async function normalizeInteractionTemplate(Xr){if(Xr==null)return null;switch(Xr.f_version){case"1.0.0":return normalizeInteractionTemplate(normalize({template:Xr}));case"1.1.0":return Xr;default:throw new Error("normalizeInteractionTemplate Error: Invalid InteractionTemplate")}}async function deriveCadenceByNetwork100(Xr){var no;let{network:eo,template:to}=Xr;return invariant$1(to.f_version==="1.0.0","deriveCadenceByNetwork100({ template }) -- template must be version 1.0.0"),Object.keys((no=to==null?void 0:to.data)==null?void 0:no.dependencies).map(io=>{var co,lo;const oo=Object.values((lo=(co=to==null?void 0:to.data)==null?void 0:co.dependencies)==null?void 0:lo[io]);invariant$1(oo!==void 0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${io}`),invariant$1(oo.length>0,`deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ${io}`);const ao=oo[0],so=ao==null?void 0:ao[eo];return invariant$1(so,`deriveCadenceByNetwork100 -- Could not find ${eo} network information for dependency: ${io}`),[io,so==null?void 0:so.address]}).reduce((io,oo)=>{let[ao,so]=oo;const co=new RegExp("(\\b"+ao+"\\b)","g");return io.replace(co,so)},to.data.cadence)}function replaceStringImports(Xr){let{cadence:eo,networkDependencies:to}=Xr;return Object.keys(to).reduce((ro,no)=>{const io=to[no],oo=new RegExp(`import "\\b${no}\\b"`,"g");return ro.replace(oo,`import ${no} from ${io}`)},eo)}async function deriveCadenceByNetwork110(Xr){var no,io,oo,ao,so,co;let{network:eo,template:to}=Xr;invariant$1(to.f_version==="1.1.0","deriveCadenceByNetwork110({ template }) -- template must be version 1.0.0");const ro={};return(no=to==null?void 0:to.data)==null||no.dependencies.forEach(lo=>{lo.contracts.forEach(uo=>{const ho=uo.contract;uo.networks.forEach(go=>{go.network===eo&&(ro[ho]=go.address)}),invariant$1(ro[ho]!==void 0,`deriveCadenceByNetwork110 -- Could not find contracts Network Address: ${eo} ${ho}`)})}),invariant$1(Object.keys(ro).length===((io=to==null?void 0:to.data)==null?void 0:io.dependencies.length),`deriveCadenceByNetwork110 -- Could not find contracts for import dependencies: ${ro}`),invariant$1(Object.keys(ro).length===Object.values(ro).length,`deriveCadenceByNetwork110 -- Could not find all addresses for network ${eo} dependencies: ${ro}`),invariant$1((ao=(oo=to==null?void 0:to.data)==null?void 0:oo.cadence)==null?void 0:ao.body,`no cadence found -- Could not replace import dependencies: ${ro}`),replaceStringImports({cadence:(co=(so=to==null?void 0:to.data)==null?void 0:so.cadence)==null?void 0:co.body,networkDependencies:ro})}async function deriveCadenceByNetwork(Xr){let{network:eo,template:to}=Xr;switch(invariant$1(eo!=null,"deriveCadenceByNetwork({ network }) -- network must be defined"),invariant$1(typeof eo=="string","deriveCadenceByNetwork({ network }) -- network must be a string"),invariant$1(to!=null,"deriveCadenceByNetwork({ template }) -- template must be defined"),invariant$1(typeof to=="object","deriveCadenceByNetwork({ template }) -- template must be an object"),invariant$1(to.f_type==="InteractionTemplate","deriveCadenceByNetwork({ template }) -- template must be an InteractionTemplate"),to.f_version){case"1.1.0":return await deriveCadenceByNetwork110({network:eo,template:to});case"1.0.0":return await deriveCadenceByNetwork100({network:eo,template:to});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}async function fetchChainId(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(await send([getNetworkParameters()],Xr).then(decode$2)).chainId}let chainIdCache={},hasWarnedEnv=!1;async function getChainId(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},eo=await config.get("flow.network"),to=await config.get("env");to&&!hasWarnedEnv&&(log.deprecate({pkg:"FCL",subject:'Using the "env" configuration key for specifying the flow network',message:"Configuring to specify flow network is no longer required",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key"}),hasWarnedEnv=!0);const ro=Xr.node||await config.get("accessNode.api");if(!ro){if(eo)return eo;if(to)return to;throw new Error('Either the "accessNode.api" config key or opts.node must be set')}if(chainIdCache[ro])try{return await chainIdCache[ro]}catch{}chainIdCache[ro]||(chainIdCache[ro]=fetchChainId(Xr).catch(no=>{throw chainIdCache[ro]=null,no}));try{return await chainIdCache[ro]}catch(no){if(eo)return eo;if(to)return to;throw new Error(`Error getting chainId from access node - are you using the correct access node endpoint. If running locally, is your emulator up-to-date? ${no.message}`)}}function watchForChainIdChanges(){return config.subscribe(()=>{getChainId({enableRequestLogging:!1}).catch(()=>{})})}function isAndroid(){return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}function isSmallIOS(){return typeof navigator<"u"&&/iPhone|iPod/.test(navigator.userAgent)}function isLargeIOS(){return typeof navigator<"u"&&/iPad/.test(navigator.userAgent)}function isIOS(){return isSmallIOS()||isLargeIOS()}function isMobile(){return isAndroid()||isIOS()}async function deriveDependencies(){var no,io,oo,ao;let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const eo=Xr.template,to=await getChainId(Xr),ro={};switch(eo.f_version){case"1.0.0":const so=Object.keys((no=eo==null?void 0:eo.data)==null?void 0:no.dependencies);for(let co of so){let lo=(io=eo==null?void 0:eo.data)==null?void 0:io.dependencies[co];const uo=Object.keys(lo);invariant$1(uo.length>0,`FCL configureDependencies Error: No contracts found in template for placeholder=${co}`);const go=lo[uo[0]][to];invariant$1(go,`FCL configureDependencies Error: No dependency information for placeholder=${co} contract=${uo[0]} network=${to}`),invariant$1(go==null?void 0:go.address,`FCL configureDependencies Error: No address information for placeholder=${co} contract=${uo[0]} network=${to}`),ro[co]=withPrefix$1(go==null?void 0:go.address)}return ro;case"1.1.0":return(ao=(oo=eo==null?void 0:eo.data)==null?void 0:oo.dependencies)==null||ao.forEach(co=>{co.contracts.forEach(lo=>{const uo=lo.contract;lo.networks.forEach(ho=>{ho.network===to&&(ro[uo]=withPrefix$1(ho==null?void 0:ho.address))}),invariant$1(ro[uo],`networkAddress -- Could not find contracts Network Address: ${to} ${uo}`)})}),ro;default:throw new Error("FCL configureDependencies Error: Unsupported template version")}}async function prepTemplateOpts(Xr){isString(Xr==null?void 0:Xr.template)&&(Xr.template=await retrieve({url:Xr==null?void 0:Xr.template}));let eo={};Xr!=null&&Xr.template&&(Xr.template=normalizeInteractionTemplate(Xr==null?void 0:Xr.template),eo=await deriveDependencies({template:Xr.template}));const to=Xr.cadence||deriveCadenceByNetwork({template:Xr.template,network:await getChainId(Xr)});return Xr.cadence=to,Xr.dependencies=eo,Xr}async function pre(Xr,eo){invariant$1(isRequired(eo),`${Xr}(opts) -- opts is required`),invariant$1(isObject$5(eo),`${Xr}(opts) -- opts must be an object`),invariant$1(!(eo.cadence&&eo.template),`${Xr}({ template, cadence }) -- cannot pass both cadence and template`),invariant$1(isRequired(eo.cadence||(eo==null?void 0:eo.template)),`${Xr}({ cadence }) -- cadence is required`),invariant$1(isString(eo.cadence)||(eo==null?void 0:eo.template),`${Xr}({ cadence }) -- cadence must be a string`),invariant$1(await config().get("accessNode.api"),`${Xr}(opts) -- Required value for "accessNode.api" not defined in config. See: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/src/exec/query.md#configuration`)}async function preQuery(Xr){return pre("query",Xr)}async function query(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return await preQuery(Xr),Xr=await prepTemplateOpts(Xr),config().overload(Xr.dependencies||{},async()=>send([script(Xr.cadence),args(normalizeArgs(Xr.args||[])),Xr.limit&&typeof Xr.limit=="number"&&limit(Xr.limit)]).then(decode$2))}const CORE_STRATEGIES={"HTTP/RPC":"HTTP/RPC","HTTP/POST":"HTTP/POST","IFRAME/RPC":"IFRAME/RPC","POP/RPC":"POP/RPC","TAB/RPC":"TAB/RPC","EXT/RPC":"EXT/RPC","DEEPLINK/RPC":"DEEPLINK/RPC"},_URL=globalThis.URL;let URL$2=class extends _URL{constructor(eo,to){for(var ro=arguments.length,no=new Array(ro>2?ro-2:0),io=2;io{if(Xr.appIdentifier){const{appIdentifier:eo,address:to,nonce:ro,signatures:no}=Xr;return invariant$1(isString(eo),"verifyAccountProof({ appIdentifier }) -- appIdentifier must be a string"),invariant$1(isString(to)&&sansPrefix(to).length===16,"verifyAccountProof({ address }) -- address must be a valid address"),invariant$1(/^[0-9a-f]+$/i.test(ro),"nonce must be a hex string"),invariant$1(Array.isArray(no)&&no.every((io,oo,ao)=>io.f_type==="CompositeSignature"),"Must include an Array of CompositeSignatures to verify"),invariant$1(no.map(io=>io.addr).every((io,oo,ao)=>io===ao[0]),"User signatures to be verified must be from a single account address"),!0}else{const{message:eo,address:to,compSigs:ro}=Xr;return invariant$1(/^[0-9a-f]+$/i.test(eo),"Signed message must be a hex string"),invariant$1(isString(to)&&sansPrefix(to).length===16,"verifyUserSignatures({ address }) -- address must be a valid address"),invariant$1(Array.isArray(ro)&&ro.every((no,io,oo)=>no.f_type==="CompositeSignature"),"Must include an Array of CompositeSignatures to verify"),invariant$1(ro.map(no=>no.addr).every((no,io,oo)=>no===oo[0]),"User signatures to be verified must be from a single account address"),!0}},getVerifySignaturesScript=async(Xr,eo)=>{const to="verifyUserSignatures";let ro=await getChainId(eo);const no={testnet:"0x74daa6f9c7ef24b1",mainnet:"0xb4b82a1c9d21d284",previewnet:"0x40b5b8b2ce81ea4a"},io=eo.fclCryptoContract||no[ro];return invariant$1(io,`${to}({ fclCryptoContract }) -- FCLCrypto contract address is unknown for network: ${ro}. Please manually specify the FCLCrypto contract address.`),` import FCLCrypto from ${io} access(all) fun main( @@ -2461,7 +4291,7 @@ Details:`,io.accounts].filter(Boolean),no=function(){for(var io=arguments.length ): Bool { return FCLCrypto.${to}(address: address, message: message, keyIndices: keyIndices, signatures: signatures) } - `};async function verifyUserSignatures$1(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ro=withPrefix$1(eo[0].addr);validateArgs({message:Xr,address:ro,compSigs:eo});let no=[],io=[];for(const oo of eo)no.push(oo.signature),io.push(oo.keyId.toString());return query({cadence:await getVerifySignaturesScript(USER_SIGNATURE,to),args:(oo,ao)=>[oo(ro,ao.Address),oo(Xr,ao.String),oo(io,ao.Array(ao.Int)),oo(no,ao.Array(ao.String))]})}log.deprecate({pkg:"FCL",subject:"fcl.verifyUserSignatures()",message:"Please use fcl.AppUtils.verifyUserSignatures()",callback:function Xr(eo,to){return verifyUserSignatures$1(eo,to)}});async function configLens(Xr){return Object.fromEntries(Object.entries(await config().where(Xr)).map(eo=>{let[to,ro]=eo;return[to.replace(Xr,""),ro]}))}const stub=()=>{throw new Error("Platform specific Core Strategies are not initialized")},stubCoreStrategies={[CORE_STRATEGIES["EXT/RPC"]]:stub,[CORE_STRATEGIES["HTTP/POST"]]:stub,[CORE_STRATEGIES["IFRAME/RPC"]]:stub,[CORE_STRATEGIES["POP/RPC"]]:stub,[CORE_STRATEGIES["TAB/RPC"]]:stub,[CORE_STRATEGIES["EXT/RPC"]]:stub},supportedServicePlugins=["discovery-service"],validateDiscoveryPlugin=Xr=>{const{services:eo,serviceStrategy:to}=Xr;invariant$1(Array.isArray(eo)&&eo.length,"Array of Discovery Services is required");for(const ro of eo)invariant$1(isRequired(ro.f_type)&&ro.f_type==="Service","Service is required"),invariant$1(isRequired(ro.type)&&ro.type==="authn",`Service must be type authn. Received ${ro.type}`),invariant$1(ro.method in CORE_STRATEGIES||to.method===ro.method,`Service method ${ro.method} is not supported`);return invariant$1(isRequired(to),"Service strategy is required"),invariant$1(isRequired(to.method)&&isString(to.method),"Service strategy method is required"),invariant$1(isRequired(to.exec)&&isFunc(to.exec),"Service strategy exec function is required"),{discoveryServices:eo,serviceStrategy:to}},ServiceRegistry=Xr=>{let{coreStrategies:eo}=Xr,to=new Set,ro=new Map(Object.entries(eo));const no=co=>{if(invariant$1(supportedServicePlugins.includes(co.type),`Service Plugin type ${co.type} is not supported`),co.type==="discovery-service"){const{discoveryServices:lo,serviceStrategy:fo}=validateDiscoveryPlugin(co);io(lo),ro.has(fo.method)?log({title:"Add Service Plugin",message:`Service strategy for ${fo.method} already exists`,level:LEVELS.warn}):ro.set(fo.method,fo.exec)}},io=co=>to=new Set([...co]);return Object.freeze({add:no,getServices:()=>[...to],getStrategy:co=>ro.get(co),getStrategies:()=>[...ro.keys()]})};let serviceRegistry;const getIsServiceRegistryInitialized=()=>typeof serviceRegistry<"u",initServiceRegistry=Xr=>{let{coreStrategies:eo}=Xr;if(getIsServiceRegistryInitialized())return serviceRegistry;const to=ServiceRegistry({coreStrategies:eo});return serviceRegistry=to,to},getServiceRegistry=()=>getIsServiceRegistryInitialized()?serviceRegistry:(console.warn("Registry is not initalized, it will be initialized with stub core strategies"),initServiceRegistry({coreStrategies:stubCoreStrategies})),makeDiscoveryServices=async()=>[...(window==null?void 0:window.fcl_extensions)||[],...getServiceRegistry().getServices()];async function getDiscoveryService(Xr){const eo=await config.get("discovery.authn.include",[]),to=await config.get("discovery.features.suggested",[]),ro=await config.first(["discovery.wallet.method","discovery.wallet.method.default"]),no=Xr!=null&&Xr.method?Xr.method:ro,io=(Xr==null?void 0:Xr.endpoint)??await config.first(["discovery.wallet","challenge.handshake"]);return invariant$1(io,` + `};async function verifyUserSignatures$1(Xr,eo){let to=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ro=withPrefix$1(eo[0].addr);validateArgs({message:Xr,address:ro,compSigs:eo});let no=[],io=[];for(const oo of eo)no.push(oo.signature),io.push(oo.keyId.toString());return query({cadence:await getVerifySignaturesScript(USER_SIGNATURE,to),args:(oo,ao)=>[oo(ro,ao.Address),oo(Xr,ao.String),oo(io,ao.Array(ao.Int)),oo(no,ao.Array(ao.String))]})}log.deprecate({pkg:"FCL",subject:"fcl.verifyUserSignatures()",message:"Please use fcl.AppUtils.verifyUserSignatures()",callback:function Xr(eo,to){return verifyUserSignatures$1(eo,to)}});async function configLens(Xr){return Object.fromEntries(Object.entries(await config().where(Xr)).map(eo=>{let[to,ro]=eo;return[to.replace(Xr,""),ro]}))}const stub=()=>{throw new Error("Platform specific Core Strategies are not initialized")},stubCoreStrategies={[CORE_STRATEGIES["EXT/RPC"]]:stub,[CORE_STRATEGIES["HTTP/POST"]]:stub,[CORE_STRATEGIES["IFRAME/RPC"]]:stub,[CORE_STRATEGIES["POP/RPC"]]:stub,[CORE_STRATEGIES["TAB/RPC"]]:stub,[CORE_STRATEGIES["EXT/RPC"]]:stub},supportedServicePlugins=["discovery-service"],validateDiscoveryPlugin=Xr=>{const{services:eo,serviceStrategy:to}=Xr;invariant$1(Array.isArray(eo)&&eo.length,"Array of Discovery Services is required");for(const ro of eo)invariant$1(isRequired(ro.f_type)&&ro.f_type==="Service","Service is required"),invariant$1(isRequired(ro.type)&&ro.type==="authn",`Service must be type authn. Received ${ro.type}`),invariant$1(ro.method in CORE_STRATEGIES||to.method===ro.method,`Service method ${ro.method} is not supported`);return invariant$1(isRequired(to),"Service strategy is required"),invariant$1(isRequired(to.method)&&isString(to.method),"Service strategy method is required"),invariant$1(isRequired(to.exec)&&isFunc(to.exec),"Service strategy exec function is required"),{discoveryServices:eo,serviceStrategy:to}},ServiceRegistry=Xr=>{let{coreStrategies:eo}=Xr,to=new Set,ro=new Map(Object.entries(eo));const no=co=>{if(invariant$1(supportedServicePlugins.includes(co.type),`Service Plugin type ${co.type} is not supported`),co.type==="discovery-service"){const{discoveryServices:lo,serviceStrategy:uo}=validateDiscoveryPlugin(co);io(lo),ro.has(uo.method)?log({title:"Add Service Plugin",message:`Service strategy for ${uo.method} already exists`,level:LEVELS.warn}):ro.set(uo.method,uo.exec)}},io=co=>to=new Set([...co]);return Object.freeze({add:no,getServices:()=>[...to],getStrategy:co=>ro.get(co),getStrategies:()=>[...ro.keys()]})};let serviceRegistry;const getIsServiceRegistryInitialized=()=>typeof serviceRegistry<"u",initServiceRegistry=Xr=>{let{coreStrategies:eo}=Xr;if(getIsServiceRegistryInitialized())return serviceRegistry;const to=ServiceRegistry({coreStrategies:eo});return serviceRegistry=to,to},getServiceRegistry=()=>getIsServiceRegistryInitialized()?serviceRegistry:(console.warn("Registry is not initalized, it will be initialized with stub core strategies"),initServiceRegistry({coreStrategies:stubCoreStrategies})),makeDiscoveryServices=async()=>[...(window==null?void 0:window.fcl_extensions)||[],...getServiceRegistry().getServices()];async function getDiscoveryService(Xr){const eo=await config.get("discovery.authn.include",[]),to=await config.get("discovery.features.suggested",[]),ro=await config.first(["discovery.wallet.method","discovery.wallet.method.default"]),no=Xr!=null&&Xr.method?Xr.method:ro,io=(Xr==null?void 0:Xr.endpoint)??await config.first(["discovery.wallet","challenge.handshake"]);return invariant$1(io,` If no service is passed to "authenticate," then "discovery.wallet" must be defined in fcl config. See: "https://docs.onflow.org/fcl/reference/api/#setting-configuration-values" `),{...Xr,type:"authn",endpoint:io,method:no,discoveryAuthnInclude:eo,discoveryFeaturesSuggested:to}}async function fetchServices(Xr,eo){if(Xr==null||eo==null)return[];const to=new URL$2(Xr);to.searchParams.append("code",eo);const ro=await fetch(to,{method:"GET",headers:{"Content-Type":"application/json"}}).then(io=>io.json());if(Array.isArray(ro))return ro;const no=[];if(Array.isArray(ro.authorizations))for(let io of ro.authorizations)no.push({type:"authz",keyId:ro.keyId,...io});return ro.provider!=null&&no.push({type:"authn",id:"wallet-provider#authn",...ro.provider}),no}function mergeServices(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return[...Xr,...eo]}function normalizeAuthn(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...SERVICE_PRAGMA,type:Xr.type,uid:Xr.id,endpoint:Xr.authn,id:Xr.pid,provider:{address:withPrefix$1(Xr.addr),name:Xr.name,icon:Xr.icon}};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeAuthz(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...SERVICE_PRAGMA,type:Xr.type,uid:Xr.id,endpoint:Xr.endpoint,method:Xr.method,identity:{...IDENTITY_PRAGMA,address:withPrefix$1(Xr.addr),keyId:Xr.keyId},params:Xr.params,data:Xr.data};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizePreAuthz(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...SERVICE_PRAGMA,type:Xr.type,uid:Xr.id,endpoint:Xr.endpoint,method:Xr.method,identity:{...IDENTITY_PRAGMA,address:withPrefix$1(Xr.addr),keyId:Xr.keyId},params:Xr.params,data:Xr.data};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeFrame(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{old:Xr,...SERVICE_PRAGMA,type:"frame",endpoint:Xr.endpoint,params:Xr.params||{},data:Xr.data||{}};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeBackChannelRpc(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...SERVICE_PRAGMA,type:"back-channel-rpc",endpoint:Xr.endpoint,method:Xr.method,params:Xr.params||{},data:Xr.data||{}};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeOpenId(Xr){if(Xr==null)return null;switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeUserSignature(Xr){if(Xr==null)return null;if(!Xr.f_vsn)throw new Error("Invalid user-signature service");switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeLocalView(Xr){if(Xr==null)return null;if(Xr.method==null&&(Xr={...Xr,type:"local-view",method:"VIEW/IFRAME"}),!Xr.f_vsn)return{...SERVICE_PRAGMA,type:Xr.type||"local-view",method:Xr.method,endpoint:Xr.endpoint,data:Xr.data||{},params:Xr.params||{}};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeAccountProof(Xr){if(Xr==null)return null;if(!Xr.f_vsn)throw new Error("FCL Normalizer Error: Invalid account-proof service");switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeAuthnRefresh(Xr){if(Xr==null)return null;if(!Xr.f_vsn)throw new Error("Invalid authn-refresh service");switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}function normalizeServices(Xr,eo){return Xr.map(to=>normalizeService(to,eo)).filter(Boolean)}const serviceNormalizers={"back-channel-rpc":normalizeBackChannelRpc,"pre-authz":normalizePreAuthz,authz:normalizeAuthz,authn:normalizeAuthn,frame:normalizeFrame,"open-id":normalizeOpenId,"user-signature":normalizeUserSignature,"local-view":normalizeLocalView,"account-proof":normalizeAccountProof,"authn-refresh":normalizeAuthnRefresh};function normalizeService(Xr,eo){try{var to=serviceNormalizers[Xr.type](Xr,eo);return to}catch(ro){return console.error(`Unrecognized FCL Service Type [${Xr.type}]`,Xr,ro),Xr}}function serviceOfType(){let Xr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],eo=arguments.length>1?arguments[1]:void 0;return Xr.reduce((to,ro)=>ro.type===eo&&(!to||compare$1(ro.f_vsn,to.f_vsn)>0)?ro:to,null)}function deriveCompositeId(Xr){return encode([Xr.provider.address||Xr.provider.name||"UNSPECIFIED",Xr.id]).toString("hex")}function normalizeData(Xr){return Xr.addr=Xr.addr?withPrefix$1(Xr.addr):null,Xr.paddr=Xr.paddr?withPrefix$1(Xr.paddr):null,Xr}async function buildUser(Xr){Xr=normalizeData(Xr);var eo=normalizeServices(mergeServices(Xr.services||[],await fetchServices(Xr.hks,Xr.code)));const to=serviceOfType(eo,"authn");return{...USER_PRAGMA,addr:withPrefix$1(Xr.addr),cid:deriveCompositeId(to),loggedIn:!0,services:eo,expiresAt:Xr.expires}}const execStrategy=async Xr=>{let{service:eo,body:to,config:ro,opts:no}=Xr;return getServiceRegistry().getStrategy(eo.method)({service:eo,body:to,config:ro,opts:no})};async function execService(Xr){var ao;let{service:eo,msg:to={},config:ro={},opts:no={},platform:io}=Xr;to.data=eo.data;const oo={services:await configLens(/^service\./),app:await configLens(/^app\.detail\./),client:{...ro.client,platform:io,fclVersion:VERSION$2,fclLibrary:"https://github.com/onflow/fcl-js",hostname:((ao=window==null?void 0:window.location)==null?void 0:ao.hostname)??null,network:await getChainId(no)}};try{const so=await execStrategy({service:eo,body:to,config:oo,opts:no});return so.status==="REDIRECT"?(invariant$1(eo.type===so.data.type,"Cannot shift recursive service type in execService"),await execService({service:so.data,msg:to,config:oo,opts:no})):so}catch(so){throw log({title:`Error on execService ${eo==null?void 0:eo.type}`,message:so,level:LEVELS.error}),so}}function normalizeCompositeSignature(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...COMPOSITE_SIGNATURE_PRAGMA,addr:sansPrefix(Xr.addr||Xr.address),signature:Xr.signature||Xr.sig,keyId:Xr.keyId};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}const isFn=Xr=>typeof Xr=="function",NAME$1="CURRENT_USER",UPDATED="CURRENT_USER/UPDATED",SNAPSHOT="SNAPSHOT",SET_CURRENT_USER="SET_CURRENT_USER",DEL_CURRENT_USER="DEL_CURRENT_USER",DATA=`{ @@ -2481,7 +4311,7 @@ Details:`,io.accounts].filter(Boolean),no=function(){for(var io=arguments.length `,"font-weight:bold;font-family:monospace;"),Xr.merge(JSON.parse(DATA));const eo=await config.first(["fcl.storage","fcl.storage.default"]);if(eo.can){const to=await getStoredUser(eo);notExpired(to)&&Xr.merge(to)}},[SUBSCRIBE]:(Xr,eo)=>{Xr.subscribe(eo.from),Xr.send(eo.from,UPDATED,{...Xr.all()})},[UNSUBSCRIBE]:(Xr,eo)=>{Xr.unsubscribe(eo.from)},[SNAPSHOT]:async(Xr,eo)=>{eo.reply({...Xr.all()})},[SET_CURRENT_USER]:async(Xr,eo,to)=>{Xr.merge(to);const ro=await config.first(["fcl.storage","fcl.storage.default"]);ro.can&&ro.put(NAME$1,Xr.all()),Xr.broadcast(UPDATED,{...Xr.all()})},[DEL_CURRENT_USER]:async(Xr,eo)=>{Xr.merge(JSON.parse(DATA));const to=await config.first(["fcl.storage","fcl.storage.default"]);to.can&&to.put(NAME$1,Xr.all()),Xr.broadcast(UPDATED,{...Xr.all()})}},spawnCurrentUser=()=>spawn(HANDLERS,NAME$1);function notExpired(Xr){return Xr.expiresAt==null||Xr.expiresAt===0||Xr.expiresAt>Date.now()}async function getAccountProofData(){let Xr=await config.get("fcl.accountProof.resolver");if(Xr==null)return;if(!isFn(Xr)){log({title:"Account Proof Data Resolver must be a function",message:`Check fcl.accountProof.resolver configuration. Expected: fcl.accountProof.resolver: async () => { ... } Received: fcl.accountProof.resolver: ${typeof Xr} - `,level:LEVELS.warn});return}const eo=await Xr();if(eo!=null)return invariant$1(typeof eo.appIdentifier=="string","appIdentifier must be a string"),invariant$1(/^[0-9a-f]+$/i.test(eo.nonce),"Nonce must be a hex string"),eo}const makeConfig=async Xr=>{let{discoveryAuthnInclude:eo,discoveryFeaturesSuggested:to}=Xr;return{client:{discoveryAuthnInclude:eo,discoveryFeaturesSuggested:to,clientServices:await makeDiscoveryServices(),supportedStrategies:getServiceRegistry().getStrategies()}}},getAuthenticate=Xr=>{let{platform:eo}=Xr;return async function(){var no,io,oo;let{service:to,redir:ro=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(to&&!((no=to==null?void 0:to.provider)!=null&&no.is_installed)&&((io=to==null?void 0:to.provider)!=null&&io.requires_install)){window.location.href=(oo=to==null?void 0:to.provider)==null?void 0:oo.install_link;return}return new Promise(async(ao,so)=>{spawnCurrentUser();const co={redir:ro},lo=await snapshot(),fo=await getDiscoveryService(to),ho=serviceOfType(lo.services,"authn-refresh");let go;if(lo.loggedIn)if(ho)try{const yo=await execService({service:ho,msg:go,opts:co,platform:eo});send$2(NAME$1,SET_CURRENT_USER,await buildUser(yo))}catch(yo){log({title:`${yo.name} Could not refresh wallet authentication.`,message:yo.message,level:LEVELS.error})}finally{return ao(await snapshot())}else return ao(lo);try{go=await getAccountProofData()}catch(yo){return log({title:`${yo.name} On Authentication: Could not resolve account proof data.`,message:yo.message,level:LEVELS.error}),so(yo)}try{const yo=await execService({service:fo,msg:go,config:await makeConfig(fo),opts:co,platform:eo});send$2(NAME$1,SET_CURRENT_USER,await buildUser(yo))}catch(yo){log({title:`${yo} On Authentication`,message:yo,level:LEVELS.error})}finally{ao(await snapshot())}})}};function unauthenticate(){spawnCurrentUser(),send$2(NAME$1,DEL_CURRENT_USER)}const normalizePreAuthzResponse=Xr=>({f_type:"PreAuthzResponse",f_vsn:"1.0.0",proposer:(Xr||{}).proposer,payer:(Xr||{}).payer||[],authorization:(Xr||{}).authorization||[]}),getResolvePreAuthz=Xr=>{let{platform:eo}=Xr;return to=>{const ro=normalizePreAuthzResponse(to),no=[];ro.proposer!=null&&no.push(["PROPOSER",ro.proposer]);for(let oo of ro.payer||[])no.push(["PAYER",oo]);for(let oo of ro.authorization||[])no.push(["AUTHORIZER",oo]);var io=no.map(oo=>{let[ao,so]=oo;return{tempId:[so.identity.address,so.identity.keyId].join("|"),addr:so.identity.address,keyId:so.identity.keyId,signingFunction(co){return execService({service:so,msg:co,platform:eo})},role:{proposer:ao==="PROPOSER",payer:ao==="PAYER",authorizer:ao==="AUTHORIZER"}}});return io}},getAuthorization=Xr=>{let{platform:eo}=Xr;return async to=>(spawnCurrentUser(),{...to,tempId:"CURRENT_USER",async resolve(ro,no){const io=await getAuthenticate({platform:eo})({redir:!0}),oo=serviceOfType(io.services,"authz"),ao=serviceOfType(io.services,"pre-authz");if(ao)return getResolvePreAuthz({platform:eo})(await execService({service:ao,msg:no,platform:eo}));if(oo){let so;return isMobile()&&oo.method==="WC/RPC"&&(so=window.open("","_blank")),{...ro,tempId:"CURRENT_USER",resolve:null,addr:sansPrefix(oo.identity.address),keyId:oo.identity.keyId,sequenceNum:null,signature:null,async signingFunction(co){return normalizeCompositeSignature(await execService({service:oo,msg:co,opts:{includeOlderJsonRpcCall:!0,windowRef:so},platform:eo}))}}}throw new Error("No Authz or PreAuthz Service configured for CURRENT_USER")}})};function subscribe(Xr){spawnCurrentUser();const eo="@EXIT",to=spawn(async ro=>{for(ro.send(NAME$1,SUBSCRIBE);;){const no=await ro.receive();if(no.tag===eo){ro.send(NAME$1,UNSUBSCRIBE);return}Xr(no.data)}});return()=>send$2(to,eo)}function snapshot(){return spawnCurrentUser(),send$2(NAME$1,SNAPSHOT,null,{expectReply:!0,timeout:0})}const getResolveArgument=Xr=>{let{platform:eo}=Xr;return async()=>{const{addr:to}=await getAuthenticate({platform:eo})();return arg(withPrefix$1(to),Address)}},makeSignable=Xr=>(invariant$1(/^[0-9a-f]+$/i.test(Xr),"Message must be a hex string"),{message:Xr}),getSignUserMessage=Xr=>{let{platform:eo}=Xr;return async to=>{spawnCurrentUser();const ro=await getAuthenticate({platform:eo})({redir:!0}),no=serviceOfType(ro.services,"user-signature");invariant$1(no,"Current user must have authorized a signing service.");try{const io=await execService({service:no,msg:makeSignable(to),platform:eo});return Array.isArray(io)?io.map(oo=>normalizeCompositeSignature(oo)):[normalizeCompositeSignature(io)]}catch(io){return io}}},getCurrentUser=Xr=>{let{platform:eo}=Xr,to=()=>({authenticate:getAuthenticate({platform:eo}),unauthenticate,authorization:getAuthorization({platform:eo}),signUserMessage:getSignUserMessage({platform:eo}),subscribe,snapshot,resolveArgument:getResolveArgument({platform:eo})});return to.authenticate=getAuthenticate({platform:eo}),to.unauthenticate=unauthenticate,to.authorization=getAuthorization({platform:eo}),to.signUserMessage=getSignUserMessage({platform:eo}),to.subscribe=subscribe,to.snapshot=snapshot,to.resolveArgument=getResolveArgument({platform:eo}),to};function serviceEndpoint(Xr){var to;const eo=new URL$2(Xr.endpoint);if((to=window==null?void 0:window.location)!=null&&to.origin&&eo.searchParams.append("l6n",window.location.origin),Xr.params!=null)for(let[ro,no]of Object.entries(Xr.params||{}))eo.searchParams.append(ro,no);return eo}function fetchService(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const to=eo.method||"POST",ro=to==="GET"?void 0:JSON.stringify(eo.data||Xr.data||{});return fetch(serviceEndpoint(Xr),{method:to,headers:{...Xr.headers||{},...eo.headers||{},"Content-Type":"application/json"},body:ro}).then(no=>no.json())}function normalizePollingResponse(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...POLLING_RESPONSE_PRAGMA,status:Xr.status??"APPROVED",reason:Xr.reason??null,data:Xr.compositeSignature||Xr.data||{...Xr},updates:normalizeBackChannelRpc(Xr.authorizationUpdates),local:normalizeFrame((Xr.local||[])[0])};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}const OPTIONS={"HTTP/GET":"GET","HTTP/POST":"POST"},serviceMethod=Xr=>(invariant$1(OPTIONS[Xr.method],"Invalid Service Method for type back-channel-rpc",{service:Xr}),OPTIONS[Xr.method]);async function poll(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>!0;if(invariant$1(Xr,"Missing Polling Service",{service:Xr}),!eo())throw new Error("Externally Halted");let ro;try{if(typeof document<"u"&&document.visibilityState==="hidden")return await new Promise(no=>setTimeout(no,500)),poll(Xr,eo);ro=await fetchService(Xr,{method:serviceMethod(Xr)}).then(normalizePollingResponse)}catch(no){throw no}switch(ro.status){case"APPROVED":return ro.data;case"DECLINED":throw new Error(`Declined: ${ro.reason||"No reason supplied."}`);default:return await new Promise(no=>setTimeout(no,500)),poll(ro.updates,eo)}}const getExecHttpPost=Xr=>async eo=>{let{service:to,body:ro,config:no,opts:io}=eo;const oo=await fetchService(to,{data:{fclVersion:VERSION$2,service:{params:to.params,data:to.data,type:to.type},config:no,...ro}}).then(normalizePollingResponse);if(oo.status==="APPROVED")return oo.data;if(oo.status==="DECLINED")throw new Error(`Declined: ${oo.reason||"No reason supplied."}`);if(oo.status==="REDIRECT")return oo;if(oo.status==="PENDING"){var ao=!0,so=!0;const[co,lo]=await Xr(normalizeLocalView(oo.local),{serviceEndpoint,onClose:()=>so=!1}),fo=()=>{try{lo(),so=!1}catch(go){console.error("Frame Close Error",go)}},ho=()=>{const go=ao;return ao=so,go};return poll(oo.updates,ho).then(go=>(fo(),go)).catch(go=>{throw console.error(go),fo(),go})}else throw console.error("Auto Decline: Invalid Response",{service:to,resp:oo}),new Error("Auto Decline: Invalid Response")},CLOSE_EVENT="FCL:VIEW:CLOSE",READY_EVENT="FCL:VIEW:READY",RESPONSE_EVENT="FCL:VIEW:RESPONSE",_$3=Xr=>typeof Xr=="string"&&Xr.toLowerCase(),IGNORE=new Set(["monetizationstart","monetizationpending","monetizationprogress","monetizationstop"]),deprecate=(Xr,eo)=>console.warn("DEPRECATION NOTICE",`Received ${Xr}, please use ${eo} for this and future versions of FCL`),buildMessageHandler=Xr=>{let{close:eo,send:to,onReady:ro,onResponse:no,onMessage:io}=Xr;return oo=>{try{if(typeof oo.data!="object"||IGNORE.has(oo.data.type))return;_$3(oo.data.type)===_$3(CLOSE_EVENT)&&eo(),_$3(oo.data.type)===_$3(READY_EVENT)&&ro(oo,{send:to,close:eo}),_$3(oo.data.type)===_$3(RESPONSE_EVENT)&&no(oo,{send:to,close:eo}),io(oo,{send:to,close:eo}),_$3(oo.data.type)===_$3("FCL:FRAME:READY")&&(deprecate(oo.data.type,READY_EVENT),ro(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL:FRAME:RESPONSE")&&(deprecate(oo.data.type,RESPONSE_EVENT),no(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL:FRAME:CLOSE")&&(deprecate(oo.data.type,CLOSE_EVENT),eo()),_$3(oo.data.type)===_$3("FCL::CHALLENGE::RESPONSE")&&(deprecate(oo.data.type,RESPONSE_EVENT),no(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL::AUTHZ_READY")&&(deprecate(oo.data.type,READY_EVENT),ro(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL::CHALLENGE::CANCEL")&&(deprecate(oo.data.type,CLOSE_EVENT),eo()),_$3(oo.data.type)===_$3("FCL::CANCEL")&&(deprecate(oo.data.type,CLOSE_EVENT),eo())}catch(ao){console.error("Frame Callback Error",ao),eo()}}};watchForChainIdChanges();const HEX="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",T$4=HEX.length;function uid(){let Xr="",eo=32;for(;eo--;)Xr+=HEX[Math.random()*T$4|0];return Xr}const FRAME="FCL_IFRAME",FRAME_STYLES=` + `,level:LEVELS.warn});return}const eo=await Xr();if(eo!=null)return invariant$1(typeof eo.appIdentifier=="string","appIdentifier must be a string"),invariant$1(/^[0-9a-f]+$/i.test(eo.nonce),"Nonce must be a hex string"),eo}const makeConfig=async Xr=>{let{discoveryAuthnInclude:eo,discoveryFeaturesSuggested:to}=Xr;return{client:{discoveryAuthnInclude:eo,discoveryFeaturesSuggested:to,clientServices:await makeDiscoveryServices(),supportedStrategies:getServiceRegistry().getStrategies()}}},getAuthenticate=Xr=>{let{platform:eo}=Xr;return async function(){var no,io,oo;let{service:to,redir:ro=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(to&&!((no=to==null?void 0:to.provider)!=null&&no.is_installed)&&((io=to==null?void 0:to.provider)!=null&&io.requires_install)){window.location.href=(oo=to==null?void 0:to.provider)==null?void 0:oo.install_link;return}return new Promise(async(ao,so)=>{spawnCurrentUser();const co={redir:ro},lo=await snapshot(),uo=await getDiscoveryService(to),ho=serviceOfType(lo.services,"authn-refresh");let go;if(lo.loggedIn)if(ho)try{const bo=await execService({service:ho,msg:go,opts:co,platform:eo});send$2(NAME$1,SET_CURRENT_USER,await buildUser(bo))}catch(bo){log({title:`${bo.name} Could not refresh wallet authentication.`,message:bo.message,level:LEVELS.error})}finally{return ao(await snapshot())}else return ao(lo);try{go=await getAccountProofData()}catch(bo){return log({title:`${bo.name} On Authentication: Could not resolve account proof data.`,message:bo.message,level:LEVELS.error}),so(bo)}try{const bo=await execService({service:uo,msg:go,config:await makeConfig(uo),opts:co,platform:eo});send$2(NAME$1,SET_CURRENT_USER,await buildUser(bo))}catch(bo){log({title:`${bo} On Authentication`,message:bo,level:LEVELS.error})}finally{ao(await snapshot())}})}};function unauthenticate(){spawnCurrentUser(),send$2(NAME$1,DEL_CURRENT_USER)}const normalizePreAuthzResponse=Xr=>({f_type:"PreAuthzResponse",f_vsn:"1.0.0",proposer:(Xr||{}).proposer,payer:(Xr||{}).payer||[],authorization:(Xr||{}).authorization||[]}),getResolvePreAuthz=Xr=>{let{platform:eo}=Xr;return to=>{const ro=normalizePreAuthzResponse(to),no=[];ro.proposer!=null&&no.push(["PROPOSER",ro.proposer]);for(let oo of ro.payer||[])no.push(["PAYER",oo]);for(let oo of ro.authorization||[])no.push(["AUTHORIZER",oo]);var io=no.map(oo=>{let[ao,so]=oo;return{tempId:[so.identity.address,so.identity.keyId].join("|"),addr:so.identity.address,keyId:so.identity.keyId,signingFunction(co){return execService({service:so,msg:co,platform:eo})},role:{proposer:ao==="PROPOSER",payer:ao==="PAYER",authorizer:ao==="AUTHORIZER"}}});return io}},getAuthorization=Xr=>{let{platform:eo}=Xr;return async to=>(spawnCurrentUser(),{...to,tempId:"CURRENT_USER",async resolve(ro,no){const io=await getAuthenticate({platform:eo})({redir:!0}),oo=serviceOfType(io.services,"authz"),ao=serviceOfType(io.services,"pre-authz");if(ao)return getResolvePreAuthz({platform:eo})(await execService({service:ao,msg:no,platform:eo}));if(oo){let so;return isMobile()&&oo.method==="WC/RPC"&&(so=window.open("","_blank")),{...ro,tempId:"CURRENT_USER",resolve:null,addr:sansPrefix(oo.identity.address),keyId:oo.identity.keyId,sequenceNum:null,signature:null,async signingFunction(co){return normalizeCompositeSignature(await execService({service:oo,msg:co,opts:{includeOlderJsonRpcCall:!0,windowRef:so},platform:eo}))}}}throw new Error("No Authz or PreAuthz Service configured for CURRENT_USER")}})};function subscribe(Xr){spawnCurrentUser();const eo="@EXIT",to=spawn(async ro=>{for(ro.send(NAME$1,SUBSCRIBE);;){const no=await ro.receive();if(no.tag===eo){ro.send(NAME$1,UNSUBSCRIBE);return}Xr(no.data)}});return()=>send$2(to,eo)}function snapshot(){return spawnCurrentUser(),send$2(NAME$1,SNAPSHOT,null,{expectReply:!0,timeout:0})}const getResolveArgument=Xr=>{let{platform:eo}=Xr;return async()=>{const{addr:to}=await getAuthenticate({platform:eo})();return arg(withPrefix$1(to),Address)}},makeSignable=Xr=>(invariant$1(/^[0-9a-f]+$/i.test(Xr),"Message must be a hex string"),{message:Xr}),getSignUserMessage=Xr=>{let{platform:eo}=Xr;return async to=>{spawnCurrentUser();const ro=await getAuthenticate({platform:eo})({redir:!0}),no=serviceOfType(ro.services,"user-signature");invariant$1(no,"Current user must have authorized a signing service.");try{const io=await execService({service:no,msg:makeSignable(to),platform:eo});return Array.isArray(io)?io.map(oo=>normalizeCompositeSignature(oo)):[normalizeCompositeSignature(io)]}catch(io){return io}}},getCurrentUser=Xr=>{let{platform:eo}=Xr,to=()=>({authenticate:getAuthenticate({platform:eo}),unauthenticate,authorization:getAuthorization({platform:eo}),signUserMessage:getSignUserMessage({platform:eo}),subscribe,snapshot,resolveArgument:getResolveArgument({platform:eo})});return to.authenticate=getAuthenticate({platform:eo}),to.unauthenticate=unauthenticate,to.authorization=getAuthorization({platform:eo}),to.signUserMessage=getSignUserMessage({platform:eo}),to.subscribe=subscribe,to.snapshot=snapshot,to.resolveArgument=getResolveArgument({platform:eo}),to};function serviceEndpoint(Xr){var to;const eo=new URL$2(Xr.endpoint);if((to=window==null?void 0:window.location)!=null&&to.origin&&eo.searchParams.append("l6n",window.location.origin),Xr.params!=null)for(let[ro,no]of Object.entries(Xr.params||{}))eo.searchParams.append(ro,no);return eo}function fetchService(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const to=eo.method||"POST",ro=to==="GET"?void 0:JSON.stringify(eo.data||Xr.data||{});return fetch(serviceEndpoint(Xr),{method:to,headers:{...Xr.headers||{},...eo.headers||{},"Content-Type":"application/json"},body:ro}).then(no=>no.json())}function normalizePollingResponse(Xr){if(Xr==null)return null;if(!Xr.f_vsn)return{...POLLING_RESPONSE_PRAGMA,status:Xr.status??"APPROVED",reason:Xr.reason??null,data:Xr.compositeSignature||Xr.data||{...Xr},updates:normalizeBackChannelRpc(Xr.authorizationUpdates),local:normalizeFrame((Xr.local||[])[0])};switch(Xr.f_vsn){case"1.0.0":return Xr;default:return null}}const OPTIONS={"HTTP/GET":"GET","HTTP/POST":"POST"},serviceMethod=Xr=>(invariant$1(OPTIONS[Xr.method],"Invalid Service Method for type back-channel-rpc",{service:Xr}),OPTIONS[Xr.method]);async function poll(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>!0;if(invariant$1(Xr,"Missing Polling Service",{service:Xr}),!eo())throw new Error("Externally Halted");let ro;try{if(typeof document<"u"&&document.visibilityState==="hidden")return await new Promise(no=>setTimeout(no,500)),poll(Xr,eo);ro=await fetchService(Xr,{method:serviceMethod(Xr)}).then(normalizePollingResponse)}catch(no){throw no}switch(ro.status){case"APPROVED":return ro.data;case"DECLINED":throw new Error(`Declined: ${ro.reason||"No reason supplied."}`);default:return await new Promise(no=>setTimeout(no,500)),poll(ro.updates,eo)}}const getExecHttpPost=Xr=>async eo=>{let{service:to,body:ro,config:no,opts:io}=eo;const oo=await fetchService(to,{data:{fclVersion:VERSION$2,service:{params:to.params,data:to.data,type:to.type},config:no,...ro}}).then(normalizePollingResponse);if(oo.status==="APPROVED")return oo.data;if(oo.status==="DECLINED")throw new Error(`Declined: ${oo.reason||"No reason supplied."}`);if(oo.status==="REDIRECT")return oo;if(oo.status==="PENDING"){var ao=!0,so=!0;const[co,lo]=await Xr(normalizeLocalView(oo.local),{serviceEndpoint,onClose:()=>so=!1}),uo=()=>{try{lo(),so=!1}catch(go){console.error("Frame Close Error",go)}},ho=()=>{const go=ao;return ao=so,go};return poll(oo.updates,ho).then(go=>(uo(),go)).catch(go=>{throw console.error(go),uo(),go})}else throw console.error("Auto Decline: Invalid Response",{service:to,resp:oo}),new Error("Auto Decline: Invalid Response")},CLOSE_EVENT="FCL:VIEW:CLOSE",READY_EVENT="FCL:VIEW:READY",RESPONSE_EVENT="FCL:VIEW:RESPONSE",_$3=Xr=>typeof Xr=="string"&&Xr.toLowerCase(),IGNORE=new Set(["monetizationstart","monetizationpending","monetizationprogress","monetizationstop"]),deprecate=(Xr,eo)=>console.warn("DEPRECATION NOTICE",`Received ${Xr}, please use ${eo} for this and future versions of FCL`),buildMessageHandler=Xr=>{let{close:eo,send:to,onReady:ro,onResponse:no,onMessage:io}=Xr;return oo=>{try{if(typeof oo.data!="object"||IGNORE.has(oo.data.type))return;_$3(oo.data.type)===_$3(CLOSE_EVENT)&&eo(),_$3(oo.data.type)===_$3(READY_EVENT)&&ro(oo,{send:to,close:eo}),_$3(oo.data.type)===_$3(RESPONSE_EVENT)&&no(oo,{send:to,close:eo}),io(oo,{send:to,close:eo}),_$3(oo.data.type)===_$3("FCL:FRAME:READY")&&(deprecate(oo.data.type,READY_EVENT),ro(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL:FRAME:RESPONSE")&&(deprecate(oo.data.type,RESPONSE_EVENT),no(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL:FRAME:CLOSE")&&(deprecate(oo.data.type,CLOSE_EVENT),eo()),_$3(oo.data.type)===_$3("FCL::CHALLENGE::RESPONSE")&&(deprecate(oo.data.type,RESPONSE_EVENT),no(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL::AUTHZ_READY")&&(deprecate(oo.data.type,READY_EVENT),ro(oo,{send:to,close:eo})),_$3(oo.data.type)===_$3("FCL::CHALLENGE::CANCEL")&&(deprecate(oo.data.type,CLOSE_EVENT),eo()),_$3(oo.data.type)===_$3("FCL::CANCEL")&&(deprecate(oo.data.type,CLOSE_EVENT),eo())}catch(ao){console.error("Frame Callback Error",ao),eo()}}};watchForChainIdChanges();const HEX="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",T$4=HEX.length;function uid(){let Xr="",eo=32;for(;eo--;)Xr+=HEX[Math.random()*T$4|0];return Xr}const FRAME="FCL_IFRAME",FRAME_STYLES=` position:fixed; top: 0px; right: 0px; @@ -2494,39 +4324,39 @@ Details:`,io.accounts].filter(Boolean),no=function(){for(var io=arguments.length z-index: 2147483647; box-sizing: border-box; color-scheme: light; -`;function renderFrame(Xr){invariant$1(!document.getElementById(FRAME),"Attempt at triggering multiple Frames",{src:Xr});const eo=document.createElement("iframe");eo.src=Xr,eo.id=FRAME,eo.allow="usb *; hid *",eo.frameBorder="0",eo.style.cssText=FRAME_STYLES,document.body.append(eo);const to=()=>{document.getElementById(FRAME)&&document.getElementById(FRAME).remove()};return[eo.contentWindow,to]}const POP="FCL_POP";let popup=null,previousUrl$1=null;function popupWindow(Xr,eo,to,ro,no){const io=to.top.outerHeight/2+to.top.screenY-no/2,oo=to.top.outerWidth/2+to.top.screenX-ro/2,ao=to.open(Xr,eo,`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${ro}, height=${no}, top=${io}, left=${oo}`);if(!ao)throw new Error("Popup failed to open (was it blocked by a popup blocker?)");return ao}function renderPop(Xr){return popup==null||popup!=null&&popup.closed?popup=popupWindow(Xr,POP,window,640,770):(previousUrl$1!==Xr&&popup.location.replace(Xr),popup.focus()),previousUrl$1=Xr,[popup,()=>{popup&&!popup.closed&&popup.close(),popup=null}]}let tab$1=null,previousUrl=null;function renderTab(Xr){if(tab$1==null||tab$1!=null&&tab$1.closed){if(tab$1=window.open(Xr,"_blank"),!tab$1)throw new Error("Tab failed to open (was it blocked by the browser?)")}else previousUrl!==Xr&&tab$1.location.replace(Xr),tab$1.focus();return previousUrl=Xr,[tab$1,()=>{tab$1&&!tab$1.closed&&tab$1.close(),tab$1=null}]}const isServerSide=()=>typeof window>"u",getSessionStorage=()=>{try{return{can:!isServerSide(),get:async eo=>JSON.parse(sessionStorage.getItem(eo)),put:async(eo,to)=>sessionStorage.setItem(eo,JSON.stringify(to))}}catch{return null}},getDefaultConfig=()=>({"discovery.wallet.method.default":"IFRAME/RPC","fcl.storage.default":getSessionStorage()}),noop$3=()=>{};function frame(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$3,close:noop$3};const to=eo.onClose||noop$3,ro=eo.onMessage||noop$3,no=eo.onReady||noop$3,io=eo.onResponse||noop$3,oo=buildMessageHandler({close:co,send:lo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderFrame(serviceEndpoint(Xr));return{send:lo,close:co};function co(){try{window.removeEventListener("message",oo),so(),to()}catch(fo){console.error("Frame Close Error",fo)}}function lo(fo){try{ao.postMessage(JSON.parse(JSON.stringify(fo||{})),"*")}catch(ho){console.error("Frame Send Error",fo,ho)}}}const VERSION$1="1.10.0";function execIframeRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),so=no.includeOlderJsonRpcCall;frame(eo,{async onReady(co,lo){let{send:fo}=lo;try{fo({type:"FCL:VIEW:READY:RESPONSE",fclVersion:VERSION$1,body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),fo({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),so&&fo({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params],deprecated:{message:"jsonrpc is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}})}catch(ho){throw ho}},onResponse(co,lo){let{close:fo}=lo;try{if(typeof co.data!="object")return;const ho=normalizePollingResponse(co.data);switch(ho.status){case"APPROVED":io(ho.data),fo();break;case"DECLINED":oo(`Declined: ${ho.reason||"No reason supplied"}`),fo();break;case"REDIRECT":io(ho),fo();break;default:oo("Declined: No reason supplied"),fo();break}}catch(ho){throw console.error("execIframeRPC onResponse error",ho),ho}},onMessage(co,lo){let{close:fo}=lo;try{if(typeof co.data!="object"||co.data.jsonrpc!=="2.0"||co.data.id!==ao)return;const ho=normalizePollingResponse(co.data.result);switch(ho.status){case"APPROVED":io(ho.data),fo();break;case"DECLINED":oo(`Declined: ${ho.reason||"No reason supplied"}`),fo();break;case"REDIRECT":io(ho),fo();break;default:oo("Declined: No reason supplied"),fo();break}}catch(ho){throw console.error("execIframeRPC onMessage error",ho),ho}},onClose(){oo("Declined: Externally Halted")}})})}const noop$2=()=>{};function pop(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$2,close:noop$2};const to=eo.onClose||noop$2,ro=eo.onMessage||noop$2,no=eo.onReady||noop$2,io=eo.onResponse||noop$2,oo=buildMessageHandler({close:lo,send:fo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderPop(serviceEndpoint(Xr)),co=setInterval(function(){ao&&ao.closed&&lo()},500);return{send:fo,close:lo};function lo(){try{window.removeEventListener("message",oo),clearInterval(co),so(),to()}catch(ho){console.error("Popup Close Error",ho)}}function fo(ho){try{ao.postMessage(JSON.parse(JSON.stringify(ho||{})),"*")}catch(go){console.error("Popup Send Error",ho,go)}}}function execPopRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),{redir:so,includeOlderJsonRpcCall:co}=no;pop(eo,{async onReady(lo,fo){let{send:ho}=fo;try{ho({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),ho({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),co&&ho({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params]})}catch(go){throw go}},onResponse(lo,fo){let{close:ho}=fo;try{if(typeof lo.data!="object")return;const go=normalizePollingResponse(lo.data);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onResponse error",go),go}},onMessage(lo,fo){let{close:ho}=fo;try{if(typeof lo.data!="object"||lo.data.jsonrpc!=="2.0"||lo.data.id!==ao)return;const go=normalizePollingResponse(lo.data.result);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onMessage error",go),go}},onClose(){oo("Declined: Externally Halted")}})})}const noop$1=()=>{};function tab(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$1,close:noop$1};const to=eo.onClose||noop$1,ro=eo.onMessage||noop$1,no=eo.onReady||noop$1,io=eo.onResponse||noop$1,oo=buildMessageHandler({close:lo,send:fo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderTab(serviceEndpoint(Xr)),co=setInterval(function(){ao&&ao.closed&&lo()},500);return{send:fo,close:lo};function lo(){try{window.removeEventListener("message",oo),clearInterval(co),so(),to()}catch(ho){console.error("Tab Close Error",ho)}}function fo(ho){try{ao.postMessage(JSON.parse(JSON.stringify(ho||{})),"*")}catch(go){console.error("Tab Send Error",ho,go)}}}function execTabRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),{redir:so,includeOlderJsonRpcCall:co}=no;tab(eo,{async onReady(lo,fo){let{send:ho}=fo;try{ho({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),ho({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),co&&ho({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params]})}catch(go){throw go}},onResponse(lo,fo){let{close:ho}=fo;try{if(typeof lo.data!="object")return;const go=normalizePollingResponse(lo.data);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onResponse error",go),go}},onMessage(lo,fo){let{close:ho}=fo;try{if(typeof lo.data!="object"||lo.data.jsonrpc!=="2.0"||lo.data.id!==ao)return;const go=normalizePollingResponse(lo.data.result);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onMessage error",go),go}},onClose(){oo("Declined: Externally Halted")}})})}const noop=()=>{};function extension(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop,close:noop};const to=eo.onClose||noop,ro=eo.onMessage||noop,no=eo.onReady||noop,io=eo.onResponse||noop,oo=buildMessageHandler({close:ao,send:so,onReady:no,onResponse:io,onMessage:ro});return window.addEventListener("message",oo),so({service:Xr}),{send:so,close:ao};function ao(){try{window.removeEventListener("message",oo),to()}catch(co){console.error("Ext Close Error",co)}}function so(co){try{window&&window.postMessage(JSON.parse(JSON.stringify(co||{})),"*")}catch(lo){console.error("Ext Send Error",co,lo)}}}function execExtRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{extension(eo,{async onReady(ao,so){let{send:co}=so;try{co({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro})}catch(lo){throw lo}},onResponse(ao,so){let{close:co}=so;try{if(typeof ao.data!="object")return;const lo=normalizePollingResponse(ao.data);switch(lo.status){case"APPROVED":io(lo.data),co();break;case"DECLINED":oo(`Declined: ${lo.reason||"No reason supplied"}`),co();break;case"REDIRECT":io(lo),co();break;default:oo("Declined: No reason supplied"),co();break}}catch(lo){throw console.error("execExtRPC onResponse error",lo),lo}},onClose(){oo("Declined: Externally Halted")}})})}const NOT_IMPLEMENTED=()=>{throw new Error("Strategy util has not been implemented on this platform")},VIEWS={"VIEW/IFRAME":renderFrame,"VIEW/POP":renderPop,"VIEW/TAB":renderTab,"VIEW/MOBILE_BROWSER":NOT_IMPLEMENTED,"VIEW/DEEPLINK":NOT_IMPLEMENTED};async function execLocal(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{serviceEndpoint:()=>{}};const{serviceEndpoint:to}=eo;try{return VIEWS[Xr.method](to(Xr),eo)}catch(ro){throw console.error("execLocal({service, opts = {}})",ro,{service:Xr,opts:eo}),ro}}const coreStrategies={[CORE_STRATEGIES["HTTP/RPC"]]:getExecHttpPost(execLocal),[CORE_STRATEGIES["HTTP/POST"]]:getExecHttpPost(execLocal),[CORE_STRATEGIES["IFRAME/RPC"]]:execIframeRPC,[CORE_STRATEGIES["POP/RPC"]]:execPopRPC,[CORE_STRATEGIES["TAB/RPC"]]:execTabRPC,[CORE_STRATEGIES["EXT/RPC"]]:execExtRPC},currentUser=getCurrentUser({platform:"web"});config(getDefaultConfig());initServiceRegistry({coreStrategies});class FlowWallet extends Wallet$1{}class FlowWalletConnector extends WalletConnectorBase{constructor(eo){var to;super(eo),this.ChainWallet=FlowWallet,this.connectedChain="FLOW",this.supportedChains=["FLOW"],this.appName=eo.appName,this.appLogoUrl=eo.appLogoUrl,this.network=(to=eo.flowNetwork)!==null&&to!==void 0?to:"mainnet"}connect(){return __awaiter$6(this,void 0,void 0,function*(){yield this.setupConfig();const{addr:eo}=yield currentUser().authenticate();eo&&eo!==this.currentAccount&&(this.currentAccount=eo,this.emit("accountChange",{accounts:[eo]}))})}getNetwork(){return __awaiter$6(this,void 0,void 0,function*(){return this.network})}setupConfig(){return __awaiter$6(this,void 0,void 0,function*(){yield config().put("app.detail.title",this.appName).put("app.detail.icon",this.appLogoUrl).put("accessNode.api",this.network==="testnet"?"https://rest-testnet.onflow.org":"https://rest-mainnet.onflow.org").put("flow.network",this.network)})}getAddress(){return __awaiter$6(this,void 0,void 0,function*(){try{return yield this.connect(),(yield currentUser().snapshot()).addr}catch(eo){logger$9.error(eo);return}})}proveOwnership(eo,to){return __awaiter$6(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);try{yield this.connect(),yield this.signDelay();const ro=yield this.signMessage(to);if(!ro)return;const no={appName:this.appName,signedMessage:JSON.parse(ro)};return JSON.stringify(no)}catch(ro){logger$9.error(ro);return}})}signMessage(eo){return __awaiter$6(this,void 0,void 0,function*(){const to=Buffer$3.from(eo).toString("hex"),ro=yield currentUser().signUserMessage(to);if(ro.includes("Declined"))throw new DynamicError("User declined the signature");return JSON.stringify(ro)})}getBalance(eo){return __awaiter$6(this,void 0,void 0,function*(){if(yield this.setupConfig(),eo){const to=` +`;function renderFrame(Xr){invariant$1(!document.getElementById(FRAME),"Attempt at triggering multiple Frames",{src:Xr});const eo=document.createElement("iframe");eo.src=Xr,eo.id=FRAME,eo.allow="usb *; hid *",eo.frameBorder="0",eo.style.cssText=FRAME_STYLES,document.body.append(eo);const to=()=>{document.getElementById(FRAME)&&document.getElementById(FRAME).remove()};return[eo.contentWindow,to]}const POP="FCL_POP";let popup=null,previousUrl$1=null;function popupWindow(Xr,eo,to,ro,no){const io=to.top.outerHeight/2+to.top.screenY-no/2,oo=to.top.outerWidth/2+to.top.screenX-ro/2,ao=to.open(Xr,eo,`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${ro}, height=${no}, top=${io}, left=${oo}`);if(!ao)throw new Error("Popup failed to open (was it blocked by a popup blocker?)");return ao}function renderPop(Xr){return popup==null||popup!=null&&popup.closed?popup=popupWindow(Xr,POP,window,640,770):(previousUrl$1!==Xr&&popup.location.replace(Xr),popup.focus()),previousUrl$1=Xr,[popup,()=>{popup&&!popup.closed&&popup.close(),popup=null}]}let tab$1=null,previousUrl=null;function renderTab(Xr){if(tab$1==null||tab$1!=null&&tab$1.closed){if(tab$1=window.open(Xr,"_blank"),!tab$1)throw new Error("Tab failed to open (was it blocked by the browser?)")}else previousUrl!==Xr&&tab$1.location.replace(Xr),tab$1.focus();return previousUrl=Xr,[tab$1,()=>{tab$1&&!tab$1.closed&&tab$1.close(),tab$1=null}]}const isServerSide=()=>typeof window>"u",getSessionStorage=()=>{try{return{can:!isServerSide(),get:async eo=>JSON.parse(sessionStorage.getItem(eo)),put:async(eo,to)=>sessionStorage.setItem(eo,JSON.stringify(to))}}catch{return null}},getDefaultConfig=()=>({"discovery.wallet.method.default":"IFRAME/RPC","fcl.storage.default":getSessionStorage()}),noop$3=()=>{};function frame(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$3,close:noop$3};const to=eo.onClose||noop$3,ro=eo.onMessage||noop$3,no=eo.onReady||noop$3,io=eo.onResponse||noop$3,oo=buildMessageHandler({close:co,send:lo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderFrame(serviceEndpoint(Xr));return{send:lo,close:co};function co(){try{window.removeEventListener("message",oo),so(),to()}catch(uo){console.error("Frame Close Error",uo)}}function lo(uo){try{ao.postMessage(JSON.parse(JSON.stringify(uo||{})),"*")}catch(ho){console.error("Frame Send Error",uo,ho)}}}const VERSION$1="1.10.0";function execIframeRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),so=no.includeOlderJsonRpcCall;frame(eo,{async onReady(co,lo){let{send:uo}=lo;try{uo({type:"FCL:VIEW:READY:RESPONSE",fclVersion:VERSION$1,body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),uo({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),so&&uo({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params],deprecated:{message:"jsonrpc is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}})}catch(ho){throw ho}},onResponse(co,lo){let{close:uo}=lo;try{if(typeof co.data!="object")return;const ho=normalizePollingResponse(co.data);switch(ho.status){case"APPROVED":io(ho.data),uo();break;case"DECLINED":oo(`Declined: ${ho.reason||"No reason supplied"}`),uo();break;case"REDIRECT":io(ho),uo();break;default:oo("Declined: No reason supplied"),uo();break}}catch(ho){throw console.error("execIframeRPC onResponse error",ho),ho}},onMessage(co,lo){let{close:uo}=lo;try{if(typeof co.data!="object"||co.data.jsonrpc!=="2.0"||co.data.id!==ao)return;const ho=normalizePollingResponse(co.data.result);switch(ho.status){case"APPROVED":io(ho.data),uo();break;case"DECLINED":oo(`Declined: ${ho.reason||"No reason supplied"}`),uo();break;case"REDIRECT":io(ho),uo();break;default:oo("Declined: No reason supplied"),uo();break}}catch(ho){throw console.error("execIframeRPC onMessage error",ho),ho}},onClose(){oo("Declined: Externally Halted")}})})}const noop$2=()=>{};function pop(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$2,close:noop$2};const to=eo.onClose||noop$2,ro=eo.onMessage||noop$2,no=eo.onReady||noop$2,io=eo.onResponse||noop$2,oo=buildMessageHandler({close:lo,send:uo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderPop(serviceEndpoint(Xr)),co=setInterval(function(){ao&&ao.closed&&lo()},500);return{send:uo,close:lo};function lo(){try{window.removeEventListener("message",oo),clearInterval(co),so(),to()}catch(ho){console.error("Popup Close Error",ho)}}function uo(ho){try{ao.postMessage(JSON.parse(JSON.stringify(ho||{})),"*")}catch(go){console.error("Popup Send Error",ho,go)}}}function execPopRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),{redir:so,includeOlderJsonRpcCall:co}=no;pop(eo,{async onReady(lo,uo){let{send:ho}=uo;try{ho({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),ho({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),co&&ho({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params]})}catch(go){throw go}},onResponse(lo,uo){let{close:ho}=uo;try{if(typeof lo.data!="object")return;const go=normalizePollingResponse(lo.data);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onResponse error",go),go}},onMessage(lo,uo){let{close:ho}=uo;try{if(typeof lo.data!="object"||lo.data.jsonrpc!=="2.0"||lo.data.id!==ao)return;const go=normalizePollingResponse(lo.data.result);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onMessage error",go),go}},onClose(){oo("Declined: Externally Halted")}})})}const noop$1=()=>{};function tab(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop$1,close:noop$1};const to=eo.onClose||noop$1,ro=eo.onMessage||noop$1,no=eo.onReady||noop$1,io=eo.onResponse||noop$1,oo=buildMessageHandler({close:lo,send:uo,onReady:no,onResponse:io,onMessage:ro});window.addEventListener("message",oo);const[ao,so]=renderTab(serviceEndpoint(Xr)),co=setInterval(function(){ao&&ao.closed&&lo()},500);return{send:uo,close:lo};function lo(){try{window.removeEventListener("message",oo),clearInterval(co),so(),to()}catch(ho){console.error("Tab Close Error",ho)}}function uo(ho){try{ao.postMessage(JSON.parse(JSON.stringify(ho||{})),"*")}catch(go){console.error("Tab Send Error",ho,go)}}}function execTabRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{const ao=uid(),{redir:so,includeOlderJsonRpcCall:co}=no;tab(eo,{async onReady(lo,uo){let{send:ho}=uo;try{ho({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro}),ho({fclVersion:VERSION$1,type:"FCL:FRAME:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),co&&ho({jsonrpc:"2.0",id:ao,method:"fcl:sign",params:[to,eo.params]})}catch(go){throw go}},onResponse(lo,uo){let{close:ho}=uo;try{if(typeof lo.data!="object")return;const go=normalizePollingResponse(lo.data);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onResponse error",go),go}},onMessage(lo,uo){let{close:ho}=uo;try{if(typeof lo.data!="object"||lo.data.jsonrpc!=="2.0"||lo.data.id!==ao)return;const go=normalizePollingResponse(lo.data.result);switch(go.status){case"APPROVED":io(go.data),!so&&ho();break;case"DECLINED":oo(`Declined: ${go.reason||"No reason supplied"}`),ho();break;case"REDIRECT":io(go),ho();break;default:oo("Declined: No reason supplied"),ho();break}}catch(go){throw console.error("execPopRPC onMessage error",go),go}},onClose(){oo("Declined: Externally Halted")}})})}const noop=()=>{};function extension(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Xr==null)return{send:noop,close:noop};const to=eo.onClose||noop,ro=eo.onMessage||noop,no=eo.onReady||noop,io=eo.onResponse||noop,oo=buildMessageHandler({close:ao,send:so,onReady:no,onResponse:io,onMessage:ro});return window.addEventListener("message",oo),so({service:Xr}),{send:so,close:ao};function ao(){try{window.removeEventListener("message",oo),to()}catch(co){console.error("Ext Close Error",co)}}function so(co){try{window&&window.postMessage(JSON.parse(JSON.stringify(co||{})),"*")}catch(lo){console.error("Ext Send Error",co,lo)}}}function execExtRPC(Xr){let{service:eo,body:to,config:ro,opts:no}=Xr;return new Promise((io,oo)=>{extension(eo,{async onReady(ao,so){let{send:co}=so;try{co({fclVersion:VERSION$1,type:"FCL:VIEW:READY:RESPONSE",body:to,service:{params:eo.params,data:eo.data,type:eo.type},config:ro})}catch(lo){throw lo}},onResponse(ao,so){let{close:co}=so;try{if(typeof ao.data!="object")return;const lo=normalizePollingResponse(ao.data);switch(lo.status){case"APPROVED":io(lo.data),co();break;case"DECLINED":oo(`Declined: ${lo.reason||"No reason supplied"}`),co();break;case"REDIRECT":io(lo),co();break;default:oo("Declined: No reason supplied"),co();break}}catch(lo){throw console.error("execExtRPC onResponse error",lo),lo}},onClose(){oo("Declined: Externally Halted")}})})}const NOT_IMPLEMENTED=()=>{throw new Error("Strategy util has not been implemented on this platform")},VIEWS={"VIEW/IFRAME":renderFrame,"VIEW/POP":renderPop,"VIEW/TAB":renderTab,"VIEW/MOBILE_BROWSER":NOT_IMPLEMENTED,"VIEW/DEEPLINK":NOT_IMPLEMENTED};async function execLocal(Xr){let eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{serviceEndpoint:()=>{}};const{serviceEndpoint:to}=eo;try{return VIEWS[Xr.method](to(Xr),eo)}catch(ro){throw console.error("execLocal({service, opts = {}})",ro,{service:Xr,opts:eo}),ro}}const coreStrategies={[CORE_STRATEGIES["HTTP/RPC"]]:getExecHttpPost(execLocal),[CORE_STRATEGIES["HTTP/POST"]]:getExecHttpPost(execLocal),[CORE_STRATEGIES["IFRAME/RPC"]]:execIframeRPC,[CORE_STRATEGIES["POP/RPC"]]:execPopRPC,[CORE_STRATEGIES["TAB/RPC"]]:execTabRPC,[CORE_STRATEGIES["EXT/RPC"]]:execExtRPC},currentUser=getCurrentUser({platform:"web"});config(getDefaultConfig());initServiceRegistry({coreStrategies});class FlowWallet extends Wallet$1{}class FlowWalletConnector extends WalletConnectorBase{constructor(eo){var to;super(eo),this.ChainWallet=FlowWallet,this.connectedChain="FLOW",this.supportedChains=["FLOW"],this.appName=eo.appName,this.appLogoUrl=eo.appLogoUrl,this.network=(to=eo.flowNetwork)!==null&&to!==void 0?to:"mainnet"}connect(){return __awaiter$6(this,void 0,void 0,function*(){yield this.setupConfig();const{addr:eo}=yield currentUser().authenticate();eo&&eo!==this.currentAccount&&(this.currentAccount=eo,this.emit("accountChange",{accounts:[eo]}))})}getNetwork(){return __awaiter$6(this,void 0,void 0,function*(){return this.network})}setupConfig(){return __awaiter$6(this,void 0,void 0,function*(){yield config().put("app.detail.title",this.appName).put("app.detail.icon",this.appLogoUrl).put("accessNode.api",this.network==="testnet"?"https://rest-testnet.onflow.org":"https://rest-mainnet.onflow.org").put("flow.network",this.network)})}getAddress(){return __awaiter$6(this,void 0,void 0,function*(){try{return yield this.connect(),(yield currentUser().snapshot()).addr}catch(eo){logger$9.error(eo);return}})}proveOwnership(eo,to){return __awaiter$6(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);try{yield this.connect(),yield this.signDelay();const ro=yield this.signMessage(to);if(!ro)return;const no={appName:this.appName,signedMessage:JSON.parse(ro)};return JSON.stringify(no)}catch(ro){logger$9.error(ro);return}})}signMessage(eo){return __awaiter$6(this,void 0,void 0,function*(){const to=Buffer$3.from(eo).toString("hex"),ro=yield currentUser().signUserMessage(to);if(ro.includes("Declined"))throw new DynamicError("User declined the signature");return JSON.stringify(ro)})}getBalance(eo){return __awaiter$6(this,void 0,void 0,function*(){if(yield this.setupConfig(),eo){const to=` pub fun main(): UFix64 { let account = getAccount(${eo}); return account.balance; } - `;try{return yield send([script(to)]).then(decode$2)}catch(ro){logger$9.error(ro);return}}else return})}endSession(){return __awaiter$6(this,void 0,void 0,function*(){currentUser().unauthenticate()})}switchNetwork(){return __awaiter$6(this,void 0,void 0,function*(){throw new DynamicError("Not supported")})}getConnectedAccounts(){return __awaiter$6(this,void 0,void 0,function*(){const eo=yield currentUser().snapshot();return eo.addr?[eo.addr]:[]})}signDelay(){return __awaiter$6(this,void 0,void 0,function*(){return Promise.resolve()})}}class Blocto extends FlowWalletConnector{constructor(){super(...arguments),this.name="Blocto",this.overrideKey="blocto",this.canConnectViaCustodialService=!0}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),yield config().put("challenge.scope","email").put("discovery.wallet",this.network==="testnet"?"https://wallet-v2-dev.blocto.app/api/flow/authn":"https://wallet-v2.blocto.app/api/flow/authn").put("service.OpenID.scopes","email!").put("discovery.wallet.method","HTTP/POST")})}}class Dapper extends FlowWalletConnector{constructor(){super(...arguments),this.name="Dapper",this.overrideKey="dapper",this.canConnectViaCustodialService=!0}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),yield config().put("challenge.scope",void 0).put("discovery.wallet",this.network==="testnet"?"https://staging.accounts.meetdapper.com/fcl/authn-restricted":"https://accounts.meetdapper.com/fcl/authn-restricted").put("service.OpenID.scopes",void 0).put("discovery.wallet.method","POP/RPC")})}}class Lilico extends FlowWalletConnector{constructor(){super(...arguments),this.name="Lilico",this.overrideKey="lilico"}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),config().put("challenge.scope",void 0).put("discovery.wallet","chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html").put("service.OpenID.scopes",void 0).put("discovery.wallet.method","EXT/RPC")})}isInstalledOnBrowser(){var eo;return typeof window>"u"?!1:!!(!((eo=window.fcl_extensions)===null||eo===void 0)&&eo.some(to=>to.id==="hpclkefagolihohboafpheddmmgdffjm"))}signDelay(){return __awaiter$6(this,void 0,void 0,function*(){return isMobile$1()?Promise.resolve():new Promise(eo=>{setTimeout(()=>{eo()},500)})})}}assertPackageVersion("@dynamic-labs/flow",version$a);const FlowWalletConnectors=Xr=>[Blocto,Dapper,Lilico];var version$9="3.4.4",dependencies={"@dynamic-labs/sdk-api-core":"0.0.547","@dynamic-labs/utils":"3.4.4","@dynamic-labs/logger":"3.4.4","@dynamic-labs/types":"3.4.4",eventemitter3:"5.0.1","@solana/spl-token":"0.4.6","@solana/web3.js":"1.92.1","@turnkey/http":"2.12.2","@turnkey/iframe-stamper":"2.0.0","@turnkey/solana":"0.3.9","@turnkey/webauthn-stamper":"0.5.0"};function __rest$1(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{try{return{isValid:!0,value:to.sqrt(bo*to.inv(_o))}}catch{return{isValid:!1,value:_0n$9}}}),go=eo.adjustScalarBytes||(bo=>bo),yo=eo.domain||((bo,_o,$o)=>{if(abool("phflag",$o),_o.length||$o)throw new Error("Contexts/pre-hash are not supported");return bo});function vo(bo,_o){aInRange("coordinate "+bo,_o,_0n$9,co)}function wo(bo){if(!(bo instanceof Ao))throw new Error("ExtendedPoint expected")}const Eo=memoized((bo,_o)=>{const{ex:$o,ey:Co,ez:Ro}=bo,So=bo.is0();_o==null&&(_o=So?_8n$2:to.inv(Ro));const mo=lo($o*_o),To=lo(Co*_o),Vo=lo(Ro*_o);if(So)return{x:_0n$9,y:_1n$a};if(Vo!==_1n$a)throw new Error("invZ was invalid");return{x:mo,y:To}}),ko=memoized(bo=>{const{a:_o,d:$o}=eo;if(bo.is0())throw new Error("bad point: ZERO");const{ex:Co,ey:Ro,ez:So,et:mo}=bo,To=lo(Co*Co),Vo=lo(Ro*Ro),Zo=lo(So*So),Qo=lo(Zo*Zo),qo=lo(To*_o),Ho=lo(Zo*lo(qo+Vo)),$a=lo(Qo+lo($o*lo(To*Vo)));if(Ho!==$a)throw new Error("bad point: equation left != right (1)");const zo=lo(Co*Ro),Ko=lo(So*mo);if(zo!==Ko)throw new Error("bad point: equation left != right (2)");return!0});class Ao{constructor(_o,$o,Co,Ro){this.ex=_o,this.ey=$o,this.ez=Co,this.et=Ro,vo("x",_o),vo("y",$o),vo("z",Co),vo("t",Ro),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(_o){if(_o instanceof Ao)throw new Error("extended point not allowed");const{x:$o,y:Co}=_o||{};return vo("x",$o),vo("y",Co),new Ao($o,Co,_1n$a,lo($o*Co))}static normalizeZ(_o){const $o=to.invertBatch(_o.map(Co=>Co.ez));return _o.map((Co,Ro)=>Co.toAffine($o[Ro])).map(Ao.fromAffine)}static msm(_o,$o){return pippenger(Ao,fo,_o,$o)}_setWindowSize(_o){Mo.setWindowSize(this,_o)}assertValidity(){ko(this)}equals(_o){wo(_o);const{ex:$o,ey:Co,ez:Ro}=this,{ex:So,ey:mo,ez:To}=_o,Vo=lo($o*To),Zo=lo(So*Ro),Qo=lo(Co*To),qo=lo(mo*Ro);return Vo===Zo&&Qo===qo}is0(){return this.equals(Ao.ZERO)}negate(){return new Ao(lo(-this.ex),this.ey,this.ez,lo(-this.et))}double(){const{a:_o}=eo,{ex:$o,ey:Co,ez:Ro}=this,So=lo($o*$o),mo=lo(Co*Co),To=lo(_2n$6*lo(Ro*Ro)),Vo=lo(_o*So),Zo=$o+Co,Qo=lo(lo(Zo*Zo)-So-mo),qo=Vo+mo,Ho=qo-To,$a=Vo-mo,zo=lo(Qo*Ho),Ko=lo(qo*$a),_c=lo(Qo*$a),Cl=lo(Ho*qo);return new Ao(zo,Ko,Cl,_c)}add(_o){wo(_o);const{a:$o,d:Co}=eo,{ex:Ro,ey:So,ez:mo,et:To}=this,{ex:Vo,ey:Zo,ez:Qo,et:qo}=_o;if($o===BigInt(-1)){const Tl=lo((So-Ro)*(Zo+Vo)),Ml=lo((So+Ro)*(Zo-Vo)),ou=lo(Ml-Tl);if(ou===_0n$9)return this.double();const Vl=lo(mo*_2n$6*qo),Ll=lo(To*_2n$6*Qo),uu=Ll+Vl,ru=Ml+Tl,tu=Ll-Vl,ku=lo(uu*ou),au=lo(ru*tu),wl=lo(uu*tu),Jo=lo(ou*ru);return new Ao(ku,au,Jo,wl)}const Ho=lo(Ro*Vo),$a=lo(So*Zo),zo=lo(To*Co*qo),Ko=lo(mo*Qo),_c=lo((Ro+So)*(Vo+Zo)-Ho-$a),Cl=Ko-zo,ga=Ko+zo,El=lo($a-$o*Ho),Al=lo(_c*Cl),Ol=lo(ga*El),Wl=lo(_c*El),zl=lo(Cl*ga);return new Ao(Al,Ol,zl,Wl)}subtract(_o){return this.add(_o.negate())}wNAF(_o){return Mo.wNAFCached(this,_o,Ao.normalizeZ)}multiply(_o){const $o=_o;aInRange("scalar",$o,_1n$a,ro);const{p:Co,f:Ro}=this.wNAF($o);return Ao.normalizeZ([Co,Ro])[0]}multiplyUnsafe(_o){const $o=_o;return aInRange("scalar",$o,_0n$9,ro),$o===_0n$9?jo:this.equals(jo)||$o===_1n$a?this:this.equals(Po)?this.wNAF($o).p:Mo.unsafeLadder(this,$o)}isSmallOrder(){return this.multiplyUnsafe(so).is0()}isTorsionFree(){return Mo.unsafeLadder(this,ro).is0()}toAffine(_o){return Eo(this,_o)}clearCofactor(){const{h:_o}=eo;return _o===_1n$a?this:this.multiplyUnsafe(_o)}static fromHex(_o,$o=!1){const{d:Co,a:Ro}=eo,So=to.BYTES;_o=ensureBytes$3("pointHex",_o,So),abool("zip215",$o);const mo=_o.slice(),To=_o[So-1];mo[So-1]=To&-129;const Vo=bytesToNumberLE$2(mo),Zo=$o?co:to.ORDER;aInRange("pointHex.y",Vo,_0n$9,Zo);const Qo=lo(Vo*Vo),qo=lo(Qo-_1n$a),Ho=lo(Co*Qo-Ro);let{isValid:$a,value:zo}=ho(qo,Ho);if(!$a)throw new Error("Point.fromHex: invalid y coordinate");const Ko=(zo&_1n$a)===_1n$a,_c=(To&128)!==0;if(!$o&&zo===_0n$9&&_c)throw new Error("Point.fromHex: x=0 and x_0=1");return _c!==Ko&&(zo=lo(-zo)),Ao.fromAffine({x:zo,y:Vo})}static fromPrivateKey(_o){return Fo(_o).point}toRawBytes(){const{x:_o,y:$o}=this.toAffine(),Co=numberToBytesLE$2($o,to.BYTES);return Co[Co.length-1]|=_o&_1n$a?128:0,Co}toHex(){return bytesToHex$3(this.toRawBytes())}}Ao.BASE=new Ao(eo.Gx,eo.Gy,_1n$a,lo(eo.Gx*eo.Gy)),Ao.ZERO=new Ao(_0n$9,_1n$a,_1n$a,_0n$9);const{BASE:Po,ZERO:jo}=Ao,Mo=wNAF$2(Ao,ao*8);function No(bo){return mod$2(bo,ro)}function Do(bo){return No(bytesToNumberLE$2(bo))}function Fo(bo){const _o=ao;bo=ensureBytes$3("private key",bo,_o);const $o=ensureBytes$3("hashed private key",io(bo),2*_o),Co=go($o.slice(0,_o)),Ro=$o.slice(_o,2*_o),So=Do(Co),mo=Po.multiply(So),To=mo.toRawBytes();return{head:Co,prefix:Ro,scalar:So,point:mo,pointBytes:To}}function Xo(bo){return Fo(bo).pointBytes}function Lo(bo=new Uint8Array,..._o){const $o=concatBytes$4(..._o);return Do(io(yo($o,ensureBytes$3("context",bo),!!no)))}function Bo(bo,_o,$o={}){bo=ensureBytes$3("message",bo),no&&(bo=no(bo));const{prefix:Co,scalar:Ro,pointBytes:So}=Fo(_o),mo=Lo($o.context,Co,bo),To=Po.multiply(mo).toRawBytes(),Vo=Lo($o.context,To,So,bo),Zo=No(mo+Vo*Ro);aInRange("signature.s",Zo,_0n$9,ro);const Qo=concatBytes$4(To,numberToBytesLE$2(Zo,to.BYTES));return ensureBytes$3("result",Qo,ao*2)}const xo=VERIFY_DEFAULT;function uo(bo,_o,$o,Co=xo){const{context:Ro,zip215:So}=Co,mo=to.BYTES;bo=ensureBytes$3("signature",bo,2*mo),_o=ensureBytes$3("message",_o),So!==void 0&&abool("zip215",So),no&&(_o=no(_o));const To=bytesToNumberLE$2(bo.slice(mo,2*mo));let Vo,Zo,Qo;try{Vo=Ao.fromHex($o,So),Zo=Ao.fromHex(bo.slice(0,mo),So),Qo=Po.multiplyUnsafe(To)}catch{return!1}if(!So&&Vo.isSmallOrder())return!1;const qo=Lo(Ro,Zo.toRawBytes(),Vo.toRawBytes(),_o);return Zo.add(Vo.multiplyUnsafe(qo)).subtract(Qo).clearCofactor().equals(Ao.ZERO)}return Po._setWindowSize(8),{CURVE:eo,getPublicKey:Xo,sign:Bo,verify:uo,ExtendedPoint:Ao,utils:{getExtendedPublicKey:Fo,randomPrivateKey:()=>oo(to.BYTES),precompute(bo=8,_o=Ao.BASE){return _o._setWindowSize(bo),_o.multiply(BigInt(3)),_o}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$9=BigInt(1),_2n$5=BigInt(2);BigInt(3);const _5n$1=BigInt(5),_8n$1=BigInt(8);function ed25519_pow_2_252_3(Xr){const eo=BigInt(10),to=BigInt(20),ro=BigInt(40),no=BigInt(80),io=ED25519_P,ao=Xr*Xr%io*Xr%io,so=pow2(ao,_2n$5,io)*ao%io,co=pow2(so,_1n$9,io)*Xr%io,lo=pow2(co,_5n$1,io)*co%io,fo=pow2(lo,eo,io)*lo%io,ho=pow2(fo,to,io)*fo%io,go=pow2(ho,ro,io)*ho%io,yo=pow2(go,no,io)*go%io,vo=pow2(yo,no,io)*go%io,wo=pow2(vo,eo,io)*lo%io;return{pow_p_5_8:pow2(wo,_2n$5,io)*Xr%io,b2:ao}}function adjustScalarBytes(Xr){return Xr[0]&=248,Xr[31]&=127,Xr[31]|=64,Xr}function uvRatio(Xr,eo){const to=ED25519_P,ro=mod$2(eo*eo*eo,to),no=mod$2(ro*ro*eo,to),io=ed25519_pow_2_252_3(Xr*no).pow_p_5_8;let oo=mod$2(Xr*ro*io,to);const ao=mod$2(eo*oo*oo,to),so=oo,co=mod$2(oo*ED25519_SQRT_M1,to),lo=ao===Xr,fo=ao===mod$2(-Xr,to),ho=ao===mod$2(-Xr*ED25519_SQRT_M1,to);return lo&&(oo=so),(fo||ho)&&(oo=co),isNegativeLE(oo,to)&&(oo=mod$2(-oo,to)),{isValid:lo||fo,value:oo}}const Fp=Field$2(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n$1,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512$3,randomBytes:randomBytes$1,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var bn$4={exports:{}};bn$4.exports;(function(Xr){(function(eo,to){function ro(xo,uo){if(!xo)throw new Error(uo||"Assertion failed")}function no(xo,uo){xo.super_=uo;var po=function(){};po.prototype=uo.prototype,xo.prototype=new po,xo.prototype.constructor=xo}function io(xo,uo,po){if(io.isBN(xo))return xo;this.negative=0,this.words=null,this.length=0,this.red=null,xo!==null&&((uo==="le"||uo==="be")&&(po=uo,uo=10),this._init(xo||0,uo||10,po||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(uo){return uo instanceof io?!0:uo!==null&&typeof uo=="object"&&uo.constructor.wordSize===io.wordSize&&Array.isArray(uo.words)},io.max=function(uo,po){return uo.cmp(po)>0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)})(bn$4);var bnExports$3=bn$4.exports;const BN$2=getDefaultExportFromCjs$2(bnExports$3);var _Buffer=safeBufferExports.Buffer;function base(Xr){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var eo=new Uint8Array(256),to=0;to>>0,Ao=new Uint8Array(ko);wo!==Eo;){for(var Po=go[wo],jo=0,Mo=ko-1;(Po!==0||jo>>0,Ao[Mo]=Po%oo>>>0,Po=Po/oo>>>0;if(Po!==0)throw new Error("Non-zero carry");vo=jo,wo++}for(var No=ko-vo;No!==ko&&Ao[No]===0;)No++;for(var Do=ao.repeat(yo);No>>0,ko=new Uint8Array(Eo);yo>>0,ko[jo]=Ao%256>>>0,Ao=Ao/256>>>0;if(Ao!==0)throw new Error("Non-zero carry");wo=Po,yo++}for(var Mo=Eo-wo;Mo!==Eo&&ko[Mo]===0;)Mo++;var No=_Buffer.allocUnsafe(vo+(Eo-Mo));No.fill(0,0,vo);for(var Do=vo;Mo!==Eo;)No[Do++]=ko[Mo++];return No}function ho(go){var yo=fo(go);if(yo)return yo;throw new Error("Non-base"+oo+" character")}return{encode:lo,decodeUnsafe:fo,decode:ho}}var src=base,basex$1=src,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex$1(ALPHABET$1);const bs58$3=getDefaultExportFromCjs$2(bs58$2);var lib={},bn$3={exports:{}};bn$3.exports;(function(Xr){(function(eo,to){function ro(xo,uo){if(!xo)throw new Error(uo||"Assertion failed")}function no(xo,uo){xo.super_=uo;var po=function(){};po.prototype=uo.prototype,xo.prototype=new po,xo.prototype.constructor=xo}function io(xo,uo,po){if(io.isBN(xo))return xo;this.negative=0,this.words=null,this.length=0,this.red=null,xo!==null&&((uo==="le"||uo==="be")&&(po=uo,uo=10),this._init(xo||0,uo||10,po||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(uo){return uo instanceof io?!0:uo!==null&&typeof uo=="object"&&uo.constructor.wordSize===io.wordSize&&Array.isArray(uo.words)},io.max=function(uo,po){return uo.cmp(po)>0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)})(bn$3);var bnExports$2=bn$3.exports;function inRange(Xr,eo,to){return eo<=Xr&&Xr<=to}function ToDictionary(Xr){if(Xr===void 0)return{};if(Xr===Object(Xr))return Xr;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(Xr){for(var eo=String(Xr),to=eo.length,ro=0,no=[];ro57343)no.push(io);else if(56320<=io&&io<=57343)no.push(65533);else if(55296<=io&&io<=56319)if(ro===to-1)no.push(65533);else{var oo=Xr.charCodeAt(ro+1);if(56320<=oo&&oo<=57343){var ao=io&1023,so=oo&1023;no.push(65536+(ao<<10)+so),ro+=1}else no.push(65533)}ro+=1}return no}function codePointsToString(Xr){for(var eo="",to=0;to>10)+55296,(ro&1023)+56320))}return eo}var end_of_stream=-1;function Stream(Xr){this.tokens=[].slice.call(Xr)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(Xr){if(Array.isArray(Xr))for(var eo=Xr;eo.length;)this.tokens.unshift(eo.pop());else this.tokens.unshift(Xr)},push:function(Xr){if(Array.isArray(Xr))for(var eo=Xr;eo.length;)this.tokens.push(eo.shift());else this.tokens.push(Xr)}};var finished=-1;function decoderError(Xr,eo){if(Xr)throw TypeError("Decoder error");return eo||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(Xr,eo){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(Xr,eo);if(Xr=Xr!==void 0?String(Xr).toLowerCase():DEFAULT_ENCODING,Xr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");eo=ToDictionary(eo),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!eo.fatal,this._ignoreBOM=!!eo.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function Xr(eo,to){var ro;typeof eo=="object"&&eo instanceof ArrayBuffer?ro=new Uint8Array(eo):typeof eo=="object"&&"buffer"in eo&&eo.buffer instanceof ArrayBuffer?ro=new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength):ro=new Uint8Array(0),to=ToDictionary(to),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!to.stream;for(var no=new Stream(ro),io=[],oo;!no.endOfStream()&&(oo=this._decoder.handler(no,no.read()),oo!==finished);)oo!==null&&(Array.isArray(oo)?io.push.apply(io,oo):io.push(oo));if(!this._streaming){do{if(oo=this._decoder.handler(no,no.read()),oo===finished)break;oo!==null&&(Array.isArray(oo)?io.push.apply(io,oo):io.push(oo))}while(!no.endOfStream());this._decoder=null}return io.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(io[0]===65279?(this._BOMseen=!0,io.shift()):this._BOMseen=!0),codePointsToString(io)}};function TextEncoder$1(Xr,eo){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(Xr,eo);if(Xr=Xr!==void 0?String(Xr).toLowerCase():DEFAULT_ENCODING,Xr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");eo=ToDictionary(eo),this._streaming=!1,this._encoder=null,this._options={fatal:!!eo.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function Xr(eo,to){eo=eo?String(eo):"",to=ToDictionary(to),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!to.stream;for(var ro=[],no=new Stream(stringToCodePoints(eo)),io;!no.endOfStream()&&(io=this._encoder.handler(no,no.read()),io!==finished);)Array.isArray(io)?ro.push.apply(ro,io):ro.push(io);if(!this._streaming){for(;io=this._encoder.handler(no,no.read()),io!==finished;)Array.isArray(io)?ro.push.apply(ro,io):ro.push(io);this._encoder=null}return new Uint8Array(ro)}};function UTF8Decoder(Xr){var eo=Xr.fatal,to=0,ro=0,no=0,io=128,oo=191;this.handler=function(ao,so){if(so===end_of_stream&&no!==0)return no=0,decoderError(eo);if(so===end_of_stream)return finished;if(no===0){if(inRange(so,0,127))return so;if(inRange(so,194,223))no=1,to=so-192;else if(inRange(so,224,239))so===224&&(io=160),so===237&&(oo=159),no=2,to=so-224;else if(inRange(so,240,244))so===240&&(io=144),so===244&&(oo=143),no=3,to=so-240;else return decoderError(eo);return to=to<<6*no,null}if(!inRange(so,io,oo))return to=no=ro=0,io=128,oo=191,ao.prepend(so),decoderError(eo);if(io=128,oo=191,ro+=1,to+=so-128<<6*(no-ro),ro!==no)return null;var co=to;return to=no=ro=0,co}}function UTF8Encoder(Xr){Xr.fatal,this.handler=function(eo,to){if(to===end_of_stream)return finished;if(inRange(to,0,127))return to;var ro,no;inRange(to,128,2047)?(ro=1,no=192):inRange(to,2048,65535)?(ro=2,no=224):inRange(to,65536,1114111)&&(ro=3,no=240);for(var io=[(to>>6*ro)+no];ro>0;){var oo=to>>6*(ro-1);io.push(128|oo&63),ro-=1}return io}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2=getAugmentedNamespace(encoding$1);var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(Xr,eo,to,ro){ro===void 0&&(ro=to),Object.defineProperty(Xr,ro,{enumerable:!0,get:function(){return eo[to]}})}:function(Xr,eo,to,ro){ro===void 0&&(ro=to),Xr[ro]=eo[to]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(Xr,eo){Object.defineProperty(Xr,"default",{enumerable:!0,value:eo})}:function(Xr,eo){Xr.default=eo}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(Xr,eo,to,ro){var no=arguments.length,io=no<3?eo:ro===null?ro=Object.getOwnPropertyDescriptor(eo,to):ro,oo;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")io=Reflect.decorate(Xr,eo,to,ro);else for(var ao=Xr.length-1;ao>=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io},__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)to!=="default"&&Object.hasOwnProperty.call(Xr,to)&&__createBinding(eo,Xr,to);return __setModuleDefault(eo,Xr),eo},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1=__importDefault(bnExports$2),bs58_1=__importDefault(bs58$2),encoding=__importStar(require$$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(Xr){return typeof Xr=="string"&&(Xr=Buffer$3.from(Xr,"utf8")),bs58_1.default.encode(Buffer$3.from(Xr))}lib.baseEncode=baseEncode;function baseDecode(Xr){return Buffer$3.from(bs58_1.default.decode(Xr))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(eo){super(eo),this.fieldPath=[],this.originalMessage=eo}addToFieldPath(eo){this.fieldPath.splice(0,0,eo),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$3.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$3.concat([this.buf,Buffer$3.alloc(INITIAL_LENGTH)]))}writeU8(eo){this.maybeResize(),this.buf.writeUInt8(eo,this.length),this.length+=1}writeU16(eo){this.maybeResize(),this.buf.writeUInt16LE(eo,this.length),this.length+=2}writeU32(eo){this.maybeResize(),this.buf.writeUInt32LE(eo,this.length),this.length+=4}writeU64(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",8)))}writeU128(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",16)))}writeU256(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",32)))}writeU512(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",64)))}writeBuffer(eo){this.buf=Buffer$3.concat([Buffer$3.from(this.buf.subarray(0,this.length)),eo,Buffer$3.alloc(INITIAL_LENGTH)]),this.length+=eo.length}writeString(eo){this.maybeResize();const to=Buffer$3.from(eo,"utf8");this.writeU32(to.length),this.writeBuffer(to)}writeFixedArray(eo){this.writeBuffer(Buffer$3.from(eo))}writeArray(eo,to){this.maybeResize(),this.writeU32(eo.length);for(const ro of eo)this.maybeResize(),to(ro)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(Xr,eo,to){const ro=to.value;to.value=function(...no){try{return ro.apply(this,no)}catch(io){if(io instanceof RangeError){const oo=io.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(oo)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw io}}}class BinaryReader{constructor(eo){this.buf=eo,this.offset=0}readU8(){const eo=this.buf.readUInt8(this.offset);return this.offset+=1,eo}readU16(){const eo=this.buf.readUInt16LE(this.offset);return this.offset+=2,eo}readU32(){const eo=this.buf.readUInt32LE(this.offset);return this.offset+=4,eo}readU64(){const eo=this.readBuffer(8);return new bn_js_1.default(eo,"le")}readU128(){const eo=this.readBuffer(16);return new bn_js_1.default(eo,"le")}readU256(){const eo=this.readBuffer(32);return new bn_js_1.default(eo,"le")}readU512(){const eo=this.readBuffer(64);return new bn_js_1.default(eo,"le")}readBuffer(eo){if(this.offset+eo>this.buf.length)throw new BorshError(`Expected buffer length ${eo} isn't within bounds`);const to=this.buf.slice(this.offset,this.offset+eo);return this.offset+=eo,to}readString(){const eo=this.readU32(),to=this.readBuffer(eo);try{return textDecoder.decode(to)}catch(ro){throw new BorshError(`Error decoding UTF-8 string: ${ro}`)}}readFixedArray(eo){return new Uint8Array(this.readBuffer(eo))}readArray(eo){const to=this.readU32(),ro=Array();for(let no=0;no{serializeField(Xr,eo,io,ro[0],no)});else if(ro.kind!==void 0)switch(ro.kind){case"option":{to==null?no.writeU8(0):(no.writeU8(1),serializeField(Xr,eo,to,ro.type,no));break}case"map":{no.writeU32(to.size),to.forEach((io,oo)=>{serializeField(Xr,eo,oo,ro.key,no),serializeField(Xr,eo,io,ro.value,no)});break}default:throw new BorshError(`FieldType ${ro} unrecognized`)}else serializeStruct(Xr,to,no)}catch(io){throw io instanceof BorshError&&io.addToFieldPath(eo),io}}function serializeStruct(Xr,eo,to){if(typeof eo.borshSerialize=="function"){eo.borshSerialize(to);return}const ro=Xr.get(eo.constructor);if(!ro)throw new BorshError(`Class ${eo.constructor.name} is missing in schema`);if(ro.kind==="struct")ro.fields.map(([no,io])=>{serializeField(Xr,no,eo[no],io,to)});else if(ro.kind==="enum"){const no=eo[ro.field];for(let io=0;iodeserializeField(Xr,eo,to[0],ro))}if(to.kind==="option")return ro.readU8()?deserializeField(Xr,eo,to.type,ro):void 0;if(to.kind==="map"){let no=new Map;const io=ro.readU32();for(let oo=0;oo=ro.values.length)throw new BorshError(`Enum index: ${no} is out of range`);const[io,oo]=ro.values[no],ao=deserializeField(Xr,io,oo,to);return new eo({[io]:ao})}throw new BorshError(`Unexpected schema kind: ${ro.kind} for ${eo.constructor.name}`)}function deserialize(Xr,eo,to,ro=BinaryReader){const no=new ro(to),io=deserializeStruct(Xr,eo,no);if(no.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(eo){const to=Object.create(this.constructor.prototype);return Object.assign(to,this),to.property=eo,to}fromArray(eo){}}Layout$1.Layout=Layout;function nameWithProperty(Xr,eo){return eo.property?Xr+"["+eo.property+"]":Xr}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(Xr,eo){if(typeof Xr!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(Xr,"layout_"))throw new Error("Class is already bound to a layout");if(!(eo&&eo instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(eo,"boundConstructor_"))throw new Error("layout is already bound to a constructor");Xr.layout_=eo,eo.boundConstructor_=Xr,eo.makeDestinationObject=()=>new Xr,Object.defineProperty(Xr.prototype,"encode",{value(to,ro){return eo.encode(this,to,ro)},writable:!0}),Object.defineProperty(Xr,"decode",{value(to,ro){return eo.decode(to,ro)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(eo=1,to){if(!Number.isInteger(eo)||0>=eo)throw new TypeError("elementSpan must be a (positive) integer");super(-1,to),this.elementSpan=eo}isCount(){return!0}decode(eo,to=0){checkUint8Array(eo);const ro=eo.length-to;return Math.floor(ro/this.elementSpan)}encode(eo,to,ro){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(eo,to=0,ro){if(!(eo instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(to))throw new TypeError("offset must be integer or undefined");super(eo.span,ro||eo.property),this.layout=eo,this.offset=to}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(eo,to=0){return this.layout.decode(eo,to+this.offset)}encode(eo,to,ro=0){return this.layout.encode(eo,to,ro+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(eo,to){if(super(eo,to),6oo+no.encode(ao,to,ro+oo),0);return this.count instanceof ExternalLayout&&this.count.encode(eo.length,to,ro),io}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(eo,to,ro){if(!(Array.isArray(eo)&&eo.reduce((io,oo)=>io&&oo instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof to=="boolean"&&ro===void 0&&(ro=to,to=void 0);for(const io of eo)if(0>io.span&&io.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let no=-1;try{no=eo.reduce((io,oo)=>io+oo.getSpan(),0)}catch{}super(no,to),this.fields=eo,this.decodePrefixes=!!ro}getSpan(eo,to=0){if(0<=this.span)return this.span;let ro=0;try{ro=this.fields.reduce((no,io)=>{const oo=io.getSpan(eo,to);return to+=oo,no+oo},0)}catch{throw new RangeError("indeterminate span")}return ro}decode(eo,to=0){checkUint8Array(eo);const ro=this.makeDestinationObject();for(const no of this.fields)if(no.property!==void 0&&(ro[no.property]=no.decode(eo,to)),to+=no.getSpan(eo,to),this.decodePrefixes&&eo.length===to)break;return ro}encode(eo,to,ro=0){const no=ro;let io=0,oo=0;for(const ao of this.fields){let so=ao.span;if(oo=0so&&(so=ao.getSpan(to,ro)))}io=ro,ro+=so}return io+oo-no}fromArray(eo){const to=this.makeDestinationObject();for(const ro of this.fields)ro.property!==void 0&&0ro.span?to=-1:0<=to&&(to+=ro.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(eo){this.property=eo}decode(eo,to){throw new Error("UnionDiscriminator is abstract")}encode(eo,to,ro){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(eo,to){if(!(eo instanceof ExternalLayout&&eo.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(to||eo.property||"variant"),this.layout=eo}decode(eo,to){return this.layout.decode(eo,to)}encode(eo,to,ro){return this.layout.encode(eo,to,ro)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(eo,to,ro){let no;if(eo instanceof UInt||eo instanceof UIntBE)no=new UnionLayoutDiscriminator(new OffsetLayout(eo));else if(eo instanceof ExternalLayout&&eo.isCount())no=new UnionLayoutDiscriminator(eo);else if(eo instanceof UnionDiscriminator)no=eo;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(to===void 0&&(to=null),!(to===null||to instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(to!==null){if(0>to.span)throw new Error("defaultLayout must have constant span");to.property===void 0&&(to=to.replicate("content"))}let io=-1;to&&(io=to.span,0<=io&&(eo instanceof UInt||eo instanceof UIntBE)&&(io+=no.layout.span)),super(io,ro),this.discriminator=no,this.usesPrefixDiscriminator=eo instanceof UInt||eo instanceof UIntBE,this.defaultLayout=to,this.registry={};let oo=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(ao){return oo(ao)},this.configGetSourceVariant=function(ao){oo=ao.bind(this)}}getSpan(eo,to=0){if(0<=this.span)return this.span;const ro=this.getVariant(eo,to);if(!ro)throw new Error("unable to determine span for unrecognized variant");return ro.getSpan(eo,to)}defaultGetSourceVariant(eo){if(Object.prototype.hasOwnProperty.call(eo,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(eo,this.defaultLayout.property))return;const to=this.registry[eo[this.discriminator.property]];if(to&&(!to.layout||to.property&&Object.prototype.hasOwnProperty.call(eo,to.property)))return to}else for(const to in this.registry){const ro=this.registry[to];if(ro.property&&Object.prototype.hasOwnProperty.call(eo,ro.property))return ro}throw new Error("unable to infer src variant")}decode(eo,to=0){let ro;const no=this.discriminator,io=no.decode(eo,to),oo=this.registry[io];if(oo===void 0){const ao=this.defaultLayout;let so=0;this.usesPrefixDiscriminator&&(so=no.layout.span),ro=this.makeDestinationObject(),ro[no.property]=io,ro[ao.property]=ao.decode(eo,to+so)}else ro=oo.decode(eo,to);return ro}encode(eo,to,ro=0){const no=this.getSourceVariant(eo);if(no===void 0){const io=this.discriminator,oo=this.defaultLayout;let ao=0;return this.usesPrefixDiscriminator&&(ao=io.layout.span),io.encode(eo[io.property],to,ro),ao+oo.encode(eo[oo.property],to,ro+ao)}return no.encode(eo,to,ro)}addVariant(eo,to,ro){const no=new VariantLayout(this,eo,to,ro);return this.registry[eo]=no,no}getVariant(eo,to=0){let ro;return eo instanceof Uint8Array?ro=this.discriminator.decode(eo,to):ro=eo,this.registry[ro]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(eo,to,ro,no){if(!(eo instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(to)||0>to)throw new TypeError("variant must be a (non-negative) integer");if(typeof ro=="string"&&no===void 0&&(no=ro,ro=null),ro){if(!(ro instanceof Layout))throw new TypeError("layout must be a Layout");if(eo.defaultLayout!==null&&0<=ro.span&&ro.span>eo.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof no!="string")throw new TypeError("variant must have a String property")}let io=eo.span;0>eo.span&&(io=ro?ro.span:0,0<=io&&eo.usesPrefixDiscriminator&&(io+=eo.discriminator.layout.span)),super(io,no),this.union=eo,this.variant=to,this.layout=ro||null}getSpan(eo,to=0){if(0<=this.span)return this.span;let ro=0;this.union.usesPrefixDiscriminator&&(ro=this.union.discriminator.layout.span);let no=0;return this.layout&&(no=this.layout.getSpan(eo,to+ro)),ro+no}decode(eo,to=0){const ro=this.makeDestinationObject();if(this!==this.union.getVariant(eo,to))throw new Error("variant mismatch");let no=0;return this.union.usesPrefixDiscriminator&&(no=this.union.discriminator.layout.span),this.layout?ro[this.property]=this.layout.decode(eo,to+no):this.property?ro[this.property]=!0:this.union.usesPrefixDiscriminator&&(ro[this.union.discriminator.property]=this.variant),ro}encode(eo,to,ro=0){let no=0;if(this.union.usesPrefixDiscriminator&&(no=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(eo,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,to,ro);let io=no;if(this.layout&&(this.layout.encode(eo[this.property],to,ro+no),io+=this.layout.getSpan(to,ro+no),0<=this.union.span&&io>this.union.span))throw new Error("encoded variant overruns containing union");return io}fromArray(eo){if(this.layout)return this.layout.fromArray(eo)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(Xr){return 0>Xr&&(Xr+=4294967296),Xr}class BitStructure extends Layout{constructor(eo,to,ro){if(!(eo instanceof UInt||eo instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof to=="string"&&ro===void 0&&(ro=to,to=!1),4=to)throw new TypeError("bits must be positive integer");const no=8*eo.span,io=eo.fields.reduce((oo,ao)=>oo+ao.bits,0);if(to+io>no)throw new Error("bits too long for span remainder ("+(no-io)+" of "+no+" remain)");this.container=eo,this.bits=to,this.valueMask=(1<>>this.start}encode(eo){if(typeof eo!="number"||!Number.isInteger(eo)||eo!==fixBitwiseResult(eo&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const to=this.container._packedGetValue(),ro=fixBitwiseResult(eo<ro&&(ro=this.length.decode(eo,to)),ro}decode(eo,to=0){let ro=this.span;return 0>ro&&(ro=this.length.decode(eo,to)),uint8ArrayToBuffer(eo).slice(to,to+ro)}encode(eo,to,ro){let no=this.length;if(this.length instanceof ExternalLayout&&(no=eo.length),!(eo instanceof Uint8Array&&no===eo.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+no+") Uint8Array as src");if(ro+no>to.length)throw new RangeError("encoding overruns Uint8Array");const io=uint8ArrayToBuffer(eo);return uint8ArrayToBuffer(to).write(io.toString("hex"),ro,no,"hex"),this.length instanceof ExternalLayout&&this.length.encode(no,to,ro),no}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(eo){super(-1,eo)}getSpan(eo,to=0){checkUint8Array(eo);let ro=to;for(;roto.length)throw new RangeError("encoding overruns Buffer");const oo=uint8ArrayToBuffer(to);return no.copy(oo,ro),oo[ro+io]=0,io+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(eo,to){if(typeof eo=="string"&&to===void 0&&(to=eo,eo=void 0),eo===void 0)eo=-1;else if(!Number.isInteger(eo))throw new TypeError("maxSpan must be an integer");super(-1,to),this.maxSpan=eo}getSpan(eo,to=0){return checkUint8Array(eo),eo.length-to}decode(eo,to=0){const ro=this.getSpan(eo,to);if(0<=this.maxSpan&&this.maxSpanto.length)throw new RangeError("encoding overruns Buffer");return no.copy(uint8ArrayToBuffer(to),ro),io}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(eo,to){super(0,to),this.value=eo}decode(eo,to){return this.value}encode(eo,to,ro){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(Xr,eo)=>new GreedyCount(Xr,eo);var offset=Layout$1.offset=(Xr,eo,to)=>new OffsetLayout(Xr,eo,to),u8=Layout$1.u8=Xr=>new UInt(1,Xr),u16=Layout$1.u16=Xr=>new UInt(2,Xr);Layout$1.u24=Xr=>new UInt(3,Xr);var u32$1=Layout$1.u32=Xr=>new UInt(4,Xr);Layout$1.u40=Xr=>new UInt(5,Xr);Layout$1.u48=Xr=>new UInt(6,Xr);var nu64=Layout$1.nu64=Xr=>new NearUInt64(Xr);Layout$1.u16be=Xr=>new UIntBE(2,Xr);Layout$1.u24be=Xr=>new UIntBE(3,Xr);Layout$1.u32be=Xr=>new UIntBE(4,Xr);Layout$1.u40be=Xr=>new UIntBE(5,Xr);Layout$1.u48be=Xr=>new UIntBE(6,Xr);Layout$1.nu64be=Xr=>new NearUInt64BE(Xr);Layout$1.s8=Xr=>new Int(1,Xr);Layout$1.s16=Xr=>new Int(2,Xr);Layout$1.s24=Xr=>new Int(3,Xr);Layout$1.s32=Xr=>new Int(4,Xr);Layout$1.s40=Xr=>new Int(5,Xr);Layout$1.s48=Xr=>new Int(6,Xr);var ns64=Layout$1.ns64=Xr=>new NearInt64(Xr);Layout$1.s16be=Xr=>new IntBE(2,Xr);Layout$1.s24be=Xr=>new IntBE(3,Xr);Layout$1.s32be=Xr=>new IntBE(4,Xr);Layout$1.s40be=Xr=>new IntBE(5,Xr);Layout$1.s48be=Xr=>new IntBE(6,Xr);Layout$1.ns64be=Xr=>new NearInt64BE(Xr);Layout$1.f32=Xr=>new Float(Xr);Layout$1.f32be=Xr=>new FloatBE(Xr);Layout$1.f64=Xr=>new Double(Xr);Layout$1.f64be=Xr=>new DoubleBE(Xr);var struct=Layout$1.struct=(Xr,eo,to)=>new Structure(Xr,eo,to);Layout$1.bits=(Xr,eo,to)=>new BitStructure(Xr,eo,to);var seq=Layout$1.seq=(Xr,eo,to)=>new Sequence(Xr,eo,to);Layout$1.union=(Xr,eo,to)=>new Union(Xr,eo,to);Layout$1.unionLayoutDiscriminator=(Xr,eo)=>new UnionLayoutDiscriminator(Xr,eo);var blob=Layout$1.blob=(Xr,eo)=>new Blob$1(Xr,eo);Layout$1.cstr=Xr=>new CString(Xr);Layout$1.utf8=(Xr,eo)=>new UTF8(Xr,eo);Layout$1.constant=(Xr,eo)=>new Constant(Xr,eo);var browser$1={};Object.defineProperty(browser$1,"__esModule",{value:!0});function toBigIntLE(Xr){{const eo=Buffer$3.from(Xr);eo.reverse();const to=eo.toString("hex");return to.length===0?BigInt(0):BigInt(`0x${to}`)}}var toBigIntLE_1=browser$1.toBigIntLE=toBigIntLE;function toBigIntBE(Xr){{const eo=Xr.toString("hex");return eo.length===0?BigInt(0):BigInt(`0x${eo}`)}}browser$1.toBigIntBE=toBigIntBE;function toBufferLE(Xr,eo){{const to=Xr.toString(16),ro=Buffer$3.from(to.padStart(eo*2,"0").slice(0,eo*2),"hex");return ro.reverse(),ro}}var toBufferLE_1=browser$1.toBufferLE=toBufferLE;function toBufferBE(Xr,eo){{const to=Xr.toString(16);return Buffer$3.from(to.padStart(eo*2,"0").slice(0,eo*2),"hex")}}browser$1.toBufferBE=toBufferBE;let StructError$2=class extends TypeError{constructor(eo,to){let ro;const{message:no,explanation:io,...oo}=eo,{path:ao}=eo,so=ao.length===0?no:`At path: ${ao.join(".")} -- ${no}`;super(io??so),io!=null&&(this.cause=so),Object.assign(this,oo),this.name=this.constructor.name,this.failures=()=>ro??(ro=[eo,...to()])}};function isIterable$2(Xr){return isObject$4(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$4(Xr){return typeof Xr=="object"&&Xr!=null}function print$2(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator$2(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure$2(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print$2(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures$2(Xr,eo,to,ro){isIterable$2(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure$2(no,eo,to,ro);io&&(yield io)}}function*run$2(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no};if(io&&(Xr=eo.coercer(Xr,ao),oo&&eo.type!=="type"&&isObject$4(eo.schema)&&isObject$4(Xr)&&!Array.isArray(Xr)))for(const co in Xr)eo.schema[co]===void 0&&delete Xr[co];let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,fo]of eo.entries(Xr,ao)){const ho=run$2(lo,fo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$4(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$5=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures$2(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures$2(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$6(eo,this,to)}create(eo,to){return create$2(eo,this,to)}is(eo){return is$3(eo,this)}mask(eo,to){return mask$2(eo,this,to)}validate(eo,to={}){return validate$3(eo,this,to)}};function assert$6(Xr,eo,to){const ro=validate$3(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create$2(Xr,eo,to){const ro=validate$3(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask$2(Xr,eo,to){const ro=validate$3(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$3(Xr,eo){return!validate$3(Xr,eo)[0]}function validate$3(Xr,eo,to={}){const ro=run$2(Xr,eo,to),no=shiftIterator$2(ro);return no[0]?[new StructError$2(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define$2(Xr,eo){return new Struct$5({type:Xr,schema:null,validator:eo})}function any$2(){return define$2("any",()=>!0)}function array$2(Xr){return new Struct$5({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print$2(eo)}`}})}function boolean$2(){return define$2("boolean",Xr=>typeof Xr=="boolean")}function instance$2(Xr){return define$2("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print$2(eo)}`)}function literal$2(Xr){const eo=print$2(Xr),to=typeof Xr;return new Struct$5({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print$2(ro)}`}})}function never$2(){return define$2("never",()=>!1)}function nullable$2(Xr){return new Struct$5({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$3(){return define$2("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print$2(Xr)}`)}function optional$2(Xr){return new Struct$5({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record$2(Xr,eo){return new Struct$5({type:"record",schema:null,*entries(to){if(isObject$4(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isObject$4(to)||`Expected an object, but received: ${print$2(to)}`}})}function string$2(){return define$2("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print$2(Xr)}`)}function tuple$3(Xr){const eo=never$2();return new Struct$5({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$5({type:"union",schema:null,coercer(to){for(const ro of Xr){const[no,io]=ro.validate(to,{coerce:!0});if(!no)return io}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run$2(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print$2(to)}`,...no]}})}function unknown$2(){return define$2("unknown",()=>!0)}function coerce$2(Xr,eo,to){return new Struct$5({...Xr,coercer:(ro,no)=>is$3(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[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 validate$2(Xr){return typeof Xr=="string"&®EX.test(Xr)}var byteToHex=[];for(var i$1=0;i$1<256;++i$1)byteToHex.push((i$1+256).toString(16).substr(1));function stringify$2(Xr){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,to=(byteToHex[Xr[eo+0]]+byteToHex[Xr[eo+1]]+byteToHex[Xr[eo+2]]+byteToHex[Xr[eo+3]]+"-"+byteToHex[Xr[eo+4]]+byteToHex[Xr[eo+5]]+"-"+byteToHex[Xr[eo+6]]+byteToHex[Xr[eo+7]]+"-"+byteToHex[Xr[eo+8]]+byteToHex[Xr[eo+9]]+"-"+byteToHex[Xr[eo+10]]+byteToHex[Xr[eo+11]]+byteToHex[Xr[eo+12]]+byteToHex[Xr[eo+13]]+byteToHex[Xr[eo+14]]+byteToHex[Xr[eo+15]]).toLowerCase();if(!validate$2(to))throw TypeError("Stringified UUID is invalid");return to}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(Xr,eo,to){var ro=eo&&to||0,no=eo||new Array(16);Xr=Xr||{};var io=Xr.node||_nodeId,oo=Xr.clockseq!==void 0?Xr.clockseq:_clockseq;if(io==null||oo==null){var ao=Xr.random||(Xr.rng||rng)();io==null&&(io=_nodeId=[ao[0]|1,ao[1],ao[2],ao[3],ao[4],ao[5]]),oo==null&&(oo=_clockseq=(ao[6]<<8|ao[7])&16383)}var so=Xr.msecs!==void 0?Xr.msecs:Date.now(),co=Xr.nsecs!==void 0?Xr.nsecs:_lastNSecs+1,lo=so-_lastMSecs+(co-_lastNSecs)/1e4;if(lo<0&&Xr.clockseq===void 0&&(oo=oo+1&16383),(lo<0||so>_lastMSecs)&&Xr.nsecs===void 0&&(co=0),co>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=so,_lastNSecs=co,_clockseq=oo,so+=122192928e5;var fo=((so&268435455)*1e4+co)%4294967296;no[ro++]=fo>>>24&255,no[ro++]=fo>>>16&255,no[ro++]=fo>>>8&255,no[ro++]=fo&255;var ho=so/4294967296*1e4&268435455;no[ro++]=ho>>>8&255,no[ro++]=ho&255,no[ro++]=ho>>>24&15|16,no[ro++]=ho>>>16&255,no[ro++]=oo>>>8|128,no[ro++]=oo&255;for(var go=0;go<6;++go)no[ro+go]=io[go];return eo||stringify$2(no)}function parse$1(Xr){if(!validate$2(Xr))throw TypeError("Invalid UUID");var eo,to=new Uint8Array(16);return to[0]=(eo=parseInt(Xr.slice(0,8),16))>>>24,to[1]=eo>>>16&255,to[2]=eo>>>8&255,to[3]=eo&255,to[4]=(eo=parseInt(Xr.slice(9,13),16))>>>8,to[5]=eo&255,to[6]=(eo=parseInt(Xr.slice(14,18),16))>>>8,to[7]=eo&255,to[8]=(eo=parseInt(Xr.slice(19,23),16))>>>8,to[9]=eo&255,to[10]=(eo=parseInt(Xr.slice(24,36),16))/1099511627776&255,to[11]=eo/4294967296&255,to[12]=eo>>>24&255,to[13]=eo>>>16&255,to[14]=eo>>>8&255,to[15]=eo&255,to}function stringToBytes(Xr){Xr=unescape(encodeURIComponent(Xr));for(var eo=[],to=0;to>5]>>>no%32&255,oo=parseInt(ro.charAt(io>>>4&15)+ro.charAt(io&15),16);eo.push(oo)}return eo}function getOutputLength(Xr){return(Xr+64>>>9<<4)+14+1}function wordsToMd5(Xr,eo){Xr[eo>>5]|=128<>5]|=(Xr[ro/8]&255)<>16)+(eo>>16)+(to>>16);return ro<<16|to&65535}function bitRotateLeft(Xr,eo){return Xr<>>32-eo}function md5cmn(Xr,eo,to,ro,no,io){return safeAdd(bitRotateLeft(safeAdd(safeAdd(eo,Xr),safeAdd(ro,io)),no),to)}function md5ff(Xr,eo,to,ro,no,io,oo){return md5cmn(eo&to|~eo&ro,Xr,eo,no,io,oo)}function md5gg(Xr,eo,to,ro,no,io,oo){return md5cmn(eo&ro|to&~ro,Xr,eo,no,io,oo)}function md5hh(Xr,eo,to,ro,no,io,oo){return md5cmn(eo^to^ro,Xr,eo,no,io,oo)}function md5ii(Xr,eo,to,ro,no,io,oo){return md5cmn(to^(eo|~ro),Xr,eo,no,io,oo)}var v3=v35("v3",48,md5);function v4(Xr,eo,to){Xr=Xr||{};var ro=Xr.random||(Xr.rng||rng)();if(ro[6]=ro[6]&15|64,ro[8]=ro[8]&63|128,eo){to=to||0;for(var no=0;no<16;++no)eo[to+no]=ro[no];return eo}return stringify$2(ro)}function f$3(Xr,eo,to,ro){switch(Xr){case 0:return eo&to^~eo&ro;case 1:return eo^to^ro;case 2:return eo&to^eo&ro^to&ro;case 3:return eo^to^ro}}function ROTL(Xr,eo){return Xr<>>32-eo}function sha1(Xr){var eo=[1518500249,1859775393,2400959708,3395469782],to=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof Xr=="string"){var ro=unescape(encodeURIComponent(Xr));Xr=[];for(var no=0;no>>0;Ao=ko,ko=Eo,Eo=ROTL(wo,30)>>>0,wo=vo,vo=Mo}to[0]=to[0]+vo>>>0,to[1]=to[1]+wo>>>0,to[2]=to[2]+Eo>>>0,to[3]=to[3]+ko>>>0,to[4]=to[4]+Ao>>>0}return[to[0]>>24&255,to[0]>>16&255,to[0]>>8&255,to[0]&255,to[1]>>24&255,to[1]>>16&255,to[1]>>8&255,to[1]&255,to[2]>>24&255,to[2]>>16&255,to[2]>>8&255,to[2]&255,to[3]>>24&255,to[3]>>16&255,to[3]>>8&255,to[3]&255,to[4]>>24&255,to[4]>>16&255,to[4]>>8&255,to[4]&255]}var v5=v35("v5",80,sha1);const nil="00000000-0000-0000-0000-000000000000";function version$8(Xr){if(!validate$2(Xr))throw TypeError("Invalid UUID");return parseInt(Xr.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse:parse$1,stringify:stringify$2,v1,v3,v4,v5,validate:validate$2,version:version$8},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esmBrowser),uuid$1=require$$0.v4,generateRequest$1=function(Xr,eo,to,ro){if(typeof Xr!="string")throw new TypeError(Xr+" must be a string");ro=ro||{};const no=typeof ro.version=="number"?ro.version:2;if(no!==1&&no!==2)throw new TypeError(no+" must be 1 or 2");const io={method:Xr};if(no===2&&(io.jsonrpc="2.0"),eo){if(typeof eo!="object"&&!Array.isArray(eo))throw new TypeError(eo+" must be an object, array or omitted");io.params=eo}if(typeof to>"u"){const oo=typeof ro.generator=="function"?ro.generator:function(){return uuid$1()};io.id=oo(io,ro)}else no===2&&to===null?ro.notificationIdNull&&(io.id=null):io.id=to;return io};var generateRequest_1=generateRequest$1;const uuid=require$$0.v4,generateRequest=generateRequest_1,ClientBrowser=function(Xr,eo){if(!(this instanceof ClientBrowser))return new ClientBrowser(Xr,eo);eo||(eo={}),this.options={reviver:typeof eo.reviver<"u"?eo.reviver:null,replacer:typeof eo.replacer<"u"?eo.replacer:null,generator:typeof eo.generator<"u"?eo.generator:function(){return uuid()},version:typeof eo.version<"u"?eo.version:2,notificationIdNull:typeof eo.notificationIdNull=="boolean"?eo.notificationIdNull:!1},this.callServer=Xr};var browser=ClientBrowser;ClientBrowser.prototype.request=function(Xr,eo,to,ro){const no=this;let io=null;const oo=Array.isArray(Xr)&&typeof eo=="function";if(this.options.version===1&&oo)throw new TypeError("JSON-RPC 1.0 does not support batching");if(oo||!oo&&Xr&&typeof Xr=="object"&&typeof eo=="function")ro=eo,io=Xr;else{typeof to=="function"&&(ro=to,to=void 0);const co=typeof ro=="function";try{io=generateRequest(Xr,eo,to,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(lo){if(co)return ro(lo);throw lo}if(!co)return io}let so;try{so=JSON.stringify(io,this.options.replacer)}catch(co){return ro(co)}return this.callServer(so,function(co,lo){no._parseResponse(co,lo,ro)}),io};ClientBrowser.prototype._parseResponse=function(Xr,eo,to){if(Xr){to(Xr);return}if(!eo)return to();let ro;try{ro=JSON.parse(eo,this.options.reviver)}catch(no){return to(no)}if(to.length===3)if(Array.isArray(ro)){const no=function(oo){return typeof oo.error<"u"},io=function(oo){return!no(oo)};return to(null,ro.filter(no),ro.filter(io))}else return to(null,ro.error,ro.result);to(null,ro)};const RpcClient=getDefaultExportFromCjs$2(browser);var client={},eventemitter3={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,fo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,fo||so,ho),yo=to?to+co:co;return so._events[yo]?so._events[yo].fn?so._events[yo]=[so._events[yo],go]:so._events[yo].push(go):(so._events[yo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var co=[],lo,fo;if(this._eventsCount===0)return co;for(fo in lo=this._events)eo.call(lo,fo)&&co.push(to?fo.slice(1):fo);return Object.getOwnPropertySymbols?co.concat(Object.getOwnPropertySymbols(lo)):co},ao.prototype.listeners=function(co){var lo=to?to+co:co,fo=this._events[lo];if(!fo)return[];if(fo.fn)return[fo.fn];for(var ho=0,go=fo.length,yo=new Array(go);ho++this.rpc_id),lo?this.dataPack=lo:this.dataPack=new utils_cjs_1.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(to,ro,no,io){return!io&&typeof no=="object"&&(io=no,no=null),new Promise((oo,ao)=>{if(!this.ready)return ao(new Error("socket not ready"));const so=this.generate_request_id(to,ro),co={jsonrpc:"2.0",method:to,params:ro||void 0,id:so};this.socket.send(this.dataPack.encode(co),io,lo=>{if(lo)return ao(lo);this.queue[so]={promise:[oo,ao]},no&&(this.queue[so].timeout=setTimeout(()=>{delete this.queue[so],ao(new Error("reply timeout"))},no))})})}async login(to){const ro=await this.call("rpc.login",to);if(!ro)throw new Error("authentication failed");return ro}async listMethods(){return await this.call("__listMethods")}notify(to,ro){return new Promise((no,io)=>{if(!this.ready)return io(new Error("socket not ready"));const oo={jsonrpc:"2.0",method:to,params:ro};this.socket.send(this.dataPack.encode(oo),ao=>{if(ao)return io(ao);no()})})}async subscribe(to){typeof to=="string"&&(to=[to]);const ro=await this.call("rpc.on",to);if(typeof to=="string"&&ro[to]!=="ok")throw new Error("Failed subscribing to an event '"+to+"' with: "+ro[to]);return ro}async unsubscribe(to){typeof to=="string"&&(to=[to]);const ro=await this.call("rpc.off",to);if(typeof to=="string"&&ro[to]!=="ok")throw new Error("Failed unsubscribing from an event with: "+ro);return ro}close(to,ro){this.socket.close(to||1e3,ro)}setAutoReconnect(to){this.reconnect=to}setReconnectInterval(to){this.reconnect_interval=to}setMaxReconnects(to){this.max_reconnects=to}_connect(to,ro){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(to,ro),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:no})=>{no instanceof ArrayBuffer&&(no=Buffer$3.from(no).toString());try{no=this.dataPack.decode(no)}catch{return}if(no.notification&&this.listeners(no.notification).length){if(!Object.keys(no.params).length)return this.emit(no.notification);const io=[no.notification];if(no.params.constructor===Object)io.push(no.params);else for(let oo=0;oo{this.emit.apply(this,io)})}if(!this.queue[no.id])return no.method?Promise.resolve().then(()=>{this.emit(no.method,no==null?void 0:no.params)}):void 0;"error"in no=="result"in no&&this.queue[no.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[no.id].timeout&&clearTimeout(this.queue[no.id].timeout),no.error?this.queue[no.id].promise[1](no.error):this.queue[no.id].promise[0](no.result),delete this.queue[no.id]}),this.socket.addEventListener("error",no=>this.emit("error",no)),this.socket.addEventListener("close",({code:no,reason:io})=>{this.ready&&setTimeout(()=>this.emit("close",no,io),0),this.ready=!1,this.socket=void 0,no!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(to,ro),this.reconnect_interval)))})}}var _default$1=client.default=CommonClient,websocket_browser={};Object.defineProperty(websocket_browser,"__esModule",{value:!0});const eventemitter3_1=eventemitter3Exports;class WebSocketBrowserImpl extends eventemitter3_1.EventEmitter{constructor(to,ro,no){super();Qu(this,"socket");this.socket=new window.WebSocket(to,no),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=io=>this.emit("message",io.data),this.socket.onerror=io=>this.emit("error",io),this.socket.onclose=io=>{this.emit("close",io.code,io.reason)}}send(to,ro,no){const io=no||ro;try{this.socket.send(to),io()}catch(oo){io(oo)}}close(to,ro){this.socket.close(to,ro)}addEventListener(to,ro,no){this.socket.addEventListener(to,ro,no)}}function default_1(Xr,eo){return new WebSocketBrowserImpl(Xr,eo)}var _default=websocket_browser.default=default_1;function isOnCurve$2(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const sign$1=(Xr,eo)=>ed25519.sign(Xr,eo.slice(0,32)),verify$1=ed25519.verify,toBuffer$2=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);let Struct$4=class{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$2,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA$2,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA$2,this,eo)}};const SOLANA_SCHEMA$2=new Map;var _PublicKey$2;const MAX_SEED_LENGTH$2=32,PUBLIC_KEY_LENGTH$2=32;function isPublicKeyData$2(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter$2=1,PublicKey$2=class G0 extends Struct$4{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData$2(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input");this._bn=new BN$2(to)}else this._bn=new BN$2(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input")}}static unique(){const eo=new G0(uniquePublicKeyCounter$2);return uniquePublicKeyCounter$2+=1,new G0(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH$2)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new G0(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH$2)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer$2(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve$2(no))throw new Error("Invalid seeds, address must fall off the curve");return new G0(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new G0(eo);return isOnCurve$2(to.toBytes())}};_PublicKey$2=PublicKey$2;PublicKey$2.default=new _PublicKey$2("11111111111111111111111111111111");SOLANA_SCHEMA$2.set(PublicKey$2,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$2("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES$2=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(eo){super(`Signature ${eo} has expired: block height exceeded.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(eo,to){super(`Transaction was not confirmed in ${to.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${eo} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(eo){super(`Signature ${eo} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(eo,to){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=eo,this.accountKeysFromLookups=to}keySegments(){const eo=[this.staticAccountKeys];return this.accountKeysFromLookups&&(eo.push(this.accountKeysFromLookups.writable),eo.push(this.accountKeysFromLookups.readonly)),eo}get(eo){for(const to of this.keySegments()){if(eo256)throw new Error("Account index overflow encountered during compilation");const ro=new Map;this.keySegments().flat().forEach((io,oo)=>{ro.set(io.toBase58(),oo)});const no=io=>{const oo=ro.get(io.toBase58());if(oo===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return oo};return eo.map(io=>({programIdIndex:no(io.programId),accountKeyIndexes:io.keys.map(oo=>no(oo.pubkey)),data:io.data}))}}const publicKey$3=(Xr="publicKey")=>blob(32,Xr),signature=(Xr="signature")=>blob(64,Xr),rustString$2=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized$2=(Xr="authorized")=>struct([publicKey$3("staker"),publicKey$3("withdrawer")],Xr),lockup$2=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$3("custodian")],Xr),voteInit$2=(Xr="voteInit")=>struct([publicKey$3("nodePubkey"),publicKey$3("authorizedVoter"),publicKey$3("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs$2=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey$3("currentAuthorityDerivedKeyOwnerPubkey"),rustString$2("currentAuthorityDerivedKeySeed"),publicKey$3("newAuthorized")],Xr);function getAlloc(Xr,eo){const to=no=>{if(no.span>=0)return no.span;if(typeof no.alloc=="function")return no.alloc(eo[no.property]);if("count"in no&&"elementLayout"in no){const io=eo[no.property];if(Array.isArray(io))return io.length*to(no.elementLayout)}else if("fields"in no)return getAlloc({layout:no},eo[no.property]);return 0};let ro=0;return Xr.layout.fields.forEach(no=>{ro+=to(no)}),ro}function decodeLength(Xr){let eo=0,to=0;for(;;){let ro=Xr.shift();if(eo|=(ro&127)<>=7,to==0){Xr.push(ro);break}else ro|=128,Xr.push(ro)}}function assert$5(Xr,eo){if(!Xr)throw new Error(eo||"Assertion failed")}class CompiledKeys{constructor(eo,to){this.payer=void 0,this.keyMetaMap=void 0,this.payer=eo,this.keyMetaMap=to}static compile(eo,to){const ro=new Map,no=oo=>{const ao=oo.toBase58();let so=ro.get(ao);return so===void 0&&(so={isSigner:!1,isWritable:!1,isInvoked:!1},ro.set(ao,so)),so},io=no(to);io.isSigner=!0,io.isWritable=!0;for(const oo of eo){no(oo.programId).isInvoked=!0;for(const ao of oo.keys){const so=no(ao.pubkey);so.isSigner||(so.isSigner=ao.isSigner),so.isWritable||(so.isWritable=ao.isWritable)}}return new CompiledKeys(to,ro)}getMessageComponents(){const eo=[...this.keyMetaMap.entries()];assert$5(eo.length<=256,"Max static account keys length exceeded");const to=eo.filter(([,so])=>so.isSigner&&so.isWritable),ro=eo.filter(([,so])=>so.isSigner&&!so.isWritable),no=eo.filter(([,so])=>!so.isSigner&&so.isWritable),io=eo.filter(([,so])=>!so.isSigner&&!so.isWritable),oo={numRequiredSignatures:to.length+ro.length,numReadonlySignedAccounts:ro.length,numReadonlyUnsignedAccounts:io.length};{assert$5(to.length>0,"Expected at least one writable signer key");const[so]=to[0];assert$5(so===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const ao=[...to.map(([so])=>new PublicKey$2(so)),...ro.map(([so])=>new PublicKey$2(so)),...no.map(([so])=>new PublicKey$2(so)),...io.map(([so])=>new PublicKey$2(so))];return[oo,ao]}extractTableLookup(eo){const[to,ro]=this.drainKeysFoundInLookupTable(eo.state.addresses,oo=>!oo.isSigner&&!oo.isInvoked&&oo.isWritable),[no,io]=this.drainKeysFoundInLookupTable(eo.state.addresses,oo=>!oo.isSigner&&!oo.isInvoked&&!oo.isWritable);if(!(to.length===0&&no.length===0))return[{accountKey:eo.key,writableIndexes:to,readonlyIndexes:no},{writable:ro,readonly:io}]}drainKeysFoundInLookupTable(eo,to){const ro=new Array,no=new Array;for(const[io,oo]of this.keyMetaMap.entries())if(to(oo)){const ao=new PublicKey$2(io),so=eo.findIndex(co=>co.equals(ao));so>=0&&(assert$5(so<256,"Max lookup table index exceeded"),ro.push(so),no.push(ao),this.keyMetaMap.delete(io))}return[ro,no]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(Xr){if(Xr.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return Xr.shift()}function guardedSplice(Xr,...eo){const[to]=eo;if(eo.length===2?to+(eo[1]??0)>Xr.length:to>=Xr.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return Xr.splice(...eo)}class Message{constructor(eo){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=eo.header,this.accountKeys=eo.accountKeys.map(to=>new PublicKey$2(to)),this.recentBlockhash=eo.recentBlockhash,this.instructions=eo.instructions,this.instructions.forEach(to=>this.indexToProgramIds.set(to.programIdIndex,this.accountKeys[to.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(eo=>({programIdIndex:eo.programIdIndex,accountKeyIndexes:eo.accounts,data:bs58$3.decode(eo.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(eo){const to=CompiledKeys.compile(eo.instructions,eo.payerKey),[ro,no]=to.getMessageComponents(),oo=new MessageAccountKeys(no).compileInstructions(eo.instructions).map(ao=>({programIdIndex:ao.programIdIndex,accounts:ao.accountKeyIndexes,data:bs58$3.encode(ao.data)}));return new Message({header:ro,accountKeys:no,recentBlockhash:eo.recentBlockhash,instructions:oo})}isAccountSigner(eo){return eo=this.header.numRequiredSignatures){const ro=eo-to,io=this.accountKeys.length-to-this.header.numReadonlyUnsignedAccounts;return ro!this.isProgramId(to))}serialize(){const eo=this.accountKeys.length;let to=[];encodeLength(to,eo);const ro=this.instructions.map(fo=>{const{accounts:ho,programIdIndex:go}=fo,yo=Array.from(bs58$3.decode(fo.data));let vo=[];encodeLength(vo,ho.length);let wo=[];return encodeLength(wo,yo.length),{programIdIndex:go,keyIndicesCount:Buffer$1$1.from(vo),keyIndices:ho,dataLength:Buffer$1$1.from(wo),data:yo}});let no=[];encodeLength(no,ro.length);let io=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(no).copy(io);let oo=no.length;ro.forEach(fo=>{const go=struct([u8("programIdIndex"),blob(fo.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),fo.keyIndices.length,"keyIndices"),blob(fo.dataLength.length,"dataLength"),seq(u8("userdatum"),fo.data.length,"data")]).encode(fo,io,oo);oo+=go}),io=io.slice(0,oo);const ao=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(to.length,"keyCount"),seq(publicKey$3("key"),eo,"keys"),publicKey$3("recentBlockhash")]),so={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(to),keys:this.accountKeys.map(fo=>toBuffer$2(fo.toBytes())),recentBlockhash:bs58$3.decode(this.recentBlockhash)};let co=Buffer$1$1.alloc(2048);const lo=ao.encode(so,co);return io.copy(co,lo),co.slice(0,lo+io.length)}static from(eo){let to=[...eo];const ro=guardedShift(to);if(ro!==(ro&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const no=guardedShift(to),io=guardedShift(to),oo=decodeLength(to);let ao=[];for(let ho=0;ho0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,to)}isAccountSigner(eo){return eo=ro){const no=eo-ro,io=this.addressTableLookups.reduce((oo,ao)=>oo+ao.writableIndexes.length,0);return no=this.header.numRequiredSignatures){const no=eo-to,oo=ro-to-this.header.numReadonlyUnsignedAccounts;return noio.key.equals(ro.accountKey));if(!no)throw new Error(`Failed to find address lookup table account for table key ${ro.accountKey.toBase58()}`);for(const io of ro.writableIndexes)if(iolo.toBytes()),recentBlockhash:bs58$3.decode(this.recentBlockhash),instructionsLength:new Uint8Array(ro),serializedInstructions:to,addressTableLookupsLength:new Uint8Array(io),serializedAddressTableLookups:no},ao);return ao.slice(0,co)}serializeInstructions(){let eo=0;const to=new Uint8Array(PACKET_DATA_SIZE);for(const ro of this.compiledInstructions){const no=Array();encodeLength(no,ro.accountKeyIndexes.length);const io=Array();encodeLength(io,ro.data.length);const oo=struct([u8("programIdIndex"),blob(no.length,"encodedAccountKeyIndexesLength"),seq(u8(),ro.accountKeyIndexes.length,"accountKeyIndexes"),blob(io.length,"encodedDataLength"),blob(ro.data.length,"data")]);eo+=oo.encode({programIdIndex:ro.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(no),accountKeyIndexes:ro.accountKeyIndexes,encodedDataLength:new Uint8Array(io),data:ro.data},to,eo)}return to.slice(0,eo)}serializeAddressTableLookups(){let eo=0;const to=new Uint8Array(PACKET_DATA_SIZE);for(const ro of this.addressTableLookups){const no=Array();encodeLength(no,ro.writableIndexes.length);const io=Array();encodeLength(io,ro.readonlyIndexes.length);const oo=struct([publicKey$3("accountKey"),blob(no.length,"encodedWritableIndexesLength"),seq(u8(),ro.writableIndexes.length,"writableIndexes"),blob(io.length,"encodedReadonlyIndexesLength"),seq(u8(),ro.readonlyIndexes.length,"readonlyIndexes")]);eo+=oo.encode({accountKey:ro.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(no),writableIndexes:ro.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(io),readonlyIndexes:ro.readonlyIndexes},to,eo)}return to.slice(0,eo)}static deserialize(eo){let to=[...eo];const ro=guardedShift(to),no=ro&VERSION_PREFIX_MASK;assert$5(ro!==no,"Expected versioned message but received legacy message");const io=no;assert$5(io===0,`Expected versioned message with version 0 but found version ${io}`);const oo={numRequiredSignatures:guardedShift(to),numReadonlySignedAccounts:guardedShift(to),numReadonlyUnsignedAccounts:guardedShift(to)},ao=[],so=decodeLength(to);for(let yo=0;yo{const eo=VersionedMessage.deserializeMessageVersion(Xr);if(eo==="legacy")return Message.from(Xr);if(eo===0)return MessageV0.deserialize(Xr);throw new Error(`Transaction message version ${eo} deserialization is not supported`)}};let TransactionStatus$1=function(Xr){return Xr[Xr.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",Xr[Xr.PROCESSED=1]="PROCESSED",Xr[Xr.TIMED_OUT=2]="TIMED_OUT",Xr[Xr.NONCE_INVALID=3]="NONCE_INVALID",Xr}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$2).fill(0);class TransactionInstruction{constructor(eo){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=eo.programId,this.keys=eo.keys,eo.data&&(this.data=eo.data)}toJSON(){return{keys:this.keys.map(({pubkey:eo,isSigner:to,isWritable:ro})=>({pubkey:eo.toJSON(),isSigner:to,isWritable:ro})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(eo){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!eo)if(eo.feePayer&&(this.feePayer=eo.feePayer),eo.signatures&&(this.signatures=eo.signatures),Object.prototype.hasOwnProperty.call(eo,"nonceInfo")){const{minContextSlot:to,nonceInfo:ro}=eo;this.minNonceContextSlot=to,this.nonceInfo=ro}else if(Object.prototype.hasOwnProperty.call(eo,"lastValidBlockHeight")){const{blockhash:to,lastValidBlockHeight:ro}=eo;this.recentBlockhash=to,this.lastValidBlockHeight=ro}else{const{recentBlockhash:to,nonceInfo:ro}=eo;ro&&(this.nonceInfo=ro),this.recentBlockhash=to}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(eo=>eo.toJSON()),signers:this.signatures.map(({publicKey:eo})=>eo.toJSON())}}add(...eo){if(eo.length===0)throw new Error("No instructions");return eo.forEach(to=>{"instructions"in to?this.instructions=this.instructions.concat(to.instructions):"data"in to&&"programId"in to&&"keys"in to?this.instructions.push(to):this.instructions.push(new TransactionInstruction(to))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let eo,to;if(this.nonceInfo?(eo=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?to=[this.nonceInfo.nonceInstruction,...this.instructions]:to=this.instructions):(eo=this.recentBlockhash,to=this.instructions),!eo)throw new Error("Transaction recentBlockhash required");to.length<1&&console.warn("No instructions provided");let ro;if(this.feePayer)ro=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)ro=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let vo=0;vo{vo.keys.forEach(Eo=>{io.push({...Eo})});const wo=vo.programId.toString();no.includes(wo)||no.push(wo)}),no.forEach(vo=>{io.push({pubkey:new PublicKey$2(vo),isSigner:!1,isWritable:!1})});const oo=[];io.forEach(vo=>{const wo=vo.pubkey.toString(),Eo=oo.findIndex(ko=>ko.pubkey.toString()===wo);Eo>-1?(oo[Eo].isWritable=oo[Eo].isWritable||vo.isWritable,oo[Eo].isSigner=oo[Eo].isSigner||vo.isSigner):oo.push(vo)}),oo.sort(function(vo,wo){if(vo.isSigner!==wo.isSigner)return vo.isSigner?-1:1;if(vo.isWritable!==wo.isWritable)return vo.isWritable?-1:1;const Eo={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return vo.pubkey.toBase58().localeCompare(wo.pubkey.toBase58(),"en",Eo)});const ao=oo.findIndex(vo=>vo.pubkey.equals(ro));if(ao>-1){const[vo]=oo.splice(ao,1);vo.isSigner=!0,vo.isWritable=!0,oo.unshift(vo)}else oo.unshift({pubkey:ro,isSigner:!0,isWritable:!0});for(const vo of this.signatures){const wo=oo.findIndex(Eo=>Eo.pubkey.equals(vo.publicKey));if(wo>-1)oo[wo].isSigner||(oo[wo].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${vo.publicKey.toString()}`)}let so=0,co=0,lo=0;const fo=[],ho=[];oo.forEach(({pubkey:vo,isSigner:wo,isWritable:Eo})=>{wo?(fo.push(vo.toString()),so+=1,Eo||(co+=1)):(ho.push(vo.toString()),Eo||(lo+=1))});const go=fo.concat(ho),yo=to.map(vo=>{const{data:wo,programId:Eo}=vo;return{programIdIndex:go.indexOf(Eo.toString()),accounts:vo.keys.map(ko=>go.indexOf(ko.pubkey.toString())),data:bs58$3.encode(wo)}});return yo.forEach(vo=>{assert$5(vo.programIdIndex>=0),vo.accounts.forEach(wo=>assert$5(wo>=0))}),new Message({header:{numRequiredSignatures:so,numReadonlySignedAccounts:co,numReadonlyUnsignedAccounts:lo},accountKeys:go,recentBlockhash:eo,instructions:yo})}_compile(){const eo=this.compileMessage(),to=eo.accountKeys.slice(0,eo.header.numRequiredSignatures);return this.signatures.length===to.length&&this.signatures.every((no,io)=>to[io].equals(no.publicKey))||(this.signatures=to.map(ro=>({signature:null,publicKey:ro}))),eo}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(eo){return(await eo.getFeeForMessage(this.compileMessage())).value}setSigners(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set;this.signatures=eo.filter(ro=>{const no=ro.toString();return to.has(no)?!1:(to.add(no),!0)}).map(ro=>({signature:null,publicKey:ro}))}sign(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set,ro=[];for(const io of eo){const oo=io.publicKey.toString();to.has(oo)||(to.add(oo),ro.push(io))}this.signatures=ro.map(io=>({signature:null,publicKey:io.publicKey}));const no=this._compile();this._partialSign(no,...ro)}partialSign(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set,ro=[];for(const io of eo){const oo=io.publicKey.toString();to.has(oo)||(to.add(oo),ro.push(io))}const no=this._compile();this._partialSign(no,...ro)}_partialSign(eo,...to){const ro=eo.serialize();to.forEach(no=>{const io=sign$1(ro,no.secretKey);this._addSignature(no.publicKey,toBuffer$2(io))})}addSignature(eo,to){this._compile(),this._addSignature(eo,to)}_addSignature(eo,to){assert$5(to.length===64);const ro=this.signatures.findIndex(no=>eo.equals(no.publicKey));if(ro<0)throw new Error(`unknown signer: ${eo.toString()}`);this.signatures[ro].signature=Buffer$1$1.from(to)}verifySignatures(eo=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),eo)}_getMessageSignednessErrors(eo,to){const ro={};for(const{signature:no,publicKey:io}of this.signatures)no===null?to&&(ro.missing||(ro.missing=[])).push(io):verify$1(no,eo,io.toBytes())||(ro.invalid||(ro.invalid=[])).push(io);return ro.invalid||ro.missing?ro:void 0}serialize(eo){const{requireAllSignatures:to,verifySignatures:ro}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},eo),no=this.serializeMessage();if(ro){const io=this._getMessageSignednessErrors(no,to);if(io){let oo="Signature verification failed.";throw io.invalid&&(oo+=` + `;try{return yield send([script(to)]).then(decode$2)}catch(ro){logger$9.error(ro);return}}else return})}endSession(){return __awaiter$6(this,void 0,void 0,function*(){currentUser().unauthenticate()})}switchNetwork(){return __awaiter$6(this,void 0,void 0,function*(){throw new DynamicError("Not supported")})}getConnectedAccounts(){return __awaiter$6(this,void 0,void 0,function*(){const eo=yield currentUser().snapshot();return eo.addr?[eo.addr]:[]})}signDelay(){return __awaiter$6(this,void 0,void 0,function*(){return Promise.resolve()})}}class Blocto extends FlowWalletConnector{constructor(){super(...arguments),this.name="Blocto",this.overrideKey="blocto",this.canConnectViaCustodialService=!0}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),yield config().put("challenge.scope","email").put("discovery.wallet",this.network==="testnet"?"https://wallet-v2-dev.blocto.app/api/flow/authn":"https://wallet-v2.blocto.app/api/flow/authn").put("service.OpenID.scopes","email!").put("discovery.wallet.method","HTTP/POST")})}}class Dapper extends FlowWalletConnector{constructor(){super(...arguments),this.name="Dapper",this.overrideKey="dapper",this.canConnectViaCustodialService=!0}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),yield config().put("challenge.scope",void 0).put("discovery.wallet",this.network==="testnet"?"https://staging.accounts.meetdapper.com/fcl/authn-restricted":"https://accounts.meetdapper.com/fcl/authn-restricted").put("service.OpenID.scopes",void 0).put("discovery.wallet.method","POP/RPC")})}}class Lilico extends FlowWalletConnector{constructor(){super(...arguments),this.name="Lilico",this.overrideKey="lilico"}setupConfig(){const eo=Object.create(null,{setupConfig:{get:()=>super.setupConfig}});return __awaiter$6(this,void 0,void 0,function*(){yield eo.setupConfig.call(this),config().put("challenge.scope",void 0).put("discovery.wallet","chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html").put("service.OpenID.scopes",void 0).put("discovery.wallet.method","EXT/RPC")})}isInstalledOnBrowser(){var eo;return typeof window>"u"?!1:!!(!((eo=window.fcl_extensions)===null||eo===void 0)&&eo.some(to=>to.id==="hpclkefagolihohboafpheddmmgdffjm"))}signDelay(){return __awaiter$6(this,void 0,void 0,function*(){return isMobile$1()?Promise.resolve():new Promise(eo=>{setTimeout(()=>{eo()},500)})})}}assertPackageVersion("@dynamic-labs/flow",version$a);const FlowWalletConnectors=Xr=>[Blocto,Dapper,Lilico];var version$9="3.5.1",version$8="3.5.1";function __awaiter$5(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$9=BigInt(0),_1n$a=BigInt(1),_2n$6=BigInt(2),_8n$2=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts$4(Xr){const eo=validateBasic$2(Xr);return validateObject$2(Xr,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...eo})}function twistedEdwards(Xr){const eo=validateOpts$4(Xr),{Fp:to,n:ro,prehash:no,hash:io,randomBytes:oo,nByteLength:ao,h:so}=eo,co=_2n$6<{try{return{isValid:!0,value:to.sqrt(So*to.inv(To))}}catch{return{isValid:!1,value:_0n$9}}}),go=eo.adjustScalarBytes||(So=>So),bo=eo.domain||((So,To,Ao)=>{if(abool("phflag",Ao),To.length||Ao)throw new Error("Contexts/pre-hash are not supported");return So});function wo(So,To){aInRange("coordinate "+So,To,_0n$9,co)}function Eo(So){if(!(So instanceof Ro))throw new Error("ExtendedPoint expected")}const $o=memoized((So,To)=>{const{ex:Ao,ey:ko,ez:mo}=So,Io=So.is0();To==null&&(To=Io?_8n$2:to.inv(mo));const Do=lo(Ao*To),Lo=lo(ko*To),Ho=lo(mo*To);if(Io)return{x:_0n$9,y:_1n$a};if(Ho!==_1n$a)throw new Error("invZ was invalid");return{x:Do,y:Lo}}),Co=memoized(So=>{const{a:To,d:Ao}=eo;if(So.is0())throw new Error("bad point: ZERO");const{ex:ko,ey:mo,ez:Io,et:Do}=So,Lo=lo(ko*ko),Ho=lo(mo*mo),Yo=lo(Io*Io),Xo=lo(Yo*Yo),qo=lo(Lo*To),Ko=lo(Yo*lo(qo+Ho)),Qo=lo(Xo+lo(Ao*lo(Lo*Ho)));if(Ko!==Qo)throw new Error("bad point: equation left != right (1)");const zo=lo(ko*mo),ga=lo(Io*Do);if(zo!==ga)throw new Error("bad point: equation left != right (2)");return!0});class Ro{constructor(To,Ao,ko,mo){this.ex=To,this.ey=Ao,this.ez=ko,this.et=mo,wo("x",To),wo("y",Ao),wo("z",ko),wo("t",mo),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(To){if(To instanceof Ro)throw new Error("extended point not allowed");const{x:Ao,y:ko}=To||{};return wo("x",Ao),wo("y",ko),new Ro(Ao,ko,_1n$a,lo(Ao*ko))}static normalizeZ(To){const Ao=to.invertBatch(To.map(ko=>ko.ez));return To.map((ko,mo)=>ko.toAffine(Ao[mo])).map(Ro.fromAffine)}static msm(To,Ao){return pippenger(Ro,uo,To,Ao)}_setWindowSize(To){Bo.setWindowSize(this,To)}assertValidity(){Co(this)}equals(To){Eo(To);const{ex:Ao,ey:ko,ez:mo}=this,{ex:Io,ey:Do,ez:Lo}=To,Ho=lo(Ao*Lo),Yo=lo(Io*mo),Xo=lo(ko*Lo),qo=lo(Do*mo);return Ho===Yo&&Xo===qo}is0(){return this.equals(Ro.ZERO)}negate(){return new Ro(lo(-this.ex),this.ey,this.ez,lo(-this.et))}double(){const{a:To}=eo,{ex:Ao,ey:ko,ez:mo}=this,Io=lo(Ao*Ao),Do=lo(ko*ko),Lo=lo(_2n$6*lo(mo*mo)),Ho=lo(To*Io),Yo=Ao+ko,Xo=lo(lo(Yo*Yo)-Io-Do),qo=Ho+Do,Ko=qo-Lo,Qo=Ho-Do,zo=lo(Xo*Ko),ga=lo(qo*Qo),$a=lo(Xo*Qo),Sl=lo(Ko*qo);return new Ro(zo,ga,Sl,$a)}add(To){Eo(To);const{a:Ao,d:ko}=eo,{ex:mo,ey:Io,ez:Do,et:Lo}=this,{ex:Ho,ey:Yo,ez:Xo,et:qo}=To;if(Ao===BigInt(-1)){const Dl=lo((Io-mo)*(Yo+Ho)),Fl=lo((Io+mo)*(Yo-Ho)),Jl=lo(Fl-Dl);if(Jl===_0n$9)return this.double();const cu=lo(Do*_2n$6*qo),Ll=lo(Lo*_2n$6*Xo),Xl=Ll+cu,ku=Fl+Dl,iu=Ll-cu,hu=lo(Xl*Jl),Cu=lo(ku*iu),_l=lo(Xl*iu),Go=lo(Jl*ku);return new Ro(hu,Cu,Go,_l)}const Ko=lo(mo*Ho),Qo=lo(Io*Yo),zo=lo(Lo*ko*qo),ga=lo(Do*Xo),$a=lo((mo+Io)*(Ho+Yo)-Ko-Qo),Sl=ga-zo,El=ga+zo,Tl=lo(Qo-Ao*Ko),Il=lo($a*Sl),Zl=lo(El*Tl),Vl=lo($a*Tl),Ol=lo(Sl*El);return new Ro(Il,Zl,Ol,Vl)}subtract(To){return this.add(To.negate())}wNAF(To){return Bo.wNAFCached(this,To,Ro.normalizeZ)}multiply(To){const Ao=To;aInRange("scalar",Ao,_1n$a,ro);const{p:ko,f:mo}=this.wNAF(Ao);return Ro.normalizeZ([ko,mo])[0]}multiplyUnsafe(To){const Ao=To;return aInRange("scalar",Ao,_0n$9,ro),Ao===_0n$9?jo:this.equals(jo)||Ao===_1n$a?this:this.equals(Oo)?this.wNAF(Ao).p:Bo.unsafeLadder(this,Ao)}isSmallOrder(){return this.multiplyUnsafe(so).is0()}isTorsionFree(){return Bo.unsafeLadder(this,ro).is0()}toAffine(To){return $o(this,To)}clearCofactor(){const{h:To}=eo;return To===_1n$a?this:this.multiplyUnsafe(To)}static fromHex(To,Ao=!1){const{d:ko,a:mo}=eo,Io=to.BYTES;To=ensureBytes$3("pointHex",To,Io),abool("zip215",Ao);const Do=To.slice(),Lo=To[Io-1];Do[Io-1]=Lo&-129;const Ho=bytesToNumberLE$2(Do),Yo=Ao?co:to.ORDER;aInRange("pointHex.y",Ho,_0n$9,Yo);const Xo=lo(Ho*Ho),qo=lo(Xo-_1n$a),Ko=lo(ko*Xo-mo);let{isValid:Qo,value:zo}=ho(qo,Ko);if(!Qo)throw new Error("Point.fromHex: invalid y coordinate");const ga=(zo&_1n$a)===_1n$a,$a=(Lo&128)!==0;if(!Ao&&zo===_0n$9&&$a)throw new Error("Point.fromHex: x=0 and x_0=1");return $a!==ga&&(zo=lo(-zo)),Ro.fromAffine({x:zo,y:Ho})}static fromPrivateKey(To){return Wo(To).point}toRawBytes(){const{x:To,y:Ao}=this.toAffine(),ko=numberToBytesLE$2(Ao,to.BYTES);return ko[ko.length-1]|=To&_1n$a?128:0,ko}toHex(){return bytesToHex$3(this.toRawBytes())}}Ro.BASE=new Ro(eo.Gx,eo.Gy,_1n$a,lo(eo.Gx*eo.Gy)),Ro.ZERO=new Ro(_0n$9,_1n$a,_1n$a,_0n$9);const{BASE:Oo,ZERO:jo}=Ro,Bo=wNAF$2(Ro,ao*8);function Mo(So){return mod$2(So,ro)}function Fo(So){return Mo(bytesToNumberLE$2(So))}function Wo(So){const To=ao;So=ensureBytes$3("private key",So,To);const Ao=ensureBytes$3("hashed private key",io(So),2*To),ko=go(Ao.slice(0,To)),mo=Ao.slice(To,2*To),Io=Fo(ko),Do=Oo.multiply(Io),Lo=Do.toRawBytes();return{head:ko,prefix:mo,scalar:Io,point:Do,pointBytes:Lo}}function Jo(So){return Wo(So).pointBytes}function Po(So=new Uint8Array,...To){const Ao=concatBytes$4(...To);return Fo(io(bo(Ao,ensureBytes$3("context",So),!!no)))}function fo(So,To,Ao={}){So=ensureBytes$3("message",So),no&&(So=no(So));const{prefix:ko,scalar:mo,pointBytes:Io}=Wo(To),Do=Po(Ao.context,ko,So),Lo=Oo.multiply(Do).toRawBytes(),Ho=Po(Ao.context,Lo,Io,So),Yo=Mo(Do+Ho*mo);aInRange("signature.s",Yo,_0n$9,ro);const Xo=concatBytes$4(Lo,numberToBytesLE$2(Yo,to.BYTES));return ensureBytes$3("result",Xo,ao*2)}const yo=VERIFY_DEFAULT;function vo(So,To,Ao,ko=yo){const{context:mo,zip215:Io}=ko,Do=to.BYTES;So=ensureBytes$3("signature",So,2*Do),To=ensureBytes$3("message",To),Io!==void 0&&abool("zip215",Io),no&&(To=no(To));const Lo=bytesToNumberLE$2(So.slice(Do,2*Do));let Ho,Yo,Xo;try{Ho=Ro.fromHex(Ao,Io),Yo=Ro.fromHex(So.slice(0,Do),Io),Xo=Oo.multiplyUnsafe(Lo)}catch{return!1}if(!Io&&Ho.isSmallOrder())return!1;const qo=Po(mo,Yo.toRawBytes(),Ho.toRawBytes(),To);return Yo.add(Ho.multiplyUnsafe(qo)).subtract(Xo).clearCofactor().equals(Ro.ZERO)}return Oo._setWindowSize(8),{CURVE:eo,getPublicKey:Jo,sign:fo,verify:vo,ExtendedPoint:Ro,utils:{getExtendedPublicKey:Wo,randomPrivateKey:()=>oo(to.BYTES),precompute(So=8,To=Ro.BASE){return To._setWindowSize(So),To.multiply(BigInt(3)),To}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$9=BigInt(1),_2n$5=BigInt(2);BigInt(3);const _5n$1=BigInt(5),_8n$1=BigInt(8);function ed25519_pow_2_252_3(Xr){const eo=BigInt(10),to=BigInt(20),ro=BigInt(40),no=BigInt(80),io=ED25519_P,ao=Xr*Xr%io*Xr%io,so=pow2(ao,_2n$5,io)*ao%io,co=pow2(so,_1n$9,io)*Xr%io,lo=pow2(co,_5n$1,io)*co%io,uo=pow2(lo,eo,io)*lo%io,ho=pow2(uo,to,io)*uo%io,go=pow2(ho,ro,io)*ho%io,bo=pow2(go,no,io)*go%io,wo=pow2(bo,no,io)*go%io,Eo=pow2(wo,eo,io)*lo%io;return{pow_p_5_8:pow2(Eo,_2n$5,io)*Xr%io,b2:ao}}function adjustScalarBytes(Xr){return Xr[0]&=248,Xr[31]&=127,Xr[31]|=64,Xr}function uvRatio(Xr,eo){const to=ED25519_P,ro=mod$2(eo*eo*eo,to),no=mod$2(ro*ro*eo,to),io=ed25519_pow_2_252_3(Xr*no).pow_p_5_8;let oo=mod$2(Xr*ro*io,to);const ao=mod$2(eo*oo*oo,to),so=oo,co=mod$2(oo*ED25519_SQRT_M1,to),lo=ao===Xr,uo=ao===mod$2(-Xr,to),ho=ao===mod$2(-Xr*ED25519_SQRT_M1,to);return lo&&(oo=so),(uo||ho)&&(oo=co),isNegativeLE(oo,to)&&(oo=mod$2(-oo,to)),{isValid:lo||uo,value:oo}}const Fp=Field$2(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n$1,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512$3,randomBytes:randomBytes$1,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var _Buffer=safeBufferExports.Buffer;function base(Xr){if(Xr.length>=255)throw new TypeError("Alphabet too long");for(var eo=new Uint8Array(256),to=0;to>>0,Ro=new Uint8Array(Co);Eo!==$o;){for(var Oo=go[Eo],jo=0,Bo=Co-1;(Oo!==0||jo>>0,Ro[Bo]=Oo%oo>>>0,Oo=Oo/oo>>>0;if(Oo!==0)throw new Error("Non-zero carry");wo=jo,Eo++}for(var Mo=Co-wo;Mo!==Co&&Ro[Mo]===0;)Mo++;for(var Fo=ao.repeat(bo);Mo>>0,Co=new Uint8Array($o);bo>>0,Co[jo]=Ro%256>>>0,Ro=Ro/256>>>0;if(Ro!==0)throw new Error("Non-zero carry");Eo=Oo,bo++}for(var Bo=$o-Eo;Bo!==$o&&Co[Bo]===0;)Bo++;var Mo=_Buffer.allocUnsafe(wo+($o-Bo));Mo.fill(0,0,wo);for(var Fo=wo;Bo!==$o;)Mo[Fo++]=Co[Bo++];return Mo}function ho(go){var bo=uo(go);if(bo)return bo;throw new Error("Non-base"+oo+" character")}return{encode:lo,decodeUnsafe:uo,decode:ho}}var src=base,basex$1=src,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex$1(ALPHABET$1);const bs58$3=getDefaultExportFromCjs$2(bs58$2);var lib={};function inRange(Xr,eo,to){return eo<=Xr&&Xr<=to}function ToDictionary(Xr){if(Xr===void 0)return{};if(Xr===Object(Xr))return Xr;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(Xr){for(var eo=String(Xr),to=eo.length,ro=0,no=[];ro57343)no.push(io);else if(56320<=io&&io<=57343)no.push(65533);else if(55296<=io&&io<=56319)if(ro===to-1)no.push(65533);else{var oo=Xr.charCodeAt(ro+1);if(56320<=oo&&oo<=57343){var ao=io&1023,so=oo&1023;no.push(65536+(ao<<10)+so),ro+=1}else no.push(65533)}ro+=1}return no}function codePointsToString(Xr){for(var eo="",to=0;to>10)+55296,(ro&1023)+56320))}return eo}var end_of_stream=-1;function Stream(Xr){this.tokens=[].slice.call(Xr)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(Xr){if(Array.isArray(Xr))for(var eo=Xr;eo.length;)this.tokens.unshift(eo.pop());else this.tokens.unshift(Xr)},push:function(Xr){if(Array.isArray(Xr))for(var eo=Xr;eo.length;)this.tokens.push(eo.shift());else this.tokens.push(Xr)}};var finished=-1;function decoderError(Xr,eo){if(Xr)throw TypeError("Decoder error");return eo||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(Xr,eo){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(Xr,eo);if(Xr=Xr!==void 0?String(Xr).toLowerCase():DEFAULT_ENCODING,Xr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");eo=ToDictionary(eo),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!eo.fatal,this._ignoreBOM=!!eo.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function Xr(eo,to){var ro;typeof eo=="object"&&eo instanceof ArrayBuffer?ro=new Uint8Array(eo):typeof eo=="object"&&"buffer"in eo&&eo.buffer instanceof ArrayBuffer?ro=new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength):ro=new Uint8Array(0),to=ToDictionary(to),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!to.stream;for(var no=new Stream(ro),io=[],oo;!no.endOfStream()&&(oo=this._decoder.handler(no,no.read()),oo!==finished);)oo!==null&&(Array.isArray(oo)?io.push.apply(io,oo):io.push(oo));if(!this._streaming){do{if(oo=this._decoder.handler(no,no.read()),oo===finished)break;oo!==null&&(Array.isArray(oo)?io.push.apply(io,oo):io.push(oo))}while(!no.endOfStream());this._decoder=null}return io.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(io[0]===65279?(this._BOMseen=!0,io.shift()):this._BOMseen=!0),codePointsToString(io)}};function TextEncoder$1(Xr,eo){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(Xr,eo);if(Xr=Xr!==void 0?String(Xr).toLowerCase():DEFAULT_ENCODING,Xr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");eo=ToDictionary(eo),this._streaming=!1,this._encoder=null,this._options={fatal:!!eo.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function Xr(eo,to){eo=eo?String(eo):"",to=ToDictionary(to),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!to.stream;for(var ro=[],no=new Stream(stringToCodePoints(eo)),io;!no.endOfStream()&&(io=this._encoder.handler(no,no.read()),io!==finished);)Array.isArray(io)?ro.push.apply(ro,io):ro.push(io);if(!this._streaming){for(;io=this._encoder.handler(no,no.read()),io!==finished;)Array.isArray(io)?ro.push.apply(ro,io):ro.push(io);this._encoder=null}return new Uint8Array(ro)}};function UTF8Decoder(Xr){var eo=Xr.fatal,to=0,ro=0,no=0,io=128,oo=191;this.handler=function(ao,so){if(so===end_of_stream&&no!==0)return no=0,decoderError(eo);if(so===end_of_stream)return finished;if(no===0){if(inRange(so,0,127))return so;if(inRange(so,194,223))no=1,to=so-192;else if(inRange(so,224,239))so===224&&(io=160),so===237&&(oo=159),no=2,to=so-224;else if(inRange(so,240,244))so===240&&(io=144),so===244&&(oo=143),no=3,to=so-240;else return decoderError(eo);return to=to<<6*no,null}if(!inRange(so,io,oo))return to=no=ro=0,io=128,oo=191,ao.prepend(so),decoderError(eo);if(io=128,oo=191,ro+=1,to+=so-128<<6*(no-ro),ro!==no)return null;var co=to;return to=no=ro=0,co}}function UTF8Encoder(Xr){Xr.fatal,this.handler=function(eo,to){if(to===end_of_stream)return finished;if(inRange(to,0,127))return to;var ro,no;inRange(to,128,2047)?(ro=1,no=192):inRange(to,2048,65535)?(ro=2,no=224):inRange(to,65536,1114111)&&(ro=3,no=240);for(var io=[(to>>6*ro)+no];ro>0;){var oo=to>>6*(ro-1);io.push(128|oo&63),ro-=1}return io}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2=getAugmentedNamespace(encoding$1);var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(Xr,eo,to,ro){ro===void 0&&(ro=to),Object.defineProperty(Xr,ro,{enumerable:!0,get:function(){return eo[to]}})}:function(Xr,eo,to,ro){ro===void 0&&(ro=to),Xr[ro]=eo[to]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(Xr,eo){Object.defineProperty(Xr,"default",{enumerable:!0,value:eo})}:function(Xr,eo){Xr.default=eo}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(Xr,eo,to,ro){var no=arguments.length,io=no<3?eo:ro===null?ro=Object.getOwnPropertyDescriptor(eo,to):ro,oo;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")io=Reflect.decorate(Xr,eo,to,ro);else for(var ao=Xr.length-1;ao>=0;ao--)(oo=Xr[ao])&&(io=(no<3?oo(io):no>3?oo(eo,to,io):oo(eo,to))||io);return no>3&&io&&Object.defineProperty(eo,to,io),io},__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(Xr){if(Xr&&Xr.__esModule)return Xr;var eo={};if(Xr!=null)for(var to in Xr)to!=="default"&&Object.hasOwnProperty.call(Xr,to)&&__createBinding(eo,Xr,to);return __setModuleDefault(eo,Xr),eo},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(Xr){return Xr&&Xr.__esModule?Xr:{default:Xr}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1=__importDefault(bnExports),bs58_1=__importDefault(bs58$2),encoding=__importStar(require$$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(Xr){return typeof Xr=="string"&&(Xr=Buffer$3.from(Xr,"utf8")),bs58_1.default.encode(Buffer$3.from(Xr))}lib.baseEncode=baseEncode;function baseDecode(Xr){return Buffer$3.from(bs58_1.default.decode(Xr))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(eo){super(eo),this.fieldPath=[],this.originalMessage=eo}addToFieldPath(eo){this.fieldPath.splice(0,0,eo),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$3.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$3.concat([this.buf,Buffer$3.alloc(INITIAL_LENGTH)]))}writeU8(eo){this.maybeResize(),this.buf.writeUInt8(eo,this.length),this.length+=1}writeU16(eo){this.maybeResize(),this.buf.writeUInt16LE(eo,this.length),this.length+=2}writeU32(eo){this.maybeResize(),this.buf.writeUInt32LE(eo,this.length),this.length+=4}writeU64(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",8)))}writeU128(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",16)))}writeU256(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",32)))}writeU512(eo){this.maybeResize(),this.writeBuffer(Buffer$3.from(new bn_js_1.default(eo).toArray("le",64)))}writeBuffer(eo){this.buf=Buffer$3.concat([Buffer$3.from(this.buf.subarray(0,this.length)),eo,Buffer$3.alloc(INITIAL_LENGTH)]),this.length+=eo.length}writeString(eo){this.maybeResize();const to=Buffer$3.from(eo,"utf8");this.writeU32(to.length),this.writeBuffer(to)}writeFixedArray(eo){this.writeBuffer(Buffer$3.from(eo))}writeArray(eo,to){this.maybeResize(),this.writeU32(eo.length);for(const ro of eo)this.maybeResize(),to(ro)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(Xr,eo,to){const ro=to.value;to.value=function(...no){try{return ro.apply(this,no)}catch(io){if(io instanceof RangeError){const oo=io.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(oo)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw io}}}class BinaryReader{constructor(eo){this.buf=eo,this.offset=0}readU8(){const eo=this.buf.readUInt8(this.offset);return this.offset+=1,eo}readU16(){const eo=this.buf.readUInt16LE(this.offset);return this.offset+=2,eo}readU32(){const eo=this.buf.readUInt32LE(this.offset);return this.offset+=4,eo}readU64(){const eo=this.readBuffer(8);return new bn_js_1.default(eo,"le")}readU128(){const eo=this.readBuffer(16);return new bn_js_1.default(eo,"le")}readU256(){const eo=this.readBuffer(32);return new bn_js_1.default(eo,"le")}readU512(){const eo=this.readBuffer(64);return new bn_js_1.default(eo,"le")}readBuffer(eo){if(this.offset+eo>this.buf.length)throw new BorshError(`Expected buffer length ${eo} isn't within bounds`);const to=this.buf.slice(this.offset,this.offset+eo);return this.offset+=eo,to}readString(){const eo=this.readU32(),to=this.readBuffer(eo);try{return textDecoder.decode(to)}catch(ro){throw new BorshError(`Error decoding UTF-8 string: ${ro}`)}}readFixedArray(eo){return new Uint8Array(this.readBuffer(eo))}readArray(eo){const to=this.readU32(),ro=Array();for(let no=0;no{serializeField(Xr,eo,io,ro[0],no)});else if(ro.kind!==void 0)switch(ro.kind){case"option":{to==null?no.writeU8(0):(no.writeU8(1),serializeField(Xr,eo,to,ro.type,no));break}case"map":{no.writeU32(to.size),to.forEach((io,oo)=>{serializeField(Xr,eo,oo,ro.key,no),serializeField(Xr,eo,io,ro.value,no)});break}default:throw new BorshError(`FieldType ${ro} unrecognized`)}else serializeStruct(Xr,to,no)}catch(io){throw io instanceof BorshError&&io.addToFieldPath(eo),io}}function serializeStruct(Xr,eo,to){if(typeof eo.borshSerialize=="function"){eo.borshSerialize(to);return}const ro=Xr.get(eo.constructor);if(!ro)throw new BorshError(`Class ${eo.constructor.name} is missing in schema`);if(ro.kind==="struct")ro.fields.map(([no,io])=>{serializeField(Xr,no,eo[no],io,to)});else if(ro.kind==="enum"){const no=eo[ro.field];for(let io=0;iodeserializeField(Xr,eo,to[0],ro))}if(to.kind==="option")return ro.readU8()?deserializeField(Xr,eo,to.type,ro):void 0;if(to.kind==="map"){let no=new Map;const io=ro.readU32();for(let oo=0;oo=ro.values.length)throw new BorshError(`Enum index: ${no} is out of range`);const[io,oo]=ro.values[no],ao=deserializeField(Xr,io,oo,to);return new eo({[io]:ao})}throw new BorshError(`Unexpected schema kind: ${ro.kind} for ${eo.constructor.name}`)}function deserialize(Xr,eo,to,ro=BinaryReader){const no=new ro(to),io=deserializeStruct(Xr,eo,no);if(no.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(eo){const to=Object.create(this.constructor.prototype);return Object.assign(to,this),to.property=eo,to}fromArray(eo){}}Layout$1.Layout=Layout;function nameWithProperty(Xr,eo){return eo.property?Xr+"["+eo.property+"]":Xr}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(Xr,eo){if(typeof Xr!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(Xr,"layout_"))throw new Error("Class is already bound to a layout");if(!(eo&&eo instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(eo,"boundConstructor_"))throw new Error("layout is already bound to a constructor");Xr.layout_=eo,eo.boundConstructor_=Xr,eo.makeDestinationObject=()=>new Xr,Object.defineProperty(Xr.prototype,"encode",{value(to,ro){return eo.encode(this,to,ro)},writable:!0}),Object.defineProperty(Xr,"decode",{value(to,ro){return eo.decode(to,ro)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(eo=1,to){if(!Number.isInteger(eo)||0>=eo)throw new TypeError("elementSpan must be a (positive) integer");super(-1,to),this.elementSpan=eo}isCount(){return!0}decode(eo,to=0){checkUint8Array(eo);const ro=eo.length-to;return Math.floor(ro/this.elementSpan)}encode(eo,to,ro){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(eo,to=0,ro){if(!(eo instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(to))throw new TypeError("offset must be integer or undefined");super(eo.span,ro||eo.property),this.layout=eo,this.offset=to}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(eo,to=0){return this.layout.decode(eo,to+this.offset)}encode(eo,to,ro=0){return this.layout.encode(eo,to,ro+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(eo,to){if(super(eo,to),6oo+no.encode(ao,to,ro+oo),0);return this.count instanceof ExternalLayout&&this.count.encode(eo.length,to,ro),io}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(eo,to,ro){if(!(Array.isArray(eo)&&eo.reduce((io,oo)=>io&&oo instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof to=="boolean"&&ro===void 0&&(ro=to,to=void 0);for(const io of eo)if(0>io.span&&io.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let no=-1;try{no=eo.reduce((io,oo)=>io+oo.getSpan(),0)}catch{}super(no,to),this.fields=eo,this.decodePrefixes=!!ro}getSpan(eo,to=0){if(0<=this.span)return this.span;let ro=0;try{ro=this.fields.reduce((no,io)=>{const oo=io.getSpan(eo,to);return to+=oo,no+oo},0)}catch{throw new RangeError("indeterminate span")}return ro}decode(eo,to=0){checkUint8Array(eo);const ro=this.makeDestinationObject();for(const no of this.fields)if(no.property!==void 0&&(ro[no.property]=no.decode(eo,to)),to+=no.getSpan(eo,to),this.decodePrefixes&&eo.length===to)break;return ro}encode(eo,to,ro=0){const no=ro;let io=0,oo=0;for(const ao of this.fields){let so=ao.span;if(oo=0so&&(so=ao.getSpan(to,ro)))}io=ro,ro+=so}return io+oo-no}fromArray(eo){const to=this.makeDestinationObject();for(const ro of this.fields)ro.property!==void 0&&0ro.span?to=-1:0<=to&&(to+=ro.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(eo){this.property=eo}decode(eo,to){throw new Error("UnionDiscriminator is abstract")}encode(eo,to,ro){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(eo,to){if(!(eo instanceof ExternalLayout&&eo.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(to||eo.property||"variant"),this.layout=eo}decode(eo,to){return this.layout.decode(eo,to)}encode(eo,to,ro){return this.layout.encode(eo,to,ro)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(eo,to,ro){let no;if(eo instanceof UInt||eo instanceof UIntBE)no=new UnionLayoutDiscriminator(new OffsetLayout(eo));else if(eo instanceof ExternalLayout&&eo.isCount())no=new UnionLayoutDiscriminator(eo);else if(eo instanceof UnionDiscriminator)no=eo;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(to===void 0&&(to=null),!(to===null||to instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(to!==null){if(0>to.span)throw new Error("defaultLayout must have constant span");to.property===void 0&&(to=to.replicate("content"))}let io=-1;to&&(io=to.span,0<=io&&(eo instanceof UInt||eo instanceof UIntBE)&&(io+=no.layout.span)),super(io,ro),this.discriminator=no,this.usesPrefixDiscriminator=eo instanceof UInt||eo instanceof UIntBE,this.defaultLayout=to,this.registry={};let oo=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(ao){return oo(ao)},this.configGetSourceVariant=function(ao){oo=ao.bind(this)}}getSpan(eo,to=0){if(0<=this.span)return this.span;const ro=this.getVariant(eo,to);if(!ro)throw new Error("unable to determine span for unrecognized variant");return ro.getSpan(eo,to)}defaultGetSourceVariant(eo){if(Object.prototype.hasOwnProperty.call(eo,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(eo,this.defaultLayout.property))return;const to=this.registry[eo[this.discriminator.property]];if(to&&(!to.layout||to.property&&Object.prototype.hasOwnProperty.call(eo,to.property)))return to}else for(const to in this.registry){const ro=this.registry[to];if(ro.property&&Object.prototype.hasOwnProperty.call(eo,ro.property))return ro}throw new Error("unable to infer src variant")}decode(eo,to=0){let ro;const no=this.discriminator,io=no.decode(eo,to),oo=this.registry[io];if(oo===void 0){const ao=this.defaultLayout;let so=0;this.usesPrefixDiscriminator&&(so=no.layout.span),ro=this.makeDestinationObject(),ro[no.property]=io,ro[ao.property]=ao.decode(eo,to+so)}else ro=oo.decode(eo,to);return ro}encode(eo,to,ro=0){const no=this.getSourceVariant(eo);if(no===void 0){const io=this.discriminator,oo=this.defaultLayout;let ao=0;return this.usesPrefixDiscriminator&&(ao=io.layout.span),io.encode(eo[io.property],to,ro),ao+oo.encode(eo[oo.property],to,ro+ao)}return no.encode(eo,to,ro)}addVariant(eo,to,ro){const no=new VariantLayout(this,eo,to,ro);return this.registry[eo]=no,no}getVariant(eo,to=0){let ro;return eo instanceof Uint8Array?ro=this.discriminator.decode(eo,to):ro=eo,this.registry[ro]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(eo,to,ro,no){if(!(eo instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(to)||0>to)throw new TypeError("variant must be a (non-negative) integer");if(typeof ro=="string"&&no===void 0&&(no=ro,ro=null),ro){if(!(ro instanceof Layout))throw new TypeError("layout must be a Layout");if(eo.defaultLayout!==null&&0<=ro.span&&ro.span>eo.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof no!="string")throw new TypeError("variant must have a String property")}let io=eo.span;0>eo.span&&(io=ro?ro.span:0,0<=io&&eo.usesPrefixDiscriminator&&(io+=eo.discriminator.layout.span)),super(io,no),this.union=eo,this.variant=to,this.layout=ro||null}getSpan(eo,to=0){if(0<=this.span)return this.span;let ro=0;this.union.usesPrefixDiscriminator&&(ro=this.union.discriminator.layout.span);let no=0;return this.layout&&(no=this.layout.getSpan(eo,to+ro)),ro+no}decode(eo,to=0){const ro=this.makeDestinationObject();if(this!==this.union.getVariant(eo,to))throw new Error("variant mismatch");let no=0;return this.union.usesPrefixDiscriminator&&(no=this.union.discriminator.layout.span),this.layout?ro[this.property]=this.layout.decode(eo,to+no):this.property?ro[this.property]=!0:this.union.usesPrefixDiscriminator&&(ro[this.union.discriminator.property]=this.variant),ro}encode(eo,to,ro=0){let no=0;if(this.union.usesPrefixDiscriminator&&(no=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(eo,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,to,ro);let io=no;if(this.layout&&(this.layout.encode(eo[this.property],to,ro+no),io+=this.layout.getSpan(to,ro+no),0<=this.union.span&&io>this.union.span))throw new Error("encoded variant overruns containing union");return io}fromArray(eo){if(this.layout)return this.layout.fromArray(eo)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(Xr){return 0>Xr&&(Xr+=4294967296),Xr}class BitStructure extends Layout{constructor(eo,to,ro){if(!(eo instanceof UInt||eo instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof to=="string"&&ro===void 0&&(ro=to,to=!1),4=to)throw new TypeError("bits must be positive integer");const no=8*eo.span,io=eo.fields.reduce((oo,ao)=>oo+ao.bits,0);if(to+io>no)throw new Error("bits too long for span remainder ("+(no-io)+" of "+no+" remain)");this.container=eo,this.bits=to,this.valueMask=(1<>>this.start}encode(eo){if(typeof eo!="number"||!Number.isInteger(eo)||eo!==fixBitwiseResult(eo&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const to=this.container._packedGetValue(),ro=fixBitwiseResult(eo<ro&&(ro=this.length.decode(eo,to)),ro}decode(eo,to=0){let ro=this.span;return 0>ro&&(ro=this.length.decode(eo,to)),uint8ArrayToBuffer(eo).slice(to,to+ro)}encode(eo,to,ro){let no=this.length;if(this.length instanceof ExternalLayout&&(no=eo.length),!(eo instanceof Uint8Array&&no===eo.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+no+") Uint8Array as src");if(ro+no>to.length)throw new RangeError("encoding overruns Uint8Array");const io=uint8ArrayToBuffer(eo);return uint8ArrayToBuffer(to).write(io.toString("hex"),ro,no,"hex"),this.length instanceof ExternalLayout&&this.length.encode(no,to,ro),no}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(eo){super(-1,eo)}getSpan(eo,to=0){checkUint8Array(eo);let ro=to;for(;roto.length)throw new RangeError("encoding overruns Buffer");const oo=uint8ArrayToBuffer(to);return no.copy(oo,ro),oo[ro+io]=0,io+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(eo,to){if(typeof eo=="string"&&to===void 0&&(to=eo,eo=void 0),eo===void 0)eo=-1;else if(!Number.isInteger(eo))throw new TypeError("maxSpan must be an integer");super(-1,to),this.maxSpan=eo}getSpan(eo,to=0){return checkUint8Array(eo),eo.length-to}decode(eo,to=0){const ro=this.getSpan(eo,to);if(0<=this.maxSpan&&this.maxSpanto.length)throw new RangeError("encoding overruns Buffer");return no.copy(uint8ArrayToBuffer(to),ro),io}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(eo,to){super(0,to),this.value=eo}decode(eo,to){return this.value}encode(eo,to,ro){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(Xr,eo)=>new GreedyCount(Xr,eo);var offset=Layout$1.offset=(Xr,eo,to)=>new OffsetLayout(Xr,eo,to),u8=Layout$1.u8=Xr=>new UInt(1,Xr),u16=Layout$1.u16=Xr=>new UInt(2,Xr);Layout$1.u24=Xr=>new UInt(3,Xr);var u32$1=Layout$1.u32=Xr=>new UInt(4,Xr);Layout$1.u40=Xr=>new UInt(5,Xr);Layout$1.u48=Xr=>new UInt(6,Xr);var nu64=Layout$1.nu64=Xr=>new NearUInt64(Xr);Layout$1.u16be=Xr=>new UIntBE(2,Xr);Layout$1.u24be=Xr=>new UIntBE(3,Xr);Layout$1.u32be=Xr=>new UIntBE(4,Xr);Layout$1.u40be=Xr=>new UIntBE(5,Xr);Layout$1.u48be=Xr=>new UIntBE(6,Xr);Layout$1.nu64be=Xr=>new NearUInt64BE(Xr);Layout$1.s8=Xr=>new Int(1,Xr);Layout$1.s16=Xr=>new Int(2,Xr);Layout$1.s24=Xr=>new Int(3,Xr);Layout$1.s32=Xr=>new Int(4,Xr);Layout$1.s40=Xr=>new Int(5,Xr);Layout$1.s48=Xr=>new Int(6,Xr);var ns64=Layout$1.ns64=Xr=>new NearInt64(Xr);Layout$1.s16be=Xr=>new IntBE(2,Xr);Layout$1.s24be=Xr=>new IntBE(3,Xr);Layout$1.s32be=Xr=>new IntBE(4,Xr);Layout$1.s40be=Xr=>new IntBE(5,Xr);Layout$1.s48be=Xr=>new IntBE(6,Xr);Layout$1.ns64be=Xr=>new NearInt64BE(Xr);Layout$1.f32=Xr=>new Float(Xr);Layout$1.f32be=Xr=>new FloatBE(Xr);Layout$1.f64=Xr=>new Double(Xr);Layout$1.f64be=Xr=>new DoubleBE(Xr);var struct=Layout$1.struct=(Xr,eo,to)=>new Structure(Xr,eo,to);Layout$1.bits=(Xr,eo,to)=>new BitStructure(Xr,eo,to);var seq=Layout$1.seq=(Xr,eo,to)=>new Sequence(Xr,eo,to);Layout$1.union=(Xr,eo,to)=>new Union(Xr,eo,to);Layout$1.unionLayoutDiscriminator=(Xr,eo)=>new UnionLayoutDiscriminator(Xr,eo);var blob=Layout$1.blob=(Xr,eo)=>new Blob$1(Xr,eo);Layout$1.cstr=Xr=>new CString(Xr);Layout$1.utf8=(Xr,eo)=>new UTF8(Xr,eo);Layout$1.constant=(Xr,eo)=>new Constant(Xr,eo);var browser$1={};Object.defineProperty(browser$1,"__esModule",{value:!0});function toBigIntLE(Xr){{const eo=Buffer$3.from(Xr);eo.reverse();const to=eo.toString("hex");return to.length===0?BigInt(0):BigInt(`0x${to}`)}}var toBigIntLE_1=browser$1.toBigIntLE=toBigIntLE;function toBigIntBE(Xr){{const eo=Xr.toString("hex");return eo.length===0?BigInt(0):BigInt(`0x${eo}`)}}browser$1.toBigIntBE=toBigIntBE;function toBufferLE(Xr,eo){{const to=Xr.toString(16),ro=Buffer$3.from(to.padStart(eo*2,"0").slice(0,eo*2),"hex");return ro.reverse(),ro}}var toBufferLE_1=browser$1.toBufferLE=toBufferLE;function toBufferBE(Xr,eo){{const to=Xr.toString(16);return Buffer$3.from(to.padStart(eo*2,"0").slice(0,eo*2),"hex")}}browser$1.toBufferBE=toBufferBE;let StructError$2=class extends TypeError{constructor(eo,to){let ro;const{message:no,explanation:io,...oo}=eo,{path:ao}=eo,so=ao.length===0?no:`At path: ${ao.join(".")} -- ${no}`;super(io??so),io!=null&&(this.cause=so),Object.assign(this,oo),this.name=this.constructor.name,this.failures=()=>ro??(ro=[eo,...to()])}};function isIterable$2(Xr){return isObject$4(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$4(Xr){return typeof Xr=="object"&&Xr!=null}function print$2(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator$2(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure$2(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print$2(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures$2(Xr,eo,to,ro){isIterable$2(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure$2(no,eo,to,ro);io&&(yield io)}}function*run$2(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no};if(io&&(Xr=eo.coercer(Xr,ao),oo&&eo.type!=="type"&&isObject$4(eo.schema)&&isObject$4(Xr)&&!Array.isArray(Xr)))for(const co in Xr)eo.schema[co]===void 0&&delete Xr[co];let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,uo]of eo.entries(Xr,ao)){const ho=run$2(lo,uo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$4(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$5=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures$2(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures$2(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$6(eo,this,to)}create(eo,to){return create$2(eo,this,to)}is(eo){return is$3(eo,this)}mask(eo,to){return mask$2(eo,this,to)}validate(eo,to={}){return validate$3(eo,this,to)}};function assert$6(Xr,eo,to){const ro=validate$3(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create$2(Xr,eo,to){const ro=validate$3(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask$2(Xr,eo,to){const ro=validate$3(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$3(Xr,eo){return!validate$3(Xr,eo)[0]}function validate$3(Xr,eo,to={}){const ro=run$2(Xr,eo,to),no=shiftIterator$2(ro);return no[0]?[new StructError$2(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define$2(Xr,eo){return new Struct$5({type:Xr,schema:null,validator:eo})}function any$2(){return define$2("any",()=>!0)}function array$2(Xr){return new Struct$5({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print$2(eo)}`}})}function boolean$2(){return define$2("boolean",Xr=>typeof Xr=="boolean")}function instance$2(Xr){return define$2("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print$2(eo)}`)}function literal$2(Xr){const eo=print$2(Xr),to=typeof Xr;return new Struct$5({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print$2(ro)}`}})}function never$2(){return define$2("never",()=>!1)}function nullable$2(Xr){return new Struct$5({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$3(){return define$2("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print$2(Xr)}`)}function optional$2(Xr){return new Struct$5({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record$2(Xr,eo){return new Struct$5({type:"record",schema:null,*entries(to){if(isObject$4(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isObject$4(to)||`Expected an object, but received: ${print$2(to)}`}})}function string$2(){return define$2("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print$2(Xr)}`)}function tuple$3(Xr){const eo=never$2();return new Struct$5({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$5({type:"union",schema:null,coercer(to){for(const ro of Xr){const[no,io]=ro.validate(to,{coerce:!0});if(!no)return io}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run$2(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print$2(to)}`,...no]}})}function unknown$2(){return define$2("unknown",()=>!0)}function coerce$2(Xr,eo,to){return new Struct$5({...Xr,coercer:(ro,no)=>is$3(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[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 validate$2(Xr){return typeof Xr=="string"&®EX.test(Xr)}var byteToHex=[];for(var i$1=0;i$1<256;++i$1)byteToHex.push((i$1+256).toString(16).substr(1));function stringify$2(Xr){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,to=(byteToHex[Xr[eo+0]]+byteToHex[Xr[eo+1]]+byteToHex[Xr[eo+2]]+byteToHex[Xr[eo+3]]+"-"+byteToHex[Xr[eo+4]]+byteToHex[Xr[eo+5]]+"-"+byteToHex[Xr[eo+6]]+byteToHex[Xr[eo+7]]+"-"+byteToHex[Xr[eo+8]]+byteToHex[Xr[eo+9]]+"-"+byteToHex[Xr[eo+10]]+byteToHex[Xr[eo+11]]+byteToHex[Xr[eo+12]]+byteToHex[Xr[eo+13]]+byteToHex[Xr[eo+14]]+byteToHex[Xr[eo+15]]).toLowerCase();if(!validate$2(to))throw TypeError("Stringified UUID is invalid");return to}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(Xr,eo,to){var ro=eo&&to||0,no=eo||new Array(16);Xr=Xr||{};var io=Xr.node||_nodeId,oo=Xr.clockseq!==void 0?Xr.clockseq:_clockseq;if(io==null||oo==null){var ao=Xr.random||(Xr.rng||rng)();io==null&&(io=_nodeId=[ao[0]|1,ao[1],ao[2],ao[3],ao[4],ao[5]]),oo==null&&(oo=_clockseq=(ao[6]<<8|ao[7])&16383)}var so=Xr.msecs!==void 0?Xr.msecs:Date.now(),co=Xr.nsecs!==void 0?Xr.nsecs:_lastNSecs+1,lo=so-_lastMSecs+(co-_lastNSecs)/1e4;if(lo<0&&Xr.clockseq===void 0&&(oo=oo+1&16383),(lo<0||so>_lastMSecs)&&Xr.nsecs===void 0&&(co=0),co>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=so,_lastNSecs=co,_clockseq=oo,so+=122192928e5;var uo=((so&268435455)*1e4+co)%4294967296;no[ro++]=uo>>>24&255,no[ro++]=uo>>>16&255,no[ro++]=uo>>>8&255,no[ro++]=uo&255;var ho=so/4294967296*1e4&268435455;no[ro++]=ho>>>8&255,no[ro++]=ho&255,no[ro++]=ho>>>24&15|16,no[ro++]=ho>>>16&255,no[ro++]=oo>>>8|128,no[ro++]=oo&255;for(var go=0;go<6;++go)no[ro+go]=io[go];return eo||stringify$2(no)}function parse$1(Xr){if(!validate$2(Xr))throw TypeError("Invalid UUID");var eo,to=new Uint8Array(16);return to[0]=(eo=parseInt(Xr.slice(0,8),16))>>>24,to[1]=eo>>>16&255,to[2]=eo>>>8&255,to[3]=eo&255,to[4]=(eo=parseInt(Xr.slice(9,13),16))>>>8,to[5]=eo&255,to[6]=(eo=parseInt(Xr.slice(14,18),16))>>>8,to[7]=eo&255,to[8]=(eo=parseInt(Xr.slice(19,23),16))>>>8,to[9]=eo&255,to[10]=(eo=parseInt(Xr.slice(24,36),16))/1099511627776&255,to[11]=eo/4294967296&255,to[12]=eo>>>24&255,to[13]=eo>>>16&255,to[14]=eo>>>8&255,to[15]=eo&255,to}function stringToBytes(Xr){Xr=unescape(encodeURIComponent(Xr));for(var eo=[],to=0;to>5]>>>no%32&255,oo=parseInt(ro.charAt(io>>>4&15)+ro.charAt(io&15),16);eo.push(oo)}return eo}function getOutputLength(Xr){return(Xr+64>>>9<<4)+14+1}function wordsToMd5(Xr,eo){Xr[eo>>5]|=128<>5]|=(Xr[ro/8]&255)<>16)+(eo>>16)+(to>>16);return ro<<16|to&65535}function bitRotateLeft(Xr,eo){return Xr<>>32-eo}function md5cmn(Xr,eo,to,ro,no,io){return safeAdd(bitRotateLeft(safeAdd(safeAdd(eo,Xr),safeAdd(ro,io)),no),to)}function md5ff(Xr,eo,to,ro,no,io,oo){return md5cmn(eo&to|~eo&ro,Xr,eo,no,io,oo)}function md5gg(Xr,eo,to,ro,no,io,oo){return md5cmn(eo&ro|to&~ro,Xr,eo,no,io,oo)}function md5hh(Xr,eo,to,ro,no,io,oo){return md5cmn(eo^to^ro,Xr,eo,no,io,oo)}function md5ii(Xr,eo,to,ro,no,io,oo){return md5cmn(to^(eo|~ro),Xr,eo,no,io,oo)}var v3=v35("v3",48,md5);function v4(Xr,eo,to){Xr=Xr||{};var ro=Xr.random||(Xr.rng||rng)();if(ro[6]=ro[6]&15|64,ro[8]=ro[8]&63|128,eo){to=to||0;for(var no=0;no<16;++no)eo[to+no]=ro[no];return eo}return stringify$2(ro)}function f$3(Xr,eo,to,ro){switch(Xr){case 0:return eo&to^~eo&ro;case 1:return eo^to^ro;case 2:return eo&to^eo&ro^to&ro;case 3:return eo^to^ro}}function ROTL(Xr,eo){return Xr<>>32-eo}function sha1(Xr){var eo=[1518500249,1859775393,2400959708,3395469782],to=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof Xr=="string"){var ro=unescape(encodeURIComponent(Xr));Xr=[];for(var no=0;no>>0;Ro=Co,Co=$o,$o=ROTL(Eo,30)>>>0,Eo=wo,wo=Bo}to[0]=to[0]+wo>>>0,to[1]=to[1]+Eo>>>0,to[2]=to[2]+$o>>>0,to[3]=to[3]+Co>>>0,to[4]=to[4]+Ro>>>0}return[to[0]>>24&255,to[0]>>16&255,to[0]>>8&255,to[0]&255,to[1]>>24&255,to[1]>>16&255,to[1]>>8&255,to[1]&255,to[2]>>24&255,to[2]>>16&255,to[2]>>8&255,to[2]&255,to[3]>>24&255,to[3]>>16&255,to[3]>>8&255,to[3]&255,to[4]>>24&255,to[4]>>16&255,to[4]>>8&255,to[4]&255]}var v5=v35("v5",80,sha1);const nil="00000000-0000-0000-0000-000000000000";function version$7(Xr){if(!validate$2(Xr))throw TypeError("Invalid UUID");return parseInt(Xr.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse:parse$1,stringify:stringify$2,v1,v3,v4,v5,validate:validate$2,version:version$7},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esmBrowser),uuid$1=require$$0.v4,generateRequest$1=function(Xr,eo,to,ro){if(typeof Xr!="string")throw new TypeError(Xr+" must be a string");ro=ro||{};const no=typeof ro.version=="number"?ro.version:2;if(no!==1&&no!==2)throw new TypeError(no+" must be 1 or 2");const io={method:Xr};if(no===2&&(io.jsonrpc="2.0"),eo){if(typeof eo!="object"&&!Array.isArray(eo))throw new TypeError(eo+" must be an object, array or omitted");io.params=eo}if(typeof to>"u"){const oo=typeof ro.generator=="function"?ro.generator:function(){return uuid$1()};io.id=oo(io,ro)}else no===2&&to===null?ro.notificationIdNull&&(io.id=null):io.id=to;return io};var generateRequest_1=generateRequest$1;const uuid=require$$0.v4,generateRequest=generateRequest_1,ClientBrowser=function(Xr,eo){if(!(this instanceof ClientBrowser))return new ClientBrowser(Xr,eo);eo||(eo={}),this.options={reviver:typeof eo.reviver<"u"?eo.reviver:null,replacer:typeof eo.replacer<"u"?eo.replacer:null,generator:typeof eo.generator<"u"?eo.generator:function(){return uuid()},version:typeof eo.version<"u"?eo.version:2,notificationIdNull:typeof eo.notificationIdNull=="boolean"?eo.notificationIdNull:!1},this.callServer=Xr};var browser=ClientBrowser;ClientBrowser.prototype.request=function(Xr,eo,to,ro){const no=this;let io=null;const oo=Array.isArray(Xr)&&typeof eo=="function";if(this.options.version===1&&oo)throw new TypeError("JSON-RPC 1.0 does not support batching");if(oo||!oo&&Xr&&typeof Xr=="object"&&typeof eo=="function")ro=eo,io=Xr;else{typeof to=="function"&&(ro=to,to=void 0);const co=typeof ro=="function";try{io=generateRequest(Xr,eo,to,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(lo){if(co)return ro(lo);throw lo}if(!co)return io}let so;try{so=JSON.stringify(io,this.options.replacer)}catch(co){return ro(co)}return this.callServer(so,function(co,lo){no._parseResponse(co,lo,ro)}),io};ClientBrowser.prototype._parseResponse=function(Xr,eo,to){if(Xr){to(Xr);return}if(!eo)return to();let ro;try{ro=JSON.parse(eo,this.options.reviver)}catch(no){return to(no)}if(to.length===3)if(Array.isArray(ro)){const no=function(oo){return typeof oo.error<"u"},io=function(oo){return!no(oo)};return to(null,ro.filter(no),ro.filter(io))}else return to(null,ro.error,ro.result);to(null,ro)};const RpcClient=getDefaultExportFromCjs$2(browser);var client={},eventemitter3={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,uo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,uo||so,ho),bo=to?to+co:co;return so._events[bo]?so._events[bo].fn?so._events[bo]=[so._events[bo],go]:so._events[bo].push(go):(so._events[bo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var co=[],lo,uo;if(this._eventsCount===0)return co;for(uo in lo=this._events)eo.call(lo,uo)&&co.push(to?uo.slice(1):uo);return Object.getOwnPropertySymbols?co.concat(Object.getOwnPropertySymbols(lo)):co},ao.prototype.listeners=function(co){var lo=to?to+co:co,uo=this._events[lo];if(!uo)return[];if(uo.fn)return[uo.fn];for(var ho=0,go=uo.length,bo=new Array(go);ho++this.rpc_id),lo?this.dataPack=lo:this.dataPack=new utils_cjs_1.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(to,ro,no,io){return!io&&typeof no=="object"&&(io=no,no=null),new Promise((oo,ao)=>{if(!this.ready)return ao(new Error("socket not ready"));const so=this.generate_request_id(to,ro),co={jsonrpc:"2.0",method:to,params:ro||void 0,id:so};this.socket.send(this.dataPack.encode(co),io,lo=>{if(lo)return ao(lo);this.queue[so]={promise:[oo,ao]},no&&(this.queue[so].timeout=setTimeout(()=>{delete this.queue[so],ao(new Error("reply timeout"))},no))})})}async login(to){const ro=await this.call("rpc.login",to);if(!ro)throw new Error("authentication failed");return ro}async listMethods(){return await this.call("__listMethods")}notify(to,ro){return new Promise((no,io)=>{if(!this.ready)return io(new Error("socket not ready"));const oo={jsonrpc:"2.0",method:to,params:ro};this.socket.send(this.dataPack.encode(oo),ao=>{if(ao)return io(ao);no()})})}async subscribe(to){typeof to=="string"&&(to=[to]);const ro=await this.call("rpc.on",to);if(typeof to=="string"&&ro[to]!=="ok")throw new Error("Failed subscribing to an event '"+to+"' with: "+ro[to]);return ro}async unsubscribe(to){typeof to=="string"&&(to=[to]);const ro=await this.call("rpc.off",to);if(typeof to=="string"&&ro[to]!=="ok")throw new Error("Failed unsubscribing from an event with: "+ro);return ro}close(to,ro){this.socket.close(to||1e3,ro)}setAutoReconnect(to){this.reconnect=to}setReconnectInterval(to){this.reconnect_interval=to}setMaxReconnects(to){this.max_reconnects=to}_connect(to,ro){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(to,ro),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:no})=>{no instanceof ArrayBuffer&&(no=Buffer$3.from(no).toString());try{no=this.dataPack.decode(no)}catch{return}if(no.notification&&this.listeners(no.notification).length){if(!Object.keys(no.params).length)return this.emit(no.notification);const io=[no.notification];if(no.params.constructor===Object)io.push(no.params);else for(let oo=0;oo{this.emit.apply(this,io)})}if(!this.queue[no.id])return no.method?Promise.resolve().then(()=>{this.emit(no.method,no==null?void 0:no.params)}):void 0;"error"in no=="result"in no&&this.queue[no.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[no.id].timeout&&clearTimeout(this.queue[no.id].timeout),no.error?this.queue[no.id].promise[1](no.error):this.queue[no.id].promise[0](no.result),delete this.queue[no.id]}),this.socket.addEventListener("error",no=>this.emit("error",no)),this.socket.addEventListener("close",({code:no,reason:io})=>{this.ready&&setTimeout(()=>this.emit("close",no,io),0),this.ready=!1,this.socket=void 0,no!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(to,ro),this.reconnect_interval)))})}}var _default$1=client.default=CommonClient,websocket_browser={};Object.defineProperty(websocket_browser,"__esModule",{value:!0});const eventemitter3_1=eventemitter3Exports;class WebSocketBrowserImpl extends eventemitter3_1.EventEmitter{constructor(to,ro,no){super();sp(this,"socket");this.socket=new window.WebSocket(to,no),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=io=>this.emit("message",io.data),this.socket.onerror=io=>this.emit("error",io),this.socket.onclose=io=>{this.emit("close",io.code,io.reason)}}send(to,ro,no){const io=no||ro;try{this.socket.send(to),io()}catch(oo){io(oo)}}close(to,ro){this.socket.close(to,ro)}addEventListener(to,ro,no){this.socket.addEventListener(to,ro,no)}}function default_1(Xr,eo){return new WebSocketBrowserImpl(Xr,eo)}var _default=websocket_browser.default=default_1;function isOnCurve$2(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const sign$1=(Xr,eo)=>ed25519.sign(Xr,eo.slice(0,32)),verify$1=ed25519.verify,toBuffer$2=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);let Struct$4=class{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$2,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA$2,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA$2,this,eo)}};const SOLANA_SCHEMA$2=new Map;var _PublicKey$2;const MAX_SEED_LENGTH$2=32,PUBLIC_KEY_LENGTH$2=32;function isPublicKeyData$2(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter$2=1,PublicKey$2=class lv extends Struct$4{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData$2(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input");this._bn=new BN(to)}else this._bn=new BN(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input")}}static unique(){const eo=new lv(uniquePublicKeyCounter$2);return uniquePublicKeyCounter$2+=1,new lv(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH$2)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new lv(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH$2)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer$2(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve$2(no))throw new Error("Invalid seeds, address must fall off the curve");return new lv(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new lv(eo);return isOnCurve$2(to.toBytes())}};_PublicKey$2=PublicKey$2;PublicKey$2.default=new _PublicKey$2("11111111111111111111111111111111");SOLANA_SCHEMA$2.set(PublicKey$2,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$2("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES$2=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(eo){super(`Signature ${eo} has expired: block height exceeded.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(eo,to){super(`Transaction was not confirmed in ${to.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${eo} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(eo){super(`Signature ${eo} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=eo}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(eo,to){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=eo,this.accountKeysFromLookups=to}keySegments(){const eo=[this.staticAccountKeys];return this.accountKeysFromLookups&&(eo.push(this.accountKeysFromLookups.writable),eo.push(this.accountKeysFromLookups.readonly)),eo}get(eo){for(const to of this.keySegments()){if(eo256)throw new Error("Account index overflow encountered during compilation");const ro=new Map;this.keySegments().flat().forEach((io,oo)=>{ro.set(io.toBase58(),oo)});const no=io=>{const oo=ro.get(io.toBase58());if(oo===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return oo};return eo.map(io=>({programIdIndex:no(io.programId),accountKeyIndexes:io.keys.map(oo=>no(oo.pubkey)),data:io.data}))}}const publicKey$3=(Xr="publicKey")=>blob(32,Xr),signature=(Xr="signature")=>blob(64,Xr),rustString$2=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized$2=(Xr="authorized")=>struct([publicKey$3("staker"),publicKey$3("withdrawer")],Xr),lockup$2=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$3("custodian")],Xr),voteInit$2=(Xr="voteInit")=>struct([publicKey$3("nodePubkey"),publicKey$3("authorizedVoter"),publicKey$3("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs$2=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey$3("currentAuthorityDerivedKeyOwnerPubkey"),rustString$2("currentAuthorityDerivedKeySeed"),publicKey$3("newAuthorized")],Xr);function getAlloc(Xr,eo){const to=no=>{if(no.span>=0)return no.span;if(typeof no.alloc=="function")return no.alloc(eo[no.property]);if("count"in no&&"elementLayout"in no){const io=eo[no.property];if(Array.isArray(io))return io.length*to(no.elementLayout)}else if("fields"in no)return getAlloc({layout:no},eo[no.property]);return 0};let ro=0;return Xr.layout.fields.forEach(no=>{ro+=to(no)}),ro}function decodeLength(Xr){let eo=0,to=0;for(;;){let ro=Xr.shift();if(eo|=(ro&127)<>=7,to==0){Xr.push(ro);break}else ro|=128,Xr.push(ro)}}function assert$5(Xr,eo){if(!Xr)throw new Error(eo||"Assertion failed")}class CompiledKeys{constructor(eo,to){this.payer=void 0,this.keyMetaMap=void 0,this.payer=eo,this.keyMetaMap=to}static compile(eo,to){const ro=new Map,no=oo=>{const ao=oo.toBase58();let so=ro.get(ao);return so===void 0&&(so={isSigner:!1,isWritable:!1,isInvoked:!1},ro.set(ao,so)),so},io=no(to);io.isSigner=!0,io.isWritable=!0;for(const oo of eo){no(oo.programId).isInvoked=!0;for(const ao of oo.keys){const so=no(ao.pubkey);so.isSigner||(so.isSigner=ao.isSigner),so.isWritable||(so.isWritable=ao.isWritable)}}return new CompiledKeys(to,ro)}getMessageComponents(){const eo=[...this.keyMetaMap.entries()];assert$5(eo.length<=256,"Max static account keys length exceeded");const to=eo.filter(([,so])=>so.isSigner&&so.isWritable),ro=eo.filter(([,so])=>so.isSigner&&!so.isWritable),no=eo.filter(([,so])=>!so.isSigner&&so.isWritable),io=eo.filter(([,so])=>!so.isSigner&&!so.isWritable),oo={numRequiredSignatures:to.length+ro.length,numReadonlySignedAccounts:ro.length,numReadonlyUnsignedAccounts:io.length};{assert$5(to.length>0,"Expected at least one writable signer key");const[so]=to[0];assert$5(so===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const ao=[...to.map(([so])=>new PublicKey$2(so)),...ro.map(([so])=>new PublicKey$2(so)),...no.map(([so])=>new PublicKey$2(so)),...io.map(([so])=>new PublicKey$2(so))];return[oo,ao]}extractTableLookup(eo){const[to,ro]=this.drainKeysFoundInLookupTable(eo.state.addresses,oo=>!oo.isSigner&&!oo.isInvoked&&oo.isWritable),[no,io]=this.drainKeysFoundInLookupTable(eo.state.addresses,oo=>!oo.isSigner&&!oo.isInvoked&&!oo.isWritable);if(!(to.length===0&&no.length===0))return[{accountKey:eo.key,writableIndexes:to,readonlyIndexes:no},{writable:ro,readonly:io}]}drainKeysFoundInLookupTable(eo,to){const ro=new Array,no=new Array;for(const[io,oo]of this.keyMetaMap.entries())if(to(oo)){const ao=new PublicKey$2(io),so=eo.findIndex(co=>co.equals(ao));so>=0&&(assert$5(so<256,"Max lookup table index exceeded"),ro.push(so),no.push(ao),this.keyMetaMap.delete(io))}return[ro,no]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(Xr){if(Xr.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return Xr.shift()}function guardedSplice(Xr,...eo){const[to]=eo;if(eo.length===2?to+(eo[1]??0)>Xr.length:to>=Xr.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return Xr.splice(...eo)}class Message{constructor(eo){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=eo.header,this.accountKeys=eo.accountKeys.map(to=>new PublicKey$2(to)),this.recentBlockhash=eo.recentBlockhash,this.instructions=eo.instructions,this.instructions.forEach(to=>this.indexToProgramIds.set(to.programIdIndex,this.accountKeys[to.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(eo=>({programIdIndex:eo.programIdIndex,accountKeyIndexes:eo.accounts,data:bs58$3.decode(eo.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(eo){const to=CompiledKeys.compile(eo.instructions,eo.payerKey),[ro,no]=to.getMessageComponents(),oo=new MessageAccountKeys(no).compileInstructions(eo.instructions).map(ao=>({programIdIndex:ao.programIdIndex,accounts:ao.accountKeyIndexes,data:bs58$3.encode(ao.data)}));return new Message({header:ro,accountKeys:no,recentBlockhash:eo.recentBlockhash,instructions:oo})}isAccountSigner(eo){return eo=this.header.numRequiredSignatures){const ro=eo-to,io=this.accountKeys.length-to-this.header.numReadonlyUnsignedAccounts;return ro!this.isProgramId(to))}serialize(){const eo=this.accountKeys.length;let to=[];encodeLength(to,eo);const ro=this.instructions.map(uo=>{const{accounts:ho,programIdIndex:go}=uo,bo=Array.from(bs58$3.decode(uo.data));let wo=[];encodeLength(wo,ho.length);let Eo=[];return encodeLength(Eo,bo.length),{programIdIndex:go,keyIndicesCount:Buffer$1$1.from(wo),keyIndices:ho,dataLength:Buffer$1$1.from(Eo),data:bo}});let no=[];encodeLength(no,ro.length);let io=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(no).copy(io);let oo=no.length;ro.forEach(uo=>{const go=struct([u8("programIdIndex"),blob(uo.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),uo.keyIndices.length,"keyIndices"),blob(uo.dataLength.length,"dataLength"),seq(u8("userdatum"),uo.data.length,"data")]).encode(uo,io,oo);oo+=go}),io=io.slice(0,oo);const ao=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(to.length,"keyCount"),seq(publicKey$3("key"),eo,"keys"),publicKey$3("recentBlockhash")]),so={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(to),keys:this.accountKeys.map(uo=>toBuffer$2(uo.toBytes())),recentBlockhash:bs58$3.decode(this.recentBlockhash)};let co=Buffer$1$1.alloc(2048);const lo=ao.encode(so,co);return io.copy(co,lo),co.slice(0,lo+io.length)}static from(eo){let to=[...eo];const ro=guardedShift(to);if(ro!==(ro&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const no=guardedShift(to),io=guardedShift(to),oo=decodeLength(to);let ao=[];for(let ho=0;ho0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,to)}isAccountSigner(eo){return eo=ro){const no=eo-ro,io=this.addressTableLookups.reduce((oo,ao)=>oo+ao.writableIndexes.length,0);return no=this.header.numRequiredSignatures){const no=eo-to,oo=ro-to-this.header.numReadonlyUnsignedAccounts;return noio.key.equals(ro.accountKey));if(!no)throw new Error(`Failed to find address lookup table account for table key ${ro.accountKey.toBase58()}`);for(const io of ro.writableIndexes)if(iolo.toBytes()),recentBlockhash:bs58$3.decode(this.recentBlockhash),instructionsLength:new Uint8Array(ro),serializedInstructions:to,addressTableLookupsLength:new Uint8Array(io),serializedAddressTableLookups:no},ao);return ao.slice(0,co)}serializeInstructions(){let eo=0;const to=new Uint8Array(PACKET_DATA_SIZE);for(const ro of this.compiledInstructions){const no=Array();encodeLength(no,ro.accountKeyIndexes.length);const io=Array();encodeLength(io,ro.data.length);const oo=struct([u8("programIdIndex"),blob(no.length,"encodedAccountKeyIndexesLength"),seq(u8(),ro.accountKeyIndexes.length,"accountKeyIndexes"),blob(io.length,"encodedDataLength"),blob(ro.data.length,"data")]);eo+=oo.encode({programIdIndex:ro.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(no),accountKeyIndexes:ro.accountKeyIndexes,encodedDataLength:new Uint8Array(io),data:ro.data},to,eo)}return to.slice(0,eo)}serializeAddressTableLookups(){let eo=0;const to=new Uint8Array(PACKET_DATA_SIZE);for(const ro of this.addressTableLookups){const no=Array();encodeLength(no,ro.writableIndexes.length);const io=Array();encodeLength(io,ro.readonlyIndexes.length);const oo=struct([publicKey$3("accountKey"),blob(no.length,"encodedWritableIndexesLength"),seq(u8(),ro.writableIndexes.length,"writableIndexes"),blob(io.length,"encodedReadonlyIndexesLength"),seq(u8(),ro.readonlyIndexes.length,"readonlyIndexes")]);eo+=oo.encode({accountKey:ro.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(no),writableIndexes:ro.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(io),readonlyIndexes:ro.readonlyIndexes},to,eo)}return to.slice(0,eo)}static deserialize(eo){let to=[...eo];const ro=guardedShift(to),no=ro&VERSION_PREFIX_MASK;assert$5(ro!==no,"Expected versioned message but received legacy message");const io=no;assert$5(io===0,`Expected versioned message with version 0 but found version ${io}`);const oo={numRequiredSignatures:guardedShift(to),numReadonlySignedAccounts:guardedShift(to),numReadonlyUnsignedAccounts:guardedShift(to)},ao=[],so=decodeLength(to);for(let bo=0;bo{const eo=VersionedMessage.deserializeMessageVersion(Xr);if(eo==="legacy")return Message.from(Xr);if(eo===0)return MessageV0.deserialize(Xr);throw new Error(`Transaction message version ${eo} deserialization is not supported`)}};let TransactionStatus$1=function(Xr){return Xr[Xr.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",Xr[Xr.PROCESSED=1]="PROCESSED",Xr[Xr.TIMED_OUT=2]="TIMED_OUT",Xr[Xr.NONCE_INVALID=3]="NONCE_INVALID",Xr}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$2).fill(0);class TransactionInstruction{constructor(eo){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=eo.programId,this.keys=eo.keys,eo.data&&(this.data=eo.data)}toJSON(){return{keys:this.keys.map(({pubkey:eo,isSigner:to,isWritable:ro})=>({pubkey:eo.toJSON(),isSigner:to,isWritable:ro})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(eo){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!eo)if(eo.feePayer&&(this.feePayer=eo.feePayer),eo.signatures&&(this.signatures=eo.signatures),Object.prototype.hasOwnProperty.call(eo,"nonceInfo")){const{minContextSlot:to,nonceInfo:ro}=eo;this.minNonceContextSlot=to,this.nonceInfo=ro}else if(Object.prototype.hasOwnProperty.call(eo,"lastValidBlockHeight")){const{blockhash:to,lastValidBlockHeight:ro}=eo;this.recentBlockhash=to,this.lastValidBlockHeight=ro}else{const{recentBlockhash:to,nonceInfo:ro}=eo;ro&&(this.nonceInfo=ro),this.recentBlockhash=to}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(eo=>eo.toJSON()),signers:this.signatures.map(({publicKey:eo})=>eo.toJSON())}}add(...eo){if(eo.length===0)throw new Error("No instructions");return eo.forEach(to=>{"instructions"in to?this.instructions=this.instructions.concat(to.instructions):"data"in to&&"programId"in to&&"keys"in to?this.instructions.push(to):this.instructions.push(new TransactionInstruction(to))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let eo,to;if(this.nonceInfo?(eo=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?to=[this.nonceInfo.nonceInstruction,...this.instructions]:to=this.instructions):(eo=this.recentBlockhash,to=this.instructions),!eo)throw new Error("Transaction recentBlockhash required");to.length<1&&console.warn("No instructions provided");let ro;if(this.feePayer)ro=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)ro=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let wo=0;wo{wo.keys.forEach($o=>{io.push({...$o})});const Eo=wo.programId.toString();no.includes(Eo)||no.push(Eo)}),no.forEach(wo=>{io.push({pubkey:new PublicKey$2(wo),isSigner:!1,isWritable:!1})});const oo=[];io.forEach(wo=>{const Eo=wo.pubkey.toString(),$o=oo.findIndex(Co=>Co.pubkey.toString()===Eo);$o>-1?(oo[$o].isWritable=oo[$o].isWritable||wo.isWritable,oo[$o].isSigner=oo[$o].isSigner||wo.isSigner):oo.push(wo)}),oo.sort(function(wo,Eo){if(wo.isSigner!==Eo.isSigner)return wo.isSigner?-1:1;if(wo.isWritable!==Eo.isWritable)return wo.isWritable?-1:1;const $o={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return wo.pubkey.toBase58().localeCompare(Eo.pubkey.toBase58(),"en",$o)});const ao=oo.findIndex(wo=>wo.pubkey.equals(ro));if(ao>-1){const[wo]=oo.splice(ao,1);wo.isSigner=!0,wo.isWritable=!0,oo.unshift(wo)}else oo.unshift({pubkey:ro,isSigner:!0,isWritable:!0});for(const wo of this.signatures){const Eo=oo.findIndex($o=>$o.pubkey.equals(wo.publicKey));if(Eo>-1)oo[Eo].isSigner||(oo[Eo].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${wo.publicKey.toString()}`)}let so=0,co=0,lo=0;const uo=[],ho=[];oo.forEach(({pubkey:wo,isSigner:Eo,isWritable:$o})=>{Eo?(uo.push(wo.toString()),so+=1,$o||(co+=1)):(ho.push(wo.toString()),$o||(lo+=1))});const go=uo.concat(ho),bo=to.map(wo=>{const{data:Eo,programId:$o}=wo;return{programIdIndex:go.indexOf($o.toString()),accounts:wo.keys.map(Co=>go.indexOf(Co.pubkey.toString())),data:bs58$3.encode(Eo)}});return bo.forEach(wo=>{assert$5(wo.programIdIndex>=0),wo.accounts.forEach(Eo=>assert$5(Eo>=0))}),new Message({header:{numRequiredSignatures:so,numReadonlySignedAccounts:co,numReadonlyUnsignedAccounts:lo},accountKeys:go,recentBlockhash:eo,instructions:bo})}_compile(){const eo=this.compileMessage(),to=eo.accountKeys.slice(0,eo.header.numRequiredSignatures);return this.signatures.length===to.length&&this.signatures.every((no,io)=>to[io].equals(no.publicKey))||(this.signatures=to.map(ro=>({signature:null,publicKey:ro}))),eo}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(eo){return(await eo.getFeeForMessage(this.compileMessage())).value}setSigners(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set;this.signatures=eo.filter(ro=>{const no=ro.toString();return to.has(no)?!1:(to.add(no),!0)}).map(ro=>({signature:null,publicKey:ro}))}sign(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set,ro=[];for(const io of eo){const oo=io.publicKey.toString();to.has(oo)||(to.add(oo),ro.push(io))}this.signatures=ro.map(io=>({signature:null,publicKey:io.publicKey}));const no=this._compile();this._partialSign(no,...ro)}partialSign(...eo){if(eo.length===0)throw new Error("No signers");const to=new Set,ro=[];for(const io of eo){const oo=io.publicKey.toString();to.has(oo)||(to.add(oo),ro.push(io))}const no=this._compile();this._partialSign(no,...ro)}_partialSign(eo,...to){const ro=eo.serialize();to.forEach(no=>{const io=sign$1(ro,no.secretKey);this._addSignature(no.publicKey,toBuffer$2(io))})}addSignature(eo,to){this._compile(),this._addSignature(eo,to)}_addSignature(eo,to){assert$5(to.length===64);const ro=this.signatures.findIndex(no=>eo.equals(no.publicKey));if(ro<0)throw new Error(`unknown signer: ${eo.toString()}`);this.signatures[ro].signature=Buffer$1$1.from(to)}verifySignatures(eo=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),eo)}_getMessageSignednessErrors(eo,to){const ro={};for(const{signature:no,publicKey:io}of this.signatures)no===null?to&&(ro.missing||(ro.missing=[])).push(io):verify$1(no,eo,io.toBytes())||(ro.invalid||(ro.invalid=[])).push(io);return ro.invalid||ro.missing?ro:void 0}serialize(eo){const{requireAllSignatures:to,verifySignatures:ro}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},eo),no=this.serializeMessage();if(ro){const io=this._getMessageSignednessErrors(no,to);if(io){let oo="Signature verification failed.";throw io.invalid&&(oo+=` Invalid signature for public key${io.invalid.length===1?"":"(s)"} [\`${io.invalid.map(ao=>ao.toBase58()).join("`, `")}\`].`),io.missing&&(oo+=` -Missing signature for public key${io.missing.length===1?"":"(s)"} [\`${io.missing.map(ao=>ao.toBase58()).join("`, `")}\`].`),new Error(oo)}}return this._serialize(no)}_serialize(eo){const{signatures:to}=this,ro=[];encodeLength(ro,to.length);const no=ro.length+to.length*64+eo.length,io=Buffer$1$1.alloc(no);return assert$5(to.length<256),Buffer$1$1.from(ro).copy(io,0),to.forEach(({signature:oo},ao)=>{oo!==null&&(assert$5(oo.length===64,"signature has invalid length"),Buffer$1$1.from(oo).copy(io,ro.length+ao*64))}),eo.copy(io,ro.length+to.length*64),assert$5(io.length<=PACKET_DATA_SIZE,`Transaction too large: ${io.length} > ${PACKET_DATA_SIZE}`),io}get keys(){return assert$5(this.instructions.length===1),this.instructions[0].keys.map(eo=>eo.pubkey)}get programId(){return assert$5(this.instructions.length===1),this.instructions[0].programId}get data(){return assert$5(this.instructions.length===1),this.instructions[0].data}static from(eo){let to=[...eo];const ro=decodeLength(to);let no=[];for(let io=0;io0&&(ro.feePayer=eo.accountKeys[0]),to.forEach((no,io)=>{const oo={signature:no==bs58$3.encode(DEFAULT_SIGNATURE)?null:bs58$3.decode(no),publicKey:eo.accountKeys[io]};ro.signatures.push(oo)}),eo.instructions.forEach(no=>{const io=no.accounts.map(oo=>{const ao=eo.accountKeys[oo];return{pubkey:ao,isSigner:ro.signatures.some(so=>so.publicKey.toString()===ao.toString())||eo.isAccountSigner(oo),isWritable:eo.isAccountWritable(oo)}});ro.instructions.push(new TransactionInstruction({keys:io,programId:eo.accountKeys[no.programIdIndex],data:bs58$3.decode(no.data)}))}),ro._message=eo,ro._json=ro.toJSON(),ro}}class TransactionMessage{constructor(eo){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=eo.payerKey,this.instructions=eo.instructions,this.recentBlockhash=eo.recentBlockhash}static decompile(eo,to){const{header:ro,compiledInstructions:no,recentBlockhash:io}=eo,{numRequiredSignatures:oo,numReadonlySignedAccounts:ao,numReadonlyUnsignedAccounts:so}=ro,co=oo-ao;assert$5(co>0,"Message header is invalid");const lo=eo.staticAccountKeys.length-oo-so;assert$5(lo>=0,"Message header is invalid");const fo=eo.getAccountKeys(to),ho=fo.get(0);if(ho===void 0)throw new Error("Failed to decompile message because no account keys were found");const go=[];for(const yo of no){const vo=[];for(const Eo of yo.accountKeyIndexes){const ko=fo.get(Eo);if(ko===void 0)throw new Error(`Failed to find key for account key index ${Eo}`);const Ao=Eooo.equals(no.publicKey));assert$5(io>=0,`Cannot sign with non signer key ${no.publicKey.toBase58()}`),this.signatures[io]=sign$1(to,no.secretKey)}}addSignature(eo,to){assert$5(to.byteLength===64,"Signature must be 64 bytes long");const no=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(io=>io.equals(eo));assert$5(no>=0,`Can not add signature; \`${eo.toBase58()}\` is not required to sign this transaction`),this.signatures[no]=to}}const NUM_TICKS_PER_SECOND=160,DEFAULT_TICKS_PER_SLOT=64,NUM_SLOTS_PER_SECOND=NUM_TICKS_PER_SECOND/DEFAULT_TICKS_PER_SLOT,MS_PER_SLOT=1e3/NUM_SLOTS_PER_SECOND;new PublicKey$2("SysvarC1ock11111111111111111111111111111111");new PublicKey$2("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$2("Sysvar1nstructions1111111111111111111111111");const SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new PublicKey$2("SysvarRecentB1ockHashes11111111111111111111"),SYSVAR_RENT_PUBKEY=new PublicKey$2("SysvarRent111111111111111111111111111111111");new PublicKey$2("SysvarRewards111111111111111111111111111111");new PublicKey$2("SysvarS1otHashes111111111111111111111111111");new PublicKey$2("SysvarS1otHistory11111111111111111111111111");new PublicKey$2("SysvarStakeHistory1111111111111111111111111");class SendTransactionError extends Error{constructor({action:eo,signature:to,transactionMessage:ro,logs:no}){let io;switch(eo){case"send":io=`Transaction ${to} resulted in an error. +Missing signature for public key${io.missing.length===1?"":"(s)"} [\`${io.missing.map(ao=>ao.toBase58()).join("`, `")}\`].`),new Error(oo)}}return this._serialize(no)}_serialize(eo){const{signatures:to}=this,ro=[];encodeLength(ro,to.length);const no=ro.length+to.length*64+eo.length,io=Buffer$1$1.alloc(no);return assert$5(to.length<256),Buffer$1$1.from(ro).copy(io,0),to.forEach(({signature:oo},ao)=>{oo!==null&&(assert$5(oo.length===64,"signature has invalid length"),Buffer$1$1.from(oo).copy(io,ro.length+ao*64))}),eo.copy(io,ro.length+to.length*64),assert$5(io.length<=PACKET_DATA_SIZE,`Transaction too large: ${io.length} > ${PACKET_DATA_SIZE}`),io}get keys(){return assert$5(this.instructions.length===1),this.instructions[0].keys.map(eo=>eo.pubkey)}get programId(){return assert$5(this.instructions.length===1),this.instructions[0].programId}get data(){return assert$5(this.instructions.length===1),this.instructions[0].data}static from(eo){let to=[...eo];const ro=decodeLength(to);let no=[];for(let io=0;io0&&(ro.feePayer=eo.accountKeys[0]),to.forEach((no,io)=>{const oo={signature:no==bs58$3.encode(DEFAULT_SIGNATURE)?null:bs58$3.decode(no),publicKey:eo.accountKeys[io]};ro.signatures.push(oo)}),eo.instructions.forEach(no=>{const io=no.accounts.map(oo=>{const ao=eo.accountKeys[oo];return{pubkey:ao,isSigner:ro.signatures.some(so=>so.publicKey.toString()===ao.toString())||eo.isAccountSigner(oo),isWritable:eo.isAccountWritable(oo)}});ro.instructions.push(new TransactionInstruction({keys:io,programId:eo.accountKeys[no.programIdIndex],data:bs58$3.decode(no.data)}))}),ro._message=eo,ro._json=ro.toJSON(),ro}}class TransactionMessage{constructor(eo){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=eo.payerKey,this.instructions=eo.instructions,this.recentBlockhash=eo.recentBlockhash}static decompile(eo,to){const{header:ro,compiledInstructions:no,recentBlockhash:io}=eo,{numRequiredSignatures:oo,numReadonlySignedAccounts:ao,numReadonlyUnsignedAccounts:so}=ro,co=oo-ao;assert$5(co>0,"Message header is invalid");const lo=eo.staticAccountKeys.length-oo-so;assert$5(lo>=0,"Message header is invalid");const uo=eo.getAccountKeys(to),ho=uo.get(0);if(ho===void 0)throw new Error("Failed to decompile message because no account keys were found");const go=[];for(const bo of no){const wo=[];for(const $o of bo.accountKeyIndexes){const Co=uo.get($o);if(Co===void 0)throw new Error(`Failed to find key for account key index ${$o}`);const Ro=$ooo.equals(no.publicKey));assert$5(io>=0,`Cannot sign with non signer key ${no.publicKey.toBase58()}`),this.signatures[io]=sign$1(to,no.secretKey)}}addSignature(eo,to){assert$5(to.byteLength===64,"Signature must be 64 bytes long");const no=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(io=>io.equals(eo));assert$5(no>=0,`Can not add signature; \`${eo.toBase58()}\` is not required to sign this transaction`),this.signatures[no]=to}}const NUM_TICKS_PER_SECOND=160,DEFAULT_TICKS_PER_SLOT=64,NUM_SLOTS_PER_SECOND=NUM_TICKS_PER_SECOND/DEFAULT_TICKS_PER_SLOT,MS_PER_SLOT=1e3/NUM_SLOTS_PER_SECOND;new PublicKey$2("SysvarC1ock11111111111111111111111111111111");new PublicKey$2("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$2("Sysvar1nstructions1111111111111111111111111");const SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new PublicKey$2("SysvarRecentB1ockHashes11111111111111111111"),SYSVAR_RENT_PUBKEY=new PublicKey$2("SysvarRent111111111111111111111111111111111");new PublicKey$2("SysvarRewards111111111111111111111111111111");new PublicKey$2("SysvarS1otHashes111111111111111111111111111");new PublicKey$2("SysvarS1otHistory11111111111111111111111111");new PublicKey$2("SysvarStakeHistory1111111111111111111111111");class SendTransactionError extends Error{constructor({action:eo,signature:to,transactionMessage:ro,logs:no}){let io;switch(eo){case"send":io=`Transaction ${to} resulted in an error. ${ro}. `+(no?`Logs: ${JSON.stringify(no.slice(-10),null,2)}. `:"")+"\nCatch the SendTransactionError and call `getLogs()` on it for full details.";break;case"simulate":io=`Simulation failed. Message: ${ro}. `+(no?`Logs: -${JSON.stringify(no.slice(-10),null,2)}. `:"")+"\nCatch the SendTransactionError and call `getLogs()` on it for full details.";break;default:io="Unknown action"}super(io),this.signature=void 0,this.transactionMessage=void 0,this.logs=void 0,this.signature=to,this.transactionMessage=ro,this.logs=no||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.logs)?this.logs:void 0}}async getLogs(eo){return Array.isArray(this.logs)||(this.logs=new Promise((to,ro)=>{eo.getTransaction(this.signature).then(no=>{if(no&&no.meta&&no.meta.logMessages){const io=no.meta.logMessages;this.logs=io,to(io)}else ro(new Error("Log messages not found"))}).catch(ro)})),await this.logs}}class SolanaJSONRPCError extends Error{constructor({code:eo,message:to,data:ro},no){super(no!=null?`${no}: ${to}`:to),this.code=void 0,this.data=void 0,this.code=eo,this.data=ro,this.name="SolanaJSONRPCError"}}function sleep(Xr){return new Promise(eo=>setTimeout(eo,Xr))}function encodeData$1(Xr,eo){const to=Xr.layout.span>=0?Xr.layout.span:getAlloc(Xr,eo),ro=Buffer$1$1.alloc(to),no=Object.assign({instruction:Xr.index},eo);return Xr.layout.encode(no,ro),ro}function decodeData$1(Xr,eo){let to;try{to=Xr.layout.decode(eo)}catch(ro){throw new Error("invalid instruction; "+ro)}if(to.instruction!==Xr.index)throw new Error(`invalid instruction; instruction index mismatch ${to.instruction} != ${Xr.index}`);return to}const FeeCalculatorLayout$2=nu64("lamportsPerSignature"),NonceAccountLayout$2=struct([u32$1("version"),u32$1("state"),publicKey$3("authorizedPubkey"),publicKey$3("nonce"),struct([FeeCalculatorLayout$2],"feeCalculator")]),NONCE_ACCOUNT_LENGTH=NonceAccountLayout$2.span;class NonceAccount{constructor(eo){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=eo.authorizedPubkey,this.nonce=eo.nonce,this.feeCalculator=eo.feeCalculator}static fromAccountData(eo){const to=NonceAccountLayout$2.decode(toBuffer$2(eo),0);return new NonceAccount({authorizedPubkey:new PublicKey$2(to.authorizedPubkey),nonce:new PublicKey$2(to.nonce).toString(),feeCalculator:to.feeCalculator})}}const encodeDecode$3=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$3=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$3(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$3=bigInt$3(8);class SystemInstruction{constructor(){}static decodeInstructionType(eo){this.checkProgramId(eo.programId);const ro=u32$1("instruction").decode(eo.data);let no;for(const[io,oo]of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS))if(oo.index==ro){no=io;break}if(!no)throw new Error("Instruction type incorrect; not a SystemInstruction");return no}static decodeCreateAccount(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{lamports:to,space:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create,eo.data);return{fromPubkey:eo.keys[0].pubkey,newAccountPubkey:eo.keys[1].pubkey,lamports:to,space:ro,programId:new PublicKey$2(no)}}static decodeTransfer(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{lamports:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer,eo.data);return{fromPubkey:eo.keys[0].pubkey,toPubkey:eo.keys[1].pubkey,lamports:to}}static decodeTransferWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3);const{lamports:to,seed:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed,eo.data);return{fromPubkey:eo.keys[0].pubkey,basePubkey:eo.keys[1].pubkey,toPubkey:eo.keys[2].pubkey,lamports:to,seed:ro,programId:new PublicKey$2(no)}}static decodeAllocate(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{space:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate,eo.data);return{accountPubkey:eo.keys[0].pubkey,space:to}}static decodeAllocateWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{base:to,seed:ro,space:no,programId:io}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed,eo.data);return{accountPubkey:eo.keys[0].pubkey,basePubkey:new PublicKey$2(to),seed:ro,space:no,programId:new PublicKey$2(io)}}static decodeAssign(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{programId:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign,eo.data);return{accountPubkey:eo.keys[0].pubkey,programId:new PublicKey$2(to)}}static decodeAssignWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{base:to,seed:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed,eo.data);return{accountPubkey:eo.keys[0].pubkey,basePubkey:new PublicKey$2(to),seed:ro,programId:new PublicKey$2(no)}}static decodeCreateWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{base:to,seed:ro,lamports:no,space:io,programId:oo}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,eo.data);return{fromPubkey:eo.keys[0].pubkey,newAccountPubkey:eo.keys[1].pubkey,basePubkey:new PublicKey$2(to),seed:ro,lamports:no,space:io,programId:new PublicKey$2(oo)}}static decodeNonceInitialize(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3);const{authorized:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:new PublicKey$2(to)}}static decodeNonceAdvance(eo){return this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3),decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,eo.data),{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:eo.keys[2].pubkey}}static decodeNonceWithdraw(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,5);const{lamports:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,toPubkey:eo.keys[1].pubkey,authorizedPubkey:eo.keys[4].pubkey,lamports:to}}static decodeNonceAuthorize(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{authorized:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:eo.keys[1].pubkey,newAuthorizedPubkey:new PublicKey$2(to)}}static checkProgramId(eo){if(!eo.equals(SystemProgram.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(eo,to){if(eo.length-1&&(no+=stringify$1(Xr[to],!0)),no+"]"}else if(so==="[object Object]"){for(io=objKeys(Xr).sort(),ro=io.length,no="",to=0;to1;)Xr/=2,eo++;return eo}function nextPowerOfTwo(Xr){return Xr===0?1:(Xr--,Xr|=Xr>>1,Xr|=Xr>>2,Xr|=Xr>>4,Xr|=Xr>>8,Xr|=Xr>>16,Xr|=Xr>>32,Xr+1)}class EpochSchedule{constructor(eo,to,ro,no,io){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=eo,this.leaderScheduleSlotOffset=to,this.warmup=ro,this.firstNormalEpoch=no,this.firstNormalSlot=io}getEpoch(eo){return this.getEpochAndSlotIndex(eo)[0]}getEpochAndSlotIndex(eo){if(eo{const oo=_default(io,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...to});return"socket"in oo?this.underlyingSocket=oo.socket:this.underlyingSocket=oo,oo};super(no,eo,to,ro),this.underlyingSocket=void 0}call(...eo){var ro;const to=(ro=this.underlyingSocket)==null?void 0:ro.readyState;return to===1?super.call(...eo):Promise.reject(new Error("Tried to call a JSON-RPC method `"+eo[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+to+")"))}notify(...eo){var ro;const to=(ro=this.underlyingSocket)==null?void 0:ro.readyState;return to===1?super.notify(...eo):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+eo[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+to+")"))}}function decodeData(Xr,eo){let to;try{to=Xr.layout.decode(eo)}catch(ro){throw new Error("invalid instruction; "+ro)}if(to.typeIndex!==Xr.index)throw new Error(`invalid account data; account type mismatch ${to.typeIndex} != ${Xr.index}`);return to}const LOOKUP_TABLE_META_SIZE=56;class AddressLookupTableAccount{constructor(eo){this.key=void 0,this.state=void 0,this.key=eo.key,this.state=eo.state}isActive(){const eo=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===eo}static deserialize(eo){const to=decodeData(LookupTableMetaLayout,eo),ro=eo.length-LOOKUP_TABLE_META_SIZE;assert$5(ro>=0,"lookup table is invalid"),assert$5(ro%32===0,"lookup table is invalid");const no=ro/32,{addresses:io}=struct([seq(publicKey$3(),no,"addresses")]).decode(eo.slice(LOOKUP_TABLE_META_SIZE));return{deactivationSlot:to.deactivationSlot,lastExtendedSlot:to.lastExtendedSlot,lastExtendedSlotStartIndex:to.lastExtendedStartIndex,authority:to.authority.length!==0?new PublicKey$2(to.authority[0]):void 0,addresses:io.map(oo=>new PublicKey$2(oo))}}}const LookupTableMetaLayout={index:1,layout:struct([u32$1("typeIndex"),u64$3("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$3(),offset(u8(),-1),"authority")])},URL_RE=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function makeWebsocketUrl(Xr){const eo=Xr.match(URL_RE);if(eo==null)throw TypeError(`Failed to validate endpoint URL \`${Xr}\``);const[to,ro,no,io]=eo,oo=Xr.startsWith("https:")?"wss:":"ws:",ao=no==null?null:parseInt(no.slice(1),10),so=ao==null?"":`:${ao+1}`;return`${oo}//${ro}${so}${io}`}const PublicKeyFromString$2=coerce$2(instance$2(PublicKey$2),string$2(),Xr=>new PublicKey$2(Xr)),RawAccountDataResult$2=tuple$3([string$2(),literal$2("base64")]),BufferFromRawAccountData$2=coerce$2(instance$2(Buffer$1$1),RawAccountDataResult$2,Xr=>Buffer$1$1.from(Xr[0],"base64")),BLOCKHASH_CACHE_TIMEOUT_MS=30*1e3;function assertEndpointUrl(Xr){if(/^https?:/.test(Xr)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return Xr}function extractCommitmentFromConfig(Xr){let eo,to;if(typeof Xr=="string")eo=Xr;else if(Xr){const{commitment:ro,...no}=Xr;eo=ro,to=no}return{commitment:eo,config:to}}function createRpcResult$2(Xr){return union$2([type$2({jsonrpc:literal$2("2.0"),id:string$2(),result:Xr}),type$2({jsonrpc:literal$2("2.0"),id:string$2(),error:type$2({code:unknown$2(),message:string$2(),data:optional$2(any$2())})})])}const UnknownRpcResult$2=createRpcResult$2(unknown$2());function jsonRpcResult$2(Xr){return coerce$2(createRpcResult$2(Xr),UnknownRpcResult$2,eo=>"error"in eo?eo:{...eo,result:create$2(eo.result,Xr)})}function jsonRpcResultAndContext$2(Xr){return jsonRpcResult$2(type$2({context:type$2({slot:number$3()}),value:Xr}))}function notificationResultAndContext$2(Xr){return type$2({context:type$2({slot:number$3()}),value:Xr})}function versionedMessageFromResponse(Xr,eo){return Xr===0?new MessageV0({header:eo.header,staticAccountKeys:eo.accountKeys.map(to=>new PublicKey$2(to)),recentBlockhash:eo.recentBlockhash,compiledInstructions:eo.instructions.map(to=>({programIdIndex:to.programIdIndex,accountKeyIndexes:to.accounts,data:bs58$3.decode(to.data)})),addressTableLookups:eo.addressTableLookups}):new Message(eo)}const GetInflationGovernorResult$2=type$2({foundation:number$3(),foundationTerm:number$3(),initial:number$3(),taper:number$3(),terminal:number$3()}),GetInflationRewardResult=jsonRpcResult$2(array$2(nullable$2(type$2({epoch:number$3(),effectiveSlot:number$3(),amount:number$3(),postBalance:number$3(),commission:optional$2(nullable$2(number$3()))})))),GetRecentPrioritizationFeesResult$2=array$2(type$2({slot:number$3(),prioritizationFee:number$3()})),GetInflationRateResult$2=type$2({total:number$3(),validator:number$3(),foundation:number$3(),epoch:number$3()}),GetEpochInfoResult$2=type$2({epoch:number$3(),slotIndex:number$3(),slotsInEpoch:number$3(),absoluteSlot:number$3(),blockHeight:optional$2(number$3()),transactionCount:optional$2(number$3())}),GetEpochScheduleResult$2=type$2({slotsPerEpoch:number$3(),leaderScheduleSlotOffset:number$3(),warmup:boolean$2(),firstNormalEpoch:number$3(),firstNormalSlot:number$3()}),GetLeaderScheduleResult$2=record$2(string$2(),array$2(number$3())),TransactionErrorResult$2=nullable$2(union$2([type$2({}),string$2()])),SignatureStatusResult$2=type$2({err:TransactionErrorResult$2}),SignatureReceivedResult$2=literal$2("receivedSignature"),VersionResult=type$2({"solana-core":string$2(),"feature-set":optional$2(number$3())}),SimulatedTransactionResponseStruct=jsonRpcResultAndContext$2(type$2({err:nullable$2(union$2([type$2({}),string$2()])),logs:nullable$2(array$2(string$2())),accounts:optional$2(nullable$2(array$2(nullable$2(type$2({executable:boolean$2(),owner:string$2(),lamports:number$3(),data:array$2(string$2()),rentEpoch:optional$2(number$3())}))))),unitsConsumed:optional$2(number$3()),returnData:optional$2(nullable$2(type$2({programId:string$2(),data:tuple$3([string$2(),literal$2("base64")])})))})),BlockProductionResponseStruct=jsonRpcResultAndContext$2(type$2({byIdentity:record$2(string$2(),array$2(number$3())),range:type$2({firstSlot:number$3(),lastSlot:number$3()})}));function createRpcClient(Xr,eo,to,ro,no,io){const oo=to||fetchImpl;let ao;io!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let so;return ro&&(so=async(lo,fo)=>{const ho=await new Promise((go,yo)=>{try{ro(lo,fo,(vo,wo)=>go([vo,wo]))}catch(vo){yo(vo)}});return await oo(...ho)}),new RpcClient(async(lo,fo)=>{const ho={method:"POST",body:lo,agent:ao,headers:Object.assign({"Content-Type":"application/json"},eo||{},COMMON_HTTP_HEADERS)};try{let go=5,yo,vo=500;for(;so?yo=await so(Xr,ho):yo=await oo(Xr,ho),!(yo.status!==429||no===!0||(go-=1,go===0));)console.error(`Server responded with ${yo.status} ${yo.statusText}. Retrying after ${vo}ms delay...`),await sleep(vo),vo*=2;const wo=await yo.text();yo.ok?fo(null,wo):fo(new Error(`${yo.status} ${yo.statusText}: ${wo}`))}catch(go){go instanceof Error&&fo(go)}},{})}function createRpcRequest(Xr){return(eo,to)=>new Promise((ro,no)=>{Xr.request(eo,to,(io,oo)=>{if(io){no(io);return}ro(oo)})})}function createRpcBatchRequest(Xr){return eo=>new Promise((to,ro)=>{eo.length===0&&to([]);const no=eo.map(io=>Xr.request(io.methodName,io.args));Xr.request(no,(io,oo)=>{if(io){ro(io);return}to(oo)})})}const GetInflationGovernorRpcResult=jsonRpcResult$2(GetInflationGovernorResult$2),GetInflationRateRpcResult=jsonRpcResult$2(GetInflationRateResult$2),GetRecentPrioritizationFeesRpcResult=jsonRpcResult$2(GetRecentPrioritizationFeesResult$2),GetEpochInfoRpcResult=jsonRpcResult$2(GetEpochInfoResult$2),GetEpochScheduleRpcResult=jsonRpcResult$2(GetEpochScheduleResult$2),GetLeaderScheduleRpcResult=jsonRpcResult$2(GetLeaderScheduleResult$2),SlotRpcResult=jsonRpcResult$2(number$3()),GetSupplyRpcResult=jsonRpcResultAndContext$2(type$2({total:number$3(),circulating:number$3(),nonCirculating:number$3(),nonCirculatingAccounts:array$2(PublicKeyFromString$2)})),TokenAmountResult$2=type$2({amount:string$2(),uiAmount:nullable$2(number$3()),decimals:number$3(),uiAmountString:optional$2(string$2())}),GetTokenLargestAccountsResult=jsonRpcResultAndContext$2(array$2(type$2({address:PublicKeyFromString$2,amount:string$2(),uiAmount:nullable$2(number$3()),decimals:number$3(),uiAmountString:optional$2(string$2())}))),GetTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$2({pubkey:PublicKeyFromString$2,account:type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:BufferFromRawAccountData$2,rentEpoch:number$3()})}))),ParsedAccountDataResult$2=type$2({program:string$2(),parsed:unknown$2(),space:number$3()}),GetParsedTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$2({pubkey:PublicKeyFromString$2,account:type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:ParsedAccountDataResult$2,rentEpoch:number$3()})}))),GetLargestAccountsRpcResult=jsonRpcResultAndContext$2(array$2(type$2({lamports:number$3(),address:PublicKeyFromString$2}))),AccountInfoResult$2=type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:BufferFromRawAccountData$2,rentEpoch:number$3()}),KeyedAccountInfoResult=type$2({pubkey:PublicKeyFromString$2,account:AccountInfoResult$2}),ParsedOrRawAccountData$2=coerce$2(union$2([instance$2(Buffer$1$1),ParsedAccountDataResult$2]),union$2([RawAccountDataResult$2,ParsedAccountDataResult$2]),Xr=>Array.isArray(Xr)?create$2(Xr,BufferFromRawAccountData$2):Xr),ParsedAccountInfoResult$2=type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:ParsedOrRawAccountData$2,rentEpoch:number$3()}),KeyedParsedAccountInfoResult=type$2({pubkey:PublicKeyFromString$2,account:ParsedAccountInfoResult$2}),StakeActivationResult=type$2({state:union$2([literal$2("active"),literal$2("inactive"),literal$2("activating"),literal$2("deactivating")]),active:number$3(),inactive:number$3()}),GetConfirmedSignaturesForAddress2RpcResult=jsonRpcResult$2(array$2(type$2({signature:string$2(),slot:number$3(),err:TransactionErrorResult$2,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$3()))}))),GetSignaturesForAddressRpcResult=jsonRpcResult$2(array$2(type$2({signature:string$2(),slot:number$3(),err:TransactionErrorResult$2,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$3()))}))),AccountNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(AccountInfoResult$2)}),ProgramAccountInfoResult$2=type$2({pubkey:PublicKeyFromString$2,account:AccountInfoResult$2}),ProgramAccountNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(ProgramAccountInfoResult$2)}),SlotInfoResult$2=type$2({parent:number$3(),slot:number$3(),root:number$3()}),SlotNotificationResult=type$2({subscription:number$3(),result:SlotInfoResult$2}),SlotUpdateResult$2=union$2([type$2({type:union$2([literal$2("firstShredReceived"),literal$2("completed"),literal$2("optimisticConfirmation"),literal$2("root")]),slot:number$3(),timestamp:number$3()}),type$2({type:literal$2("createdBank"),parent:number$3(),slot:number$3(),timestamp:number$3()}),type$2({type:literal$2("frozen"),slot:number$3(),timestamp:number$3(),stats:type$2({numTransactionEntries:number$3(),numSuccessfulTransactions:number$3(),numFailedTransactions:number$3(),maxTransactionsPerEntry:number$3()})}),type$2({type:literal$2("dead"),slot:number$3(),timestamp:number$3(),err:string$2()})]),SlotUpdateNotificationResult=type$2({subscription:number$3(),result:SlotUpdateResult$2}),SignatureNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(union$2([SignatureStatusResult$2,SignatureReceivedResult$2]))}),RootNotificationResult=type$2({subscription:number$3(),result:number$3()}),ContactInfoResult=type$2({pubkey:string$2(),gossip:nullable$2(string$2()),tpu:nullable$2(string$2()),rpc:nullable$2(string$2()),version:nullable$2(string$2())}),VoteAccountInfoResult$2=type$2({votePubkey:string$2(),nodePubkey:string$2(),activatedStake:number$3(),epochVoteAccount:boolean$2(),epochCredits:array$2(tuple$3([number$3(),number$3(),number$3()])),commission:number$3(),lastVote:number$3(),rootSlot:nullable$2(number$3())}),GetVoteAccounts=jsonRpcResult$2(type$2({current:array$2(VoteAccountInfoResult$2),delinquent:array$2(VoteAccountInfoResult$2)})),ConfirmationStatus$2=union$2([literal$2("processed"),literal$2("confirmed"),literal$2("finalized")]),SignatureStatusResponse$2=type$2({slot:number$3(),confirmations:nullable$2(number$3()),err:TransactionErrorResult$2,confirmationStatus:optional$2(ConfirmationStatus$2)}),GetSignatureStatusesRpcResult=jsonRpcResultAndContext$2(array$2(nullable$2(SignatureStatusResponse$2))),GetMinimumBalanceForRentExemptionRpcResult=jsonRpcResult$2(number$3()),AddressTableLookupStruct$2=type$2({accountKey:PublicKeyFromString$2,writableIndexes:array$2(number$3()),readonlyIndexes:array$2(number$3())}),ConfirmedTransactionResult$2=type$2({signatures:array$2(string$2()),message:type$2({accountKeys:array$2(string$2()),header:type$2({numRequiredSignatures:number$3(),numReadonlySignedAccounts:number$3(),numReadonlyUnsignedAccounts:number$3()}),instructions:array$2(type$2({accounts:array$2(number$3()),data:string$2(),programIdIndex:number$3()})),recentBlockhash:string$2(),addressTableLookups:optional$2(array$2(AddressTableLookupStruct$2))})}),AnnotatedAccountKey$2=type$2({pubkey:PublicKeyFromString$2,signer:boolean$2(),writable:boolean$2(),source:optional$2(union$2([literal$2("transaction"),literal$2("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$2=type$2({accountKeys:array$2(AnnotatedAccountKey$2),signatures:array$2(string$2())}),ParsedInstructionResult$2=type$2({parsed:unknown$2(),program:string$2(),programId:PublicKeyFromString$2}),RawInstructionResult$2=type$2({accounts:array$2(PublicKeyFromString$2),data:string$2(),programId:PublicKeyFromString$2}),InstructionResult$2=union$2([RawInstructionResult$2,ParsedInstructionResult$2]),UnknownInstructionResult$2=union$2([type$2({parsed:unknown$2(),program:string$2(),programId:string$2()}),type$2({accounts:array$2(string$2()),data:string$2(),programId:string$2()})]),ParsedOrRawInstruction$2=coerce$2(InstructionResult$2,UnknownInstructionResult$2,Xr=>"accounts"in Xr?create$2(Xr,RawInstructionResult$2):create$2(Xr,ParsedInstructionResult$2)),ParsedConfirmedTransactionResult$2=type$2({signatures:array$2(string$2()),message:type$2({accountKeys:array$2(AnnotatedAccountKey$2),instructions:array$2(ParsedOrRawInstruction$2),recentBlockhash:string$2(),addressTableLookups:optional$2(nullable$2(array$2(AddressTableLookupStruct$2)))})}),TokenBalanceResult$2=type$2({accountIndex:number$3(),mint:string$2(),owner:optional$2(string$2()),uiTokenAmount:TokenAmountResult$2}),LoadedAddressesResult$2=type$2({writable:array$2(PublicKeyFromString$2),readonly:array$2(PublicKeyFromString$2)}),ConfirmedTransactionMetaResult$2=type$2({err:TransactionErrorResult$2,fee:number$3(),innerInstructions:optional$2(nullable$2(array$2(type$2({index:number$3(),instructions:array$2(type$2({accounts:array$2(number$3()),data:string$2(),programIdIndex:number$3()}))})))),preBalances:array$2(number$3()),postBalances:array$2(number$3()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),loadedAddresses:optional$2(LoadedAddressesResult$2),computeUnitsConsumed:optional$2(number$3())}),ParsedConfirmedTransactionMetaResult$2=type$2({err:TransactionErrorResult$2,fee:number$3(),innerInstructions:optional$2(nullable$2(array$2(type$2({index:number$3(),instructions:array$2(ParsedOrRawInstruction$2)})))),preBalances:array$2(number$3()),postBalances:array$2(number$3()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),loadedAddresses:optional$2(LoadedAddressesResult$2),computeUnitsConsumed:optional$2(number$3())}),TransactionVersionStruct$2=union$2([literal$2(0),literal$2("legacy")]),RewardsResult$2=type$2({pubkey:string$2(),lamports:number$3(),postBalance:nullable$2(number$3()),rewardType:nullable$2(string$2()),commission:optional$2(nullable$2(number$3()))}),GetBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionAccountsModeResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ParsedConfirmedTransactionResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionAccountsModeResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetConfirmedBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3())}))),GetBlockSignaturesRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),signatures:array$2(string$2()),blockTime:nullable$2(number$3())}))),GetTransactionRpcResult=jsonRpcResult$2(nullable$2(type$2({slot:number$3(),meta:nullable$2(ConfirmedTransactionMetaResult$2),blockTime:optional$2(nullable$2(number$3())),transaction:ConfirmedTransactionResult$2,version:optional$2(TransactionVersionStruct$2)}))),GetParsedTransactionRpcResult=jsonRpcResult$2(nullable$2(type$2({slot:number$3(),transaction:ParsedConfirmedTransactionResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),blockTime:optional$2(nullable$2(number$3())),version:optional$2(TransactionVersionStruct$2)}))),GetRecentBlockhashAndContextRpcResult=jsonRpcResultAndContext$2(type$2({blockhash:string$2(),feeCalculator:type$2({lamportsPerSignature:number$3()})})),GetLatestBlockhashRpcResult=jsonRpcResultAndContext$2(type$2({blockhash:string$2(),lastValidBlockHeight:number$3()})),IsBlockhashValidRpcResult=jsonRpcResultAndContext$2(boolean$2()),PerfSampleResult$2=type$2({slot:number$3(),numTransactions:number$3(),numSlots:number$3(),samplePeriodSecs:number$3()}),GetRecentPerformanceSamplesRpcResult=jsonRpcResult$2(array$2(PerfSampleResult$2)),GetFeeCalculatorRpcResult=jsonRpcResultAndContext$2(nullable$2(type$2({feeCalculator:type$2({lamportsPerSignature:number$3()})}))),RequestAirdropRpcResult=jsonRpcResult$2(string$2()),SendTransactionRpcResult=jsonRpcResult$2(string$2()),LogsResult$2=type$2({err:TransactionErrorResult$2,logs:array$2(string$2()),signature:string$2()}),LogsNotificationResult=type$2({result:notificationResultAndContext$2(LogsResult$2),subscription:number$3()}),COMMON_HTTP_HEADERS={"solana-client":"js/0.0.0-development"};class Connection{constructor(eo,to){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const co={};return async lo=>{const{commitment:fo,config:ho}=extractCommitmentFromConfig(lo),go=this._buildArgs([],fo,void 0,ho),yo=fastStableStringify$1(go);return co[yo]=co[yo]??(async()=>{try{const vo=await this._rpcRequest("getBlockHeight",go),wo=create$2(vo,jsonRpcResult$2(number$3()));if("error"in wo)throw new SolanaJSONRPCError(wo.error,"failed to get block height information");return wo.result}finally{delete co[yo]}})(),await co[yo]}})();let ro,no,io,oo,ao,so;to&&typeof to=="string"?this._commitment=to:to&&(this._commitment=to.commitment,this._confirmTransactionInitialTimeout=to.confirmTransactionInitialTimeout,ro=to.wsEndpoint,no=to.httpHeaders,io=to.fetch,oo=to.fetchMiddleware,ao=to.disableRetryOnRateLimit,so=to.httpAgent),this._rpcEndpoint=assertEndpointUrl(eo),this._rpcWsEndpoint=ro||makeWebsocketUrl(eo),this._rpcClient=createRpcClient(eo,no,io,oo,ao,so),this._rpcRequest=createRpcRequest(this._rpcClient),this._rpcBatchRequest=createRpcBatchRequest(this._rpcClient),this._rpcWebSocket=new RpcWebSocketClient(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,void 0,no),oo=await this._rpcRequest("getBalance",io),ao=create$2(oo,jsonRpcResultAndContext$2(number$3()));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get balance for ${eo.toBase58()}`);return ao.result}async getBalance(eo,to){return await this.getBalanceAndContext(eo,to).then(ro=>ro.value).catch(ro=>{throw new Error("failed to get balance of account "+eo.toBase58()+": "+ro)})}async getBlockTime(eo){const to=await this._rpcRequest("getBlockTime",[eo]),ro=create$2(to,jsonRpcResult$2(nullable$2(number$3())));if("error"in ro)throw new SolanaJSONRPCError(ro.error,`failed to get block time for slot ${eo}`);return ro.result}async getMinimumLedgerSlot(){const eo=await this._rpcRequest("minimumLedgerSlot",[]),to=create$2(eo,jsonRpcResult$2(number$3()));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get minimum ledger slot");return to.result}async getFirstAvailableBlock(){const eo=await this._rpcRequest("getFirstAvailableBlock",[]),to=create$2(eo,SlotRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get first available block");return to.result}async getSupply(eo){let to={};typeof eo=="string"?to={commitment:eo}:eo?to={...eo,commitment:eo&&eo.commitment||this.commitment}:to={commitment:this.commitment};const ro=await this._rpcRequest("getSupply",[to]),no=create$2(ro,GetSupplyRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get supply");return no.result}async getTokenSupply(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenSupply",ro),io=create$2(no,jsonRpcResultAndContext$2(TokenAmountResult$2));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token supply");return io.result}async getTokenAccountBalance(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenAccountBalance",ro),io=create$2(no,jsonRpcResultAndContext$2(TokenAmountResult$2));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token account balance");return io.result}async getTokenAccountsByOwner(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(ro);let oo=[eo.toBase58()];"mint"in to?oo.push({mint:to.mint.toBase58()}):oo.push({programId:to.programId.toBase58()});const ao=this._buildArgs(oo,no,"base64",io),so=await this._rpcRequest("getTokenAccountsByOwner",ao),co=create$2(so,GetTokenAccountsByOwner);if("error"in co)throw new SolanaJSONRPCError(co.error,`failed to get token accounts owned by account ${eo.toBase58()}`);return co.result}async getParsedTokenAccountsByOwner(eo,to,ro){let no=[eo.toBase58()];"mint"in to?no.push({mint:to.mint.toBase58()}):no.push({programId:to.programId.toBase58()});const io=this._buildArgs(no,ro,"jsonParsed"),oo=await this._rpcRequest("getTokenAccountsByOwner",io),ao=create$2(oo,GetParsedTokenAccountsByOwner);if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get token accounts owned by account ${eo.toBase58()}`);return ao.result}async getLargestAccounts(eo){const to={...eo,commitment:eo&&eo.commitment||this.commitment},ro=to.filter||to.commitment?[to]:[],no=await this._rpcRequest("getLargestAccounts",ro),io=create$2(no,GetLargestAccountsRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get largest accounts");return io.result}async getTokenLargestAccounts(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenLargestAccounts",ro),io=create$2(no,GetTokenLargestAccountsResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token largest accounts");return io.result}async getAccountInfoAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"base64",no),oo=await this._rpcRequest("getAccountInfo",io),ao=create$2(oo,jsonRpcResultAndContext$2(nullable$2(AccountInfoResult$2)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get info about account ${eo.toBase58()}`);return ao.result}async getParsedAccountInfo(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"jsonParsed",no),oo=await this._rpcRequest("getAccountInfo",io),ao=create$2(oo,jsonRpcResultAndContext$2(nullable$2(ParsedAccountInfoResult$2)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get info about account ${eo.toBase58()}`);return ao.result}async getAccountInfo(eo,to){try{return(await this.getAccountInfoAndContext(eo,to)).value}catch(ro){throw new Error("failed to get info about account "+eo.toBase58()+": "+ro)}}async getMultipleParsedAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(co=>co.toBase58()),oo=this._buildArgs([io],ro,"jsonParsed",no),ao=await this._rpcRequest("getMultipleAccounts",oo),so=create$2(ao,jsonRpcResultAndContext$2(array$2(nullable$2(ParsedAccountInfoResult$2))));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get info for accounts ${io}`);return so.result}async getMultipleAccountsInfoAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(co=>co.toBase58()),oo=this._buildArgs([io],ro,"base64",no),ao=await this._rpcRequest("getMultipleAccounts",oo),so=create$2(ao,jsonRpcResultAndContext$2(array$2(nullable$2(AccountInfoResult$2))));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get info for accounts ${io}`);return so.result}async getMultipleAccountsInfo(eo,to){return(await this.getMultipleAccountsInfoAndContext(eo,to)).value}async getStakeActivation(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(to),oo=this._buildArgs([eo.toBase58()],no,void 0,{...io,epoch:ro??(io==null?void 0:io.epoch)}),ao=await this._rpcRequest("getStakeActivation",oo),so=create$2(ao,jsonRpcResult$2(StakeActivationResult));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get Stake Activation ${eo.toBase58()}`);return so.result}async getProgramAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),{encoding:io,...oo}=no||{},ao=this._buildArgs([eo.toBase58()],ro,io||"base64",oo),so=await this._rpcRequest("getProgramAccounts",ao),co=array$2(KeyedAccountInfoResult),lo=oo.withContext===!0?create$2(so,jsonRpcResultAndContext$2(co)):create$2(so,jsonRpcResult$2(co));if("error"in lo)throw new SolanaJSONRPCError(lo.error,`failed to get accounts owned by program ${eo.toBase58()}`);return lo.result}async getParsedProgramAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"jsonParsed",no),oo=await this._rpcRequest("getProgramAccounts",io),ao=create$2(oo,jsonRpcResult$2(array$2(KeyedParsedAccountInfoResult)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get accounts owned by program ${eo.toBase58()}`);return ao.result}async confirmTransaction(eo,to){var io;let ro;if(typeof eo=="string")ro=eo;else{const oo=eo;if((io=oo.abortSignal)!=null&&io.aborted)return Promise.reject(oo.abortSignal.reason);ro=oo.signature}let no;try{no=bs58$3.decode(ro)}catch{throw new Error("signature must be base58 encoded: "+ro)}return assert$5(no.length===64,"signature has invalid length"),typeof eo=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:to||this.commitment,signature:ro}):"lastValidBlockHeight"in eo?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:to||this.commitment,strategy:eo}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:to||this.commitment,strategy:eo})}getCancellationPromise(eo){return new Promise((to,ro)=>{eo!=null&&(eo.aborted?ro(eo.reason):eo.addEventListener("abort",()=>{ro(eo.reason)}))})}getTransactionConfirmationPromise({commitment:eo,signature:to}){let ro,no,io=!1;const oo=new Promise((so,co)=>{try{ro=this.onSignature(to,(fo,ho)=>{ro=void 0;const go={context:ho,value:fo};so({__type:TransactionStatus$1.PROCESSED,response:go})},eo);const lo=new Promise(fo=>{ro==null?fo():no=this._onSubscriptionStateChange(ro,ho=>{ho==="subscribed"&&fo()})});(async()=>{if(await lo,io)return;const fo=await this.getSignatureStatus(to);if(io||fo==null)return;const{context:ho,value:go}=fo;if(go!=null)if(go!=null&&go.err)co(go.err);else{switch(eo){case"confirmed":case"single":case"singleGossip":{if(go.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(go.confirmationStatus==="processed"||go.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}io=!0,so({__type:TransactionStatus$1.PROCESSED,response:{context:ho,value:go}})}})()}catch(lo){co(lo)}});return{abortConfirmation:()=>{no&&(no(),no=void 0),ro!=null&&(this.removeSignatureListener(ro),ro=void 0)},confirmationPromise:oo}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:eo,strategy:{abortSignal:to,lastValidBlockHeight:ro,signature:no}}){let io=!1;const oo=new Promise(fo=>{const ho=async()=>{try{return await this.getBlockHeight(eo)}catch{return-1}};(async()=>{let go=await ho();if(!io){for(;go<=ro;)if(await sleep(1e3),io||(go=await ho(),io))return;fo({__type:TransactionStatus$1.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:ao,confirmationPromise:so}=this.getTransactionConfirmationPromise({commitment:eo,signature:no}),co=this.getCancellationPromise(to);let lo;try{const fo=await Promise.race([co,so,oo]);if(fo.__type===TransactionStatus$1.PROCESSED)lo=fo.response;else throw new TransactionExpiredBlockheightExceededError(no)}finally{io=!0,ao()}return lo}async confirmTransactionUsingDurableNonceStrategy({commitment:eo,strategy:{abortSignal:to,minContextSlot:ro,nonceAccountPubkey:no,nonceValue:io,signature:oo}}){let ao=!1;const so=new Promise(go=>{let yo=io,vo=null;const wo=async()=>{try{const{context:Eo,value:ko}=await this.getNonceAndContext(no,{commitment:eo,minContextSlot:ro});return vo=Eo.slot,ko==null?void 0:ko.nonce}catch{return yo}};(async()=>{if(yo=await wo(),!ao)for(;;){if(io!==yo){go({__type:TransactionStatus$1.NONCE_INVALID,slotInWhichNonceDidAdvance:vo});return}if(await sleep(2e3),ao||(yo=await wo(),ao))return}})()}),{abortConfirmation:co,confirmationPromise:lo}=this.getTransactionConfirmationPromise({commitment:eo,signature:oo}),fo=this.getCancellationPromise(to);let ho;try{const go=await Promise.race([fo,lo,so]);if(go.__type===TransactionStatus$1.PROCESSED)ho=go.response;else{let yo;for(;;){const vo=await this.getSignatureStatus(oo);if(vo==null)break;if(vo.context.slot<(go.slotInWhichNonceDidAdvance??ro)){await sleep(400);continue}yo=vo;break}if(yo!=null&&yo.value){const vo=eo||"finalized",{confirmationStatus:wo}=yo.value;switch(vo){case"processed":case"recent":if(wo!=="processed"&&wo!=="confirmed"&&wo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;case"confirmed":case"single":case"singleGossip":if(wo!=="confirmed"&&wo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;case"finalized":case"max":case"root":if(wo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;default:}ho={context:yo.context,value:{err:yo.value.err}}}else throw new TransactionExpiredNonceInvalidError(oo)}}finally{ao=!0,co()}return ho}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:eo,signature:to}){let ro;const no=new Promise(so=>{let co=this._confirmTransactionInitialTimeout||6e4;switch(eo){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{co=this._confirmTransactionInitialTimeout||3e4;break}}ro=setTimeout(()=>so({__type:TransactionStatus$1.TIMED_OUT,timeoutMs:co}),co)}),{abortConfirmation:io,confirmationPromise:oo}=this.getTransactionConfirmationPromise({commitment:eo,signature:to});let ao;try{const so=await Promise.race([oo,no]);if(so.__type===TransactionStatus$1.PROCESSED)ao=so.response;else throw new TransactionExpiredTimeoutError(to,so.timeoutMs/1e3)}finally{clearTimeout(ro),io()}return ao}async getClusterNodes(){const eo=await this._rpcRequest("getClusterNodes",[]),to=create$2(eo,jsonRpcResult$2(array$2(ContactInfoResult)));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get cluster nodes");return to.result}async getVoteAccounts(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getVoteAccounts",to),no=create$2(ro,GetVoteAccounts);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get vote accounts");return no.result}async getSlot(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getSlot",no),oo=create$2(io,jsonRpcResult$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get slot");return oo.result}async getSlotLeader(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getSlotLeader",no),oo=create$2(io,jsonRpcResult$2(string$2()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get slot leader");return oo.result}async getSlotLeaders(eo,to){const ro=[eo,to],no=await this._rpcRequest("getSlotLeaders",ro),io=create$2(no,jsonRpcResult$2(array$2(PublicKeyFromString$2)));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get slot leaders");return io.result}async getSignatureStatus(eo,to){const{context:ro,value:no}=await this.getSignatureStatuses([eo],to);assert$5(no.length===1);const io=no[0];return{context:ro,value:io}}async getSignatureStatuses(eo,to){const ro=[eo];to&&ro.push(to);const no=await this._rpcRequest("getSignatureStatuses",ro),io=create$2(no,GetSignatureStatusesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get signature status");return io.result}async getTransactionCount(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getTransactionCount",no),oo=create$2(io,jsonRpcResult$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get transaction count");return oo.result}async getTotalSupply(eo){return(await this.getSupply({commitment:eo,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getInflationGovernor",to),no=create$2(ro,GetInflationGovernorRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get inflation");return no.result}async getInflationReward(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(ro),oo=this._buildArgs([eo.map(co=>co.toBase58())],no,void 0,{...io,epoch:to??(io==null?void 0:io.epoch)}),ao=await this._rpcRequest("getInflationReward",oo),so=create$2(ao,GetInflationRewardResult);if("error"in so)throw new SolanaJSONRPCError(so.error,"failed to get inflation reward");return so.result}async getInflationRate(){const eo=await this._rpcRequest("getInflationRate",[]),to=create$2(eo,GetInflationRateRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get inflation rate");return to.result}async getEpochInfo(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getEpochInfo",no),oo=create$2(io,GetEpochInfoRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get epoch info");return oo.result}async getEpochSchedule(){const eo=await this._rpcRequest("getEpochSchedule",[]),to=create$2(eo,GetEpochScheduleRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get epoch schedule");const ro=to.result;return new EpochSchedule(ro.slotsPerEpoch,ro.leaderScheduleSlotOffset,ro.warmup,ro.firstNormalEpoch,ro.firstNormalSlot)}async getLeaderSchedule(){const eo=await this._rpcRequest("getLeaderSchedule",[]),to=create$2(eo,GetLeaderScheduleRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get leader schedule");return to.result}async getMinimumBalanceForRentExemption(eo,to){const ro=this._buildArgs([eo],to),no=await this._rpcRequest("getMinimumBalanceForRentExemption",ro),io=create$2(no,GetMinimumBalanceForRentExemptionRpcResult);return"error"in io?(console.warn("Unable to fetch minimum balance for rent exemption"),0):io.result}async getRecentBlockhashAndContext(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getRecentBlockhash",to),no=create$2(ro,GetRecentBlockhashAndContextRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get recent blockhash");return no.result}async getRecentPerformanceSamples(eo){const to=await this._rpcRequest("getRecentPerformanceSamples",eo?[eo]:[]),ro=create$2(to,GetRecentPerformanceSamplesRpcResult);if("error"in ro)throw new SolanaJSONRPCError(ro.error,"failed to get recent performance samples");return ro.result}async getFeeCalculatorForBlockhash(eo,to){const ro=this._buildArgs([eo],to),no=await this._rpcRequest("getFeeCalculatorForBlockhash",ro),io=create$2(no,GetFeeCalculatorRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get fee calculator");const{context:oo,value:ao}=io.result;return{context:oo,value:ao!==null?ao.feeCalculator:null}}async getFeeForMessage(eo,to){const ro=toBuffer$2(eo.serialize()).toString("base64"),no=this._buildArgs([ro],to),io=await this._rpcRequest("getFeeForMessage",no),oo=create$2(io,jsonRpcResultAndContext$2(nullable$2(number$3())));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get fee for message");if(oo.result===null)throw new Error("invalid blockhash");return oo.result}async getRecentPrioritizationFees(eo){var oo;const to=(oo=eo==null?void 0:eo.lockedWritableAccounts)==null?void 0:oo.map(ao=>ao.toBase58()),ro=to!=null&&to.length?[to]:[],no=await this._rpcRequest("getRecentPrioritizationFees",ro),io=create$2(no,GetRecentPrioritizationFeesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get recent prioritization fees");return io.result}async getRecentBlockhash(eo){try{return(await this.getRecentBlockhashAndContext(eo)).value}catch(to){throw new Error("failed to get recent blockhash: "+to)}}async getLatestBlockhash(eo){try{return(await this.getLatestBlockhashAndContext(eo)).value}catch(to){throw new Error("failed to get recent blockhash: "+to)}}async getLatestBlockhashAndContext(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getLatestBlockhash",no),oo=create$2(io,GetLatestBlockhashRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get latest blockhash");return oo.result}async isBlockhashValid(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo],ro,void 0,no),oo=await this._rpcRequest("isBlockhashValid",io),ao=create$2(oo,IsBlockhashValidRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to determine if the blockhash `"+eo+"`is valid");return ao.result}async getVersion(){const eo=await this._rpcRequest("getVersion",[]),to=create$2(eo,jsonRpcResult$2(VersionResult));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get version");return to.result}async getGenesisHash(){const eo=await this._rpcRequest("getGenesisHash",[]),to=create$2(eo,jsonRpcResult$2(string$2()));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get genesis hash");return to.result}async getBlock(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,void 0,no),oo=await this._rpcRequest("getBlock",io);try{switch(no==null?void 0:no.transactionDetails){case"accounts":{const ao=create$2(oo,GetAccountsModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}case"none":{const ao=create$2(oo,GetNoneModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}default:{const ao=create$2(oo,GetBlockRpcResult);if("error"in ao)throw ao.error;const{result:so}=ao;return so?{...so,transactions:so.transactions.map(({transaction:co,meta:lo,version:fo})=>({meta:lo,transaction:{...co,message:versionedMessageFromResponse(fo,co.message)},version:fo}))}:null}}}catch(ao){throw new SolanaJSONRPCError(ao,"failed to get confirmed block")}}async getParsedBlock(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,"jsonParsed",no),oo=await this._rpcRequest("getBlock",io);try{switch(no==null?void 0:no.transactionDetails){case"accounts":{const ao=create$2(oo,GetParsedAccountsModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}case"none":{const ao=create$2(oo,GetParsedNoneModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}default:{const ao=create$2(oo,GetParsedBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}}}catch(ao){throw new SolanaJSONRPCError(ao,"failed to get block")}}async getBlockProduction(eo){let to,ro;if(typeof eo=="string")ro=eo;else if(eo){const{commitment:ao,...so}=eo;ro=ao,to=so}const no=this._buildArgs([],ro,"base64",to),io=await this._rpcRequest("getBlockProduction",no),oo=create$2(io,BlockProductionResponseStruct);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get block production information");return oo.result}async getTransaction(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,void 0,no),oo=await this._rpcRequest("getTransaction",io),ao=create$2(oo,GetTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get transaction");const so=ao.result;return so&&{...so,transaction:{...so.transaction,message:versionedMessageFromResponse(so.version,so.transaction.message)}}}async getParsedTransaction(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,"jsonParsed",no),oo=await this._rpcRequest("getTransaction",io),ao=create$2(oo,GetParsedTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get transaction");return ao.result}async getParsedTransactions(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(so=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([so],ro,"jsonParsed",no)}));return(await this._rpcBatchRequest(io)).map(so=>{const co=create$2(so,GetParsedTransactionRpcResult);if("error"in co)throw new SolanaJSONRPCError(co.error,"failed to get transactions");return co.result})}async getTransactions(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(so=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([so],ro,void 0,no)}));return(await this._rpcBatchRequest(io)).map(so=>{const co=create$2(so,GetTransactionRpcResult);if("error"in co)throw new SolanaJSONRPCError(co.error,"failed to get transactions");const lo=co.result;return lo&&{...lo,transaction:{...lo.transaction,message:versionedMessageFromResponse(lo.version,lo.transaction.message)}}})}async getConfirmedBlock(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to),no=await this._rpcRequest("getConfirmedBlock",ro),io=create$2(no,GetConfirmedBlockRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed block");const oo=io.result;if(!oo)throw new Error("Confirmed block "+eo+" not found");const ao={...oo,transactions:oo.transactions.map(({transaction:so,meta:co})=>{const lo=new Message(so.message);return{meta:co,transaction:{...so,message:lo}}})};return{...ao,transactions:ao.transactions.map(({transaction:so,meta:co})=>({meta:co,transaction:Transaction.populate(so.message,so.signatures)}))}}async getBlocks(eo,to,ro){const no=this._buildArgsAtLeastConfirmed(to!==void 0?[eo,to]:[eo],ro),io=await this._rpcRequest("getBlocks",no),oo=create$2(io,jsonRpcResult$2(array$2(number$3())));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get blocks");return oo.result}async getBlockSignatures(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,void 0,{transactionDetails:"signatures",rewards:!1}),no=await this._rpcRequest("getBlock",ro),io=create$2(no,GetBlockSignaturesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get block");const oo=io.result;if(!oo)throw new Error("Block "+eo+" not found");return oo}async getConfirmedBlockSignatures(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,void 0,{transactionDetails:"signatures",rewards:!1}),no=await this._rpcRequest("getConfirmedBlock",ro),io=create$2(no,GetBlockSignaturesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed block");const oo=io.result;if(!oo)throw new Error("Confirmed block "+eo+" not found");return oo}async getConfirmedTransaction(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to),no=await this._rpcRequest("getConfirmedTransaction",ro),io=create$2(no,GetTransactionRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get transaction");const oo=io.result;if(!oo)return oo;const ao=new Message(oo.transaction.message),so=oo.transaction.signatures;return{...oo,transaction:Transaction.populate(ao,so)}}async getParsedConfirmedTransaction(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,"jsonParsed"),no=await this._rpcRequest("getConfirmedTransaction",ro),io=create$2(no,GetParsedTransactionRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed transaction");return io.result}async getParsedConfirmedTransactions(eo,to){const ro=eo.map(oo=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([oo],to,"jsonParsed")}));return(await this._rpcBatchRequest(ro)).map(oo=>{const ao=create$2(oo,GetParsedTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get confirmed transactions");return ao.result})}async getConfirmedSignaturesForAddress(eo,to,ro){let no={},io=await this.getFirstAvailableBlock();for(;!("until"in no)&&(to--,!(to<=0||to0&&(no.until=so.signatures[so.signatures.length-1].toString())}catch(so){if(so instanceof Error&&so.message.includes("skipped"))continue;throw so}let oo=await this.getSlot("finalized");for(;!("before"in no)&&(ro++,!(ro>oo));)try{const so=await this.getConfirmedBlockSignatures(ro);so.signatures.length>0&&(no.before=so.signatures[so.signatures.length-1].toString())}catch(so){if(so instanceof Error&&so.message.includes("skipped"))continue;throw so}return(await this.getConfirmedSignaturesForAddress2(eo,no)).map(so=>so.signature)}async getConfirmedSignaturesForAddress2(eo,to,ro){const no=this._buildArgsAtLeastConfirmed([eo.toBase58()],ro,void 0,to),io=await this._rpcRequest("getConfirmedSignaturesForAddress2",no),oo=create$2(io,GetConfirmedSignaturesForAddress2RpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get confirmed signatures for address");return oo.result}async getSignaturesForAddress(eo,to,ro){const no=this._buildArgsAtLeastConfirmed([eo.toBase58()],ro,void 0,to),io=await this._rpcRequest("getSignaturesForAddress",no),oo=create$2(io,GetSignaturesForAddressRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get signatures for address");return oo.result}async getAddressLookupTable(eo,to){const{context:ro,value:no}=await this.getAccountInfoAndContext(eo,to);let io=null;return no!==null&&(io=new AddressLookupTableAccount({key:eo,state:AddressLookupTableAccount.deserialize(no.data)})),{context:ro,value:io}}async getNonceAndContext(eo,to){const{context:ro,value:no}=await this.getAccountInfoAndContext(eo,to);let io=null;return no!==null&&(io=NonceAccount.fromAccountData(no.data)),{context:ro,value:io}}async getNonce(eo,to){return await this.getNonceAndContext(eo,to).then(ro=>ro.value).catch(ro=>{throw new Error("failed to get nonce for account "+eo.toBase58()+": "+ro)})}async requestAirdrop(eo,to){const ro=await this._rpcRequest("requestAirdrop",[eo.toBase58(),to]),no=create$2(ro,RequestAirdropRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,`airdrop to ${eo.toBase58()} failed`);return no.result}async _blockhashWithExpiryBlockHeight(eo){if(!eo){for(;this._pollingBlockhash;)await sleep(100);const ro=Date.now()-this._blockhashInfo.lastFetch>=BLOCKHASH_CACHE_TIMEOUT_MS;if(this._blockhashInfo.latestBlockhash!==null&&!ro)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const eo=Date.now(),to=this._blockhashInfo.latestBlockhash,ro=to?to.blockhash:null;for(let no=0;no<50;no++){const io=await this.getLatestBlockhash("finalized");if(ro!==io.blockhash)return this._blockhashInfo={latestBlockhash:io,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},io;await sleep(MS_PER_SLOT/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-eo}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,"base64",ro),io=await this._rpcRequest("getStakeMinimumDelegation",no),oo=create$2(io,jsonRpcResultAndContext$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get stake minimum delegation");return oo.result}async simulateTransaction(eo,to,ro){if("message"in eo){const vo=eo.serialize(),wo=Buffer$1$1.from(vo).toString("base64");if(Array.isArray(to)||ro!==void 0)throw new Error("Invalid arguments");const Eo=to||{};Eo.encoding="base64","commitment"in Eo||(Eo.commitment=this.commitment);const ko=[wo,Eo],Ao=await this._rpcRequest("simulateTransaction",ko),Po=create$2(Ao,SimulatedTransactionResponseStruct);if("error"in Po)throw new Error("failed to simulate transaction: "+Po.error.message);return Po.result}let no;if(eo instanceof Transaction){let yo=eo;no=new Transaction,no.feePayer=yo.feePayer,no.instructions=eo.instructions,no.nonceInfo=yo.nonceInfo,no.signatures=yo.signatures}else no=Transaction.populate(eo),no._message=no._json=void 0;if(to!==void 0&&!Array.isArray(to))throw new Error("Invalid arguments");const io=to;if(no.nonceInfo&&io)no.sign(...io);else{let yo=this._disableBlockhashCaching;for(;;){const vo=await this._blockhashWithExpiryBlockHeight(yo);if(no.lastValidBlockHeight=vo.lastValidBlockHeight,no.recentBlockhash=vo.blockhash,!io)break;if(no.sign(...io),!no.signature)throw new Error("!signature");const wo=no.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(wo)&&!this._blockhashInfo.transactionSignatures.includes(wo)){this._blockhashInfo.simulatedSignatures.push(wo);break}else yo=!0}}const oo=no._compile(),ao=oo.serialize(),co=no._serialize(ao).toString("base64"),lo={encoding:"base64",commitment:this.commitment};if(ro){const yo=(Array.isArray(ro)?ro:oo.nonProgramIds()).map(vo=>vo.toBase58());lo.accounts={encoding:"base64",addresses:yo}}io&&(lo.sigVerify=!0);const fo=[co,lo],ho=await this._rpcRequest("simulateTransaction",fo),go=create$2(ho,SimulatedTransactionResponseStruct);if("error"in go){let yo;if("data"in go.error&&(yo=go.error.data.logs,yo&&Array.isArray(yo))){const vo=` - `,wo=vo+yo.join(vo);console.error(go.error.message,wo)}throw new SendTransactionError({action:"simulate",signature:"",transactionMessage:go.error.message,logs:yo})}return go.result}async sendTransaction(eo,to,ro){if("version"in eo){if(to&&Array.isArray(to))throw new Error("Invalid arguments");const oo=eo.serialize();return await this.sendRawTransaction(oo,to)}if(to===void 0||!Array.isArray(to))throw new Error("Invalid arguments");const no=to;if(eo.nonceInfo)eo.sign(...no);else{let oo=this._disableBlockhashCaching;for(;;){const ao=await this._blockhashWithExpiryBlockHeight(oo);if(eo.lastValidBlockHeight=ao.lastValidBlockHeight,eo.recentBlockhash=ao.blockhash,eo.sign(...no),!eo.signature)throw new Error("!signature");const so=eo.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(so))oo=!0;else{this._blockhashInfo.transactionSignatures.push(so);break}}}const io=eo.serialize();return await this.sendRawTransaction(io,ro)}async sendRawTransaction(eo,to){const ro=toBuffer$2(eo).toString("base64");return await this.sendEncodedTransaction(ro,to)}async sendEncodedTransaction(eo,to){const ro={encoding:"base64"},no=to&&to.skipPreflight,io=no===!0?"processed":to&&to.preflightCommitment||this.commitment;to&&to.maxRetries!=null&&(ro.maxRetries=to.maxRetries),to&&to.minContextSlot!=null&&(ro.minContextSlot=to.minContextSlot),no&&(ro.skipPreflight=no),io&&(ro.preflightCommitment=io);const oo=[eo,ro],ao=await this._rpcRequest("sendTransaction",oo),so=create$2(ao,SendTransactionRpcResult);if("error"in so){let co;throw"data"in so.error&&(co=so.error.data.logs),new SendTransactionError({action:no?"send":"simulate",signature:"",transactionMessage:so.error.message,logs:co})}return so.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(eo){this._rpcWebSocketConnected=!1,console.error("ws error:",eo.message)}_wsOnClose(eo){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),eo===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([to,ro])=>{this._setSubscription(to,{...ro,state:"pending"})})}_setSubscription(eo,to){var no;const ro=(no=this._subscriptionsByHash[eo])==null?void 0:no.state;if(this._subscriptionsByHash[eo]=to,ro!==to.state){const io=this._subscriptionStateChangeCallbacksByHash[eo];io&&io.forEach(oo=>{try{oo(to.state)}catch{}})}}_onSubscriptionStateChange(eo,to){var io;const ro=this._subscriptionHashByClientSubscriptionId[eo];if(ro==null)return()=>{};const no=(io=this._subscriptionStateChangeCallbacksByHash)[ro]||(io[ro]=new Set);return no.add(to),()=>{no.delete(to),no.size===0&&delete this._subscriptionStateChangeCallbacksByHash[ro]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(ro){ro instanceof Error&&console.log(`Error when closing socket connection: ${ro.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const eo=this._rpcWebSocketGeneration,to=()=>eo===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async ro=>{const no=this._subscriptionsByHash[ro];if(no!==void 0)switch(no.state){case"pending":case"unsubscribed":if(no.callbacks.size===0){delete this._subscriptionsByHash[ro],no.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[no.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:io,method:oo}=no;try{this._setSubscription(ro,{...no,state:"subscribing"});const ao=await this._rpcWebSocket.call(oo,io);this._setSubscription(ro,{...no,serverSubscriptionId:ao,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[ao]=no.callbacks,await this._updateSubscriptions()}catch(ao){if(ao instanceof Error&&console.error(`${oo} error for argument`,io,ao.message),!to())return;this._setSubscription(ro,{...no,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":no.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:io,unsubscribeMethod:oo}=no;if(this._subscriptionsAutoDisposedByRpc.has(io))this._subscriptionsAutoDisposedByRpc.delete(io);else{this._setSubscription(ro,{...no,state:"unsubscribing"}),this._setSubscription(ro,{...no,state:"unsubscribing"});try{await this._rpcWebSocket.call(oo,[io])}catch(ao){if(ao instanceof Error&&console.error(`${oo} error:`,ao.message),!to())return;this._setSubscription(ro,{...no,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(ro,{...no,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(eo,to){const ro=this._subscriptionCallbacksByServerSubscriptionId[eo];ro!==void 0&&ro.forEach(no=>{try{no(...to)}catch(io){console.error(io)}})}_wsOnAccountNotification(eo){const{result:to,subscription:ro}=create$2(eo,AccountNotificationResult);this._handleServerNotification(ro,[to.value,to.context])}_makeSubscription(eo,to){const ro=this._nextClientSubscriptionId++,no=fastStableStringify$1([eo.method,to]),io=this._subscriptionsByHash[no];return io===void 0?this._subscriptionsByHash[no]={...eo,args:to,callbacks:new Set([eo.callback]),state:"pending"}:io.callbacks.add(eo.callback),this._subscriptionHashByClientSubscriptionId[ro]=no,this._subscriptionDisposeFunctionsByClientSubscriptionId[ro]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[ro],delete this._subscriptionHashByClientSubscriptionId[ro];const oo=this._subscriptionsByHash[no];assert$5(oo!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${ro}`),oo.callbacks.delete(eo.callback),await this._updateSubscriptions()},this._updateSubscriptions(),ro}onAccountChange(eo,to,ro){const no=this._buildArgs([eo.toBase58()],ro||this._commitment||"finalized","base64");return this._makeSubscription({callback:to,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},no)}async removeAccountChangeListener(eo){await this._unsubscribeClientSubscription(eo,"account change")}_wsOnProgramAccountNotification(eo){const{result:to,subscription:ro}=create$2(eo,ProgramAccountNotificationResult);this._handleServerNotification(ro,[{accountId:to.value.pubkey,accountInfo:to.value.account},to.context])}onProgramAccountChange(eo,to,ro,no){const io=this._buildArgs([eo.toBase58()],ro||this._commitment||"finalized","base64",no?{filters:no}:void 0);return this._makeSubscription({callback:to,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},io)}async removeProgramAccountChangeListener(eo){await this._unsubscribeClientSubscription(eo,"program account change")}onLogs(eo,to,ro){const no=this._buildArgs([typeof eo=="object"?{mentions:[eo.toString()]}:eo],ro||this._commitment||"finalized");return this._makeSubscription({callback:to,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},no)}async removeOnLogsListener(eo){await this._unsubscribeClientSubscription(eo,"logs")}_wsOnLogsNotification(eo){const{result:to,subscription:ro}=create$2(eo,LogsNotificationResult);this._handleServerNotification(ro,[to.value,to.context])}_wsOnSlotNotification(eo){const{result:to,subscription:ro}=create$2(eo,SlotNotificationResult);this._handleServerNotification(ro,[to])}onSlotChange(eo){return this._makeSubscription({callback:eo,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(eo){await this._unsubscribeClientSubscription(eo,"slot change")}_wsOnSlotUpdatesNotification(eo){const{result:to,subscription:ro}=create$2(eo,SlotUpdateNotificationResult);this._handleServerNotification(ro,[to])}onSlotUpdate(eo){return this._makeSubscription({callback:eo,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(eo){await this._unsubscribeClientSubscription(eo,"slot update")}async _unsubscribeClientSubscription(eo,to){const ro=this._subscriptionDisposeFunctionsByClientSubscriptionId[eo];ro?await ro():console.warn(`Ignored unsubscribe request because an active subscription with id \`${eo}\` for '${to}' events could not be found.`)}_buildArgs(eo,to,ro,no){const io=to||this._commitment;if(io||ro||no){let oo={};ro&&(oo.encoding=ro),io&&(oo.commitment=io),no&&(oo=Object.assign(oo,no)),eo.push(oo)}return eo}_buildArgsAtLeastConfirmed(eo,to,ro,no){const io=to||this._commitment;if(io&&!["confirmed","finalized"].includes(io))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(eo,to,ro,no)}_wsOnSignatureNotification(eo){const{result:to,subscription:ro}=create$2(eo,SignatureNotificationResult);to.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(ro),this._handleServerNotification(ro,to.value==="receivedSignature"?[{type:"received"},to.context]:[{type:"status",result:to.value},to.context])}onSignature(eo,to,ro){const no=this._buildArgs([eo],ro||this._commitment||"finalized"),io=this._makeSubscription({callback:(oo,ao)=>{if(oo.type==="status"){to(oo.result,ao);try{this.removeSignatureListener(io)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},no);return io}onSignatureWithOptions(eo,to,ro){const{commitment:no,...io}={...ro,commitment:ro&&ro.commitment||this._commitment||"finalized"},oo=this._buildArgs([eo],no,void 0,io),ao=this._makeSubscription({callback:(so,co)=>{to(so,co);try{this.removeSignatureListener(ao)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},oo);return ao}async removeSignatureListener(eo){await this._unsubscribeClientSubscription(eo,"signature result")}_wsOnRootNotification(eo){const{result:to,subscription:ro}=create$2(eo,RootNotificationResult);this._handleServerNotification(ro,[to])}onRootChange(eo){return this._makeSubscription({callback:eo,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(eo){await this._unsubscribeClientSubscription(eo,"root change")}}Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64$3("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64$3(),seq(publicKey$3(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey$2("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$3("microLamports")])}});new PublicKey$2("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$2("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$2("KeccakSecp256k11111111111111111111111111111");var _Lockup$2;new PublicKey$2("StakeConfig11111111111111111111111111111111");let Lockup$2=class{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}};_Lockup$2=Lockup$2;Lockup$2.default=new _Lockup$2(0,0,PublicKey$2.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized$2(),lockup$2()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("stakeAuthorizationType"),rustString$2("authoritySeed"),publicKey$3("authorityOwner")])}});new PublicKey$2("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit$2()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs$2()])}});new PublicKey$2("Vote111111111111111111111111111111111111111");new PublicKey$2("Va1idator1nfo111111111111111111111111111111");type$2({name:string$2(),website:optional$2(string$2()),details:optional$2(string$2()),keybaseUsername:optional$2(string$2())});new PublicKey$2("Vote111111111111111111111111111111111111111");struct([publicKey$3("nodePubkey"),publicKey$3("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$3("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey$3("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const LAMPORTS_PER_SOL$2=1e9;var bn$2={exports:{}};bn$2.exports;(function(Xr){(function(eo,to){function ro(xo,uo){if(!xo)throw new Error(uo||"Assertion failed")}function no(xo,uo){xo.super_=uo;var po=function(){};po.prototype=uo.prototype,xo.prototype=new po,xo.prototype.constructor=xo}function io(xo,uo,po){if(io.isBN(xo))return xo;this.negative=0,this.words=null,this.length=0,this.red=null,xo!==null&&((uo==="le"||uo==="be")&&(po=uo,uo=10),this._init(xo||0,uo||10,po||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(uo){return uo instanceof io?!0:uo!==null&&typeof uo=="object"&&uo.constructor.wordSize===io.wordSize&&Array.isArray(uo.words)},io.max=function(uo,po){return uo.cmp(po)>0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)})(bn$2);var bnExports$1=bn$2.exports;const BN$1=getDefaultExportFromCjs$2(bnExports$1);let StructError$1=class extends TypeError{constructor(eo,to){let ro;const{message:no,explanation:io,...oo}=eo,{path:ao}=eo,so=ao.length===0?no:`At path: ${ao.join(".")} -- ${no}`;super(io??so),io!=null&&(this.cause=so),Object.assign(this,oo),this.name=this.constructor.name,this.failures=()=>ro??(ro=[eo,...to()])}};function isIterable$1(Xr){return isObject$3(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$3(Xr){return typeof Xr=="object"&&Xr!=null}function isNonArrayObject$1(Xr){return isObject$3(Xr)&&!Array.isArray(Xr)}function print$1(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator$1(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure$1(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print$1(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures$1(Xr,eo,to,ro){isIterable$1(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure$1(no,eo,to,ro);io&&(yield io)}}function*run$1(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no,mask:oo};io&&(Xr=eo.coercer(Xr,ao));let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,fo]of eo.entries(Xr,ao)){const ho=run$1(lo,fo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$3(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$3=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures$1(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures$1(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$4(eo,this,to)}create(eo,to){return create$1(eo,this,to)}is(eo){return is$2(eo,this)}mask(eo,to){return mask$1(eo,this,to)}validate(eo,to={}){return validate$1(eo,this,to)}};function assert$4(Xr,eo,to){const ro=validate$1(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create$1(Xr,eo,to){const ro=validate$1(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask$1(Xr,eo,to){const ro=validate$1(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$2(Xr,eo){return!validate$1(Xr,eo)[0]}function validate$1(Xr,eo,to={}){const ro=run$1(Xr,eo,to),no=shiftIterator$1(ro);return no[0]?[new StructError$1(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define$1(Xr,eo){return new Struct$3({type:Xr,schema:null,validator:eo})}function any$1(){return define$1("any",()=>!0)}function array$1(Xr){return new Struct$3({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print$1(eo)}`}})}function boolean$1(){return define$1("boolean",Xr=>typeof Xr=="boolean")}function instance$1(Xr){return define$1("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print$1(eo)}`)}function literal$1(Xr){const eo=print$1(Xr),to=typeof Xr;return new Struct$3({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print$1(ro)}`}})}function never$1(){return define$1("never",()=>!1)}function nullable$1(Xr){return new Struct$3({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$2(){return define$1("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print$1(Xr)}`)}function optional$1(Xr){return new Struct$3({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record$1(Xr,eo){return new Struct$3({type:"record",schema:null,*entries(to){if(isObject$3(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isNonArrayObject$1(to)||`Expected an object, but received: ${print$1(to)}`},coercer(to){return isNonArrayObject$1(to)?{...to}:to}})}function string$1(){return define$1("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print$1(Xr)}`)}function tuple$2(Xr){const eo=never$1();return new Struct$3({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$3({type:"union",schema:null,coercer(to,ro){for(const no of Xr){const[io,oo]=no.validate(to,{coerce:!0,mask:ro.mask});if(!io)return oo}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run$1(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print$1(to)}`,...no]}})}function unknown$1(){return define$1("unknown",()=>!0)}function coerce$1(Xr,eo,to){return new Struct$3({...Xr,coercer:(ro,no)=>is$2(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}function isOnCurve$1(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const toBuffer$1=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);let Struct$2=class{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$1,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA$1,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA$1,this,eo)}};const SOLANA_SCHEMA$1=new Map;var _PublicKey$1;const MAX_SEED_LENGTH$1=32,PUBLIC_KEY_LENGTH$1=32;function isPublicKeyData$1(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter$1=1,PublicKey$1=class Z0 extends Struct$2{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData$1(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input");this._bn=new BN$1(to)}else this._bn=new BN$1(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input")}}static unique(){const eo=new Z0(uniquePublicKeyCounter$1);return uniquePublicKeyCounter$1+=1,new Z0(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH$1)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new Z0(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH$1)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer$1(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve$1(no))throw new Error("Invalid seeds, address must fall off the curve");return new Z0(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new Z0(eo);return isOnCurve$1(to.toBytes())}};_PublicKey$1=PublicKey$1;PublicKey$1.default=new _PublicKey$1("11111111111111111111111111111111");SOLANA_SCHEMA$1.set(PublicKey$1,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$1("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES$1=64,publicKey$2=(Xr="publicKey")=>blob(32,Xr),rustString$1=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized$1=(Xr="authorized")=>struct([publicKey$2("staker"),publicKey$2("withdrawer")],Xr),lockup$1=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$2("custodian")],Xr),voteInit$1=(Xr="voteInit")=>struct([publicKey$2("nodePubkey"),publicKey$2("authorizedVoter"),publicKey$2("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs$1=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey$2("currentAuthorityDerivedKeyOwnerPubkey"),rustString$1("currentAuthorityDerivedKeySeed"),publicKey$2("newAuthorized")],Xr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$1).fill(0);new PublicKey$1("SysvarC1ock11111111111111111111111111111111");new PublicKey$1("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$1("Sysvar1nstructions1111111111111111111111111");new PublicKey$1("SysvarRecentB1ockHashes11111111111111111111");new PublicKey$1("SysvarRent111111111111111111111111111111111");new PublicKey$1("SysvarRewards111111111111111111111111111111");new PublicKey$1("SysvarS1otHashes111111111111111111111111111");new PublicKey$1("SysvarS1otHistory11111111111111111111111111");new PublicKey$1("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout$1=nu64("lamportsPerSignature"),NonceAccountLayout$1=struct([u32$1("version"),u32$1("state"),publicKey$2("authorizedPubkey"),publicKey$2("nonce"),struct([FeeCalculatorLayout$1],"feeCalculator")]);NonceAccountLayout$1.span;const encodeDecode$2=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$2=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$2(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$2=bigInt$2(8);Object.freeze({Create:{index:0,layout:struct([u32$1("instruction"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},Assign:{index:1,layout:struct([u32$1("instruction"),publicKey$2("programId")])},Transfer:{index:2,layout:struct([u32$1("instruction"),u64$2("lamports")])},CreateWithSeed:{index:3,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32$1("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32$1("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32$1("instruction"),publicKey$2("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32$1("instruction"),publicKey$2("authorized")])},Allocate:{index:8,layout:struct([u32$1("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("space"),publicKey$2("programId")])},AssignWithSeed:{index:10,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),publicKey$2("programId")])},TransferWithSeed:{index:11,layout:struct([u32$1("instruction"),u64$2("lamports"),rustString$1("seed"),publicKey$2("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32$1("instruction")])}});new PublicKey$1("11111111111111111111111111111111");new PublicKey$1("BPFLoader2111111111111111111111111111111111");struct([u32$1("typeIndex"),u64$2("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$2(),offset(u8(),-1),"authority")]);const PublicKeyFromString$1=coerce$1(instance$1(PublicKey$1),string$1(),Xr=>new PublicKey$1(Xr)),RawAccountDataResult$1=tuple$2([string$1(),literal$1("base64")]),BufferFromRawAccountData$1=coerce$1(instance$1(Buffer$1$1),RawAccountDataResult$1,Xr=>Buffer$1$1.from(Xr[0],"base64"));function createRpcResult$1(Xr){return union$1([type$1({jsonrpc:literal$1("2.0"),id:string$1(),result:Xr}),type$1({jsonrpc:literal$1("2.0"),id:string$1(),error:type$1({code:unknown$1(),message:string$1(),data:optional$1(any$1())})})])}const UnknownRpcResult$1=createRpcResult$1(unknown$1());function jsonRpcResult$1(Xr){return coerce$1(createRpcResult$1(Xr),UnknownRpcResult$1,eo=>"error"in eo?eo:{...eo,result:create$1(eo.result,Xr)})}function jsonRpcResultAndContext$1(Xr){return jsonRpcResult$1(type$1({context:type$1({slot:number$2()}),value:Xr}))}function notificationResultAndContext$1(Xr){return type$1({context:type$1({slot:number$2()}),value:Xr})}const GetInflationGovernorResult$1=type$1({foundation:number$2(),foundationTerm:number$2(),initial:number$2(),taper:number$2(),terminal:number$2()});jsonRpcResult$1(array$1(nullable$1(type$1({epoch:number$2(),effectiveSlot:number$2(),amount:number$2(),postBalance:number$2(),commission:optional$1(nullable$1(number$2()))}))));const GetRecentPrioritizationFeesResult$1=array$1(type$1({slot:number$2(),prioritizationFee:number$2()})),GetInflationRateResult$1=type$1({total:number$2(),validator:number$2(),foundation:number$2(),epoch:number$2()}),GetEpochInfoResult$1=type$1({epoch:number$2(),slotIndex:number$2(),slotsInEpoch:number$2(),absoluteSlot:number$2(),blockHeight:optional$1(number$2()),transactionCount:optional$1(number$2())}),GetEpochScheduleResult$1=type$1({slotsPerEpoch:number$2(),leaderScheduleSlotOffset:number$2(),warmup:boolean$1(),firstNormalEpoch:number$2(),firstNormalSlot:number$2()}),GetLeaderScheduleResult$1=record$1(string$1(),array$1(number$2())),TransactionErrorResult$1=nullable$1(union$1([type$1({}),string$1()])),SignatureStatusResult$1=type$1({err:TransactionErrorResult$1}),SignatureReceivedResult$1=literal$1("receivedSignature");type$1({"solana-core":string$1(),"feature-set":optional$1(number$2())});const ParsedInstructionStruct$1=type$1({program:string$1(),programId:PublicKeyFromString$1,parsed:unknown$1()}),PartiallyDecodedInstructionStruct$1=type$1({programId:PublicKeyFromString$1,accounts:array$1(PublicKeyFromString$1),data:string$1()});jsonRpcResultAndContext$1(type$1({err:nullable$1(union$1([type$1({}),string$1()])),logs:nullable$1(array$1(string$1())),accounts:optional$1(nullable$1(array$1(nullable$1(type$1({executable:boolean$1(),owner:string$1(),lamports:number$2(),data:array$1(string$1()),rentEpoch:optional$1(number$2())}))))),unitsConsumed:optional$1(number$2()),returnData:optional$1(nullable$1(type$1({programId:string$1(),data:tuple$2([string$1(),literal$1("base64")])}))),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(union$1([ParsedInstructionStruct$1,PartiallyDecodedInstructionStruct$1]))}))))}));jsonRpcResultAndContext$1(type$1({byIdentity:record$1(string$1(),array$1(number$2())),range:type$1({firstSlot:number$2(),lastSlot:number$2()})}));jsonRpcResult$1(GetInflationGovernorResult$1);jsonRpcResult$1(GetInflationRateResult$1);jsonRpcResult$1(GetRecentPrioritizationFeesResult$1);jsonRpcResult$1(GetEpochInfoResult$1);jsonRpcResult$1(GetEpochScheduleResult$1);jsonRpcResult$1(GetLeaderScheduleResult$1);jsonRpcResult$1(number$2());jsonRpcResultAndContext$1(type$1({total:number$2(),circulating:number$2(),nonCirculating:number$2(),nonCirculatingAccounts:array$1(PublicKeyFromString$1)}));const TokenAmountResult$1=type$1({amount:string$1(),uiAmount:nullable$1(number$2()),decimals:number$2(),uiAmountString:optional$1(string$1())});jsonRpcResultAndContext$1(array$1(type$1({address:PublicKeyFromString$1,amount:string$1(),uiAmount:nullable$1(number$2()),decimals:number$2(),uiAmountString:optional$1(string$1())})));jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:BufferFromRawAccountData$1,rentEpoch:number$2()})})));const ParsedAccountDataResult$1=type$1({program:string$1(),parsed:unknown$1(),space:number$2()});jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:ParsedAccountDataResult$1,rentEpoch:number$2()})})));jsonRpcResultAndContext$1(array$1(type$1({lamports:number$2(),address:PublicKeyFromString$1})));const AccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:BufferFromRawAccountData$1,rentEpoch:number$2()});type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});const ParsedOrRawAccountData$1=coerce$1(union$1([instance$1(Buffer$1$1),ParsedAccountDataResult$1]),union$1([RawAccountDataResult$1,ParsedAccountDataResult$1]),Xr=>Array.isArray(Xr)?create$1(Xr,BufferFromRawAccountData$1):Xr),ParsedAccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:ParsedOrRawAccountData$1,rentEpoch:number$2()});type$1({pubkey:PublicKeyFromString$1,account:ParsedAccountInfoResult$1});type$1({state:union$1([literal$1("active"),literal$1("inactive"),literal$1("activating"),literal$1("deactivating")]),active:number$2(),inactive:number$2()});jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$2(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$2()))})));jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$2(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$2()))})));type$1({subscription:number$2(),result:notificationResultAndContext$1(AccountInfoResult$1)});const ProgramAccountInfoResult$1=type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});type$1({subscription:number$2(),result:notificationResultAndContext$1(ProgramAccountInfoResult$1)});const SlotInfoResult$1=type$1({parent:number$2(),slot:number$2(),root:number$2()});type$1({subscription:number$2(),result:SlotInfoResult$1});const SlotUpdateResult$1=union$1([type$1({type:union$1([literal$1("firstShredReceived"),literal$1("completed"),literal$1("optimisticConfirmation"),literal$1("root")]),slot:number$2(),timestamp:number$2()}),type$1({type:literal$1("createdBank"),parent:number$2(),slot:number$2(),timestamp:number$2()}),type$1({type:literal$1("frozen"),slot:number$2(),timestamp:number$2(),stats:type$1({numTransactionEntries:number$2(),numSuccessfulTransactions:number$2(),numFailedTransactions:number$2(),maxTransactionsPerEntry:number$2()})}),type$1({type:literal$1("dead"),slot:number$2(),timestamp:number$2(),err:string$1()})]);type$1({subscription:number$2(),result:SlotUpdateResult$1});type$1({subscription:number$2(),result:notificationResultAndContext$1(union$1([SignatureStatusResult$1,SignatureReceivedResult$1]))});type$1({subscription:number$2(),result:number$2()});type$1({pubkey:string$1(),gossip:nullable$1(string$1()),tpu:nullable$1(string$1()),rpc:nullable$1(string$1()),version:nullable$1(string$1())});const VoteAccountInfoResult$1=type$1({votePubkey:string$1(),nodePubkey:string$1(),activatedStake:number$2(),epochVoteAccount:boolean$1(),epochCredits:array$1(tuple$2([number$2(),number$2(),number$2()])),commission:number$2(),lastVote:number$2(),rootSlot:nullable$1(number$2())});jsonRpcResult$1(type$1({current:array$1(VoteAccountInfoResult$1),delinquent:array$1(VoteAccountInfoResult$1)}));const ConfirmationStatus$1=union$1([literal$1("processed"),literal$1("confirmed"),literal$1("finalized")]),SignatureStatusResponse$1=type$1({slot:number$2(),confirmations:nullable$1(number$2()),err:TransactionErrorResult$1,confirmationStatus:optional$1(ConfirmationStatus$1)});jsonRpcResultAndContext$1(array$1(nullable$1(SignatureStatusResponse$1)));jsonRpcResult$1(number$2());const AddressTableLookupStruct$1=type$1({accountKey:PublicKeyFromString$1,writableIndexes:array$1(number$2()),readonlyIndexes:array$1(number$2())}),ConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(string$1()),header:type$1({numRequiredSignatures:number$2(),numReadonlySignedAccounts:number$2(),numReadonlyUnsignedAccounts:number$2()}),instructions:array$1(type$1({accounts:array$1(number$2()),data:string$1(),programIdIndex:number$2()})),recentBlockhash:string$1(),addressTableLookups:optional$1(array$1(AddressTableLookupStruct$1))})}),AnnotatedAccountKey$1=type$1({pubkey:PublicKeyFromString$1,signer:boolean$1(),writable:boolean$1(),source:optional$1(union$1([literal$1("transaction"),literal$1("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$1=type$1({accountKeys:array$1(AnnotatedAccountKey$1),signatures:array$1(string$1())}),ParsedInstructionResult$1=type$1({parsed:unknown$1(),program:string$1(),programId:PublicKeyFromString$1}),RawInstructionResult$1=type$1({accounts:array$1(PublicKeyFromString$1),data:string$1(),programId:PublicKeyFromString$1}),InstructionResult$1=union$1([RawInstructionResult$1,ParsedInstructionResult$1]),UnknownInstructionResult$1=union$1([type$1({parsed:unknown$1(),program:string$1(),programId:string$1()}),type$1({accounts:array$1(string$1()),data:string$1(),programId:string$1()})]),ParsedOrRawInstruction$1=coerce$1(InstructionResult$1,UnknownInstructionResult$1,Xr=>"accounts"in Xr?create$1(Xr,RawInstructionResult$1):create$1(Xr,ParsedInstructionResult$1)),ParsedConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(AnnotatedAccountKey$1),instructions:array$1(ParsedOrRawInstruction$1),recentBlockhash:string$1(),addressTableLookups:optional$1(nullable$1(array$1(AddressTableLookupStruct$1)))})}),TokenBalanceResult$1=type$1({accountIndex:number$2(),mint:string$1(),owner:optional$1(string$1()),uiTokenAmount:TokenAmountResult$1}),LoadedAddressesResult$1=type$1({writable:array$1(PublicKeyFromString$1),readonly:array$1(PublicKeyFromString$1)}),ConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$2(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(type$1({accounts:array$1(number$2()),data:string$1(),programIdIndex:number$2()}))})))),preBalances:array$1(number$2()),postBalances:array$1(number$2()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$2())}),ParsedConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$2(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(ParsedOrRawInstruction$1)})))),preBalances:array$1(number$2()),postBalances:array$1(number$2()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$2())}),TransactionVersionStruct$1=union$1([literal$1(0),literal$1("legacy")]),RewardsResult$1=type$1({pubkey:string$1(),lamports:number$2(),postBalance:nullable$1(number$2()),rewardType:nullable$1(string$1()),commission:optional$1(nullable$1(number$2()))});jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),signatures:array$1(string$1()),blockTime:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({slot:number$2(),meta:nullable$1(ConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$2())),transaction:ConfirmedTransactionResult$1,version:optional$1(TransactionVersionStruct$1)})));jsonRpcResult$1(nullable$1(type$1({slot:number$2(),transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$2())),version:optional$1(TransactionVersionStruct$1)})));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),feeCalculator:type$1({lamportsPerSignature:number$2()})}));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),lastValidBlockHeight:number$2()}));jsonRpcResultAndContext$1(boolean$1());const PerfSampleResult$1=type$1({slot:number$2(),numTransactions:number$2(),numSlots:number$2(),samplePeriodSecs:number$2()});jsonRpcResult$1(array$1(PerfSampleResult$1));jsonRpcResultAndContext$1(nullable$1(type$1({feeCalculator:type$1({lamportsPerSignature:number$2()})})));jsonRpcResult$1(string$1());jsonRpcResult$1(string$1());const LogsResult$1=type$1({err:TransactionErrorResult$1,logs:array$1(string$1()),signature:string$1()});type$1({result:notificationResultAndContext$1(LogsResult$1),subscription:number$2()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64$2("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64$2(),seq(publicKey$2(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey$1("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$2("microLamports")])}});new PublicKey$1("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$1("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$1("KeccakSecp256k11111111111111111111111111111");var _Lockup$1;new PublicKey$1("StakeConfig11111111111111111111111111111111");let Lockup$1=class{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}};_Lockup$1=Lockup$1;Lockup$1.default=new _Lockup$1(0,0,PublicKey$1.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized$1(),lockup$1()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("stakeAuthorizationType"),rustString$1("authoritySeed"),publicKey$2("authorityOwner")])}});new PublicKey$1("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit$1()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs$1()])}});new PublicKey$1("Vote111111111111111111111111111111111111111");new PublicKey$1("Va1idator1nfo111111111111111111111111111111");type$1({name:string$1(),website:optional$1(string$1()),details:optional$1(string$1()),iconUrl:optional$1(string$1()),keybaseUsername:optional$1(string$1())});new PublicKey$1("Vote111111111111111111111111111111111111111");struct([publicKey$2("nodePubkey"),publicKey$2("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$2("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey$2("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);class TurnkeySigner{constructor(eo){this.organizationId=eo.organizationId,this.client=eo.client}async signAllTransactions(eo,to){var ao,so,co;const ro=new PublicKey$1(to);let no=eo.map(lo=>this.getMessageToSign(lo).toString("hex"));const oo=(so=(ao=(await this.signRawPayloads(no,to)).signRawPayloadsResult)==null?void 0:ao.signatures)==null?void 0:so.map(lo=>`${lo==null?void 0:lo.r}${lo==null?void 0:lo.s}`);for(let lo in eo)(co=eo[lo])==null||co.addSignature(ro,Buffer$3.from(oo[lo],"hex"));return eo}async addSignature(eo,to){var ao,so;const ro=new PublicKey$1(to);let no=this.getMessageToSign(eo);const io=await this.signRawPayload(no.toString("hex"),to),oo=`${(ao=io.signRawPayloadResult)==null?void 0:ao.r}${(so=io.signRawPayloadResult)==null?void 0:so.s}`;eo.addSignature(ro,Buffer$3.from(oo,"hex"))}async signMessage(eo,to){var no,io;const ro=await this.signRawPayload(Buffer$3.from(eo).toString("hex"),to);return Buffer$3.from(`${(no=ro.signRawPayloadResult)==null?void 0:no.r}${(io=ro.signRawPayloadResult)==null?void 0:io.s}`,"hex")}async signRawPayload(eo,to){const ro=await this.client.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:to,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:no,status:io,type:oo,result:ao}=ro.activity;if(io!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${io}`,activityId:no,activityStatus:io,activityType:oo});return ao}async signRawPayloads(eo,to){const ro=await this.client.signRawPayloads({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:to,payloads:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:no,status:io,type:oo,result:ao}=ro.activity;if(io!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${io}`,activityId:no,activityStatus:io,activityType:oo});return ao}getMessageToSign(eo){let to;return typeof eo.serializeMessage=="function"?to=eo.serializeMessage():to=Buffer$3.from(eo.message.serialize()),to}}var version$7="3.4.4";function __rest(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{var Xr,eo,to;return typeof process$1$1<"u"&&define_process_env_default$2&&(to=(eo=(Xr=define_process_env_default$2.ICONIC_SPRITE_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$2.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$2.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&to!==void 0?to:DEFAULT_ICONIC_SPRITE_URL},ICONIC_SPRITE_URL=getIconicSpriteUrl(),createIconic=Xr=>{const eo=Object.assign(Object.assign({},Xr),{function:ro=>{const no=`${ICONIC_SPRITE_URL}#${eo.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${eo.iconName}`},ro),{alt:eo.alt,src:no}))}}),to=eo.function.bind(eo);return Object.assign(to,{iconName:eo.iconName,sourcePath:eo.sourcePath}),to};createIconic({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"});createIconic({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"});createIconic({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"});createIconic({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"});createIconic({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"});createIconic({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"});createIconic({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});createIconic({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});createIconic({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});createIconic({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});createIconic({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});createIconic({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"});createIconic({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});createIconic({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});createIconic({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"});createIconic({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"});createIconic({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"});createIconic({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"});createIconic({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"});createIconic({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"});createIconic({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"});createIconic({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"});createIconic({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"});createIconic({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"});createIconic({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"});createIconic({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"});createIconic({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"});createIconic({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"});createIconic({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"});createIconic({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"});createIconic({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"});createIconic({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"});createIconic({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"});createIconic({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"});createIconic({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"});createIconic({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"});createIconic({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"});createIconic({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"});createIconic({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"});createIconic({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"});createIconic({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"});createIconic({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"});createIconic({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"});createIconic({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"});createIconic({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"});createIconic({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"});createIconic({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"});createIconic({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"});createIconic({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});typeof SuppressedError=="function"&&SuppressedError;new Logger$2("iconic");assertPackageVersion("@dynamic-labs/iconic",version$5);`${getIconicSpriteUrl()}`;new Logger$2("WalletBook");typeof SuppressedError=="function"&&SuppressedError;const walletConnectSourceValueSchema=z$a.object({app:z$a.object({android:z$a.string().nullable(),browser:z$a.string().nullable(),chrome:z$a.string().nullable(),edge:z$a.string().nullable(),firefox:z$a.string().nullable(),ios:z$a.string().nullable(),linux:z$a.string().nullable(),mac:z$a.string().nullable(),opera:z$a.string().nullable(),safari:z$a.string().nullable(),windows:z$a.string().nullable()}),app_type:z$a.string(),category:z$a.string().nullable(),chains:z$a.array(z$a.string()),description:z$a.string().nullable(),desktop:z$a.object({native:z$a.string().nullable(),universal:z$a.string().nullable()}),homepage:z$a.string(),id:z$a.string(),image_id:z$a.string(),image_url:z$a.object({lg:z$a.string(),md:z$a.string(),sm:z$a.string()}),injected:z$a.array(z$a.object({injected_id:z$a.string(),namespace:z$a.string()})).nullable(),metadata:z$a.object({colors:z$a.object({primary:z$a.string().nullable(),secondary:z$a.string().nullable()}),shortName:z$a.string().nullable()}),mobile:z$a.object({native:z$a.string().nullable(),universal:z$a.string().nullable()}),name:z$a.string(),rdns:z$a.string().nullable(),sdks:z$a.array(z$a.string()),slug:z$a.string(),supported_standards:z$a.array(z$a.object({id:z$a.string(),standard_id:z$a.number(),standard_prefix:z$a.string(),title:z$a.string(),url:z$a.string()})).optional(),updatedAt:z$a.string(),versions:z$a.array(z$a.string())}).strict();z$a.record(z$a.string(),walletConnectSourceValueSchema);const nonEmptyString=z$a.preprocess(Xr=>Xr||void 0,z$a.string().optional()),transformChromeExtensionId=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("chrome.google.com/webstore/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr!=null&&Xr.includes("addons.mozilla.org"))try{return new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex=/^id[0-9]{1,36}$/,transformIosId=Xr=>{if(Xr!=null&&Xr.match(idRegex))return Xr;if(Xr!=null&&Xr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const to=new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1);if(to!=null&&to.match(idRegex))return to}catch{}},transformAndroidId=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr)try{const to=new URL(Xr).searchParams.get("id");if(to)return to}catch{}},nonEmptyStringArray=z$a.preprocess(Xr=>Array.isArray(Xr)&&Xr.length>0?Xr:void 0,z$a.array(z$a.string()).optional()),filterEmptyObject=Xr=>Xr&&Object.values(Xr).some(eo=>!!eo)?Xr:void 0,injectedConfigSchema=z$a.object({chain:z$a.string(),extensionLocators:z$a.array(z$a.object({flag:z$a.string(),value:z$a.boolean().optional().default(!0)})),providerInterface:z$a.string().optional(),walletStandard:z$a.object({features:z$a.array(z$a.string()),name:z$a.string(),providerId:z$a.string().optional()}).optional(),walletStandardLocators:z$a.array(z$a.object({locator:z$a.string(),name:z$a.string()})).optional(),windowLocations:z$a.array(z$a.string()).optional().refine(Xr=>!Xr||!Xr.some(eo=>["ethereum","ethereum.providers"].includes(eo)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema=z$a.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}),walletSchema=z$a.preprocess(Xr=>Xr,z$a.object({brand:brandSchema.optional(),chainGroup:z$a.string().optional(),chains:z$a.array(z$a.string()).optional(),desktop:z$a.object({chromeId:nonEmptyString.transform(transformChromeExtensionId),edgeId:nonEmptyString.transform(transformEdgeExtensionId),firefoxId:nonEmptyString.transform(transformFirefoxExtensionId),native:nonEmptyString,operaId:nonEmptyString,safariId:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),eip6963Config:z$a.object({rdns:z$a.string()}).optional(),filterFromWalletConnect:z$a.boolean().optional(),group:z$a.string().optional(),hardwareWallets:z$a.array(z$a.string()).optional(),injectedConfig:z$a.array(injectedConfigSchema).optional(),mobile:z$a.object({android:stringType().nullish(),androidId:nonEmptyString.transform(transformAndroidId),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString.transform(transformIosId),native:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),mobileExperience:z$a.enum(["in-app-browser","redirect"]).optional(),name:z$a.string(),shortName:nonEmptyString,showOnlyIfInstalled:z$a.boolean().optional(),switchNetworkOnlyFromWallet:z$a.boolean().optional(),walletConnect:z$a.object({sdks:nonEmptyStringArray}).optional().transform(filterEmptyObject),walletGroup:z$a.string().optional(),walletLimitations:z$a.object({browserExtension:z$a.object({unsupportedEvents:z$a.array(z$a.string()).optional(),unsupportedMethods:z$a.array(z$a.string()).optional()}).optional(),mobile:z$a.object({unsupportedEvents:z$a.array(z$a.string()).optional(),unsupportedMethods:z$a.array(z$a.string()).optional()}).optional()}).optional()})).transform(Xr=>{var eo,to,ro,no,io,oo;return Xr.group&&(Xr.chainGroup=Xr.group),(!((eo=Xr.mobile)===null||eo===void 0)&&eo.iosId||((to=Xr.mobile)===null||to===void 0?void 0:to.ios)===null)&&((ro=Xr.mobile)===null||ro===void 0||delete ro.ios),(!((no=Xr.mobile)===null||no===void 0)&&no.androidId||((io=Xr.mobile)===null||io===void 0?void 0:io.android)===null)&&((oo=Xr.mobile)===null||oo===void 0||delete oo.android),Xr}),WalletOverrideEntrySchema=z$a.object({brand:brandSchema.optional(),name:nonEmptyString}),walletGroupSchema=z$a.object({brand:z$a.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}).optional(),key:z$a.string(),name:z$a.string(),walletOverrides:z$a.record(WalletOverrideEntrySchema).optional()});z$a.record(z$a.string(),walletSchema);z$a.preprocess(Xr=>Xr,z$a.object({groups:z$a.record(z$a.string(),walletGroupSchema),wallets:z$a.record(z$a.string(),walletSchema)}));z$a.record(z$a.string(),walletGroupSchema);assertPackageVersion("@dynamic-labs/wallet-book",version$6);const logger$3=new Logger$2("WalletConnector"),shouldLowercaseAddress=Xr=>["eip155","flow","evm","eth","avax","matic"].includes(Xr.toLowerCase()),normalizeAddress=(Xr,eo)=>(Xr.startsWith("0x")&&(Xr=Xr.slice(2)),shouldLowercaseAddress(eo)?Xr.toLowerCase():Xr),isSameAddress=(Xr,eo,to)=>normalizeAddress(Xr,to)===normalizeAddress(eo,to);class Wallet extends BaseWallet{constructor(eo){var{connector:to}=eo,ro=__rest(eo,["connector"]);super(ro),this._connector=to}get connector(){return this._connector}getBalance(){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter$4(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(to=>normalizeAddress(to,this.chain)).includes(normalizeAddress(this.address,this.chain))}catch(eo){return logger$3.error("[Wallet] isConnected - Error detecting if wallet is connected",eo),!1}})}proveOwnership(eo){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,eo)})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(eo,this.address)})}switchNetwork(eo){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:eo})})}sync(){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}}new EventEmitter$3;assertPackageVersion("@dynamic-labs/wallet-connector-core",version$7);var version$4="3.4.4";function __awaiter$3(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let SolanaWallet$1=class extends Wallet{getConnection(){return __awaiter$3(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){const eo=yield this._connector.getSigner();if(!eo)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(eo,{signAllTransactions:to=>__awaiter$3(this,void 0,void 0,function*(){return yield this.sync(),eo.signAllTransactions(to)}),signAndSendTransaction:(to,...ro)=>__awaiter$3(this,void 0,void 0,function*(){return yield this.sync(),eo.signAndSendTransaction(to,...ro)}),signMessage:(to,...ro)=>__awaiter$3(this,void 0,void 0,function*(){return yield this.sync(),eo.signMessage(to,...ro)}),signTransaction:to=>__awaiter$3(this,void 0,void 0,function*(){return yield this.sync(),eo.signTransaction(to)})})}catch(to){return logger$3.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}};const SOLANA_GENESIS_HASH$1="genesis-hash",getGenesisHashLSKey$1=Xr=>`${Xr}_${SOLANA_GENESIS_HASH$1}`;new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");ChainRpcProviders.getSolanaProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.solana)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerSolanaProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,Xr=>{const eo={};return Xr!=null&&Xr.solana&&(eo.solana=Xr.solana.map(to=>{var ro;const no=((ro=to.privateCustomerRpcUrls)===null||ro===void 0?void 0:ro[0])||to.rpcUrls[0],io=new Connection(no);return{chainId:to.chainId.toString(),chainName:to.name,provider:io}})),eo.solana})};const TOKEN_PROGRAM_ID=new PublicKey$2("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new PublicKey$2("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const ASSOCIATED_TOKEN_PROGRAM_ID=new PublicKey$2("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new PublicKey$2("So11111111111111111111111111111111111111112");new PublicKey$2("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const encodeDecode$1=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$1=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$1(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$3.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$1=bigInt$1(8),bool=Xr=>{const eo=u8(Xr),{encode:to,decode:ro}=encodeDecode$1(eo),no=eo;return no.decode=(io,oo)=>!!ro(io,oo),no.encode=(io,oo,ao)=>{const so=Number(io);return to(so,oo,ao)},no};var bn$1={exports:{}};bn$1.exports;(function(Xr){(function(eo,to){function ro(xo,uo){if(!xo)throw new Error(uo||"Assertion failed")}function no(xo,uo){xo.super_=uo;var po=function(){};po.prototype=uo.prototype,xo.prototype=new po,xo.prototype.constructor=xo}function io(xo,uo,po){if(io.isBN(xo))return xo;this.negative=0,this.words=null,this.length=0,this.red=null,xo!==null&&((uo==="le"||uo==="be")&&(po=uo,uo=10),this._init(xo||0,uo||10,po||"be"))}typeof eo=="object"?eo.exports=io:to.BN=io,io.BN=io,io.wordSize=26;var oo;try{typeof window<"u"&&typeof window.Buffer<"u"?oo=window.Buffer:oo=require$$0$9.Buffer}catch{}io.isBN=function(uo){return uo instanceof io?!0:uo!==null&&typeof uo=="object"&&uo.constructor.wordSize===io.wordSize&&Array.isArray(uo.words)},io.max=function(uo,po){return uo.cmp(po)>0?uo:po},io.min=function(uo,po){return uo.cmp(po)<0?uo:po},io.prototype._init=function(uo,po,bo){if(typeof uo=="number")return this._initNumber(uo,po,bo);if(typeof uo=="object")return this._initArray(uo,po,bo);po==="hex"&&(po=16),ro(po===(po|0)&&po>=2&&po<=36),uo=uo.toString().replace(/\s+/g,"");var _o=0;uo[0]==="-"&&(_o++,this.negative=1),_o=0;_o-=3)Co=uo[_o]|uo[_o-1]<<8|uo[_o-2]<<16,this.words[$o]|=Co<>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);else if(bo==="le")for(_o=0,$o=0;_o>>26-Ro&67108863,Ro+=24,Ro>=26&&(Ro-=26,$o++);return this._strip()};function ao(xo,uo){var po=xo.charCodeAt(uo);if(po>=48&&po<=57)return po-48;if(po>=65&&po<=70)return po-55;if(po>=97&&po<=102)return po-87;ro(!1,"Invalid character in "+xo)}function so(xo,uo,po){var bo=ao(xo,po);return po-1>=uo&&(bo|=ao(xo,po-1)<<4),bo}io.prototype._parseHex=function(uo,po,bo){this.length=Math.ceil((uo.length-po)/6),this.words=new Array(this.length);for(var _o=0;_o=po;_o-=2)Ro=so(uo,po,_o)<<$o,this.words[Co]|=Ro&67108863,$o>=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8;else{var So=uo.length-po;for(_o=So%2===0?po+1:po;_o=18?($o-=18,Co+=1,this.words[Co]|=Ro>>>26):$o+=8}this._strip()};function co(xo,uo,po,bo){for(var _o=0,$o=0,Co=Math.min(xo.length,po),Ro=uo;Ro=49?$o=So-49+10:So>=17?$o=So-17+10:$o=So,ro(So>=0&&$o1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},io.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{io.prototype[Symbol.for("nodejs.util.inspect.custom")]=fo}catch{io.prototype.inspect=fo}else io.prototype.inspect=fo;function fo(){return(this.red?""}var ho=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],go=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],yo=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];io.prototype.toString=function(uo,po){uo=uo||10,po=po|0||1;var bo;if(uo===16||uo==="hex"){bo="";for(var _o=0,$o=0,Co=0;Co>>24-_o&16777215,_o+=2,_o>=26&&(_o-=26,Co--),$o!==0||Co!==this.length-1?bo=ho[6-So.length]+So+bo:bo=So+bo}for($o!==0&&(bo=$o.toString(16)+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}if(uo===(uo|0)&&uo>=2&&uo<=36){var mo=go[uo],To=yo[uo];bo="";var Vo=this.clone();for(Vo.negative=0;!Vo.isZero();){var Zo=Vo.modrn(To).toString(uo);Vo=Vo.idivn(To),Vo.isZero()?bo=Zo+bo:bo=ho[mo-Zo.length]+Zo+bo}for(this.isZero()&&(bo="0"+bo);bo.length%po!==0;)bo="0"+bo;return this.negative!==0&&(bo="-"+bo),bo}ro(!1,"Base should be between 2 and 36")},io.prototype.toNumber=function(){var uo=this.words[0];return this.length===2?uo+=this.words[1]*67108864:this.length===3&&this.words[2]===1?uo+=4503599627370496+this.words[1]*67108864:this.length>2&&ro(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-uo:uo},io.prototype.toJSON=function(){return this.toString(16,2)},oo&&(io.prototype.toBuffer=function(uo,po){return this.toArrayLike(oo,uo,po)}),io.prototype.toArray=function(uo,po){return this.toArrayLike(Array,uo,po)};var vo=function(uo,po){return uo.allocUnsafe?uo.allocUnsafe(po):new uo(po)};io.prototype.toArrayLike=function(uo,po,bo){this._strip();var _o=this.byteLength(),$o=bo||Math.max(1,_o);ro(_o<=$o,"byte array longer than desired length"),ro($o>0,"Requested array length <= 0");var Co=vo(uo,$o),Ro=po==="le"?"LE":"BE";return this["_toArrayLike"+Ro](Co,_o),Co},io.prototype._toArrayLikeLE=function(uo,po){for(var bo=0,_o=0,$o=0,Co=0;$o>8&255),bo>16&255),Co===6?(bo>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo=0&&(uo[bo--]=Ro>>8&255),bo>=0&&(uo[bo--]=Ro>>16&255),Co===6?(bo>=0&&(uo[bo--]=Ro>>24&255),_o=0,Co=0):(_o=Ro>>>24,Co+=2)}if(bo>=0)for(uo[bo--]=_o;bo>=0;)uo[bo--]=0},Math.clz32?io.prototype._countBits=function(uo){return 32-Math.clz32(uo)}:io.prototype._countBits=function(uo){var po=uo,bo=0;return po>=4096&&(bo+=13,po>>>=13),po>=64&&(bo+=7,po>>>=7),po>=8&&(bo+=4,po>>>=4),po>=2&&(bo+=2,po>>>=2),bo+po},io.prototype._zeroBits=function(uo){if(uo===0)return 26;var po=uo,bo=0;return po&8191||(bo+=13,po>>>=13),po&127||(bo+=7,po>>>=7),po&15||(bo+=4,po>>>=4),po&3||(bo+=2,po>>>=2),po&1||bo++,bo},io.prototype.bitLength=function(){var uo=this.words[this.length-1],po=this._countBits(uo);return(this.length-1)*26+po};function wo(xo){for(var uo=new Array(xo.bitLength()),po=0;po>>_o&1}return uo}io.prototype.zeroBits=function(){if(this.isZero())return 0;for(var uo=0,po=0;pouo.length?this.clone().ior(uo):uo.clone().ior(this)},io.prototype.uor=function(uo){return this.length>uo.length?this.clone().iuor(uo):uo.clone().iuor(this)},io.prototype.iuand=function(uo){var po;this.length>uo.length?po=uo:po=this;for(var bo=0;bouo.length?this.clone().iand(uo):uo.clone().iand(this)},io.prototype.uand=function(uo){return this.length>uo.length?this.clone().iuand(uo):uo.clone().iuand(this)},io.prototype.iuxor=function(uo){var po,bo;this.length>uo.length?(po=this,bo=uo):(po=uo,bo=this);for(var _o=0;_ouo.length?this.clone().ixor(uo):uo.clone().ixor(this)},io.prototype.uxor=function(uo){return this.length>uo.length?this.clone().iuxor(uo):uo.clone().iuxor(this)},io.prototype.inotn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=Math.ceil(uo/26)|0,bo=uo%26;this._expand(po),bo>0&&po--;for(var _o=0;_o0&&(this.words[_o]=~this.words[_o]&67108863>>26-bo),this._strip()},io.prototype.notn=function(uo){return this.clone().inotn(uo)},io.prototype.setn=function(uo,po){ro(typeof uo=="number"&&uo>=0);var bo=uo/26|0,_o=uo%26;return this._expand(bo+1),po?this.words[bo]=this.words[bo]|1<<_o:this.words[bo]=this.words[bo]&~(1<<_o),this._strip()},io.prototype.iadd=function(uo){var po;if(this.negative!==0&&uo.negative===0)return this.negative=0,po=this.isub(uo),this.negative^=1,this._normSign();if(this.negative===0&&uo.negative!==0)return uo.negative=0,po=this.isub(uo),uo.negative=1,po._normSign();var bo,_o;this.length>uo.length?(bo=this,_o=uo):(bo=uo,_o=this);for(var $o=0,Co=0;Co<_o.length;Co++)po=(bo.words[Co]|0)+(_o.words[Co]|0)+$o,this.words[Co]=po&67108863,$o=po>>>26;for(;$o!==0&&Co>>26;if(this.length=bo.length,$o!==0)this.words[this.length]=$o,this.length++;else if(bo!==this)for(;Couo.length?this.clone().iadd(uo):uo.clone().iadd(this)},io.prototype.isub=function(uo){if(uo.negative!==0){uo.negative=0;var po=this.iadd(uo);return uo.negative=1,po._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(uo),this.negative=1,this._normSign();var bo=this.cmp(uo);if(bo===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _o,$o;bo>0?(_o=this,$o=uo):(_o=uo,$o=this);for(var Co=0,Ro=0;Ro<$o.length;Ro++)po=(_o.words[Ro]|0)-($o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;for(;Co!==0&&Ro<_o.length;Ro++)po=(_o.words[Ro]|0)+Co,Co=po>>26,this.words[Ro]=po&67108863;if(Co===0&&Ro<_o.length&&_o!==this)for(;Ro<_o.length;Ro++)this.words[Ro]=_o.words[Ro];return this.length=Math.max(this.length,Ro),_o!==this&&(this.negative=1),this._strip()},io.prototype.sub=function(uo){return this.clone().isub(uo)};function Eo(xo,uo,po){po.negative=uo.negative^xo.negative;var bo=xo.length+uo.length|0;po.length=bo,bo=bo-1|0;var _o=xo.words[0]|0,$o=uo.words[0]|0,Co=_o*$o,Ro=Co&67108863,So=Co/67108864|0;po.words[0]=Ro;for(var mo=1;mo>>26,Vo=So&67108863,Zo=Math.min(mo,uo.length-1),Qo=Math.max(0,mo-xo.length+1);Qo<=Zo;Qo++){var qo=mo-Qo|0;_o=xo.words[qo]|0,$o=uo.words[Qo]|0,Co=_o*$o+Vo,To+=Co/67108864|0,Vo=Co&67108863}po.words[mo]=Vo|0,So=To|0}return So!==0?po.words[mo]=So|0:po.length--,po._strip()}var ko=function(uo,po,bo){var _o=uo.words,$o=po.words,Co=bo.words,Ro=0,So,mo,To,Vo=_o[0]|0,Zo=Vo&8191,Qo=Vo>>>13,qo=_o[1]|0,Ho=qo&8191,$a=qo>>>13,zo=_o[2]|0,Ko=zo&8191,_c=zo>>>13,Cl=_o[3]|0,ga=Cl&8191,El=Cl>>>13,Al=_o[4]|0,Ol=Al&8191,Wl=Al>>>13,zl=_o[5]|0,Tl=zl&8191,Ml=zl>>>13,ou=_o[6]|0,Vl=ou&8191,Ll=ou>>>13,uu=_o[7]|0,ru=uu&8191,tu=uu>>>13,ku=_o[8]|0,au=ku&8191,wl=ku>>>13,Jo=_o[9]|0,Go=Jo&8191,$l=Jo>>>13,Zl=$o[0]|0,Ul=Zl&8191,Gl=Zl>>>13,Nu=$o[1]|0,hu=Nu&8191,cu=Nu>>>13,Wu=$o[2]|0,mu=Wu&8191,yu=Wu>>>13,Yu=$o[3]|0,_u=Yu&8191,Il=Yu>>>13,Nl=$o[4]|0,Pl=Nl&8191,Bl=Nl>>>13,fu=$o[5]|0,eu=fu&8191,Xl=fu>>>13,$u=$o[6]|0,Yo=$u&8191,_l=$u>>>13,Sl=$o[7]|0,Wo=Sl&8191,xl=Sl>>>13,Ql=$o[8]|0,Fl=Ql&8191,Jl=Ql>>>13,xu=$o[9]|0,lu=xu&8191,su=xu>>>13;bo.negative=uo.negative^po.negative,bo.length=19,So=Math.imul(Zo,Ul),mo=Math.imul(Zo,Gl),mo=mo+Math.imul(Qo,Ul)|0,To=Math.imul(Qo,Gl);var Xu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,So=Math.imul(Ho,Ul),mo=Math.imul(Ho,Gl),mo=mo+Math.imul($a,Ul)|0,To=Math.imul($a,Gl),So=So+Math.imul(Zo,hu)|0,mo=mo+Math.imul(Zo,cu)|0,mo=mo+Math.imul(Qo,hu)|0,To=To+Math.imul(Qo,cu)|0;var ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(ju>>>26)|0,ju&=67108863,So=Math.imul(Ko,Ul),mo=Math.imul(Ko,Gl),mo=mo+Math.imul(_c,Ul)|0,To=Math.imul(_c,Gl),So=So+Math.imul(Ho,hu)|0,mo=mo+Math.imul(Ho,cu)|0,mo=mo+Math.imul($a,hu)|0,To=To+Math.imul($a,cu)|0,So=So+Math.imul(Zo,mu)|0,mo=mo+Math.imul(Zo,yu)|0,mo=mo+Math.imul(Qo,mu)|0,To=To+Math.imul(Qo,yu)|0;var zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(zu>>>26)|0,zu&=67108863,So=Math.imul(ga,Ul),mo=Math.imul(ga,Gl),mo=mo+Math.imul(El,Ul)|0,To=Math.imul(El,Gl),So=So+Math.imul(Ko,hu)|0,mo=mo+Math.imul(Ko,cu)|0,mo=mo+Math.imul(_c,hu)|0,To=To+Math.imul(_c,cu)|0,So=So+Math.imul(Ho,mu)|0,mo=mo+Math.imul(Ho,yu)|0,mo=mo+Math.imul($a,mu)|0,To=To+Math.imul($a,yu)|0,So=So+Math.imul(Zo,_u)|0,mo=mo+Math.imul(Zo,Il)|0,mo=mo+Math.imul(Qo,_u)|0,To=To+Math.imul(Qo,Il)|0;var Ku=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ku>>>26)|0,Ku&=67108863,So=Math.imul(Ol,Ul),mo=Math.imul(Ol,Gl),mo=mo+Math.imul(Wl,Ul)|0,To=Math.imul(Wl,Gl),So=So+Math.imul(ga,hu)|0,mo=mo+Math.imul(ga,cu)|0,mo=mo+Math.imul(El,hu)|0,To=To+Math.imul(El,cu)|0,So=So+Math.imul(Ko,mu)|0,mo=mo+Math.imul(Ko,yu)|0,mo=mo+Math.imul(_c,mu)|0,To=To+Math.imul(_c,yu)|0,So=So+Math.imul(Ho,_u)|0,mo=mo+Math.imul(Ho,Il)|0,mo=mo+Math.imul($a,_u)|0,To=To+Math.imul($a,Il)|0,So=So+Math.imul(Zo,Pl)|0,mo=mo+Math.imul(Zo,Bl)|0,mo=mo+Math.imul(Qo,Pl)|0,To=To+Math.imul(Qo,Bl)|0;var Hu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,So=Math.imul(Tl,Ul),mo=Math.imul(Tl,Gl),mo=mo+Math.imul(Ml,Ul)|0,To=Math.imul(Ml,Gl),So=So+Math.imul(Ol,hu)|0,mo=mo+Math.imul(Ol,cu)|0,mo=mo+Math.imul(Wl,hu)|0,To=To+Math.imul(Wl,cu)|0,So=So+Math.imul(ga,mu)|0,mo=mo+Math.imul(ga,yu)|0,mo=mo+Math.imul(El,mu)|0,To=To+Math.imul(El,yu)|0,So=So+Math.imul(Ko,_u)|0,mo=mo+Math.imul(Ko,Il)|0,mo=mo+Math.imul(_c,_u)|0,To=To+Math.imul(_c,Il)|0,So=So+Math.imul(Ho,Pl)|0,mo=mo+Math.imul(Ho,Bl)|0,mo=mo+Math.imul($a,Pl)|0,To=To+Math.imul($a,Bl)|0,So=So+Math.imul(Zo,eu)|0,mo=mo+Math.imul(Zo,Xl)|0,mo=mo+Math.imul(Qo,eu)|0,To=To+Math.imul(Qo,Xl)|0;var Gu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Gu>>>26)|0,Gu&=67108863,So=Math.imul(Vl,Ul),mo=Math.imul(Vl,Gl),mo=mo+Math.imul(Ll,Ul)|0,To=Math.imul(Ll,Gl),So=So+Math.imul(Tl,hu)|0,mo=mo+Math.imul(Tl,cu)|0,mo=mo+Math.imul(Ml,hu)|0,To=To+Math.imul(Ml,cu)|0,So=So+Math.imul(Ol,mu)|0,mo=mo+Math.imul(Ol,yu)|0,mo=mo+Math.imul(Wl,mu)|0,To=To+Math.imul(Wl,yu)|0,So=So+Math.imul(ga,_u)|0,mo=mo+Math.imul(ga,Il)|0,mo=mo+Math.imul(El,_u)|0,To=To+Math.imul(El,Il)|0,So=So+Math.imul(Ko,Pl)|0,mo=mo+Math.imul(Ko,Bl)|0,mo=mo+Math.imul(_c,Pl)|0,To=To+Math.imul(_c,Bl)|0,So=So+Math.imul(Ho,eu)|0,mo=mo+Math.imul(Ho,Xl)|0,mo=mo+Math.imul($a,eu)|0,To=To+Math.imul($a,Xl)|0,So=So+Math.imul(Zo,Yo)|0,mo=mo+Math.imul(Zo,_l)|0,mo=mo+Math.imul(Qo,Yo)|0,To=To+Math.imul(Qo,_l)|0;var Zu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,So=Math.imul(ru,Ul),mo=Math.imul(ru,Gl),mo=mo+Math.imul(tu,Ul)|0,To=Math.imul(tu,Gl),So=So+Math.imul(Vl,hu)|0,mo=mo+Math.imul(Vl,cu)|0,mo=mo+Math.imul(Ll,hu)|0,To=To+Math.imul(Ll,cu)|0,So=So+Math.imul(Tl,mu)|0,mo=mo+Math.imul(Tl,yu)|0,mo=mo+Math.imul(Ml,mu)|0,To=To+Math.imul(Ml,yu)|0,So=So+Math.imul(Ol,_u)|0,mo=mo+Math.imul(Ol,Il)|0,mo=mo+Math.imul(Wl,_u)|0,To=To+Math.imul(Wl,Il)|0,So=So+Math.imul(ga,Pl)|0,mo=mo+Math.imul(ga,Bl)|0,mo=mo+Math.imul(El,Pl)|0,To=To+Math.imul(El,Bl)|0,So=So+Math.imul(Ko,eu)|0,mo=mo+Math.imul(Ko,Xl)|0,mo=mo+Math.imul(_c,eu)|0,To=To+Math.imul(_c,Xl)|0,So=So+Math.imul(Ho,Yo)|0,mo=mo+Math.imul(Ho,_l)|0,mo=mo+Math.imul($a,Yo)|0,To=To+Math.imul($a,_l)|0,So=So+Math.imul(Zo,Wo)|0,mo=mo+Math.imul(Zo,xl)|0,mo=mo+Math.imul(Qo,Wo)|0,To=To+Math.imul(Qo,xl)|0;var Vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Vu>>>26)|0,Vu&=67108863,So=Math.imul(au,Ul),mo=Math.imul(au,Gl),mo=mo+Math.imul(wl,Ul)|0,To=Math.imul(wl,Gl),So=So+Math.imul(ru,hu)|0,mo=mo+Math.imul(ru,cu)|0,mo=mo+Math.imul(tu,hu)|0,To=To+Math.imul(tu,cu)|0,So=So+Math.imul(Vl,mu)|0,mo=mo+Math.imul(Vl,yu)|0,mo=mo+Math.imul(Ll,mu)|0,To=To+Math.imul(Ll,yu)|0,So=So+Math.imul(Tl,_u)|0,mo=mo+Math.imul(Tl,Il)|0,mo=mo+Math.imul(Ml,_u)|0,To=To+Math.imul(Ml,Il)|0,So=So+Math.imul(Ol,Pl)|0,mo=mo+Math.imul(Ol,Bl)|0,mo=mo+Math.imul(Wl,Pl)|0,To=To+Math.imul(Wl,Bl)|0,So=So+Math.imul(ga,eu)|0,mo=mo+Math.imul(ga,Xl)|0,mo=mo+Math.imul(El,eu)|0,To=To+Math.imul(El,Xl)|0,So=So+Math.imul(Ko,Yo)|0,mo=mo+Math.imul(Ko,_l)|0,mo=mo+Math.imul(_c,Yo)|0,To=To+Math.imul(_c,_l)|0,So=So+Math.imul(Ho,Wo)|0,mo=mo+Math.imul(Ho,xl)|0,mo=mo+Math.imul($a,Wo)|0,To=To+Math.imul($a,xl)|0,So=So+Math.imul(Zo,Fl)|0,mo=mo+Math.imul(Zo,Jl)|0,mo=mo+Math.imul(Qo,Fl)|0,To=To+Math.imul(Qo,Jl)|0;var Ju=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Ju>>>26)|0,Ju&=67108863,So=Math.imul(Go,Ul),mo=Math.imul(Go,Gl),mo=mo+Math.imul($l,Ul)|0,To=Math.imul($l,Gl),So=So+Math.imul(au,hu)|0,mo=mo+Math.imul(au,cu)|0,mo=mo+Math.imul(wl,hu)|0,To=To+Math.imul(wl,cu)|0,So=So+Math.imul(ru,mu)|0,mo=mo+Math.imul(ru,yu)|0,mo=mo+Math.imul(tu,mu)|0,To=To+Math.imul(tu,yu)|0,So=So+Math.imul(Vl,_u)|0,mo=mo+Math.imul(Vl,Il)|0,mo=mo+Math.imul(Ll,_u)|0,To=To+Math.imul(Ll,Il)|0,So=So+Math.imul(Tl,Pl)|0,mo=mo+Math.imul(Tl,Bl)|0,mo=mo+Math.imul(Ml,Pl)|0,To=To+Math.imul(Ml,Bl)|0,So=So+Math.imul(Ol,eu)|0,mo=mo+Math.imul(Ol,Xl)|0,mo=mo+Math.imul(Wl,eu)|0,To=To+Math.imul(Wl,Xl)|0,So=So+Math.imul(ga,Yo)|0,mo=mo+Math.imul(ga,_l)|0,mo=mo+Math.imul(El,Yo)|0,To=To+Math.imul(El,_l)|0,So=So+Math.imul(Ko,Wo)|0,mo=mo+Math.imul(Ko,xl)|0,mo=mo+Math.imul(_c,Wo)|0,To=To+Math.imul(_c,xl)|0,So=So+Math.imul(Ho,Fl)|0,mo=mo+Math.imul(Ho,Jl)|0,mo=mo+Math.imul($a,Fl)|0,To=To+Math.imul($a,Jl)|0,So=So+Math.imul(Zo,lu)|0,mo=mo+Math.imul(Zo,su)|0,mo=mo+Math.imul(Qo,lu)|0,To=To+Math.imul(Qo,su)|0;var Uu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Uu>>>26)|0,Uu&=67108863,So=Math.imul(Go,hu),mo=Math.imul(Go,cu),mo=mo+Math.imul($l,hu)|0,To=Math.imul($l,cu),So=So+Math.imul(au,mu)|0,mo=mo+Math.imul(au,yu)|0,mo=mo+Math.imul(wl,mu)|0,To=To+Math.imul(wl,yu)|0,So=So+Math.imul(ru,_u)|0,mo=mo+Math.imul(ru,Il)|0,mo=mo+Math.imul(tu,_u)|0,To=To+Math.imul(tu,Il)|0,So=So+Math.imul(Vl,Pl)|0,mo=mo+Math.imul(Vl,Bl)|0,mo=mo+Math.imul(Ll,Pl)|0,To=To+Math.imul(Ll,Bl)|0,So=So+Math.imul(Tl,eu)|0,mo=mo+Math.imul(Tl,Xl)|0,mo=mo+Math.imul(Ml,eu)|0,To=To+Math.imul(Ml,Xl)|0,So=So+Math.imul(Ol,Yo)|0,mo=mo+Math.imul(Ol,_l)|0,mo=mo+Math.imul(Wl,Yo)|0,To=To+Math.imul(Wl,_l)|0,So=So+Math.imul(ga,Wo)|0,mo=mo+Math.imul(ga,xl)|0,mo=mo+Math.imul(El,Wo)|0,To=To+Math.imul(El,xl)|0,So=So+Math.imul(Ko,Fl)|0,mo=mo+Math.imul(Ko,Jl)|0,mo=mo+Math.imul(_c,Fl)|0,To=To+Math.imul(_c,Jl)|0,So=So+Math.imul(Ho,lu)|0,mo=mo+Math.imul(Ho,su)|0,mo=mo+Math.imul($a,lu)|0,To=To+Math.imul($a,su)|0;var qu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(qu>>>26)|0,qu&=67108863,So=Math.imul(Go,mu),mo=Math.imul(Go,yu),mo=mo+Math.imul($l,mu)|0,To=Math.imul($l,yu),So=So+Math.imul(au,_u)|0,mo=mo+Math.imul(au,Il)|0,mo=mo+Math.imul(wl,_u)|0,To=To+Math.imul(wl,Il)|0,So=So+Math.imul(ru,Pl)|0,mo=mo+Math.imul(ru,Bl)|0,mo=mo+Math.imul(tu,Pl)|0,To=To+Math.imul(tu,Bl)|0,So=So+Math.imul(Vl,eu)|0,mo=mo+Math.imul(Vl,Xl)|0,mo=mo+Math.imul(Ll,eu)|0,To=To+Math.imul(Ll,Xl)|0,So=So+Math.imul(Tl,Yo)|0,mo=mo+Math.imul(Tl,_l)|0,mo=mo+Math.imul(Ml,Yo)|0,To=To+Math.imul(Ml,_l)|0,So=So+Math.imul(Ol,Wo)|0,mo=mo+Math.imul(Ol,xl)|0,mo=mo+Math.imul(Wl,Wo)|0,To=To+Math.imul(Wl,xl)|0,So=So+Math.imul(ga,Fl)|0,mo=mo+Math.imul(ga,Jl)|0,mo=mo+Math.imul(El,Fl)|0,To=To+Math.imul(El,Jl)|0,So=So+Math.imul(Ko,lu)|0,mo=mo+Math.imul(Ko,su)|0,mo=mo+Math.imul(_c,lu)|0,To=To+Math.imul(_c,su)|0;var Mu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Mu>>>26)|0,Mu&=67108863,So=Math.imul(Go,_u),mo=Math.imul(Go,Il),mo=mo+Math.imul($l,_u)|0,To=Math.imul($l,Il),So=So+Math.imul(au,Pl)|0,mo=mo+Math.imul(au,Bl)|0,mo=mo+Math.imul(wl,Pl)|0,To=To+Math.imul(wl,Bl)|0,So=So+Math.imul(ru,eu)|0,mo=mo+Math.imul(ru,Xl)|0,mo=mo+Math.imul(tu,eu)|0,To=To+Math.imul(tu,Xl)|0,So=So+Math.imul(Vl,Yo)|0,mo=mo+Math.imul(Vl,_l)|0,mo=mo+Math.imul(Ll,Yo)|0,To=To+Math.imul(Ll,_l)|0,So=So+Math.imul(Tl,Wo)|0,mo=mo+Math.imul(Tl,xl)|0,mo=mo+Math.imul(Ml,Wo)|0,To=To+Math.imul(Ml,xl)|0,So=So+Math.imul(Ol,Fl)|0,mo=mo+Math.imul(Ol,Jl)|0,mo=mo+Math.imul(Wl,Fl)|0,To=To+Math.imul(Wl,Jl)|0,So=So+Math.imul(ga,lu)|0,mo=mo+Math.imul(ga,su)|0,mo=mo+Math.imul(El,lu)|0,To=To+Math.imul(El,su)|0;var Bu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Bu>>>26)|0,Bu&=67108863,So=Math.imul(Go,Pl),mo=Math.imul(Go,Bl),mo=mo+Math.imul($l,Pl)|0,To=Math.imul($l,Bl),So=So+Math.imul(au,eu)|0,mo=mo+Math.imul(au,Xl)|0,mo=mo+Math.imul(wl,eu)|0,To=To+Math.imul(wl,Xl)|0,So=So+Math.imul(ru,Yo)|0,mo=mo+Math.imul(ru,_l)|0,mo=mo+Math.imul(tu,Yo)|0,To=To+Math.imul(tu,_l)|0,So=So+Math.imul(Vl,Wo)|0,mo=mo+Math.imul(Vl,xl)|0,mo=mo+Math.imul(Ll,Wo)|0,To=To+Math.imul(Ll,xl)|0,So=So+Math.imul(Tl,Fl)|0,mo=mo+Math.imul(Tl,Jl)|0,mo=mo+Math.imul(Ml,Fl)|0,To=To+Math.imul(Ml,Jl)|0,So=So+Math.imul(Ol,lu)|0,mo=mo+Math.imul(Ol,su)|0,mo=mo+Math.imul(Wl,lu)|0,To=To+Math.imul(Wl,su)|0;var Au=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Au>>>26)|0,Au&=67108863,So=Math.imul(Go,eu),mo=Math.imul(Go,Xl),mo=mo+Math.imul($l,eu)|0,To=Math.imul($l,Xl),So=So+Math.imul(au,Yo)|0,mo=mo+Math.imul(au,_l)|0,mo=mo+Math.imul(wl,Yo)|0,To=To+Math.imul(wl,_l)|0,So=So+Math.imul(ru,Wo)|0,mo=mo+Math.imul(ru,xl)|0,mo=mo+Math.imul(tu,Wo)|0,To=To+Math.imul(tu,xl)|0,So=So+Math.imul(Vl,Fl)|0,mo=mo+Math.imul(Vl,Jl)|0,mo=mo+Math.imul(Ll,Fl)|0,To=To+Math.imul(Ll,Jl)|0,So=So+Math.imul(Tl,lu)|0,mo=mo+Math.imul(Tl,su)|0,mo=mo+Math.imul(Ml,lu)|0,To=To+Math.imul(Ml,su)|0;var Du=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Du>>>26)|0,Du&=67108863,So=Math.imul(Go,Yo),mo=Math.imul(Go,_l),mo=mo+Math.imul($l,Yo)|0,To=Math.imul($l,_l),So=So+Math.imul(au,Wo)|0,mo=mo+Math.imul(au,xl)|0,mo=mo+Math.imul(wl,Wo)|0,To=To+Math.imul(wl,xl)|0,So=So+Math.imul(ru,Fl)|0,mo=mo+Math.imul(ru,Jl)|0,mo=mo+Math.imul(tu,Fl)|0,To=To+Math.imul(tu,Jl)|0,So=So+Math.imul(Vl,lu)|0,mo=mo+Math.imul(Vl,su)|0,mo=mo+Math.imul(Ll,lu)|0,To=To+Math.imul(Ll,su)|0;var wu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(wu>>>26)|0,wu&=67108863,So=Math.imul(Go,Wo),mo=Math.imul(Go,xl),mo=mo+Math.imul($l,Wo)|0,To=Math.imul($l,xl),So=So+Math.imul(au,Fl)|0,mo=mo+Math.imul(au,Jl)|0,mo=mo+Math.imul(wl,Fl)|0,To=To+Math.imul(wl,Jl)|0,So=So+Math.imul(ru,lu)|0,mo=mo+Math.imul(ru,su)|0,mo=mo+Math.imul(tu,lu)|0,To=To+Math.imul(tu,su)|0;var vu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(vu>>>26)|0,vu&=67108863,So=Math.imul(Go,Fl),mo=Math.imul(Go,Jl),mo=mo+Math.imul($l,Fl)|0,To=Math.imul($l,Jl),So=So+Math.imul(au,lu)|0,mo=mo+Math.imul(au,su)|0,mo=mo+Math.imul(wl,lu)|0,To=To+Math.imul(wl,su)|0;var Cu=(Ro+So|0)+((mo&8191)<<13)|0;Ro=(To+(mo>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,So=Math.imul(Go,lu),mo=Math.imul(Go,su),mo=mo+Math.imul($l,lu)|0,To=Math.imul($l,su);var Eu=(Ro+So|0)+((mo&8191)<<13)|0;return Ro=(To+(mo>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,Co[0]=Xu,Co[1]=ju,Co[2]=zu,Co[3]=Ku,Co[4]=Hu,Co[5]=Gu,Co[6]=Zu,Co[7]=Vu,Co[8]=Ju,Co[9]=Uu,Co[10]=qu,Co[11]=Mu,Co[12]=Bu,Co[13]=Au,Co[14]=Du,Co[15]=wu,Co[16]=vu,Co[17]=Cu,Co[18]=Eu,Ro!==0&&(Co[19]=Ro,bo.length++),bo};Math.imul||(ko=Eo);function Ao(xo,uo,po){po.negative=uo.negative^xo.negative,po.length=xo.length+uo.length;for(var bo=0,_o=0,$o=0;$o>>26)|0,_o+=Co>>>26,Co&=67108863}po.words[$o]=Ro,bo=Co,Co=_o}return bo!==0?po.words[$o]=bo:po.length--,po._strip()}function Po(xo,uo,po){return Ao(xo,uo,po)}io.prototype.mulTo=function(uo,po){var bo,_o=this.length+uo.length;return this.length===10&&uo.length===10?bo=ko(this,uo,po):_o<63?bo=Eo(this,uo,po):_o<1024?bo=Ao(this,uo,po):bo=Po(this,uo,po),bo},io.prototype.mul=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),this.mulTo(uo,po)},io.prototype.mulf=function(uo){var po=new io(null);return po.words=new Array(this.length+uo.length),Po(this,uo,po)},io.prototype.imul=function(uo){return this.clone().mulTo(uo,this)},io.prototype.imuln=function(uo){var po=uo<0;po&&(uo=-uo),ro(typeof uo=="number"),ro(uo<67108864);for(var bo=0,_o=0;_o>=26,bo+=$o/67108864|0,bo+=Co>>>26,this.words[_o]=Co&67108863}return bo!==0&&(this.words[_o]=bo,this.length++),po?this.ineg():this},io.prototype.muln=function(uo){return this.clone().imuln(uo)},io.prototype.sqr=function(){return this.mul(this)},io.prototype.isqr=function(){return this.imul(this.clone())},io.prototype.pow=function(uo){var po=wo(uo);if(po.length===0)return new io(1);for(var bo=this,_o=0;_o=0);var po=uo%26,bo=(uo-po)/26,_o=67108863>>>26-po<<26-po,$o;if(po!==0){var Co=0;for($o=0;$o>>26-po}Co&&(this.words[$o]=Co,this.length++)}if(bo!==0){for($o=this.length-1;$o>=0;$o--)this.words[$o+bo]=this.words[$o];for($o=0;$o=0);var _o;po?_o=(po-po%26)/26:_o=0;var $o=uo%26,Co=Math.min((uo-$o)/26,this.length),Ro=67108863^67108863>>>$o<<$o,So=bo;if(_o-=Co,_o=Math.max(0,_o),So){for(var mo=0;moCo)for(this.length-=Co,mo=0;mo=0&&(To!==0||mo>=_o);mo--){var Vo=this.words[mo]|0;this.words[mo]=To<<26-$o|Vo>>>$o,To=Vo&Ro}return So&&To!==0&&(So.words[So.length++]=To),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},io.prototype.ishrn=function(uo,po,bo){return ro(this.negative===0),this.iushrn(uo,po,bo)},io.prototype.shln=function(uo){return this.clone().ishln(uo)},io.prototype.ushln=function(uo){return this.clone().iushln(uo)},io.prototype.shrn=function(uo){return this.clone().ishrn(uo)},io.prototype.ushrn=function(uo){return this.clone().iushrn(uo)},io.prototype.testn=function(uo){ro(typeof uo=="number"&&uo>=0);var po=uo%26,bo=(uo-po)/26,_o=1<=0);var po=uo%26,bo=(uo-po)/26;if(ro(this.negative===0,"imaskn works only with positive numbers"),this.length<=bo)return this;if(po!==0&&bo++,this.length=Math.min(bo,this.length),po!==0){var _o=67108863^67108863>>>po<=67108864;po++)this.words[po]-=67108864,po===this.length-1?this.words[po+1]=1:this.words[po+1]++;return this.length=Math.max(this.length,po+1),this},io.prototype.isubn=function(uo){if(ro(typeof uo=="number"),ro(uo<67108864),uo<0)return this.iaddn(-uo);if(this.negative!==0)return this.negative=0,this.iaddn(uo),this.negative=1,this;if(this.words[0]-=uo,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var po=0;po>26)-(So/67108864|0),this.words[$o+bo]=Co&67108863}for(;$o>26,this.words[$o+bo]=Co&67108863;if(Ro===0)return this._strip();for(ro(Ro===-1),Ro=0,$o=0;$o>26,this.words[$o]=Co&67108863;return this.negative=1,this._strip()},io.prototype._wordDiv=function(uo,po){var bo=this.length-uo.length,_o=this.clone(),$o=uo,Co=$o.words[$o.length-1]|0,Ro=this._countBits(Co);bo=26-Ro,bo!==0&&($o=$o.ushln(bo),_o.iushln(bo),Co=$o.words[$o.length-1]|0);var So=_o.length-$o.length,mo;if(po!=="mod"){mo=new io(null),mo.length=So+1,mo.words=new Array(mo.length);for(var To=0;To=0;Zo--){var Qo=(_o.words[$o.length+Zo]|0)*67108864+(_o.words[$o.length+Zo-1]|0);for(Qo=Math.min(Qo/Co|0,67108863),_o._ishlnsubmul($o,Qo,Zo);_o.negative!==0;)Qo--,_o.negative=0,_o._ishlnsubmul($o,1,Zo),_o.isZero()||(_o.negative^=1);mo&&(mo.words[Zo]=Qo)}return mo&&mo._strip(),_o._strip(),po!=="div"&&bo!==0&&_o.iushrn(bo),{div:mo||null,mod:_o}},io.prototype.divmod=function(uo,po,bo){if(ro(!uo.isZero()),this.isZero())return{div:new io(0),mod:new io(0)};var _o,$o,Co;return this.negative!==0&&uo.negative===0?(Co=this.neg().divmod(uo,po),po!=="mod"&&(_o=Co.div.neg()),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.iadd(uo)),{div:_o,mod:$o}):this.negative===0&&uo.negative!==0?(Co=this.divmod(uo.neg(),po),po!=="mod"&&(_o=Co.div.neg()),{div:_o,mod:Co.mod}):this.negative&uo.negative?(Co=this.neg().divmod(uo.neg(),po),po!=="div"&&($o=Co.mod.neg(),bo&&$o.negative!==0&&$o.isub(uo)),{div:Co.div,mod:$o}):uo.length>this.length||this.cmp(uo)<0?{div:new io(0),mod:this}:uo.length===1?po==="div"?{div:this.divn(uo.words[0]),mod:null}:po==="mod"?{div:null,mod:new io(this.modrn(uo.words[0]))}:{div:this.divn(uo.words[0]),mod:new io(this.modrn(uo.words[0]))}:this._wordDiv(uo,po)},io.prototype.div=function(uo){return this.divmod(uo,"div",!1).div},io.prototype.mod=function(uo){return this.divmod(uo,"mod",!1).mod},io.prototype.umod=function(uo){return this.divmod(uo,"mod",!0).mod},io.prototype.divRound=function(uo){var po=this.divmod(uo);if(po.mod.isZero())return po.div;var bo=po.div.negative!==0?po.mod.isub(uo):po.mod,_o=uo.ushrn(1),$o=uo.andln(1),Co=bo.cmp(_o);return Co<0||$o===1&&Co===0?po.div:po.div.negative!==0?po.div.isubn(1):po.div.iaddn(1)},io.prototype.modrn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=(1<<26)%uo,_o=0,$o=this.length-1;$o>=0;$o--)_o=(bo*_o+(this.words[$o]|0))%uo;return po?-_o:_o},io.prototype.modn=function(uo){return this.modrn(uo)},io.prototype.idivn=function(uo){var po=uo<0;po&&(uo=-uo),ro(uo<=67108863);for(var bo=0,_o=this.length-1;_o>=0;_o--){var $o=(this.words[_o]|0)+bo*67108864;this.words[_o]=$o/uo|0,bo=$o%uo}return this._strip(),po?this.ineg():this},io.prototype.divn=function(uo){return this.clone().idivn(uo)},io.prototype.egcd=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=new io(0),Ro=new io(1),So=0;po.isEven()&&bo.isEven();)po.iushrn(1),bo.iushrn(1),++So;for(var mo=bo.clone(),To=po.clone();!po.isZero();){for(var Vo=0,Zo=1;!(po.words[0]&Zo)&&Vo<26;++Vo,Zo<<=1);if(Vo>0)for(po.iushrn(Vo);Vo-- >0;)(_o.isOdd()||$o.isOdd())&&(_o.iadd(mo),$o.isub(To)),_o.iushrn(1),$o.iushrn(1);for(var Qo=0,qo=1;!(bo.words[0]&qo)&&Qo<26;++Qo,qo<<=1);if(Qo>0)for(bo.iushrn(Qo);Qo-- >0;)(Co.isOdd()||Ro.isOdd())&&(Co.iadd(mo),Ro.isub(To)),Co.iushrn(1),Ro.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub(Co),$o.isub(Ro)):(bo.isub(po),Co.isub(_o),Ro.isub($o))}return{a:Co,b:Ro,gcd:bo.iushln(So)}},io.prototype._invmp=function(uo){ro(uo.negative===0),ro(!uo.isZero());var po=this,bo=uo.clone();po.negative!==0?po=po.umod(uo):po=po.clone();for(var _o=new io(1),$o=new io(0),Co=bo.clone();po.cmpn(1)>0&&bo.cmpn(1)>0;){for(var Ro=0,So=1;!(po.words[0]&So)&&Ro<26;++Ro,So<<=1);if(Ro>0)for(po.iushrn(Ro);Ro-- >0;)_o.isOdd()&&_o.iadd(Co),_o.iushrn(1);for(var mo=0,To=1;!(bo.words[0]&To)&&mo<26;++mo,To<<=1);if(mo>0)for(bo.iushrn(mo);mo-- >0;)$o.isOdd()&&$o.iadd(Co),$o.iushrn(1);po.cmp(bo)>=0?(po.isub(bo),_o.isub($o)):(bo.isub(po),$o.isub(_o))}var Vo;return po.cmpn(1)===0?Vo=_o:Vo=$o,Vo.cmpn(0)<0&&Vo.iadd(uo),Vo},io.prototype.gcd=function(uo){if(this.isZero())return uo.abs();if(uo.isZero())return this.abs();var po=this.clone(),bo=uo.clone();po.negative=0,bo.negative=0;for(var _o=0;po.isEven()&&bo.isEven();_o++)po.iushrn(1),bo.iushrn(1);do{for(;po.isEven();)po.iushrn(1);for(;bo.isEven();)bo.iushrn(1);var $o=po.cmp(bo);if($o<0){var Co=po;po=bo,bo=Co}else if($o===0||bo.cmpn(1)===0)break;po.isub(bo)}while(!0);return bo.iushln(_o)},io.prototype.invm=function(uo){return this.egcd(uo).a.umod(uo)},io.prototype.isEven=function(){return(this.words[0]&1)===0},io.prototype.isOdd=function(){return(this.words[0]&1)===1},io.prototype.andln=function(uo){return this.words[0]&uo},io.prototype.bincn=function(uo){ro(typeof uo=="number");var po=uo%26,bo=(uo-po)/26,_o=1<>>26,Ro&=67108863,this.words[Co]=Ro}return $o!==0&&(this.words[Co]=$o,this.length++),this},io.prototype.isZero=function(){return this.length===1&&this.words[0]===0},io.prototype.cmpn=function(uo){var po=uo<0;if(this.negative!==0&&!po)return-1;if(this.negative===0&&po)return 1;this._strip();var bo;if(this.length>1)bo=1;else{po&&(uo=-uo),ro(uo<=67108863,"Number is too big");var _o=this.words[0]|0;bo=_o===uo?0:_ouo.length)return 1;if(this.length=0;bo--){var _o=this.words[bo]|0,$o=uo.words[bo]|0;if(_o!==$o){_o<$o?po=-1:_o>$o&&(po=1);break}}return po},io.prototype.gtn=function(uo){return this.cmpn(uo)===1},io.prototype.gt=function(uo){return this.cmp(uo)===1},io.prototype.gten=function(uo){return this.cmpn(uo)>=0},io.prototype.gte=function(uo){return this.cmp(uo)>=0},io.prototype.ltn=function(uo){return this.cmpn(uo)===-1},io.prototype.lt=function(uo){return this.cmp(uo)===-1},io.prototype.lten=function(uo){return this.cmpn(uo)<=0},io.prototype.lte=function(uo){return this.cmp(uo)<=0},io.prototype.eqn=function(uo){return this.cmpn(uo)===0},io.prototype.eq=function(uo){return this.cmp(uo)===0},io.red=function(uo){return new Lo(uo)},io.prototype.toRed=function(uo){return ro(!this.red,"Already a number in reduction context"),ro(this.negative===0,"red works only with positives"),uo.convertTo(this)._forceRed(uo)},io.prototype.fromRed=function(){return ro(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},io.prototype._forceRed=function(uo){return this.red=uo,this},io.prototype.forceRed=function(uo){return ro(!this.red,"Already a number in reduction context"),this._forceRed(uo)},io.prototype.redAdd=function(uo){return ro(this.red,"redAdd works only with red numbers"),this.red.add(this,uo)},io.prototype.redIAdd=function(uo){return ro(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,uo)},io.prototype.redSub=function(uo){return ro(this.red,"redSub works only with red numbers"),this.red.sub(this,uo)},io.prototype.redISub=function(uo){return ro(this.red,"redISub works only with red numbers"),this.red.isub(this,uo)},io.prototype.redShl=function(uo){return ro(this.red,"redShl works only with red numbers"),this.red.shl(this,uo)},io.prototype.redMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.mul(this,uo)},io.prototype.redIMul=function(uo){return ro(this.red,"redMul works only with red numbers"),this.red._verify2(this,uo),this.red.imul(this,uo)},io.prototype.redSqr=function(){return ro(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},io.prototype.redISqr=function(){return ro(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},io.prototype.redSqrt=function(){return ro(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},io.prototype.redInvm=function(){return ro(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},io.prototype.redNeg=function(){return ro(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},io.prototype.redPow=function(uo){return ro(this.red&&!uo.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,uo)};var jo={k256:null,p224:null,p192:null,p25519:null};function Mo(xo,uo){this.name=xo,this.p=new io(uo,16),this.n=this.p.bitLength(),this.k=new io(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Mo.prototype._tmp=function(){var uo=new io(null);return uo.words=new Array(Math.ceil(this.n/13)),uo},Mo.prototype.ireduce=function(uo){var po=uo,bo;do this.split(po,this.tmp),po=this.imulK(po),po=po.iadd(this.tmp),bo=po.bitLength();while(bo>this.n);var _o=bo0?po.isub(this.p):po.strip!==void 0?po.strip():po._strip(),po},Mo.prototype.split=function(uo,po){uo.iushrn(this.n,0,po)},Mo.prototype.imulK=function(uo){return uo.imul(this.k)};function No(){Mo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}no(No,Mo),No.prototype.split=function(uo,po){for(var bo=4194303,_o=Math.min(uo.length,9),$o=0;$o<_o;$o++)po.words[$o]=uo.words[$o];if(po.length=_o,uo.length<=9){uo.words[0]=0,uo.length=1;return}var Co=uo.words[9];for(po.words[po.length++]=Co&bo,$o=10;$o>>22,Co=Ro}Co>>>=22,uo.words[$o-10]=Co,Co===0&&uo.length>10?uo.length-=10:uo.length-=9},No.prototype.imulK=function(uo){uo.words[uo.length]=0,uo.words[uo.length+1]=0,uo.length+=2;for(var po=0,bo=0;bo>>=26,uo.words[bo]=$o,po=_o}return po!==0&&(uo.words[uo.length++]=po),uo},io._prime=function(uo){if(jo[uo])return jo[uo];var po;if(uo==="k256")po=new No;else if(uo==="p224")po=new Do;else if(uo==="p192")po=new Fo;else if(uo==="p25519")po=new Xo;else throw new Error("Unknown prime "+uo);return jo[uo]=po,po};function Lo(xo){if(typeof xo=="string"){var uo=io._prime(xo);this.m=uo.p,this.prime=uo}else ro(xo.gtn(1),"modulus must be greater than 1"),this.m=xo,this.prime=null}Lo.prototype._verify1=function(uo){ro(uo.negative===0,"red works only with positives"),ro(uo.red,"red works only with red numbers")},Lo.prototype._verify2=function(uo,po){ro((uo.negative|po.negative)===0,"red works only with positives"),ro(uo.red&&uo.red===po.red,"red works only with red numbers")},Lo.prototype.imod=function(uo){return this.prime?this.prime.ireduce(uo)._forceRed(this):(lo(uo,uo.umod(this.m)._forceRed(this)),uo)},Lo.prototype.neg=function(uo){return uo.isZero()?uo.clone():this.m.sub(uo)._forceRed(this)},Lo.prototype.add=function(uo,po){this._verify2(uo,po);var bo=uo.add(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo._forceRed(this)},Lo.prototype.iadd=function(uo,po){this._verify2(uo,po);var bo=uo.iadd(po);return bo.cmp(this.m)>=0&&bo.isub(this.m),bo},Lo.prototype.sub=function(uo,po){this._verify2(uo,po);var bo=uo.sub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo._forceRed(this)},Lo.prototype.isub=function(uo,po){this._verify2(uo,po);var bo=uo.isub(po);return bo.cmpn(0)<0&&bo.iadd(this.m),bo},Lo.prototype.shl=function(uo,po){return this._verify1(uo),this.imod(uo.ushln(po))},Lo.prototype.imul=function(uo,po){return this._verify2(uo,po),this.imod(uo.imul(po))},Lo.prototype.mul=function(uo,po){return this._verify2(uo,po),this.imod(uo.mul(po))},Lo.prototype.isqr=function(uo){return this.imul(uo,uo.clone())},Lo.prototype.sqr=function(uo){return this.mul(uo,uo)},Lo.prototype.sqrt=function(uo){if(uo.isZero())return uo.clone();var po=this.m.andln(3);if(ro(po%2===1),po===3){var bo=this.m.add(new io(1)).iushrn(2);return this.pow(uo,bo)}for(var _o=this.m.subn(1),$o=0;!_o.isZero()&&_o.andln(1)===0;)$o++,_o.iushrn(1);ro(!_o.isZero());var Co=new io(1).toRed(this),Ro=Co.redNeg(),So=this.m.subn(1).iushrn(1),mo=this.m.bitLength();for(mo=new io(2*mo*mo).toRed(this);this.pow(mo,So).cmp(Ro)!==0;)mo.redIAdd(Ro);for(var To=this.pow(mo,_o),Vo=this.pow(uo,_o.addn(1).iushrn(1)),Zo=this.pow(uo,_o),Qo=$o;Zo.cmp(Co)!==0;){for(var qo=Zo,Ho=0;qo.cmp(Co)!==0;Ho++)qo=qo.redSqr();ro(Ho=0;$o--){for(var To=po.words[$o],Vo=mo-1;Vo>=0;Vo--){var Zo=To>>Vo&1;if(Co!==_o[0]&&(Co=this.sqr(Co)),Zo===0&&Ro===0){So=0;continue}Ro<<=1,Ro|=Zo,So++,!(So!==bo&&($o!==0||Vo!==0))&&(Co=this.mul(Co,_o[Ro]),So=0,Ro=0)}mo=26}return Co},Lo.prototype.convertTo=function(uo){var po=uo.umod(this.m);return po===uo?po.clone():po},Lo.prototype.convertFrom=function(uo){var po=uo.clone();return po.red=null,po},io.mont=function(uo){return new Bo(uo)};function Bo(xo){Lo.call(this,xo),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new io(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}no(Bo,Lo),Bo.prototype.convertTo=function(uo){return this.imod(uo.ushln(this.shift))},Bo.prototype.convertFrom=function(uo){var po=this.imod(uo.mul(this.rinv));return po.red=null,po},Bo.prototype.imul=function(uo,po){if(uo.isZero()||po.isZero())return uo.words[0]=0,uo.length=1,uo;var bo=uo.imul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.mul=function(uo,po){if(uo.isZero()||po.isZero())return new io(0)._forceRed(this);var bo=uo.mul(po),_o=bo.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$o=bo.isub(_o).iushrn(this.shift),Co=$o;return $o.cmp(this.m)>=0?Co=$o.isub(this.m):$o.cmpn(0)<0&&(Co=$o.iadd(this.m)),Co._forceRed(this)},Bo.prototype.invm=function(uo){var po=this.imod(uo._invmp(this.m).mul(this.r2));return po._forceRed(this)}})(Xr,commonjsGlobal)})(bn$1);var bnExports=bn$1.exports;const BN=getDefaultExportFromCjs$2(bnExports);class StructError extends TypeError{constructor(eo,to){let ro;const{message:no,explanation:io,...oo}=eo,{path:ao}=eo,so=ao.length===0?no:`At path: ${ao.join(".")} -- ${no}`;super(io??so),io!=null&&(this.cause=so),Object.assign(this,oo),this.name=this.constructor.name,this.failures=()=>ro??(ro=[eo,...to()])}}function isIterable(Xr){return isObject$2(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$2(Xr){return typeof Xr=="object"&&Xr!=null}function isNonArrayObject(Xr){return isObject$2(Xr)&&!Array.isArray(Xr)}function print(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures(Xr,eo,to,ro){isIterable(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure(no,eo,to,ro);io&&(yield io)}}function*run(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no,mask:oo};io&&(Xr=eo.coercer(Xr,ao));let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,fo]of eo.entries(Xr,ao)){const ho=run(lo,fo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$2(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$1=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$3(eo,this,to)}create(eo,to){return create(eo,this,to)}is(eo){return is$1(eo,this)}mask(eo,to){return mask(eo,this,to)}validate(eo,to={}){return validate(eo,this,to)}};function assert$3(Xr,eo,to){const ro=validate(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create(Xr,eo,to){const ro=validate(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask(Xr,eo,to){const ro=validate(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$1(Xr,eo){return!validate(Xr,eo)[0]}function validate(Xr,eo,to={}){const ro=run(Xr,eo,to),no=shiftIterator(ro);return no[0]?[new StructError(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define(Xr,eo){return new Struct$1({type:Xr,schema:null,validator:eo})}function any(){return define("any",()=>!0)}function array(Xr){return new Struct$1({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print(eo)}`}})}function boolean(){return define("boolean",Xr=>typeof Xr=="boolean")}function instance(Xr){return define("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print(eo)}`)}function literal(Xr){const eo=print(Xr),to=typeof Xr;return new Struct$1({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print(ro)}`}})}function never(){return define("never",()=>!1)}function nullable(Xr){return new Struct$1({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$1(){return define("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print(Xr)}`)}function optional(Xr){return new Struct$1({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record(Xr,eo){return new Struct$1({type:"record",schema:null,*entries(to){if(isObject$2(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isNonArrayObject(to)||`Expected an object, but received: ${print(to)}`},coercer(to){return isNonArrayObject(to)?{...to}:to}})}function string(){return define("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print(Xr)}`)}function tuple$1(Xr){const eo=never();return new Struct$1({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(to,ro){for(const no of Xr){const[io,oo]=no.validate(to,{coerce:!0,mask:ro.mask});if(!io)return oo}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print(to)}`,...no]}})}function unknown(){return define("unknown",()=>!0)}function coerce(Xr,eo,to){return new Struct$1({...Xr,coercer:(ro,no)=>is$1(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}function isOnCurve(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const toBuffer=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);class Struct{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA,this,eo)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN(to)}else this._bn=new BN(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const eo=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new PublicKey(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve(no))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new PublicKey(eo);return isOnCurve(to.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES=64,publicKey$1=(Xr="publicKey")=>blob(32,Xr),rustString=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized=(Xr="authorized")=>struct([publicKey$1("staker"),publicKey$1("withdrawer")],Xr),lockup=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$1("custodian")],Xr),voteInit=(Xr="voteInit")=>struct([publicKey$1("nodePubkey"),publicKey$1("authorizedVoter"),publicKey$1("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey$1("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey$1("newAuthorized")],Xr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);new PublicKey("SysvarC1ock11111111111111111111111111111111");new PublicKey("SysvarEpochSchedu1e111111111111111111111111");new PublicKey("Sysvar1nstructions1111111111111111111111111");new PublicKey("SysvarRecentB1ockHashes11111111111111111111");new PublicKey("SysvarRent111111111111111111111111111111111");new PublicKey("SysvarRewards111111111111111111111111111111");new PublicKey("SysvarS1otHashes111111111111111111111111111");new PublicKey("SysvarS1otHistory11111111111111111111111111");new PublicKey("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout=nu64("lamportsPerSignature"),NonceAccountLayout=struct([u32$1("version"),u32$1("state"),publicKey$1("authorizedPubkey"),publicKey$1("nonce"),struct([FeeCalculatorLayout],"feeCalculator")]);NonceAccountLayout.span;const encodeDecode=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64=bigInt(8);Object.freeze({Create:{index:0,layout:struct([u32$1("instruction"),ns64("lamports"),ns64("space"),publicKey$1("programId")])},Assign:{index:1,layout:struct([u32$1("instruction"),publicKey$1("programId")])},Transfer:{index:2,layout:struct([u32$1("instruction"),u64("lamports")])},CreateWithSeed:{index:3,layout:struct([u32$1("instruction"),publicKey$1("base"),rustString("seed"),ns64("lamports"),ns64("space"),publicKey$1("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32$1("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32$1("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32$1("instruction"),publicKey$1("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32$1("instruction"),publicKey$1("authorized")])},Allocate:{index:8,layout:struct([u32$1("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32$1("instruction"),publicKey$1("base"),rustString("seed"),ns64("space"),publicKey$1("programId")])},AssignWithSeed:{index:10,layout:struct([u32$1("instruction"),publicKey$1("base"),rustString("seed"),publicKey$1("programId")])},TransferWithSeed:{index:11,layout:struct([u32$1("instruction"),u64("lamports"),rustString("seed"),publicKey$1("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32$1("instruction")])}});new PublicKey("11111111111111111111111111111111");new PublicKey("BPFLoader2111111111111111111111111111111111");struct([u32$1("typeIndex"),u64("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$1(),offset(u8(),-1),"authority")]);const PublicKeyFromString=coerce(instance(PublicKey),string(),Xr=>new PublicKey(Xr)),RawAccountDataResult=tuple$1([string(),literal("base64")]),BufferFromRawAccountData=coerce(instance(Buffer$1$1),RawAccountDataResult,Xr=>Buffer$1$1.from(Xr[0],"base64"));function createRpcResult(Xr){return union([type({jsonrpc:literal("2.0"),id:string(),result:Xr}),type({jsonrpc:literal("2.0"),id:string(),error:type({code:unknown(),message:string(),data:optional(any())})})])}const UnknownRpcResult=createRpcResult(unknown());function jsonRpcResult(Xr){return coerce(createRpcResult(Xr),UnknownRpcResult,eo=>"error"in eo?eo:{...eo,result:create(eo.result,Xr)})}function jsonRpcResultAndContext(Xr){return jsonRpcResult(type({context:type({slot:number$1()}),value:Xr}))}function notificationResultAndContext(Xr){return type({context:type({slot:number$1()}),value:Xr})}const GetInflationGovernorResult=type({foundation:number$1(),foundationTerm:number$1(),initial:number$1(),taper:number$1(),terminal:number$1()});jsonRpcResult(array(nullable(type({epoch:number$1(),effectiveSlot:number$1(),amount:number$1(),postBalance:number$1(),commission:optional(nullable(number$1()))}))));const GetRecentPrioritizationFeesResult=array(type({slot:number$1(),prioritizationFee:number$1()})),GetInflationRateResult=type({total:number$1(),validator:number$1(),foundation:number$1(),epoch:number$1()}),GetEpochInfoResult=type({epoch:number$1(),slotIndex:number$1(),slotsInEpoch:number$1(),absoluteSlot:number$1(),blockHeight:optional(number$1()),transactionCount:optional(number$1())}),GetEpochScheduleResult=type({slotsPerEpoch:number$1(),leaderScheduleSlotOffset:number$1(),warmup:boolean(),firstNormalEpoch:number$1(),firstNormalSlot:number$1()}),GetLeaderScheduleResult=record(string(),array(number$1())),TransactionErrorResult=nullable(union([type({}),string()])),SignatureStatusResult=type({err:TransactionErrorResult}),SignatureReceivedResult=literal("receivedSignature");type({"solana-core":string(),"feature-set":optional(number$1())});const ParsedInstructionStruct=type({program:string(),programId:PublicKeyFromString,parsed:unknown()}),PartiallyDecodedInstructionStruct=type({programId:PublicKeyFromString,accounts:array(PublicKeyFromString),data:string()});jsonRpcResultAndContext(type({err:nullable(union([type({}),string()])),logs:nullable(array(string())),accounts:optional(nullable(array(nullable(type({executable:boolean(),owner:string(),lamports:number$1(),data:array(string()),rentEpoch:optional(number$1())}))))),unitsConsumed:optional(number$1()),returnData:optional(nullable(type({programId:string(),data:tuple$1([string(),literal("base64")])}))),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(union([ParsedInstructionStruct,PartiallyDecodedInstructionStruct]))}))))}));jsonRpcResultAndContext(type({byIdentity:record(string(),array(number$1())),range:type({firstSlot:number$1(),lastSlot:number$1()})}));jsonRpcResult(GetInflationGovernorResult);jsonRpcResult(GetInflationRateResult);jsonRpcResult(GetRecentPrioritizationFeesResult);jsonRpcResult(GetEpochInfoResult);jsonRpcResult(GetEpochScheduleResult);jsonRpcResult(GetLeaderScheduleResult);jsonRpcResult(number$1());jsonRpcResultAndContext(type({total:number$1(),circulating:number$1(),nonCirculating:number$1(),nonCirculatingAccounts:array(PublicKeyFromString)}));const TokenAmountResult=type({amount:string(),uiAmount:nullable(number$1()),decimals:number$1(),uiAmountString:optional(string())});jsonRpcResultAndContext(array(type({address:PublicKeyFromString,amount:string(),uiAmount:nullable(number$1()),decimals:number$1(),uiAmountString:optional(string())})));jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:BufferFromRawAccountData,rentEpoch:number$1()})})));const ParsedAccountDataResult=type({program:string(),parsed:unknown(),space:number$1()});jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:ParsedAccountDataResult,rentEpoch:number$1()})})));jsonRpcResultAndContext(array(type({lamports:number$1(),address:PublicKeyFromString})));const AccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:BufferFromRawAccountData,rentEpoch:number$1()});type({pubkey:PublicKeyFromString,account:AccountInfoResult});const ParsedOrRawAccountData=coerce(union([instance(Buffer$1$1),ParsedAccountDataResult]),union([RawAccountDataResult,ParsedAccountDataResult]),Xr=>Array.isArray(Xr)?create(Xr,BufferFromRawAccountData):Xr),ParsedAccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:ParsedOrRawAccountData,rentEpoch:number$1()});type({pubkey:PublicKeyFromString,account:ParsedAccountInfoResult});type({state:union([literal("active"),literal("inactive"),literal("activating"),literal("deactivating")]),active:number$1(),inactive:number$1()});jsonRpcResult(array(type({signature:string(),slot:number$1(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number$1()))})));jsonRpcResult(array(type({signature:string(),slot:number$1(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number$1()))})));type({subscription:number$1(),result:notificationResultAndContext(AccountInfoResult)});const ProgramAccountInfoResult=type({pubkey:PublicKeyFromString,account:AccountInfoResult});type({subscription:number$1(),result:notificationResultAndContext(ProgramAccountInfoResult)});const SlotInfoResult=type({parent:number$1(),slot:number$1(),root:number$1()});type({subscription:number$1(),result:SlotInfoResult});const SlotUpdateResult=union([type({type:union([literal("firstShredReceived"),literal("completed"),literal("optimisticConfirmation"),literal("root")]),slot:number$1(),timestamp:number$1()}),type({type:literal("createdBank"),parent:number$1(),slot:number$1(),timestamp:number$1()}),type({type:literal("frozen"),slot:number$1(),timestamp:number$1(),stats:type({numTransactionEntries:number$1(),numSuccessfulTransactions:number$1(),numFailedTransactions:number$1(),maxTransactionsPerEntry:number$1()})}),type({type:literal("dead"),slot:number$1(),timestamp:number$1(),err:string()})]);type({subscription:number$1(),result:SlotUpdateResult});type({subscription:number$1(),result:notificationResultAndContext(union([SignatureStatusResult,SignatureReceivedResult]))});type({subscription:number$1(),result:number$1()});type({pubkey:string(),gossip:nullable(string()),tpu:nullable(string()),rpc:nullable(string()),version:nullable(string())});const VoteAccountInfoResult=type({votePubkey:string(),nodePubkey:string(),activatedStake:number$1(),epochVoteAccount:boolean(),epochCredits:array(tuple$1([number$1(),number$1(),number$1()])),commission:number$1(),lastVote:number$1(),rootSlot:nullable(number$1())});jsonRpcResult(type({current:array(VoteAccountInfoResult),delinquent:array(VoteAccountInfoResult)}));const ConfirmationStatus=union([literal("processed"),literal("confirmed"),literal("finalized")]),SignatureStatusResponse=type({slot:number$1(),confirmations:nullable(number$1()),err:TransactionErrorResult,confirmationStatus:optional(ConfirmationStatus)});jsonRpcResultAndContext(array(nullable(SignatureStatusResponse)));jsonRpcResult(number$1());const AddressTableLookupStruct=type({accountKey:PublicKeyFromString,writableIndexes:array(number$1()),readonlyIndexes:array(number$1())}),ConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(string()),header:type({numRequiredSignatures:number$1(),numReadonlySignedAccounts:number$1(),numReadonlyUnsignedAccounts:number$1()}),instructions:array(type({accounts:array(number$1()),data:string(),programIdIndex:number$1()})),recentBlockhash:string(),addressTableLookups:optional(array(AddressTableLookupStruct))})}),AnnotatedAccountKey=type({pubkey:PublicKeyFromString,signer:boolean(),writable:boolean(),source:optional(union([literal("transaction"),literal("lookupTable")]))}),ConfirmedTransactionAccountsModeResult=type({accountKeys:array(AnnotatedAccountKey),signatures:array(string())}),ParsedInstructionResult=type({parsed:unknown(),program:string(),programId:PublicKeyFromString}),RawInstructionResult=type({accounts:array(PublicKeyFromString),data:string(),programId:PublicKeyFromString}),InstructionResult=union([RawInstructionResult,ParsedInstructionResult]),UnknownInstructionResult=union([type({parsed:unknown(),program:string(),programId:string()}),type({accounts:array(string()),data:string(),programId:string()})]),ParsedOrRawInstruction=coerce(InstructionResult,UnknownInstructionResult,Xr=>"accounts"in Xr?create(Xr,RawInstructionResult):create(Xr,ParsedInstructionResult)),ParsedConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(AnnotatedAccountKey),instructions:array(ParsedOrRawInstruction),recentBlockhash:string(),addressTableLookups:optional(nullable(array(AddressTableLookupStruct)))})}),TokenBalanceResult=type({accountIndex:number$1(),mint:string(),owner:optional(string()),uiTokenAmount:TokenAmountResult}),LoadedAddressesResult=type({writable:array(PublicKeyFromString),readonly:array(PublicKeyFromString)}),ConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number$1(),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(type({accounts:array(number$1()),data:string(),programIdIndex:number$1()}))})))),preBalances:array(number$1()),postBalances:array(number$1()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number$1())}),ParsedConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number$1(),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(ParsedOrRawInstruction)})))),preBalances:array(number$1()),postBalances:array(number$1()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number$1())}),TransactionVersionStruct=union([literal(0),literal("legacy")]),RewardsResult=type({pubkey:string(),lamports:number$1(),postBalance:nullable(number$1()),rewardType:nullable(string()),commission:optional(nullable(number$1()))});jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),signatures:array(string()),blockTime:nullable(number$1())})));jsonRpcResult(nullable(type({slot:number$1(),meta:nullable(ConfirmedTransactionMetaResult),blockTime:optional(nullable(number$1())),transaction:ConfirmedTransactionResult,version:optional(TransactionVersionStruct)})));jsonRpcResult(nullable(type({slot:number$1(),transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),blockTime:optional(nullable(number$1())),version:optional(TransactionVersionStruct)})));jsonRpcResultAndContext(type({blockhash:string(),feeCalculator:type({lamportsPerSignature:number$1()})}));jsonRpcResultAndContext(type({blockhash:string(),lastValidBlockHeight:number$1()}));jsonRpcResultAndContext(boolean());const PerfSampleResult=type({slot:number$1(),numTransactions:number$1(),numSlots:number$1(),samplePeriodSecs:number$1()});jsonRpcResult(array(PerfSampleResult));jsonRpcResultAndContext(nullable(type({feeCalculator:type({lamportsPerSignature:number$1()})})));jsonRpcResult(string());jsonRpcResult(string());const LogsResult=type({err:TransactionErrorResult,logs:array(string()),signature:string()});type({result:notificationResultAndContext(LogsResult),subscription:number$1()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64(),seq(publicKey$1(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64("microLamports")])}});new PublicKey("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey("KeccakSecp256k11111111111111111111111111111");var _Lockup;new PublicKey("StakeConfig11111111111111111111111111111111");class Lockup{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}}_Lockup=Lockup;Lockup.default=new _Lockup(0,0,PublicKey.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized(),lockup()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$1("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey$1("newAuthorized"),u32$1("stakeAuthorizationType"),rustString("authoritySeed"),publicKey$1("authorityOwner")])}});new PublicKey("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$1("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs()])}});new PublicKey("Vote111111111111111111111111111111111111111");new PublicKey("Va1idator1nfo111111111111111111111111111111");type({name:string(),website:optional(string()),details:optional(string()),iconUrl:optional(string()),keybaseUsername:optional(string())});new PublicKey("Vote111111111111111111111111111111111111111");struct([publicKey$1("nodePubkey"),publicKey$1("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$1("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey$1("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const publicKey=Xr=>{const eo=blob(32,Xr),{encode:to,decode:ro}=encodeDecode$1(eo),no=eo;return no.decode=(io,oo)=>{const ao=ro(io,oo);return new PublicKey(ao)},no.encode=(io,oo,ao)=>{const so=io.toBuffer();return to(so,oo,ao)},no};class TokenError extends Error{constructor(eo){super(eo)}}class TokenOwnerOffCurveError extends TokenError{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var TokenInstruction;(function(Xr){Xr[Xr.InitializeMint=0]="InitializeMint",Xr[Xr.InitializeAccount=1]="InitializeAccount",Xr[Xr.InitializeMultisig=2]="InitializeMultisig",Xr[Xr.Transfer=3]="Transfer",Xr[Xr.Approve=4]="Approve",Xr[Xr.Revoke=5]="Revoke",Xr[Xr.SetAuthority=6]="SetAuthority",Xr[Xr.MintTo=7]="MintTo",Xr[Xr.Burn=8]="Burn",Xr[Xr.CloseAccount=9]="CloseAccount",Xr[Xr.FreezeAccount=10]="FreezeAccount",Xr[Xr.ThawAccount=11]="ThawAccount",Xr[Xr.TransferChecked=12]="TransferChecked",Xr[Xr.ApproveChecked=13]="ApproveChecked",Xr[Xr.MintToChecked=14]="MintToChecked",Xr[Xr.BurnChecked=15]="BurnChecked",Xr[Xr.InitializeAccount2=16]="InitializeAccount2",Xr[Xr.SyncNative=17]="SyncNative",Xr[Xr.InitializeAccount3=18]="InitializeAccount3",Xr[Xr.InitializeMultisig2=19]="InitializeMultisig2",Xr[Xr.InitializeMint2=20]="InitializeMint2",Xr[Xr.GetAccountDataSize=21]="GetAccountDataSize",Xr[Xr.InitializeImmutableOwner=22]="InitializeImmutableOwner",Xr[Xr.AmountToUiAmount=23]="AmountToUiAmount",Xr[Xr.UiAmountToAmount=24]="UiAmountToAmount",Xr[Xr.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Xr[Xr.TransferFeeExtension=26]="TransferFeeExtension",Xr[Xr.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",Xr[Xr.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",Xr[Xr.Reallocate=29]="Reallocate",Xr[Xr.MemoTransferExtension=30]="MemoTransferExtension",Xr[Xr.CreateNativeMint=31]="CreateNativeMint",Xr[Xr.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",Xr[Xr.InterestBearingMintExtension=33]="InterestBearingMintExtension",Xr[Xr.CpiGuardExtension=34]="CpiGuardExtension",Xr[Xr.InitializePermanentDelegate=35]="InitializePermanentDelegate",Xr[Xr.TransferHookExtension=36]="TransferHookExtension",Xr[Xr.MetadataPointerExtension=39]="MetadataPointerExtension",Xr[Xr.GroupPointerExtension=40]="GroupPointerExtension",Xr[Xr.GroupMemberPointerExtension=41]="GroupMemberPointerExtension"})(TokenInstruction||(TokenInstruction={}));function addSigners(Xr,eo,to){if(to.length){Xr.push({pubkey:eo,isSigner:!1,isWritable:!1});for(const ro of to)Xr.push({pubkey:ro instanceof PublicKey$2?ro:ro.publicKey,isSigner:!0,isWritable:!1})}else Xr.push({pubkey:eo,isSigner:!0,isWritable:!1});return Xr}const MintLayout=struct([u32$1("mintAuthorityOption"),publicKey("mintAuthority"),u64$1("supply"),u8("decimals"),bool("isInitialized"),u32$1("freezeAuthorityOption"),publicKey("freezeAuthority")]);MintLayout.span;async function getAssociatedTokenAddress(Xr,eo,to=!1,ro=TOKEN_PROGRAM_ID,no=ASSOCIATED_TOKEN_PROGRAM_ID){if(!to&&!PublicKey$2.isOnCurve(eo.toBuffer()))throw new TokenOwnerOffCurveError;const[io]=await PublicKey$2.findProgramAddress([eo.toBuffer(),ro.toBuffer(),Xr.toBuffer()],no);return io}function createAssociatedTokenAccountInstruction(Xr,eo,to,ro,no=TOKEN_PROGRAM_ID,io=ASSOCIATED_TOKEN_PROGRAM_ID){return buildAssociatedTokenAccountInstruction(Xr,eo,to,ro,Buffer$3.alloc(0),no,io)}function buildAssociatedTokenAccountInstruction(Xr,eo,to,ro,no,io=TOKEN_PROGRAM_ID,oo=ASSOCIATED_TOKEN_PROGRAM_ID){const ao=[{pubkey:Xr,isSigner:!0,isWritable:!0},{pubkey:eo,isSigner:!1,isWritable:!0},{pubkey:to,isSigner:!1,isWritable:!1},{pubkey:ro,isSigner:!1,isWritable:!1},{pubkey:SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:io,isSigner:!1,isWritable:!1}];return new TransactionInstruction({keys:ao,programId:oo,data:no})}const transferInstructionData=struct([u8("instruction"),u64$1("amount")]);function createTransferInstruction(Xr,eo,to,ro,no=[],io=TOKEN_PROGRAM_ID){const oo=addSigners([{pubkey:Xr,isSigner:!1,isWritable:!0},{pubkey:eo,isSigner:!1,isWritable:!0}],to,no),ao=Buffer$3.alloc(transferInstructionData.span);return transferInstructionData.encode({instruction:TokenInstruction.Transfer,amount:BigInt(ro)},ao),new TransactionInstruction({keys:oo,programId:io,data:ao})}function decodeTransferInstructionUnchecked({programId:Xr,keys:[eo,to,ro,...no],data:io}){return{programId:Xr,keys:{source:eo,destination:to,owner:ro,multiSigners:no},data:transferInstructionData.decode(io)}}const LAMPORTS_PER_SOL$1=1e9;let SolanaUiTransaction$1=class{constructor({onSubmit:eo,from:to,connection:ro,originalTransaction:no}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.feeDeducted=!1,this.formatNonNativeToken=(io,oo)=>(Number(io)/Number(Math.pow(10,oo))).toString(),this.from=to,this.onSubmit=eo,this.connection=ro,this.originalTransaction=no}parse(eo){const to=parseFloat(eo),ro=Math.round(to*LAMPORTS_PER_SOL$1);return BigInt(ro)}parseNonNativeToken(eo,to){return BigInt(Math.floor(Number(eo)*Math.pow(10,to)))}format(eo,{precision:to}={}){const no=(Number(eo)/LAMPORTS_PER_SOL$1).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(no,{precision:to})}submit(){return __awaiter$3(this,void 0,void 0,function*(){const eo=yield this.createTransaction();return this.onSubmit(eo)})}getBalance(){return __awaiter$3(this,void 0,void 0,function*(){const eo=new PublicKey$2(this.from),to=yield this.connection.getBalance(eo);return BigInt(to)})}validateAddressFormat(eo){return eo==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(eo)}fetchFee(){return __awaiter$3(this,void 0,void 0,function*(){if(this.fee.gas)return;const eo=yield this.createTransactionSafe();if(!eo)return;let to;if("version"in eo?to=eo.message:to=eo.compileMessage(),!to)throw new Error("Invalid transaction");let ro=yield this.connection.getFeeForMessage(to),no=0;for(;ro.value===null&&no<5;)ro=yield this.connection.getFeeForMessage(to),no++;this.fee.gas=ro.value?BigInt(ro.value):void 0,!this.feeDeducted&&this.fee.gas&&this.value&&(this.value=this.value-this.fee.gas,this.feeDeducted=!0)})}createTransaction(){return __awaiter$3(this,void 0,void 0,function*(){var eo;const{value:to,to:ro,nonNativeAddress:no,nonNativeValue:io}=this;if(!ro)throw new Error("Destination is required");if(this.originalTransaction)return this.originalTransaction;const oo=new Transaction,ao=new PublicKey$2(this.from),so=new PublicKey$2(ro);if(no&&io){const lo=new PublicKey$2(no),fo=io,ho=(eo=(yield this.connection.getTokenAccountsByOwner(ao,{mint:lo})).value[0])===null||eo===void 0?void 0:eo.pubkey;if(!ho)throw new Error("Source token account not found");let go;try{go=yield getAssociatedTokenAddress(lo,so),yield this.connection.getTokenAccountBalance(go)}catch{go=yield getAssociatedTokenAddress(lo,so),oo.add(createAssociatedTokenAccountInstruction(ao,go,so,lo))}oo.add(createTransferInstruction(ho,go,ao,fo))}else{const lo=to??BigInt(0);oo.add(SystemProgram.transfer({fromPubkey:ao,lamports:lo,toPubkey:so}))}const{blockhash:co}=yield this.connection.getLatestBlockhash();return oo.feePayer=new PublicKey$2(this.from),oo.recentBlockhash=co,oo})}createTransactionSafe(){return __awaiter$3(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}};assertPackageVersion("@dynamic-labs/solana-core",version$4);const createSolanaConnection=(Xr,eo)=>{if(!Xr)throw new Error("rpcUrl is required");return new Connection(Xr,eo)},getTotalSolanaSpend=(Xr,eo,to)=>__awaiter$5(void 0,void 0,void 0,function*(){var ro,no,io,oo,ao,so,co,lo,fo,ho;let go,yo;"version"in Xr?([yo]=Xr.message.staticAccountKeys,go=yield eo.simulateTransaction(Xr,{accounts:{addresses:yo.toBase58()&&yo.toBase58()!==to?[yo.toBase58(),to]:[to],encoding:"base64"},replaceRecentBlockhash:!0})):(yo=Xr.feePayer||Xr.instructions[0].keys[0].pubkey,go=yield eo.simulateTransaction(Xr,void 0,yo.toBase58()&&yo.toBase58()!==to?[yo,new PublicKey$2(to)]:[new PublicKey$2(to)]));const vo=yield eo.getBalance(new PublicKey$2(to));if(!(!((io=(no=(ro=go==null?void 0:go.value)===null||ro===void 0?void 0:ro.accounts)===null||no===void 0?void 0:no[0])===null||io===void 0)&&io.lamports)){logger$3.debug("Transaction simulation failed",go);const Eo=JSON.stringify({InstructionError:[0,{Custom:1}]}),ko=JSON.stringify({InsufficientFundsForRent:{account_index:0}});if(JSON.stringify(go==null?void 0:go.value.err)===Eo||JSON.stringify(go==null?void 0:go.value.err)===ko)throw new Error("Insufficient funds");return}const wo=vo-((co=(so=(ao=(oo=go==null?void 0:go.value)===null||oo===void 0?void 0:oo.accounts)===null||ao===void 0?void 0:ao[1])===null||so===void 0?void 0:so.lamports)!==null&&co!==void 0?co:(ho=(fo=(lo=go==null?void 0:go.value)===null||lo===void 0?void 0:lo.accounts)===null||fo===void 0?void 0:fo[0])===null||ho===void 0?void 0:ho.lamports);return BigInt(wo)}),decodeTransaction=(Xr,eo,to)=>__awaiter$5(void 0,void 0,void 0,function*(){var ro;if(!Xr)throw new DynamicError("Transaction is required");try{let no=[];if("version"in Xr){const so=Xr.message.addressTableLookups.map(co=>new PublicKey$2(co.accountKey));if(so.length>0){const lo=(yield Promise.all(so.map(fo=>eo.getAddressLookupTable(fo)))).filter(fo=>fo!==null).map(fo=>fo.value);lo.length>0&&(no=TransactionMessage.decompile(Xr.message,{addressLookupTableAccounts:lo}).instructions)}else no=TransactionMessage.decompile(Xr.message).instructions}else Xr.instructions?no=Xr.instructions:no=(ro=Transaction.from(Buffer$3.from(Xr.serialize())))===null||ro===void 0?void 0:ro.instructions;if(!(no!=null&&no.length))throw new DynamicError("Bad formatted instruction");const io=no.filter(so=>so.programId.equals(SystemProgram.programId));if(io.length>0)return io.map(so=>{let co;try{co=SystemInstruction.decodeTransfer(so)}catch{return{from:to,to:"Unknown"}}return{from:co==null?void 0:co.fromPubkey.toBase58(),to:co==null?void 0:co.toPubkey.toBase58()}});let oo=yield Promise.all(no.map(so=>__awaiter$5(void 0,void 0,void 0,function*(){var co,lo,fo,ho,go,yo,vo;if(so.programId.equals(TOKEN_PROGRAM_ID)){const wo=decodeTransferInstructionUnchecked(so),{source:Eo,destination:ko}=wo.keys;if(ko){if((ko==null?void 0:ko.pubkey.toBase58())===to)return{from:to,to:Eo==null?void 0:Eo.pubkey.toBase58()};const Ao=yield eo.getParsedAccountInfo(ko.pubkey),jo=((fo=(lo=(co=Ao.value)===null||co===void 0?void 0:co.data)===null||lo===void 0?void 0:lo.parsed)===null||fo===void 0?void 0:fo.type)==="account"?(vo=(yo=(go=(ho=Ao.value)===null||ho===void 0?void 0:ho.data)===null||go===void 0?void 0:go.parsed)===null||yo===void 0?void 0:yo.info)===null||vo===void 0?void 0:vo.owner:null,Mo=jo||(ko==null?void 0:ko.pubkey.toBase58());return{from:to,to:Mo}}}return null})));if(oo=oo.filter(so=>so!==null),oo!=null&&oo.length)return oo;const ao=no.map(so=>({from:to,to:so.programId.toBase58()}));return ao.length?ao:[{from:to,to:"Unknown"}]}catch(no){return logger$3.warn("[decodeTransaction]",no),[{from:to,to:"Unknown"}]}}),summarizeTransactionDecodedData=Xr=>{const eo=new Set;return Xr.forEach(ro=>{ro&&ro.to&&eo.add(ro.to)}),eo.size===1?eo.values().next().value:"Multiple"},logger$2=new Logger$2("DynamicSDK"),AUTH_MIN_TOKEN="dynamic_min_authentication_token",AUTH_MIN_TOKEN_DEMO="dynamic_min_authentication_token_demo",isCookieEnabled=()=>{var Xr,eo,to,ro;let no=(Xr=StorageService.getItem("dynamic_store"))!==null&&Xr!==void 0?Xr:StorageService.getItem("dynamic_store_demo");if(no=(eo=no==null?void 0:no.settings)===null||eo===void 0?void 0:eo.security,!no)return!1;const io=(((to=no.auth)===null||to===void 0?void 0:to.storage)||[]).includes(AuthStorageEnum.Cookie),oo=!!(!((ro=no.externalAuth)===null||ro===void 0)&&ro.cookieName);return io||oo},parseToken=Xr=>{var eo;if(!Xr)return;const to=(eo=Xr.split(".")[1])===null||eo===void 0?void 0:eo.replace(/-/g,"+").replace(/_/g,"/"),ro=to&&decodeURIComponent(atob(to).split("").map(no=>`%${`00${no.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(ro)},decodeMinJwt=Xr=>{try{const eo=parseToken(Xr);return eo?MinifiedDynamicJwtFromJSON(eo):void 0}catch(eo){logger$2.error(eo);return}},getMinAuthToken=()=>{var Xr;if(typeof window>"u")return;const eo=(Xr=StorageService.getItem(AUTH_MIN_TOKEN,{priority:["secureStorage","localStorage"]}))!==null&&Xr!==void 0?Xr:StorageService.getItem(AUTH_MIN_TOKEN_DEMO,{priority:["secureStorage","localStorage"]});if(!(!eo||isMinAuthTokenExpired(eo)))return eo},isMinAuthTokenExpired=Xr=>{const eo=decodeMinJwt(Xr);return isTokenExpired(eo)},isTokenExpired=Xr=>{if(!Xr||!Xr.exp)return!0;const eo=new Date(Xr.exp*1e3).getTime();return new Date().getTime()>=eo};class ApiEndpoint{}ApiEndpoint.getBaseUrl=()=>{if(!ApiEndpoint.__defined__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint.__baseUrl__};ApiEndpoint.setBaseUrl=Xr=>{if(!ApiEndpoint.__defined__)Xr?ApiEndpoint.__baseUrl__=Xr:ApiEndpoint.__baseUrl__=new Configuration().basePath,ApiEndpoint.__defined__=!0;else{if(!Xr&&ApiEndpoint.__defined__)return;if(ApiEndpoint.__baseUrl__!==Xr)throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${Xr}`)}Object.freeze(ApiEndpoint)};const VERSION=version$9,API_VERSION$1=dependencies["@dynamic-labs/sdk-api-core"];var define_process_env_default$1={};const sdkApi=()=>{const Xr=define_process_env_default$1.API_BASE_URL||define_process_env_default$1.NX_API_BASE_URL||"https://app.dynamic.xyz/api/v0";ApiEndpoint.setBaseUrl(Xr);const eo={basePath:ApiEndpoint.getBaseUrl(),headers:{"Content-Type":"application/json"}},to=getMinAuthToken();to&&(eo.headers.Authorization=`Bearer ${to}`);const ro=isCookieEnabled()?"include":void 0;return eo.headers["x-dyn-version"]=`WalletKit/${VERSION}`,eo.headers["x-dyn-api-version"]=`API/${API_VERSION$1}`,new SDKApi(new Configuration(Object.assign(Object.assign({},eo),{credentials:ro,fetchApi:FetchService.fetch})))},serializeTransaction=Xr=>Xr instanceof VersionedTransaction?Buffer$3.from(Xr.serialize()).toString("base64"):Buffer$3.from(Xr.serialize({verifySignatures:!1})).toString("base64"),deserializeTransaction=Xr=>{const eo=Buffer$3.from(Xr,"base64");return VersionedTransaction.deserialize(eo)},optimizeSolanaTransaction=(Xr,eo,to)=>__awaiter$5(void 0,void 0,void 0,function*(){const ro=serializeTransaction(eo),no={environmentId:Xr,solanaTransactionOptimizationRequest:{address:to,transaction:ro}},io=yield sdkApi().optimizeTransaction(no);return deserializeTransaction(io.transaction)});class TurnkeySolanaSigner{constructor({walletConnector:eo}){this.isConnected=!0,this.providers=[this],this.walletConnector=eo,this.turnkeyAddress=this.walletConnector.turnkeyAddress,this.publicKey=this.turnkeyAddress?new PublicKey$2(this.turnkeyAddress):void 0}signMessage(eo){return __awaiter$5(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signUint8ArrayMessage(eo)}})}signTransaction(eo){return __awaiter$5(this,void 0,void 0,function*(){return this.walletConnector.signTransaction(eo)})}signAllTransactions(eo){return __awaiter$5(this,void 0,void 0,function*(){return this.walletConnector.signAllTransactions(eo)})}signAndSendTransaction(eo,to){return __awaiter$5(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signAndSendTransaction(eo,to)}})}connect(eo){return __awaiter$5(this,void 0,void 0,function*(){return{address:this.turnkeyAddress,publicKey:this.publicKey}})}disconnect(){return __awaiter$5(this,void 0,void 0,function*(){})}}class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase{constructor(eo,to){var ro;super(eo,to),this.ChainWallet=SolanaWallet$1,this.connectedChain="SOL",this.supportedChains=["SOL"],this.verifiedCredentialChain="solana",this.getEnvId=()=>{const no=localStorage.getItem("dynamic_nonce");if(no){const oo=JSON.parse(no);if(oo&&oo.environmentId)return oo.environmentId}const io=localStorage.getItem("dynamic_nonce_demo");if(io){const oo=JSON.parse(io);if(oo&&oo.environmentId)return oo.environmentId}throw new Error("Failed to get environment id")},this.stampCreateWalletAccountRequest=no=>__awaiter$5(this,[no],void 0,function*({request:io}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(io)}),this.solNetworks=to.solNetworks,this.walletUiUtils=to.walletUiUtils,this._turnkeyAccount=void 0,this._connectionClient=void 0,this.chainRpcProviders=to.chainRpcProviders,(ro=this.chainRpcProviders)===null||ro===void 0||ro.registerSolanaProviders(),this.__turnkeyClient=this.getTurnkeyClient()}getRpcUrl(){var eo;const[to]=this.solNetworks;if(!to)throw new DynamicError("No enabled networks");return((eo=to.privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])||to.rpcUrls[0]}getConnection(eo){if(!this._connectionClient){const to=this.getRpcUrl();if(!to)throw new DynamicError("No rpcUrl");this._connectionClient=createSolanaConnection(to,eo)}return this._connectionClient}getWalletClient(){return this.getConnection()}getNetwork(){return __awaiter$5(this,void 0,void 0,function*(){const eo=this.getConnection();let to=localStorage.getItem(getGenesisHashLSKey$1(eo.rpcEndpoint));return to||(to=yield eo.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey$1(eo.rpcEndpoint),to)),to=to.substring(0,32),to==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?"mainnet":to==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?"devnet":"testnet"})}getPublicClient(){return __awaiter$5(this,void 0,void 0,function*(){var eo;if(this.solNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const ro=this.chainRpcProviders.getProviders(to);return(eo=this.chainRpcProviders.getSolanaProviderByChainId(ro,"101"))===null||eo===void 0?void 0:eo.provider})}supportsNetworkSwitching(){return!1}setVerifiedCredentials(eo){const to=findTurnkeyVerifiedCredentials(eo,ProviderChain.SOLANA),[ro]=to;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(to)&&(this.verifiedCredential=ro,this.verifiedCredentials=to,this.refreshTurnkeyAccount())}validateActiveWallet(eo){return __awaiter$5(this,void 0,void 0,function*(){var to,ro;const no=((to=this.verifiedCredential)===null||to===void 0?void 0:to.address)||"";if(!isSameAddress(no,eo,this.connectedChain)){const oo=(ro=this.verifiedCredentials)===null||ro===void 0?void 0:ro.find(ao=>(ao==null?void 0:ao.address)===eo);if(!oo)throw new DynamicError("Account not found");this.verifiedCredential=oo,this.refreshTurnkeyAccount()}})}getAccount(){return this.turnkeyAddress}endSession(){return __awaiter$5(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey$1(this.getRpcUrl()))})}refreshTurnkeyAccount(){return __awaiter$5(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyClient(){var eo;let to=getTLD();to||(to=PlatformService.getHostname());const ro=PasskeyService.createWebauthnStamper({rpId:to}),no=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,io=no??ro;return this.__turnkeyClient=(eo=this.getAuthenticatorHandler().client)!==null&&eo!==void 0?eo:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},io),this.__turnkeyClient}createTurnkeyAccount(eo){return __awaiter$5(this,arguments,void 0,function*({organizationId:to}){const ro=this.getTurnkeyClient();return new TurnkeySigner({client:ro,organizationId:to})})}getTurnkeyAccount(){return __awaiter$5(this,void 0,void 0,function*(){var eo,to,ro,no;if(this._turnkeyAccount&&(this.getAuthenticatorHandler().recoveryType==="passkey"&&((eo=this.__turnkeyClient)===null||eo===void 0?void 0:eo.stamper)instanceof WebauthnStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((to=this.__turnkeyClient)===null||to===void 0?void 0:to.stamper)instanceof IframeStamper)&&this.__turnkeyClient===this.getAuthenticatorHandler().client)return this._turnkeyAccount;const{turnkeySubOrganizationId:io}=(ro=this.walletProperties)!==null&&ro!==void 0?ro:{},{address:oo}=(no=this.verifiedCredential)!==null&&no!==void 0?no:{};if(!(!io||!oo))return this._turnkeyAccount=yield this.createTurnkeyAccount({organizationId:io}),this.setLoggerMetadata(),this._turnkeyAccount})}getSigner(){return __awaiter$5(this,void 0,void 0,function*(){return new TurnkeySolanaSigner({walletConnector:this})})}getBalance(eo){return __awaiter$5(this,void 0,void 0,function*(){const to=this.getConnection(),ro=new PublicKey$2(eo),no=yield to.getBalance(ro);return this.lamportsToSol(no).toString()})}signUint8ArrayMessage(eo){return __awaiter$5(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const to=this.turnkeyAddress;let ro;if(yield this.createOrRestoreSession(),yield this.walletUiUtils.signMessage({handler:()=>__awaiter$5(this,void 0,void 0,function*(){let no=yield this.getTurnkeyAccount();try{ro=yield no==null?void 0:no.signMessage(eo,to)}catch{yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),no=yield this.getTurnkeyAccount(),ro=yield no==null?void 0:no.signMessage(eo,to)}return bufferToBase64(ro||Buffer$3.from([]))}),message:new TextDecoder().decode(eo)}),!ro)throw new Error("Failed to sign message");return ro})}signMessage(eo){return __awaiter$5(this,void 0,void 0,function*(){const ro=new TextEncoder().encode(eo),no=yield this.signUint8ArrayMessage(ro);return bufferToBase64(no)})}signTransaction(eo){return __awaiter$5(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let to=yield this.getTurnkeyAccount();const ro=this.turnkeyAddress;if(!to||!ro)throw new Error("No turnkey account");try{yield to.addSignature(eo,ro)}catch(no){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(io=>no.message.includes(io)))yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),to=yield this.getTurnkeyAccount(),yield to.addSignature(eo,ro);else throw logger$6.error("[TK] failed to perform SignTransaction activity",no),no}return eo})}signAllTransactions(eo){return __awaiter$5(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let to=yield this.getTurnkeyAccount();const ro=this.turnkeyAddress;if(!to||!ro)throw new Error("No turnkey account");try{return yield to.signAllTransactions(eo,ro)}catch(no){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(io=>no.message.includes(io)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),to=yield this.getTurnkeyAccount(),yield to.signAllTransactions(eo,ro);throw logger$6.error("[TK] failed to perform SignAllTransactions activity",no),no}})}internalSignAndSendTransaction(eo,to){return __awaiter$5(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const ro=this.getConnection("confirmed"),no=yield this.signTransaction(eo),io=yield ro.sendRawTransaction(no.serialize(),to);return new Promise((oo,ao)=>{const so=setTimeout(()=>{ao(new DynamicError("Transaction timed out"))},6e4);ro.onSignature(io,co=>{clearTimeout(so),co.err?ao(new DynamicError("Transaction failed")):oo(io)},"confirmed")})})}signAndSendTransaction(eo,to){return __awaiter$5(this,void 0,void 0,function*(){var ro;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");let no=eo,io=!1;"version"in eo?io=eo.signatures.some(fo=>!fo.every(ho=>ho===0)):io=eo.signatures.some(fo=>fo.signature);try{(yield this.getNetwork())==="mainnet"&&!io&&(no=yield optimizeSolanaTransaction(this.getEnvId(),eo,(ro=this.turnkeyAddress)!==null&&ro!==void 0?ro:""))}catch(fo){logger$6.warn("Failed to optimize transaction",fo)}const oo=yield decodeTransaction(no,this.getConnection(),this.turnkeyAddress);if(!(oo!=null&&oo.length))throw new DynamicError("Incorrectly formatted transaction instructions");let ao,so=!1;try{ao=yield getTotalSolanaSpend(no,this.getConnection(),this.turnkeyAddress)}catch(fo){fo.message==="Insufficient funds"&&(so=!0)}const co=summarizeTransactionDecodedData(oo),lo=new SolanaUiTransaction$1({connection:this.getConnection(),from:this.turnkeyAddress,onSubmit:()=>__awaiter$5(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(no,to)}),originalTransaction:no});return lo.to=co,lo.value=ao,so&&(lo.notEnoughFundsError=!0),this.walletUiUtils.sendTransaction(this,lo)})}sendTransaction(eo,to){return __awaiter$5(this,arguments,void 0,function*(ro,no,io={}){var oo;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");if(!ro||!no)throw new DynamicError("Transaction and connection are required");const{signers:ao}=io,so=__rest$1(io,["signers"]),co=yield no.getLatestBlockhash({commitment:io.preflightCommitment,minContextSlot:io.minContextSlot});"version"in ro?ao!=null&&ao.length&&ro.sign(ao):(ro.feePayer=ro.feePayer||new PublicKey$2(this.turnkeyAddress),ro.recentBlockhash=ro.recentBlockhash||co.blockhash,ao!=null&&ao.length&&ro.partialSign(...ao)),so.preflightCommitment=so.preflightCommitment||no.commitment;const lo=yield no.sendRawTransaction(ro.serialize(),io),fo={blockhash:co.blockhash,lastValidBlockHeight:co.lastValidBlockHeight,signature:lo},ho=yield no==null?void 0:no.confirmTransaction(fo);return!((oo=ho==null?void 0:ho.value)===null||oo===void 0)&&oo.err?JSON.stringify(ho.value.err):lo})}lamportsToSol(eo){return eo/LAMPORTS_PER_SOL$2}createUiTransaction(eo){return __awaiter$5(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=new SolanaUiTransaction$1({connection:this.getConnection(),from:eo,onSubmit:ro=>__awaiter$5(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(ro)})});return to.feeDeducted=!0,to})}}const TurnkeySolanaWalletConnectors=Xr=>{var eo;return!((eo=Xr.apiProviders)===null||eo===void 0)&&eo.turnkey?[TurnkeySolanaWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-solana",version$9);var version$3="3.4.4";function __awaiter$2(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var version$2="3.4.4";function __awaiter$1(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class SolanaWallet extends Wallet$1{getConnection(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$1(this,void 0,void 0,function*(){const eo=yield this._connector.getSigner();if(!eo)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(eo,{signAllTransactions:to=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),eo.signAllTransactions(to)}),signAndSendTransaction:(to,...ro)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),eo.signAndSendTransaction(to,...ro)}),signMessage:(to,...ro)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),eo.signMessage(to,...ro)}),signTransaction:to=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),eo.signTransaction(to)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}}const extractNonce=Xr=>{const eo=Xr.match(/Nonce: (.*)/);if(eo&&eo.length===2)return eo[1]},SOLANA_GENESIS_HASH="genesis-hash",getGenesisHashLSKey=Xr=>`${Xr}_${SOLANA_GENESIS_HASH}`,MEMO_PROGRAM_ID=new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");class SolWalletConnector extends WalletConnectorBase{constructor(eo){var to;super(eo),this.isHardwareWalletEnabled=!1,this.verifiedCredentials=[],this.ChainWallet=SolanaWallet,this.supportedChains=["SOL"],this.connectedChain="SOL",this.solNetworks=eo.solNetworks,this.chainRpcProviders=eo.chainRpcProviders,(to=this.chainRpcProviders)===null||to===void 0||to.registerSolanaProviders()}getNetwork(){return __awaiter$1(this,void 0,void 0,function*(){const eo=this.getWalletClient();let to=localStorage.getItem(getGenesisHashLSKey(eo.rpcEndpoint));to||(to=yield eo.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey(eo.rpcEndpoint),to)),to=to.substring(0,32);let ro;return to==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?ro="mainnet":to==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?ro="devnet":ro="testnet",ro})}endSession(){return __awaiter$1(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey(this.getWalletClient().rpcEndpoint))})}getWalletClient(){var eo;const[to]=this.solNetworks;if(!to)throw new DynamicError("No enabled networks");const ro=((eo=to.privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])||to.rpcUrls[0];return new Connection(ro,"confirmed")}getPublicClient(){return __awaiter$1(this,void 0,void 0,function*(){var eo;if(this.solNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const ro=this.chainRpcProviders.getProviders(to);return(eo=this.chainRpcProviders.getSolanaProviderByChainId(ro,"101"))===null||eo===void 0?void 0:eo.provider})}getBalance(eo){return __awaiter$1(this,void 0,void 0,function*(){const to=new PublicKey$2(eo);return this.lamportsToSol(yield this.getWalletClient().getBalance(to)).toString()})}lamportsToSol(eo){return eo/1e9}canConnectWithHardwareWallet(){const eo=findWalletBookWallet(this.walletBook,this.key);return!eo||!eo.hardwareWallets?!1:eo.hardwareWallets.includes("ledger")}signMessage(eo){const to=Object.create(null,{signMessage:{get:()=>super.signMessage}});return __awaiter$1(this,void 0,void 0,function*(){if(this.isHardwareWalletEnabled)throw new NotSupportedError(`Message signing is currently not supported on ${this.name} hardware wallet. +${JSON.stringify(no.slice(-10),null,2)}. `:"")+"\nCatch the SendTransactionError and call `getLogs()` on it for full details.";break;default:io="Unknown action"}super(io),this.signature=void 0,this.transactionMessage=void 0,this.logs=void 0,this.signature=to,this.transactionMessage=ro,this.logs=no||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.logs)?this.logs:void 0}}async getLogs(eo){return Array.isArray(this.logs)||(this.logs=new Promise((to,ro)=>{eo.getTransaction(this.signature).then(no=>{if(no&&no.meta&&no.meta.logMessages){const io=no.meta.logMessages;this.logs=io,to(io)}else ro(new Error("Log messages not found"))}).catch(ro)})),await this.logs}}class SolanaJSONRPCError extends Error{constructor({code:eo,message:to,data:ro},no){super(no!=null?`${no}: ${to}`:to),this.code=void 0,this.data=void 0,this.code=eo,this.data=ro,this.name="SolanaJSONRPCError"}}function sleep(Xr){return new Promise(eo=>setTimeout(eo,Xr))}function encodeData$1(Xr,eo){const to=Xr.layout.span>=0?Xr.layout.span:getAlloc(Xr,eo),ro=Buffer$1$1.alloc(to),no=Object.assign({instruction:Xr.index},eo);return Xr.layout.encode(no,ro),ro}function decodeData$1(Xr,eo){let to;try{to=Xr.layout.decode(eo)}catch(ro){throw new Error("invalid instruction; "+ro)}if(to.instruction!==Xr.index)throw new Error(`invalid instruction; instruction index mismatch ${to.instruction} != ${Xr.index}`);return to}const FeeCalculatorLayout$2=nu64("lamportsPerSignature"),NonceAccountLayout$2=struct([u32$1("version"),u32$1("state"),publicKey$3("authorizedPubkey"),publicKey$3("nonce"),struct([FeeCalculatorLayout$2],"feeCalculator")]),NONCE_ACCOUNT_LENGTH=NonceAccountLayout$2.span;class NonceAccount{constructor(eo){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=eo.authorizedPubkey,this.nonce=eo.nonce,this.feeCalculator=eo.feeCalculator}static fromAccountData(eo){const to=NonceAccountLayout$2.decode(toBuffer$2(eo),0);return new NonceAccount({authorizedPubkey:new PublicKey$2(to.authorizedPubkey),nonce:new PublicKey$2(to.nonce).toString(),feeCalculator:to.feeCalculator})}}const encodeDecode$3=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$3=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$3(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$3=bigInt$3(8);class SystemInstruction{constructor(){}static decodeInstructionType(eo){this.checkProgramId(eo.programId);const ro=u32$1("instruction").decode(eo.data);let no;for(const[io,oo]of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS))if(oo.index==ro){no=io;break}if(!no)throw new Error("Instruction type incorrect; not a SystemInstruction");return no}static decodeCreateAccount(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{lamports:to,space:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create,eo.data);return{fromPubkey:eo.keys[0].pubkey,newAccountPubkey:eo.keys[1].pubkey,lamports:to,space:ro,programId:new PublicKey$2(no)}}static decodeTransfer(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{lamports:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer,eo.data);return{fromPubkey:eo.keys[0].pubkey,toPubkey:eo.keys[1].pubkey,lamports:to}}static decodeTransferWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3);const{lamports:to,seed:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed,eo.data);return{fromPubkey:eo.keys[0].pubkey,basePubkey:eo.keys[1].pubkey,toPubkey:eo.keys[2].pubkey,lamports:to,seed:ro,programId:new PublicKey$2(no)}}static decodeAllocate(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{space:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate,eo.data);return{accountPubkey:eo.keys[0].pubkey,space:to}}static decodeAllocateWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{base:to,seed:ro,space:no,programId:io}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed,eo.data);return{accountPubkey:eo.keys[0].pubkey,basePubkey:new PublicKey$2(to),seed:ro,space:no,programId:new PublicKey$2(io)}}static decodeAssign(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{programId:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign,eo.data);return{accountPubkey:eo.keys[0].pubkey,programId:new PublicKey$2(to)}}static decodeAssignWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,1);const{base:to,seed:ro,programId:no}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed,eo.data);return{accountPubkey:eo.keys[0].pubkey,basePubkey:new PublicKey$2(to),seed:ro,programId:new PublicKey$2(no)}}static decodeCreateWithSeed(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{base:to,seed:ro,lamports:no,space:io,programId:oo}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,eo.data);return{fromPubkey:eo.keys[0].pubkey,newAccountPubkey:eo.keys[1].pubkey,basePubkey:new PublicKey$2(to),seed:ro,lamports:no,space:io,programId:new PublicKey$2(oo)}}static decodeNonceInitialize(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3);const{authorized:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:new PublicKey$2(to)}}static decodeNonceAdvance(eo){return this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,3),decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,eo.data),{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:eo.keys[2].pubkey}}static decodeNonceWithdraw(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,5);const{lamports:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,toPubkey:eo.keys[1].pubkey,authorizedPubkey:eo.keys[4].pubkey,lamports:to}}static decodeNonceAuthorize(eo){this.checkProgramId(eo.programId),this.checkKeyLength(eo.keys,2);const{authorized:to}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,eo.data);return{noncePubkey:eo.keys[0].pubkey,authorizedPubkey:eo.keys[1].pubkey,newAuthorizedPubkey:new PublicKey$2(to)}}static checkProgramId(eo){if(!eo.equals(SystemProgram.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(eo,to){if(eo.length-1&&(no+=stringify$1(Xr[to],!0)),no+"]"}else if(so==="[object Object]"){for(io=objKeys(Xr).sort(),ro=io.length,no="",to=0;to1;)Xr/=2,eo++;return eo}function nextPowerOfTwo(Xr){return Xr===0?1:(Xr--,Xr|=Xr>>1,Xr|=Xr>>2,Xr|=Xr>>4,Xr|=Xr>>8,Xr|=Xr>>16,Xr|=Xr>>32,Xr+1)}class EpochSchedule{constructor(eo,to,ro,no,io){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=eo,this.leaderScheduleSlotOffset=to,this.warmup=ro,this.firstNormalEpoch=no,this.firstNormalSlot=io}getEpoch(eo){return this.getEpochAndSlotIndex(eo)[0]}getEpochAndSlotIndex(eo){if(eo{const oo=_default(io,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...to});return"socket"in oo?this.underlyingSocket=oo.socket:this.underlyingSocket=oo,oo};super(no,eo,to,ro),this.underlyingSocket=void 0}call(...eo){var ro;const to=(ro=this.underlyingSocket)==null?void 0:ro.readyState;return to===1?super.call(...eo):Promise.reject(new Error("Tried to call a JSON-RPC method `"+eo[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+to+")"))}notify(...eo){var ro;const to=(ro=this.underlyingSocket)==null?void 0:ro.readyState;return to===1?super.notify(...eo):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+eo[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+to+")"))}}function decodeData(Xr,eo){let to;try{to=Xr.layout.decode(eo)}catch(ro){throw new Error("invalid instruction; "+ro)}if(to.typeIndex!==Xr.index)throw new Error(`invalid account data; account type mismatch ${to.typeIndex} != ${Xr.index}`);return to}const LOOKUP_TABLE_META_SIZE=56;class AddressLookupTableAccount{constructor(eo){this.key=void 0,this.state=void 0,this.key=eo.key,this.state=eo.state}isActive(){const eo=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===eo}static deserialize(eo){const to=decodeData(LookupTableMetaLayout,eo),ro=eo.length-LOOKUP_TABLE_META_SIZE;assert$5(ro>=0,"lookup table is invalid"),assert$5(ro%32===0,"lookup table is invalid");const no=ro/32,{addresses:io}=struct([seq(publicKey$3(),no,"addresses")]).decode(eo.slice(LOOKUP_TABLE_META_SIZE));return{deactivationSlot:to.deactivationSlot,lastExtendedSlot:to.lastExtendedSlot,lastExtendedSlotStartIndex:to.lastExtendedStartIndex,authority:to.authority.length!==0?new PublicKey$2(to.authority[0]):void 0,addresses:io.map(oo=>new PublicKey$2(oo))}}}const LookupTableMetaLayout={index:1,layout:struct([u32$1("typeIndex"),u64$3("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$3(),offset(u8(),-1),"authority")])},URL_RE=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function makeWebsocketUrl(Xr){const eo=Xr.match(URL_RE);if(eo==null)throw TypeError(`Failed to validate endpoint URL \`${Xr}\``);const[to,ro,no,io]=eo,oo=Xr.startsWith("https:")?"wss:":"ws:",ao=no==null?null:parseInt(no.slice(1),10),so=ao==null?"":`:${ao+1}`;return`${oo}//${ro}${so}${io}`}const PublicKeyFromString$2=coerce$2(instance$2(PublicKey$2),string$2(),Xr=>new PublicKey$2(Xr)),RawAccountDataResult$2=tuple$3([string$2(),literal$2("base64")]),BufferFromRawAccountData$2=coerce$2(instance$2(Buffer$1$1),RawAccountDataResult$2,Xr=>Buffer$1$1.from(Xr[0],"base64")),BLOCKHASH_CACHE_TIMEOUT_MS=30*1e3;function assertEndpointUrl(Xr){if(/^https?:/.test(Xr)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return Xr}function extractCommitmentFromConfig(Xr){let eo,to;if(typeof Xr=="string")eo=Xr;else if(Xr){const{commitment:ro,...no}=Xr;eo=ro,to=no}return{commitment:eo,config:to}}function createRpcResult$2(Xr){return union$2([type$2({jsonrpc:literal$2("2.0"),id:string$2(),result:Xr}),type$2({jsonrpc:literal$2("2.0"),id:string$2(),error:type$2({code:unknown$2(),message:string$2(),data:optional$2(any$2())})})])}const UnknownRpcResult$2=createRpcResult$2(unknown$2());function jsonRpcResult$2(Xr){return coerce$2(createRpcResult$2(Xr),UnknownRpcResult$2,eo=>"error"in eo?eo:{...eo,result:create$2(eo.result,Xr)})}function jsonRpcResultAndContext$2(Xr){return jsonRpcResult$2(type$2({context:type$2({slot:number$3()}),value:Xr}))}function notificationResultAndContext$2(Xr){return type$2({context:type$2({slot:number$3()}),value:Xr})}function versionedMessageFromResponse(Xr,eo){return Xr===0?new MessageV0({header:eo.header,staticAccountKeys:eo.accountKeys.map(to=>new PublicKey$2(to)),recentBlockhash:eo.recentBlockhash,compiledInstructions:eo.instructions.map(to=>({programIdIndex:to.programIdIndex,accountKeyIndexes:to.accounts,data:bs58$3.decode(to.data)})),addressTableLookups:eo.addressTableLookups}):new Message(eo)}const GetInflationGovernorResult$2=type$2({foundation:number$3(),foundationTerm:number$3(),initial:number$3(),taper:number$3(),terminal:number$3()}),GetInflationRewardResult=jsonRpcResult$2(array$2(nullable$2(type$2({epoch:number$3(),effectiveSlot:number$3(),amount:number$3(),postBalance:number$3(),commission:optional$2(nullable$2(number$3()))})))),GetRecentPrioritizationFeesResult$2=array$2(type$2({slot:number$3(),prioritizationFee:number$3()})),GetInflationRateResult$2=type$2({total:number$3(),validator:number$3(),foundation:number$3(),epoch:number$3()}),GetEpochInfoResult$2=type$2({epoch:number$3(),slotIndex:number$3(),slotsInEpoch:number$3(),absoluteSlot:number$3(),blockHeight:optional$2(number$3()),transactionCount:optional$2(number$3())}),GetEpochScheduleResult$2=type$2({slotsPerEpoch:number$3(),leaderScheduleSlotOffset:number$3(),warmup:boolean$2(),firstNormalEpoch:number$3(),firstNormalSlot:number$3()}),GetLeaderScheduleResult$2=record$2(string$2(),array$2(number$3())),TransactionErrorResult$2=nullable$2(union$2([type$2({}),string$2()])),SignatureStatusResult$2=type$2({err:TransactionErrorResult$2}),SignatureReceivedResult$2=literal$2("receivedSignature"),VersionResult=type$2({"solana-core":string$2(),"feature-set":optional$2(number$3())}),SimulatedTransactionResponseStruct=jsonRpcResultAndContext$2(type$2({err:nullable$2(union$2([type$2({}),string$2()])),logs:nullable$2(array$2(string$2())),accounts:optional$2(nullable$2(array$2(nullable$2(type$2({executable:boolean$2(),owner:string$2(),lamports:number$3(),data:array$2(string$2()),rentEpoch:optional$2(number$3())}))))),unitsConsumed:optional$2(number$3()),returnData:optional$2(nullable$2(type$2({programId:string$2(),data:tuple$3([string$2(),literal$2("base64")])})))})),BlockProductionResponseStruct=jsonRpcResultAndContext$2(type$2({byIdentity:record$2(string$2(),array$2(number$3())),range:type$2({firstSlot:number$3(),lastSlot:number$3()})}));function createRpcClient(Xr,eo,to,ro,no,io){const oo=to||fetchImpl;let ao;io!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let so;return ro&&(so=async(lo,uo)=>{const ho=await new Promise((go,bo)=>{try{ro(lo,uo,(wo,Eo)=>go([wo,Eo]))}catch(wo){bo(wo)}});return await oo(...ho)}),new RpcClient(async(lo,uo)=>{const ho={method:"POST",body:lo,agent:ao,headers:Object.assign({"Content-Type":"application/json"},eo||{},COMMON_HTTP_HEADERS)};try{let go=5,bo,wo=500;for(;so?bo=await so(Xr,ho):bo=await oo(Xr,ho),!(bo.status!==429||no===!0||(go-=1,go===0));)console.error(`Server responded with ${bo.status} ${bo.statusText}. Retrying after ${wo}ms delay...`),await sleep(wo),wo*=2;const Eo=await bo.text();bo.ok?uo(null,Eo):uo(new Error(`${bo.status} ${bo.statusText}: ${Eo}`))}catch(go){go instanceof Error&&uo(go)}},{})}function createRpcRequest(Xr){return(eo,to)=>new Promise((ro,no)=>{Xr.request(eo,to,(io,oo)=>{if(io){no(io);return}ro(oo)})})}function createRpcBatchRequest(Xr){return eo=>new Promise((to,ro)=>{eo.length===0&&to([]);const no=eo.map(io=>Xr.request(io.methodName,io.args));Xr.request(no,(io,oo)=>{if(io){ro(io);return}to(oo)})})}const GetInflationGovernorRpcResult=jsonRpcResult$2(GetInflationGovernorResult$2),GetInflationRateRpcResult=jsonRpcResult$2(GetInflationRateResult$2),GetRecentPrioritizationFeesRpcResult=jsonRpcResult$2(GetRecentPrioritizationFeesResult$2),GetEpochInfoRpcResult=jsonRpcResult$2(GetEpochInfoResult$2),GetEpochScheduleRpcResult=jsonRpcResult$2(GetEpochScheduleResult$2),GetLeaderScheduleRpcResult=jsonRpcResult$2(GetLeaderScheduleResult$2),SlotRpcResult=jsonRpcResult$2(number$3()),GetSupplyRpcResult=jsonRpcResultAndContext$2(type$2({total:number$3(),circulating:number$3(),nonCirculating:number$3(),nonCirculatingAccounts:array$2(PublicKeyFromString$2)})),TokenAmountResult$2=type$2({amount:string$2(),uiAmount:nullable$2(number$3()),decimals:number$3(),uiAmountString:optional$2(string$2())}),GetTokenLargestAccountsResult=jsonRpcResultAndContext$2(array$2(type$2({address:PublicKeyFromString$2,amount:string$2(),uiAmount:nullable$2(number$3()),decimals:number$3(),uiAmountString:optional$2(string$2())}))),GetTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$2({pubkey:PublicKeyFromString$2,account:type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:BufferFromRawAccountData$2,rentEpoch:number$3()})}))),ParsedAccountDataResult$2=type$2({program:string$2(),parsed:unknown$2(),space:number$3()}),GetParsedTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$2({pubkey:PublicKeyFromString$2,account:type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:ParsedAccountDataResult$2,rentEpoch:number$3()})}))),GetLargestAccountsRpcResult=jsonRpcResultAndContext$2(array$2(type$2({lamports:number$3(),address:PublicKeyFromString$2}))),AccountInfoResult$2=type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:BufferFromRawAccountData$2,rentEpoch:number$3()}),KeyedAccountInfoResult=type$2({pubkey:PublicKeyFromString$2,account:AccountInfoResult$2}),ParsedOrRawAccountData$2=coerce$2(union$2([instance$2(Buffer$1$1),ParsedAccountDataResult$2]),union$2([RawAccountDataResult$2,ParsedAccountDataResult$2]),Xr=>Array.isArray(Xr)?create$2(Xr,BufferFromRawAccountData$2):Xr),ParsedAccountInfoResult$2=type$2({executable:boolean$2(),owner:PublicKeyFromString$2,lamports:number$3(),data:ParsedOrRawAccountData$2,rentEpoch:number$3()}),KeyedParsedAccountInfoResult=type$2({pubkey:PublicKeyFromString$2,account:ParsedAccountInfoResult$2}),StakeActivationResult=type$2({state:union$2([literal$2("active"),literal$2("inactive"),literal$2("activating"),literal$2("deactivating")]),active:number$3(),inactive:number$3()}),GetConfirmedSignaturesForAddress2RpcResult=jsonRpcResult$2(array$2(type$2({signature:string$2(),slot:number$3(),err:TransactionErrorResult$2,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$3()))}))),GetSignaturesForAddressRpcResult=jsonRpcResult$2(array$2(type$2({signature:string$2(),slot:number$3(),err:TransactionErrorResult$2,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$3()))}))),AccountNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(AccountInfoResult$2)}),ProgramAccountInfoResult$2=type$2({pubkey:PublicKeyFromString$2,account:AccountInfoResult$2}),ProgramAccountNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(ProgramAccountInfoResult$2)}),SlotInfoResult$2=type$2({parent:number$3(),slot:number$3(),root:number$3()}),SlotNotificationResult=type$2({subscription:number$3(),result:SlotInfoResult$2}),SlotUpdateResult$2=union$2([type$2({type:union$2([literal$2("firstShredReceived"),literal$2("completed"),literal$2("optimisticConfirmation"),literal$2("root")]),slot:number$3(),timestamp:number$3()}),type$2({type:literal$2("createdBank"),parent:number$3(),slot:number$3(),timestamp:number$3()}),type$2({type:literal$2("frozen"),slot:number$3(),timestamp:number$3(),stats:type$2({numTransactionEntries:number$3(),numSuccessfulTransactions:number$3(),numFailedTransactions:number$3(),maxTransactionsPerEntry:number$3()})}),type$2({type:literal$2("dead"),slot:number$3(),timestamp:number$3(),err:string$2()})]),SlotUpdateNotificationResult=type$2({subscription:number$3(),result:SlotUpdateResult$2}),SignatureNotificationResult=type$2({subscription:number$3(),result:notificationResultAndContext$2(union$2([SignatureStatusResult$2,SignatureReceivedResult$2]))}),RootNotificationResult=type$2({subscription:number$3(),result:number$3()}),ContactInfoResult=type$2({pubkey:string$2(),gossip:nullable$2(string$2()),tpu:nullable$2(string$2()),rpc:nullable$2(string$2()),version:nullable$2(string$2())}),VoteAccountInfoResult$2=type$2({votePubkey:string$2(),nodePubkey:string$2(),activatedStake:number$3(),epochVoteAccount:boolean$2(),epochCredits:array$2(tuple$3([number$3(),number$3(),number$3()])),commission:number$3(),lastVote:number$3(),rootSlot:nullable$2(number$3())}),GetVoteAccounts=jsonRpcResult$2(type$2({current:array$2(VoteAccountInfoResult$2),delinquent:array$2(VoteAccountInfoResult$2)})),ConfirmationStatus$2=union$2([literal$2("processed"),literal$2("confirmed"),literal$2("finalized")]),SignatureStatusResponse$2=type$2({slot:number$3(),confirmations:nullable$2(number$3()),err:TransactionErrorResult$2,confirmationStatus:optional$2(ConfirmationStatus$2)}),GetSignatureStatusesRpcResult=jsonRpcResultAndContext$2(array$2(nullable$2(SignatureStatusResponse$2))),GetMinimumBalanceForRentExemptionRpcResult=jsonRpcResult$2(number$3()),AddressTableLookupStruct$2=type$2({accountKey:PublicKeyFromString$2,writableIndexes:array$2(number$3()),readonlyIndexes:array$2(number$3())}),ConfirmedTransactionResult$2=type$2({signatures:array$2(string$2()),message:type$2({accountKeys:array$2(string$2()),header:type$2({numRequiredSignatures:number$3(),numReadonlySignedAccounts:number$3(),numReadonlyUnsignedAccounts:number$3()}),instructions:array$2(type$2({accounts:array$2(number$3()),data:string$2(),programIdIndex:number$3()})),recentBlockhash:string$2(),addressTableLookups:optional$2(array$2(AddressTableLookupStruct$2))})}),AnnotatedAccountKey$2=type$2({pubkey:PublicKeyFromString$2,signer:boolean$2(),writable:boolean$2(),source:optional$2(union$2([literal$2("transaction"),literal$2("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$2=type$2({accountKeys:array$2(AnnotatedAccountKey$2),signatures:array$2(string$2())}),ParsedInstructionResult$2=type$2({parsed:unknown$2(),program:string$2(),programId:PublicKeyFromString$2}),RawInstructionResult$2=type$2({accounts:array$2(PublicKeyFromString$2),data:string$2(),programId:PublicKeyFromString$2}),InstructionResult$2=union$2([RawInstructionResult$2,ParsedInstructionResult$2]),UnknownInstructionResult$2=union$2([type$2({parsed:unknown$2(),program:string$2(),programId:string$2()}),type$2({accounts:array$2(string$2()),data:string$2(),programId:string$2()})]),ParsedOrRawInstruction$2=coerce$2(InstructionResult$2,UnknownInstructionResult$2,Xr=>"accounts"in Xr?create$2(Xr,RawInstructionResult$2):create$2(Xr,ParsedInstructionResult$2)),ParsedConfirmedTransactionResult$2=type$2({signatures:array$2(string$2()),message:type$2({accountKeys:array$2(AnnotatedAccountKey$2),instructions:array$2(ParsedOrRawInstruction$2),recentBlockhash:string$2(),addressTableLookups:optional$2(nullable$2(array$2(AddressTableLookupStruct$2)))})}),TokenBalanceResult$2=type$2({accountIndex:number$3(),mint:string$2(),owner:optional$2(string$2()),uiTokenAmount:TokenAmountResult$2}),LoadedAddressesResult$2=type$2({writable:array$2(PublicKeyFromString$2),readonly:array$2(PublicKeyFromString$2)}),ConfirmedTransactionMetaResult$2=type$2({err:TransactionErrorResult$2,fee:number$3(),innerInstructions:optional$2(nullable$2(array$2(type$2({index:number$3(),instructions:array$2(type$2({accounts:array$2(number$3()),data:string$2(),programIdIndex:number$3()}))})))),preBalances:array$2(number$3()),postBalances:array$2(number$3()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),loadedAddresses:optional$2(LoadedAddressesResult$2),computeUnitsConsumed:optional$2(number$3())}),ParsedConfirmedTransactionMetaResult$2=type$2({err:TransactionErrorResult$2,fee:number$3(),innerInstructions:optional$2(nullable$2(array$2(type$2({index:number$3(),instructions:array$2(ParsedOrRawInstruction$2)})))),preBalances:array$2(number$3()),postBalances:array$2(number$3()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult$2))),loadedAddresses:optional$2(LoadedAddressesResult$2),computeUnitsConsumed:optional$2(number$3())}),TransactionVersionStruct$2=union$2([literal$2(0),literal$2("legacy")]),RewardsResult$2=type$2({pubkey:string$2(),lamports:number$3(),postBalance:nullable$2(number$3()),rewardType:nullable$2(string$2()),commission:optional$2(nullable$2(number$3()))}),GetBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionAccountsModeResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ParsedConfirmedTransactionResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionAccountsModeResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),version:optional$2(TransactionVersionStruct$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetParsedNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3()),blockHeight:nullable$2(number$3())}))),GetConfirmedBlockRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),transactions:array$2(type$2({transaction:ConfirmedTransactionResult$2,meta:nullable$2(ConfirmedTransactionMetaResult$2)})),rewards:optional$2(array$2(RewardsResult$2)),blockTime:nullable$2(number$3())}))),GetBlockSignaturesRpcResult=jsonRpcResult$2(nullable$2(type$2({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$3(),signatures:array$2(string$2()),blockTime:nullable$2(number$3())}))),GetTransactionRpcResult=jsonRpcResult$2(nullable$2(type$2({slot:number$3(),meta:nullable$2(ConfirmedTransactionMetaResult$2),blockTime:optional$2(nullable$2(number$3())),transaction:ConfirmedTransactionResult$2,version:optional$2(TransactionVersionStruct$2)}))),GetParsedTransactionRpcResult=jsonRpcResult$2(nullable$2(type$2({slot:number$3(),transaction:ParsedConfirmedTransactionResult$2,meta:nullable$2(ParsedConfirmedTransactionMetaResult$2),blockTime:optional$2(nullable$2(number$3())),version:optional$2(TransactionVersionStruct$2)}))),GetRecentBlockhashAndContextRpcResult=jsonRpcResultAndContext$2(type$2({blockhash:string$2(),feeCalculator:type$2({lamportsPerSignature:number$3()})})),GetLatestBlockhashRpcResult=jsonRpcResultAndContext$2(type$2({blockhash:string$2(),lastValidBlockHeight:number$3()})),IsBlockhashValidRpcResult=jsonRpcResultAndContext$2(boolean$2()),PerfSampleResult$2=type$2({slot:number$3(),numTransactions:number$3(),numSlots:number$3(),samplePeriodSecs:number$3()}),GetRecentPerformanceSamplesRpcResult=jsonRpcResult$2(array$2(PerfSampleResult$2)),GetFeeCalculatorRpcResult=jsonRpcResultAndContext$2(nullable$2(type$2({feeCalculator:type$2({lamportsPerSignature:number$3()})}))),RequestAirdropRpcResult=jsonRpcResult$2(string$2()),SendTransactionRpcResult=jsonRpcResult$2(string$2()),LogsResult$2=type$2({err:TransactionErrorResult$2,logs:array$2(string$2()),signature:string$2()}),LogsNotificationResult=type$2({result:notificationResultAndContext$2(LogsResult$2),subscription:number$3()}),COMMON_HTTP_HEADERS={"solana-client":"js/0.0.0-development"};class Connection{constructor(eo,to){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const co={};return async lo=>{const{commitment:uo,config:ho}=extractCommitmentFromConfig(lo),go=this._buildArgs([],uo,void 0,ho),bo=fastStableStringify$1(go);return co[bo]=co[bo]??(async()=>{try{const wo=await this._rpcRequest("getBlockHeight",go),Eo=create$2(wo,jsonRpcResult$2(number$3()));if("error"in Eo)throw new SolanaJSONRPCError(Eo.error,"failed to get block height information");return Eo.result}finally{delete co[bo]}})(),await co[bo]}})();let ro,no,io,oo,ao,so;to&&typeof to=="string"?this._commitment=to:to&&(this._commitment=to.commitment,this._confirmTransactionInitialTimeout=to.confirmTransactionInitialTimeout,ro=to.wsEndpoint,no=to.httpHeaders,io=to.fetch,oo=to.fetchMiddleware,ao=to.disableRetryOnRateLimit,so=to.httpAgent),this._rpcEndpoint=assertEndpointUrl(eo),this._rpcWsEndpoint=ro||makeWebsocketUrl(eo),this._rpcClient=createRpcClient(eo,no,io,oo,ao,so),this._rpcRequest=createRpcRequest(this._rpcClient),this._rpcBatchRequest=createRpcBatchRequest(this._rpcClient),this._rpcWebSocket=new RpcWebSocketClient(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,void 0,no),oo=await this._rpcRequest("getBalance",io),ao=create$2(oo,jsonRpcResultAndContext$2(number$3()));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get balance for ${eo.toBase58()}`);return ao.result}async getBalance(eo,to){return await this.getBalanceAndContext(eo,to).then(ro=>ro.value).catch(ro=>{throw new Error("failed to get balance of account "+eo.toBase58()+": "+ro)})}async getBlockTime(eo){const to=await this._rpcRequest("getBlockTime",[eo]),ro=create$2(to,jsonRpcResult$2(nullable$2(number$3())));if("error"in ro)throw new SolanaJSONRPCError(ro.error,`failed to get block time for slot ${eo}`);return ro.result}async getMinimumLedgerSlot(){const eo=await this._rpcRequest("minimumLedgerSlot",[]),to=create$2(eo,jsonRpcResult$2(number$3()));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get minimum ledger slot");return to.result}async getFirstAvailableBlock(){const eo=await this._rpcRequest("getFirstAvailableBlock",[]),to=create$2(eo,SlotRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get first available block");return to.result}async getSupply(eo){let to={};typeof eo=="string"?to={commitment:eo}:eo?to={...eo,commitment:eo&&eo.commitment||this.commitment}:to={commitment:this.commitment};const ro=await this._rpcRequest("getSupply",[to]),no=create$2(ro,GetSupplyRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get supply");return no.result}async getTokenSupply(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenSupply",ro),io=create$2(no,jsonRpcResultAndContext$2(TokenAmountResult$2));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token supply");return io.result}async getTokenAccountBalance(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenAccountBalance",ro),io=create$2(no,jsonRpcResultAndContext$2(TokenAmountResult$2));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token account balance");return io.result}async getTokenAccountsByOwner(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(ro);let oo=[eo.toBase58()];"mint"in to?oo.push({mint:to.mint.toBase58()}):oo.push({programId:to.programId.toBase58()});const ao=this._buildArgs(oo,no,"base64",io),so=await this._rpcRequest("getTokenAccountsByOwner",ao),co=create$2(so,GetTokenAccountsByOwner);if("error"in co)throw new SolanaJSONRPCError(co.error,`failed to get token accounts owned by account ${eo.toBase58()}`);return co.result}async getParsedTokenAccountsByOwner(eo,to,ro){let no=[eo.toBase58()];"mint"in to?no.push({mint:to.mint.toBase58()}):no.push({programId:to.programId.toBase58()});const io=this._buildArgs(no,ro,"jsonParsed"),oo=await this._rpcRequest("getTokenAccountsByOwner",io),ao=create$2(oo,GetParsedTokenAccountsByOwner);if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get token accounts owned by account ${eo.toBase58()}`);return ao.result}async getLargestAccounts(eo){const to={...eo,commitment:eo&&eo.commitment||this.commitment},ro=to.filter||to.commitment?[to]:[],no=await this._rpcRequest("getLargestAccounts",ro),io=create$2(no,GetLargestAccountsRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get largest accounts");return io.result}async getTokenLargestAccounts(eo,to){const ro=this._buildArgs([eo.toBase58()],to),no=await this._rpcRequest("getTokenLargestAccounts",ro),io=create$2(no,GetTokenLargestAccountsResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get token largest accounts");return io.result}async getAccountInfoAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"base64",no),oo=await this._rpcRequest("getAccountInfo",io),ao=create$2(oo,jsonRpcResultAndContext$2(nullable$2(AccountInfoResult$2)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get info about account ${eo.toBase58()}`);return ao.result}async getParsedAccountInfo(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"jsonParsed",no),oo=await this._rpcRequest("getAccountInfo",io),ao=create$2(oo,jsonRpcResultAndContext$2(nullable$2(ParsedAccountInfoResult$2)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get info about account ${eo.toBase58()}`);return ao.result}async getAccountInfo(eo,to){try{return(await this.getAccountInfoAndContext(eo,to)).value}catch(ro){throw new Error("failed to get info about account "+eo.toBase58()+": "+ro)}}async getMultipleParsedAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(co=>co.toBase58()),oo=this._buildArgs([io],ro,"jsonParsed",no),ao=await this._rpcRequest("getMultipleAccounts",oo),so=create$2(ao,jsonRpcResultAndContext$2(array$2(nullable$2(ParsedAccountInfoResult$2))));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get info for accounts ${io}`);return so.result}async getMultipleAccountsInfoAndContext(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(co=>co.toBase58()),oo=this._buildArgs([io],ro,"base64",no),ao=await this._rpcRequest("getMultipleAccounts",oo),so=create$2(ao,jsonRpcResultAndContext$2(array$2(nullable$2(AccountInfoResult$2))));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get info for accounts ${io}`);return so.result}async getMultipleAccountsInfo(eo,to){return(await this.getMultipleAccountsInfoAndContext(eo,to)).value}async getStakeActivation(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(to),oo=this._buildArgs([eo.toBase58()],no,void 0,{...io,epoch:ro??(io==null?void 0:io.epoch)}),ao=await this._rpcRequest("getStakeActivation",oo),so=create$2(ao,jsonRpcResult$2(StakeActivationResult));if("error"in so)throw new SolanaJSONRPCError(so.error,`failed to get Stake Activation ${eo.toBase58()}`);return so.result}async getProgramAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),{encoding:io,...oo}=no||{},ao=this._buildArgs([eo.toBase58()],ro,io||"base64",oo),so=await this._rpcRequest("getProgramAccounts",ao),co=array$2(KeyedAccountInfoResult),lo=oo.withContext===!0?create$2(so,jsonRpcResultAndContext$2(co)):create$2(so,jsonRpcResult$2(co));if("error"in lo)throw new SolanaJSONRPCError(lo.error,`failed to get accounts owned by program ${eo.toBase58()}`);return lo.result}async getParsedProgramAccounts(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo.toBase58()],ro,"jsonParsed",no),oo=await this._rpcRequest("getProgramAccounts",io),ao=create$2(oo,jsonRpcResult$2(array$2(KeyedParsedAccountInfoResult)));if("error"in ao)throw new SolanaJSONRPCError(ao.error,`failed to get accounts owned by program ${eo.toBase58()}`);return ao.result}async confirmTransaction(eo,to){var io;let ro;if(typeof eo=="string")ro=eo;else{const oo=eo;if((io=oo.abortSignal)!=null&&io.aborted)return Promise.reject(oo.abortSignal.reason);ro=oo.signature}let no;try{no=bs58$3.decode(ro)}catch{throw new Error("signature must be base58 encoded: "+ro)}return assert$5(no.length===64,"signature has invalid length"),typeof eo=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:to||this.commitment,signature:ro}):"lastValidBlockHeight"in eo?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:to||this.commitment,strategy:eo}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:to||this.commitment,strategy:eo})}getCancellationPromise(eo){return new Promise((to,ro)=>{eo!=null&&(eo.aborted?ro(eo.reason):eo.addEventListener("abort",()=>{ro(eo.reason)}))})}getTransactionConfirmationPromise({commitment:eo,signature:to}){let ro,no,io=!1;const oo=new Promise((so,co)=>{try{ro=this.onSignature(to,(uo,ho)=>{ro=void 0;const go={context:ho,value:uo};so({__type:TransactionStatus$1.PROCESSED,response:go})},eo);const lo=new Promise(uo=>{ro==null?uo():no=this._onSubscriptionStateChange(ro,ho=>{ho==="subscribed"&&uo()})});(async()=>{if(await lo,io)return;const uo=await this.getSignatureStatus(to);if(io||uo==null)return;const{context:ho,value:go}=uo;if(go!=null)if(go!=null&&go.err)co(go.err);else{switch(eo){case"confirmed":case"single":case"singleGossip":{if(go.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(go.confirmationStatus==="processed"||go.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}io=!0,so({__type:TransactionStatus$1.PROCESSED,response:{context:ho,value:go}})}})()}catch(lo){co(lo)}});return{abortConfirmation:()=>{no&&(no(),no=void 0),ro!=null&&(this.removeSignatureListener(ro),ro=void 0)},confirmationPromise:oo}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:eo,strategy:{abortSignal:to,lastValidBlockHeight:ro,signature:no}}){let io=!1;const oo=new Promise(uo=>{const ho=async()=>{try{return await this.getBlockHeight(eo)}catch{return-1}};(async()=>{let go=await ho();if(!io){for(;go<=ro;)if(await sleep(1e3),io||(go=await ho(),io))return;uo({__type:TransactionStatus$1.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:ao,confirmationPromise:so}=this.getTransactionConfirmationPromise({commitment:eo,signature:no}),co=this.getCancellationPromise(to);let lo;try{const uo=await Promise.race([co,so,oo]);if(uo.__type===TransactionStatus$1.PROCESSED)lo=uo.response;else throw new TransactionExpiredBlockheightExceededError(no)}finally{io=!0,ao()}return lo}async confirmTransactionUsingDurableNonceStrategy({commitment:eo,strategy:{abortSignal:to,minContextSlot:ro,nonceAccountPubkey:no,nonceValue:io,signature:oo}}){let ao=!1;const so=new Promise(go=>{let bo=io,wo=null;const Eo=async()=>{try{const{context:$o,value:Co}=await this.getNonceAndContext(no,{commitment:eo,minContextSlot:ro});return wo=$o.slot,Co==null?void 0:Co.nonce}catch{return bo}};(async()=>{if(bo=await Eo(),!ao)for(;;){if(io!==bo){go({__type:TransactionStatus$1.NONCE_INVALID,slotInWhichNonceDidAdvance:wo});return}if(await sleep(2e3),ao||(bo=await Eo(),ao))return}})()}),{abortConfirmation:co,confirmationPromise:lo}=this.getTransactionConfirmationPromise({commitment:eo,signature:oo}),uo=this.getCancellationPromise(to);let ho;try{const go=await Promise.race([uo,lo,so]);if(go.__type===TransactionStatus$1.PROCESSED)ho=go.response;else{let bo;for(;;){const wo=await this.getSignatureStatus(oo);if(wo==null)break;if(wo.context.slot<(go.slotInWhichNonceDidAdvance??ro)){await sleep(400);continue}bo=wo;break}if(bo!=null&&bo.value){const wo=eo||"finalized",{confirmationStatus:Eo}=bo.value;switch(wo){case"processed":case"recent":if(Eo!=="processed"&&Eo!=="confirmed"&&Eo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;case"confirmed":case"single":case"singleGossip":if(Eo!=="confirmed"&&Eo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;case"finalized":case"max":case"root":if(Eo!=="finalized")throw new TransactionExpiredNonceInvalidError(oo);break;default:}ho={context:bo.context,value:{err:bo.value.err}}}else throw new TransactionExpiredNonceInvalidError(oo)}}finally{ao=!0,co()}return ho}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:eo,signature:to}){let ro;const no=new Promise(so=>{let co=this._confirmTransactionInitialTimeout||6e4;switch(eo){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{co=this._confirmTransactionInitialTimeout||3e4;break}}ro=setTimeout(()=>so({__type:TransactionStatus$1.TIMED_OUT,timeoutMs:co}),co)}),{abortConfirmation:io,confirmationPromise:oo}=this.getTransactionConfirmationPromise({commitment:eo,signature:to});let ao;try{const so=await Promise.race([oo,no]);if(so.__type===TransactionStatus$1.PROCESSED)ao=so.response;else throw new TransactionExpiredTimeoutError(to,so.timeoutMs/1e3)}finally{clearTimeout(ro),io()}return ao}async getClusterNodes(){const eo=await this._rpcRequest("getClusterNodes",[]),to=create$2(eo,jsonRpcResult$2(array$2(ContactInfoResult)));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get cluster nodes");return to.result}async getVoteAccounts(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getVoteAccounts",to),no=create$2(ro,GetVoteAccounts);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get vote accounts");return no.result}async getSlot(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getSlot",no),oo=create$2(io,jsonRpcResult$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get slot");return oo.result}async getSlotLeader(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getSlotLeader",no),oo=create$2(io,jsonRpcResult$2(string$2()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get slot leader");return oo.result}async getSlotLeaders(eo,to){const ro=[eo,to],no=await this._rpcRequest("getSlotLeaders",ro),io=create$2(no,jsonRpcResult$2(array$2(PublicKeyFromString$2)));if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get slot leaders");return io.result}async getSignatureStatus(eo,to){const{context:ro,value:no}=await this.getSignatureStatuses([eo],to);assert$5(no.length===1);const io=no[0];return{context:ro,value:io}}async getSignatureStatuses(eo,to){const ro=[eo];to&&ro.push(to);const no=await this._rpcRequest("getSignatureStatuses",ro),io=create$2(no,GetSignatureStatusesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get signature status");return io.result}async getTransactionCount(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getTransactionCount",no),oo=create$2(io,jsonRpcResult$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get transaction count");return oo.result}async getTotalSupply(eo){return(await this.getSupply({commitment:eo,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getInflationGovernor",to),no=create$2(ro,GetInflationGovernorRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get inflation");return no.result}async getInflationReward(eo,to,ro){const{commitment:no,config:io}=extractCommitmentFromConfig(ro),oo=this._buildArgs([eo.map(co=>co.toBase58())],no,void 0,{...io,epoch:to??(io==null?void 0:io.epoch)}),ao=await this._rpcRequest("getInflationReward",oo),so=create$2(ao,GetInflationRewardResult);if("error"in so)throw new SolanaJSONRPCError(so.error,"failed to get inflation reward");return so.result}async getInflationRate(){const eo=await this._rpcRequest("getInflationRate",[]),to=create$2(eo,GetInflationRateRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get inflation rate");return to.result}async getEpochInfo(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getEpochInfo",no),oo=create$2(io,GetEpochInfoRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get epoch info");return oo.result}async getEpochSchedule(){const eo=await this._rpcRequest("getEpochSchedule",[]),to=create$2(eo,GetEpochScheduleRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get epoch schedule");const ro=to.result;return new EpochSchedule(ro.slotsPerEpoch,ro.leaderScheduleSlotOffset,ro.warmup,ro.firstNormalEpoch,ro.firstNormalSlot)}async getLeaderSchedule(){const eo=await this._rpcRequest("getLeaderSchedule",[]),to=create$2(eo,GetLeaderScheduleRpcResult);if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get leader schedule");return to.result}async getMinimumBalanceForRentExemption(eo,to){const ro=this._buildArgs([eo],to),no=await this._rpcRequest("getMinimumBalanceForRentExemption",ro),io=create$2(no,GetMinimumBalanceForRentExemptionRpcResult);return"error"in io?(console.warn("Unable to fetch minimum balance for rent exemption"),0):io.result}async getRecentBlockhashAndContext(eo){const to=this._buildArgs([],eo),ro=await this._rpcRequest("getRecentBlockhash",to),no=create$2(ro,GetRecentBlockhashAndContextRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,"failed to get recent blockhash");return no.result}async getRecentPerformanceSamples(eo){const to=await this._rpcRequest("getRecentPerformanceSamples",eo?[eo]:[]),ro=create$2(to,GetRecentPerformanceSamplesRpcResult);if("error"in ro)throw new SolanaJSONRPCError(ro.error,"failed to get recent performance samples");return ro.result}async getFeeCalculatorForBlockhash(eo,to){const ro=this._buildArgs([eo],to),no=await this._rpcRequest("getFeeCalculatorForBlockhash",ro),io=create$2(no,GetFeeCalculatorRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get fee calculator");const{context:oo,value:ao}=io.result;return{context:oo,value:ao!==null?ao.feeCalculator:null}}async getFeeForMessage(eo,to){const ro=toBuffer$2(eo.serialize()).toString("base64"),no=this._buildArgs([ro],to),io=await this._rpcRequest("getFeeForMessage",no),oo=create$2(io,jsonRpcResultAndContext$2(nullable$2(number$3())));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get fee for message");if(oo.result===null)throw new Error("invalid blockhash");return oo.result}async getRecentPrioritizationFees(eo){var oo;const to=(oo=eo==null?void 0:eo.lockedWritableAccounts)==null?void 0:oo.map(ao=>ao.toBase58()),ro=to!=null&&to.length?[to]:[],no=await this._rpcRequest("getRecentPrioritizationFees",ro),io=create$2(no,GetRecentPrioritizationFeesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get recent prioritization fees");return io.result}async getRecentBlockhash(eo){try{return(await this.getRecentBlockhashAndContext(eo)).value}catch(to){throw new Error("failed to get recent blockhash: "+to)}}async getLatestBlockhash(eo){try{return(await this.getLatestBlockhashAndContext(eo)).value}catch(to){throw new Error("failed to get recent blockhash: "+to)}}async getLatestBlockhashAndContext(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,void 0,ro),io=await this._rpcRequest("getLatestBlockhash",no),oo=create$2(io,GetLatestBlockhashRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get latest blockhash");return oo.result}async isBlockhashValid(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgs([eo],ro,void 0,no),oo=await this._rpcRequest("isBlockhashValid",io),ao=create$2(oo,IsBlockhashValidRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to determine if the blockhash `"+eo+"`is valid");return ao.result}async getVersion(){const eo=await this._rpcRequest("getVersion",[]),to=create$2(eo,jsonRpcResult$2(VersionResult));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get version");return to.result}async getGenesisHash(){const eo=await this._rpcRequest("getGenesisHash",[]),to=create$2(eo,jsonRpcResult$2(string$2()));if("error"in to)throw new SolanaJSONRPCError(to.error,"failed to get genesis hash");return to.result}async getBlock(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,void 0,no),oo=await this._rpcRequest("getBlock",io);try{switch(no==null?void 0:no.transactionDetails){case"accounts":{const ao=create$2(oo,GetAccountsModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}case"none":{const ao=create$2(oo,GetNoneModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}default:{const ao=create$2(oo,GetBlockRpcResult);if("error"in ao)throw ao.error;const{result:so}=ao;return so?{...so,transactions:so.transactions.map(({transaction:co,meta:lo,version:uo})=>({meta:lo,transaction:{...co,message:versionedMessageFromResponse(uo,co.message)},version:uo}))}:null}}}catch(ao){throw new SolanaJSONRPCError(ao,"failed to get confirmed block")}}async getParsedBlock(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,"jsonParsed",no),oo=await this._rpcRequest("getBlock",io);try{switch(no==null?void 0:no.transactionDetails){case"accounts":{const ao=create$2(oo,GetParsedAccountsModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}case"none":{const ao=create$2(oo,GetParsedNoneModeBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}default:{const ao=create$2(oo,GetParsedBlockRpcResult);if("error"in ao)throw ao.error;return ao.result}}}catch(ao){throw new SolanaJSONRPCError(ao,"failed to get block")}}async getBlockProduction(eo){let to,ro;if(typeof eo=="string")ro=eo;else if(eo){const{commitment:ao,...so}=eo;ro=ao,to=so}const no=this._buildArgs([],ro,"base64",to),io=await this._rpcRequest("getBlockProduction",no),oo=create$2(io,BlockProductionResponseStruct);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get block production information");return oo.result}async getTransaction(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,void 0,no),oo=await this._rpcRequest("getTransaction",io),ao=create$2(oo,GetTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get transaction");const so=ao.result;return so&&{...so,transaction:{...so.transaction,message:versionedMessageFromResponse(so.version,so.transaction.message)}}}async getParsedTransaction(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=this._buildArgsAtLeastConfirmed([eo],ro,"jsonParsed",no),oo=await this._rpcRequest("getTransaction",io),ao=create$2(oo,GetParsedTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get transaction");return ao.result}async getParsedTransactions(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(so=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([so],ro,"jsonParsed",no)}));return(await this._rpcBatchRequest(io)).map(so=>{const co=create$2(so,GetParsedTransactionRpcResult);if("error"in co)throw new SolanaJSONRPCError(co.error,"failed to get transactions");return co.result})}async getTransactions(eo,to){const{commitment:ro,config:no}=extractCommitmentFromConfig(to),io=eo.map(so=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([so],ro,void 0,no)}));return(await this._rpcBatchRequest(io)).map(so=>{const co=create$2(so,GetTransactionRpcResult);if("error"in co)throw new SolanaJSONRPCError(co.error,"failed to get transactions");const lo=co.result;return lo&&{...lo,transaction:{...lo.transaction,message:versionedMessageFromResponse(lo.version,lo.transaction.message)}}})}async getConfirmedBlock(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to),no=await this._rpcRequest("getConfirmedBlock",ro),io=create$2(no,GetConfirmedBlockRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed block");const oo=io.result;if(!oo)throw new Error("Confirmed block "+eo+" not found");const ao={...oo,transactions:oo.transactions.map(({transaction:so,meta:co})=>{const lo=new Message(so.message);return{meta:co,transaction:{...so,message:lo}}})};return{...ao,transactions:ao.transactions.map(({transaction:so,meta:co})=>({meta:co,transaction:Transaction.populate(so.message,so.signatures)}))}}async getBlocks(eo,to,ro){const no=this._buildArgsAtLeastConfirmed(to!==void 0?[eo,to]:[eo],ro),io=await this._rpcRequest("getBlocks",no),oo=create$2(io,jsonRpcResult$2(array$2(number$3())));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get blocks");return oo.result}async getBlockSignatures(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,void 0,{transactionDetails:"signatures",rewards:!1}),no=await this._rpcRequest("getBlock",ro),io=create$2(no,GetBlockSignaturesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get block");const oo=io.result;if(!oo)throw new Error("Block "+eo+" not found");return oo}async getConfirmedBlockSignatures(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,void 0,{transactionDetails:"signatures",rewards:!1}),no=await this._rpcRequest("getConfirmedBlock",ro),io=create$2(no,GetBlockSignaturesRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed block");const oo=io.result;if(!oo)throw new Error("Confirmed block "+eo+" not found");return oo}async getConfirmedTransaction(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to),no=await this._rpcRequest("getConfirmedTransaction",ro),io=create$2(no,GetTransactionRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get transaction");const oo=io.result;if(!oo)return oo;const ao=new Message(oo.transaction.message),so=oo.transaction.signatures;return{...oo,transaction:Transaction.populate(ao,so)}}async getParsedConfirmedTransaction(eo,to){const ro=this._buildArgsAtLeastConfirmed([eo],to,"jsonParsed"),no=await this._rpcRequest("getConfirmedTransaction",ro),io=create$2(no,GetParsedTransactionRpcResult);if("error"in io)throw new SolanaJSONRPCError(io.error,"failed to get confirmed transaction");return io.result}async getParsedConfirmedTransactions(eo,to){const ro=eo.map(oo=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([oo],to,"jsonParsed")}));return(await this._rpcBatchRequest(ro)).map(oo=>{const ao=create$2(oo,GetParsedTransactionRpcResult);if("error"in ao)throw new SolanaJSONRPCError(ao.error,"failed to get confirmed transactions");return ao.result})}async getConfirmedSignaturesForAddress(eo,to,ro){let no={},io=await this.getFirstAvailableBlock();for(;!("until"in no)&&(to--,!(to<=0||to0&&(no.until=so.signatures[so.signatures.length-1].toString())}catch(so){if(so instanceof Error&&so.message.includes("skipped"))continue;throw so}let oo=await this.getSlot("finalized");for(;!("before"in no)&&(ro++,!(ro>oo));)try{const so=await this.getConfirmedBlockSignatures(ro);so.signatures.length>0&&(no.before=so.signatures[so.signatures.length-1].toString())}catch(so){if(so instanceof Error&&so.message.includes("skipped"))continue;throw so}return(await this.getConfirmedSignaturesForAddress2(eo,no)).map(so=>so.signature)}async getConfirmedSignaturesForAddress2(eo,to,ro){const no=this._buildArgsAtLeastConfirmed([eo.toBase58()],ro,void 0,to),io=await this._rpcRequest("getConfirmedSignaturesForAddress2",no),oo=create$2(io,GetConfirmedSignaturesForAddress2RpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get confirmed signatures for address");return oo.result}async getSignaturesForAddress(eo,to,ro){const no=this._buildArgsAtLeastConfirmed([eo.toBase58()],ro,void 0,to),io=await this._rpcRequest("getSignaturesForAddress",no),oo=create$2(io,GetSignaturesForAddressRpcResult);if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get signatures for address");return oo.result}async getAddressLookupTable(eo,to){const{context:ro,value:no}=await this.getAccountInfoAndContext(eo,to);let io=null;return no!==null&&(io=new AddressLookupTableAccount({key:eo,state:AddressLookupTableAccount.deserialize(no.data)})),{context:ro,value:io}}async getNonceAndContext(eo,to){const{context:ro,value:no}=await this.getAccountInfoAndContext(eo,to);let io=null;return no!==null&&(io=NonceAccount.fromAccountData(no.data)),{context:ro,value:io}}async getNonce(eo,to){return await this.getNonceAndContext(eo,to).then(ro=>ro.value).catch(ro=>{throw new Error("failed to get nonce for account "+eo.toBase58()+": "+ro)})}async requestAirdrop(eo,to){const ro=await this._rpcRequest("requestAirdrop",[eo.toBase58(),to]),no=create$2(ro,RequestAirdropRpcResult);if("error"in no)throw new SolanaJSONRPCError(no.error,`airdrop to ${eo.toBase58()} failed`);return no.result}async _blockhashWithExpiryBlockHeight(eo){if(!eo){for(;this._pollingBlockhash;)await sleep(100);const ro=Date.now()-this._blockhashInfo.lastFetch>=BLOCKHASH_CACHE_TIMEOUT_MS;if(this._blockhashInfo.latestBlockhash!==null&&!ro)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const eo=Date.now(),to=this._blockhashInfo.latestBlockhash,ro=to?to.blockhash:null;for(let no=0;no<50;no++){const io=await this.getLatestBlockhash("finalized");if(ro!==io.blockhash)return this._blockhashInfo={latestBlockhash:io,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},io;await sleep(MS_PER_SLOT/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-eo}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(eo){const{commitment:to,config:ro}=extractCommitmentFromConfig(eo),no=this._buildArgs([],to,"base64",ro),io=await this._rpcRequest("getStakeMinimumDelegation",no),oo=create$2(io,jsonRpcResultAndContext$2(number$3()));if("error"in oo)throw new SolanaJSONRPCError(oo.error,"failed to get stake minimum delegation");return oo.result}async simulateTransaction(eo,to,ro){if("message"in eo){const wo=eo.serialize(),Eo=Buffer$1$1.from(wo).toString("base64");if(Array.isArray(to)||ro!==void 0)throw new Error("Invalid arguments");const $o=to||{};$o.encoding="base64","commitment"in $o||($o.commitment=this.commitment);const Co=[Eo,$o],Ro=await this._rpcRequest("simulateTransaction",Co),Oo=create$2(Ro,SimulatedTransactionResponseStruct);if("error"in Oo)throw new Error("failed to simulate transaction: "+Oo.error.message);return Oo.result}let no;if(eo instanceof Transaction){let bo=eo;no=new Transaction,no.feePayer=bo.feePayer,no.instructions=eo.instructions,no.nonceInfo=bo.nonceInfo,no.signatures=bo.signatures}else no=Transaction.populate(eo),no._message=no._json=void 0;if(to!==void 0&&!Array.isArray(to))throw new Error("Invalid arguments");const io=to;if(no.nonceInfo&&io)no.sign(...io);else{let bo=this._disableBlockhashCaching;for(;;){const wo=await this._blockhashWithExpiryBlockHeight(bo);if(no.lastValidBlockHeight=wo.lastValidBlockHeight,no.recentBlockhash=wo.blockhash,!io)break;if(no.sign(...io),!no.signature)throw new Error("!signature");const Eo=no.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(Eo)&&!this._blockhashInfo.transactionSignatures.includes(Eo)){this._blockhashInfo.simulatedSignatures.push(Eo);break}else bo=!0}}const oo=no._compile(),ao=oo.serialize(),co=no._serialize(ao).toString("base64"),lo={encoding:"base64",commitment:this.commitment};if(ro){const bo=(Array.isArray(ro)?ro:oo.nonProgramIds()).map(wo=>wo.toBase58());lo.accounts={encoding:"base64",addresses:bo}}io&&(lo.sigVerify=!0);const uo=[co,lo],ho=await this._rpcRequest("simulateTransaction",uo),go=create$2(ho,SimulatedTransactionResponseStruct);if("error"in go){let bo;if("data"in go.error&&(bo=go.error.data.logs,bo&&Array.isArray(bo))){const wo=` + `,Eo=wo+bo.join(wo);console.error(go.error.message,Eo)}throw new SendTransactionError({action:"simulate",signature:"",transactionMessage:go.error.message,logs:bo})}return go.result}async sendTransaction(eo,to,ro){if("version"in eo){if(to&&Array.isArray(to))throw new Error("Invalid arguments");const oo=eo.serialize();return await this.sendRawTransaction(oo,to)}if(to===void 0||!Array.isArray(to))throw new Error("Invalid arguments");const no=to;if(eo.nonceInfo)eo.sign(...no);else{let oo=this._disableBlockhashCaching;for(;;){const ao=await this._blockhashWithExpiryBlockHeight(oo);if(eo.lastValidBlockHeight=ao.lastValidBlockHeight,eo.recentBlockhash=ao.blockhash,eo.sign(...no),!eo.signature)throw new Error("!signature");const so=eo.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(so))oo=!0;else{this._blockhashInfo.transactionSignatures.push(so);break}}}const io=eo.serialize();return await this.sendRawTransaction(io,ro)}async sendRawTransaction(eo,to){const ro=toBuffer$2(eo).toString("base64");return await this.sendEncodedTransaction(ro,to)}async sendEncodedTransaction(eo,to){const ro={encoding:"base64"},no=to&&to.skipPreflight,io=no===!0?"processed":to&&to.preflightCommitment||this.commitment;to&&to.maxRetries!=null&&(ro.maxRetries=to.maxRetries),to&&to.minContextSlot!=null&&(ro.minContextSlot=to.minContextSlot),no&&(ro.skipPreflight=no),io&&(ro.preflightCommitment=io);const oo=[eo,ro],ao=await this._rpcRequest("sendTransaction",oo),so=create$2(ao,SendTransactionRpcResult);if("error"in so){let co;throw"data"in so.error&&(co=so.error.data.logs),new SendTransactionError({action:no?"send":"simulate",signature:"",transactionMessage:so.error.message,logs:co})}return so.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(eo){this._rpcWebSocketConnected=!1,console.error("ws error:",eo.message)}_wsOnClose(eo){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),eo===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([to,ro])=>{this._setSubscription(to,{...ro,state:"pending"})})}_setSubscription(eo,to){var no;const ro=(no=this._subscriptionsByHash[eo])==null?void 0:no.state;if(this._subscriptionsByHash[eo]=to,ro!==to.state){const io=this._subscriptionStateChangeCallbacksByHash[eo];io&&io.forEach(oo=>{try{oo(to.state)}catch{}})}}_onSubscriptionStateChange(eo,to){var io;const ro=this._subscriptionHashByClientSubscriptionId[eo];if(ro==null)return()=>{};const no=(io=this._subscriptionStateChangeCallbacksByHash)[ro]||(io[ro]=new Set);return no.add(to),()=>{no.delete(to),no.size===0&&delete this._subscriptionStateChangeCallbacksByHash[ro]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(ro){ro instanceof Error&&console.log(`Error when closing socket connection: ${ro.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const eo=this._rpcWebSocketGeneration,to=()=>eo===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async ro=>{const no=this._subscriptionsByHash[ro];if(no!==void 0)switch(no.state){case"pending":case"unsubscribed":if(no.callbacks.size===0){delete this._subscriptionsByHash[ro],no.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[no.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:io,method:oo}=no;try{this._setSubscription(ro,{...no,state:"subscribing"});const ao=await this._rpcWebSocket.call(oo,io);this._setSubscription(ro,{...no,serverSubscriptionId:ao,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[ao]=no.callbacks,await this._updateSubscriptions()}catch(ao){if(ao instanceof Error&&console.error(`${oo} error for argument`,io,ao.message),!to())return;this._setSubscription(ro,{...no,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":no.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:io,unsubscribeMethod:oo}=no;if(this._subscriptionsAutoDisposedByRpc.has(io))this._subscriptionsAutoDisposedByRpc.delete(io);else{this._setSubscription(ro,{...no,state:"unsubscribing"}),this._setSubscription(ro,{...no,state:"unsubscribing"});try{await this._rpcWebSocket.call(oo,[io])}catch(ao){if(ao instanceof Error&&console.error(`${oo} error:`,ao.message),!to())return;this._setSubscription(ro,{...no,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(ro,{...no,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(eo,to){const ro=this._subscriptionCallbacksByServerSubscriptionId[eo];ro!==void 0&&ro.forEach(no=>{try{no(...to)}catch(io){console.error(io)}})}_wsOnAccountNotification(eo){const{result:to,subscription:ro}=create$2(eo,AccountNotificationResult);this._handleServerNotification(ro,[to.value,to.context])}_makeSubscription(eo,to){const ro=this._nextClientSubscriptionId++,no=fastStableStringify$1([eo.method,to]),io=this._subscriptionsByHash[no];return io===void 0?this._subscriptionsByHash[no]={...eo,args:to,callbacks:new Set([eo.callback]),state:"pending"}:io.callbacks.add(eo.callback),this._subscriptionHashByClientSubscriptionId[ro]=no,this._subscriptionDisposeFunctionsByClientSubscriptionId[ro]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[ro],delete this._subscriptionHashByClientSubscriptionId[ro];const oo=this._subscriptionsByHash[no];assert$5(oo!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${ro}`),oo.callbacks.delete(eo.callback),await this._updateSubscriptions()},this._updateSubscriptions(),ro}onAccountChange(eo,to,ro){const no=this._buildArgs([eo.toBase58()],ro||this._commitment||"finalized","base64");return this._makeSubscription({callback:to,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},no)}async removeAccountChangeListener(eo){await this._unsubscribeClientSubscription(eo,"account change")}_wsOnProgramAccountNotification(eo){const{result:to,subscription:ro}=create$2(eo,ProgramAccountNotificationResult);this._handleServerNotification(ro,[{accountId:to.value.pubkey,accountInfo:to.value.account},to.context])}onProgramAccountChange(eo,to,ro,no){const io=this._buildArgs([eo.toBase58()],ro||this._commitment||"finalized","base64",no?{filters:no}:void 0);return this._makeSubscription({callback:to,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},io)}async removeProgramAccountChangeListener(eo){await this._unsubscribeClientSubscription(eo,"program account change")}onLogs(eo,to,ro){const no=this._buildArgs([typeof eo=="object"?{mentions:[eo.toString()]}:eo],ro||this._commitment||"finalized");return this._makeSubscription({callback:to,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},no)}async removeOnLogsListener(eo){await this._unsubscribeClientSubscription(eo,"logs")}_wsOnLogsNotification(eo){const{result:to,subscription:ro}=create$2(eo,LogsNotificationResult);this._handleServerNotification(ro,[to.value,to.context])}_wsOnSlotNotification(eo){const{result:to,subscription:ro}=create$2(eo,SlotNotificationResult);this._handleServerNotification(ro,[to])}onSlotChange(eo){return this._makeSubscription({callback:eo,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(eo){await this._unsubscribeClientSubscription(eo,"slot change")}_wsOnSlotUpdatesNotification(eo){const{result:to,subscription:ro}=create$2(eo,SlotUpdateNotificationResult);this._handleServerNotification(ro,[to])}onSlotUpdate(eo){return this._makeSubscription({callback:eo,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(eo){await this._unsubscribeClientSubscription(eo,"slot update")}async _unsubscribeClientSubscription(eo,to){const ro=this._subscriptionDisposeFunctionsByClientSubscriptionId[eo];ro?await ro():console.warn(`Ignored unsubscribe request because an active subscription with id \`${eo}\` for '${to}' events could not be found.`)}_buildArgs(eo,to,ro,no){const io=to||this._commitment;if(io||ro||no){let oo={};ro&&(oo.encoding=ro),io&&(oo.commitment=io),no&&(oo=Object.assign(oo,no)),eo.push(oo)}return eo}_buildArgsAtLeastConfirmed(eo,to,ro,no){const io=to||this._commitment;if(io&&!["confirmed","finalized"].includes(io))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(eo,to,ro,no)}_wsOnSignatureNotification(eo){const{result:to,subscription:ro}=create$2(eo,SignatureNotificationResult);to.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(ro),this._handleServerNotification(ro,to.value==="receivedSignature"?[{type:"received"},to.context]:[{type:"status",result:to.value},to.context])}onSignature(eo,to,ro){const no=this._buildArgs([eo],ro||this._commitment||"finalized"),io=this._makeSubscription({callback:(oo,ao)=>{if(oo.type==="status"){to(oo.result,ao);try{this.removeSignatureListener(io)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},no);return io}onSignatureWithOptions(eo,to,ro){const{commitment:no,...io}={...ro,commitment:ro&&ro.commitment||this._commitment||"finalized"},oo=this._buildArgs([eo],no,void 0,io),ao=this._makeSubscription({callback:(so,co)=>{to(so,co);try{this.removeSignatureListener(ao)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},oo);return ao}async removeSignatureListener(eo){await this._unsubscribeClientSubscription(eo,"signature result")}_wsOnRootNotification(eo){const{result:to,subscription:ro}=create$2(eo,RootNotificationResult);this._handleServerNotification(ro,[to])}onRootChange(eo){return this._makeSubscription({callback:eo,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(eo){await this._unsubscribeClientSubscription(eo,"root change")}}Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64$3("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64$3(),seq(publicKey$3(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey$2("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$3("microLamports")])}});new PublicKey$2("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$2("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$2("KeccakSecp256k11111111111111111111111111111");var _Lockup$2;new PublicKey$2("StakeConfig11111111111111111111111111111111");let Lockup$2=class{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}};_Lockup$2=Lockup$2;Lockup$2.default=new _Lockup$2(0,0,PublicKey$2.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized$2(),lockup$2()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("stakeAuthorizationType"),rustString$2("authoritySeed"),publicKey$3("authorityOwner")])}});new PublicKey$2("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit$2()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$3("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs$2()])}});new PublicKey$2("Vote111111111111111111111111111111111111111");new PublicKey$2("Va1idator1nfo111111111111111111111111111111");type$2({name:string$2(),website:optional$2(string$2()),details:optional$2(string$2()),keybaseUsername:optional$2(string$2())});new PublicKey$2("Vote111111111111111111111111111111111111111");struct([publicKey$3("nodePubkey"),publicKey$3("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$3("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey$3("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const LAMPORTS_PER_SOL$2=1e9;let SolanaWallet$1=class extends Wallet$1{getConnection(){return __awaiter$5(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$5(this,void 0,void 0,function*(){const eo=yield this._connector.getSigner();if(!eo)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(eo,{signAllTransactions:to=>__awaiter$5(this,void 0,void 0,function*(){return yield this.sync(),eo.signAllTransactions(to)}),signAndSendTransaction:(to,...ro)=>__awaiter$5(this,void 0,void 0,function*(){return yield this.sync(),eo.signAndSendTransaction(to,...ro)}),signMessage:(to,...ro)=>__awaiter$5(this,void 0,void 0,function*(){return yield this.sync(),eo.signMessage(to,...ro)}),signTransaction:to=>__awaiter$5(this,void 0,void 0,function*(){return yield this.sync(),eo.signTransaction(to)})})}catch(to){return logger$9.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}};const extractNonce=Xr=>{const eo=Xr.match(/Nonce: (.*)/);if(eo&&eo.length===2)return eo[1]},SOLANA_GENESIS_HASH$1="genesis-hash",getGenesisHashLSKey$1=Xr=>`${Xr}_${SOLANA_GENESIS_HASH$1}`,MEMO_PROGRAM_ID=new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");class SolanaWalletConnector extends WalletConnectorBase{constructor(eo){var to;super(eo),this.isHardwareWalletEnabled=!1,this.verifiedCredentials=[],this.ChainWallet=SolanaWallet$1,this.supportedChains=["SOL"],this.connectedChain="SOL",this.solNetworks=eo.solNetworks,this.chainRpcProviders=eo.chainRpcProviders,this.connectionConfig=eo.connectionConfig,(to=this.chainRpcProviders)===null||to===void 0||to.registerSolanaProviders(this.connectionConfig)}getNetwork(){return __awaiter$5(this,void 0,void 0,function*(){const eo=this.getWalletClient();let to=localStorage.getItem(getGenesisHashLSKey$1(eo.rpcEndpoint));to||(to=yield eo.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey$1(eo.rpcEndpoint),to)),to=to.substring(0,32);let ro;return to==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?ro="mainnet":to==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?ro="devnet":ro="testnet",ro})}endSession(){return __awaiter$5(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey$1(this.getWalletClient().rpcEndpoint))})}getWalletClient(){var eo,to;const[ro]=this.solNetworks;if(!ro)throw new DynamicError("No enabled networks");const no=((eo=ro.privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])||ro.rpcUrls[0];return new Connection(no,(to=this.connectionConfig)!==null&&to!==void 0?to:"confirmed")}getPublicClient(){return __awaiter$5(this,void 0,void 0,function*(){var eo;if(this.solNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const ro=this.chainRpcProviders.getProviders(to);return(eo=this.chainRpcProviders.getSolanaProviderByChainId(ro,"101"))===null||eo===void 0?void 0:eo.provider})}getBalance(eo){return __awaiter$5(this,void 0,void 0,function*(){const to=new PublicKey$2(eo);return this.lamportsToSol(yield this.getWalletClient().getBalance(to)).toString()})}lamportsToSol(eo){return eo/1e9}canConnectWithHardwareWallet(){const eo=findWalletBookWallet(this.walletBook,this.key);return!eo||!eo.hardwareWallets?!1:eo.hardwareWallets.includes("ledger")}signMessage(eo){const to=Object.create(null,{signMessage:{get:()=>super.signMessage}});return __awaiter$5(this,void 0,void 0,function*(){if(this.isHardwareWalletEnabled)throw new NotSupportedError(`Message signing is currently not supported on ${this.name} hardware wallet. You can use signMessageViaTransaction instead to achieve similar functionality by signing a transaction with a memo instruction. - You can read more about it here https://github.com/solana-labs/solana/issues/21366`);return to.signMessage.call(this,eo)})}proveOwnership(eo,to){const ro=Object.create(null,{proveOwnership:{get:()=>super.proveOwnership}});return __awaiter$1(this,void 0,void 0,function*(){if(yield this.validateActiveWallet(eo),this.isHardwareWalletEnabled){const no=extractNonce(to);if(!no)throw new DynamicError("Nonce missing");return this.signMessageViaTransaction(no)}return ro.proveOwnership.call(this,eo,to)})}signMessageViaTransaction(eo){return __awaiter$1(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)throw new DynamicError("Address missing");const ro=this.buildAuthTx(eo);ro.feePayer=new PublicKey$2(to),ro.recentBlockhash=(yield this.getWalletClient().getLatestBlockhash()).blockhash;const no=yield this.getSigner();if(!no)throw new DynamicError("Signer not found");const oo=(yield no.signTransaction(ro)).serialize();return JSON.stringify({signedTransaction:{data:Array.from(oo),type:"Buffer"}})})}buildAuthTx(eo){const to=new Transaction;return to.add(new TransactionInstruction({data:Buffer$3.from(eo,"utf8"),keys:[],programId:MEMO_PROGRAM_ID})),to}setVerifiedCredentials(eo){this.verifiedCredentials=eo}isLedgerAddress(eo){return isLedgerAddressViaVerifiedCredentials(eo,this.verifiedCredentials)}}ChainRpcProviders.getSolanaProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.solana)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerSolanaProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,Xr=>{const eo={};return Xr!=null&&Xr.solana&&(eo.solana=Xr.solana.map(to=>{var ro;const no=((ro=to.privateCustomerRpcUrls)===null||ro===void 0?void 0:ro[0])||to.rpcUrls[0],io=new Connection(no);return{chainId:to.chainId.toString(),chainName:to.name,provider:io}})),eo.solana})};const LAMPORTS_PER_SOL=1e9;class SolanaUiTransaction{constructor({onSubmit:eo,from:to,connection:ro,originalTransaction:no}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.feeDeducted=!1,this.formatNonNativeToken=(io,oo)=>(Number(io)/Number(Math.pow(10,oo))).toString(),this.from=to,this.onSubmit=eo,this.connection=ro,this.originalTransaction=no}parse(eo){const to=parseFloat(eo),ro=Math.round(to*LAMPORTS_PER_SOL);return BigInt(ro)}parseNonNativeToken(eo,to){return BigInt(Math.floor(Number(eo)*Math.pow(10,to)))}format(eo,{precision:to}={}){const no=(Number(eo)/LAMPORTS_PER_SOL).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(no,{precision:to})}submit(){return __awaiter$1(this,void 0,void 0,function*(){const eo=yield this.createTransaction();return this.onSubmit(eo)})}getBalance(){return __awaiter$1(this,void 0,void 0,function*(){const eo=new PublicKey$2(this.from),to=yield this.connection.getBalance(eo);return BigInt(to)})}validateAddressFormat(eo){return eo==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(eo)}fetchFee(){return __awaiter$1(this,void 0,void 0,function*(){if(this.fee.gas)return;const eo=yield this.createTransactionSafe();if(!eo)return;let to;if("version"in eo?to=eo.message:to=eo.compileMessage(),!to)throw new Error("Invalid transaction");let ro=yield this.connection.getFeeForMessage(to),no=0;for(;ro.value===null&&no<5;)ro=yield this.connection.getFeeForMessage(to),no++;this.fee.gas=ro.value?BigInt(ro.value):void 0,!this.feeDeducted&&this.fee.gas&&this.value&&(this.value=this.value-this.fee.gas,this.feeDeducted=!0)})}createTransaction(){return __awaiter$1(this,void 0,void 0,function*(){var eo;const{value:to,to:ro,nonNativeAddress:no,nonNativeValue:io}=this;if(!ro)throw new Error("Destination is required");if(this.originalTransaction)return this.originalTransaction;const oo=new Transaction,ao=new PublicKey$2(this.from),so=new PublicKey$2(ro);if(no&&io){const lo=new PublicKey$2(no),fo=io,ho=(eo=(yield this.connection.getTokenAccountsByOwner(ao,{mint:lo})).value[0])===null||eo===void 0?void 0:eo.pubkey;if(!ho)throw new Error("Source token account not found");let go;try{go=yield getAssociatedTokenAddress(lo,so),yield this.connection.getTokenAccountBalance(go)}catch{go=yield getAssociatedTokenAddress(lo,so),oo.add(createAssociatedTokenAccountInstruction(ao,go,so,lo))}oo.add(createTransferInstruction(ho,go,ao,fo))}else{const lo=to??BigInt(0);oo.add(SystemProgram.transfer({fromPubkey:ao,lamports:lo,toPubkey:so}))}const{blockhash:co}=yield this.connection.getLatestBlockhash();return oo.feePayer=new PublicKey$2(this.from),oo.recentBlockhash=co,oo})}createTransactionSafe(){return __awaiter$1(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}}assertPackageVersion("@dynamic-labs/solana-core",version$2);var naclFast={exports:{}};(function(Xr){(function(eo){var to=function(Yo){var _l,Sl=new Float64Array(16);if(Yo)for(_l=0;_l>24&255,Yo[_l+1]=Sl>>16&255,Yo[_l+2]=Sl>>8&255,Yo[_l+3]=Sl&255,Yo[_l+4]=Wo>>24&255,Yo[_l+5]=Wo>>16&255,Yo[_l+6]=Wo>>8&255,Yo[_l+7]=Wo&255}function vo(Yo,_l,Sl,Wo,xl){var Ql,Fl=0;for(Ql=0;Ql>>8)-1}function wo(Yo,_l,Sl,Wo){return vo(Yo,_l,Sl,Wo,16)}function Eo(Yo,_l,Sl,Wo){return vo(Yo,_l,Sl,Wo,32)}function ko(Yo,_l,Sl,Wo){for(var xl=Wo[0]&255|(Wo[1]&255)<<8|(Wo[2]&255)<<16|(Wo[3]&255)<<24,Ql=Sl[0]&255|(Sl[1]&255)<<8|(Sl[2]&255)<<16|(Sl[3]&255)<<24,Fl=Sl[4]&255|(Sl[5]&255)<<8|(Sl[6]&255)<<16|(Sl[7]&255)<<24,Jl=Sl[8]&255|(Sl[9]&255)<<8|(Sl[10]&255)<<16|(Sl[11]&255)<<24,xu=Sl[12]&255|(Sl[13]&255)<<8|(Sl[14]&255)<<16|(Sl[15]&255)<<24,lu=Wo[4]&255|(Wo[5]&255)<<8|(Wo[6]&255)<<16|(Wo[7]&255)<<24,su=_l[0]&255|(_l[1]&255)<<8|(_l[2]&255)<<16|(_l[3]&255)<<24,Xu=_l[4]&255|(_l[5]&255)<<8|(_l[6]&255)<<16|(_l[7]&255)<<24,ju=_l[8]&255|(_l[9]&255)<<8|(_l[10]&255)<<16|(_l[11]&255)<<24,zu=_l[12]&255|(_l[13]&255)<<8|(_l[14]&255)<<16|(_l[15]&255)<<24,Ku=Wo[8]&255|(Wo[9]&255)<<8|(Wo[10]&255)<<16|(Wo[11]&255)<<24,Hu=Sl[16]&255|(Sl[17]&255)<<8|(Sl[18]&255)<<16|(Sl[19]&255)<<24,Gu=Sl[20]&255|(Sl[21]&255)<<8|(Sl[22]&255)<<16|(Sl[23]&255)<<24,Zu=Sl[24]&255|(Sl[25]&255)<<8|(Sl[26]&255)<<16|(Sl[27]&255)<<24,Vu=Sl[28]&255|(Sl[29]&255)<<8|(Sl[30]&255)<<16|(Sl[31]&255)<<24,Ju=Wo[12]&255|(Wo[13]&255)<<8|(Wo[14]&255)<<16|(Wo[15]&255)<<24,Uu=xl,qu=Ql,Mu=Fl,Bu=Jl,Au=xu,Du=lu,wu=su,vu=Xu,Cu=ju,Eu=zu,Ru=Ku,Lu=Hu,ep=Gu,rp=Zu,ip=Vu,np=Ju,nu,lp=0;lp<20;lp+=2)nu=Uu+ep|0,Au^=nu<<7|nu>>>25,nu=Au+Uu|0,Cu^=nu<<9|nu>>>23,nu=Cu+Au|0,ep^=nu<<13|nu>>>19,nu=ep+Cu|0,Uu^=nu<<18|nu>>>14,nu=Du+qu|0,Eu^=nu<<7|nu>>>25,nu=Eu+Du|0,rp^=nu<<9|nu>>>23,nu=rp+Eu|0,qu^=nu<<13|nu>>>19,nu=qu+rp|0,Du^=nu<<18|nu>>>14,nu=Ru+wu|0,ip^=nu<<7|nu>>>25,nu=ip+Ru|0,Mu^=nu<<9|nu>>>23,nu=Mu+ip|0,wu^=nu<<13|nu>>>19,nu=wu+Mu|0,Ru^=nu<<18|nu>>>14,nu=np+Lu|0,Bu^=nu<<7|nu>>>25,nu=Bu+np|0,vu^=nu<<9|nu>>>23,nu=vu+Bu|0,Lu^=nu<<13|nu>>>19,nu=Lu+vu|0,np^=nu<<18|nu>>>14,nu=Uu+Bu|0,qu^=nu<<7|nu>>>25,nu=qu+Uu|0,Mu^=nu<<9|nu>>>23,nu=Mu+qu|0,Bu^=nu<<13|nu>>>19,nu=Bu+Mu|0,Uu^=nu<<18|nu>>>14,nu=Du+Au|0,wu^=nu<<7|nu>>>25,nu=wu+Du|0,vu^=nu<<9|nu>>>23,nu=vu+wu|0,Au^=nu<<13|nu>>>19,nu=Au+vu|0,Du^=nu<<18|nu>>>14,nu=Ru+Eu|0,Lu^=nu<<7|nu>>>25,nu=Lu+Ru|0,Cu^=nu<<9|nu>>>23,nu=Cu+Lu|0,Eu^=nu<<13|nu>>>19,nu=Eu+Cu|0,Ru^=nu<<18|nu>>>14,nu=np+ip|0,ep^=nu<<7|nu>>>25,nu=ep+np|0,rp^=nu<<9|nu>>>23,nu=rp+ep|0,ip^=nu<<13|nu>>>19,nu=ip+rp|0,np^=nu<<18|nu>>>14;Uu=Uu+xl|0,qu=qu+Ql|0,Mu=Mu+Fl|0,Bu=Bu+Jl|0,Au=Au+xu|0,Du=Du+lu|0,wu=wu+su|0,vu=vu+Xu|0,Cu=Cu+ju|0,Eu=Eu+zu|0,Ru=Ru+Ku|0,Lu=Lu+Hu|0,ep=ep+Gu|0,rp=rp+Zu|0,ip=ip+Vu|0,np=np+Ju|0,Yo[0]=Uu>>>0&255,Yo[1]=Uu>>>8&255,Yo[2]=Uu>>>16&255,Yo[3]=Uu>>>24&255,Yo[4]=qu>>>0&255,Yo[5]=qu>>>8&255,Yo[6]=qu>>>16&255,Yo[7]=qu>>>24&255,Yo[8]=Mu>>>0&255,Yo[9]=Mu>>>8&255,Yo[10]=Mu>>>16&255,Yo[11]=Mu>>>24&255,Yo[12]=Bu>>>0&255,Yo[13]=Bu>>>8&255,Yo[14]=Bu>>>16&255,Yo[15]=Bu>>>24&255,Yo[16]=Au>>>0&255,Yo[17]=Au>>>8&255,Yo[18]=Au>>>16&255,Yo[19]=Au>>>24&255,Yo[20]=Du>>>0&255,Yo[21]=Du>>>8&255,Yo[22]=Du>>>16&255,Yo[23]=Du>>>24&255,Yo[24]=wu>>>0&255,Yo[25]=wu>>>8&255,Yo[26]=wu>>>16&255,Yo[27]=wu>>>24&255,Yo[28]=vu>>>0&255,Yo[29]=vu>>>8&255,Yo[30]=vu>>>16&255,Yo[31]=vu>>>24&255,Yo[32]=Cu>>>0&255,Yo[33]=Cu>>>8&255,Yo[34]=Cu>>>16&255,Yo[35]=Cu>>>24&255,Yo[36]=Eu>>>0&255,Yo[37]=Eu>>>8&255,Yo[38]=Eu>>>16&255,Yo[39]=Eu>>>24&255,Yo[40]=Ru>>>0&255,Yo[41]=Ru>>>8&255,Yo[42]=Ru>>>16&255,Yo[43]=Ru>>>24&255,Yo[44]=Lu>>>0&255,Yo[45]=Lu>>>8&255,Yo[46]=Lu>>>16&255,Yo[47]=Lu>>>24&255,Yo[48]=ep>>>0&255,Yo[49]=ep>>>8&255,Yo[50]=ep>>>16&255,Yo[51]=ep>>>24&255,Yo[52]=rp>>>0&255,Yo[53]=rp>>>8&255,Yo[54]=rp>>>16&255,Yo[55]=rp>>>24&255,Yo[56]=ip>>>0&255,Yo[57]=ip>>>8&255,Yo[58]=ip>>>16&255,Yo[59]=ip>>>24&255,Yo[60]=np>>>0&255,Yo[61]=np>>>8&255,Yo[62]=np>>>16&255,Yo[63]=np>>>24&255}function Ao(Yo,_l,Sl,Wo){for(var xl=Wo[0]&255|(Wo[1]&255)<<8|(Wo[2]&255)<<16|(Wo[3]&255)<<24,Ql=Sl[0]&255|(Sl[1]&255)<<8|(Sl[2]&255)<<16|(Sl[3]&255)<<24,Fl=Sl[4]&255|(Sl[5]&255)<<8|(Sl[6]&255)<<16|(Sl[7]&255)<<24,Jl=Sl[8]&255|(Sl[9]&255)<<8|(Sl[10]&255)<<16|(Sl[11]&255)<<24,xu=Sl[12]&255|(Sl[13]&255)<<8|(Sl[14]&255)<<16|(Sl[15]&255)<<24,lu=Wo[4]&255|(Wo[5]&255)<<8|(Wo[6]&255)<<16|(Wo[7]&255)<<24,su=_l[0]&255|(_l[1]&255)<<8|(_l[2]&255)<<16|(_l[3]&255)<<24,Xu=_l[4]&255|(_l[5]&255)<<8|(_l[6]&255)<<16|(_l[7]&255)<<24,ju=_l[8]&255|(_l[9]&255)<<8|(_l[10]&255)<<16|(_l[11]&255)<<24,zu=_l[12]&255|(_l[13]&255)<<8|(_l[14]&255)<<16|(_l[15]&255)<<24,Ku=Wo[8]&255|(Wo[9]&255)<<8|(Wo[10]&255)<<16|(Wo[11]&255)<<24,Hu=Sl[16]&255|(Sl[17]&255)<<8|(Sl[18]&255)<<16|(Sl[19]&255)<<24,Gu=Sl[20]&255|(Sl[21]&255)<<8|(Sl[22]&255)<<16|(Sl[23]&255)<<24,Zu=Sl[24]&255|(Sl[25]&255)<<8|(Sl[26]&255)<<16|(Sl[27]&255)<<24,Vu=Sl[28]&255|(Sl[29]&255)<<8|(Sl[30]&255)<<16|(Sl[31]&255)<<24,Ju=Wo[12]&255|(Wo[13]&255)<<8|(Wo[14]&255)<<16|(Wo[15]&255)<<24,Uu=xl,qu=Ql,Mu=Fl,Bu=Jl,Au=xu,Du=lu,wu=su,vu=Xu,Cu=ju,Eu=zu,Ru=Ku,Lu=Hu,ep=Gu,rp=Zu,ip=Vu,np=Ju,nu,lp=0;lp<20;lp+=2)nu=Uu+ep|0,Au^=nu<<7|nu>>>25,nu=Au+Uu|0,Cu^=nu<<9|nu>>>23,nu=Cu+Au|0,ep^=nu<<13|nu>>>19,nu=ep+Cu|0,Uu^=nu<<18|nu>>>14,nu=Du+qu|0,Eu^=nu<<7|nu>>>25,nu=Eu+Du|0,rp^=nu<<9|nu>>>23,nu=rp+Eu|0,qu^=nu<<13|nu>>>19,nu=qu+rp|0,Du^=nu<<18|nu>>>14,nu=Ru+wu|0,ip^=nu<<7|nu>>>25,nu=ip+Ru|0,Mu^=nu<<9|nu>>>23,nu=Mu+ip|0,wu^=nu<<13|nu>>>19,nu=wu+Mu|0,Ru^=nu<<18|nu>>>14,nu=np+Lu|0,Bu^=nu<<7|nu>>>25,nu=Bu+np|0,vu^=nu<<9|nu>>>23,nu=vu+Bu|0,Lu^=nu<<13|nu>>>19,nu=Lu+vu|0,np^=nu<<18|nu>>>14,nu=Uu+Bu|0,qu^=nu<<7|nu>>>25,nu=qu+Uu|0,Mu^=nu<<9|nu>>>23,nu=Mu+qu|0,Bu^=nu<<13|nu>>>19,nu=Bu+Mu|0,Uu^=nu<<18|nu>>>14,nu=Du+Au|0,wu^=nu<<7|nu>>>25,nu=wu+Du|0,vu^=nu<<9|nu>>>23,nu=vu+wu|0,Au^=nu<<13|nu>>>19,nu=Au+vu|0,Du^=nu<<18|nu>>>14,nu=Ru+Eu|0,Lu^=nu<<7|nu>>>25,nu=Lu+Ru|0,Cu^=nu<<9|nu>>>23,nu=Cu+Lu|0,Eu^=nu<<13|nu>>>19,nu=Eu+Cu|0,Ru^=nu<<18|nu>>>14,nu=np+ip|0,ep^=nu<<7|nu>>>25,nu=ep+np|0,rp^=nu<<9|nu>>>23,nu=rp+ep|0,ip^=nu<<13|nu>>>19,nu=ip+rp|0,np^=nu<<18|nu>>>14;Yo[0]=Uu>>>0&255,Yo[1]=Uu>>>8&255,Yo[2]=Uu>>>16&255,Yo[3]=Uu>>>24&255,Yo[4]=Du>>>0&255,Yo[5]=Du>>>8&255,Yo[6]=Du>>>16&255,Yo[7]=Du>>>24&255,Yo[8]=Ru>>>0&255,Yo[9]=Ru>>>8&255,Yo[10]=Ru>>>16&255,Yo[11]=Ru>>>24&255,Yo[12]=np>>>0&255,Yo[13]=np>>>8&255,Yo[14]=np>>>16&255,Yo[15]=np>>>24&255,Yo[16]=wu>>>0&255,Yo[17]=wu>>>8&255,Yo[18]=wu>>>16&255,Yo[19]=wu>>>24&255,Yo[20]=vu>>>0&255,Yo[21]=vu>>>8&255,Yo[22]=vu>>>16&255,Yo[23]=vu>>>24&255,Yo[24]=Cu>>>0&255,Yo[25]=Cu>>>8&255,Yo[26]=Cu>>>16&255,Yo[27]=Cu>>>24&255,Yo[28]=Eu>>>0&255,Yo[29]=Eu>>>8&255,Yo[30]=Eu>>>16&255,Yo[31]=Eu>>>24&255}function Po(Yo,_l,Sl,Wo){ko(Yo,_l,Sl,Wo)}function jo(Yo,_l,Sl,Wo){Ao(Yo,_l,Sl,Wo)}var Mo=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function No(Yo,_l,Sl,Wo,xl,Ql,Fl){var Jl=new Uint8Array(16),xu=new Uint8Array(64),lu,su;for(su=0;su<16;su++)Jl[su]=0;for(su=0;su<8;su++)Jl[su]=Ql[su];for(;xl>=64;){for(Po(xu,Jl,Fl,Mo),su=0;su<64;su++)Yo[_l+su]=Sl[Wo+su]^xu[su];for(lu=1,su=8;su<16;su++)lu=lu+(Jl[su]&255)|0,Jl[su]=lu&255,lu>>>=8;xl-=64,_l+=64,Wo+=64}if(xl>0)for(Po(xu,Jl,Fl,Mo),su=0;su=64;){for(Po(Fl,Ql,xl,Mo),xu=0;xu<64;xu++)Yo[_l+xu]=Fl[xu];for(Jl=1,xu=8;xu<16;xu++)Jl=Jl+(Ql[xu]&255)|0,Ql[xu]=Jl&255,Jl>>>=8;Sl-=64,_l+=64}if(Sl>0)for(Po(Fl,Ql,xl,Mo),xu=0;xu>>13|Sl<<3)&8191,Wo=Yo[4]&255|(Yo[5]&255)<<8,this.r[2]=(Sl>>>10|Wo<<6)&7939,xl=Yo[6]&255|(Yo[7]&255)<<8,this.r[3]=(Wo>>>7|xl<<9)&8191,Ql=Yo[8]&255|(Yo[9]&255)<<8,this.r[4]=(xl>>>4|Ql<<12)&255,this.r[5]=Ql>>>1&8190,Fl=Yo[10]&255|(Yo[11]&255)<<8,this.r[6]=(Ql>>>14|Fl<<2)&8191,Jl=Yo[12]&255|(Yo[13]&255)<<8,this.r[7]=(Fl>>>11|Jl<<5)&8065,xu=Yo[14]&255|(Yo[15]&255)<<8,this.r[8]=(Jl>>>8|xu<<8)&8191,this.r[9]=xu>>>5&127,this.pad[0]=Yo[16]&255|(Yo[17]&255)<<8,this.pad[1]=Yo[18]&255|(Yo[19]&255)<<8,this.pad[2]=Yo[20]&255|(Yo[21]&255)<<8,this.pad[3]=Yo[22]&255|(Yo[23]&255)<<8,this.pad[4]=Yo[24]&255|(Yo[25]&255)<<8,this.pad[5]=Yo[26]&255|(Yo[27]&255)<<8,this.pad[6]=Yo[28]&255|(Yo[29]&255)<<8,this.pad[7]=Yo[30]&255|(Yo[31]&255)<<8};Lo.prototype.blocks=function(Yo,_l,Sl){for(var Wo=this.fin?0:2048,xl,Ql,Fl,Jl,xu,lu,su,Xu,ju,zu,Ku,Hu,Gu,Zu,Vu,Ju,Uu,qu,Mu,Bu=this.h[0],Au=this.h[1],Du=this.h[2],wu=this.h[3],vu=this.h[4],Cu=this.h[5],Eu=this.h[6],Ru=this.h[7],Lu=this.h[8],ep=this.h[9],rp=this.r[0],ip=this.r[1],np=this.r[2],nu=this.r[3],lp=this.r[4],yp=this.r[5],up=this.r[6],op=this.r[7],bp=this.r[8],dp=this.r[9];Sl>=16;)xl=Yo[_l+0]&255|(Yo[_l+1]&255)<<8,Bu+=xl&8191,Ql=Yo[_l+2]&255|(Yo[_l+3]&255)<<8,Au+=(xl>>>13|Ql<<3)&8191,Fl=Yo[_l+4]&255|(Yo[_l+5]&255)<<8,Du+=(Ql>>>10|Fl<<6)&8191,Jl=Yo[_l+6]&255|(Yo[_l+7]&255)<<8,wu+=(Fl>>>7|Jl<<9)&8191,xu=Yo[_l+8]&255|(Yo[_l+9]&255)<<8,vu+=(Jl>>>4|xu<<12)&8191,Cu+=xu>>>1&8191,lu=Yo[_l+10]&255|(Yo[_l+11]&255)<<8,Eu+=(xu>>>14|lu<<2)&8191,su=Yo[_l+12]&255|(Yo[_l+13]&255)<<8,Ru+=(lu>>>11|su<<5)&8191,Xu=Yo[_l+14]&255|(Yo[_l+15]&255)<<8,Lu+=(su>>>8|Xu<<8)&8191,ep+=Xu>>>5|Wo,ju=0,zu=ju,zu+=Bu*rp,zu+=Au*(5*dp),zu+=Du*(5*bp),zu+=wu*(5*op),zu+=vu*(5*up),ju=zu>>>13,zu&=8191,zu+=Cu*(5*yp),zu+=Eu*(5*lp),zu+=Ru*(5*nu),zu+=Lu*(5*np),zu+=ep*(5*ip),ju+=zu>>>13,zu&=8191,Ku=ju,Ku+=Bu*ip,Ku+=Au*rp,Ku+=Du*(5*dp),Ku+=wu*(5*bp),Ku+=vu*(5*op),ju=Ku>>>13,Ku&=8191,Ku+=Cu*(5*up),Ku+=Eu*(5*yp),Ku+=Ru*(5*lp),Ku+=Lu*(5*nu),Ku+=ep*(5*np),ju+=Ku>>>13,Ku&=8191,Hu=ju,Hu+=Bu*np,Hu+=Au*ip,Hu+=Du*rp,Hu+=wu*(5*dp),Hu+=vu*(5*bp),ju=Hu>>>13,Hu&=8191,Hu+=Cu*(5*op),Hu+=Eu*(5*up),Hu+=Ru*(5*yp),Hu+=Lu*(5*lp),Hu+=ep*(5*nu),ju+=Hu>>>13,Hu&=8191,Gu=ju,Gu+=Bu*nu,Gu+=Au*np,Gu+=Du*ip,Gu+=wu*rp,Gu+=vu*(5*dp),ju=Gu>>>13,Gu&=8191,Gu+=Cu*(5*bp),Gu+=Eu*(5*op),Gu+=Ru*(5*up),Gu+=Lu*(5*yp),Gu+=ep*(5*lp),ju+=Gu>>>13,Gu&=8191,Zu=ju,Zu+=Bu*lp,Zu+=Au*nu,Zu+=Du*np,Zu+=wu*ip,Zu+=vu*rp,ju=Zu>>>13,Zu&=8191,Zu+=Cu*(5*dp),Zu+=Eu*(5*bp),Zu+=Ru*(5*op),Zu+=Lu*(5*up),Zu+=ep*(5*yp),ju+=Zu>>>13,Zu&=8191,Vu=ju,Vu+=Bu*yp,Vu+=Au*lp,Vu+=Du*nu,Vu+=wu*np,Vu+=vu*ip,ju=Vu>>>13,Vu&=8191,Vu+=Cu*rp,Vu+=Eu*(5*dp),Vu+=Ru*(5*bp),Vu+=Lu*(5*op),Vu+=ep*(5*up),ju+=Vu>>>13,Vu&=8191,Ju=ju,Ju+=Bu*up,Ju+=Au*yp,Ju+=Du*lp,Ju+=wu*nu,Ju+=vu*np,ju=Ju>>>13,Ju&=8191,Ju+=Cu*ip,Ju+=Eu*rp,Ju+=Ru*(5*dp),Ju+=Lu*(5*bp),Ju+=ep*(5*op),ju+=Ju>>>13,Ju&=8191,Uu=ju,Uu+=Bu*op,Uu+=Au*up,Uu+=Du*yp,Uu+=wu*lp,Uu+=vu*nu,ju=Uu>>>13,Uu&=8191,Uu+=Cu*np,Uu+=Eu*ip,Uu+=Ru*rp,Uu+=Lu*(5*dp),Uu+=ep*(5*bp),ju+=Uu>>>13,Uu&=8191,qu=ju,qu+=Bu*bp,qu+=Au*op,qu+=Du*up,qu+=wu*yp,qu+=vu*lp,ju=qu>>>13,qu&=8191,qu+=Cu*nu,qu+=Eu*np,qu+=Ru*ip,qu+=Lu*rp,qu+=ep*(5*dp),ju+=qu>>>13,qu&=8191,Mu=ju,Mu+=Bu*dp,Mu+=Au*bp,Mu+=Du*op,Mu+=wu*up,Mu+=vu*yp,ju=Mu>>>13,Mu&=8191,Mu+=Cu*lp,Mu+=Eu*nu,Mu+=Ru*np,Mu+=Lu*ip,Mu+=ep*rp,ju+=Mu>>>13,Mu&=8191,ju=(ju<<2)+ju|0,ju=ju+zu|0,zu=ju&8191,ju=ju>>>13,Ku+=ju,Bu=zu,Au=Ku,Du=Hu,wu=Gu,vu=Zu,Cu=Vu,Eu=Ju,Ru=Uu,Lu=qu,ep=Mu,_l+=16,Sl-=16;this.h[0]=Bu,this.h[1]=Au,this.h[2]=Du,this.h[3]=wu,this.h[4]=vu,this.h[5]=Cu,this.h[6]=Eu,this.h[7]=Ru,this.h[8]=Lu,this.h[9]=ep},Lo.prototype.finish=function(Yo,_l){var Sl=new Uint16Array(10),Wo,xl,Ql,Fl;if(this.leftover){for(Fl=this.leftover,this.buffer[Fl++]=1;Fl<16;Fl++)this.buffer[Fl]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(Wo=this.h[1]>>>13,this.h[1]&=8191,Fl=2;Fl<10;Fl++)this.h[Fl]+=Wo,Wo=this.h[Fl]>>>13,this.h[Fl]&=8191;for(this.h[0]+=Wo*5,Wo=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=Wo,Wo=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=Wo,Sl[0]=this.h[0]+5,Wo=Sl[0]>>>13,Sl[0]&=8191,Fl=1;Fl<10;Fl++)Sl[Fl]=this.h[Fl]+Wo,Wo=Sl[Fl]>>>13,Sl[Fl]&=8191;for(Sl[9]-=8192,xl=(Wo^1)-1,Fl=0;Fl<10;Fl++)Sl[Fl]&=xl;for(xl=~xl,Fl=0;Fl<10;Fl++)this.h[Fl]=this.h[Fl]&xl|Sl[Fl];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Ql=this.h[0]+this.pad[0],this.h[0]=Ql&65535,Fl=1;Fl<8;Fl++)Ql=(this.h[Fl]+this.pad[Fl]|0)+(Ql>>>16)|0,this.h[Fl]=Ql&65535;Yo[_l+0]=this.h[0]>>>0&255,Yo[_l+1]=this.h[0]>>>8&255,Yo[_l+2]=this.h[1]>>>0&255,Yo[_l+3]=this.h[1]>>>8&255,Yo[_l+4]=this.h[2]>>>0&255,Yo[_l+5]=this.h[2]>>>8&255,Yo[_l+6]=this.h[3]>>>0&255,Yo[_l+7]=this.h[3]>>>8&255,Yo[_l+8]=this.h[4]>>>0&255,Yo[_l+9]=this.h[4]>>>8&255,Yo[_l+10]=this.h[5]>>>0&255,Yo[_l+11]=this.h[5]>>>8&255,Yo[_l+12]=this.h[6]>>>0&255,Yo[_l+13]=this.h[6]>>>8&255,Yo[_l+14]=this.h[7]>>>0&255,Yo[_l+15]=this.h[7]>>>8&255},Lo.prototype.update=function(Yo,_l,Sl){var Wo,xl;if(this.leftover){for(xl=16-this.leftover,xl>Sl&&(xl=Sl),Wo=0;Wo=16&&(xl=Sl-Sl%16,this.blocks(Yo,_l,xl),_l+=xl,Sl-=xl),Sl){for(Wo=0;Wo>16&1),Ql[Sl-1]&=65535;Ql[15]=Fl[15]-32767-(Ql[14]>>16&1),xl=Ql[15]>>16&1,Ql[14]&=65535,$o(Fl,Ql,1-xl)}for(Sl=0;Sl<16;Sl++)Yo[2*Sl]=Fl[Sl]&255,Yo[2*Sl+1]=Fl[Sl]>>8}function Ro(Yo,_l){var Sl=new Uint8Array(32),Wo=new Uint8Array(32);return Co(Sl,Yo),Co(Wo,_l),Eo(Sl,0,Wo,0)}function So(Yo){var _l=new Uint8Array(32);return Co(_l,Yo),_l[0]&1}function mo(Yo,_l){var Sl;for(Sl=0;Sl<16;Sl++)Yo[Sl]=_l[2*Sl]+(_l[2*Sl+1]<<8);Yo[15]&=32767}function To(Yo,_l,Sl){for(var Wo=0;Wo<16;Wo++)Yo[Wo]=_l[Wo]+Sl[Wo]}function Vo(Yo,_l,Sl){for(var Wo=0;Wo<16;Wo++)Yo[Wo]=_l[Wo]-Sl[Wo]}function Zo(Yo,_l,Sl){var Wo,xl,Ql=0,Fl=0,Jl=0,xu=0,lu=0,su=0,Xu=0,ju=0,zu=0,Ku=0,Hu=0,Gu=0,Zu=0,Vu=0,Ju=0,Uu=0,qu=0,Mu=0,Bu=0,Au=0,Du=0,wu=0,vu=0,Cu=0,Eu=0,Ru=0,Lu=0,ep=0,rp=0,ip=0,np=0,nu=Sl[0],lp=Sl[1],yp=Sl[2],up=Sl[3],op=Sl[4],bp=Sl[5],dp=Sl[6],Ep=Sl[7],pp=Sl[8],wp=Sl[9],Ap=Sl[10],fp=Sl[11],Tp=Sl[12],Lp=Sl[13],zp=Sl[14],Hp=Sl[15];Wo=_l[0],Ql+=Wo*nu,Fl+=Wo*lp,Jl+=Wo*yp,xu+=Wo*up,lu+=Wo*op,su+=Wo*bp,Xu+=Wo*dp,ju+=Wo*Ep,zu+=Wo*pp,Ku+=Wo*wp,Hu+=Wo*Ap,Gu+=Wo*fp,Zu+=Wo*Tp,Vu+=Wo*Lp,Ju+=Wo*zp,Uu+=Wo*Hp,Wo=_l[1],Fl+=Wo*nu,Jl+=Wo*lp,xu+=Wo*yp,lu+=Wo*up,su+=Wo*op,Xu+=Wo*bp,ju+=Wo*dp,zu+=Wo*Ep,Ku+=Wo*pp,Hu+=Wo*wp,Gu+=Wo*Ap,Zu+=Wo*fp,Vu+=Wo*Tp,Ju+=Wo*Lp,Uu+=Wo*zp,qu+=Wo*Hp,Wo=_l[2],Jl+=Wo*nu,xu+=Wo*lp,lu+=Wo*yp,su+=Wo*up,Xu+=Wo*op,ju+=Wo*bp,zu+=Wo*dp,Ku+=Wo*Ep,Hu+=Wo*pp,Gu+=Wo*wp,Zu+=Wo*Ap,Vu+=Wo*fp,Ju+=Wo*Tp,Uu+=Wo*Lp,qu+=Wo*zp,Mu+=Wo*Hp,Wo=_l[3],xu+=Wo*nu,lu+=Wo*lp,su+=Wo*yp,Xu+=Wo*up,ju+=Wo*op,zu+=Wo*bp,Ku+=Wo*dp,Hu+=Wo*Ep,Gu+=Wo*pp,Zu+=Wo*wp,Vu+=Wo*Ap,Ju+=Wo*fp,Uu+=Wo*Tp,qu+=Wo*Lp,Mu+=Wo*zp,Bu+=Wo*Hp,Wo=_l[4],lu+=Wo*nu,su+=Wo*lp,Xu+=Wo*yp,ju+=Wo*up,zu+=Wo*op,Ku+=Wo*bp,Hu+=Wo*dp,Gu+=Wo*Ep,Zu+=Wo*pp,Vu+=Wo*wp,Ju+=Wo*Ap,Uu+=Wo*fp,qu+=Wo*Tp,Mu+=Wo*Lp,Bu+=Wo*zp,Au+=Wo*Hp,Wo=_l[5],su+=Wo*nu,Xu+=Wo*lp,ju+=Wo*yp,zu+=Wo*up,Ku+=Wo*op,Hu+=Wo*bp,Gu+=Wo*dp,Zu+=Wo*Ep,Vu+=Wo*pp,Ju+=Wo*wp,Uu+=Wo*Ap,qu+=Wo*fp,Mu+=Wo*Tp,Bu+=Wo*Lp,Au+=Wo*zp,Du+=Wo*Hp,Wo=_l[6],Xu+=Wo*nu,ju+=Wo*lp,zu+=Wo*yp,Ku+=Wo*up,Hu+=Wo*op,Gu+=Wo*bp,Zu+=Wo*dp,Vu+=Wo*Ep,Ju+=Wo*pp,Uu+=Wo*wp,qu+=Wo*Ap,Mu+=Wo*fp,Bu+=Wo*Tp,Au+=Wo*Lp,Du+=Wo*zp,wu+=Wo*Hp,Wo=_l[7],ju+=Wo*nu,zu+=Wo*lp,Ku+=Wo*yp,Hu+=Wo*up,Gu+=Wo*op,Zu+=Wo*bp,Vu+=Wo*dp,Ju+=Wo*Ep,Uu+=Wo*pp,qu+=Wo*wp,Mu+=Wo*Ap,Bu+=Wo*fp,Au+=Wo*Tp,Du+=Wo*Lp,wu+=Wo*zp,vu+=Wo*Hp,Wo=_l[8],zu+=Wo*nu,Ku+=Wo*lp,Hu+=Wo*yp,Gu+=Wo*up,Zu+=Wo*op,Vu+=Wo*bp,Ju+=Wo*dp,Uu+=Wo*Ep,qu+=Wo*pp,Mu+=Wo*wp,Bu+=Wo*Ap,Au+=Wo*fp,Du+=Wo*Tp,wu+=Wo*Lp,vu+=Wo*zp,Cu+=Wo*Hp,Wo=_l[9],Ku+=Wo*nu,Hu+=Wo*lp,Gu+=Wo*yp,Zu+=Wo*up,Vu+=Wo*op,Ju+=Wo*bp,Uu+=Wo*dp,qu+=Wo*Ep,Mu+=Wo*pp,Bu+=Wo*wp,Au+=Wo*Ap,Du+=Wo*fp,wu+=Wo*Tp,vu+=Wo*Lp,Cu+=Wo*zp,Eu+=Wo*Hp,Wo=_l[10],Hu+=Wo*nu,Gu+=Wo*lp,Zu+=Wo*yp,Vu+=Wo*up,Ju+=Wo*op,Uu+=Wo*bp,qu+=Wo*dp,Mu+=Wo*Ep,Bu+=Wo*pp,Au+=Wo*wp,Du+=Wo*Ap,wu+=Wo*fp,vu+=Wo*Tp,Cu+=Wo*Lp,Eu+=Wo*zp,Ru+=Wo*Hp,Wo=_l[11],Gu+=Wo*nu,Zu+=Wo*lp,Vu+=Wo*yp,Ju+=Wo*up,Uu+=Wo*op,qu+=Wo*bp,Mu+=Wo*dp,Bu+=Wo*Ep,Au+=Wo*pp,Du+=Wo*wp,wu+=Wo*Ap,vu+=Wo*fp,Cu+=Wo*Tp,Eu+=Wo*Lp,Ru+=Wo*zp,Lu+=Wo*Hp,Wo=_l[12],Zu+=Wo*nu,Vu+=Wo*lp,Ju+=Wo*yp,Uu+=Wo*up,qu+=Wo*op,Mu+=Wo*bp,Bu+=Wo*dp,Au+=Wo*Ep,Du+=Wo*pp,wu+=Wo*wp,vu+=Wo*Ap,Cu+=Wo*fp,Eu+=Wo*Tp,Ru+=Wo*Lp,Lu+=Wo*zp,ep+=Wo*Hp,Wo=_l[13],Vu+=Wo*nu,Ju+=Wo*lp,Uu+=Wo*yp,qu+=Wo*up,Mu+=Wo*op,Bu+=Wo*bp,Au+=Wo*dp,Du+=Wo*Ep,wu+=Wo*pp,vu+=Wo*wp,Cu+=Wo*Ap,Eu+=Wo*fp,Ru+=Wo*Tp,Lu+=Wo*Lp,ep+=Wo*zp,rp+=Wo*Hp,Wo=_l[14],Ju+=Wo*nu,Uu+=Wo*lp,qu+=Wo*yp,Mu+=Wo*up,Bu+=Wo*op,Au+=Wo*bp,Du+=Wo*dp,wu+=Wo*Ep,vu+=Wo*pp,Cu+=Wo*wp,Eu+=Wo*Ap,Ru+=Wo*fp,Lu+=Wo*Tp,ep+=Wo*Lp,rp+=Wo*zp,ip+=Wo*Hp,Wo=_l[15],Uu+=Wo*nu,qu+=Wo*lp,Mu+=Wo*yp,Bu+=Wo*up,Au+=Wo*op,Du+=Wo*bp,wu+=Wo*dp,vu+=Wo*Ep,Cu+=Wo*pp,Eu+=Wo*wp,Ru+=Wo*Ap,Lu+=Wo*fp,ep+=Wo*Tp,rp+=Wo*Lp,ip+=Wo*zp,np+=Wo*Hp,Ql+=38*qu,Fl+=38*Mu,Jl+=38*Bu,xu+=38*Au,lu+=38*Du,su+=38*wu,Xu+=38*vu,ju+=38*Cu,zu+=38*Eu,Ku+=38*Ru,Hu+=38*Lu,Gu+=38*ep,Zu+=38*rp,Vu+=38*ip,Ju+=38*np,xl=1,Wo=Ql+xl+65535,xl=Math.floor(Wo/65536),Ql=Wo-xl*65536,Wo=Fl+xl+65535,xl=Math.floor(Wo/65536),Fl=Wo-xl*65536,Wo=Jl+xl+65535,xl=Math.floor(Wo/65536),Jl=Wo-xl*65536,Wo=xu+xl+65535,xl=Math.floor(Wo/65536),xu=Wo-xl*65536,Wo=lu+xl+65535,xl=Math.floor(Wo/65536),lu=Wo-xl*65536,Wo=su+xl+65535,xl=Math.floor(Wo/65536),su=Wo-xl*65536,Wo=Xu+xl+65535,xl=Math.floor(Wo/65536),Xu=Wo-xl*65536,Wo=ju+xl+65535,xl=Math.floor(Wo/65536),ju=Wo-xl*65536,Wo=zu+xl+65535,xl=Math.floor(Wo/65536),zu=Wo-xl*65536,Wo=Ku+xl+65535,xl=Math.floor(Wo/65536),Ku=Wo-xl*65536,Wo=Hu+xl+65535,xl=Math.floor(Wo/65536),Hu=Wo-xl*65536,Wo=Gu+xl+65535,xl=Math.floor(Wo/65536),Gu=Wo-xl*65536,Wo=Zu+xl+65535,xl=Math.floor(Wo/65536),Zu=Wo-xl*65536,Wo=Vu+xl+65535,xl=Math.floor(Wo/65536),Vu=Wo-xl*65536,Wo=Ju+xl+65535,xl=Math.floor(Wo/65536),Ju=Wo-xl*65536,Wo=Uu+xl+65535,xl=Math.floor(Wo/65536),Uu=Wo-xl*65536,Ql+=xl-1+37*(xl-1),xl=1,Wo=Ql+xl+65535,xl=Math.floor(Wo/65536),Ql=Wo-xl*65536,Wo=Fl+xl+65535,xl=Math.floor(Wo/65536),Fl=Wo-xl*65536,Wo=Jl+xl+65535,xl=Math.floor(Wo/65536),Jl=Wo-xl*65536,Wo=xu+xl+65535,xl=Math.floor(Wo/65536),xu=Wo-xl*65536,Wo=lu+xl+65535,xl=Math.floor(Wo/65536),lu=Wo-xl*65536,Wo=su+xl+65535,xl=Math.floor(Wo/65536),su=Wo-xl*65536,Wo=Xu+xl+65535,xl=Math.floor(Wo/65536),Xu=Wo-xl*65536,Wo=ju+xl+65535,xl=Math.floor(Wo/65536),ju=Wo-xl*65536,Wo=zu+xl+65535,xl=Math.floor(Wo/65536),zu=Wo-xl*65536,Wo=Ku+xl+65535,xl=Math.floor(Wo/65536),Ku=Wo-xl*65536,Wo=Hu+xl+65535,xl=Math.floor(Wo/65536),Hu=Wo-xl*65536,Wo=Gu+xl+65535,xl=Math.floor(Wo/65536),Gu=Wo-xl*65536,Wo=Zu+xl+65535,xl=Math.floor(Wo/65536),Zu=Wo-xl*65536,Wo=Vu+xl+65535,xl=Math.floor(Wo/65536),Vu=Wo-xl*65536,Wo=Ju+xl+65535,xl=Math.floor(Wo/65536),Ju=Wo-xl*65536,Wo=Uu+xl+65535,xl=Math.floor(Wo/65536),Uu=Wo-xl*65536,Ql+=xl-1+37*(xl-1),Yo[0]=Ql,Yo[1]=Fl,Yo[2]=Jl,Yo[3]=xu,Yo[4]=lu,Yo[5]=su,Yo[6]=Xu,Yo[7]=ju,Yo[8]=zu,Yo[9]=Ku,Yo[10]=Hu,Yo[11]=Gu,Yo[12]=Zu,Yo[13]=Vu,Yo[14]=Ju,Yo[15]=Uu}function Qo(Yo,_l){Zo(Yo,_l,_l)}function qo(Yo,_l){var Sl=to(),Wo;for(Wo=0;Wo<16;Wo++)Sl[Wo]=_l[Wo];for(Wo=253;Wo>=0;Wo--)Qo(Sl,Sl),Wo!==2&&Wo!==4&&Zo(Sl,Sl,_l);for(Wo=0;Wo<16;Wo++)Yo[Wo]=Sl[Wo]}function Ho(Yo,_l){var Sl=to(),Wo;for(Wo=0;Wo<16;Wo++)Sl[Wo]=_l[Wo];for(Wo=250;Wo>=0;Wo--)Qo(Sl,Sl),Wo!==1&&Zo(Sl,Sl,_l);for(Wo=0;Wo<16;Wo++)Yo[Wo]=Sl[Wo]}function $a(Yo,_l,Sl){var Wo=new Uint8Array(32),xl=new Float64Array(80),Ql,Fl,Jl=to(),xu=to(),lu=to(),su=to(),Xu=to(),ju=to();for(Fl=0;Fl<31;Fl++)Wo[Fl]=_l[Fl];for(Wo[31]=_l[31]&127|64,Wo[0]&=248,mo(xl,Sl),Fl=0;Fl<16;Fl++)xu[Fl]=xl[Fl],su[Fl]=Jl[Fl]=lu[Fl]=0;for(Jl[0]=su[0]=1,Fl=254;Fl>=0;--Fl)Ql=Wo[Fl>>>3]>>>(Fl&7)&1,$o(Jl,xu,Ql),$o(lu,su,Ql),To(Xu,Jl,lu),Vo(Jl,Jl,lu),To(lu,xu,su),Vo(xu,xu,su),Qo(su,Xu),Qo(ju,Jl),Zo(Jl,lu,Jl),Zo(lu,xu,Xu),To(Xu,Jl,lu),Vo(Jl,Jl,lu),Qo(xu,Jl),Vo(lu,su,ju),Zo(Jl,lu,so),To(Jl,Jl,su),Zo(lu,lu,Jl),Zo(Jl,su,ju),Zo(su,xu,xl),Qo(xu,Xu),$o(Jl,xu,Ql),$o(lu,su,Ql);for(Fl=0;Fl<16;Fl++)xl[Fl+16]=Jl[Fl],xl[Fl+32]=lu[Fl],xl[Fl+48]=xu[Fl],xl[Fl+64]=su[Fl];var zu=xl.subarray(32),Ku=xl.subarray(16);return qo(zu,zu),Zo(Ku,Ku,zu),Co(Yo,Ku),0}function zo(Yo,_l){return $a(Yo,_l,io)}function Ko(Yo,_l){return ro(_l,32),zo(Yo,_l)}function _c(Yo,_l,Sl){var Wo=new Uint8Array(32);return $a(Wo,Sl,_l),jo(Yo,no,Wo,Mo)}var Cl=uo,ga=po;function El(Yo,_l,Sl,Wo,xl,Ql){var Fl=new Uint8Array(32);return _c(Fl,xl,Ql),Cl(Yo,_l,Sl,Wo,Fl)}function Al(Yo,_l,Sl,Wo,xl,Ql){var Fl=new Uint8Array(32);return _c(Fl,xl,Ql),ga(Yo,_l,Sl,Wo,Fl)}var Ol=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Wl(Yo,_l,Sl,Wo){for(var xl=new Int32Array(16),Ql=new Int32Array(16),Fl,Jl,xu,lu,su,Xu,ju,zu,Ku,Hu,Gu,Zu,Vu,Ju,Uu,qu,Mu,Bu,Au,Du,wu,vu,Cu,Eu,Ru,Lu,ep=Yo[0],rp=Yo[1],ip=Yo[2],np=Yo[3],nu=Yo[4],lp=Yo[5],yp=Yo[6],up=Yo[7],op=_l[0],bp=_l[1],dp=_l[2],Ep=_l[3],pp=_l[4],wp=_l[5],Ap=_l[6],fp=_l[7],Tp=0;Wo>=128;){for(Au=0;Au<16;Au++)Du=8*Au+Tp,xl[Au]=Sl[Du+0]<<24|Sl[Du+1]<<16|Sl[Du+2]<<8|Sl[Du+3],Ql[Au]=Sl[Du+4]<<24|Sl[Du+5]<<16|Sl[Du+6]<<8|Sl[Du+7];for(Au=0;Au<80;Au++)if(Fl=ep,Jl=rp,xu=ip,lu=np,su=nu,Xu=lp,ju=yp,zu=up,Ku=op,Hu=bp,Gu=dp,Zu=Ep,Vu=pp,Ju=wp,Uu=Ap,qu=fp,wu=up,vu=fp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=(nu>>>14|pp<<18)^(nu>>>18|pp<<14)^(pp>>>9|nu<<23),vu=(pp>>>14|nu<<18)^(pp>>>18|nu<<14)^(nu>>>9|pp<<23),Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,wu=nu&lp^~nu&yp,vu=pp&wp^~pp&Ap,Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,wu=Ol[Au*2],vu=Ol[Au*2+1],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,wu=xl[Au%16],vu=Ql[Au%16],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Mu=Ru&65535|Lu<<16,Bu=Cu&65535|Eu<<16,wu=Mu,vu=Bu,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=(ep>>>28|op<<4)^(op>>>2|ep<<30)^(op>>>7|ep<<25),vu=(op>>>28|ep<<4)^(ep>>>2|op<<30)^(ep>>>7|op<<25),Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,wu=ep&rp^ep&ip^rp&ip,vu=op&bp^op&dp^bp&dp,Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,zu=Ru&65535|Lu<<16,qu=Cu&65535|Eu<<16,wu=lu,vu=Zu,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Mu,vu=Bu,Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,lu=Ru&65535|Lu<<16,Zu=Cu&65535|Eu<<16,rp=Fl,ip=Jl,np=xu,nu=lu,lp=su,yp=Xu,up=ju,ep=zu,bp=Ku,dp=Hu,Ep=Gu,pp=Zu,wp=Vu,Ap=Ju,fp=Uu,op=qu,Au%16===15)for(Du=0;Du<16;Du++)wu=xl[Du],vu=Ql[Du],Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=xl[(Du+9)%16],vu=Ql[(Du+9)%16],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Mu=xl[(Du+1)%16],Bu=Ql[(Du+1)%16],wu=(Mu>>>1|Bu<<31)^(Mu>>>8|Bu<<24)^Mu>>>7,vu=(Bu>>>1|Mu<<31)^(Bu>>>8|Mu<<24)^(Bu>>>7|Mu<<25),Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Mu=xl[(Du+14)%16],Bu=Ql[(Du+14)%16],wu=(Mu>>>19|Bu<<13)^(Bu>>>29|Mu<<3)^Mu>>>6,vu=(Bu>>>19|Mu<<13)^(Mu>>>29|Bu<<3)^(Bu>>>6|Mu<<26),Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,xl[Du]=Ru&65535|Lu<<16,Ql[Du]=Cu&65535|Eu<<16;wu=ep,vu=op,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[0],vu=_l[0],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[0]=ep=Ru&65535|Lu<<16,_l[0]=op=Cu&65535|Eu<<16,wu=rp,vu=bp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[1],vu=_l[1],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[1]=rp=Ru&65535|Lu<<16,_l[1]=bp=Cu&65535|Eu<<16,wu=ip,vu=dp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[2],vu=_l[2],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[2]=ip=Ru&65535|Lu<<16,_l[2]=dp=Cu&65535|Eu<<16,wu=np,vu=Ep,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[3],vu=_l[3],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[3]=np=Ru&65535|Lu<<16,_l[3]=Ep=Cu&65535|Eu<<16,wu=nu,vu=pp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[4],vu=_l[4],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[4]=nu=Ru&65535|Lu<<16,_l[4]=pp=Cu&65535|Eu<<16,wu=lp,vu=wp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[5],vu=_l[5],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[5]=lp=Ru&65535|Lu<<16,_l[5]=wp=Cu&65535|Eu<<16,wu=yp,vu=Ap,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[6],vu=_l[6],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[6]=yp=Ru&65535|Lu<<16,_l[6]=Ap=Cu&65535|Eu<<16,wu=up,vu=fp,Cu=vu&65535,Eu=vu>>>16,Ru=wu&65535,Lu=wu>>>16,wu=Yo[7],vu=_l[7],Cu+=vu&65535,Eu+=vu>>>16,Ru+=wu&65535,Lu+=wu>>>16,Eu+=Cu>>>16,Ru+=Eu>>>16,Lu+=Ru>>>16,Yo[7]=up=Ru&65535|Lu<<16,_l[7]=fp=Cu&65535|Eu<<16,Tp+=128,Wo-=128}return Wo}function zl(Yo,_l,Sl){var Wo=new Int32Array(8),xl=new Int32Array(8),Ql=new Uint8Array(256),Fl,Jl=Sl;for(Wo[0]=1779033703,Wo[1]=3144134277,Wo[2]=1013904242,Wo[3]=2773480762,Wo[4]=1359893119,Wo[5]=2600822924,Wo[6]=528734635,Wo[7]=1541459225,xl[0]=4089235720,xl[1]=2227873595,xl[2]=4271175723,xl[3]=1595750129,xl[4]=2917565137,xl[5]=725511199,xl[6]=4215389547,xl[7]=327033209,Wl(Wo,xl,_l,Sl),Sl%=128,Fl=0;Fl=0;--xl)Wo=Sl[xl/8|0]>>(xl&7)&1,Ml(Yo,_l,Wo),Tl(_l,Yo),Tl(Yo,Yo),Ml(Yo,_l,Wo)}function Ll(Yo,_l){var Sl=[to(),to(),to(),to()];bo(Sl[0],fo),bo(Sl[1],ho),bo(Sl[2],ao),Zo(Sl[3],fo,ho),Vl(Yo,Sl,_l)}function uu(Yo,_l,Sl){var Wo=new Uint8Array(64),xl=[to(),to(),to(),to()],Ql;for(Sl||ro(_l,32),zl(Wo,_l,32),Wo[0]&=248,Wo[31]&=127,Wo[31]|=64,Ll(xl,Wo),ou(Yo,xl),Ql=0;Ql<32;Ql++)_l[Ql+32]=Yo[Ql];return 0}var ru=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function tu(Yo,_l){var Sl,Wo,xl,Ql;for(Wo=63;Wo>=32;--Wo){for(Sl=0,xl=Wo-32,Ql=Wo-12;xl>4)*ru[xl],Sl=_l[xl]>>8,_l[xl]&=255;for(xl=0;xl<32;xl++)_l[xl]-=Sl*ru[xl];for(Wo=0;Wo<32;Wo++)_l[Wo+1]+=_l[Wo]>>8,Yo[Wo]=_l[Wo]&255}function ku(Yo){var _l=new Float64Array(64),Sl;for(Sl=0;Sl<64;Sl++)_l[Sl]=Yo[Sl];for(Sl=0;Sl<64;Sl++)Yo[Sl]=0;tu(Yo,_l)}function au(Yo,_l,Sl,Wo){var xl=new Uint8Array(64),Ql=new Uint8Array(64),Fl=new Uint8Array(64),Jl,xu,lu=new Float64Array(64),su=[to(),to(),to(),to()];zl(xl,Wo,32),xl[0]&=248,xl[31]&=127,xl[31]|=64;var Xu=Sl+64;for(Jl=0;Jl>7&&Vo(Yo[0],oo,Yo[0]),Zo(Yo[3],Yo[0],Yo[1]),0)}function Jo(Yo,_l,Sl,Wo){var xl,Ql=new Uint8Array(32),Fl=new Uint8Array(64),Jl=[to(),to(),to(),to()],xu=[to(),to(),to(),to()];if(Sl<64||wl(xu,Wo))return-1;for(xl=0;xl=0},eo.sign.keyPair=function(){var Yo=new Uint8Array(Il),_l=new Uint8Array(Nl);return uu(Yo,_l),{publicKey:Yo,secretKey:_l}},eo.sign.keyPair.fromSecretKey=function(Yo){if(Xl(Yo),Yo.length!==Nl)throw new Error("bad secret key size");for(var _l=new Uint8Array(Il),Sl=0;Sl<_l.length;Sl++)_l[Sl]=Yo[32+Sl];return{publicKey:_l,secretKey:new Uint8Array(Yo)}},eo.sign.keyPair.fromSeed=function(Yo){if(Xl(Yo),Yo.length!==Pl)throw new Error("bad seed size");for(var _l=new Uint8Array(Il),Sl=new Uint8Array(Nl),Wo=0;Wo<32;Wo++)Sl[Wo]=Yo[Wo];return uu(_l,Sl,!0),{publicKey:_l,secretKey:Sl}},eo.sign.publicKeyLength=Il,eo.sign.secretKeyLength=Nl,eo.sign.seedLength=Pl,eo.sign.signatureLength=_u,eo.hash=function(Yo){Xl(Yo);var _l=new Uint8Array(Bl);return zl(_l,Yo,Yo.length),_l},eo.hash.hashLength=Bl,eo.verify=function(Yo,_l){return Xl(Yo,_l),Yo.length===0||_l.length===0||Yo.length!==_l.length?!1:vo(Yo,0,_l,0,Yo.length)===0},eo.setPRNG=function(Yo){ro=Yo},function(){var Yo=typeof self<"u"?self.crypto||self.msCrypto:null;if(Yo&&Yo.getRandomValues){var _l=65536;eo.setPRNG(function(Sl,Wo){var xl,Ql=new Uint8Array(Wo);for(xl=0;xl`https://phantom.app/ul/v1/${Xr}?${eo.toString()}`,decryptPayload=(Xr,eo,to)=>{const ro=nacl.box.open.after(bs58$1.decode(Xr),bs58$1.decode(eo),to);if(!ro)throw new Error("Unable to decrypt data");return JSON.parse(Buffer$3.from(ro).toString("utf8"))},encryptPayload=(Xr,eo)=>{const to=nacl.randomBytes(24),ro=nacl.box.after(Buffer$3.from(JSON.stringify(Xr)),to,eo);return[to,ro]},GENESIS_HASHES={"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY":"testnet","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d":"mainnet-beta",EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG:"devnet"},fetchCluster=Xr=>__awaiter$2(void 0,void 0,void 0,function*(){try{const{result:eo}=yield(yield fetch(Xr,{body:JSON.stringify({id:1,jsonrpc:"2.0",method:"getGenesisHash"}),headers:{"Content-Type":"application/json"},method:"POST"})).json();return GENESIS_HASHES[eo]}catch{return"mainnet-beta"}}),storage={address:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_wallet_address"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_wallet_address")},set:Xr=>{localStorage.setItem("dynamic_phantom_wallet_address",Xr.toString())}},encryptionPublicKey:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_public_key");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_public_key")},set:Xr=>{localStorage.setItem("dynamic_phantom_public_key",JSON.stringify([...Xr]))}},encryptionSecretKey:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_secret_key");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_secret_key")},set:Xr=>{localStorage.setItem("dynamic_phantom_secret_key",JSON.stringify([...Xr]))}},message:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_message_to_sign"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_message_to_sign")},set:Xr=>{localStorage.setItem("dynamic_phantom_message_to_sign",Xr)}},method:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_method"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_method")},set:Xr=>{localStorage.setItem("dynamic_phantom_method",Xr)}},session:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_session"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_session")},set:Xr=>{localStorage.setItem("dynamic_phantom_session",Xr)}},sharedSecret:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_shared_secret");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_shared_secret")},set:Xr=>{localStorage.setItem("dynamic_phantom_shared_secret",JSON.stringify([...Xr]))}}},clearStorage=()=>{for(const Xr in storage)storage[Xr].remove()};class PhantomRedirect extends SolWalletConnector{constructor(eo){super(Object.assign({},eo)),this.name="Phantom",this.overrideKey="phantom"}getMethod(){throw new Error("Method not implemented.")}getAddress(){return __awaiter$2(this,void 0,void 0,function*(){const eo=storage.address.get();if(eo)return eo;yield this.connect()})}connect(){return __awaiter$2(this,void 0,void 0,function*(){var eo,to;const ro=nacl.box.keyPair();storage.encryptionPublicKey.set(ro.publicKey),storage.encryptionSecretKey.set(ro.secretKey);const no=window.location.href.includes("localhost")||window.location.href.includes("0.0.0.0")||window.location.href.includes("127.0.0.1"),io=(to=(eo=this.solNetworks[0].privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])!==null&&to!==void 0?to:this.solNetworks[0].rpcUrls[0],oo=new URLSearchParams({app_url:no?"https://demo.dynamic.xyz":window.location.href,cluster:yield fetchCluster(io),dapp_encryption_public_key:bs58$1.encode(ro.publicKey),redirect_link:window.location.href}),ao=buildUrl$1("connect",oo);window.location.href=ao})}getSession(){return __awaiter$2(this,void 0,void 0,function*(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,phantom_encryption_public_key:no,encryptionSecretKey:io}=this.getInputsOrThrow("getSession",["data","nonce","phantom_encryption_public_key"],["encryptionSecretKey"]),oo=nacl.box.before(bs58$1.decode(no),io);storage.sharedSecret.set(oo);const ao=decryptPayload(to,ro,oo);return storage.session.set(ao.session),storage.address.set(new PublicKey$2(ao.public_key)),eo.delete("phantom_encryption_public_key"),eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),ao.public_key})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){const{session:to,sharedSecret:ro,encryptionPublicKey:no}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]);storage.message.set(eo);const io={message:bs58$1.encode(Buffer$3.from(eo)),session:to},[oo,ao]=encryptPayload(io,ro),so=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(no),nonce:bs58$1.encode(oo),payload:bs58$1.encode(ao),redirect_link:window.location.href}),co=buildUrl$1("signMessage",so);throw storage.method.set("signMessage"),window.location.href=co,new Error("ignore")})}extractSignature(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no,message:io}=this.getInputsOrThrow("extractSignature",["data","nonce"],["sharedSecret","message"]),oo=decryptPayload(to,ro,no);return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),{message:io,signature:oo.signature}}extractTransactions(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no}=this.getInputsOrThrow("extractTransactions",["data","nonce"],["sharedSecret"]),oo=decryptPayload(to,ro,no).transactions.map(ao=>Transaction.from(bs58$1.decode(ao)));return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),oo}extractTransaction(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no}=this.getInputsOrThrow("extractTransaction",["data","nonce"],["sharedSecret"]),io=decryptPayload(to,ro,no),oo=Transaction.from(bs58$1.decode(io.transaction));return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),oo}consumeMethod(){const eo=storage.method.get();return storage.method.remove(),eo}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){const eo=storage.address.get();if(eo)return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>{throw new Error("Not implemented")},emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!0,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],publicKey:new PublicKey$2(eo),removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},signAllTransactions:to=>__awaiter$2(this,void 0,void 0,function*(){const ro=to.map(ho=>bs58$1.encode(ho.serialize({requireAllSignatures:!1}))),{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signAllTransactions",[],["session","sharedSecret","encryptionPublicKey"]),ao={session:no,transactions:ro},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),fo=buildUrl$1("signAllTransactions",lo);return window.location.href=fo,[]}),signAndSendTransaction:(to,ro)=>__awaiter$2(this,void 0,void 0,function*(){const{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signAndSendTransaction",[],["session","sharedSecret","encryptionPublicKey"]),ao={options:ro,session:no,transaction:bs58$1.encode(to.serialize({requireAllSignatures:!1}))},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),fo=buildUrl$1("signAndSendTransaction",lo);return storage.method.set("signAndSendTransaction"),window.location.href=fo,{signature:""}}),signMessage:to=>__awaiter$2(this,void 0,void 0,function*(){const{session:ro,sharedSecret:no,encryptionPublicKey:io}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]),oo={message:bs58$1.encode(Buffer$3.from(to)),session:ro},[ao,so]=encryptPayload(oo,no),co=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(io),nonce:bs58$1.encode(ao),payload:bs58$1.encode(so),redirect_link:window.location.href}),lo=buildUrl$1("signMessage",co);return window.location.href=lo,{signature:Buffer$3.from("")}}),signTransaction:to=>__awaiter$2(this,void 0,void 0,function*(){const ro=bs58$1.encode(to.serialize({requireAllSignatures:!1})),{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signTransaction",[],["session","sharedSecret","encryptionPublicKey"]),ao={session:no,transaction:ro},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),fo=buildUrl$1("signTransaction",lo);return window.location.href=fo,to})}})}getConnectedAccounts(){return __awaiter$2(this,void 0,void 0,function*(){const eo=storage.address.get();return eo?[eo]:[]})}endSession(){return __awaiter$2(this,void 0,void 0,function*(){const eo=storage.address.get(),to=storage.session.get(),ro=storage.sharedSecret.get(),no=storage.encryptionPublicKey.get();if(clearStorage(),!eo||!to||!no||!ro)return;const io={session:to},[oo,ao]=encryptPayload(io,ro),so=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(no),nonce:bs58$1.encode(oo),payload:bs58$1.encode(ao),redirect_link:window.location.href}),co=buildUrl$1("disconnect",so);window.location.href=co})}getInputsOrThrow(eo,to,ro){const no={},io=new URLSearchParams(window.location.search);return to.forEach(oo=>{const ao=io.get(oo);if(!ao)throw new Error(`[PhantomRedirect] ${eo} called, but required input '${oo}' not found in query params`);no[oo]=ao}),ro.forEach(oo=>{const ao=storage[oo].get();if(!ao)throw new Error(`[PhantomRedirect] ${eo} called, but required input '${oo}' not found in local storage`);no[oo]=ao}),no}}const isSignedMessage=Xr=>!!Xr&&Xr.signature!==void 0,findWalletProviderFromWalletStandard=Xr=>{const{walletStandardLocators:eo}=Xr;if(!eo||eo.length===0)return;const to=getWallets().get();return eo.reduce((ro,no)=>{if(ro)return ro;const io=to.find(oo=>oo.name===no.name);if(io)return get$8(io,no.locator)},void 0)};class SolProviderHelper{constructor(eo){this.wallet=eo}getInjectedConfig(){if(!this.wallet||!this.wallet.injectedConfig)return;const{injectedConfig:eo}=this.wallet;return eo.find(to=>to.chain==="sol")}getInstalledProvider(){const eo=this.getInjectedConfig();if(!(!eo||!eo.extensionLocators))return this.installedProviderLookup(eo.extensionLocators)}installedProviders(){var eo,to;const ro=this.getInjectedConfig();if(!ro)return[];const no=[];if(ro.windowLocations)for(const io of ro.windowLocations){const oo=getProvidersFromWindow(io);oo&&oo.length&&no.push(...oo)}if(ro.extensionLocators.length!==0&&window.solana&&(window.solana.providers?window.solana.providers.forEach(io=>no.push(io)):no.push(window.solana)),((to=(eo=ro.walletStandardLocators)===null||eo===void 0?void 0:eo.length)!==null&&to!==void 0?to:0)>0){const io=findWalletProviderFromWalletStandard(ro);io&&no.push(io)}return no}installedProviderLookup(eo){const to=this.installedProviders();return eo.length===0?to[0]:ProviderLookup(to,eo)}findProvider(){return this.getInstalledProvider()}isInstalledHelper(){return this.findProvider()!==void 0}getAddress(){return __awaiter$2(this,void 0,void 0,function*(){var eo;const to=this.findProvider();if(to)return yield to.connect(),(eo=to.publicKey)===null||eo===void 0?void 0:eo.toString()})}connect(){return __awaiter$2(this,void 0,void 0,function*(){const eo=this.findProvider();if(eo)try{return eo.isConnected||(yield eo.connect()),eo}catch{return}})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=this.findProvider();if(!ro)return;const no=new TextEncoder().encode(eo),io=yield ro.signMessage(no,"utf8");if(io)return bufferToBase64(isSignedMessage(io)?io.signature:io)})}handleAccountChange(eo,to,ro){return __awaiter$2(this,void 0,void 0,function*(){var no;if(!ro){yield to==null?void 0:to.connect(),!((no=to==null?void 0:to.publicKey)===null||no===void 0)&&no.toString()&&eo.emit("accountChange",{accounts:[to.publicKey.toString()]});return}ro.toString()&&eo.emit("accountChange",{accounts:[ro.toString()]})})}_setupEventListeners(eo){const to=this.findProvider();if(!to){logger$9.warn("Provider not found",{connector:eo});return}if(!("on"in to)){logger$9.warn("Provider does not support event listeners",{connector:eo,provider:to});return}to.on("accountChanged",ro=>this.handleAccountChange(eo,to,ro)),to.on("disconnect",()=>eo.emit("disconnect"))}_teardownEventListeners(){const eo=this.findProvider();eo&&eo.removeAllListeners()}getConnectedAccounts(){return __awaiter$2(this,void 0,void 0,function*(){var eo,to;const ro=this.findProvider();if(!ro)return[];let no;try{ro.isConnected||(no=yield ro.connect({onlyIfTrusted:!0}))}catch{return[]}const io=no==null?void 0:no.address,oo=(eo=no==null?void 0:no.publicKey)!==null&&eo!==void 0?eo:(to=ro.publicKey)===null||to===void 0?void 0:to.toString();return io?[io]:oo?[oo==null?void 0:oo.toString()]:[]})}}class SignMessageNotSupportedError extends NotSupportedError{constructor(eo){super(`Message signing is currently not supported on ${eo} hardware wallet. + You can read more about it here https://github.com/solana-labs/solana/issues/21366`);return to.signMessage.call(this,eo)})}proveOwnership(eo,to){const ro=Object.create(null,{proveOwnership:{get:()=>super.proveOwnership}});return __awaiter$5(this,void 0,void 0,function*(){if(yield this.validateActiveWallet(eo),this.isHardwareWalletEnabled){const no=extractNonce(to);if(!no)throw new DynamicError("Nonce missing");return this.signMessageViaTransaction(no)}return ro.proveOwnership.call(this,eo,to)})}signMessageViaTransaction(eo){return __awaiter$5(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)throw new DynamicError("Address missing");const ro=this.buildAuthTx(eo);ro.feePayer=new PublicKey$2(to),ro.recentBlockhash=(yield this.getWalletClient().getLatestBlockhash()).blockhash;const no=yield this.getSigner();if(!no)throw new DynamicError("Signer not found");const oo=(yield no.signTransaction(ro)).serialize();return JSON.stringify({signedTransaction:{data:Array.from(oo),type:"Buffer"}})})}buildAuthTx(eo){const to=new Transaction;return to.add(new TransactionInstruction({data:Buffer$3.from(eo,"utf8"),keys:[],programId:MEMO_PROGRAM_ID})),to}setVerifiedCredentials(eo){this.verifiedCredentials=eo}isLedgerAddress(eo){return isLedgerAddressViaVerifiedCredentials(eo,this.verifiedCredentials)}}ChainRpcProviders.getSolanaProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.solana)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerSolanaProviders=Xr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,eo=>{const to={};return eo!=null&&eo.solana&&(to.solana=eo.solana.map(ro=>{var no;const io=((no=ro.privateCustomerRpcUrls)===null||no===void 0?void 0:no[0])||ro.rpcUrls[0],oo=new Connection(io,Xr);return{chainId:ro.chainId.toString(),chainName:ro.name,provider:oo}})),to.solana})};const TOKEN_PROGRAM_ID=new PublicKey$2("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new PublicKey$2("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const ASSOCIATED_TOKEN_PROGRAM_ID=new PublicKey$2("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new PublicKey$2("So11111111111111111111111111111111111111112");new PublicKey$2("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const encodeDecode$2=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$2=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$2(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$3.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$2=bigInt$2(8),bool=Xr=>{const eo=u8(Xr),{encode:to,decode:ro}=encodeDecode$2(eo),no=eo;return no.decode=(io,oo)=>!!ro(io,oo),no.encode=(io,oo,ao)=>{const so=Number(io);return to(so,oo,ao)},no};let StructError$1=class extends TypeError{constructor(eo,to){let ro;const{message:no,explanation:io,...oo}=eo,{path:ao}=eo,so=ao.length===0?no:`At path: ${ao.join(".")} -- ${no}`;super(io??so),io!=null&&(this.cause=so),Object.assign(this,oo),this.name=this.constructor.name,this.failures=()=>ro??(ro=[eo,...to()])}};function isIterable$1(Xr){return isObject$3(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$3(Xr){return typeof Xr=="object"&&Xr!=null}function isNonArrayObject$1(Xr){return isObject$3(Xr)&&!Array.isArray(Xr)}function print$1(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator$1(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure$1(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print$1(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures$1(Xr,eo,to,ro){isIterable$1(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure$1(no,eo,to,ro);io&&(yield io)}}function*run$1(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no,mask:oo};io&&(Xr=eo.coercer(Xr,ao));let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,uo]of eo.entries(Xr,ao)){const ho=run$1(lo,uo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$3(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$3=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures$1(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures$1(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$4(eo,this,to)}create(eo,to){return create$1(eo,this,to)}is(eo){return is$2(eo,this)}mask(eo,to){return mask$1(eo,this,to)}validate(eo,to={}){return validate$1(eo,this,to)}};function assert$4(Xr,eo,to){const ro=validate$1(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create$1(Xr,eo,to){const ro=validate$1(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask$1(Xr,eo,to){const ro=validate$1(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$2(Xr,eo){return!validate$1(Xr,eo)[0]}function validate$1(Xr,eo,to={}){const ro=run$1(Xr,eo,to),no=shiftIterator$1(ro);return no[0]?[new StructError$1(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define$1(Xr,eo){return new Struct$3({type:Xr,schema:null,validator:eo})}function any$1(){return define$1("any",()=>!0)}function array$1(Xr){return new Struct$3({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print$1(eo)}`}})}function boolean$1(){return define$1("boolean",Xr=>typeof Xr=="boolean")}function instance$1(Xr){return define$1("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print$1(eo)}`)}function literal$1(Xr){const eo=print$1(Xr),to=typeof Xr;return new Struct$3({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print$1(ro)}`}})}function never$1(){return define$1("never",()=>!1)}function nullable$1(Xr){return new Struct$3({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$2(){return define$1("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print$1(Xr)}`)}function optional$1(Xr){return new Struct$3({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record$1(Xr,eo){return new Struct$3({type:"record",schema:null,*entries(to){if(isObject$3(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isNonArrayObject$1(to)||`Expected an object, but received: ${print$1(to)}`},coercer(to){return isNonArrayObject$1(to)?{...to}:to}})}function string$1(){return define$1("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print$1(Xr)}`)}function tuple$2(Xr){const eo=never$1();return new Struct$3({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$3({type:"union",schema:null,coercer(to,ro){for(const no of Xr){const[io,oo]=no.validate(to,{coerce:!0,mask:ro.mask});if(!io)return oo}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run$1(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print$1(to)}`,...no]}})}function unknown$1(){return define$1("unknown",()=>!0)}function coerce$1(Xr,eo,to){return new Struct$3({...Xr,coercer:(ro,no)=>is$2(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}function isOnCurve$1(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const toBuffer$1=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);let Struct$2=class{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$1,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA$1,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA$1,this,eo)}};const SOLANA_SCHEMA$1=new Map;var _PublicKey$1;const MAX_SEED_LENGTH$1=32,PUBLIC_KEY_LENGTH$1=32;function isPublicKeyData$1(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter$1=1,PublicKey$1=class dv extends Struct$2{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData$1(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input");this._bn=new BN(to)}else this._bn=new BN(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input")}}static unique(){const eo=new dv(uniquePublicKeyCounter$1);return uniquePublicKeyCounter$1+=1,new dv(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH$1)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new dv(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH$1)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer$1(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve$1(no))throw new Error("Invalid seeds, address must fall off the curve");return new dv(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new dv(eo);return isOnCurve$1(to.toBytes())}};_PublicKey$1=PublicKey$1;PublicKey$1.default=new _PublicKey$1("11111111111111111111111111111111");SOLANA_SCHEMA$1.set(PublicKey$1,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$1("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES$1=64,publicKey$2=(Xr="publicKey")=>blob(32,Xr),rustString$1=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized$1=(Xr="authorized")=>struct([publicKey$2("staker"),publicKey$2("withdrawer")],Xr),lockup$1=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$2("custodian")],Xr),voteInit$1=(Xr="voteInit")=>struct([publicKey$2("nodePubkey"),publicKey$2("authorizedVoter"),publicKey$2("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs$1=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey$2("currentAuthorityDerivedKeyOwnerPubkey"),rustString$1("currentAuthorityDerivedKeySeed"),publicKey$2("newAuthorized")],Xr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$1).fill(0);new PublicKey$1("SysvarC1ock11111111111111111111111111111111");new PublicKey$1("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$1("Sysvar1nstructions1111111111111111111111111");new PublicKey$1("SysvarRecentB1ockHashes11111111111111111111");new PublicKey$1("SysvarRent111111111111111111111111111111111");new PublicKey$1("SysvarRewards111111111111111111111111111111");new PublicKey$1("SysvarS1otHashes111111111111111111111111111");new PublicKey$1("SysvarS1otHistory11111111111111111111111111");new PublicKey$1("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout$1=nu64("lamportsPerSignature"),NonceAccountLayout$1=struct([u32$1("version"),u32$1("state"),publicKey$2("authorizedPubkey"),publicKey$2("nonce"),struct([FeeCalculatorLayout$1],"feeCalculator")]);NonceAccountLayout$1.span;const encodeDecode$1=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt$1=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode$1(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64$1=bigInt$1(8);Object.freeze({Create:{index:0,layout:struct([u32$1("instruction"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},Assign:{index:1,layout:struct([u32$1("instruction"),publicKey$2("programId")])},Transfer:{index:2,layout:struct([u32$1("instruction"),u64$1("lamports")])},CreateWithSeed:{index:3,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32$1("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32$1("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32$1("instruction"),publicKey$2("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32$1("instruction"),publicKey$2("authorized")])},Allocate:{index:8,layout:struct([u32$1("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("space"),publicKey$2("programId")])},AssignWithSeed:{index:10,layout:struct([u32$1("instruction"),publicKey$2("base"),rustString$1("seed"),publicKey$2("programId")])},TransferWithSeed:{index:11,layout:struct([u32$1("instruction"),u64$1("lamports"),rustString$1("seed"),publicKey$2("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32$1("instruction")])}});new PublicKey$1("11111111111111111111111111111111");new PublicKey$1("BPFLoader2111111111111111111111111111111111");struct([u32$1("typeIndex"),u64$1("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$2(),offset(u8(),-1),"authority")]);const PublicKeyFromString$1=coerce$1(instance$1(PublicKey$1),string$1(),Xr=>new PublicKey$1(Xr)),RawAccountDataResult$1=tuple$2([string$1(),literal$1("base64")]),BufferFromRawAccountData$1=coerce$1(instance$1(Buffer$1$1),RawAccountDataResult$1,Xr=>Buffer$1$1.from(Xr[0],"base64"));function createRpcResult$1(Xr){return union$1([type$1({jsonrpc:literal$1("2.0"),id:string$1(),result:Xr}),type$1({jsonrpc:literal$1("2.0"),id:string$1(),error:type$1({code:unknown$1(),message:string$1(),data:optional$1(any$1())})})])}const UnknownRpcResult$1=createRpcResult$1(unknown$1());function jsonRpcResult$1(Xr){return coerce$1(createRpcResult$1(Xr),UnknownRpcResult$1,eo=>"error"in eo?eo:{...eo,result:create$1(eo.result,Xr)})}function jsonRpcResultAndContext$1(Xr){return jsonRpcResult$1(type$1({context:type$1({slot:number$2()}),value:Xr}))}function notificationResultAndContext$1(Xr){return type$1({context:type$1({slot:number$2()}),value:Xr})}const GetInflationGovernorResult$1=type$1({foundation:number$2(),foundationTerm:number$2(),initial:number$2(),taper:number$2(),terminal:number$2()});jsonRpcResult$1(array$1(nullable$1(type$1({epoch:number$2(),effectiveSlot:number$2(),amount:number$2(),postBalance:number$2(),commission:optional$1(nullable$1(number$2()))}))));const GetRecentPrioritizationFeesResult$1=array$1(type$1({slot:number$2(),prioritizationFee:number$2()})),GetInflationRateResult$1=type$1({total:number$2(),validator:number$2(),foundation:number$2(),epoch:number$2()}),GetEpochInfoResult$1=type$1({epoch:number$2(),slotIndex:number$2(),slotsInEpoch:number$2(),absoluteSlot:number$2(),blockHeight:optional$1(number$2()),transactionCount:optional$1(number$2())}),GetEpochScheduleResult$1=type$1({slotsPerEpoch:number$2(),leaderScheduleSlotOffset:number$2(),warmup:boolean$1(),firstNormalEpoch:number$2(),firstNormalSlot:number$2()}),GetLeaderScheduleResult$1=record$1(string$1(),array$1(number$2())),TransactionErrorResult$1=nullable$1(union$1([type$1({}),string$1()])),SignatureStatusResult$1=type$1({err:TransactionErrorResult$1}),SignatureReceivedResult$1=literal$1("receivedSignature");type$1({"solana-core":string$1(),"feature-set":optional$1(number$2())});const ParsedInstructionStruct$1=type$1({program:string$1(),programId:PublicKeyFromString$1,parsed:unknown$1()}),PartiallyDecodedInstructionStruct$1=type$1({programId:PublicKeyFromString$1,accounts:array$1(PublicKeyFromString$1),data:string$1()});jsonRpcResultAndContext$1(type$1({err:nullable$1(union$1([type$1({}),string$1()])),logs:nullable$1(array$1(string$1())),accounts:optional$1(nullable$1(array$1(nullable$1(type$1({executable:boolean$1(),owner:string$1(),lamports:number$2(),data:array$1(string$1()),rentEpoch:optional$1(number$2())}))))),unitsConsumed:optional$1(number$2()),returnData:optional$1(nullable$1(type$1({programId:string$1(),data:tuple$2([string$1(),literal$1("base64")])}))),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(union$1([ParsedInstructionStruct$1,PartiallyDecodedInstructionStruct$1]))}))))}));jsonRpcResultAndContext$1(type$1({byIdentity:record$1(string$1(),array$1(number$2())),range:type$1({firstSlot:number$2(),lastSlot:number$2()})}));jsonRpcResult$1(GetInflationGovernorResult$1);jsonRpcResult$1(GetInflationRateResult$1);jsonRpcResult$1(GetRecentPrioritizationFeesResult$1);jsonRpcResult$1(GetEpochInfoResult$1);jsonRpcResult$1(GetEpochScheduleResult$1);jsonRpcResult$1(GetLeaderScheduleResult$1);jsonRpcResult$1(number$2());jsonRpcResultAndContext$1(type$1({total:number$2(),circulating:number$2(),nonCirculating:number$2(),nonCirculatingAccounts:array$1(PublicKeyFromString$1)}));const TokenAmountResult$1=type$1({amount:string$1(),uiAmount:nullable$1(number$2()),decimals:number$2(),uiAmountString:optional$1(string$1())});jsonRpcResultAndContext$1(array$1(type$1({address:PublicKeyFromString$1,amount:string$1(),uiAmount:nullable$1(number$2()),decimals:number$2(),uiAmountString:optional$1(string$1())})));jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:BufferFromRawAccountData$1,rentEpoch:number$2()})})));const ParsedAccountDataResult$1=type$1({program:string$1(),parsed:unknown$1(),space:number$2()});jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:ParsedAccountDataResult$1,rentEpoch:number$2()})})));jsonRpcResultAndContext$1(array$1(type$1({lamports:number$2(),address:PublicKeyFromString$1})));const AccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:BufferFromRawAccountData$1,rentEpoch:number$2()});type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});const ParsedOrRawAccountData$1=coerce$1(union$1([instance$1(Buffer$1$1),ParsedAccountDataResult$1]),union$1([RawAccountDataResult$1,ParsedAccountDataResult$1]),Xr=>Array.isArray(Xr)?create$1(Xr,BufferFromRawAccountData$1):Xr),ParsedAccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$2(),data:ParsedOrRawAccountData$1,rentEpoch:number$2()});type$1({pubkey:PublicKeyFromString$1,account:ParsedAccountInfoResult$1});type$1({state:union$1([literal$1("active"),literal$1("inactive"),literal$1("activating"),literal$1("deactivating")]),active:number$2(),inactive:number$2()});jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$2(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$2()))})));jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$2(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$2()))})));type$1({subscription:number$2(),result:notificationResultAndContext$1(AccountInfoResult$1)});const ProgramAccountInfoResult$1=type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});type$1({subscription:number$2(),result:notificationResultAndContext$1(ProgramAccountInfoResult$1)});const SlotInfoResult$1=type$1({parent:number$2(),slot:number$2(),root:number$2()});type$1({subscription:number$2(),result:SlotInfoResult$1});const SlotUpdateResult$1=union$1([type$1({type:union$1([literal$1("firstShredReceived"),literal$1("completed"),literal$1("optimisticConfirmation"),literal$1("root")]),slot:number$2(),timestamp:number$2()}),type$1({type:literal$1("createdBank"),parent:number$2(),slot:number$2(),timestamp:number$2()}),type$1({type:literal$1("frozen"),slot:number$2(),timestamp:number$2(),stats:type$1({numTransactionEntries:number$2(),numSuccessfulTransactions:number$2(),numFailedTransactions:number$2(),maxTransactionsPerEntry:number$2()})}),type$1({type:literal$1("dead"),slot:number$2(),timestamp:number$2(),err:string$1()})]);type$1({subscription:number$2(),result:SlotUpdateResult$1});type$1({subscription:number$2(),result:notificationResultAndContext$1(union$1([SignatureStatusResult$1,SignatureReceivedResult$1]))});type$1({subscription:number$2(),result:number$2()});type$1({pubkey:string$1(),gossip:nullable$1(string$1()),tpu:nullable$1(string$1()),rpc:nullable$1(string$1()),version:nullable$1(string$1())});const VoteAccountInfoResult$1=type$1({votePubkey:string$1(),nodePubkey:string$1(),activatedStake:number$2(),epochVoteAccount:boolean$1(),epochCredits:array$1(tuple$2([number$2(),number$2(),number$2()])),commission:number$2(),lastVote:number$2(),rootSlot:nullable$1(number$2())});jsonRpcResult$1(type$1({current:array$1(VoteAccountInfoResult$1),delinquent:array$1(VoteAccountInfoResult$1)}));const ConfirmationStatus$1=union$1([literal$1("processed"),literal$1("confirmed"),literal$1("finalized")]),SignatureStatusResponse$1=type$1({slot:number$2(),confirmations:nullable$1(number$2()),err:TransactionErrorResult$1,confirmationStatus:optional$1(ConfirmationStatus$1)});jsonRpcResultAndContext$1(array$1(nullable$1(SignatureStatusResponse$1)));jsonRpcResult$1(number$2());const AddressTableLookupStruct$1=type$1({accountKey:PublicKeyFromString$1,writableIndexes:array$1(number$2()),readonlyIndexes:array$1(number$2())}),ConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(string$1()),header:type$1({numRequiredSignatures:number$2(),numReadonlySignedAccounts:number$2(),numReadonlyUnsignedAccounts:number$2()}),instructions:array$1(type$1({accounts:array$1(number$2()),data:string$1(),programIdIndex:number$2()})),recentBlockhash:string$1(),addressTableLookups:optional$1(array$1(AddressTableLookupStruct$1))})}),AnnotatedAccountKey$1=type$1({pubkey:PublicKeyFromString$1,signer:boolean$1(),writable:boolean$1(),source:optional$1(union$1([literal$1("transaction"),literal$1("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$1=type$1({accountKeys:array$1(AnnotatedAccountKey$1),signatures:array$1(string$1())}),ParsedInstructionResult$1=type$1({parsed:unknown$1(),program:string$1(),programId:PublicKeyFromString$1}),RawInstructionResult$1=type$1({accounts:array$1(PublicKeyFromString$1),data:string$1(),programId:PublicKeyFromString$1}),InstructionResult$1=union$1([RawInstructionResult$1,ParsedInstructionResult$1]),UnknownInstructionResult$1=union$1([type$1({parsed:unknown$1(),program:string$1(),programId:string$1()}),type$1({accounts:array$1(string$1()),data:string$1(),programId:string$1()})]),ParsedOrRawInstruction$1=coerce$1(InstructionResult$1,UnknownInstructionResult$1,Xr=>"accounts"in Xr?create$1(Xr,RawInstructionResult$1):create$1(Xr,ParsedInstructionResult$1)),ParsedConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(AnnotatedAccountKey$1),instructions:array$1(ParsedOrRawInstruction$1),recentBlockhash:string$1(),addressTableLookups:optional$1(nullable$1(array$1(AddressTableLookupStruct$1)))})}),TokenBalanceResult$1=type$1({accountIndex:number$2(),mint:string$1(),owner:optional$1(string$1()),uiTokenAmount:TokenAmountResult$1}),LoadedAddressesResult$1=type$1({writable:array$1(PublicKeyFromString$1),readonly:array$1(PublicKeyFromString$1)}),ConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$2(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(type$1({accounts:array$1(number$2()),data:string$1(),programIdIndex:number$2()}))})))),preBalances:array$1(number$2()),postBalances:array$1(number$2()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$2())}),ParsedConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$2(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$2(),instructions:array$1(ParsedOrRawInstruction$1)})))),preBalances:array$1(number$2()),postBalances:array$1(number$2()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$2())}),TransactionVersionStruct$1=union$1([literal$1(0),literal$1("legacy")]),RewardsResult$1=type$1({pubkey:string$1(),lamports:number$2(),postBalance:nullable$1(number$2()),rewardType:nullable$1(string$1()),commission:optional$1(nullable$1(number$2()))});jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2()),blockHeight:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$2(),signatures:array$1(string$1()),blockTime:nullable$1(number$2())})));jsonRpcResult$1(nullable$1(type$1({slot:number$2(),meta:nullable$1(ConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$2())),transaction:ConfirmedTransactionResult$1,version:optional$1(TransactionVersionStruct$1)})));jsonRpcResult$1(nullable$1(type$1({slot:number$2(),transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$2())),version:optional$1(TransactionVersionStruct$1)})));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),feeCalculator:type$1({lamportsPerSignature:number$2()})}));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),lastValidBlockHeight:number$2()}));jsonRpcResultAndContext$1(boolean$1());const PerfSampleResult$1=type$1({slot:number$2(),numTransactions:number$2(),numSlots:number$2(),samplePeriodSecs:number$2()});jsonRpcResult$1(array$1(PerfSampleResult$1));jsonRpcResultAndContext$1(nullable$1(type$1({feeCalculator:type$1({lamportsPerSignature:number$2()})})));jsonRpcResult$1(string$1());jsonRpcResult$1(string$1());const LogsResult$1=type$1({err:TransactionErrorResult$1,logs:array$1(string$1()),signature:string$1()});type$1({result:notificationResultAndContext$1(LogsResult$1),subscription:number$2()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64$1("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64$1(),seq(publicKey$2(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey$1("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$1("microLamports")])}});new PublicKey$1("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$1("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$1("KeccakSecp256k11111111111111111111111111111");var _Lockup$1;new PublicKey$1("StakeConfig11111111111111111111111111111111");let Lockup$1=class{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}};_Lockup$1=Lockup$1;Lockup$1.default=new _Lockup$1(0,0,PublicKey$1.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized$1(),lockup$1()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("stakeAuthorizationType"),rustString$1("authoritySeed"),publicKey$2("authorityOwner")])}});new PublicKey$1("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit$1()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey$2("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs$1()])}});new PublicKey$1("Vote111111111111111111111111111111111111111");new PublicKey$1("Va1idator1nfo111111111111111111111111111111");type$1({name:string$1(),website:optional$1(string$1()),details:optional$1(string$1()),iconUrl:optional$1(string$1()),keybaseUsername:optional$1(string$1())});new PublicKey$1("Vote111111111111111111111111111111111111111");struct([publicKey$2("nodePubkey"),publicKey$2("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$2("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey$2("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const publicKey$1=Xr=>{const eo=blob(32,Xr),{encode:to,decode:ro}=encodeDecode$2(eo),no=eo;return no.decode=(io,oo)=>{const ao=ro(io,oo);return new PublicKey$1(ao)},no.encode=(io,oo,ao)=>{const so=io.toBuffer();return to(so,oo,ao)},no};class TokenError extends Error{constructor(eo){super(eo)}}class TokenOwnerOffCurveError extends TokenError{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var TokenInstruction;(function(Xr){Xr[Xr.InitializeMint=0]="InitializeMint",Xr[Xr.InitializeAccount=1]="InitializeAccount",Xr[Xr.InitializeMultisig=2]="InitializeMultisig",Xr[Xr.Transfer=3]="Transfer",Xr[Xr.Approve=4]="Approve",Xr[Xr.Revoke=5]="Revoke",Xr[Xr.SetAuthority=6]="SetAuthority",Xr[Xr.MintTo=7]="MintTo",Xr[Xr.Burn=8]="Burn",Xr[Xr.CloseAccount=9]="CloseAccount",Xr[Xr.FreezeAccount=10]="FreezeAccount",Xr[Xr.ThawAccount=11]="ThawAccount",Xr[Xr.TransferChecked=12]="TransferChecked",Xr[Xr.ApproveChecked=13]="ApproveChecked",Xr[Xr.MintToChecked=14]="MintToChecked",Xr[Xr.BurnChecked=15]="BurnChecked",Xr[Xr.InitializeAccount2=16]="InitializeAccount2",Xr[Xr.SyncNative=17]="SyncNative",Xr[Xr.InitializeAccount3=18]="InitializeAccount3",Xr[Xr.InitializeMultisig2=19]="InitializeMultisig2",Xr[Xr.InitializeMint2=20]="InitializeMint2",Xr[Xr.GetAccountDataSize=21]="GetAccountDataSize",Xr[Xr.InitializeImmutableOwner=22]="InitializeImmutableOwner",Xr[Xr.AmountToUiAmount=23]="AmountToUiAmount",Xr[Xr.UiAmountToAmount=24]="UiAmountToAmount",Xr[Xr.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Xr[Xr.TransferFeeExtension=26]="TransferFeeExtension",Xr[Xr.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",Xr[Xr.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",Xr[Xr.Reallocate=29]="Reallocate",Xr[Xr.MemoTransferExtension=30]="MemoTransferExtension",Xr[Xr.CreateNativeMint=31]="CreateNativeMint",Xr[Xr.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",Xr[Xr.InterestBearingMintExtension=33]="InterestBearingMintExtension",Xr[Xr.CpiGuardExtension=34]="CpiGuardExtension",Xr[Xr.InitializePermanentDelegate=35]="InitializePermanentDelegate",Xr[Xr.TransferHookExtension=36]="TransferHookExtension",Xr[Xr.MetadataPointerExtension=39]="MetadataPointerExtension",Xr[Xr.GroupPointerExtension=40]="GroupPointerExtension",Xr[Xr.GroupMemberPointerExtension=41]="GroupMemberPointerExtension"})(TokenInstruction||(TokenInstruction={}));function addSigners(Xr,eo,to){if(to.length){Xr.push({pubkey:eo,isSigner:!1,isWritable:!1});for(const ro of to)Xr.push({pubkey:ro instanceof PublicKey$2?ro:ro.publicKey,isSigner:!0,isWritable:!1})}else Xr.push({pubkey:eo,isSigner:!0,isWritable:!1});return Xr}const MintLayout=struct([u32$1("mintAuthorityOption"),publicKey$1("mintAuthority"),u64$2("supply"),u8("decimals"),bool("isInitialized"),u32$1("freezeAuthorityOption"),publicKey$1("freezeAuthority")]);MintLayout.span;async function getAssociatedTokenAddress(Xr,eo,to=!1,ro=TOKEN_PROGRAM_ID,no=ASSOCIATED_TOKEN_PROGRAM_ID){if(!to&&!PublicKey$2.isOnCurve(eo.toBuffer()))throw new TokenOwnerOffCurveError;const[io]=await PublicKey$2.findProgramAddress([eo.toBuffer(),ro.toBuffer(),Xr.toBuffer()],no);return io}function createAssociatedTokenAccountInstruction(Xr,eo,to,ro,no=TOKEN_PROGRAM_ID,io=ASSOCIATED_TOKEN_PROGRAM_ID){return buildAssociatedTokenAccountInstruction(Xr,eo,to,ro,Buffer$3.alloc(0),no,io)}function buildAssociatedTokenAccountInstruction(Xr,eo,to,ro,no,io=TOKEN_PROGRAM_ID,oo=ASSOCIATED_TOKEN_PROGRAM_ID){const ao=[{pubkey:Xr,isSigner:!0,isWritable:!0},{pubkey:eo,isSigner:!1,isWritable:!0},{pubkey:to,isSigner:!1,isWritable:!1},{pubkey:ro,isSigner:!1,isWritable:!1},{pubkey:SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:io,isSigner:!1,isWritable:!1}];return new TransactionInstruction({keys:ao,programId:oo,data:no})}const transferInstructionData=struct([u8("instruction"),u64$2("amount")]);function createTransferInstruction(Xr,eo,to,ro,no=[],io=TOKEN_PROGRAM_ID){const oo=addSigners([{pubkey:Xr,isSigner:!1,isWritable:!0},{pubkey:eo,isSigner:!1,isWritable:!0}],to,no),ao=Buffer$3.alloc(transferInstructionData.span);return transferInstructionData.encode({instruction:TokenInstruction.Transfer,amount:BigInt(ro)},ao),new TransactionInstruction({keys:oo,programId:io,data:ao})}function decodeTransferInstructionUnchecked({programId:Xr,keys:[eo,to,ro,...no],data:io}){return{programId:Xr,keys:{source:eo,destination:to,owner:ro,multiSigners:no},data:transferInstructionData.decode(io)}}const LAMPORTS_PER_SOL$1=1e9;let SolanaUiTransaction$1=class{constructor({onSubmit:eo,from:to,connection:ro,originalTransaction:no}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.feeDeducted=!1,this.formatNonNativeToken=(io,oo)=>(Number(io)/Number(Math.pow(10,oo))).toString(),this.from=to,this.onSubmit=eo,this.connection=ro,this.originalTransaction=no}parse(eo){const to=parseFloat(eo),ro=Math.round(to*LAMPORTS_PER_SOL$1);return BigInt(ro)}parseNonNativeToken(eo,to){return BigInt(Math.floor(Number(eo)*Math.pow(10,to)))}format(eo,{precision:to}={}){const no=(Number(eo)/LAMPORTS_PER_SOL$1).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(no,{precision:to})}submit(){return __awaiter$5(this,void 0,void 0,function*(){const eo=yield this.createTransaction();return this.onSubmit(eo)})}getBalance(){return __awaiter$5(this,void 0,void 0,function*(){const eo=new PublicKey$2(this.from),to=yield this.connection.getBalance(eo);return BigInt(to)})}validateAddressFormat(eo){return eo==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(eo)}fetchFee(){return __awaiter$5(this,void 0,void 0,function*(){if(this.fee.gas)return;const eo=yield this.createTransactionSafe();if(!eo)return;let to;if("version"in eo?to=eo.message:to=eo.compileMessage(),!to)throw new Error("Invalid transaction");let ro=yield this.connection.getFeeForMessage(to),no=0;for(;ro.value===null&&no<5;)ro=yield this.connection.getFeeForMessage(to),no++;this.fee.gas=ro.value?BigInt(ro.value):void 0,!this.feeDeducted&&this.fee.gas&&this.value&&(this.value=this.value-this.fee.gas,this.feeDeducted=!0)})}createTransaction(){return __awaiter$5(this,void 0,void 0,function*(){var eo;const{value:to,to:ro,nonNativeAddress:no,nonNativeValue:io}=this;if(!ro)throw new Error("Destination is required");if(this.originalTransaction)return this.originalTransaction;const oo=new Transaction,ao=new PublicKey$2(this.from),so=new PublicKey$2(ro);if(no&&io){const lo=new PublicKey$2(no),uo=io,ho=(eo=(yield this.connection.getTokenAccountsByOwner(ao,{mint:lo})).value[0])===null||eo===void 0?void 0:eo.pubkey;if(!ho)throw new Error("Source token account not found");let go;try{go=yield getAssociatedTokenAddress(lo,so),yield this.connection.getTokenAccountBalance(go)}catch{go=yield getAssociatedTokenAddress(lo,so),oo.add(createAssociatedTokenAccountInstruction(ao,go,so,lo))}oo.add(createTransferInstruction(ho,go,ao,uo))}else{const lo=to??BigInt(0);oo.add(SystemProgram.transfer({fromPubkey:ao,lamports:lo,toPubkey:so}))}const{blockhash:co}=yield this.connection.getLatestBlockhash();return oo.feePayer=new PublicKey$2(this.from),oo.recentBlockhash=co,oo})}createTransactionSafe(){return __awaiter$5(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}};assertPackageVersion("@dynamic-labs/solana-core",version$8);function __awaiter$4(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const isSignedMessage=Xr=>!!Xr&&Xr.signature!==void 0,findWalletProviderFromWalletStandard=Xr=>{const{walletStandardLocators:eo}=Xr;if(!eo||eo.length===0)return;const to=getWallets().get();return eo.reduce((ro,no)=>{if(ro)return ro;const io=to.find(oo=>oo.name===no.name);if(io)return get$8(io,no.locator)},void 0)};class SolProviderHelper{constructor(eo){this.wallet=eo}getInjectedConfig(){if(!this.wallet||!this.wallet.injectedConfig)return;const{injectedConfig:eo}=this.wallet;return eo.find(to=>to.chain==="sol")}getInstalledProvider(){const eo=this.getInjectedConfig();if(!(!eo||!eo.extensionLocators))return this.installedProviderLookup(eo.extensionLocators)}installedProviders(){var eo,to;const ro=this.getInjectedConfig();if(!ro)return[];const no=[];if(ro.windowLocations)for(const io of ro.windowLocations){const oo=getProvidersFromWindow(io);oo&&oo.length&&no.push(...oo)}if(ro.extensionLocators.length!==0&&window.solana&&(window.solana.providers?window.solana.providers.forEach(io=>no.push(io)):no.push(window.solana)),((to=(eo=ro.walletStandardLocators)===null||eo===void 0?void 0:eo.length)!==null&&to!==void 0?to:0)>0){const io=findWalletProviderFromWalletStandard(ro);io&&no.push(io)}return no}installedProviderLookup(eo){const to=this.installedProviders();return eo.length===0?to[0]:ProviderLookup(to,eo)}findProvider(){return this.getInstalledProvider()}isInstalledHelper(){return this.findProvider()!==void 0}getAddress(){return __awaiter$4(this,void 0,void 0,function*(){var eo;const to=this.findProvider();if(to)return yield to.connect(),(eo=to.publicKey)===null||eo===void 0?void 0:eo.toString()})}connect(){return __awaiter$4(this,void 0,void 0,function*(){const eo=this.findProvider();if(eo)try{return eo.isConnected||(yield eo.connect()),eo}catch{return}})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=this.findProvider();if(!ro)return;const no=new TextEncoder().encode(eo),io=yield ro.signMessage(no,"utf8");if(io)return bufferToBase64(isSignedMessage(io)?io.signature:io)})}handleAccountChange(eo,to,ro){return __awaiter$4(this,void 0,void 0,function*(){var no;if(!ro){yield to==null?void 0:to.connect(),!((no=to==null?void 0:to.publicKey)===null||no===void 0)&&no.toString()&&eo.emit("accountChange",{accounts:[to.publicKey.toString()]});return}ro.toString()&&eo.emit("accountChange",{accounts:[ro.toString()]})})}_setupEventListeners(eo){const to=this.findProvider();if(!to){logger$9.warn("Provider not found",{connector:eo});return}if(!to.on){logger$9.warn("Provider does not support event listeners",{connector:eo,provider:to});return}to.on("accountChanged",ro=>this.handleAccountChange(eo,to,ro)),to.on("disconnect",()=>eo.emit("disconnect"))}_teardownEventListeners(){const eo=this.findProvider();eo&&eo.removeAllListeners()}getConnectedAccounts(){return __awaiter$4(this,void 0,void 0,function*(){var eo,to;const ro=this.findProvider();if(!ro)return[];let no;try{ro.isConnected||(no=yield ro.connect({onlyIfTrusted:!0}))}catch{return[]}const io=no==null?void 0:no.address,oo=(eo=no==null?void 0:no.publicKey)!==null&&eo!==void 0?eo:(to=ro.publicKey)===null||to===void 0?void 0:to.toString();return io?[io]:oo?[oo==null?void 0:oo.toString()]:[]})}}class SignMessageNotSupportedError extends NotSupportedError{constructor(eo){super(`Message signing is currently not supported on ${eo} hardware wallet. You can use signMessageViaTransaction instead to achieve similar functionality by signing a transaction with a memo instruction. - You can read more about it here https://github.com/solana-labs/solana/issues/21366`)}}class InjectedWalletBase extends SolWalletConnector{getSolProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.solProviderHelper&&(this.solProviderHelper=new SolProviderHelper(this.wallet)),this.solProviderHelper}getProvider(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.getInstalledProvider()}setupEventListeners(){var eo;(eo=this.getSolProviderHelper())===null||eo===void 0||eo._setupEventListeners(this)}teardownEventListeners(){var eo;(eo=this.getSolProviderHelper())===null||eo===void 0||eo._teardownEventListeners()}connect(){return __awaiter$2(this,void 0,void 0,function*(){var eo;yield(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}createUiTransaction(eo){return __awaiter$2(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=new SolanaUiTransaction({connection:this.getWalletClient(),from:eo,onSubmit:ro=>__awaiter$2(this,void 0,void 0,function*(){var no;const io=yield this.getSigner();if(!io)throw new Error("Signer not found");const oo=yield this.getWalletClient().getLatestBlockhash();if("version"in ro)ro.message.recentBlockhash=oo.blockhash;else{const ao=yield this.getAddress();if(!ao)throw new Error("User address not found");ro.recentBlockhash=oo.blockhash,ro.feePayer=(no=ro.feePayer)!==null&&no!==void 0?no:new PublicKey$2(ao)}return(yield io.signAndSendTransaction(ro)).signature})});return to.feeDeducted=!0,to})}isInstalledOnBrowser(){var eo;return!!(!((eo=this.getSolProviderHelper())===null||eo===void 0)&&eo.isInstalledHelper())}getAddress(){return __awaiter$2(this,void 0,void 0,function*(){var eo,to;if(!this.isInstalledOnBrowser()){if(isMobile$1()&&(!((eo=this.wallet)===null||eo===void 0)&&eo.mobile)&&this.wallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const no=template$1(this.wallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(no)}return}return(to=this.getSolProviderHelper())===null||to===void 0?void 0:to.getAddress()})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){var to,ro;const no=yield(to=this.getSolProviderHelper())===null||to===void 0?void 0:to.getAddress();if(no&&this.isLedgerAddress(no))throw new SignMessageNotSupportedError(this.name);return(ro=this.getSolProviderHelper())===null||ro===void 0?void 0:ro.signMessage(eo)})}getConnectedAccounts(){return __awaiter$2(this,void 0,void 0,function*(){var eo,to;return(to=(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.getConnectedAccounts())!==null&&to!==void 0?to:[]})}}class PhantomInjected extends InjectedWalletBase{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$2(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var eo,to;return((to=(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.findProvider())===null||to===void 0?void 0:to.publicKey)!==null}}class Phantom extends SolWalletConnector{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}connect(){return __awaiter$2(this,void 0,void 0,function*(){yield this.getMobileOrInstalledWallet().connect()})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){return this.getMobileOrInstalledWallet().getSigner()})}getMobileOrInstalledWallet(){const eo=new PhantomInjected(this.constructorProps);return!isMobile$1()||eo.isInstalledOnBrowser()?eo:this.mobileExperience==="redirect"?new PhantomRedirect(this.constructorProps):new PhantomInjected(this.constructorProps)}}class CoinbaseSolana extends InjectedWalletBase{constructor(eo){super(eo),this.name="CoinbaseSolana",this.overrideKey="coinbasesolana",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)return;const ro=yield this.getSigner();if(!ro)return;const no=new TextEncoder().encode(eo),io=yield ro.signMessage(no,to);if(io)return bufferToBase64(isSignedMessage(io)?io.signature:io)})}}class Solflare extends InjectedWalletBase{constructor(eo){super(eo),this.name="Solflare",this.overrideKey="solflare",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){return __awaiter$2(this,void 0,void 0,function*(){var eo,to,ro,no,io;if(isMobile$1()&&!this.isInstalledOnBrowser()){handleMobileWalletRedirect({nativeLink:((to=(eo=this.wallet)===null||eo===void 0?void 0:eo.mobile)===null||to===void 0?void 0:to.native)||"solflare://ul/v1/browse",universalLink:((no=(ro=this.wallet)===null||ro===void 0?void 0:ro.mobile)===null||no===void 0?void 0:no.universal)||"https://solflare.com/ul/v1/browse"});return}return(io=this.getSolProviderHelper())===null||io===void 0?void 0:io.getAddress()})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=yield this.getSigner();if(!ro)return;const no=new TextEncoder().encode(eo),io=ao=>ao.signature!==void 0;yield ro.connect(),yield new Promise(ao=>{setTimeout(ao,100)});const oo=yield ro.signMessage(no,"utf8");return io(oo)?bufferToBase64(oo.signature):void 0})}}const isVersionedTransaction=Xr=>!("instructions"in Xr),createSolanaSignerFromWalletStandard=(Xr,eo)=>{const to=Xr.features,ro=()=>__awaiter$2(void 0,void 0,void 0,function*(){const co=yield eo.getAddress(),lo=Xr.accounts.find(fo=>fo.address===co);if(!lo)throw new Error("Account not found");return lo}),no=()=>__awaiter$2(void 0,void 0,void 0,function*(){var co,lo;const fo=(lo=(co=eo.solNetworks[0].privateCustomerRpcUrls)===null||co===void 0?void 0:co[0])!==null&&lo!==void 0?lo:eo.solNetworks[0].rpcUrls[0];return`solana:${yield fetchCluster(fo)}`}),io=co=>__awaiter$2(void 0,void 0,void 0,function*(){const lo=yield ro(),fo=yield to["solana:signTransaction"].signTransaction({account:lo,chain:yield no(),transaction:co.serialize({requireAllSignatures:!1})});return isVersionedTransaction(co)?VersionedTransaction.deserialize(fo[0].signedTransaction):Transaction.from(fo[0].signedTransaction)});return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>eo.endSession(),emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!1,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],get publicKey(){return new PublicKey$2(Xr.accounts[0].publicKey)},removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},send:()=>{throw new Error("Not implemented")},signAllTransactions:co=>__awaiter$2(void 0,void 0,void 0,function*(){return Promise.all(co.map(io))}),signAndSendTransaction:co=>__awaiter$2(void 0,void 0,void 0,function*(){const lo=yield ro(),fo=yield to["solana:signAndSendTransaction"].signAndSendTransaction({account:lo,chain:yield no(),transaction:co.serialize()}),[{signature:ho}]=fo;return{signature:new TextDecoder().decode(ho)}}),signMessage:co=>__awaiter$2(void 0,void 0,void 0,function*(){const lo=yield ro();return{signature:(yield to["solana:signMessage"].signMessage({account:lo,message:co}))[0].signature}}),signTransaction:io}},encoder=new TextEncoder;class SolanaWalletStandardConnector extends SolWalletConnector{constructor(eo){super(eo),this.connectedChain="SOL",this.supportedChains=["SOL"]}get wallet(){const eo=SolanaWalletStandardConnector.getWallet(this.walletBook,this.key);if(!eo)throw new Error("Wallet not found");return eo}get walletFeatures(){return this.wallet.features}connect(){return __awaiter$2(this,void 0,void 0,function*(){yield this.walletFeatures["standard:connect"].connect()})}endSession(){return __awaiter$2(this,void 0,void 0,function*(){yield this.walletFeatures["standard:disconnect"].disconnect()})}isInstalledOnBrowser(){return!0}getAddress(){return __awaiter$2(this,void 0,void 0,function*(){yield this.connect();const[eo]=yield this.getConnectedAccounts();return eo})}getConnectedAccounts(){return __awaiter$2(this,void 0,void 0,function*(){return this.wallet.accounts.map(to=>to.address)})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){const to=yield this.getSigner();if(!to)throw new Error("Signer not found");const ro=encoder.encode(eo),{signature:no}=yield to.signMessage(ro);if(!(no instanceof Uint8Array))throw new Error("Signature not found");return Buffer$3.from(no).toString("base64")})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){const{wallet:eo}=this;return createSolanaSignerFromWalletStandard(eo,this)})}static getWallet(eo,to){var ro,no;const io=getWallets().get(),oo=(ro=eo.wallets[to].injectedConfig)===null||ro===void 0?void 0:ro.find(co=>co.chain==="sol");if(!oo)return;const{features:ao}=(no=oo.walletStandard)!==null&&no!==void 0?no:{};return ao?io.find(co=>{var lo;return co.name===((lo=oo.walletStandard)===null||lo===void 0?void 0:lo.name)?ao.reduce((go,yo)=>{const vo=Object.keys(co.features);return go?vo.includes(yo):!1},!0):!1}):void 0}}class BackpackSol extends InjectedWalletBase{constructor(eo){super(eo),this.name="Backpack",this.overrideKey="backpacksol",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}signMessage(eo){return __awaiter$2(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=yield this.getSigner();if(!ro)return;const no=yield ro.signMessage(Buffer$3.from(eo,"utf8"));if(no)return typeof no=="object"&&"signature"in no?bufferToBase64(no.signature):bufferToBase64(no)})}}const injectedWalletOverrides=[CoinbaseSolana,BackpackSol,Solflare],filteredInjectedWalletKeysOverrides=["coinbasesolana","phantom","phantomledger","backpacksol","solflare"],fetchInjectedWalletConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;const io=!!(!((no=ro.injectedConfig)===null||no===void 0)&&no.find(ao=>ao.chain==="sol")),oo=filteredInjectedWalletKeysOverrides.includes(to);return io&&!oo}).map(([to,ro])=>{var no;const{shortName:io}=ro,oo=io||ro.name;return!!(!((no=ro.injectedConfig)===null||no===void 0)&&no.find(so=>so.walletStandard))&&!!SolanaWalletStandardConnector.getWallet(Xr,to)?class extends SolanaWalletStandardConnector{constructor(co){super(Object.assign({},co)),this.name=oo,this.overrideKey=to}}:class extends InjectedWalletBase{constructor(so){super(Object.assign({},so)),this.name=oo,this.wallet=ro,this.overrideKey=to}}})};class UnknownInjected extends InjectedWalletBase{constructor(eo){super(eo),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}class FallbackSolanaConnector extends InjectedWalletBase{constructor(eo){super(eo),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}assertPackageVersion("@dynamic-labs/solana",version$3);const SolanaWalletConnectors=Xr=>[...injectedWalletOverrides,...fetchInjectedWalletConnectors(Xr),...TurnkeySolanaWalletConnectors(Xr),Phantom,UnknownInjected,FallbackSolanaConnector];var version$1="3.4.4";function __awaiter(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(fo){oo(fo)}}function so(lo){try{co(ro.throw(lo))}catch(fo){oo(fo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var h$2=Object.defineProperty,Q$2=(Xr,eo,to)=>eo in Xr?h$2(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,T$3=(Xr,eo,to)=>(Q$2(Xr,eo+"",to),to),y$4=(Xr,eo,to)=>{if(!eo.has(Xr))throw TypeError("Cannot "+to)},i=(Xr,eo,to)=>(y$4(Xr,eo,"read from private field"),to?to.call(Xr):eo.get(Xr)),z$2=(Xr,eo,to)=>{if(eo.has(Xr))throw TypeError("Cannot add the same private member more than once");eo instanceof WeakSet?eo.add(Xr):eo.set(Xr,to)},C$3=(Xr,eo,to,ro)=>(y$4(Xr,eo,"write to private field"),eo.set(Xr,to),to),l$2=(Xr,eo,to)=>(y$4(Xr,eo,"access private method"),to);const Y$2=[{id:"argentX",name:"Argent X",icon:"data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgNDAgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNC43NTgyIC0zLjk3MzY0ZS0wN0gxNC42MjM4QzE0LjI4NTEgLTMuOTczNjRlLTA3IDE0LjAxMzggMC4yODExNzggMTQuMDA2NCAwLjYzMDY4M0MxMy44MDE3IDEwLjQ1NDkgOC44MjIzNCAxOS43NzkyIDAuMjUxODkzIDI2LjM4MzdDLTAuMDIwMjA0NiAyNi41OTMzIC0wLjA4MjE5NDYgMjYuOTg3MiAwLjExNjczNCAyNy4yNzA5TDYuMDQ2MjMgMzUuNzM0QzYuMjQ3OTYgMzYuMDIyIDYuNjQwOTkgMzYuMDg3IDYuOTE3NjYgMzUuODc1NEMxMi4yNzY1IDMxLjc3MjggMTYuNTg2OSAyNi44MjM2IDE5LjY5MSAyMS4zMzhDMjIuNzk1MSAyNi44MjM2IDI3LjEwNTcgMzEuNzcyOCAzMi40NjQ2IDM1Ljg3NTRDMzIuNzQxIDM2LjA4NyAzMy4xMzQxIDM2LjAyMiAzMy4zMzYxIDM1LjczNEwzOS4yNjU2IDI3LjI3MDlDMzkuNDY0MiAyNi45ODcyIDM5LjQwMjIgMjYuNTkzMyAzOS4xMzA0IDI2LjM4MzdDMzAuNTU5NyAxOS43NzkyIDI1LjU4MDQgMTAuNDU0OSAyNS4zNzU5IDAuNjMwNjgzQzI1LjM2ODUgMC4yODExNzggMjUuMDk2OSAtMy45NzM2NGUtMDcgMjQuNzU4MiAtMy45NzM2NGUtMDdaIiBmaWxsPSIjRkY4NzVCIi8+Cjwvc3ZnPgo=",downloads:{chrome:"https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb",firefox:"https://addons.mozilla.org/en-US/firefox/addon/argent-x"}},{id:"braavos",name:"Braavos",icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aAogICAgICAgIGQ9Ik02Mi43MDUgMTMuOTExNkM2Mi44MzU5IDE0LjEzMzMgNjIuNjYyMSAxNC40MDcgNjIuNDAzOSAxNC40MDdDNTcuMTgwNyAxNC40MDcgNTIuOTM0OCAxOC41NDI3IDUyLjgzNTEgMjMuNjgxN0M1MS4wNDY1IDIzLjM0NzcgNDkuMTkzMyAyMy4zMjI2IDQ3LjM2MjYgMjMuNjMxMUM0Ny4yMzYxIDE4LjUxNTYgNDMuMDAwOSAxNC40MDcgMzcuNzk0OCAxNC40MDdDMzcuNTM2NSAxNC40MDcgMzcuMzYyNSAxNC4xMzMxIDM3LjQ5MzUgMTMuOTExMkM0MC4wMjE3IDkuNjI4MDkgNDQuNzIwNCA2Ljc1IDUwLjA5OTEgNi43NUM1NS40NzgxIDYuNzUgNjAuMTc2OSA5LjYyODI2IDYyLjcwNSAxMy45MTE2WiIKICAgICAgICBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfMzcyXzQwMjU5KSIgLz4KICAgIDxwYXRoCiAgICAgICAgZD0iTTc4Ljc2MDYgNDUuODcxOEM4MC4yNzI1IDQ2LjMyOTcgODEuNzAyNSA0NS4wMDU1IDgxLjE3MTQgNDMuNTIyMkM3Ni40MTM3IDMwLjIzMzQgNjEuMzkxMSAyNC44MDM5IDUwLjAyNzcgMjQuODAzOUMzOC42NDQyIDI0LjgwMzkgMjMuMjg2OCAzMC40MDcgMTguODc1NCA0My41OTEyQzE4LjM4MjQgNDUuMDY0NSAxOS44MDgzIDQ2LjM0NDYgMjEuMjk3OCA0NS44ODgxTDQ4Ljg3MiAzNy40MzgxQzQ5LjUzMzEgMzcuMjM1NSA1MC4yMzk5IDM3LjIzNDQgNTAuOTAxNyAzNy40MzQ4TDc4Ljc2MDYgNDUuODcxOFoiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8cGF0aAogICAgICAgIGQ9Ik0xOC44MTMyIDQ4LjE3MDdMNDguODkzNSAzOS4wNDcyQzQ5LjU1MDYgMzguODQ3OCA1MC4yNTI0IDM4Ljg0NzMgNTAuOTA5OCAzOS4wNDU2TDgxLjE3ODEgNDguMTc1MkM4My42OTEyIDQ4LjkzMzIgODUuNDExIDUxLjI0ODMgODUuNDExIDUzLjg3MzVWODEuMjIzM0M4NS4yOTQ0IDg3Ljg5OTEgNzkuMjk3NyA5My4yNSA3Mi42MjQ1IDkzLjI1SDYxLjU0MDZDNjAuNDQ0OSA5My4yNSA1OS41NTc3IDkyLjM2MzcgNTkuNTU3NyA5MS4yNjhWODEuNjc4OUM1OS41NTc3IDc3LjkwMzEgNjEuNzkyMSA3NC40ODU1IDY1LjI0OTggNzIuOTcyOUM2OS44ODQ5IDcwLjk0NTQgNzUuMzY4MSA2OC4yMDI4IDc2LjM5OTQgNjIuNjk5MkM3Ni43MzIzIDYwLjkyMjkgNzUuNTc0MSA1OS4yMDk0IDczLjgwMjQgNTguODU3M0M2OS4zMjI2IDU3Ljk2NjcgNjQuMzU2MiA1OC4zMTA3IDYwLjE1NjQgNjAuMTg5M0M1NS4zODg3IDYyLjMyMTkgNTQuMTQxNSA2NS44Njk0IDUzLjY3OTcgNzAuNjMzN0w1My4xMjAxIDc1Ljc2NjJDNTIuOTQ5MSA3Ny4zMzQ5IDUxLjQ3ODUgNzguNTM2NiA0OS45MDE0IDc4LjUzNjZDNDguMjY5OSA3OC41MzY2IDQ3LjA0NjUgNzcuMjk0IDQ2Ljg2OTYgNzUuNjcxMkw0Ni4zMjA0IDcwLjYzMzdDNDUuOTI0OSA2Ni41NTI5IDQ1LjIwNzkgNjIuNTg4NyA0MC45ODk1IDYwLjcwMThDMzYuMTc3NiA1OC41NDk0IDMxLjM0MTkgNTcuODM0NyAyNi4xOTc2IDU4Ljg1NzNDMjQuNDI2IDU5LjIwOTQgMjMuMjY3OCA2MC45MjI5IDIzLjYwMDcgNjIuNjk5MkMyNC42NDEgNjguMjUwNyAzMC4wODEyIDcwLjkzMDUgMzQuNzUwMyA3Mi45NzI5QzM4LjIwOCA3NC40ODU1IDQwLjQ0MjQgNzcuOTAzMSA0MC40NDI0IDgxLjY3ODlWOTEuMjY2M0M0MC40NDI0IDkyLjM2MiAzOS41NTU1IDkzLjI1IDM4LjQ1OTkgOTMuMjVIMjcuMzc1NkMyMC43MDI0IDkzLjI1IDE0LjcwNTcgODcuODk5MSAxNC41ODkxIDgxLjIyMzNWNTMuODY2M0MxNC41ODkxIDUxLjI0NDYgMTYuMzA0NSA0OC45MzE2IDE4LjgxMzIgNDguMTcwN1oiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDJfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMzcyXzQwMjU5IiB4MT0iNDkuMzA1NyIgeTE9IjIuMDc5IiB4Mj0iODAuMzYyNyIgeTI9IjkzLjY1OTciCiAgICAgICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIgLz4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY5NjAwIiAvPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzM3Ml80MDI1OSIgeDE9IjQ5LjMwNTciIHkxPSIyLjA3OSIgeDI9IjgwLjM2MjciIHkyPSI5My42NTk3IgogICAgICAgICAgICBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGNUQ0NUUiIC8+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0ZGOTYwMCIgLz4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQyX2xpbmVhcl8zNzJfNDAyNTkiIHgxPSI0OS4zMDU3IiB5MT0iMi4wNzkiIHgyPSI4MC4zNjI3IiB5Mj0iOTMuNjU5NyIKICAgICAgICAgICAgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjVENDVFIiAvPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiIC8+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KPC9zdmc+",downloads:{chrome:"https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",firefox:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet",edge:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc"}}],U$3=()=>`${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,w$1=Xr=>{for(let eo=Xr.length-1;eo>0;eo--){const to=Math.floor(Math.random()*(eo+1));[Xr[eo],Xr[to]]=[Xr[to],Xr[eo]]}return Xr};function s$1(...Xr){return eo=>Xr.reduce((to,ro)=>to.then(ro),Promise.resolve(eo))}var A$3,c,u$1,r,S$2,a$1,n;let f$2=class{constructor(eo){z$2(this,r),z$2(this,a$1),z$2(this,A$3,!1),z$2(this,c,void 0),z$2(this,u$1,void 0),T$3(this,"value"),C$3(this,u$1,eo),l$2(this,a$1,n).call(this)}set(eo){return!i(this,A$3)&&!l$2(this,a$1,n).call(this)?!1:(this.delete(),this.value=eo,eo&&(C$3(this,c,`${i(this,u$1)}-${U$3()}`),localStorage.setItem(i(this,c),eo)),!0)}get(){return l$2(this,r,S$2).call(this),this.value}delete(){return!i(this,A$3)&&!l$2(this,a$1,n).call(this)?!1:(this.value=null,i(this,c)&&localStorage.removeItem(i(this,c)),!0)}};A$3=new WeakMap,c=new WeakMap,u$1=new WeakMap,r=new WeakSet,S$2=function(){this.value&&this.set(this.value)},a$1=new WeakSet,n=function(){try{!i(this,A$3)&&typeof window<"u"&&(C$3(this,c,Object.keys(localStorage).find(Xr=>Xr.startsWith(i(this,u$1)))),C$3(this,A$3,!0),i(this,c)&&this.set(localStorage.getItem(i(this,c))))}catch(Xr){console.warn(Xr)}return i(this,A$3)};function O$4(Xr,eo){var to,ro;if((to=eo==null?void 0:eo.include)!=null&&to.length){const no=new Set(eo.include);return Xr.filter(io=>no.has(io.id))}if((ro=eo==null?void 0:eo.exclude)!=null&&ro.length){const no=new Set(eo.exclude);return Xr.filter(io=>!no.has(io.id))}return Xr}const x$1=async Xr=>{const eo=await Promise.all(Xr.map(to=>to.isPreauthorized().catch(()=>!1)));return Xr.filter((to,ro)=>eo[ro])},m=Xr=>{try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1};function o$1(Xr,eo){return Object.values(Object.getOwnPropertyNames(Xr).reduce((to,ro)=>{if(ro.startsWith("starknet")){const no=Xr[ro];eo(no)&&!to[no.id]&&(to[no.id]=no)}return to},{}))}const d$3=(Xr,eo)=>{if(eo&&Array.isArray(eo)){Xr.sort((ro,no)=>eo.indexOf(ro.id)-eo.indexOf(no.id));const to=Xr.length-eo.length;return[...Xr.slice(to),...w$1(Xr.slice(0,to))]}else return w$1(Xr)},b$2=typeof window<"u"?window:{},E$1={windowObject:b$2,isWalletObject:m,storageFactoryImplementation:Xr=>new f$2(Xr)};function W$3(Xr={}){const{storageFactoryImplementation:eo,windowObject:to,isWalletObject:ro}={...E$1,...Xr},no=eo("gsw-last");return{getAvailableWallets:async(io={})=>{const oo=o$1(to,ro);return s$1(ao=>O$4(ao,io),ao=>d$3(ao,io.sort))(oo)},getPreAuthorizedWallets:async(io={})=>{const oo=o$1(to,ro);return s$1(ao=>x$1(ao),ao=>O$4(ao,io),ao=>d$3(ao,io.sort))(oo)},getDiscoveryWallets:async(io={})=>s$1(oo=>O$4(oo,io),oo=>d$3(oo,io.sort))(Y$2),getLastConnectedWallet:async()=>{const io=no.get(),oo=o$1(to,ro).find(so=>so.id===io),[ao]=await x$1(oo?[oo]:[]);return ao||(no.delete(),null)},enable:async(io,oo)=>{if(await io.enable(oo??{starknetVersion:"v5"}),!io.isConnected)throw new Error("Failed to connect to wallet");return no.set(io.id),io},disconnect:async({clearLastWallet:io}={})=>{io&&no.delete()}}}W$3();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$8=BigInt(0),_1n$8=BigInt(1),_2n$4=BigInt(2);function isBytes$3(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const hexes$1=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex$1(Xr){if(!isBytes$3(Xr))throw new Error("Uint8Array expected");let eo="";for(let to=0;to=asciis$1._0&&Xr<=asciis$1._9)return Xr-asciis$1._0;if(Xr>=asciis$1._A&&Xr<=asciis$1._F)return Xr-(asciis$1._A-10);if(Xr>=asciis$1._a&&Xr<=asciis$1._f)return Xr-(asciis$1._a-10)}function hexToBytes$2(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no_0n$8;Xr>>=_1n$8,eo+=1);return eo}function bitGet$1(Xr,eo){return Xr>>BigInt(eo)&_1n$8}const bitSet$1=(Xr,eo,to)=>Xr|(to?_1n$8:_0n$8)<(_2n$4<new Uint8Array(Xr),u8fr$1=Xr=>Uint8Array.from(Xr);function createHmacDrbg$1(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n$1(Xr),no=u8n$1(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...fo)=>to(no,ro,...fo),so=(fo=u8n$1())=>{no=ao(u8fr$1([0]),fo),ro=ao(),fo.length!==0&&(no=ao(u8fr$1([1]),fo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let fo=0;const ho=[];for(;fo{oo(),so(fo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns$1={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes$3(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject$1(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns$1[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const ut$3=Object.freeze(Object.defineProperty({__proto__:null,bitGet:bitGet$1,bitLen:bitLen$1,bitMask:bitMask$1,bitSet:bitSet$1,bytesToHex:bytesToHex$1,bytesToNumberBE:bytesToNumberBE$1,bytesToNumberLE:bytesToNumberLE$1,concatBytes:concatBytes$2,createHmacDrbg:createHmacDrbg$1,ensureBytes:ensureBytes$2,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,isBytes:isBytes$3,numberToBytesBE:numberToBytesBE$1,numberToBytesLE:numberToBytesLE$1,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE:numberToVarBytesBE$1,utf8ToBytes:utf8ToBytes$2,validateObject:validateObject$1},Symbol.toStringTag,{value:"Module"}));function number(Xr){if(!Number.isSafeInteger(Xr)||Xr<0)throw new Error(`Wrong positive integer: ${Xr}`)}function isBytes$2(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function bytes(Xr,...eo){if(!isBytes$2(Xr))throw new Error("Expected Uint8Array");if(eo.length>0&&!eo.includes(Xr.length))throw new Error(`Expected Uint8Array of length ${eo}, not of length=${Xr.length}`)}function hash(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(Xr.outputLen),number(Xr.blockLen)}function exists(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output(Xr,eo){bytes(Xr);const to=eo.outputLen;if(Xr.length>_32n&U32_MASK64)}:{h:Number(Xr>>_32n&U32_MASK64)|0,l:Number(Xr&U32_MASK64)|0}}function split(Xr,eo=!1){let to=new Uint32Array(Xr.length),ro=new Uint32Array(Xr.length);for(let no=0;noXr<>>32-to,rotlSL=(Xr,eo,to)=>eo<>>32-to,rotlBH=(Xr,eo,to)=>eo<>>64-to,rotlBL=(Xr,eo,to)=>Xr<>>64-to,crypto$1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32=Xr=>new Uint32Array(Xr.buffer,Xr.byteOffset,Math.floor(Xr.byteLength/4));function isBytes$1(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const createView=Xr=>new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),rotr=(Xr,eo)=>Xr<<32-eo|Xr>>>eo,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$1(Xr){if(typeof Xr!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Xr}`);return new Uint8Array(new TextEncoder().encode(Xr))}function toBytes(Xr){if(typeof Xr=="string"&&(Xr=utf8ToBytes$1(Xr)),!isBytes$1(Xr))throw new Error(`expected Uint8Array, got ${typeof Xr}`);return Xr}function concatBytes$1(...Xr){let eo=0;for(let ro=0;roXr().update(toBytes(ro)).digest(),to=Xr();return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=()=>Xr(),eo}function randomBytes(Xr=32){if(crypto$1&&typeof crypto$1.getRandomValues=="function")return crypto$1.getRandomValues(new Uint8Array(Xr));throw new Error("crypto.getRandomValues must be defined")}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n$7=BigInt(0),_1n$7=BigInt(1),_2n$3=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let Xr=0,eo=_1n$7,to=1,ro=0;Xr<24;Xr++){[to,ro]=[ro,(2*to+3*ro)%5],SHA3_PI.push(2*(5*ro+to)),SHA3_ROTL.push((Xr+1)*(Xr+2)/2%64);let no=_0n$7;for(let io=0;io<7;io++)eo=(eo<<_1n$7^(eo>>_7n)*_0x71n)%_256n,eo&_2n$3&&(no^=_1n$7<<(_1n$7<to>32?rotlBH(Xr,eo,to):rotlSH(Xr,eo,to),rotlL=(Xr,eo,to)=>to>32?rotlBL(Xr,eo,to):rotlSL(Xr,eo,to);function keccakP(Xr,eo=24){const to=new Uint32Array(10);for(let ro=24-eo;ro<24;ro++){for(let oo=0;oo<10;oo++)to[oo]=Xr[oo]^Xr[oo+10]^Xr[oo+20]^Xr[oo+30]^Xr[oo+40];for(let oo=0;oo<10;oo+=2){const ao=(oo+8)%10,so=(oo+2)%10,co=to[so],lo=to[so+1],fo=rotlH(co,lo,1)^to[ao],ho=rotlL(co,lo,1)^to[ao+1];for(let go=0;go<50;go+=10)Xr[oo+go]^=fo,Xr[oo+go+1]^=ho}let no=Xr[2],io=Xr[3];for(let oo=0;oo<24;oo++){const ao=SHA3_ROTL[oo],so=rotlH(no,io,ao),co=rotlL(no,io,ao),lo=SHA3_PI[oo];no=Xr[lo],io=Xr[lo+1],Xr[lo]=so,Xr[lo+1]=co}for(let oo=0;oo<50;oo+=10){for(let ao=0;ao<10;ao++)to[ao]=Xr[oo+ao];for(let ao=0;ao<10;ao++)Xr[oo+ao]^=~to[(ao+2)%10]&to[(ao+4)%10]}Xr[0]^=SHA3_IOTA_H[ro],Xr[1]^=SHA3_IOTA_L[ro]}to.fill(0)}class Keccak extends Hash{constructor(eo,to,ro,no=!1,io=24){if(super(),this.blockLen=eo,this.suffix=to,this.outputLen=ro,this.enableXOF=no,this.rounds=io,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number(ro),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(eo){exists(this);const{blockLen:to,state:ro}=this;eo=toBytes(eo);const no=eo.length;for(let io=0;io=ro&&this.keccak();const oo=Math.min(ro-this.posOut,io-no);eo.set(to.subarray(this.posOut,this.posOut+oo),no),this.posOut+=oo,no+=oo}return eo}xofInto(eo){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(eo)}xof(eo){return number(eo),this.xofInto(new Uint8Array(eo))}digestInto(eo){if(output(eo,this),this.finished)throw new Error("digest() was already called");return this.writeInto(eo),this.destroy(),eo}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(eo){const{blockLen:to,suffix:ro,outputLen:no,rounds:io,enableXOF:oo}=this;return eo||(eo=new Keccak(to,ro,no,oo,io)),eo.state32.set(this.state32),eo.pos=this.pos,eo.posOut=this.posOut,eo.finished=this.finished,eo.rounds=io,eo.suffix=ro,eo.outputLen=no,eo.enableXOF=oo,eo.destroyed=this.destroyed,eo}}const gen=(Xr,eo,to)=>wrapConstructor(()=>new Keccak(eo,Xr,to)),keccak_256=gen(1,136,256/8);function setBigUint64(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}class SHA2 extends Hash{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=createView(this.buffer)}update(eo){exists(this);const{view:to,buffer:ro,blockLen:no}=this;eo=toBytes(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let fo=oo;folo.length)throw new Error("_sha2: outputLen bigger than state");for(let fo=0;foXr&eo^~Xr&to,Maj=(Xr,eo,to)=>Xr&eo^Xr&to^eo&to,SHA256_K=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]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so}=this;return[eo,to,ro,no,io,oo,ao,so]}set(eo,to,ro,no,io,oo,ao,so){this.A=eo|0,this.B=to|0,this.C=ro|0,this.D=no|0,this.E=io|0,this.F=oo|0,this.G=ao|0,this.H=so|0}process(eo,to){for(let fo=0;fo<16;fo++,to+=4)SHA256_W[fo]=eo.getUint32(to,!1);for(let fo=16;fo<64;fo++){const ho=SHA256_W[fo-15],go=SHA256_W[fo-2],yo=rotr(ho,7)^rotr(ho,18)^ho>>>3,vo=rotr(go,17)^rotr(go,19)^go>>>10;SHA256_W[fo]=vo+SHA256_W[fo-7]+yo+SHA256_W[fo-16]|0}let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this;for(let fo=0;fo<64;fo++){const ho=rotr(ao,6)^rotr(ao,11)^rotr(ao,25),go=lo+ho+Chi(ao,so,co)+SHA256_K[fo]+SHA256_W[fo]|0,vo=(rotr(ro,2)^rotr(ro,13)^rotr(ro,22))+Maj(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+go|0,oo=io,io=no,no=ro,ro=go+vo|0}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,so=so+this.F|0,co=co+this.G|0,lo=lo+this.H|0,this.set(ro,no,io,oo,ao,so,co,lo)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256=wrapConstructor(()=>new SHA256);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$6=BigInt(1),_2n$2=BigInt(2);function isBytes(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const hexes=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex(Xr){if(!isBytes(Xr))throw new Error("Uint8Array expected");let eo="";for(let to=0;to=asciis._0&&Xr<=asciis._9)return Xr-asciis._0;if(Xr>=asciis._A&&Xr<=asciis._F)return Xr-(asciis._A-10);if(Xr>=asciis._a&&Xr<=asciis._f)return Xr-(asciis._a-10)}function hexToBytes$1(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no_0n$6;Xr>>=_1n$6,eo+=1);return eo}function bitGet(Xr,eo){return Xr>>BigInt(eo)&_1n$6}const bitSet=(Xr,eo,to)=>Xr|(to?_1n$6:_0n$6)<(_2n$2<new Uint8Array(Xr),u8fr=Xr=>Uint8Array.from(Xr);function createHmacDrbg(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n(Xr),no=u8n(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...fo)=>to(no,ro,...fo),so=(fo=u8n())=>{no=ao(u8fr([0]),fo),ro=ao(),fo.length!==0&&(no=ao(u8fr([1]),fo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let fo=0;const ho=[];for(;fo{oo(),so(fo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const ut$2=Object.freeze(Object.defineProperty({__proto__:null,bitGet,bitLen,bitMask,bitSet,bytesToHex,bytesToNumberBE,bytesToNumberLE,concatBytes,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes,hexToBytes:hexToBytes$1,hexToNumber,isBytes,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$5=BigInt(1),_2n$1=BigInt(2),_3n$2=BigInt(3),_4n$1=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);BigInt(9);BigInt(16);function mod$1(Xr,eo){const to=Xr%eo;return to>=_0n$5?to:eo+to}function pow(Xr,eo,to){if(to<=_0n$5||eo<_0n$5)throw new Error("Expected power/modulo > 0");if(to===_1n$5)return _0n$5;let ro=_1n$5;for(;eo>_0n$5;)eo&_1n$5&&(ro=ro*Xr%to),Xr=Xr*Xr%to,eo>>=_1n$5;return ro}function invert$1(Xr,eo){if(Xr===_0n$5||eo<=_0n$5)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod$1(Xr,eo),ro=eo,no=_0n$5,io=_1n$5;for(;to!==_0n$5;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$5)throw new Error("invert: does not exist");return mod$1(no,eo)}function tonelliShanks(Xr){const eo=(Xr-_1n$5)/_2n$1;let to,ro,no;for(to=Xr-_1n$5,ro=0;to%_2n$1===_0n$5;to/=_2n$1,ro++);for(no=_2n$1;no(ro[no]="function",ro),eo);return validateObject(Xr,to)}function FpPow$1(Xr,eo,to){if(to<_0n$5)throw new Error("Expected power > 0");if(to===_0n$5)return Xr.ONE;if(to===_1n$5)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$5;)to&_1n$5&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$5;return ro}function FpInvertBatch(Xr,eo){const to=new Array(eo.length),ro=eo.reduce((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=io,Xr.mul(io,oo)),Xr.ONE),no=Xr.inv(ro);return eo.reduceRight((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=Xr.mul(io,to[ao]),Xr.mul(io,oo)),no),to}function nLength$1(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function Field(Xr,eo,to=!1,ro={}){if(Xr<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${Xr}`);const{nBitLength:no,nByteLength:io}=nLength$1(Xr,eo);if(io>2048)throw new Error("Field lengths over 2048 bytes are not supported");const oo=FpSqrt(Xr),ao=Object.freeze({ORDER:Xr,BITS:no,BYTES:io,MASK:bitMask(no),ZERO:_0n$5,ONE:_1n$5,create:so=>mod$1(so,Xr),isValid:so=>{if(typeof so!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof so}`);return _0n$5<=so&&soso===_0n$5,isOdd:so=>(so&_1n$5)===_1n$5,neg:so=>mod$1(-so,Xr),eql:(so,co)=>so===co,sqr:so=>mod$1(so*so,Xr),add:(so,co)=>mod$1(so+co,Xr),sub:(so,co)=>mod$1(so-co,Xr),mul:(so,co)=>mod$1(so*co,Xr),pow:(so,co)=>FpPow$1(ao,so,co),div:(so,co)=>mod$1(so*invert$1(co,Xr),Xr),sqrN:so=>so*so,addN:(so,co)=>so+co,subN:(so,co)=>so-co,mulN:(so,co)=>so*co,inv:so=>invert$1(so,Xr),sqrt:ro.sqrt||(so=>oo(ao,so)),invertBatch:so=>FpInvertBatch(ao,so),cmov:(so,co,lo)=>lo?co:so,toBytes:so=>to?numberToBytesLE(so,io):numberToBytesBE(so,io),fromBytes:so=>{if(so.length!==io)throw new Error(`Fp.fromBytes: expected ${io}, got ${so.length}`);return to?bytesToNumberLE(so):bytesToNumberBE(so)}});return Object.freeze(ao)}function getFieldBytesLength$1(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength$1(Xr){const eo=getFieldBytesLength$1(Xr);return eo+Math.ceil(eo/2)}function mapHashToField$1(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength$1(eo),io=getMinHashLength$1(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE(Xr):bytesToNumberLE(Xr),ao=mod$1(oo,eo-_1n$5)+_1n$5;return to?numberToBytesLE(ao,no):numberToBytesBE(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validateOpts$3(Xr){const{Fp:eo,mds:to,reversePartialPowIdx:ro,roundConstants:no}=Xr,{roundsFull:io,roundsPartial:oo,sboxPower:ao,t:so}=Xr;validateField$1(eo);for(const yo of["t","roundsFull","roundsPartial"])if(typeof Xr[yo]!="number"||!Number.isSafeInteger(Xr[yo]))throw new Error(`Poseidon: invalid param ${yo}=${Xr[yo]} (${typeof Xr[yo]})`);if(!Array.isArray(to)||to.length!==so)throw new Error("Poseidon: wrong MDS matrix");const co=to.map(yo=>{if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon MDS matrix row: ${yo}`);return yo.map(vo=>{if(typeof vo!="bigint")throw new Error(`Poseidon MDS matrix value=${vo}`);return eo.create(vo)})});if(ro!==void 0&&typeof ro!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${ro}`);if(io%2!==0)throw new Error(`Poseidon roundsFull is not even: ${io}`);const lo=io+oo;if(!Array.isArray(no)||no.length!==lo)throw new Error("Poseidon: wrong round constants");const fo=no.map(yo=>{if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon wrong round constants: ${yo}`);return yo.map(vo=>{if(typeof vo!="bigint"||!eo.isValid(vo))throw new Error(`Poseidon wrong round constant=${vo}`);return eo.create(vo)})});if(!ao||![3,5,7].includes(ao))throw new Error(`Poseidon wrong sboxPower=${ao}`);const ho=BigInt(ao);let go=yo=>FpPow$1(eo,yo,ho);return ao===3?go=yo=>eo.mul(eo.sqrN(yo),yo):ao===5&&(go=yo=>eo.mul(eo.sqrN(eo.sqrN(yo)),yo)),Object.freeze({...Xr,rounds:lo,sboxFn:go,roundConstants:fo,mds:co})}function poseidon$2(Xr){const eo=validateOpts$3(Xr),{Fp:to,mds:ro,roundConstants:no,rounds:io,roundsPartial:oo,sboxFn:ao,t:so}=eo,co=eo.roundsFull/2,lo=eo.reversePartialPowIdx?so-1:0,fo=(go,yo,vo)=>(go=go.map((wo,Eo)=>to.add(wo,no[vo][Eo])),yo?go=go.map(wo=>ao(wo)):go[lo]=ao(go[lo]),go=ro.map(wo=>wo.reduce((Eo,ko,Ao)=>to.add(Eo,to.mulN(ko,go[Ao])),to.ZERO)),go),ho=function(yo){if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${so})`);yo=yo.map(wo=>{if(typeof wo!="bigint")throw new Error(`Poseidon: wrong value=${wo} (${typeof wo})`);return to.create(wo)});let vo=0;for(let wo=0;wo{const oo=io.negate();return no?oo:io},ro=no=>{const io=Math.ceil(eo/no)+1,oo=2**(no-1);return{windows:io,windowSize:oo}};return{constTimeNegate:to,unsafeLadder(no,io){let oo=Xr.ZERO,ao=no;for(;io>_0n$4;)io&_1n$4&&(oo=oo.add(ao)),ao=ao.double(),io>>=_1n$4;return oo},precomputeWindow(no,io){const{windows:oo,windowSize:ao}=ro(io),so=[];let co=no,lo=co;for(let fo=0;fo>=go,wo>so&&(wo-=ho,oo+=_1n$4);const Eo=vo,ko=vo+Math.abs(wo)-1,Ao=yo%2!==0,Po=wo<0;wo===0?lo=lo.add(to(Ao,io[Eo])):co=co.add(to(Po,io[ko]))}return{p:co,f:lo}},wNAFCached(no,io,oo,ao){const so=no._WINDOW_SIZE||1;let co=io.get(no);return co||(co=this.precomputeWindow(no,so),so!==1&&io.set(no,ao(co))),this.wNAF(so,co,oo)}}}function validateBasic$1(Xr){return validateField$1(Xr.Fp),validateObject(Xr,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength$1(Xr.n,Xr.nBitLength),...Xr,p:Xr.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts$1(Xr){const eo=validateBasic$1(Xr);validateObject(eo,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:to,Fp:ro,a:no}=eo;if(to){if(!ro.eql(no,ro.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof to!="object"||typeof to.beta!="bigint"||typeof to.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...eo})}const{bytesToNumberBE:b2n$1,hexToBytes:h2b$1}=ut$2,DER$1={Err:class extends Error{constructor(eo=""){super(eo)}},_parseInt(Xr){const{Err:eo}=DER$1;if(Xr.length<2||Xr[0]!==2)throw new eo("Invalid signature integer tag");const to=Xr[1],ro=Xr.subarray(2,to+2);if(!to||ro.length!==to)throw new eo("Invalid signature integer: wrong length");if(ro[0]&128)throw new eo("Invalid signature integer: negative");if(ro[0]===0&&!(ro[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return{d:b2n$1(ro),l:Xr.subarray(to+2)}},toSig(Xr){const{Err:eo}=DER$1,to=typeof Xr=="string"?h2b$1(Xr):Xr;if(!isBytes(to))throw new Error("ui8a expected");let ro=to.length;if(ro<2||to[0]!=48)throw new eo("Invalid signature tag");if(to[1]!==ro-2)throw new eo("Invalid signature: incorrect length");const{d:no,l:io}=DER$1._parseInt(to.subarray(2)),{d:oo,l:ao}=DER$1._parseInt(io);if(ao.length)throw new eo("Invalid signature: left bytes after parsing");return{r:no,s:oo}},hexFromSig(Xr){const eo=co=>Number.parseInt(co[0],16)&8?"00"+co:co,to=co=>{const lo=co.toString(16);return lo.length&1?`0${lo}`:lo},ro=eo(to(Xr.s)),no=eo(to(Xr.r)),io=ro.length/2,oo=no.length/2,ao=to(io),so=to(oo);return`30${to(oo+io+4)}02${so}${no}02${ao}${ro}`}},_0n$3=BigInt(0),_1n$3=BigInt(1);BigInt(2);const _3n$1=BigInt(3);BigInt(4);function weierstrassPoints$1(Xr){const eo=validatePointOpts$1(Xr),{Fp:to}=eo,ro=eo.toBytes||((yo,vo,wo)=>{const Eo=vo.toAffine();return concatBytes(Uint8Array.from([4]),to.toBytes(Eo.x),to.toBytes(Eo.y))}),no=eo.fromBytes||(yo=>{const vo=yo.subarray(1),wo=to.fromBytes(vo.subarray(0,to.BYTES)),Eo=to.fromBytes(vo.subarray(to.BYTES,2*to.BYTES));return{x:wo,y:Eo}});function io(yo){const{a:vo,b:wo}=eo,Eo=to.sqr(yo),ko=to.mul(Eo,yo);return to.add(to.add(ko,to.mul(yo,vo)),wo)}if(!to.eql(to.sqr(eo.Gy),io(eo.Gx)))throw new Error("bad generator point: equation left != right");function oo(yo){return typeof yo=="bigint"&&_0n$3to.eql(Ao,to.ZERO);return ko(wo)&&ko(Eo)?fo.ZERO:new fo(wo,Eo,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(vo){const wo=to.invertBatch(vo.map(Eo=>Eo.pz));return vo.map((Eo,ko)=>Eo.toAffine(wo[ko])).map(fo.fromAffine)}static fromHex(vo){const wo=fo.fromAffine(no(ensureBytes$1("pointHex",vo)));return wo.assertValidity(),wo}static fromPrivateKey(vo){return fo.BASE.multiply(so(vo))}_setWindowSize(vo){this._WINDOW_SIZE=vo,co.delete(this)}assertValidity(){if(this.is0()){if(eo.allowInfinityPoint&&!to.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:vo,y:wo}=this.toAffine();if(!to.isValid(vo)||!to.isValid(wo))throw new Error("bad point: x or y not FE");const Eo=to.sqr(wo),ko=io(vo);if(!to.eql(Eo,ko))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:vo}=this.toAffine();if(to.isOdd)return!to.isOdd(vo);throw new Error("Field doesn't support isOdd")}equals(vo){lo(vo);const{px:wo,py:Eo,pz:ko}=this,{px:Ao,py:Po,pz:jo}=vo,Mo=to.eql(to.mul(wo,jo),to.mul(Ao,ko)),No=to.eql(to.mul(Eo,jo),to.mul(Po,ko));return Mo&&No}negate(){return new fo(this.px,to.neg(this.py),this.pz)}double(){const{a:vo,b:wo}=eo,Eo=to.mul(wo,_3n$1),{px:ko,py:Ao,pz:Po}=this;let jo=to.ZERO,Mo=to.ZERO,No=to.ZERO,Do=to.mul(ko,ko),Fo=to.mul(Ao,Ao),Xo=to.mul(Po,Po),Lo=to.mul(ko,Ao);return Lo=to.add(Lo,Lo),No=to.mul(ko,Po),No=to.add(No,No),jo=to.mul(vo,No),Mo=to.mul(Eo,Xo),Mo=to.add(jo,Mo),jo=to.sub(Fo,Mo),Mo=to.add(Fo,Mo),Mo=to.mul(jo,Mo),jo=to.mul(Lo,jo),No=to.mul(Eo,No),Xo=to.mul(vo,Xo),Lo=to.sub(Do,Xo),Lo=to.mul(vo,Lo),Lo=to.add(Lo,No),No=to.add(Do,Do),Do=to.add(No,Do),Do=to.add(Do,Xo),Do=to.mul(Do,Lo),Mo=to.add(Mo,Do),Xo=to.mul(Ao,Po),Xo=to.add(Xo,Xo),Do=to.mul(Xo,Lo),jo=to.sub(jo,Do),No=to.mul(Xo,Fo),No=to.add(No,No),No=to.add(No,No),new fo(jo,Mo,No)}add(vo){lo(vo);const{px:wo,py:Eo,pz:ko}=this,{px:Ao,py:Po,pz:jo}=vo;let Mo=to.ZERO,No=to.ZERO,Do=to.ZERO;const Fo=eo.a,Xo=to.mul(eo.b,_3n$1);let Lo=to.mul(wo,Ao),Bo=to.mul(Eo,Po),xo=to.mul(ko,jo),uo=to.add(wo,Eo),po=to.add(Ao,Po);uo=to.mul(uo,po),po=to.add(Lo,Bo),uo=to.sub(uo,po),po=to.add(wo,ko);let bo=to.add(Ao,jo);return po=to.mul(po,bo),bo=to.add(Lo,xo),po=to.sub(po,bo),bo=to.add(Eo,ko),Mo=to.add(Po,jo),bo=to.mul(bo,Mo),Mo=to.add(Bo,xo),bo=to.sub(bo,Mo),Do=to.mul(Fo,po),Mo=to.mul(Xo,xo),Do=to.add(Mo,Do),Mo=to.sub(Bo,Do),Do=to.add(Bo,Do),No=to.mul(Mo,Do),Bo=to.add(Lo,Lo),Bo=to.add(Bo,Lo),xo=to.mul(Fo,xo),po=to.mul(Xo,po),Bo=to.add(Bo,xo),xo=to.sub(Lo,xo),xo=to.mul(Fo,xo),po=to.add(po,xo),Lo=to.mul(Bo,po),No=to.add(No,Lo),Lo=to.mul(bo,po),Mo=to.mul(uo,Mo),Mo=to.sub(Mo,Lo),Lo=to.mul(uo,Bo),Do=to.mul(bo,Do),Do=to.add(Do,Lo),new fo(Mo,No,Do)}subtract(vo){return this.add(vo.negate())}is0(){return this.equals(fo.ZERO)}wNAF(vo){return go.wNAFCached(this,co,vo,wo=>{const Eo=to.invertBatch(wo.map(ko=>ko.pz));return wo.map((ko,Ao)=>ko.toAffine(Eo[Ao])).map(fo.fromAffine)})}multiplyUnsafe(vo){const wo=fo.ZERO;if(vo===_0n$3)return wo;if(ao(vo),vo===_1n$3)return this;const{endo:Eo}=eo;if(!Eo)return go.unsafeLadder(this,vo);let{k1neg:ko,k1:Ao,k2neg:Po,k2:jo}=Eo.splitScalar(vo),Mo=wo,No=wo,Do=this;for(;Ao>_0n$3||jo>_0n$3;)Ao&_1n$3&&(Mo=Mo.add(Do)),jo&_1n$3&&(No=No.add(Do)),Do=Do.double(),Ao>>=_1n$3,jo>>=_1n$3;return ko&&(Mo=Mo.negate()),Po&&(No=No.negate()),No=new fo(to.mul(No.px,Eo.beta),No.py,No.pz),Mo.add(No)}multiply(vo){ao(vo);let wo=vo,Eo,ko;const{endo:Ao}=eo;if(Ao){const{k1neg:Po,k1:jo,k2neg:Mo,k2:No}=Ao.splitScalar(wo);let{p:Do,f:Fo}=this.wNAF(jo),{p:Xo,f:Lo}=this.wNAF(No);Do=go.constTimeNegate(Po,Do),Xo=go.constTimeNegate(Mo,Xo),Xo=new fo(to.mul(Xo.px,Ao.beta),Xo.py,Xo.pz),Eo=Do.add(Xo),ko=Fo.add(Lo)}else{const{p:Po,f:jo}=this.wNAF(wo);Eo=Po,ko=jo}return fo.normalizeZ([Eo,ko])[0]}multiplyAndAddUnsafe(vo,wo,Eo){const ko=fo.BASE,Ao=(jo,Mo)=>Mo===_0n$3||Mo===_1n$3||!jo.equals(ko)?jo.multiplyUnsafe(Mo):jo.multiply(Mo),Po=Ao(this,wo).add(Ao(vo,Eo));return Po.is0()?void 0:Po}toAffine(vo){const{px:wo,py:Eo,pz:ko}=this,Ao=this.is0();vo==null&&(vo=Ao?to.ONE:to.inv(ko));const Po=to.mul(wo,vo),jo=to.mul(Eo,vo),Mo=to.mul(ko,vo);if(Ao)return{x:to.ZERO,y:to.ZERO};if(!to.eql(Mo,to.ONE))throw new Error("invZ was invalid");return{x:Po,y:jo}}isTorsionFree(){const{h:vo,isTorsionFree:wo}=eo;if(vo===_1n$3)return!0;if(wo)return wo(fo,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:vo,clearCofactor:wo}=eo;return vo===_1n$3?this:wo?wo(fo,this):this.multiplyUnsafe(eo.h)}toRawBytes(vo=!0){return this.assertValidity(),ro(fo,this,vo)}toHex(vo=!0){return bytesToHex(this.toRawBytes(vo))}}fo.BASE=new fo(eo.Gx,eo.Gy,to.ONE),fo.ZERO=new fo(to.ZERO,to.ONE,to.ZERO);const ho=eo.nBitLength,go=wNAF$1(fo,eo.endo?Math.ceil(ho/2):ho);return{CURVE:eo,ProjectivePoint:fo,normPrivateKeyToScalar:so,weierstrassEquation:io,isWithinCurveOrder:oo}}function validateOpts$2(Xr){const eo=validateBasic$1(Xr);return validateObject(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass$2(Xr){const eo=validateOpts$2(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(po){return _0n$3bytesToHex(numberToBytesBE(po,eo.nByteLength));function yo(po){const bo=ro>>_1n$3;return po>bo}function vo(po){return yo(po)?ao(-po):po}const wo=(po,bo,_o)=>bytesToNumberBE(po.slice(bo,_o));class Eo{constructor(bo,_o,$o){this.r=bo,this.s=_o,this.recovery=$o,this.assertValidity()}static fromCompact(bo){const _o=eo.nByteLength;return bo=ensureBytes$1("compactSignature",bo,_o*2),new Eo(wo(bo,0,_o),wo(bo,_o,2*_o))}static fromDER(bo){const{r:_o,s:$o}=DER$1.toSig(ensureBytes$1("DER",bo));return new Eo(_o,$o)}assertValidity(){if(!ho(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!ho(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(bo){return new Eo(this.r,this.s,bo)}recoverPublicKey(bo){const{r:_o,s:$o,recovery:Co}=this,Ro=No(ensureBytes$1("msgHash",bo));if(Co==null||![0,1,2,3].includes(Co))throw new Error("recovery id invalid");const So=Co===2||Co===3?_o+eo.n:_o;if(So>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const mo=Co&1?"03":"02",To=co.fromHex(mo+go(So)),Vo=so(So),Zo=ao(-Ro*Vo),Qo=ao($o*Vo),qo=co.BASE.multiplyAndAddUnsafe(To,Zo,Qo);if(!qo)throw new Error("point at infinify");return qo.assertValidity(),qo}hasHighS(){return yo(this.s)}normalizeS(){return this.hasHighS()?new Eo(this.r,ao(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$1(this.toDERHex())}toDERHex(){return DER$1.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$1(this.toCompactHex())}toCompactHex(){return go(this.r)+go(this.s)}}const ko={isValidPrivateKey(po){try{return lo(po),!0}catch{return!1}},normPrivateKeyToScalar:lo,randomPrivateKey:()=>{const po=getMinHashLength$1(eo.n);return mapHashToField$1(eo.randomBytes(po),eo.n)},precompute(po=8,bo=co.BASE){return bo._setWindowSize(po),bo.multiply(BigInt(3)),bo}};function Ao(po,bo=!0){return co.fromPrivateKey(po).toRawBytes(bo)}function Po(po){const bo=isBytes(po),_o=typeof po=="string",$o=(bo||_o)&&po.length;return bo?$o===no||$o===io:_o?$o===2*no||$o===2*io:po instanceof co}function jo(po,bo,_o=!0){if(Po(po))throw new Error("first arg must be private key");if(!Po(bo))throw new Error("second arg must be public key");return co.fromHex(bo).multiply(lo(po)).toRawBytes(_o)}const Mo=eo.bits2int||function(po){const bo=bytesToNumberBE(po),_o=po.length*8-eo.nBitLength;return _o>0?bo>>BigInt(_o):bo},No=eo.bits2int_modN||function(po){return ao(Mo(po))},Do=bitMask(eo.nBitLength);function Fo(po){if(typeof po!="bigint")throw new Error("bigint expected");if(!(_0n$3<=po&&po$a in _o))throw new Error("sign() legacy options not supported");const{hash:$o,randomBytes:Co}=eo;let{lowS:Ro,prehash:So,extraEntropy:mo}=_o;Ro==null&&(Ro=!0),po=ensureBytes$1("msgHash",po),So&&(po=ensureBytes$1("prehashed msgHash",$o(po)));const To=No(po),Vo=lo(bo),Zo=[Fo(Vo),Fo(To)];if(mo!=null){const $a=mo===!0?Co(to.BYTES):mo;Zo.push(ensureBytes$1("extraEntropy",$a))}const Qo=concatBytes(...Zo),qo=To;function Ho($a){const zo=Mo($a);if(!ho(zo))return;const Ko=so(zo),_c=co.BASE.multiply(zo).toAffine(),Cl=ao(_c.x);if(Cl===_0n$3)return;const ga=ao(Ko*ao(qo+Cl*Vo));if(ga===_0n$3)return;let El=(_c.x===Cl?0:2)|Number(_c.y&_1n$3),Al=ga;return Ro&&yo(ga)&&(Al=vo(ga),El^=1),new Eo(Cl,Al,El)}return{seed:Qo,k2sig:Ho}}const Lo={lowS:eo.lowS,prehash:!1},Bo={lowS:eo.lowS,prehash:!1};function xo(po,bo,_o=Lo){const{seed:$o,k2sig:Co}=Xo(po,bo,_o),Ro=eo;return createHmacDrbg(Ro.hash.outputLen,Ro.nByteLength,Ro.hmac)($o,Co)}co.BASE._setWindowSize(8);function uo(po,bo,_o,$o=Bo){var _c;const Co=po;if(bo=ensureBytes$1("msgHash",bo),_o=ensureBytes$1("publicKey",_o),"strict"in $o)throw new Error("options.strict was renamed to lowS");const{lowS:Ro,prehash:So}=$o;let mo,To;try{if(typeof Co=="string"||isBytes(Co))try{mo=Eo.fromDER(Co)}catch(Cl){if(!(Cl instanceof DER$1.Err))throw Cl;mo=Eo.fromCompact(Co)}else if(typeof Co=="object"&&typeof Co.r=="bigint"&&typeof Co.s=="bigint"){const{r:Cl,s:ga}=Co;mo=new Eo(Cl,ga)}else throw new Error("PARSE");To=co.fromHex(_o)}catch(Cl){if(Cl.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Ro&&mo.hasHighS())return!1;So&&(bo=eo.hash(bo));const{r:Vo,s:Zo}=mo,Qo=No(bo),qo=so(Zo),Ho=ao(Qo*qo),$a=ao(Vo*qo),zo=(_c=co.BASE.multiplyAndAddUnsafe(To,Ho,$a))==null?void 0:_c.toAffine();return zo?ao(zo.x)===Vo:!1}return{CURVE:eo,getPublicKey:Ao,getSharedSecret:jo,sign:xo,verify:uo,ProjectivePoint:co,Signature:Eo,utils:ko}}class HMAC extends Hash{constructor(eo,to){super(),this.finished=!1,this.destroyed=!1,hash(eo);const ro=toBytes(to);if(this.iHash=eo.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 no=this.blockLen,io=new Uint8Array(no);io.set(ro.length>no?eo.create().update(ro).digest():ro);for(let oo=0;oonew HMAC(Xr,eo).update(to).digest();hmac.create=(Xr,eo)=>new HMAC(Xr,eo);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(Xr){return{hash:Xr,hmac:(eo,...to)=>hmac(Xr,eo,concatBytes$1(...to)),randomBytes}}const CURVE_ORDER=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),MAX_VALUE=BigInt("0x800000000000000000000000000000000000000000000000000000000000000"),nBitLength=252;function bits2int(Xr){for(;Xr[0]===0;)Xr=Xr.subarray(1);const eo=Xr.length*8-nBitLength,to=bytesToNumberBE(Xr);return eo>0?to>>BigInt(eo):to}function hex0xToBytes(Xr){return typeof Xr=="string"&&(Xr=strip0x(Xr),Xr.length&1&&(Xr="0"+Xr)),hexToBytes$1(Xr)}const curve=weierstrass$2({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:Field(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:CURVE_ORDER,nBitLength,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...getHash(sha256),bits2int,bits2int_modN:Xr=>{const eo=bytesToNumberBE(Xr).toString(16);return eo.length===63&&(Xr=hex0xToBytes(eo+"0")),mod$1(bits2int(Xr),CURVE_ORDER)}}),_starkCurve=curve;function ensureBytes(Xr){return ensureBytes$1("",typeof Xr=="string"?hex0xToBytes(Xr):Xr)}function normPrivKey(Xr){return bytesToHex(ensureBytes(Xr)).padStart(64,"0")}function getPublicKey(Xr,eo=!1){return curve.getPublicKey(normPrivKey(Xr),eo)}function getSharedSecret(Xr,eo){return curve.getSharedSecret(normPrivKey(Xr),eo)}function checkSignature(Xr){const{r:eo,s:to}=Xr;if(eo<0n||eo>=MAX_VALUE)throw new Error(`Signature.r should be [1, ${MAX_VALUE})`);const ro=invert$1(to,CURVE_ORDER);if(ro<0n||ro>=MAX_VALUE)throw new Error(`inv(Signature.s) should be [1, ${MAX_VALUE})`)}function checkMessage(Xr){const eo=ensureBytes(Xr);if(bytesToNumberBE(eo)>=MAX_VALUE)throw new Error(`msgHash should be [0, ${MAX_VALUE})`);return eo}function sign(Xr,eo,to){const ro=curve.sign(checkMessage(Xr),normPrivKey(eo),to);return checkSignature(ro),ro}function verify(Xr,eo,to){if(!(Xr instanceof Signature)){const ro=ensureBytes(Xr);try{Xr=Signature.fromDER(ro)}catch(no){if(!(no instanceof DER$1.Err))throw no;Xr=Signature.fromCompact(ro)}}return checkSignature(Xr),curve.verify(Xr,checkMessage(eo),ensureBytes(to))}const{CURVE,ProjectivePoint,Signature,utils}=curve;function extractX(Xr){return`0x${bytesToHex(Xr.subarray(1)).replace(/^0+/gm,"")}`}function strip0x(Xr){return Xr.replace(/^0x/i,"")}function grindKey(Xr){const eo=ensureBytes(Xr),to=2n**256n,ro=to-mod$1(to,CURVE_ORDER);for(let no=0;;no++){const io=sha256Num(concatBytes(eo,numberToVarBytesBE(BigInt(no))));if(ioNumber(Xr&MASK_31);function getAccountPath(Xr,eo,to,ro){const no=int31(sha256Num(Xr)),io=int31(sha256Num(eo)),oo=hexToNumber(strip0x(to));return`m/2645'/${no}'/${io}'/${int31(oo)}'/${int31(oo>>31n)}'/${ro}`}const PEDERSEN_POINTS=[new ProjectivePoint(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new ProjectivePoint(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new ProjectivePoint(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new ProjectivePoint(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new ProjectivePoint(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function pedersenPrecompute(Xr,eo){const to=[];let ro=Xr;for(let no=0;no<248;no++)to.push(ro),ro=ro.double();ro=eo;for(let no=0;no<4;no++)to.push(ro),ro=ro.double();return to}const PEDERSEN_POINTS1=pedersenPrecompute(PEDERSEN_POINTS[1],PEDERSEN_POINTS[2]),PEDERSEN_POINTS2=pedersenPrecompute(PEDERSEN_POINTS[3],PEDERSEN_POINTS[4]);function pedersenArg(Xr){let eo;if(typeof Xr=="bigint")eo=Xr;else if(typeof Xr=="number"){if(!Number.isSafeInteger(Xr))throw new Error(`Invalid pedersenArg: ${Xr}`);eo=BigInt(Xr)}else eo=bytesToNumberBE(ensureBytes(Xr));if(!(0n<=eo&&eo>=1n}return Xr}function pedersen(Xr,eo){let to=PEDERSEN_POINTS[0];return to=pedersenSingle(to,Xr,PEDERSEN_POINTS1),to=pedersenSingle(to,eo,PEDERSEN_POINTS2),extractX(to.toRawBytes(!0))}const computeHashOnElements$1=(Xr,eo=pedersen)=>[0,...Xr,Xr.length].reduce((to,ro)=>eo(to,ro)),MASK_250$1=bitMask(250),keccak=Xr=>bytesToNumberBE(keccak_256(Xr))&MASK_250$1,sha256Num=Xr=>bytesToNumberBE(sha256(Xr)),Fp251=Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function poseidonRoundConstant(Xr,eo,to){const ro=Xr.fromBytes(sha256(utf8ToBytes$1(`${eo}${to}`)));return Xr.create(ro)}function _poseidonMDS(Xr,eo,to,ro=0){const no=[],io=[];for(let oo=0;ooio.map(ao=>Xr.inv(Xr.sub(oo,ao))))}const MDS_SMALL=[[3,1,1],[1,-1,1],[1,1,-2]].map(Xr=>Xr.map(BigInt));function poseidonBasic(Xr,eo){if(validateField$1(Xr.Fp),!Number.isSafeInteger(Xr.rate)||!Number.isSafeInteger(Xr.capacity))throw new Error(`Wrong poseidon opts: ${Xr}`);const to=Xr.rate+Xr.capacity,ro=Xr.roundsFull+Xr.roundsPartial,no=[];for(let oo=0;oo=_0n$2?to:eo+to}function invert(Xr,eo){if(Xr===_0n$2||eo<=_0n$2)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod(Xr,eo),ro=eo,no=_0n$2,io=_1n$2;for(;to!==_0n$2;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$2)throw new Error("invert: does not exist");return mod(no,eo)}const FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(Xr){const eo={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},to=FIELD_FIELDS.reduce((ro,no)=>(ro[no]="function",ro),eo);return validateObject$1(Xr,to)}function FpPow(Xr,eo,to){if(to<_0n$2)throw new Error("Expected power > 0");if(to===_0n$2)return Xr.ONE;if(to===_1n$2)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$2;)to&_1n$2&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$2;return ro}function nLength(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function getFieldBytesLength(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength(Xr){const eo=getFieldBytesLength(Xr);return eo+Math.ceil(eo/2)}function mapHashToField(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength(eo),io=getMinHashLength(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE$1(Xr):bytesToNumberLE$1(Xr),ao=mod(oo,eo-_1n$2)+_1n$2;return to?numberToBytesLE$1(ao,no):numberToBytesBE$1(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$1=BigInt(1);function wNAF(Xr,eo){const to=(no,io)=>{const oo=io.negate();return no?oo:io},ro=no=>{const io=Math.ceil(eo/no)+1,oo=2**(no-1);return{windows:io,windowSize:oo}};return{constTimeNegate:to,unsafeLadder(no,io){let oo=Xr.ZERO,ao=no;for(;io>_0n$1;)io&_1n$1&&(oo=oo.add(ao)),ao=ao.double(),io>>=_1n$1;return oo},precomputeWindow(no,io){const{windows:oo,windowSize:ao}=ro(io),so=[];let co=no,lo=co;for(let fo=0;fo>=go,wo>so&&(wo-=ho,oo+=_1n$1);const Eo=vo,ko=vo+Math.abs(wo)-1,Ao=yo%2!==0,Po=wo<0;wo===0?lo=lo.add(to(Ao,io[Eo])):co=co.add(to(Po,io[ko]))}return{p:co,f:lo}},wNAFCached(no,io,oo,ao){const so=no._WINDOW_SIZE||1;let co=io.get(no);return co||(co=this.precomputeWindow(no,so),so!==1&&io.set(no,ao(co))),this.wNAF(so,co,oo)}}}function validateBasic(Xr){return validateField(Xr.Fp),validateObject$1(Xr,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(Xr.n,Xr.nBitLength),...Xr,p:Xr.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts(Xr){const eo=validateBasic(Xr);validateObject$1(eo,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:to,Fp:ro,a:no}=eo;if(to){if(!ro.eql(no,ro.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof to!="object"||typeof to.beta!="bigint"||typeof to.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...eo})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut$3,DER={Err:class extends Error{constructor(eo=""){super(eo)}},_parseInt(Xr){const{Err:eo}=DER;if(Xr.length<2||Xr[0]!==2)throw new eo("Invalid signature integer tag");const to=Xr[1],ro=Xr.subarray(2,to+2);if(!to||ro.length!==to)throw new eo("Invalid signature integer: wrong length");if(ro[0]&128)throw new eo("Invalid signature integer: negative");if(ro[0]===0&&!(ro[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return{d:b2n(ro),l:Xr.subarray(to+2)}},toSig(Xr){const{Err:eo}=DER,to=typeof Xr=="string"?h2b(Xr):Xr;if(!isBytes$3(to))throw new Error("ui8a expected");let ro=to.length;if(ro<2||to[0]!=48)throw new eo("Invalid signature tag");if(to[1]!==ro-2)throw new eo("Invalid signature: incorrect length");const{d:no,l:io}=DER._parseInt(to.subarray(2)),{d:oo,l:ao}=DER._parseInt(io);if(ao.length)throw new eo("Invalid signature: left bytes after parsing");return{r:no,s:oo}},hexFromSig(Xr){const eo=co=>Number.parseInt(co[0],16)&8?"00"+co:co,to=co=>{const lo=co.toString(16);return lo.length&1?`0${lo}`:lo},ro=eo(to(Xr.s)),no=eo(to(Xr.r)),io=ro.length/2,oo=no.length/2,ao=to(io),so=to(oo);return`30${to(oo+io+4)}02${so}${no}02${ao}${ro}`}},_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function weierstrassPoints(Xr){const eo=validatePointOpts(Xr),{Fp:to}=eo,ro=eo.toBytes||((yo,vo,wo)=>{const Eo=vo.toAffine();return concatBytes$2(Uint8Array.from([4]),to.toBytes(Eo.x),to.toBytes(Eo.y))}),no=eo.fromBytes||(yo=>{const vo=yo.subarray(1),wo=to.fromBytes(vo.subarray(0,to.BYTES)),Eo=to.fromBytes(vo.subarray(to.BYTES,2*to.BYTES));return{x:wo,y:Eo}});function io(yo){const{a:vo,b:wo}=eo,Eo=to.sqr(yo),ko=to.mul(Eo,yo);return to.add(to.add(ko,to.mul(yo,vo)),wo)}if(!to.eql(to.sqr(eo.Gy),io(eo.Gx)))throw new Error("bad generator point: equation left != right");function oo(yo){return typeof yo=="bigint"&&_0nto.eql(Ao,to.ZERO);return ko(wo)&&ko(Eo)?fo.ZERO:new fo(wo,Eo,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(vo){const wo=to.invertBatch(vo.map(Eo=>Eo.pz));return vo.map((Eo,ko)=>Eo.toAffine(wo[ko])).map(fo.fromAffine)}static fromHex(vo){const wo=fo.fromAffine(no(ensureBytes$2("pointHex",vo)));return wo.assertValidity(),wo}static fromPrivateKey(vo){return fo.BASE.multiply(so(vo))}_setWindowSize(vo){this._WINDOW_SIZE=vo,co.delete(this)}assertValidity(){if(this.is0()){if(eo.allowInfinityPoint&&!to.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:vo,y:wo}=this.toAffine();if(!to.isValid(vo)||!to.isValid(wo))throw new Error("bad point: x or y not FE");const Eo=to.sqr(wo),ko=io(vo);if(!to.eql(Eo,ko))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:vo}=this.toAffine();if(to.isOdd)return!to.isOdd(vo);throw new Error("Field doesn't support isOdd")}equals(vo){lo(vo);const{px:wo,py:Eo,pz:ko}=this,{px:Ao,py:Po,pz:jo}=vo,Mo=to.eql(to.mul(wo,jo),to.mul(Ao,ko)),No=to.eql(to.mul(Eo,jo),to.mul(Po,ko));return Mo&&No}negate(){return new fo(this.px,to.neg(this.py),this.pz)}double(){const{a:vo,b:wo}=eo,Eo=to.mul(wo,_3n),{px:ko,py:Ao,pz:Po}=this;let jo=to.ZERO,Mo=to.ZERO,No=to.ZERO,Do=to.mul(ko,ko),Fo=to.mul(Ao,Ao),Xo=to.mul(Po,Po),Lo=to.mul(ko,Ao);return Lo=to.add(Lo,Lo),No=to.mul(ko,Po),No=to.add(No,No),jo=to.mul(vo,No),Mo=to.mul(Eo,Xo),Mo=to.add(jo,Mo),jo=to.sub(Fo,Mo),Mo=to.add(Fo,Mo),Mo=to.mul(jo,Mo),jo=to.mul(Lo,jo),No=to.mul(Eo,No),Xo=to.mul(vo,Xo),Lo=to.sub(Do,Xo),Lo=to.mul(vo,Lo),Lo=to.add(Lo,No),No=to.add(Do,Do),Do=to.add(No,Do),Do=to.add(Do,Xo),Do=to.mul(Do,Lo),Mo=to.add(Mo,Do),Xo=to.mul(Ao,Po),Xo=to.add(Xo,Xo),Do=to.mul(Xo,Lo),jo=to.sub(jo,Do),No=to.mul(Xo,Fo),No=to.add(No,No),No=to.add(No,No),new fo(jo,Mo,No)}add(vo){lo(vo);const{px:wo,py:Eo,pz:ko}=this,{px:Ao,py:Po,pz:jo}=vo;let Mo=to.ZERO,No=to.ZERO,Do=to.ZERO;const Fo=eo.a,Xo=to.mul(eo.b,_3n);let Lo=to.mul(wo,Ao),Bo=to.mul(Eo,Po),xo=to.mul(ko,jo),uo=to.add(wo,Eo),po=to.add(Ao,Po);uo=to.mul(uo,po),po=to.add(Lo,Bo),uo=to.sub(uo,po),po=to.add(wo,ko);let bo=to.add(Ao,jo);return po=to.mul(po,bo),bo=to.add(Lo,xo),po=to.sub(po,bo),bo=to.add(Eo,ko),Mo=to.add(Po,jo),bo=to.mul(bo,Mo),Mo=to.add(Bo,xo),bo=to.sub(bo,Mo),Do=to.mul(Fo,po),Mo=to.mul(Xo,xo),Do=to.add(Mo,Do),Mo=to.sub(Bo,Do),Do=to.add(Bo,Do),No=to.mul(Mo,Do),Bo=to.add(Lo,Lo),Bo=to.add(Bo,Lo),xo=to.mul(Fo,xo),po=to.mul(Xo,po),Bo=to.add(Bo,xo),xo=to.sub(Lo,xo),xo=to.mul(Fo,xo),po=to.add(po,xo),Lo=to.mul(Bo,po),No=to.add(No,Lo),Lo=to.mul(bo,po),Mo=to.mul(uo,Mo),Mo=to.sub(Mo,Lo),Lo=to.mul(uo,Bo),Do=to.mul(bo,Do),Do=to.add(Do,Lo),new fo(Mo,No,Do)}subtract(vo){return this.add(vo.negate())}is0(){return this.equals(fo.ZERO)}wNAF(vo){return go.wNAFCached(this,co,vo,wo=>{const Eo=to.invertBatch(wo.map(ko=>ko.pz));return wo.map((ko,Ao)=>ko.toAffine(Eo[Ao])).map(fo.fromAffine)})}multiplyUnsafe(vo){const wo=fo.ZERO;if(vo===_0n)return wo;if(ao(vo),vo===_1n)return this;const{endo:Eo}=eo;if(!Eo)return go.unsafeLadder(this,vo);let{k1neg:ko,k1:Ao,k2neg:Po,k2:jo}=Eo.splitScalar(vo),Mo=wo,No=wo,Do=this;for(;Ao>_0n||jo>_0n;)Ao&_1n&&(Mo=Mo.add(Do)),jo&_1n&&(No=No.add(Do)),Do=Do.double(),Ao>>=_1n,jo>>=_1n;return ko&&(Mo=Mo.negate()),Po&&(No=No.negate()),No=new fo(to.mul(No.px,Eo.beta),No.py,No.pz),Mo.add(No)}multiply(vo){ao(vo);let wo=vo,Eo,ko;const{endo:Ao}=eo;if(Ao){const{k1neg:Po,k1:jo,k2neg:Mo,k2:No}=Ao.splitScalar(wo);let{p:Do,f:Fo}=this.wNAF(jo),{p:Xo,f:Lo}=this.wNAF(No);Do=go.constTimeNegate(Po,Do),Xo=go.constTimeNegate(Mo,Xo),Xo=new fo(to.mul(Xo.px,Ao.beta),Xo.py,Xo.pz),Eo=Do.add(Xo),ko=Fo.add(Lo)}else{const{p:Po,f:jo}=this.wNAF(wo);Eo=Po,ko=jo}return fo.normalizeZ([Eo,ko])[0]}multiplyAndAddUnsafe(vo,wo,Eo){const ko=fo.BASE,Ao=(jo,Mo)=>Mo===_0n||Mo===_1n||!jo.equals(ko)?jo.multiplyUnsafe(Mo):jo.multiply(Mo),Po=Ao(this,wo).add(Ao(vo,Eo));return Po.is0()?void 0:Po}toAffine(vo){const{px:wo,py:Eo,pz:ko}=this,Ao=this.is0();vo==null&&(vo=Ao?to.ONE:to.inv(ko));const Po=to.mul(wo,vo),jo=to.mul(Eo,vo),Mo=to.mul(ko,vo);if(Ao)return{x:to.ZERO,y:to.ZERO};if(!to.eql(Mo,to.ONE))throw new Error("invZ was invalid");return{x:Po,y:jo}}isTorsionFree(){const{h:vo,isTorsionFree:wo}=eo;if(vo===_1n)return!0;if(wo)return wo(fo,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:vo,clearCofactor:wo}=eo;return vo===_1n?this:wo?wo(fo,this):this.multiplyUnsafe(eo.h)}toRawBytes(vo=!0){return this.assertValidity(),ro(fo,this,vo)}toHex(vo=!0){return bytesToHex$1(this.toRawBytes(vo))}}fo.BASE=new fo(eo.Gx,eo.Gy,to.ONE),fo.ZERO=new fo(to.ZERO,to.ONE,to.ZERO);const ho=eo.nBitLength,go=wNAF(fo,eo.endo?Math.ceil(ho/2):ho);return{CURVE:eo,ProjectivePoint:fo,normPrivateKeyToScalar:so,weierstrassEquation:io,isWithinCurveOrder:oo}}function validateOpts$1(Xr){const eo=validateBasic(Xr);return validateObject$1(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass(Xr){const eo=validateOpts$1(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(po){return _0nbytesToHex$1(numberToBytesBE$1(po,eo.nByteLength));function yo(po){const bo=ro>>_1n;return po>bo}function vo(po){return yo(po)?ao(-po):po}const wo=(po,bo,_o)=>bytesToNumberBE$1(po.slice(bo,_o));class Eo{constructor(bo,_o,$o){this.r=bo,this.s=_o,this.recovery=$o,this.assertValidity()}static fromCompact(bo){const _o=eo.nByteLength;return bo=ensureBytes$2("compactSignature",bo,_o*2),new Eo(wo(bo,0,_o),wo(bo,_o,2*_o))}static fromDER(bo){const{r:_o,s:$o}=DER.toSig(ensureBytes$2("DER",bo));return new Eo(_o,$o)}assertValidity(){if(!ho(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!ho(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(bo){return new Eo(this.r,this.s,bo)}recoverPublicKey(bo){const{r:_o,s:$o,recovery:Co}=this,Ro=No(ensureBytes$2("msgHash",bo));if(Co==null||![0,1,2,3].includes(Co))throw new Error("recovery id invalid");const So=Co===2||Co===3?_o+eo.n:_o;if(So>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const mo=Co&1?"03":"02",To=co.fromHex(mo+go(So)),Vo=so(So),Zo=ao(-Ro*Vo),Qo=ao($o*Vo),qo=co.BASE.multiplyAndAddUnsafe(To,Zo,Qo);if(!qo)throw new Error("point at infinify");return qo.assertValidity(),qo}hasHighS(){return yo(this.s)}normalizeS(){return this.hasHighS()?new Eo(this.r,ao(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return go(this.r)+go(this.s)}}const ko={isValidPrivateKey(po){try{return lo(po),!0}catch{return!1}},normPrivateKeyToScalar:lo,randomPrivateKey:()=>{const po=getMinHashLength(eo.n);return mapHashToField(eo.randomBytes(po),eo.n)},precompute(po=8,bo=co.BASE){return bo._setWindowSize(po),bo.multiply(BigInt(3)),bo}};function Ao(po,bo=!0){return co.fromPrivateKey(po).toRawBytes(bo)}function Po(po){const bo=isBytes$3(po),_o=typeof po=="string",$o=(bo||_o)&&po.length;return bo?$o===no||$o===io:_o?$o===2*no||$o===2*io:po instanceof co}function jo(po,bo,_o=!0){if(Po(po))throw new Error("first arg must be private key");if(!Po(bo))throw new Error("second arg must be public key");return co.fromHex(bo).multiply(lo(po)).toRawBytes(_o)}const Mo=eo.bits2int||function(po){const bo=bytesToNumberBE$1(po),_o=po.length*8-eo.nBitLength;return _o>0?bo>>BigInt(_o):bo},No=eo.bits2int_modN||function(po){return ao(Mo(po))},Do=bitMask$1(eo.nBitLength);function Fo(po){if(typeof po!="bigint")throw new Error("bigint expected");if(!(_0n<=po&&po$a in _o))throw new Error("sign() legacy options not supported");const{hash:$o,randomBytes:Co}=eo;let{lowS:Ro,prehash:So,extraEntropy:mo}=_o;Ro==null&&(Ro=!0),po=ensureBytes$2("msgHash",po),So&&(po=ensureBytes$2("prehashed msgHash",$o(po)));const To=No(po),Vo=lo(bo),Zo=[Fo(Vo),Fo(To)];if(mo!=null){const $a=mo===!0?Co(to.BYTES):mo;Zo.push(ensureBytes$2("extraEntropy",$a))}const Qo=concatBytes$2(...Zo),qo=To;function Ho($a){const zo=Mo($a);if(!ho(zo))return;const Ko=so(zo),_c=co.BASE.multiply(zo).toAffine(),Cl=ao(_c.x);if(Cl===_0n)return;const ga=ao(Ko*ao(qo+Cl*Vo));if(ga===_0n)return;let El=(_c.x===Cl?0:2)|Number(_c.y&_1n),Al=ga;return Ro&&yo(ga)&&(Al=vo(ga),El^=1),new Eo(Cl,Al,El)}return{seed:Qo,k2sig:Ho}}const Lo={lowS:eo.lowS,prehash:!1},Bo={lowS:eo.lowS,prehash:!1};function xo(po,bo,_o=Lo){const{seed:$o,k2sig:Co}=Xo(po,bo,_o),Ro=eo;return createHmacDrbg$1(Ro.hash.outputLen,Ro.nByteLength,Ro.hmac)($o,Co)}co.BASE._setWindowSize(8);function uo(po,bo,_o,$o=Bo){var _c;const Co=po;if(bo=ensureBytes$2("msgHash",bo),_o=ensureBytes$2("publicKey",_o),"strict"in $o)throw new Error("options.strict was renamed to lowS");const{lowS:Ro,prehash:So}=$o;let mo,To;try{if(typeof Co=="string"||isBytes$3(Co))try{mo=Eo.fromDER(Co)}catch(Cl){if(!(Cl instanceof DER.Err))throw Cl;mo=Eo.fromCompact(Co)}else if(typeof Co=="object"&&typeof Co.r=="bigint"&&typeof Co.s=="bigint"){const{r:Cl,s:ga}=Co;mo=new Eo(Cl,ga)}else throw new Error("PARSE");To=co.fromHex(_o)}catch(Cl){if(Cl.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Ro&&mo.hasHighS())return!1;So&&(bo=eo.hash(bo));const{r:Vo,s:Zo}=mo,Qo=No(bo),qo=so(Zo),Ho=ao(Qo*qo),$a=ao(Vo*qo),zo=(_c=co.BASE.multiplyAndAddUnsafe(To,Ho,$a))==null?void 0:_c.toAffine();return zo?ao(zo.x)===Vo:!1}return{CURVE:eo,getPublicKey:Ao,getSharedSecret:jo,sign:xo,verify:uo,ProjectivePoint:co,Signature:Eo,utils:ko}}function SWUFpSqrtRatio(Xr,eo){const to=Xr.ORDER;let ro=_0n;for(let yo=to-_1n;yo%_2n===_0n;yo/=_2n)ro+=_1n;const no=ro,io=_2n<{let wo=fo,Eo=Xr.pow(vo,co),ko=Xr.sqr(Eo);ko=Xr.mul(ko,vo);let Ao=Xr.mul(yo,ko);Ao=Xr.pow(Ao,so),Ao=Xr.mul(Ao,Eo),Eo=Xr.mul(Ao,vo),ko=Xr.mul(Ao,yo);let Po=Xr.mul(ko,Eo);Ao=Xr.pow(Po,lo);let jo=Xr.eql(Ao,Xr.ONE);Eo=Xr.mul(ko,ho),Ao=Xr.mul(Po,wo),ko=Xr.cmov(Eo,ko,jo),Po=Xr.cmov(Ao,Po,jo);for(let Mo=no;Mo>_1n;Mo--){let No=Mo-_2n;No=_2n<{let ko=Xr.sqr(Eo);const Ao=Xr.mul(wo,Eo);ko=Xr.mul(ko,Ao);let Po=Xr.pow(ko,yo);Po=Xr.mul(Po,Ao);const jo=Xr.mul(Po,vo),Mo=Xr.mul(Xr.sqr(Po),Eo),No=Xr.eql(Mo,wo);let Do=Xr.cmov(jo,Po,No);return{isValid:No,value:Do}}}return go}function mapToCurveSimpleSWU(Xr,eo){if(validateField(Xr),!Xr.isValid(eo.A)||!Xr.isValid(eo.B)||!Xr.isValid(eo.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const to=SWUFpSqrtRatio(Xr,eo.Z);if(!Xr.isOdd)throw new Error("Fp.isOdd is not implemented!");return ro=>{let no,io,oo,ao,so,co,lo,fo;no=Xr.sqr(ro),no=Xr.mul(no,eo.Z),io=Xr.sqr(no),io=Xr.add(io,no),oo=Xr.add(io,Xr.ONE),oo=Xr.mul(oo,eo.B),ao=Xr.cmov(eo.Z,Xr.neg(io),!Xr.eql(io,Xr.ZERO)),ao=Xr.mul(ao,eo.A),io=Xr.sqr(oo),co=Xr.sqr(ao),so=Xr.mul(co,eo.A),io=Xr.add(io,so),io=Xr.mul(io,oo),co=Xr.mul(co,ao),so=Xr.mul(co,eo.B),io=Xr.add(io,so),lo=Xr.mul(no,oo);const{isValid:ho,value:go}=to(io,co);fo=Xr.mul(no,ro),fo=Xr.mul(fo,go),lo=Xr.cmov(lo,oo,ho),fo=Xr.cmov(fo,go,ho);const yo=Xr.isOdd(ro)===Xr.isOdd(fo);return fo=Xr.cmov(Xr.neg(fo),fo,yo),lo=Xr.div(lo,ao),{x:lo,y:fo}}}const weierstrass$1=Object.freeze(Object.defineProperty({__proto__:null,DER,SWUFpSqrtRatio,mapToCurveSimpleSWU,weierstrass,weierstrassPoints},Symbol.toStringTag,{value:"Module"}));function isInteger(Xr){return INTEGER_REGEX.test(Xr)}var INTEGER_REGEX=/^-?[0-9]+$/;function isNumber(Xr){return NUMBER_REGEX.test(Xr)}var NUMBER_REGEX=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function isSafeNumber(Xr,eo){var to=parseFloat(Xr),ro=String(to),no=extractSignificantDigits(Xr),io=extractSignificantDigits(ro);if(no===io)return!0;if((eo==null?void 0:eo.approx)===!0){var oo=14;if(!isInteger(Xr)&&io.length>=oo&&no.startsWith(io.substring(0,oo)))return!0}return!1}var UnsafeNumberReason=function(Xr){return Xr.underflow="underflow",Xr.overflow="overflow",Xr.truncate_integer="truncate_integer",Xr.truncate_float="truncate_float",Xr}({});function getUnsafeNumberReason(Xr){if(!isSafeNumber(Xr,{approx:!1})){if(isInteger(Xr))return UnsafeNumberReason.truncate_integer;var eo=parseFloat(Xr);return isFinite(eo)?eo===0?UnsafeNumberReason.underflow:UnsafeNumberReason.truncate_float:UnsafeNumberReason.overflow}}function extractSignificantDigits(Xr){return Xr.replace(EXPONENTIAL_PART_REGEX,"").replace(DOT_REGEX,"").replace(TRAILING_ZEROS_REGEX,"").replace(LEADING_MINUS_AND_ZEROS_REGEX,"")}var EXPONENTIAL_PART_REGEX=/[eE][+-]?\d+$/,LEADING_MINUS_AND_ZEROS_REGEX=/^-?(0*)?/,DOT_REGEX=/\./,TRAILING_ZEROS_REGEX=/0+$/;function _typeof$3(Xr){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(eo){return typeof eo}:function(eo){return eo&&typeof Symbol=="function"&&eo.constructor===Symbol&&eo!==Symbol.prototype?"symbol":typeof eo},_typeof$3(Xr)}function _classCallCheck(Xr,eo){if(!(Xr instanceof eo))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(Xr,eo){for(var to=0;toXr.length)&&(eo=Xr.length);for(var to=0,ro=new Array(eo);to2&&arguments[2]!==void 0?arguments[2]:parseLosslessNumber,ro=0,no=ao();return yo(no),wo(),eo?revive(no,eo):no;function io(){if(Xr.charCodeAt(ro)===codeOpeningBrace){ro++,co();for(var uo={},po=!0;rouo)return to(Xr.slice(uo,ro))}function ho(){if(Xr.charCodeAt(ro)!==codeComma)throw new SyntaxError("Comma ',' expected after value ".concat(xo()));ro++}function go(){if(Xr.charCodeAt(ro)!==codeColon)throw new SyntaxError("Colon ':' expected after property name ".concat(xo()));ro++}function yo(uo){if(uo===void 0)throw new SyntaxError("JSON value expected ".concat(xo()))}function vo(uo){if(uo===void 0)throw new SyntaxError("Array item expected ".concat(xo()))}function wo(){if(ro=codeZero&&Xr<=codeNine||Xr>=codeUppercaseA&&Xr<=codeUppercaseF||Xr>=codeLowercaseA&&Xr<=codeLowercaseF}function isDigit(Xr){return Xr>=codeZero&&Xr<=codeNine}function isNonZeroDigit(Xr){return Xr>=codeOne&&Xr<=codeNine}function isValidStringCharacter(Xr){return Xr>=32&&Xr<=1114111}function isDeepEqual(Xr,eo){if(Xr===eo)return!0;if(Array.isArray(Xr)&&Array.isArray(eo))return Xr.length===eo.length&&Xr.every(function(ro,no){return isDeepEqual(ro,eo[no])});if(isObject$1(Xr)&&isObject$1(eo)){var to=_toConsumableArray(new Set([].concat(_toConsumableArray(Object.keys(Xr)),_toConsumableArray(Object.keys(eo)))));return to.every(function(ro){return isDeepEqual(Xr[ro],eo[ro])})}return!1}function isObject$1(Xr){return _typeof$1(Xr)==="object"&&Xr!==null}var escapeCharacters={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` -`,r:"\r",t:" "},codeBackslash=92,codeOpeningBrace=123,codeClosingBrace=125,codeOpeningBracket=91,codeClosingBracket=93,codeSpace=32,codeNewline=10,codeTab=9,codeReturn=13,codeDoubleQuote=34,codePlus=43,codeMinus=45,codeZero=48,codeOne=49,codeNine=57,codeComma=44,codeDot=46,codeColon=58,codeUppercaseA=65,codeLowercaseA=97,codeUppercaseE=69,codeLowercaseE=101,codeUppercaseF=70,codeLowercaseF=102;function _typeof(Xr){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(eo){return typeof eo}:function(eo){return eo&&typeof Symbol=="function"&&eo.constructor===Symbol&&eo!==Symbol.prototype?"symbol":typeof eo},_typeof(Xr)}function stringify(Xr,eo,to,ro){var no=resolveSpace(to),io=typeof eo=="function"?eo.call({"":Xr},"",Xr):Xr;return oo(io,"");function oo(lo,fo){if(Array.isArray(ro)){var ho=ro.find(function(yo){return yo.test(lo)});if(ho){var go=ho.stringify(lo);if(typeof go!="string"||!isNumber(go))throw new Error("Invalid JSON number: output of a number stringifier must be a string containing a JSON number "+"(output: ".concat(go,")"));return go}}if(typeof lo=="boolean"||typeof lo=="number"||typeof lo=="string"||lo===null||lo instanceof Date||lo instanceof Boolean||lo instanceof Number||lo instanceof String)return JSON.stringify(lo);if(lo&&lo.isLosslessNumber||typeof lo=="bigint")return lo.toString();if(Array.isArray(lo))return ao(lo,fo);if(lo&&_typeof(lo)==="object")return so(lo,fo)}function ao(lo,fo){if(lo.length===0)return"[]";for(var ho=no?fo+no:void 0,go=no?`[ -`:"[",yo=0;yo__awaiter$4(this,void 0,void 0,function*(){var no;const io=yield this.getSigner();if(!io)throw new Error("Signer not found");const oo=yield this.getWalletClient().getLatestBlockhash();if("version"in ro)ro.message.recentBlockhash=oo.blockhash;else{const ao=yield this.getAddress();if(!ao)throw new Error("User address not found");ro.recentBlockhash=oo.blockhash,ro.feePayer=(no=ro.feePayer)!==null&&no!==void 0?no:new PublicKey$2(ao)}return(yield io.signAndSendTransaction(ro)).signature})});return to.feeDeducted=!0,to})}isInstalledOnBrowser(){var eo;return!!(!((eo=this.getSolProviderHelper())===null||eo===void 0)&&eo.isInstalledHelper())}getAddress(){return __awaiter$4(this,void 0,void 0,function*(){var eo,to;if(!this.isInstalledOnBrowser()){if(isMobile$1()&&(!((eo=this.wallet)===null||eo===void 0)&&eo.mobile)&&this.wallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const no=template$1(this.wallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(no)}return}return(to=this.getSolProviderHelper())===null||to===void 0?void 0:to.getAddress()})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){var to,ro;const no=yield(to=this.getSolProviderHelper())===null||to===void 0?void 0:to.getAddress();if(no&&this.isLedgerAddress(no))throw new SignMessageNotSupportedError(this.name);return(ro=this.getSolProviderHelper())===null||ro===void 0?void 0:ro.signMessage(eo)})}getConnectedAccounts(){return __awaiter$4(this,void 0,void 0,function*(){var eo,to;return(to=(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.getConnectedAccounts())!==null&&to!==void 0?to:[]})}}var version$6="3.5.1",dependencies={"@dynamic-labs/sdk-api-core":"0.0.559","@dynamic-labs/utils":"3.5.1","@dynamic-labs/logger":"3.5.1","@dynamic-labs/types":"3.5.1",eventemitter3:"5.0.1","@solana/spl-token":"0.4.6","@solana/web3.js":"1.92.1","@turnkey/http":"2.12.2","@turnkey/iframe-stamper":"2.0.0","@turnkey/solana":"0.3.9","@turnkey/webauthn-stamper":"0.5.0"};function __rest$1(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);noro??(ro=[eo,...to()])}}function isIterable(Xr){return isObject$2(Xr)&&typeof Xr[Symbol.iterator]=="function"}function isObject$2(Xr){return typeof Xr=="object"&&Xr!=null}function isNonArrayObject(Xr){return isObject$2(Xr)&&!Array.isArray(Xr)}function print(Xr){return typeof Xr=="symbol"?Xr.toString():typeof Xr=="string"?JSON.stringify(Xr):`${Xr}`}function shiftIterator(Xr){const{done:eo,value:to}=Xr.next();return eo?void 0:to}function toFailure(Xr,eo,to,ro){if(Xr===!0)return;Xr===!1?Xr={}:typeof Xr=="string"&&(Xr={message:Xr});const{path:no,branch:io}=eo,{type:oo}=to,{refinement:ao,message:so=`Expected a value of type \`${oo}\`${ao?` with refinement \`${ao}\``:""}, but received: \`${print(ro)}\``}=Xr;return{value:ro,type:oo,refinement:ao,key:no[no.length-1],path:no,branch:io,...Xr,message:so}}function*toFailures(Xr,eo,to,ro){isIterable(Xr)||(Xr=[Xr]);for(const no of Xr){const io=toFailure(no,eo,to,ro);io&&(yield io)}}function*run(Xr,eo,to={}){const{path:ro=[],branch:no=[Xr],coerce:io=!1,mask:oo=!1}=to,ao={path:ro,branch:no,mask:oo};io&&(Xr=eo.coercer(Xr,ao));let so="valid";for(const co of eo.validator(Xr,ao))co.explanation=to.message,so="not_valid",yield[co,void 0];for(let[co,lo,uo]of eo.entries(Xr,ao)){const ho=run(lo,uo,{path:co===void 0?ro:[...ro,co],branch:co===void 0?no:[...no,lo],coerce:io,mask:oo,message:to.message});for(const go of ho)go[0]?(so=go[0].refinement!=null?"not_refined":"not_valid",yield[go[0],void 0]):io&&(lo=go[1],co===void 0?Xr=lo:Xr instanceof Map?Xr.set(co,lo):Xr instanceof Set?Xr.add(lo):isObject$2(Xr)&&(lo!==void 0||co in Xr)&&(Xr[co]=lo))}if(so!=="not_valid")for(const co of eo.refiner(Xr,ao))co.explanation=to.message,so="not_refined",yield[co,void 0];so==="valid"&&(yield[void 0,Xr])}let Struct$1=class{constructor(eo){const{type:to,schema:ro,validator:no,refiner:io,coercer:oo=so=>so,entries:ao=function*(){}}=eo;this.type=to,this.schema=ro,this.entries=ao,this.coercer=oo,no?this.validator=(so,co)=>{const lo=no(so,co);return toFailures(lo,co,this,so)}:this.validator=()=>[],io?this.refiner=(so,co)=>{const lo=io(so,co);return toFailures(lo,co,this,so)}:this.refiner=()=>[]}assert(eo,to){return assert$3(eo,this,to)}create(eo,to){return create(eo,this,to)}is(eo){return is$1(eo,this)}mask(eo,to){return mask(eo,this,to)}validate(eo,to={}){return validate(eo,this,to)}};function assert$3(Xr,eo,to){const ro=validate(Xr,eo,{message:to});if(ro[0])throw ro[0]}function create(Xr,eo,to){const ro=validate(Xr,eo,{coerce:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function mask(Xr,eo,to){const ro=validate(Xr,eo,{coerce:!0,mask:!0,message:to});if(ro[0])throw ro[0];return ro[1]}function is$1(Xr,eo){return!validate(Xr,eo)[0]}function validate(Xr,eo,to={}){const ro=run(Xr,eo,to),no=shiftIterator(ro);return no[0]?[new StructError(no[0],function*(){for(const oo of ro)oo[0]&&(yield oo[0])}),void 0]:[void 0,no[1]]}function define(Xr,eo){return new Struct$1({type:Xr,schema:null,validator:eo})}function any(){return define("any",()=>!0)}function array(Xr){return new Struct$1({type:"array",schema:Xr,*entries(eo){if(Xr&&Array.isArray(eo))for(const[to,ro]of eo.entries())yield[to,ro,Xr]},coercer(eo){return Array.isArray(eo)?eo.slice():eo},validator(eo){return Array.isArray(eo)||`Expected an array value, but received: ${print(eo)}`}})}function boolean(){return define("boolean",Xr=>typeof Xr=="boolean")}function instance(Xr){return define("instance",eo=>eo instanceof Xr||`Expected a \`${Xr.name}\` instance, but received: ${print(eo)}`)}function literal(Xr){const eo=print(Xr),to=typeof Xr;return new Struct$1({type:"literal",schema:to==="string"||to==="number"||to==="boolean"?Xr:null,validator(ro){return ro===Xr||`Expected the literal \`${eo}\`, but received: ${print(ro)}`}})}function never(){return define("never",()=>!1)}function nullable(Xr){return new Struct$1({...Xr,validator:(eo,to)=>eo===null||Xr.validator(eo,to),refiner:(eo,to)=>eo===null||Xr.refiner(eo,to)})}function number$1(){return define("number",Xr=>typeof Xr=="number"&&!isNaN(Xr)||`Expected a number, but received: ${print(Xr)}`)}function optional(Xr){return new Struct$1({...Xr,validator:(eo,to)=>eo===void 0||Xr.validator(eo,to),refiner:(eo,to)=>eo===void 0||Xr.refiner(eo,to)})}function record(Xr,eo){return new Struct$1({type:"record",schema:null,*entries(to){if(isObject$2(to))for(const ro in to){const no=to[ro];yield[ro,ro,Xr],yield[ro,no,eo]}},validator(to){return isNonArrayObject(to)||`Expected an object, but received: ${print(to)}`},coercer(to){return isNonArrayObject(to)?{...to}:to}})}function string(){return define("string",Xr=>typeof Xr=="string"||`Expected a string, but received: ${print(Xr)}`)}function tuple$1(Xr){const eo=never();return new Struct$1({type:"tuple",schema:null,*entries(to){if(Array.isArray(to)){const ro=Math.max(Xr.length,to.length);for(let no=0;noto.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(to,ro){for(const no of Xr){const[io,oo]=no.validate(to,{coerce:!0,mask:ro.mask});if(!io)return oo}return to},validator(to,ro){const no=[];for(const io of Xr){const[...oo]=run(to,io,ro),[ao]=oo;if(ao[0])for(const[so]of oo)so&&no.push(so);else return[]}return[`Expected the value to satisfy a union of \`${eo}\`, but received: ${print(to)}`,...no]}})}function unknown(){return define("unknown",()=>!0)}function coerce(Xr,eo,to){return new Struct$1({...Xr,coercer:(ro,no)=>is$1(ro,eo)?Xr.coercer(to(ro,no),no):Xr.coercer(ro,no)})}function isOnCurve(Xr){try{return ed25519.ExtendedPoint.fromHex(Xr),!0}catch{return!1}}const toBuffer=Xr=>Buffer$1$1.isBuffer(Xr)?Xr:Xr instanceof Uint8Array?Buffer$1$1.from(Xr.buffer,Xr.byteOffset,Xr.byteLength):Buffer$1$1.from(Xr);class Struct{constructor(eo){Object.assign(this,eo)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(eo){return deserialize_1(SOLANA_SCHEMA,this,eo)}static decodeUnchecked(eo){return deserializeUnchecked_1(SOLANA_SCHEMA,this,eo)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(Xr){return Xr._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(eo){if(super({}),this._bn=void 0,isPublicKeyData(eo))this._bn=eo._bn;else{if(typeof eo=="string"){const to=bs58$3.decode(eo);if(to.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN(to)}else this._bn=new BN(eo);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const eo=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(eo.toBuffer())}equals(eo){return this._bn.eq(eo._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const eo=this.toBuffer();return new Uint8Array(eo.buffer,eo.byteOffset,eo.byteLength)}toBuffer(){const eo=this._bn.toArrayLike(Buffer$1$1);if(eo.length===PUBLIC_KEY_LENGTH)return eo;const to=Buffer$1$1.alloc(32);return eo.copy(to,32-eo.length),to}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(eo,to,ro){const no=Buffer$1$1.concat([eo.toBuffer(),Buffer$1$1.from(to),ro.toBuffer()]),io=sha256_1$4(no);return new PublicKey(io)}static createProgramAddressSync(eo,to){let ro=Buffer$1$1.alloc(0);eo.forEach(function(io){if(io.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");ro=Buffer$1$1.concat([ro,toBuffer(io)])}),ro=Buffer$1$1.concat([ro,to.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const no=sha256_1$4(ro);if(isOnCurve(no))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(no)}static async createProgramAddress(eo,to){return this.createProgramAddressSync(eo,to)}static findProgramAddressSync(eo,to){let ro=255,no;for(;ro!=0;){try{const io=eo.concat(Buffer$1$1.from([ro]));no=this.createProgramAddressSync(io,to)}catch(io){if(io instanceof TypeError)throw io;ro--;continue}return[no,ro]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(eo,to){return this.findProgramAddressSync(eo,to)}static isOnCurve(eo){const to=new PublicKey(eo);return isOnCurve(to.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES=64,publicKey=(Xr="publicKey")=>blob(32,Xr),rustString=(Xr="string")=>{const eo=struct([u32$1("length"),u32$1("lengthPadding"),blob(offset(u32$1(),-8),"chars")],Xr),to=eo.decode.bind(eo),ro=eo.encode.bind(eo),no=eo;return no.decode=(io,oo)=>to(io,oo).chars.toString(),no.encode=(io,oo,ao)=>{const so={chars:Buffer$1$1.from(io,"utf8")};return ro(so,oo,ao)},no.alloc=io=>u32$1().span+u32$1().span+Buffer$1$1.from(io,"utf8").length,no},authorized=(Xr="authorized")=>struct([publicKey("staker"),publicKey("withdrawer")],Xr),lockup=(Xr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey("custodian")],Xr),voteInit=(Xr="voteInit")=>struct([publicKey("nodePubkey"),publicKey("authorizedVoter"),publicKey("authorizedWithdrawer"),u8("commission")],Xr),voteAuthorizeWithSeedArgs=(Xr="voteAuthorizeWithSeedArgs")=>struct([u32$1("voteAuthorizationType"),publicKey("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey("newAuthorized")],Xr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);new PublicKey("SysvarC1ock11111111111111111111111111111111");new PublicKey("SysvarEpochSchedu1e111111111111111111111111");new PublicKey("Sysvar1nstructions1111111111111111111111111");new PublicKey("SysvarRecentB1ockHashes11111111111111111111");new PublicKey("SysvarRent111111111111111111111111111111111");new PublicKey("SysvarRewards111111111111111111111111111111");new PublicKey("SysvarS1otHashes111111111111111111111111111");new PublicKey("SysvarS1otHistory11111111111111111111111111");new PublicKey("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout=nu64("lamportsPerSignature"),NonceAccountLayout=struct([u32$1("version"),u32$1("state"),publicKey("authorizedPubkey"),publicKey("nonce"),struct([FeeCalculatorLayout],"feeCalculator")]);NonceAccountLayout.span;const encodeDecode=Xr=>{const eo=Xr.decode.bind(Xr),to=Xr.encode.bind(Xr);return{decode:eo,encode:to}},bigInt=Xr=>eo=>{const to=blob(Xr,eo),{encode:ro,decode:no}=encodeDecode(to),io=to;return io.decode=(oo,ao)=>{const so=no(oo,ao);return toBigIntLE_1(Buffer$1$1.from(so))},io.encode=(oo,ao,so)=>{const co=toBufferLE_1(oo,Xr);return ro(co,ao,so)},io},u64=bigInt(8);Object.freeze({Create:{index:0,layout:struct([u32$1("instruction"),ns64("lamports"),ns64("space"),publicKey("programId")])},Assign:{index:1,layout:struct([u32$1("instruction"),publicKey("programId")])},Transfer:{index:2,layout:struct([u32$1("instruction"),u64("lamports")])},CreateWithSeed:{index:3,layout:struct([u32$1("instruction"),publicKey("base"),rustString("seed"),ns64("lamports"),ns64("space"),publicKey("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32$1("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32$1("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32$1("instruction"),publicKey("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32$1("instruction"),publicKey("authorized")])},Allocate:{index:8,layout:struct([u32$1("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32$1("instruction"),publicKey("base"),rustString("seed"),ns64("space"),publicKey("programId")])},AssignWithSeed:{index:10,layout:struct([u32$1("instruction"),publicKey("base"),rustString("seed"),publicKey("programId")])},TransferWithSeed:{index:11,layout:struct([u32$1("instruction"),u64("lamports"),rustString("seed"),publicKey("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32$1("instruction")])}});new PublicKey("11111111111111111111111111111111");new PublicKey("BPFLoader2111111111111111111111111111111111");struct([u32$1("typeIndex"),u64("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey(),offset(u8(),-1),"authority")]);const PublicKeyFromString=coerce(instance(PublicKey),string(),Xr=>new PublicKey(Xr)),RawAccountDataResult=tuple$1([string(),literal("base64")]),BufferFromRawAccountData=coerce(instance(Buffer$1$1),RawAccountDataResult,Xr=>Buffer$1$1.from(Xr[0],"base64"));function createRpcResult(Xr){return union([type({jsonrpc:literal("2.0"),id:string(),result:Xr}),type({jsonrpc:literal("2.0"),id:string(),error:type({code:unknown(),message:string(),data:optional(any())})})])}const UnknownRpcResult=createRpcResult(unknown());function jsonRpcResult(Xr){return coerce(createRpcResult(Xr),UnknownRpcResult,eo=>"error"in eo?eo:{...eo,result:create(eo.result,Xr)})}function jsonRpcResultAndContext(Xr){return jsonRpcResult(type({context:type({slot:number$1()}),value:Xr}))}function notificationResultAndContext(Xr){return type({context:type({slot:number$1()}),value:Xr})}const GetInflationGovernorResult=type({foundation:number$1(),foundationTerm:number$1(),initial:number$1(),taper:number$1(),terminal:number$1()});jsonRpcResult(array(nullable(type({epoch:number$1(),effectiveSlot:number$1(),amount:number$1(),postBalance:number$1(),commission:optional(nullable(number$1()))}))));const GetRecentPrioritizationFeesResult=array(type({slot:number$1(),prioritizationFee:number$1()})),GetInflationRateResult=type({total:number$1(),validator:number$1(),foundation:number$1(),epoch:number$1()}),GetEpochInfoResult=type({epoch:number$1(),slotIndex:number$1(),slotsInEpoch:number$1(),absoluteSlot:number$1(),blockHeight:optional(number$1()),transactionCount:optional(number$1())}),GetEpochScheduleResult=type({slotsPerEpoch:number$1(),leaderScheduleSlotOffset:number$1(),warmup:boolean(),firstNormalEpoch:number$1(),firstNormalSlot:number$1()}),GetLeaderScheduleResult=record(string(),array(number$1())),TransactionErrorResult=nullable(union([type({}),string()])),SignatureStatusResult=type({err:TransactionErrorResult}),SignatureReceivedResult=literal("receivedSignature");type({"solana-core":string(),"feature-set":optional(number$1())});const ParsedInstructionStruct=type({program:string(),programId:PublicKeyFromString,parsed:unknown()}),PartiallyDecodedInstructionStruct=type({programId:PublicKeyFromString,accounts:array(PublicKeyFromString),data:string()});jsonRpcResultAndContext(type({err:nullable(union([type({}),string()])),logs:nullable(array(string())),accounts:optional(nullable(array(nullable(type({executable:boolean(),owner:string(),lamports:number$1(),data:array(string()),rentEpoch:optional(number$1())}))))),unitsConsumed:optional(number$1()),returnData:optional(nullable(type({programId:string(),data:tuple$1([string(),literal("base64")])}))),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(union([ParsedInstructionStruct,PartiallyDecodedInstructionStruct]))}))))}));jsonRpcResultAndContext(type({byIdentity:record(string(),array(number$1())),range:type({firstSlot:number$1(),lastSlot:number$1()})}));jsonRpcResult(GetInflationGovernorResult);jsonRpcResult(GetInflationRateResult);jsonRpcResult(GetRecentPrioritizationFeesResult);jsonRpcResult(GetEpochInfoResult);jsonRpcResult(GetEpochScheduleResult);jsonRpcResult(GetLeaderScheduleResult);jsonRpcResult(number$1());jsonRpcResultAndContext(type({total:number$1(),circulating:number$1(),nonCirculating:number$1(),nonCirculatingAccounts:array(PublicKeyFromString)}));const TokenAmountResult=type({amount:string(),uiAmount:nullable(number$1()),decimals:number$1(),uiAmountString:optional(string())});jsonRpcResultAndContext(array(type({address:PublicKeyFromString,amount:string(),uiAmount:nullable(number$1()),decimals:number$1(),uiAmountString:optional(string())})));jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:BufferFromRawAccountData,rentEpoch:number$1()})})));const ParsedAccountDataResult=type({program:string(),parsed:unknown(),space:number$1()});jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:ParsedAccountDataResult,rentEpoch:number$1()})})));jsonRpcResultAndContext(array(type({lamports:number$1(),address:PublicKeyFromString})));const AccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:BufferFromRawAccountData,rentEpoch:number$1()});type({pubkey:PublicKeyFromString,account:AccountInfoResult});const ParsedOrRawAccountData=coerce(union([instance(Buffer$1$1),ParsedAccountDataResult]),union([RawAccountDataResult,ParsedAccountDataResult]),Xr=>Array.isArray(Xr)?create(Xr,BufferFromRawAccountData):Xr),ParsedAccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number$1(),data:ParsedOrRawAccountData,rentEpoch:number$1()});type({pubkey:PublicKeyFromString,account:ParsedAccountInfoResult});type({state:union([literal("active"),literal("inactive"),literal("activating"),literal("deactivating")]),active:number$1(),inactive:number$1()});jsonRpcResult(array(type({signature:string(),slot:number$1(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number$1()))})));jsonRpcResult(array(type({signature:string(),slot:number$1(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number$1()))})));type({subscription:number$1(),result:notificationResultAndContext(AccountInfoResult)});const ProgramAccountInfoResult=type({pubkey:PublicKeyFromString,account:AccountInfoResult});type({subscription:number$1(),result:notificationResultAndContext(ProgramAccountInfoResult)});const SlotInfoResult=type({parent:number$1(),slot:number$1(),root:number$1()});type({subscription:number$1(),result:SlotInfoResult});const SlotUpdateResult=union([type({type:union([literal("firstShredReceived"),literal("completed"),literal("optimisticConfirmation"),literal("root")]),slot:number$1(),timestamp:number$1()}),type({type:literal("createdBank"),parent:number$1(),slot:number$1(),timestamp:number$1()}),type({type:literal("frozen"),slot:number$1(),timestamp:number$1(),stats:type({numTransactionEntries:number$1(),numSuccessfulTransactions:number$1(),numFailedTransactions:number$1(),maxTransactionsPerEntry:number$1()})}),type({type:literal("dead"),slot:number$1(),timestamp:number$1(),err:string()})]);type({subscription:number$1(),result:SlotUpdateResult});type({subscription:number$1(),result:notificationResultAndContext(union([SignatureStatusResult,SignatureReceivedResult]))});type({subscription:number$1(),result:number$1()});type({pubkey:string(),gossip:nullable(string()),tpu:nullable(string()),rpc:nullable(string()),version:nullable(string())});const VoteAccountInfoResult=type({votePubkey:string(),nodePubkey:string(),activatedStake:number$1(),epochVoteAccount:boolean(),epochCredits:array(tuple$1([number$1(),number$1(),number$1()])),commission:number$1(),lastVote:number$1(),rootSlot:nullable(number$1())});jsonRpcResult(type({current:array(VoteAccountInfoResult),delinquent:array(VoteAccountInfoResult)}));const ConfirmationStatus=union([literal("processed"),literal("confirmed"),literal("finalized")]),SignatureStatusResponse=type({slot:number$1(),confirmations:nullable(number$1()),err:TransactionErrorResult,confirmationStatus:optional(ConfirmationStatus)});jsonRpcResultAndContext(array(nullable(SignatureStatusResponse)));jsonRpcResult(number$1());const AddressTableLookupStruct=type({accountKey:PublicKeyFromString,writableIndexes:array(number$1()),readonlyIndexes:array(number$1())}),ConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(string()),header:type({numRequiredSignatures:number$1(),numReadonlySignedAccounts:number$1(),numReadonlyUnsignedAccounts:number$1()}),instructions:array(type({accounts:array(number$1()),data:string(),programIdIndex:number$1()})),recentBlockhash:string(),addressTableLookups:optional(array(AddressTableLookupStruct))})}),AnnotatedAccountKey=type({pubkey:PublicKeyFromString,signer:boolean(),writable:boolean(),source:optional(union([literal("transaction"),literal("lookupTable")]))}),ConfirmedTransactionAccountsModeResult=type({accountKeys:array(AnnotatedAccountKey),signatures:array(string())}),ParsedInstructionResult=type({parsed:unknown(),program:string(),programId:PublicKeyFromString}),RawInstructionResult=type({accounts:array(PublicKeyFromString),data:string(),programId:PublicKeyFromString}),InstructionResult=union([RawInstructionResult,ParsedInstructionResult]),UnknownInstructionResult=union([type({parsed:unknown(),program:string(),programId:string()}),type({accounts:array(string()),data:string(),programId:string()})]),ParsedOrRawInstruction=coerce(InstructionResult,UnknownInstructionResult,Xr=>"accounts"in Xr?create(Xr,RawInstructionResult):create(Xr,ParsedInstructionResult)),ParsedConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(AnnotatedAccountKey),instructions:array(ParsedOrRawInstruction),recentBlockhash:string(),addressTableLookups:optional(nullable(array(AddressTableLookupStruct)))})}),TokenBalanceResult=type({accountIndex:number$1(),mint:string(),owner:optional(string()),uiTokenAmount:TokenAmountResult}),LoadedAddressesResult=type({writable:array(PublicKeyFromString),readonly:array(PublicKeyFromString)}),ConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number$1(),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(type({accounts:array(number$1()),data:string(),programIdIndex:number$1()}))})))),preBalances:array(number$1()),postBalances:array(number$1()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number$1())}),ParsedConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number$1(),innerInstructions:optional(nullable(array(type({index:number$1(),instructions:array(ParsedOrRawInstruction)})))),preBalances:array(number$1()),postBalances:array(number$1()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number$1())}),TransactionVersionStruct=union([literal(0),literal("legacy")]),RewardsResult=type({pubkey:string(),lamports:number$1(),postBalance:nullable(number$1()),rewardType:nullable(string()),commission:optional(nullable(number$1()))});jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1()),blockHeight:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number$1())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number$1(),signatures:array(string()),blockTime:nullable(number$1())})));jsonRpcResult(nullable(type({slot:number$1(),meta:nullable(ConfirmedTransactionMetaResult),blockTime:optional(nullable(number$1())),transaction:ConfirmedTransactionResult,version:optional(TransactionVersionStruct)})));jsonRpcResult(nullable(type({slot:number$1(),transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),blockTime:optional(nullable(number$1())),version:optional(TransactionVersionStruct)})));jsonRpcResultAndContext(type({blockhash:string(),feeCalculator:type({lamportsPerSignature:number$1()})}));jsonRpcResultAndContext(type({blockhash:string(),lastValidBlockHeight:number$1()}));jsonRpcResultAndContext(boolean());const PerfSampleResult=type({slot:number$1(),numTransactions:number$1(),numSlots:number$1(),samplePeriodSecs:number$1()});jsonRpcResult(array(PerfSampleResult));jsonRpcResultAndContext(nullable(type({feeCalculator:type({lamportsPerSignature:number$1()})})));jsonRpcResult(string());jsonRpcResult(string());const LogsResult=type({err:TransactionErrorResult,logs:array(string()),signature:string()});type({result:notificationResultAndContext(LogsResult),subscription:number$1()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32$1("instruction"),u64("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32$1("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32$1("instruction"),u64(),seq(publicKey(),offset(u32$1(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32$1("instruction")])},CloseLookupTable:{index:4,layout:struct([u32$1("instruction")])}});new PublicKey("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32$1("units"),u32$1("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32$1("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32$1("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64("microLamports")])}});new PublicKey("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey("Ed25519SigVerify111111111111111111111111111");secp256k1$2.utils.isValidPrivateKey;secp256k1$2.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey("KeccakSecp256k11111111111111111111111111111");var _Lockup;new PublicKey("StakeConfig11111111111111111111111111111111");class Lockup{constructor(eo,to,ro){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=eo,this.epoch=to,this.custodian=ro}}_Lockup=Lockup;Lockup.default=new _Lockup(0,0,PublicKey.default);Object.freeze({Initialize:{index:0,layout:struct([u32$1("instruction"),authorized(),lockup()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey("newAuthorized"),u32$1("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32$1("instruction")])},Split:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32$1("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32$1("instruction")])},Merge:{index:7,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32$1("instruction"),publicKey("newAuthorized"),u32$1("stakeAuthorizationType"),rustString("authoritySeed"),publicKey("authorityOwner")])}});new PublicKey("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32$1("instruction"),voteInit()])},Authorize:{index:1,layout:struct([u32$1("instruction"),publicKey("newAuthorized"),u32$1("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32$1("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32$1("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32$1("instruction"),voteAuthorizeWithSeedArgs()])}});new PublicKey("Vote111111111111111111111111111111111111111");new PublicKey("Va1idator1nfo111111111111111111111111111111");type({name:string(),website:optional(string()),details:optional(string()),iconUrl:optional(string()),keybaseUsername:optional(string())});new PublicKey("Vote111111111111111111111111111111111111111");struct([publicKey("nodePubkey"),publicKey("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32$1("confirmationCount")]),offset(u32$1(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey("authorizedVoter")]),offset(u32$1(),-8),"authorizedVoters"),struct([seq(struct([publicKey("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32$1(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);class TurnkeySigner{constructor(eo){this.organizationId=eo.organizationId,this.client=eo.client}async signAllTransactions(eo,to){var ao,so,co;const ro=new PublicKey(to);let no=eo.map(lo=>this.getMessageToSign(lo).toString("hex"));const oo=(so=(ao=(await this.signRawPayloads(no,to)).signRawPayloadsResult)==null?void 0:ao.signatures)==null?void 0:so.map(lo=>`${lo==null?void 0:lo.r}${lo==null?void 0:lo.s}`);for(let lo in eo)(co=eo[lo])==null||co.addSignature(ro,Buffer$3.from(oo[lo],"hex"));return eo}async addSignature(eo,to){var ao,so;const ro=new PublicKey(to);let no=this.getMessageToSign(eo);const io=await this.signRawPayload(no.toString("hex"),to),oo=`${(ao=io.signRawPayloadResult)==null?void 0:ao.r}${(so=io.signRawPayloadResult)==null?void 0:so.s}`;eo.addSignature(ro,Buffer$3.from(oo,"hex"))}async signMessage(eo,to){var no,io;const ro=await this.signRawPayload(Buffer$3.from(eo).toString("hex"),to);return Buffer$3.from(`${(no=ro.signRawPayloadResult)==null?void 0:no.r}${(io=ro.signRawPayloadResult)==null?void 0:io.s}`,"hex")}async signRawPayload(eo,to){const ro=await this.client.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:to,payload:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:no,status:io,type:oo,result:ao}=ro.activity;if(io!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${io}`,activityId:no,activityStatus:io,activityType:oo});return ao}async signRawPayloads(eo,to){const ro=await this.client.signRawPayloads({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:to,payloads:eo,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:no,status:io,type:oo,result:ao}=ro.activity;if(io!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${io}`,activityId:no,activityStatus:io,activityType:oo});return ao}getMessageToSign(eo){let to;return typeof eo.serializeMessage=="function"?to=eo.serializeMessage():to=Buffer$3.from(eo.message.serialize()),to}}var version$5="3.5.1";function __awaiter$2(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var version$4="3.5.1";function __rest(Xr,eo){var to={};for(var ro in Xr)Object.prototype.hasOwnProperty.call(Xr,ro)&&eo.indexOf(ro)<0&&(to[ro]=Xr[ro]);if(Xr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var no=0,ro=Object.getOwnPropertySymbols(Xr);no{var Xr,eo,to;return typeof process$1$1<"u"&&define_process_env_default$2&&(to=(eo=(Xr=define_process_env_default$2.ICONIC_SPRITE_CDN_URL)!==null&&Xr!==void 0?Xr:define_process_env_default$2.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&eo!==void 0?eo:define_process_env_default$2.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&to!==void 0?to:DEFAULT_ICONIC_SPRITE_URL},ICONIC_SPRITE_URL=getIconicSpriteUrl(),createIconic=Xr=>{const eo=Object.assign(Object.assign({},Xr),{function:ro=>{const no=`${ICONIC_SPRITE_URL}#${eo.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${eo.iconName}`},ro),{alt:eo.alt,src:no}))}}),to=eo.function.bind(eo);return Object.assign(to,{iconName:eo.iconName,sourcePath:eo.sourcePath}),to};createIconic({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"});createIconic({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"});createIconic({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"});createIconic({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"});createIconic({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"});createIconic({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"});createIconic({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});createIconic({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});createIconic({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});createIconic({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});createIconic({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});createIconic({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"});createIconic({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});createIconic({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});createIconic({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"});createIconic({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"});createIconic({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"});createIconic({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"});createIconic({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"});createIconic({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"});createIconic({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"});createIconic({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"});createIconic({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"});createIconic({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"});createIconic({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"});createIconic({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"});createIconic({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"});createIconic({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"});createIconic({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"});createIconic({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"});createIconic({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"});createIconic({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"});createIconic({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"});createIconic({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"});createIconic({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"});createIconic({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"});createIconic({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"});createIconic({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"});createIconic({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"});createIconic({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"});createIconic({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"});createIconic({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"});createIconic({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"});createIconic({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"});createIconic({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"});createIconic({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"});createIconic({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"});createIconic({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"});createIconic({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});typeof SuppressedError=="function"&&SuppressedError;new Logger$2("iconic");assertPackageVersion("@dynamic-labs/iconic",version$2);`${getIconicSpriteUrl()}`;new Logger$2("WalletBook");typeof SuppressedError=="function"&&SuppressedError;const walletConnectSourceValueSchema=z$9.object({app:z$9.object({android:z$9.string().nullable(),browser:z$9.string().nullable(),chrome:z$9.string().nullable(),edge:z$9.string().nullable(),firefox:z$9.string().nullable(),ios:z$9.string().nullable(),linux:z$9.string().nullable(),mac:z$9.string().nullable(),opera:z$9.string().nullable(),safari:z$9.string().nullable(),windows:z$9.string().nullable()}),app_type:z$9.string(),category:z$9.string().nullable(),chains:z$9.array(z$9.string()),description:z$9.string().nullable(),desktop:z$9.object({native:z$9.string().nullable(),universal:z$9.string().nullable()}),homepage:z$9.string(),id:z$9.string(),image_id:z$9.string(),image_url:z$9.object({lg:z$9.string(),md:z$9.string(),sm:z$9.string()}),injected:z$9.array(z$9.object({injected_id:z$9.string(),namespace:z$9.string()})).nullable(),metadata:z$9.object({colors:z$9.object({primary:z$9.string().nullable(),secondary:z$9.string().nullable()}),shortName:z$9.string().nullable()}),mobile:z$9.object({native:z$9.string().nullable(),universal:z$9.string().nullable()}),name:z$9.string(),rdns:z$9.string().nullable(),sdks:z$9.array(z$9.string()),slug:z$9.string(),supported_standards:z$9.array(z$9.object({id:z$9.string(),standard_id:z$9.number(),standard_prefix:z$9.string(),title:z$9.string(),url:z$9.string()})).optional(),updatedAt:z$9.string(),versions:z$9.array(z$9.string())}).strict();z$9.record(z$9.string(),walletConnectSourceValueSchema);const nonEmptyString=z$9.preprocess(Xr=>Xr||void 0,z$9.string().optional()),transformChromeExtensionId=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("chrome.google.com/webstore/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId=Xr=>{if(Xr!=null&&Xr.match(/^[a-z]{32}$/))return Xr;if(Xr!=null&&Xr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(Xr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr!=null&&Xr.includes("addons.mozilla.org"))try{return new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex=/^id[0-9]{1,36}$/,transformIosId=Xr=>{if(Xr!=null&&Xr.match(idRegex))return Xr;if(Xr!=null&&Xr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const to=new URL(Xr).pathname.replace(/\/$/,"").split("/").at(-1);if(to!=null&&to.match(idRegex))return to}catch{}},transformAndroidId=Xr=>{if(!(Xr!=null&&Xr.match(/^https?:\/\//)))return Xr;if(Xr)try{const to=new URL(Xr).searchParams.get("id");if(to)return to}catch{}},nonEmptyStringArray=z$9.preprocess(Xr=>Array.isArray(Xr)&&Xr.length>0?Xr:void 0,z$9.array(z$9.string()).optional()),filterEmptyObject=Xr=>Xr&&Object.values(Xr).some(eo=>!!eo)?Xr:void 0,injectedConfigSchema=z$9.object({chain:z$9.string(),extensionLocators:z$9.array(z$9.object({flag:z$9.string(),value:z$9.boolean().optional().default(!0)})),providerInterface:z$9.string().optional(),walletStandard:z$9.object({features:z$9.array(z$9.string()),name:z$9.string(),providerId:z$9.string().optional()}).optional(),walletStandardLocators:z$9.array(z$9.object({locator:z$9.string(),name:z$9.string()})).optional(),windowLocations:z$9.array(z$9.string()).optional().refine(Xr=>!Xr||!Xr.some(eo=>["ethereum","ethereum.providers"].includes(eo)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema=z$9.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}),walletSchema=z$9.preprocess(Xr=>Xr,z$9.object({brand:brandSchema.optional(),chainGroup:z$9.string().optional(),chains:z$9.array(z$9.string()).optional(),desktop:z$9.object({chromeId:nonEmptyString.transform(transformChromeExtensionId),edgeId:nonEmptyString.transform(transformEdgeExtensionId),firefoxId:nonEmptyString.transform(transformFirefoxExtensionId),native:nonEmptyString,operaId:nonEmptyString,safariId:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),eip6963Config:z$9.object({rdns:z$9.string()}).optional(),filterFromWalletConnect:z$9.boolean().optional(),group:z$9.string().optional(),hardwareWallets:z$9.array(z$9.string()).optional(),injectedConfig:z$9.array(injectedConfigSchema).optional(),mobile:z$9.object({android:stringType().nullish(),androidId:nonEmptyString.transform(transformAndroidId),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString.transform(transformIosId),native:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),mobileExperience:z$9.enum(["in-app-browser","redirect"]).optional(),name:z$9.string(),shortName:nonEmptyString,showOnlyIfInstalled:z$9.boolean().optional(),switchNetworkOnlyFromWallet:z$9.boolean().optional(),walletConnect:z$9.object({sdks:nonEmptyStringArray}).optional().transform(filterEmptyObject),walletGroup:z$9.string().optional(),walletLimitations:z$9.object({browserExtension:z$9.object({unsupportedEvents:z$9.array(z$9.string()).optional(),unsupportedMethods:z$9.array(z$9.string()).optional()}).optional(),mobile:z$9.object({unsupportedEvents:z$9.array(z$9.string()).optional(),unsupportedMethods:z$9.array(z$9.string()).optional()}).optional()}).optional()})).transform(Xr=>{var eo,to,ro,no,io,oo;return Xr.group&&(Xr.chainGroup=Xr.group),(!((eo=Xr.mobile)===null||eo===void 0)&&eo.iosId||((to=Xr.mobile)===null||to===void 0?void 0:to.ios)===null)&&((ro=Xr.mobile)===null||ro===void 0||delete ro.ios),(!((no=Xr.mobile)===null||no===void 0)&&no.androidId||((io=Xr.mobile)===null||io===void 0?void 0:io.android)===null)&&((oo=Xr.mobile)===null||oo===void 0||delete oo.android),Xr}),WalletOverrideEntrySchema=z$9.object({brand:brandSchema.optional(),name:nonEmptyString}),walletGroupSchema=z$9.object({brand:z$9.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}).optional(),key:z$9.string(),name:z$9.string(),walletOverrides:z$9.record(WalletOverrideEntrySchema).optional()});z$9.record(z$9.string(),walletSchema);z$9.preprocess(Xr=>Xr,z$9.object({groups:z$9.record(z$9.string(),walletGroupSchema),wallets:z$9.record(z$9.string(),walletSchema)}));z$9.record(z$9.string(),walletGroupSchema);assertPackageVersion("@dynamic-labs/wallet-book",version$3);const logger$3=new Logger$2("WalletConnector"),shouldLowercaseAddress=Xr=>["eip155","flow","evm","eth","avax","matic"].includes(Xr.toLowerCase()),normalizeAddress=(Xr,eo)=>(Xr.startsWith("0x")&&(Xr=Xr.slice(2)),shouldLowercaseAddress(eo)?Xr.toLowerCase():Xr),isSameAddress=(Xr,eo,to)=>normalizeAddress(Xr,to)===normalizeAddress(eo,to);new EventEmitter$3;class Wallet extends BaseWallet{constructor(eo){var{connector:to}=eo,ro=__rest(eo,["connector"]);super(ro),this._connector=to}get connector(){return this._connector}getBalance(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter$1(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(to=>normalizeAddress(to,this.chain)).includes(normalizeAddress(this.address,this.chain))}catch(eo){return logger$3.error("[Wallet] isConnected - Error detecting if wallet is connected",eo),!1}})}proveOwnership(eo){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,eo)})}signMessage(eo){return __awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(eo,this.address)})}switchNetwork(eo){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:eo})})}sync(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}}assertPackageVersion("@dynamic-labs/wallet-connector-core",version$4);class SolanaWallet extends Wallet{getConnection(){return __awaiter$2(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){const eo=yield this._connector.getSigner();if(!eo)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(eo,{signAllTransactions:to=>__awaiter$2(this,void 0,void 0,function*(){return yield this.sync(),eo.signAllTransactions(to)}),signAndSendTransaction:(to,...ro)=>__awaiter$2(this,void 0,void 0,function*(){return yield this.sync(),eo.signAndSendTransaction(to,...ro)}),signMessage:(to,...ro)=>__awaiter$2(this,void 0,void 0,function*(){return yield this.sync(),eo.signMessage(to,...ro)}),signTransaction:to=>__awaiter$2(this,void 0,void 0,function*(){return yield this.sync(),eo.signTransaction(to)})})}catch(to){return logger$3.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,to),eo}})}}const SOLANA_GENESIS_HASH="genesis-hash",getGenesisHashLSKey=Xr=>`${Xr}_${SOLANA_GENESIS_HASH}`;new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");ChainRpcProviders.getSolanaProviderByChainId=(Xr,eo)=>{var to;return(to=Xr.solana)===null||to===void 0?void 0:to.find(no=>no.chainId===eo)};ChainRpcProviders.registerSolanaProviders=Xr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,eo=>{const to={};return eo!=null&&eo.solana&&(to.solana=eo.solana.map(ro=>{var no;const io=((no=ro.privateCustomerRpcUrls)===null||no===void 0?void 0:no[0])||ro.rpcUrls[0],oo=new Connection(io,Xr);return{chainId:ro.chainId.toString(),chainName:ro.name,provider:oo}})),to.solana})};const LAMPORTS_PER_SOL=1e9;class SolanaUiTransaction{constructor({onSubmit:eo,from:to,connection:ro,originalTransaction:no}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.feeDeducted=!1,this.formatNonNativeToken=(io,oo)=>(Number(io)/Number(Math.pow(10,oo))).toString(),this.from=to,this.onSubmit=eo,this.connection=ro,this.originalTransaction=no}parse(eo){const to=parseFloat(eo),ro=Math.round(to*LAMPORTS_PER_SOL);return BigInt(ro)}parseNonNativeToken(eo,to){return BigInt(Math.floor(Number(eo)*Math.pow(10,to)))}format(eo,{precision:to}={}){const no=(Number(eo)/LAMPORTS_PER_SOL).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(no,{precision:to})}submit(){return __awaiter$2(this,void 0,void 0,function*(){const eo=yield this.createTransaction();return this.onSubmit(eo)})}getBalance(){return __awaiter$2(this,void 0,void 0,function*(){const eo=new PublicKey$2(this.from),to=yield this.connection.getBalance(eo);return BigInt(to)})}validateAddressFormat(eo){return eo==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(eo)}fetchFee(){return __awaiter$2(this,void 0,void 0,function*(){if(this.fee.gas)return;const eo=yield this.createTransactionSafe();if(!eo)return;let to;if("version"in eo?to=eo.message:to=eo.compileMessage(),!to)throw new Error("Invalid transaction");let ro=yield this.connection.getFeeForMessage(to),no=0;for(;ro.value===null&&no<5;)ro=yield this.connection.getFeeForMessage(to),no++;this.fee.gas=ro.value?BigInt(ro.value):void 0,!this.feeDeducted&&this.fee.gas&&this.value&&(this.value=this.value-this.fee.gas,this.feeDeducted=!0)})}createTransaction(){return __awaiter$2(this,void 0,void 0,function*(){var eo;const{value:to,to:ro,nonNativeAddress:no,nonNativeValue:io}=this;if(!ro)throw new Error("Destination is required");if(this.originalTransaction)return this.originalTransaction;const oo=new Transaction,ao=new PublicKey$2(this.from),so=new PublicKey$2(ro);if(no&&io){const lo=new PublicKey$2(no),uo=io,ho=(eo=(yield this.connection.getTokenAccountsByOwner(ao,{mint:lo})).value[0])===null||eo===void 0?void 0:eo.pubkey;if(!ho)throw new Error("Source token account not found");let go;try{go=yield getAssociatedTokenAddress(lo,so),yield this.connection.getTokenAccountBalance(go)}catch{go=yield getAssociatedTokenAddress(lo,so),oo.add(createAssociatedTokenAccountInstruction(ao,go,so,lo))}oo.add(createTransferInstruction(ho,go,ao,uo))}else{const lo=to??BigInt(0);oo.add(SystemProgram.transfer({fromPubkey:ao,lamports:lo,toPubkey:so}))}const{blockhash:co}=yield this.connection.getLatestBlockhash();return oo.feePayer=new PublicKey$2(this.from),oo.recentBlockhash=co,oo})}createTransactionSafe(){return __awaiter$2(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}}assertPackageVersion("@dynamic-labs/solana-core",version$5);const createSolanaConnection=(Xr,eo)=>{if(!Xr)throw new Error("rpcUrl is required");return new Connection(Xr,eo)},getTotalSolanaSpend=(Xr,eo,to)=>__awaiter$3(void 0,void 0,void 0,function*(){var ro,no,io,oo,ao,so,co,lo,uo,ho;let go,bo;"version"in Xr?([bo]=Xr.message.staticAccountKeys,go=yield eo.simulateTransaction(Xr,{accounts:{addresses:bo.toBase58()&&bo.toBase58()!==to?[bo.toBase58(),to]:[to],encoding:"base64"},replaceRecentBlockhash:!0})):(bo=Xr.feePayer||Xr.instructions[0].keys[0].pubkey,go=yield eo.simulateTransaction(Xr,void 0,bo.toBase58()&&bo.toBase58()!==to?[bo,new PublicKey$2(to)]:[new PublicKey$2(to)]));const wo=yield eo.getBalance(new PublicKey$2(to));if(!(!((io=(no=(ro=go==null?void 0:go.value)===null||ro===void 0?void 0:ro.accounts)===null||no===void 0?void 0:no[0])===null||io===void 0)&&io.lamports)){logger$3.debug("Transaction simulation failed",go);const $o=JSON.stringify({InstructionError:[0,{Custom:1}]}),Co=JSON.stringify({InsufficientFundsForRent:{account_index:0}});if(JSON.stringify(go==null?void 0:go.value.err)===$o||JSON.stringify(go==null?void 0:go.value.err)===Co)throw new Error("Insufficient funds");return}const Eo=wo-((co=(so=(ao=(oo=go==null?void 0:go.value)===null||oo===void 0?void 0:oo.accounts)===null||ao===void 0?void 0:ao[1])===null||so===void 0?void 0:so.lamports)!==null&&co!==void 0?co:(ho=(uo=(lo=go==null?void 0:go.value)===null||lo===void 0?void 0:lo.accounts)===null||uo===void 0?void 0:uo[0])===null||ho===void 0?void 0:ho.lamports);return BigInt(Eo)}),decodeTransaction=(Xr,eo,to)=>__awaiter$3(void 0,void 0,void 0,function*(){var ro;if(!Xr)throw new DynamicError("Transaction is required");try{let no=[];if("version"in Xr){const so=Xr.message.addressTableLookups.map(co=>new PublicKey$2(co.accountKey));if(so.length>0){const lo=(yield Promise.all(so.map(uo=>eo.getAddressLookupTable(uo)))).filter(uo=>uo!==null).map(uo=>uo.value);lo.length>0&&(no=TransactionMessage.decompile(Xr.message,{addressLookupTableAccounts:lo}).instructions)}else no=TransactionMessage.decompile(Xr.message).instructions}else Xr.instructions?no=Xr.instructions:no=(ro=Transaction.from(Buffer$3.from(Xr.serialize())))===null||ro===void 0?void 0:ro.instructions;if(!(no!=null&&no.length))throw new DynamicError("Bad formatted instruction");const io=no.filter(so=>so.programId.equals(SystemProgram.programId));if(io.length>0)return io.map(so=>{let co;try{co=SystemInstruction.decodeTransfer(so)}catch{return{from:to,to:"Unknown"}}return{from:co==null?void 0:co.fromPubkey.toBase58(),to:co==null?void 0:co.toPubkey.toBase58()}});let oo=yield Promise.all(no.map(so=>__awaiter$3(void 0,void 0,void 0,function*(){var co,lo,uo,ho,go,bo,wo;if(so.programId.equals(TOKEN_PROGRAM_ID)){const Eo=decodeTransferInstructionUnchecked(so),{source:$o,destination:Co}=Eo.keys;if(Co){if((Co==null?void 0:Co.pubkey.toBase58())===to)return{from:to,to:$o==null?void 0:$o.pubkey.toBase58()};const Ro=yield eo.getParsedAccountInfo(Co.pubkey),jo=((uo=(lo=(co=Ro.value)===null||co===void 0?void 0:co.data)===null||lo===void 0?void 0:lo.parsed)===null||uo===void 0?void 0:uo.type)==="account"?(wo=(bo=(go=(ho=Ro.value)===null||ho===void 0?void 0:ho.data)===null||go===void 0?void 0:go.parsed)===null||bo===void 0?void 0:bo.info)===null||wo===void 0?void 0:wo.owner:null,Bo=jo||(Co==null?void 0:Co.pubkey.toBase58());return{from:to,to:Bo}}}return null})));if(oo=oo.filter(so=>so!==null),oo!=null&&oo.length)return oo;const ao=no.map(so=>({from:to,to:so.programId.toBase58()}));return ao.length?ao:[{from:to,to:"Unknown"}]}catch(no){return logger$3.warn("[decodeTransaction]",no),[{from:to,to:"Unknown"}]}}),summarizeTransactionDecodedData=Xr=>{const eo=new Set;return Xr.forEach(ro=>{ro&&ro.to&&eo.add(ro.to)}),eo.size===1?eo.values().next().value:"Multiple"},logger$2=new Logger$2("DynamicSDK"),AUTH_MIN_TOKEN="dynamic_min_authentication_token",AUTH_MIN_TOKEN_DEMO="dynamic_min_authentication_token_demo",isCookieEnabled=()=>{var Xr,eo,to,ro;let no=(Xr=StorageService.getItem("dynamic_store"))!==null&&Xr!==void 0?Xr:StorageService.getItem("dynamic_store_demo");if(no=(eo=no==null?void 0:no.settings)===null||eo===void 0?void 0:eo.security,!no)return!1;const io=(((to=no.auth)===null||to===void 0?void 0:to.storage)||[]).includes(AuthStorageEnum.Cookie),oo=!!(!((ro=no.externalAuth)===null||ro===void 0)&&ro.cookieName);return io||oo},parseToken=Xr=>{var eo;if(!Xr)return;const to=(eo=Xr.split(".")[1])===null||eo===void 0?void 0:eo.replace(/-/g,"+").replace(/_/g,"/"),ro=to&&decodeURIComponent(atob(to).split("").map(no=>`%${`00${no.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(ro)},decodeMinJwt=Xr=>{try{const eo=parseToken(Xr);return eo?MinifiedDynamicJwtFromJSON(eo):void 0}catch(eo){logger$2.error(eo);return}},getMinAuthToken=()=>{var Xr;if(typeof window>"u")return;const eo=(Xr=StorageService.getItem(AUTH_MIN_TOKEN,{priority:["secureStorage","localStorage"]}))!==null&&Xr!==void 0?Xr:StorageService.getItem(AUTH_MIN_TOKEN_DEMO,{priority:["secureStorage","localStorage"]});if(!(!eo||isMinAuthTokenExpired(eo)))return eo},isMinAuthTokenExpired=Xr=>{const eo=decodeMinJwt(Xr);return isTokenExpired(eo)},isTokenExpired=Xr=>{if(!Xr||!Xr.exp)return!0;const eo=new Date(Xr.exp*1e3).getTime();return new Date().getTime()>=eo};class ApiEndpoint{}ApiEndpoint.getBaseUrl=()=>{if(!ApiEndpoint.__defined__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint.__baseUrl__};ApiEndpoint.setBaseUrl=Xr=>{if(!ApiEndpoint.__defined__)Xr?ApiEndpoint.__baseUrl__=Xr:ApiEndpoint.__baseUrl__=new Configuration().basePath,ApiEndpoint.__defined__=!0;else{if(!Xr&&ApiEndpoint.__defined__)return;if(ApiEndpoint.__baseUrl__!==Xr)throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${Xr}`)}Object.freeze(ApiEndpoint)};const VERSION=version$6,API_VERSION$1=dependencies["@dynamic-labs/sdk-api-core"];var define_process_env_default$1={};const sdkApi=()=>{const Xr=define_process_env_default$1.API_BASE_URL||define_process_env_default$1.NX_API_BASE_URL||"https://app.dynamic.xyz/api/v0";ApiEndpoint.setBaseUrl(Xr);const eo={basePath:ApiEndpoint.getBaseUrl(),headers:{"Content-Type":"application/json"}},to=getMinAuthToken();to&&(eo.headers.Authorization=`Bearer ${to}`);const ro=isCookieEnabled()?"include":void 0;return eo.headers["x-dyn-version"]=`WalletKit/${VERSION}`,eo.headers["x-dyn-api-version"]=`API/${API_VERSION$1}`,new SDKApi(new Configuration(Object.assign(Object.assign({},eo),{credentials:ro,fetchApi:FetchService.fetch})))},serializeTransaction=Xr=>Xr instanceof VersionedTransaction?Buffer$3.from(Xr.serialize()).toString("base64"):Buffer$3.from(Xr.serialize({verifySignatures:!1})).toString("base64"),deserializeTransaction=Xr=>{const eo=Buffer$3.from(Xr,"base64");return VersionedTransaction.deserialize(eo)},optimizeSolanaTransaction=(Xr,eo,to)=>__awaiter$3(void 0,void 0,void 0,function*(){const ro=serializeTransaction(eo),no={environmentId:Xr,solanaTransactionOptimizationRequest:{address:to,transaction:ro}},io=yield sdkApi().optimizeTransaction(no);return deserializeTransaction(io.transaction)});class TurnkeySolanaSigner{constructor({walletConnector:eo}){this.isConnected=!0,this.providers=[this],this.walletConnector=eo,this.turnkeyAddress=this.walletConnector.turnkeyAddress,this.publicKey=this.turnkeyAddress?new PublicKey$2(this.turnkeyAddress):void 0}signMessage(eo){return __awaiter$3(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signUint8ArrayMessage(eo)}})}signTransaction(eo){return __awaiter$3(this,void 0,void 0,function*(){return this.walletConnector.signTransaction(eo)})}signAllTransactions(eo){return __awaiter$3(this,void 0,void 0,function*(){return this.walletConnector.signAllTransactions(eo)})}signAndSendTransaction(eo,to){return __awaiter$3(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signAndSendTransaction(eo,to)}})}connect(eo){return __awaiter$3(this,void 0,void 0,function*(){return{address:this.turnkeyAddress,publicKey:this.publicKey}})}disconnect(){return __awaiter$3(this,void 0,void 0,function*(){})}}class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase{constructor(eo,to){var ro;super(eo,to),this.ChainWallet=SolanaWallet,this.connectedChain="SOL",this.supportedChains=["SOL"],this.verifiedCredentialChain="solana",this.getEnvId=()=>{const no=localStorage.getItem("dynamic_nonce");if(no){const oo=JSON.parse(no);if(oo&&oo.environmentId)return oo.environmentId}const io=localStorage.getItem("dynamic_nonce_demo");if(io){const oo=JSON.parse(io);if(oo&&oo.environmentId)return oo.environmentId}throw new Error("Failed to get environment id")},this.stampCreateWalletAccountRequest=no=>__awaiter$3(this,[no],void 0,function*({request:io}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(io)}),this.solNetworks=to.solNetworks,this.walletUiUtils=to.walletUiUtils,this._turnkeyAccount=void 0,this._connectionClient=void 0,this.chainRpcProviders=to.chainRpcProviders,this.connectionConfig=to.connectionConfig,(ro=this.chainRpcProviders)===null||ro===void 0||ro.registerSolanaProviders(this.connectionConfig),this.__turnkeyClient=this.getTurnkeyClient()}getRpcUrl(){var eo;const[to]=this.solNetworks;if(!to)throw new DynamicError("No enabled networks");return((eo=to.privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])||to.rpcUrls[0]}getConnection(eo){if(!this._connectionClient){const to=this.getRpcUrl();if(!to)throw new DynamicError("No rpcUrl");const ro=typeof eo=="string"?Object.assign(Object.assign({},this.connectionConfig),{commitment:eo}):Object.assign(Object.assign({},this.connectionConfig),eo);this._connectionClient=createSolanaConnection(to,ro)}return this._connectionClient}getWalletClient(){return this.getConnection()}getNetwork(){return __awaiter$3(this,void 0,void 0,function*(){const eo=this.getConnection();let to=localStorage.getItem(getGenesisHashLSKey(eo.rpcEndpoint));return to||(to=yield eo.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey(eo.rpcEndpoint),to)),to=to.substring(0,32),to==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?"mainnet":to==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?"devnet":"testnet"})}getPublicClient(){return __awaiter$3(this,void 0,void 0,function*(){var eo;if(this.solNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const ro=this.chainRpcProviders.getProviders(to);return(eo=this.chainRpcProviders.getSolanaProviderByChainId(ro,"101"))===null||eo===void 0?void 0:eo.provider})}supportsNetworkSwitching(){return!1}setVerifiedCredentials(eo){const to=findTurnkeyVerifiedCredentials(eo,ProviderChain.SOLANA),[ro]=to;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(to)&&(this.verifiedCredential=ro,this.verifiedCredentials=to,this.refreshTurnkeyAccount())}validateActiveWallet(eo){return __awaiter$3(this,void 0,void 0,function*(){var to,ro;const no=((to=this.verifiedCredential)===null||to===void 0?void 0:to.address)||"";if(!isSameAddress(no,eo,this.connectedChain)){const oo=(ro=this.verifiedCredentials)===null||ro===void 0?void 0:ro.find(ao=>(ao==null?void 0:ao.address)===eo);if(!oo)throw new DynamicError("Account not found");this.verifiedCredential=oo,this.refreshTurnkeyAccount()}})}getAccount(){return this.turnkeyAddress}endSession(){return __awaiter$3(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey(this.getRpcUrl()))})}refreshTurnkeyAccount(){return __awaiter$3(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyClient(){var eo;let to=getTLD();to||(to=PlatformService.getHostname());const ro=PasskeyService.createWebauthnStamper({rpId:to}),no=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,io=no??ro;return this.__turnkeyClient=(eo=this.getAuthenticatorHandler().client)!==null&&eo!==void 0?eo:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},io),this.__turnkeyClient}createTurnkeyAccount(eo){return __awaiter$3(this,arguments,void 0,function*({organizationId:to}){const ro=this.getTurnkeyClient();return new TurnkeySigner({client:ro,organizationId:to})})}getTurnkeyAccount(){return __awaiter$3(this,void 0,void 0,function*(){var eo,to,ro,no;if(this._turnkeyAccount&&(this.getAuthenticatorHandler().recoveryType==="passkey"&&((eo=this.__turnkeyClient)===null||eo===void 0?void 0:eo.stamper)instanceof WebauthnStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((to=this.__turnkeyClient)===null||to===void 0?void 0:to.stamper)instanceof IframeStamper)&&this.__turnkeyClient===this.getAuthenticatorHandler().client)return this._turnkeyAccount;const{turnkeySubOrganizationId:io}=(ro=this.walletProperties)!==null&&ro!==void 0?ro:{},{address:oo}=(no=this.verifiedCredential)!==null&&no!==void 0?no:{};if(!(!io||!oo))return this._turnkeyAccount=yield this.createTurnkeyAccount({organizationId:io}),this.setLoggerMetadata(),this._turnkeyAccount})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){return new TurnkeySolanaSigner({walletConnector:this})})}getBalance(eo){return __awaiter$3(this,void 0,void 0,function*(){const to=this.getConnection(),ro=new PublicKey$2(eo),no=yield to.getBalance(ro);return this.lamportsToSol(no).toString()})}signUint8ArrayMessage(eo){return __awaiter$3(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const to=this.turnkeyAddress;let ro;if(yield this.createOrRestoreSession(),yield this.walletUiUtils.signMessage({handler:()=>__awaiter$3(this,void 0,void 0,function*(){let no=yield this.getTurnkeyAccount();try{ro=yield no==null?void 0:no.signMessage(eo,to)}catch{yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),no=yield this.getTurnkeyAccount(),ro=yield no==null?void 0:no.signMessage(eo,to)}return bufferToBase64(ro||Buffer$3.from([]))}),message:new TextDecoder().decode(eo)}),!ro)throw new Error("Failed to sign message");return ro})}signMessage(eo){return __awaiter$3(this,void 0,void 0,function*(){const ro=new TextEncoder().encode(eo),no=yield this.signUint8ArrayMessage(ro);return bufferToBase64(no)})}signTransaction(eo){return __awaiter$3(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let to=yield this.getTurnkeyAccount();const ro=this.turnkeyAddress;if(!to||!ro)throw new Error("No turnkey account");try{yield to.addSignature(eo,ro)}catch(no){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(io=>no.message.includes(io)))yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),to=yield this.getTurnkeyAccount(),yield to.addSignature(eo,ro);else throw logger$6.error("[TK] failed to perform SignTransaction activity",no),no}return eo})}signAllTransactions(eo){return __awaiter$3(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let to=yield this.getTurnkeyAccount();const ro=this.turnkeyAddress;if(!to||!ro)throw new Error("No turnkey account");try{return yield to.signAllTransactions(eo,ro)}catch(no){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(io=>no.message.includes(io)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),to=yield this.getTurnkeyAccount(),yield to.signAllTransactions(eo,ro);throw logger$6.error("[TK] failed to perform SignAllTransactions activity",no),no}})}internalSignAndSendTransaction(eo,to){return __awaiter$3(this,void 0,void 0,function*(){var ro,no;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const io=this.getConnection((no=(ro=this.connectionConfig)===null||ro===void 0?void 0:ro.commitment)!==null&&no!==void 0?no:"confirmed"),oo=yield this.signTransaction(eo),ao=yield io.sendRawTransaction(oo.serialize(),to);return new Promise((so,co)=>{const lo=setTimeout(()=>{co(new DynamicError("Transaction timed out"))},6e4);io.onSignature(ao,uo=>{clearTimeout(lo),uo.err?co(new DynamicError("Transaction failed")):so(ao)},"confirmed")})})}signAndSendTransaction(eo,to){return __awaiter$3(this,void 0,void 0,function*(){var ro;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");let no=eo,io=!1;"version"in eo?io=eo.signatures.some(uo=>!uo.every(ho=>ho===0)):io=eo.signatures.some(uo=>uo.signature);try{(yield this.getNetwork())==="mainnet"&&!io&&(no=yield optimizeSolanaTransaction(this.getEnvId(),eo,(ro=this.turnkeyAddress)!==null&&ro!==void 0?ro:""))}catch(uo){logger$6.warn("Failed to optimize transaction",uo)}const oo=yield decodeTransaction(no,this.getConnection(),this.turnkeyAddress);if(!(oo!=null&&oo.length))throw new DynamicError("Incorrectly formatted transaction instructions");let ao,so=!1;try{ao=yield getTotalSolanaSpend(no,this.getConnection(),this.turnkeyAddress)}catch(uo){uo.message==="Insufficient funds"&&(so=!0)}const co=summarizeTransactionDecodedData(oo),lo=new SolanaUiTransaction({connection:this.getConnection(),from:this.turnkeyAddress,onSubmit:()=>__awaiter$3(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(no,to)}),originalTransaction:no});return lo.to=co,lo.value=ao,so&&(lo.notEnoughFundsError=!0),this.walletUiUtils.sendTransaction(this,lo)})}sendTransaction(eo,to){return __awaiter$3(this,arguments,void 0,function*(ro,no,io={}){var oo;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");if(!ro||!no)throw new DynamicError("Transaction and connection are required");const{signers:ao}=io,so=__rest$1(io,["signers"]),co=yield no.getLatestBlockhash({commitment:io.preflightCommitment,minContextSlot:io.minContextSlot});"version"in ro?ao!=null&&ao.length&&ro.sign(ao):(ro.feePayer=ro.feePayer||new PublicKey$2(this.turnkeyAddress),ro.recentBlockhash=ro.recentBlockhash||co.blockhash,ao!=null&&ao.length&&ro.partialSign(...ao)),so.preflightCommitment=so.preflightCommitment||no.commitment;const lo=yield no.sendRawTransaction(ro.serialize(),io),uo={blockhash:co.blockhash,lastValidBlockHeight:co.lastValidBlockHeight,signature:lo},ho=yield no==null?void 0:no.confirmTransaction(uo);return!((oo=ho==null?void 0:ho.value)===null||oo===void 0)&&oo.err?JSON.stringify(ho.value.err):lo})}lamportsToSol(eo){return eo/LAMPORTS_PER_SOL$2}createUiTransaction(eo){return __awaiter$3(this,void 0,void 0,function*(){yield this.validateActiveWallet(eo);const to=new SolanaUiTransaction({connection:this.getConnection(),from:eo,onSubmit:ro=>__awaiter$3(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(ro)})});return to.feeDeducted=!0,to})}}const TurnkeySolanaWalletConnectors=Xr=>{var eo;return!((eo=Xr.apiProviders)===null||eo===void 0)&&eo.turnkey?[TurnkeySolanaWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-solana",version$6);var naclFast={exports:{}};(function(Xr){(function(eo){var to=function(xl){var $l,Cl=new Float64Array(16);if(xl)for($l=0;$l>24&255,xl[$l+1]=Cl>>16&255,xl[$l+2]=Cl>>8&255,xl[$l+3]=Cl&255,xl[$l+4]=Zo>>24&255,xl[$l+5]=Zo>>16&255,xl[$l+6]=Zo>>8&255,xl[$l+7]=Zo&255}function wo(xl,$l,Cl,Zo,Rl){var Hl,au=0;for(Hl=0;Hl>>8)-1}function Eo(xl,$l,Cl,Zo){return wo(xl,$l,Cl,Zo,16)}function $o(xl,$l,Cl,Zo){return wo(xl,$l,Cl,Zo,32)}function Co(xl,$l,Cl,Zo){for(var Rl=Zo[0]&255|(Zo[1]&255)<<8|(Zo[2]&255)<<16|(Zo[3]&255)<<24,Hl=Cl[0]&255|(Cl[1]&255)<<8|(Cl[2]&255)<<16|(Cl[3]&255)<<24,au=Cl[4]&255|(Cl[5]&255)<<8|(Cl[6]&255)<<16|(Cl[7]&255)<<24,tu=Cl[8]&255|(Cl[9]&255)<<8|(Cl[10]&255)<<16|(Cl[11]&255)<<24,lu=Cl[12]&255|(Cl[13]&255)<<8|(Cl[14]&255)<<16|(Cl[15]&255)<<24,Nu=Zo[4]&255|(Zo[5]&255)<<8|(Zo[6]&255)<<16|(Zo[7]&255)<<24,Pu=$l[0]&255|($l[1]&255)<<8|($l[2]&255)<<16|($l[3]&255)<<24,ip=$l[4]&255|($l[5]&255)<<8|($l[6]&255)<<16|($l[7]&255)<<24,Lu=$l[8]&255|($l[9]&255)<<8|($l[10]&255)<<16|($l[11]&255)<<24,Yu=$l[12]&255|($l[13]&255)<<8|($l[14]&255)<<16|($l[15]&255)<<24,_d=Zo[8]&255|(Zo[9]&255)<<8|(Zo[10]&255)<<16|(Zo[11]&255)<<24,Qu=Cl[16]&255|(Cl[17]&255)<<8|(Cl[18]&255)<<16|(Cl[19]&255)<<24,_f=Cl[20]&255|(Cl[21]&255)<<8|(Cl[22]&255)<<16|(Cl[23]&255)<<24,ep=Cl[24]&255|(Cl[25]&255)<<8|(Cl[26]&255)<<16|(Cl[27]&255)<<24,Xu=Cl[28]&255|(Cl[29]&255)<<8|(Cl[30]&255)<<16|(Cl[31]&255)<<24,_h=Zo[12]&255|(Zo[13]&255)<<8|(Zo[14]&255)<<16|(Zo[15]&255)<<24,zu=Rl,Vu=Hl,Fu=au,Tu=tu,Ru=lu,Ou=Nu,_u=Pu,$u=ip,Uu=Lu,ju=Yu,Bu=_d,Hu=Qu,fp=_f,wp=ep,xp=Xu,gp=_h,fu,Cp=0;Cp<20;Cp+=2)fu=zu+fp|0,Ru^=fu<<7|fu>>>25,fu=Ru+zu|0,Uu^=fu<<9|fu>>>23,fu=Uu+Ru|0,fp^=fu<<13|fu>>>19,fu=fp+Uu|0,zu^=fu<<18|fu>>>14,fu=Ou+Vu|0,ju^=fu<<7|fu>>>25,fu=ju+Ou|0,wp^=fu<<9|fu>>>23,fu=wp+ju|0,Vu^=fu<<13|fu>>>19,fu=Vu+wp|0,Ou^=fu<<18|fu>>>14,fu=Bu+_u|0,xp^=fu<<7|fu>>>25,fu=xp+Bu|0,Fu^=fu<<9|fu>>>23,fu=Fu+xp|0,_u^=fu<<13|fu>>>19,fu=_u+Fu|0,Bu^=fu<<18|fu>>>14,fu=gp+Hu|0,Tu^=fu<<7|fu>>>25,fu=Tu+gp|0,$u^=fu<<9|fu>>>23,fu=$u+Tu|0,Hu^=fu<<13|fu>>>19,fu=Hu+$u|0,gp^=fu<<18|fu>>>14,fu=zu+Tu|0,Vu^=fu<<7|fu>>>25,fu=Vu+zu|0,Fu^=fu<<9|fu>>>23,fu=Fu+Vu|0,Tu^=fu<<13|fu>>>19,fu=Tu+Fu|0,zu^=fu<<18|fu>>>14,fu=Ou+Ru|0,_u^=fu<<7|fu>>>25,fu=_u+Ou|0,$u^=fu<<9|fu>>>23,fu=$u+_u|0,Ru^=fu<<13|fu>>>19,fu=Ru+$u|0,Ou^=fu<<18|fu>>>14,fu=Bu+ju|0,Hu^=fu<<7|fu>>>25,fu=Hu+Bu|0,Uu^=fu<<9|fu>>>23,fu=Uu+Hu|0,ju^=fu<<13|fu>>>19,fu=ju+Uu|0,Bu^=fu<<18|fu>>>14,fu=gp+xp|0,fp^=fu<<7|fu>>>25,fu=fp+gp|0,wp^=fu<<9|fu>>>23,fu=wp+fp|0,xp^=fu<<13|fu>>>19,fu=xp+wp|0,gp^=fu<<18|fu>>>14;zu=zu+Rl|0,Vu=Vu+Hl|0,Fu=Fu+au|0,Tu=Tu+tu|0,Ru=Ru+lu|0,Ou=Ou+Nu|0,_u=_u+Pu|0,$u=$u+ip|0,Uu=Uu+Lu|0,ju=ju+Yu|0,Bu=Bu+_d|0,Hu=Hu+Qu|0,fp=fp+_f|0,wp=wp+ep|0,xp=xp+Xu|0,gp=gp+_h|0,xl[0]=zu>>>0&255,xl[1]=zu>>>8&255,xl[2]=zu>>>16&255,xl[3]=zu>>>24&255,xl[4]=Vu>>>0&255,xl[5]=Vu>>>8&255,xl[6]=Vu>>>16&255,xl[7]=Vu>>>24&255,xl[8]=Fu>>>0&255,xl[9]=Fu>>>8&255,xl[10]=Fu>>>16&255,xl[11]=Fu>>>24&255,xl[12]=Tu>>>0&255,xl[13]=Tu>>>8&255,xl[14]=Tu>>>16&255,xl[15]=Tu>>>24&255,xl[16]=Ru>>>0&255,xl[17]=Ru>>>8&255,xl[18]=Ru>>>16&255,xl[19]=Ru>>>24&255,xl[20]=Ou>>>0&255,xl[21]=Ou>>>8&255,xl[22]=Ou>>>16&255,xl[23]=Ou>>>24&255,xl[24]=_u>>>0&255,xl[25]=_u>>>8&255,xl[26]=_u>>>16&255,xl[27]=_u>>>24&255,xl[28]=$u>>>0&255,xl[29]=$u>>>8&255,xl[30]=$u>>>16&255,xl[31]=$u>>>24&255,xl[32]=Uu>>>0&255,xl[33]=Uu>>>8&255,xl[34]=Uu>>>16&255,xl[35]=Uu>>>24&255,xl[36]=ju>>>0&255,xl[37]=ju>>>8&255,xl[38]=ju>>>16&255,xl[39]=ju>>>24&255,xl[40]=Bu>>>0&255,xl[41]=Bu>>>8&255,xl[42]=Bu>>>16&255,xl[43]=Bu>>>24&255,xl[44]=Hu>>>0&255,xl[45]=Hu>>>8&255,xl[46]=Hu>>>16&255,xl[47]=Hu>>>24&255,xl[48]=fp>>>0&255,xl[49]=fp>>>8&255,xl[50]=fp>>>16&255,xl[51]=fp>>>24&255,xl[52]=wp>>>0&255,xl[53]=wp>>>8&255,xl[54]=wp>>>16&255,xl[55]=wp>>>24&255,xl[56]=xp>>>0&255,xl[57]=xp>>>8&255,xl[58]=xp>>>16&255,xl[59]=xp>>>24&255,xl[60]=gp>>>0&255,xl[61]=gp>>>8&255,xl[62]=gp>>>16&255,xl[63]=gp>>>24&255}function Ro(xl,$l,Cl,Zo){for(var Rl=Zo[0]&255|(Zo[1]&255)<<8|(Zo[2]&255)<<16|(Zo[3]&255)<<24,Hl=Cl[0]&255|(Cl[1]&255)<<8|(Cl[2]&255)<<16|(Cl[3]&255)<<24,au=Cl[4]&255|(Cl[5]&255)<<8|(Cl[6]&255)<<16|(Cl[7]&255)<<24,tu=Cl[8]&255|(Cl[9]&255)<<8|(Cl[10]&255)<<16|(Cl[11]&255)<<24,lu=Cl[12]&255|(Cl[13]&255)<<8|(Cl[14]&255)<<16|(Cl[15]&255)<<24,Nu=Zo[4]&255|(Zo[5]&255)<<8|(Zo[6]&255)<<16|(Zo[7]&255)<<24,Pu=$l[0]&255|($l[1]&255)<<8|($l[2]&255)<<16|($l[3]&255)<<24,ip=$l[4]&255|($l[5]&255)<<8|($l[6]&255)<<16|($l[7]&255)<<24,Lu=$l[8]&255|($l[9]&255)<<8|($l[10]&255)<<16|($l[11]&255)<<24,Yu=$l[12]&255|($l[13]&255)<<8|($l[14]&255)<<16|($l[15]&255)<<24,_d=Zo[8]&255|(Zo[9]&255)<<8|(Zo[10]&255)<<16|(Zo[11]&255)<<24,Qu=Cl[16]&255|(Cl[17]&255)<<8|(Cl[18]&255)<<16|(Cl[19]&255)<<24,_f=Cl[20]&255|(Cl[21]&255)<<8|(Cl[22]&255)<<16|(Cl[23]&255)<<24,ep=Cl[24]&255|(Cl[25]&255)<<8|(Cl[26]&255)<<16|(Cl[27]&255)<<24,Xu=Cl[28]&255|(Cl[29]&255)<<8|(Cl[30]&255)<<16|(Cl[31]&255)<<24,_h=Zo[12]&255|(Zo[13]&255)<<8|(Zo[14]&255)<<16|(Zo[15]&255)<<24,zu=Rl,Vu=Hl,Fu=au,Tu=tu,Ru=lu,Ou=Nu,_u=Pu,$u=ip,Uu=Lu,ju=Yu,Bu=_d,Hu=Qu,fp=_f,wp=ep,xp=Xu,gp=_h,fu,Cp=0;Cp<20;Cp+=2)fu=zu+fp|0,Ru^=fu<<7|fu>>>25,fu=Ru+zu|0,Uu^=fu<<9|fu>>>23,fu=Uu+Ru|0,fp^=fu<<13|fu>>>19,fu=fp+Uu|0,zu^=fu<<18|fu>>>14,fu=Ou+Vu|0,ju^=fu<<7|fu>>>25,fu=ju+Ou|0,wp^=fu<<9|fu>>>23,fu=wp+ju|0,Vu^=fu<<13|fu>>>19,fu=Vu+wp|0,Ou^=fu<<18|fu>>>14,fu=Bu+_u|0,xp^=fu<<7|fu>>>25,fu=xp+Bu|0,Fu^=fu<<9|fu>>>23,fu=Fu+xp|0,_u^=fu<<13|fu>>>19,fu=_u+Fu|0,Bu^=fu<<18|fu>>>14,fu=gp+Hu|0,Tu^=fu<<7|fu>>>25,fu=Tu+gp|0,$u^=fu<<9|fu>>>23,fu=$u+Tu|0,Hu^=fu<<13|fu>>>19,fu=Hu+$u|0,gp^=fu<<18|fu>>>14,fu=zu+Tu|0,Vu^=fu<<7|fu>>>25,fu=Vu+zu|0,Fu^=fu<<9|fu>>>23,fu=Fu+Vu|0,Tu^=fu<<13|fu>>>19,fu=Tu+Fu|0,zu^=fu<<18|fu>>>14,fu=Ou+Ru|0,_u^=fu<<7|fu>>>25,fu=_u+Ou|0,$u^=fu<<9|fu>>>23,fu=$u+_u|0,Ru^=fu<<13|fu>>>19,fu=Ru+$u|0,Ou^=fu<<18|fu>>>14,fu=Bu+ju|0,Hu^=fu<<7|fu>>>25,fu=Hu+Bu|0,Uu^=fu<<9|fu>>>23,fu=Uu+Hu|0,ju^=fu<<13|fu>>>19,fu=ju+Uu|0,Bu^=fu<<18|fu>>>14,fu=gp+xp|0,fp^=fu<<7|fu>>>25,fu=fp+gp|0,wp^=fu<<9|fu>>>23,fu=wp+fp|0,xp^=fu<<13|fu>>>19,fu=xp+wp|0,gp^=fu<<18|fu>>>14;xl[0]=zu>>>0&255,xl[1]=zu>>>8&255,xl[2]=zu>>>16&255,xl[3]=zu>>>24&255,xl[4]=Ou>>>0&255,xl[5]=Ou>>>8&255,xl[6]=Ou>>>16&255,xl[7]=Ou>>>24&255,xl[8]=Bu>>>0&255,xl[9]=Bu>>>8&255,xl[10]=Bu>>>16&255,xl[11]=Bu>>>24&255,xl[12]=gp>>>0&255,xl[13]=gp>>>8&255,xl[14]=gp>>>16&255,xl[15]=gp>>>24&255,xl[16]=_u>>>0&255,xl[17]=_u>>>8&255,xl[18]=_u>>>16&255,xl[19]=_u>>>24&255,xl[20]=$u>>>0&255,xl[21]=$u>>>8&255,xl[22]=$u>>>16&255,xl[23]=$u>>>24&255,xl[24]=Uu>>>0&255,xl[25]=Uu>>>8&255,xl[26]=Uu>>>16&255,xl[27]=Uu>>>24&255,xl[28]=ju>>>0&255,xl[29]=ju>>>8&255,xl[30]=ju>>>16&255,xl[31]=ju>>>24&255}function Oo(xl,$l,Cl,Zo){Co(xl,$l,Cl,Zo)}function jo(xl,$l,Cl,Zo){Ro(xl,$l,Cl,Zo)}var Bo=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Mo(xl,$l,Cl,Zo,Rl,Hl,au){var tu=new Uint8Array(16),lu=new Uint8Array(64),Nu,Pu;for(Pu=0;Pu<16;Pu++)tu[Pu]=0;for(Pu=0;Pu<8;Pu++)tu[Pu]=Hl[Pu];for(;Rl>=64;){for(Oo(lu,tu,au,Bo),Pu=0;Pu<64;Pu++)xl[$l+Pu]=Cl[Zo+Pu]^lu[Pu];for(Nu=1,Pu=8;Pu<16;Pu++)Nu=Nu+(tu[Pu]&255)|0,tu[Pu]=Nu&255,Nu>>>=8;Rl-=64,$l+=64,Zo+=64}if(Rl>0)for(Oo(lu,tu,au,Bo),Pu=0;Pu=64;){for(Oo(au,Hl,Rl,Bo),lu=0;lu<64;lu++)xl[$l+lu]=au[lu];for(tu=1,lu=8;lu<16;lu++)tu=tu+(Hl[lu]&255)|0,Hl[lu]=tu&255,tu>>>=8;Cl-=64,$l+=64}if(Cl>0)for(Oo(au,Hl,Rl,Bo),lu=0;lu>>13|Cl<<3)&8191,Zo=xl[4]&255|(xl[5]&255)<<8,this.r[2]=(Cl>>>10|Zo<<6)&7939,Rl=xl[6]&255|(xl[7]&255)<<8,this.r[3]=(Zo>>>7|Rl<<9)&8191,Hl=xl[8]&255|(xl[9]&255)<<8,this.r[4]=(Rl>>>4|Hl<<12)&255,this.r[5]=Hl>>>1&8190,au=xl[10]&255|(xl[11]&255)<<8,this.r[6]=(Hl>>>14|au<<2)&8191,tu=xl[12]&255|(xl[13]&255)<<8,this.r[7]=(au>>>11|tu<<5)&8065,lu=xl[14]&255|(xl[15]&255)<<8,this.r[8]=(tu>>>8|lu<<8)&8191,this.r[9]=lu>>>5&127,this.pad[0]=xl[16]&255|(xl[17]&255)<<8,this.pad[1]=xl[18]&255|(xl[19]&255)<<8,this.pad[2]=xl[20]&255|(xl[21]&255)<<8,this.pad[3]=xl[22]&255|(xl[23]&255)<<8,this.pad[4]=xl[24]&255|(xl[25]&255)<<8,this.pad[5]=xl[26]&255|(xl[27]&255)<<8,this.pad[6]=xl[28]&255|(xl[29]&255)<<8,this.pad[7]=xl[30]&255|(xl[31]&255)<<8};Po.prototype.blocks=function(xl,$l,Cl){for(var Zo=this.fin?0:2048,Rl,Hl,au,tu,lu,Nu,Pu,ip,Lu,Yu,_d,Qu,_f,ep,Xu,_h,zu,Vu,Fu,Tu=this.h[0],Ru=this.h[1],Ou=this.h[2],_u=this.h[3],$u=this.h[4],Uu=this.h[5],ju=this.h[6],Bu=this.h[7],Hu=this.h[8],fp=this.h[9],wp=this.r[0],xp=this.r[1],gp=this.r[2],fu=this.r[3],Cp=this.r[4],Rp=this.r[5],Np=this.r[6],_p=this.r[7],Tp=this.r[8],Ap=this.r[9];Cl>=16;)Rl=xl[$l+0]&255|(xl[$l+1]&255)<<8,Tu+=Rl&8191,Hl=xl[$l+2]&255|(xl[$l+3]&255)<<8,Ru+=(Rl>>>13|Hl<<3)&8191,au=xl[$l+4]&255|(xl[$l+5]&255)<<8,Ou+=(Hl>>>10|au<<6)&8191,tu=xl[$l+6]&255|(xl[$l+7]&255)<<8,_u+=(au>>>7|tu<<9)&8191,lu=xl[$l+8]&255|(xl[$l+9]&255)<<8,$u+=(tu>>>4|lu<<12)&8191,Uu+=lu>>>1&8191,Nu=xl[$l+10]&255|(xl[$l+11]&255)<<8,ju+=(lu>>>14|Nu<<2)&8191,Pu=xl[$l+12]&255|(xl[$l+13]&255)<<8,Bu+=(Nu>>>11|Pu<<5)&8191,ip=xl[$l+14]&255|(xl[$l+15]&255)<<8,Hu+=(Pu>>>8|ip<<8)&8191,fp+=ip>>>5|Zo,Lu=0,Yu=Lu,Yu+=Tu*wp,Yu+=Ru*(5*Ap),Yu+=Ou*(5*Tp),Yu+=_u*(5*_p),Yu+=$u*(5*Np),Lu=Yu>>>13,Yu&=8191,Yu+=Uu*(5*Rp),Yu+=ju*(5*Cp),Yu+=Bu*(5*fu),Yu+=Hu*(5*gp),Yu+=fp*(5*xp),Lu+=Yu>>>13,Yu&=8191,_d=Lu,_d+=Tu*xp,_d+=Ru*wp,_d+=Ou*(5*Ap),_d+=_u*(5*Tp),_d+=$u*(5*_p),Lu=_d>>>13,_d&=8191,_d+=Uu*(5*Np),_d+=ju*(5*Rp),_d+=Bu*(5*Cp),_d+=Hu*(5*fu),_d+=fp*(5*gp),Lu+=_d>>>13,_d&=8191,Qu=Lu,Qu+=Tu*gp,Qu+=Ru*xp,Qu+=Ou*wp,Qu+=_u*(5*Ap),Qu+=$u*(5*Tp),Lu=Qu>>>13,Qu&=8191,Qu+=Uu*(5*_p),Qu+=ju*(5*Np),Qu+=Bu*(5*Rp),Qu+=Hu*(5*Cp),Qu+=fp*(5*fu),Lu+=Qu>>>13,Qu&=8191,_f=Lu,_f+=Tu*fu,_f+=Ru*gp,_f+=Ou*xp,_f+=_u*wp,_f+=$u*(5*Ap),Lu=_f>>>13,_f&=8191,_f+=Uu*(5*Tp),_f+=ju*(5*_p),_f+=Bu*(5*Np),_f+=Hu*(5*Rp),_f+=fp*(5*Cp),Lu+=_f>>>13,_f&=8191,ep=Lu,ep+=Tu*Cp,ep+=Ru*fu,ep+=Ou*gp,ep+=_u*xp,ep+=$u*wp,Lu=ep>>>13,ep&=8191,ep+=Uu*(5*Ap),ep+=ju*(5*Tp),ep+=Bu*(5*_p),ep+=Hu*(5*Np),ep+=fp*(5*Rp),Lu+=ep>>>13,ep&=8191,Xu=Lu,Xu+=Tu*Rp,Xu+=Ru*Cp,Xu+=Ou*fu,Xu+=_u*gp,Xu+=$u*xp,Lu=Xu>>>13,Xu&=8191,Xu+=Uu*wp,Xu+=ju*(5*Ap),Xu+=Bu*(5*Tp),Xu+=Hu*(5*_p),Xu+=fp*(5*Np),Lu+=Xu>>>13,Xu&=8191,_h=Lu,_h+=Tu*Np,_h+=Ru*Rp,_h+=Ou*Cp,_h+=_u*fu,_h+=$u*gp,Lu=_h>>>13,_h&=8191,_h+=Uu*xp,_h+=ju*wp,_h+=Bu*(5*Ap),_h+=Hu*(5*Tp),_h+=fp*(5*_p),Lu+=_h>>>13,_h&=8191,zu=Lu,zu+=Tu*_p,zu+=Ru*Np,zu+=Ou*Rp,zu+=_u*Cp,zu+=$u*fu,Lu=zu>>>13,zu&=8191,zu+=Uu*gp,zu+=ju*xp,zu+=Bu*wp,zu+=Hu*(5*Ap),zu+=fp*(5*Tp),Lu+=zu>>>13,zu&=8191,Vu=Lu,Vu+=Tu*Tp,Vu+=Ru*_p,Vu+=Ou*Np,Vu+=_u*Rp,Vu+=$u*Cp,Lu=Vu>>>13,Vu&=8191,Vu+=Uu*fu,Vu+=ju*gp,Vu+=Bu*xp,Vu+=Hu*wp,Vu+=fp*(5*Ap),Lu+=Vu>>>13,Vu&=8191,Fu=Lu,Fu+=Tu*Ap,Fu+=Ru*Tp,Fu+=Ou*_p,Fu+=_u*Np,Fu+=$u*Rp,Lu=Fu>>>13,Fu&=8191,Fu+=Uu*Cp,Fu+=ju*fu,Fu+=Bu*gp,Fu+=Hu*xp,Fu+=fp*wp,Lu+=Fu>>>13,Fu&=8191,Lu=(Lu<<2)+Lu|0,Lu=Lu+Yu|0,Yu=Lu&8191,Lu=Lu>>>13,_d+=Lu,Tu=Yu,Ru=_d,Ou=Qu,_u=_f,$u=ep,Uu=Xu,ju=_h,Bu=zu,Hu=Vu,fp=Fu,$l+=16,Cl-=16;this.h[0]=Tu,this.h[1]=Ru,this.h[2]=Ou,this.h[3]=_u,this.h[4]=$u,this.h[5]=Uu,this.h[6]=ju,this.h[7]=Bu,this.h[8]=Hu,this.h[9]=fp},Po.prototype.finish=function(xl,$l){var Cl=new Uint16Array(10),Zo,Rl,Hl,au;if(this.leftover){for(au=this.leftover,this.buffer[au++]=1;au<16;au++)this.buffer[au]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(Zo=this.h[1]>>>13,this.h[1]&=8191,au=2;au<10;au++)this.h[au]+=Zo,Zo=this.h[au]>>>13,this.h[au]&=8191;for(this.h[0]+=Zo*5,Zo=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=Zo,Zo=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=Zo,Cl[0]=this.h[0]+5,Zo=Cl[0]>>>13,Cl[0]&=8191,au=1;au<10;au++)Cl[au]=this.h[au]+Zo,Zo=Cl[au]>>>13,Cl[au]&=8191;for(Cl[9]-=8192,Rl=(Zo^1)-1,au=0;au<10;au++)Cl[au]&=Rl;for(Rl=~Rl,au=0;au<10;au++)this.h[au]=this.h[au]&Rl|Cl[au];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Hl=this.h[0]+this.pad[0],this.h[0]=Hl&65535,au=1;au<8;au++)Hl=(this.h[au]+this.pad[au]|0)+(Hl>>>16)|0,this.h[au]=Hl&65535;xl[$l+0]=this.h[0]>>>0&255,xl[$l+1]=this.h[0]>>>8&255,xl[$l+2]=this.h[1]>>>0&255,xl[$l+3]=this.h[1]>>>8&255,xl[$l+4]=this.h[2]>>>0&255,xl[$l+5]=this.h[2]>>>8&255,xl[$l+6]=this.h[3]>>>0&255,xl[$l+7]=this.h[3]>>>8&255,xl[$l+8]=this.h[4]>>>0&255,xl[$l+9]=this.h[4]>>>8&255,xl[$l+10]=this.h[5]>>>0&255,xl[$l+11]=this.h[5]>>>8&255,xl[$l+12]=this.h[6]>>>0&255,xl[$l+13]=this.h[6]>>>8&255,xl[$l+14]=this.h[7]>>>0&255,xl[$l+15]=this.h[7]>>>8&255},Po.prototype.update=function(xl,$l,Cl){var Zo,Rl;if(this.leftover){for(Rl=16-this.leftover,Rl>Cl&&(Rl=Cl),Zo=0;Zo=16&&(Rl=Cl-Cl%16,this.blocks(xl,$l,Rl),$l+=Rl,Cl-=Rl),Cl){for(Zo=0;Zo>16&1),Hl[Cl-1]&=65535;Hl[15]=au[15]-32767-(Hl[14]>>16&1),Rl=Hl[15]>>16&1,Hl[14]&=65535,Ao(au,Hl,1-Rl)}for(Cl=0;Cl<16;Cl++)xl[2*Cl]=au[Cl]&255,xl[2*Cl+1]=au[Cl]>>8}function mo(xl,$l){var Cl=new Uint8Array(32),Zo=new Uint8Array(32);return ko(Cl,xl),ko(Zo,$l),$o(Cl,0,Zo,0)}function Io(xl){var $l=new Uint8Array(32);return ko($l,xl),$l[0]&1}function Do(xl,$l){var Cl;for(Cl=0;Cl<16;Cl++)xl[Cl]=$l[2*Cl]+($l[2*Cl+1]<<8);xl[15]&=32767}function Lo(xl,$l,Cl){for(var Zo=0;Zo<16;Zo++)xl[Zo]=$l[Zo]+Cl[Zo]}function Ho(xl,$l,Cl){for(var Zo=0;Zo<16;Zo++)xl[Zo]=$l[Zo]-Cl[Zo]}function Yo(xl,$l,Cl){var Zo,Rl,Hl=0,au=0,tu=0,lu=0,Nu=0,Pu=0,ip=0,Lu=0,Yu=0,_d=0,Qu=0,_f=0,ep=0,Xu=0,_h=0,zu=0,Vu=0,Fu=0,Tu=0,Ru=0,Ou=0,_u=0,$u=0,Uu=0,ju=0,Bu=0,Hu=0,fp=0,wp=0,xp=0,gp=0,fu=Cl[0],Cp=Cl[1],Rp=Cl[2],Np=Cl[3],_p=Cl[4],Tp=Cl[5],Ap=Cl[6],Kp=Cl[7],Sp=Cl[8],Ep=Cl[9],qp=Cl[10],Gp=Cl[11],Hp=Cl[12],Dp=Cl[13],lm=Cl[14],rm=Cl[15];Zo=$l[0],Hl+=Zo*fu,au+=Zo*Cp,tu+=Zo*Rp,lu+=Zo*Np,Nu+=Zo*_p,Pu+=Zo*Tp,ip+=Zo*Ap,Lu+=Zo*Kp,Yu+=Zo*Sp,_d+=Zo*Ep,Qu+=Zo*qp,_f+=Zo*Gp,ep+=Zo*Hp,Xu+=Zo*Dp,_h+=Zo*lm,zu+=Zo*rm,Zo=$l[1],au+=Zo*fu,tu+=Zo*Cp,lu+=Zo*Rp,Nu+=Zo*Np,Pu+=Zo*_p,ip+=Zo*Tp,Lu+=Zo*Ap,Yu+=Zo*Kp,_d+=Zo*Sp,Qu+=Zo*Ep,_f+=Zo*qp,ep+=Zo*Gp,Xu+=Zo*Hp,_h+=Zo*Dp,zu+=Zo*lm,Vu+=Zo*rm,Zo=$l[2],tu+=Zo*fu,lu+=Zo*Cp,Nu+=Zo*Rp,Pu+=Zo*Np,ip+=Zo*_p,Lu+=Zo*Tp,Yu+=Zo*Ap,_d+=Zo*Kp,Qu+=Zo*Sp,_f+=Zo*Ep,ep+=Zo*qp,Xu+=Zo*Gp,_h+=Zo*Hp,zu+=Zo*Dp,Vu+=Zo*lm,Fu+=Zo*rm,Zo=$l[3],lu+=Zo*fu,Nu+=Zo*Cp,Pu+=Zo*Rp,ip+=Zo*Np,Lu+=Zo*_p,Yu+=Zo*Tp,_d+=Zo*Ap,Qu+=Zo*Kp,_f+=Zo*Sp,ep+=Zo*Ep,Xu+=Zo*qp,_h+=Zo*Gp,zu+=Zo*Hp,Vu+=Zo*Dp,Fu+=Zo*lm,Tu+=Zo*rm,Zo=$l[4],Nu+=Zo*fu,Pu+=Zo*Cp,ip+=Zo*Rp,Lu+=Zo*Np,Yu+=Zo*_p,_d+=Zo*Tp,Qu+=Zo*Ap,_f+=Zo*Kp,ep+=Zo*Sp,Xu+=Zo*Ep,_h+=Zo*qp,zu+=Zo*Gp,Vu+=Zo*Hp,Fu+=Zo*Dp,Tu+=Zo*lm,Ru+=Zo*rm,Zo=$l[5],Pu+=Zo*fu,ip+=Zo*Cp,Lu+=Zo*Rp,Yu+=Zo*Np,_d+=Zo*_p,Qu+=Zo*Tp,_f+=Zo*Ap,ep+=Zo*Kp,Xu+=Zo*Sp,_h+=Zo*Ep,zu+=Zo*qp,Vu+=Zo*Gp,Fu+=Zo*Hp,Tu+=Zo*Dp,Ru+=Zo*lm,Ou+=Zo*rm,Zo=$l[6],ip+=Zo*fu,Lu+=Zo*Cp,Yu+=Zo*Rp,_d+=Zo*Np,Qu+=Zo*_p,_f+=Zo*Tp,ep+=Zo*Ap,Xu+=Zo*Kp,_h+=Zo*Sp,zu+=Zo*Ep,Vu+=Zo*qp,Fu+=Zo*Gp,Tu+=Zo*Hp,Ru+=Zo*Dp,Ou+=Zo*lm,_u+=Zo*rm,Zo=$l[7],Lu+=Zo*fu,Yu+=Zo*Cp,_d+=Zo*Rp,Qu+=Zo*Np,_f+=Zo*_p,ep+=Zo*Tp,Xu+=Zo*Ap,_h+=Zo*Kp,zu+=Zo*Sp,Vu+=Zo*Ep,Fu+=Zo*qp,Tu+=Zo*Gp,Ru+=Zo*Hp,Ou+=Zo*Dp,_u+=Zo*lm,$u+=Zo*rm,Zo=$l[8],Yu+=Zo*fu,_d+=Zo*Cp,Qu+=Zo*Rp,_f+=Zo*Np,ep+=Zo*_p,Xu+=Zo*Tp,_h+=Zo*Ap,zu+=Zo*Kp,Vu+=Zo*Sp,Fu+=Zo*Ep,Tu+=Zo*qp,Ru+=Zo*Gp,Ou+=Zo*Hp,_u+=Zo*Dp,$u+=Zo*lm,Uu+=Zo*rm,Zo=$l[9],_d+=Zo*fu,Qu+=Zo*Cp,_f+=Zo*Rp,ep+=Zo*Np,Xu+=Zo*_p,_h+=Zo*Tp,zu+=Zo*Ap,Vu+=Zo*Kp,Fu+=Zo*Sp,Tu+=Zo*Ep,Ru+=Zo*qp,Ou+=Zo*Gp,_u+=Zo*Hp,$u+=Zo*Dp,Uu+=Zo*lm,ju+=Zo*rm,Zo=$l[10],Qu+=Zo*fu,_f+=Zo*Cp,ep+=Zo*Rp,Xu+=Zo*Np,_h+=Zo*_p,zu+=Zo*Tp,Vu+=Zo*Ap,Fu+=Zo*Kp,Tu+=Zo*Sp,Ru+=Zo*Ep,Ou+=Zo*qp,_u+=Zo*Gp,$u+=Zo*Hp,Uu+=Zo*Dp,ju+=Zo*lm,Bu+=Zo*rm,Zo=$l[11],_f+=Zo*fu,ep+=Zo*Cp,Xu+=Zo*Rp,_h+=Zo*Np,zu+=Zo*_p,Vu+=Zo*Tp,Fu+=Zo*Ap,Tu+=Zo*Kp,Ru+=Zo*Sp,Ou+=Zo*Ep,_u+=Zo*qp,$u+=Zo*Gp,Uu+=Zo*Hp,ju+=Zo*Dp,Bu+=Zo*lm,Hu+=Zo*rm,Zo=$l[12],ep+=Zo*fu,Xu+=Zo*Cp,_h+=Zo*Rp,zu+=Zo*Np,Vu+=Zo*_p,Fu+=Zo*Tp,Tu+=Zo*Ap,Ru+=Zo*Kp,Ou+=Zo*Sp,_u+=Zo*Ep,$u+=Zo*qp,Uu+=Zo*Gp,ju+=Zo*Hp,Bu+=Zo*Dp,Hu+=Zo*lm,fp+=Zo*rm,Zo=$l[13],Xu+=Zo*fu,_h+=Zo*Cp,zu+=Zo*Rp,Vu+=Zo*Np,Fu+=Zo*_p,Tu+=Zo*Tp,Ru+=Zo*Ap,Ou+=Zo*Kp,_u+=Zo*Sp,$u+=Zo*Ep,Uu+=Zo*qp,ju+=Zo*Gp,Bu+=Zo*Hp,Hu+=Zo*Dp,fp+=Zo*lm,wp+=Zo*rm,Zo=$l[14],_h+=Zo*fu,zu+=Zo*Cp,Vu+=Zo*Rp,Fu+=Zo*Np,Tu+=Zo*_p,Ru+=Zo*Tp,Ou+=Zo*Ap,_u+=Zo*Kp,$u+=Zo*Sp,Uu+=Zo*Ep,ju+=Zo*qp,Bu+=Zo*Gp,Hu+=Zo*Hp,fp+=Zo*Dp,wp+=Zo*lm,xp+=Zo*rm,Zo=$l[15],zu+=Zo*fu,Vu+=Zo*Cp,Fu+=Zo*Rp,Tu+=Zo*Np,Ru+=Zo*_p,Ou+=Zo*Tp,_u+=Zo*Ap,$u+=Zo*Kp,Uu+=Zo*Sp,ju+=Zo*Ep,Bu+=Zo*qp,Hu+=Zo*Gp,fp+=Zo*Hp,wp+=Zo*Dp,xp+=Zo*lm,gp+=Zo*rm,Hl+=38*Vu,au+=38*Fu,tu+=38*Tu,lu+=38*Ru,Nu+=38*Ou,Pu+=38*_u,ip+=38*$u,Lu+=38*Uu,Yu+=38*ju,_d+=38*Bu,Qu+=38*Hu,_f+=38*fp,ep+=38*wp,Xu+=38*xp,_h+=38*gp,Rl=1,Zo=Hl+Rl+65535,Rl=Math.floor(Zo/65536),Hl=Zo-Rl*65536,Zo=au+Rl+65535,Rl=Math.floor(Zo/65536),au=Zo-Rl*65536,Zo=tu+Rl+65535,Rl=Math.floor(Zo/65536),tu=Zo-Rl*65536,Zo=lu+Rl+65535,Rl=Math.floor(Zo/65536),lu=Zo-Rl*65536,Zo=Nu+Rl+65535,Rl=Math.floor(Zo/65536),Nu=Zo-Rl*65536,Zo=Pu+Rl+65535,Rl=Math.floor(Zo/65536),Pu=Zo-Rl*65536,Zo=ip+Rl+65535,Rl=Math.floor(Zo/65536),ip=Zo-Rl*65536,Zo=Lu+Rl+65535,Rl=Math.floor(Zo/65536),Lu=Zo-Rl*65536,Zo=Yu+Rl+65535,Rl=Math.floor(Zo/65536),Yu=Zo-Rl*65536,Zo=_d+Rl+65535,Rl=Math.floor(Zo/65536),_d=Zo-Rl*65536,Zo=Qu+Rl+65535,Rl=Math.floor(Zo/65536),Qu=Zo-Rl*65536,Zo=_f+Rl+65535,Rl=Math.floor(Zo/65536),_f=Zo-Rl*65536,Zo=ep+Rl+65535,Rl=Math.floor(Zo/65536),ep=Zo-Rl*65536,Zo=Xu+Rl+65535,Rl=Math.floor(Zo/65536),Xu=Zo-Rl*65536,Zo=_h+Rl+65535,Rl=Math.floor(Zo/65536),_h=Zo-Rl*65536,Zo=zu+Rl+65535,Rl=Math.floor(Zo/65536),zu=Zo-Rl*65536,Hl+=Rl-1+37*(Rl-1),Rl=1,Zo=Hl+Rl+65535,Rl=Math.floor(Zo/65536),Hl=Zo-Rl*65536,Zo=au+Rl+65535,Rl=Math.floor(Zo/65536),au=Zo-Rl*65536,Zo=tu+Rl+65535,Rl=Math.floor(Zo/65536),tu=Zo-Rl*65536,Zo=lu+Rl+65535,Rl=Math.floor(Zo/65536),lu=Zo-Rl*65536,Zo=Nu+Rl+65535,Rl=Math.floor(Zo/65536),Nu=Zo-Rl*65536,Zo=Pu+Rl+65535,Rl=Math.floor(Zo/65536),Pu=Zo-Rl*65536,Zo=ip+Rl+65535,Rl=Math.floor(Zo/65536),ip=Zo-Rl*65536,Zo=Lu+Rl+65535,Rl=Math.floor(Zo/65536),Lu=Zo-Rl*65536,Zo=Yu+Rl+65535,Rl=Math.floor(Zo/65536),Yu=Zo-Rl*65536,Zo=_d+Rl+65535,Rl=Math.floor(Zo/65536),_d=Zo-Rl*65536,Zo=Qu+Rl+65535,Rl=Math.floor(Zo/65536),Qu=Zo-Rl*65536,Zo=_f+Rl+65535,Rl=Math.floor(Zo/65536),_f=Zo-Rl*65536,Zo=ep+Rl+65535,Rl=Math.floor(Zo/65536),ep=Zo-Rl*65536,Zo=Xu+Rl+65535,Rl=Math.floor(Zo/65536),Xu=Zo-Rl*65536,Zo=_h+Rl+65535,Rl=Math.floor(Zo/65536),_h=Zo-Rl*65536,Zo=zu+Rl+65535,Rl=Math.floor(Zo/65536),zu=Zo-Rl*65536,Hl+=Rl-1+37*(Rl-1),xl[0]=Hl,xl[1]=au,xl[2]=tu,xl[3]=lu,xl[4]=Nu,xl[5]=Pu,xl[6]=ip,xl[7]=Lu,xl[8]=Yu,xl[9]=_d,xl[10]=Qu,xl[11]=_f,xl[12]=ep,xl[13]=Xu,xl[14]=_h,xl[15]=zu}function Xo(xl,$l){Yo(xl,$l,$l)}function qo(xl,$l){var Cl=to(),Zo;for(Zo=0;Zo<16;Zo++)Cl[Zo]=$l[Zo];for(Zo=253;Zo>=0;Zo--)Xo(Cl,Cl),Zo!==2&&Zo!==4&&Yo(Cl,Cl,$l);for(Zo=0;Zo<16;Zo++)xl[Zo]=Cl[Zo]}function Ko(xl,$l){var Cl=to(),Zo;for(Zo=0;Zo<16;Zo++)Cl[Zo]=$l[Zo];for(Zo=250;Zo>=0;Zo--)Xo(Cl,Cl),Zo!==1&&Yo(Cl,Cl,$l);for(Zo=0;Zo<16;Zo++)xl[Zo]=Cl[Zo]}function Qo(xl,$l,Cl){var Zo=new Uint8Array(32),Rl=new Float64Array(80),Hl,au,tu=to(),lu=to(),Nu=to(),Pu=to(),ip=to(),Lu=to();for(au=0;au<31;au++)Zo[au]=$l[au];for(Zo[31]=$l[31]&127|64,Zo[0]&=248,Do(Rl,Cl),au=0;au<16;au++)lu[au]=Rl[au],Pu[au]=tu[au]=Nu[au]=0;for(tu[0]=Pu[0]=1,au=254;au>=0;--au)Hl=Zo[au>>>3]>>>(au&7)&1,Ao(tu,lu,Hl),Ao(Nu,Pu,Hl),Lo(ip,tu,Nu),Ho(tu,tu,Nu),Lo(Nu,lu,Pu),Ho(lu,lu,Pu),Xo(Pu,ip),Xo(Lu,tu),Yo(tu,Nu,tu),Yo(Nu,lu,ip),Lo(ip,tu,Nu),Ho(tu,tu,Nu),Xo(lu,tu),Ho(Nu,Pu,Lu),Yo(tu,Nu,so),Lo(tu,tu,Pu),Yo(Nu,Nu,tu),Yo(tu,Pu,Lu),Yo(Pu,lu,Rl),Xo(lu,ip),Ao(tu,lu,Hl),Ao(Nu,Pu,Hl);for(au=0;au<16;au++)Rl[au+16]=tu[au],Rl[au+32]=Nu[au],Rl[au+48]=lu[au],Rl[au+64]=Pu[au];var Yu=Rl.subarray(32),_d=Rl.subarray(16);return qo(Yu,Yu),Yo(_d,_d,Yu),ko(xl,_d),0}function zo(xl,$l){return Qo(xl,$l,io)}function ga(xl,$l){return ro($l,32),zo(xl,$l)}function $a(xl,$l,Cl){var Zo=new Uint8Array(32);return Qo(Zo,Cl,$l),jo(xl,no,Zo,Bo)}var Sl=vo,El=_o;function Tl(xl,$l,Cl,Zo,Rl,Hl){var au=new Uint8Array(32);return $a(au,Rl,Hl),Sl(xl,$l,Cl,Zo,au)}function Il(xl,$l,Cl,Zo,Rl,Hl){var au=new Uint8Array(32);return $a(au,Rl,Hl),El(xl,$l,Cl,Zo,au)}var Zl=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Vl(xl,$l,Cl,Zo){for(var Rl=new Int32Array(16),Hl=new Int32Array(16),au,tu,lu,Nu,Pu,ip,Lu,Yu,_d,Qu,_f,ep,Xu,_h,zu,Vu,Fu,Tu,Ru,Ou,_u,$u,Uu,ju,Bu,Hu,fp=xl[0],wp=xl[1],xp=xl[2],gp=xl[3],fu=xl[4],Cp=xl[5],Rp=xl[6],Np=xl[7],_p=$l[0],Tp=$l[1],Ap=$l[2],Kp=$l[3],Sp=$l[4],Ep=$l[5],qp=$l[6],Gp=$l[7],Hp=0;Zo>=128;){for(Ru=0;Ru<16;Ru++)Ou=8*Ru+Hp,Rl[Ru]=Cl[Ou+0]<<24|Cl[Ou+1]<<16|Cl[Ou+2]<<8|Cl[Ou+3],Hl[Ru]=Cl[Ou+4]<<24|Cl[Ou+5]<<16|Cl[Ou+6]<<8|Cl[Ou+7];for(Ru=0;Ru<80;Ru++)if(au=fp,tu=wp,lu=xp,Nu=gp,Pu=fu,ip=Cp,Lu=Rp,Yu=Np,_d=_p,Qu=Tp,_f=Ap,ep=Kp,Xu=Sp,_h=Ep,zu=qp,Vu=Gp,_u=Np,$u=Gp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=(fu>>>14|Sp<<18)^(fu>>>18|Sp<<14)^(Sp>>>9|fu<<23),$u=(Sp>>>14|fu<<18)^(Sp>>>18|fu<<14)^(fu>>>9|Sp<<23),Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,_u=fu&Cp^~fu&Rp,$u=Sp&Ep^~Sp&qp,Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,_u=Zl[Ru*2],$u=Zl[Ru*2+1],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,_u=Rl[Ru%16],$u=Hl[Ru%16],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,Fu=Bu&65535|Hu<<16,Tu=Uu&65535|ju<<16,_u=Fu,$u=Tu,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=(fp>>>28|_p<<4)^(_p>>>2|fp<<30)^(_p>>>7|fp<<25),$u=(_p>>>28|fp<<4)^(fp>>>2|_p<<30)^(fp>>>7|_p<<25),Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,_u=fp&wp^fp&xp^wp&xp,$u=_p&Tp^_p&Ap^Tp&Ap,Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,Yu=Bu&65535|Hu<<16,Vu=Uu&65535|ju<<16,_u=Nu,$u=ep,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=Fu,$u=Tu,Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,Nu=Bu&65535|Hu<<16,ep=Uu&65535|ju<<16,wp=au,xp=tu,gp=lu,fu=Nu,Cp=Pu,Rp=ip,Np=Lu,fp=Yu,Tp=_d,Ap=Qu,Kp=_f,Sp=ep,Ep=Xu,qp=_h,Gp=zu,_p=Vu,Ru%16===15)for(Ou=0;Ou<16;Ou++)_u=Rl[Ou],$u=Hl[Ou],Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=Rl[(Ou+9)%16],$u=Hl[(Ou+9)%16],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,Fu=Rl[(Ou+1)%16],Tu=Hl[(Ou+1)%16],_u=(Fu>>>1|Tu<<31)^(Fu>>>8|Tu<<24)^Fu>>>7,$u=(Tu>>>1|Fu<<31)^(Tu>>>8|Fu<<24)^(Tu>>>7|Fu<<25),Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,Fu=Rl[(Ou+14)%16],Tu=Hl[(Ou+14)%16],_u=(Fu>>>19|Tu<<13)^(Tu>>>29|Fu<<3)^Fu>>>6,$u=(Tu>>>19|Fu<<13)^(Fu>>>29|Tu<<3)^(Tu>>>6|Fu<<26),Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,Rl[Ou]=Bu&65535|Hu<<16,Hl[Ou]=Uu&65535|ju<<16;_u=fp,$u=_p,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[0],$u=$l[0],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[0]=fp=Bu&65535|Hu<<16,$l[0]=_p=Uu&65535|ju<<16,_u=wp,$u=Tp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[1],$u=$l[1],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[1]=wp=Bu&65535|Hu<<16,$l[1]=Tp=Uu&65535|ju<<16,_u=xp,$u=Ap,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[2],$u=$l[2],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[2]=xp=Bu&65535|Hu<<16,$l[2]=Ap=Uu&65535|ju<<16,_u=gp,$u=Kp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[3],$u=$l[3],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[3]=gp=Bu&65535|Hu<<16,$l[3]=Kp=Uu&65535|ju<<16,_u=fu,$u=Sp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[4],$u=$l[4],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[4]=fu=Bu&65535|Hu<<16,$l[4]=Sp=Uu&65535|ju<<16,_u=Cp,$u=Ep,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[5],$u=$l[5],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[5]=Cp=Bu&65535|Hu<<16,$l[5]=Ep=Uu&65535|ju<<16,_u=Rp,$u=qp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[6],$u=$l[6],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[6]=Rp=Bu&65535|Hu<<16,$l[6]=qp=Uu&65535|ju<<16,_u=Np,$u=Gp,Uu=$u&65535,ju=$u>>>16,Bu=_u&65535,Hu=_u>>>16,_u=xl[7],$u=$l[7],Uu+=$u&65535,ju+=$u>>>16,Bu+=_u&65535,Hu+=_u>>>16,ju+=Uu>>>16,Bu+=ju>>>16,Hu+=Bu>>>16,xl[7]=Np=Bu&65535|Hu<<16,$l[7]=Gp=Uu&65535|ju<<16,Hp+=128,Zo-=128}return Zo}function Ol(xl,$l,Cl){var Zo=new Int32Array(8),Rl=new Int32Array(8),Hl=new Uint8Array(256),au,tu=Cl;for(Zo[0]=1779033703,Zo[1]=3144134277,Zo[2]=1013904242,Zo[3]=2773480762,Zo[4]=1359893119,Zo[5]=2600822924,Zo[6]=528734635,Zo[7]=1541459225,Rl[0]=4089235720,Rl[1]=2227873595,Rl[2]=4271175723,Rl[3]=1595750129,Rl[4]=2917565137,Rl[5]=725511199,Rl[6]=4215389547,Rl[7]=327033209,Vl(Zo,Rl,$l,Cl),Cl%=128,au=0;au=0;--Rl)Zo=Cl[Rl/8|0]>>(Rl&7)&1,Fl(xl,$l,Zo),Dl($l,xl),Dl(xl,xl),Fl(xl,$l,Zo)}function Ll(xl,$l){var Cl=[to(),to(),to(),to()];So(Cl[0],uo),So(Cl[1],ho),So(Cl[2],ao),Yo(Cl[3],uo,ho),cu(xl,Cl,$l)}function Xl(xl,$l,Cl){var Zo=new Uint8Array(64),Rl=[to(),to(),to(),to()],Hl;for(Cl||ro($l,32),Ol(Zo,$l,32),Zo[0]&=248,Zo[31]&=127,Zo[31]|=64,Ll(Rl,Zo),Jl(xl,Rl),Hl=0;Hl<32;Hl++)$l[Hl+32]=xl[Hl];return 0}var ku=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function iu(xl,$l){var Cl,Zo,Rl,Hl;for(Zo=63;Zo>=32;--Zo){for(Cl=0,Rl=Zo-32,Hl=Zo-12;Rl>4)*ku[Rl],Cl=$l[Rl]>>8,$l[Rl]&=255;for(Rl=0;Rl<32;Rl++)$l[Rl]-=Cl*ku[Rl];for(Zo=0;Zo<32;Zo++)$l[Zo+1]+=$l[Zo]>>8,xl[Zo]=$l[Zo]&255}function hu(xl){var $l=new Float64Array(64),Cl;for(Cl=0;Cl<64;Cl++)$l[Cl]=xl[Cl];for(Cl=0;Cl<64;Cl++)xl[Cl]=0;iu(xl,$l)}function Cu(xl,$l,Cl,Zo){var Rl=new Uint8Array(64),Hl=new Uint8Array(64),au=new Uint8Array(64),tu,lu,Nu=new Float64Array(64),Pu=[to(),to(),to(),to()];Ol(Rl,Zo,32),Rl[0]&=248,Rl[31]&=127,Rl[31]|=64;var ip=Cl+64;for(tu=0;tu>7&&Ho(xl[0],oo,xl[0]),Yo(xl[3],xl[0],xl[1]),0)}function Go(xl,$l,Cl,Zo){var Rl,Hl=new Uint8Array(32),au=new Uint8Array(64),tu=[to(),to(),to(),to()],lu=[to(),to(),to(),to()];if(Cl<64||_l(lu,Zo))return-1;for(Rl=0;Rl=0},eo.sign.keyPair=function(){var xl=new Uint8Array(Ml),$l=new Uint8Array(Nl);return Xl(xl,$l),{publicKey:xl,secretKey:$l}},eo.sign.keyPair.fromSecretKey=function(xl){if(ru(xl),xl.length!==Nl)throw new Error("bad secret key size");for(var $l=new Uint8Array(Ml),Cl=0;Cl<$l.length;Cl++)$l[Cl]=xl[32+Cl];return{publicKey:$l,secretKey:new Uint8Array(xl)}},eo.sign.keyPair.fromSeed=function(xl){if(ru(xl),xl.length!==Yl)throw new Error("bad seed size");for(var $l=new Uint8Array(Ml),Cl=new Uint8Array(Nl),Zo=0;Zo<32;Zo++)Cl[Zo]=xl[Zo];return Xl($l,Cl,!0),{publicKey:$l,secretKey:Cl}},eo.sign.publicKeyLength=Ml,eo.sign.secretKeyLength=Nl,eo.sign.seedLength=Yl,eo.sign.signatureLength=Gu,eo.hash=function(xl){ru(xl);var $l=new Uint8Array(Wl);return Ol($l,xl,xl.length),$l},eo.hash.hashLength=Wl,eo.verify=function(xl,$l){return ru(xl,$l),xl.length===0||$l.length===0||xl.length!==$l.length?!1:wo(xl,0,$l,0,xl.length)===0},eo.setPRNG=function(xl){ro=xl},function(){var xl=typeof self<"u"?self.crypto||self.msCrypto:null;if(xl&&xl.getRandomValues){var $l=65536;eo.setPRNG(function(Cl,Zo){var Rl,Hl=new Uint8Array(Zo);for(Rl=0;Rl`https://phantom.app/ul/v1/${Xr}?${eo.toString()}`,decryptPayload=(Xr,eo,to)=>{const ro=nacl.box.open.after(bs58$1.decode(Xr),bs58$1.decode(eo),to);if(!ro)throw new Error("Unable to decrypt data");return JSON.parse(Buffer$3.from(ro).toString("utf8"))},encryptPayload=(Xr,eo)=>{const to=nacl.randomBytes(24),ro=nacl.box.after(Buffer$3.from(JSON.stringify(Xr)),to,eo);return[to,ro]},GENESIS_HASHES={"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY":"testnet","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d":"mainnet-beta",EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG:"devnet"},fetchCluster=Xr=>__awaiter$4(void 0,void 0,void 0,function*(){try{const{result:eo}=yield(yield fetch(Xr,{body:JSON.stringify({id:1,jsonrpc:"2.0",method:"getGenesisHash"}),headers:{"Content-Type":"application/json"},method:"POST"})).json();return GENESIS_HASHES[eo]}catch{return"mainnet-beta"}}),storage={address:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_wallet_address"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_wallet_address")},set:Xr=>{localStorage.setItem("dynamic_phantom_wallet_address",Xr.toString())}},encryptionPublicKey:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_public_key");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_public_key")},set:Xr=>{localStorage.setItem("dynamic_phantom_public_key",JSON.stringify([...Xr]))}},encryptionSecretKey:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_secret_key");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_secret_key")},set:Xr=>{localStorage.setItem("dynamic_phantom_secret_key",JSON.stringify([...Xr]))}},message:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_message_to_sign"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_message_to_sign")},set:Xr=>{localStorage.setItem("dynamic_phantom_message_to_sign",Xr)}},method:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_method"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_method")},set:Xr=>{localStorage.setItem("dynamic_phantom_method",Xr)}},session:{get:()=>{var Xr;return(Xr=localStorage.getItem("dynamic_phantom_session"))!==null&&Xr!==void 0?Xr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_session")},set:Xr=>{localStorage.setItem("dynamic_phantom_session",Xr)}},sharedSecret:{get:()=>{const Xr=localStorage.getItem("dynamic_phantom_shared_secret");if(Xr)return new Uint8Array(JSON.parse(Xr))},remove:()=>{localStorage.removeItem("dynamic_phantom_shared_secret")},set:Xr=>{localStorage.setItem("dynamic_phantom_shared_secret",JSON.stringify([...Xr]))}}},clearStorage=()=>{for(const Xr in storage)storage[Xr].remove()};class PhantomRedirect extends SolanaWalletConnector{constructor(eo){super(Object.assign({},eo)),this.name="Phantom",this.overrideKey="phantom"}getMethod(){throw new Error("Method not implemented.")}getAddress(){return __awaiter$4(this,void 0,void 0,function*(){const eo=storage.address.get();if(eo)return eo;yield this.connect()})}connect(){return __awaiter$4(this,void 0,void 0,function*(){var eo,to;const ro=nacl.box.keyPair();storage.encryptionPublicKey.set(ro.publicKey),storage.encryptionSecretKey.set(ro.secretKey);const no=window.location.href.includes("localhost")||window.location.href.includes("0.0.0.0")||window.location.href.includes("127.0.0.1"),io=(to=(eo=this.solNetworks[0].privateCustomerRpcUrls)===null||eo===void 0?void 0:eo[0])!==null&&to!==void 0?to:this.solNetworks[0].rpcUrls[0],oo=new URLSearchParams({app_url:no?"https://demo.dynamic.xyz":window.location.href,cluster:yield fetchCluster(io),dapp_encryption_public_key:bs58$1.encode(ro.publicKey),redirect_link:window.location.href}),ao=buildUrl$1("connect",oo);window.location.href=ao})}getSession(){return __awaiter$4(this,void 0,void 0,function*(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,phantom_encryption_public_key:no,encryptionSecretKey:io}=this.getInputsOrThrow("getSession",["data","nonce","phantom_encryption_public_key"],["encryptionSecretKey"]),oo=nacl.box.before(bs58$1.decode(no),io);storage.sharedSecret.set(oo);const ao=decryptPayload(to,ro,oo);return storage.session.set(ao.session),storage.address.set(new PublicKey$2(ao.public_key)),eo.delete("phantom_encryption_public_key"),eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),ao.public_key})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){const{session:to,sharedSecret:ro,encryptionPublicKey:no}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]);storage.message.set(eo);const io={message:bs58$1.encode(Buffer$3.from(eo)),session:to},[oo,ao]=encryptPayload(io,ro),so=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(no),nonce:bs58$1.encode(oo),payload:bs58$1.encode(ao),redirect_link:window.location.href}),co=buildUrl$1("signMessage",so);throw storage.method.set("signMessage"),window.location.href=co,new Error("ignore")})}extractSignature(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no,message:io}=this.getInputsOrThrow("extractSignature",["data","nonce"],["sharedSecret","message"]),oo=decryptPayload(to,ro,no);return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),{message:io,signature:oo.signature}}extractTransactions(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no}=this.getInputsOrThrow("extractTransactions",["data","nonce"],["sharedSecret"]),oo=decryptPayload(to,ro,no).transactions.map(ao=>Transaction.from(bs58$1.decode(ao)));return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),oo}extractTransaction(){const eo=new URLSearchParams(window.location.search),{data:to,nonce:ro,sharedSecret:no}=this.getInputsOrThrow("extractTransaction",["data","nonce"],["sharedSecret"]),io=decryptPayload(to,ro,no),oo=Transaction.from(bs58$1.decode(io.transaction));return eo.delete("data"),eo.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${eo.toString()}`),oo}consumeMethod(){const eo=storage.method.get();return storage.method.remove(),eo}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){const eo=storage.address.get();if(eo)return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>{throw new Error("Not implemented")},emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!0,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],publicKey:new PublicKey$2(eo),removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},signAllTransactions:to=>__awaiter$4(this,void 0,void 0,function*(){const ro=to.map(ho=>bs58$1.encode(ho.serialize({requireAllSignatures:!1}))),{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signAllTransactions",[],["session","sharedSecret","encryptionPublicKey"]),ao={session:no,transactions:ro},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),uo=buildUrl$1("signAllTransactions",lo);return window.location.href=uo,[]}),signAndSendTransaction:(to,ro)=>__awaiter$4(this,void 0,void 0,function*(){const{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signAndSendTransaction",[],["session","sharedSecret","encryptionPublicKey"]),ao={options:ro,session:no,transaction:bs58$1.encode(to.serialize({requireAllSignatures:!1}))},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),uo=buildUrl$1("signAndSendTransaction",lo);return storage.method.set("signAndSendTransaction"),window.location.href=uo,{signature:""}}),signMessage:to=>__awaiter$4(this,void 0,void 0,function*(){const{session:ro,sharedSecret:no,encryptionPublicKey:io}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]),oo={message:bs58$1.encode(Buffer$3.from(to)),session:ro},[ao,so]=encryptPayload(oo,no),co=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(io),nonce:bs58$1.encode(ao),payload:bs58$1.encode(so),redirect_link:window.location.href}),lo=buildUrl$1("signMessage",co);return window.location.href=lo,{signature:Buffer$3.from("")}}),signTransaction:to=>__awaiter$4(this,void 0,void 0,function*(){const ro=bs58$1.encode(to.serialize({requireAllSignatures:!1})),{session:no,sharedSecret:io,encryptionPublicKey:oo}=this.getInputsOrThrow("signTransaction",[],["session","sharedSecret","encryptionPublicKey"]),ao={session:no,transaction:ro},[so,co]=encryptPayload(ao,io),lo=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(oo),nonce:bs58$1.encode(so),payload:bs58$1.encode(co),redirect_link:window.location.href}),uo=buildUrl$1("signTransaction",lo);return window.location.href=uo,to})}})}getConnectedAccounts(){return __awaiter$4(this,void 0,void 0,function*(){const eo=storage.address.get();return eo?[eo]:[]})}endSession(){return __awaiter$4(this,void 0,void 0,function*(){const eo=storage.address.get(),to=storage.session.get(),ro=storage.sharedSecret.get(),no=storage.encryptionPublicKey.get();if(clearStorage(),!eo||!to||!no||!ro)return;const io={session:to},[oo,ao]=encryptPayload(io,ro),so=new URLSearchParams({dapp_encryption_public_key:bs58$1.encode(no),nonce:bs58$1.encode(oo),payload:bs58$1.encode(ao),redirect_link:window.location.href}),co=buildUrl$1("disconnect",so);window.location.href=co})}getInputsOrThrow(eo,to,ro){const no={},io=new URLSearchParams(window.location.search);return to.forEach(oo=>{const ao=io.get(oo);if(!ao)throw new Error(`[PhantomRedirect] ${eo} called, but required input '${oo}' not found in query params`);no[oo]=ao}),ro.forEach(oo=>{const ao=storage[oo].get();if(!ao)throw new Error(`[PhantomRedirect] ${eo} called, but required input '${oo}' not found in local storage`);no[oo]=ao}),no}}class PhantomInjected extends InjectedWalletBase{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$4(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);isMobile$1()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var eo,to;return((to=(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.findProvider())===null||to===void 0?void 0:to.publicKey)!==null}}class Phantom extends SolanaWalletConnector{constructor(eo){super(eo),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}connect(){return __awaiter$4(this,void 0,void 0,function*(){yield this.getMobileOrInstalledWallet().connect()})}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){return this.getMobileOrInstalledWallet().getSigner()})}getMobileOrInstalledWallet(){const eo=new PhantomInjected(this.constructorProps);return!isMobile$1()||eo.isInstalledOnBrowser()?eo:this.mobileExperience==="redirect"?new PhantomRedirect(this.constructorProps):new PhantomInjected(this.constructorProps)}}class CoinbaseSolana extends InjectedWalletBase{constructor(eo){super(eo),this.name="CoinbaseSolana",this.overrideKey="coinbasesolana",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){const to=yield this.getAddress();if(!to)return;const ro=yield this.getSigner();if(!ro)return;const no=new TextEncoder().encode(eo),io=yield ro.signMessage(no,to);if(io)return bufferToBase64(isSignedMessage(io)?io.signature:io)})}}class Solflare extends InjectedWalletBase{constructor(eo){super(eo),this.name="Solflare",this.overrideKey="solflare",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){return __awaiter$4(this,void 0,void 0,function*(){var eo,to,ro,no,io;if(isMobile$1()&&!this.isInstalledOnBrowser()){handleMobileWalletRedirect({nativeLink:((to=(eo=this.wallet)===null||eo===void 0?void 0:eo.mobile)===null||to===void 0?void 0:to.native)||"solflare://ul/v1/browse",universalLink:((no=(ro=this.wallet)===null||ro===void 0?void 0:ro.mobile)===null||no===void 0?void 0:no.universal)||"https://solflare.com/ul/v1/browse"});return}return(io=this.getSolProviderHelper())===null||io===void 0?void 0:io.getAddress()})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=yield this.getSigner();if(!ro)return;const no=new TextEncoder().encode(eo),io=ao=>ao.signature!==void 0;yield ro.connect(),yield new Promise(ao=>{setTimeout(ao,100)});const oo=yield ro.signMessage(no,"utf8");return io(oo)?bufferToBase64(oo.signature):void 0})}}const isVersionedTransaction=Xr=>!("instructions"in Xr),createSolanaSignerFromWalletStandard=(Xr,eo)=>{const to=Xr.features,ro=()=>__awaiter$4(void 0,void 0,void 0,function*(){const co=yield eo.getAddress(),lo=Xr.accounts.find(uo=>uo.address===co);if(!lo)throw new Error("Account not found");return lo}),no=()=>__awaiter$4(void 0,void 0,void 0,function*(){var co,lo;const uo=(lo=(co=eo.solNetworks[0].privateCustomerRpcUrls)===null||co===void 0?void 0:co[0])!==null&&lo!==void 0?lo:eo.solNetworks[0].rpcUrls[0];return`solana:${yield fetchCluster(uo)}`}),io=co=>__awaiter$4(void 0,void 0,void 0,function*(){const lo=yield ro(),uo=yield to["solana:signTransaction"].signTransaction({account:lo,chain:yield no(),transaction:co.serialize({requireAllSignatures:!1})});return isVersionedTransaction(co)?VersionedTransaction.deserialize(uo[0].signedTransaction):Transaction.from(uo[0].signedTransaction)});return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>eo.endSession(),emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!1,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],get publicKey(){return new PublicKey$2(Xr.accounts[0].publicKey)},removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},send:()=>{throw new Error("Not implemented")},signAllTransactions:co=>__awaiter$4(void 0,void 0,void 0,function*(){return Promise.all(co.map(io))}),signAndSendTransaction:co=>__awaiter$4(void 0,void 0,void 0,function*(){const lo=yield ro(),uo=yield to["solana:signAndSendTransaction"].signAndSendTransaction({account:lo,chain:yield no(),transaction:co.serialize()}),[{signature:ho}]=uo;return{signature:new TextDecoder().decode(ho)}}),signMessage:co=>__awaiter$4(void 0,void 0,void 0,function*(){const lo=yield ro();return{signature:(yield to["solana:signMessage"].signMessage({account:lo,message:co}))[0].signature}}),signTransaction:io}},encoder=new TextEncoder;class SolanaWalletStandardConnector extends SolanaWalletConnector{constructor(eo){super(eo),this.connectedChain="SOL",this.supportedChains=["SOL"]}get wallet(){const eo=SolanaWalletStandardConnector.getWallet(this.walletBook,this.key);if(!eo)throw new Error("Wallet not found");return eo}get walletFeatures(){return this.wallet.features}connect(){return __awaiter$4(this,void 0,void 0,function*(){yield this.walletFeatures["standard:connect"].connect()})}endSession(){return __awaiter$4(this,void 0,void 0,function*(){yield this.walletFeatures["standard:disconnect"].disconnect()})}isInstalledOnBrowser(){return!0}getAddress(){return __awaiter$4(this,void 0,void 0,function*(){yield this.connect();const[eo]=yield this.getConnectedAccounts();return eo})}getConnectedAccounts(){return __awaiter$4(this,void 0,void 0,function*(){return this.wallet.accounts.map(to=>to.address)})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){const to=yield this.getSigner();if(!to)throw new Error("Signer not found");const ro=encoder.encode(eo),{signature:no}=yield to.signMessage(ro);if(!(no instanceof Uint8Array))throw new Error("Signature not found");return Buffer$3.from(no).toString("base64")})}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){const{wallet:eo}=this;return createSolanaSignerFromWalletStandard(eo,this)})}static getWallet(eo,to){var ro,no;const io=getWallets().get(),oo=(ro=eo.wallets[to].injectedConfig)===null||ro===void 0?void 0:ro.find(co=>co.chain==="sol");if(!oo)return;const{features:ao}=(no=oo.walletStandard)!==null&&no!==void 0?no:{};return ao?io.find(co=>{var lo;return co.name===((lo=oo.walletStandard)===null||lo===void 0?void 0:lo.name)?ao.reduce((go,bo)=>{const wo=Object.keys(co.features);return go?wo.includes(bo):!1},!0):!1}):void 0}}class BackpackSol extends InjectedWalletBase{constructor(eo){super(eo),this.name="Backpack",this.overrideKey="backpacksol",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){var eo;return(eo=this.getSolProviderHelper())===null||eo===void 0?void 0:eo.connect()})}signMessage(eo){return __awaiter$4(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const ro=yield this.getSigner();if(!ro)return;const no=yield ro.signMessage(Buffer$3.from(eo,"utf8"));if(no)return typeof no=="object"&&"signature"in no?bufferToBase64(no.signature):bufferToBase64(no)})}}const injectedWalletOverrides=[CoinbaseSolana,BackpackSol,Solflare],filteredInjectedWalletKeysOverrides=["coinbasesolana","phantom","phantomledger","backpacksol","solflare"],fetchInjectedWalletConnectors=({walletBook:Xr})=>{var eo;return Object.entries((eo=Xr==null?void 0:Xr.wallets)!==null&&eo!==void 0?eo:{}).filter(([to,ro])=>{var no;const io=!!(!((no=ro.injectedConfig)===null||no===void 0)&&no.find(ao=>ao.chain==="sol")),oo=filteredInjectedWalletKeysOverrides.includes(to);return io&&!oo}).map(([to,ro])=>{var no;const{shortName:io}=ro,oo=io||ro.name;return!!(!((no=ro.injectedConfig)===null||no===void 0)&&no.find(so=>so.walletStandard))&&!!SolanaWalletStandardConnector.getWallet(Xr,to)?class extends SolanaWalletStandardConnector{constructor(co){super(Object.assign({},co)),this.name=oo,this.overrideKey=to}}:class extends InjectedWalletBase{constructor(so){super(Object.assign({},so)),this.name=oo,this.wallet=ro,this.overrideKey=to}}})};class UnknownInjected extends InjectedWalletBase{constructor(eo){super(eo),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}class FallbackSolanaConnector extends InjectedWalletBase{constructor(eo){super(eo),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const SolanaWalletConnectors=Xr=>[...injectedWalletOverrides,...fetchInjectedWalletConnectors(Xr),...TurnkeySolanaWalletConnectors(Xr),Phantom,UnknownInjected,FallbackSolanaConnector];assertPackageVersion("@dynamic-labs/solana",version$9);var version$1="3.5.1";function __awaiter(Xr,eo,to,ro){function no(io){return io instanceof to?io:new to(function(oo){oo(io)})}return new(to||(to=Promise))(function(io,oo){function ao(lo){try{co(ro.next(lo))}catch(uo){oo(uo)}}function so(lo){try{co(ro.throw(lo))}catch(uo){oo(uo)}}function co(lo){lo.done?io(lo.value):no(lo.value).then(ao,so)}co((ro=ro.apply(Xr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var h$2=Object.defineProperty,Q$2=(Xr,eo,to)=>eo in Xr?h$2(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,T$3=(Xr,eo,to)=>(Q$2(Xr,eo+"",to),to),y$4=(Xr,eo,to)=>{if(!eo.has(Xr))throw TypeError("Cannot "+to)},i=(Xr,eo,to)=>(y$4(Xr,eo,"read from private field"),to?to.call(Xr):eo.get(Xr)),z$2=(Xr,eo,to)=>{if(eo.has(Xr))throw TypeError("Cannot add the same private member more than once");eo instanceof WeakSet?eo.add(Xr):eo.set(Xr,to)},C$3=(Xr,eo,to,ro)=>(y$4(Xr,eo,"write to private field"),eo.set(Xr,to),to),l$2=(Xr,eo,to)=>(y$4(Xr,eo,"access private method"),to);const Y$2=[{id:"argentX",name:"Argent X",icon:"data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgNDAgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNC43NTgyIC0zLjk3MzY0ZS0wN0gxNC42MjM4QzE0LjI4NTEgLTMuOTczNjRlLTA3IDE0LjAxMzggMC4yODExNzggMTQuMDA2NCAwLjYzMDY4M0MxMy44MDE3IDEwLjQ1NDkgOC44MjIzNCAxOS43NzkyIDAuMjUxODkzIDI2LjM4MzdDLTAuMDIwMjA0NiAyNi41OTMzIC0wLjA4MjE5NDYgMjYuOTg3MiAwLjExNjczNCAyNy4yNzA5TDYuMDQ2MjMgMzUuNzM0QzYuMjQ3OTYgMzYuMDIyIDYuNjQwOTkgMzYuMDg3IDYuOTE3NjYgMzUuODc1NEMxMi4yNzY1IDMxLjc3MjggMTYuNTg2OSAyNi44MjM2IDE5LjY5MSAyMS4zMzhDMjIuNzk1MSAyNi44MjM2IDI3LjEwNTcgMzEuNzcyOCAzMi40NjQ2IDM1Ljg3NTRDMzIuNzQxIDM2LjA4NyAzMy4xMzQxIDM2LjAyMiAzMy4zMzYxIDM1LjczNEwzOS4yNjU2IDI3LjI3MDlDMzkuNDY0MiAyNi45ODcyIDM5LjQwMjIgMjYuNTkzMyAzOS4xMzA0IDI2LjM4MzdDMzAuNTU5NyAxOS43NzkyIDI1LjU4MDQgMTAuNDU0OSAyNS4zNzU5IDAuNjMwNjgzQzI1LjM2ODUgMC4yODExNzggMjUuMDk2OSAtMy45NzM2NGUtMDcgMjQuNzU4MiAtMy45NzM2NGUtMDdaIiBmaWxsPSIjRkY4NzVCIi8+Cjwvc3ZnPgo=",downloads:{chrome:"https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb",firefox:"https://addons.mozilla.org/en-US/firefox/addon/argent-x"}},{id:"braavos",name:"Braavos",icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aAogICAgICAgIGQ9Ik02Mi43MDUgMTMuOTExNkM2Mi44MzU5IDE0LjEzMzMgNjIuNjYyMSAxNC40MDcgNjIuNDAzOSAxNC40MDdDNTcuMTgwNyAxNC40MDcgNTIuOTM0OCAxOC41NDI3IDUyLjgzNTEgMjMuNjgxN0M1MS4wNDY1IDIzLjM0NzcgNDkuMTkzMyAyMy4zMjI2IDQ3LjM2MjYgMjMuNjMxMUM0Ny4yMzYxIDE4LjUxNTYgNDMuMDAwOSAxNC40MDcgMzcuNzk0OCAxNC40MDdDMzcuNTM2NSAxNC40MDcgMzcuMzYyNSAxNC4xMzMxIDM3LjQ5MzUgMTMuOTExMkM0MC4wMjE3IDkuNjI4MDkgNDQuNzIwNCA2Ljc1IDUwLjA5OTEgNi43NUM1NS40NzgxIDYuNzUgNjAuMTc2OSA5LjYyODI2IDYyLjcwNSAxMy45MTE2WiIKICAgICAgICBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfMzcyXzQwMjU5KSIgLz4KICAgIDxwYXRoCiAgICAgICAgZD0iTTc4Ljc2MDYgNDUuODcxOEM4MC4yNzI1IDQ2LjMyOTcgODEuNzAyNSA0NS4wMDU1IDgxLjE3MTQgNDMuNTIyMkM3Ni40MTM3IDMwLjIzMzQgNjEuMzkxMSAyNC44MDM5IDUwLjAyNzcgMjQuODAzOUMzOC42NDQyIDI0LjgwMzkgMjMuMjg2OCAzMC40MDcgMTguODc1NCA0My41OTEyQzE4LjM4MjQgNDUuMDY0NSAxOS44MDgzIDQ2LjM0NDYgMjEuMjk3OCA0NS44ODgxTDQ4Ljg3MiAzNy40MzgxQzQ5LjUzMzEgMzcuMjM1NSA1MC4yMzk5IDM3LjIzNDQgNTAuOTAxNyAzNy40MzQ4TDc4Ljc2MDYgNDUuODcxOFoiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8cGF0aAogICAgICAgIGQ9Ik0xOC44MTMyIDQ4LjE3MDdMNDguODkzNSAzOS4wNDcyQzQ5LjU1MDYgMzguODQ3OCA1MC4yNTI0IDM4Ljg0NzMgNTAuOTA5OCAzOS4wNDU2TDgxLjE3ODEgNDguMTc1MkM4My42OTEyIDQ4LjkzMzIgODUuNDExIDUxLjI0ODMgODUuNDExIDUzLjg3MzVWODEuMjIzM0M4NS4yOTQ0IDg3Ljg5OTEgNzkuMjk3NyA5My4yNSA3Mi42MjQ1IDkzLjI1SDYxLjU0MDZDNjAuNDQ0OSA5My4yNSA1OS41NTc3IDkyLjM2MzcgNTkuNTU3NyA5MS4yNjhWODEuNjc4OUM1OS41NTc3IDc3LjkwMzEgNjEuNzkyMSA3NC40ODU1IDY1LjI0OTggNzIuOTcyOUM2OS44ODQ5IDcwLjk0NTQgNzUuMzY4MSA2OC4yMDI4IDc2LjM5OTQgNjIuNjk5MkM3Ni43MzIzIDYwLjkyMjkgNzUuNTc0MSA1OS4yMDk0IDczLjgwMjQgNTguODU3M0M2OS4zMjI2IDU3Ljk2NjcgNjQuMzU2MiA1OC4zMTA3IDYwLjE1NjQgNjAuMTg5M0M1NS4zODg3IDYyLjMyMTkgNTQuMTQxNSA2NS44Njk0IDUzLjY3OTcgNzAuNjMzN0w1My4xMjAxIDc1Ljc2NjJDNTIuOTQ5MSA3Ny4zMzQ5IDUxLjQ3ODUgNzguNTM2NiA0OS45MDE0IDc4LjUzNjZDNDguMjY5OSA3OC41MzY2IDQ3LjA0NjUgNzcuMjk0IDQ2Ljg2OTYgNzUuNjcxMkw0Ni4zMjA0IDcwLjYzMzdDNDUuOTI0OSA2Ni41NTI5IDQ1LjIwNzkgNjIuNTg4NyA0MC45ODk1IDYwLjcwMThDMzYuMTc3NiA1OC41NDk0IDMxLjM0MTkgNTcuODM0NyAyNi4xOTc2IDU4Ljg1NzNDMjQuNDI2IDU5LjIwOTQgMjMuMjY3OCA2MC45MjI5IDIzLjYwMDcgNjIuNjk5MkMyNC42NDEgNjguMjUwNyAzMC4wODEyIDcwLjkzMDUgMzQuNzUwMyA3Mi45NzI5QzM4LjIwOCA3NC40ODU1IDQwLjQ0MjQgNzcuOTAzMSA0MC40NDI0IDgxLjY3ODlWOTEuMjY2M0M0MC40NDI0IDkyLjM2MiAzOS41NTU1IDkzLjI1IDM4LjQ1OTkgOTMuMjVIMjcuMzc1NkMyMC43MDI0IDkzLjI1IDE0LjcwNTcgODcuODk5MSAxNC41ODkxIDgxLjIyMzNWNTMuODY2M0MxNC41ODkxIDUxLjI0NDYgMTYuMzA0NSA0OC45MzE2IDE4LjgxMzIgNDguMTcwN1oiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDJfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMzcyXzQwMjU5IiB4MT0iNDkuMzA1NyIgeTE9IjIuMDc5IiB4Mj0iODAuMzYyNyIgeTI9IjkzLjY1OTciCiAgICAgICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIgLz4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY5NjAwIiAvPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzM3Ml80MDI1OSIgeDE9IjQ5LjMwNTciIHkxPSIyLjA3OSIgeDI9IjgwLjM2MjciIHkyPSI5My42NTk3IgogICAgICAgICAgICBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGNUQ0NUUiIC8+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0ZGOTYwMCIgLz4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQyX2xpbmVhcl8zNzJfNDAyNTkiIHgxPSI0OS4zMDU3IiB5MT0iMi4wNzkiIHgyPSI4MC4zNjI3IiB5Mj0iOTMuNjU5NyIKICAgICAgICAgICAgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjVENDVFIiAvPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiIC8+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KPC9zdmc+",downloads:{chrome:"https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",firefox:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet",edge:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc"}}],U$3=()=>`${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,w$1=Xr=>{for(let eo=Xr.length-1;eo>0;eo--){const to=Math.floor(Math.random()*(eo+1));[Xr[eo],Xr[to]]=[Xr[to],Xr[eo]]}return Xr};function s$1(...Xr){return eo=>Xr.reduce((to,ro)=>to.then(ro),Promise.resolve(eo))}var A$3,c,u$1,r,S$2,a$1,n;let f$2=class{constructor(eo){z$2(this,r),z$2(this,a$1),z$2(this,A$3,!1),z$2(this,c,void 0),z$2(this,u$1,void 0),T$3(this,"value"),C$3(this,u$1,eo),l$2(this,a$1,n).call(this)}set(eo){return!i(this,A$3)&&!l$2(this,a$1,n).call(this)?!1:(this.delete(),this.value=eo,eo&&(C$3(this,c,`${i(this,u$1)}-${U$3()}`),localStorage.setItem(i(this,c),eo)),!0)}get(){return l$2(this,r,S$2).call(this),this.value}delete(){return!i(this,A$3)&&!l$2(this,a$1,n).call(this)?!1:(this.value=null,i(this,c)&&localStorage.removeItem(i(this,c)),!0)}};A$3=new WeakMap,c=new WeakMap,u$1=new WeakMap,r=new WeakSet,S$2=function(){this.value&&this.set(this.value)},a$1=new WeakSet,n=function(){try{!i(this,A$3)&&typeof window<"u"&&(C$3(this,c,Object.keys(localStorage).find(Xr=>Xr.startsWith(i(this,u$1)))),C$3(this,A$3,!0),i(this,c)&&this.set(localStorage.getItem(i(this,c))))}catch(Xr){console.warn(Xr)}return i(this,A$3)};function O$4(Xr,eo){var to,ro;if((to=eo==null?void 0:eo.include)!=null&&to.length){const no=new Set(eo.include);return Xr.filter(io=>no.has(io.id))}if((ro=eo==null?void 0:eo.exclude)!=null&&ro.length){const no=new Set(eo.exclude);return Xr.filter(io=>!no.has(io.id))}return Xr}const x$1=async Xr=>{const eo=await Promise.all(Xr.map(to=>to.isPreauthorized().catch(()=>!1)));return Xr.filter((to,ro)=>eo[ro])},m=Xr=>{try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1};function o$1(Xr,eo){return Object.values(Object.getOwnPropertyNames(Xr).reduce((to,ro)=>{if(ro.startsWith("starknet")){const no=Xr[ro];eo(no)&&!to[no.id]&&(to[no.id]=no)}return to},{}))}const d$3=(Xr,eo)=>{if(eo&&Array.isArray(eo)){Xr.sort((ro,no)=>eo.indexOf(ro.id)-eo.indexOf(no.id));const to=Xr.length-eo.length;return[...Xr.slice(to),...w$1(Xr.slice(0,to))]}else return w$1(Xr)},b$2=typeof window<"u"?window:{},E$1={windowObject:b$2,isWalletObject:m,storageFactoryImplementation:Xr=>new f$2(Xr)};function W$3(Xr={}){const{storageFactoryImplementation:eo,windowObject:to,isWalletObject:ro}={...E$1,...Xr},no=eo("gsw-last");return{getAvailableWallets:async(io={})=>{const oo=o$1(to,ro);return s$1(ao=>O$4(ao,io),ao=>d$3(ao,io.sort))(oo)},getPreAuthorizedWallets:async(io={})=>{const oo=o$1(to,ro);return s$1(ao=>x$1(ao),ao=>O$4(ao,io),ao=>d$3(ao,io.sort))(oo)},getDiscoveryWallets:async(io={})=>s$1(oo=>O$4(oo,io),oo=>d$3(oo,io.sort))(Y$2),getLastConnectedWallet:async()=>{const io=no.get(),oo=o$1(to,ro).find(so=>so.id===io),[ao]=await x$1(oo?[oo]:[]);return ao||(no.delete(),null)},enable:async(io,oo)=>{if(await io.enable(oo??{starknetVersion:"v5"}),!io.isConnected)throw new Error("Failed to connect to wallet");return no.set(io.id),io},disconnect:async({clearLastWallet:io}={})=>{io&&no.delete()}}}W$3();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$8=BigInt(0),_1n$8=BigInt(1),_2n$4=BigInt(2);function isBytes$3(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const hexes$1=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex$1(Xr){if(!isBytes$3(Xr))throw new Error("Uint8Array expected");let eo="";for(let to=0;to=asciis$1._0&&Xr<=asciis$1._9)return Xr-asciis$1._0;if(Xr>=asciis$1._A&&Xr<=asciis$1._F)return Xr-(asciis$1._A-10);if(Xr>=asciis$1._a&&Xr<=asciis$1._f)return Xr-(asciis$1._a-10)}function hexToBytes$2(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no_0n$8;Xr>>=_1n$8,eo+=1);return eo}function bitGet$1(Xr,eo){return Xr>>BigInt(eo)&_1n$8}const bitSet$1=(Xr,eo,to)=>Xr|(to?_1n$8:_0n$8)<(_2n$4<new Uint8Array(Xr),u8fr$1=Xr=>Uint8Array.from(Xr);function createHmacDrbg$1(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n$1(Xr),no=u8n$1(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...uo)=>to(no,ro,...uo),so=(uo=u8n$1())=>{no=ao(u8fr$1([0]),uo),ro=ao(),uo.length!==0&&(no=ao(u8fr$1([1]),uo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let uo=0;const ho=[];for(;uo{oo(),so(uo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns$1={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes$3(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject$1(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns$1[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const ut$3=Object.freeze(Object.defineProperty({__proto__:null,bitGet:bitGet$1,bitLen:bitLen$1,bitMask:bitMask$1,bitSet:bitSet$1,bytesToHex:bytesToHex$1,bytesToNumberBE:bytesToNumberBE$1,bytesToNumberLE:bytesToNumberLE$1,concatBytes:concatBytes$2,createHmacDrbg:createHmacDrbg$1,ensureBytes:ensureBytes$2,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,isBytes:isBytes$3,numberToBytesBE:numberToBytesBE$1,numberToBytesLE:numberToBytesLE$1,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE:numberToVarBytesBE$1,utf8ToBytes:utf8ToBytes$2,validateObject:validateObject$1},Symbol.toStringTag,{value:"Module"}));function number(Xr){if(!Number.isSafeInteger(Xr)||Xr<0)throw new Error(`Wrong positive integer: ${Xr}`)}function isBytes$2(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}function bytes(Xr,...eo){if(!isBytes$2(Xr))throw new Error("Expected Uint8Array");if(eo.length>0&&!eo.includes(Xr.length))throw new Error(`Expected Uint8Array of length ${eo}, not of length=${Xr.length}`)}function hash(Xr){if(typeof Xr!="function"||typeof Xr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(Xr.outputLen),number(Xr.blockLen)}function exists(Xr,eo=!0){if(Xr.destroyed)throw new Error("Hash instance has been destroyed");if(eo&&Xr.finished)throw new Error("Hash#digest() has already been called")}function output(Xr,eo){bytes(Xr);const to=eo.outputLen;if(Xr.length>_32n&U32_MASK64)}:{h:Number(Xr>>_32n&U32_MASK64)|0,l:Number(Xr&U32_MASK64)|0}}function split(Xr,eo=!1){let to=new Uint32Array(Xr.length),ro=new Uint32Array(Xr.length);for(let no=0;noXr<>>32-to,rotlSL=(Xr,eo,to)=>eo<>>32-to,rotlBH=(Xr,eo,to)=>eo<>>64-to,rotlBL=(Xr,eo,to)=>Xr<>>64-to,crypto$1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32=Xr=>new Uint32Array(Xr.buffer,Xr.byteOffset,Math.floor(Xr.byteLength/4));function isBytes$1(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const createView=Xr=>new DataView(Xr.buffer,Xr.byteOffset,Xr.byteLength),rotr=(Xr,eo)=>Xr<<32-eo|Xr>>>eo,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$1(Xr){if(typeof Xr!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Xr}`);return new Uint8Array(new TextEncoder().encode(Xr))}function toBytes(Xr){if(typeof Xr=="string"&&(Xr=utf8ToBytes$1(Xr)),!isBytes$1(Xr))throw new Error(`expected Uint8Array, got ${typeof Xr}`);return Xr}function concatBytes$1(...Xr){let eo=0;for(let ro=0;roXr().update(toBytes(ro)).digest(),to=Xr();return eo.outputLen=to.outputLen,eo.blockLen=to.blockLen,eo.create=()=>Xr(),eo}function randomBytes(Xr=32){if(crypto$1&&typeof crypto$1.getRandomValues=="function")return crypto$1.getRandomValues(new Uint8Array(Xr));throw new Error("crypto.getRandomValues must be defined")}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n$7=BigInt(0),_1n$7=BigInt(1),_2n$3=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let Xr=0,eo=_1n$7,to=1,ro=0;Xr<24;Xr++){[to,ro]=[ro,(2*to+3*ro)%5],SHA3_PI.push(2*(5*ro+to)),SHA3_ROTL.push((Xr+1)*(Xr+2)/2%64);let no=_0n$7;for(let io=0;io<7;io++)eo=(eo<<_1n$7^(eo>>_7n)*_0x71n)%_256n,eo&_2n$3&&(no^=_1n$7<<(_1n$7<to>32?rotlBH(Xr,eo,to):rotlSH(Xr,eo,to),rotlL=(Xr,eo,to)=>to>32?rotlBL(Xr,eo,to):rotlSL(Xr,eo,to);function keccakP(Xr,eo=24){const to=new Uint32Array(10);for(let ro=24-eo;ro<24;ro++){for(let oo=0;oo<10;oo++)to[oo]=Xr[oo]^Xr[oo+10]^Xr[oo+20]^Xr[oo+30]^Xr[oo+40];for(let oo=0;oo<10;oo+=2){const ao=(oo+8)%10,so=(oo+2)%10,co=to[so],lo=to[so+1],uo=rotlH(co,lo,1)^to[ao],ho=rotlL(co,lo,1)^to[ao+1];for(let go=0;go<50;go+=10)Xr[oo+go]^=uo,Xr[oo+go+1]^=ho}let no=Xr[2],io=Xr[3];for(let oo=0;oo<24;oo++){const ao=SHA3_ROTL[oo],so=rotlH(no,io,ao),co=rotlL(no,io,ao),lo=SHA3_PI[oo];no=Xr[lo],io=Xr[lo+1],Xr[lo]=so,Xr[lo+1]=co}for(let oo=0;oo<50;oo+=10){for(let ao=0;ao<10;ao++)to[ao]=Xr[oo+ao];for(let ao=0;ao<10;ao++)Xr[oo+ao]^=~to[(ao+2)%10]&to[(ao+4)%10]}Xr[0]^=SHA3_IOTA_H[ro],Xr[1]^=SHA3_IOTA_L[ro]}to.fill(0)}class Keccak extends Hash{constructor(eo,to,ro,no=!1,io=24){if(super(),this.blockLen=eo,this.suffix=to,this.outputLen=ro,this.enableXOF=no,this.rounds=io,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number(ro),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(eo){exists(this);const{blockLen:to,state:ro}=this;eo=toBytes(eo);const no=eo.length;for(let io=0;io=ro&&this.keccak();const oo=Math.min(ro-this.posOut,io-no);eo.set(to.subarray(this.posOut,this.posOut+oo),no),this.posOut+=oo,no+=oo}return eo}xofInto(eo){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(eo)}xof(eo){return number(eo),this.xofInto(new Uint8Array(eo))}digestInto(eo){if(output(eo,this),this.finished)throw new Error("digest() was already called");return this.writeInto(eo),this.destroy(),eo}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(eo){const{blockLen:to,suffix:ro,outputLen:no,rounds:io,enableXOF:oo}=this;return eo||(eo=new Keccak(to,ro,no,oo,io)),eo.state32.set(this.state32),eo.pos=this.pos,eo.posOut=this.posOut,eo.finished=this.finished,eo.rounds=io,eo.suffix=ro,eo.outputLen=no,eo.enableXOF=oo,eo.destroyed=this.destroyed,eo}}const gen=(Xr,eo,to)=>wrapConstructor(()=>new Keccak(eo,Xr,to)),keccak_256=gen(1,136,256/8);function setBigUint64(Xr,eo,to,ro){if(typeof Xr.setBigUint64=="function")return Xr.setBigUint64(eo,to,ro);const no=BigInt(32),io=BigInt(4294967295),oo=Number(to>>no&io),ao=Number(to&io),so=ro?4:0,co=ro?0:4;Xr.setUint32(eo+so,oo,ro),Xr.setUint32(eo+co,ao,ro)}class SHA2 extends Hash{constructor(eo,to,ro,no){super(),this.blockLen=eo,this.outputLen=to,this.padOffset=ro,this.isLE=no,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(eo),this.view=createView(this.buffer)}update(eo){exists(this);const{view:to,buffer:ro,blockLen:no}=this;eo=toBytes(eo);const io=eo.length;for(let oo=0;oono-oo&&(this.process(ro,0),oo=0);for(let uo=oo;uolo.length)throw new Error("_sha2: outputLen bigger than state");for(let uo=0;uoXr&eo^~Xr&to,Maj=(Xr,eo,to)=>Xr&eo^Xr&to^eo&to,SHA256_K=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]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:eo,B:to,C:ro,D:no,E:io,F:oo,G:ao,H:so}=this;return[eo,to,ro,no,io,oo,ao,so]}set(eo,to,ro,no,io,oo,ao,so){this.A=eo|0,this.B=to|0,this.C=ro|0,this.D=no|0,this.E=io|0,this.F=oo|0,this.G=ao|0,this.H=so|0}process(eo,to){for(let uo=0;uo<16;uo++,to+=4)SHA256_W[uo]=eo.getUint32(to,!1);for(let uo=16;uo<64;uo++){const ho=SHA256_W[uo-15],go=SHA256_W[uo-2],bo=rotr(ho,7)^rotr(ho,18)^ho>>>3,wo=rotr(go,17)^rotr(go,19)^go>>>10;SHA256_W[uo]=wo+SHA256_W[uo-7]+bo+SHA256_W[uo-16]|0}let{A:ro,B:no,C:io,D:oo,E:ao,F:so,G:co,H:lo}=this;for(let uo=0;uo<64;uo++){const ho=rotr(ao,6)^rotr(ao,11)^rotr(ao,25),go=lo+ho+Chi(ao,so,co)+SHA256_K[uo]+SHA256_W[uo]|0,wo=(rotr(ro,2)^rotr(ro,13)^rotr(ro,22))+Maj(ro,no,io)|0;lo=co,co=so,so=ao,ao=oo+go|0,oo=io,io=no,no=ro,ro=go+wo|0}ro=ro+this.A|0,no=no+this.B|0,io=io+this.C|0,oo=oo+this.D|0,ao=ao+this.E|0,so=so+this.F|0,co=co+this.G|0,lo=lo+this.H|0,this.set(ro,no,io,oo,ao,so,co,lo)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256=wrapConstructor(()=>new SHA256);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$6=BigInt(1),_2n$2=BigInt(2);function isBytes(Xr){return Xr instanceof Uint8Array||Xr!=null&&typeof Xr=="object"&&Xr.constructor.name==="Uint8Array"}const hexes=Array.from({length:256},(Xr,eo)=>eo.toString(16).padStart(2,"0"));function bytesToHex(Xr){if(!isBytes(Xr))throw new Error("Uint8Array expected");let eo="";for(let to=0;to=asciis._0&&Xr<=asciis._9)return Xr-asciis._0;if(Xr>=asciis._A&&Xr<=asciis._F)return Xr-(asciis._A-10);if(Xr>=asciis._a&&Xr<=asciis._f)return Xr-(asciis._a-10)}function hexToBytes$1(Xr){if(typeof Xr!="string")throw new Error("hex string expected, got "+typeof Xr);const eo=Xr.length,to=eo/2;if(eo%2)throw new Error("padded hex string expected, got unpadded hex of length "+eo);const ro=new Uint8Array(to);for(let no=0,io=0;no_0n$6;Xr>>=_1n$6,eo+=1);return eo}function bitGet(Xr,eo){return Xr>>BigInt(eo)&_1n$6}const bitSet=(Xr,eo,to)=>Xr|(to?_1n$6:_0n$6)<(_2n$2<new Uint8Array(Xr),u8fr=Xr=>Uint8Array.from(Xr);function createHmacDrbg(Xr,eo,to){if(typeof Xr!="number"||Xr<2)throw new Error("hashLen must be a number");if(typeof eo!="number"||eo<2)throw new Error("qByteLen must be a number");if(typeof to!="function")throw new Error("hmacFn must be a function");let ro=u8n(Xr),no=u8n(Xr),io=0;const oo=()=>{ro.fill(1),no.fill(0),io=0},ao=(...uo)=>to(no,ro,...uo),so=(uo=u8n())=>{no=ao(u8fr([0]),uo),ro=ao(),uo.length!==0&&(no=ao(u8fr([1]),uo),ro=ao())},co=()=>{if(io++>=1e3)throw new Error("drbg: tried 1000 values");let uo=0;const ho=[];for(;uo{oo(),so(uo);let go;for(;!(go=ho(co()));)so();return oo(),go}}const validatorFns={bigint:Xr=>typeof Xr=="bigint",function:Xr=>typeof Xr=="function",boolean:Xr=>typeof Xr=="boolean",string:Xr=>typeof Xr=="string",stringOrUint8Array:Xr=>typeof Xr=="string"||isBytes(Xr),isSafeInteger:Xr=>Number.isSafeInteger(Xr),array:Xr=>Array.isArray(Xr),field:(Xr,eo)=>eo.Fp.isValid(Xr),hash:Xr=>typeof Xr=="function"&&Number.isSafeInteger(Xr.outputLen)};function validateObject(Xr,eo,to={}){const ro=(no,io,oo)=>{const ao=validatorFns[io];if(typeof ao!="function")throw new Error(`Invalid validator "${io}", expected function`);const so=Xr[no];if(!(oo&&so===void 0)&&!ao(so,Xr))throw new Error(`Invalid param ${String(no)}=${so} (${typeof so}), expected ${io}`)};for(const[no,io]of Object.entries(eo))ro(no,io,!1);for(const[no,io]of Object.entries(to))ro(no,io,!0);return Xr}const ut$2=Object.freeze(Object.defineProperty({__proto__:null,bitGet,bitLen,bitMask,bitSet,bytesToHex,bytesToNumberBE,bytesToNumberLE,concatBytes,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes,hexToBytes:hexToBytes$1,hexToNumber,isBytes,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$5=BigInt(1),_2n$1=BigInt(2),_3n$2=BigInt(3),_4n$1=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);BigInt(9);BigInt(16);function mod$1(Xr,eo){const to=Xr%eo;return to>=_0n$5?to:eo+to}function pow(Xr,eo,to){if(to<=_0n$5||eo<_0n$5)throw new Error("Expected power/modulo > 0");if(to===_1n$5)return _0n$5;let ro=_1n$5;for(;eo>_0n$5;)eo&_1n$5&&(ro=ro*Xr%to),Xr=Xr*Xr%to,eo>>=_1n$5;return ro}function invert$1(Xr,eo){if(Xr===_0n$5||eo<=_0n$5)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod$1(Xr,eo),ro=eo,no=_0n$5,io=_1n$5;for(;to!==_0n$5;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$5)throw new Error("invert: does not exist");return mod$1(no,eo)}function tonelliShanks(Xr){const eo=(Xr-_1n$5)/_2n$1;let to,ro,no;for(to=Xr-_1n$5,ro=0;to%_2n$1===_0n$5;to/=_2n$1,ro++);for(no=_2n$1;no(ro[no]="function",ro),eo);return validateObject(Xr,to)}function FpPow$1(Xr,eo,to){if(to<_0n$5)throw new Error("Expected power > 0");if(to===_0n$5)return Xr.ONE;if(to===_1n$5)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$5;)to&_1n$5&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$5;return ro}function FpInvertBatch(Xr,eo){const to=new Array(eo.length),ro=eo.reduce((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=io,Xr.mul(io,oo)),Xr.ONE),no=Xr.inv(ro);return eo.reduceRight((io,oo,ao)=>Xr.is0(oo)?io:(to[ao]=Xr.mul(io,to[ao]),Xr.mul(io,oo)),no),to}function nLength$1(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function Field(Xr,eo,to=!1,ro={}){if(Xr<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${Xr}`);const{nBitLength:no,nByteLength:io}=nLength$1(Xr,eo);if(io>2048)throw new Error("Field lengths over 2048 bytes are not supported");const oo=FpSqrt(Xr),ao=Object.freeze({ORDER:Xr,BITS:no,BYTES:io,MASK:bitMask(no),ZERO:_0n$5,ONE:_1n$5,create:so=>mod$1(so,Xr),isValid:so=>{if(typeof so!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof so}`);return _0n$5<=so&&soso===_0n$5,isOdd:so=>(so&_1n$5)===_1n$5,neg:so=>mod$1(-so,Xr),eql:(so,co)=>so===co,sqr:so=>mod$1(so*so,Xr),add:(so,co)=>mod$1(so+co,Xr),sub:(so,co)=>mod$1(so-co,Xr),mul:(so,co)=>mod$1(so*co,Xr),pow:(so,co)=>FpPow$1(ao,so,co),div:(so,co)=>mod$1(so*invert$1(co,Xr),Xr),sqrN:so=>so*so,addN:(so,co)=>so+co,subN:(so,co)=>so-co,mulN:(so,co)=>so*co,inv:so=>invert$1(so,Xr),sqrt:ro.sqrt||(so=>oo(ao,so)),invertBatch:so=>FpInvertBatch(ao,so),cmov:(so,co,lo)=>lo?co:so,toBytes:so=>to?numberToBytesLE(so,io):numberToBytesBE(so,io),fromBytes:so=>{if(so.length!==io)throw new Error(`Fp.fromBytes: expected ${io}, got ${so.length}`);return to?bytesToNumberLE(so):bytesToNumberBE(so)}});return Object.freeze(ao)}function getFieldBytesLength$1(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength$1(Xr){const eo=getFieldBytesLength$1(Xr);return eo+Math.ceil(eo/2)}function mapHashToField$1(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength$1(eo),io=getMinHashLength$1(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE(Xr):bytesToNumberLE(Xr),ao=mod$1(oo,eo-_1n$5)+_1n$5;return to?numberToBytesLE(ao,no):numberToBytesBE(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validateOpts$3(Xr){const{Fp:eo,mds:to,reversePartialPowIdx:ro,roundConstants:no}=Xr,{roundsFull:io,roundsPartial:oo,sboxPower:ao,t:so}=Xr;validateField$1(eo);for(const bo of["t","roundsFull","roundsPartial"])if(typeof Xr[bo]!="number"||!Number.isSafeInteger(Xr[bo]))throw new Error(`Poseidon: invalid param ${bo}=${Xr[bo]} (${typeof Xr[bo]})`);if(!Array.isArray(to)||to.length!==so)throw new Error("Poseidon: wrong MDS matrix");const co=to.map(bo=>{if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon MDS matrix row: ${bo}`);return bo.map(wo=>{if(typeof wo!="bigint")throw new Error(`Poseidon MDS matrix value=${wo}`);return eo.create(wo)})});if(ro!==void 0&&typeof ro!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${ro}`);if(io%2!==0)throw new Error(`Poseidon roundsFull is not even: ${io}`);const lo=io+oo;if(!Array.isArray(no)||no.length!==lo)throw new Error("Poseidon: wrong round constants");const uo=no.map(bo=>{if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon wrong round constants: ${bo}`);return bo.map(wo=>{if(typeof wo!="bigint"||!eo.isValid(wo))throw new Error(`Poseidon wrong round constant=${wo}`);return eo.create(wo)})});if(!ao||![3,5,7].includes(ao))throw new Error(`Poseidon wrong sboxPower=${ao}`);const ho=BigInt(ao);let go=bo=>FpPow$1(eo,bo,ho);return ao===3?go=bo=>eo.mul(eo.sqrN(bo),bo):ao===5&&(go=bo=>eo.mul(eo.sqrN(eo.sqrN(bo)),bo)),Object.freeze({...Xr,rounds:lo,sboxFn:go,roundConstants:uo,mds:co})}function poseidon$2(Xr){const eo=validateOpts$3(Xr),{Fp:to,mds:ro,roundConstants:no,rounds:io,roundsPartial:oo,sboxFn:ao,t:so}=eo,co=eo.roundsFull/2,lo=eo.reversePartialPowIdx?so-1:0,uo=(go,bo,wo)=>(go=go.map((Eo,$o)=>to.add(Eo,no[wo][$o])),bo?go=go.map(Eo=>ao(Eo)):go[lo]=ao(go[lo]),go=ro.map(Eo=>Eo.reduce(($o,Co,Ro)=>to.add($o,to.mulN(Co,go[Ro])),to.ZERO)),go),ho=function(bo){if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${so})`);bo=bo.map(Eo=>{if(typeof Eo!="bigint")throw new Error(`Poseidon: wrong value=${Eo} (${typeof Eo})`);return to.create(Eo)});let wo=0;for(let Eo=0;Eo{const oo=io.negate();return no?oo:io},ro=no=>{const io=Math.ceil(eo/no)+1,oo=2**(no-1);return{windows:io,windowSize:oo}};return{constTimeNegate:to,unsafeLadder(no,io){let oo=Xr.ZERO,ao=no;for(;io>_0n$4;)io&_1n$4&&(oo=oo.add(ao)),ao=ao.double(),io>>=_1n$4;return oo},precomputeWindow(no,io){const{windows:oo,windowSize:ao}=ro(io),so=[];let co=no,lo=co;for(let uo=0;uo>=go,Eo>so&&(Eo-=ho,oo+=_1n$4);const $o=wo,Co=wo+Math.abs(Eo)-1,Ro=bo%2!==0,Oo=Eo<0;Eo===0?lo=lo.add(to(Ro,io[$o])):co=co.add(to(Oo,io[Co]))}return{p:co,f:lo}},wNAFCached(no,io,oo,ao){const so=no._WINDOW_SIZE||1;let co=io.get(no);return co||(co=this.precomputeWindow(no,so),so!==1&&io.set(no,ao(co))),this.wNAF(so,co,oo)}}}function validateBasic$1(Xr){return validateField$1(Xr.Fp),validateObject(Xr,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength$1(Xr.n,Xr.nBitLength),...Xr,p:Xr.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts$1(Xr){const eo=validateBasic$1(Xr);validateObject(eo,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:to,Fp:ro,a:no}=eo;if(to){if(!ro.eql(no,ro.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof to!="object"||typeof to.beta!="bigint"||typeof to.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...eo})}const{bytesToNumberBE:b2n$1,hexToBytes:h2b$1}=ut$2,DER$1={Err:class extends Error{constructor(eo=""){super(eo)}},_parseInt(Xr){const{Err:eo}=DER$1;if(Xr.length<2||Xr[0]!==2)throw new eo("Invalid signature integer tag");const to=Xr[1],ro=Xr.subarray(2,to+2);if(!to||ro.length!==to)throw new eo("Invalid signature integer: wrong length");if(ro[0]&128)throw new eo("Invalid signature integer: negative");if(ro[0]===0&&!(ro[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return{d:b2n$1(ro),l:Xr.subarray(to+2)}},toSig(Xr){const{Err:eo}=DER$1,to=typeof Xr=="string"?h2b$1(Xr):Xr;if(!isBytes(to))throw new Error("ui8a expected");let ro=to.length;if(ro<2||to[0]!=48)throw new eo("Invalid signature tag");if(to[1]!==ro-2)throw new eo("Invalid signature: incorrect length");const{d:no,l:io}=DER$1._parseInt(to.subarray(2)),{d:oo,l:ao}=DER$1._parseInt(io);if(ao.length)throw new eo("Invalid signature: left bytes after parsing");return{r:no,s:oo}},hexFromSig(Xr){const eo=co=>Number.parseInt(co[0],16)&8?"00"+co:co,to=co=>{const lo=co.toString(16);return lo.length&1?`0${lo}`:lo},ro=eo(to(Xr.s)),no=eo(to(Xr.r)),io=ro.length/2,oo=no.length/2,ao=to(io),so=to(oo);return`30${to(oo+io+4)}02${so}${no}02${ao}${ro}`}},_0n$3=BigInt(0),_1n$3=BigInt(1);BigInt(2);const _3n$1=BigInt(3);BigInt(4);function weierstrassPoints$1(Xr){const eo=validatePointOpts$1(Xr),{Fp:to}=eo,ro=eo.toBytes||((bo,wo,Eo)=>{const $o=wo.toAffine();return concatBytes(Uint8Array.from([4]),to.toBytes($o.x),to.toBytes($o.y))}),no=eo.fromBytes||(bo=>{const wo=bo.subarray(1),Eo=to.fromBytes(wo.subarray(0,to.BYTES)),$o=to.fromBytes(wo.subarray(to.BYTES,2*to.BYTES));return{x:Eo,y:$o}});function io(bo){const{a:wo,b:Eo}=eo,$o=to.sqr(bo),Co=to.mul($o,bo);return to.add(to.add(Co,to.mul(bo,wo)),Eo)}if(!to.eql(to.sqr(eo.Gy),io(eo.Gx)))throw new Error("bad generator point: equation left != right");function oo(bo){return typeof bo=="bigint"&&_0n$3to.eql(Ro,to.ZERO);return Co(Eo)&&Co($o)?uo.ZERO:new uo(Eo,$o,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(wo){const Eo=to.invertBatch(wo.map($o=>$o.pz));return wo.map(($o,Co)=>$o.toAffine(Eo[Co])).map(uo.fromAffine)}static fromHex(wo){const Eo=uo.fromAffine(no(ensureBytes$1("pointHex",wo)));return Eo.assertValidity(),Eo}static fromPrivateKey(wo){return uo.BASE.multiply(so(wo))}_setWindowSize(wo){this._WINDOW_SIZE=wo,co.delete(this)}assertValidity(){if(this.is0()){if(eo.allowInfinityPoint&&!to.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:wo,y:Eo}=this.toAffine();if(!to.isValid(wo)||!to.isValid(Eo))throw new Error("bad point: x or y not FE");const $o=to.sqr(Eo),Co=io(wo);if(!to.eql($o,Co))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:wo}=this.toAffine();if(to.isOdd)return!to.isOdd(wo);throw new Error("Field doesn't support isOdd")}equals(wo){lo(wo);const{px:Eo,py:$o,pz:Co}=this,{px:Ro,py:Oo,pz:jo}=wo,Bo=to.eql(to.mul(Eo,jo),to.mul(Ro,Co)),Mo=to.eql(to.mul($o,jo),to.mul(Oo,Co));return Bo&&Mo}negate(){return new uo(this.px,to.neg(this.py),this.pz)}double(){const{a:wo,b:Eo}=eo,$o=to.mul(Eo,_3n$1),{px:Co,py:Ro,pz:Oo}=this;let jo=to.ZERO,Bo=to.ZERO,Mo=to.ZERO,Fo=to.mul(Co,Co),Wo=to.mul(Ro,Ro),Jo=to.mul(Oo,Oo),Po=to.mul(Co,Ro);return Po=to.add(Po,Po),Mo=to.mul(Co,Oo),Mo=to.add(Mo,Mo),jo=to.mul(wo,Mo),Bo=to.mul($o,Jo),Bo=to.add(jo,Bo),jo=to.sub(Wo,Bo),Bo=to.add(Wo,Bo),Bo=to.mul(jo,Bo),jo=to.mul(Po,jo),Mo=to.mul($o,Mo),Jo=to.mul(wo,Jo),Po=to.sub(Fo,Jo),Po=to.mul(wo,Po),Po=to.add(Po,Mo),Mo=to.add(Fo,Fo),Fo=to.add(Mo,Fo),Fo=to.add(Fo,Jo),Fo=to.mul(Fo,Po),Bo=to.add(Bo,Fo),Jo=to.mul(Ro,Oo),Jo=to.add(Jo,Jo),Fo=to.mul(Jo,Po),jo=to.sub(jo,Fo),Mo=to.mul(Jo,Wo),Mo=to.add(Mo,Mo),Mo=to.add(Mo,Mo),new uo(jo,Bo,Mo)}add(wo){lo(wo);const{px:Eo,py:$o,pz:Co}=this,{px:Ro,py:Oo,pz:jo}=wo;let Bo=to.ZERO,Mo=to.ZERO,Fo=to.ZERO;const Wo=eo.a,Jo=to.mul(eo.b,_3n$1);let Po=to.mul(Eo,Ro),fo=to.mul($o,Oo),yo=to.mul(Co,jo),vo=to.add(Eo,$o),_o=to.add(Ro,Oo);vo=to.mul(vo,_o),_o=to.add(Po,fo),vo=to.sub(vo,_o),_o=to.add(Eo,Co);let So=to.add(Ro,jo);return _o=to.mul(_o,So),So=to.add(Po,yo),_o=to.sub(_o,So),So=to.add($o,Co),Bo=to.add(Oo,jo),So=to.mul(So,Bo),Bo=to.add(fo,yo),So=to.sub(So,Bo),Fo=to.mul(Wo,_o),Bo=to.mul(Jo,yo),Fo=to.add(Bo,Fo),Bo=to.sub(fo,Fo),Fo=to.add(fo,Fo),Mo=to.mul(Bo,Fo),fo=to.add(Po,Po),fo=to.add(fo,Po),yo=to.mul(Wo,yo),_o=to.mul(Jo,_o),fo=to.add(fo,yo),yo=to.sub(Po,yo),yo=to.mul(Wo,yo),_o=to.add(_o,yo),Po=to.mul(fo,_o),Mo=to.add(Mo,Po),Po=to.mul(So,_o),Bo=to.mul(vo,Bo),Bo=to.sub(Bo,Po),Po=to.mul(vo,fo),Fo=to.mul(So,Fo),Fo=to.add(Fo,Po),new uo(Bo,Mo,Fo)}subtract(wo){return this.add(wo.negate())}is0(){return this.equals(uo.ZERO)}wNAF(wo){return go.wNAFCached(this,co,wo,Eo=>{const $o=to.invertBatch(Eo.map(Co=>Co.pz));return Eo.map((Co,Ro)=>Co.toAffine($o[Ro])).map(uo.fromAffine)})}multiplyUnsafe(wo){const Eo=uo.ZERO;if(wo===_0n$3)return Eo;if(ao(wo),wo===_1n$3)return this;const{endo:$o}=eo;if(!$o)return go.unsafeLadder(this,wo);let{k1neg:Co,k1:Ro,k2neg:Oo,k2:jo}=$o.splitScalar(wo),Bo=Eo,Mo=Eo,Fo=this;for(;Ro>_0n$3||jo>_0n$3;)Ro&_1n$3&&(Bo=Bo.add(Fo)),jo&_1n$3&&(Mo=Mo.add(Fo)),Fo=Fo.double(),Ro>>=_1n$3,jo>>=_1n$3;return Co&&(Bo=Bo.negate()),Oo&&(Mo=Mo.negate()),Mo=new uo(to.mul(Mo.px,$o.beta),Mo.py,Mo.pz),Bo.add(Mo)}multiply(wo){ao(wo);let Eo=wo,$o,Co;const{endo:Ro}=eo;if(Ro){const{k1neg:Oo,k1:jo,k2neg:Bo,k2:Mo}=Ro.splitScalar(Eo);let{p:Fo,f:Wo}=this.wNAF(jo),{p:Jo,f:Po}=this.wNAF(Mo);Fo=go.constTimeNegate(Oo,Fo),Jo=go.constTimeNegate(Bo,Jo),Jo=new uo(to.mul(Jo.px,Ro.beta),Jo.py,Jo.pz),$o=Fo.add(Jo),Co=Wo.add(Po)}else{const{p:Oo,f:jo}=this.wNAF(Eo);$o=Oo,Co=jo}return uo.normalizeZ([$o,Co])[0]}multiplyAndAddUnsafe(wo,Eo,$o){const Co=uo.BASE,Ro=(jo,Bo)=>Bo===_0n$3||Bo===_1n$3||!jo.equals(Co)?jo.multiplyUnsafe(Bo):jo.multiply(Bo),Oo=Ro(this,Eo).add(Ro(wo,$o));return Oo.is0()?void 0:Oo}toAffine(wo){const{px:Eo,py:$o,pz:Co}=this,Ro=this.is0();wo==null&&(wo=Ro?to.ONE:to.inv(Co));const Oo=to.mul(Eo,wo),jo=to.mul($o,wo),Bo=to.mul(Co,wo);if(Ro)return{x:to.ZERO,y:to.ZERO};if(!to.eql(Bo,to.ONE))throw new Error("invZ was invalid");return{x:Oo,y:jo}}isTorsionFree(){const{h:wo,isTorsionFree:Eo}=eo;if(wo===_1n$3)return!0;if(Eo)return Eo(uo,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:wo,clearCofactor:Eo}=eo;return wo===_1n$3?this:Eo?Eo(uo,this):this.multiplyUnsafe(eo.h)}toRawBytes(wo=!0){return this.assertValidity(),ro(uo,this,wo)}toHex(wo=!0){return bytesToHex(this.toRawBytes(wo))}}uo.BASE=new uo(eo.Gx,eo.Gy,to.ONE),uo.ZERO=new uo(to.ZERO,to.ONE,to.ZERO);const ho=eo.nBitLength,go=wNAF$1(uo,eo.endo?Math.ceil(ho/2):ho);return{CURVE:eo,ProjectivePoint:uo,normPrivateKeyToScalar:so,weierstrassEquation:io,isWithinCurveOrder:oo}}function validateOpts$2(Xr){const eo=validateBasic$1(Xr);return validateObject(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass$2(Xr){const eo=validateOpts$2(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(_o){return _0n$3<_o&&_obytesToHex(numberToBytesBE(_o,eo.nByteLength));function bo(_o){const So=ro>>_1n$3;return _o>So}function wo(_o){return bo(_o)?ao(-_o):_o}const Eo=(_o,So,To)=>bytesToNumberBE(_o.slice(So,To));class $o{constructor(So,To,Ao){this.r=So,this.s=To,this.recovery=Ao,this.assertValidity()}static fromCompact(So){const To=eo.nByteLength;return So=ensureBytes$1("compactSignature",So,To*2),new $o(Eo(So,0,To),Eo(So,To,2*To))}static fromDER(So){const{r:To,s:Ao}=DER$1.toSig(ensureBytes$1("DER",So));return new $o(To,Ao)}assertValidity(){if(!ho(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!ho(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(So){return new $o(this.r,this.s,So)}recoverPublicKey(So){const{r:To,s:Ao,recovery:ko}=this,mo=Mo(ensureBytes$1("msgHash",So));if(ko==null||![0,1,2,3].includes(ko))throw new Error("recovery id invalid");const Io=ko===2||ko===3?To+eo.n:To;if(Io>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const Do=ko&1?"03":"02",Lo=co.fromHex(Do+go(Io)),Ho=so(Io),Yo=ao(-mo*Ho),Xo=ao(Ao*Ho),qo=co.BASE.multiplyAndAddUnsafe(Lo,Yo,Xo);if(!qo)throw new Error("point at infinify");return qo.assertValidity(),qo}hasHighS(){return bo(this.s)}normalizeS(){return this.hasHighS()?new $o(this.r,ao(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$1(this.toDERHex())}toDERHex(){return DER$1.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$1(this.toCompactHex())}toCompactHex(){return go(this.r)+go(this.s)}}const Co={isValidPrivateKey(_o){try{return lo(_o),!0}catch{return!1}},normPrivateKeyToScalar:lo,randomPrivateKey:()=>{const _o=getMinHashLength$1(eo.n);return mapHashToField$1(eo.randomBytes(_o),eo.n)},precompute(_o=8,So=co.BASE){return So._setWindowSize(_o),So.multiply(BigInt(3)),So}};function Ro(_o,So=!0){return co.fromPrivateKey(_o).toRawBytes(So)}function Oo(_o){const So=isBytes(_o),To=typeof _o=="string",Ao=(So||To)&&_o.length;return So?Ao===no||Ao===io:To?Ao===2*no||Ao===2*io:_o instanceof co}function jo(_o,So,To=!0){if(Oo(_o))throw new Error("first arg must be private key");if(!Oo(So))throw new Error("second arg must be public key");return co.fromHex(So).multiply(lo(_o)).toRawBytes(To)}const Bo=eo.bits2int||function(_o){const So=bytesToNumberBE(_o),To=_o.length*8-eo.nBitLength;return To>0?So>>BigInt(To):So},Mo=eo.bits2int_modN||function(_o){return ao(Bo(_o))},Fo=bitMask(eo.nBitLength);function Wo(_o){if(typeof _o!="bigint")throw new Error("bigint expected");if(!(_0n$3<=_o&&_oQo in To))throw new Error("sign() legacy options not supported");const{hash:Ao,randomBytes:ko}=eo;let{lowS:mo,prehash:Io,extraEntropy:Do}=To;mo==null&&(mo=!0),_o=ensureBytes$1("msgHash",_o),Io&&(_o=ensureBytes$1("prehashed msgHash",Ao(_o)));const Lo=Mo(_o),Ho=lo(So),Yo=[Wo(Ho),Wo(Lo)];if(Do!=null){const Qo=Do===!0?ko(to.BYTES):Do;Yo.push(ensureBytes$1("extraEntropy",Qo))}const Xo=concatBytes(...Yo),qo=Lo;function Ko(Qo){const zo=Bo(Qo);if(!ho(zo))return;const ga=so(zo),$a=co.BASE.multiply(zo).toAffine(),Sl=ao($a.x);if(Sl===_0n$3)return;const El=ao(ga*ao(qo+Sl*Ho));if(El===_0n$3)return;let Tl=($a.x===Sl?0:2)|Number($a.y&_1n$3),Il=El;return mo&&bo(El)&&(Il=wo(El),Tl^=1),new $o(Sl,Il,Tl)}return{seed:Xo,k2sig:Ko}}const Po={lowS:eo.lowS,prehash:!1},fo={lowS:eo.lowS,prehash:!1};function yo(_o,So,To=Po){const{seed:Ao,k2sig:ko}=Jo(_o,So,To),mo=eo;return createHmacDrbg(mo.hash.outputLen,mo.nByteLength,mo.hmac)(Ao,ko)}co.BASE._setWindowSize(8);function vo(_o,So,To,Ao=fo){var $a;const ko=_o;if(So=ensureBytes$1("msgHash",So),To=ensureBytes$1("publicKey",To),"strict"in Ao)throw new Error("options.strict was renamed to lowS");const{lowS:mo,prehash:Io}=Ao;let Do,Lo;try{if(typeof ko=="string"||isBytes(ko))try{Do=$o.fromDER(ko)}catch(Sl){if(!(Sl instanceof DER$1.Err))throw Sl;Do=$o.fromCompact(ko)}else if(typeof ko=="object"&&typeof ko.r=="bigint"&&typeof ko.s=="bigint"){const{r:Sl,s:El}=ko;Do=new $o(Sl,El)}else throw new Error("PARSE");Lo=co.fromHex(To)}catch(Sl){if(Sl.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(mo&&Do.hasHighS())return!1;Io&&(So=eo.hash(So));const{r:Ho,s:Yo}=Do,Xo=Mo(So),qo=so(Yo),Ko=ao(Xo*qo),Qo=ao(Ho*qo),zo=($a=co.BASE.multiplyAndAddUnsafe(Lo,Ko,Qo))==null?void 0:$a.toAffine();return zo?ao(zo.x)===Ho:!1}return{CURVE:eo,getPublicKey:Ro,getSharedSecret:jo,sign:yo,verify:vo,ProjectivePoint:co,Signature:$o,utils:Co}}class HMAC extends Hash{constructor(eo,to){super(),this.finished=!1,this.destroyed=!1,hash(eo);const ro=toBytes(to);if(this.iHash=eo.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 no=this.blockLen,io=new Uint8Array(no);io.set(ro.length>no?eo.create().update(ro).digest():ro);for(let oo=0;oonew HMAC(Xr,eo).update(to).digest();hmac.create=(Xr,eo)=>new HMAC(Xr,eo);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(Xr){return{hash:Xr,hmac:(eo,...to)=>hmac(Xr,eo,concatBytes$1(...to)),randomBytes}}const CURVE_ORDER=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),MAX_VALUE=BigInt("0x800000000000000000000000000000000000000000000000000000000000000"),nBitLength=252;function bits2int(Xr){for(;Xr[0]===0;)Xr=Xr.subarray(1);const eo=Xr.length*8-nBitLength,to=bytesToNumberBE(Xr);return eo>0?to>>BigInt(eo):to}function hex0xToBytes(Xr){return typeof Xr=="string"&&(Xr=strip0x(Xr),Xr.length&1&&(Xr="0"+Xr)),hexToBytes$1(Xr)}const curve=weierstrass$2({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:Field(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:CURVE_ORDER,nBitLength,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...getHash(sha256),bits2int,bits2int_modN:Xr=>{const eo=bytesToNumberBE(Xr).toString(16);return eo.length===63&&(Xr=hex0xToBytes(eo+"0")),mod$1(bits2int(Xr),CURVE_ORDER)}}),_starkCurve=curve;function ensureBytes(Xr){return ensureBytes$1("",typeof Xr=="string"?hex0xToBytes(Xr):Xr)}function normPrivKey(Xr){return bytesToHex(ensureBytes(Xr)).padStart(64,"0")}function getPublicKey(Xr,eo=!1){return curve.getPublicKey(normPrivKey(Xr),eo)}function getSharedSecret(Xr,eo){return curve.getSharedSecret(normPrivKey(Xr),eo)}function checkSignature(Xr){const{r:eo,s:to}=Xr;if(eo<0n||eo>=MAX_VALUE)throw new Error(`Signature.r should be [1, ${MAX_VALUE})`);const ro=invert$1(to,CURVE_ORDER);if(ro<0n||ro>=MAX_VALUE)throw new Error(`inv(Signature.s) should be [1, ${MAX_VALUE})`)}function checkMessage(Xr){const eo=ensureBytes(Xr);if(bytesToNumberBE(eo)>=MAX_VALUE)throw new Error(`msgHash should be [0, ${MAX_VALUE})`);return eo}function sign(Xr,eo,to){const ro=curve.sign(checkMessage(Xr),normPrivKey(eo),to);return checkSignature(ro),ro}function verify(Xr,eo,to){if(!(Xr instanceof Signature)){const ro=ensureBytes(Xr);try{Xr=Signature.fromDER(ro)}catch(no){if(!(no instanceof DER$1.Err))throw no;Xr=Signature.fromCompact(ro)}}return checkSignature(Xr),curve.verify(Xr,checkMessage(eo),ensureBytes(to))}const{CURVE,ProjectivePoint,Signature,utils}=curve;function extractX(Xr){return`0x${bytesToHex(Xr.subarray(1)).replace(/^0+/gm,"")}`}function strip0x(Xr){return Xr.replace(/^0x/i,"")}function grindKey(Xr){const eo=ensureBytes(Xr),to=2n**256n,ro=to-mod$1(to,CURVE_ORDER);for(let no=0;;no++){const io=sha256Num(concatBytes(eo,numberToVarBytesBE(BigInt(no))));if(ioNumber(Xr&MASK_31);function getAccountPath(Xr,eo,to,ro){const no=int31(sha256Num(Xr)),io=int31(sha256Num(eo)),oo=hexToNumber(strip0x(to));return`m/2645'/${no}'/${io}'/${int31(oo)}'/${int31(oo>>31n)}'/${ro}`}const PEDERSEN_POINTS=[new ProjectivePoint(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new ProjectivePoint(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new ProjectivePoint(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new ProjectivePoint(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new ProjectivePoint(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function pedersenPrecompute(Xr,eo){const to=[];let ro=Xr;for(let no=0;no<248;no++)to.push(ro),ro=ro.double();ro=eo;for(let no=0;no<4;no++)to.push(ro),ro=ro.double();return to}const PEDERSEN_POINTS1=pedersenPrecompute(PEDERSEN_POINTS[1],PEDERSEN_POINTS[2]),PEDERSEN_POINTS2=pedersenPrecompute(PEDERSEN_POINTS[3],PEDERSEN_POINTS[4]);function pedersenArg(Xr){let eo;if(typeof Xr=="bigint")eo=Xr;else if(typeof Xr=="number"){if(!Number.isSafeInteger(Xr))throw new Error(`Invalid pedersenArg: ${Xr}`);eo=BigInt(Xr)}else eo=bytesToNumberBE(ensureBytes(Xr));if(!(0n<=eo&&eo>=1n}return Xr}function pedersen(Xr,eo){let to=PEDERSEN_POINTS[0];return to=pedersenSingle(to,Xr,PEDERSEN_POINTS1),to=pedersenSingle(to,eo,PEDERSEN_POINTS2),extractX(to.toRawBytes(!0))}const computeHashOnElements$1=(Xr,eo=pedersen)=>[0,...Xr,Xr.length].reduce((to,ro)=>eo(to,ro)),MASK_250$1=bitMask(250),keccak=Xr=>bytesToNumberBE(keccak_256(Xr))&MASK_250$1,sha256Num=Xr=>bytesToNumberBE(sha256(Xr)),Fp251=Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function poseidonRoundConstant(Xr,eo,to){const ro=Xr.fromBytes(sha256(utf8ToBytes$1(`${eo}${to}`)));return Xr.create(ro)}function _poseidonMDS(Xr,eo,to,ro=0){const no=[],io=[];for(let oo=0;ooio.map(ao=>Xr.inv(Xr.sub(oo,ao))))}const MDS_SMALL=[[3,1,1],[1,-1,1],[1,1,-2]].map(Xr=>Xr.map(BigInt));function poseidonBasic(Xr,eo){if(validateField$1(Xr.Fp),!Number.isSafeInteger(Xr.rate)||!Number.isSafeInteger(Xr.capacity))throw new Error(`Wrong poseidon opts: ${Xr}`);const to=Xr.rate+Xr.capacity,ro=Xr.roundsFull+Xr.roundsPartial,no=[];for(let oo=0;oo=_0n$2?to:eo+to}function invert(Xr,eo){if(Xr===_0n$2||eo<=_0n$2)throw new Error(`invert: expected positive integers, got n=${Xr} mod=${eo}`);let to=mod(Xr,eo),ro=eo,no=_0n$2,io=_1n$2;for(;to!==_0n$2;){const ao=ro/to,so=ro%to,co=no-io*ao;ro=to,to=so,no=io,io=co}if(ro!==_1n$2)throw new Error("invert: does not exist");return mod(no,eo)}const FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(Xr){const eo={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},to=FIELD_FIELDS.reduce((ro,no)=>(ro[no]="function",ro),eo);return validateObject$1(Xr,to)}function FpPow(Xr,eo,to){if(to<_0n$2)throw new Error("Expected power > 0");if(to===_0n$2)return Xr.ONE;if(to===_1n$2)return eo;let ro=Xr.ONE,no=eo;for(;to>_0n$2;)to&_1n$2&&(ro=Xr.mul(ro,no)),no=Xr.sqr(no),to>>=_1n$2;return ro}function nLength(Xr,eo){const to=eo!==void 0?eo:Xr.toString(2).length,ro=Math.ceil(to/8);return{nBitLength:to,nByteLength:ro}}function getFieldBytesLength(Xr){if(typeof Xr!="bigint")throw new Error("field order must be bigint");const eo=Xr.toString(2).length;return Math.ceil(eo/8)}function getMinHashLength(Xr){const eo=getFieldBytesLength(Xr);return eo+Math.ceil(eo/2)}function mapHashToField(Xr,eo,to=!1){const ro=Xr.length,no=getFieldBytesLength(eo),io=getMinHashLength(eo);if(ro<16||ro1024)throw new Error(`expected ${io}-1024 bytes of input, got ${ro}`);const oo=to?bytesToNumberBE$1(Xr):bytesToNumberLE$1(Xr),ao=mod(oo,eo-_1n$2)+_1n$2;return to?numberToBytesLE$1(ao,no):numberToBytesBE$1(ao,no)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$1=BigInt(1);function wNAF(Xr,eo){const to=(no,io)=>{const oo=io.negate();return no?oo:io},ro=no=>{const io=Math.ceil(eo/no)+1,oo=2**(no-1);return{windows:io,windowSize:oo}};return{constTimeNegate:to,unsafeLadder(no,io){let oo=Xr.ZERO,ao=no;for(;io>_0n$1;)io&_1n$1&&(oo=oo.add(ao)),ao=ao.double(),io>>=_1n$1;return oo},precomputeWindow(no,io){const{windows:oo,windowSize:ao}=ro(io),so=[];let co=no,lo=co;for(let uo=0;uo>=go,Eo>so&&(Eo-=ho,oo+=_1n$1);const $o=wo,Co=wo+Math.abs(Eo)-1,Ro=bo%2!==0,Oo=Eo<0;Eo===0?lo=lo.add(to(Ro,io[$o])):co=co.add(to(Oo,io[Co]))}return{p:co,f:lo}},wNAFCached(no,io,oo,ao){const so=no._WINDOW_SIZE||1;let co=io.get(no);return co||(co=this.precomputeWindow(no,so),so!==1&&io.set(no,ao(co))),this.wNAF(so,co,oo)}}}function validateBasic(Xr){return validateField(Xr.Fp),validateObject$1(Xr,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(Xr.n,Xr.nBitLength),...Xr,p:Xr.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts(Xr){const eo=validateBasic(Xr);validateObject$1(eo,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:to,Fp:ro,a:no}=eo;if(to){if(!ro.eql(no,ro.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof to!="object"||typeof to.beta!="bigint"||typeof to.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...eo})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut$3,DER={Err:class extends Error{constructor(eo=""){super(eo)}},_parseInt(Xr){const{Err:eo}=DER;if(Xr.length<2||Xr[0]!==2)throw new eo("Invalid signature integer tag");const to=Xr[1],ro=Xr.subarray(2,to+2);if(!to||ro.length!==to)throw new eo("Invalid signature integer: wrong length");if(ro[0]&128)throw new eo("Invalid signature integer: negative");if(ro[0]===0&&!(ro[1]&128))throw new eo("Invalid signature integer: unnecessary leading zero");return{d:b2n(ro),l:Xr.subarray(to+2)}},toSig(Xr){const{Err:eo}=DER,to=typeof Xr=="string"?h2b(Xr):Xr;if(!isBytes$3(to))throw new Error("ui8a expected");let ro=to.length;if(ro<2||to[0]!=48)throw new eo("Invalid signature tag");if(to[1]!==ro-2)throw new eo("Invalid signature: incorrect length");const{d:no,l:io}=DER._parseInt(to.subarray(2)),{d:oo,l:ao}=DER._parseInt(io);if(ao.length)throw new eo("Invalid signature: left bytes after parsing");return{r:no,s:oo}},hexFromSig(Xr){const eo=co=>Number.parseInt(co[0],16)&8?"00"+co:co,to=co=>{const lo=co.toString(16);return lo.length&1?`0${lo}`:lo},ro=eo(to(Xr.s)),no=eo(to(Xr.r)),io=ro.length/2,oo=no.length/2,ao=to(io),so=to(oo);return`30${to(oo+io+4)}02${so}${no}02${ao}${ro}`}},_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function weierstrassPoints(Xr){const eo=validatePointOpts(Xr),{Fp:to}=eo,ro=eo.toBytes||((bo,wo,Eo)=>{const $o=wo.toAffine();return concatBytes$2(Uint8Array.from([4]),to.toBytes($o.x),to.toBytes($o.y))}),no=eo.fromBytes||(bo=>{const wo=bo.subarray(1),Eo=to.fromBytes(wo.subarray(0,to.BYTES)),$o=to.fromBytes(wo.subarray(to.BYTES,2*to.BYTES));return{x:Eo,y:$o}});function io(bo){const{a:wo,b:Eo}=eo,$o=to.sqr(bo),Co=to.mul($o,bo);return to.add(to.add(Co,to.mul(bo,wo)),Eo)}if(!to.eql(to.sqr(eo.Gy),io(eo.Gx)))throw new Error("bad generator point: equation left != right");function oo(bo){return typeof bo=="bigint"&&_0nto.eql(Ro,to.ZERO);return Co(Eo)&&Co($o)?uo.ZERO:new uo(Eo,$o,to.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(wo){const Eo=to.invertBatch(wo.map($o=>$o.pz));return wo.map(($o,Co)=>$o.toAffine(Eo[Co])).map(uo.fromAffine)}static fromHex(wo){const Eo=uo.fromAffine(no(ensureBytes$2("pointHex",wo)));return Eo.assertValidity(),Eo}static fromPrivateKey(wo){return uo.BASE.multiply(so(wo))}_setWindowSize(wo){this._WINDOW_SIZE=wo,co.delete(this)}assertValidity(){if(this.is0()){if(eo.allowInfinityPoint&&!to.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:wo,y:Eo}=this.toAffine();if(!to.isValid(wo)||!to.isValid(Eo))throw new Error("bad point: x or y not FE");const $o=to.sqr(Eo),Co=io(wo);if(!to.eql($o,Co))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:wo}=this.toAffine();if(to.isOdd)return!to.isOdd(wo);throw new Error("Field doesn't support isOdd")}equals(wo){lo(wo);const{px:Eo,py:$o,pz:Co}=this,{px:Ro,py:Oo,pz:jo}=wo,Bo=to.eql(to.mul(Eo,jo),to.mul(Ro,Co)),Mo=to.eql(to.mul($o,jo),to.mul(Oo,Co));return Bo&&Mo}negate(){return new uo(this.px,to.neg(this.py),this.pz)}double(){const{a:wo,b:Eo}=eo,$o=to.mul(Eo,_3n),{px:Co,py:Ro,pz:Oo}=this;let jo=to.ZERO,Bo=to.ZERO,Mo=to.ZERO,Fo=to.mul(Co,Co),Wo=to.mul(Ro,Ro),Jo=to.mul(Oo,Oo),Po=to.mul(Co,Ro);return Po=to.add(Po,Po),Mo=to.mul(Co,Oo),Mo=to.add(Mo,Mo),jo=to.mul(wo,Mo),Bo=to.mul($o,Jo),Bo=to.add(jo,Bo),jo=to.sub(Wo,Bo),Bo=to.add(Wo,Bo),Bo=to.mul(jo,Bo),jo=to.mul(Po,jo),Mo=to.mul($o,Mo),Jo=to.mul(wo,Jo),Po=to.sub(Fo,Jo),Po=to.mul(wo,Po),Po=to.add(Po,Mo),Mo=to.add(Fo,Fo),Fo=to.add(Mo,Fo),Fo=to.add(Fo,Jo),Fo=to.mul(Fo,Po),Bo=to.add(Bo,Fo),Jo=to.mul(Ro,Oo),Jo=to.add(Jo,Jo),Fo=to.mul(Jo,Po),jo=to.sub(jo,Fo),Mo=to.mul(Jo,Wo),Mo=to.add(Mo,Mo),Mo=to.add(Mo,Mo),new uo(jo,Bo,Mo)}add(wo){lo(wo);const{px:Eo,py:$o,pz:Co}=this,{px:Ro,py:Oo,pz:jo}=wo;let Bo=to.ZERO,Mo=to.ZERO,Fo=to.ZERO;const Wo=eo.a,Jo=to.mul(eo.b,_3n);let Po=to.mul(Eo,Ro),fo=to.mul($o,Oo),yo=to.mul(Co,jo),vo=to.add(Eo,$o),_o=to.add(Ro,Oo);vo=to.mul(vo,_o),_o=to.add(Po,fo),vo=to.sub(vo,_o),_o=to.add(Eo,Co);let So=to.add(Ro,jo);return _o=to.mul(_o,So),So=to.add(Po,yo),_o=to.sub(_o,So),So=to.add($o,Co),Bo=to.add(Oo,jo),So=to.mul(So,Bo),Bo=to.add(fo,yo),So=to.sub(So,Bo),Fo=to.mul(Wo,_o),Bo=to.mul(Jo,yo),Fo=to.add(Bo,Fo),Bo=to.sub(fo,Fo),Fo=to.add(fo,Fo),Mo=to.mul(Bo,Fo),fo=to.add(Po,Po),fo=to.add(fo,Po),yo=to.mul(Wo,yo),_o=to.mul(Jo,_o),fo=to.add(fo,yo),yo=to.sub(Po,yo),yo=to.mul(Wo,yo),_o=to.add(_o,yo),Po=to.mul(fo,_o),Mo=to.add(Mo,Po),Po=to.mul(So,_o),Bo=to.mul(vo,Bo),Bo=to.sub(Bo,Po),Po=to.mul(vo,fo),Fo=to.mul(So,Fo),Fo=to.add(Fo,Po),new uo(Bo,Mo,Fo)}subtract(wo){return this.add(wo.negate())}is0(){return this.equals(uo.ZERO)}wNAF(wo){return go.wNAFCached(this,co,wo,Eo=>{const $o=to.invertBatch(Eo.map(Co=>Co.pz));return Eo.map((Co,Ro)=>Co.toAffine($o[Ro])).map(uo.fromAffine)})}multiplyUnsafe(wo){const Eo=uo.ZERO;if(wo===_0n)return Eo;if(ao(wo),wo===_1n)return this;const{endo:$o}=eo;if(!$o)return go.unsafeLadder(this,wo);let{k1neg:Co,k1:Ro,k2neg:Oo,k2:jo}=$o.splitScalar(wo),Bo=Eo,Mo=Eo,Fo=this;for(;Ro>_0n||jo>_0n;)Ro&_1n&&(Bo=Bo.add(Fo)),jo&_1n&&(Mo=Mo.add(Fo)),Fo=Fo.double(),Ro>>=_1n,jo>>=_1n;return Co&&(Bo=Bo.negate()),Oo&&(Mo=Mo.negate()),Mo=new uo(to.mul(Mo.px,$o.beta),Mo.py,Mo.pz),Bo.add(Mo)}multiply(wo){ao(wo);let Eo=wo,$o,Co;const{endo:Ro}=eo;if(Ro){const{k1neg:Oo,k1:jo,k2neg:Bo,k2:Mo}=Ro.splitScalar(Eo);let{p:Fo,f:Wo}=this.wNAF(jo),{p:Jo,f:Po}=this.wNAF(Mo);Fo=go.constTimeNegate(Oo,Fo),Jo=go.constTimeNegate(Bo,Jo),Jo=new uo(to.mul(Jo.px,Ro.beta),Jo.py,Jo.pz),$o=Fo.add(Jo),Co=Wo.add(Po)}else{const{p:Oo,f:jo}=this.wNAF(Eo);$o=Oo,Co=jo}return uo.normalizeZ([$o,Co])[0]}multiplyAndAddUnsafe(wo,Eo,$o){const Co=uo.BASE,Ro=(jo,Bo)=>Bo===_0n||Bo===_1n||!jo.equals(Co)?jo.multiplyUnsafe(Bo):jo.multiply(Bo),Oo=Ro(this,Eo).add(Ro(wo,$o));return Oo.is0()?void 0:Oo}toAffine(wo){const{px:Eo,py:$o,pz:Co}=this,Ro=this.is0();wo==null&&(wo=Ro?to.ONE:to.inv(Co));const Oo=to.mul(Eo,wo),jo=to.mul($o,wo),Bo=to.mul(Co,wo);if(Ro)return{x:to.ZERO,y:to.ZERO};if(!to.eql(Bo,to.ONE))throw new Error("invZ was invalid");return{x:Oo,y:jo}}isTorsionFree(){const{h:wo,isTorsionFree:Eo}=eo;if(wo===_1n)return!0;if(Eo)return Eo(uo,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:wo,clearCofactor:Eo}=eo;return wo===_1n?this:Eo?Eo(uo,this):this.multiplyUnsafe(eo.h)}toRawBytes(wo=!0){return this.assertValidity(),ro(uo,this,wo)}toHex(wo=!0){return bytesToHex$1(this.toRawBytes(wo))}}uo.BASE=new uo(eo.Gx,eo.Gy,to.ONE),uo.ZERO=new uo(to.ZERO,to.ONE,to.ZERO);const ho=eo.nBitLength,go=wNAF(uo,eo.endo?Math.ceil(ho/2):ho);return{CURVE:eo,ProjectivePoint:uo,normPrivateKeyToScalar:so,weierstrassEquation:io,isWithinCurveOrder:oo}}function validateOpts$1(Xr){const eo=validateBasic(Xr);return validateObject$1(eo,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...eo})}function weierstrass(Xr){const eo=validateOpts$1(Xr),{Fp:to,n:ro}=eo,no=to.BYTES+1,io=2*to.BYTES+1;function oo(_o){return _0n<_o&&_obytesToHex$1(numberToBytesBE$1(_o,eo.nByteLength));function bo(_o){const So=ro>>_1n;return _o>So}function wo(_o){return bo(_o)?ao(-_o):_o}const Eo=(_o,So,To)=>bytesToNumberBE$1(_o.slice(So,To));class $o{constructor(So,To,Ao){this.r=So,this.s=To,this.recovery=Ao,this.assertValidity()}static fromCompact(So){const To=eo.nByteLength;return So=ensureBytes$2("compactSignature",So,To*2),new $o(Eo(So,0,To),Eo(So,To,2*To))}static fromDER(So){const{r:To,s:Ao}=DER.toSig(ensureBytes$2("DER",So));return new $o(To,Ao)}assertValidity(){if(!ho(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!ho(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(So){return new $o(this.r,this.s,So)}recoverPublicKey(So){const{r:To,s:Ao,recovery:ko}=this,mo=Mo(ensureBytes$2("msgHash",So));if(ko==null||![0,1,2,3].includes(ko))throw new Error("recovery id invalid");const Io=ko===2||ko===3?To+eo.n:To;if(Io>=to.ORDER)throw new Error("recovery id 2 or 3 invalid");const Do=ko&1?"03":"02",Lo=co.fromHex(Do+go(Io)),Ho=so(Io),Yo=ao(-mo*Ho),Xo=ao(Ao*Ho),qo=co.BASE.multiplyAndAddUnsafe(Lo,Yo,Xo);if(!qo)throw new Error("point at infinify");return qo.assertValidity(),qo}hasHighS(){return bo(this.s)}normalizeS(){return this.hasHighS()?new $o(this.r,ao(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return go(this.r)+go(this.s)}}const Co={isValidPrivateKey(_o){try{return lo(_o),!0}catch{return!1}},normPrivateKeyToScalar:lo,randomPrivateKey:()=>{const _o=getMinHashLength(eo.n);return mapHashToField(eo.randomBytes(_o),eo.n)},precompute(_o=8,So=co.BASE){return So._setWindowSize(_o),So.multiply(BigInt(3)),So}};function Ro(_o,So=!0){return co.fromPrivateKey(_o).toRawBytes(So)}function Oo(_o){const So=isBytes$3(_o),To=typeof _o=="string",Ao=(So||To)&&_o.length;return So?Ao===no||Ao===io:To?Ao===2*no||Ao===2*io:_o instanceof co}function jo(_o,So,To=!0){if(Oo(_o))throw new Error("first arg must be private key");if(!Oo(So))throw new Error("second arg must be public key");return co.fromHex(So).multiply(lo(_o)).toRawBytes(To)}const Bo=eo.bits2int||function(_o){const So=bytesToNumberBE$1(_o),To=_o.length*8-eo.nBitLength;return To>0?So>>BigInt(To):So},Mo=eo.bits2int_modN||function(_o){return ao(Bo(_o))},Fo=bitMask$1(eo.nBitLength);function Wo(_o){if(typeof _o!="bigint")throw new Error("bigint expected");if(!(_0n<=_o&&_oQo in To))throw new Error("sign() legacy options not supported");const{hash:Ao,randomBytes:ko}=eo;let{lowS:mo,prehash:Io,extraEntropy:Do}=To;mo==null&&(mo=!0),_o=ensureBytes$2("msgHash",_o),Io&&(_o=ensureBytes$2("prehashed msgHash",Ao(_o)));const Lo=Mo(_o),Ho=lo(So),Yo=[Wo(Ho),Wo(Lo)];if(Do!=null){const Qo=Do===!0?ko(to.BYTES):Do;Yo.push(ensureBytes$2("extraEntropy",Qo))}const Xo=concatBytes$2(...Yo),qo=Lo;function Ko(Qo){const zo=Bo(Qo);if(!ho(zo))return;const ga=so(zo),$a=co.BASE.multiply(zo).toAffine(),Sl=ao($a.x);if(Sl===_0n)return;const El=ao(ga*ao(qo+Sl*Ho));if(El===_0n)return;let Tl=($a.x===Sl?0:2)|Number($a.y&_1n),Il=El;return mo&&bo(El)&&(Il=wo(El),Tl^=1),new $o(Sl,Il,Tl)}return{seed:Xo,k2sig:Ko}}const Po={lowS:eo.lowS,prehash:!1},fo={lowS:eo.lowS,prehash:!1};function yo(_o,So,To=Po){const{seed:Ao,k2sig:ko}=Jo(_o,So,To),mo=eo;return createHmacDrbg$1(mo.hash.outputLen,mo.nByteLength,mo.hmac)(Ao,ko)}co.BASE._setWindowSize(8);function vo(_o,So,To,Ao=fo){var $a;const ko=_o;if(So=ensureBytes$2("msgHash",So),To=ensureBytes$2("publicKey",To),"strict"in Ao)throw new Error("options.strict was renamed to lowS");const{lowS:mo,prehash:Io}=Ao;let Do,Lo;try{if(typeof ko=="string"||isBytes$3(ko))try{Do=$o.fromDER(ko)}catch(Sl){if(!(Sl instanceof DER.Err))throw Sl;Do=$o.fromCompact(ko)}else if(typeof ko=="object"&&typeof ko.r=="bigint"&&typeof ko.s=="bigint"){const{r:Sl,s:El}=ko;Do=new $o(Sl,El)}else throw new Error("PARSE");Lo=co.fromHex(To)}catch(Sl){if(Sl.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(mo&&Do.hasHighS())return!1;Io&&(So=eo.hash(So));const{r:Ho,s:Yo}=Do,Xo=Mo(So),qo=so(Yo),Ko=ao(Xo*qo),Qo=ao(Ho*qo),zo=($a=co.BASE.multiplyAndAddUnsafe(Lo,Ko,Qo))==null?void 0:$a.toAffine();return zo?ao(zo.x)===Ho:!1}return{CURVE:eo,getPublicKey:Ro,getSharedSecret:jo,sign:yo,verify:vo,ProjectivePoint:co,Signature:$o,utils:Co}}function SWUFpSqrtRatio(Xr,eo){const to=Xr.ORDER;let ro=_0n;for(let bo=to-_1n;bo%_2n===_0n;bo/=_2n)ro+=_1n;const no=ro,io=_2n<{let Eo=uo,$o=Xr.pow(wo,co),Co=Xr.sqr($o);Co=Xr.mul(Co,wo);let Ro=Xr.mul(bo,Co);Ro=Xr.pow(Ro,so),Ro=Xr.mul(Ro,$o),$o=Xr.mul(Ro,wo),Co=Xr.mul(Ro,bo);let Oo=Xr.mul(Co,$o);Ro=Xr.pow(Oo,lo);let jo=Xr.eql(Ro,Xr.ONE);$o=Xr.mul(Co,ho),Ro=Xr.mul(Oo,Eo),Co=Xr.cmov($o,Co,jo),Oo=Xr.cmov(Ro,Oo,jo);for(let Bo=no;Bo>_1n;Bo--){let Mo=Bo-_2n;Mo=_2n<{let Co=Xr.sqr($o);const Ro=Xr.mul(Eo,$o);Co=Xr.mul(Co,Ro);let Oo=Xr.pow(Co,bo);Oo=Xr.mul(Oo,Ro);const jo=Xr.mul(Oo,wo),Bo=Xr.mul(Xr.sqr(Oo),$o),Mo=Xr.eql(Bo,Eo);let Fo=Xr.cmov(jo,Oo,Mo);return{isValid:Mo,value:Fo}}}return go}function mapToCurveSimpleSWU(Xr,eo){if(validateField(Xr),!Xr.isValid(eo.A)||!Xr.isValid(eo.B)||!Xr.isValid(eo.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const to=SWUFpSqrtRatio(Xr,eo.Z);if(!Xr.isOdd)throw new Error("Fp.isOdd is not implemented!");return ro=>{let no,io,oo,ao,so,co,lo,uo;no=Xr.sqr(ro),no=Xr.mul(no,eo.Z),io=Xr.sqr(no),io=Xr.add(io,no),oo=Xr.add(io,Xr.ONE),oo=Xr.mul(oo,eo.B),ao=Xr.cmov(eo.Z,Xr.neg(io),!Xr.eql(io,Xr.ZERO)),ao=Xr.mul(ao,eo.A),io=Xr.sqr(oo),co=Xr.sqr(ao),so=Xr.mul(co,eo.A),io=Xr.add(io,so),io=Xr.mul(io,oo),co=Xr.mul(co,ao),so=Xr.mul(co,eo.B),io=Xr.add(io,so),lo=Xr.mul(no,oo);const{isValid:ho,value:go}=to(io,co);uo=Xr.mul(no,ro),uo=Xr.mul(uo,go),lo=Xr.cmov(lo,oo,ho),uo=Xr.cmov(uo,go,ho);const bo=Xr.isOdd(ro)===Xr.isOdd(uo);return uo=Xr.cmov(Xr.neg(uo),uo,bo),lo=Xr.div(lo,ao),{x:lo,y:uo}}}const weierstrass$1=Object.freeze(Object.defineProperty({__proto__:null,DER,SWUFpSqrtRatio,mapToCurveSimpleSWU,weierstrass,weierstrassPoints},Symbol.toStringTag,{value:"Module"}));function isInteger(Xr){return INTEGER_REGEX.test(Xr)}var INTEGER_REGEX=/^-?[0-9]+$/;function isNumber(Xr){return NUMBER_REGEX.test(Xr)}var NUMBER_REGEX=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function isSafeNumber(Xr,eo){var to=parseFloat(Xr),ro=String(to),no=extractSignificantDigits(Xr),io=extractSignificantDigits(ro);if(no===io)return!0;if((eo==null?void 0:eo.approx)===!0){var oo=14;if(!isInteger(Xr)&&io.length>=oo&&no.startsWith(io.substring(0,oo)))return!0}return!1}var UnsafeNumberReason=function(Xr){return Xr.underflow="underflow",Xr.overflow="overflow",Xr.truncate_integer="truncate_integer",Xr.truncate_float="truncate_float",Xr}({});function getUnsafeNumberReason(Xr){if(!isSafeNumber(Xr,{approx:!1})){if(isInteger(Xr))return UnsafeNumberReason.truncate_integer;var eo=parseFloat(Xr);return isFinite(eo)?eo===0?UnsafeNumberReason.underflow:UnsafeNumberReason.truncate_float:UnsafeNumberReason.overflow}}function extractSignificantDigits(Xr){return Xr.replace(EXPONENTIAL_PART_REGEX,"").replace(DOT_REGEX,"").replace(TRAILING_ZEROS_REGEX,"").replace(LEADING_MINUS_AND_ZEROS_REGEX,"")}var EXPONENTIAL_PART_REGEX=/[eE][+-]?\d+$/,LEADING_MINUS_AND_ZEROS_REGEX=/^-?(0*)?/,DOT_REGEX=/\./,TRAILING_ZEROS_REGEX=/0+$/;function _typeof$3(Xr){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(eo){return typeof eo}:function(eo){return eo&&typeof Symbol=="function"&&eo.constructor===Symbol&&eo!==Symbol.prototype?"symbol":typeof eo},_typeof$3(Xr)}function _classCallCheck(Xr,eo){if(!(Xr instanceof eo))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(Xr,eo){for(var to=0;toXr.length)&&(eo=Xr.length);for(var to=0,ro=new Array(eo);to2&&arguments[2]!==void 0?arguments[2]:parseLosslessNumber,ro=0,no=ao();return bo(no),Eo(),eo?revive(no,eo):no;function io(){if(Xr.charCodeAt(ro)===codeOpeningBrace){ro++,co();for(var vo={},_o=!0;rovo)return to(Xr.slice(vo,ro))}function ho(){if(Xr.charCodeAt(ro)!==codeComma)throw new SyntaxError("Comma ',' expected after value ".concat(yo()));ro++}function go(){if(Xr.charCodeAt(ro)!==codeColon)throw new SyntaxError("Colon ':' expected after property name ".concat(yo()));ro++}function bo(vo){if(vo===void 0)throw new SyntaxError("JSON value expected ".concat(yo()))}function wo(vo){if(vo===void 0)throw new SyntaxError("Array item expected ".concat(yo()))}function Eo(){if(ro=codeZero&&Xr<=codeNine||Xr>=codeUppercaseA&&Xr<=codeUppercaseF||Xr>=codeLowercaseA&&Xr<=codeLowercaseF}function isDigit(Xr){return Xr>=codeZero&&Xr<=codeNine}function isNonZeroDigit(Xr){return Xr>=codeOne&&Xr<=codeNine}function isValidStringCharacter(Xr){return Xr>=32&&Xr<=1114111}function isDeepEqual(Xr,eo){if(Xr===eo)return!0;if(Array.isArray(Xr)&&Array.isArray(eo))return Xr.length===eo.length&&Xr.every(function(ro,no){return isDeepEqual(ro,eo[no])});if(isObject$1(Xr)&&isObject$1(eo)){var to=_toConsumableArray(new Set([].concat(_toConsumableArray(Object.keys(Xr)),_toConsumableArray(Object.keys(eo)))));return to.every(function(ro){return isDeepEqual(Xr[ro],eo[ro])})}return!1}function isObject$1(Xr){return _typeof$1(Xr)==="object"&&Xr!==null}var escapeCharacters={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "},codeBackslash=92,codeOpeningBrace=123,codeClosingBrace=125,codeOpeningBracket=91,codeClosingBracket=93,codeSpace=32,codeNewline=10,codeTab=9,codeReturn=13,codeDoubleQuote=34,codePlus=43,codeMinus=45,codeZero=48,codeOne=49,codeNine=57,codeComma=44,codeDot=46,codeColon=58,codeUppercaseA=65,codeLowercaseA=97,codeUppercaseE=69,codeLowercaseE=101,codeUppercaseF=70,codeLowercaseF=102;function _typeof(Xr){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(eo){return typeof eo}:function(eo){return eo&&typeof Symbol=="function"&&eo.constructor===Symbol&&eo!==Symbol.prototype?"symbol":typeof eo},_typeof(Xr)}function stringify(Xr,eo,to,ro){var no=resolveSpace(to),io=typeof eo=="function"?eo.call({"":Xr},"",Xr):Xr;return oo(io,"");function oo(lo,uo){if(Array.isArray(ro)){var ho=ro.find(function(bo){return bo.test(lo)});if(ho){var go=ho.stringify(lo);if(typeof go!="string"||!isNumber(go))throw new Error("Invalid JSON number: output of a number stringifier must be a string containing a JSON number "+"(output: ".concat(go,")"));return go}}if(typeof lo=="boolean"||typeof lo=="number"||typeof lo=="string"||lo===null||lo instanceof Date||lo instanceof Boolean||lo instanceof Number||lo instanceof String)return JSON.stringify(lo);if(lo&&lo.isLosslessNumber||typeof lo=="bigint")return lo.toString();if(Array.isArray(lo))return ao(lo,uo);if(lo&&_typeof(lo)==="object")return so(lo,uo)}function ao(lo,uo){if(lo.length===0)return"[]";for(var ho=no?uo+no:void 0,go=no?`[ +`:"[",bo=0;bo{if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon MDS matrix row: ${yo}`);return yo.map(vo=>{if(typeof vo!="bigint")throw new Error(`Poseidon MDS matrix value=${vo}`);return eo.create(vo)})});if(ro!==void 0&&typeof ro!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${ro}`);if(io%2!==0)throw new Error(`Poseidon roundsFull is not even: ${io}`);const lo=io+oo;if(!Array.isArray(no)||no.length!==lo)throw new Error("Poseidon: wrong round constants");const fo=no.map(yo=>{if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon wrong round constants: ${yo}`);return yo.map(vo=>{if(typeof vo!="bigint"||!eo.isValid(vo))throw new Error(`Poseidon wrong round constant=${vo}`);return eo.create(vo)})});if(!ao||![3,5,7].includes(ao))throw new Error(`Poseidon wrong sboxPower=${ao}`);const ho=BigInt(ao);let go=yo=>FpPow(eo,yo,ho);return ao===3?go=yo=>eo.mul(eo.sqrN(yo),yo):ao===5&&(go=yo=>eo.mul(eo.sqrN(eo.sqrN(yo)),yo)),Object.freeze({...Xr,rounds:lo,sboxFn:go,roundConstants:fo,mds:co})}function splitConstants(Xr,eo){if(typeof eo!="number")throw new Error("poseidonSplitConstants: wrong t");if(!Array.isArray(Xr)||Xr.length%eo)throw new Error("poseidonSplitConstants: wrong rc");const to=[];let ro=[];for(let no=0;no(go=go.map((wo,Eo)=>to.add(wo,no[vo][Eo])),yo?go=go.map(wo=>ao(wo)):go[lo]=ao(go[lo]),go=ro.map(wo=>wo.reduce((Eo,ko,Ao)=>to.add(Eo,to.mulN(ko,go[Ao])),to.ZERO)),go),ho=function(yo){if(!Array.isArray(yo)||yo.length!==so)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${so})`);yo=yo.map(wo=>{if(typeof wo!="bigint")throw new Error(`Poseidon: wrong value=${wo} (${typeof wo})`);return to.create(wo)});let vo=0;for(let wo=0;wo=0;)Xr[eo]=0}const STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,BL_CODES$1=19,HEAP_SIZE$1=2*L_CODES$1+1,MAX_BITS$1=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),extra_dbits=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),extra_blbits=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl_order=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DIST_CODE_LEN=512,static_ltree=new Array((L_CODES$1+2)*2);zero$1(static_ltree);const static_dtree=new Array(D_CODES$1*2);zero$1(static_dtree);const _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);const _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);const base_length=new Array(LENGTH_CODES$1);zero$1(base_length);const base_dist=new Array(D_CODES$1);zero$1(base_dist);function StaticTreeDesc(Xr,eo,to,ro,no){this.static_tree=Xr,this.extra_bits=eo,this.extra_base=to,this.elems=ro,this.max_length=no,this.has_stree=Xr&&Xr.length}let static_l_desc,static_d_desc,static_bl_desc;function TreeDesc(Xr,eo){this.dyn_tree=Xr,this.max_code=0,this.stat_desc=eo}const d_code=Xr=>Xr<256?_dist_code[Xr]:_dist_code[256+(Xr>>>7)],put_short=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo&255,Xr.pending_buf[Xr.pending++]=eo>>>8&255},send_bits=(Xr,eo,to)=>{Xr.bi_valid>Buf_size-to?(Xr.bi_buf|=eo<>Buf_size-Xr.bi_valid,Xr.bi_valid+=to-Buf_size):(Xr.bi_buf|=eo<{send_bits(Xr,to[eo*2],to[eo*2+1])},bi_reverse=(Xr,eo)=>{let to=0;do to|=Xr&1,Xr>>>=1,to<<=1;while(--eo>0);return to>>>1},bi_flush=Xr=>{Xr.bi_valid===16?(put_short(Xr,Xr.bi_buf),Xr.bi_buf=0,Xr.bi_valid=0):Xr.bi_valid>=8&&(Xr.pending_buf[Xr.pending++]=Xr.bi_buf&255,Xr.bi_buf>>=8,Xr.bi_valid-=8)},gen_bitlen=(Xr,eo)=>{const to=eo.dyn_tree,ro=eo.max_code,no=eo.stat_desc.static_tree,io=eo.stat_desc.has_stree,oo=eo.stat_desc.extra_bits,ao=eo.stat_desc.extra_base,so=eo.stat_desc.max_length;let co,lo,fo,ho,go,yo,vo=0;for(ho=0;ho<=MAX_BITS$1;ho++)Xr.bl_count[ho]=0;for(to[Xr.heap[Xr.heap_max]*2+1]=0,co=Xr.heap_max+1;coso&&(ho=so,vo++),to[lo*2+1]=ho,!(lo>ro)&&(Xr.bl_count[ho]++,go=0,lo>=ao&&(go=oo[lo-ao]),yo=to[lo*2],Xr.opt_len+=yo*(ho+go),io&&(Xr.static_len+=yo*(no[lo*2+1]+go)));if(vo!==0){do{for(ho=so-1;Xr.bl_count[ho]===0;)ho--;Xr.bl_count[ho]--,Xr.bl_count[ho+1]+=2,Xr.bl_count[so]--,vo-=2}while(vo>0);for(ho=so;ho!==0;ho--)for(lo=Xr.bl_count[ho];lo!==0;)fo=Xr.heap[--co],!(fo>ro)&&(to[fo*2+1]!==ho&&(Xr.opt_len+=(ho-to[fo*2+1])*to[fo*2],to[fo*2+1]=ho),lo--)}},gen_codes=(Xr,eo,to)=>{const ro=new Array(MAX_BITS$1+1);let no=0,io,oo;for(io=1;io<=MAX_BITS$1;io++)no=no+to[io-1]<<1,ro[io]=no;for(oo=0;oo<=eo;oo++){let ao=Xr[oo*2+1];ao!==0&&(Xr[oo*2]=bi_reverse(ro[ao]++,ao))}},tr_static_init=()=>{let Xr,eo,to,ro,no;const io=new Array(MAX_BITS$1+1);for(to=0,ro=0;ro>=7;ro{let eo;for(eo=0;eo{Xr.bi_valid>8?put_short(Xr,Xr.bi_buf):Xr.bi_valid>0&&(Xr.pending_buf[Xr.pending++]=Xr.bi_buf),Xr.bi_buf=0,Xr.bi_valid=0},smaller=(Xr,eo,to,ro)=>{const no=eo*2,io=to*2;return Xr[no]{const ro=Xr.heap[to];let no=to<<1;for(;no<=Xr.heap_len&&(no{let ro,no,io=0,oo,ao;if(Xr.sym_next!==0)do ro=Xr.pending_buf[Xr.sym_buf+io++]&255,ro+=(Xr.pending_buf[Xr.sym_buf+io++]&255)<<8,no=Xr.pending_buf[Xr.sym_buf+io++],ro===0?send_code(Xr,no,eo):(oo=_length_code[no],send_code(Xr,oo+LITERALS$1+1,eo),ao=extra_lbits[oo],ao!==0&&(no-=base_length[oo],send_bits(Xr,no,ao)),ro--,oo=d_code(ro),send_code(Xr,oo,to),ao=extra_dbits[oo],ao!==0&&(ro-=base_dist[oo],send_bits(Xr,ro,ao)));while(io{const to=eo.dyn_tree,ro=eo.stat_desc.static_tree,no=eo.stat_desc.has_stree,io=eo.stat_desc.elems;let oo,ao,so=-1,co;for(Xr.heap_len=0,Xr.heap_max=HEAP_SIZE$1,oo=0;oo>1;oo>=1;oo--)pqdownheap(Xr,to,oo);co=io;do oo=Xr.heap[1],Xr.heap[1]=Xr.heap[Xr.heap_len--],pqdownheap(Xr,to,1),ao=Xr.heap[1],Xr.heap[--Xr.heap_max]=oo,Xr.heap[--Xr.heap_max]=ao,to[co*2]=to[oo*2]+to[ao*2],Xr.depth[co]=(Xr.depth[oo]>=Xr.depth[ao]?Xr.depth[oo]:Xr.depth[ao])+1,to[oo*2+1]=to[ao*2+1]=co,Xr.heap[1]=co++,pqdownheap(Xr,to,1);while(Xr.heap_len>=2);Xr.heap[--Xr.heap_max]=Xr.heap[1],gen_bitlen(Xr,eo),gen_codes(to,so,Xr.bl_count)},scan_tree=(Xr,eo,to)=>{let ro,no=-1,io,oo=eo[0*2+1],ao=0,so=7,co=4;for(oo===0&&(so=138,co=3),eo[(to+1)*2+1]=65535,ro=0;ro<=to;ro++)io=oo,oo=eo[(ro+1)*2+1],!(++ao{let ro,no=-1,io,oo=eo[0*2+1],ao=0,so=7,co=4;for(oo===0&&(so=138,co=3),ro=0;ro<=to;ro++)if(io=oo,oo=eo[(ro+1)*2+1],!(++ao{let eo;for(scan_tree(Xr,Xr.dyn_ltree,Xr.l_desc.max_code),scan_tree(Xr,Xr.dyn_dtree,Xr.d_desc.max_code),build_tree(Xr,Xr.bl_desc),eo=BL_CODES$1-1;eo>=3&&Xr.bl_tree[bl_order[eo]*2+1]===0;eo--);return Xr.opt_len+=3*(eo+1)+5+5+4,eo},send_all_trees=(Xr,eo,to,ro)=>{let no;for(send_bits(Xr,eo-257,5),send_bits(Xr,to-1,5),send_bits(Xr,ro-4,4),no=0;no{let eo=4093624447,to;for(to=0;to<=31;to++,eo>>>=1)if(eo&1&&Xr.dyn_ltree[to*2]!==0)return Z_BINARY;if(Xr.dyn_ltree[9*2]!==0||Xr.dyn_ltree[10*2]!==0||Xr.dyn_ltree[13*2]!==0)return Z_TEXT;for(to=32;to{static_init_done||(tr_static_init(),static_init_done=!0),Xr.l_desc=new TreeDesc(Xr.dyn_ltree,static_l_desc),Xr.d_desc=new TreeDesc(Xr.dyn_dtree,static_d_desc),Xr.bl_desc=new TreeDesc(Xr.bl_tree,static_bl_desc),Xr.bi_buf=0,Xr.bi_valid=0,init_block(Xr)},_tr_stored_block$1=(Xr,eo,to,ro)=>{send_bits(Xr,(STORED_BLOCK<<1)+(ro?1:0),3),bi_windup(Xr),put_short(Xr,to),put_short(Xr,~to),to&&Xr.pending_buf.set(Xr.window.subarray(eo,eo+to),Xr.pending),Xr.pending+=to},_tr_align$1=Xr=>{send_bits(Xr,STATIC_TREES<<1,3),send_code(Xr,END_BLOCK,static_ltree),bi_flush(Xr)},_tr_flush_block$1=(Xr,eo,to,ro)=>{let no,io,oo=0;Xr.level>0?(Xr.strm.data_type===Z_UNKNOWN$1&&(Xr.strm.data_type=detect_data_type(Xr)),build_tree(Xr,Xr.l_desc),build_tree(Xr,Xr.d_desc),oo=build_bl_tree(Xr),no=Xr.opt_len+3+7>>>3,io=Xr.static_len+3+7>>>3,io<=no&&(no=io)):no=io=to+5,to+4<=no&&eo!==-1?_tr_stored_block$1(Xr,eo,to,ro):Xr.strategy===Z_FIXED$1||io===no?(send_bits(Xr,(STATIC_TREES<<1)+(ro?1:0),3),compress_block(Xr,static_ltree,static_dtree)):(send_bits(Xr,(DYN_TREES<<1)+(ro?1:0),3),send_all_trees(Xr,Xr.l_desc.max_code+1,Xr.d_desc.max_code+1,oo+1),compress_block(Xr,Xr.dyn_ltree,Xr.dyn_dtree)),init_block(Xr),ro&&bi_windup(Xr)},_tr_tally$1=(Xr,eo,to)=>(Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=eo,Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=eo>>8,Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=to,eo===0?Xr.dyn_ltree[to*2]++:(Xr.matches++,eo--,Xr.dyn_ltree[(_length_code[to]+LITERALS$1+1)*2]++,Xr.dyn_dtree[d_code(eo)*2]++),Xr.sym_next===Xr.sym_end);var _tr_init_1=_tr_init$1,_tr_stored_block_1=_tr_stored_block$1,_tr_flush_block_1=_tr_flush_block$1,_tr_tally_1=_tr_tally$1,_tr_align_1=_tr_align$1,trees={_tr_init:_tr_init_1,_tr_stored_block:_tr_stored_block_1,_tr_flush_block:_tr_flush_block_1,_tr_tally:_tr_tally_1,_tr_align:_tr_align_1};const adler32=(Xr,eo,to,ro)=>{let no=Xr&65535|0,io=Xr>>>16&65535|0,oo=0;for(;to!==0;){oo=to>2e3?2e3:to,to-=oo;do no=no+eo[ro++]|0,io=io+no|0;while(--oo);no%=65521,io%=65521}return no|io<<16|0};var adler32_1=adler32;const makeTable=()=>{let Xr,eo=[];for(var to=0;to<256;to++){Xr=to;for(var ro=0;ro<8;ro++)Xr=Xr&1?3988292384^Xr>>>1:Xr>>>1;eo[to]=Xr}return eo},crcTable=new Uint32Array(makeTable()),crc32=(Xr,eo,to,ro)=>{const no=crcTable,io=ro+to;Xr^=-1;for(let oo=ro;oo>>8^no[(Xr^eo[oo])&255];return Xr^-1};var crc32_1=crc32,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},constants$2={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init,_tr_stored_block,_tr_flush_block,_tr_tally,_tr_align}=trees,{Z_NO_FLUSH:Z_NO_FLUSH$2,Z_PARTIAL_FLUSH,Z_FULL_FLUSH:Z_FULL_FLUSH$1,Z_FINISH:Z_FINISH$3,Z_BLOCK:Z_BLOCK$1,Z_OK:Z_OK$3,Z_STREAM_END:Z_STREAM_END$3,Z_STREAM_ERROR:Z_STREAM_ERROR$2,Z_DATA_ERROR:Z_DATA_ERROR$2,Z_BUF_ERROR:Z_BUF_ERROR$1,Z_DEFAULT_COMPRESSION:Z_DEFAULT_COMPRESSION$1,Z_FILTERED,Z_HUFFMAN_ONLY,Z_RLE,Z_FIXED,Z_DEFAULT_STRATEGY:Z_DEFAULT_STRATEGY$1,Z_UNKNOWN,Z_DEFLATED:Z_DEFLATED$2}=constants$2,MAX_MEM_LEVEL=9,MAX_WBITS$1=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,GZIP_STATE=57,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3,err=(Xr,eo)=>(Xr.msg=messages[eo],eo),rank=Xr=>Xr*2-(Xr>4?9:0),zero=Xr=>{let eo=Xr.length;for(;--eo>=0;)Xr[eo]=0},slide_hash=Xr=>{let eo,to,ro,no=Xr.w_size;eo=Xr.hash_size,ro=eo;do to=Xr.head[--ro],Xr.head[ro]=to>=no?to-no:0;while(--eo);eo=no,ro=eo;do to=Xr.prev[--ro],Xr.prev[ro]=to>=no?to-no:0;while(--eo)};let HASH_ZLIB=(Xr,eo,to)=>(eo<{const eo=Xr.state;let to=eo.pending;to>Xr.avail_out&&(to=Xr.avail_out),to!==0&&(Xr.output.set(eo.pending_buf.subarray(eo.pending_out,eo.pending_out+to),Xr.next_out),Xr.next_out+=to,eo.pending_out+=to,Xr.total_out+=to,Xr.avail_out-=to,eo.pending-=to,eo.pending===0&&(eo.pending_out=0))},flush_block_only=(Xr,eo)=>{_tr_flush_block(Xr,Xr.block_start>=0?Xr.block_start:-1,Xr.strstart-Xr.block_start,eo),Xr.block_start=Xr.strstart,flush_pending(Xr.strm)},put_byte=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo},putShortMSB=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo>>>8&255,Xr.pending_buf[Xr.pending++]=eo&255},read_buf=(Xr,eo,to,ro)=>{let no=Xr.avail_in;return no>ro&&(no=ro),no===0?0:(Xr.avail_in-=no,eo.set(Xr.input.subarray(Xr.next_in,Xr.next_in+no),to),Xr.state.wrap===1?Xr.adler=adler32_1(Xr.adler,eo,no,to):Xr.state.wrap===2&&(Xr.adler=crc32_1(Xr.adler,eo,no,to)),Xr.next_in+=no,Xr.total_in+=no,no)},longest_match=(Xr,eo)=>{let to=Xr.max_chain_length,ro=Xr.strstart,no,io,oo=Xr.prev_length,ao=Xr.nice_match;const so=Xr.strstart>Xr.w_size-MIN_LOOKAHEAD?Xr.strstart-(Xr.w_size-MIN_LOOKAHEAD):0,co=Xr.window,lo=Xr.w_mask,fo=Xr.prev,ho=Xr.strstart+MAX_MATCH;let go=co[ro+oo-1],yo=co[ro+oo];Xr.prev_length>=Xr.good_match&&(to>>=2),ao>Xr.lookahead&&(ao=Xr.lookahead);do if(no=eo,!(co[no+oo]!==yo||co[no+oo-1]!==go||co[no]!==co[ro]||co[++no]!==co[ro+1])){ro+=2,no++;do;while(co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&rooo){if(Xr.match_start=eo,oo=io,io>=ao)break;go=co[ro+oo-1],yo=co[ro+oo]}}while((eo=fo[eo&lo])>so&&--to!==0);return oo<=Xr.lookahead?oo:Xr.lookahead},fill_window=Xr=>{const eo=Xr.w_size;let to,ro,no;do{if(ro=Xr.window_size-Xr.lookahead-Xr.strstart,Xr.strstart>=eo+(eo-MIN_LOOKAHEAD)&&(Xr.window.set(Xr.window.subarray(eo,eo+eo-ro),0),Xr.match_start-=eo,Xr.strstart-=eo,Xr.block_start-=eo,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart),slide_hash(Xr),ro+=eo),Xr.strm.avail_in===0)break;if(to=read_buf(Xr.strm,Xr.window,Xr.strstart+Xr.lookahead,ro),Xr.lookahead+=to,Xr.lookahead+Xr.insert>=MIN_MATCH)for(no=Xr.strstart-Xr.insert,Xr.ins_h=Xr.window[no],Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[no+1]);Xr.insert&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[no+MIN_MATCH-1]),Xr.prev[no&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=no,no++,Xr.insert--,!(Xr.lookahead+Xr.insert{let to=Xr.pending_buf_size-5>Xr.w_size?Xr.w_size:Xr.pending_buf_size-5,ro,no,io,oo=0,ao=Xr.strm.avail_in;do{if(ro=65535,io=Xr.bi_valid+42>>3,Xr.strm.avail_outno+Xr.strm.avail_in&&(ro=no+Xr.strm.avail_in),ro>io&&(ro=io),ro>8,Xr.pending_buf[Xr.pending-2]=~ro,Xr.pending_buf[Xr.pending-1]=~ro>>8,flush_pending(Xr.strm),no&&(no>ro&&(no=ro),Xr.strm.output.set(Xr.window.subarray(Xr.block_start,Xr.block_start+no),Xr.strm.next_out),Xr.strm.next_out+=no,Xr.strm.avail_out-=no,Xr.strm.total_out+=no,Xr.block_start+=no,ro-=no),ro&&(read_buf(Xr.strm,Xr.strm.output,Xr.strm.next_out,ro),Xr.strm.next_out+=ro,Xr.strm.avail_out-=ro,Xr.strm.total_out+=ro)}while(oo===0);return ao-=Xr.strm.avail_in,ao&&(ao>=Xr.w_size?(Xr.matches=2,Xr.window.set(Xr.strm.input.subarray(Xr.strm.next_in-Xr.w_size,Xr.strm.next_in),0),Xr.strstart=Xr.w_size,Xr.insert=Xr.strstart):(Xr.window_size-Xr.strstart<=ao&&(Xr.strstart-=Xr.w_size,Xr.window.set(Xr.window.subarray(Xr.w_size,Xr.w_size+Xr.strstart),0),Xr.matches<2&&Xr.matches++,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart)),Xr.window.set(Xr.strm.input.subarray(Xr.strm.next_in-ao,Xr.strm.next_in),Xr.strstart),Xr.strstart+=ao,Xr.insert+=ao>Xr.w_size-Xr.insert?Xr.w_size-Xr.insert:ao),Xr.block_start=Xr.strstart),Xr.high_waterio&&Xr.block_start>=Xr.w_size&&(Xr.block_start-=Xr.w_size,Xr.strstart-=Xr.w_size,Xr.window.set(Xr.window.subarray(Xr.w_size,Xr.w_size+Xr.strstart),0),Xr.matches<2&&Xr.matches++,io+=Xr.w_size,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart)),io>Xr.strm.avail_in&&(io=Xr.strm.avail_in),io&&(read_buf(Xr.strm,Xr.window,Xr.strstart,io),Xr.strstart+=io,Xr.insert+=io>Xr.w_size-Xr.insert?Xr.w_size-Xr.insert:io),Xr.high_water>3,io=Xr.pending_buf_size-io>65535?65535:Xr.pending_buf_size-io,to=io>Xr.w_size?Xr.w_size:io,no=Xr.strstart-Xr.block_start,(no>=to||(no||eo===Z_FINISH$3)&&eo!==Z_NO_FLUSH$2&&Xr.strm.avail_in===0&&no<=io)&&(ro=no>io?io:no,oo=eo===Z_FINISH$3&&Xr.strm.avail_in===0&&ro===no?1:0,_tr_stored_block(Xr,Xr.block_start,ro,oo),Xr.block_start+=ro,flush_pending(Xr.strm)),oo?BS_FINISH_STARTED:BS_NEED_MORE)},deflate_fast=(Xr,eo)=>{let to,ro;for(;;){if(Xr.lookahead=MIN_MATCH&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart),to!==0&&Xr.strstart-to<=Xr.w_size-MIN_LOOKAHEAD&&(Xr.match_length=longest_match(Xr,to)),Xr.match_length>=MIN_MATCH)if(ro=_tr_tally(Xr,Xr.strstart-Xr.match_start,Xr.match_length-MIN_MATCH),Xr.lookahead-=Xr.match_length,Xr.match_length<=Xr.max_lazy_match&&Xr.lookahead>=MIN_MATCH){Xr.match_length--;do Xr.strstart++,Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart;while(--Xr.match_length!==0);Xr.strstart++}else Xr.strstart+=Xr.match_length,Xr.match_length=0,Xr.ins_h=Xr.window[Xr.strstart],Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+1]);else ro=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++;if(ro&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=Xr.strstart{let to,ro,no;for(;;){if(Xr.lookahead=MIN_MATCH&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart),Xr.prev_length=Xr.match_length,Xr.prev_match=Xr.match_start,Xr.match_length=MIN_MATCH-1,to!==0&&Xr.prev_length4096)&&(Xr.match_length=MIN_MATCH-1)),Xr.prev_length>=MIN_MATCH&&Xr.match_length<=Xr.prev_length){no=Xr.strstart+Xr.lookahead-MIN_MATCH,ro=_tr_tally(Xr,Xr.strstart-1-Xr.prev_match,Xr.prev_length-MIN_MATCH),Xr.lookahead-=Xr.prev_length-1,Xr.prev_length-=2;do++Xr.strstart<=no&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart);while(--Xr.prev_length!==0);if(Xr.match_available=0,Xr.match_length=MIN_MATCH-1,Xr.strstart++,ro&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}else if(Xr.match_available){if(ro=_tr_tally(Xr,0,Xr.window[Xr.strstart-1]),ro&&flush_block_only(Xr,!1),Xr.strstart++,Xr.lookahead--,Xr.strm.avail_out===0)return BS_NEED_MORE}else Xr.match_available=1,Xr.strstart++,Xr.lookahead--}return Xr.match_available&&(ro=_tr_tally(Xr,0,Xr.window[Xr.strstart-1]),Xr.match_available=0),Xr.insert=Xr.strstart{let to,ro,no,io;const oo=Xr.window;for(;;){if(Xr.lookahead<=MAX_MATCH){if(fill_window(Xr),Xr.lookahead<=MAX_MATCH&&eo===Z_NO_FLUSH$2)return BS_NEED_MORE;if(Xr.lookahead===0)break}if(Xr.match_length=0,Xr.lookahead>=MIN_MATCH&&Xr.strstart>0&&(no=Xr.strstart-1,ro=oo[no],ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no])){io=Xr.strstart+MAX_MATCH;do;while(ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&noXr.lookahead&&(Xr.match_length=Xr.lookahead)}if(Xr.match_length>=MIN_MATCH?(to=_tr_tally(Xr,1,Xr.match_length-MIN_MATCH),Xr.lookahead-=Xr.match_length,Xr.strstart+=Xr.match_length,Xr.match_length=0):(to=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++),to&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=0,eo===Z_FINISH$3?(flush_block_only(Xr,!0),Xr.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):Xr.sym_next&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE},deflate_huff=(Xr,eo)=>{let to;for(;;){if(Xr.lookahead===0&&(fill_window(Xr),Xr.lookahead===0)){if(eo===Z_NO_FLUSH$2)return BS_NEED_MORE;break}if(Xr.match_length=0,to=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++,to&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=0,eo===Z_FINISH$3?(flush_block_only(Xr,!0),Xr.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):Xr.sym_next&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE};function Config(Xr,eo,to,ro,no){this.good_length=Xr,this.max_lazy=eo,this.nice_length=to,this.max_chain=ro,this.func=no}const configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],lm_init=Xr=>{Xr.window_size=2*Xr.w_size,zero(Xr.head),Xr.max_lazy_match=configuration_table[Xr.level].max_lazy,Xr.good_match=configuration_table[Xr.level].good_length,Xr.nice_match=configuration_table[Xr.level].nice_length,Xr.max_chain_length=configuration_table[Xr.level].max_chain,Xr.strstart=0,Xr.block_start=0,Xr.lookahead=0,Xr.insert=0,Xr.match_length=Xr.prev_length=MIN_MATCH-1,Xr.match_available=0,Xr.ins_h=0};function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED$2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HEAP_SIZE*2),this.dyn_dtree=new Uint16Array((2*D_CODES+1)*2),this.bl_tree=new Uint16Array((2*BL_CODES+1)*2),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(MAX_BITS+1),this.heap=new Uint16Array(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*L_CODES+1),zero(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const deflateStateCheck=Xr=>{if(!Xr)return 1;const eo=Xr.state;return!eo||eo.strm!==Xr||eo.status!==INIT_STATE&&eo.status!==GZIP_STATE&&eo.status!==EXTRA_STATE&&eo.status!==NAME_STATE&&eo.status!==COMMENT_STATE&&eo.status!==HCRC_STATE&&eo.status!==BUSY_STATE&&eo.status!==FINISH_STATE?1:0},deflateResetKeep=Xr=>{if(deflateStateCheck(Xr))return err(Xr,Z_STREAM_ERROR$2);Xr.total_in=Xr.total_out=0,Xr.data_type=Z_UNKNOWN;const eo=Xr.state;return eo.pending=0,eo.pending_out=0,eo.wrap<0&&(eo.wrap=-eo.wrap),eo.status=eo.wrap===2?GZIP_STATE:eo.wrap?INIT_STATE:BUSY_STATE,Xr.adler=eo.wrap===2?0:1,eo.last_flush=-2,_tr_init(eo),Z_OK$3},deflateReset=Xr=>{const eo=deflateResetKeep(Xr);return eo===Z_OK$3&&lm_init(Xr.state),eo},deflateSetHeader=(Xr,eo)=>deflateStateCheck(Xr)||Xr.state.wrap!==2?Z_STREAM_ERROR$2:(Xr.state.gzhead=eo,Z_OK$3),deflateInit2=(Xr,eo,to,ro,no,io)=>{if(!Xr)return Z_STREAM_ERROR$2;let oo=1;if(eo===Z_DEFAULT_COMPRESSION$1&&(eo=6),ro<0?(oo=0,ro=-ro):ro>15&&(oo=2,ro-=16),no<1||no>MAX_MEM_LEVEL||to!==Z_DEFLATED$2||ro<8||ro>15||eo<0||eo>9||io<0||io>Z_FIXED||ro===8&&oo!==1)return err(Xr,Z_STREAM_ERROR$2);ro===8&&(ro=9);const ao=new DeflateState;return Xr.state=ao,ao.strm=Xr,ao.status=INIT_STATE,ao.wrap=oo,ao.gzhead=null,ao.w_bits=ro,ao.w_size=1<deflateInit2(Xr,eo,Z_DEFLATED$2,MAX_WBITS$1,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY$1),deflate$2=(Xr,eo)=>{if(deflateStateCheck(Xr)||eo>Z_BLOCK$1||eo<0)return Xr?err(Xr,Z_STREAM_ERROR$2):Z_STREAM_ERROR$2;const to=Xr.state;if(!Xr.output||Xr.avail_in!==0&&!Xr.input||to.status===FINISH_STATE&&eo!==Z_FINISH$3)return err(Xr,Xr.avail_out===0?Z_BUF_ERROR$1:Z_STREAM_ERROR$2);const ro=to.last_flush;if(to.last_flush=eo,to.pending!==0){if(flush_pending(Xr),Xr.avail_out===0)return to.last_flush=-1,Z_OK$3}else if(Xr.avail_in===0&&rank(eo)<=rank(ro)&&eo!==Z_FINISH$3)return err(Xr,Z_BUF_ERROR$1);if(to.status===FINISH_STATE&&Xr.avail_in!==0)return err(Xr,Z_BUF_ERROR$1);if(to.status===INIT_STATE&&to.wrap===0&&(to.status=BUSY_STATE),to.status===INIT_STATE){let no=Z_DEFLATED$2+(to.w_bits-8<<4)<<8,io=-1;if(to.strategy>=Z_HUFFMAN_ONLY||to.level<2?io=0:to.level<6?io=1:to.level===6?io=2:io=3,no|=io<<6,to.strstart!==0&&(no|=PRESET_DICT),no+=31-no%31,putShortMSB(to,no),to.strstart!==0&&(putShortMSB(to,Xr.adler>>>16),putShortMSB(to,Xr.adler&65535)),Xr.adler=1,to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(to.status===GZIP_STATE){if(Xr.adler=0,put_byte(to,31),put_byte(to,139),put_byte(to,8),to.gzhead)put_byte(to,(to.gzhead.text?1:0)+(to.gzhead.hcrc?2:0)+(to.gzhead.extra?4:0)+(to.gzhead.name?8:0)+(to.gzhead.comment?16:0)),put_byte(to,to.gzhead.time&255),put_byte(to,to.gzhead.time>>8&255),put_byte(to,to.gzhead.time>>16&255),put_byte(to,to.gzhead.time>>24&255),put_byte(to,to.level===9?2:to.strategy>=Z_HUFFMAN_ONLY||to.level<2?4:0),put_byte(to,to.gzhead.os&255),to.gzhead.extra&&to.gzhead.extra.length&&(put_byte(to,to.gzhead.extra.length&255),put_byte(to,to.gzhead.extra.length>>8&255)),to.gzhead.hcrc&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending,0)),to.gzindex=0,to.status=EXTRA_STATE;else if(put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,to.level===9?2:to.strategy>=Z_HUFFMAN_ONLY||to.level<2?4:0),put_byte(to,OS_CODE),to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(to.status===EXTRA_STATE){if(to.gzhead.extra){let no=to.pending,io=(to.gzhead.extra.length&65535)-to.gzindex;for(;to.pending+io>to.pending_buf_size;){let ao=to.pending_buf_size-to.pending;if(to.pending_buf.set(to.gzhead.extra.subarray(to.gzindex,to.gzindex+ao),to.pending),to.pending=to.pending_buf_size,to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex+=ao,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0,io-=ao}let oo=new Uint8Array(to.gzhead.extra);to.pending_buf.set(oo.subarray(to.gzindex,to.gzindex+io),to.pending),to.pending+=io,to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex=0}to.status=NAME_STATE}if(to.status===NAME_STATE){if(to.gzhead.name){let no=to.pending,io;do{if(to.pending===to.pending_buf_size){if(to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0}to.gzindexno&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex=0}to.status=COMMENT_STATE}if(to.status===COMMENT_STATE){if(to.gzhead.comment){let no=to.pending,io;do{if(to.pending===to.pending_buf_size){if(to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0}to.gzindexno&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no))}to.status=HCRC_STATE}if(to.status===HCRC_STATE){if(to.gzhead.hcrc){if(to.pending+2>to.pending_buf_size&&(flush_pending(Xr),to.pending!==0))return to.last_flush=-1,Z_OK$3;put_byte(to,Xr.adler&255),put_byte(to,Xr.adler>>8&255),Xr.adler=0}if(to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(Xr.avail_in!==0||to.lookahead!==0||eo!==Z_NO_FLUSH$2&&to.status!==FINISH_STATE){let no=to.level===0?deflate_stored(to,eo):to.strategy===Z_HUFFMAN_ONLY?deflate_huff(to,eo):to.strategy===Z_RLE?deflate_rle(to,eo):configuration_table[to.level].func(to,eo);if((no===BS_FINISH_STARTED||no===BS_FINISH_DONE)&&(to.status=FINISH_STATE),no===BS_NEED_MORE||no===BS_FINISH_STARTED)return Xr.avail_out===0&&(to.last_flush=-1),Z_OK$3;if(no===BS_BLOCK_DONE&&(eo===Z_PARTIAL_FLUSH?_tr_align(to):eo!==Z_BLOCK$1&&(_tr_stored_block(to,0,0,!1),eo===Z_FULL_FLUSH$1&&(zero(to.head),to.lookahead===0&&(to.strstart=0,to.block_start=0,to.insert=0))),flush_pending(Xr),Xr.avail_out===0))return to.last_flush=-1,Z_OK$3}return eo!==Z_FINISH$3?Z_OK$3:to.wrap<=0?Z_STREAM_END$3:(to.wrap===2?(put_byte(to,Xr.adler&255),put_byte(to,Xr.adler>>8&255),put_byte(to,Xr.adler>>16&255),put_byte(to,Xr.adler>>24&255),put_byte(to,Xr.total_in&255),put_byte(to,Xr.total_in>>8&255),put_byte(to,Xr.total_in>>16&255),put_byte(to,Xr.total_in>>24&255)):(putShortMSB(to,Xr.adler>>>16),putShortMSB(to,Xr.adler&65535)),flush_pending(Xr),to.wrap>0&&(to.wrap=-to.wrap),to.pending!==0?Z_OK$3:Z_STREAM_END$3)},deflateEnd=Xr=>{if(deflateStateCheck(Xr))return Z_STREAM_ERROR$2;const eo=Xr.state.status;return Xr.state=null,eo===BUSY_STATE?err(Xr,Z_DATA_ERROR$2):Z_OK$3},deflateSetDictionary=(Xr,eo)=>{let to=eo.length;if(deflateStateCheck(Xr))return Z_STREAM_ERROR$2;const ro=Xr.state,no=ro.wrap;if(no===2||no===1&&ro.status!==INIT_STATE||ro.lookahead)return Z_STREAM_ERROR$2;if(no===1&&(Xr.adler=adler32_1(Xr.adler,eo,to,0)),ro.wrap=0,to>=ro.w_size){no===0&&(zero(ro.head),ro.strstart=0,ro.block_start=0,ro.insert=0);let so=new Uint8Array(ro.w_size);so.set(eo.subarray(to-ro.w_size,to),0),eo=so,to=ro.w_size}const io=Xr.avail_in,oo=Xr.next_in,ao=Xr.input;for(Xr.avail_in=to,Xr.next_in=0,Xr.input=eo,fill_window(ro);ro.lookahead>=MIN_MATCH;){let so=ro.strstart,co=ro.lookahead-(MIN_MATCH-1);do ro.ins_h=HASH(ro,ro.ins_h,ro.window[so+MIN_MATCH-1]),ro.prev[so&ro.w_mask]=ro.head[ro.ins_h],ro.head[ro.ins_h]=so,so++;while(--co);ro.strstart=so,ro.lookahead=MIN_MATCH-1,fill_window(ro)}return ro.strstart+=ro.lookahead,ro.block_start=ro.strstart,ro.insert=ro.lookahead,ro.lookahead=0,ro.match_length=ro.prev_length=MIN_MATCH-1,ro.match_available=0,Xr.next_in=oo,Xr.input=ao,Xr.avail_in=io,ro.wrap=no,Z_OK$3};var deflateInit_1=deflateInit,deflateInit2_1=deflateInit2,deflateReset_1=deflateReset,deflateResetKeep_1=deflateResetKeep,deflateSetHeader_1=deflateSetHeader,deflate_2$1=deflate$2,deflateEnd_1=deflateEnd,deflateSetDictionary_1=deflateSetDictionary,deflateInfo="pako deflate (from Nodeca project)",deflate_1$2={deflateInit:deflateInit_1,deflateInit2:deflateInit2_1,deflateReset:deflateReset_1,deflateResetKeep:deflateResetKeep_1,deflateSetHeader:deflateSetHeader_1,deflate:deflate_2$1,deflateEnd:deflateEnd_1,deflateSetDictionary:deflateSetDictionary_1,deflateInfo};const _has=(Xr,eo)=>Object.prototype.hasOwnProperty.call(Xr,eo);var assign=function(Xr){const eo=Array.prototype.slice.call(arguments,1);for(;eo.length;){const to=eo.shift();if(to){if(typeof to!="object")throw new TypeError(to+"must be non-object");for(const ro in to)_has(to,ro)&&(Xr[ro]=to[ro])}}return Xr},flattenChunks=Xr=>{let eo=0;for(let ro=0,no=Xr.length;ro=252?6:Xr>=248?5:Xr>=240?4:Xr>=224?3:Xr>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=Xr=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(Xr);let eo,to,ro,no,io,oo=Xr.length,ao=0;for(no=0;no>>6,eo[io++]=128|to&63):to<65536?(eo[io++]=224|to>>>12,eo[io++]=128|to>>>6&63,eo[io++]=128|to&63):(eo[io++]=240|to>>>18,eo[io++]=128|to>>>12&63,eo[io++]=128|to>>>6&63,eo[io++]=128|to&63);return eo};const buf2binstring=(Xr,eo)=>{if(eo<65534&&Xr.subarray&&STR_APPLY_UIA_OK)return String.fromCharCode.apply(null,Xr.length===eo?Xr:Xr.subarray(0,eo));let to="";for(let ro=0;ro{const to=eo||Xr.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(Xr.subarray(0,eo));let ro,no;const io=new Array(to*2);for(no=0,ro=0;ro4){io[no++]=65533,ro+=ao-1;continue}for(oo&=ao===2?31:ao===3?15:7;ao>1&&ro1){io[no++]=65533;continue}oo<65536?io[no++]=oo:(oo-=65536,io[no++]=55296|oo>>10&1023,io[no++]=56320|oo&1023)}return buf2binstring(io,no)},utf8border=(Xr,eo)=>{eo=eo||Xr.length,eo>Xr.length&&(eo=Xr.length);let to=eo-1;for(;to>=0&&(Xr[to]&192)===128;)to--;return to<0||to===0?eo:to+_utf8len[Xr[to]]>eo?to:eo},strings={string2buf,buf2string,utf8border};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;const toString$1=Object.prototype.toString,{Z_NO_FLUSH:Z_NO_FLUSH$1,Z_SYNC_FLUSH,Z_FULL_FLUSH,Z_FINISH:Z_FINISH$2,Z_OK:Z_OK$2,Z_STREAM_END:Z_STREAM_END$2,Z_DEFAULT_COMPRESSION,Z_DEFAULT_STRATEGY,Z_DEFLATED:Z_DEFLATED$1}=constants$2;function Deflate$1(Xr){this.options=common.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED$1,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY},Xr||{});let eo=this.options;eo.raw&&eo.windowBits>0?eo.windowBits=-eo.windowBits:eo.gzip&&eo.windowBits>0&&eo.windowBits<16&&(eo.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let to=deflate_1$2.deflateInit2(this.strm,eo.level,eo.method,eo.windowBits,eo.memLevel,eo.strategy);if(to!==Z_OK$2)throw new Error(messages[to]);if(eo.header&&deflate_1$2.deflateSetHeader(this.strm,eo.header),eo.dictionary){let ro;if(typeof eo.dictionary=="string"?ro=strings.string2buf(eo.dictionary):toString$1.call(eo.dictionary)==="[object ArrayBuffer]"?ro=new Uint8Array(eo.dictionary):ro=eo.dictionary,to=deflate_1$2.deflateSetDictionary(this.strm,ro),to!==Z_OK$2)throw new Error(messages[to]);this._dict_set=!0}}Deflate$1.prototype.push=function(Xr,eo){const to=this.strm,ro=this.options.chunkSize;let no,io;if(this.ended)return!1;for(eo===~~eo?io=eo:io=eo===!0?Z_FINISH$2:Z_NO_FLUSH$1,typeof Xr=="string"?to.input=strings.string2buf(Xr):toString$1.call(Xr)==="[object ArrayBuffer]"?to.input=new Uint8Array(Xr):to.input=Xr,to.next_in=0,to.avail_in=to.input.length;;){if(to.avail_out===0&&(to.output=new Uint8Array(ro),to.next_out=0,to.avail_out=ro),(io===Z_SYNC_FLUSH||io===Z_FULL_FLUSH)&&to.avail_out<=6){this.onData(to.output.subarray(0,to.next_out)),to.avail_out=0;continue}if(no=deflate_1$2.deflate(to,io),no===Z_STREAM_END$2)return to.next_out>0&&this.onData(to.output.subarray(0,to.next_out)),no=deflate_1$2.deflateEnd(this.strm),this.onEnd(no),this.ended=!0,no===Z_OK$2;if(to.avail_out===0){this.onData(to.output);continue}if(io>0&&to.next_out>0){this.onData(to.output.subarray(0,to.next_out)),to.avail_out=0;continue}if(to.avail_in===0)break}return!0};Deflate$1.prototype.onData=function(Xr){this.chunks.push(Xr)};Deflate$1.prototype.onEnd=function(Xr){Xr===Z_OK$2&&(this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=Xr,this.msg=this.strm.msg};function deflate$1(Xr,eo){const to=new Deflate$1(eo);if(to.push(Xr,!0),to.err)throw to.msg||messages[to.err];return to.result}function deflateRaw$1(Xr,eo){return eo=eo||{},eo.raw=!0,deflate$1(Xr,eo)}function gzip$1(Xr,eo){return eo=eo||{},eo.gzip=!0,deflate$1(Xr,eo)}var Deflate_1$1=Deflate$1,deflate_2=deflate$1,deflateRaw_1$1=deflateRaw$1,gzip_1$1=gzip$1,constants$1=constants$2,deflate_1$1={Deflate:Deflate_1$1,deflate:deflate_2,deflateRaw:deflateRaw_1$1,gzip:gzip_1$1,constants:constants$1};const BAD$1=16209,TYPE$1=16191;var inffast=function Xr(eo,to){let ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo,Eo,ko,Ao,Po,jo,Mo,No,Do,Fo,Xo;const Lo=eo.state;ro=eo.next_in,Fo=eo.input,no=ro+(eo.avail_in-5),io=eo.next_out,Xo=eo.output,oo=io-(to-eo.avail_out),ao=io+(eo.avail_out-257),so=Lo.dmax,co=Lo.wsize,lo=Lo.whave,fo=Lo.wnext,ho=Lo.window,go=Lo.hold,yo=Lo.bits,vo=Lo.lencode,wo=Lo.distcode,Eo=(1<>>24,go>>>=Po,yo-=Po,Po=Ao>>>16&255,Po===0)Xo[io++]=Ao&65535;else if(Po&16){jo=Ao&65535,Po&=15,Po&&(yo>>=Po,yo-=Po),yo<15&&(go+=Fo[ro++]<>>24,go>>>=Po,yo-=Po,Po=Ao>>>16&255,Po&16){if(Mo=Ao&65535,Po&=15,yoso){eo.msg="invalid distance too far back",Lo.mode=BAD$1;break e}if(go>>>=Po,yo-=Po,Po=io-oo,Mo>Po){if(Po=Mo-Po,Po>lo&&Lo.sane){eo.msg="invalid distance too far back",Lo.mode=BAD$1;break e}if(No=0,Do=ho,fo===0){if(No+=co-Po,Po2;)Xo[io++]=Do[No++],Xo[io++]=Do[No++],Xo[io++]=Do[No++],jo-=3;jo&&(Xo[io++]=Do[No++],jo>1&&(Xo[io++]=Do[No++]))}else{No=io-Mo;do Xo[io++]=Xo[No++],Xo[io++]=Xo[No++],Xo[io++]=Xo[No++],jo-=3;while(jo>2);jo&&(Xo[io++]=Xo[No++],jo>1&&(Xo[io++]=Xo[No++]))}}else if(Po&64){eo.msg="invalid distance code",Lo.mode=BAD$1;break e}else{Ao=wo[(Ao&65535)+(go&(1<>3,ro-=jo,yo-=jo<<3,go&=(1<{const so=ao.bits;let co=0,lo=0,fo=0,ho=0,go=0,yo=0,vo=0,wo=0,Eo=0,ko=0,Ao,Po,jo,Mo,No,Do=null,Fo;const Xo=new Uint16Array(MAXBITS+1),Lo=new Uint16Array(MAXBITS+1);let Bo=null,xo,uo,po;for(co=0;co<=MAXBITS;co++)Xo[co]=0;for(lo=0;lo=1&&Xo[ho]===0;ho--);if(go>ho&&(go=ho),ho===0)return no[io++]=1<<24|64<<16|0,no[io++]=1<<24|64<<16|0,ao.bits=1,0;for(fo=1;fo0&&(Xr===CODES$1||ho!==1))return-1;for(Lo[1]=0,co=1;coENOUGH_LENS$1||Xr===DISTS$1&&Eo>ENOUGH_DISTS$1)return 1;for(;;){xo=co-vo,oo[lo]+1=Fo?(uo=Bo[oo[lo]-Fo],po=Do[oo[lo]-Fo]):(uo=96,po=0),Ao=1<>vo)+Po]=xo<<24|uo<<16|po|0;while(Po!==0);for(Ao=1<>=1;if(Ao!==0?(ko&=Ao-1,ko+=Ao):ko=0,lo++,--Xo[co]===0){if(co===ho)break;co=eo[to+oo[lo]]}if(co>go&&(ko&Mo)!==jo){for(vo===0&&(vo=go),No+=fo,yo=co-vo,wo=1<ENOUGH_LENS$1||Xr===DISTS$1&&Eo>ENOUGH_DISTS$1)return 1;jo=ko&Mo,no[jo]=go<<24|yo<<16|No-io|0}}return ko!==0&&(no[No+ko]=co-vo<<24|64<<16|0),ao.bits=go,0};var inftrees=inflate_table;const CODES=0,LENS=1,DISTS=2,{Z_FINISH:Z_FINISH$1,Z_BLOCK,Z_TREES,Z_OK:Z_OK$1,Z_STREAM_END:Z_STREAM_END$1,Z_NEED_DICT:Z_NEED_DICT$1,Z_STREAM_ERROR:Z_STREAM_ERROR$1,Z_DATA_ERROR:Z_DATA_ERROR$1,Z_MEM_ERROR:Z_MEM_ERROR$1,Z_BUF_ERROR,Z_DEFLATED}=constants$2,HEAD=16180,FLAGS=16181,TIME=16182,OS=16183,EXLEN=16184,EXTRA=16185,NAME=16186,COMMENT=16187,HCRC=16188,DICTID=16189,DICT=16190,TYPE=16191,TYPEDO=16192,STORED=16193,COPY_=16194,COPY=16195,TABLE=16196,LENLENS=16197,CODELENS=16198,LEN_=16199,LEN=16200,LENEXT=16201,DIST=16202,DISTEXT=16203,MATCH=16204,LIT=16205,CHECK=16206,LENGTH=16207,DONE=16208,BAD=16209,MEM=16210,SYNC=16211,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS,zswap32=Xr=>(Xr>>>24&255)+(Xr>>>8&65280)+((Xr&65280)<<8)+((Xr&255)<<24);function InflateState(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const inflateStateCheck=Xr=>{if(!Xr)return 1;const eo=Xr.state;return!eo||eo.strm!==Xr||eo.modeSYNC?1:0},inflateResetKeep=Xr=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const eo=Xr.state;return Xr.total_in=Xr.total_out=eo.total=0,Xr.msg="",eo.wrap&&(Xr.adler=eo.wrap&1),eo.mode=HEAD,eo.last=0,eo.havedict=0,eo.flags=-1,eo.dmax=32768,eo.head=null,eo.hold=0,eo.bits=0,eo.lencode=eo.lendyn=new Int32Array(ENOUGH_LENS),eo.distcode=eo.distdyn=new Int32Array(ENOUGH_DISTS),eo.sane=1,eo.back=-1,Z_OK$1},inflateReset=Xr=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const eo=Xr.state;return eo.wsize=0,eo.whave=0,eo.wnext=0,inflateResetKeep(Xr)},inflateReset2=(Xr,eo)=>{let to;if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const ro=Xr.state;return eo<0?(to=0,eo=-eo):(to=(eo>>4)+5,eo<48&&(eo&=15)),eo&&(eo<8||eo>15)?Z_STREAM_ERROR$1:(ro.window!==null&&ro.wbits!==eo&&(ro.window=null),ro.wrap=to,ro.wbits=eo,inflateReset(Xr))},inflateInit2=(Xr,eo)=>{if(!Xr)return Z_STREAM_ERROR$1;const to=new InflateState;Xr.state=to,to.strm=Xr,to.window=null,to.mode=HEAD;const ro=inflateReset2(Xr,eo);return ro!==Z_OK$1&&(Xr.state=null),ro},inflateInit=Xr=>inflateInit2(Xr,DEF_WBITS);let virgin=!0,lenfix,distfix;const fixedtables=Xr=>{if(virgin){lenfix=new Int32Array(512),distfix=new Int32Array(32);let eo=0;for(;eo<144;)Xr.lens[eo++]=8;for(;eo<256;)Xr.lens[eo++]=9;for(;eo<280;)Xr.lens[eo++]=7;for(;eo<288;)Xr.lens[eo++]=8;for(inftrees(LENS,Xr.lens,0,288,lenfix,0,Xr.work,{bits:9}),eo=0;eo<32;)Xr.lens[eo++]=5;inftrees(DISTS,Xr.lens,0,32,distfix,0,Xr.work,{bits:5}),virgin=!1}Xr.lencode=lenfix,Xr.lenbits=9,Xr.distcode=distfix,Xr.distbits=5},updatewindow=(Xr,eo,to,ro)=>{let no;const io=Xr.state;return io.window===null&&(io.wsize=1<=io.wsize?(io.window.set(eo.subarray(to-io.wsize,to),0),io.wnext=0,io.whave=io.wsize):(no=io.wsize-io.wnext,no>ro&&(no=ro),io.window.set(eo.subarray(to-ro,to-ro+no),io.wnext),ro-=no,ro?(io.window.set(eo.subarray(to-ro,to),0),io.wnext=ro,io.whave=io.wsize):(io.wnext+=no,io.wnext===io.wsize&&(io.wnext=0),io.whave{let to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo=0,Eo,ko,Ao,Po,jo,Mo,No,Do;const Fo=new Uint8Array(4);let Xo,Lo;const Bo=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(inflateStateCheck(Xr)||!Xr.output||!Xr.input&&Xr.avail_in!==0)return Z_STREAM_ERROR$1;to=Xr.state,to.mode===TYPE&&(to.mode=TYPEDO),oo=Xr.next_out,no=Xr.output,so=Xr.avail_out,io=Xr.next_in,ro=Xr.input,ao=Xr.avail_in,co=to.hold,lo=to.bits,fo=ao,ho=so,Do=Z_OK$1;e:for(;;)switch(to.mode){case HEAD:if(to.wrap===0){to.mode=TYPEDO;break}for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,to.check=crc32_1(to.check,Fo,2,0),co=0,lo=0,to.mode=FLAGS;break}if(to.head&&(to.head.done=!1),!(to.wrap&1)||(((co&255)<<8)+(co>>8))%31){Xr.msg="incorrect header check",to.mode=BAD;break}if((co&15)!==Z_DEFLATED){Xr.msg="unknown compression method",to.mode=BAD;break}if(co>>>=4,lo-=4,No=(co&15)+8,to.wbits===0&&(to.wbits=No),No>15||No>to.wbits){Xr.msg="invalid window size",to.mode=BAD;break}to.dmax=1<>8&1),to.flags&512&&to.wrap&4&&(Fo[0]=co&255,Fo[1]=co>>>8&255,to.check=crc32_1(to.check,Fo,2,0)),co=0,lo=0,to.mode=TIME;case TIME:for(;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,Fo[2]=co>>>16&255,Fo[3]=co>>>24&255,to.check=crc32_1(to.check,Fo,4,0)),co=0,lo=0,to.mode=OS;case OS:for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>8),to.flags&512&&to.wrap&4&&(Fo[0]=co&255,Fo[1]=co>>>8&255,to.check=crc32_1(to.check,Fo,2,0)),co=0,lo=0,to.mode=EXLEN;case EXLEN:if(to.flags&1024){for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,to.check=crc32_1(to.check,Fo,2,0)),co=0,lo=0}else to.head&&(to.head.extra=null);to.mode=EXTRA;case EXTRA:if(to.flags&1024&&(go=to.length,go>ao&&(go=ao),go&&(to.head&&(No=to.head.extra_len-to.length,to.head.extra||(to.head.extra=new Uint8Array(to.head.extra_len)),to.head.extra.set(ro.subarray(io,io+go),No)),to.flags&512&&to.wrap&4&&(to.check=crc32_1(to.check,ro,go,io)),ao-=go,io+=go,to.length-=go),to.length))break e;to.length=0,to.mode=NAME;case NAME:if(to.flags&2048){if(ao===0)break e;go=0;do No=ro[io+go++],to.head&&No&&to.length<65536&&(to.head.name+=String.fromCharCode(No));while(No&&go>9&1,to.head.done=!0),Xr.adler=to.check=0,to.mode=TYPE;break;case DICTID:for(;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>=lo&7,lo-=lo&7,to.mode=CHECK;break}for(;lo<3;){if(ao===0)break e;ao--,co+=ro[io++]<>>=1,lo-=1,co&3){case 0:to.mode=STORED;break;case 1:if(fixedtables(to),to.mode=LEN_,eo===Z_TREES){co>>>=2,lo-=2;break e}break;case 2:to.mode=TABLE;break;case 3:Xr.msg="invalid block type",to.mode=BAD}co>>>=2,lo-=2;break;case STORED:for(co>>>=lo&7,lo-=lo&7;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>16^65535)){Xr.msg="invalid stored block lengths",to.mode=BAD;break}if(to.length=co&65535,co=0,lo=0,to.mode=COPY_,eo===Z_TREES)break e;case COPY_:to.mode=COPY;case COPY:if(go=to.length,go){if(go>ao&&(go=ao),go>so&&(go=so),go===0)break e;no.set(ro.subarray(io,io+go),oo),ao-=go,io+=go,so-=go,oo+=go,to.length-=go;break}to.mode=TYPE;break;case TABLE:for(;lo<14;){if(ao===0)break e;ao--,co+=ro[io++]<>>=5,lo-=5,to.ndist=(co&31)+1,co>>>=5,lo-=5,to.ncode=(co&15)+4,co>>>=4,lo-=4,to.nlen>286||to.ndist>30){Xr.msg="too many length or distance symbols",to.mode=BAD;break}to.have=0,to.mode=LENLENS;case LENLENS:for(;to.have>>=3,lo-=3}for(;to.have<19;)to.lens[Bo[to.have++]]=0;if(to.lencode=to.lendyn,to.lenbits=7,Xo={bits:to.lenbits},Do=inftrees(CODES,to.lens,0,19,to.lencode,0,to.work,Xo),to.lenbits=Xo.bits,Do){Xr.msg="invalid code lengths set",to.mode=BAD;break}to.have=0,to.mode=CODELENS;case CODELENS:for(;to.have>>24,ko=wo>>>16&255,Ao=wo&65535,!(Eo<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=Eo,lo-=Eo,to.lens[to.have++]=Ao;else{if(Ao===16){for(Lo=Eo+2;lo>>=Eo,lo-=Eo,to.have===0){Xr.msg="invalid bit length repeat",to.mode=BAD;break}No=to.lens[to.have-1],go=3+(co&3),co>>>=2,lo-=2}else if(Ao===17){for(Lo=Eo+3;lo>>=Eo,lo-=Eo,No=0,go=3+(co&7),co>>>=3,lo-=3}else{for(Lo=Eo+7;lo>>=Eo,lo-=Eo,No=0,go=11+(co&127),co>>>=7,lo-=7}if(to.have+go>to.nlen+to.ndist){Xr.msg="invalid bit length repeat",to.mode=BAD;break}for(;go--;)to.lens[to.have++]=No}}if(to.mode===BAD)break;if(to.lens[256]===0){Xr.msg="invalid code -- missing end-of-block",to.mode=BAD;break}if(to.lenbits=9,Xo={bits:to.lenbits},Do=inftrees(LENS,to.lens,0,to.nlen,to.lencode,0,to.work,Xo),to.lenbits=Xo.bits,Do){Xr.msg="invalid literal/lengths set",to.mode=BAD;break}if(to.distbits=6,to.distcode=to.distdyn,Xo={bits:to.distbits},Do=inftrees(DISTS,to.lens,to.nlen,to.ndist,to.distcode,0,to.work,Xo),to.distbits=Xo.bits,Do){Xr.msg="invalid distances set",to.mode=BAD;break}if(to.mode=LEN_,eo===Z_TREES)break e;case LEN_:to.mode=LEN;case LEN:if(ao>=6&&so>=258){Xr.next_out=oo,Xr.avail_out=so,Xr.next_in=io,Xr.avail_in=ao,to.hold=co,to.bits=lo,inffast(Xr,ho),oo=Xr.next_out,no=Xr.output,so=Xr.avail_out,io=Xr.next_in,ro=Xr.input,ao=Xr.avail_in,co=to.hold,lo=to.bits,to.mode===TYPE&&(to.back=-1);break}for(to.back=0;wo=to.lencode[co&(1<>>24,ko=wo>>>16&255,Ao=wo&65535,!(Eo<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>Po)],Eo=wo>>>24,ko=wo>>>16&255,Ao=wo&65535,!(Po+Eo<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=Po,lo-=Po,to.back+=Po}if(co>>>=Eo,lo-=Eo,to.back+=Eo,to.length=Ao,ko===0){to.mode=LIT;break}if(ko&32){to.back=-1,to.mode=TYPE;break}if(ko&64){Xr.msg="invalid literal/length code",to.mode=BAD;break}to.extra=ko&15,to.mode=LENEXT;case LENEXT:if(to.extra){for(Lo=to.extra;lo>>=to.extra,lo-=to.extra,to.back+=to.extra}to.was=to.length,to.mode=DIST;case DIST:for(;wo=to.distcode[co&(1<>>24,ko=wo>>>16&255,Ao=wo&65535,!(Eo<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>Po)],Eo=wo>>>24,ko=wo>>>16&255,Ao=wo&65535,!(Po+Eo<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=Po,lo-=Po,to.back+=Po}if(co>>>=Eo,lo-=Eo,to.back+=Eo,ko&64){Xr.msg="invalid distance code",to.mode=BAD;break}to.offset=Ao,to.extra=ko&15,to.mode=DISTEXT;case DISTEXT:if(to.extra){for(Lo=to.extra;lo>>=to.extra,lo-=to.extra,to.back+=to.extra}if(to.offset>to.dmax){Xr.msg="invalid distance too far back",to.mode=BAD;break}to.mode=MATCH;case MATCH:if(so===0)break e;if(go=ho-so,to.offset>go){if(go=to.offset-go,go>to.whave&&to.sane){Xr.msg="invalid distance too far back",to.mode=BAD;break}go>to.wnext?(go-=to.wnext,yo=to.wsize-go):yo=to.wnext-go,go>to.length&&(go=to.length),vo=to.window}else vo=no,yo=oo-to.offset,go=to.length;go>so&&(go=so),so-=go,to.length-=go;do no[oo++]=vo[yo++];while(--go);to.length===0&&(to.mode=LEN);break;case LIT:if(so===0)break e;no[oo++]=to.length,so--,to.mode=LEN;break;case CHECK:if(to.wrap){for(;lo<32;){if(ao===0)break e;ao--,co|=ro[io++]<{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;let eo=Xr.state;return eo.window&&(eo.window=null),Xr.state=null,Z_OK$1},inflateGetHeader=(Xr,eo)=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const to=Xr.state;return to.wrap&2?(to.head=eo,eo.done=!1,Z_OK$1):Z_STREAM_ERROR$1},inflateSetDictionary=(Xr,eo)=>{const to=eo.length;let ro,no,io;return inflateStateCheck(Xr)||(ro=Xr.state,ro.wrap!==0&&ro.mode!==DICT)?Z_STREAM_ERROR$1:ro.mode===DICT&&(no=1,no=adler32_1(no,eo,to,0),no!==ro.check)?Z_DATA_ERROR$1:(io=updatewindow(Xr,eo,to,to),io?(ro.mode=MEM,Z_MEM_ERROR$1):(ro.havedict=1,Z_OK$1))};var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$2,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$2={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo};function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader;const toString=Object.prototype.toString,{Z_NO_FLUSH,Z_FINISH,Z_OK,Z_STREAM_END,Z_NEED_DICT,Z_STREAM_ERROR,Z_DATA_ERROR,Z_MEM_ERROR}=constants$2;function Inflate$1(Xr){this.options=common.assign({chunkSize:1024*64,windowBits:15,to:""},Xr||{});const eo=this.options;eo.raw&&eo.windowBits>=0&&eo.windowBits<16&&(eo.windowBits=-eo.windowBits,eo.windowBits===0&&(eo.windowBits=-15)),eo.windowBits>=0&&eo.windowBits<16&&!(Xr&&Xr.windowBits)&&(eo.windowBits+=32),eo.windowBits>15&&eo.windowBits<48&&(eo.windowBits&15||(eo.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let to=inflate_1$2.inflateInit2(this.strm,eo.windowBits);if(to!==Z_OK)throw new Error(messages[to]);if(this.header=new gzheader,inflate_1$2.inflateGetHeader(this.strm,this.header),eo.dictionary&&(typeof eo.dictionary=="string"?eo.dictionary=strings.string2buf(eo.dictionary):toString.call(eo.dictionary)==="[object ArrayBuffer]"&&(eo.dictionary=new Uint8Array(eo.dictionary)),eo.raw&&(to=inflate_1$2.inflateSetDictionary(this.strm,eo.dictionary),to!==Z_OK)))throw new Error(messages[to])}Inflate$1.prototype.push=function(Xr,eo){const to=this.strm,ro=this.options.chunkSize,no=this.options.dictionary;let io,oo,ao;if(this.ended)return!1;for(eo===~~eo?oo=eo:oo=eo===!0?Z_FINISH:Z_NO_FLUSH,toString.call(Xr)==="[object ArrayBuffer]"?to.input=new Uint8Array(Xr):to.input=Xr,to.next_in=0,to.avail_in=to.input.length;;){for(to.avail_out===0&&(to.output=new Uint8Array(ro),to.next_out=0,to.avail_out=ro),io=inflate_1$2.inflate(to,oo),io===Z_NEED_DICT&&no&&(io=inflate_1$2.inflateSetDictionary(to,no),io===Z_OK?io=inflate_1$2.inflate(to,oo):io===Z_DATA_ERROR&&(io=Z_NEED_DICT));to.avail_in>0&&io===Z_STREAM_END&&to.state.wrap>0&&Xr[to.next_in]!==0;)inflate_1$2.inflateReset(to),io=inflate_1$2.inflate(to,oo);switch(io){case Z_STREAM_ERROR:case Z_DATA_ERROR:case Z_NEED_DICT:case Z_MEM_ERROR:return this.onEnd(io),this.ended=!0,!1}if(ao=to.avail_out,to.next_out&&(to.avail_out===0||io===Z_STREAM_END))if(this.options.to==="string"){let so=strings.utf8border(to.output,to.next_out),co=to.next_out-so,lo=strings.buf2string(to.output,so);to.next_out=co,to.avail_out=ro-co,co&&to.output.set(to.output.subarray(so,so+co),0),this.onData(lo)}else this.onData(to.output.length===to.next_out?to.output:to.output.subarray(0,to.next_out));if(!(io===Z_OK&&ao===0)){if(io===Z_STREAM_END)return io=inflate_1$2.inflateEnd(this.strm),this.onEnd(io),this.ended=!0,!0;if(to.avail_in===0)break}}return!0};Inflate$1.prototype.onData=function(Xr){this.chunks.push(Xr)};Inflate$1.prototype.onEnd=function(Xr){Xr===Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=Xr,this.msg=this.strm.msg};function inflate$1(Xr,eo){const to=new Inflate$1(eo);if(to.push(Xr),to.err)throw to.msg||messages[to.err];return to.result}function inflateRaw$1(Xr,eo){return eo=eo||{},eo.raw=!0,inflate$1(Xr,eo)}var Inflate_1$1=Inflate$1,inflate_2=inflate$1,inflateRaw_1$1=inflateRaw$1,ungzip$1=inflate$1,constants=constants$2,inflate_1$1={Inflate:Inflate_1$1,inflate:inflate_2,inflateRaw:inflateRaw_1$1,ungzip:ungzip$1,constants};const{Deflate,deflate,deflateRaw,gzip}=deflate_1$1,{Inflate,inflate,inflateRaw,ungzip}=inflate_1$1;var gzip_1=gzip,ungzip_1=ungzip,g$2=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global$1<"u"&&global$1||{},support={searchParams:"URLSearchParams"in g$2,iterable:"Symbol"in g$2&&"iterator"in Symbol,blob:"FileReader"in g$2&&"Blob"in g$2&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in g$2,arrayBuffer:"ArrayBuffer"in g$2};function isDataView(Xr){return Xr&&DataView.prototype.isPrototypeOf(Xr)}if(support.arrayBuffer)var viewClasses=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isArrayBufferView=ArrayBuffer.isView||function(Xr){return Xr&&viewClasses.indexOf(Object.prototype.toString.call(Xr))>-1};function normalizeName(Xr){if(typeof Xr!="string"&&(Xr=String(Xr)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(Xr)||Xr==="")throw new TypeError('Invalid character in header field name: "'+Xr+'"');return Xr.toLowerCase()}function normalizeValue(Xr){return typeof Xr!="string"&&(Xr=String(Xr)),Xr}function iteratorFor(Xr){var eo={next:function(){var to=Xr.shift();return{done:to===void 0,value:to}}};return support.iterable&&(eo[Symbol.iterator]=function(){return eo}),eo}function Headers$1(Xr){this.map={},Xr instanceof Headers$1?Xr.forEach(function(eo,to){this.append(to,eo)},this):Array.isArray(Xr)?Xr.forEach(function(eo){if(eo.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+eo.length);this.append(eo[0],eo[1])},this):Xr&&Object.getOwnPropertyNames(Xr).forEach(function(eo){this.append(eo,Xr[eo])},this)}Headers$1.prototype.append=function(Xr,eo){Xr=normalizeName(Xr),eo=normalizeValue(eo);var to=this.map[Xr];this.map[Xr]=to?to+", "+eo:eo};Headers$1.prototype.delete=function(Xr){delete this.map[normalizeName(Xr)]};Headers$1.prototype.get=function(Xr){return Xr=normalizeName(Xr),this.has(Xr)?this.map[Xr]:null};Headers$1.prototype.has=function(Xr){return this.map.hasOwnProperty(normalizeName(Xr))};Headers$1.prototype.set=function(Xr,eo){this.map[normalizeName(Xr)]=normalizeValue(eo)};Headers$1.prototype.forEach=function(Xr,eo){for(var to in this.map)this.map.hasOwnProperty(to)&&Xr.call(eo,this.map[to],to,this)};Headers$1.prototype.keys=function(){var Xr=[];return this.forEach(function(eo,to){Xr.push(to)}),iteratorFor(Xr)};Headers$1.prototype.values=function(){var Xr=[];return this.forEach(function(eo){Xr.push(eo)}),iteratorFor(Xr)};Headers$1.prototype.entries=function(){var Xr=[];return this.forEach(function(eo,to){Xr.push([to,eo])}),iteratorFor(Xr)};support.iterable&&(Headers$1.prototype[Symbol.iterator]=Headers$1.prototype.entries);function consumed(Xr){if(!Xr._noBody){if(Xr.bodyUsed)return Promise.reject(new TypeError("Already read"));Xr.bodyUsed=!0}}function fileReaderReady(Xr){return new Promise(function(eo,to){Xr.onload=function(){eo(Xr.result)},Xr.onerror=function(){to(Xr.error)}})}function readBlobAsArrayBuffer(Xr){var eo=new FileReader,to=fileReaderReady(eo);return eo.readAsArrayBuffer(Xr),to}function readBlobAsText(Xr){var eo=new FileReader,to=fileReaderReady(eo),ro=/charset=([A-Za-z0-9_-]+)/.exec(Xr.type),no=ro?ro[1]:"utf-8";return eo.readAsText(Xr,no),to}function readArrayBufferAsText(Xr){for(var eo=new Uint8Array(Xr),to=new Array(eo.length),ro=0;ro-1?eo:Xr}function Request$1(Xr,eo){if(!(this instanceof Request$1))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');eo=eo||{};var to=eo.body;if(Xr instanceof Request$1){if(Xr.bodyUsed)throw new TypeError("Already read");this.url=Xr.url,this.credentials=Xr.credentials,eo.headers||(this.headers=new Headers$1(Xr.headers)),this.method=Xr.method,this.mode=Xr.mode,this.signal=Xr.signal,!to&&Xr._bodyInit!=null&&(to=Xr._bodyInit,Xr.bodyUsed=!0)}else this.url=String(Xr);if(this.credentials=eo.credentials||this.credentials||"same-origin",(eo.headers||!this.headers)&&(this.headers=new Headers$1(eo.headers)),this.method=normalizeMethod(eo.method||this.method||"GET"),this.mode=eo.mode||this.mode||null,this.signal=eo.signal||this.signal||function(){if("AbortController"in g$2){var io=new AbortController;return io.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&to)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(to),(this.method==="GET"||this.method==="HEAD")&&(eo.cache==="no-store"||eo.cache==="no-cache")){var ro=/([?&])_=[^&]*/;if(ro.test(this.url))this.url=this.url.replace(ro,"$1_="+new Date().getTime());else{var no=/\?/;this.url+=(no.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request$1.prototype.clone=function(){return new Request$1(this,{body:this._bodyInit})};function decode(Xr){var eo=new FormData;return Xr.trim().split("&").forEach(function(to){if(to){var ro=to.split("="),no=ro.shift().replace(/\+/g," "),io=ro.join("=").replace(/\+/g," ");eo.append(decodeURIComponent(no),decodeURIComponent(io))}}),eo}function parseHeaders(Xr){var eo=new Headers$1,to=Xr.replace(/\r?\n[\t ]+/g," ");return to.split("\r").map(function(ro){return ro.indexOf(` -`)===0?ro.substr(1,ro.length):ro}).forEach(function(ro){var no=ro.split(":"),io=no.shift().trim();if(io){var oo=no.join(":").trim();try{eo.append(io,oo)}catch(ao){console.warn("Response "+ao.message)}}}),eo}Body.call(Request$1.prototype);function Response$1(Xr,eo){if(!(this instanceof Response$1))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(eo||(eo={}),this.type="default",this.status=eo.status===void 0?200:eo.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=eo.statusText===void 0?"":""+eo.statusText,this.headers=new Headers$1(eo.headers),this.url=eo.url||"",this._initBody(Xr)}Body.call(Response$1.prototype);Response$1.prototype.clone=function(){return new Response$1(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers$1(this.headers),url:this.url})};Response$1.error=function(){var Xr=new Response$1(null,{status:200,statusText:""});return Xr.ok=!1,Xr.status=0,Xr.type="error",Xr};var redirectStatuses=[301,302,303,307,308];Response$1.redirect=function(Xr,eo){if(redirectStatuses.indexOf(eo)===-1)throw new RangeError("Invalid status code");return new Response$1(null,{status:eo,headers:{location:Xr}})};var DOMException$1=g$2.DOMException;try{new DOMException$1}catch(Xr){DOMException$1=function(eo,to){this.message=eo,this.name=to;var ro=Error(eo);this.stack=ro.stack},DOMException$1.prototype=Object.create(Error.prototype),DOMException$1.prototype.constructor=DOMException$1}function fetch$1(Xr,eo){return new Promise(function(to,ro){var no=new Request$1(Xr,eo);if(no.signal&&no.signal.aborted)return ro(new DOMException$1("Aborted","AbortError"));var io=new XMLHttpRequest;function oo(){io.abort()}io.onload=function(){var co={statusText:io.statusText,headers:parseHeaders(io.getAllResponseHeaders()||"")};no.url.indexOf("file://")===0&&(io.status<200||io.status>599)?co.status=200:co.status=io.status,co.url="responseURL"in io?io.responseURL:co.headers.get("X-Request-URL");var lo="response"in io?io.response:io.responseText;setTimeout(function(){to(new Response$1(lo,co))},0)},io.onerror=function(){setTimeout(function(){ro(new TypeError("Network request failed"))},0)},io.ontimeout=function(){setTimeout(function(){ro(new TypeError("Network request timed out"))},0)},io.onabort=function(){setTimeout(function(){ro(new DOMException$1("Aborted","AbortError"))},0)};function ao(co){try{return co===""&&g$2.location.href?g$2.location.href:co}catch{return co}}if(io.open(no.method,ao(no.url),!0),no.credentials==="include"?io.withCredentials=!0:no.credentials==="omit"&&(io.withCredentials=!1),"responseType"in io&&(support.blob?io.responseType="blob":support.arrayBuffer&&(io.responseType="arraybuffer")),eo&&typeof eo.headers=="object"&&!(eo.headers instanceof Headers$1||g$2.Headers&&eo.headers instanceof g$2.Headers)){var so=[];Object.getOwnPropertyNames(eo.headers).forEach(function(co){so.push(normalizeName(co)),io.setRequestHeader(co,normalizeValue(eo.headers[co]))}),no.headers.forEach(function(co,lo){so.indexOf(lo)===-1&&io.setRequestHeader(lo,co)})}else no.headers.forEach(function(co,lo){io.setRequestHeader(lo,co)});no.signal&&(no.signal.addEventListener("abort",oo),io.onreadystatechange=function(){io.readyState===4&&no.signal.removeEventListener("abort",oo)}),io.send(typeof no._bodyInit>"u"?null:no._bodyInit)})}fetch$1.polyfill=!0;g$2.fetch||(g$2.fetch=fetch$1,g$2.Headers=Headers$1,g$2.Request=Request$1,g$2.Response=Response$1);var fetchNpmBrowserify=self.fetch.bind(self);const isomorphicFetch=getDefaultExportFromCjs$2(fetchNpmBrowserify);var urlJoin={exports:{}};(function(Xr){(function(eo,to,ro){Xr.exports?Xr.exports=ro():to[eo]=ro()})("urljoin",commonjsGlobal,function(){function eo(to){var ro=[];if(to.length===0)return"";if(typeof to[0]!="string")throw new TypeError("Url must be a string. Received "+to[0]);if(to[0].match(/^[^/:]+:\/*$/)&&to.length>1){var no=to.shift();to[0]=no+to[0]}to[0].match(/^file:\/\/\//)?to[0]=to[0].replace(/^([^/:]+):\/*/,"$1:///"):to[0]=to[0].replace(/^([^/:]+):\/*/,"$1://");for(var io=0;io0&&(oo=oo.replace(/^[\/]+/,"")),io0?"?":"")+so.join("&"),ao}return function(){var to;return typeof arguments[0]=="object"?to=arguments[0]:to=[].slice.call(arguments),eo(to)}})})(urlJoin);var urlJoinExports=urlJoin.exports;const urljoin2=getDefaultExportFromCjs$2(urlJoinExports);var __defProp=Object.defineProperty,__export=(Xr,eo)=>{for(var to in eo)__defProp(Xr,to,{get:eo[to],enumerable:!0})},constants_exports={};__export(constants_exports,{ADDR_BOUND:()=>ADDR_BOUND,API_VERSION:()=>API_VERSION,BN_FEE_TRANSACTION_VERSION_1:()=>BN_FEE_TRANSACTION_VERSION_1,BN_FEE_TRANSACTION_VERSION_2:()=>BN_FEE_TRANSACTION_VERSION_2,BN_TRANSACTION_VERSION_1:()=>BN_TRANSACTION_VERSION_1,BN_TRANSACTION_VERSION_2:()=>BN_TRANSACTION_VERSION_2,BaseUrl:()=>BaseUrl,HEX_STR_TRANSACTION_VERSION_1:()=>HEX_STR_TRANSACTION_VERSION_1,HEX_STR_TRANSACTION_VERSION_2:()=>HEX_STR_TRANSACTION_VERSION_2,IS_BROWSER:()=>IS_BROWSER,MASK_250:()=>MASK_250,MAX_STORAGE_ITEM_SIZE:()=>MAX_STORAGE_ITEM_SIZE,NetworkName:()=>NetworkName,RPC_DEFAULT_VERSION:()=>RPC_DEFAULT_VERSION,RPC_NODES:()=>RPC_NODES,StarknetChainId:()=>StarknetChainId,TEXT_TO_FELT_MAX_LEN:()=>TEXT_TO_FELT_MAX_LEN,TransactionHashPrefix:()=>TransactionHashPrefix,UDC:()=>UDC,ZERO:()=>ZERO});var encode_exports={};__export(encode_exports,{IS_BROWSER:()=>IS_BROWSER,addHexPrefix:()=>addHexPrefix,arrayBufferToString:()=>arrayBufferToString,atobUniversal:()=>atobUniversal,btoaUniversal:()=>btoaUniversal,buf2hex:()=>buf2hex,calcByteLength:()=>calcByteLength,padLeft:()=>padLeft,pascalToSnake:()=>pascalToSnake,removeHexPrefix:()=>removeHexPrefix,sanitizeBytes:()=>sanitizeBytes,sanitizeHex:()=>sanitizeHex,stringToArrayBuffer:()=>stringToArrayBuffer,utf8ToArray:()=>utf8ToArray});var IS_BROWSER=typeof window<"u",STRING_ZERO="0";function arrayBufferToString(Xr){return new Uint8Array(Xr).reduce((eo,to)=>eo+String.fromCharCode(to),"")}function utf8ToArray(Xr){return new TextEncoder().encode(Xr)}function stringToArrayBuffer(Xr){return utf8ToArray(Xr)}function atobUniversal(Xr){return base64$2.decode(Xr)}function btoaUniversal(Xr){return base64$2.encode(new Uint8Array(Xr))}function buf2hex(Xr){return Xr.reduce((eo,to)=>eo+to.toString(16).padStart(2,"0"),"")}function removeHexPrefix(Xr){return Xr.replace(/^0x/i,"")}function addHexPrefix(Xr){return`0x${removeHexPrefix(Xr)}`}function padString(Xr,eo,to,ro=STRING_ZERO){const no=eo-Xr.length;let io=Xr;return no>0&&(io=ro.repeat(no)+Xr),io}function padLeft(Xr,eo,to=STRING_ZERO){return padString(Xr,eo,!0,to)}function calcByteLength(Xr,eo=8){const{length:to}=Xr,ro=to%eo;return ro?(to-ro)/eo*eo+eo:to}function sanitizeBytes(Xr,eo=8,to=STRING_ZERO){return padLeft(Xr,calcByteLength(Xr,eo),to)}function sanitizeHex(Xr){return Xr=removeHexPrefix(Xr),Xr=sanitizeBytes(Xr,2),Xr&&(Xr=addHexPrefix(Xr)),Xr}var pascalToSnake=Xr=>/[a-z]/.test(Xr)?Xr.split(/(?=[A-Z])/).join("_").toUpperCase():Xr,TEXT_TO_FELT_MAX_LEN=31,HEX_STR_TRANSACTION_VERSION_1="0x1",HEX_STR_TRANSACTION_VERSION_2="0x2",BN_TRANSACTION_VERSION_1=1n,BN_TRANSACTION_VERSION_2=2n,BN_FEE_TRANSACTION_VERSION_1=2n**128n+BN_TRANSACTION_VERSION_1,BN_FEE_TRANSACTION_VERSION_2=2n**128n+BN_TRANSACTION_VERSION_2,ZERO=0n,MASK_250=2n**250n-1n,API_VERSION=ZERO,MAX_STORAGE_ITEM_SIZE=256n,ADDR_BOUND=2n**251n-MAX_STORAGE_ITEM_SIZE,BaseUrl=(Xr=>(Xr.SN_MAIN="https://alpha-mainnet.starknet.io",Xr.SN_GOERLI="https://alpha4.starknet.io",Xr.SN_SEPOLIA="https://alpha-sepolia.starknet.io",Xr))(BaseUrl||{}),NetworkName=(Xr=>(Xr.SN_MAIN="SN_MAIN",Xr.SN_GOERLI="SN_GOERLI",Xr.SN_SEPOLIA="SN_SEPOLIA",Xr))(NetworkName||{}),StarknetChainId=(Xr=>(Xr.SN_MAIN="0x534e5f4d41494e",Xr.SN_GOERLI="0x534e5f474f45524c49",Xr.SN_SEPOLIA="0x534e5f5345504f4c4941",Xr))(StarknetChainId||{}),TransactionHashPrefix=(Xr=>(Xr.DECLARE="0x6465636c617265",Xr.DEPLOY="0x6465706c6f79",Xr.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",Xr.INVOKE="0x696e766f6b65",Xr.L1_HANDLER="0x6c315f68616e646c6572",Xr))(TransactionHashPrefix||{}),UDC={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},RPC_DEFAULT_VERSION="v0_5",RPC_NODES={SN_GOERLI:["https://starknet-testnet.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/goerli-juno/"],SN_MAIN:["https://starknet-mainnet.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/mainnet-juno/"],SN_SEPOLIA:["https://starknet-sepolia.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/sepolia-juno/"]},types_exports={};__export(types_exports,{BlockStatus:()=>BlockStatus,BlockTag:()=>BlockTag,EntryPointType:()=>EntryPointType,Litteral:()=>Litteral,RPC:()=>rpc_exports,SIMULATION_FLAG:()=>SIMULATION_FLAG,Sequencer:()=>sequencer_exports,TransactionExecutionStatus:()=>TransactionExecutionStatus,TransactionFinalityStatus:()=>TransactionFinalityStatus,TransactionStatus:()=>TransactionStatus,TransactionType:()=>TransactionType,Uint:()=>Uint,ValidateType:()=>ValidateType});var SIMULATION_FLAG=(Xr=>(Xr.SKIP_VALIDATE="SKIP_VALIDATE",Xr.SKIP_EXECUTE="SKIP_EXECUTE",Xr))(SIMULATION_FLAG||{}),ValidateType=(Xr=>(Xr.DEPLOY="DEPLOY",Xr.CALL="CALL",Xr.INVOKE="INVOKE",Xr))(ValidateType||{}),Uint=(Xr=>(Xr.u8="core::integer::u8",Xr.u16="core::integer::u16",Xr.u32="core::integer::u32",Xr.u64="core::integer::u64",Xr.u128="core::integer::u128",Xr.u256="core::integer::u256",Xr))(Uint||{}),Litteral=(Xr=>(Xr.ClassHash="core::starknet::class_hash::ClassHash",Xr.ContractAddress="core::starknet::contract_address::ContractAddress",Xr))(Litteral||{}),EntryPointType=(Xr=>(Xr.EXTERNAL="EXTERNAL",Xr.L1_HANDLER="L1_HANDLER",Xr.CONSTRUCTOR="CONSTRUCTOR",Xr))(EntryPointType||{}),TransactionType=(Xr=>(Xr.DECLARE="DECLARE",Xr.DEPLOY="DEPLOY",Xr.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",Xr.INVOKE="INVOKE_FUNCTION",Xr))(TransactionType||{}),TransactionStatus=(Xr=>(Xr.NOT_RECEIVED="NOT_RECEIVED",Xr.RECEIVED="RECEIVED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr.REJECTED="REJECTED",Xr.REVERTED="REVERTED",Xr))(TransactionStatus||{}),TransactionFinalityStatus=(Xr=>(Xr.NOT_RECEIVED="NOT_RECEIVED",Xr.RECEIVED="RECEIVED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(TransactionFinalityStatus||{}),TransactionExecutionStatus=(Xr=>(Xr.REJECTED="REJECTED",Xr.REVERTED="REVERTED",Xr.SUCCEEDED="SUCCEEDED",Xr))(TransactionExecutionStatus||{}),BlockStatus=(Xr=>(Xr.PENDING="PENDING",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.REJECTED="REJECTED",Xr))(BlockStatus||{}),BlockTag=(Xr=>(Xr.pending="pending",Xr.latest="latest",Xr))(BlockTag||{}),rpc_exports={};__export(rpc_exports,{EBlockTag:()=>EBlockTag,EDataAvailabilityMode:()=>EDataAvailabilityMode,ESimulationFlag:()=>ESimulationFlag,ETransactionExecutionStatus:()=>ETransactionExecutionStatus,ETransactionFinalityStatus:()=>ETransactionFinalityStatus,ETransactionStatus:()=>ETransactionStatus,ETransactionType:()=>ETransactionType,Errors:()=>errors_exports,JRPC:()=>jsonrpc_exports,SPEC:()=>components_exports});var jsonrpc_exports={},errors_exports={},components_exports={},ETransactionType=(Xr=>(Xr.DECLARE="DECLARE",Xr.DEPLOY="DEPLOY",Xr.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",Xr.INVOKE="INVOKE",Xr.L1_HANDLER="L1_HANDLER",Xr))(ETransactionType||{}),ESimulationFlag=(Xr=>(Xr.SKIP_VALIDATE="SKIP_VALIDATE",Xr.SKIP_FEE_CHARGE="SKIP_FEE_CHARGE",Xr))(ESimulationFlag||{}),ETransactionStatus=(Xr=>(Xr.RECEIVED="RECEIVED",Xr.REJECTED="REJECTED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(ETransactionStatus||{}),ETransactionFinalityStatus=(Xr=>(Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(ETransactionFinalityStatus||{}),ETransactionExecutionStatus=(Xr=>(Xr.SUCCEEDED="SUCCEEDED",Xr.REVERTED="REVERTED",Xr))(ETransactionExecutionStatus||{}),EBlockTag=(Xr=>(Xr.LATEST="latest",Xr.PENDING="pending",Xr))(EBlockTag||{}),EDataAvailabilityMode=(Xr=>(Xr.L1="L1",Xr.L2="L2",Xr))(EDataAvailabilityMode||{}),sequencer_exports={};function assert$2(Xr,eo){if(!Xr)throw new Error(eo||"Assertion failure")}var num_exports={};__export(num_exports,{assertInRange:()=>assertInRange,bigNumberishArrayToDecimalStringArray:()=>bigNumberishArrayToDecimalStringArray,bigNumberishArrayToHexadecimalStringArray:()=>bigNumberishArrayToHexadecimalStringArray,cleanHex:()=>cleanHex,getDecimalString:()=>getDecimalString,getHexString:()=>getHexString,getHexStringArray:()=>getHexStringArray,hexToBytes:()=>hexToBytes,hexToDecimalString:()=>hexToDecimalString,isBigInt:()=>isBigInt,isHex:()=>isHex,isStringWholeNumber:()=>isStringWholeNumber,toBigInt:()=>toBigInt,toCairoBool:()=>toCairoBool,toHex:()=>toHex,toHexString:()=>toHexString,toStorageKey:()=>toStorageKey});function isHex(Xr){return/^0x[0-9a-f]*$/i.test(Xr)}function toBigInt(Xr){return BigInt(Xr)}function isBigInt(Xr){return typeof Xr=="bigint"}function toHex(Xr){return addHexPrefix(toBigInt(Xr).toString(16))}var toHexString=toHex;function toStorageKey(Xr){return addHexPrefix(toBigInt(Xr).toString(16).padStart(64,"0"))}function hexToDecimalString(Xr){return BigInt(addHexPrefix(Xr)).toString(10)}var cleanHex=Xr=>Xr.toLowerCase().replace(/^(0x)0+/,"$1");function assertInRange(Xr,eo,to,ro=""){const no=ro===""?"invalid length":`invalid ${ro} length`,io=BigInt(Xr),oo=BigInt(eo),ao=BigInt(to);assert$2(io>=oo&&io<=ao,`Message not signable, ${no}.`)}function bigNumberishArrayToDecimalStringArray(Xr){return Xr.map(eo=>toBigInt(eo).toString(10))}function bigNumberishArrayToHexadecimalStringArray(Xr){return Xr.map(eo=>toHex(eo))}var isStringWholeNumber=Xr=>/^\d+$/.test(Xr);function getDecimalString(Xr){if(isHex(Xr))return hexToDecimalString(Xr);if(isStringWholeNumber(Xr))return Xr;throw new Error(`${Xr} need to be hex-string or whole-number-string`)}function getHexString(Xr){if(isHex(Xr))return Xr;if(isStringWholeNumber(Xr))return toHexString(Xr);throw new Error(`${Xr} need to be hex-string or whole-number-string`)}function getHexStringArray(Xr){return Xr.map(eo=>getHexString(eo))}var toCairoBool=Xr=>(+Xr).toString();function hexToBytes(Xr){if(!isHex(Xr))throw new Error(`${Xr} need to be a hex-string`);let eo=removeHexPrefix(Xr);return eo.length%2!==0&&(eo=`0${eo}`),hexToBytes$2(eo)}var selector_exports={};__export(selector_exports,{getSelector:()=>getSelector,getSelectorFromName:()=>getSelectorFromName,keccakBn:()=>keccakBn,starknetKeccak:()=>starknetKeccak});function keccakBn(Xr){const eo=removeHexPrefix(toHex(BigInt(Xr))),to=eo.length%2===0?eo:`0${eo}`;return addHexPrefix(keccak(hexToBytes(addHexPrefix(to))).toString(16))}function keccakHex(Xr){return addHexPrefix(keccak(utf8ToArray(Xr)).toString(16))}function starknetKeccak(Xr){return BigInt(keccakHex(Xr))&MASK_250}function getSelectorFromName(Xr){return toHex(starknetKeccak(Xr))}function getSelector(Xr){return isHex(Xr)?Xr:isStringWholeNumber(Xr)?toHexString(Xr):getSelectorFromName(Xr)}var shortString_exports={};__export(shortString_exports,{decodeShortString:()=>decodeShortString,encodeShortString:()=>encodeShortString,isASCII:()=>isASCII,isDecimalString:()=>isDecimalString,isLongText:()=>isLongText,isShortString:()=>isShortString,isShortText:()=>isShortText,isText:()=>isText,splitLongString:()=>splitLongString});function isASCII(Xr){return/^[\x00-\x7F]*$/.test(Xr)}function isShortString(Xr){return Xr.length<=TEXT_TO_FELT_MAX_LEN}function isDecimalString(Xr){return/^[0-9]*$/i.test(Xr)}function isText(Xr){return typeof Xr=="string"&&!isHex(Xr)&&!isStringWholeNumber(Xr)}var isShortText=Xr=>isText(Xr)&&isShortString(Xr),isLongText=Xr=>isText(Xr)&&!isShortString(Xr);function splitLongString(Xr){const eo=RegExp(`[^]{1,${TEXT_TO_FELT_MAX_LEN}}`,"g");return Xr.match(eo)||[]}function encodeShortString(Xr){if(!isASCII(Xr))throw new Error(`${Xr} is not an ASCII string`);if(!isShortString(Xr))throw new Error(`${Xr} is too long`);return addHexPrefix(Xr.replace(/./g,eo=>eo.charCodeAt(0).toString(16)))}function decodeShortString(Xr){if(!isASCII(Xr))throw new Error(`${Xr} is not an ASCII string`);if(isHex(Xr))return removeHexPrefix(Xr).replace(/.{2}/g,eo=>String.fromCharCode(parseInt(eo,16)));if(isDecimalString(Xr))return decodeShortString("0X".concat(BigInt(Xr).toString(16)));throw new Error(`${Xr} is not Hex or decimal`)}var cairo_exports={};__export(cairo_exports,{felt:()=>felt,getAbiContractVersion:()=>getAbiContractVersion,getArrayType:()=>getArrayType,isCairo1Abi:()=>isCairo1Abi,isCairo1Type:()=>isCairo1Type,isLen:()=>isLen,isTypeArray:()=>isTypeArray,isTypeBool:()=>isTypeBool,isTypeContractAddress:()=>isTypeContractAddress,isTypeEnum:()=>isTypeEnum,isTypeEthAddress:()=>isTypeEthAddress,isTypeFelt:()=>isTypeFelt,isTypeLitteral:()=>isTypeLitteral,isTypeNamedTuple:()=>isTypeNamedTuple,isTypeOption:()=>isTypeOption,isTypeResult:()=>isTypeResult,isTypeStruct:()=>isTypeStruct,isTypeTuple:()=>isTypeTuple,isTypeUint:()=>isTypeUint,isTypeUint256:()=>isTypeUint256,tuple:()=>tuple,uint256:()=>uint256});var uint256_exports={};__export(uint256_exports,{UINT_128_MAX:()=>UINT_128_MAX,UINT_256_MAX:()=>UINT_256_MAX,bnToUint256:()=>bnToUint256,isUint256:()=>isUint256,uint256ToBN:()=>uint256ToBN});var UINT_128_MAX=(1n<<128n)-1n,UINT_256_MAX=(1n<<256n)-1n;function uint256ToBN(Xr){return(toBigInt(Xr.high)<<128n)+toBigInt(Xr.low)}function isUint256(Xr){return toBigInt(Xr)<=UINT_256_MAX}function bnToUint256(Xr){const eo=toBigInt(Xr);if(!isUint256(eo))throw new Error("Number is too large");return{low:addHexPrefix((eo&UINT_128_MAX).toString(16)),high:addHexPrefix((eo>>128n).toString(16))}}var isLen=Xr=>/_len$/.test(Xr),isTypeFelt=Xr=>Xr==="felt"||Xr==="core::felt252",isTypeArray=Xr=>/\*/.test(Xr)||Xr.startsWith("core::array::Array::")||Xr.startsWith("core::array::Span::"),isTypeTuple=Xr=>/^\(.*\)$/i.test(Xr),isTypeNamedTuple=Xr=>/\(.*\)/i.test(Xr)&&Xr.includes(":"),isTypeStruct=(Xr,eo)=>Xr in eo,isTypeEnum=(Xr,eo)=>Xr in eo,isTypeOption=Xr=>Xr.startsWith("core::option::Option::"),isTypeResult=Xr=>Xr.startsWith("core::result::Result::"),isTypeUint=Xr=>Object.values(Uint).includes(Xr),isTypeLitteral=Xr=>Object.values(Litteral).includes(Xr),isTypeUint256=Xr=>Xr==="core::integer::u256",isTypeBool=Xr=>Xr==="core::bool",isTypeContractAddress=Xr=>Xr==="core::starknet::contract_address::ContractAddress",isTypeEthAddress=Xr=>Xr==="core::starknet::eth_address::EthAddress",isCairo1Type=Xr=>Xr.includes("::"),getArrayType=Xr=>isCairo1Type(Xr)?Xr.substring(Xr.indexOf("<")+1,Xr.lastIndexOf(">")):Xr.replace("*","");function isCairo1Abi(Xr){const{cairo:eo}=getAbiContractVersion(Xr);if(eo===void 0)throw Error("Unable to determine Cairo version");return eo==="1"}function getAbiContractVersion(Xr){if(Xr.find(ro=>ro.type==="interface"))return{cairo:"1",compiler:"2"};const eo=Xr.find(ro=>ro.type==="function"&&(ro.inputs.length||ro.outputs.length));if(!eo)return{cairo:void 0,compiler:void 0};const to=eo.inputs.length?eo.inputs:eo.outputs;return isCairo1Type(to[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var uint256=Xr=>{const eo=BigInt(Xr);if(!isUint256(eo))throw new Error("Number is too large");return{low:(eo&UINT_128_MAX).toString(10),high:(eo>>128n).toString(10)}},tuple=(...Xr)=>({...Xr});function felt(Xr){if(isBigInt(Xr)||typeof Xr=="number"&&Number.isInteger(Xr))return Xr.toString();if(isText(Xr)){if(!isShortString(Xr))throw new Error(`${Xr} is a long string > 31 chars, felt can store short strings, split it to array of short strings`);const eo=encodeShortString(Xr);return BigInt(eo).toString()}if(typeof Xr=="string"&&isHex(Xr))return BigInt(Xr).toString();if(typeof Xr=="string"&&isStringWholeNumber(Xr))return Xr;if(typeof Xr=="boolean")return`${+Xr}`;throw new Error(`${Xr} can't be computed by felt()`)}var CairoCustomEnum=class{constructor(Xr){const eo=Object.values(Xr);if(eo.length===0)throw new Error("This Enum must have a least 1 variant");if(eo.filter(ro=>typeof ro<"u").length!==1)throw new Error("This Enum must have exactly one active variant");this.variant=Xr}unwrap(){const eo=Object.entries(this.variant).find(to=>typeof to[1]<"u");if(!(typeof eo>"u"))return eo[1]}activeVariant(){const eo=Object.entries(this.variant).find(to=>typeof to[1]<"u");return typeof eo>"u"?"":eo[0]}},CairoOptionVariant=(Xr=>(Xr[Xr.Some=0]="Some",Xr[Xr.None=1]="None",Xr))(CairoOptionVariant||{}),CairoOption=class{constructor(Xr,eo){if(!(Xr in CairoOptionVariant))throw new Error("Wrong variant : should be CairoOptionVariant.Some or .None.");if(Xr===0){if(typeof eo>"u")throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=eo,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){if(!this.None)return this.Some}isSome(){return!(typeof this.Some>"u")}isNone(){return this.None===!0}},CairoResultVariant=(Xr=>(Xr[Xr.Ok=0]="Ok",Xr[Xr.Err=1]="Err",Xr))(CairoResultVariant||{}),CairoResult=class{constructor(Xr,eo){if(!(Xr in CairoResultVariant))throw new Error("Wrong variant : should be CairoResultVariant.Ok or .Err.");Xr===0?(this.Ok=eo,this.Err=void 0):(this.Ok=void 0,this.Err=eo)}unwrap(){if(typeof this.Ok<"u")return this.Ok;if(typeof this.Err<"u")return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!(typeof this.Ok>"u")}isErr(){return!(typeof this.Err>"u")}},guard={isBN:(Xr,eo,to)=>{if(!isBigInt(Xr[to]))throw new Error(`Data and formatter mismatch on ${to}:${eo[to]}, expected response data ${to}:${Xr[to]} to be BN instead it is ${typeof Xr[to]}`)},unknown:(Xr,eo,to)=>{throw new Error(`Unhandled formatter type on ${to}:${eo[to]} for data ${to}:${Xr[to]}`)}};function formatter(Xr,eo,to){return Object.entries(Xr).reduce((ro,[no,io])=>{const oo=to??eo[no];if(!(no in eo)&&!to)return ro[no]=io,ro;if(oo==="string"){if(Array.isArray(Xr[no])){const ao=formatter(Xr[no],Xr[no].map(so=>oo));return ro[no]=Object.values(ao).join(""),ro}return guard.isBN(Xr,eo,no),ro[no]=decodeShortString(io),ro}if(oo==="number")return guard.isBN(Xr,eo,no),ro[no]=Number(io),ro;if(typeof oo=="function")return ro[no]=oo(io),ro;if(Array.isArray(oo)){const ao=formatter(Xr[no],oo,oo[0]);return ro[no]=Object.values(ao),ro}return typeof oo=="object"?(ro[no]=formatter(Xr[no],oo),ro):(guard.unknown(Xr,eo,no),ro)},{})}var AbiParser1=class{constructor(Xr){this.abi=Xr}methodInputsLength(Xr){return Xr.inputs.reduce((eo,to)=>isLen(to.name)?eo:eo+1,0)}getMethod(Xr){return this.abi.find(eo=>eo.name===Xr)}getLegacyFormat(){return this.abi}},AbiParser2=class{constructor(Xr){this.abi=Xr}methodInputsLength(Xr){return Xr.inputs.length}getMethod(Xr){return this.abi.find(to=>to.type==="interface").items.find(to=>to.name===Xr)}getLegacyFormat(){return this.abi.flatMap(Xr=>Xr.type==="interface"?Xr.items:Xr)}};function createAbiParser(Xr){const eo=getAbiVersion(Xr);if(eo===0||eo===1)return new AbiParser1(Xr);if(eo===2)return new AbiParser2(Xr);throw Error(`Unsupported ABI version ${eo}`)}function getAbiVersion(Xr){return Xr.find(eo=>eo.type==="interface")?2:isCairo1Abi(Xr)?1:0}function isNoConstructorValid(Xr,eo,to){return Xr==="constructor"&&!to&&!eo.length}function parseNamedTuple(Xr){const eo=Xr.substring(0,Xr.indexOf(":")),to=Xr.substring(eo.length+1);return{name:eo,type:to}}function parseSubTuple(Xr){if(!Xr.includes("("))return{subTuple:[],result:Xr};const eo=[];let to="",ro=0;for(;roto.length?io.replace(" ",to.shift()):io);return isTypeNamedTuple(Xr)&&(no=no.reduce((io,oo)=>io.concat(parseNamedTuple(oo)),[])),no}function extractCairo1Tuple(Xr){const eo=Xr.replace(/\s/g,"").slice(1,-1),{subTuple:to,result:ro}=parseSubTuple(eo);return ro.split(",").map(io=>to.length?io.replace(" ",to.shift()):io)}function extractTupleMemberTypes(Xr){return isCairo1Type(Xr)?extractCairo1Tuple(Xr):extractCairo0Tuple(Xr)}function errorU256(Xr){return Error(`Your object includes the property : ${Xr}, containing an Uint256 object without the 'low' and 'high' keys.`)}function orderPropsByAbi(Xr,eo,to,ro){const no=(lo,fo)=>{if(isTypeArray(fo))return oo(lo,fo);if(isTypeEnum(fo,ro)){const ho=ro[fo];return so(lo,ho)}if(isTypeTuple(fo))return ao(lo,fo);if(isTypeEthAddress(fo))return lo;if(isTypeUint256(fo)){const ho=lo;if(typeof ho!="object")return ho;if(!("low"in ho&&"high"in ho))throw errorU256(fo);return{low:ho.low,high:ho.high}}if(isTypeStruct(fo,to)){const ho=to[fo].members;return io(lo,ho)}return lo},io=(lo,fo)=>fo.reduce((go,yo)=>{const vo=wo=>Object.defineProperty(go,yo.name,{enumerable:!0,value:wo??lo[yo.name]});if(lo[yo.name]==="undefined"&&(isCairo1Type(yo.type)||!isLen(yo.name)))throw Error(`Your object needs a property with key : ${yo.name} .`);return vo(no(lo[yo.name],yo.type)),go},{});function oo(lo,fo){const ho=getArrayType(fo);return typeof lo=="string"?lo:lo.map(go=>no(go,ho))}function ao(lo,fo){return extractTupleMemberTypes(fo).reduce((yo,vo,wo)=>{const Eo=Object.keys(lo),ko=Po=>Object.defineProperty(yo,wo.toString(),{enumerable:!0,value:Po??lo[Eo[wo]]}),Ao=vo!=null&&vo.type?vo.type:vo;return ko(no(lo[Eo[wo]],Ao)),yo},{})}const so=(lo,fo)=>{if(isTypeResult(fo.name)){const vo=lo,wo=fo.name.substring(fo.name.indexOf("<")+1,fo.name.lastIndexOf(",")),Eo=fo.name.substring(fo.name.indexOf(",")+1,fo.name.lastIndexOf(">"));return vo.isOk()?new CairoResult(0,no(lo.unwrap(),wo)):new CairoResult(1,no(lo.unwrap(),Eo))}if(isTypeOption(fo.name)){const vo=lo,wo=fo.name.substring(fo.name.indexOf("<")+1,fo.name.lastIndexOf(">"));return vo.isSome()?new CairoOption(0,no(vo.unwrap(),wo)):new CairoOption(1,{})}const ho=lo,yo=Object.entries(ho.variant).map(vo=>{if(typeof vo[1]>"u")return vo;const wo=fo.type.substring(fo.type.lastIndexOf("<")+1,fo.type.lastIndexOf(">"));return wo==="()"?vo:[vo[0],no(ho.unwrap(),wo)]});return new CairoCustomEnum(Object.fromEntries(yo))};return eo.reduce((lo,fo)=>{const ho=go=>Object.defineProperty(lo,fo.name,{enumerable:!0,value:go});return isLen(fo.name)&&!isCairo1Type(fo.type)||ho(no(Xr[fo.name],fo.type)),lo},{})}function parseBaseTypes(Xr,eo){switch(!0){case isTypeUint256(Xr):const to=uint256(eo);return[felt(to.low),felt(to.high)];default:return felt(eo)}}function parseTuple(Xr,eo){const to=extractTupleMemberTypes(eo),ro=Object.values(Xr);if(ro.length!==to.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match. +`+uo+"]":"]",go}function so(lo,uo){if(typeof lo.toJSON=="function")return stringify(lo.toJSON(),eo,to,void 0);var ho=Array.isArray(eo)?eo.map(String):Object.keys(lo);if(ho.length===0)return"{}";var go=no?uo+no:void 0,bo=!0,wo=no?`{ +`:"{";return ho.forEach(function(Eo){var $o=typeof eo=="function"?eo.call(lo,Eo,lo[Eo]):lo[Eo];if(co(Eo,$o)){bo?bo=!1:wo+=no?`, +`:",";var Co=JSON.stringify(Eo);wo+=no?go+Co+": ":Co+":",wo+=oo($o,go)}}),wo+=no?` +`+uo+"}":"}",wo}function co(lo,uo){return typeof uo<"u"&&typeof uo!="function"&&_typeof(uo)!=="symbol"}}function resolveSpace(Xr){if(typeof Xr=="number")return" ".repeat(Xr);if(typeof Xr=="string"&&Xr!=="")return Xr}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validateOpts(Xr){const{Fp:eo,mds:to,reversePartialPowIdx:ro,roundConstants:no}=Xr,{roundsFull:io,roundsPartial:oo,sboxPower:ao,t:so}=Xr;validateField(eo);for(const bo of["t","roundsFull","roundsPartial"])if(typeof Xr[bo]!="number"||!Number.isSafeInteger(Xr[bo]))throw new Error(`Poseidon: invalid param ${bo}=${Xr[bo]} (${typeof Xr[bo]})`);if(!Array.isArray(to)||to.length!==so)throw new Error("Poseidon: wrong MDS matrix");const co=to.map(bo=>{if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon MDS matrix row: ${bo}`);return bo.map(wo=>{if(typeof wo!="bigint")throw new Error(`Poseidon MDS matrix value=${wo}`);return eo.create(wo)})});if(ro!==void 0&&typeof ro!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${ro}`);if(io%2!==0)throw new Error(`Poseidon roundsFull is not even: ${io}`);const lo=io+oo;if(!Array.isArray(no)||no.length!==lo)throw new Error("Poseidon: wrong round constants");const uo=no.map(bo=>{if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon wrong round constants: ${bo}`);return bo.map(wo=>{if(typeof wo!="bigint"||!eo.isValid(wo))throw new Error(`Poseidon wrong round constant=${wo}`);return eo.create(wo)})});if(!ao||![3,5,7].includes(ao))throw new Error(`Poseidon wrong sboxPower=${ao}`);const ho=BigInt(ao);let go=bo=>FpPow(eo,bo,ho);return ao===3?go=bo=>eo.mul(eo.sqrN(bo),bo):ao===5&&(go=bo=>eo.mul(eo.sqrN(eo.sqrN(bo)),bo)),Object.freeze({...Xr,rounds:lo,sboxFn:go,roundConstants:uo,mds:co})}function splitConstants(Xr,eo){if(typeof eo!="number")throw new Error("poseidonSplitConstants: wrong t");if(!Array.isArray(Xr)||Xr.length%eo)throw new Error("poseidonSplitConstants: wrong rc");const to=[];let ro=[];for(let no=0;no(go=go.map((Eo,$o)=>to.add(Eo,no[wo][$o])),bo?go=go.map(Eo=>ao(Eo)):go[lo]=ao(go[lo]),go=ro.map(Eo=>Eo.reduce(($o,Co,Ro)=>to.add($o,to.mulN(Co,go[Ro])),to.ZERO)),go),ho=function(bo){if(!Array.isArray(bo)||bo.length!==so)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${so})`);bo=bo.map(Eo=>{if(typeof Eo!="bigint")throw new Error(`Poseidon: wrong value=${Eo} (${typeof Eo})`);return to.create(Eo)});let wo=0;for(let Eo=0;Eo=0;)Xr[eo]=0}const STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,BL_CODES$1=19,HEAP_SIZE$1=2*L_CODES$1+1,MAX_BITS$1=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),extra_dbits=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),extra_blbits=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl_order=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DIST_CODE_LEN=512,static_ltree=new Array((L_CODES$1+2)*2);zero$1(static_ltree);const static_dtree=new Array(D_CODES$1*2);zero$1(static_dtree);const _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);const _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);const base_length=new Array(LENGTH_CODES$1);zero$1(base_length);const base_dist=new Array(D_CODES$1);zero$1(base_dist);function StaticTreeDesc(Xr,eo,to,ro,no){this.static_tree=Xr,this.extra_bits=eo,this.extra_base=to,this.elems=ro,this.max_length=no,this.has_stree=Xr&&Xr.length}let static_l_desc,static_d_desc,static_bl_desc;function TreeDesc(Xr,eo){this.dyn_tree=Xr,this.max_code=0,this.stat_desc=eo}const d_code=Xr=>Xr<256?_dist_code[Xr]:_dist_code[256+(Xr>>>7)],put_short=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo&255,Xr.pending_buf[Xr.pending++]=eo>>>8&255},send_bits=(Xr,eo,to)=>{Xr.bi_valid>Buf_size-to?(Xr.bi_buf|=eo<>Buf_size-Xr.bi_valid,Xr.bi_valid+=to-Buf_size):(Xr.bi_buf|=eo<{send_bits(Xr,to[eo*2],to[eo*2+1])},bi_reverse=(Xr,eo)=>{let to=0;do to|=Xr&1,Xr>>>=1,to<<=1;while(--eo>0);return to>>>1},bi_flush=Xr=>{Xr.bi_valid===16?(put_short(Xr,Xr.bi_buf),Xr.bi_buf=0,Xr.bi_valid=0):Xr.bi_valid>=8&&(Xr.pending_buf[Xr.pending++]=Xr.bi_buf&255,Xr.bi_buf>>=8,Xr.bi_valid-=8)},gen_bitlen=(Xr,eo)=>{const to=eo.dyn_tree,ro=eo.max_code,no=eo.stat_desc.static_tree,io=eo.stat_desc.has_stree,oo=eo.stat_desc.extra_bits,ao=eo.stat_desc.extra_base,so=eo.stat_desc.max_length;let co,lo,uo,ho,go,bo,wo=0;for(ho=0;ho<=MAX_BITS$1;ho++)Xr.bl_count[ho]=0;for(to[Xr.heap[Xr.heap_max]*2+1]=0,co=Xr.heap_max+1;coso&&(ho=so,wo++),to[lo*2+1]=ho,!(lo>ro)&&(Xr.bl_count[ho]++,go=0,lo>=ao&&(go=oo[lo-ao]),bo=to[lo*2],Xr.opt_len+=bo*(ho+go),io&&(Xr.static_len+=bo*(no[lo*2+1]+go)));if(wo!==0){do{for(ho=so-1;Xr.bl_count[ho]===0;)ho--;Xr.bl_count[ho]--,Xr.bl_count[ho+1]+=2,Xr.bl_count[so]--,wo-=2}while(wo>0);for(ho=so;ho!==0;ho--)for(lo=Xr.bl_count[ho];lo!==0;)uo=Xr.heap[--co],!(uo>ro)&&(to[uo*2+1]!==ho&&(Xr.opt_len+=(ho-to[uo*2+1])*to[uo*2],to[uo*2+1]=ho),lo--)}},gen_codes=(Xr,eo,to)=>{const ro=new Array(MAX_BITS$1+1);let no=0,io,oo;for(io=1;io<=MAX_BITS$1;io++)no=no+to[io-1]<<1,ro[io]=no;for(oo=0;oo<=eo;oo++){let ao=Xr[oo*2+1];ao!==0&&(Xr[oo*2]=bi_reverse(ro[ao]++,ao))}},tr_static_init=()=>{let Xr,eo,to,ro,no;const io=new Array(MAX_BITS$1+1);for(to=0,ro=0;ro>=7;ro{let eo;for(eo=0;eo{Xr.bi_valid>8?put_short(Xr,Xr.bi_buf):Xr.bi_valid>0&&(Xr.pending_buf[Xr.pending++]=Xr.bi_buf),Xr.bi_buf=0,Xr.bi_valid=0},smaller=(Xr,eo,to,ro)=>{const no=eo*2,io=to*2;return Xr[no]{const ro=Xr.heap[to];let no=to<<1;for(;no<=Xr.heap_len&&(no{let ro,no,io=0,oo,ao;if(Xr.sym_next!==0)do ro=Xr.pending_buf[Xr.sym_buf+io++]&255,ro+=(Xr.pending_buf[Xr.sym_buf+io++]&255)<<8,no=Xr.pending_buf[Xr.sym_buf+io++],ro===0?send_code(Xr,no,eo):(oo=_length_code[no],send_code(Xr,oo+LITERALS$1+1,eo),ao=extra_lbits[oo],ao!==0&&(no-=base_length[oo],send_bits(Xr,no,ao)),ro--,oo=d_code(ro),send_code(Xr,oo,to),ao=extra_dbits[oo],ao!==0&&(ro-=base_dist[oo],send_bits(Xr,ro,ao)));while(io{const to=eo.dyn_tree,ro=eo.stat_desc.static_tree,no=eo.stat_desc.has_stree,io=eo.stat_desc.elems;let oo,ao,so=-1,co;for(Xr.heap_len=0,Xr.heap_max=HEAP_SIZE$1,oo=0;oo>1;oo>=1;oo--)pqdownheap(Xr,to,oo);co=io;do oo=Xr.heap[1],Xr.heap[1]=Xr.heap[Xr.heap_len--],pqdownheap(Xr,to,1),ao=Xr.heap[1],Xr.heap[--Xr.heap_max]=oo,Xr.heap[--Xr.heap_max]=ao,to[co*2]=to[oo*2]+to[ao*2],Xr.depth[co]=(Xr.depth[oo]>=Xr.depth[ao]?Xr.depth[oo]:Xr.depth[ao])+1,to[oo*2+1]=to[ao*2+1]=co,Xr.heap[1]=co++,pqdownheap(Xr,to,1);while(Xr.heap_len>=2);Xr.heap[--Xr.heap_max]=Xr.heap[1],gen_bitlen(Xr,eo),gen_codes(to,so,Xr.bl_count)},scan_tree=(Xr,eo,to)=>{let ro,no=-1,io,oo=eo[0*2+1],ao=0,so=7,co=4;for(oo===0&&(so=138,co=3),eo[(to+1)*2+1]=65535,ro=0;ro<=to;ro++)io=oo,oo=eo[(ro+1)*2+1],!(++ao{let ro,no=-1,io,oo=eo[0*2+1],ao=0,so=7,co=4;for(oo===0&&(so=138,co=3),ro=0;ro<=to;ro++)if(io=oo,oo=eo[(ro+1)*2+1],!(++ao{let eo;for(scan_tree(Xr,Xr.dyn_ltree,Xr.l_desc.max_code),scan_tree(Xr,Xr.dyn_dtree,Xr.d_desc.max_code),build_tree(Xr,Xr.bl_desc),eo=BL_CODES$1-1;eo>=3&&Xr.bl_tree[bl_order[eo]*2+1]===0;eo--);return Xr.opt_len+=3*(eo+1)+5+5+4,eo},send_all_trees=(Xr,eo,to,ro)=>{let no;for(send_bits(Xr,eo-257,5),send_bits(Xr,to-1,5),send_bits(Xr,ro-4,4),no=0;no{let eo=4093624447,to;for(to=0;to<=31;to++,eo>>>=1)if(eo&1&&Xr.dyn_ltree[to*2]!==0)return Z_BINARY;if(Xr.dyn_ltree[9*2]!==0||Xr.dyn_ltree[10*2]!==0||Xr.dyn_ltree[13*2]!==0)return Z_TEXT;for(to=32;to{static_init_done||(tr_static_init(),static_init_done=!0),Xr.l_desc=new TreeDesc(Xr.dyn_ltree,static_l_desc),Xr.d_desc=new TreeDesc(Xr.dyn_dtree,static_d_desc),Xr.bl_desc=new TreeDesc(Xr.bl_tree,static_bl_desc),Xr.bi_buf=0,Xr.bi_valid=0,init_block(Xr)},_tr_stored_block$1=(Xr,eo,to,ro)=>{send_bits(Xr,(STORED_BLOCK<<1)+(ro?1:0),3),bi_windup(Xr),put_short(Xr,to),put_short(Xr,~to),to&&Xr.pending_buf.set(Xr.window.subarray(eo,eo+to),Xr.pending),Xr.pending+=to},_tr_align$1=Xr=>{send_bits(Xr,STATIC_TREES<<1,3),send_code(Xr,END_BLOCK,static_ltree),bi_flush(Xr)},_tr_flush_block$1=(Xr,eo,to,ro)=>{let no,io,oo=0;Xr.level>0?(Xr.strm.data_type===Z_UNKNOWN$1&&(Xr.strm.data_type=detect_data_type(Xr)),build_tree(Xr,Xr.l_desc),build_tree(Xr,Xr.d_desc),oo=build_bl_tree(Xr),no=Xr.opt_len+3+7>>>3,io=Xr.static_len+3+7>>>3,io<=no&&(no=io)):no=io=to+5,to+4<=no&&eo!==-1?_tr_stored_block$1(Xr,eo,to,ro):Xr.strategy===Z_FIXED$1||io===no?(send_bits(Xr,(STATIC_TREES<<1)+(ro?1:0),3),compress_block(Xr,static_ltree,static_dtree)):(send_bits(Xr,(DYN_TREES<<1)+(ro?1:0),3),send_all_trees(Xr,Xr.l_desc.max_code+1,Xr.d_desc.max_code+1,oo+1),compress_block(Xr,Xr.dyn_ltree,Xr.dyn_dtree)),init_block(Xr),ro&&bi_windup(Xr)},_tr_tally$1=(Xr,eo,to)=>(Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=eo,Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=eo>>8,Xr.pending_buf[Xr.sym_buf+Xr.sym_next++]=to,eo===0?Xr.dyn_ltree[to*2]++:(Xr.matches++,eo--,Xr.dyn_ltree[(_length_code[to]+LITERALS$1+1)*2]++,Xr.dyn_dtree[d_code(eo)*2]++),Xr.sym_next===Xr.sym_end);var _tr_init_1=_tr_init$1,_tr_stored_block_1=_tr_stored_block$1,_tr_flush_block_1=_tr_flush_block$1,_tr_tally_1=_tr_tally$1,_tr_align_1=_tr_align$1,trees={_tr_init:_tr_init_1,_tr_stored_block:_tr_stored_block_1,_tr_flush_block:_tr_flush_block_1,_tr_tally:_tr_tally_1,_tr_align:_tr_align_1};const adler32=(Xr,eo,to,ro)=>{let no=Xr&65535|0,io=Xr>>>16&65535|0,oo=0;for(;to!==0;){oo=to>2e3?2e3:to,to-=oo;do no=no+eo[ro++]|0,io=io+no|0;while(--oo);no%=65521,io%=65521}return no|io<<16|0};var adler32_1=adler32;const makeTable=()=>{let Xr,eo=[];for(var to=0;to<256;to++){Xr=to;for(var ro=0;ro<8;ro++)Xr=Xr&1?3988292384^Xr>>>1:Xr>>>1;eo[to]=Xr}return eo},crcTable=new Uint32Array(makeTable()),crc32=(Xr,eo,to,ro)=>{const no=crcTable,io=ro+to;Xr^=-1;for(let oo=ro;oo>>8^no[(Xr^eo[oo])&255];return Xr^-1};var crc32_1=crc32,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},constants$2={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init,_tr_stored_block,_tr_flush_block,_tr_tally,_tr_align}=trees,{Z_NO_FLUSH:Z_NO_FLUSH$2,Z_PARTIAL_FLUSH,Z_FULL_FLUSH:Z_FULL_FLUSH$1,Z_FINISH:Z_FINISH$3,Z_BLOCK:Z_BLOCK$1,Z_OK:Z_OK$3,Z_STREAM_END:Z_STREAM_END$3,Z_STREAM_ERROR:Z_STREAM_ERROR$2,Z_DATA_ERROR:Z_DATA_ERROR$2,Z_BUF_ERROR:Z_BUF_ERROR$1,Z_DEFAULT_COMPRESSION:Z_DEFAULT_COMPRESSION$1,Z_FILTERED,Z_HUFFMAN_ONLY,Z_RLE,Z_FIXED,Z_DEFAULT_STRATEGY:Z_DEFAULT_STRATEGY$1,Z_UNKNOWN,Z_DEFLATED:Z_DEFLATED$2}=constants$2,MAX_MEM_LEVEL=9,MAX_WBITS$1=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,GZIP_STATE=57,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3,err=(Xr,eo)=>(Xr.msg=messages[eo],eo),rank=Xr=>Xr*2-(Xr>4?9:0),zero=Xr=>{let eo=Xr.length;for(;--eo>=0;)Xr[eo]=0},slide_hash=Xr=>{let eo,to,ro,no=Xr.w_size;eo=Xr.hash_size,ro=eo;do to=Xr.head[--ro],Xr.head[ro]=to>=no?to-no:0;while(--eo);eo=no,ro=eo;do to=Xr.prev[--ro],Xr.prev[ro]=to>=no?to-no:0;while(--eo)};let HASH_ZLIB=(Xr,eo,to)=>(eo<{const eo=Xr.state;let to=eo.pending;to>Xr.avail_out&&(to=Xr.avail_out),to!==0&&(Xr.output.set(eo.pending_buf.subarray(eo.pending_out,eo.pending_out+to),Xr.next_out),Xr.next_out+=to,eo.pending_out+=to,Xr.total_out+=to,Xr.avail_out-=to,eo.pending-=to,eo.pending===0&&(eo.pending_out=0))},flush_block_only=(Xr,eo)=>{_tr_flush_block(Xr,Xr.block_start>=0?Xr.block_start:-1,Xr.strstart-Xr.block_start,eo),Xr.block_start=Xr.strstart,flush_pending(Xr.strm)},put_byte=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo},putShortMSB=(Xr,eo)=>{Xr.pending_buf[Xr.pending++]=eo>>>8&255,Xr.pending_buf[Xr.pending++]=eo&255},read_buf=(Xr,eo,to,ro)=>{let no=Xr.avail_in;return no>ro&&(no=ro),no===0?0:(Xr.avail_in-=no,eo.set(Xr.input.subarray(Xr.next_in,Xr.next_in+no),to),Xr.state.wrap===1?Xr.adler=adler32_1(Xr.adler,eo,no,to):Xr.state.wrap===2&&(Xr.adler=crc32_1(Xr.adler,eo,no,to)),Xr.next_in+=no,Xr.total_in+=no,no)},longest_match=(Xr,eo)=>{let to=Xr.max_chain_length,ro=Xr.strstart,no,io,oo=Xr.prev_length,ao=Xr.nice_match;const so=Xr.strstart>Xr.w_size-MIN_LOOKAHEAD?Xr.strstart-(Xr.w_size-MIN_LOOKAHEAD):0,co=Xr.window,lo=Xr.w_mask,uo=Xr.prev,ho=Xr.strstart+MAX_MATCH;let go=co[ro+oo-1],bo=co[ro+oo];Xr.prev_length>=Xr.good_match&&(to>>=2),ao>Xr.lookahead&&(ao=Xr.lookahead);do if(no=eo,!(co[no+oo]!==bo||co[no+oo-1]!==go||co[no]!==co[ro]||co[++no]!==co[ro+1])){ro+=2,no++;do;while(co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&co[++ro]===co[++no]&&rooo){if(Xr.match_start=eo,oo=io,io>=ao)break;go=co[ro+oo-1],bo=co[ro+oo]}}while((eo=uo[eo&lo])>so&&--to!==0);return oo<=Xr.lookahead?oo:Xr.lookahead},fill_window=Xr=>{const eo=Xr.w_size;let to,ro,no;do{if(ro=Xr.window_size-Xr.lookahead-Xr.strstart,Xr.strstart>=eo+(eo-MIN_LOOKAHEAD)&&(Xr.window.set(Xr.window.subarray(eo,eo+eo-ro),0),Xr.match_start-=eo,Xr.strstart-=eo,Xr.block_start-=eo,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart),slide_hash(Xr),ro+=eo),Xr.strm.avail_in===0)break;if(to=read_buf(Xr.strm,Xr.window,Xr.strstart+Xr.lookahead,ro),Xr.lookahead+=to,Xr.lookahead+Xr.insert>=MIN_MATCH)for(no=Xr.strstart-Xr.insert,Xr.ins_h=Xr.window[no],Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[no+1]);Xr.insert&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[no+MIN_MATCH-1]),Xr.prev[no&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=no,no++,Xr.insert--,!(Xr.lookahead+Xr.insert{let to=Xr.pending_buf_size-5>Xr.w_size?Xr.w_size:Xr.pending_buf_size-5,ro,no,io,oo=0,ao=Xr.strm.avail_in;do{if(ro=65535,io=Xr.bi_valid+42>>3,Xr.strm.avail_outno+Xr.strm.avail_in&&(ro=no+Xr.strm.avail_in),ro>io&&(ro=io),ro>8,Xr.pending_buf[Xr.pending-2]=~ro,Xr.pending_buf[Xr.pending-1]=~ro>>8,flush_pending(Xr.strm),no&&(no>ro&&(no=ro),Xr.strm.output.set(Xr.window.subarray(Xr.block_start,Xr.block_start+no),Xr.strm.next_out),Xr.strm.next_out+=no,Xr.strm.avail_out-=no,Xr.strm.total_out+=no,Xr.block_start+=no,ro-=no),ro&&(read_buf(Xr.strm,Xr.strm.output,Xr.strm.next_out,ro),Xr.strm.next_out+=ro,Xr.strm.avail_out-=ro,Xr.strm.total_out+=ro)}while(oo===0);return ao-=Xr.strm.avail_in,ao&&(ao>=Xr.w_size?(Xr.matches=2,Xr.window.set(Xr.strm.input.subarray(Xr.strm.next_in-Xr.w_size,Xr.strm.next_in),0),Xr.strstart=Xr.w_size,Xr.insert=Xr.strstart):(Xr.window_size-Xr.strstart<=ao&&(Xr.strstart-=Xr.w_size,Xr.window.set(Xr.window.subarray(Xr.w_size,Xr.w_size+Xr.strstart),0),Xr.matches<2&&Xr.matches++,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart)),Xr.window.set(Xr.strm.input.subarray(Xr.strm.next_in-ao,Xr.strm.next_in),Xr.strstart),Xr.strstart+=ao,Xr.insert+=ao>Xr.w_size-Xr.insert?Xr.w_size-Xr.insert:ao),Xr.block_start=Xr.strstart),Xr.high_waterio&&Xr.block_start>=Xr.w_size&&(Xr.block_start-=Xr.w_size,Xr.strstart-=Xr.w_size,Xr.window.set(Xr.window.subarray(Xr.w_size,Xr.w_size+Xr.strstart),0),Xr.matches<2&&Xr.matches++,io+=Xr.w_size,Xr.insert>Xr.strstart&&(Xr.insert=Xr.strstart)),io>Xr.strm.avail_in&&(io=Xr.strm.avail_in),io&&(read_buf(Xr.strm,Xr.window,Xr.strstart,io),Xr.strstart+=io,Xr.insert+=io>Xr.w_size-Xr.insert?Xr.w_size-Xr.insert:io),Xr.high_water>3,io=Xr.pending_buf_size-io>65535?65535:Xr.pending_buf_size-io,to=io>Xr.w_size?Xr.w_size:io,no=Xr.strstart-Xr.block_start,(no>=to||(no||eo===Z_FINISH$3)&&eo!==Z_NO_FLUSH$2&&Xr.strm.avail_in===0&&no<=io)&&(ro=no>io?io:no,oo=eo===Z_FINISH$3&&Xr.strm.avail_in===0&&ro===no?1:0,_tr_stored_block(Xr,Xr.block_start,ro,oo),Xr.block_start+=ro,flush_pending(Xr.strm)),oo?BS_FINISH_STARTED:BS_NEED_MORE)},deflate_fast=(Xr,eo)=>{let to,ro;for(;;){if(Xr.lookahead=MIN_MATCH&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart),to!==0&&Xr.strstart-to<=Xr.w_size-MIN_LOOKAHEAD&&(Xr.match_length=longest_match(Xr,to)),Xr.match_length>=MIN_MATCH)if(ro=_tr_tally(Xr,Xr.strstart-Xr.match_start,Xr.match_length-MIN_MATCH),Xr.lookahead-=Xr.match_length,Xr.match_length<=Xr.max_lazy_match&&Xr.lookahead>=MIN_MATCH){Xr.match_length--;do Xr.strstart++,Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart;while(--Xr.match_length!==0);Xr.strstart++}else Xr.strstart+=Xr.match_length,Xr.match_length=0,Xr.ins_h=Xr.window[Xr.strstart],Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+1]);else ro=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++;if(ro&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=Xr.strstart{let to,ro,no;for(;;){if(Xr.lookahead=MIN_MATCH&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart),Xr.prev_length=Xr.match_length,Xr.prev_match=Xr.match_start,Xr.match_length=MIN_MATCH-1,to!==0&&Xr.prev_length4096)&&(Xr.match_length=MIN_MATCH-1)),Xr.prev_length>=MIN_MATCH&&Xr.match_length<=Xr.prev_length){no=Xr.strstart+Xr.lookahead-MIN_MATCH,ro=_tr_tally(Xr,Xr.strstart-1-Xr.prev_match,Xr.prev_length-MIN_MATCH),Xr.lookahead-=Xr.prev_length-1,Xr.prev_length-=2;do++Xr.strstart<=no&&(Xr.ins_h=HASH(Xr,Xr.ins_h,Xr.window[Xr.strstart+MIN_MATCH-1]),to=Xr.prev[Xr.strstart&Xr.w_mask]=Xr.head[Xr.ins_h],Xr.head[Xr.ins_h]=Xr.strstart);while(--Xr.prev_length!==0);if(Xr.match_available=0,Xr.match_length=MIN_MATCH-1,Xr.strstart++,ro&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}else if(Xr.match_available){if(ro=_tr_tally(Xr,0,Xr.window[Xr.strstart-1]),ro&&flush_block_only(Xr,!1),Xr.strstart++,Xr.lookahead--,Xr.strm.avail_out===0)return BS_NEED_MORE}else Xr.match_available=1,Xr.strstart++,Xr.lookahead--}return Xr.match_available&&(ro=_tr_tally(Xr,0,Xr.window[Xr.strstart-1]),Xr.match_available=0),Xr.insert=Xr.strstart{let to,ro,no,io;const oo=Xr.window;for(;;){if(Xr.lookahead<=MAX_MATCH){if(fill_window(Xr),Xr.lookahead<=MAX_MATCH&&eo===Z_NO_FLUSH$2)return BS_NEED_MORE;if(Xr.lookahead===0)break}if(Xr.match_length=0,Xr.lookahead>=MIN_MATCH&&Xr.strstart>0&&(no=Xr.strstart-1,ro=oo[no],ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no])){io=Xr.strstart+MAX_MATCH;do;while(ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&ro===oo[++no]&&noXr.lookahead&&(Xr.match_length=Xr.lookahead)}if(Xr.match_length>=MIN_MATCH?(to=_tr_tally(Xr,1,Xr.match_length-MIN_MATCH),Xr.lookahead-=Xr.match_length,Xr.strstart+=Xr.match_length,Xr.match_length=0):(to=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++),to&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=0,eo===Z_FINISH$3?(flush_block_only(Xr,!0),Xr.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):Xr.sym_next&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE},deflate_huff=(Xr,eo)=>{let to;for(;;){if(Xr.lookahead===0&&(fill_window(Xr),Xr.lookahead===0)){if(eo===Z_NO_FLUSH$2)return BS_NEED_MORE;break}if(Xr.match_length=0,to=_tr_tally(Xr,0,Xr.window[Xr.strstart]),Xr.lookahead--,Xr.strstart++,to&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0))return BS_NEED_MORE}return Xr.insert=0,eo===Z_FINISH$3?(flush_block_only(Xr,!0),Xr.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):Xr.sym_next&&(flush_block_only(Xr,!1),Xr.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE};function Config(Xr,eo,to,ro,no){this.good_length=Xr,this.max_lazy=eo,this.nice_length=to,this.max_chain=ro,this.func=no}const configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],lm_init=Xr=>{Xr.window_size=2*Xr.w_size,zero(Xr.head),Xr.max_lazy_match=configuration_table[Xr.level].max_lazy,Xr.good_match=configuration_table[Xr.level].good_length,Xr.nice_match=configuration_table[Xr.level].nice_length,Xr.max_chain_length=configuration_table[Xr.level].max_chain,Xr.strstart=0,Xr.block_start=0,Xr.lookahead=0,Xr.insert=0,Xr.match_length=Xr.prev_length=MIN_MATCH-1,Xr.match_available=0,Xr.ins_h=0};function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED$2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HEAP_SIZE*2),this.dyn_dtree=new Uint16Array((2*D_CODES+1)*2),this.bl_tree=new Uint16Array((2*BL_CODES+1)*2),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(MAX_BITS+1),this.heap=new Uint16Array(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*L_CODES+1),zero(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const deflateStateCheck=Xr=>{if(!Xr)return 1;const eo=Xr.state;return!eo||eo.strm!==Xr||eo.status!==INIT_STATE&&eo.status!==GZIP_STATE&&eo.status!==EXTRA_STATE&&eo.status!==NAME_STATE&&eo.status!==COMMENT_STATE&&eo.status!==HCRC_STATE&&eo.status!==BUSY_STATE&&eo.status!==FINISH_STATE?1:0},deflateResetKeep=Xr=>{if(deflateStateCheck(Xr))return err(Xr,Z_STREAM_ERROR$2);Xr.total_in=Xr.total_out=0,Xr.data_type=Z_UNKNOWN;const eo=Xr.state;return eo.pending=0,eo.pending_out=0,eo.wrap<0&&(eo.wrap=-eo.wrap),eo.status=eo.wrap===2?GZIP_STATE:eo.wrap?INIT_STATE:BUSY_STATE,Xr.adler=eo.wrap===2?0:1,eo.last_flush=-2,_tr_init(eo),Z_OK$3},deflateReset=Xr=>{const eo=deflateResetKeep(Xr);return eo===Z_OK$3&&lm_init(Xr.state),eo},deflateSetHeader=(Xr,eo)=>deflateStateCheck(Xr)||Xr.state.wrap!==2?Z_STREAM_ERROR$2:(Xr.state.gzhead=eo,Z_OK$3),deflateInit2=(Xr,eo,to,ro,no,io)=>{if(!Xr)return Z_STREAM_ERROR$2;let oo=1;if(eo===Z_DEFAULT_COMPRESSION$1&&(eo=6),ro<0?(oo=0,ro=-ro):ro>15&&(oo=2,ro-=16),no<1||no>MAX_MEM_LEVEL||to!==Z_DEFLATED$2||ro<8||ro>15||eo<0||eo>9||io<0||io>Z_FIXED||ro===8&&oo!==1)return err(Xr,Z_STREAM_ERROR$2);ro===8&&(ro=9);const ao=new DeflateState;return Xr.state=ao,ao.strm=Xr,ao.status=INIT_STATE,ao.wrap=oo,ao.gzhead=null,ao.w_bits=ro,ao.w_size=1<deflateInit2(Xr,eo,Z_DEFLATED$2,MAX_WBITS$1,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY$1),deflate$2=(Xr,eo)=>{if(deflateStateCheck(Xr)||eo>Z_BLOCK$1||eo<0)return Xr?err(Xr,Z_STREAM_ERROR$2):Z_STREAM_ERROR$2;const to=Xr.state;if(!Xr.output||Xr.avail_in!==0&&!Xr.input||to.status===FINISH_STATE&&eo!==Z_FINISH$3)return err(Xr,Xr.avail_out===0?Z_BUF_ERROR$1:Z_STREAM_ERROR$2);const ro=to.last_flush;if(to.last_flush=eo,to.pending!==0){if(flush_pending(Xr),Xr.avail_out===0)return to.last_flush=-1,Z_OK$3}else if(Xr.avail_in===0&&rank(eo)<=rank(ro)&&eo!==Z_FINISH$3)return err(Xr,Z_BUF_ERROR$1);if(to.status===FINISH_STATE&&Xr.avail_in!==0)return err(Xr,Z_BUF_ERROR$1);if(to.status===INIT_STATE&&to.wrap===0&&(to.status=BUSY_STATE),to.status===INIT_STATE){let no=Z_DEFLATED$2+(to.w_bits-8<<4)<<8,io=-1;if(to.strategy>=Z_HUFFMAN_ONLY||to.level<2?io=0:to.level<6?io=1:to.level===6?io=2:io=3,no|=io<<6,to.strstart!==0&&(no|=PRESET_DICT),no+=31-no%31,putShortMSB(to,no),to.strstart!==0&&(putShortMSB(to,Xr.adler>>>16),putShortMSB(to,Xr.adler&65535)),Xr.adler=1,to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(to.status===GZIP_STATE){if(Xr.adler=0,put_byte(to,31),put_byte(to,139),put_byte(to,8),to.gzhead)put_byte(to,(to.gzhead.text?1:0)+(to.gzhead.hcrc?2:0)+(to.gzhead.extra?4:0)+(to.gzhead.name?8:0)+(to.gzhead.comment?16:0)),put_byte(to,to.gzhead.time&255),put_byte(to,to.gzhead.time>>8&255),put_byte(to,to.gzhead.time>>16&255),put_byte(to,to.gzhead.time>>24&255),put_byte(to,to.level===9?2:to.strategy>=Z_HUFFMAN_ONLY||to.level<2?4:0),put_byte(to,to.gzhead.os&255),to.gzhead.extra&&to.gzhead.extra.length&&(put_byte(to,to.gzhead.extra.length&255),put_byte(to,to.gzhead.extra.length>>8&255)),to.gzhead.hcrc&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending,0)),to.gzindex=0,to.status=EXTRA_STATE;else if(put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,0),put_byte(to,to.level===9?2:to.strategy>=Z_HUFFMAN_ONLY||to.level<2?4:0),put_byte(to,OS_CODE),to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(to.status===EXTRA_STATE){if(to.gzhead.extra){let no=to.pending,io=(to.gzhead.extra.length&65535)-to.gzindex;for(;to.pending+io>to.pending_buf_size;){let ao=to.pending_buf_size-to.pending;if(to.pending_buf.set(to.gzhead.extra.subarray(to.gzindex,to.gzindex+ao),to.pending),to.pending=to.pending_buf_size,to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex+=ao,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0,io-=ao}let oo=new Uint8Array(to.gzhead.extra);to.pending_buf.set(oo.subarray(to.gzindex,to.gzindex+io),to.pending),to.pending+=io,to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex=0}to.status=NAME_STATE}if(to.status===NAME_STATE){if(to.gzhead.name){let no=to.pending,io;do{if(to.pending===to.pending_buf_size){if(to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0}to.gzindexno&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),to.gzindex=0}to.status=COMMENT_STATE}if(to.status===COMMENT_STATE){if(to.gzhead.comment){let no=to.pending,io;do{if(to.pending===to.pending_buf_size){if(to.gzhead.hcrc&&to.pending>no&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no)),flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3;no=0}to.gzindexno&&(Xr.adler=crc32_1(Xr.adler,to.pending_buf,to.pending-no,no))}to.status=HCRC_STATE}if(to.status===HCRC_STATE){if(to.gzhead.hcrc){if(to.pending+2>to.pending_buf_size&&(flush_pending(Xr),to.pending!==0))return to.last_flush=-1,Z_OK$3;put_byte(to,Xr.adler&255),put_byte(to,Xr.adler>>8&255),Xr.adler=0}if(to.status=BUSY_STATE,flush_pending(Xr),to.pending!==0)return to.last_flush=-1,Z_OK$3}if(Xr.avail_in!==0||to.lookahead!==0||eo!==Z_NO_FLUSH$2&&to.status!==FINISH_STATE){let no=to.level===0?deflate_stored(to,eo):to.strategy===Z_HUFFMAN_ONLY?deflate_huff(to,eo):to.strategy===Z_RLE?deflate_rle(to,eo):configuration_table[to.level].func(to,eo);if((no===BS_FINISH_STARTED||no===BS_FINISH_DONE)&&(to.status=FINISH_STATE),no===BS_NEED_MORE||no===BS_FINISH_STARTED)return Xr.avail_out===0&&(to.last_flush=-1),Z_OK$3;if(no===BS_BLOCK_DONE&&(eo===Z_PARTIAL_FLUSH?_tr_align(to):eo!==Z_BLOCK$1&&(_tr_stored_block(to,0,0,!1),eo===Z_FULL_FLUSH$1&&(zero(to.head),to.lookahead===0&&(to.strstart=0,to.block_start=0,to.insert=0))),flush_pending(Xr),Xr.avail_out===0))return to.last_flush=-1,Z_OK$3}return eo!==Z_FINISH$3?Z_OK$3:to.wrap<=0?Z_STREAM_END$3:(to.wrap===2?(put_byte(to,Xr.adler&255),put_byte(to,Xr.adler>>8&255),put_byte(to,Xr.adler>>16&255),put_byte(to,Xr.adler>>24&255),put_byte(to,Xr.total_in&255),put_byte(to,Xr.total_in>>8&255),put_byte(to,Xr.total_in>>16&255),put_byte(to,Xr.total_in>>24&255)):(putShortMSB(to,Xr.adler>>>16),putShortMSB(to,Xr.adler&65535)),flush_pending(Xr),to.wrap>0&&(to.wrap=-to.wrap),to.pending!==0?Z_OK$3:Z_STREAM_END$3)},deflateEnd=Xr=>{if(deflateStateCheck(Xr))return Z_STREAM_ERROR$2;const eo=Xr.state.status;return Xr.state=null,eo===BUSY_STATE?err(Xr,Z_DATA_ERROR$2):Z_OK$3},deflateSetDictionary=(Xr,eo)=>{let to=eo.length;if(deflateStateCheck(Xr))return Z_STREAM_ERROR$2;const ro=Xr.state,no=ro.wrap;if(no===2||no===1&&ro.status!==INIT_STATE||ro.lookahead)return Z_STREAM_ERROR$2;if(no===1&&(Xr.adler=adler32_1(Xr.adler,eo,to,0)),ro.wrap=0,to>=ro.w_size){no===0&&(zero(ro.head),ro.strstart=0,ro.block_start=0,ro.insert=0);let so=new Uint8Array(ro.w_size);so.set(eo.subarray(to-ro.w_size,to),0),eo=so,to=ro.w_size}const io=Xr.avail_in,oo=Xr.next_in,ao=Xr.input;for(Xr.avail_in=to,Xr.next_in=0,Xr.input=eo,fill_window(ro);ro.lookahead>=MIN_MATCH;){let so=ro.strstart,co=ro.lookahead-(MIN_MATCH-1);do ro.ins_h=HASH(ro,ro.ins_h,ro.window[so+MIN_MATCH-1]),ro.prev[so&ro.w_mask]=ro.head[ro.ins_h],ro.head[ro.ins_h]=so,so++;while(--co);ro.strstart=so,ro.lookahead=MIN_MATCH-1,fill_window(ro)}return ro.strstart+=ro.lookahead,ro.block_start=ro.strstart,ro.insert=ro.lookahead,ro.lookahead=0,ro.match_length=ro.prev_length=MIN_MATCH-1,ro.match_available=0,Xr.next_in=oo,Xr.input=ao,Xr.avail_in=io,ro.wrap=no,Z_OK$3};var deflateInit_1=deflateInit,deflateInit2_1=deflateInit2,deflateReset_1=deflateReset,deflateResetKeep_1=deflateResetKeep,deflateSetHeader_1=deflateSetHeader,deflate_2$1=deflate$2,deflateEnd_1=deflateEnd,deflateSetDictionary_1=deflateSetDictionary,deflateInfo="pako deflate (from Nodeca project)",deflate_1$2={deflateInit:deflateInit_1,deflateInit2:deflateInit2_1,deflateReset:deflateReset_1,deflateResetKeep:deflateResetKeep_1,deflateSetHeader:deflateSetHeader_1,deflate:deflate_2$1,deflateEnd:deflateEnd_1,deflateSetDictionary:deflateSetDictionary_1,deflateInfo};const _has=(Xr,eo)=>Object.prototype.hasOwnProperty.call(Xr,eo);var assign=function(Xr){const eo=Array.prototype.slice.call(arguments,1);for(;eo.length;){const to=eo.shift();if(to){if(typeof to!="object")throw new TypeError(to+"must be non-object");for(const ro in to)_has(to,ro)&&(Xr[ro]=to[ro])}}return Xr},flattenChunks=Xr=>{let eo=0;for(let ro=0,no=Xr.length;ro=252?6:Xr>=248?5:Xr>=240?4:Xr>=224?3:Xr>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=Xr=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(Xr);let eo,to,ro,no,io,oo=Xr.length,ao=0;for(no=0;no>>6,eo[io++]=128|to&63):to<65536?(eo[io++]=224|to>>>12,eo[io++]=128|to>>>6&63,eo[io++]=128|to&63):(eo[io++]=240|to>>>18,eo[io++]=128|to>>>12&63,eo[io++]=128|to>>>6&63,eo[io++]=128|to&63);return eo};const buf2binstring=(Xr,eo)=>{if(eo<65534&&Xr.subarray&&STR_APPLY_UIA_OK)return String.fromCharCode.apply(null,Xr.length===eo?Xr:Xr.subarray(0,eo));let to="";for(let ro=0;ro{const to=eo||Xr.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(Xr.subarray(0,eo));let ro,no;const io=new Array(to*2);for(no=0,ro=0;ro4){io[no++]=65533,ro+=ao-1;continue}for(oo&=ao===2?31:ao===3?15:7;ao>1&&ro1){io[no++]=65533;continue}oo<65536?io[no++]=oo:(oo-=65536,io[no++]=55296|oo>>10&1023,io[no++]=56320|oo&1023)}return buf2binstring(io,no)},utf8border=(Xr,eo)=>{eo=eo||Xr.length,eo>Xr.length&&(eo=Xr.length);let to=eo-1;for(;to>=0&&(Xr[to]&192)===128;)to--;return to<0||to===0?eo:to+_utf8len[Xr[to]]>eo?to:eo},strings={string2buf,buf2string,utf8border};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;const toString$1=Object.prototype.toString,{Z_NO_FLUSH:Z_NO_FLUSH$1,Z_SYNC_FLUSH,Z_FULL_FLUSH,Z_FINISH:Z_FINISH$2,Z_OK:Z_OK$2,Z_STREAM_END:Z_STREAM_END$2,Z_DEFAULT_COMPRESSION,Z_DEFAULT_STRATEGY,Z_DEFLATED:Z_DEFLATED$1}=constants$2;function Deflate$1(Xr){this.options=common.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED$1,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY},Xr||{});let eo=this.options;eo.raw&&eo.windowBits>0?eo.windowBits=-eo.windowBits:eo.gzip&&eo.windowBits>0&&eo.windowBits<16&&(eo.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let to=deflate_1$2.deflateInit2(this.strm,eo.level,eo.method,eo.windowBits,eo.memLevel,eo.strategy);if(to!==Z_OK$2)throw new Error(messages[to]);if(eo.header&&deflate_1$2.deflateSetHeader(this.strm,eo.header),eo.dictionary){let ro;if(typeof eo.dictionary=="string"?ro=strings.string2buf(eo.dictionary):toString$1.call(eo.dictionary)==="[object ArrayBuffer]"?ro=new Uint8Array(eo.dictionary):ro=eo.dictionary,to=deflate_1$2.deflateSetDictionary(this.strm,ro),to!==Z_OK$2)throw new Error(messages[to]);this._dict_set=!0}}Deflate$1.prototype.push=function(Xr,eo){const to=this.strm,ro=this.options.chunkSize;let no,io;if(this.ended)return!1;for(eo===~~eo?io=eo:io=eo===!0?Z_FINISH$2:Z_NO_FLUSH$1,typeof Xr=="string"?to.input=strings.string2buf(Xr):toString$1.call(Xr)==="[object ArrayBuffer]"?to.input=new Uint8Array(Xr):to.input=Xr,to.next_in=0,to.avail_in=to.input.length;;){if(to.avail_out===0&&(to.output=new Uint8Array(ro),to.next_out=0,to.avail_out=ro),(io===Z_SYNC_FLUSH||io===Z_FULL_FLUSH)&&to.avail_out<=6){this.onData(to.output.subarray(0,to.next_out)),to.avail_out=0;continue}if(no=deflate_1$2.deflate(to,io),no===Z_STREAM_END$2)return to.next_out>0&&this.onData(to.output.subarray(0,to.next_out)),no=deflate_1$2.deflateEnd(this.strm),this.onEnd(no),this.ended=!0,no===Z_OK$2;if(to.avail_out===0){this.onData(to.output);continue}if(io>0&&to.next_out>0){this.onData(to.output.subarray(0,to.next_out)),to.avail_out=0;continue}if(to.avail_in===0)break}return!0};Deflate$1.prototype.onData=function(Xr){this.chunks.push(Xr)};Deflate$1.prototype.onEnd=function(Xr){Xr===Z_OK$2&&(this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=Xr,this.msg=this.strm.msg};function deflate$1(Xr,eo){const to=new Deflate$1(eo);if(to.push(Xr,!0),to.err)throw to.msg||messages[to.err];return to.result}function deflateRaw$1(Xr,eo){return eo=eo||{},eo.raw=!0,deflate$1(Xr,eo)}function gzip$1(Xr,eo){return eo=eo||{},eo.gzip=!0,deflate$1(Xr,eo)}var Deflate_1$1=Deflate$1,deflate_2=deflate$1,deflateRaw_1$1=deflateRaw$1,gzip_1$1=gzip$1,constants$1=constants$2,deflate_1$1={Deflate:Deflate_1$1,deflate:deflate_2,deflateRaw:deflateRaw_1$1,gzip:gzip_1$1,constants:constants$1};const BAD$1=16209,TYPE$1=16191;var inffast=function Xr(eo,to){let ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo,$o,Co,Ro,Oo,jo,Bo,Mo,Fo,Wo,Jo;const Po=eo.state;ro=eo.next_in,Wo=eo.input,no=ro+(eo.avail_in-5),io=eo.next_out,Jo=eo.output,oo=io-(to-eo.avail_out),ao=io+(eo.avail_out-257),so=Po.dmax,co=Po.wsize,lo=Po.whave,uo=Po.wnext,ho=Po.window,go=Po.hold,bo=Po.bits,wo=Po.lencode,Eo=Po.distcode,$o=(1<>>24,go>>>=Oo,bo-=Oo,Oo=Ro>>>16&255,Oo===0)Jo[io++]=Ro&65535;else if(Oo&16){jo=Ro&65535,Oo&=15,Oo&&(bo>>=Oo,bo-=Oo),bo<15&&(go+=Wo[ro++]<>>24,go>>>=Oo,bo-=Oo,Oo=Ro>>>16&255,Oo&16){if(Bo=Ro&65535,Oo&=15,boso){eo.msg="invalid distance too far back",Po.mode=BAD$1;break e}if(go>>>=Oo,bo-=Oo,Oo=io-oo,Bo>Oo){if(Oo=Bo-Oo,Oo>lo&&Po.sane){eo.msg="invalid distance too far back",Po.mode=BAD$1;break e}if(Mo=0,Fo=ho,uo===0){if(Mo+=co-Oo,Oo2;)Jo[io++]=Fo[Mo++],Jo[io++]=Fo[Mo++],Jo[io++]=Fo[Mo++],jo-=3;jo&&(Jo[io++]=Fo[Mo++],jo>1&&(Jo[io++]=Fo[Mo++]))}else{Mo=io-Bo;do Jo[io++]=Jo[Mo++],Jo[io++]=Jo[Mo++],Jo[io++]=Jo[Mo++],jo-=3;while(jo>2);jo&&(Jo[io++]=Jo[Mo++],jo>1&&(Jo[io++]=Jo[Mo++]))}}else if(Oo&64){eo.msg="invalid distance code",Po.mode=BAD$1;break e}else{Ro=Eo[(Ro&65535)+(go&(1<>3,ro-=jo,bo-=jo<<3,go&=(1<{const so=ao.bits;let co=0,lo=0,uo=0,ho=0,go=0,bo=0,wo=0,Eo=0,$o=0,Co=0,Ro,Oo,jo,Bo,Mo,Fo=null,Wo;const Jo=new Uint16Array(MAXBITS+1),Po=new Uint16Array(MAXBITS+1);let fo=null,yo,vo,_o;for(co=0;co<=MAXBITS;co++)Jo[co]=0;for(lo=0;lo=1&&Jo[ho]===0;ho--);if(go>ho&&(go=ho),ho===0)return no[io++]=1<<24|64<<16|0,no[io++]=1<<24|64<<16|0,ao.bits=1,0;for(uo=1;uo0&&(Xr===CODES$1||ho!==1))return-1;for(Po[1]=0,co=1;coENOUGH_LENS$1||Xr===DISTS$1&&$o>ENOUGH_DISTS$1)return 1;for(;;){yo=co-wo,oo[lo]+1=Wo?(vo=fo[oo[lo]-Wo],_o=Fo[oo[lo]-Wo]):(vo=96,_o=0),Ro=1<>wo)+Oo]=yo<<24|vo<<16|_o|0;while(Oo!==0);for(Ro=1<>=1;if(Ro!==0?(Co&=Ro-1,Co+=Ro):Co=0,lo++,--Jo[co]===0){if(co===ho)break;co=eo[to+oo[lo]]}if(co>go&&(Co&Bo)!==jo){for(wo===0&&(wo=go),Mo+=uo,bo=co-wo,Eo=1<ENOUGH_LENS$1||Xr===DISTS$1&&$o>ENOUGH_DISTS$1)return 1;jo=Co&Bo,no[jo]=go<<24|bo<<16|Mo-io|0}}return Co!==0&&(no[Mo+Co]=co-wo<<24|64<<16|0),ao.bits=go,0};var inftrees=inflate_table;const CODES=0,LENS=1,DISTS=2,{Z_FINISH:Z_FINISH$1,Z_BLOCK,Z_TREES,Z_OK:Z_OK$1,Z_STREAM_END:Z_STREAM_END$1,Z_NEED_DICT:Z_NEED_DICT$1,Z_STREAM_ERROR:Z_STREAM_ERROR$1,Z_DATA_ERROR:Z_DATA_ERROR$1,Z_MEM_ERROR:Z_MEM_ERROR$1,Z_BUF_ERROR,Z_DEFLATED}=constants$2,HEAD=16180,FLAGS=16181,TIME=16182,OS=16183,EXLEN=16184,EXTRA=16185,NAME=16186,COMMENT=16187,HCRC=16188,DICTID=16189,DICT=16190,TYPE=16191,TYPEDO=16192,STORED=16193,COPY_=16194,COPY=16195,TABLE=16196,LENLENS=16197,CODELENS=16198,LEN_=16199,LEN=16200,LENEXT=16201,DIST=16202,DISTEXT=16203,MATCH=16204,LIT=16205,CHECK=16206,LENGTH=16207,DONE=16208,BAD=16209,MEM=16210,SYNC=16211,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS,zswap32=Xr=>(Xr>>>24&255)+(Xr>>>8&65280)+((Xr&65280)<<8)+((Xr&255)<<24);function InflateState(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const inflateStateCheck=Xr=>{if(!Xr)return 1;const eo=Xr.state;return!eo||eo.strm!==Xr||eo.modeSYNC?1:0},inflateResetKeep=Xr=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const eo=Xr.state;return Xr.total_in=Xr.total_out=eo.total=0,Xr.msg="",eo.wrap&&(Xr.adler=eo.wrap&1),eo.mode=HEAD,eo.last=0,eo.havedict=0,eo.flags=-1,eo.dmax=32768,eo.head=null,eo.hold=0,eo.bits=0,eo.lencode=eo.lendyn=new Int32Array(ENOUGH_LENS),eo.distcode=eo.distdyn=new Int32Array(ENOUGH_DISTS),eo.sane=1,eo.back=-1,Z_OK$1},inflateReset=Xr=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const eo=Xr.state;return eo.wsize=0,eo.whave=0,eo.wnext=0,inflateResetKeep(Xr)},inflateReset2=(Xr,eo)=>{let to;if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const ro=Xr.state;return eo<0?(to=0,eo=-eo):(to=(eo>>4)+5,eo<48&&(eo&=15)),eo&&(eo<8||eo>15)?Z_STREAM_ERROR$1:(ro.window!==null&&ro.wbits!==eo&&(ro.window=null),ro.wrap=to,ro.wbits=eo,inflateReset(Xr))},inflateInit2=(Xr,eo)=>{if(!Xr)return Z_STREAM_ERROR$1;const to=new InflateState;Xr.state=to,to.strm=Xr,to.window=null,to.mode=HEAD;const ro=inflateReset2(Xr,eo);return ro!==Z_OK$1&&(Xr.state=null),ro},inflateInit=Xr=>inflateInit2(Xr,DEF_WBITS);let virgin=!0,lenfix,distfix;const fixedtables=Xr=>{if(virgin){lenfix=new Int32Array(512),distfix=new Int32Array(32);let eo=0;for(;eo<144;)Xr.lens[eo++]=8;for(;eo<256;)Xr.lens[eo++]=9;for(;eo<280;)Xr.lens[eo++]=7;for(;eo<288;)Xr.lens[eo++]=8;for(inftrees(LENS,Xr.lens,0,288,lenfix,0,Xr.work,{bits:9}),eo=0;eo<32;)Xr.lens[eo++]=5;inftrees(DISTS,Xr.lens,0,32,distfix,0,Xr.work,{bits:5}),virgin=!1}Xr.lencode=lenfix,Xr.lenbits=9,Xr.distcode=distfix,Xr.distbits=5},updatewindow=(Xr,eo,to,ro)=>{let no;const io=Xr.state;return io.window===null&&(io.wsize=1<=io.wsize?(io.window.set(eo.subarray(to-io.wsize,to),0),io.wnext=0,io.whave=io.wsize):(no=io.wsize-io.wnext,no>ro&&(no=ro),io.window.set(eo.subarray(to-ro,to-ro+no),io.wnext),ro-=no,ro?(io.window.set(eo.subarray(to-ro,to),0),io.wnext=ro,io.whave=io.wsize):(io.wnext+=no,io.wnext===io.wsize&&(io.wnext=0),io.whave{let to,ro,no,io,oo,ao,so,co,lo,uo,ho,go,bo,wo,Eo=0,$o,Co,Ro,Oo,jo,Bo,Mo,Fo;const Wo=new Uint8Array(4);let Jo,Po;const fo=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(inflateStateCheck(Xr)||!Xr.output||!Xr.input&&Xr.avail_in!==0)return Z_STREAM_ERROR$1;to=Xr.state,to.mode===TYPE&&(to.mode=TYPEDO),oo=Xr.next_out,no=Xr.output,so=Xr.avail_out,io=Xr.next_in,ro=Xr.input,ao=Xr.avail_in,co=to.hold,lo=to.bits,uo=ao,ho=so,Fo=Z_OK$1;e:for(;;)switch(to.mode){case HEAD:if(to.wrap===0){to.mode=TYPEDO;break}for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,to.check=crc32_1(to.check,Wo,2,0),co=0,lo=0,to.mode=FLAGS;break}if(to.head&&(to.head.done=!1),!(to.wrap&1)||(((co&255)<<8)+(co>>8))%31){Xr.msg="incorrect header check",to.mode=BAD;break}if((co&15)!==Z_DEFLATED){Xr.msg="unknown compression method",to.mode=BAD;break}if(co>>>=4,lo-=4,Mo=(co&15)+8,to.wbits===0&&(to.wbits=Mo),Mo>15||Mo>to.wbits){Xr.msg="invalid window size",to.mode=BAD;break}to.dmax=1<>8&1),to.flags&512&&to.wrap&4&&(Wo[0]=co&255,Wo[1]=co>>>8&255,to.check=crc32_1(to.check,Wo,2,0)),co=0,lo=0,to.mode=TIME;case TIME:for(;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,Wo[2]=co>>>16&255,Wo[3]=co>>>24&255,to.check=crc32_1(to.check,Wo,4,0)),co=0,lo=0,to.mode=OS;case OS:for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>8),to.flags&512&&to.wrap&4&&(Wo[0]=co&255,Wo[1]=co>>>8&255,to.check=crc32_1(to.check,Wo,2,0)),co=0,lo=0,to.mode=EXLEN;case EXLEN:if(to.flags&1024){for(;lo<16;){if(ao===0)break e;ao--,co+=ro[io++]<>>8&255,to.check=crc32_1(to.check,Wo,2,0)),co=0,lo=0}else to.head&&(to.head.extra=null);to.mode=EXTRA;case EXTRA:if(to.flags&1024&&(go=to.length,go>ao&&(go=ao),go&&(to.head&&(Mo=to.head.extra_len-to.length,to.head.extra||(to.head.extra=new Uint8Array(to.head.extra_len)),to.head.extra.set(ro.subarray(io,io+go),Mo)),to.flags&512&&to.wrap&4&&(to.check=crc32_1(to.check,ro,go,io)),ao-=go,io+=go,to.length-=go),to.length))break e;to.length=0,to.mode=NAME;case NAME:if(to.flags&2048){if(ao===0)break e;go=0;do Mo=ro[io+go++],to.head&&Mo&&to.length<65536&&(to.head.name+=String.fromCharCode(Mo));while(Mo&&go>9&1,to.head.done=!0),Xr.adler=to.check=0,to.mode=TYPE;break;case DICTID:for(;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>=lo&7,lo-=lo&7,to.mode=CHECK;break}for(;lo<3;){if(ao===0)break e;ao--,co+=ro[io++]<>>=1,lo-=1,co&3){case 0:to.mode=STORED;break;case 1:if(fixedtables(to),to.mode=LEN_,eo===Z_TREES){co>>>=2,lo-=2;break e}break;case 2:to.mode=TABLE;break;case 3:Xr.msg="invalid block type",to.mode=BAD}co>>>=2,lo-=2;break;case STORED:for(co>>>=lo&7,lo-=lo&7;lo<32;){if(ao===0)break e;ao--,co+=ro[io++]<>>16^65535)){Xr.msg="invalid stored block lengths",to.mode=BAD;break}if(to.length=co&65535,co=0,lo=0,to.mode=COPY_,eo===Z_TREES)break e;case COPY_:to.mode=COPY;case COPY:if(go=to.length,go){if(go>ao&&(go=ao),go>so&&(go=so),go===0)break e;no.set(ro.subarray(io,io+go),oo),ao-=go,io+=go,so-=go,oo+=go,to.length-=go;break}to.mode=TYPE;break;case TABLE:for(;lo<14;){if(ao===0)break e;ao--,co+=ro[io++]<>>=5,lo-=5,to.ndist=(co&31)+1,co>>>=5,lo-=5,to.ncode=(co&15)+4,co>>>=4,lo-=4,to.nlen>286||to.ndist>30){Xr.msg="too many length or distance symbols",to.mode=BAD;break}to.have=0,to.mode=LENLENS;case LENLENS:for(;to.have>>=3,lo-=3}for(;to.have<19;)to.lens[fo[to.have++]]=0;if(to.lencode=to.lendyn,to.lenbits=7,Jo={bits:to.lenbits},Fo=inftrees(CODES,to.lens,0,19,to.lencode,0,to.work,Jo),to.lenbits=Jo.bits,Fo){Xr.msg="invalid code lengths set",to.mode=BAD;break}to.have=0,to.mode=CODELENS;case CODELENS:for(;to.have>>24,Co=Eo>>>16&255,Ro=Eo&65535,!($o<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=$o,lo-=$o,to.lens[to.have++]=Ro;else{if(Ro===16){for(Po=$o+2;lo>>=$o,lo-=$o,to.have===0){Xr.msg="invalid bit length repeat",to.mode=BAD;break}Mo=to.lens[to.have-1],go=3+(co&3),co>>>=2,lo-=2}else if(Ro===17){for(Po=$o+3;lo>>=$o,lo-=$o,Mo=0,go=3+(co&7),co>>>=3,lo-=3}else{for(Po=$o+7;lo>>=$o,lo-=$o,Mo=0,go=11+(co&127),co>>>=7,lo-=7}if(to.have+go>to.nlen+to.ndist){Xr.msg="invalid bit length repeat",to.mode=BAD;break}for(;go--;)to.lens[to.have++]=Mo}}if(to.mode===BAD)break;if(to.lens[256]===0){Xr.msg="invalid code -- missing end-of-block",to.mode=BAD;break}if(to.lenbits=9,Jo={bits:to.lenbits},Fo=inftrees(LENS,to.lens,0,to.nlen,to.lencode,0,to.work,Jo),to.lenbits=Jo.bits,Fo){Xr.msg="invalid literal/lengths set",to.mode=BAD;break}if(to.distbits=6,to.distcode=to.distdyn,Jo={bits:to.distbits},Fo=inftrees(DISTS,to.lens,to.nlen,to.ndist,to.distcode,0,to.work,Jo),to.distbits=Jo.bits,Fo){Xr.msg="invalid distances set",to.mode=BAD;break}if(to.mode=LEN_,eo===Z_TREES)break e;case LEN_:to.mode=LEN;case LEN:if(ao>=6&&so>=258){Xr.next_out=oo,Xr.avail_out=so,Xr.next_in=io,Xr.avail_in=ao,to.hold=co,to.bits=lo,inffast(Xr,ho),oo=Xr.next_out,no=Xr.output,so=Xr.avail_out,io=Xr.next_in,ro=Xr.input,ao=Xr.avail_in,co=to.hold,lo=to.bits,to.mode===TYPE&&(to.back=-1);break}for(to.back=0;Eo=to.lencode[co&(1<>>24,Co=Eo>>>16&255,Ro=Eo&65535,!($o<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>Oo)],$o=Eo>>>24,Co=Eo>>>16&255,Ro=Eo&65535,!(Oo+$o<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=Oo,lo-=Oo,to.back+=Oo}if(co>>>=$o,lo-=$o,to.back+=$o,to.length=Ro,Co===0){to.mode=LIT;break}if(Co&32){to.back=-1,to.mode=TYPE;break}if(Co&64){Xr.msg="invalid literal/length code",to.mode=BAD;break}to.extra=Co&15,to.mode=LENEXT;case LENEXT:if(to.extra){for(Po=to.extra;lo>>=to.extra,lo-=to.extra,to.back+=to.extra}to.was=to.length,to.mode=DIST;case DIST:for(;Eo=to.distcode[co&(1<>>24,Co=Eo>>>16&255,Ro=Eo&65535,!($o<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>Oo)],$o=Eo>>>24,Co=Eo>>>16&255,Ro=Eo&65535,!(Oo+$o<=lo);){if(ao===0)break e;ao--,co+=ro[io++]<>>=Oo,lo-=Oo,to.back+=Oo}if(co>>>=$o,lo-=$o,to.back+=$o,Co&64){Xr.msg="invalid distance code",to.mode=BAD;break}to.offset=Ro,to.extra=Co&15,to.mode=DISTEXT;case DISTEXT:if(to.extra){for(Po=to.extra;lo>>=to.extra,lo-=to.extra,to.back+=to.extra}if(to.offset>to.dmax){Xr.msg="invalid distance too far back",to.mode=BAD;break}to.mode=MATCH;case MATCH:if(so===0)break e;if(go=ho-so,to.offset>go){if(go=to.offset-go,go>to.whave&&to.sane){Xr.msg="invalid distance too far back",to.mode=BAD;break}go>to.wnext?(go-=to.wnext,bo=to.wsize-go):bo=to.wnext-go,go>to.length&&(go=to.length),wo=to.window}else wo=no,bo=oo-to.offset,go=to.length;go>so&&(go=so),so-=go,to.length-=go;do no[oo++]=wo[bo++];while(--go);to.length===0&&(to.mode=LEN);break;case LIT:if(so===0)break e;no[oo++]=to.length,so--,to.mode=LEN;break;case CHECK:if(to.wrap){for(;lo<32;){if(ao===0)break e;ao--,co|=ro[io++]<{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;let eo=Xr.state;return eo.window&&(eo.window=null),Xr.state=null,Z_OK$1},inflateGetHeader=(Xr,eo)=>{if(inflateStateCheck(Xr))return Z_STREAM_ERROR$1;const to=Xr.state;return to.wrap&2?(to.head=eo,eo.done=!1,Z_OK$1):Z_STREAM_ERROR$1},inflateSetDictionary=(Xr,eo)=>{const to=eo.length;let ro,no,io;return inflateStateCheck(Xr)||(ro=Xr.state,ro.wrap!==0&&ro.mode!==DICT)?Z_STREAM_ERROR$1:ro.mode===DICT&&(no=1,no=adler32_1(no,eo,to,0),no!==ro.check)?Z_DATA_ERROR$1:(io=updatewindow(Xr,eo,to,to),io?(ro.mode=MEM,Z_MEM_ERROR$1):(ro.havedict=1,Z_OK$1))};var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$2,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$2={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo};function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader;const toString=Object.prototype.toString,{Z_NO_FLUSH,Z_FINISH,Z_OK,Z_STREAM_END,Z_NEED_DICT,Z_STREAM_ERROR,Z_DATA_ERROR,Z_MEM_ERROR}=constants$2;function Inflate$1(Xr){this.options=common.assign({chunkSize:1024*64,windowBits:15,to:""},Xr||{});const eo=this.options;eo.raw&&eo.windowBits>=0&&eo.windowBits<16&&(eo.windowBits=-eo.windowBits,eo.windowBits===0&&(eo.windowBits=-15)),eo.windowBits>=0&&eo.windowBits<16&&!(Xr&&Xr.windowBits)&&(eo.windowBits+=32),eo.windowBits>15&&eo.windowBits<48&&(eo.windowBits&15||(eo.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let to=inflate_1$2.inflateInit2(this.strm,eo.windowBits);if(to!==Z_OK)throw new Error(messages[to]);if(this.header=new gzheader,inflate_1$2.inflateGetHeader(this.strm,this.header),eo.dictionary&&(typeof eo.dictionary=="string"?eo.dictionary=strings.string2buf(eo.dictionary):toString.call(eo.dictionary)==="[object ArrayBuffer]"&&(eo.dictionary=new Uint8Array(eo.dictionary)),eo.raw&&(to=inflate_1$2.inflateSetDictionary(this.strm,eo.dictionary),to!==Z_OK)))throw new Error(messages[to])}Inflate$1.prototype.push=function(Xr,eo){const to=this.strm,ro=this.options.chunkSize,no=this.options.dictionary;let io,oo,ao;if(this.ended)return!1;for(eo===~~eo?oo=eo:oo=eo===!0?Z_FINISH:Z_NO_FLUSH,toString.call(Xr)==="[object ArrayBuffer]"?to.input=new Uint8Array(Xr):to.input=Xr,to.next_in=0,to.avail_in=to.input.length;;){for(to.avail_out===0&&(to.output=new Uint8Array(ro),to.next_out=0,to.avail_out=ro),io=inflate_1$2.inflate(to,oo),io===Z_NEED_DICT&&no&&(io=inflate_1$2.inflateSetDictionary(to,no),io===Z_OK?io=inflate_1$2.inflate(to,oo):io===Z_DATA_ERROR&&(io=Z_NEED_DICT));to.avail_in>0&&io===Z_STREAM_END&&to.state.wrap>0&&Xr[to.next_in]!==0;)inflate_1$2.inflateReset(to),io=inflate_1$2.inflate(to,oo);switch(io){case Z_STREAM_ERROR:case Z_DATA_ERROR:case Z_NEED_DICT:case Z_MEM_ERROR:return this.onEnd(io),this.ended=!0,!1}if(ao=to.avail_out,to.next_out&&(to.avail_out===0||io===Z_STREAM_END))if(this.options.to==="string"){let so=strings.utf8border(to.output,to.next_out),co=to.next_out-so,lo=strings.buf2string(to.output,so);to.next_out=co,to.avail_out=ro-co,co&&to.output.set(to.output.subarray(so,so+co),0),this.onData(lo)}else this.onData(to.output.length===to.next_out?to.output:to.output.subarray(0,to.next_out));if(!(io===Z_OK&&ao===0)){if(io===Z_STREAM_END)return io=inflate_1$2.inflateEnd(this.strm),this.onEnd(io),this.ended=!0,!0;if(to.avail_in===0)break}}return!0};Inflate$1.prototype.onData=function(Xr){this.chunks.push(Xr)};Inflate$1.prototype.onEnd=function(Xr){Xr===Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=Xr,this.msg=this.strm.msg};function inflate$1(Xr,eo){const to=new Inflate$1(eo);if(to.push(Xr),to.err)throw to.msg||messages[to.err];return to.result}function inflateRaw$1(Xr,eo){return eo=eo||{},eo.raw=!0,inflate$1(Xr,eo)}var Inflate_1$1=Inflate$1,inflate_2=inflate$1,inflateRaw_1$1=inflateRaw$1,ungzip$1=inflate$1,constants=constants$2,inflate_1$1={Inflate:Inflate_1$1,inflate:inflate_2,inflateRaw:inflateRaw_1$1,ungzip:ungzip$1,constants};const{Deflate,deflate,deflateRaw,gzip}=deflate_1$1,{Inflate,inflate,inflateRaw,ungzip}=inflate_1$1;var gzip_1=gzip,ungzip_1=ungzip,g$2=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global$1<"u"&&global$1||{},support={searchParams:"URLSearchParams"in g$2,iterable:"Symbol"in g$2&&"iterator"in Symbol,blob:"FileReader"in g$2&&"Blob"in g$2&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in g$2,arrayBuffer:"ArrayBuffer"in g$2};function isDataView(Xr){return Xr&&DataView.prototype.isPrototypeOf(Xr)}if(support.arrayBuffer)var viewClasses=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isArrayBufferView=ArrayBuffer.isView||function(Xr){return Xr&&viewClasses.indexOf(Object.prototype.toString.call(Xr))>-1};function normalizeName(Xr){if(typeof Xr!="string"&&(Xr=String(Xr)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(Xr)||Xr==="")throw new TypeError('Invalid character in header field name: "'+Xr+'"');return Xr.toLowerCase()}function normalizeValue(Xr){return typeof Xr!="string"&&(Xr=String(Xr)),Xr}function iteratorFor(Xr){var eo={next:function(){var to=Xr.shift();return{done:to===void 0,value:to}}};return support.iterable&&(eo[Symbol.iterator]=function(){return eo}),eo}function Headers$1(Xr){this.map={},Xr instanceof Headers$1?Xr.forEach(function(eo,to){this.append(to,eo)},this):Array.isArray(Xr)?Xr.forEach(function(eo){if(eo.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+eo.length);this.append(eo[0],eo[1])},this):Xr&&Object.getOwnPropertyNames(Xr).forEach(function(eo){this.append(eo,Xr[eo])},this)}Headers$1.prototype.append=function(Xr,eo){Xr=normalizeName(Xr),eo=normalizeValue(eo);var to=this.map[Xr];this.map[Xr]=to?to+", "+eo:eo};Headers$1.prototype.delete=function(Xr){delete this.map[normalizeName(Xr)]};Headers$1.prototype.get=function(Xr){return Xr=normalizeName(Xr),this.has(Xr)?this.map[Xr]:null};Headers$1.prototype.has=function(Xr){return this.map.hasOwnProperty(normalizeName(Xr))};Headers$1.prototype.set=function(Xr,eo){this.map[normalizeName(Xr)]=normalizeValue(eo)};Headers$1.prototype.forEach=function(Xr,eo){for(var to in this.map)this.map.hasOwnProperty(to)&&Xr.call(eo,this.map[to],to,this)};Headers$1.prototype.keys=function(){var Xr=[];return this.forEach(function(eo,to){Xr.push(to)}),iteratorFor(Xr)};Headers$1.prototype.values=function(){var Xr=[];return this.forEach(function(eo){Xr.push(eo)}),iteratorFor(Xr)};Headers$1.prototype.entries=function(){var Xr=[];return this.forEach(function(eo,to){Xr.push([to,eo])}),iteratorFor(Xr)};support.iterable&&(Headers$1.prototype[Symbol.iterator]=Headers$1.prototype.entries);function consumed(Xr){if(!Xr._noBody){if(Xr.bodyUsed)return Promise.reject(new TypeError("Already read"));Xr.bodyUsed=!0}}function fileReaderReady(Xr){return new Promise(function(eo,to){Xr.onload=function(){eo(Xr.result)},Xr.onerror=function(){to(Xr.error)}})}function readBlobAsArrayBuffer(Xr){var eo=new FileReader,to=fileReaderReady(eo);return eo.readAsArrayBuffer(Xr),to}function readBlobAsText(Xr){var eo=new FileReader,to=fileReaderReady(eo),ro=/charset=([A-Za-z0-9_-]+)/.exec(Xr.type),no=ro?ro[1]:"utf-8";return eo.readAsText(Xr,no),to}function readArrayBufferAsText(Xr){for(var eo=new Uint8Array(Xr),to=new Array(eo.length),ro=0;ro-1?eo:Xr}function Request$1(Xr,eo){if(!(this instanceof Request$1))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');eo=eo||{};var to=eo.body;if(Xr instanceof Request$1){if(Xr.bodyUsed)throw new TypeError("Already read");this.url=Xr.url,this.credentials=Xr.credentials,eo.headers||(this.headers=new Headers$1(Xr.headers)),this.method=Xr.method,this.mode=Xr.mode,this.signal=Xr.signal,!to&&Xr._bodyInit!=null&&(to=Xr._bodyInit,Xr.bodyUsed=!0)}else this.url=String(Xr);if(this.credentials=eo.credentials||this.credentials||"same-origin",(eo.headers||!this.headers)&&(this.headers=new Headers$1(eo.headers)),this.method=normalizeMethod(eo.method||this.method||"GET"),this.mode=eo.mode||this.mode||null,this.signal=eo.signal||this.signal||function(){if("AbortController"in g$2){var io=new AbortController;return io.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&to)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(to),(this.method==="GET"||this.method==="HEAD")&&(eo.cache==="no-store"||eo.cache==="no-cache")){var ro=/([?&])_=[^&]*/;if(ro.test(this.url))this.url=this.url.replace(ro,"$1_="+new Date().getTime());else{var no=/\?/;this.url+=(no.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request$1.prototype.clone=function(){return new Request$1(this,{body:this._bodyInit})};function decode(Xr){var eo=new FormData;return Xr.trim().split("&").forEach(function(to){if(to){var ro=to.split("="),no=ro.shift().replace(/\+/g," "),io=ro.join("=").replace(/\+/g," ");eo.append(decodeURIComponent(no),decodeURIComponent(io))}}),eo}function parseHeaders(Xr){var eo=new Headers$1,to=Xr.replace(/\r?\n[\t ]+/g," ");return to.split("\r").map(function(ro){return ro.indexOf(` +`)===0?ro.substr(1,ro.length):ro}).forEach(function(ro){var no=ro.split(":"),io=no.shift().trim();if(io){var oo=no.join(":").trim();try{eo.append(io,oo)}catch(ao){console.warn("Response "+ao.message)}}}),eo}Body.call(Request$1.prototype);function Response$1(Xr,eo){if(!(this instanceof Response$1))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(eo||(eo={}),this.type="default",this.status=eo.status===void 0?200:eo.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=eo.statusText===void 0?"":""+eo.statusText,this.headers=new Headers$1(eo.headers),this.url=eo.url||"",this._initBody(Xr)}Body.call(Response$1.prototype);Response$1.prototype.clone=function(){return new Response$1(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers$1(this.headers),url:this.url})};Response$1.error=function(){var Xr=new Response$1(null,{status:200,statusText:""});return Xr.ok=!1,Xr.status=0,Xr.type="error",Xr};var redirectStatuses=[301,302,303,307,308];Response$1.redirect=function(Xr,eo){if(redirectStatuses.indexOf(eo)===-1)throw new RangeError("Invalid status code");return new Response$1(null,{status:eo,headers:{location:Xr}})};var DOMException$1=g$2.DOMException;try{new DOMException$1}catch(Xr){DOMException$1=function(eo,to){this.message=eo,this.name=to;var ro=Error(eo);this.stack=ro.stack},DOMException$1.prototype=Object.create(Error.prototype),DOMException$1.prototype.constructor=DOMException$1}function fetch$1(Xr,eo){return new Promise(function(to,ro){var no=new Request$1(Xr,eo);if(no.signal&&no.signal.aborted)return ro(new DOMException$1("Aborted","AbortError"));var io=new XMLHttpRequest;function oo(){io.abort()}io.onload=function(){var co={statusText:io.statusText,headers:parseHeaders(io.getAllResponseHeaders()||"")};no.url.indexOf("file://")===0&&(io.status<200||io.status>599)?co.status=200:co.status=io.status,co.url="responseURL"in io?io.responseURL:co.headers.get("X-Request-URL");var lo="response"in io?io.response:io.responseText;setTimeout(function(){to(new Response$1(lo,co))},0)},io.onerror=function(){setTimeout(function(){ro(new TypeError("Network request failed"))},0)},io.ontimeout=function(){setTimeout(function(){ro(new TypeError("Network request timed out"))},0)},io.onabort=function(){setTimeout(function(){ro(new DOMException$1("Aborted","AbortError"))},0)};function ao(co){try{return co===""&&g$2.location.href?g$2.location.href:co}catch{return co}}if(io.open(no.method,ao(no.url),!0),no.credentials==="include"?io.withCredentials=!0:no.credentials==="omit"&&(io.withCredentials=!1),"responseType"in io&&(support.blob?io.responseType="blob":support.arrayBuffer&&(io.responseType="arraybuffer")),eo&&typeof eo.headers=="object"&&!(eo.headers instanceof Headers$1||g$2.Headers&&eo.headers instanceof g$2.Headers)){var so=[];Object.getOwnPropertyNames(eo.headers).forEach(function(co){so.push(normalizeName(co)),io.setRequestHeader(co,normalizeValue(eo.headers[co]))}),no.headers.forEach(function(co,lo){so.indexOf(lo)===-1&&io.setRequestHeader(lo,co)})}else no.headers.forEach(function(co,lo){io.setRequestHeader(lo,co)});no.signal&&(no.signal.addEventListener("abort",oo),io.onreadystatechange=function(){io.readyState===4&&no.signal.removeEventListener("abort",oo)}),io.send(typeof no._bodyInit>"u"?null:no._bodyInit)})}fetch$1.polyfill=!0;g$2.fetch||(g$2.fetch=fetch$1,g$2.Headers=Headers$1,g$2.Request=Request$1,g$2.Response=Response$1);var fetchNpmBrowserify=self.fetch.bind(self);const isomorphicFetch=getDefaultExportFromCjs$2(fetchNpmBrowserify);var urlJoin={exports:{}};(function(Xr){(function(eo,to,ro){Xr.exports?Xr.exports=ro():to[eo]=ro()})("urljoin",commonjsGlobal,function(){function eo(to){var ro=[];if(to.length===0)return"";if(typeof to[0]!="string")throw new TypeError("Url must be a string. Received "+to[0]);if(to[0].match(/^[^/:]+:\/*$/)&&to.length>1){var no=to.shift();to[0]=no+to[0]}to[0].match(/^file:\/\/\//)?to[0]=to[0].replace(/^([^/:]+):\/*/,"$1:///"):to[0]=to[0].replace(/^([^/:]+):\/*/,"$1://");for(var io=0;io0&&(oo=oo.replace(/^[\/]+/,"")),io0?"?":"")+so.join("&"),ao}return function(){var to;return typeof arguments[0]=="object"?to=arguments[0]:to=[].slice.call(arguments),eo(to)}})})(urlJoin);var urlJoinExports=urlJoin.exports;const urljoin2=getDefaultExportFromCjs$2(urlJoinExports);var __defProp=Object.defineProperty,__export=(Xr,eo)=>{for(var to in eo)__defProp(Xr,to,{get:eo[to],enumerable:!0})},constants_exports={};__export(constants_exports,{ADDR_BOUND:()=>ADDR_BOUND,API_VERSION:()=>API_VERSION,BN_FEE_TRANSACTION_VERSION_1:()=>BN_FEE_TRANSACTION_VERSION_1,BN_FEE_TRANSACTION_VERSION_2:()=>BN_FEE_TRANSACTION_VERSION_2,BN_TRANSACTION_VERSION_1:()=>BN_TRANSACTION_VERSION_1,BN_TRANSACTION_VERSION_2:()=>BN_TRANSACTION_VERSION_2,BaseUrl:()=>BaseUrl,HEX_STR_TRANSACTION_VERSION_1:()=>HEX_STR_TRANSACTION_VERSION_1,HEX_STR_TRANSACTION_VERSION_2:()=>HEX_STR_TRANSACTION_VERSION_2,IS_BROWSER:()=>IS_BROWSER,MASK_250:()=>MASK_250,MAX_STORAGE_ITEM_SIZE:()=>MAX_STORAGE_ITEM_SIZE,NetworkName:()=>NetworkName,RPC_DEFAULT_VERSION:()=>RPC_DEFAULT_VERSION,RPC_NODES:()=>RPC_NODES,StarknetChainId:()=>StarknetChainId,TEXT_TO_FELT_MAX_LEN:()=>TEXT_TO_FELT_MAX_LEN,TransactionHashPrefix:()=>TransactionHashPrefix,UDC:()=>UDC,ZERO:()=>ZERO});var encode_exports={};__export(encode_exports,{IS_BROWSER:()=>IS_BROWSER,addHexPrefix:()=>addHexPrefix,arrayBufferToString:()=>arrayBufferToString,atobUniversal:()=>atobUniversal,btoaUniversal:()=>btoaUniversal,buf2hex:()=>buf2hex,calcByteLength:()=>calcByteLength,padLeft:()=>padLeft,pascalToSnake:()=>pascalToSnake,removeHexPrefix:()=>removeHexPrefix,sanitizeBytes:()=>sanitizeBytes,sanitizeHex:()=>sanitizeHex,stringToArrayBuffer:()=>stringToArrayBuffer,utf8ToArray:()=>utf8ToArray});var IS_BROWSER=typeof window<"u",STRING_ZERO="0";function arrayBufferToString(Xr){return new Uint8Array(Xr).reduce((eo,to)=>eo+String.fromCharCode(to),"")}function utf8ToArray(Xr){return new TextEncoder().encode(Xr)}function stringToArrayBuffer(Xr){return utf8ToArray(Xr)}function atobUniversal(Xr){return base64$2.decode(Xr)}function btoaUniversal(Xr){return base64$2.encode(new Uint8Array(Xr))}function buf2hex(Xr){return Xr.reduce((eo,to)=>eo+to.toString(16).padStart(2,"0"),"")}function removeHexPrefix(Xr){return Xr.replace(/^0x/i,"")}function addHexPrefix(Xr){return`0x${removeHexPrefix(Xr)}`}function padString(Xr,eo,to,ro=STRING_ZERO){const no=eo-Xr.length;let io=Xr;return no>0&&(io=ro.repeat(no)+Xr),io}function padLeft(Xr,eo,to=STRING_ZERO){return padString(Xr,eo,!0,to)}function calcByteLength(Xr,eo=8){const{length:to}=Xr,ro=to%eo;return ro?(to-ro)/eo*eo+eo:to}function sanitizeBytes(Xr,eo=8,to=STRING_ZERO){return padLeft(Xr,calcByteLength(Xr,eo),to)}function sanitizeHex(Xr){return Xr=removeHexPrefix(Xr),Xr=sanitizeBytes(Xr,2),Xr&&(Xr=addHexPrefix(Xr)),Xr}var pascalToSnake=Xr=>/[a-z]/.test(Xr)?Xr.split(/(?=[A-Z])/).join("_").toUpperCase():Xr,TEXT_TO_FELT_MAX_LEN=31,HEX_STR_TRANSACTION_VERSION_1="0x1",HEX_STR_TRANSACTION_VERSION_2="0x2",BN_TRANSACTION_VERSION_1=1n,BN_TRANSACTION_VERSION_2=2n,BN_FEE_TRANSACTION_VERSION_1=2n**128n+BN_TRANSACTION_VERSION_1,BN_FEE_TRANSACTION_VERSION_2=2n**128n+BN_TRANSACTION_VERSION_2,ZERO=0n,MASK_250=2n**250n-1n,API_VERSION=ZERO,MAX_STORAGE_ITEM_SIZE=256n,ADDR_BOUND=2n**251n-MAX_STORAGE_ITEM_SIZE,BaseUrl=(Xr=>(Xr.SN_MAIN="https://alpha-mainnet.starknet.io",Xr.SN_GOERLI="https://alpha4.starknet.io",Xr.SN_SEPOLIA="https://alpha-sepolia.starknet.io",Xr))(BaseUrl||{}),NetworkName=(Xr=>(Xr.SN_MAIN="SN_MAIN",Xr.SN_GOERLI="SN_GOERLI",Xr.SN_SEPOLIA="SN_SEPOLIA",Xr))(NetworkName||{}),StarknetChainId=(Xr=>(Xr.SN_MAIN="0x534e5f4d41494e",Xr.SN_GOERLI="0x534e5f474f45524c49",Xr.SN_SEPOLIA="0x534e5f5345504f4c4941",Xr))(StarknetChainId||{}),TransactionHashPrefix=(Xr=>(Xr.DECLARE="0x6465636c617265",Xr.DEPLOY="0x6465706c6f79",Xr.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",Xr.INVOKE="0x696e766f6b65",Xr.L1_HANDLER="0x6c315f68616e646c6572",Xr))(TransactionHashPrefix||{}),UDC={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},RPC_DEFAULT_VERSION="v0_5",RPC_NODES={SN_GOERLI:["https://starknet-testnet.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/goerli-juno/"],SN_MAIN:["https://starknet-mainnet.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/mainnet-juno/"],SN_SEPOLIA:["https://starknet-sepolia.public.blastapi.io/rpc/","https://free-rpc.nethermind.io/sepolia-juno/"]},types_exports={};__export(types_exports,{BlockStatus:()=>BlockStatus,BlockTag:()=>BlockTag,EntryPointType:()=>EntryPointType,Litteral:()=>Litteral,RPC:()=>rpc_exports,SIMULATION_FLAG:()=>SIMULATION_FLAG,Sequencer:()=>sequencer_exports,TransactionExecutionStatus:()=>TransactionExecutionStatus,TransactionFinalityStatus:()=>TransactionFinalityStatus,TransactionStatus:()=>TransactionStatus,TransactionType:()=>TransactionType,Uint:()=>Uint,ValidateType:()=>ValidateType});var SIMULATION_FLAG=(Xr=>(Xr.SKIP_VALIDATE="SKIP_VALIDATE",Xr.SKIP_EXECUTE="SKIP_EXECUTE",Xr))(SIMULATION_FLAG||{}),ValidateType=(Xr=>(Xr.DEPLOY="DEPLOY",Xr.CALL="CALL",Xr.INVOKE="INVOKE",Xr))(ValidateType||{}),Uint=(Xr=>(Xr.u8="core::integer::u8",Xr.u16="core::integer::u16",Xr.u32="core::integer::u32",Xr.u64="core::integer::u64",Xr.u128="core::integer::u128",Xr.u256="core::integer::u256",Xr))(Uint||{}),Litteral=(Xr=>(Xr.ClassHash="core::starknet::class_hash::ClassHash",Xr.ContractAddress="core::starknet::contract_address::ContractAddress",Xr))(Litteral||{}),EntryPointType=(Xr=>(Xr.EXTERNAL="EXTERNAL",Xr.L1_HANDLER="L1_HANDLER",Xr.CONSTRUCTOR="CONSTRUCTOR",Xr))(EntryPointType||{}),TransactionType=(Xr=>(Xr.DECLARE="DECLARE",Xr.DEPLOY="DEPLOY",Xr.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",Xr.INVOKE="INVOKE_FUNCTION",Xr))(TransactionType||{}),TransactionStatus=(Xr=>(Xr.NOT_RECEIVED="NOT_RECEIVED",Xr.RECEIVED="RECEIVED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr.REJECTED="REJECTED",Xr.REVERTED="REVERTED",Xr))(TransactionStatus||{}),TransactionFinalityStatus=(Xr=>(Xr.NOT_RECEIVED="NOT_RECEIVED",Xr.RECEIVED="RECEIVED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(TransactionFinalityStatus||{}),TransactionExecutionStatus=(Xr=>(Xr.REJECTED="REJECTED",Xr.REVERTED="REVERTED",Xr.SUCCEEDED="SUCCEEDED",Xr))(TransactionExecutionStatus||{}),BlockStatus=(Xr=>(Xr.PENDING="PENDING",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.REJECTED="REJECTED",Xr))(BlockStatus||{}),BlockTag=(Xr=>(Xr.pending="pending",Xr.latest="latest",Xr))(BlockTag||{}),rpc_exports={};__export(rpc_exports,{EBlockTag:()=>EBlockTag,EDataAvailabilityMode:()=>EDataAvailabilityMode,ESimulationFlag:()=>ESimulationFlag,ETransactionExecutionStatus:()=>ETransactionExecutionStatus,ETransactionFinalityStatus:()=>ETransactionFinalityStatus,ETransactionStatus:()=>ETransactionStatus,ETransactionType:()=>ETransactionType,Errors:()=>errors_exports,JRPC:()=>jsonrpc_exports,SPEC:()=>components_exports});var jsonrpc_exports={},errors_exports={},components_exports={},ETransactionType=(Xr=>(Xr.DECLARE="DECLARE",Xr.DEPLOY="DEPLOY",Xr.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",Xr.INVOKE="INVOKE",Xr.L1_HANDLER="L1_HANDLER",Xr))(ETransactionType||{}),ESimulationFlag=(Xr=>(Xr.SKIP_VALIDATE="SKIP_VALIDATE",Xr.SKIP_FEE_CHARGE="SKIP_FEE_CHARGE",Xr))(ESimulationFlag||{}),ETransactionStatus=(Xr=>(Xr.RECEIVED="RECEIVED",Xr.REJECTED="REJECTED",Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(ETransactionStatus||{}),ETransactionFinalityStatus=(Xr=>(Xr.ACCEPTED_ON_L2="ACCEPTED_ON_L2",Xr.ACCEPTED_ON_L1="ACCEPTED_ON_L1",Xr))(ETransactionFinalityStatus||{}),ETransactionExecutionStatus=(Xr=>(Xr.SUCCEEDED="SUCCEEDED",Xr.REVERTED="REVERTED",Xr))(ETransactionExecutionStatus||{}),EBlockTag=(Xr=>(Xr.LATEST="latest",Xr.PENDING="pending",Xr))(EBlockTag||{}),EDataAvailabilityMode=(Xr=>(Xr.L1="L1",Xr.L2="L2",Xr))(EDataAvailabilityMode||{}),sequencer_exports={};function assert$2(Xr,eo){if(!Xr)throw new Error(eo||"Assertion failure")}var num_exports={};__export(num_exports,{assertInRange:()=>assertInRange,bigNumberishArrayToDecimalStringArray:()=>bigNumberishArrayToDecimalStringArray,bigNumberishArrayToHexadecimalStringArray:()=>bigNumberishArrayToHexadecimalStringArray,cleanHex:()=>cleanHex,getDecimalString:()=>getDecimalString,getHexString:()=>getHexString,getHexStringArray:()=>getHexStringArray,hexToBytes:()=>hexToBytes,hexToDecimalString:()=>hexToDecimalString,isBigInt:()=>isBigInt,isHex:()=>isHex,isStringWholeNumber:()=>isStringWholeNumber,toBigInt:()=>toBigInt,toCairoBool:()=>toCairoBool,toHex:()=>toHex,toHexString:()=>toHexString,toStorageKey:()=>toStorageKey});function isHex(Xr){return/^0x[0-9a-f]*$/i.test(Xr)}function toBigInt(Xr){return BigInt(Xr)}function isBigInt(Xr){return typeof Xr=="bigint"}function toHex(Xr){return addHexPrefix(toBigInt(Xr).toString(16))}var toHexString=toHex;function toStorageKey(Xr){return addHexPrefix(toBigInt(Xr).toString(16).padStart(64,"0"))}function hexToDecimalString(Xr){return BigInt(addHexPrefix(Xr)).toString(10)}var cleanHex=Xr=>Xr.toLowerCase().replace(/^(0x)0+/,"$1");function assertInRange(Xr,eo,to,ro=""){const no=ro===""?"invalid length":`invalid ${ro} length`,io=BigInt(Xr),oo=BigInt(eo),ao=BigInt(to);assert$2(io>=oo&&io<=ao,`Message not signable, ${no}.`)}function bigNumberishArrayToDecimalStringArray(Xr){return Xr.map(eo=>toBigInt(eo).toString(10))}function bigNumberishArrayToHexadecimalStringArray(Xr){return Xr.map(eo=>toHex(eo))}var isStringWholeNumber=Xr=>/^\d+$/.test(Xr);function getDecimalString(Xr){if(isHex(Xr))return hexToDecimalString(Xr);if(isStringWholeNumber(Xr))return Xr;throw new Error(`${Xr} need to be hex-string or whole-number-string`)}function getHexString(Xr){if(isHex(Xr))return Xr;if(isStringWholeNumber(Xr))return toHexString(Xr);throw new Error(`${Xr} need to be hex-string or whole-number-string`)}function getHexStringArray(Xr){return Xr.map(eo=>getHexString(eo))}var toCairoBool=Xr=>(+Xr).toString();function hexToBytes(Xr){if(!isHex(Xr))throw new Error(`${Xr} need to be a hex-string`);let eo=removeHexPrefix(Xr);return eo.length%2!==0&&(eo=`0${eo}`),hexToBytes$2(eo)}var selector_exports={};__export(selector_exports,{getSelector:()=>getSelector,getSelectorFromName:()=>getSelectorFromName,keccakBn:()=>keccakBn,starknetKeccak:()=>starknetKeccak});function keccakBn(Xr){const eo=removeHexPrefix(toHex(BigInt(Xr))),to=eo.length%2===0?eo:`0${eo}`;return addHexPrefix(keccak(hexToBytes(addHexPrefix(to))).toString(16))}function keccakHex(Xr){return addHexPrefix(keccak(utf8ToArray(Xr)).toString(16))}function starknetKeccak(Xr){return BigInt(keccakHex(Xr))&MASK_250}function getSelectorFromName(Xr){return toHex(starknetKeccak(Xr))}function getSelector(Xr){return isHex(Xr)?Xr:isStringWholeNumber(Xr)?toHexString(Xr):getSelectorFromName(Xr)}var shortString_exports={};__export(shortString_exports,{decodeShortString:()=>decodeShortString,encodeShortString:()=>encodeShortString,isASCII:()=>isASCII,isDecimalString:()=>isDecimalString,isLongText:()=>isLongText,isShortString:()=>isShortString,isShortText:()=>isShortText,isText:()=>isText,splitLongString:()=>splitLongString});function isASCII(Xr){return/^[\x00-\x7F]*$/.test(Xr)}function isShortString(Xr){return Xr.length<=TEXT_TO_FELT_MAX_LEN}function isDecimalString(Xr){return/^[0-9]*$/i.test(Xr)}function isText(Xr){return typeof Xr=="string"&&!isHex(Xr)&&!isStringWholeNumber(Xr)}var isShortText=Xr=>isText(Xr)&&isShortString(Xr),isLongText=Xr=>isText(Xr)&&!isShortString(Xr);function splitLongString(Xr){const eo=RegExp(`[^]{1,${TEXT_TO_FELT_MAX_LEN}}`,"g");return Xr.match(eo)||[]}function encodeShortString(Xr){if(!isASCII(Xr))throw new Error(`${Xr} is not an ASCII string`);if(!isShortString(Xr))throw new Error(`${Xr} is too long`);return addHexPrefix(Xr.replace(/./g,eo=>eo.charCodeAt(0).toString(16)))}function decodeShortString(Xr){if(!isASCII(Xr))throw new Error(`${Xr} is not an ASCII string`);if(isHex(Xr))return removeHexPrefix(Xr).replace(/.{2}/g,eo=>String.fromCharCode(parseInt(eo,16)));if(isDecimalString(Xr))return decodeShortString("0X".concat(BigInt(Xr).toString(16)));throw new Error(`${Xr} is not Hex or decimal`)}var cairo_exports={};__export(cairo_exports,{felt:()=>felt,getAbiContractVersion:()=>getAbiContractVersion,getArrayType:()=>getArrayType,isCairo1Abi:()=>isCairo1Abi,isCairo1Type:()=>isCairo1Type,isLen:()=>isLen,isTypeArray:()=>isTypeArray,isTypeBool:()=>isTypeBool,isTypeContractAddress:()=>isTypeContractAddress,isTypeEnum:()=>isTypeEnum,isTypeEthAddress:()=>isTypeEthAddress,isTypeFelt:()=>isTypeFelt,isTypeLitteral:()=>isTypeLitteral,isTypeNamedTuple:()=>isTypeNamedTuple,isTypeOption:()=>isTypeOption,isTypeResult:()=>isTypeResult,isTypeStruct:()=>isTypeStruct,isTypeTuple:()=>isTypeTuple,isTypeUint:()=>isTypeUint,isTypeUint256:()=>isTypeUint256,tuple:()=>tuple,uint256:()=>uint256});var uint256_exports={};__export(uint256_exports,{UINT_128_MAX:()=>UINT_128_MAX,UINT_256_MAX:()=>UINT_256_MAX,bnToUint256:()=>bnToUint256,isUint256:()=>isUint256,uint256ToBN:()=>uint256ToBN});var UINT_128_MAX=(1n<<128n)-1n,UINT_256_MAX=(1n<<256n)-1n;function uint256ToBN(Xr){return(toBigInt(Xr.high)<<128n)+toBigInt(Xr.low)}function isUint256(Xr){return toBigInt(Xr)<=UINT_256_MAX}function bnToUint256(Xr){const eo=toBigInt(Xr);if(!isUint256(eo))throw new Error("Number is too large");return{low:addHexPrefix((eo&UINT_128_MAX).toString(16)),high:addHexPrefix((eo>>128n).toString(16))}}var isLen=Xr=>/_len$/.test(Xr),isTypeFelt=Xr=>Xr==="felt"||Xr==="core::felt252",isTypeArray=Xr=>/\*/.test(Xr)||Xr.startsWith("core::array::Array::")||Xr.startsWith("core::array::Span::"),isTypeTuple=Xr=>/^\(.*\)$/i.test(Xr),isTypeNamedTuple=Xr=>/\(.*\)/i.test(Xr)&&Xr.includes(":"),isTypeStruct=(Xr,eo)=>Xr in eo,isTypeEnum=(Xr,eo)=>Xr in eo,isTypeOption=Xr=>Xr.startsWith("core::option::Option::"),isTypeResult=Xr=>Xr.startsWith("core::result::Result::"),isTypeUint=Xr=>Object.values(Uint).includes(Xr),isTypeLitteral=Xr=>Object.values(Litteral).includes(Xr),isTypeUint256=Xr=>Xr==="core::integer::u256",isTypeBool=Xr=>Xr==="core::bool",isTypeContractAddress=Xr=>Xr==="core::starknet::contract_address::ContractAddress",isTypeEthAddress=Xr=>Xr==="core::starknet::eth_address::EthAddress",isCairo1Type=Xr=>Xr.includes("::"),getArrayType=Xr=>isCairo1Type(Xr)?Xr.substring(Xr.indexOf("<")+1,Xr.lastIndexOf(">")):Xr.replace("*","");function isCairo1Abi(Xr){const{cairo:eo}=getAbiContractVersion(Xr);if(eo===void 0)throw Error("Unable to determine Cairo version");return eo==="1"}function getAbiContractVersion(Xr){if(Xr.find(ro=>ro.type==="interface"))return{cairo:"1",compiler:"2"};const eo=Xr.find(ro=>ro.type==="function"&&(ro.inputs.length||ro.outputs.length));if(!eo)return{cairo:void 0,compiler:void 0};const to=eo.inputs.length?eo.inputs:eo.outputs;return isCairo1Type(to[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var uint256=Xr=>{const eo=BigInt(Xr);if(!isUint256(eo))throw new Error("Number is too large");return{low:(eo&UINT_128_MAX).toString(10),high:(eo>>128n).toString(10)}},tuple=(...Xr)=>({...Xr});function felt(Xr){if(isBigInt(Xr)||typeof Xr=="number"&&Number.isInteger(Xr))return Xr.toString();if(isText(Xr)){if(!isShortString(Xr))throw new Error(`${Xr} is a long string > 31 chars, felt can store short strings, split it to array of short strings`);const eo=encodeShortString(Xr);return BigInt(eo).toString()}if(typeof Xr=="string"&&isHex(Xr))return BigInt(Xr).toString();if(typeof Xr=="string"&&isStringWholeNumber(Xr))return Xr;if(typeof Xr=="boolean")return`${+Xr}`;throw new Error(`${Xr} can't be computed by felt()`)}var CairoCustomEnum=class{constructor(Xr){const eo=Object.values(Xr);if(eo.length===0)throw new Error("This Enum must have a least 1 variant");if(eo.filter(ro=>typeof ro<"u").length!==1)throw new Error("This Enum must have exactly one active variant");this.variant=Xr}unwrap(){const eo=Object.entries(this.variant).find(to=>typeof to[1]<"u");if(!(typeof eo>"u"))return eo[1]}activeVariant(){const eo=Object.entries(this.variant).find(to=>typeof to[1]<"u");return typeof eo>"u"?"":eo[0]}},CairoOptionVariant=(Xr=>(Xr[Xr.Some=0]="Some",Xr[Xr.None=1]="None",Xr))(CairoOptionVariant||{}),CairoOption=class{constructor(Xr,eo){if(!(Xr in CairoOptionVariant))throw new Error("Wrong variant : should be CairoOptionVariant.Some or .None.");if(Xr===0){if(typeof eo>"u")throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=eo,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){if(!this.None)return this.Some}isSome(){return!(typeof this.Some>"u")}isNone(){return this.None===!0}},CairoResultVariant=(Xr=>(Xr[Xr.Ok=0]="Ok",Xr[Xr.Err=1]="Err",Xr))(CairoResultVariant||{}),CairoResult=class{constructor(Xr,eo){if(!(Xr in CairoResultVariant))throw new Error("Wrong variant : should be CairoResultVariant.Ok or .Err.");Xr===0?(this.Ok=eo,this.Err=void 0):(this.Ok=void 0,this.Err=eo)}unwrap(){if(typeof this.Ok<"u")return this.Ok;if(typeof this.Err<"u")return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!(typeof this.Ok>"u")}isErr(){return!(typeof this.Err>"u")}},guard={isBN:(Xr,eo,to)=>{if(!isBigInt(Xr[to]))throw new Error(`Data and formatter mismatch on ${to}:${eo[to]}, expected response data ${to}:${Xr[to]} to be BN instead it is ${typeof Xr[to]}`)},unknown:(Xr,eo,to)=>{throw new Error(`Unhandled formatter type on ${to}:${eo[to]} for data ${to}:${Xr[to]}`)}};function formatter(Xr,eo,to){return Object.entries(Xr).reduce((ro,[no,io])=>{const oo=to??eo[no];if(!(no in eo)&&!to)return ro[no]=io,ro;if(oo==="string"){if(Array.isArray(Xr[no])){const ao=formatter(Xr[no],Xr[no].map(so=>oo));return ro[no]=Object.values(ao).join(""),ro}return guard.isBN(Xr,eo,no),ro[no]=decodeShortString(io),ro}if(oo==="number")return guard.isBN(Xr,eo,no),ro[no]=Number(io),ro;if(typeof oo=="function")return ro[no]=oo(io),ro;if(Array.isArray(oo)){const ao=formatter(Xr[no],oo,oo[0]);return ro[no]=Object.values(ao),ro}return typeof oo=="object"?(ro[no]=formatter(Xr[no],oo),ro):(guard.unknown(Xr,eo,no),ro)},{})}var AbiParser1=class{constructor(Xr){this.abi=Xr}methodInputsLength(Xr){return Xr.inputs.reduce((eo,to)=>isLen(to.name)?eo:eo+1,0)}getMethod(Xr){return this.abi.find(eo=>eo.name===Xr)}getLegacyFormat(){return this.abi}},AbiParser2=class{constructor(Xr){this.abi=Xr}methodInputsLength(Xr){return Xr.inputs.length}getMethod(Xr){return this.abi.find(to=>to.type==="interface").items.find(to=>to.name===Xr)}getLegacyFormat(){return this.abi.flatMap(Xr=>Xr.type==="interface"?Xr.items:Xr)}};function createAbiParser(Xr){const eo=getAbiVersion(Xr);if(eo===0||eo===1)return new AbiParser1(Xr);if(eo===2)return new AbiParser2(Xr);throw Error(`Unsupported ABI version ${eo}`)}function getAbiVersion(Xr){return Xr.find(eo=>eo.type==="interface")?2:isCairo1Abi(Xr)?1:0}function isNoConstructorValid(Xr,eo,to){return Xr==="constructor"&&!to&&!eo.length}function parseNamedTuple(Xr){const eo=Xr.substring(0,Xr.indexOf(":")),to=Xr.substring(eo.length+1);return{name:eo,type:to}}function parseSubTuple(Xr){if(!Xr.includes("("))return{subTuple:[],result:Xr};const eo=[];let to="",ro=0;for(;roto.length?io.replace(" ",to.shift()):io);return isTypeNamedTuple(Xr)&&(no=no.reduce((io,oo)=>io.concat(parseNamedTuple(oo)),[])),no}function extractCairo1Tuple(Xr){const eo=Xr.replace(/\s/g,"").slice(1,-1),{subTuple:to,result:ro}=parseSubTuple(eo);return ro.split(",").map(io=>to.length?io.replace(" ",to.shift()):io)}function extractTupleMemberTypes(Xr){return isCairo1Type(Xr)?extractCairo1Tuple(Xr):extractCairo0Tuple(Xr)}function errorU256(Xr){return Error(`Your object includes the property : ${Xr}, containing an Uint256 object without the 'low' and 'high' keys.`)}function orderPropsByAbi(Xr,eo,to,ro){const no=(lo,uo)=>{if(isTypeArray(uo))return oo(lo,uo);if(isTypeEnum(uo,ro)){const ho=ro[uo];return so(lo,ho)}if(isTypeTuple(uo))return ao(lo,uo);if(isTypeEthAddress(uo))return lo;if(isTypeUint256(uo)){const ho=lo;if(typeof ho!="object")return ho;if(!("low"in ho&&"high"in ho))throw errorU256(uo);return{low:ho.low,high:ho.high}}if(isTypeStruct(uo,to)){const ho=to[uo].members;return io(lo,ho)}return lo},io=(lo,uo)=>uo.reduce((go,bo)=>{const wo=Eo=>Object.defineProperty(go,bo.name,{enumerable:!0,value:Eo??lo[bo.name]});if(lo[bo.name]==="undefined"&&(isCairo1Type(bo.type)||!isLen(bo.name)))throw Error(`Your object needs a property with key : ${bo.name} .`);return wo(no(lo[bo.name],bo.type)),go},{});function oo(lo,uo){const ho=getArrayType(uo);return typeof lo=="string"?lo:lo.map(go=>no(go,ho))}function ao(lo,uo){return extractTupleMemberTypes(uo).reduce((bo,wo,Eo)=>{const $o=Object.keys(lo),Co=Oo=>Object.defineProperty(bo,Eo.toString(),{enumerable:!0,value:Oo??lo[$o[Eo]]}),Ro=wo!=null&&wo.type?wo.type:wo;return Co(no(lo[$o[Eo]],Ro)),bo},{})}const so=(lo,uo)=>{if(isTypeResult(uo.name)){const wo=lo,Eo=uo.name.substring(uo.name.indexOf("<")+1,uo.name.lastIndexOf(",")),$o=uo.name.substring(uo.name.indexOf(",")+1,uo.name.lastIndexOf(">"));return wo.isOk()?new CairoResult(0,no(lo.unwrap(),Eo)):new CairoResult(1,no(lo.unwrap(),$o))}if(isTypeOption(uo.name)){const wo=lo,Eo=uo.name.substring(uo.name.indexOf("<")+1,uo.name.lastIndexOf(">"));return wo.isSome()?new CairoOption(0,no(wo.unwrap(),Eo)):new CairoOption(1,{})}const ho=lo,bo=Object.entries(ho.variant).map(wo=>{if(typeof wo[1]>"u")return wo;const Eo=uo.type.substring(uo.type.lastIndexOf("<")+1,uo.type.lastIndexOf(">"));return Eo==="()"?wo:[wo[0],no(ho.unwrap(),Eo)]});return new CairoCustomEnum(Object.fromEntries(bo))};return eo.reduce((lo,uo)=>{const ho=go=>Object.defineProperty(lo,uo.name,{enumerable:!0,value:go});return isLen(uo.name)&&!isCairo1Type(uo.type)||ho(no(Xr[uo.name],uo.type)),lo},{})}function parseBaseTypes(Xr,eo){switch(!0){case isTypeUint256(Xr):const to=uint256(eo);return[felt(to.low),felt(to.high)];default:return felt(eo)}}function parseTuple(Xr,eo){const to=extractTupleMemberTypes(eo),ro=Object.values(Xr);if(ro.length!==to.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match. provided: ${ro} - expected: ${to}`);return to.map((no,io)=>({element:ro[io],type:no.type??no}))}function parseUint256(Xr){if(typeof Xr=="object"){const{low:to,high:ro}=Xr;return[felt(to),felt(ro)]}const eo=uint256(Xr);return[felt(eo.low),felt(eo.high)]}function parseCalldataValue(Xr,eo,to,ro){if(Xr===void 0)throw Error(`Missing parameter for type ${eo}`);if(Array.isArray(Xr)){const no=[];no.push(felt(Xr.length));const io=getArrayType(eo);return Xr.reduce((oo,ao)=>oo.concat(parseCalldataValue(ao,io,to,ro)),no)}if(to[eo]&&to[eo].members.length){if(isTypeUint256(eo))return parseUint256(Xr);if(eo==="core::starknet::eth_address::EthAddress")return parseBaseTypes(eo,Xr);const{members:no}=to[eo],io=Xr;return no.reduce((oo,ao)=>oo.concat(parseCalldataValue(io[ao.name],ao.type,to,ro)),[])}if(isTypeTuple(eo))return parseTuple(Xr,eo).reduce((io,oo)=>{const ao=parseCalldataValue(oo.element,oo.type,to,ro);return io.concat(ao)},[]);if(isTypeUint256(eo))return parseUint256(Xr);if(isTypeEnum(eo,ro)){const{variants:no}=ro[eo];if(isTypeOption(eo)){const fo=Xr;if(fo.isSome()){const ho=no.find(vo=>vo.name==="Some");if(typeof ho>"u")throw Error("Error in abi : Option has no 'Some' variant.");const go=ho.type;if(go==="()")return"0";const yo=parseCalldataValue(fo.unwrap(),go,to,ro);return Array.isArray(yo)?["0",...yo]:["0",yo]}return"1"}if(isTypeResult(eo)){const fo=Xr;if(fo.isOk()){const vo=no.find(ko=>ko.name==="Ok");if(typeof vo>"u")throw Error("Error in abi : Result has no 'Ok' variant.");const wo=vo.type;if(wo==="()")return"0";const Eo=parseCalldataValue(fo.unwrap(),wo,to,ro);return Array.isArray(Eo)?["0",...Eo]:["0",Eo]}const ho=no.find(vo=>vo.name==="Err");if(typeof ho>"u")throw Error("Error in abi : Result has no 'Err' variant.");const go=ho.type;if(go==="()")return"1";const yo=parseCalldataValue(fo.unwrap(),go,to,ro);return Array.isArray(yo)?["1",...yo]:["1",yo]}const io=Xr,oo=io.activeVariant(),ao=no.find(fo=>fo.name===oo);if(typeof ao>"u")throw Error(`Not find in abi : Enum has no '${oo}' variant.`);const so=ao.type,co=no.findIndex(fo=>fo.name===oo);if(so==="()")return co.toString();const lo=parseCalldataValue(io.unwrap(),so,to,ro);return Array.isArray(lo)?[co.toString(),...lo]:[co.toString(),lo]}if(typeof Xr=="object")throw Error(`Parameter ${Xr} do not align with abi parameter ${eo}`);return parseBaseTypes(eo,Xr)}function parseCalldataField(Xr,eo,to,ro){const{name:no,type:io}=eo;let{value:oo}=Xr.next();switch(!0){case isTypeArray(io):if(!Array.isArray(oo)&&!isText(oo))throw Error(`ABI expected parameter ${no} to be array or long string, got ${oo}`);return typeof oo=="string"&&(oo=splitLongString(oo)),parseCalldataValue(oo,eo.type,to,ro);case io==="core::starknet::eth_address::EthAddress":return parseBaseTypes(io,oo);case(isTypeStruct(io,to)||isTypeTuple(io)||isTypeUint256(io)):return parseCalldataValue(oo,io,to,ro);case isTypeEnum(io,ro):return parseCalldataValue(oo,io,to,ro);default:return parseBaseTypes(io,oo)}}function parseBaseTypes2(Xr,eo){let to;switch(!0){case isTypeBool(Xr):return to=eo.next().value,!!BigInt(to);case isTypeUint256(Xr):const ro=eo.next().value,no=eo.next().value;return uint256ToBN({low:ro,high:no});case Xr==="core::starknet::eth_address::EthAddress":return to=eo.next().value,BigInt(to);default:return to=eo.next().value,BigInt(to)}}function parseResponseValue(Xr,eo,to,ro){if(eo.type==="()")return{};if(isTypeUint256(eo.type)){const no=Xr.next().value,io=Xr.next().value;return uint256ToBN({low:no,high:io})}if(isTypeArray(eo.type)){const no=[],io={name:"",type:getArrayType(eo.type)},oo=BigInt(Xr.next().value);for(;no.length(no[io.name]=parseResponseValue(Xr,io,to,ro),no),{});if(ro&&eo.type in ro&&ro[eo.type]){const no=Number(Xr.next().value),io=ro[eo.type].variants.reduce((ao,so,co)=>co===no?(ao[so.name]=parseResponseValue(Xr,{name:"",type:so.type},to,ro),ao):(ao[so.name]=void 0,ao),{});if(eo.type.startsWith("core::option::Option")){const ao=no===0?io.Some:void 0;return new CairoOption(no,ao)}if(eo.type.startsWith("core::result::Result")){let ao;return no===0?ao=io.Ok:ao=io.Err,new CairoResult(no,ao)}return new CairoCustomEnum(io)}if(isTypeTuple(eo.type))return extractTupleMemberTypes(eo.type).reduce((io,oo,ao)=>{const so=oo!=null&&oo.name?oo.name:ao,co=oo!=null&&oo.type?oo.type:oo,lo={name:so,type:co};return io[so]=parseResponseValue(Xr,lo,to,ro),io},{});if(isTypeArray(eo.type)){const no=[],io={name:"",type:getArrayType(eo.type)},oo=BigInt(Xr.next().value);for(;no.length{if(assert$2(typeof Xr=="string"||typeof Xr=="number"||typeof Xr=="bigint",`Validate: arg ${eo.name} should be a felt typed as (String, Number or BigInt)`),typeof Xr=="string"&&!isHex(Xr))return;const to=BigInt(Xr.toString(10));assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`)},validateUint=(Xr,eo)=>{typeof Xr=="number"&&assert$2(Xr<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is to large to be typed as Number use (BigInt or String)"),assert$2(typeof Xr=="string"||typeof Xr=="number"||typeof Xr=="bigint"||typeof Xr=="object"&&"low"in Xr&&"high"in Xr,`Validate: arg ${eo.name} of cairo type ${eo.type} should be type (String, Number or BigInt), but is ${typeof Xr} ${Xr}.`);const to=typeof Xr=="object"?uint256ToBN(Xr):toBigInt(Xr);switch(eo.type){case"core::integer::u8":assert$2(to>=0n&&to<=255n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0 - 255]`);break;case"core::integer::u16":assert$2(to>=0n&&to<=65535n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 65535]`);break;case"core::integer::u32":assert$2(to>=0n&&to<=4294967295n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 4294967295]`);break;case"core::integer::u64":assert$2(to>=0n&&to<=2n**64n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^64-1]`);break;case"core::integer::u128":assert$2(to>=0n&&to<=2n**128n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^128-1]`);break;case"core::integer::u256":assert$2(to>=0n&&to<=2n**256n-1n,`Validate: arg ${eo.name} is ${eo.type} 0 - 2^256-1`);break;case"core::starknet::class_hash::ClassHash":assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`);break;case"core::starknet::contract_address::ContractAddress":assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`);break}},validateBool=(Xr,eo)=>{assert$2(typeof Xr=="boolean",`Validate: arg ${eo.name} of cairo type ${eo.type} should be type (Boolean)`)},validateStruct=(Xr,eo,to)=>{if(eo.type==="core::integer::u256"){validateUint(Xr,eo);return}if(eo.type==="core::starknet::eth_address::EthAddress"){assert$2(typeof Xr!="object",`EthAddress type is waiting a BigNumberish. Got ${Xr}`);const ro=BigInt(Xr.toString(10));assert$2(ro>=0n&&ro<=2n**160n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^160-1]`);return}assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} is cairo type struct (${eo.type}), and should be defined as js object (not array)`),to[eo.type].members.forEach(({name:ro})=>{assert$2(Object.keys(Xr).includes(ro),`Validate: arg ${eo.name} should have a property ${ro}`)})},validateEnum=(Xr,eo)=>{assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} is cairo type Enum (${eo.type}), and should be defined as js object (not array)`);const to=Object.getOwnPropertyNames(Object.getPrototypeOf(Xr)),ro=[...Object.getOwnPropertyNames(Xr),...to];if(!(isTypeOption(eo.type)&&ro.includes("isSome")&&ro.includes("isNone"))&&!(isTypeResult(eo.type)&&ro.includes("isOk")&&ro.includes("isErr"))&&!(ro.includes("variant")&&ro.includes("activeVariant")))throw new Error(`Validate Enum: argument ${eo.name}, type ${eo.type}, value received ${Xr}, is not an Enum.`)},validateTuple=(Xr,eo)=>{assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} should be a tuple (defined as object)`)},validateArray=(Xr,eo,to,ro)=>{const no=getArrayType(eo.type);if(!(isTypeFelt(no)&&isLongText(Xr)))switch(assert$2(Array.isArray(Xr),`Validate: arg ${eo.name} should be an Array`),!0){case isTypeFelt(no):Xr.forEach(io=>validateFelt(io,eo));break;case isTypeTuple(no):Xr.forEach(io=>validateTuple(io,{name:eo.name,type:no}));break;case isTypeArray(no):Xr.forEach(io=>validateArray(io,{name:"",type:no},to,ro));break;case isTypeStruct(no,to):Xr.forEach(io=>validateStruct(io,{name:eo.name,type:no},to));break;case isTypeEnum(no,ro):Xr.forEach(io=>validateEnum(io,{name:eo.name,type:no}));break;case(isTypeUint(no)||isTypeLitteral(no)):Xr.forEach(io=>validateUint(io,eo));break;case isTypeBool(no):Xr.forEach(io=>validateBool(io,eo));break;default:throw new Error(`Validate Unhandled: argument ${eo.name}, type ${eo.type}, value ${Xr}`)}};function validateFields(Xr,eo,to,ro){Xr.inputs.reduce((no,io)=>{const oo=eo[no];switch(!0){case isLen(io.name):return no;case isTypeFelt(io.type):validateFelt(oo,io);break;case(isTypeUint(io.type)||isTypeLitteral(io.type)):validateUint(oo,io);break;case isTypeBool(io.type):validateBool(oo,io);break;case isTypeArray(io.type):validateArray(oo,io,to,ro);break;case isTypeStruct(io.type,to):validateStruct(oo,io,to);break;case isTypeEnum(io.type,ro):validateEnum(oo,io);break;case isTypeTuple(io.type):validateTuple(oo,io);break;default:throw new Error(`Validate Unhandled: argument ${io.name}, type ${io.type}, value ${oo}`)}return no+1},0)}var CallData=class{constructor(Xr){this.structs=CallData.getAbiStruct(Xr),this.enums=CallData.getAbiEnum(Xr),this.parser=createAbiParser(Xr),this.abi=this.parser.getLegacyFormat()}validate(Xr,eo,to=[]){if(Xr!=="DEPLOY"){const io=this.abi.filter(oo=>{if(oo.type!=="function")return!1;const ao=oo.stateMutability==="view"||oo.state_mutability==="view";return Xr==="INVOKE"?!ao:ao}).map(oo=>oo.name);assert$2(io.includes(eo),`${Xr==="INVOKE"?"invocable":"viewable"} method not found in abi`)}const ro=this.abi.find(io=>Xr==="DEPLOY"?io.name===eo&&io.type==="constructor":io.name===eo&&io.type==="function");if(isNoConstructorValid(eo,to,ro))return;const no=this.parser.methodInputsLength(ro);if(to.length!==no)throw Error(`Invalid number of arguments, expected ${no} arguments, but got ${to.length}`);validateFields(ro,to,this.structs,this.enums)}compile(Xr,eo){const to=this.abi.find(oo=>oo.name===Xr);if(isNoConstructorValid(Xr,eo,to))return[];let ro;if(Array.isArray(eo))ro=eo;else{const oo=orderPropsByAbi(eo,to.inputs,this.structs,this.enums);ro=Object.values(oo),validateFields(to,ro,this.structs,this.enums)}const no=ro[Symbol.iterator](),io=to.inputs.reduce((oo,ao)=>isLen(ao.name)&&!isCairo1Type(ao.type)?oo:oo.concat(parseCalldataField(no,ao,this.structs,this.enums)),[]);return Object.defineProperty(io,"__compiled__",{enumerable:!1,writable:!1,value:!0}),io}static compile(Xr){const eo=ro=>{const no=(oo,ao=".")=>{const so=Array.isArray(oo)?[oo.length.toString(),...oo]:oo;return Object.entries(so).flatMap(([co,lo])=>{let fo=lo;co==="entrypoint"?fo=getSelectorFromName(fo):isLongText(fo)&&(fo=splitLongString(fo));const ho=Array.isArray(so)&&co==="0"?"$$len":co;if(isBigInt(fo))return[[`${ao}${ho}`,felt(fo)]];if(Object(fo)===fo){const go=Object.getOwnPropertyNames(Object.getPrototypeOf(fo)),yo=[...Object.getOwnPropertyNames(fo),...go];if(yo.includes("isSome")&&yo.includes("isNone")){const vo=fo,wo=vo.isSome()?0:1;return vo.isSome()?no({0:wo,1:vo.unwrap()},`${ao}${ho}.`):[[`${ao}${ho}`,felt(wo)]]}if(yo.includes("isOk")&&yo.includes("isErr")){const vo=fo,wo=vo.isOk()?0:1;return no({0:wo,1:vo.unwrap()},`${ao}${ho}.`)}if(yo.includes("variant")&&yo.includes("activeVariant")){const vo=fo,wo=vo.activeVariant(),ko=Object.keys(vo.variant).findIndex(Ao=>Ao===wo);return typeof vo.unwrap()=="object"&&Object.keys(vo.unwrap()).length===0?[[`${ao}${ho}`,felt(ko)]]:no({0:ko,1:vo.unwrap()},`${ao}${ho}.`)}return no(fo,`${ao}${ho}.`)}return[[`${ao}${ho}`,felt(fo)]]})};return Object.fromEntries(no(ro))};let to;if(Array.isArray(Xr)){const ro={...Xr},no=eo(ro);to=Object.values(no)}else{const ro=eo(Xr);to=Object.values(ro)}return Object.defineProperty(to,"__compiled__",{enumerable:!1,writable:!1,value:!0}),to}parse(Xr,eo){const{outputs:to}=this.abi.find(io=>io.name===Xr),ro=eo.flat()[Symbol.iterator](),no=to.flat().reduce((io,oo,ao)=>{const so=oo.name??ao;return io[so]=responseParser(ro,oo,this.structs,this.enums,io),io[so]&&io[`${so}_len`]&&delete io[`${so}_len`],io},{});return Object.keys(no).length===1&&0 in no?no[0]:no}format(Xr,eo,to){const ro=this.parse(Xr,eo);return formatter(ro,to)}static getAbiStruct(Xr){return Xr.filter(eo=>eo.type==="struct").reduce((eo,to)=>({...eo,[to.name]:to}),{})}static getAbiEnum(Xr){const eo=Xr.filter(to=>to.type==="enum").reduce((to,ro)=>({...to,[ro.name]:ro}),{});return delete eo["core::bool"],eo}static toCalldata(Xr=[]){return CallData.compile(Xr)}static toHex(Xr=[]){return CallData.compile(Xr).map(to=>toHex(to))}},hash_exports={};__export(hash_exports,{calculateContractAddressFromHash:()=>calculateContractAddressFromHash,calculateDeclareTransactionHash:()=>calculateDeclareTransactionHash,calculateDeployAccountTransactionHash:()=>calculateDeployAccountTransactionHash,calculateDeployTransactionHash:()=>calculateDeployTransactionHash,calculateTransactionHash:()=>calculateTransactionHash,calculateTransactionHashCommon:()=>calculateTransactionHashCommon,computeCompiledClassHash:()=>computeCompiledClassHash,computeContractClassHash:()=>computeContractClassHash,computeHashOnElements:()=>computeHashOnElements,computeLegacyContractClassHash:()=>computeLegacyContractClassHash,computeSierraContractClassHash:()=>computeSierraContractClassHash,default:()=>computeHintedClassHash,feeTransactionVersion:()=>feeTransactionVersion,feeTransactionVersion_2:()=>feeTransactionVersion_2,formatSpaces:()=>formatSpaces,getSelector:()=>getSelector,getSelectorFromName:()=>getSelectorFromName,getVersionsByType:()=>getVersionsByType,keccakBn:()=>keccakBn,poseidon:()=>poseidon$1,starknetKeccak:()=>starknetKeccak,transactionVersion:()=>transactionVersion,transactionVersion_2:()=>transactionVersion_2});var ec_exports={};__export(ec_exports,{starkCurve:()=>starkCurve,weierstrass:()=>weierstrass$1});var json_exports={};__export(json_exports,{parse:()=>parse2,parseAlwaysAsBig:()=>parseAlwaysAsBig,stringify:()=>stringify2,stringifyAlwaysAsBig:()=>stringifyAlwaysAsBig});var parseIntAsNumberOrBigInt=Xr=>{if(!isInteger(Xr))return parseFloat(Xr);const eo=parseInt(Xr,10);return Number.isSafeInteger(eo)?eo:BigInt(Xr)},parse2=Xr=>parse(String(Xr),void 0,parseIntAsNumberOrBigInt),parseAlwaysAsBig=Xr=>parse(String(Xr),void 0,parseNumberAndBigInt),stringify2=(Xr,eo,to,ro)=>stringify(Xr,eo,to,ro),stringifyAlwaysAsBig=stringify2,transactionVersion=BN_TRANSACTION_VERSION_1,transactionVersion_2=BN_TRANSACTION_VERSION_2,feeTransactionVersion=BN_FEE_TRANSACTION_VERSION_1,feeTransactionVersion_2=BN_FEE_TRANSACTION_VERSION_2;function getVersionsByType(Xr){return Xr==="fee"?{v1:feeTransactionVersion,v2:feeTransactionVersion_2}:{v1:transactionVersion,v2:transactionVersion_2}}function computeHashOnElements(Xr){return[...Xr,Xr.length].reduce((eo,to)=>pedersen(toBigInt(eo),toBigInt(to)),0).toString()}function calculateTransactionHashCommon(Xr,eo,to,ro,no,io,oo,ao=[]){const so=computeHashOnElements(no),co=[Xr,eo,to,ro,so,io,oo,...ao];return computeHashOnElements(co)}function calculateDeployTransactionHash(Xr,eo,to,ro,no="constructor"){return calculateTransactionHashCommon("0x6465706c6f79",to,Xr,getSelectorFromName(no),eo,0,ro)}function calculateDeclareTransactionHash(Xr,eo,to,ro,no,io,oo){return calculateTransactionHashCommon("0x6465636c617265",to,eo,0,[Xr],ro,no,[io,...oo?[oo]:[]])}function calculateDeployAccountTransactionHash(Xr,eo,to,ro,no,io,oo,ao){const so=[eo,ro,...to];return calculateTransactionHashCommon("0x6465706c6f795f6163636f756e74",no,Xr,0,so,io,oo,[ao])}function calculateTransactionHash(Xr,eo,to,ro,no,io){return calculateTransactionHashCommon("0x696e766f6b65",eo,Xr,0,to,ro,no,[io])}function calculateContractAddressFromHash(Xr,eo,to,ro){const no=CallData.compile(to),io=computeHashOnElements(no),oo=felt("0x535441524b4e45545f434f4e54524143545f41444452455353"),ao=computeHashOnElements([oo,ro,Xr,eo,io]);return toHex(BigInt(ao)%ADDR_BOUND)}function nullSkipReplacer(Xr,eo){return Xr==="attributes"||Xr==="accessible_scopes"?Array.isArray(eo)&&eo.length===0?void 0:eo:Xr==="debug_info"?null:eo===null?void 0:eo}function formatSpaces(Xr){let eo=!1;const to=[];for(const ro of Xr)ro==='"'&&!(to.length>0&&to.slice(-1)[0]==="\\")&&(eo=!eo),eo?to.push(ro):to.push(ro===":"?": ":ro===","?", ":ro);return to.join("")}function computeHintedClassHash(Xr){const{abi:eo,program:to}=Xr,no=formatSpaces(stringify2({abi:eo,program:to},nullSkipReplacer));return addHexPrefix(keccak(utf8ToArray(no)).toString(16))}function computeLegacyContractClassHash(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr,to=toHex(API_VERSION),ro=computeHashOnElements(eo.entry_points_by_type.EXTERNAL.flatMap(co=>[co.selector,co.offset])),no=computeHashOnElements(eo.entry_points_by_type.L1_HANDLER.flatMap(co=>[co.selector,co.offset])),io=computeHashOnElements(eo.entry_points_by_type.CONSTRUCTOR.flatMap(co=>[co.selector,co.offset])),oo=computeHashOnElements(eo.program.builtins.map(co=>encodeShortString(co))),ao=computeHintedClassHash(eo),so=computeHashOnElements(eo.program.data);return computeHashOnElements([to,ro,no,io,oo,ao,so])}function hashBuiltins(Xr){return poseidonHashMany(Xr.flatMap(eo=>BigInt(encodeShortString(eo))))}function hashEntryPoint(Xr){const eo=Xr.flatMap(to=>[BigInt(to.selector),BigInt(to.offset),hashBuiltins(to.builtins)]);return poseidonHashMany(eo)}function computeCompiledClassHash(Xr){const to=BigInt(encodeShortString("COMPILED_CLASS_V1")),ro=hashEntryPoint(Xr.entry_points_by_type.EXTERNAL),no=hashEntryPoint(Xr.entry_points_by_type.L1_HANDLER),io=hashEntryPoint(Xr.entry_points_by_type.CONSTRUCTOR),oo=poseidonHashMany(Xr.bytecode.map(ao=>BigInt(ao)));return toHex(poseidonHashMany([to,ro,no,io,oo]))}function hashEntryPointSierra(Xr){const eo=Xr.flatMap(to=>[BigInt(to.selector),BigInt(to.function_idx)]);return poseidonHashMany(eo)}function hashAbi(Xr){const eo=formatSpaces(stringify2(Xr.abi,null));return BigInt(addHexPrefix(keccak(utf8ToArray(eo)).toString(16)))}function computeSierraContractClassHash(Xr){const to=BigInt(encodeShortString("CONTRACT_CLASS_V0.1.0")),ro=hashEntryPointSierra(Xr.entry_points_by_type.EXTERNAL),no=hashEntryPointSierra(Xr.entry_points_by_type.L1_HANDLER),io=hashEntryPointSierra(Xr.entry_points_by_type.CONSTRUCTOR),oo=hashAbi(Xr),ao=poseidonHashMany(Xr.sierra_program.map(so=>BigInt(so)));return toHex(poseidonHashMany([to,ro,no,io,oo,ao]))}function computeContractClassHash(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr;return"sierra_program"in eo?computeSierraContractClassHash(eo):computeLegacyContractClassHash(eo)}var stark_exports={};__export(stark_exports,{compressProgram:()=>compressProgram,decompressProgram:()=>decompressProgram,estimatedFeeToMaxFee:()=>estimatedFeeToMaxFee,formatSignature:()=>formatSignature,makeAddress:()=>makeAddress,randomAddress:()=>randomAddress,signatureToDecimalArray:()=>signatureToDecimalArray,signatureToHexArray:()=>signatureToHexArray});function compressProgram(Xr){const eo=typeof Xr=="string"?Xr:stringify2(Xr),to=gzip_1(eo);return btoaUniversal(to)}function decompressProgram(Xr){if(Array.isArray(Xr))return Xr;const eo=arrayBufferToString(ungzip_1(atobUniversal(Xr)));return parse2(eo)}function randomAddress(){const Xr=utils.randomPrivateKey();return getStarkKey(Xr)}function makeAddress(Xr){return addHexPrefix(Xr).toLowerCase()}function formatSignature(Xr){if(!Xr)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(Xr))return Xr.map(eo=>toHex(eo));try{const{r:eo,s:to}=Xr;return[toHex(eo),toHex(to)]}catch{throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function signatureToDecimalArray(Xr){return bigNumberishArrayToDecimalStringArray(formatSignature(Xr))}function signatureToHexArray(Xr){return bigNumberishArrayToHexadecimalStringArray(formatSignature(Xr))}function estimatedFeeToMaxFee(Xr,eo=.5){const to=Math.round((1+eo)*100);return toBigInt(Xr)*toBigInt(to)/100n}function isSierra(Xr){return"sierra_program"in(typeof Xr=="string"?parse2(Xr):Xr)}function extractContractHashes(Xr){const eo={...Xr};if(isSierra(Xr.contract)&&(!Xr.compiledClassHash&&Xr.casm&&(eo.compiledClassHash=computeCompiledClassHash(Xr.casm)),!eo.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(eo.classHash=Xr.classHash??computeContractClassHash(Xr.contract),!eo.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return eo}var fetchPonyfill_default=typeof window<"u"&&window.fetch||typeof global$1<"u"&&global$1.fetch||isomorphicFetch,provider_exports={};__export(provider_exports,{createSierraContractClass:()=>createSierraContractClass,parseContract:()=>parseContract,wait:()=>wait});function wait(Xr){return new Promise(eo=>{setTimeout(eo,Xr)})}function createSierraContractClass(Xr){const eo={...Xr};return delete eo.sierra_program_debug_info,eo.abi=formatSpaces(stringify2(Xr.abi)),eo.sierra_program=formatSpaces(stringify2(Xr.sierra_program)),eo.sierra_program=compressProgram(eo.sierra_program),eo}function parseContract(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr;return isSierra(Xr)?createSierraContractClass(eo):{...eo,..."program"in eo&&{program:compressProgram(eo.program)}}}var RPCResponseParser=class{parseGetBlockResponse(Xr){return{timestamp:Xr.timestamp,block_hash:"block_hash"in Xr?Xr.block_hash:"",block_number:"block_number"in Xr?Xr.block_number:-1,new_root:"new_root"in Xr?Xr.new_root:"",parent_hash:Xr.parent_hash,status:"status"in Xr?Xr.status:"PENDING",transactions:Xr.transactions}}parseGetTransactionResponse(Xr){return{calldata:"calldata"in Xr?Xr.calldata:[],contract_address:"contract_address"in Xr?Xr.contract_address:"",sender_address:"sender_address"in Xr?Xr.sender_address:"",max_fee:"max_fee"in Xr?Xr.max_fee:"",nonce:"nonce"in Xr?Xr.nonce:"",signature:"signature"in Xr?Xr.signature:[],transaction_hash:Xr.transaction_hash,version:Xr.version}}parseFeeEstimateResponse(Xr){return{overall_fee:toBigInt(Xr[0].overall_fee),gas_consumed:toBigInt(Xr[0].gas_consumed),gas_price:toBigInt(Xr[0].gas_price)}}parseFeeEstimateBulkResponse(Xr){return Xr.map(eo=>({overall_fee:toBigInt(eo.overall_fee),gas_consumed:toBigInt(eo.gas_consumed),gas_price:toBigInt(eo.gas_price)}))}parseCallContractResponse(Xr){return{result:Xr}}parseSimulateTransactionResponse(Xr){return Xr.map(eo=>({...eo,suggestedMaxFee:estimatedFeeToMaxFee(BigInt(eo.fee_estimation.overall_fee))}))}parseContractClassResponse(Xr){return{...Xr,abi:typeof Xr.abi=="string"?JSON.parse(Xr.abi):Xr.abi}}};function fixStack(Xr,eo=Xr.constructor){const{captureStackTrace:to}=Error;to&&to(Xr,eo)}function fixProto(Xr,eo){const{setPrototypeOf:to}=Object;to?to(Xr,eo):Xr.__proto__=eo}var CustomError=class extends Error{constructor(Xr){super(Xr),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),fixProto(this,new.target.prototype),fixStack(this)}},LibraryError=class extends CustomError{},GatewayError=class extends LibraryError{constructor(Xr,eo){super(Xr),this.errorCode=eo}},HttpError=class extends LibraryError{constructor(Xr,eo){super(Xr),this.errorCode=eo}},starknetId_exports={};__export(starknetId_exports,{StarknetIdContract:()=>StarknetIdContract,getStarknetIdContract:()=>getStarknetIdContract,useDecoded:()=>useDecoded,useEncoded:()=>useEncoded});var basicAlphabet="abcdefghijklmnopqrstuvwxyz0123456789-",basicSizePlusOne=BigInt(basicAlphabet.length+1),bigAlphabet="这来",basicAlphabetSize=BigInt(basicAlphabet.length),bigAlphabetSize=BigInt(bigAlphabet.length),bigAlphabetSizePlusOne=BigInt(bigAlphabet.length+1);function extractStars(Xr){let eo=0;for(;Xr.endsWith(bigAlphabet[bigAlphabet.length-1]);)Xr=Xr.substring(0,Xr.length-1),eo+=1;return[Xr,eo]}function useDecoded(Xr){let eo="";return Xr.forEach(to=>{for(;to!==ZERO;){const io=to%basicSizePlusOne;if(to/=basicSizePlusOne,io===BigInt(basicAlphabet.length)){const oo=to/bigAlphabetSizePlusOne;if(oo===ZERO){const ao=to%bigAlphabetSizePlusOne;to=oo,ao===ZERO?eo+=basicAlphabet[0]:eo+=bigAlphabet[Number(ao)-1]}else{const ao=to%bigAlphabetSize;eo+=bigAlphabet[Number(ao)],to/=bigAlphabetSize}}else eo+=basicAlphabet[Number(io)]}const[ro,no]=extractStars(eo);no&&(eo=ro+(no%2===0?bigAlphabet[bigAlphabet.length-1].repeat(no/2-1)+bigAlphabet[0]+basicAlphabet[1]:bigAlphabet[bigAlphabet.length-1].repeat((no-1)/2+1))),eo+="."}),eo&&eo.concat("stark")}function useEncoded(Xr){let eo=BigInt(0),to=BigInt(1);if(Xr.endsWith(bigAlphabet[0]+basicAlphabet[1])){const[ro,no]=extractStars(Xr.substring(0,Xr.length-2));Xr=ro+bigAlphabet[bigAlphabet.length-1].repeat(2*(no+1))}else{const[ro,no]=extractStars(Xr);no&&(Xr=ro+bigAlphabet[bigAlphabet.length-1].repeat(1+2*(no-1)))}for(let ro=0;ro(Xr.MAINNET="0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",Xr.TESTNET="0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce",Xr))(StarknetIdContract||{});function getStarknetIdContract(Xr){switch(Xr){case"0x534e5f4d41494e":return"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";case"0x534e5f474f45524c49":return"0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";default:throw new Error("Starknet.id is not yet deployed on this network")}}async function getStarkName(Xr,eo,to){const ro=await Xr.getChainId(),no=to??getStarknetIdContract(ro);try{const oo=(await Xr.callContract({contractAddress:no,entrypoint:"address_to_domain",calldata:CallData.compile({address:eo})})).result.map(so=>BigInt(so)).slice(1),ao=useDecoded(oo);if(!ao)throw Error("Starkname not found");return ao}catch(io){throw io instanceof Error&&io.message==="Starkname not found"?io:Error("Could not get stark name")}}async function getAddressFromStarkName(Xr,eo,to){const ro=await Xr.getChainId(),no=to??getStarknetIdContract(ro);try{return(await Xr.callContract({contractAddress:no,entrypoint:"domain_to_address",calldata:CallData.compile({domain:[useEncoded(eo.replace(".stark","")).toString(10)]})})).result[0]}catch{throw Error("Could not get address from stark name")}}var validBlockTags=Object.values(BlockTag),Block=class{constructor(Xr){this.hash=null,this.number=null,this.tag=null,this.valueOf=()=>this.number,this.toString=()=>this.hash,this.setIdentifier(Xr)}setIdentifier(Xr){typeof Xr=="string"&&isHex(Xr)?this.hash=Xr:typeof Xr=="bigint"?this.hash=toHex(Xr):typeof Xr=="number"?this.number=Xr:typeof Xr=="string"&&validBlockTags.includes(Xr)?this.tag=Xr:this.tag="pending"}get queryIdentifier(){return this.number!==null?`blockNumber=${this.number}`:this.hash!==null?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return this.number!==null?{block_number:this.number}:this.hash!==null?{block_hash:this.hash}:this.tag}set identifier(Xr){this.setIdentifier(Xr)}get sequencerIdentifier(){return this.hash!==null?{blockHash:this.hash}:{blockNumber:this.number??this.tag}}},getDefaultNodeUrl=(Xr,eo=!1,to=RPC_DEFAULT_VERSION)=>{eo||console.warn("Using default public node url, please provide nodeUrl in provider options!");const ro=RPC_NODES[Xr??"SN_GOERLI"],no=Math.floor(Math.random()*ro.length);return`${ro[no]}${to}`},defaultOptions={headers:{"Content-Type":"application/json"},blockIdentifier:"pending",retries:200},RpcProvider=class{constructor(Xr){this.responseParser=new RPCResponseParser,this.getBlockHashAndNumber=this.getBlockLatestAccepted,this.getStateUpdate=this.getBlockStateUpdate,this.traceBlockTransactions=this.getBlockTransactionsTraces,this.getTransactionCount=this.getBlockTransactionCount,this.traceTransaction=this.getTransactionTrace,this.getSimulateTransaction=this.simulateTransaction;const{nodeUrl:eo,retries:to,headers:ro,blockIdentifier:no,chainId:io,rpcVersion:oo}=Xr||{};Object.values(NetworkName).includes(eo)?this.nodeUrl=getDefaultNodeUrl(eo,Xr==null?void 0:Xr.default,oo):eo?this.nodeUrl=eo:this.nodeUrl=getDefaultNodeUrl(void 0,Xr==null?void 0:Xr.default,oo),this.retries=to||defaultOptions.retries,this.headers={...defaultOptions.headers,...ro},this.blockIdentifier=no||defaultOptions.blockIdentifier,this.chainId=io}fetch(Xr,eo,to=0){const ro={id:to,jsonrpc:"2.0",method:Xr,...eo&&{params:eo}};return fetchPonyfill_default(this.nodeUrl,{method:"POST",body:stringify2(ro),headers:this.headers})}errorHandler(Xr,eo,to,ro){if(to){const{code:no,message:io,data:oo}=to;throw new LibraryError(`RPC: ${Xr} with params ${stringify2(eo)} - ${no}: ${io}: ${stringify2(oo)}`)}if(ro instanceof LibraryError)throw ro;if(ro)throw Error(ro.message)}async fetchEndpoint(Xr,eo){var to;try{const ro=await this.fetch(Xr,eo),{error:no,result:io}=await ro.json();return this.errorHandler(Xr,eo,no),io}catch(ro){throw this.errorHandler(Xr,eo,(to=ro==null?void 0:ro.response)==null?void 0:to.data,ro),ro}}async getChainId(){return this.chainId??(this.chainId=await this.fetchEndpoint("starknet_chainId")),this.chainId}async getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async getNonceForAddress(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:to,block_id:ro})}async getBlock(Xr=this.blockIdentifier){return this.getBlockWithTxHashes(Xr).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}async getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}async getBlockWithTxHashes(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:eo})}async getBlockWithTxs(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:eo})}async getBlockStateUpdate(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:eo})}async getBlockTransactionsTraces(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:eo})}async getBlockTransactionCount(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:eo})}async getPendingTransactions(){const{transactions:Xr}=await this.getBlock("pending");return Promise.all(Xr.map(eo=>this.getTransactionByHash(eo)))}async getTransaction(Xr){return this.getTransactionByHash(Xr).then(this.responseParser.parseGetTransactionResponse)}async getTransactionByHash(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:eo})}async getTransactionByBlockIdAndIndex(Xr,eo){const to=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:to,index:eo})}async getTransactionReceipt(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:eo})}async getTransactionTrace(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:eo})}async getTransactionStatus(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:eo})}async simulateTransaction(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1,skipFeeCharge:ro=!0}){const no=new Block(eo).identifier,io=[];return to&&io.push(rpc_exports.ESimulationFlag.SKIP_VALIDATE),ro&&io.push(rpc_exports.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:no,transactions:Xr.map(oo=>this.buildTransaction(oo)),simulation_flags:io}).then(this.responseParser.parseSimulateTransactionResponse)}async waitForTransaction(Xr,eo){const to=toHex(Xr);let{retries:ro}=this,no=!1,io=!1;const oo=(eo==null?void 0:eo.retryInterval)??5e3,ao=(eo==null?void 0:eo.errorStates)??[rpc_exports.ETransactionStatus.REJECTED],so=(eo==null?void 0:eo.successStates)??[rpc_exports.ETransactionExecutionStatus.SUCCEEDED,rpc_exports.ETransactionStatus.ACCEPTED_ON_L2,rpc_exports.ETransactionStatus.ACCEPTED_ON_L1];let co;for(;!no;){await wait(oo);try{co=await this.getTransactionStatus(to);const fo=co.execution_status,ho=co.finality_status;if(!ho)throw new Error("waiting for transaction status");if(ao.includes(fo)||ao.includes(ho)){const go=`${fo}: ${ho}`,yo=new Error(go);throw yo.response=co,io=!0,yo}else(so.includes(fo)||so.includes(ho))&&(no=!0)}catch(fo){if(fo instanceof Error&&io)throw fo;if(ro<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}ro-=1}let lo=null;for(;lo===null;){try{lo=await this.getTransactionReceipt(to)}catch{if(ro<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}ro-=1,await wait(oo)}return lo}async getStorageAt(Xr,eo,to=this.blockIdentifier){const ro=toHex(Xr),no=toStorageKey(eo),io=new Block(to).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:ro,key:no,block_id:io})}async getClassHashAt(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:ro,contract_address:to})}async getClassByHash(Xr){return this.getClass(Xr)}async getClass(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:to,block_id:ro}).then(this.responseParser.parseContractClassResponse)}async getClassAt(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:ro,contract_address:to}).then(this.responseParser.parseContractClassResponse)}async getCode(Xr,eo){throw new Error("RPC does not implement getCode function")}async getContractVersion(Xr,eo,{blockIdentifier:to=this.blockIdentifier,compiler:ro=!0}={}){let no;if(Xr)no=await this.getClassAt(Xr,to);else if(eo)no=await this.getClass(eo,to);else throw Error("getContractVersion require contractAddress or classHash");return isSierra(no)?ro?{cairo:"1",compiler:getAbiContractVersion(no.abi).compiler}:{cairo:"1",compiler:void 0}:{cairo:"0",compiler:"0"}}async getEstimateFee(Xr,eo,to=this.blockIdentifier){return this.getInvokeEstimateFee(Xr,eo,to)}async getInvokeEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"INVOKE_FUNCTION",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"DECLARE",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"DEPLOY_ACCOUNT",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1}){to&&console.warn("getEstimateFeeBulk RPC does not support skipValidate");const ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_estimateFee",{request:Xr.map(no=>this.buildTransaction(no,"fee")),block_id:ro}).then(this.responseParser.parseFeeEstimateBulkResponse)}async invokeFunction(Xr,eo){return this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:Xr.contractAddress,calldata:CallData.toHex(Xr.calldata),type:rpc_exports.ETransactionType.INVOKE,max_fee:toHex(eo.maxFee||0),version:"0x1",signature:signatureToHexArray(Xr.signature),nonce:toHex(eo.nonce)}})}async declareContract({contract:Xr,signature:eo,senderAddress:to,compiledClassHash:ro},no){return isSierra(Xr)?this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:rpc_exports.ETransactionType.DECLARE,contract_class:{sierra_program:decompressProgram(Xr.sierra_program),contract_class_version:Xr.contract_class_version,entry_points_by_type:Xr.entry_points_by_type,abi:Xr.abi},compiled_class_hash:ro||"",version:HEX_STR_TRANSACTION_VERSION_2,max_fee:toHex(no.maxFee||0),signature:signatureToHexArray(eo),sender_address:to,nonce:toHex(no.nonce)}}):this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:rpc_exports.ETransactionType.DECLARE,contract_class:{program:Xr.program,entry_points_by_type:Xr.entry_points_by_type,abi:Xr.abi},version:HEX_STR_TRANSACTION_VERSION_1,max_fee:toHex(no.maxFee||0),signature:signatureToHexArray(eo),sender_address:to,nonce:toHex(no.nonce)}})}async deployAccountContract({classHash:Xr,constructorCalldata:eo,addressSalt:to,signature:ro},no){return this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:CallData.toHex(eo||[]),class_hash:toHex(Xr),contract_address_salt:toHex(to||0),type:rpc_exports.ETransactionType.DEPLOY_ACCOUNT,max_fee:toHex(no.maxFee||0),version:toHex(no.version||0),signature:signatureToHexArray(ro),nonce:toHex(no.nonce)}})}async callContract(Xr,eo=this.blockIdentifier){const to=new Block(eo).identifier,ro=await this.fetchEndpoint("starknet_call",{request:{contract_address:Xr.contractAddress,entry_point_selector:getSelectorFromName(Xr.entrypoint),calldata:CallData.toHex(Xr.calldata)},block_id:to});return this.responseParser.parseCallContractResponse(ro)}async estimateMessageFee(Xr,eo=this.blockIdentifier){const{from_address:to,to_address:ro,entry_point_selector:no,payload:io}=Xr,oo={from_address:toHex(to),to_address:toHex(ro),entry_point_selector:getSelector(no),payload:getHexStringArray(io)},ao=new Block(eo).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:oo,block_id:ao})}async getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}async getEvents(Xr){return this.fetchEndpoint("starknet_getEvents",{filter:Xr})}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}buildTransaction(Xr,eo){const to=getVersionsByType(eo),ro={signature:signatureToHexArray(Xr.signature),nonce:toHex(Xr.nonce),max_fee:toHex(Xr.maxFee||0)};if(Xr.type==="INVOKE_FUNCTION")return{type:rpc_exports.ETransactionType.INVOKE,sender_address:Xr.contractAddress,calldata:CallData.toHex(Xr.calldata),version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DECLARE")return isSierra(Xr.contract)?{type:Xr.type,contract_class:{...Xr.contract,sierra_program:decompressProgram(Xr.contract.sierra_program)},compiled_class_hash:Xr.compiledClassHash||"",sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v2),...ro}:{type:Xr.type,contract_class:Xr.contract,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DEPLOY_ACCOUNT")return{type:Xr.type,constructor_calldata:CallData.toHex(Xr.constructorCalldata||[]),class_hash:toHex(Xr.classHash),contract_address_salt:toHex(Xr.addressSalt||0),version:toHex(Xr.version||to.v1),...ro};throw Error("RPC buildTransaction received unknown TransactionType")}},ResponseParser=class{},SequencerAPIResponseParser=class extends ResponseParser{parseGetBlockResponse(Xr){return{...Xr,new_root:Xr.state_root,parent_hash:Xr.parent_block_hash,transactions:Object.values(Xr.transactions).map(eo=>"transaction_hash"in eo&&eo.transaction_hash).filter(Boolean)}}parseGetTransactionResponse(Xr){if(Xr.status==="NOT_RECEIVED"&&Xr.finality_status==="NOT_RECEIVED")throw new LibraryError;return{...Xr,calldata:"calldata"in Xr.transaction?Xr.transaction.calldata:[],contract_class:"contract_class"in Xr.transaction?Xr.transaction.contract_class:void 0,entry_point_selector:"entry_point_selector"in Xr.transaction?Xr.transaction.entry_point_selector:void 0,max_fee:"max_fee"in Xr.transaction?Xr.transaction.max_fee:void 0,nonce:Xr.transaction.nonce,sender_address:"sender_address"in Xr.transaction?Xr.transaction.sender_address:void 0,signature:"signature"in Xr.transaction?Xr.transaction.signature:void 0,transaction_hash:"transaction_hash"in Xr.transaction?Xr.transaction.transaction_hash:void 0,version:"version"in Xr.transaction?Xr.transaction.version:void 0}}parseGetTransactionReceiptResponse(Xr){return{...Xr,messages_sent:Xr.l2_to_l1_messages,..."revert_error"in Xr&&{revert_reason:Xr.revert_error}}}parseFeeEstimateResponse(Xr){if("overall_fee"in Xr){let eo={};try{eo={gas_consumed:toBigInt(Xr.gas_usage),gas_price:toBigInt(Xr.gas_price)}}catch{}return{overall_fee:toBigInt(Xr.overall_fee),...eo}}return{overall_fee:toBigInt(Xr.amount)}}parseFeeEstimateBulkResponse(Xr){return[].concat(Xr).map(eo=>{if("overall_fee"in eo){let to={};try{to={gas_consumed:toBigInt(eo.gas_usage),gas_price:toBigInt(eo.gas_price)}}catch{}return{overall_fee:toBigInt(eo.overall_fee),...to}}return{overall_fee:toBigInt(eo.amount)}})}parseSimulateTransactionResponse(Xr){const eo="overall_fee"in Xr.fee_estimation?Xr.fee_estimation.overall_fee:Xr.fee_estimation.amount;return[{transaction_trace:Xr.trace,fee_estimation:Xr.fee_estimation,suggestedMaxFee:estimatedFeeToMaxFee(BigInt(eo))}]}parseCallContractResponse(Xr){return{result:Xr.result}}parseInvokeFunctionResponse(Xr){return{transaction_hash:Xr.transaction_hash}}parseDeployContractResponse(Xr){return{transaction_hash:Xr.transaction_hash,contract_address:Xr.address}}parseDeclareContractResponse(Xr){return{transaction_hash:Xr.transaction_hash,class_hash:Xr.class_hash}}parseGetStateUpdateResponse(Xr){const eo=Object.entries(Xr.state_diff.nonces).map(([ro,no])=>({contract_address:ro,nonce:no})),to=Object.entries(Xr.state_diff.storage_diffs).map(([ro,no])=>({address:ro,storage_entries:no}));return{...Xr,state_diff:{...Xr.state_diff,storage_diffs:to,nonces:eo}}}parseContractClassResponse(Xr){const eo=isSierra(Xr)?Xr:parseContract(Xr);return{...eo,abi:typeof eo.abi=="string"?JSON.parse(eo.abi):eo.abi}}},protocolAndDomainRE=/^(?:\w+:)?\/\/(\S+)$/,localhostDomainRE=/^localhost[:?\d]*(?:[^:?\d]\S*)?$/,nonLocalhostDomainRE=/^[^\s.]+\.\S{2,}$/;function isUrl(Xr){if(!Xr||typeof Xr!="string")return!1;const eo=Xr.match(protocolAndDomainRE);if(!eo)return!1;const to=eo[1];return to?!!(localhostDomainRE.test(to)||nonLocalhostDomainRE.test(to)):!1}function buildUrl(Xr,eo,to){return isUrl(to)?to:urljoin2(Xr,to??eo)}function isEmptyQueryObject(Xr){return Xr===void 0||Object.keys(Xr).length===0||Object.keys(Xr).length===1&&Object.entries(Xr).every(([eo,to])=>eo==="blockIdentifier"&&to===null)}var defaultOptions2={network:"SN_GOERLI",blockIdentifier:"pending"},SequencerProvider=class{constructor(Xr=defaultOptions2){this.responseParser=new SequencerAPIResponseParser,"network"in Xr?(this.baseUrl=SequencerProvider.getNetworkFromName(Xr.network),this.feederGatewayUrl=buildUrl(this.baseUrl,"feeder_gateway"),this.gatewayUrl=buildUrl(this.baseUrl,"gateway")):(this.baseUrl=Xr.baseUrl,this.feederGatewayUrl=buildUrl(this.baseUrl,"feeder_gateway",Xr.feederGatewayUrl),this.gatewayUrl=buildUrl(this.baseUrl,"gateway",Xr.gatewayUrl)),this.chainId=(Xr==null?void 0:Xr.chainId)??SequencerProvider.getChainIdFromBaseUrl(this.baseUrl),this.headers=Xr.headers,this.blockIdentifier=(Xr==null?void 0:Xr.blockIdentifier)||defaultOptions2.blockIdentifier}static getNetworkFromName(Xr){switch(Xr){case"SN_MAIN":case"0x534e5f4d41494e":return"https://alpha-mainnet.starknet.io";case"SN_GOERLI":case"0x534e5f474f45524c49":return"https://alpha4.starknet.io";default:throw new Error("Could not detect base url from NetworkName")}}static getChainIdFromBaseUrl(Xr){try{return new URL(Xr).host.includes("mainnet.starknet.io")?"0x534e5f4d41494e":"0x534e5f474f45524c49"}catch{return console.error(`Could not parse baseUrl: ${Xr}`),"0x534e5f474f45524c49"}}getFetchUrl(Xr){return["add_transaction"].includes(Xr)?this.gatewayUrl:this.feederGatewayUrl}getFetchMethod(Xr){return["add_transaction","call_contract","estimate_fee","estimate_message_fee","estimate_fee_bulk","simulate_transaction"].includes(Xr)?"POST":"GET"}getQueryString(Xr){return isEmptyQueryObject(Xr)?"":`?${Object.entries(Xr).map(([to,ro])=>to==="blockIdentifier"?`${new Block(ro).queryIdentifier}`:`${to}=${ro}`).join("&")}`}getHeaders(Xr){return Xr==="POST"?{"Content-Type":"application/json",...this.headers}:this.headers}async fetchEndpoint(Xr,...[eo,to]){const ro=this.getFetchUrl(Xr),no=this.getFetchMethod(Xr),io=this.getQueryString(eo),oo=urljoin2(ro,Xr,io);return this.fetch(oo,{method:no,body:to})}async fetch(Xr,eo){const to=buildUrl(this.baseUrl,"",Xr),ro=(eo==null?void 0:eo.method)??"GET",no=this.getHeaders(ro),io=stringify2(eo==null?void 0:eo.body);try{const oo=await fetchPonyfill_default(to,{method:ro,body:io,headers:no}),ao=await oo.text();if(!oo.ok){let co;try{co=parse2(ao)}catch{throw new HttpError(oo.statusText,oo.status)}throw new GatewayError(co.message,co.code)}return(eo!=null&&eo.parseAlwaysAsBigInt?parseAlwaysAsBig:parse2)(ao)}catch(oo){throw oo instanceof Error&&!(oo instanceof LibraryError)?Error(`Could not ${ro} from endpoint \`${to}\`: ${oo.message}`):oo}}async getChainId(){return Promise.resolve(this.chainId)}async callContract({contractAddress:Xr,entrypoint:eo,calldata:to=[]},ro=this.blockIdentifier){return this.fetchEndpoint("call_contract",{blockIdentifier:ro},{contract_address:Xr,entry_point_selector:getSelectorFromName(eo),calldata:CallData.compile(to)}).then(this.responseParser.parseCallContractResponse)}async getBlock(Xr=this.blockIdentifier){return this.fetchEndpoint("get_block",{blockIdentifier:Xr}).then(this.responseParser.parseGetBlockResponse)}async getNonceForAddress(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_nonce",{contractAddress:Xr,blockIdentifier:eo})}async getStorageAt(Xr,eo,to=this.blockIdentifier){const ro=toBigInt(eo).toString(10);return this.fetchEndpoint("get_storage_at",{blockIdentifier:to,contractAddress:Xr,key:ro})}async getTransaction(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction",{transactionHash:eo}).then(to=>{if(Object.values(to).length===1)throw new LibraryError(to.status);return this.responseParser.parseGetTransactionResponse(to)})}async getTransactionReceipt(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_receipt",{transactionHash:eo}).then(this.responseParser.parseGetTransactionReceiptResponse)}async getClassAt(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_full_contract",{blockIdentifier:eo,contractAddress:Xr}).then(this.responseParser.parseContractClassResponse)}async getClassHashAt(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_class_hash_at",{blockIdentifier:eo,contractAddress:Xr})}async getClassByHash(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_class_by_hash",{classHash:Xr,blockIdentifier:eo}).then(this.responseParser.parseContractClassResponse)}async getCompiledClassByClassHash(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_compiled_class_by_class_hash",{classHash:Xr,blockIdentifier:eo})}async getContractVersion(Xr,eo,{blockIdentifier:to=this.blockIdentifier,compiler:ro=!0}={}){let no;if(Xr)no=await this.getClassAt(Xr,to);else if(eo)no=await this.getClassByHash(eo,to);else throw Error("getContractVersion require contractAddress or classHash");return isSierra(no)?ro?{cairo:"1",compiler:getAbiContractVersion(no.abi).compiler}:{cairo:"1",compiler:void 0}:{cairo:"0",compiler:"0"}}async invokeFunction(Xr,eo){return this.fetchEndpoint("add_transaction",void 0,{type:"INVOKE_FUNCTION",sender_address:Xr.contractAddress,calldata:CallData.compile(Xr.calldata??[]),signature:signatureToDecimalArray(Xr.signature),nonce:toHex(eo.nonce),max_fee:toHex(eo.maxFee||0),version:"0x1"}).then(this.responseParser.parseInvokeFunctionResponse)}async deployAccountContract({classHash:Xr,constructorCalldata:eo,addressSalt:to,signature:ro},no){return this.fetchEndpoint("add_transaction",void 0,{type:"DEPLOY_ACCOUNT",contract_address_salt:to??randomAddress(),constructor_calldata:CallData.compile(eo??[]),class_hash:toHex(Xr),max_fee:toHex(no.maxFee||0),version:toHex(no.version||0),nonce:toHex(no.nonce),signature:signatureToDecimalArray(ro)}).then(this.responseParser.parseDeployContractResponse)}async declareContract({senderAddress:Xr,contract:eo,signature:to,compiledClassHash:ro},no){return isSierra(eo)?this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",sender_address:Xr,compiled_class_hash:ro,contract_class:eo,nonce:toHex(no.nonce),signature:signatureToDecimalArray(to),max_fee:toHex(no.maxFee||0),version:toHex(transactionVersion_2)}).then(this.responseParser.parseDeclareContractResponse):this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",contract_class:eo,nonce:toHex(no.nonce),signature:signatureToDecimalArray(to),sender_address:Xr,max_fee:toHex(no.maxFee||0),version:toHex(transactionVersion)}).then(this.responseParser.parseDeclareContractResponse)}async getEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){return this.getInvokeEstimateFee(Xr,eo,to,ro)}async getInvokeEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"INVOKE_FUNCTION",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"DECLARE",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"DEPLOY_ACCOUNT",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1}){const ro=Xr.map(no=>this.buildTransaction(no,"fee"));return this.fetchEndpoint("estimate_fee_bulk",{blockIdentifier:eo,skipValidate:to},ro).then(this.responseParser.parseFeeEstimateBulkResponse)}async getCode(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_code",{contractAddress:Xr,blockIdentifier:eo})}async waitForTransaction(Xr,eo){let to,ro=!1,no=0;const io=(eo==null?void 0:eo.retryInterval)??5e3,oo=(eo==null?void 0:eo.errorStates)??["REJECTED","NOT_RECEIVED","REVERTED"],ao=(eo==null?void 0:eo.successStates)??["SUCCEEDED","ACCEPTED_ON_L1","ACCEPTED_ON_L2"];for(;!ro;)if(await wait(io),to=await this.getTransactionStatus(Xr),to.finality_status==="NOT_RECEIVED"&&no<3)no+=1;else if(ao.includes(to.finality_status)||ao.includes(to.execution_status))ro=!0;else if(oo.includes(to.finality_status)||oo.includes(to.execution_status)){let co;to.tx_failure_reason?co=`${to.tx_status}: ${to.tx_failure_reason.code} -${to.tx_failure_reason.error_message}`:to.tx_revert_reason?co=`${to.tx_status}: ${to.tx_revert_reason}`:co=to.tx_status;const lo=new Error(co);throw lo.response=to,lo}return await this.getTransactionReceipt(Xr)}async getTransactionStatus(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_status",{transactionHash:eo})}async getContractAddresses(){return this.fetchEndpoint("get_contract_addresses")}async getTransactionTrace(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_trace",{transactionHash:eo})}async estimateMessageFee({from_address:Xr,to_address:eo,entry_point_selector:to,payload:ro},no=this.blockIdentifier){const io={from_address:getDecimalString(Xr),to_address:getHexString(eo),entry_point_selector:getSelector(to),payload:getHexStringArray(ro)};return this.fetchEndpoint("estimate_message_fee",{blockIdentifier:no},io)}async getSimulateTransaction(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1,skipExecute:ro=!1}){Xr.length>1&&console.warn("Sequencer simulate process only first element from invocations list"),ro&&console.warn("Sequencer can't skip account __execute__");const no=this.buildTransaction(Xr[0]);return this.fetchEndpoint("simulate_transaction",{blockIdentifier:eo,skipValidate:to??!1},no).then(this.responseParser.parseSimulateTransactionResponse)}async getStateUpdate(Xr=this.blockIdentifier){const eo=new Block(Xr).sequencerIdentifier;return this.fetchEndpoint("get_state_update",{...eo}).then(this.responseParser.parseGetStateUpdateResponse)}async getBlockTraces(Xr=this.blockIdentifier){const eo=new Block(Xr).sequencerIdentifier;return this.fetchEndpoint("get_block_traces",{...eo})}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}buildTransaction(Xr,eo){const to=getVersionsByType(eo),ro={signature:signatureToDecimalArray(Xr.signature),nonce:toHex(Xr.nonce)};if(Xr.type==="INVOKE_FUNCTION")return{type:Xr.type,sender_address:Xr.contractAddress,calldata:CallData.compile(Xr.calldata??[]),version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DECLARE")return isSierra(Xr.contract)?{type:Xr.type,contract_class:Xr.contract,compiled_class_hash:Xr.compiledClassHash,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v2),...ro}:{type:Xr.type,contract_class:Xr.contract,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DEPLOY_ACCOUNT")return{type:Xr.type,constructor_calldata:CallData.compile(Xr.constructorCalldata||[]),class_hash:toHex(Xr.classHash),contract_address_salt:toHex(Xr.addressSalt||0),version:toHex(Xr.version||to.v1),...ro};throw Error("Sequencer buildTransaction received unknown TransactionType")}},Provider=class{constructor(Xr){Xr instanceof Provider?this.provider=Xr.provider:Xr instanceof RpcProvider||Xr instanceof SequencerProvider?this.provider=Xr:Xr&&"rpc"in Xr?this.provider=new RpcProvider(Xr.rpc):Xr&&"sequencer"in Xr?this.provider=new SequencerProvider(Xr.sequencer):this.provider=new RpcProvider}async getChainId(){return this.provider.getChainId()}async getBlock(Xr){return this.provider.getBlock(Xr)}async getClassAt(Xr,eo){return this.provider.getClassAt(Xr,eo)}async getClassHashAt(Xr,eo){return this.provider.getClassHashAt(Xr,eo)}getClassByHash(Xr){return this.provider.getClassByHash(Xr)}async getEstimateFee(Xr,eo,to){return this.provider.getEstimateFee(Xr,eo,to)}async getInvokeEstimateFee(Xr,eo,to,ro){return this.provider.getInvokeEstimateFee(Xr,eo,to,ro)}async getEstimateFeeBulk(Xr,eo){return this.provider.getEstimateFeeBulk(Xr,eo)}async getNonceForAddress(Xr,eo){return this.provider.getNonceForAddress(Xr,eo)}async getStorageAt(Xr,eo,to){return this.provider.getStorageAt(Xr,eo,to)}async getTransaction(Xr){return this.provider.getTransaction(Xr)}async getTransactionReceipt(Xr){return this.provider.getTransactionReceipt(Xr)}async callContract(Xr,eo){return this.provider.callContract(Xr,eo)}async invokeFunction(Xr,eo){return this.provider.invokeFunction(Xr,eo)}async deployAccountContract(Xr,eo){return this.provider.deployAccountContract(Xr,eo)}async declareContract(Xr,eo){return this.provider.declareContract(Xr,eo)}async getDeclareEstimateFee(Xr,eo,to,ro){return this.provider.getDeclareEstimateFee(Xr,eo,to,ro)}getDeployAccountEstimateFee(Xr,eo,to,ro){return this.provider.getDeployAccountEstimateFee(Xr,eo,to,ro)}async getCode(Xr,eo){return this.provider.getCode(Xr,eo)}async waitForTransaction(Xr,eo){return this.provider.waitForTransaction(Xr,eo)}async getSimulateTransaction(Xr,eo){return this.provider.getSimulateTransaction(Xr,eo)}async getStateUpdate(Xr){return this.provider.getStateUpdate(Xr)}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}async getContractVersion(Xr,eo,to){return this.provider.getContractVersion(Xr,eo,to)}},transaction_exports={};__export(transaction_exports,{fromCallsToExecuteCalldata:()=>fromCallsToExecuteCalldata,fromCallsToExecuteCalldataWithNonce:()=>fromCallsToExecuteCalldataWithNonce,fromCallsToExecuteCalldata_cairo1:()=>fromCallsToExecuteCalldata_cairo1,getExecuteCalldata:()=>getExecuteCalldata,transformCallsToMulticallArrays:()=>transformCallsToMulticallArrays,transformCallsToMulticallArrays_cairo1:()=>transformCallsToMulticallArrays_cairo1});var transformCallsToMulticallArrays=Xr=>{const eo=[],to=[];return Xr.forEach(ro=>{const no=CallData.compile(ro.calldata||[]);eo.push({to:toBigInt(ro.contractAddress).toString(10),selector:toBigInt(getSelectorFromName(ro.entrypoint)).toString(10),data_offset:to.length.toString(),data_len:no.length.toString()}),to.push(...no)}),{callArray:eo,calldata:CallData.compile({calldata:to})}},fromCallsToExecuteCalldata=Xr=>{const{callArray:eo,calldata:to}=transformCallsToMulticallArrays(Xr);return[...CallData.compile({callArray:eo}),...to]},fromCallsToExecuteCalldataWithNonce=(Xr,eo)=>[...fromCallsToExecuteCalldata(Xr),toBigInt(eo).toString()],transformCallsToMulticallArrays_cairo1=Xr=>Xr.map(to=>({to:toBigInt(to.contractAddress).toString(10),selector:toBigInt(getSelectorFromName(to.entrypoint)).toString(10),calldata:CallData.compile(to.calldata||[])})),fromCallsToExecuteCalldata_cairo1=Xr=>{const eo=Xr.map(to=>({contractAddress:to.contractAddress,entrypoint:to.entrypoint,calldata:Array.isArray(to.calldata)&&"__compiled__"in to.calldata?to.calldata:CallData.compile(to.calldata)}));return CallData.compile({orderCalls:eo})},getExecuteCalldata=(Xr,eo="0")=>eo==="1"?fromCallsToExecuteCalldata_cairo1(Xr):fromCallsToExecuteCalldata(Xr),typedData_exports={};__export(typedData_exports,{encodeData:()=>encodeData,encodeType:()=>encodeType,encodeValue:()=>encodeValue,getDependencies:()=>getDependencies,getMessageHash:()=>getMessageHash,getStructHash:()=>getStructHash,getTypeHash:()=>getTypeHash,isMerkleTreeType:()=>isMerkleTreeType,prepareSelector:()=>prepareSelector});var merkle_exports={};__export(merkle_exports,{MerkleTree:()=>MerkleTree,proofMerklePath:()=>proofMerklePath});var MerkleTree=class{constructor(Xr){this.branches=[],this.leaves=Xr,this.root=this.build(Xr)}build(Xr){if(Xr.length===1)return Xr[0];Xr.length!==this.leaves.length&&this.branches.push(Xr);const eo=[];for(let to=0;tono>=io?1:-1);return pedersen(to,ro)}getProof(Xr,eo=this.leaves,to=[]){const ro=eo.indexOf(Xr);if(ro===-1)throw new Error("leaf not found");if(eo.length===1)return to;const no=ro%2===0,io=(no?eo[ro+1]:eo[ro-1])??"0x0",oo=[...to,io],ao=this.leaves.length===eo.length?-1:this.branches.findIndex(co=>co.length===eo.length),so=this.branches[ao+1]??[this.root];return this.getProof(MerkleTree.hash(no?Xr:io,no?io:Xr),so,oo)}};function proofMerklePath(Xr,eo,to){if(to.length===0)return Xr===eo;const[ro,...no]=to;return proofMerklePath(Xr,MerkleTree.hash(eo,ro),no)}function getHex(Xr){try{return toHex(Xr)}catch{if(typeof Xr=="string")return toHex(encodeShortString(Xr));throw new Error(`Invalid BigNumberish: ${Xr}`)}}var validateTypedData=Xr=>{const eo=Xr;return!!(eo.types&&eo.primaryType&&eo.message)};function prepareSelector(Xr){return isHex(Xr)?Xr:getSelectorFromName(Xr)}function isMerkleTreeType(Xr){return Xr.type==="merkletree"}var getDependencies=(Xr,eo,to=[])=>(eo[eo.length-1]==="*"&&(eo=eo.slice(0,-1)),to.includes(eo)||!Xr[eo]?to:[eo,...Xr[eo].reduce((ro,no)=>[...ro,...getDependencies(Xr,no.type,ro).filter(io=>!ro.includes(io))],[])]);function getMerkleTreeType(Xr,eo){if(eo.parent&&eo.key){const ro=Xr[eo.parent].find(io=>io.name===eo.key);if(!isMerkleTreeType(ro))throw new Error(`${eo.key} is not a merkle tree`);if(ro.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${eo.key}`);return ro.contains}return"raw"}var encodeType=(Xr,eo)=>{const[to,...ro]=getDependencies(Xr,eo);return(to?[to,...ro.sort()]:[]).map(io=>`${io}(${Xr[io].map(oo=>`${oo.name}:${oo.type}`)})`).join("")},getTypeHash=(Xr,eo)=>getSelectorFromName(encodeType(Xr,eo)),encodeValue=(Xr,eo,to,ro={})=>{if(Xr[eo])return[eo,getStructHash(Xr,eo,to)];if(Object.keys(Xr).map(no=>`${no}*`).includes(eo)){const no=to.map(io=>getStructHash(Xr,eo.slice(0,-1),io));return[eo,computeHashOnElements(no)]}if(eo==="merkletree"){const no=getMerkleTreeType(Xr,ro),io=to.map(ao=>encodeValue(Xr,no,ao)[1]),{root:oo}=new MerkleTree(io);return["felt",oo]}return eo==="felt*"?["felt*",computeHashOnElements(to)]:eo==="selector"?["felt",prepareSelector(to)]:[eo,getHex(to)]},encodeData=(Xr,eo,to)=>{const[ro,no]=Xr[eo].reduce(([io,oo],ao)=>{if(to[ao.name]===void 0||to[ao.name]===null)throw new Error(`Cannot encode data: missing data for '${ao.name}'`);const so=to[ao.name],[co,lo]=encodeValue(Xr,ao.type,so,{parent:eo,key:ao.name});return[[...io,co],[...oo,lo]]},[["felt"],[getTypeHash(Xr,eo)]]);return[ro,no]},getStructHash=(Xr,eo,to)=>computeHashOnElements(encodeData(Xr,eo,to)[1]),getMessageHash=(Xr,eo)=>{if(!validateTypedData(Xr))throw new Error("Typed data does not match JSON schema");const to=[encodeShortString("StarkNet Message"),getStructHash(Xr.types,"StarkNetDomain",Xr.domain),eo,getStructHash(Xr.types,Xr.primaryType,Xr.message)];return computeHashOnElements(to)},Signer=class{constructor(Xr=utils.randomPrivateKey()){this.pk=Xr instanceof Uint8Array?buf2hex(Xr):toHex(Xr)}async getPubKey(){return getStarkKey(this.pk)}async signMessage(Xr,eo){const to=getMessageHash(Xr,eo);return sign(to,this.pk)}async signTransaction(Xr,eo,to){if(to&&to.length!==Xr.length)throw new Error("ABI must be provided for each transaction or no transaction");const ro=getExecuteCalldata(Xr,eo.cairoVersion),no=calculateTransactionHash(eo.walletAddress,eo.version,ro,eo.maxFee,eo.chainId,eo.nonce);return sign(no,this.pk)}async signDeployAccountTransaction({classHash:Xr,contractAddress:eo,constructorCalldata:to,addressSalt:ro,maxFee:no,version:io,chainId:oo,nonce:ao}){const so=calculateDeployAccountTransactionHash(eo,Xr,CallData.compile(to),ro,io,no,oo,ao);return sign(so,this.pk)}async signDeclareTransaction({classHash:Xr,senderAddress:eo,chainId:to,maxFee:ro,version:no,nonce:io,compiledClassHash:oo}){const ao=calculateDeclareTransactionHash(Xr,eo,no,ro,to,io,oo);return sign(ao,this.pk)}};function parseUDCEvent(Xr){if(!Xr.events)throw new Error("UDC emitted event is empty");const eo=Xr.events.find(to=>cleanHex(to.from_address)===cleanHex(UDC.ADDRESS))||{data:[]};return{transaction_hash:Xr.transaction_hash,contract_address:eo.data[0],address:eo.data[0],deployer:eo.data[1],unique:eo.data[2],classHash:eo.data[3],calldata_len:eo.data[4],calldata:eo.data.slice(5,5+parseInt(eo.data[4],16)),salt:eo.data[eo.data.length-1]}}var Account=class extends Provider{constructor(Xr,eo,to,ro){super(Xr),this.deploySelf=this.deployAccount,this.address=eo.toLowerCase(),this.signer=typeof to=="string"||to instanceof Uint8Array?new Signer(to):to,ro&&(this.cairoVersion=ro.toString())}async getNonce(Xr){return super.getNonceForAddress(this.address,Xr)}async getNonceSafe(Xr){try{return toBigInt(Xr??await this.getNonce())}catch{return 0n}}async getCairoVersion(Xr){if(!this.cairoVersion){const{cairo:eo}=Xr?await super.getContractVersion(void 0,Xr):await super.getContractVersion(this.address);this.cairoVersion=eo}return this.cairoVersion}async estimateFee(Xr,eo){return this.estimateInvokeFee(Xr,eo)}async estimateInvokeFee(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro}={}){const no=Array.isArray(Xr)?Xr:[Xr],io=toBigInt(eo??await this.getNonce()),oo=toBigInt(feeTransactionVersion),ao=await this.getChainId(),so={walletAddress:this.address,nonce:io,maxFee:ZERO,version:oo,chainId:ao,cairoVersion:await this.getCairoVersion()},co=await this.buildInvocation(no,so),lo=await super.getInvokeEstimateFee({...co},{version:oo,nonce:io},to,ro),fo=estimatedFeeToMaxFee(lo.overall_fee);return{...lo,suggestedMaxFee:fo}}async estimateDeclareFee({contract:Xr,classHash:eo,casm:to,compiledClassHash:ro},{blockIdentifier:no,nonce:io,skipValidate:oo}={}){const ao=toBigInt(io??await this.getNonce()),so=isSierra(Xr)?feeTransactionVersion_2:feeTransactionVersion,co=await this.getChainId(),lo=await this.buildDeclarePayload({classHash:eo,contract:Xr,casm:to,compiledClassHash:ro},{nonce:ao,chainId:co,version:so,walletAddress:this.address,maxFee:ZERO,cairoVersion:void 0}),fo=await super.getDeclareEstimateFee(lo,{version:so,nonce:ao},no,oo),ho=estimatedFeeToMaxFee(fo.overall_fee);return{...fo,suggestedMaxFee:ho}}async estimateAccountDeployFee({classHash:Xr,addressSalt:eo=0,constructorCalldata:to=[],contractAddress:ro},{blockIdentifier:no,skipValidate:io}={}){const oo=toBigInt(feeTransactionVersion),ao=ZERO,so=await this.getChainId(),co=await this.buildAccountDeployPayload({classHash:Xr,addressSalt:eo,constructorCalldata:to,contractAddress:ro},{nonce:ao,chainId:so,version:oo,walletAddress:this.address,maxFee:ZERO,cairoVersion:void 0}),lo=await super.getDeployAccountEstimateFee({...co},{version:oo,nonce:ao},no,io),fo=estimatedFeeToMaxFee(lo.overall_fee);return{...lo,suggestedMaxFee:fo}}async estimateDeployFee(Xr,eo){const to=this.buildUDCContractPayload(Xr);return this.estimateInvokeFee(to,eo)}async estimateFeeBulk(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro}={}){const no=await this.accountInvocationsFactory(Xr,{versions:[feeTransactionVersion,feeTransactionVersion_2],nonce:eo,blockIdentifier:to}),io=await super.getEstimateFeeBulk(no,{blockIdentifier:to,skipValidate:ro});return[].concat(io).map(oo=>{const ao=estimatedFeeToMaxFee(oo.overall_fee);return{...oo,suggestedMaxFee:ao}})}async buildInvocation(Xr,eo){const to=getExecuteCalldata(Xr,await this.getCairoVersion()),ro=await this.signer.signTransaction(Xr,eo);return{contractAddress:this.address,calldata:to,signature:ro}}async execute(Xr,eo=void 0,to={}){const ro=Array.isArray(Xr)?Xr:[Xr],no=toBigInt(to.nonce??await this.getNonce()),io=to.maxFee??await this.getSuggestedMaxFee({type:"INVOKE_FUNCTION",payload:Xr},to),oo=toBigInt(transactionVersion),ao=await this.getChainId(),so={walletAddress:this.address,nonce:no,maxFee:io,version:oo,chainId:ao,cairoVersion:await this.getCairoVersion()},co=await this.signer.signTransaction(ro,so,eo),lo=getExecuteCalldata(ro,await this.getCairoVersion());return this.invokeFunction({contractAddress:this.address,calldata:lo,signature:co},{nonce:no,maxFee:io,version:oo})}async declareIfNot(Xr,eo={}){const to=extractContractHashes(Xr);try{await this.getClassByHash(to.classHash)}catch{return this.declare(Xr,eo)}return{transaction_hash:"",class_hash:to.classHash}}async declare(Xr,eo={}){const to=extractContractHashes(Xr),ro={};ro.nonce=toBigInt(eo.nonce??await this.getNonce()),ro.maxFee=eo.maxFee??await this.getSuggestedMaxFee({type:"DECLARE",payload:to},eo),ro.version=isSierra(Xr.contract)?transactionVersion_2:transactionVersion,ro.chainId=await this.getChainId();const no=await this.buildDeclarePayload(to,{...ro,walletAddress:this.address,cairoVersion:void 0});return this.declareContract(no,ro)}async deploy(Xr,eo){const to=[].concat(Xr).map(oo=>{const{classHash:ao,salt:so,unique:co=!0,constructorCalldata:lo=[]}=oo,fo=CallData.compile(lo),ho=so??randomAddress();return{call:{contractAddress:UDC.ADDRESS,entrypoint:UDC.ENTRYPOINT,calldata:[ao,ho,toCairoBool(co),fo.length,...fo]},address:calculateContractAddressFromHash(co?pedersen(this.address,ho):ho,ao,fo,co?UDC.ADDRESS:0)}}),ro=to.map(oo=>oo.call),no=to.map(oo=>oo.address);return{...await this.execute(ro,void 0,eo),contract_address:no}}async deployContract(Xr,eo){const to=await this.deploy(Xr,eo),ro=await this.waitForTransaction(to.transaction_hash);return parseUDCEvent(ro)}async declareAndDeploy(Xr,eo){const{constructorCalldata:to,salt:ro,unique:no}=Xr;let io=await this.declareIfNot(Xr,eo);if(io.transaction_hash!==""){const ao=await this.waitForTransaction(io.transaction_hash);io={...io,...ao}}const oo=await this.deployContract({classHash:io.class_hash,salt:ro,unique:no,constructorCalldata:to},eo);return{declare:{...io},deploy:oo}}async deployAccount({classHash:Xr,constructorCalldata:eo=[],addressSalt:to=0,contractAddress:ro},no={}){const io=toBigInt(transactionVersion),oo=ZERO,ao=await this.getChainId(),so=CallData.compile(eo),co=ro??calculateContractAddressFromHash(to,Xr,so,0),lo=no.maxFee??await this.getSuggestedMaxFee({type:"DEPLOY_ACCOUNT",payload:{classHash:Xr,constructorCalldata:so,addressSalt:to,contractAddress:co}},no),fo=await this.signer.signDeployAccountTransaction({classHash:Xr,constructorCalldata:so,contractAddress:co,addressSalt:to,chainId:ao,maxFee:lo,version:io,nonce:oo});return this.deployAccountContract({classHash:Xr,addressSalt:to,constructorCalldata:eo,signature:fo},{nonce:oo,maxFee:lo,version:io})}async signMessage(Xr){return this.signer.signMessage(Xr,this.address)}async hashMessage(Xr){return getMessageHash(Xr,this.address)}async verifyMessageHash(Xr,eo){try{return await this.callContract({contractAddress:this.address,entrypoint:"isValidSignature",calldata:CallData.compile({hash:toBigInt(Xr).toString(),signature:formatSignature(eo)})}),!0}catch{return!1}}async verifyMessage(Xr,eo){const to=await this.hashMessage(Xr);return this.verifyMessageHash(to,eo)}async getSuggestedMaxFee({type:Xr,payload:eo},to){let ro;switch(Xr){case"INVOKE_FUNCTION":ro=await this.estimateInvokeFee(eo,to);break;case"DECLARE":ro=await this.estimateDeclareFee(eo,to);break;case"DEPLOY_ACCOUNT":ro=await this.estimateAccountDeployFee(eo,to);break;case"DEPLOY":ro=await this.estimateDeployFee(eo,to);break;default:ro={suggestedMaxFee:ZERO,overall_fee:ZERO};break}return ro.suggestedMaxFee}async buildDeclarePayload(Xr,{nonce:eo,chainId:to,version:ro,walletAddress:no,maxFee:io}){const{classHash:oo,contract:ao,compiledClassHash:so}=extractContractHashes(Xr),co=parseContract(ao),lo=await this.signer.signDeclareTransaction({classHash:oo,compiledClassHash:so,senderAddress:no,chainId:to,maxFee:io,version:ro,nonce:eo});return{senderAddress:no,signature:lo,contract:co,compiledClassHash:so}}async buildAccountDeployPayload({classHash:Xr,addressSalt:eo=0,constructorCalldata:to=[],contractAddress:ro},{nonce:no,chainId:io,version:oo,maxFee:ao}){const so=CallData.compile(to),co=ro??calculateContractAddressFromHash(eo,Xr,so,0),lo=await this.signer.signDeployAccountTransaction({classHash:Xr,contractAddress:co,chainId:io,maxFee:ao,version:oo,nonce:no,addressSalt:eo,constructorCalldata:so});return{classHash:Xr,addressSalt:eo,constructorCalldata:so,signature:lo}}buildUDCContractPayload(Xr){return[].concat(Xr).map(to=>{const{classHash:ro,salt:no="0",unique:io=!0,constructorCalldata:oo=[]}=to,ao=CallData.compile(oo);return{contractAddress:UDC.ADDRESS,entrypoint:UDC.ENTRYPOINT,calldata:[ro,no,toCairoBool(io),ao.length,...ao]}})}async simulateTransaction(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro,skipExecute:no}={}){const io=await this.accountInvocationsFactory(Xr,{versions:[transactionVersion,transactionVersion_2],nonce:eo,blockIdentifier:to});return super.getSimulateTransaction(io,{blockIdentifier:to,skipValidate:ro,skipExecute:no})}async accountInvocationsFactory(Xr,{versions:eo,nonce:to,blockIdentifier:ro}){const no=eo[0],io=await this.getNonceSafe(to),oo=await this.getChainId(),ao="payload"in Xr[0]?Xr[0].payload:Xr[0],so=Xr[0].type==="DEPLOY_ACCOUNT"?await this.getCairoVersion(ao.classHash):await this.getCairoVersion();return Promise.all([].concat(Xr).map(async(co,lo)=>{const fo="payload"in co?co.payload:co,ho={walletAddress:this.address,nonce:toBigInt(Number(io)+lo),maxFee:ZERO,version:no,chainId:oo,cairoVersion:so},go={type:co.type,version:no,nonce:toBigInt(Number(io)+lo),blockIdentifier:ro};if(co.type==="INVOKE_FUNCTION"){const yo=await this.buildInvocation([].concat(fo),ho);return{...go,...yo}}if(co.type==="DECLARE"){ho.version=isSierra(fo.contract)?toBigInt(eo[1]):toBigInt(eo[0]);const yo=await this.buildDeclarePayload(fo,ho);return{...go,...yo,version:ho.version}}if(co.type==="DEPLOY_ACCOUNT"){const yo=await this.buildAccountDeployPayload(fo,ho);return{...go,...yo}}if(co.type==="DEPLOY"){const yo=this.buildUDCContractPayload(fo),vo=await this.buildInvocation(yo,ho);return{...go,...vo,type:"INVOKE_FUNCTION"}}throw Error(`accountInvocationsFactory: unsupported transaction type: ${co}`)}))}async getStarkName(Xr=this.address,eo){return super.getStarkName(Xr,eo)}},defaultProvider=new Provider({rpc:{default:!0}}),events_exports={};__export(events_exports,{getAbiEvents:()=>getAbiEvents,parseEvents:()=>parseEvents});function getAbiEvents(Xr){return Xr.filter(eo=>eo.type==="event"&&(eo.size||eo.kind!=="enum")).reduce((eo,to)=>{const ro=to.name.slice(to.name.lastIndexOf(":")+1),no={...to};return no.name=ro,{...eo,[addHexPrefix(keccak(utf8ToArray(ro)).toString(16))]:no}},{})}function parseEvents(Xr,eo,to,ro){return Xr.flat().reduce((io,oo)=>{var go,yo;const ao=eo[oo.keys[0]];if(!ao)return io;const so={};so[ao.name]={},oo.keys.shift();const co=oo.keys[Symbol.iterator](),lo=oo.data[Symbol.iterator](),fo=((go=ao.members)==null?void 0:go.filter(vo=>vo.kind==="key"))||ao.keys,ho=((yo=ao.members)==null?void 0:yo.filter(vo=>vo.kind==="data"))||ao.data;return fo.forEach(vo=>{so[ao.name][vo.name]=responseParser(co,vo,to,ro,so[ao.name])}),ho.forEach(vo=>{so[ao.name][vo.name]=responseParser(lo,vo,to,ro,so[ao.name])}),io.push(so),io},[])}var splitArgsAndOptions=Xr=>{const eo=["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"],to=Xr[Xr.length-1];return typeof to=="object"&&eo.some(ro=>ro in to)?{args:Xr,options:Xr.pop()}:{args:Xr}};function buildCall(Xr,eo){return async function(...to){const ro=splitArgsAndOptions(to);return Xr.call(eo.name,ro.args,{parseRequest:!0,parseResponse:!0,...ro.options})}}function buildInvoke(Xr,eo){return async function(...to){const ro=splitArgsAndOptions(to);return Xr.invoke(eo.name,ro.args,{parseRequest:!0,...ro.options})}}function buildDefault(Xr,eo){return eo.stateMutability==="view"||eo.state_mutability==="view"?buildCall(Xr,eo):buildInvoke(Xr,eo)}function buildPopulate(Xr,eo){return function(...to){return Xr.populate(eo.name,to)}}function buildEstimate(Xr,eo){return function(...to){return Xr.estimate(eo.name,to)}}function getCalldata(Xr,eo){return Array.isArray(Xr)&&"__compiled__"in Xr?Xr:Array.isArray(Xr)&&Array.isArray(Xr[0])&&"__compiled__"in Xr[0]?Xr[0]:eo()}var Contract=class{constructor(Xr,eo,to=defaultProvider){this.address=eo&&eo.toLowerCase(),this.providerOrAccount=to,this.callData=new CallData(Xr),this.structs=CallData.getAbiStruct(Xr),this.events=getAbiEvents(Xr);const ro=createAbiParser(Xr);this.abi=ro.getLegacyFormat();const no={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach(io=>{if(io.type!=="function")return;const oo=io.name;this[oo]||Object.defineProperty(this,oo,{...no,value:buildDefault(this,io)}),this.functions[oo]||Object.defineProperty(this.functions,oo,{...no,value:buildDefault(this,io)}),this.callStatic[oo]||Object.defineProperty(this.callStatic,oo,{...no,value:buildCall(this,io)}),this.populateTransaction[oo]||Object.defineProperty(this.populateTransaction,oo,{...no,value:buildPopulate(this,io)}),this.estimateFee[oo]||Object.defineProperty(this.estimateFee,oo,{...no,value:buildEstimate(this,io)})})}attach(Xr){this.address=Xr}connect(Xr){this.providerOrAccount=Xr}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(Xr,eo=[],{parseRequest:to=!0,parseResponse:ro=!0,formatResponse:no=void 0,blockIdentifier:io=void 0}={}){assert$2(this.address!==null,"contract is not connected to an address");const oo=getCalldata(eo,()=>to?(this.callData.validate("CALL",Xr,eo),this.callData.compile(Xr,eo)):(console.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),eo));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:oo,entrypoint:Xr},io).then(ao=>ro?no?this.callData.format(Xr,ao.result,no):this.callData.parse(Xr,ao.result):ao.result)}invoke(Xr,eo=[],{parseRequest:to=!0,maxFee:ro,nonce:no,signature:io}={}){assert$2(this.address!==null,"contract is not connected to an address");const oo=getCalldata(eo,()=>to?(this.callData.validate("INVOKE",Xr,eo),this.callData.compile(Xr,eo)):(console.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),eo)),ao={contractAddress:this.address,calldata:oo,entrypoint:Xr};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(ao,void 0,{maxFee:ro,nonce:no});if(!no)throw new Error("Nonce is required when invoking a function without an account");return console.warn(`Invoking ${Xr} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...ao,signature:io},{nonce:no})}async estimate(Xr,eo=[]){assert$2(this.address!==null,"contract is not connected to an address"),getCalldata(eo,()=>!1)||this.callData.validate("INVOKE",Xr,eo);const to=this.populate(Xr,eo);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(to);throw Error("Contract must be connected to the account contract to estimate")}populate(Xr,eo=[]){const to=getCalldata(eo,()=>this.callData.compile(Xr,eo));return{contractAddress:this.address,entrypoint:Xr,calldata:to}}parseEvents(Xr){var eo;return parseEvents(((eo=Xr.events)==null?void 0:eo.filter(to=>cleanHex(to.from_address)===cleanHex(this.address),[]))||[],this.events,this.structs,CallData.getAbiEnum(this.abi))}isCairo1(){return cairo_exports.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typed(Xr){return this}};const ETH_STARKNET_ADDRESS="0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";var ETH_CONTRACT_ABI=[{members:[{name:"low",offset:0,type:"felt"},{name:"high",offset:1,type:"felt"}],name:"Uint256",size:2,type:"struct"},{data:[{name:"from_",type:"felt"},{name:"to",type:"felt"},{name:"value",type:"Uint256"}],keys:[],name:"Transfer",type:"event"},{data:[{name:"owner",type:"felt"},{name:"spender",type:"felt"},{name:"value",type:"Uint256"}],keys:[],name:"Approval",type:"event"},{inputs:[],name:"name",outputs:[{name:"name",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{name:"symbol",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{name:"totalSupply",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"decimals",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"felt"}],name:"balanceOf",outputs:[{name:"balance",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"felt"},{name:"spender",type:"felt"}],name:"allowance",outputs:[{name:"remaining",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"permittedMinter",outputs:[{name:"minter",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialized",outputs:[{name:"res",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"get_version",outputs:[{name:"version",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"get_identity",outputs:[{name:"identity",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[{name:"init_vector_len",type:"felt"},{name:"init_vector",type:"felt*"}],name:"initialize",outputs:[],type:"function"},{inputs:[{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"transfer",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"sender",type:"felt"},{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"transferFrom",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"amount",type:"Uint256"}],name:"approve",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"added_value",type:"Uint256"}],name:"increaseAllowance",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"subtracted_value",type:"Uint256"}],name:"decreaseAllowance",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"permissionedMint",outputs:[],type:"function"},{inputs:[{name:"account",type:"felt"},{name:"amount",type:"Uint256"}],name:"permissionedBurn",outputs:[],type:"function"}];const defaultTypedData={primaryType:"Message",types:{Message:[{name:"message",type:"felt"}],StarkNetDomain:[{name:"name",type:"felt"},{name:"chainId",type:"felt"},{name:"version",type:"felt"}]}},formatTypedDataMessage=(Xr,eo=constants_exports.NetworkName.SN_MAIN)=>{let to,ro;try{const{nonce:io,domain:oo}=JSON.parse(Xr);to=io,ro=oo}catch{to=Xr,ro="domain"}const no={message:to.substring(0,31)};return Object.assign(Object.assign({},defaultTypedData),{domain:{chainId:eo,name:ro.substring(0,31),version:"0.0.1"},message:no})};class StarknetWallet extends Wallet$1{getWalletAccount(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this._connector.getWalletAccount();if(!eo)throw new Error("unable to retrieve Starknet wallet account");return wrapMethodWithCallback(eo,"signMessage",(to,ro)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro)})),eo})}getProvider(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this._connector.getProvider();if(!eo)throw new Error("unable to retrieve Starknet provider");return wrapMethodWithCallback(eo,"callContract",(to,ro,no)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro,no)})),wrapMethodWithCallback(eo,"deployAccountContract",(to,ro,no)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro,no)})),eo})}}const ACCOUNT_CHANGED_EVENT_LISTENER="accountsChanged",NETWORK_CHANGED_EVENT_LISTENER="networkChanged";class StarknetWalletConnector extends WalletConnectorBase{constructor(eo,to,ro){var no;super(ro),this.STARKNET_VERSION="v5",this.ChainWallet=StarknetWallet,this.connectedChain="STARK",this.supportedChains=["STARK"],this.switchNetworkOnlyFromWallet=!0,this.canSetEventListeners=!0,this.name=eo,this.windowKey=to,this.starknetNetworks=ro.starknetNetworks,this.chainRpcProviders=ro.chainRpcProviders,(no=this.chainRpcProviders)===null||no===void 0||no.registerStarknetProviders()}get walletBookWallet(){return this.walletBook.wallets[this.key]}isProviderConnected(){var eo;const to=this.getWallet();return(eo=to==null?void 0:to.isConnected)!==null&&eo!==void 0?eo:!1}getPublicClient(){return __awaiter(this,void 0,void 0,function*(){var eo;if(this.starknetNetworks===void 0||this.starknetNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:void 0,starknet:this.starknetNetworks},ro=yield this.getNetwork(),no=(eo=this.chainRpcProviders)===null||eo===void 0?void 0:eo.getStarknetRpcProviderByChainId(to,ro);return no==null?void 0:no.provider})}getNetwork(){return __awaiter(this,void 0,void 0,function*(){var eo;const to=this.getWallet();return to?(this.isProviderConnected()||(yield to.enable({starknetVersion:this.STARKNET_VERSION})),Promise.resolve((eo=to.provider)===null||eo===void 0?void 0:eo.getChainId())):Promise.resolve(void 0)})}connect(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();try{eo&&!this.isProviderConnected()&&(yield eo.enable({starknetVersion:this.STARKNET_VERSION}),localStorage.setItem("dynamic_should_have_wallet","true"))}catch(to){logger$9.error(to)}})}getAddress(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();if(!this.isInstalledOnBrowser()&&isMobile$1()&&this.walletBookWallet.mobile&&this.walletBookWallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const ro=template$1(this.walletBookWallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(ro)}return eo&&!this.isProviderConnected()&&(yield eo==null?void 0:eo.isPreauthorized(),yield this.connect()),Promise.resolve(eo==null?void 0:eo.selectedAddress)})}getWalletAccount(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();return eo==null?void 0:eo.account})}getProvider(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this.getWallet();return eo==null?void 0:eo.provider})}signMessage(eo){return __awaiter(this,void 0,void 0,function*(){const to=yield this.getAddress(),ro=this.getWallet();if(!to||!ro){logger$9.error("Could not fetch wallet address for signing message");return}const no=formatTypedDataMessage(eo,yield ro.provider.getChainId()),io=yield ro.account.signMessage(no);return io==null?void 0:io.join(",")})}getBalance(eo){return __awaiter(this,void 0,void 0,function*(){const to=yield this.getProvider();if(!to){logger$9.error("Could not find provider for getting balance");return}const ro=new Contract(ETH_CONTRACT_ABI,ETH_STARKNET_ADDRESS,to);try{const{balance:no}=yield ro.balanceOf(eo);return(Number(cairo_exports.uint256(no.low).low)/1e18).toFixed(6)}catch(no){throw logger$9.error(no),new DynamicError("Something went wrong")}})}endSession(){return __awaiter(this,void 0,void 0,function*(){localStorage.removeItem("dynamic_should_have_wallet"),W$3().disconnect({clearLastWallet:!0})})}getWallet(){let eo=window[`starknet_${this.windowKey}`];if(eo!==void 0)return eo;if(eo=window.starknet,(eo==null?void 0:eo.name)===this.name)return eo}isInstalledOnBrowser(){return this.getWallet()!==void 0}getConnectedAccounts(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();if(!eo)return[];try{yield this.reconnectIfNeeded(eo)}catch{return[]}return retryableFn(()=>eo.selectedAddress?Promise.resolve([eo.selectedAddress]):Promise.reject(),{fallbackValue:[],retryIntervalMs:100,retryStrategy:"timeout-and-rejection"})})}reconnectIfNeeded(eo){return __awaiter(this,void 0,void 0,function*(){if(!this.isProviderConnected()&&(yield eo.isPreauthorized()))if(localStorage.getItem("dynamic_should_have_wallet")==="true")try{yield retryableFn(this.connect.bind(this),{maxRetries:0,retryStrategy:"timeout-only",timeoutMs:1e3})}catch{throw localStorage.removeItem("dynamic_should_have_wallet"),new Error("Could not reconnect")}else yield this.connect()})}setupEventListeners(){if(!this.canSetEventListeners)return;const eo=this.getWallet();if(!eo)return logger$9.error("Wallet has not been found");this.handleAccountChange=to=>__awaiter(this,void 0,void 0,function*(){if(!to){this.emit("disconnect");return}to.toString()&&this.emit("accountChange",{accounts:[to.toString()]})}),this.handleNetworkChange=to=>__awaiter(this,void 0,void 0,function*(){if(!to){this.emit("disconnect");return}const ro=this.mapNetworkNameToChainId(to.toString());ro&&this.emit("chainChange",{chain:ro})}),eo==null||eo.on(ACCOUNT_CHANGED_EVENT_LISTENER,this.handleAccountChange),eo==null||eo.on(NETWORK_CHANGED_EVENT_LISTENER,this.handleNetworkChange)}teardownEventListeners(){return __awaiter(this,void 0,void 0,function*(){if(!this.canSetEventListeners)return;const eo=this.getWallet();this.handleAccountChange&&(eo==null||eo.off(ACCOUNT_CHANGED_EVENT_LISTENER,this.handleAccountChange),this.handleAccountChange=void 0),this.handleNetworkChange&&(eo==null||eo.off(NETWORK_CHANGED_EVENT_LISTENER,this.handleNetworkChange),this.handleNetworkChange=void 0)})}mapNetworkNameToChainId(eo){if(eo===constants_exports.NetworkName.SN_MAIN||eo.includes("mainnet")||eo===constants_exports.StarknetChainId.SN_MAIN)return constants_exports.StarknetChainId.SN_MAIN;if(eo===constants_exports.NetworkName.SN_GOERLI||eo.includes("goerli")||eo===constants_exports.StarknetChainId.SN_GOERLI)return constants_exports.StarknetChainId.SN_GOERLI;if(eo===constants_exports.NetworkName.SN_SEPOLIA||eo.includes("sepolia")||eo===constants_exports.StarknetChainId.SN_SEPOLIA)return constants_exports.StarknetChainId.SN_SEPOLIA;logger$9.error("Unknown networkName",eo)}mapChainIdToNetworkName(eo){if(eo===constants_exports.StarknetChainId.SN_MAIN||eo===constants_exports.NetworkName.SN_MAIN)return constants_exports.NetworkName.SN_MAIN;if(eo===constants_exports.StarknetChainId.SN_GOERLI||eo===constants_exports.NetworkName.SN_GOERLI)return constants_exports.NetworkName.SN_GOERLI;if(eo===constants_exports.StarknetChainId.SN_SEPOLIA||eo===constants_exports.NetworkName.SN_SEPOLIA)return constants_exports.NetworkName.SN_SEPOLIA;logger$9.error("Unknown chainId",eo)}}class ArgentX extends StarknetWalletConnector{constructor(eo){super("Argent X","argentX",eo),this.overrideKey="argentx"}getConnectedAccounts(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this.getAddress();return eo?[eo]:[]})}}class Braavos extends StarknetWalletConnector{constructor(eo){super("Braavos","braavos",eo),this.overrideKey="braavos"}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);const ro=`starknet://dapp/${window.location.toString().replace(/http(s)?:\/\//,"")}`;return isMobile$1()&&window.location.assign(ro),Promise.resolve(void 0)})}}var x=Object.defineProperty,O$3=(Xr,eo,to)=>eo in Xr?x(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,h$1=(Xr,eo,to)=>(O$3(Xr,typeof eo!="symbol"?eo+"":eo,to),to);let P$1=class extends Error{constructor(){super(...arguments),h$1(this,"name","ConnectorNotConnectedError"),h$1(this,"message","Connector not connected")}},U$2=class extends Error{constructor(){super(...arguments),h$1(this,"name","ConnectorNotFoundError"),h$1(this,"message","Connector not found")}},A$2=class extends Error{constructor(){super(...arguments),h$1(this,"name","UserRejectedRequestError"),h$1(this,"message","User rejected request")}},S$1=class extends Error{constructor(){super(...arguments),h$1(this,"name","UserNotConnectedError"),h$1(this,"message","User not connected")}};var F$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{};function L$3(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}function R$2(Xr){if(Xr.__esModule)return Xr;var eo=Xr.default;if(typeof eo=="function"){var to=function ro(){if(this instanceof ro){var no=[null];no.push.apply(no,arguments);var io=Function.bind.apply(eo,no);return new io}return eo.apply(this,arguments)};to.prototype=eo.prototype}else to={};return Object.defineProperty(to,"__esModule",{value:!0}),Object.keys(Xr).forEach(function(ro){var no=Object.getOwnPropertyDescriptor(Xr,ro);Object.defineProperty(to,ro,no.get?no:{enumerable:!0,get:function(){return Xr[ro]}})}),to}var C$2={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,fo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,fo||so,ho),yo=to?to+co:co;return so._events[yo]?so._events[yo].fn?so._events[yo]=[so._events[yo],go]:so._events[yo].push(go):(so._events[yo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var so=[],co,lo;if(this._eventsCount===0)return so;for(lo in co=this._events)eo.call(co,lo)&&so.push(to?lo.slice(1):lo);return Object.getOwnPropertySymbols?so.concat(Object.getOwnPropertySymbols(co)):so},ao.prototype.listeners=function(so){var co=to?to+so:so,lo=this._events[co];if(!lo)return[];if(lo.fn)return[lo.fn];for(var fo=0,ho=lo.length,go=new Array(ho);fo{localStorage.setItem("starknetLastConnectedWallet",Xr)},q$2=()=>{localStorage.removeItem("starknetLastConnectedWallet")},a={mainnet:"https://starknet-mainnet.public.blastapi.io",testnet:"https://starknet-testnet.public.blastapi.io"},e={mainnet:"https://rpc.starknet.lava.build",testnet:"https://rpc.starknet-testnet.lava.build"},t=[a,e];function s(){const Xr=Math.floor(Math.random()*t.length);return t[Xr]}var define_globalThis_process_env_default={},en=Object.defineProperty,tn=(Xr,eo,to)=>eo in Xr?en(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,ie$1=(Xr,eo,to)=>(tn(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const sr$1="https://web.argent.xyz",$t$1=`({element:ro[io],type:no.type??no}))}function parseUint256(Xr){if(typeof Xr=="object"){const{low:to,high:ro}=Xr;return[felt(to),felt(ro)]}const eo=uint256(Xr);return[felt(eo.low),felt(eo.high)]}function parseCalldataValue(Xr,eo,to,ro){if(Xr===void 0)throw Error(`Missing parameter for type ${eo}`);if(Array.isArray(Xr)){const no=[];no.push(felt(Xr.length));const io=getArrayType(eo);return Xr.reduce((oo,ao)=>oo.concat(parseCalldataValue(ao,io,to,ro)),no)}if(to[eo]&&to[eo].members.length){if(isTypeUint256(eo))return parseUint256(Xr);if(eo==="core::starknet::eth_address::EthAddress")return parseBaseTypes(eo,Xr);const{members:no}=to[eo],io=Xr;return no.reduce((oo,ao)=>oo.concat(parseCalldataValue(io[ao.name],ao.type,to,ro)),[])}if(isTypeTuple(eo))return parseTuple(Xr,eo).reduce((io,oo)=>{const ao=parseCalldataValue(oo.element,oo.type,to,ro);return io.concat(ao)},[]);if(isTypeUint256(eo))return parseUint256(Xr);if(isTypeEnum(eo,ro)){const{variants:no}=ro[eo];if(isTypeOption(eo)){const uo=Xr;if(uo.isSome()){const ho=no.find(wo=>wo.name==="Some");if(typeof ho>"u")throw Error("Error in abi : Option has no 'Some' variant.");const go=ho.type;if(go==="()")return"0";const bo=parseCalldataValue(uo.unwrap(),go,to,ro);return Array.isArray(bo)?["0",...bo]:["0",bo]}return"1"}if(isTypeResult(eo)){const uo=Xr;if(uo.isOk()){const wo=no.find(Co=>Co.name==="Ok");if(typeof wo>"u")throw Error("Error in abi : Result has no 'Ok' variant.");const Eo=wo.type;if(Eo==="()")return"0";const $o=parseCalldataValue(uo.unwrap(),Eo,to,ro);return Array.isArray($o)?["0",...$o]:["0",$o]}const ho=no.find(wo=>wo.name==="Err");if(typeof ho>"u")throw Error("Error in abi : Result has no 'Err' variant.");const go=ho.type;if(go==="()")return"1";const bo=parseCalldataValue(uo.unwrap(),go,to,ro);return Array.isArray(bo)?["1",...bo]:["1",bo]}const io=Xr,oo=io.activeVariant(),ao=no.find(uo=>uo.name===oo);if(typeof ao>"u")throw Error(`Not find in abi : Enum has no '${oo}' variant.`);const so=ao.type,co=no.findIndex(uo=>uo.name===oo);if(so==="()")return co.toString();const lo=parseCalldataValue(io.unwrap(),so,to,ro);return Array.isArray(lo)?[co.toString(),...lo]:[co.toString(),lo]}if(typeof Xr=="object")throw Error(`Parameter ${Xr} do not align with abi parameter ${eo}`);return parseBaseTypes(eo,Xr)}function parseCalldataField(Xr,eo,to,ro){const{name:no,type:io}=eo;let{value:oo}=Xr.next();switch(!0){case isTypeArray(io):if(!Array.isArray(oo)&&!isText(oo))throw Error(`ABI expected parameter ${no} to be array or long string, got ${oo}`);return typeof oo=="string"&&(oo=splitLongString(oo)),parseCalldataValue(oo,eo.type,to,ro);case io==="core::starknet::eth_address::EthAddress":return parseBaseTypes(io,oo);case(isTypeStruct(io,to)||isTypeTuple(io)||isTypeUint256(io)):return parseCalldataValue(oo,io,to,ro);case isTypeEnum(io,ro):return parseCalldataValue(oo,io,to,ro);default:return parseBaseTypes(io,oo)}}function parseBaseTypes2(Xr,eo){let to;switch(!0){case isTypeBool(Xr):return to=eo.next().value,!!BigInt(to);case isTypeUint256(Xr):const ro=eo.next().value,no=eo.next().value;return uint256ToBN({low:ro,high:no});case Xr==="core::starknet::eth_address::EthAddress":return to=eo.next().value,BigInt(to);default:return to=eo.next().value,BigInt(to)}}function parseResponseValue(Xr,eo,to,ro){if(eo.type==="()")return{};if(isTypeUint256(eo.type)){const no=Xr.next().value,io=Xr.next().value;return uint256ToBN({low:no,high:io})}if(isTypeArray(eo.type)){const no=[],io={name:"",type:getArrayType(eo.type)},oo=BigInt(Xr.next().value);for(;no.length(no[io.name]=parseResponseValue(Xr,io,to,ro),no),{});if(ro&&eo.type in ro&&ro[eo.type]){const no=Number(Xr.next().value),io=ro[eo.type].variants.reduce((ao,so,co)=>co===no?(ao[so.name]=parseResponseValue(Xr,{name:"",type:so.type},to,ro),ao):(ao[so.name]=void 0,ao),{});if(eo.type.startsWith("core::option::Option")){const ao=no===0?io.Some:void 0;return new CairoOption(no,ao)}if(eo.type.startsWith("core::result::Result")){let ao;return no===0?ao=io.Ok:ao=io.Err,new CairoResult(no,ao)}return new CairoCustomEnum(io)}if(isTypeTuple(eo.type))return extractTupleMemberTypes(eo.type).reduce((io,oo,ao)=>{const so=oo!=null&&oo.name?oo.name:ao,co=oo!=null&&oo.type?oo.type:oo,lo={name:so,type:co};return io[so]=parseResponseValue(Xr,lo,to,ro),io},{});if(isTypeArray(eo.type)){const no=[],io={name:"",type:getArrayType(eo.type)},oo=BigInt(Xr.next().value);for(;no.length{if(assert$2(typeof Xr=="string"||typeof Xr=="number"||typeof Xr=="bigint",`Validate: arg ${eo.name} should be a felt typed as (String, Number or BigInt)`),typeof Xr=="string"&&!isHex(Xr))return;const to=BigInt(Xr.toString(10));assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`)},validateUint=(Xr,eo)=>{typeof Xr=="number"&&assert$2(Xr<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is to large to be typed as Number use (BigInt or String)"),assert$2(typeof Xr=="string"||typeof Xr=="number"||typeof Xr=="bigint"||typeof Xr=="object"&&"low"in Xr&&"high"in Xr,`Validate: arg ${eo.name} of cairo type ${eo.type} should be type (String, Number or BigInt), but is ${typeof Xr} ${Xr}.`);const to=typeof Xr=="object"?uint256ToBN(Xr):toBigInt(Xr);switch(eo.type){case"core::integer::u8":assert$2(to>=0n&&to<=255n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0 - 255]`);break;case"core::integer::u16":assert$2(to>=0n&&to<=65535n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 65535]`);break;case"core::integer::u32":assert$2(to>=0n&&to<=4294967295n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 4294967295]`);break;case"core::integer::u64":assert$2(to>=0n&&to<=2n**64n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^64-1]`);break;case"core::integer::u128":assert$2(to>=0n&&to<=2n**128n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^128-1]`);break;case"core::integer::u256":assert$2(to>=0n&&to<=2n**256n-1n,`Validate: arg ${eo.name} is ${eo.type} 0 - 2^256-1`);break;case"core::starknet::class_hash::ClassHash":assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`);break;case"core::starknet::contract_address::ContractAddress":assert$2(to>=0n&&to<=2n**252n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^252-1]`);break}},validateBool=(Xr,eo)=>{assert$2(typeof Xr=="boolean",`Validate: arg ${eo.name} of cairo type ${eo.type} should be type (Boolean)`)},validateStruct=(Xr,eo,to)=>{if(eo.type==="core::integer::u256"){validateUint(Xr,eo);return}if(eo.type==="core::starknet::eth_address::EthAddress"){assert$2(typeof Xr!="object",`EthAddress type is waiting a BigNumberish. Got ${Xr}`);const ro=BigInt(Xr.toString(10));assert$2(ro>=0n&&ro<=2n**160n-1n,`Validate: arg ${eo.name} cairo typed ${eo.type} should be in range [0, 2^160-1]`);return}assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} is cairo type struct (${eo.type}), and should be defined as js object (not array)`),to[eo.type].members.forEach(({name:ro})=>{assert$2(Object.keys(Xr).includes(ro),`Validate: arg ${eo.name} should have a property ${ro}`)})},validateEnum=(Xr,eo)=>{assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} is cairo type Enum (${eo.type}), and should be defined as js object (not array)`);const to=Object.getOwnPropertyNames(Object.getPrototypeOf(Xr)),ro=[...Object.getOwnPropertyNames(Xr),...to];if(!(isTypeOption(eo.type)&&ro.includes("isSome")&&ro.includes("isNone"))&&!(isTypeResult(eo.type)&&ro.includes("isOk")&&ro.includes("isErr"))&&!(ro.includes("variant")&&ro.includes("activeVariant")))throw new Error(`Validate Enum: argument ${eo.name}, type ${eo.type}, value received ${Xr}, is not an Enum.`)},validateTuple=(Xr,eo)=>{assert$2(typeof Xr=="object"&&!Array.isArray(Xr),`Validate: arg ${eo.name} should be a tuple (defined as object)`)},validateArray=(Xr,eo,to,ro)=>{const no=getArrayType(eo.type);if(!(isTypeFelt(no)&&isLongText(Xr)))switch(assert$2(Array.isArray(Xr),`Validate: arg ${eo.name} should be an Array`),!0){case isTypeFelt(no):Xr.forEach(io=>validateFelt(io,eo));break;case isTypeTuple(no):Xr.forEach(io=>validateTuple(io,{name:eo.name,type:no}));break;case isTypeArray(no):Xr.forEach(io=>validateArray(io,{name:"",type:no},to,ro));break;case isTypeStruct(no,to):Xr.forEach(io=>validateStruct(io,{name:eo.name,type:no},to));break;case isTypeEnum(no,ro):Xr.forEach(io=>validateEnum(io,{name:eo.name,type:no}));break;case(isTypeUint(no)||isTypeLitteral(no)):Xr.forEach(io=>validateUint(io,eo));break;case isTypeBool(no):Xr.forEach(io=>validateBool(io,eo));break;default:throw new Error(`Validate Unhandled: argument ${eo.name}, type ${eo.type}, value ${Xr}`)}};function validateFields(Xr,eo,to,ro){Xr.inputs.reduce((no,io)=>{const oo=eo[no];switch(!0){case isLen(io.name):return no;case isTypeFelt(io.type):validateFelt(oo,io);break;case(isTypeUint(io.type)||isTypeLitteral(io.type)):validateUint(oo,io);break;case isTypeBool(io.type):validateBool(oo,io);break;case isTypeArray(io.type):validateArray(oo,io,to,ro);break;case isTypeStruct(io.type,to):validateStruct(oo,io,to);break;case isTypeEnum(io.type,ro):validateEnum(oo,io);break;case isTypeTuple(io.type):validateTuple(oo,io);break;default:throw new Error(`Validate Unhandled: argument ${io.name}, type ${io.type}, value ${oo}`)}return no+1},0)}var CallData=class{constructor(Xr){this.structs=CallData.getAbiStruct(Xr),this.enums=CallData.getAbiEnum(Xr),this.parser=createAbiParser(Xr),this.abi=this.parser.getLegacyFormat()}validate(Xr,eo,to=[]){if(Xr!=="DEPLOY"){const io=this.abi.filter(oo=>{if(oo.type!=="function")return!1;const ao=oo.stateMutability==="view"||oo.state_mutability==="view";return Xr==="INVOKE"?!ao:ao}).map(oo=>oo.name);assert$2(io.includes(eo),`${Xr==="INVOKE"?"invocable":"viewable"} method not found in abi`)}const ro=this.abi.find(io=>Xr==="DEPLOY"?io.name===eo&&io.type==="constructor":io.name===eo&&io.type==="function");if(isNoConstructorValid(eo,to,ro))return;const no=this.parser.methodInputsLength(ro);if(to.length!==no)throw Error(`Invalid number of arguments, expected ${no} arguments, but got ${to.length}`);validateFields(ro,to,this.structs,this.enums)}compile(Xr,eo){const to=this.abi.find(oo=>oo.name===Xr);if(isNoConstructorValid(Xr,eo,to))return[];let ro;if(Array.isArray(eo))ro=eo;else{const oo=orderPropsByAbi(eo,to.inputs,this.structs,this.enums);ro=Object.values(oo),validateFields(to,ro,this.structs,this.enums)}const no=ro[Symbol.iterator](),io=to.inputs.reduce((oo,ao)=>isLen(ao.name)&&!isCairo1Type(ao.type)?oo:oo.concat(parseCalldataField(no,ao,this.structs,this.enums)),[]);return Object.defineProperty(io,"__compiled__",{enumerable:!1,writable:!1,value:!0}),io}static compile(Xr){const eo=ro=>{const no=(oo,ao=".")=>{const so=Array.isArray(oo)?[oo.length.toString(),...oo]:oo;return Object.entries(so).flatMap(([co,lo])=>{let uo=lo;co==="entrypoint"?uo=getSelectorFromName(uo):isLongText(uo)&&(uo=splitLongString(uo));const ho=Array.isArray(so)&&co==="0"?"$$len":co;if(isBigInt(uo))return[[`${ao}${ho}`,felt(uo)]];if(Object(uo)===uo){const go=Object.getOwnPropertyNames(Object.getPrototypeOf(uo)),bo=[...Object.getOwnPropertyNames(uo),...go];if(bo.includes("isSome")&&bo.includes("isNone")){const wo=uo,Eo=wo.isSome()?0:1;return wo.isSome()?no({0:Eo,1:wo.unwrap()},`${ao}${ho}.`):[[`${ao}${ho}`,felt(Eo)]]}if(bo.includes("isOk")&&bo.includes("isErr")){const wo=uo,Eo=wo.isOk()?0:1;return no({0:Eo,1:wo.unwrap()},`${ao}${ho}.`)}if(bo.includes("variant")&&bo.includes("activeVariant")){const wo=uo,Eo=wo.activeVariant(),Co=Object.keys(wo.variant).findIndex(Ro=>Ro===Eo);return typeof wo.unwrap()=="object"&&Object.keys(wo.unwrap()).length===0?[[`${ao}${ho}`,felt(Co)]]:no({0:Co,1:wo.unwrap()},`${ao}${ho}.`)}return no(uo,`${ao}${ho}.`)}return[[`${ao}${ho}`,felt(uo)]]})};return Object.fromEntries(no(ro))};let to;if(Array.isArray(Xr)){const ro={...Xr},no=eo(ro);to=Object.values(no)}else{const ro=eo(Xr);to=Object.values(ro)}return Object.defineProperty(to,"__compiled__",{enumerable:!1,writable:!1,value:!0}),to}parse(Xr,eo){const{outputs:to}=this.abi.find(io=>io.name===Xr),ro=eo.flat()[Symbol.iterator](),no=to.flat().reduce((io,oo,ao)=>{const so=oo.name??ao;return io[so]=responseParser(ro,oo,this.structs,this.enums,io),io[so]&&io[`${so}_len`]&&delete io[`${so}_len`],io},{});return Object.keys(no).length===1&&0 in no?no[0]:no}format(Xr,eo,to){const ro=this.parse(Xr,eo);return formatter(ro,to)}static getAbiStruct(Xr){return Xr.filter(eo=>eo.type==="struct").reduce((eo,to)=>({...eo,[to.name]:to}),{})}static getAbiEnum(Xr){const eo=Xr.filter(to=>to.type==="enum").reduce((to,ro)=>({...to,[ro.name]:ro}),{});return delete eo["core::bool"],eo}static toCalldata(Xr=[]){return CallData.compile(Xr)}static toHex(Xr=[]){return CallData.compile(Xr).map(to=>toHex(to))}},hash_exports={};__export(hash_exports,{calculateContractAddressFromHash:()=>calculateContractAddressFromHash,calculateDeclareTransactionHash:()=>calculateDeclareTransactionHash,calculateDeployAccountTransactionHash:()=>calculateDeployAccountTransactionHash,calculateDeployTransactionHash:()=>calculateDeployTransactionHash,calculateTransactionHash:()=>calculateTransactionHash,calculateTransactionHashCommon:()=>calculateTransactionHashCommon,computeCompiledClassHash:()=>computeCompiledClassHash,computeContractClassHash:()=>computeContractClassHash,computeHashOnElements:()=>computeHashOnElements,computeLegacyContractClassHash:()=>computeLegacyContractClassHash,computeSierraContractClassHash:()=>computeSierraContractClassHash,default:()=>computeHintedClassHash,feeTransactionVersion:()=>feeTransactionVersion,feeTransactionVersion_2:()=>feeTransactionVersion_2,formatSpaces:()=>formatSpaces,getSelector:()=>getSelector,getSelectorFromName:()=>getSelectorFromName,getVersionsByType:()=>getVersionsByType,keccakBn:()=>keccakBn,poseidon:()=>poseidon$1,starknetKeccak:()=>starknetKeccak,transactionVersion:()=>transactionVersion,transactionVersion_2:()=>transactionVersion_2});var ec_exports={};__export(ec_exports,{starkCurve:()=>starkCurve,weierstrass:()=>weierstrass$1});var json_exports={};__export(json_exports,{parse:()=>parse2,parseAlwaysAsBig:()=>parseAlwaysAsBig,stringify:()=>stringify2,stringifyAlwaysAsBig:()=>stringifyAlwaysAsBig});var parseIntAsNumberOrBigInt=Xr=>{if(!isInteger(Xr))return parseFloat(Xr);const eo=parseInt(Xr,10);return Number.isSafeInteger(eo)?eo:BigInt(Xr)},parse2=Xr=>parse(String(Xr),void 0,parseIntAsNumberOrBigInt),parseAlwaysAsBig=Xr=>parse(String(Xr),void 0,parseNumberAndBigInt),stringify2=(Xr,eo,to,ro)=>stringify(Xr,eo,to,ro),stringifyAlwaysAsBig=stringify2,transactionVersion=BN_TRANSACTION_VERSION_1,transactionVersion_2=BN_TRANSACTION_VERSION_2,feeTransactionVersion=BN_FEE_TRANSACTION_VERSION_1,feeTransactionVersion_2=BN_FEE_TRANSACTION_VERSION_2;function getVersionsByType(Xr){return Xr==="fee"?{v1:feeTransactionVersion,v2:feeTransactionVersion_2}:{v1:transactionVersion,v2:transactionVersion_2}}function computeHashOnElements(Xr){return[...Xr,Xr.length].reduce((eo,to)=>pedersen(toBigInt(eo),toBigInt(to)),0).toString()}function calculateTransactionHashCommon(Xr,eo,to,ro,no,io,oo,ao=[]){const so=computeHashOnElements(no),co=[Xr,eo,to,ro,so,io,oo,...ao];return computeHashOnElements(co)}function calculateDeployTransactionHash(Xr,eo,to,ro,no="constructor"){return calculateTransactionHashCommon("0x6465706c6f79",to,Xr,getSelectorFromName(no),eo,0,ro)}function calculateDeclareTransactionHash(Xr,eo,to,ro,no,io,oo){return calculateTransactionHashCommon("0x6465636c617265",to,eo,0,[Xr],ro,no,[io,...oo?[oo]:[]])}function calculateDeployAccountTransactionHash(Xr,eo,to,ro,no,io,oo,ao){const so=[eo,ro,...to];return calculateTransactionHashCommon("0x6465706c6f795f6163636f756e74",no,Xr,0,so,io,oo,[ao])}function calculateTransactionHash(Xr,eo,to,ro,no,io){return calculateTransactionHashCommon("0x696e766f6b65",eo,Xr,0,to,ro,no,[io])}function calculateContractAddressFromHash(Xr,eo,to,ro){const no=CallData.compile(to),io=computeHashOnElements(no),oo=felt("0x535441524b4e45545f434f4e54524143545f41444452455353"),ao=computeHashOnElements([oo,ro,Xr,eo,io]);return toHex(BigInt(ao)%ADDR_BOUND)}function nullSkipReplacer(Xr,eo){return Xr==="attributes"||Xr==="accessible_scopes"?Array.isArray(eo)&&eo.length===0?void 0:eo:Xr==="debug_info"?null:eo===null?void 0:eo}function formatSpaces(Xr){let eo=!1;const to=[];for(const ro of Xr)ro==='"'&&!(to.length>0&&to.slice(-1)[0]==="\\")&&(eo=!eo),eo?to.push(ro):to.push(ro===":"?": ":ro===","?", ":ro);return to.join("")}function computeHintedClassHash(Xr){const{abi:eo,program:to}=Xr,no=formatSpaces(stringify2({abi:eo,program:to},nullSkipReplacer));return addHexPrefix(keccak(utf8ToArray(no)).toString(16))}function computeLegacyContractClassHash(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr,to=toHex(API_VERSION),ro=computeHashOnElements(eo.entry_points_by_type.EXTERNAL.flatMap(co=>[co.selector,co.offset])),no=computeHashOnElements(eo.entry_points_by_type.L1_HANDLER.flatMap(co=>[co.selector,co.offset])),io=computeHashOnElements(eo.entry_points_by_type.CONSTRUCTOR.flatMap(co=>[co.selector,co.offset])),oo=computeHashOnElements(eo.program.builtins.map(co=>encodeShortString(co))),ao=computeHintedClassHash(eo),so=computeHashOnElements(eo.program.data);return computeHashOnElements([to,ro,no,io,oo,ao,so])}function hashBuiltins(Xr){return poseidonHashMany(Xr.flatMap(eo=>BigInt(encodeShortString(eo))))}function hashEntryPoint(Xr){const eo=Xr.flatMap(to=>[BigInt(to.selector),BigInt(to.offset),hashBuiltins(to.builtins)]);return poseidonHashMany(eo)}function computeCompiledClassHash(Xr){const to=BigInt(encodeShortString("COMPILED_CLASS_V1")),ro=hashEntryPoint(Xr.entry_points_by_type.EXTERNAL),no=hashEntryPoint(Xr.entry_points_by_type.L1_HANDLER),io=hashEntryPoint(Xr.entry_points_by_type.CONSTRUCTOR),oo=poseidonHashMany(Xr.bytecode.map(ao=>BigInt(ao)));return toHex(poseidonHashMany([to,ro,no,io,oo]))}function hashEntryPointSierra(Xr){const eo=Xr.flatMap(to=>[BigInt(to.selector),BigInt(to.function_idx)]);return poseidonHashMany(eo)}function hashAbi(Xr){const eo=formatSpaces(stringify2(Xr.abi,null));return BigInt(addHexPrefix(keccak(utf8ToArray(eo)).toString(16)))}function computeSierraContractClassHash(Xr){const to=BigInt(encodeShortString("CONTRACT_CLASS_V0.1.0")),ro=hashEntryPointSierra(Xr.entry_points_by_type.EXTERNAL),no=hashEntryPointSierra(Xr.entry_points_by_type.L1_HANDLER),io=hashEntryPointSierra(Xr.entry_points_by_type.CONSTRUCTOR),oo=hashAbi(Xr),ao=poseidonHashMany(Xr.sierra_program.map(so=>BigInt(so)));return toHex(poseidonHashMany([to,ro,no,io,oo,ao]))}function computeContractClassHash(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr;return"sierra_program"in eo?computeSierraContractClassHash(eo):computeLegacyContractClassHash(eo)}var stark_exports={};__export(stark_exports,{compressProgram:()=>compressProgram,decompressProgram:()=>decompressProgram,estimatedFeeToMaxFee:()=>estimatedFeeToMaxFee,formatSignature:()=>formatSignature,makeAddress:()=>makeAddress,randomAddress:()=>randomAddress,signatureToDecimalArray:()=>signatureToDecimalArray,signatureToHexArray:()=>signatureToHexArray});function compressProgram(Xr){const eo=typeof Xr=="string"?Xr:stringify2(Xr),to=gzip_1(eo);return btoaUniversal(to)}function decompressProgram(Xr){if(Array.isArray(Xr))return Xr;const eo=arrayBufferToString(ungzip_1(atobUniversal(Xr)));return parse2(eo)}function randomAddress(){const Xr=utils.randomPrivateKey();return getStarkKey(Xr)}function makeAddress(Xr){return addHexPrefix(Xr).toLowerCase()}function formatSignature(Xr){if(!Xr)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(Xr))return Xr.map(eo=>toHex(eo));try{const{r:eo,s:to}=Xr;return[toHex(eo),toHex(to)]}catch{throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function signatureToDecimalArray(Xr){return bigNumberishArrayToDecimalStringArray(formatSignature(Xr))}function signatureToHexArray(Xr){return bigNumberishArrayToHexadecimalStringArray(formatSignature(Xr))}function estimatedFeeToMaxFee(Xr,eo=.5){const to=Math.round((1+eo)*100);return toBigInt(Xr)*toBigInt(to)/100n}function isSierra(Xr){return"sierra_program"in(typeof Xr=="string"?parse2(Xr):Xr)}function extractContractHashes(Xr){const eo={...Xr};if(isSierra(Xr.contract)&&(!Xr.compiledClassHash&&Xr.casm&&(eo.compiledClassHash=computeCompiledClassHash(Xr.casm)),!eo.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(eo.classHash=Xr.classHash??computeContractClassHash(Xr.contract),!eo.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return eo}var fetchPonyfill_default=typeof window<"u"&&window.fetch||typeof global$1<"u"&&global$1.fetch||isomorphicFetch,provider_exports={};__export(provider_exports,{createSierraContractClass:()=>createSierraContractClass,parseContract:()=>parseContract,wait:()=>wait});function wait(Xr){return new Promise(eo=>{setTimeout(eo,Xr)})}function createSierraContractClass(Xr){const eo={...Xr};return delete eo.sierra_program_debug_info,eo.abi=formatSpaces(stringify2(Xr.abi)),eo.sierra_program=formatSpaces(stringify2(Xr.sierra_program)),eo.sierra_program=compressProgram(eo.sierra_program),eo}function parseContract(Xr){const eo=typeof Xr=="string"?parse2(Xr):Xr;return isSierra(Xr)?createSierraContractClass(eo):{...eo,..."program"in eo&&{program:compressProgram(eo.program)}}}var RPCResponseParser=class{parseGetBlockResponse(Xr){return{timestamp:Xr.timestamp,block_hash:"block_hash"in Xr?Xr.block_hash:"",block_number:"block_number"in Xr?Xr.block_number:-1,new_root:"new_root"in Xr?Xr.new_root:"",parent_hash:Xr.parent_hash,status:"status"in Xr?Xr.status:"PENDING",transactions:Xr.transactions}}parseGetTransactionResponse(Xr){return{calldata:"calldata"in Xr?Xr.calldata:[],contract_address:"contract_address"in Xr?Xr.contract_address:"",sender_address:"sender_address"in Xr?Xr.sender_address:"",max_fee:"max_fee"in Xr?Xr.max_fee:"",nonce:"nonce"in Xr?Xr.nonce:"",signature:"signature"in Xr?Xr.signature:[],transaction_hash:Xr.transaction_hash,version:Xr.version}}parseFeeEstimateResponse(Xr){return{overall_fee:toBigInt(Xr[0].overall_fee),gas_consumed:toBigInt(Xr[0].gas_consumed),gas_price:toBigInt(Xr[0].gas_price)}}parseFeeEstimateBulkResponse(Xr){return Xr.map(eo=>({overall_fee:toBigInt(eo.overall_fee),gas_consumed:toBigInt(eo.gas_consumed),gas_price:toBigInt(eo.gas_price)}))}parseCallContractResponse(Xr){return{result:Xr}}parseSimulateTransactionResponse(Xr){return Xr.map(eo=>({...eo,suggestedMaxFee:estimatedFeeToMaxFee(BigInt(eo.fee_estimation.overall_fee))}))}parseContractClassResponse(Xr){return{...Xr,abi:typeof Xr.abi=="string"?JSON.parse(Xr.abi):Xr.abi}}};function fixStack(Xr,eo=Xr.constructor){const{captureStackTrace:to}=Error;to&&to(Xr,eo)}function fixProto(Xr,eo){const{setPrototypeOf:to}=Object;to?to(Xr,eo):Xr.__proto__=eo}var CustomError=class extends Error{constructor(Xr){super(Xr),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),fixProto(this,new.target.prototype),fixStack(this)}},LibraryError=class extends CustomError{},GatewayError=class extends LibraryError{constructor(Xr,eo){super(Xr),this.errorCode=eo}},HttpError=class extends LibraryError{constructor(Xr,eo){super(Xr),this.errorCode=eo}},starknetId_exports={};__export(starknetId_exports,{StarknetIdContract:()=>StarknetIdContract,getStarknetIdContract:()=>getStarknetIdContract,useDecoded:()=>useDecoded,useEncoded:()=>useEncoded});var basicAlphabet="abcdefghijklmnopqrstuvwxyz0123456789-",basicSizePlusOne=BigInt(basicAlphabet.length+1),bigAlphabet="这来",basicAlphabetSize=BigInt(basicAlphabet.length),bigAlphabetSize=BigInt(bigAlphabet.length),bigAlphabetSizePlusOne=BigInt(bigAlphabet.length+1);function extractStars(Xr){let eo=0;for(;Xr.endsWith(bigAlphabet[bigAlphabet.length-1]);)Xr=Xr.substring(0,Xr.length-1),eo+=1;return[Xr,eo]}function useDecoded(Xr){let eo="";return Xr.forEach(to=>{for(;to!==ZERO;){const io=to%basicSizePlusOne;if(to/=basicSizePlusOne,io===BigInt(basicAlphabet.length)){const oo=to/bigAlphabetSizePlusOne;if(oo===ZERO){const ao=to%bigAlphabetSizePlusOne;to=oo,ao===ZERO?eo+=basicAlphabet[0]:eo+=bigAlphabet[Number(ao)-1]}else{const ao=to%bigAlphabetSize;eo+=bigAlphabet[Number(ao)],to/=bigAlphabetSize}}else eo+=basicAlphabet[Number(io)]}const[ro,no]=extractStars(eo);no&&(eo=ro+(no%2===0?bigAlphabet[bigAlphabet.length-1].repeat(no/2-1)+bigAlphabet[0]+basicAlphabet[1]:bigAlphabet[bigAlphabet.length-1].repeat((no-1)/2+1))),eo+="."}),eo&&eo.concat("stark")}function useEncoded(Xr){let eo=BigInt(0),to=BigInt(1);if(Xr.endsWith(bigAlphabet[0]+basicAlphabet[1])){const[ro,no]=extractStars(Xr.substring(0,Xr.length-2));Xr=ro+bigAlphabet[bigAlphabet.length-1].repeat(2*(no+1))}else{const[ro,no]=extractStars(Xr);no&&(Xr=ro+bigAlphabet[bigAlphabet.length-1].repeat(1+2*(no-1)))}for(let ro=0;ro(Xr.MAINNET="0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",Xr.TESTNET="0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce",Xr))(StarknetIdContract||{});function getStarknetIdContract(Xr){switch(Xr){case"0x534e5f4d41494e":return"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";case"0x534e5f474f45524c49":return"0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";default:throw new Error("Starknet.id is not yet deployed on this network")}}async function getStarkName(Xr,eo,to){const ro=await Xr.getChainId(),no=to??getStarknetIdContract(ro);try{const oo=(await Xr.callContract({contractAddress:no,entrypoint:"address_to_domain",calldata:CallData.compile({address:eo})})).result.map(so=>BigInt(so)).slice(1),ao=useDecoded(oo);if(!ao)throw Error("Starkname not found");return ao}catch(io){throw io instanceof Error&&io.message==="Starkname not found"?io:Error("Could not get stark name")}}async function getAddressFromStarkName(Xr,eo,to){const ro=await Xr.getChainId(),no=to??getStarknetIdContract(ro);try{return(await Xr.callContract({contractAddress:no,entrypoint:"domain_to_address",calldata:CallData.compile({domain:[useEncoded(eo.replace(".stark","")).toString(10)]})})).result[0]}catch{throw Error("Could not get address from stark name")}}var validBlockTags=Object.values(BlockTag),Block=class{constructor(Xr){this.hash=null,this.number=null,this.tag=null,this.valueOf=()=>this.number,this.toString=()=>this.hash,this.setIdentifier(Xr)}setIdentifier(Xr){typeof Xr=="string"&&isHex(Xr)?this.hash=Xr:typeof Xr=="bigint"?this.hash=toHex(Xr):typeof Xr=="number"?this.number=Xr:typeof Xr=="string"&&validBlockTags.includes(Xr)?this.tag=Xr:this.tag="pending"}get queryIdentifier(){return this.number!==null?`blockNumber=${this.number}`:this.hash!==null?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return this.number!==null?{block_number:this.number}:this.hash!==null?{block_hash:this.hash}:this.tag}set identifier(Xr){this.setIdentifier(Xr)}get sequencerIdentifier(){return this.hash!==null?{blockHash:this.hash}:{blockNumber:this.number??this.tag}}},getDefaultNodeUrl=(Xr,eo=!1,to=RPC_DEFAULT_VERSION)=>{eo||console.warn("Using default public node url, please provide nodeUrl in provider options!");const ro=RPC_NODES[Xr??"SN_GOERLI"],no=Math.floor(Math.random()*ro.length);return`${ro[no]}${to}`},defaultOptions={headers:{"Content-Type":"application/json"},blockIdentifier:"pending",retries:200},RpcProvider=class{constructor(Xr){this.responseParser=new RPCResponseParser,this.getBlockHashAndNumber=this.getBlockLatestAccepted,this.getStateUpdate=this.getBlockStateUpdate,this.traceBlockTransactions=this.getBlockTransactionsTraces,this.getTransactionCount=this.getBlockTransactionCount,this.traceTransaction=this.getTransactionTrace,this.getSimulateTransaction=this.simulateTransaction;const{nodeUrl:eo,retries:to,headers:ro,blockIdentifier:no,chainId:io,rpcVersion:oo}=Xr||{};Object.values(NetworkName).includes(eo)?this.nodeUrl=getDefaultNodeUrl(eo,Xr==null?void 0:Xr.default,oo):eo?this.nodeUrl=eo:this.nodeUrl=getDefaultNodeUrl(void 0,Xr==null?void 0:Xr.default,oo),this.retries=to||defaultOptions.retries,this.headers={...defaultOptions.headers,...ro},this.blockIdentifier=no||defaultOptions.blockIdentifier,this.chainId=io}fetch(Xr,eo,to=0){const ro={id:to,jsonrpc:"2.0",method:Xr,...eo&&{params:eo}};return fetchPonyfill_default(this.nodeUrl,{method:"POST",body:stringify2(ro),headers:this.headers})}errorHandler(Xr,eo,to,ro){if(to){const{code:no,message:io,data:oo}=to;throw new LibraryError(`RPC: ${Xr} with params ${stringify2(eo)} + ${no}: ${io}: ${stringify2(oo)}`)}if(ro instanceof LibraryError)throw ro;if(ro)throw Error(ro.message)}async fetchEndpoint(Xr,eo){var to;try{const ro=await this.fetch(Xr,eo),{error:no,result:io}=await ro.json();return this.errorHandler(Xr,eo,no),io}catch(ro){throw this.errorHandler(Xr,eo,(to=ro==null?void 0:ro.response)==null?void 0:to.data,ro),ro}}async getChainId(){return this.chainId??(this.chainId=await this.fetchEndpoint("starknet_chainId")),this.chainId}async getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async getNonceForAddress(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:to,block_id:ro})}async getBlock(Xr=this.blockIdentifier){return this.getBlockWithTxHashes(Xr).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}async getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}async getBlockWithTxHashes(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:eo})}async getBlockWithTxs(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:eo})}async getBlockStateUpdate(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:eo})}async getBlockTransactionsTraces(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:eo})}async getBlockTransactionCount(Xr=this.blockIdentifier){const eo=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:eo})}async getPendingTransactions(){const{transactions:Xr}=await this.getBlock("pending");return Promise.all(Xr.map(eo=>this.getTransactionByHash(eo)))}async getTransaction(Xr){return this.getTransactionByHash(Xr).then(this.responseParser.parseGetTransactionResponse)}async getTransactionByHash(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:eo})}async getTransactionByBlockIdAndIndex(Xr,eo){const to=new Block(Xr).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:to,index:eo})}async getTransactionReceipt(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:eo})}async getTransactionTrace(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:eo})}async getTransactionStatus(Xr){const eo=toHex(Xr);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:eo})}async simulateTransaction(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1,skipFeeCharge:ro=!0}){const no=new Block(eo).identifier,io=[];return to&&io.push(rpc_exports.ESimulationFlag.SKIP_VALIDATE),ro&&io.push(rpc_exports.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:no,transactions:Xr.map(oo=>this.buildTransaction(oo)),simulation_flags:io}).then(this.responseParser.parseSimulateTransactionResponse)}async waitForTransaction(Xr,eo){const to=toHex(Xr);let{retries:ro}=this,no=!1,io=!1;const oo=(eo==null?void 0:eo.retryInterval)??5e3,ao=(eo==null?void 0:eo.errorStates)??[rpc_exports.ETransactionStatus.REJECTED],so=(eo==null?void 0:eo.successStates)??[rpc_exports.ETransactionExecutionStatus.SUCCEEDED,rpc_exports.ETransactionStatus.ACCEPTED_ON_L2,rpc_exports.ETransactionStatus.ACCEPTED_ON_L1];let co;for(;!no;){await wait(oo);try{co=await this.getTransactionStatus(to);const uo=co.execution_status,ho=co.finality_status;if(!ho)throw new Error("waiting for transaction status");if(ao.includes(uo)||ao.includes(ho)){const go=`${uo}: ${ho}`,bo=new Error(go);throw bo.response=co,io=!0,bo}else(so.includes(uo)||so.includes(ho))&&(no=!0)}catch(uo){if(uo instanceof Error&&io)throw uo;if(ro<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}ro-=1}let lo=null;for(;lo===null;){try{lo=await this.getTransactionReceipt(to)}catch{if(ro<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}ro-=1,await wait(oo)}return lo}async getStorageAt(Xr,eo,to=this.blockIdentifier){const ro=toHex(Xr),no=toStorageKey(eo),io=new Block(to).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:ro,key:no,block_id:io})}async getClassHashAt(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:ro,contract_address:to})}async getClassByHash(Xr){return this.getClass(Xr)}async getClass(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:to,block_id:ro}).then(this.responseParser.parseContractClassResponse)}async getClassAt(Xr,eo=this.blockIdentifier){const to=toHex(Xr),ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:ro,contract_address:to}).then(this.responseParser.parseContractClassResponse)}async getCode(Xr,eo){throw new Error("RPC does not implement getCode function")}async getContractVersion(Xr,eo,{blockIdentifier:to=this.blockIdentifier,compiler:ro=!0}={}){let no;if(Xr)no=await this.getClassAt(Xr,to);else if(eo)no=await this.getClass(eo,to);else throw Error("getContractVersion require contractAddress or classHash");return isSierra(no)?ro?{cairo:"1",compiler:getAbiContractVersion(no.abi).compiler}:{cairo:"1",compiler:void 0}:{cairo:"0",compiler:"0"}}async getEstimateFee(Xr,eo,to=this.blockIdentifier){return this.getInvokeEstimateFee(Xr,eo,to)}async getInvokeEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"INVOKE_FUNCTION",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"DECLARE",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(Xr,eo,to=this.blockIdentifier){const ro=new Block(to).identifier,no=this.buildTransaction({type:"DEPLOY_ACCOUNT",...Xr,...eo},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[no],block_id:ro}).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1}){to&&console.warn("getEstimateFeeBulk RPC does not support skipValidate");const ro=new Block(eo).identifier;return this.fetchEndpoint("starknet_estimateFee",{request:Xr.map(no=>this.buildTransaction(no,"fee")),block_id:ro}).then(this.responseParser.parseFeeEstimateBulkResponse)}async invokeFunction(Xr,eo){return this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:Xr.contractAddress,calldata:CallData.toHex(Xr.calldata),type:rpc_exports.ETransactionType.INVOKE,max_fee:toHex(eo.maxFee||0),version:"0x1",signature:signatureToHexArray(Xr.signature),nonce:toHex(eo.nonce)}})}async declareContract({contract:Xr,signature:eo,senderAddress:to,compiledClassHash:ro},no){return isSierra(Xr)?this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:rpc_exports.ETransactionType.DECLARE,contract_class:{sierra_program:decompressProgram(Xr.sierra_program),contract_class_version:Xr.contract_class_version,entry_points_by_type:Xr.entry_points_by_type,abi:Xr.abi},compiled_class_hash:ro||"",version:HEX_STR_TRANSACTION_VERSION_2,max_fee:toHex(no.maxFee||0),signature:signatureToHexArray(eo),sender_address:to,nonce:toHex(no.nonce)}}):this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:rpc_exports.ETransactionType.DECLARE,contract_class:{program:Xr.program,entry_points_by_type:Xr.entry_points_by_type,abi:Xr.abi},version:HEX_STR_TRANSACTION_VERSION_1,max_fee:toHex(no.maxFee||0),signature:signatureToHexArray(eo),sender_address:to,nonce:toHex(no.nonce)}})}async deployAccountContract({classHash:Xr,constructorCalldata:eo,addressSalt:to,signature:ro},no){return this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:CallData.toHex(eo||[]),class_hash:toHex(Xr),contract_address_salt:toHex(to||0),type:rpc_exports.ETransactionType.DEPLOY_ACCOUNT,max_fee:toHex(no.maxFee||0),version:toHex(no.version||0),signature:signatureToHexArray(ro),nonce:toHex(no.nonce)}})}async callContract(Xr,eo=this.blockIdentifier){const to=new Block(eo).identifier,ro=await this.fetchEndpoint("starknet_call",{request:{contract_address:Xr.contractAddress,entry_point_selector:getSelectorFromName(Xr.entrypoint),calldata:CallData.toHex(Xr.calldata)},block_id:to});return this.responseParser.parseCallContractResponse(ro)}async estimateMessageFee(Xr,eo=this.blockIdentifier){const{from_address:to,to_address:ro,entry_point_selector:no,payload:io}=Xr,oo={from_address:toHex(to),to_address:toHex(ro),entry_point_selector:getSelector(no),payload:getHexStringArray(io)},ao=new Block(eo).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:oo,block_id:ao})}async getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}async getEvents(Xr){return this.fetchEndpoint("starknet_getEvents",{filter:Xr})}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}buildTransaction(Xr,eo){const to=getVersionsByType(eo),ro={signature:signatureToHexArray(Xr.signature),nonce:toHex(Xr.nonce),max_fee:toHex(Xr.maxFee||0)};if(Xr.type==="INVOKE_FUNCTION")return{type:rpc_exports.ETransactionType.INVOKE,sender_address:Xr.contractAddress,calldata:CallData.toHex(Xr.calldata),version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DECLARE")return isSierra(Xr.contract)?{type:Xr.type,contract_class:{...Xr.contract,sierra_program:decompressProgram(Xr.contract.sierra_program)},compiled_class_hash:Xr.compiledClassHash||"",sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v2),...ro}:{type:Xr.type,contract_class:Xr.contract,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DEPLOY_ACCOUNT")return{type:Xr.type,constructor_calldata:CallData.toHex(Xr.constructorCalldata||[]),class_hash:toHex(Xr.classHash),contract_address_salt:toHex(Xr.addressSalt||0),version:toHex(Xr.version||to.v1),...ro};throw Error("RPC buildTransaction received unknown TransactionType")}},ResponseParser=class{},SequencerAPIResponseParser=class extends ResponseParser{parseGetBlockResponse(Xr){return{...Xr,new_root:Xr.state_root,parent_hash:Xr.parent_block_hash,transactions:Object.values(Xr.transactions).map(eo=>"transaction_hash"in eo&&eo.transaction_hash).filter(Boolean)}}parseGetTransactionResponse(Xr){if(Xr.status==="NOT_RECEIVED"&&Xr.finality_status==="NOT_RECEIVED")throw new LibraryError;return{...Xr,calldata:"calldata"in Xr.transaction?Xr.transaction.calldata:[],contract_class:"contract_class"in Xr.transaction?Xr.transaction.contract_class:void 0,entry_point_selector:"entry_point_selector"in Xr.transaction?Xr.transaction.entry_point_selector:void 0,max_fee:"max_fee"in Xr.transaction?Xr.transaction.max_fee:void 0,nonce:Xr.transaction.nonce,sender_address:"sender_address"in Xr.transaction?Xr.transaction.sender_address:void 0,signature:"signature"in Xr.transaction?Xr.transaction.signature:void 0,transaction_hash:"transaction_hash"in Xr.transaction?Xr.transaction.transaction_hash:void 0,version:"version"in Xr.transaction?Xr.transaction.version:void 0}}parseGetTransactionReceiptResponse(Xr){return{...Xr,messages_sent:Xr.l2_to_l1_messages,..."revert_error"in Xr&&{revert_reason:Xr.revert_error}}}parseFeeEstimateResponse(Xr){if("overall_fee"in Xr){let eo={};try{eo={gas_consumed:toBigInt(Xr.gas_usage),gas_price:toBigInt(Xr.gas_price)}}catch{}return{overall_fee:toBigInt(Xr.overall_fee),...eo}}return{overall_fee:toBigInt(Xr.amount)}}parseFeeEstimateBulkResponse(Xr){return[].concat(Xr).map(eo=>{if("overall_fee"in eo){let to={};try{to={gas_consumed:toBigInt(eo.gas_usage),gas_price:toBigInt(eo.gas_price)}}catch{}return{overall_fee:toBigInt(eo.overall_fee),...to}}return{overall_fee:toBigInt(eo.amount)}})}parseSimulateTransactionResponse(Xr){const eo="overall_fee"in Xr.fee_estimation?Xr.fee_estimation.overall_fee:Xr.fee_estimation.amount;return[{transaction_trace:Xr.trace,fee_estimation:Xr.fee_estimation,suggestedMaxFee:estimatedFeeToMaxFee(BigInt(eo))}]}parseCallContractResponse(Xr){return{result:Xr.result}}parseInvokeFunctionResponse(Xr){return{transaction_hash:Xr.transaction_hash}}parseDeployContractResponse(Xr){return{transaction_hash:Xr.transaction_hash,contract_address:Xr.address}}parseDeclareContractResponse(Xr){return{transaction_hash:Xr.transaction_hash,class_hash:Xr.class_hash}}parseGetStateUpdateResponse(Xr){const eo=Object.entries(Xr.state_diff.nonces).map(([ro,no])=>({contract_address:ro,nonce:no})),to=Object.entries(Xr.state_diff.storage_diffs).map(([ro,no])=>({address:ro,storage_entries:no}));return{...Xr,state_diff:{...Xr.state_diff,storage_diffs:to,nonces:eo}}}parseContractClassResponse(Xr){const eo=isSierra(Xr)?Xr:parseContract(Xr);return{...eo,abi:typeof eo.abi=="string"?JSON.parse(eo.abi):eo.abi}}},protocolAndDomainRE=/^(?:\w+:)?\/\/(\S+)$/,localhostDomainRE=/^localhost[:?\d]*(?:[^:?\d]\S*)?$/,nonLocalhostDomainRE=/^[^\s.]+\.\S{2,}$/;function isUrl(Xr){if(!Xr||typeof Xr!="string")return!1;const eo=Xr.match(protocolAndDomainRE);if(!eo)return!1;const to=eo[1];return to?!!(localhostDomainRE.test(to)||nonLocalhostDomainRE.test(to)):!1}function buildUrl(Xr,eo,to){return isUrl(to)?to:urljoin2(Xr,to??eo)}function isEmptyQueryObject(Xr){return Xr===void 0||Object.keys(Xr).length===0||Object.keys(Xr).length===1&&Object.entries(Xr).every(([eo,to])=>eo==="blockIdentifier"&&to===null)}var defaultOptions2={network:"SN_GOERLI",blockIdentifier:"pending"},SequencerProvider=class{constructor(Xr=defaultOptions2){this.responseParser=new SequencerAPIResponseParser,"network"in Xr?(this.baseUrl=SequencerProvider.getNetworkFromName(Xr.network),this.feederGatewayUrl=buildUrl(this.baseUrl,"feeder_gateway"),this.gatewayUrl=buildUrl(this.baseUrl,"gateway")):(this.baseUrl=Xr.baseUrl,this.feederGatewayUrl=buildUrl(this.baseUrl,"feeder_gateway",Xr.feederGatewayUrl),this.gatewayUrl=buildUrl(this.baseUrl,"gateway",Xr.gatewayUrl)),this.chainId=(Xr==null?void 0:Xr.chainId)??SequencerProvider.getChainIdFromBaseUrl(this.baseUrl),this.headers=Xr.headers,this.blockIdentifier=(Xr==null?void 0:Xr.blockIdentifier)||defaultOptions2.blockIdentifier}static getNetworkFromName(Xr){switch(Xr){case"SN_MAIN":case"0x534e5f4d41494e":return"https://alpha-mainnet.starknet.io";case"SN_GOERLI":case"0x534e5f474f45524c49":return"https://alpha4.starknet.io";default:throw new Error("Could not detect base url from NetworkName")}}static getChainIdFromBaseUrl(Xr){try{return new URL(Xr).host.includes("mainnet.starknet.io")?"0x534e5f4d41494e":"0x534e5f474f45524c49"}catch{return console.error(`Could not parse baseUrl: ${Xr}`),"0x534e5f474f45524c49"}}getFetchUrl(Xr){return["add_transaction"].includes(Xr)?this.gatewayUrl:this.feederGatewayUrl}getFetchMethod(Xr){return["add_transaction","call_contract","estimate_fee","estimate_message_fee","estimate_fee_bulk","simulate_transaction"].includes(Xr)?"POST":"GET"}getQueryString(Xr){return isEmptyQueryObject(Xr)?"":`?${Object.entries(Xr).map(([to,ro])=>to==="blockIdentifier"?`${new Block(ro).queryIdentifier}`:`${to}=${ro}`).join("&")}`}getHeaders(Xr){return Xr==="POST"?{"Content-Type":"application/json",...this.headers}:this.headers}async fetchEndpoint(Xr,...[eo,to]){const ro=this.getFetchUrl(Xr),no=this.getFetchMethod(Xr),io=this.getQueryString(eo),oo=urljoin2(ro,Xr,io);return this.fetch(oo,{method:no,body:to})}async fetch(Xr,eo){const to=buildUrl(this.baseUrl,"",Xr),ro=(eo==null?void 0:eo.method)??"GET",no=this.getHeaders(ro),io=stringify2(eo==null?void 0:eo.body);try{const oo=await fetchPonyfill_default(to,{method:ro,body:io,headers:no}),ao=await oo.text();if(!oo.ok){let co;try{co=parse2(ao)}catch{throw new HttpError(oo.statusText,oo.status)}throw new GatewayError(co.message,co.code)}return(eo!=null&&eo.parseAlwaysAsBigInt?parseAlwaysAsBig:parse2)(ao)}catch(oo){throw oo instanceof Error&&!(oo instanceof LibraryError)?Error(`Could not ${ro} from endpoint \`${to}\`: ${oo.message}`):oo}}async getChainId(){return Promise.resolve(this.chainId)}async callContract({contractAddress:Xr,entrypoint:eo,calldata:to=[]},ro=this.blockIdentifier){return this.fetchEndpoint("call_contract",{blockIdentifier:ro},{contract_address:Xr,entry_point_selector:getSelectorFromName(eo),calldata:CallData.compile(to)}).then(this.responseParser.parseCallContractResponse)}async getBlock(Xr=this.blockIdentifier){return this.fetchEndpoint("get_block",{blockIdentifier:Xr}).then(this.responseParser.parseGetBlockResponse)}async getNonceForAddress(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_nonce",{contractAddress:Xr,blockIdentifier:eo})}async getStorageAt(Xr,eo,to=this.blockIdentifier){const ro=toBigInt(eo).toString(10);return this.fetchEndpoint("get_storage_at",{blockIdentifier:to,contractAddress:Xr,key:ro})}async getTransaction(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction",{transactionHash:eo}).then(to=>{if(Object.values(to).length===1)throw new LibraryError(to.status);return this.responseParser.parseGetTransactionResponse(to)})}async getTransactionReceipt(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_receipt",{transactionHash:eo}).then(this.responseParser.parseGetTransactionReceiptResponse)}async getClassAt(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_full_contract",{blockIdentifier:eo,contractAddress:Xr}).then(this.responseParser.parseContractClassResponse)}async getClassHashAt(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_class_hash_at",{blockIdentifier:eo,contractAddress:Xr})}async getClassByHash(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_class_by_hash",{classHash:Xr,blockIdentifier:eo}).then(this.responseParser.parseContractClassResponse)}async getCompiledClassByClassHash(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_compiled_class_by_class_hash",{classHash:Xr,blockIdentifier:eo})}async getContractVersion(Xr,eo,{blockIdentifier:to=this.blockIdentifier,compiler:ro=!0}={}){let no;if(Xr)no=await this.getClassAt(Xr,to);else if(eo)no=await this.getClassByHash(eo,to);else throw Error("getContractVersion require contractAddress or classHash");return isSierra(no)?ro?{cairo:"1",compiler:getAbiContractVersion(no.abi).compiler}:{cairo:"1",compiler:void 0}:{cairo:"0",compiler:"0"}}async invokeFunction(Xr,eo){return this.fetchEndpoint("add_transaction",void 0,{type:"INVOKE_FUNCTION",sender_address:Xr.contractAddress,calldata:CallData.compile(Xr.calldata??[]),signature:signatureToDecimalArray(Xr.signature),nonce:toHex(eo.nonce),max_fee:toHex(eo.maxFee||0),version:"0x1"}).then(this.responseParser.parseInvokeFunctionResponse)}async deployAccountContract({classHash:Xr,constructorCalldata:eo,addressSalt:to,signature:ro},no){return this.fetchEndpoint("add_transaction",void 0,{type:"DEPLOY_ACCOUNT",contract_address_salt:to??randomAddress(),constructor_calldata:CallData.compile(eo??[]),class_hash:toHex(Xr),max_fee:toHex(no.maxFee||0),version:toHex(no.version||0),nonce:toHex(no.nonce),signature:signatureToDecimalArray(ro)}).then(this.responseParser.parseDeployContractResponse)}async declareContract({senderAddress:Xr,contract:eo,signature:to,compiledClassHash:ro},no){return isSierra(eo)?this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",sender_address:Xr,compiled_class_hash:ro,contract_class:eo,nonce:toHex(no.nonce),signature:signatureToDecimalArray(to),max_fee:toHex(no.maxFee||0),version:toHex(transactionVersion_2)}).then(this.responseParser.parseDeclareContractResponse):this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",contract_class:eo,nonce:toHex(no.nonce),signature:signatureToDecimalArray(to),sender_address:Xr,max_fee:toHex(no.maxFee||0),version:toHex(transactionVersion)}).then(this.responseParser.parseDeclareContractResponse)}async getEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){return this.getInvokeEstimateFee(Xr,eo,to,ro)}async getInvokeEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"INVOKE_FUNCTION",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"DECLARE",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(Xr,eo,to=this.blockIdentifier,ro=!1){const no=this.buildTransaction({type:"DEPLOY_ACCOUNT",...Xr,...eo},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:to,skipValidate:ro},no).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1}){const ro=Xr.map(no=>this.buildTransaction(no,"fee"));return this.fetchEndpoint("estimate_fee_bulk",{blockIdentifier:eo,skipValidate:to},ro).then(this.responseParser.parseFeeEstimateBulkResponse)}async getCode(Xr,eo=this.blockIdentifier){return this.fetchEndpoint("get_code",{contractAddress:Xr,blockIdentifier:eo})}async waitForTransaction(Xr,eo){let to,ro=!1,no=0;const io=(eo==null?void 0:eo.retryInterval)??5e3,oo=(eo==null?void 0:eo.errorStates)??["REJECTED","NOT_RECEIVED","REVERTED"],ao=(eo==null?void 0:eo.successStates)??["SUCCEEDED","ACCEPTED_ON_L1","ACCEPTED_ON_L2"];for(;!ro;)if(await wait(io),to=await this.getTransactionStatus(Xr),to.finality_status==="NOT_RECEIVED"&&no<3)no+=1;else if(ao.includes(to.finality_status)||ao.includes(to.execution_status))ro=!0;else if(oo.includes(to.finality_status)||oo.includes(to.execution_status)){let co;to.tx_failure_reason?co=`${to.tx_status}: ${to.tx_failure_reason.code} +${to.tx_failure_reason.error_message}`:to.tx_revert_reason?co=`${to.tx_status}: ${to.tx_revert_reason}`:co=to.tx_status;const lo=new Error(co);throw lo.response=to,lo}return await this.getTransactionReceipt(Xr)}async getTransactionStatus(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_status",{transactionHash:eo})}async getContractAddresses(){return this.fetchEndpoint("get_contract_addresses")}async getTransactionTrace(Xr){const eo=toHex(Xr);return this.fetchEndpoint("get_transaction_trace",{transactionHash:eo})}async estimateMessageFee({from_address:Xr,to_address:eo,entry_point_selector:to,payload:ro},no=this.blockIdentifier){const io={from_address:getDecimalString(Xr),to_address:getHexString(eo),entry_point_selector:getSelector(to),payload:getHexStringArray(ro)};return this.fetchEndpoint("estimate_message_fee",{blockIdentifier:no},io)}async getSimulateTransaction(Xr,{blockIdentifier:eo=this.blockIdentifier,skipValidate:to=!1,skipExecute:ro=!1}){Xr.length>1&&console.warn("Sequencer simulate process only first element from invocations list"),ro&&console.warn("Sequencer can't skip account __execute__");const no=this.buildTransaction(Xr[0]);return this.fetchEndpoint("simulate_transaction",{blockIdentifier:eo,skipValidate:to??!1},no).then(this.responseParser.parseSimulateTransactionResponse)}async getStateUpdate(Xr=this.blockIdentifier){const eo=new Block(Xr).sequencerIdentifier;return this.fetchEndpoint("get_state_update",{...eo}).then(this.responseParser.parseGetStateUpdateResponse)}async getBlockTraces(Xr=this.blockIdentifier){const eo=new Block(Xr).sequencerIdentifier;return this.fetchEndpoint("get_block_traces",{...eo})}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}buildTransaction(Xr,eo){const to=getVersionsByType(eo),ro={signature:signatureToDecimalArray(Xr.signature),nonce:toHex(Xr.nonce)};if(Xr.type==="INVOKE_FUNCTION")return{type:Xr.type,sender_address:Xr.contractAddress,calldata:CallData.compile(Xr.calldata??[]),version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DECLARE")return isSierra(Xr.contract)?{type:Xr.type,contract_class:Xr.contract,compiled_class_hash:Xr.compiledClassHash,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v2),...ro}:{type:Xr.type,contract_class:Xr.contract,sender_address:Xr.senderAddress,version:toHex(Xr.version||to.v1),...ro};if(Xr.type==="DEPLOY_ACCOUNT")return{type:Xr.type,constructor_calldata:CallData.compile(Xr.constructorCalldata||[]),class_hash:toHex(Xr.classHash),contract_address_salt:toHex(Xr.addressSalt||0),version:toHex(Xr.version||to.v1),...ro};throw Error("Sequencer buildTransaction received unknown TransactionType")}},Provider=class{constructor(Xr){Xr instanceof Provider?this.provider=Xr.provider:Xr instanceof RpcProvider||Xr instanceof SequencerProvider?this.provider=Xr:Xr&&"rpc"in Xr?this.provider=new RpcProvider(Xr.rpc):Xr&&"sequencer"in Xr?this.provider=new SequencerProvider(Xr.sequencer):this.provider=new RpcProvider}async getChainId(){return this.provider.getChainId()}async getBlock(Xr){return this.provider.getBlock(Xr)}async getClassAt(Xr,eo){return this.provider.getClassAt(Xr,eo)}async getClassHashAt(Xr,eo){return this.provider.getClassHashAt(Xr,eo)}getClassByHash(Xr){return this.provider.getClassByHash(Xr)}async getEstimateFee(Xr,eo,to){return this.provider.getEstimateFee(Xr,eo,to)}async getInvokeEstimateFee(Xr,eo,to,ro){return this.provider.getInvokeEstimateFee(Xr,eo,to,ro)}async getEstimateFeeBulk(Xr,eo){return this.provider.getEstimateFeeBulk(Xr,eo)}async getNonceForAddress(Xr,eo){return this.provider.getNonceForAddress(Xr,eo)}async getStorageAt(Xr,eo,to){return this.provider.getStorageAt(Xr,eo,to)}async getTransaction(Xr){return this.provider.getTransaction(Xr)}async getTransactionReceipt(Xr){return this.provider.getTransactionReceipt(Xr)}async callContract(Xr,eo){return this.provider.callContract(Xr,eo)}async invokeFunction(Xr,eo){return this.provider.invokeFunction(Xr,eo)}async deployAccountContract(Xr,eo){return this.provider.deployAccountContract(Xr,eo)}async declareContract(Xr,eo){return this.provider.declareContract(Xr,eo)}async getDeclareEstimateFee(Xr,eo,to,ro){return this.provider.getDeclareEstimateFee(Xr,eo,to,ro)}getDeployAccountEstimateFee(Xr,eo,to,ro){return this.provider.getDeployAccountEstimateFee(Xr,eo,to,ro)}async getCode(Xr,eo){return this.provider.getCode(Xr,eo)}async waitForTransaction(Xr,eo){return this.provider.waitForTransaction(Xr,eo)}async getSimulateTransaction(Xr,eo){return this.provider.getSimulateTransaction(Xr,eo)}async getStateUpdate(Xr){return this.provider.getStateUpdate(Xr)}async getStarkName(Xr,eo){return getStarkName(this,Xr,eo)}async getAddressFromStarkName(Xr,eo){return getAddressFromStarkName(this,Xr,eo)}async getContractVersion(Xr,eo,to){return this.provider.getContractVersion(Xr,eo,to)}},transaction_exports={};__export(transaction_exports,{fromCallsToExecuteCalldata:()=>fromCallsToExecuteCalldata,fromCallsToExecuteCalldataWithNonce:()=>fromCallsToExecuteCalldataWithNonce,fromCallsToExecuteCalldata_cairo1:()=>fromCallsToExecuteCalldata_cairo1,getExecuteCalldata:()=>getExecuteCalldata,transformCallsToMulticallArrays:()=>transformCallsToMulticallArrays,transformCallsToMulticallArrays_cairo1:()=>transformCallsToMulticallArrays_cairo1});var transformCallsToMulticallArrays=Xr=>{const eo=[],to=[];return Xr.forEach(ro=>{const no=CallData.compile(ro.calldata||[]);eo.push({to:toBigInt(ro.contractAddress).toString(10),selector:toBigInt(getSelectorFromName(ro.entrypoint)).toString(10),data_offset:to.length.toString(),data_len:no.length.toString()}),to.push(...no)}),{callArray:eo,calldata:CallData.compile({calldata:to})}},fromCallsToExecuteCalldata=Xr=>{const{callArray:eo,calldata:to}=transformCallsToMulticallArrays(Xr);return[...CallData.compile({callArray:eo}),...to]},fromCallsToExecuteCalldataWithNonce=(Xr,eo)=>[...fromCallsToExecuteCalldata(Xr),toBigInt(eo).toString()],transformCallsToMulticallArrays_cairo1=Xr=>Xr.map(to=>({to:toBigInt(to.contractAddress).toString(10),selector:toBigInt(getSelectorFromName(to.entrypoint)).toString(10),calldata:CallData.compile(to.calldata||[])})),fromCallsToExecuteCalldata_cairo1=Xr=>{const eo=Xr.map(to=>({contractAddress:to.contractAddress,entrypoint:to.entrypoint,calldata:Array.isArray(to.calldata)&&"__compiled__"in to.calldata?to.calldata:CallData.compile(to.calldata)}));return CallData.compile({orderCalls:eo})},getExecuteCalldata=(Xr,eo="0")=>eo==="1"?fromCallsToExecuteCalldata_cairo1(Xr):fromCallsToExecuteCalldata(Xr),typedData_exports={};__export(typedData_exports,{encodeData:()=>encodeData,encodeType:()=>encodeType,encodeValue:()=>encodeValue,getDependencies:()=>getDependencies,getMessageHash:()=>getMessageHash,getStructHash:()=>getStructHash,getTypeHash:()=>getTypeHash,isMerkleTreeType:()=>isMerkleTreeType,prepareSelector:()=>prepareSelector});var merkle_exports={};__export(merkle_exports,{MerkleTree:()=>MerkleTree,proofMerklePath:()=>proofMerklePath});var MerkleTree=class{constructor(Xr){this.branches=[],this.leaves=Xr,this.root=this.build(Xr)}build(Xr){if(Xr.length===1)return Xr[0];Xr.length!==this.leaves.length&&this.branches.push(Xr);const eo=[];for(let to=0;tono>=io?1:-1);return pedersen(to,ro)}getProof(Xr,eo=this.leaves,to=[]){const ro=eo.indexOf(Xr);if(ro===-1)throw new Error("leaf not found");if(eo.length===1)return to;const no=ro%2===0,io=(no?eo[ro+1]:eo[ro-1])??"0x0",oo=[...to,io],ao=this.leaves.length===eo.length?-1:this.branches.findIndex(co=>co.length===eo.length),so=this.branches[ao+1]??[this.root];return this.getProof(MerkleTree.hash(no?Xr:io,no?io:Xr),so,oo)}};function proofMerklePath(Xr,eo,to){if(to.length===0)return Xr===eo;const[ro,...no]=to;return proofMerklePath(Xr,MerkleTree.hash(eo,ro),no)}function getHex(Xr){try{return toHex(Xr)}catch{if(typeof Xr=="string")return toHex(encodeShortString(Xr));throw new Error(`Invalid BigNumberish: ${Xr}`)}}var validateTypedData=Xr=>{const eo=Xr;return!!(eo.types&&eo.primaryType&&eo.message)};function prepareSelector(Xr){return isHex(Xr)?Xr:getSelectorFromName(Xr)}function isMerkleTreeType(Xr){return Xr.type==="merkletree"}var getDependencies=(Xr,eo,to=[])=>(eo[eo.length-1]==="*"&&(eo=eo.slice(0,-1)),to.includes(eo)||!Xr[eo]?to:[eo,...Xr[eo].reduce((ro,no)=>[...ro,...getDependencies(Xr,no.type,ro).filter(io=>!ro.includes(io))],[])]);function getMerkleTreeType(Xr,eo){if(eo.parent&&eo.key){const ro=Xr[eo.parent].find(io=>io.name===eo.key);if(!isMerkleTreeType(ro))throw new Error(`${eo.key} is not a merkle tree`);if(ro.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${eo.key}`);return ro.contains}return"raw"}var encodeType=(Xr,eo)=>{const[to,...ro]=getDependencies(Xr,eo);return(to?[to,...ro.sort()]:[]).map(io=>`${io}(${Xr[io].map(oo=>`${oo.name}:${oo.type}`)})`).join("")},getTypeHash=(Xr,eo)=>getSelectorFromName(encodeType(Xr,eo)),encodeValue=(Xr,eo,to,ro={})=>{if(Xr[eo])return[eo,getStructHash(Xr,eo,to)];if(Object.keys(Xr).map(no=>`${no}*`).includes(eo)){const no=to.map(io=>getStructHash(Xr,eo.slice(0,-1),io));return[eo,computeHashOnElements(no)]}if(eo==="merkletree"){const no=getMerkleTreeType(Xr,ro),io=to.map(ao=>encodeValue(Xr,no,ao)[1]),{root:oo}=new MerkleTree(io);return["felt",oo]}return eo==="felt*"?["felt*",computeHashOnElements(to)]:eo==="selector"?["felt",prepareSelector(to)]:[eo,getHex(to)]},encodeData=(Xr,eo,to)=>{const[ro,no]=Xr[eo].reduce(([io,oo],ao)=>{if(to[ao.name]===void 0||to[ao.name]===null)throw new Error(`Cannot encode data: missing data for '${ao.name}'`);const so=to[ao.name],[co,lo]=encodeValue(Xr,ao.type,so,{parent:eo,key:ao.name});return[[...io,co],[...oo,lo]]},[["felt"],[getTypeHash(Xr,eo)]]);return[ro,no]},getStructHash=(Xr,eo,to)=>computeHashOnElements(encodeData(Xr,eo,to)[1]),getMessageHash=(Xr,eo)=>{if(!validateTypedData(Xr))throw new Error("Typed data does not match JSON schema");const to=[encodeShortString("StarkNet Message"),getStructHash(Xr.types,"StarkNetDomain",Xr.domain),eo,getStructHash(Xr.types,Xr.primaryType,Xr.message)];return computeHashOnElements(to)},Signer=class{constructor(Xr=utils.randomPrivateKey()){this.pk=Xr instanceof Uint8Array?buf2hex(Xr):toHex(Xr)}async getPubKey(){return getStarkKey(this.pk)}async signMessage(Xr,eo){const to=getMessageHash(Xr,eo);return sign(to,this.pk)}async signTransaction(Xr,eo,to){if(to&&to.length!==Xr.length)throw new Error("ABI must be provided for each transaction or no transaction");const ro=getExecuteCalldata(Xr,eo.cairoVersion),no=calculateTransactionHash(eo.walletAddress,eo.version,ro,eo.maxFee,eo.chainId,eo.nonce);return sign(no,this.pk)}async signDeployAccountTransaction({classHash:Xr,contractAddress:eo,constructorCalldata:to,addressSalt:ro,maxFee:no,version:io,chainId:oo,nonce:ao}){const so=calculateDeployAccountTransactionHash(eo,Xr,CallData.compile(to),ro,io,no,oo,ao);return sign(so,this.pk)}async signDeclareTransaction({classHash:Xr,senderAddress:eo,chainId:to,maxFee:ro,version:no,nonce:io,compiledClassHash:oo}){const ao=calculateDeclareTransactionHash(Xr,eo,no,ro,to,io,oo);return sign(ao,this.pk)}};function parseUDCEvent(Xr){if(!Xr.events)throw new Error("UDC emitted event is empty");const eo=Xr.events.find(to=>cleanHex(to.from_address)===cleanHex(UDC.ADDRESS))||{data:[]};return{transaction_hash:Xr.transaction_hash,contract_address:eo.data[0],address:eo.data[0],deployer:eo.data[1],unique:eo.data[2],classHash:eo.data[3],calldata_len:eo.data[4],calldata:eo.data.slice(5,5+parseInt(eo.data[4],16)),salt:eo.data[eo.data.length-1]}}var Account=class extends Provider{constructor(Xr,eo,to,ro){super(Xr),this.deploySelf=this.deployAccount,this.address=eo.toLowerCase(),this.signer=typeof to=="string"||to instanceof Uint8Array?new Signer(to):to,ro&&(this.cairoVersion=ro.toString())}async getNonce(Xr){return super.getNonceForAddress(this.address,Xr)}async getNonceSafe(Xr){try{return toBigInt(Xr??await this.getNonce())}catch{return 0n}}async getCairoVersion(Xr){if(!this.cairoVersion){const{cairo:eo}=Xr?await super.getContractVersion(void 0,Xr):await super.getContractVersion(this.address);this.cairoVersion=eo}return this.cairoVersion}async estimateFee(Xr,eo){return this.estimateInvokeFee(Xr,eo)}async estimateInvokeFee(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro}={}){const no=Array.isArray(Xr)?Xr:[Xr],io=toBigInt(eo??await this.getNonce()),oo=toBigInt(feeTransactionVersion),ao=await this.getChainId(),so={walletAddress:this.address,nonce:io,maxFee:ZERO,version:oo,chainId:ao,cairoVersion:await this.getCairoVersion()},co=await this.buildInvocation(no,so),lo=await super.getInvokeEstimateFee({...co},{version:oo,nonce:io},to,ro),uo=estimatedFeeToMaxFee(lo.overall_fee);return{...lo,suggestedMaxFee:uo}}async estimateDeclareFee({contract:Xr,classHash:eo,casm:to,compiledClassHash:ro},{blockIdentifier:no,nonce:io,skipValidate:oo}={}){const ao=toBigInt(io??await this.getNonce()),so=isSierra(Xr)?feeTransactionVersion_2:feeTransactionVersion,co=await this.getChainId(),lo=await this.buildDeclarePayload({classHash:eo,contract:Xr,casm:to,compiledClassHash:ro},{nonce:ao,chainId:co,version:so,walletAddress:this.address,maxFee:ZERO,cairoVersion:void 0}),uo=await super.getDeclareEstimateFee(lo,{version:so,nonce:ao},no,oo),ho=estimatedFeeToMaxFee(uo.overall_fee);return{...uo,suggestedMaxFee:ho}}async estimateAccountDeployFee({classHash:Xr,addressSalt:eo=0,constructorCalldata:to=[],contractAddress:ro},{blockIdentifier:no,skipValidate:io}={}){const oo=toBigInt(feeTransactionVersion),ao=ZERO,so=await this.getChainId(),co=await this.buildAccountDeployPayload({classHash:Xr,addressSalt:eo,constructorCalldata:to,contractAddress:ro},{nonce:ao,chainId:so,version:oo,walletAddress:this.address,maxFee:ZERO,cairoVersion:void 0}),lo=await super.getDeployAccountEstimateFee({...co},{version:oo,nonce:ao},no,io),uo=estimatedFeeToMaxFee(lo.overall_fee);return{...lo,suggestedMaxFee:uo}}async estimateDeployFee(Xr,eo){const to=this.buildUDCContractPayload(Xr);return this.estimateInvokeFee(to,eo)}async estimateFeeBulk(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro}={}){const no=await this.accountInvocationsFactory(Xr,{versions:[feeTransactionVersion,feeTransactionVersion_2],nonce:eo,blockIdentifier:to}),io=await super.getEstimateFeeBulk(no,{blockIdentifier:to,skipValidate:ro});return[].concat(io).map(oo=>{const ao=estimatedFeeToMaxFee(oo.overall_fee);return{...oo,suggestedMaxFee:ao}})}async buildInvocation(Xr,eo){const to=getExecuteCalldata(Xr,await this.getCairoVersion()),ro=await this.signer.signTransaction(Xr,eo);return{contractAddress:this.address,calldata:to,signature:ro}}async execute(Xr,eo=void 0,to={}){const ro=Array.isArray(Xr)?Xr:[Xr],no=toBigInt(to.nonce??await this.getNonce()),io=to.maxFee??await this.getSuggestedMaxFee({type:"INVOKE_FUNCTION",payload:Xr},to),oo=toBigInt(transactionVersion),ao=await this.getChainId(),so={walletAddress:this.address,nonce:no,maxFee:io,version:oo,chainId:ao,cairoVersion:await this.getCairoVersion()},co=await this.signer.signTransaction(ro,so,eo),lo=getExecuteCalldata(ro,await this.getCairoVersion());return this.invokeFunction({contractAddress:this.address,calldata:lo,signature:co},{nonce:no,maxFee:io,version:oo})}async declareIfNot(Xr,eo={}){const to=extractContractHashes(Xr);try{await this.getClassByHash(to.classHash)}catch{return this.declare(Xr,eo)}return{transaction_hash:"",class_hash:to.classHash}}async declare(Xr,eo={}){const to=extractContractHashes(Xr),ro={};ro.nonce=toBigInt(eo.nonce??await this.getNonce()),ro.maxFee=eo.maxFee??await this.getSuggestedMaxFee({type:"DECLARE",payload:to},eo),ro.version=isSierra(Xr.contract)?transactionVersion_2:transactionVersion,ro.chainId=await this.getChainId();const no=await this.buildDeclarePayload(to,{...ro,walletAddress:this.address,cairoVersion:void 0});return this.declareContract(no,ro)}async deploy(Xr,eo){const to=[].concat(Xr).map(oo=>{const{classHash:ao,salt:so,unique:co=!0,constructorCalldata:lo=[]}=oo,uo=CallData.compile(lo),ho=so??randomAddress();return{call:{contractAddress:UDC.ADDRESS,entrypoint:UDC.ENTRYPOINT,calldata:[ao,ho,toCairoBool(co),uo.length,...uo]},address:calculateContractAddressFromHash(co?pedersen(this.address,ho):ho,ao,uo,co?UDC.ADDRESS:0)}}),ro=to.map(oo=>oo.call),no=to.map(oo=>oo.address);return{...await this.execute(ro,void 0,eo),contract_address:no}}async deployContract(Xr,eo){const to=await this.deploy(Xr,eo),ro=await this.waitForTransaction(to.transaction_hash);return parseUDCEvent(ro)}async declareAndDeploy(Xr,eo){const{constructorCalldata:to,salt:ro,unique:no}=Xr;let io=await this.declareIfNot(Xr,eo);if(io.transaction_hash!==""){const ao=await this.waitForTransaction(io.transaction_hash);io={...io,...ao}}const oo=await this.deployContract({classHash:io.class_hash,salt:ro,unique:no,constructorCalldata:to},eo);return{declare:{...io},deploy:oo}}async deployAccount({classHash:Xr,constructorCalldata:eo=[],addressSalt:to=0,contractAddress:ro},no={}){const io=toBigInt(transactionVersion),oo=ZERO,ao=await this.getChainId(),so=CallData.compile(eo),co=ro??calculateContractAddressFromHash(to,Xr,so,0),lo=no.maxFee??await this.getSuggestedMaxFee({type:"DEPLOY_ACCOUNT",payload:{classHash:Xr,constructorCalldata:so,addressSalt:to,contractAddress:co}},no),uo=await this.signer.signDeployAccountTransaction({classHash:Xr,constructorCalldata:so,contractAddress:co,addressSalt:to,chainId:ao,maxFee:lo,version:io,nonce:oo});return this.deployAccountContract({classHash:Xr,addressSalt:to,constructorCalldata:eo,signature:uo},{nonce:oo,maxFee:lo,version:io})}async signMessage(Xr){return this.signer.signMessage(Xr,this.address)}async hashMessage(Xr){return getMessageHash(Xr,this.address)}async verifyMessageHash(Xr,eo){try{return await this.callContract({contractAddress:this.address,entrypoint:"isValidSignature",calldata:CallData.compile({hash:toBigInt(Xr).toString(),signature:formatSignature(eo)})}),!0}catch{return!1}}async verifyMessage(Xr,eo){const to=await this.hashMessage(Xr);return this.verifyMessageHash(to,eo)}async getSuggestedMaxFee({type:Xr,payload:eo},to){let ro;switch(Xr){case"INVOKE_FUNCTION":ro=await this.estimateInvokeFee(eo,to);break;case"DECLARE":ro=await this.estimateDeclareFee(eo,to);break;case"DEPLOY_ACCOUNT":ro=await this.estimateAccountDeployFee(eo,to);break;case"DEPLOY":ro=await this.estimateDeployFee(eo,to);break;default:ro={suggestedMaxFee:ZERO,overall_fee:ZERO};break}return ro.suggestedMaxFee}async buildDeclarePayload(Xr,{nonce:eo,chainId:to,version:ro,walletAddress:no,maxFee:io}){const{classHash:oo,contract:ao,compiledClassHash:so}=extractContractHashes(Xr),co=parseContract(ao),lo=await this.signer.signDeclareTransaction({classHash:oo,compiledClassHash:so,senderAddress:no,chainId:to,maxFee:io,version:ro,nonce:eo});return{senderAddress:no,signature:lo,contract:co,compiledClassHash:so}}async buildAccountDeployPayload({classHash:Xr,addressSalt:eo=0,constructorCalldata:to=[],contractAddress:ro},{nonce:no,chainId:io,version:oo,maxFee:ao}){const so=CallData.compile(to),co=ro??calculateContractAddressFromHash(eo,Xr,so,0),lo=await this.signer.signDeployAccountTransaction({classHash:Xr,contractAddress:co,chainId:io,maxFee:ao,version:oo,nonce:no,addressSalt:eo,constructorCalldata:so});return{classHash:Xr,addressSalt:eo,constructorCalldata:so,signature:lo}}buildUDCContractPayload(Xr){return[].concat(Xr).map(to=>{const{classHash:ro,salt:no="0",unique:io=!0,constructorCalldata:oo=[]}=to,ao=CallData.compile(oo);return{contractAddress:UDC.ADDRESS,entrypoint:UDC.ENTRYPOINT,calldata:[ro,no,toCairoBool(io),ao.length,...ao]}})}async simulateTransaction(Xr,{nonce:eo,blockIdentifier:to,skipValidate:ro,skipExecute:no}={}){const io=await this.accountInvocationsFactory(Xr,{versions:[transactionVersion,transactionVersion_2],nonce:eo,blockIdentifier:to});return super.getSimulateTransaction(io,{blockIdentifier:to,skipValidate:ro,skipExecute:no})}async accountInvocationsFactory(Xr,{versions:eo,nonce:to,blockIdentifier:ro}){const no=eo[0],io=await this.getNonceSafe(to),oo=await this.getChainId(),ao="payload"in Xr[0]?Xr[0].payload:Xr[0],so=Xr[0].type==="DEPLOY_ACCOUNT"?await this.getCairoVersion(ao.classHash):await this.getCairoVersion();return Promise.all([].concat(Xr).map(async(co,lo)=>{const uo="payload"in co?co.payload:co,ho={walletAddress:this.address,nonce:toBigInt(Number(io)+lo),maxFee:ZERO,version:no,chainId:oo,cairoVersion:so},go={type:co.type,version:no,nonce:toBigInt(Number(io)+lo),blockIdentifier:ro};if(co.type==="INVOKE_FUNCTION"){const bo=await this.buildInvocation([].concat(uo),ho);return{...go,...bo}}if(co.type==="DECLARE"){ho.version=isSierra(uo.contract)?toBigInt(eo[1]):toBigInt(eo[0]);const bo=await this.buildDeclarePayload(uo,ho);return{...go,...bo,version:ho.version}}if(co.type==="DEPLOY_ACCOUNT"){const bo=await this.buildAccountDeployPayload(uo,ho);return{...go,...bo}}if(co.type==="DEPLOY"){const bo=this.buildUDCContractPayload(uo),wo=await this.buildInvocation(bo,ho);return{...go,...wo,type:"INVOKE_FUNCTION"}}throw Error(`accountInvocationsFactory: unsupported transaction type: ${co}`)}))}async getStarkName(Xr=this.address,eo){return super.getStarkName(Xr,eo)}},defaultProvider=new Provider({rpc:{default:!0}}),events_exports={};__export(events_exports,{getAbiEvents:()=>getAbiEvents,parseEvents:()=>parseEvents});function getAbiEvents(Xr){return Xr.filter(eo=>eo.type==="event"&&(eo.size||eo.kind!=="enum")).reduce((eo,to)=>{const ro=to.name.slice(to.name.lastIndexOf(":")+1),no={...to};return no.name=ro,{...eo,[addHexPrefix(keccak(utf8ToArray(ro)).toString(16))]:no}},{})}function parseEvents(Xr,eo,to,ro){return Xr.flat().reduce((io,oo)=>{var go,bo;const ao=eo[oo.keys[0]];if(!ao)return io;const so={};so[ao.name]={},oo.keys.shift();const co=oo.keys[Symbol.iterator](),lo=oo.data[Symbol.iterator](),uo=((go=ao.members)==null?void 0:go.filter(wo=>wo.kind==="key"))||ao.keys,ho=((bo=ao.members)==null?void 0:bo.filter(wo=>wo.kind==="data"))||ao.data;return uo.forEach(wo=>{so[ao.name][wo.name]=responseParser(co,wo,to,ro,so[ao.name])}),ho.forEach(wo=>{so[ao.name][wo.name]=responseParser(lo,wo,to,ro,so[ao.name])}),io.push(so),io},[])}var splitArgsAndOptions=Xr=>{const eo=["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"],to=Xr[Xr.length-1];return typeof to=="object"&&eo.some(ro=>ro in to)?{args:Xr,options:Xr.pop()}:{args:Xr}};function buildCall(Xr,eo){return async function(...to){const ro=splitArgsAndOptions(to);return Xr.call(eo.name,ro.args,{parseRequest:!0,parseResponse:!0,...ro.options})}}function buildInvoke(Xr,eo){return async function(...to){const ro=splitArgsAndOptions(to);return Xr.invoke(eo.name,ro.args,{parseRequest:!0,...ro.options})}}function buildDefault(Xr,eo){return eo.stateMutability==="view"||eo.state_mutability==="view"?buildCall(Xr,eo):buildInvoke(Xr,eo)}function buildPopulate(Xr,eo){return function(...to){return Xr.populate(eo.name,to)}}function buildEstimate(Xr,eo){return function(...to){return Xr.estimate(eo.name,to)}}function getCalldata(Xr,eo){return Array.isArray(Xr)&&"__compiled__"in Xr?Xr:Array.isArray(Xr)&&Array.isArray(Xr[0])&&"__compiled__"in Xr[0]?Xr[0]:eo()}var Contract=class{constructor(Xr,eo,to=defaultProvider){this.address=eo&&eo.toLowerCase(),this.providerOrAccount=to,this.callData=new CallData(Xr),this.structs=CallData.getAbiStruct(Xr),this.events=getAbiEvents(Xr);const ro=createAbiParser(Xr);this.abi=ro.getLegacyFormat();const no={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach(io=>{if(io.type!=="function")return;const oo=io.name;this[oo]||Object.defineProperty(this,oo,{...no,value:buildDefault(this,io)}),this.functions[oo]||Object.defineProperty(this.functions,oo,{...no,value:buildDefault(this,io)}),this.callStatic[oo]||Object.defineProperty(this.callStatic,oo,{...no,value:buildCall(this,io)}),this.populateTransaction[oo]||Object.defineProperty(this.populateTransaction,oo,{...no,value:buildPopulate(this,io)}),this.estimateFee[oo]||Object.defineProperty(this.estimateFee,oo,{...no,value:buildEstimate(this,io)})})}attach(Xr){this.address=Xr}connect(Xr){this.providerOrAccount=Xr}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(Xr,eo=[],{parseRequest:to=!0,parseResponse:ro=!0,formatResponse:no=void 0,blockIdentifier:io=void 0}={}){assert$2(this.address!==null,"contract is not connected to an address");const oo=getCalldata(eo,()=>to?(this.callData.validate("CALL",Xr,eo),this.callData.compile(Xr,eo)):(console.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),eo));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:oo,entrypoint:Xr},io).then(ao=>ro?no?this.callData.format(Xr,ao.result,no):this.callData.parse(Xr,ao.result):ao.result)}invoke(Xr,eo=[],{parseRequest:to=!0,maxFee:ro,nonce:no,signature:io}={}){assert$2(this.address!==null,"contract is not connected to an address");const oo=getCalldata(eo,()=>to?(this.callData.validate("INVOKE",Xr,eo),this.callData.compile(Xr,eo)):(console.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),eo)),ao={contractAddress:this.address,calldata:oo,entrypoint:Xr};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(ao,void 0,{maxFee:ro,nonce:no});if(!no)throw new Error("Nonce is required when invoking a function without an account");return console.warn(`Invoking ${Xr} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...ao,signature:io},{nonce:no})}async estimate(Xr,eo=[]){assert$2(this.address!==null,"contract is not connected to an address"),getCalldata(eo,()=>!1)||this.callData.validate("INVOKE",Xr,eo);const to=this.populate(Xr,eo);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(to);throw Error("Contract must be connected to the account contract to estimate")}populate(Xr,eo=[]){const to=getCalldata(eo,()=>this.callData.compile(Xr,eo));return{contractAddress:this.address,entrypoint:Xr,calldata:to}}parseEvents(Xr){var eo;return parseEvents(((eo=Xr.events)==null?void 0:eo.filter(to=>cleanHex(to.from_address)===cleanHex(this.address),[]))||[],this.events,this.structs,CallData.getAbiEnum(this.abi))}isCairo1(){return cairo_exports.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typed(Xr){return this}};const ETH_STARKNET_ADDRESS="0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";var ETH_CONTRACT_ABI=[{members:[{name:"low",offset:0,type:"felt"},{name:"high",offset:1,type:"felt"}],name:"Uint256",size:2,type:"struct"},{data:[{name:"from_",type:"felt"},{name:"to",type:"felt"},{name:"value",type:"Uint256"}],keys:[],name:"Transfer",type:"event"},{data:[{name:"owner",type:"felt"},{name:"spender",type:"felt"},{name:"value",type:"Uint256"}],keys:[],name:"Approval",type:"event"},{inputs:[],name:"name",outputs:[{name:"name",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{name:"symbol",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{name:"totalSupply",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"decimals",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"felt"}],name:"balanceOf",outputs:[{name:"balance",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"felt"},{name:"spender",type:"felt"}],name:"allowance",outputs:[{name:"remaining",type:"Uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"permittedMinter",outputs:[{name:"minter",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialized",outputs:[{name:"res",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"get_version",outputs:[{name:"version",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[],name:"get_identity",outputs:[{name:"identity",type:"felt"}],stateMutability:"view",type:"function"},{inputs:[{name:"init_vector_len",type:"felt"},{name:"init_vector",type:"felt*"}],name:"initialize",outputs:[],type:"function"},{inputs:[{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"transfer",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"sender",type:"felt"},{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"transferFrom",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"amount",type:"Uint256"}],name:"approve",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"added_value",type:"Uint256"}],name:"increaseAllowance",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"spender",type:"felt"},{name:"subtracted_value",type:"Uint256"}],name:"decreaseAllowance",outputs:[{name:"success",type:"felt"}],type:"function"},{inputs:[{name:"recipient",type:"felt"},{name:"amount",type:"Uint256"}],name:"permissionedMint",outputs:[],type:"function"},{inputs:[{name:"account",type:"felt"},{name:"amount",type:"Uint256"}],name:"permissionedBurn",outputs:[],type:"function"}];const defaultTypedData={primaryType:"Message",types:{Message:[{name:"message",type:"felt"}],StarkNetDomain:[{name:"name",type:"felt"},{name:"chainId",type:"felt"},{name:"version",type:"felt"}]}},formatTypedDataMessage=(Xr,eo=constants_exports.NetworkName.SN_MAIN)=>{let to,ro;try{const{nonce:io,domain:oo}=JSON.parse(Xr);to=io,ro=oo}catch{to=Xr,ro="domain"}const no={message:to.substring(0,31)};return Object.assign(Object.assign({},defaultTypedData),{domain:{chainId:eo,name:ro.substring(0,31),version:"0.0.1"},message:no})};class StarknetWallet extends Wallet$1{getWalletAccount(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this._connector.getWalletAccount();if(!eo)throw new Error("unable to retrieve Starknet wallet account");return wrapMethodWithCallback(eo,"signMessage",(to,ro)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro)})),eo})}getProvider(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this._connector.getProvider();if(!eo)throw new Error("unable to retrieve Starknet provider");return wrapMethodWithCallback(eo,"callContract",(to,ro,no)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro,no)})),wrapMethodWithCallback(eo,"deployAccountContract",(to,ro,no)=>__awaiter(this,void 0,void 0,function*(){return yield this.sync(),to(ro,no)})),eo})}}const ACCOUNT_CHANGED_EVENT_LISTENER="accountsChanged",NETWORK_CHANGED_EVENT_LISTENER="networkChanged";class StarknetWalletConnector extends WalletConnectorBase{constructor(eo,to,ro){var no;super(ro),this.STARKNET_VERSION="v5",this.ChainWallet=StarknetWallet,this.connectedChain="STARK",this.supportedChains=["STARK"],this.switchNetworkOnlyFromWallet=!0,this.canSetEventListeners=!0,this.name=eo,this.windowKey=to,this.starknetNetworks=ro.starknetNetworks,this.chainRpcProviders=ro.chainRpcProviders,(no=this.chainRpcProviders)===null||no===void 0||no.registerStarknetProviders()}get walletBookWallet(){return this.walletBook.wallets[this.key]}isProviderConnected(){var eo;const to=this.getWallet();return(eo=to==null?void 0:to.isConnected)!==null&&eo!==void 0?eo:!1}getPublicClient(){return __awaiter(this,void 0,void 0,function*(){var eo;if(this.starknetNetworks===void 0||this.starknetNetworks.length===0)return;const to={cosmos:[],evm:void 0,solana:void 0,starknet:this.starknetNetworks},ro=yield this.getNetwork(),no=(eo=this.chainRpcProviders)===null||eo===void 0?void 0:eo.getStarknetRpcProviderByChainId(to,ro);return no==null?void 0:no.provider})}getNetwork(){return __awaiter(this,void 0,void 0,function*(){var eo;const to=this.getWallet();return to?(this.isProviderConnected()||(yield to.enable({starknetVersion:this.STARKNET_VERSION})),Promise.resolve((eo=to.provider)===null||eo===void 0?void 0:eo.getChainId())):Promise.resolve(void 0)})}connect(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();try{eo&&!this.isProviderConnected()&&(yield eo.enable({starknetVersion:this.STARKNET_VERSION}),localStorage.setItem("dynamic_should_have_wallet","true"))}catch(to){logger$9.error(to)}})}getAddress(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();if(!this.isInstalledOnBrowser()&&isMobile$1()&&this.walletBookWallet.mobile&&this.walletBookWallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const ro=template$1(this.walletBookWallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(ro)}return eo&&!this.isProviderConnected()&&(yield eo==null?void 0:eo.isPreauthorized(),yield this.connect()),Promise.resolve(eo==null?void 0:eo.selectedAddress)})}getWalletAccount(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();return eo==null?void 0:eo.account})}getProvider(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this.getWallet();return eo==null?void 0:eo.provider})}signMessage(eo){return __awaiter(this,void 0,void 0,function*(){const to=yield this.getAddress(),ro=this.getWallet();if(!to||!ro){logger$9.error("Could not fetch wallet address for signing message");return}const no=formatTypedDataMessage(eo,yield ro.provider.getChainId()),io=yield ro.account.signMessage(no);return io==null?void 0:io.join(",")})}getBalance(eo){return __awaiter(this,void 0,void 0,function*(){const to=yield this.getProvider();if(!to){logger$9.error("Could not find provider for getting balance");return}const ro=new Contract(ETH_CONTRACT_ABI,ETH_STARKNET_ADDRESS,to);try{const{balance:no}=yield ro.balanceOf(eo);return(Number(cairo_exports.uint256(no.low).low)/1e18).toFixed(6)}catch(no){throw logger$9.error(no),new DynamicError("Something went wrong")}})}endSession(){return __awaiter(this,void 0,void 0,function*(){localStorage.removeItem("dynamic_should_have_wallet"),W$3().disconnect({clearLastWallet:!0})})}getWallet(){let eo=window[`starknet_${this.windowKey}`];if(eo!==void 0)return eo;if(eo=window.starknet,(eo==null?void 0:eo.name)===this.name)return eo}isInstalledOnBrowser(){return this.getWallet()!==void 0}getConnectedAccounts(){return __awaiter(this,void 0,void 0,function*(){const eo=this.getWallet();if(!eo)return[];try{yield this.reconnectIfNeeded(eo)}catch{return[]}return retryableFn(()=>eo.selectedAddress?Promise.resolve([eo.selectedAddress]):Promise.reject(),{fallbackValue:[],retryIntervalMs:100,retryStrategy:"timeout-and-rejection"})})}reconnectIfNeeded(eo){return __awaiter(this,void 0,void 0,function*(){if(!this.isProviderConnected()&&(yield eo.isPreauthorized()))if(localStorage.getItem("dynamic_should_have_wallet")==="true")try{yield retryableFn(this.connect.bind(this),{maxRetries:0,retryStrategy:"timeout-only",timeoutMs:1e3})}catch{throw localStorage.removeItem("dynamic_should_have_wallet"),new Error("Could not reconnect")}else yield this.connect()})}setupEventListeners(){if(!this.canSetEventListeners)return;const eo=this.getWallet();if(!eo)return logger$9.error("Wallet has not been found");this.handleAccountChange=to=>__awaiter(this,void 0,void 0,function*(){if(!to){this.emit("disconnect");return}to.toString()&&this.emit("accountChange",{accounts:[to.toString()]})}),this.handleNetworkChange=to=>__awaiter(this,void 0,void 0,function*(){if(!to){this.emit("disconnect");return}const ro=this.mapNetworkNameToChainId(to.toString());ro&&this.emit("chainChange",{chain:ro})}),eo==null||eo.on(ACCOUNT_CHANGED_EVENT_LISTENER,this.handleAccountChange),eo==null||eo.on(NETWORK_CHANGED_EVENT_LISTENER,this.handleNetworkChange)}teardownEventListeners(){return __awaiter(this,void 0,void 0,function*(){if(!this.canSetEventListeners)return;const eo=this.getWallet();this.handleAccountChange&&(eo==null||eo.off(ACCOUNT_CHANGED_EVENT_LISTENER,this.handleAccountChange),this.handleAccountChange=void 0),this.handleNetworkChange&&(eo==null||eo.off(NETWORK_CHANGED_EVENT_LISTENER,this.handleNetworkChange),this.handleNetworkChange=void 0)})}mapNetworkNameToChainId(eo){if(eo===constants_exports.NetworkName.SN_MAIN||eo.includes("mainnet")||eo===constants_exports.StarknetChainId.SN_MAIN)return constants_exports.StarknetChainId.SN_MAIN;if(eo===constants_exports.NetworkName.SN_GOERLI||eo.includes("goerli")||eo===constants_exports.StarknetChainId.SN_GOERLI)return constants_exports.StarknetChainId.SN_GOERLI;if(eo===constants_exports.NetworkName.SN_SEPOLIA||eo.includes("sepolia")||eo===constants_exports.StarknetChainId.SN_SEPOLIA)return constants_exports.StarknetChainId.SN_SEPOLIA;logger$9.error("Unknown networkName",eo)}mapChainIdToNetworkName(eo){if(eo===constants_exports.StarknetChainId.SN_MAIN||eo===constants_exports.NetworkName.SN_MAIN)return constants_exports.NetworkName.SN_MAIN;if(eo===constants_exports.StarknetChainId.SN_GOERLI||eo===constants_exports.NetworkName.SN_GOERLI)return constants_exports.NetworkName.SN_GOERLI;if(eo===constants_exports.StarknetChainId.SN_SEPOLIA||eo===constants_exports.NetworkName.SN_SEPOLIA)return constants_exports.NetworkName.SN_SEPOLIA;logger$9.error("Unknown chainId",eo)}}class ArgentX extends StarknetWalletConnector{constructor(eo){super("Argent X","argentX",eo),this.overrideKey="argentx"}getConnectedAccounts(){return __awaiter(this,void 0,void 0,function*(){const eo=yield this.getAddress();return eo?[eo]:[]})}}class Braavos extends StarknetWalletConnector{constructor(eo){super("Braavos","braavos",eo),this.overrideKey="braavos"}getAddress(){const eo=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return eo.getAddress.call(this);const ro=`starknet://dapp/${window.location.toString().replace(/http(s)?:\/\//,"")}`;return isMobile$1()&&window.location.assign(ro),Promise.resolve(void 0)})}}var x=Object.defineProperty,O$3=(Xr,eo,to)=>eo in Xr?x(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,h$1=(Xr,eo,to)=>(O$3(Xr,typeof eo!="symbol"?eo+"":eo,to),to);let P$1=class extends Error{constructor(){super(...arguments),h$1(this,"name","ConnectorNotConnectedError"),h$1(this,"message","Connector not connected")}},U$2=class extends Error{constructor(){super(...arguments),h$1(this,"name","ConnectorNotFoundError"),h$1(this,"message","Connector not found")}},A$2=class extends Error{constructor(){super(...arguments),h$1(this,"name","UserRejectedRequestError"),h$1(this,"message","User rejected request")}},S$1=class extends Error{constructor(){super(...arguments),h$1(this,"name","UserNotConnectedError"),h$1(this,"message","User not connected")}};var F$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{};function L$3(Xr){return Xr&&Xr.__esModule&&Object.prototype.hasOwnProperty.call(Xr,"default")?Xr.default:Xr}function R$2(Xr){if(Xr.__esModule)return Xr;var eo=Xr.default;if(typeof eo=="function"){var to=function ro(){if(this instanceof ro){var no=[null];no.push.apply(no,arguments);var io=Function.bind.apply(eo,no);return new io}return eo.apply(this,arguments)};to.prototype=eo.prototype}else to={};return Object.defineProperty(to,"__esModule",{value:!0}),Object.keys(Xr).forEach(function(ro){var no=Object.getOwnPropertyDescriptor(Xr,ro);Object.defineProperty(to,ro,no.get?no:{enumerable:!0,get:function(){return Xr[ro]}})}),to}var C$2={exports:{}};(function(Xr){var eo=Object.prototype.hasOwnProperty,to="~";function ro(){}Object.create&&(ro.prototype=Object.create(null),new ro().__proto__||(to=!1));function no(so,co,lo){this.fn=so,this.context=co,this.once=lo||!1}function io(so,co,lo,uo,ho){if(typeof lo!="function")throw new TypeError("The listener must be a function");var go=new no(lo,uo||so,ho),bo=to?to+co:co;return so._events[bo]?so._events[bo].fn?so._events[bo]=[so._events[bo],go]:so._events[bo].push(go):(so._events[bo]=go,so._eventsCount++),so}function oo(so,co){--so._eventsCount===0?so._events=new ro:delete so._events[co]}function ao(){this._events=new ro,this._eventsCount=0}ao.prototype.eventNames=function(){var so=[],co,lo;if(this._eventsCount===0)return so;for(lo in co=this._events)eo.call(co,lo)&&so.push(to?lo.slice(1):lo);return Object.getOwnPropertySymbols?so.concat(Object.getOwnPropertySymbols(co)):so},ao.prototype.listeners=function(so){var co=to?to+so:so,lo=this._events[co];if(!lo)return[];if(lo.fn)return[lo.fn];for(var uo=0,ho=lo.length,go=new Array(ho);uo{localStorage.setItem("starknetLastConnectedWallet",Xr)},q$2=()=>{localStorage.removeItem("starknetLastConnectedWallet")},a={mainnet:"https://starknet-mainnet.public.blastapi.io",testnet:"https://starknet-testnet.public.blastapi.io"},e={mainnet:"https://rpc.starknet.lava.build",testnet:"https://rpc.starknet-testnet.lava.build"},t=[a,e];function s(){const Xr=Math.floor(Math.random()*t.length);return t[Xr]}var define_globalThis_process_env_default={},en=Object.defineProperty,tn=(Xr,eo,to)=>eo in Xr?en(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,ie$1=(Xr,eo,to)=>(tn(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const sr$1="https://web.argent.xyz",$t$1=` - `;function un(Xr){return Xr}function ln(Xr){return Xr.length===0?un:Xr.length===1?Xr[0]:function(eo){return Xr.reduce((to,ro)=>ro(to),eo)}}function dn(Xr){return typeof Xr=="object"&&Xr!==null&&"subscribe"in Xr}function Ye$1(Xr){const eo={subscribe(to){let ro=null,no=!1,io=!1,oo=!1;function ao(){if(ro===null){oo=!0;return}io||(io=!0,typeof ro=="function"?ro():ro&&ro.unsubscribe())}return ro=Xr({next(so){var co;no||((co=to.next)==null||co.call(to,so))},error(so){var co;no||(no=!0,(co=to.error)==null||co.call(to,so),ao())},complete(){var so;no||(no=!0,(so=to.complete)==null||so.call(to),ao())}}),oo&&ao(),{unsubscribe:ao}},pipe(...to){return ln(to)(eo)}};return eo}function ir$1(Xr){return eo=>{let to=0,ro=null;const no=[];function io(){ro||(ro=eo.subscribe({next(ao){var so;for(const co of no)(so=co.next)==null||so.call(co,ao)},error(ao){var so;for(const co of no)(so=co.error)==null||so.call(co,ao)},complete(){var ao;for(const so of no)(ao=so.complete)==null||ao.call(so)}}))}function oo(){if(to===0&&ro){const ao=ro;ro=null,ao.unsubscribe()}}return{subscribe(ao){return to++,no.push(ao),io(),{unsubscribe(){to--,oo();const so=no.findIndex(co=>co===ao);so>-1&&no.splice(so,1)}}}}}}function fn(Xr){return eo=>({subscribe(to){let ro=0;return eo.subscribe({next(no){var io;(io=to.next)==null||io.call(to,Xr(no,ro++))},error(no){var io;(io=to.error)==null||io.call(to,no)},complete(){var no;(no=to.complete)==null||no.call(to)}})}})}function ar$1(Xr){return eo=>({subscribe(to){return eo.subscribe({next(ro){var no,io;(no=Xr.next)==null||no.call(Xr,ro),(io=to.next)==null||io.call(to,ro)},error(ro){var no,io;(no=Xr.error)==null||no.call(Xr,ro),(io=to.error)==null||io.call(to,ro)},complete(){var ro,no;(ro=Xr.complete)==null||ro.call(Xr),(no=to.complete)==null||no.call(to)}})}})}let pn=class O_ extends Error{constructor(eo){super(eo),this.name="ObservableAbortError",Object.setPrototypeOf(this,O_.prototype)}};function cr$1(Xr){let eo;return{promise:new Promise((to,ro)=>{let no=!1;function io(){no||(no=!0,ro(new pn("This operation was aborted.")),oo.unsubscribe())}const oo=Xr.subscribe({next(ao){no=!0,to(ao),io()},error(ao){no=!0,ro(ao),io()},complete(){no=!0,io()}});eo=io}),abort:eo}}const hn=Object.freeze(Object.defineProperty({__proto__:null,isObservable:dn,map:fn,observable:Ye$1,observableToPromise:cr$1,share:ir$1,tap:ar$1},Symbol.toStringTag,{value:"Module"}));function ur$1(Xr){return Ye$1(eo=>{function to(ro=0,no=Xr.op){const io=Xr.links[ro];if(!io)throw new Error("No more links to execute - did you forget to add an ending link?");return io({op:no,next(oo){return to(ro+1,oo)}})}return to().subscribe(eo)})}function Dt$1(Xr){return Array.isArray(Xr)?Xr:[Xr]}function mn(Xr){return eo=>{const to=Dt$1(Xr.true).map(no=>no(eo)),ro=Dt$1(Xr.false).map(no=>no(eo));return no=>Ye$1(io=>{const oo=Xr.condition(no.op)?to:ro;return ur$1({op:no.op,links:oo}).subscribe(io)})}}function yn(Xr){return Xr instanceof lr$1||Xr.name==="TRPCClientError"}let lr$1=class Xy extends Error{static from(eo,to={}){return eo instanceof Error?yn(eo)?(to.meta&&(eo.meta={...eo.meta,...to.meta}),eo):new Xy(eo.message,{...to,cause:eo,result:null}):new Xy(eo.error.message??"",{...to,cause:void 0,result:eo})}constructor(eo,to){var no,io;const ro=to==null?void 0:to.cause;super(eo,{cause:ro}),this.meta=to==null?void 0:to.meta,this.cause=ro,this.shape=(no=to==null?void 0:to.result)==null?void 0:no.error,this.data=(io=to==null?void 0:to.result)==null?void 0:io.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Xy.prototype)}};function dr$1(Xr){const eo=Object.create(null);for(const to in Xr){const ro=Xr[to];eo[ro]=to}return eo}const Qe$1={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};dr$1(Qe$1);dr$1(Qe$1);const gn={PARSE_ERROR:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,FORBIDDEN:403,METHOD_NOT_SUPPORTED:405,TIMEOUT:408,CONFLICT:409,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNPROCESSABLE_CONTENT:422,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501};function _n(Xr){return gn[Xr]??500}function fr(Xr){return _n(Xr.code)}const pr=()=>{};function hr(Xr,eo){return new Proxy(pr,{get(to,ro){if(!(typeof ro!="string"||ro==="then"))return hr(Xr,[...eo,ro])},apply(to,ro,no){const io=eo[eo.length-1]==="apply";return Xr({args:io?no.length>=2?no[1]:[]:no,path:io?eo.slice(0,-1):eo})}})}const xt$1=Xr=>hr(Xr,[]),Tt$1=Xr=>new Proxy(pr,{get(eo,to){if(!(typeof to!="string"||to==="then"))return Xr(to)}});function bn(Xr){const{path:eo,error:to,config:ro}=Xr,{code:no}=Xr.error,io={message:to.message,code:Qe$1[no],data:{code:no,httpStatus:fr(to)}};return ro.isDev&&typeof Xr.error.stack=="string"&&(io.data.stack=Xr.error.stack),typeof eo=="string"&&(io.data.path=eo),ro.errorFormatter({...Xr,shape:io})}function Zt$1(Xr,eo){return"error"in eo?{...eo,error:Xr.transformer.output.serialize(eo.error)}:"data"in eo.result?{...eo,result:{...eo.result,data:Xr.transformer.output.serialize(eo.result.data)}}:eo}function vn(Xr,eo){return Array.isArray(eo)?eo.map(to=>Zt$1(Xr,to)):Zt$1(Xr,eo)}const wn=Object.freeze(Object.defineProperty({__proto__:null,createFlatProxy:Tt$1,createRecursiveProxy:xt$1,getErrorShape:bn,transformTRPCResponse:vn},Symbol.toStringTag,{value:"Module"}));function xn(Xr){return typeof FormData>"u"?!1:Xr instanceof FormData}const ct$1={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Tn(Xr){const{direction:eo,type:to,path:ro,id:no,input:io}=Xr,oo=[],ao=[];if(Xr.colorMode==="ansi"){const[fo,ho]=ct$1.ansi.regular[to],[go,yo]=ct$1.ansi.bold[to];return oo.push(eo==="up"?fo:ho,eo==="up"?">>":"<<",to,eo==="up"?go:yo,`#${no}`,ro,"\x1B[0m"),eo==="up"?ao.push({input:Xr.input}):ao.push({input:Xr.input,result:"result"in Xr.result?Xr.result.result:Xr.result,elapsedMs:Xr.elapsedMs}),{parts:oo,args:ao}}const[so,co]=ct$1.css[to],lo=` + `;function un(Xr){return Xr}function ln(Xr){return Xr.length===0?un:Xr.length===1?Xr[0]:function(eo){return Xr.reduce((to,ro)=>ro(to),eo)}}function dn(Xr){return typeof Xr=="object"&&Xr!==null&&"subscribe"in Xr}function Ye$1(Xr){const eo={subscribe(to){let ro=null,no=!1,io=!1,oo=!1;function ao(){if(ro===null){oo=!0;return}io||(io=!0,typeof ro=="function"?ro():ro&&ro.unsubscribe())}return ro=Xr({next(so){var co;no||((co=to.next)==null||co.call(to,so))},error(so){var co;no||(no=!0,(co=to.error)==null||co.call(to,so),ao())},complete(){var so;no||(no=!0,(so=to.complete)==null||so.call(to),ao())}}),oo&&ao(),{unsubscribe:ao}},pipe(...to){return ln(to)(eo)}};return eo}function ir$1(Xr){return eo=>{let to=0,ro=null;const no=[];function io(){ro||(ro=eo.subscribe({next(ao){var so;for(const co of no)(so=co.next)==null||so.call(co,ao)},error(ao){var so;for(const co of no)(so=co.error)==null||so.call(co,ao)},complete(){var ao;for(const so of no)(ao=so.complete)==null||ao.call(so)}}))}function oo(){if(to===0&&ro){const ao=ro;ro=null,ao.unsubscribe()}}return{subscribe(ao){return to++,no.push(ao),io(),{unsubscribe(){to--,oo();const so=no.findIndex(co=>co===ao);so>-1&&no.splice(so,1)}}}}}}function fn(Xr){return eo=>({subscribe(to){let ro=0;return eo.subscribe({next(no){var io;(io=to.next)==null||io.call(to,Xr(no,ro++))},error(no){var io;(io=to.error)==null||io.call(to,no)},complete(){var no;(no=to.complete)==null||no.call(to)}})}})}function ar$1(Xr){return eo=>({subscribe(to){return eo.subscribe({next(ro){var no,io;(no=Xr.next)==null||no.call(Xr,ro),(io=to.next)==null||io.call(to,ro)},error(ro){var no,io;(no=Xr.error)==null||no.call(Xr,ro),(io=to.error)==null||io.call(to,ro)},complete(){var ro,no;(ro=Xr.complete)==null||ro.call(Xr),(no=to.complete)==null||no.call(to)}})}})}let pn=class pC extends Error{constructor(eo){super(eo),this.name="ObservableAbortError",Object.setPrototypeOf(this,pC.prototype)}};function cr$1(Xr){let eo;return{promise:new Promise((to,ro)=>{let no=!1;function io(){no||(no=!0,ro(new pn("This operation was aborted.")),oo.unsubscribe())}const oo=Xr.subscribe({next(ao){no=!0,to(ao),io()},error(ao){no=!0,ro(ao),io()},complete(){no=!0,io()}});eo=io}),abort:eo}}const hn=Object.freeze(Object.defineProperty({__proto__:null,isObservable:dn,map:fn,observable:Ye$1,observableToPromise:cr$1,share:ir$1,tap:ar$1},Symbol.toStringTag,{value:"Module"}));function ur$1(Xr){return Ye$1(eo=>{function to(ro=0,no=Xr.op){const io=Xr.links[ro];if(!io)throw new Error("No more links to execute - did you forget to add an ending link?");return io({op:no,next(oo){return to(ro+1,oo)}})}return to().subscribe(eo)})}function Dt$1(Xr){return Array.isArray(Xr)?Xr:[Xr]}function mn(Xr){return eo=>{const to=Dt$1(Xr.true).map(no=>no(eo)),ro=Dt$1(Xr.false).map(no=>no(eo));return no=>Ye$1(io=>{const oo=Xr.condition(no.op)?to:ro;return ur$1({op:no.op,links:oo}).subscribe(io)})}}function yn(Xr){return Xr instanceof lr$1||Xr.name==="TRPCClientError"}let lr$1=class h_ extends Error{static from(eo,to={}){return eo instanceof Error?yn(eo)?(to.meta&&(eo.meta={...eo.meta,...to.meta}),eo):new h_(eo.message,{...to,cause:eo,result:null}):new h_(eo.error.message??"",{...to,cause:void 0,result:eo})}constructor(eo,to){var no,io;const ro=to==null?void 0:to.cause;super(eo,{cause:ro}),this.meta=to==null?void 0:to.meta,this.cause=ro,this.shape=(no=to==null?void 0:to.result)==null?void 0:no.error,this.data=(io=to==null?void 0:to.result)==null?void 0:io.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,h_.prototype)}};function dr$1(Xr){const eo=Object.create(null);for(const to in Xr){const ro=Xr[to];eo[ro]=to}return eo}const Qe$1={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};dr$1(Qe$1);dr$1(Qe$1);const gn={PARSE_ERROR:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,FORBIDDEN:403,METHOD_NOT_SUPPORTED:405,TIMEOUT:408,CONFLICT:409,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNPROCESSABLE_CONTENT:422,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501};function _n(Xr){return gn[Xr]??500}function fr(Xr){return _n(Xr.code)}const pr=()=>{};function hr(Xr,eo){return new Proxy(pr,{get(to,ro){if(!(typeof ro!="string"||ro==="then"))return hr(Xr,[...eo,ro])},apply(to,ro,no){const io=eo[eo.length-1]==="apply";return Xr({args:io?no.length>=2?no[1]:[]:no,path:io?eo.slice(0,-1):eo})}})}const xt$1=Xr=>hr(Xr,[]),Tt$1=Xr=>new Proxy(pr,{get(eo,to){if(!(typeof to!="string"||to==="then"))return Xr(to)}});function bn(Xr){const{path:eo,error:to,config:ro}=Xr,{code:no}=Xr.error,io={message:to.message,code:Qe$1[no],data:{code:no,httpStatus:fr(to)}};return ro.isDev&&typeof Xr.error.stack=="string"&&(io.data.stack=Xr.error.stack),typeof eo=="string"&&(io.data.path=eo),ro.errorFormatter({...Xr,shape:io})}function Zt$1(Xr,eo){return"error"in eo?{...eo,error:Xr.transformer.output.serialize(eo.error)}:"data"in eo.result?{...eo,result:{...eo.result,data:Xr.transformer.output.serialize(eo.result.data)}}:eo}function vn(Xr,eo){return Array.isArray(eo)?eo.map(to=>Zt$1(Xr,to)):Zt$1(Xr,eo)}const wn=Object.freeze(Object.defineProperty({__proto__:null,createFlatProxy:Tt$1,createRecursiveProxy:xt$1,getErrorShape:bn,transformTRPCResponse:vn},Symbol.toStringTag,{value:"Module"}));function xn(Xr){return typeof FormData>"u"?!1:Xr instanceof FormData}const ct$1={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Tn(Xr){const{direction:eo,type:to,path:ro,id:no,input:io}=Xr,oo=[],ao=[];if(Xr.colorMode==="ansi"){const[uo,ho]=ct$1.ansi.regular[to],[go,bo]=ct$1.ansi.bold[to];return oo.push(eo==="up"?uo:ho,eo==="up"?">>":"<<",to,eo==="up"?go:bo,`#${no}`,ro,"\x1B[0m"),eo==="up"?ao.push({input:Xr.input}):ao.push({input:Xr.input,result:"result"in Xr.result?Xr.result.result:Xr.result,elapsedMs:Xr.elapsedMs}),{parts:oo,args:ao}}const[so,co]=ct$1.css[to],lo=` background-color: #${eo==="up"?so:co}; color: ${eo==="up"?"black":"white"}; padding: 2px; - `;return oo.push("%c",eo==="up"?">>":"<<",to,`#${no}`,`%c${ro}%c`,"%O"),ao.push(lo,`${lo}; font-weight: bold;`,`${lo}; font-weight: normal;`),eo==="up"?ao.push({input:io,context:Xr.context}):ao.push({input:io,result:Xr.result,elapsedMs:Xr.elapsedMs,context:Xr.context}),{parts:oo,args:ao}}const En=({c:Xr=console,colorMode:eo="css"})=>to=>{const ro=to.input,no=xn(ro)?Object.fromEntries(ro):ro,{parts:io,args:oo}=Tn({...to,colorMode:eo,input:no}),ao=to.direction==="down"&&to.result&&(to.result instanceof Error||"error"in to.result.result)?"error":"log";Xr[ao].apply(null,[io.join(" ")].concat(oo))};function kn(Xr={}){const{enabled:eo=()=>!0}=Xr,to=Xr.colorMode??(typeof window>"u"?"ansi":"css"),{logger:ro=En({c:Xr.console,colorMode:to})}=Xr;return()=>({op:no,next:io})=>Ye$1(oo=>{eo({...no,direction:"up"})&&ro({...no,direction:"up"});const ao=Date.now();function so(co){const lo=Date.now()-ao;eo({...no,direction:"down",result:co})&&ro({...no,direction:"down",elapsedMs:lo,result:co})}return io(no).pipe(ar$1({next(co){so(co)},error(co){so(co)}})).subscribe(oo)})}let Cn=class{$request({type:Xr,input:eo,path:to,context:ro={}}){return ur$1({links:this.links,op:{id:++this.requestId,type:Xr,path:to,input:eo,context:ro}}).pipe(ir$1())}requestAsPromise(Xr){const eo=this.$request(Xr),{promise:to,abort:ro}=cr$1(eo);return new Promise((no,io)=>{var oo;(oo=Xr.signal)==null||oo.addEventListener("abort",ro),to.then(ao=>{no(ao.result.data)}).catch(ao=>{io(lr$1.from(ao))})})}query(Xr,eo,to){return this.requestAsPromise({type:"query",path:Xr,input:eo,context:to==null?void 0:to.context,signal:to==null?void 0:to.signal})}mutation(Xr,eo,to){return this.requestAsPromise({type:"mutation",path:Xr,input:eo,context:to==null?void 0:to.context,signal:to==null?void 0:to.signal})}subscription(Xr,eo,to){return this.$request({type:"subscription",path:Xr,input:eo,context:to==null?void 0:to.context}).subscribe({next(ro){var no,io,oo;ro.result.type==="started"?(no=to.onStarted)==null||no.call(to):ro.result.type==="stopped"?(io=to.onStopped)==null||io.call(to):(oo=to.onData)==null||oo.call(to,ro.result.data)},error(ro){var no;(no=to.onError)==null||no.call(to,ro)},complete(){var ro;(ro=to.onComplete)==null||ro.call(to)}})}constructor(Xr){this.requestId=0;const eo=(()=>{const to=Xr.transformer;return to?"input"in to?Xr.transformer:{input:to,output:to}:{input:{serialize:ro=>ro,deserialize:ro=>ro},output:{serialize:ro=>ro,deserialize:ro=>ro}}})();this.runtime={transformer:{serialize:to=>eo.input.serialize(to),deserialize:to=>eo.output.deserialize(to)},combinedTransformer:eo},this.links=Xr.links.map(to=>to(this.runtime))}};const Rn={query:"query",mutate:"mutation",subscribe:"subscription"},On=Xr=>Rn[Xr];function Pn(Xr){return Tt$1(eo=>Xr.hasOwnProperty(eo)?Xr[eo]:eo==="__untypedClient"?Xr:xt$1(({path:to,args:ro})=>{const no=[eo,...to],io=On(no.pop()),oo=no.join(".");return Xr[io](oo,...ro)}))}function Sn(Xr){const eo=new Cn(Xr);return Pn(eo)}function Nn(Xr){return!!Xr&&!Array.isArray(Xr)&&typeof Xr=="object"}function Ln(Xr){if(Xr instanceof ue$1)return Xr;const eo=new ue$1({code:"INTERNAL_SERVER_ERROR",cause:Xr});return Xr instanceof Error&&Xr.stack&&(eo.stack=Xr.stack),eo}class In extends Error{}function jn(Xr){if(Xr instanceof Error)return Xr;const eo=typeof Xr;if(!(eo==="undefined"||eo==="function"||Xr===null)){if(eo!=="object")return new Error(String(Xr));if(Nn(Xr)){const to=new In;for(const ro in Xr)to[ro]=Xr[ro];return to}}}let ue$1=class extends Error{constructor(eo){const to=jn(eo.cause),ro=eo.message??(to==null?void 0:to.message)??eo.code;super(ro,{cause:to}),this.code=eo.code,this.name=this.constructor.name}};function An(Xr){return"input"in Xr?Xr:{input:Xr,output:Xr}}const ye$1={_default:!0,input:{serialize:Xr=>Xr,deserialize:Xr=>Xr},output:{serialize:Xr=>Xr,deserialize:Xr=>Xr}},ge$1=({shape:Xr})=>Xr;function Mn(Xr){return Object.assign(Object.create(null),Xr)}const $n=["query","mutation","subscription"];function Dn(Xr){return"router"in Xr._def}const Zn={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:ge$1,transformer:ye$1},Un=["then"];function mr(Xr){return function(eo){const to=new Set(Object.keys(eo).filter(oo=>Un.includes(oo)));if(to.size>0)throw new Error("Reserved words used in `router({})` call: "+Array.from(to).join(", "));const ro=Mn({});function no(oo,ao=""){for(const[so,co]of Object.entries(oo??{})){const lo=`${ao}${so}`;if(Dn(co)){no(co._def.procedures,`${lo}.`);continue}if(ro[lo])throw new Error(`Duplicate key: ${lo}`);ro[lo]=co}}no(eo);const io={_config:Xr,router:!0,procedures:ro,...Zn,record:eo,queries:Object.entries(ro).filter(oo=>oo[1]._def.query).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{}),mutations:Object.entries(ro).filter(oo=>oo[1]._def.mutation).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{}),subscriptions:Object.entries(ro).filter(oo=>oo[1]._def.subscription).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{})};return{...eo,_def:io,createCaller(oo){return xt$1(({path:ao,args:so})=>{if(ao.length===1&&$n.includes(ao[0]))return Wn({procedures:io.procedures,path:so[0],rawInput:so[1],ctx:oo,type:ao[0]});const co=ao.join("."),lo=io.procedures[co];let fo="query";return lo._def.mutation?fo="mutation":lo._def.subscription&&(fo="subscription"),lo({path:co,rawInput:so[0],ctx:oo,type:fo})})},getErrorShape(oo){const{path:ao,error:so}=oo,{code:co}=oo.error,lo={message:so.message,code:Qe$1[co],data:{code:co,httpStatus:fr(so)}};return Xr.isDev&&typeof oo.error.stack=="string"&&(lo.data.stack=oo.error.stack),typeof ao=="string"&&(lo.data.path=ao),this._def._config.errorFormatter({...oo,shape:lo})}}}}function Wn(Xr){var no;const{type:eo,path:to}=Xr;if(!(to in Xr.procedures)||!((no=Xr.procedures[to])!=null&&no._def[eo]))throw new ue$1({code:"NOT_FOUND",message:`No "${eo}"-procedure on path "${to}"`});const ro=Xr.procedures[to];return ro(Xr)}const Ut$1=typeof window>"u"||"Deno"in window||!1||!!(define_globalThis_process_env_default!=null&&define_globalThis_process_env_default.JEST_WORKER_ID)||!!(define_globalThis_process_env_default!=null&&define_globalThis_process_env_default.VITEST_WORKER_ID);function Wt$1(Xr){const eo=Xr;if(typeof eo=="function")return eo;if(typeof eo.parseAsync=="function")return eo.parseAsync.bind(eo);if(typeof eo.parse=="function")return eo.parse.bind(eo);if(typeof eo.validateSync=="function")return eo.validateSync.bind(eo);if(typeof eo.create=="function")return eo.create.bind(eo);if(typeof eo.assert=="function")return to=>(eo.assert(to),to);throw new Error("Could not find a validator fn")}function yr(Xr,...eo){const to=Object.assign(Object.create(null),Xr);for(const ro of eo)for(const no in ro){if(no in to&&to[no]!==ro[no])throw new Error(`Duplicate key ${no}`);to[no]=ro[no]}return to}function qn(){function Xr(to){return{_middlewares:to,unstable_pipe(ro){const no="_middlewares"in ro?ro._middlewares:[ro];return Xr([...to,...no])}}}function eo(to){return Xr([to])}return eo}function qt$1(Xr){return Xr&&typeof Xr=="object"&&!Array.isArray(Xr)}function zn(Xr){const eo=async({next:to,rawInput:ro,input:no})=>{let io;try{io=await Xr(ro)}catch(ao){throw new ue$1({code:"BAD_REQUEST",cause:ao})}const oo=qt$1(no)&&qt$1(io)?{...no,...io}:io;return to({input:oo})};return eo._type="input",eo}function Vn(Xr){const eo=async({next:to})=>{const ro=await to();if(!ro.ok)return ro;try{const no=await Xr(ro.data);return{...ro,data:no}}catch(no){throw new ue$1({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:no})}};return eo._type="output",eo}const gr$1="middlewareMarker";function ae$1(Xr,eo){const{middlewares:to=[],inputs:ro,meta:no,...io}=eo;return _r({...yr(Xr,io),inputs:[...Xr.inputs,...ro??[]],middlewares:[...Xr.middlewares,...to],meta:Xr.meta&&no?{...Xr.meta,...no}:no??Xr.meta})}function _r(Xr={}){const eo={inputs:[],middlewares:[],...Xr};return{_def:eo,input(to){const ro=Wt$1(to);return ae$1(eo,{inputs:[to],middlewares:[zn(ro)]})},output(to){const ro=Wt$1(to);return ae$1(eo,{output:to,middlewares:[Vn(ro)]})},meta(to){return ae$1(eo,{meta:to})},unstable_concat(to){return ae$1(eo,to._def)},use(to){const ro="_middlewares"in to?to._middlewares:[to];return ae$1(eo,{middlewares:ro})},query(to){return ut$1({...eo,query:!0},to)},mutation(to){return ut$1({...eo,mutation:!0},to)},subscription(to){return ut$1({...eo,subscription:!0},to)}}}function ut$1(Xr,eo){const to=ae$1(Xr,{resolver:eo,middlewares:[async function(ro){const no=await eo(ro);return{marker:gr$1,ok:!0,data:no,ctx:ro.ctx}}]});return Hn(to._def)}const Bn=` + `;return oo.push("%c",eo==="up"?">>":"<<",to,`#${no}`,`%c${ro}%c`,"%O"),ao.push(lo,`${lo}; font-weight: bold;`,`${lo}; font-weight: normal;`),eo==="up"?ao.push({input:io,context:Xr.context}):ao.push({input:io,result:Xr.result,elapsedMs:Xr.elapsedMs,context:Xr.context}),{parts:oo,args:ao}}const En=({c:Xr=console,colorMode:eo="css"})=>to=>{const ro=to.input,no=xn(ro)?Object.fromEntries(ro):ro,{parts:io,args:oo}=Tn({...to,colorMode:eo,input:no}),ao=to.direction==="down"&&to.result&&(to.result instanceof Error||"error"in to.result.result)?"error":"log";Xr[ao].apply(null,[io.join(" ")].concat(oo))};function kn(Xr={}){const{enabled:eo=()=>!0}=Xr,to=Xr.colorMode??(typeof window>"u"?"ansi":"css"),{logger:ro=En({c:Xr.console,colorMode:to})}=Xr;return()=>({op:no,next:io})=>Ye$1(oo=>{eo({...no,direction:"up"})&&ro({...no,direction:"up"});const ao=Date.now();function so(co){const lo=Date.now()-ao;eo({...no,direction:"down",result:co})&&ro({...no,direction:"down",elapsedMs:lo,result:co})}return io(no).pipe(ar$1({next(co){so(co)},error(co){so(co)}})).subscribe(oo)})}let Cn=class{$request({type:Xr,input:eo,path:to,context:ro={}}){return ur$1({links:this.links,op:{id:++this.requestId,type:Xr,path:to,input:eo,context:ro}}).pipe(ir$1())}requestAsPromise(Xr){const eo=this.$request(Xr),{promise:to,abort:ro}=cr$1(eo);return new Promise((no,io)=>{var oo;(oo=Xr.signal)==null||oo.addEventListener("abort",ro),to.then(ao=>{no(ao.result.data)}).catch(ao=>{io(lr$1.from(ao))})})}query(Xr,eo,to){return this.requestAsPromise({type:"query",path:Xr,input:eo,context:to==null?void 0:to.context,signal:to==null?void 0:to.signal})}mutation(Xr,eo,to){return this.requestAsPromise({type:"mutation",path:Xr,input:eo,context:to==null?void 0:to.context,signal:to==null?void 0:to.signal})}subscription(Xr,eo,to){return this.$request({type:"subscription",path:Xr,input:eo,context:to==null?void 0:to.context}).subscribe({next(ro){var no,io,oo;ro.result.type==="started"?(no=to.onStarted)==null||no.call(to):ro.result.type==="stopped"?(io=to.onStopped)==null||io.call(to):(oo=to.onData)==null||oo.call(to,ro.result.data)},error(ro){var no;(no=to.onError)==null||no.call(to,ro)},complete(){var ro;(ro=to.onComplete)==null||ro.call(to)}})}constructor(Xr){this.requestId=0;const eo=(()=>{const to=Xr.transformer;return to?"input"in to?Xr.transformer:{input:to,output:to}:{input:{serialize:ro=>ro,deserialize:ro=>ro},output:{serialize:ro=>ro,deserialize:ro=>ro}}})();this.runtime={transformer:{serialize:to=>eo.input.serialize(to),deserialize:to=>eo.output.deserialize(to)},combinedTransformer:eo},this.links=Xr.links.map(to=>to(this.runtime))}};const Rn={query:"query",mutate:"mutation",subscribe:"subscription"},On=Xr=>Rn[Xr];function Pn(Xr){return Tt$1(eo=>Xr.hasOwnProperty(eo)?Xr[eo]:eo==="__untypedClient"?Xr:xt$1(({path:to,args:ro})=>{const no=[eo,...to],io=On(no.pop()),oo=no.join(".");return Xr[io](oo,...ro)}))}function Sn(Xr){const eo=new Cn(Xr);return Pn(eo)}function Nn(Xr){return!!Xr&&!Array.isArray(Xr)&&typeof Xr=="object"}function Ln(Xr){if(Xr instanceof ue$1)return Xr;const eo=new ue$1({code:"INTERNAL_SERVER_ERROR",cause:Xr});return Xr instanceof Error&&Xr.stack&&(eo.stack=Xr.stack),eo}class In extends Error{}function jn(Xr){if(Xr instanceof Error)return Xr;const eo=typeof Xr;if(!(eo==="undefined"||eo==="function"||Xr===null)){if(eo!=="object")return new Error(String(Xr));if(Nn(Xr)){const to=new In;for(const ro in Xr)to[ro]=Xr[ro];return to}}}let ue$1=class extends Error{constructor(eo){const to=jn(eo.cause),ro=eo.message??(to==null?void 0:to.message)??eo.code;super(ro,{cause:to}),this.code=eo.code,this.name=this.constructor.name}};function An(Xr){return"input"in Xr?Xr:{input:Xr,output:Xr}}const ye$1={_default:!0,input:{serialize:Xr=>Xr,deserialize:Xr=>Xr},output:{serialize:Xr=>Xr,deserialize:Xr=>Xr}},ge$1=({shape:Xr})=>Xr;function Mn(Xr){return Object.assign(Object.create(null),Xr)}const $n=["query","mutation","subscription"];function Dn(Xr){return"router"in Xr._def}const Zn={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:ge$1,transformer:ye$1},Un=["then"];function mr(Xr){return function(eo){const to=new Set(Object.keys(eo).filter(oo=>Un.includes(oo)));if(to.size>0)throw new Error("Reserved words used in `router({})` call: "+Array.from(to).join(", "));const ro=Mn({});function no(oo,ao=""){for(const[so,co]of Object.entries(oo??{})){const lo=`${ao}${so}`;if(Dn(co)){no(co._def.procedures,`${lo}.`);continue}if(ro[lo])throw new Error(`Duplicate key: ${lo}`);ro[lo]=co}}no(eo);const io={_config:Xr,router:!0,procedures:ro,...Zn,record:eo,queries:Object.entries(ro).filter(oo=>oo[1]._def.query).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{}),mutations:Object.entries(ro).filter(oo=>oo[1]._def.mutation).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{}),subscriptions:Object.entries(ro).filter(oo=>oo[1]._def.subscription).reduce((oo,[ao,so])=>({...oo,[ao]:so}),{})};return{...eo,_def:io,createCaller(oo){return xt$1(({path:ao,args:so})=>{if(ao.length===1&&$n.includes(ao[0]))return Wn({procedures:io.procedures,path:so[0],rawInput:so[1],ctx:oo,type:ao[0]});const co=ao.join("."),lo=io.procedures[co];let uo="query";return lo._def.mutation?uo="mutation":lo._def.subscription&&(uo="subscription"),lo({path:co,rawInput:so[0],ctx:oo,type:uo})})},getErrorShape(oo){const{path:ao,error:so}=oo,{code:co}=oo.error,lo={message:so.message,code:Qe$1[co],data:{code:co,httpStatus:fr(so)}};return Xr.isDev&&typeof oo.error.stack=="string"&&(lo.data.stack=oo.error.stack),typeof ao=="string"&&(lo.data.path=ao),this._def._config.errorFormatter({...oo,shape:lo})}}}}function Wn(Xr){var no;const{type:eo,path:to}=Xr;if(!(to in Xr.procedures)||!((no=Xr.procedures[to])!=null&&no._def[eo]))throw new ue$1({code:"NOT_FOUND",message:`No "${eo}"-procedure on path "${to}"`});const ro=Xr.procedures[to];return ro(Xr)}const Ut$1=typeof window>"u"||"Deno"in window||!1||!!(define_globalThis_process_env_default!=null&&define_globalThis_process_env_default.JEST_WORKER_ID)||!!(define_globalThis_process_env_default!=null&&define_globalThis_process_env_default.VITEST_WORKER_ID);function Wt$1(Xr){const eo=Xr;if(typeof eo=="function")return eo;if(typeof eo.parseAsync=="function")return eo.parseAsync.bind(eo);if(typeof eo.parse=="function")return eo.parse.bind(eo);if(typeof eo.validateSync=="function")return eo.validateSync.bind(eo);if(typeof eo.create=="function")return eo.create.bind(eo);if(typeof eo.assert=="function")return to=>(eo.assert(to),to);throw new Error("Could not find a validator fn")}function yr(Xr,...eo){const to=Object.assign(Object.create(null),Xr);for(const ro of eo)for(const no in ro){if(no in to&&to[no]!==ro[no])throw new Error(`Duplicate key ${no}`);to[no]=ro[no]}return to}function qn(){function Xr(to){return{_middlewares:to,unstable_pipe(ro){const no="_middlewares"in ro?ro._middlewares:[ro];return Xr([...to,...no])}}}function eo(to){return Xr([to])}return eo}function qt$1(Xr){return Xr&&typeof Xr=="object"&&!Array.isArray(Xr)}function zn(Xr){const eo=async({next:to,rawInput:ro,input:no})=>{let io;try{io=await Xr(ro)}catch(ao){throw new ue$1({code:"BAD_REQUEST",cause:ao})}const oo=qt$1(no)&&qt$1(io)?{...no,...io}:io;return to({input:oo})};return eo._type="input",eo}function Vn(Xr){const eo=async({next:to})=>{const ro=await to();if(!ro.ok)return ro;try{const no=await Xr(ro.data);return{...ro,data:no}}catch(no){throw new ue$1({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:no})}};return eo._type="output",eo}const gr$1="middlewareMarker";function ae$1(Xr,eo){const{middlewares:to=[],inputs:ro,meta:no,...io}=eo;return _r({...yr(Xr,io),inputs:[...Xr.inputs,...ro??[]],middlewares:[...Xr.middlewares,...to],meta:Xr.meta&&no?{...Xr.meta,...no}:no??Xr.meta})}function _r(Xr={}){const eo={inputs:[],middlewares:[],...Xr};return{_def:eo,input(to){const ro=Wt$1(to);return ae$1(eo,{inputs:[to],middlewares:[zn(ro)]})},output(to){const ro=Wt$1(to);return ae$1(eo,{output:to,middlewares:[Vn(ro)]})},meta(to){return ae$1(eo,{meta:to})},unstable_concat(to){return ae$1(eo,to._def)},use(to){const ro="_middlewares"in to?to._middlewares:[to];return ae$1(eo,{middlewares:ro})},query(to){return ut$1({...eo,query:!0},to)},mutation(to){return ut$1({...eo,mutation:!0},to)},subscription(to){return ut$1({...eo,subscription:!0},to)}}}function ut$1(Xr,eo){const to=ae$1(Xr,{resolver:eo,middlewares:[async function(ro){const no=await eo(ro);return{marker:gr$1,ok:!0,data:no,ctx:ro.ctx}}]});return Hn(to._def)}const Bn=` If you want to call this function on the server, you do the following: This is a client-only function. @@ -2552,12 +4382,12 @@ const caller = appRouter.createCaller({ }); const result = await caller.call('myProcedure', input); -`.trim();function Hn(Xr){const eo=async function(to){if(!to||!("rawInput"in to))throw new Error(Bn);const ro=async(io={index:0,ctx:to.ctx})=>{try{const oo=Xr.middlewares[io.index];return await oo({ctx:io.ctx,type:to.type,path:to.path,rawInput:io.rawInput??to.rawInput,meta:Xr.meta,input:io.input,next(ao){const so=ao;return ro({index:io.index+1,ctx:so&&"ctx"in so?{...io.ctx,...so.ctx}:io.ctx,input:so&&"input"in so?so.input:io.input,rawInput:so&&"rawInput"in so?so.rawInput:io.rawInput})}})}catch(oo){return{ok:!1,error:Ln(oo),marker:gr$1}}},no=await ro();if(!no)throw new ue$1({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!no.ok)throw no.error;return no.data};return eo._def=Xr,eo.meta=Xr.meta,eo}function Fn(...Xr){var no;const eo=yr({},...Xr.map(io=>io._def.record)),to=Xr.reduce((io,oo)=>{if(oo._def._config.errorFormatter&&oo._def._config.errorFormatter!==ge$1){if(io!==ge$1&&io!==oo._def._config.errorFormatter)throw new Error("You seem to have several error formatters");return oo._def._config.errorFormatter}return io},ge$1),ro=Xr.reduce((io,oo)=>{if(oo._def._config.transformer&&oo._def._config.transformer!==ye$1){if(io!==ye$1&&io!==oo._def._config.transformer)throw new Error("You seem to have several transformers");return oo._def._config.transformer}return io},ye$1);return mr({errorFormatter:to,transformer:ro,isDev:Xr.some(io=>io._def._config.isDev),allowOutsideOfServer:Xr.some(io=>io._def._config.allowOutsideOfServer),isServer:Xr.some(io=>io._def._config.isServer),$types:(no=Xr[0])==null?void 0:no._def._config.$types})(eo)}let Ze$1=class _v{context(){return new _v}meta(){return new _v}create(eo){return Gn()(eo)}};const Jn=new Ze$1;function Gn(){return function(Xr){const eo=(Xr==null?void 0:Xr.errorFormatter)??ge$1,to={transformer:An((Xr==null?void 0:Xr.transformer)??ye$1),isDev:(Xr==null?void 0:Xr.isDev)??!1,allowOutsideOfServer:(Xr==null?void 0:Xr.allowOutsideOfServer)??!1,errorFormatter:eo,isServer:(Xr==null?void 0:Xr.isServer)??Ut$1,$types:Tt$1(ro=>{throw new Error(`Tried to access "$types.${ro}" which is not available at runtime`)})};if(!((Xr==null?void 0:Xr.isServer)??Ut$1)&&(Xr==null?void 0:Xr.allowOutsideOfServer)!==!0)throw new Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:to,procedure:_r({meta:Xr==null?void 0:Xr.defaultMeta}),middleware:qn(),router:mr(to),mergeRouters:Fn}}}var mt$1={},Xe$1={},fe={},O$2={};const pe$1=R$2(hn);var Et$1={},br=pe$1;function vr(Xr){return br.observable(eo=>{function to(ro=0,no=Xr.op){const io=Xr.links[ro];if(!io)throw new Error("No more links to execute - did you forget to add an ending link?");return io({op:no,next(oo){return to(ro+1,oo)}})}return to().subscribe(eo)})}function zt$1(Xr){return Array.isArray(Xr)?Xr:[Xr]}function Yn(Xr){return eo=>{const to=zt$1(Xr.true).map(no=>no(eo)),ro=zt$1(Xr.false).map(no=>no(eo));return no=>br.observable(io=>{const oo=Xr.condition(no.op)?to:ro;return vr({op:no.op,links:oo}).subscribe(io)})}}Et$1.createChain=vr;Et$1.splitLink=Yn;var he$1={};function Qn(Xr){return Xr instanceof wr||Xr.name==="TRPCClientError"}let wr=class Qy extends Error{static from(eo,to={}){return eo instanceof Error?Qn(eo)?(to.meta&&(eo.meta={...eo.meta,...to.meta}),eo):new Qy(eo.message,{...to,cause:eo,result:null}):new Qy(eo.error.message??"",{...to,cause:void 0,result:eo})}constructor(eo,to){var no,io;const ro=to==null?void 0:to.cause;super(eo,{cause:ro}),this.meta=to==null?void 0:to.meta,this.cause=ro,this.shape=(no=to==null?void 0:to.result)==null?void 0:no.error,this.data=(io=to==null?void 0:to.result)==null?void 0:io.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Qy.prototype)}};he$1.TRPCClientError=wr;const Xn=R$2(wn);var q$1={},Kn=he$1;const Vt$1=Xr=>typeof Xr=="function";function xr(Xr){if(Xr)return Xr;if(typeof window<"u"&&Vt$1(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Vt$1(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function es(Xr){return Xr||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}function ts(Xr){return{url:Xr.url,fetch:Xr.fetch,AbortController:es(Xr.AbortController)}}function rs(Xr){const eo={};for(let to=0;toXr.runtime.transformer.serialize(eo)))}const Er=Xr=>{let eo=Xr.url+"/"+Xr.path;const to=[];if("inputs"in Xr&&to.push("batch=1"),Xr.type==="query"){const ro=Tr(Xr);ro!==void 0&&to.push(`input=${encodeURIComponent(JSON.stringify(ro))}`)}return to.length&&(eo+="?"+to.join("&")),eo},kr$1=Xr=>{if(Xr.type==="query")return;const eo=Tr(Xr);return eo!==void 0?JSON.stringify(eo):void 0},ss=Xr=>Rr({...Xr,contentTypeHeader:"application/json",getUrl:Er,getBody:kr$1});async function Cr(Xr,eo){const to=Xr.getUrl(Xr),ro=Xr.getBody(Xr),{type:no}=Xr,io=await Xr.headers();/* istanbul ignore if -- @preserve */if(no==="subscription")throw new Error("Subscriptions should use wsLink");const oo={...Xr.contentTypeHeader?{"content-type":Xr.contentTypeHeader}:{},...Xr.batchModeHeader?{"trpc-batch-mode":Xr.batchModeHeader}:{},...io};return xr(Xr.fetch)(to,{method:ns[no],signal:eo==null?void 0:eo.signal,body:ro,headers:oo})}function Rr(Xr){const eo=Xr.AbortController?new Xr.AbortController:null,to={};return{promise:new Promise((ro,no)=>{Cr(Xr,eo).then(io=>(to.response=io,io.json())).then(io=>{to.responseJSON=io,ro({json:io,meta:to})}).catch(io=>{no(Kn.TRPCClientError.from(io,{meta:to}))})}),cancel:()=>{eo==null||eo.abort()}}}q$1.fetchHTTPResponse=Cr;q$1.getBody=kr$1;q$1.getFetch=xr;q$1.getUrl=Er;q$1.httpRequest=Rr;q$1.jsonHttpRequester=ss;q$1.resolveHTTPLinkOptions=ts;var kt$1={},Ke={};function Bt$1(Xr){return!!Xr&&!Array.isArray(Xr)&&typeof Xr=="object"}function is(Xr,eo){if("error"in Xr){const to=eo.transformer.deserialize(Xr.error);return{ok:!1,error:{...Xr,error:to}}}return{ok:!0,result:{...Xr.result,...(!Xr.result.type||Xr.result.type==="data")&&{type:"data",data:eo.transformer.deserialize(Xr.result.data)}}}}let lt$1=class extends Error{constructor(){super("Unable to transform response from server")}};function as(Xr,eo){let to;try{to=is(Xr,eo)}catch{throw new lt$1}if(!to.ok&&(!Bt$1(to.error.error)||typeof to.error.error.code!="number"))throw new lt$1;if(to.ok&&!Bt$1(to.result))throw new lt$1;return to}Ke.transformResult=as;var os=pe$1,cs=Ke,Ht$1=he$1,yt$1=q$1;const dt$1=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function ft$1(Xr){let eo=null,to=null;const ro=()=>{clearTimeout(to),to=null,eo=null};function no(ao){var lo,fo;const so=[[]];let co=0;for(;;){const ho=ao[co];if(!ho)break;const go=so[so.length-1];if(ho.aborted){(lo=ho.reject)==null||lo.call(ho,new Error("Aborted")),co++;continue}if(Xr.validate(go.concat(ho).map(yo=>yo.key))){go.push(ho),co++;continue}if(go.length===0){(fo=ho.reject)==null||fo.call(ho,new Error("Input is too big for a single dispatch")),co++;continue}so.push([])}return so}function io(){const ao=no(eo);ro();for(const so of ao){if(!so.length)continue;const co={items:so,cancel:dt$1};for(const go of so)go.batch=co;const lo=(go,yo)=>{var wo;const vo=co.items[go];(wo=vo.resolve)==null||wo.call(vo,yo),vo.batch=null,vo.reject=null,vo.resolve=null},{promise:fo,cancel:ho}=Xr.fetch(co.items.map(go=>go.key),lo);co.cancel=ho,fo.then(go=>{var yo;for(let vo=0;vo{var yo;for(const vo of co.items)(yo=vo.reject)==null||yo.call(vo,go),vo.batch=null})}}function oo(ao){const so={aborted:!1,key:ao,batch:null,resolve:dt$1,reject:dt$1},co=new Promise((lo,fo)=>{so.reject=fo,so.resolve=lo,eo||(eo=[]),eo.push(so)});return to||(to=setTimeout(io)),{promise:co,cancel:()=>{var lo;so.aborted=!0,(lo=so.batch)!=null&&lo.items.every(fo=>fo.aborted)&&(so.batch.cancel(),so.batch=null)}}}return{load:oo}}function Or(Xr){return function(eo){const to=yt$1.resolveHTTPLinkOptions(eo),ro=eo.maxURLLength??1/0;return no=>{const io=lo=>{const fo=go=>{if(ro===1/0)return!0;const yo=go.map(wo=>wo.path).join(","),vo=go.map(wo=>wo.input);return yt$1.getUrl({...to,runtime:no,type:lo,path:yo,inputs:vo}).length<=ro},ho=Xr({...to,runtime:no,type:lo,opts:eo});return{validate:fo,fetch:ho}},oo=ft$1(io("query")),ao=ft$1(io("mutation")),so=ft$1(io("subscription")),co={query:oo,subscription:so,mutation:ao};return({op:lo})=>os.observable(fo=>{const ho=co[lo.type],{promise:go,cancel:yo}=ho.load(lo);let vo;return go.then(wo=>{vo=wo;const Eo=cs.transformResult(wo.json,no);if(!Eo.ok){fo.error(Ht$1.TRPCClientError.from(Eo.error,{meta:wo.meta}));return}fo.next({context:wo.meta,result:Eo.result}),fo.complete()}).catch(wo=>{fo.error(Ht$1.TRPCClientError.from(wo,{meta:vo==null?void 0:vo.meta}))}),()=>{yo()}})}}}const us=Xr=>eo=>{const to=eo.map(oo=>oo.path).join(","),ro=eo.map(oo=>oo.input),{promise:no,cancel:io}=yt$1.jsonHttpRequester({...Xr,path:to,inputs:ro,headers(){return Xr.opts.headers?typeof Xr.opts.headers=="function"?Xr.opts.headers({opList:eo}):Xr.opts.headers:{}}});return{promise:no.then(oo=>(Array.isArray(oo.json)?oo.json:eo.map(()=>oo.json)).map(ao=>({meta:oo.meta,json:ao}))),cancel:io}},ls=Or(us);kt$1.createHTTPBatchLink=Or;kt$1.httpBatchLink=ls;var et={};Object.defineProperty(et,"__esModule",{value:!0});var ds=pe$1,fs=Ke,Ft$1=he$1,Pr=q$1;function Sr(Xr){return eo=>{const to=Pr.resolveHTTPLinkOptions(eo);return ro=>({op:no})=>ds.observable(io=>{const{path:oo,input:ao,type:so}=no,{promise:co,cancel:lo}=Xr.requester({...to,runtime:ro,type:so,path:oo,input:ao,headers(){return eo.headers?typeof eo.headers=="function"?eo.headers({op:no}):eo.headers:{}}});let fo;return co.then(ho=>{fo=ho.meta;const go=fs.transformResult(ho.json,ro);if(!go.ok){io.error(Ft$1.TRPCClientError.from(go.error,{meta:fo}));return}io.next({context:ho.meta,result:go.result}),io.complete()}).catch(ho=>{io.error(Ft$1.TRPCClientError.from(ho,{meta:fo}))}),()=>{lo()}})}}const ps=Sr({requester:Pr.jsonHttpRequester});et.httpLink=ps;et.httpLinkFactory=Sr;var Ct$1={};Object.defineProperty(Ct$1,"__esModule",{value:!0});var Jt$1=pe$1;function hs(Xr){return typeof FormData>"u"?!1:Xr instanceof FormData}const pt$1={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function ms(Xr){const{direction:eo,type:to,path:ro,id:no,input:io}=Xr,oo=[],ao=[];if(Xr.colorMode==="ansi"){const[fo,ho]=pt$1.ansi.regular[to],[go,yo]=pt$1.ansi.bold[to];return oo.push(eo==="up"?fo:ho,eo==="up"?">>":"<<",to,eo==="up"?go:yo,`#${no}`,ro,"\x1B[0m"),eo==="up"?ao.push({input:Xr.input}):ao.push({input:Xr.input,result:"result"in Xr.result?Xr.result.result:Xr.result,elapsedMs:Xr.elapsedMs}),{parts:oo,args:ao}}const[so,co]=pt$1.css[to],lo=` +`.trim();function Hn(Xr){const eo=async function(to){if(!to||!("rawInput"in to))throw new Error(Bn);const ro=async(io={index:0,ctx:to.ctx})=>{try{const oo=Xr.middlewares[io.index];return await oo({ctx:io.ctx,type:to.type,path:to.path,rawInput:io.rawInput??to.rawInput,meta:Xr.meta,input:io.input,next(ao){const so=ao;return ro({index:io.index+1,ctx:so&&"ctx"in so?{...io.ctx,...so.ctx}:io.ctx,input:so&&"input"in so?so.input:io.input,rawInput:so&&"rawInput"in so?so.rawInput:io.rawInput})}})}catch(oo){return{ok:!1,error:Ln(oo),marker:gr$1}}},no=await ro();if(!no)throw new ue$1({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!no.ok)throw no.error;return no.data};return eo._def=Xr,eo.meta=Xr.meta,eo}function Fn(...Xr){var no;const eo=yr({},...Xr.map(io=>io._def.record)),to=Xr.reduce((io,oo)=>{if(oo._def._config.errorFormatter&&oo._def._config.errorFormatter!==ge$1){if(io!==ge$1&&io!==oo._def._config.errorFormatter)throw new Error("You seem to have several error formatters");return oo._def._config.errorFormatter}return io},ge$1),ro=Xr.reduce((io,oo)=>{if(oo._def._config.transformer&&oo._def._config.transformer!==ye$1){if(io!==ye$1&&io!==oo._def._config.transformer)throw new Error("You seem to have several transformers");return oo._def._config.transformer}return io},ye$1);return mr({errorFormatter:to,transformer:ro,isDev:Xr.some(io=>io._def._config.isDev),allowOutsideOfServer:Xr.some(io=>io._def._config.allowOutsideOfServer),isServer:Xr.some(io=>io._def._config.isServer),$types:(no=Xr[0])==null?void 0:no._def._config.$types})(eo)}let Ze$1=class eC{context(){return new eC}meta(){return new eC}create(eo){return Gn()(eo)}};const Jn=new Ze$1;function Gn(){return function(Xr){const eo=(Xr==null?void 0:Xr.errorFormatter)??ge$1,to={transformer:An((Xr==null?void 0:Xr.transformer)??ye$1),isDev:(Xr==null?void 0:Xr.isDev)??!1,allowOutsideOfServer:(Xr==null?void 0:Xr.allowOutsideOfServer)??!1,errorFormatter:eo,isServer:(Xr==null?void 0:Xr.isServer)??Ut$1,$types:Tt$1(ro=>{throw new Error(`Tried to access "$types.${ro}" which is not available at runtime`)})};if(!((Xr==null?void 0:Xr.isServer)??Ut$1)&&(Xr==null?void 0:Xr.allowOutsideOfServer)!==!0)throw new Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:to,procedure:_r({meta:Xr==null?void 0:Xr.defaultMeta}),middleware:qn(),router:mr(to),mergeRouters:Fn}}}var mt$1={},Xe$1={},fe={},O$2={};const pe$1=R$2(hn);var Et$1={},br=pe$1;function vr(Xr){return br.observable(eo=>{function to(ro=0,no=Xr.op){const io=Xr.links[ro];if(!io)throw new Error("No more links to execute - did you forget to add an ending link?");return io({op:no,next(oo){return to(ro+1,oo)}})}return to().subscribe(eo)})}function zt$1(Xr){return Array.isArray(Xr)?Xr:[Xr]}function Yn(Xr){return eo=>{const to=zt$1(Xr.true).map(no=>no(eo)),ro=zt$1(Xr.false).map(no=>no(eo));return no=>br.observable(io=>{const oo=Xr.condition(no.op)?to:ro;return vr({op:no.op,links:oo}).subscribe(io)})}}Et$1.createChain=vr;Et$1.splitLink=Yn;var he$1={};function Qn(Xr){return Xr instanceof wr||Xr.name==="TRPCClientError"}let wr=class p_ extends Error{static from(eo,to={}){return eo instanceof Error?Qn(eo)?(to.meta&&(eo.meta={...eo.meta,...to.meta}),eo):new p_(eo.message,{...to,cause:eo,result:null}):new p_(eo.error.message??"",{...to,cause:void 0,result:eo})}constructor(eo,to){var no,io;const ro=to==null?void 0:to.cause;super(eo,{cause:ro}),this.meta=to==null?void 0:to.meta,this.cause=ro,this.shape=(no=to==null?void 0:to.result)==null?void 0:no.error,this.data=(io=to==null?void 0:to.result)==null?void 0:io.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,p_.prototype)}};he$1.TRPCClientError=wr;const Xn=R$2(wn);var q$1={},Kn=he$1;const Vt$1=Xr=>typeof Xr=="function";function xr(Xr){if(Xr)return Xr;if(typeof window<"u"&&Vt$1(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Vt$1(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function es(Xr){return Xr||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}function ts(Xr){return{url:Xr.url,fetch:Xr.fetch,AbortController:es(Xr.AbortController)}}function rs(Xr){const eo={};for(let to=0;toXr.runtime.transformer.serialize(eo)))}const Er=Xr=>{let eo=Xr.url+"/"+Xr.path;const to=[];if("inputs"in Xr&&to.push("batch=1"),Xr.type==="query"){const ro=Tr(Xr);ro!==void 0&&to.push(`input=${encodeURIComponent(JSON.stringify(ro))}`)}return to.length&&(eo+="?"+to.join("&")),eo},kr$1=Xr=>{if(Xr.type==="query")return;const eo=Tr(Xr);return eo!==void 0?JSON.stringify(eo):void 0},ss=Xr=>Rr({...Xr,contentTypeHeader:"application/json",getUrl:Er,getBody:kr$1});async function Cr(Xr,eo){const to=Xr.getUrl(Xr),ro=Xr.getBody(Xr),{type:no}=Xr,io=await Xr.headers();/* istanbul ignore if -- @preserve */if(no==="subscription")throw new Error("Subscriptions should use wsLink");const oo={...Xr.contentTypeHeader?{"content-type":Xr.contentTypeHeader}:{},...Xr.batchModeHeader?{"trpc-batch-mode":Xr.batchModeHeader}:{},...io};return xr(Xr.fetch)(to,{method:ns[no],signal:eo==null?void 0:eo.signal,body:ro,headers:oo})}function Rr(Xr){const eo=Xr.AbortController?new Xr.AbortController:null,to={};return{promise:new Promise((ro,no)=>{Cr(Xr,eo).then(io=>(to.response=io,io.json())).then(io=>{to.responseJSON=io,ro({json:io,meta:to})}).catch(io=>{no(Kn.TRPCClientError.from(io,{meta:to}))})}),cancel:()=>{eo==null||eo.abort()}}}q$1.fetchHTTPResponse=Cr;q$1.getBody=kr$1;q$1.getFetch=xr;q$1.getUrl=Er;q$1.httpRequest=Rr;q$1.jsonHttpRequester=ss;q$1.resolveHTTPLinkOptions=ts;var kt$1={},Ke={};function Bt$1(Xr){return!!Xr&&!Array.isArray(Xr)&&typeof Xr=="object"}function is(Xr,eo){if("error"in Xr){const to=eo.transformer.deserialize(Xr.error);return{ok:!1,error:{...Xr,error:to}}}return{ok:!0,result:{...Xr.result,...(!Xr.result.type||Xr.result.type==="data")&&{type:"data",data:eo.transformer.deserialize(Xr.result.data)}}}}let lt$1=class extends Error{constructor(){super("Unable to transform response from server")}};function as(Xr,eo){let to;try{to=is(Xr,eo)}catch{throw new lt$1}if(!to.ok&&(!Bt$1(to.error.error)||typeof to.error.error.code!="number"))throw new lt$1;if(to.ok&&!Bt$1(to.result))throw new lt$1;return to}Ke.transformResult=as;var os=pe$1,cs=Ke,Ht$1=he$1,yt$1=q$1;const dt$1=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function ft$1(Xr){let eo=null,to=null;const ro=()=>{clearTimeout(to),to=null,eo=null};function no(ao){var lo,uo;const so=[[]];let co=0;for(;;){const ho=ao[co];if(!ho)break;const go=so[so.length-1];if(ho.aborted){(lo=ho.reject)==null||lo.call(ho,new Error("Aborted")),co++;continue}if(Xr.validate(go.concat(ho).map(bo=>bo.key))){go.push(ho),co++;continue}if(go.length===0){(uo=ho.reject)==null||uo.call(ho,new Error("Input is too big for a single dispatch")),co++;continue}so.push([])}return so}function io(){const ao=no(eo);ro();for(const so of ao){if(!so.length)continue;const co={items:so,cancel:dt$1};for(const go of so)go.batch=co;const lo=(go,bo)=>{var Eo;const wo=co.items[go];(Eo=wo.resolve)==null||Eo.call(wo,bo),wo.batch=null,wo.reject=null,wo.resolve=null},{promise:uo,cancel:ho}=Xr.fetch(co.items.map(go=>go.key),lo);co.cancel=ho,uo.then(go=>{var bo;for(let wo=0;wo{var bo;for(const wo of co.items)(bo=wo.reject)==null||bo.call(wo,go),wo.batch=null})}}function oo(ao){const so={aborted:!1,key:ao,batch:null,resolve:dt$1,reject:dt$1},co=new Promise((lo,uo)=>{so.reject=uo,so.resolve=lo,eo||(eo=[]),eo.push(so)});return to||(to=setTimeout(io)),{promise:co,cancel:()=>{var lo;so.aborted=!0,(lo=so.batch)!=null&&lo.items.every(uo=>uo.aborted)&&(so.batch.cancel(),so.batch=null)}}}return{load:oo}}function Or(Xr){return function(eo){const to=yt$1.resolveHTTPLinkOptions(eo),ro=eo.maxURLLength??1/0;return no=>{const io=lo=>{const uo=go=>{if(ro===1/0)return!0;const bo=go.map(Eo=>Eo.path).join(","),wo=go.map(Eo=>Eo.input);return yt$1.getUrl({...to,runtime:no,type:lo,path:bo,inputs:wo}).length<=ro},ho=Xr({...to,runtime:no,type:lo,opts:eo});return{validate:uo,fetch:ho}},oo=ft$1(io("query")),ao=ft$1(io("mutation")),so=ft$1(io("subscription")),co={query:oo,subscription:so,mutation:ao};return({op:lo})=>os.observable(uo=>{const ho=co[lo.type],{promise:go,cancel:bo}=ho.load(lo);let wo;return go.then(Eo=>{wo=Eo;const $o=cs.transformResult(Eo.json,no);if(!$o.ok){uo.error(Ht$1.TRPCClientError.from($o.error,{meta:Eo.meta}));return}uo.next({context:Eo.meta,result:$o.result}),uo.complete()}).catch(Eo=>{uo.error(Ht$1.TRPCClientError.from(Eo,{meta:wo==null?void 0:wo.meta}))}),()=>{bo()}})}}}const us=Xr=>eo=>{const to=eo.map(oo=>oo.path).join(","),ro=eo.map(oo=>oo.input),{promise:no,cancel:io}=yt$1.jsonHttpRequester({...Xr,path:to,inputs:ro,headers(){return Xr.opts.headers?typeof Xr.opts.headers=="function"?Xr.opts.headers({opList:eo}):Xr.opts.headers:{}}});return{promise:no.then(oo=>(Array.isArray(oo.json)?oo.json:eo.map(()=>oo.json)).map(ao=>({meta:oo.meta,json:ao}))),cancel:io}},ls=Or(us);kt$1.createHTTPBatchLink=Or;kt$1.httpBatchLink=ls;var et={};Object.defineProperty(et,"__esModule",{value:!0});var ds=pe$1,fs=Ke,Ft$1=he$1,Pr=q$1;function Sr(Xr){return eo=>{const to=Pr.resolveHTTPLinkOptions(eo);return ro=>({op:no})=>ds.observable(io=>{const{path:oo,input:ao,type:so}=no,{promise:co,cancel:lo}=Xr.requester({...to,runtime:ro,type:so,path:oo,input:ao,headers(){return eo.headers?typeof eo.headers=="function"?eo.headers({op:no}):eo.headers:{}}});let uo;return co.then(ho=>{uo=ho.meta;const go=fs.transformResult(ho.json,ro);if(!go.ok){io.error(Ft$1.TRPCClientError.from(go.error,{meta:uo}));return}io.next({context:ho.meta,result:go.result}),io.complete()}).catch(ho=>{io.error(Ft$1.TRPCClientError.from(ho,{meta:uo}))}),()=>{lo()}})}}const ps=Sr({requester:Pr.jsonHttpRequester});et.httpLink=ps;et.httpLinkFactory=Sr;var Ct$1={};Object.defineProperty(Ct$1,"__esModule",{value:!0});var Jt$1=pe$1;function hs(Xr){return typeof FormData>"u"?!1:Xr instanceof FormData}const pt$1={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function ms(Xr){const{direction:eo,type:to,path:ro,id:no,input:io}=Xr,oo=[],ao=[];if(Xr.colorMode==="ansi"){const[uo,ho]=pt$1.ansi.regular[to],[go,bo]=pt$1.ansi.bold[to];return oo.push(eo==="up"?uo:ho,eo==="up"?">>":"<<",to,eo==="up"?go:bo,`#${no}`,ro,"\x1B[0m"),eo==="up"?ao.push({input:Xr.input}):ao.push({input:Xr.input,result:"result"in Xr.result?Xr.result.result:Xr.result,elapsedMs:Xr.elapsedMs}),{parts:oo,args:ao}}const[so,co]=pt$1.css[to],lo=` background-color: #${eo==="up"?so:co}; color: ${eo==="up"?"black":"white"}; padding: 2px; - `;return oo.push("%c",eo==="up"?">>":"<<",to,`#${no}`,`%c${ro}%c`,"%O"),ao.push(lo,`${lo}; font-weight: bold;`,`${lo}; font-weight: normal;`),eo==="up"?ao.push({input:io,context:Xr.context}):ao.push({input:io,result:Xr.result,elapsedMs:Xr.elapsedMs,context:Xr.context}),{parts:oo,args:ao}}const ys=({c:Xr=console,colorMode:eo="css"})=>to=>{const ro=to.input,no=hs(ro)?Object.fromEntries(ro):ro,{parts:io,args:oo}=ms({...to,colorMode:eo,input:no}),ao=to.direction==="down"&&to.result&&(to.result instanceof Error||"error"in to.result.result)?"error":"log";Xr[ao].apply(null,[io.join(" ")].concat(oo))};function gs(Xr={}){const{enabled:eo=()=>!0}=Xr,to=Xr.colorMode??(typeof window>"u"?"ansi":"css"),{logger:ro=ys({c:Xr.console,colorMode:to})}=Xr;return()=>({op:no,next:io})=>Jt$1.observable(oo=>{eo({...no,direction:"up"})&&ro({...no,direction:"up"});const ao=Date.now();function so(co){const lo=Date.now()-ao;eo({...no,direction:"down",result:co})&&ro({...no,direction:"down",elapsedMs:lo,result:co})}return io(no).pipe(Jt$1.tap({next(co){so(co)},error(co){so(co)}})).subscribe(oo)})}Ct$1.loggerLink=gs;var tt={};Object.defineProperty(tt,"__esModule",{value:!0});var _s=pe$1,bs=Ke,Nr=he$1;/* istanbul ignore next -- @preserve */const vs=Xr=>Xr===0?0:Math.min(1e3*2**Xr,3e4);function ws(Xr){const{url:eo,WebSocket:to=WebSocket,retryDelayMs:ro=vs,onOpen:no,onClose:io}=Xr;/* istanbul ignore next -- @preserve */if(!to)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");let oo=[];const ao=Object.create(null);let so=0,co=null,lo=null,fo=Po(),ho="connecting";function go(){ho!=="open"||co||(co=setTimeout(()=>{co=null,oo.length===1?fo.send(JSON.stringify(oo.pop())):fo.send(JSON.stringify(oo)),oo=[]}))}function yo(){if(lo!==null||ho==="closed")return;const Mo=ro(so++);wo(Mo)}function vo(){ho="connecting";const Mo=fo;fo=Po(),Eo(Mo)}function wo(Mo){lo||(ho="connecting",lo=setTimeout(vo,Mo))}function Eo(Mo){Object.values(ao).some(No=>No.ws===Mo)||Mo.close()}function ko(){Object.values(ao).forEach(Mo=>{Mo.type==="subscription"&&Mo.callbacks.complete()})}function Ao(Mo){oo.some(No=>No.id===Mo.op.id)||jo(Mo.op,Mo.callbacks)}function Po(){const Mo=typeof eo=="function"?eo():eo,No=new to(Mo);clearTimeout(lo),lo=null,No.addEventListener("open",()=>{/* istanbul ignore next -- @preserve */No===fo&&(so=0,ho="open",no==null||no(),go())}),No.addEventListener("error",()=>{No===fo&&yo()});const Do=Xo=>{if(Xo.method==="reconnect"&&No===fo){ho==="open"&&(io==null||io()),vo();for(const Lo of Object.values(ao))Lo.type==="subscription"&&Ao(Lo)}},Fo=Xo=>{var Bo,xo;const Lo=Xo.id!==null&&ao[Xo.id];if(Lo){if((xo=(Bo=Lo.callbacks).next)==null||xo.call(Bo,Xo),Lo.ws!==fo&&No===fo){const uo=Lo.ws;Lo.ws=fo,Eo(uo)}"result"in Xo&&Xo.result.type==="stopped"&&No===fo&&Lo.callbacks.complete()}};return No.addEventListener("message",({data:Xo})=>{const Lo=JSON.parse(Xo);"method"in Lo?Do(Lo):Fo(Lo),(No!==fo||ho==="closed")&&Eo(No)}),No.addEventListener("close",({code:Xo})=>{var Lo,Bo,xo,uo;ho==="open"&&(io==null||io({code:Xo})),fo===No&&yo();for(const[po,bo]of Object.entries(ao))if(bo.ws===No){if(ho==="closed"){delete ao[po],(Bo=(Lo=bo.callbacks).complete)==null||Bo.call(Lo);continue}bo.type==="subscription"?Ao(bo):(delete ao[po],(uo=(xo=bo.callbacks).error)==null||uo.call(xo,Nr.TRPCClientError.from(new Rt$1("WebSocket closed prematurely"))))}}),No}function jo(Mo,No){const{type:Do,input:Fo,path:Xo,id:Lo}=Mo,Bo={id:Lo,method:Do,params:{input:Fo,path:Xo}};return ao[Lo]={ws:fo,type:Do,callbacks:No,op:Mo},oo.push(Bo),go(),()=>{var uo,po;const xo=(uo=ao[Lo])==null?void 0:uo.callbacks;delete ao[Lo],oo=oo.filter(bo=>bo.id!==Lo),(po=xo==null?void 0:xo.complete)==null||po.call(xo),fo.readyState===to.OPEN&&Mo.type==="subscription"&&(oo.push({id:Lo,method:"subscription.stop"}),go())}}return{close:()=>{ho="closed",io==null||io(),ko(),Eo(fo),clearTimeout(lo),lo=null},request:jo,getConnection(){return fo}}}let Rt$1=class N_ extends Error{constructor(eo){super(eo),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,N_.prototype)}};function xs(Xr){return eo=>{const{client:to}=Xr;return({op:ro})=>_s.observable(no=>{const{type:io,path:oo,id:ao,context:so}=ro,co=eo.transformer.serialize(ro.input),lo=to.request({type:io,path:oo,input:co,id:ao,context:so},{error(fo){no.error(fo),lo()},complete(){no.complete()},next(fo){const ho=bs.transformResult(fo,eo);if(!ho.ok){no.error(Nr.TRPCClientError.from(ho.error));return}no.next({result:ho.result}),ro.type!=="subscription"&&(lo(),no.complete())}});return()=>{lo()}})}}tt.createWSClient=ws;tt.wsLink=xs;Object.defineProperty(O$2,"__esModule",{value:!0});var Gt$1=pe$1,Lr=Et$1,Ir=he$1,Yt$1=Xn,_e$1=q$1,jr=kt$1,Ot$1=et,Ts=Ct$1,Ar=tt;let rt$1=class{$request({type:eo,input:to,path:ro,context:no={}}){return Lr.createChain({links:this.links,op:{id:++this.requestId,type:eo,path:ro,input:to,context:no}}).pipe(Gt$1.share())}requestAsPromise(eo){const to=this.$request(eo),{promise:ro,abort:no}=Gt$1.observableToPromise(to);return new Promise((io,oo)=>{var ao;(ao=eo.signal)==null||ao.addEventListener("abort",no),ro.then(so=>{io(so.result.data)}).catch(so=>{oo(Ir.TRPCClientError.from(so))})})}query(eo,to,ro){return this.requestAsPromise({type:"query",path:eo,input:to,context:ro==null?void 0:ro.context,signal:ro==null?void 0:ro.signal})}mutation(eo,to,ro){return this.requestAsPromise({type:"mutation",path:eo,input:to,context:ro==null?void 0:ro.context,signal:ro==null?void 0:ro.signal})}subscription(eo,to,ro){return this.$request({type:"subscription",path:eo,input:to,context:ro==null?void 0:ro.context}).subscribe({next(no){var io,oo,ao;no.result.type==="started"?(io=ro.onStarted)==null||io.call(ro):no.result.type==="stopped"?(oo=ro.onStopped)==null||oo.call(ro):(ao=ro.onData)==null||ao.call(ro,no.result.data)},error(no){var io;(io=ro.onError)==null||io.call(ro,no)},complete(){var no;(no=ro.onComplete)==null||no.call(ro)}})}constructor(eo){this.requestId=0;const to=(()=>{const ro=eo.transformer;return ro?"input"in ro?eo.transformer:{input:ro,output:ro}:{input:{serialize:no=>no,deserialize:no=>no},output:{serialize:no=>no,deserialize:no=>no}}})();this.runtime={transformer:{serialize:ro=>to.input.serialize(ro),deserialize:ro=>to.output.deserialize(ro)},combinedTransformer:to},this.links=eo.links.map(ro=>ro(this.runtime))}};function Es(Xr){return new rt$1(Xr)}function ks(Xr){return new rt$1(Xr)}const Cs={query:"query",mutate:"mutation",subscribe:"subscription"},Mr=Xr=>Cs[Xr];function $r(Xr){return Yt$1.createFlatProxy(eo=>Xr.hasOwnProperty(eo)?Xr[eo]:eo==="__untypedClient"?Xr:Yt$1.createRecursiveProxy(({path:to,args:ro})=>{const no=[eo,...to],io=Mr(no.pop()),oo=no.join(".");return Xr[io](oo,...ro)}))}function Rs(Xr){const eo=new rt$1(Xr);return $r(eo)}function Os(Xr){return Xr.__untypedClient}function Ps(Xr){if(Xr)return Xr;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}async function Ss(Xr){const eo=Xr.parse??JSON.parse,to=ro=>{var ao;if((ao=Xr.signal)!=null&&ao.aborted||!ro||ro==="}")return;const no=ro.indexOf(":"),io=ro.substring(2,no-1),oo=ro.substring(no+1);Xr.onSingle(Number(io),eo(oo))};await Ns(Xr.readableStream,to,Xr.textDecoder)}async function Ns(Xr,eo,to){let ro="";const no=io=>{const oo=to.decode(io).split(` -`);if(oo.length===1)ro+=oo[0];else if(oo.length>1){eo(ro+oo[0]);for(let ao=1;ao{Xr.on("data",eo),Xr.on("end",to)})}async function Is(Xr,eo){const to=Xr.getReader();let ro=await to.read();for(;!ro.done;)eo(ro.value),ro=await to.read()}const js=(Xr,eo)=>{const to=Xr.AbortController?new Xr.AbortController:null,ro=_e$1.fetchHTTPResponse({...Xr,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:_e$1.getUrl,getBody:_e$1.getBody},to),no=()=>to==null?void 0:to.abort(),io=ro.then(async oo=>{if(!oo.body)throw new Error("Received response without body");const ao={response:oo};return Ss({readableStream:oo.body,onSingle:eo,parse:so=>({json:JSON.parse(so),meta:ao}),signal:to==null?void 0:to.signal,textDecoder:Xr.textDecoder})});return{cancel:no,promise:io}},As=Xr=>{const eo=Ps(Xr.opts.textDecoder);return(to,ro)=>{const no=to.map(so=>so.path).join(","),io=to.map(so=>so.input),{cancel:oo,promise:ao}=js({...Xr,textDecoder:eo,path:no,inputs:io,headers(){return Xr.opts.headers?typeof Xr.opts.headers=="function"?Xr.opts.headers({opList:to}):Xr.opts.headers:{}}},(so,co)=>{ro(so,co)});return{promise:ao.then(()=>[]),cancel:oo}}},Ms=jr.createHTTPBatchLink(As),$s=Xr=>{if("input"in Xr){if(!(Xr.input instanceof FormData))throw new Error("Input is not FormData");return Xr.input}},Ds=Xr=>{if(Xr.type!=="mutation")throw new Error("We only handle mutations with formdata");return _e$1.httpRequest({...Xr,getUrl(){return`${Xr.url}/${Xr.path}`},getBody:$s})},Zs=Ot$1.httpLinkFactory({requester:Ds});O$2.splitLink=Lr.splitLink;O$2.TRPCClientError=Ir.TRPCClientError;O$2.getFetch=_e$1.getFetch;O$2.httpBatchLink=jr.httpBatchLink;O$2.httpLink=Ot$1.httpLink;O$2.httpLinkFactory=Ot$1.httpLinkFactory;O$2.loggerLink=Ts.loggerLink;O$2.createWSClient=Ar.createWSClient;O$2.wsLink=Ar.wsLink;O$2.TRPCUntypedClient=rt$1;O$2.clientCallTypeToProcedureType=Mr;O$2.createTRPCClient=ks;O$2.createTRPCClientProxy=$r;O$2.createTRPCProxyClient=Rs;O$2.createTRPCUntypedClient=Es;O$2.experimental_formDataLink=Zs;O$2.getUntypedClient=Os;O$2.unstable_httpBatchStreamLink=Ms;var X$1={},Pt$1={};function Us(Xr){return Xr}function Ws(Xr){return Xr.length===0?Us:Xr.length===1?Xr[0]:function(eo){return Xr.reduce((to,ro)=>ro(to),eo)}}function qs(Xr){return typeof Xr=="object"&&Xr!==null&&"subscribe"in Xr}function zs(Xr){const eo={subscribe(to){let ro=null,no=!1,io=!1,oo=!1;function ao(){if(ro===null){oo=!0;return}io||(io=!0,typeof ro=="function"?ro():ro&&ro.unsubscribe())}return ro=Xr({next(so){var co;no||((co=to.next)==null||co.call(to,so))},error(so){var co;no||(no=!0,(co=to.error)==null||co.call(to,so),ao())},complete(){var so;no||(no=!0,(so=to.complete)==null||so.call(to),ao())}}),oo&&ao(),{unsubscribe:ao}},pipe(...to){return Ws(to)(eo)}};return eo}Pt$1.isObservable=qs;Pt$1.observable=zs;Object.defineProperty(X$1,"__esModule",{value:!0});var Dr=Pt$1;function Vs(Xr){return eo=>{let to=0,ro=null;const no=[];function io(){ro||(ro=eo.subscribe({next(ao){var so;for(const co of no)(so=co.next)==null||so.call(co,ao)},error(ao){var so;for(const co of no)(so=co.error)==null||so.call(co,ao)},complete(){var ao;for(const so of no)(ao=so.complete)==null||ao.call(so)}}))}function oo(){if(to===0&&ro){const ao=ro;ro=null,ao.unsubscribe()}}return{subscribe(ao){return to++,no.push(ao),io(),{unsubscribe(){to--,oo();const so=no.findIndex(co=>co===ao);so>-1&&no.splice(so,1)}}}}}}function Bs(Xr){return eo=>({subscribe(to){let ro=0;return eo.subscribe({next(no){var io;(io=to.next)==null||io.call(to,Xr(no,ro++))},error(no){var io;(io=to.error)==null||io.call(to,no)},complete(){var no;(no=to.complete)==null||no.call(to)}})}})}function Hs(Xr){return eo=>({subscribe(to){return eo.subscribe({next(ro){var no,io;(no=Xr.next)==null||no.call(Xr,ro),(io=to.next)==null||io.call(to,ro)},error(ro){var no,io;(no=Xr.error)==null||no.call(Xr,ro),(io=to.error)==null||io.call(to,ro)},complete(){var ro,no;(ro=Xr.complete)==null||ro.call(Xr),(no=to.complete)==null||no.call(to)}})}})}let St$1=class M_ extends Error{constructor(eo){super(eo),this.name="ObservableAbortError",Object.setPrototypeOf(this,M_.prototype)}};function Fs(Xr){let eo;return{promise:new Promise((to,ro)=>{let no=!1;function io(){no||(no=!0,ro(new St$1("This operation was aborted.")),oo.unsubscribe())}const oo=Xr.subscribe({next(ao){no=!0,to(ao),io()},error(ao){no=!0,ro(ao),io()},complete(){no=!0,io()}});eo=io}),abort:eo}}X$1.isObservable=Dr.isObservable;X$1.observable=Dr.observable;X$1.map=Bs;X$1.observableToPromise=Fs;X$1.share=Vs;X$1.tap=Hs;var Z$1={};Object.defineProperty(Z$1,"__esModule",{value:!0});Z$1.isTRPCRequestWithId=Z$1.isTRPCRequest=Z$1.isTRPCResponse=Z$1.isTRPCMessage=void 0;function Qt$1(Xr){return typeof Xr=="object"&&Xr!==null&&!Array.isArray(Xr)}function Js(Xr){return Xr==null}function Zr(Xr){return!!(Qt$1(Xr)&&"trpc"in Xr&&Qt$1(Xr.trpc))}Z$1.isTRPCMessage=Zr;function Nt$1(Xr){return Zr(Xr)&&"id"in Xr.trpc&&!Js(Xr.trpc.id)}function Gs(Xr){return Nt$1(Xr)&&("error"in Xr.trpc||"result"in Xr.trpc)}Z$1.isTRPCResponse=Gs;function Ur(Xr){return Nt$1(Xr)&&"method"in Xr.trpc}Z$1.isTRPCRequest=Ur;function Ys(Xr){return Ur(Xr)&&Nt$1(Xr)}Z$1.isTRPCRequestWithId=Ys;Object.defineProperty(fe,"__esModule",{value:!0});fe.createBaseLink=void 0;const ht$1=O$2,Qs=X$1,Xs=Z$1,Ks=Xr=>eo=>({op:to})=>(0,Qs.observable)(ro=>{const no=[],{id:io,type:oo,path:ao}=to;try{const so=eo.transformer.serialize(to.input),co=()=>{ro.error(new ht$1.TRPCClientError("Port disconnected prematurely"))};Xr.addCloseListener(co),no.push(()=>Xr.removeCloseListener(co));const lo=fo=>{if(!(0,Xs.isTRPCResponse)(fo))return;const{trpc:ho}=fo;if(io===ho.id){if("error"in ho){const go=eo.transformer.deserialize(ho.error);ro.error(ht$1.TRPCClientError.from(Object.assign(Object.assign({},ho),{error:go})));return}ro.next({result:Object.assign(Object.assign({},ho.result),(!ho.result.type||ho.result.type==="data")&&{type:"data",data:eo.transformer.deserialize(ho.result.data)})}),(oo!=="subscription"||ho.result.type==="stopped")&&ro.complete()}};Xr.addMessageListener(lo),no.push(()=>Xr.removeMessageListener(lo)),Xr.postMessage({trpc:{id:io,jsonrpc:void 0,method:oo,params:{path:ao,input:so}}})}catch(so){ro.error(new ht$1.TRPCClientError(so instanceof Error?so.message:"Unknown error"))}return()=>{oo==="subscription"&&Xr.postMessage({trpc:{id:io,jsonrpc:void 0,method:"subscription.stop"}}),no.forEach(so=>so())}});fe.createBaseLink=Ks;Object.defineProperty(Xe$1,"__esModule",{value:!0});Xe$1.chromeLink=void 0;const ei=fe,ti=Xr=>(0,ei.createBaseLink)({postMessage(eo){Xr.port.postMessage(eo)},addMessageListener(eo){Xr.port.onMessage.addListener(eo)},removeMessageListener(eo){Xr.port.onMessage.removeListener(eo)},addCloseListener(eo){Xr.port.onDisconnect.addListener(eo)},removeCloseListener(eo){Xr.port.onDisconnect.removeListener(eo)}});Xe$1.chromeLink=ti;var nt$1={};Object.defineProperty(nt$1,"__esModule",{value:!0});nt$1.windowLink=void 0;const ri=fe,ni=Xr=>{var eo;const to=new Map,ro=Xr.window,no=(eo=Xr.postWindow)!==null&&eo!==void 0?eo:ro;return(0,ri.createBaseLink)({postMessage(io){no.postMessage(io,{targetOrigin:Xr.postOrigin})},addMessageListener(io){const oo=ao=>{io(ao.data)};to.set(io,oo),ro.addEventListener("message",oo)},removeMessageListener(io){const oo=to.get(io);oo&&ro.removeEventListener("message",oo)},addCloseListener(io){ro.addEventListener("beforeunload",io)},removeCloseListener(io){ro.removeEventListener("beforeunload",io)}})};nt$1.windowLink=ni;var st$1={},it$1={};Object.defineProperty(it$1,"__esModule",{value:!0});it$1.TRPC_BROWSER_LOADED_EVENT=void 0;it$1.TRPC_BROWSER_LOADED_EVENT="TRPC_BROWSER::POPUP_LOADED";Object.defineProperty(st$1,"__esModule",{value:!0});st$1.popupLink=void 0;const si=it$1,ii=fe,ai=Xr=>{const eo=new Map,to=new Set;let ro=null;async function no(io){if(!ro||ro.closed){ro=Xr.createPopup(),await Promise.race([new Promise(oo=>{var ao;try{(ao=ro==null?void 0:ro.addEventListener)===null||ao===void 0||ao.call(ro,"load",oo)}catch{}}),new Promise(oo=>{io.addEventListener("message",ao=>{ao.data===si.TRPC_BROWSER_LOADED_EVENT&&oo()})}),new Promise(oo=>{console.warn("Could not detect if popup loading succeeded after 15s timeout, continuing anyway"),setTimeout(oo,15e3)})]);try{if(!ro.addEventListener)throw new Error("popupWindow.addEventListener is not a function");ro.addEventListener("beforeunload",()=>{ro=null})}catch{const oo=setInterval(()=>{ro&&ro.closed&&(ro=null,to.forEach(ao=>{ao()}),clearInterval(oo))},1e3)}}return ro}return(0,ii.createBaseLink)({async postMessage(io){return(await no(Xr.listenWindow)).postMessage(io,{targetOrigin:Xr.postOrigin})},addMessageListener(io){const oo=ao=>{io(ao.data)};eo.set(io,oo),Xr.listenWindow.addEventListener("message",oo)},removeMessageListener(io){const oo=eo.get(io);oo&&Xr.listenWindow.removeEventListener("message",oo)},addCloseListener(io){Xr.listenWindow.addEventListener("beforeunload",io),to.add(io)},removeCloseListener(io){Xr.listenWindow.removeEventListener("beforeunload",io),to.delete(io)}})};st$1.popupLink=ai;(function(Xr){var eo=F$2&&F$2.__createBinding||(Object.create?function(ro,no,io,oo){oo===void 0&&(oo=io);var ao=Object.getOwnPropertyDescriptor(no,io);(!ao||("get"in ao?!no.__esModule:ao.writable||ao.configurable))&&(ao={enumerable:!0,get:function(){return no[io]}}),Object.defineProperty(ro,oo,ao)}:function(ro,no,io,oo){oo===void 0&&(oo=io),ro[oo]=no[io]}),to=F$2&&F$2.__exportStar||function(ro,no){for(var io in ro)io!=="default"&&!Object.prototype.hasOwnProperty.call(no,io)&&eo(no,ro,io)};Object.defineProperty(Xr,"__esModule",{value:!0}),to(Xe$1,Xr),to(nt$1,Xr),to(st$1,Xr)})(mt$1);var T$1;(function(Xr){Xr.assertEqual=no=>no;function eo(no){}Xr.assertIs=eo;function to(no){throw new Error}Xr.assertNever=to,Xr.arrayToEnum=no=>{const io={};for(const oo of no)io[oo]=oo;return io},Xr.getValidEnumValues=no=>{const io=Xr.objectKeys(no).filter(ao=>typeof no[no[ao]]!="number"),oo={};for(const ao of io)oo[ao]=no[ao];return Xr.objectValues(oo)},Xr.objectValues=no=>Xr.objectKeys(no).map(function(io){return no[io]}),Xr.objectKeys=typeof Object.keys=="function"?no=>Object.keys(no):no=>{const io=[];for(const oo in no)Object.prototype.hasOwnProperty.call(no,oo)&&io.push(oo);return io},Xr.find=(no,io)=>{for(const oo of no)if(io(oo))return oo},Xr.isInteger=typeof Number.isInteger=="function"?no=>Number.isInteger(no):no=>typeof no=="number"&&isFinite(no)&&Math.floor(no)===no;function ro(no,io=" | "){return no.map(oo=>typeof oo=="string"?`'${oo}'`:oo).join(io)}Xr.joinValues=ro,Xr.jsonStringifyReplacer=(no,io)=>typeof io=="bigint"?io.toString():io})(T$1||(T$1={}));const p=T$1.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G$1=Xr=>{switch(typeof Xr){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(Xr)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(Xr)?p.array:Xr===null?p.null:Xr.then&&typeof Xr.then=="function"&&Xr.catch&&typeof Xr.catch=="function"?p.promise:typeof Map<"u"&&Xr instanceof Map?p.map:typeof Set<"u"&&Xr instanceof Set?p.set:typeof Date<"u"&&Xr instanceof Date?p.date:p.object;default:return p.unknown}},d$2=T$1.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),oi=Xr=>JSON.stringify(Xr,null,2).replace(/"([^"]+)":/g,"$1:");let B$1=class extends Error{constructor(eo){super(),this.issues=[],this.addIssue=ro=>{this.issues=[...this.issues,ro]},this.addIssues=(ro=[])=>{this.issues=[...this.issues,...ro]};const to=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,to):this.__proto__=to,this.name="ZodError",this.issues=eo}get errors(){return this.issues}format(eo){const to=eo||function(io){return io.message},ro={_errors:[]},no=io=>{for(const oo of io.issues)if(oo.code==="invalid_union")oo.unionErrors.map(no);else if(oo.code==="invalid_return_type")no(oo.returnTypeError);else if(oo.code==="invalid_arguments")no(oo.argumentsError);else if(oo.path.length===0)ro._errors.push(to(oo));else{let ao=ro,so=0;for(;soto.message){const to={},ro=[];for(const no of this.issues)no.path.length>0?(to[no.path[0]]=to[no.path[0]]||[],to[no.path[0]].push(eo(no))):ro.push(eo(no));return{formErrors:ro,fieldErrors:to}}get formErrors(){return this.flatten()}};B$1.create=Xr=>new B$1(Xr);const ve$1=(Xr,eo)=>{let to;switch(Xr.code){case d$2.invalid_type:Xr.received===p.undefined?to="Required":to=`Expected ${Xr.expected}, received ${Xr.received}`;break;case d$2.invalid_literal:to=`Invalid literal value, expected ${JSON.stringify(Xr.expected,T$1.jsonStringifyReplacer)}`;break;case d$2.unrecognized_keys:to=`Unrecognized key(s) in object: ${T$1.joinValues(Xr.keys,", ")}`;break;case d$2.invalid_union:to="Invalid input";break;case d$2.invalid_union_discriminator:to=`Invalid discriminator value. Expected ${T$1.joinValues(Xr.options)}`;break;case d$2.invalid_enum_value:to=`Invalid enum value. Expected ${T$1.joinValues(Xr.options)}, received '${Xr.received}'`;break;case d$2.invalid_arguments:to="Invalid function arguments";break;case d$2.invalid_return_type:to="Invalid function return type";break;case d$2.invalid_date:to="Invalid date";break;case d$2.invalid_string:typeof Xr.validation=="object"?"startsWith"in Xr.validation?to=`Invalid input: must start with "${Xr.validation.startsWith}"`:"endsWith"in Xr.validation?to=`Invalid input: must end with "${Xr.validation.endsWith}"`:T$1.assertNever(Xr.validation):Xr.validation!=="regex"?to=`Invalid ${Xr.validation}`:to="Invalid";break;case d$2.too_small:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"more than"} ${Xr.minimum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"over"} ${Xr.minimum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${Xr.minimum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${new Date(Xr.minimum)}`:to="Invalid input";break;case d$2.too_big:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"less than"} ${Xr.maximum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"under"} ${Xr.maximum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly":Xr.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Xr.maximum)}`:to="Invalid input";break;case d$2.custom:to="Invalid input";break;case d$2.invalid_intersection_types:to="Intersection results could not be merged";break;case d$2.not_multiple_of:to=`Number must be a multiple of ${Xr.multipleOf}`;break;case d$2.not_finite:to="Number must be finite";break;default:to=eo.defaultError,T$1.assertNever(Xr)}return{message:to}};let Wr=ve$1;function ci(Xr){Wr=Xr}function Ue$1(){return Wr}const We$1=Xr=>{const{data:eo,path:to,errorMaps:ro,issueData:no}=Xr,io=[...to,...no.path||[]],oo={...no,path:io};let ao="";const so=ro.filter(co=>!!co).slice().reverse();for(const co of so)ao=co(oo,{data:eo,defaultError:ao}).message;return{...no,path:io,message:no.message||ao}},ui=[];function y$3(Xr,eo){const to=We$1({issueData:eo,data:Xr.data,path:Xr.path,errorMaps:[Xr.common.contextualErrorMap,Xr.schemaErrorMap,Ue$1(),ve$1].filter(ro=>!!ro)});Xr.common.issues.push(to)}let L$2=class j_{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(eo,to){const ro=[];for(const no of to){if(no.status==="aborted")return _$2;no.status==="dirty"&&eo.dirty(),ro.push(no.value)}return{status:eo.value,value:ro}}static async mergeObjectAsync(eo,to){const ro=[];for(const no of to)ro.push({key:await no.key,value:await no.value});return j_.mergeObjectSync(eo,ro)}static mergeObjectSync(eo,to){const ro={};for(const no of to){const{key:io,value:oo}=no;if(io.status==="aborted"||oo.status==="aborted")return _$2;io.status==="dirty"&&eo.dirty(),oo.status==="dirty"&&eo.dirty(),(typeof oo.value<"u"||no.alwaysSet)&&(ro[io.value]=oo.value)}return{status:eo.value,value:ro}}};const _$2=Object.freeze({status:"aborted"}),qr=Xr=>({status:"dirty",value:Xr}),N$2=Xr=>({status:"valid",value:Xr}),gt$1=Xr=>Xr.status==="aborted",_t$1=Xr=>Xr.status==="dirty",qe$1=Xr=>Xr.status==="valid",ze$1=Xr=>typeof Promise<"u"&&Xr instanceof Promise;var w;(function(Xr){Xr.errToObj=eo=>typeof eo=="string"?{message:eo}:eo||{},Xr.toString=eo=>typeof eo=="string"?eo:eo==null?void 0:eo.message})(w||(w={}));let U$1=class{constructor(eo,to,ro,no){this.parent=eo,this.data=to,this._path=ro,this._key=no}get path(){return this._path.concat(this._key)}};const Xt$1=(Xr,eo)=>{if(qe$1(eo))return{success:!0,data:eo.value};if(!Xr.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,error:new B$1(Xr.common.issues)}};function b$1(Xr){if(!Xr)return{};const{errorMap:eo,invalid_type_error:to,required_error:ro,description:no}=Xr;if(eo&&(to||ro))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return eo?{errorMap:eo,description:no}:{errorMap:(io,oo)=>io.code!=="invalid_type"?{message:oo.defaultError}:typeof oo.data>"u"?{message:ro??oo.defaultError}:{message:to??oo.defaultError},description:no}}class v{constructor(eo){this.spa=this.safeParseAsync,this._def=eo,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(eo){return G$1(eo.data)}_getOrReturnCtx(eo,to){return to||{common:eo.parent.common,data:eo.data,parsedType:G$1(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}_processInputParams(eo){return{status:new L$2,ctx:{common:eo.parent.common,data:eo.data,parsedType:G$1(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}}_parseSync(eo){const to=this._parse(eo);if(ze$1(to))throw new Error("Synchronous parse encountered promise.");return to}_parseAsync(eo){const to=this._parse(eo);return Promise.resolve(to)}parse(eo,to){const ro=this.safeParse(eo,to);if(ro.success)return ro.data;throw ro.error}safeParse(eo,to){var ro;const no={common:{issues:[],async:(ro=to==null?void 0:to.async)!==null&&ro!==void 0?ro:!1,contextualErrorMap:to==null?void 0:to.errorMap},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:G$1(eo)},io=this._parseSync({data:eo,path:no.path,parent:no});return Xt$1(no,io)}async parseAsync(eo,to){const ro=await this.safeParseAsync(eo,to);if(ro.success)return ro.data;throw ro.error}async safeParseAsync(eo,to){const ro={common:{issues:[],contextualErrorMap:to==null?void 0:to.errorMap,async:!0},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:G$1(eo)},no=this._parse({data:eo,path:ro.path,parent:ro}),io=await(ze$1(no)?no:Promise.resolve(no));return Xt$1(ro,io)}refine(eo,to){const ro=no=>typeof to=="string"||typeof to>"u"?{message:to}:typeof to=="function"?to(no):to;return this._refinement((no,io)=>{const oo=eo(no),ao=()=>io.addIssue({code:d$2.custom,...ro(no)});return typeof Promise<"u"&&oo instanceof Promise?oo.then(so=>so?!0:(ao(),!1)):oo?!0:(ao(),!1)})}refinement(eo,to){return this._refinement((ro,no)=>eo(ro)?!0:(no.addIssue(typeof to=="function"?to(ro,no):to),!1))}_refinement(eo){return new D({schema:this,typeName:g$1.ZodEffects,effect:{type:"refinement",refinement:eo}})}superRefine(eo){return this._refinement(eo)}optional(){return H$1.create(this,this._def)}nullable(){return re$1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $$1.create(this,this._def)}promise(){return de$1.create(this,this._def)}or(eo){return ke$1.create([this,eo],this._def)}and(eo){return Ce$1.create(this,eo,this._def)}transform(eo){return new D({...b$1(this._def),schema:this,typeName:g$1.ZodEffects,effect:{type:"transform",transform:eo}})}default(eo){const to=typeof eo=="function"?eo:()=>eo;return new Ne$1({...b$1(this._def),innerType:this,defaultValue:to,typeName:g$1.ZodDefault})}brand(){return new Vr({typeName:g$1.ZodBranded,type:this,...b$1(this._def)})}catch(eo){const to=typeof eo=="function"?eo:()=>eo;return new Je({...b$1(this._def),innerType:this,catchValue:to,typeName:g$1.ZodCatch})}describe(eo){const to=this.constructor;return new to({...this._def,description:eo})}pipe(eo){return Le$1.create(this,eo)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const li=/^c[^\s-]{8,}$/i,di=/^[a-z][a-z0-9]*$/,fi=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,pi=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/,hi=Xr=>Xr.precision?Xr.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}Z$`):Xr.precision===0?Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");let F$1=class xv extends v{constructor(){super(...arguments),this._regex=(eo,to,ro)=>this.refinement(no=>eo.test(no),{validation:to,code:d$2.invalid_string,...w.errToObj(ro)}),this.nonempty=eo=>this.min(1,w.errToObj(eo)),this.trim=()=>new xv({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(eo){if(this._def.coerce&&(eo.data=String(eo.data)),this._getType(eo)!==p.string){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.string,received:no.parsedType}),_$2}const to=new L$2;let ro;for(const no of this._def.checks)if(no.kind==="min")eo.data.lengthno.value&&(ro=this._getOrReturnCtx(eo,ro),y$3(ro,{code:d$2.too_big,maximum:no.value,type:"string",inclusive:!0,exact:!1,message:no.message}),to.dirty());else if(no.kind==="length"){const io=eo.data.length>no.value,oo=eo.data.length"u"?null:eo==null?void 0:eo.precision,offset:(to=eo==null?void 0:eo.offset)!==null&&to!==void 0?to:!1,...w.errToObj(eo==null?void 0:eo.message)})}regex(eo,to){return this._addCheck({kind:"regex",regex:eo,...w.errToObj(to)})}startsWith(eo,to){return this._addCheck({kind:"startsWith",value:eo,...w.errToObj(to)})}endsWith(eo,to){return this._addCheck({kind:"endsWith",value:eo,...w.errToObj(to)})}min(eo,to){return this._addCheck({kind:"min",value:eo,...w.errToObj(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo,...w.errToObj(to)})}length(eo,to){return this._addCheck({kind:"length",value:eo,...w.errToObj(to)})}get isDatetime(){return!!this._def.checks.find(eo=>eo.kind==="datetime")}get isEmail(){return!!this._def.checks.find(eo=>eo.kind==="email")}get isURL(){return!!this._def.checks.find(eo=>eo.kind==="url")}get isUUID(){return!!this._def.checks.find(eo=>eo.kind==="uuid")}get isCUID(){return!!this._def.checks.find(eo=>eo.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(eo=>eo.kind==="cuid2")}get minLength(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxLength(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new F$1({checks:[],typeName:g$1.ZodString,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...b$1(Xr)})};function mi(Xr,eo){const to=(Xr.toString().split(".")[1]||"").length,ro=(eo.toString().split(".")[1]||"").length,no=to>ro?to:ro,io=parseInt(Xr.toFixed(no).replace(".","")),oo=parseInt(eo.toFixed(no).replace(".",""));return io%oo/Math.pow(10,no)}let Y$1=class Ev extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(eo){if(this._def.coerce&&(eo.data=Number(eo.data)),this._getType(eo)!==p.number){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.number,received:no.parsedType}),_$2}let to;const ro=new L$2;for(const no of this._def.checks)no.kind==="int"?T$1.isInteger(eo.data)||(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.invalid_type,expected:"integer",received:"float",message:no.message}),ro.dirty()):no.kind==="min"?(no.inclusive?eo.datano.value:eo.data>=no.value)&&(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.too_big,maximum:no.value,type:"number",inclusive:no.inclusive,exact:!1,message:no.message}),ro.dirty()):no.kind==="multipleOf"?mi(eo.data,no.value)!==0&&(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.not_multiple_of,multipleOf:no.value,message:no.message}),ro.dirty()):no.kind==="finite"?Number.isFinite(eo.data)||(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.not_finite,message:no.message}),ro.dirty()):T$1.assertNever(no);return{status:ro.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,w.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,w.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,w.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,w.toString(to))}setLimit(eo,to,ro,no){return new Ev({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:w.toString(no)}]})}_addCheck(eo){return new Ev({...this._def,checks:[...this._def.checks,eo]})}int(eo){return this._addCheck({kind:"int",message:w.toString(eo)})}positive(eo){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:w.toString(to)})}finite(eo){return this._addCheck({kind:"finite",message:w.toString(eo)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valueeo.kind==="int"||eo.kind==="multipleOf"&&T$1.isInteger(eo.value))}get isFinite(){let eo=null,to=null;for(const ro of this._def.checks){if(ro.kind==="finite"||ro.kind==="int"||ro.kind==="multipleOf")return!0;ro.kind==="min"?(to===null||ro.value>to)&&(to=ro.value):ro.kind==="max"&&(eo===null||ro.valuenew Y$1({checks:[],typeName:g$1.ZodNumber,coerce:(Xr==null?void 0:Xr.coerce)||!1,...b$1(Xr)});let we$1=class extends v{_parse(eo){if(this._def.coerce&&(eo.data=BigInt(eo.data)),this._getType(eo)!==p.bigint){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.bigint,received:to.parsedType}),_$2}return N$2(eo.data)}};we$1.create=Xr=>{var eo;return new we$1({typeName:g$1.ZodBigInt,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...b$1(Xr)})};let xe$1=class extends v{_parse(eo){if(this._def.coerce&&(eo.data=!!eo.data),this._getType(eo)!==p.boolean){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.boolean,received:to.parsedType}),_$2}return N$2(eo.data)}};xe$1.create=Xr=>new xe$1({typeName:g$1.ZodBoolean,coerce:(Xr==null?void 0:Xr.coerce)||!1,...b$1(Xr)});let ee$1=class B_ extends v{_parse(eo){if(this._def.coerce&&(eo.data=new Date(eo.data)),this._getType(eo)!==p.date){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.date,received:no.parsedType}),_$2}if(isNaN(eo.data.getTime())){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_date}),_$2}const to=new L$2;let ro;for(const no of this._def.checks)no.kind==="min"?eo.data.getTime()no.value&&(ro=this._getOrReturnCtx(eo,ro),y$3(ro,{code:d$2.too_big,message:no.message,inclusive:!0,exact:!1,maximum:no.value,type:"date"}),to.dirty()):T$1.assertNever(no);return{status:to.value,value:new Date(eo.data.getTime())}}_addCheck(eo){return new B_({...this._def,checks:[...this._def.checks,eo]})}min(eo,to){return this._addCheck({kind:"min",value:eo.getTime(),message:w.toString(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo.getTime(),message:w.toString(to)})}get minDate(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo!=null?new Date(eo):null}get maxDate(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valuenew ee$1({checks:[],coerce:(Xr==null?void 0:Xr.coerce)||!1,typeName:g$1.ZodDate,...b$1(Xr)});let Ve$1=class extends v{_parse(eo){if(this._getType(eo)!==p.symbol){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.symbol,received:to.parsedType}),_$2}return N$2(eo.data)}};Ve$1.create=Xr=>new Ve$1({typeName:g$1.ZodSymbol,...b$1(Xr)});let Te$1=class extends v{_parse(eo){if(this._getType(eo)!==p.undefined){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.undefined,received:to.parsedType}),_$2}return N$2(eo.data)}};Te$1.create=Xr=>new Te$1({typeName:g$1.ZodUndefined,...b$1(Xr)});let Ee$1=class extends v{_parse(eo){if(this._getType(eo)!==p.null){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.null,received:to.parsedType}),_$2}return N$2(eo.data)}};Ee$1.create=Xr=>new Ee$1({typeName:g$1.ZodNull,...b$1(Xr)});let le$1=class extends v{constructor(){super(...arguments),this._any=!0}_parse(eo){return N$2(eo.data)}};le$1.create=Xr=>new le$1({typeName:g$1.ZodAny,...b$1(Xr)});let K$1=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(eo){return N$2(eo.data)}};K$1.create=Xr=>new K$1({typeName:g$1.ZodUnknown,...b$1(Xr)});let J$1=class extends v{_parse(eo){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.never,received:to.parsedType}),_$2}};J$1.create=Xr=>new J$1({typeName:g$1.ZodNever,...b$1(Xr)});let Be$1=class extends v{_parse(eo){if(this._getType(eo)!==p.undefined){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.void,received:to.parsedType}),_$2}return N$2(eo.data)}};Be$1.create=Xr=>new Be$1({typeName:g$1.ZodVoid,...b$1(Xr)});let $$1=class e1 extends v{_parse(eo){const{ctx:to,status:ro}=this._processInputParams(eo),no=this._def;if(to.parsedType!==p.array)return y$3(to,{code:d$2.invalid_type,expected:p.array,received:to.parsedType}),_$2;if(no.exactLength!==null){const oo=to.data.length>no.exactLength.value,ao=to.data.lengthno.maxLength.value&&(y$3(to,{code:d$2.too_big,maximum:no.maxLength.value,type:"array",inclusive:!0,exact:!1,message:no.maxLength.message}),ro.dirty()),to.common.async)return Promise.all([...to.data].map((oo,ao)=>no.type._parseAsync(new U$1(to,oo,to.path,ao)))).then(oo=>L$2.mergeArray(ro,oo));const io=[...to.data].map((oo,ao)=>no.type._parseSync(new U$1(to,oo,to.path,ao)));return L$2.mergeArray(ro,io)}get element(){return this._def.type}min(eo,to){return new e1({...this._def,minLength:{value:eo,message:w.toString(to)}})}max(eo,to){return new e1({...this._def,maxLength:{value:eo,message:w.toString(to)}})}length(eo,to){return new e1({...this._def,exactLength:{value:eo,message:w.toString(to)}})}nonempty(eo){return this.min(1,eo)}};$$1.create=(Xr,eo)=>new $$1({type:Xr,minLength:null,maxLength:null,exactLength:null,typeName:g$1.ZodArray,...b$1(eo)});var He$1;(function(Xr){Xr.mergeShapes=(eo,to)=>({...eo,...to})})(He$1||(He$1={}));function oe$1(Xr){if(Xr instanceof C$1){const eo={};for(const to in Xr.shape){const ro=Xr.shape[to];eo[to]=H$1.create(oe$1(ro))}return new C$1({...Xr._def,shape:()=>eo})}else return Xr instanceof $$1?$$1.create(oe$1(Xr.element)):Xr instanceof H$1?H$1.create(oe$1(Xr.unwrap())):Xr instanceof re$1?re$1.create(oe$1(Xr.unwrap())):Xr instanceof W$1?W$1.create(Xr.items.map(eo=>oe$1(eo))):Xr}let C$1=class Dm extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const eo=this._def.shape(),to=T$1.objectKeys(eo);return this._cached={shape:eo,keys:to}}_parse(eo){if(this._getType(eo)!==p.object){const so=this._getOrReturnCtx(eo);return y$3(so,{code:d$2.invalid_type,expected:p.object,received:so.parsedType}),_$2}const{status:to,ctx:ro}=this._processInputParams(eo),{shape:no,keys:io}=this._getCached(),oo=[];if(!(this._def.catchall instanceof J$1&&this._def.unknownKeys==="strip"))for(const so in ro.data)io.includes(so)||oo.push(so);const ao=[];for(const so of io){const co=no[so],lo=ro.data[so];ao.push({key:{status:"valid",value:so},value:co._parse(new U$1(ro,lo,ro.path,so)),alwaysSet:so in ro.data})}if(this._def.catchall instanceof J$1){const so=this._def.unknownKeys;if(so==="passthrough")for(const co of oo)ao.push({key:{status:"valid",value:co},value:{status:"valid",value:ro.data[co]}});else if(so==="strict")oo.length>0&&(y$3(ro,{code:d$2.unrecognized_keys,keys:oo}),to.dirty());else if(so!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const so=this._def.catchall;for(const co of oo){const lo=ro.data[co];ao.push({key:{status:"valid",value:co},value:so._parse(new U$1(ro,lo,ro.path,co)),alwaysSet:co in ro.data})}}return ro.common.async?Promise.resolve().then(async()=>{const so=[];for(const co of ao){const lo=await co.key;so.push({key:lo,value:await co.value,alwaysSet:co.alwaysSet})}return so}).then(so=>L$2.mergeObjectSync(to,so)):L$2.mergeObjectSync(to,ao)}get shape(){return this._def.shape()}strict(eo){return w.errToObj,new Dm({...this._def,unknownKeys:"strict",...eo!==void 0?{errorMap:(to,ro)=>{var no,io,oo,ao;const so=(oo=(io=(no=this._def).errorMap)===null||io===void 0?void 0:io.call(no,to,ro).message)!==null&&oo!==void 0?oo:ro.defaultError;return to.code==="unrecognized_keys"?{message:(ao=w.errToObj(eo).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new Dm({...this._def,unknownKeys:"strip"})}passthrough(){return new Dm({...this._def,unknownKeys:"passthrough"})}extend(eo){return new Dm({...this._def,shape:()=>({...this._def.shape(),...eo})})}merge(eo){return new Dm({unknownKeys:eo._def.unknownKeys,catchall:eo._def.catchall,shape:()=>He$1.mergeShapes(this._def.shape(),eo._def.shape()),typeName:g$1.ZodObject})}setKey(eo,to){return this.augment({[eo]:to})}catchall(eo){return new Dm({...this._def,catchall:eo})}pick(eo){const to={};return T$1.objectKeys(eo).forEach(ro=>{eo[ro]&&this.shape[ro]&&(to[ro]=this.shape[ro])}),new Dm({...this._def,shape:()=>to})}omit(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{eo[ro]||(to[ro]=this.shape[ro])}),new Dm({...this._def,shape:()=>to})}deepPartial(){return oe$1(this)}partial(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{const no=this.shape[ro];eo&&!eo[ro]?to[ro]=no:to[ro]=no.optional()}),new Dm({...this._def,shape:()=>to})}required(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{if(eo&&!eo[ro])to[ro]=this.shape[ro];else{let no=this.shape[ro];for(;no instanceof H$1;)no=no._def.innerType;to[ro]=no}}),new Dm({...this._def,shape:()=>to})}keyof(){return zr(T$1.objectKeys(this.shape))}};C$1.create=(Xr,eo)=>new C$1({shape:()=>Xr,unknownKeys:"strip",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});C$1.strictCreate=(Xr,eo)=>new C$1({shape:()=>Xr,unknownKeys:"strict",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});C$1.lazycreate=(Xr,eo)=>new C$1({shape:Xr,unknownKeys:"strip",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});let ke$1=class extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.options;function no(io){for(const ao of io)if(ao.result.status==="valid")return ao.result;for(const ao of io)if(ao.result.status==="dirty")return to.common.issues.push(...ao.ctx.common.issues),ao.result;const oo=io.map(ao=>new B$1(ao.ctx.common.issues));return y$3(to,{code:d$2.invalid_union,unionErrors:oo}),_$2}if(to.common.async)return Promise.all(ro.map(async io=>{const oo={...to,common:{...to.common,issues:[]},parent:null};return{result:await io._parseAsync({data:to.data,path:to.path,parent:oo}),ctx:oo}})).then(no);{let io;const oo=[];for(const so of ro){const co={...to,common:{...to.common,issues:[]},parent:null},lo=so._parseSync({data:to.data,path:to.path,parent:co});if(lo.status==="valid")return lo;lo.status==="dirty"&&!io&&(io={result:lo,ctx:co}),co.common.issues.length&&oo.push(co.common.issues)}if(io)return to.common.issues.push(...io.ctx.common.issues),io.result;const ao=oo.map(so=>new B$1(so));return y$3(to,{code:d$2.invalid_union,unionErrors:ao}),_$2}}get options(){return this._def.options}};ke$1.create=(Xr,eo)=>new ke$1({options:Xr,typeName:g$1.ZodUnion,...b$1(eo)});const $e=Xr=>Xr instanceof Oe$1?$e(Xr.schema):Xr instanceof D?$e(Xr.innerType()):Xr instanceof Pe$1?[Xr.value]:Xr instanceof Q$1?Xr.options:Xr instanceof Se$1?Object.keys(Xr.enum):Xr instanceof Ne$1?$e(Xr._def.innerType):Xr instanceof Te$1?[void 0]:Xr instanceof Ee$1?[null]:null;let at$1=class D_ extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.object)return y$3(to,{code:d$2.invalid_type,expected:p.object,received:to.parsedType}),_$2;const ro=this.discriminator,no=to.data[ro],io=this.optionsMap.get(no);return io?to.common.async?io._parseAsync({data:to.data,path:to.path,parent:to}):io._parseSync({data:to.data,path:to.path,parent:to}):(y$3(to,{code:d$2.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ro]}),_$2)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(eo,to,ro){const no=new Map;for(const io of to){const oo=$e(io.shape[eo]);if(!oo)throw new Error(`A discriminator value for key \`${eo}\` could not be extracted from all schema options`);for(const ao of oo){if(no.has(ao))throw new Error(`Discriminator property ${String(eo)} has duplicate value ${String(ao)}`);no.set(ao,io)}}return new D_({typeName:g$1.ZodDiscriminatedUnion,discriminator:eo,options:to,optionsMap:no,...b$1(ro)})}};function bt$1(Xr,eo){const to=G$1(Xr),ro=G$1(eo);if(Xr===eo)return{valid:!0,data:Xr};if(to===p.object&&ro===p.object){const no=T$1.objectKeys(eo),io=T$1.objectKeys(Xr).filter(ao=>no.indexOf(ao)!==-1),oo={...Xr,...eo};for(const ao of io){const so=bt$1(Xr[ao],eo[ao]);if(!so.valid)return{valid:!1};oo[ao]=so.data}return{valid:!0,data:oo}}else if(to===p.array&&ro===p.array){if(Xr.length!==eo.length)return{valid:!1};const no=[];for(let io=0;io{if(gt$1(io)||gt$1(oo))return _$2;const ao=bt$1(io.value,oo.value);return ao.valid?((_t$1(io)||_t$1(oo))&&to.dirty(),{status:to.value,value:ao.data}):(y$3(ro,{code:d$2.invalid_intersection_types}),_$2)};return ro.common.async?Promise.all([this._def.left._parseAsync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseAsync({data:ro.data,path:ro.path,parent:ro})]).then(([io,oo])=>no(io,oo)):no(this._def.left._parseSync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseSync({data:ro.data,path:ro.path,parent:ro}))}};Ce$1.create=(Xr,eo,to)=>new Ce$1({left:Xr,right:eo,typeName:g$1.ZodIntersection,...b$1(to)});let W$1=class L_ extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.array)return y$3(ro,{code:d$2.invalid_type,expected:p.array,received:ro.parsedType}),_$2;if(ro.data.lengththis._def.items.length&&(y$3(ro,{code:d$2.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),to.dirty());const no=[...ro.data].map((io,oo)=>{const ao=this._def.items[oo]||this._def.rest;return ao?ao._parse(new U$1(ro,io,ro.path,oo)):null}).filter(io=>!!io);return ro.common.async?Promise.all(no).then(io=>L$2.mergeArray(to,io)):L$2.mergeArray(to,no)}get items(){return this._def.items}rest(eo){return new L_({...this._def,rest:eo})}};W$1.create=(Xr,eo)=>{if(!Array.isArray(Xr))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W$1({items:Xr,typeName:g$1.ZodTuple,rest:null,...b$1(eo)})};let Re$1=class $v extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.object)return y$3(ro,{code:d$2.invalid_type,expected:p.object,received:ro.parsedType}),_$2;const no=[],io=this._def.keyType,oo=this._def.valueType;for(const ao in ro.data)no.push({key:io._parse(new U$1(ro,ao,ro.path,ao)),value:oo._parse(new U$1(ro,ro.data[ao],ro.path,ao))});return ro.common.async?L$2.mergeObjectAsync(to,no):L$2.mergeObjectSync(to,no)}get element(){return this._def.valueType}static create(eo,to,ro){return to instanceof v?new $v({keyType:eo,valueType:to,typeName:g$1.ZodRecord,...b$1(ro)}):new $v({keyType:F$1.create(),valueType:eo,typeName:g$1.ZodRecord,...b$1(to)})}},Fe$1=class extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.map)return y$3(ro,{code:d$2.invalid_type,expected:p.map,received:ro.parsedType}),_$2;const no=this._def.keyType,io=this._def.valueType,oo=[...ro.data.entries()].map(([ao,so],co)=>({key:no._parse(new U$1(ro,ao,ro.path,[co,"key"])),value:io._parse(new U$1(ro,so,ro.path,[co,"value"]))}));if(ro.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of oo){const co=await so.key,lo=await so.value;if(co.status==="aborted"||lo.status==="aborted")return _$2;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}})}else{const ao=new Map;for(const so of oo){const co=so.key,lo=so.value;if(co.status==="aborted"||lo.status==="aborted")return _$2;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}}}};Fe$1.create=(Xr,eo,to)=>new Fe$1({valueType:eo,keyType:Xr,typeName:g$1.ZodMap,...b$1(to)});let te$1=class Sv extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.set)return y$3(ro,{code:d$2.invalid_type,expected:p.set,received:ro.parsedType}),_$2;const no=this._def;no.minSize!==null&&ro.data.sizeno.maxSize.value&&(y$3(ro,{code:d$2.too_big,maximum:no.maxSize.value,type:"set",inclusive:!0,exact:!1,message:no.maxSize.message}),to.dirty());const io=this._def.valueType;function oo(so){const co=new Set;for(const lo of so){if(lo.status==="aborted")return _$2;lo.status==="dirty"&&to.dirty(),co.add(lo.value)}return{status:to.value,value:co}}const ao=[...ro.data.values()].map((so,co)=>io._parse(new U$1(ro,so,ro.path,co)));return ro.common.async?Promise.all(ao).then(so=>oo(so)):oo(ao)}min(eo,to){return new Sv({...this._def,minSize:{value:eo,message:w.toString(to)}})}max(eo,to){return new Sv({...this._def,maxSize:{value:eo,message:w.toString(to)}})}size(eo,to){return this.min(eo,to).max(eo,to)}nonempty(eo){return this.min(1,eo)}};te$1.create=(Xr,eo)=>new te$1({valueType:Xr,minSize:null,maxSize:null,typeName:g$1.ZodSet,...b$1(eo)});let ce$1=class t1 extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.function)return y$3(to,{code:d$2.invalid_type,expected:p.function,received:to.parsedType}),_$2;function ro(ao,so){return We$1({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,Ue$1(),ve$1].filter(co=>!!co),issueData:{code:d$2.invalid_arguments,argumentsError:so}})}function no(ao,so){return We$1({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,Ue$1(),ve$1].filter(co=>!!co),issueData:{code:d$2.invalid_return_type,returnTypeError:so}})}const io={errorMap:to.common.contextualErrorMap},oo=to.data;return this._def.returns instanceof de$1?N$2(async(...ao)=>{const so=new B$1([]),co=await this._def.args.parseAsync(ao,io).catch(fo=>{throw so.addIssue(ro(ao,fo)),so}),lo=await oo(...co);return await this._def.returns._def.type.parseAsync(lo,io).catch(fo=>{throw so.addIssue(no(lo,fo)),so})}):N$2((...ao)=>{const so=this._def.args.safeParse(ao,io);if(!so.success)throw new B$1([ro(ao,so.error)]);const co=oo(...so.data),lo=this._def.returns.safeParse(co,io);if(!lo.success)throw new B$1([no(co,lo.error)]);return lo.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...eo){return new t1({...this._def,args:W$1.create(eo).rest(K$1.create())})}returns(eo){return new t1({...this._def,returns:eo})}implement(eo){return this.parse(eo)}strictImplement(eo){return this.parse(eo)}static create(eo,to,ro){return new t1({args:eo||W$1.create([]).rest(K$1.create()),returns:to||K$1.create(),typeName:g$1.ZodFunction,...b$1(ro)})}},Oe$1=class extends v{get schema(){return this._def.getter()}_parse(eo){const{ctx:to}=this._processInputParams(eo);return this._def.getter()._parse({data:to.data,path:to.path,parent:to})}};Oe$1.create=(Xr,eo)=>new Oe$1({getter:Xr,typeName:g$1.ZodLazy,...b$1(eo)});let Pe$1=class extends v{_parse(eo){if(eo.data!==this._def.value){const to=this._getOrReturnCtx(eo);return y$3(to,{received:to.data,code:d$2.invalid_literal,expected:this._def.value}),_$2}return{status:"valid",value:eo.data}}get value(){return this._def.value}};Pe$1.create=(Xr,eo)=>new Pe$1({value:Xr,typeName:g$1.ZodLiteral,...b$1(eo)});function zr(Xr,eo){return new Q$1({values:Xr,typeName:g$1.ZodEnum,...b$1(eo)})}let Q$1=class kv extends v{_parse(eo){if(typeof eo.data!="string"){const to=this._getOrReturnCtx(eo),ro=this._def.values;return y$3(to,{expected:T$1.joinValues(ro),received:to.parsedType,code:d$2.invalid_type}),_$2}if(this._def.values.indexOf(eo.data)===-1){const to=this._getOrReturnCtx(eo),ro=this._def.values;return y$3(to,{received:to.data,code:d$2.invalid_enum_value,options:ro}),_$2}return N$2(eo.data)}get options(){return this._def.values}get enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Values(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}extract(eo){return kv.create(eo)}exclude(eo){return kv.create(this.options.filter(to=>!eo.includes(to)))}};Q$1.create=zr;let Se$1=class extends v{_parse(eo){const to=T$1.getValidEnumValues(this._def.values),ro=this._getOrReturnCtx(eo);if(ro.parsedType!==p.string&&ro.parsedType!==p.number){const no=T$1.objectValues(to);return y$3(ro,{expected:T$1.joinValues(no),received:ro.parsedType,code:d$2.invalid_type}),_$2}if(to.indexOf(eo.data)===-1){const no=T$1.objectValues(to);return y$3(ro,{received:ro.data,code:d$2.invalid_enum_value,options:no}),_$2}return N$2(eo.data)}get enum(){return this._def.values}};Se$1.create=(Xr,eo)=>new Se$1({values:Xr,typeName:g$1.ZodNativeEnum,...b$1(eo)});let de$1=class extends v{unwrap(){return this._def.type}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.promise&&to.common.async===!1)return y$3(to,{code:d$2.invalid_type,expected:p.promise,received:to.parsedType}),_$2;const ro=to.parsedType===p.promise?to.data:Promise.resolve(to.data);return N$2(ro.then(no=>this._def.type.parseAsync(no,{path:to.path,errorMap:to.common.contextualErrorMap})))}};de$1.create=(Xr,eo)=>new de$1({type:Xr,typeName:g$1.ZodPromise,...b$1(eo)});class D extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g$1.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo),no=this._def.effect||null;if(no.type==="preprocess"){const oo=no.transform(ro.data);return ro.common.async?Promise.resolve(oo).then(ao=>this._def.schema._parseAsync({data:ao,path:ro.path,parent:ro})):this._def.schema._parseSync({data:oo,path:ro.path,parent:ro})}const io={addIssue:oo=>{y$3(ro,oo),oo.fatal?to.abort():to.dirty()},get path(){return ro.path}};if(io.addIssue=io.addIssue.bind(io),no.type==="refinement"){const oo=ao=>{const so=no.refinement(ao,io);if(ro.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(ro.common.async===!1){const ao=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});return ao.status==="aborted"?_$2:(ao.status==="dirty"&&to.dirty(),oo(ao.value),{status:to.value,value:ao.value})}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(ao=>ao.status==="aborted"?_$2:(ao.status==="dirty"&&to.dirty(),oo(ao.value).then(()=>({status:to.value,value:ao.value}))))}if(no.type==="transform")if(ro.common.async===!1){const oo=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});if(!qe$1(oo))return oo;const ao=no.transform(oo.value,io);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:to.value,value:ao}}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(oo=>qe$1(oo)?Promise.resolve(no.transform(oo.value,io)).then(ao=>({status:to.value,value:ao})):oo);T$1.assertNever(no)}}D.create=(Xr,eo,to)=>new D({schema:Xr,typeName:g$1.ZodEffects,effect:eo,...b$1(to)});D.createWithPreprocess=(Xr,eo,to)=>new D({schema:eo,effect:{type:"preprocess",transform:Xr},typeName:g$1.ZodEffects,...b$1(to)});let H$1=class extends v{_parse(eo){return this._getType(eo)===p.undefined?N$2(void 0):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}};H$1.create=(Xr,eo)=>new H$1({innerType:Xr,typeName:g$1.ZodOptional,...b$1(eo)});let re$1=class extends v{_parse(eo){return this._getType(eo)===p.null?N$2(null):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}};re$1.create=(Xr,eo)=>new re$1({innerType:Xr,typeName:g$1.ZodNullable,...b$1(eo)});let Ne$1=class extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo);let ro=to.data;return to.parsedType===p.undefined&&(ro=this._def.defaultValue()),this._def.innerType._parse({data:ro,path:to.path,parent:to})}removeDefault(){return this._def.innerType}};Ne$1.create=(Xr,eo)=>new Ne$1({innerType:Xr,typeName:g$1.ZodDefault,defaultValue:typeof eo.default=="function"?eo.default:()=>eo.default,...b$1(eo)});class Je extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.innerType._parse({data:to.data,path:to.path,parent:{...to,common:{...to.common,issues:[]}}});return ze$1(ro)?ro.then(no=>({status:"valid",value:no.status==="valid"?no.value:this._def.catchValue()})):{status:"valid",value:ro.status==="valid"?ro.value:this._def.catchValue()}}removeCatch(){return this._def.innerType}}Je.create=(Xr,eo)=>new Je({innerType:Xr,typeName:g$1.ZodCatch,catchValue:typeof eo.catch=="function"?eo.catch:()=>eo.catch,...b$1(eo)});let Ge$1=class extends v{_parse(eo){if(this._getType(eo)!==p.nan){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.nan,received:to.parsedType}),_$2}return{status:"valid",value:eo.data}}};Ge$1.create=Xr=>new Ge$1({typeName:g$1.ZodNaN,...b$1(Xr)});const yi=Symbol("zod_brand");class Vr extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=to.data;return this._def.type._parse({data:ro,path:to.path,parent:to})}unwrap(){return this._def.type}}let Le$1=class U_ extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.common.async)return(async()=>{const no=await this._def.in._parseAsync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?_$2:no.status==="dirty"?(to.dirty(),qr(no.value)):this._def.out._parseAsync({data:no.value,path:ro.path,parent:ro})})();{const no=this._def.in._parseSync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?_$2:no.status==="dirty"?(to.dirty(),{status:"dirty",value:no.value}):this._def.out._parseSync({data:no.value,path:ro.path,parent:ro})}}static create(eo,to){return new U_({in:eo,out:to,typeName:g$1.ZodPipeline})}};const Br=(Xr,eo={},to)=>Xr?le$1.create().superRefine((ro,no)=>{if(!Xr(ro)){const io=typeof eo=="function"?eo(ro):eo,oo=typeof io=="string"?{message:io}:io;no.addIssue({code:"custom",...oo,fatal:to})}}):le$1.create(),gi={object:C$1.lazycreate};var g$1;(function(Xr){Xr.ZodString="ZodString",Xr.ZodNumber="ZodNumber",Xr.ZodNaN="ZodNaN",Xr.ZodBigInt="ZodBigInt",Xr.ZodBoolean="ZodBoolean",Xr.ZodDate="ZodDate",Xr.ZodSymbol="ZodSymbol",Xr.ZodUndefined="ZodUndefined",Xr.ZodNull="ZodNull",Xr.ZodAny="ZodAny",Xr.ZodUnknown="ZodUnknown",Xr.ZodNever="ZodNever",Xr.ZodVoid="ZodVoid",Xr.ZodArray="ZodArray",Xr.ZodObject="ZodObject",Xr.ZodUnion="ZodUnion",Xr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Xr.ZodIntersection="ZodIntersection",Xr.ZodTuple="ZodTuple",Xr.ZodRecord="ZodRecord",Xr.ZodMap="ZodMap",Xr.ZodSet="ZodSet",Xr.ZodFunction="ZodFunction",Xr.ZodLazy="ZodLazy",Xr.ZodLiteral="ZodLiteral",Xr.ZodEnum="ZodEnum",Xr.ZodEffects="ZodEffects",Xr.ZodNativeEnum="ZodNativeEnum",Xr.ZodOptional="ZodOptional",Xr.ZodNullable="ZodNullable",Xr.ZodDefault="ZodDefault",Xr.ZodCatch="ZodCatch",Xr.ZodPromise="ZodPromise",Xr.ZodBranded="ZodBranded",Xr.ZodPipeline="ZodPipeline"})(g$1||(g$1={}));const _i=(Xr,eo={message:`Input not instance of ${Xr.name}`})=>Br(to=>to instanceof Xr,eo,!0),Hr=F$1.create,Fr=Y$1.create,bi=Ge$1.create,vi=we$1.create,Jr=xe$1.create,wi=ee$1.create,xi=Ve$1.create,Ti=Te$1.create,Ei=Ee$1.create,ki=le$1.create,Ci=K$1.create,Ri=J$1.create,Oi=Be$1.create,Pi=$$1.create,Si=C$1.create,Ni=C$1.strictCreate,Li=ke$1.create,Ii=at$1.create,ji=Ce$1.create,Ai=W$1.create,Mi=Re$1.create,$i=Fe$1.create,Di=te$1.create,Zi=ce$1.create,Ui=Oe$1.create,Wi=Pe$1.create,qi=Q$1.create,zi=Se$1.create,Vi=de$1.create,Kt$1=D.create,Bi=H$1.create,Hi=re$1.create,Fi=D.createWithPreprocess,Ji=Le$1.create,Gi=()=>Hr().optional(),Yi=()=>Fr().optional(),Qi=()=>Jr().optional(),Xi={string:Xr=>F$1.create({...Xr,coerce:!0}),number:Xr=>Y$1.create({...Xr,coerce:!0}),boolean:Xr=>xe$1.create({...Xr,coerce:!0}),bigint:Xr=>we$1.create({...Xr,coerce:!0}),date:Xr=>ee$1.create({...Xr,coerce:!0})},Ki=_$2;var f$1=Object.freeze({__proto__:null,defaultErrorMap:ve$1,setErrorMap:ci,getErrorMap:Ue$1,makeIssue:We$1,EMPTY_PATH:ui,addIssueToContext:y$3,ParseStatus:L$2,INVALID:_$2,DIRTY:qr,OK:N$2,isAborted:gt$1,isDirty:_t$1,isValid:qe$1,isAsync:ze$1,get util(){return T$1},ZodParsedType:p,getParsedType:G$1,ZodType:v,ZodString:F$1,ZodNumber:Y$1,ZodBigInt:we$1,ZodBoolean:xe$1,ZodDate:ee$1,ZodSymbol:Ve$1,ZodUndefined:Te$1,ZodNull:Ee$1,ZodAny:le$1,ZodUnknown:K$1,ZodNever:J$1,ZodVoid:Be$1,ZodArray:$$1,get objectUtil(){return He$1},ZodObject:C$1,ZodUnion:ke$1,ZodDiscriminatedUnion:at$1,ZodIntersection:Ce$1,ZodTuple:W$1,ZodRecord:Re$1,ZodMap:Fe$1,ZodSet:te$1,ZodFunction:ce$1,ZodLazy:Oe$1,ZodLiteral:Pe$1,ZodEnum:Q$1,ZodNativeEnum:Se$1,ZodPromise:de$1,ZodEffects:D,ZodTransformer:D,ZodOptional:H$1,ZodNullable:re$1,ZodDefault:Ne$1,ZodCatch:Je,ZodNaN:Ge$1,BRAND:yi,ZodBranded:Vr,ZodPipeline:Le$1,custom:Br,Schema:v,ZodSchema:v,late:gi,get ZodFirstPartyTypeKind(){return g$1},coerce:Xi,any:ki,array:Pi,bigint:vi,boolean:Jr,date:wi,discriminatedUnion:Ii,effect:Kt$1,enum:qi,function:Zi,instanceof:_i,intersection:ji,lazy:Ui,literal:Wi,map:$i,nan:bi,nativeEnum:zi,never:Ri,null:Ei,nullable:Hi,number:Fr,object:Si,oboolean:Qi,onumber:Yi,optional:Bi,ostring:Gi,pipeline:Ji,preprocess:Fi,promise:Vi,record:Mi,set:Di,strictObject:Ni,string:Hr,symbol:xi,transformer:Kt$1,tuple:Ai,undefined:Ti,union:Li,unknown:Ci,void:Oi,NEVER:Ki,ZodIssueCode:d$2,quotelessJson:oi,ZodError:B$1});const Gr=/^0x[0-9a-f]+$/i,Yr=/^\d+$/,ea=f$1.string().nonempty("The short string cannot be empty").max(31,"The short string cannot exceed 31 characters").refine(Xr=>!Gr.test(Xr),"The shortString should not be a hex string").refine(Xr=>!Yr.test(Xr),"The shortString should not be an integer string"),De$1=f$1.union([f$1.string().regex(Gr,"Only hex, integers and bigint are supported in calldata"),f$1.string().regex(Yr,"Only hex, integers and bigint are supported in calldata"),ea,f$1.number().int("Only hex, integers and bigint are supported in calldata"),f$1.bigint()]),er$1=f$1.object({contractAddress:f$1.string(),entrypoint:f$1.string(),calldata:f$1.array(De$1).optional()}),ta=f$1.object({types:f$1.record(f$1.array(f$1.union([f$1.object({name:f$1.string(),type:f$1.string()}),f$1.object({name:f$1.string(),type:f$1.literal("merkletree"),contains:f$1.string()})]))),primaryType:f$1.string(),domain:f$1.record(f$1.unknown()),message:f$1.record(f$1.unknown())}),tr$1={enable:f$1.tuple([f$1.object({starknetVersion:f$1.union([f$1.literal("v4"),f$1.literal("v5")]).optional()}).optional()]).or(f$1.tuple([])),addStarknetChain:f$1.tuple([f$1.object({id:f$1.string(),chainId:f$1.string(),chainName:f$1.string(),rpcUrls:f$1.array(f$1.string()).optional(),nativeCurrency:f$1.object({name:f$1.string(),symbol:f$1.string(),decimals:f$1.number()}).optional(),blockExplorerUrls:f$1.array(f$1.string()).optional()})]),switchStarknetChain:f$1.tuple([f$1.object({chainId:f$1.string()})]),watchAsset:f$1.tuple([f$1.object({type:f$1.literal("ERC20"),options:f$1.object({address:f$1.string(),symbol:f$1.string().optional(),decimals:f$1.number().optional(),image:f$1.string().optional(),name:f$1.string().optional()})})]),execute:f$1.tuple([f$1.array(er$1).nonempty().or(er$1),f$1.array(f$1.any()).optional(),f$1.object({nonce:De$1.optional(),maxFee:De$1.optional(),version:De$1.optional()}).optional()]),signMessage:f$1.tuple([ta])},M$1=Jn.create({isServer:!1,allowOutsideOfServer:!0});let vt$1=sr$1,wt$1="",Qr="";const be$1=({width:Xr=775,height:eo=385,origin:to,location:ro,atLeftBottom:no=!1})=>{const io=(window==null?void 0:window.outerWidth)??(window==null?void 0:window.innerWidth)??(window==null?void 0:window.screen.width)??0,oo=(window==null?void 0:window.outerHeight)??(window==null?void 0:window.innerHeight)??(window==null?void 0:window.screen.height)??0,ao=(window==null?void 0:window.screenLeft)??(window==null?void 0:window.screenX)??0,so=(window==null?void 0:window.screenTop)??(window==null?void 0:window.screenY)??0,co=no?0:ao+io/2-Xr/2,lo=no?window.screen.availHeight+10:so+oo/2-eo/2;vt$1=to??vt$1,wt$1=ro??wt$1,Qr=`width=${Xr},height=${eo},top=${lo},left=${co},toolbar=no,menubar=no,scrollbars=no,location=no,status=no,popup=1`};M$1.router({authorize:M$1.procedure.output(f$1.boolean()).mutation(async()=>!0),connect:M$1.procedure.mutation(async()=>""),enable:M$1.procedure.output(f$1.string()).mutation(async()=>""),execute:M$1.procedure.input(tr$1.execute).output(f$1.string()).mutation(async()=>""),signMessage:M$1.procedure.input(tr$1.signMessage).output(f$1.string().array()).mutation(async()=>[]),getLoginStatus:M$1.procedure.output(f$1.object({isLoggedIn:f$1.boolean(),hasSession:f$1.boolean().optional(),isPreauthorized:f$1.boolean().optional()})).mutation(async()=>({isLoggedIn:!0})),addStarknetChain:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),switchStarknetChain:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),watchAsset:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),updateModal:M$1.procedure.subscription(async()=>{})});const ra=({iframe:Xr})=>Sn({links:[kn({enabled:eo=>!1}),mn({condition(eo){if(!Xr&&eo.type==="subscription")throw new Error("subscription is not supported without an iframe window");return!!Xr},true:mt$1.windowLink({window,postWindow:Xr,postOrigin:"*"}),false:mt$1.popupLink({listenWindow:window,createPopup:()=>{let eo=null;const to=document.createElement("button");if(to.style.display="none",to.addEventListener("click",()=>{eo=window.open(`${vt$1}${wt$1}`,"popup",Qr)}),to.click(),(async()=>{for(;!eo;)await new Promise(ro=>setTimeout(ro,100))})(),!eo)throw new Error("Could not open popup");return eo},postOrigin:"*"})})]});function na(Xr){const eo=s();try{const{origin:to}=new URL(Xr);if(to.includes("localhost")||to.includes("127.0.0.1")||to.includes("hydrogen"))return eo.testnet;if(to.includes("staging")||to.includes("argent.xyz"))return eo.mainnet}catch{console.warn("Could not determine rpc nodeUrl from target URL, defaulting to mainnet")}return eo.mainnet}const sa=385,ia=775,aa=385,oa=440,ca=886,ua=562;let rr$1=class{async getPubKey(){throw new Error("Method not implemented")}async signMessage(){throw new Error("Method not implemented")}async signTransaction(){throw new Error("Method not implemented")}async signDeclareTransaction(){throw new Error("Method not implemented")}async signDeployAccountTransaction(){throw new Error("Method not implemented")}};class la extends Account{constructor(eo,to,ro){super(eo,to,new rr$1),ie$1(this,"signer",new rr$1),ie$1(this,"execute",async(no,io,oo)=>{try{return be$1({width:sa,height:ia,location:"/review"}),Array.isArray(no)&&no[0]&&no[0].entrypoint==="use_offchain_session"&&be$1({width:1,height:1,location:"/executeSessionTx",atLeftBottom:!0}),{transaction_hash:await this.proxyLink.execute.mutate([no,io,oo])}}catch(ao){throw ao instanceof Error?new Error(ao.message):new Error("Error while execute a transaction")}}),ie$1(this,"signMessage",async no=>{try{return be$1({width:aa,height:oa,location:"/signMessage"}),await this.proxyLink.signMessage.mutate([no])}catch(io){throw io instanceof Error?new Error(io.message):new Error("Error while sign a message")}}),this.address=to,this.proxyLink=ro}}const je$1=[],da=(Xr,eo,to)=>{const ro={...Xr,isConnected:!1,provider:eo,getLoginStatus:()=>to.getLoginStatus.mutate(),async request(no){switch(no.type){case"wallet_addStarknetChain":return await to.addStarknetChain.mutate();case"wallet_switchStarknetChain":return await to.switchStarknetChain.mutate();case"wallet_watchAsset":return await to.watchAsset.mutate();default:throw new Error("not implemented")}},async enable(no){if((no==null?void 0:no.starknetVersion)!=="v4")throw Error("not implemented");try{be$1({width:ca,height:ua,location:"/interstitialLogin"});const io=await to.enable.mutate();return await fa(ro,eo,to,io),[io]}catch(io){throw io instanceof Error?new Error(io.message):new Error("Unknow error on enable wallet")}},async isPreauthorized(){const{isLoggedIn:no,isPreauthorized:io}=await to.getLoginStatus.mutate();return!!(no&&io)},on:(no,io)=>{if(no==="accountsChanged")je$1.push({type:no,handler:io});else if(no==="networkChanged")je$1.push({type:no,handler:io});else throw new Error(`Unknwown event: ${no}`)},off:(no,io)=>{if(no!=="accountsChanged"&&no!=="networkChanged")throw new Error(`Unknwown event: ${no}`);const oo=je$1.findIndex(ao=>ao.type===no&&ao.handler===io);oo>=0&&je$1.splice(oo,1)}};return ro};async function fa(Xr,eo,to,ro){if(Xr.isConnected)return Xr;const no={isConnected:!0,chainId:await eo.getChainId(),selectedAddress:ro,account:new la(eo,ro,to),provider:eo};return Object.assign(Xr,no)}const pa=async(Xr,eo,to)=>{const ro=typeof window<"u"?window:void 0;if(!ro)throw new Error("window is not defined");const no=na(Xr),io=to??new RpcProvider({nodeUrl:no});return da({host:ro.location.origin,id:"argentWebWallet",icon:"https://www.argent.xyz/favicon.ico",name:"Argent Web Wallet",version:"1.0.0"},io,eo)};let A$1=null;class ba extends T$2{constructor(eo={}){super(),ie$1(this,"_wallet",null),ie$1(this,"_options"),this._options=eo}available(){return!0}async ready(){return A$1?(this._wallet=A$1,this._wallet.isPreauthorized()):(this._wallet=null,!1)}get id(){var eo;return this._wallet=A$1,((eo=this._wallet)==null?void 0:eo.id)||"argentWebWallet"}get name(){var eo;return this._wallet=A$1,((eo=this._wallet)==null?void 0:eo.name)||"Argent Web Wallet"}get icon(){return{light:$t$1,dark:$t$1}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}get title(){return"Email"}get subtitle(){return"Powered by Argent"}async connect(){if(await this.ensureWallet(),!this._wallet)throw new U$2;try{await this._wallet.enable({starknetVersion:"v4"})}catch{throw new A$2}if(!this._wallet.isConnected)throw new A$2;const eo=this._wallet.account,to=await this.chainId();return{account:eo.address,chainId:to}}async disconnect(){var eo;if(!this.available()&&!this._wallet)throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1;A$1=null,this._wallet=A$1,q$2()}async account(){if(this._wallet=A$1,!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}async chainId(){if(!this._wallet||!this.wallet.account||!this._wallet.provider)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async initEventListener(eo){if(this._wallet=A$1,!this._wallet)throw new P$1;this._wallet.on("accountsChanged",eo)}async removeEventListener(eo){if(this._wallet=A$1,!this._wallet)throw new P$1;this._wallet.off("accountsChanged",eo),A$1=null,this._wallet=null}async ensureWallet(){const eo=this._options.url||sr$1,to=this._options.provider;be$1({origin:eo,location:"/interstitialLogin"}),A$1=await pa(eo,ra({}),to)??null,this._wallet=A$1}}var b=Object.defineProperty,y$2=(Xr,eo,to)=>eo in Xr?b(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,l$1=(Xr,eo,to)=>(y$2(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const d$1="f2e613881f7a0e811295cdd57999e31b",u=`>":"<<",to,`#${no}`,`%c${ro}%c`,"%O"),ao.push(lo,`${lo}; font-weight: bold;`,`${lo}; font-weight: normal;`),eo==="up"?ao.push({input:io,context:Xr.context}):ao.push({input:io,result:Xr.result,elapsedMs:Xr.elapsedMs,context:Xr.context}),{parts:oo,args:ao}}const ys=({c:Xr=console,colorMode:eo="css"})=>to=>{const ro=to.input,no=hs(ro)?Object.fromEntries(ro):ro,{parts:io,args:oo}=ms({...to,colorMode:eo,input:no}),ao=to.direction==="down"&&to.result&&(to.result instanceof Error||"error"in to.result.result)?"error":"log";Xr[ao].apply(null,[io.join(" ")].concat(oo))};function gs(Xr={}){const{enabled:eo=()=>!0}=Xr,to=Xr.colorMode??(typeof window>"u"?"ansi":"css"),{logger:ro=ys({c:Xr.console,colorMode:to})}=Xr;return()=>({op:no,next:io})=>Jt$1.observable(oo=>{eo({...no,direction:"up"})&&ro({...no,direction:"up"});const ao=Date.now();function so(co){const lo=Date.now()-ao;eo({...no,direction:"down",result:co})&&ro({...no,direction:"down",elapsedMs:lo,result:co})}return io(no).pipe(Jt$1.tap({next(co){so(co)},error(co){so(co)}})).subscribe(oo)})}Ct$1.loggerLink=gs;var tt={};Object.defineProperty(tt,"__esModule",{value:!0});var _s=pe$1,bs=Ke,Nr=he$1;/* istanbul ignore next -- @preserve */const vs=Xr=>Xr===0?0:Math.min(1e3*2**Xr,3e4);function ws(Xr){const{url:eo,WebSocket:to=WebSocket,retryDelayMs:ro=vs,onOpen:no,onClose:io}=Xr;/* istanbul ignore next -- @preserve */if(!to)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");let oo=[];const ao=Object.create(null);let so=0,co=null,lo=null,uo=Oo(),ho="connecting";function go(){ho!=="open"||co||(co=setTimeout(()=>{co=null,oo.length===1?uo.send(JSON.stringify(oo.pop())):uo.send(JSON.stringify(oo)),oo=[]}))}function bo(){if(lo!==null||ho==="closed")return;const Bo=ro(so++);Eo(Bo)}function wo(){ho="connecting";const Bo=uo;uo=Oo(),$o(Bo)}function Eo(Bo){lo||(ho="connecting",lo=setTimeout(wo,Bo))}function $o(Bo){Object.values(ao).some(Mo=>Mo.ws===Bo)||Bo.close()}function Co(){Object.values(ao).forEach(Bo=>{Bo.type==="subscription"&&Bo.callbacks.complete()})}function Ro(Bo){oo.some(Mo=>Mo.id===Bo.op.id)||jo(Bo.op,Bo.callbacks)}function Oo(){const Bo=typeof eo=="function"?eo():eo,Mo=new to(Bo);clearTimeout(lo),lo=null,Mo.addEventListener("open",()=>{/* istanbul ignore next -- @preserve */Mo===uo&&(so=0,ho="open",no==null||no(),go())}),Mo.addEventListener("error",()=>{Mo===uo&&bo()});const Fo=Jo=>{if(Jo.method==="reconnect"&&Mo===uo){ho==="open"&&(io==null||io()),wo();for(const Po of Object.values(ao))Po.type==="subscription"&&Ro(Po)}},Wo=Jo=>{var fo,yo;const Po=Jo.id!==null&&ao[Jo.id];if(Po){if((yo=(fo=Po.callbacks).next)==null||yo.call(fo,Jo),Po.ws!==uo&&Mo===uo){const vo=Po.ws;Po.ws=uo,$o(vo)}"result"in Jo&&Jo.result.type==="stopped"&&Mo===uo&&Po.callbacks.complete()}};return Mo.addEventListener("message",({data:Jo})=>{const Po=JSON.parse(Jo);"method"in Po?Fo(Po):Wo(Po),(Mo!==uo||ho==="closed")&&$o(Mo)}),Mo.addEventListener("close",({code:Jo})=>{var Po,fo,yo,vo;ho==="open"&&(io==null||io({code:Jo})),uo===Mo&&bo();for(const[_o,So]of Object.entries(ao))if(So.ws===Mo){if(ho==="closed"){delete ao[_o],(fo=(Po=So.callbacks).complete)==null||fo.call(Po);continue}So.type==="subscription"?Ro(So):(delete ao[_o],(vo=(yo=So.callbacks).error)==null||vo.call(yo,Nr.TRPCClientError.from(new Rt$1("WebSocket closed prematurely"))))}}),Mo}function jo(Bo,Mo){const{type:Fo,input:Wo,path:Jo,id:Po}=Bo,fo={id:Po,method:Fo,params:{input:Wo,path:Jo}};return ao[Po]={ws:uo,type:Fo,callbacks:Mo,op:Bo},oo.push(fo),go(),()=>{var vo,_o;const yo=(vo=ao[Po])==null?void 0:vo.callbacks;delete ao[Po],oo=oo.filter(So=>So.id!==Po),(_o=yo==null?void 0:yo.complete)==null||_o.call(yo),uo.readyState===to.OPEN&&Bo.type==="subscription"&&(oo.push({id:Po,method:"subscription.stop"}),go())}}return{close:()=>{ho="closed",io==null||io(),Co(),$o(uo),clearTimeout(lo),lo=null},request:jo,getConnection(){return uo}}}let Rt$1=class mC extends Error{constructor(eo){super(eo),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,mC.prototype)}};function xs(Xr){return eo=>{const{client:to}=Xr;return({op:ro})=>_s.observable(no=>{const{type:io,path:oo,id:ao,context:so}=ro,co=eo.transformer.serialize(ro.input),lo=to.request({type:io,path:oo,input:co,id:ao,context:so},{error(uo){no.error(uo),lo()},complete(){no.complete()},next(uo){const ho=bs.transformResult(uo,eo);if(!ho.ok){no.error(Nr.TRPCClientError.from(ho.error));return}no.next({result:ho.result}),ro.type!=="subscription"&&(lo(),no.complete())}});return()=>{lo()}})}}tt.createWSClient=ws;tt.wsLink=xs;Object.defineProperty(O$2,"__esModule",{value:!0});var Gt$1=pe$1,Lr=Et$1,Ir=he$1,Yt$1=Xn,_e$1=q$1,jr=kt$1,Ot$1=et,Ts=Ct$1,Ar=tt;let rt$1=class{$request({type:eo,input:to,path:ro,context:no={}}){return Lr.createChain({links:this.links,op:{id:++this.requestId,type:eo,path:ro,input:to,context:no}}).pipe(Gt$1.share())}requestAsPromise(eo){const to=this.$request(eo),{promise:ro,abort:no}=Gt$1.observableToPromise(to);return new Promise((io,oo)=>{var ao;(ao=eo.signal)==null||ao.addEventListener("abort",no),ro.then(so=>{io(so.result.data)}).catch(so=>{oo(Ir.TRPCClientError.from(so))})})}query(eo,to,ro){return this.requestAsPromise({type:"query",path:eo,input:to,context:ro==null?void 0:ro.context,signal:ro==null?void 0:ro.signal})}mutation(eo,to,ro){return this.requestAsPromise({type:"mutation",path:eo,input:to,context:ro==null?void 0:ro.context,signal:ro==null?void 0:ro.signal})}subscription(eo,to,ro){return this.$request({type:"subscription",path:eo,input:to,context:ro==null?void 0:ro.context}).subscribe({next(no){var io,oo,ao;no.result.type==="started"?(io=ro.onStarted)==null||io.call(ro):no.result.type==="stopped"?(oo=ro.onStopped)==null||oo.call(ro):(ao=ro.onData)==null||ao.call(ro,no.result.data)},error(no){var io;(io=ro.onError)==null||io.call(ro,no)},complete(){var no;(no=ro.onComplete)==null||no.call(ro)}})}constructor(eo){this.requestId=0;const to=(()=>{const ro=eo.transformer;return ro?"input"in ro?eo.transformer:{input:ro,output:ro}:{input:{serialize:no=>no,deserialize:no=>no},output:{serialize:no=>no,deserialize:no=>no}}})();this.runtime={transformer:{serialize:ro=>to.input.serialize(ro),deserialize:ro=>to.output.deserialize(ro)},combinedTransformer:to},this.links=eo.links.map(ro=>ro(this.runtime))}};function Es(Xr){return new rt$1(Xr)}function ks(Xr){return new rt$1(Xr)}const Cs={query:"query",mutate:"mutation",subscribe:"subscription"},Mr=Xr=>Cs[Xr];function $r(Xr){return Yt$1.createFlatProxy(eo=>Xr.hasOwnProperty(eo)?Xr[eo]:eo==="__untypedClient"?Xr:Yt$1.createRecursiveProxy(({path:to,args:ro})=>{const no=[eo,...to],io=Mr(no.pop()),oo=no.join(".");return Xr[io](oo,...ro)}))}function Rs(Xr){const eo=new rt$1(Xr);return $r(eo)}function Os(Xr){return Xr.__untypedClient}function Ps(Xr){if(Xr)return Xr;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}async function Ss(Xr){const eo=Xr.parse??JSON.parse,to=ro=>{var ao;if((ao=Xr.signal)!=null&&ao.aborted||!ro||ro==="}")return;const no=ro.indexOf(":"),io=ro.substring(2,no-1),oo=ro.substring(no+1);Xr.onSingle(Number(io),eo(oo))};await Ns(Xr.readableStream,to,Xr.textDecoder)}async function Ns(Xr,eo,to){let ro="";const no=io=>{const oo=to.decode(io).split(` +`);if(oo.length===1)ro+=oo[0];else if(oo.length>1){eo(ro+oo[0]);for(let ao=1;ao{Xr.on("data",eo),Xr.on("end",to)})}async function Is(Xr,eo){const to=Xr.getReader();let ro=await to.read();for(;!ro.done;)eo(ro.value),ro=await to.read()}const js=(Xr,eo)=>{const to=Xr.AbortController?new Xr.AbortController:null,ro=_e$1.fetchHTTPResponse({...Xr,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:_e$1.getUrl,getBody:_e$1.getBody},to),no=()=>to==null?void 0:to.abort(),io=ro.then(async oo=>{if(!oo.body)throw new Error("Received response without body");const ao={response:oo};return Ss({readableStream:oo.body,onSingle:eo,parse:so=>({json:JSON.parse(so),meta:ao}),signal:to==null?void 0:to.signal,textDecoder:Xr.textDecoder})});return{cancel:no,promise:io}},As=Xr=>{const eo=Ps(Xr.opts.textDecoder);return(to,ro)=>{const no=to.map(so=>so.path).join(","),io=to.map(so=>so.input),{cancel:oo,promise:ao}=js({...Xr,textDecoder:eo,path:no,inputs:io,headers(){return Xr.opts.headers?typeof Xr.opts.headers=="function"?Xr.opts.headers({opList:to}):Xr.opts.headers:{}}},(so,co)=>{ro(so,co)});return{promise:ao.then(()=>[]),cancel:oo}}},Ms=jr.createHTTPBatchLink(As),$s=Xr=>{if("input"in Xr){if(!(Xr.input instanceof FormData))throw new Error("Input is not FormData");return Xr.input}},Ds=Xr=>{if(Xr.type!=="mutation")throw new Error("We only handle mutations with formdata");return _e$1.httpRequest({...Xr,getUrl(){return`${Xr.url}/${Xr.path}`},getBody:$s})},Zs=Ot$1.httpLinkFactory({requester:Ds});O$2.splitLink=Lr.splitLink;O$2.TRPCClientError=Ir.TRPCClientError;O$2.getFetch=_e$1.getFetch;O$2.httpBatchLink=jr.httpBatchLink;O$2.httpLink=Ot$1.httpLink;O$2.httpLinkFactory=Ot$1.httpLinkFactory;O$2.loggerLink=Ts.loggerLink;O$2.createWSClient=Ar.createWSClient;O$2.wsLink=Ar.wsLink;O$2.TRPCUntypedClient=rt$1;O$2.clientCallTypeToProcedureType=Mr;O$2.createTRPCClient=ks;O$2.createTRPCClientProxy=$r;O$2.createTRPCProxyClient=Rs;O$2.createTRPCUntypedClient=Es;O$2.experimental_formDataLink=Zs;O$2.getUntypedClient=Os;O$2.unstable_httpBatchStreamLink=Ms;var X$1={},Pt$1={};function Us(Xr){return Xr}function Ws(Xr){return Xr.length===0?Us:Xr.length===1?Xr[0]:function(eo){return Xr.reduce((to,ro)=>ro(to),eo)}}function qs(Xr){return typeof Xr=="object"&&Xr!==null&&"subscribe"in Xr}function zs(Xr){const eo={subscribe(to){let ro=null,no=!1,io=!1,oo=!1;function ao(){if(ro===null){oo=!0;return}io||(io=!0,typeof ro=="function"?ro():ro&&ro.unsubscribe())}return ro=Xr({next(so){var co;no||((co=to.next)==null||co.call(to,so))},error(so){var co;no||(no=!0,(co=to.error)==null||co.call(to,so),ao())},complete(){var so;no||(no=!0,(so=to.complete)==null||so.call(to),ao())}}),oo&&ao(),{unsubscribe:ao}},pipe(...to){return Ws(to)(eo)}};return eo}Pt$1.isObservable=qs;Pt$1.observable=zs;Object.defineProperty(X$1,"__esModule",{value:!0});var Dr=Pt$1;function Vs(Xr){return eo=>{let to=0,ro=null;const no=[];function io(){ro||(ro=eo.subscribe({next(ao){var so;for(const co of no)(so=co.next)==null||so.call(co,ao)},error(ao){var so;for(const co of no)(so=co.error)==null||so.call(co,ao)},complete(){var ao;for(const so of no)(ao=so.complete)==null||ao.call(so)}}))}function oo(){if(to===0&&ro){const ao=ro;ro=null,ao.unsubscribe()}}return{subscribe(ao){return to++,no.push(ao),io(),{unsubscribe(){to--,oo();const so=no.findIndex(co=>co===ao);so>-1&&no.splice(so,1)}}}}}}function Bs(Xr){return eo=>({subscribe(to){let ro=0;return eo.subscribe({next(no){var io;(io=to.next)==null||io.call(to,Xr(no,ro++))},error(no){var io;(io=to.error)==null||io.call(to,no)},complete(){var no;(no=to.complete)==null||no.call(to)}})}})}function Hs(Xr){return eo=>({subscribe(to){return eo.subscribe({next(ro){var no,io;(no=Xr.next)==null||no.call(Xr,ro),(io=to.next)==null||io.call(to,ro)},error(ro){var no,io;(no=Xr.error)==null||no.call(Xr,ro),(io=to.error)==null||io.call(to,ro)},complete(){var ro,no;(ro=Xr.complete)==null||ro.call(Xr),(no=to.complete)==null||no.call(to)}})}})}let St$1=class gC extends Error{constructor(eo){super(eo),this.name="ObservableAbortError",Object.setPrototypeOf(this,gC.prototype)}};function Fs(Xr){let eo;return{promise:new Promise((to,ro)=>{let no=!1;function io(){no||(no=!0,ro(new St$1("This operation was aborted.")),oo.unsubscribe())}const oo=Xr.subscribe({next(ao){no=!0,to(ao),io()},error(ao){no=!0,ro(ao),io()},complete(){no=!0,io()}});eo=io}),abort:eo}}X$1.isObservable=Dr.isObservable;X$1.observable=Dr.observable;X$1.map=Bs;X$1.observableToPromise=Fs;X$1.share=Vs;X$1.tap=Hs;var Z$1={};Object.defineProperty(Z$1,"__esModule",{value:!0});Z$1.isTRPCRequestWithId=Z$1.isTRPCRequest=Z$1.isTRPCResponse=Z$1.isTRPCMessage=void 0;function Qt$1(Xr){return typeof Xr=="object"&&Xr!==null&&!Array.isArray(Xr)}function Js(Xr){return Xr==null}function Zr(Xr){return!!(Qt$1(Xr)&&"trpc"in Xr&&Qt$1(Xr.trpc))}Z$1.isTRPCMessage=Zr;function Nt$1(Xr){return Zr(Xr)&&"id"in Xr.trpc&&!Js(Xr.trpc.id)}function Gs(Xr){return Nt$1(Xr)&&("error"in Xr.trpc||"result"in Xr.trpc)}Z$1.isTRPCResponse=Gs;function Ur(Xr){return Nt$1(Xr)&&"method"in Xr.trpc}Z$1.isTRPCRequest=Ur;function Ys(Xr){return Ur(Xr)&&Nt$1(Xr)}Z$1.isTRPCRequestWithId=Ys;Object.defineProperty(fe,"__esModule",{value:!0});fe.createBaseLink=void 0;const ht$1=O$2,Qs=X$1,Xs=Z$1,Ks=Xr=>eo=>({op:to})=>(0,Qs.observable)(ro=>{const no=[],{id:io,type:oo,path:ao}=to;try{const so=eo.transformer.serialize(to.input),co=()=>{ro.error(new ht$1.TRPCClientError("Port disconnected prematurely"))};Xr.addCloseListener(co),no.push(()=>Xr.removeCloseListener(co));const lo=uo=>{if(!(0,Xs.isTRPCResponse)(uo))return;const{trpc:ho}=uo;if(io===ho.id){if("error"in ho){const go=eo.transformer.deserialize(ho.error);ro.error(ht$1.TRPCClientError.from(Object.assign(Object.assign({},ho),{error:go})));return}ro.next({result:Object.assign(Object.assign({},ho.result),(!ho.result.type||ho.result.type==="data")&&{type:"data",data:eo.transformer.deserialize(ho.result.data)})}),(oo!=="subscription"||ho.result.type==="stopped")&&ro.complete()}};Xr.addMessageListener(lo),no.push(()=>Xr.removeMessageListener(lo)),Xr.postMessage({trpc:{id:io,jsonrpc:void 0,method:oo,params:{path:ao,input:so}}})}catch(so){ro.error(new ht$1.TRPCClientError(so instanceof Error?so.message:"Unknown error"))}return()=>{oo==="subscription"&&Xr.postMessage({trpc:{id:io,jsonrpc:void 0,method:"subscription.stop"}}),no.forEach(so=>so())}});fe.createBaseLink=Ks;Object.defineProperty(Xe$1,"__esModule",{value:!0});Xe$1.chromeLink=void 0;const ei=fe,ti=Xr=>(0,ei.createBaseLink)({postMessage(eo){Xr.port.postMessage(eo)},addMessageListener(eo){Xr.port.onMessage.addListener(eo)},removeMessageListener(eo){Xr.port.onMessage.removeListener(eo)},addCloseListener(eo){Xr.port.onDisconnect.addListener(eo)},removeCloseListener(eo){Xr.port.onDisconnect.removeListener(eo)}});Xe$1.chromeLink=ti;var nt$1={};Object.defineProperty(nt$1,"__esModule",{value:!0});nt$1.windowLink=void 0;const ri=fe,ni=Xr=>{var eo;const to=new Map,ro=Xr.window,no=(eo=Xr.postWindow)!==null&&eo!==void 0?eo:ro;return(0,ri.createBaseLink)({postMessage(io){no.postMessage(io,{targetOrigin:Xr.postOrigin})},addMessageListener(io){const oo=ao=>{io(ao.data)};to.set(io,oo),ro.addEventListener("message",oo)},removeMessageListener(io){const oo=to.get(io);oo&&ro.removeEventListener("message",oo)},addCloseListener(io){ro.addEventListener("beforeunload",io)},removeCloseListener(io){ro.removeEventListener("beforeunload",io)}})};nt$1.windowLink=ni;var st$1={},it$1={};Object.defineProperty(it$1,"__esModule",{value:!0});it$1.TRPC_BROWSER_LOADED_EVENT=void 0;it$1.TRPC_BROWSER_LOADED_EVENT="TRPC_BROWSER::POPUP_LOADED";Object.defineProperty(st$1,"__esModule",{value:!0});st$1.popupLink=void 0;const si=it$1,ii=fe,ai=Xr=>{const eo=new Map,to=new Set;let ro=null;async function no(io){if(!ro||ro.closed){ro=Xr.createPopup(),await Promise.race([new Promise(oo=>{var ao;try{(ao=ro==null?void 0:ro.addEventListener)===null||ao===void 0||ao.call(ro,"load",oo)}catch{}}),new Promise(oo=>{io.addEventListener("message",ao=>{ao.data===si.TRPC_BROWSER_LOADED_EVENT&&oo()})}),new Promise(oo=>{console.warn("Could not detect if popup loading succeeded after 15s timeout, continuing anyway"),setTimeout(oo,15e3)})]);try{if(!ro.addEventListener)throw new Error("popupWindow.addEventListener is not a function");ro.addEventListener("beforeunload",()=>{ro=null})}catch{const oo=setInterval(()=>{ro&&ro.closed&&(ro=null,to.forEach(ao=>{ao()}),clearInterval(oo))},1e3)}}return ro}return(0,ii.createBaseLink)({async postMessage(io){return(await no(Xr.listenWindow)).postMessage(io,{targetOrigin:Xr.postOrigin})},addMessageListener(io){const oo=ao=>{io(ao.data)};eo.set(io,oo),Xr.listenWindow.addEventListener("message",oo)},removeMessageListener(io){const oo=eo.get(io);oo&&Xr.listenWindow.removeEventListener("message",oo)},addCloseListener(io){Xr.listenWindow.addEventListener("beforeunload",io),to.add(io)},removeCloseListener(io){Xr.listenWindow.removeEventListener("beforeunload",io),to.delete(io)}})};st$1.popupLink=ai;(function(Xr){var eo=F$2&&F$2.__createBinding||(Object.create?function(ro,no,io,oo){oo===void 0&&(oo=io);var ao=Object.getOwnPropertyDescriptor(no,io);(!ao||("get"in ao?!no.__esModule:ao.writable||ao.configurable))&&(ao={enumerable:!0,get:function(){return no[io]}}),Object.defineProperty(ro,oo,ao)}:function(ro,no,io,oo){oo===void 0&&(oo=io),ro[oo]=no[io]}),to=F$2&&F$2.__exportStar||function(ro,no){for(var io in ro)io!=="default"&&!Object.prototype.hasOwnProperty.call(no,io)&&eo(no,ro,io)};Object.defineProperty(Xr,"__esModule",{value:!0}),to(Xe$1,Xr),to(nt$1,Xr),to(st$1,Xr)})(mt$1);var T$1;(function(Xr){Xr.assertEqual=no=>no;function eo(no){}Xr.assertIs=eo;function to(no){throw new Error}Xr.assertNever=to,Xr.arrayToEnum=no=>{const io={};for(const oo of no)io[oo]=oo;return io},Xr.getValidEnumValues=no=>{const io=Xr.objectKeys(no).filter(ao=>typeof no[no[ao]]!="number"),oo={};for(const ao of io)oo[ao]=no[ao];return Xr.objectValues(oo)},Xr.objectValues=no=>Xr.objectKeys(no).map(function(io){return no[io]}),Xr.objectKeys=typeof Object.keys=="function"?no=>Object.keys(no):no=>{const io=[];for(const oo in no)Object.prototype.hasOwnProperty.call(no,oo)&&io.push(oo);return io},Xr.find=(no,io)=>{for(const oo of no)if(io(oo))return oo},Xr.isInteger=typeof Number.isInteger=="function"?no=>Number.isInteger(no):no=>typeof no=="number"&&isFinite(no)&&Math.floor(no)===no;function ro(no,io=" | "){return no.map(oo=>typeof oo=="string"?`'${oo}'`:oo).join(io)}Xr.joinValues=ro,Xr.jsonStringifyReplacer=(no,io)=>typeof io=="bigint"?io.toString():io})(T$1||(T$1={}));const p=T$1.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G$1=Xr=>{switch(typeof Xr){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(Xr)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(Xr)?p.array:Xr===null?p.null:Xr.then&&typeof Xr.then=="function"&&Xr.catch&&typeof Xr.catch=="function"?p.promise:typeof Map<"u"&&Xr instanceof Map?p.map:typeof Set<"u"&&Xr instanceof Set?p.set:typeof Date<"u"&&Xr instanceof Date?p.date:p.object;default:return p.unknown}},d$2=T$1.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),oi=Xr=>JSON.stringify(Xr,null,2).replace(/"([^"]+)":/g,"$1:");let B$1=class extends Error{constructor(eo){super(),this.issues=[],this.addIssue=ro=>{this.issues=[...this.issues,ro]},this.addIssues=(ro=[])=>{this.issues=[...this.issues,...ro]};const to=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,to):this.__proto__=to,this.name="ZodError",this.issues=eo}get errors(){return this.issues}format(eo){const to=eo||function(io){return io.message},ro={_errors:[]},no=io=>{for(const oo of io.issues)if(oo.code==="invalid_union")oo.unionErrors.map(no);else if(oo.code==="invalid_return_type")no(oo.returnTypeError);else if(oo.code==="invalid_arguments")no(oo.argumentsError);else if(oo.path.length===0)ro._errors.push(to(oo));else{let ao=ro,so=0;for(;soto.message){const to={},ro=[];for(const no of this.issues)no.path.length>0?(to[no.path[0]]=to[no.path[0]]||[],to[no.path[0]].push(eo(no))):ro.push(eo(no));return{formErrors:ro,fieldErrors:to}}get formErrors(){return this.flatten()}};B$1.create=Xr=>new B$1(Xr);const ve$1=(Xr,eo)=>{let to;switch(Xr.code){case d$2.invalid_type:Xr.received===p.undefined?to="Required":to=`Expected ${Xr.expected}, received ${Xr.received}`;break;case d$2.invalid_literal:to=`Invalid literal value, expected ${JSON.stringify(Xr.expected,T$1.jsonStringifyReplacer)}`;break;case d$2.unrecognized_keys:to=`Unrecognized key(s) in object: ${T$1.joinValues(Xr.keys,", ")}`;break;case d$2.invalid_union:to="Invalid input";break;case d$2.invalid_union_discriminator:to=`Invalid discriminator value. Expected ${T$1.joinValues(Xr.options)}`;break;case d$2.invalid_enum_value:to=`Invalid enum value. Expected ${T$1.joinValues(Xr.options)}, received '${Xr.received}'`;break;case d$2.invalid_arguments:to="Invalid function arguments";break;case d$2.invalid_return_type:to="Invalid function return type";break;case d$2.invalid_date:to="Invalid date";break;case d$2.invalid_string:typeof Xr.validation=="object"?"startsWith"in Xr.validation?to=`Invalid input: must start with "${Xr.validation.startsWith}"`:"endsWith"in Xr.validation?to=`Invalid input: must end with "${Xr.validation.endsWith}"`:T$1.assertNever(Xr.validation):Xr.validation!=="regex"?to=`Invalid ${Xr.validation}`:to="Invalid";break;case d$2.too_small:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"more than"} ${Xr.minimum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at least":"over"} ${Xr.minimum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${Xr.minimum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly equal to ":Xr.inclusive?"greater than or equal to ":"greater than "}${new Date(Xr.minimum)}`:to="Invalid input";break;case d$2.too_big:Xr.type==="array"?to=`Array must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"less than"} ${Xr.maximum} element(s)`:Xr.type==="string"?to=`String must contain ${Xr.exact?"exactly":Xr.inclusive?"at most":"under"} ${Xr.maximum} character(s)`:Xr.type==="number"?to=`Number must be ${Xr.exact?"exactly":Xr.inclusive?"less than or equal to":"less than"} ${Xr.maximum}`:Xr.type==="date"?to=`Date must be ${Xr.exact?"exactly":Xr.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Xr.maximum)}`:to="Invalid input";break;case d$2.custom:to="Invalid input";break;case d$2.invalid_intersection_types:to="Intersection results could not be merged";break;case d$2.not_multiple_of:to=`Number must be a multiple of ${Xr.multipleOf}`;break;case d$2.not_finite:to="Number must be finite";break;default:to=eo.defaultError,T$1.assertNever(Xr)}return{message:to}};let Wr=ve$1;function ci(Xr){Wr=Xr}function Ue$1(){return Wr}const We$1=Xr=>{const{data:eo,path:to,errorMaps:ro,issueData:no}=Xr,io=[...to,...no.path||[]],oo={...no,path:io};let ao="";const so=ro.filter(co=>!!co).slice().reverse();for(const co of so)ao=co(oo,{data:eo,defaultError:ao}).message;return{...no,path:io,message:no.message||ao}},ui=[];function y$3(Xr,eo){const to=We$1({issueData:eo,data:Xr.data,path:Xr.path,errorMaps:[Xr.common.contextualErrorMap,Xr.schemaErrorMap,Ue$1(),ve$1].filter(ro=>!!ro)});Xr.common.issues.push(to)}let L$2=class yC{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(eo,to){const ro=[];for(const no of to){if(no.status==="aborted")return _$2;no.status==="dirty"&&eo.dirty(),ro.push(no.value)}return{status:eo.value,value:ro}}static async mergeObjectAsync(eo,to){const ro=[];for(const no of to)ro.push({key:await no.key,value:await no.value});return yC.mergeObjectSync(eo,ro)}static mergeObjectSync(eo,to){const ro={};for(const no of to){const{key:io,value:oo}=no;if(io.status==="aborted"||oo.status==="aborted")return _$2;io.status==="dirty"&&eo.dirty(),oo.status==="dirty"&&eo.dirty(),(typeof oo.value<"u"||no.alwaysSet)&&(ro[io.value]=oo.value)}return{status:eo.value,value:ro}}};const _$2=Object.freeze({status:"aborted"}),qr=Xr=>({status:"dirty",value:Xr}),N$2=Xr=>({status:"valid",value:Xr}),gt$1=Xr=>Xr.status==="aborted",_t$1=Xr=>Xr.status==="dirty",qe$1=Xr=>Xr.status==="valid",ze$1=Xr=>typeof Promise<"u"&&Xr instanceof Promise;var w;(function(Xr){Xr.errToObj=eo=>typeof eo=="string"?{message:eo}:eo||{},Xr.toString=eo=>typeof eo=="string"?eo:eo==null?void 0:eo.message})(w||(w={}));let U$1=class{constructor(eo,to,ro,no){this.parent=eo,this.data=to,this._path=ro,this._key=no}get path(){return this._path.concat(this._key)}};const Xt$1=(Xr,eo)=>{if(qe$1(eo))return{success:!0,data:eo.value};if(!Xr.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,error:new B$1(Xr.common.issues)}};function b$1(Xr){if(!Xr)return{};const{errorMap:eo,invalid_type_error:to,required_error:ro,description:no}=Xr;if(eo&&(to||ro))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return eo?{errorMap:eo,description:no}:{errorMap:(io,oo)=>io.code!=="invalid_type"?{message:oo.defaultError}:typeof oo.data>"u"?{message:ro??oo.defaultError}:{message:to??oo.defaultError},description:no}}class v{constructor(eo){this.spa=this.safeParseAsync,this._def=eo,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(eo){return G$1(eo.data)}_getOrReturnCtx(eo,to){return to||{common:eo.parent.common,data:eo.data,parsedType:G$1(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}_processInputParams(eo){return{status:new L$2,ctx:{common:eo.parent.common,data:eo.data,parsedType:G$1(eo.data),schemaErrorMap:this._def.errorMap,path:eo.path,parent:eo.parent}}}_parseSync(eo){const to=this._parse(eo);if(ze$1(to))throw new Error("Synchronous parse encountered promise.");return to}_parseAsync(eo){const to=this._parse(eo);return Promise.resolve(to)}parse(eo,to){const ro=this.safeParse(eo,to);if(ro.success)return ro.data;throw ro.error}safeParse(eo,to){var ro;const no={common:{issues:[],async:(ro=to==null?void 0:to.async)!==null&&ro!==void 0?ro:!1,contextualErrorMap:to==null?void 0:to.errorMap},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:G$1(eo)},io=this._parseSync({data:eo,path:no.path,parent:no});return Xt$1(no,io)}async parseAsync(eo,to){const ro=await this.safeParseAsync(eo,to);if(ro.success)return ro.data;throw ro.error}async safeParseAsync(eo,to){const ro={common:{issues:[],contextualErrorMap:to==null?void 0:to.errorMap,async:!0},path:(to==null?void 0:to.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:eo,parsedType:G$1(eo)},no=this._parse({data:eo,path:ro.path,parent:ro}),io=await(ze$1(no)?no:Promise.resolve(no));return Xt$1(ro,io)}refine(eo,to){const ro=no=>typeof to=="string"||typeof to>"u"?{message:to}:typeof to=="function"?to(no):to;return this._refinement((no,io)=>{const oo=eo(no),ao=()=>io.addIssue({code:d$2.custom,...ro(no)});return typeof Promise<"u"&&oo instanceof Promise?oo.then(so=>so?!0:(ao(),!1)):oo?!0:(ao(),!1)})}refinement(eo,to){return this._refinement((ro,no)=>eo(ro)?!0:(no.addIssue(typeof to=="function"?to(ro,no):to),!1))}_refinement(eo){return new D({schema:this,typeName:g$1.ZodEffects,effect:{type:"refinement",refinement:eo}})}superRefine(eo){return this._refinement(eo)}optional(){return H$1.create(this,this._def)}nullable(){return re$1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $$1.create(this,this._def)}promise(){return de$1.create(this,this._def)}or(eo){return ke$1.create([this,eo],this._def)}and(eo){return Ce$1.create(this,eo,this._def)}transform(eo){return new D({...b$1(this._def),schema:this,typeName:g$1.ZodEffects,effect:{type:"transform",transform:eo}})}default(eo){const to=typeof eo=="function"?eo:()=>eo;return new Ne$1({...b$1(this._def),innerType:this,defaultValue:to,typeName:g$1.ZodDefault})}brand(){return new Vr({typeName:g$1.ZodBranded,type:this,...b$1(this._def)})}catch(eo){const to=typeof eo=="function"?eo:()=>eo;return new Je({...b$1(this._def),innerType:this,catchValue:to,typeName:g$1.ZodCatch})}describe(eo){const to=this.constructor;return new to({...this._def,description:eo})}pipe(eo){return Le$1.create(this,eo)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const li=/^c[^\s-]{8,}$/i,di=/^[a-z][a-z0-9]*$/,fi=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,pi=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/,hi=Xr=>Xr.precision?Xr.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${Xr.precision}}Z$`):Xr.precision===0?Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):Xr.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");let F$1=class tC extends v{constructor(){super(...arguments),this._regex=(eo,to,ro)=>this.refinement(no=>eo.test(no),{validation:to,code:d$2.invalid_string,...w.errToObj(ro)}),this.nonempty=eo=>this.min(1,w.errToObj(eo)),this.trim=()=>new tC({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(eo){if(this._def.coerce&&(eo.data=String(eo.data)),this._getType(eo)!==p.string){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.string,received:no.parsedType}),_$2}const to=new L$2;let ro;for(const no of this._def.checks)if(no.kind==="min")eo.data.lengthno.value&&(ro=this._getOrReturnCtx(eo,ro),y$3(ro,{code:d$2.too_big,maximum:no.value,type:"string",inclusive:!0,exact:!1,message:no.message}),to.dirty());else if(no.kind==="length"){const io=eo.data.length>no.value,oo=eo.data.length"u"?null:eo==null?void 0:eo.precision,offset:(to=eo==null?void 0:eo.offset)!==null&&to!==void 0?to:!1,...w.errToObj(eo==null?void 0:eo.message)})}regex(eo,to){return this._addCheck({kind:"regex",regex:eo,...w.errToObj(to)})}startsWith(eo,to){return this._addCheck({kind:"startsWith",value:eo,...w.errToObj(to)})}endsWith(eo,to){return this._addCheck({kind:"endsWith",value:eo,...w.errToObj(to)})}min(eo,to){return this._addCheck({kind:"min",value:eo,...w.errToObj(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo,...w.errToObj(to)})}length(eo,to){return this._addCheck({kind:"length",value:eo,...w.errToObj(to)})}get isDatetime(){return!!this._def.checks.find(eo=>eo.kind==="datetime")}get isEmail(){return!!this._def.checks.find(eo=>eo.kind==="email")}get isURL(){return!!this._def.checks.find(eo=>eo.kind==="url")}get isUUID(){return!!this._def.checks.find(eo=>eo.kind==="uuid")}get isCUID(){return!!this._def.checks.find(eo=>eo.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(eo=>eo.kind==="cuid2")}get minLength(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxLength(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.value{var eo;return new F$1({checks:[],typeName:g$1.ZodString,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...b$1(Xr)})};function mi(Xr,eo){const to=(Xr.toString().split(".")[1]||"").length,ro=(eo.toString().split(".")[1]||"").length,no=to>ro?to:ro,io=parseInt(Xr.toFixed(no).replace(".","")),oo=parseInt(eo.toFixed(no).replace(".",""));return io%oo/Math.pow(10,no)}let Y$1=class rC extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(eo){if(this._def.coerce&&(eo.data=Number(eo.data)),this._getType(eo)!==p.number){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.number,received:no.parsedType}),_$2}let to;const ro=new L$2;for(const no of this._def.checks)no.kind==="int"?T$1.isInteger(eo.data)||(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.invalid_type,expected:"integer",received:"float",message:no.message}),ro.dirty()):no.kind==="min"?(no.inclusive?eo.datano.value:eo.data>=no.value)&&(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.too_big,maximum:no.value,type:"number",inclusive:no.inclusive,exact:!1,message:no.message}),ro.dirty()):no.kind==="multipleOf"?mi(eo.data,no.value)!==0&&(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.not_multiple_of,multipleOf:no.value,message:no.message}),ro.dirty()):no.kind==="finite"?Number.isFinite(eo.data)||(to=this._getOrReturnCtx(eo,to),y$3(to,{code:d$2.not_finite,message:no.message}),ro.dirty()):T$1.assertNever(no);return{status:ro.value,value:eo.data}}gte(eo,to){return this.setLimit("min",eo,!0,w.toString(to))}gt(eo,to){return this.setLimit("min",eo,!1,w.toString(to))}lte(eo,to){return this.setLimit("max",eo,!0,w.toString(to))}lt(eo,to){return this.setLimit("max",eo,!1,w.toString(to))}setLimit(eo,to,ro,no){return new rC({...this._def,checks:[...this._def.checks,{kind:eo,value:to,inclusive:ro,message:w.toString(no)}]})}_addCheck(eo){return new rC({...this._def,checks:[...this._def.checks,eo]})}int(eo){return this._addCheck({kind:"int",message:w.toString(eo)})}positive(eo){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(eo)})}negative(eo){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(eo)})}nonpositive(eo){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(eo)})}nonnegative(eo){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(eo)})}multipleOf(eo,to){return this._addCheck({kind:"multipleOf",value:eo,message:w.toString(to)})}finite(eo){return this._addCheck({kind:"finite",message:w.toString(eo)})}get minValue(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo}get maxValue(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valueeo.kind==="int"||eo.kind==="multipleOf"&&T$1.isInteger(eo.value))}get isFinite(){let eo=null,to=null;for(const ro of this._def.checks){if(ro.kind==="finite"||ro.kind==="int"||ro.kind==="multipleOf")return!0;ro.kind==="min"?(to===null||ro.value>to)&&(to=ro.value):ro.kind==="max"&&(eo===null||ro.valuenew Y$1({checks:[],typeName:g$1.ZodNumber,coerce:(Xr==null?void 0:Xr.coerce)||!1,...b$1(Xr)});let we$1=class extends v{_parse(eo){if(this._def.coerce&&(eo.data=BigInt(eo.data)),this._getType(eo)!==p.bigint){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.bigint,received:to.parsedType}),_$2}return N$2(eo.data)}};we$1.create=Xr=>{var eo;return new we$1({typeName:g$1.ZodBigInt,coerce:(eo=Xr==null?void 0:Xr.coerce)!==null&&eo!==void 0?eo:!1,...b$1(Xr)})};let xe$1=class extends v{_parse(eo){if(this._def.coerce&&(eo.data=!!eo.data),this._getType(eo)!==p.boolean){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.boolean,received:to.parsedType}),_$2}return N$2(eo.data)}};xe$1.create=Xr=>new xe$1({typeName:g$1.ZodBoolean,coerce:(Xr==null?void 0:Xr.coerce)||!1,...b$1(Xr)});let ee$1=class vC extends v{_parse(eo){if(this._def.coerce&&(eo.data=new Date(eo.data)),this._getType(eo)!==p.date){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_type,expected:p.date,received:no.parsedType}),_$2}if(isNaN(eo.data.getTime())){const no=this._getOrReturnCtx(eo);return y$3(no,{code:d$2.invalid_date}),_$2}const to=new L$2;let ro;for(const no of this._def.checks)no.kind==="min"?eo.data.getTime()no.value&&(ro=this._getOrReturnCtx(eo,ro),y$3(ro,{code:d$2.too_big,message:no.message,inclusive:!0,exact:!1,maximum:no.value,type:"date"}),to.dirty()):T$1.assertNever(no);return{status:to.value,value:new Date(eo.data.getTime())}}_addCheck(eo){return new vC({...this._def,checks:[...this._def.checks,eo]})}min(eo,to){return this._addCheck({kind:"min",value:eo.getTime(),message:w.toString(to)})}max(eo,to){return this._addCheck({kind:"max",value:eo.getTime(),message:w.toString(to)})}get minDate(){let eo=null;for(const to of this._def.checks)to.kind==="min"&&(eo===null||to.value>eo)&&(eo=to.value);return eo!=null?new Date(eo):null}get maxDate(){let eo=null;for(const to of this._def.checks)to.kind==="max"&&(eo===null||to.valuenew ee$1({checks:[],coerce:(Xr==null?void 0:Xr.coerce)||!1,typeName:g$1.ZodDate,...b$1(Xr)});let Ve$1=class extends v{_parse(eo){if(this._getType(eo)!==p.symbol){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.symbol,received:to.parsedType}),_$2}return N$2(eo.data)}};Ve$1.create=Xr=>new Ve$1({typeName:g$1.ZodSymbol,...b$1(Xr)});let Te$1=class extends v{_parse(eo){if(this._getType(eo)!==p.undefined){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.undefined,received:to.parsedType}),_$2}return N$2(eo.data)}};Te$1.create=Xr=>new Te$1({typeName:g$1.ZodUndefined,...b$1(Xr)});let Ee$1=class extends v{_parse(eo){if(this._getType(eo)!==p.null){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.null,received:to.parsedType}),_$2}return N$2(eo.data)}};Ee$1.create=Xr=>new Ee$1({typeName:g$1.ZodNull,...b$1(Xr)});let le$1=class extends v{constructor(){super(...arguments),this._any=!0}_parse(eo){return N$2(eo.data)}};le$1.create=Xr=>new le$1({typeName:g$1.ZodAny,...b$1(Xr)});let K$1=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(eo){return N$2(eo.data)}};K$1.create=Xr=>new K$1({typeName:g$1.ZodUnknown,...b$1(Xr)});let J$1=class extends v{_parse(eo){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.never,received:to.parsedType}),_$2}};J$1.create=Xr=>new J$1({typeName:g$1.ZodNever,...b$1(Xr)});let Be$1=class extends v{_parse(eo){if(this._getType(eo)!==p.undefined){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.void,received:to.parsedType}),_$2}return N$2(eo.data)}};Be$1.create=Xr=>new Be$1({typeName:g$1.ZodVoid,...b$1(Xr)});let $$1=class m_ extends v{_parse(eo){const{ctx:to,status:ro}=this._processInputParams(eo),no=this._def;if(to.parsedType!==p.array)return y$3(to,{code:d$2.invalid_type,expected:p.array,received:to.parsedType}),_$2;if(no.exactLength!==null){const oo=to.data.length>no.exactLength.value,ao=to.data.lengthno.maxLength.value&&(y$3(to,{code:d$2.too_big,maximum:no.maxLength.value,type:"array",inclusive:!0,exact:!1,message:no.maxLength.message}),ro.dirty()),to.common.async)return Promise.all([...to.data].map((oo,ao)=>no.type._parseAsync(new U$1(to,oo,to.path,ao)))).then(oo=>L$2.mergeArray(ro,oo));const io=[...to.data].map((oo,ao)=>no.type._parseSync(new U$1(to,oo,to.path,ao)));return L$2.mergeArray(ro,io)}get element(){return this._def.type}min(eo,to){return new m_({...this._def,minLength:{value:eo,message:w.toString(to)}})}max(eo,to){return new m_({...this._def,maxLength:{value:eo,message:w.toString(to)}})}length(eo,to){return new m_({...this._def,exactLength:{value:eo,message:w.toString(to)}})}nonempty(eo){return this.min(1,eo)}};$$1.create=(Xr,eo)=>new $$1({type:Xr,minLength:null,maxLength:null,exactLength:null,typeName:g$1.ZodArray,...b$1(eo)});var He$1;(function(Xr){Xr.mergeShapes=(eo,to)=>({...eo,...to})})(He$1||(He$1={}));function oe$1(Xr){if(Xr instanceof C$1){const eo={};for(const to in Xr.shape){const ro=Xr.shape[to];eo[to]=H$1.create(oe$1(ro))}return new C$1({...Xr._def,shape:()=>eo})}else return Xr instanceof $$1?$$1.create(oe$1(Xr.element)):Xr instanceof H$1?H$1.create(oe$1(Xr.unwrap())):Xr instanceof re$1?re$1.create(oe$1(Xr.unwrap())):Xr instanceof W$1?W$1.create(Xr.items.map(eo=>oe$1(eo))):Xr}let C$1=class q0 extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const eo=this._def.shape(),to=T$1.objectKeys(eo);return this._cached={shape:eo,keys:to}}_parse(eo){if(this._getType(eo)!==p.object){const so=this._getOrReturnCtx(eo);return y$3(so,{code:d$2.invalid_type,expected:p.object,received:so.parsedType}),_$2}const{status:to,ctx:ro}=this._processInputParams(eo),{shape:no,keys:io}=this._getCached(),oo=[];if(!(this._def.catchall instanceof J$1&&this._def.unknownKeys==="strip"))for(const so in ro.data)io.includes(so)||oo.push(so);const ao=[];for(const so of io){const co=no[so],lo=ro.data[so];ao.push({key:{status:"valid",value:so},value:co._parse(new U$1(ro,lo,ro.path,so)),alwaysSet:so in ro.data})}if(this._def.catchall instanceof J$1){const so=this._def.unknownKeys;if(so==="passthrough")for(const co of oo)ao.push({key:{status:"valid",value:co},value:{status:"valid",value:ro.data[co]}});else if(so==="strict")oo.length>0&&(y$3(ro,{code:d$2.unrecognized_keys,keys:oo}),to.dirty());else if(so!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const so=this._def.catchall;for(const co of oo){const lo=ro.data[co];ao.push({key:{status:"valid",value:co},value:so._parse(new U$1(ro,lo,ro.path,co)),alwaysSet:co in ro.data})}}return ro.common.async?Promise.resolve().then(async()=>{const so=[];for(const co of ao){const lo=await co.key;so.push({key:lo,value:await co.value,alwaysSet:co.alwaysSet})}return so}).then(so=>L$2.mergeObjectSync(to,so)):L$2.mergeObjectSync(to,ao)}get shape(){return this._def.shape()}strict(eo){return w.errToObj,new q0({...this._def,unknownKeys:"strict",...eo!==void 0?{errorMap:(to,ro)=>{var no,io,oo,ao;const so=(oo=(io=(no=this._def).errorMap)===null||io===void 0?void 0:io.call(no,to,ro).message)!==null&&oo!==void 0?oo:ro.defaultError;return to.code==="unrecognized_keys"?{message:(ao=w.errToObj(eo).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new q0({...this._def,unknownKeys:"strip"})}passthrough(){return new q0({...this._def,unknownKeys:"passthrough"})}extend(eo){return new q0({...this._def,shape:()=>({...this._def.shape(),...eo})})}merge(eo){return new q0({unknownKeys:eo._def.unknownKeys,catchall:eo._def.catchall,shape:()=>He$1.mergeShapes(this._def.shape(),eo._def.shape()),typeName:g$1.ZodObject})}setKey(eo,to){return this.augment({[eo]:to})}catchall(eo){return new q0({...this._def,catchall:eo})}pick(eo){const to={};return T$1.objectKeys(eo).forEach(ro=>{eo[ro]&&this.shape[ro]&&(to[ro]=this.shape[ro])}),new q0({...this._def,shape:()=>to})}omit(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{eo[ro]||(to[ro]=this.shape[ro])}),new q0({...this._def,shape:()=>to})}deepPartial(){return oe$1(this)}partial(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{const no=this.shape[ro];eo&&!eo[ro]?to[ro]=no:to[ro]=no.optional()}),new q0({...this._def,shape:()=>to})}required(eo){const to={};return T$1.objectKeys(this.shape).forEach(ro=>{if(eo&&!eo[ro])to[ro]=this.shape[ro];else{let no=this.shape[ro];for(;no instanceof H$1;)no=no._def.innerType;to[ro]=no}}),new q0({...this._def,shape:()=>to})}keyof(){return zr(T$1.objectKeys(this.shape))}};C$1.create=(Xr,eo)=>new C$1({shape:()=>Xr,unknownKeys:"strip",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});C$1.strictCreate=(Xr,eo)=>new C$1({shape:()=>Xr,unknownKeys:"strict",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});C$1.lazycreate=(Xr,eo)=>new C$1({shape:Xr,unknownKeys:"strip",catchall:J$1.create(),typeName:g$1.ZodObject,...b$1(eo)});let ke$1=class extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.options;function no(io){for(const ao of io)if(ao.result.status==="valid")return ao.result;for(const ao of io)if(ao.result.status==="dirty")return to.common.issues.push(...ao.ctx.common.issues),ao.result;const oo=io.map(ao=>new B$1(ao.ctx.common.issues));return y$3(to,{code:d$2.invalid_union,unionErrors:oo}),_$2}if(to.common.async)return Promise.all(ro.map(async io=>{const oo={...to,common:{...to.common,issues:[]},parent:null};return{result:await io._parseAsync({data:to.data,path:to.path,parent:oo}),ctx:oo}})).then(no);{let io;const oo=[];for(const so of ro){const co={...to,common:{...to.common,issues:[]},parent:null},lo=so._parseSync({data:to.data,path:to.path,parent:co});if(lo.status==="valid")return lo;lo.status==="dirty"&&!io&&(io={result:lo,ctx:co}),co.common.issues.length&&oo.push(co.common.issues)}if(io)return to.common.issues.push(...io.ctx.common.issues),io.result;const ao=oo.map(so=>new B$1(so));return y$3(to,{code:d$2.invalid_union,unionErrors:ao}),_$2}}get options(){return this._def.options}};ke$1.create=(Xr,eo)=>new ke$1({options:Xr,typeName:g$1.ZodUnion,...b$1(eo)});const $e=Xr=>Xr instanceof Oe$1?$e(Xr.schema):Xr instanceof D?$e(Xr.innerType()):Xr instanceof Pe$1?[Xr.value]:Xr instanceof Q$1?Xr.options:Xr instanceof Se$1?Object.keys(Xr.enum):Xr instanceof Ne$1?$e(Xr._def.innerType):Xr instanceof Te$1?[void 0]:Xr instanceof Ee$1?[null]:null;let at$1=class bC extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.object)return y$3(to,{code:d$2.invalid_type,expected:p.object,received:to.parsedType}),_$2;const ro=this.discriminator,no=to.data[ro],io=this.optionsMap.get(no);return io?to.common.async?io._parseAsync({data:to.data,path:to.path,parent:to}):io._parseSync({data:to.data,path:to.path,parent:to}):(y$3(to,{code:d$2.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ro]}),_$2)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(eo,to,ro){const no=new Map;for(const io of to){const oo=$e(io.shape[eo]);if(!oo)throw new Error(`A discriminator value for key \`${eo}\` could not be extracted from all schema options`);for(const ao of oo){if(no.has(ao))throw new Error(`Discriminator property ${String(eo)} has duplicate value ${String(ao)}`);no.set(ao,io)}}return new bC({typeName:g$1.ZodDiscriminatedUnion,discriminator:eo,options:to,optionsMap:no,...b$1(ro)})}};function bt$1(Xr,eo){const to=G$1(Xr),ro=G$1(eo);if(Xr===eo)return{valid:!0,data:Xr};if(to===p.object&&ro===p.object){const no=T$1.objectKeys(eo),io=T$1.objectKeys(Xr).filter(ao=>no.indexOf(ao)!==-1),oo={...Xr,...eo};for(const ao of io){const so=bt$1(Xr[ao],eo[ao]);if(!so.valid)return{valid:!1};oo[ao]=so.data}return{valid:!0,data:oo}}else if(to===p.array&&ro===p.array){if(Xr.length!==eo.length)return{valid:!1};const no=[];for(let io=0;io{if(gt$1(io)||gt$1(oo))return _$2;const ao=bt$1(io.value,oo.value);return ao.valid?((_t$1(io)||_t$1(oo))&&to.dirty(),{status:to.value,value:ao.data}):(y$3(ro,{code:d$2.invalid_intersection_types}),_$2)};return ro.common.async?Promise.all([this._def.left._parseAsync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseAsync({data:ro.data,path:ro.path,parent:ro})]).then(([io,oo])=>no(io,oo)):no(this._def.left._parseSync({data:ro.data,path:ro.path,parent:ro}),this._def.right._parseSync({data:ro.data,path:ro.path,parent:ro}))}};Ce$1.create=(Xr,eo,to)=>new Ce$1({left:Xr,right:eo,typeName:g$1.ZodIntersection,...b$1(to)});let W$1=class wC extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.array)return y$3(ro,{code:d$2.invalid_type,expected:p.array,received:ro.parsedType}),_$2;if(ro.data.lengththis._def.items.length&&(y$3(ro,{code:d$2.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),to.dirty());const no=[...ro.data].map((io,oo)=>{const ao=this._def.items[oo]||this._def.rest;return ao?ao._parse(new U$1(ro,io,ro.path,oo)):null}).filter(io=>!!io);return ro.common.async?Promise.all(no).then(io=>L$2.mergeArray(to,io)):L$2.mergeArray(to,no)}get items(){return this._def.items}rest(eo){return new wC({...this._def,rest:eo})}};W$1.create=(Xr,eo)=>{if(!Array.isArray(Xr))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W$1({items:Xr,typeName:g$1.ZodTuple,rest:null,...b$1(eo)})};let Re$1=class nC extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.object)return y$3(ro,{code:d$2.invalid_type,expected:p.object,received:ro.parsedType}),_$2;const no=[],io=this._def.keyType,oo=this._def.valueType;for(const ao in ro.data)no.push({key:io._parse(new U$1(ro,ao,ro.path,ao)),value:oo._parse(new U$1(ro,ro.data[ao],ro.path,ao))});return ro.common.async?L$2.mergeObjectAsync(to,no):L$2.mergeObjectSync(to,no)}get element(){return this._def.valueType}static create(eo,to,ro){return to instanceof v?new nC({keyType:eo,valueType:to,typeName:g$1.ZodRecord,...b$1(ro)}):new nC({keyType:F$1.create(),valueType:eo,typeName:g$1.ZodRecord,...b$1(to)})}},Fe$1=class extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.map)return y$3(ro,{code:d$2.invalid_type,expected:p.map,received:ro.parsedType}),_$2;const no=this._def.keyType,io=this._def.valueType,oo=[...ro.data.entries()].map(([ao,so],co)=>({key:no._parse(new U$1(ro,ao,ro.path,[co,"key"])),value:io._parse(new U$1(ro,so,ro.path,[co,"value"]))}));if(ro.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of oo){const co=await so.key,lo=await so.value;if(co.status==="aborted"||lo.status==="aborted")return _$2;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}})}else{const ao=new Map;for(const so of oo){const co=so.key,lo=so.value;if(co.status==="aborted"||lo.status==="aborted")return _$2;(co.status==="dirty"||lo.status==="dirty")&&to.dirty(),ao.set(co.value,lo.value)}return{status:to.value,value:ao}}}};Fe$1.create=(Xr,eo,to)=>new Fe$1({valueType:eo,keyType:Xr,typeName:g$1.ZodMap,...b$1(to)});let te$1=class iC extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.parsedType!==p.set)return y$3(ro,{code:d$2.invalid_type,expected:p.set,received:ro.parsedType}),_$2;const no=this._def;no.minSize!==null&&ro.data.sizeno.maxSize.value&&(y$3(ro,{code:d$2.too_big,maximum:no.maxSize.value,type:"set",inclusive:!0,exact:!1,message:no.maxSize.message}),to.dirty());const io=this._def.valueType;function oo(so){const co=new Set;for(const lo of so){if(lo.status==="aborted")return _$2;lo.status==="dirty"&&to.dirty(),co.add(lo.value)}return{status:to.value,value:co}}const ao=[...ro.data.values()].map((so,co)=>io._parse(new U$1(ro,so,ro.path,co)));return ro.common.async?Promise.all(ao).then(so=>oo(so)):oo(ao)}min(eo,to){return new iC({...this._def,minSize:{value:eo,message:w.toString(to)}})}max(eo,to){return new iC({...this._def,maxSize:{value:eo,message:w.toString(to)}})}size(eo,to){return this.min(eo,to).max(eo,to)}nonempty(eo){return this.min(1,eo)}};te$1.create=(Xr,eo)=>new te$1({valueType:Xr,minSize:null,maxSize:null,typeName:g$1.ZodSet,...b$1(eo)});let ce$1=class g_ extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.function)return y$3(to,{code:d$2.invalid_type,expected:p.function,received:to.parsedType}),_$2;function ro(ao,so){return We$1({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,Ue$1(),ve$1].filter(co=>!!co),issueData:{code:d$2.invalid_arguments,argumentsError:so}})}function no(ao,so){return We$1({data:ao,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,Ue$1(),ve$1].filter(co=>!!co),issueData:{code:d$2.invalid_return_type,returnTypeError:so}})}const io={errorMap:to.common.contextualErrorMap},oo=to.data;return this._def.returns instanceof de$1?N$2(async(...ao)=>{const so=new B$1([]),co=await this._def.args.parseAsync(ao,io).catch(uo=>{throw so.addIssue(ro(ao,uo)),so}),lo=await oo(...co);return await this._def.returns._def.type.parseAsync(lo,io).catch(uo=>{throw so.addIssue(no(lo,uo)),so})}):N$2((...ao)=>{const so=this._def.args.safeParse(ao,io);if(!so.success)throw new B$1([ro(ao,so.error)]);const co=oo(...so.data),lo=this._def.returns.safeParse(co,io);if(!lo.success)throw new B$1([no(co,lo.error)]);return lo.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...eo){return new g_({...this._def,args:W$1.create(eo).rest(K$1.create())})}returns(eo){return new g_({...this._def,returns:eo})}implement(eo){return this.parse(eo)}strictImplement(eo){return this.parse(eo)}static create(eo,to,ro){return new g_({args:eo||W$1.create([]).rest(K$1.create()),returns:to||K$1.create(),typeName:g$1.ZodFunction,...b$1(ro)})}},Oe$1=class extends v{get schema(){return this._def.getter()}_parse(eo){const{ctx:to}=this._processInputParams(eo);return this._def.getter()._parse({data:to.data,path:to.path,parent:to})}};Oe$1.create=(Xr,eo)=>new Oe$1({getter:Xr,typeName:g$1.ZodLazy,...b$1(eo)});let Pe$1=class extends v{_parse(eo){if(eo.data!==this._def.value){const to=this._getOrReturnCtx(eo);return y$3(to,{received:to.data,code:d$2.invalid_literal,expected:this._def.value}),_$2}return{status:"valid",value:eo.data}}get value(){return this._def.value}};Pe$1.create=(Xr,eo)=>new Pe$1({value:Xr,typeName:g$1.ZodLiteral,...b$1(eo)});function zr(Xr,eo){return new Q$1({values:Xr,typeName:g$1.ZodEnum,...b$1(eo)})}let Q$1=class oC extends v{_parse(eo){if(typeof eo.data!="string"){const to=this._getOrReturnCtx(eo),ro=this._def.values;return y$3(to,{expected:T$1.joinValues(ro),received:to.parsedType,code:d$2.invalid_type}),_$2}if(this._def.values.indexOf(eo.data)===-1){const to=this._getOrReturnCtx(eo),ro=this._def.values;return y$3(to,{received:to.data,code:d$2.invalid_enum_value,options:ro}),_$2}return N$2(eo.data)}get options(){return this._def.values}get enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Values(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}get Enum(){const eo={};for(const to of this._def.values)eo[to]=to;return eo}extract(eo){return oC.create(eo)}exclude(eo){return oC.create(this.options.filter(to=>!eo.includes(to)))}};Q$1.create=zr;let Se$1=class extends v{_parse(eo){const to=T$1.getValidEnumValues(this._def.values),ro=this._getOrReturnCtx(eo);if(ro.parsedType!==p.string&&ro.parsedType!==p.number){const no=T$1.objectValues(to);return y$3(ro,{expected:T$1.joinValues(no),received:ro.parsedType,code:d$2.invalid_type}),_$2}if(to.indexOf(eo.data)===-1){const no=T$1.objectValues(to);return y$3(ro,{received:ro.data,code:d$2.invalid_enum_value,options:no}),_$2}return N$2(eo.data)}get enum(){return this._def.values}};Se$1.create=(Xr,eo)=>new Se$1({values:Xr,typeName:g$1.ZodNativeEnum,...b$1(eo)});let de$1=class extends v{unwrap(){return this._def.type}_parse(eo){const{ctx:to}=this._processInputParams(eo);if(to.parsedType!==p.promise&&to.common.async===!1)return y$3(to,{code:d$2.invalid_type,expected:p.promise,received:to.parsedType}),_$2;const ro=to.parsedType===p.promise?to.data:Promise.resolve(to.data);return N$2(ro.then(no=>this._def.type.parseAsync(no,{path:to.path,errorMap:to.common.contextualErrorMap})))}};de$1.create=(Xr,eo)=>new de$1({type:Xr,typeName:g$1.ZodPromise,...b$1(eo)});class D extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g$1.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo),no=this._def.effect||null;if(no.type==="preprocess"){const oo=no.transform(ro.data);return ro.common.async?Promise.resolve(oo).then(ao=>this._def.schema._parseAsync({data:ao,path:ro.path,parent:ro})):this._def.schema._parseSync({data:oo,path:ro.path,parent:ro})}const io={addIssue:oo=>{y$3(ro,oo),oo.fatal?to.abort():to.dirty()},get path(){return ro.path}};if(io.addIssue=io.addIssue.bind(io),no.type==="refinement"){const oo=ao=>{const so=no.refinement(ao,io);if(ro.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(ro.common.async===!1){const ao=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});return ao.status==="aborted"?_$2:(ao.status==="dirty"&&to.dirty(),oo(ao.value),{status:to.value,value:ao.value})}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(ao=>ao.status==="aborted"?_$2:(ao.status==="dirty"&&to.dirty(),oo(ao.value).then(()=>({status:to.value,value:ao.value}))))}if(no.type==="transform")if(ro.common.async===!1){const oo=this._def.schema._parseSync({data:ro.data,path:ro.path,parent:ro});if(!qe$1(oo))return oo;const ao=no.transform(oo.value,io);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:to.value,value:ao}}else return this._def.schema._parseAsync({data:ro.data,path:ro.path,parent:ro}).then(oo=>qe$1(oo)?Promise.resolve(no.transform(oo.value,io)).then(ao=>({status:to.value,value:ao})):oo);T$1.assertNever(no)}}D.create=(Xr,eo,to)=>new D({schema:Xr,typeName:g$1.ZodEffects,effect:eo,...b$1(to)});D.createWithPreprocess=(Xr,eo,to)=>new D({schema:eo,effect:{type:"preprocess",transform:Xr},typeName:g$1.ZodEffects,...b$1(to)});let H$1=class extends v{_parse(eo){return this._getType(eo)===p.undefined?N$2(void 0):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}};H$1.create=(Xr,eo)=>new H$1({innerType:Xr,typeName:g$1.ZodOptional,...b$1(eo)});let re$1=class extends v{_parse(eo){return this._getType(eo)===p.null?N$2(null):this._def.innerType._parse(eo)}unwrap(){return this._def.innerType}};re$1.create=(Xr,eo)=>new re$1({innerType:Xr,typeName:g$1.ZodNullable,...b$1(eo)});let Ne$1=class extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo);let ro=to.data;return to.parsedType===p.undefined&&(ro=this._def.defaultValue()),this._def.innerType._parse({data:ro,path:to.path,parent:to})}removeDefault(){return this._def.innerType}};Ne$1.create=(Xr,eo)=>new Ne$1({innerType:Xr,typeName:g$1.ZodDefault,defaultValue:typeof eo.default=="function"?eo.default:()=>eo.default,...b$1(eo)});class Je extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=this._def.innerType._parse({data:to.data,path:to.path,parent:{...to,common:{...to.common,issues:[]}}});return ze$1(ro)?ro.then(no=>({status:"valid",value:no.status==="valid"?no.value:this._def.catchValue()})):{status:"valid",value:ro.status==="valid"?ro.value:this._def.catchValue()}}removeCatch(){return this._def.innerType}}Je.create=(Xr,eo)=>new Je({innerType:Xr,typeName:g$1.ZodCatch,catchValue:typeof eo.catch=="function"?eo.catch:()=>eo.catch,...b$1(eo)});let Ge$1=class extends v{_parse(eo){if(this._getType(eo)!==p.nan){const to=this._getOrReturnCtx(eo);return y$3(to,{code:d$2.invalid_type,expected:p.nan,received:to.parsedType}),_$2}return{status:"valid",value:eo.data}}};Ge$1.create=Xr=>new Ge$1({typeName:g$1.ZodNaN,...b$1(Xr)});const yi=Symbol("zod_brand");class Vr extends v{_parse(eo){const{ctx:to}=this._processInputParams(eo),ro=to.data;return this._def.type._parse({data:ro,path:to.path,parent:to})}unwrap(){return this._def.type}}let Le$1=class _C extends v{_parse(eo){const{status:to,ctx:ro}=this._processInputParams(eo);if(ro.common.async)return(async()=>{const no=await this._def.in._parseAsync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?_$2:no.status==="dirty"?(to.dirty(),qr(no.value)):this._def.out._parseAsync({data:no.value,path:ro.path,parent:ro})})();{const no=this._def.in._parseSync({data:ro.data,path:ro.path,parent:ro});return no.status==="aborted"?_$2:no.status==="dirty"?(to.dirty(),{status:"dirty",value:no.value}):this._def.out._parseSync({data:no.value,path:ro.path,parent:ro})}}static create(eo,to){return new _C({in:eo,out:to,typeName:g$1.ZodPipeline})}};const Br=(Xr,eo={},to)=>Xr?le$1.create().superRefine((ro,no)=>{if(!Xr(ro)){const io=typeof eo=="function"?eo(ro):eo,oo=typeof io=="string"?{message:io}:io;no.addIssue({code:"custom",...oo,fatal:to})}}):le$1.create(),gi={object:C$1.lazycreate};var g$1;(function(Xr){Xr.ZodString="ZodString",Xr.ZodNumber="ZodNumber",Xr.ZodNaN="ZodNaN",Xr.ZodBigInt="ZodBigInt",Xr.ZodBoolean="ZodBoolean",Xr.ZodDate="ZodDate",Xr.ZodSymbol="ZodSymbol",Xr.ZodUndefined="ZodUndefined",Xr.ZodNull="ZodNull",Xr.ZodAny="ZodAny",Xr.ZodUnknown="ZodUnknown",Xr.ZodNever="ZodNever",Xr.ZodVoid="ZodVoid",Xr.ZodArray="ZodArray",Xr.ZodObject="ZodObject",Xr.ZodUnion="ZodUnion",Xr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Xr.ZodIntersection="ZodIntersection",Xr.ZodTuple="ZodTuple",Xr.ZodRecord="ZodRecord",Xr.ZodMap="ZodMap",Xr.ZodSet="ZodSet",Xr.ZodFunction="ZodFunction",Xr.ZodLazy="ZodLazy",Xr.ZodLiteral="ZodLiteral",Xr.ZodEnum="ZodEnum",Xr.ZodEffects="ZodEffects",Xr.ZodNativeEnum="ZodNativeEnum",Xr.ZodOptional="ZodOptional",Xr.ZodNullable="ZodNullable",Xr.ZodDefault="ZodDefault",Xr.ZodCatch="ZodCatch",Xr.ZodPromise="ZodPromise",Xr.ZodBranded="ZodBranded",Xr.ZodPipeline="ZodPipeline"})(g$1||(g$1={}));const _i=(Xr,eo={message:`Input not instance of ${Xr.name}`})=>Br(to=>to instanceof Xr,eo,!0),Hr=F$1.create,Fr=Y$1.create,bi=Ge$1.create,vi=we$1.create,Jr=xe$1.create,wi=ee$1.create,xi=Ve$1.create,Ti=Te$1.create,Ei=Ee$1.create,ki=le$1.create,Ci=K$1.create,Ri=J$1.create,Oi=Be$1.create,Pi=$$1.create,Si=C$1.create,Ni=C$1.strictCreate,Li=ke$1.create,Ii=at$1.create,ji=Ce$1.create,Ai=W$1.create,Mi=Re$1.create,$i=Fe$1.create,Di=te$1.create,Zi=ce$1.create,Ui=Oe$1.create,Wi=Pe$1.create,qi=Q$1.create,zi=Se$1.create,Vi=de$1.create,Kt$1=D.create,Bi=H$1.create,Hi=re$1.create,Fi=D.createWithPreprocess,Ji=Le$1.create,Gi=()=>Hr().optional(),Yi=()=>Fr().optional(),Qi=()=>Jr().optional(),Xi={string:Xr=>F$1.create({...Xr,coerce:!0}),number:Xr=>Y$1.create({...Xr,coerce:!0}),boolean:Xr=>xe$1.create({...Xr,coerce:!0}),bigint:Xr=>we$1.create({...Xr,coerce:!0}),date:Xr=>ee$1.create({...Xr,coerce:!0})},Ki=_$2;var f$1=Object.freeze({__proto__:null,defaultErrorMap:ve$1,setErrorMap:ci,getErrorMap:Ue$1,makeIssue:We$1,EMPTY_PATH:ui,addIssueToContext:y$3,ParseStatus:L$2,INVALID:_$2,DIRTY:qr,OK:N$2,isAborted:gt$1,isDirty:_t$1,isValid:qe$1,isAsync:ze$1,get util(){return T$1},ZodParsedType:p,getParsedType:G$1,ZodType:v,ZodString:F$1,ZodNumber:Y$1,ZodBigInt:we$1,ZodBoolean:xe$1,ZodDate:ee$1,ZodSymbol:Ve$1,ZodUndefined:Te$1,ZodNull:Ee$1,ZodAny:le$1,ZodUnknown:K$1,ZodNever:J$1,ZodVoid:Be$1,ZodArray:$$1,get objectUtil(){return He$1},ZodObject:C$1,ZodUnion:ke$1,ZodDiscriminatedUnion:at$1,ZodIntersection:Ce$1,ZodTuple:W$1,ZodRecord:Re$1,ZodMap:Fe$1,ZodSet:te$1,ZodFunction:ce$1,ZodLazy:Oe$1,ZodLiteral:Pe$1,ZodEnum:Q$1,ZodNativeEnum:Se$1,ZodPromise:de$1,ZodEffects:D,ZodTransformer:D,ZodOptional:H$1,ZodNullable:re$1,ZodDefault:Ne$1,ZodCatch:Je,ZodNaN:Ge$1,BRAND:yi,ZodBranded:Vr,ZodPipeline:Le$1,custom:Br,Schema:v,ZodSchema:v,late:gi,get ZodFirstPartyTypeKind(){return g$1},coerce:Xi,any:ki,array:Pi,bigint:vi,boolean:Jr,date:wi,discriminatedUnion:Ii,effect:Kt$1,enum:qi,function:Zi,instanceof:_i,intersection:ji,lazy:Ui,literal:Wi,map:$i,nan:bi,nativeEnum:zi,never:Ri,null:Ei,nullable:Hi,number:Fr,object:Si,oboolean:Qi,onumber:Yi,optional:Bi,ostring:Gi,pipeline:Ji,preprocess:Fi,promise:Vi,record:Mi,set:Di,strictObject:Ni,string:Hr,symbol:xi,transformer:Kt$1,tuple:Ai,undefined:Ti,union:Li,unknown:Ci,void:Oi,NEVER:Ki,ZodIssueCode:d$2,quotelessJson:oi,ZodError:B$1});const Gr=/^0x[0-9a-f]+$/i,Yr=/^\d+$/,ea=f$1.string().nonempty("The short string cannot be empty").max(31,"The short string cannot exceed 31 characters").refine(Xr=>!Gr.test(Xr),"The shortString should not be a hex string").refine(Xr=>!Yr.test(Xr),"The shortString should not be an integer string"),De$1=f$1.union([f$1.string().regex(Gr,"Only hex, integers and bigint are supported in calldata"),f$1.string().regex(Yr,"Only hex, integers and bigint are supported in calldata"),ea,f$1.number().int("Only hex, integers and bigint are supported in calldata"),f$1.bigint()]),er$1=f$1.object({contractAddress:f$1.string(),entrypoint:f$1.string(),calldata:f$1.array(De$1).optional()}),ta=f$1.object({types:f$1.record(f$1.array(f$1.union([f$1.object({name:f$1.string(),type:f$1.string()}),f$1.object({name:f$1.string(),type:f$1.literal("merkletree"),contains:f$1.string()})]))),primaryType:f$1.string(),domain:f$1.record(f$1.unknown()),message:f$1.record(f$1.unknown())}),tr$1={enable:f$1.tuple([f$1.object({starknetVersion:f$1.union([f$1.literal("v4"),f$1.literal("v5")]).optional()}).optional()]).or(f$1.tuple([])),addStarknetChain:f$1.tuple([f$1.object({id:f$1.string(),chainId:f$1.string(),chainName:f$1.string(),rpcUrls:f$1.array(f$1.string()).optional(),nativeCurrency:f$1.object({name:f$1.string(),symbol:f$1.string(),decimals:f$1.number()}).optional(),blockExplorerUrls:f$1.array(f$1.string()).optional()})]),switchStarknetChain:f$1.tuple([f$1.object({chainId:f$1.string()})]),watchAsset:f$1.tuple([f$1.object({type:f$1.literal("ERC20"),options:f$1.object({address:f$1.string(),symbol:f$1.string().optional(),decimals:f$1.number().optional(),image:f$1.string().optional(),name:f$1.string().optional()})})]),execute:f$1.tuple([f$1.array(er$1).nonempty().or(er$1),f$1.array(f$1.any()).optional(),f$1.object({nonce:De$1.optional(),maxFee:De$1.optional(),version:De$1.optional()}).optional()]),signMessage:f$1.tuple([ta])},M$1=Jn.create({isServer:!1,allowOutsideOfServer:!0});let vt$1=sr$1,wt$1="",Qr="";const be$1=({width:Xr=775,height:eo=385,origin:to,location:ro,atLeftBottom:no=!1})=>{const io=(window==null?void 0:window.outerWidth)??(window==null?void 0:window.innerWidth)??(window==null?void 0:window.screen.width)??0,oo=(window==null?void 0:window.outerHeight)??(window==null?void 0:window.innerHeight)??(window==null?void 0:window.screen.height)??0,ao=(window==null?void 0:window.screenLeft)??(window==null?void 0:window.screenX)??0,so=(window==null?void 0:window.screenTop)??(window==null?void 0:window.screenY)??0,co=no?0:ao+io/2-Xr/2,lo=no?window.screen.availHeight+10:so+oo/2-eo/2;vt$1=to??vt$1,wt$1=ro??wt$1,Qr=`width=${Xr},height=${eo},top=${lo},left=${co},toolbar=no,menubar=no,scrollbars=no,location=no,status=no,popup=1`};M$1.router({authorize:M$1.procedure.output(f$1.boolean()).mutation(async()=>!0),connect:M$1.procedure.mutation(async()=>""),enable:M$1.procedure.output(f$1.string()).mutation(async()=>""),execute:M$1.procedure.input(tr$1.execute).output(f$1.string()).mutation(async()=>""),signMessage:M$1.procedure.input(tr$1.signMessage).output(f$1.string().array()).mutation(async()=>[]),getLoginStatus:M$1.procedure.output(f$1.object({isLoggedIn:f$1.boolean(),hasSession:f$1.boolean().optional(),isPreauthorized:f$1.boolean().optional()})).mutation(async()=>({isLoggedIn:!0})),addStarknetChain:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),switchStarknetChain:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),watchAsset:M$1.procedure.mutation(Xr=>{throw Error("not implemented")}),updateModal:M$1.procedure.subscription(async()=>{})});const ra=({iframe:Xr})=>Sn({links:[kn({enabled:eo=>!1}),mn({condition(eo){if(!Xr&&eo.type==="subscription")throw new Error("subscription is not supported without an iframe window");return!!Xr},true:mt$1.windowLink({window,postWindow:Xr,postOrigin:"*"}),false:mt$1.popupLink({listenWindow:window,createPopup:()=>{let eo=null;const to=document.createElement("button");if(to.style.display="none",to.addEventListener("click",()=>{eo=window.open(`${vt$1}${wt$1}`,"popup",Qr)}),to.click(),(async()=>{for(;!eo;)await new Promise(ro=>setTimeout(ro,100))})(),!eo)throw new Error("Could not open popup");return eo},postOrigin:"*"})})]});function na(Xr){const eo=s();try{const{origin:to}=new URL(Xr);if(to.includes("localhost")||to.includes("127.0.0.1")||to.includes("hydrogen"))return eo.testnet;if(to.includes("staging")||to.includes("argent.xyz"))return eo.mainnet}catch{console.warn("Could not determine rpc nodeUrl from target URL, defaulting to mainnet")}return eo.mainnet}const sa=385,ia=775,aa=385,oa=440,ca=886,ua=562;let rr$1=class{async getPubKey(){throw new Error("Method not implemented")}async signMessage(){throw new Error("Method not implemented")}async signTransaction(){throw new Error("Method not implemented")}async signDeclareTransaction(){throw new Error("Method not implemented")}async signDeployAccountTransaction(){throw new Error("Method not implemented")}};class la extends Account{constructor(eo,to,ro){super(eo,to,new rr$1),ie$1(this,"signer",new rr$1),ie$1(this,"execute",async(no,io,oo)=>{try{return be$1({width:sa,height:ia,location:"/review"}),Array.isArray(no)&&no[0]&&no[0].entrypoint==="use_offchain_session"&&be$1({width:1,height:1,location:"/executeSessionTx",atLeftBottom:!0}),{transaction_hash:await this.proxyLink.execute.mutate([no,io,oo])}}catch(ao){throw ao instanceof Error?new Error(ao.message):new Error("Error while execute a transaction")}}),ie$1(this,"signMessage",async no=>{try{return be$1({width:aa,height:oa,location:"/signMessage"}),await this.proxyLink.signMessage.mutate([no])}catch(io){throw io instanceof Error?new Error(io.message):new Error("Error while sign a message")}}),this.address=to,this.proxyLink=ro}}const je$1=[],da=(Xr,eo,to)=>{const ro={...Xr,isConnected:!1,provider:eo,getLoginStatus:()=>to.getLoginStatus.mutate(),async request(no){switch(no.type){case"wallet_addStarknetChain":return await to.addStarknetChain.mutate();case"wallet_switchStarknetChain":return await to.switchStarknetChain.mutate();case"wallet_watchAsset":return await to.watchAsset.mutate();default:throw new Error("not implemented")}},async enable(no){if((no==null?void 0:no.starknetVersion)!=="v4")throw Error("not implemented");try{be$1({width:ca,height:ua,location:"/interstitialLogin"});const io=await to.enable.mutate();return await fa(ro,eo,to,io),[io]}catch(io){throw io instanceof Error?new Error(io.message):new Error("Unknow error on enable wallet")}},async isPreauthorized(){const{isLoggedIn:no,isPreauthorized:io}=await to.getLoginStatus.mutate();return!!(no&&io)},on:(no,io)=>{if(no==="accountsChanged")je$1.push({type:no,handler:io});else if(no==="networkChanged")je$1.push({type:no,handler:io});else throw new Error(`Unknwown event: ${no}`)},off:(no,io)=>{if(no!=="accountsChanged"&&no!=="networkChanged")throw new Error(`Unknwown event: ${no}`);const oo=je$1.findIndex(ao=>ao.type===no&&ao.handler===io);oo>=0&&je$1.splice(oo,1)}};return ro};async function fa(Xr,eo,to,ro){if(Xr.isConnected)return Xr;const no={isConnected:!0,chainId:await eo.getChainId(),selectedAddress:ro,account:new la(eo,ro,to),provider:eo};return Object.assign(Xr,no)}const pa=async(Xr,eo,to)=>{const ro=typeof window<"u"?window:void 0;if(!ro)throw new Error("window is not defined");const no=na(Xr),io=to??new RpcProvider({nodeUrl:no});return da({host:ro.location.origin,id:"argentWebWallet",icon:"https://www.argent.xyz/favicon.ico",name:"Argent Web Wallet",version:"1.0.0"},io,eo)};let A$1=null;class ba extends T$2{constructor(eo={}){super(),ie$1(this,"_wallet",null),ie$1(this,"_options"),this._options=eo}available(){return!0}async ready(){return A$1?(this._wallet=A$1,this._wallet.isPreauthorized()):(this._wallet=null,!1)}get id(){var eo;return this._wallet=A$1,((eo=this._wallet)==null?void 0:eo.id)||"argentWebWallet"}get name(){var eo;return this._wallet=A$1,((eo=this._wallet)==null?void 0:eo.name)||"Argent Web Wallet"}get icon(){return{light:$t$1,dark:$t$1}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}get title(){return"Email"}get subtitle(){return"Powered by Argent"}async connect(){if(await this.ensureWallet(),!this._wallet)throw new U$2;try{await this._wallet.enable({starknetVersion:"v4"})}catch{throw new A$2}if(!this._wallet.isConnected)throw new A$2;const eo=this._wallet.account,to=await this.chainId();return{account:eo.address,chainId:to}}async disconnect(){var eo;if(!this.available()&&!this._wallet)throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1;A$1=null,this._wallet=A$1,q$2()}async account(){if(this._wallet=A$1,!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}async chainId(){if(!this._wallet||!this.wallet.account||!this._wallet.provider)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async initEventListener(eo){if(this._wallet=A$1,!this._wallet)throw new P$1;this._wallet.on("accountsChanged",eo)}async removeEventListener(eo){if(this._wallet=A$1,!this._wallet)throw new P$1;this._wallet.off("accountsChanged",eo),A$1=null,this._wallet=null}async ensureWallet(){const eo=this._options.url||sr$1,to=this._options.provider;be$1({origin:eo,location:"/interstitialLogin"}),A$1=await pa(eo,ra({}),to)??null,this._wallet=A$1}}var b=Object.defineProperty,y$2=(Xr,eo,to)=>eo in Xr?b(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,l$1=(Xr,eo,to)=>(y$2(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const d$1="f2e613881f7a0e811295cdd57999e31b",u=` - `,R$1=()=>Object.keys(localStorage).some(Xr=>Xr==="walletconnect"||Xr.startsWith("wc@2:")),_$1=()=>{if(R$1()){delete localStorage.walletconnect;for(const Xr in localStorage)Xr.startsWith("wc@2:")&&delete localStorage[Xr]}},j$2=()=>{var Xr;return window!=null&&window.starknet_argentX?(Xr=window==null?void 0:window.starknet_argentX)==null?void 0:Xr.isInAppBrowser:!1};let O$1=class extends T$2{constructor(eo={}){super(),l$1(this,"_wallet",null),l$1(this,"_options"),this._options=eo}available(){return!0}async ready(){return await this.ensureWallet(),this._wallet?this._wallet.isPreauthorized():!1}get id(){return"argentMobile"}get name(){return"Argent (mobile)"}get icon(){return{dark:u,light:u}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}async connect(){if(await this.ensureWallet(),!this._wallet)throw new U$2;const eo=this._wallet.account,to=await this.chainId();return{account:eo.address,chainId:to}}async disconnect(){var eo;if(await this._wallet.disable(),_$1(),!this.available()&&!this._wallet)throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1;this._wallet=null}async account(){if(!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}async chainId(){if(!this._wallet||!this.wallet.account||!this._wallet.provider)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async initEventListener(eo){if(!this._wallet)throw new P$1;this._wallet.on("accountsChanged",eo)}async removeEventListener(eo){if(!this._wallet)throw new P$1;this._wallet.off("accountsChanged",eo),this._wallet=null}async ensureWallet(){const{getStarknetWindowObject:eo}=await __vitePreload(async()=>{const{getStarknetWindowObject:vo}=await import("./index-8e228000-DPntdE7M.js");return{getStarknetWindowObject:vo}},[]),{chainId:to,projectId:ro,dappName:no,description:io,url:oo,icons:ao,provider:so,rpcUrl:co}=this._options,lo=s(),fo=co??(!to||to===constants_exports.NetworkName.SN_MAIN?lo.mainnet:lo.testnet),ho={chainId:to??constants_exports.NetworkName.SN_MAIN,name:no,projectId:ro??d$1,description:io,url:oo,icons:ao,provider:so,rpcUrl:fo};ro===d$1&&(console.log("========= NOTICE ========="),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys."),console.log("Go to WalletConnect Cloud (https://cloud.walletconnect.com) and create a new account."),console.log("Once your account is created, create a new project and collect the Project ID"),console.log("=========================="));const go=await eo(ho);if(!go)throw new A$2;this._wallet=go;const yo=this._wallet;await yo.enable(),yo.client.on("session_delete",()=>{_$1(),this._wallet=null,q$2(),document.dispatchEvent(new Event("wallet_disconnected"))})}};var g=Object.defineProperty,j$1=(Xr,eo,to)=>eo in Xr?g(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,N$1=(Xr,eo,to)=>(j$1(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const d="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iOCIgZmlsbD0iYmxhY2siLz4KPHBhdGggZD0iTTE4LjQwMTggNy41NTU1NkgxMy41OTgyQzEzLjQzNzcgNy41NTU1NiAxMy4zMDkxIDcuNjg3NDcgMTMuMzA1NiA3Ljg1MTQzQzEzLjIwODUgMTIuNDYwMyAxMC44NDg0IDE2LjgzNDcgNi43ODYwOCAxOS45MzMxQzYuNjU3MTEgMjAuMDMxNCA2LjYyNzczIDIwLjIxNjIgNi43MjIwMiAyMC4zNDkzTDkuNTMyNTMgMjQuMzE5NkM5LjYyODE1IDI0LjQ1NDggOS44MTQ0NCAyNC40ODUzIDkuOTQ1NTggMjQuMzg2QzEyLjQ4NTYgMjIuNDYxMyAxNC41Mjg3IDIwLjEzOTUgMTYgMTcuNTY2QzE3LjQ3MTMgMjAuMTM5NSAxOS41MTQ1IDIyLjQ2MTMgMjIuMDU0NSAyNC4zODZDMjIuMTg1NiAyNC40ODUzIDIyLjM3MTkgMjQuNDU0OCAyMi40Njc2IDI0LjMxOTZMMjUuMjc4MSAyMC4zNDkzQzI1LjM3MjMgMjAuMjE2MiAyNS4zNDI5IDIwLjAzMTQgMjUuMjE0IDE5LjkzMzFDMjEuMTUxNiAxNi44MzQ3IDE4Ljc5MTUgMTIuNDYwMyAxOC42OTQ2IDcuODUxNDNDMTguNjkxMSA3LjY4NzQ3IDE4LjU2MjMgNy41NTU1NiAxOC40MDE4IDcuNTU1NTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMjQuNzIzNiAxMC40OTJMMjQuMjIzMSA4LjkyNDM5QzI0LjEyMTMgOC42MDYxNCAyMy44NzM0IDguMzU4MjQgMjMuNTU3NyA4LjI2MDIzTDIyLjAwMzkgNy43NzU5NUMyMS43ODk1IDcuNzA5MDYgMjEuNzg3MyA3LjQwMTc3IDIyLjAwMTEgNy4zMzIwMUwyMy41NDY5IDYuODI0NjZDMjMuODYwOSA2LjcyMTQ2IDI0LjEwNiA2LjQ2OTUyIDI0LjIwMjcgNi4xNTAxMUwyNC42Nzk4IDQuNTc1MDJDMjQuNzQ1OCA0LjM1NzA5IDI1LjA0ODkgNC4zNTQ3NyAyNS4xMTgzIDQuNTcxNTZMMjUuNjE4OCA2LjEzOTE1QzI1LjcyMDYgNi40NTc0IDI1Ljk2ODYgNi43MDUzMSAyNi4yODQyIDYuODAzOUwyNy44MzggNy4yODc2MUMyOC4wNTI0IDcuMzU0NSAyOC4wNTQ3IDcuNjYxNzkgMjcuODQwOCA3LjczMjEzTDI2LjI5NSA4LjIzOTQ4QzI1Ljk4MTEgOC4zNDIxIDI1LjczNiA4LjU5NDA0IDI1LjYzOTMgOC45MTQwMkwyNS4xNjIxIDEwLjQ4ODVDMjUuMDk2MSAxMC43MDY1IDI0Ljc5MyAxMC43MDg4IDI0LjcyMzYgMTAuNDkyWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==",l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iYmxhY2siPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+",h="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0id2hpdGUiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+Cg==";let L$1=class extends T$2{constructor({options:eo}){super(),N$1(this,"_wallet"),N$1(this,"_options"),this._options=eo}available(){return this.ensureWallet(),this._wallet!==void 0}async ready(){return this.ensureWallet(),this._wallet?await this._wallet.isPreauthorized():!1}async chainId(){if(this.ensureWallet(),!this._wallet)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async onAccountsChanged(eo){let to;if(typeof eo=="string"?to=eo:to=eo[0],to){const ro=await this.chainId();this.emit("change",{account:to,chainId:ro})}else this.emit("disconnect")}onNetworkChanged(eo){switch(eo){case"SN_MAIN":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_MAIN)});break;case"SN_GOERLI":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_GOERLI)});break;case"mainnet-alpha":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_MAIN)});break;case"goerli-alpha":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_GOERLI)});break;default:this.emit("change",{});break}}async connect(){if(this.ensureWallet(),!this._wallet)throw new U$2;let eo;try{eo=await this._wallet.enable({starknetVersion:"v5"})}catch{throw new A$2}if(!this._wallet.isConnected||!eo)throw new A$2;this._wallet.on("accountsChanged",async no=>{await this.onAccountsChanged(no)}),this._wallet.on("networkChanged",no=>{this.onNetworkChanged(no)}),await this.onAccountsChanged(eo);const to=this._wallet.account.address,ro=await this.chainId();return this.emit("connect",{account:to,chainId:ro}),{account:to,chainId:ro}}async disconnect(){var eo;if(this.ensureWallet(),q$2(),!this.available())throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1}async account(){if(this.ensureWallet(),!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}get id(){return this._options.id}get name(){if(!this._wallet)throw new P$1;return this._wallet.name}get icon(){var eo;return this._options.icon?this._options.icon:(eo=this._wallet)!=null&&eo.icon?{dark:this._wallet.icon,light:this._wallet.icon}:{dark:h,light:l}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}ensureWallet(){const eo=z$1(globalThis).filter(to=>to.id===this._options.id)[0];if(eo){const{provider:to}=this._options;to&&Object.assign(eo,{provider:to}),this._wallet=eo}}};function z$1(Xr){return Object.values(Object.getOwnPropertyNames(Xr).reduce((eo,to)=>{if(to.startsWith("starknet")){const ro=Xr[to];y$1(ro)&&!eo[ro.id]&&(eo[ro.id]=ro)}return eo},{}))}function y$1(Xr){try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1}var He=Object.defineProperty,qe=(Xr,eo,to)=>eo in Xr?He(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,ae=(Xr,eo,to)=>(qe(Xr,typeof eo!="symbol"?eo+"":eo,to),to),rt=Object.defineProperty,nt=(Xr,eo,to)=>eo in Xr?rt(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,it=(Xr,eo,to)=>(nt(Xr,eo+"",to),to),pe=(Xr,eo,to)=>{if(!eo.has(Xr))throw TypeError("Cannot "+to)},z=(Xr,eo,to)=>(pe(Xr,eo,"read from private field"),to?to.call(Xr):eo.get(Xr)),V=(Xr,eo,to)=>{if(eo.has(Xr))throw TypeError("Cannot add the same private member more than once");eo instanceof WeakSet?eo.add(Xr):eo.set(Xr,to)},ie=(Xr,eo,to,ro)=>(pe(Xr,eo,"write to private field"),eo.set(Xr,to),to),$=(Xr,eo,to)=>(pe(Xr,eo,"access private method"),to);const ot=[{id:"argentX",name:"Argent X",icon:"data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgNDAgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNC43NTgyIC0zLjk3MzY0ZS0wN0gxNC42MjM4QzE0LjI4NTEgLTMuOTczNjRlLTA3IDE0LjAxMzggMC4yODExNzggMTQuMDA2NCAwLjYzMDY4M0MxMy44MDE3IDEwLjQ1NDkgOC44MjIzNCAxOS43NzkyIDAuMjUxODkzIDI2LjM4MzdDLTAuMDIwMjA0NiAyNi41OTMzIC0wLjA4MjE5NDYgMjYuOTg3MiAwLjExNjczNCAyNy4yNzA5TDYuMDQ2MjMgMzUuNzM0QzYuMjQ3OTYgMzYuMDIyIDYuNjQwOTkgMzYuMDg3IDYuOTE3NjYgMzUuODc1NEMxMi4yNzY1IDMxLjc3MjggMTYuNTg2OSAyNi44MjM2IDE5LjY5MSAyMS4zMzhDMjIuNzk1MSAyNi44MjM2IDI3LjEwNTcgMzEuNzcyOCAzMi40NjQ2IDM1Ljg3NTRDMzIuNzQxIDM2LjA4NyAzMy4xMzQxIDM2LjAyMiAzMy4zMzYxIDM1LjczNEwzOS4yNjU2IDI3LjI3MDlDMzkuNDY0MiAyNi45ODcyIDM5LjQwMjIgMjYuNTkzMyAzOS4xMzA0IDI2LjM4MzdDMzAuNTU5NyAxOS43NzkyIDI1LjU4MDQgMTAuNDU0OSAyNS4zNzU5IDAuNjMwNjgzQzI1LjM2ODUgMC4yODExNzggMjUuMDk2OSAtMy45NzM2NGUtMDcgMjQuNzU4MiAtMy45NzM2NGUtMDdaIiBmaWxsPSIjRkY4NzVCIi8+Cjwvc3ZnPgo=",downloads:{chrome:"https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb",firefox:"https://addons.mozilla.org/en-US/firefox/addon/argent-x"}},{id:"braavos",name:"Braavos",icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aAogICAgICAgIGQ9Ik02Mi43MDUgMTMuOTExNkM2Mi44MzU5IDE0LjEzMzMgNjIuNjYyMSAxNC40MDcgNjIuNDAzOSAxNC40MDdDNTcuMTgwNyAxNC40MDcgNTIuOTM0OCAxOC41NDI3IDUyLjgzNTEgMjMuNjgxN0M1MS4wNDY1IDIzLjM0NzcgNDkuMTkzMyAyMy4zMjI2IDQ3LjM2MjYgMjMuNjMxMUM0Ny4yMzYxIDE4LjUxNTYgNDMuMDAwOSAxNC40MDcgMzcuNzk0OCAxNC40MDdDMzcuNTM2NSAxNC40MDcgMzcuMzYyNSAxNC4xMzMxIDM3LjQ5MzUgMTMuOTExMkM0MC4wMjE3IDkuNjI4MDkgNDQuNzIwNCA2Ljc1IDUwLjA5OTEgNi43NUM1NS40NzgxIDYuNzUgNjAuMTc2OSA5LjYyODI2IDYyLjcwNSAxMy45MTE2WiIKICAgICAgICBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfMzcyXzQwMjU5KSIgLz4KICAgIDxwYXRoCiAgICAgICAgZD0iTTc4Ljc2MDYgNDUuODcxOEM4MC4yNzI1IDQ2LjMyOTcgODEuNzAyNSA0NS4wMDU1IDgxLjE3MTQgNDMuNTIyMkM3Ni40MTM3IDMwLjIzMzQgNjEuMzkxMSAyNC44MDM5IDUwLjAyNzcgMjQuODAzOUMzOC42NDQyIDI0LjgwMzkgMjMuMjg2OCAzMC40MDcgMTguODc1NCA0My41OTEyQzE4LjM4MjQgNDUuMDY0NSAxOS44MDgzIDQ2LjM0NDYgMjEuMjk3OCA0NS44ODgxTDQ4Ljg3MiAzNy40MzgxQzQ5LjUzMzEgMzcuMjM1NSA1MC4yMzk5IDM3LjIzNDQgNTAuOTAxNyAzNy40MzQ4TDc4Ljc2MDYgNDUuODcxOFoiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8cGF0aAogICAgICAgIGQ9Ik0xOC44MTMyIDQ4LjE3MDdMNDguODkzNSAzOS4wNDcyQzQ5LjU1MDYgMzguODQ3OCA1MC4yNTI0IDM4Ljg0NzMgNTAuOTA5OCAzOS4wNDU2TDgxLjE3ODEgNDguMTc1MkM4My42OTEyIDQ4LjkzMzIgODUuNDExIDUxLjI0ODMgODUuNDExIDUzLjg3MzVWODEuMjIzM0M4NS4yOTQ0IDg3Ljg5OTEgNzkuMjk3NyA5My4yNSA3Mi42MjQ1IDkzLjI1SDYxLjU0MDZDNjAuNDQ0OSA5My4yNSA1OS41NTc3IDkyLjM2MzcgNTkuNTU3NyA5MS4yNjhWODEuNjc4OUM1OS41NTc3IDc3LjkwMzEgNjEuNzkyMSA3NC40ODU1IDY1LjI0OTggNzIuOTcyOUM2OS44ODQ5IDcwLjk0NTQgNzUuMzY4MSA2OC4yMDI4IDc2LjM5OTQgNjIuNjk5MkM3Ni43MzIzIDYwLjkyMjkgNzUuNTc0MSA1OS4yMDk0IDczLjgwMjQgNTguODU3M0M2OS4zMjI2IDU3Ljk2NjcgNjQuMzU2MiA1OC4zMTA3IDYwLjE1NjQgNjAuMTg5M0M1NS4zODg3IDYyLjMyMTkgNTQuMTQxNSA2NS44Njk0IDUzLjY3OTcgNzAuNjMzN0w1My4xMjAxIDc1Ljc2NjJDNTIuOTQ5MSA3Ny4zMzQ5IDUxLjQ3ODUgNzguNTM2NiA0OS45MDE0IDc4LjUzNjZDNDguMjY5OSA3OC41MzY2IDQ3LjA0NjUgNzcuMjk0IDQ2Ljg2OTYgNzUuNjcxMkw0Ni4zMjA0IDcwLjYzMzdDNDUuOTI0OSA2Ni41NTI5IDQ1LjIwNzkgNjIuNTg4NyA0MC45ODk1IDYwLjcwMThDMzYuMTc3NiA1OC41NDk0IDMxLjM0MTkgNTcuODM0NyAyNi4xOTc2IDU4Ljg1NzNDMjQuNDI2IDU5LjIwOTQgMjMuMjY3OCA2MC45MjI5IDIzLjYwMDcgNjIuNjk5MkMyNC42NDEgNjguMjUwNyAzMC4wODEyIDcwLjkzMDUgMzQuNzUwMyA3Mi45NzI5QzM4LjIwOCA3NC40ODU1IDQwLjQ0MjQgNzcuOTAzMSA0MC40NDI0IDgxLjY3ODlWOTEuMjY2M0M0MC40NDI0IDkyLjM2MiAzOS41NTU1IDkzLjI1IDM4LjQ1OTkgOTMuMjVIMjcuMzc1NkMyMC43MDI0IDkzLjI1IDE0LjcwNTcgODcuODk5MSAxNC41ODkxIDgxLjIyMzNWNTMuODY2M0MxNC41ODkxIDUxLjI0NDYgMTYuMzA0NSA0OC45MzE2IDE4LjgxMzIgNDguMTcwN1oiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDJfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMzcyXzQwMjU5IiB4MT0iNDkuMzA1NyIgeTE9IjIuMDc5IiB4Mj0iODAuMzYyNyIgeTI9IjkzLjY1OTciCiAgICAgICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIgLz4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY5NjAwIiAvPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzM3Ml80MDI1OSIgeDE9IjQ5LjMwNTciIHkxPSIyLjA3OSIgeDI9IjgwLjM2MjciIHkyPSI5My42NTk3IgogICAgICAgICAgICBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGNUQ0NUUiIC8+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0ZGOTYwMCIgLz4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQyX2xpbmVhcl8zNzJfNDAyNTkiIHgxPSI0OS4zMDU3IiB5MT0iMi4wNzkiIHgyPSI4MC4zNjI3IiB5Mj0iOTMuNjU5NyIKICAgICAgICAgICAgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjVENDVFIiAvPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiIC8+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KPC9zdmc+",downloads:{chrome:"https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",firefox:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet",edge:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc"}}],st=()=>`${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,ye=Xr=>{for(let eo=Xr.length-1;eo>0;eo--){const to=Math.floor(Math.random()*(eo+1));[Xr[eo],Xr[to]]=[Xr[to],Xr[eo]]}return Xr};function ce(...Xr){return eo=>Xr.reduce((to,ro)=>to.then(ro),Promise.resolve(eo))}var W,S,H,we,_e,X,te;class at{constructor(eo){V(this,we),V(this,X),V(this,W,!1),V(this,S,void 0),V(this,H,void 0),it(this,"value"),ie(this,H,eo),$(this,X,te).call(this)}set(eo){return!z(this,W)&&!$(this,X,te).call(this)?!1:(this.delete(),this.value=eo,eo&&(ie(this,S,`${z(this,H)}-${st()}`),localStorage.setItem(z(this,S),eo)),!0)}get(){return $(this,we,_e).call(this),this.value}delete(){return!z(this,W)&&!$(this,X,te).call(this)?!1:(this.value=null,z(this,S)&&localStorage.removeItem(z(this,S)),!0)}}W=new WeakMap,S=new WeakMap,H=new WeakMap,we=new WeakSet,_e=function(){this.value&&this.set(this.value)},X=new WeakSet,te=function(){try{!z(this,W)&&typeof window<"u"&&(ie(this,S,Object.keys(localStorage).find(Xr=>Xr.startsWith(z(this,H)))),ie(this,W,!0),z(this,S)&&this.set(localStorage.getItem(z(this,S))))}catch(Xr){console.warn(Xr)}return z(this,W)};function le(Xr,eo){var to,ro;if((to=eo==null?void 0:eo.include)!=null&&to.length){const no=new Set(eo.include);return Xr.filter(io=>no.has(io.id))}if((ro=eo==null?void 0:eo.exclude)!=null&&ro.length){const no=new Set(eo.exclude);return Xr.filter(io=>!no.has(io.id))}return Xr}const ve=async Xr=>{const eo=await Promise.all(Xr.map(to=>to.isPreauthorized().catch(()=>!1)));return Xr.filter((to,ro)=>eo[ro])},ct=Xr=>{try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1};function de(Xr,eo){return Object.values(Object.getOwnPropertyNames(Xr).reduce((to,ro)=>{if(ro.startsWith("starknet")){const no=Xr[ro];eo(no)&&!to[no.id]&&(to[no.id]=no)}return to},{}))}const ue=(Xr,eo)=>{if(eo&&Array.isArray(eo)){Xr.sort((ro,no)=>eo.indexOf(ro.id)-eo.indexOf(no.id));const to=Xr.length-eo.length;return[...Xr.slice(to),...ye(Xr.slice(0,to))]}else return ye(Xr)},lt=typeof window<"u"?window:{},dt={windowObject:lt,isWalletObject:ct,storageFactoryImplementation:Xr=>new at(Xr)};function ut(Xr={}){const{storageFactoryImplementation:eo,windowObject:to,isWalletObject:ro}={...dt,...Xr},no=eo("gsw-last");return{getAvailableWallets:async(io={})=>{const oo=de(to,ro);return ce(ao=>le(ao,io),ao=>ue(ao,io.sort))(oo)},getPreAuthorizedWallets:async(io={})=>{const oo=de(to,ro);return ce(ao=>ve(ao),ao=>le(ao,io),ao=>ue(ao,io.sort))(oo)},getDiscoveryWallets:async(io={})=>ce(oo=>le(oo,io),oo=>ue(oo,io.sort))(ot),getLastConnectedWallet:async()=>{const io=no.get(),oo=de(to,ro).find(so=>so.id===io),[ao]=await ve(oo?[oo]:[]);return ao||(no.delete(),null)},enable:async(io,oo)=>{if(await io.enable(oo??{starknetVersion:"v5"}),!io.isConnected)throw new Error("Failed to connect to wallet");return no.set(io.id),io},disconnect:async({clearLastWallet:io}={})=>{io&&no.delete()}}}const re=ut(),gt={"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"},Le={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"},N={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},j={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"},L={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class o{static getFirstMatch(eo,to){const ro=to.match(eo);return ro&&ro.length>0&&ro[1]||""}static getSecondMatch(eo,to){const ro=to.match(eo);return ro&&ro.length>1&&ro[2]||""}static matchAndReturnConst(eo,to,ro){if(eo.test(to))return ro}static getWindowsVersionName(eo){switch(eo){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";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}}static getMacOSVersionName(eo){const to=eo.split(".").splice(0,2).map(ro=>parseInt(ro,10)||0);if(to.push(0),to[0]===10)switch(to[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(eo){const to=eo.split(".").splice(0,2).map(ro=>parseInt(ro,10)||0);if(to.push(0),!(to[0]===1&&to[1]<5)){if(to[0]===1&&to[1]<6)return"Cupcake";if(to[0]===1&&to[1]>=6)return"Donut";if(to[0]===2&&to[1]<2)return"Eclair";if(to[0]===2&&to[1]===2)return"Froyo";if(to[0]===2&&to[1]>2)return"Gingerbread";if(to[0]===3)return"Honeycomb";if(to[0]===4&&to[1]<1)return"Ice Cream Sandwich";if(to[0]===4&&to[1]<4)return"Jelly Bean";if(to[0]===4&&to[1]>=4)return"KitKat";if(to[0]===5)return"Lollipop";if(to[0]===6)return"Marshmallow";if(to[0]===7)return"Nougat";if(to[0]===8)return"Oreo";if(to[0]===9)return"Pie"}}static getVersionPrecision(eo){return eo.split(".").length}static compareVersions(eo,to,ro=!1){const no=o.getVersionPrecision(eo),io=o.getVersionPrecision(to);let oo=Math.max(no,io),ao=0;const so=o.map([eo,to],co=>{const lo=oo-o.getVersionPrecision(co),fo=co+new Array(lo+1).join(".0");return o.map(fo.split("."),ho=>new Array(20-ho.length).join("0")+ho).reverse()});for(ro&&(ao=oo-Math.min(no,io)),oo-=1;oo>=ao;){if(so[0][oo]>so[1][oo])return 1;if(so[0][oo]===so[1][oo]){if(oo===ao)return 0;oo-=1}else if(so[0][oo]{ro[ao]=oo[ao]})}return eo}static getBrowserAlias(eo){return gt[eo]}static getBrowserTypeByAlias(eo){return Le[eo]||""}}const M=/version\/(\d+(\.?_?\d+)+)/i,ft=[{test:[/googlebot/i],describe(Xr){const eo={name:"Googlebot"},to=o.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/opera/i],describe(Xr){const eo={name:"Opera"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/opr\/|opios/i],describe(Xr){const eo={name:"Opera"},to=o.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/SamsungBrowser/i],describe(Xr){const eo={name:"Samsung Internet for Android"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/Whale/i],describe(Xr){const eo={name:"NAVER Whale Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/MZBrowser/i],describe(Xr){const eo={name:"MZ Browser"},to=o.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/focus/i],describe(Xr){const eo={name:"Focus"},to=o.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/swing/i],describe(Xr){const eo={name:"Swing"},to=o.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/coast/i],describe(Xr){const eo={name:"Opera Coast"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(Xr){const eo={name:"Opera Touch"},to=o.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/yabrowser/i],describe(Xr){const eo={name:"Yandex Browser"},to=o.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/ucbrowser/i],describe(Xr){const eo={name:"UC Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/Maxthon|mxios/i],describe(Xr){const eo={name:"Maxthon"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/epiphany/i],describe(Xr){const eo={name:"Epiphany"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/puffin/i],describe(Xr){const eo={name:"Puffin"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/sleipnir/i],describe(Xr){const eo={name:"Sleipnir"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/k-meleon/i],describe(Xr){const eo={name:"K-Meleon"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/micromessenger/i],describe(Xr){const eo={name:"WeChat"},to=o.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/qqbrowser/i],describe(Xr){const eo={name:/qqbrowserlite/i.test(Xr)?"QQ Browser Lite":"QQ Browser"},to=o.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/msie|trident/i],describe(Xr){const eo={name:"Internet Explorer"},to=o.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/\sedg\//i],describe(Xr){const eo={name:"Microsoft Edge"},to=o.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/edg([ea]|ios)/i],describe(Xr){const eo={name:"Microsoft Edge"},to=o.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/vivaldi/i],describe(Xr){const eo={name:"Vivaldi"},to=o.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/seamonkey/i],describe(Xr){const eo={name:"SeaMonkey"},to=o.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/sailfish/i],describe(Xr){const eo={name:"Sailfish"},to=o.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,Xr);return to&&(eo.version=to),eo}},{test:[/silk/i],describe(Xr){const eo={name:"Amazon Silk"},to=o.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/phantom/i],describe(Xr){const eo={name:"PhantomJS"},to=o.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/slimerjs/i],describe(Xr){const eo={name:"SlimerJS"},to=o.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(Xr){const eo={name:"BlackBerry"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/(web|hpw)[o0]s/i],describe(Xr){const eo={name:"WebOS Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/bada/i],describe(Xr){const eo={name:"Bada"},to=o.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/tizen/i],describe(Xr){const eo={name:"Tizen"},to=o.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/qupzilla/i],describe(Xr){const eo={name:"QupZilla"},to=o.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/firefox|iceweasel|fxios/i],describe(Xr){const eo={name:"Firefox"},to=o.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/electron/i],describe(Xr){const eo={name:"Electron"},to=o.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/MiuiBrowser/i],describe(Xr){const eo={name:"Miui"},to=o.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/chromium/i],describe(Xr){const eo={name:"Chromium"},to=o.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/chrome|crios|crmo/i],describe(Xr){const eo={name:"Chrome"},to=o.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/GSA/i],describe(Xr){const eo={name:"Google Search"},to=o.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){const eo=!Xr.test(/like android/i),to=Xr.test(/android/i);return eo&&to},describe(Xr){const eo={name:"Android Browser"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/playstation 4/i],describe(Xr){const eo={name:"PlayStation 4"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/safari|applewebkit/i],describe(Xr){const eo={name:"Safari"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/.*/i],describe(Xr){const eo=/^(.*)\/(.*) /,to=/^(.*)\/(.*)[ \t]\((.*)/,ro=Xr.search("\\(")!==-1?to:eo;return{name:o.getFirstMatch(ro,Xr),version:o.getSecondMatch(ro,Xr)}}}],wt=[{test:[/Roku\/DVP/],describe(Xr){const eo=o.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,Xr);return{name:j.Roku,version:eo}}},{test:[/windows phone/i],describe(Xr){const eo=o.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,Xr);return{name:j.WindowsPhone,version:eo}}},{test:[/windows /i],describe(Xr){const eo=o.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,Xr),to=o.getWindowsVersionName(eo);return{name:j.Windows,version:eo,versionName:to}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(Xr){const eo={name:j.iOS},to=o.getSecondMatch(/(Version\/)(\d[\d.]+)/,Xr);return to&&(eo.version=to),eo}},{test:[/macintosh/i],describe(Xr){const eo=o.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,Xr).replace(/[_\s]/g,"."),to=o.getMacOSVersionName(eo),ro={name:j.MacOS,version:eo};return to&&(ro.versionName=to),ro}},{test:[/(ipod|iphone|ipad)/i],describe(Xr){const eo=o.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,Xr).replace(/[_\s]/g,".");return{name:j.iOS,version:eo}}},{test(Xr){const eo=!Xr.test(/like android/i),to=Xr.test(/android/i);return eo&&to},describe(Xr){const eo=o.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,Xr),to=o.getAndroidVersionName(eo),ro={name:j.Android,version:eo};return to&&(ro.versionName=to),ro}},{test:[/(web|hpw)[o0]s/i],describe(Xr){const eo=o.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,Xr),to={name:j.WebOS};return eo&&eo.length&&(to.version=eo),to}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(Xr){const eo=o.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,Xr)||o.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,Xr)||o.getFirstMatch(/\bbb(\d+)/i,Xr);return{name:j.BlackBerry,version:eo}}},{test:[/bada/i],describe(Xr){const eo=o.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,Xr);return{name:j.Bada,version:eo}}},{test:[/tizen/i],describe(Xr){const eo=o.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,Xr);return{name:j.Tizen,version:eo}}},{test:[/linux/i],describe(){return{name:j.Linux}}},{test:[/CrOS/],describe(){return{name:j.ChromeOS}}},{test:[/PlayStation 4/],describe(Xr){const eo=o.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,Xr);return{name:j.PlayStation4,version:eo}}}],ht=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(Xr){const eo=o.getFirstMatch(/(can-l01)/i,Xr)&&"Nova",to={type:N.mobile,vendor:"Huawei"};return eo&&(to.model=eo),to}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:N.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:N.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:N.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:N.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:N.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:N.tablet}}},{test(Xr){const eo=Xr.test(/ipod|iphone/i),to=Xr.test(/like (ipod|iphone)/i);return eo&&!to},describe(Xr){const eo=o.getFirstMatch(/(ipod|iphone)/i,Xr);return{type:N.mobile,vendor:"Apple",model:eo}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:N.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:N.mobile}}},{test(Xr){return Xr.getBrowserName(!0)==="blackberry"},describe(){return{type:N.mobile,vendor:"BlackBerry"}}},{test(Xr){return Xr.getBrowserName(!0)==="bada"},describe(){return{type:N.mobile}}},{test(Xr){return Xr.getBrowserName()==="windows phone"},describe(){return{type:N.mobile,vendor:"Microsoft"}}},{test(Xr){const eo=Number(String(Xr.getOSVersion()).split(".")[0]);return Xr.getOSName(!0)==="android"&&eo>=3},describe(){return{type:N.tablet}}},{test(Xr){return Xr.getOSName(!0)==="android"},describe(){return{type:N.mobile}}},{test(Xr){return Xr.getOSName(!0)==="macos"},describe(){return{type:N.desktop,vendor:"Apple"}}},{test(Xr){return Xr.getOSName(!0)==="windows"},describe(){return{type:N.desktop}}},{test(Xr){return Xr.getOSName(!0)==="linux"},describe(){return{type:N.desktop}}},{test(Xr){return Xr.getOSName(!0)==="playstation 4"},describe(){return{type:N.tv}}},{test(Xr){return Xr.getOSName(!0)==="roku"},describe(){return{type:N.tv}}}],bt=[{test(Xr){return Xr.getBrowserName(!0)==="microsoft edge"},describe(Xr){if(/\sedg\//i.test(Xr))return{name:L.Blink};const eo=o.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,Xr);return{name:L.EdgeHTML,version:eo}}},{test:[/trident/i],describe(Xr){const eo={name:L.Trident},to=o.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){return Xr.test(/presto/i)},describe(Xr){const eo={name:L.Presto},to=o.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){const eo=Xr.test(/gecko/i),to=Xr.test(/like gecko/i);return eo&&!to},describe(Xr){const eo={name:L.Gecko},to=o.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:L.Blink}}},{test:[/(apple)?webkit/i],describe(Xr){const eo={name:L.WebKit},to=o.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}}];class ke{constructor(eo,to=!1){if(eo==null||eo==="")throw new Error("UserAgent parameter can't be empty");this._ua=eo,this.parsedResult={},to!==!0&&this.parse()}getUA(){return this._ua}test(eo){return eo.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const eo=o.find(ft,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.browser=eo.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(eo){return eo?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const eo=o.find(wt,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.os=eo.describe(this.getUA())),this.parsedResult.os}getOSName(eo){const{name:to}=this.getOS();return eo?String(to).toLowerCase()||"":to||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(eo=!1){const{type:to}=this.getPlatform();return eo?String(to).toLowerCase()||"":to||""}parsePlatform(){this.parsedResult.platform={};const eo=o.find(ht,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.platform=eo.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(eo){return eo?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const eo=o.find(bt,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.engine=eo.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return o.assign({},this.parsedResult)}satisfies(eo){const to={};let ro=0;const no={};let io=0;if(Object.keys(eo).forEach(oo=>{const ao=eo[oo];typeof ao=="string"?(no[oo]=ao,io+=1):typeof ao=="object"&&(to[oo]=ao,ro+=1)}),ro>0){const oo=Object.keys(to),ao=o.find(oo,co=>this.isOS(co));if(ao){const co=this.satisfies(to[ao]);if(co!==void 0)return co}const so=o.find(oo,co=>this.isPlatform(co));if(so){const co=this.satisfies(to[so]);if(co!==void 0)return co}}if(io>0){const oo=Object.keys(no),ao=o.find(oo,so=>this.isBrowser(so,!0));if(ao!==void 0)return this.compareVersion(no[ao])}}isBrowser(eo,to=!1){const ro=this.getBrowserName().toLowerCase();let no=eo.toLowerCase();const io=o.getBrowserTypeByAlias(no);return to&&io&&(no=io.toLowerCase()),no===ro}compareVersion(eo){let to=[0],ro=eo,no=!1;const io=this.getBrowserVersion();if(typeof io=="string")return eo[0]===">"||eo[0]==="<"?(ro=eo.substr(1),eo[1]==="="?(no=!0,ro=eo.substr(2)):to=[],eo[0]===">"?to.push(1):to.push(-1)):eo[0]==="="?ro=eo.substr(1):eo[0]==="~"&&(no=!0,ro=eo.substr(1)),to.indexOf(o.compareVersions(io,ro,no))>-1}isOS(eo){return this.getOSName(!0)===String(eo).toLowerCase()}isPlatform(eo){return this.getPlatformType(!0)===String(eo).toLowerCase()}isEngine(eo){return this.getEngineName(!0)===String(eo).toLowerCase()}is(eo,to=!1){return this.isBrowser(eo,to)||this.isOS(eo)||this.isPlatform(eo)}some(eo=[]){return eo.some(to=>this.is(to))}}/*! + `,R$1=()=>Object.keys(localStorage).some(Xr=>Xr==="walletconnect"||Xr.startsWith("wc@2:")),_$1=()=>{if(R$1()){delete localStorage.walletconnect;for(const Xr in localStorage)Xr.startsWith("wc@2:")&&delete localStorage[Xr]}},j$2=()=>{var Xr;return window!=null&&window.starknet_argentX?(Xr=window==null?void 0:window.starknet_argentX)==null?void 0:Xr.isInAppBrowser:!1};let O$1=class extends T$2{constructor(eo={}){super(),l$1(this,"_wallet",null),l$1(this,"_options"),this._options=eo}available(){return!0}async ready(){return await this.ensureWallet(),this._wallet?this._wallet.isPreauthorized():!1}get id(){return"argentMobile"}get name(){return"Argent (mobile)"}get icon(){return{dark:u,light:u}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}async connect(){if(await this.ensureWallet(),!this._wallet)throw new U$2;const eo=this._wallet.account,to=await this.chainId();return{account:eo.address,chainId:to}}async disconnect(){var eo;if(await this._wallet.disable(),_$1(),!this.available()&&!this._wallet)throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1;this._wallet=null}async account(){if(!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}async chainId(){if(!this._wallet||!this.wallet.account||!this._wallet.provider)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async initEventListener(eo){if(!this._wallet)throw new P$1;this._wallet.on("accountsChanged",eo)}async removeEventListener(eo){if(!this._wallet)throw new P$1;this._wallet.off("accountsChanged",eo),this._wallet=null}async ensureWallet(){const{getStarknetWindowObject:eo}=await __vitePreload(async()=>{const{getStarknetWindowObject:wo}=await import("./index-8e228000-VDftQdqf.js");return{getStarknetWindowObject:wo}},[]),{chainId:to,projectId:ro,dappName:no,description:io,url:oo,icons:ao,provider:so,rpcUrl:co}=this._options,lo=s(),uo=co??(!to||to===constants_exports.NetworkName.SN_MAIN?lo.mainnet:lo.testnet),ho={chainId:to??constants_exports.NetworkName.SN_MAIN,name:no,projectId:ro??d$1,description:io,url:oo,icons:ao,provider:so,rpcUrl:uo};ro===d$1&&(console.log("========= NOTICE ========="),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys."),console.log("Go to WalletConnect Cloud (https://cloud.walletconnect.com) and create a new account."),console.log("Once your account is created, create a new project and collect the Project ID"),console.log("=========================="));const go=await eo(ho);if(!go)throw new A$2;this._wallet=go;const bo=this._wallet;await bo.enable(),bo.client.on("session_delete",()=>{_$1(),this._wallet=null,q$2(),document.dispatchEvent(new Event("wallet_disconnected"))})}};var g=Object.defineProperty,j$1=(Xr,eo,to)=>eo in Xr?g(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,N$1=(Xr,eo,to)=>(j$1(Xr,typeof eo!="symbol"?eo+"":eo,to),to);const d="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iOCIgZmlsbD0iYmxhY2siLz4KPHBhdGggZD0iTTE4LjQwMTggNy41NTU1NkgxMy41OTgyQzEzLjQzNzcgNy41NTU1NiAxMy4zMDkxIDcuNjg3NDcgMTMuMzA1NiA3Ljg1MTQzQzEzLjIwODUgMTIuNDYwMyAxMC44NDg0IDE2LjgzNDcgNi43ODYwOCAxOS45MzMxQzYuNjU3MTEgMjAuMDMxNCA2LjYyNzczIDIwLjIxNjIgNi43MjIwMiAyMC4zNDkzTDkuNTMyNTMgMjQuMzE5NkM5LjYyODE1IDI0LjQ1NDggOS44MTQ0NCAyNC40ODUzIDkuOTQ1NTggMjQuMzg2QzEyLjQ4NTYgMjIuNDYxMyAxNC41Mjg3IDIwLjEzOTUgMTYgMTcuNTY2QzE3LjQ3MTMgMjAuMTM5NSAxOS41MTQ1IDIyLjQ2MTMgMjIuMDU0NSAyNC4zODZDMjIuMTg1NiAyNC40ODUzIDIyLjM3MTkgMjQuNDU0OCAyMi40Njc2IDI0LjMxOTZMMjUuMjc4MSAyMC4zNDkzQzI1LjM3MjMgMjAuMjE2MiAyNS4zNDI5IDIwLjAzMTQgMjUuMjE0IDE5LjkzMzFDMjEuMTUxNiAxNi44MzQ3IDE4Ljc5MTUgMTIuNDYwMyAxOC42OTQ2IDcuODUxNDNDMTguNjkxMSA3LjY4NzQ3IDE4LjU2MjMgNy41NTU1NiAxOC40MDE4IDcuNTU1NTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMjQuNzIzNiAxMC40OTJMMjQuMjIzMSA4LjkyNDM5QzI0LjEyMTMgOC42MDYxNCAyMy44NzM0IDguMzU4MjQgMjMuNTU3NyA4LjI2MDIzTDIyLjAwMzkgNy43NzU5NUMyMS43ODk1IDcuNzA5MDYgMjEuNzg3MyA3LjQwMTc3IDIyLjAwMTEgNy4zMzIwMUwyMy41NDY5IDYuODI0NjZDMjMuODYwOSA2LjcyMTQ2IDI0LjEwNiA2LjQ2OTUyIDI0LjIwMjcgNi4xNTAxMUwyNC42Nzk4IDQuNTc1MDJDMjQuNzQ1OCA0LjM1NzA5IDI1LjA0ODkgNC4zNTQ3NyAyNS4xMTgzIDQuNTcxNTZMMjUuNjE4OCA2LjEzOTE1QzI1LjcyMDYgNi40NTc0IDI1Ljk2ODYgNi43MDUzMSAyNi4yODQyIDYuODAzOUwyNy44MzggNy4yODc2MUMyOC4wNTI0IDcuMzU0NSAyOC4wNTQ3IDcuNjYxNzkgMjcuODQwOCA3LjczMjEzTDI2LjI5NSA4LjIzOTQ4QzI1Ljk4MTEgOC4zNDIxIDI1LjczNiA4LjU5NDA0IDI1LjYzOTMgOC45MTQwMkwyNS4xNjIxIDEwLjQ4ODVDMjUuMDk2MSAxMC43MDY1IDI0Ljc5MyAxMC43MDg4IDI0LjcyMzYgMTAuNDkyWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==",l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iYmxhY2siPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+",h="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0id2hpdGUiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+Cg==";let L$1=class extends T$2{constructor({options:eo}){super(),N$1(this,"_wallet"),N$1(this,"_options"),this._options=eo}available(){return this.ensureWallet(),this._wallet!==void 0}async ready(){return this.ensureWallet(),this._wallet?await this._wallet.isPreauthorized():!1}async chainId(){if(this.ensureWallet(),!this._wallet)throw new P$1;const eo=await this._wallet.provider.getChainId();return BigInt(eo)}async onAccountsChanged(eo){let to;if(typeof eo=="string"?to=eo:to=eo[0],to){const ro=await this.chainId();this.emit("change",{account:to,chainId:ro})}else this.emit("disconnect")}onNetworkChanged(eo){switch(eo){case"SN_MAIN":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_MAIN)});break;case"SN_GOERLI":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_GOERLI)});break;case"mainnet-alpha":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_MAIN)});break;case"goerli-alpha":this.emit("change",{chainId:BigInt(constants_exports.StarknetChainId.SN_GOERLI)});break;default:this.emit("change",{});break}}async connect(){if(this.ensureWallet(),!this._wallet)throw new U$2;let eo;try{eo=await this._wallet.enable({starknetVersion:"v5"})}catch{throw new A$2}if(!this._wallet.isConnected||!eo)throw new A$2;this._wallet.on("accountsChanged",async no=>{await this.onAccountsChanged(no)}),this._wallet.on("networkChanged",no=>{this.onNetworkChanged(no)}),await this.onAccountsChanged(eo);const to=this._wallet.account.address,ro=await this.chainId();return this.emit("connect",{account:to,chainId:ro}),{account:to,chainId:ro}}async disconnect(){var eo;if(this.ensureWallet(),q$2(),!this.available())throw new U$2;if(!((eo=this._wallet)!=null&&eo.isConnected))throw new S$1}async account(){if(this.ensureWallet(),!this._wallet||!this._wallet.account)throw new P$1;return this._wallet.account}get id(){return this._options.id}get name(){if(!this._wallet)throw new P$1;return this._wallet.name}get icon(){var eo;return this._options.icon?this._options.icon:(eo=this._wallet)!=null&&eo.icon?{dark:this._wallet.icon,light:this._wallet.icon}:{dark:h,light:l}}get wallet(){if(!this._wallet)throw new P$1;return this._wallet}ensureWallet(){const eo=z$1(globalThis).filter(to=>to.id===this._options.id)[0];if(eo){const{provider:to}=this._options;to&&Object.assign(eo,{provider:to}),this._wallet=eo}}};function z$1(Xr){return Object.values(Object.getOwnPropertyNames(Xr).reduce((eo,to)=>{if(to.startsWith("starknet")){const ro=Xr[to];y$1(ro)&&!eo[ro.id]&&(eo[ro.id]=ro)}return eo},{}))}function y$1(Xr){try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1}var He=Object.defineProperty,qe=(Xr,eo,to)=>eo in Xr?He(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,ae=(Xr,eo,to)=>(qe(Xr,typeof eo!="symbol"?eo+"":eo,to),to),rt=Object.defineProperty,nt=(Xr,eo,to)=>eo in Xr?rt(Xr,eo,{enumerable:!0,configurable:!0,writable:!0,value:to}):Xr[eo]=to,it=(Xr,eo,to)=>(nt(Xr,eo+"",to),to),pe=(Xr,eo,to)=>{if(!eo.has(Xr))throw TypeError("Cannot "+to)},z=(Xr,eo,to)=>(pe(Xr,eo,"read from private field"),to?to.call(Xr):eo.get(Xr)),V=(Xr,eo,to)=>{if(eo.has(Xr))throw TypeError("Cannot add the same private member more than once");eo instanceof WeakSet?eo.add(Xr):eo.set(Xr,to)},ie=(Xr,eo,to,ro)=>(pe(Xr,eo,"write to private field"),eo.set(Xr,to),to),$=(Xr,eo,to)=>(pe(Xr,eo,"access private method"),to);const ot=[{id:"argentX",name:"Argent X",icon:"data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgNDAgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNC43NTgyIC0zLjk3MzY0ZS0wN0gxNC42MjM4QzE0LjI4NTEgLTMuOTczNjRlLTA3IDE0LjAxMzggMC4yODExNzggMTQuMDA2NCAwLjYzMDY4M0MxMy44MDE3IDEwLjQ1NDkgOC44MjIzNCAxOS43NzkyIDAuMjUxODkzIDI2LjM4MzdDLTAuMDIwMjA0NiAyNi41OTMzIC0wLjA4MjE5NDYgMjYuOTg3MiAwLjExNjczNCAyNy4yNzA5TDYuMDQ2MjMgMzUuNzM0QzYuMjQ3OTYgMzYuMDIyIDYuNjQwOTkgMzYuMDg3IDYuOTE3NjYgMzUuODc1NEMxMi4yNzY1IDMxLjc3MjggMTYuNTg2OSAyNi44MjM2IDE5LjY5MSAyMS4zMzhDMjIuNzk1MSAyNi44MjM2IDI3LjEwNTcgMzEuNzcyOCAzMi40NjQ2IDM1Ljg3NTRDMzIuNzQxIDM2LjA4NyAzMy4xMzQxIDM2LjAyMiAzMy4zMzYxIDM1LjczNEwzOS4yNjU2IDI3LjI3MDlDMzkuNDY0MiAyNi45ODcyIDM5LjQwMjIgMjYuNTkzMyAzOS4xMzA0IDI2LjM4MzdDMzAuNTU5NyAxOS43NzkyIDI1LjU4MDQgMTAuNDU0OSAyNS4zNzU5IDAuNjMwNjgzQzI1LjM2ODUgMC4yODExNzggMjUuMDk2OSAtMy45NzM2NGUtMDcgMjQuNzU4MiAtMy45NzM2NGUtMDdaIiBmaWxsPSIjRkY4NzVCIi8+Cjwvc3ZnPgo=",downloads:{chrome:"https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb",firefox:"https://addons.mozilla.org/en-US/firefox/addon/argent-x"}},{id:"braavos",name:"Braavos",icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aAogICAgICAgIGQ9Ik02Mi43MDUgMTMuOTExNkM2Mi44MzU5IDE0LjEzMzMgNjIuNjYyMSAxNC40MDcgNjIuNDAzOSAxNC40MDdDNTcuMTgwNyAxNC40MDcgNTIuOTM0OCAxOC41NDI3IDUyLjgzNTEgMjMuNjgxN0M1MS4wNDY1IDIzLjM0NzcgNDkuMTkzMyAyMy4zMjI2IDQ3LjM2MjYgMjMuNjMxMUM0Ny4yMzYxIDE4LjUxNTYgNDMuMDAwOSAxNC40MDcgMzcuNzk0OCAxNC40MDdDMzcuNTM2NSAxNC40MDcgMzcuMzYyNSAxNC4xMzMxIDM3LjQ5MzUgMTMuOTExMkM0MC4wMjE3IDkuNjI4MDkgNDQuNzIwNCA2Ljc1IDUwLjA5OTEgNi43NUM1NS40NzgxIDYuNzUgNjAuMTc2OSA5LjYyODI2IDYyLjcwNSAxMy45MTE2WiIKICAgICAgICBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfMzcyXzQwMjU5KSIgLz4KICAgIDxwYXRoCiAgICAgICAgZD0iTTc4Ljc2MDYgNDUuODcxOEM4MC4yNzI1IDQ2LjMyOTcgODEuNzAyNSA0NS4wMDU1IDgxLjE3MTQgNDMuNTIyMkM3Ni40MTM3IDMwLjIzMzQgNjEuMzkxMSAyNC44MDM5IDUwLjAyNzcgMjQuODAzOUMzOC42NDQyIDI0LjgwMzkgMjMuMjg2OCAzMC40MDcgMTguODc1NCA0My41OTEyQzE4LjM4MjQgNDUuMDY0NSAxOS44MDgzIDQ2LjM0NDYgMjEuMjk3OCA0NS44ODgxTDQ4Ljg3MiAzNy40MzgxQzQ5LjUzMzEgMzcuMjM1NSA1MC4yMzk5IDM3LjIzNDQgNTAuOTAxNyAzNy40MzQ4TDc4Ljc2MDYgNDUuODcxOFoiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8cGF0aAogICAgICAgIGQ9Ik0xOC44MTMyIDQ4LjE3MDdMNDguODkzNSAzOS4wNDcyQzQ5LjU1MDYgMzguODQ3OCA1MC4yNTI0IDM4Ljg0NzMgNTAuOTA5OCAzOS4wNDU2TDgxLjE3ODEgNDguMTc1MkM4My42OTEyIDQ4LjkzMzIgODUuNDExIDUxLjI0ODMgODUuNDExIDUzLjg3MzVWODEuMjIzM0M4NS4yOTQ0IDg3Ljg5OTEgNzkuMjk3NyA5My4yNSA3Mi42MjQ1IDkzLjI1SDYxLjU0MDZDNjAuNDQ0OSA5My4yNSA1OS41NTc3IDkyLjM2MzcgNTkuNTU3NyA5MS4yNjhWODEuNjc4OUM1OS41NTc3IDc3LjkwMzEgNjEuNzkyMSA3NC40ODU1IDY1LjI0OTggNzIuOTcyOUM2OS44ODQ5IDcwLjk0NTQgNzUuMzY4MSA2OC4yMDI4IDc2LjM5OTQgNjIuNjk5MkM3Ni43MzIzIDYwLjkyMjkgNzUuNTc0MSA1OS4yMDk0IDczLjgwMjQgNTguODU3M0M2OS4zMjI2IDU3Ljk2NjcgNjQuMzU2MiA1OC4zMTA3IDYwLjE1NjQgNjAuMTg5M0M1NS4zODg3IDYyLjMyMTkgNTQuMTQxNSA2NS44Njk0IDUzLjY3OTcgNzAuNjMzN0w1My4xMjAxIDc1Ljc2NjJDNTIuOTQ5MSA3Ny4zMzQ5IDUxLjQ3ODUgNzguNTM2NiA0OS45MDE0IDc4LjUzNjZDNDguMjY5OSA3OC41MzY2IDQ3LjA0NjUgNzcuMjk0IDQ2Ljg2OTYgNzUuNjcxMkw0Ni4zMjA0IDcwLjYzMzdDNDUuOTI0OSA2Ni41NTI5IDQ1LjIwNzkgNjIuNTg4NyA0MC45ODk1IDYwLjcwMThDMzYuMTc3NiA1OC41NDk0IDMxLjM0MTkgNTcuODM0NyAyNi4xOTc2IDU4Ljg1NzNDMjQuNDI2IDU5LjIwOTQgMjMuMjY3OCA2MC45MjI5IDIzLjYwMDcgNjIuNjk5MkMyNC42NDEgNjguMjUwNyAzMC4wODEyIDcwLjkzMDUgMzQuNzUwMyA3Mi45NzI5QzM4LjIwOCA3NC40ODU1IDQwLjQ0MjQgNzcuOTAzMSA0MC40NDI0IDgxLjY3ODlWOTEuMjY2M0M0MC40NDI0IDkyLjM2MiAzOS41NTU1IDkzLjI1IDM4LjQ1OTkgOTMuMjVIMjcuMzc1NkMyMC43MDI0IDkzLjI1IDE0LjcwNTcgODcuODk5MSAxNC41ODkxIDgxLjIyMzNWNTMuODY2M0MxNC41ODkxIDUxLjI0NDYgMTYuMzA0NSA0OC45MzE2IDE4LjgxMzIgNDguMTcwN1oiCiAgICAgICAgZmlsbD0idXJsKCNwYWludDJfbGluZWFyXzM3Ml80MDI1OSkiIC8+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMzcyXzQwMjU5IiB4MT0iNDkuMzA1NyIgeTE9IjIuMDc5IiB4Mj0iODAuMzYyNyIgeTI9IjkzLjY1OTciCiAgICAgICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIgLz4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY5NjAwIiAvPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzM3Ml80MDI1OSIgeDE9IjQ5LjMwNTciIHkxPSIyLjA3OSIgeDI9IjgwLjM2MjciIHkyPSI5My42NTk3IgogICAgICAgICAgICBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGNUQ0NUUiIC8+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0ZGOTYwMCIgLz4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQyX2xpbmVhcl8zNzJfNDAyNTkiIHgxPSI0OS4zMDU3IiB5MT0iMi4wNzkiIHgyPSI4MC4zNjI3IiB5Mj0iOTMuNjU5NyIKICAgICAgICAgICAgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjVENDVFIiAvPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiIC8+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KPC9zdmc+",downloads:{chrome:"https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",firefox:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet",edge:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc"}}],st=()=>`${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,ye=Xr=>{for(let eo=Xr.length-1;eo>0;eo--){const to=Math.floor(Math.random()*(eo+1));[Xr[eo],Xr[to]]=[Xr[to],Xr[eo]]}return Xr};function ce(...Xr){return eo=>Xr.reduce((to,ro)=>to.then(ro),Promise.resolve(eo))}var W,S,H,we,_e,X,te;class at{constructor(eo){V(this,we),V(this,X),V(this,W,!1),V(this,S,void 0),V(this,H,void 0),it(this,"value"),ie(this,H,eo),$(this,X,te).call(this)}set(eo){return!z(this,W)&&!$(this,X,te).call(this)?!1:(this.delete(),this.value=eo,eo&&(ie(this,S,`${z(this,H)}-${st()}`),localStorage.setItem(z(this,S),eo)),!0)}get(){return $(this,we,_e).call(this),this.value}delete(){return!z(this,W)&&!$(this,X,te).call(this)?!1:(this.value=null,z(this,S)&&localStorage.removeItem(z(this,S)),!0)}}W=new WeakMap,S=new WeakMap,H=new WeakMap,we=new WeakSet,_e=function(){this.value&&this.set(this.value)},X=new WeakSet,te=function(){try{!z(this,W)&&typeof window<"u"&&(ie(this,S,Object.keys(localStorage).find(Xr=>Xr.startsWith(z(this,H)))),ie(this,W,!0),z(this,S)&&this.set(localStorage.getItem(z(this,S))))}catch(Xr){console.warn(Xr)}return z(this,W)};function le(Xr,eo){var to,ro;if((to=eo==null?void 0:eo.include)!=null&&to.length){const no=new Set(eo.include);return Xr.filter(io=>no.has(io.id))}if((ro=eo==null?void 0:eo.exclude)!=null&&ro.length){const no=new Set(eo.exclude);return Xr.filter(io=>!no.has(io.id))}return Xr}const ve=async Xr=>{const eo=await Promise.all(Xr.map(to=>to.isPreauthorized().catch(()=>!1)));return Xr.filter((to,ro)=>eo[ro])},ct=Xr=>{try{return Xr&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(eo=>eo in Xr)}catch{}return!1};function de(Xr,eo){return Object.values(Object.getOwnPropertyNames(Xr).reduce((to,ro)=>{if(ro.startsWith("starknet")){const no=Xr[ro];eo(no)&&!to[no.id]&&(to[no.id]=no)}return to},{}))}const ue=(Xr,eo)=>{if(eo&&Array.isArray(eo)){Xr.sort((ro,no)=>eo.indexOf(ro.id)-eo.indexOf(no.id));const to=Xr.length-eo.length;return[...Xr.slice(to),...ye(Xr.slice(0,to))]}else return ye(Xr)},lt=typeof window<"u"?window:{},dt={windowObject:lt,isWalletObject:ct,storageFactoryImplementation:Xr=>new at(Xr)};function ut(Xr={}){const{storageFactoryImplementation:eo,windowObject:to,isWalletObject:ro}={...dt,...Xr},no=eo("gsw-last");return{getAvailableWallets:async(io={})=>{const oo=de(to,ro);return ce(ao=>le(ao,io),ao=>ue(ao,io.sort))(oo)},getPreAuthorizedWallets:async(io={})=>{const oo=de(to,ro);return ce(ao=>ve(ao),ao=>le(ao,io),ao=>ue(ao,io.sort))(oo)},getDiscoveryWallets:async(io={})=>ce(oo=>le(oo,io),oo=>ue(oo,io.sort))(ot),getLastConnectedWallet:async()=>{const io=no.get(),oo=de(to,ro).find(so=>so.id===io),[ao]=await ve(oo?[oo]:[]);return ao||(no.delete(),null)},enable:async(io,oo)=>{if(await io.enable(oo??{starknetVersion:"v5"}),!io.isConnected)throw new Error("Failed to connect to wallet");return no.set(io.id),io},disconnect:async({clearLastWallet:io}={})=>{io&&no.delete()}}}const re=ut(),gt={"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"},Le={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"},N={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},j={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"},L={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class o{static getFirstMatch(eo,to){const ro=to.match(eo);return ro&&ro.length>0&&ro[1]||""}static getSecondMatch(eo,to){const ro=to.match(eo);return ro&&ro.length>1&&ro[2]||""}static matchAndReturnConst(eo,to,ro){if(eo.test(to))return ro}static getWindowsVersionName(eo){switch(eo){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";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}}static getMacOSVersionName(eo){const to=eo.split(".").splice(0,2).map(ro=>parseInt(ro,10)||0);if(to.push(0),to[0]===10)switch(to[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(eo){const to=eo.split(".").splice(0,2).map(ro=>parseInt(ro,10)||0);if(to.push(0),!(to[0]===1&&to[1]<5)){if(to[0]===1&&to[1]<6)return"Cupcake";if(to[0]===1&&to[1]>=6)return"Donut";if(to[0]===2&&to[1]<2)return"Eclair";if(to[0]===2&&to[1]===2)return"Froyo";if(to[0]===2&&to[1]>2)return"Gingerbread";if(to[0]===3)return"Honeycomb";if(to[0]===4&&to[1]<1)return"Ice Cream Sandwich";if(to[0]===4&&to[1]<4)return"Jelly Bean";if(to[0]===4&&to[1]>=4)return"KitKat";if(to[0]===5)return"Lollipop";if(to[0]===6)return"Marshmallow";if(to[0]===7)return"Nougat";if(to[0]===8)return"Oreo";if(to[0]===9)return"Pie"}}static getVersionPrecision(eo){return eo.split(".").length}static compareVersions(eo,to,ro=!1){const no=o.getVersionPrecision(eo),io=o.getVersionPrecision(to);let oo=Math.max(no,io),ao=0;const so=o.map([eo,to],co=>{const lo=oo-o.getVersionPrecision(co),uo=co+new Array(lo+1).join(".0");return o.map(uo.split("."),ho=>new Array(20-ho.length).join("0")+ho).reverse()});for(ro&&(ao=oo-Math.min(no,io)),oo-=1;oo>=ao;){if(so[0][oo]>so[1][oo])return 1;if(so[0][oo]===so[1][oo]){if(oo===ao)return 0;oo-=1}else if(so[0][oo]{ro[ao]=oo[ao]})}return eo}static getBrowserAlias(eo){return gt[eo]}static getBrowserTypeByAlias(eo){return Le[eo]||""}}const M=/version\/(\d+(\.?_?\d+)+)/i,ft=[{test:[/googlebot/i],describe(Xr){const eo={name:"Googlebot"},to=o.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/opera/i],describe(Xr){const eo={name:"Opera"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/opr\/|opios/i],describe(Xr){const eo={name:"Opera"},to=o.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/SamsungBrowser/i],describe(Xr){const eo={name:"Samsung Internet for Android"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/Whale/i],describe(Xr){const eo={name:"NAVER Whale Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/MZBrowser/i],describe(Xr){const eo={name:"MZ Browser"},to=o.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/focus/i],describe(Xr){const eo={name:"Focus"},to=o.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/swing/i],describe(Xr){const eo={name:"Swing"},to=o.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/coast/i],describe(Xr){const eo={name:"Opera Coast"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(Xr){const eo={name:"Opera Touch"},to=o.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/yabrowser/i],describe(Xr){const eo={name:"Yandex Browser"},to=o.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/ucbrowser/i],describe(Xr){const eo={name:"UC Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/Maxthon|mxios/i],describe(Xr){const eo={name:"Maxthon"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/epiphany/i],describe(Xr){const eo={name:"Epiphany"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/puffin/i],describe(Xr){const eo={name:"Puffin"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/sleipnir/i],describe(Xr){const eo={name:"Sleipnir"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/k-meleon/i],describe(Xr){const eo={name:"K-Meleon"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/micromessenger/i],describe(Xr){const eo={name:"WeChat"},to=o.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/qqbrowser/i],describe(Xr){const eo={name:/qqbrowserlite/i.test(Xr)?"QQ Browser Lite":"QQ Browser"},to=o.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/msie|trident/i],describe(Xr){const eo={name:"Internet Explorer"},to=o.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/\sedg\//i],describe(Xr){const eo={name:"Microsoft Edge"},to=o.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/edg([ea]|ios)/i],describe(Xr){const eo={name:"Microsoft Edge"},to=o.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/vivaldi/i],describe(Xr){const eo={name:"Vivaldi"},to=o.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/seamonkey/i],describe(Xr){const eo={name:"SeaMonkey"},to=o.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/sailfish/i],describe(Xr){const eo={name:"Sailfish"},to=o.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,Xr);return to&&(eo.version=to),eo}},{test:[/silk/i],describe(Xr){const eo={name:"Amazon Silk"},to=o.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/phantom/i],describe(Xr){const eo={name:"PhantomJS"},to=o.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/slimerjs/i],describe(Xr){const eo={name:"SlimerJS"},to=o.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(Xr){const eo={name:"BlackBerry"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/(web|hpw)[o0]s/i],describe(Xr){const eo={name:"WebOS Browser"},to=o.getFirstMatch(M,Xr)||o.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/bada/i],describe(Xr){const eo={name:"Bada"},to=o.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/tizen/i],describe(Xr){const eo={name:"Tizen"},to=o.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/qupzilla/i],describe(Xr){const eo={name:"QupZilla"},to=o.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/firefox|iceweasel|fxios/i],describe(Xr){const eo={name:"Firefox"},to=o.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/electron/i],describe(Xr){const eo={name:"Electron"},to=o.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/MiuiBrowser/i],describe(Xr){const eo={name:"Miui"},to=o.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/chromium/i],describe(Xr){const eo={name:"Chromium"},to=o.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,Xr)||o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/chrome|crios|crmo/i],describe(Xr){const eo={name:"Chrome"},to=o.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/GSA/i],describe(Xr){const eo={name:"Google Search"},to=o.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){const eo=!Xr.test(/like android/i),to=Xr.test(/android/i);return eo&&to},describe(Xr){const eo={name:"Android Browser"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/playstation 4/i],describe(Xr){const eo={name:"PlayStation 4"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/safari|applewebkit/i],describe(Xr){const eo={name:"Safari"},to=o.getFirstMatch(M,Xr);return to&&(eo.version=to),eo}},{test:[/.*/i],describe(Xr){const eo=/^(.*)\/(.*) /,to=/^(.*)\/(.*)[ \t]\((.*)/,ro=Xr.search("\\(")!==-1?to:eo;return{name:o.getFirstMatch(ro,Xr),version:o.getSecondMatch(ro,Xr)}}}],wt=[{test:[/Roku\/DVP/],describe(Xr){const eo=o.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,Xr);return{name:j.Roku,version:eo}}},{test:[/windows phone/i],describe(Xr){const eo=o.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,Xr);return{name:j.WindowsPhone,version:eo}}},{test:[/windows /i],describe(Xr){const eo=o.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,Xr),to=o.getWindowsVersionName(eo);return{name:j.Windows,version:eo,versionName:to}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(Xr){const eo={name:j.iOS},to=o.getSecondMatch(/(Version\/)(\d[\d.]+)/,Xr);return to&&(eo.version=to),eo}},{test:[/macintosh/i],describe(Xr){const eo=o.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,Xr).replace(/[_\s]/g,"."),to=o.getMacOSVersionName(eo),ro={name:j.MacOS,version:eo};return to&&(ro.versionName=to),ro}},{test:[/(ipod|iphone|ipad)/i],describe(Xr){const eo=o.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,Xr).replace(/[_\s]/g,".");return{name:j.iOS,version:eo}}},{test(Xr){const eo=!Xr.test(/like android/i),to=Xr.test(/android/i);return eo&&to},describe(Xr){const eo=o.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,Xr),to=o.getAndroidVersionName(eo),ro={name:j.Android,version:eo};return to&&(ro.versionName=to),ro}},{test:[/(web|hpw)[o0]s/i],describe(Xr){const eo=o.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,Xr),to={name:j.WebOS};return eo&&eo.length&&(to.version=eo),to}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(Xr){const eo=o.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,Xr)||o.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,Xr)||o.getFirstMatch(/\bbb(\d+)/i,Xr);return{name:j.BlackBerry,version:eo}}},{test:[/bada/i],describe(Xr){const eo=o.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,Xr);return{name:j.Bada,version:eo}}},{test:[/tizen/i],describe(Xr){const eo=o.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,Xr);return{name:j.Tizen,version:eo}}},{test:[/linux/i],describe(){return{name:j.Linux}}},{test:[/CrOS/],describe(){return{name:j.ChromeOS}}},{test:[/PlayStation 4/],describe(Xr){const eo=o.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,Xr);return{name:j.PlayStation4,version:eo}}}],ht=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(Xr){const eo=o.getFirstMatch(/(can-l01)/i,Xr)&&"Nova",to={type:N.mobile,vendor:"Huawei"};return eo&&(to.model=eo),to}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:N.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:N.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:N.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:N.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:N.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:N.tablet}}},{test(Xr){const eo=Xr.test(/ipod|iphone/i),to=Xr.test(/like (ipod|iphone)/i);return eo&&!to},describe(Xr){const eo=o.getFirstMatch(/(ipod|iphone)/i,Xr);return{type:N.mobile,vendor:"Apple",model:eo}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:N.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:N.mobile}}},{test(Xr){return Xr.getBrowserName(!0)==="blackberry"},describe(){return{type:N.mobile,vendor:"BlackBerry"}}},{test(Xr){return Xr.getBrowserName(!0)==="bada"},describe(){return{type:N.mobile}}},{test(Xr){return Xr.getBrowserName()==="windows phone"},describe(){return{type:N.mobile,vendor:"Microsoft"}}},{test(Xr){const eo=Number(String(Xr.getOSVersion()).split(".")[0]);return Xr.getOSName(!0)==="android"&&eo>=3},describe(){return{type:N.tablet}}},{test(Xr){return Xr.getOSName(!0)==="android"},describe(){return{type:N.mobile}}},{test(Xr){return Xr.getOSName(!0)==="macos"},describe(){return{type:N.desktop,vendor:"Apple"}}},{test(Xr){return Xr.getOSName(!0)==="windows"},describe(){return{type:N.desktop}}},{test(Xr){return Xr.getOSName(!0)==="linux"},describe(){return{type:N.desktop}}},{test(Xr){return Xr.getOSName(!0)==="playstation 4"},describe(){return{type:N.tv}}},{test(Xr){return Xr.getOSName(!0)==="roku"},describe(){return{type:N.tv}}}],bt=[{test(Xr){return Xr.getBrowserName(!0)==="microsoft edge"},describe(Xr){if(/\sedg\//i.test(Xr))return{name:L.Blink};const eo=o.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,Xr);return{name:L.EdgeHTML,version:eo}}},{test:[/trident/i],describe(Xr){const eo={name:L.Trident},to=o.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){return Xr.test(/presto/i)},describe(Xr){const eo={name:L.Presto},to=o.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test(Xr){const eo=Xr.test(/gecko/i),to=Xr.test(/like gecko/i);return eo&&!to},describe(Xr){const eo={name:L.Gecko},to=o.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:L.Blink}}},{test:[/(apple)?webkit/i],describe(Xr){const eo={name:L.WebKit},to=o.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,Xr);return to&&(eo.version=to),eo}}];class ke{constructor(eo,to=!1){if(eo==null||eo==="")throw new Error("UserAgent parameter can't be empty");this._ua=eo,this.parsedResult={},to!==!0&&this.parse()}getUA(){return this._ua}test(eo){return eo.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const eo=o.find(ft,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.browser=eo.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(eo){return eo?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const eo=o.find(wt,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.os=eo.describe(this.getUA())),this.parsedResult.os}getOSName(eo){const{name:to}=this.getOS();return eo?String(to).toLowerCase()||"":to||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(eo=!1){const{type:to}=this.getPlatform();return eo?String(to).toLowerCase()||"":to||""}parsePlatform(){this.parsedResult.platform={};const eo=o.find(ht,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.platform=eo.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(eo){return eo?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const eo=o.find(bt,to=>{if(typeof to.test=="function")return to.test(this);if(to.test instanceof Array)return to.test.some(ro=>this.test(ro));throw new Error("Browser's test function is not valid")});return eo&&(this.parsedResult.engine=eo.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return o.assign({},this.parsedResult)}satisfies(eo){const to={};let ro=0;const no={};let io=0;if(Object.keys(eo).forEach(oo=>{const ao=eo[oo];typeof ao=="string"?(no[oo]=ao,io+=1):typeof ao=="object"&&(to[oo]=ao,ro+=1)}),ro>0){const oo=Object.keys(to),ao=o.find(oo,co=>this.isOS(co));if(ao){const co=this.satisfies(to[ao]);if(co!==void 0)return co}const so=o.find(oo,co=>this.isPlatform(co));if(so){const co=this.satisfies(to[so]);if(co!==void 0)return co}}if(io>0){const oo=Object.keys(no),ao=o.find(oo,so=>this.isBrowser(so,!0));if(ao!==void 0)return this.compareVersion(no[ao])}}isBrowser(eo,to=!1){const ro=this.getBrowserName().toLowerCase();let no=eo.toLowerCase();const io=o.getBrowserTypeByAlias(no);return to&&io&&(no=io.toLowerCase()),no===ro}compareVersion(eo){let to=[0],ro=eo,no=!1;const io=this.getBrowserVersion();if(typeof io=="string")return eo[0]===">"||eo[0]==="<"?(ro=eo.substr(1),eo[1]==="="?(no=!0,ro=eo.substr(2)):to=[],eo[0]===">"?to.push(1):to.push(-1)):eo[0]==="="?ro=eo.substr(1):eo[0]==="~"&&(no=!0,ro=eo.substr(1)),to.indexOf(o.compareVersions(io,ro,no))>-1}isOS(eo){return this.getOSName(!0)===String(eo).toLowerCase()}isPlatform(eo){return this.getPlatformType(!0)===String(eo).toLowerCase()}isEngine(eo){return this.getEngineName(!0)===String(eo).toLowerCase()}is(eo,to=!1){return this.isBrowser(eo,to)||this.isOS(eo)||this.isPlatform(eo)}some(eo=[]){return eo.some(to=>this.is(to))}}/*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 - */class pt{static getParser(eo,to=!1){if(typeof eo!="string")throw new Error("UserAgent should be a string");return new ke(eo,to)}static parse(eo){return new ke(eo).getResult()}static get BROWSER_MAP(){return Le}static get ENGINE_MAP(){return L}static get OS_MAP(){return j}static get PLATFORMS_MAP(){return N}}const Ne=typeof window<"u"?window:null;function mt(){var Xr;if(!Ne)return null;switch((Xr=pt.getParser(Ne.navigator.userAgent).getBrowserName())==null?void 0:Xr.toLowerCase()){case"firefox":return"firefox";case"microsoft edge":return"edge";case"android browser":case"chrome":case"chromium":case"electron":case"opera":case"vivaldi":return"chrome";default:return null}}const Mt=({argentMobileOptions:Xr,webWalletUrl:eo,provider:to})=>{const ro=typeof window<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1,no=[];return ro||(no.push(new L$1({options:{id:"argentX",provider:to}})),no.push(new L$1({options:{id:"braavos",provider:to}}))),no.push(new O$1({...Xr,provider:to})),no.push(new ba({url:eo,provider:to})),no};var yt=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1;const vt=yt;var kt=typeof self=="object"&&self&&self.Object===Object&&self,Nt=vt||kt||Function("return this")();const It=Nt;var At=It.Symbol;const oe=At;var Te=Object.prototype,xt=Te.hasOwnProperty,jt=Te.toString,Z=oe?oe.toStringTag:void 0;function Dt(Xr){var eo=xt.call(Xr,Z),to=Xr[Z];try{Xr[Z]=void 0;var ro=!0}catch{}var no=jt.call(Xr);return ro&&(eo?Xr[Z]=to:delete Xr[Z]),no}var zt=Object.prototype,Ct=zt.toString;function St(Xr){return Ct.call(Xr)}var Ot="[object Null]",_t="[object Undefined]",Ie=oe?oe.toStringTag:void 0;function Lt(Xr){return Xr==null?Xr===void 0?_t:Ot:Ie&&Ie in Object(Xr)?Dt(Xr):St(Xr)}function Tt(Xr){return Xr!=null&&typeof Xr=="object"}var Et=Array.isArray;const Ft=Et;var Bt="[object String]";function Ae(Xr){return typeof Xr=="string"||!Ft(Xr)&&Tt(Xr)&&Lt(Xr)==Bt}const Wt=({availableConnectors:Xr,installedWallets:eo,discoveryWallets:to,storeVersion:ro})=>{var no;return(no=window==null?void 0:window.starknet_argentX)!=null&&no.isInAppBrowser?[]:Xr.map(io=>{const oo=eo.find(so=>so.id===io.id);if(oo){const so=oo.id==="argentX"?d:oo.icon;return{name:oo.name,id:oo.id,icon:{light:so,dark:so},connector:io}}const ao=to.filter(so=>!!so.downloads[ro]).find(so=>so.id===io.id);if(ao){const{downloads:so}=ao,co=ao.id==="argentX"?d:ao.icon;return{name:ao.name,id:ao.id,icon:{light:co,dark:co},connector:io,download:so[ro]}}return!io||!io.id||!io.name?null:{name:io.name,id:io.id,icon:io.icon,connector:io,title:"title"in io&&Ae(io.title)?io.title:void 0,subtitle:"subtitle"in io&&Ae(io.subtitle)?io.subtitle:void 0}}).filter(io=>io!==null)};function Q(){}function Ee(Xr){return Xr()}function xe(){return Object.create(null)}function F(Xr){Xr.forEach(Ee)}function Fe(Xr){return typeof Xr=="function"}function Be(Xr,eo){return Xr!=Xr?eo==eo:Xr!==eo||Xr&&typeof Xr=="object"||typeof Xr=="function"}let ee;function We(Xr,eo){return ee||(ee=document.createElement("a")),ee.href=eo,Xr===ee.href}function Pt(Xr){return Object.keys(Xr).length===0}function y(Xr,eo){Xr.appendChild(eo)}function B(Xr,eo,to){Xr.insertBefore(eo,to||null)}function _(Xr){Xr.parentNode&&Xr.parentNode.removeChild(Xr)}function Qt(Xr,eo){for(let to=0;toXr.removeEventListener(eo,to,ro)}function f(Xr,eo,to){to==null?Xr.removeAttribute(eo):Xr.getAttribute(eo)!==to&&Xr.setAttribute(eo,to)}function Ut(Xr){return Array.from(Xr.childNodes)}function se(Xr,eo){eo=""+eo,Xr.data!==eo&&(Xr.data=eo)}function Qe(Xr,eo,to,ro){to==null?Xr.style.removeProperty(eo):Xr.style.setProperty(eo,to,"")}let J;function q(Xr){J=Xr}function Yt(){if(!J)throw new Error("Function called outside component initialization");return J}function Rt(Xr){Yt().$$.on_mount.push(Xr)}const R=[],je=[];let G=[];const De=[],Gt=Promise.resolve();let he=!1;function Vt(){he||(he=!0,Gt.then(Ue))}function be(Xr){G.push(Xr)}const ge=new Set;let Y=0;function Ue(){if(Y!==0)return;const Xr=J;do{try{for(;YXr.indexOf(ro)===-1?eo.push(ro):to.push(ro)),to.forEach(ro=>ro()),G=eo}const ne=new Set;let P;function Ye(){P={r:0,c:[],p:P}}function Re(){P.r||F(P.c),P=P.p}function E(Xr,eo){Xr&&Xr.i&&(ne.delete(Xr),Xr.i(eo))}function K(Xr,eo,to,ro){if(Xr&&Xr.o){if(ne.has(Xr))return;ne.add(Xr),P.c.push(()=>{ne.delete(Xr),ro&&(to&&Xr.d(1),ro())}),Xr.o(eo)}else ro&&ro()}function ze(Xr){return(Xr==null?void 0:Xr.length)!==void 0?Xr:Array.from(Xr)}function Ht(Xr){Xr&&Xr.c()}function Ge(Xr,eo,to){const{fragment:ro,after_update:no}=Xr.$$;ro&&ro.m(eo,to),be(()=>{const io=Xr.$$.on_mount.map(Ee).filter(Fe);Xr.$$.on_destroy?Xr.$$.on_destroy.push(...io):F(io),Xr.$$.on_mount=[]}),no.forEach(be)}function Ve(Xr,eo){const to=Xr.$$;to.fragment!==null&&(Xt(to.after_update),F(to.on_destroy),to.fragment&&to.fragment.d(eo),to.on_destroy=to.fragment=null,to.ctx=[])}function qt(Xr,eo){Xr.$$.dirty[0]===-1&&(R.push(Xr),Vt(),Xr.$$.dirty.fill(0)),Xr.$$.dirty[eo/31|0]|=1<{const yo=go.length?go[0]:ho;return co.ctx&&no(co.ctx[fo],co.ctx[fo]=yo)&&(!co.skip_bound&&co.bound[fo]&&co.bound[fo](yo),lo&&qt(Xr,fo)),ho}):[],co.update(),lo=!0,F(co.before_update),co.fragment=ro?ro(co.ctx):!1,eo.target){if(eo.hydrate){const fo=Ut(eo.target);co.fragment&&co.fragment.l(fo),fo.forEach(_)}else co.fragment&&co.fragment.c();eo.intro&&E(Xr.$$.fragment),Ge(Xr,eo.target,eo.anchor),Ue()}q(so)}class Xe{constructor(){ae(this,"$$"),ae(this,"$$set")}$destroy(){Ve(this,1),this.$destroy=Q}$on(eo,to){if(!Fe(to))return Q;const ro=this.$$.callbacks[eo]||(this.$$.callbacks[eo]=[]);return ro.push(to),()=>{const no=ro.indexOf(to);no!==-1&&ro.splice(no,1)}}$set(eo){this.$$set&&!Pt(eo)&&(this.$$.skip_bound=!0,this.$$set(eo),this.$$.skip_bound=!1)}}const Jt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Jt);function Kt(Xr){let eo,to,ro,no,io,oo=(Xr[0].title??Xr[0].name)+"",ao,so,co,lo=(Xr[0].subtitle??"")+"",fo,ho,go,yo;function vo(ko,Ao){var Po;return ko[2]===((Po=ko[0])==null?void 0:Po.id)?rr:ko[4]?tr:er}let wo=vo(Xr),Eo=wo(Xr);return{c(){eo=A("li"),to=A("span"),ro=T(),no=A("div"),io=A("p"),ao=U(oo),so=T(),co=A("p"),fo=U(lo),ho=T(),Eo.c(),f(to,"class","w-8 h-8"),f(io,"class","font-semibold text-base p"),f(co,"class","l2 p"),Qe(co,"text-align","center"),f(no,"class","flex flex-col justify-center items-center"),f(eo,"class",`flex flex-row-reverse justify-between items-center + */class pt{static getParser(eo,to=!1){if(typeof eo!="string")throw new Error("UserAgent should be a string");return new ke(eo,to)}static parse(eo){return new ke(eo).getResult()}static get BROWSER_MAP(){return Le}static get ENGINE_MAP(){return L}static get OS_MAP(){return j}static get PLATFORMS_MAP(){return N}}const Ne=typeof window<"u"?window:null;function mt(){var Xr;if(!Ne)return null;switch((Xr=pt.getParser(Ne.navigator.userAgent).getBrowserName())==null?void 0:Xr.toLowerCase()){case"firefox":return"firefox";case"microsoft edge":return"edge";case"android browser":case"chrome":case"chromium":case"electron":case"opera":case"vivaldi":return"chrome";default:return null}}const Mt=({argentMobileOptions:Xr,webWalletUrl:eo,provider:to})=>{const ro=typeof window<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1,no=[];return ro||(no.push(new L$1({options:{id:"argentX",provider:to}})),no.push(new L$1({options:{id:"braavos",provider:to}}))),no.push(new O$1({...Xr,provider:to})),no.push(new ba({url:eo,provider:to})),no};var yt=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1;const vt=yt;var kt=typeof self=="object"&&self&&self.Object===Object&&self,Nt=vt||kt||Function("return this")();const It=Nt;var At=It.Symbol;const oe=At;var Te=Object.prototype,xt=Te.hasOwnProperty,jt=Te.toString,Z=oe?oe.toStringTag:void 0;function Dt(Xr){var eo=xt.call(Xr,Z),to=Xr[Z];try{Xr[Z]=void 0;var ro=!0}catch{}var no=jt.call(Xr);return ro&&(eo?Xr[Z]=to:delete Xr[Z]),no}var zt=Object.prototype,Ct=zt.toString;function St(Xr){return Ct.call(Xr)}var Ot="[object Null]",_t="[object Undefined]",Ie=oe?oe.toStringTag:void 0;function Lt(Xr){return Xr==null?Xr===void 0?_t:Ot:Ie&&Ie in Object(Xr)?Dt(Xr):St(Xr)}function Tt(Xr){return Xr!=null&&typeof Xr=="object"}var Et=Array.isArray;const Ft=Et;var Bt="[object String]";function Ae(Xr){return typeof Xr=="string"||!Ft(Xr)&&Tt(Xr)&&Lt(Xr)==Bt}const Wt=({availableConnectors:Xr,installedWallets:eo,discoveryWallets:to,storeVersion:ro})=>{var no;return(no=window==null?void 0:window.starknet_argentX)!=null&&no.isInAppBrowser?[]:Xr.map(io=>{const oo=eo.find(so=>so.id===io.id);if(oo){const so=oo.id==="argentX"?d:oo.icon;return{name:oo.name,id:oo.id,icon:{light:so,dark:so},connector:io}}const ao=to.filter(so=>!!so.downloads[ro]).find(so=>so.id===io.id);if(ao){const{downloads:so}=ao,co=ao.id==="argentX"?d:ao.icon;return{name:ao.name,id:ao.id,icon:{light:co,dark:co},connector:io,download:so[ro]}}return!io||!io.id||!io.name?null:{name:io.name,id:io.id,icon:io.icon,connector:io,title:"title"in io&&Ae(io.title)?io.title:void 0,subtitle:"subtitle"in io&&Ae(io.subtitle)?io.subtitle:void 0}}).filter(io=>io!==null)};function Q(){}function Ee(Xr){return Xr()}function xe(){return Object.create(null)}function F(Xr){Xr.forEach(Ee)}function Fe(Xr){return typeof Xr=="function"}function Be(Xr,eo){return Xr!=Xr?eo==eo:Xr!==eo||Xr&&typeof Xr=="object"||typeof Xr=="function"}let ee;function We(Xr,eo){return ee||(ee=document.createElement("a")),ee.href=eo,Xr===ee.href}function Pt(Xr){return Object.keys(Xr).length===0}function y(Xr,eo){Xr.appendChild(eo)}function B(Xr,eo,to){Xr.insertBefore(eo,to||null)}function _(Xr){Xr.parentNode&&Xr.parentNode.removeChild(Xr)}function Qt(Xr,eo){for(let to=0;toXr.removeEventListener(eo,to,ro)}function f(Xr,eo,to){to==null?Xr.removeAttribute(eo):Xr.getAttribute(eo)!==to&&Xr.setAttribute(eo,to)}function Ut(Xr){return Array.from(Xr.childNodes)}function se(Xr,eo){eo=""+eo,Xr.data!==eo&&(Xr.data=eo)}function Qe(Xr,eo,to,ro){to==null?Xr.style.removeProperty(eo):Xr.style.setProperty(eo,to,"")}let J;function q(Xr){J=Xr}function Yt(){if(!J)throw new Error("Function called outside component initialization");return J}function Rt(Xr){Yt().$$.on_mount.push(Xr)}const R=[],je=[];let G=[];const De=[],Gt=Promise.resolve();let he=!1;function Vt(){he||(he=!0,Gt.then(Ue))}function be(Xr){G.push(Xr)}const ge=new Set;let Y=0;function Ue(){if(Y!==0)return;const Xr=J;do{try{for(;YXr.indexOf(ro)===-1?eo.push(ro):to.push(ro)),to.forEach(ro=>ro()),G=eo}const ne=new Set;let P;function Ye(){P={r:0,c:[],p:P}}function Re(){P.r||F(P.c),P=P.p}function E(Xr,eo){Xr&&Xr.i&&(ne.delete(Xr),Xr.i(eo))}function K(Xr,eo,to,ro){if(Xr&&Xr.o){if(ne.has(Xr))return;ne.add(Xr),P.c.push(()=>{ne.delete(Xr),ro&&(to&&Xr.d(1),ro())}),Xr.o(eo)}else ro&&ro()}function ze(Xr){return(Xr==null?void 0:Xr.length)!==void 0?Xr:Array.from(Xr)}function Ht(Xr){Xr&&Xr.c()}function Ge(Xr,eo,to){const{fragment:ro,after_update:no}=Xr.$$;ro&&ro.m(eo,to),be(()=>{const io=Xr.$$.on_mount.map(Ee).filter(Fe);Xr.$$.on_destroy?Xr.$$.on_destroy.push(...io):F(io),Xr.$$.on_mount=[]}),no.forEach(be)}function Ve(Xr,eo){const to=Xr.$$;to.fragment!==null&&(Xt(to.after_update),F(to.on_destroy),to.fragment&&to.fragment.d(eo),to.on_destroy=to.fragment=null,to.ctx=[])}function qt(Xr,eo){Xr.$$.dirty[0]===-1&&(R.push(Xr),Vt(),Xr.$$.dirty.fill(0)),Xr.$$.dirty[eo/31|0]|=1<{const bo=go.length?go[0]:ho;return co.ctx&&no(co.ctx[uo],co.ctx[uo]=bo)&&(!co.skip_bound&&co.bound[uo]&&co.bound[uo](bo),lo&&qt(Xr,uo)),ho}):[],co.update(),lo=!0,F(co.before_update),co.fragment=ro?ro(co.ctx):!1,eo.target){if(eo.hydrate){const uo=Ut(eo.target);co.fragment&&co.fragment.l(uo),uo.forEach(_)}else co.fragment&&co.fragment.c();eo.intro&&E(Xr.$$.fragment),Ge(Xr,eo.target,eo.anchor),Ue()}q(so)}class Xe{constructor(){ae(this,"$$"),ae(this,"$$set")}$destroy(){Ve(this,1),this.$destroy=Q}$on(eo,to){if(!Fe(to))return Q;const ro=this.$$.callbacks[eo]||(this.$$.callbacks[eo]=[]);return ro.push(to),()=>{const no=ro.indexOf(to);no!==-1&&ro.splice(no,1)}}$set(eo){this.$$set&&!Pt(eo)&&(this.$$.skip_bound=!0,this.$$set(eo),this.$$.skip_bound=!1)}}const Jt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Jt);function Kt(Xr){let eo,to,ro,no,io,oo=(Xr[0].title??Xr[0].name)+"",ao,so,co,lo=(Xr[0].subtitle??"")+"",uo,ho,go,bo;function wo(Co,Ro){var Oo;return Co[2]===((Oo=Co[0])==null?void 0:Oo.id)?rr:Co[4]?tr:er}let Eo=wo(Xr),$o=Eo(Xr);return{c(){eo=A("li"),to=A("span"),ro=T(),no=A("div"),io=A("p"),ao=U(oo),so=T(),co=A("p"),uo=U(lo),ho=T(),$o.c(),f(to,"class","w-8 h-8"),f(io,"class","font-semibold text-base p"),f(co,"class","l2 p"),Qe(co,"text-align","center"),f(no,"class","flex flex-col justify-center items-center"),f(eo,"class",`flex flex-row-reverse justify-between items-center p-3 rounded-md cursor-pointer shadow-list-item dark:shadow-none dark:bg-neutral-800 dark:text-white hover:bg-neutral-100 dark:hover:bg-neutral-700 focus:outline-none focus:ring-2 focus:ring-neutral-200 dark:focus:ring-neutral-700 - transition-colors`),f(eo,"role","button"),f(eo,"tabindex","0")},m(ko,Ao){B(ko,eo,Ao),y(eo,to),y(eo,ro),y(eo,no),y(no,io),y(io,ao),y(no,so),y(no,co),y(co,fo),y(eo,ho),Eo.m(eo,null),go||(yo=[C(eo,"click",Xr[8]),C(eo,"keyup",Xr[9])],go=!0)},p(ko,Ao){Ao&1&&oo!==(oo=(ko[0].title??ko[0].name)+"")&&se(ao,oo),Ao&1&&lo!==(lo=(ko[0].subtitle??"")+"")&&se(fo,lo),wo===(wo=vo(ko))&&Eo?Eo.p(ko,Ao):(Eo.d(1),Eo=wo(ko),Eo&&(Eo.c(),Eo.m(eo,null)))},d(ko){ko&&_(eo),Eo.d(),go=!1,F(yo)}}}function $t(Xr){let eo,to,ro,no,io,oo,ao=Xr[0].name+"",so,co,lo,fo,ho,go,yo,vo,wo;return{c(){eo=A("a"),to=A("li"),ro=A("span"),no=T(),io=A("p"),oo=U("Install "),so=U(ao),co=T(),lo=A("img"),f(ro,"class","w-8 h-8"),f(io,"class","font-semibold text-base p"),f(lo,"alt",fo=Xr[0].name),We(lo.src,ho=Xr[3])||f(lo,"src",ho),f(lo,"class","w-8 h-8 rounded-full"),f(to,"class",`flex flex-row-reverse justify-between items-center + transition-colors`),f(eo,"role","button"),f(eo,"tabindex","0")},m(Co,Ro){B(Co,eo,Ro),y(eo,to),y(eo,ro),y(eo,no),y(no,io),y(io,ao),y(no,so),y(no,co),y(co,uo),y(eo,ho),$o.m(eo,null),go||(bo=[C(eo,"click",Xr[8]),C(eo,"keyup",Xr[9])],go=!0)},p(Co,Ro){Ro&1&&oo!==(oo=(Co[0].title??Co[0].name)+"")&&se(ao,oo),Ro&1&&lo!==(lo=(Co[0].subtitle??"")+"")&&se(uo,lo),Eo===(Eo=wo(Co))&&$o?$o.p(Co,Ro):($o.d(1),$o=Eo(Co),$o&&($o.c(),$o.m(eo,null)))},d(Co){Co&&_(eo),$o.d(),go=!1,F(bo)}}}function $t(Xr){let eo,to,ro,no,io,oo,ao=Xr[0].name+"",so,co,lo,uo,ho,go,bo,wo,Eo;return{c(){eo=A("a"),to=A("li"),ro=A("span"),no=T(),io=A("p"),oo=U("Install "),so=U(ao),co=T(),lo=A("img"),f(ro,"class","w-8 h-8"),f(io,"class","font-semibold text-base p"),f(lo,"alt",uo=Xr[0].name),We(lo.src,ho=Xr[3])||f(lo,"src",ho),f(lo,"class","w-8 h-8 rounded-full"),f(to,"class",`flex flex-row-reverse justify-between items-center p-3 rounded-md cursor-pointer shadow-list-item dark:shadow-none dark:bg-neutral-800 dark:text-white - hover:bg-neutral-100 dark:hover:bg-neutral-700`),f(eo,"aria-label",go=Xr[0].name+" download link"),f(eo,"href",yo=Xr[0].download),f(eo,"target","_blank"),f(eo,"rel","noopener noreferrer"),f(eo,"class",`rounded-md focus:outline-none focus:ring-2 - focus:ring-neutral-200 dark:focus:ring-neutral-700 transition-colors`)},m(Eo,ko){B(Eo,eo,ko),y(eo,to),y(to,ro),y(to,no),y(to,io),y(io,oo),y(io,so),y(to,co),y(to,lo),vo||(wo=[C(to,"click",Xr[6]),C(to,"keyup",Xr[7])],vo=!0)},p(Eo,ko){ko&1&&ao!==(ao=Eo[0].name+"")&&se(so,ao),ko&1&&fo!==(fo=Eo[0].name)&&f(lo,"alt",fo),ko&1&&go!==(go=Eo[0].name+" download link")&&f(eo,"aria-label",go),ko&1&&yo!==(yo=Eo[0].download)&&f(eo,"href",yo)},d(Eo){Eo&&_(eo),vo=!1,F(wo)}}}function er(Xr){let eo,to,ro;return{c(){var no;eo=A("img"),f(eo,"alt",to=(no=Xr[0])==null?void 0:no.name),We(eo.src,ro=Xr[3])||f(eo,"src",ro),f(eo,"class","w-8 h-8 rounded")},m(no,io){B(no,eo,io)},p(no,io){var oo;io&1&&to!==(to=(oo=no[0])==null?void 0:oo.name)&&f(eo,"alt",to)},d(no){no&&_(eo)}}}function tr(Xr){let eo;return{c(){eo=A("div"),Qe(eo,"position","relative")},m(to,ro){B(to,eo,ro),eo.innerHTML=Xr[3]},p:Q,d(to){to&&_(eo)}}}function rr(Xr){let eo;return{c(){eo=A("div"),eo.innerHTML=' Loading...',f(eo,"role","status")},m(to,ro){B(to,eo,ro)},p:Q,d(to){to&&_(eo)}}}function nr(Xr){let eo;function to(io,oo){return io[0].download?$t:Kt}let ro=to(Xr),no=ro(Xr);return{c(){no.c(),eo=Pe()},m(io,oo){no.m(io,oo),B(io,eo,oo)},p(io,[oo]){ro===(ro=to(io))&&no?no.p(io,oo):(no.d(1),no=ro(io),no&&(no.c(),no.m(eo.parentNode,eo)))},i:Q,o:Q,d(io){io&&_(eo),no.d(io)}}}function ir(Xr,eo,to){let{wallet:ro}=eo,{theme:no=null}=eo,{cb:io=async()=>{}}=eo,{loadingItem:oo=!1}=eo;const ao=no==="dark"?ro.icon.dark:ro.icon.light,so=ao==null?void 0:ao.startsWith("{io(null)},lo=go=>{go.key==="Enter"&&io(null)},fo=async()=>{io(ro.connector)},ho=async go=>{go.key==="Enter"&&io(ro.connector)};return Xr.$$set=go=>{"wallet"in go&&to(0,ro=go.wallet),"theme"in go&&to(5,no=go.theme),"cb"in go&&to(1,io=go.cb),"loadingItem"in go&&to(2,oo=go.loadingItem)},[ro,io,oo,ao,so,no,co,lo,fo,ho]}class or extends Xe{constructor(eo){super(),Ze(this,eo,ir,nr,Be,{wallet:0,theme:5,cb:1,loadingItem:2})}}function Ce(Xr,eo,to){const ro=Xr.slice();return ro[14]=eo[to],ro}function Se(Xr){let eo,to,ro,no,io,oo,ao,so,co,lo,fo,ho,go,yo,vo,wo=ze(Xr[1]),Eo=[];for(let Ao=0;AoK(Eo[Ao],1,1,()=>{Eo[Ao]=null});return{c(){eo=A("div"),to=A("main"),ro=A("header"),no=A("h2"),no.textContent="Connect to",io=T(),oo=A("h1"),ao=U(Xr[0]),so=T(),co=A("span"),co.innerHTML='',lo=T(),fo=A("ul");for(let Ao=0;Ao